@antv/layout 0.3.4 → 0.3.5
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/layout.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see layout.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.layout=e():t.layout=e()}(self,(()=>(()=>{var t={7294:()=>{},9586:()=>{},2697:()=>{},1894:()=>{},1186:()=>{},5275:()=>{},2862:()=>{},9633:()=>{},7222:()=>{},5965:()=>{},2391:()=>{},3945:()=>{},9216:(t,e,n)=>{"use strict";n(9504),n(3982),n(721),n(5778),n(3898),n(7536),n(5834),n(6945),n(547),n(5967),n(3515),n(3042),n(4962),n(5375)},8344:(t,e)=>{"use strict";var n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y,m,b,_,x,w,E,S,A,T;(e.UX||(e.UX={})).TextureCompressionBC="texture-compression-bc",(T=e.OB||(e.OB={})).ClampToEdge="clamp-to-edge",T.Repeat="repeat",T.MirrorRepeat="mirror-repeat",(A=e.$l||(e.$l={})).UniformBuffer="uniform-buffer",A.StorageBuffer="storage-buffer",A.ReadonlyStorageBuffer="readonly-storage-buffer",A.Sampler="sampler",A.ComparisonSampler="comparison-sampler",A.SampledTexture="sampled-texture",A.ReadonlyStorageTexture="readonly-storage-texture",A.WriteonlyStorageTexture="writeonly-storage-texture",(S=e.zi||(e.zi={})).Zero="zero",S.One="one",S.SrcColor="src-color",S.OneMinusSrcColor="one-minus-src-color",S.SrcAlpha="src-alpha",S.OneMinusSrcAlpha="one-minus-src-alpha",S.DstColor="dst-color",S.OneMinusDstColor="one-minus-dst-color",S.DstAlpha="dst-alpha",S.OneMinusDstAlpha="one-minus-dst-alpha",S.SrcAlphaSaturated="src-alpha-saturated",S.BlendColor="blend-color",S.OneMinusBlendColor="one-minus-blend-color",(E=e.db||(e.db={})).Add="add",E.Subtract="subtract",E.ReverseSubtract="reverse-subtract",E.Min="min",E.Max="max",(w=e.wb||(e.wb={})).Never="never",w.Less="less",w.Equal="equal",w.LessEqual="less-equal",w.Greater="greater",w.NotEqual="not-equal",w.GreaterEqual="greater-equal",w.Always="always",(x=e.Wf||(e.Wf={})).None="none",x.Front="front",x.Back="back",(_=e.X9||(e.X9={})).Nearest="nearest",_.Linear="linear",(b=e.zX||(e.zX={})).CCW="ccw",b.CW="cw",(m=e.iD||(e.iD={})).Uint16="uint16",m.Uint32="uint32",(y=e.V||(e.V={})).Vertex="vertex",y.Instance="instance",(e.Ws||(e.Ws={})).Load="load",(g=e.YV||(e.YV={})).PointList="point-list",g.LineList="line-list",g.LineStrip="line-strip",g.TriangleList="triangle-list",g.TriangleStrip="triangle-strip",(v=e.xS||(e.xS={})).Keep="keep",v.Zero="zero",v.Replace="replace",v.Invert="invert",v.IncrementClamp="increment-clamp",v.DecrementClamp="decrement-clamp",v.IncrementWrap="increment-wrap",v.DecrementWrap="decrement-wrap",(p=e.EG||(e.EG={})).Store="store",p.Clear="clear",(h=e.kd||(e.kd={})).E1d="1d",h.E2d="2d",h.E3d="3d",(d=e.EV||(e.EV={})).R8Unorm="r8unorm",d.R8Snorm="r8snorm",d.R8Uint="r8uint",d.R8Sint="r8sint",d.R16Uint="r16uint",d.R16Sint="r16sint",d.R16Float="r16float",d.RG8Unorm="rg8unorm",d.RG8Snorm="rg8snorm",d.RG8Uint="rg8uint",d.RG8Sint="rg8sint",d.R32Uint="r32uint",d.R32Sint="r32sint",d.R32Float="r32float",d.RG16Uint="rg16uint",d.RG16Sint="rg16sint",d.RG16Float="rg16float",d.RGBA8Unorm="rgba8unorm",d.RGBA8UnormSRGB="rgba8unorm-srgb",d.RGBA8Snorm="rgba8snorm",d.RGBA8Uint="rgba8uint",d.RGBA8Sint="rgba8sint",d.BGRA8Unorm="bgra8unorm",d.BGRA8UnormSRGB="bgra8unorm-srgb",d.RGB10A2Unorm="rgb10a2unorm",d.RG11B10Float="rg11b10float",d.RG32Uint="rg32uint",d.RG32Sint="rg32sint",d.RG32Float="rg32float",d.RGBA16Uint="rgba16uint",d.RGBA16Sint="rgba16sint",d.RGBA16Float="rgba16float",d.RGBA32Uint="rgba32uint",d.RGBA32Sint="rgba32sint",d.RGBA32Float="rgba32float",d.Depth32Float="depth32float",d.Depth24Plus="depth24plus",d.Depth24PlusStencil8="depth24plus-stencil8",(l=e.Ek||(e.Ek={})).Float="float",l.Sint="sint",l.Uint="uint",(f=e.p_||(e.p_={})).E1d="1d",f.E2d="2d",f.E2dArray="2d-array",f.Cube="cube",f.CubeArray="cube-array",f.E3d="3d",(c=e.gB||(e.gB={})).Uchar2="uchar2",c.Uchar4="uchar4",c.Char2="char2",c.Char4="char4",c.Uchar2Norm="uchar2norm",c.Uchar4Norm="uchar4norm",c.Char2Norm="char2norm",c.Char4Norm="char4norm",c.Ushort2="ushort2",c.Ushort4="ushort4",c.Short2="short2",c.Short4="short4",c.Ushort2Norm="ushort2norm",c.Ushort4Norm="ushort4norm",c.Short2Norm="short2norm",c.Short4Norm="short4norm",c.Half2="half2",c.Half4="half4",c.Float="float",c.Float2="float2",c.Float3="float3",c.Float4="float4",c.Uint="uint",c.Uint2="uint2",c.Uint3="uint3",c.Uint4="uint4",c.Int="int",c.Int2="int2",c.Int3="int3",c.Int4="int4",(s=e.H7||(e.H7={})).All="all",s.StencilOnly="stencil-only",s.DepthOnly="depth-only",(u=e.mj||(e.mj={})).Error="error",u.Warning="warning",u.Info="info",(e.xL||(e.xL={})).Occlusion="occlusion",(a=e.FB||(e.FB={}))[a.MapRead=1]="MapRead",a[a.MapWrite=2]="MapWrite",a[a.CopySrc=4]="CopySrc",a[a.CopyDst=8]="CopyDst",a[a.Index=16]="Index",a[a.Vertex=32]="Vertex",a[a.Uniform=64]="Uniform",a[a.Storage=128]="Storage",a[a.Indirect=256]="Indirect",a[a.QueryResolve=512]="QueryResolve",(o=e.Yw||(e.Yw={}))[o.Red=1]="Red",o[o.Green=2]="Green",o[o.Blue=4]="Blue",o[o.Alpha=8]="Alpha",o[o.All=15]="All",(i=e.$X||(e.$X={}))[i.Vertex=1]="Vertex",i[i.Fragment=2]="Fragment",i[i.Compute=4]="Compute",(r=e.v2||(e.v2={}))[r.CopySrc=1]="CopySrc",r[r.CopyDst=2]="CopyDst",r[r.Sampled=4]="Sampled",r[r.Storage=8]="Storage",r[r.OutputAttachment=16]="OutputAttachment",(n=e.gc||(e.gc={}))[n.Read=1]="Read",n[n.Write=2]="Write"},9504:(t,e,n)=>{n(2825),n(6051),n(2640),n(9518),n(8201),n(470),n(5723),n(7525),n(9788),n(1498),n(7577),n(6129),n(2802),n(7940),n(5261),n(9340),n(1584),n(7298),n(1765),n(5747),n(7451),n(2784),n(2809),n(7454),n(3053),n(8032),n(7551),n(2929),n(215),n(6183),n(8190),n(476),n(948),n(942),n(2870),n(2212),n(4230),n(9754),n(2811),n(3998),n(1769),n(8789),n(2848),n(1762),n(1323),n(6063),n(3282),n(6816),n(1854),n(3303),n(4421),n(2203),n(1028),n(6818),n(5557),n(7938),n(8316),n(7937),n(637),n(8219),n(9029),n(3157),n(9791),n(2296),n(4555),n(6505),n(4722),n(9713),n(7392),n(4687),n(3684),n(3339),n(4148),n(7754),n(4094),n(8781),n(5013),n(3735),n(8723),n(2247),n(9689),n(9003),n(9026),n(4088),n(535),n(5788),n(7878),n(5119),n(3135),n(5015),n(8059),n(646),n(5377),n(9879),n(5305),n(6341),n(5915),n(4488),n(9281),n(163),n(6668),n(7139),n(6408),n(8686),n(5480),n(9121),n(914),n(7742),n(7843),n(6441),n(429),n(2214),n(498),n(6349),n(3742),n(9604),n(2592),n(9290),n(9363),n(3871),n(8632),n(1838),n(3421),n(6144),n(8275),n(2552),n(3077),n(1031),n(8916),n(8978),n(8531),n(7323),n(3704),n(3153),n(8812),n(2636),n(1602),n(377),t.exports=n(2845)},721:(t,e,n)=>{n(7744),t.exports=n(2845).Array.flatMap},3982:(t,e,n)=>{n(5448),t.exports=n(2845).Array.includes},3515:(t,e,n)=>{n(8938),t.exports=n(2845).Object.entries},547:(t,e,n)=>{n(7819),t.exports=n(2845).Object.getOwnPropertyDescriptors},5967:(t,e,n)=>{n(6572),t.exports=n(2845).Object.values},3042:(t,e,n)=>{"use strict";n(7843),n(8228),t.exports=n(2845).Promise.finally},3898:(t,e,n)=>{n(3336),t.exports=n(2845).String.padEnd},5778:(t,e,n)=>{n(3718),t.exports=n(2845).String.padStart},5834:(t,e,n)=>{n(6642),t.exports=n(2845).String.trimRight},7536:(t,e,n)=>{n(7831),t.exports=n(2845).String.trimLeft},6945:(t,e,n)=>{n(9956),t.exports=n(7686).f("asyncIterator")},2680:(t,e,n)=>{n(8358),t.exports=n(3142).global},3749:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},8891:(t,e,n)=>{var r=n(2799);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},3142:t=>{var e=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},5526:(t,e,n)=>{var r=n(3749);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},7498:(t,e,n)=>{t.exports=!n(9880)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},2004:(t,e,n)=>{var r=n(2799),i=n(5505).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},2069:(t,e,n)=>{var r=n(5505),i=n(3142),o=n(5526),a=n(5954),u=n(9761),s=function(t,e,n){var c,f,l,d=t&s.F,h=t&s.G,p=t&s.S,v=t&s.P,g=t&s.B,y=t&s.W,m=h?i:i[e]||(i[e]={}),b=m.prototype,_=h?r:p?r[e]:(r[e]||{}).prototype;for(c in h&&(n=e),n)(f=!d&&_&&void 0!==_[c])&&u(m,c)||(l=f?_[c]:n[c],m[c]=h&&"function"!=typeof _[c]?n[c]:g&&f?o(l,r):y&&_[c]==l?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):v&&"function"==typeof l?o(Function.call,l):l,v&&((m.virtual||(m.virtual={}))[c]=l,t&s.R&&b&&!b[c]&&a(b,c,l)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},9880:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},5505:t=>{var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},9761:t=>{var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},5954:(t,e,n)=>{var r=n(5584),i=n(5734);t.exports=n(7498)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},4053:(t,e,n)=>{t.exports=!n(7498)&&!n(9880)((function(){return 7!=Object.defineProperty(n(2004)("div"),"a",{get:function(){return 7}}).a}))},2799:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},5584:(t,e,n)=>{var r=n(8891),i=n(4053),o=n(923),a=Object.defineProperty;e.f=n(7498)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},5734:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},923:(t,e,n)=>{var r=n(2799);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},8358:(t,e,n)=>{var r=n(2069);r(r.G,{global:n(5505)})},1464:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},8347:(t,e,n)=>{var r=n(1669);t.exports=function(t,e){if("number"!=typeof t&&"Number"!=r(t))throw TypeError(e);return+t}},4691:(t,e,n)=>{var r=n(341)("unscopables"),i=Array.prototype;null==i[r]&&n(913)(i,r,{}),t.exports=function(t){i[r][t]=!0}},178:(t,e,n)=>{"use strict";var r=n(8016)(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},6903:t=>{t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},486:(t,e,n)=>{var r=n(1255);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},1064:(t,e,n)=>{"use strict";var r=n(7583),i=n(9260),o=n(8087);t.exports=[].copyWithin||function(t,e){var n=r(this),a=o(n.length),u=i(t,a),s=i(e,a),c=arguments.length>2?arguments[2]:void 0,f=Math.min((void 0===c?a:i(c,a))-s,a-u),l=1;for(s<u&&u<s+f&&(l=-1,s+=f-1,u+=f-1);f-- >0;)s in n?n[u]=n[s]:delete n[u],u+=l,s+=l;return n}},8676:(t,e,n)=>{"use strict";var r=n(7583),i=n(9260),o=n(8087);t.exports=function(t){for(var e=r(this),n=o(e.length),a=arguments.length,u=i(a>1?arguments[1]:void 0,n),s=a>2?arguments[2]:void 0,c=void 0===s?n:i(s,n);c>u;)e[u++]=t;return e}},4538:(t,e,n)=>{var r=n(8182),i=n(8087),o=n(9260);t.exports=function(t){return function(e,n,a){var u,s=r(e),c=i(s.length),f=o(a,c);if(t&&n!=n){for(;c>f;)if((u=s[f++])!=u)return!0}else for(;c>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}}},7622:(t,e,n)=>{var r=n(994),i=n(8579),o=n(7583),a=n(8087),u=n(6699);t.exports=function(t,e){var n=1==t,s=2==t,c=3==t,f=4==t,l=6==t,d=5==t||l,h=e||u;return function(e,u,p){for(var v,g,y=o(e),m=i(y),b=r(u,p,3),_=a(m.length),x=0,w=n?h(e,_):s?h(e,0):void 0;_>x;x++)if((d||x in m)&&(g=b(v=m[x],x,y),t))if(n)w[x]=g;else if(g)switch(t){case 3:return!0;case 5:return v;case 6:return x;case 2:w.push(v)}else if(f)return!1;return l?-1:c||f?f:w}}},5336:(t,e,n)=>{var r=n(1464),i=n(7583),o=n(8579),a=n(8087);t.exports=function(t,e,n,u,s){r(e);var c=i(t),f=o(c),l=a(c.length),d=s?l-1:0,h=s?-1:1;if(n<2)for(;;){if(d in f){u=f[d],d+=h;break}if(d+=h,s?d<0:l<=d)throw TypeError("Reduce of empty array with no initial value")}for(;s?d>=0:l>d;d+=h)d in f&&(u=e(u,f[d],d,c));return u}},7600:(t,e,n)=>{var r=n(1255),i=n(7183),o=n(341)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},6699:(t,e,n)=>{var r=n(7600);t.exports=function(t,e){return new(r(t))(e)}},8366:(t,e,n)=>{"use strict";var r=n(1464),i=n(1255),o=n(8262),a=[].slice,u={},s=function(t,e,n){if(!(e in u)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";u[e]=Function("F,a","return new F("+r.join(",")+")")}return u[e](t,n)};t.exports=Function.bind||function(t){var e=r(this),n=a.call(arguments,1),u=function(){var r=n.concat(a.call(arguments));return this instanceof u?s(e,r.length,r):o(e,r,t)};return i(e.prototype)&&(u.prototype=e.prototype),u}},4939:(t,e,n)=>{var r=n(1669),i=n(341)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},1669:t=>{var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},3050:(t,e,n)=>{"use strict";var r=n(3886).f,i=n(9055),o=n(8565),a=n(994),u=n(6903),s=n(9822),c=n(966),f=n(8782),l=n(4412),d=n(1216),h=n(4278).fastKey,p=n(4664),v=d?"_s":"size",g=function(t,e){var n,r=h(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,c){var f=t((function(t,r){u(t,f,e,"_i"),t._t=e,t._i=i(null),t._f=void 0,t._l=void 0,t[v]=0,null!=r&&s(r,n,t[c],t)}));return o(f.prototype,{clear:function(){for(var t=p(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[v]=0},delete:function(t){var n=p(this,e),r=g(n,t);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[v]--}return!!r},forEach:function(t){p(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!g(p(this,e),t)}}),d&&r(f.prototype,"size",{get:function(){return p(this,e)[v]}}),f},def:function(t,e,n){var r,i,o=g(t,e);return o?o.v=n:(t._l=o={i:i=h(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=o),r&&(r.n=o),t[v]++,"F"!==i&&(t._i[i]=o)),t},getEntry:g,setStrong:function(t,e,n){c(t,e,(function(t,n){this._t=p(t,e),this._k=n,this._l=void 0}),(function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?f(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,f(1))}),n?"entries":"values",!n,!0),l(e)}}},1990:(t,e,n)=>{"use strict";var r=n(8565),i=n(4278).getWeak,o=n(486),a=n(1255),u=n(6903),s=n(9822),c=n(7622),f=n(7384),l=n(4664),d=c(5),h=c(6),p=0,v=function(t){return t._l||(t._l=new g)},g=function(){this.a=[]},y=function(t,e){return d(t.a,(function(t){return t[0]===e}))};g.prototype={get:function(t){var e=y(this,t);if(e)return e[1]},has:function(t){return!!y(this,t)},set:function(t,e){var n=y(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(t){var e=h(this.a,(function(e){return e[0]===t}));return~e&&this.a.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,n,o){var c=t((function(t,r){u(t,c,e,"_i"),t._t=e,t._i=p++,t._l=void 0,null!=r&&s(r,n,t[o],t)}));return r(c.prototype,{delete:function(t){if(!a(t))return!1;var n=i(t);return!0===n?v(l(this,e)).delete(t):n&&f(n,this._i)&&delete n[this._i]},has:function(t){if(!a(t))return!1;var n=i(t);return!0===n?v(l(this,e)).has(t):n&&f(n,this._i)}}),c},def:function(t,e,n){var r=i(o(e),!0);return!0===r?v(t).set(e,n):r[t._i]=n,t},ufstore:v}},859:(t,e,n)=>{"use strict";var r=n(7571),i=n(7044),o=n(6476),a=n(8565),u=n(4278),s=n(9822),c=n(6903),f=n(1255),l=n(5338),d=n(2803),h=n(5837),p=n(116);t.exports=function(t,e,n,v,g,y){var m=r[t],b=m,_=g?"set":"add",x=b&&b.prototype,w={},E=function(t){var e=x[t];o(x,t,"delete"==t||"has"==t?function(t){return!(y&&!f(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return y&&!f(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof b&&(y||x.forEach&&!l((function(){(new b).entries().next()})))){var S=new b,A=S[_](y?{}:-0,1)!=S,T=l((function(){S.has(1)})),I=d((function(t){new b(t)})),N=!y&&l((function(){for(var t=new b,e=5;e--;)t[_](e,e);return!t.has(-0)}));I||((b=e((function(e,n){c(e,b,t);var r=p(new m,e,b);return null!=n&&s(n,g,r[_],r),r}))).prototype=x,x.constructor=b),(T||N)&&(E("delete"),E("has"),g&&E("get")),(N||A)&&E(_),y&&x.clear&&delete x.clear}else b=v.getConstructor(e,t,g,_),a(b.prototype,n),u.NEED=!0;return h(b,t),w[t]=b,i(i.G+i.W+i.F*(b!=m),w),y||v.setStrong(b,t,g),b}},2845:t=>{var e=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},1395:(t,e,n)=>{"use strict";var r=n(3886),i=n(8328);t.exports=function(t,e,n){e in t?r.f(t,e,i(0,n)):t[e]=n}},994:(t,e,n)=>{var r=n(1464);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},4506:(t,e,n)=>{"use strict";var r=n(5338),i=Date.prototype.getTime,o=Date.prototype.toISOString,a=function(t){return t>9?t:"0"+t};t.exports=r((function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-50000000000001))}))||!r((function(){o.call(new Date(NaN))}))?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:o},9514:(t,e,n)=>{"use strict";var r=n(486),i=n(4467),o="number";t.exports=function(t){if("string"!==t&&t!==o&&"default"!==t)throw TypeError("Incorrect hint");return i(r(this),t!=o)}},5091:t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},1216:(t,e,n)=>{t.exports=!n(5338)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},3438:(t,e,n)=>{var r=n(1255),i=n(7571).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},9824:t=>{t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},6397:(t,e,n)=>{var r=n(9804),i=n(3844),o=n(4179);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,u=n(t),s=o.f,c=0;u.length>c;)s.call(t,a=u[c++])&&e.push(a);return e}},7044:(t,e,n)=>{var r=n(7571),i=n(2845),o=n(913),a=n(6476),u=n(994),s=function(t,e,n){var c,f,l,d,h=t&s.F,p=t&s.G,v=t&s.S,g=t&s.P,y=t&s.B,m=p?r:v?r[e]||(r[e]={}):(r[e]||{}).prototype,b=p?i:i[e]||(i[e]={}),_=b.prototype||(b.prototype={});for(c in p&&(n=e),n)l=((f=!h&&m&&void 0!==m[c])?m:n)[c],d=y&&f?u(l,r):g&&"function"==typeof l?u(Function.call,l):l,m&&a(m,c,l,t&s.U),b[c]!=l&&o(b,c,d),g&&_[c]!=l&&(_[c]=l)};r.core=i,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},2910:(t,e,n)=>{var r=n(341)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},5338:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},6719:(t,e,n)=>{"use strict";n(7139);var r=n(6476),i=n(913),o=n(5338),a=n(5091),u=n(341),s=n(9020),c=u("species"),f=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),l=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var d=u(t),h=!o((function(){var e={};return e[d]=function(){return 7},7!=""[t](e)})),p=h?!o((function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[c]=function(){return n}),n[d](""),!e})):void 0;if(!h||!p||"replace"===t&&!f||"split"===t&&!l){var v=/./[d],g=n(a,d,""[t],(function(t,e,n,r,i){return e.exec===s?h&&!i?{done:!0,value:v.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}})),y=g[0],m=g[1];r(String.prototype,t,y),i(RegExp.prototype,d,2==e?function(t,e){return m.call(t,this,e)}:function(t){return m.call(t,this)})}}},3649:(t,e,n)=>{"use strict";var r=n(486);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},6806:(t,e,n)=>{"use strict";var r=n(7183),i=n(1255),o=n(8087),a=n(994),u=n(341)("isConcatSpreadable");t.exports=function t(e,n,s,c,f,l,d,h){for(var p,v,g=f,y=0,m=!!d&&a(d,h,3);y<c;){if(y in s){if(p=m?m(s[y],y,n):s[y],v=!1,i(p)&&(v=void 0!==(v=p[u])?!!v:r(p)),v&&l>0)g=t(e,n,p,o(p.length),g,l-1)-1;else{if(g>=9007199254740991)throw TypeError();e[g]=p}g++}y++}return g}},9822:(t,e,n)=>{var r=n(994),i=n(4902),o=n(9981),a=n(486),u=n(8087),s=n(9685),c={},f={},l=t.exports=function(t,e,n,l,d){var h,p,v,g,y=d?function(){return t}:s(t),m=r(n,l,e?2:1),b=0;if("function"!=typeof y)throw TypeError(t+" is not iterable!");if(o(y)){for(h=u(t.length);h>b;b++)if((g=e?m(a(p=t[b])[0],p[1]):m(t[b]))===c||g===f)return g}else for(v=y.call(t);!(p=v.next()).done;)if((g=i(v,m,p.value,e))===c||g===f)return g};l.BREAK=c,l.RETURN=f},8454:(t,e,n)=>{t.exports=n(5570)("native-function-to-string",Function.toString)},7571:t=>{var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},7384:t=>{var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},913:(t,e,n)=>{var r=n(3886),i=n(8328);t.exports=n(1216)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},7680:(t,e,n)=>{var r=n(7571).document;t.exports=r&&r.documentElement},6252:(t,e,n)=>{t.exports=!n(1216)&&!n(5338)((function(){return 7!=Object.defineProperty(n(3438)("div"),"a",{get:function(){return 7}}).a}))},116:(t,e,n)=>{var r=n(1255),i=n(473).set;t.exports=function(t,e,n){var o,a=e.constructor;return a!==n&&"function"==typeof a&&(o=a.prototype)!==n.prototype&&r(o)&&i&&i(t,o),t}},8262:t=>{t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},8579:(t,e,n)=>{var r=n(1669);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},9981:(t,e,n)=>{var r=n(9740),i=n(341)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},7183:(t,e,n)=>{var r=n(1669);t.exports=Array.isArray||function(t){return"Array"==r(t)}},1272:(t,e,n)=>{var r=n(1255),i=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&i(t)===t}},1255:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},8990:(t,e,n)=>{var r=n(1255),i=n(1669),o=n(341)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},4902:(t,e,n)=>{var r=n(486);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&r(o.call(t)),e}}},4529:(t,e,n)=>{"use strict";var r=n(9055),i=n(8328),o=n(5837),a={};n(913)(a,n(341)("iterator"),(function(){return this})),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},966:(t,e,n)=>{"use strict";var r=n(2725),i=n(7044),o=n(6476),a=n(913),u=n(9740),s=n(4529),c=n(5837),f=n(9881),l=n(341)("iterator"),d=!([].keys&&"next"in[].keys()),h="keys",p="values",v=function(){return this};t.exports=function(t,e,n,g,y,m,b){s(n,e,g);var _,x,w,E=function(t){if(!d&&t in I)return I[t];switch(t){case h:case p:return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",A=y==p,T=!1,I=t.prototype,N=I[l]||I["@@iterator"]||y&&I[y],O=N||E(y),C=y?A?E("entries"):O:void 0,k="Array"==e&&I.entries||N;if(k&&(w=f(k.call(new t)))!==Object.prototype&&w.next&&(c(w,S,!0),r||"function"==typeof w[l]||a(w,l,v)),A&&N&&N.name!==p&&(T=!0,O=function(){return N.call(this)}),r&&!b||!d&&!T&&I[l]||a(I,l,O),u[e]=O,u[S]=v,y)if(_={values:A?O:E(p),keys:m?O:E(h),entries:C},b)for(x in _)x in I||o(I,x,_[x]);else i(i.P+i.F*(d||T),e,_);return _}},2803:(t,e,n)=>{var r=n(341)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},t(o)}catch(t){}return n}},8782:t=>{t.exports=function(t,e){return{value:e,done:!!t}}},9740:t=>{t.exports={}},2725:t=>{t.exports=!1},959:t=>{var e=Math.expm1;t.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:e},7682:(t,e,n)=>{var r=n(2987),i=Math.pow,o=i(2,-52),a=i(2,-23),u=i(2,127)*(2-a),s=i(2,-126);t.exports=Math.fround||function(t){var e,n,i=Math.abs(t),c=r(t);return i<s?c*(i/s/a+1/o-1/o)*s*a:(n=(e=(1+a/o)*i)-(e-i))>u||n!=n?c*(1/0):c*n}},1618:t=>{t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},2987:t=>{t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},4278:(t,e,n)=>{var r=n(4316)("meta"),i=n(1255),o=n(7384),a=n(3886).f,u=0,s=Object.isExtensible||function(){return!0},c=!n(5338)((function(){return s(Object.preventExtensions({}))})),f=function(t){a(t,r,{value:{i:"O"+ ++u,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!s(t))return"F";if(!e)return"E";f(t)}return t[r].i},getWeak:function(t,e){if(!o(t,r)){if(!s(t))return!0;if(!e)return!1;f(t)}return t[r].w},onFreeze:function(t){return c&&l.NEED&&s(t)&&!o(t,r)&&f(t),t}}},7485:(t,e,n)=>{var r=n(7571),i=n(7225).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,u=r.Promise,s="process"==n(1669)(a);t.exports=function(){var t,e,n,c=function(){var r,i;for(s&&(r=a.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(s)n=function(){a.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(u&&u.resolve){var f=u.resolve(void 0);n=function(){f.then(c)}}else n=function(){i.call(r,c)};else{var l=!0,d=document.createTextNode("");new o(c).observe(d,{characterData:!0}),n=function(){d.data=l=!l}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},449:(t,e,n)=>{"use strict";var r=n(1464);function i(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)}t.exports.f=function(t){return new i(t)}},4643:(t,e,n)=>{"use strict";var r=n(1216),i=n(9804),o=n(3844),a=n(4179),u=n(7583),s=n(8579),c=Object.assign;t.exports=!c||n(5338)((function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=c({},t)[n]||Object.keys(c({},e)).join("")!=r}))?function(t,e){for(var n=u(t),c=arguments.length,f=1,l=o.f,d=a.f;c>f;)for(var h,p=s(arguments[f++]),v=l?i(p).concat(l(p)):i(p),g=v.length,y=0;g>y;)h=v[y++],r&&!d.call(p,h)||(n[h]=p[h]);return n}:c},9055:(t,e,n)=>{var r=n(486),i=n(6283),o=n(9824),a=n(3574)("IE_PROTO"),u=function(){},s=function(){var t,e=n(3438)("iframe"),r=o.length;for(e.style.display="none",n(7680).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),s=t.F;r--;)delete s.prototype[o[r]];return s()};t.exports=Object.create||function(t,e){var n;return null!==t?(u.prototype=r(t),n=new u,u.prototype=null,n[a]=t):n=s(),void 0===e?n:i(n,e)}},3886:(t,e,n)=>{var r=n(486),i=n(6252),o=n(4467),a=Object.defineProperty;e.f=n(1216)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},6283:(t,e,n)=>{var r=n(3886),i=n(486),o=n(9804);t.exports=n(1216)?Object.defineProperties:function(t,e){i(t);for(var n,a=o(e),u=a.length,s=0;u>s;)r.f(t,n=a[s++],e[n]);return t}},5385:(t,e,n)=>{var r=n(4179),i=n(8328),o=n(8182),a=n(4467),u=n(7384),s=n(6252),c=Object.getOwnPropertyDescriptor;e.f=n(1216)?c:function(t,e){if(t=o(t),e=a(e,!0),s)try{return c(t,e)}catch(t){}if(u(t,e))return i(!r.f.call(t,e),t[e])}},3473:(t,e,n)=>{var r=n(8182),i=n(6907).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return a.slice()}}(t):i(r(t))}},6907:(t,e,n)=>{var r=n(946),i=n(9824).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},3844:(t,e)=>{e.f=Object.getOwnPropertySymbols},9881:(t,e,n)=>{var r=n(7384),i=n(7583),o=n(3574)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},946:(t,e,n)=>{var r=n(7384),i=n(8182),o=n(4538)(!1),a=n(3574)("IE_PROTO");t.exports=function(t,e){var n,u=i(t),s=0,c=[];for(n in u)n!=a&&r(u,n)&&c.push(n);for(;e.length>s;)r(u,n=e[s++])&&(~o(c,n)||c.push(n));return c}},9804:(t,e,n)=>{var r=n(946),i=n(9824);t.exports=Object.keys||function(t){return r(t,i)}},4179:(t,e)=>{e.f={}.propertyIsEnumerable},381:(t,e,n)=>{var r=n(7044),i=n(2845),o=n(5338);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*o((function(){n(1)})),"Object",a)}},6460:(t,e,n)=>{var r=n(1216),i=n(9804),o=n(8182),a=n(4179).f;t.exports=function(t){return function(e){for(var n,u=o(e),s=i(u),c=s.length,f=0,l=[];c>f;)n=s[f++],r&&!a.call(u,n)||l.push(t?[n,u[n]]:u[n]);return l}}},8125:(t,e,n)=>{var r=n(6907),i=n(3844),o=n(486),a=n(7571).Reflect;t.exports=a&&a.ownKeys||function(t){var e=r.f(o(t)),n=i.f;return n?e.concat(n(t)):e}},1885:(t,e,n)=>{var r=n(7571).parseFloat,i=n(4961).trim;t.exports=1/r(n(1644)+"-0")!=-1/0?function(t){var e=i(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},343:(t,e,n)=>{var r=n(7571).parseInt,i=n(4961).trim,o=n(1644),a=/^[-+]?0[xX]/;t.exports=8!==r(o+"08")||22!==r(o+"0x16")?function(t,e){var n=i(String(t),3);return r(n,e>>>0||(a.test(n)?16:10))}:r},9696:t=>{t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},909:(t,e,n)=>{var r=n(486),i=n(1255),o=n(449);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=o.f(t);return(0,n.resolve)(e),n.promise}},8328:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},8565:(t,e,n)=>{var r=n(6476);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},6476:(t,e,n)=>{var r=n(7571),i=n(913),o=n(7384),a=n(4316)("src"),u=n(8454),s="toString",c=(""+u).split(s);n(2845).inspectSource=function(t){return u.call(t)},(t.exports=function(t,e,n,u){var s="function"==typeof n;s&&(o(n,"name")||i(n,"name",e)),t[e]!==n&&(s&&(o(n,a)||i(n,a,t[e]?""+t[e]:c.join(String(e)))),t===r?t[e]=n:u?t[e]?t[e]=n:i(t,e,n):(delete t[e],i(t,e,n)))})(Function.prototype,s,(function(){return"function"==typeof this&&this[a]||u.call(this)}))},2968:(t,e,n)=>{"use strict";var r=n(4939),i=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var o=n.call(t,e);if("object"!=typeof o)throw new TypeError("RegExp exec method returned something other than an Object or null");return o}if("RegExp"!==r(t))throw new TypeError("RegExp#exec called on incompatible receiver");return i.call(t,e)}},9020:(t,e,n)=>{"use strict";var r,i,o=n(3649),a=RegExp.prototype.exec,u=String.prototype.replace,s=a,c=(r=/a/,i=/b*/g,a.call(r,"a"),a.call(i,"a"),0!==r.lastIndex||0!==i.lastIndex),f=void 0!==/()??/.exec("")[1];(c||f)&&(s=function(t){var e,n,r,i,s=this;return f&&(n=new RegExp("^"+s.source+"$(?!\\s)",o.call(s))),c&&(e=s.lastIndex),r=a.call(s,t),c&&r&&(s.lastIndex=s.global?r.index+r[0].length:e),f&&r&&r.length>1&&u.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r}),t.exports=s},6962:t=>{t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},473:(t,e,n)=>{var r=n(1255),i=n(486),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(994)(Function.call,n(5385).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return o(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:o}},4412:(t,e,n)=>{"use strict";var r=n(7571),i=n(3886),o=n(1216),a=n(341)("species");t.exports=function(t){var e=r[t];o&&e&&!e[a]&&i.f(e,a,{configurable:!0,get:function(){return this}})}},5837:(t,e,n)=>{var r=n(3886).f,i=n(7384),o=n(341)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},3574:(t,e,n)=>{var r=n(5570)("keys"),i=n(4316);t.exports=function(t){return r[t]||(r[t]=i(t))}},5570:(t,e,n)=>{var r=n(2845),i=n(7571),o="__core-js_shared__",a=i[o]||(i[o]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(2725)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},8713:(t,e,n)=>{var r=n(486),i=n(1464),o=n(341)("species");t.exports=function(t,e){var n,a=r(t).constructor;return void 0===a||null==(n=r(a)[o])?e:i(n)}},5296:(t,e,n)=>{"use strict";var r=n(5338);t.exports=function(t,e){return!!t&&r((function(){e?t.call(null,(function(){}),1):t.call(null)}))}},8016:(t,e,n)=>{var r=n(5845),i=n(5091);t.exports=function(t){return function(e,n){var o,a,u=String(i(e)),s=r(n),c=u.length;return s<0||s>=c?t?"":void 0:(o=u.charCodeAt(s))<55296||o>56319||s+1===c||(a=u.charCodeAt(s+1))<56320||a>57343?t?u.charAt(s):o:t?u.slice(s,s+2):a-56320+(o-55296<<10)+65536}}},5692:(t,e,n)=>{var r=n(8990),i=n(5091);t.exports=function(t,e,n){if(r(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(i(t))}},5264:(t,e,n)=>{var r=n(7044),i=n(5338),o=n(5091),a=/"/g,u=function(t,e,n,r){var i=String(o(t)),u="<"+e;return""!==n&&(u+=" "+n+'="'+String(r).replace(a,""")+'"'),u+">"+i+"</"+e+">"};t.exports=function(t,e){var n={};n[t]=e(u),r(r.P+r.F*i((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3})),"String",n)}},8261:(t,e,n)=>{var r=n(8087),i=n(5458),o=n(5091);t.exports=function(t,e,n,a){var u=String(o(t)),s=u.length,c=void 0===n?" ":String(n),f=r(e);if(f<=s||""==c)return u;var l=f-s,d=i.call(c,Math.ceil(l/c.length));return d.length>l&&(d=d.slice(0,l)),a?d+u:u+d}},5458:(t,e,n)=>{"use strict";var r=n(5845),i=n(5091);t.exports=function(t){var e=String(i(this)),n="",o=r(t);if(o<0||o==1/0)throw RangeError("Count can't be negative");for(;o>0;(o>>>=1)&&(e+=e))1&o&&(n+=e);return n}},4961:(t,e,n)=>{var r=n(7044),i=n(5091),o=n(5338),a=n(1644),u="["+a+"]",s=RegExp("^"+u+u+"*"),c=RegExp(u+u+"*$"),f=function(t,e,n){var i={},u=o((function(){return!!a[t]()||"
"!="
"[t]()})),s=i[t]=u?e(l):a[t];n&&(i[n]=s),r(r.P+r.F*u,"String",i)},l=f.trim=function(t,e){return t=String(i(t)),1&e&&(t=t.replace(s,"")),2&e&&(t=t.replace(c,"")),t};t.exports=f},1644:t=>{t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},7225:(t,e,n)=>{var r,i,o,a=n(994),u=n(8262),s=n(7680),c=n(3438),f=n(7571),l=f.process,d=f.setImmediate,h=f.clearImmediate,p=f.MessageChannel,v=f.Dispatch,g=0,y={},m=function(){var t=+this;if(y.hasOwnProperty(t)){var e=y[t];delete y[t],e()}},b=function(t){m.call(t.data)};d&&h||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return y[++g]=function(){u("function"==typeof t?t:Function(t),e)},r(g),g},h=function(t){delete y[t]},"process"==n(1669)(l)?r=function(t){l.nextTick(a(m,t,1))}:v&&v.now?r=function(t){v.now(a(m,t,1))}:p?(o=(i=new p).port2,i.port1.onmessage=b,r=a(o.postMessage,o,1)):f.addEventListener&&"function"==typeof postMessage&&!f.importScripts?(r=function(t){f.postMessage(t+"","*")},f.addEventListener("message",b,!1)):r="onreadystatechange"in c("script")?function(t){s.appendChild(c("script")).onreadystatechange=function(){s.removeChild(this),m.call(t)}}:function(t){setTimeout(a(m,t,1),0)}),t.exports={set:d,clear:h}},9260:(t,e,n)=>{var r=n(5845),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},5e3:(t,e,n)=>{var r=n(5845),i=n(8087);t.exports=function(t){if(void 0===t)return 0;var e=r(t),n=i(e);if(e!==n)throw RangeError("Wrong length!");return n}},5845:t=>{var e=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:e)(t)}},8182:(t,e,n)=>{var r=n(8579),i=n(5091);t.exports=function(t){return r(i(t))}},8087:(t,e,n)=>{var r=n(5845),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},7583:(t,e,n)=>{var r=n(5091);t.exports=function(t){return Object(r(t))}},4467:(t,e,n)=>{var r=n(1255);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},1063:(t,e,n)=>{"use strict";if(n(1216)){var r=n(2725),i=n(7571),o=n(5338),a=n(7044),u=n(604),s=n(1541),c=n(994),f=n(6903),l=n(8328),d=n(913),h=n(8565),p=n(5845),v=n(8087),g=n(5e3),y=n(9260),m=n(4467),b=n(7384),_=n(4939),x=n(1255),w=n(7583),E=n(9981),S=n(9055),A=n(9881),T=n(6907).f,I=n(9685),N=n(4316),O=n(341),C=n(7622),k=n(4538),D=n(8713),M=n(163),R=n(9740),P=n(2803),G=n(4412),L=n(8676),j=n(1064),F=n(3886),U=n(5385),B=F.f,z=U.f,V=i.RangeError,W=i.TypeError,H=i.Uint8Array,X="ArrayBuffer",q="SharedArrayBuffer",Y="BYTES_PER_ELEMENT",K=Array.prototype,Z=s.ArrayBuffer,$=s.DataView,J=C(0),Q=C(2),tt=C(3),et=C(4),nt=C(5),rt=C(6),it=k(!0),ot=k(!1),at=M.values,ut=M.keys,st=M.entries,ct=K.lastIndexOf,ft=K.reduce,lt=K.reduceRight,dt=K.join,ht=K.sort,pt=K.slice,vt=K.toString,gt=K.toLocaleString,yt=O("iterator"),mt=O("toStringTag"),bt=N("typed_constructor"),_t=N("def_constructor"),xt=u.CONSTR,wt=u.TYPED,Et=u.VIEW,St="Wrong length!",At=C(1,(function(t,e){return Ct(D(t,t[_t]),e)})),Tt=o((function(){return 1===new H(new Uint16Array([1]).buffer)[0]})),It=!!H&&!!H.prototype.set&&o((function(){new H(1).set({})})),Nt=function(t,e){var n=p(t);if(n<0||n%e)throw V("Wrong offset!");return n},Ot=function(t){if(x(t)&&wt in t)return t;throw W(t+" is not a typed array!")},Ct=function(t,e){if(!x(t)||!(bt in t))throw W("It is not a typed array constructor!");return new t(e)},kt=function(t,e){return Dt(D(t,t[_t]),e)},Dt=function(t,e){for(var n=0,r=e.length,i=Ct(t,r);r>n;)i[n]=e[n++];return i},Mt=function(t,e,n){B(t,e,{get:function(){return this._d[n]}})},Rt=function(t){var e,n,r,i,o,a,u=w(t),s=arguments.length,f=s>1?arguments[1]:void 0,l=void 0!==f,d=I(u);if(null!=d&&!E(d)){for(a=d.call(u),r=[],e=0;!(o=a.next()).done;e++)r.push(o.value);u=r}for(l&&s>2&&(f=c(f,arguments[2],2)),e=0,n=v(u.length),i=Ct(this,n);n>e;e++)i[e]=l?f(u[e],e):u[e];return i},Pt=function(){for(var t=0,e=arguments.length,n=Ct(this,e);e>t;)n[t]=arguments[t++];return n},Gt=!!H&&o((function(){gt.call(new H(1))})),Lt=function(){return gt.apply(Gt?pt.call(Ot(this)):Ot(this),arguments)},jt={copyWithin:function(t,e){return j.call(Ot(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return et(Ot(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return L.apply(Ot(this),arguments)},filter:function(t){return kt(this,Q(Ot(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return nt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return rt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){J(Ot(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return ot(Ot(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return it(Ot(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return dt.apply(Ot(this),arguments)},lastIndexOf:function(t){return ct.apply(Ot(this),arguments)},map:function(t){return At(Ot(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ft.apply(Ot(this),arguments)},reduceRight:function(t){return lt.apply(Ot(this),arguments)},reverse:function(){for(var t,e=this,n=Ot(e).length,r=Math.floor(n/2),i=0;i<r;)t=e[i],e[i++]=e[--n],e[n]=t;return e},some:function(t){return tt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return ht.call(Ot(this),t)},subarray:function(t,e){var n=Ot(this),r=n.length,i=y(t,r);return new(D(n,n[_t]))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,v((void 0===e?r:y(e,r))-i))}},Ft=function(t,e){return kt(this,pt.call(Ot(this),t,e))},Ut=function(t){Ot(this);var e=Nt(arguments[1],1),n=this.length,r=w(t),i=v(r.length),o=0;if(i+e>n)throw V(St);for(;o<i;)this[e+o]=r[o++]},Bt={entries:function(){return st.call(Ot(this))},keys:function(){return ut.call(Ot(this))},values:function(){return at.call(Ot(this))}},zt=function(t,e){return x(t)&&t[wt]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Vt=function(t,e){return zt(t,e=m(e,!0))?l(2,t[e]):z(t,e)},Wt=function(t,e,n){return!(zt(t,e=m(e,!0))&&x(n)&&b(n,"value"))||b(n,"get")||b(n,"set")||n.configurable||b(n,"writable")&&!n.writable||b(n,"enumerable")&&!n.enumerable?B(t,e,n):(t[e]=n.value,t)};xt||(U.f=Vt,F.f=Wt),a(a.S+a.F*!xt,"Object",{getOwnPropertyDescriptor:Vt,defineProperty:Wt}),o((function(){vt.call({})}))&&(vt=gt=function(){return dt.call(this)});var Ht=h({},jt);h(Ht,Bt),d(Ht,yt,Bt.values),h(Ht,{slice:Ft,set:Ut,constructor:function(){},toString:vt,toLocaleString:Lt}),Mt(Ht,"buffer","b"),Mt(Ht,"byteOffset","o"),Mt(Ht,"byteLength","l"),Mt(Ht,"length","e"),B(Ht,mt,{get:function(){return this[wt]}}),t.exports=function(t,e,n,s){var c=t+((s=!!s)?"Clamped":"")+"Array",l="get"+t,h="set"+t,p=i[c],y=p||{},m=p&&A(p),b=!p||!u.ABV,w={},E=p&&p.prototype,I=function(t,n){B(t,n,{get:function(){return function(t,n){var r=t._d;return r.v[l](n*e+r.o,Tt)}(this,n)},set:function(t){return function(t,n,r){var i=t._d;s&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),i.v[h](n*e+i.o,r,Tt)}(this,n,t)},enumerable:!0})};b?(p=n((function(t,n,r,i){f(t,p,c,"_d");var o,a,u,s,l=0,h=0;if(x(n)){if(!(n instanceof Z||(s=_(n))==X||s==q))return wt in n?Dt(p,n):Rt.call(p,n);o=n,h=Nt(r,e);var y=n.byteLength;if(void 0===i){if(y%e)throw V(St);if((a=y-h)<0)throw V(St)}else if((a=v(i)*e)+h>y)throw V(St);u=a/e}else u=g(n),o=new Z(a=u*e);for(d(t,"_d",{b:o,o:h,l:a,e:u,v:new $(o)});l<u;)I(t,l++)})),E=p.prototype=S(Ht),d(E,"constructor",p)):o((function(){p(1)}))&&o((function(){new p(-1)}))&&P((function(t){new p,new p(null),new p(1.5),new p(t)}),!0)||(p=n((function(t,n,r,i){var o;return f(t,p,c),x(n)?n instanceof Z||(o=_(n))==X||o==q?void 0!==i?new y(n,Nt(r,e),i):void 0!==r?new y(n,Nt(r,e)):new y(n):wt in n?Dt(p,n):Rt.call(p,n):new y(g(n))})),J(m!==Function.prototype?T(y).concat(T(m)):T(y),(function(t){t in p||d(p,t,y[t])})),p.prototype=E,r||(E.constructor=p));var N=E[yt],O=!!N&&("values"==N.name||null==N.name),C=Bt.values;d(p,bt,!0),d(E,wt,c),d(E,Et,!0),d(E,_t,p),(s?new p(1)[mt]==c:mt in E)||B(E,mt,{get:function(){return c}}),w[c]=p,a(a.G+a.W+a.F*(p!=y),w),a(a.S,c,{BYTES_PER_ELEMENT:e}),a(a.S+a.F*o((function(){y.of.call(p,1)})),c,{from:Rt,of:Pt}),Y in E||d(E,Y,e),a(a.P,c,jt),G(c),a(a.P+a.F*It,c,{set:Ut}),a(a.P+a.F*!O,c,Bt),r||E.toString==vt||(E.toString=vt),a(a.P+a.F*o((function(){new p(1).slice()})),c,{slice:Ft}),a(a.P+a.F*(o((function(){return[1,2].toLocaleString()!=new p([1,2]).toLocaleString()}))||!o((function(){E.toLocaleString.call([1,2])}))),c,{toLocaleString:Lt}),R[c]=O?N:C,r||O||d(E,yt,C)}}else t.exports=function(){}},1541:(t,e,n)=>{"use strict";var r=n(7571),i=n(1216),o=n(2725),a=n(604),u=n(913),s=n(8565),c=n(5338),f=n(6903),l=n(5845),d=n(8087),h=n(5e3),p=n(6907).f,v=n(3886).f,g=n(8676),y=n(5837),m="ArrayBuffer",b="DataView",_="Wrong index!",x=r.ArrayBuffer,w=r.DataView,E=r.Math,S=r.RangeError,A=r.Infinity,T=x,I=E.abs,N=E.pow,O=E.floor,C=E.log,k=E.LN2,D="buffer",M="byteLength",R="byteOffset",P=i?"_b":D,G=i?"_l":M,L=i?"_o":R;function j(t,e,n){var r,i,o,a=new Array(n),u=8*n-e-1,s=(1<<u)-1,c=s>>1,f=23===e?N(2,-24)-N(2,-77):0,l=0,d=t<0||0===t&&1/t<0?1:0;for((t=I(t))!=t||t===A?(i=t!=t?1:0,r=s):(r=O(C(t)/k),t*(o=N(2,-r))<1&&(r--,o*=2),(t+=r+c>=1?f/o:f*N(2,1-c))*o>=2&&(r++,o/=2),r+c>=s?(i=0,r=s):r+c>=1?(i=(t*o-1)*N(2,e),r+=c):(i=t*N(2,c-1)*N(2,e),r=0));e>=8;a[l++]=255&i,i/=256,e-=8);for(r=r<<e|i,u+=e;u>0;a[l++]=255&r,r/=256,u-=8);return a[--l]|=128*d,a}function F(t,e,n){var r,i=8*n-e-1,o=(1<<i)-1,a=o>>1,u=i-7,s=n-1,c=t[s--],f=127&c;for(c>>=7;u>0;f=256*f+t[s],s--,u-=8);for(r=f&(1<<-u)-1,f>>=-u,u+=e;u>0;r=256*r+t[s],s--,u-=8);if(0===f)f=1-a;else{if(f===o)return r?NaN:c?-A:A;r+=N(2,e),f-=a}return(c?-1:1)*r*N(2,f-e)}function U(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function B(t){return[255&t]}function z(t){return[255&t,t>>8&255]}function V(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function W(t){return j(t,52,8)}function H(t){return j(t,23,4)}function X(t,e,n){v(t.prototype,e,{get:function(){return this[n]}})}function q(t,e,n,r){var i=h(+n);if(i+e>t[G])throw S(_);var o=t[P]._b,a=i+t[L],u=o.slice(a,a+e);return r?u:u.reverse()}function Y(t,e,n,r,i,o){var a=h(+n);if(a+e>t[G])throw S(_);for(var u=t[P]._b,s=a+t[L],c=r(+i),f=0;f<e;f++)u[s+f]=c[o?f:e-f-1]}if(a.ABV){if(!c((function(){x(1)}))||!c((function(){new x(-1)}))||c((function(){return new x,new x(1.5),new x(NaN),x.name!=m}))){for(var K,Z=(x=function(t){return f(this,x),new T(h(t))}).prototype=T.prototype,$=p(T),J=0;$.length>J;)(K=$[J++])in x||u(x,K,T[K]);o||(Z.constructor=x)}var Q=new w(new x(2)),tt=w.prototype.setInt8;Q.setInt8(0,2147483648),Q.setInt8(1,2147483649),!Q.getInt8(0)&&Q.getInt8(1)||s(w.prototype,{setInt8:function(t,e){tt.call(this,t,e<<24>>24)},setUint8:function(t,e){tt.call(this,t,e<<24>>24)}},!0)}else x=function(t){f(this,x,m);var e=h(t);this._b=g.call(new Array(e),0),this[G]=e},w=function(t,e,n){f(this,w,b),f(t,x,b);var r=t[G],i=l(e);if(i<0||i>r)throw S("Wrong offset!");if(i+(n=void 0===n?r-i:d(n))>r)throw S("Wrong length!");this[P]=t,this[L]=i,this[G]=n},i&&(X(x,M,"_l"),X(w,D,"_b"),X(w,M,"_l"),X(w,R,"_o")),s(w.prototype,{getInt8:function(t){return q(this,1,t)[0]<<24>>24},getUint8:function(t){return q(this,1,t)[0]},getInt16:function(t){var e=q(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=q(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return U(q(this,4,t,arguments[1]))},getUint32:function(t){return U(q(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return F(q(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return F(q(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){Y(this,1,t,B,e)},setUint8:function(t,e){Y(this,1,t,B,e)},setInt16:function(t,e){Y(this,2,t,z,e,arguments[2])},setUint16:function(t,e){Y(this,2,t,z,e,arguments[2])},setInt32:function(t,e){Y(this,4,t,V,e,arguments[2])},setUint32:function(t,e){Y(this,4,t,V,e,arguments[2])},setFloat32:function(t,e){Y(this,4,t,H,e,arguments[2])},setFloat64:function(t,e){Y(this,8,t,W,e,arguments[2])}});y(x,m),y(w,b),u(w.prototype,a.VIEW,!0),e.ArrayBuffer=x,e.DataView=w},604:(t,e,n)=>{for(var r,i=n(7571),o=n(913),a=n(4316),u=a("typed_array"),s=a("view"),c=!(!i.ArrayBuffer||!i.DataView),f=c,l=0,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(r=i[d[l++]])?(o(r.prototype,u,!0),o(r.prototype,s,!0)):f=!1;t.exports={ABV:c,CONSTR:f,TYPED:u,VIEW:s}},4316:t=>{var e=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+n).toString(36))}},2541:(t,e,n)=>{var r=n(7571).navigator;t.exports=r&&r.userAgent||""},4664:(t,e,n)=>{var r=n(1255);t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},6262:(t,e,n)=>{var r=n(7571),i=n(2845),o=n(2725),a=n(7686),u=n(3886).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||u(e,t,{value:a.f(t)})}},7686:(t,e,n)=>{e.f=n(341)},341:(t,e,n)=>{var r=n(5570)("wks"),i=n(4316),o=n(7571).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},9685:(t,e,n)=>{var r=n(4939),i=n(341)("iterator"),o=n(9740);t.exports=n(2845).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[r(t)]}},5305:(t,e,n)=>{var r=n(7044);r(r.P,"Array",{copyWithin:n(1064)}),n(4691)("copyWithin")},5015:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(4);r(r.P+r.F*!n(5296)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},6341:(t,e,n)=>{var r=n(7044);r(r.P,"Array",{fill:n(8676)}),n(4691)("fill")},5119:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(2);r(r.P+r.F*!n(5296)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},4488:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(6),o="findIndex",a=!0;o in[]&&Array(1)[o]((function(){a=!1})),r(r.P+r.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(4691)(o)},5915:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(5),o="find",a=!0;o in[]&&Array(1).find((function(){a=!1})),r(r.P+r.F*a,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(4691)(o)},5788:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(0),o=n(5296)([].forEach,!0);r(r.P+r.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},9689:(t,e,n)=>{"use strict";var r=n(994),i=n(7044),o=n(7583),a=n(4902),u=n(9981),s=n(8087),c=n(1395),f=n(9685);i(i.S+i.F*!n(2803)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,i,l,d=o(t),h="function"==typeof this?this:Array,p=arguments.length,v=p>1?arguments[1]:void 0,g=void 0!==v,y=0,m=f(d);if(g&&(v=r(v,p>2?arguments[2]:void 0,2)),null==m||h==Array&&u(m))for(n=new h(e=s(d.length));e>y;y++)c(n,y,g?v(d[y],y):d[y]);else for(l=m.call(d),n=new h;!(i=l.next()).done;y++)c(n,y,g?a(l,v,[i.value,y],!0):i.value);return n.length=y,n}})},5377:(t,e,n)=>{"use strict";var r=n(7044),i=n(4538)(!1),o=[].indexOf,a=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(5296)(o)),"Array",{indexOf:function(t){return a?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},2247:(t,e,n)=>{var r=n(7044);r(r.S,"Array",{isArray:n(7183)})},163:(t,e,n)=>{"use strict";var r=n(4691),i=n(8782),o=n(9740),a=n(8182);t.exports=n(966)(Array,"Array",(function(t,e){this._t=a(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},9026:(t,e,n)=>{"use strict";var r=n(7044),i=n(8182),o=[].join;r(r.P+r.F*(n(8579)!=Object||!n(5296)(o)),"Array",{join:function(t){return o.call(i(this),void 0===t?",":t)}})},9879:(t,e,n)=>{"use strict";var r=n(7044),i=n(8182),o=n(5845),a=n(8087),u=[].lastIndexOf,s=!!u&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(s||!n(5296)(u)),"Array",{lastIndexOf:function(t){if(s)return u.apply(this,arguments)||0;var e=i(this),n=a(e.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,o(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in e&&e[r]===t)return r||0;return-1}})},7878:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(1);r(r.P+r.F*!n(5296)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},9003:(t,e,n)=>{"use strict";var r=n(7044),i=n(1395);r(r.S+r.F*n(5338)((function(){function t(){}return!(Array.of.call(t)instanceof t)})),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);e>t;)i(n,t,arguments[t++]);return n.length=e,n}})},646:(t,e,n)=>{"use strict";var r=n(7044),i=n(5336);r(r.P+r.F*!n(5296)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},8059:(t,e,n)=>{"use strict";var r=n(7044),i=n(5336);r(r.P+r.F*!n(5296)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},4088:(t,e,n)=>{"use strict";var r=n(7044),i=n(7680),o=n(1669),a=n(9260),u=n(8087),s=[].slice;r(r.P+r.F*n(5338)((function(){i&&s.call(i)})),"Array",{slice:function(t,e){var n=u(this.length),r=o(this);if(e=void 0===e?n:e,"Array"==r)return s.call(this,t,e);for(var i=a(t,n),c=a(e,n),f=u(c-i),l=new Array(f),d=0;d<f;d++)l[d]="String"==r?this.charAt(i+d):this[i+d];return l}})},3135:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(3);r(r.P+r.F*!n(5296)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},535:(t,e,n)=>{"use strict";var r=n(7044),i=n(1464),o=n(7583),a=n(5338),u=[].sort,s=[1,2,3];r(r.P+r.F*(a((function(){s.sort(void 0)}))||!a((function(){s.sort(null)}))||!n(5296)(u)),"Array",{sort:function(t){return void 0===t?u.call(o(this)):u.call(o(this),i(t))}})},9281:(t,e,n)=>{n(4412)("Array")},4094:(t,e,n)=>{var r=n(7044);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},5013:(t,e,n)=>{var r=n(7044),i=n(4506);r(r.P+r.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},8781:(t,e,n)=>{"use strict";var r=n(7044),i=n(7583),o=n(4467);r(r.P+r.F*n(5338)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(t){var e=i(this),n=o(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},8723:(t,e,n)=>{var r=n(341)("toPrimitive"),i=Date.prototype;r in i||n(913)(i,r,n(9514))},3735:(t,e,n)=>{var r=Date.prototype,i="Invalid Date",o=r.toString,a=r.getTime;new Date(NaN)+""!=i&&n(6476)(r,"toString",(function(){var t=a.call(this);return t==t?o.call(this):i}))},1765:(t,e,n)=>{var r=n(7044);r(r.P,"Function",{bind:n(8366)})},7451:(t,e,n)=>{"use strict";var r=n(1255),i=n(9881),o=n(341)("hasInstance"),a=Function.prototype;o in a||n(3886).f(a,o,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},5747:(t,e,n)=>{var r=n(3886).f,i=Function.prototype,o=/^\s*function ([^ (]*)/,a="name";a in i||n(1216)&&r(i,a,{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},6441:(t,e,n)=>{"use strict";var r=n(3050),i=n(4664),o="Map";t.exports=n(859)(o,(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{get:function(t){var e=r.getEntry(i(this,o),t);return e&&e.v},set:function(t,e){return r.def(i(this,o),0===t?0:t,e)}},r,!0)},2212:(t,e,n)=>{var r=n(7044),i=n(1618),o=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},4230:(t,e,n)=>{var r=n(7044),i=Math.asinh;r(r.S+r.F*!(i&&1/i(0)>0),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}})},9754:(t,e,n)=>{var r=n(7044),i=Math.atanh;r(r.S+r.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},2811:(t,e,n)=>{var r=n(7044),i=n(2987);r(r.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},3998:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},1769:(t,e,n)=>{var r=n(7044),i=Math.exp;r(r.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},8789:(t,e,n)=>{var r=n(7044),i=n(959);r(r.S+r.F*(i!=Math.expm1),"Math",{expm1:i})},2848:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{fround:n(7682)})},1762:(t,e,n)=>{var r=n(7044),i=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,o=0,a=0,u=arguments.length,s=0;a<u;)s<(n=i(arguments[a++]))?(o=o*(r=s/n)*r+1,s=n):o+=n>0?(r=n/s)*r:n;return s===1/0?1/0:s*Math.sqrt(o)}})},1323:(t,e,n)=>{var r=n(7044),i=Math.imul;r(r.S+r.F*n(5338)((function(){return-5!=i(4294967295,5)||2!=i.length})),"Math",{imul:function(t,e){var n=65535,r=+t,i=+e,o=n&r,a=n&i;return 0|o*a+((n&r>>>16)*a+o*(n&i>>>16)<<16>>>0)}})},6063:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},3282:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{log1p:n(1618)})},6816:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},1854:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{sign:n(2987)})},3303:(t,e,n)=>{var r=n(7044),i=n(959),o=Math.exp;r(r.S+r.F*n(5338)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},4421:(t,e,n)=>{var r=n(7044),i=n(959),o=Math.exp;r(r.S,"Math",{tanh:function(t){var e=i(t=+t),n=i(-t);return e==1/0?1:n==1/0?-1:(e-n)/(o(t)+o(-t))}})},2203:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},7454:(t,e,n)=>{"use strict";var r=n(7571),i=n(7384),o=n(1669),a=n(116),u=n(4467),s=n(5338),c=n(6907).f,f=n(5385).f,l=n(3886).f,d=n(4961).trim,h="Number",p=r.Number,v=p,g=p.prototype,y=o(n(9055)(g))==h,m="trim"in String.prototype,b=function(t){var e=u(t,!1);if("string"==typeof e&&e.length>2){var n,r,i,o=(e=m?e.trim():d(e,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(e.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+e}for(var a,s=e.slice(2),c=0,f=s.length;c<f;c++)if((a=s.charCodeAt(c))<48||a>i)return NaN;return parseInt(s,r)}}return+e};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof p&&(y?s((function(){g.valueOf.call(n)})):o(n)!=h)?a(new v(b(e)),n,p):b(e)};for(var _,x=n(1216)?c(v):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),w=0;x.length>w;w++)i(v,_=x[w])&&!i(p,_)&&l(p,_,f(v,_));p.prototype=g,g.constructor=p,n(6476)(r,h,p)}},7551:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},2929:(t,e,n)=>{var r=n(7044),i=n(7571).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},215:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{isInteger:n(1272)})},6183:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{isNaN:function(t){return t!=t}})},8190:(t,e,n)=>{var r=n(7044),i=n(1272),o=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},476:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},948:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},942:(t,e,n)=>{var r=n(7044),i=n(1885);r(r.S+r.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},2870:(t,e,n)=>{var r=n(7044),i=n(343);r(r.S+r.F*(Number.parseInt!=i),"Number",{parseInt:i})},3053:(t,e,n)=>{"use strict";var r=n(7044),i=n(5845),o=n(8347),a=n(5458),u=1..toFixed,s=Math.floor,c=[0,0,0,0,0,0],f="Number.toFixed: incorrect invocation!",l="0",d=function(t,e){for(var n=-1,r=e;++n<6;)r+=t*c[n],c[n]=r%1e7,r=s(r/1e7)},h=function(t){for(var e=6,n=0;--e>=0;)n+=c[e],c[e]=s(n/t),n=n%t*1e7},p=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==c[t]){var n=String(c[t]);e=""===e?n:e+a.call(l,7-n.length)+n}return e},v=function(t,e,n){return 0===e?n:e%2==1?v(t,e-1,n*t):v(t*t,e/2,n)};r(r.P+r.F*(!!u&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(5338)((function(){u.call({})}))),"Number",{toFixed:function(t){var e,n,r,u,s=o(this,f),c=i(t),g="",y=l;if(c<0||c>20)throw RangeError(f);if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return String(s);if(s<0&&(g="-",s=-s),s>1e-21)if(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(s*v(2,69,1))-69,n=e<0?s*v(2,-e,1):s/v(2,e,1),n*=4503599627370496,(e=52-e)>0){for(d(0,n),r=c;r>=7;)d(1e7,0),r-=7;for(d(v(10,r,1),0),r=e-1;r>=23;)h(1<<23),r-=23;h(1<<r),d(1,1),h(2),y=p()}else d(0,n),d(1<<-e,0),y=p()+a.call(l,c);return c>0?g+((u=y.length)<=c?"0."+a.call(l,c-u)+y:y.slice(0,u-c)+"."+y.slice(u-c)):g+y}})},8032:(t,e,n)=>{"use strict";var r=n(7044),i=n(5338),o=n(8347),a=1..toPrecision;r(r.P+r.F*(i((function(){return"1"!==a.call(1,void 0)}))||!i((function(){a.call({})}))),"Number",{toPrecision:function(t){var e=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},5261:(t,e,n)=>{var r=n(7044);r(r.S+r.F,"Object",{assign:n(4643)})},6051:(t,e,n)=>{var r=n(7044);r(r.S,"Object",{create:n(9055)})},9518:(t,e,n)=>{var r=n(7044);r(r.S+r.F*!n(1216),"Object",{defineProperties:n(6283)})},2640:(t,e,n)=>{var r=n(7044);r(r.S+r.F*!n(1216),"Object",{defineProperty:n(3886).f})},9788:(t,e,n)=>{var r=n(1255),i=n(4278).onFreeze;n(381)("freeze",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},8201:(t,e,n)=>{var r=n(8182),i=n(5385).f;n(381)("getOwnPropertyDescriptor",(function(){return function(t,e){return i(r(t),e)}}))},7525:(t,e,n)=>{n(381)("getOwnPropertyNames",(function(){return n(3473).f}))},470:(t,e,n)=>{var r=n(7583),i=n(9881);n(381)("getPrototypeOf",(function(){return function(t){return i(r(t))}}))},7940:(t,e,n)=>{var r=n(1255);n(381)("isExtensible",(function(t){return function(e){return!!r(e)&&(!t||t(e))}}))},6129:(t,e,n)=>{var r=n(1255);n(381)("isFrozen",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},2802:(t,e,n)=>{var r=n(1255);n(381)("isSealed",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},9340:(t,e,n)=>{var r=n(7044);r(r.S,"Object",{is:n(6962)})},5723:(t,e,n)=>{var r=n(7583),i=n(9804);n(381)("keys",(function(){return function(t){return i(r(t))}}))},7577:(t,e,n)=>{var r=n(1255),i=n(4278).onFreeze;n(381)("preventExtensions",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},1498:(t,e,n)=>{var r=n(1255),i=n(4278).onFreeze;n(381)("seal",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},1584:(t,e,n)=>{var r=n(7044);r(r.S,"Object",{setPrototypeOf:n(473).set})},7298:(t,e,n)=>{"use strict";var r=n(4939),i={};i[n(341)("toStringTag")]="z",i+""!="[object z]"&&n(6476)(Object.prototype,"toString",(function(){return"[object "+r(this)+"]"}),!0)},2809:(t,e,n)=>{var r=n(7044),i=n(1885);r(r.G+r.F*(parseFloat!=i),{parseFloat:i})},2784:(t,e,n)=>{var r=n(7044),i=n(343);r(r.G+r.F*(parseInt!=i),{parseInt:i})},7843:(t,e,n)=>{"use strict";var r,i,o,a,u=n(2725),s=n(7571),c=n(994),f=n(4939),l=n(7044),d=n(1255),h=n(1464),p=n(6903),v=n(9822),g=n(8713),y=n(7225).set,m=n(7485)(),b=n(449),_=n(9696),x=n(2541),w=n(909),E="Promise",S=s.TypeError,A=s.process,T=A&&A.versions,I=T&&T.v8||"",N=s.Promise,O="process"==f(A),C=function(){},k=i=b.f,D=!!function(){try{var t=N.resolve(1),e=(t.constructor={})[n(341)("species")]=function(t){t(C,C)};return(O||"function"==typeof PromiseRejectionEvent)&&t.then(C)instanceof e&&0!==I.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),M=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},R=function(t,e){if(!t._n){t._n=!0;var n=t._c;m((function(){for(var r=t._v,i=1==t._s,o=0,a=function(e){var n,o,a,u=i?e.ok:e.fail,s=e.resolve,c=e.reject,f=e.domain;try{u?(i||(2==t._h&&L(t),t._h=1),!0===u?n=r:(f&&f.enter(),n=u(r),f&&(f.exit(),a=!0)),n===e.promise?c(S("Promise-chain cycle")):(o=M(n))?o.call(n,s,c):s(n)):c(r)}catch(t){f&&!a&&f.exit(),c(t)}};n.length>o;)a(n[o++]);t._c=[],t._n=!1,e&&!t._h&&P(t)}))}},P=function(t){y.call(s,(function(){var e,n,r,i=t._v,o=G(t);if(o&&(e=_((function(){O?A.emit("unhandledRejection",i,t):(n=s.onunhandledrejection)?n({promise:t,reason:i}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",i)})),t._h=O||G(t)?2:1),t._a=void 0,o&&e.e)throw e.v}))},G=function(t){return 1!==t._h&&0===(t._a||t._c).length},L=function(t){y.call(s,(function(){var e;O?A.emit("rejectionHandled",t):(e=s.onrejectionhandled)&&e({promise:t,reason:t._v})}))},j=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),R(e,!0))},F=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw S("Promise can't be resolved itself");(e=M(t))?m((function(){var r={_w:n,_d:!1};try{e.call(t,c(F,r,1),c(j,r,1))}catch(t){j.call(r,t)}})):(n._v=t,n._s=1,R(n,!1))}catch(t){j.call({_w:n,_d:!1},t)}}};D||(N=function(t){p(this,N,E,"_h"),h(t),r.call(this);try{t(c(F,this,1),c(j,this,1))}catch(t){j.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(8565)(N.prototype,{then:function(t,e){var n=k(g(this,N));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=O?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&R(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r;this.promise=t,this.resolve=c(F,t,1),this.reject=c(j,t,1)},b.f=k=function(t){return t===N||t===a?new o(t):i(t)}),l(l.G+l.W+l.F*!D,{Promise:N}),n(5837)(N,E),n(4412)(E),a=n(2845).Promise,l(l.S+l.F*!D,E,{reject:function(t){var e=k(this);return(0,e.reject)(t),e.promise}}),l(l.S+l.F*(u||!D),E,{resolve:function(t){return w(u&&this===a?N:this,t)}}),l(l.S+l.F*!(D&&n(2803)((function(t){N.all(t).catch(C)}))),E,{all:function(t){var e=this,n=k(e),r=n.resolve,i=n.reject,o=_((function(){var n=[],o=0,a=1;v(t,!1,(function(t){var u=o++,s=!1;n.push(void 0),a++,e.resolve(t).then((function(t){s||(s=!0,n[u]=t,--a||r(n))}),i)})),--a||r(n)}));return o.e&&i(o.v),n.promise},race:function(t){var e=this,n=k(e),r=n.reject,i=_((function(){v(t,!1,(function(t){e.resolve(t).then(n.resolve,r)}))}));return i.e&&r(i.v),n.promise}})},8275:(t,e,n)=>{var r=n(7044),i=n(1464),o=n(486),a=(n(7571).Reflect||{}).apply,u=Function.apply;r(r.S+r.F*!n(5338)((function(){a((function(){}))})),"Reflect",{apply:function(t,e,n){var r=i(t),s=o(n);return a?a(r,e,s):u.call(r,e,s)}})},2552:(t,e,n)=>{var r=n(7044),i=n(9055),o=n(1464),a=n(486),u=n(1255),s=n(5338),c=n(8366),f=(n(7571).Reflect||{}).construct,l=s((function(){function t(){}return!(f((function(){}),[],t)instanceof t)})),d=!s((function(){f((function(){}))}));r(r.S+r.F*(l||d),"Reflect",{construct:function(t,e){o(t),a(e);var n=arguments.length<3?t:o(arguments[2]);if(d&&!l)return f(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(c.apply(t,r))}var s=n.prototype,h=i(u(s)?s:Object.prototype),p=Function.apply.call(t,h,e);return u(p)?p:h}})},3077:(t,e,n)=>{var r=n(3886),i=n(7044),o=n(486),a=n(4467);i(i.S+i.F*n(5338)((function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(t,e,n){o(t),e=a(e,!0),o(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},1031:(t,e,n)=>{var r=n(7044),i=n(5385).f,o=n(486);r(r.S,"Reflect",{deleteProperty:function(t,e){var n=i(o(t),e);return!(n&&!n.configurable)&&delete t[e]}})},8916:(t,e,n)=>{"use strict";var r=n(7044),i=n(486),o=function(t){this._t=i(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)};n(4529)(o,"Object",(function(){var t,e=this,n=e._k;do{if(e._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[e._i++])in e._t));return{value:t,done:!1}})),r(r.S,"Reflect",{enumerate:function(t){return new o(t)}})},8531:(t,e,n)=>{var r=n(5385),i=n(7044),o=n(486);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(o(t),e)}})},7323:(t,e,n)=>{var r=n(7044),i=n(9881),o=n(486);r(r.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},8978:(t,e,n)=>{var r=n(5385),i=n(9881),o=n(7384),a=n(7044),u=n(1255),s=n(486);a(a.S,"Reflect",{get:function t(e,n){var a,c,f=arguments.length<3?e:arguments[2];return s(e)===f?e[n]:(a=r.f(e,n))?o(a,"value")?a.value:void 0!==a.get?a.get.call(f):void 0:u(c=i(e))?t(c,n,f):void 0}})},3704:(t,e,n)=>{var r=n(7044);r(r.S,"Reflect",{has:function(t,e){return e in t}})},3153:(t,e,n)=>{var r=n(7044),i=n(486),o=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},8812:(t,e,n)=>{var r=n(7044);r(r.S,"Reflect",{ownKeys:n(8125)})},2636:(t,e,n)=>{var r=n(7044),i=n(486),o=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},377:(t,e,n)=>{var r=n(7044),i=n(473);i&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){i.check(t,e);try{return i.set(t,e),!0}catch(t){return!1}}})},1602:(t,e,n)=>{var r=n(3886),i=n(5385),o=n(9881),a=n(7384),u=n(7044),s=n(8328),c=n(486),f=n(1255);u(u.S,"Reflect",{set:function t(e,n,u){var l,d,h=arguments.length<4?e:arguments[3],p=i.f(c(e),n);if(!p){if(f(d=o(e)))return t(d,n,u,h);p=s(0)}if(a(p,"value")){if(!1===p.writable||!f(h))return!1;if(l=i.f(h,n)){if(l.get||l.set||!1===l.writable)return!1;l.value=u,r.f(h,n,l)}else r.f(h,n,s(0,u));return!0}return void 0!==p.set&&(p.set.call(h,u),!0)}})},6668:(t,e,n)=>{var r=n(7571),i=n(116),o=n(3886).f,a=n(6907).f,u=n(8990),s=n(3649),c=r.RegExp,f=c,l=c.prototype,d=/a/g,h=/a/g,p=new c(d)!==d;if(n(1216)&&(!p||n(5338)((function(){return h[n(341)("match")]=!1,c(d)!=d||c(h)==h||"/a/i"!=c(d,"i")})))){c=function(t,e){var n=this instanceof c,r=u(t),o=void 0===e;return!n&&r&&t.constructor===c&&o?t:i(p?new f(r&&!o?t.source:t,e):f((r=t instanceof c)?t.source:t,r&&o?s.call(t):e),n?this:l,c)};for(var v=function(t){t in c||o(c,t,{configurable:!0,get:function(){return f[t]},set:function(e){f[t]=e}})},g=a(f),y=0;g.length>y;)v(g[y++]);l.constructor=c,c.prototype=l,n(6476)(r,"RegExp",c)}n(4412)("RegExp")},7139:(t,e,n)=>{"use strict";var r=n(9020);n(7044)({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},8686:(t,e,n)=>{n(1216)&&"g"!=/./g.flags&&n(3886).f(RegExp.prototype,"flags",{configurable:!0,get:n(3649)})},5480:(t,e,n)=>{"use strict";var r=n(486),i=n(8087),o=n(178),a=n(2968);n(6719)("match",1,(function(t,e,n,u){return[function(n){var r=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=u(n,t,this);if(e.done)return e.value;var s=r(t),c=String(this);if(!s.global)return a(s,c);var f=s.unicode;s.lastIndex=0;for(var l,d=[],h=0;null!==(l=a(s,c));){var p=String(l[0]);d[h]=p,""===p&&(s.lastIndex=o(c,i(s.lastIndex),f)),h++}return 0===h?null:d}]}))},9121:(t,e,n)=>{"use strict";var r=n(486),i=n(7583),o=n(8087),a=n(5845),u=n(178),s=n(2968),c=Math.max,f=Math.min,l=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g;n(6719)("replace",2,(function(t,e,n,p){return[function(r,i){var o=t(this),a=null==r?void 0:r[e];return void 0!==a?a.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=p(n,t,this,e);if(i.done)return i.value;var l=r(t),d=String(this),h="function"==typeof e;h||(e=String(e));var g=l.global;if(g){var y=l.unicode;l.lastIndex=0}for(var m=[];;){var b=s(l,d);if(null===b)break;if(m.push(b),!g)break;""===String(b[0])&&(l.lastIndex=u(d,o(l.lastIndex),y))}for(var _,x="",w=0,E=0;E<m.length;E++){b=m[E];for(var S=String(b[0]),A=c(f(a(b.index),d.length),0),T=[],I=1;I<b.length;I++)T.push(void 0===(_=b[I])?_:String(_));var N=b.groups;if(h){var O=[S].concat(T,A,d);void 0!==N&&O.push(N);var C=String(e.apply(void 0,O))}else C=v(S,d,A,T,N,e);A>=w&&(x+=d.slice(w,A)+C,w=A+S.length)}return x+d.slice(w)}];function v(t,e,r,o,a,u){var s=r+t.length,c=o.length,f=h;return void 0!==a&&(a=i(a),f=d),n.call(u,f,(function(n,i){var u;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(s);case"<":u=a[i.slice(1,-1)];break;default:var f=+i;if(0===f)return n;if(f>c){var d=l(f/10);return 0===d?n:d<=c?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):n}u=o[f-1]}return void 0===u?"":u}))}}))},914:(t,e,n)=>{"use strict";var r=n(486),i=n(6962),o=n(2968);n(6719)("search",1,(function(t,e,n,a){return[function(n){var r=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=a(n,t,this);if(e.done)return e.value;var u=r(t),s=String(this),c=u.lastIndex;i(c,0)||(u.lastIndex=0);var f=o(u,s);return i(u.lastIndex,c)||(u.lastIndex=c),null===f?-1:f.index}]}))},7742:(t,e,n)=>{"use strict";var r=n(8990),i=n(486),o=n(8713),a=n(178),u=n(8087),s=n(2968),c=n(9020),f=n(5338),l=Math.min,d=[].push,h=4294967295,p=!f((function(){RegExp(h,"y")}));n(6719)("split",2,(function(t,e,n,f){var v;return v="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,e){var i=String(this);if(void 0===t&&0===e)return[];if(!r(t))return n.call(i,t,e);for(var o,a,u,s=[],f=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,p=void 0===e?h:e>>>0,v=new RegExp(t.source,f+"g");(o=c.call(v,i))&&!((a=v.lastIndex)>l&&(s.push(i.slice(l,o.index)),o.length>1&&o.index<i.length&&d.apply(s,o.slice(1)),u=o[0].length,l=a,s.length>=p));)v.lastIndex===o.index&&v.lastIndex++;return l===i.length?!u&&v.test("")||s.push(""):s.push(i.slice(l)),s.length>p?s.slice(0,p):s}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:n.call(this,t,e)}:n,[function(n,r){var i=t(this),o=null==n?void 0:n[e];return void 0!==o?o.call(n,i,r):v.call(String(i),n,r)},function(t,e){var r=f(v,t,this,e,v!==n);if(r.done)return r.value;var c=i(t),d=String(this),g=o(c,RegExp),y=c.unicode,m=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(p?"y":"g"),b=new g(p?c:"^(?:"+c.source+")",m),_=void 0===e?h:e>>>0;if(0===_)return[];if(0===d.length)return null===s(b,d)?[d]:[];for(var x=0,w=0,E=[];w<d.length;){b.lastIndex=p?w:0;var S,A=s(b,p?d:d.slice(w));if(null===A||(S=l(u(b.lastIndex+(p?0:w)),d.length))===x)w=a(d,w,y);else{if(E.push(d.slice(x,w)),E.length===_)return E;for(var T=1;T<=A.length-1;T++)if(E.push(A[T]),E.length===_)return E;w=x=S}}return E.push(d.slice(x)),E}]}))},6408:(t,e,n)=>{"use strict";n(8686);var r=n(486),i=n(3649),o=n(1216),a="toString",u=/./.toString,s=function(t){n(6476)(RegExp.prototype,a,t,!0)};n(5338)((function(){return"/a/b"!=u.call({source:"a",flags:"b"})}))?s((function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)})):u.name!=a&&s((function(){return u.call(this)}))},429:(t,e,n)=>{"use strict";var r=n(3050),i=n(4664);t.exports=n(859)("Set",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},3157:(t,e,n)=>{"use strict";n(5264)("anchor",(function(t){return function(e){return t(this,"a","name",e)}}))},9791:(t,e,n)=>{"use strict";n(5264)("big",(function(t){return function(){return t(this,"big","","")}}))},2296:(t,e,n)=>{"use strict";n(5264)("blink",(function(t){return function(){return t(this,"blink","","")}}))},4555:(t,e,n)=>{"use strict";n(5264)("bold",(function(t){return function(){return t(this,"b","","")}}))},8316:(t,e,n)=>{"use strict";var r=n(7044),i=n(8016)(!1);r(r.P,"String",{codePointAt:function(t){return i(this,t)}})},7937:(t,e,n)=>{"use strict";var r=n(7044),i=n(8087),o=n(5692),a="endsWith",u="".endsWith;r(r.P+r.F*n(2910)(a),"String",{endsWith:function(t){var e=o(this,t,a),n=arguments.length>1?arguments[1]:void 0,r=i(e.length),s=void 0===n?r:Math.min(i(n),r),c=String(t);return u?u.call(e,c,s):e.slice(s-c.length,s)===c}})},6505:(t,e,n)=>{"use strict";n(5264)("fixed",(function(t){return function(){return t(this,"tt","","")}}))},4722:(t,e,n)=>{"use strict";n(5264)("fontcolor",(function(t){return function(e){return t(this,"font","color",e)}}))},9713:(t,e,n)=>{"use strict";n(5264)("fontsize",(function(t){return function(e){return t(this,"font","size",e)}}))},1028:(t,e,n)=>{var r=n(7044),i=n(9260),o=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,a=0;r>a;){if(e=+arguments[a++],i(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?o(e):o(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},637:(t,e,n)=>{"use strict";var r=n(7044),i=n(5692),o="includes";r(r.P+r.F*n(2910)(o),"String",{includes:function(t){return!!~i(this,t,o).indexOf(t,arguments.length>1?arguments[1]:void 0)}})},7392:(t,e,n)=>{"use strict";n(5264)("italics",(function(t){return function(){return t(this,"i","","")}}))},7938:(t,e,n)=>{"use strict";var r=n(8016)(!0);n(966)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},4687:(t,e,n)=>{"use strict";n(5264)("link",(function(t){return function(e){return t(this,"a","href",e)}}))},6818:(t,e,n)=>{var r=n(7044),i=n(8182),o=n(8087);r(r.S,"String",{raw:function(t){for(var e=i(t.raw),n=o(e.length),r=arguments.length,a=[],u=0;n>u;)a.push(String(e[u++])),u<r&&a.push(String(arguments[u]));return a.join("")}})},8219:(t,e,n)=>{var r=n(7044);r(r.P,"String",{repeat:n(5458)})},3684:(t,e,n)=>{"use strict";n(5264)("small",(function(t){return function(){return t(this,"small","","")}}))},9029:(t,e,n)=>{"use strict";var r=n(7044),i=n(8087),o=n(5692),a="startsWith",u="".startsWith;r(r.P+r.F*n(2910)(a),"String",{startsWith:function(t){var e=o(this,t,a),n=i(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return u?u.call(e,r,n):e.slice(n,n+r.length)===r}})},3339:(t,e,n)=>{"use strict";n(5264)("strike",(function(t){return function(){return t(this,"strike","","")}}))},4148:(t,e,n)=>{"use strict";n(5264)("sub",(function(t){return function(){return t(this,"sub","","")}}))},7754:(t,e,n)=>{"use strict";n(5264)("sup",(function(t){return function(){return t(this,"sup","","")}}))},5557:(t,e,n)=>{"use strict";n(4961)("trim",(function(t){return function(){return t(this,3)}}))},2825:(t,e,n)=>{"use strict";var r=n(7571),i=n(7384),o=n(1216),a=n(7044),u=n(6476),s=n(4278).KEY,c=n(5338),f=n(5570),l=n(5837),d=n(4316),h=n(341),p=n(7686),v=n(6262),g=n(6397),y=n(7183),m=n(486),b=n(1255),_=n(7583),x=n(8182),w=n(4467),E=n(8328),S=n(9055),A=n(3473),T=n(5385),I=n(3844),N=n(3886),O=n(9804),C=T.f,k=N.f,D=A.f,M=r.Symbol,R=r.JSON,P=R&&R.stringify,G=h("_hidden"),L=h("toPrimitive"),j={}.propertyIsEnumerable,F=f("symbol-registry"),U=f("symbols"),B=f("op-symbols"),z=Object.prototype,V="function"==typeof M&&!!I.f,W=r.QObject,H=!W||!W.prototype||!W.prototype.findChild,X=o&&c((function(){return 7!=S(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=C(z,e);r&&delete z[e],k(t,e,n),r&&t!==z&&k(z,e,r)}:k,q=function(t){var e=U[t]=S(M.prototype);return e._k=t,e},Y=V&&"symbol"==typeof M.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof M},K=function(t,e,n){return t===z&&K(B,e,n),m(t),e=w(e,!0),m(n),i(U,e)?(n.enumerable?(i(t,G)&&t[G][e]&&(t[G][e]=!1),n=S(n,{enumerable:E(0,!1)})):(i(t,G)||k(t,G,E(1,{})),t[G][e]=!0),X(t,e,n)):k(t,e,n)},Z=function(t,e){m(t);for(var n,r=g(e=x(e)),i=0,o=r.length;o>i;)K(t,n=r[i++],e[n]);return t},$=function(t){var e=j.call(this,t=w(t,!0));return!(this===z&&i(U,t)&&!i(B,t))&&(!(e||!i(this,t)||!i(U,t)||i(this,G)&&this[G][t])||e)},J=function(t,e){if(t=x(t),e=w(e,!0),t!==z||!i(U,e)||i(B,e)){var n=C(t,e);return!n||!i(U,e)||i(t,G)&&t[G][e]||(n.enumerable=!0),n}},Q=function(t){for(var e,n=D(x(t)),r=[],o=0;n.length>o;)i(U,e=n[o++])||e==G||e==s||r.push(e);return r},tt=function(t){for(var e,n=t===z,r=D(n?B:x(t)),o=[],a=0;r.length>a;)!i(U,e=r[a++])||n&&!i(z,e)||o.push(U[e]);return o};V||(u((M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(n){this===z&&e.call(B,n),i(this,G)&&i(this[G],t)&&(this[G][t]=!1),X(this,t,E(1,n))};return o&&H&&X(z,t,{configurable:!0,set:e}),q(t)}).prototype,"toString",(function(){return this._k})),T.f=J,N.f=K,n(6907).f=A.f=Q,n(4179).f=$,I.f=tt,o&&!n(2725)&&u(z,"propertyIsEnumerable",$,!0),p.f=function(t){return q(h(t))}),a(a.G+a.W+a.F*!V,{Symbol:M});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)h(et[nt++]);for(var rt=O(h.store),it=0;rt.length>it;)v(rt[it++]);a(a.S+a.F*!V,"Symbol",{for:function(t){return i(F,t+="")?F[t]:F[t]=M(t)},keyFor:function(t){if(!Y(t))throw TypeError(t+" is not a symbol!");for(var e in F)if(F[e]===t)return e},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!V,"Object",{create:function(t,e){return void 0===e?S(t):Z(S(t),e)},defineProperty:K,defineProperties:Z,getOwnPropertyDescriptor:J,getOwnPropertyNames:Q,getOwnPropertySymbols:tt});var ot=c((function(){I.f(1)}));a(a.S+a.F*ot,"Object",{getOwnPropertySymbols:function(t){return I.f(_(t))}}),R&&a(a.S+a.F*(!V||c((function(){var t=M();return"[null]"!=P([t])||"{}"!=P({a:t})||"{}"!=P(Object(t))}))),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(b(e)||void 0!==t)&&!Y(t))return y(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!Y(e))return e}),r[1]=e,P.apply(R,r)}}),M.prototype[L]||n(913)(M.prototype,L,M.prototype.valueOf),l(M,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},6349:(t,e,n)=>{"use strict";var r=n(7044),i=n(604),o=n(1541),a=n(486),u=n(9260),s=n(8087),c=n(1255),f=n(7571).ArrayBuffer,l=n(8713),d=o.ArrayBuffer,h=o.DataView,p=i.ABV&&f.isView,v=d.prototype.slice,g=i.VIEW,y="ArrayBuffer";r(r.G+r.W+r.F*(f!==d),{ArrayBuffer:d}),r(r.S+r.F*!i.CONSTR,y,{isView:function(t){return p&&p(t)||c(t)&&g in t}}),r(r.P+r.U+r.F*n(5338)((function(){return!new d(2).slice(1,void 0).byteLength})),y,{slice:function(t,e){if(void 0!==v&&void 0===e)return v.call(a(this),t);for(var n=a(this).byteLength,r=u(t,n),i=u(void 0===e?n:e,n),o=new(l(this,d))(s(i-r)),c=new h(this),f=new h(o),p=0;r<i;)f.setUint8(p++,c.getUint8(r++));return o}}),n(4412)(y)},3742:(t,e,n)=>{var r=n(7044);r(r.G+r.W+r.F*!n(604).ABV,{DataView:n(1541).DataView})},3421:(t,e,n)=>{n(1063)("Float32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},6144:(t,e,n)=>{n(1063)("Float64",8,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},9363:(t,e,n)=>{n(1063)("Int16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},8632:(t,e,n)=>{n(1063)("Int32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},9604:(t,e,n)=>{n(1063)("Int8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},3871:(t,e,n)=>{n(1063)("Uint16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},1838:(t,e,n)=>{n(1063)("Uint32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},2592:(t,e,n)=>{n(1063)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},9290:(t,e,n)=>{n(1063)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}),!0)},2214:(t,e,n)=>{"use strict";var r,i=n(7571),o=n(7622)(0),a=n(6476),u=n(4278),s=n(4643),c=n(1990),f=n(1255),l=n(4664),d=n(4664),h=!i.ActiveXObject&&"ActiveXObject"in i,p="WeakMap",v=u.getWeak,g=Object.isExtensible,y=c.ufstore,m=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},b={get:function(t){if(f(t)){var e=v(t);return!0===e?y(l(this,p)).get(t):e?e[this._i]:void 0}},set:function(t,e){return c.def(l(this,p),t,e)}},_=t.exports=n(859)(p,m,b,c,!0,!0);d&&h&&(s((r=c.getConstructor(m,p)).prototype,b),u.NEED=!0,o(["delete","has","get","set"],(function(t){var e=_.prototype,n=e[t];a(e,t,(function(e,i){if(f(e)&&!g(e)){this._f||(this._f=new r);var o=this._f[t](e,i);return"set"==t?this:o}return n.call(this,e,i)}))})))},498:(t,e,n)=>{"use strict";var r=n(1990),i=n(4664),o="WeakSet";n(859)(o,(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,o),t,!0)}},r,!1,!0)},7744:(t,e,n)=>{"use strict";var r=n(7044),i=n(6806),o=n(7583),a=n(8087),u=n(1464),s=n(6699);r(r.P,"Array",{flatMap:function(t){var e,n,r=o(this);return u(t),e=a(r.length),n=s(r,0),i(n,r,r,e,0,1,t,arguments[1]),n}}),n(4691)("flatMap")},5448:(t,e,n)=>{"use strict";var r=n(7044),i=n(4538)(!0);r(r.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(4691)("includes")},8938:(t,e,n)=>{var r=n(7044),i=n(6460)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},7819:(t,e,n)=>{var r=n(7044),i=n(8125),o=n(8182),a=n(5385),u=n(1395);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=o(t),s=a.f,c=i(r),f={},l=0;c.length>l;)void 0!==(n=s(r,e=c[l++]))&&u(f,e,n);return f}})},6572:(t,e,n)=>{var r=n(7044),i=n(6460)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},8228:(t,e,n)=>{"use strict";var r=n(7044),i=n(2845),o=n(7571),a=n(8713),u=n(909);r(r.P+r.R,"Promise",{finally:function(t){var e=a(this,i.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return u(e,t()).then((function(){return n}))}:t,n?function(n){return u(e,t()).then((function(){throw n}))}:t)}})},3336:(t,e,n)=>{"use strict";var r=n(7044),i=n(8261),o=n(2541),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},3718:(t,e,n)=>{"use strict";var r=n(7044),i=n(8261),o=n(2541),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},7831:(t,e,n)=>{"use strict";n(4961)("trimLeft",(function(t){return function(){return t(this,1)}}),"trimStart")},6642:(t,e,n)=>{"use strict";n(4961)("trimRight",(function(t){return function(){return t(this,2)}}),"trimEnd")},9956:(t,e,n)=>{n(6262)("asyncIterator")},4367:(t,e,n)=>{for(var r=n(163),i=n(9804),o=n(6476),a=n(7571),u=n(913),s=n(9740),c=n(341),f=c("iterator"),l=c("toStringTag"),d=s.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=i(h),v=0;v<p.length;v++){var g,y=p[v],m=h[y],b=a[y],_=b&&b.prototype;if(_&&(_[f]||u(_,f,d),_[l]||u(_,l,y),s[y]=d,m))for(g in r)_[g]||o(_,g,r[g],!0)}},4433:(t,e,n)=>{var r=n(7044),i=n(7225);r(r.G+r.B,{setImmediate:i.set,clearImmediate:i.clear})},110:(t,e,n)=>{var r=n(7571),i=n(7044),o=n(2541),a=[].slice,u=/MSIE .\./.test(o),s=function(t){return function(e,n){var r=arguments.length>2,i=!!r&&a.call(arguments,2);return t(r?function(){("function"==typeof e?e:Function(e)).apply(this,i)}:e,n)}};i(i.G+i.B+i.F*u,{setTimeout:s(r.setTimeout),setInterval:s(r.setInterval)})},4962:(t,e,n)=>{n(110),n(4433),n(4367),t.exports=n(2845)},5229:t=>{t.exports=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}},8356:t=>{t.exports=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}},8623:t=>{t.exports=function(t){var e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e}},3422:t=>{t.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}},5128:t=>{t.exports=function(){var t=new Float32Array(2);return t[0]=0,t[1]=0,t}},134:t=>{t.exports=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}},7223:(t,e,n)=>{t.exports=n(2274)},2274:t=>{t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}},6770:(t,e,n)=>{t.exports=n(236)},236:t=>{t.exports=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}},6064:t=>{t.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]}},2157:t=>{t.exports=1e-6},6922:(t,e,n)=>{t.exports=function(t,e){var n=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(n-o)<=r*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r*Math.max(1,Math.abs(i),Math.abs(a))};var r=n(2157)},6066:t=>{t.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]}},4860:t=>{t.exports=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}},7395:(t,e,n)=>{t.exports=function(t,e,n,i,o,a){var u,s;for(e||(e=2),n||(n=0),s=i?Math.min(i*e+n,t.length):t.length,u=n;u<s;u+=e)r[0]=t[u],r[1]=t[u+1],o(r,r,a),t[u]=r[0],t[u+1]=r[1];return t};var r=n(5128)()},4697:t=>{t.exports=function(t,e){var n=new Float32Array(2);return n[0]=t,n[1]=e,n}},7801:(t,e,n)=>{t.exports={EPSILON:n(2157),create:n(5128),clone:n(8623),fromValues:n(4697),copy:n(3422),set:n(6765),equals:n(6922),exactEquals:n(6066),add:n(5229),subtract:n(4186),sub:n(5302),multiply:n(3848),mul:n(1665),divide:n(236),div:n(6770),inverse:n(1873),min:n(6780),max:n(9564),rotate:n(8615),floor:n(4860),ceil:n(8356),round:n(7313),scale:n(6526),scaleAndAdd:n(7781),distance:n(2274),dist:n(7223),squaredDistance:n(6534),sqrDist:n(4969),length:n(360),len:n(2256),squaredLength:n(5476),sqrLen:n(508),negate:n(388),normalize:n(5927),dot:n(6064),cross:n(134),lerp:n(1099),random:n(679),transformMat2:n(367),transformMat2d:n(655),transformMat3:n(2730),transformMat4:n(4020),forEach:n(7395),limit:n(8709)}},1873:t=>{t.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}},2256:(t,e,n)=>{t.exports=n(360)},360:t=>{t.exports=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}},1099:t=>{t.exports=function(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}},8709:t=>{t.exports=function(t,e,n){var r=e[0]*e[0]+e[1]*e[1];if(r>n*n){var i=Math.sqrt(r);t[0]=e[0]/i*n,t[1]=e[1]/i*n}else t[0]=e[0],t[1]=e[1];return t}},9564:t=>{t.exports=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}},6780:t=>{t.exports=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}},1665:(t,e,n)=>{t.exports=n(3848)},3848:t=>{t.exports=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}},388:t=>{t.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t}},5927:t=>{t.exports=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t}},679:t=>{t.exports=function(t,e){e=e||1;var n=2*Math.random()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}},8615:t=>{t.exports=function(t,e,n){var r=Math.cos(n),i=Math.sin(n),o=e[0],a=e[1];return t[0]=o*r-a*i,t[1]=o*i+a*r,t}},7313:t=>{t.exports=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}},6526:t=>{t.exports=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}},7781:t=>{t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}},6765:t=>{t.exports=function(t,e,n){return t[0]=e,t[1]=n,t}},4969:(t,e,n)=>{t.exports=n(6534)},508:(t,e,n)=>{t.exports=n(5476)},6534:t=>{t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}},5476:t=>{t.exports=function(t){var e=t[0],n=t[1];return e*e+n*n}},5302:(t,e,n)=>{t.exports=n(4186)},4186:t=>{t.exports=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}},367:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t}},655:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}},2730:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}},4020:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}},3039:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Symbol.for("INJECTION");function r(t,e,r,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i&&!Reflect.hasMetadata(n,this,e)&&Reflect.defineMetadata(n,r(),this,e),Reflect.hasMetadata(n,this,e)?Reflect.getMetadata(n,this,e):r()},set:function(t){Reflect.defineMetadata(n,t,this,e)}})}e.makePropertyInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.get(n)}),e)}}},e.makePropertyInjectNamedDecorator=function(t,e){return function(n,i){return function(o,a){r(o,a,(function(){return t.getNamed(n,i)}),e)}}},e.makePropertyInjectTaggedDecorator=function(t,e){return function(n,i,o){return function(a,u){r(a,u,(function(){return t.getTagged(n,i,o)}),e)}}},e.makePropertyMultiInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.getAll(n)}),e)}}}},1922:(t,e,n)=>{"use strict";var r=n(3039);e.Z=function(t,e){return void 0===e&&(e=!0),{lazyInject:r.makePropertyInjectDecorator(t,e),lazyInjectNamed:r.makePropertyInjectNamedDecorator(t,e),lazyInjectTagged:r.makePropertyInjectTaggedDecorator(t,e),lazyMultiInject:r.makePropertyMultiInjectDecorator(t,e)}}},626:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagProperty=e.tagParameter=e.decorate=void 0;var r=n(6078),i=n(295);function o(t,e,n,i,o){var a={},u="number"==typeof o,s=void 0!==o&&u?o.toString():n;if(u&&void 0!==n)throw new Error(r.INVALID_DECORATOR_OPERATION);Reflect.hasOwnMetadata(t,e)&&(a=Reflect.getMetadata(t,e));var c=a[s];if(Array.isArray(c))for(var f=0,l=c;f<l.length;f++){var d=l[f];if(d.key===i.key)throw new Error(r.DUPLICATED_METADATA+" "+d.key.toString())}else c=[];c.push(i),a[s]=c,Reflect.defineMetadata(t,a,e)}function a(t,e){Reflect.decorate(t,e)}function u(t,e){return function(n,r){e(n,r,t)}}e.tagParameter=function(t,e,n,r){o(i.TAGGED,t,e,r,n)},e.tagProperty=function(t,e,n){o(i.TAGGED_PROP,t.constructor,e,n)},e.decorate=function(t,e,n){"number"==typeof n?a([u(n,t)],e):"string"==typeof n?Reflect.decorate([t],e,n):a([t],e)}},6213:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.inject=e.LazyServiceIdentifer=void 0;var r=n(6078),i=n(295),o=n(5092),a=n(626),u=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}();e.LazyServiceIdentifer=u,e.inject=function(t){return function(e,n,u){if(void 0===t)throw new Error(r.UNDEFINED_INJECT_ANNOTATION(e.name));var s=new o.Metadata(i.INJECT_TAG,t);"number"==typeof u?a.tagParameter(e,n,u,s):a.tagProperty(e,n,s)}}},1773:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.injectable=void 0;var r=n(6078),i=n(295);e.injectable=function(){return function(t){if(Reflect.hasOwnMetadata(i.PARAM_TYPES,t))throw new Error(r.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(i.DESIGN_PARAM_TYPES,t)||[];return Reflect.defineMetadata(i.PARAM_TYPES,e,t),t}}},1528:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiInject=void 0;var r=n(295),i=n(5092),o=n(626);e.multiInject=function(t){return function(e,n,a){var u=new i.Metadata(r.MULTI_INJECT_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,u):o.tagProperty(e,n,u)}}},9817:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.named=void 0;var r=n(295),i=n(5092),o=n(626);e.named=function(t){return function(e,n,a){var u=new i.Metadata(r.NAMED_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,u):o.tagProperty(e,n,u)}}},1316:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.optional=void 0;var r=n(295),i=n(5092),o=n(626);e.optional=function(){return function(t,e,n){var a=new i.Metadata(r.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(t,e,n,a):o.tagProperty(t,e,a)}}},1971:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.postConstruct=void 0;var r=n(6078),i=n(295),o=n(5092);e.postConstruct=function(){return function(t,e,n){var a=new o.Metadata(i.POST_CONSTRUCT,e);if(Reflect.hasOwnMetadata(i.POST_CONSTRUCT,t.constructor))throw new Error(r.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(i.POST_CONSTRUCT,a,t.constructor)}}},9189:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagged=void 0;var r=n(5092),i=n(626);e.tagged=function(t,e){return function(n,o,a){var u=new r.Metadata(t,e);"number"==typeof a?i.tagParameter(n,o,a,u):i.tagProperty(n,o,u)}}},8245:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.targetName=void 0;var r=n(295),i=n(5092),o=n(626);e.targetName=function(t){return function(e,n,a){var u=new i.Metadata(r.NAME_TAG,t);o.tagParameter(e,n,a,u)}}},9235:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unmanaged=void 0;var r=n(295),i=n(5092),o=n(626);e.unmanaged=function(){return function(t,e,n){var a=new i.Metadata(r.UNMANAGED_TAG,!0);o.tagParameter(t,e,n,a)}}},683:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Binding=void 0;var r=n(7690),i=n(23),o=function(){function t(t,e){this.id=i.id(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=r.BindingTypeEnum.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===r.BindingScopeEnum.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},t}();e.Binding=o},3497:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingCount=void 0,e.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}},6078:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STACK_OVERFLOW=e.CIRCULAR_DEPENDENCY_IN_FACTORY=e.POST_CONSTRUCT_ERROR=e.MULTIPLE_POST_CONSTRUCT_METHODS=e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=e.ARGUMENTS_LENGTH_MISMATCH=e.INVALID_DECORATOR_OPERATION=e.INVALID_TO_SELF_VALUE=e.INVALID_FUNCTION_BINDING=e.INVALID_MIDDLEWARE_RETURN=e.NO_MORE_SNAPSHOTS_AVAILABLE=e.INVALID_BINDING_TYPE=e.NOT_IMPLEMENTED=e.CIRCULAR_DEPENDENCY=e.UNDEFINED_INJECT_ANNOTATION=e.MISSING_INJECT_ANNOTATION=e.MISSING_INJECTABLE_ANNOTATION=e.NOT_REGISTERED=e.CANNOT_UNBIND=e.AMBIGUOUS_MATCH=e.KEY_NOT_FOUND=e.NULL_ARGUMENT=e.DUPLICATED_METADATA=e.DUPLICATED_INJECTABLE_DECORATOR=void 0,e.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.",e.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:",e.NULL_ARGUMENT="NULL argument",e.KEY_NOT_FOUND="Key Not Found",e.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:",e.CANNOT_UNBIND="Could not unbind serviceIdentifier:",e.NOT_REGISTERED="No matching bindings found for serviceIdentifier:",e.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:",e.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:",e.UNDEFINED_INJECT_ANNOTATION=function(t){return"@inject called with undefined this could mean that the class "+t+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},e.CIRCULAR_DEPENDENCY="Circular dependency found:",e.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.",e.INVALID_BINDING_TYPE="Invalid binding type:",e.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.",e.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!",e.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!",e.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier",e.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",e.ARGUMENTS_LENGTH_MISMATCH=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."},e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",e.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class",e.POST_CONSTRUCT_ERROR=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"@postConstruct error in class "+t[0]+": "+t[1]},e.CIRCULAR_DEPENDENCY_IN_FACTORY=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"It looks like there is a circular dependency in one of the '"+t[0]+"' bindings. Please investigate bindings withservice identifier '"+t[1]+"'."},e.STACK_OVERFLOW="Maximum call stack size exceeded"},7690:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TargetTypeEnum=e.BindingTypeEnum=e.BindingScopeEnum=void 0,e.BindingScopeEnum={Request:"Request",Singleton:"Singleton",Transient:"Transient"},e.BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},e.TargetTypeEnum={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"}},295:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NON_CUSTOM_TAG_KEYS=e.POST_CONSTRUCT=e.DESIGN_PARAM_TYPES=e.PARAM_TYPES=e.TAGGED_PROP=e.TAGGED=e.MULTI_INJECT_TAG=e.INJECT_TAG=e.OPTIONAL_TAG=e.UNMANAGED_TAG=e.NAME_TAG=e.NAMED_TAG=void 0,e.NAMED_TAG="named",e.NAME_TAG="name",e.UNMANAGED_TAG="unmanaged",e.OPTIONAL_TAG="optional",e.INJECT_TAG="inject",e.MULTI_INJECT_TAG="multi_inject",e.TAGGED="inversify:tagged",e.TAGGED_PROP="inversify:tagged_props",e.PARAM_TYPES="inversify:paramtypes",e.DESIGN_PARAM_TYPES="design:paramtypes",e.POST_CONSTRUCT="post_construct",e.NON_CUSTOM_TAG_KEYS=[e.INJECT_TAG,e.MULTI_INJECT_TAG,e.NAME_TAG,e.UNMANAGED_TAG,e.NAMED_TAG,e.OPTIONAL_TAG]},596:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},o=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Container=void 0;var a=n(683),u=n(6078),s=n(7690),c=n(295),f=n(3870),l=n(4142),d=n(9386),h=n(3313),p=n(23),v=n(9552),g=n(1878),y=n(2543),m=function(){function t(t){this._appliedMiddleware=[];var e=t||{};if("object"!=typeof e)throw new Error(""+u.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(void 0===e.defaultScope)e.defaultScope=s.BindingScopeEnum.Transient;else if(e.defaultScope!==s.BindingScopeEnum.Singleton&&e.defaultScope!==s.BindingScopeEnum.Transient&&e.defaultScope!==s.BindingScopeEnum.Request)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=p.id(),this._bindingDictionary=new y.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new f.MetadataReader}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var a=new t,u=o([e,n],r).map((function(t){return l.getBindingDictionary(t)})),s=l.getBindingDictionary(a);function c(t,e){t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))}return u.forEach((function(t){c(t,s)})),a},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],a=n(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r(this,void 0,void 0,(function(){var e,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,i.label=1;case 1:return n<r.length?(o=r[n],a=e(o.id),[4,o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=function(t){return function(e){return e.moduleId===t}};e.forEach((function(e){var n=r(e.id);t._bindingDictionary.removeByCondition(n)}))},t.prototype.bind=function(t){var e=this.options.defaultScope||s.BindingScopeEnum.Transient,n=new a.Binding(t,e);return this._bindingDictionary.add(t,n),new h.BindingToSyntax(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error(u.CANNOT_UNBIND+" "+v.getServiceIdentifierAsString(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new y.Lookup},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,c.NAMED_TAG,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=l.createMockRequest(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(g.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error(u.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._appliedMiddleware=this._appliedMiddleware.concat(t);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,s.TargetTypeEnum.Variable,t)},t.prototype.getTagged=function(t,e,n){return this._get(!1,!1,s.TargetTypeEnum.Variable,t,e,n)},t.prototype.getNamed=function(t,e){return this.getTagged(t,c.NAMED_TAG,e)},t.prototype.getAll=function(t){return this._get(!0,!0,s.TargetTypeEnum.Variable,t)},t.prototype.getAllTagged=function(t,e,n){return this._get(!1,!0,s.TargetTypeEnum.Variable,t,e,n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,c.NAMED_TAG,e)},t.prototype.resolve=function(t){var e=this.createChild();return e.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){e.applyMiddleware(t)})),e.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind.bind(t)(r);return e(i,n),i}};return function(r){return{bindFunction:(i=r,function(n){var r=t.bind.bind(t)(n);return e(r,i),r}),isboundFunction:function(e){return t.isBound.bind(t)(e)},rebindFunction:n(r),unbindFunction:function(e){t.unbind.bind(t)(e)}};var i}},t.prototype._get=function(t,e,n,r,i,o){var a=null,s={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:e,key:i,serviceIdentifier:r,targetType:n,value:o};if(this._middleware){if(null==(a=this._middleware(s)))throw new Error(u.INVALID_MIDDLEWARE_RETURN)}else a=this._planAndResolve()(s);return a},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=l.plan(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return n=e.contextInterceptor(n),d.resolve(n)}},t}();e.Container=m},2913:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncContainerModule=e.ContainerModule=void 0;var r=n(23);e.ContainerModule=function(t){this.id=r.id(),this.registry=t};e.AsyncContainerModule=function(t){this.id=r.id(),this.registry=t}},1878:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContainerSnapshot=void 0;var n=function(){function t(){}return t.of=function(e,n){var r=new t;return r.bindings=e,r.middleware=n,r},t}();e.ContainerSnapshot=n},2543:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Lookup=void 0;var r=n(6078),i=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(r.NULL_ARGUMENT);if(null==e)throw new Error(r.NULL_ARGUMENT);var n=this._map.get(t);void 0!==n?(n.push(e),this._map.set(t,n)):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(r.KEY_NOT_FOUND)},t.prototype.remove=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);if(!this._map.delete(t))throw new Error(r.KEY_NOT_FOUND)},t.prototype.removeByCondition=function(t){var e=this;this._map.forEach((function(n,r){var i=n.filter((function(e){return!t(e)}));i.length>0?e._map.set(r,i):e._map.delete(r)}))},t.prototype.hasKey=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,t.clone())}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t}();e.Lookup=i},9311:(t,e,n)=>{"use strict";e.f3=e.t6=e.b2=e.W2=void 0,n(295);var r=n(596);Object.defineProperty(e,"W2",{enumerable:!0,get:function(){return r.Container}});n(7690),n(2913);var i=n(1773);Object.defineProperty(e,"b2",{enumerable:!0,get:function(){return i.injectable}});n(9189);var o=n(9817);Object.defineProperty(e,"t6",{enumerable:!0,get:function(){return o.named}});var a=n(6213);Object.defineProperty(e,"f3",{enumerable:!0,get:function(){return a.inject}});n(1316),n(9235),n(1528),n(8245),n(1971),n(3870),n(23),n(626),n(3140),n(9552),n(4384)},1519:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Context=void 0;var r=n(23),i=function(){function t(t){this.id=r.id(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}();e.Context=i},5092:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var r=n(295),i=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===r.NAMED_TAG?"named: "+this.value.toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+this.value+" }"},t}();e.Metadata=i},3870:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetadataReader=void 0;var r=n(295),i=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(r.PARAM_TYPES,t),userGeneratedMetadata:Reflect.getMetadata(r.TAGGED,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(r.TAGGED_PROP,t)||[]},t}();e.MetadataReader=i},6335:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=void 0;e.Plan=function(t,e){this.parentContext=t,this.rootRequest=e}},4142:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBindingDictionary=e.createMockRequest=e.plan=void 0;var r=n(3497),i=n(6078),o=n(7690),a=n(295),u=n(2542),s=n(9552),c=n(1519),f=n(5092),l=n(6335),d=n(6664),h=n(4810),p=n(9660);function v(t){return t._bindingDictionary}function g(t,e,n,o,a){var u,c=m(n.container,a.serviceIdentifier);return c.length===r.BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof a.serviceIdentifier&&t.getConstructorMetadata(a.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(a.serviceIdentifier).toSelf(),c=m(n.container,a.serviceIdentifier)),u=e?c:c.filter((function(t){var e=new h.Request(t.serviceIdentifier,n,o,t,a);return t.constraint(e)})),function(t,e,n,o){switch(e.length){case r.BindingCount.NoBindingsAvailable:if(n.isOptional())return e;var a=s.getServiceIdentifierAsString(t),u=i.NOT_REGISTERED;throw u+=s.listMetadataForTarget(a,n),u+=s.listRegisteredBindingsForServiceIdentifier(o,a,m),new Error(u);case r.BindingCount.OnlyOneBindingAvailable:if(!n.isArray())return e;case r.BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return e;throw a=s.getServiceIdentifierAsString(t),u=i.AMBIGUOUS_MATCH+" "+a,u+=s.listRegisteredBindingsForServiceIdentifier(o,a,m),new Error(u)}}(a.serviceIdentifier,u,a,n.container),u}function y(t,e,n,r,a,u){var s,c;if(null===a){s=g(t,e,r,null,u),c=new h.Request(n,r,null,s,u);var f=new l.Plan(r,c);r.addPlan(f)}else s=g(t,e,r,a,u),c=a.addChildRequest(u.serviceIdentifier,s,u);s.forEach((function(e){var n=null;if(u.isArray())n=c.addChildRequest(e.serviceIdentifier,e,u);else{if(e.cache)return;n=c}if(e.type===o.BindingTypeEnum.Instance&&null!==e.implementationType){var a=d.getDependencies(t,e.implementationType);if(!r.container.options.skipBaseClassChecks){var s=d.getBaseClassDependencyCount(t,e.implementationType);if(a.length<s){var f=i.ARGUMENTS_LENGTH_MISMATCH(d.getFunctionName(e.implementationType));throw new Error(f)}}a.forEach((function(e){y(t,!1,e.serviceIdentifier,r,n,e)}))}}))}function m(t,e){var n=[],r=v(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=m(t.parent,e)),n}e.getBindingDictionary=v,e.plan=function(t,e,n,r,i,o,l,d){void 0===d&&(d=!1);var h=new c.Context(e),v=function(t,e,n,r,i,o){var u=t?a.MULTI_INJECT_TAG:a.INJECT_TAG,s=new f.Metadata(u,n),c=new p.Target(e,"",n,s);if(void 0!==i){var l=new f.Metadata(i,o);c.metadata.push(l)}return c}(n,r,i,0,o,l);try{return y(t,d,i,h,null,v),h}catch(t){throw u.isStackOverflowExeption(t)&&h.plan&&s.circularDependencyToException(h.plan.rootRequest),t}},e.createMockRequest=function(t,e,n,r){var i=new p.Target(o.TargetTypeEnum.Variable,"",e,new f.Metadata(n,r)),a=new c.Context(t);return new h.Request(e,a,null,[],i)}},8634:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QueryableString=void 0;var n=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}();e.QueryableString=n},6664:function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.getFunctionName=e.getBaseClassDependencyCount=e.getDependencies=void 0;var i=n(6213),o=n(6078),a=n(7690),u=n(295),s=n(9552);Object.defineProperty(e,"getFunctionName",{enumerable:!0,get:function(){return s.getFunctionName}});var c=n(9660);function f(t,e,n,i){var a=t.getConstructorMetadata(n),u=a.compilerGeneratedMetadata;if(void 0===u){var s=o.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(s)}var c=a.userGeneratedMetadata,f=Object.keys(c),h=0===n.length&&f.length>0,p=f.length>n.length,v=function(t,e,n,r,i){for(var o=[],a=0;a<i;a++){var u=l(a,t,e,n,r);null!==u&&o.push(u)}return o}(i,e,u,c,h||p?f.length:n.length),g=d(t,n);return r(r([],v),g)}function l(t,e,n,r,u){var s=u[t.toString()]||[],f=h(s),l=!0!==f.unmanaged,d=r[t];if((d=f.inject||f.multiInject||d)instanceof i.LazyServiceIdentifer&&(d=d.unwrap()),l){if(!e&&(d===Object||d===Function||void 0===d)){var p=o.MISSING_INJECT_ANNOTATION+" argument "+t+" in class "+n+".";throw new Error(p)}var v=new c.Target(a.TargetTypeEnum.ConstructorArgument,f.targetName,d);return v.metadata=s,v}return null}function d(t,e){for(var n=t.getPropertiesMetadata(e),i=[],o=0,u=Object.keys(n);o<u.length;o++){var s=u[o],f=n[s],l=h(n[s]),p=l.targetName||s,v=l.inject||l.multiInject,g=new c.Target(a.TargetTypeEnum.ClassProperty,p,v);g.metadata=f,i.push(g)}var y=Object.getPrototypeOf(e.prototype).constructor;if(y!==Object){var m=d(t,y);i=r(r([],i),m)}return i}function h(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[u.INJECT_TAG],multiInject:e[u.MULTI_INJECT_TAG],targetName:e[u.NAME_TAG],unmanaged:e[u.UNMANAGED_TAG]}}e.getDependencies=function(t,e){return f(t,s.getFunctionName(e),e,!1)},e.getBaseClassDependencyCount=function t(e,n){var r=Object.getPrototypeOf(n.prototype).constructor;if(r!==Object){var i=f(e,s.getFunctionName(r),r,!0),o=i.map((function(t){return t.metadata.filter((function(t){return t.key===u.UNMANAGED_TAG}))})),a=[].concat.apply([],o).length,c=i.length-a;return c>0?c:t(e,r)}return 0}},4810:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Request=void 0;var r=n(23),i=function(){function t(t,e,n,i,o){this.id=r.id(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();e.Request=i},9660:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Target=void 0;var r=n(295),i=n(23),o=n(5092),a=n(8634),u=function(){function t(t,e,n,u){this.id=i.id(),this.type=t,this.serviceIdentifier=n,this.name=new a.QueryableString(e||""),this.metadata=new Array;var s=null;"string"==typeof u?s=new o.Metadata(r.NAMED_TAG,u):u instanceof o.Metadata&&(s=u),null!==s&&this.metadata.push(s)}return t.prototype.hasTag=function(t){for(var e=0,n=this.metadata;e<n.length;e++)if(n[e].key===t)return!0;return!1},t.prototype.isArray=function(){return this.hasTag(r.MULTI_INJECT_TAG)},t.prototype.matchesArray=function(t){return this.matchesTag(r.MULTI_INJECT_TAG)(t)},t.prototype.isNamed=function(){return this.hasTag(r.NAMED_TAG)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(r.OPTIONAL_TAG)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===r.NAMED_TAG}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(r.NAMED_TAG)(t)},t.prototype.matchesTag=function(t){var e=this;return function(n){for(var r=0,i=e.metadata;r<i.length;r++){var o=i[r];if(o.key===t&&o.value===n)return!0}return!1}},t}();e.Target=u},8544:function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveInstance=void 0;var i=n(6078),o=n(7690),a=n(295);e.resolveInstance=function(t,e,n){var u,s,c=null;e.length>0?(s=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ConstructorArgument})).map(n),c=function(t,e,n){var r=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ClassProperty})),i=r.map(n);return r.forEach((function(e,n){var r;r=e.target.name.value();var o=i[n];t[r]=o})),t}(c=new((u=t).bind.apply(u,r([void 0],s))),e,n)):c=new t;return function(t,e){if(Reflect.hasMetadata(a.POST_CONSTRUCT,t)){var n=Reflect.getMetadata(a.POST_CONSTRUCT,t);try{e[n.value]()}catch(e){throw new Error(i.POST_CONSTRUCT_ERROR(t.name,e.message))}}}(t,c),c}},9386:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolve=void 0;var r=n(6078),i=n(7690),o=n(2542),a=n(9552),u=n(8544),s=function(t,e,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(r.CIRCULAR_DEPENDENCY_IN_FACTORY(t,e.toString())):n}},c=function(t){return function(e){e.parentContext.setCurrentRequest(e);var n=e.bindings,o=e.childRequests,f=e.target&&e.target.isArray(),l=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(f&&l)return o.map((function(e){return c(t)(e)}));var d=null;if(!e.target.isOptional()||0!==n.length){var h=n[0],p=h.scope===i.BindingScopeEnum.Singleton,v=h.scope===i.BindingScopeEnum.Request;if(p&&h.activated)return h.cache;if(v&&null!==t&&t.has(h.id))return t.get(h.id);if(h.type===i.BindingTypeEnum.ConstantValue)d=h.cache,h.activated=!0;else if(h.type===i.BindingTypeEnum.Function)d=h.cache,h.activated=!0;else if(h.type===i.BindingTypeEnum.Constructor)d=h.implementationType;else if(h.type===i.BindingTypeEnum.DynamicValue&&null!==h.dynamicValue)d=s("toDynamicValue",h.serviceIdentifier,(function(){return h.dynamicValue(e.parentContext)}));else if(h.type===i.BindingTypeEnum.Factory&&null!==h.factory)d=s("toFactory",h.serviceIdentifier,(function(){return h.factory(e.parentContext)}));else if(h.type===i.BindingTypeEnum.Provider&&null!==h.provider)d=s("toProvider",h.serviceIdentifier,(function(){return h.provider(e.parentContext)}));else{if(h.type!==i.BindingTypeEnum.Instance||null===h.implementationType){var g=a.getServiceIdentifierAsString(e.serviceIdentifier);throw new Error(r.INVALID_BINDING_TYPE+" "+g)}d=u.resolveInstance(h.implementationType,o,c(t))}return"function"==typeof h.onActivation&&(d=h.onActivation(e.parentContext,d)),p&&(h.cache=d,h.activated=!0),v&&null!==t&&!t.has(h.id)&&t.set(h.id,d),d}}};e.resolve=function(t){return c(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}},1640:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInSyntax=void 0;var r=n(7690),i=n(6890),o=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=r.BindingScopeEnum.Request,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=r.BindingScopeEnum.Singleton,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=r.BindingScopeEnum.Transient,new i.BindingWhenOnSyntax(this._binding)},t}();e.BindingInSyntax=o},2386:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInWhenOnSyntax=void 0;var r=n(1640),i=n(8926),o=n(2700),a=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding),this._bindingInSyntax=new r.BindingInSyntax(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingInWhenOnSyntax=a},8926:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingOnSyntax=void 0;var r=n(2700),i=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new r.BindingWhenSyntax(this._binding)},t}();e.BindingOnSyntax=i},3313:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingToSyntax=void 0;var r=n(6078),i=n(7690),o=n(2386),a=n(6890),u=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=i.BindingTypeEnum.Instance,this._binding.implementationType=t,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+r.INVALID_TO_SELF_VALUE);var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=i.BindingTypeEnum.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=i.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=i.BindingTypeEnum.Constructor,this._binding.implementationType=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error(r.INVALID_FUNCTION_BINDING);var e=this.toConstantValue(t);return this._binding.type=i.BindingTypeEnum.Function,this._binding.scope=i.BindingScopeEnum.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=i.BindingTypeEnum.Provider,this._binding.provider=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}();e.BindingToSyntax=u},6890:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenOnSyntax=void 0;var r=n(8926),i=n(2700),o=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new i.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new r.BindingOnSyntax(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingWhenOnSyntax=o},2700:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenSyntax=void 0;var r=n(8926),i=n(3140),o=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=i.namedConstraint(t),new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=i.taggedConstraint(t)(e),new r.BindingOnSyntax(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return i.typeConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return i.namedConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return i.taggedConstraint(t)(e)(n.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return!i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t}();e.BindingWhenSyntax=o},3140:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.typeConstraint=e.namedConstraint=e.taggedConstraint=e.traverseAncerstors=void 0;var r=n(295),i=n(5092),o=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||o(n,e))};e.traverseAncerstors=o;var a=function(t){return function(e){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(t)(e)};return n.metaData=new i.Metadata(t,e),n}};e.taggedConstraint=a;var u=a(r.NAMED_TAG);e.namedConstraint=u,e.typeConstraint=function(t){return function(e){var n=null;if(null!==e){if(n=e.bindings[0],"string"==typeof t)return n.serviceIdentifier===t;var r=e.bindings[0].implementationType;return t===r}return!1}}},4384:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=void 0,e.multiBindToService=function(t){return function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return n.forEach((function(n){return t.bind(n).toService(e)}))}}}},2542:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isStackOverflowExeption=void 0;var r=n(6078);e.isStackOverflowExeption=function(t){return t instanceof RangeError||t.message===r.STACK_OVERFLOW}},23:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id=void 0;var n=0;e.id=function(){return n++}},9552:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.circularDependencyToException=e.listMetadataForTarget=e.listRegisteredBindingsForServiceIdentifier=e.getServiceIdentifierAsString=e.getFunctionName=void 0;var r=n(6078);function i(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function o(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||o(t.parentRequest,e))}function a(t){if(t.name)return t.name;var e=t.toString(),n=e.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+e}e.getServiceIdentifierAsString=i,e.listRegisteredBindingsForServiceIdentifier=function(t,e,n){var r="",i=n(t,e);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(t){var e="Object";null!==t.implementationType&&(e=a(t.implementationType)),r=r+"\n "+e,t.constraint.metaData&&(r=r+" - "+t.constraint.metaData)}))),r},e.circularDependencyToException=function t(e){e.childRequests.forEach((function(e){if(o(e,e.serviceIdentifier)){var n=function(t){return function t(e,n){void 0===n&&(n=[]);var r=i(e.serviceIdentifier);return n.push(r),null!==e.parentRequest?t(e.parentRequest,n):n}(t).reverse().join(" --\x3e ")}(e);throw new Error(r.CIRCULAR_DEPENDENCY+" "+n)}t(e)}))},e.listMetadataForTarget=function(t,e){if(e.isTagged()||e.isNamed()){var n="",r=e.getNamedTag(),i=e.getCustomTags();return null!==r&&(n+=r.toString()+"\n"),null!==i&&i.forEach((function(t){n+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+n}return" "+t},e.getFunctionName=a},1739:(t,e,n)=>{var r=n(5229),i=n(6765),o=n(5927),a=n(4186),u=n(6064),s=[0,0];t.exports.x7=function(t,e,n,a,c){return r(t,n,a),o(t,t),i(e,-t[1],t[0]),i(s,-n[1],n[0]),c/u(e,s)},t.exports.mJ=function(t,e){return i(t,-e[1],e[0]),t},t.exports.o7=function(t,e,n){return a(t,e,n),o(t,t),t}},8892:(t,e,n)=>{var r;!function(t){!function(e){var r="object"==typeof n.g?n.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=o(t);function o(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===r.Reflect?r.Reflect=t:i=o(r.Reflect,i),function(t){var e=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,a={__proto__:[]}instanceof Array,u=!o&&!a,s={create:o?function(){return P(Object.create(null))}:a?function(){return P({__proto__:null})}:function(){return P({})},has:u?function(t,n){return e.call(t,n)}:function(t,e){return e in t},get:u?function(t,n){return e.call(t,n)?t[n]:void 0}:function(t,e){return t[e]}},c=Object.getPrototypeOf(Function),f="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,l=f||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[i]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,o)},e.prototype.entries=function(){return new n(this._keys,this._values,a)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[i]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function a(t,e){return[t,e]}}():Map,d=f||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){function t(){this._map=new l}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[i]=function(){return this.keys()},t}():Set,h=new(f||"function"!=typeof WeakMap?function(){var t=s.create(),n=r();return function(){function t(){this._key=r()}return t.prototype.has=function(t){var e=i(t,!1);return void 0!==e&&s.has(e,this._key)},t.prototype.get=function(t){var e=i(t,!1);return void 0!==e?s.get(e,this._key):void 0},t.prototype.set=function(t,e){return i(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=i(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=r()},t}();function r(){var e;do{e="@@WeakMap@@"+a()}while(s.has(t,e));return t[e]=!0,e}function i(t,r){if(!e.call(t,n)){if(!r)return;Object.defineProperty(t,n,{value:s.create()})}return t[n]}function o(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function a(){var t,e=(t=16,"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):o(new Uint8Array(t),t):o(new Array(t),t));e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<16;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}():WeakMap);function p(t,e,n){var r=h.get(t);if(E(r)){if(!n)return;r=new l,h.set(t,r)}var i=r.get(e);if(E(i)){if(!n)return;i=new l,r.set(e,i)}return i}function v(t,e,n){if(g(t,e,n))return!0;var r=R(e);return!S(r)&&v(t,r,n)}function g(t,e,n){var r=p(e,n,!1);return!E(r)&&!!r.has(t)}function y(t,e,n){if(g(t,e,n))return m(t,e,n);var r=R(e);return S(r)?void 0:y(t,r,n)}function m(t,e,n){var r=p(e,n,!1);if(!E(r))return r.get(t)}function b(t,e,n,r){p(n,r,!0).set(t,e)}function _(t,e){var n=x(t,e),r=R(t);if(null===r)return n;var i=_(r,e);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new d,a=[],u=0,s=n;u<s.length;u++){var c=s[u];o.has(c)||(o.add(c),a.push(c))}for(var f=0,l=i;f<l.length;f++)c=l[f],o.has(c)||(o.add(c),a.push(c));return a}function x(t,e){var n=[],r=p(t,e,!1);if(E(r))return n;for(var o=function(t){var e=k(t,i);if(!O(e))throw new TypeError;var n=e.call(t);if(!A(n))throw new TypeError;return n}(r.keys()),a=0;;){var u=D(o);if(!u)return n.length=a,n;var s=u.value;try{n[a]=s}catch(t){try{M(o)}finally{throw t}}a++}}function w(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function E(t){return void 0===t}function S(t){return null===t}function A(t){return"object"==typeof t?null!==t:"function"==typeof t}function T(t,e){switch(w(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",i=k(t,r);if(void 0!==i){var o=i.call(t,n);if(A(o))throw new TypeError;return o}return function(t,e){if("string"===e){var n=t.toString;if(O(n)&&!A(i=n.call(t)))return i;if(O(r=t.valueOf)&&!A(i=r.call(t)))return i}else{var r;if(O(r=t.valueOf)&&!A(i=r.call(t)))return i;var i,o=t.toString;if(O(o)&&!A(i=o.call(t)))return i}throw new TypeError}(t,"default"===n?"number":n)}function I(t){var e=T(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function N(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function O(t){return"function"==typeof t}function C(t){return"function"==typeof t}function k(t,e){var n=t[e];if(null!=n){if(!O(n))throw new TypeError;return n}}function D(t){var e=t.next();return!e.done&&e}function M(t){var e=t.return;e&&e.call(t)}function R(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===c)return e;if(e!==c)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function P(t){return t.__=void 0,delete t.__,t}t("decorate",(function(t,e,n,r){if(E(n)){if(!N(t))throw new TypeError;if(!C(e))throw new TypeError;return function(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!E(r)&&!S(r)){if(!C(r))throw new TypeError;e=r}}return e}(t,e)}if(!N(t))throw new TypeError;if(!A(e))throw new TypeError;if(!A(r)&&!E(r)&&!S(r))throw new TypeError;return S(r)&&(r=void 0),function(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!E(o)&&!S(o)){if(!A(o))throw new TypeError;r=o}}return r}(t,e,n=I(n),r)})),t("metadata",(function(t,e){return function(n,r){if(!A(n))throw new TypeError;if(!E(r)&&!function(t){switch(w(t)){case 3:case 4:return!0;default:return!1}}(r))throw new TypeError;b(t,e,n,r)}})),t("defineMetadata",(function(t,e,n,r){if(!A(n))throw new TypeError;return E(r)||(r=I(r)),b(t,e,n,r)})),t("hasMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),v(t,e,n)})),t("hasOwnMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),g(t,e,n)})),t("getMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),y(t,e,n)})),t("getOwnMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),m(t,e,n)})),t("getMetadataKeys",(function(t,e){if(!A(t))throw new TypeError;return E(e)||(e=I(e)),_(t,e)})),t("getOwnMetadataKeys",(function(t,e){if(!A(t))throw new TypeError;return E(e)||(e=I(e)),x(t,e)})),t("deleteMetadata",(function(t,e,n){if(!A(e))throw new TypeError;E(n)||(n=I(n));var r=p(e,n,!1);if(E(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=h.get(e);return i.delete(n),i.size>0||h.delete(e),!0}))}(i)}()}(r||(r={}))},5375:t=>{var e=function(t){"use strict";var e,n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),u=new O(r||[]);return i(a,"_invoke",{value:A(t,n,u)}),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var d="suspendedStart",h="executing",p="completed",v={};function g(){}function y(){}function m(){}var b={};c(b,a,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(C([])));x&&x!==n&&r.call(x,a)&&(b=x);var w=m.prototype=g.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(i,o,a,u){var s=l(t[i],t,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(s.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function A(t,e,n){var r=d;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===p){if("throw"===i)throw o;return k()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=T(a,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var s=l(t,e,n);if("normal"===s.type){if(r=n.done?p:"suspendedYield",s.arg===v)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=p,n.method="throw",n.arg=s.arg)}}}function T(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=l(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function I(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 N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function C(t){if(t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}return{next:k}}function k(){return{value:e,done:!0}}return y.prototype=m,i(w,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:y,configurable:!0}),y.displayName=c(m,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,c(t,s,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},E(S.prototype),c(S.prototype,u,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(f(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(w),c(w,s,"Generator"),c(w,a,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(N),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return u.type="throw",u.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;N(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},6377:function(t){t.exports=function(){"use strict";var t=function(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array||t instanceof Uint8ClampedArray},e=function(t,e){for(var n=Object.keys(e),r=0;r<n.length;++r)t[n[r]]=e[n[r]];return t},n="\n";function r(t){var e=new Error("(regl) "+t);throw console.error(e),e}function i(t,e){t||r(e)}function o(t){return t?": "+t:""}function a(t,e){switch(e){case"number":return"number"==typeof t;case"object":return"object"==typeof t;case"string":return"string"==typeof t;case"boolean":return"boolean"==typeof t;case"function":return"function"==typeof t;case"undefined":return void 0===t;case"symbol":return"symbol"==typeof t}}function u(t,e,n){e.indexOf(t)<0&&r("invalid value"+o(n)+". must be one of: "+e)}var s=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function c(t,e){for(t+="";t.length<e;)t=" "+t;return t}function f(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function l(t,e){this.number=t,this.line=e,this.errors=[]}function d(t,e,n){this.file=t,this.line=e,this.message=n}function h(){var t=new Error,e=(t.stack||t).toString(),n=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(e);if(n)return n[1];var r=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(e);return r?r[1]:"unknown"}function p(){var t=new Error,e=(t.stack||t).toString(),n=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(e);if(n)return n[1];var r=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(e);return r?r[1]:"unknown"}function v(t,e){var n,r=t.split("\n"),i=1,o=0,a={unknown:new f,0:new f};a.unknown.name=a[0].name=e||h(),a.unknown.lines.push(new l(0,""));for(var u=0;u<r.length;++u){var s=r[u],c=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(s);if(c)switch(c[1]){case"line":var d=/(\d+)(\s+\d+)?/.exec(c[2]);d&&(i=0|d[1],d[2]&&((o=0|d[2])in a||(a[o]=new f)));break;case"define":var p=/SHADER_NAME(_B64)?\s+(.*)$/.exec(c[2]);p&&(a[o].name=p[1]?(n=p[2],"undefined"!=typeof atob?atob(n):"base64:"+n):p[2])}a[o].lines.push(new l(i++,s))}return Object.keys(a).forEach((function(t){var e=a[t];e.lines.forEach((function(t){e.index[t.number]=t}))})),a}function g(t){t._commandRef=h()}function y(t,e){var n=p();r(t+" in command "+(e||h())+("unknown"===n?"":" called from "+n))}function m(t,e,n,r){a(t,e)||y("invalid parameter type"+o(n)+". expected "+e+", got "+typeof t,r||h())}var b=33071,_={};function x(t,e){return 32820===t||32819===t||33635===t?2:34042===t?4:_[t]*e}function w(t){return!(t&t-1||!t)}_[5120]=_[5121]=1,_[5122]=_[5123]=_[36193]=_[33635]=_[32819]=_[32820]=2,_[5124]=_[5125]=_[5126]=_[34042]=4;var E=e(i,{optional:function(t){t()},raise:r,commandRaise:y,command:function(t,e,n){t||y(e,n||h())},parameter:function(t,e,n){t in e||r("unknown parameter ("+t+")"+o(n)+". possible values: "+Object.keys(e).join())},commandParameter:function(t,e,n,r){t in e||y("unknown parameter ("+t+")"+o(n)+". possible values: "+Object.keys(e).join(),r||h())},constructor:function(t){Object.keys(t).forEach((function(t){s.indexOf(t)<0&&r('invalid regl constructor argument "'+t+'". must be one of '+s)}))},type:function(t,e,n){a(t,e)||r("invalid parameter type"+o(n)+". expected "+e+", got "+typeof t)},commandType:m,isTypedArray:function(e,n){t(e)||r("invalid parameter type"+o(n)+". must be a typed array")},nni:function(t,e){t>=0&&(0|t)===t||r("invalid parameter type, ("+t+")"+o(e)+". must be a nonnegative integer")},oneOf:u,shaderError:function(t,e,r,o,a){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var u=t.getShaderInfoLog(e),s=o===t.FRAGMENT_SHADER?"fragment":"vertex";m(r,"string",s+" shader source must be a string",a);var f=v(r,a),l=function(t){var e=[];return t.split("\n").forEach((function(t){if(!(t.length<5)){var n=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(t);n?e.push(new d(0|n[1],0|n[2],n[3].trim())):t.length>0&&e.push(new d("unknown",0,t))}})),e}(u);(function(t,e){e.forEach((function(e){var n=t[e.file];if(n){var r=n.index[e.line];if(r)return r.errors.push(e),void(n.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)}))})(f,l),Object.keys(f).forEach((function(t){var e=f[t];if(e.hasErrors){var r=[""],i=[""];o("file number "+t+": "+e.name+"\n","color:red;text-decoration:underline;font-weight:bold"),e.lines.forEach((function(t){if(t.errors.length>0){o(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),o(t.line+n,"color:red; background-color:yellow; font-weight:bold");var e=0;t.errors.forEach((function(r){var i=r.message,a=/^\s*'(.*)'\s*:\s*(.*)$/.exec(i);if(a){var u=a[1];i=a[2],"assign"===u&&(u="="),e=Math.max(t.line.indexOf(u,e),0)}else e=0;o(c("| ",6)),o(c("^^^",e+3)+n,"font-weight:bold"),o(c("| ",6)),o(i+n,"font-weight:bold")})),o(c("| ",6)+n)}else o(c(t.number,4)+"| "),o(t.line+n,"color:red")})),"undefined"==typeof document||window.chrome?console.log(r.join("")):(i[0]=r.join("%c"),console.log.apply(console,i))}function o(t,e){r.push(t),i.push(e||"")}})),i.raise("Error compiling "+s+" shader, "+f[0].name)}},linkError:function(t,e,r,o,a){if(!t.getProgramParameter(e,t.LINK_STATUS)){var u=t.getProgramInfoLog(e),s=v(r,a),c='Error linking program with vertex shader, "'+v(o,a)[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+c+"\n%c"+u,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(c+n+u),i.raise(c)}},callSite:p,saveCommandRef:g,saveDrawInfo:function(t,e,n,r){function i(t){return t?r.id(t):0}function o(t,e){Object.keys(e).forEach((function(e){t[r.id(e)]=!0}))}g(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var a=t._uniformSet={};o(a,e.static),o(a,e.dynamic);var u=t._attributeSet={};o(u,n.static),o(u,n.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic},framebufferFormat:function(t,e,n){t.texture?u(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):u(t.renderbuffer._renderbuffer.format,n,"unsupported renderbuffer format for attachment")},guessCommand:h,texture2D:function(t,e,n){var r,o=e.width,a=e.height,u=e.channels;i(o>0&&o<=n.maxTextureSize&&a>0&&a<=n.maxTextureSize,"invalid texture shape"),t.wrapS===b&&t.wrapT===b||i(w(o)&&w(a),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==o&&1!==a&&i(9984!==t.minFilter&&9986!==t.minFilter&&9985!==t.minFilter&&9987!==t.minFilter,"min filter requires mipmap"):(i(w(o)&&w(a),"texture must be a square power of 2 to support mipmapping"),i(e.mipmask===(o<<1)-1,"missing or incomplete mipmap data")),5126===e.type&&(n.extensions.indexOf("oes_texture_float_linear")<0&&i(9728===t.minFilter&&9728===t.magFilter,"filter not supported, must enable oes_texture_float_linear"),i(!t.genMipmaps,"mipmap generation not supported with float textures"));var s=e.images;for(r=0;r<16;++r)if(s[r]){var c=o>>r,f=a>>r;i(e.mipmask&1<<r,"missing mipmap data");var l=s[r];if(i(l.width===c&&l.height===f,"invalid shape for mip images"),i(l.format===e.format&&l.internalformat===e.internalformat&&l.type===e.type,"incompatible type for mip image"),l.compressed);else if(l.data){var d=Math.ceil(x(l.type,u)*c/l.unpackAlignment)*l.unpackAlignment;i(l.data.byteLength===d*f,"invalid data for image, buffer size is inconsistent with image format")}else l.element||l.copy}else t.genMipmaps||i(0==(e.mipmask&1<<r),"extra mipmap data");e.compressed&&i(!t.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(t,e,n,r){var o=t.width,a=t.height,u=t.channels;i(o>0&&o<=r.maxTextureSize&&a>0&&a<=r.maxTextureSize,"invalid texture shape"),i(o===a,"cube map must be square"),i(e.wrapS===b&&e.wrapT===b,"wrap mode not supported by cube map");for(var s=0;s<n.length;++s){var c=n[s];i(c.width===o&&c.height===a,"inconsistent cube map face shape"),e.genMipmaps&&(i(!c.compressed,"can not generate mipmap for compressed textures"),i(1===c.mipmask,"can not specify mipmaps and generate mipmaps"));for(var f=c.images,l=0;l<16;++l){var d=f[l];if(d){var h=o>>l,p=a>>l;i(c.mipmask&1<<l,"missing mipmap data"),i(d.width===h&&d.height===p,"invalid shape for mip images"),i(d.format===t.format&&d.internalformat===t.internalformat&&d.type===t.type,"incompatible type for mip image"),d.compressed||(d.data?i(d.data.byteLength===h*p*Math.max(x(d.type,u),d.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):d.element||d.copy)}}}}}),S=0;function A(t,e){this.id=S++,this.type=t,this.data=e}function T(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function I(t){if(0===t.length)return[];var e=t.charAt(0),n=t.charAt(t.length-1);if(t.length>1&&e===n&&('"'===e||"'"===e))return['"'+T(t.substr(1,t.length-2))+'"'];var r=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(r)return I(t.substr(0,r.index)).concat(I(r[1])).concat(I(t.substr(r.index+r[0].length)));var i=t.split(".");if(1===i.length)return['"'+T(t)+'"'];for(var o=[],a=0;a<i.length;++a)o=o.concat(I(i[a]));return o}function N(t){return"["+I(t).join("][")+"]"}var O={DynamicVariable:A,define:function(t,e){return new A(t,N(e+""))},isDynamic:function(t){return"function"==typeof t&&!t._reglType||t instanceof A},unbox:function t(e,n){return"function"==typeof e?new A(0,e):"number"==typeof e||"boolean"==typeof e?new A(5,e):Array.isArray(e)?new A(6,e.map(((e,r)=>t(e,n+"["+r+"]")))):e instanceof A?e:void E(!1,"invalid option type in uniform "+n)},accessor:N},C={next:"function"==typeof requestAnimationFrame?function(t){return requestAnimationFrame(t)}:function(t){return setTimeout(t,16)},cancel:"function"==typeof cancelAnimationFrame?function(t){return cancelAnimationFrame(t)}:clearTimeout},k="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date};function D(t){return"string"==typeof t?t.split():(E(Array.isArray(t),"invalid extension array"),t)}function M(t){return"string"==typeof t?(E("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(t)):t}function R(t){var n,r,i,o,a,u=t||{},s={},c=[],f=[],l="undefined"==typeof window?1:window.devicePixelRatio,d=!1,h=function(t){t&&E.raise(t)},p=function(){};if("string"==typeof u?(E("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),n=document.querySelector(u),E(n,"invalid query string for element")):"object"==typeof u?"string"==typeof(a=u).nodeName&&"function"==typeof a.appendChild&&"function"==typeof a.getBoundingClientRect?n=u:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(u)?i=(o=u).canvas:(E.constructor(u),"gl"in u?o=u.gl:"canvas"in u?i=M(u.canvas):"container"in u&&(r=M(u.container)),"attributes"in u&&(s=u.attributes,E.type(s,"object","invalid context attributes")),"extensions"in u&&(c=D(u.extensions)),"optionalExtensions"in u&&(f=D(u.optionalExtensions)),"onDone"in u&&(E.type(u.onDone,"function","invalid or missing onDone callback"),h=u.onDone),"profile"in u&&(d=!!u.profile),"pixelRatio"in u&&(l=+u.pixelRatio,E(l>0,"invalid pixel ratio"))):E.raise("invalid arguments to regl"),n&&("canvas"===n.nodeName.toLowerCase()?i=n:r=n),!o){if(!i){E("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var v=function(t,n,r){var i,o=document.createElement("canvas");function a(){var n=window.innerWidth,i=window.innerHeight;if(t!==document.body){var a=t.getBoundingClientRect();n=a.right-a.left,i=a.bottom-a.top}o.width=r*n,o.height=r*i,e(o.style,{width:n+"px",height:i+"px"})}return e(o.style,{border:0,margin:0,padding:0,top:0,left:0}),t.appendChild(o),t===document.body&&(o.style.position="absolute",e(t.style,{margin:0,padding:0})),t!==document.body&&"function"==typeof ResizeObserver?(i=new ResizeObserver((function(){setTimeout(a)}))).observe(t):window.addEventListener("resize",a,!1),a(),{canvas:o,onDestroy:function(){i?i.disconnect():window.removeEventListener("resize",a),t.removeChild(o)}}}(r||document.body,0,l);if(!v)return null;i=v.canvas,p=v.onDestroy}void 0===s.premultipliedAlpha&&(s.premultipliedAlpha=!0),o=function(t,e){function n(n){try{return t.getContext(n,e)}catch(t){return null}}return n("webgl")||n("experimental-webgl")||n("webgl-experimental")}(i,s)}return o?{gl:o,canvas:i,container:r,extensions:c,optionalExtensions:f,pixelRatio:l,profile:d,onDone:h,onDestroy:p}:(p(),h("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function P(t,e){for(var n=Array(t),r=0;r<t;++r)n[r]=e(r);return n}function G(t){var e,n;return e=(t>65535)<<4,e|=n=((t>>>=e)>255)<<3,e|=n=((t>>>=n)>15)<<2,(e|=n=((t>>>=n)>3)<<1)|(t>>>=n)>>1}function L(){var t=P(8,(function(){return[]}));function e(e){var n=function(t){for(var e=16;e<=1<<28;e*=16)if(t<=e)return e;return 0}(e),r=t[G(n)>>2];return r.length>0?r.pop():new ArrayBuffer(n)}function n(e){t[G(e.byteLength)>>2].push(e)}return{alloc:e,free:n,allocType:function(t,n){var r=null;switch(t){case 5120:r=new Int8Array(e(n),0,n);break;case 5121:r=new Uint8Array(e(n),0,n);break;case 5122:r=new Int16Array(e(2*n),0,n);break;case 5123:r=new Uint16Array(e(2*n),0,n);break;case 5124:r=new Int32Array(e(4*n),0,n);break;case 5125:r=new Uint32Array(e(4*n),0,n);break;case 5126:r=new Float32Array(e(4*n),0,n);break;default:return null}return r.length!==n?r.subarray(0,n):r},freeType:function(t){n(t.buffer)}}}var j=L();j.zero=L();var F=3553,U=6408,B=5126,z=36160;function V(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||t(e.data))}var W=function(t){return Object.keys(t).map((function(e){return t[e]}))},H={shape:function(t){for(var e=[],n=t;n.length;n=n[0])e.push(n.length);return e},flatten:function(t,e,n,r){var i=1;if(e.length)for(var o=0;o<e.length;++o)i*=e[o];else i=0;var a=r||j.allocType(n,i);switch(e.length){case 0:break;case 1:!function(t,e,n){for(var r=0;r<e;++r)n[r]=t[r]}(t,e[0],a);break;case 2:!function(t,e,n,r){for(var i=0,o=0;o<e;++o)for(var a=t[o],u=0;u<n;++u)r[i++]=a[u]}(t,e[0],e[1],a);break;case 3:X(t,e[0],e[1],e[2],a,0);break;default:q(t,e,0,a,0)}return a}};function X(t,e,n,r,i,o){for(var a=o,u=0;u<e;++u)for(var s=t[u],c=0;c<n;++c)for(var f=s[c],l=0;l<r;++l)i[a++]=f[l]}function q(t,e,n,r,i){for(var o=1,a=n+1;a<e.length;++a)o*=e[a];var u=e[n];if(e.length-n==4){var s=e[n+1],c=e[n+2],f=e[n+3];for(a=0;a<u;++a)X(t[a],s,c,f,r,i),i+=o}else for(a=0;a<u;++a)q(t[a],e,n+1,r,i),i+=o}var Y={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},K={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Z={dynamic:35048,stream:35040,static:35044},$=H.flatten,J=H.shape,Q=5121,tt=5126,et=[];function nt(t){return 0|Y[Object.prototype.toString.call(t)]}function rt(t,e){for(var n=0;n<e.length;++n)t[n]=e[n]}function it(t,e,n,r,i,o,a){for(var u=0,s=0;s<n;++s)for(var c=0;c<r;++c)t[u++]=e[i*s+o*c+a]}et[5120]=1,et[5122]=2,et[5124]=4,et[5121]=1,et[5123]=2,et[5125]=4,et[5126]=4;var ot={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},at=5121,ut=5123,st=5125,ct=34963;var ft=new Float32Array(1),lt=new Uint32Array(ft.buffer);function dt(t){for(var e=j.allocType(5123,t.length),n=0;n<t.length;++n)if(isNaN(t[n]))e[n]=65535;else if(t[n]===1/0)e[n]=31744;else if(t[n]===-1/0)e[n]=64512;else{ft[0]=t[n];var r=lt[0],i=r>>>31<<15,o=(r<<1>>>24)-127,a=r>>13&1023;if(o<-24)e[n]=i;else if(o<-14){var u=-14-o;e[n]=i+(a+1024>>u)}else e[n]=o>15?i+31744:i+(o+15<<10)+a}return e}function ht(e){return Array.isArray(e)||t(e)}var pt=function(t){return!(t&t-1||!t)},vt=3553,gt=34067,yt=34069,mt=6408,bt=6406,_t=6407,xt=6409,wt=6410,Et=32855,St=6402,At=34041,Tt=35904,It=35906,Nt=36193,Ot=33776,Ct=33777,kt=33778,Dt=33779,Mt=5121,Rt=5123,Pt=5125,Gt=5126,Lt=33071,jt=9728,Ft=9984,Ut=9987,Bt=4352,zt=33984,Vt=[Ft,9986,9985,Ut],Wt=[0,xt,wt,_t,mt],Ht={};function Xt(t){return"[object "+t+"]"}Ht[6409]=Ht[6406]=Ht[6402]=1,Ht[34041]=Ht[6410]=2,Ht[6407]=Ht[35904]=3,Ht[6408]=Ht[35906]=4;var qt=Xt("HTMLCanvasElement"),Yt=Xt("OffscreenCanvas"),Kt=Xt("CanvasRenderingContext2D"),Zt=Xt("ImageBitmap"),$t=Xt("HTMLImageElement"),Jt=Xt("HTMLVideoElement"),Qt=Object.keys(Y).concat([qt,Yt,Kt,Zt,$t,Jt]),te=[];te[5121]=1,te[5126]=4,te[36193]=2,te[5123]=2,te[5125]=4;var ee=[];function ne(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function re(t){return!!Array.isArray(t)&&!(0===t.length||!ht(t[0]))}function ie(t){return Object.prototype.toString.call(t)}function oe(t){return ie(t)===qt}function ae(t){return ie(t)===Yt}function ue(t){if(!t)return!1;var e=ie(t);return Qt.indexOf(e)>=0||ne(t)||re(t)||V(t)}function se(t){return 0|Y[Object.prototype.toString.call(t)]}function ce(t,e){return j.allocType(t.type===Nt?Gt:t.type,e)}function fe(t,e){t.type===Nt?(t.data=dt(e),j.freeType(e)):t.data=e}function le(t,e,n,r,i,o){var a;if(a=void 0!==ee[t]?ee[t]:Ht[t]*te[e],o&&(a*=6),i){for(var u=0,s=n;s>=1;)u+=a*s*s,s/=2;return u}return a*n*r}function de(n,r,i,o,a,u,s){var c={"don't care":Bt,"dont care":Bt,nice:4354,fast:4353},f={repeat:10497,clamp:Lt,mirror:33648},l={nearest:jt,linear:9729},d=e({mipmap:Ut,"nearest mipmap nearest":Ft,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":Ut},l),h={none:0,browser:37444},p={uint8:Mt,rgba4:32819,rgb565:33635,"rgb5 a1":32820},v={alpha:bt,luminance:xt,"luminance alpha":wt,rgb:_t,rgba:mt,rgba4:32854,"rgb5 a1":Et,rgb565:36194},g={};r.ext_srgb&&(v.srgb=Tt,v.srgba=It),r.oes_texture_float&&(p.float32=p.float=Gt),r.oes_texture_half_float&&(p.float16=p["half float"]=Nt),r.webgl_depth_texture&&(e(v,{depth:St,"depth stencil":At}),e(p,{uint16:Rt,uint32:Pt,"depth stencil":34042})),r.webgl_compressed_texture_s3tc&&e(g,{"rgb s3tc dxt1":Ot,"rgba s3tc dxt1":Ct,"rgba s3tc dxt3":kt,"rgba s3tc dxt5":Dt}),r.webgl_compressed_texture_atc&&e(g,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798}),r.webgl_compressed_texture_pvrtc&&e(g,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843}),r.webgl_compressed_texture_etc1&&(g["rgb etc1"]=36196);var y=Array.prototype.slice.call(n.getParameter(34467));Object.keys(g).forEach((function(t){var e=g[t];y.indexOf(e)>=0&&(v[t]=e)}));var m=Object.keys(v);i.textureFormats=m;var b=[];Object.keys(v).forEach((function(t){var e=v[t];b[e]=t}));var _=[];Object.keys(p).forEach((function(t){var e=p[t];_[e]=t}));var x=[];Object.keys(l).forEach((function(t){x[l[t]]=t}));var w=[];Object.keys(d).forEach((function(t){var e=d[t];w[e]=t}));var S=[];Object.keys(f).forEach((function(t){S[f[t]]=t}));var A=m.reduce((function(t,e){var n=v[e];return n===xt||n===bt||n===xt||n===wt||n===St||n===At||r.ext_srgb&&(n===Tt||n===It)?t[n]=n:n===Et||e.indexOf("rgba")>=0?t[n]=mt:t[n]=_t,t}),{});function T(){this.internalformat=mt,this.format=mt,this.type=Mt,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=37444,this.width=0,this.height=0,this.channels=0}function I(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function N(t,e){if("object"==typeof e&&e){if("premultiplyAlpha"in e&&(E.type(e.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=e.premultiplyAlpha),"flipY"in e&&(E.type(e.flipY,"boolean","invalid texture flip"),t.flipY=e.flipY),"alignment"in e&&(E.oneOf(e.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=e.alignment),"colorSpace"in e&&(E.parameter(e.colorSpace,h,"invalid colorSpace"),t.colorSpace=h[e.colorSpace]),"type"in e){var n=e.type;E(r.oes_texture_float||!("float"===n||"float32"===n),"you must enable the OES_texture_float extension in order to use floating point textures."),E(r.oes_texture_half_float||!("half float"===n||"float16"===n),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),E(r.webgl_depth_texture||!("uint16"===n||"uint32"===n||"depth stencil"===n),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),E.parameter(n,p,"invalid texture type"),t.type=p[n]}var o=t.width,a=t.height,u=t.channels,s=!1;"shape"in e?(E(Array.isArray(e.shape)&&e.shape.length>=2,"shape must be an array"),o=e.shape[0],a=e.shape[1],3===e.shape.length&&(u=e.shape[2],E(u>0&&u<=4,"invalid number of channels"),s=!0),E(o>=0&&o<=i.maxTextureSize,"invalid width"),E(a>=0&&a<=i.maxTextureSize,"invalid height")):("radius"in e&&(o=a=e.radius,E(o>=0&&o<=i.maxTextureSize,"invalid radius")),"width"in e&&(o=e.width,E(o>=0&&o<=i.maxTextureSize,"invalid width")),"height"in e&&(a=e.height,E(a>=0&&a<=i.maxTextureSize,"invalid height")),"channels"in e&&(u=e.channels,E(u>0&&u<=4,"invalid number of channels"),s=!0)),t.width=0|o,t.height=0|a,t.channels=0|u;var c=!1;if("format"in e){var f=e.format;E(r.webgl_depth_texture||!("depth"===f||"depth stencil"===f),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),E.parameter(f,v,"invalid texture format");var l=t.internalformat=v[f];t.format=A[l],f in p&&("type"in e||(t.type=p[f])),f in g&&(t.compressed=!0),c=!0}!s&&c?t.channels=Ht[t.format]:s&&!c?t.channels!==Wt[t.format]&&(t.format=t.internalformat=Wt[t.channels]):c&&s&&E(t.channels===Ht[t.format],"number of channels inconsistent with specified format")}}function O(t){n.pixelStorei(37440,t.flipY),n.pixelStorei(37441,t.premultiplyAlpha),n.pixelStorei(37443,t.colorSpace),n.pixelStorei(3317,t.unpackAlignment)}function C(){T.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function k(e,n){var r=null;if(ue(n)?r=n:n&&(E.type(n,"object","invalid pixel data type"),N(e,n),"x"in n&&(e.xOffset=0|n.x),"y"in n&&(e.yOffset=0|n.y),ue(n.data)&&(r=n.data)),E(!e.compressed||r instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),n.copy){E(!r,"can not specify copy and data field for the same texture");var o=a.viewportWidth,u=a.viewportHeight;e.width=e.width||o-e.xOffset,e.height=e.height||u-e.yOffset,e.needsCopy=!0,E(e.xOffset>=0&&e.xOffset<o&&e.yOffset>=0&&e.yOffset<u&&e.width>0&&e.width<=o&&e.height>0&&e.height<=u,"copy texture read out of bounds")}else if(r){if(t(r))e.channels=e.channels||4,e.data=r,"type"in n||e.type!==Mt||(e.type=se(r));else if(ne(r))e.channels=e.channels||4,function(t,e){var n=e.length;switch(t.type){case Mt:case Rt:case Pt:case Gt:var r=j.allocType(t.type,n);r.set(e),t.data=r;break;case Nt:t.data=dt(e);break;default:E.raise("unsupported texture type, must specify a typed array")}}(e,r),e.alignment=1,e.needsFree=!0;else if(V(r)){var s=r.data;Array.isArray(s)||e.type!==Mt||(e.type=se(s));var c,f,l,d,h,p,v=r.shape,g=r.stride;3===v.length?(l=v[2],p=g[2]):(E(2===v.length,"invalid ndarray pixel data, must be 2 or 3D"),l=1,p=1),c=v[0],f=v[1],d=g[0],h=g[1],e.alignment=1,e.width=c,e.height=f,e.channels=l,e.format=e.internalformat=Wt[l],e.needsFree=!0,function(t,e,n,r,i,o){for(var a=t.width,u=t.height,s=t.channels,c=ce(t,a*u*s),f=0,l=0;l<u;++l)for(var d=0;d<a;++d)for(var h=0;h<s;++h)c[f++]=e[n*d+r*l+i*h+o];fe(t,c)}(e,s,d,h,p,r.offset)}else if(oe(r)||ae(r)||ie(r)===Kt)oe(r)||ae(r)?e.element=r:e.element=r.canvas,e.width=e.element.width,e.height=e.element.height,e.channels=4;else if(function(t){return ie(t)===Zt}(r))e.element=r,e.width=r.width,e.height=r.height,e.channels=4;else if(function(t){return ie(t)===$t}(r))e.element=r,e.width=r.naturalWidth,e.height=r.naturalHeight,e.channels=4;else if(function(t){return ie(t)===Jt}(r))e.element=r,e.width=r.videoWidth,e.height=r.videoHeight,e.channels=4;else if(re(r)){var y=e.width||r[0].length,m=e.height||r.length,b=e.channels;b=ht(r[0][0])?b||r[0][0].length:b||1;for(var _=H.shape(r),x=1,w=0;w<_.length;++w)x*=_[w];var S=ce(e,x);H.flatten(r,_,"",S),fe(e,S),e.alignment=1,e.width=y,e.height=m,e.channels=b,e.format=e.internalformat=Wt[b],e.needsFree=!0}}else e.width=e.width||1,e.height=e.height||1,e.channels=e.channels||4;e.type===Gt?E(i.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):e.type===Nt&&E(i.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function D(t,e,r){var i=t.element,a=t.data,u=t.internalformat,s=t.format,c=t.type,f=t.width,l=t.height;O(t),i?n.texImage2D(e,r,s,s,c,i):t.compressed?n.compressedTexImage2D(e,r,u,f,l,0,a):t.needsCopy?(o(),n.copyTexImage2D(e,r,s,t.xOffset,t.yOffset,f,l,0)):n.texImage2D(e,r,s,f,l,0,s,c,a||null)}function M(t,e,r,i,a){var u=t.element,s=t.data,c=t.internalformat,f=t.format,l=t.type,d=t.width,h=t.height;O(t),u?n.texSubImage2D(e,a,r,i,f,l,u):t.compressed?n.compressedTexSubImage2D(e,a,r,i,c,d,h,s):t.needsCopy?(o(),n.copyTexSubImage2D(e,a,r,i,t.xOffset,t.yOffset,d,h)):n.texSubImage2D(e,a,r,i,d,h,f,l,s)}var R=[];function P(){return R.pop()||new C}function G(t){t.needsFree&&j.freeType(t.data),C.call(t),R.push(t)}function L(){T.call(this),this.genMipmaps=!1,this.mipmapHint=Bt,this.mipmask=0,this.images=Array(16)}function F(t,e,n){var r=t.images[0]=P();t.mipmask=1,r.width=t.width=e,r.height=t.height=n,r.channels=t.channels=4}function U(t,e){var n=null;if(ue(e))I(n=t.images[0]=P(),t),k(n,e),t.mipmask=1;else if(N(t,e),Array.isArray(e.mipmap))for(var r=e.mipmap,i=0;i<r.length;++i)I(n=t.images[i]=P(),t),n.width>>=i,n.height>>=i,k(n,r[i]),t.mipmask|=1<<i;else I(n=t.images[0]=P(),t),k(n,e),t.mipmask=1;I(t,t.images[0]),!t.compressed||t.internalformat!==Ot&&t.internalformat!==Ct&&t.internalformat!==kt&&t.internalformat!==Dt||E(t.width%4==0&&t.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function B(t,e){for(var n=t.images,r=0;r<n.length;++r){if(!n[r])return;D(n[r],e,r)}}var z=[];function X(){var t=z.pop()||new L;T.call(t),t.mipmask=0;for(var e=0;e<16;++e)t.images[e]=null;return t}function q(t){for(var e=t.images,n=0;n<e.length;++n)e[n]&&G(e[n]),e[n]=null;z.push(t)}function Y(){this.minFilter=jt,this.magFilter=jt,this.wrapS=Lt,this.wrapT=Lt,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Bt}function K(t,e){if("min"in e){var n=e.min;E.parameter(n,d),t.minFilter=d[n],Vt.indexOf(t.minFilter)>=0&&!("faces"in e)&&(t.genMipmaps=!0)}if("mag"in e){var r=e.mag;E.parameter(r,l),t.magFilter=l[r]}var o=t.wrapS,a=t.wrapT;if("wrap"in e){var u=e.wrap;"string"==typeof u?(E.parameter(u,f),o=a=f[u]):Array.isArray(u)&&(E.parameter(u[0],f),E.parameter(u[1],f),o=f[u[0]],a=f[u[1]])}else{if("wrapS"in e){var s=e.wrapS;E.parameter(s,f),o=f[s]}if("wrapT"in e){var h=e.wrapT;E.parameter(h,f),a=f[h]}}if(t.wrapS=o,t.wrapT=a,"anisotropic"in e){var p=e.anisotropic;E("number"==typeof p&&p>=1&&p<=i.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var v=!1;switch(typeof e.mipmap){case"string":E.parameter(e.mipmap,c,"invalid mipmap hint"),t.mipmapHint=c[e.mipmap],t.genMipmaps=!0,v=!0;break;case"boolean":v=t.genMipmaps=e.mipmap;break;case"object":E(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,v=!0;break;default:E.raise("invalid mipmap type")}v&&!("min"in e)&&(t.minFilter=Ft)}}function Z(t,e){n.texParameteri(e,10241,t.minFilter),n.texParameteri(e,10240,t.magFilter),n.texParameteri(e,10242,t.wrapS),n.texParameteri(e,10243,t.wrapT),r.ext_texture_filter_anisotropic&&n.texParameteri(e,34046,t.anisotropic),t.genMipmaps&&(n.hint(33170,t.mipmapHint),n.generateMipmap(e))}var $=0,J={},Q=i.maxTextureUnits,tt=Array(Q).map((function(){return null}));function et(t){T.call(this),this.mipmask=0,this.internalformat=mt,this.id=$++,this.refCount=1,this.target=t,this.texture=n.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Y,s.profile&&(this.stats={size:0})}function nt(t){n.activeTexture(zt),n.bindTexture(t.target,t.texture)}function rt(){var t=tt[0];t?n.bindTexture(t.target,t.texture):n.bindTexture(vt,null)}function it(t){var e=t.texture;E(e,"must not double destroy texture");var r=t.unit,i=t.target;r>=0&&(n.activeTexture(zt+r),n.bindTexture(i,null),tt[r]=null),n.deleteTexture(e),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete J[t.id],u.textureCount--}return e(et.prototype,{bind:function(){var t=this;t.bindCount+=1;var e=t.unit;if(e<0){for(var r=0;r<Q;++r){var i=tt[r];if(i){if(i.bindCount>0)continue;i.unit=-1}tt[r]=t,e=r;break}e>=Q&&E.raise("insufficient number of texture units"),s.profile&&u.maxTextureUnits<e+1&&(u.maxTextureUnits=e+1),t.unit=e,n.activeTexture(zt+e),n.bindTexture(t.target,t.texture)}return e},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&it(this)}}),s.profile&&(u.getTotalTextureSize=function(){var t=0;return Object.keys(J).forEach((function(e){t+=J[e].stats.size})),t}),{create2D:function(t,e){var r=new et(vt);function o(t,e){var n=r.texInfo;Y.call(n);var a=X();return"number"==typeof t?F(a,0|t,"number"==typeof e?0|e:0|t):t?(E.type(t,"object","invalid arguments to regl.texture"),K(n,t),U(a,t)):F(a,1,1),n.genMipmaps&&(a.mipmask=(a.width<<1)-1),r.mipmask=a.mipmask,I(r,a),E.texture2D(n,a,i),r.internalformat=a.internalformat,o.width=a.width,o.height=a.height,nt(r),B(a,vt),Z(n,vt),rt(),q(a),s.profile&&(r.stats.size=le(r.internalformat,r.type,a.width,a.height,n.genMipmaps,!1)),o.format=b[r.internalformat],o.type=_[r.type],o.mag=x[n.magFilter],o.min=w[n.minFilter],o.wrapS=S[n.wrapS],o.wrapT=S[n.wrapT],o}return J[r.id]=r,u.textureCount++,o(t,e),o.subimage=function(t,e,n,i){E(!!t,"must specify image data");var a=0|e,u=0|n,s=0|i,c=P();return I(c,r),c.width=0,c.height=0,k(c,t),c.width=c.width||(r.width>>s)-a,c.height=c.height||(r.height>>s)-u,E(r.type===c.type&&r.format===c.format&&r.internalformat===c.internalformat,"incompatible format for texture.subimage"),E(a>=0&&u>=0&&a+c.width<=r.width&&u+c.height<=r.height,"texture.subimage write out of bounds"),E(r.mipmask&1<<s,"missing mipmap data"),E(c.data||c.element||c.needsCopy,"missing image data"),nt(r),M(c,vt,a,u,s),rt(),G(c),o},o.resize=function(t,e){var i=0|t,a=0|e||i;if(i===r.width&&a===r.height)return o;o.width=r.width=i,o.height=r.height=a,nt(r);for(var u=0;r.mipmask>>u;++u){var c=i>>u,f=a>>u;if(!c||!f)break;n.texImage2D(vt,u,r.format,c,f,0,r.format,r.type,null)}return rt(),s.profile&&(r.stats.size=le(r.internalformat,r.type,i,a,!1,!1)),o},o._reglType="texture2d",o._texture=r,s.profile&&(o.stats=r.stats),o.destroy=function(){r.decRef()},o},createCube:function(t,e,r,o,a,c){var f=new et(gt);J[f.id]=f,u.cubeCount++;var l=new Array(6);function d(t,e,n,r,o,a){var u,c=f.texInfo;for(Y.call(c),u=0;u<6;++u)l[u]=X();if("number"!=typeof t&&t)if("object"==typeof t)if(e)U(l[0],t),U(l[1],e),U(l[2],n),U(l[3],r),U(l[4],o),U(l[5],a);else if(K(c,t),N(f,t),"faces"in t){var h=t.faces;for(E(Array.isArray(h)&&6===h.length,"cube faces must be a length 6 array"),u=0;u<6;++u)E("object"==typeof h[u]&&!!h[u],"invalid input for cube map face"),I(l[u],f),U(l[u],h[u])}else for(u=0;u<6;++u)U(l[u],t);else E.raise("invalid arguments to cube map");else{var p=0|t||1;for(u=0;u<6;++u)F(l[u],p,p)}for(I(f,l[0]),i.npotTextureCube||E(pt(f.width)&&pt(f.height),"your browser does not support non power or two texture dimensions"),c.genMipmaps?f.mipmask=(l[0].width<<1)-1:f.mipmask=l[0].mipmask,E.textureCube(f,c,l,i),f.internalformat=l[0].internalformat,d.width=l[0].width,d.height=l[0].height,nt(f),u=0;u<6;++u)B(l[u],yt+u);for(Z(c,gt),rt(),s.profile&&(f.stats.size=le(f.internalformat,f.type,d.width,d.height,c.genMipmaps,!0)),d.format=b[f.internalformat],d.type=_[f.type],d.mag=x[c.magFilter],d.min=w[c.minFilter],d.wrapS=S[c.wrapS],d.wrapT=S[c.wrapT],u=0;u<6;++u)q(l[u]);return d}return d(t,e,r,o,a,c),d.subimage=function(t,e,n,r,i){E(!!e,"must specify image data"),E("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var o=0|n,a=0|r,u=0|i,s=P();return I(s,f),s.width=0,s.height=0,k(s,e),s.width=s.width||(f.width>>u)-o,s.height=s.height||(f.height>>u)-a,E(f.type===s.type&&f.format===s.format&&f.internalformat===s.internalformat,"incompatible format for texture.subimage"),E(o>=0&&a>=0&&o+s.width<=f.width&&a+s.height<=f.height,"texture.subimage write out of bounds"),E(f.mipmask&1<<u,"missing mipmap data"),E(s.data||s.element||s.needsCopy,"missing image data"),nt(f),M(s,yt+t,o,a,u),rt(),G(s),d},d.resize=function(t){var e=0|t;if(e!==f.width){d.width=f.width=e,d.height=f.height=e,nt(f);for(var r=0;r<6;++r)for(var i=0;f.mipmask>>i;++i)n.texImage2D(yt+r,i,f.format,e>>i,e>>i,0,f.format,f.type,null);return rt(),s.profile&&(f.stats.size=le(f.internalformat,f.type,d.width,d.height,!1,!0)),d}},d._reglType="textureCube",d._texture=f,s.profile&&(d.stats=f.stats),d.destroy=function(){f.decRef()},d},clear:function(){for(var t=0;t<Q;++t)n.activeTexture(zt+t),n.bindTexture(vt,null),tt[t]=null;W(J).forEach(it),u.cubeCount=0,u.textureCount=0},getTexture:function(t){return null},restore:function(){for(var t=0;t<Q;++t){var e=tt[t];e&&(e.bindCount=0,e.unit=-1,tt[t]=null)}W(J).forEach((function(t){t.texture=n.createTexture(),n.bindTexture(t.target,t.texture);for(var e=0;e<32;++e)if(0!=(t.mipmask&1<<e))if(t.target===vt)n.texImage2D(vt,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);else for(var r=0;r<6;++r)n.texImage2D(yt+r,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);Z(t.texInfo,t.target)}))},refresh:function(){for(var t=0;t<Q;++t){var e=tt[t];e&&(e.bindCount=0,e.unit=-1,tt[t]=null),n.activeTexture(zt+t),n.bindTexture(vt,null),n.bindTexture(gt,null)}}}}ee[32854]=2,ee[32855]=2,ee[36194]=2,ee[34041]=4,ee[33776]=.5,ee[33777]=.5,ee[33778]=1,ee[33779]=1,ee[35986]=.5,ee[35987]=1,ee[34798]=1,ee[35840]=.5,ee[35841]=.25,ee[35842]=.5,ee[35843]=.25,ee[36196]=.5;var he=36161,pe=32854,ve=[];function ge(t,e,n){return ve[t]*e*n}ve[32854]=2,ve[32855]=2,ve[36194]=2,ve[33189]=2,ve[36168]=1,ve[34041]=4,ve[35907]=4,ve[34836]=16,ve[34842]=8,ve[34843]=6;var ye=36160,me=36161,be=3553,_e=34069,xe=[6407,6408],we=[];we[6408]=4,we[6407]=3;var Ee=[];Ee[5121]=1,Ee[5126]=4,Ee[36193]=2;var Se=[32854,32855,36194,35907,34842,34843,34836],Ae={};Ae[36053]="complete",Ae[36054]="incomplete attachment",Ae[36057]="incomplete dimensions",Ae[36055]="incomplete, missing attachment",Ae[36061]="unsupported";function Te(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.offset=0,this.stride=0,this.divisor=0}var Ie=5121,Ne=5126;function Oe(e,n,r,i,o,a,u){function s(s){var c;null===n.next?(E(o.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),c=Ie):(E(null!==n.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),c=n.next.colorAttachments[0].texture._texture.type,a.oes_texture_float?(E(c===Ie||c===Ne,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),c===Ne&&E(u.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):E(c===Ie,"Reading from a framebuffer is only allowed for the type 'uint8'"));var f=0,l=0,d=i.framebufferWidth,h=i.framebufferHeight,p=null;t(s)?p=s:s&&(E.type(s,"object","invalid arguments to regl.read()"),f=0|s.x,l=0|s.y,E(f>=0&&f<i.framebufferWidth,"invalid x offset for regl.read"),E(l>=0&&l<i.framebufferHeight,"invalid y offset for regl.read"),d=0|(s.width||i.framebufferWidth-f),h=0|(s.height||i.framebufferHeight-l),p=s.data||null),p&&(c===Ie?E(p instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):c===Ne&&E(p instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),E(d>0&&d+f<=i.framebufferWidth,"invalid width for read pixels"),E(h>0&&h+l<=i.framebufferHeight,"invalid height for read pixels"),r();var v=d*h*4;return p||(c===Ie?p=new Uint8Array(v):c===Ne&&(p=p||new Float32Array(v))),E.isTypedArray(p,"data buffer for regl.read() must be a typedarray"),E(p.byteLength>=v,"data buffer for regl.read() too small"),e.pixelStorei(3333,4),e.readPixels(f,l,d,h,6408,c,p),p}return function(t){return t&&"framebuffer"in t?function(t){var e;return n.setFBO({framebuffer:t.framebuffer},(function(){e=s(t)})),e}(t):s(t)}}function Ce(t){return Array.prototype.slice.call(t)}function ke(t){return Ce(t).join("")}var De="xyzw".split(""),Me="dither",Re="blend.enable",Pe="blend.color",Ge="blend.equation",Le="blend.func",je="depth.enable",Fe="depth.func",Ue="depth.range",Be="depth.mask",ze="colorMask",Ve="cull.enable",We="cull.face",He="frontFace",Xe="lineWidth",qe="polygonOffset.enable",Ye="polygonOffset.offset",Ke="sample.alpha",Ze="sample.enable",$e="sample.coverage",Je="stencil.enable",Qe="stencil.mask",tn="stencil.func",en="stencil.opFront",nn="stencil.opBack",rn="scissor.enable",on="scissor.box",an="viewport",un="profile",sn="framebuffer",cn="vert",fn="frag",ln="elements",dn="primitive",hn="count",pn="offset",vn="instances",gn="vao",yn="Width",mn="Height",bn=sn+yn,_n=sn+mn,xn="drawingBufferWidth",wn="drawingBufferHeight",En=[Le,Ge,tn,en,nn,$e,an,on,Ye],Sn=34962,An=5126,Tn=35664,In=35665,Nn=35666,On=5124,Cn=35667,kn=35668,Dn=35669,Mn=35670,Rn=35671,Pn=35672,Gn=35673,Ln=35674,jn=35675,Fn=35676,Un=35678,Bn=35680,zn=1028,Vn=1029,Wn=2305,Hn=7680,Xn={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},qn=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Yn={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Kn={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Zn={frag:35632,vert:35633},$n={cw:2304,ccw:Wn};function Jn(e){return Array.isArray(e)||t(e)||V(e)}function Qn(t){return t.sort((function(t,e){return t===an?-1:e===an?1:t<e?-1:1}))}function tr(t,e,n,r){this.thisDep=t,this.contextDep=e,this.propDep=n,this.append=r}function er(t){return t&&!(t.thisDep||t.contextDep||t.propDep)}function nr(t){return new tr(!1,!1,!1,t)}function rr(t,e){var n=t.type;if(0===n){var r=t.data.length;return new tr(!0,r>=1,r>=2,e)}if(4===n){var i=t.data;return new tr(i.thisDep,i.contextDep,i.propDep,e)}if(5===n)return new tr(!1,!1,!1,e);if(6===n){for(var o=!1,a=!1,u=!1,s=0;s<t.data.length;++s){var c=t.data[s];if(1===c.type)u=!0;else if(2===c.type)a=!0;else if(3===c.type)o=!0;else if(0===c.type){o=!0;var f=c.data;f>=1&&(a=!0),f>=2&&(u=!0)}else 4===c.type&&(o=o||c.data.thisDep,a=a||c.data.contextDep,u=u||c.data.propDep)}return new tr(o,a,u,e)}return new tr(3===n,2===n,1===n,e)}var ir=new tr(!1,!1,!1,(function(){}));function or(t,n,r,i,o,a,u,s,c,f,l,d,h,p,v){var g=f.Record,y={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(y.min=32775,y.max=32776);var m=r.angle_instanced_arrays,b=r.webgl_draw_buffers,_={dirty:!0,profile:v.profile},x={},w=[],S={},A={};function T(t){return t.replace(".","_")}function I(t,e,n){var r=T(t);w.push(t),x[r]=_[r]=!!n,S[r]=e}function N(t,e,n){var r=T(t);w.push(t),Array.isArray(n)?(_[r]=n.slice(),x[r]=n.slice()):_[r]=x[r]=n,A[r]=e}I(Me,3024),I(Re,3042),N(Pe,"blendColor",[0,0,0,0]),N(Ge,"blendEquationSeparate",[32774,32774]),N(Le,"blendFuncSeparate",[1,0,1,0]),I(je,2929,!0),N(Fe,"depthFunc",513),N(Ue,"depthRange",[0,1]),N(Be,"depthMask",!0),N(ze,ze,[!0,!0,!0,!0]),I(Ve,2884),N(We,"cullFace",Vn),N(He,He,Wn),N(Xe,Xe,1),I(qe,32823),N(Ye,"polygonOffset",[0,0]),I(Ke,32926),I(Ze,32928),N($e,"sampleCoverage",[1,!1]),I(Je,2960),N(Qe,"stencilMask",-1),N(tn,"stencilFunc",[519,0,-1]),N(en,"stencilOpSeparate",[zn,Hn,Hn,Hn]),N(nn,"stencilOpSeparate",[Vn,Hn,Hn,Hn]),I(rn,3089),N(on,"scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),N(an,an,[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var C={gl:t,context:h,strings:n,next:x,current:_,draw:d,elements:a,buffer:o,shader:l,attributes:f.state,vao:f,uniforms:c,framebuffer:s,extensions:r,timer:p,isBufferArgs:Jn},k={primTypes:ot,compareFuncs:Yn,blendFuncs:Xn,blendEquations:y,stencilOps:Kn,glTypes:K,orientationType:$n};E.optional((function(){C.isArrayLike=ht})),b&&(k.backBuffer=[Vn],k.drawBuffer=P(i.maxDrawbuffers,(function(t){return 0===t?[0]:P(t,(function(t){return 36064+t}))})));var D=0;function M(){var t=function(){var t=0,n=[],r=[];function i(){var n=[],r=[];return e((function(){n.push.apply(n,Ce(arguments))}),{def:function(){var e="v"+t++;return r.push(e),arguments.length>0&&(n.push(e,"="),n.push.apply(n,Ce(arguments)),n.push(";")),e},toString:function(){return ke([r.length>0?"var "+r.join(",")+";":"",ke(n)])}})}function o(){var t=i(),n=i(),r=t.toString,o=n.toString;function a(e,r){n(e,r,"=",t.def(e,r),";")}return e((function(){t.apply(t,Ce(arguments))}),{def:t.def,entry:t,exit:n,save:a,set:function(e,n,r){a(e,n),t(e,n,"=",r,";")},toString:function(){return r()+o()}})}var a=i(),u={};return{global:a,link:function(e){for(var i=0;i<r.length;++i)if(r[i]===e)return n[i];var o="g"+t++;return n.push(o),r.push(e),o},block:i,proc:function(t,n){var r=[];function i(){var t="a"+r.length;return r.push(t),t}n=n||0;for(var a=0;a<n;++a)i();var s=o(),c=s.toString;return u[t]=e(s,{arg:i,toString:function(){return ke(["function(",r.join(),"){",c(),"}"])}})},scope:o,cond:function(){var t=ke(arguments),n=o(),r=o(),i=n.toString,a=r.toString;return e(n,{then:function(){return n.apply(n,Ce(arguments)),this},else:function(){return r.apply(r,Ce(arguments)),this},toString:function(){var e=a();return e&&(e="else{"+e+"}"),ke(["if(",t,"){",i(),"}",e])}})},compile:function(){var t=['"use strict";',a,"return {"];Object.keys(u).forEach((function(e){t.push('"',e,'":',u[e].toString(),",")})),t.push("}");var e=ke(t).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,n.concat(e)).apply(null,r)}}}(),r=t.link,i=t.global;t.id=D++,t.batchId="0";var o=r(C),a=t.shared={props:"a0"};Object.keys(C).forEach((function(t){a[t]=i.def(o,".",t)})),E.optional((function(){t.CHECK=r(E),t.commandStr=E.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},k.invalidBlendCombinations=qn}));var u=t.next={},s=t.current={};Object.keys(A).forEach((function(t){Array.isArray(_[t])&&(u[t]=i.def(a.next,".",t),s[t]=i.def(a.current,".",t))}));var c=t.constants={};Object.keys(k).forEach((function(t){c[t]=i.def(JSON.stringify(k[t]))})),t.invoke=function(e,n){switch(n.type){case 0:var i=["this",a.context,a.props,t.batchId];return e.def(r(n.data),".call(",i.slice(0,Math.max(n.data.length+1,4)),")");case 1:return e.def(a.props,n.data);case 2:return e.def(a.context,n.data);case 3:return e.def("this",n.data);case 4:return n.data.append(t,e),n.data.ref;case 5:return n.data.toString();case 6:return n.data.map((function(n){return t.invoke(e,n)}))}},t.attribCache={};var l={};return t.scopeAttrib=function(t){var e=n.id(t);if(e in l)return l[e];var i=f.scope[e];return i||(i=f.scope[e]=new g),l[e]=r(i)},t}function R(t,e,u,c,d){var h=t.static,p=t.dynamic;E.optional((function(){var t=[sn,cn,fn,ln,dn,pn,hn,vn,un,gn].concat(w);function e(e){Object.keys(e).forEach((function(e){E.command(t.indexOf(e)>=0,'unknown parameter "'+e+'"',d.commandStr)}))}e(h),e(p)}));var v=function(t,e){var n=t.static;if("string"==typeof n[fn]&&"string"==typeof n[cn]){if(Object.keys(e.dynamic).length>0)return null;var r=e.static,i=Object.keys(r);if(i.length>0&&"number"==typeof r[i[0]]){for(var o=[],a=0;a<i.length;++a)E("number"==typeof r[i[a]],"must specify all vertex attribute locations when using vaos"),o.push([0|r[i[a]],i[a]]);return o}}return null}(t,e),b=function(t,e){var n=t.static,r=t.dynamic;if(sn in n){var i=n[sn];return i?(i=s.getFramebuffer(i),E.command(i,"invalid framebuffer object"),nr((function(t,e){var n=t.link(i),r=t.shared;e.set(r.framebuffer,".next",n);var o=r.context;return e.set(o,"."+bn,n+".width"),e.set(o,"."+_n,n+".height"),n}))):nr((function(t,e){var n=t.shared;e.set(n.framebuffer,".next","null");var r=n.context;return e.set(r,"."+bn,r+"."+xn),e.set(r,"."+_n,r+"."+wn),"null"}))}if(sn in r){var o=r[sn];return rr(o,(function(t,e){var n=t.invoke(e,o),r=t.shared,i=r.framebuffer,a=e.def(i,".getFramebuffer(",n,")");E.optional((function(){t.assert(e,"!"+n+"||"+a,"invalid framebuffer object")})),e.set(i,".next",a);var u=r.context;return e.set(u,"."+bn,a+"?"+a+".width:"+u+"."+xn),e.set(u,"."+_n,a+"?"+a+".height:"+u+"."+wn),a}))}return null}(t),_=function(t,e,n){var r=t.static,i=t.dynamic;function o(t){if(t in r){var o=r[t];E.commandType(o,"object","invalid "+t,n.commandStr);var a,u,s=!0,c=0|o.x,f=0|o.y;return"width"in o?(a=0|o.width,E.command(a>=0,"invalid "+t,n.commandStr)):s=!1,"height"in o?(u=0|o.height,E.command(u>=0,"invalid "+t,n.commandStr)):s=!1,new tr(!s&&e&&e.thisDep,!s&&e&&e.contextDep,!s&&e&&e.propDep,(function(t,e){var n=t.shared.context,r=a;"width"in o||(r=e.def(n,".",bn,"-",c));var i=u;return"height"in o||(i=e.def(n,".",_n,"-",f)),[c,f,r,i]}))}if(t in i){var l=i[t],d=rr(l,(function(e,n){var r=e.invoke(n,l);E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)}));var i=e.shared.context,o=n.def(r,".x|0"),a=n.def(r,".y|0"),u=n.def('"width" in ',r,"?",r,".width|0:","(",i,".",bn,"-",o,")"),s=n.def('"height" in ',r,"?",r,".height|0:","(",i,".",_n,"-",a,")");return E.optional((function(){e.assert(n,u+">=0&&"+s+">=0","invalid "+t)})),[o,a,u,s]}));return e&&(d.thisDep=d.thisDep||e.thisDep,d.contextDep=d.contextDep||e.contextDep,d.propDep=d.propDep||e.propDep),d}return e?new tr(e.thisDep,e.contextDep,e.propDep,(function(t,e){var n=t.shared.context;return[0,0,e.def(n,".",bn),e.def(n,".",_n)]})):null}var a=o(an);if(a){var u=a;a=new tr(a.thisDep,a.contextDep,a.propDep,(function(t,e){var n=u.append(t,e),r=t.shared.context;return e.set(r,".viewportWidth",n[2]),e.set(r,".viewportHeight",n[3]),n}))}return{viewport:a,scissor_box:o(on)}}(t,b,d),x=function(t,e){var n=t.static,r=t.dynamic,i=function(){if(ln in n){var t=n[ln];Jn(t)?t=a.getElements(a.create(t,!0)):t&&(t=a.getElements(t),E.command(t,"invalid elements",e.commandStr));var i=nr((function(e,n){if(t){var r=e.link(t);return e.ELEMENTS=r,r}return e.ELEMENTS=null,null}));return i.value=t,i}if(ln in r){var o=r[ln];return rr(o,(function(t,e){var n=t.shared,r=n.isBufferArgs,i=n.elements,a=t.invoke(e,o),u=e.def("null"),s=e.def(r,"(",a,")"),c=t.cond(s).then(u,"=",i,".createStream(",a,");").else(u,"=",i,".getElements(",a,");");return E.optional((function(){t.assert(c.else,"!"+a+"||"+u,"invalid elements")})),e.entry(c),e.exit(t.cond(s).then(i,".destroyStream(",u,");")),t.ELEMENTS=u,u}))}return null}();function o(t,o){if(t in n){var a=0|n[t];return E.command(!o||a>=0,"invalid "+t,e.commandStr),nr((function(t,e){return o&&(t.OFFSET=a),a}))}if(t in r){var u=r[t];return rr(u,(function(e,n){var r=e.invoke(n,u);return o&&(e.OFFSET=r,E.optional((function(){e.assert(n,r+">=0","invalid "+t)}))),r}))}return o&&i?nr((function(t,e){return t.OFFSET="0",0})):null}var u=o(pn,!0);return{elements:i,primitive:function(){if(dn in n){var t=n[dn];return E.commandParameter(t,ot,"invalid primitve",e.commandStr),nr((function(e,n){return ot[t]}))}if(dn in r){var o=r[dn];return rr(o,(function(t,e){var n=t.constants.primTypes,r=t.invoke(e,o);return E.optional((function(){t.assert(e,r+" in "+n,"invalid primitive, must be one of "+Object.keys(ot))})),e.def(n,"[",r,"]")}))}return i?er(i)?i.value?nr((function(t,e){return e.def(t.ELEMENTS,".primType")})):nr((function(){return 4})):new tr(i.thisDep,i.contextDep,i.propDep,(function(t,e){var n=t.ELEMENTS;return e.def(n,"?",n,".primType:",4)})):null}(),count:function(){if(hn in n){var t=0|n[hn];return E.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),nr((function(){return t}))}if(hn in r){var o=r[hn];return rr(o,(function(t,e){var n=t.invoke(e,o);return E.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")})),n}))}if(i){if(er(i)){if(i)return u?new tr(u.thisDep,u.contextDep,u.propDep,(function(t,e){var n=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return E.optional((function(){t.assert(e,n+">=0","invalid vertex offset/element buffer too small")})),n})):nr((function(t,e){return e.def(t.ELEMENTS,".vertCount")}));var a=nr((function(){return-1}));return E.optional((function(){a.MISSING=!0})),a}var s=new tr(i.thisDep||u.thisDep,i.contextDep||u.contextDep,i.propDep||u.propDep,(function(t,e){var n=t.ELEMENTS;return t.OFFSET?e.def(n,"?",n,".vertCount-",t.OFFSET,":-1"):e.def(n,"?",n,".vertCount:-1")}));return E.optional((function(){s.DYNAMIC=!0})),s}return null}(),instances:o(vn,!1),offset:u}}(t,d),S=function(t,e){var n=t.static,r=t.dynamic,o={};return w.forEach((function(t){var a=T(t);function u(e,i){if(t in n){var u=e(n[t]);o[a]=nr((function(){return u}))}else if(t in r){var s=r[t];o[a]=rr(s,(function(t,e){return i(t,e,t.invoke(e,s))}))}}switch(t){case Ve:case Re:case Me:case Je:case je:case rn:case qe:case Ke:case Ze:case Be:return u((function(n){return E.commandType(n,"boolean",t,e.commandStr),n}),(function(e,n,r){return E.optional((function(){e.assert(n,"typeof "+r+'==="boolean"',"invalid flag "+t,e.commandStr)})),r}));case Fe:return u((function(n){return E.commandParameter(n,Yn,"invalid "+t,e.commandStr),Yn[n]}),(function(e,n,r){var i=e.constants.compareFuncs;return E.optional((function(){e.assert(n,r+" in "+i,"invalid "+t+", must be one of "+Object.keys(Yn))})),n.def(i,"[",r,"]")}));case Ue:return u((function(t){return E.command(ht(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===2&&typeof "+n+'[0]==="number"&&typeof '+n+'[1]==="number"&&'+n+"[0]<="+n+"[1]","depth range must be a 2d array")})),[e.def("+",n,"[0]"),e.def("+",n,"[1]")]}));case Le:return u((function(t){E.commandType(t,"object","blend.func",e.commandStr);var n="srcRGB"in t?t.srcRGB:t.src,r="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,o="dstAlpha"in t?t.dstAlpha:t.dst;return E.commandParameter(n,Xn,a+".srcRGB",e.commandStr),E.commandParameter(r,Xn,a+".srcAlpha",e.commandStr),E.commandParameter(i,Xn,a+".dstRGB",e.commandStr),E.commandParameter(o,Xn,a+".dstAlpha",e.commandStr),E.command(-1===qn.indexOf(n+", "+i),"unallowed blending combination (srcRGB, dstRGB) = ("+n+", "+i+")",e.commandStr),[Xn[n],Xn[i],Xn[r],Xn[o]]}),(function(e,n,r){var i=e.constants.blendFuncs;function o(o,a){var u=n.def('"',o,a,'" in ',r,"?",r,".",o,a,":",r,".",o);return E.optional((function(){e.assert(n,u+" in "+i,"invalid "+t+"."+o+a+", must be one of "+Object.keys(Xn))})),u}E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid blend func, must be an object")}));var a=o("src","RGB"),u=o("dst","RGB");E.optional((function(){var t=e.constants.invalidBlendCombinations;e.assert(n,t+".indexOf("+a+'+", "+'+u+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")}));var s=n.def(i,"[",a,"]"),c=n.def(i,"[",o("src","Alpha"),"]");return[s,n.def(i,"[",u,"]"),c,n.def(i,"[",o("dst","Alpha"),"]")]}));case Ge:return u((function(n){return"string"==typeof n?(E.commandParameter(n,y,"invalid "+t,e.commandStr),[y[n],y[n]]):"object"==typeof n?(E.commandParameter(n.rgb,y,t+".rgb",e.commandStr),E.commandParameter(n.alpha,y,t+".alpha",e.commandStr),[y[n.rgb],y[n.alpha]]):void E.commandRaise("invalid blend.equation",e.commandStr)}),(function(e,n,r){var i=e.constants.blendEquations,o=n.def(),a=n.def(),u=e.cond("typeof ",r,'==="string"');return E.optional((function(){function n(t,n,r){e.assert(t,r+" in "+i,"invalid "+n+", must be one of "+Object.keys(y))}n(u.then,t,r),e.assert(u.else,r+"&&typeof "+r+'==="object"',"invalid "+t),n(u.else,t+".rgb",r+".rgb"),n(u.else,t+".alpha",r+".alpha")})),u.then(o,"=",a,"=",i,"[",r,"];"),u.else(o,"=",i,"[",r,".rgb];",a,"=",i,"[",r,".alpha];"),n(u),[o,a]}));case Pe:return u((function(t){return E.command(ht(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),P(4,(function(e){return+t[e]}))}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","blend.color must be a 4d array")})),P(4,(function(t){return e.def("+",n,"[",t,"]")}))}));case Qe:return u((function(t){return E.commandType(t,"number",a,e.commandStr),0|t}),(function(t,e,n){return E.optional((function(){t.assert(e,"typeof "+n+'==="number"',"invalid stencil.mask")})),e.def(n,"|0")}));case tn:return u((function(n){E.commandType(n,"object",a,e.commandStr);var r=n.cmp||"keep",i=n.ref||0,o="mask"in n?n.mask:-1;return E.commandParameter(r,Yn,t+".cmp",e.commandStr),E.commandType(i,"number",t+".ref",e.commandStr),E.commandType(o,"number",t+".mask",e.commandStr),[Yn[r],i,o]}),(function(t,e,n){var r=t.constants.compareFuncs;return E.optional((function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(n+"&&typeof ",n,'==="object"'),i('!("cmp" in ',n,")||(",n,".cmp in ",r,")")})),[e.def('"cmp" in ',n,"?",r,"[",n,".cmp]",":",Hn),e.def(n,".ref|0"),e.def('"mask" in ',n,"?",n,".mask|0:-1")]}));case en:case nn:return u((function(n){E.commandType(n,"object",a,e.commandStr);var r=n.fail||"keep",i=n.zfail||"keep",o=n.zpass||"keep";return E.commandParameter(r,Kn,t+".fail",e.commandStr),E.commandParameter(i,Kn,t+".zfail",e.commandStr),E.commandParameter(o,Kn,t+".zpass",e.commandStr),[t===nn?Vn:zn,Kn[r],Kn[i],Kn[o]]}),(function(e,n,r){var i=e.constants.stencilOps;function o(o){return E.optional((function(){e.assert(n,'!("'+o+'" in '+r+")||("+r+"."+o+" in "+i+")","invalid "+t+"."+o+", must be one of "+Object.keys(Kn))})),n.def('"',o,'" in ',r,"?",i,"[",r,".",o,"]:",Hn)}return E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),[t===nn?Vn:zn,o("fail"),o("zfail"),o("zpass")]}));case Ye:return u((function(t){E.commandType(t,"object",a,e.commandStr);var n=0|t.factor,r=0|t.units;return E.commandType(n,"number",a+".factor",e.commandStr),E.commandType(r,"number",a+".units",e.commandStr),[n,r]}),(function(e,n,r){return E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),[n.def(r,".factor|0"),n.def(r,".units|0")]}));case We:return u((function(t){var n=0;return"front"===t?n=zn:"back"===t&&(n=Vn),E.command(!!n,a,e.commandStr),n}),(function(t,e,n){return E.optional((function(){t.assert(e,n+'==="front"||'+n+'==="back"',"invalid cull.face")})),e.def(n,'==="front"?',zn,":",Vn)}));case Xe:return u((function(t){return E.command("number"==typeof t&&t>=i.lineWidthDims[0]&&t<=i.lineWidthDims[1],"invalid line width, must be a positive number between "+i.lineWidthDims[0]+" and "+i.lineWidthDims[1],e.commandStr),t}),(function(t,e,n){return E.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">="+i.lineWidthDims[0]+"&&"+n+"<="+i.lineWidthDims[1],"invalid line width")})),n}));case He:return u((function(t){return E.commandParameter(t,$n,a,e.commandStr),$n[t]}),(function(t,e,n){return E.optional((function(){t.assert(e,n+'==="cw"||'+n+'==="ccw"',"invalid frontFace, must be one of cw,ccw")})),e.def(n+'==="cw"?2304:'+Wn)}));case ze:return u((function(t){return E.command(ht(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map((function(t){return!!t}))}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","invalid color.mask")})),P(4,(function(t){return"!!"+n+"["+t+"]"}))}));case $e:return u((function(t){E.command("object"==typeof t&&t,a,e.commandStr);var n="value"in t?t.value:1,r=!!t.invert;return E.command("number"==typeof n&&n>=0&&n<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[n,r]}),(function(t,e,n){return E.optional((function(){t.assert(e,n+"&&typeof "+n+'==="object"',"invalid sample.coverage")})),[e.def('"value" in ',n,"?+",n,".value:1"),e.def("!!",n,".invert")]}))}})),o}(t,d),A=function(t,e,r){var i=t.static,o=t.dynamic;function a(t){if(t in i){var e=n.id(i[t]);E.optional((function(){l.shader(Zn[t],e,E.guessCommand())}));var r=nr((function(){return e}));return r.id=e,r}if(t in o){var a=o[t];return rr(a,(function(e,n){var r=e.invoke(n,a),i=n.def(e.shared.strings,".id(",r,")");return E.optional((function(){n(e.shared.shader,".shader(",Zn[t],",",i,",",e.command,");")})),i}))}return null}var u,s=a(fn),c=a(cn),f=null;return er(s)&&er(c)?(f=l.program(c.id,s.id,null,r),u=nr((function(t,e){return t.link(f)}))):u=new tr(s&&s.thisDep||c&&c.thisDep,s&&s.contextDep||c&&c.contextDep,s&&s.propDep||c&&c.propDep,(function(t,e){var n,r=t.shared.shader;n=s?s.append(t,e):e.def(r,".",fn);var i=r+".program("+(c?c.append(t,e):e.def(r,".",cn))+","+n;return E.optional((function(){i+=","+t.command})),e.def(i+")")})),{frag:s,vert:c,progVar:u,program:f}}(t,0,v);function I(t){var e=_[t];e&&(S[t]=e)}I(an),I(T(on));var N=Object.keys(S).length>0,O={framebuffer:b,draw:x,shader:A,state:S,dirty:N,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(O.profile=function(t){var e,n=t.static,r=t.dynamic;if(un in n){var i=!!n[un];(e=nr((function(t,e){return i}))).enable=i}else if(un in r){var o=r[un];e=rr(o,(function(t,e){return t.invoke(e,o)}))}return e}(t),O.uniforms=function(t,e){var n=t.static,r=t.dynamic,i={};return Object.keys(n).forEach((function(t){var r,o=n[t];if("number"==typeof o||"boolean"==typeof o)r=nr((function(){return o}));else if("function"==typeof o){var a=o._reglType;"texture2d"===a||"textureCube"===a?r=nr((function(t){return t.link(o)})):"framebuffer"===a||"framebufferCube"===a?(E.command(o.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),r=nr((function(t){return t.link(o.color[0])}))):E.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else ht(o)?r=nr((function(e){return e.global.def("[",P(o.length,(function(n){return E.command("number"==typeof o[n]||"boolean"==typeof o[n],"invalid uniform "+t,e.commandStr),o[n]})),"]")})):E.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);r.value=o,i[t]=r})),Object.keys(r).forEach((function(t){var e=r[t];i[t]=rr(e,(function(t,n){return t.invoke(n,e)}))})),i}(u,d),O.drawVAO=O.scopeVAO=function(t,e){var n=t.static,r=t.dynamic;if(gn in n){var i=n[gn];return null!==i&&null===f.getVAO(i)&&(i=f.createVAO(i)),nr((function(t){return t.link(f.getVAO(i))}))}if(gn in r){var o=r[gn];return rr(o,(function(t,e){var n=t.invoke(e,o);return e.def(t.shared.vao+".getVAO("+n+")")}))}return null}(t),!O.drawVAO&&A.program&&!v&&r.angle_instanced_arrays){var C=!0,k=A.program.attributes.map((function(t){var n=e.static[t];return C=C&&!!n,n}));if(C&&k.length>0){var D=f.getVAO(f.createVAO(k));O.drawVAO=new tr(null,null,null,(function(t,e){return t.link(D)})),O.useVAO=!0}}return v?O.useVAO=!0:O.attributes=function(t,e){var r=t.static,i=t.dynamic,a={};return Object.keys(r).forEach((function(t){var i=r[t],u=n.id(t),s=new g;if(Jn(i))s.state=1,s.buffer=o.getBuffer(o.create(i,Sn,!1,!0)),s.type=0;else{var c=o.getBuffer(i);if(c)s.state=1,s.buffer=c,s.type=0;else if(E.command("object"==typeof i&&i,"invalid data for attribute "+t,e.commandStr),"constant"in i){var f=i.constant;s.buffer="null",s.state=2,"number"==typeof f?s.x=f:(E.command(ht(f)&&f.length>0&&f.length<=4,"invalid constant for attribute "+t,e.commandStr),De.forEach((function(t,e){e<f.length&&(s[t]=f[e])})))}else{c=Jn(i.buffer)?o.getBuffer(o.create(i.buffer,Sn,!1,!0)):o.getBuffer(i.buffer),E.command(!!c,'missing buffer for attribute "'+t+'"',e.commandStr);var l=0|i.offset;E.command(l>=0,'invalid offset for attribute "'+t+'"',e.commandStr);var d=0|i.stride;E.command(d>=0&&d<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',e.commandStr);var h=0|i.size;E.command(!("size"in i)||h>0&&h<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',e.commandStr);var p=!!i.normalized,v=0;"type"in i&&(E.commandParameter(i.type,K,"invalid type for attribute "+t,e.commandStr),v=K[i.type]);var y=0|i.divisor;"divisor"in i&&(E.command(0===y||m,'cannot specify divisor for attribute "'+t+'", instancing not supported',e.commandStr),E.command(y>=0,'invalid divisor for attribute "'+t+'"',e.commandStr)),E.optional((function(){var n=e.commandStr,r=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach((function(e){E.command(r.indexOf(e)>=0,'unknown parameter "'+e+'" for attribute pointer "'+t+'" (valid parameters are '+r+")",n)}))})),s.buffer=c,s.state=1,s.size=h,s.normalized=p,s.type=v||c.dtype,s.offset=l,s.stride=d,s.divisor=y}}a[t]=nr((function(t,e){var n=t.attribCache;if(u in n)return n[u];var r={isStream:!1};return Object.keys(s).forEach((function(t){r[t]=s[t]})),s.buffer&&(r.buffer=t.link(s.buffer),r.type=r.type||r.buffer+".dtype"),n[u]=r,r}))})),Object.keys(i).forEach((function(t){var e=i[t];a[t]=rr(e,(function(n,r){var i=n.invoke(r,e),o=n.shared,a=n.constants,u=o.isBufferArgs,s=o.buffer;E.optional((function(){n.assert(r,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+u+"("+i+")||"+s+".getBuffer("+i+")||"+s+".getBuffer("+i+".buffer)||"+u+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')}));var c={isStream:r.def(!1)},f=new g;f.state=1,Object.keys(f).forEach((function(t){c[t]=r.def(""+f[t])}));var l=c.buffer,d=c.type;function h(t){r(c[t],"=",i,".",t,"|0;")}return r("if(",u,"(",i,")){",c.isStream,"=true;",l,"=",s,".createStream(",Sn,",",i,");",d,"=",l,".dtype;","}else{",l,"=",s,".getBuffer(",i,");","if(",l,"){",d,"=",l,".dtype;",'}else if("constant" in ',i,"){",c.state,"=",2,";","if(typeof "+i+'.constant === "number"){',c[De[0]],"=",i,".constant;",De.slice(1).map((function(t){return c[t]})).join("="),"=0;","}else{",De.map((function(t,e){return c[t]+"="+i+".constant.length>"+e+"?"+i+".constant["+e+"]:0;"})).join(""),"}}else{","if(",u,"(",i,".buffer)){",l,"=",s,".createStream(",Sn,",",i,".buffer);","}else{",l,"=",s,".getBuffer(",i,".buffer);","}",d,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",l,".dtype;",c.normalized,"=!!",i,".normalized;"),h("size"),h("offset"),h("stride"),h("divisor"),r("}}"),r.exit("if(",c.isStream,"){",s,".destroyStream(",l,");","}"),c}))})),a}(e,d),O.context=function(t){var e=t.static,n=t.dynamic,r={};return Object.keys(e).forEach((function(t){var n=e[t];r[t]=nr((function(t,e){return"number"==typeof n||"boolean"==typeof n?""+n:t.link(n)}))})),Object.keys(n).forEach((function(t){var e=n[t];r[t]=rr(e,(function(t,n){return t.invoke(n,e)}))})),r}(c),O}function G(t,e,n){var r=t.shared.context,i=t.scope();Object.keys(n).forEach((function(o){e.save(r,"."+o);var a=n[o].append(t,e);Array.isArray(a)?i(r,".",o,"=[",a.join(),"];"):i(r,".",o,"=",a,";")})),e(i)}function L(t,e,n,r){var i,o=t.shared,a=o.gl,u=o.framebuffer;b&&(i=e.def(o.extensions,".webgl_draw_buffers"));var s,c=t.constants,f=c.drawBuffer,l=c.backBuffer;s=n?n.append(t,e):e.def(u,".next"),r||e("if(",s,"!==",u,".cur){"),e("if(",s,"){",a,".bindFramebuffer(",36160,",",s,".framebuffer);"),b&&e(i,".drawBuffersWEBGL(",f,"[",s,".colorAttachments.length]);"),e("}else{",a,".bindFramebuffer(",36160,",null);"),b&&e(i,".drawBuffersWEBGL(",l,");"),e("}",u,".cur=",s,";"),r||e("}")}function j(t,e,n){var r=t.shared,i=r.gl,o=t.current,a=t.next,u=r.current,s=r.next,c=t.cond(u,".dirty");w.forEach((function(e){var r,f,l=T(e);if(!(l in n.state))if(l in a){r=a[l],f=o[l];var d=P(_[l].length,(function(t){return c.def(r,"[",t,"]")}));c(t.cond(d.map((function(t,e){return t+"!=="+f+"["+e+"]"})).join("||")).then(i,".",A[l],"(",d,");",d.map((function(t,e){return f+"["+e+"]="+t})).join(";"),";"))}else{r=c.def(s,".",l);var h=t.cond(r,"!==",u,".",l);c(h),l in S?h(t.cond(r).then(i,".enable(",S[l],");").else(i,".disable(",S[l],");"),u,".",l,"=",r,";"):h(i,".",A[l],"(",r,");",u,".",l,"=",r,";")}})),0===Object.keys(n.state).length&&c(u,".dirty=false;"),e(c)}function F(t,e,n,r){var i=t.shared,o=t.current,a=i.current,u=i.gl;Qn(Object.keys(n)).forEach((function(i){var s=n[i];if(!r||r(s)){var c=s.append(t,e);if(S[i]){var f=S[i];er(s)?e(u,c?".enable(":".disable(",f,");"):e(t.cond(c).then(u,".enable(",f,");").else(u,".disable(",f,");")),e(a,".",i,"=",c,";")}else if(ht(c)){var l=o[i];e(u,".",A[i],"(",c,");",c.map((function(t,e){return l+"["+e+"]="+t})).join(";"),";")}else e(u,".",A[i],"(",c,");",a,".",i,"=",c,";")}}))}function U(t,e){m&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function B(t,e,n,r,i){var o,a,u,s=t.shared,c=t.stats,f=s.current,l=s.timer,d=n.profile;function h(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function v(t){t(o=e.def(),"=",h(),";"),"string"==typeof i?t(c,".count+=",i,";"):t(c,".count++;"),p&&(r?t(a=e.def(),"=",l,".getNumPendingQueries();"):t(l,".beginQuery(",c,");"))}function g(t){t(c,".cpuTime+=",h(),"-",o,";"),p&&(r?t(l,".pushScopeStats(",a,",",l,".getNumPendingQueries(),",c,");"):t(l,".endQuery();"))}function y(t){var n=e.def(f,".profile");e(f,".profile=",t,";"),e.exit(f,".profile=",n,";")}if(d){if(er(d))return void(d.enable?(v(e),g(e.exit),y("true")):y("false"));y(u=d.append(t,e))}else u=e.def(f,".profile");var m=t.block();v(m),e("if(",u,"){",m,"}");var b=t.block();g(b),e.exit("if(",u,"){",b,"}")}function z(t,e,n,r,i){var o=t.shared;r.forEach((function(r){var a,u=r.name,s=n.attributes[u];if(s){if(!i(s))return;a=s.append(t,e)}else{if(!i(ir))return;var c=t.scopeAttrib(u);E.optional((function(){t.assert(e,c+".state","missing attribute "+u)})),a={},Object.keys(new g).forEach((function(t){a[t]=e.def(c,".",t)}))}!function(n,r,i){var a=o.gl,u=e.def(n,".location"),s=e.def(o.attributes,"[",u,"]"),c=i.state,f=i.buffer,l=[i.x,i.y,i.z,i.w],d=["buffer","normalized","offset","stride"];function h(){e("if(!",s,".buffer){",a,".enableVertexAttribArray(",u,");}");var n,o=i.type;if(n=i.size?e.def(i.size,"||",r):r,e("if(",s,".type!==",o,"||",s,".size!==",n,"||",d.map((function(t){return s+"."+t+"!=="+i[t]})).join("||"),"){",a,".bindBuffer(",Sn,",",f,".buffer);",a,".vertexAttribPointer(",[u,n,o,i.normalized,i.stride,i.offset],");",s,".type=",o,";",s,".size=",n,";",d.map((function(t){return s+"."+t+"="+i[t]+";"})).join(""),"}"),m){var c=i.divisor;e("if(",s,".divisor!==",c,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,c],");",s,".divisor=",c,";}")}}function p(){e("if(",s,".buffer){",a,".disableVertexAttribArray(",u,");",s,".buffer=null;","}if(",De.map((function(t,e){return s+"."+t+"!=="+l[e]})).join("||"),"){",a,".vertexAttrib4f(",u,",",l,");",De.map((function(t,e){return s+"."+t+"="+l[e]+";"})).join(""),"}")}1===c?h():2===c?p():(e("if(",c,"===",1,"){"),h(),e("}else{"),p(),e("}"))}(t.link(r),function(t){switch(t){case Tn:case Cn:case Rn:return 2;case In:case kn:case Pn:return 3;case Nn:case Dn:case Gn:return 4;default:return 1}}(r.info.type),a)}))}function V(t,e,r,i,o){for(var a,u=t.shared,s=u.gl,c=0;c<i.length;++c){var f,l=i[c],d=l.name,h=l.info.type,p=r.uniforms[d],v=t.link(l)+".location";if(p){if(!o(p))continue;if(er(p)){var g=p.value;if(E.command(null!=g,'missing uniform "'+d+'"',t.commandStr),h===Un||h===Bn){E.command("function"==typeof g&&(h===Un&&("texture2d"===g._reglType||"framebuffer"===g._reglType)||h===Bn&&("textureCube"===g._reglType||"framebufferCube"===g._reglType)),"invalid texture for uniform "+d,t.commandStr);var y=t.link(g._texture||g.color[0]._texture);e(s,".uniform1i(",v,",",y+".bind());"),e.exit(y,".unbind();")}else if(h===Ln||h===jn||h===Fn){E.optional((function(){E.command(ht(g),"invalid matrix for uniform "+d,t.commandStr),E.command(h===Ln&&4===g.length||h===jn&&9===g.length||h===Fn&&16===g.length,"invalid length for matrix uniform "+d,t.commandStr)}));var m=t.global.def("new Float32Array(["+Array.prototype.slice.call(g)+"])"),b=2;h===jn?b=3:h===Fn&&(b=4),e(s,".uniformMatrix",b,"fv(",v,",false,",m,");")}else{switch(h){case An:E.commandType(g,"number","uniform "+d,t.commandStr),a="1f";break;case Tn:E.command(ht(g)&&2===g.length,"uniform "+d,t.commandStr),a="2f";break;case In:E.command(ht(g)&&3===g.length,"uniform "+d,t.commandStr),a="3f";break;case Nn:E.command(ht(g)&&4===g.length,"uniform "+d,t.commandStr),a="4f";break;case Mn:E.commandType(g,"boolean","uniform "+d,t.commandStr),a="1i";break;case On:E.commandType(g,"number","uniform "+d,t.commandStr),a="1i";break;case Rn:case Cn:E.command(ht(g)&&2===g.length,"uniform "+d,t.commandStr),a="2i";break;case Pn:case kn:E.command(ht(g)&&3===g.length,"uniform "+d,t.commandStr),a="3i";break;case Gn:case Dn:E.command(ht(g)&&4===g.length,"uniform "+d,t.commandStr),a="4i"}e(s,".uniform",a,"(",v,",",ht(g)?Array.prototype.slice.call(g):g,");")}continue}f=p.append(t,e)}else{if(!o(ir))continue;f=e.def(u.uniforms,"[",n.id(d),"]")}h===Un?(E(!Array.isArray(f),"must specify a scalar prop for textures"),e("if(",f,"&&",f,'._reglType==="framebuffer"){',f,"=",f,".color[0];","}")):h===Bn&&(E(!Array.isArray(f),"must specify a scalar prop for cube maps"),e("if(",f,"&&",f,'._reglType==="framebufferCube"){',f,"=",f,".color[0];","}")),E.optional((function(){function n(n,r){t.assert(e,n,'bad data or missing for uniform "'+d+'". '+r)}function r(t){E(!Array.isArray(f),"must not specify an array type for uniform"),n("typeof "+f+'==="'+t+'"',"invalid type, expected "+t)}function i(e,r){Array.isArray(f)?E(f.length===e,"must have length "+e):n(u.isArrayLike+"("+f+")&&"+f+".length==="+e,"invalid vector, should have length "+e,t.commandStr)}function o(e){E(!Array.isArray(f),"must not specify a value type"),n("typeof "+f+'==="function"&&'+f+'._reglType==="texture'+(3553===e?"2d":"Cube")+'"',"invalid texture type",t.commandStr)}switch(h){case On:r("number");break;case Cn:i(2);break;case kn:i(3);break;case Dn:i(4);break;case An:r("number");break;case Tn:i(2);break;case In:i(3);break;case Nn:i(4);break;case Mn:r("boolean");break;case Rn:i(2);break;case Pn:i(3);break;case Gn:case Ln:i(4);break;case jn:i(9);break;case Fn:i(16);break;case Un:o(3553);break;case Bn:o(34067)}}));var _=1;switch(h){case Un:case Bn:var x=e.def(f,"._texture");e(s,".uniform1i(",v,",",x,".bind());"),e.exit(x,".unbind();");continue;case On:case Mn:a="1i";break;case Cn:case Rn:a="2i",_=2;break;case kn:case Pn:a="3i",_=3;break;case Dn:case Gn:a="4i",_=4;break;case An:a="1f";break;case Tn:a="2f",_=2;break;case In:a="3f",_=3;break;case Nn:a="4f",_=4;break;case Ln:a="Matrix2fv";break;case jn:a="Matrix3fv";break;case Fn:a="Matrix4fv"}if(e(s,".uniform",a,"(",v,","),"M"===a.charAt(0)){var w=Math.pow(h-Ln+2,2),S=t.global.def("new Float32Array(",w,")");Array.isArray(f)?e("false,(",P(w,(function(t){return S+"["+t+"]="+f[t]})),",",S,")"):e("false,(Array.isArray(",f,")||",f," instanceof Float32Array)?",f,":(",P(w,(function(t){return S+"["+t+"]="+f+"["+t+"]"})),",",S,")")}else _>1?e(P(_,(function(t){return Array.isArray(f)?f[t]:f+"["+t+"]"}))):(E(!Array.isArray(f),"uniform value must not be an array"),e(f));e(");")}}function W(t,e,n,r){var i=t.shared,o=i.gl,a=i.draw,u=r.draw;var s=function(){var i,s=u.elements,c=e;return s?((s.contextDep&&r.contextDynamic||s.propDep)&&(c=n),i=s.append(t,c)):i=c.def(a,".",ln),i&&c("if("+i+")"+o+".bindBuffer(34963,"+i+".buffer.buffer);"),i}();function c(i){var o=u[i];return o?o.contextDep&&r.contextDynamic||o.propDep?o.append(t,n):o.append(t,e):e.def(a,".",i)}var f,l,d=c(dn),h=c(pn),p=function(){var i,o=u.count,s=e;return o?((o.contextDep&&r.contextDynamic||o.propDep)&&(s=n),i=o.append(t,s),E.optional((function(){o.MISSING&&t.assert(e,"false","missing vertex count"),o.DYNAMIC&&t.assert(s,i+">=0","missing vertex count")}))):(i=s.def(a,".",hn),E.optional((function(){t.assert(s,i+">=0","missing vertex count")}))),i}();if("number"==typeof p){if(0===p)return}else n("if(",p,"){"),n.exit("}");m&&(f=c(vn),l=t.instancing);var v=s+".type",g=u.elements&&er(u.elements);function y(){function t(){n(l,".drawElementsInstancedANGLE(",[d,p,v,h+"<<(("+v+"-5121)>>1)",f],");")}function e(){n(l,".drawArraysInstancedANGLE(",[d,h,p,f],");")}s?g?t():(n("if(",s,"){"),t(),n("}else{"),e(),n("}")):e()}function b(){function t(){n(o+".drawElements("+[d,p,v,h+"<<(("+v+"-5121)>>1)"]+");")}function e(){n(o+".drawArrays("+[d,h,p]+");")}s?g?t():(n("if(",s,"){"),t(),n("}else{"),e(),n("}")):e()}m&&("number"!=typeof f||f>=0)?"string"==typeof f?(n("if(",f,">0){"),y(),n("}else if(",f,"<0){"),b(),n("}")):y():b()}function H(t,e,n,r,i){var o=M(),a=o.proc("body",i);return E.optional((function(){o.commandStr=e.commandStr,o.command=o.link(e.commandStr)})),m&&(o.instancing=a.def(o.shared.extensions,".angle_instanced_arrays")),t(o,a,n,r),o.compile().body}function X(t,e,n,r){U(t,e),n.useVAO?n.drawVAO?e(t.shared.vao,".setVAO(",n.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),z(t,e,n,r.attributes,(function(){return!0}))),V(t,e,n,r.uniforms,(function(){return!0})),W(t,e,e,n)}function q(t,e,n,r){function i(){return!0}t.batchId="a1",U(t,e),z(t,e,n,r.attributes,i),V(t,e,n,r.uniforms,i),W(t,e,e,n)}function Y(t,e,n,r){U(t,e);var i=n.contextDep,o=e.def(),a=e.def();t.shared.props=a,t.batchId=o;var u=t.scope(),s=t.scope();function c(t){return t.contextDep&&i||t.propDep}function f(t){return!c(t)}if(e(u.entry,"for(",o,"=0;",o,"<","a1",";++",o,"){",a,"=","a0","[",o,"];",s,"}",u.exit),n.needsContext&&G(t,s,n.context),n.needsFramebuffer&&L(t,s,n.framebuffer),F(t,s,n.state,c),n.profile&&c(n.profile)&&B(t,s,n,!1,!0),r)n.useVAO?n.drawVAO?c(n.drawVAO)?s(t.shared.vao,".setVAO(",n.drawVAO.append(t,s),");"):u(t.shared.vao,".setVAO(",n.drawVAO.append(t,u),");"):u(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(u(t.shared.vao,".setVAO(null);"),z(t,u,n,r.attributes,f),z(t,s,n,r.attributes,c)),V(t,u,n,r.uniforms,f),V(t,s,n,r.uniforms,c),W(t,u,s,n);else{var l=t.global.def("{}"),d=n.shader.progVar.append(t,s),h=s.def(d,".id"),p=s.def(l,"[",h,"]");s(t.shared.gl,".useProgram(",d,".program);","if(!",p,"){",p,"=",l,"[",h,"]=",t.link((function(e){return H(q,t,n,e,2)})),"(",d,");}",p,".call(this,a0[",o,"],",o,");")}}function Z(t,e,n){var r=e.static[n];if(r&&function(t){if("object"==typeof t&&!ht(t)){for(var e=Object.keys(t),n=0;n<e.length;++n)if(O.isDynamic(t[e[n]]))return!0;return!1}}(r)){var i=t.global,o=Object.keys(r),a=!1,u=!1,s=!1,c=t.global.def("{}");o.forEach((function(e){var n=r[e];if(O.isDynamic(n)){"function"==typeof n&&(n=r[e]=O.unbox(n));var o=rr(n,null);a=a||o.thisDep,s=s||o.propDep,u=u||o.contextDep}else{switch(i(c,".",e,"="),typeof n){case"number":i(n);break;case"string":i('"',n,'"');break;case"object":Array.isArray(n)&&i("[",n.join(),"]");break;default:i(t.link(n))}i(";")}})),e.dynamic[n]=new O.DynamicVariable(4,{thisDep:a,contextDep:u,propDep:s,ref:c,append:function(t,e){o.forEach((function(n){var i=r[n];if(O.isDynamic(i)){var o=t.invoke(e,i);e(c,".",n,"=",o,";")}}))}}),delete e.static[n]}}return{next:x,current:_,procs:function(){var t=M(),e=t.proc("poll"),n=t.proc("refresh"),o=t.block();e(o),n(o);var a,u=t.shared,s=u.gl,c=u.next,f=u.current;o(f,".dirty=false;"),L(t,e),L(t,n,null,!0),m&&(a=t.link(m)),r.oes_vertex_array_object&&n(t.link(r.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var l=0;l<i.maxAttributes;++l){var d=n.def(u.attributes,"[",l,"]"),h=t.cond(d,".buffer");h.then(s,".enableVertexAttribArray(",l,");",s,".bindBuffer(",Sn,",",d,".buffer.buffer);",s,".vertexAttribPointer(",l,",",d,".size,",d,".type,",d,".normalized,",d,".stride,",d,".offset);").else(s,".disableVertexAttribArray(",l,");",s,".vertexAttrib4f(",l,",",d,".x,",d,".y,",d,".z,",d,".w);",d,".buffer=null;"),n(h),m&&n(a,".vertexAttribDivisorANGLE(",l,",",d,".divisor);")}return n(t.shared.vao,".currentVAO=null;",t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"),Object.keys(S).forEach((function(r){var i=S[r],a=o.def(c,".",r),u=t.block();u("if(",a,"){",s,".enable(",i,")}else{",s,".disable(",i,")}",f,".",r,"=",a,";"),n(u),e("if(",a,"!==",f,".",r,"){",u,"}")})),Object.keys(A).forEach((function(r){var i,a,u=A[r],l=_[r],d=t.block();if(d(s,".",u,"("),ht(l)){var h=l.length;i=t.global.def(c,".",r),a=t.global.def(f,".",r),d(P(h,(function(t){return i+"["+t+"]"})),");",P(h,(function(t){return a+"["+t+"]="+i+"["+t+"];"})).join("")),e("if(",P(h,(function(t){return i+"["+t+"]!=="+a+"["+t+"]"})).join("||"),"){",d,"}")}else i=o.def(c,".",r),a=o.def(f,".",r),d(i,");",f,".",r,"=",i,";"),e("if(",i,"!==",a,"){",d,"}");n(d)})),t.compile()}(),compile:function(t,r,i,o,a){var u=M();u.stats=u.link(a),Object.keys(r.static).forEach((function(t){Z(u,r,t)})),En.forEach((function(e){Z(u,t,e)}));var s=R(t,r,i,o,u);return function(t,e){var n=t.proc("draw",1);U(t,n),G(t,n,e.context),L(t,n,e.framebuffer),j(t,n,e),F(t,n,e.state),B(t,n,e,!1,!0);var r=e.shader.progVar.append(t,n);if(n(t.shared.gl,".useProgram(",r,".program);"),e.shader.program)X(t,n,e,e.shader.program);else{n(t.shared.vao,".setVAO(null);");var i=t.global.def("{}"),o=n.def(r,".id"),a=n.def(i,"[",o,"]");n(t.cond(a).then(a,".call(this,a0);").else(a,"=",i,"[",o,"]=",t.link((function(n){return H(X,t,e,n,1)})),"(",r,");",a,".call(this,a0);"))}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(u,s),function(t,e){var r=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;function a(n){var o=e.shader[n];o&&r.set(i.shader,"."+n,o.append(t,r))}G(t,r,e.context),e.framebuffer&&e.framebuffer.append(t,r),Qn(Object.keys(e.state)).forEach((function(n){var o=e.state[n].append(t,r);ht(o)?o.forEach((function(e,i){r.set(t.next[n],"["+i+"]",e)})):r.set(i.next,"."+n,o)})),B(t,r,e,!0,!0),[ln,pn,hn,vn,dn].forEach((function(n){var o=e.draw[n];o&&r.set(i.draw,"."+n,""+o.append(t,r))})),Object.keys(e.uniforms).forEach((function(o){var a=e.uniforms[o].append(t,r);Array.isArray(a)&&(a="["+a.join()+"]"),r.set(i.uniforms,"["+n.id(o)+"]",a)})),Object.keys(e.attributes).forEach((function(n){var i=e.attributes[n].append(t,r),o=t.scopeAttrib(n);Object.keys(new g).forEach((function(t){r.set(o,"."+t,i[t])}))})),e.scopeVAO&&r.set(i.vao,".targetVAO",e.scopeVAO.append(t,r)),a(cn),a(fn),Object.keys(e.state).length>0&&(r(o,".dirty=true;"),r.exit(o,".dirty=true;")),r("a1(",t.shared.context,",a0,",t.batchId,");")}(u,s),function(t,e){var n=t.proc("batch",2);t.batchId="0",U(t,n);var r=!1,i=!0;Object.keys(e.context).forEach((function(t){r=r||e.context[t].propDep})),r||(G(t,n,e.context),i=!1);var o=e.framebuffer,a=!1;function u(t){return t.contextDep&&r||t.propDep}o?(o.propDep?r=a=!0:o.contextDep&&r&&(a=!0),a||L(t,n,o)):L(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(r=!0),j(t,n,e),F(t,n,e.state,(function(t){return!u(t)})),e.profile&&u(e.profile)||B(t,n,e,!1,"a1"),e.contextDep=r,e.needsContext=i,e.needsFramebuffer=a;var s=e.shader.progVar;if(s.contextDep&&r||s.propDep)Y(t,n,e,null);else{var c=s.append(t,n);if(n(t.shared.gl,".useProgram(",c,".program);"),e.shader.program)Y(t,n,e,e.shader.program);else{n(t.shared.vao,".setVAO(null);");var f=t.global.def("{}"),l=n.def(c,".id"),d=n.def(f,"[",l,"]");n(t.cond(d).then(d,".call(this,a0,a1);").else(d,"=",f,"[",l,"]=",t.link((function(n){return H(Y,t,e,n,2)})),"(",c,");",d,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(u,s),e(u.compile(),{destroy:function(){s.shader.program.destroy()}})}}}var ar=function(t,e){if(!e.ext_disjoint_timer_query)return null;var n=[];function r(t){n.push(t)}var i=[];function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var a=[];function u(t){a.push(t)}var s=[];function c(t,e,n){var r=a.pop()||new o;r.startQueryIndex=t,r.endQueryIndex=e,r.sum=0,r.stats=n,s.push(r)}var f=[],l=[];return{beginQuery:function(t){var r=n.pop()||e.ext_disjoint_timer_query.createQueryEXT();e.ext_disjoint_timer_query.beginQueryEXT(35007,r),i.push(r),c(i.length-1,i.length,t)},endQuery:function(){e.ext_disjoint_timer_query.endQueryEXT(35007)},pushScopeStats:c,update:function(){var t,n,o=i.length;if(0!==o){l.length=Math.max(l.length,o+1),f.length=Math.max(f.length,o+1),f[0]=0,l[0]=0;var a=0;for(t=0,n=0;n<i.length;++n){var c=i[n];e.ext_disjoint_timer_query.getQueryObjectEXT(c,34919)?(a+=e.ext_disjoint_timer_query.getQueryObjectEXT(c,34918),r(c)):i[t++]=c,f[n+1]=a,l[n+1]=t}for(i.length=t,t=0,n=0;n<s.length;++n){var d=s[n],h=d.startQueryIndex,p=d.endQueryIndex;d.sum+=f[p]-f[h];var v=l[h],g=l[p];g===v?(d.stats.gpuTime+=d.sum/1e6,u(d)):(d.startQueryIndex=v,d.endQueryIndex=g,s[t++]=d)}s.length=t}},getNumPendingQueries:function(){return i.length},clear:function(){n.push.apply(n,i);for(var t=0;t<n.length;t++)e.ext_disjoint_timer_query.deleteQueryEXT(n[t]);i.length=0,n.length=0},restore:function(){i.length=0,n.length=0}}},ur="webglcontextlost",sr="webglcontextrestored";function cr(t,e){for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}return function(n){var r=R(n);if(!r)return null;var i=r.gl,o=i.getContextAttributes(),a=i.isContextLost(),u=function(t,e){var n={};function r(e){E.type(e,"string","extension name must be string");var r,i=e.toLowerCase();try{r=n[i]=t.getExtension(i)}catch(t){}return!!r}for(var i=0;i<e.extensions.length;++i){var o=e.extensions[i];if(!r(o))return e.onDestroy(),e.onDone('"'+o+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return e.optionalExtensions.forEach(r),{extensions:n,restore:function(){Object.keys(n).forEach((function(t){if(n[t]&&!r(t))throw new Error("(regl): error restoring extension "+t)}))}}}(i,r);if(!u)return null;var s,c,f=(s={"":0},c=[""],{id:function(t){var e=s[t];return e||(e=s[t]=c.length,c.push(t),e)},str:function(t){return c[t]}}),l={vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},d=u.extensions,h=ar(0,d),p=k(),v=i.drawingBufferWidth,g=i.drawingBufferHeight,y={tick:0,time:0,viewportWidth:v,viewportHeight:g,framebufferWidth:v,framebufferHeight:g,drawingBufferWidth:v,drawingBufferHeight:g,pixelRatio:r.pixelRatio},m=function(t,e){var n=1;e.ext_texture_filter_anisotropic&&(n=t.getParameter(34047));var r=1,i=1;e.webgl_draw_buffers&&(r=t.getParameter(34852),i=t.getParameter(36063));var o=!!e.oes_texture_float;if(o){var a=t.createTexture();t.bindTexture(F,a),t.texImage2D(F,0,U,1,1,0,U,B,null);var u=t.createFramebuffer();if(t.bindFramebuffer(z,u),t.framebufferTexture2D(z,36064,F,a,0),t.bindTexture(F,null),36053!==t.checkFramebufferStatus(z))o=!1;else{t.viewport(0,0,1,1),t.clearColor(1,0,0,1),t.clear(16384);var s=j.allocType(B,4);t.readPixels(0,0,1,1,U,B,s),t.getError()?o=!1:(t.deleteFramebuffer(u),t.deleteTexture(a),o=1===s[0]),j.freeType(s)}}var c=!0;if("undefined"==typeof navigator||!(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent))){var f=t.createTexture(),l=j.allocType(5121,36);t.activeTexture(33984),t.bindTexture(34067,f),t.texImage2D(34069,0,U,3,3,0,U,5121,l),j.freeType(l),t.bindTexture(34067,null),t.deleteTexture(f),c=!t.getError()}return{colorBits:[t.getParameter(3410),t.getParameter(3411),t.getParameter(3412),t.getParameter(3413)],depthBits:t.getParameter(3414),stencilBits:t.getParameter(3415),subpixelBits:t.getParameter(3408),extensions:Object.keys(e).filter((function(t){return!!e[t]})),maxAnisotropic:n,maxDrawbuffers:r,maxColorAttachments:i,pointSizeDims:t.getParameter(33901),lineWidthDims:t.getParameter(33902),maxViewportDims:t.getParameter(3386),maxCombinedTextureUnits:t.getParameter(35661),maxCubeMapSize:t.getParameter(34076),maxRenderbufferSize:t.getParameter(34024),maxTextureUnits:t.getParameter(34930),maxTextureSize:t.getParameter(3379),maxAttributes:t.getParameter(34921),maxVertexUniforms:t.getParameter(36347),maxVertexTextureUnits:t.getParameter(35660),maxVaryingVectors:t.getParameter(36348),maxFragmentUniforms:t.getParameter(36349),glsl:t.getParameter(35724),renderer:t.getParameter(7937),vendor:t.getParameter(7936),version:t.getParameter(7938),readFloat:o,npotTextureCube:c}}(i,d),b=function(e,n,r,i){var o=0,a={};function u(t){this.id=o++,this.buffer=e.createBuffer(),this.type=t,this.usage=35044,this.byteLength=0,this.dimension=1,this.dtype=Q,this.persistentData=null,r.profile&&(this.stats={size:0})}u.prototype.bind=function(){e.bindBuffer(this.type,this.buffer)},u.prototype.destroy=function(){l(this)};var s=[];function c(t,n,r){t.byteLength=n.byteLength,e.bufferData(t.type,n,r)}function f(e,n,r,i,o,a){var u,s;if(e.usage=r,Array.isArray(n)){if(e.dtype=i||tt,n.length>0)if(Array.isArray(n[0])){u=J(n);for(var f=1,l=1;l<u.length;++l)f*=u[l];e.dimension=f,c(e,s=$(n,u,e.dtype),r),a?e.persistentData=s:j.freeType(s)}else if("number"==typeof n[0]){e.dimension=o;var d=j.allocType(e.dtype,n.length);rt(d,n),c(e,d,r),a?e.persistentData=d:j.freeType(d)}else t(n[0])?(e.dimension=n[0].length,e.dtype=i||nt(n[0])||tt,c(e,s=$(n,[n.length,n[0].length],e.dtype),r),a?e.persistentData=s:j.freeType(s)):E.raise("invalid buffer data")}else if(t(n))e.dtype=i||nt(n),e.dimension=o,c(e,n,r),a&&(e.persistentData=new Uint8Array(new Uint8Array(n.buffer)));else if(V(n)){u=n.shape;var h=n.stride,p=n.offset,v=0,g=0,y=0,m=0;1===u.length?(v=u[0],g=1,y=h[0],m=0):2===u.length?(v=u[0],g=u[1],y=h[0],m=h[1]):E.raise("invalid shape"),e.dtype=i||nt(n.data)||tt,e.dimension=g;var b=j.allocType(e.dtype,v*g);it(b,n.data,v,g,y,m,p),c(e,b,r),a?e.persistentData=b:j.freeType(b)}else n instanceof ArrayBuffer?(e.dtype=Q,e.dimension=o,c(e,n,r),a&&(e.persistentData=new Uint8Array(new Uint8Array(n)))):E.raise("invalid buffer data")}function l(t){n.bufferCount--,i(t);var r=t.buffer;E(r,"buffer must not be deleted already"),e.deleteBuffer(r),t.buffer=null,delete a[t.id]}return r.profile&&(n.getTotalBufferSize=function(){var t=0;return Object.keys(a).forEach((function(e){t+=a[e].stats.size})),t}),{create:function(i,o,s,c){n.bufferCount++;var d=new u(o);function h(n){var i=35044,o=null,a=0,u=0,s=1;return Array.isArray(n)||t(n)||V(n)||n instanceof ArrayBuffer?o=n:"number"==typeof n?a=0|n:n&&(E.type(n,"object","buffer arguments must be an object, a number or an array"),"data"in n&&(E(null===o||Array.isArray(o)||t(o)||V(o),"invalid data for buffer"),o=n.data),"usage"in n&&(E.parameter(n.usage,Z,"invalid buffer usage"),i=Z[n.usage]),"type"in n&&(E.parameter(n.type,K,"invalid buffer type"),u=K[n.type]),"dimension"in n&&(E.type(n.dimension,"number","invalid dimension"),s=0|n.dimension),"length"in n&&(E.nni(a,"buffer length must be a nonnegative integer"),a=0|n.length)),d.bind(),o?f(d,o,i,u,s,c):(a&&e.bufferData(d.type,a,i),d.dtype=u||Q,d.usage=i,d.dimension=s,d.byteLength=a),r.profile&&(d.stats.size=d.byteLength*et[d.dtype]),h}function p(t,n){E(n+t.byteLength<=d.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+t.byteLength+" starting from offset "+n+" to a buffer of size "+d.byteLength),e.bufferSubData(d.type,n,t)}return a[d.id]=d,s||h(i),h._reglType="buffer",h._buffer=d,h.subdata=function(e,n){var r,i=0|(n||0);if(d.bind(),t(e)||e instanceof ArrayBuffer)p(e,i);else if(Array.isArray(e)){if(e.length>0)if("number"==typeof e[0]){var o=j.allocType(d.dtype,e.length);rt(o,e),p(o,i),j.freeType(o)}else if(Array.isArray(e[0])||t(e[0])){r=J(e);var a=$(e,r,d.dtype);p(a,i),j.freeType(a)}else E.raise("invalid buffer data")}else if(V(e)){r=e.shape;var u=e.stride,s=0,c=0,f=0,l=0;1===r.length?(s=r[0],c=1,f=u[0],l=0):2===r.length?(s=r[0],c=r[1],f=u[0],l=u[1]):E.raise("invalid shape");var v=Array.isArray(e.data)?d.dtype:nt(e.data),g=j.allocType(v,s*c);it(g,e.data,s,c,f,l,e.offset),p(g,i),j.freeType(g)}else E.raise("invalid data for buffer subdata");return h},r.profile&&(h.stats=d.stats),h.destroy=function(){l(d)},h},createStream:function(t,e){var n=s.pop();return n||(n=new u(t)),n.bind(),f(n,e,35040,0,1,!1),n},destroyStream:function(t){s.push(t)},clear:function(){W(a).forEach(l),s.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof u?t._buffer:null},restore:function(){W(a).forEach((function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)}))},_initBuffer:f}}(i,l,r,(function(t){return _.destroyBuffer(t)})),_=function(e,n,r,i,o){for(var a=r.maxAttributes,u=new Array(a),s=0;s<a;++s)u[s]=new Te;var c=0,f={},l={Record:Te,scope:{},state:u,currentVAO:null,targetVAO:null,restore:d()?function(){d()&&W(f).forEach((function(t){t.refresh()}))}:function(){},createVAO:function(e){var r=new p;function u(e){E(Array.isArray(e),"arguments to vertex array constructor must be an array"),E(e.length<a,"too many attributes"),E(e.length>0,"must specify at least one attribute");var i={},s=r.attributes;s.length=e.length;for(var c=0;c<e.length;++c){var f,l=e[c],d=s[c]=new Te,h=l.data||l;Array.isArray(h)||t(h)||V(h)?(r.buffers[c]&&(f=r.buffers[c],t(h)&&f._buffer.byteLength>=h.byteLength?f.subdata(h):(f.destroy(),r.buffers[c]=null)),r.buffers[c]||(f=r.buffers[c]=o.create(l,34962,!1,!0)),d.buffer=o.getBuffer(f),d.size=0|d.buffer.dimension,d.normalized=!1,d.type=d.buffer.dtype,d.offset=0,d.stride=0,d.divisor=0,d.state=1,i[c]=1):o.getBuffer(l)?(d.buffer=o.getBuffer(l),d.size=0|d.buffer.dimension,d.normalized=!1,d.type=d.buffer.dtype,d.offset=0,d.stride=0,d.divisor=0,d.state=1):o.getBuffer(l.buffer)?(d.buffer=o.getBuffer(l.buffer),d.size=0|(+l.size||d.buffer.dimension),d.normalized=!!l.normalized||!1,"type"in l?(E.parameter(l.type,K,"invalid buffer type"),d.type=K[l.type]):d.type=d.buffer.dtype,d.offset=0|(l.offset||0),d.stride=0|(l.stride||0),d.divisor=0|(l.divisor||0),d.state=1,E(d.size>=1&&d.size<=4,"size must be between 1 and 4"),E(d.offset>=0,"invalid offset"),E(d.stride>=0&&d.stride<=255,"stride must be between 0 and 255"),E(d.divisor>=0,"divisor must be positive"),E(!d.divisor||!!n.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in l?(E(c>0,"first attribute must not be a constant"),d.x=+l.x||0,d.y=+l.y||0,d.z=+l.z||0,d.w=+l.w||0,d.state=2):E(!1,"invalid attribute spec for location "+c)}for(var p=0;p<r.buffers.length;++p)!i[p]&&r.buffers[p]&&(r.buffers[p].destroy(),r.buffers[p]=null);return r.refresh(),u}return i.vaoCount+=1,u.destroy=function(){for(var t=0;t<r.buffers.length;++t)r.buffers[t]&&r.buffers[t].destroy();r.buffers.length=0,r.destroy()},u._vao=r,u._reglType="vao",u(e)},getVAO:function(t){return"function"==typeof t&&t._vao?t._vao:null},destroyBuffer:function(t){for(var n=0;n<u.length;++n){var r=u[n];r.buffer===t&&(e.disableVertexAttribArray(n),r.buffer=null)}},setVAO:d()?function(t){if(t!==l.currentVAO){var e=d();t?e.bindVertexArrayOES(t.vao):e.bindVertexArrayOES(null),l.currentVAO=t}}:function(t){if(t!==l.currentVAO){if(t)t.bindAttrs();else for(var n=h(),r=0;r<u.length;++r){var i=u[r];i.buffer?(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offfset),n&&i.divisor&&n.vertexAttribDivisorANGLE(r,i.divisor)):(e.disableVertexAttribArray(r),e.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}l.currentVAO=t}},clear:d()?function(){W(f).forEach((function(t){t.destroy()}))}:function(){}};function d(){return n.oes_vertex_array_object}function h(){return n.angle_instanced_arrays}function p(){this.id=++c,this.attributes=[];var t=d();this.vao=t?t.createVertexArrayOES():null,f[this.id]=this,this.buffers=[]}return p.prototype.bindAttrs=function(){for(var t=h(),n=this.attributes,r=0;r<n.length;++r){var i=n[r];i.buffer?(e.enableVertexAttribArray(r),e.bindBuffer(34962,i.buffer.buffer),e.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offset),t&&i.divisor&&t.vertexAttribDivisorANGLE(r,i.divisor)):(e.disableVertexAttribArray(r),e.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}for(var o=n.length;o<a;++o)e.disableVertexAttribArray(o)},p.prototype.refresh=function(){var t=d();t&&(t.bindVertexArrayOES(this.vao),this.bindAttrs(),l.currentVAO=this)},p.prototype.destroy=function(){if(this.vao){var t=d();this===l.currentVAO&&(l.currentVAO=null,t.bindVertexArrayOES(null)),t.deleteVertexArrayOES(this.vao),this.vao=null}f[this.id]&&(delete f[this.id],i.vaoCount-=1)},l}(i,d,m,l,b),x=function(e,n,r,i){var o={},a=0,u={uint8:at,uint16:ut};function s(t){this.id=a++,o[this.id]=this,this.buffer=t,this.primType=4,this.vertCount=0,this.type=0}n.oes_element_index_uint&&(u.uint32=st),s.prototype.bind=function(){this.buffer.bind()};var c=[];function f(i,o,a,u,s,c,f){var l;if(i.buffer.bind(),o){var d=f;f||t(o)&&(!V(o)||t(o.data))||(d=n.oes_element_index_uint?st:ut),r._initBuffer(i.buffer,o,a,d,3)}else e.bufferData(ct,c,a),i.buffer.dtype=l||at,i.buffer.usage=a,i.buffer.dimension=3,i.buffer.byteLength=c;if(l=f,!f){switch(i.buffer.dtype){case at:case 5120:l=at;break;case ut:case 5122:l=ut;break;case st:case 5124:l=st;break;default:E.raise("unsupported type for element array")}i.buffer.dtype=l}i.type=l,E(l!==st||!!n.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var h=s;h<0&&(h=i.buffer.byteLength,l===ut?h>>=1:l===st&&(h>>=2)),i.vertCount=h;var p=u;if(u<0){p=4;var v=i.buffer.dimension;1===v&&(p=0),2===v&&(p=1),3===v&&(p=4)}i.primType=p}function l(t){i.elementsCount--,E(null!==t.buffer,"must not double destroy elements"),delete o[t.id],t.buffer.destroy(),t.buffer=null}return{create:function(e,n){var o=r.create(null,ct,!0),a=new s(o._buffer);function c(e){if(e)if("number"==typeof e)o(e),a.primType=4,a.vertCount=0|e,a.type=at;else{var n=null,r=35044,i=-1,s=-1,l=0,d=0;Array.isArray(e)||t(e)||V(e)?n=e:(E.type(e,"object","invalid arguments for elements"),"data"in e&&(n=e.data,E(Array.isArray(n)||t(n)||V(n),"invalid data for element buffer")),"usage"in e&&(E.parameter(e.usage,Z,"invalid element buffer usage"),r=Z[e.usage]),"primitive"in e&&(E.parameter(e.primitive,ot,"invalid element buffer primitive"),i=ot[e.primitive]),"count"in e&&(E("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),s=0|e.count),"type"in e&&(E.parameter(e.type,u,"invalid buffer type"),d=u[e.type]),"length"in e?l=0|e.length:(l=s,d===ut||5122===d?l*=2:d!==st&&5124!==d||(l*=4))),f(a,n,r,i,s,l,d)}else o(),a.primType=4,a.vertCount=0,a.type=at;return c}return i.elementsCount++,c(e),c._reglType="elements",c._elements=a,c.subdata=function(t,e){return o.subdata(t,e),c},c.destroy=function(){l(a)},c},createStream:function(t){var e=c.pop();return e||(e=new s(r.create(null,ct,!0,!1)._buffer)),f(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){c.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof s?t._elements:null},clear:function(){W(o).forEach(l)}}}(i,d,b,l),w=function(t,n,r,i){var o={},a={};function u(t,e,n,r){this.name=t,this.id=e,this.location=n,this.info=r}function s(t,e){for(var n=0;n<t.length;++n)if(t[n].id===e.id)return void(t[n].location=e.location);t.push(e)}function c(e,r,i){var u=35632===e?o:a,s=u[r];if(!s){var c=n.str(r);s=t.createShader(e),t.shaderSource(s,c),t.compileShader(s),E.shaderError(t,s,c,e,i),u[r]=s}return s}var f={},l=[],d=0;function h(t,e){this.id=d++,this.fragId=t,this.vertId=e,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,i.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function p(e,r,o){var a,f,l=c(35632,e.fragId),d=c(35633,e.vertId),h=e.program=t.createProgram();if(t.attachShader(h,l),t.attachShader(h,d),o)for(a=0;a<o.length;++a){var p=o[a];t.bindAttribLocation(h,p[0],p[1])}t.linkProgram(h),E.linkError(t,h,n.str(e.fragId),n.str(e.vertId),r);var v=t.getProgramParameter(h,35718);i.profile&&(e.stats.uniformsCount=v);var g=e.uniforms;for(a=0;a<v;++a)if(f=t.getActiveUniform(h,a))if(f.size>1)for(var y=0;y<f.size;++y){var m=f.name.replace("[0]","["+y+"]");s(g,new u(m,n.id(m),t.getUniformLocation(h,m),f))}else s(g,new u(f.name,n.id(f.name),t.getUniformLocation(h,f.name),f));var b=t.getProgramParameter(h,35721);i.profile&&(e.stats.attributesCount=b);var _=e.attributes;for(a=0;a<b;++a)(f=t.getActiveAttrib(h,a))&&s(_,new u(f.name,n.id(f.name),t.getAttribLocation(h,f.name),f))}return i.profile&&(r.getMaxUniformsCount=function(){var t=0;return l.forEach((function(e){e.stats.uniformsCount>t&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return l.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);W(o).forEach(e),o={},W(a).forEach(e),a={},l.forEach((function(e){t.deleteProgram(e.program)})),l.length=0,f={},r.shaderCount=0},program:function(n,i,u,s){E.command(n>=0,"missing vertex shader",u),E.command(i>=0,"missing fragment shader",u);var c=f[i];c||(c=f[i]={});var d=c[n];if(d&&(d.refCount++,!s))return d;var v=new h(i,n);return r.shaderCount++,p(v,u,s),d||(c[n]=v),l.push(v),e(v,{destroy:function(){if(v.refCount--,v.refCount<=0){t.deleteProgram(v.program);var e=l.indexOf(v);l.splice(e,1),r.shaderCount--}c[v.vertId].refCount<=0&&(t.deleteShader(a[v.vertId]),delete a[v.vertId],delete f[v.fragId][v.vertId]),Object.keys(f[v.fragId]).length||(t.deleteShader(o[v.fragId]),delete o[v.fragId],delete f[v.fragId])}})},restore:function(){o={},a={};for(var t=0;t<l.length;++t)p(l[t],null,l[t].attributes.map((function(t){return[t.location,t.name]})))},shader:c,frag:-1,vert:-1}}(i,f,l,r),S=de(i,d,m,(function(){I.procs.poll()}),y,l,r),A=function(t,e,n,r,i){var o={rgba4:pe,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(o.srgba=35907),e.ext_color_buffer_half_float&&(o.rgba16f=34842,o.rgb16f=34843),e.webgl_color_buffer_float&&(o.rgba32f=34836);var a=[];Object.keys(o).forEach((function(t){var e=o[t];a[e]=t}));var u=0,s={};function c(t){this.id=u++,this.refCount=1,this.renderbuffer=t,this.format=pe,this.width=0,this.height=0,i.profile&&(this.stats={size:0})}function f(e){var n=e.renderbuffer;E(n,"must not double destroy renderbuffer"),t.bindRenderbuffer(he,null),t.deleteRenderbuffer(n),e.renderbuffer=null,e.refCount=0,delete s[e.id],r.renderbufferCount--}return c.prototype.decRef=function(){--this.refCount<=0&&f(this)},i.profile&&(r.getTotalRenderbufferSize=function(){var t=0;return Object.keys(s).forEach((function(e){t+=s[e].stats.size})),t}),{create:function(e,u){var f=new c(t.createRenderbuffer());function l(e,r){var u=0,s=0,c=pe;if("object"==typeof e&&e){var d=e;if("shape"in d){var h=d.shape;E(Array.isArray(h)&&h.length>=2,"invalid renderbuffer shape"),u=0|h[0],s=0|h[1]}else"radius"in d&&(u=s=0|d.radius),"width"in d&&(u=0|d.width),"height"in d&&(s=0|d.height);"format"in d&&(E.parameter(d.format,o,"invalid renderbuffer format"),c=o[d.format])}else"number"==typeof e?(u=0|e,s="number"==typeof r?0|r:u):e?E.raise("invalid arguments to renderbuffer constructor"):u=s=1;if(E(u>0&&s>0&&u<=n.maxRenderbufferSize&&s<=n.maxRenderbufferSize,"invalid renderbuffer size"),u!==f.width||s!==f.height||c!==f.format)return l.width=f.width=u,l.height=f.height=s,f.format=c,t.bindRenderbuffer(he,f.renderbuffer),t.renderbufferStorage(he,c,u,s),E(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=ge(f.format,f.width,f.height)),l.format=a[f.format],l}return s[f.id]=f,r.renderbufferCount++,l(e,u),l.resize=function(e,r){var o=0|e,a=0|r||o;return o===f.width&&a===f.height||(E(o>0&&a>0&&o<=n.maxRenderbufferSize&&a<=n.maxRenderbufferSize,"invalid renderbuffer size"),l.width=f.width=o,l.height=f.height=a,t.bindRenderbuffer(he,f.renderbuffer),t.renderbufferStorage(he,f.format,o,a),E(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=ge(f.format,f.width,f.height))),l},l._reglType="renderbuffer",l._renderbuffer=f,i.profile&&(l.stats=f.stats),l.destroy=function(){f.decRef()},l},clear:function(){W(s).forEach(f)},restore:function(){W(s).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(he,e.renderbuffer),t.renderbufferStorage(he,e.format,e.width,e.height)})),t.bindRenderbuffer(he,null)}}}(i,d,m,l,r),T=function(t,n,r,i,o,a){var u={cur:null,next:null,dirty:!1,setFBO:null},s=["rgba"],c=["rgba4","rgb565","rgb5 a1"];n.ext_srgb&&c.push("srgba"),n.ext_color_buffer_half_float&&c.push("rgba16f","rgb16f"),n.webgl_color_buffer_float&&c.push("rgba32f");var f=["uint8"];function l(t,e,n){this.target=t,this.texture=e,this.renderbuffer=n;var r=0,i=0;e?(r=e.width,i=e.height):n&&(r=n.width,i=n.height),this.width=r,this.height=i}function d(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function h(t,e,n){if(t)if(t.texture){var r=t.texture._texture,i=Math.max(1,r.width),o=Math.max(1,r.height);E(i===e&&o===n,"inconsistent width/height for supplied texture"),r.refCount+=1}else{var a=t.renderbuffer._renderbuffer;E(a.width===e&&a.height===n,"inconsistent width/height for renderbuffer"),a.refCount+=1}}function p(e,n){n&&(n.texture?t.framebufferTexture2D(ye,e,n.target,n.texture._texture.texture,0):t.framebufferRenderbuffer(ye,e,me,n.renderbuffer._renderbuffer.renderbuffer))}function v(t){var e=be,n=null,r=null,i=t;"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),E.type(i,"function","invalid attachment data");var o=i._reglType;return"texture2d"===o?(n=i,E(e===be)):"textureCube"===o?(n=i,E(e>=_e&&e<34075,"invalid cube map target")):"renderbuffer"===o?(r=i,e=me):E.raise("invalid regl object for attachment"),new l(e,n,r)}function g(t,e,n,r,a){if(n){var u=i.create2D({width:t,height:e,format:r,type:a});return u._texture.refCount=0,new l(be,u,null)}var s=o.create({width:t,height:e,format:r});return s._renderbuffer.refCount=0,new l(me,null,s)}function y(t){return t&&(t.texture||t.renderbuffer)}function m(t,e,n){t&&(t.texture?t.texture.resize(e,n):t.renderbuffer&&t.renderbuffer.resize(e,n),t.width=e,t.height=n)}n.oes_texture_half_float&&f.push("half float","float16"),n.oes_texture_float&&f.push("float","float32");var b=0,_={};function x(){this.id=b++,_[this.id]=this,this.framebuffer=t.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function w(t){t.colorAttachments.forEach(d),d(t.depthAttachment),d(t.stencilAttachment),d(t.depthStencilAttachment)}function S(e){var n=e.framebuffer;E(n,"must not double destroy framebuffer"),t.deleteFramebuffer(n),e.framebuffer=null,a.framebufferCount--,delete _[e.id]}function A(e){var n;t.bindFramebuffer(ye,e.framebuffer);var i=e.colorAttachments;for(n=0;n<i.length;++n)p(36064+n,i[n]);for(n=i.length;n<r.maxColorAttachments;++n)t.framebufferTexture2D(ye,36064+n,be,null,0);t.framebufferTexture2D(ye,33306,be,null,0),t.framebufferTexture2D(ye,36096,be,null,0),t.framebufferTexture2D(ye,36128,be,null,0),p(36096,e.depthAttachment),p(36128,e.stencilAttachment),p(33306,e.depthStencilAttachment);var o=t.checkFramebufferStatus(ye);t.isContextLost()||36053===o||E.raise("framebuffer configuration not supported, status = "+Ae[o]),t.bindFramebuffer(ye,u.next?u.next.framebuffer:null),u.cur=u.next,t.getError()}function T(t,i){var o=new x;function l(t,e){var i;E(u.next!==o,"can not update framebuffer which is currently in use");var a=0,d=0,p=!0,m=!0,b=null,_=!0,x="rgba",S="uint8",T=1,I=null,N=null,O=null,C=!1;if("number"==typeof t)a=0|t,d=0|e||a;else if(t){E.type(t,"object","invalid arguments for framebuffer");var k=t;if("shape"in k){var D=k.shape;E(Array.isArray(D)&&D.length>=2,"invalid shape for framebuffer"),a=D[0],d=D[1]}else"radius"in k&&(a=d=k.radius),"width"in k&&(a=k.width),"height"in k&&(d=k.height);("color"in k||"colors"in k)&&(b=k.color||k.colors,Array.isArray(b)&&E(1===b.length||n.webgl_draw_buffers,"multiple render targets not supported")),b||("colorCount"in k&&(T=0|k.colorCount,E(T>0,"invalid color buffer count")),"colorTexture"in k&&(_=!!k.colorTexture,x="rgba4"),"colorType"in k&&(S=k.colorType,_?(E(n.oes_texture_float||!("float"===S||"float32"===S),"you must enable OES_texture_float in order to use floating point framebuffer objects"),E(n.oes_texture_half_float||!("half float"===S||"float16"===S),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===S||"float16"===S?(E(n.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==S&&"float32"!==S||(E(n.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),E.oneOf(S,f,"invalid color type")),"colorFormat"in k&&(x=k.colorFormat,s.indexOf(x)>=0?_=!0:c.indexOf(x)>=0?_=!1:_?E.oneOf(k.colorFormat,s,"invalid color format for texture"):E.oneOf(k.colorFormat,c,"invalid color format for renderbuffer"))),("depthTexture"in k||"depthStencilTexture"in k)&&(C=!(!k.depthTexture&&!k.depthStencilTexture),E(!C||n.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in k&&("boolean"==typeof k.depth?p=k.depth:(I=k.depth,m=!1)),"stencil"in k&&("boolean"==typeof k.stencil?m=k.stencil:(N=k.stencil,p=!1)),"depthStencil"in k&&("boolean"==typeof k.depthStencil?p=m=k.depthStencil:(O=k.depthStencil,p=!1,m=!1))}else a=d=1;var M=null,R=null,P=null,G=null;if(Array.isArray(b))M=b.map(v);else if(b)M=[v(b)];else for(M=new Array(T),i=0;i<T;++i)M[i]=g(a,d,_,x,S);E(n.webgl_draw_buffers||M.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),E(M.length<=r.maxColorAttachments,"too many color attachments, not supported"),a=a||M[0].width,d=d||M[0].height,I?R=v(I):p&&!m&&(R=g(a,d,C,"depth","uint32")),N?P=v(N):m&&!p&&(P=g(a,d,!1,"stencil","uint8")),O?G=v(O):!I&&!N&&m&&p&&(G=g(a,d,C,"depth stencil","depth stencil")),E(!!I+!!N+!!O<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var L=null;for(i=0;i<M.length;++i)if(h(M[i],a,d),E(!M[i]||M[i].texture&&xe.indexOf(M[i].texture._texture.format)>=0||M[i].renderbuffer&&Se.indexOf(M[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),M[i]&&M[i].texture){var j=we[M[i].texture._texture.format]*Ee[M[i].texture._texture.type];null===L?L=j:E(L===j,"all color attachments much have the same number of bits per pixel.")}return h(R,a,d),E(!R||R.texture&&6402===R.texture._texture.format||R.renderbuffer&&33189===R.renderbuffer._renderbuffer.format,"invalid depth attachment for framebuffer object"),h(P,a,d),E(!P||P.renderbuffer&&36168===P.renderbuffer._renderbuffer.format,"invalid stencil attachment for framebuffer object"),h(G,a,d),E(!G||G.texture&&34041===G.texture._texture.format||G.renderbuffer&&34041===G.renderbuffer._renderbuffer.format,"invalid depth-stencil attachment for framebuffer object"),w(o),o.width=a,o.height=d,o.colorAttachments=M,o.depthAttachment=R,o.stencilAttachment=P,o.depthStencilAttachment=G,l.color=M.map(y),l.depth=y(R),l.stencil=y(P),l.depthStencil=y(G),l.width=o.width,l.height=o.height,A(o),l}return a.framebufferCount++,l(t,i),e(l,{resize:function(t,e){E(u.next!==o,"can not resize a framebuffer which is currently in use");var n=Math.max(0|t,1),r=Math.max(0|e||n,1);if(n===o.width&&r===o.height)return l;for(var i=o.colorAttachments,a=0;a<i.length;++a)m(i[a],n,r);return m(o.depthAttachment,n,r),m(o.stencilAttachment,n,r),m(o.depthStencilAttachment,n,r),o.width=l.width=n,o.height=l.height=r,A(o),l},_reglType:"framebuffer",_framebuffer:o,destroy:function(){S(o),w(o)},use:function(t){u.setFBO({framebuffer:l},t)}})}return e(u,{getFramebuffer:function(t){if("function"==typeof t&&"framebuffer"===t._reglType){var e=t._framebuffer;if(e instanceof x)return e}return null},create:T,createCube:function(t){var o=Array(6);function a(t){var r;E(o.indexOf(u.next)<0,"can not update framebuffer which is currently in use");var c,l={color:null},d=0,h=null,p="rgba",v="uint8",g=1;if("number"==typeof t)d=0|t;else if(t){E.type(t,"object","invalid arguments for framebuffer");var y=t;if("shape"in y){var m=y.shape;E(Array.isArray(m)&&m.length>=2,"invalid shape for framebuffer"),E(m[0]===m[1],"cube framebuffer must be square"),d=m[0]}else"radius"in y&&(d=0|y.radius),"width"in y?(d=0|y.width,"height"in y&&E(y.height===d,"must be square")):"height"in y&&(d=0|y.height);("color"in y||"colors"in y)&&(h=y.color||y.colors,Array.isArray(h)&&E(1===h.length||n.webgl_draw_buffers,"multiple render targets not supported")),h||("colorCount"in y&&(g=0|y.colorCount,E(g>0,"invalid color buffer count")),"colorType"in y&&(E.oneOf(y.colorType,f,"invalid color type"),v=y.colorType),"colorFormat"in y&&(p=y.colorFormat,E.oneOf(y.colorFormat,s,"invalid color format for texture"))),"depth"in y&&(l.depth=y.depth),"stencil"in y&&(l.stencil=y.stencil),"depthStencil"in y&&(l.depthStencil=y.depthStencil)}else d=1;if(h)if(Array.isArray(h))for(c=[],r=0;r<h.length;++r)c[r]=h[r];else c=[h];else{c=Array(g);var b={radius:d,format:p,type:v};for(r=0;r<g;++r)c[r]=i.createCube(b)}for(l.color=Array(c.length),r=0;r<c.length;++r){var _=c[r];E("function"==typeof _&&"textureCube"===_._reglType,"invalid cube map"),d=d||_.width,E(_.width===d&&_.height===d,"invalid cube map shape"),l.color[r]={target:_e,data:c[r]}}for(r=0;r<6;++r){for(var x=0;x<c.length;++x)l.color[x].target=_e+r;r>0&&(l.depth=o[0].depth,l.stencil=o[0].stencil,l.depthStencil=o[0].depthStencil),o[r]?o[r](l):o[r]=T(l)}return e(a,{width:d,height:d,color:c})}return a(t),e(a,{faces:o,resize:function(t){var e,n=0|t;if(E(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e<i.length;++e)i[e].resize(n);for(e=0;e<6;++e)o[e].resize(n);return a.width=a.height=n,a},_reglType:"framebufferCube",destroy:function(){o.forEach((function(t){t.destroy()}))}})},clear:function(){W(_).forEach(S)},restore:function(){u.cur=null,u.next=null,u.dirty=!0,W(_).forEach((function(e){e.framebuffer=t.createFramebuffer(),A(e)}))}})}(i,d,m,S,A,l),I=or(i,f,d,m,b,x,0,T,{},_,w,{elements:null,primitive:4,count:-1,offset:0,instances:-1},y,h,r),N=Oe(i,T,I.procs.poll,y,o,d,m),D=I.next,M=i.canvas,P=[],G=[],L=[],H=[r.onDestroy],X=null;function q(){if(0===P.length)return h&&h.update(),void(X=null);X=C.next(q),mt();for(var t=P.length-1;t>=0;--t){var e=P[t];e&&e(y,null,0)}i.flush(),h&&h.update()}function Y(){!X&&P.length>0&&(X=C.next(q))}function ft(){X&&(C.cancel(q),X=null)}function lt(t){t.preventDefault(),a=!0,ft(),G.forEach((function(t){t()}))}function dt(t){i.getError(),a=!1,u.restore(),w.restore(),b.restore(),S.restore(),A.restore(),T.restore(),_.restore(),h&&h.restore(),I.procs.refresh(),Y(),L.forEach((function(t){t()}))}function ht(t){function n(t,e){var n={},r={};return Object.keys(t).forEach((function(i){var o=t[i];if(O.isDynamic(o))r[i]=O.unbox(o,i);else{if(e&&Array.isArray(o))for(var a=0;a<o.length;++a)if(O.isDynamic(o[a]))return void(r[i]=O.unbox(o,i));n[i]=o}})),{dynamic:r,static:n}}E(!!t,"invalid args to regl({...})"),E.type(t,"object","invalid args to regl({...})");var r=n(t.context||{},!0),i=n(t.uniforms||{},!0),o=n(t.attributes||{},!1),u=n(function(t){var n=e({},t);function r(t){if(t in n){var e=n[t];delete n[t],Object.keys(e).forEach((function(r){n[t+"."+r]=e[r]}))}}return delete n.uniforms,delete n.attributes,delete n.context,delete n.vao,"stencil"in n&&n.stencil.op&&(n.stencil.opBack=n.stencil.opFront=n.stencil.op,delete n.stencil.op),r("blend"),r("depth"),r("cull"),r("stencil"),r("polygonOffset"),r("scissor"),r("sample"),"vao"in t&&(n.vao=t.vao),n}(t),!1),s={gpuTime:0,cpuTime:0,count:0},c=I.compile(u,o,i,r,s),f=c.draw,l=c.batch,d=c.scope,h=[];return e((function(t,e){var n;if(a&&E.raise("context lost"),"function"==typeof t)return d.call(this,null,t,0);if("function"==typeof e)if("number"==typeof t)for(n=0;n<t;++n)d.call(this,null,e,n);else{if(!Array.isArray(t))return d.call(this,t,e,0);for(n=0;n<t.length;++n)d.call(this,t[n],e,n)}else if("number"==typeof t){if(t>0)return l.call(this,function(t){for(;h.length<t;)h.push(null);return h}(0|t),0|t)}else{if(!Array.isArray(t))return f.call(this,t);if(t.length)return l.call(this,t,t.length)}}),{stats:s,destroy:function(){c.destroy()}})}M&&(M.addEventListener(ur,lt,!1),M.addEventListener(sr,dt,!1));var pt=T.setFBO=ht({framebuffer:O.define.call(null,1,"framebuffer")});function vt(t,e){var n=0;I.procs.poll();var r=e.color;r&&(i.clearColor(+r[0]||0,+r[1]||0,+r[2]||0,+r[3]||0),n|=16384),"depth"in e&&(i.clearDepth(+e.depth),n|=256),"stencil"in e&&(i.clearStencil(0|e.stencil),n|=1024),E(!!n,"called regl.clear with no buffer specified"),i.clear(n)}function gt(t){return E.type(t,"function","regl.frame() callback must be a function"),P.push(t),Y(),{cancel:function(){var e=cr(P,t);E(e>=0,"cannot cancel a frame twice"),P[e]=function t(){var e=cr(P,t);P[e]=P[P.length-1],P.length-=1,P.length<=0&&ft()}}}}function yt(){var t=D.viewport,e=D.scissor_box;t[0]=t[1]=e[0]=e[1]=0,y.viewportWidth=y.framebufferWidth=y.drawingBufferWidth=t[2]=e[2]=i.drawingBufferWidth,y.viewportHeight=y.framebufferHeight=y.drawingBufferHeight=t[3]=e[3]=i.drawingBufferHeight}function mt(){y.tick+=1,y.time=_t(),yt(),I.procs.poll()}function bt(){S.refresh(),yt(),I.procs.refresh(),h&&h.update()}function _t(){return(k()-p)/1e3}bt();var xt=e(ht,{clear:function(t){if(E("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var n=0;n<6;++n)pt(e({framebuffer:t.framebuffer.faces[n]},t),vt);else pt(t,vt);else vt(0,t)},prop:O.define.bind(null,1),context:O.define.bind(null,2),this:O.define.bind(null,3),draw:ht({}),buffer:function(t){return b.create(t,34962,!1,!1)},elements:function(t){return x.create(t,!1)},texture:S.create2D,cube:S.createCube,renderbuffer:A.create,framebuffer:T.create,framebufferCube:T.createCube,vao:_.createVAO,attributes:o,frame:gt,on:function(t,e){var n;switch(E.type(e,"function","listener callback must be a function"),t){case"frame":return gt(e);case"lost":n=G;break;case"restore":n=L;break;case"destroy":n=H;break;default:E.raise("invalid event, must be one of frame,lost,restore,destroy")}return n.push(e),{cancel:function(){for(var t=0;t<n.length;++t)if(n[t]===e)return n[t]=n[n.length-1],void n.pop()}}},limits:m,hasExtension:function(t){return m.extensions.indexOf(t.toLowerCase())>=0},read:N,destroy:function(){P.length=0,ft(),M&&(M.removeEventListener(ur,lt),M.removeEventListener(sr,dt)),w.clear(),T.clear(),A.clear(),S.clear(),x.clear(),b.clear(),_.clear(),h&&h.clear(),H.forEach((function(t){t()}))},_gl:i,_refresh:bt,poll:function(){mt(),h&&h.update()},now:_t,stats:l});return r.onDone(null,xt),xt}}()},2842:(t,e,n)=>{var r=n(1799).default;function i(){"use strict";t.exports=i=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function d(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,o=Object.create(i.prototype),u=new N(r||[]);return a(o,"_invoke",{value:S(t,n,u)}),o}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=d;var p={};function v(){}function g(){}function y(){}var m={};l(m,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(O([])));_&&_!==n&&o.call(_,s)&&(m=_);var x=y.prototype=v.prototype=Object.create(m);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,a,u,s){var c=h(t[i],t,a);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==r(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,u,s)}),(function(t){n("throw",t,u,s)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,s)}))}s(c.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(o,o):o()}})}function S(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=A(a,n);if(u){if(u===p)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=h(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function A(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var r=h(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,p;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function T(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 I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function O(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:C}}function C(){return{value:void 0,done:!0}}return g.prototype=y,a(x,"constructor",{value:y,configurable:!0}),a(y,"constructor",{value:g,configurable:!0}),g.displayName=l(y,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,f,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},w(E.prototype),l(E.prototype,c,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new E(d(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(x),l(x,f,"Generator"),l(x,s,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,N.prototype={constructor:N,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(I),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=o.call(i,"catchLoc"),s=o.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},1799:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},2662:(t,e,n)=>{var r=n(2842)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n(9216);var t,e=(t=n(2680))&&t.__esModule?t:{default:t};e.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),e.default._babelPolyfill=!0})(),(()=>{"use strict";n.r(r),n.d(r,{CircularLayout:()=>Vt,ComboCombinedLayout:()=>A_,ComboForceLayout:()=>w_,ConcentricLayout:()=>Pf,DagreCompoundLayout:()=>ef,DagreLayout:()=>or,ERLayout:()=>Y_,Force2Layout:()=>Y,ForceAtlas2Layout:()=>D_,ForceLayout:()=>Ft,FruchtermanGPULayout:()=>g_,FruchtermanLayout:()=>Ff,GForceGPULayout:()=>__,GForceLayout:()=>P,GridLayout:()=>C,Layout:()=>K_,Layouts:()=>Z_,MDSLayout:()=>Lf,RadialLayout:()=>Mf,RandomLayout:()=>D,getLayoutByName:()=>N,registerLayout:()=>T,unRegisterLayout:()=>I});var t=function(){function t(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return t.prototype.layout=function(t){return this.init(t),this.execute(!0)},t.prototype.init=function(t){this.nodes=t.nodes||[],this.edges=t.edges||[],this.combos=t.combos||[],this.comboEdges=t.comboEdges||[],this.hiddenNodes=t.hiddenNodes||[],this.hiddenEdges=t.hiddenEdges||[],this.hiddenCombos=t.hiddenCombos||[]},t.prototype.execute=function(t){},t.prototype.executeWithWorker=function(){},t.prototype.getDefaultCfg=function(){return{}},t.prototype.updateCfg=function(t){t&&Object.assign(this,t)},t.prototype.getType=function(){return"base"},t.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},t}(),e=function(t){return"string"==typeof t},i=(Object.create(null),Array.isArray),o=function(t){return"number"==typeof t},a=function(t){return Number.isNaN(Number(t))};function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}var s,c=function(){return c=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},c.apply(this,arguments)},f=function(t){return null!==t&&"object"===u(t)},l=function t(e){if(null===e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){var n=[];return e.forEach((function(t){n.push(t)})),n.map((function(e){return t(e)}))}if("object"===u(e)&&Object.keys(e).length){var r=c({},e);return Object.keys(r).forEach((function(e){r[e]=t(r[e])})),r}return e},d=function(t,e){var n=t[e];return f(n)?n.cell:n},h=function(t,e,n){for(var r=[],i=0;i<t;i++)r[i]={in:0,out:0,all:0};return n?(n.forEach((function(t){var n=d(t,"source"),i=d(t,"target");n&&r[e[n]]&&(r[e[n]].out+=1,r[e[n]].all+=1),i&&r[e[i]]&&(r[e[i]].in+=1,r[e[i]].all+=1)})),r):r},p=function(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},v=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e,i.push([])})),null==r||r.forEach((function(t){var n=d(t,"source"),r=d(t,"target"),a=o[n],u=o[r];void 0!==a&&void 0!==u&&(i[a][u]=1,e||(i[u][a]=1))})),i},g=function t(e,n){if(e&&e.children)for(var r=e.children.length-1;r>=0;r--)if(!t(e.children[r],n))return;return!!n(e)},y=function(t,e){"function"==typeof e&&g(t,e)},m=function(t){var e={x:0,y:0};t.forEach((function(t){e.x+=t.x||0,e.y+=t.y||0}));var n=t.length||1;return{x:e.x/n,y:e.y/n}},b=function(t,e,n){var r,i;return"source"===t?(null===(r=null==n?void 0:n.find((function(t){return t.target===e.id})))||void 0===r?void 0:r.source)||{}:(null===(i=null==n?void 0:n.find((function(t){return t.source===e.id})))||void 0===i?void 0:i.target)||{}},_=function(t,e,n){var r=[];switch(t){case"source":r=null==n?void 0:n.filter((function(t){return t.source===e.id})).map((function(t){return t.target}));break;case"target":r=null==n?void 0:n.filter((function(t){return t.target===e.id})).map((function(t){return t.source}));break;case"both":r=null==n?void 0:n.filter((function(t){return t.source===e.id})).map((function(t){return t.target})).concat(null==n?void 0:n.filter((function(t){return t.target===e.id})).map((function(t){return t.source})))}var i=new Set(r);return Array.from(i)},x=function(t){return"function"==typeof t},w=function(t,e,n){return n||(o(t)?function(){return t}:function(){return e})},E=function(t,e,n){return void 0===n&&(n=!0),e||0===e?x(e)?e:o(e)?function(){return e}:i(e)?function(){if(n){var r=Math.max.apply(Math,e);return isNaN(r)?t:r}return e}:f(e)?function(){if(n){var r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:function(){return t}:function(e){return e.size?i(e.size)?e.size[0]>e.size[1]?e.size[0]:e.size[1]:f(e.size)?e.size.width>e.size.height?e.size.width:e.size.height:e.size:t}},S=(s=function(t,e){return s=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])},s(t,e)},function(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}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),A=new Map,T=function(e,n){if(A.get(e)&&console.warn("The layout with the name ".concat(e," exists already, it will be overridden")),f(n)){var r=function(t){function e(e){var r=t.call(this)||this,i=r,o={},a=i.getDefaultCfg();return Object.assign(o,a,n,e),Object.keys(o).forEach((function(t){var e=o[t];i[t]=e})),r}return S(e,t),e}(t);A.set(e,r)}else A.set(e,n);return A.get(e)},I=function(t){A.has(t)&&A.delete(t)},N=function(t){return A.has(t)?A.get(t):null},O=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=function(t){function n(e){var n=t.call(this)||this;return n.begin=[0,0],n.preventOverlap=!0,n.preventOverlapPadding=10,n.condense=!1,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.row=0,n.col=0,n.cellWidth=0,n.cellHeight=0,n.cellUsed={},n.id2manPos={},n.onLayoutEnd=function(){},n.updateCfg(e),n}return O(n,t),n.prototype.getDefaultCfg=function(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30}},n.prototype.execute=function(){var t=this,n=t.nodes,r=t.edges,o=t.begin,u=n.length;if(0===u)return t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:r};if(1===u)return n[0].x=o[0],n[0].y=o[1],t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:r};var s=t.sortBy,c=t.width,f=t.height,l=t.condense,d=t.preventOverlapPadding,p=t.preventOverlap,v=t.nodeSpacing,g=t.nodeSize,y=[];n.forEach((function(t){y.push(t)}));var m={};if(y.forEach((function(t,e){m[t.id]=e})),("degree"===s||!e(s)||void 0===y[0][s])&&(s="degree",a(n[0].degree))){var b=h(y.length,m,r);y.forEach((function(t,e){t.degree=b[e].all}))}y.sort((function(t,e){return e[s]-t[s]})),c||"undefined"==typeof window||(c=window.innerWidth),f||"undefined"==typeof window||(f=window.innerHeight);var _=t.rows,x=null!=t.cols?t.cols:t.columns;if(t.cells=u,null!=_&&null!=x?(t.rows=_,t.cols=x):null!=_&&null==x?(t.rows=_,t.cols=Math.ceil(t.cells/t.rows)):null==_&&null!=x?(t.cols=x,t.rows=Math.ceil(t.cells/t.cols)):(t.splits=Math.sqrt(t.cells*t.height/t.width),t.rows=Math.round(t.splits),t.cols=Math.round(t.width/t.height*t.splits)),t.rows=Math.max(t.rows,1),t.cols=Math.max(t.cols,1),t.cols*t.rows>t.cells)((S=t.small())-1)*(w=t.large())>=t.cells?t.small(S-1):(w-1)*S>=t.cells&&t.large(w-1);else for(;t.cols*t.rows<t.cells;){var w,S=t.small();((w=t.large())+1)*S>=t.cells?t.large(w+1):t.small(S+1)}if(t.cellWidth=c/t.cols,t.cellHeight=f/t.rows,l&&(t.cellWidth=0,t.cellHeight=0),p||v){var A=E(10,v),T=E(30,g,!1);y.forEach((function(e){e.x&&e.y||(e.x=0,e.y=0);var n,r,o=T(e)||30;i(o)?(n=o[0],r=o[1]):(n=o,r=o);var a=void 0!==A?A(e):d,u=n+a,s=r+a;t.cellWidth=Math.max(t.cellWidth,u),t.cellHeight=Math.max(t.cellHeight,s)}))}t.cellUsed={},t.row=0,t.col=0,t.id2manPos={};for(var I=0;I<y.length;I++){var N=y[I],O=void 0;if(t.position&&(O=t.position(N)),O&&(void 0!==O.row||void 0!==O.col)){var C={row:O.row,col:O.col};if(void 0===C.col)for(C.col=0;t.used(C.row,C.col);)C.col++;else if(void 0===C.row)for(C.row=0;t.used(C.row,C.col);)C.row++;t.id2manPos[N.id]=C,t.use(C.row,C.col)}t.getPos(N)}return t.onLayoutEnd&&t.onLayoutEnd(),{edges:r,nodes:y}},n.prototype.small=function(t){var e,n=this,r=n.rows||5,i=n.cols||5;return null==t?e=Math.min(r,i):Math.min(r,i)===n.rows?n.rows=t:n.cols=t,e},n.prototype.large=function(t){var e,n=this,r=n.rows||5,i=n.cols||5;return null==t?e=Math.max(r,i):Math.max(r,i)===n.rows?n.rows=t:n.cols=t,e},n.prototype.used=function(t,e){return this.cellUsed["c-".concat(t,"-").concat(e)]||!1},n.prototype.use=function(t,e){this.cellUsed["c-".concat(t,"-").concat(e)]=!0},n.prototype.moveToNextCell=function(){var t=this,e=t.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},n.prototype.getPos=function(t){var e,n,r=this,i=r.begin,o=r.cellWidth,a=r.cellHeight,u=r.id2manPos[t.id];if(u)e=u.col*o+o/2+i[0],n=u.row*a+a/2+i[1];else{for(;r.used(r.row,r.col);)r.moveToNextCell();e=r.col*o+o/2+i[0],n=r.row*a+a/2+i[1],r.use(r.row,r.col),r.moveToNextCell()}t.x=e,t.y=n},n.prototype.getType=function(){return"grid"},n}(t),k=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),D=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return k(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.center;return t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),e&&e.forEach((function(e){e.x=.9*(Math.random()-.5)*t.width+n[0],e.y=.9*(Math.random()-.5)*t.height+n[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(t),M=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),R=function(t,e){return t?o(t)?function(e){return t}:t:function(t){return e||1}},P=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=500,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.preventOverlap=!0,n.collideStrength=1,n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.animate=!0,n.updateCfg(e),n}return M(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t,e,n=this,r=n.nodes;if(void 0!==n.timeInterval&&"undefined"!=typeof window&&window.clearInterval(n.timeInterval),r&&0!==r.length){n.width||"undefined"==typeof window||(n.width=window.innerWidth),n.height||"undefined"==typeof window||(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var a=n.center;if(1===r.length)return r[0].x=a[0],r[0].y=a[1],void(null===(e=n.onLayoutEnd)||void 0===e||e.call(n));var u={},s={};r.forEach((function(t,e){o(t.x)||(t.x=Math.random()*n.width),o(t.y)||(t.y=Math.random()*n.height),u[t.id]=t,s[t.id]=e})),n.nodeMap=u,n.nodeIdxMap=s,n.linkDistance=R(n.linkDistance,1),n.nodeStrength=R(n.nodeStrength,1),n.edgeStrength=R(n.edgeStrength,1);var c,l=n.nodeSize;if(n.preventOverlap){var d,p=n.nodeSpacing;d=o(p)?function(){return p}:x(p)?p:function(){return 0},c=l?i(l)?function(t){return Math.max(l[0],l[1])+d(t)}:function(t){return l+d(t)}:function(t){return t.size?i(t.size)?Math.max(t.size[0],t.size[1])+d(t):f(t.size)?Math.max(t.size.width,t.size.height)+d(t):t.size+d(t):10+d(t)}}n.nodeSize=c;var v=n.edges;n.degrees=h(r.length,n.nodeIdxMap,v),n.getMass||(n.getMass=function(t){return t.mass||n.degrees[n.nodeIdxMap[t.id]].all||1}),n.run()}else null===(t=n.onLayoutEnd)||void 0===t||t.call(n)},e.prototype.run=function(){var t,e=this,n=e.maxIteration,r=e.nodes,i=e.workerEnabled,o=e.minMovement,a=e.animate;if(r)if(i||!a){for(var u=0;u<n;u++){var s=e.runOneStep(u);if(e.reachMoveThreshold(r,s,o))break}null===(t=e.onLayoutEnd)||void 0===t||t.call(e)}else{if("undefined"==typeof window)return;var c=0;this.timeInterval=window.setInterval((function(){var t,i;if(r){var a=e.runOneStep(c)||[];e.reachMoveThreshold(r,a,o)&&(null===(t=e.onLayoutEnd)||void 0===t||t.call(e),window.clearInterval(e.timeInterval)),++c>=n&&(null===(i=e.onLayoutEnd)||void 0===i||i.call(e),window.clearInterval(e.timeInterval))}}),0)}},e.prototype.reachMoveThreshold=function(t,e,n){var r=0;return t.forEach((function(t,n){var i=t.x-e[n].x,o=t.y-e[n].y;r+=Math.sqrt(i*i+o*o)})),(r/=t.length)<n},e.prototype.runOneStep=function(t){var e,n=this,r=n.nodes,i=n.edges,o=[],a=[];if(r){r.forEach((function(t,e){o[2*e]=0,o[2*e+1]=0,a[2*e]=0,a[2*e+1]=0})),n.calRepulsive(o,r),i&&n.calAttractive(o,i),n.calGravity(o,r);var u=Math.max(.02,n.interval-.002*t);n.updateVelocity(o,a,u,r);var s=[];return r.forEach((function(t){s.push({x:t.x,y:t.y})})),n.updatePosition(a,u,r),null===(e=n.tick)||void 0===e||e.call(n),s}},e.prototype.calRepulsive=function(t,e){var n=this,r=n.getMass,i=n.factor,o=n.coulombDisScale,a=n.preventOverlap,u=n.collideStrength,s=void 0===u?1:u,c=n.nodeStrength,f=n.nodeSize;e.forEach((function(n,u){var l=r?r(n):1;e.forEach((function(e,d){if(!(u>=d)){var h=n.x-e.x,p=n.y-e.y;0===h&&0===p&&(h=.01*Math.random(),p=.01*Math.random());var v=h*h+p*p,g=Math.sqrt(v),y=(g+.1)*o,m=h/g,b=p/g,_=.5*(c(n)+c(e))*i/(y*y),x=r?r(e):1;if(t[2*u]+=m*_,t[2*u+1]+=b*_,t[2*d]-=m*_,t[2*d+1]-=b*_,a&&(f(n)+f(e))/2>g){var w=s*(c(n)+c(e))*.5/v;t[2*u]+=m*w/l,t[2*u+1]+=b*w/l,t[2*d]-=m*w/x,t[2*d+1]-=b*w/x}}}))}))},e.prototype.calAttractive=function(t,e){var n=this,r=n.nodeMap,i=n.nodeIdxMap,o=n.linkDistance,a=n.edgeStrength,u=n.nodeSize,s=n.getMass;e.forEach((function(e,n){var c=d(e,"source"),f=d(e,"target"),l=r[c],h=r[f],p=h.x-l.x,v=h.y-l.y;0===p&&0===v&&(p=.01*Math.random(),v=.01*Math.random());var g=Math.sqrt(p*p+v*v),y=p/g,m=v/g,b=((o(e,l,h)||1+(u(l)+u(h)||0)/2)-g)*a(e),_=i[c],x=i[f],w=s?s(l):1,E=s?s(h):1;t[2*_]-=y*b/w,t[2*_+1]-=m*b/w,t[2*x]+=y*b/E,t[2*x+1]+=m*b/E}))},e.prototype.calGravity=function(t,e){for(var n=this,r=n.center,i=n.gravity,a=n.degrees,u=e.length,s=0;s<u;s++){var c=e[s],f=c.x-r[0],l=c.y-r[1],d=i;if(n.getCenter){var h=n.getCenter(c,a[s].all);h&&o(h[0])&&o(h[1])&&o(h[2])&&(f=c.x-h[0],l=c.y-h[1],d=h[2])}d&&(t[2*s]-=d*f,t[2*s+1]-=d*l)}},e.prototype.updateVelocity=function(t,e,n,r){var i=this,o=n*i.damping;r.forEach((function(n,r){var a=t[2*r]*o||.01,u=t[2*r+1]*o||.01,s=Math.sqrt(a*a+u*u);if(s>i.maxSpeed){var c=i.maxSpeed/s;a*=c,u*=c}e[2*r]=a,e[2*r+1]=u}))},e.prototype.updatePosition=function(t,e,n){n.forEach((function(n,r){if(o(n.fx)&&o(n.fy))return n.x=n.fx,void(n.y=n.fy);var i=t[2*r]*e,a=t[2*r+1]*e;n.x+=i,n.y+=a}))},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(t);function G(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,u,s,c,f,l,d,h=t._root,p={data:r},v=t._x0,g=t._y0,y=t._x1,m=t._y1;if(!h)return t._root=p,t;for(;h.length;)if((c=e>=(o=(v+y)/2))?v=o:y=o,(f=n>=(a=(g+m)/2))?g=a:m=a,i=h,!(h=h[l=f<<1|c]))return i[l]=p,t;if(u=+t._x.call(null,h.data),s=+t._y.call(null,h.data),e===u&&n===s)return p.next=h,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=e>=(o=(v+y)/2))?v=o:y=o,(f=n>=(a=(g+m)/2))?g=a:m=a}while((l=f<<1|c)==(d=(s>=a)<<1|u>=o));return i[d]=h,i[l]=p,t}function L(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function j(t){return t[0]}function F(t){return t[1]}function U(t,e,n){var r=new B(null==e?j:e,null==n?F:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function B(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 z(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var V=U.prototype=B.prototype;V.copy=function(){var t,e,n=new B(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=z(r),n;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]=z(e));return n},V.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return G(this.cover(e,n),e,n,t)},V.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,c=1/0,f=-1/0,l=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,u[n]=i,r<s&&(s=r),r>f&&(f=r),i<c&&(c=i),i>l&&(l=i));if(s>f||c>l)return this;for(this.cover(s,c).cover(f,l),n=0;n<o;++n)G(this,a[n],u[n],t[n]);return this},V.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;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,u,s=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(u=(e<r)<<1|t<n,(a=new Array(4))[u]=c,c=a,s*=2,u){case 0:i=n+s,o=r+s;break;case 1:n=i-s,o=r+s;break;case 2:i=n+s,r=o-s;break;case 3:n=i-s,r=o-s}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},V.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},V.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]]},V.find=function(t,e,n){var r,i,o,a,u,s,c,f=this._x0,l=this._y0,d=this._x1,h=this._y1,p=[],v=this._root;for(v&&p.push(new L(v,f,l,d,h)),null==n?n=1/0:(f=t-n,l=e-n,d=t+n,h=e+n,n*=n);s=p.pop();)if(!(!(v=s.node)||(i=s.x0)>d||(o=s.y0)>h||(a=s.x1)<f||(u=s.y1)<l))if(v.length){var g=(i+a)/2,y=(o+u)/2;p.push(new L(v[3],g,y,a,u),new L(v[2],i,y,g,u),new L(v[1],g,o,a,y),new L(v[0],i,o,g,y)),(c=(e>=y)<<1|t>=g)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=s)}else{var m=t-+this._x.call(null,v.data),b=e-+this._y.call(null,v.data),_=m*m+b*b;if(_<n){var x=Math.sqrt(n=_);f=t-x,l=e-x,d=t+x,h=e+x,r=v.data}}return r},V.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,u,s,c,f,l,d,h=this._root,p=this._x0,v=this._y0,g=this._x1,y=this._y1;if(!h)return this;if(h.length)for(;;){if((c=o>=(u=(p+g)/2))?p=u:g=u,(f=a>=(s=(v+y)/2))?v=s:y=s,e=h,!(h=h[l=f<<1|c]))return this;if(!h.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(n=e,d=l)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):e?(i?e[l]=i:delete e[l],(h=e[0]||e[1]||e[2]||e[3])&&h===(e[3]||e[2]||e[1]||e[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=i,this)},V.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},V.root=function(){return this._root},V.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},V.visit=function(t){var e,n,r,i,o,a,u=[],s=this._root;for(s&&u.push(new L(s,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(s=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&s.length){var c=(r+o)/2,f=(i+a)/2;(n=s[3])&&u.push(new L(n,c,f,o,a)),(n=s[2])&&u.push(new L(n,r,f,c,a)),(n=s[1])&&u.push(new L(n,c,i,o,f)),(n=s[0])&&u.push(new L(n,r,i,c,f))}return this},V.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new L(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,u=e.y0,s=e.x1,c=e.y1,f=(a+s)/2,l=(u+c)/2;(o=i[0])&&n.push(new L(o,a,u,f,l)),(o=i[1])&&n.push(new L(o,f,u,s,l)),(o=i[2])&&n.push(new L(o,a,l,f,c)),(o=i[3])&&n.push(new L(o,f,l,s,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},V.x=function(t){return arguments.length?(this._x=t,this):this._x},V.y=function(t){return arguments.length?(this._y=t,this):this._y};function W(t){var e=0,n=0,r=0;if(t.length){for(var i=0;i<4;i++)(o=t[i])&&o.weight&&(e+=o.weight,n+=o.x*o.weight,r+=o.y*o.weight);t.x=n/e,t.y=r/e,t.weight=e}else{var o=t;t.x=o.data.x,t.y=o.data.y,t.weight=o.data.weight}}var H=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),X=function(){return X=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},X.apply(this,arguments)},q=function(t,e){return t?o(t)?function(e){return t}:t:function(t){return e||1}},Y=function(t){function e(e){var n=t.call(this)||this;n.maxIteration=1e3,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=100,n.minMovement=.4,n.interval=.02,n.factor=1,n.linkDistance=200,n.gravity=0,n.clusterNodeStrength=20,n.preventOverlap=!0,n.distanceThresholdMode="mean",n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.judgingDistance=0,n.centripetalOptions={leaf:2,single:2,others:1,center:function(t){return{x:n.width/2,y:n.height/2}}};var r=e.getMass;return n.propsGetMass=r,n.updateCfg(e),n}return H(e,t),e.prototype.getCentripetalOptions=function(){var t,e=this,n=e.leafCluster,r=e.clustering,i=e.nodeClusterBy,o=e.nodes,a=e.nodeMap,u=e.clusterNodeStrength,s=function(t){return"function"==typeof u?u(t):u},c={};if(n){t=this.getSameTypeLeafMap()||{};var f=Array.from(new Set(null==o?void 0:o.map((function(t){return t[i]}))))||[];c={single:100,leaf:function(e,n,r){var i=t[e.id]||{},o=i.relativeLeafNodes,a=i.sameTypeLeafNodes;return(null==a?void 0:a.length)===(null==o?void 0:o.length)||1===(null==f?void 0:f.length)?1:s(e)},others:1,center:function(e,n,r){var i,o,a=((null===(i=e.data)||void 0===i?void 0:i.layout)||{}).degree;if(!a)return{x:100,y:100};if(1===a){var u=(t[e.id]||{}).sameTypeLeafNodes,s=void 0===u?[]:u;1===s.length?o=void 0:s.length>1&&(o=m(s))}else o=void 0;return{x:null==o?void 0:o.x,y:null==o?void 0:o.y}}}}if(r){t||(t=this.getSameTypeLeafMap());var l=Array.from(new Set(o.map((function(t,e){return t[i]})))).filter((function(t){return void 0!==t})),d={};l.forEach((function(t){var e=o.filter((function(e){return e[i]===t})).map((function(t){return a[t.id]}));d[t]=m(e)})),c={single:function(t){return s(t)},leaf:function(t){return s(t)},others:function(t){return s(t)},center:function(t,e,n){var r=d[t[i]];return{x:null==r?void 0:r.x,y:null==r?void 0:r.y}}}}this.centripetalOptions=X(X({},this.centripetalOptions),c);var h=this.centripetalOptions,p=h.leaf,v=h.single,g=h.others;p&&"function"!=typeof p&&(this.centripetalOptions.leaf=function(){return p}),v&&"function"!=typeof v&&(this.centripetalOptions.single=function(){return v}),g&&"function"!=typeof g&&(this.centripetalOptions.others=function(){return g})},e.prototype.updateCfg=function(t){t&&Object.assign(this,t)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t=this;t.stop();var e=t.nodes,n=t.edges,r=t.defSpringLen;if(t.judgingDistance=0,e&&0!==e.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var a=t.center;if(1===e.length)return e[0].x=a[0],e[0].y=a[1],void t.onLayoutEnd([X({},e[0])]);t.degreesMap=function(t,e){var n={};return t.forEach((function(t){n[t.id]={in:0,out:0,all:0}})),e?(e.forEach((function(t){var e=d(t,"source"),r=d(t,"target");e&&(n[e].out+=1,n[e].all+=1),r&&(n[r].in+=1,n[r].all+=1)})),n):n}(e,n),t.propsGetMass?t.getMass=t.propsGetMass:t.getMass=function(e){var n=1;o(e.mass)&&(n=e.mass);var r=t.degreesMap[e.id].all;return!r||r<5?n:5*r*n};var u,s=t.nodeSize;if(t.preventOverlap){var c,l=t.nodeSpacing;c=o(l)?function(){return l}:x(l)?l:function(){return 0},u=s?i(s)?function(t){return Math.max(s[0],s[1])+c(t)}:function(t){return s+c(t)}:function(t){return t.size?i(t.size)?Math.max(t.size[0],t.size[1])+c(t):f(t.size)?Math.max(t.size.width,t.size.height)+c(t):t.size+c(t):10+c(t)}}t.nodeSize=u,t.linkDistance=q(t.linkDistance,1),t.nodeStrength=q(t.nodeStrength,1),t.edgeStrength=q(t.edgeStrength,1);var h={},p={};e.forEach((function(e,n){o(e.x)||(e.x=Math.random()*t.width),o(e.y)||(e.y=Math.random()*t.height);var r=t.degreesMap[e.id];h[e.id]=X(X({},e),{data:X(X({},e.data),{size:t.nodeSize(e)||30,layout:{inDegree:r.in,outDegree:r.out,degree:r.all,tDegree:r.in,sDegree:r.out,force:{mass:t.getMass(e),nodeStrength:t.nodeStrength(e)}}})}),p[e.id]=n})),t.nodeMap=h,t.nodeIdxMap=p,t.edgeInfos=[],null==n||n.forEach((function(e){var n=h[e.source],i=h[e.target];n&&i?t.edgeInfos.push({edgeStrength:t.edgeStrength(e),linkDistance:r?r(X(X({},e),{source:n,target:i}),n,i):t.linkDistance(e,n,i)||1+(s(n)+s(n)||0)/2}):elf.edgeInfos.push({})})),this.getCentripetalOptions(),t.onLayoutEnd=t.onLayoutEnd||function(){},t.run()}else t.onLayoutEnd([])},e.prototype.run=function(){var t=this,e=t.maxIteration,n=t.nodes,r=t.workerEnabled,i=t.minMovement,o=t.animate,a=t.nodeMap;if(n){var u=[];n.forEach((function(t,e){u[2*e]=0,u[2*e+1]=0}));var s=e;if(r||!o){for(var c=0;(t.judgingDistance>i||c<1)&&c<s;c++)t.runOneStep(c,u);t.onLayoutEnd(Object.values(a))}else{if("undefined"==typeof window)return;var f=0;this.timeInterval=window.setInterval((function(){n&&(t.runOneStep(f,u),(++f>=s||t.judgingDistance<i)&&(t.onLayoutEnd(Object.values(a)),window.clearInterval(t.timeInterval)))}),0)}}},e.prototype.runOneStep=function(t,e){var n,r=this,i=r.nodes,o=r.edges,a=(r.nodeMap,r.monitor),u=[];if(null==i?void 0:i.length){r.calRepulsive(u),o&&r.calAttractive(u),r.calGravity(u);var s=r.interval;r.updateVelocity(u,e,s),r.updatePosition(e,s),null===(n=r.tick)||void 0===n||n.call(r),a&&a({energy:this.calTotalEnergy(u),nodes:i,edges:o,iterations:t})}},e.prototype.calTotalEnergy=function(t){var e=this.nodes,n=this.nodeMap;if(!(null==e?void 0:e.length))return 0;var r=0;return e.forEach((function(e,i){var o=t[2*i],a=t[2*i+1],u=o*o+a*a,s=n[e.id].data.layout.force.mass;r+=(void 0===s?1:s)*u*.5})),r},e.prototype.calRepulsive=function(t){var e=this,n=e.nodes,r=e.nodeMap,i=e.factor,o=e.coulombDisScale;e.nodeSize,function(t,e,n,r,i){var o=n/r,a=t.map((function(t,n){var r=e[t.id],i=r.data,a=r.x,u=r.y,s=r.size,c=i.layout.force.nodeStrength;return{x:a,y:u,size:s,index:n,vx:0,vy:0,weight:o*c}})),u=U(a,(function(t){return t.x}),(function(t){return t.y})).visitAfter(W);a.forEach((function(t){!function(t,e){e.visit((function(e,n,r,i,o){return function(t,e,n,r,i,o){var a=o.x-t.x||.1,u=o.y-t.y||.1,s=r-e,c=a*a+u*u,f=Math.sqrt(c)*c;if(s*s*.81<c){var l=t.weight/f;return o.vx+=a*l,o.vy+=u*l,!0}if(t.length)return!1;t.data!==o&&(l=t.data.weight/f,o.vx+=a*l,o.vy+=u*l)}(e,n,0,i,0,t)}))}(t,u)})),a.map((function(n,r){var o=e[t[r].id].data.layout.force.mass,a=void 0===o?1:o;i[2*r]=n.vx/a,i[2*r+1]=n.vy/a}))}(n,r,i,o*o,t)},e.prototype.calAttractive=function(t){var e=this,n=e.edges,r=e.nodeMap,i=e.nodeIdxMap,o=e.edgeInfos;e.nodeSize,n.forEach((function(e,n){var a=d(e,"source"),u=d(e,"target"),s=r[a],c=r[u];if(s&&c){var f=c.x-s.x,l=c.y-s.y;f||l||(f=.01*Math.random(),l=.01*Math.random());var h=Math.sqrt(f*f+l*l),p=f/h,v=l/h,g=o[n]||{},y=g.linkDistance,m=void 0===y?200:y,b=g.edgeStrength,_=(m-h)*(void 0===b?200:b),x=1/(s.data.layout.force.mass||1),w=1/(c.data.layout.force.mass||1),E=p*_,S=v*_,A=2*i[a],T=2*i[u];t[A]-=E*x,t[A+1]-=S*x,t[T]+=E*w,t[T+1]+=S*w}}))},e.prototype.calGravity=function(t){var e,n=this,r=n.nodes,i=n.edges,a=void 0===i?[]:i,u=n.nodeMap,s=n.width,c=n.height,f=n.center,l=n.gravity,d=n.degreesMap,h=n.centripetalOptions;if(r)for(var p=r.length,v=0;v<p;v++){var g=2*v,y=u[r[v].id],m=y.data.layout.force.mass,b=void 0===m?1:m,_=0,x=0,w=l,E=d[y.id],S=E.in,A=E.out,T=E.all,I=null===(e=n.getCenter)||void 0===e?void 0:e.call(n,y,T);if(I){var N=I[0],O=I[1],C=I[2];_=y.x-N,x=y.y-O,w=C}else _=y.x-f[0],x=y.y-f[1];if(w&&(t[g]-=w*_/b,t[g+1]-=w*x/b),h){var k=h.leaf,D=h.single,M=h.others,R=h.center,P=(null==R?void 0:R(y,r,a,s,c))||{x:0,y:0,centerStrength:0},G=P.x,L=P.y,j=P.centerStrength;if(!o(G)||!o(L))continue;var F=(y.x-G)/b,U=(y.y-L)/b;if(j&&(t[g]-=j*F,t[g+1]-=j*U),0===T){var B=D(y);if(!B)continue;t[g]-=B*F,t[g+1]-=B*U;continue}if(0===S||0===A){var z=k(y,r,a);if(!z)continue;t[g]-=z*F,t[g+1]-=z*U;continue}var V=M(y);if(!V)continue;t[g]-=V*F,t[g+1]-=V*U}}},e.prototype.updateVelocity=function(t,e,n){var r=this,i=r.nodes,o=r.damping,a=r.maxSpeed;(null==i?void 0:i.length)&&i.forEach((function(r,i){var u=(e[2*i]+t[2*i]*n)*o||.01,s=(e[2*i+1]+t[2*i+1]*n)*o||.01,c=Math.sqrt(u*u+s*s);if(c>a){var f=a/c;u*=f,s*=f}e[2*i]=u,e[2*i+1]=s}))},e.prototype.updatePosition=function(t,e){var n=this,r=n.nodes,i=n.distanceThresholdMode,a=n.nodeMap;if(null==r?void 0:r.length){var u=0;"max"===i?n.judgingDistance=-1/0:"min"===i&&(n.judgingDistance=1/0),r.forEach((function(r,s){var c=a[r.id];if(o(r.fx)&&o(r.fy))return r.x=r.fx,r.y=r.fy,c.x=r.x,void(c.y=r.y);var f=t[2*s]*e,l=t[2*s+1]*e;r.x+=f,r.y+=l,c.x=r.x,c.y=r.y;var d=Math.sqrt(f*f+l*l);switch(i){case"max":n.judgingDistance<d&&(n.judgingDistance=d);break;case"min":n.judgingDistance>d&&(n.judgingDistance=d);break;default:u+=d}})),i&&"mean"!==i||(n.judgingDistance=u/r.length)}else this.judgingDistance=0},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,e=t.nodeClusterBy,n=t.nodes,r=t.edges,i=t.nodeMap,o=t.degreesMap;if(null==n?void 0:n.length){var a={};return n.forEach((function(t,n){1===o[t.id].all&&(a[t.id]=function(t,e,n,r,i,o){var a=i[e.id],u=a.in,s=a.out,c=e,f=[];0===u?(c=b("source",e,n),f=_("both",c,n).map((function(t){return o[t]}))):0===s&&(c=b("target",e,n),f=_("both",c,n).map((function(t){return o[t]}))),f=f.filter((function(t){return i[t.id]&&(0===i[t.id].in||0===i[t.id].out)}));var l=function(t,e,n,r,i){var o=n[e]||"",a=(null==r?void 0:r.filter((function(t){return t[e]===o})))||[];return a=a.filter((function(t){var e,n;return 0===(null===(e=i[t.id])||void 0===e?void 0:e.in)||0===(null===(n=i[t.id])||void 0===n?void 0:n.out)})),a}(0,r,e,f,i);return{coreNode:c,relativeLeafNodes:f,sameTypeLeafNodes:l}}(0,t,r,e,o,i))})),a}},e}(t);function K(t){return function(){return t}}function Z(t){return 1e-6*(t()-.5)}var $={value:()=>{}};function J(){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 Q(r)}function Q(t){this._=t}function tt(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function et(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function nt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=$,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Q.prototype=J.prototype={constructor:Q,on:function(t,e){var n,r=this._,i=tt(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=nt(r[n],t.name,e);else if(null==e)for(n in r)r[n]=nt(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=et(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Q(t)},call:function(t,e){if((n=arguments.length-2)>0)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)}};const rt=J;var it,ot,at=0,ut=0,st=0,ct=0,ft=0,lt=0,dt="object"==typeof performance&&performance.now?performance:Date,ht="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function pt(){return ft||(ht(vt),ft=dt.now()+lt)}function vt(){ft=0}function gt(){this._call=this._time=this._next=null}function yt(t,e,n){var r=new gt;return r.restart(t,e,n),r}function mt(){ft=(ct=dt.now())+lt,at=ut=0;try{!function(){pt(),++at;for(var t,e=it;e;)(t=ft-e._time)>=0&&e._call.call(null,t),e=e._next;--at}()}finally{at=0,function(){for(var t,e,n=it,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:it=e);ot=t,_t(r)}(),ft=0}}function bt(){var t=dt.now(),e=t-ct;e>1e3&&(lt-=e,ct=t)}function _t(t){at||(ut&&(ut=clearTimeout(ut)),t-ft>24?(t<1/0&&(ut=setTimeout(mt,t-dt.now()-lt)),st&&(st=clearInterval(st))):(st||(ct=dt.now(),st=setInterval(bt,1e3)),at=1,ht(mt)))}gt.prototype=yt.prototype={constructor:gt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?pt():+n)+(null==e?0:+e),this._next||ot===this||(ot?ot._next=this:it=this,ot=this),this._call=t,this._time=n,_t()},stop:function(){this._call&&(this._call=null,this._time=1/0,_t())}};const xt=4294967296;function wt(t){return t.x}function Et(t){return t.y}var St=Math.PI*(3-Math.sqrt(5));function At(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=yt(l),c=rt("tick","end"),f=function(){let t=1;return()=>(t=(1664525*t+1013904223)%xt)/xt}();function l(){d(),c.call("tick",e),n<r&&(s.stop(),c.call("end",e))}function d(r){var s,c,f=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(n+=(o-n)*i,u.forEach((function(t){t(n)})),s=0;s<f;++s)null==(c=t[s]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function h(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*St;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,f),e}return null==t&&(t=[]),h(),e={tick:d,restart:function(){return s.restart(l),e},stop:function(){return s.stop(),e},nodes:function(n){return arguments.length?(t=n,h(),u.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(f=t,u.forEach(p),e):f},force:function(t,n){return arguments.length>1?(null==n?u.delete(t):u.set(t,p(n)),e):u.get(t)},find:function(e,n,r){var i,o,a,u,s,c=0,f=t.length;for(null==r?r=1/0:r*=r,c=0;c<f;++c)(a=(i=e-(u=t[c]).x)*i+(o=n-u.y)*o)<r&&(s=u,r=a);return s},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function Tt(){var t,e,n,r,i,o=K(-30),a=1,u=1/0,s=.81;function c(n){var i,o=t.length,a=U(t,wt,Et).visitAfter(l);for(r=n,i=0;i<o;++i)e=t[i],a.visit(d)}function f(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function l(t){var e,n,r,o,a,u=0,s=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(u+=e.value,s+=n,r+=n*e.x,o+=n*e.y);t.x=r/s,t.y=o/s}else{(e=t).x=e.data.x,e.y=e.data.y;do{u+=i[e.data.index]}while(e=e.next)}t.value=u}function d(t,o,c,f){if(!t.value)return!0;var l=t.x-e.x,d=t.y-e.y,h=f-o,p=l*l+d*d;if(h*h/s<p)return p<u&&(0===l&&(p+=(l=Z(n))*l),0===d&&(p+=(d=Z(n))*d),p<a&&(p=Math.sqrt(a*p)),e.vx+=l*t.value*r/p,e.vy+=d*t.value*r/p),!0;if(!(t.length||p>=u)){(t.data!==e||t.next)&&(0===l&&(p+=(l=Z(n))*l),0===d&&(p+=(d=Z(n))*d),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(h=i[t.data.index]*r/p,e.vx+=l*h,e.vy+=d*h)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,f()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:K(+t),f(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c.theta=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c}function It(t,e){var n,r=1;function i(){var i,o,a=n.length,u=0,s=0;for(i=0;i<a;++i)u+=(o=n[i]).x,s+=o.y;for(u=(u/a-t)*r,s=(s/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=u,o.y-=s}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function Nt(t){return t.index}function Ot(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Ct(t){var e,n,r,i,o,a,u=Nt,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=K(30),f=1;function l(r){for(var i=0,u=t.length;i<f;++i)for(var s,c,l,d,h,p,v,g=0;g<u;++g)c=(s=t[g]).source,d=(l=s.target).x+l.vx-c.x-c.vx||Z(a),h=l.y+l.vy-c.y-c.vy||Z(a),d*=p=((p=Math.sqrt(d*d+h*h))-n[g])/p*r*e[g],h*=p,l.vx-=d*(v=o[g]),l.vy-=h*v,c.vx+=d*(v=1-v),c.vy+=h*v}function d(){if(r){var a,s,c=r.length,f=t.length,l=new Map(r.map(((t,e)=>[u(t,e,r),t])));for(a=0,i=new Array(c);a<f;++a)(s=t[a]).index=a,"object"!=typeof s.source&&(s.source=Ot(l,s.source)),"object"!=typeof s.target&&(s.target=Ot(l,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(a=0,o=new Array(f);a<f;++a)s=t[a],o[a]=i[s.source.index]/(i[s.source.index]+i[s.target.index]);e=new Array(f),h(),n=new Array(f),p()}}function h(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+s(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,e){r=t,a=e,d()},l.links=function(e){return arguments.length?(t=e,d(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(f=+t,l):f},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:K(+t),h(),l):s},l.distance=function(t){return arguments.length?(c="function"==typeof t?t:K(+t),p(),l):c},l}function kt(t){return t.x+t.vx}function Dt(t){return t.y+t.vy}function Mt(t){var e,n,r,i=1,o=1;function a(){for(var t,a,s,c,f,l,d,h=e.length,p=0;p<o;++p)for(a=U(e,kt,Dt).visitAfter(u),t=0;t<h;++t)s=e[t],l=n[s.index],d=l*l,c=s.x+s.vx,f=s.y+s.vy,a.visit(v);function v(t,e,n,o,a){var u=t.data,h=t.r,p=l+h;if(!u)return e>c+p||o<c-p||n>f+p||a<f-p;if(u.index>s.index){var v=c-u.x-u.vx,g=f-u.y-u.vy,y=v*v+g*g;y<p*p&&(0===v&&(y+=(v=Z(r))*v),0===g&&(y+=(g=Z(r))*g),y=(p-(y=Math.sqrt(y)))/y*i,s.vx+=(v*=y)*(p=(h*=h)/(d+h)),s.vy+=(g*=y)*p,u.vx-=v*(p=1-p),u.vy-=g*p)}}}function u(t){if(t.data)return t.r=n[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 s(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=K(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,s()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:K(+e),s(),a):t},a}function Rt(t){var e,n,r,i=K(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=K(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:K(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:K(+e),a(),o):t},o}function Pt(t){var e,n,r,i=K(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=K(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:K(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:K(+e),a(),o):t},o}var Gt="GPU_LAYOUT_END",Lt={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},jt=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ft=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.nodeStrength=null,n.edgeStrength=null,n.preventOverlap=!1,n.clusterNodeStrength=null,n.clusterEdgeStrength=null,n.clusterEdgeDistance=null,n.clusterNodeSize=null,n.clusterFociStrength=null,n.linkDistance=50,n.alphaDecay=.028,n.alphaMin=.001,n.alpha=.3,n.collideStrength=1,n.workerEnabled=!1,n.tick=function(){},n.onLayoutEnd=function(){},n.ticking=void 0,e&&n.updateCfg(e),n}return jt(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],nodeStrength:null,edgeStrength:null,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,tick:function(){},onLayoutEnd:function(){},workerEnabled:!1}},e.prototype.init=function(t){var e=this;e.nodes=t.nodes||[];var n=t.edges||[];e.edges=n.map((function(t){var e={},n=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(t).forEach((function(r){n.indexOf(r)>-1||(e[r]=t[r])})),e})),e.ticking=!1},e.prototype.execute=function(t){var e=this,n=e.nodes,r=e.edges;if(!e.ticking){var i=e.forceSimulation,o=e.alphaMin,a=e.alphaDecay,u=e.alpha;if(i)t&&(e.clustering&&e.clusterForce&&(e.clusterForce.nodes(n),e.clusterForce.links(r)),i.nodes(n),r&&e.edgeForce?e.edgeForce.links(r):r&&!e.edgeForce&&(f=Ct().id((function(t){return t.id})).links(r),e.edgeStrength&&f.strength(e.edgeStrength),e.linkDistance&&f.distance(e.linkDistance),e.edgeForce=f,i.force("link",f))),e.preventOverlap&&e.overlapProcess(i),i.alpha(u).restart(),this.ticking=!0;else try{var s=Tt();if(e.nodeStrength&&s.strength(e.nodeStrength),i=At().nodes(n),e.clustering){var c=function(){function t(t){return function(){return t}}var e,n=function(t){return t.cluster},r=t(1),i=t(-1),o=t(100),a=t(.1),u=[0,0],s=[],c={},f=[],l=100,h=100,p={none:{x:0,y:0}},v=[],g="force",y=!0,m=.1;function b(t){if(!y)return b;e.tick(),x();for(var r=0,i=s.length,o=void 0,a=t*m;r<i;++r)(o=s[r]).vx+=(p[n(o)].x-o.x)*a,o.vy+=(p[n(o)].y-o.y)*a}function _(){s&&function(){if(s&&s.length){if(void 0===n(s[0]))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");var t,u,p,g,y,m=(t=[],u=[],p={},y=[],g=function(t){var e={};return t.forEach((function(t){var r=n(t);e[r]||(e[r]={count:0,sumforceNodeSize:0})})),t.forEach((function(t){var i=n(t),o=r(t),a=e[i];a.count=a.count+1,a.sumforceNodeSize=a.sumforceNodeSize+Math.PI*(o*o)*1.3,e[i]=a})),e}(s),y=function(t){var e={},r=[];return t.forEach((function(t){var r=function(t){var e=d(t,"source"),r=d(t,"target"),i=n(c[e]),o=n(c[r]);return i<=o?"".concat(i,"~").concat(o):"".concat(o,"~").concat(i)}(t),i=0;void 0!==e[r]&&(i=e[r]),i+=1,e[r]=i})),Object.entries(e).forEach((function(t){var e=t[0],n=t[1],i=e.split("~")[0],o=e.split("~")[1];void 0!==i&&void 0!==o&&r.push({source:i,target:o,count:n})})),r}(f),Object.keys(g).forEach((function(e,n){var r=g[e];t.push({id:e,size:r.count,r:Math.sqrt(r.sumforceNodeSize/Math.PI)}),p[e]=n})),y.forEach((function(t){var e=d(t,"source"),n=d(t,"target"),r=p[e],i=p[n];void 0!==r&&void 0!==i&&u.push({source:r,target:i,count:t.count})})),{nodes:t,links:u});e=At(m.nodes).force("x",Rt(l).strength(.1)).force("y",Pt(h).strength(.1)).force("collide",Mt((function(t){return t.r})).iterations(4)).force("charge",Tt().strength(i)).force("links",Ct(m.nodes.length?m.links:[]).distance(o).strength(a)),v=e.nodes(),x()}}()}function x(){return p={none:{x:0,y:0}},v.forEach((function(t){p[t.id]={x:t.x-u[0],y:t.y-u[1]}})),p}function w(t){c={},t.forEach((function(t){c[t.id]=t}))}return b.initialize=function(t){s=t,_()},b.template=function(t){return arguments.length?(g=t,_(),b):g},b.groupBy=function(t){return arguments.length?"string"==typeof t?(n=function(e){return e[t]},b):(n=t,b):n},b.enableGrouping=function(t){return arguments.length?(y=t,b):y},b.strength=function(t){return arguments.length?(m=t,b):m},b.centerX=function(t){return arguments.length?(l=t,b):l},b.centerY=function(t){return arguments.length?(h=t,b):h},b.nodes=function(t){return arguments.length?(w(t||[]),s=t||[],b):s},b.links=function(t){return arguments.length?(f=t||[],_(),b):f},b.forceNodeSize=function(e){return arguments.length?(r="function"==typeof e?e:t(+e),_(),b):r},b.nodeSize=b.forceNodeSize,b.forceCharge=function(e){return arguments.length?(i="function"==typeof e?e:t(+e),_(),b):i},b.forceLinkDistance=function(e){return arguments.length?(o="function"==typeof e?e:t(+e),_(),b):o},b.forceLinkStrength=function(e){return arguments.length?(a="function"==typeof e?e:t(+e),_(),b):a},b.offset=function(t){return arguments.length?(u=t,b):u},b.getFocis=x,b}();c.centerX(e.center[0]).centerY(e.center[1]).template("force").strength(e.clusterFociStrength),r&&c.links(r),n&&c.nodes(n),c.forceLinkDistance(e.clusterEdgeDistance).forceLinkStrength(e.clusterEdgeStrength).forceCharge(e.clusterNodeStrength).forceNodeSize(e.clusterNodeSize),e.clusterForce=c,i.force("group",c)}if(i.force("center",It(e.center[0],e.center[1])).force("charge",s).alpha(u).alphaDecay(a).alphaMin(o),e.preventOverlap&&e.overlapProcess(i),r){var f=Ct().id((function(t){return t.id})).links(r);e.edgeStrength&&f.strength(e.edgeStrength),e.linkDistance&&f.distance(e.linkDistance),e.edgeForce=f,i.force("link",f)}if(e.workerEnabled&&!Ut()&&(e.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),e.workerEnabled){i.stop();for(var l=function(t){var e=t.alphaMin(),n=t.alphaTarget(),r=t.alpha(),i=Math.log((e-n)/(r-n))/Math.log(1-t.alphaDecay());return Math.ceil(i)}(i),h=1;h<=l;h++)i.tick(),postMessage({nodes:n,currentTick:h,totalTicks:l,type:"LAYOUT_TICK"},void 0);e.ticking=!1}else i.on("tick",(function(){e.tick()})).on("end",(function(){e.ticking=!1,e.onLayoutEnd&&e.onLayoutEnd()})),e.ticking=!0;e.forceSimulation=i,e.ticking=!0}catch(t){e.ticking=!1,console.warn(t)}}},e.prototype.overlapProcess=function(t){var e,n,r=this,a=r.nodeSize,u=r.nodeSpacing,s=r.collideStrength;if(n=o(u)?function(){return u}:x(u)?u:function(){return 0},a)if(x(a))e=function(t){return a(t)+n(t)};else if(i(a)){var c=(a[0]>a[1]?a[0]:a[1])/2;e=function(t){return c+n(t)}}else if(o(a)){var l=a/2;e=function(t){return l+n(t)}}else e=function(){return 10};else e=function(t){return t.size?i(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+n(t):f(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2+n(t):t.size/2+n(t):10+n(t)};t.force("collisionForce",Mt(e).strength(s))},e.prototype.updateCfg=function(t){var e=this;e.ticking&&(e.forceSimulation.stop(),e.ticking=!1),e.forceSimulation=null,Object.assign(e,t)},e.prototype.destroy=function(){var t=this;t.ticking&&(t.forceSimulation.stop(),t.ticking=!1),t.nodes=null,t.edges=null,t.destroyed=!0},e}(t);function Ut(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}var Bt=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function zt(t,e){var n=t.degree,r=e.degree;return n<r?-1:n>r?1:0}var Vt=function(t){function e(e){var n=t.call(this)||this;return n.radius=null,n.nodeSize=void 0,n.startRadius=null,n.endRadius=null,n.startAngle=0,n.endAngle=2*Math.PI,n.clockwise=!0,n.divisions=1,n.ordering=null,n.angleRatio=1,n.nodes=[],n.edges=[],n.nodeMap={},n.degrees=[],n.width=300,n.height=300,n.updateCfg(e),n}return Bt(e,t),e.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},e.prototype.execute=function(){var t,e=this,n=e.nodes,r=e.edges,i=n.length;if(0!==i){e.width||"undefined"==typeof window||(e.width=window.innerWidth),e.height||"undefined"==typeof window||(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);var o=e.center;if(1===i)return n[0].x=o[0],n[0].y=o[1],void(e.onLayoutEnd&&e.onLayoutEnd());var a=e.radius,u=e.startRadius,s=e.endRadius,c=e.divisions,f=e.startAngle,l=e.endAngle,d=e.angleRatio,p=e.ordering,v=e.clockwise,g=e.nodeSpacing,y=e.nodeSize,m=(l-f)/i,b={};n.forEach((function(t,e){b[t.id]=e})),e.nodeMap=b;var _=h(n.length,b,r);if(e.degrees=_,g){var x=E(10,g),w=E(10,y),S=-1/0;n.forEach((function(t){var e=w(t);S<e&&(S=e)}));var A=0;n.forEach((function(t,e){A+=0===e?S||10:(x(t)||0)+(S||10)})),a=A/(2*Math.PI)}else a||u||s?!u&&s?u=s:u&&!s&&(s=u):a=e.height>e.width?e.width/2:e.height/2;var T=m*d,I=[];I="topology"===p?e.topologyOrdering():"topology-directed"===p?e.topologyOrdering(!0):"degree"===p?e.degreeOrdering():n;for(var N=Math.ceil(i/c),O=0;O<i;++O){var C=a;C||null===u||null===s||(C=u+O*(s-u)/(i-1)),C||(C=10+100*O/(i-1));var k=f+O%N*T+2*Math.PI/c*Math.floor(O/N);v||(k=l-O%N*T-2*Math.PI/c*Math.floor(O/N)),I[O].x=o[0]+Math.cos(k)*C,I[O].y=o[1]+Math.sin(k)*C,I[O].weight=_[O].all}return null===(t=e.onLayoutEnd)||void 0===t||t.call(e),{nodes:I,edges:this.edges}}e.onLayoutEnd&&e.onLayoutEnd()},e.prototype.topologyOrdering=function(t){void 0===t&&(t=!1);var e=this,n=e.degrees,r=e.edges,i=e.nodes,o=l(i),a=e.nodeMap,u=[o[0]],s=[i[0]],c=[],f=i.length;c[0]=!0,function(t,e,n,r){t.forEach((function(e,n){t[n].children=[],t[n].parent=[]})),r?e.forEach((function(e){var r=d(e,"source"),i=d(e,"target"),o=0;r&&(o=n[r]);var a=0;i&&(a=n[i]);var u=t[o].children,s=t[a].parent;u.push(t[a].id),s.push(t[o].id)})):e.forEach((function(e){var r=d(e,"source"),i=d(e,"target"),o=0;r&&(o=n[r]);var a=0;i&&(a=n[i]);var u=t[o].children,s=t[a].children;u.push(t[a].id),s.push(t[o].id)}))}(o,r,a,t);var h=0;return o.forEach((function(t,e){if(0!==e)if(e!==f-1&&n[e].all===n[e+1].all&&!function(t,e,n){for(var r=n.length,i=0;i<r;i++){var o=d(n[i],"source"),a=d(n[i],"target");if(t.id===o&&e.id===a||e.id===o&&t.id===a)return!0}return!1}(u[h],t,r)||c[e]){for(var l=u[h].children,p=!1,v=0;v<l.length;v++){var g=a[l[v]];if(n[g].all===n[e].all&&!c[g]){u.push(o[g]),s.push(i[a[o[g].id]]),c[g]=!0,p=!0;break}}for(var y=0;!p&&(c[y]||(u.push(o[y]),s.push(i[a[o[y].id]]),c[y]=!0,p=!0),++y!==f););}else u.push(t),s.push(i[a[t.id]]),c[e]=!0,h++})),s},e.prototype.degreeOrdering=function(){var t=this.nodes,e=[],n=this.degrees;return t.forEach((function(t,r){t.degree=n[r].all,e.push(t)})),e.sort(zt),e},e.prototype.getType=function(){return"circular"},e}(t),Wt=function(t,e){if("next"!==t&&"prev"!==t)return e},Ht=function(t){t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};const Xt=function(){function t(){var t={};t.prev=t,t.next=t.prev,this.shortcut=t}return t.prototype.dequeue=function(){var t=this.shortcut,e=t.prev;if(e&&e!==t)return Ht(e),e},t.prototype.enqueue=function(t){var e=this.shortcut;t.prev&&t.next&&Ht(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e},t.prototype.toString=function(){for(var t=[],e=this.shortcut,n=e.prev;n!==e;)t.push(JSON.stringify(n,Wt)),n=null==n?void 0:n.prev;return"[".concat(t.join(", "),"]")},t}();var qt;function Yt(t,e){var n=t.get(e)||0;t.set(e,n+1)}function Kt(t,e){var n=t.get(e);void 0!==n&&((n-=1)>0?t.set(e,n):t.delete(e))}function Zt(t,e,n,r){var i=String(e),o=String(n);if(!t&&i>o){var a=i;i=o,o=a}return i+qt.EDGE_KEY_DELIM+o+qt.EDGE_KEY_DELIM+(void 0===r?qt.DEFAULT_EDGE_NAME:r)}function $t(t,e,n,r){var i=String(e),o=String(n),a={v:e,w:n};if(!t&&i>o){var u=a.v;a.v=a.w,a.w=u}return void 0!==r&&(a.name=r),a}function Jt(t,e){return Zt(t,e.v,e.w,e.name)}function Qt(t){return"function"==typeof t}!function(t){t.DEFAULT_EDGE_NAME="\0",t.GRAPH_NODE="\0",t.EDGE_KEY_DELIM=""}(qt||(qt={}));var te=function(t){return t.nodes().map((function(e){var n={id:e,value:t.node(e),parent:t.parent(e)};return void 0===n.value&&delete n.value,void 0===n.parent&&delete n.parent,n}))},ee=function(t){return t.edges().map((function(e){var n=t.edge(e),r={v:e.v,w:e.w,value:n,name:e.name};return void 0===r.name&&delete r.name,void 0===r.value&&delete r.value,r}))},ne=function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:te(t),edges:ee(t),value:t.graph()};return void 0===e.value&&delete e.value,e};function re(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ie(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?re(Object(n),!0).forEach((function(e){oe(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function oe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ue(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,r.key,r)}}var se={compound:!1,multigraph:!1,directed:!0},ce=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ae(this,t),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=qt.GRAPH_NODE,this.label=void 0,this.nodeCountNum=0,this.edgeCountNum=0,this.defaultNodeLabelFn=function(){},this.defaultEdgeLabelFn=function(){},this.parentMap=void 0,this.childrenMap=void 0,this.nodesLabelMap=new Map,this.inEdgesMap=new Map,this.outEdgesMap=new Map,this.predecessorsMap=new Map,this.successorsMap=new Map,this.edgesMap=new Map,this.edgesLabelsMap=new Map,this.isDirected=function(){return e.directed},this.isMultigraph=function(){return e.multigraph},this.isCompound=function(){return e.compound},this.setGraph=function(t){return e.label=t,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(t){return Qt(t)?e.defaultNodeLabelFn=t:e.defaultNodeLabelFn=function(){return t},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(t){return e.nodesLabelMap.get(t)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter((function(t){var n;return!(null===(n=e.inEdgesMap.get(t))||void 0===n?void 0:n.size)}))},this.sinks=function(){return e.nodes().filter((function(t){var n;return!(null===(n=e.outEdgesMap.get(t))||void 0===n?void 0:n.size)}))},this.setNodes=function(t,n){return t.map((function(t){return e.setNode(t,n)})),e},this.hasNode=function(t){return e.nodesLabelMap.has(t)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(t){if(e.isCompound()){var n,r=null===(n=e.parentMap)||void 0===n?void 0:n.get(t);if(r!==e.GRAPH_NODE)return r}},this.removeFromParentsChildList=function(t){var n=e.parentMap.get(t);e.childrenMap.get(n).delete(t)},this.setParent=function(t,n){var r,i;e.checkCompound();for(var o=void 0===n?e.GRAPH_NODE:n,a=e.parent(o);a;){if(t===a)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");a=e.parent(a)}n&&e.setNode(n),e.setNode(t),e.removeFromParentsChildList(t),null===(r=e.parentMap)||void 0===r||r.set(t,o);var u=e.childrenMap.get(o);return u.set(t,!0),null===(i=e.childrenMap)||void 0===i||i.set(o,u),e},this.children=function(t){var n=void 0===t?e.GRAPH_NODE:t;if(e.isCompound()){var r,i=null===(r=e.childrenMap)||void 0===r?void 0:r.get(n);return i?Array.from(i.keys()):void 0}return n===e.GRAPH_NODE?e.nodes():t&&e.hasNode(t)?[]:void 0},this.predecessors=function(t){var n=e.predecessorsMap.get(t);return n?Array.from(n.keys()):void 0},this.successors=function(t){var n=e.successorsMap.get(t);return n?Array.from(n.keys()):void 0},this.neighbors=function(t){var n;if(e.hasNode(t))return Array.from(new Set(null===(n=e.predecessors(t))||void 0===n?void 0:n.concat(e.successors(t))))},this.isLeaf=function(t){var n,r;return e.isDirected()?!(null===(r=e.successors(t))||void 0===r?void 0:r.length):!(null===(n=e.neighbors(t))||void 0===n?void 0:n.length)},this.filterNodes=function(n){var r=e.directed,i=e.multigraph,o=e.compound,a=new t({directed:r,multigraph:i,compound:o});return a.setGraph(e.graph()),e.nodes().forEach((function(t){n(t)&&a.setNode(t,e.node(t))})),e.edges().forEach((function(t){a.hasNode(t.v)&&a.hasNode(t.w)&&a.setEdgeObj(t,e.edge(t))})),o&&a.nodes().forEach((function(t){a.setParent(t,function(t){for(var n=e.parent(t);void 0!==n&&!a.hasNode(n);)n=e.parent(n);return n}(t))})),a},this.setDefaultEdgeLabel=function(t){return Qt(t)?e.defaultEdgeLabelFn=t:e.defaultEdgeLabelFn=function(){return t},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(t,n){return e.setEdge(t.v,t.w,n,t.name)},this.setPath=function(t,n){return t.reduce((function(t,r){return e.setEdge(t,r,n),r})),e},this.edgeFromArgs=function(t,n,r){return e.edge({v:t,w:n,name:r})},this.edge=function(t){return e.edgesLabelsMap.get(Jt(e.isDirected(),t))},this.hasEdge=function(t,n,r){return e.edgesLabelsMap.has(Jt(e.isDirected(),{v:t,w:n,name:r}))},this.removeEdgeObj=function(t){var n=t.v,r=t.w,i=t.name;return e.removeEdge(n,r,i)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(t,n){var r=e.inEdgesMap.get(t);if(r)return Array.from(r.values()).filter((function(t){return!n||t.v===n}))},this.outEdges=function(t,n){var r=e.outEdgesMap.get(t);if(r)return Array.from(r.values()).filter((function(t){return!n||t.w===n}))},this.nodeEdges=function(t,n){var r;if(e.hasNode(t))return null===(r=e.inEdges(t,n))||void 0===r?void 0:r.concat(e.outEdges(t,n))},this.toJSON=function(){return ne(e)},this.nodeInDegree=function(t){var n=e.inEdgesMap.get(t);return n?n.size:0},this.nodeOutDegree=function(t){var n=e.outEdgesMap.get(t);return n?n.size:0},this.nodeDegree=function(t){return e.nodeInDegree(t)+e.nodeOutDegree(t)},this.source=function(t){return t.v},this.target=function(t){return t.w};var r=ie(ie({},se),n);this.compound=r.compound,this.directed=r.directed,this.multigraph=r.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}var e,n;return e=t,n=[{key:"setNode",value:function(t,e){var n,r=this.nodesLabelMap,i=this.defaultNodeLabelFn,o=this.isCompound,a=this.parentMap,u=this.childrenMap,s=this.inEdgesMap,c=this.outEdgesMap,f=this.predecessorsMap,l=this.successorsMap;return r.has(t)?(void 0!==e&&r.set(t,e),this):(r.set(t,e||i(t)),o()&&(null==a||a.set(t,this.GRAPH_NODE),null==u||u.set(t,new Map),(null==u?void 0:u.has(this.GRAPH_NODE))||null==u||u.set(this.GRAPH_NODE,new Map),null==u||null===(n=u.get(this.GRAPH_NODE))||void 0===n||n.set(t,!0)),[s,c,f,l].forEach((function(e){return e.set(t,new Map)})),this.nodeCountNum+=1,this)}},{key:"removeNode",value:function(t){var e=this;if(this.hasNode(t)){var n,r,i,o=function(t){e.removeEdge(t.v,t.w,t.name)},a=this.inEdgesMap,u=this.outEdgesMap,s=this.predecessorsMap,c=this.successorsMap,f=this.nodesLabelMap;this.isCompound()&&(this.removeFromParentsChildList(t),null===(n=this.parentMap)||void 0===n||n.delete(t),null===(r=this.children(t))||void 0===r||r.forEach((function(t){return e.setParent(t)})),null===(i=this.childrenMap)||void 0===i||i.delete(t));var l=a.get(t),d=u.get(t);Array.from(l.values()).forEach((function(t){return o(t)})),Array.from(d.values()).forEach((function(t){return o(t)})),f.delete(t),a.delete(t),u.delete(t),s.delete(t),c.delete(t),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(t,e,n,r){var i,o,a=$t(this.isDirected(),t,e,r),u=Jt(this.isDirected(),a),s=a.v,c=a.w;if(this.edgesLabelsMap.has(u))return this.edgesLabelsMap.set(u,n),this;if(void 0!==r&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(c),this.edgesLabelsMap.set(u,n||this.defaultEdgeLabelFn(s,c,r)),Object.freeze(a),this.edgesMap.set(u,a);var f=this.predecessorsMap.get(c),l=this.successorsMap.get(s);return Yt(f,s),Yt(l,c),null===(i=this.inEdgesMap.get(c))||void 0===i||i.set(u,a),null===(o=this.outEdgesMap.get(s))||void 0===o||o.set(u,a),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(t,e,n){var r=Zt(this.isDirected(),t,e,n);if(this.edgesMap.get(r)){var i=$t(this.isDirected(),t,e,n),o=i.v,a=i.w;this.edgesLabelsMap.delete(r),this.edgesMap.delete(r);var u=this.predecessorsMap.get(a),s=this.successorsMap.get(o);Kt(u,o),Kt(s,a),this.inEdgesMap.get(a).delete(r),this.outEdgesMap.get(o).delete(r),this.edgeCountNum-=1}return this}}],n&&ue(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();ce.fromJSON=function(t){var e=new ce(t.options);return void 0!==t.value&&e.setGraph(t.value),t.nodes.forEach((function(t){e.setNode(t.id,t.value),t.parent&&e.setParent(t.id,t.parent)})),t.edges.forEach((function(t){e.setEdge(t.v,t.w,t.value,t.name)})),e},Error;var fe=function t(e,n,r,i,o,a){i.includes(n)||(i.push(n),r||a.push(n),o(n).forEach((function(n){return t(e,n,r,i,o,a)})),r&&a.push(n))};const le=function(t,e,n){var r=Array.isArray(e)?e:[e],i=function(e){return t.isDirected()?t.successors(e):t.neighbors(e)},o=[],a=[];return r.forEach((function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);fe(t,e,"post"===n,a,i,o)})),o};var de=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),he=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return de(e,t),e}(Xt),pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return de(e,t),e}(ce),ve=function(){return 1},ge=function(t,e,n,r,i){var o,a,u=[];return null===(o=t.inEdges(r.v))||void 0===o||o.forEach((function(r){var o=t.edge(r),a=t.node(r.v);i&&u.push({v:r.v,w:r.w,in:0,out:0}),void 0===a.out&&(a.out=0),a.out-=o,ye(e,n,a)})),null===(a=t.outEdges(r.v))||void 0===a||a.forEach((function(r){var i=t.edge(r),o=r.w,a=t.node(o);void 0===a.in&&(a.in=0),a.in-=i,ye(e,n,a)})),t.removeNode(r.v),i?u:void 0},ye=function(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)};const me=function(t,e){var n;if(t.nodeCount()<=1)return[];var r=function(t,e){var n=new pe,r=0,i=0;t.nodes().forEach((function(t){n.setNode(t,{v:t,in:0,out:0})})),t.edges().forEach((function(t){var o=n.edge(t)||0,a=(null==e?void 0:e(t))||1,u=o+a;n.setEdge(t.v,t.w,u),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));for(var o=[],a=i+r+3,u=0;u<a;u++)o.push(new he);var s=r+1;return n.nodes().forEach((function(t){ye(o,s,n.node(t))})),{buckets:o,zeroIdx:s,graph:n}}(t,e||ve);return null===(n=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.nodeCount();){for(;r=a.dequeue();)ge(t,e,n,r);for(;r=o.dequeue();)ge(t,e,n,r);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(r=e[u].dequeue()){i=i.concat(ge(t,e,n,r,!0));break}}return i}(r.graph,r.buckets,r.zeroIdx).map((function(e){return t.outEdges(e.v,e.w)})))||void 0===n?void 0:n.flat()};var be=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return be(e,t),e}(ce),xe=function(t,e,n,r){var i;do{i="".concat(r).concat(Math.random())}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i},we=function(t){var e=new _e({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach((function(n){var r;(null===(r=t.children(n))||void 0===r?void 0:r.length)||e.setNode(n,t.node(n))})),t.edges().forEach((function(n){e.setEdgeObj(n,t.edge(n))})),e},Ee=function(t,e){var n,r,i=Number(t.x),o=Number(t.y),a=Number(e.x)-i,u=Number(e.y)-o,s=Number(t.width)/2,c=Number(t.height)/2;return a||u?(Math.abs(u)*s>Math.abs(a)*c?(u<0&&(c=-c),n=c*a/u,r=c):(a<0&&(s=-s),n=s,r=s*u/a),{x:i+n,y:o+r}):{x:0,y:0}},Se=function(t){for(var e=[],n=Te(t)+1,r=0;r<n;r++)e.push([]);for(t.nodes().forEach((function(n){var r=t.node(n).rank;void 0!==r&&e[r]&&e[r].push(n)})),r=0;r<n;r++)e[r]=e[r].sort((function(e,n){var r,i,o,a;return o=null===(r=t.node(e))||void 0===r?void 0:r.order,a=null===(i=t.node(n))||void 0===i?void 0:i.order,Number(o)-Number(a)}));return e},Ae=function(t,e,n,r){var i={width:0,height:0};return o(n)&&o(r)&&(i.rank=n,i.order=r),xe(t,"border",i,e)},Te=function(t){var e;return t.nodes().forEach((function(n){var r,i=null===(r=t.node(n))||void 0===r?void 0:r.rank;void 0!==i&&(void 0===e||i>e)&&(e=i)})),e||(e=0),e},Ie=function(t,e){var n=Date.now();try{return e()}finally{console.log("".concat(t," time: ").concat(Date.now()-n,"ms"))}},Ne=function(t,e){return e()},Oe=function(t,e){return t.reduce((function(t,n){return e(t)>e(n)?n:t}))};const Ce=function(t){t.graph().dummyChains=[],t.edges().forEach((function(e){return function(t,e){var n=e.v,r=t.node(n).rank,i=e.w,o=t.node(i).rank,a=e.name,u=t.edge(e),s=u.labelRank;if(o!==r+1){t.removeEdgeObj(e);var c,f,l,d=t.graph();for(l=0,++r;r<o;++l,++r)u.points=[],c=xe(t,"edge",f={edgeLabel:u,width:0,height:0,edgeObj:e,rank:r},"_d"),r===s&&(f.width=u.width,f.height=u.height,f.dummy="edge-label",f.labelpos=u.labelpos),t.setEdge(n,c,{weight:u.weight},a),0===l&&(d.dummyChains||(d.dummyChains=[]),d.dummyChains.push(c)),n=c;t.setEdge(n,i,{weight:u.weight},a)}}(t,e)}))};var ke=function(t){var e,n={},r=function e(r){var i,o,a=t.node(r);return n[r]?a.rank:(n[r]=!0,null===(i=t.outEdges(r))||void 0===i||i.forEach((function(n){var r=e(n.w)-t.edge(n).minlen;r&&(void 0===o||r<o)&&(o=r)})),o||(o=0),a.rank=o,o)};null===(e=t.sources())||void 0===e||e.forEach((function(t){return r(t)}))},De=function(t){var e,n,r={},i=function e(i){var o,a,u=t.node(i);return r[i]?u.rank:(r[i]=!0,null===(o=t.outEdges(i))||void 0===o||o.forEach((function(n){var r=e(n.w)-t.edge(n).minlen;r&&(void 0===a||r<a)&&(a=r)})),a||(a=0),(void 0===n||a<n)&&(n=a),u.rank=a,a)};null===(e=t.sources())||void 0===e||e.forEach((function(t){return i(t)})),void 0===n&&(n=0);var o={},a=function e(n,r){var i,a=t.node(n),u=isNaN(a.layer)?r:a.layer;(void 0===a.rank||a.rank<u)&&(a.rank=u),o[n]||(o[n]=!0,null===(i=t.outEdges(n))||void 0===i||i.map((function(n){e(n.w,u+t.edge(n).minlen)})))};t.nodes().forEach((function(e){var r=t.node(e);isNaN(r.layer)?r.rank-=n:a(e,r.layer)}))},Me=function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen},Re=function(t,e){return t.nodes().forEach((function n(r){e.nodeEdges(r).forEach((function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||Me(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()},Pe=function(t,e){return t.nodes().forEach((function n(r){var i;null===(i=e.nodeEdges(r))||void 0===i||i.forEach((function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||void 0===e.node(a).layer&&Me(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()},Ge=function(t,e){return Oe(e.edges(),(function(n){return t.hasNode(n.v)!==t.hasNode(n.w)?Me(e,n):1/0}))},Le=function(t,e,n){t.nodes().forEach((function(t){e.node(t).rank||(e.node(t).rank=0),e.node(t).rank+=n}))},je=function(t,e){return le(t,e,"pre")},Fe=function(t,e){return le(t,e,"post")},Ue=function(t,e){var n=Fe(t,t.nodes());null==(n=null==n?void 0:n.slice(0,(null==n?void 0:n.length)-1))||n.forEach((function(n){Be(t,e,n)}))},Be=function(t,e,n){var r=t.node(n).parent;t.edgeFromArgs(n,r).cutvalue=ze(t,e,n)},ze=function(t,e,n){var r,i=t.node(n).parent,o=!0,a=e.edgeFromArgs(n,i),u=0;return a||(o=!1,a=e.edgeFromArgs(i,n)),u=a.weight,null===(r=e.nodeEdges(n))||void 0===r||r.forEach((function(r){var a=r.v===n,s=a?r.w:r.v;if(s!==i){var c=a===o,f=e.edge(r).weight;if(u+=c?f:-f,Ke(t,n,s)){var l=t.edgeFromArgs(n,s).cutvalue;u+=c?-l:l}}})),u},Ve=function(t,e){void 0===e&&(e=t.nodes()[0]),We(t,{},1,e)},We=function t(e,n,r,i,o){var a,u=r,s=r,c=e.node(i);return n[i]=!0,null===(a=e.neighbors(i))||void 0===a||a.forEach((function(r){n[r]||(s=t(e,n,s,r,i))})),c.low=u,c.lim=s++,o?c.parent=o:delete c.parent,s},He=function(t){return t.edges().find((function(e){return t.edge(e).cutvalue<0}))},Xe=function(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),u=o,s=!1;o.lim>a.lim&&(u=a,s=!0);var c=e.edges().filter((function(e){return s===Ze(t,t.node(e.v),u)&&s!==Ze(t,t.node(e.w),u)}));return Oe(c,(function(t){return Me(e,t)}))},qe=function(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),Ve(t),Ue(t,e),Ye(t,e)},Ye=function(t,e){var n=t.nodes().find((function(t){var n;return!(null===(n=e.node(t))||void 0===n?void 0:n.parent)})),r=je(t,n);null==(r=null==r?void 0:r.slice(1))||r.forEach((function(n){var r=t.node(n).parent,i=e.edgeFromArgs(n,r),o=!1;i||(i=e.edgeFromArgs(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))},Ke=function(t,e,n){return t.hasEdge(e,n)},Ze=function(t,e,n){return n.low<=e.lim&&e.lim<=n.lim};const $e=function(t){var e=function(t){var e=(new _e).setGraph(t.graph());return t.nodes().forEach((function(n){e.setNode(n,t.node(n))})),t.edges().forEach((function(n){var r=e.edgeFromArgs(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e}(t);ke(e);var n,r,i=function(t){var e,n,r=new _e({directed:!1}),i=t.nodes()[0],o=t.nodeCount();for(r.setNode(i,{});Re(r,t)<o;)e=Ge(r,t),n=r.hasNode(e.v)?Me(t,e):-Me(t,e),Le(r,t,n);return r}(e);for(Ve(i),Ue(i,e);n=He(i);)r=Xe(i,e,n),qe(i,e,n,r)};var Je=ke,Qe=function(t){De(t),function(t){var e,n,r=new _e({directed:!1}),i=t.nodes()[0],o=t.nodeCount();for(r.setNode(i,{});Pe(r,t)<o;)e=Ge(r,t),n=r.hasNode(e.v)?Me(t,e):-Me(t,e),Le(r,t,n)}(t)};const tn=function(t){switch(t.graph().ranker){case"network-simplex":!function(t){$e(t)}(t);break;case"tight-tree":default:Qe(t);break;case"longest-path":Je(t)}};var en=function t(e,n,r,i,o,a,u){var s=e.children(u);if(null==s?void 0:s.length){var c=Ae(e,"_bt"),f=Ae(e,"_bb"),l=e.node(u);e.setParent(c,u),l.borderTop=c,e.setParent(f,u),l.borderBottom=f,null==s||s.forEach((function(s){t(e,n,r,i,o,a,s);var l=e.node(s),d=l.borderTop?l.borderTop:s,h=l.borderBottom?l.borderBottom:s,p=l.borderTop?i:2*i,v=d!==h?1:o-a[u]+1;e.setEdge(c,d,{minlen:v,weight:p,nestingEdge:!0}),e.setEdge(h,f,{minlen:v,weight:p,nestingEdge:!0})})),e.parent(u)||e.setEdge(n,c,{weight:0,minlen:o+a[u]})}else u!==n&&e.setEdge(n,u,{weight:0,minlen:r})},nn=function(t){var e,n={},r=function e(r,i){var o=t.children(r);null==o||o.forEach((function(t){return e(t,i+1)})),n[r]=i};return null===(e=t.children())||void 0===e||e.forEach((function(t){return r(t,1)})),n};const rn=function(t){var e,n=xe(t,"root",{},"_root"),r=nn(t),i=Math.max.apply(Math,Object.values(r));Math.abs(i)===1/0&&(i=1);var o=i-1,a=2*o+1;t.graph().nestingRoot=n,t.edges().forEach((function(e){t.edge(e).minlen*=a}));var u=function(t){var e=0;return t.edges().forEach((function(n){e+=t.edge(n).weight})),e}(t)+1;null===(e=t.children())||void 0===e||e.forEach((function(e){en(t,n,a,u,o,r,e)})),t.graph().nodeRankFactor=a};var on=function(t,e,n,r,i,o){var a={rank:o,borderType:e,width:0,height:0},u=i[e][o-1],s=xe(t,"border",a,n);i[e][o]=s,t.setParent(s,r),u&&t.setEdge(u,s,{weight:1})};const an=function(t){var e,n=function e(n){var r=t.children(n),i=t.node(n);if((null==r?void 0:r.length)&&r.forEach((function(t){return e(t)})),i.hasOwnProperty("minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;o+=1)on(t,"borderLeft","_bl",n,i,o),on(t,"borderRight","_br",n,i,o)}};null===(e=t.children())||void 0===e||e.forEach((function(t){return n(t)}))};var un=function(t){t.nodes().forEach((function(e){sn(t.node(e))})),t.edges().forEach((function(e){sn(t.edge(e))}))},sn=function(t){var e=t.width;t.width=t.height,t.height=e},cn=function(t){(null==t?void 0:t.y)&&(t.y=-t.y)},fn=function(t){var e=t.x;t.x=t.y,t.y=e};const ln=function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"bt"!==n&&"rl"!==n||function(t){t.nodes().forEach((function(e){cn(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return cn(t)})),r.hasOwnProperty("y")&&cn(r)}))}(t),"lr"!==n&&"rl"!==n||(function(t){t.nodes().forEach((function(e){fn(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return fn(t)})),r.hasOwnProperty("x")&&fn(r)}))}(t),un(t))},dn=function(t){for(var e={},n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})),r=n.map((function(e){return t.node(e).rank})),i=Math.max.apply(Math,r),o=[],a=0;a<i+1;a++)o.push([]);var u=n.sort((function(e,n){return t.node(e).rank-t.node(n).rank})),s=u.filter((function(e){return void 0!==t.node(e).fixorder})),c=s.sort((function(e,n){return t.node(e).fixorder-t.node(n).fixorder}));return null==c||c.forEach((function(n){isNaN(t.node(n).rank)||o[t.node(n).rank].push(n),e[n]=!0})),null==u||u.forEach((function n(r){var i;if(!e.hasOwnProperty(r)){e[r]=!0;var a=t.node(r);isNaN(a.rank)||o[a.rank].push(r),null===(i=t.successors(r))||void 0===i||i.forEach((function(t){return n(t)}))}})),o};var hn=function(t,e,n){for(var r=function(t,e){return null==t?void 0:t.reduce((function(t,n,r){return t[n]=e[r],t}),{})}(n,n.map((function(t,e){return e}))),i=e.map((function(e){var n,i=null===(n=t.outEdges(e))||void 0===n?void 0:n.map((function(e){return{pos:r[e.w]||0,weight:t.edge(e).weight}}));return null==i?void 0:i.sort((function(t,e){return t.pos-e.pos}))})),o=i.flat().filter((function(t){return void 0!==t})),a=1;a<n.length;)a<<=1;var u=2*a-1;a-=1;var s=Array(u).fill(0,0,u),c=0;return null==o||o.forEach((function(t){if(t){var e=t.pos+a;s[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=s[e+1]),s[e=e-1>>1]+=t.weight;c+=t.weight*n}})),c};const pn=function(t,e){for(var n=0,r=1;r<(null==e?void 0:e.length);r+=1)n+=hn(t,e[r-1],e[r]);return n};const vn=function(t,e,n){var r=function(t){for(var e;t.hasNode(e="_root".concat(Math.random())););return e}(t),i=new _e({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return t.nodes().forEach((function(o){var a,u=t.node(o),s=t.parent(o);(u.rank===e||u.minRank<=e&&e<=u.maxRank)&&(i.setNode(o),i.setParent(o,s||r),null===(a=t[n](o))||void 0===a||a.forEach((function(e){var n=e.v===o?e.w:e.v,r=i.edgeFromArgs(n,o),a=void 0!==r?r.weight:0;i.setEdge(n,o,{weight:t.edge(e).weight+a})})),u.hasOwnProperty("minRank")&&i.setNode(o,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]}))})),i};var gn=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?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0};const yn=function(t,e){var n,r,i,o={};return null==t||t.forEach((function(t,e){o[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};var n=o[t.v];void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)})),null===(n=e.edges())||void 0===n||n.forEach((function(t){var e=o[t.v],n=o[t.w];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(o[t.w]))})),function(t){for(var e,n,r=[],i=function(){var i=t.pop();r.push(i),null===(e=i.in.reverse())||void 0===e||e.forEach((function(t){return(e=i,function(t){t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&gn(e,t)})(t);var e})),null===(n=i.out)||void 0===n||n.forEach((function(e){return(n=i,function(e){e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n}))};null==t?void 0:t.length;)i();var o=r.filter((function(t){return!t.merged})),a=["vs","i","barycenter","weight"];return o.map((function(t){var e={};return null==a||a.forEach((function(n){void 0!==t[n]&&(e[n]=t[n])})),e}))}(null===(i=(r=Object.values(o)).filter)||void 0===i?void 0:i.call(r,(function(t){return!t.indegree})))};var mn=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};const bn=function(t,e,n){var r=function(t,e){var n={lhs:[],rhs:[]};return null==t||t.forEach((function(t){var e;(e=t).hasOwnProperty("fixorder")&&!isNaN(e.fixorder)||e.hasOwnProperty("barycenter")?n.lhs.push(t):n.rhs.push(t)})),n}(t),i=r.lhs,o=r.rhs.sort((function(t,e){return-t.i- -e.i})),a=[],u=0,s=0,c=0;null==i||i.sort(function(t,e){return function(n,r){if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i}}(!!e,!!n)),c=mn(a,o,c),null==i||i.forEach((function(t){var e;c+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,s+=t.weight,c=mn(a,o,c)}));var f={vs:a.flat()};return s&&(f.barycenter=u/s,f.weight=s),f};const _n=function t(e,n,r,i,o){var a,u,s,c,f=e.children(n),l=e.node(n),d=l?l.borderLeft:void 0,h=l?l.borderRight:void 0,p={};d&&(f=null==f?void 0:f.filter((function(t){return t!==d&&t!==h})));var v=function(t,e){return e.map((function(e){var n=t.inEdges(e);if(!(null==n?void 0:n.length))return{v:e};var r={sum:0,weight:0};return null==n||n.forEach((function(e){var n=t.edge(e),i=t.node(e.v);r.sum+=n.weight*i.order,r.weight+=n.weight})),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}))}(e,f||[]);null==v||v.forEach((function(n){var o,a,u;if(null===(o=e.children(n.v))||void 0===o?void 0:o.length){var s=t(e,n.v,r,i);p[n.v]=s,s.hasOwnProperty("barycenter")&&(u=s,void 0!==(a=n).barycenter?(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight):(a.barycenter=u.barycenter,a.weight=u.weight))}}));var g=yn(v,r);(function(t,e){null==t||t.forEach((function(t){var n,r=null===(n=t.vs)||void 0===n?void 0:n.map((function(t){return e[t]?e[t].vs:t}));t.vs=r.flat()}))})(g,p),null===(a=g.filter((function(t){return t.vs.length>0})))||void 0===a||a.forEach((function(t){var n=e.node(t.vs[0]);n&&(t.fixorder=n.fixorder,t.order=n.order)}));var y=bn(g,i,o);if(d&&(y.vs=[d,y.vs,h].flat(),null===(u=e.predecessors(d))||void 0===u?void 0:u.length)){var m=e.node((null===(s=e.predecessors(d))||void 0===s?void 0:s[0])||""),b=e.node((null===(c=e.predecessors(h))||void 0===c?void 0:c[0])||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y};var xn=function(t,e,n){return e.map((function(e){return vn(t,e,n)}))},wn=function(t,e,n){var r=new _e;null==t||t.forEach((function(t){for(var i,o=t.graph().root,a=_n(t,o,r,e,n),u=0;u<(null===(i=a.vs)||void 0===i?void 0:i.length);u++){var s=t.node(a.vs[u]);s&&(s.order=u)}!function(t,e,n){var r,i={};null==n||n.forEach((function(n){for(var o,a,u=t.parent(n);u;){if((o=t.parent(u))?(a=i[o],i[o]=u):(a=r,r=u),a&&a!==u)return void e.setEdge(a,u);u=o}}))}(t,r,a.vs)}))},En=function(t,e){null==e||e.forEach((function(e){null==e||e.forEach((function(e,n){t.node(e).order=n}))}))};var Sn=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),An=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Sn(e,t),e}(ce),Tn=function(t,e){var n,r;if(null===(n=t.node(e))||void 0===n?void 0:n.dummy)return null===(r=t.predecessors(e))||void 0===r?void 0:r.find((function(e){return t.node(e).dummy}))},In=function(t,e,n){var r=e,i=n;if(r>i){var o=r;r=i,i=o}var a=t[r];a||(t[r]=a={}),a[i]=!0},Nn=function(t,e,n){var r=e;return r>n&&(r=n),!!t[r]},On=function(t,e,n,r){var i=new An,o=t.graph(),a=Cn(o.nodesep,o.edgesep,r);return null==e||e.forEach((function(e){var r;null==e||e.forEach((function(e){var o=n[e];if(i.setNode(o),r){var u=n[r],s=i.edgeFromArgs(u,o);i.setEdge(u,o,Math.max(a(t,e,r),s||0))}r=e}))})),i};var Cn=function(t,e,n){return function(r,i,o){var a,u=r.node(i),s=r.node(o),c=0;if(c+=u.width/2,u.hasOwnProperty("labelpos"))switch((u.labelpos||"").toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(c+=n?a:-a),a=0,c+=(u.dummy?e:t)/2,c+=(s.dummy?e:t)/2,c+=s.width/2,s.labelpos)switch((s.labelpos||"").toLowerCase()){case"l":a=s.width/2;break;case"r":a=-s.width/2}return a&&(c+=n?a:-a),a=0,c}},kn=function(t,e){return t.node(e).width||0},Dn=function(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)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};const Mn=function(t){var e,n=we(t);!function(t){var e=Se(t),n=t.graph().ranksep,r=0;null==e||e.forEach((function(e){var i=e.map((function(e){return t.node(e).height})),o=Math.max.apply(Math,Dn(Dn([],i,!1),[0],!1));null==e||e.forEach((function(e){t.node(e).y=r+o/2})),r+=o+n}))}(n);var r=function(t){var e=Se(t),n=Object.assign(function(t,e){var n={};return(null==e?void 0:e.length)&&e.reduce((function(e,r){var i=0,o=0,a=e.length,u=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach((function(e,s){var c,f=Tn(t,e),l=f?t.node(f).order:a;(f||e===u)&&(null===(c=r.slice(o,s+1))||void 0===c||c.forEach((function(e){var r;null===(r=t.predecessors(e))||void 0===r||r.forEach((function(r){var o,a=t.node(r),u=a.order;!(u<i||l<u)||a.dummy&&(null===(o=t.node(e))||void 0===o?void 0:o.dummy)||In(n,r,e)}))})),o=s+1,i=l)})),r})),n}(t,e),function(t,e){var n={},r=function(e,r,i,o,a){for(var u,s=[],c=r;c<i;c++)s.push(c);s.forEach((function(r){var i,s;u=e[r],(null===(i=t.node(u))||void 0===i?void 0:i.dummy)&&(null===(s=t.predecessors(u))||void 0===s||s.forEach((function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&In(n,e,u)})))}))};return(null==e?void 0:e.length)&&e.reduce((function(e,n){var i,o=-1,a=0;return null==n||n.forEach((function(u,s){var c;if("border"===(null===(c=t.node(u))||void 0===c?void 0:c.dummy)){var f=t.predecessors(u)||[];f.length&&(i=t.node(f[0]).order,r(n,a,s,o,i),a=s,o=i)}r(n,a,n.length,i,e.length)})),n})),n}(t,e)),r={},i=[];["u","d"].forEach((function(o){i="u"===o?e:Object.values(e).reverse(),["l","r"].forEach((function(e){"r"===e&&(i=i.map((function(t){return Object.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),u=function(t,e,n,r){var i={},o={},a={};return null==e||e.forEach((function(t){null==t||t.forEach((function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),null==e||e.forEach((function(t){var e=-1;null==t||t.forEach((function(t){var u=r(t);if(u.length)for(var s=((u=u.sort((function(t,e){return a[t]-a[e]}))).length-1)/2,c=Math.floor(s),f=Math.ceil(s);c<=f;++c){var l=u[c];o[t]===t&&e<a[l]&&!Nn(n,t,l)&&(o[l]=t,o[t]=i[t]=i[l],e=a[l])}}))})),{root:i,align:o}}(0,i,n,a),s=function(t,e,n,r,i){var o,a={},u=On(t,e,n,i),s=i?"borderLeft":"borderRight",c=function(t,e){for(var n=u.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()};return c((function(t){a[t]=(u.inEdges(t)||[]).reduce((function(t,e){return Math.max(t,(a[e.v]||0)+u.edge(e))}),0)}),u.predecessors.bind(u)),c((function(e){var n=(u.outEdges(e)||[]).reduce((function(t,e){return Math.min(t,(a[e.w]||0)-u.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(a[e]=Math.max(a[e],n))}),u.successors.bind(u)),null===(o=Object.values(r))||void 0===o||o.forEach((function(t){a[t]=a[n[t]]})),a}(t,i,u.root,u.align,"r"===e);"r"===e&&Object.keys(s).forEach((function(t){return s[t]=-s[t]})),r[o+e]=s}))}));var o=function(t,e){return Oe(Object.values(e),(function(e){var n,r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach((function(n){var o=e[n],a=kn(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)})),r-i}))}(t,r);return o&&function(t,e){var n=Object.values(e),r=Math.min.apply(Math,n),i=Math.max.apply(Math,n);["u","d"].forEach((function(n){["l","r"].forEach((function(o){var a,u=n+o,s=t[u];if(s!==e){var c=Object.values(s);(a="l"===o?r-Math.min.apply(Math,c):i-Math.max.apply(Math,c))&&(t[u]={},Object.keys(s).forEach((function(e){t[u][e]=s[e]+a})))}}))}))}(r,o),function(t,e){var n={};return Object.keys(t.ul).forEach((function(r){if(e)n[r]=t[e.toLowerCase()][r];else{var i=Object.values(t).map((function(t){return t[r]}));n[r]=(i[0]+i[1])/2}})),n}(r,t.graph().align)}(n);null===(e=Object.keys(r))||void 0===e||e.forEach((function(t){n.node(t).x=r[t]}))};var Rn=function(){return Rn=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},Rn.apply(this,arguments)},Pn=function(t,e,n){e(" removeSelfEdges",(function(){Jn(t)})),e(" acyclic",(function(){!function(t){var e="greedy"===t.graph().acyclicer?me(t,function(t){return function(e){var n;return(null===(n=t.edge(e))||void 0===n?void 0:n.weight)||1}}(t)):function(t){var e=[],n={},r={};return t.nodes().forEach((function i(o){var a;r[o]||(r[o]=!0,n[o]=!0,null===(a=t.outEdges(o))||void 0===a||a.forEach((function(t){n[t.w]?e.push(t):i(t.w)})),delete n[o])})),e}(t);null==e||e.forEach((function(e){var n=t.edge(e);t.removeEdgeObj(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,"rev-".concat(Math.random()))}))}(t)})),e(" nestingGraph.run",(function(){rn(t)})),e(" rank",(function(){tn(we(t))})),e(" injectEdgeLabelProxies",(function(){Wn(t)})),e(" removeEmptyRanks",(function(){!function(t){var e=t.nodes(),n=e.filter((function(e){var n;return void 0!==(null===(n=t.node(e))||void 0===n?void 0:n.rank)})).map((function(e){return t.node(e).rank})),r=Math.min.apply(Math,n),i=[];e.forEach((function(e){var n,o=((null===(n=t.node(e))||void 0===n?void 0:n.rank)||0)-r;i[o]||(i[o]=[]),i[o].push(e)}));for(var o=0,a=t.graph().nodeRankFactor||0,u=0;u<i.length;u++){var s=i[u];void 0===s?u%a!=0&&(o-=1):o&&(null==s||s.forEach((function(e){var n=t.node(e);n&&(n.rank=n.rank||0,n.rank+=o)})))}}(t)})),e(" nestingGraph.cleanup",(function(){!function(t){var e=t.graph();e.nestingRoot&&t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach((function(e){t.edge(e).nestingEdge&&t.removeEdgeObj(e)}))}(t)})),e(" normalizeRanks",(function(){!function(t){var e=t.nodes().filter((function(e){var n;return void 0!==(null===(n=t.node(e))||void 0===n?void 0:n.rank)})).map((function(e){return t.node(e).rank})),n=Math.min.apply(Math,e);t.nodes().forEach((function(e){var r=t.node(e);r.hasOwnProperty("rank")&&n!==1/0&&(r.rank-=n)}))}(t)})),e(" assignRankMinMax",(function(){Hn(t)})),e(" removeEdgeLabelProxies",(function(){Xn(t)})),e(" normalize.run",(function(){Ce(t)})),e(" parentDummyChains",(function(){!function(t){var e,n=function(t){var e,n={},r=0;return null===(e=t.children())||void 0===e||e.forEach((function e(i){var o,a=r;null===(o=t.children(i))||void 0===o||o.forEach(e),n[i]={low:a,lim:r++}})),n}(t);null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var r,i,o=e,a=t.node(o),u=a.edgeObj;if(u)for(var s=function(t,e,n,r){var i,o,a=[],u=[],s=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>s||c>e[i].lim));for(o=i,i=r;i&&i!==o;)u.push(i),i=t.parent(i);return{lca:o,path:a.concat(u.reverse())}}(t,n,u.v,u.w),c=s.path,f=s.lca,l=0,d=c[l],h=!0;o!==u.w;){if(a=t.node(o),h){for(;d!==f&&(null===(r=t.node(d))||void 0===r?void 0:r.maxRank)<a.rank;)d=c[++l];d===f&&(h=!1)}if(!h){for(;l<c.length-1&&(null===(i=t.node(c[l+1]))||void 0===i?void 0:i.minRank)<=a.rank;)l++;d=c[l]}t.setParent(o,d),o=t.successors(o)[0]}}))}(t)})),e(" addBorderSegments",(function(){an(t)})),n&&n.keepNodeOrder&&e(" initDataOrder",(function(){!function(t,e){var n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})),r=n.map((function(e){return t.node(e).rank})),i=Math.max.apply(Math,r),o=Array(i+1).fill([]);null==e||e.forEach((function(e){var n=t.node(e);n&&!(null==n?void 0:n.dummy)&&(isNaN(n.rank)||(n.fixorder=o[n.rank].length,o[n.rank].push(e)))}))}(t,n.nodeOrder)})),e(" order",(function(){!function(t){for(var e=Te(t),n=[],r=[],i=1;i<e+1;i++)n.push(i);for(i=e-1;i>-1;i--)r.push(i);var o=xn(t,n,"inEdges"),a=xn(t,r,"outEdges"),u=dn(t);En(t,u);for(var s,c=Number.POSITIVE_INFINITY,f=(i=0,0);f<4;++i,++f)wn(i%2?o:a,i%4>=2),u=Se(t),(d=pn(t,u))<c&&(f=0,s=l(u),c=d);for(u=dn(t),En(t,u),i=0,f=0;f<4;++i,++f){var d;wn(i%2?o:a,i%4>=2,!0),u=Se(t),(d=pn(t,u))<c&&(f=0,s=l(u),c=d)}En(t,s)}(t)})),e(" insertSelfEdges",(function(){Qn(t)})),e(" adjustCoordinateSystem",(function(){!function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"lr"!==n&&"rl"!==n||un(t)}(t)})),e(" position",(function(){Mn(t)})),e(" positionSelfEdges",(function(){tr(t)})),e(" removeBorderNodes",(function(){$n(t)})),e(" normalize.undo",(function(){!function(t){var e;null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var n,r=t.node(e),i=r.edgeLabel;r.edgeObj&&t.setEdgeObj(r.edgeObj,i);for(var o=e;r.dummy;)n=t.successors(o)[0],t.removeNode(o),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),o=n,r=t.node(o)}))}(t)})),e(" fixupEdgeLabelCoords",(function(){Kn(t)})),e(" undoCoordinateSystem",(function(){ln(t)})),e(" translateGraph",(function(){qn(t)})),e(" assignNodeIntersects",(function(){Yn(t)})),e(" reversePoints",(function(){Zn(t)})),e(" acyclic.undo",(function(){!function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.reversed){t.removeEdgeObj(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}(t)}))},Gn=["nodesep","edgesep","ranksep","marginx","marginy"],Ln={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},jn=["acyclicer","ranker","rankdir","align"],Fn=["width","height","layer","fixorder"],Un={width:0,height:0},Bn=["minlen","weight","width","height","labeloffset"],zn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Vn=["labelpos"],Wn=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={e,rank:(t.node(e.w).rank-r.rank)/2+r.rank};xe(t,"edge-proxy",i,"_ep")}}))},Hn=function(t){var e=0;t.nodes().forEach((function(n){var r,i,o=t.node(n);o.borderTop&&(o.minRank=null===(r=t.node(o.borderTop))||void 0===r?void 0:r.rank,o.maxRank=null===(i=t.node(o.borderBottom))||void 0===i?void 0:i.rank,e=Math.max(e,o.maxRank||-1/0))})),t.graph().maxRank=e},Xn=function(t){t.nodes().forEach((function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))},qn=function(t){var e,n,r=0,i=0,o=t.graph(),a=o.marginx||0,u=o.marginy||0,s=function(t){if(t){var o=t.x,a=t.y,u=t.width,s=t.height;isNaN(o)||isNaN(u)||(void 0===e&&(e=o-u/2),e=Math.min(e,o-u/2),r=Math.max(r,o+u/2)),isNaN(a)||isNaN(s)||(void 0===n&&(n=a-s/2),n=Math.min(n,a-s/2),i=Math.max(i,a+s/2))}};t.nodes().forEach((function(e){s(t.node(e))})),t.edges().forEach((function(e){var n=t.edge(e);(null==n?void 0:n.hasOwnProperty("x"))&&s(n)})),e-=a,n-=u,t.nodes().forEach((function(r){var i=t.node(r);i&&(i.x-=e,i.y-=n)})),t.edges().forEach((function(r){var i,o=t.edge(r);null===(i=o.points)||void 0===i||i.forEach((function(t){t.x-=e,t.y-=n})),o.hasOwnProperty("x")&&(o.x-=e),o.hasOwnProperty("y")&&(o.y-=n)})),o.width=r-e+a,o.height=i-n+u},Yn=function(t){t.edges().forEach((function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(Ee(o,n)),i.points.push(Ee(a,r))}))},Kn=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(null==n?void 0:n.hasOwnProperty("x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))},Zn=function(t){t.edges().forEach((function(e){var n,r=t.edge(e);r.reversed&&(null===(n=r.points)||void 0===n||n.reverse())}))},$n=function(t){t.nodes().forEach((function(e){var n,r,i;if(null===(n=t.children(e))||void 0===n?void 0:n.length){var o=t.node(e),a=t.node(o.borderTop),u=t.node(o.borderBottom),s=t.node(o.borderLeft[(null===(r=o.borderLeft)||void 0===r?void 0:r.length)-1]),c=t.node(o.borderRight[(null===(i=o.borderRight)||void 0===i?void 0:i.length)-1]);o.width=Math.abs((null==c?void 0:c.x)-(null==s?void 0:s.x))||10,o.height=Math.abs((null==u?void 0:u.y)-(null==a?void 0:a.y))||10,o.x=((null==s?void 0:s.x)||0)+o.width/2,o.y=((null==a?void 0:a.y)||0)+o.height/2}})),t.nodes().forEach((function(e){var n;"border"===(null===(n=t.node(e))||void 0===n?void 0:n.dummy)&&t.removeNode(e)}))},Jn=function(t){t.edges().forEach((function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdgeObj(e)}}))},Qn=function(t){var e=Se(t);null==e||e.forEach((function(e){var n=0;null==e||e.forEach((function(e,r){var i,o=t.node(e);o.order=r+n,null===(i=o.selfEdges)||void 0===i||i.forEach((function(e){xe(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete o.selfEdges}))}))},tr=function(t){t.nodes().forEach((function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,u=r.height/2;t.setEdgeObj(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{y:o,x:i+a},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],n.label.x=n.x,n.label.y=n.y}}))},er=function(t,e){var n={};return null==e||e.forEach((function(e){void 0!==t[e]&&(n[e]=+t[e])})),n},nr=function(t){void 0===t&&(t={});var e={};return Object.keys(t).forEach((function(n){e[n.toLowerCase()]=t[n]})),e};const rr=function(t,e){var n=e&&e.debugTiming?Ie:Ne;n("layout",(function(){e&&!e.keepNodeOrder&&e.prevGraph&&n(" inheritOrder",(function(){var n,r;n=t,r=e.prevGraph,n.nodes().forEach((function(t){var e=n.node(t),i=r.node(t);void 0!==i?(e.fixorder=i._order,delete i._order):delete e.fixorder}))}));var r=n(" buildLayoutGraph",(function(){return function(t){var e=new _e({multigraph:!0,compound:!0}),n=nr(t.graph()),r={};return null==jn||jn.forEach((function(t){void 0!==n[t]&&(r[t]=n[t])})),e.setGraph(Object.assign({},Ln,er(n,Gn),r)),t.nodes().forEach((function(n){var r=nr(t.node(n)),i=Rn(Rn({},Un),r),o=er(i,Fn);e.setNode(n,o),e.setParent(n,t.parent(n))})),t.edges().forEach((function(n){var r=nr(t.edge(n)),i={};null==Vn||Vn.forEach((function(t){void 0!==r[t]&&(i[t]=r[t])})),e.setEdgeObj(n,Object.assign({},zn,er(r,Bn),i))})),e}(t)}));e&&!1===e.edgeLabelSpace||n(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,t.nodes().forEach((function(e){var n=t.node(e);isNaN(n.layer)||n.layer||(n.layer=0)})),t.edges().forEach((function(n){var r,i=t.edge(n);i.minlen*=2,"c"!==(null===(r=i.labelpos)||void 0===r?void 0:r.toLowerCase())&&("TB"===e.rankdir||"BT"===e.rankdir?i.width+=i.labeloffset:i.height+=i.labeloffset)}))}(r)}));try{n(" runLayout",(function(){Pn(r,n,e)}))}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void 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}n(" updateInputGraph",(function(){!function(t,e){t.nodes().forEach((function(n){var r,i=t.node(n);if(i){var o=e.node(n);i.x=o.x,i.y=o.y,i._order=o.order,i._rank=o.rank,(null===(r=e.children(n))||void 0===r?void 0:r.length)&&(i.width=o.width,i.height=o.height)}})),t.edges().forEach((function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,i.hasOwnProperty("x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,r)}))}))};var ir=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),or=function(t){function n(e){var n=t.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.ranksep=50,n.controlPoints=!1,n.sortByCombo=!1,n.edgeLabelSpace=!0,n.radial=!1,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.layoutNode=function(t){var e=n.nodes.find((function(e){return e.id===t}));return!e||!1!==e.layout},n.updateCfg(e),n}return ir(n,t),n.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,nodeSize:void 0,nodesepFunc:void 0,ranksepFunc:void 0,nodesep:50,ranksep:50,controlPoints:!1,radial:!1,focusNode:null}},n.prototype.execute=function(){var t,n,r=this,a=this,u=a.nodes,s=a.nodeSize,c=a.rankdir,l=a.combos,h=a.begin,p=a.radial;if(u){var v,g=a.edges||[],y=new _e({multigraph:!0,compound:!0});v=s?i(s)?function(){return s}:function(){return[s,s]}:function(t){return t.size?i(t.size)?t.size:f(t.size)?[t.size.width||40,t.size.height||40]:[t.size,t.size]:[40,40]};var m=w(a.ranksep,50,a.ranksepFunc),b=w(a.nodesep,50,a.nodesepFunc),_=b,x=m;"LR"!==c&&"RL"!==c||(_=m,x=b),y.setDefaultEdgeLabel((function(){return{}})),y.setGraph(a);var E={};this.sortByCombo&&l&&l.forEach((function(t){t.parentId&&(E[t.parentId]||(E[t.parentId]=!0,y.setNode(t.parentId,{})),y.setParent(t.id,t.parentId))})),u.filter((function(t){return!1!==t.layout})).forEach((function(t){var e=v(t),n=x(t),i=_(t),a=e[0]+2*i,u=e[1]+2*n,s=t.layer;o(s)?y.setNode(t.id,{width:a,height:u,layer:s}):y.setNode(t.id,{width:a,height:u}),r.sortByCombo&&t.comboId&&(E[t.comboId]||(E[t.comboId]=!0,y.setNode(t.comboId,{})),y.setParent(t.id,t.comboId))})),g.forEach((function(t){var e=d(t,"source"),n=d(t,"target");r.layoutNode(e)&&r.layoutNode(n)&&y.setEdge(e,n,{weight:t.weight||1})}));var S=void 0;(null===(t=a.preset)||void 0===t?void 0:t.nodes)&&(S=new _e({multigraph:!0,compound:!0}),a.preset.nodes.forEach((function(t){null==S||S.setNode(t.id,t)}))),rr(y,{prevGraph:S,edgeLabelSpace:a.edgeLabelSpace,keepNodeOrder:Boolean(!!a.nodeOrder),nodeOrder:a.nodeOrder});var A=[0,0];if(h){var T=1/0,I=1/0;y.nodes().forEach((function(t){var e=y.node(t);T>e.x&&(T=e.x),I>e.y&&(I=e.y)})),y.edges().forEach((function(t){var e;null===(e=y.edge(t).points)||void 0===e||e.forEach((function(t){T>t.x&&(T=t.x),I>t.y&&(I=t.y)}))})),A[0]=h[0]-T,A[1]=h[1]-I}if(p){var N=this,O=N.focusNode,C=N.ranksep,k=N.getRadialPos,D=e(O)?O:null==O?void 0:O.id,M=D?null===(n=y.node(D))||void 0===n?void 0:n._rank:0,R=[],P="LR"===c||"RL"===c,G=P?"y":"x",L=P?"height":"width",j=1/0,F=-1/0;y.nodes().forEach((function(t){var e=y.node(t),n=u.findIndex((function(e){return e.id===t}));if(u[n]){var r=b(u[n]);if(0===M)R[e._rank]||(R[e._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),R[e._rank].nodes.push(t),R[e._rank].totalWidth+=2*r+e[L],R[e._rank].maxSize<Math.max(e.width,e.height)&&(R[e._rank].maxSize=Math.max(e.width,e.height));else{var i=e._rank-M;if(0===i)R[i]||(R[i]={nodes:[],totalWidth:0,maxSize:-1/0}),R[i].nodes.push(t),R[i].totalWidth+=2*r+e[L],R[i].maxSize<Math.max(e.width,e.height)&&(R[i].maxSize=Math.max(e.width,e.height));else{var o=Math.abs(i);R[o]||(R[o]={left:[],right:[],totalWidth:0,maxSize:-1/0}),R[o].totalWidth+=2*r+e[L],R[o].maxSize<Math.max(e.width,e.height)&&(R[o].maxSize=Math.max(e.width,e.height)),i<0?R[o].left.push(t):R[o].right.push(t)}}var a=e[G]-e[L]/2-r,s=e[G]+e[L]/2+r;a<j&&(j=a),s>F&&(F=s)}}));var U=C||50,B={},z=(F-j)/.9,V=[.5*(j+F-z),.5*(j+F+z)],W=function(t,e,n,r){void 0===n&&(n=-1/0),void 0===r&&(r=[0,1]);var i=n;return t.forEach((function(t){var n=y.node(t);B[t]=e;var o=k(n[G],V,z,e,r),a=o.x,s=o.y,c=u.findIndex((function(e){return e.id===t}));if(u[c]){u[c].x=a+A[0],u[c].y=s+A[1],u[c]._order=n._order;var f=m(u[c]);i<f&&(i=f)}})),i},H=!0;R.forEach((function(t){var e,n,r,i,o,a,s;if((null===(e=null==t?void 0:t.nodes)||void 0===e?void 0:e.length)||(null===(n=null==t?void 0:t.left)||void 0===n?void 0:n.length)||(null===(r=null==t?void 0:t.right)||void 0===r?void 0:r.length)){if(H&&1===t.nodes.length){var c=u.findIndex((function(e){return e.id===t.nodes[0]}));return u[c].x=A[0],u[c].y=A[1],B[t.nodes[0]]=0,U=m(u[c]),void(H=!1)}U=Math.max(U,t.totalWidth/(2*Math.PI));var f=-1/0;if(0===M||(null===(i=t.nodes)||void 0===i?void 0:i.length))f=W(t.nodes,U,f,[0,1]);else{var l=(null===(o=t.left)||void 0===o?void 0:o.length)/((null===(a=t.left)||void 0===a?void 0:a.length)+(null===(s=t.right)||void 0===s?void 0:s.length));f=W(t.left,U,f,[0,l]),f=W(t.right,U,f,[l+.05,1])}U+=f,H=!1,t.maxSize}})),y.edges().forEach((function(t){var e,n,r,i=y.edge(t),o=g.findIndex((function(e){var n=d(e,"source"),r=d(e,"target");return n===t.v&&r===t.w}));if(a.edgeLabelSpace&&a.controlPoints&&"loop"!==g[o].type){var u="x"===G?"y":"x",s=null===(e=null==i?void 0:i.points)||void 0===e?void 0:e.slice(1,i.points.length-1),c=[],f=null===(n=y.node(t.v))||void 0===n?void 0:n[u],l=f-(null===(r=y.node(t.w))||void 0===r?void 0:r[u]),h=B[t.v],p=h-B[t.w];null==s||s.forEach((function(t){var e=(t[u]-f)/l*p+h,n=k(t[G],V,z,e);c.push({x:n.x+A[0],y:n.y+A[1]})})),g[o].controlPoints=c}}))}else y.nodes().forEach((function(t){var e=y.node(t),n=u.findIndex((function(e){return e.id===t}));u[n]&&(u[n].x=e.x+A[0],u[n].y=e.y+A[1],u[n]._order=e._order)})),y.edges().forEach((function(t){var e,n=y.edge(t),r=g.findIndex((function(e){var n=d(e,"source"),r=d(e,"target");return n===t.v&&r===t.w}));a.edgeLabelSpace&&a.controlPoints&&"loop"!==g[r].type&&(g[r].controlPoints=null===(e=null==n?void 0:n.points)||void 0===e?void 0:e.slice(1,n.points.length-1),g[r].controlPoints.forEach((function(t){t.x+=A[0],t.y+=A[1]})))}));return a.onLayoutEnd&&a.onLayoutEnd(),{nodes:u,edges:g}}},n.prototype.getRadialPos=function(t,e,n,r,i){void 0===i&&(i=[0,1]);var o=(t-e[0])/n,a=2*(o=o*(i[1]-i[0])+i[0])*Math.PI;return{x:Math.cos(a)*r,y:Math.sin(a)*r}},n.prototype.getType=function(){return"dagre"},n}(t);const ar={graph:{meta:{rankDir:"TB",nodeSep:50,rankSep:50,edgeSep:5,align:void 0}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};function ur(t={},e=ar){var n,r,i,o;const a=JSON.parse(JSON.stringify(e)),u=(null===(n=null==t?void 0:t.graph)||void 0===n?void 0:n.meta)||{},s=(null===(r=null==t?void 0:t.subScene)||void 0===r?void 0:r.meta)||{},c=(null===(i=null==t?void 0:t.nodeSize)||void 0===i?void 0:i.meta)||{},f=(null===(o=null==t?void 0:t.nodeSize)||void 0===o?void 0:o.node)||{},l=a.nodeSize.bridge;return{graph:{meta:Object.assign(a.graph.meta,u)},subScene:{meta:Object.assign(a.subScene.meta,s)},nodeSize:{meta:Object.assign(a.nodeSize.meta,c),node:Object.assign(a.nodeSize.node,f),bridge:l}}}function sr(t){return`◬${t}◬`}const cr=sr("ROOT"),fr=sr("BRIDGE_GRAPH");var lr,dr,hr,pr;!function(t){t[t.META=0]="META",t[t.NODE=1]="NODE",t[t.BRIDGE=2]="BRIDGE"}(lr||(lr={})),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE",t[t.UNSPECIFIED=2]="UNSPECIFIED"}(dr||(dr={})),function(t){t[t.META=0]="META",t[t.CORE=1]="CORE",t[t.BRIDGE=2]="BRIDGE"}(hr||(hr={})),function(t){t[t.META=0]="META",t[t.OP=1]="OP",t[t.SERIES=2]="SERIES"}(pr||(pr={}));var vr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function gr(t,e){return t(e={exports:{}},e.exports),e.exports}var yr=function(t,e){return t===e||t!=t&&e!=e},mr=function(t,e){for(var n=t.length;n--;)if(yr(t[n][0],e))return n;return-1},br=Array.prototype.splice;function _r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}_r.prototype.clear=function(){this.__data__=[],this.size=0},_r.prototype.delete=function(t){var e=this.__data__,n=mr(e,t);return!(n<0||(n==e.length-1?e.pop():br.call(e,n,1),--this.size,0))},_r.prototype.get=function(t){var e=this.__data__,n=mr(e,t);return n<0?void 0:e[n][1]},_r.prototype.has=function(t){return mr(this.__data__,t)>-1},_r.prototype.set=function(t,e){var n=this.__data__,r=mr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var xr,wr=_r,Er="object"==typeof vr&&vr&&vr.Object===Object&&vr,Sr="object"==typeof self&&self&&self.Object===Object&&self,Ar=Er||Sr||Function("return this")(),Tr=Ar.Symbol,Ir=Object.prototype,Nr=Ir.hasOwnProperty,Or=Ir.toString,Cr=Tr?Tr.toStringTag:void 0,kr=Object.prototype.toString,Dr=Tr?Tr.toStringTag:void 0,Mr=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Dr&&Dr in Object(t)?function(t){var e=Nr.call(t,Cr),n=t[Cr];try{t[Cr]=void 0;var r=!0}catch(t){}var i=Or.call(t);return r&&(e?t[Cr]=n:delete t[Cr]),i}(t):function(t){return kr.call(t)}(t)},Rr=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Pr=function(t){if(!Rr(t))return!1;var e=Mr(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Gr=Ar["__core-js_shared__"],Lr=(xr=/[^.]+$/.exec(Gr&&Gr.keys&&Gr.keys.IE_PROTO||""))?"Symbol(src)_1."+xr:"",jr=Function.prototype.toString,Fr=function(t){if(null!=t){try{return jr.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Ur=/^\[object .+?Constructor\]$/,Br=Function.prototype,zr=Object.prototype,Vr=Br.toString,Wr=zr.hasOwnProperty,Hr=RegExp("^"+Vr.call(Wr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xr=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Rr(t)||function(t){return!!Lr&&Lr in t}(t))&&(Pr(t)?Hr:Ur).test(Fr(t))}(n)?n:void 0},qr=Xr(Ar,"Map"),Yr=Xr(Object,"create"),Kr=Object.prototype.hasOwnProperty,Zr=Object.prototype.hasOwnProperty;function $r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}$r.prototype.clear=function(){this.__data__=Yr?Yr(null):{},this.size=0},$r.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$r.prototype.get=function(t){var e=this.__data__;if(Yr){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Kr.call(e,t)?e[t]:void 0},$r.prototype.has=function(t){var e=this.__data__;return Yr?void 0!==e[t]:Zr.call(e,t)},$r.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Yr&&void 0===e?"__lodash_hash_undefined__":e,this};var Jr=$r,Qr=function(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map};function ti(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ti.prototype.clear=function(){this.size=0,this.__data__={hash:new Jr,map:new(qr||wr),string:new Jr}},ti.prototype.delete=function(t){var e=Qr(this,t).delete(t);return this.size-=e?1:0,e},ti.prototype.get=function(t){return Qr(this,t).get(t)},ti.prototype.has=function(t){return Qr(this,t).has(t)},ti.prototype.set=function(t,e){var n=Qr(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};var ei=ti;function ni(t){var e=this.__data__=new wr(t);this.size=e.size}ni.prototype.clear=function(){this.__data__=new wr,this.size=0},ni.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},ni.prototype.get=function(t){return this.__data__.get(t)},ni.prototype.has=function(t){return this.__data__.has(t)},ni.prototype.set=function(t,e){var n=this.__data__;if(n instanceof wr){var r=n.__data__;if(!qr||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ei(r)}return n.set(t,e),this.size=n.size,this};var ri=ni,ii=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t},oi=function(){try{var t=Xr(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),ai=function(t,e,n){"__proto__"==e&&oi?oi(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},ui=Object.prototype.hasOwnProperty,si=function(t,e,n){var r=t[e];ui.call(t,e)&&yr(r,n)&&(void 0!==n||e in t)||ai(t,e,n)},ci=function(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var u=e[o],s=r?r(n[u],t[u],u,n,t):void 0;void 0===s&&(s=t[u]),i?ai(n,u,s):si(n,u,s)}return n},fi=function(t){return null!=t&&"object"==typeof t},li=function(t){return fi(t)&&"[object Arguments]"==Mr(t)},di=Object.prototype,hi=di.hasOwnProperty,pi=di.propertyIsEnumerable,vi=li(function(){return arguments}())?li:function(t){return fi(t)&&hi.call(t,"callee")&&!pi.call(t,"callee")},gi=Array.isArray,yi=function(){return!1},mi=gr((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n?Ar.Buffer:void 0,o=(i?i.isBuffer:void 0)||yi;t.exports=o})),bi=/^(?:0|[1-9]\d*)$/,_i=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&bi.test(t))&&t>-1&&t%1==0&&t<e},xi=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},wi={};wi["[object Float32Array]"]=wi["[object Float64Array]"]=wi["[object Int8Array]"]=wi["[object Int16Array]"]=wi["[object Int32Array]"]=wi["[object Uint8Array]"]=wi["[object Uint8ClampedArray]"]=wi["[object Uint16Array]"]=wi["[object Uint32Array]"]=!0,wi["[object Arguments]"]=wi["[object Array]"]=wi["[object ArrayBuffer]"]=wi["[object Boolean]"]=wi["[object DataView]"]=wi["[object Date]"]=wi["[object Error]"]=wi["[object Function]"]=wi["[object Map]"]=wi["[object Number]"]=wi["[object Object]"]=wi["[object RegExp]"]=wi["[object Set]"]=wi["[object String]"]=wi["[object WeakMap]"]=!1;var Ei=function(t){return function(e){return t(e)}},Si=gr((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n&&Er.process,o=function(){try{return r&&r.require&&r.require("util").types||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o})),Ai=Si&&Si.isTypedArray,Ti=Ai?Ei(Ai):function(t){return fi(t)&&xi(t.length)&&!!wi[Mr(t)]},Ii=Object.prototype.hasOwnProperty,Ni=function(t,e){var n=gi(t),r=!n&&vi(t),i=!n&&!r&&mi(t),o=!n&&!r&&!i&&Ti(t),a=n||r||i||o,u=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],s=u.length;for(var c in t)!e&&!Ii.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_i(c,s))||u.push(c);return u},Oi=Object.prototype,Ci=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Oi)},ki=function(t,e){return function(n){return t(e(n))}},Di=ki(Object.keys,Object),Mi=Object.prototype.hasOwnProperty,Ri=function(t){if(!Ci(t))return Di(t);var e=[];for(var n in Object(t))Mi.call(t,n)&&"constructor"!=n&&e.push(n);return e},Pi=function(t){return null!=t&&xi(t.length)&&!Pr(t)},Gi=function(t){return Pi(t)?Ni(t):Ri(t)},Li=Object.prototype.hasOwnProperty,ji=function(t){return Pi(t)?Ni(t,!0):function(t){if(!Rr(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Ci(t),n=[];for(var r in t)("constructor"!=r||!e&&Li.call(t,r))&&n.push(r);return n}(t)},Fi=gr((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n?Ar.Buffer:void 0,o=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=o?o(n):new t.constructor(n);return t.copy(r),r}})),Ui=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},Bi=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o},zi=function(){return[]},Vi=Object.prototype.propertyIsEnumerable,Wi=Object.getOwnPropertySymbols,Hi=Wi?function(t){return null==t?[]:(t=Object(t),Bi(Wi(t),(function(e){return Vi.call(t,e)})))}:zi,Xi=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t},qi=ki(Object.getPrototypeOf,Object),Yi=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Xi(e,Hi(t)),t=qi(t);return e}:zi,Ki=function(t,e,n){var r=e(t);return gi(t)?r:Xi(r,n(t))},Zi=function(t){return Ki(t,Gi,Hi)},$i=function(t){return Ki(t,ji,Yi)},Ji=Xr(Ar,"DataView"),Qi=Xr(Ar,"Promise"),to=Xr(Ar,"Set"),eo=Xr(Ar,"WeakMap"),no=Fr(Ji),ro=Fr(qr),io=Fr(Qi),oo=Fr(to),ao=Fr(eo),uo=Mr;(Ji&&"[object DataView]"!=uo(new Ji(new ArrayBuffer(1)))||qr&&"[object Map]"!=uo(new qr)||Qi&&"[object Promise]"!=uo(Qi.resolve())||to&&"[object Set]"!=uo(new to)||eo&&"[object WeakMap]"!=uo(new eo))&&(uo=function(t){var e=Mr(t),n="[object Object]"==e?t.constructor:void 0,r=n?Fr(n):"";if(r)switch(r){case no:return"[object DataView]";case ro:return"[object Map]";case io:return"[object Promise]";case oo:return"[object Set]";case ao:return"[object WeakMap]"}return e});var so=uo,co=Object.prototype.hasOwnProperty,fo=Ar.Uint8Array,lo=function(t){var e=new t.constructor(t.byteLength);return new fo(e).set(new fo(t)),e},ho=/\w*$/,po=Tr?Tr.prototype:void 0,vo=po?po.valueOf:void 0,go=function(t,e){var n=e?lo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)},yo=Object.create,mo=function(){function t(){}return function(e){if(!Rr(e))return{};if(yo)return yo(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),bo=function(t){return"function"!=typeof t.constructor||Ci(t)?{}:mo(qi(t))},_o=Si&&Si.isMap,xo=_o?Ei(_o):function(t){return fi(t)&&"[object Map]"==so(t)},wo=Si&&Si.isSet,Eo=wo?Ei(wo):function(t){return fi(t)&&"[object Set]"==so(t)},So={};So["[object Arguments]"]=So["[object Array]"]=So["[object ArrayBuffer]"]=So["[object DataView]"]=So["[object Boolean]"]=So["[object Date]"]=So["[object Float32Array]"]=So["[object Float64Array]"]=So["[object Int8Array]"]=So["[object Int16Array]"]=So["[object Int32Array]"]=So["[object Map]"]=So["[object Number]"]=So["[object Object]"]=So["[object RegExp]"]=So["[object Set]"]=So["[object String]"]=So["[object Symbol]"]=So["[object Uint8Array]"]=So["[object Uint8ClampedArray]"]=So["[object Uint16Array]"]=So["[object Uint32Array]"]=!0,So["[object Error]"]=So["[object Function]"]=So["[object WeakMap]"]=!1;var Ao=function t(e,n,r,i,o,a){var u,s=1&n,c=2&n,f=4&n;if(r&&(u=o?r(e,i,o,a):r(e)),void 0!==u)return u;if(!Rr(e))return e;var l=gi(e);if(l){if(u=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&co.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!s)return Ui(e,u)}else{var d=so(e),h="[object Function]"==d||"[object GeneratorFunction]"==d;if(mi(e))return Fi(e,s);if("[object Object]"==d||"[object Arguments]"==d||h&&!o){if(u=c||h?{}:bo(e),!s)return c?function(t,e){return ci(t,Yi(t),e)}(e,function(t,e){return t&&ci(e,ji(e),t)}(u,e)):function(t,e){return ci(t,Hi(t),e)}(e,function(t,e){return t&&ci(e,Gi(e),t)}(u,e))}else{if(!So[d])return o?e:{};u=function(t,e,n){var r=t.constructor;switch(e){case"[object ArrayBuffer]":return lo(t);case"[object Boolean]":case"[object Date]":return new r(+t);case"[object DataView]":return function(t,e){var n=e?lo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return go(t,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,ho.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return function(t){return vo?Object(vo.call(t)):{}}(t)}}(e,d,s)}}a||(a=new ri);var p=a.get(e);if(p)return p;a.set(e,u),Eo(e)?e.forEach((function(i){u.add(t(i,n,r,i,e,a))})):xo(e)&&e.forEach((function(i,o){u.set(o,t(i,n,r,o,e,a))}));var v=l?void 0:(f?c?$i:Zi:c?ji:Gi)(e);return ii(v||e,(function(i,o){v&&(i=e[o=i]),si(u,o,t(i,n,r,o,e,a))})),u},To=function(t){return function(){return t}},Io=function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var u=o[++r];if(!1===e(i[u],u,i))break}return t},No=function(t,e){return t&&Io(t,e,Gi)},Oo=function(t,e){return function(e,n){if(null==e)return e;if(!Pi(e))return t(e,n);for(var r=e.length,i=-1,o=Object(e);++i<r&&!1!==n(o[i],i,o););return e}}(No),Co=function(t){return t},ko=function(t){return"function"==typeof t?t:Co},Do=function(t,e){return(gi(t)?ii:Oo)(t,ko(e))},Mo=Do,Ro=function(t,e){var n=[];return Oo(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n};function Po(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ei;++e<n;)this.add(t[e])}Po.prototype.add=Po.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Po.prototype.has=function(t){return this.__data__.has(t)};var Go=Po,Lo=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1},jo=function(t,e){return t.has(e)},Fo=function(t,e,n,r,i,o){var a=1&n,u=t.length,s=e.length;if(u!=s&&!(a&&s>u))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var l=-1,d=!0,h=2&n?new Go:void 0;for(o.set(t,e),o.set(e,t);++l<u;){var p=t[l],v=e[l];if(r)var g=a?r(v,p,l,e,t,o):r(p,v,l,t,e,o);if(void 0!==g){if(g)continue;d=!1;break}if(h){if(!Lo(e,(function(t,e){if(!jo(h,e)&&(p===t||i(p,t,n,r,o)))return h.push(e)}))){d=!1;break}}else if(p!==v&&!i(p,v,n,r,o)){d=!1;break}}return o.delete(t),o.delete(e),d},Uo=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},Bo=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},zo=Tr?Tr.prototype:void 0,Vo=zo?zo.valueOf:void 0,Wo=function(t,e,n,r,i,o,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new fo(t),new fo(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return yr(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=Uo;case"[object Set]":var s=1&r;if(u||(u=Bo),t.size!=e.size&&!s)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var f=Fo(u(t),u(e),r,i,o,a);return a.delete(t),f;case"[object Symbol]":if(Vo)return Vo.call(t)==Vo.call(e)}return!1},Ho=Object.prototype.hasOwnProperty,Xo=Object.prototype.hasOwnProperty,qo=function t(e,n,r,i,o){return e===n||(null==e||null==n||!fi(e)&&!fi(n)?e!=e&&n!=n:function(t,e,n,r,i,o){var a=gi(t),u=gi(e),s=a?"[object Array]":so(t),c=u?"[object Array]":so(e),f="[object Object]"==(s="[object Arguments]"==s?"[object Object]":s),l="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),d=s==c;if(d&&mi(t)){if(!mi(e))return!1;a=!0,f=!1}if(d&&!f)return o||(o=new ri),a||Ti(t)?Fo(t,e,n,r,i,o):Wo(t,e,s,n,r,i,o);if(!(1&n)){var h=f&&Xo.call(t,"__wrapped__"),p=l&&Xo.call(e,"__wrapped__");if(h||p){var v=h?t.value():t,g=p?e.value():e;return o||(o=new ri),i(v,g,n,r,o)}}return!!d&&(o||(o=new ri),function(t,e,n,r,i,o){var a=1&n,u=Zi(t),s=u.length;if(s!=Zi(e).length&&!a)return!1;for(var c=s;c--;){var f=u[c];if(!(a?f in e:Ho.call(e,f)))return!1}var l=o.get(t),d=o.get(e);if(l&&d)return l==e&&d==t;var h=!0;o.set(t,e),o.set(e,t);for(var p=a;++c<s;){var v=t[f=u[c]],g=e[f];if(r)var y=a?r(g,v,f,e,t,o):r(v,g,f,t,e,o);if(!(void 0===y?v===g||i(v,g,n,r,o):y)){h=!1;break}p||(p="constructor"==f)}if(h&&!p){var m=t.constructor,b=e.constructor;m==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof b&&b instanceof b||(h=!1)}return o.delete(t),o.delete(e),h}(t,e,n,r,i,o))}(e,n,r,i,t,o))},Yo=function(t){return t==t&&!Rr(t)},Ko=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}},Zo=function(t){return"symbol"==typeof t||fi(t)&&"[object Symbol]"==Mr(t)},$o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jo=/^\w*$/,Qo=function(t,e){if(gi(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Zo(t))||Jo.test(t)||!$o.test(t)||null!=e&&t in Object(e)};function ta(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(ta.Cache||ei),n}ta.Cache=ei;var ea,na=ta,ra=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ia=/\\(\\)?/g,oa=function(t){var e=na((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ra,(function(t,n,r,i){e.push(r?i.replace(ia,"$1"):n||t)})),e}),(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}(),aa=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i},ua=Tr?Tr.prototype:void 0,sa=ua?ua.toString:void 0,ca=function t(e){if("string"==typeof e)return e;if(gi(e))return aa(e,t)+"";if(Zo(e))return sa?sa.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},fa=function(t){return null==t?"":ca(t)},la=function(t,e){return gi(t)?t:Qo(t,e)?[t]:oa(fa(t))},da=function(t){if("string"==typeof t||Zo(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},ha=function(t,e){for(var n=0,r=(e=la(e,t)).length;null!=t&&n<r;)t=t[da(e[n++])];return n&&n==r?t:void 0},pa=function(t,e){return null!=t&&e in Object(t)},va=function(t,e,n){for(var r=-1,i=(e=la(e,t)).length,o=!1;++r<i;){var a=da(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&xi(i)&&_i(a,i)&&(gi(t)||vi(t))},ga=function(t,e){return null!=t&&va(t,e,pa)},ya=function(t){return function(e){return null==e?void 0:e[t]}},ma=function(t){return"function"==typeof t?t:null==t?Co:"object"==typeof t?gi(t)?function(t,e){return Qo(t)&&Yo(e)?Ko(da(t),e):function(n){var r=function(t,e,n){var r=null==t?void 0:ha(t,e);return void 0===r?void 0:r}(n,t);return void 0===r&&r===e?ga(n,t):qo(e,r,3)}}(t[0],t[1]):function(t){var e=function(t){for(var e=Gi(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Yo(i)]}return e}(t);return 1==e.length&&e[0][2]?Ko(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,r){var i=n.length,o=i;if(null==t)return!o;for(t=Object(t);i--;){var a=n[i];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){var u=(a=n[i])[0],s=t[u],c=a[1];if(a[2]){if(void 0===s&&!(u in t))return!1}else{var f,l=new ri;if(!(void 0===f?qo(c,s,3,r,l):f))return!1}}return!0}(n,0,e)}}(t):function(t){return Qo(t)?ya(da(t)):function(t){return function(e){return ha(e,t)}}(t)}(t)},ba=function(t,e){return(gi(t)?Bi:Ro)(t,ma(e))},_a=Object.prototype.hasOwnProperty,xa=function(t,e){return null!=t&&_a.call(t,e)},wa=function(t,e){return null!=t&&va(t,e,xa)},Ea=Object.prototype.hasOwnProperty,Sa=function(t){return void 0===t},Aa=function(t,e){var n=-1,r=Pi(t)?Array(t.length):[];return Oo(t,(function(t,i,o){r[++n]=e(t,i,o)})),r},Ta=function(t,e){return(gi(t)?aa:Aa)(t,ma(e))},Ia=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n},Na=function(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n},Oa=function(t,e,n){var r=gi(t)?Ia:Na,i=arguments.length<3;return r(t,ma(e),n,i,Oo)},Ca=ya("length"),ka=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Da="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ma="\\ud83c[\\udffb-\\udfff]",Ra="[^\\ud800-\\udfff]",Pa="(?:\\ud83c[\\udde6-\\uddff]){2}",Ga="[\\ud800-\\udbff][\\udc00-\\udfff]",La="(?:"+Da+"|"+Ma+")?",ja="[\\ufe0e\\ufe0f]?"+La+"(?:\\u200d(?:"+[Ra,Pa,Ga].join("|")+")[\\ufe0e\\ufe0f]?"+La+")*",Fa="(?:"+[Ra+Da+"?",Da,Pa,Ga,"[\\ud800-\\udfff]"].join("|")+")",Ua=RegExp(Ma+"(?="+Ma+")|"+Fa+ja,"g"),Ba=Tr?Tr.isConcatSpreadable:void 0,za=function(t){return gi(t)||vi(t)||!!(Ba&&t&&t[Ba])},Va=function t(e,n,r,i,o){var a=-1,u=e.length;for(r||(r=za),o||(o=[]);++a<u;){var s=e[a];n>0&&r(s)?n>1?t(s,n-1,r,i,o):Xi(o,s):i||(o[o.length]=s)}return o},Wa=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},Ha=Math.max,Xa=function(t,e,n){return e=Ha(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=Ha(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=r[i];return u[e]=n(a),Wa(t,this,u)}},qa=oi?function(t,e){return oi(t,"toString",{configurable:!0,enumerable:!1,value:To(e),writable:!0})}:Co,Ya=Date.now,Ka=function(t){var e=0,n=0;return function(){var r=Ya(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(qa),Za=function(t,e){return Ka(Xa(t,e,Co),t+"")},$a=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1},Ja=function(t){return t!=t},Qa=function(t,e){return!(null==t||!t.length)&&function(t,e,n){return e==e?function(t,e,n){for(var r=-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e):$a(t,Ja,0)}(t,e)>-1},tu=to&&1/Bo(new to([,-0]))[1]==1/0?function(t){return new to(t)}:function(){},eu=function(t){return fi(t)&&Pi(t)},nu=Za((function(t){return function(t,e,n){var r=-1,i=Qa,o=t.length,a=!0,u=[],s=u;if(o>=200){var c=tu(t);if(c)return Bo(c);a=!1,i=jo,s=new Go}else s=u;t:for(;++r<o;){var f=t[r],l=f;if(f=0!==f?f:0,a&&l==l){for(var d=s.length;d--;)if(s[d]===l)continue t;u.push(f)}else i(s,l,n)||(s!==u&&s.push(l),u.push(f))}return u}(Va(t,1,eu,!0))})),ru=function(t){return null==t?[]:function(t,e){return aa(e,(function(e){return t[e]}))}(t,Gi(t))};try{ea={clone:function(t){return Ao(t,4)},constant:To,each:Mo,filter:ba,has:wa,isArray:gi,isEmpty:function(t){if(null==t)return!0;if(Pi(t)&&(gi(t)||"string"==typeof t||"function"==typeof t.splice||mi(t)||Ti(t)||vi(t)))return!t.length;var e=so(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(Ci(t))return!Ri(t).length;for(var n in t)if(Ea.call(t,n))return!1;return!0},isFunction:Pr,isUndefined:Sa,keys:Gi,map:Ta,reduce:Oa,size:function(t){if(null==t)return 0;if(Pi(t))return function(t){return"string"==typeof t||!gi(t)&&fi(t)&&"[object String]"==Mr(t)}(t)?function(t){return function(t){return ka.test(t)}(t)?function(t){for(var e=Ua.lastIndex=0;Ua.test(t);)++e;return e}(t):Ca(t)}(t):t.length;var e=so(t);return"[object Map]"==e||"[object Set]"==e?t.size:Ri(t).length},transform:function(t,e,n){var r=gi(t),i=r||mi(t)||Ti(t);if(e=ma(e),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Rr(t)&&Pr(o)?mo(qi(t)):{}}return(i?ii:No)(t,(function(t,r,i){return e(n,t,r,i)})),n},union:nu,values:ru}}catch(ar){}ea||(ea=window._);var iu=ea,ou=au;function au(t){this._isDirected=!iu.has(t,"directed")||t.directed,this._isMultigraph=!!iu.has(t,"multigraph")&&t.multigraph,this._isCompound=!!iu.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=iu.constant(void 0),this._defaultEdgeLabelFn=iu.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function uu(t,e){t[e]?t[e]++:t[e]=1}function su(t,e){--t[e]||delete t[e]}function cu(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}return i+""+o+""+(iu.isUndefined(r)?"\0":r)}function fu(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var u={v:i,w:o};return r&&(u.name=r),u}function lu(t,e){return cu(t,e.v,e.w,e.name)}au.prototype._nodeCount=0,au.prototype._edgeCount=0,au.prototype.isDirected=function(){return this._isDirected},au.prototype.isMultigraph=function(){return this._isMultigraph},au.prototype.isCompound=function(){return this._isCompound},au.prototype.setGraph=function(t){return this._label=t,this},au.prototype.graph=function(){return this._label},au.prototype.setDefaultNodeLabel=function(t){return iu.isFunction(t)||(t=iu.constant(t)),this._defaultNodeLabelFn=t,this},au.prototype.nodeCount=function(){return this._nodeCount},au.prototype.nodes=function(){return iu.keys(this._nodes)},au.prototype.sources=function(){var t=this;return iu.filter(this.nodes(),(function(e){return iu.isEmpty(t._in[e])}))},au.prototype.sinks=function(){var t=this;return iu.filter(this.nodes(),(function(e){return iu.isEmpty(t._out[e])}))},au.prototype.setNodes=function(t,e){var n=arguments,r=this;return iu.each(t,(function(t){n.length>1?r.setNode(t,e):r.setNode(t)})),this},au.prototype.setNode=function(t,e){return iu.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},au.prototype.node=function(t){return this._nodes[t]},au.prototype.hasNode=function(t){return iu.has(this._nodes,t)},au.prototype.removeNode=function(t){var e=this;if(iu.has(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],iu.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),iu.each(iu.keys(this._in[t]),n),delete this._in[t],delete this._preds[t],iu.each(iu.keys(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},au.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(iu.isUndefined(e))e="\0";else{for(var n=e+="";!iu.isUndefined(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},au.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},au.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if("\0"!==e)return e}},au.prototype.children=function(t){if(iu.isUndefined(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return iu.keys(e)}else{if("\0"===t)return this.nodes();if(this.hasNode(t))return[]}},au.prototype.predecessors=function(t){var e=this._preds[t];if(e)return iu.keys(e)},au.prototype.successors=function(t){var e=this._sucs[t];if(e)return iu.keys(e)},au.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return iu.union(e,this.successors(t))},au.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},au.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;iu.each(this._nodes,(function(n,r){t(r)&&e.setNode(r,n)})),iu.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))}));var r={};function i(t){var o=n.parent(t);return void 0===o||e.hasNode(o)?(r[t]=o,o):o in r?r[o]:i(o)}return this._isCompound&&iu.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},au.prototype.setDefaultEdgeLabel=function(t){return iu.isFunction(t)||(t=iu.constant(t)),this._defaultEdgeLabelFn=t,this},au.prototype.edgeCount=function(){return this._edgeCount},au.prototype.edges=function(){return iu.values(this._edgeObjs)},au.prototype.setPath=function(t,e){var n=this,r=arguments;return iu.reduce(t,(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i})),this},au.prototype.setEdge=function(){var t,e,n,r,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,e=o.w,n=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,e=""+e,iu.isUndefined(n)||(n=""+n);var a=cu(this._isDirected,t,e,n);if(iu.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=r),this;if(!iu.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?r:this._defaultEdgeLabelFn(t,e,n);var u=fu(this._isDirected,t,e,n);return t=u.v,e=u.w,Object.freeze(u),this._edgeObjs[a]=u,uu(this._preds[e],t),uu(this._sucs[t],e),this._in[e][a]=u,this._out[t][a]=u,this._edgeCount++,this},au.prototype.edge=function(t,e,n){var r=1===arguments.length?lu(this._isDirected,arguments[0]):cu(this._isDirected,t,e,n);return this._edgeLabels[r]},au.prototype.hasEdge=function(t,e,n){var r=1===arguments.length?lu(this._isDirected,arguments[0]):cu(this._isDirected,t,e,n);return iu.has(this._edgeLabels,r)},au.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?lu(this._isDirected,arguments[0]):cu(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],su(this._preds[e],t),su(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},au.prototype.inEdges=function(t,e){var n=this._in[t];if(n){var r=iu.values(n);return e?iu.filter(r,(function(t){return t.v===e})):r}},au.prototype.outEdges=function(t,e){var n=this._out[t];if(n){var r=iu.values(n);return e?iu.filter(r,(function(t){return t.w===e})):r}},au.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))};var du={Graph:ou,version:"2.1.8"},hu={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:pu(t),edges:vu(t)};return iu.isUndefined(t.graph())||(e.value=iu.clone(t.graph())),e},read:function(t){var e=new ou(t.options).setGraph(t.value);return iu.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),iu.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}};function pu(t){return iu.map(t.nodes(),(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return iu.isUndefined(n)||(i.value=n),iu.isUndefined(r)||(i.parent=r),i}))}function vu(t){return iu.map(t.edges(),(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return iu.isUndefined(e.name)||(r.name=e.name),iu.isUndefined(n)||(r.value=n),r}))}var gu=yu;function yu(){this._arr=[],this._keyIndices={}}yu.prototype.size=function(){return this._arr.length},yu.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},yu.prototype.has=function(t){return iu.has(this._keyIndices,t)},yu.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},yu.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},yu.prototype.add=function(t,e){var n=this._keyIndices;if(t=String(t),!iu.has(n,t)){var r=this._arr,i=r.length;return n[t]=i,r.push({key:t,priority:e}),this._decrease(i),!0}return!1},yu.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},yu.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},yu.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))},yu.prototype._decrease=function(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e},yu.prototype._swap=function(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e};var mu=function(t,e,n,r){return function(t,e,n,r){var i,o,a={},u=new gu,s=function(t){var e=t.v!==i?t.v:t.w,r=a[e],s=n(t),c=o.distance+s;if(s<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+s);c<r.distance&&(r.distance=c,r.predecessor=i,u.decrease(e,c))};for(t.nodes().forEach((function(t){var n=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:n},u.add(t,n)}));u.size()>0&&(i=u.removeMin(),(o=a[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(s);return a}(t,String(e),n||bu,r||function(e){return t.outEdges(e)})},bu=iu.constant(1),_u=function(t){var e=0,n=[],r={},i=[];function o(a){var u=r[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach((function(t){iu.has(r,t)?r[t].onStack&&(u.lowlink=Math.min(u.lowlink,r[t].index)):(o(t),u.lowlink=Math.min(u.lowlink,r[t].lowlink))})),u.lowlink===u.index){var s,c=[];do{s=n.pop(),r[s].onStack=!1,c.push(s)}while(a!==s);i.push(c)}}return t.nodes().forEach((function(t){iu.has(r,t)||o(t)})),i},xu=iu.constant(1),wu=Eu;function Eu(t){var e={},n={},r=[];if(iu.each(t.sinks(),(function i(o){if(iu.has(n,o))throw new Su;iu.has(e,o)||(n[o]=!0,e[o]=!0,iu.each(t.predecessors(o),i),delete n[o],r.push(o))})),iu.size(e)!==t.nodeCount())throw new Su;return r}function Su(){}Eu.CycleException=Su,Su.prototype=new Error;var Au=function(t,e,n){iu.isArray(e)||(e=[e]);var r=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],o={};return iu.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);Tu(t,e,"post"===n,o,r,i)})),i};function Tu(t,e,n,r,i,o){iu.has(r,e)||(r[e]=!0,n||o.push(e),iu.each(i(e),(function(e){Tu(t,e,n,r,i,o)})),n&&o.push(e))}var Iu,Nu={Graph:du.Graph,json:hu,alg:{components:function(t){var e,n={},r=[];function i(r){iu.has(n,r)||(n[r]=!0,e.push(r),iu.each(t.successors(r),i),iu.each(t.predecessors(r),i))}return iu.each(t.nodes(),(function(t){e=[],i(t),e.length&&r.push(e)})),r},dijkstra:mu,dijkstraAll:function(t,e,n){return iu.transform(t.nodes(),(function(r,i){r[i]=mu(t,i,e,n)}),{})},findCycles:function(t){return iu.filter(_u(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))},floydWarshall:function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],u=r.distance+i.distance;u<a.distance&&(a.distance=u,a.predecessor=i.predecessor)}))}))})),r}(t,e||xu,n||function(e){return t.outEdges(e)})},isAcyclic:function(t){try{wu(t)}catch(t){if(t instanceof wu.CycleException)return!1;throw t}return!0},postorder:function(t,e){return Au(t,e,"post")},preorder:function(t,e){return Au(t,e,"pre")},prim:function(t,e){var n,r=new ou,i={},o=new gu;function a(t){var r=t.v===n?t.w:t.v,a=o.priority(r);if(void 0!==a){var u=e(t);u<a&&(i[r]=n,o.decrease(r,u))}}if(0===t.nodeCount())return r;iu.each(t.nodes(),(function(t){o.add(t,Number.POSITIVE_INFINITY),r.setNode(t)})),o.decrease(t.nodes()[0],0);for(var u=!1;o.size()>0;){if(n=o.removeMin(),iu.has(i,n))r.setEdge(n,i[n]);else{if(u)throw new Error("Input graph is not connected: "+t);u=!0}t.nodeEdges(n).forEach(a)}return r},tarjan:_u,topsort:wu},version:du.version};try{Iu=Nu}catch(ar){}Iu||(Iu=window.graphlib);var Ou,Cu=Iu,ku=function(t,e,n){if(!Rr(n))return!1;var r=typeof e;return!!("number"==r?Pi(n)&&_i(e,n.length):"string"==r&&e in n)&&yr(n[e],t)},Du=Object.prototype,Mu=Du.hasOwnProperty,Ru=Za((function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&ku(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],a=ji(o),u=-1,s=a.length;++u<s;){var c=a[u],f=t[c];(void 0===f||yr(f,Du[c])&&!Mu.call(t,c))&&(t[c]=o[c])}return t})),Pu=/^\s+|\s+$/g,Gu=/^[-+]0x[0-9a-f]+$/i,Lu=/^0b[01]+$/i,ju=/^0o[0-7]+$/i,Fu=parseInt,Uu=function(t){return t?1/0===(t=function(t){if("number"==typeof t)return t;if(Zo(t))return NaN;if(Rr(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Rr(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Pu,"");var n=Lu.test(t);return n||ju.test(t)?Fu(t.slice(2),n?2:8):Gu.test(t)?NaN:+t}(t))||-1/0===t?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},Bu=Math.max,zu=function(t,e,n){var r=Object(t);if(!Pi(t)){var i=ma(e);t=Gi(t),e=function(t){return i(r[t],t,r)}}var o=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:function(t){var e=Uu(t),n=e%1;return e==e?n?e-n:e:0}(n);return i<0&&(i=Bu(r+i,0)),$a(t,ma(e),i)}(t,e,n);return o>-1?r[i?t[o]:o]:void 0},Vu=function(t){return null!=t&&t.length?Va(t,1):[]},Wu=function(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],a=e(o);if(null!=a&&(void 0===u?a==a&&!Zo(a):n(a,u)))var u=a,s=o}return s},Hu=function(t,e){return t>e},Xu=function(t,e,n){(void 0!==n&&!yr(t[e],n)||void 0===n&&!(e in t))&&ai(t,e,n)},qu=Function.prototype,Yu=Object.prototype,Ku=qu.toString,Zu=Yu.hasOwnProperty,$u=Ku.call(Object),Ju=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Qu=function t(e,n,r,i,o){e!==n&&Io(n,(function(a,u){if(o||(o=new ri),Rr(a))!function(t,e,n,r,i,o,a){var u=Ju(t,n),s=Ju(e,n),c=a.get(s);if(c)Xu(t,n,c);else{var f=o?o(u,s,n+"",t,e,a):void 0,l=void 0===f;if(l){var d=gi(s),h=!d&&mi(s),p=!d&&!h&&Ti(s);f=s,d||h||p?gi(u)?f=u:eu(u)?f=Ui(u):h?(l=!1,f=Fi(s,!0)):p?(l=!1,f=go(s,!0)):f=[]:function(t){if(!fi(t)||"[object Object]"!=Mr(t))return!1;var e=qi(t);if(null===e)return!0;var n=Zu.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ku.call(n)==$u}(s)||vi(s)?(f=u,vi(u)?f=function(t){return ci(t,ji(t))}(u):Rr(u)&&!Pr(u)||(f=bo(s))):l=!1}l&&(a.set(s,f),i(f,s,r,o,a),a.delete(s)),Xu(t,n,f)}}(e,n,u,r,t,i,o);else{var s=i?i(Ju(e,u),a,u+"",e,n,o):void 0;void 0===s&&(s=a),Xu(e,u,s)}}),ji)},ts=function(t){return Za((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&ku(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++r<i;){var u=n[r];u&&t(e,u,r)}return e}))}((function(t,e,n){Qu(t,e,n)})),es=function(t,e){return t<e},ns=function(t,e,n,r){if(!Rr(t))return t;for(var i=-1,o=(e=la(e,t)).length,a=o-1,u=t;null!=u&&++i<o;){var s=da(e[i]),c=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return t;if(i!=a){var f=u[s];void 0===(c=r?r(f,s,u):void 0)&&(c=Rr(f)?f:_i(e[i+1])?[]:{})}si(u,s,c),u=u[s]}return t},rs=function(t){return Ka(Xa(t,void 0,Vu),t+"")}((function(t,e){return null==t?{}:function(t,e){return function(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],u=ha(t,a);n(0,a)&&ns(o,la(a,t),u)}return o}(t,e,(function(e,n){return ga(t,n)}))}(t,e)})),is=Math.ceil,os=Math.max,as=function(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Zo(t),a=void 0!==e,u=null===e,s=e==e,c=Zo(e);if(!u&&!c&&!o&&t>e||o&&a&&s&&!u&&!c||r&&a&&s||!n&&s||!i)return 1;if(!r&&!o&&!c&&t<e||c&&n&&i&&!r&&!o||u&&n&&i||!a&&i||!s)return-1}return 0},us=Za((function(t,e){if(null==t)return[];var n=e.length;return n>1&&ku(t,e[0],e[1])?e=[]:n>2&&ku(e[0],e[1],e[2])&&(e=[e[0]]),function(t,e,n){e=e.length?aa(e,(function(t){return gi(t)?function(e){return ha(e,1===t.length?t[0]:t)}:t})):[Co];var r=-1;e=aa(e,Ei(ma));var i=Aa(t,(function(t,n,i){return{criteria:aa(e,(function(e){return e(t)})),index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,u=n.length;++r<a;){var s=as(i[r],o[r]);if(s)return r>=u?s:s*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}(t,Va(e,1),[])})),ss=0;try{Ou={cloneDeep:function(t){return Ao(t,5)},constant:To,defaults:Ru,each:Mo,filter:ba,find:zu,flatten:Vu,forEach:Do,forIn:function(t,e){return null==t?t:Io(t,ko(e),ji)},has:wa,isUndefined:Sa,last:function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},map:Ta,mapValues:function(t,e){var n={};return e=ma(e),No(t,(function(t,r,i){ai(n,r,e(t,r,i))})),n},max:function(t){return t&&t.length?Wu(t,Co,Hu):void 0},merge:ts,min:function(t){return t&&t.length?Wu(t,Co,es):void 0},minBy:function(t,e){return t&&t.length?Wu(t,ma(e),es):void 0},now:function(){return Ar.Date.now()},pick:rs,range:function(t,e,n){return n&&"number"!=typeof n&&ku(t,e,n)&&(e=n=void 0),t=Uu(t),void 0===e?(e=t,t=0):e=Uu(e),function(t,e,n,r){for(var i=-1,o=os(is((e-t)/(n||1)),0),a=Array(o);o--;)a[++i]=t,t+=n;return a}(t,e,n=void 0===n?t<e?1:-1:Uu(n))},reduce:Oa,sortBy:us,uniqueId:function(t){var e=++ss;return fa(t)+e},values:ru,zipObject:function(t,e){return function(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var u=r<o?e[r]:void 0;n(a,t[r],u)}return a}(t||[],e||[],si)}}}catch(ar){}Ou||(Ou=window._);var cs=Ou,fs=ls;function ls(){var t={};t._next=t._prev=t,this._sentinel=t}function ds(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function hs(t,e){if("_next"!==t&&"_prev"!==t)return e}ls.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return ds(e),e},ls.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&ds(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},ls.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,hs)),n=n._prev;return"["+t.join(", ")+"]"};var ps=Cu.Graph,vs=cs.constant(1);function gs(t,e,n,r,i){var o=i?[]:void 0;return cs.forEach(t.inEdges(r.v),(function(r){var a=t.edge(r),u=t.node(r.v);i&&o.push({v:r.v,w:r.w}),u.out-=a,ys(e,n,u)})),cs.forEach(t.outEdges(r.v),(function(r){var i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,ys(e,n,a)})),t.removeNode(r.v),o}function ys(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var ms=Cu.Graph,bs={addDummyNode:_s,simplify:function(t){var e=(new ms).setGraph(t.graph());return cs.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n))})),cs.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e},asNonCompoundGraph:function(t){var e=new ms({multigraph:t.isMultigraph()}).setGraph(t.graph());return cs.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),cs.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e},successorWeights:function(t){var e=cs.map(t.nodes(),(function(e){var n={};return cs.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight})),n}));return cs.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=cs.map(t.nodes(),(function(e){var n={};return cs.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight})),n}));return cs.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,o=t.y,a=e.x-i,u=e.y-o,s=t.width/2,c=t.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*s>Math.abs(a)*c?(u<0&&(c=-c),n=c*a/u,r=c):(a<0&&(s=-s),n=s,r=s*u/a),{x:i+n,y:o+r}},buildLayerMatrix:function(t){var e=cs.map(cs.range(xs(t)+1),(function(){return[]}));return cs.forEach(t.nodes(),(function(n){var r=t.node(n),i=r.rank;cs.isUndefined(i)||(e[i][r.order]=n)})),e},normalizeRanks:function(t){var e=cs.min(cs.map(t.nodes(),(function(e){return t.node(e).rank})));cs.forEach(t.nodes(),(function(n){var r=t.node(n);cs.has(r,"rank")&&(r.rank-=e)}))},removeEmptyRanks:function(t){var e=cs.min(cs.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];cs.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var r=0,i=t.graph().nodeRankFactor;cs.forEach(n,(function(e,n){cs.isUndefined(e)&&n%i!=0?--r:r&&cs.forEach(e,(function(e){t.node(e).rank+=r}))}))},addBorderNode:function(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),_s(t,"border",i,e)},maxRank:xs,partition:function(t,e){var n={lhs:[],rhs:[]};return cs.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n},time:function(t,e){var n=cs.now();try{return e()}finally{console.log(t+" time: "+(cs.now()-n)+"ms")}},notime:function(t,e){return e()}};function _s(t,e,n,r){var i;do{i=cs.uniqueId(r)}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function xs(t){return cs.max(cs.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!cs.isUndefined(n))return n})))}var ws=function(t){var e={};cs.forEach(t.sources(),(function n(r){var i=t.node(r);if(cs.has(e,r))return i.rank;e[r]=!0;var o=cs.min(cs.map(t.outEdges(r),(function(e){return n(e.w)-t.edge(e).minlen})));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),i.rank=o}))},Es=function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen},Ss=Cu.Graph,As=Es,Ts=function(t){var e,n,r=new Ss({directed:!1}),i=t.nodes()[0],o=t.nodeCount();for(r.setNode(i,{});Is(r,t)<o;)e=Ns(r,t),n=r.hasNode(e.v)?As(t,e):-As(t,e),Os(r,t,n);return r};function Is(t,e){return cs.forEach(t.nodes(),(function n(r){cs.forEach(e.nodeEdges(r),(function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||As(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()}function Ns(t,e){return cs.minBy(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return As(e,n)}))}function Os(t,e,n){cs.forEach(t.nodes(),(function(t){e.node(t).rank+=n}))}var Cs=Es,ks=ws,Ds=Cu.alg.preorder,Ms=Cu.alg.postorder,Rs=bs.simplify,Ps=Gs;function Gs(t){t=Rs(t),ks(t);var e,n=Ts(t);for(Fs(n),Ls(n,t);e=Bs(n);)Vs(n,t,e,zs(n,t,e))}function Ls(t,e){var n=Ms(t,t.nodes());n=n.slice(0,n.length-1),cs.forEach(n,(function(n){!function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=js(t,e,n)}(t,e,n)}))}function js(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,cs.forEach(e.nodeEdges(n),(function(o){var u,s,c=o.v===n,f=c?o.w:o.v;if(f!==r){var l=c===i,d=e.edge(o).weight;if(a+=l?d:-d,u=n,s=f,t.hasEdge(u,s)){var h=t.edge(n,f).cutvalue;a+=l?-h:h}}})),a}function Fs(t,e){arguments.length<2&&(e=t.nodes()[0]),Us(t,{},1,e)}function Us(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,cs.forEach(t.neighbors(r),(function(i){cs.has(e,i)||(n=Us(t,e,n,i,r))})),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function Bs(t){return cs.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function zs(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),u=o,s=!1;o.lim>a.lim&&(u=a,s=!0);var c=cs.filter(e.edges(),(function(e){return s===Ws(0,t.node(e.v),u)&&s!==Ws(0,t.node(e.w),u)}));return cs.minBy(c,(function(t){return Cs(e,t)}))}function Vs(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),Fs(t),Ls(t,e),function(t,e){var n=cs.find(t.nodes(),(function(t){return!e.node(t).parent})),r=Ds(t,n);r=r.slice(1),cs.forEach(r,(function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))}(t,e)}function Ws(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}Gs.initLowLimValues=Fs,Gs.initCutValues=Ls,Gs.calcCutValue=js,Gs.leaveEdge=Bs,Gs.enterEdge=zs,Gs.exchangeEdges=Vs;var Hs=ws,Xs=Hs;var qs=function(t){var e=bs.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&cs.forEach(o,(function(t){n(t,i+1)})),e[r]=i}return cs.forEach(t.children(),(function(t){n(t,1)})),e}(t),r=cs.max(cs.values(n))-1,i=2*r+1;t.graph().nestingRoot=e,cs.forEach(t.edges(),(function(e){t.edge(e).minlen*=i}));var o=function(t){return cs.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;cs.forEach(t.children(),(function(a){Ys(t,e,i,o,r,n,a)})),t.graph().nodeRankFactor=i};function Ys(t,e,n,r,i,o,a){var u=t.children(a);if(u.length){var s=bs.addBorderNode(t,"_bt"),c=bs.addBorderNode(t,"_bb"),f=t.node(a);t.setParent(s,a),f.borderTop=s,t.setParent(c,a),f.borderBottom=c,cs.forEach(u,(function(u){Ys(t,e,n,r,i,o,u);var f=t.node(u),l=f.borderTop?f.borderTop:u,d=f.borderBottom?f.borderBottom:u,h=f.borderTop?r:2*r,p=l!==d?1:i-o[a]+1;t.setEdge(s,l,{weight:h,minlen:p,nestingEdge:!0}),t.setEdge(d,c,{weight:h,minlen:p,nestingEdge:!0})})),t.parent(a)||t.setEdge(e,s,{weight:0,minlen:i+o[a]})}else a!==e&&t.setEdge(e,a,{weight:0,minlen:n})}function Ks(t,e,n,r,i,o){var a={width:0,height:0,rank:o,borderType:e},u=i[e][o-1],s=bs.addDummyNode(t,"border",a,n);i[e][o]=s,t.setParent(s,r),u&&t.setEdge(u,s,{weight:1})}function Zs(t){cs.forEach(t.nodes(),(function(e){$s(t.node(e))})),cs.forEach(t.edges(),(function(e){$s(t.edge(e))}))}function $s(t){var e=t.width;t.width=t.height,t.height=e}function Js(t){t.y=-t.y}function Qs(t){var e=t.x;t.x=t.y,t.y=e}var tc=function(t,e){for(var n=0,r=1;r<e.length;++r)n+=ec(t,e[r-1],e[r]);return n};function ec(t,e,n){for(var r=cs.zipObject(n,cs.map(n,(function(t,e){return e}))),i=cs.flatten(cs.map(e,(function(e){return cs.sortBy(cs.map(t.outEdges(e),(function(e){return{pos:r[e.w],weight:t.edge(e).weight}})),"pos")})),!0),o=1;o<n.length;)o<<=1;var a=2*o-1;o-=1;var u=cs.map(new Array(a),(function(){return 0})),s=0;return cs.forEach(i.forEach((function(t){var e=t.pos+o;u[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=u[e+1]),u[e=e-1>>1]+=t.weight;s+=t.weight*n}))),s}function nc(t,e,n){for(var r;e.length&&(r=cs.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}var rc=function t(e,n,r,i){var o=e.children(n),a=e.node(n),u=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};u&&(o=cs.filter(o,(function(t){return t!==u&&t!==s})));var f=function(t,e){return cs.map(e,(function(e){var n=t.inEdges(e);if(n.length){var r=cs.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))}(e,o);cs.forEach(f,(function(n){if(e.children(n.v).length){var o=t(e,n.v,r,i);c[n.v]=o,cs.has(o,"barycenter")&&(a=n,u=o,cs.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var l=function(t,e){var n={};return cs.forEach(t,(function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};cs.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)})),cs.forEach(e.edges(),(function(t){var e=n[t.v],r=n[t.w];cs.isUndefined(e)||cs.isUndefined(r)||(r.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){e.merged||(cs.isUndefined(e.barycenter)||cs.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var i=t.pop();e.push(i),cs.forEach(i.in.reverse(),n(i)),cs.forEach(i.out,r(i))}return cs.map(cs.filter(e,(function(t){return!t.merged})),(function(t){return cs.pick(t,["vs","i","barycenter","weight"])}))}(cs.filter(n,(function(t){return!t.indegree})))}(f,r);!function(t,e){cs.forEach(t,(function(t){t.vs=cs.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(l,c);var d=function(t,e){var n,r=bs.partition(t,(function(t){return cs.has(t,"barycenter")})),i=r.lhs,o=cs.sortBy(r.rhs,(function(t){return-t.i})),a=[],u=0,s=0,c=0;i.sort((n=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:n?e.i-t.i:t.i-e.i})),c=nc(a,o,c),cs.forEach(i,(function(t){c+=t.vs.length,a.push(t.vs),u+=t.barycenter*t.weight,s+=t.weight,c=nc(a,o,c)}));var f={vs:cs.flatten(a,!0)};return s&&(f.barycenter=u/s,f.weight=s),f}(l,i);if(u&&(d.vs=cs.flatten([u,d.vs,s],!0),e.predecessors(u).length)){var h=e.node(e.predecessors(u)[0]),p=e.node(e.predecessors(s)[0]);cs.has(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+h.order+p.order)/(d.weight+2),d.weight+=2}return d},ic=Cu.Graph,oc=Cu.Graph;function ac(t,e,n){return cs.map(e,(function(e){return function(t,e,n){var r=function(t){for(var e;t.hasNode(e=cs.uniqueId("_root")););return e}(t),i=new ic({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return cs.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||r),cs.forEach(t[n](o),(function(e){var n=e.v===o?e.w:e.v,r=i.edge(n,o),a=cs.isUndefined(r)?0:r.weight;i.setEdge(n,o,{weight:t.edge(e).weight+a})})),cs.has(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),i}(t,e,n)}))}function uc(t,e){var n=new oc;cs.forEach(t,(function(t){var r=t.graph().root,i=rc(t,r,n,e);cs.forEach(i.vs,(function(e,n){t.node(e).order=n})),function(t,e,n){var r,i={};cs.forEach(n,(function(n){for(var o,a,u=t.parent(n);u;){if((o=t.parent(u))?(a=i[o],i[o]=u):(a=r,r=u),a&&a!==u)return void e.setEdge(a,u);u=o}}))}(t,n,i.vs)}))}function sc(t,e){cs.forEach(e,(function(e){cs.forEach(e,(function(e,n){t.node(e).order=n}))}))}var cc=Cu.Graph;function fc(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function lc(t,e,n){if(e>n){var r=e;e=n,n=r}return cs.has(t[e],n)}var dc=bs.normalizeRanks,hc=bs.removeEmptyRanks,pc=bs,vc=Cu.Graph,gc=["nodesep","edgesep","ranksep","marginx","marginy"],yc={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},mc=["acyclicer","ranker","rankdir","align"],bc=["width","height"],_c={width:0,height:0},xc=["minlen","weight","width","height","labeloffset"],wc={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ec=["labelpos"];function Sc(t,e){return cs.mapValues(cs.pick(t,e),Number)}function Ac(t){var e={};return cs.forEach(t,(function(t,n){e[n.toLowerCase()]=t})),e}var Tc=Cu.Graph,Ic={graphlib:Cu,layout:function(t,e){var n=e&&e.debugTiming?pc.time:pc.notime;n("layout",(function(){var e=n(" buildLayoutGraph",(function(){return function(t){var e=new vc({multigraph:!0,compound:!0}),n=Ac(t.graph());return e.setGraph(cs.merge({},yc,Sc(n,gc),cs.pick(n,mc))),cs.forEach(t.nodes(),(function(n){var r=Ac(t.node(n));e.setNode(n,cs.defaults(Sc(r,bc),_c)),e.setParent(n,t.parent(n))})),cs.forEach(t.edges(),(function(n){var r=Ac(t.edge(n));e.setEdge(n,cs.merge({},wc,Sc(r,xc),cs.pick(r,Ec)))})),e}(t)}));n(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,cs.forEach(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){cs.forEach(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){!function(t){var e="greedy"===t.graph().acyclicer?function(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new ps,r=0,i=0;cs.forEach(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),cs.forEach(t.edges(),(function(t){var o=n.edge(t.v,t.w)||0,a=e(t),u=o+a;n.setEdge(t.v,t.w,u),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));var o=cs.range(i+r+3).map((function(){return new fs})),a=r+1;return cs.forEach(n.nodes(),(function(t){ys(o,a,n.node(t))})),{graph:n,buckets:o,zeroIdx:a}}(t,e||vs),r=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.nodeCount();){for(;r=a.dequeue();)gs(t,e,n,r);for(;r=o.dequeue();)gs(t,e,n,r);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(r=e[u].dequeue()){i=i.concat(gs(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return cs.flatten(cs.map(r,(function(e){return t.outEdges(e.v,e.w)})),!0)}(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},r={};return cs.forEach(t.nodes(),(function i(o){cs.has(r,o)||(r[o]=!0,n[o]=!0,cs.forEach(t.outEdges(o),(function(t){cs.has(n,t.w)?e.push(t):i(t.w)})),delete n[o])})),e}(t);cs.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,cs.uniqueId("rev"))}))}(t)})),e(" nestingGraph.run",(function(){qs(t)})),e(" rank",(function(){!function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){Ps(t)}(t);break;case"tight-tree":!function(t){Hs(t),Ts(t)}(t);break;case"longest-path":Xs(t)}}(pc.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};pc.addDummyNode(t,"edge-proxy",i,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){hc(t)})),e(" nestingGraph.cleanup",(function(){!function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,cs.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}(t)})),e(" normalizeRanks",(function(){dc(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;cs.forEach(t.nodes(),(function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=cs.max(e,r.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){cs.forEach(t.nodes(),(function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){!function(t){t.graph().dummyChains=[],cs.forEach(t.edges(),(function(e){!function(t,e){var n,r,i,o=e.v,a=t.node(o).rank,u=e.w,s=t.node(u).rank,c=e.name,f=t.edge(e),l=f.labelRank;if(s!==a+1){for(t.removeEdge(e),i=0,++a;a<s;++i,++a)f.points=[],r={width:0,height:0,edgeLabel:f,edgeObj:e,rank:a},n=bs.addDummyNode(t,"edge",r,"_d"),a===l&&(r.width=f.width,r.height=f.height,r.dummy="edge-label",r.labelpos=f.labelpos),t.setEdge(o,n,{weight:f.weight},c),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,u,{weight:f.weight},c)}}(t,e)}))}(t)})),e(" parentDummyChains",(function(){!function(t){var e=function(t){var e={},n=0;return cs.forEach(t.children(),(function r(i){var o=n;cs.forEach(t.children(i),r),e[i]={low:o,lim:n++}})),e}(t);cs.forEach(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){var i,o,a=[],u=[],s=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>s||c>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)u.push(i);return{path:a.concat(u.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,u=o.lca,s=0,c=a[s],f=!0;n!==i.w;){if(r=t.node(n),f){for(;(c=a[s])!==u&&t.node(c).maxRank<r.rank;)s++;c===u&&(f=!1)}if(!f){for(;s<a.length-1&&t.node(c=a[s+1]).minRank<=r.rank;)s++;c=a[s]}t.setParent(n,c),n=t.successors(n)[0]}}))}(t)})),e(" addBorderSegments",(function(){!function(t){cs.forEach(t.children(),(function e(n){var r=t.children(n),i=t.node(n);if(r.length&&cs.forEach(r,e),cs.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)Ks(t,"borderLeft","_bl",n,i,o),Ks(t,"borderRight","_br",n,i,o)}}))}(t)})),e(" order",(function(){!function(t){var e=bs.maxRank(t),n=ac(t,cs.range(1,e+1),"inEdges"),r=ac(t,cs.range(e-1,-1,-1),"outEdges"),i=function(t){var e={},n=cs.filter(t.nodes(),(function(e){return!t.children(e).length})),r=cs.max(cs.map(n,(function(e){return t.node(e).rank}))),i=cs.map(cs.range(r+1),(function(){return[]})),o=cs.sortBy(n,(function(e){return t.node(e).rank}));return cs.forEach(o,(function n(r){if(!cs.has(e,r)){e[r]=!0;var o=t.node(r);i[o.rank].push(r),cs.forEach(t.successors(r),n)}})),i}(t);sc(t,i);for(var o,a=Number.POSITIVE_INFINITY,u=0,s=0;s<4;++u,++s){uc(u%2?n:r,u%4>=2),i=bs.buildLayerMatrix(t);var c=tc(t,i);c<a&&(s=0,o=cs.cloneDeep(i),a=c)}sc(t,o)}(t)})),e(" insertSelfEdges",(function(){!function(t){var e=pc.buildLayerMatrix(t);cs.forEach(e,(function(e){var n=0;cs.forEach(e,(function(e,r){var i=t.node(e);i.order=r+n,cs.forEach(i.selfEdges,(function(e){pc.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){!function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||Zs(t)}(t)})),e(" position",(function(){!function(t){(function(t){var e=bs.buildLayerMatrix(t),n=t.graph().ranksep,r=0;cs.forEach(e,(function(e){var i=cs.max(cs.map(e,(function(e){return t.node(e).height})));cs.forEach(e,(function(e){t.node(e).y=r+i/2})),r+=i+n}))})(t=bs.asNonCompoundGraph(t)),cs.forEach(function(t){var e,n=bs.buildLayerMatrix(t),r=cs.merge(function(t,e){var n={};return cs.reduce(e,(function(e,r){var i=0,o=0,a=e.length,u=cs.last(r);return cs.forEach(r,(function(e,s){var c=function(t,e){if(t.node(e).dummy)return cs.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),f=c?t.node(c).order:a;(c||e===u)&&(cs.forEach(r.slice(o,s+1),(function(e){cs.forEach(t.predecessors(e),(function(r){var o=t.node(r),a=o.order;!(a<i||f<a)||o.dummy&&t.node(e).dummy||fc(n,r,e)}))})),o=s+1,i=f)})),r})),n}(t,n),function(t,e){var n={};function r(e,r,i,o,a){var u;cs.forEach(cs.range(r,i),(function(r){u=e[r],t.node(u).dummy&&cs.forEach(t.predecessors(u),(function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&fc(n,e,u)}))}))}return cs.reduce(e,(function(e,n){var i,o=-1,a=0;return cs.forEach(n,(function(u,s){if("border"===t.node(u).dummy){var c=t.predecessors(u);c.length&&(i=t.node(c[0]).order,r(n,a,s,o,i),a=s,o=i)}r(n,a,n.length,i,e.length)})),n})),n}(t,n)),i={};cs.forEach(["u","d"],(function(o){e="u"===o?n:cs.values(n).reverse(),cs.forEach(["l","r"],(function(n){"r"===n&&(e=cs.map(e,(function(t){return cs.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),u=function(t,e,n,r){var i={},o={},a={};return cs.forEach(e,(function(t){cs.forEach(t,(function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),cs.forEach(e,(function(t){var e=-1;cs.forEach(t,(function(t){var u=r(t);if(u.length)for(var s=((u=cs.sortBy(u,(function(t){return a[t]}))).length-1)/2,c=Math.floor(s),f=Math.ceil(s);c<=f;++c){var l=u[c];o[t]===t&&e<a[l]&&!lc(n,t,l)&&(o[l]=t,o[t]=i[t]=i[l],e=a[l])}}))})),{root:i,align:o}}(0,e,r,a),s=function(t,e,n,r,i){var o={},a=function(t,e,n,r){var i=new cc,o=t.graph(),a=function(t,e,n){return function(r,i,o){var a,u=r.node(i),s=r.node(o),c=0;if(c+=u.width/2,cs.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(c+=n?a:-a),a=0,c+=(u.dummy?e:t)/2,c+=(s.dummy?e:t)/2,c+=s.width/2,cs.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=s.width/2;break;case"r":a=-s.width/2}return a&&(c+=n?a:-a),a=0,c}}(o.nodesep,o.edgesep,r);return cs.forEach(e,(function(e){var r;cs.forEach(e,(function(e){var o=n[e];if(i.setNode(o),r){var u=n[r],s=i.edge(u,o);i.setEdge(u,o,Math.max(a(t,e,r),s||0))}r=e}))})),i}(t,e,n,i),u=i?"borderLeft":"borderRight";function s(t,e){for(var n=a.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}return s((function(t){o[t]=a.inEdges(t).reduce((function(t,e){return Math.max(t,o[e.v]+a.edge(e))}),0)}),a.predecessors.bind(a)),s((function(e){var n=a.outEdges(e).reduce((function(t,e){return Math.min(t,o[e.w]-a.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(o[e]=Math.max(o[e],n))}),a.successors.bind(a)),cs.forEach(r,(function(t){o[t]=o[n[t]]})),o}(t,e,u.root,u.align,"r"===n);"r"===n&&(s=cs.mapValues(s,(function(t){return-t}))),i[o+n]=s}))}));var o=function(t,e){return cs.minBy(cs.values(e),(function(e){var n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return cs.forIn(e,(function(e,i){var o=function(t,e){return t.node(e).width}(t,i)/2;n=Math.max(e+o,n),r=Math.min(e-o,r)})),n-r}))}(t,i);return function(t,e){var n=cs.values(e),r=cs.min(n),i=cs.max(n);cs.forEach(["u","d"],(function(n){cs.forEach(["l","r"],(function(o){var a,u=n+o,s=t[u];if(s!==e){var c=cs.values(s);(a="l"===o?r-cs.min(c):i-cs.max(c))&&(t[u]=cs.mapValues(s,(function(t){return t+a})))}}))}))}(i,o),function(t,e){return cs.mapValues(t.ul,(function(n,r){if(e)return t[e.toLowerCase()][r];var i=cs.sortBy(cs.map(t,r));return(i[1]+i[2])/2}))}(i,t.graph().align)}(t),(function(e,n){t.node(n).x=e}))}(t)})),e(" positionSelfEdges",(function(){!function(t){cs.forEach(t.nodes(),(function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,u=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){cs.forEach(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(cs.last(n.borderLeft)),a=t.node(cs.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}})),cs.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){!function(t){cs.forEach(t.graph().dummyChains,(function(e){var n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)}))}(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);if(cs.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){!function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){cs.forEach(t.nodes(),(function(e){Js(t.node(e))})),cs.forEach(t.edges(),(function(e){var n=t.edge(e);cs.forEach(n.points,Js),cs.has(n,"y")&&Js(n)}))}(t),"lr"!==e&&"rl"!==e||(function(t){cs.forEach(t.nodes(),(function(e){Qs(t.node(e))})),cs.forEach(t.edges(),(function(e){var n=t.edge(e);cs.forEach(n.points,Qs),cs.has(n,"x")&&Qs(n)}))}(t),Zs(t))}(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,u=o.marginy||0;function s(t){var o=t.x,a=t.y,u=t.width,s=t.height;e=Math.min(e,o-u/2),n=Math.max(n,o+u/2),r=Math.min(r,a-s/2),i=Math.max(i,a+s/2)}cs.forEach(t.nodes(),(function(e){s(t.node(e))})),cs.forEach(t.edges(),(function(e){var n=t.edge(e);cs.has(n,"x")&&s(n)})),e-=a,r-=u,cs.forEach(t.nodes(),(function(n){var i=t.node(n);i.x-=e,i.y-=r})),cs.forEach(t.edges(),(function(n){var i=t.edge(n);cs.forEach(i.points,(function(t){t.x-=e,t.y-=r})),cs.has(i,"x")&&(i.x-=e),cs.has(i,"y")&&(i.y-=r)})),o.width=n-e+a,o.height=i-r+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(pc.intersectRect(o,n)),i.points.push(pc.intersectRect(a,r))}))}(t)})),e(" reversePoints",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}(t)}))}(e,n)})),n(" updateInputGraph",(function(){!function(t,e){cs.forEach(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),cs.forEach(t.edges(),(function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,cs.has(i,"x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))},debug:{debugOrdering:function(t){var e=bs.buildLayerMatrix(t),n=new Tc({compound:!0,multigraph:!0}).setGraph({});return cs.forEach(t.nodes(),(function(e){n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)})),cs.forEach(t.edges(),(function(t){n.setEdge(t.v,t.w,{},t.name)})),cs.forEach(e,(function(t,e){var r="layer"+e;n.setNode(r,{rank:"same"}),cs.reduce(t,(function(t,e){return n.setEdge(t,e,{style:"invis"}),e}))})),n}},util:{time:bs.time,notime:bs.notime},version:"0.8.5"},Nc=Ic.graphlib,Oc=Ic.layout;class Cc{constructor(t){this.cardinality=1,this.include=dr.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=lr.NODE,this.name=t.name,this.attr=t.attr||{},this.inputs=t.inputs,this.path=t.path||[],this.width=t.width,this.height=t.height}}class kc{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}class Dc{constructor(t,e={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=dr.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=lr.META,this.path=[],this.name=t,this.metaGraph=Gc(t,hr.META,e)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map((t=>this.metaGraph.node(t)))}leaves(){let t,e=[],n=[this];for(;n.length;){let r=n.shift();r.isGroupNode?(t=r.metaGraph,t.nodes().forEach((e=>n.push(t.node(e))))):e.push(r.name)}return e}}class Mc{constructor(t,e){this.v=t,this.w=e,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(t,e){this.baseEdgeList.push(t)}}function Rc(t,e={}){return new Dc(t,e)}function Pc(t,e){return new Mc(t,e)}function Gc(t,e,n){const r=n||{},i=new Nc.Graph(r);return i.setGraph({name:t,rankdir:r.rankdir,type:e,align:r.align}),i}class Lc{constructor(t={}){this.graphOptions=t,this.index={},this.graphOptions.compound=!0,this.root=Rc(cr,this.graphOptions),this.index[cr]=this.root}getNodeMap(){return this.index}node(t){return this.index[t]}setNode(t,e){this.index[t]=e}getBridgeGraph(t){const e=this.index[t];if(!e)throw Error("Could not find node in hierarchy: "+t);if(!("metaGraph"in e))return null;const n=e;if(n.bridgeGraph)return n.bridgeGraph;const r=Gc(fr,hr.BRIDGE,this.graphOptions);if(n.bridgeGraph=r,!e.parentNode||!("metaGraph"in e.parentNode))return r;const i=e.parentNode;return[i.metaGraph,this.getBridgeGraph(i.name)].forEach((e=>{e.edges().filter((e=>e.v===t||e.w===t)).forEach((n=>{const i=n.w===t;e.edge(n).baseEdgeList.forEach((e=>{const[o,a]=i?[e.w,n.v]:[e.v,n.w],u=this.getChildName(t,o),s={v:i?a:u,w:i?u:a};let c=r.edge(s);c||(c=Pc(s.v,s.w),c.inbound=i,r.setEdge(s.v,s.w,c)),c.addBaseEdge(e,this)}))}))})),r}getChildName(t,e){let n=this.index[e];for(;n;){if(n.parentNode&&n.parentNode.name===t)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+e)}getPredecessors(t){const e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!0)}getSuccessors(t){const e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!1)}getOneWayEdges(t,e){const n=[];if(!t.parentNode||!t.parentNode.isGroupNode)return n;const r=t.parentNode,i=r.metaGraph,o=this.getBridgeGraph(r.name);return jc(i,t,e,n),jc(o,t,e,n),n}}function jc(t,e,n,r){(n?t.inEdges(e.name):t.outEdges(e.name)).forEach((e=>{const n=t.edge(e);r.push(n)}))}class Fc{constructor(t){this.hierarchy=t,this.index={},this.hasSubHierarchy={},this.root=new zc(this.hierarchy.root,this.hierarchy.graphOptions),this.index[t.root.name]=this.root,this.buildSubHierarchy(t.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(t){if(t in this.hasSubHierarchy)return;this.hasSubHierarchy[t]=!0;const e=this.index[t];if(e.node.type!==lr.META)return;const n=e,r=n.node.metaGraph,i=n.coreGraph;r.nodes().forEach((t=>{const e=this.getOrCreateRenderNodeByName(t);i.setNode(t,e)})),r.edges().forEach((t=>{const e=r.edge(t),n=new Bc(e);i.setEdge(t.v,t.w,n)}));const o=n.node.parentNode;if(!o)return;const a=this.getRenderNodeByName(o.name),u=(t,...e)=>e.concat([t?"IN":"OUT"]).join("~~"),s=this.hierarchy.getBridgeGraph(t);s.edges().forEach((e=>{const n=s.edge(e),c=!!r.node(e.w),[f,l]=c?[e.w,e.v]:[e.v,e.w],d=e=>{const n=c?{v:e,w:t}:{v:t,w:e};return a.coreGraph.edge(n)};let h=d(l);h||(h=d(u(c,l,o.name)));const p=u(c,t),v=u(c,l,t);let g=i.node(v);if(!g){let t=i.node(p);if(!t){const e={name:p,type:lr.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:dr.UNSPECIFIED,inbound:c,attr:{}};t=new Uc(e),this.index[p]=t,i.setNode(p,t)}const e={name:v,type:lr.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:dr.UNSPECIFIED,inbound:c,attr:{}};g=new Uc(e),this.index[v]=g,i.setNode(v,g),i.setParent(v,p),t.node.cardinality++}const y=new Bc(n);y.adjoiningMetaEdge=h,c?i.setEdge(v,f,y):i.setEdge(f,v,y)}))}getOrCreateRenderNodeByName(t){if(!t)return null;if(t in this.index)return this.index[t];const e=this.getNodeByName(t);return e?(this.index[t]=e.isGroupNode?new zc(e,this.hierarchy.graphOptions):new Uc(e),this.index[t]):null}getRenderNodeByName(t){return this.index[t]}getNodeByName(t){return this.hierarchy.node(t)}}class Uc{constructor(t){this.node=t,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=t.width||0,this.height=t.height||0,this.displayName=t.name,this.attr=t.attr}}class Bc{constructor(t){this.metaEdge=t,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class zc extends Uc{constructor(t,e){super(t);const n=t.metaGraph.graph();e.compound=!0,this.coreGraph=Gc(n.name,hr.CORE,e)}}function Vc(t,e){t.node.isGroupNode&&function(t,e){const n=ur(e);t.coreGraph.nodes().map((e=>t.coreGraph.node(e))).forEach((t=>{var r,i,o,a,u,s;const{height:c,width:f}=t;switch(t.node.type){case lr.NODE:Object.assign(t,n.nodeSize.node),t.height=c||n.nodeSize.node.height,t.width=f||n.nodeSize.node.width;break;case lr.BRIDGE:Object.assign(t,n.nodeSize.bridge);break;case lr.META:t.expanded?Vc(t,e):(Object.assign(t,n.nodeSize.meta),t.height=n.nodeSize.meta.height,t.width=n.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+t.node.type)}if(!t.expanded){const n=t.attr;!function(t,e=!1){if(t.coreBox.width=t.width,t.coreBox.height=t.height,!e){const e=`${t.displayName}`.length,n=3;t.width=Math.max(t.coreBox.width,e*n)}}(t,e&&(0===t.node.type&&!!(null===(i=null===(r=null==e?void 0:e.nodeSize)||void 0===r?void 0:r.meta)||void 0===i?void 0:i.width)||1===t.node.type&&(!!(null===(a=null===(o=null==e?void 0:e.nodeSize)||void 0===o?void 0:o.node)||void 0===a?void 0:a.width)||!!n.width)||2===t.node.type&&!!(null===(s=null===(u=null==e?void 0:e.nodeSize)||void 0===u?void 0:u.bridge)||void 0===s?void 0:s.width)))}}))}(t,e),t.node.type===lr.META&&function(t,e){const n=ur(e),r=n.subScene.meta;Object.assign(t,r);const{nodeSep:i,rankSep:o,edgeSep:a,align:u}=n.graph.meta,s={nodesep:i,ranksep:o,edgesep:a,align:u};Object.assign(t.coreBox,function(t,e){const{ranksep:n,nodesep:r,edgesep:i,align:o}=e;Object.assign(t.graph(),{ranksep:n,nodesep:r,edgesep:i,align:o});const a=[];if(t.nodes().forEach((e=>{t.node(e).node.type!==lr.BRIDGE&&a.push(e)})),!a.length)return{width:0,height:0};Oc(t);let u=1/0,s=1/0,c=-1/0,f=-1/0;return a.forEach((e=>{const n=t.node(e),r=.5*n.width,i=n.x-r,o=n.x+r;u=i<u?i:u,c=o>c?o:c;const a=.5*n.height,l=n.y-a,d=n.y+a;s=l<s?l:s,f=d>f?d:f})),t.edges().forEach((e=>{const n=t.edge(e),r=t.node(n.metaEdge.v),i=t.node(n.metaEdge.w);if(3===n.points.length&&function(t){let e=Wc(t[0],t[1]);for(let n=1;n<t.length-1;n++){const r=Wc(t[n],t[n+1]);if(Math.abs(r-e)>1)return!1;e=r}return!0}(n.points)){if(null!=r){const t=r.expanded?r.x:Hc(r);n.points[0].x=t}if(null!=i){const t=i.expanded?i.x:Hc(i);n.points[2].x=t}n.points=[n.points[0],n.points[1]]}const o=n.points[n.points.length-2];null!=i&&(n.points[n.points.length-1]=Xc(o,i));const a=n.points[1];null!=r&&(n.points[0]=Xc(a,r)),n.points.forEach((t=>{u=t.x<u?t.x:u,c=t.x>c?t.x:c,s=t.y<s?t.y:s,f=t.y>f?t.y:f}))})),t.nodes().forEach((e=>{const n=t.node(e);n.x-=u,n.y-=s})),t.edges().forEach((e=>{t.edge(e).points.forEach((t=>{t.x-=u,t.y-=s}))})),{width:c-u,height:f-s}}(t.coreGraph,s));let c=0;t.coreGraph.nodeCount()>0&&c++;const f=c<=1?0:c;t.coreBox.width+=f+f,t.coreBox.height=r.labelHeight+t.coreBox.height,t.width=t.coreBox.width+r.paddingLeft+r.paddingRight,t.height=t.paddingTop+t.coreBox.height+t.paddingBottom}(t,e)}function Wc(t,e){const n=e.x-t.x,r=e.y-t.y;return 180*Math.atan(r/n)/Math.PI}function Hc(t){return t.expanded?t.x:t.x-t.width/2+0+t.coreBox.width/2}function Xc(t,e){const n=e.expanded?e.x:Hc(e),r=e.y,i=t.x-n,o=t.y-r;let a,u,s=e.expanded?e.width:e.coreBox.width,c=e.expanded?e.height:e.coreBox.height;return Math.abs(o)*s/2>Math.abs(i)*c/2?(o<0&&(c=-c),a=0===o?0:c/2*i/o,u=c/2):(i<0&&(s=-s),a=s/2,u=0===i?0:s/2*o/i),{x:n+a,y:r+u}}function qc(t,e,n){var r,i,o,a;const u=t.nodes.filter(((t,e,n)=>n.findIndex((e=>e.id===t.id))!==e)).map((t=>t.id));if(u.length)throw new Error(`Duplicated ids found: ${u.join(", ")}`);const s=function(t){const e={nodes:[]},n=t.compound,r=Object.keys(n||{}),i=new Map,o=(t,e=[])=>{if(i.has(t))return i.get(t);for(let i=0;i<r.length;i++){let a=r[i];if(n&&-1!==n[a].indexOf(t))return e.unshift(a),o(a,e)}return 0===e.length&&i.set(t,e),e},a=e=>t.edges.filter((t=>t.w===e)).map((t=>({name:t.v})));return t.nodes.forEach((t=>{const n=t.id,r=[...o(n),n];let i=a(n);e.nodes.push({name:n,path:r,inputs:i,width:t.width,height:t.height,attr:Object.assign({},t)})})),e}(t),c=function(t,e){const n=(t,e)=>{for(let n of e.values())if(n.includes(t))return!0;return!1},r=(t,e=[])=>{if(0===Object.keys(t).length)return[...new Set(e)];const i=new Map(Object.keys(t).map((e=>[e,t[e]]))),o={};for(let[t,r]of i)n(t,i)?o[t]=r:e=e.concat(t,r);return r(o,e)};return r(t).filter((t=>e.includes(t)))}(t.compound||{},(null==e?void 0:e.expanded)||[]),f=function(t,e){return function(t){return new Fc(t)}(function(t,e){const{rankDirection:n,align:r}=e,i=new Lc({rankdir:n,align:r});return function(t,e){Object.keys(e.nodes).forEach((n=>{const r=e.nodes[n],i=r.path;let o=t.root;o.depth=Math.max(i.length,o.depth);for(let e=0;e<i.length&&(o.depth=Math.max(o.depth,i.length-e),o.cardinality+=r.cardinality,e!==i.length-1);e++){const n=i[e];let a=t.node(n);a||(a=Rc(n,t.graphOptions),a.path=r.path.slice(0,e+1),a.parentNode=o,t.setNode(n,a),o.metaGraph.setNode(n,a)),o=a}t.setNode(r.name,r),r.parentNode=o,o.metaGraph.setNode(r.name,r)}))}(i,t),function(t,e){const n=t.getNodeMap();let r=[],i=[];const o=(t,e)=>{let n=0;for(;t;)e[n++]=t.name,t=t.parentNode;return n-1};e.edges.forEach((a=>{r=[],i=[];let u=o(e.nodes[a.v],r),s=o(e.nodes[a.w],i);for(;r[u]===i[s];)if(u--,s--,u<0||s<0)throw Error("No difference found between ancestor paths.");const c=n[r[u+1]],f=r[u],l=i[s];let d=c.metaGraph.edge(f,l);d||(d=Pc(f,l),c.metaGraph.setEdge(f,l,d)),d.addBaseEdge(a,t)}))}(i,t),i}(function(t){const e=new kc;return t.nodes.map((t=>new Cc(t))).forEach((t=>{e.nodes[t.name]=t,t.inputs.forEach((n=>{!function(t,e,n){n.name!==e.name&&t.edges.push(Object.assign(Object.assign({},n.attr),{v:n.name,w:e.name}))}(e,t,n)}))})),e}(t),e))}(s,{rankDirection:(null===(i=null===(r=null==n?void 0:n.graph)||void 0===r?void 0:r.meta)||void 0===i?void 0:i.rankDir)||(null==e?void 0:e.rankDirection)||ar.graph.meta.rankDir,align:(null===(a=null===(o=null==n?void 0:n.graph)||void 0===o?void 0:o.meta)||void 0===a?void 0:a.align)||ar.graph.meta.align});return function(t,e){e.forEach((e=>{const n=t.getRenderInfoNodes().find((t=>t.displayName===e));let r=n&&n.node&&n.node.name||"";const i=t.getRenderNodeByName(r);if(!i)throw new Error(`No nodes found: ${r}`);i.expanded=!0,t.buildSubHierarchy(r)}))}(f,c),Vc(f.root,n),Kc(f.root)}function Yc(t,e,n,r){var i,o;let a=[];const u=(null===(i=n.find((e=>e.id===t)))||void 0===i?void 0:i.path)||[],s=(null===(o=n.find((t=>t.id===e)))||void 0===o?void 0:o.path)||[],c=[cr,...u].slice(0,u.length).reverse(),f=[cr,...s].slice(0,s.length);return c.forEach((i=>{const o=n.find((t=>t.id===i));a=a.concat(o.edges.filter((n=>n.baseEdgeList.some((n=>n.v===((null==r?void 0:r.v)||t)&&n.w===((null==r?void 0:r.w)||e))))))})),f.filter((t=>!c.includes(t))).forEach((i=>{const o=n.find((t=>t.id===i));a=a.concat(o.edges.filter((n=>n.baseEdgeList.some((n=>n.v===((null==r?void 0:r.v)||t)&&n.w===((null==r?void 0:r.w)||e))))))})),a}function Kc(t){const e=t.coreGraph.nodes().map((e=>t.coreGraph.node(e)));return Object.assign(Object.assign({},Zc(t)),{expanded:t.expanded,nodes:t.expanded?(n=e,n.map((t=>t.node.type===lr.META?Kc(t):Zc(t)))):[],edges:t.expanded?$c(t):[]});var n}function Zc(t){return{id:t.node.name,name:t.node.name,type:t.node.type,cardinality:t.node.cardinality,attr:t.attr,parentNodeName:t.node.parentNode?t.node.parentNode.name:null,coreBox:Object.assign({},t.coreBox),x:t.x,y:t.y,width:t.width,height:t.height,radius:t.radius,labelHeight:t.labelHeight,labelOffset:t.labelOffset,outboxWidth:t.outboxWidth,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom,path:t.node.path}}function $c(t){return t.coreGraph.edges().map((e=>({renderInfoEdge:t.coreGraph.edge(e),edge:e}))).filter((({renderInfoEdge:t})=>t.metaEdge)).map((({edge:e,renderInfoEdge:n})=>{const r=function(t,e){const n=e.points.map((t=>Object.assign({},t)));if(e.adjoiningMetaEdge){const r=e.adjoiningMetaEdge.points,i=e.metaEdge.inbound,o=i?r[r.length-1]:r[0],a=n[i?0:n.length-1],u=t.x-t.width/2,s=t.y-t.height/2,c=o.x-u,f=o.y-s,l=-t.paddingLeft,d=-(t.paddingTop+t.labelHeight);a.x=c+l,a.y=f+d}return n}(t,n);return{adjoiningEdge:n.adjoiningMetaEdge?{w:n.adjoiningMetaEdge.metaEdge.w,v:n.adjoiningMetaEdge.metaEdge.v}:null,inbound:n.metaEdge.inbound,w:e.w,v:e.v,points:r,weight:n.weight,baseEdgeList:n.metaEdge.baseEdgeList,parentNodeName:t.node.name}}))}var Jc=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qc=function(){return Qc=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},Qc.apply(this,arguments)},tf=function(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)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},ef=function(t){function e(e){var n=t.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.edgesep=5,n.ranksep=50,n.controlPoints=!0,n.anchorPoint=!0,n.nodes=[],n.edges=[],n.combos=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return Jc(e,t),e.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,begin:void 0,nodeSize:void 0,nodesep:50,ranksep:50,controlPoints:!0,anchorPoint:!0}},e.prototype.init=function(t){var e=t.hiddenNodes||[],n=t.hiddenEdges||[],r=t.hiddenCombos||[];this.nodes=this.getDataByOrder((t.nodes||[]).concat(e)),this.edges=this.getDataByOrder((t.edges||[]).concat(n)),this.combos=(t.combos||[]).concat(r.map((function(t){return Qc(Qc({},t),{collapsed:!0})})))},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges;if(e){var r=t.getLayoutConfig(),i=function(t,e=!1){const n=JSON.parse(JSON.stringify(t)),r={nodes:[n],edges:[...n.edges]};return n.nodes.forEach((function t(e){(0===e.type||1===e.type)&&r.nodes.push(e),0===e.type&&(r.edges=r.edges.concat(e.edges)),Array.isArray(e.nodes)&&e.nodes.forEach(t)})),e&&r.nodes.forEach((t=>{const e=r.nodes.find((e=>e.id===t.parentNodeName));if(e){const n=e.x-e.width/2+e.paddingLeft,r=e.y-e.height/2+e.labelHeight+e.paddingTop;e.id!==cr&&(t.x+=n,t.y+=r),0===t.type&&t.edges.forEach((e=>{e.points.forEach((e=>{e.x+=t.x-t.width/2+t.paddingLeft,e.y+=t.y-t.height/2+t.labelHeight+t.paddingTop}))}))}})),r}(qc(r.graphDef,r.graphOption,r.graphSettings),!0);return this.updatePosition(i),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:n}}},e.prototype.getNodePath=function(t){var e=this.nodes,n=this.combos,r=e.find((function(e){return e.id===t}));return r&&r.comboId?function t(e,r){void 0===r&&(r=[]);var i=n.find((function(t){return t.id===e}));return i?(r.unshift(e),i.parentId?t(i.parentId,r):r):r}(r.comboId,[t]):[t]},e.prototype.getLayoutConfig=function(){var t,e,n,r,o=this,a=o.nodes,u=o.edges,s=o.combos,c=o.nodeSize,l=o.rankdir,d=o.align,h=o.edgesep,p=o.nodesep,v=o.ranksep,g=o.settings,y=(s||[]).reduce((function(t,e){var n=a.filter((function(t){return t.comboId===e.id})).map((function(t){return t.id})),r=(s||[]).filter((function(t){return t.parentId===e.id})).map((function(t){return t.id}));return(n.length||r.length)&&(t[e.id]=tf(tf([],n,!0),r,!0)),t}),{});r=c?i(c)?function(){return c}:function(){return[c,c]}:function(t){return t&&t.size?i(t.size)?t.size:f(t.size)?[t.size.width||40,t.size.height||40]:[t.size,t.size]:[40,40]};var m=function(t){return t&&t.size?i(t.size)?t.size:[t.size,t.size]:[80,40]}(null==s?void 0:s[0]),b=m[0],_=m[1],x=null===(e=null===(t=o.graphSettings)||void 0===t?void 0:t.subScene)||void 0===e?void 0:e.meta,w=(null===(n=s.find((function(t){return!t.collapsed})))||void 0===n?void 0:n.padding)||[20,20,20,20],E=w[0],S=w[1],A=w[2],T=w[3],I={compound:y,nodes:tf([],(a||[]).map((function(t){var e=r(t),n=e[0],i=e[1];return Qc(Qc({},t),{width:n,height:i})})),!0),edges:tf([],(u||[]).map((function(t){return Qc(Qc({},t),{v:t.source,w:t.target})})),!0)},N={expanded:(s||[]).filter((function(t){return!t.collapsed})).map((function(t){return t.id}))},O={graph:{meta:{align:d,rankDir:l,nodeSep:p,edgeSep:h,rankSep:v}},subScene:{meta:{paddingTop:E||(null==x?void 0:x.paddingTop)||20,paddingRight:S||(null==x?void 0:x.paddingRight)||20,paddingBottom:A||(null==x?void 0:x.paddingBottom)||20,paddingLeft:T||(null==x?void 0:x.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:b,height:_}}},C=ur(g,Qc({},ur(O,ar)));return o.graphSettings=C,{graphDef:I,graphOption:N,graphSettings:C}},e.prototype.updatePosition=function(t){var e=t.nodes,n=t.edges;this.updateNodePosition(e,n),this.updateEdgePosition(e,n)},e.prototype.getBegin=function(t,e){var n=this.begin,r=[0,0];if(n){var i=1/0,o=1/0;t.forEach((function(t){i>t.x&&(i=t.x),o>t.y&&(o=t.y)})),e.forEach((function(t){t.points.forEach((function(t){i>t.x&&(i=t.x),o>t.y&&(o=t.y)}))})),r[0]=n[0]-i,r[1]=n[1]-o}return r},e.prototype.updateNodePosition=function(t,e){var n=this,r=n.combos,i=n.nodes,o=n.edges,a=n.anchorPoint,u=n.graphSettings,s=this.getBegin(t,e);t.forEach((function(t){var n,c=t.x,f=t.y,l=t.id,d=t.type,h=t.coreBox;if(d===pr.META&&l!==cr){var p=r.findIndex((function(t){return t.id===l})),v=null===(n=null==u?void 0:u.subScene)||void 0===n?void 0:n.meta;r[p].offsetX=c+s[0],r[p].offsetY=f+s[1],r[p].fixSize=[h.width,h.height],r[p].fixCollapseSize=[h.width,h.height],t.expanded?r[p].padding=[null==v?void 0:v.paddingTop,null==v?void 0:v.paddingRight,null==v?void 0:v.paddingBottom,null==v?void 0:v.paddingLeft]:r[p].padding=[0,0,0,0]}else if(d===pr.OP&&(p=i.findIndex((function(t){return t.id===l})),i[p].x=c+s[0],i[p].y=f+s[1],a)){var g=[],y=e.filter((function(t){return t.v===l})),m=e.filter((function(t){return t.w===l}));y.length>0&&y.forEach((function(e){var n=e.points[0],r=(n.x-c)/t.width+.5,i=(n.y-f)/t.height+.5;g.push([r,i]),e.baseEdgeList.forEach((function(t){var e=o.find((function(e){return e.source===t.v&&e.target===t.w}));e&&(e.sourceAnchor=g.length-1)}))})),m.length>0&&m.forEach((function(e){var n=e.points[e.points.length-1],r=(n.x-c)/t.width+.5,i=(n.y-f)/t.height+.5;g.push([r,i]),e.baseEdgeList.forEach((function(t){var e=o.find((function(e){return e.source===t.v&&e.target===t.w}));e&&(e.targetAnchor=g.length-1)}))})),i[p].anchorPoints=g.length>0?g:i[p].anchorPoints||[]}}))},e.prototype.updateEdgePosition=function(t,e){var n=this,r=n.combos,i=n.edges,o=n.controlPoints,a=this.getBegin(t,e);o&&(r.forEach((function(t){t.inEdges=[],t.outEdges=[]})),i.forEach((function(e){var i,o,u,s,c=t.find((function(t){return t.id===e.source})),f=t.find((function(t){return t.id===e.target})),l=[],d=[];if(c&&f)d=Yc(null==c?void 0:c.id,null==f?void 0:f.id,t);else if(!c||!f){var h=n.getNodePath(e.source),p=n.getNodePath(e.target),v=h.reverse().slice(c?0:1).find((function(e){return t.find((function(t){return t.id===e}))})),g=p.reverse().slice(f?0:1).find((function(e){return t.find((function(t){return t.id===e}))}));c=t.find((function(t){return t.id===v})),f=t.find((function(t){return t.id===g})),d=Yc(null==c?void 0:c.id,null==f?void 0:f.id,t,{v:e.source,w:e.target})}if(l=(l=d.reduce((function(t,e){return tf(tf([],t,!0),e.points.map((function(t){return Qc(Qc({},t),{x:t.x+a[0],y:t.y+a[1]})})),!0)}),[])).slice(1,-1),e.controlPoints=l,(null==f?void 0:f.type)===lr.META){var y=r.findIndex((function(t){return t.id===(null==f?void 0:f.id)}));if(!r[y]||(null===(i=r[y].inEdges)||void 0===i?void 0:i.some((function(t){return t.source===c.id&&t.target===f.id}))))return;null===(o=r[y].inEdges)||void 0===o||o.push({source:c.id,target:f.id,controlPoints:l})}if((null==c?void 0:c.type)===lr.META){if(y=r.findIndex((function(t){return t.id===(null==c?void 0:c.id)})),!r[y]||(null===(u=r[y].outEdges)||void 0===u?void 0:u.some((function(t){return t.source===c.id&&t.target===f.id}))))return;null===(s=r[y].outEdges)||void 0===s||s.push({source:c.id,target:f.id,controlPoints:l})}})))},e.prototype.getType=function(){return"dagreCompound"},e.prototype.getDataByOrder=function(t){return t.every((function(t){return void 0!==t.layoutOrder}))||t.forEach((function(t,e){t.layoutOrder=e})),t.sort((function(t,e){return t.layoutOrder-e.layoutOrder}))},e}(t);const nf=Object.prototype.toString;function rf(t){return nf.call(t).endsWith("Array]")}function of(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!rf(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],u=r+1;u<o;u++)t[u]>a&&(a=t[u]);return a}function af(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!rf(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],u=r+1;u<o;u++)t[u]<a&&(a=t[u]);return a}function uf(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!rf(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!rf(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=af(t),i=of(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,a=void 0===o?n.autoMinMax?r:0:o,u=n.max,s=void 0===u?n.autoMinMax?i:1:u;if(a>=s)throw new RangeError("min option must be smaller than max option");for(var c=(s-a)/(i-r),f=0;f<t.length;f++)e[f]=(t[f]-r)*c+a;return e}const sf=" ".repeat(2),cf=" ".repeat(4);function ff(t,e={}){const{maxRows:n=15,maxColumns:r=10,maxNumSize:i=8,padMinus:o="auto"}=e;return`${t.constructor.name} {\n${sf}[\n${cf}${function(t,e,n,r,i){const{rows:o,columns:a}=t,u=Math.min(o,e),s=Math.min(a,n),c=[];if("auto"===i){i=!1;t:for(let e=0;e<u;e++)for(let n=0;n<s;n++)if(t.get(e,n)<0){i=!0;break t}}for(let e=0;e<u;e++){let n=[];for(let o=0;o<s;o++)n.push(lf(t.get(e,o),r,i));c.push(`${n.join(" ")}`)}return s!==a&&(c[c.length-1]+=` ... ${a-n} more columns`),u!==o&&c.push(`... ${o-e} more rows`),c.join(`\n${cf}`)}(t,n,r,i,o)}\n${sf}]\n${sf}rows: ${t.rows}\n${sf}columns: ${t.columns}\n}`}function lf(t,e,n){return(t>=0&&n?` ${df(t,e-1)}`:df(t,e)).padEnd(e)}function df(t,e){let n=t.toString();if(n.length<=e)return n;let r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function hf(t,e,n){let r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function pf(t,e,n){let r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function vf(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function gf(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function yf(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(bf("startRow",e),bf("endRow",n),bf("startColumn",r),bf("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function mf(t,e=0){let n=[];for(let r=0;r<t;r++)n.push(e);return n}function bf(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function _f(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class xf{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let r=new Ef(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.set(i,t,n[i*e+t]);return r}static rowVector(t){let e=new Ef(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new Ef(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new Ef(t,e)}static ones(t,e){return new Ef(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:r=Math.random}=n;let i=new Ef(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.set(n,t,r());return i}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:r=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(r>=i)throw new RangeError("min must be smaller than max");let a=i-r,u=new Ef(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=r+Math.round(o()*a);u.set(n,t,e)}return u}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let r=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<r;t++)i.set(t,t,n);return i}static diag(t,e,n){let r=t.length;void 0===e&&(e=r),void 0===n&&(n=e);let i=Math.min(r,e,n),o=this.zeros(e,n);for(let e=0;e<i;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new Ef(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new this(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return i}static checkMatrix(t){return xf.isMatrix(t)?t:new Ef(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let r=e;for(let i=e;i<t.rows;i++)t.get(i,n)>t.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);let i=t.get(e,n);for(let r=n;r<t.columns;r++)t.set(e,r,t.get(e,r)/i);for(let r=e+1;r<t.rows;r++){let i=t.get(r,n)/t.get(e,n);t.set(r,n,0);for(let o=n+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*i)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,r=n-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let i=0,o=!1;for(;i<n&&!1===o;)1===t.get(r,i)?o=!0:i++;for(let n=0;n<r;n++){let o=t.get(n,i);for(let a=i;a<e;a++){let e=t.get(n,a)-o*t.get(r,a);t.set(n,a,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let r=new Ef(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){hf(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return Ef.rowVector(this.getRow(t))}setRow(t,e){hf(this,t),e=vf(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){hf(this,t),hf(this,e);for(let n=0;n<this.columns;n++){let r=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,r)}return this}getColumn(t){pf(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return Ef.columnVector(this.getColumn(t))}setColumn(t,e){pf(this,t),e=gf(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){pf(this,t),pf(this,e);for(let n=0;n<this.rows;n++){let r=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,r)}return this}addRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){hf(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){pf(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){_f(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)>t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){_f(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)<t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}maxRow(t){if(hf(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){hf(this,t),_f(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),n[1]=r);return n}minRow(t){if(hf(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){hf(this,t),_f(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),n[1]=r);return n}maxColumn(t){if(pf(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){pf(this,t),_f(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),n[0]=r);return n}minColumn(t){if(pf(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){pf(this,t),_f(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),n[0]=r);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n)*this.get(t,n);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){xf.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}mmul(t){t=Ef.checkMatrix(t);let e=this.rows,n=this.columns,r=t.columns,i=new Ef(e,r),o=new Float64Array(n);for(let a=0;a<r;a++){for(let e=0;e<n;e++)o[e]=t.get(e,a);for(let t=0;t<e;t++){let e=0;for(let r=0;r<n;r++)e+=this.get(t,r)*o[r];i.set(t,a,e)}}return i}strassen2x2(t){t=Ef.checkMatrix(t);let e=new Ef(2,2);const n=this.get(0,0),r=t.get(0,0),i=this.get(0,1),o=t.get(0,1),a=this.get(1,0),u=t.get(1,0),s=this.get(1,1),c=t.get(1,1),f=(n+s)*(r+c),l=(a+s)*r,d=n*(o-c),h=s*(u-r),p=(n+i)*c,v=f+h-p+(i-s)*(u+c),g=d+p,y=l+h,m=f-l+d+(a-n)*(r+o);return e.set(0,0,v),e.set(0,1,g),e.set(1,0,y),e.set(1,1,m),e}strassen3x3(t){t=Ef.checkMatrix(t);let e=new Ef(3,3);const n=this.get(0,0),r=this.get(0,1),i=this.get(0,2),o=this.get(1,0),a=this.get(1,1),u=this.get(1,2),s=this.get(2,0),c=this.get(2,1),f=this.get(2,2),l=t.get(0,0),d=t.get(0,1),h=t.get(0,2),p=t.get(1,0),v=t.get(1,1),g=t.get(1,2),y=t.get(2,0),m=t.get(2,1),b=t.get(2,2),_=(n-o)*(-d+v),x=(-n+o+a)*(l-d+v),w=(o+a)*(-l+d),E=n*l,S=(-n+s+c)*(l-h+g),A=(-n+s)*(h-g),T=(s+c)*(-l+h),I=(-i+c+f)*(v+y-m),N=(i-f)*(v-m),O=i*y,C=(c+f)*(-y+m),k=(-i+a+u)*(g+y-b),D=(i-u)*(g-b),M=(a+u)*(-y+b),R=E+O+r*p,P=(n+r+i-o-a-c-f)*v+x+w+E+I+O+C,G=E+S+T+(n+r+i-a-u-s-c)*g+O+k+M,L=_+a*(-l+d+p-v-g-y+b)+x+E+O+k+D,j=_+x+w+E+u*m,F=O+k+D+M+o*h,U=E+S+A+c*(-l+h+p-v-g-y+m)+I+N+O,B=I+N+O+C+s*d,z=E+S+A+T+f*b;return e.set(0,0,R),e.set(0,1,P),e.set(0,2,G),e.set(1,0,L),e.set(1,1,j),e.set(1,2,F),e.set(2,0,U),e.set(2,1,B),e.set(2,2,z),e}mmulStrassen(t){t=Ef.checkMatrix(t);let e=this.clone(),n=e.rows,r=e.columns,i=t.rows,o=t.columns;function a(t,e,n){let r=t.rows,i=t.columns;if(r===e&&i===n)return t;{let r=xf.zeros(e,n);return r=r.setSubMatrix(t,0,0),r}}r!==i&&console.warn(`Multiplying ${n} x ${r} and ${i} x ${o} matrix: dimensions do not match.`);let u=Math.max(n,i),s=Math.max(r,o);return e=a(e,u,s),function t(e,n,r,i){if(r<=512||i<=512)return e.mmul(n);r%2==1&&i%2==1?(e=a(e,r+1,i+1),n=a(n,r+1,i+1)):r%2==1?(e=a(e,r+1,i),n=a(n,r+1,i)):i%2==1&&(e=a(e,r,i+1),n=a(n,r,i+1));let o=parseInt(e.rows/2,10),u=parseInt(e.columns/2,10),s=e.subMatrix(0,o-1,0,u-1),c=n.subMatrix(0,o-1,0,u-1),f=e.subMatrix(0,o-1,u,e.columns-1),l=n.subMatrix(0,o-1,u,n.columns-1),d=e.subMatrix(o,e.rows-1,0,u-1),h=n.subMatrix(o,n.rows-1,0,u-1),p=e.subMatrix(o,e.rows-1,u,e.columns-1),v=n.subMatrix(o,n.rows-1,u,n.columns-1),g=t(xf.add(s,p),xf.add(c,v),o,u),y=t(xf.add(d,p),c,o,u),m=t(s,xf.sub(l,v),o,u),b=t(p,xf.sub(h,c),o,u),_=t(xf.add(s,f),v,o,u),x=t(xf.sub(d,s),xf.add(c,l),o,u),w=t(xf.sub(f,p),xf.add(h,v),o,u),E=xf.add(g,b);E.sub(_),E.add(w);let S=xf.add(m,_),A=xf.add(y,b),T=xf.sub(g,y);T.add(m),T.add(x);let I=xf.zeros(2*E.rows,2*E.columns);return I=I.setSubMatrix(E,0,0),I=I.setSubMatrix(S,E.rows,0),I=I.setSubMatrix(A,0,E.columns),I=I.setSubMatrix(T,E.rows,E.columns),I.subMatrix(0,r-1,0,i-1)}(e,t=a(t,u,s),u,s)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Ef(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&uf(i,{min:e,max:n,output:i}),r.setRow(t,i)}return r}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Ef(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&uf(i,{min:e,max:n,output:i}),r.setColumn(t,i)}return r}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),r=this.get(e,this.columns-1-n);this.set(e,n,r),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),r=this.get(this.rows-1-n,e);this.set(n,e,r),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=Ef.checkMatrix(t);let e=this.rows,n=this.columns,r=t.rows,i=t.columns,o=new Ef(e*r,n*i);for(let a=0;a<e;a++)for(let e=0;e<n;e++)for(let n=0;n<r;n++)for(let u=0;u<i;u++)o.set(r*a+n,i*e+u,this.get(a,e)*t.get(n,u));return o}kroneckerSum(t){if(t=Ef.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,r=this.kroneckerProduct(Ef.eye(n,n)),i=Ef.eye(e,e).kroneckerProduct(t);return r.add(i)}transpose(){let t=new Ef(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=wf){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=wf){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,r){yf(this,t,e,n,r);let i=new Ef(e-t+1,r-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=r;e++)i.set(o-t,e-n,this.get(o,e));return i}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let r=new Ef(t.length,n-e+1);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);r.set(i,o-e,this.get(t[i],o))}return r}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let r=new Ef(n-e+1,t.length);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);r.set(o-e,i,this.get(o,t[i]))}return r}setSubMatrix(t,e,n){if((t=Ef.checkMatrix(t)).isEmpty())return this;yf(this,e,e+t.rows-1,n,n+t.columns-1);for(let r=0;r<t.rows;r++)for(let i=0;i<t.columns;i++)this.set(e+r,n+i,t.get(r,i));return this}selection(t,e){!function(t,e){if(!rf(e))throw new TypeError("row indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!rf(e))throw new TypeError("column indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let n=new Ef(t.length,e.length);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<e.length;t++){let o=e[t];n.set(r,t,this.get(i,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){let t=new Ef(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(e,n,this.get(e,n));return t}sum(t){switch(t){case"row":return function(t){let e=mf(t.rows);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]+=t.get(n,r);return e}(this);case"column":return function(t){let e=mf(t.columns);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]+=t.get(n,r);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e+=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=mf(t.rows,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]*=t.get(n,r);return e}(this);case"column":return function(t){let e=mf(t.columns,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]*=t.get(n,r);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e*=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:r=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!rf(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<r;a++){let r=0,u=0,s=0;for(let e=0;e<i;e++)s=t.get(a,e)-n[a],r+=s,u+=s*s;e?o.push((u-r*r/i)/(i-1)):o.push((u-r*r/i)/i)}return o}(this,n,r);case"column":if(!rf(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<i;a++){let i=0,u=0,s=0;for(let e=0;e<r;e++)s=t.get(e,a)-n[a],i+=s,u+=s*s;e?o.push((u-i*i/r)/(r-1)):o.push((u-i*i/r)/r)}return o}(this,n,r);case void 0:if("number"!=typeof r)throw new TypeError("mean must be a number");return function(t,e,n){const r=t.rows,i=t.columns,o=r*i;let a=0,u=0,s=0;for(let e=0;e<r;e++)for(let r=0;r<i;r++)s=t.get(e,r)-n,a+=s,u+=s*s;return e?(u-a*a/o)/(o-1):(u-a*a/o)/o}(this,n,r);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!rf(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[n])}(this,n),this;case"column":if(!rf(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[r])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let r=0;for(let e=0;e<t.columns;e++)r+=Math.pow(t.get(n,e),2)/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!rf(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let r=0;for(let e=0;e<t.rows;e++)r+=Math.pow(t.get(e,n),2)/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!rf(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[r])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let r=0;r<t.columns;r++)for(let i=0;i<t.rows;i++)n+=Math.pow(t.get(i,r),2)/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return ff(this,t)}}function wf(t,e){return t-e}xf.prototype.klass="Matrix","undefined"!=typeof Symbol&&(xf.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return ff(this)}),xf.random=xf.rand,xf.randomInt=xf.randInt,xf.diagonal=xf.diag,xf.prototype.diagonal=xf.prototype.diag,xf.identity=xf.eye,xf.prototype.negate=xf.prototype.neg,xf.prototype.tensorProduct=xf.prototype.kroneckerProduct;class Ef extends xf{constructor(t,e){if(super(),Ef.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e))}else{if(!rf(t))throw new TypeError("First argument must be a positive number or an array");{const n=t;if("number"!=typeof(e=(t=n.length)?n[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<t;r++){if(n[r].length!==e)throw new RangeError("Inconsistent array dimensions");if(!n[r].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[r]))}}}this.rows=t,this.columns=e}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return hf(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),hf(this,t,!0),e=Float64Array.from(vf(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){pf(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let r=0;r<t;r++)n[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)n[r-1]=this.data[e][r];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),pf(this,t,!0),e=gf(this,e);for(let n=0;n<this.rows;n++){const r=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)r[i]=this.data[n][i];for(r[i++]=e[n];i<this.columns+1;i++)r[i]=this.data[n][i-1];this.data[n]=r}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t.get(e,n)));return this}}(xf,Ef);class Sf extends xf{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}function Af(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class Tf{constructor(t,e={}){if((t=Sf.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,r=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:a=!1}=e;let u,s=Boolean(i),c=Boolean(o),f=!1;if(n<r)if(a){u=t.transpose(),n=u.rows,r=u.columns,f=!0;let e=s;s=c,c=e}else u=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else u=t.clone();let l=Math.min(n,r),d=Math.min(n+1,r),h=new Float64Array(d),p=new Ef(n,l),v=new Ef(r,r),g=new Float64Array(r),y=new Float64Array(n),m=new Float64Array(d);for(let t=0;t<d;t++)m[t]=t;let b=Math.min(n-1,r),_=Math.max(0,Math.min(r-2,n)),x=Math.max(b,_);for(let t=0;t<x;t++){if(t<b){h[t]=0;for(let e=t;e<n;e++)h[t]=Af(h[t],u.get(e,t));if(0!==h[t]){u.get(t,t)<0&&(h[t]=-h[t]);for(let e=t;e<n;e++)u.set(e,t,u.get(e,t)/h[t]);u.set(t,t,u.get(t,t)+1)}h[t]=-h[t]}for(let e=t+1;e<r;e++){if(t<b&&0!==h[t]){let r=0;for(let i=t;i<n;i++)r+=u.get(i,t)*u.get(i,e);r=-r/u.get(t,t);for(let i=t;i<n;i++)u.set(i,e,u.get(i,e)+r*u.get(i,t))}g[e]=u.get(t,e)}if(s&&t<b)for(let e=t;e<n;e++)p.set(e,t,u.get(e,t));if(t<_){g[t]=0;for(let e=t+1;e<r;e++)g[t]=Af(g[t],g[e]);if(0!==g[t]){g[t+1]<0&&(g[t]=0-g[t]);for(let e=t+1;e<r;e++)g[e]/=g[t];g[t+1]+=1}if(g[t]=-g[t],t+1<n&&0!==g[t]){for(let e=t+1;e<n;e++)y[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<r;n++)y[e]+=g[n]*u.get(e,n);for(let e=t+1;e<r;e++){let r=-g[e]/g[t+1];for(let i=t+1;i<n;i++)u.set(i,e,u.get(i,e)+r*y[i])}}if(c)for(let e=t+1;e<r;e++)v.set(e,t,g[e])}}let w=Math.min(r,n+1);if(b<r&&(h[b]=u.get(b,b)),n<w&&(h[w-1]=0),_+1<w&&(g[_]=u.get(_,w-1)),g[w-1]=0,s){for(let t=b;t<l;t++){for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}for(let t=b-1;t>=0;t--)if(0!==h[t]){for(let e=t+1;e<l;e++){let r=0;for(let i=t;i<n;i++)r+=p.get(i,t)*p.get(i,e);r=-r/p.get(t,t);for(let i=t;i<n;i++)p.set(i,e,p.get(i,e)+r*p.get(i,t))}for(let e=t;e<n;e++)p.set(e,t,-p.get(e,t));p.set(t,t,1+p.get(t,t));for(let e=0;e<t-1;e++)p.set(e,t,0)}else{for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}}if(c)for(let t=r-1;t>=0;t--){if(t<_&&0!==g[t])for(let e=t+1;e<r;e++){let n=0;for(let i=t+1;i<r;i++)n+=v.get(i,t)*v.get(i,e);n=-n/v.get(t+1,t);for(let i=t+1;i<r;i++)v.set(i,e,v.get(i,e)+n*v.get(i,t))}for(let e=0;e<r;e++)v.set(e,t,0);v.set(t,t,1)}let E=w-1,S=0,A=Number.EPSILON;for(;w>0;){let t,e;for(t=w-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+A*Math.abs(h[t]+Math.abs(h[t+1]));if(Math.abs(g[t])<=e||Number.isNaN(g[t])){g[t]=0;break}}if(t===w-2)e=4;else{let n;for(n=w-1;n>=t&&n!==t;n--){let e=(n!==w?Math.abs(g[n]):0)+(n!==t+1?Math.abs(g[n-1]):0);if(Math.abs(h[n])<=A*e){h[n]=0;break}}n===t?e=3:n===w-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=g[w-2];g[w-2]=0;for(let n=w-2;n>=t;n--){let i=Af(h[n],e),o=h[n]/i,a=e/i;if(h[n]=i,n!==t&&(e=-a*g[n-1],g[n-1]=o*g[n-1]),c)for(let t=0;t<r;t++)i=o*v.get(t,n)+a*v.get(t,w-1),v.set(t,w-1,-a*v.get(t,n)+o*v.get(t,w-1)),v.set(t,n,i)}break}case 2:{let e=g[t-1];g[t-1]=0;for(let r=t;r<w;r++){let i=Af(h[r],e),o=h[r]/i,a=e/i;if(h[r]=i,e=-a*g[r],g[r]=o*g[r],s)for(let e=0;e<n;e++)i=o*p.get(e,r)+a*p.get(e,t-1),p.set(e,t-1,-a*p.get(e,r)+o*p.get(e,t-1)),p.set(e,r,i)}break}case 3:{const e=Math.max(Math.abs(h[w-1]),Math.abs(h[w-2]),Math.abs(g[w-2]),Math.abs(h[t]),Math.abs(g[t])),i=h[w-1]/e,o=h[w-2]/e,a=g[w-2]/e,u=h[t]/e,f=g[t]/e,l=((o+i)*(o-i)+a*a)/2,d=i*a*(i*a);let y=0;0===l&&0===d||(y=l<0?0-Math.sqrt(l*l+d):Math.sqrt(l*l+d),y=d/(l+y));let m=(u+i)*(u-i)+y,b=u*f;for(let e=t;e<w-1;e++){let i=Af(m,b);0===i&&(i=Number.MIN_VALUE);let o=m/i,a=b/i;if(e!==t&&(g[e-1]=i),m=o*h[e]+a*g[e],g[e]=o*g[e]-a*h[e],b=a*h[e+1],h[e+1]=o*h[e+1],c)for(let t=0;t<r;t++)i=o*v.get(t,e)+a*v.get(t,e+1),v.set(t,e+1,-a*v.get(t,e)+o*v.get(t,e+1)),v.set(t,e,i);if(i=Af(m,b),0===i&&(i=Number.MIN_VALUE),o=m/i,a=b/i,h[e]=i,m=o*g[e]+a*h[e+1],h[e+1]=-a*g[e]+o*h[e+1],b=a*g[e+1],g[e+1]=o*g[e+1],s&&e<n-1)for(let t=0;t<n;t++)i=o*p.get(t,e)+a*p.get(t,e+1),p.set(t,e+1,-a*p.get(t,e)+o*p.get(t,e+1)),p.set(t,e,i)}g[w-2]=m,S+=1;break}case 4:if(h[t]<=0&&(h[t]=h[t]<0?-h[t]:0,c))for(let e=0;e<=E;e++)v.set(e,t,-v.get(e,t));for(;t<E&&!(h[t]>=h[t+1]);){let e=h[t];if(h[t]=h[t+1],h[t+1]=e,c&&t<r-1)for(let n=0;n<r;n++)e=v.get(n,t+1),v.set(n,t+1,v.get(n,t)),v.set(n,t,e);if(s&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);t++}S=0,w--}}if(f){let t=v;v=p,p=t}this.m=n,this.n=r,this.s=h,this.U=p,this.V=v}solve(t){let e=t,n=this.threshold,r=this.s.length,i=Ef.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=n?i.set(t,t,0):i.set(t,t,1/this.s[t]);let o=this.U,a=this.rightSingularVectors,u=a.mmul(i),s=a.rows,c=o.rows,f=Ef.zeros(s,c);for(let t=0;t<s;t++)for(let e=0;e<c;e++){let n=0;for(let i=0;i<r;i++)n+=u.get(t,i)*o.get(e,i);f.set(t,e,n)}return f.mmul(e)}solveForDiagonal(t){return this.solve(Ef.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,r=t.columns,i=new Ef(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<r;n++)Math.abs(this.s[n])>e&&i.set(o,n,t.get(o,n)/this.s[n]);let o=this.U,a=o.rows,u=o.columns,s=new Ef(n,a);for(let t=0;t<n;t++)for(let e=0;e<a;e++){let n=0;for(let r=0;r<u;r++)n+=i.get(t,r)*o.get(e,r);s.set(t,e,n)}return s}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let r=0,i=n.length;r<i;r++)n[r]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Ef.diag(this.s)}}var If=function(){function t(t){this.distances=t.distances,this.dimension=t.dimension||2,this.linkDistance=t.linkDistance}return t.prototype.layout=function(){var t=this,e=t.dimension,n=t.distances,r=t.linkDistance;try{var i=Ef.mul(Ef.pow(n,2),-.5),o=i.mean("row"),a=i.mean("column"),u=i.mean();i.add(u).subRowVector(o).subColumnVector(a);var s=new Tf(i),c=Ef.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((function(t){return Ef.mul([t],[c]).toJSON()[0].splice(0,e)}))}catch(t){for(var f=[],l=0;l<n.length;l++){var d=Math.random()*r,h=Math.random()*r;f.push([d,h])}return f}},t}();const Nf=If;var Of=function(){function t(t){this.disp=[],this.positions=t.positions,this.adjMatrix=t.adjMatrix,this.focusID=t.focusID,this.radii=t.radii,this.iterations=t.iterations||10,this.height=t.height||10,this.width=t.width||10,this.speed=t.speed||100,this.gravity=t.gravity||10,this.nodeSizeFunc=t.nodeSizeFunc,this.k=t.k||5,this.strictRadial=t.strictRadial,this.nodes=t.nodes}return t.prototype.layout=function(){var t=this,e=t.positions,n=[],r=t.iterations,i=t.width/10;t.maxDisplace=i,t.disp=n;for(var o=0;o<r;o++)e.forEach((function(t,e){n[e]={x:0,y:0}})),t.getRepulsion(),t.updatePositions();return e},t.prototype.getRepulsion=function(){var t=this,e=t.positions,n=t.nodes,r=t.disp,i=t.k,o=t.radii||[];e.forEach((function(a,u){r[u]={x:0,y:0},e.forEach((function(e,s){if(u!==s&&o[u]===o[s]){var c=a[0]-e[0],f=a[1]-e[1],l=Math.sqrt(c*c+f*f);if(0===l){l=1;var d=u>s?1:-1;c=.01*d,f=.01*d}if(l<t.nodeSizeFunc(n[u])/2+t.nodeSizeFunc(n[s])/2){var h=i*i/l;r[u].x+=c/l*h,r[u].y+=f/l*h}}}))}))},t.prototype.updatePositions=function(){var t=this,e=t.positions,n=t.disp,r=t.speed,i=t.strictRadial,o=t.focusID,a=t.maxDisplace||t.width/10;i&&n.forEach((function(t,n){var r=e[n][0]-e[o][0],i=e[n][1]-e[o][1],a=Math.sqrt(r*r+i*i),u=i/a,s=-r/a,c=Math.sqrt(t.x*t.x+t.y*t.y),f=Math.acos((u*t.x+s*t.y)/c);f>Math.PI/2&&(f-=Math.PI/2,u*=-1,s*=-1);var l=Math.cos(f)*c;t.x=u*l,t.y=s*l}));var u=t.radii;e.forEach((function(t,s){if(s!==o){var c=Math.sqrt(n[s].x*n[s].x+n[s].y*n[s].y);if(c>0&&s!==o){var f=Math.min(a*(r/800),c);if(t[0]+=n[s].x/c*f,t[1]+=n[s].y/c*f,i){var l=t[0]-e[o][0],d=t[1]-e[o][1],h=Math.sqrt(l*l+d*d);l=l/h*u[s],d=d/h*u[s],t[0]=e[o][0]+l,t[1]=e[o][1]+d}}}}))},t}();const Cf=Of;var kf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Df(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var Mf=function(t){function n(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(e),n}return kf(n,t),n.prototype.getDefaultCfg=function(){return{maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,strictRadial:!0,maxPreventOverlapIteration:200,sortBy:void 0,sortStrength:10}},n.prototype.execute=function(){var t=this,n=t.nodes,r=t.edges||[];if(n&&0!==n.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var u=t.center;if(1===n.length)return n[0].x=u[0],n[0].y=u[1],void(t.onLayoutEnd&&t.onLayoutEnd());var s=t.linkDistance,c=null;if(e(t.focusNode)){for(var l=!1,d=0;d<n.length;d++)n[d].id===t.focusNode&&(c=n[d],t.focusNode=c,l=!0,d=n.length);l||(c=null)}else c=t.focusNode;c||(c=n[0],t.focusNode=c);var h=function(t,e){var n=-1;return t.forEach((function(t,r){t.id===e&&(n=r)})),n}(n,c.id);h<0&&(h=0),t.focusIndex=h;var g=v({nodes:n,edges:r},!1),y=p(g),m=t.maxToFocus(y,h);t.handleInfinity(y,h,m+1),t.distances=y;var b=y[h],_=t.width||500,w=t.height||500,E=_-u[0]>u[0]?u[0]:_-u[0],S=w-u[1]>u[1]?u[1]:w-u[1];0===E&&(E=_/2),0===S&&(S=w/2);var A=S>E?E:S,T=Math.max.apply(Math,b),I=[];b.forEach((function(e,n){t.unitRadius||(t.unitRadius=A/T),I[n]=e*t.unitRadius})),t.radii=I;var N=t.eIdealDisMatrix();t.eIdealDistances=N;var O=function(t){for(var e=t.length,n=t[0].length,r=[],i=0;i<e;i++){for(var o=[],a=0;a<n;a++)0!==t[i][a]?o.push(1/(t[i][a]*t[i][a])):o.push(0);r.push(o)}return r}(N);t.weights=O;var C=new Nf({linkDistance:s,distances:N}).layout();C.forEach((function(t){a(t[0])&&(t[0]=Math.random()*s),a(t[1])&&(t[1]=Math.random()*s)})),t.positions=C,C.forEach((function(t,e){n[e].x=t[0]+u[0],n[e].y=t[1]+u[1]})),C.forEach((function(t){t[0]-=C[h][0],t[1]-=C[h][1]})),t.run();var k,D=t.preventOverlap,M=t.nodeSize,R=t.strictRadial;if(D){var P,G=t.nodeSpacing;P=o(G)?function(){return G}:x(G)?G:function(){return 0},k=M?i(M)?function(t){return(M[0]>M[1]?M[0]:M[1])+P(t)}:function(t){return M+P(t)}:function(t){return t.size?i(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])+P(t):f(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)+P(t):t.size+P(t):10+P(t)};var L={nodes:n,nodeSizeFunc:k,adjMatrix:g,positions:C,radii:I,height:w,width:_,strictRadial:R,focusID:h,iterations:t.maxPreventOverlapIteration||200,k:C.length/4.5},j=new Cf(L);C=j.layout()}return C.forEach((function(t,e){n[e].x=t[0]+u[0],n[e].y=t[1]+u[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:r}}t.onLayoutEnd&&t.onLayoutEnd()},n.prototype.run=function(){for(var t=this,e=t.maxIteration,n=t.positions||[],r=t.weights||[],i=t.eIdealDistances||[],o=t.radii||[],a=0;a<=e;a++){var u=a/e;t.oneIteration(u,n,o,i,r)}},n.prototype.oneIteration=function(t,e,n,r,i){var o=1-t,a=this.focusIndex;e.forEach((function(u,s){var c=Df(u,[0,0]),f=0===c?0:1/c;if(s!==a){var l=0,d=0,h=0;e.forEach((function(t,e){if(s!==e){var n=Df(u,t),o=0===n?0:1/n,a=r[e][s];h+=i[s][e],l+=i[s][e]*(t[0]+a*(u[0]-t[0])*o),d+=i[s][e]*(t[1]+a*(u[1]-t[1])*o)}}));var p=0===n[s]?0:1/n[s];h*=o,h+=t*p*p,l*=o,l+=t*p*u[0]*f,u[0]=l/h,d*=o,d+=t*p*u[1]*f,u[1]=d/h}}))},n.prototype.eIdealDisMatrix=function(){var t=this,n=t.nodes;if(!n)return[];var r=t.distances,i=t.linkDistance,o=t.radii||[],a=t.unitRadius||50,u=[];return r&&r.forEach((function(r,s){var c=[];r.forEach((function(r,u){if(s===u)c.push(0);else if(o[s]===o[u])if("data"===t.sortBy)c.push(r*(Math.abs(s-u)*t.sortStrength)/(o[s]/a));else if(t.sortBy){var f=n[s][t.sortBy]||0,l=n[u][t.sortBy]||0;e(f)&&(f=f.charCodeAt(0)),e(l)&&(l=l.charCodeAt(0)),c.push(r*(Math.abs(f-l)*t.sortStrength)/(o[s]/a))}else c.push(r*i/(o[s]/a));else{var d=(i+a)/2;c.push(r*d)}})),u.push(c)})),u},n.prototype.handleInfinity=function(t,e,n){for(var r=t.length,i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(var o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(i=0;i<r;i++)if(i!==e)for(o=0;o<r;o++)if(t[i][o]===1/0){var a=Math.abs(t[e][i]-t[e][o]);a=0===a?1:a,t[i][o]=a}},n.prototype.maxToFocus=function(t,e){for(var n=0,r=0;r<t[e].length;r++)t[e][r]!==1/0&&(n=t[e][r]>n?t[e][r]:n);return n},n.prototype.getType=function(){return"radial"},n}(t),Rf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pf=function(t){function n(e){var n=t.call(this)||this;return n.nodeSize=30,n.minNodeSpacing=10,n.nodeSpacing=10,n.preventOverlap=!1,n.equidistant=!1,n.startAngle=1.5*Math.PI,n.clockwise=!0,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.onLayoutEnd=function(){},n.updateCfg(e),n}return Rf(n,t),n.prototype.getDefaultCfg=function(){return{nodeSize:30,minNodeSpacing:10,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"}},n.prototype.execute=function(){var t,n,r=this,a=r.nodes,u=r.edges,s=a.length;if(0!==s){r.width||"undefined"==typeof window||(r.width=window.innerWidth),r.height||"undefined"==typeof window||(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var c=r.center;if(1===s)return a[0].x=c[0],a[0].y=c[1],void(null===(n=r.onLayoutEnd)||void 0===n||n.call(r));var l,d=r.nodeSize,p=r.nodeSpacing,v=[],g=0;l=i(d)?Math.max(d[0],d[1]):d,i(p)?g=Math.max(p[0],p[1]):o(p)&&(g=p),a.forEach((function(t){v.push(t);var e=l;i(t.size)?e=Math.max(t.size[0],t.size[1]):o(t.size)?e=t.size:f(t.size)&&(e=Math.max(t.size.width,t.size.height)),l=Math.max(l,e),x(p)&&(g=Math.max(p(t),g))})),r.clockwise=void 0!==r.counterclockwise?!r.counterclockwise:r.clockwise;var y={},m={};if(v.forEach((function(t,e){y[t.id]=t,m[t.id]=e})),!("degree"!==r.sortBy&&e(r.sortBy)&&void 0!==v[0][r.sortBy]||(r.sortBy="degree",o(a[0].degree)))){var b=h(a.length,m,u);v.forEach((function(t,e){t.degree=b[e].all}))}v.sort((function(t,e){return e[r.sortBy]-t[r.sortBy]})),r.maxValueNode=v[0],r.maxLevelDiff=r.maxLevelDiff||r.maxValueNode[r.sortBy]/4;var _=[[]],w=_[0];v.forEach((function(t){if(w.length>0){var e=Math.abs(w[0][r.sortBy]-t[r.sortBy]);r.maxLevelDiff&&e>=r.maxLevelDiff&&(w=[],_.push(w))}w.push(t)}));var E=l+(g||r.minNodeSpacing);if(!r.preventOverlap){var S=_.length>0&&_[0].length>1,A=(Math.min(r.width,r.height)/2-E)/(_.length+(S?1:0));E=Math.min(E,A)}var T=0;if(_.forEach((function(t){var e=r.sweep;void 0===e&&(e=2*Math.PI-2*Math.PI/t.length);var n=t.dTheta=e/Math.max(1,t.length-1);if(t.length>1&&r.preventOverlap){var i=Math.cos(n)-Math.cos(0),o=Math.sin(n)-Math.sin(0),a=Math.sqrt(E*E/(i*i+o*o));T=Math.max(a,T)}t.r=T,T+=E})),r.equidistant){for(var I=0,N=0,O=0;O<_.length;O++){var C=_[O].r-N;I=Math.max(I,C)}N=0,_.forEach((function(t,e){0===e&&(N=t.r),t.r=N,N+=I}))}return _.forEach((function(t){var e=t.dTheta,n=t.r;t.forEach((function(t,i){var o=r.startAngle+(r.clockwise?1:-1)*e*i;t.x=c[0]+n*Math.cos(o),t.y=c[1]+n*Math.sin(o)}))})),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:a,edges:u}}null===(t=r.onLayoutEnd)||void 0===t||t.call(r)},n.prototype.getType=function(){return"concentric"},n}(t),Gf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Lf=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.linkDistance=50,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return Gf(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges,r=void 0===n?[]:n,i=t.center;if(e&&0!==e.length){if(1===e.length)return e[0].x=i[0],e[0].y=i[1],void(t.onLayoutEnd&&t.onLayoutEnd());var o=t.linkDistance,a=v({nodes:e,edges:r},!1),u=p(a);t.handleInfinity(u);var s,c,f=(s=o,c=[],u.forEach((function(t){var e=[];t.forEach((function(t){e.push(t*s)})),c.push(e)})),c);t.scaledDistances=f;var l=t.runMDS();return t.positions=l,l.forEach((function(t,n){e[n].x=t[0]+i[0],e[n].y=t[1]+i[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:r}}t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.runMDS=function(){var t=this.scaledDistances,e=Ef.mul(Ef.pow(t,2),-.5),n=e.mean("row"),r=e.mean("column"),i=e.mean();e.add(i).subRowVector(n).subColumnVector(r);var o=new Tf(e),a=Ef.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map((function(t){return Ef.mul([t],[a]).toJSON()[0].splice(0,2)}))},e.prototype.handleInfinity=function(t){var e=-999999;t.forEach((function(t){t.forEach((function(t){t!==1/0&&e<t&&(e=t)}))})),t.forEach((function(n,r){n.forEach((function(n,i){n===1/0&&(t[r][i]=e)}))}))},e.prototype.getType=function(){return"mds"},e}(t),jf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ff=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.workerEnabled=!1,n.gravity=10,n.speed=5,n.clustering=!1,n.clusterGravity=10,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.onLayoutEnd=function(){},n.tick=function(){},n.animate=!0,n.updateCfg(e),n}return jf(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},e.prototype.execute=function(){var t,e,n=this,r=this,i=r.nodes;if(void 0!==r.timeInterval&&"undefined"!=typeof window&&window.clearInterval(r.timeInterval),i&&0!==i.length){r.width||"undefined"==typeof window||(r.width=window.innerWidth),r.height||"undefined"==typeof window||(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var a=r.center;if(1===i.length)return i[0].x=a[0],i[0].y=a[1],void(null===(e=r.onLayoutEnd)||void 0===e||e.call(r));var u={},s={};return i.forEach((function(t,e){o(t.x)||(t.x=Math.random()*n.width),o(t.y)||(t.y=Math.random()*n.height),u[t.id]=t,s[t.id]=e})),r.nodeMap=u,r.nodeIdxMap=s,r.run()}null===(t=r.onLayoutEnd)||void 0===t||t.call(r)},e.prototype.run=function(){var t,e=this,n=e.nodes;if(n){var r=e.edges,i=e.maxIteration,o=e.workerEnabled,a=e.clustering,u=e.animate,s={};if(a&&n.forEach((function(t){void 0===s[t.cluster]&&(s[t.cluster]={name:t.cluster,cx:0,cy:0,count:0})})),o||!u){for(var c=0;c<i;c++)e.runOneStep(s);null===(t=e.onLayoutEnd)||void 0===t||t.call(e)}else{if("undefined"==typeof window)return;var f=0;this.timeInterval=window.setInterval((function(){var t;e.runOneStep(s),++f>=i&&(null===(t=e.onLayoutEnd)||void 0===t||t.call(e),window.clearInterval(e.timeInterval))}),0)}return{nodes:n,edges:r}}},e.prototype.runOneStep=function(t){var e,n=this,r=n.nodes;if(r){var i=n.edges,a=n.center,u=n.gravity,s=n.speed,c=n.clustering,f=n.height*n.width,l=Math.sqrt(f)/10,d=f/(r.length+1),h=Math.sqrt(d),p=[];if(r.forEach((function(t,e){p[e]={x:0,y:0}})),n.applyCalculate(r,i,p,h,d),c){for(var v in t)t[v].cx=0,t[v].cy=0,t[v].count=0;for(var v in r.forEach((function(e){var n=t[e.cluster];o(e.x)&&(n.cx+=e.x),o(e.y)&&(n.cy+=e.y),n.count++})),t)t[v].cx/=t[v].count,t[v].cy/=t[v].count;var g=n.clusterGravity||u;r.forEach((function(e,n){if(o(e.x)&&o(e.y)){var r=t[e.cluster],i=Math.sqrt((e.x-r.cx)*(e.x-r.cx)+(e.y-r.cy)*(e.y-r.cy)),a=h*g;p[n].x-=a*(e.x-r.cx)/i,p[n].y-=a*(e.y-r.cy)/i}}))}r.forEach((function(t,e){if(o(t.x)&&o(t.y)){var n=.01*h*u;p[e].x-=n*(t.x-a[0]),p[e].y-=n*(t.y-a[1])}})),r.forEach((function(t,e){if(o(t.fx)&&o(t.fy))return t.x=t.fx,void(t.y=t.fy);if(o(t.x)&&o(t.y)){var n=Math.sqrt(p[e].x*p[e].x+p[e].y*p[e].y);if(n>0){var r=Math.min(l*(s/800),n);t.x+=p[e].x/n*r,t.y+=p[e].y/n*r}}})),null===(e=n.tick)||void 0===e||e.call(n)}},e.prototype.applyCalculate=function(t,e,n,r,i){this.calRepulsive(t,n,i),e&&this.calAttractive(e,n,r)},e.prototype.calRepulsive=function(t,e,n){t.forEach((function(r,i){e[i]={x:0,y:0},t.forEach((function(t,a){if(i!==a&&o(r.x)&&o(t.x)&&o(r.y)&&o(t.y)){var u=r.x-t.x,s=r.y-t.y,c=u*u+s*s;if(0===c){c=1;var f=i>a?1:-1;u=.01*f,s=.01*f}var l=n/c;e[i].x+=u*l,e[i].y+=s*l}}))}))},e.prototype.calAttractive=function(t,e,n){var r=this;t.forEach((function(t){var i=d(t,"source"),a=d(t,"target");if(i&&a){var u=r.nodeIdxMap[i],s=r.nodeIdxMap[a];if(u!==s){var c=r.nodeMap[i],f=r.nodeMap[a];if(o(f.x)&&o(c.x)&&o(f.y)&&o(c.y)){var l=f.x-c.x,h=f.y-c.y,p=Math.sqrt(l*l+h*h),v=p*p/n;e[s].x-=l/p*v,e[s].y-=h/p*v,e[u].x+=l/p*v,e[u].y+=h/p*v}}}}))},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(t);function Uf(t,e,n,r){n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(r):void 0})}function Bf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zf(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,r.key,r)}}function Vf(t,e,n){return e&&zf(t.prototype,e),n&&zf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wf(t,e,n,r,i){var o={};return Object.keys(r).forEach((function(t){o[t]=r[t]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce((function(n,r){return r(t,e,n)||n}),o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(t,e,o),o=null),o}n(8892);var Hf=n(2662),Xf=n.n(Hf);function qf(t,e,n,r,i,o,a){try{var u=t[o](a),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(r,i)}function Yf(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){qf(o,r,i,a,u,"next",t)}function u(t){qf(o,r,i,a,u,"throw",t)}a(void 0)}))}}var Kf=1;function Zf(){return Kf++}var $f=function t(e){Bf(this,t)},Jf=function(){function t(e){Bf(this,t),this.clazz=void 0,this.components=[],this.entities=[],this.lookup={},this.clazz=e}var e;return Vf(t,[{key:"clear",value:function(){this.components=[],this.entities=[],this.lookup={}}},{key:"contains",value:function(t){return this.lookup[t]>-1}},{key:"create",value:function(t,e){this.lookup[t]=this.components.length;var n=new this.clazz(e||{});return this.components.push(n),this.entities.push(t),n}},{key:"remove",value:function(t){var e=this.lookup[t];e>-1&&e<this.components.length-1&&(this.components[e]=this.components[this.components.length-1],this.entities[e]=this.entities[this.entities.length-1],this.lookup[this.entities[e]]=e),this.components.pop(),this.entities.pop(),delete this.lookup[t]}},{key:"removeKeepSorted",value:function(t){var e=this.lookup[t];if(e>-1){var n=this.entities[e];if(e<this.components.length-1){for(var r=e+1;r<this.components.length;++r)this.components[r-1]=this.components[r];for(var i=e+1;i<this.entities.length;++i)this.entities[i-1]=this.entities[i],this.lookup[this.entities[i-1]]=i-1}this.components.pop(),this.entities.pop(),delete this.lookup[n]}}},{key:"moveItem",value:function(t,e){if(t!==e){for(var n=this.components[t],r=this.entities[t],i=t<e?1:-1,o=t;o!==e;o+=i){var a=o+i;this.components[o]=this.components[a],this.entities[o]=this.entities[a],this.lookup[this.entities[o]]=o}this.components[e]=n,this.entities[e]=r,this.lookup[r]=e}}},{key:"getEntity",value:function(t){return this.entities[t]}},{key:"getComponent",value:function(t){return this.components[t]}},{key:"getComponentByEntity",value:function(t){var e=this.lookup[t];return e>-1?this.components[e]:null}},{key:"getCount",value:function(){return this.components.length}},{key:"getEntityByComponentIndex",value:function(t){for(var e=0,n=Object.keys(this.lookup);e<n.length;e++){var r=n[e],i=Number(r);if(this.lookup[i]===t)return i}return-1}},{key:"find",value:function(t){for(var e=0;e<this.getCount();e++){var n=this.getComponent(e);if(t(n,e))return n}return null}},{key:"findIndex",value:function(t){for(var e=0;e<this.getCount();e++)if(t(this.getComponent(e),e))return e;return-1}},{key:"forEach",value:function(t){for(var e=0,n=Object.keys(this.lookup);e<n.length;e++){var r=n[e],i=Number(r),o=this.lookup[i];t(i,this.getComponent(o))}}},{key:"forEachAsync",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,r=Object.keys(this.lookup);case 1:if(!(n<r.length)){t.next=10;break}return i=r[n],o=Number(i),a=this.lookup[o],t.next=7,e(o,this.getComponent(a));case 7:n++,t.next=1;break;case 10:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"map",value:function(t){for(var e=[],n=0,r=Object.keys(this.lookup);n<r.length;n++){var i=r[n],o=Number(i),a=this.lookup[o];e.push(t(o,this.getComponent(a)))}return e}}]),t}();function Qf(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 tl(t,e){if(t){if("string"==typeof t)return Qf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qf(t,e):void 0}}function el(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){u=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(t,e)||tl(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var nl=n(9311),rl={HierarchyComponentManager:Symbol("HierarchyComponentManager"),TransformComponentManager:Symbol("TransformComponentManager"),NameComponentManager:Symbol("NameComponentManager"),SceneGraphSystem:Symbol("SceneGraphSystem"),FrameGraphSystem:Symbol("FrameGraphSystem"),ResourcePool:Symbol("ResourcePool"),ResourceHandleComponentManager:Symbol("ResourceHandleComponentManager"),PassNodeComponentManager:Symbol("PassNodeComponentManager"),RendererSystem:Symbol("RendererSystem"),RenderPass:Symbol("RenderPass"),RenderPassFactory:Symbol("Factory<IRenderPass>"),Renderable:Symbol("Factory<IRenderPass>"),MeshSystem:Symbol("MeshSystem"),MeshComponentManager:Symbol("MeshComponentManager"),CullableComponentManager:Symbol("CullableComponentManager"),Geometry:Symbol("Geometry"),GeometrySystem:Symbol("GeometrySystem"),GeometryComponentManager:Symbol("GeometryComponentManager"),Material:Symbol("Material"),MaterialSystem:Symbol("MaterialSystem"),MaterialComponentManager:Symbol("MaterialComponentManager"),ForwardRenderPath:Symbol("ForwardRenderPath"),ComputeSystem:Symbol("ComputeSystem"),ComputeComponentManager:Symbol("ComputeComponentManager"),ComputeStrategy:Symbol("ComputeStrategy"),Systems:Symbol("Systems"),World:Symbol("World"),RenderEngine:Symbol("RenderEngine"),WebGPUEngine:Symbol("WebGPUEngine"),WebGLEngine:Symbol("WebGLEngine"),ShaderModuleService:Symbol("ShaderModuleService"),ConfigService:Symbol("ConfigService"),InteractorService:Symbol("InteractorService"),IEventEmitter:Symbol("IEventEmitter"),Light:Symbol("Light")},il=function t(){Bf(this,t),this.index=void 0},ol=function t(){Bf(this,t),this.name=void 0,this.data=void 0,this.execute=void 0,this.tearDown=void 0},al=function(){function t(){Bf(this,t),this.name=void 0,this.refCount=0,this.hasSideEffect=!1,this.devirtualize=[],this.destroy=[],this.reads=[],this.writes=[]}return Vf(t,[{key:"read",value:function(t){return this.reads.find((function(e){return e.index===t.index}))||this.reads.push(t),t}},{key:"sample",value:function(t){return this.read(t),t}},{key:"write",value:function(t,e){var n=this.writes.find((function(t){return t.index===e.index}));if(n)return e;var r=t.getResourceNode(e);r.resource.version++,r.resource.imported&&(this.hasSideEffect=!0);var i=t.createResourceNode(r.resource);return t.getResourceNode(i).writer=this,this.writes.push(i),i}}]),t}();function ul(t,e){return ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ul(t,e)}function sl(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ul(t,e)}function cl(t){return cl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(t)}function fl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ll(t,e){if(e&&("object"===cl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return fl(t)}function dl(t){return dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dl(t)}var hl,pl,vl,gl,yl,ml,bl=function(t){sl(i,(function t(){Bf(this,t),this.first=void 0,this.last=void 0}));var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return(t=r.call.apply(r,[this].concat(n))).version=0,t.refs=0,t.name=void 0,t.imported=void 0,t.priority=void 0,t.discardStart=!0,t.discardEnd=!1,t.descriptor=void 0,t.resource=void 0,t}return Vf(i,[{key:"preExecuteDestroy",value:function(){this.discardEnd=!0}},{key:"postExecuteDestroy",value:function(){this.imported}},{key:"postExecuteDevirtualize",value:function(){this.discardStart=!1}},{key:"preExecuteDevirtualize",value:function(){this.imported}}]),i}(),_l=function t(){Bf(this,t),this.resource=void 0,this.writer=void 0,this.readerCount=0,this.version=void 0};function xl(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function wl(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}var El=(hl=(0,nl.b2)(),pl=(0,nl.f3)(rl.RenderEngine),hl((ml=function(){function t(){Bf(this,t),this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[],Uf(this,"engine",yl,this)}var e,n;return Vf(t,[{key:"execute",value:(n=Yf(Xf().mark((function t(e){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.compile(),t.next=3,this.executePassNodes(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"tearDown",value:function(){this.frameGraphPasses.forEach((function(t){t.tearDown&&t.tearDown()})),this.reset()}},{key:"addPass",value:function(t,e,n,r){var i=new ol;i.execute=n,r&&(i.tearDown=r),i.name=t;var o=new al;return o.name=t,this.passNodes.push(o),this.frameGraphPasses.push(i),e(this,o,i),i}},{key:"getPass",value:function(t){return this.frameGraphPasses.find((function(e){return e.name===t}))}},{key:"compile",value:function(){var t,e=this,n=xl(this.passNodes);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.refCount=r.writes.length+(r.hasSideEffect?1:0),r.reads.forEach((function(t){e.resourceNodes[t.index].readerCount++}))}}catch(t){n.e(t)}finally{n.f()}var i,o=[],a=xl(this.resourceNodes);try{for(a.s();!(i=a.n()).done;){var u=i.value;0===u.readerCount&&o.push(u)}}catch(t){a.e(t)}finally{a.f()}for(;o.length;){var s=o.pop(),c=s&&s.writer;if(c&&0==--c.refCount){var f,l=xl(c.reads);try{for(l.s();!(f=l.n()).done;){var d=f.value,h=this.resourceNodes[d.index];0==--h.readerCount&&o.push(h)}}catch(t){l.e(t)}finally{l.f()}}}this.resourceNodes.forEach((function(t){t.resource.refs+=t.readerCount}));var p,v=xl(this.passNodes);try{for(v.s();!(p=v.n()).done;){var g=p.value;if(g.refCount){var y,m=xl(g.reads);try{for(m.s();!(y=m.n()).done;){var b=y.value,_=this.resourceNodes[b.index].resource;_.first=_.first?_.first:g,_.last=g}}catch(t){m.e(t)}finally{m.f()}var x,w=xl(g.writes);try{for(w.s();!(x=w.n()).done;){var E=x.value,S=this.resourceNodes[E.index].resource;S.first=S.first?S.first:g,S.last=g}}catch(t){w.e(t)}finally{w.f()}}}}catch(t){v.e(t)}finally{v.f()}for(var A=0;A<2;A++){var T,I=xl(this.resourceNodes);try{for(I.s();!(T=I.n()).done;){var N=T.value.resource;if(N.priority===A&&N.refs){var O=N.first,C=N.last;O&&C&&(O.devirtualize.push(N),C.destroy.push(N))}}}catch(t){I.e(t)}finally{I.f()}}}},{key:"executePassNodes",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a,u,s,c,f,l,d,h,p;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=xl(this.passNodes.entries()),t.prev=1,n.s();case 3:if((r=n.n()).done){t.next=18;break}if(i=el(r.value,2),o=i[0],!(a=i[1]).refCount){t.next=16;break}u=xl(a.devirtualize);try{for(u.s();!(s=u.n()).done;)s.value.preExecuteDevirtualize(this.engine)}catch(t){u.e(t)}finally{u.f()}c=xl(a.destroy);try{for(c.s();!(f=c.n()).done;)f.value.preExecuteDestroy(this.engine)}catch(t){c.e(t)}finally{c.f()}return t.next=12,this.frameGraphPasses[o].execute(this,this.frameGraphPasses[o],e);case 12:l=xl(a.devirtualize);try{for(l.s();!(d=l.n()).done;)d.value.postExecuteDevirtualize(this.engine)}catch(t){l.e(t)}finally{l.f()}h=xl(a.destroy);try{for(h.s();!(p=h.n()).done;)p.value.postExecuteDestroy(this.engine)}catch(t){h.e(t)}finally{h.f()}case 16:t.next=3;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(1),n.e(t.t0);case 23:return t.prev=23,n.f(),t.finish(23);case 26:this.reset();case 27:case"end":return t.stop()}}),t,this,[[1,20,23,26]])}))),function(t){return e.apply(this,arguments)})},{key:"reset",value:function(){this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[]}},{key:"getResourceNode",value:function(t){return this.resourceNodes[t.index]}},{key:"createResourceNode",value:function(t){var e=new _l;e.resource=t,e.version=t.version,this.resourceNodes.push(e);var n=new il;return n.index=this.resourceNodes.length-1,n}},{key:"createTexture",value:function(t,e,n){var r=new bl;return r.name=e,r.descriptor=n,this.createResourceNode(r)}},{key:"createRenderTarget",value:function(t,e,n){var r=new bl;return r.name=e,r.descriptor=n,this.createResourceNode(r)}},{key:"present",value:function(t){this.addPass("Present",(function(e,n){n.read(t),n.hasSideEffect=!0}),Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))))}}]),t}(),yl=Wf((gl=ml).prototype,"engine",[pl],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vl=gl))||vl);function Sl(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Al=1e-6,Tl="undefined"!=typeof Float32Array?Float32Array:Array;function Il(){var t=new Tl(4);return Tl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Nl(t,e,n,r){var i=new Tl(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function Ol(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}function Cl(){var t=new Tl(9);return Tl!=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 kl(){var t=new Tl(3);return Tl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Dl(t){var e=new Tl(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Ml(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function Rl(t,e,n){var r=new Tl(3);return r[0]=t,r[1]=e,r[2]=n,r}function Pl(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Gl(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function Ll(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function jl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Fl(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function Ul(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Bl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function zl(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function Vl(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function Wl(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t}Math.random,Math.PI,Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Il();var Hl=jl,Xl=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.hypot(n,r,i)},ql=Ml,Yl=(kl(),9007199254740991),Kl={};Kl["[object Float32Array]"]=Kl["[object Float64Array]"]=Kl["[object Int8Array]"]=Kl["[object Int16Array]"]=Kl["[object Int32Array]"]=Kl["[object Uint8Array]"]=Kl["[object Uint8ClampedArray]"]=Kl["[object Uint16Array]"]=Kl["[object Uint32Array]"]=!0,Kl["[object Arguments]"]=Kl["[object Array]"]=Kl["[object ArrayBuffer]"]=Kl["[object Boolean]"]=Kl["[object DataView]"]=Kl["[object Date]"]=Kl["[object Error]"]=Kl["[object Function]"]=Kl["[object Map]"]=Kl["[object Number]"]=Kl["[object Object]"]=Kl["[object RegExp]"]=Kl["[object Set]"]=Kl["[object String]"]=Kl["[object WeakMap]"]=!1;var Zl=Object.prototype.toString,$l=function(t){return function(t){return!!t&&"object"===cl(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Yl}(t.length)&&!!Kl[Zl.call(t)]};function Jl(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ql(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Jl(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var td,ed,nd,rd,id,od,ad,ud,sd,cd=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).dirty=!0,e.attributes=[],e.indices=void 0,e.indicesBuffer=void 0,e.vertexCount=0,e.maxInstancedCount=void 0,e.aabb=void 0,e.entity=void 0,Object.assign(fl(e),t),e}return Vf(i,[{key:"setAttribute",value:function(t,e,n,r){var i=this.attributes.find((function(e){return e.name===t}));return i?(i.data=e,i.dirty=!0):this.attributes.push(Ql(Ql({dirty:!0,name:t,data:e},n),{},{bufferGetter:r})),this.dirty=!0,this}},{key:"setIndex",value:function(t){return this.indices=new Uint32Array(t.buffer?t.buffer:t),this.dirty=!0,this}},{key:"applyMatrix",value:function(t){var e,n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y,m,b,_,x,w,E,S,A,T,I,N,O,C,k,D=this.attributes.find((function(t){return"position"===t.name})),M=this.attributes.find((function(t){return"normal"===t.name}));if(D&&(D.dirty=!0,D.data&&D.data.length))for(var R=0;R<D.data.length;R+=3){var P=Nl(D.data[R],D.data[R+1],D.data[R+2],1);Ol(P,P,t),$l(D.data)?D.data.set([P[0],P[1],P[2]],R):(D.data[R]=P[0],D.data[R+1]=P[1],D.data[R+2]=P[2])}if(M){var G=(e=Cl(),r=(n=t)[0],i=n[1],o=n[2],a=n[3],u=n[4],s=n[5],c=n[6],f=n[7],l=n[8],d=n[9],h=n[10],p=n[11],v=n[12],g=n[13],y=n[14],m=n[15],(k=(b=r*s-i*u)*(C=h*m-p*y)-(_=r*c-o*u)*(O=d*m-p*g)+(x=r*f-a*u)*(N=d*y-h*g)+(w=i*c-o*s)*(I=l*m-p*v)-(E=i*f-a*s)*(T=l*y-h*v)+(S=o*f-a*c)*(A=l*g-d*v))?(k=1/k,e[0]=(s*C-c*O+f*N)*k,e[1]=(c*I-u*C-f*T)*k,e[2]=(u*O-s*I+f*A)*k,e[3]=(o*O-i*C-a*N)*k,e[4]=(r*C-o*I+a*T)*k,e[5]=(i*I-r*O-a*A)*k,e[6]=(g*S-y*E+m*w)*k,e[7]=(y*x-v*S-m*_)*k,e[8]=(v*E-g*x+m*b)*k,e):null);if(M.data&&M.data.length)for(var L=0;L<M.data.length;L+=3){var j=Rl(M.data[L],M.data[L+1],M.data[L+2]);Wl(j,j,G),Ul(j,j),$l(M.data)?M.data.set([j[0],j[1],j[2]],L):(M.data[L]=j[0],M.data[L+1]=j[1],M.data[L+2]=j[2])}}}}]),i}($f);!function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.MAX_EXT=32776]="MAX_EXT",t[t.MIN_EXT=32775]="MIN_EXT",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.CULL_FACE=2884]="CULL_FACE",t[t.BLEND=3042]="BLEND",t[t.DITHER=3024]="DITHER",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.TEXTURE1=33985]="TEXTURE1",t[t.TEXTURE2=33986]="TEXTURE2",t[t.TEXTURE3=33987]="TEXTURE3",t[t.TEXTURE4=33988]="TEXTURE4",t[t.TEXTURE5=33989]="TEXTURE5",t[t.TEXTURE6=33990]="TEXTURE6",t[t.TEXTURE7=33991]="TEXTURE7",t[t.TEXTURE8=33992]="TEXTURE8",t[t.TEXTURE9=33993]="TEXTURE9",t[t.TEXTURE10=33994]="TEXTURE10",t[t.TEXTURE11=33995]="TEXTURE11",t[t.TEXTURE12=33996]="TEXTURE12",t[t.TEXTURE13=33997]="TEXTURE13",t[t.TEXTURE14=33998]="TEXTURE14",t[t.TEXTURE15=33999]="TEXTURE15",t[t.TEXTURE16=34e3]="TEXTURE16",t[t.TEXTURE17=34001]="TEXTURE17",t[t.TEXTURE18=34002]="TEXTURE18",t[t.TEXTURE19=34003]="TEXTURE19",t[t.TEXTURE20=34004]="TEXTURE20",t[t.TEXTURE21=34005]="TEXTURE21",t[t.TEXTURE22=34006]="TEXTURE22",t[t.TEXTURE23=34007]="TEXTURE23",t[t.TEXTURE24=34008]="TEXTURE24",t[t.TEXTURE25=34009]="TEXTURE25",t[t.TEXTURE26=34010]="TEXTURE26",t[t.TEXTURE27=34011]="TEXTURE27",t[t.TEXTURE28=34012]="TEXTURE28",t[t.TEXTURE29=34013]="TEXTURE29",t[t.TEXTURE30=34014]="TEXTURE30",t[t.TEXTURE31=34015]="TEXTURE31",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.COPY_SRC=1]="COPY_SRC",t[t.COPY_DST=2]="COPY_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"}(td||(td={}));var fd=(ed=(0,nl.b2)(),nd=(0,nl.f3)(rl.GeometryComponentManager),rd=(0,nl.f3)(rl.RenderEngine),ed((sd=function(){function t(){Bf(this,t),Uf(this,"geometry",ad,this),Uf(this,"engine",ud,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(){var e=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.geometry.forEach((function(t,n){n.dirty&&(n.attributes.forEach((function(t){var n;t.dirty&&t.data&&(t.buffer?null===(n=t.buffer)||void 0===n||n.subData({data:t.data,offset:0}):t.buffer=e.engine.createBuffer({data:t.data,type:td.FLOAT}),t.dirty=!1)})),n.indices&&(n.indicesBuffer?n.indicesBuffer.subData({data:n.indices,offset:0}):n.indicesBuffer=e.engine.createElements({data:n.indices,count:n.indices.length,type:td.UNSIGNED_INT,usage:td.STATIC_DRAW})),n.dirty=!1)}));case 1:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.geometry.forEach((function(t,e){e.indicesBuffer&&e.indicesBuffer.destroy(),e.attributes.forEach((function(t){t.buffer&&t.buffer.destroy()}))})),this.geometry.clear()}},{key:"createBufferGeometry",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{vertexCount:3},e=t.vertexCount,n=Zf();return this.geometry.create(n,{vertexCount:e})}},{key:"createInstancedBufferGeometry",value:function(t){var e=t.maxInstancedCount,n=t.vertexCount,r=Zf();return this.geometry.create(r,{maxInstancedCount:e,vertexCount:n})}}]),t}(),ad=Wf((od=sd).prototype,"geometry",[nd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ud=Wf(od.prototype,"engine",[rd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),id=od))||id);function ld(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function dd(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ld(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ld(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var hd,pd,vd,gd,yd,md,bd,_d,xd,wd,Ed=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).vertexShaderGLSL=void 0,e.fragmentShaderGLSL=void 0,e.defines={},e.dirty=!0,e.uniforms=[],e.cull={enable:!0,face:td.BACK},e.depth={enable:!0},e.blend=void 0,e.entity=void 0,e.type=void 0,Object.assign(fl(e),t),e}return Vf(i,[{key:"setDefines",value:function(t){return this.defines=dd(dd({},this.defines),t),this}},{key:"setCull",value:function(t){return this.cull=t,this}},{key:"setDepth",value:function(t){return this.depth=t,this}},{key:"setBlend",value:function(t){return this.blend=t,this}},{key:"setUniform",value:function(t,e){var n=this;if("string"!=typeof t)return Object.keys(t).forEach((function(e){return n.setUniform(e,t[e])})),this;var r=this.uniforms.find((function(e){return e.name===t}));return r?(r.dirty=!0,r.data=e):this.uniforms.push({name:t,dirty:!0,data:e}),this.dirty=!0,this}}]),i}($f);function Sd(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ad(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Sd(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sd(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Td,Id=(hd=(0,nl.b2)(),pd=(0,nl.f3)(rl.MaterialComponentManager),vd=(0,nl.f3)(rl.RenderEngine),gd=(0,nl.f3)(rl.ShaderModuleService),hd((wd=function(){function t(){Bf(this,t),Uf(this,"material",bd,this),Uf(this,"engine",_d,this),Uf(this,"shaderModule",xd,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.material.clear()}},{key:"createShaderMaterial",value:function(t){var e=Zf(),n=t.vertexShader,r=t.fragmentShader,i=[];if(!this.engine.supportWebGPU){var o="material-".concat(e);this.shaderModule.registerModule(o,{vs:t.vertexShader,fs:t.fragmentShader});var a=this.shaderModule.getModule(o);n=a.vs,r=a.fs,a.uniforms&&(i=Object.keys(a.uniforms).map((function(t){return{dirty:!0,name:t,data:a.uniforms[t]}})))}return this.material.create(e,Ad(Ad({vertexShaderGLSL:n,fragmentShaderGLSL:r},t),{},{uniforms:i}))}}]),t}(),bd=Wf((md=wd).prototype,"material",[pd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_d=Wf(md.prototype,"engine",[vd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xd=Wf(md.prototype,"shaderModule",[gd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),yd=md))||yd);!function(t){t[t.Standard=0]="Standard"}(Td||(Td={}));var Nd=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).strategy=Td.Standard,e.visibilityPlaneMask=0,e.visible=!1,Object.assign(fl(e),t),e}return i}($f),Od=function(){function t(e,n){Bf(this,t),this.center=void 0,this.halfExtents=void 0,this.min=kl(),this.max=kl(),this.update(e,n)}return Vf(t,[{key:"update",value:function(t,e){this.center=t||kl(),this.halfExtents=e||Rl(.5,.5,.5),this.min=Hl(this.min,this.center,this.halfExtents),this.max=Ll(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,e){Ll(this.center,e,t),Fl(this.center,this.center,.5),Hl(this.halfExtents,e,t),Fl(this.halfExtents,this.halfExtents,.5),Pl(this.min,t),Pl(this.max,e)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(t){var e=this.center,n=e[0],r=e[1],i=e[2],o=this.halfExtents,a=o[0],u=o[1],s=o[2],c=n-a,f=n+a,l=r-u,d=r+u,h=i-s,p=i+s,v=t.center,g=v[0],y=v[1],m=v[2],b=t.halfExtents,_=b[0],x=b[1],w=b[2],E=g-_,S=g+_,A=y-x,T=y+x,I=m-w,N=m+w;E<c&&(c=E),S>f&&(f=S),A<l&&(l=A),T>d&&(d=T),I<h&&(h=I),N>p&&(p=N),e[0]=.5*(c+f),e[1]=.5*(l+d),e[2]=.5*(h+p),o[0]=.5*(f-c),o[1]=.5*(d-l),o[2]=.5*(p-h),this.min[0]=c,this.min[1]=l,this.min[2]=h,this.max[0]=f,this.max[1]=d,this.max[2]=p}},{key:"intersects",value:function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return n[0]<=r[0]&&e[0]>=i[0]&&n[1]<=r[1]&&e[1]>=i[1]&&n[2]<=r[2]&&e[2]>=i[2]}},{key:"containsPoint",value:function(t){var e=this.getMin(),n=this.getMax();return!(t[0]<e[0]||t[0]>n[0]||t[1]<e[1]||t[1]>n[1]||t[2]<e[2]||t[2]>n[2])}},{key:"getNegativeFarPoint",value:function(t){return 273===t.pnVertexFlag?Pl(kl(),this.min):272===t.pnVertexFlag?Rl(this.min[0],this.min[1],this.max[2]):257===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.min[2]):256===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.max[2]):17===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.min[2]):16===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.max[2]):1===t.pnVertexFlag?Rl(this.max[0],this.max[1],this.min[2]):Rl(this.max[0],this.max[1],this.max[2])}},{key:"getPositiveFarPoint",value:function(t){return 273===t.pnVertexFlag?Pl(kl(),this.max):272===t.pnVertexFlag?Rl(this.max[0],this.max[1],this.min[2]):257===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.max[2]):256===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.min[2]):17===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.max[2]):16===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.min[2]):1===t.pnVertexFlag?Rl(this.min[0],this.min[1],this.max[2]):Rl(this.min[0],this.min[1],this.min[2])}}]),t}();var Cd,kd=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).material=void 0,e.geometry=void 0,e.aabb=new Od,e.aabbDirty=!0,e.model=void 0,e.visible=!0,e.children=[],Object.assign(fl(e),t),e}return i}($f),Dd=function(){function t(e,n){Bf(this,t),this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=e||0,this.normal=n||Rl(0,1,0),this.updatePNVertexFlag()}return Vf(t,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return Bl(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/ql(this.normal);Fl(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&i<=1;return o&&n&&zl(n,t,e,i),o}}]),t}();!function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"}(Cd||(Cd={}));var Md,Rd,Pd,Gd,Ld,jd,Fd,Ud,Bd,zd,Vd,Wd,Hd,Xd,qd=function(){function t(e){if(Bf(this,t),this.planes=[],e)this.planes=e;else for(var n=0;n<6;n++)this.planes.push(new Dd)}return Vf(t,[{key:"extractFromVPMatrix",value:function(t){var e=el(t,16),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=e[9],d=e[10],h=e[11],p=e[12],v=e[13],g=e[14],y=e[15];Gl(this.planes[0].normal,o-n,c-a,h-f),this.planes[0].distance=-(y-p),Gl(this.planes[1].normal,o+n,c+a,h+f),this.planes[1].distance=-(y+p),Gl(this.planes[2].normal,o+r,c+u,h+l),this.planes[2].distance=-(y+v),Gl(this.planes[3].normal,o-r,c-u,h-l),this.planes[3].distance=-(y-v),Gl(this.planes[4].normal,o-i,c-s,h-d),this.planes[4].distance=-(y-g),Gl(this.planes[5].normal,o+i,c+s,h+d),this.planes[5].distance=-(y+g),this.planes.forEach((function(t){t.normalize(),t.updatePNVertexFlag()}))}}]),t}();function Yd(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Kd(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kd(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Kd(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}var Zd=(Md=(0,nl.b2)(),Rd=(0,nl.f3)(rl.MeshComponentManager),Pd=(0,nl.f3)(rl.CullableComponentManager),Gd=(0,nl.f3)(rl.GeometryComponentManager),Ld=(0,nl.f3)(rl.HierarchyComponentManager),jd=(0,nl.f3)(rl.TransformComponentManager),Md((Xd=function(){function t(){Bf(this,t),Uf(this,"mesh",Bd,this),Uf(this,"cullable",zd,this),Uf(this,"geometry",Vd,this),Uf(this,"hierarchy",Wd,this),Uf(this,"transform",Hd,this),this.planes=void 0}var e;return Vf(t,[{key:"setFrustumPlanes",value:function(t){this.planes=t}},{key:"execute",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y,m,b,_,x,w;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Yd(e);try{for(n.s();!(r=n.n()).done;){i=r.value,o=i.getScene(),a=i.getCamera(),u=Yd(o.getEntities());try{for(u.s();!(s=u.n()).done;)c=s.value,(f=this.mesh.getComponentByEntity(c))&&(l=this.hierarchy.getComponentByEntity(c),d=this.cullable.getComponentByEntity(c),h=f.geometry,p=this.transform.getComponentByEntity(c),h&&h.aabb&&p&&f.aabbDirty&&(v=p.worldTransform,g=h.aabb,y=g.center,m=g.halfExtents,b=Vl(kl(),y,v),E=v,(S=Cl())[0]=E[0],S[1]=E[1],S[2]=E[2],S[3]=E[4],S[4]=E[5],S[5]=E[6],S[6]=E[8],S[7]=E[9],S[8]=E[10],_=S,x=Wl(kl(),m,_),f.aabb.update(b,x),f.aabbDirty=!1),d&&h&&(w=this.cullable.getComponentByEntity((null==l?void 0:l.parentID)||-1),d.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(f.aabb,(null==w?void 0:w.visibilityPlaneMask)||Cd.INDETERMINATE,this.planes||a.getFrustum().planes),d.visible=d.visibilityPlaneMask!==Cd.OUTSIDE))}catch(t){u.e(t)}finally{u.f()}}}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return t.stop()}var E,S}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.cullable.clear(),this.mesh.clear()}},{key:"computeVisibilityWithPlaneMask",value:function(t,e,n){if(e===Cd.OUTSIDE||e===Cd.INSIDE)return e;for(var r=Cd.INSIDE,i=0,o=n.length;i<o;++i){var a=i<31?1<<i:0;if(!(i<31&&0==(e&a))){var u=n[i],s=u.normal,c=u.distance;if(Bl(s,t.getNegativeFarPoint(n[i]))+c>0)return Cd.OUTSIDE;Bl(s,t.getPositiveFarPoint(n[i]))+c>0&&(r|=a)}}return r}}]),t}(),Bd=Wf((Ud=Xd).prototype,"mesh",[Rd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),zd=Wf(Ud.prototype,"cullable",[Pd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Vd=Wf(Ud.prototype,"geometry",[Gd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Wd=Wf(Ud.prototype,"hierarchy",[Ld],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Hd=Wf(Ud.prototype,"transform",[jd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Fd=Ud))||Fd);function $d(){var t=new Tl(16);return Tl!=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 Jd(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 Qd(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 th(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=e[9],d=e[10],h=e[11],p=e[12],v=e[13],g=e[14],y=e[15],m=n*u-r*a,b=n*s-i*a,_=n*c-o*a,x=r*s-i*u,w=r*c-o*u,E=i*c-o*s,S=f*v-l*p,A=f*g-d*p,T=f*y-h*p,I=l*g-d*v,N=l*y-h*v,O=d*y-h*g,C=m*O-b*N+_*I+x*T-w*A+E*S;return C?(C=1/C,t[0]=(u*O-s*N+c*I)*C,t[1]=(i*N-r*O-o*I)*C,t[2]=(v*E-g*w+y*x)*C,t[3]=(d*w-l*E-h*x)*C,t[4]=(s*T-a*O-c*A)*C,t[5]=(n*O-i*T+o*A)*C,t[6]=(g*_-p*E-y*b)*C,t[7]=(f*E-d*_+h*b)*C,t[8]=(a*N-u*T+c*S)*C,t[9]=(r*T-n*N-o*S)*C,t[10]=(p*w-v*_+y*m)*C,t[11]=(l*_-f*w-h*m)*C,t[12]=(u*A-a*I-s*S)*C,t[13]=(n*I-r*A+i*S)*C,t[14]=(v*b-p*x-g*m)*C,t[15]=(f*x-l*b+d*m)*C,t):null}function eh(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],d=e[9],h=e[10],p=e[11],v=e[12],g=e[13],y=e[14],m=e[15],b=n[0],_=n[1],x=n[2],w=n[3];return t[0]=b*r+_*u+x*l+w*v,t[1]=b*i+_*s+x*d+w*g,t[2]=b*o+_*c+x*h+w*y,t[3]=b*a+_*f+x*p+w*m,b=n[4],_=n[5],x=n[6],w=n[7],t[4]=b*r+_*u+x*l+w*v,t[5]=b*i+_*s+x*d+w*g,t[6]=b*o+_*c+x*h+w*y,t[7]=b*a+_*f+x*p+w*m,b=n[8],_=n[9],x=n[10],w=n[11],t[8]=b*r+_*u+x*l+w*v,t[9]=b*i+_*s+x*d+w*g,t[10]=b*o+_*c+x*h+w*y,t[11]=b*a+_*f+x*p+w*m,b=n[12],_=n[13],x=n[14],w=n[15],t[12]=b*r+_*u+x*l+w*v,t[13]=b*i+_*s+x*d+w*g,t[14]=b*o+_*c+x*h+w*y,t[15]=b*a+_*f+x*p+w*m,t}function nh(t,e,n){var r,i,o,a,u,s,c,f,l,d,h,p,v=n[0],g=n[1],y=n[2];return e===t?(t[12]=e[0]*v+e[4]*g+e[8]*y+e[12],t[13]=e[1]*v+e[5]*g+e[9]*y+e[13],t[14]=e[2]*v+e[6]*g+e[10]*y+e[14],t[15]=e[3]*v+e[7]*g+e[11]*y+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],d=e[9],h=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=s,t[6]=c,t[7]=f,t[8]=l,t[9]=d,t[10]=h,t[11]=p,t[12]=r*v+u*g+l*y+e[12],t[13]=i*v+s*g+d*y+e[13],t[14]=o*v+c*g+h*y+e[14],t[15]=a*v+f*g+p*y+e[15]),t}function rh(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function ih(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],u=e[6],s=e[8],c=e[9],f=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,u),t[2]=Math.hypot(s,c,f),t}function oh(t,e){var n=new Tl(3);ih(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,u=e[1]*i,s=e[2]*o,c=e[4]*r,f=e[5]*i,l=e[6]*o,d=e[8]*r,h=e[9]*i,p=e[10]*o,v=a+f+p,g=0;return v>0?(g=2*Math.sqrt(v+1),t[3]=.25*g,t[0]=(l-h)/g,t[1]=(d-s)/g,t[2]=(u-c)/g):a>f&&a>p?(g=2*Math.sqrt(1+a-f-p),t[3]=(l-h)/g,t[0]=.25*g,t[1]=(u+c)/g,t[2]=(d+s)/g):f>p?(g=2*Math.sqrt(1+f-a-p),t[3]=(d-s)/g,t[0]=(u+c)/g,t[1]=.25*g,t[2]=(l+h)/g):(g=2*Math.sqrt(1+p-a-f),t[3]=(u-c)/g,t[0]=(d+s)/g,t[1]=(l+h)/g,t[2]=.25*g),t}function ah(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,u=r+r,s=i+i,c=n*a,f=r*a,l=r*u,d=i*a,h=i*u,p=i*s,v=o*a,g=o*u,y=o*s;return t[0]=1-l-p,t[1]=f+y,t[2]=d-g,t[3]=0,t[4]=f-y,t[5]=1-c-p,t[6]=h+v,t[7]=0,t[8]=d+g,t[9]=h-v,t[10]=1-c-l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}var uh,sh,ch,fh,lh,dh,hh,ph,vh,gh,yh,mh,bh,_h,xh,wh,Eh,Sh,Ah,Th,Ih,Nh,Oh,Ch;function kh(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Dh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Dh(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}var Mh,Rh,Ph,Gh,Lh,jh,Fh,Uh,Bh,zh,Vh,Wh,Hh,Xh=(uh=(0,nl.b2)(),sh=(0,nl.f3)(rl.MeshComponentManager),ch=(0,nl.f3)(rl.GeometryComponentManager),fh=(0,nl.f3)(rl.MaterialComponentManager),lh=(0,nl.f3)(rl.CullableComponentManager),dh=(0,nl.f3)(rl.TransformComponentManager),hh=(0,nl.f3)(rl.HierarchyComponentManager),ph=(0,nl.f3)(rl.Systems),vh=(0,nl.t6)(rl.FrameGraphSystem),gh=(0,nl.f3)(rl.RenderEngine),yh=(0,nl.f3)(rl.ResourcePool),uh((Ch=Oh=function(){function t(){var e=this;Bf(this,t),Uf(this,"mesh",_h,this),Uf(this,"geometry",xh,this),Uf(this,"material",wh,this),Uf(this,"cullable",Eh,this),Uf(this,"transform",Sh,this),Uf(this,"hierarchy",Ah,this),Uf(this,"frameGraphSystem",Th,this),Uf(this,"engine",Ih,this),Uf(this,"resourcePool",Nh,this),this.modelCache={},this.setup=function(t,e,n){var r=t.createRenderTarget(e,"color buffer",{width:1,height:1,usage:td.RENDER_ATTACHMENT|td.SAMPLED|td.COPY_SRC});n.data={output:e.write(t,r)}},this.execute=function(){var t=Yf(Xf().mark((function t(n,r,i){var o,a,u,s,c,f;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n.getResourceNode(r.data.output),a=e.resourcePool.getOrCreateResource(o.resource),u=kh(i),t.prev=3,u.s();case 5:if((s=u.n()).done){t.next=11;break}return c=s.value,t.next=9,e.initView(c);case 9:t.next=5;break;case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(3),u.e(t.t0);case 16:return t.prev=16,u.f(),t.finish(16);case 19:f=e.engine.getCanvas(),a.resize({width:f.width,height:f.height}),e.engine.setScissor({enable:!1}),e.engine.clear({framebuffer:a,color:i[0].getClearColor(),depth:1}),e.engine.useFramebuffer(a,(function(){var t,n=kh(i);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.renderView(r)}}catch(t){n.e(t)}finally{n.f()}}));case 24:case"end":return t.stop()}}),t,null,[[3,13,16,19]])})));return function(e,n,r){return t.apply(this,arguments)}}()}var e,n;return Vf(t,[{key:"renderView",value:function(t){var e=t.getScene(),n=t.getCamera(),r=n.getViewTransform(),i=eh($d(),n.getPerspective(),r);n.getFrustum().extractFromVPMatrix(i);var o=t.getViewport(),a=o.x,u=o.y,s=o.width,c=o.height;this.engine.viewport({x:a,y:u,width:s,height:c});var f,l=kh(e.getEntities());try{for(l.s();!(f=l.n()).done;){var d=f.value;this.renderMesh(d,{camera:n,view:t,viewMatrix:r})}}catch(t){l.e(t)}finally{l.f()}}},{key:"renderMesh",value:function(t,e){var n=e.camera,r=e.view,i=e.viewMatrix,o=this.mesh.getComponentByEntity(t);if(o&&o.visible){var a=o.material,u=o.geometry;if(u&&!u.dirty&&a){var s=this.transform.getComponentByEntity(t),c=eh($d(),i,s.worldTransform),f=r.getViewport(),l=f.width,d=f.height;a.setUniform({projectionMatrix:n.getPerspective(),modelViewMatrix:c,modelMatrix:s.worldTransform,viewMatrix:i,cameraPosition:n.getPosition(),u_viewport:[l,d]}),o.model&&(o.model.draw({uniforms:a.uniforms.reduce((function(t,e){return t[e.name]=e.data,t}),{})}),a.uniforms.forEach((function(t){t.dirty=!1})),a.dirty=!1)}}}},{key:"initMesh",value:(n=Yf(Xf().mark((function t(e,n){var r,i,o,a,u,s,c,f;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.mesh.getComponentByEntity(e)){t.next=3;break}return t.abrupt("return");case 3:if(i=r.material,(o=r.geometry)&&!o.dirty&&i){t.next=7;break}return t.abrupt("return");case 7:if(r.model){t.next=24;break}if(a="m-".concat(i.entity,"-g-").concat(o.entity),!this.modelCache[a]){t.next=12;break}return r.model=this.modelCache[a],t.abrupt("return");case 12:return i.setUniform({projectionMatrix:1,modelViewMatrix:1,modelMatrix:1,viewMatrix:1,cameraPosition:1,u_viewport:1}),u=this.engine,s=u.createModel,c=u.createAttribute,f={vs:i.vertexShaderGLSL,fs:i.fragmentShaderGLSL,defines:i.defines,attributes:o.attributes.reduce((function(t,e){return e.data&&e.buffer&&(t[e.name]=c({buffer:e.buffer,attributes:e.attributes,arrayStride:e.arrayStride,stepMode:e.stepMode,divisor:"vertex"===e.stepMode?0:1})),t}),{}),uniforms:i.uniforms.reduce((function(t,e){return t[e.name]=e.data,t}),{}),scissor:{enable:!0,box:function(){return n.getViewport()}}},i.cull&&(f.cull=i.cull),i.depth&&(f.depth=i.depth),i.blend&&(f.blend=i.blend),o.indicesBuffer&&(f.elements=o.indicesBuffer),o.maxInstancedCount&&(f.instances=o.maxInstancedCount,f.count=o.vertexCount||3),t.next=22,s(f);case 22:r.model=t.sent,this.modelCache[a]=r.model;case 24:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"initView",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.getScene(),r=kh(n.getEntities()),t.prev=2,r.s();case 4:if((i=r.n()).done){t.next=10;break}return o=i.value,t.next=8,this.initMesh(o,e);case 8:t.next=4;break;case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(2),r.e(t.t0);case 15:return t.prev=15,r.f(),t.finish(15);case 18:case"end":return t.stop()}}),t,this,[[2,12,15,18]])}))),function(t){return e.apply(this,arguments)})}]),t}(),Oh.IDENTIFIER="Render Pass",_h=Wf((bh=Ch).prototype,"mesh",[sh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xh=Wf(bh.prototype,"geometry",[ch],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),wh=Wf(bh.prototype,"material",[fh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Eh=Wf(bh.prototype,"cullable",[lh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sh=Wf(bh.prototype,"transform",[dh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ah=Wf(bh.prototype,"hierarchy",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Th=Wf(bh.prototype,"frameGraphSystem",[ph,vh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ih=Wf(bh.prototype,"engine",[gh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Nh=Wf(bh.prototype,"resourcePool",[yh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),mh=bh))||mh);function qh(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Yh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Yh(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}var Kh,Zh,$h,Jh,Qh,tp,ep,np,rp,ip,op,ap,up,sp,cp,fp,lp,dp,hp,pp,vp,gp,yp=(Mh=(0,nl.b2)(),Rh=(0,nl.f3)(rl.RenderEngine),Ph=(0,nl.f3)(rl.ResourcePool),Gh=(0,nl.f3)(rl.RenderPassFactory),Lh=(0,nl.f3)(rl.MeshComponentManager),Mh((Hh=Wh=function(){function t(){var e=this;Bf(this,t),Uf(this,"engine",Uh,this),Uf(this,"resourcePool",Bh,this),Uf(this,"renderPassFactory",zh,this),Uf(this,"mesh",Vh,this),this.pickingFBO=void 0,this.views=void 0,this.highlightEnabled=!0,this.highlightColor=[255,0,0,255],this.alreadyInRendering=!1,this.setup=function(t,e,n){var r=t.createRenderTarget(e,"picking fbo",{width:1,height:1});n.data={output:e.write(t,r)},e.hasSideEffect=!0},this.execute=function(){var t=Yf(Xf().mark((function t(n,r,i){var o,a,u;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.views=i,!e.alreadyInRendering){t.next=3;break}return t.abrupt("return");case 3:o=qh(i);try{for(u=function(){var t=a.value,i=t.getViewport(),o=i.width,u=i.height;e.alreadyInRendering=!0;var s=n.getResourceNode(r.data.output);e.pickingFBO=e.resourcePool.getOrCreateResource(s.resource),e.pickingFBO.resize({width:o,height:u}),e.engine.useFramebuffer(e.pickingFBO,(function(){e.engine.clear({framebuffer:e.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});var n,r=e.renderPassFactory(Xh.IDENTIFIER),i=[],o=qh(t.getScene().getEntities());try{for(o.s();!(n=o.n()).done;){var a=n.value,u=e.mesh.getComponentByEntity(a);u.material.setUniform("u_PickingStage",1),i.push(u)}}catch(t){o.e(t)}finally{o.f()}r.renderView(t),i.forEach((function(t){t.material.setUniform("u_PickingStage",2)})),e.alreadyInRendering=!1}))},o.s();!(a=o.n()).done;)u()}catch(t){o.e(t)}finally{o.f()}case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),this.pick=function(t,n){var r,i,o=t.x,a=t.y,u=e.engine,s=u.readPixels,c=u.useFramebuffer,f=n.getViewport(),l=f.width,d=f.height,h=o*window.devicePixelRatio,p=a*window.devicePixelRatio;if(!(h>l||h<0||p>d||p<0))return c(e.pickingFBO,(function(){var t;0===(r=s({x:Math.round(h),y:Math.round(d-(a+1)*window.devicePixelRatio),width:1,height:1,data:new Uint8Array(4),framebuffer:e.pickingFBO}))[0]&&0===r[1]&&0===r[2]||(t=el(r,3),i=t[0]+256*t[1]+65536*t[2]-1,e.highlightEnabled&&e.highlightPickedFeature(r,n))})),i}}return Vf(t,[{key:"enableHighlight",value:function(t){this.highlightEnabled=t}},{key:"setHighlightColor",value:function(t){this.highlightColor=t}},{key:"highlightPickedFeature",value:function(t,e){if(t){var n,r=qh(e.getScene().getEntities());try{for(r.s();!(n=r.n()).done;){var i=n.value,o=this.mesh.getComponentByEntity(i).material;o.setUniform("u_PickingStage",2),o.setUniform("u_PickingColor",[t[0],t[1],t[2]]),o.setUniform("u_HighlightColor",this.highlightColor)}}catch(t){r.e(t)}finally{r.f()}}}}]),t}(),Wh.IDENTIFIER="PixelPicking Pass",Uh=Wf((Fh=Hh).prototype,"engine",[Rh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Bh=Wf(Fh.prototype,"resourcePool",[Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),zh=Wf(Fh.prototype,"renderPassFactory",[Gh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Vh=Wf(Fh.prototype,"mesh",[Lh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),jh=Fh))||jh),mp=(Kh=(0,nl.b2)(),Zh=(0,nl.f3)(rl.RenderEngine),$h=(0,nl.f3)(rl.ResourcePool),Kh((rp=np=function t(){var e=this;Bf(this,t),Uf(this,"engine",tp,this),Uf(this,"resourcePool",ep,this),this.model=void 0,this.setup=function(t,e,n){var r=t.getPass(Xh.IDENTIFIER);if(r){var i=t.createRenderTarget(e,"render to screen",{width:1,height:1});n.data={input:e.read(r.data.output),output:e.write(t,i)}}},this.execute=function(){var t=Yf(Xf().mark((function t(n,r){var i,o,a,u,s,c,f;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=e.engine,o=i.createModel,a=i.createAttribute,u=i.createBuffer,e.model){t.next=6;break}return t.next=4,o({vs:e.engine.supportWebGPU?"layout(location = 0) in vec2 a_Position;\nlayout(location = 0) out vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}":"attribute vec2 a_Position;\n\nvarying vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}",fs:e.engine.supportWebGPU?"layout(set = 0, binding = 0) uniform sampler u_TextureSampler;\nlayout(set = 0, binding = 1) uniform texture2D u_Texture;\n\nlayout(location = 0) in vec2 v_UV;\nlayout(location = 0) out vec4 outColor;\n\nvoid main() {\n outColor = texture(sampler2D(u_Texture, u_TextureSampler), v_UV);\n}":"varying vec2 v_UV;\n\nuniform sampler2D u_Texture;\n\nvoid main() {\n gl_FragColor = vec4(texture2D(u_Texture, v_UV));\n}",attributes:{a_Position:a({buffer:u({data:[-4,-4,4,-4,0,4],type:td.FLOAT}),size:2,arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})},uniforms:{u_Texture:null},depth:{enable:!1},count:3,blend:{enable:!0}});case 4:s=t.sent,e.model=s;case 6:c=n.getResourceNode(r.data.input),f=e.resourcePool.getOrCreateResource(c.resource),e.engine.useFramebuffer(null,(function(){e.engine.clear({framebuffer:null,color:[0,0,0,0],depth:1,stencil:0}),e.model.draw({uniforms:{u_Texture:f}})}));case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),this.tearDown=function(){e.model=void 0}},np.IDENTIFIER="Copy Pass",tp=Wf((Qh=rp).prototype,"engine",[Zh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ep=Wf(Qh.prototype,"resourcePool",[$h],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Jh=Qh))||Jh),bp=(ip=(0,nl.b2)(),op=(0,nl.f3)(rl.Systems),ap=(0,nl.t6)(rl.FrameGraphSystem),up=(0,nl.f3)(rl.RenderPassFactory),sp=(0,nl.f3)(rl.ConfigService),cp=(0,nl.f3)(rl.ResourcePool),ip((gp=function(){function t(){Bf(this,t),Uf(this,"frameGraphSystem",dp,this),Uf(this,"renderPassFactory",hp,this),Uf(this,"configService",pp,this),Uf(this,"resourcePool",vp,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a,u,s,c;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.renderPassFactory(Xh.IDENTIFIER),r=n.setup,i=n.execute,this.frameGraphSystem.addPass(Xh.IDENTIFIER,r,i),o=this.renderPassFactory(mp.IDENTIFIER),a=o.setup,u=o.execute,s=o.tearDown,c=this.frameGraphSystem.addPass(mp.IDENTIFIER,a,u,s),this.frameGraphSystem.present(c.data.output);case 5:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.resourcePool.clean()}},{key:"pick",value:function(t,e){return this.renderPassFactory(yp.IDENTIFIER).pick(t,e)}}]),t}(),dp=Wf((lp=gp).prototype,"frameGraphSystem",[op,ap],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),hp=Wf(lp.prototype,"renderPassFactory",[up],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),pp=Wf(lp.prototype,"configService",[sp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vp=Wf(lp.prototype,"resourcePool",[cp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),fp=lp))||fp);var _p,xp,wp,Ep,Sp,Ap,Tp,Ip,Np,Op,Cp=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).parentID=void 0,Object.assign(fl(e),t),e}return i}($f),kp=(_p=(0,nl.b2)(),xp=(0,nl.f3)(rl.HierarchyComponentManager),wp=(0,nl.f3)(rl.TransformComponentManager),Ep=(0,nl.f3)(rl.MeshComponentManager),_p((Op=function(){function t(){Bf(this,t),Uf(this,"hierarchy",Tp,this),Uf(this,"transform",Ip,this),Uf(this,"mesh",Np,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.runTransformUpdateSystem(),this.runHierarchyUpdateSystem();case 2:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.hierarchy.clear(),this.transform.clear()}},{key:"getHierarchyComponentManager",value:function(){return this.hierarchy}},{key:"getTransformComponentManager",value:function(){return this.transform}},{key:"runTransformUpdateSystem",value:function(){var t=this;this.transform.forEach((function(e,n){(n.isDirty()||n.isLocalDirty())&&(t.setMeshAABBDirty(t.mesh.getComponentByEntity(e)),n.updateTransform())}))}},{key:"runHierarchyUpdateSystem",value:function(){var t=this;this.hierarchy.forEach((function(e,n){var r=t.transform.getComponentByEntity(e),i=t.transform.getComponentByEntity(n.parentID);null!==r&&null!==i&&r.updateTransformWithParent(i)}))}},{key:"attach",value:function(t,e,n){this.hierarchy.contains(t)&&this.detach(t),this.hierarchy.create(t,{parentID:e});var r=this.mesh.getComponentByEntity(e);if(this.setMeshAABBDirty(r),r&&-1===r.children.indexOf(t)&&r.children.push(t),this.hierarchy.getCount()>1)for(var i=this.hierarchy.getCount()-1;i>0;--i)for(var o=this.hierarchy.getEntity(i),a=0;a<i;++a)if(this.hierarchy.getComponent(a).parentID===o){this.hierarchy.moveItem(i,a),++i;break}this.hierarchy.getComponentByEntity(t);var u=this.transform.getComponentByEntity(e);null===u&&(u=this.transform.create(e));var s=this.transform.getComponentByEntity(t);null===s&&(s=this.transform.create(t),u=this.transform.getComponentByEntity(e)),s.parent=u,!n&&u&&(s.matrixTransform(th($d(),u.worldTransform)),s.updateTransform()),u&&s.updateTransformWithParent(u)}},{key:"detach",value:function(t){var e=this.hierarchy.getComponentByEntity(t);if(null!==e){var n=this.transform.getComponentByEntity(t);null!==n&&(n.parent=null,n.applyTransform()),this.hierarchy.removeKeepSorted(t);var r=this.mesh.getComponentByEntity(e.parentID);if(r){var i=r.children.indexOf(t);r.children.splice(i,1)}this.setMeshAABBDirty(r)}}},{key:"detachChildren",value:function(t){var e=this.mesh.getComponentByEntity(t);e&&(e.children=[]);for(var n=0;n<this.hierarchy.getCount();){var r;if((null===(r=this.hierarchy.getComponent(n))||void 0===r?void 0:r.parentID)===t){var i=this.hierarchy.getEntity(n);this.detach(i)}else++n}}},{key:"setMeshAABBDirty",value:function(t){t&&(t.aabbDirty=!0)}}]),t}(),Tp=Wf((Ap=Op).prototype,"hierarchy",[xp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ip=Wf(Ap.prototype,"transform",[wp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Np=Wf(Ap.prototype,"mesh",[Ep],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sp=Ap))||Sp);function Dp(){var t=new Tl(4);return Tl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Mp(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 Rp(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=n[0],s=n[1],c=n[2],f=n[3];return t[0]=r*f+a*u+i*c-o*s,t[1]=i*f+a*s+o*u-r*c,t[2]=o*f+a*c+r*s-i*u,t[3]=a*f-r*u-i*s-o*c,t}function Pp(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,u=a?1/a:0;return t[0]=-n*u,t[1]=-r*u,t[2]=-i*u,t[3]=o*u,t}function Gp(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var o=Math.sin(e),a=Math.cos(e),u=Math.sin(n),s=Math.cos(n),c=Math.sin(r),f=Math.cos(r);return t[0]=o*s*f-a*u*c,t[1]=a*u*f+o*s*c,t[2]=a*s*c-o*u*f,t[3]=a*s*f+o*u*c,t}var Lp=Nl,jp=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Fp=Rp,Up=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t};kl(),Rl(1,0,0),Rl(0,1,0),Dp(),Dp(),Cl();var Bp=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e,n,o,a,u,s,c,f,l,d,h,p,v,g,y;return Bf(this,i),(e=r.call(this,t)).dirtyFlag=void 0,e.localDirtyFlag=void 0,e.parent=null,e.localPosition=Rl(0,0,0),e.localRotation=Lp(0,0,0,1),e.localScale=Rl(1,1,1),e.localTransform=$d(),e.position=Rl(0,0,0),e.rotation=Lp(0,0,0,1),e.scaling=Rl(1,1,1),e.worldTransform=$d(),e.matrixTransform=(n=$d(),function(t){eh(n,e.getLocalTransform(),t),ih(e.localScale,n),rh(e.localPosition,n),oh(e.localRotation,n)}),e.rotateRollPitchYaw=(o=Dp(),a=Dp(),u=Dp(),function(t,n,r){e.setDirty(),Gp(o,t,0,0),Gp(a,0,n,0),Gp(u,0,0,r),Rp(e.localRotation,o,e.localRotation),Rp(e.localRotation,e.localRotation,a),Rp(e.localRotation,u,e.localRotation),Up(e.localRotation,e.localRotation)}),e.lerp=(s=kl(),c=Dp(),f=kl(),l=kl(),d=Dp(),h=kl(),function(t,n,r){e.setDirty(),ih(s,t.worldTransform),rh(f,t.worldTransform),oh(c,t.worldTransform),ih(l,n.worldTransform),rh(h,n.worldTransform),oh(d,n.worldTransform),zl(e.localScale,s,l,r),function(t,e,n,r){var i,o,a,u,s,c=e[0],f=e[1],l=e[2],d=e[3],h=n[0],p=n[1],v=n[2],g=n[3];(o=c*h+f*p+l*v+d*g)<0&&(o=-o,h=-h,p=-p,v=-v,g=-g),1-o>Al?(i=Math.acos(o),a=Math.sin(i),u=Math.sin((1-r)*i)/a,s=Math.sin(r*i)/a):(u=1-r,s=r),t[0]=u*c+s*h,t[1]=u*f+s*p,t[2]=u*l+s*v,t[3]=u*d+s*g}(e.localRotation,c,d,r),zl(e.localPosition,f,h,r)}),e.translate=(y=kl(),function(t){return Ll(y,e.getPosition(),t),e.setPosition(y),e.setDirty(!0),fl(e)}),e.translateLocal=function(t){return function(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],u=e[0],s=e[1],c=e[2],f=i*c-o*s,l=o*u-r*c,d=r*s-i*u,h=i*d-o*l,p=o*f-r*d,v=r*l-i*f,g=2*a;f*=g,l*=g,d*=g,h*=2,p*=2,v*=2,t[0]=u+f+h,t[1]=s+l+p,t[2]=c+d+v}(t,t,e.localRotation),Ll(e.localPosition,e.localPosition,t),e.setLocalDirty(!0),fl(e)},e.setPosition=(p=$d(),function(t){return e.position=t,e.setLocalDirty(!0),null===e.parent?Pl(e.localPosition,t):(Jd(p,e.parent.worldTransform),th(p,p),Vl(e.localPosition,t,p)),fl(e)}),e.rotate=(v=Dp(),function(t){if(null===e.parent)Rp(e.localRotation,e.localRotation,t),Up(e.localRotation,e.localRotation);else{var n=e.getRotation(),r=e.parent.getRotation();jp(v,r),Pp(v,v),Rp(v,v,t),Rp(e.localRotation,t,n),Up(e.localRotation,e.localRotation)}return e.setLocalDirty(),fl(e)}),e.rotateLocal=function(t){return Rp(e.localRotation,e.localRotation,t),Up(e.localRotation,e.localRotation),e.setLocalDirty(!0),fl(e)},e.setRotation=(g=Dp(),function(t){return null===e.parent?jp(e.localRotation,t):(jp(g,e.parent.getRotation()),Pp(g,g),jp(e.localRotation,g),Fp(e.localRotation,e.localRotation,t)),e.setLocalDirty(!0),fl(e)}),e}return Vf(i,[{key:"setLocalPosition",value:function(t){Pl(this.localPosition,t),this.setLocalDirty(!0)}},{key:"setLocalScale",value:function(t){Pl(this.localScale,t),this.setLocalDirty(!0)}},{key:"setLocalRotation",value:function(t){return jp(this.localRotation,t),this.setLocalDirty(!0),this}},{key:"isDirty",value:function(){return this.dirtyFlag}},{key:"setDirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t?this.dirtyFlag|=i.DIRTY:this.dirtyFlag&=~i.DIRTY}},{key:"isLocalDirty",value:function(){return this.localDirtyFlag}},{key:"setLocalDirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t?(this.localDirtyFlag|=i.DIRTY,this.setDirty(!0)):this.localDirtyFlag&=~i.DIRTY}},{key:"updateTransform",value:function(){this.isLocalDirty()&&this.getLocalTransform(),this.isDirty()&&null===this.parent&&(Jd(this.worldTransform,this.getLocalTransform()),this.setDirty(!1))}},{key:"updateTransformWithParent",value:function(t){eh(this.worldTransform,t.worldTransform,this.getLocalTransform())}},{key:"applyTransform",value:function(){this.setDirty(),ih(this.localScale,this.worldTransform),rh(this.localPosition,this.worldTransform),oh(this.localRotation,this.worldTransform)}},{key:"clearTransform",value:function(){this.setDirty(),this.localPosition=Rl(0,0,0),this.localRotation=Lp(0,0,0,1),this.localScale=Rl(1,1,1)}},{key:"scaleLocal",value:function(t){return this.setLocalDirty(),e=this.localScale,n=this.localScale,r=t,e[0]=n[0]*r[0],e[1]=n[1]*r[1],e[2]=n[2]*r[2],this;var e,n,r}},{key:"getLocalPosition",value:function(){return this.localPosition}},{key:"getLocalRotation",value:function(){return this.localRotation}},{key:"getLocalScale",value:function(){return this.localScale}},{key:"getLocalTransform",value:function(){return this.localDirtyFlag&&(function(t,e,n,r){var i=e[0],o=e[1],a=e[2],u=e[3],s=i+i,c=o+o,f=a+a,l=i*s,d=i*c,h=i*f,p=o*c,v=o*f,g=a*f,y=u*s,m=u*c,b=u*f,_=r[0],x=r[1],w=r[2];t[0]=(1-(p+g))*_,t[1]=(d+b)*_,t[2]=(h-m)*_,t[3]=0,t[4]=(d-b)*x,t[5]=(1-(l+g))*x,t[6]=(v+y)*x,t[7]=0,t[8]=(h+m)*w,t[9]=(v-y)*w,t[10]=(1-(l+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1}(this.localTransform,this.localRotation,this.localPosition,this.localScale),this.setLocalDirty(!1)),this.localTransform}},{key:"getWorldTransform",value:function(){return this.isLocalDirty()||this.isDirty()?(this.parent&&this.parent.getWorldTransform(),this.updateTransform(),this.worldTransform):this.worldTransform}},{key:"getPosition",value:function(){return rh(this.position,this.worldTransform),this.position}},{key:"getRotation",value:function(){return oh(this.rotation,this.worldTransform),this.rotation}},{key:"getScale",value:function(){return ih(this.scaling,this.worldTransform),this.scaling}}]),i}($f);Bp.DIRTY=1;var zp,Vp,Wp,Hp,Xp,qp,Yp=n(1922),Kp=(zp=(0,nl.b2)(),Vp=(0,nl.f3)(rl.RenderEngine),zp((qp=function(){function t(){Bf(this,t),Uf(this,"engine",Xp,this),this.resourcePool={}}return Vf(t,[{key:"getOrCreateResource",value:function(t){if(!this.resourcePool[t.name]){var e=t.descriptor,n=e.width,r=e.height,i=e.usage;this.resourcePool[t.name]=this.engine.createFramebuffer({color:this.engine.createTexture2D({width:n,height:r,wrapS:td.CLAMP_TO_EDGE,wrapT:td.CLAMP_TO_EDGE,usage:i})})}return this.resourcePool[t.name]}},{key:"clean",value:function(){this.resourcePool={}}}]),t}(),Xp=Wf((Hp=qp).prototype,"engine",[Vp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Wp=Hp))||Wp);var Zp,$p,Jp,Qp,tv=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).name=void 0,e.name=t.name||"",e}return i}($f),ev=(0,nl.b2)()(($p=function(){function t(){Bf(this,t),this.config=void 0}return Vf(t,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),t}(),Zp=$p))||Zp;!function(t){t.PANSTART="PANSTART",t.PANEND="PANEND",t.PANMOVE="PANMOVE",t.PINCH="PINCH",t.KEYDOWN="KEYDOWN",t.KEYUP="KEYUP",t.HOVER="HOVER"}(Qp||(Qp={}));var nv,rv,iv=(0,nl.b2)()(Jp=function(){function t(){Bf(this,t)}return Vf(t,[{key:"listen",value:function(t){}},{key:"on",value:function(t,e){}},{key:"connect",value:function(){}},{key:"disconnect",value:function(){}},{key:"destroy",value:function(){}}]),t}())||Jp,ov=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function av(t){var e={};return{content:t=t.replace(ov,(function(t,n,r){var i=r.split(":"),o=i[0].trim(),a="";switch(i.length>1&&(a=i[1].trim()),n){case"bool":a="true"===a;break;case"float":case"int":a=Number(a);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":a=a?a.replace("[","").replace("]","").split(",").reduce((function(t,e){return t.push(Number(e.trim())),t}),[]):new Array(function(t){var e=0;switch(t){case"vec2":case"ivec2":e=2;break;case"vec3":case"ivec3":e=3;break;case"vec4":case"ivec4":case"mat2":e=4;break;case"mat3":e=9;break;case"mat4":e=16}return e}(n)).fill(0)}return e[o]=a,"uniform ".concat(n," ").concat(o,";\n")})),uniforms:e}}function uv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function sv(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?uv(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uv(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var cv=/precision\s+(high|low|medium)p\s+float/,fv=/#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g,lv=(0,nl.b2)()((rv=function(){function t(){Bf(this,t),this.moduleCache={},this.rawContentCache={}}return Vf(t,[{key:"registerBuiltinModules",value:function(){this.destroy(),this.registerModule("picking",{vs:"attribute vec3 a_PickingColor;\nvarying vec4 v_PickingResult;\n\nuniform vec3 u_PickingColor : [0, 0, 0];\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\nuniform float u_PickingThreshold : 1.0;\nuniform float u_PickingBuffer: 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n abs(vertexColor.r - u_PickingColor.r) < u_PickingThreshold &&\n abs(vertexColor.g - u_PickingColor.g) < u_PickingThreshold &&\n abs(vertexColor.b - u_PickingColor.b) < u_PickingThreshold;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n // compares only in highlight stage\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}",fs:"varying vec4 v_PickingResult;\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 filterHighlightColor(vec4 color) {\n bool selected = bool(v_PickingResult.a);\n\n if (selected) {\n vec4 highLightColor = u_HighlightColor * COLOR_SCALE;\n\n float highLightAlpha = highLightColor.a;\n float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));\n\n vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);\n return vec4(resultRGB, color.a);\n } else {\n return color;\n }\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 filterPickingColor(vec4 color) {\n vec3 pickingColor = v_PickingResult.rgb;\n if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {\n discard;\n }\n return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;\n}\n\n/*\n * Returns picking color if picking is enabled if not\n * highlight color if this item is selected, otherwise unmodified argument.\n */\nvec4 filterColor(vec4 color) {\n return filterPickingColor(filterHighlightColor(color));\n}\n"}),this.registerModule("sdf2d",{vs:"",fs:"/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat sdEquilateralTriangle(vec2 p) {\n float k = sqrt(3.0);\n p.x = abs(p.x) - 1.0;\n p.y = p.y + 1.0/k;\n if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;\n p.x -= clamp( p.x, -2.0, 0.0 );\n return -length(p)*sign(p.y);\n}\n\nfloat sdBox(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);\n}\n\nfloat sdPentagon(vec2 p, float r) {\n vec3 k = vec3(0.809016994,0.587785252,0.726542528);\n p.x = abs(p.x);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagon(vec2 p, float r) {\n vec3 k = vec3(-0.866025404,0.5,0.577350269);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdOctogon(vec2 p, float r) {\n vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );\n p = abs(p);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagram(vec2 p, float r) {\n vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;\n p -= vec2(clamp(p.x,r*k.z,r*k.w),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdRhombus(vec2 p, vec2 b) {\n vec2 q = abs(p);\n float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);\n float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );\n return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );\n}\n\nfloat sdVesica(vec2 p, float r, float d) {\n p = abs(p);\n float b = sqrt(r*r-d*d); // can delay this sqrt\n return ((p.y-b)*d>p.x*b)\n ? length(p-vec2(0.0,b))\n : length(p-vec2(-d,0.0))-r;\n}"})}},{key:"registerModule",value:function(t,e){if(!this.rawContentCache[t]){var n=e.vs,r=void 0===n?"":n,i=e.fs,o=void 0===i?"":i,a=e.uniforms,u=av(r),s=u.content,c=u.uniforms,f=av(o),l=f.content,d=f.uniforms;this.rawContentCache[t]={fs:l,uniforms:sv(sv(sv({},c),d),a),vs:s}}}},{key:"destroy",value:function(){this.moduleCache={},this.rawContentCache={}}},{key:"getModule",value:function(t){var e=this;if(this.moduleCache[t])return this.moduleCache[t];var n,r=this.rawContentCache[t].vs||"",i=this.rawContentCache[t].fs||"",o=this.processModule(r,[],"vs"),a=o.content,u=o.includeList,s=this.processModule(i,[],"fs"),c=s.content,f=s.includeList,l=c,d=(n=u.concat(f).concat(t),n.filter((function(t,e,n){return n.indexOf(t)===e}))).reduce((function(t,n){return sv(sv({},t),e.rawContentCache[n].uniforms)}),{});return cv.test(c)||(l="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n#endif\n"+c),this.moduleCache[t]={fs:l.trim(),uniforms:d,vs:a.trim()},this.moduleCache[t]}},{key:"processModule",value:function(t,e,n){var r=this;return{content:t.replace(fv,(function(t,i){var o=i.split(" ")[0].replace(/"/g,"");if(e.indexOf(o)>-1)return"";var a=r.rawContentCache[o][n];return e.push(o),r.processModule(a||"",e,n).content})),includeList:e}}}]),t}(),nv=rv))||nv,dv=new nl.W2;function hv(){var t=new nl.W2;return t.parent=dv,t.bind(rl.Systems).to(kp).inSingletonScope().whenTargetNamed(rl.SceneGraphSystem),t.bind(rl.Systems).to(El).inSingletonScope().whenTargetNamed(rl.FrameGraphSystem),t.bind(rl.Systems).to(Zd).inSingletonScope().whenTargetNamed(rl.MeshSystem),t.bind(rl.Systems).to(fd).inSingletonScope().whenTargetNamed(rl.GeometrySystem),t.bind(rl.Systems).to(Id).inSingletonScope().whenTargetNamed(rl.MaterialSystem),t.bind(rl.Systems).to(bp).inSingletonScope().whenTargetNamed(rl.RendererSystem),t.bind(rl.ResourcePool).to(Kp).inSingletonScope(),t.bind(rl.ConfigService).to(ev).inSingletonScope(),t.bind(rl.InteractorService).to(iv).inSingletonScope(),t.bind(rl.RenderPass).to(Xh).inSingletonScope().whenTargetNamed(Xh.IDENTIFIER),t.bind(rl.RenderPass).to(mp).inSingletonScope().whenTargetNamed(mp.IDENTIFIER),t.bind(rl.RenderPass).to(yp).inSingletonScope().whenTargetNamed(yp.IDENTIFIER),t.bind(rl.RenderPassFactory).toFactory((function(t){return function(e){return t.container.getNamed(rl.RenderPass,e)}})),t}function pv(t){for(var e=new Od,n=Rl(t[0],t[1],t[2]),r=Rl(t[0],t[1],t[2]),i=3;i<t.length;){var o=t[i++],a=t[i++],u=t[i++];o<n[0]&&(n[0]=o),a<n[1]&&(n[1]=a),u<n[2]&&(n[2]=u),o>r[0]&&(r[0]=o),a>r[1]&&(r[1]=a),u>r[2]&&(r[2]=u)}return e.setMinMax(n,r),e}(0,Yp.Z)(dv,!1),dv.bind(rl.ShaderModuleService).to(lv).inSingletonScope(),dv.bind(rl.NameComponentManager).toConstantValue(new Jf(tv)),dv.bind(rl.HierarchyComponentManager).toConstantValue(new Jf(Cp)),dv.bind(rl.TransformComponentManager).toConstantValue(new Jf(Bp)),dv.bind(rl.MeshComponentManager).toConstantValue(new Jf(kd)),dv.bind(rl.CullableComponentManager).toConstantValue(new Jf(Nd)),dv.bind(rl.GeometryComponentManager).toConstantValue(new Jf(cd)),dv.bind(rl.MaterialComponentManager).toConstantValue(new Jf(Ed));var vv,gv,yv,mv,bv,_v="undefined"!=typeof navigator&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);function xv(t){return"number"==typeof t}function wv(t){return void 0===t?0:t>360||t<-360?t%360:t}function Ev(t,e,n){return xv(t)?Rl(t,e,n):3===t.length?Dl(t):Rl(t[0],t[1],t[2])}kl(),kl(),kl(),kl(),kl(),kl(),n(2697),n(1894),n(1186),n(5275),n(2862),n(9633),function(t){t.Normal="normal",t.PostProcessing="post-processing"}(vv||(vv={})),n(7222),n(5965),n(2391),n(3945),n(7294),n(9586),function(t){t.Void="Void",t.Boolean="Boolean",t.Float="Float",t.Uint32="Uint32",t.Int32="Int32",t.Vector="Vector",t.Vector2Float="vec2<f32>",t.Vector3Float="vec3<f32>",t.Vector4Float="vec4<f32>",t.Vector2Boolean="vec2<bool>",t.Vector3Boolean="vec3<bool>",t.Vector4Boolean="vec4<bool>",t.Vector2Uint="vec2<u32>",t.Vector3Uint="vec3<u32>",t.Vector4Uint="vec4<u32>",t.Vector2Int="vec2<i32>",t.Vector3Int="vec3<i32>",t.Vector4Int="vec4<i32>",t.Matrix="Matrix",t.Matrix3x3Float="mat3x3<f32>",t.Matrix4x4Float="mat4x4<i32>",t.Struct="Struct",t.FloatArray="Float[]",t.Vector4FloatArray="vec4<f32>[]"}(gv||(gv={})),function(t){t.Program="Program",t.Identifier="Identifier",t.VariableDeclaration="VariableDeclaration",t.BlockStatement="BlockStatement",t.ReturnStatement="ReturnStatement",t.FunctionDeclaration="FunctionDeclaration",t.VariableDeclarator="VariableDeclarator",t.AssignmentExpression="AssignmentExpression",t.LogicalExpression="LogicalExpression",t.BinaryExpression="BinaryExpression",t.ArrayExpression="ArrayExpression",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.FunctionExpression="FunctionExpression",t.MemberExpression="MemberExpression",t.ConditionalExpression="ConditionalExpression",t.ExpressionStatement="ExpressionStatement",t.CallExpression="CallExpression",t.NumThreadStatement="NumThreadStatement",t.StorageStatement="StorageStatement",t.DoWhileStatement="DoWhileStatement",t.WhileStatement="WhileStatement",t.ForStatement="ForStatement",t.BreakStatement="BreakStatement",t.ContinueStatement="ContinueStatement",t.IfStatement="IfStatement",t.ImportedFunctionStatement="ImportedFunctionStatement"}(yv||(yv={})),function(t){t.Input="Input",t.Output="Output",t.Uniform="Uniform",t.Workgroup="Workgroup",t.UniformConstant="UniformConstant",t.Image="Image",t.StorageBuffer="StorageBuffer",t.Private="Private",t.Function="Function"}(mv||(mv={})),function(t){t.GLSL100="GLSL100",t.GLSL450="GLSL450",t.WGSL="WGSL"}(bv||(bv={}));var Sv,Av,Tv,Iv,Nv,Ov,Cv,kv,Dv,Mv,Rv=function(){function t(e,n){var r,i;Bf(this,t),this.name=void 0,this.matrix=void 0,this.right=void 0,this.up=void 0,this.forward=void 0,this.position=void 0,this.focalPoint=void 0,this.distanceVector=void 0,this.distance=void 0,this.dollyingStep=void 0,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.name=e,this.matrix=(r=n.matrix,(i=new Tl(16))[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i),this.right=Dl(n.right),this.up=Dl(n.up),this.forward=Dl(n.forward),this.position=Dl(n.position),this.focalPoint=Dl(n.focalPoint),this.distanceVector=Dl(n.distanceVector),this.azimuth=n.azimuth,this.elevation=n.elevation,this.roll=n.roll,this.relAzimuth=n.relAzimuth,this.relElevation=n.relElevation,this.relRoll=n.relRoll,this.dollyingStep=n.dollyingStep,this.distance=n.distance}return Vf(t,[{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getRoll",value:function(){return this.roll}},{key:"retrieve",value:function(t){t.matrix=Jd(t.matrix,this.matrix),t.right=Pl(t.right,this.right),t.up=Pl(t.up,this.up),t.forward=Pl(t.forward,this.forward),t.position=Pl(t.position,this.position),t.focalPoint=Pl(t.focalPoint,this.focalPoint),t.distanceVector=Pl(t.distanceVector,this.distanceVector),t.azimuth=this.azimuth,t.elevation=this.elevation,t.roll=this.roll,t.relAzimuth=this.relAzimuth,t.relElevation=this.relElevation,t.relRoll=this.relRoll,t.dollyingStep=this.dollyingStep,t.distance=this.distance}}]),t}();!function(t){t.ORBITING="ORBITING",t.EXPLORING="EXPLORING",t.TRACKING="TRACKING"}(kv||(kv={})),function(t){t.DEFAULT="DEFAULT",t.ROTATIONAL="ROTATIONAL",t.TRANSLATIONAL="TRANSLATIONAL",t.CINEMATIC="CINEMATIC"}(Dv||(Dv={})),function(t){t.ORTHOGRAPHIC="ORTHOGRAPHIC",t.PERSPECTIVE="PERSPECTIVE"}(Mv||(Mv={}));var Pv,Gv,Lv,jv,Fv,Uv,Bv,zv=Math.PI/180,Vv=180/Math.PI,Wv=(Sv=(0,nl.b2)(),Av=(0,nl.f3)(rl.InteractorService),Sv((Cv=Ov=function(){function t(){Bf(this,t),this.matrix=$d(),this.right=Rl(1,0,0),this.up=Rl(0,1,0),this.forward=Rl(0,0,1),this.position=Rl(0,0,1),this.focalPoint=Rl(0,0,0),this.distanceVector=Rl(0,0,0),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.rotateWorld=!1,Uf(this,"interactor",Nv,this),this.fov=30,this.near=.1,this.far=1e4,this.aspect=1,this.left=void 0,this.rright=void 0,this.top=void 0,this.bottom=void 0,this.zoom=1,this.perspective=$d(),this.view=void 0,this.following=void 0,this.type=kv.EXPLORING,this.trackingMode=Dv.DEFAULT,this.projectionMode=Mv.PERSPECTIVE,this.frustum=new qd,this.landmarks=[],this.landmarkAnimationID=void 0}return Vf(t,[{key:"clone",value:function(){var e=new t;return e.setType(this.type,void 0),e.interactor=this.interactor,e}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.perspective}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"setType",value:function(t,e){return this.type=t,this.type===kv.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===kv.TRACKING&&void 0!==e&&this.setTrackingMode(e),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==kv.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this}},{key:"setWorldRotation",value:function(t){this.rotateWorld=t,this._getAngles()}},{key:"getViewTransform",value:function(){return th($d(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"setMatrix",value:function(t){return this.matrix=t,this._update(),this}},{key:"setAspect",value:function(t){return this.setPerspective(this.near,this.far,this.fov,t),this}},{key:"setViewOffset",value: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===Mv.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}},{key:"clearViewOffset",value:function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===Mv.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}},{key:"setPerspective",value:function(t,e,n,r){return this.projectionMode=Mv.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r,function(t,e,n,r,i){var o,a=1/Math.tan(e/2);t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r)}(this.perspective,this.fov*zv,this.aspect,this.near,this.far),this}},{key:"setOrthographic",value:function(t,e,n,r,i,o){this.projectionMode=Mv.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var a=(this.rright-this.left)/(2*this.zoom),u=(this.top-this.bottom)/(2*this.zoom),s=(this.rright+this.left)/2,c=(this.top+this.bottom)/2,f=s-a,l=s+a,d=c+u,h=c-u;if(void 0!==this.view&&this.view.enabled){var p=(this.rright-this.left)/this.view.fullWidth/this.zoom,v=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l=(f+=p*this.view.offsetX)+p*this.view.width,h=(d-=v*this.view.offsetY)-v*this.view.height}return function(t,e,n,r,i,o,a){var u=1/(e-n),s=1/(r-i),c=1/(o-a);t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*u,t[13]=(i+r)*s,t[14]=(a+o)*c,t[15]=1}(this.perspective,f,l,d,h,i,o),this}},{key:"setPosition",value:function(t,e,n){return this._setPosition(t,e,n),this.setFocalPoint(this.focalPoint),this}},{key:"setFocalPoint",value:function(t,e,n){var r=Rl(0,1,0);if(this.focalPoint=Ev(t,e,n),this.trackingMode===Dv.CINEMATIC){var i=jl(kl(),this.focalPoint,this.position);t=i[0],e=i[1],n=i[2];var o=Ml(i),a=Math.asin(e/o)*Vv,u=90+Math.atan2(n,t)*Vv,s=$d();!function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],u=e[2],s=e[3],c=e[8],f=e[9],l=e[10],d=e[11];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]=o*i-c*r,t[1]=a*i-f*r,t[2]=u*i-l*r,t[3]=s*i-d*r,t[8]=o*r+c*i,t[9]=a*r+f*i,t[10]=u*r+l*i,t[11]=s*r+d*i}(s,s,u*zv),function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],u=e[6],s=e[7],c=e[8],f=e[9],l=e[10],d=e[11];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]=o*i+c*r,t[5]=a*i+f*r,t[6]=u*i+l*r,t[7]=s*i+d*r,t[8]=c*i-o*r,t[9]=f*i-a*r,t[10]=l*i-u*r,t[11]=d*i-s*r}(s,s,a*zv),r=Vl(kl(),[0,1,0],s)}return th(this.matrix,function(t,e,n,r){var i,o,a,u,s,c,f,l,d,h,p=e[0],v=e[1],g=e[2],y=r[0],m=r[1],b=r[2],_=n[0],x=n[1],w=n[2];return Math.abs(p-_)<Al&&Math.abs(v-x)<Al&&Math.abs(g-w)<Al?Qd(t):(f=p-_,l=v-x,d=g-w,i=m*(d*=h=1/Math.hypot(f,l,d))-b*(l*=h),o=b*(f*=h)-y*d,a=y*l-m*f,(h=Math.hypot(i,o,a))?(i*=h=1/h,o*=h,a*=h):(i=0,o=0,a=0),u=l*a-d*o,s=d*i-f*a,c=f*o-l*i,(h=Math.hypot(u,s,c))?(u*=h=1/h,s*=h,c*=h):(u=0,s=0,c=0),t[0]=i,t[1]=u,t[2]=f,t[3]=0,t[4]=o,t[5]=s,t[6]=l,t[7]=0,t[8]=a,t[9]=c,t[10]=d,t[11]=0,t[12]=-(i*p+o*v+a*g),t[13]=-(u*p+s*v+c*g),t[14]=-(f*p+l*v+d*g),t[15]=1,t)}($d(),this.position,this.focalPoint,r)),this._getAxes(),this._getDistance(),this._getAngles(),this}},{key:"setDistance",value:function(t){if(!(this.distance===t||t<0)){this.distance=t,this.distance<2e-4&&(this.distance=2e-4),this.dollyingStep=this.distance/100;var e=kl();t=this.distance;var n=this.forward,r=this.focalPoint;return 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}}},{key:"setMaxDistance",value:function(t){return this.maxDistance=t,this}},{key:"setMinDistance",value:function(t){return this.minDistance=t,this}},{key:"changeAzimuth",value:function(t){return this.setAzimuth(this.azimuth+t),this}},{key:"changeElevation",value:function(t){return this.setElevation(this.elevation+t),this}},{key:"changeRoll",value:function(t){return this.setRoll(this.roll+t),this}},{key:"setAzimuth",value:function(t){return this.azimuth=wv(t),this.computeMatrix(),this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=wv(t),this.computeMatrix(),this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this}},{key:"setRoll",value:function(t){return this.roll=wv(t),this.computeMatrix(),this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this}},{key:"rotate",value:function(t,e,n){if(this.type===kv.EXPLORING){t=wv(t),e=wv(e),n=wv(n);var r=Mp(Dp(),[1,0,0],(this.rotateWorld?1:-1)*e*zv),i=Mp(Dp(),[0,1,0],(this.rotateWorld?1:-1)*t*zv),o=Mp(Dp(),[0,0,1],n*zv),a=Rp(Dp(),i,r);a=Rp(Dp(),a,o);var u=ah($d(),a);nh(this.matrix,this.matrix,[0,0,-this.distance]),eh(this.matrix,this.matrix,u),nh(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation+e)>90)return;this.relElevation=wv(e),this.relAzimuth=wv(t),this.relRoll=wv(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.computeMatrix()}return this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,e){var n=Ev(t,e,0),r=Dl(this.position);return Ll(r,r,Fl(kl(),this.right,n[0])),Ll(r,r,Fl(kl(),this.up,n[1])),this._setPosition(r),this}},{key:"dolly",value:function(t){var e=this.forward,n=Dl(this.position),r=this.dollyingStep,i=this.distance+t*this.dollyingStep;return r=Math.max(Math.min(i,this.maxDistance),this.minDistance)-this.distance,n[0]+=r*e[0],n[1]+=r*e[1],n[2]+=r*e[2],this._setPosition(n),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getDistance():this.type===kv.TRACKING&&Ll(this.focalPoint,n,this.distanceVector),this}},{key:"createLandmark",value:function(t,e){var n=this.clone();n.setPosition(e.position),n.setFocalPoint(e.focalPoint),void 0!==e.roll&&n.setRoll(e.roll);var r=new Rv(t,n);return this.landmarks.push(r),r}},{key:"setLandmark",value:function(t){var e=new Rv(t,this);return this.landmarks.push(e),this}},{key:"gotoLandmark",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,r=this.landmarks.find((function(e){return e.name===t}));if(r){if(0===n)return void r.retrieve(this);void 0!==this.landmarkAnimationID&&window.cancelAnimationFrame(this.landmarkAnimationID),this.interactor.disconnect();var i,o=r.getPosition(),a=r.getFocalPoint(),u=r.getRoll(),s=function t(r){void 0===i&&(i=r);var s,c=r-i,f=(1-Math.cos(c/n*Math.PI))/2,l=kl(),d=kl();if(zl(l,e.focalPoint,a,f),zl(d,e.position,o,f),s=e.roll*(1-f)+u*f,e.setFocalPoint(l),e.setPosition(d),e.setRoll(s),e.computeMatrix(),!(Xl(l,a)+Xl(d,o)>.01))return e.setFocalPoint(l),e.setPosition(d),e.setRoll(s),e.computeMatrix(),void e.interactor.connect();c<n&&(e.landmarkAnimationID=window.requestAnimationFrame(t))};window.requestAnimationFrame(s)}}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles()}},{key:"computeMatrix",value:function(){var t,e,n=Mp(Dp(),[0,0,1],this.roll*zv);Qd(this.matrix),t=Mp(Dp(),[1,0,0],(this.rotateWorld&&this.type!==kv.TRACKING||this.type===kv.TRACKING?1:-1)*this.elevation*zv),e=Mp(Dp(),[0,1,0],(this.rotateWorld&&this.type!==kv.TRACKING||this.type===kv.TRACKING?1:-1)*this.azimuth*zv);var r=Rp(Dp(),e,t);r=Rp(Dp(),r,n);var i=ah($d(),r);this.type===kv.ORBITING||this.type===kv.EXPLORING?(nh(this.matrix,this.matrix,this.focalPoint),eh(this.matrix,this.matrix,i),nh(this.matrix,this.matrix,[0,0,this.distance])):this.type===kv.TRACKING&&(nh(this.matrix,this.matrix,this.position),eh(this.matrix,this.matrix,i))}},{key:"_setPosition",value:function(t,e,n){this.position=Ev(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1}},{key:"_getAxes",value:function(){Pl(this.right,Ev(Ol(Il(),[1,0,0,0],this.matrix))),Pl(this.up,Ev(Ol(Il(),[0,1,0,0],this.matrix))),Pl(this.forward,Ev(Ol(Il(),[0,0,1,0],this.matrix))),Ul(this.right,this.right),Ul(this.up,this.up),Ul(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=Ml(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===kv.TRACKING||this.rotateWorld?(this.elevation=Math.asin(e/r)*Vv,this.azimuth=Math.atan2(-t,-n)*Vv):(this.elevation=-Math.asin(e/r)*Vv,this.azimuth=-Math.atan2(-t,-n)*Vv)}},{key:"_getPosition",value:function(){Pl(this.position,Ev(Ol(Il(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){var t,e;Wl(this.distanceVector,[0,0,-this.distance],(t=Cl(),e=this.matrix,t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t)),Ll(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=jl(kl(),this.focalPoint,this.position),this.distance=Ml(this.distanceVector),this.dollyingStep=this.distance/100}}]),t}(),Ov.ProjectionMode={ORTHOGRAPHIC:"ORTHOGRAPHIC",PERSPECTIVE:"PERSPECTIVE"},Nv=Wf((Iv=Cv).prototype,"interactor",[Av],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Tv=Iv))||Tv),Hv=(Pv=(0,nl.b2)(),Gv=(0,nl.f3)(rl.GeometryComponentManager),Pv((Bv=Uv=function(){function t(){Bf(this,t),this.config=void 0,Uf(this,"geometry",Fv,this),this.entity=void 0,this.component=void 0}return Vf(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.component=this.geometry.create(t),this.component.entity=t,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),t}(),Uv.BOX="box",Uv.SPHERE="sphere",Uv.PLANE="plane",Uv.MERGED="merged",Fv=Wf((jv=Bv).prototype,"geometry",[Gv],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Lv=jv))||Lv),Xv=n(8344);function qv(){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}var Yv={}.toString;var Kv={};Kv["[object Float32Array]"]=Kv["[object Float64Array]"]=Kv["[object Int8Array]"]=Kv["[object Int16Array]"]=Kv["[object Int32Array]"]=Kv["[object Uint8Array]"]=Kv["[object Uint8ClampedArray]"]=Kv["[object Uint16Array]"]=Kv["[object Uint32Array]"]=!0,Kv["[object Arguments]"]=Kv["[object Array]"]=Kv["[object ArrayBuffer]"]=Kv["[object Boolean]"]=Kv["[object DataView]"]=Kv["[object Date]"]=Kv["[object Error]"]=Kv["[object Function]"]=Kv["[object Map]"]=Kv["[object Number]"]=Kv["[object Object]"]=Kv["[object RegExp]"]=Kv["[object Set]"]=Kv["[object String]"]=Kv["[object WeakMap]"]=!1;var Zv,$v,Jv,Qv,tg,eg,ng,rg,ig=Object.prototype.toString,og=function(t){return function(t){return!!t&&"object"===cl(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!!Kv[ig.call(t)]};function ag(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ug(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ag(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ag(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var sg,cg,fg,lg,dg,hg,pg,vg,gg,yg,mg,bg,_g,xg,wg,Eg,Sg,Ag,Tg,Ig,Ng,Og,Cg,kg,Dg,Mg,Rg,Pg,Gg,Lg,jg,Fg,Ug,Bg,zg,Vg=(Zv=(0,nl.b2)(),$v=(0,nl.f3)(rl.RenderEngine),Jv=(0,nl.f3)(rl.ConfigService),Zv((rg=function(){function t(){Bf(this,t),Uf(this,"engine",eg,this),Uf(this,"configService",ng,this),this.entity=Zf(),this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}var e,n,r;return Vf(t,[{key:"init",value:function(){var t=this.configService.get(),e=t.canvas,n=t.engineOptions;this.initPromise=this.engine.init(ug({canvas:e||qv(),swapChainFormat:Xv.EV.BGRA8Unorm,antialiasing:!1},n))}},{key:"setBundle",value:function(t){this.compiledBundle=JSON.parse(JSON.stringify(t))}},{key:"setDispatch",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=t),this}},{key:"setMaxIteration",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=t),this}},{key:"setBinding",value:function(t,e){var n,r=this;if("string"==typeof t){var i=xv(e)||og(e)||(n=e,Array.isArray?Array.isArray(n):function(t,e){return Yv.call(t)==="[object "+e+"]"}(n,"Array"));if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find((function(e){return e.name===t}));if(o)return o.value=e,this;var a=this.compiledBundle.context.uniforms.find((function(e){return e.name===t}));a&&(i?(a.data=e,a.isReferer=!1,a.storageClass===mv.Uniform?this.model&&this.model.updateUniform(t,e):this.model&&this.model.updateBuffer(t,e)):(a.isReferer=!0,a.data=e))}}else Object.keys(t).forEach((function(e){r.setBinding(e,t[e])}));return this}},{key:"execute",value:(r=Yf(Xf().mark((function t(){var e,n,r=this,i=arguments;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=i.length>0&&void 0!==i[0]?i[0]:1,!this.dirty){t.next=6;break}return this.compiledBundle.context&&(e>1?this.compiledBundle.context.maxIteration=e:this.compiledBundle.context.maxIteration++),t.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter((function(t){return t.isReferer})).forEach((function(t){var e=t.data,n=t.name;r.model.confirmInput(e.model,n)})),n=0;n<e;n++)this.model.run();return this.engine.endFrame(),t.abrupt("return",this);case 12:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"getOutput",value:(n=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.model.readData());case 1:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"compile",value:(e=Yf(Xf().mark((function t(){var e,n,r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.initPromise;case 2:return e=ug({},this.compiledBundle.context),n=this.engine.supportWebGPU?this.engine.useWGSL?bv.WGSL:bv.GLSL450:bv.GLSL100,r=this.compiledBundle.shaders[n],e.defines.filter((function(t){return t.runtime})).forEach((function(t){var e="".concat("__DefineValuePlaceholder__").concat(t.name);r=r.replace(e,"".concat(t.value))})),e.shader=r,e.uniforms.forEach((function(t){if(!t.data&&t.storageClass===mv.StorageBuffer){var n=1;t.type===gv.FloatArray?n=1:t.type===gv.Vector4FloatArray&&(n=4),t.data=new Float32Array(e.output.length*n).fill(0)}})),this.compiledBundle.context=e,t.next=11,this.engine.createComputeModel(this.compiledBundle.context);case 11:this.model=t.sent;case 12:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),eg=Wf((tg=rg).prototype,"engine",[$v],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ng=Wf(tg.prototype,"configService",[Jv],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Qv=tg))||Qv),Wg=(sg=(0,nl.b2)(),cg=(0,nl.f3)(rl.MaterialComponentManager),sg((pg=hg=function(){function t(){Bf(this,t),this.config=void 0,Uf(this,"material",dg,this),this.entity=void 0,this.component=void 0}return Vf(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t,e){this.entity=t,this.component=this.material.create(t),this.component.entity=t,this.component.type=e,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),t}(),hg.BASIC="basic",dg=Wf((lg=pg).prototype,"material",[cg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),fg=lg))||fg),Hg=(vg=(0,nl.b2)(),gg=(0,nl.f3)(rl.MeshComponentManager),yg=(0,nl.f3)(rl.CullableComponentManager),mg=(0,nl.f3)(rl.TransformComponentManager),bg=(0,nl.f3)(rl.Systems),_g=(0,nl.t6)(rl.SceneGraphSystem),vg((Ng=Ig=function(){function t(){Bf(this,t),this.attributes={},this.config=void 0,Uf(this,"mesh",Eg,this),Uf(this,"cullable",Sg,this),Uf(this,"transform",Ag,this),Uf(this,"sceneGraphSystem",Tg,this),this.meshComponent=void 0,this.transformComponent=void 0,this.entity=void 0}return Vf(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getTransformComponent",value:function(){return this.transformComponent}},{key:"getMeshComponent",value:function(){return this.meshComponent}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.cullable.create(t),this.meshComponent=this.mesh.create(t),this.transformComponent=this.transform.create(t),this.onEntityCreated()}},{key:"setMaterial",value:function(t){return this.meshComponent.material=t,this}},{key:"setGeometry",value:function(t){return this.meshComponent.geometry=t,this}},{key:"setAttributes",value:function(t){var e=this;Object.keys(t).forEach((function(n){void 0!==t[n]&&t[n]!==e.attributes[n]&&(e.onAttributeChanged({name:n,data:t[n]}),e.attributes[n]=t[n])}))}},{key:"setVisible",value:function(t){var e=this;return this.meshComponent.visible=t,this.meshComponent.children.forEach((function(n){var r=e.mesh.getComponentByEntity(n);r&&(r.visible=t)})),this}},{key:"isVisible",value:function(){return this.meshComponent.visible}},{key:"attach",value:function(t){return this.sceneGraphSystem.attach(this.entity,t.entity),this}},{key:"detach",value:function(){return this.sceneGraphSystem.detach(this.entity),this}},{key:"detachChildren",value:function(){return this.sceneGraphSystem.detachChildren(this.entity),this}},{key:"onEntityCreated",value:function(){}},{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data;this.meshComponent&&this.meshComponent.material&&this.meshComponent.material.setUniform(this.convertAttributeName2UniformName(e),n)}},{key:"convertAttributeName2UniformName",value:function(t){return t}}]),t}(),Ig.POINT="point",Ig.LINE="line",Ig.GRID="grid",Eg=Wf((wg=Ng).prototype,"mesh",[gg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sg=Wf(wg.prototype,"cullable",[yg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ag=Wf(wg.prototype,"transform",[mg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Tg=Wf(wg.prototype,"sceneGraphSystem",[bg,_g],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xg=wg))||xg),Xg=n(6377),qg=n.n(Xg),Yg=function(){function t(e,n){Bf(this,t),this.attribute=void 0,this.buffer=void 0;var r=n.buffer,i=n.offset,o=n.stride,a=n.normalized,u=n.size,s=n.divisor;this.buffer=r,this.attribute={buffer:r.get(),offset:i||0,stride:o||0,normalized:a||!1,divisor:s||0},u&&(this.attribute.size=u)}return Vf(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),Kg=(Sl(Og={},td.POINTS,"points"),Sl(Og,td.LINES,"lines"),Sl(Og,td.LINE_LOOP,"line loop"),Sl(Og,td.LINE_STRIP,"line strip"),Sl(Og,td.TRIANGLES,"triangles"),Sl(Og,td.TRIANGLE_FAN,"triangle fan"),Sl(Og,td.TRIANGLE_STRIP,"triangle strip"),Og),Zg=(Sl(Cg={},td.STATIC_DRAW,"static"),Sl(Cg,td.DYNAMIC_DRAW,"dynamic"),Sl(Cg,td.STREAM_DRAW,"stream"),Cg),$g=(Sl(kg={},td.BYTE,"int8"),Sl(kg,td.UNSIGNED_INT,"int16"),Sl(kg,td.INT,"int32"),Sl(kg,td.UNSIGNED_BYTE,"uint8"),Sl(kg,td.UNSIGNED_SHORT,"uint16"),Sl(kg,td.UNSIGNED_INT,"uint32"),Sl(kg,td.FLOAT,"float"),kg),Jg=(Sl(Dg={},td.ALPHA,"alpha"),Sl(Dg,td.LUMINANCE,"luminance"),Sl(Dg,td.LUMINANCE_ALPHA,"luminance alpha"),Sl(Dg,td.RGB,"rgb"),Sl(Dg,td.RGBA,"rgba"),Sl(Dg,td.RGBA4,"rgba4"),Sl(Dg,td.RGB5_A1,"rgb5 a1"),Sl(Dg,td.RGB565,"rgb565"),Sl(Dg,td.DEPTH_COMPONENT,"depth"),Sl(Dg,td.DEPTH_STENCIL,"depth stencil"),Dg),Qg=(Sl(Mg={},td.DONT_CARE,"dont care"),Sl(Mg,td.NICEST,"nice"),Sl(Mg,td.FASTEST,"fast"),Mg),ty=(Sl(Rg={},td.NEAREST,"nearest"),Sl(Rg,td.LINEAR,"linear"),Sl(Rg,td.LINEAR_MIPMAP_LINEAR,"mipmap"),Sl(Rg,td.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Sl(Rg,td.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Sl(Rg,td.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),Rg),ey=(Sl(Pg={},td.REPEAT,"repeat"),Sl(Pg,td.CLAMP_TO_EDGE,"clamp"),Sl(Pg,td.MIRRORED_REPEAT,"mirror"),Pg),ny=(Sl(Gg={},td.NONE,"none"),Sl(Gg,td.BROWSER_DEFAULT_WEBGL,"browser"),Gg),ry=(Sl(Lg={},td.NEVER,"never"),Sl(Lg,td.ALWAYS,"always"),Sl(Lg,td.LESS,"less"),Sl(Lg,td.LEQUAL,"lequal"),Sl(Lg,td.GREATER,"greater"),Sl(Lg,td.GEQUAL,"gequal"),Sl(Lg,td.EQUAL,"equal"),Sl(Lg,td.NOTEQUAL,"notequal"),Lg),iy=(Sl(jg={},td.FUNC_ADD,"add"),Sl(jg,td.MIN_EXT,"min"),Sl(jg,td.MAX_EXT,"max"),Sl(jg,td.FUNC_SUBTRACT,"subtract"),Sl(jg,td.FUNC_REVERSE_SUBTRACT,"reverse subtract"),jg),oy=(Sl(Fg={},td.ZERO,"zero"),Sl(Fg,td.ONE,"one"),Sl(Fg,td.SRC_COLOR,"src color"),Sl(Fg,td.ONE_MINUS_SRC_COLOR,"one minus src color"),Sl(Fg,td.SRC_ALPHA,"src alpha"),Sl(Fg,td.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Sl(Fg,td.DST_COLOR,"dst color"),Sl(Fg,td.ONE_MINUS_DST_COLOR,"one minus dst color"),Sl(Fg,td.DST_ALPHA,"dst alpha"),Sl(Fg,td.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Sl(Fg,td.CONSTANT_COLOR,"constant color"),Sl(Fg,td.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Sl(Fg,td.CONSTANT_ALPHA,"constant alpha"),Sl(Fg,td.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Sl(Fg,td.SRC_ALPHA_SATURATE,"src alpha saturate"),Fg),ay=(Sl(Ug={},td.NEVER,"never"),Sl(Ug,td.ALWAYS,"always"),Sl(Ug,td.LESS,"less"),Sl(Ug,td.LEQUAL,"lequal"),Sl(Ug,td.GREATER,"greater"),Sl(Ug,td.GEQUAL,"gequal"),Sl(Ug,td.EQUAL,"equal"),Sl(Ug,td.NOTEQUAL,"notequal"),Ug),uy=(Sl(Bg={},td.ZERO,"zero"),Sl(Bg,td.KEEP,"keep"),Sl(Bg,td.REPLACE,"replace"),Sl(Bg,td.INVERT,"invert"),Sl(Bg,td.INCR,"increment"),Sl(Bg,td.DECR,"decrement"),Sl(Bg,td.INCR_WRAP,"increment wrap"),Sl(Bg,td.DECR_WRAP,"decrement wrap"),Bg),sy=(Sl(zg={},td.FRONT,"front"),Sl(zg,td.BACK,"back"),zg),cy=function(){function t(e,n){Bf(this,t),this.buffer=void 0;var r=n.data,i=n.usage,o=n.type;this.buffer=e.buffer({data:r,usage:Zg[i||td.STATIC_DRAW],type:$g[o||td.UNSIGNED_BYTE]})}return Vf(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(t){var e=t.data,n=t.offset;this.buffer.subdata(e,n)}}]),t}();function fy(t){return function(t){if(Array.isArray(t))return Qf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||tl(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ly={};ly["[object Float32Array]"]=ly["[object Float64Array]"]=ly["[object Int8Array]"]=ly["[object Int16Array]"]=ly["[object Int32Array]"]=ly["[object Uint8Array]"]=ly["[object Uint8ClampedArray]"]=ly["[object Uint16Array]"]=ly["[object Uint32Array]"]=!0,ly["[object Arguments]"]=ly["[object Array]"]=ly["[object ArrayBuffer]"]=ly["[object Boolean]"]=ly["[object DataView]"]=ly["[object Date]"]=ly["[object Error]"]=ly["[object Function]"]=ly["[object Map]"]=ly["[object Number]"]=ly["[object Object]"]=ly["[object RegExp]"]=ly["[object Set]"]=ly["[object String]"]=ly["[object WeakMap]"]=!1;var dy=Object.prototype.toString,hy=function(t){return function(t){return!!t&&"object"===cl(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!!ly[dy.call(t)]};function py(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function vy(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?py(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):py(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var gy=0,yy=function(){function t(e,n){var r=this;Bf(this,t),this.reGl=e,this.context=n,this.entity=Zf(),this.texFBO=void 0,this.computeCommand=void 0,this.textureCache={},this.outputTextureName=void 0,this.swapOutputTextureName=void 0,this.compiledPingpong=void 0,this.dynamicPingpong=void 0;var i={};this.context.uniforms.forEach((function(t){var e=t.name,n=t.type,o=t.data,a=t.isReferer,u=t.storageClass;if(u===mv.StorageBuffer){if(a)r.textureCache[e]={data:void 0},i["".concat(e,"Size")]=function(){return o.compiledBundle.context.output.textureSize};else{r.textureCache[e]=r.calcDataTexture(e,n,o);var s=r.textureCache[e],c=s.textureWidth,f=s.isOutput;i["".concat(e,"Size")]=[c,c],f&&(r.outputTextureName=e,r.context.needPingpong&&(r.outputTextureName="".concat(e,"Output"),r.textureCache[r.outputTextureName]=r.calcDataTexture(e,n,o)))}i[e]=function(){return r.textureCache[e].texture}}else if(u===mv.Uniform){if(o&&(Array.isArray(o)||hy(o))&&o.length>16)throw new Error("invalid data type ".concat(n));i[e]=function(){return t.data}}}));var o=this.getOuputDataTexture(),a=o.textureWidth,u=o.texelCount;i.u_OutputTextureSize=[a,a],i.u_OutputTexelCount=u,this.context.output.textureSize=[a,a];var s={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(this.context.shader),uniforms:i,vert:"attribute vec3 a_Position;\nattribute vec2 a_TexCoord;\n\nvarying vec2 v_TexCoord;\n\nvoid main() {\n gl_Position = vec4(a_Position, 1.0);\n v_TexCoord = a_TexCoord;\n}",primitive:"triangle strip",count:4};this.computeCommand=this.reGl(s)}var e;return Vf(t,[{key:"run",value:function(){var t=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use((function(){t.computeCommand()}))}},{key:"readData",value:(e=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s,c=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.reGl({framebuffer:this.texFBO})((function(){e=c.reGl.read()})),!e){t.next=6;break}if(n=this.getOuputDataTexture(),r=n.originalDataLength,i=n.elementsPerTexel,o=n.typedArrayConstructor,a=void 0===o?Float32Array:o,u=[],4!==i)for(s=0;s<e.length;s+=4)1===i?u.push(e[s]):2===i?u.push(e[s],e[s+1]):u.push(e[s],e[s+1],e[s+2]);else u=e;return t.abrupt("return",new a(u.slice(0,r)));case 6:return t.abrupt("return",new Float32Array);case 7:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"confirmInput",value:function(t,e){var n;this.entity===t.entity?(this.dynamicPingpong=!0,n=this):n=t,this.textureCache[e].id=n.getOuputDataTexture().id,this.textureCache[e].texture=n.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(t,e){var n=this.context.uniforms.find((function(e){return e.name===t}));if(n){var r=this.calcDataTexture(t,n.type,e),i=r.texture,o=r.data;this.textureCache[t].data=o,this.textureCache[t].texture=i}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var t=this.context.output.name;this.textureCache[t].id=this.getOuputDataTexture().id,this.textureCache[t].texture=this.getOuputDataTexture().texture}var e=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=e}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var t=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=t}},{key:"cloneDataTexture",value:function(t){var e=t.data,n=t.textureWidth;return vy(vy({},t),{},{id:gy++,texture:this.reGl.texture({width:n,height:n,data:e,type:"float"})})}},{key:"calcDataTexture",value:function(t,e,n){var r=1;e===gv.Vector4FloatArray&&(r=4);for(var i=[],o=0;o<n.length;o+=r)1===r?i.push(n[o],0,0,0):2===r?i.push(n[o],n[o+1],0,0):3===r?i.push(n[o],n[o+1],n[o+2],0):4===r&&i.push(n[o],n[o+1],n[o+2],n[o+3]);var a=n.length,u=Math.ceil(a/r),s=Math.ceil(Math.sqrt(u)),c=s*s;u<c&&i.push.apply(i,fy(new Array(4*(c-u)).fill(0)));var f=this.reGl.texture({width:s,height:s,data:i,type:"float"});return{id:gy++,data:i,originalDataLength:a,typedArrayConstructor:hy(n)?n.constructor:void 0,textureWidth:s,texture:f,texelCount:u,elementsPerTexel:r,isOutput:t===this.context.output.name}}}]),t}(),my=function(){function t(e,n){Bf(this,t),this.elements=void 0;var r=n.data,i=n.usage,o=n.type,a=n.count;this.elements=e.elements({data:r,usage:Zg[i||td.STATIC_DRAW],type:$g[o||td.UNSIGNED_BYTE],count:a})}return Vf(t,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(t){var e=t.data;this.elements.subdata(e)}},{key:"destroy",value:function(){this.elements.destroy()}}]),t}(),by=function(){function t(e,n){Bf(this,t),this.framebuffer=void 0;var r=n.width,i=n.height,o=n.color,a=n.colors,u=(n.depth,n.stencil,{width:r,height:i});Array.isArray(a)&&(u.colors=a.map((function(t){return t.get()}))),o&&"boolean"!=typeof o&&(u.color=o.get()),this.framebuffer=e.framebuffer(u)}return Vf(t,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(t){var e=t.width,n=t.height;this.framebuffer.resize(e,n)}}]),t}();function _y(t){var e={};return Object.keys(t).forEach((function(n){xy(n,t[n],e,"")})),e}function xy(t,e,n,r){var i,o;null===e||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)&&"number"==typeof e[0]||hy(e)||""===e||void 0!==e.resize?n["".concat(r&&r+".").concat(t)]=e:(o=cl(i=e),null==i||"object"!==o&&"function"!==o||Object.keys(e).forEach((function(i){xy(i,e[i],n,"".concat(r&&r+".").concat(t))})),Array.isArray(e)&&e.forEach((function(e,i){Object.keys(e).forEach((function(o){xy(o,e[o],n,"".concat(r&&r+".").concat(t,"[").concat(i,"]"))}))})))}function wy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ey(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wy(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wy(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Sy,Ay,Ty,Iy=function(){function t(e,n){Bf(this,t),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=e;var r=n.vs,i=n.fs,o=n.defines,a=n.attributes,u=n.uniforms,s=n.primitive,c=n.count,f=n.elements,l=n.depth,d=n.blend,h=n.stencil,p=n.cull,v=n.instances,g=n.scissor,y=n.viewport,m={};u&&(this.uniforms=_y(u),Object.keys(u).forEach((function(t){m[t]=e.prop(t)})));var b={};Object.keys(a).forEach((function(t){b[t]=a[t].get()}));var _=o&&this.generateDefines(o)||"",x={attributes:b,frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(_,"\n").concat(i),uniforms:m,vert:"\n".concat(_,"\n").concat(r),primitive:Kg[void 0===s?td.TRIANGLES:s]};v&&(x.instances=v),c&&(x.count=c),f&&(x.elements=f.get()),g&&(x.scissor=g),y&&(x.viewport=y),this.initDepthDrawParams({depth:l},x),this.initBlendDrawParams({blend:d},x),this.initStencilDrawParams({stencil:h},x),this.initCullDrawParams({cull:p},x),this.drawCommand=e(x)}return Vf(t,[{key:"addUniforms",value:function(t){this.uniforms=Ey(Ey({},this.uniforms),_y(t))}},{key:"draw",value:function(t){var e=Ey(Ey({},this.uniforms),_y(t.uniforms||{})),n={};Object.keys(e).forEach((function(t){var r=cl(e[t]);"boolean"===r||"number"===r||Array.isArray(e[t])||e[t].BYTES_PER_ELEMENT?n[t]=e[t]:"string"===r||(n[t]=e[t].get())})),this.drawCommand(n)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(t,e){var n=t.depth;n&&(e.depth={enable:void 0===n.enable||!!n.enable,mask:void 0===n.mask||!!n.mask,func:ry[n.func||td.LESS],range:n.range||[0,1]})}},{key:"initBlendDrawParams",value:function(t,e){var n=t.blend;if(n){var r=n.enable,i=n.func,o=n.equation,a=n.color,u=void 0===a?[0,0,0,0]:a;e.blend={enable:!!r,func:{srcRGB:oy[i&&i.srcRGB||td.SRC_ALPHA],srcAlpha:oy[i&&i.srcAlpha||td.SRC_ALPHA],dstRGB:oy[i&&i.dstRGB||td.ONE_MINUS_SRC_ALPHA],dstAlpha:oy[i&&i.dstAlpha||td.ONE_MINUS_SRC_ALPHA]},equation:{rgb:iy[o&&o.rgb||td.FUNC_ADD],alpha:iy[o&&o.alpha||td.FUNC_ADD]},color:u}}}},{key:"initStencilDrawParams",value:function(t,e){var n=t.stencil;if(n){var r=n.enable,i=n.mask,o=void 0===i?-1:i,a=n.func,u=void 0===a?{cmp:td.ALWAYS,ref:0,mask:-1}:a,s=n.opFront,c=void 0===s?{fail:td.KEEP,zfail:td.KEEP,zpass:td.KEEP}:s,f=n.opBack,l=void 0===f?{fail:td.KEEP,zfail:td.KEEP,zpass:td.KEEP}:f;e.stencil={enable:!!r,mask:o,func:Ey(Ey({},u),{},{cmp:ay[u.cmp]}),opFront:{fail:uy[c.fail],zfail:uy[c.zfail],zpass:uy[c.zpass]},opBack:{fail:uy[l.fail],zfail:uy[l.zfail],zpass:uy[l.zpass]}}}}},{key:"initCullDrawParams",value:function(t,e){var n=t.cull;if(n){var r=n.enable,i=n.face,o=void 0===i?td.BACK:i;e.cull={enable:!!r,face:sy[o]}}}},{key:"generateDefines",value:function(t){return Object.keys(t).map((function(e){return"#define ".concat(e," ").concat(Number(t[e]))})).join("\n")}}]),t}(),Ny=function(){function t(e,n){Bf(this,t),this.texture=void 0,this.width=void 0,this.height=void 0;var r=n.data,i=n.type,o=void 0===i?td.UNSIGNED_BYTE:i,a=n.width,u=n.height,s=n.flipY,c=void 0!==s&&s,f=n.format,l=void 0===f?td.RGBA:f,d=n.mipmap,h=void 0!==d&&d,p=n.wrapS,v=void 0===p?td.CLAMP_TO_EDGE:p,g=n.wrapT,y=void 0===g?td.CLAMP_TO_EDGE:g,m=n.aniso,b=void 0===m?0:m,_=n.alignment,x=void 0===_?1:_,w=n.premultiplyAlpha,E=void 0!==w&&w,S=n.mag,A=void 0===S?td.NEAREST:S,T=n.min,I=void 0===T?td.NEAREST:T,N=n.colorSpace,O=void 0===N?td.BROWSER_DEFAULT_WEBGL:N;this.width=a,this.height=u;var C={width:a,height:u,type:$g[o],format:Jg[l],wrapS:ey[v],wrapT:ey[y],mag:ty[A],min:ty[I],alignment:x,flipY:c,colorSpace:ny[O],premultiplyAlpha:E,aniso:b};r&&(C.data=r),"number"==typeof h?C.mipmap=Qg[h]:"boolean"==typeof h&&(C.mipmap=h),this.texture=e.texture(C)}return Vf(t,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(t){var e=t.width,n=t.height;this.texture.resize(e,n),this.width=e,this.height=n}},{key:"destroy",value:function(){this.texture.destroy()}}]),t}(),Oy=(0,nl.b2)()((Ay=function(){function t(){var e=this;Bf(this,t),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var t=Yf(Xf().mark((function t(n){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.uniforms){t.next=3;break}return t.next=3,Promise.all(Object.keys(n.uniforms).map(function(){var t=Yf(Xf().mark((function t(e){var r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.uniforms[e]||void 0===n.uniforms[e].load){t.next=5;break}return t.next=3,n.uniforms[e].load();case 3:r=t.sent,n.uniforms[e]=r;case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:return t.abrupt("return",new Iy(e.gl,n));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new Yg(e.gl,t)},this.createBuffer=function(t){return new cy(e.gl,t)},this.createElements=function(t){return new my(e.gl,t)},this.createTexture2D=function(t){return new Ny(e.gl,t)},this.createFramebuffer=function(t){return new by(e.gl,t)},this.useFramebuffer=function(t,n){e.gl({framebuffer:t?t.get():null})(n)},this.createComputeModel=function(){var t=Yf(Xf().mark((function t(n){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new yy(e.gl,n));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.clear=function(t){var n=t.color,r=t.depth,i=t.stencil,o=t.framebuffer,a=void 0===o?null:o,u={color:n,depth:r,stencil:i};u.framebuffer=null===a?a:a.get(),e.gl.clear(u)},this.setScissor=function(t){e.gl&&e.gl._gl&&(t.enable&&t.box?(e.gl._gl.enable(td.SCISSOR_TEST),e.gl._gl.scissor(t.box.x,t.box.y,t.box.width,t.box.height)):e.gl._gl.disable(td.SCISSOR_TEST),e.gl._refresh())},this.viewport=function(t){var n=t.x,r=t.y,i=t.width,o=t.height;e.gl&&e.gl._gl&&(e.gl._gl.viewport(n,r,i,o),e.gl._refresh())},this.readPixels=function(t){var n=t.framebuffer,r={x:t.x,y:t.y,width:t.width,height:t.height};return n&&(r.framebuffer=n.get()),e.gl.read(r)},this.getCanvas=function(){return e.$canvas},this.getGLContext=function(){return e.gl._gl},this.destroy=function(){e.gl&&(e.gl.destroy(),e.inited=!1)}}var e;return Vf(t,[{key:"init",value:(e=Yf(Xf().mark((function t(e){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.inited){t.next=2;break}return t.abrupt("return");case 2:return this.$canvas=e.canvas,t.next=5,new Promise((function(t,n){qg()({canvas:e.canvas,attributes:{alpha:!0,antialias:e.antialias,premultipliedAlpha:!0},pixelRatio:1,extensions:["OES_element_index_uint","OES_texture_float","OES_standard_derivatives","angle_instanced_arrays"],optionalExtensions:["EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture"],profile:!0,onDone:function(e,r){!e&&r||n(e),t(r)}})}));case 5:this.gl=t.sent,this.inited=!0;case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),t}(),Sy=Ay))||Sy;function Cy(t,e){return new Promise((function(e,n){!function(t,e,n,r){if("undefined"!=typeof window){var i=document.getElementsByTagName("head")[0],o=document.createElement("script");o.setAttribute("type","text/javascript"),o.setAttribute("src",t),r&&(o.id=r),o.onload=function(){e&&e()},o.onerror=function(e){n&&n("Unable to load script '".concat(t,"'"),e)},i.appendChild(o)}}(t,(function(){e()}),(function(t,e){n(e)}))}))}function ky(){return Dy.apply(this,arguments)}function Dy(){return(Dy=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!Ty){t.next=2;break}return t.abrupt("return",Ty);case 2:return t.next=4,Cy("https://preview.babylonjs.com/glslang/glslang.js");case 4:return Ty=window.glslang("https://preview.babylonjs.com/glslang/glslang.wasm"),t.abrupt("return",Ty);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var My,Ry,Py,Gy,Ly,jy,Fy,Uy=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.attribute=void 0,this.buffer=void 0;var r=n,i=r.buffer,o=r.offset,a=r.stride,u=r.normalized,s=r.size,c=r.divisor,f=r.arrayStride,l=r.attributes,d=r.stepMode;this.buffer=i,this.attribute={buffer:i.get(),offset:o||0,stride:a||0,normalized:u||!1,divisor:c||0,arrayStride:f||0,attributes:l,stepMode:d||"vertex"},s&&(this.attribute.size=s)}return Vf(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),By=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.buffer=void 0;var r=n,i=r.data,o=r.usage;r.type,this.buffer=this.createBuffer(i instanceof Array?new Float32Array(i):i,o||Xv.FB.Vertex|Xv.FB.CopyDst)}return Vf(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){this.buffer.destroy()}},{key:"subData",value:function(t){var e=t.data,n=t.offset;this.setSubData(this.buffer,n,e instanceof Array?new Float32Array(e):e)}},{key:"createBuffer",value:function(t,e){var n=t.byteLength%4,r={size:t.byteLength+n,usage:e},i=this.engine.device.createBuffer(r);return this.setSubData(i,0,t),i}},{key:"setSubData",value:function(t,e,n){(_v?this.engine.device.getQueue():this.engine.device.defaultQueue).writeBuffer(t,e,n)}}]),t}(),zy=function(){function t(e,n){Bf(this,t),this.engine=e,this.context=n,this.entity=Zf(),this.uniformGPUBufferLayout=[],this.uniformBuffer=void 0,this.vertexBuffers={},this.outputBuffer=void 0,this.bindGroupEntries=void 0,this.bindGroup=void 0,this.computePipeline=void 0}var e,n,r;return Vf(t,[{key:"init",value:(r=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.compileComputePipelineStageDescriptor(this.context.shader);case 2:e=t.sent,n=e.computeStage,r=this.context.uniforms.filter((function(t){return t.storageClass===mv.StorageBuffer})),i=this.context.uniforms.filter((function(t){return t.storageClass===mv.Uniform})),o=i.length?1:0,this.bindGroupEntries=[],o&&(a=0,u=[],i.forEach((function(t){if("number"==typeof t.data)s.uniformGPUBufferLayout.push({name:t.name,offset:a}),a+=4,u.push(t.data);else{var e,n=(null===(e=t.data)||void 0===e?void 0:e.length)||1;3===n&&(n=4,t.data.push(0));var r=a/4%4;if(r>0){var i=4-r;if(n>1&&n<=i)2===n&&(3===i&&(a+=4,u.push(0)),u.push.apply(u,fy(t.data)),s.uniformGPUBufferLayout.push({name:t.name,offset:a}));else{for(var o=0;o<i;o++)a+=4,u.push(0);u.push.apply(u,fy(t.data)),s.uniformGPUBufferLayout.push({name:t.name,offset:a})}}a+=4*n}})),this.uniformBuffer=new By(this.engine,{data:u instanceof Array?new Float32Array(u):u,usage:Xv.FB.Uniform|Xv.FB.CopyDst}),this.bindGroupEntries.push({binding:0,resource:{buffer:this.uniformBuffer.get()}})),r.forEach((function(t){var e;null!==t.data&&(t.type!==gv.Vector4FloatArray&&t.type!==gv.FloatArray||(t.name===s.context.output.name?(e=new By(s.engine,{data:isFinite(Number(t.data))?[t.data]:t.data,usage:Xv.FB.Storage|Xv.FB.CopyDst|Xv.FB.CopySrc}),s.outputBuffer=e,s.context.output={name:t.name,length:isFinite(Number(t.data))?1:t.data.length,typedArrayConstructor:Float32Array,gpuBuffer:e.get()}):t.isReferer?t.data.model&&t.data.model.outputBuffer&&(e=t.data.model.outputBuffer):e=new By(s.engine,{data:isFinite(Number(t.data))?[t.data]:t.data,usage:Xv.FB.Storage|Xv.FB.CopyDst|Xv.FB.CopySrc}),s.vertexBuffers[t.name]=e,s.bindGroupEntries.push({binding:o,resource:{name:t.name,refer:e?void 0:t.data,buffer:e?e.get():void 0}}),o++))})),this.computePipeline=this.engine.device.createComputePipeline({computeStage:n}),console.log(this.bindGroupEntries),this.bindGroup=this.engine.device.createBindGroup({layout:this.computePipeline.getBindGroupLayout(0),entries:this.bindGroupEntries});case 13:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"destroy",value:function(){var t=this;this.uniformBuffer&&this.uniformBuffer.destroy(),Object.keys(this.vertexBuffers).forEach((function(e){return t.vertexBuffers[e].destroy()}))}},{key:"readData",value:(n=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s,c;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=this.context.output)){t.next=16;break}if(n=e.length,r=e.typedArrayConstructor,!(i=e.gpuBuffer)){t.next=16;break}return o=n*r.BYTES_PER_ELEMENT,a=this.engine.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),(u=this.engine.device.createCommandEncoder()).copyBufferToBuffer(i,0,a,0,o),(_v?this.engine.device.getQueue():this.engine.device.defaultQueue).submit([u.finish()]),t.next=12,a.mapAsync(Xv.gc.Read);case 12:return s=a.getMappedRange(),c=new r(s.slice(0)),a.unmap(),t.abrupt("return",c);case 16:return t.abrupt("return",new Float32Array);case 17:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"run",value:function(){var t;this.engine.currentComputePass&&(this.engine.currentComputePass.setPipeline(this.computePipeline),this.engine.currentComputePass.setBindGroup(0,this.bindGroup),(t=this.engine.currentComputePass).dispatch.apply(t,fy(this.context.dispatch)))}},{key:"updateBuffer",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.vertexBuffers[t];r&&r.subData({data:e,offset:n})}},{key:"updateUniform",value:function(t,e){var n=this.uniformGPUBufferLayout.find((function(e){return e.name===t}));n&&this.uniformBuffer.subData({data:Number.isFinite(e)?new Float32Array([e]):new Float32Array(e),offset:n.offset})}},{key:"confirmInput",value:function(t,e){var n=this.vertexBuffers[e],r=t.outputBuffer;if(n&&r&&n!==r){var i=this.engine.device.createCommandEncoder(),o=t.context.output,a=o.length*o.typedArrayConstructor.BYTES_PER_ELEMENT;i.copyBufferToBuffer(r.get(),0,n.get(),0,a),(_v?this.engine.device.getQueue():this.engine.device.defaultQueue).submit([i.finish()])}}},{key:"compileShaderToSpirV",value:function(t,e,n){return this.compileRawShaderToSpirV(n+t,e)}},{key:"compileRawShaderToSpirV",value:function(t,e){return this.engine.glslang.compileGLSL(t,e)}},{key:"compileComputePipelineStageDescriptor",value:(e=Yf(Xf().mark((function t(e){var n;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e,this.engine.options.useWGSL){t.next=6;break}return t.next=5,this.compileShaderToSpirV(e,"compute","#version 450\n");case 5:n=t.sent;case 6:return t.abrupt("return",{computeStage:{module:this.engine.device.createShaderModule({code:n,isWHLSL:_v}),entryPoint:"main"}});case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Vy=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.indexCount=void 0,this.buffer=void 0;var r=n,i=r.data,o=(r.usage,r.type,r.count);this.indexCount=o||0,this.buffer=new By(e,{data:i instanceof Array?new Uint16Array(i):i,usage:Xv.FB.Index|Xv.FB.CopyDst})}return Vf(t,[{key:"get",value:function(){return this.buffer}},{key:"subData",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),Wy=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.colorTexture=void 0,this.depthTexture=void 0,this.width=0,this.height=0;var r=n,i=(r.width,r.height,r.color),o=(r.colors,r.depth);r.stencil,i&&(this.colorTexture=i),o&&(this.depthTexture=o)}return Vf(t,[{key:"get",value:function(){var t,e;return{color:null===(t=this.colorTexture)||void 0===t?void 0:t.get(),depth:null===(e=this.depthTexture)||void 0===e?void 0:e.get()}}},{key:"destroy",value:function(){var t,e;null===(t=this.colorTexture)||void 0===t||t.destroy(),null===(e=this.depthTexture)||void 0===e||e.destroy()}},{key:"resize",value:function(t){var e,n,r=t.width,i=t.height;r===this.width&&i===this.height||(null===(e=this.colorTexture)||void 0===e||e.resize({width:r,height:i}),null===(n=this.depthTexture)||void 0===n||n.resize({width:r,height:i})),this.width=r,this.height=i}}]),t}(),Hy=(Sl(My={},td.POINTS,Xv.YV.PointList),Sl(My,td.LINES,Xv.YV.LineList),Sl(My,td.LINE_LOOP,Xv.YV.LineList),Sl(My,td.LINE_STRIP,Xv.YV.LineStrip),Sl(My,td.TRIANGLES,Xv.YV.TriangleList),Sl(My,td.TRIANGLE_FAN,Xv.YV.TriangleList),Sl(My,td.TRIANGLE_STRIP,Xv.YV.TriangleStrip),My),Xy=(Sl(Ry={},td.NEVER,Xv.wb.Never),Sl(Ry,td.ALWAYS,Xv.wb.Always),Sl(Ry,td.LESS,Xv.wb.Less),Sl(Ry,td.LEQUAL,Xv.wb.LessEqual),Sl(Ry,td.GREATER,Xv.wb.Greater),Sl(Ry,td.GEQUAL,Xv.wb.GreaterEqual),Sl(Ry,td.EQUAL,Xv.wb.Equal),Sl(Ry,td.NOTEQUAL,Xv.wb.NotEqual),Ry),qy=(Sl(Py={},td.FUNC_ADD,Xv.db.Add),Sl(Py,td.MIN_EXT,Xv.db.Min),Sl(Py,td.MAX_EXT,Xv.db.Max),Sl(Py,td.FUNC_SUBTRACT,Xv.db.Subtract),Sl(Py,td.FUNC_REVERSE_SUBTRACT,Xv.db.ReverseSubtract),Py),Yy=(Sl(Gy={},td.ZERO,Xv.zi.Zero),Sl(Gy,td.ONE,Xv.zi.One),Sl(Gy,td.SRC_COLOR,Xv.zi.SrcColor),Sl(Gy,td.ONE_MINUS_SRC_COLOR,Xv.zi.OneMinusSrcColor),Sl(Gy,td.SRC_ALPHA,Xv.zi.SrcAlpha),Sl(Gy,td.ONE_MINUS_SRC_ALPHA,Xv.zi.OneMinusSrcAlpha),Sl(Gy,td.DST_COLOR,Xv.zi.DstColor),Sl(Gy,td.ONE_MINUS_DST_COLOR,Xv.zi.OneMinusDstColor),Sl(Gy,td.DST_ALPHA,Xv.zi.DstAlpha),Sl(Gy,td.ONE_MINUS_DST_ALPHA,Xv.zi.OneMinusDstAlpha),Sl(Gy,td.CONSTANT_COLOR,Xv.zi.BlendColor),Sl(Gy,td.ONE_MINUS_CONSTANT_COLOR,Xv.zi.OneMinusBlendColor),Sl(Gy,td.SRC_ALPHA_SATURATE,Xv.zi.SrcAlphaSaturated),Gy),Ky=(Sl(Ly={},td.ALPHA,"r8unorm"),Sl(Ly,td.RGBA,"rgba8unorm"),Sl(Ly,td.DEPTH_COMPONENT,"depth32float"),Sl(Ly,td.DEPTH_STENCIL,"depth24plus-stencil8"),Ly),Zy=(Sl(jy={},td.NEAREST,"nearest"),Sl(jy,td.LINEAR,"linear"),jy),$y=(Sl(Fy={},td.REPEAT,"repeat"),Sl(Fy,td.CLAMP_TO_EDGE,"clamp-to-edge"),Sl(Fy,td.MIRRORED_REPEAT,"mirror-repeat"),Fy);function Jy(t){var e=t.cull;return e&&e.enable?e.face?e.face===td.FRONT?Xv.Wf.Front:Xv.Wf.Back:void 0:Xv.Wf.None}function Qy(t){var e=t.depth,n=(t.stencil,{compare:Xv.wb.Always,depthFailOp:Xv.xS.Keep,failOp:Xv.xS.Keep,passOp:Xv.xS.Keep});return{depthWriteEnabled:e&&e.enable,depthCompare:Xy[(null==e?void 0:e.func)||td.ALWAYS],format:Xv.EV.Depth24PlusStencil8,stencilFront:n,stencilBack:n,stencilReadMask:4294967295,stencilWriteMask:4294967295}}function tm(t,e){var n=t.blend;return[{format:e,alphaBlend:{srcFactor:Yy[n&&n.func&&n.func.srcAlpha||td.ONE],dstFactor:Yy[n&&n.func&&n.func.dstAlpha||td.ZERO],operation:qy[n&&n.equation&&n.equation.alpha||td.FUNC_ADD]},colorBlend:{srcFactor:Yy[n&&n.func&&n.func.srcRGB||td.ONE],dstFactor:Yy[n&&n.func&&n.func.dstRGB||td.ZERO],operation:qy[n&&n.equation&&n.equation.rgb||td.FUNC_ADD]},writeMask:Xv.Yw.All}]}function em(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function nm(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?em(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):em(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function rm(t){for(var e=0,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0,a=r;o<a.length;o++){var u=a[o];e+=u.length}for(var s=new t(e),c=0,f=0,l=r;f<l.length;f++){var d=l[f];s.set(d,c),c+=d.length}return s}var im,om,am,um=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.pipelineLayout=void 0,this.renderPipeline=void 0,this.uniformsBindGroupLayout=void 0,this.uniformBindGroup=void 0,this.uniformBuffer=void 0,this.uniforms={},this.uniformGPUBufferLayout=[],this.attributeCache={},this.indexBuffer=void 0,this.indexCount=void 0}var e,n;return Vf(t,[{key:"init",value:(n=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.options,n=e.vs,r=e.fs,i=e.attributes,o=e.uniforms,a=e.primitive,e.count,u=e.elements,s=e.depth,c=e.blend,f=e.stencil,l=e.cull,e.instances,t.next=3,this.compilePipelineStageDescriptor(n,r,null);case 3:d=t.sent,h=d.vertexStage,p=d.fragmentStage,o&&this.buildUniformBindGroup(o),u&&(this.indexBuffer=u.get(),this.indexCount=u.indexCount),v={vertexBuffers:Object.keys(i).map((function(t,e){var n=i[t],r=n.get(),o=r.arrayStride,a=r.stepMode,u=r.attributes;return y.attributeCache[t]=n,{arrayStride:o,stepMode:a,attributes:u}}))},g={sampleCount:this.engine.mainPassSampleCount,primitiveTopology:Hy[a||td.TRIANGLES],rasterizationState:nm(nm({},this.getDefaultRasterizationStateDescriptor()),{},{cullMode:Jy({cull:l})}),depthStencilState:Qy({depth:s,stencil:f}),colorStates:tm({blend:c},this.engine.options.swapChainFormat),layout:this.pipelineLayout,vertexStage:h,fragmentStage:p,vertexState:v},this.renderPipeline=this.engine.device.createRenderPipeline(g);case 11:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"addUniforms",value:function(t){this.uniforms=nm(nm({},this.uniforms),_y(t))}},{key:"draw",value:function(t){var e=this,n=this.engine.getCurrentRenderPass(),r=nm(nm({},this.uniforms),_y(t.uniforms||{})),i=[];Object.keys(r).forEach((function(t){var n=cl(r[t]);if("boolean"===n||"number"===n||Array.isArray(r[t])||r[t].BYTES_PER_ELEMENT){var o,a=null===(o=e.uniformGPUBufferLayout.find((function(e){return e.name===t})))||void 0===o?void 0:o.offset;null!==a&&e.uniformBuffer.subData({data:r[t],offset:a})}else{var u,s=null===(u=e.uniformGPUBufferLayout.find((function(e){return e.name===t})))||void 0===u?void 0:u.offset;if(null!==s){var c=r[t].get(),f=c.color||c,l=f.texture,d=f.sampler;d&&(i.push({binding:s,resource:d}),s++),i.push({binding:s,resource:l.createView()})}}})),this.uniformBuffer&&(i[0]={binding:0,resource:{buffer:this.uniformBuffer.get()}}),this.uniformBindGroup=this.engine.device.createBindGroup({layout:this.uniformsBindGroupLayout,entries:i}),this.renderPipeline&&n.setPipeline(this.renderPipeline),n.setBindGroup(0,this.uniformBindGroup),this.indexBuffer&&n.setIndexBuffer(this.indexBuffer.get(),Xv.iD.Uint32,0),Object.keys(this.attributeCache).forEach((function(t,r){n.setVertexBuffer(0+r,e.attributeCache[t].get().buffer,0)})),this.indexBuffer?n.drawIndexed(this.indexCount,this.options.instances||1,0,0,0):n.draw(this.options.count||0,this.options.instances||0,0,0)}},{key:"destroy",value:function(){throw new Error("Method not implemented.")}},{key:"compilePipelineStageDescriptor",value:(e=Yf(Xf().mark((function t(e,n,r){var i,o,a;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i="#version 450\n",o=e,a=n,this.engine.options.useWGSL){t.next=10;break}return t.next=6,this.compileShaderToSpirV(e,"vertex",i);case 6:return o=t.sent,t.next=9,this.compileShaderToSpirV(n,"fragment",i);case 9:a=t.sent;case 10:return t.abrupt("return",this.createPipelineStageDescriptor(o,a));case 11:case"end":return t.stop()}}),t,this)}))),function(t,n,r){return e.apply(this,arguments)})},{key:"compileShaderToSpirV",value:function(t,e,n){return this.compileRawShaderToSpirV(n+t,e)}},{key:"compileRawShaderToSpirV",value:function(t,e){return this.engine.glslang.compileGLSL(t,e)}},{key:"createPipelineStageDescriptor",value:function(t,e){return{vertexStage:{module:this.engine.device.createShaderModule({code:t,isWHLSL:_v}),entryPoint:"main"},fragmentStage:{module:this.engine.device.createShaderModule({code:e,isWHLSL:_v}),entryPoint:"main"}}}},{key:"getDefaultRasterizationStateDescriptor",value:function(){return{frontFace:Xv.zX.CCW,cullMode:Xv.Wf.None,depthBias:0,depthBiasSlopeScale:0,depthBiasClamp:0}}},{key:"buildUniformBindGroup",value:function(t){var e=this,n=0,r=rm.apply(void 0,[Float32Array].concat(fy(Object.keys(t).map((function(r){return t[r]?(e.uniformGPUBufferLayout.push({name:r,offset:n}),n+=4*(t[r].length||1),t[r]):[]}))))),i=[],o=!1;r.length&&(o=!0,i.push({binding:0,visibility:Xv.$X.Fragment|Xv.$X.Vertex,type:Xv.$l.UniformBuffer})),Object.keys(t).filter((function(e){return null===t[e]})).forEach((function(t,n){e.uniformGPUBufferLayout.push({name:t,offset:2*n+(o?1:0)}),i.push({binding:2*n+(o?1:0),visibility:Xv.$X.Fragment,type:Xv.$l.Sampler},{binding:2*n+(o?1:0)+1,visibility:Xv.$X.Fragment,type:Xv.$l.SampledTexture})})),this.uniformsBindGroupLayout=this.engine.device.createBindGroupLayout({entries:i}),this.pipelineLayout=this.engine.device.createPipelineLayout({bindGroupLayouts:[this.uniformsBindGroupLayout]}),o&&(this.uniformBuffer=new By(this.engine,{data:r instanceof Array?new Float32Array(r):r,usage:Xv.FB.Uniform|Xv.FB.CopyDst}))}}]),t}(),sm=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.texture=void 0,this.sampler=void 0,this.width=void 0,this.height=void 0,this.createTexture()}return Vf(t,[{key:"get",value:function(){return{texture:this.texture,sampler:this.sampler}}},{key:"update",value:function(){}},{key:"resize",value:function(t){var e=t.width,n=t.height;e===this.width&&n===this.height||(this.destroy(),this.createTexture()),this.width=e,this.height=n}},{key:"destroy",value:function(){this.texture&&this.texture.destroy()}},{key:"createTexture",value:function(){var t=this.options,e=(void 0===(t.data,t.type)&&td.UNSIGNED_BYTE,t.width),n=t.height,r=(t.flipY,t.format),i=void 0===r?td.RGBA:r,o=(t.mipmap,t.wrapS),a=void 0===o?td.CLAMP_TO_EDGE:o,u=t.wrapT,s=void 0===u?td.CLAMP_TO_EDGE:u,c=t.aniso,f=void 0===c?0:c,l=(t.alignment,t.premultiplyAlpha,t.mag),d=void 0===l?td.NEAREST:l,h=t.min,p=void 0===h?td.NEAREST:h,v=(void 0===t.colorSpace&&td.BROWSER_DEFAULT_WEBGL,t.usage);this.width=e,this.height=n,this.texture=this.engine.device.createTexture({size:[e,n,1],mipLevelCount:1,sampleCount:1,dimension:Xv.kd.E2d,format:Ky[i],usage:v||Xv.v2.Sampled|Xv.v2.CopyDst}),(!v||v&Xv.v2.Sampled)&&(this.sampler=this.engine.device.createSampler({addressModeU:$y[a],addressModeV:$y[s],addressModeW:$y[a],magFilter:Zy[d],minFilter:Zy[p],maxAnisotropy:f}))}}]),t}(),cm=(0,nl.b2)()((om=function(){function t(){var e=this;Bf(this,t),this.supportWebGPU=!0,this.useWGSL=!1,this.options=void 0,this.canvas=void 0,this.context=void 0,this.glslang=void 0,this.adapter=void 0,this.device=void 0,this.swapChain=void 0,this.mainPassSampleCount=void 0,this.mainTexture=void 0,this.depthTexture=void 0,this.mainColorAttachments=void 0,this.mainTextureExtends=void 0,this.mainDepthAttachment=void 0,this.uploadEncoder=void 0,this.renderEncoder=void 0,this.computeEncoder=void 0,this.renderTargetEncoder=void 0,this.commandBuffers=new Array(4).fill(void 0),this.currentRenderPass=null,this.mainRenderPass=null,this.currentRenderTargetViewDescriptor=void 0,this.currentComputePass=null,this.bundleEncoder=void 0,this.tempBuffers=[],this.currentRenderTarget=null,this.uploadEncoderDescriptor={label:"upload"},this.renderEncoderDescriptor={label:"render"},this.renderTargetEncoderDescriptor={label:"renderTarget"},this.computeEncoderDescriptor={label:"compute"},this.pipelines={},this.computePipelines={},this.defaultSampleCount=4,this.clearDepthValue=1,this.clearStencilValue=0,this.transientViewport={x:1/0,y:0,width:0,height:0},this.cachedViewport={x:0,y:0,width:0,height:0},this.clear=function(t){t.framebuffer;var n=t.color,r=t.depth,i=t.stencil;e.options.supportCompute&&e.startComputePass(),e.currentRenderTarget?(e.currentRenderPass&&e.endRenderTargetRenderPass(),e.startRenderTargetRenderPass(e.currentRenderTarget,n||null,!!r,!!i)):(e.mainColorAttachments[0].loadValue=n||Xv.Ws.Load,e.mainDepthAttachment.depthLoadValue=r||Xv.Ws.Load,e.mainDepthAttachment.stencilLoadValue=i?e.clearStencilValue:Xv.Ws.Load,e.mainRenderPass&&e.endMainRenderPass(),e.startMainRenderPass())},this.createModel=function(){var t=Yf(Xf().mark((function t(n){var r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new um(e,n),t.next=3,r.init();case 3:return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new Uy(e,t)},this.createBuffer=function(t){return new By(e,t)},this.createElements=function(t){return new Vy(e,t)},this.createTexture2D=function(t){return new sm(e,t)},this.createFramebuffer=function(t){return new Wy(e,t)},this.useFramebuffer=function(t,n){e.currentRenderTarget&&e.unbindFramebuffer(e.currentRenderTarget),e.currentRenderTarget=t,e.currentRenderTargetViewDescriptor={dimension:Xv.p_.E2d,arrayLayerCount:1,aspect:Xv.H7.All},e.currentRenderPass=null,n()},this.createComputeModel=function(){var t=Yf(Xf().mark((function t(n){var r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new zy(e,n),t.next=3,r.init();case 3:return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.getCanvas=function(){return e.canvas},this.getGLContext=function(){throw new Error("Method not implemented.")},this.viewport=function(t){var n=t.x,r=t.y,i=t.width,o=t.height;e.currentRenderPass?e.transientViewport.x!==1/0?e.getCurrentRenderPass().setViewport(e.transientViewport.x,e.transientViewport.y,e.transientViewport.width,e.transientViewport.height,0,1):n===e.cachedViewport.x&&r===e.cachedViewport.y&&i===e.cachedViewport.width&&o===e.cachedViewport.height||(e.cachedViewport={x:n,y:r,width:i,height:o},e.getCurrentRenderPass().setViewport(n,r,i,o,0,1)):e.transientViewport={x:n,y:r,width:i,height:o}},this.readPixels=function(t){throw new Error("Method not implemented.")}}var e,n;return Vf(t,[{key:"isFloatSupported",value:function(){return!0}},{key:"init",value:(n=Yf(Xf().mark((function t(e){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.canvas=e.canvas,this.options=e,this.useWGSL=!!e.useWGSL,this.mainPassSampleCount=e.antialiasing?this.defaultSampleCount:1,t.next=6,this.initGlslang();case 6:this.initContextAndSwapChain(),this.initMainAttachments();case 8:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"setScissor",value:function(t){throw new Error("Method not implemented.")}},{key:"destroy",value:function(){this.mainTexture&&this.mainTexture.destroy(),this.depthTexture&&this.depthTexture.destroy(),this.tempBuffers.forEach((function(t){return t.destroy()})),this.tempBuffers=[]}},{key:"beginFrame",value:function(){this.uploadEncoder=this.device.createCommandEncoder(this.uploadEncoderDescriptor),this.renderEncoder=this.device.createCommandEncoder(this.renderEncoderDescriptor),this.renderTargetEncoder=this.device.createCommandEncoder(this.renderTargetEncoderDescriptor),this.options.supportCompute&&(this.computeEncoder=this.device.createCommandEncoder(this.computeEncoderDescriptor))}},{key:"endFrame",value:function(){this.options.supportCompute&&this.endComputePass(),this.endMainRenderPass(),this.commandBuffers[0]=this.uploadEncoder.finish(),this.commandBuffers[1]=this.renderEncoder.finish(),this.options.supportCompute&&(this.commandBuffers[2]=this.computeEncoder.finish()),this.commandBuffers[3]=this.renderTargetEncoder.finish(),_v?this.device.getQueue().submit(this.commandBuffers.filter((function(t){return t}))):this.device.defaultQueue.submit(this.commandBuffers.filter((function(t){return t})))}},{key:"getCurrentRenderPass",value:function(){return this.currentRenderTarget&&!this.currentRenderPass?this.startRenderTargetRenderPass(this.currentRenderTarget,null,!1,!1):this.currentRenderPass||this.startMainRenderPass(),this.currentRenderPass}},{key:"initGlslang",value:(e=Yf(Xf().mark((function t(){var e,n;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ky();case 2:return this.glslang=t.sent,t.next=5,null===(e=navigator)||void 0===e||null===(n=e.gpu)||void 0===n?void 0:n.requestAdapter();case 5:return this.adapter=t.sent,t.next=8,this.adapter.requestDevice();case 8:this.device=t.sent;case 9:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"initContextAndSwapChain",value:function(){this.context=this.canvas.getContext(_v?"gpu":"gpupresent"),this.swapChain=this.context.configureSwapChain({device:this.device,format:this.options.swapChainFormat,usage:Xv.v2.OutputAttachment|Xv.v2.CopySrc})}},{key:"initMainAttachments",value:function(){if(this.mainTextureExtends={width:this.canvas.width,height:this.canvas.height,depth:1},this.options.antialiasing){var t={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:Xv.kd.E2d,format:Xv.EV.BGRA8Unorm,usage:Xv.v2.OutputAttachment};this.mainTexture&&this.mainTexture.destroy(),this.mainTexture=this.device.createTexture(t),this.mainColorAttachments=[{attachment:_v?this.mainTexture.createDefaultView():this.mainTexture.createView(),loadValue:[0,0,0,1],storeOp:Xv.EG.Store}]}else this.mainColorAttachments=[{attachment:_v?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),loadValue:[0,0,0,1],storeOp:Xv.EG.Store}];var e={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:Xv.kd.E2d,format:_v?"depth32float-stencil8":Xv.EV.Depth24PlusStencil8,usage:Xv.v2.OutputAttachment};this.depthTexture&&this.depthTexture.destroy(),this.depthTexture=this.device.createTexture(e),this.mainDepthAttachment={attachment:_v?this.depthTexture.createDefaultView():this.depthTexture.createView(),depthLoadValue:this.clearDepthValue,depthStoreOp:Xv.EG.Store,stencilLoadValue:this.clearStencilValue,stencilStoreOp:Xv.EG.Store}}},{key:"startComputePass",value:function(){this.currentComputePass&&this.endComputePass(),this.currentComputePass=this.computeEncoder.beginComputePass()}},{key:"startMainRenderPass",value:function(){this.currentRenderPass&&!this.currentRenderTarget&&this.endMainRenderPass(),this.options.antialiasing?this.mainColorAttachments[0].resolveTarget=_v?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView():this.mainColorAttachments[0].attachment=_v?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),this.currentRenderPass=this.renderEncoder.beginRenderPass({colorAttachments:this.mainColorAttachments,depthStencilAttachment:this.mainDepthAttachment}),this.mainRenderPass=this.currentRenderPass,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"startRenderTargetRenderPass",value:function(t,e,n){var r,i,o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=null===(r=t.get().color)||void 0===r?void 0:r.texture;u&&(o=u.createView(this.currentRenderTargetViewDescriptor));var s,c=null===(i=t.get().depth)||void 0===i?void 0:i.texture;c&&(s=c.createView());var f=this.renderTargetEncoder.beginRenderPass({colorAttachments:[{attachment:o,loadValue:null!==e?e:Xv.Ws.Load,storeOp:Xv.EG.Store}],depthStencilAttachment:c&&s?{attachment:s,depthLoadValue:n?this.clearDepthValue:Xv.Ws.Load,depthStoreOp:Xv.EG.Store,stencilLoadValue:a?this.clearStencilValue:Xv.Ws.Load,stencilStoreOp:Xv.EG.Store}:void 0});this.currentRenderPass=f,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"endMainRenderPass",value:function(){this.currentRenderPass===this.mainRenderPass&&null!==this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport(),this.currentRenderPass=null,this.mainRenderPass=null)}},{key:"endComputePass",value:function(){this.currentComputePass&&(this.currentComputePass.endPass(),this.currentComputePass=null)}},{key:"endRenderTargetRenderPass",value:function(){this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport())}},{key:"resetCachedViewport",value:function(){this.cachedViewport={x:0,y:0,width:0,height:0}}},{key:"unbindFramebuffer",value:function(t){this.currentRenderPass&&this.currentRenderPass!==this.mainRenderPass&&this.endRenderTargetRenderPass(),this.transientViewport.x=1/0,this.currentRenderTarget=null,this.currentRenderPass=this.mainRenderPass}}]),t}(),im=om))||im;var fm,lm=4/64,dm=(0,nl.b2)()(am=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){var t=this.config,e=t.widthSegments,n=void 0===e?1:e,r=t.heightSegments,i=void 0===r?1:r,o=t.depthSegments,a=void 0===o?1:o,u=t.halfExtents,s=n,c=i,f=a,l=el(void 0===u?Rl(.5,.5,.5):u,3),d=l[0],h=l[1],p=l[2],v=[Rl(-d,-h,p),Rl(d,-h,p),Rl(d,h,p),Rl(-d,h,p),Rl(d,-h,-p),Rl(-d,-h,-p),Rl(-d,h,-p),Rl(d,h,-p)],g=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],y=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],m=[],b=[],_=[],x=[],w=[],E=0,S=function(t,e,n){var r,i,o,a;for(o=0;o<=e;o++)for(a=0;a<=n;a++){var u=kl(),s=kl(),c=kl(),f=kl();zl(u,v[g[t][0]],v[g[t][1]],o/e),zl(s,v[g[t][0]],v[g[t][2]],a/n),Hl(c,s,v[g[t][0]]),Ll(f,u,c),r=o/e,i=a/n,m.push(f[0],f[1],f[2]),b.push(y[t][0],y[t][1],y[t][2]),_.push(r,i),r=.875*(r/=3)+lm,i=.875*(i/=3)+lm,r+=t%3/3,i+=Math.floor(t/3)/3,x.push(r,i),o<e&&a<n&&(w.push(E+n+1,E+1,E),w.push(E+n+1,E+n+2,E+1)),E++}};S(0,s,c),S(1,s,c),S(2,s,f),S(3,s,f),S(4,f,c),S(5,f,c);var A=pv(m),T=this.getComponent();T.indices=Uint32Array.from(w),T.aabb=A,T.vertexCount=E,T.attributes=[{dirty:!0,name:"position",data:Float32Array.from(m),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(b),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(_),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),i}(Hv))||am;var hm,pm=(0,nl.b2)()(fm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){var t=this.config.geometries,e=void 0===t?[]:t,n=this.getComponent();n.aabb=new Od;var r=[],i=[],o=0;e.forEach((function(t){var e=t.aabb,a=t.indices,u=t.vertexCount,s=t.attributes;n.aabb.add(e),n.vertexCount+=u,a&&i.push.apply(i,fy(a.map((function(t){return t+o})))),o+=u,s.forEach((function(t,e){r[e]?t.data&&(xv(t.data)?r[e].push(t.data):og(t.data)?r[e].data=function(t,e){if(!t&&!e)throw new Error("Please specify valid arguments for parameters a and b.");if(!e||0===e.length)return t;if(!t||0===t.length)return e;if(Object.prototype.toString.call(t)!==Object.prototype.toString.call(e))throw new Error("The types of the two arguments passed for parameters a and b do not match.");var n=new t.constructor(t.length+e.length);return n.set(t),n.set(e,t.length),n}(r[e].data,t.data):r[e].data=r[e].data.concat(t.data)):(r[e]=t,r[e].dirty=!0)}))})),n.attributes=r,n.indices=Uint32Array.from(i),n.dirty=!0}}]),i}(Hv))||fm;var vm,gm=(0,nl.b2)()(hm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){for(var t=this.config,e=t.halfExtents,n=void 0===e?[.5,.5]:e,r=t.widthSegments,i=void 0===r?5:r,o=t.lengthSegments,a=void 0===o?5:o,u=[],s=[],c=[],f=[],l=0,d=0;d<=i;d++)for(var h=0;h<=a;h++){var p=-n[0]+2*n[0]*d/i,v=-(-n[1]+2*n[1]*h/a),g=d/i,y=h/a;u.push(p,0,v),s.push(0,1,0),c.push(g,y),d<i&&h<a&&(f.push(l+a+1,l+1,l),f.push(l+a+1,l+a+2,l+1)),l++}var m=pv(u),b=this.getComponent();b.indices=Uint32Array.from(f),b.aabb=m,b.vertexCount=l,b.attributes=[{dirty:!0,name:"position",data:Float32Array.from(u),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(s),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(c),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),i}(Hv))||hm;var ym,mm,bm,_m,xm,wm,Em,Sm,Am=(0,nl.b2)()(vm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){for(var t=this.config,e=t.radius,n=void 0===e?.5:e,r=t.latitudeBands,i=void 0===r?16:r,o=t.longitudeBands,a=void 0===o?16:o,u=[],s=[],c=[],f=[],l=0;l<=i;l++)for(var d=l*Math.PI/i,h=Math.sin(d),p=Math.cos(d),v=0;v<=a;v++){var g=2*v*Math.PI/a-Math.PI/2,y=Math.sin(g),m=Math.cos(g)*h,b=p,_=y*h,x=1-v/a,w=1-l/i;u.push(m*n,b*n,_*n),s.push(m,b,_),c.push(x,w)}for(var E=0;E<i;++E)for(var S=0;S<a;++S){var A=E*(a+1)+S,T=A+a+1;f.push(A+1,T,A),f.push(A+1,T+1,T)}var I=pv(u),N=this.getComponent();N.indices=Uint32Array.from(f),N.aabb=I,N.vertexCount=u.length/3,N.attributes=[{dirty:!0,name:"position",data:Float32Array.from(u),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(s),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(c),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),i}(Hv))||vm;var Tm,Im,Nm,Om,Cm,km,Dm,Mm,Rm,Pm,Gm,Lm,jm=(ym=(0,nl.b2)(),mm=(0,nl.f3)(rl.RenderEngine),bm=(0,nl.f3)(rl.ShaderModuleService),ym((Sm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"engine",wm,fl(t)),Uf(t,"shaderModuleService",Em,fl(t)),t}return Vf(i,[{key:"onEntityCreated",value:function(){var t=this.getComponent(),e=this.engine.supportWebGPU?"layout(set = 0, binding = 0) uniform Uniforms {\n vec4 color;\n mat4 projectionMatrix;\n mat4 modelViewMatrix;\n} uniforms;\n\nlayout(location = 0) in vec3 position;\n// layout(location = 1) in vec3 barycentric;\n\nlayout(location = 0) out vec4 fragColor;\n// layout(location = 1) out vec3 v_Barycentric;\n\nvoid main() {\n gl_Position = uniforms.projectionMatrix * uniforms.modelViewMatrix * vec4(position, 1.0);\n fragColor = uniforms.color;\n // v_Barycentric = barycentric;\n}":'attribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec4 color;\n\nvarying vec4 fragColor;\n\n#pragma include "uv.vert.declaration"\n\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n fragColor = color;\n\n #pragma include "uv.vert.main"\n}',n=this.engine.supportWebGPU?"// layout(set = 0, binding = 1) uniform WireframeUniforms {\n// float lineWidth;\n// vec4 lineColor;\n// } wireframe;\n\nlayout(location = 0) in vec4 fragColor;\n// layout(location = 1) in vec3 v_Barycentric;\n\nlayout(location = 0) out vec4 outColor;\n\n// wireframe\n// float edgeFactor() {\n// vec3 d = fwidth(v_Barycentric);\n// vec3 a3 = smoothstep(vec3(0.0), d * wireframe.lineWidth, v_Barycentric);\n// return min(min(a3.x, a3.y), a3.z);\n// }\n\nvoid main() {\n // outColor = mix(fragColor, wireframe.lineColor, (1.0 - edgeFactor()));\n outColor = fragColor;\n}":'varying vec4 fragColor;\n\n#pragma include "uv.frag.declaration"\n#pragma include "map.frag.declaration"\n\nvoid main() {\n vec4 diffuseColor = fragColor;\n\n #pragma include "map.frag.main"\n\n gl_FragColor = diffuseColor;\n}';this.shaderModuleService.registerModule("material-basic",{vs:e,fs:n});var r=this.shaderModuleService.getModule("material-basic"),i=r.vs,o=r.fs,a=r.uniforms;t.vertexShaderGLSL=i,t.fragmentShaderGLSL=o,t.setUniform(a),this.config.map&&(t.setDefines({USE_UV:1,USE_MAP:1}),t.setUniform({map:this.config.map,uvTransform:Cl()}))}}]),i}(Wg),wm=Wf((xm=Sm).prototype,"engine",[mm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Em=Wf(xm.prototype,"shaderModuleService",[bm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_m=xm))||_m);var Fm,Um,Bm,zm,Vm,Wm,Hm,Xm,qm,Ym,Km,Zm,$m=(Tm=(0,nl.b2)(),Im=(0,nl.f3)(rl.Systems),Nm=(0,nl.t6)(rl.MaterialSystem),Om=(0,nl.f3)(rl.Systems),Cm=(0,nl.t6)(rl.GeometrySystem),km=(0,nl.f3)(rl.ShaderModuleService),Tm((Lm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"materialSystem",Rm,fl(t)),Uf(t,"geometrySystem",Pm,fl(t)),Uf(t,"shaderModuleService",Gm,fl(t)),t}return Vf(i,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();r&&r.material&&("gridColor"===e?(r.material.setUniform("u_GridColor",n),r.material.setUniform("u_GridColor2",n)):"gridSize"===e&&(r.material.setUniform("u_GridSize",n),r.material.setUniform("u_GridSize2",n)))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:"attribute vec3 a_Position;\n\nvarying vec3 v_Position;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvoid main() {\n v_Position = a_Position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_Position, 1.);\n}",fs:"// generate grid, borrow from clay.gl viewer\n// @see https://github.com/pissang/clay-viewer/blob/master/src/graphic/ground.glsl\n#extension GL_OES_standard_derivatives : enable\n\nvarying vec3 v_Position;\n// varying vec3 v_Normal;\n\nuniform float u_GridSize : 5;\nuniform float u_GridSize2 : .5;\nuniform vec4 u_GridColor : [0, 0, 0, 1];\nuniform vec4 u_GridColor2 : [0.3, 0.3, 0.3, 1];\nuniform bool u_GridEnabled : true;\n\n// uniform vec3 u_LightDirection;\n// uniform vec3 u_LightColor;\n// uniform vec3 u_Camera;\n\nvoid main() {\n // vec3 n = v_Normal;\n // vec3 l = normalize(u_LightDirection);\n // float NdotL = clamp(dot(n, l), 0.001, 1.0);\n\n gl_FragColor = vec4(1.);\n\n if (u_GridEnabled) {\n float wx = v_Position.x;\n float wz = v_Position.z;\n // float x0 = abs(fract(wx / u_GridSize - 0.5) - 0.5) / fwidth(wx) * u_GridSize / 2.0;\n // float z0 = abs(fract(wz / u_GridSize - 0.5) - 0.5) / fwidth(wz) * u_GridSize / 2.0;\n\n float x1 = abs(fract(wx / u_GridSize2 - 0.5) - 0.5) / fwidth(wx) * u_GridSize2;\n float z1 = abs(fract(wz / u_GridSize2 - 0.5) - 0.5) / fwidth(wz) * u_GridSize2;\n\n // float v0 = 1.0 - clamp(min(x0, z0), 0.0, 1.0);\n float v1 = 1.0 - clamp(min(x1, z1), 0.0, 1.0);\n // if (v0 > 0.1) {\n // gl_FragColor = mix(gl_FragColor, u_GridColor, v0);\n // }\n // else {\n gl_FragColor = mix(gl_FragColor, u_GridColor2, v1);\n // }\n }\n\n // float shadowFactor = calcShadow(u_ShadowMap, v_PositionFromLight, l, n);\n // vec3 diffuseColor = u_LightColor * NdotL * shadowFactor;\n\n // gl_FragColor.rgb *= diffuseColor;\n}"});var t=this.shaderModuleService.getModule("grid"),e=t.vs,n=t.fs,r=t.uniforms,i=this.materialSystem.createShaderMaterial({vertexShader:e,fragmentShader:n});this.setMaterial(i);var o=this.geometrySystem.createBufferGeometry({vertexCount:4});this.setGeometry(o),i.setCull({enable:!1,face:td.BACK}).setDepth({enable:!0,func:td.LESS}),i.setUniform(r),this.setAttributes({gridColor:this.config.gridColor,gridSize:this.config.gridSize}),o.setIndex([0,3,2,2,1,0]),o.setAttribute("a_Position",Float32Array.from([-4,-1,-4,4,-1,-4,4,-1,4,-4,-1,4]),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})}}]),i}(Hg),Rm=Wf((Mm=Lm).prototype,"materialSystem",[Im,Nm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Pm=Wf(Mm.prototype,"geometrySystem",[Om,Cm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Gm=Wf(Mm.prototype,"shaderModuleService",[km],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Dm=Mm))||Dm),Jm=n(7801),Qm=n(1739);function tb(t,e,n,r,i){eb(e,r,-i),eb(e,r,i),t.push(n),t.push(n)}function eb(t,e,n){t.push([[e[0],e[1]],n])}var nb,rb,ib,ob,ab,ub,sb,cb,fb,lb,db,hb,pb=(Fm=(0,nl.b2)(),Um=(0,nl.f3)(rl.Systems),Bm=(0,nl.t6)(rl.MaterialSystem),zm=(0,nl.f3)(rl.Systems),Vm=(0,nl.t6)(rl.GeometrySystem),Wm=(0,nl.f3)(rl.ShaderModuleService),Fm((Zm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"materialSystem",qm,fl(t)),Uf(t,"geometrySystem",Ym,fl(t)),Uf(t,"shaderModuleService",Km,fl(t)),t.vertexCount=void 0,t}return Vf(i,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();if(r&&r.material)switch(e){case"dashArray":r.material.setUniform("u_dash_array",n);break;case"dashOffset":r.material.setUniform("u_dash_offset",n);break;case"dashRatio":r.material.setUniform("u_dash_ratio",n);break;case"thickness":r.material.setUniform("u_thickness",n);break;case"color":var i=new Array(this.vertexCount).fill(void 0).map((function(){return n})).reduce((function(t,e){return[].concat(fy(t),fy(e))}),[]);r.geometry.setAttribute("a_color",Float32Array.from(i),{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]})}}},{key:"onEntityCreated",value:function(){var t=this;this.shaderModuleService.registerModule("line",{vs:"attribute vec2 a_pos;\nattribute vec4 a_color;\nattribute float a_line_miter;\nattribute vec2 a_line_normal;\nattribute float a_counters;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform float u_thickness : 0.02;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n v_color = a_color;\n v_counters = a_counters;\n\n vec3 normal = normalize(vec3(a_line_normal, 0.0));\n\n vec4 offset = vec4(normal * u_thickness / 2.0 * a_line_miter, 0.0);\n\n v_normal = vec2(normal * sign(a_line_miter));\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_pos, 0.0, 1.0) + offset;\n}\n",fs:"uniform float u_dash_array : 0.02;\nuniform float u_dash_offset : 0;\nuniform float u_dash_ratio : 0;\nuniform float u_thickness : 0.02;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n float blur = 1. - smoothstep(0.98, 1., length(v_normal));\n\n gl_FragColor = v_color;\n gl_FragColor.a *= blur * ceil(mod(v_counters + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n}"});var e=this.shaderModuleService.getModule("line"),n=e.vs,r=e.fs,i=e.uniforms,o=this.materialSystem.createShaderMaterial({vertexShader:n,fragmentShader:r}),a=function(t,e,n){for(var r=[0,0],i=[0,0],o=[0,0],a=[0,0],u=-1,s=!1,c=null,f=(0,Jm.create)(),l=0,d=[],h=[],p=[],v=[0,0],g=t.length,y=1;y<g;y++){var m=l,b=t[y-1],_=t[y],x=y<t.length-1?t[y+1]:null;if(v.push(y/g,y/g),(0,Qm.o7)(r,_,b),c||(c=[0,0],(0,Qm.mJ)(c,r)),s||(s=!0,tb(h,d,b,c,1)),p.push([m+0,m+1,m+2]),x){(0,Qm.o7)(i,x,_);var w=(0,Qm.x7)(o,a,r,i,1),E=(0,Jm.dot)(o,c)<0?-1:1,S=w>3;if(!isFinite(w)){(0,Qm.mJ)(c,r),tb(h,d,_,c,1),p.push(1===u?[m,m+2,m+3]:[m+2,m+1,m+3]),l+=2,u=E;continue}S?(w=3,v.push(y/g),eb(d,c,-E),h.push(_),eb(d,a,w*E),h.push(_),p.push(u!==-E?[m,m+2,m+3]:[m+2,m+1,m+3]),p.push([m+2,m+3,m+4]),(0,Qm.mJ)(f,i),(0,Jm.copy)(c,f),eb(d,c,-E),h.push(_),l+=3):(tb(h,d,_,a,w),p.push(1===u?[m,m+2,m+3]:[m+2,m+1,m+3]),E=-1,(0,Jm.copy)(c,a),l+=2),u=E}else(0,Qm.mJ)(c,r),tb(h,d,_,c,1),p.push(1===u?[m,m+2,m+3]:[m+2,m+1,m+3]),l+=2}return{normals:d,attrIndex:p,attrPos:h,attrCounters:v}}(this.config.points),u=a.normals,s=a.attrIndex,c=a.attrPos,f=a.attrCounters,l=c.length;this.vertexCount=l;var d=this.geometrySystem.createBufferGeometry({vertexCount:l});this.setMaterial(o),this.setGeometry(d),o.setCull({enable:!1,face:td.BACK}).setUniform(i),this.setAttributes({dashArray:this.config.dashArray,dashOffset:this.config.dashOffset,dashRatio:this.config.dashRatio,thickness:this.config.thickness});var h=[],p=[];u.forEach((function(t){var e=t[0],n=t[1];h.push([e[0],e[1]]),p.push(n)})),d.setIndex(s.reduce((function(t,e){return[].concat(fy(t),fy(e))}),[])),d.setAttribute("a_pos",Float32Array.from(c.reduce((function(t,e){return[].concat(fy(t),fy(e))}),[])),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]});var v=new Array(l).fill(void 0).map((function(){return fy(t.config.color)})).reduce((function(t,e){return[].concat(fy(t),fy(e))}),[]);d.setAttribute("a_color",Float32Array.from(v),{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]}),d.setAttribute("a_line_miter",Float32Array.from(p),{arrayStride:4,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float"}]}),d.setAttribute("a_line_normal",Float32Array.from(h.reduce((function(t,e){return[].concat(fy(t),fy(e))}),[])),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:3,offset:0,format:"float2"}]}),d.setAttribute("a_counters",Float32Array.from(f),{arrayStride:4,stepMode:"vertex",attributes:[{shaderLocation:4,offset:0,format:"float"}]})}}]),i}(Hg),qm=Wf((Xm=Zm).prototype,"materialSystem",[Um,Bm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ym=Wf(Xm.prototype,"geometrySystem",[zm,Vm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Km=Wf(Xm.prototype,"shaderModuleService",[Wm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Hm=Xm))||Hm);function vb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var gb,yb,mb,bb,_b,xb,wb,Eb,Sb,Ab,Tb=["circle","triangle","square","pentagon","hexagon","octogon","hexagram","rhombus","vesica"],Ib=(nb=(0,nl.b2)(),rb=(0,nl.f3)(rl.Systems),ib=(0,nl.t6)(rl.MaterialSystem),ob=(0,nl.f3)(rl.Systems),ab=(0,nl.t6)(rl.GeometrySystem),ub=(0,nl.f3)(rl.ShaderModuleService),nb((hb=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"materialSystem",fb,fl(t)),Uf(t,"geometrySystem",lb,fl(t)),Uf(t,"shaderModuleService",db,fl(t)),t}return Vf(i,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();r&&r.material&&("strokeWidth"===e?r.material.setUniform("u_stroke_width",n):"strokeColor"===e?r.material.setUniform("u_stroke_color",n):"strokeOpacity"===e?r.material.setUniform("u_stroke_opacity",n):"opacity"===e?r.material.setUniform("u_opacity",n):"blur"===e&&r.material.setUniform("u_blur",n))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:'attribute vec2 position;\nattribute vec4 color;\nattribute float shape;\nattribute vec2 offset;\nattribute float size;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nuniform float u_stroke_width : 0.01;\nuniform float u_device_pixel_ratio;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec4 v_data;\nvarying float v_radius;\n\n#pragma include "picking"\n\nvoid main() {\n v_color = color;\n v_radius = size;\n\n lowp float antialiasblur = 1.0 / u_device_pixel_ratio * (size + u_stroke_width);\n\n // construct point coords\n v_data = vec4(position, antialiasblur, shape);\n\n gl_Position = projectionMatrix * modelViewMatrix\n * vec4(position * size + offset, 0.0, 1.0);\n\n setPickingColor(a_PickingColor);\n}',fs:"uniform float u_blur : 0.05;\nuniform float u_opacity : 0.7;\nuniform float u_stroke_width : 0.01;\nuniform vec4 u_stroke_color : [0, 0, 0, 0];\nuniform float u_stroke_opacity : 1;\n\nvarying vec4 v_color;\nvarying vec4 v_data;\nvarying float v_radius;\n\n#pragma include \"sdf2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n float antialiasblur = v_data.z;\n float antialiased_blur = -max(u_blur, antialiasblur);\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n // if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n // } else if (shape == 1) {\n // outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n // inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n // } else if (shape == 2) {\n // outer_df = sdBox(v_data.xy, vec2(1.));\n // inner_df = sdBox(v_data.xy, vec2(r));\n // } else if (shape == 3) {\n // outer_df = sdPentagon(v_data.xy, 0.8);\n // inner_df = sdPentagon(v_data.xy, r * 0.8);\n // } else if (shape == 4) {\n // outer_df = sdHexagon(v_data.xy, 0.8);\n // inner_df = sdHexagon(v_data.xy, r * 0.8);\n // } else if (shape == 5) {\n // outer_df = sdOctogon(v_data.xy, 1.0);\n // inner_df = sdOctogon(v_data.xy, r);\n // } else if (shape == 6) {\n // outer_df = sdHexagram(v_data.xy, 0.52);\n // inner_df = sdHexagram(v_data.xy, r * 0.52);\n // } else if (shape == 7) {\n // outer_df = sdRhombus(v_data.xy, vec2(1.0));\n // inner_df = sdRhombus(v_data.xy, vec2(r));\n // } else if (shape == 8) {\n // outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n // inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n // }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n vec4 strokeColor = u_stroke_color == vec4(0) ? v_color : u_stroke_color;\n\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);\n gl_FragColor.a = gl_FragColor.a * opacity_t;\n\n gl_FragColor = filterColor(gl_FragColor);\n}"});var t=this.shaderModuleService.getModule("grid"),e=t.vs,n=t.fs,r=t.uniforms,i=this.materialSystem.createShaderMaterial({vertexShader:e,fragmentShader:n,cull:{enable:!1},depth:{enable:!1},blend:{enable:!0,func:{srcRGB:td.SRC_ALPHA,dstRGB:td.ONE_MINUS_SRC_ALPHA,srcAlpha:1,dstAlpha:1}}});i.setUniform(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vb(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vb(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({u_device_pixel_ratio:window.devicePixelRatio},r));var o=this.buildAttributes(),a=this.geometrySystem.createInstancedBufferGeometry({maxInstancedCount:o.instancedOffsets.length/2,vertexCount:6});a.setIndex([0,2,1,0,3,2]),a.setAttribute("position",Float32Array.from(o.positions),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]}),a.setAttribute("offset",Float32Array.from(o.instancedOffsets),{arrayStride:8,stepMode:"instance",attributes:[{shaderLocation:1,offset:0,format:"float2"}]}),a.setAttribute("color",Float32Array.from(o.instancedColors),{arrayStride:16,stepMode:"instance",attributes:[{shaderLocation:2,offset:0,format:"float4"}]}),a.setAttribute("size",Float32Array.from(o.instancedSizes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:3,offset:0,format:"float"}]}),a.setAttribute("shape",Float32Array.from(o.instancedShapes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:4,offset:0,format:"float"}]}),a.setAttribute("a_PickingColor",Float32Array.from(o.instancedPickingColors),{arrayStride:12,stepMode:"instance",attributes:[{shaderLocation:6,offset:0,format:"float3"}]}),this.setMaterial(i),this.setGeometry(a)}},{key:"buildAttribute",value:function(t,e,n){var r,i,o,a,u;(r=e.instancedPickingColors).push.apply(r,fy([(u=t.id||n)+1&255,u+1>>8&255,u+1>>8>>8&255])),e.instancedShapes.push(Tb.indexOf(t.shape||"circle")),(i=e.instancedColors).push.apply(i,fy(t.color||[1,0,0,1])),(o=e.instancedOffsets).push.apply(o,fy(t.position||[0,0])),(a=e.instancedSizes).push.apply(a,fy(t.size||[.2,.2]))}},{key:"buildAttributes",value:function(){var t=this,e={positions:[1,1,1,-1,-1,-1,-1,1],instancedOffsets:[],instancedColors:[],instancedSizes:[],instancedShapes:[],instancedPickingColors:[]};return Array.isArray(this.config)?this.config.forEach((function(n,r){t.buildAttribute(n,e,r)})):this.buildAttribute(this.config,e,0),e}}]),i}(Hg),fb=Wf((cb=hb).prototype,"materialSystem",[rb,ib],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),lb=Wf(cb.prototype,"geometrySystem",[ob,ab],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),db=Wf(cb.prototype,"shaderModuleService",[ub],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),sb=cb))||sb);function Nb(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ob(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ob(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Ob(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}var Cb,kb,Db,Mb,Rb,Pb,Gb,Lb,jb,Fb,Ub,Bb,zb=(gb=(0,nl.b2)(),yb=(0,nl.f3)(rl.RenderEngine),mb=(0,nl.f3)(rl.ShaderModuleService),bb=(0,nl.f3)(rl.ConfigService),gb((Ab=function(){function t(){Bf(this,t),this.container=void 0,Uf(this,"engine",wb,this),Uf(this,"shaderModule",Eb,this),Uf(this,"configService",Sb,this),this.inited=!1,this.rendering=!1,this.pendings=[],this.views=[],this.size=void 0}var e,n;return Vf(t,[{key:"init",value:(n=Yf(Xf().mark((function t(){var e,n,r,i,o;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.shaderModule.registerBuiltinModules(),this.shaderModule.registerModule("uv.vert.declaration",{vs:"#ifdef USE_UV\n attribute vec2 uv;\n\t#ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif"}),this.shaderModule.registerModule("uv.vert.main",{vs:"#ifdef USE_UV\n vUv = (uvTransform * vec3(uv, 1)).xy;\n#endif"}),this.shaderModule.registerModule("uv.frag.declaration",{fs:"#if (defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ))\n varying vec2 vUv;\n#endif"}),this.shaderModule.registerModule("map.frag.declaration",{fs:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif"}),this.shaderModule.registerModule("map.frag.main",{fs:"#ifdef USE_MAP\n vec4 texelColor = texture2D(map, vUv);\n // texelColor = mapTexelToLinear(texelColor);\n diffuseColor *= texelColor;\n#endif"}),e=this.container.getAll(rl.Systems),!(n=this.configService.get()).canvas){t.next=30;break}return t.next=11,this.engine.init({canvas:n.canvas,swapChainFormat:Xv.EV.BGRA8Unorm,antialiasing:!1});case 11:r=Nb(e),t.prev=12,r.s();case 14:if((i=r.n()).done){t.next=21;break}if(!(o=i.value).initialize){t.next=19;break}return t.next=19,o.initialize();case 19:t.next=14;break;case 21:t.next=26;break;case 23:t.prev=23,t.t0=t.catch(12),r.e(t.t0);case 26:return t.prev=26,r.f(),t.finish(26);case 29:this.inited=!0;case 30:case"end":return t.stop()}}),t,this,[[12,23,26,29]])}))),function(){return n.apply(this,arguments)})},{key:"render",value:(e=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s=arguments;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.inited&&!this.rendering){t.next=2;break}return t.abrupt("return");case 2:for(this.pendings.length&&this.pendings.forEach((function(t){t()})),this.rendering=!0,this.engine.beginFrame(),e=this.container.getAll(rl.Systems),n=s.length,r=new Array(n),i=0;i<n;i++)r[i]=s[i];o=Nb(e),t.prev=8,o.s();case 10:if((a=o.n()).done){t.next=17;break}if(!(u=a.value).execute){t.next=15;break}return t.next=15,u.execute(r);case 15:t.next=10;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(8),o.e(t.t0);case 22:return t.prev=22,o.f(),t.finish(22);case 25:this.engine.endFrame(),this.rendering=!1;case 27:case"end":return t.stop()}}),t,this,[[8,19,22,25]])}))),function(){return e.apply(this,arguments)})},{key:"clear",value:function(t){var e=this;return this.inited?this.engine.clear(t):this.pendings.unshift((function(){e.engine.clear(t),e.pendings.shift()})),this}},{key:"setSize",value:function(t){var e=t.width,n=t.height,r=this.engine.getCanvas();return this.size={width:e,height:n},r.width=e,r.height=n,this}},{key:"getSize",value:function(){return this.size}}]),t}(),wb=Wf((xb=Ab).prototype,"engine",[yb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Eb=Wf(xb.prototype,"shaderModule",[mb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sb=Wf(xb.prototype,"configService",[bb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_b=xb))||_b),Vb=(0,nl.b2)()((kb=function(){function t(){Bf(this,t),this.entities=[]}return Vf(t,[{key:"getEntities",value:function(){return this.entities}},{key:"addRenderable",value:function(t){return this.addEntity(t.getEntity()),this}},{key:"removeRenderable",value:function(t){return this.removeEntity(t.getEntity()),this}},{key:"addLight",value:function(){}},{key:"addEntity",value:function(t){return-1===this.entities.indexOf(t)&&this.entities.push(t),this}},{key:"removeEntity",value:function(t){var e=this.entities.indexOf(t);return this.entities.splice(e,1),this}}]),t}(),Cb=kb))||Cb,Wb=(0,nl.b2)()((Mb=function(){function t(){Bf(this,t),this.cache={}}return Vf(t,[{key:"get",value:function(t){return this.cache[t]}},{key:"set",value:function(t,e){this.cache[t]=e}}]),t}(),Db=Mb))||Db;function Hb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Xb(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Hb(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hb(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var qb,Yb,Kb,Zb,$b,Jb,Qb,t_,e_,n_,r_,i_,o_,a_=(Rb=(0,nl.b2)(),Pb=(0,nl.f3)(Wb),Gb=(0,nl.f3)(rl.RenderEngine),Rb((Bb=function(){function t(){Bf(this,t),Uf(this,"textureCache",Fb,this),Uf(this,"engine",Ub,this),this.config=void 0,this.loaded=!1,this.texture=void 0}var e;return Vf(t,[{key:"setConfig",value:function(t){this.config=t}},{key:"isLoaded",value:function(){return this.loaded}},{key:"load",value:(e=Yf(Xf().mark((function t(){var e=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.config.url){t.next=4;break}return t.abrupt("return",new Promise((function(t,n){var r=e.textureCache.get(e.config.url);if(r)t(r);else{var i=new Image;i.crossOrigin="Anonymous",i.src=e.config.url,i.onload=function(){var n=e.engine.createTexture2D(Xb(Xb({},e.config),{},{data:i,width:i.width,height:i.height,flipY:!0}));e.textureCache.set(e.config.url,n),e.texture=n,e.loaded=!0,t(n)},i.onerror=function(){n()}}})));case 4:return this.loaded=!0,this.texture=this.engine.createTexture2D(this.config),t.abrupt("return",this.texture);case 7:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),Fb=Wf((jb=Bb).prototype,"textureCache",[Pb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ub=Wf(jb.prototype,"engine",[Gb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Lb=jb))||Lb),u_=(qb=(0,nl.b2)(),Yb=(0,nl.f3)(rl.Systems),Kb=(0,nl.t6)(rl.RendererSystem),qb((Qb=function(){function t(){Bf(this,t),Uf(this,"rendererSystem",Jb,this),this.camera=void 0,this.scene=void 0,this.viewport={x:0,y:0,width:0,height:0},this.clearColor=[1,1,1,1]}return Vf(t,[{key:"getCamera",value:function(){return this.camera}},{key:"getScene",value:function(){return this.scene}},{key:"getViewport",value:function(){return this.viewport}},{key:"getClearColor",value:function(){return this.clearColor}},{key:"setCamera",value:function(t){return this.camera=t,this}},{key:"setScene",value:function(t){return this.scene=t,this}},{key:"setViewport",value:function(t){return this.viewport=t,this}},{key:"setClearColor",value:function(t){return this.clearColor=t,this}},{key:"pick",value:function(t){return this.rendererSystem.pick(t,this)}}]),t}(),Jb=Wf(($b=Qb).prototype,"rendererSystem",[Yb,Kb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Zb=$b))||Zb);function s_(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c_(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s_(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s_(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var f_=(t_=(0,nl.b2)(),e_=(0,nl.f3)(rl.ConfigService),t_((o_=function(){function t(){Bf(this,t),Uf(this,"configService",i_,this),this.container=void 0}var e;return Vf(t,[{key:"getEngine",value:(e=Yf(Xf().mark((function t(){var e,n,r,i;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.container.get(rl.RenderEngine),n=this.configService.get(),r=n.canvas,i=n.engineOptions,t.next=4,e.init(c_({canvas:r||qv(),swapChainFormat:Xv.EV.BGRA8Unorm,antialiasing:!1},i));case 4:return t.abrupt("return",e);case 5:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"getTransformComponent",value:function(t){return this.container.get(rl.TransformComponentManager).getComponentByEntity(t)}},{key:"getMeshComponent",value:function(t){return this.container.get(rl.MeshComponentManager).getComponentByEntity(t)}},{key:"setConfig",value:function(t){this.configService.set(t)}},{key:"setContainer",value:function(t){this.container=t}},{key:"getContainer",value:function(){return this.container}},{key:"createEntity",value:function(){return Zf()}},{key:"createScene",value:function(){return this.container.get(Vb)}},{key:"createCamera",value:function(){return this.container.get(Wv)}},{key:"createView",value:function(){return this.container.get(u_)}},{key:"createRenderable",value:function(t,e){var n=t?this.container.getNamed(rl.Renderable,t):this.container.get(Hg),r=Zf();return n.setConfig(e||{}),n.setEntity(r),n}},{key:"createGeometry",value:function(t,e){var n=this.container.getNamed(rl.Geometry,t),r=Zf();return n.setConfig(e||{}),n.setEntity(r),n.getComponent()}},{key:"createMaterial",value:function(t,e){var n=this.container.getNamed(rl.Material,t),r=Zf();return n.setConfig(e||{}),n.setEntity(r,t),n.getComponent()}},{key:"createTexture2D",value:function(t){var e=this.container.get(a_);return e.setConfig(t),e}},{key:"createBufferGeometry",value:function(t){return this.container.getNamed(rl.Systems,rl.GeometrySystem).createBufferGeometry(t)}},{key:"createInstancedBufferGeometry",value:function(t){return this.container.getNamed(rl.Systems,rl.GeometrySystem).createInstancedBufferGeometry(t)}},{key:"createShaderMaterial",value:function(t){return this.container.getNamed(rl.Systems,rl.MaterialSystem).createShaderMaterial(t)}},{key:"createKernel",value:function(t){var e=this.container.get(Vg);return"string"==typeof t?e.setBundle(JSON.parse(t)):e.setBundle(t),e.init(),e}},{key:"createRenderer",value:function(){var t=this.container.get(zb);return t.container=this.container,t.init(),t}},{key:"destroy",value:function(){this.container.getAll(rl.Systems).forEach((function(t){t.tearDown&&t.tearDown()})),this.container.get(rl.RenderEngine).destroy(),this.container.get(rl.InteractorService).destroy()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=hv(),r=navigator.gpu?cm:Oy;n.isBound(rl.RenderEngine)||n.bind(rl.RenderEngine).to(r).inSingletonScope(),n.bind(zb).toSelf(),n.bind(Vg).toSelf(),n.bind(Hg).toSelf(),n.bind(u_).toSelf(),n.bind(Wv).toSelf(),n.bind(Vb).toSelf(),n.bind(t).toSelf(),n.bind(Wb).toSelf(),n.bind(a_).toSelf(),n.bind(rl.Geometry).to(dm).whenTargetNamed(Hv.BOX),n.bind(rl.Geometry).to(Am).whenTargetNamed(Hv.SPHERE),n.bind(rl.Geometry).to(gm).whenTargetNamed(Hv.PLANE),n.bind(rl.Geometry).to(pm).whenTargetNamed(Hv.MERGED),n.bind(rl.Material).to(jm).whenTargetNamed(Wg.BASIC),n.bind(rl.Renderable).to(Ib).whenTargetNamed(Hg.POINT),n.bind(rl.Renderable).to(pb).whenTargetNamed(Hg.LINE),n.bind(rl.Renderable).to($m).whenTargetNamed(Hg.GRID);var i=n.get(t);return i.setContainer(n),i.setConfig(e),i}}]),t}(),i_=Wf((r_=o_).prototype,"configService",[e_],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),n_=r_))||n_),l_=function(t,e){return t?o(t)?function(){return t}:t:function(){return e||1}},d_=function(t){for(var e=[],n=t.length,r=t[0].length,i=function(r){t.forEach((function(t,i){if(e.push(t[r]),i===n-1)for(;e.length%4!=0;)e.push(0)}))},o=0;o<r;o++)i(o);return new Float32Array(e)},h_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},v_=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},g_=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.gravity=10,n.speed=1,n.clustering=!1,n.clusterField="cluster",n.clusterGravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(e),n}return h_(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return p_(this,void 0,void 0,(function(){var t,e,n,r,i,a=this;return v_(this,(function(u){switch(u.label){case 0:return(e=(t=this).nodes)&&0!==e.length?(t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),n=t.center,1===e.length?(e[0].x=n[0],e[0].y=n[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(r={},i={},e.forEach((function(t,e){o(t.x)||(t.x=Math.random()*a.width),o(t.y)||(t.y=Math.random()*a.height),r[t.id]=t,i[t.id]=e})),t.nodeMap=r,t.nodeIdxMap=i,[4,t.run()])):(t.onLayoutEnd&&t.onLayoutEnd(),[2]);case 1:return u.sent(),[2]}}))}))},e.prototype.executeWithWorker=function(t,e){return p_(this,void 0,void 0,(function(){var n,r,i,a,u,s=this;return v_(this,(function(c){switch(c.label){case 0:return r=(n=this).nodes,i=n.center,r&&0!==r.length?1===r.length?(r[0].x=i[0],r[0].y=i[1],[2]):(a={},u={},r.forEach((function(t,e){o(t.x)||(t.x=Math.random()*s.width),o(t.y)||(t.y=Math.random()*s.height),a[t.id]=t,u[t.id]=e})),n.nodeMap=a,n.nodeIdxMap=u,[4,n.run(t,e)]):[2];case 1:return c.sent(),[2]}}))}))},e.prototype.run=function(t,e){return p_(this,void 0,void 0,(function(){var n,r,i,a,u,s,c,f,l,h,p,v,g,y,m,b,_,x,w,E,S,A,T,I,N,O,C=this;return v_(this,(function(k){switch(k.label){case 0:for(r=(n=this).nodes,i=n.edges,a=n.maxIteration,u=n.center,s=n.height*n.width,c=Math.sqrt(s)/10,f=s/(r.length+1),l=Math.sqrt(f),h=n.speed,p=n.clustering,D=[n.clusterField],M=r,R=[],P=D.length,G={},M.forEach((function(t){D.forEach((function(e,n){if(void 0===G[t[e]]&&(G[t[e]]=Object.keys(G).length),R.push(G[t[e]]),n===P-1)for(;R.length%4!=0;)R.push(0)}))})),v={array:new Float32Array(R),count:Object.keys(G).length},g=v.array,y=v.count,r.forEach((function(t,e){var n=0,r=0;o(t.fx)&&o(t.fy)&&(n=t.fx||.001,r=t.fy||.001),g[4*e+1]=n,g[4*e+2]=r})),m=r.length,b=function(t,e){var n=[],r=[],i={},o=0;for(o=0;o<t.length;o++){var a=t[o];i[a.id]=o,n.push(a.x),n.push(a.y),n.push(0),n.push(0),r.push([])}for(o=0;o<e.length;o++){var u=e[o],s=d(u,"source"),c=d(u,"target");isNaN(i[s])||isNaN(i[c])||(r[i[s]].push(i[c]),r[i[c]].push(i[s]))}var f=0;for(o=0;o<t.length;o++){var l=n.length,h=r[o],p=h.length;n[4*o+2]=l,n[4*o+3]=p,f=Math.max(f,p);for(var v=0;v<p;++v){var g=h[v];n.push(+g)}}for(;n.length%4!=0;)n.push(0);return{maxEdgePerVetex:f,array:new Float32Array(n)}}(r,i),_=b.maxEdgePerVetex,x=b.array,w=n.workerEnabled,E=w?f_.create({canvas:t,engineOptions:{supportCompute:!0}}):f_.create({engineOptions:{supportCompute:!0}}),S=n.onLayoutEnd,A=[],T=0;T<y;T++)A.push(0,0,0,0);return I=E.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_K : f32;\\n [[offset 4]] u_K2 : f32;\\n [[offset 8]] u_Center : vec2<f32>;\\n [[offset 16]] u_Gravity : f32;\\n [[offset 20]] u_ClusterGravity : f32;\\n [[offset 24]] u_Speed : f32;\\n [[offset 28]] u_MaxDisplace : f32;\\n [[offset 32]] u_Clustering : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AttributeArray : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar param : f32 = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx = dx + param * xDist;\\ndy = dy + param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < j);\\ndx = dx + param * std::sign;\\ndy = dy + param * std::sign;}}}}\\nreturn vec2<f32>(dx, dy);}\\nfn calcGravity(currentNode : vec4<f32>, nodeAttributes : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar vx : f32 = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nvar vy : f32 = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nvar gf : f32 = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {var clusterIdx : i32 = i32(nodeAttributes.x);\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nvar cvx : f32 = currentNode.x - center.x;\\nvar cvy : f32 = currentNode.y - center.y;\\nvar dist : f32 = std::sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nvar parma : f32 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx = dx + parma * cvx;\\ndy = dy + parma * cvy;}\\nreturn vec2<f32>(dx, dy);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar arr_offset : i32 = i32(std::floor(currentNode.z + 0.5));\\nvar length : i32 = i32(std::floor(currentNode.w + 0.5));\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + i32(p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = select(node_buffer.x, select(node_buffer.y, select(node_buffer.z, node_buffer.w, buf_offset == 2), buf_offset == 1), buf_offset == 0);\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar attractiveF : f32 = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx = dx - xDist * attractiveF;\\ndy = dy - yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < i32(float_j));\\ndx = dx - std::sign * attractiveF;\\ndy = dy - std::sign * attractiveF;}}}\\nreturn vec2<f32>(dx, dy);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nif (i >= __DefineValuePlaceholder__VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes : vec4<f32> = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\ndx = dx + repulsive.x;\\ndy = dy + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode);\\ndx = dx + attractive.x;\\ndy = dy + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(currentNode, nodeAttributes);\\ndx = dx - gravity.x;\\ndy = dy - gravity.y;\\ndx = dx * gWebGPUUniformParams.u_Speed;\\ndy = dy * gWebGPUUniformParams.u_Speed;\\nvar distLength : f32 = std::sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {var limitedDist : f32 = std::min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_K;\\n float u_K2;\\n vec2 u_Center;\\n float u_Gravity;\\n float u_ClusterGravity;\\n float u_Speed;\\n float u_MaxDisplace;\\n float u_Clustering;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AttributeArray[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec2 calcRepulsive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {float dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nfloat vy = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nfloat gf = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= gWebGPUUniformParams.u_Speed;\\ndy *= gWebGPUUniformParams.u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2<f32>","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([m,1,1]).setBinding({u_Data:x,u_K:l,u_K2:f,u_Gravity:n.gravity,u_ClusterGravity:n.clusterGravity||n.gravity||1,u_Speed:h,u_MaxDisplace:c,u_Clustering:p?1:0,u_Center:u,u_AttributeArray:g,u_ClusterCenters:A,MAX_EDGE_PER_VERTEX:_,VERTEX_COUNT:m}),p&&(N=E.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\n\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 0, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_NodeAttributes : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[i];\\nvar sumx : f32 = 0.0;\\nvar sumy : f32 = 0.0;\\nvar count : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var attributes : vec4<f32> = gWebGPUBuffer1.u_NodeAttributes[j];\\nvar clusterIdx : i32 = i32(attributes.x);\\nvar vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx = sumx + vertex.x;\\nsumy = sumy + vertex.y;\\ncount = count + 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4<f32>(sumx / count, sumy / count, count, i);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\n\\nlayout(std430, set = 0, binding = 0) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer1 {\\n vec4 u_NodeAttributes[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {int i = globalInvocationID.x;\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[i];\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = gWebGPUBuffer1.u_NodeAttributes[j];\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([y,1,1]).setBinding({u_Data:x,u_NodeAttributes:g,u_ClusterCenters:A,VERTEX_COUNT:m,CLUSTER_COUNT:y})),O=function(){return p_(C,void 0,void 0,(function(){var n,i;return v_(this,(function(o){switch(o.label){case 0:n=0,o.label=1;case 1:return n<a?[4,I.execute()]:[3,6];case 2:return o.sent(),p?(N.setBinding({u_Data:I}),[4,N.execute()]):[3,4];case 3:o.sent(),I.setBinding({u_ClusterCenters:N}),o.label=4;case 4:I.setBinding({u_MaxDisplace:c*=.99}),o.label=5;case 5:return n++,[3,1];case 6:return[4,I.getOutput()];case 7:return i=o.sent(),t?e.postMessage({type:Gt,vertexEdgeData:i}):r.forEach((function(t,e){var n=i[4*e],r=i[4*e+1];t.x=n,t.y=r})),S&&S(),[2]}}))}))},[4,O()];case 1:return k.sent(),[2]}var D,M,R,P,G}))}))},e.prototype.getType=function(){return"fruchterman-gpu"},e}(t),y_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},b_=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},__=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(e),n}return y_(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return m_(this,void 0,void 0,(function(){var t,e,n,r,i;return b_(this,(function(a){switch(a.label){case 0:return(e=(t=this).nodes)&&0!==e.length?(t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),n=t.center,1===e.length?(e[0].x=n[0],e[0].y=n[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(r={},i={},e.forEach((function(e,n){o(e.x)||(e.x=Math.random()*t.width),o(e.y)||(e.y=Math.random()*t.height),r[e.id]=e,i[e.id]=n})),t.nodeMap=r,t.nodeIdxMap=i,t.nodeStrength=l_(t.nodeStrength,1),t.edgeStrength=l_(t.edgeStrength,1),[4,t.run()])):(t.onLayoutEnd&&t.onLayoutEnd(),[2]);case 1:return a.sent(),[2]}}))}))},e.prototype.executeWithWorker=function(t,e){var n=this,r=n.nodes,i=n.center;if(r&&0!==r.length){if(1===r.length)return r[0].x=i[0],void(r[0].y=i[1]);var a={},u={};r.forEach((function(t,e){o(t.x)||(t.x=Math.random()*n.width),o(t.y)||(t.y=Math.random()*n.height),a[t.id]=t,u[t.id]=e})),n.nodeMap=a,n.nodeIdxMap=u,n.nodeStrength=l_(n.nodeStrength,1),n.edgeStrength=l_(n.edgeStrength,1),n.run(t,e)}},e.prototype.run=function(t,e){return m_(this,void 0,void 0,(function(){var n,r,i,a,u,s,c,f,l,p,v,g,y,m,b,_,x,w,E,S,A,T,I,N,O,C,k,D=this;return b_(this,(function(M){switch(M.label){case 0:for(r=(n=this).nodes,i=n.edges,a=n.maxIteration,n.width||"undefined"==typeof window||(n.width=window.innerWidth),n.height||"undefined"==typeof window||(n.height=window.innerHeight),u=r.length,n.linkDistance=l_(n.linkDistance),n.edgeStrength=l_(n.edgeStrength),s=function(t,e,n,r){var i=[],o=[],a={},u=0;for(u=0;u<t.length;u++){var s=t[u];a[s.id]=u,i.push(s.x),i.push(s.y),i.push(0),i.push(0),o.push([])}for(u=0;u<e.length;u++){var c=e[u],f=d(c,"source"),l=d(c,"target");o[a[f]].push(a[l]),o[a[f]].push(n(c)),o[a[f]].push(r(c)),o[a[f]].push(0),o[a[l]].push(a[f]),o[a[l]].push(n(c)),o[a[l]].push(r(c)),o[a[l]].push(0)}var h=0;for(u=0;u<t.length;u++){var p=i.length,v=o[u],g=v.length;i[4*u+2]=p+1048576*g/4,i[4*u+3]=0,h=Math.max(h,g/4);for(var y=0;y<g;++y){var m=v[y];i.push(+m)}}for(;i.length%4!=0;)i.push(0);return{maxEdgePerVetex:h,array:new Float32Array(i)}}(r,i,n.linkDistance,n.edgeStrength),c=s.maxEdgePerVetex,f=s.array,n.degrees=h(r.length,n.nodeIdxMap,i).map((function(t){return t.all})),l=[],p=[],v=[],g=[],y=[],m=[],b=[],n.getMass||(n.getMass=function(t){return n.degrees[n.nodeIdxMap[t.id]]||1}),_=n.gravity,x=n.center,r.forEach((function(t,e){l.push(n.getMass(t)),p.push(n.nodeStrength(t)),n.degrees[e]||(n.degrees[e]=0);var r=[x[0],x[1],_];if(n.getCenter){var i=n.getCenter(t,n.degrees[e]);i&&o(i[0])&&o(i[1])&&o(i[2])&&(r=i)}v.push(r[0]),g.push(r[1]),y.push(r[2]),o(t.fx)&&o(t.fy)?(m.push(t.fx||.001),b.push(t.fy||.001)):(m.push(0),b.push(0))})),w=d_([l,n.degrees,p,m]),E=d_([v,g,y,b]),S=n.workerEnabled,A=S?f_.create({canvas:t,engineOptions:{supportCompute:!0}}):f_.create({engineOptions:{supportCompute:!0}}),T=n.onLayoutEnd,I=[],f.forEach((function(t){I.push(t)})),N=0;N<4;N++)I.push(0);return O=A.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_damping : f32;\\n [[offset 4]] u_maxSpeed : f32;\\n [[offset 8]] u_minMovement : f32;\\n \\n [[offset 12]] u_coulombDisScale : f32;\\n [[offset 16]] u_factor : f32;\\n \\n \\n [[offset 20]] u_interval : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray1 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\ntype GWebGPUBuffer3 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray2 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 4, set 0]] var<storage_buffer> gWebGPUBuffer3 : GWebGPUBuffer3;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn unpack_float(packedValue : f32) -> vec2<i32> {var packedIntValue : i32 = i32(packedValue);\\nvar v0 : i32 = packedIntValue / 1048576;\\nreturn vec2<i32>(v0, packedIntValue - (v0 * 1048576));}\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar vx : f32 = currentNode.x - nextNode.x;\\nvar vy : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar n_dist : f32 = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar attributesi : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar attributesj : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nvar massi : f32 = attributesi.x;\\nvar nodeStrengthi : f32 = attributesi.z;\\nvar nodeStrengthj : f32 = attributesj.z;\\nvar nodeStrength : f32 = (nodeStrengthi + nodeStrengthj) / 2.0;\\nvar param : f32 = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax = ax + direx * param;\\nay = ay + direy * param;}}\\nreturn vec2<f32>(ax, ay);}\\nfn calcGravity(i : i32, currentNode : vec4<f32>, attributes2 : vec4<f32>) -> vec2<f32> {var vx : f32 = currentNode.x - attributes2.x;\\nvar vy : f32 = currentNode.y - attributes2.y;\\nvar ax : f32 = vx * attributes2.z;\\nvar ay : f32 = vy * attributes2.z;\\nreturn vec2<f32>(ax, ay);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>, attributes1 : vec4<f32>) -> vec2<f32> {var mass : f32 = attributes1.x;\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nvar compressed : vec2<i32> = unpack_float(currentNode.z);\\nvar length : i32 = compressed.x;\\nvar arr_offset : i32 = compressed.y;\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + (4 * p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = node_buffer.x;\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar vx : f32 = nextNode.x - currentNode.x;\\nvar vy : f32 = nextNode.y - currentNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar edgeLength : f32 = node_buffer.y;\\nvar edgeStrength : f32 = node_buffer.z;\\nvar diff : f32 = edgeLength - dist;\\nvar param : f32 = (diff * edgeStrength) / mass;\\nax = ax - direx * param;\\nay = ay - direy * param;}\\nreturn vec2<f32>(ax, ay);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar movement : vec4<f32> = gWebGPUBuffer1.u_AveMovement[0];\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nif ((i >= __DefineValuePlaceholder__VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes1 : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar nodeAttributes2 : vec4<f32> = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\nax = ax + repulsive.x;\\nay = ay + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode, nodeAttributes1);\\nax = ax + attractive.x;\\nay = ay + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(i, currentNode, nodeAttributes2);\\nax = ax - gravity.x;\\nay = ay - gravity.y;\\nvar param : f32 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nvar vx : f32 = ax * param;\\nvar vy : f32 = ay * param;\\nvar vlength : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {var param2 : f32 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nvar distx : f32 = vx * gWebGPUUniformParams.u_interval;\\nvar disty : f32 = vy * gWebGPUUniformParams.u_interval;\\nvar distLength : f32 = std::sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_damping;\\n float u_maxSpeed;\\n float u_minMovement;\\n \\n float u_coulombDisScale;\\n float u_factor;\\n \\n \\n float u_interval;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_NodeAttributeArray1[];\\n} gWebGPUBuffer2;\\n\\nlayout(std430, set = 0, binding = 4) buffer readonly GWebGPUBuffer3 {\\n vec4 u_NodeAttributeArray2[];\\n} gWebGPUBuffer3;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nivec2 unpack_float(float packedValue) {int packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {float ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 attributesj = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {float vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {float mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nvec4 movement = gWebGPUBuffer1.u_AveMovement[0];\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes1 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 nodeAttributes2 = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {float param2 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * gWebGPUUniformParams.u_interval;\\nfloat disty = vy * gWebGPUUniformParams.u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {gl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([u,1,1]).setBinding({u_Data:f,u_damping:n.damping,u_maxSpeed:n.maxSpeed,u_minMovement:n.minMovement,u_coulombDisScale:n.coulombDisScale,u_factor:n.factor,u_NodeAttributeArray1:w,u_NodeAttributeArray2:E,MAX_EDGE_PER_VERTEX:c,VERTEX_COUNT:u,u_AveMovement:I,u_interval:n.interval}),C=A.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_iter : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var movement : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nmovement = movement + vertex.w;}\\nmovement = movement / f32(__DefineValuePlaceholder__VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4<f32>(movement, 0.0, 0.0, 0.0);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_iter;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {float movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = gWebGPUBuffer0.u_Data[j];\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([1,1,1]).setBinding({u_Data:f,VERTEX_COUNT:u,u_AveMovement:[0,0,0,0]}),k=function(){return m_(D,void 0,void 0,(function(){var i,o,u;return b_(this,(function(s){switch(s.label){case 0:i=0,s.label=1;case 1:return i<a?[4,O.execute()]:[3,5];case 2:return s.sent(),C.setBinding({u_Data:O}),[4,C.execute()];case 3:s.sent(),o=Math.max(.02,n.interval-.002*i),O.setBinding({u_interval:o,u_AveMovement:C}),s.label=4;case 4:return i++,[3,1];case 5:return[4,O.getOutput()];case 6:return u=s.sent(),t?e.postMessage({type:Gt,vertexEdgeData:u}):r.forEach((function(t,e){var n=u[4*e],r=u[4*e+1];t.x=n,t.y=r})),T&&T(),[2]}}))}))},[4,k()];case 1:return M.sent(),[2]}}))}))},e.prototype.getType=function(){return"gForce-gpu"},e}(t),x_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),w_=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.maxIteration=100,n.gravity=10,n.comboGravity=10,n.linkDistance=10,n.alpha=1,n.alphaMin=.001,n.alphaDecay=1-Math.pow(n.alphaMin,1/300),n.alphaTarget=0,n.velocityDecay=.6,n.edgeStrength=.6,n.nodeStrength=30,n.preventOverlap=!1,n.preventNodeOverlap=!1,n.preventComboOverlap=!1,n.collideStrength=void 0,n.nodeCollideStrength=.5,n.comboCollideStrength=.5,n.comboSpacing=20,n.comboPadding=10,n.optimizeRangeFactor=1,n.onTick=function(){},n.onLayoutEnd=function(){},n.depthAttractiveForceScale=1,n.depthRepulsiveForceScale=2,n.nodes=[],n.edges=[],n.combos=[],n.comboTrees=[],n.width=300,n.height=300,n.bias=[],n.nodeMap={},n.oriComboMap={},n.indexMap={},n.comboMap={},n.previousLayouted=!1,n.updateCfg(e),n}return x_(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:100,center:[0,0],gravity:10,speed:1,comboGravity:30,preventOverlap:!1,preventComboOverlap:!0,preventNodeOverlap:!0,nodeSpacing:void 0,collideStrength:void 0,nodeCollideStrength:.5,comboCollideStrength:.5,comboSpacing:20,comboPadding:10,edgeStrength:.6,nodeStrength:30,linkDistance:10}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.center;if(t.comboTree={id:"comboTreeRoot",depth:-1,children:t.comboTrees},e&&0!==e.length){if(1===e.length)return e[0].x=n[0],e[0].y=n[1],void(t.onLayoutEnd&&t.onLayoutEnd());t.initVals(),t.run(),t.onLayoutEnd&&t.onLayoutEnd()}else t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){var t=this,e=t.nodes,n=t.previousLayouted?t.maxIteration/5:t.maxIteration;t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight);var r=t.center,i=t.velocityDecay,a=t.comboMap;t.previousLayouted||t.initPos(a);for(var u=function(n){var r=[];e.forEach((function(t,e){r[e]={x:0,y:0}})),t.applyCalculate(r),t.applyComboCenterForce(r),e.forEach((function(t,e){o(t.x)&&o(t.y)&&(t.x+=r[e].x*i,t.y+=r[e].y*i)})),t.alpha+=(t.alphaTarget-t.alpha)*t.alphaDecay,t.onTick()},s=0;s<n;s++)u();var c=[0,0];e.forEach((function(t){o(t.x)&&o(t.y)&&(c[0]+=t.x,c[1]+=t.y)})),c[0]/=e.length,c[1]/=e.length;var f=[r[0]-c[0],r[1]-c[1]];e.forEach((function(t,e){o(t.x)&&o(t.y)&&(t.x+=f[0],t.y+=f[1])})),t.combos.forEach((function(t){var e=a[t.id];e&&e.empty&&(t.x=e.cx||t.x,t.y=e.cy||t.y)})),t.previousLayouted=!0},e.prototype.initVals=function(){var t=this,e=t.edges,n=t.nodes,r=t.combos,a={},u={},s={};n.forEach((function(t,e){u[t.id]=t,s[t.id]=e})),t.nodeMap=u,t.indexMap=s;var c={};r.forEach((function(t){c[t.id]=t})),t.oriComboMap=c,t.comboMap=t.getComboMap();var l=t.preventOverlap;t.preventComboOverlap=t.preventComboOverlap||l,t.preventNodeOverlap=t.preventNodeOverlap||l;var h=t.collideStrength;h&&(t.comboCollideStrength=h,t.nodeCollideStrength=h),t.comboCollideStrength=t.comboCollideStrength?t.comboCollideStrength:0,t.nodeCollideStrength=t.nodeCollideStrength?t.nodeCollideStrength:0;for(var p=0;p<e.length;++p){var v=d(e[p],"source"),g=d(e[p],"target");a[v]?a[v]++:a[v]=1,a[g]?a[g]++:a[g]=1}var y=[];for(p=0;p<e.length;++p)v=d(e[p],"source"),g=d(e[p],"target"),y[p]=a[v]/(a[v]+a[g]);this.bias=y;var m,b,_=t.nodeSize,w=t.nodeSpacing;if(b=o(w)?function(){return w}:x(w)?w:function(){return 0},this.nodeSpacing=b,_)if(x(_))m=function(t){return _(t)};else if(i(_)){var E=(_[0]>_[1]?_[0]:_[1])/2;m=function(t){return E}}else{var S=_/2;m=function(t){return S}}else m=function(t){return t.size?i(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2:f(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2:t.size/2:10};this.nodeSize=m;var A,T=t.comboSpacing;A=o(T)?function(){return T}:x(T)?T:function(){return 0},this.comboSpacing=A;var I,N=t.comboPadding;I=o(N)?function(){return N}:i(N)?function(){return Math.max.apply(null,N)}:x(N)?N:function(){return 0},this.comboPadding=I;var O,C=this.linkDistance;C||(C=10),O=o(C)?function(t){return C}:C,this.linkDistance=O;var k,D=this.edgeStrength;D||(D=1),k=o(D)?function(t){return D}:D,this.edgeStrength=k;var M,R=this.nodeStrength;R||(R=30),M=o(R)?function(t){return R}:R,this.nodeStrength=M},e.prototype.initPos=function(t){this.nodes.forEach((function(e,n){var r=e.comboId,i=t[r];r&&i?(e.x=i.cx+100/(n+1),e.y=i.cy+100/(n+1)):(e.x=100/(n+1),e.y=100/(n+1))}))},e.prototype.getComboMap=function(){var t=this,e=t.nodeMap,n=t.comboTrees,r=t.oriComboMap,i={};return(n||[]).forEach((function(n){var a=[];y(n,(function(n){if("node"===n.itemType)return!0;if(!r[n.id])return!0;if(void 0===i[n.id]){var u={id:n.id,name:n.id,cx:0,cy:0,count:0,depth:t.oriComboMap[n.id].depth||0,children:[]};i[n.id]=u}var s=n.children;s&&s.forEach((function(t){if(!i[t.id]&&!e[t.id])return!0;a.push(t)}));var c=i[n.id];if(c.cx=0,c.cy=0,0===a.length){c.empty=!0;var f=r[n.id];c.cx=f.x,c.cy=f.y}return a.forEach((function(t){if(c.count++,"node"!==t.itemType){var n=i[t.id];return o(n.cx)&&(c.cx+=n.cx),void(o(n.cy)&&(c.cy+=n.cy))}var r=e[t.id];r&&(o(r.x)&&(c.cx+=r.x),o(r.y)&&(c.cy+=r.y))})),c.cx/=c.count||1,c.cy/=c.count||1,c.children=a,!0}))})),i},e.prototype.applyComboCenterForce=function(t){var e=this,n=e.gravity,r=e.comboGravity||n,i=this.alpha,a=e.comboTrees,u=e.indexMap,s=e.nodeMap,c=e.comboMap;(a||[]).forEach((function(e){y(e,(function(e){if("node"===e.itemType)return!0;if(!c[e.id])return!0;var n=c[e.id],a=(n.depth+1)/10*.5,f=n.cx,l=n.cy;return n.cx=0,n.cy=0,n.children.forEach((function(e){if("node"!==e.itemType){var d=c[e.id];return d&&o(d.cx)&&(n.cx+=d.cx),void(d&&o(d.cy)&&(n.cy+=d.cy))}var h=s[e.id],p=h.x-f||.005,v=h.y-l||.005,g=Math.sqrt(p*p+v*v),y=u[h.id],m=r*i/g*a;t[y].x-=p*m,t[y].y-=v*m,o(h.x)&&(n.cx+=h.x),o(h.y)&&(n.cy+=h.y)})),n.cx/=n.count||1,n.cy/=n.count||1,!0}))}))},e.prototype.applyCalculate=function(t){var e=this,n=e.comboMap,r=e.nodes,i={};r.forEach((function(t,e){r.forEach((function(n,r){if(!(e<r)){var o=t.x-n.x||.005,a=t.y-n.y||.005,u=o*o+a*a,s=Math.sqrt(u);u<1&&(u=s),i["".concat(t.id,"-").concat(n.id)]={vx:o,vy:a,vl2:u,vl:s},i["".concat(n.id,"-").concat(t.id)]={vl2:u,vl:s,vx:-o,vy:-a}}}))})),e.updateComboSizes(n),e.calRepulsive(t,i),e.calAttractive(t,i),e.preventComboOverlap&&e.comboNonOverlapping(t,n)},e.prototype.updateComboSizes=function(t){var e=this,n=e.comboTrees,r=e.nodeMap,o=e.nodeSize,a=e.comboSpacing,u=e.comboPadding;(n||[]).forEach((function(n){var s=[];y(n,(function(n){if("node"===n.itemType)return!0;var c=t[n.id];if(!c)return!1;var f=n.children;f&&f.forEach((function(e){(t[e.id]||r[e.id])&&s.push(e)})),c.minX=1/0,c.minY=1/0,c.maxX=-1/0,c.maxY=-1/0,s.forEach((function(t){if("node"!==t.itemType)return!0;var e=r[t.id];if(!e)return!0;var n=o(e),i=e.x-n,a=e.y-n,u=e.x+n,s=e.y+n;c.minX>i&&(c.minX=i),c.minY>a&&(c.minY=a),c.maxX<u&&(c.maxX=u),c.maxY<s&&(c.maxY=s)}));var l=e.oriComboMap[n.id].size||10;i(l)&&(l=l[0]);var d=Math.max(c.maxX-c.minX,c.maxY-c.minY,l);return c.r=d/2+a(c)/2+u(c),!0}))}))},e.prototype.comboNonOverlapping=function(t,e){var n=this,r=n.comboTree,i=n.comboCollideStrength,o=n.indexMap,a=n.nodeMap;y(r,(function(n){if(!e[n.id]&&!a[n.id]&&"comboTreeRoot"!==n.id)return!1;var r=n.children;return r&&r.length>1&&r.forEach((function(n,u){if("node"===n.itemType)return!1;var s=e[n.id];s&&r.forEach((function(r,c){if(u<=c)return!1;if("node"===r.itemType)return!1;var f=e[r.id];if(!f)return!1;var l=s.cx-f.cx||.005,d=s.cy-f.cy||.005,h=l*l+d*d,p=s.r||1,v=f.r||1,g=p+v,y=v*v,m=p*p;if(h<g*g){var b=n.children;if(!b||0===b.length)return!1;var _=r.children;if(!_||0===_.length)return!1;var x=Math.sqrt(h),w=(g-x)/x*i,E=l*w,S=d*w,A=y/(m+y),T=1-A;b.forEach((function(e){if("node"!==e.itemType)return!1;if(a[e.id]){var n=o[e.id];_.forEach((function(e){if("node"!==e.itemType)return!1;if(!a[e.id])return!1;var r=o[e.id];t[n].x+=E*A,t[n].y+=S*A,t[r].x-=E*T,t[r].y-=S*T}))}}))}}))})),!0}))},e.prototype.calRepulsive=function(t,e){var n=this,r=n.nodes,i=n.width*n.optimizeRangeFactor,o=n.nodeStrength,a=n.alpha,u=n.nodeCollideStrength,s=n.preventNodeOverlap,c=n.nodeSize,f=n.nodeSpacing,l=n.depthRepulsiveForceScale,d=n.center;r.forEach((function(h,p){if(h.x&&h.y){if(d){var v=n.gravity,g=h.x-d[0]||.005,y=h.y-d[1]||.005,m=Math.sqrt(g*g+y*y);t[p].x-=g*v*a/m,t[p].y-=y*v*a/m}r.forEach((function(n,r){if(p!==r&&n.x&&n.y){var d=e["".concat(h.id,"-").concat(n.id)],v=d.vl2,g=d.vl;if(!(g>i)){var y=e["".concat(h.id,"-").concat(n.id)],m=y.vx,b=y.vy,_=Math.log(Math.abs(n.depth-h.depth)/10)+1||1;_=_<1?1:_,n.comboId!==h.comboId&&(_+=1);var x=_?Math.pow(l,_):1,w=o(n)*a/v*x;if(t[p].x+=m*w,t[p].y+=b*w,p<r&&s){var E=c(h)+f(h)||1,S=c(n)+f(n)||1,A=E+S;if(v<A*A){var T=(A-g)/g*u,I=S*S,N=I/(E*E+I),O=m*T,C=b*T;t[p].x+=O*N,t[p].y+=C*N,N=1-N,t[r].x-=O*N,t[r].y-=C*N}}}}}))}}))},e.prototype.calAttractive=function(t,e){var n=this,r=n.edges,i=n.linkDistance,a=n.alpha,u=n.edgeStrength,s=n.bias,c=n.depthAttractiveForceScale;r.forEach((function(r,f){var l=d(r,"source"),h=d(r,"target");if(l&&h&&l!==h){var p=n.indexMap[l],v=n.indexMap[h],g=n.nodeMap[l],y=n.nodeMap[h];if(g&&y){var m=g.depth===y.depth?0:Math.log(Math.abs(g.depth-y.depth)/10);g.comboId===y.comboId&&(m/=2);var b=m?Math.pow(c,m):1;if(g.comboId!==y.comboId&&1===b?b=c/2:g.comboId===y.comboId&&(b=2),o(y.x)&&o(g.x)&&o(y.y)&&o(g.y)){var _=e["".concat(h,"-").concat(l)],x=_.vl,w=_.vx,E=_.vy,S=(x-i(r))/x*a*u(r)*b,A=w*S,T=E*S,I=s[f];t[v].x-=A*I,t[v].y-=T*I,t[p].x+=A*(1-I),t[p].y+=T*(1-I)}}}}))},e.prototype.getType=function(){return"comboForce"},e}(t),E_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),S_=function(){return S_=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},S_.apply(this,arguments)},A_=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.nodes=[],n.edges=[],n.combos=[],n.comboEdges=[],n.comboPadding=10,n.comboTrees=[],n.updateCfg(e),n}return E_(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.center;if(e&&0!==e.length){if(1===e.length)return e[0].x=n[0],e[0].y=n[1],void(t.onLayoutEnd&&t.onLayoutEnd());t.initVals(),t.run(),t.onLayoutEnd&&t.onLayoutEnd()}else t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){var t,e=this,n=e.nodes,r=e.edges,i=e.combos,o=e.comboEdges,a=e.center,u={};n.forEach((function(t){u[t.id]=t}));var s={};i.forEach((function(t){s[t.id]=t}));var c=e.getInnerGraphs(u),f=[],l=[],d={},h=!0;this.comboTrees.forEach((function(t){var e=c[t.id],n=S_(S_({},t),{x:e.x||s[t.id].x,y:e.y||s[t.id].y,fx:e.fx||s[t.id].fx,fy:e.fy||s[t.id].fy,mass:e.mass||s[t.id].mass,size:e.size});l.push(n),isNaN(n.x)||0===n.x||isNaN(n.y)||0===n.y?(n.x=100*Math.random(),n.y=100*Math.random()):h=!1,f.push(t.id),y(t,(function(e){return e.id!==t.id&&(d[e.id]=t.id),!0}))})),n.forEach((function(t){if(!t.comboId||!s[t.comboId]){var e=S_({},t);l.push(e),isNaN(e.x)||0===e.x||isNaN(e.y)||0===e.y?(e.x=100*Math.random(),e.y=100*Math.random()):h=!1,f.push(t.id)}}));var p=[];if(r.concat(o).forEach((function(t){var e=d[t.source]||t.source,n=d[t.target]||t.target;e!==n&&f.includes(e)&&f.includes(n)&&p.push({source:e,target:n})})),null==l?void 0:l.length){if(1===l.length)l[0].x=a[0],l[0].y=a[1];else{var v={nodes:l,edges:p},g=this.outerLayout||new P({gravity:1,factor:2,linkDistance:function(t,e,n){var r,i,o=(((null===(r=e.size)||void 0===r?void 0:r[0])||30)+((null===(i=n.size)||void 0===i?void 0:i[0])||30))/2;return Math.min(1.5*o,700)}}),m=null===(t=g.getType)||void 0===t?void 0:t.call(g);g.updateCfg({center:a,kg:5,preventOverlap:!0,animate:!1}),h&&Lt[m]&&(l.length<100?new Lf:new C).layout(v),g.layout(v)}l.forEach((function(t){var e=c[t.id];if(e)e.visited=!0,e.x=t.x,e.y=t.y,e.nodes.forEach((function(e){e.x+=t.x,e.y+=t.y}));else{var n=u[t.id];n&&(n.x=t.x,n.y=t.y)}}))}for(var b=Object.keys(c),_=function(t){var e=b[t],n=c[e];if(!n)return"continue";n.nodes.forEach((function(t){n.visited||(t.x+=n.x||0,t.y+=n.y||0),u[t.id]&&(u[t.id].x=t.x,u[t.id].y=t.y)})),s[e]&&(s[e].x=n.x,s[e].y=n.y)},x=b.length-1;x>=0;x--)_(x);return{nodes:n,edges:r,combos:i,comboEdges:o}},e.prototype.getInnerGraphs=function(t){var e=this,n=e.comboTrees,r=e.nodeSize,a=e.edges,u=e.comboPadding,s=e.spacing,c={},f=this.innerLayout||new Pf({sortBy:"id"});return f.center=[0,0],f.preventOverlap=!0,f.nodeSpacing=s,(n||[]).forEach((function(e){y(e,(function(e){var n,s=(null==u?void 0:u(e))||10;if(i(s)&&(s=Math.max.apply(Math,s)),null===(n=e.children)||void 0===n?void 0:n.length){var l=e.children.map((function(e){if("combo"===e.itemType)return c[e.id];var n=t[e.id]||{};return S_(S_({},n),e)})),d=l.map((function(t){return t.id})),h={nodes:l,edges:a.filter((function(t){return d.includes(t.source)&&d.includes(t.target)}))},p=1/0;l.forEach((function(t){var e;t.size||(t.size=(null===(e=c[t.id])||void 0===e?void 0:e.size)||(null==r?void 0:r(t))||[30,30]),o(t.size)&&(t.size=[t.size,t.size]),p>t.size[0]&&(p=t.size[0]),p>t.size[1]&&(p=t.size[1])})),f.layout(h);var v=function(t){var e=1/0,n=1/0,r=-1/0,i=-1/0;return t.forEach((function(t){e>t.x&&(e=t.x),n>t.y&&(n=t.y),r<t.x&&(r=t.x),i<t.y&&(i=t.y)})),{minX:e,minY:n,maxX:r,maxY:i}}(l),g=v.minX,y=v.minY,m=v.maxX,b=v.maxY,_=Math.max(m-g,b-y,p)+2*s;c[e.id]={id:e.id,nodes:l,size:[_,_]}}else if("combo"===e.itemType){var x=s?[2*s,2*s]:[30,30];c[e.id]={id:e.id,nodes:[],size:x}}return!0}))})),c},e.prototype.initVals=function(){var t,e,n=this,r=n.nodeSize,a=n.spacing;if(e=o(a)?function(){return a}:x(a)?a:function(){return 0},this.spacing=e,r)if(x(r))t=function(t){var n=r(t),o=e(t);return i(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+o)/2:((n||10)+o)/2};else if(i(r)){var u=(r[0]>r[1]?r[0]:r[1])/2;t=function(t){return u+e(t)/2}}else{var s=r/2;t=function(t){return s+e(t)/2}}else t=function(t){var n=e(t);return t.size?i(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:f(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+n)/2:(t.size+n)/2:10+n/2};this.nodeSize=t;var c,l=n.comboPadding;c=o(l)?function(){return l}:i(l)?function(){return Math.max.apply(null,l)}:x(l)?l:function(){return 0},this.comboPadding=c},e.prototype.getType=function(){return"comboCombined"},e}(t),T_=function(){function t(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}return t.prototype.distanceTo=function(t){var e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)},t.prototype.setPos=function(t,e){this.rx=t,this.ry=e},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,r=Math.hypot(e,n);r=r<1e-4?1e-4:r;var i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r},t.prototype.in=function(t){return t.contains(this.rx,this.ry)},t.prototype.add=function(e){var n=this.mass+e.mass;return new t({rx:(this.rx*this.mass+e.rx*e.mass)/n,ry:(this.ry*this.mass+e.ry*e.mass)/n,mass:n,degree:this.degree+e.degree})},t}();const I_=T_;const N_=function(){function t(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return t.prototype.getLength=function(){return this.length},t.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},t.prototype.NW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.NE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.SW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t.prototype.SE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t}();var O_=function(){function t(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)}return t.prototype.insert=function(e){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e)):this.body=e},t.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))},t.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},t.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)))},t}();const C_=O_;var k_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),D_=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.kr=5,n.kg=1,n.mode="normal",n.preventOverlap=!1,n.dissuadeHubs=!1,n.barnesHut=void 0,n.maxIteration=0,n.ks=.1,n.ksmax=10,n.tao=.1,n.onLayoutEnd=function(){},n.prune=void 0,n.updateCfg(e),n}return k_(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.onLayoutEnd,r=t.prune,a=t.maxIteration;t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight);for(var u=[],s=e.length,c=0;c<s;c+=1){var l=e[c],d=10,h=10;o(l.size)&&(d=l.size,h=l.size),i(l.size)?(isNaN(l.size[0])||(d=l.size[0]),isNaN(l.size[1])||(h=l.size[1])):f(l.size)&&(d=l.size.width,h=l.size.height),t.getWidth&&!isNaN(t.getWidth(l))&&(h=t.getWidth(l)),t.getHeight&&!isNaN(t.getHeight(l))&&(d=t.getHeight(l));var p=Math.max(d,h);u.push(p)}void 0===t.barnesHut&&s>250&&(t.barnesHut=!0),void 0===t.prune&&s>100&&(t.prune=!0),0!==this.maxIteration||t.prune?0===this.maxIteration&&r&&(a=100,s<=200&&s>100?a=500:s>200&&(a=950),this.maxIteration=a):(a=250,s<=200&&s>100?a=1e3:s>200&&(a=1200),this.maxIteration=a),t.kr||(t.kr=50,s>100&&s<=500?t.kr=20:s>500&&(t.kr=1)),t.kg||(t.kg=20,s>100&&s<=500?t.kg=10:s>500&&(t.kg=1)),this.nodes=t.updateNodesByForces(u),n()},e.prototype.updateNodesByForces=function(t){for(var e=this,n=e.edges,r=e.maxIteration,i=e.nodes,o=n.filter((function(t){return d(t,"source")!==d(t,"target")})),a=i.length,u=o.length,s=[],c={},f={},l=[],h=0;h<a;h+=1)c[i[h].id]=h,s[h]=0,(void 0===i[h].x||isNaN(i[h].x))&&(i[h].x=1e3*Math.random()),(void 0===i[h].y||isNaN(i[h].y))&&(i[h].y=1e3*Math.random()),l.push({x:i[h].x,y:i[h].y});for(h=0;h<u;h+=1){for(var p=void 0,v=void 0,g=0,y=0,m=0;m<a;m+=1){var b=d(o[h],"source"),_=d(o[h],"target");i[m].id===b?(p=i[m],g=m):i[m].id===_&&(v=i[m],y=m),f[h]={sourceIdx:g,targetIdx:y}}p&&(s[c[p.id]]+=1),v&&(s[c[v.id]]+=1)}var x=r;if(i=this.iterate(x,c,f,u,s,t),e.prune){for(m=0;m<u;m+=1)s[f[m].sourceIdx]<=1?(i[f[m].sourceIdx].x=i[f[m].targetIdx].x,i[f[m].sourceIdx].y=i[f[m].targetIdx].y):s[f[m].targetIdx]<=1&&(i[f[m].targetIdx].x=i[f[m].sourceIdx].x,i[f[m].targetIdx].y=i[f[m].sourceIdx].y);e.prune=!1,e.barnesHut=!1,x=100,i=this.iterate(x,c,f,u,s,t)}return i},e.prototype.iterate=function(t,e,n,r,i,o){for(var a=this,u=a.nodes,s=a.kr,c=a.preventOverlap,f=a.barnesHut,l=u.length,d=0,h=t,p=[],v=[],g=[],y=0;y<l;y+=1)if(p[2*y]=0,p[2*y+1]=0,f){var m={id:y,rx:u[y].x,ry:u[y].y,mass:1,g:s,degree:i[y]};g[y]=new I_(m)}for(;h>0;){for(y=0;y<l;y+=1)v[2*y]=p[2*y],v[2*y+1]=p[2*y+1],p[2*y]=0,p[2*y+1]=0;p=this.getAttrForces(h,50,r,e,n,i,o,p),p=f&&(c&&h>50||!c)?this.getOptRepGraForces(p,g,i):this.getRepGraForces(h,50,p,100,o,i);var b=this.updatePos(p,v,d,i);u=b.nodes,d=b.sg,h--,a.tick&&a.tick()}return u},e.prototype.getAttrForces=function(t,e,n,r,i,o,a,u){for(var s=this,c=s.nodes,f=s.preventOverlap,l=s.dissuadeHubs,d=s.mode,h=s.prune,p=0;p<n;p+=1){var v=c[i[p].sourceIdx],g=i[p].sourceIdx,y=c[i[p].targetIdx],m=i[p].targetIdx;if(!h||!(o[g]<=1||o[m]<=1)){var b=[y.x-v.x,y.y-v.y],_=Math.hypot(b[0],b[1]);_=_<1e-4?1e-4:_,b[0]=b[0]/_,b[1]=b[1]/_,f&&t<e&&(_=_-a[g]-a[m]);var x=_,w=x;"linlog"===d&&(w=x=Math.log(1+_)),l&&(x=_/o[g],w=_/o[m]),f&&t<e&&_<=0?(x=0,w=0):f&&t<e&&_>0&&(x=_,w=_),u[2*r[v.id]]+=x*b[0],u[2*r[y.id]]-=w*b[0],u[2*r[v.id]+1]+=x*b[1],u[2*r[y.id]+1]-=w*b[1]}}return u},e.prototype.getRepGraForces=function(t,e,n,r,i,o){for(var a=this,u=a.nodes,s=a.preventOverlap,c=a.kr,f=a.kg,l=a.center,d=a.prune,h=u.length,p=0;p<h;p+=1){for(var v=p+1;v<h;v+=1)if(!d||!(o[p]<=1||o[v]<=1)){var g=[u[v].x-u[p].x,u[v].y-u[p].y],y=Math.hypot(g[0],g[1]);y=y<1e-4?1e-4:y,g[0]=g[0]/y,g[1]=g[1]/y,s&&t<e&&(y=y-i[p]-i[v]);var m=c*(o[p]+1)*(o[v]+1)/y;s&&t<e&&y<0?m=r*(o[p]+1)*(o[v]+1):s&&t<e&&0===y?m=0:s&&t<e&&y>0&&(m=c*(o[p]+1)*(o[v]+1)/y),n[2*p]-=m*g[0],n[2*v]+=m*g[0],n[2*p+1]-=m*g[1],n[2*v+1]+=m*g[1]}var b=[u[p].x-l[0],u[p].y-l[1]],_=Math.hypot(b[0],b[1]);b[0]=b[0]/_,b[1]=b[1]/_;var x=f*(o[p]+1);n[2*p]-=x*b[0],n[2*p+1]-=x*b[1]}return n},e.prototype.getOptRepGraForces=function(t,e,n){for(var r=this,i=r.nodes,o=r.kg,a=r.center,u=r.prune,s=i.length,c=9e10,f=-9e10,l=9e10,d=-9e10,h=0;h<s;h+=1)u&&n[h]<=1||(e[h].setPos(i[h].x,i[h].y),i[h].x>=f&&(f=i[h].x),i[h].x<=c&&(c=i[h].x),i[h].y>=d&&(d=i[h].y),i[h].y<=l&&(l=i[h].y));var p=Math.max(f-c,d-l),v=new N_({xmid:(f+c)/2,ymid:(d+l)/2,length:p,massCenter:a,mass:s}),g=new C_(v);for(h=0;h<s;h+=1)u&&n[h]<=1||e[h].in(v)&&g.insert(e[h]);for(h=0;h<s;h+=1)if(!(u&&n[h]<=1)){e[h].resetForce(),g.updateForce(e[h]),t[2*h]-=e[h].fx,t[2*h+1]-=e[h].fy;var y=[i[h].x-a[0],i[h].y-a[1]],m=Math.hypot(y[0],y[1]);m=m<1e-4?1e-4:m,y[0]=y[0]/m,y[1]=y[1]/m;var b=o*(n[h]+1);t[2*h]-=b*y[0],t[2*h+1]-=b*y[1]}return t},e.prototype.updatePos=function(t,e,n,r){for(var i=this,a=i.nodes,u=i.ks,s=i.tao,c=i.prune,f=i.ksmax,l=a.length,d=[],h=[],p=0,v=0,g=0;g<l;g+=1)if(!(c&&r[g]<=1)){var y=[t[2*g]-e[2*g],t[2*g+1]-e[2*g+1]],m=Math.hypot(y[0],y[1]),b=[t[2*g]+e[2*g],t[2*g+1]+e[2*g+1]],_=Math.hypot(b[0],b[1]);d[g]=m,h[g]=_/2,p+=(r[g]+1)*d[g],v+=(r[g]+1)*h[g]}var x=n;for(n=s*v/p,0!==x&&(n=n>1.5*x?1.5*x:n),g=0;g<l;g+=1)if(!(c&&r[g]<=1||o(a[g].fx)&&o(a[g].fy))){var w=u*n/(1+n*Math.sqrt(d[g])),E=Math.hypot(t[2*g],t[2*g+1]),S=f/(E=E<1e-4?1e-4:E),A=(w=w>S?S:w)*t[2*g],T=w*t[2*g+1];a[g].x+=A,a[g].y+=T}return{nodes:a,sg:n}},e}(t),M_=function(){return M_=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},M_.apply(this,arguments)},R_=function(){function t(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return t.prototype.init=function(e,n,r){this.cells=[],this.CELL_W=r.CELL_W||t.DEFAULT_CELL_W,this.CELL_H=r.CELL_H||t.DEFAULT_CELL_H,this.columnNum=Math.ceil(e/this.CELL_W),this.rowNum=Math.ceil(n/this.CELL_H),t.MIN_DIST=Math.pow(e,2)+Math.pow(n,2);for(var i=0;i<this.columnNum;i++){for(var o=[],a=0;a<this.rowNum;a++){var u={dx:i,dy:a,x:i*this.CELL_W,y:a*this.CELL_H,occupied:!1};o.push(u)}this.cells.push(o)}},t.prototype.findGridByNodeId=function(t){for(var e,n,r=0;r<this.columnNum;r++)for(var i=0;i<this.rowNum;i++)if(this.cells[r][i].node&&(null===(n=null===(e=this.cells[r][i])||void 0===e?void 0:e.node)||void 0===n?void 0:n.id)===t)return{column:r,row:i};return null},t.prototype.sqdist=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},t.prototype.occupyNearest=function(e){for(var n,r=t.MIN_DIST,i=null,o=0;o<this.columnNum;o++)for(var a=0;a<this.rowNum;a++)!this.cells[o][a].occupied&&(n=this.sqdist(e,this.cells[o][a]))<r&&(r=n,i=this.cells[o][a]);return i&&(i.occupied=!0),i},t.prototype.insertColumn=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++){this.cells[n+this.columnNum]=[];for(var r=0;r<this.rowNum;r++)this.cells[n+this.columnNum][r]={dx:n,dy:r,x:n*this.CELL_W,y:r*this.CELL_H,occupied:!1,node:null}}for(n=this.columnNum-1;n>t;n--)for(r=0;r<this.rowNum;r++)this.cells[n+e][r]=M_(M_({},this.cells[n][r]),{x:(n+e)*this.CELL_W,y:r*this.CELL_H}),this.cells[n][r]={x:n*this.CELL_W,y:r*this.CELL_H,occupied:!0,node:null};for(r=0;r<this.additionColumn.length;r++)this.additionColumn[r]>=t&&(this.additionColumn[r]+=e);for(n=0;n<e;n++)this.additionColumn.push(t+n+1);this.columnNum+=e}},t.prototype.insertRow=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++)for(var r=0;r<this.columnNum;r++)this.cells[r][n+this.rowNum]={dx:r,dy:n,x:r*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(r=0;r<this.columnNum;r++)for(n=this.rowNum-1;n>t;n--)this.cells[r][n+e]=M_(M_({},this.cells[r][n]),{dx:r,dy:n+e,x:r*this.CELL_W,y:(n+e)*this.CELL_H}),this.cells[r][n]={dx:r,dy:n,x:r*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(n=0;n<this.additionRow.length;n++)this.additionRow[n]>=t&&(this.additionRow[n]+=e);for(r=0;r<e;r++)this.additionRow.push(t+r+1);this.rowNum+=e}},t.prototype.getNodes=function(){for(var t=[],e=0;e<this.columnNum;e++)for(var n=0;n<this.rowNum;n++)this.cells[e][n].node&&t.push(this.cells[e][n]);return t},t.MIN_DIST=50,t.DEFAULT_CELL_W=80,t.DEFAULT_CELL_H=80,t}();const P_=R_;var G_=1e7,L_=1.5707963267948966,j_=new Map,F_=.8;function U_(t,e){var n=(j_.get(t.id)||[]).find((function(t){return t.source===e.id||t.target===e.id})),r=t.size[0]*t.size[1],i=e.size[0]*e.size[1],o=r>i?e:t,a=r>i?t:e,u=o.x-o.size[0]/2,s=o.y-o.size[1]/2,c=o.x+o.size[0]/2,f=o.y+o.size[1]/2,l=a.x-a.size[0]/2,d=a.y-a.size[1]/2,h=a.x+a.size[0]/2,p=a.y+a.size[1]/2,v=o.x,g=o.y,y=a.x,m=a.y,b=0,_=0;if(c>=l&&h>=u&&f>=d&&p>=s)0===(_=Math.sqrt(Math.pow(y-v,2)+Math.pow(m-g,2)))&&(_=1e-7),b=10/_*100+((c<h?c:h)-(u>l?u:l))*((f<p?f:p)-(s>d?s:d)),b*=G_;else{var x=!1,w=function(t,e,n){var r=t.x-t.size[0]/2,i=t.y-t.size[1]/2,o=t.x+t.size[0]/2,a=t.y+t.size[1]/2,u=e.x-e.size[0]/2,s=e.y-e.size[1]/2,c=e.x+e.size[0]/2,f=e.y+e.size[1]/2,l=t.x,d=t.y,h=e.x,p=e.y,v=h-l,g=Math.atan2(v,p-d),y=0,m=0,b=0,_=0;g>L_?(m=i-f,y=u-o,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),_=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):b=_=0<g&&g<=L_?(m=s-a)>(y=u-o)?parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2)):g<-L_?(m=i-f)>(y=-(c-r))?parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2)):(m=s-a)>(y=Math.abs(v)>(o-r)/2?r-c:v)?parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):parseFloat(y&&0!==g?(y/Math.sin(g)).toFixed(2):m.toFixed(2));var x=parseFloat(g.toFixed(2)),w=n;return n&&(w=1.1780972450961724<x&&x<1.9634954084936207),{distance:Math.abs(b<_?b:_),isHoriz:w}}(o,a,x);_=w.distance,x=w.isHoriz,_<=10?b+=0!==_?n?10+1e7/_:10+1e8/_:G_:(b+=_,n&&(b+=_*_))}return b}function B_(t){for(var e=0,n=0;n<t.length;n++){var r=t[n];(r.x<0||r.y<0||r.x>1200||r.y>800)&&(e+=1e12);for(var i=n+1;i<t.length;i++)e+=U_(r,t[i])}return e}function z_(t,e,n,r){var i=new Map;n.forEach((function(t,e){i.set(t.id,t)}));var o=r.filter((function(e){return e.source===t.id||e.target===t.id}))||[],a=[];o.forEach((function(e){var n=e.source===t.id?e.target:e.source,r=i.get(n);r&&a.push(r)}));for(var u=!0,s=0;s<a.length;s++){var c=a[s],f=180*Math.atan((t.y-c.y)/(c.x-t.y)),l=180*Math.atan((e.y-c.y)/(c.x-e.y)),d=f>70&&f<110,h=l>70&&l<110;if((f<30||f>150)&&!(l<30||l>150)||f*l<0){u=!1;break}if(d&&!h||f*l<0){u=!1;break}if((c.x-t.x)*(c.x-e.x)<0){u=!1;break}if((c.y-t.y)*(c.y-e.y)<0){u=!1;break}}return u}function V_(t,e){for(var n=!1,r=[10,-10,0,0],i=[0,0,10,-10],o=0;o<t.length;++o)for(var a=t[o],u=W_(a,t),s=0;s<r.length;s++)if(z_(a,{x:a.x+r[s],y:a.y+i[s]},t,e)){a.x+=r[s],a.y+=i[s];var c=W_(a,t),f=Math.random();c<u||f<F_&&f>.1?(u=c,n=!0):(a.x-=r[s],a.y-=i[s])}return F_>.1&&(F_*=.5),n?B_(t):0}function W_(t,e){var n=0;(t.x<0||t.y<0||t.x+t.size[0]+20>1200||t.y+t.size[1]+20>800)&&(n+=1e12);for(var r=0;r<e.length;++r)t.id!==e[r].id&&(n+=U_(t,e[r]));return n}var H_=function(){return H_=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},H_.apply(this,arguments)};function X_(t,e){var n=t.nodes,r=t.edges,i=e.width,o=e.height;if(!(null==n?void 0:n.length))return Promise.resolve();var a=[];n.forEach((function(t){if(r.filter((function(e){return e.source===t.id||e.target===t.id})).length>1){var e=H_({},t);delete e.size,a.push(e)}}));var u=[];r.forEach((function(t){var e=a.find((function(e){return e.id===t.source})),n=a.find((function(e){return e.id===t.target}));e&&n&&u.push(t)}));var s=new or({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}).layout({nodes:a,edges:u}).nodes;n.forEach((function(t){var e=(s||[]).find((function(e){return e.id===t.id}));t.x=(null==e?void 0:e.x)||i/2,t.y=(null==e?void 0:e.y)||o/2}));var c=JSON.parse(JSON.stringify(n)),f=JSON.parse(JSON.stringify(r)),l=At().nodes(c).force("link",Ct(f).id((function(t){return t.id})).distance((function(t){return u.find((function(e){return e.source===t.source&&e.target===t.target}))?30:20}))).force("charge",Tt()).force("center",It(i/2,o/2)).force("x",Rt(i/2)).force("y",Pt(o/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise((function(t){l.on("end",(function(){n.forEach((function(t){var e=c.find((function(e){return e.id===t.id}));e&&(t.x=e.x,t.y=e.y)}));var a=Math.min.apply(Math,n.map((function(t){return t.x}))),u=Math.max.apply(Math,n.map((function(t){return t.x}))),s=Math.min.apply(Math,n.map((function(t){return t.y}))),f=Math.max.apply(Math,n.map((function(t){return t.y}))),l=i/(u-a),d=o/(f-s);n.forEach((function(t){void 0!==t.x&&l<1&&(t.x=(t.x-a)*l),void 0!==t.y&&d<1&&(t.y=(t.y-s)*d)})),n.forEach((function(t){t.sizeTemp=t.size,t.size=[10,10]})),function(t,e){if(0===t.length)return{nodes:t,edges:e};t.forEach((function(t){var n=e.filter((function(e){return e.source===t.id||e.target===t.id}));j_.set(t,n)})),t.sort((function(t,e){var n,r;return(null===(n=j_.get(t.id))||void 0===n?void 0:n.length)-(null===(r=j_.get(e.id))||void 0===r?void 0:r.length)}));for(var n=B_(t),r=20,i=1,o=0,a=0;r>0&&!(++a>=50);){var u=V_(t,e);0!==u&&(o=u),i=o-n,n=o,0===i?--r:r=20}t.forEach((function(t){t.x=t.x-t.size[0]/2,t.y=t.y-t.size[1]/2}))}(n,r),n.forEach((function(t){t.size=t.sizeTemp||[],delete t.sizeTemp})),function(t,e){if(!t.nodes||0===t.nodes.length)return t;var n=e.width,r=e.height,i=e.nodeMinGap,o=1e4,a=1e4;t.nodes.forEach((function(t){var e=t.size[0]||50,n=t.size[1]||50;o=Math.min(e,o),a=Math.min(n,a)}));var u=new P_;u.init(n,r,{CELL_H:a,CELL_W:o}),t.nodes.forEach((function(t){var e=u.occupyNearest(t);e&&(e.node={id:t.id,size:t.size},t.x=e.x,t.y=e.y,t.dx=e.dx,t.dy=e.dy)}));for(var s=0;s<t.nodes.length;s++){var c=t.nodes[s],f=u.findGridByNodeId(c.id);if(!f)throw new Error("can not find node cell");var l=f.column,d=f.row;if(c.size[0]+i>o){for(var h=v=Math.ceil((c.size[0]+i)/o)-1,p=0;p<v&&u.additionColumn.indexOf(l+p+1)>-1&&!u.cells[l+p+1][d].node;p++)h--;u.insertColumn(l,h)}if(c.size[1]+i>a){var v;for(h=v=Math.ceil((c.size[1]+i)/a)-1,p=0;p<v&&u.additionRow.indexOf(d+p+1)>-1&&!u.cells[l][d+p+1].node;p++)h--;u.insertRow(d,h)}}for(s=0;s<u.columnNum;s++){var g=function(e){var n=u.cells[s][e];if(n.node){var r=t.nodes.find((function(t){var e;return t.id===(null===(e=null==n?void 0:n.node)||void 0===e?void 0:e.id)}));r&&(r.x=n.x+r.size[0]/2,r.y=n.y+r.size[1]/2)}};for(p=0;p<u.rowNum;p++)g(p)}}({nodes:n,edges:r},e),t()}))}));return d}var q_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Y_=function(t){function e(e){var n=t.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},e&&n.updateCfg(e),n}return q_(e,t),e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges;return null==e||e.forEach((function(t){t.size||(t.size=[50,50])})),X_({nodes:e,edges:n},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then((function(){t.onLayoutEnd&&t.onLayoutEnd()}))},e.prototype.getType=function(){return"er"},e}(t),K_=function(){function t(t){var e=N(t.type);this.layoutInstance=new e(t)}return t.prototype.layout=function(t){return this.layoutInstance.layout(t)},t.prototype.updateCfg=function(t){this.layoutInstance.updateCfg(t)},t.prototype.init=function(t){this.correctLayers(t.nodes),this.layoutInstance.init(t)},t.prototype.correctLayers=function(t){if(null==t?void 0:t.length){var n=1/0,r=[];if(t.forEach((function(t){e(t.layer)&&(t.layer=parseInt(t.layer,10)),void 0===t.layer||isNaN(t.layer)||(r.push(t),t.layer<n&&(n=t.layer))})),n<=0){var i=Math.abs(n)+1;r.forEach((function(t){return t.layer+=i}))}}},t.prototype.execute=function(){this.layoutInstance.execute()},t.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},t.prototype.destroy=function(){return this.layoutInstance.destroy()},t}(),Z_={force:Ft,fruchterman:Ff,forceAtlas2:D_,gForce:P,force2:Y,dagre:or,dagreCompound:ef,circular:Vt,radial:Mf,concentric:Pf,grid:C,mds:Lf,comboForce:w_,comboCombined:A_,random:D,"gForce-gpu":__,"fruchterman-gpu":g_,er:Y_}})(),r})()));
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.layout=e():t.layout=e()}(self,(()=>(()=>{var t={7294:()=>{},9586:()=>{},2697:()=>{},1894:()=>{},1186:()=>{},5275:()=>{},2862:()=>{},9633:()=>{},7222:()=>{},5965:()=>{},2391:()=>{},3945:()=>{},9216:(t,e,n)=>{"use strict";n(9504),n(3982),n(721),n(5778),n(3898),n(7536),n(5834),n(6945),n(547),n(5967),n(3515),n(3042),n(4962),n(5375)},8344:(t,e)=>{"use strict";var n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y,m,b,_,x,w,E,S,A,T;(e.UX||(e.UX={})).TextureCompressionBC="texture-compression-bc",(T=e.OB||(e.OB={})).ClampToEdge="clamp-to-edge",T.Repeat="repeat",T.MirrorRepeat="mirror-repeat",(A=e.$l||(e.$l={})).UniformBuffer="uniform-buffer",A.StorageBuffer="storage-buffer",A.ReadonlyStorageBuffer="readonly-storage-buffer",A.Sampler="sampler",A.ComparisonSampler="comparison-sampler",A.SampledTexture="sampled-texture",A.ReadonlyStorageTexture="readonly-storage-texture",A.WriteonlyStorageTexture="writeonly-storage-texture",(S=e.zi||(e.zi={})).Zero="zero",S.One="one",S.SrcColor="src-color",S.OneMinusSrcColor="one-minus-src-color",S.SrcAlpha="src-alpha",S.OneMinusSrcAlpha="one-minus-src-alpha",S.DstColor="dst-color",S.OneMinusDstColor="one-minus-dst-color",S.DstAlpha="dst-alpha",S.OneMinusDstAlpha="one-minus-dst-alpha",S.SrcAlphaSaturated="src-alpha-saturated",S.BlendColor="blend-color",S.OneMinusBlendColor="one-minus-blend-color",(E=e.db||(e.db={})).Add="add",E.Subtract="subtract",E.ReverseSubtract="reverse-subtract",E.Min="min",E.Max="max",(w=e.wb||(e.wb={})).Never="never",w.Less="less",w.Equal="equal",w.LessEqual="less-equal",w.Greater="greater",w.NotEqual="not-equal",w.GreaterEqual="greater-equal",w.Always="always",(x=e.Wf||(e.Wf={})).None="none",x.Front="front",x.Back="back",(_=e.X9||(e.X9={})).Nearest="nearest",_.Linear="linear",(b=e.zX||(e.zX={})).CCW="ccw",b.CW="cw",(m=e.iD||(e.iD={})).Uint16="uint16",m.Uint32="uint32",(y=e.V||(e.V={})).Vertex="vertex",y.Instance="instance",(e.Ws||(e.Ws={})).Load="load",(g=e.YV||(e.YV={})).PointList="point-list",g.LineList="line-list",g.LineStrip="line-strip",g.TriangleList="triangle-list",g.TriangleStrip="triangle-strip",(v=e.xS||(e.xS={})).Keep="keep",v.Zero="zero",v.Replace="replace",v.Invert="invert",v.IncrementClamp="increment-clamp",v.DecrementClamp="decrement-clamp",v.IncrementWrap="increment-wrap",v.DecrementWrap="decrement-wrap",(p=e.EG||(e.EG={})).Store="store",p.Clear="clear",(h=e.kd||(e.kd={})).E1d="1d",h.E2d="2d",h.E3d="3d",(d=e.EV||(e.EV={})).R8Unorm="r8unorm",d.R8Snorm="r8snorm",d.R8Uint="r8uint",d.R8Sint="r8sint",d.R16Uint="r16uint",d.R16Sint="r16sint",d.R16Float="r16float",d.RG8Unorm="rg8unorm",d.RG8Snorm="rg8snorm",d.RG8Uint="rg8uint",d.RG8Sint="rg8sint",d.R32Uint="r32uint",d.R32Sint="r32sint",d.R32Float="r32float",d.RG16Uint="rg16uint",d.RG16Sint="rg16sint",d.RG16Float="rg16float",d.RGBA8Unorm="rgba8unorm",d.RGBA8UnormSRGB="rgba8unorm-srgb",d.RGBA8Snorm="rgba8snorm",d.RGBA8Uint="rgba8uint",d.RGBA8Sint="rgba8sint",d.BGRA8Unorm="bgra8unorm",d.BGRA8UnormSRGB="bgra8unorm-srgb",d.RGB10A2Unorm="rgb10a2unorm",d.RG11B10Float="rg11b10float",d.RG32Uint="rg32uint",d.RG32Sint="rg32sint",d.RG32Float="rg32float",d.RGBA16Uint="rgba16uint",d.RGBA16Sint="rgba16sint",d.RGBA16Float="rgba16float",d.RGBA32Uint="rgba32uint",d.RGBA32Sint="rgba32sint",d.RGBA32Float="rgba32float",d.Depth32Float="depth32float",d.Depth24Plus="depth24plus",d.Depth24PlusStencil8="depth24plus-stencil8",(l=e.Ek||(e.Ek={})).Float="float",l.Sint="sint",l.Uint="uint",(f=e.p_||(e.p_={})).E1d="1d",f.E2d="2d",f.E2dArray="2d-array",f.Cube="cube",f.CubeArray="cube-array",f.E3d="3d",(c=e.gB||(e.gB={})).Uchar2="uchar2",c.Uchar4="uchar4",c.Char2="char2",c.Char4="char4",c.Uchar2Norm="uchar2norm",c.Uchar4Norm="uchar4norm",c.Char2Norm="char2norm",c.Char4Norm="char4norm",c.Ushort2="ushort2",c.Ushort4="ushort4",c.Short2="short2",c.Short4="short4",c.Ushort2Norm="ushort2norm",c.Ushort4Norm="ushort4norm",c.Short2Norm="short2norm",c.Short4Norm="short4norm",c.Half2="half2",c.Half4="half4",c.Float="float",c.Float2="float2",c.Float3="float3",c.Float4="float4",c.Uint="uint",c.Uint2="uint2",c.Uint3="uint3",c.Uint4="uint4",c.Int="int",c.Int2="int2",c.Int3="int3",c.Int4="int4",(s=e.H7||(e.H7={})).All="all",s.StencilOnly="stencil-only",s.DepthOnly="depth-only",(u=e.mj||(e.mj={})).Error="error",u.Warning="warning",u.Info="info",(e.xL||(e.xL={})).Occlusion="occlusion",(a=e.FB||(e.FB={}))[a.MapRead=1]="MapRead",a[a.MapWrite=2]="MapWrite",a[a.CopySrc=4]="CopySrc",a[a.CopyDst=8]="CopyDst",a[a.Index=16]="Index",a[a.Vertex=32]="Vertex",a[a.Uniform=64]="Uniform",a[a.Storage=128]="Storage",a[a.Indirect=256]="Indirect",a[a.QueryResolve=512]="QueryResolve",(o=e.Yw||(e.Yw={}))[o.Red=1]="Red",o[o.Green=2]="Green",o[o.Blue=4]="Blue",o[o.Alpha=8]="Alpha",o[o.All=15]="All",(i=e.$X||(e.$X={}))[i.Vertex=1]="Vertex",i[i.Fragment=2]="Fragment",i[i.Compute=4]="Compute",(r=e.v2||(e.v2={}))[r.CopySrc=1]="CopySrc",r[r.CopyDst=2]="CopyDst",r[r.Sampled=4]="Sampled",r[r.Storage=8]="Storage",r[r.OutputAttachment=16]="OutputAttachment",(n=e.gc||(e.gc={}))[n.Read=1]="Read",n[n.Write=2]="Write"},9504:(t,e,n)=>{n(2825),n(6051),n(2640),n(9518),n(8201),n(470),n(5723),n(7525),n(9788),n(1498),n(7577),n(6129),n(2802),n(7940),n(5261),n(9340),n(1584),n(7298),n(1765),n(5747),n(7451),n(2784),n(2809),n(7454),n(3053),n(8032),n(7551),n(2929),n(215),n(6183),n(8190),n(476),n(948),n(942),n(2870),n(2212),n(4230),n(9754),n(2811),n(3998),n(1769),n(8789),n(2848),n(1762),n(1323),n(6063),n(3282),n(6816),n(1854),n(3303),n(4421),n(2203),n(1028),n(6818),n(5557),n(7938),n(8316),n(7937),n(637),n(8219),n(9029),n(3157),n(9791),n(2296),n(4555),n(6505),n(4722),n(9713),n(7392),n(4687),n(3684),n(3339),n(4148),n(7754),n(4094),n(8781),n(5013),n(3735),n(8723),n(2247),n(9689),n(9003),n(9026),n(4088),n(535),n(5788),n(7878),n(5119),n(3135),n(5015),n(8059),n(646),n(5377),n(9879),n(5305),n(6341),n(5915),n(4488),n(9281),n(163),n(6668),n(7139),n(6408),n(8686),n(5480),n(9121),n(914),n(7742),n(7843),n(6441),n(429),n(2214),n(498),n(6349),n(3742),n(9604),n(2592),n(9290),n(9363),n(3871),n(8632),n(1838),n(3421),n(6144),n(8275),n(2552),n(3077),n(1031),n(8916),n(8978),n(8531),n(7323),n(3704),n(3153),n(8812),n(2636),n(1602),n(377),t.exports=n(2845)},721:(t,e,n)=>{n(7744),t.exports=n(2845).Array.flatMap},3982:(t,e,n)=>{n(5448),t.exports=n(2845).Array.includes},3515:(t,e,n)=>{n(8938),t.exports=n(2845).Object.entries},547:(t,e,n)=>{n(7819),t.exports=n(2845).Object.getOwnPropertyDescriptors},5967:(t,e,n)=>{n(6572),t.exports=n(2845).Object.values},3042:(t,e,n)=>{"use strict";n(7843),n(8228),t.exports=n(2845).Promise.finally},3898:(t,e,n)=>{n(3336),t.exports=n(2845).String.padEnd},5778:(t,e,n)=>{n(3718),t.exports=n(2845).String.padStart},5834:(t,e,n)=>{n(6642),t.exports=n(2845).String.trimRight},7536:(t,e,n)=>{n(7831),t.exports=n(2845).String.trimLeft},6945:(t,e,n)=>{n(9956),t.exports=n(7686).f("asyncIterator")},2680:(t,e,n)=>{n(8358),t.exports=n(3142).global},3749:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},8891:(t,e,n)=>{var r=n(2799);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},3142:t=>{var e=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},5526:(t,e,n)=>{var r=n(3749);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},7498:(t,e,n)=>{t.exports=!n(9880)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},2004:(t,e,n)=>{var r=n(2799),i=n(5505).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},2069:(t,e,n)=>{var r=n(5505),i=n(3142),o=n(5526),a=n(5954),u=n(9761),s=function(t,e,n){var c,f,l,d=t&s.F,h=t&s.G,p=t&s.S,v=t&s.P,g=t&s.B,y=t&s.W,m=h?i:i[e]||(i[e]={}),b=m.prototype,_=h?r:p?r[e]:(r[e]||{}).prototype;for(c in h&&(n=e),n)(f=!d&&_&&void 0!==_[c])&&u(m,c)||(l=f?_[c]:n[c],m[c]=h&&"function"!=typeof _[c]?n[c]:g&&f?o(l,r):y&&_[c]==l?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):v&&"function"==typeof l?o(Function.call,l):l,v&&((m.virtual||(m.virtual={}))[c]=l,t&s.R&&b&&!b[c]&&a(b,c,l)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},9880:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},5505:t=>{var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},9761:t=>{var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},5954:(t,e,n)=>{var r=n(5584),i=n(5734);t.exports=n(7498)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},4053:(t,e,n)=>{t.exports=!n(7498)&&!n(9880)((function(){return 7!=Object.defineProperty(n(2004)("div"),"a",{get:function(){return 7}}).a}))},2799:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},5584:(t,e,n)=>{var r=n(8891),i=n(4053),o=n(923),a=Object.defineProperty;e.f=n(7498)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},5734:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},923:(t,e,n)=>{var r=n(2799);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},8358:(t,e,n)=>{var r=n(2069);r(r.G,{global:n(5505)})},1464:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},8347:(t,e,n)=>{var r=n(1669);t.exports=function(t,e){if("number"!=typeof t&&"Number"!=r(t))throw TypeError(e);return+t}},4691:(t,e,n)=>{var r=n(341)("unscopables"),i=Array.prototype;null==i[r]&&n(913)(i,r,{}),t.exports=function(t){i[r][t]=!0}},178:(t,e,n)=>{"use strict";var r=n(8016)(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},6903:t=>{t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},486:(t,e,n)=>{var r=n(1255);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},1064:(t,e,n)=>{"use strict";var r=n(7583),i=n(9260),o=n(8087);t.exports=[].copyWithin||function(t,e){var n=r(this),a=o(n.length),u=i(t,a),s=i(e,a),c=arguments.length>2?arguments[2]:void 0,f=Math.min((void 0===c?a:i(c,a))-s,a-u),l=1;for(s<u&&u<s+f&&(l=-1,s+=f-1,u+=f-1);f-- >0;)s in n?n[u]=n[s]:delete n[u],u+=l,s+=l;return n}},8676:(t,e,n)=>{"use strict";var r=n(7583),i=n(9260),o=n(8087);t.exports=function(t){for(var e=r(this),n=o(e.length),a=arguments.length,u=i(a>1?arguments[1]:void 0,n),s=a>2?arguments[2]:void 0,c=void 0===s?n:i(s,n);c>u;)e[u++]=t;return e}},4538:(t,e,n)=>{var r=n(8182),i=n(8087),o=n(9260);t.exports=function(t){return function(e,n,a){var u,s=r(e),c=i(s.length),f=o(a,c);if(t&&n!=n){for(;c>f;)if((u=s[f++])!=u)return!0}else for(;c>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}}},7622:(t,e,n)=>{var r=n(994),i=n(8579),o=n(7583),a=n(8087),u=n(6699);t.exports=function(t,e){var n=1==t,s=2==t,c=3==t,f=4==t,l=6==t,d=5==t||l,h=e||u;return function(e,u,p){for(var v,g,y=o(e),m=i(y),b=r(u,p,3),_=a(m.length),x=0,w=n?h(e,_):s?h(e,0):void 0;_>x;x++)if((d||x in m)&&(g=b(v=m[x],x,y),t))if(n)w[x]=g;else if(g)switch(t){case 3:return!0;case 5:return v;case 6:return x;case 2:w.push(v)}else if(f)return!1;return l?-1:c||f?f:w}}},5336:(t,e,n)=>{var r=n(1464),i=n(7583),o=n(8579),a=n(8087);t.exports=function(t,e,n,u,s){r(e);var c=i(t),f=o(c),l=a(c.length),d=s?l-1:0,h=s?-1:1;if(n<2)for(;;){if(d in f){u=f[d],d+=h;break}if(d+=h,s?d<0:l<=d)throw TypeError("Reduce of empty array with no initial value")}for(;s?d>=0:l>d;d+=h)d in f&&(u=e(u,f[d],d,c));return u}},7600:(t,e,n)=>{var r=n(1255),i=n(7183),o=n(341)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},6699:(t,e,n)=>{var r=n(7600);t.exports=function(t,e){return new(r(t))(e)}},8366:(t,e,n)=>{"use strict";var r=n(1464),i=n(1255),o=n(8262),a=[].slice,u={},s=function(t,e,n){if(!(e in u)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";u[e]=Function("F,a","return new F("+r.join(",")+")")}return u[e](t,n)};t.exports=Function.bind||function(t){var e=r(this),n=a.call(arguments,1),u=function(){var r=n.concat(a.call(arguments));return this instanceof u?s(e,r.length,r):o(e,r,t)};return i(e.prototype)&&(u.prototype=e.prototype),u}},4939:(t,e,n)=>{var r=n(1669),i=n(341)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},1669:t=>{var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},3050:(t,e,n)=>{"use strict";var r=n(3886).f,i=n(9055),o=n(8565),a=n(994),u=n(6903),s=n(9822),c=n(966),f=n(8782),l=n(4412),d=n(1216),h=n(4278).fastKey,p=n(4664),v=d?"_s":"size",g=function(t,e){var n,r=h(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,c){var f=t((function(t,r){u(t,f,e,"_i"),t._t=e,t._i=i(null),t._f=void 0,t._l=void 0,t[v]=0,null!=r&&s(r,n,t[c],t)}));return o(f.prototype,{clear:function(){for(var t=p(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[v]=0},delete:function(t){var n=p(this,e),r=g(n,t);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[v]--}return!!r},forEach:function(t){p(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!g(p(this,e),t)}}),d&&r(f.prototype,"size",{get:function(){return p(this,e)[v]}}),f},def:function(t,e,n){var r,i,o=g(t,e);return o?o.v=n:(t._l=o={i:i=h(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=o),r&&(r.n=o),t[v]++,"F"!==i&&(t._i[i]=o)),t},getEntry:g,setStrong:function(t,e,n){c(t,e,(function(t,n){this._t=p(t,e),this._k=n,this._l=void 0}),(function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?f(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,f(1))}),n?"entries":"values",!n,!0),l(e)}}},1990:(t,e,n)=>{"use strict";var r=n(8565),i=n(4278).getWeak,o=n(486),a=n(1255),u=n(6903),s=n(9822),c=n(7622),f=n(7384),l=n(4664),d=c(5),h=c(6),p=0,v=function(t){return t._l||(t._l=new g)},g=function(){this.a=[]},y=function(t,e){return d(t.a,(function(t){return t[0]===e}))};g.prototype={get:function(t){var e=y(this,t);if(e)return e[1]},has:function(t){return!!y(this,t)},set:function(t,e){var n=y(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(t){var e=h(this.a,(function(e){return e[0]===t}));return~e&&this.a.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,n,o){var c=t((function(t,r){u(t,c,e,"_i"),t._t=e,t._i=p++,t._l=void 0,null!=r&&s(r,n,t[o],t)}));return r(c.prototype,{delete:function(t){if(!a(t))return!1;var n=i(t);return!0===n?v(l(this,e)).delete(t):n&&f(n,this._i)&&delete n[this._i]},has:function(t){if(!a(t))return!1;var n=i(t);return!0===n?v(l(this,e)).has(t):n&&f(n,this._i)}}),c},def:function(t,e,n){var r=i(o(e),!0);return!0===r?v(t).set(e,n):r[t._i]=n,t},ufstore:v}},859:(t,e,n)=>{"use strict";var r=n(7571),i=n(7044),o=n(6476),a=n(8565),u=n(4278),s=n(9822),c=n(6903),f=n(1255),l=n(5338),d=n(2803),h=n(5837),p=n(116);t.exports=function(t,e,n,v,g,y){var m=r[t],b=m,_=g?"set":"add",x=b&&b.prototype,w={},E=function(t){var e=x[t];o(x,t,"delete"==t||"has"==t?function(t){return!(y&&!f(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return y&&!f(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof b&&(y||x.forEach&&!l((function(){(new b).entries().next()})))){var S=new b,A=S[_](y?{}:-0,1)!=S,T=l((function(){S.has(1)})),I=d((function(t){new b(t)})),N=!y&&l((function(){for(var t=new b,e=5;e--;)t[_](e,e);return!t.has(-0)}));I||((b=e((function(e,n){c(e,b,t);var r=p(new m,e,b);return null!=n&&s(n,g,r[_],r),r}))).prototype=x,x.constructor=b),(T||N)&&(E("delete"),E("has"),g&&E("get")),(N||A)&&E(_),y&&x.clear&&delete x.clear}else b=v.getConstructor(e,t,g,_),a(b.prototype,n),u.NEED=!0;return h(b,t),w[t]=b,i(i.G+i.W+i.F*(b!=m),w),y||v.setStrong(b,t,g),b}},2845:t=>{var e=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},1395:(t,e,n)=>{"use strict";var r=n(3886),i=n(8328);t.exports=function(t,e,n){e in t?r.f(t,e,i(0,n)):t[e]=n}},994:(t,e,n)=>{var r=n(1464);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},4506:(t,e,n)=>{"use strict";var r=n(5338),i=Date.prototype.getTime,o=Date.prototype.toISOString,a=function(t){return t>9?t:"0"+t};t.exports=r((function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-50000000000001))}))||!r((function(){o.call(new Date(NaN))}))?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:o},9514:(t,e,n)=>{"use strict";var r=n(486),i=n(4467),o="number";t.exports=function(t){if("string"!==t&&t!==o&&"default"!==t)throw TypeError("Incorrect hint");return i(r(this),t!=o)}},5091:t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},1216:(t,e,n)=>{t.exports=!n(5338)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},3438:(t,e,n)=>{var r=n(1255),i=n(7571).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},9824:t=>{t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},6397:(t,e,n)=>{var r=n(9804),i=n(3844),o=n(4179);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,u=n(t),s=o.f,c=0;u.length>c;)s.call(t,a=u[c++])&&e.push(a);return e}},7044:(t,e,n)=>{var r=n(7571),i=n(2845),o=n(913),a=n(6476),u=n(994),s=function(t,e,n){var c,f,l,d,h=t&s.F,p=t&s.G,v=t&s.S,g=t&s.P,y=t&s.B,m=p?r:v?r[e]||(r[e]={}):(r[e]||{}).prototype,b=p?i:i[e]||(i[e]={}),_=b.prototype||(b.prototype={});for(c in p&&(n=e),n)l=((f=!h&&m&&void 0!==m[c])?m:n)[c],d=y&&f?u(l,r):g&&"function"==typeof l?u(Function.call,l):l,m&&a(m,c,l,t&s.U),b[c]!=l&&o(b,c,d),g&&_[c]!=l&&(_[c]=l)};r.core=i,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},2910:(t,e,n)=>{var r=n(341)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},5338:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},6719:(t,e,n)=>{"use strict";n(7139);var r=n(6476),i=n(913),o=n(5338),a=n(5091),u=n(341),s=n(9020),c=u("species"),f=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),l=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var d=u(t),h=!o((function(){var e={};return e[d]=function(){return 7},7!=""[t](e)})),p=h?!o((function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[c]=function(){return n}),n[d](""),!e})):void 0;if(!h||!p||"replace"===t&&!f||"split"===t&&!l){var v=/./[d],g=n(a,d,""[t],(function(t,e,n,r,i){return e.exec===s?h&&!i?{done:!0,value:v.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}})),y=g[0],m=g[1];r(String.prototype,t,y),i(RegExp.prototype,d,2==e?function(t,e){return m.call(t,this,e)}:function(t){return m.call(t,this)})}}},3649:(t,e,n)=>{"use strict";var r=n(486);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},6806:(t,e,n)=>{"use strict";var r=n(7183),i=n(1255),o=n(8087),a=n(994),u=n(341)("isConcatSpreadable");t.exports=function t(e,n,s,c,f,l,d,h){for(var p,v,g=f,y=0,m=!!d&&a(d,h,3);y<c;){if(y in s){if(p=m?m(s[y],y,n):s[y],v=!1,i(p)&&(v=void 0!==(v=p[u])?!!v:r(p)),v&&l>0)g=t(e,n,p,o(p.length),g,l-1)-1;else{if(g>=9007199254740991)throw TypeError();e[g]=p}g++}y++}return g}},9822:(t,e,n)=>{var r=n(994),i=n(4902),o=n(9981),a=n(486),u=n(8087),s=n(9685),c={},f={},l=t.exports=function(t,e,n,l,d){var h,p,v,g,y=d?function(){return t}:s(t),m=r(n,l,e?2:1),b=0;if("function"!=typeof y)throw TypeError(t+" is not iterable!");if(o(y)){for(h=u(t.length);h>b;b++)if((g=e?m(a(p=t[b])[0],p[1]):m(t[b]))===c||g===f)return g}else for(v=y.call(t);!(p=v.next()).done;)if((g=i(v,m,p.value,e))===c||g===f)return g};l.BREAK=c,l.RETURN=f},8454:(t,e,n)=>{t.exports=n(5570)("native-function-to-string",Function.toString)},7571:t=>{var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},7384:t=>{var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},913:(t,e,n)=>{var r=n(3886),i=n(8328);t.exports=n(1216)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},7680:(t,e,n)=>{var r=n(7571).document;t.exports=r&&r.documentElement},6252:(t,e,n)=>{t.exports=!n(1216)&&!n(5338)((function(){return 7!=Object.defineProperty(n(3438)("div"),"a",{get:function(){return 7}}).a}))},116:(t,e,n)=>{var r=n(1255),i=n(473).set;t.exports=function(t,e,n){var o,a=e.constructor;return a!==n&&"function"==typeof a&&(o=a.prototype)!==n.prototype&&r(o)&&i&&i(t,o),t}},8262:t=>{t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},8579:(t,e,n)=>{var r=n(1669);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},9981:(t,e,n)=>{var r=n(9740),i=n(341)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},7183:(t,e,n)=>{var r=n(1669);t.exports=Array.isArray||function(t){return"Array"==r(t)}},1272:(t,e,n)=>{var r=n(1255),i=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&i(t)===t}},1255:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},8990:(t,e,n)=>{var r=n(1255),i=n(1669),o=n(341)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},4902:(t,e,n)=>{var r=n(486);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&r(o.call(t)),e}}},4529:(t,e,n)=>{"use strict";var r=n(9055),i=n(8328),o=n(5837),a={};n(913)(a,n(341)("iterator"),(function(){return this})),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},966:(t,e,n)=>{"use strict";var r=n(2725),i=n(7044),o=n(6476),a=n(913),u=n(9740),s=n(4529),c=n(5837),f=n(9881),l=n(341)("iterator"),d=!([].keys&&"next"in[].keys()),h="keys",p="values",v=function(){return this};t.exports=function(t,e,n,g,y,m,b){s(n,e,g);var _,x,w,E=function(t){if(!d&&t in I)return I[t];switch(t){case h:case p:return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",A=y==p,T=!1,I=t.prototype,N=I[l]||I["@@iterator"]||y&&I[y],O=N||E(y),C=y?A?E("entries"):O:void 0,k="Array"==e&&I.entries||N;if(k&&(w=f(k.call(new t)))!==Object.prototype&&w.next&&(c(w,S,!0),r||"function"==typeof w[l]||a(w,l,v)),A&&N&&N.name!==p&&(T=!0,O=function(){return N.call(this)}),r&&!b||!d&&!T&&I[l]||a(I,l,O),u[e]=O,u[S]=v,y)if(_={values:A?O:E(p),keys:m?O:E(h),entries:C},b)for(x in _)x in I||o(I,x,_[x]);else i(i.P+i.F*(d||T),e,_);return _}},2803:(t,e,n)=>{var r=n(341)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},t(o)}catch(t){}return n}},8782:t=>{t.exports=function(t,e){return{value:e,done:!!t}}},9740:t=>{t.exports={}},2725:t=>{t.exports=!1},959:t=>{var e=Math.expm1;t.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:e},7682:(t,e,n)=>{var r=n(2987),i=Math.pow,o=i(2,-52),a=i(2,-23),u=i(2,127)*(2-a),s=i(2,-126);t.exports=Math.fround||function(t){var e,n,i=Math.abs(t),c=r(t);return i<s?c*(i/s/a+1/o-1/o)*s*a:(n=(e=(1+a/o)*i)-(e-i))>u||n!=n?c*(1/0):c*n}},1618:t=>{t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},2987:t=>{t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},4278:(t,e,n)=>{var r=n(4316)("meta"),i=n(1255),o=n(7384),a=n(3886).f,u=0,s=Object.isExtensible||function(){return!0},c=!n(5338)((function(){return s(Object.preventExtensions({}))})),f=function(t){a(t,r,{value:{i:"O"+ ++u,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!s(t))return"F";if(!e)return"E";f(t)}return t[r].i},getWeak:function(t,e){if(!o(t,r)){if(!s(t))return!0;if(!e)return!1;f(t)}return t[r].w},onFreeze:function(t){return c&&l.NEED&&s(t)&&!o(t,r)&&f(t),t}}},7485:(t,e,n)=>{var r=n(7571),i=n(7225).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,u=r.Promise,s="process"==n(1669)(a);t.exports=function(){var t,e,n,c=function(){var r,i;for(s&&(r=a.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(s)n=function(){a.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(u&&u.resolve){var f=u.resolve(void 0);n=function(){f.then(c)}}else n=function(){i.call(r,c)};else{var l=!0,d=document.createTextNode("");new o(c).observe(d,{characterData:!0}),n=function(){d.data=l=!l}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},449:(t,e,n)=>{"use strict";var r=n(1464);function i(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)}t.exports.f=function(t){return new i(t)}},4643:(t,e,n)=>{"use strict";var r=n(1216),i=n(9804),o=n(3844),a=n(4179),u=n(7583),s=n(8579),c=Object.assign;t.exports=!c||n(5338)((function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=c({},t)[n]||Object.keys(c({},e)).join("")!=r}))?function(t,e){for(var n=u(t),c=arguments.length,f=1,l=o.f,d=a.f;c>f;)for(var h,p=s(arguments[f++]),v=l?i(p).concat(l(p)):i(p),g=v.length,y=0;g>y;)h=v[y++],r&&!d.call(p,h)||(n[h]=p[h]);return n}:c},9055:(t,e,n)=>{var r=n(486),i=n(6283),o=n(9824),a=n(3574)("IE_PROTO"),u=function(){},s=function(){var t,e=n(3438)("iframe"),r=o.length;for(e.style.display="none",n(7680).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),s=t.F;r--;)delete s.prototype[o[r]];return s()};t.exports=Object.create||function(t,e){var n;return null!==t?(u.prototype=r(t),n=new u,u.prototype=null,n[a]=t):n=s(),void 0===e?n:i(n,e)}},3886:(t,e,n)=>{var r=n(486),i=n(6252),o=n(4467),a=Object.defineProperty;e.f=n(1216)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},6283:(t,e,n)=>{var r=n(3886),i=n(486),o=n(9804);t.exports=n(1216)?Object.defineProperties:function(t,e){i(t);for(var n,a=o(e),u=a.length,s=0;u>s;)r.f(t,n=a[s++],e[n]);return t}},5385:(t,e,n)=>{var r=n(4179),i=n(8328),o=n(8182),a=n(4467),u=n(7384),s=n(6252),c=Object.getOwnPropertyDescriptor;e.f=n(1216)?c:function(t,e){if(t=o(t),e=a(e,!0),s)try{return c(t,e)}catch(t){}if(u(t,e))return i(!r.f.call(t,e),t[e])}},3473:(t,e,n)=>{var r=n(8182),i=n(6907).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return a.slice()}}(t):i(r(t))}},6907:(t,e,n)=>{var r=n(946),i=n(9824).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},3844:(t,e)=>{e.f=Object.getOwnPropertySymbols},9881:(t,e,n)=>{var r=n(7384),i=n(7583),o=n(3574)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},946:(t,e,n)=>{var r=n(7384),i=n(8182),o=n(4538)(!1),a=n(3574)("IE_PROTO");t.exports=function(t,e){var n,u=i(t),s=0,c=[];for(n in u)n!=a&&r(u,n)&&c.push(n);for(;e.length>s;)r(u,n=e[s++])&&(~o(c,n)||c.push(n));return c}},9804:(t,e,n)=>{var r=n(946),i=n(9824);t.exports=Object.keys||function(t){return r(t,i)}},4179:(t,e)=>{e.f={}.propertyIsEnumerable},381:(t,e,n)=>{var r=n(7044),i=n(2845),o=n(5338);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*o((function(){n(1)})),"Object",a)}},6460:(t,e,n)=>{var r=n(1216),i=n(9804),o=n(8182),a=n(4179).f;t.exports=function(t){return function(e){for(var n,u=o(e),s=i(u),c=s.length,f=0,l=[];c>f;)n=s[f++],r&&!a.call(u,n)||l.push(t?[n,u[n]]:u[n]);return l}}},8125:(t,e,n)=>{var r=n(6907),i=n(3844),o=n(486),a=n(7571).Reflect;t.exports=a&&a.ownKeys||function(t){var e=r.f(o(t)),n=i.f;return n?e.concat(n(t)):e}},1885:(t,e,n)=>{var r=n(7571).parseFloat,i=n(4961).trim;t.exports=1/r(n(1644)+"-0")!=-1/0?function(t){var e=i(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},343:(t,e,n)=>{var r=n(7571).parseInt,i=n(4961).trim,o=n(1644),a=/^[-+]?0[xX]/;t.exports=8!==r(o+"08")||22!==r(o+"0x16")?function(t,e){var n=i(String(t),3);return r(n,e>>>0||(a.test(n)?16:10))}:r},9696:t=>{t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},909:(t,e,n)=>{var r=n(486),i=n(1255),o=n(449);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=o.f(t);return(0,n.resolve)(e),n.promise}},8328:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},8565:(t,e,n)=>{var r=n(6476);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},6476:(t,e,n)=>{var r=n(7571),i=n(913),o=n(7384),a=n(4316)("src"),u=n(8454),s="toString",c=(""+u).split(s);n(2845).inspectSource=function(t){return u.call(t)},(t.exports=function(t,e,n,u){var s="function"==typeof n;s&&(o(n,"name")||i(n,"name",e)),t[e]!==n&&(s&&(o(n,a)||i(n,a,t[e]?""+t[e]:c.join(String(e)))),t===r?t[e]=n:u?t[e]?t[e]=n:i(t,e,n):(delete t[e],i(t,e,n)))})(Function.prototype,s,(function(){return"function"==typeof this&&this[a]||u.call(this)}))},2968:(t,e,n)=>{"use strict";var r=n(4939),i=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var o=n.call(t,e);if("object"!=typeof o)throw new TypeError("RegExp exec method returned something other than an Object or null");return o}if("RegExp"!==r(t))throw new TypeError("RegExp#exec called on incompatible receiver");return i.call(t,e)}},9020:(t,e,n)=>{"use strict";var r,i,o=n(3649),a=RegExp.prototype.exec,u=String.prototype.replace,s=a,c=(r=/a/,i=/b*/g,a.call(r,"a"),a.call(i,"a"),0!==r.lastIndex||0!==i.lastIndex),f=void 0!==/()??/.exec("")[1];(c||f)&&(s=function(t){var e,n,r,i,s=this;return f&&(n=new RegExp("^"+s.source+"$(?!\\s)",o.call(s))),c&&(e=s.lastIndex),r=a.call(s,t),c&&r&&(s.lastIndex=s.global?r.index+r[0].length:e),f&&r&&r.length>1&&u.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r}),t.exports=s},6962:t=>{t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},473:(t,e,n)=>{var r=n(1255),i=n(486),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(994)(Function.call,n(5385).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return o(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:o}},4412:(t,e,n)=>{"use strict";var r=n(7571),i=n(3886),o=n(1216),a=n(341)("species");t.exports=function(t){var e=r[t];o&&e&&!e[a]&&i.f(e,a,{configurable:!0,get:function(){return this}})}},5837:(t,e,n)=>{var r=n(3886).f,i=n(7384),o=n(341)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},3574:(t,e,n)=>{var r=n(5570)("keys"),i=n(4316);t.exports=function(t){return r[t]||(r[t]=i(t))}},5570:(t,e,n)=>{var r=n(2845),i=n(7571),o="__core-js_shared__",a=i[o]||(i[o]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(2725)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},8713:(t,e,n)=>{var r=n(486),i=n(1464),o=n(341)("species");t.exports=function(t,e){var n,a=r(t).constructor;return void 0===a||null==(n=r(a)[o])?e:i(n)}},5296:(t,e,n)=>{"use strict";var r=n(5338);t.exports=function(t,e){return!!t&&r((function(){e?t.call(null,(function(){}),1):t.call(null)}))}},8016:(t,e,n)=>{var r=n(5845),i=n(5091);t.exports=function(t){return function(e,n){var o,a,u=String(i(e)),s=r(n),c=u.length;return s<0||s>=c?t?"":void 0:(o=u.charCodeAt(s))<55296||o>56319||s+1===c||(a=u.charCodeAt(s+1))<56320||a>57343?t?u.charAt(s):o:t?u.slice(s,s+2):a-56320+(o-55296<<10)+65536}}},5692:(t,e,n)=>{var r=n(8990),i=n(5091);t.exports=function(t,e,n){if(r(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(i(t))}},5264:(t,e,n)=>{var r=n(7044),i=n(5338),o=n(5091),a=/"/g,u=function(t,e,n,r){var i=String(o(t)),u="<"+e;return""!==n&&(u+=" "+n+'="'+String(r).replace(a,""")+'"'),u+">"+i+"</"+e+">"};t.exports=function(t,e){var n={};n[t]=e(u),r(r.P+r.F*i((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3})),"String",n)}},8261:(t,e,n)=>{var r=n(8087),i=n(5458),o=n(5091);t.exports=function(t,e,n,a){var u=String(o(t)),s=u.length,c=void 0===n?" ":String(n),f=r(e);if(f<=s||""==c)return u;var l=f-s,d=i.call(c,Math.ceil(l/c.length));return d.length>l&&(d=d.slice(0,l)),a?d+u:u+d}},5458:(t,e,n)=>{"use strict";var r=n(5845),i=n(5091);t.exports=function(t){var e=String(i(this)),n="",o=r(t);if(o<0||o==1/0)throw RangeError("Count can't be negative");for(;o>0;(o>>>=1)&&(e+=e))1&o&&(n+=e);return n}},4961:(t,e,n)=>{var r=n(7044),i=n(5091),o=n(5338),a=n(1644),u="["+a+"]",s=RegExp("^"+u+u+"*"),c=RegExp(u+u+"*$"),f=function(t,e,n){var i={},u=o((function(){return!!a[t]()||"
"!="
"[t]()})),s=i[t]=u?e(l):a[t];n&&(i[n]=s),r(r.P+r.F*u,"String",i)},l=f.trim=function(t,e){return t=String(i(t)),1&e&&(t=t.replace(s,"")),2&e&&(t=t.replace(c,"")),t};t.exports=f},1644:t=>{t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},7225:(t,e,n)=>{var r,i,o,a=n(994),u=n(8262),s=n(7680),c=n(3438),f=n(7571),l=f.process,d=f.setImmediate,h=f.clearImmediate,p=f.MessageChannel,v=f.Dispatch,g=0,y={},m=function(){var t=+this;if(y.hasOwnProperty(t)){var e=y[t];delete y[t],e()}},b=function(t){m.call(t.data)};d&&h||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return y[++g]=function(){u("function"==typeof t?t:Function(t),e)},r(g),g},h=function(t){delete y[t]},"process"==n(1669)(l)?r=function(t){l.nextTick(a(m,t,1))}:v&&v.now?r=function(t){v.now(a(m,t,1))}:p?(o=(i=new p).port2,i.port1.onmessage=b,r=a(o.postMessage,o,1)):f.addEventListener&&"function"==typeof postMessage&&!f.importScripts?(r=function(t){f.postMessage(t+"","*")},f.addEventListener("message",b,!1)):r="onreadystatechange"in c("script")?function(t){s.appendChild(c("script")).onreadystatechange=function(){s.removeChild(this),m.call(t)}}:function(t){setTimeout(a(m,t,1),0)}),t.exports={set:d,clear:h}},9260:(t,e,n)=>{var r=n(5845),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},5e3:(t,e,n)=>{var r=n(5845),i=n(8087);t.exports=function(t){if(void 0===t)return 0;var e=r(t),n=i(e);if(e!==n)throw RangeError("Wrong length!");return n}},5845:t=>{var e=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:e)(t)}},8182:(t,e,n)=>{var r=n(8579),i=n(5091);t.exports=function(t){return r(i(t))}},8087:(t,e,n)=>{var r=n(5845),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},7583:(t,e,n)=>{var r=n(5091);t.exports=function(t){return Object(r(t))}},4467:(t,e,n)=>{var r=n(1255);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},1063:(t,e,n)=>{"use strict";if(n(1216)){var r=n(2725),i=n(7571),o=n(5338),a=n(7044),u=n(604),s=n(1541),c=n(994),f=n(6903),l=n(8328),d=n(913),h=n(8565),p=n(5845),v=n(8087),g=n(5e3),y=n(9260),m=n(4467),b=n(7384),_=n(4939),x=n(1255),w=n(7583),E=n(9981),S=n(9055),A=n(9881),T=n(6907).f,I=n(9685),N=n(4316),O=n(341),C=n(7622),k=n(4538),D=n(8713),M=n(163),R=n(9740),P=n(2803),G=n(4412),L=n(8676),j=n(1064),F=n(3886),U=n(5385),B=F.f,z=U.f,V=i.RangeError,W=i.TypeError,H=i.Uint8Array,X="ArrayBuffer",q="SharedArrayBuffer",Y="BYTES_PER_ELEMENT",K=Array.prototype,Z=s.ArrayBuffer,$=s.DataView,J=C(0),Q=C(2),tt=C(3),et=C(4),nt=C(5),rt=C(6),it=k(!0),ot=k(!1),at=M.values,ut=M.keys,st=M.entries,ct=K.lastIndexOf,ft=K.reduce,lt=K.reduceRight,dt=K.join,ht=K.sort,pt=K.slice,vt=K.toString,gt=K.toLocaleString,yt=O("iterator"),mt=O("toStringTag"),bt=N("typed_constructor"),_t=N("def_constructor"),xt=u.CONSTR,wt=u.TYPED,Et=u.VIEW,St="Wrong length!",At=C(1,(function(t,e){return Ct(D(t,t[_t]),e)})),Tt=o((function(){return 1===new H(new Uint16Array([1]).buffer)[0]})),It=!!H&&!!H.prototype.set&&o((function(){new H(1).set({})})),Nt=function(t,e){var n=p(t);if(n<0||n%e)throw V("Wrong offset!");return n},Ot=function(t){if(x(t)&&wt in t)return t;throw W(t+" is not a typed array!")},Ct=function(t,e){if(!x(t)||!(bt in t))throw W("It is not a typed array constructor!");return new t(e)},kt=function(t,e){return Dt(D(t,t[_t]),e)},Dt=function(t,e){for(var n=0,r=e.length,i=Ct(t,r);r>n;)i[n]=e[n++];return i},Mt=function(t,e,n){B(t,e,{get:function(){return this._d[n]}})},Rt=function(t){var e,n,r,i,o,a,u=w(t),s=arguments.length,f=s>1?arguments[1]:void 0,l=void 0!==f,d=I(u);if(null!=d&&!E(d)){for(a=d.call(u),r=[],e=0;!(o=a.next()).done;e++)r.push(o.value);u=r}for(l&&s>2&&(f=c(f,arguments[2],2)),e=0,n=v(u.length),i=Ct(this,n);n>e;e++)i[e]=l?f(u[e],e):u[e];return i},Pt=function(){for(var t=0,e=arguments.length,n=Ct(this,e);e>t;)n[t]=arguments[t++];return n},Gt=!!H&&o((function(){gt.call(new H(1))})),Lt=function(){return gt.apply(Gt?pt.call(Ot(this)):Ot(this),arguments)},jt={copyWithin:function(t,e){return j.call(Ot(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return et(Ot(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return L.apply(Ot(this),arguments)},filter:function(t){return kt(this,Q(Ot(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return nt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return rt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){J(Ot(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return ot(Ot(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return it(Ot(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return dt.apply(Ot(this),arguments)},lastIndexOf:function(t){return ct.apply(Ot(this),arguments)},map:function(t){return At(Ot(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ft.apply(Ot(this),arguments)},reduceRight:function(t){return lt.apply(Ot(this),arguments)},reverse:function(){for(var t,e=this,n=Ot(e).length,r=Math.floor(n/2),i=0;i<r;)t=e[i],e[i++]=e[--n],e[n]=t;return e},some:function(t){return tt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return ht.call(Ot(this),t)},subarray:function(t,e){var n=Ot(this),r=n.length,i=y(t,r);return new(D(n,n[_t]))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,v((void 0===e?r:y(e,r))-i))}},Ft=function(t,e){return kt(this,pt.call(Ot(this),t,e))},Ut=function(t){Ot(this);var e=Nt(arguments[1],1),n=this.length,r=w(t),i=v(r.length),o=0;if(i+e>n)throw V(St);for(;o<i;)this[e+o]=r[o++]},Bt={entries:function(){return st.call(Ot(this))},keys:function(){return ut.call(Ot(this))},values:function(){return at.call(Ot(this))}},zt=function(t,e){return x(t)&&t[wt]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Vt=function(t,e){return zt(t,e=m(e,!0))?l(2,t[e]):z(t,e)},Wt=function(t,e,n){return!(zt(t,e=m(e,!0))&&x(n)&&b(n,"value"))||b(n,"get")||b(n,"set")||n.configurable||b(n,"writable")&&!n.writable||b(n,"enumerable")&&!n.enumerable?B(t,e,n):(t[e]=n.value,t)};xt||(U.f=Vt,F.f=Wt),a(a.S+a.F*!xt,"Object",{getOwnPropertyDescriptor:Vt,defineProperty:Wt}),o((function(){vt.call({})}))&&(vt=gt=function(){return dt.call(this)});var Ht=h({},jt);h(Ht,Bt),d(Ht,yt,Bt.values),h(Ht,{slice:Ft,set:Ut,constructor:function(){},toString:vt,toLocaleString:Lt}),Mt(Ht,"buffer","b"),Mt(Ht,"byteOffset","o"),Mt(Ht,"byteLength","l"),Mt(Ht,"length","e"),B(Ht,mt,{get:function(){return this[wt]}}),t.exports=function(t,e,n,s){var c=t+((s=!!s)?"Clamped":"")+"Array",l="get"+t,h="set"+t,p=i[c],y=p||{},m=p&&A(p),b=!p||!u.ABV,w={},E=p&&p.prototype,I=function(t,n){B(t,n,{get:function(){return function(t,n){var r=t._d;return r.v[l](n*e+r.o,Tt)}(this,n)},set:function(t){return function(t,n,r){var i=t._d;s&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),i.v[h](n*e+i.o,r,Tt)}(this,n,t)},enumerable:!0})};b?(p=n((function(t,n,r,i){f(t,p,c,"_d");var o,a,u,s,l=0,h=0;if(x(n)){if(!(n instanceof Z||(s=_(n))==X||s==q))return wt in n?Dt(p,n):Rt.call(p,n);o=n,h=Nt(r,e);var y=n.byteLength;if(void 0===i){if(y%e)throw V(St);if((a=y-h)<0)throw V(St)}else if((a=v(i)*e)+h>y)throw V(St);u=a/e}else u=g(n),o=new Z(a=u*e);for(d(t,"_d",{b:o,o:h,l:a,e:u,v:new $(o)});l<u;)I(t,l++)})),E=p.prototype=S(Ht),d(E,"constructor",p)):o((function(){p(1)}))&&o((function(){new p(-1)}))&&P((function(t){new p,new p(null),new p(1.5),new p(t)}),!0)||(p=n((function(t,n,r,i){var o;return f(t,p,c),x(n)?n instanceof Z||(o=_(n))==X||o==q?void 0!==i?new y(n,Nt(r,e),i):void 0!==r?new y(n,Nt(r,e)):new y(n):wt in n?Dt(p,n):Rt.call(p,n):new y(g(n))})),J(m!==Function.prototype?T(y).concat(T(m)):T(y),(function(t){t in p||d(p,t,y[t])})),p.prototype=E,r||(E.constructor=p));var N=E[yt],O=!!N&&("values"==N.name||null==N.name),C=Bt.values;d(p,bt,!0),d(E,wt,c),d(E,Et,!0),d(E,_t,p),(s?new p(1)[mt]==c:mt in E)||B(E,mt,{get:function(){return c}}),w[c]=p,a(a.G+a.W+a.F*(p!=y),w),a(a.S,c,{BYTES_PER_ELEMENT:e}),a(a.S+a.F*o((function(){y.of.call(p,1)})),c,{from:Rt,of:Pt}),Y in E||d(E,Y,e),a(a.P,c,jt),G(c),a(a.P+a.F*It,c,{set:Ut}),a(a.P+a.F*!O,c,Bt),r||E.toString==vt||(E.toString=vt),a(a.P+a.F*o((function(){new p(1).slice()})),c,{slice:Ft}),a(a.P+a.F*(o((function(){return[1,2].toLocaleString()!=new p([1,2]).toLocaleString()}))||!o((function(){E.toLocaleString.call([1,2])}))),c,{toLocaleString:Lt}),R[c]=O?N:C,r||O||d(E,yt,C)}}else t.exports=function(){}},1541:(t,e,n)=>{"use strict";var r=n(7571),i=n(1216),o=n(2725),a=n(604),u=n(913),s=n(8565),c=n(5338),f=n(6903),l=n(5845),d=n(8087),h=n(5e3),p=n(6907).f,v=n(3886).f,g=n(8676),y=n(5837),m="ArrayBuffer",b="DataView",_="Wrong index!",x=r.ArrayBuffer,w=r.DataView,E=r.Math,S=r.RangeError,A=r.Infinity,T=x,I=E.abs,N=E.pow,O=E.floor,C=E.log,k=E.LN2,D="buffer",M="byteLength",R="byteOffset",P=i?"_b":D,G=i?"_l":M,L=i?"_o":R;function j(t,e,n){var r,i,o,a=new Array(n),u=8*n-e-1,s=(1<<u)-1,c=s>>1,f=23===e?N(2,-24)-N(2,-77):0,l=0,d=t<0||0===t&&1/t<0?1:0;for((t=I(t))!=t||t===A?(i=t!=t?1:0,r=s):(r=O(C(t)/k),t*(o=N(2,-r))<1&&(r--,o*=2),(t+=r+c>=1?f/o:f*N(2,1-c))*o>=2&&(r++,o/=2),r+c>=s?(i=0,r=s):r+c>=1?(i=(t*o-1)*N(2,e),r+=c):(i=t*N(2,c-1)*N(2,e),r=0));e>=8;a[l++]=255&i,i/=256,e-=8);for(r=r<<e|i,u+=e;u>0;a[l++]=255&r,r/=256,u-=8);return a[--l]|=128*d,a}function F(t,e,n){var r,i=8*n-e-1,o=(1<<i)-1,a=o>>1,u=i-7,s=n-1,c=t[s--],f=127&c;for(c>>=7;u>0;f=256*f+t[s],s--,u-=8);for(r=f&(1<<-u)-1,f>>=-u,u+=e;u>0;r=256*r+t[s],s--,u-=8);if(0===f)f=1-a;else{if(f===o)return r?NaN:c?-A:A;r+=N(2,e),f-=a}return(c?-1:1)*r*N(2,f-e)}function U(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function B(t){return[255&t]}function z(t){return[255&t,t>>8&255]}function V(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function W(t){return j(t,52,8)}function H(t){return j(t,23,4)}function X(t,e,n){v(t.prototype,e,{get:function(){return this[n]}})}function q(t,e,n,r){var i=h(+n);if(i+e>t[G])throw S(_);var o=t[P]._b,a=i+t[L],u=o.slice(a,a+e);return r?u:u.reverse()}function Y(t,e,n,r,i,o){var a=h(+n);if(a+e>t[G])throw S(_);for(var u=t[P]._b,s=a+t[L],c=r(+i),f=0;f<e;f++)u[s+f]=c[o?f:e-f-1]}if(a.ABV){if(!c((function(){x(1)}))||!c((function(){new x(-1)}))||c((function(){return new x,new x(1.5),new x(NaN),x.name!=m}))){for(var K,Z=(x=function(t){return f(this,x),new T(h(t))}).prototype=T.prototype,$=p(T),J=0;$.length>J;)(K=$[J++])in x||u(x,K,T[K]);o||(Z.constructor=x)}var Q=new w(new x(2)),tt=w.prototype.setInt8;Q.setInt8(0,2147483648),Q.setInt8(1,2147483649),!Q.getInt8(0)&&Q.getInt8(1)||s(w.prototype,{setInt8:function(t,e){tt.call(this,t,e<<24>>24)},setUint8:function(t,e){tt.call(this,t,e<<24>>24)}},!0)}else x=function(t){f(this,x,m);var e=h(t);this._b=g.call(new Array(e),0),this[G]=e},w=function(t,e,n){f(this,w,b),f(t,x,b);var r=t[G],i=l(e);if(i<0||i>r)throw S("Wrong offset!");if(i+(n=void 0===n?r-i:d(n))>r)throw S("Wrong length!");this[P]=t,this[L]=i,this[G]=n},i&&(X(x,M,"_l"),X(w,D,"_b"),X(w,M,"_l"),X(w,R,"_o")),s(w.prototype,{getInt8:function(t){return q(this,1,t)[0]<<24>>24},getUint8:function(t){return q(this,1,t)[0]},getInt16:function(t){var e=q(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=q(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return U(q(this,4,t,arguments[1]))},getUint32:function(t){return U(q(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return F(q(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return F(q(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){Y(this,1,t,B,e)},setUint8:function(t,e){Y(this,1,t,B,e)},setInt16:function(t,e){Y(this,2,t,z,e,arguments[2])},setUint16:function(t,e){Y(this,2,t,z,e,arguments[2])},setInt32:function(t,e){Y(this,4,t,V,e,arguments[2])},setUint32:function(t,e){Y(this,4,t,V,e,arguments[2])},setFloat32:function(t,e){Y(this,4,t,H,e,arguments[2])},setFloat64:function(t,e){Y(this,8,t,W,e,arguments[2])}});y(x,m),y(w,b),u(w.prototype,a.VIEW,!0),e.ArrayBuffer=x,e.DataView=w},604:(t,e,n)=>{for(var r,i=n(7571),o=n(913),a=n(4316),u=a("typed_array"),s=a("view"),c=!(!i.ArrayBuffer||!i.DataView),f=c,l=0,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(r=i[d[l++]])?(o(r.prototype,u,!0),o(r.prototype,s,!0)):f=!1;t.exports={ABV:c,CONSTR:f,TYPED:u,VIEW:s}},4316:t=>{var e=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+n).toString(36))}},2541:(t,e,n)=>{var r=n(7571).navigator;t.exports=r&&r.userAgent||""},4664:(t,e,n)=>{var r=n(1255);t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},6262:(t,e,n)=>{var r=n(7571),i=n(2845),o=n(2725),a=n(7686),u=n(3886).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||u(e,t,{value:a.f(t)})}},7686:(t,e,n)=>{e.f=n(341)},341:(t,e,n)=>{var r=n(5570)("wks"),i=n(4316),o=n(7571).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},9685:(t,e,n)=>{var r=n(4939),i=n(341)("iterator"),o=n(9740);t.exports=n(2845).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[r(t)]}},5305:(t,e,n)=>{var r=n(7044);r(r.P,"Array",{copyWithin:n(1064)}),n(4691)("copyWithin")},5015:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(4);r(r.P+r.F*!n(5296)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},6341:(t,e,n)=>{var r=n(7044);r(r.P,"Array",{fill:n(8676)}),n(4691)("fill")},5119:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(2);r(r.P+r.F*!n(5296)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},4488:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(6),o="findIndex",a=!0;o in[]&&Array(1)[o]((function(){a=!1})),r(r.P+r.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(4691)(o)},5915:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(5),o="find",a=!0;o in[]&&Array(1).find((function(){a=!1})),r(r.P+r.F*a,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(4691)(o)},5788:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(0),o=n(5296)([].forEach,!0);r(r.P+r.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},9689:(t,e,n)=>{"use strict";var r=n(994),i=n(7044),o=n(7583),a=n(4902),u=n(9981),s=n(8087),c=n(1395),f=n(9685);i(i.S+i.F*!n(2803)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,i,l,d=o(t),h="function"==typeof this?this:Array,p=arguments.length,v=p>1?arguments[1]:void 0,g=void 0!==v,y=0,m=f(d);if(g&&(v=r(v,p>2?arguments[2]:void 0,2)),null==m||h==Array&&u(m))for(n=new h(e=s(d.length));e>y;y++)c(n,y,g?v(d[y],y):d[y]);else for(l=m.call(d),n=new h;!(i=l.next()).done;y++)c(n,y,g?a(l,v,[i.value,y],!0):i.value);return n.length=y,n}})},5377:(t,e,n)=>{"use strict";var r=n(7044),i=n(4538)(!1),o=[].indexOf,a=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(5296)(o)),"Array",{indexOf:function(t){return a?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},2247:(t,e,n)=>{var r=n(7044);r(r.S,"Array",{isArray:n(7183)})},163:(t,e,n)=>{"use strict";var r=n(4691),i=n(8782),o=n(9740),a=n(8182);t.exports=n(966)(Array,"Array",(function(t,e){this._t=a(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},9026:(t,e,n)=>{"use strict";var r=n(7044),i=n(8182),o=[].join;r(r.P+r.F*(n(8579)!=Object||!n(5296)(o)),"Array",{join:function(t){return o.call(i(this),void 0===t?",":t)}})},9879:(t,e,n)=>{"use strict";var r=n(7044),i=n(8182),o=n(5845),a=n(8087),u=[].lastIndexOf,s=!!u&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(s||!n(5296)(u)),"Array",{lastIndexOf:function(t){if(s)return u.apply(this,arguments)||0;var e=i(this),n=a(e.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,o(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in e&&e[r]===t)return r||0;return-1}})},7878:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(1);r(r.P+r.F*!n(5296)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},9003:(t,e,n)=>{"use strict";var r=n(7044),i=n(1395);r(r.S+r.F*n(5338)((function(){function t(){}return!(Array.of.call(t)instanceof t)})),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);e>t;)i(n,t,arguments[t++]);return n.length=e,n}})},646:(t,e,n)=>{"use strict";var r=n(7044),i=n(5336);r(r.P+r.F*!n(5296)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},8059:(t,e,n)=>{"use strict";var r=n(7044),i=n(5336);r(r.P+r.F*!n(5296)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},4088:(t,e,n)=>{"use strict";var r=n(7044),i=n(7680),o=n(1669),a=n(9260),u=n(8087),s=[].slice;r(r.P+r.F*n(5338)((function(){i&&s.call(i)})),"Array",{slice:function(t,e){var n=u(this.length),r=o(this);if(e=void 0===e?n:e,"Array"==r)return s.call(this,t,e);for(var i=a(t,n),c=a(e,n),f=u(c-i),l=new Array(f),d=0;d<f;d++)l[d]="String"==r?this.charAt(i+d):this[i+d];return l}})},3135:(t,e,n)=>{"use strict";var r=n(7044),i=n(7622)(3);r(r.P+r.F*!n(5296)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},535:(t,e,n)=>{"use strict";var r=n(7044),i=n(1464),o=n(7583),a=n(5338),u=[].sort,s=[1,2,3];r(r.P+r.F*(a((function(){s.sort(void 0)}))||!a((function(){s.sort(null)}))||!n(5296)(u)),"Array",{sort:function(t){return void 0===t?u.call(o(this)):u.call(o(this),i(t))}})},9281:(t,e,n)=>{n(4412)("Array")},4094:(t,e,n)=>{var r=n(7044);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},5013:(t,e,n)=>{var r=n(7044),i=n(4506);r(r.P+r.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},8781:(t,e,n)=>{"use strict";var r=n(7044),i=n(7583),o=n(4467);r(r.P+r.F*n(5338)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(t){var e=i(this),n=o(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},8723:(t,e,n)=>{var r=n(341)("toPrimitive"),i=Date.prototype;r in i||n(913)(i,r,n(9514))},3735:(t,e,n)=>{var r=Date.prototype,i="Invalid Date",o=r.toString,a=r.getTime;new Date(NaN)+""!=i&&n(6476)(r,"toString",(function(){var t=a.call(this);return t==t?o.call(this):i}))},1765:(t,e,n)=>{var r=n(7044);r(r.P,"Function",{bind:n(8366)})},7451:(t,e,n)=>{"use strict";var r=n(1255),i=n(9881),o=n(341)("hasInstance"),a=Function.prototype;o in a||n(3886).f(a,o,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},5747:(t,e,n)=>{var r=n(3886).f,i=Function.prototype,o=/^\s*function ([^ (]*)/,a="name";a in i||n(1216)&&r(i,a,{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},6441:(t,e,n)=>{"use strict";var r=n(3050),i=n(4664),o="Map";t.exports=n(859)(o,(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{get:function(t){var e=r.getEntry(i(this,o),t);return e&&e.v},set:function(t,e){return r.def(i(this,o),0===t?0:t,e)}},r,!0)},2212:(t,e,n)=>{var r=n(7044),i=n(1618),o=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},4230:(t,e,n)=>{var r=n(7044),i=Math.asinh;r(r.S+r.F*!(i&&1/i(0)>0),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}})},9754:(t,e,n)=>{var r=n(7044),i=Math.atanh;r(r.S+r.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},2811:(t,e,n)=>{var r=n(7044),i=n(2987);r(r.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},3998:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},1769:(t,e,n)=>{var r=n(7044),i=Math.exp;r(r.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},8789:(t,e,n)=>{var r=n(7044),i=n(959);r(r.S+r.F*(i!=Math.expm1),"Math",{expm1:i})},2848:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{fround:n(7682)})},1762:(t,e,n)=>{var r=n(7044),i=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,o=0,a=0,u=arguments.length,s=0;a<u;)s<(n=i(arguments[a++]))?(o=o*(r=s/n)*r+1,s=n):o+=n>0?(r=n/s)*r:n;return s===1/0?1/0:s*Math.sqrt(o)}})},1323:(t,e,n)=>{var r=n(7044),i=Math.imul;r(r.S+r.F*n(5338)((function(){return-5!=i(4294967295,5)||2!=i.length})),"Math",{imul:function(t,e){var n=65535,r=+t,i=+e,o=n&r,a=n&i;return 0|o*a+((n&r>>>16)*a+o*(n&i>>>16)<<16>>>0)}})},6063:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},3282:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{log1p:n(1618)})},6816:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},1854:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{sign:n(2987)})},3303:(t,e,n)=>{var r=n(7044),i=n(959),o=Math.exp;r(r.S+r.F*n(5338)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},4421:(t,e,n)=>{var r=n(7044),i=n(959),o=Math.exp;r(r.S,"Math",{tanh:function(t){var e=i(t=+t),n=i(-t);return e==1/0?1:n==1/0?-1:(e-n)/(o(t)+o(-t))}})},2203:(t,e,n)=>{var r=n(7044);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},7454:(t,e,n)=>{"use strict";var r=n(7571),i=n(7384),o=n(1669),a=n(116),u=n(4467),s=n(5338),c=n(6907).f,f=n(5385).f,l=n(3886).f,d=n(4961).trim,h="Number",p=r.Number,v=p,g=p.prototype,y=o(n(9055)(g))==h,m="trim"in String.prototype,b=function(t){var e=u(t,!1);if("string"==typeof e&&e.length>2){var n,r,i,o=(e=m?e.trim():d(e,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(e.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+e}for(var a,s=e.slice(2),c=0,f=s.length;c<f;c++)if((a=s.charCodeAt(c))<48||a>i)return NaN;return parseInt(s,r)}}return+e};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof p&&(y?s((function(){g.valueOf.call(n)})):o(n)!=h)?a(new v(b(e)),n,p):b(e)};for(var _,x=n(1216)?c(v):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),w=0;x.length>w;w++)i(v,_=x[w])&&!i(p,_)&&l(p,_,f(v,_));p.prototype=g,g.constructor=p,n(6476)(r,h,p)}},7551:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},2929:(t,e,n)=>{var r=n(7044),i=n(7571).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},215:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{isInteger:n(1272)})},6183:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{isNaN:function(t){return t!=t}})},8190:(t,e,n)=>{var r=n(7044),i=n(1272),o=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},476:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},948:(t,e,n)=>{var r=n(7044);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},942:(t,e,n)=>{var r=n(7044),i=n(1885);r(r.S+r.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},2870:(t,e,n)=>{var r=n(7044),i=n(343);r(r.S+r.F*(Number.parseInt!=i),"Number",{parseInt:i})},3053:(t,e,n)=>{"use strict";var r=n(7044),i=n(5845),o=n(8347),a=n(5458),u=1..toFixed,s=Math.floor,c=[0,0,0,0,0,0],f="Number.toFixed: incorrect invocation!",l="0",d=function(t,e){for(var n=-1,r=e;++n<6;)r+=t*c[n],c[n]=r%1e7,r=s(r/1e7)},h=function(t){for(var e=6,n=0;--e>=0;)n+=c[e],c[e]=s(n/t),n=n%t*1e7},p=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==c[t]){var n=String(c[t]);e=""===e?n:e+a.call(l,7-n.length)+n}return e},v=function(t,e,n){return 0===e?n:e%2==1?v(t,e-1,n*t):v(t*t,e/2,n)};r(r.P+r.F*(!!u&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(5338)((function(){u.call({})}))),"Number",{toFixed:function(t){var e,n,r,u,s=o(this,f),c=i(t),g="",y=l;if(c<0||c>20)throw RangeError(f);if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return String(s);if(s<0&&(g="-",s=-s),s>1e-21)if(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(s*v(2,69,1))-69,n=e<0?s*v(2,-e,1):s/v(2,e,1),n*=4503599627370496,(e=52-e)>0){for(d(0,n),r=c;r>=7;)d(1e7,0),r-=7;for(d(v(10,r,1),0),r=e-1;r>=23;)h(1<<23),r-=23;h(1<<r),d(1,1),h(2),y=p()}else d(0,n),d(1<<-e,0),y=p()+a.call(l,c);return c>0?g+((u=y.length)<=c?"0."+a.call(l,c-u)+y:y.slice(0,u-c)+"."+y.slice(u-c)):g+y}})},8032:(t,e,n)=>{"use strict";var r=n(7044),i=n(5338),o=n(8347),a=1..toPrecision;r(r.P+r.F*(i((function(){return"1"!==a.call(1,void 0)}))||!i((function(){a.call({})}))),"Number",{toPrecision:function(t){var e=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},5261:(t,e,n)=>{var r=n(7044);r(r.S+r.F,"Object",{assign:n(4643)})},6051:(t,e,n)=>{var r=n(7044);r(r.S,"Object",{create:n(9055)})},9518:(t,e,n)=>{var r=n(7044);r(r.S+r.F*!n(1216),"Object",{defineProperties:n(6283)})},2640:(t,e,n)=>{var r=n(7044);r(r.S+r.F*!n(1216),"Object",{defineProperty:n(3886).f})},9788:(t,e,n)=>{var r=n(1255),i=n(4278).onFreeze;n(381)("freeze",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},8201:(t,e,n)=>{var r=n(8182),i=n(5385).f;n(381)("getOwnPropertyDescriptor",(function(){return function(t,e){return i(r(t),e)}}))},7525:(t,e,n)=>{n(381)("getOwnPropertyNames",(function(){return n(3473).f}))},470:(t,e,n)=>{var r=n(7583),i=n(9881);n(381)("getPrototypeOf",(function(){return function(t){return i(r(t))}}))},7940:(t,e,n)=>{var r=n(1255);n(381)("isExtensible",(function(t){return function(e){return!!r(e)&&(!t||t(e))}}))},6129:(t,e,n)=>{var r=n(1255);n(381)("isFrozen",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},2802:(t,e,n)=>{var r=n(1255);n(381)("isSealed",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},9340:(t,e,n)=>{var r=n(7044);r(r.S,"Object",{is:n(6962)})},5723:(t,e,n)=>{var r=n(7583),i=n(9804);n(381)("keys",(function(){return function(t){return i(r(t))}}))},7577:(t,e,n)=>{var r=n(1255),i=n(4278).onFreeze;n(381)("preventExtensions",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},1498:(t,e,n)=>{var r=n(1255),i=n(4278).onFreeze;n(381)("seal",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},1584:(t,e,n)=>{var r=n(7044);r(r.S,"Object",{setPrototypeOf:n(473).set})},7298:(t,e,n)=>{"use strict";var r=n(4939),i={};i[n(341)("toStringTag")]="z",i+""!="[object z]"&&n(6476)(Object.prototype,"toString",(function(){return"[object "+r(this)+"]"}),!0)},2809:(t,e,n)=>{var r=n(7044),i=n(1885);r(r.G+r.F*(parseFloat!=i),{parseFloat:i})},2784:(t,e,n)=>{var r=n(7044),i=n(343);r(r.G+r.F*(parseInt!=i),{parseInt:i})},7843:(t,e,n)=>{"use strict";var r,i,o,a,u=n(2725),s=n(7571),c=n(994),f=n(4939),l=n(7044),d=n(1255),h=n(1464),p=n(6903),v=n(9822),g=n(8713),y=n(7225).set,m=n(7485)(),b=n(449),_=n(9696),x=n(2541),w=n(909),E="Promise",S=s.TypeError,A=s.process,T=A&&A.versions,I=T&&T.v8||"",N=s.Promise,O="process"==f(A),C=function(){},k=i=b.f,D=!!function(){try{var t=N.resolve(1),e=(t.constructor={})[n(341)("species")]=function(t){t(C,C)};return(O||"function"==typeof PromiseRejectionEvent)&&t.then(C)instanceof e&&0!==I.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),M=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},R=function(t,e){if(!t._n){t._n=!0;var n=t._c;m((function(){for(var r=t._v,i=1==t._s,o=0,a=function(e){var n,o,a,u=i?e.ok:e.fail,s=e.resolve,c=e.reject,f=e.domain;try{u?(i||(2==t._h&&L(t),t._h=1),!0===u?n=r:(f&&f.enter(),n=u(r),f&&(f.exit(),a=!0)),n===e.promise?c(S("Promise-chain cycle")):(o=M(n))?o.call(n,s,c):s(n)):c(r)}catch(t){f&&!a&&f.exit(),c(t)}};n.length>o;)a(n[o++]);t._c=[],t._n=!1,e&&!t._h&&P(t)}))}},P=function(t){y.call(s,(function(){var e,n,r,i=t._v,o=G(t);if(o&&(e=_((function(){O?A.emit("unhandledRejection",i,t):(n=s.onunhandledrejection)?n({promise:t,reason:i}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",i)})),t._h=O||G(t)?2:1),t._a=void 0,o&&e.e)throw e.v}))},G=function(t){return 1!==t._h&&0===(t._a||t._c).length},L=function(t){y.call(s,(function(){var e;O?A.emit("rejectionHandled",t):(e=s.onrejectionhandled)&&e({promise:t,reason:t._v})}))},j=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),R(e,!0))},F=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw S("Promise can't be resolved itself");(e=M(t))?m((function(){var r={_w:n,_d:!1};try{e.call(t,c(F,r,1),c(j,r,1))}catch(t){j.call(r,t)}})):(n._v=t,n._s=1,R(n,!1))}catch(t){j.call({_w:n,_d:!1},t)}}};D||(N=function(t){p(this,N,E,"_h"),h(t),r.call(this);try{t(c(F,this,1),c(j,this,1))}catch(t){j.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(8565)(N.prototype,{then:function(t,e){var n=k(g(this,N));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=O?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&R(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r;this.promise=t,this.resolve=c(F,t,1),this.reject=c(j,t,1)},b.f=k=function(t){return t===N||t===a?new o(t):i(t)}),l(l.G+l.W+l.F*!D,{Promise:N}),n(5837)(N,E),n(4412)(E),a=n(2845).Promise,l(l.S+l.F*!D,E,{reject:function(t){var e=k(this);return(0,e.reject)(t),e.promise}}),l(l.S+l.F*(u||!D),E,{resolve:function(t){return w(u&&this===a?N:this,t)}}),l(l.S+l.F*!(D&&n(2803)((function(t){N.all(t).catch(C)}))),E,{all:function(t){var e=this,n=k(e),r=n.resolve,i=n.reject,o=_((function(){var n=[],o=0,a=1;v(t,!1,(function(t){var u=o++,s=!1;n.push(void 0),a++,e.resolve(t).then((function(t){s||(s=!0,n[u]=t,--a||r(n))}),i)})),--a||r(n)}));return o.e&&i(o.v),n.promise},race:function(t){var e=this,n=k(e),r=n.reject,i=_((function(){v(t,!1,(function(t){e.resolve(t).then(n.resolve,r)}))}));return i.e&&r(i.v),n.promise}})},8275:(t,e,n)=>{var r=n(7044),i=n(1464),o=n(486),a=(n(7571).Reflect||{}).apply,u=Function.apply;r(r.S+r.F*!n(5338)((function(){a((function(){}))})),"Reflect",{apply:function(t,e,n){var r=i(t),s=o(n);return a?a(r,e,s):u.call(r,e,s)}})},2552:(t,e,n)=>{var r=n(7044),i=n(9055),o=n(1464),a=n(486),u=n(1255),s=n(5338),c=n(8366),f=(n(7571).Reflect||{}).construct,l=s((function(){function t(){}return!(f((function(){}),[],t)instanceof t)})),d=!s((function(){f((function(){}))}));r(r.S+r.F*(l||d),"Reflect",{construct:function(t,e){o(t),a(e);var n=arguments.length<3?t:o(arguments[2]);if(d&&!l)return f(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(c.apply(t,r))}var s=n.prototype,h=i(u(s)?s:Object.prototype),p=Function.apply.call(t,h,e);return u(p)?p:h}})},3077:(t,e,n)=>{var r=n(3886),i=n(7044),o=n(486),a=n(4467);i(i.S+i.F*n(5338)((function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(t,e,n){o(t),e=a(e,!0),o(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},1031:(t,e,n)=>{var r=n(7044),i=n(5385).f,o=n(486);r(r.S,"Reflect",{deleteProperty:function(t,e){var n=i(o(t),e);return!(n&&!n.configurable)&&delete t[e]}})},8916:(t,e,n)=>{"use strict";var r=n(7044),i=n(486),o=function(t){this._t=i(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)};n(4529)(o,"Object",(function(){var t,e=this,n=e._k;do{if(e._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[e._i++])in e._t));return{value:t,done:!1}})),r(r.S,"Reflect",{enumerate:function(t){return new o(t)}})},8531:(t,e,n)=>{var r=n(5385),i=n(7044),o=n(486);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(o(t),e)}})},7323:(t,e,n)=>{var r=n(7044),i=n(9881),o=n(486);r(r.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},8978:(t,e,n)=>{var r=n(5385),i=n(9881),o=n(7384),a=n(7044),u=n(1255),s=n(486);a(a.S,"Reflect",{get:function t(e,n){var a,c,f=arguments.length<3?e:arguments[2];return s(e)===f?e[n]:(a=r.f(e,n))?o(a,"value")?a.value:void 0!==a.get?a.get.call(f):void 0:u(c=i(e))?t(c,n,f):void 0}})},3704:(t,e,n)=>{var r=n(7044);r(r.S,"Reflect",{has:function(t,e){return e in t}})},3153:(t,e,n)=>{var r=n(7044),i=n(486),o=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},8812:(t,e,n)=>{var r=n(7044);r(r.S,"Reflect",{ownKeys:n(8125)})},2636:(t,e,n)=>{var r=n(7044),i=n(486),o=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},377:(t,e,n)=>{var r=n(7044),i=n(473);i&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){i.check(t,e);try{return i.set(t,e),!0}catch(t){return!1}}})},1602:(t,e,n)=>{var r=n(3886),i=n(5385),o=n(9881),a=n(7384),u=n(7044),s=n(8328),c=n(486),f=n(1255);u(u.S,"Reflect",{set:function t(e,n,u){var l,d,h=arguments.length<4?e:arguments[3],p=i.f(c(e),n);if(!p){if(f(d=o(e)))return t(d,n,u,h);p=s(0)}if(a(p,"value")){if(!1===p.writable||!f(h))return!1;if(l=i.f(h,n)){if(l.get||l.set||!1===l.writable)return!1;l.value=u,r.f(h,n,l)}else r.f(h,n,s(0,u));return!0}return void 0!==p.set&&(p.set.call(h,u),!0)}})},6668:(t,e,n)=>{var r=n(7571),i=n(116),o=n(3886).f,a=n(6907).f,u=n(8990),s=n(3649),c=r.RegExp,f=c,l=c.prototype,d=/a/g,h=/a/g,p=new c(d)!==d;if(n(1216)&&(!p||n(5338)((function(){return h[n(341)("match")]=!1,c(d)!=d||c(h)==h||"/a/i"!=c(d,"i")})))){c=function(t,e){var n=this instanceof c,r=u(t),o=void 0===e;return!n&&r&&t.constructor===c&&o?t:i(p?new f(r&&!o?t.source:t,e):f((r=t instanceof c)?t.source:t,r&&o?s.call(t):e),n?this:l,c)};for(var v=function(t){t in c||o(c,t,{configurable:!0,get:function(){return f[t]},set:function(e){f[t]=e}})},g=a(f),y=0;g.length>y;)v(g[y++]);l.constructor=c,c.prototype=l,n(6476)(r,"RegExp",c)}n(4412)("RegExp")},7139:(t,e,n)=>{"use strict";var r=n(9020);n(7044)({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},8686:(t,e,n)=>{n(1216)&&"g"!=/./g.flags&&n(3886).f(RegExp.prototype,"flags",{configurable:!0,get:n(3649)})},5480:(t,e,n)=>{"use strict";var r=n(486),i=n(8087),o=n(178),a=n(2968);n(6719)("match",1,(function(t,e,n,u){return[function(n){var r=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=u(n,t,this);if(e.done)return e.value;var s=r(t),c=String(this);if(!s.global)return a(s,c);var f=s.unicode;s.lastIndex=0;for(var l,d=[],h=0;null!==(l=a(s,c));){var p=String(l[0]);d[h]=p,""===p&&(s.lastIndex=o(c,i(s.lastIndex),f)),h++}return 0===h?null:d}]}))},9121:(t,e,n)=>{"use strict";var r=n(486),i=n(7583),o=n(8087),a=n(5845),u=n(178),s=n(2968),c=Math.max,f=Math.min,l=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g;n(6719)("replace",2,(function(t,e,n,p){return[function(r,i){var o=t(this),a=null==r?void 0:r[e];return void 0!==a?a.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=p(n,t,this,e);if(i.done)return i.value;var l=r(t),d=String(this),h="function"==typeof e;h||(e=String(e));var g=l.global;if(g){var y=l.unicode;l.lastIndex=0}for(var m=[];;){var b=s(l,d);if(null===b)break;if(m.push(b),!g)break;""===String(b[0])&&(l.lastIndex=u(d,o(l.lastIndex),y))}for(var _,x="",w=0,E=0;E<m.length;E++){b=m[E];for(var S=String(b[0]),A=c(f(a(b.index),d.length),0),T=[],I=1;I<b.length;I++)T.push(void 0===(_=b[I])?_:String(_));var N=b.groups;if(h){var O=[S].concat(T,A,d);void 0!==N&&O.push(N);var C=String(e.apply(void 0,O))}else C=v(S,d,A,T,N,e);A>=w&&(x+=d.slice(w,A)+C,w=A+S.length)}return x+d.slice(w)}];function v(t,e,r,o,a,u){var s=r+t.length,c=o.length,f=h;return void 0!==a&&(a=i(a),f=d),n.call(u,f,(function(n,i){var u;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(s);case"<":u=a[i.slice(1,-1)];break;default:var f=+i;if(0===f)return n;if(f>c){var d=l(f/10);return 0===d?n:d<=c?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):n}u=o[f-1]}return void 0===u?"":u}))}}))},914:(t,e,n)=>{"use strict";var r=n(486),i=n(6962),o=n(2968);n(6719)("search",1,(function(t,e,n,a){return[function(n){var r=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=a(n,t,this);if(e.done)return e.value;var u=r(t),s=String(this),c=u.lastIndex;i(c,0)||(u.lastIndex=0);var f=o(u,s);return i(u.lastIndex,c)||(u.lastIndex=c),null===f?-1:f.index}]}))},7742:(t,e,n)=>{"use strict";var r=n(8990),i=n(486),o=n(8713),a=n(178),u=n(8087),s=n(2968),c=n(9020),f=n(5338),l=Math.min,d=[].push,h=4294967295,p=!f((function(){RegExp(h,"y")}));n(6719)("split",2,(function(t,e,n,f){var v;return v="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,e){var i=String(this);if(void 0===t&&0===e)return[];if(!r(t))return n.call(i,t,e);for(var o,a,u,s=[],f=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,p=void 0===e?h:e>>>0,v=new RegExp(t.source,f+"g");(o=c.call(v,i))&&!((a=v.lastIndex)>l&&(s.push(i.slice(l,o.index)),o.length>1&&o.index<i.length&&d.apply(s,o.slice(1)),u=o[0].length,l=a,s.length>=p));)v.lastIndex===o.index&&v.lastIndex++;return l===i.length?!u&&v.test("")||s.push(""):s.push(i.slice(l)),s.length>p?s.slice(0,p):s}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:n.call(this,t,e)}:n,[function(n,r){var i=t(this),o=null==n?void 0:n[e];return void 0!==o?o.call(n,i,r):v.call(String(i),n,r)},function(t,e){var r=f(v,t,this,e,v!==n);if(r.done)return r.value;var c=i(t),d=String(this),g=o(c,RegExp),y=c.unicode,m=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(p?"y":"g"),b=new g(p?c:"^(?:"+c.source+")",m),_=void 0===e?h:e>>>0;if(0===_)return[];if(0===d.length)return null===s(b,d)?[d]:[];for(var x=0,w=0,E=[];w<d.length;){b.lastIndex=p?w:0;var S,A=s(b,p?d:d.slice(w));if(null===A||(S=l(u(b.lastIndex+(p?0:w)),d.length))===x)w=a(d,w,y);else{if(E.push(d.slice(x,w)),E.length===_)return E;for(var T=1;T<=A.length-1;T++)if(E.push(A[T]),E.length===_)return E;w=x=S}}return E.push(d.slice(x)),E}]}))},6408:(t,e,n)=>{"use strict";n(8686);var r=n(486),i=n(3649),o=n(1216),a="toString",u=/./.toString,s=function(t){n(6476)(RegExp.prototype,a,t,!0)};n(5338)((function(){return"/a/b"!=u.call({source:"a",flags:"b"})}))?s((function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)})):u.name!=a&&s((function(){return u.call(this)}))},429:(t,e,n)=>{"use strict";var r=n(3050),i=n(4664);t.exports=n(859)("Set",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},3157:(t,e,n)=>{"use strict";n(5264)("anchor",(function(t){return function(e){return t(this,"a","name",e)}}))},9791:(t,e,n)=>{"use strict";n(5264)("big",(function(t){return function(){return t(this,"big","","")}}))},2296:(t,e,n)=>{"use strict";n(5264)("blink",(function(t){return function(){return t(this,"blink","","")}}))},4555:(t,e,n)=>{"use strict";n(5264)("bold",(function(t){return function(){return t(this,"b","","")}}))},8316:(t,e,n)=>{"use strict";var r=n(7044),i=n(8016)(!1);r(r.P,"String",{codePointAt:function(t){return i(this,t)}})},7937:(t,e,n)=>{"use strict";var r=n(7044),i=n(8087),o=n(5692),a="endsWith",u="".endsWith;r(r.P+r.F*n(2910)(a),"String",{endsWith:function(t){var e=o(this,t,a),n=arguments.length>1?arguments[1]:void 0,r=i(e.length),s=void 0===n?r:Math.min(i(n),r),c=String(t);return u?u.call(e,c,s):e.slice(s-c.length,s)===c}})},6505:(t,e,n)=>{"use strict";n(5264)("fixed",(function(t){return function(){return t(this,"tt","","")}}))},4722:(t,e,n)=>{"use strict";n(5264)("fontcolor",(function(t){return function(e){return t(this,"font","color",e)}}))},9713:(t,e,n)=>{"use strict";n(5264)("fontsize",(function(t){return function(e){return t(this,"font","size",e)}}))},1028:(t,e,n)=>{var r=n(7044),i=n(9260),o=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,a=0;r>a;){if(e=+arguments[a++],i(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?o(e):o(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},637:(t,e,n)=>{"use strict";var r=n(7044),i=n(5692),o="includes";r(r.P+r.F*n(2910)(o),"String",{includes:function(t){return!!~i(this,t,o).indexOf(t,arguments.length>1?arguments[1]:void 0)}})},7392:(t,e,n)=>{"use strict";n(5264)("italics",(function(t){return function(){return t(this,"i","","")}}))},7938:(t,e,n)=>{"use strict";var r=n(8016)(!0);n(966)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},4687:(t,e,n)=>{"use strict";n(5264)("link",(function(t){return function(e){return t(this,"a","href",e)}}))},6818:(t,e,n)=>{var r=n(7044),i=n(8182),o=n(8087);r(r.S,"String",{raw:function(t){for(var e=i(t.raw),n=o(e.length),r=arguments.length,a=[],u=0;n>u;)a.push(String(e[u++])),u<r&&a.push(String(arguments[u]));return a.join("")}})},8219:(t,e,n)=>{var r=n(7044);r(r.P,"String",{repeat:n(5458)})},3684:(t,e,n)=>{"use strict";n(5264)("small",(function(t){return function(){return t(this,"small","","")}}))},9029:(t,e,n)=>{"use strict";var r=n(7044),i=n(8087),o=n(5692),a="startsWith",u="".startsWith;r(r.P+r.F*n(2910)(a),"String",{startsWith:function(t){var e=o(this,t,a),n=i(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return u?u.call(e,r,n):e.slice(n,n+r.length)===r}})},3339:(t,e,n)=>{"use strict";n(5264)("strike",(function(t){return function(){return t(this,"strike","","")}}))},4148:(t,e,n)=>{"use strict";n(5264)("sub",(function(t){return function(){return t(this,"sub","","")}}))},7754:(t,e,n)=>{"use strict";n(5264)("sup",(function(t){return function(){return t(this,"sup","","")}}))},5557:(t,e,n)=>{"use strict";n(4961)("trim",(function(t){return function(){return t(this,3)}}))},2825:(t,e,n)=>{"use strict";var r=n(7571),i=n(7384),o=n(1216),a=n(7044),u=n(6476),s=n(4278).KEY,c=n(5338),f=n(5570),l=n(5837),d=n(4316),h=n(341),p=n(7686),v=n(6262),g=n(6397),y=n(7183),m=n(486),b=n(1255),_=n(7583),x=n(8182),w=n(4467),E=n(8328),S=n(9055),A=n(3473),T=n(5385),I=n(3844),N=n(3886),O=n(9804),C=T.f,k=N.f,D=A.f,M=r.Symbol,R=r.JSON,P=R&&R.stringify,G=h("_hidden"),L=h("toPrimitive"),j={}.propertyIsEnumerable,F=f("symbol-registry"),U=f("symbols"),B=f("op-symbols"),z=Object.prototype,V="function"==typeof M&&!!I.f,W=r.QObject,H=!W||!W.prototype||!W.prototype.findChild,X=o&&c((function(){return 7!=S(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=C(z,e);r&&delete z[e],k(t,e,n),r&&t!==z&&k(z,e,r)}:k,q=function(t){var e=U[t]=S(M.prototype);return e._k=t,e},Y=V&&"symbol"==typeof M.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof M},K=function(t,e,n){return t===z&&K(B,e,n),m(t),e=w(e,!0),m(n),i(U,e)?(n.enumerable?(i(t,G)&&t[G][e]&&(t[G][e]=!1),n=S(n,{enumerable:E(0,!1)})):(i(t,G)||k(t,G,E(1,{})),t[G][e]=!0),X(t,e,n)):k(t,e,n)},Z=function(t,e){m(t);for(var n,r=g(e=x(e)),i=0,o=r.length;o>i;)K(t,n=r[i++],e[n]);return t},$=function(t){var e=j.call(this,t=w(t,!0));return!(this===z&&i(U,t)&&!i(B,t))&&(!(e||!i(this,t)||!i(U,t)||i(this,G)&&this[G][t])||e)},J=function(t,e){if(t=x(t),e=w(e,!0),t!==z||!i(U,e)||i(B,e)){var n=C(t,e);return!n||!i(U,e)||i(t,G)&&t[G][e]||(n.enumerable=!0),n}},Q=function(t){for(var e,n=D(x(t)),r=[],o=0;n.length>o;)i(U,e=n[o++])||e==G||e==s||r.push(e);return r},tt=function(t){for(var e,n=t===z,r=D(n?B:x(t)),o=[],a=0;r.length>a;)!i(U,e=r[a++])||n&&!i(z,e)||o.push(U[e]);return o};V||(u((M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(n){this===z&&e.call(B,n),i(this,G)&&i(this[G],t)&&(this[G][t]=!1),X(this,t,E(1,n))};return o&&H&&X(z,t,{configurable:!0,set:e}),q(t)}).prototype,"toString",(function(){return this._k})),T.f=J,N.f=K,n(6907).f=A.f=Q,n(4179).f=$,I.f=tt,o&&!n(2725)&&u(z,"propertyIsEnumerable",$,!0),p.f=function(t){return q(h(t))}),a(a.G+a.W+a.F*!V,{Symbol:M});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)h(et[nt++]);for(var rt=O(h.store),it=0;rt.length>it;)v(rt[it++]);a(a.S+a.F*!V,"Symbol",{for:function(t){return i(F,t+="")?F[t]:F[t]=M(t)},keyFor:function(t){if(!Y(t))throw TypeError(t+" is not a symbol!");for(var e in F)if(F[e]===t)return e},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!V,"Object",{create:function(t,e){return void 0===e?S(t):Z(S(t),e)},defineProperty:K,defineProperties:Z,getOwnPropertyDescriptor:J,getOwnPropertyNames:Q,getOwnPropertySymbols:tt});var ot=c((function(){I.f(1)}));a(a.S+a.F*ot,"Object",{getOwnPropertySymbols:function(t){return I.f(_(t))}}),R&&a(a.S+a.F*(!V||c((function(){var t=M();return"[null]"!=P([t])||"{}"!=P({a:t})||"{}"!=P(Object(t))}))),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(b(e)||void 0!==t)&&!Y(t))return y(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!Y(e))return e}),r[1]=e,P.apply(R,r)}}),M.prototype[L]||n(913)(M.prototype,L,M.prototype.valueOf),l(M,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},6349:(t,e,n)=>{"use strict";var r=n(7044),i=n(604),o=n(1541),a=n(486),u=n(9260),s=n(8087),c=n(1255),f=n(7571).ArrayBuffer,l=n(8713),d=o.ArrayBuffer,h=o.DataView,p=i.ABV&&f.isView,v=d.prototype.slice,g=i.VIEW,y="ArrayBuffer";r(r.G+r.W+r.F*(f!==d),{ArrayBuffer:d}),r(r.S+r.F*!i.CONSTR,y,{isView:function(t){return p&&p(t)||c(t)&&g in t}}),r(r.P+r.U+r.F*n(5338)((function(){return!new d(2).slice(1,void 0).byteLength})),y,{slice:function(t,e){if(void 0!==v&&void 0===e)return v.call(a(this),t);for(var n=a(this).byteLength,r=u(t,n),i=u(void 0===e?n:e,n),o=new(l(this,d))(s(i-r)),c=new h(this),f=new h(o),p=0;r<i;)f.setUint8(p++,c.getUint8(r++));return o}}),n(4412)(y)},3742:(t,e,n)=>{var r=n(7044);r(r.G+r.W+r.F*!n(604).ABV,{DataView:n(1541).DataView})},3421:(t,e,n)=>{n(1063)("Float32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},6144:(t,e,n)=>{n(1063)("Float64",8,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},9363:(t,e,n)=>{n(1063)("Int16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},8632:(t,e,n)=>{n(1063)("Int32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},9604:(t,e,n)=>{n(1063)("Int8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},3871:(t,e,n)=>{n(1063)("Uint16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},1838:(t,e,n)=>{n(1063)("Uint32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},2592:(t,e,n)=>{n(1063)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},9290:(t,e,n)=>{n(1063)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}),!0)},2214:(t,e,n)=>{"use strict";var r,i=n(7571),o=n(7622)(0),a=n(6476),u=n(4278),s=n(4643),c=n(1990),f=n(1255),l=n(4664),d=n(4664),h=!i.ActiveXObject&&"ActiveXObject"in i,p="WeakMap",v=u.getWeak,g=Object.isExtensible,y=c.ufstore,m=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},b={get:function(t){if(f(t)){var e=v(t);return!0===e?y(l(this,p)).get(t):e?e[this._i]:void 0}},set:function(t,e){return c.def(l(this,p),t,e)}},_=t.exports=n(859)(p,m,b,c,!0,!0);d&&h&&(s((r=c.getConstructor(m,p)).prototype,b),u.NEED=!0,o(["delete","has","get","set"],(function(t){var e=_.prototype,n=e[t];a(e,t,(function(e,i){if(f(e)&&!g(e)){this._f||(this._f=new r);var o=this._f[t](e,i);return"set"==t?this:o}return n.call(this,e,i)}))})))},498:(t,e,n)=>{"use strict";var r=n(1990),i=n(4664),o="WeakSet";n(859)(o,(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,o),t,!0)}},r,!1,!0)},7744:(t,e,n)=>{"use strict";var r=n(7044),i=n(6806),o=n(7583),a=n(8087),u=n(1464),s=n(6699);r(r.P,"Array",{flatMap:function(t){var e,n,r=o(this);return u(t),e=a(r.length),n=s(r,0),i(n,r,r,e,0,1,t,arguments[1]),n}}),n(4691)("flatMap")},5448:(t,e,n)=>{"use strict";var r=n(7044),i=n(4538)(!0);r(r.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(4691)("includes")},8938:(t,e,n)=>{var r=n(7044),i=n(6460)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},7819:(t,e,n)=>{var r=n(7044),i=n(8125),o=n(8182),a=n(5385),u=n(1395);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=o(t),s=a.f,c=i(r),f={},l=0;c.length>l;)void 0!==(n=s(r,e=c[l++]))&&u(f,e,n);return f}})},6572:(t,e,n)=>{var r=n(7044),i=n(6460)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},8228:(t,e,n)=>{"use strict";var r=n(7044),i=n(2845),o=n(7571),a=n(8713),u=n(909);r(r.P+r.R,"Promise",{finally:function(t){var e=a(this,i.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return u(e,t()).then((function(){return n}))}:t,n?function(n){return u(e,t()).then((function(){throw n}))}:t)}})},3336:(t,e,n)=>{"use strict";var r=n(7044),i=n(8261),o=n(2541),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},3718:(t,e,n)=>{"use strict";var r=n(7044),i=n(8261),o=n(2541),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},7831:(t,e,n)=>{"use strict";n(4961)("trimLeft",(function(t){return function(){return t(this,1)}}),"trimStart")},6642:(t,e,n)=>{"use strict";n(4961)("trimRight",(function(t){return function(){return t(this,2)}}),"trimEnd")},9956:(t,e,n)=>{n(6262)("asyncIterator")},4367:(t,e,n)=>{for(var r=n(163),i=n(9804),o=n(6476),a=n(7571),u=n(913),s=n(9740),c=n(341),f=c("iterator"),l=c("toStringTag"),d=s.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=i(h),v=0;v<p.length;v++){var g,y=p[v],m=h[y],b=a[y],_=b&&b.prototype;if(_&&(_[f]||u(_,f,d),_[l]||u(_,l,y),s[y]=d,m))for(g in r)_[g]||o(_,g,r[g],!0)}},4433:(t,e,n)=>{var r=n(7044),i=n(7225);r(r.G+r.B,{setImmediate:i.set,clearImmediate:i.clear})},110:(t,e,n)=>{var r=n(7571),i=n(7044),o=n(2541),a=[].slice,u=/MSIE .\./.test(o),s=function(t){return function(e,n){var r=arguments.length>2,i=!!r&&a.call(arguments,2);return t(r?function(){("function"==typeof e?e:Function(e)).apply(this,i)}:e,n)}};i(i.G+i.B+i.F*u,{setTimeout:s(r.setTimeout),setInterval:s(r.setInterval)})},4962:(t,e,n)=>{n(110),n(4433),n(4367),t.exports=n(2845)},5229:t=>{t.exports=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}},8356:t=>{t.exports=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}},8623:t=>{t.exports=function(t){var e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e}},3422:t=>{t.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}},5128:t=>{t.exports=function(){var t=new Float32Array(2);return t[0]=0,t[1]=0,t}},134:t=>{t.exports=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}},7223:(t,e,n)=>{t.exports=n(2274)},2274:t=>{t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}},6770:(t,e,n)=>{t.exports=n(236)},236:t=>{t.exports=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}},6064:t=>{t.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]}},2157:t=>{t.exports=1e-6},6922:(t,e,n)=>{t.exports=function(t,e){var n=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(n-o)<=r*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r*Math.max(1,Math.abs(i),Math.abs(a))};var r=n(2157)},6066:t=>{t.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]}},4860:t=>{t.exports=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}},7395:(t,e,n)=>{t.exports=function(t,e,n,i,o,a){var u,s;for(e||(e=2),n||(n=0),s=i?Math.min(i*e+n,t.length):t.length,u=n;u<s;u+=e)r[0]=t[u],r[1]=t[u+1],o(r,r,a),t[u]=r[0],t[u+1]=r[1];return t};var r=n(5128)()},4697:t=>{t.exports=function(t,e){var n=new Float32Array(2);return n[0]=t,n[1]=e,n}},7801:(t,e,n)=>{t.exports={EPSILON:n(2157),create:n(5128),clone:n(8623),fromValues:n(4697),copy:n(3422),set:n(6765),equals:n(6922),exactEquals:n(6066),add:n(5229),subtract:n(4186),sub:n(5302),multiply:n(3848),mul:n(1665),divide:n(236),div:n(6770),inverse:n(1873),min:n(6780),max:n(9564),rotate:n(8615),floor:n(4860),ceil:n(8356),round:n(7313),scale:n(6526),scaleAndAdd:n(7781),distance:n(2274),dist:n(7223),squaredDistance:n(6534),sqrDist:n(4969),length:n(360),len:n(2256),squaredLength:n(5476),sqrLen:n(508),negate:n(388),normalize:n(5927),dot:n(6064),cross:n(134),lerp:n(1099),random:n(679),transformMat2:n(367),transformMat2d:n(655),transformMat3:n(2730),transformMat4:n(4020),forEach:n(7395),limit:n(8709)}},1873:t=>{t.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}},2256:(t,e,n)=>{t.exports=n(360)},360:t=>{t.exports=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}},1099:t=>{t.exports=function(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}},8709:t=>{t.exports=function(t,e,n){var r=e[0]*e[0]+e[1]*e[1];if(r>n*n){var i=Math.sqrt(r);t[0]=e[0]/i*n,t[1]=e[1]/i*n}else t[0]=e[0],t[1]=e[1];return t}},9564:t=>{t.exports=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}},6780:t=>{t.exports=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}},1665:(t,e,n)=>{t.exports=n(3848)},3848:t=>{t.exports=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}},388:t=>{t.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t}},5927:t=>{t.exports=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t}},679:t=>{t.exports=function(t,e){e=e||1;var n=2*Math.random()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}},8615:t=>{t.exports=function(t,e,n){var r=Math.cos(n),i=Math.sin(n),o=e[0],a=e[1];return t[0]=o*r-a*i,t[1]=o*i+a*r,t}},7313:t=>{t.exports=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}},6526:t=>{t.exports=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}},7781:t=>{t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}},6765:t=>{t.exports=function(t,e,n){return t[0]=e,t[1]=n,t}},4969:(t,e,n)=>{t.exports=n(6534)},508:(t,e,n)=>{t.exports=n(5476)},6534:t=>{t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}},5476:t=>{t.exports=function(t){var e=t[0],n=t[1];return e*e+n*n}},5302:(t,e,n)=>{t.exports=n(4186)},4186:t=>{t.exports=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}},367:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t}},655:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}},2730:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}},4020:t=>{t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}},3039:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Symbol.for("INJECTION");function r(t,e,r,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i&&!Reflect.hasMetadata(n,this,e)&&Reflect.defineMetadata(n,r(),this,e),Reflect.hasMetadata(n,this,e)?Reflect.getMetadata(n,this,e):r()},set:function(t){Reflect.defineMetadata(n,t,this,e)}})}e.makePropertyInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.get(n)}),e)}}},e.makePropertyInjectNamedDecorator=function(t,e){return function(n,i){return function(o,a){r(o,a,(function(){return t.getNamed(n,i)}),e)}}},e.makePropertyInjectTaggedDecorator=function(t,e){return function(n,i,o){return function(a,u){r(a,u,(function(){return t.getTagged(n,i,o)}),e)}}},e.makePropertyMultiInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.getAll(n)}),e)}}}},1922:(t,e,n)=>{"use strict";var r=n(3039);e.Z=function(t,e){return void 0===e&&(e=!0),{lazyInject:r.makePropertyInjectDecorator(t,e),lazyInjectNamed:r.makePropertyInjectNamedDecorator(t,e),lazyInjectTagged:r.makePropertyInjectTaggedDecorator(t,e),lazyMultiInject:r.makePropertyMultiInjectDecorator(t,e)}}},626:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagProperty=e.tagParameter=e.decorate=void 0;var r=n(6078),i=n(295);function o(t,e,n,i,o){var a={},u="number"==typeof o,s=void 0!==o&&u?o.toString():n;if(u&&void 0!==n)throw new Error(r.INVALID_DECORATOR_OPERATION);Reflect.hasOwnMetadata(t,e)&&(a=Reflect.getMetadata(t,e));var c=a[s];if(Array.isArray(c))for(var f=0,l=c;f<l.length;f++){var d=l[f];if(d.key===i.key)throw new Error(r.DUPLICATED_METADATA+" "+d.key.toString())}else c=[];c.push(i),a[s]=c,Reflect.defineMetadata(t,a,e)}function a(t,e){Reflect.decorate(t,e)}function u(t,e){return function(n,r){e(n,r,t)}}e.tagParameter=function(t,e,n,r){o(i.TAGGED,t,e,r,n)},e.tagProperty=function(t,e,n){o(i.TAGGED_PROP,t.constructor,e,n)},e.decorate=function(t,e,n){"number"==typeof n?a([u(n,t)],e):"string"==typeof n?Reflect.decorate([t],e,n):a([t],e)}},6213:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.inject=e.LazyServiceIdentifer=void 0;var r=n(6078),i=n(295),o=n(5092),a=n(626),u=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}();e.LazyServiceIdentifer=u,e.inject=function(t){return function(e,n,u){if(void 0===t)throw new Error(r.UNDEFINED_INJECT_ANNOTATION(e.name));var s=new o.Metadata(i.INJECT_TAG,t);"number"==typeof u?a.tagParameter(e,n,u,s):a.tagProperty(e,n,s)}}},1773:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.injectable=void 0;var r=n(6078),i=n(295);e.injectable=function(){return function(t){if(Reflect.hasOwnMetadata(i.PARAM_TYPES,t))throw new Error(r.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(i.DESIGN_PARAM_TYPES,t)||[];return Reflect.defineMetadata(i.PARAM_TYPES,e,t),t}}},1528:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiInject=void 0;var r=n(295),i=n(5092),o=n(626);e.multiInject=function(t){return function(e,n,a){var u=new i.Metadata(r.MULTI_INJECT_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,u):o.tagProperty(e,n,u)}}},9817:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.named=void 0;var r=n(295),i=n(5092),o=n(626);e.named=function(t){return function(e,n,a){var u=new i.Metadata(r.NAMED_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,u):o.tagProperty(e,n,u)}}},1316:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.optional=void 0;var r=n(295),i=n(5092),o=n(626);e.optional=function(){return function(t,e,n){var a=new i.Metadata(r.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(t,e,n,a):o.tagProperty(t,e,a)}}},1971:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.postConstruct=void 0;var r=n(6078),i=n(295),o=n(5092);e.postConstruct=function(){return function(t,e,n){var a=new o.Metadata(i.POST_CONSTRUCT,e);if(Reflect.hasOwnMetadata(i.POST_CONSTRUCT,t.constructor))throw new Error(r.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(i.POST_CONSTRUCT,a,t.constructor)}}},9189:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagged=void 0;var r=n(5092),i=n(626);e.tagged=function(t,e){return function(n,o,a){var u=new r.Metadata(t,e);"number"==typeof a?i.tagParameter(n,o,a,u):i.tagProperty(n,o,u)}}},8245:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.targetName=void 0;var r=n(295),i=n(5092),o=n(626);e.targetName=function(t){return function(e,n,a){var u=new i.Metadata(r.NAME_TAG,t);o.tagParameter(e,n,a,u)}}},9235:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unmanaged=void 0;var r=n(295),i=n(5092),o=n(626);e.unmanaged=function(){return function(t,e,n){var a=new i.Metadata(r.UNMANAGED_TAG,!0);o.tagParameter(t,e,n,a)}}},683:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Binding=void 0;var r=n(7690),i=n(23),o=function(){function t(t,e){this.id=i.id(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=r.BindingTypeEnum.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===r.BindingScopeEnum.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},t}();e.Binding=o},3497:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingCount=void 0,e.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}},6078:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STACK_OVERFLOW=e.CIRCULAR_DEPENDENCY_IN_FACTORY=e.POST_CONSTRUCT_ERROR=e.MULTIPLE_POST_CONSTRUCT_METHODS=e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=e.ARGUMENTS_LENGTH_MISMATCH=e.INVALID_DECORATOR_OPERATION=e.INVALID_TO_SELF_VALUE=e.INVALID_FUNCTION_BINDING=e.INVALID_MIDDLEWARE_RETURN=e.NO_MORE_SNAPSHOTS_AVAILABLE=e.INVALID_BINDING_TYPE=e.NOT_IMPLEMENTED=e.CIRCULAR_DEPENDENCY=e.UNDEFINED_INJECT_ANNOTATION=e.MISSING_INJECT_ANNOTATION=e.MISSING_INJECTABLE_ANNOTATION=e.NOT_REGISTERED=e.CANNOT_UNBIND=e.AMBIGUOUS_MATCH=e.KEY_NOT_FOUND=e.NULL_ARGUMENT=e.DUPLICATED_METADATA=e.DUPLICATED_INJECTABLE_DECORATOR=void 0,e.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.",e.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:",e.NULL_ARGUMENT="NULL argument",e.KEY_NOT_FOUND="Key Not Found",e.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:",e.CANNOT_UNBIND="Could not unbind serviceIdentifier:",e.NOT_REGISTERED="No matching bindings found for serviceIdentifier:",e.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:",e.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:",e.UNDEFINED_INJECT_ANNOTATION=function(t){return"@inject called with undefined this could mean that the class "+t+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},e.CIRCULAR_DEPENDENCY="Circular dependency found:",e.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.",e.INVALID_BINDING_TYPE="Invalid binding type:",e.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.",e.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!",e.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!",e.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier",e.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",e.ARGUMENTS_LENGTH_MISMATCH=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."},e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",e.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class",e.POST_CONSTRUCT_ERROR=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"@postConstruct error in class "+t[0]+": "+t[1]},e.CIRCULAR_DEPENDENCY_IN_FACTORY=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"It looks like there is a circular dependency in one of the '"+t[0]+"' bindings. Please investigate bindings withservice identifier '"+t[1]+"'."},e.STACK_OVERFLOW="Maximum call stack size exceeded"},7690:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TargetTypeEnum=e.BindingTypeEnum=e.BindingScopeEnum=void 0,e.BindingScopeEnum={Request:"Request",Singleton:"Singleton",Transient:"Transient"},e.BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},e.TargetTypeEnum={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"}},295:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NON_CUSTOM_TAG_KEYS=e.POST_CONSTRUCT=e.DESIGN_PARAM_TYPES=e.PARAM_TYPES=e.TAGGED_PROP=e.TAGGED=e.MULTI_INJECT_TAG=e.INJECT_TAG=e.OPTIONAL_TAG=e.UNMANAGED_TAG=e.NAME_TAG=e.NAMED_TAG=void 0,e.NAMED_TAG="named",e.NAME_TAG="name",e.UNMANAGED_TAG="unmanaged",e.OPTIONAL_TAG="optional",e.INJECT_TAG="inject",e.MULTI_INJECT_TAG="multi_inject",e.TAGGED="inversify:tagged",e.TAGGED_PROP="inversify:tagged_props",e.PARAM_TYPES="inversify:paramtypes",e.DESIGN_PARAM_TYPES="design:paramtypes",e.POST_CONSTRUCT="post_construct",e.NON_CUSTOM_TAG_KEYS=[e.INJECT_TAG,e.MULTI_INJECT_TAG,e.NAME_TAG,e.UNMANAGED_TAG,e.NAMED_TAG,e.OPTIONAL_TAG]},596:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},o=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Container=void 0;var a=n(683),u=n(6078),s=n(7690),c=n(295),f=n(3870),l=n(4142),d=n(9386),h=n(3313),p=n(23),v=n(9552),g=n(1878),y=n(2543),m=function(){function t(t){this._appliedMiddleware=[];var e=t||{};if("object"!=typeof e)throw new Error(""+u.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(void 0===e.defaultScope)e.defaultScope=s.BindingScopeEnum.Transient;else if(e.defaultScope!==s.BindingScopeEnum.Singleton&&e.defaultScope!==s.BindingScopeEnum.Transient&&e.defaultScope!==s.BindingScopeEnum.Request)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=p.id(),this._bindingDictionary=new y.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new f.MetadataReader}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var a=new t,u=o([e,n],r).map((function(t){return l.getBindingDictionary(t)})),s=l.getBindingDictionary(a);function c(t,e){t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))}return u.forEach((function(t){c(t,s)})),a},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],a=n(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r(this,void 0,void 0,(function(){var e,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,i.label=1;case 1:return n<r.length?(o=r[n],a=e(o.id),[4,o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=function(t){return function(e){return e.moduleId===t}};e.forEach((function(e){var n=r(e.id);t._bindingDictionary.removeByCondition(n)}))},t.prototype.bind=function(t){var e=this.options.defaultScope||s.BindingScopeEnum.Transient,n=new a.Binding(t,e);return this._bindingDictionary.add(t,n),new h.BindingToSyntax(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error(u.CANNOT_UNBIND+" "+v.getServiceIdentifierAsString(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new y.Lookup},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,c.NAMED_TAG,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=l.createMockRequest(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(g.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error(u.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._appliedMiddleware=this._appliedMiddleware.concat(t);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,s.TargetTypeEnum.Variable,t)},t.prototype.getTagged=function(t,e,n){return this._get(!1,!1,s.TargetTypeEnum.Variable,t,e,n)},t.prototype.getNamed=function(t,e){return this.getTagged(t,c.NAMED_TAG,e)},t.prototype.getAll=function(t){return this._get(!0,!0,s.TargetTypeEnum.Variable,t)},t.prototype.getAllTagged=function(t,e,n){return this._get(!1,!0,s.TargetTypeEnum.Variable,t,e,n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,c.NAMED_TAG,e)},t.prototype.resolve=function(t){var e=this.createChild();return e.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){e.applyMiddleware(t)})),e.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind.bind(t)(r);return e(i,n),i}};return function(r){return{bindFunction:(i=r,function(n){var r=t.bind.bind(t)(n);return e(r,i),r}),isboundFunction:function(e){return t.isBound.bind(t)(e)},rebindFunction:n(r),unbindFunction:function(e){t.unbind.bind(t)(e)}};var i}},t.prototype._get=function(t,e,n,r,i,o){var a=null,s={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:e,key:i,serviceIdentifier:r,targetType:n,value:o};if(this._middleware){if(null==(a=this._middleware(s)))throw new Error(u.INVALID_MIDDLEWARE_RETURN)}else a=this._planAndResolve()(s);return a},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=l.plan(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return n=e.contextInterceptor(n),d.resolve(n)}},t}();e.Container=m},2913:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncContainerModule=e.ContainerModule=void 0;var r=n(23);e.ContainerModule=function(t){this.id=r.id(),this.registry=t};e.AsyncContainerModule=function(t){this.id=r.id(),this.registry=t}},1878:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContainerSnapshot=void 0;var n=function(){function t(){}return t.of=function(e,n){var r=new t;return r.bindings=e,r.middleware=n,r},t}();e.ContainerSnapshot=n},2543:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Lookup=void 0;var r=n(6078),i=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(r.NULL_ARGUMENT);if(null==e)throw new Error(r.NULL_ARGUMENT);var n=this._map.get(t);void 0!==n?(n.push(e),this._map.set(t,n)):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(r.KEY_NOT_FOUND)},t.prototype.remove=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);if(!this._map.delete(t))throw new Error(r.KEY_NOT_FOUND)},t.prototype.removeByCondition=function(t){var e=this;this._map.forEach((function(n,r){var i=n.filter((function(e){return!t(e)}));i.length>0?e._map.set(r,i):e._map.delete(r)}))},t.prototype.hasKey=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,t.clone())}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t}();e.Lookup=i},9311:(t,e,n)=>{"use strict";e.f3=e.t6=e.b2=e.W2=void 0,n(295);var r=n(596);Object.defineProperty(e,"W2",{enumerable:!0,get:function(){return r.Container}});n(7690),n(2913);var i=n(1773);Object.defineProperty(e,"b2",{enumerable:!0,get:function(){return i.injectable}});n(9189);var o=n(9817);Object.defineProperty(e,"t6",{enumerable:!0,get:function(){return o.named}});var a=n(6213);Object.defineProperty(e,"f3",{enumerable:!0,get:function(){return a.inject}});n(1316),n(9235),n(1528),n(8245),n(1971),n(3870),n(23),n(626),n(3140),n(9552),n(4384)},1519:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Context=void 0;var r=n(23),i=function(){function t(t){this.id=r.id(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}();e.Context=i},5092:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var r=n(295),i=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===r.NAMED_TAG?"named: "+this.value.toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+this.value+" }"},t}();e.Metadata=i},3870:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetadataReader=void 0;var r=n(295),i=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(r.PARAM_TYPES,t),userGeneratedMetadata:Reflect.getMetadata(r.TAGGED,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(r.TAGGED_PROP,t)||[]},t}();e.MetadataReader=i},6335:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=void 0;e.Plan=function(t,e){this.parentContext=t,this.rootRequest=e}},4142:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBindingDictionary=e.createMockRequest=e.plan=void 0;var r=n(3497),i=n(6078),o=n(7690),a=n(295),u=n(2542),s=n(9552),c=n(1519),f=n(5092),l=n(6335),d=n(6664),h=n(4810),p=n(9660);function v(t){return t._bindingDictionary}function g(t,e,n,o,a){var u,c=m(n.container,a.serviceIdentifier);return c.length===r.BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof a.serviceIdentifier&&t.getConstructorMetadata(a.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(a.serviceIdentifier).toSelf(),c=m(n.container,a.serviceIdentifier)),u=e?c:c.filter((function(t){var e=new h.Request(t.serviceIdentifier,n,o,t,a);return t.constraint(e)})),function(t,e,n,o){switch(e.length){case r.BindingCount.NoBindingsAvailable:if(n.isOptional())return e;var a=s.getServiceIdentifierAsString(t),u=i.NOT_REGISTERED;throw u+=s.listMetadataForTarget(a,n),u+=s.listRegisteredBindingsForServiceIdentifier(o,a,m),new Error(u);case r.BindingCount.OnlyOneBindingAvailable:if(!n.isArray())return e;case r.BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return e;throw a=s.getServiceIdentifierAsString(t),u=i.AMBIGUOUS_MATCH+" "+a,u+=s.listRegisteredBindingsForServiceIdentifier(o,a,m),new Error(u)}}(a.serviceIdentifier,u,a,n.container),u}function y(t,e,n,r,a,u){var s,c;if(null===a){s=g(t,e,r,null,u),c=new h.Request(n,r,null,s,u);var f=new l.Plan(r,c);r.addPlan(f)}else s=g(t,e,r,a,u),c=a.addChildRequest(u.serviceIdentifier,s,u);s.forEach((function(e){var n=null;if(u.isArray())n=c.addChildRequest(e.serviceIdentifier,e,u);else{if(e.cache)return;n=c}if(e.type===o.BindingTypeEnum.Instance&&null!==e.implementationType){var a=d.getDependencies(t,e.implementationType);if(!r.container.options.skipBaseClassChecks){var s=d.getBaseClassDependencyCount(t,e.implementationType);if(a.length<s){var f=i.ARGUMENTS_LENGTH_MISMATCH(d.getFunctionName(e.implementationType));throw new Error(f)}}a.forEach((function(e){y(t,!1,e.serviceIdentifier,r,n,e)}))}}))}function m(t,e){var n=[],r=v(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=m(t.parent,e)),n}e.getBindingDictionary=v,e.plan=function(t,e,n,r,i,o,l,d){void 0===d&&(d=!1);var h=new c.Context(e),v=function(t,e,n,r,i,o){var u=t?a.MULTI_INJECT_TAG:a.INJECT_TAG,s=new f.Metadata(u,n),c=new p.Target(e,"",n,s);if(void 0!==i){var l=new f.Metadata(i,o);c.metadata.push(l)}return c}(n,r,i,0,o,l);try{return y(t,d,i,h,null,v),h}catch(t){throw u.isStackOverflowExeption(t)&&h.plan&&s.circularDependencyToException(h.plan.rootRequest),t}},e.createMockRequest=function(t,e,n,r){var i=new p.Target(o.TargetTypeEnum.Variable,"",e,new f.Metadata(n,r)),a=new c.Context(t);return new h.Request(e,a,null,[],i)}},8634:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QueryableString=void 0;var n=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}();e.QueryableString=n},6664:function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.getFunctionName=e.getBaseClassDependencyCount=e.getDependencies=void 0;var i=n(6213),o=n(6078),a=n(7690),u=n(295),s=n(9552);Object.defineProperty(e,"getFunctionName",{enumerable:!0,get:function(){return s.getFunctionName}});var c=n(9660);function f(t,e,n,i){var a=t.getConstructorMetadata(n),u=a.compilerGeneratedMetadata;if(void 0===u){var s=o.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(s)}var c=a.userGeneratedMetadata,f=Object.keys(c),h=0===n.length&&f.length>0,p=f.length>n.length,v=function(t,e,n,r,i){for(var o=[],a=0;a<i;a++){var u=l(a,t,e,n,r);null!==u&&o.push(u)}return o}(i,e,u,c,h||p?f.length:n.length),g=d(t,n);return r(r([],v),g)}function l(t,e,n,r,u){var s=u[t.toString()]||[],f=h(s),l=!0!==f.unmanaged,d=r[t];if((d=f.inject||f.multiInject||d)instanceof i.LazyServiceIdentifer&&(d=d.unwrap()),l){if(!e&&(d===Object||d===Function||void 0===d)){var p=o.MISSING_INJECT_ANNOTATION+" argument "+t+" in class "+n+".";throw new Error(p)}var v=new c.Target(a.TargetTypeEnum.ConstructorArgument,f.targetName,d);return v.metadata=s,v}return null}function d(t,e){for(var n=t.getPropertiesMetadata(e),i=[],o=0,u=Object.keys(n);o<u.length;o++){var s=u[o],f=n[s],l=h(n[s]),p=l.targetName||s,v=l.inject||l.multiInject,g=new c.Target(a.TargetTypeEnum.ClassProperty,p,v);g.metadata=f,i.push(g)}var y=Object.getPrototypeOf(e.prototype).constructor;if(y!==Object){var m=d(t,y);i=r(r([],i),m)}return i}function h(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[u.INJECT_TAG],multiInject:e[u.MULTI_INJECT_TAG],targetName:e[u.NAME_TAG],unmanaged:e[u.UNMANAGED_TAG]}}e.getDependencies=function(t,e){return f(t,s.getFunctionName(e),e,!1)},e.getBaseClassDependencyCount=function t(e,n){var r=Object.getPrototypeOf(n.prototype).constructor;if(r!==Object){var i=f(e,s.getFunctionName(r),r,!0),o=i.map((function(t){return t.metadata.filter((function(t){return t.key===u.UNMANAGED_TAG}))})),a=[].concat.apply([],o).length,c=i.length-a;return c>0?c:t(e,r)}return 0}},4810:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Request=void 0;var r=n(23),i=function(){function t(t,e,n,i,o){this.id=r.id(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();e.Request=i},9660:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Target=void 0;var r=n(295),i=n(23),o=n(5092),a=n(8634),u=function(){function t(t,e,n,u){this.id=i.id(),this.type=t,this.serviceIdentifier=n,this.name=new a.QueryableString(e||""),this.metadata=new Array;var s=null;"string"==typeof u?s=new o.Metadata(r.NAMED_TAG,u):u instanceof o.Metadata&&(s=u),null!==s&&this.metadata.push(s)}return t.prototype.hasTag=function(t){for(var e=0,n=this.metadata;e<n.length;e++)if(n[e].key===t)return!0;return!1},t.prototype.isArray=function(){return this.hasTag(r.MULTI_INJECT_TAG)},t.prototype.matchesArray=function(t){return this.matchesTag(r.MULTI_INJECT_TAG)(t)},t.prototype.isNamed=function(){return this.hasTag(r.NAMED_TAG)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(r.OPTIONAL_TAG)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===r.NAMED_TAG}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(r.NAMED_TAG)(t)},t.prototype.matchesTag=function(t){var e=this;return function(n){for(var r=0,i=e.metadata;r<i.length;r++){var o=i[r];if(o.key===t&&o.value===n)return!0}return!1}},t}();e.Target=u},8544:function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveInstance=void 0;var i=n(6078),o=n(7690),a=n(295);e.resolveInstance=function(t,e,n){var u,s,c=null;e.length>0?(s=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ConstructorArgument})).map(n),c=function(t,e,n){var r=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ClassProperty})),i=r.map(n);return r.forEach((function(e,n){var r;r=e.target.name.value();var o=i[n];t[r]=o})),t}(c=new((u=t).bind.apply(u,r([void 0],s))),e,n)):c=new t;return function(t,e){if(Reflect.hasMetadata(a.POST_CONSTRUCT,t)){var n=Reflect.getMetadata(a.POST_CONSTRUCT,t);try{e[n.value]()}catch(e){throw new Error(i.POST_CONSTRUCT_ERROR(t.name,e.message))}}}(t,c),c}},9386:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolve=void 0;var r=n(6078),i=n(7690),o=n(2542),a=n(9552),u=n(8544),s=function(t,e,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(r.CIRCULAR_DEPENDENCY_IN_FACTORY(t,e.toString())):n}},c=function(t){return function(e){e.parentContext.setCurrentRequest(e);var n=e.bindings,o=e.childRequests,f=e.target&&e.target.isArray(),l=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(f&&l)return o.map((function(e){return c(t)(e)}));var d=null;if(!e.target.isOptional()||0!==n.length){var h=n[0],p=h.scope===i.BindingScopeEnum.Singleton,v=h.scope===i.BindingScopeEnum.Request;if(p&&h.activated)return h.cache;if(v&&null!==t&&t.has(h.id))return t.get(h.id);if(h.type===i.BindingTypeEnum.ConstantValue)d=h.cache,h.activated=!0;else if(h.type===i.BindingTypeEnum.Function)d=h.cache,h.activated=!0;else if(h.type===i.BindingTypeEnum.Constructor)d=h.implementationType;else if(h.type===i.BindingTypeEnum.DynamicValue&&null!==h.dynamicValue)d=s("toDynamicValue",h.serviceIdentifier,(function(){return h.dynamicValue(e.parentContext)}));else if(h.type===i.BindingTypeEnum.Factory&&null!==h.factory)d=s("toFactory",h.serviceIdentifier,(function(){return h.factory(e.parentContext)}));else if(h.type===i.BindingTypeEnum.Provider&&null!==h.provider)d=s("toProvider",h.serviceIdentifier,(function(){return h.provider(e.parentContext)}));else{if(h.type!==i.BindingTypeEnum.Instance||null===h.implementationType){var g=a.getServiceIdentifierAsString(e.serviceIdentifier);throw new Error(r.INVALID_BINDING_TYPE+" "+g)}d=u.resolveInstance(h.implementationType,o,c(t))}return"function"==typeof h.onActivation&&(d=h.onActivation(e.parentContext,d)),p&&(h.cache=d,h.activated=!0),v&&null!==t&&!t.has(h.id)&&t.set(h.id,d),d}}};e.resolve=function(t){return c(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}},1640:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInSyntax=void 0;var r=n(7690),i=n(6890),o=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=r.BindingScopeEnum.Request,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=r.BindingScopeEnum.Singleton,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=r.BindingScopeEnum.Transient,new i.BindingWhenOnSyntax(this._binding)},t}();e.BindingInSyntax=o},2386:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInWhenOnSyntax=void 0;var r=n(1640),i=n(8926),o=n(2700),a=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding),this._bindingInSyntax=new r.BindingInSyntax(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingInWhenOnSyntax=a},8926:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingOnSyntax=void 0;var r=n(2700),i=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new r.BindingWhenSyntax(this._binding)},t}();e.BindingOnSyntax=i},3313:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingToSyntax=void 0;var r=n(6078),i=n(7690),o=n(2386),a=n(6890),u=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=i.BindingTypeEnum.Instance,this._binding.implementationType=t,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+r.INVALID_TO_SELF_VALUE);var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=i.BindingTypeEnum.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=i.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=i.BindingTypeEnum.Constructor,this._binding.implementationType=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error(r.INVALID_FUNCTION_BINDING);var e=this.toConstantValue(t);return this._binding.type=i.BindingTypeEnum.Function,this._binding.scope=i.BindingScopeEnum.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=i.BindingTypeEnum.Provider,this._binding.provider=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}();e.BindingToSyntax=u},6890:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenOnSyntax=void 0;var r=n(8926),i=n(2700),o=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new i.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new r.BindingOnSyntax(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingWhenOnSyntax=o},2700:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenSyntax=void 0;var r=n(8926),i=n(3140),o=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=i.namedConstraint(t),new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=i.taggedConstraint(t)(e),new r.BindingOnSyntax(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return i.typeConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return i.namedConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return i.taggedConstraint(t)(e)(n.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return!i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t}();e.BindingWhenSyntax=o},3140:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.typeConstraint=e.namedConstraint=e.taggedConstraint=e.traverseAncerstors=void 0;var r=n(295),i=n(5092),o=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||o(n,e))};e.traverseAncerstors=o;var a=function(t){return function(e){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(t)(e)};return n.metaData=new i.Metadata(t,e),n}};e.taggedConstraint=a;var u=a(r.NAMED_TAG);e.namedConstraint=u,e.typeConstraint=function(t){return function(e){var n=null;if(null!==e){if(n=e.bindings[0],"string"==typeof t)return n.serviceIdentifier===t;var r=e.bindings[0].implementationType;return t===r}return!1}}},4384:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=void 0,e.multiBindToService=function(t){return function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return n.forEach((function(n){return t.bind(n).toService(e)}))}}}},2542:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isStackOverflowExeption=void 0;var r=n(6078);e.isStackOverflowExeption=function(t){return t instanceof RangeError||t.message===r.STACK_OVERFLOW}},23:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id=void 0;var n=0;e.id=function(){return n++}},9552:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.circularDependencyToException=e.listMetadataForTarget=e.listRegisteredBindingsForServiceIdentifier=e.getServiceIdentifierAsString=e.getFunctionName=void 0;var r=n(6078);function i(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function o(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||o(t.parentRequest,e))}function a(t){if(t.name)return t.name;var e=t.toString(),n=e.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+e}e.getServiceIdentifierAsString=i,e.listRegisteredBindingsForServiceIdentifier=function(t,e,n){var r="",i=n(t,e);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(t){var e="Object";null!==t.implementationType&&(e=a(t.implementationType)),r=r+"\n "+e,t.constraint.metaData&&(r=r+" - "+t.constraint.metaData)}))),r},e.circularDependencyToException=function t(e){e.childRequests.forEach((function(e){if(o(e,e.serviceIdentifier)){var n=function(t){return function t(e,n){void 0===n&&(n=[]);var r=i(e.serviceIdentifier);return n.push(r),null!==e.parentRequest?t(e.parentRequest,n):n}(t).reverse().join(" --\x3e ")}(e);throw new Error(r.CIRCULAR_DEPENDENCY+" "+n)}t(e)}))},e.listMetadataForTarget=function(t,e){if(e.isTagged()||e.isNamed()){var n="",r=e.getNamedTag(),i=e.getCustomTags();return null!==r&&(n+=r.toString()+"\n"),null!==i&&i.forEach((function(t){n+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+n}return" "+t},e.getFunctionName=a},1739:(t,e,n)=>{var r=n(5229),i=n(6765),o=n(5927),a=n(4186),u=n(6064),s=[0,0];t.exports.x7=function(t,e,n,a,c){return r(t,n,a),o(t,t),i(e,-t[1],t[0]),i(s,-n[1],n[0]),c/u(e,s)},t.exports.mJ=function(t,e){return i(t,-e[1],e[0]),t},t.exports.o7=function(t,e,n){return a(t,e,n),o(t,t),t}},8892:(t,e,n)=>{var r;!function(t){!function(e){var r="object"==typeof n.g?n.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=o(t);function o(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===r.Reflect?r.Reflect=t:i=o(r.Reflect,i),function(t){var e=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,a={__proto__:[]}instanceof Array,u=!o&&!a,s={create:o?function(){return P(Object.create(null))}:a?function(){return P({__proto__:null})}:function(){return P({})},has:u?function(t,n){return e.call(t,n)}:function(t,e){return e in t},get:u?function(t,n){return e.call(t,n)?t[n]:void 0}:function(t,e){return t[e]}},c=Object.getPrototypeOf(Function),f="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,l=f||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[i]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,o)},e.prototype.entries=function(){return new n(this._keys,this._values,a)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[i]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function a(t,e){return[t,e]}}():Map,d=f||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){function t(){this._map=new l}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[i]=function(){return this.keys()},t}():Set,h=new(f||"function"!=typeof WeakMap?function(){var t=s.create(),n=r();return function(){function t(){this._key=r()}return t.prototype.has=function(t){var e=i(t,!1);return void 0!==e&&s.has(e,this._key)},t.prototype.get=function(t){var e=i(t,!1);return void 0!==e?s.get(e,this._key):void 0},t.prototype.set=function(t,e){return i(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=i(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=r()},t}();function r(){var e;do{e="@@WeakMap@@"+a()}while(s.has(t,e));return t[e]=!0,e}function i(t,r){if(!e.call(t,n)){if(!r)return;Object.defineProperty(t,n,{value:s.create()})}return t[n]}function o(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function a(){var t,e=(t=16,"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):o(new Uint8Array(t),t):o(new Array(t),t));e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<16;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}():WeakMap);function p(t,e,n){var r=h.get(t);if(E(r)){if(!n)return;r=new l,h.set(t,r)}var i=r.get(e);if(E(i)){if(!n)return;i=new l,r.set(e,i)}return i}function v(t,e,n){if(g(t,e,n))return!0;var r=R(e);return!S(r)&&v(t,r,n)}function g(t,e,n){var r=p(e,n,!1);return!E(r)&&!!r.has(t)}function y(t,e,n){if(g(t,e,n))return m(t,e,n);var r=R(e);return S(r)?void 0:y(t,r,n)}function m(t,e,n){var r=p(e,n,!1);if(!E(r))return r.get(t)}function b(t,e,n,r){p(n,r,!0).set(t,e)}function _(t,e){var n=x(t,e),r=R(t);if(null===r)return n;var i=_(r,e);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new d,a=[],u=0,s=n;u<s.length;u++){var c=s[u];o.has(c)||(o.add(c),a.push(c))}for(var f=0,l=i;f<l.length;f++)c=l[f],o.has(c)||(o.add(c),a.push(c));return a}function x(t,e){var n=[],r=p(t,e,!1);if(E(r))return n;for(var o=function(t){var e=k(t,i);if(!O(e))throw new TypeError;var n=e.call(t);if(!A(n))throw new TypeError;return n}(r.keys()),a=0;;){var u=D(o);if(!u)return n.length=a,n;var s=u.value;try{n[a]=s}catch(t){try{M(o)}finally{throw t}}a++}}function w(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function E(t){return void 0===t}function S(t){return null===t}function A(t){return"object"==typeof t?null!==t:"function"==typeof t}function T(t,e){switch(w(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",i=k(t,r);if(void 0!==i){var o=i.call(t,n);if(A(o))throw new TypeError;return o}return function(t,e){if("string"===e){var n=t.toString;if(O(n)&&!A(i=n.call(t)))return i;if(O(r=t.valueOf)&&!A(i=r.call(t)))return i}else{var r;if(O(r=t.valueOf)&&!A(i=r.call(t)))return i;var i,o=t.toString;if(O(o)&&!A(i=o.call(t)))return i}throw new TypeError}(t,"default"===n?"number":n)}function I(t){var e=T(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function N(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function O(t){return"function"==typeof t}function C(t){return"function"==typeof t}function k(t,e){var n=t[e];if(null!=n){if(!O(n))throw new TypeError;return n}}function D(t){var e=t.next();return!e.done&&e}function M(t){var e=t.return;e&&e.call(t)}function R(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===c)return e;if(e!==c)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function P(t){return t.__=void 0,delete t.__,t}t("decorate",(function(t,e,n,r){if(E(n)){if(!N(t))throw new TypeError;if(!C(e))throw new TypeError;return function(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!E(r)&&!S(r)){if(!C(r))throw new TypeError;e=r}}return e}(t,e)}if(!N(t))throw new TypeError;if(!A(e))throw new TypeError;if(!A(r)&&!E(r)&&!S(r))throw new TypeError;return S(r)&&(r=void 0),function(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!E(o)&&!S(o)){if(!A(o))throw new TypeError;r=o}}return r}(t,e,n=I(n),r)})),t("metadata",(function(t,e){return function(n,r){if(!A(n))throw new TypeError;if(!E(r)&&!function(t){switch(w(t)){case 3:case 4:return!0;default:return!1}}(r))throw new TypeError;b(t,e,n,r)}})),t("defineMetadata",(function(t,e,n,r){if(!A(n))throw new TypeError;return E(r)||(r=I(r)),b(t,e,n,r)})),t("hasMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),v(t,e,n)})),t("hasOwnMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),g(t,e,n)})),t("getMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),y(t,e,n)})),t("getOwnMetadata",(function(t,e,n){if(!A(e))throw new TypeError;return E(n)||(n=I(n)),m(t,e,n)})),t("getMetadataKeys",(function(t,e){if(!A(t))throw new TypeError;return E(e)||(e=I(e)),_(t,e)})),t("getOwnMetadataKeys",(function(t,e){if(!A(t))throw new TypeError;return E(e)||(e=I(e)),x(t,e)})),t("deleteMetadata",(function(t,e,n){if(!A(e))throw new TypeError;E(n)||(n=I(n));var r=p(e,n,!1);if(E(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=h.get(e);return i.delete(n),i.size>0||h.delete(e),!0}))}(i)}()}(r||(r={}))},5375:t=>{var e=function(t){"use strict";var e,n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),u=new O(r||[]);return i(a,"_invoke",{value:A(t,n,u)}),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var d="suspendedStart",h="executing",p="completed",v={};function g(){}function y(){}function m(){}var b={};c(b,a,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(C([])));x&&x!==n&&r.call(x,a)&&(b=x);var w=m.prototype=g.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(i,o,a,u){var s=l(t[i],t,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(s.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function A(t,e,n){var r=d;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===p){if("throw"===i)throw o;return k()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=T(a,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var s=l(t,e,n);if("normal"===s.type){if(r=n.done?p:"suspendedYield",s.arg===v)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=p,n.method="throw",n.arg=s.arg)}}}function T(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=l(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function I(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 N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function C(t){if(t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}return{next:k}}function k(){return{value:e,done:!0}}return y.prototype=m,i(w,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:y,configurable:!0}),y.displayName=c(m,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,c(t,s,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},E(S.prototype),c(S.prototype,u,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(f(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(w),c(w,s,"Generator"),c(w,a,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(N),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return u.type="throw",u.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;N(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},6377:function(t){t.exports=function(){"use strict";var t=function(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array||t instanceof Uint8ClampedArray},e=function(t,e){for(var n=Object.keys(e),r=0;r<n.length;++r)t[n[r]]=e[n[r]];return t},n="\n";function r(t){var e=new Error("(regl) "+t);throw console.error(e),e}function i(t,e){t||r(e)}function o(t){return t?": "+t:""}function a(t,e){switch(e){case"number":return"number"==typeof t;case"object":return"object"==typeof t;case"string":return"string"==typeof t;case"boolean":return"boolean"==typeof t;case"function":return"function"==typeof t;case"undefined":return void 0===t;case"symbol":return"symbol"==typeof t}}function u(t,e,n){e.indexOf(t)<0&&r("invalid value"+o(n)+". must be one of: "+e)}var s=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function c(t,e){for(t+="";t.length<e;)t=" "+t;return t}function f(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function l(t,e){this.number=t,this.line=e,this.errors=[]}function d(t,e,n){this.file=t,this.line=e,this.message=n}function h(){var t=new Error,e=(t.stack||t).toString(),n=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(e);if(n)return n[1];var r=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(e);return r?r[1]:"unknown"}function p(){var t=new Error,e=(t.stack||t).toString(),n=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(e);if(n)return n[1];var r=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(e);return r?r[1]:"unknown"}function v(t,e){var n,r=t.split("\n"),i=1,o=0,a={unknown:new f,0:new f};a.unknown.name=a[0].name=e||h(),a.unknown.lines.push(new l(0,""));for(var u=0;u<r.length;++u){var s=r[u],c=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(s);if(c)switch(c[1]){case"line":var d=/(\d+)(\s+\d+)?/.exec(c[2]);d&&(i=0|d[1],d[2]&&((o=0|d[2])in a||(a[o]=new f)));break;case"define":var p=/SHADER_NAME(_B64)?\s+(.*)$/.exec(c[2]);p&&(a[o].name=p[1]?(n=p[2],"undefined"!=typeof atob?atob(n):"base64:"+n):p[2])}a[o].lines.push(new l(i++,s))}return Object.keys(a).forEach((function(t){var e=a[t];e.lines.forEach((function(t){e.index[t.number]=t}))})),a}function g(t){t._commandRef=h()}function y(t,e){var n=p();r(t+" in command "+(e||h())+("unknown"===n?"":" called from "+n))}function m(t,e,n,r){a(t,e)||y("invalid parameter type"+o(n)+". expected "+e+", got "+typeof t,r||h())}var b=33071,_={};function x(t,e){return 32820===t||32819===t||33635===t?2:34042===t?4:_[t]*e}function w(t){return!(t&t-1||!t)}_[5120]=_[5121]=1,_[5122]=_[5123]=_[36193]=_[33635]=_[32819]=_[32820]=2,_[5124]=_[5125]=_[5126]=_[34042]=4;var E=e(i,{optional:function(t){t()},raise:r,commandRaise:y,command:function(t,e,n){t||y(e,n||h())},parameter:function(t,e,n){t in e||r("unknown parameter ("+t+")"+o(n)+". possible values: "+Object.keys(e).join())},commandParameter:function(t,e,n,r){t in e||y("unknown parameter ("+t+")"+o(n)+". possible values: "+Object.keys(e).join(),r||h())},constructor:function(t){Object.keys(t).forEach((function(t){s.indexOf(t)<0&&r('invalid regl constructor argument "'+t+'". must be one of '+s)}))},type:function(t,e,n){a(t,e)||r("invalid parameter type"+o(n)+". expected "+e+", got "+typeof t)},commandType:m,isTypedArray:function(e,n){t(e)||r("invalid parameter type"+o(n)+". must be a typed array")},nni:function(t,e){t>=0&&(0|t)===t||r("invalid parameter type, ("+t+")"+o(e)+". must be a nonnegative integer")},oneOf:u,shaderError:function(t,e,r,o,a){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var u=t.getShaderInfoLog(e),s=o===t.FRAGMENT_SHADER?"fragment":"vertex";m(r,"string",s+" shader source must be a string",a);var f=v(r,a),l=function(t){var e=[];return t.split("\n").forEach((function(t){if(!(t.length<5)){var n=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(t);n?e.push(new d(0|n[1],0|n[2],n[3].trim())):t.length>0&&e.push(new d("unknown",0,t))}})),e}(u);(function(t,e){e.forEach((function(e){var n=t[e.file];if(n){var r=n.index[e.line];if(r)return r.errors.push(e),void(n.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)}))})(f,l),Object.keys(f).forEach((function(t){var e=f[t];if(e.hasErrors){var r=[""],i=[""];o("file number "+t+": "+e.name+"\n","color:red;text-decoration:underline;font-weight:bold"),e.lines.forEach((function(t){if(t.errors.length>0){o(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),o(t.line+n,"color:red; background-color:yellow; font-weight:bold");var e=0;t.errors.forEach((function(r){var i=r.message,a=/^\s*'(.*)'\s*:\s*(.*)$/.exec(i);if(a){var u=a[1];i=a[2],"assign"===u&&(u="="),e=Math.max(t.line.indexOf(u,e),0)}else e=0;o(c("| ",6)),o(c("^^^",e+3)+n,"font-weight:bold"),o(c("| ",6)),o(i+n,"font-weight:bold")})),o(c("| ",6)+n)}else o(c(t.number,4)+"| "),o(t.line+n,"color:red")})),"undefined"==typeof document||window.chrome?console.log(r.join("")):(i[0]=r.join("%c"),console.log.apply(console,i))}function o(t,e){r.push(t),i.push(e||"")}})),i.raise("Error compiling "+s+" shader, "+f[0].name)}},linkError:function(t,e,r,o,a){if(!t.getProgramParameter(e,t.LINK_STATUS)){var u=t.getProgramInfoLog(e),s=v(r,a),c='Error linking program with vertex shader, "'+v(o,a)[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+c+"\n%c"+u,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(c+n+u),i.raise(c)}},callSite:p,saveCommandRef:g,saveDrawInfo:function(t,e,n,r){function i(t){return t?r.id(t):0}function o(t,e){Object.keys(e).forEach((function(e){t[r.id(e)]=!0}))}g(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var a=t._uniformSet={};o(a,e.static),o(a,e.dynamic);var u=t._attributeSet={};o(u,n.static),o(u,n.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic},framebufferFormat:function(t,e,n){t.texture?u(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):u(t.renderbuffer._renderbuffer.format,n,"unsupported renderbuffer format for attachment")},guessCommand:h,texture2D:function(t,e,n){var r,o=e.width,a=e.height,u=e.channels;i(o>0&&o<=n.maxTextureSize&&a>0&&a<=n.maxTextureSize,"invalid texture shape"),t.wrapS===b&&t.wrapT===b||i(w(o)&&w(a),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==o&&1!==a&&i(9984!==t.minFilter&&9986!==t.minFilter&&9985!==t.minFilter&&9987!==t.minFilter,"min filter requires mipmap"):(i(w(o)&&w(a),"texture must be a square power of 2 to support mipmapping"),i(e.mipmask===(o<<1)-1,"missing or incomplete mipmap data")),5126===e.type&&(n.extensions.indexOf("oes_texture_float_linear")<0&&i(9728===t.minFilter&&9728===t.magFilter,"filter not supported, must enable oes_texture_float_linear"),i(!t.genMipmaps,"mipmap generation not supported with float textures"));var s=e.images;for(r=0;r<16;++r)if(s[r]){var c=o>>r,f=a>>r;i(e.mipmask&1<<r,"missing mipmap data");var l=s[r];if(i(l.width===c&&l.height===f,"invalid shape for mip images"),i(l.format===e.format&&l.internalformat===e.internalformat&&l.type===e.type,"incompatible type for mip image"),l.compressed);else if(l.data){var d=Math.ceil(x(l.type,u)*c/l.unpackAlignment)*l.unpackAlignment;i(l.data.byteLength===d*f,"invalid data for image, buffer size is inconsistent with image format")}else l.element||l.copy}else t.genMipmaps||i(0==(e.mipmask&1<<r),"extra mipmap data");e.compressed&&i(!t.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(t,e,n,r){var o=t.width,a=t.height,u=t.channels;i(o>0&&o<=r.maxTextureSize&&a>0&&a<=r.maxTextureSize,"invalid texture shape"),i(o===a,"cube map must be square"),i(e.wrapS===b&&e.wrapT===b,"wrap mode not supported by cube map");for(var s=0;s<n.length;++s){var c=n[s];i(c.width===o&&c.height===a,"inconsistent cube map face shape"),e.genMipmaps&&(i(!c.compressed,"can not generate mipmap for compressed textures"),i(1===c.mipmask,"can not specify mipmaps and generate mipmaps"));for(var f=c.images,l=0;l<16;++l){var d=f[l];if(d){var h=o>>l,p=a>>l;i(c.mipmask&1<<l,"missing mipmap data"),i(d.width===h&&d.height===p,"invalid shape for mip images"),i(d.format===t.format&&d.internalformat===t.internalformat&&d.type===t.type,"incompatible type for mip image"),d.compressed||(d.data?i(d.data.byteLength===h*p*Math.max(x(d.type,u),d.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):d.element||d.copy)}}}}}),S=0;function A(t,e){this.id=S++,this.type=t,this.data=e}function T(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function I(t){if(0===t.length)return[];var e=t.charAt(0),n=t.charAt(t.length-1);if(t.length>1&&e===n&&('"'===e||"'"===e))return['"'+T(t.substr(1,t.length-2))+'"'];var r=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(r)return I(t.substr(0,r.index)).concat(I(r[1])).concat(I(t.substr(r.index+r[0].length)));var i=t.split(".");if(1===i.length)return['"'+T(t)+'"'];for(var o=[],a=0;a<i.length;++a)o=o.concat(I(i[a]));return o}function N(t){return"["+I(t).join("][")+"]"}var O={DynamicVariable:A,define:function(t,e){return new A(t,N(e+""))},isDynamic:function(t){return"function"==typeof t&&!t._reglType||t instanceof A},unbox:function t(e,n){return"function"==typeof e?new A(0,e):"number"==typeof e||"boolean"==typeof e?new A(5,e):Array.isArray(e)?new A(6,e.map(((e,r)=>t(e,n+"["+r+"]")))):e instanceof A?e:void E(!1,"invalid option type in uniform "+n)},accessor:N},C={next:"function"==typeof requestAnimationFrame?function(t){return requestAnimationFrame(t)}:function(t){return setTimeout(t,16)},cancel:"function"==typeof cancelAnimationFrame?function(t){return cancelAnimationFrame(t)}:clearTimeout},k="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date};function D(t){return"string"==typeof t?t.split():(E(Array.isArray(t),"invalid extension array"),t)}function M(t){return"string"==typeof t?(E("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(t)):t}function R(t){var n,r,i,o,a,u=t||{},s={},c=[],f=[],l="undefined"==typeof window?1:window.devicePixelRatio,d=!1,h=function(t){t&&E.raise(t)},p=function(){};if("string"==typeof u?(E("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),n=document.querySelector(u),E(n,"invalid query string for element")):"object"==typeof u?"string"==typeof(a=u).nodeName&&"function"==typeof a.appendChild&&"function"==typeof a.getBoundingClientRect?n=u:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(u)?i=(o=u).canvas:(E.constructor(u),"gl"in u?o=u.gl:"canvas"in u?i=M(u.canvas):"container"in u&&(r=M(u.container)),"attributes"in u&&(s=u.attributes,E.type(s,"object","invalid context attributes")),"extensions"in u&&(c=D(u.extensions)),"optionalExtensions"in u&&(f=D(u.optionalExtensions)),"onDone"in u&&(E.type(u.onDone,"function","invalid or missing onDone callback"),h=u.onDone),"profile"in u&&(d=!!u.profile),"pixelRatio"in u&&(l=+u.pixelRatio,E(l>0,"invalid pixel ratio"))):E.raise("invalid arguments to regl"),n&&("canvas"===n.nodeName.toLowerCase()?i=n:r=n),!o){if(!i){E("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var v=function(t,n,r){var i,o=document.createElement("canvas");function a(){var n=window.innerWidth,i=window.innerHeight;if(t!==document.body){var a=t.getBoundingClientRect();n=a.right-a.left,i=a.bottom-a.top}o.width=r*n,o.height=r*i,e(o.style,{width:n+"px",height:i+"px"})}return e(o.style,{border:0,margin:0,padding:0,top:0,left:0}),t.appendChild(o),t===document.body&&(o.style.position="absolute",e(t.style,{margin:0,padding:0})),t!==document.body&&"function"==typeof ResizeObserver?(i=new ResizeObserver((function(){setTimeout(a)}))).observe(t):window.addEventListener("resize",a,!1),a(),{canvas:o,onDestroy:function(){i?i.disconnect():window.removeEventListener("resize",a),t.removeChild(o)}}}(r||document.body,0,l);if(!v)return null;i=v.canvas,p=v.onDestroy}void 0===s.premultipliedAlpha&&(s.premultipliedAlpha=!0),o=function(t,e){function n(n){try{return t.getContext(n,e)}catch(t){return null}}return n("webgl")||n("experimental-webgl")||n("webgl-experimental")}(i,s)}return o?{gl:o,canvas:i,container:r,extensions:c,optionalExtensions:f,pixelRatio:l,profile:d,onDone:h,onDestroy:p}:(p(),h("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function P(t,e){for(var n=Array(t),r=0;r<t;++r)n[r]=e(r);return n}function G(t){var e,n;return e=(t>65535)<<4,e|=n=((t>>>=e)>255)<<3,e|=n=((t>>>=n)>15)<<2,(e|=n=((t>>>=n)>3)<<1)|(t>>>=n)>>1}function L(){var t=P(8,(function(){return[]}));function e(e){var n=function(t){for(var e=16;e<=1<<28;e*=16)if(t<=e)return e;return 0}(e),r=t[G(n)>>2];return r.length>0?r.pop():new ArrayBuffer(n)}function n(e){t[G(e.byteLength)>>2].push(e)}return{alloc:e,free:n,allocType:function(t,n){var r=null;switch(t){case 5120:r=new Int8Array(e(n),0,n);break;case 5121:r=new Uint8Array(e(n),0,n);break;case 5122:r=new Int16Array(e(2*n),0,n);break;case 5123:r=new Uint16Array(e(2*n),0,n);break;case 5124:r=new Int32Array(e(4*n),0,n);break;case 5125:r=new Uint32Array(e(4*n),0,n);break;case 5126:r=new Float32Array(e(4*n),0,n);break;default:return null}return r.length!==n?r.subarray(0,n):r},freeType:function(t){n(t.buffer)}}}var j=L();j.zero=L();var F=3553,U=6408,B=5126,z=36160;function V(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||t(e.data))}var W=function(t){return Object.keys(t).map((function(e){return t[e]}))},H={shape:function(t){for(var e=[],n=t;n.length;n=n[0])e.push(n.length);return e},flatten:function(t,e,n,r){var i=1;if(e.length)for(var o=0;o<e.length;++o)i*=e[o];else i=0;var a=r||j.allocType(n,i);switch(e.length){case 0:break;case 1:!function(t,e,n){for(var r=0;r<e;++r)n[r]=t[r]}(t,e[0],a);break;case 2:!function(t,e,n,r){for(var i=0,o=0;o<e;++o)for(var a=t[o],u=0;u<n;++u)r[i++]=a[u]}(t,e[0],e[1],a);break;case 3:X(t,e[0],e[1],e[2],a,0);break;default:q(t,e,0,a,0)}return a}};function X(t,e,n,r,i,o){for(var a=o,u=0;u<e;++u)for(var s=t[u],c=0;c<n;++c)for(var f=s[c],l=0;l<r;++l)i[a++]=f[l]}function q(t,e,n,r,i){for(var o=1,a=n+1;a<e.length;++a)o*=e[a];var u=e[n];if(e.length-n==4){var s=e[n+1],c=e[n+2],f=e[n+3];for(a=0;a<u;++a)X(t[a],s,c,f,r,i),i+=o}else for(a=0;a<u;++a)q(t[a],e,n+1,r,i),i+=o}var Y={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},K={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Z={dynamic:35048,stream:35040,static:35044},$=H.flatten,J=H.shape,Q=5121,tt=5126,et=[];function nt(t){return 0|Y[Object.prototype.toString.call(t)]}function rt(t,e){for(var n=0;n<e.length;++n)t[n]=e[n]}function it(t,e,n,r,i,o,a){for(var u=0,s=0;s<n;++s)for(var c=0;c<r;++c)t[u++]=e[i*s+o*c+a]}et[5120]=1,et[5122]=2,et[5124]=4,et[5121]=1,et[5123]=2,et[5125]=4,et[5126]=4;var ot={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},at=5121,ut=5123,st=5125,ct=34963;var ft=new Float32Array(1),lt=new Uint32Array(ft.buffer);function dt(t){for(var e=j.allocType(5123,t.length),n=0;n<t.length;++n)if(isNaN(t[n]))e[n]=65535;else if(t[n]===1/0)e[n]=31744;else if(t[n]===-1/0)e[n]=64512;else{ft[0]=t[n];var r=lt[0],i=r>>>31<<15,o=(r<<1>>>24)-127,a=r>>13&1023;if(o<-24)e[n]=i;else if(o<-14){var u=-14-o;e[n]=i+(a+1024>>u)}else e[n]=o>15?i+31744:i+(o+15<<10)+a}return e}function ht(e){return Array.isArray(e)||t(e)}var pt=function(t){return!(t&t-1||!t)},vt=3553,gt=34067,yt=34069,mt=6408,bt=6406,_t=6407,xt=6409,wt=6410,Et=32855,St=6402,At=34041,Tt=35904,It=35906,Nt=36193,Ot=33776,Ct=33777,kt=33778,Dt=33779,Mt=5121,Rt=5123,Pt=5125,Gt=5126,Lt=33071,jt=9728,Ft=9984,Ut=9987,Bt=4352,zt=33984,Vt=[Ft,9986,9985,Ut],Wt=[0,xt,wt,_t,mt],Ht={};function Xt(t){return"[object "+t+"]"}Ht[6409]=Ht[6406]=Ht[6402]=1,Ht[34041]=Ht[6410]=2,Ht[6407]=Ht[35904]=3,Ht[6408]=Ht[35906]=4;var qt=Xt("HTMLCanvasElement"),Yt=Xt("OffscreenCanvas"),Kt=Xt("CanvasRenderingContext2D"),Zt=Xt("ImageBitmap"),$t=Xt("HTMLImageElement"),Jt=Xt("HTMLVideoElement"),Qt=Object.keys(Y).concat([qt,Yt,Kt,Zt,$t,Jt]),te=[];te[5121]=1,te[5126]=4,te[36193]=2,te[5123]=2,te[5125]=4;var ee=[];function ne(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function re(t){return!!Array.isArray(t)&&!(0===t.length||!ht(t[0]))}function ie(t){return Object.prototype.toString.call(t)}function oe(t){return ie(t)===qt}function ae(t){return ie(t)===Yt}function ue(t){if(!t)return!1;var e=ie(t);return Qt.indexOf(e)>=0||ne(t)||re(t)||V(t)}function se(t){return 0|Y[Object.prototype.toString.call(t)]}function ce(t,e){return j.allocType(t.type===Nt?Gt:t.type,e)}function fe(t,e){t.type===Nt?(t.data=dt(e),j.freeType(e)):t.data=e}function le(t,e,n,r,i,o){var a;if(a=void 0!==ee[t]?ee[t]:Ht[t]*te[e],o&&(a*=6),i){for(var u=0,s=n;s>=1;)u+=a*s*s,s/=2;return u}return a*n*r}function de(n,r,i,o,a,u,s){var c={"don't care":Bt,"dont care":Bt,nice:4354,fast:4353},f={repeat:10497,clamp:Lt,mirror:33648},l={nearest:jt,linear:9729},d=e({mipmap:Ut,"nearest mipmap nearest":Ft,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":Ut},l),h={none:0,browser:37444},p={uint8:Mt,rgba4:32819,rgb565:33635,"rgb5 a1":32820},v={alpha:bt,luminance:xt,"luminance alpha":wt,rgb:_t,rgba:mt,rgba4:32854,"rgb5 a1":Et,rgb565:36194},g={};r.ext_srgb&&(v.srgb=Tt,v.srgba=It),r.oes_texture_float&&(p.float32=p.float=Gt),r.oes_texture_half_float&&(p.float16=p["half float"]=Nt),r.webgl_depth_texture&&(e(v,{depth:St,"depth stencil":At}),e(p,{uint16:Rt,uint32:Pt,"depth stencil":34042})),r.webgl_compressed_texture_s3tc&&e(g,{"rgb s3tc dxt1":Ot,"rgba s3tc dxt1":Ct,"rgba s3tc dxt3":kt,"rgba s3tc dxt5":Dt}),r.webgl_compressed_texture_atc&&e(g,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798}),r.webgl_compressed_texture_pvrtc&&e(g,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843}),r.webgl_compressed_texture_etc1&&(g["rgb etc1"]=36196);var y=Array.prototype.slice.call(n.getParameter(34467));Object.keys(g).forEach((function(t){var e=g[t];y.indexOf(e)>=0&&(v[t]=e)}));var m=Object.keys(v);i.textureFormats=m;var b=[];Object.keys(v).forEach((function(t){var e=v[t];b[e]=t}));var _=[];Object.keys(p).forEach((function(t){var e=p[t];_[e]=t}));var x=[];Object.keys(l).forEach((function(t){x[l[t]]=t}));var w=[];Object.keys(d).forEach((function(t){var e=d[t];w[e]=t}));var S=[];Object.keys(f).forEach((function(t){S[f[t]]=t}));var A=m.reduce((function(t,e){var n=v[e];return n===xt||n===bt||n===xt||n===wt||n===St||n===At||r.ext_srgb&&(n===Tt||n===It)?t[n]=n:n===Et||e.indexOf("rgba")>=0?t[n]=mt:t[n]=_t,t}),{});function T(){this.internalformat=mt,this.format=mt,this.type=Mt,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=37444,this.width=0,this.height=0,this.channels=0}function I(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function N(t,e){if("object"==typeof e&&e){if("premultiplyAlpha"in e&&(E.type(e.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=e.premultiplyAlpha),"flipY"in e&&(E.type(e.flipY,"boolean","invalid texture flip"),t.flipY=e.flipY),"alignment"in e&&(E.oneOf(e.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=e.alignment),"colorSpace"in e&&(E.parameter(e.colorSpace,h,"invalid colorSpace"),t.colorSpace=h[e.colorSpace]),"type"in e){var n=e.type;E(r.oes_texture_float||!("float"===n||"float32"===n),"you must enable the OES_texture_float extension in order to use floating point textures."),E(r.oes_texture_half_float||!("half float"===n||"float16"===n),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),E(r.webgl_depth_texture||!("uint16"===n||"uint32"===n||"depth stencil"===n),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),E.parameter(n,p,"invalid texture type"),t.type=p[n]}var o=t.width,a=t.height,u=t.channels,s=!1;"shape"in e?(E(Array.isArray(e.shape)&&e.shape.length>=2,"shape must be an array"),o=e.shape[0],a=e.shape[1],3===e.shape.length&&(u=e.shape[2],E(u>0&&u<=4,"invalid number of channels"),s=!0),E(o>=0&&o<=i.maxTextureSize,"invalid width"),E(a>=0&&a<=i.maxTextureSize,"invalid height")):("radius"in e&&(o=a=e.radius,E(o>=0&&o<=i.maxTextureSize,"invalid radius")),"width"in e&&(o=e.width,E(o>=0&&o<=i.maxTextureSize,"invalid width")),"height"in e&&(a=e.height,E(a>=0&&a<=i.maxTextureSize,"invalid height")),"channels"in e&&(u=e.channels,E(u>0&&u<=4,"invalid number of channels"),s=!0)),t.width=0|o,t.height=0|a,t.channels=0|u;var c=!1;if("format"in e){var f=e.format;E(r.webgl_depth_texture||!("depth"===f||"depth stencil"===f),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),E.parameter(f,v,"invalid texture format");var l=t.internalformat=v[f];t.format=A[l],f in p&&("type"in e||(t.type=p[f])),f in g&&(t.compressed=!0),c=!0}!s&&c?t.channels=Ht[t.format]:s&&!c?t.channels!==Wt[t.format]&&(t.format=t.internalformat=Wt[t.channels]):c&&s&&E(t.channels===Ht[t.format],"number of channels inconsistent with specified format")}}function O(t){n.pixelStorei(37440,t.flipY),n.pixelStorei(37441,t.premultiplyAlpha),n.pixelStorei(37443,t.colorSpace),n.pixelStorei(3317,t.unpackAlignment)}function C(){T.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function k(e,n){var r=null;if(ue(n)?r=n:n&&(E.type(n,"object","invalid pixel data type"),N(e,n),"x"in n&&(e.xOffset=0|n.x),"y"in n&&(e.yOffset=0|n.y),ue(n.data)&&(r=n.data)),E(!e.compressed||r instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),n.copy){E(!r,"can not specify copy and data field for the same texture");var o=a.viewportWidth,u=a.viewportHeight;e.width=e.width||o-e.xOffset,e.height=e.height||u-e.yOffset,e.needsCopy=!0,E(e.xOffset>=0&&e.xOffset<o&&e.yOffset>=0&&e.yOffset<u&&e.width>0&&e.width<=o&&e.height>0&&e.height<=u,"copy texture read out of bounds")}else if(r){if(t(r))e.channels=e.channels||4,e.data=r,"type"in n||e.type!==Mt||(e.type=se(r));else if(ne(r))e.channels=e.channels||4,function(t,e){var n=e.length;switch(t.type){case Mt:case Rt:case Pt:case Gt:var r=j.allocType(t.type,n);r.set(e),t.data=r;break;case Nt:t.data=dt(e);break;default:E.raise("unsupported texture type, must specify a typed array")}}(e,r),e.alignment=1,e.needsFree=!0;else if(V(r)){var s=r.data;Array.isArray(s)||e.type!==Mt||(e.type=se(s));var c,f,l,d,h,p,v=r.shape,g=r.stride;3===v.length?(l=v[2],p=g[2]):(E(2===v.length,"invalid ndarray pixel data, must be 2 or 3D"),l=1,p=1),c=v[0],f=v[1],d=g[0],h=g[1],e.alignment=1,e.width=c,e.height=f,e.channels=l,e.format=e.internalformat=Wt[l],e.needsFree=!0,function(t,e,n,r,i,o){for(var a=t.width,u=t.height,s=t.channels,c=ce(t,a*u*s),f=0,l=0;l<u;++l)for(var d=0;d<a;++d)for(var h=0;h<s;++h)c[f++]=e[n*d+r*l+i*h+o];fe(t,c)}(e,s,d,h,p,r.offset)}else if(oe(r)||ae(r)||ie(r)===Kt)oe(r)||ae(r)?e.element=r:e.element=r.canvas,e.width=e.element.width,e.height=e.element.height,e.channels=4;else if(function(t){return ie(t)===Zt}(r))e.element=r,e.width=r.width,e.height=r.height,e.channels=4;else if(function(t){return ie(t)===$t}(r))e.element=r,e.width=r.naturalWidth,e.height=r.naturalHeight,e.channels=4;else if(function(t){return ie(t)===Jt}(r))e.element=r,e.width=r.videoWidth,e.height=r.videoHeight,e.channels=4;else if(re(r)){var y=e.width||r[0].length,m=e.height||r.length,b=e.channels;b=ht(r[0][0])?b||r[0][0].length:b||1;for(var _=H.shape(r),x=1,w=0;w<_.length;++w)x*=_[w];var S=ce(e,x);H.flatten(r,_,"",S),fe(e,S),e.alignment=1,e.width=y,e.height=m,e.channels=b,e.format=e.internalformat=Wt[b],e.needsFree=!0}}else e.width=e.width||1,e.height=e.height||1,e.channels=e.channels||4;e.type===Gt?E(i.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):e.type===Nt&&E(i.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function D(t,e,r){var i=t.element,a=t.data,u=t.internalformat,s=t.format,c=t.type,f=t.width,l=t.height;O(t),i?n.texImage2D(e,r,s,s,c,i):t.compressed?n.compressedTexImage2D(e,r,u,f,l,0,a):t.needsCopy?(o(),n.copyTexImage2D(e,r,s,t.xOffset,t.yOffset,f,l,0)):n.texImage2D(e,r,s,f,l,0,s,c,a||null)}function M(t,e,r,i,a){var u=t.element,s=t.data,c=t.internalformat,f=t.format,l=t.type,d=t.width,h=t.height;O(t),u?n.texSubImage2D(e,a,r,i,f,l,u):t.compressed?n.compressedTexSubImage2D(e,a,r,i,c,d,h,s):t.needsCopy?(o(),n.copyTexSubImage2D(e,a,r,i,t.xOffset,t.yOffset,d,h)):n.texSubImage2D(e,a,r,i,d,h,f,l,s)}var R=[];function P(){return R.pop()||new C}function G(t){t.needsFree&&j.freeType(t.data),C.call(t),R.push(t)}function L(){T.call(this),this.genMipmaps=!1,this.mipmapHint=Bt,this.mipmask=0,this.images=Array(16)}function F(t,e,n){var r=t.images[0]=P();t.mipmask=1,r.width=t.width=e,r.height=t.height=n,r.channels=t.channels=4}function U(t,e){var n=null;if(ue(e))I(n=t.images[0]=P(),t),k(n,e),t.mipmask=1;else if(N(t,e),Array.isArray(e.mipmap))for(var r=e.mipmap,i=0;i<r.length;++i)I(n=t.images[i]=P(),t),n.width>>=i,n.height>>=i,k(n,r[i]),t.mipmask|=1<<i;else I(n=t.images[0]=P(),t),k(n,e),t.mipmask=1;I(t,t.images[0]),!t.compressed||t.internalformat!==Ot&&t.internalformat!==Ct&&t.internalformat!==kt&&t.internalformat!==Dt||E(t.width%4==0&&t.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function B(t,e){for(var n=t.images,r=0;r<n.length;++r){if(!n[r])return;D(n[r],e,r)}}var z=[];function X(){var t=z.pop()||new L;T.call(t),t.mipmask=0;for(var e=0;e<16;++e)t.images[e]=null;return t}function q(t){for(var e=t.images,n=0;n<e.length;++n)e[n]&&G(e[n]),e[n]=null;z.push(t)}function Y(){this.minFilter=jt,this.magFilter=jt,this.wrapS=Lt,this.wrapT=Lt,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Bt}function K(t,e){if("min"in e){var n=e.min;E.parameter(n,d),t.minFilter=d[n],Vt.indexOf(t.minFilter)>=0&&!("faces"in e)&&(t.genMipmaps=!0)}if("mag"in e){var r=e.mag;E.parameter(r,l),t.magFilter=l[r]}var o=t.wrapS,a=t.wrapT;if("wrap"in e){var u=e.wrap;"string"==typeof u?(E.parameter(u,f),o=a=f[u]):Array.isArray(u)&&(E.parameter(u[0],f),E.parameter(u[1],f),o=f[u[0]],a=f[u[1]])}else{if("wrapS"in e){var s=e.wrapS;E.parameter(s,f),o=f[s]}if("wrapT"in e){var h=e.wrapT;E.parameter(h,f),a=f[h]}}if(t.wrapS=o,t.wrapT=a,"anisotropic"in e){var p=e.anisotropic;E("number"==typeof p&&p>=1&&p<=i.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var v=!1;switch(typeof e.mipmap){case"string":E.parameter(e.mipmap,c,"invalid mipmap hint"),t.mipmapHint=c[e.mipmap],t.genMipmaps=!0,v=!0;break;case"boolean":v=t.genMipmaps=e.mipmap;break;case"object":E(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,v=!0;break;default:E.raise("invalid mipmap type")}v&&!("min"in e)&&(t.minFilter=Ft)}}function Z(t,e){n.texParameteri(e,10241,t.minFilter),n.texParameteri(e,10240,t.magFilter),n.texParameteri(e,10242,t.wrapS),n.texParameteri(e,10243,t.wrapT),r.ext_texture_filter_anisotropic&&n.texParameteri(e,34046,t.anisotropic),t.genMipmaps&&(n.hint(33170,t.mipmapHint),n.generateMipmap(e))}var $=0,J={},Q=i.maxTextureUnits,tt=Array(Q).map((function(){return null}));function et(t){T.call(this),this.mipmask=0,this.internalformat=mt,this.id=$++,this.refCount=1,this.target=t,this.texture=n.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Y,s.profile&&(this.stats={size:0})}function nt(t){n.activeTexture(zt),n.bindTexture(t.target,t.texture)}function rt(){var t=tt[0];t?n.bindTexture(t.target,t.texture):n.bindTexture(vt,null)}function it(t){var e=t.texture;E(e,"must not double destroy texture");var r=t.unit,i=t.target;r>=0&&(n.activeTexture(zt+r),n.bindTexture(i,null),tt[r]=null),n.deleteTexture(e),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete J[t.id],u.textureCount--}return e(et.prototype,{bind:function(){var t=this;t.bindCount+=1;var e=t.unit;if(e<0){for(var r=0;r<Q;++r){var i=tt[r];if(i){if(i.bindCount>0)continue;i.unit=-1}tt[r]=t,e=r;break}e>=Q&&E.raise("insufficient number of texture units"),s.profile&&u.maxTextureUnits<e+1&&(u.maxTextureUnits=e+1),t.unit=e,n.activeTexture(zt+e),n.bindTexture(t.target,t.texture)}return e},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&it(this)}}),s.profile&&(u.getTotalTextureSize=function(){var t=0;return Object.keys(J).forEach((function(e){t+=J[e].stats.size})),t}),{create2D:function(t,e){var r=new et(vt);function o(t,e){var n=r.texInfo;Y.call(n);var a=X();return"number"==typeof t?F(a,0|t,"number"==typeof e?0|e:0|t):t?(E.type(t,"object","invalid arguments to regl.texture"),K(n,t),U(a,t)):F(a,1,1),n.genMipmaps&&(a.mipmask=(a.width<<1)-1),r.mipmask=a.mipmask,I(r,a),E.texture2D(n,a,i),r.internalformat=a.internalformat,o.width=a.width,o.height=a.height,nt(r),B(a,vt),Z(n,vt),rt(),q(a),s.profile&&(r.stats.size=le(r.internalformat,r.type,a.width,a.height,n.genMipmaps,!1)),o.format=b[r.internalformat],o.type=_[r.type],o.mag=x[n.magFilter],o.min=w[n.minFilter],o.wrapS=S[n.wrapS],o.wrapT=S[n.wrapT],o}return J[r.id]=r,u.textureCount++,o(t,e),o.subimage=function(t,e,n,i){E(!!t,"must specify image data");var a=0|e,u=0|n,s=0|i,c=P();return I(c,r),c.width=0,c.height=0,k(c,t),c.width=c.width||(r.width>>s)-a,c.height=c.height||(r.height>>s)-u,E(r.type===c.type&&r.format===c.format&&r.internalformat===c.internalformat,"incompatible format for texture.subimage"),E(a>=0&&u>=0&&a+c.width<=r.width&&u+c.height<=r.height,"texture.subimage write out of bounds"),E(r.mipmask&1<<s,"missing mipmap data"),E(c.data||c.element||c.needsCopy,"missing image data"),nt(r),M(c,vt,a,u,s),rt(),G(c),o},o.resize=function(t,e){var i=0|t,a=0|e||i;if(i===r.width&&a===r.height)return o;o.width=r.width=i,o.height=r.height=a,nt(r);for(var u=0;r.mipmask>>u;++u){var c=i>>u,f=a>>u;if(!c||!f)break;n.texImage2D(vt,u,r.format,c,f,0,r.format,r.type,null)}return rt(),s.profile&&(r.stats.size=le(r.internalformat,r.type,i,a,!1,!1)),o},o._reglType="texture2d",o._texture=r,s.profile&&(o.stats=r.stats),o.destroy=function(){r.decRef()},o},createCube:function(t,e,r,o,a,c){var f=new et(gt);J[f.id]=f,u.cubeCount++;var l=new Array(6);function d(t,e,n,r,o,a){var u,c=f.texInfo;for(Y.call(c),u=0;u<6;++u)l[u]=X();if("number"!=typeof t&&t)if("object"==typeof t)if(e)U(l[0],t),U(l[1],e),U(l[2],n),U(l[3],r),U(l[4],o),U(l[5],a);else if(K(c,t),N(f,t),"faces"in t){var h=t.faces;for(E(Array.isArray(h)&&6===h.length,"cube faces must be a length 6 array"),u=0;u<6;++u)E("object"==typeof h[u]&&!!h[u],"invalid input for cube map face"),I(l[u],f),U(l[u],h[u])}else for(u=0;u<6;++u)U(l[u],t);else E.raise("invalid arguments to cube map");else{var p=0|t||1;for(u=0;u<6;++u)F(l[u],p,p)}for(I(f,l[0]),i.npotTextureCube||E(pt(f.width)&&pt(f.height),"your browser does not support non power or two texture dimensions"),c.genMipmaps?f.mipmask=(l[0].width<<1)-1:f.mipmask=l[0].mipmask,E.textureCube(f,c,l,i),f.internalformat=l[0].internalformat,d.width=l[0].width,d.height=l[0].height,nt(f),u=0;u<6;++u)B(l[u],yt+u);for(Z(c,gt),rt(),s.profile&&(f.stats.size=le(f.internalformat,f.type,d.width,d.height,c.genMipmaps,!0)),d.format=b[f.internalformat],d.type=_[f.type],d.mag=x[c.magFilter],d.min=w[c.minFilter],d.wrapS=S[c.wrapS],d.wrapT=S[c.wrapT],u=0;u<6;++u)q(l[u]);return d}return d(t,e,r,o,a,c),d.subimage=function(t,e,n,r,i){E(!!e,"must specify image data"),E("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var o=0|n,a=0|r,u=0|i,s=P();return I(s,f),s.width=0,s.height=0,k(s,e),s.width=s.width||(f.width>>u)-o,s.height=s.height||(f.height>>u)-a,E(f.type===s.type&&f.format===s.format&&f.internalformat===s.internalformat,"incompatible format for texture.subimage"),E(o>=0&&a>=0&&o+s.width<=f.width&&a+s.height<=f.height,"texture.subimage write out of bounds"),E(f.mipmask&1<<u,"missing mipmap data"),E(s.data||s.element||s.needsCopy,"missing image data"),nt(f),M(s,yt+t,o,a,u),rt(),G(s),d},d.resize=function(t){var e=0|t;if(e!==f.width){d.width=f.width=e,d.height=f.height=e,nt(f);for(var r=0;r<6;++r)for(var i=0;f.mipmask>>i;++i)n.texImage2D(yt+r,i,f.format,e>>i,e>>i,0,f.format,f.type,null);return rt(),s.profile&&(f.stats.size=le(f.internalformat,f.type,d.width,d.height,!1,!0)),d}},d._reglType="textureCube",d._texture=f,s.profile&&(d.stats=f.stats),d.destroy=function(){f.decRef()},d},clear:function(){for(var t=0;t<Q;++t)n.activeTexture(zt+t),n.bindTexture(vt,null),tt[t]=null;W(J).forEach(it),u.cubeCount=0,u.textureCount=0},getTexture:function(t){return null},restore:function(){for(var t=0;t<Q;++t){var e=tt[t];e&&(e.bindCount=0,e.unit=-1,tt[t]=null)}W(J).forEach((function(t){t.texture=n.createTexture(),n.bindTexture(t.target,t.texture);for(var e=0;e<32;++e)if(0!=(t.mipmask&1<<e))if(t.target===vt)n.texImage2D(vt,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);else for(var r=0;r<6;++r)n.texImage2D(yt+r,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);Z(t.texInfo,t.target)}))},refresh:function(){for(var t=0;t<Q;++t){var e=tt[t];e&&(e.bindCount=0,e.unit=-1,tt[t]=null),n.activeTexture(zt+t),n.bindTexture(vt,null),n.bindTexture(gt,null)}}}}ee[32854]=2,ee[32855]=2,ee[36194]=2,ee[34041]=4,ee[33776]=.5,ee[33777]=.5,ee[33778]=1,ee[33779]=1,ee[35986]=.5,ee[35987]=1,ee[34798]=1,ee[35840]=.5,ee[35841]=.25,ee[35842]=.5,ee[35843]=.25,ee[36196]=.5;var he=36161,pe=32854,ve=[];function ge(t,e,n){return ve[t]*e*n}ve[32854]=2,ve[32855]=2,ve[36194]=2,ve[33189]=2,ve[36168]=1,ve[34041]=4,ve[35907]=4,ve[34836]=16,ve[34842]=8,ve[34843]=6;var ye=36160,me=36161,be=3553,_e=34069,xe=[6407,6408],we=[];we[6408]=4,we[6407]=3;var Ee=[];Ee[5121]=1,Ee[5126]=4,Ee[36193]=2;var Se=[32854,32855,36194,35907,34842,34843,34836],Ae={};Ae[36053]="complete",Ae[36054]="incomplete attachment",Ae[36057]="incomplete dimensions",Ae[36055]="incomplete, missing attachment",Ae[36061]="unsupported";function Te(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.offset=0,this.stride=0,this.divisor=0}var Ie=5121,Ne=5126;function Oe(e,n,r,i,o,a,u){function s(s){var c;null===n.next?(E(o.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),c=Ie):(E(null!==n.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),c=n.next.colorAttachments[0].texture._texture.type,a.oes_texture_float?(E(c===Ie||c===Ne,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),c===Ne&&E(u.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):E(c===Ie,"Reading from a framebuffer is only allowed for the type 'uint8'"));var f=0,l=0,d=i.framebufferWidth,h=i.framebufferHeight,p=null;t(s)?p=s:s&&(E.type(s,"object","invalid arguments to regl.read()"),f=0|s.x,l=0|s.y,E(f>=0&&f<i.framebufferWidth,"invalid x offset for regl.read"),E(l>=0&&l<i.framebufferHeight,"invalid y offset for regl.read"),d=0|(s.width||i.framebufferWidth-f),h=0|(s.height||i.framebufferHeight-l),p=s.data||null),p&&(c===Ie?E(p instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):c===Ne&&E(p instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),E(d>0&&d+f<=i.framebufferWidth,"invalid width for read pixels"),E(h>0&&h+l<=i.framebufferHeight,"invalid height for read pixels"),r();var v=d*h*4;return p||(c===Ie?p=new Uint8Array(v):c===Ne&&(p=p||new Float32Array(v))),E.isTypedArray(p,"data buffer for regl.read() must be a typedarray"),E(p.byteLength>=v,"data buffer for regl.read() too small"),e.pixelStorei(3333,4),e.readPixels(f,l,d,h,6408,c,p),p}return function(t){return t&&"framebuffer"in t?function(t){var e;return n.setFBO({framebuffer:t.framebuffer},(function(){e=s(t)})),e}(t):s(t)}}function Ce(t){return Array.prototype.slice.call(t)}function ke(t){return Ce(t).join("")}var De="xyzw".split(""),Me="dither",Re="blend.enable",Pe="blend.color",Ge="blend.equation",Le="blend.func",je="depth.enable",Fe="depth.func",Ue="depth.range",Be="depth.mask",ze="colorMask",Ve="cull.enable",We="cull.face",He="frontFace",Xe="lineWidth",qe="polygonOffset.enable",Ye="polygonOffset.offset",Ke="sample.alpha",Ze="sample.enable",$e="sample.coverage",Je="stencil.enable",Qe="stencil.mask",tn="stencil.func",en="stencil.opFront",nn="stencil.opBack",rn="scissor.enable",on="scissor.box",an="viewport",un="profile",sn="framebuffer",cn="vert",fn="frag",ln="elements",dn="primitive",hn="count",pn="offset",vn="instances",gn="vao",yn="Width",mn="Height",bn=sn+yn,_n=sn+mn,xn="drawingBufferWidth",wn="drawingBufferHeight",En=[Le,Ge,tn,en,nn,$e,an,on,Ye],Sn=34962,An=5126,Tn=35664,In=35665,Nn=35666,On=5124,Cn=35667,kn=35668,Dn=35669,Mn=35670,Rn=35671,Pn=35672,Gn=35673,Ln=35674,jn=35675,Fn=35676,Un=35678,Bn=35680,zn=1028,Vn=1029,Wn=2305,Hn=7680,Xn={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},qn=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Yn={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Kn={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Zn={frag:35632,vert:35633},$n={cw:2304,ccw:Wn};function Jn(e){return Array.isArray(e)||t(e)||V(e)}function Qn(t){return t.sort((function(t,e){return t===an?-1:e===an?1:t<e?-1:1}))}function tr(t,e,n,r){this.thisDep=t,this.contextDep=e,this.propDep=n,this.append=r}function er(t){return t&&!(t.thisDep||t.contextDep||t.propDep)}function nr(t){return new tr(!1,!1,!1,t)}function rr(t,e){var n=t.type;if(0===n){var r=t.data.length;return new tr(!0,r>=1,r>=2,e)}if(4===n){var i=t.data;return new tr(i.thisDep,i.contextDep,i.propDep,e)}if(5===n)return new tr(!1,!1,!1,e);if(6===n){for(var o=!1,a=!1,u=!1,s=0;s<t.data.length;++s){var c=t.data[s];if(1===c.type)u=!0;else if(2===c.type)a=!0;else if(3===c.type)o=!0;else if(0===c.type){o=!0;var f=c.data;f>=1&&(a=!0),f>=2&&(u=!0)}else 4===c.type&&(o=o||c.data.thisDep,a=a||c.data.contextDep,u=u||c.data.propDep)}return new tr(o,a,u,e)}return new tr(3===n,2===n,1===n,e)}var ir=new tr(!1,!1,!1,(function(){}));function or(t,n,r,i,o,a,u,s,c,f,l,d,h,p,v){var g=f.Record,y={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(y.min=32775,y.max=32776);var m=r.angle_instanced_arrays,b=r.webgl_draw_buffers,_={dirty:!0,profile:v.profile},x={},w=[],S={},A={};function T(t){return t.replace(".","_")}function I(t,e,n){var r=T(t);w.push(t),x[r]=_[r]=!!n,S[r]=e}function N(t,e,n){var r=T(t);w.push(t),Array.isArray(n)?(_[r]=n.slice(),x[r]=n.slice()):_[r]=x[r]=n,A[r]=e}I(Me,3024),I(Re,3042),N(Pe,"blendColor",[0,0,0,0]),N(Ge,"blendEquationSeparate",[32774,32774]),N(Le,"blendFuncSeparate",[1,0,1,0]),I(je,2929,!0),N(Fe,"depthFunc",513),N(Ue,"depthRange",[0,1]),N(Be,"depthMask",!0),N(ze,ze,[!0,!0,!0,!0]),I(Ve,2884),N(We,"cullFace",Vn),N(He,He,Wn),N(Xe,Xe,1),I(qe,32823),N(Ye,"polygonOffset",[0,0]),I(Ke,32926),I(Ze,32928),N($e,"sampleCoverage",[1,!1]),I(Je,2960),N(Qe,"stencilMask",-1),N(tn,"stencilFunc",[519,0,-1]),N(en,"stencilOpSeparate",[zn,Hn,Hn,Hn]),N(nn,"stencilOpSeparate",[Vn,Hn,Hn,Hn]),I(rn,3089),N(on,"scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),N(an,an,[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var C={gl:t,context:h,strings:n,next:x,current:_,draw:d,elements:a,buffer:o,shader:l,attributes:f.state,vao:f,uniforms:c,framebuffer:s,extensions:r,timer:p,isBufferArgs:Jn},k={primTypes:ot,compareFuncs:Yn,blendFuncs:Xn,blendEquations:y,stencilOps:Kn,glTypes:K,orientationType:$n};E.optional((function(){C.isArrayLike=ht})),b&&(k.backBuffer=[Vn],k.drawBuffer=P(i.maxDrawbuffers,(function(t){return 0===t?[0]:P(t,(function(t){return 36064+t}))})));var D=0;function M(){var t=function(){var t=0,n=[],r=[];function i(){var n=[],r=[];return e((function(){n.push.apply(n,Ce(arguments))}),{def:function(){var e="v"+t++;return r.push(e),arguments.length>0&&(n.push(e,"="),n.push.apply(n,Ce(arguments)),n.push(";")),e},toString:function(){return ke([r.length>0?"var "+r.join(",")+";":"",ke(n)])}})}function o(){var t=i(),n=i(),r=t.toString,o=n.toString;function a(e,r){n(e,r,"=",t.def(e,r),";")}return e((function(){t.apply(t,Ce(arguments))}),{def:t.def,entry:t,exit:n,save:a,set:function(e,n,r){a(e,n),t(e,n,"=",r,";")},toString:function(){return r()+o()}})}var a=i(),u={};return{global:a,link:function(e){for(var i=0;i<r.length;++i)if(r[i]===e)return n[i];var o="g"+t++;return n.push(o),r.push(e),o},block:i,proc:function(t,n){var r=[];function i(){var t="a"+r.length;return r.push(t),t}n=n||0;for(var a=0;a<n;++a)i();var s=o(),c=s.toString;return u[t]=e(s,{arg:i,toString:function(){return ke(["function(",r.join(),"){",c(),"}"])}})},scope:o,cond:function(){var t=ke(arguments),n=o(),r=o(),i=n.toString,a=r.toString;return e(n,{then:function(){return n.apply(n,Ce(arguments)),this},else:function(){return r.apply(r,Ce(arguments)),this},toString:function(){var e=a();return e&&(e="else{"+e+"}"),ke(["if(",t,"){",i(),"}",e])}})},compile:function(){var t=['"use strict";',a,"return {"];Object.keys(u).forEach((function(e){t.push('"',e,'":',u[e].toString(),",")})),t.push("}");var e=ke(t).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,n.concat(e)).apply(null,r)}}}(),r=t.link,i=t.global;t.id=D++,t.batchId="0";var o=r(C),a=t.shared={props:"a0"};Object.keys(C).forEach((function(t){a[t]=i.def(o,".",t)})),E.optional((function(){t.CHECK=r(E),t.commandStr=E.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},k.invalidBlendCombinations=qn}));var u=t.next={},s=t.current={};Object.keys(A).forEach((function(t){Array.isArray(_[t])&&(u[t]=i.def(a.next,".",t),s[t]=i.def(a.current,".",t))}));var c=t.constants={};Object.keys(k).forEach((function(t){c[t]=i.def(JSON.stringify(k[t]))})),t.invoke=function(e,n){switch(n.type){case 0:var i=["this",a.context,a.props,t.batchId];return e.def(r(n.data),".call(",i.slice(0,Math.max(n.data.length+1,4)),")");case 1:return e.def(a.props,n.data);case 2:return e.def(a.context,n.data);case 3:return e.def("this",n.data);case 4:return n.data.append(t,e),n.data.ref;case 5:return n.data.toString();case 6:return n.data.map((function(n){return t.invoke(e,n)}))}},t.attribCache={};var l={};return t.scopeAttrib=function(t){var e=n.id(t);if(e in l)return l[e];var i=f.scope[e];return i||(i=f.scope[e]=new g),l[e]=r(i)},t}function R(t,e,u,c,d){var h=t.static,p=t.dynamic;E.optional((function(){var t=[sn,cn,fn,ln,dn,pn,hn,vn,un,gn].concat(w);function e(e){Object.keys(e).forEach((function(e){E.command(t.indexOf(e)>=0,'unknown parameter "'+e+'"',d.commandStr)}))}e(h),e(p)}));var v=function(t,e){var n=t.static;if("string"==typeof n[fn]&&"string"==typeof n[cn]){if(Object.keys(e.dynamic).length>0)return null;var r=e.static,i=Object.keys(r);if(i.length>0&&"number"==typeof r[i[0]]){for(var o=[],a=0;a<i.length;++a)E("number"==typeof r[i[a]],"must specify all vertex attribute locations when using vaos"),o.push([0|r[i[a]],i[a]]);return o}}return null}(t,e),b=function(t,e){var n=t.static,r=t.dynamic;if(sn in n){var i=n[sn];return i?(i=s.getFramebuffer(i),E.command(i,"invalid framebuffer object"),nr((function(t,e){var n=t.link(i),r=t.shared;e.set(r.framebuffer,".next",n);var o=r.context;return e.set(o,"."+bn,n+".width"),e.set(o,"."+_n,n+".height"),n}))):nr((function(t,e){var n=t.shared;e.set(n.framebuffer,".next","null");var r=n.context;return e.set(r,"."+bn,r+"."+xn),e.set(r,"."+_n,r+"."+wn),"null"}))}if(sn in r){var o=r[sn];return rr(o,(function(t,e){var n=t.invoke(e,o),r=t.shared,i=r.framebuffer,a=e.def(i,".getFramebuffer(",n,")");E.optional((function(){t.assert(e,"!"+n+"||"+a,"invalid framebuffer object")})),e.set(i,".next",a);var u=r.context;return e.set(u,"."+bn,a+"?"+a+".width:"+u+"."+xn),e.set(u,"."+_n,a+"?"+a+".height:"+u+"."+wn),a}))}return null}(t),_=function(t,e,n){var r=t.static,i=t.dynamic;function o(t){if(t in r){var o=r[t];E.commandType(o,"object","invalid "+t,n.commandStr);var a,u,s=!0,c=0|o.x,f=0|o.y;return"width"in o?(a=0|o.width,E.command(a>=0,"invalid "+t,n.commandStr)):s=!1,"height"in o?(u=0|o.height,E.command(u>=0,"invalid "+t,n.commandStr)):s=!1,new tr(!s&&e&&e.thisDep,!s&&e&&e.contextDep,!s&&e&&e.propDep,(function(t,e){var n=t.shared.context,r=a;"width"in o||(r=e.def(n,".",bn,"-",c));var i=u;return"height"in o||(i=e.def(n,".",_n,"-",f)),[c,f,r,i]}))}if(t in i){var l=i[t],d=rr(l,(function(e,n){var r=e.invoke(n,l);E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)}));var i=e.shared.context,o=n.def(r,".x|0"),a=n.def(r,".y|0"),u=n.def('"width" in ',r,"?",r,".width|0:","(",i,".",bn,"-",o,")"),s=n.def('"height" in ',r,"?",r,".height|0:","(",i,".",_n,"-",a,")");return E.optional((function(){e.assert(n,u+">=0&&"+s+">=0","invalid "+t)})),[o,a,u,s]}));return e&&(d.thisDep=d.thisDep||e.thisDep,d.contextDep=d.contextDep||e.contextDep,d.propDep=d.propDep||e.propDep),d}return e?new tr(e.thisDep,e.contextDep,e.propDep,(function(t,e){var n=t.shared.context;return[0,0,e.def(n,".",bn),e.def(n,".",_n)]})):null}var a=o(an);if(a){var u=a;a=new tr(a.thisDep,a.contextDep,a.propDep,(function(t,e){var n=u.append(t,e),r=t.shared.context;return e.set(r,".viewportWidth",n[2]),e.set(r,".viewportHeight",n[3]),n}))}return{viewport:a,scissor_box:o(on)}}(t,b,d),x=function(t,e){var n=t.static,r=t.dynamic,i=function(){if(ln in n){var t=n[ln];Jn(t)?t=a.getElements(a.create(t,!0)):t&&(t=a.getElements(t),E.command(t,"invalid elements",e.commandStr));var i=nr((function(e,n){if(t){var r=e.link(t);return e.ELEMENTS=r,r}return e.ELEMENTS=null,null}));return i.value=t,i}if(ln in r){var o=r[ln];return rr(o,(function(t,e){var n=t.shared,r=n.isBufferArgs,i=n.elements,a=t.invoke(e,o),u=e.def("null"),s=e.def(r,"(",a,")"),c=t.cond(s).then(u,"=",i,".createStream(",a,");").else(u,"=",i,".getElements(",a,");");return E.optional((function(){t.assert(c.else,"!"+a+"||"+u,"invalid elements")})),e.entry(c),e.exit(t.cond(s).then(i,".destroyStream(",u,");")),t.ELEMENTS=u,u}))}return null}();function o(t,o){if(t in n){var a=0|n[t];return E.command(!o||a>=0,"invalid "+t,e.commandStr),nr((function(t,e){return o&&(t.OFFSET=a),a}))}if(t in r){var u=r[t];return rr(u,(function(e,n){var r=e.invoke(n,u);return o&&(e.OFFSET=r,E.optional((function(){e.assert(n,r+">=0","invalid "+t)}))),r}))}return o&&i?nr((function(t,e){return t.OFFSET="0",0})):null}var u=o(pn,!0);return{elements:i,primitive:function(){if(dn in n){var t=n[dn];return E.commandParameter(t,ot,"invalid primitve",e.commandStr),nr((function(e,n){return ot[t]}))}if(dn in r){var o=r[dn];return rr(o,(function(t,e){var n=t.constants.primTypes,r=t.invoke(e,o);return E.optional((function(){t.assert(e,r+" in "+n,"invalid primitive, must be one of "+Object.keys(ot))})),e.def(n,"[",r,"]")}))}return i?er(i)?i.value?nr((function(t,e){return e.def(t.ELEMENTS,".primType")})):nr((function(){return 4})):new tr(i.thisDep,i.contextDep,i.propDep,(function(t,e){var n=t.ELEMENTS;return e.def(n,"?",n,".primType:",4)})):null}(),count:function(){if(hn in n){var t=0|n[hn];return E.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),nr((function(){return t}))}if(hn in r){var o=r[hn];return rr(o,(function(t,e){var n=t.invoke(e,o);return E.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")})),n}))}if(i){if(er(i)){if(i)return u?new tr(u.thisDep,u.contextDep,u.propDep,(function(t,e){var n=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return E.optional((function(){t.assert(e,n+">=0","invalid vertex offset/element buffer too small")})),n})):nr((function(t,e){return e.def(t.ELEMENTS,".vertCount")}));var a=nr((function(){return-1}));return E.optional((function(){a.MISSING=!0})),a}var s=new tr(i.thisDep||u.thisDep,i.contextDep||u.contextDep,i.propDep||u.propDep,(function(t,e){var n=t.ELEMENTS;return t.OFFSET?e.def(n,"?",n,".vertCount-",t.OFFSET,":-1"):e.def(n,"?",n,".vertCount:-1")}));return E.optional((function(){s.DYNAMIC=!0})),s}return null}(),instances:o(vn,!1),offset:u}}(t,d),S=function(t,e){var n=t.static,r=t.dynamic,o={};return w.forEach((function(t){var a=T(t);function u(e,i){if(t in n){var u=e(n[t]);o[a]=nr((function(){return u}))}else if(t in r){var s=r[t];o[a]=rr(s,(function(t,e){return i(t,e,t.invoke(e,s))}))}}switch(t){case Ve:case Re:case Me:case Je:case je:case rn:case qe:case Ke:case Ze:case Be:return u((function(n){return E.commandType(n,"boolean",t,e.commandStr),n}),(function(e,n,r){return E.optional((function(){e.assert(n,"typeof "+r+'==="boolean"',"invalid flag "+t,e.commandStr)})),r}));case Fe:return u((function(n){return E.commandParameter(n,Yn,"invalid "+t,e.commandStr),Yn[n]}),(function(e,n,r){var i=e.constants.compareFuncs;return E.optional((function(){e.assert(n,r+" in "+i,"invalid "+t+", must be one of "+Object.keys(Yn))})),n.def(i,"[",r,"]")}));case Ue:return u((function(t){return E.command(ht(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===2&&typeof "+n+'[0]==="number"&&typeof '+n+'[1]==="number"&&'+n+"[0]<="+n+"[1]","depth range must be a 2d array")})),[e.def("+",n,"[0]"),e.def("+",n,"[1]")]}));case Le:return u((function(t){E.commandType(t,"object","blend.func",e.commandStr);var n="srcRGB"in t?t.srcRGB:t.src,r="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,o="dstAlpha"in t?t.dstAlpha:t.dst;return E.commandParameter(n,Xn,a+".srcRGB",e.commandStr),E.commandParameter(r,Xn,a+".srcAlpha",e.commandStr),E.commandParameter(i,Xn,a+".dstRGB",e.commandStr),E.commandParameter(o,Xn,a+".dstAlpha",e.commandStr),E.command(-1===qn.indexOf(n+", "+i),"unallowed blending combination (srcRGB, dstRGB) = ("+n+", "+i+")",e.commandStr),[Xn[n],Xn[i],Xn[r],Xn[o]]}),(function(e,n,r){var i=e.constants.blendFuncs;function o(o,a){var u=n.def('"',o,a,'" in ',r,"?",r,".",o,a,":",r,".",o);return E.optional((function(){e.assert(n,u+" in "+i,"invalid "+t+"."+o+a+", must be one of "+Object.keys(Xn))})),u}E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid blend func, must be an object")}));var a=o("src","RGB"),u=o("dst","RGB");E.optional((function(){var t=e.constants.invalidBlendCombinations;e.assert(n,t+".indexOf("+a+'+", "+'+u+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")}));var s=n.def(i,"[",a,"]"),c=n.def(i,"[",o("src","Alpha"),"]");return[s,n.def(i,"[",u,"]"),c,n.def(i,"[",o("dst","Alpha"),"]")]}));case Ge:return u((function(n){return"string"==typeof n?(E.commandParameter(n,y,"invalid "+t,e.commandStr),[y[n],y[n]]):"object"==typeof n?(E.commandParameter(n.rgb,y,t+".rgb",e.commandStr),E.commandParameter(n.alpha,y,t+".alpha",e.commandStr),[y[n.rgb],y[n.alpha]]):void E.commandRaise("invalid blend.equation",e.commandStr)}),(function(e,n,r){var i=e.constants.blendEquations,o=n.def(),a=n.def(),u=e.cond("typeof ",r,'==="string"');return E.optional((function(){function n(t,n,r){e.assert(t,r+" in "+i,"invalid "+n+", must be one of "+Object.keys(y))}n(u.then,t,r),e.assert(u.else,r+"&&typeof "+r+'==="object"',"invalid "+t),n(u.else,t+".rgb",r+".rgb"),n(u.else,t+".alpha",r+".alpha")})),u.then(o,"=",a,"=",i,"[",r,"];"),u.else(o,"=",i,"[",r,".rgb];",a,"=",i,"[",r,".alpha];"),n(u),[o,a]}));case Pe:return u((function(t){return E.command(ht(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),P(4,(function(e){return+t[e]}))}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","blend.color must be a 4d array")})),P(4,(function(t){return e.def("+",n,"[",t,"]")}))}));case Qe:return u((function(t){return E.commandType(t,"number",a,e.commandStr),0|t}),(function(t,e,n){return E.optional((function(){t.assert(e,"typeof "+n+'==="number"',"invalid stencil.mask")})),e.def(n,"|0")}));case tn:return u((function(n){E.commandType(n,"object",a,e.commandStr);var r=n.cmp||"keep",i=n.ref||0,o="mask"in n?n.mask:-1;return E.commandParameter(r,Yn,t+".cmp",e.commandStr),E.commandType(i,"number",t+".ref",e.commandStr),E.commandType(o,"number",t+".mask",e.commandStr),[Yn[r],i,o]}),(function(t,e,n){var r=t.constants.compareFuncs;return E.optional((function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(n+"&&typeof ",n,'==="object"'),i('!("cmp" in ',n,")||(",n,".cmp in ",r,")")})),[e.def('"cmp" in ',n,"?",r,"[",n,".cmp]",":",Hn),e.def(n,".ref|0"),e.def('"mask" in ',n,"?",n,".mask|0:-1")]}));case en:case nn:return u((function(n){E.commandType(n,"object",a,e.commandStr);var r=n.fail||"keep",i=n.zfail||"keep",o=n.zpass||"keep";return E.commandParameter(r,Kn,t+".fail",e.commandStr),E.commandParameter(i,Kn,t+".zfail",e.commandStr),E.commandParameter(o,Kn,t+".zpass",e.commandStr),[t===nn?Vn:zn,Kn[r],Kn[i],Kn[o]]}),(function(e,n,r){var i=e.constants.stencilOps;function o(o){return E.optional((function(){e.assert(n,'!("'+o+'" in '+r+")||("+r+"."+o+" in "+i+")","invalid "+t+"."+o+", must be one of "+Object.keys(Kn))})),n.def('"',o,'" in ',r,"?",i,"[",r,".",o,"]:",Hn)}return E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),[t===nn?Vn:zn,o("fail"),o("zfail"),o("zpass")]}));case Ye:return u((function(t){E.commandType(t,"object",a,e.commandStr);var n=0|t.factor,r=0|t.units;return E.commandType(n,"number",a+".factor",e.commandStr),E.commandType(r,"number",a+".units",e.commandStr),[n,r]}),(function(e,n,r){return E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),[n.def(r,".factor|0"),n.def(r,".units|0")]}));case We:return u((function(t){var n=0;return"front"===t?n=zn:"back"===t&&(n=Vn),E.command(!!n,a,e.commandStr),n}),(function(t,e,n){return E.optional((function(){t.assert(e,n+'==="front"||'+n+'==="back"',"invalid cull.face")})),e.def(n,'==="front"?',zn,":",Vn)}));case Xe:return u((function(t){return E.command("number"==typeof t&&t>=i.lineWidthDims[0]&&t<=i.lineWidthDims[1],"invalid line width, must be a positive number between "+i.lineWidthDims[0]+" and "+i.lineWidthDims[1],e.commandStr),t}),(function(t,e,n){return E.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">="+i.lineWidthDims[0]+"&&"+n+"<="+i.lineWidthDims[1],"invalid line width")})),n}));case He:return u((function(t){return E.commandParameter(t,$n,a,e.commandStr),$n[t]}),(function(t,e,n){return E.optional((function(){t.assert(e,n+'==="cw"||'+n+'==="ccw"',"invalid frontFace, must be one of cw,ccw")})),e.def(n+'==="cw"?2304:'+Wn)}));case ze:return u((function(t){return E.command(ht(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map((function(t){return!!t}))}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","invalid color.mask")})),P(4,(function(t){return"!!"+n+"["+t+"]"}))}));case $e:return u((function(t){E.command("object"==typeof t&&t,a,e.commandStr);var n="value"in t?t.value:1,r=!!t.invert;return E.command("number"==typeof n&&n>=0&&n<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[n,r]}),(function(t,e,n){return E.optional((function(){t.assert(e,n+"&&typeof "+n+'==="object"',"invalid sample.coverage")})),[e.def('"value" in ',n,"?+",n,".value:1"),e.def("!!",n,".invert")]}))}})),o}(t,d),A=function(t,e,r){var i=t.static,o=t.dynamic;function a(t){if(t in i){var e=n.id(i[t]);E.optional((function(){l.shader(Zn[t],e,E.guessCommand())}));var r=nr((function(){return e}));return r.id=e,r}if(t in o){var a=o[t];return rr(a,(function(e,n){var r=e.invoke(n,a),i=n.def(e.shared.strings,".id(",r,")");return E.optional((function(){n(e.shared.shader,".shader(",Zn[t],",",i,",",e.command,");")})),i}))}return null}var u,s=a(fn),c=a(cn),f=null;return er(s)&&er(c)?(f=l.program(c.id,s.id,null,r),u=nr((function(t,e){return t.link(f)}))):u=new tr(s&&s.thisDep||c&&c.thisDep,s&&s.contextDep||c&&c.contextDep,s&&s.propDep||c&&c.propDep,(function(t,e){var n,r=t.shared.shader;n=s?s.append(t,e):e.def(r,".",fn);var i=r+".program("+(c?c.append(t,e):e.def(r,".",cn))+","+n;return E.optional((function(){i+=","+t.command})),e.def(i+")")})),{frag:s,vert:c,progVar:u,program:f}}(t,0,v);function I(t){var e=_[t];e&&(S[t]=e)}I(an),I(T(on));var N=Object.keys(S).length>0,O={framebuffer:b,draw:x,shader:A,state:S,dirty:N,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(O.profile=function(t){var e,n=t.static,r=t.dynamic;if(un in n){var i=!!n[un];(e=nr((function(t,e){return i}))).enable=i}else if(un in r){var o=r[un];e=rr(o,(function(t,e){return t.invoke(e,o)}))}return e}(t),O.uniforms=function(t,e){var n=t.static,r=t.dynamic,i={};return Object.keys(n).forEach((function(t){var r,o=n[t];if("number"==typeof o||"boolean"==typeof o)r=nr((function(){return o}));else if("function"==typeof o){var a=o._reglType;"texture2d"===a||"textureCube"===a?r=nr((function(t){return t.link(o)})):"framebuffer"===a||"framebufferCube"===a?(E.command(o.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),r=nr((function(t){return t.link(o.color[0])}))):E.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else ht(o)?r=nr((function(e){return e.global.def("[",P(o.length,(function(n){return E.command("number"==typeof o[n]||"boolean"==typeof o[n],"invalid uniform "+t,e.commandStr),o[n]})),"]")})):E.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);r.value=o,i[t]=r})),Object.keys(r).forEach((function(t){var e=r[t];i[t]=rr(e,(function(t,n){return t.invoke(n,e)}))})),i}(u,d),O.drawVAO=O.scopeVAO=function(t,e){var n=t.static,r=t.dynamic;if(gn in n){var i=n[gn];return null!==i&&null===f.getVAO(i)&&(i=f.createVAO(i)),nr((function(t){return t.link(f.getVAO(i))}))}if(gn in r){var o=r[gn];return rr(o,(function(t,e){var n=t.invoke(e,o);return e.def(t.shared.vao+".getVAO("+n+")")}))}return null}(t),!O.drawVAO&&A.program&&!v&&r.angle_instanced_arrays){var C=!0,k=A.program.attributes.map((function(t){var n=e.static[t];return C=C&&!!n,n}));if(C&&k.length>0){var D=f.getVAO(f.createVAO(k));O.drawVAO=new tr(null,null,null,(function(t,e){return t.link(D)})),O.useVAO=!0}}return v?O.useVAO=!0:O.attributes=function(t,e){var r=t.static,i=t.dynamic,a={};return Object.keys(r).forEach((function(t){var i=r[t],u=n.id(t),s=new g;if(Jn(i))s.state=1,s.buffer=o.getBuffer(o.create(i,Sn,!1,!0)),s.type=0;else{var c=o.getBuffer(i);if(c)s.state=1,s.buffer=c,s.type=0;else if(E.command("object"==typeof i&&i,"invalid data for attribute "+t,e.commandStr),"constant"in i){var f=i.constant;s.buffer="null",s.state=2,"number"==typeof f?s.x=f:(E.command(ht(f)&&f.length>0&&f.length<=4,"invalid constant for attribute "+t,e.commandStr),De.forEach((function(t,e){e<f.length&&(s[t]=f[e])})))}else{c=Jn(i.buffer)?o.getBuffer(o.create(i.buffer,Sn,!1,!0)):o.getBuffer(i.buffer),E.command(!!c,'missing buffer for attribute "'+t+'"',e.commandStr);var l=0|i.offset;E.command(l>=0,'invalid offset for attribute "'+t+'"',e.commandStr);var d=0|i.stride;E.command(d>=0&&d<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',e.commandStr);var h=0|i.size;E.command(!("size"in i)||h>0&&h<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',e.commandStr);var p=!!i.normalized,v=0;"type"in i&&(E.commandParameter(i.type,K,"invalid type for attribute "+t,e.commandStr),v=K[i.type]);var y=0|i.divisor;"divisor"in i&&(E.command(0===y||m,'cannot specify divisor for attribute "'+t+'", instancing not supported',e.commandStr),E.command(y>=0,'invalid divisor for attribute "'+t+'"',e.commandStr)),E.optional((function(){var n=e.commandStr,r=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach((function(e){E.command(r.indexOf(e)>=0,'unknown parameter "'+e+'" for attribute pointer "'+t+'" (valid parameters are '+r+")",n)}))})),s.buffer=c,s.state=1,s.size=h,s.normalized=p,s.type=v||c.dtype,s.offset=l,s.stride=d,s.divisor=y}}a[t]=nr((function(t,e){var n=t.attribCache;if(u in n)return n[u];var r={isStream:!1};return Object.keys(s).forEach((function(t){r[t]=s[t]})),s.buffer&&(r.buffer=t.link(s.buffer),r.type=r.type||r.buffer+".dtype"),n[u]=r,r}))})),Object.keys(i).forEach((function(t){var e=i[t];a[t]=rr(e,(function(n,r){var i=n.invoke(r,e),o=n.shared,a=n.constants,u=o.isBufferArgs,s=o.buffer;E.optional((function(){n.assert(r,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+u+"("+i+")||"+s+".getBuffer("+i+")||"+s+".getBuffer("+i+".buffer)||"+u+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')}));var c={isStream:r.def(!1)},f=new g;f.state=1,Object.keys(f).forEach((function(t){c[t]=r.def(""+f[t])}));var l=c.buffer,d=c.type;function h(t){r(c[t],"=",i,".",t,"|0;")}return r("if(",u,"(",i,")){",c.isStream,"=true;",l,"=",s,".createStream(",Sn,",",i,");",d,"=",l,".dtype;","}else{",l,"=",s,".getBuffer(",i,");","if(",l,"){",d,"=",l,".dtype;",'}else if("constant" in ',i,"){",c.state,"=",2,";","if(typeof "+i+'.constant === "number"){',c[De[0]],"=",i,".constant;",De.slice(1).map((function(t){return c[t]})).join("="),"=0;","}else{",De.map((function(t,e){return c[t]+"="+i+".constant.length>"+e+"?"+i+".constant["+e+"]:0;"})).join(""),"}}else{","if(",u,"(",i,".buffer)){",l,"=",s,".createStream(",Sn,",",i,".buffer);","}else{",l,"=",s,".getBuffer(",i,".buffer);","}",d,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",l,".dtype;",c.normalized,"=!!",i,".normalized;"),h("size"),h("offset"),h("stride"),h("divisor"),r("}}"),r.exit("if(",c.isStream,"){",s,".destroyStream(",l,");","}"),c}))})),a}(e,d),O.context=function(t){var e=t.static,n=t.dynamic,r={};return Object.keys(e).forEach((function(t){var n=e[t];r[t]=nr((function(t,e){return"number"==typeof n||"boolean"==typeof n?""+n:t.link(n)}))})),Object.keys(n).forEach((function(t){var e=n[t];r[t]=rr(e,(function(t,n){return t.invoke(n,e)}))})),r}(c),O}function G(t,e,n){var r=t.shared.context,i=t.scope();Object.keys(n).forEach((function(o){e.save(r,"."+o);var a=n[o].append(t,e);Array.isArray(a)?i(r,".",o,"=[",a.join(),"];"):i(r,".",o,"=",a,";")})),e(i)}function L(t,e,n,r){var i,o=t.shared,a=o.gl,u=o.framebuffer;b&&(i=e.def(o.extensions,".webgl_draw_buffers"));var s,c=t.constants,f=c.drawBuffer,l=c.backBuffer;s=n?n.append(t,e):e.def(u,".next"),r||e("if(",s,"!==",u,".cur){"),e("if(",s,"){",a,".bindFramebuffer(",36160,",",s,".framebuffer);"),b&&e(i,".drawBuffersWEBGL(",f,"[",s,".colorAttachments.length]);"),e("}else{",a,".bindFramebuffer(",36160,",null);"),b&&e(i,".drawBuffersWEBGL(",l,");"),e("}",u,".cur=",s,";"),r||e("}")}function j(t,e,n){var r=t.shared,i=r.gl,o=t.current,a=t.next,u=r.current,s=r.next,c=t.cond(u,".dirty");w.forEach((function(e){var r,f,l=T(e);if(!(l in n.state))if(l in a){r=a[l],f=o[l];var d=P(_[l].length,(function(t){return c.def(r,"[",t,"]")}));c(t.cond(d.map((function(t,e){return t+"!=="+f+"["+e+"]"})).join("||")).then(i,".",A[l],"(",d,");",d.map((function(t,e){return f+"["+e+"]="+t})).join(";"),";"))}else{r=c.def(s,".",l);var h=t.cond(r,"!==",u,".",l);c(h),l in S?h(t.cond(r).then(i,".enable(",S[l],");").else(i,".disable(",S[l],");"),u,".",l,"=",r,";"):h(i,".",A[l],"(",r,");",u,".",l,"=",r,";")}})),0===Object.keys(n.state).length&&c(u,".dirty=false;"),e(c)}function F(t,e,n,r){var i=t.shared,o=t.current,a=i.current,u=i.gl;Qn(Object.keys(n)).forEach((function(i){var s=n[i];if(!r||r(s)){var c=s.append(t,e);if(S[i]){var f=S[i];er(s)?e(u,c?".enable(":".disable(",f,");"):e(t.cond(c).then(u,".enable(",f,");").else(u,".disable(",f,");")),e(a,".",i,"=",c,";")}else if(ht(c)){var l=o[i];e(u,".",A[i],"(",c,");",c.map((function(t,e){return l+"["+e+"]="+t})).join(";"),";")}else e(u,".",A[i],"(",c,");",a,".",i,"=",c,";")}}))}function U(t,e){m&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function B(t,e,n,r,i){var o,a,u,s=t.shared,c=t.stats,f=s.current,l=s.timer,d=n.profile;function h(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function v(t){t(o=e.def(),"=",h(),";"),"string"==typeof i?t(c,".count+=",i,";"):t(c,".count++;"),p&&(r?t(a=e.def(),"=",l,".getNumPendingQueries();"):t(l,".beginQuery(",c,");"))}function g(t){t(c,".cpuTime+=",h(),"-",o,";"),p&&(r?t(l,".pushScopeStats(",a,",",l,".getNumPendingQueries(),",c,");"):t(l,".endQuery();"))}function y(t){var n=e.def(f,".profile");e(f,".profile=",t,";"),e.exit(f,".profile=",n,";")}if(d){if(er(d))return void(d.enable?(v(e),g(e.exit),y("true")):y("false"));y(u=d.append(t,e))}else u=e.def(f,".profile");var m=t.block();v(m),e("if(",u,"){",m,"}");var b=t.block();g(b),e.exit("if(",u,"){",b,"}")}function z(t,e,n,r,i){var o=t.shared;r.forEach((function(r){var a,u=r.name,s=n.attributes[u];if(s){if(!i(s))return;a=s.append(t,e)}else{if(!i(ir))return;var c=t.scopeAttrib(u);E.optional((function(){t.assert(e,c+".state","missing attribute "+u)})),a={},Object.keys(new g).forEach((function(t){a[t]=e.def(c,".",t)}))}!function(n,r,i){var a=o.gl,u=e.def(n,".location"),s=e.def(o.attributes,"[",u,"]"),c=i.state,f=i.buffer,l=[i.x,i.y,i.z,i.w],d=["buffer","normalized","offset","stride"];function h(){e("if(!",s,".buffer){",a,".enableVertexAttribArray(",u,");}");var n,o=i.type;if(n=i.size?e.def(i.size,"||",r):r,e("if(",s,".type!==",o,"||",s,".size!==",n,"||",d.map((function(t){return s+"."+t+"!=="+i[t]})).join("||"),"){",a,".bindBuffer(",Sn,",",f,".buffer);",a,".vertexAttribPointer(",[u,n,o,i.normalized,i.stride,i.offset],");",s,".type=",o,";",s,".size=",n,";",d.map((function(t){return s+"."+t+"="+i[t]+";"})).join(""),"}"),m){var c=i.divisor;e("if(",s,".divisor!==",c,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,c],");",s,".divisor=",c,";}")}}function p(){e("if(",s,".buffer){",a,".disableVertexAttribArray(",u,");",s,".buffer=null;","}if(",De.map((function(t,e){return s+"."+t+"!=="+l[e]})).join("||"),"){",a,".vertexAttrib4f(",u,",",l,");",De.map((function(t,e){return s+"."+t+"="+l[e]+";"})).join(""),"}")}1===c?h():2===c?p():(e("if(",c,"===",1,"){"),h(),e("}else{"),p(),e("}"))}(t.link(r),function(t){switch(t){case Tn:case Cn:case Rn:return 2;case In:case kn:case Pn:return 3;case Nn:case Dn:case Gn:return 4;default:return 1}}(r.info.type),a)}))}function V(t,e,r,i,o){for(var a,u=t.shared,s=u.gl,c=0;c<i.length;++c){var f,l=i[c],d=l.name,h=l.info.type,p=r.uniforms[d],v=t.link(l)+".location";if(p){if(!o(p))continue;if(er(p)){var g=p.value;if(E.command(null!=g,'missing uniform "'+d+'"',t.commandStr),h===Un||h===Bn){E.command("function"==typeof g&&(h===Un&&("texture2d"===g._reglType||"framebuffer"===g._reglType)||h===Bn&&("textureCube"===g._reglType||"framebufferCube"===g._reglType)),"invalid texture for uniform "+d,t.commandStr);var y=t.link(g._texture||g.color[0]._texture);e(s,".uniform1i(",v,",",y+".bind());"),e.exit(y,".unbind();")}else if(h===Ln||h===jn||h===Fn){E.optional((function(){E.command(ht(g),"invalid matrix for uniform "+d,t.commandStr),E.command(h===Ln&&4===g.length||h===jn&&9===g.length||h===Fn&&16===g.length,"invalid length for matrix uniform "+d,t.commandStr)}));var m=t.global.def("new Float32Array(["+Array.prototype.slice.call(g)+"])"),b=2;h===jn?b=3:h===Fn&&(b=4),e(s,".uniformMatrix",b,"fv(",v,",false,",m,");")}else{switch(h){case An:E.commandType(g,"number","uniform "+d,t.commandStr),a="1f";break;case Tn:E.command(ht(g)&&2===g.length,"uniform "+d,t.commandStr),a="2f";break;case In:E.command(ht(g)&&3===g.length,"uniform "+d,t.commandStr),a="3f";break;case Nn:E.command(ht(g)&&4===g.length,"uniform "+d,t.commandStr),a="4f";break;case Mn:E.commandType(g,"boolean","uniform "+d,t.commandStr),a="1i";break;case On:E.commandType(g,"number","uniform "+d,t.commandStr),a="1i";break;case Rn:case Cn:E.command(ht(g)&&2===g.length,"uniform "+d,t.commandStr),a="2i";break;case Pn:case kn:E.command(ht(g)&&3===g.length,"uniform "+d,t.commandStr),a="3i";break;case Gn:case Dn:E.command(ht(g)&&4===g.length,"uniform "+d,t.commandStr),a="4i"}e(s,".uniform",a,"(",v,",",ht(g)?Array.prototype.slice.call(g):g,");")}continue}f=p.append(t,e)}else{if(!o(ir))continue;f=e.def(u.uniforms,"[",n.id(d),"]")}h===Un?(E(!Array.isArray(f),"must specify a scalar prop for textures"),e("if(",f,"&&",f,'._reglType==="framebuffer"){',f,"=",f,".color[0];","}")):h===Bn&&(E(!Array.isArray(f),"must specify a scalar prop for cube maps"),e("if(",f,"&&",f,'._reglType==="framebufferCube"){',f,"=",f,".color[0];","}")),E.optional((function(){function n(n,r){t.assert(e,n,'bad data or missing for uniform "'+d+'". '+r)}function r(t){E(!Array.isArray(f),"must not specify an array type for uniform"),n("typeof "+f+'==="'+t+'"',"invalid type, expected "+t)}function i(e,r){Array.isArray(f)?E(f.length===e,"must have length "+e):n(u.isArrayLike+"("+f+")&&"+f+".length==="+e,"invalid vector, should have length "+e,t.commandStr)}function o(e){E(!Array.isArray(f),"must not specify a value type"),n("typeof "+f+'==="function"&&'+f+'._reglType==="texture'+(3553===e?"2d":"Cube")+'"',"invalid texture type",t.commandStr)}switch(h){case On:r("number");break;case Cn:i(2);break;case kn:i(3);break;case Dn:i(4);break;case An:r("number");break;case Tn:i(2);break;case In:i(3);break;case Nn:i(4);break;case Mn:r("boolean");break;case Rn:i(2);break;case Pn:i(3);break;case Gn:case Ln:i(4);break;case jn:i(9);break;case Fn:i(16);break;case Un:o(3553);break;case Bn:o(34067)}}));var _=1;switch(h){case Un:case Bn:var x=e.def(f,"._texture");e(s,".uniform1i(",v,",",x,".bind());"),e.exit(x,".unbind();");continue;case On:case Mn:a="1i";break;case Cn:case Rn:a="2i",_=2;break;case kn:case Pn:a="3i",_=3;break;case Dn:case Gn:a="4i",_=4;break;case An:a="1f";break;case Tn:a="2f",_=2;break;case In:a="3f",_=3;break;case Nn:a="4f",_=4;break;case Ln:a="Matrix2fv";break;case jn:a="Matrix3fv";break;case Fn:a="Matrix4fv"}if(e(s,".uniform",a,"(",v,","),"M"===a.charAt(0)){var w=Math.pow(h-Ln+2,2),S=t.global.def("new Float32Array(",w,")");Array.isArray(f)?e("false,(",P(w,(function(t){return S+"["+t+"]="+f[t]})),",",S,")"):e("false,(Array.isArray(",f,")||",f," instanceof Float32Array)?",f,":(",P(w,(function(t){return S+"["+t+"]="+f+"["+t+"]"})),",",S,")")}else _>1?e(P(_,(function(t){return Array.isArray(f)?f[t]:f+"["+t+"]"}))):(E(!Array.isArray(f),"uniform value must not be an array"),e(f));e(");")}}function W(t,e,n,r){var i=t.shared,o=i.gl,a=i.draw,u=r.draw;var s=function(){var i,s=u.elements,c=e;return s?((s.contextDep&&r.contextDynamic||s.propDep)&&(c=n),i=s.append(t,c)):i=c.def(a,".",ln),i&&c("if("+i+")"+o+".bindBuffer(34963,"+i+".buffer.buffer);"),i}();function c(i){var o=u[i];return o?o.contextDep&&r.contextDynamic||o.propDep?o.append(t,n):o.append(t,e):e.def(a,".",i)}var f,l,d=c(dn),h=c(pn),p=function(){var i,o=u.count,s=e;return o?((o.contextDep&&r.contextDynamic||o.propDep)&&(s=n),i=o.append(t,s),E.optional((function(){o.MISSING&&t.assert(e,"false","missing vertex count"),o.DYNAMIC&&t.assert(s,i+">=0","missing vertex count")}))):(i=s.def(a,".",hn),E.optional((function(){t.assert(s,i+">=0","missing vertex count")}))),i}();if("number"==typeof p){if(0===p)return}else n("if(",p,"){"),n.exit("}");m&&(f=c(vn),l=t.instancing);var v=s+".type",g=u.elements&&er(u.elements);function y(){function t(){n(l,".drawElementsInstancedANGLE(",[d,p,v,h+"<<(("+v+"-5121)>>1)",f],");")}function e(){n(l,".drawArraysInstancedANGLE(",[d,h,p,f],");")}s?g?t():(n("if(",s,"){"),t(),n("}else{"),e(),n("}")):e()}function b(){function t(){n(o+".drawElements("+[d,p,v,h+"<<(("+v+"-5121)>>1)"]+");")}function e(){n(o+".drawArrays("+[d,h,p]+");")}s?g?t():(n("if(",s,"){"),t(),n("}else{"),e(),n("}")):e()}m&&("number"!=typeof f||f>=0)?"string"==typeof f?(n("if(",f,">0){"),y(),n("}else if(",f,"<0){"),b(),n("}")):y():b()}function H(t,e,n,r,i){var o=M(),a=o.proc("body",i);return E.optional((function(){o.commandStr=e.commandStr,o.command=o.link(e.commandStr)})),m&&(o.instancing=a.def(o.shared.extensions,".angle_instanced_arrays")),t(o,a,n,r),o.compile().body}function X(t,e,n,r){U(t,e),n.useVAO?n.drawVAO?e(t.shared.vao,".setVAO(",n.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),z(t,e,n,r.attributes,(function(){return!0}))),V(t,e,n,r.uniforms,(function(){return!0})),W(t,e,e,n)}function q(t,e,n,r){function i(){return!0}t.batchId="a1",U(t,e),z(t,e,n,r.attributes,i),V(t,e,n,r.uniforms,i),W(t,e,e,n)}function Y(t,e,n,r){U(t,e);var i=n.contextDep,o=e.def(),a=e.def();t.shared.props=a,t.batchId=o;var u=t.scope(),s=t.scope();function c(t){return t.contextDep&&i||t.propDep}function f(t){return!c(t)}if(e(u.entry,"for(",o,"=0;",o,"<","a1",";++",o,"){",a,"=","a0","[",o,"];",s,"}",u.exit),n.needsContext&&G(t,s,n.context),n.needsFramebuffer&&L(t,s,n.framebuffer),F(t,s,n.state,c),n.profile&&c(n.profile)&&B(t,s,n,!1,!0),r)n.useVAO?n.drawVAO?c(n.drawVAO)?s(t.shared.vao,".setVAO(",n.drawVAO.append(t,s),");"):u(t.shared.vao,".setVAO(",n.drawVAO.append(t,u),");"):u(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(u(t.shared.vao,".setVAO(null);"),z(t,u,n,r.attributes,f),z(t,s,n,r.attributes,c)),V(t,u,n,r.uniforms,f),V(t,s,n,r.uniforms,c),W(t,u,s,n);else{var l=t.global.def("{}"),d=n.shader.progVar.append(t,s),h=s.def(d,".id"),p=s.def(l,"[",h,"]");s(t.shared.gl,".useProgram(",d,".program);","if(!",p,"){",p,"=",l,"[",h,"]=",t.link((function(e){return H(q,t,n,e,2)})),"(",d,");}",p,".call(this,a0[",o,"],",o,");")}}function Z(t,e,n){var r=e.static[n];if(r&&function(t){if("object"==typeof t&&!ht(t)){for(var e=Object.keys(t),n=0;n<e.length;++n)if(O.isDynamic(t[e[n]]))return!0;return!1}}(r)){var i=t.global,o=Object.keys(r),a=!1,u=!1,s=!1,c=t.global.def("{}");o.forEach((function(e){var n=r[e];if(O.isDynamic(n)){"function"==typeof n&&(n=r[e]=O.unbox(n));var o=rr(n,null);a=a||o.thisDep,s=s||o.propDep,u=u||o.contextDep}else{switch(i(c,".",e,"="),typeof n){case"number":i(n);break;case"string":i('"',n,'"');break;case"object":Array.isArray(n)&&i("[",n.join(),"]");break;default:i(t.link(n))}i(";")}})),e.dynamic[n]=new O.DynamicVariable(4,{thisDep:a,contextDep:u,propDep:s,ref:c,append:function(t,e){o.forEach((function(n){var i=r[n];if(O.isDynamic(i)){var o=t.invoke(e,i);e(c,".",n,"=",o,";")}}))}}),delete e.static[n]}}return{next:x,current:_,procs:function(){var t=M(),e=t.proc("poll"),n=t.proc("refresh"),o=t.block();e(o),n(o);var a,u=t.shared,s=u.gl,c=u.next,f=u.current;o(f,".dirty=false;"),L(t,e),L(t,n,null,!0),m&&(a=t.link(m)),r.oes_vertex_array_object&&n(t.link(r.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var l=0;l<i.maxAttributes;++l){var d=n.def(u.attributes,"[",l,"]"),h=t.cond(d,".buffer");h.then(s,".enableVertexAttribArray(",l,");",s,".bindBuffer(",Sn,",",d,".buffer.buffer);",s,".vertexAttribPointer(",l,",",d,".size,",d,".type,",d,".normalized,",d,".stride,",d,".offset);").else(s,".disableVertexAttribArray(",l,");",s,".vertexAttrib4f(",l,",",d,".x,",d,".y,",d,".z,",d,".w);",d,".buffer=null;"),n(h),m&&n(a,".vertexAttribDivisorANGLE(",l,",",d,".divisor);")}return n(t.shared.vao,".currentVAO=null;",t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"),Object.keys(S).forEach((function(r){var i=S[r],a=o.def(c,".",r),u=t.block();u("if(",a,"){",s,".enable(",i,")}else{",s,".disable(",i,")}",f,".",r,"=",a,";"),n(u),e("if(",a,"!==",f,".",r,"){",u,"}")})),Object.keys(A).forEach((function(r){var i,a,u=A[r],l=_[r],d=t.block();if(d(s,".",u,"("),ht(l)){var h=l.length;i=t.global.def(c,".",r),a=t.global.def(f,".",r),d(P(h,(function(t){return i+"["+t+"]"})),");",P(h,(function(t){return a+"["+t+"]="+i+"["+t+"];"})).join("")),e("if(",P(h,(function(t){return i+"["+t+"]!=="+a+"["+t+"]"})).join("||"),"){",d,"}")}else i=o.def(c,".",r),a=o.def(f,".",r),d(i,");",f,".",r,"=",i,";"),e("if(",i,"!==",a,"){",d,"}");n(d)})),t.compile()}(),compile:function(t,r,i,o,a){var u=M();u.stats=u.link(a),Object.keys(r.static).forEach((function(t){Z(u,r,t)})),En.forEach((function(e){Z(u,t,e)}));var s=R(t,r,i,o,u);return function(t,e){var n=t.proc("draw",1);U(t,n),G(t,n,e.context),L(t,n,e.framebuffer),j(t,n,e),F(t,n,e.state),B(t,n,e,!1,!0);var r=e.shader.progVar.append(t,n);if(n(t.shared.gl,".useProgram(",r,".program);"),e.shader.program)X(t,n,e,e.shader.program);else{n(t.shared.vao,".setVAO(null);");var i=t.global.def("{}"),o=n.def(r,".id"),a=n.def(i,"[",o,"]");n(t.cond(a).then(a,".call(this,a0);").else(a,"=",i,"[",o,"]=",t.link((function(n){return H(X,t,e,n,1)})),"(",r,");",a,".call(this,a0);"))}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(u,s),function(t,e){var r=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;function a(n){var o=e.shader[n];o&&r.set(i.shader,"."+n,o.append(t,r))}G(t,r,e.context),e.framebuffer&&e.framebuffer.append(t,r),Qn(Object.keys(e.state)).forEach((function(n){var o=e.state[n].append(t,r);ht(o)?o.forEach((function(e,i){r.set(t.next[n],"["+i+"]",e)})):r.set(i.next,"."+n,o)})),B(t,r,e,!0,!0),[ln,pn,hn,vn,dn].forEach((function(n){var o=e.draw[n];o&&r.set(i.draw,"."+n,""+o.append(t,r))})),Object.keys(e.uniforms).forEach((function(o){var a=e.uniforms[o].append(t,r);Array.isArray(a)&&(a="["+a.join()+"]"),r.set(i.uniforms,"["+n.id(o)+"]",a)})),Object.keys(e.attributes).forEach((function(n){var i=e.attributes[n].append(t,r),o=t.scopeAttrib(n);Object.keys(new g).forEach((function(t){r.set(o,"."+t,i[t])}))})),e.scopeVAO&&r.set(i.vao,".targetVAO",e.scopeVAO.append(t,r)),a(cn),a(fn),Object.keys(e.state).length>0&&(r(o,".dirty=true;"),r.exit(o,".dirty=true;")),r("a1(",t.shared.context,",a0,",t.batchId,");")}(u,s),function(t,e){var n=t.proc("batch",2);t.batchId="0",U(t,n);var r=!1,i=!0;Object.keys(e.context).forEach((function(t){r=r||e.context[t].propDep})),r||(G(t,n,e.context),i=!1);var o=e.framebuffer,a=!1;function u(t){return t.contextDep&&r||t.propDep}o?(o.propDep?r=a=!0:o.contextDep&&r&&(a=!0),a||L(t,n,o)):L(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(r=!0),j(t,n,e),F(t,n,e.state,(function(t){return!u(t)})),e.profile&&u(e.profile)||B(t,n,e,!1,"a1"),e.contextDep=r,e.needsContext=i,e.needsFramebuffer=a;var s=e.shader.progVar;if(s.contextDep&&r||s.propDep)Y(t,n,e,null);else{var c=s.append(t,n);if(n(t.shared.gl,".useProgram(",c,".program);"),e.shader.program)Y(t,n,e,e.shader.program);else{n(t.shared.vao,".setVAO(null);");var f=t.global.def("{}"),l=n.def(c,".id"),d=n.def(f,"[",l,"]");n(t.cond(d).then(d,".call(this,a0,a1);").else(d,"=",f,"[",l,"]=",t.link((function(n){return H(Y,t,e,n,2)})),"(",c,");",d,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(u,s),e(u.compile(),{destroy:function(){s.shader.program.destroy()}})}}}var ar=function(t,e){if(!e.ext_disjoint_timer_query)return null;var n=[];function r(t){n.push(t)}var i=[];function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var a=[];function u(t){a.push(t)}var s=[];function c(t,e,n){var r=a.pop()||new o;r.startQueryIndex=t,r.endQueryIndex=e,r.sum=0,r.stats=n,s.push(r)}var f=[],l=[];return{beginQuery:function(t){var r=n.pop()||e.ext_disjoint_timer_query.createQueryEXT();e.ext_disjoint_timer_query.beginQueryEXT(35007,r),i.push(r),c(i.length-1,i.length,t)},endQuery:function(){e.ext_disjoint_timer_query.endQueryEXT(35007)},pushScopeStats:c,update:function(){var t,n,o=i.length;if(0!==o){l.length=Math.max(l.length,o+1),f.length=Math.max(f.length,o+1),f[0]=0,l[0]=0;var a=0;for(t=0,n=0;n<i.length;++n){var c=i[n];e.ext_disjoint_timer_query.getQueryObjectEXT(c,34919)?(a+=e.ext_disjoint_timer_query.getQueryObjectEXT(c,34918),r(c)):i[t++]=c,f[n+1]=a,l[n+1]=t}for(i.length=t,t=0,n=0;n<s.length;++n){var d=s[n],h=d.startQueryIndex,p=d.endQueryIndex;d.sum+=f[p]-f[h];var v=l[h],g=l[p];g===v?(d.stats.gpuTime+=d.sum/1e6,u(d)):(d.startQueryIndex=v,d.endQueryIndex=g,s[t++]=d)}s.length=t}},getNumPendingQueries:function(){return i.length},clear:function(){n.push.apply(n,i);for(var t=0;t<n.length;t++)e.ext_disjoint_timer_query.deleteQueryEXT(n[t]);i.length=0,n.length=0},restore:function(){i.length=0,n.length=0}}},ur="webglcontextlost",sr="webglcontextrestored";function cr(t,e){for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}return function(n){var r=R(n);if(!r)return null;var i=r.gl,o=i.getContextAttributes(),a=i.isContextLost(),u=function(t,e){var n={};function r(e){E.type(e,"string","extension name must be string");var r,i=e.toLowerCase();try{r=n[i]=t.getExtension(i)}catch(t){}return!!r}for(var i=0;i<e.extensions.length;++i){var o=e.extensions[i];if(!r(o))return e.onDestroy(),e.onDone('"'+o+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return e.optionalExtensions.forEach(r),{extensions:n,restore:function(){Object.keys(n).forEach((function(t){if(n[t]&&!r(t))throw new Error("(regl): error restoring extension "+t)}))}}}(i,r);if(!u)return null;var s,c,f=(s={"":0},c=[""],{id:function(t){var e=s[t];return e||(e=s[t]=c.length,c.push(t),e)},str:function(t){return c[t]}}),l={vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},d=u.extensions,h=ar(0,d),p=k(),v=i.drawingBufferWidth,g=i.drawingBufferHeight,y={tick:0,time:0,viewportWidth:v,viewportHeight:g,framebufferWidth:v,framebufferHeight:g,drawingBufferWidth:v,drawingBufferHeight:g,pixelRatio:r.pixelRatio},m=function(t,e){var n=1;e.ext_texture_filter_anisotropic&&(n=t.getParameter(34047));var r=1,i=1;e.webgl_draw_buffers&&(r=t.getParameter(34852),i=t.getParameter(36063));var o=!!e.oes_texture_float;if(o){var a=t.createTexture();t.bindTexture(F,a),t.texImage2D(F,0,U,1,1,0,U,B,null);var u=t.createFramebuffer();if(t.bindFramebuffer(z,u),t.framebufferTexture2D(z,36064,F,a,0),t.bindTexture(F,null),36053!==t.checkFramebufferStatus(z))o=!1;else{t.viewport(0,0,1,1),t.clearColor(1,0,0,1),t.clear(16384);var s=j.allocType(B,4);t.readPixels(0,0,1,1,U,B,s),t.getError()?o=!1:(t.deleteFramebuffer(u),t.deleteTexture(a),o=1===s[0]),j.freeType(s)}}var c=!0;if("undefined"==typeof navigator||!(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent))){var f=t.createTexture(),l=j.allocType(5121,36);t.activeTexture(33984),t.bindTexture(34067,f),t.texImage2D(34069,0,U,3,3,0,U,5121,l),j.freeType(l),t.bindTexture(34067,null),t.deleteTexture(f),c=!t.getError()}return{colorBits:[t.getParameter(3410),t.getParameter(3411),t.getParameter(3412),t.getParameter(3413)],depthBits:t.getParameter(3414),stencilBits:t.getParameter(3415),subpixelBits:t.getParameter(3408),extensions:Object.keys(e).filter((function(t){return!!e[t]})),maxAnisotropic:n,maxDrawbuffers:r,maxColorAttachments:i,pointSizeDims:t.getParameter(33901),lineWidthDims:t.getParameter(33902),maxViewportDims:t.getParameter(3386),maxCombinedTextureUnits:t.getParameter(35661),maxCubeMapSize:t.getParameter(34076),maxRenderbufferSize:t.getParameter(34024),maxTextureUnits:t.getParameter(34930),maxTextureSize:t.getParameter(3379),maxAttributes:t.getParameter(34921),maxVertexUniforms:t.getParameter(36347),maxVertexTextureUnits:t.getParameter(35660),maxVaryingVectors:t.getParameter(36348),maxFragmentUniforms:t.getParameter(36349),glsl:t.getParameter(35724),renderer:t.getParameter(7937),vendor:t.getParameter(7936),version:t.getParameter(7938),readFloat:o,npotTextureCube:c}}(i,d),b=function(e,n,r,i){var o=0,a={};function u(t){this.id=o++,this.buffer=e.createBuffer(),this.type=t,this.usage=35044,this.byteLength=0,this.dimension=1,this.dtype=Q,this.persistentData=null,r.profile&&(this.stats={size:0})}u.prototype.bind=function(){e.bindBuffer(this.type,this.buffer)},u.prototype.destroy=function(){l(this)};var s=[];function c(t,n,r){t.byteLength=n.byteLength,e.bufferData(t.type,n,r)}function f(e,n,r,i,o,a){var u,s;if(e.usage=r,Array.isArray(n)){if(e.dtype=i||tt,n.length>0)if(Array.isArray(n[0])){u=J(n);for(var f=1,l=1;l<u.length;++l)f*=u[l];e.dimension=f,c(e,s=$(n,u,e.dtype),r),a?e.persistentData=s:j.freeType(s)}else if("number"==typeof n[0]){e.dimension=o;var d=j.allocType(e.dtype,n.length);rt(d,n),c(e,d,r),a?e.persistentData=d:j.freeType(d)}else t(n[0])?(e.dimension=n[0].length,e.dtype=i||nt(n[0])||tt,c(e,s=$(n,[n.length,n[0].length],e.dtype),r),a?e.persistentData=s:j.freeType(s)):E.raise("invalid buffer data")}else if(t(n))e.dtype=i||nt(n),e.dimension=o,c(e,n,r),a&&(e.persistentData=new Uint8Array(new Uint8Array(n.buffer)));else if(V(n)){u=n.shape;var h=n.stride,p=n.offset,v=0,g=0,y=0,m=0;1===u.length?(v=u[0],g=1,y=h[0],m=0):2===u.length?(v=u[0],g=u[1],y=h[0],m=h[1]):E.raise("invalid shape"),e.dtype=i||nt(n.data)||tt,e.dimension=g;var b=j.allocType(e.dtype,v*g);it(b,n.data,v,g,y,m,p),c(e,b,r),a?e.persistentData=b:j.freeType(b)}else n instanceof ArrayBuffer?(e.dtype=Q,e.dimension=o,c(e,n,r),a&&(e.persistentData=new Uint8Array(new Uint8Array(n)))):E.raise("invalid buffer data")}function l(t){n.bufferCount--,i(t);var r=t.buffer;E(r,"buffer must not be deleted already"),e.deleteBuffer(r),t.buffer=null,delete a[t.id]}return r.profile&&(n.getTotalBufferSize=function(){var t=0;return Object.keys(a).forEach((function(e){t+=a[e].stats.size})),t}),{create:function(i,o,s,c){n.bufferCount++;var d=new u(o);function h(n){var i=35044,o=null,a=0,u=0,s=1;return Array.isArray(n)||t(n)||V(n)||n instanceof ArrayBuffer?o=n:"number"==typeof n?a=0|n:n&&(E.type(n,"object","buffer arguments must be an object, a number or an array"),"data"in n&&(E(null===o||Array.isArray(o)||t(o)||V(o),"invalid data for buffer"),o=n.data),"usage"in n&&(E.parameter(n.usage,Z,"invalid buffer usage"),i=Z[n.usage]),"type"in n&&(E.parameter(n.type,K,"invalid buffer type"),u=K[n.type]),"dimension"in n&&(E.type(n.dimension,"number","invalid dimension"),s=0|n.dimension),"length"in n&&(E.nni(a,"buffer length must be a nonnegative integer"),a=0|n.length)),d.bind(),o?f(d,o,i,u,s,c):(a&&e.bufferData(d.type,a,i),d.dtype=u||Q,d.usage=i,d.dimension=s,d.byteLength=a),r.profile&&(d.stats.size=d.byteLength*et[d.dtype]),h}function p(t,n){E(n+t.byteLength<=d.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+t.byteLength+" starting from offset "+n+" to a buffer of size "+d.byteLength),e.bufferSubData(d.type,n,t)}return a[d.id]=d,s||h(i),h._reglType="buffer",h._buffer=d,h.subdata=function(e,n){var r,i=0|(n||0);if(d.bind(),t(e)||e instanceof ArrayBuffer)p(e,i);else if(Array.isArray(e)){if(e.length>0)if("number"==typeof e[0]){var o=j.allocType(d.dtype,e.length);rt(o,e),p(o,i),j.freeType(o)}else if(Array.isArray(e[0])||t(e[0])){r=J(e);var a=$(e,r,d.dtype);p(a,i),j.freeType(a)}else E.raise("invalid buffer data")}else if(V(e)){r=e.shape;var u=e.stride,s=0,c=0,f=0,l=0;1===r.length?(s=r[0],c=1,f=u[0],l=0):2===r.length?(s=r[0],c=r[1],f=u[0],l=u[1]):E.raise("invalid shape");var v=Array.isArray(e.data)?d.dtype:nt(e.data),g=j.allocType(v,s*c);it(g,e.data,s,c,f,l,e.offset),p(g,i),j.freeType(g)}else E.raise("invalid data for buffer subdata");return h},r.profile&&(h.stats=d.stats),h.destroy=function(){l(d)},h},createStream:function(t,e){var n=s.pop();return n||(n=new u(t)),n.bind(),f(n,e,35040,0,1,!1),n},destroyStream:function(t){s.push(t)},clear:function(){W(a).forEach(l),s.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof u?t._buffer:null},restore:function(){W(a).forEach((function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)}))},_initBuffer:f}}(i,l,r,(function(t){return _.destroyBuffer(t)})),_=function(e,n,r,i,o){for(var a=r.maxAttributes,u=new Array(a),s=0;s<a;++s)u[s]=new Te;var c=0,f={},l={Record:Te,scope:{},state:u,currentVAO:null,targetVAO:null,restore:d()?function(){d()&&W(f).forEach((function(t){t.refresh()}))}:function(){},createVAO:function(e){var r=new p;function u(e){E(Array.isArray(e),"arguments to vertex array constructor must be an array"),E(e.length<a,"too many attributes"),E(e.length>0,"must specify at least one attribute");var i={},s=r.attributes;s.length=e.length;for(var c=0;c<e.length;++c){var f,l=e[c],d=s[c]=new Te,h=l.data||l;Array.isArray(h)||t(h)||V(h)?(r.buffers[c]&&(f=r.buffers[c],t(h)&&f._buffer.byteLength>=h.byteLength?f.subdata(h):(f.destroy(),r.buffers[c]=null)),r.buffers[c]||(f=r.buffers[c]=o.create(l,34962,!1,!0)),d.buffer=o.getBuffer(f),d.size=0|d.buffer.dimension,d.normalized=!1,d.type=d.buffer.dtype,d.offset=0,d.stride=0,d.divisor=0,d.state=1,i[c]=1):o.getBuffer(l)?(d.buffer=o.getBuffer(l),d.size=0|d.buffer.dimension,d.normalized=!1,d.type=d.buffer.dtype,d.offset=0,d.stride=0,d.divisor=0,d.state=1):o.getBuffer(l.buffer)?(d.buffer=o.getBuffer(l.buffer),d.size=0|(+l.size||d.buffer.dimension),d.normalized=!!l.normalized||!1,"type"in l?(E.parameter(l.type,K,"invalid buffer type"),d.type=K[l.type]):d.type=d.buffer.dtype,d.offset=0|(l.offset||0),d.stride=0|(l.stride||0),d.divisor=0|(l.divisor||0),d.state=1,E(d.size>=1&&d.size<=4,"size must be between 1 and 4"),E(d.offset>=0,"invalid offset"),E(d.stride>=0&&d.stride<=255,"stride must be between 0 and 255"),E(d.divisor>=0,"divisor must be positive"),E(!d.divisor||!!n.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in l?(E(c>0,"first attribute must not be a constant"),d.x=+l.x||0,d.y=+l.y||0,d.z=+l.z||0,d.w=+l.w||0,d.state=2):E(!1,"invalid attribute spec for location "+c)}for(var p=0;p<r.buffers.length;++p)!i[p]&&r.buffers[p]&&(r.buffers[p].destroy(),r.buffers[p]=null);return r.refresh(),u}return i.vaoCount+=1,u.destroy=function(){for(var t=0;t<r.buffers.length;++t)r.buffers[t]&&r.buffers[t].destroy();r.buffers.length=0,r.destroy()},u._vao=r,u._reglType="vao",u(e)},getVAO:function(t){return"function"==typeof t&&t._vao?t._vao:null},destroyBuffer:function(t){for(var n=0;n<u.length;++n){var r=u[n];r.buffer===t&&(e.disableVertexAttribArray(n),r.buffer=null)}},setVAO:d()?function(t){if(t!==l.currentVAO){var e=d();t?e.bindVertexArrayOES(t.vao):e.bindVertexArrayOES(null),l.currentVAO=t}}:function(t){if(t!==l.currentVAO){if(t)t.bindAttrs();else for(var n=h(),r=0;r<u.length;++r){var i=u[r];i.buffer?(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offfset),n&&i.divisor&&n.vertexAttribDivisorANGLE(r,i.divisor)):(e.disableVertexAttribArray(r),e.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}l.currentVAO=t}},clear:d()?function(){W(f).forEach((function(t){t.destroy()}))}:function(){}};function d(){return n.oes_vertex_array_object}function h(){return n.angle_instanced_arrays}function p(){this.id=++c,this.attributes=[];var t=d();this.vao=t?t.createVertexArrayOES():null,f[this.id]=this,this.buffers=[]}return p.prototype.bindAttrs=function(){for(var t=h(),n=this.attributes,r=0;r<n.length;++r){var i=n[r];i.buffer?(e.enableVertexAttribArray(r),e.bindBuffer(34962,i.buffer.buffer),e.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offset),t&&i.divisor&&t.vertexAttribDivisorANGLE(r,i.divisor)):(e.disableVertexAttribArray(r),e.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}for(var o=n.length;o<a;++o)e.disableVertexAttribArray(o)},p.prototype.refresh=function(){var t=d();t&&(t.bindVertexArrayOES(this.vao),this.bindAttrs(),l.currentVAO=this)},p.prototype.destroy=function(){if(this.vao){var t=d();this===l.currentVAO&&(l.currentVAO=null,t.bindVertexArrayOES(null)),t.deleteVertexArrayOES(this.vao),this.vao=null}f[this.id]&&(delete f[this.id],i.vaoCount-=1)},l}(i,d,m,l,b),x=function(e,n,r,i){var o={},a=0,u={uint8:at,uint16:ut};function s(t){this.id=a++,o[this.id]=this,this.buffer=t,this.primType=4,this.vertCount=0,this.type=0}n.oes_element_index_uint&&(u.uint32=st),s.prototype.bind=function(){this.buffer.bind()};var c=[];function f(i,o,a,u,s,c,f){var l;if(i.buffer.bind(),o){var d=f;f||t(o)&&(!V(o)||t(o.data))||(d=n.oes_element_index_uint?st:ut),r._initBuffer(i.buffer,o,a,d,3)}else e.bufferData(ct,c,a),i.buffer.dtype=l||at,i.buffer.usage=a,i.buffer.dimension=3,i.buffer.byteLength=c;if(l=f,!f){switch(i.buffer.dtype){case at:case 5120:l=at;break;case ut:case 5122:l=ut;break;case st:case 5124:l=st;break;default:E.raise("unsupported type for element array")}i.buffer.dtype=l}i.type=l,E(l!==st||!!n.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var h=s;h<0&&(h=i.buffer.byteLength,l===ut?h>>=1:l===st&&(h>>=2)),i.vertCount=h;var p=u;if(u<0){p=4;var v=i.buffer.dimension;1===v&&(p=0),2===v&&(p=1),3===v&&(p=4)}i.primType=p}function l(t){i.elementsCount--,E(null!==t.buffer,"must not double destroy elements"),delete o[t.id],t.buffer.destroy(),t.buffer=null}return{create:function(e,n){var o=r.create(null,ct,!0),a=new s(o._buffer);function c(e){if(e)if("number"==typeof e)o(e),a.primType=4,a.vertCount=0|e,a.type=at;else{var n=null,r=35044,i=-1,s=-1,l=0,d=0;Array.isArray(e)||t(e)||V(e)?n=e:(E.type(e,"object","invalid arguments for elements"),"data"in e&&(n=e.data,E(Array.isArray(n)||t(n)||V(n),"invalid data for element buffer")),"usage"in e&&(E.parameter(e.usage,Z,"invalid element buffer usage"),r=Z[e.usage]),"primitive"in e&&(E.parameter(e.primitive,ot,"invalid element buffer primitive"),i=ot[e.primitive]),"count"in e&&(E("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),s=0|e.count),"type"in e&&(E.parameter(e.type,u,"invalid buffer type"),d=u[e.type]),"length"in e?l=0|e.length:(l=s,d===ut||5122===d?l*=2:d!==st&&5124!==d||(l*=4))),f(a,n,r,i,s,l,d)}else o(),a.primType=4,a.vertCount=0,a.type=at;return c}return i.elementsCount++,c(e),c._reglType="elements",c._elements=a,c.subdata=function(t,e){return o.subdata(t,e),c},c.destroy=function(){l(a)},c},createStream:function(t){var e=c.pop();return e||(e=new s(r.create(null,ct,!0,!1)._buffer)),f(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){c.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof s?t._elements:null},clear:function(){W(o).forEach(l)}}}(i,d,b,l),w=function(t,n,r,i){var o={},a={};function u(t,e,n,r){this.name=t,this.id=e,this.location=n,this.info=r}function s(t,e){for(var n=0;n<t.length;++n)if(t[n].id===e.id)return void(t[n].location=e.location);t.push(e)}function c(e,r,i){var u=35632===e?o:a,s=u[r];if(!s){var c=n.str(r);s=t.createShader(e),t.shaderSource(s,c),t.compileShader(s),E.shaderError(t,s,c,e,i),u[r]=s}return s}var f={},l=[],d=0;function h(t,e){this.id=d++,this.fragId=t,this.vertId=e,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,i.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function p(e,r,o){var a,f,l=c(35632,e.fragId),d=c(35633,e.vertId),h=e.program=t.createProgram();if(t.attachShader(h,l),t.attachShader(h,d),o)for(a=0;a<o.length;++a){var p=o[a];t.bindAttribLocation(h,p[0],p[1])}t.linkProgram(h),E.linkError(t,h,n.str(e.fragId),n.str(e.vertId),r);var v=t.getProgramParameter(h,35718);i.profile&&(e.stats.uniformsCount=v);var g=e.uniforms;for(a=0;a<v;++a)if(f=t.getActiveUniform(h,a))if(f.size>1)for(var y=0;y<f.size;++y){var m=f.name.replace("[0]","["+y+"]");s(g,new u(m,n.id(m),t.getUniformLocation(h,m),f))}else s(g,new u(f.name,n.id(f.name),t.getUniformLocation(h,f.name),f));var b=t.getProgramParameter(h,35721);i.profile&&(e.stats.attributesCount=b);var _=e.attributes;for(a=0;a<b;++a)(f=t.getActiveAttrib(h,a))&&s(_,new u(f.name,n.id(f.name),t.getAttribLocation(h,f.name),f))}return i.profile&&(r.getMaxUniformsCount=function(){var t=0;return l.forEach((function(e){e.stats.uniformsCount>t&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return l.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);W(o).forEach(e),o={},W(a).forEach(e),a={},l.forEach((function(e){t.deleteProgram(e.program)})),l.length=0,f={},r.shaderCount=0},program:function(n,i,u,s){E.command(n>=0,"missing vertex shader",u),E.command(i>=0,"missing fragment shader",u);var c=f[i];c||(c=f[i]={});var d=c[n];if(d&&(d.refCount++,!s))return d;var v=new h(i,n);return r.shaderCount++,p(v,u,s),d||(c[n]=v),l.push(v),e(v,{destroy:function(){if(v.refCount--,v.refCount<=0){t.deleteProgram(v.program);var e=l.indexOf(v);l.splice(e,1),r.shaderCount--}c[v.vertId].refCount<=0&&(t.deleteShader(a[v.vertId]),delete a[v.vertId],delete f[v.fragId][v.vertId]),Object.keys(f[v.fragId]).length||(t.deleteShader(o[v.fragId]),delete o[v.fragId],delete f[v.fragId])}})},restore:function(){o={},a={};for(var t=0;t<l.length;++t)p(l[t],null,l[t].attributes.map((function(t){return[t.location,t.name]})))},shader:c,frag:-1,vert:-1}}(i,f,l,r),S=de(i,d,m,(function(){I.procs.poll()}),y,l,r),A=function(t,e,n,r,i){var o={rgba4:pe,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(o.srgba=35907),e.ext_color_buffer_half_float&&(o.rgba16f=34842,o.rgb16f=34843),e.webgl_color_buffer_float&&(o.rgba32f=34836);var a=[];Object.keys(o).forEach((function(t){var e=o[t];a[e]=t}));var u=0,s={};function c(t){this.id=u++,this.refCount=1,this.renderbuffer=t,this.format=pe,this.width=0,this.height=0,i.profile&&(this.stats={size:0})}function f(e){var n=e.renderbuffer;E(n,"must not double destroy renderbuffer"),t.bindRenderbuffer(he,null),t.deleteRenderbuffer(n),e.renderbuffer=null,e.refCount=0,delete s[e.id],r.renderbufferCount--}return c.prototype.decRef=function(){--this.refCount<=0&&f(this)},i.profile&&(r.getTotalRenderbufferSize=function(){var t=0;return Object.keys(s).forEach((function(e){t+=s[e].stats.size})),t}),{create:function(e,u){var f=new c(t.createRenderbuffer());function l(e,r){var u=0,s=0,c=pe;if("object"==typeof e&&e){var d=e;if("shape"in d){var h=d.shape;E(Array.isArray(h)&&h.length>=2,"invalid renderbuffer shape"),u=0|h[0],s=0|h[1]}else"radius"in d&&(u=s=0|d.radius),"width"in d&&(u=0|d.width),"height"in d&&(s=0|d.height);"format"in d&&(E.parameter(d.format,o,"invalid renderbuffer format"),c=o[d.format])}else"number"==typeof e?(u=0|e,s="number"==typeof r?0|r:u):e?E.raise("invalid arguments to renderbuffer constructor"):u=s=1;if(E(u>0&&s>0&&u<=n.maxRenderbufferSize&&s<=n.maxRenderbufferSize,"invalid renderbuffer size"),u!==f.width||s!==f.height||c!==f.format)return l.width=f.width=u,l.height=f.height=s,f.format=c,t.bindRenderbuffer(he,f.renderbuffer),t.renderbufferStorage(he,c,u,s),E(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=ge(f.format,f.width,f.height)),l.format=a[f.format],l}return s[f.id]=f,r.renderbufferCount++,l(e,u),l.resize=function(e,r){var o=0|e,a=0|r||o;return o===f.width&&a===f.height||(E(o>0&&a>0&&o<=n.maxRenderbufferSize&&a<=n.maxRenderbufferSize,"invalid renderbuffer size"),l.width=f.width=o,l.height=f.height=a,t.bindRenderbuffer(he,f.renderbuffer),t.renderbufferStorage(he,f.format,o,a),E(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=ge(f.format,f.width,f.height))),l},l._reglType="renderbuffer",l._renderbuffer=f,i.profile&&(l.stats=f.stats),l.destroy=function(){f.decRef()},l},clear:function(){W(s).forEach(f)},restore:function(){W(s).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(he,e.renderbuffer),t.renderbufferStorage(he,e.format,e.width,e.height)})),t.bindRenderbuffer(he,null)}}}(i,d,m,l,r),T=function(t,n,r,i,o,a){var u={cur:null,next:null,dirty:!1,setFBO:null},s=["rgba"],c=["rgba4","rgb565","rgb5 a1"];n.ext_srgb&&c.push("srgba"),n.ext_color_buffer_half_float&&c.push("rgba16f","rgb16f"),n.webgl_color_buffer_float&&c.push("rgba32f");var f=["uint8"];function l(t,e,n){this.target=t,this.texture=e,this.renderbuffer=n;var r=0,i=0;e?(r=e.width,i=e.height):n&&(r=n.width,i=n.height),this.width=r,this.height=i}function d(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function h(t,e,n){if(t)if(t.texture){var r=t.texture._texture,i=Math.max(1,r.width),o=Math.max(1,r.height);E(i===e&&o===n,"inconsistent width/height for supplied texture"),r.refCount+=1}else{var a=t.renderbuffer._renderbuffer;E(a.width===e&&a.height===n,"inconsistent width/height for renderbuffer"),a.refCount+=1}}function p(e,n){n&&(n.texture?t.framebufferTexture2D(ye,e,n.target,n.texture._texture.texture,0):t.framebufferRenderbuffer(ye,e,me,n.renderbuffer._renderbuffer.renderbuffer))}function v(t){var e=be,n=null,r=null,i=t;"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),E.type(i,"function","invalid attachment data");var o=i._reglType;return"texture2d"===o?(n=i,E(e===be)):"textureCube"===o?(n=i,E(e>=_e&&e<34075,"invalid cube map target")):"renderbuffer"===o?(r=i,e=me):E.raise("invalid regl object for attachment"),new l(e,n,r)}function g(t,e,n,r,a){if(n){var u=i.create2D({width:t,height:e,format:r,type:a});return u._texture.refCount=0,new l(be,u,null)}var s=o.create({width:t,height:e,format:r});return s._renderbuffer.refCount=0,new l(me,null,s)}function y(t){return t&&(t.texture||t.renderbuffer)}function m(t,e,n){t&&(t.texture?t.texture.resize(e,n):t.renderbuffer&&t.renderbuffer.resize(e,n),t.width=e,t.height=n)}n.oes_texture_half_float&&f.push("half float","float16"),n.oes_texture_float&&f.push("float","float32");var b=0,_={};function x(){this.id=b++,_[this.id]=this,this.framebuffer=t.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function w(t){t.colorAttachments.forEach(d),d(t.depthAttachment),d(t.stencilAttachment),d(t.depthStencilAttachment)}function S(e){var n=e.framebuffer;E(n,"must not double destroy framebuffer"),t.deleteFramebuffer(n),e.framebuffer=null,a.framebufferCount--,delete _[e.id]}function A(e){var n;t.bindFramebuffer(ye,e.framebuffer);var i=e.colorAttachments;for(n=0;n<i.length;++n)p(36064+n,i[n]);for(n=i.length;n<r.maxColorAttachments;++n)t.framebufferTexture2D(ye,36064+n,be,null,0);t.framebufferTexture2D(ye,33306,be,null,0),t.framebufferTexture2D(ye,36096,be,null,0),t.framebufferTexture2D(ye,36128,be,null,0),p(36096,e.depthAttachment),p(36128,e.stencilAttachment),p(33306,e.depthStencilAttachment);var o=t.checkFramebufferStatus(ye);t.isContextLost()||36053===o||E.raise("framebuffer configuration not supported, status = "+Ae[o]),t.bindFramebuffer(ye,u.next?u.next.framebuffer:null),u.cur=u.next,t.getError()}function T(t,i){var o=new x;function l(t,e){var i;E(u.next!==o,"can not update framebuffer which is currently in use");var a=0,d=0,p=!0,m=!0,b=null,_=!0,x="rgba",S="uint8",T=1,I=null,N=null,O=null,C=!1;if("number"==typeof t)a=0|t,d=0|e||a;else if(t){E.type(t,"object","invalid arguments for framebuffer");var k=t;if("shape"in k){var D=k.shape;E(Array.isArray(D)&&D.length>=2,"invalid shape for framebuffer"),a=D[0],d=D[1]}else"radius"in k&&(a=d=k.radius),"width"in k&&(a=k.width),"height"in k&&(d=k.height);("color"in k||"colors"in k)&&(b=k.color||k.colors,Array.isArray(b)&&E(1===b.length||n.webgl_draw_buffers,"multiple render targets not supported")),b||("colorCount"in k&&(T=0|k.colorCount,E(T>0,"invalid color buffer count")),"colorTexture"in k&&(_=!!k.colorTexture,x="rgba4"),"colorType"in k&&(S=k.colorType,_?(E(n.oes_texture_float||!("float"===S||"float32"===S),"you must enable OES_texture_float in order to use floating point framebuffer objects"),E(n.oes_texture_half_float||!("half float"===S||"float16"===S),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===S||"float16"===S?(E(n.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==S&&"float32"!==S||(E(n.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),E.oneOf(S,f,"invalid color type")),"colorFormat"in k&&(x=k.colorFormat,s.indexOf(x)>=0?_=!0:c.indexOf(x)>=0?_=!1:_?E.oneOf(k.colorFormat,s,"invalid color format for texture"):E.oneOf(k.colorFormat,c,"invalid color format for renderbuffer"))),("depthTexture"in k||"depthStencilTexture"in k)&&(C=!(!k.depthTexture&&!k.depthStencilTexture),E(!C||n.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in k&&("boolean"==typeof k.depth?p=k.depth:(I=k.depth,m=!1)),"stencil"in k&&("boolean"==typeof k.stencil?m=k.stencil:(N=k.stencil,p=!1)),"depthStencil"in k&&("boolean"==typeof k.depthStencil?p=m=k.depthStencil:(O=k.depthStencil,p=!1,m=!1))}else a=d=1;var M=null,R=null,P=null,G=null;if(Array.isArray(b))M=b.map(v);else if(b)M=[v(b)];else for(M=new Array(T),i=0;i<T;++i)M[i]=g(a,d,_,x,S);E(n.webgl_draw_buffers||M.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),E(M.length<=r.maxColorAttachments,"too many color attachments, not supported"),a=a||M[0].width,d=d||M[0].height,I?R=v(I):p&&!m&&(R=g(a,d,C,"depth","uint32")),N?P=v(N):m&&!p&&(P=g(a,d,!1,"stencil","uint8")),O?G=v(O):!I&&!N&&m&&p&&(G=g(a,d,C,"depth stencil","depth stencil")),E(!!I+!!N+!!O<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var L=null;for(i=0;i<M.length;++i)if(h(M[i],a,d),E(!M[i]||M[i].texture&&xe.indexOf(M[i].texture._texture.format)>=0||M[i].renderbuffer&&Se.indexOf(M[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),M[i]&&M[i].texture){var j=we[M[i].texture._texture.format]*Ee[M[i].texture._texture.type];null===L?L=j:E(L===j,"all color attachments much have the same number of bits per pixel.")}return h(R,a,d),E(!R||R.texture&&6402===R.texture._texture.format||R.renderbuffer&&33189===R.renderbuffer._renderbuffer.format,"invalid depth attachment for framebuffer object"),h(P,a,d),E(!P||P.renderbuffer&&36168===P.renderbuffer._renderbuffer.format,"invalid stencil attachment for framebuffer object"),h(G,a,d),E(!G||G.texture&&34041===G.texture._texture.format||G.renderbuffer&&34041===G.renderbuffer._renderbuffer.format,"invalid depth-stencil attachment for framebuffer object"),w(o),o.width=a,o.height=d,o.colorAttachments=M,o.depthAttachment=R,o.stencilAttachment=P,o.depthStencilAttachment=G,l.color=M.map(y),l.depth=y(R),l.stencil=y(P),l.depthStencil=y(G),l.width=o.width,l.height=o.height,A(o),l}return a.framebufferCount++,l(t,i),e(l,{resize:function(t,e){E(u.next!==o,"can not resize a framebuffer which is currently in use");var n=Math.max(0|t,1),r=Math.max(0|e||n,1);if(n===o.width&&r===o.height)return l;for(var i=o.colorAttachments,a=0;a<i.length;++a)m(i[a],n,r);return m(o.depthAttachment,n,r),m(o.stencilAttachment,n,r),m(o.depthStencilAttachment,n,r),o.width=l.width=n,o.height=l.height=r,A(o),l},_reglType:"framebuffer",_framebuffer:o,destroy:function(){S(o),w(o)},use:function(t){u.setFBO({framebuffer:l},t)}})}return e(u,{getFramebuffer:function(t){if("function"==typeof t&&"framebuffer"===t._reglType){var e=t._framebuffer;if(e instanceof x)return e}return null},create:T,createCube:function(t){var o=Array(6);function a(t){var r;E(o.indexOf(u.next)<0,"can not update framebuffer which is currently in use");var c,l={color:null},d=0,h=null,p="rgba",v="uint8",g=1;if("number"==typeof t)d=0|t;else if(t){E.type(t,"object","invalid arguments for framebuffer");var y=t;if("shape"in y){var m=y.shape;E(Array.isArray(m)&&m.length>=2,"invalid shape for framebuffer"),E(m[0]===m[1],"cube framebuffer must be square"),d=m[0]}else"radius"in y&&(d=0|y.radius),"width"in y?(d=0|y.width,"height"in y&&E(y.height===d,"must be square")):"height"in y&&(d=0|y.height);("color"in y||"colors"in y)&&(h=y.color||y.colors,Array.isArray(h)&&E(1===h.length||n.webgl_draw_buffers,"multiple render targets not supported")),h||("colorCount"in y&&(g=0|y.colorCount,E(g>0,"invalid color buffer count")),"colorType"in y&&(E.oneOf(y.colorType,f,"invalid color type"),v=y.colorType),"colorFormat"in y&&(p=y.colorFormat,E.oneOf(y.colorFormat,s,"invalid color format for texture"))),"depth"in y&&(l.depth=y.depth),"stencil"in y&&(l.stencil=y.stencil),"depthStencil"in y&&(l.depthStencil=y.depthStencil)}else d=1;if(h)if(Array.isArray(h))for(c=[],r=0;r<h.length;++r)c[r]=h[r];else c=[h];else{c=Array(g);var b={radius:d,format:p,type:v};for(r=0;r<g;++r)c[r]=i.createCube(b)}for(l.color=Array(c.length),r=0;r<c.length;++r){var _=c[r];E("function"==typeof _&&"textureCube"===_._reglType,"invalid cube map"),d=d||_.width,E(_.width===d&&_.height===d,"invalid cube map shape"),l.color[r]={target:_e,data:c[r]}}for(r=0;r<6;++r){for(var x=0;x<c.length;++x)l.color[x].target=_e+r;r>0&&(l.depth=o[0].depth,l.stencil=o[0].stencil,l.depthStencil=o[0].depthStencil),o[r]?o[r](l):o[r]=T(l)}return e(a,{width:d,height:d,color:c})}return a(t),e(a,{faces:o,resize:function(t){var e,n=0|t;if(E(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e<i.length;++e)i[e].resize(n);for(e=0;e<6;++e)o[e].resize(n);return a.width=a.height=n,a},_reglType:"framebufferCube",destroy:function(){o.forEach((function(t){t.destroy()}))}})},clear:function(){W(_).forEach(S)},restore:function(){u.cur=null,u.next=null,u.dirty=!0,W(_).forEach((function(e){e.framebuffer=t.createFramebuffer(),A(e)}))}})}(i,d,m,S,A,l),I=or(i,f,d,m,b,x,0,T,{},_,w,{elements:null,primitive:4,count:-1,offset:0,instances:-1},y,h,r),N=Oe(i,T,I.procs.poll,y,o,d,m),D=I.next,M=i.canvas,P=[],G=[],L=[],H=[r.onDestroy],X=null;function q(){if(0===P.length)return h&&h.update(),void(X=null);X=C.next(q),mt();for(var t=P.length-1;t>=0;--t){var e=P[t];e&&e(y,null,0)}i.flush(),h&&h.update()}function Y(){!X&&P.length>0&&(X=C.next(q))}function ft(){X&&(C.cancel(q),X=null)}function lt(t){t.preventDefault(),a=!0,ft(),G.forEach((function(t){t()}))}function dt(t){i.getError(),a=!1,u.restore(),w.restore(),b.restore(),S.restore(),A.restore(),T.restore(),_.restore(),h&&h.restore(),I.procs.refresh(),Y(),L.forEach((function(t){t()}))}function ht(t){function n(t,e){var n={},r={};return Object.keys(t).forEach((function(i){var o=t[i];if(O.isDynamic(o))r[i]=O.unbox(o,i);else{if(e&&Array.isArray(o))for(var a=0;a<o.length;++a)if(O.isDynamic(o[a]))return void(r[i]=O.unbox(o,i));n[i]=o}})),{dynamic:r,static:n}}E(!!t,"invalid args to regl({...})"),E.type(t,"object","invalid args to regl({...})");var r=n(t.context||{},!0),i=n(t.uniforms||{},!0),o=n(t.attributes||{},!1),u=n(function(t){var n=e({},t);function r(t){if(t in n){var e=n[t];delete n[t],Object.keys(e).forEach((function(r){n[t+"."+r]=e[r]}))}}return delete n.uniforms,delete n.attributes,delete n.context,delete n.vao,"stencil"in n&&n.stencil.op&&(n.stencil.opBack=n.stencil.opFront=n.stencil.op,delete n.stencil.op),r("blend"),r("depth"),r("cull"),r("stencil"),r("polygonOffset"),r("scissor"),r("sample"),"vao"in t&&(n.vao=t.vao),n}(t),!1),s={gpuTime:0,cpuTime:0,count:0},c=I.compile(u,o,i,r,s),f=c.draw,l=c.batch,d=c.scope,h=[];return e((function(t,e){var n;if(a&&E.raise("context lost"),"function"==typeof t)return d.call(this,null,t,0);if("function"==typeof e)if("number"==typeof t)for(n=0;n<t;++n)d.call(this,null,e,n);else{if(!Array.isArray(t))return d.call(this,t,e,0);for(n=0;n<t.length;++n)d.call(this,t[n],e,n)}else if("number"==typeof t){if(t>0)return l.call(this,function(t){for(;h.length<t;)h.push(null);return h}(0|t),0|t)}else{if(!Array.isArray(t))return f.call(this,t);if(t.length)return l.call(this,t,t.length)}}),{stats:s,destroy:function(){c.destroy()}})}M&&(M.addEventListener(ur,lt,!1),M.addEventListener(sr,dt,!1));var pt=T.setFBO=ht({framebuffer:O.define.call(null,1,"framebuffer")});function vt(t,e){var n=0;I.procs.poll();var r=e.color;r&&(i.clearColor(+r[0]||0,+r[1]||0,+r[2]||0,+r[3]||0),n|=16384),"depth"in e&&(i.clearDepth(+e.depth),n|=256),"stencil"in e&&(i.clearStencil(0|e.stencil),n|=1024),E(!!n,"called regl.clear with no buffer specified"),i.clear(n)}function gt(t){return E.type(t,"function","regl.frame() callback must be a function"),P.push(t),Y(),{cancel:function(){var e=cr(P,t);E(e>=0,"cannot cancel a frame twice"),P[e]=function t(){var e=cr(P,t);P[e]=P[P.length-1],P.length-=1,P.length<=0&&ft()}}}}function yt(){var t=D.viewport,e=D.scissor_box;t[0]=t[1]=e[0]=e[1]=0,y.viewportWidth=y.framebufferWidth=y.drawingBufferWidth=t[2]=e[2]=i.drawingBufferWidth,y.viewportHeight=y.framebufferHeight=y.drawingBufferHeight=t[3]=e[3]=i.drawingBufferHeight}function mt(){y.tick+=1,y.time=_t(),yt(),I.procs.poll()}function bt(){S.refresh(),yt(),I.procs.refresh(),h&&h.update()}function _t(){return(k()-p)/1e3}bt();var xt=e(ht,{clear:function(t){if(E("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var n=0;n<6;++n)pt(e({framebuffer:t.framebuffer.faces[n]},t),vt);else pt(t,vt);else vt(0,t)},prop:O.define.bind(null,1),context:O.define.bind(null,2),this:O.define.bind(null,3),draw:ht({}),buffer:function(t){return b.create(t,34962,!1,!1)},elements:function(t){return x.create(t,!1)},texture:S.create2D,cube:S.createCube,renderbuffer:A.create,framebuffer:T.create,framebufferCube:T.createCube,vao:_.createVAO,attributes:o,frame:gt,on:function(t,e){var n;switch(E.type(e,"function","listener callback must be a function"),t){case"frame":return gt(e);case"lost":n=G;break;case"restore":n=L;break;case"destroy":n=H;break;default:E.raise("invalid event, must be one of frame,lost,restore,destroy")}return n.push(e),{cancel:function(){for(var t=0;t<n.length;++t)if(n[t]===e)return n[t]=n[n.length-1],void n.pop()}}},limits:m,hasExtension:function(t){return m.extensions.indexOf(t.toLowerCase())>=0},read:N,destroy:function(){P.length=0,ft(),M&&(M.removeEventListener(ur,lt),M.removeEventListener(sr,dt)),w.clear(),T.clear(),A.clear(),S.clear(),x.clear(),b.clear(),_.clear(),h&&h.clear(),H.forEach((function(t){t()}))},_gl:i,_refresh:bt,poll:function(){mt(),h&&h.update()},now:_t,stats:l});return r.onDone(null,xt),xt}}()},2842:(t,e,n)=>{var r=n(1799).default;function i(){"use strict";t.exports=i=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function d(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,o=Object.create(i.prototype),u=new N(r||[]);return a(o,"_invoke",{value:S(t,n,u)}),o}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=d;var p={};function v(){}function g(){}function y(){}var m={};l(m,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(O([])));_&&_!==n&&o.call(_,s)&&(m=_);var x=y.prototype=v.prototype=Object.create(m);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,a,u,s){var c=h(t[i],t,a);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==r(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,u,s)}),(function(t){n("throw",t,u,s)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,s)}))}s(c.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(o,o):o()}})}function S(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=A(a,n);if(u){if(u===p)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=h(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function A(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var r=h(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,p;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function T(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 I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function O(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:C}}function C(){return{value:void 0,done:!0}}return g.prototype=y,a(x,"constructor",{value:y,configurable:!0}),a(y,"constructor",{value:g,configurable:!0}),g.displayName=l(y,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,f,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},w(E.prototype),l(E.prototype,c,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new E(d(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(x),l(x,f,"Generator"),l(x,s,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,N.prototype={constructor:N,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(I),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=o.call(i,"catchLoc"),s=o.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},1799:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},2662:(t,e,n)=>{var r=n(2842)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n(9216);var t,e=(t=n(2680))&&t.__esModule?t:{default:t};e.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),e.default._babelPolyfill=!0})(),(()=>{"use strict";n.r(r),n.d(r,{CircularLayout:()=>Vt,ComboCombinedLayout:()=>A_,ComboForceLayout:()=>w_,ConcentricLayout:()=>Pf,DagreCompoundLayout:()=>ef,DagreLayout:()=>or,ERLayout:()=>Y_,Force2Layout:()=>Y,ForceAtlas2Layout:()=>D_,ForceLayout:()=>Ft,FruchtermanGPULayout:()=>g_,FruchtermanLayout:()=>Ff,GForceGPULayout:()=>__,GForceLayout:()=>P,GridLayout:()=>C,Layout:()=>K_,Layouts:()=>Z_,MDSLayout:()=>Lf,RadialLayout:()=>Mf,RandomLayout:()=>D,getLayoutByName:()=>N,registerLayout:()=>T,unRegisterLayout:()=>I});var t=function(){function t(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return t.prototype.layout=function(t){return this.init(t),this.execute(!0)},t.prototype.init=function(t){this.nodes=t.nodes||[],this.edges=t.edges||[],this.combos=t.combos||[],this.comboEdges=t.comboEdges||[],this.hiddenNodes=t.hiddenNodes||[],this.hiddenEdges=t.hiddenEdges||[],this.hiddenCombos=t.hiddenCombos||[]},t.prototype.execute=function(t){},t.prototype.executeWithWorker=function(){},t.prototype.getDefaultCfg=function(){return{}},t.prototype.updateCfg=function(t){t&&Object.assign(this,t)},t.prototype.getType=function(){return"base"},t.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},t}(),e=function(t){return"string"==typeof t},i=(Object.create(null),Array.isArray),o=function(t){return"number"==typeof t},a=function(t){return Number.isNaN(Number(t))};function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}var s,c=function(){return c=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},c.apply(this,arguments)},f=function(t){return null!==t&&"object"===u(t)},l=function t(e){if(null===e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){var n=[];return e.forEach((function(t){n.push(t)})),n.map((function(e){return t(e)}))}if("object"===u(e)&&Object.keys(e).length){var r=c({},e);return Object.keys(r).forEach((function(e){r[e]=t(r[e])})),r}return e},d=function(t,e){var n=t[e];return f(n)?n.cell:n},h=function(t,e,n){for(var r=[],i=0;i<t;i++)r[i]={in:0,out:0,all:0};return n?(n.forEach((function(t){var n=d(t,"source"),i=d(t,"target");n&&r[e[n]]&&(r[e[n]].out+=1,r[e[n]].all+=1),i&&r[e[i]]&&(r[e[i]].in+=1,r[e[i]].all+=1)})),r):r},p=function(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},v=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e,i.push([])})),null==r||r.forEach((function(t){var n=d(t,"source"),r=d(t,"target"),a=o[n],u=o[r];void 0!==a&&void 0!==u&&(i[a][u]=1,e||(i[u][a]=1))})),i},g=function t(e,n){if(e&&e.children)for(var r=e.children.length-1;r>=0;r--)if(!t(e.children[r],n))return;return!!n(e)},y=function(t,e){"function"==typeof e&&g(t,e)},m=function(t){var e={x:0,y:0};t.forEach((function(t){e.x+=t.x||0,e.y+=t.y||0}));var n=t.length||1;return{x:e.x/n,y:e.y/n}},b=function(t,e,n){var r,i;return"source"===t?(null===(r=null==n?void 0:n.find((function(t){return t.target===e.id})))||void 0===r?void 0:r.source)||{}:(null===(i=null==n?void 0:n.find((function(t){return t.source===e.id})))||void 0===i?void 0:i.target)||{}},_=function(t,e,n){var r=[];switch(t){case"source":r=null==n?void 0:n.filter((function(t){return t.source===e.id})).map((function(t){return t.target}));break;case"target":r=null==n?void 0:n.filter((function(t){return t.target===e.id})).map((function(t){return t.source}));break;case"both":r=null==n?void 0:n.filter((function(t){return t.source===e.id})).map((function(t){return t.target})).concat(null==n?void 0:n.filter((function(t){return t.target===e.id})).map((function(t){return t.source})))}var i=new Set(r);return Array.from(i)},x=function(t){return"function"==typeof t},w=function(t,e,n){return n||(o(t)?function(){return t}:function(){return e})},E=function(t,e,n){return void 0===n&&(n=!0),e||0===e?x(e)?e:o(e)?function(){return e}:i(e)?function(){if(n){var r=Math.max.apply(Math,e);return isNaN(r)?t:r}return e}:f(e)?function(){if(n){var r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:function(){return t}:function(e){return e.size?i(e.size)?e.size[0]>e.size[1]?e.size[0]:e.size[1]:f(e.size)?e.size.width>e.size.height?e.size.width:e.size.height:e.size:t}},S=(s=function(t,e){return s=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])},s(t,e)},function(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}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),A=new Map,T=function(e,n){if(A.get(e)&&console.warn("The layout with the name ".concat(e," exists already, it will be overridden")),f(n)){var r=function(t){function e(e){var r=t.call(this)||this,i=r,o={},a=i.getDefaultCfg();return Object.assign(o,a,n,e),Object.keys(o).forEach((function(t){var e=o[t];i[t]=e})),r}return S(e,t),e}(t);A.set(e,r)}else A.set(e,n);return A.get(e)},I=function(t){A.has(t)&&A.delete(t)},N=function(t){return A.has(t)?A.get(t):null},O=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=function(t){function n(e){var n=t.call(this)||this;return n.begin=[0,0],n.preventOverlap=!0,n.preventOverlapPadding=10,n.condense=!1,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.row=0,n.col=0,n.cellWidth=0,n.cellHeight=0,n.cellUsed={},n.id2manPos={},n.onLayoutEnd=function(){},n.updateCfg(e),n}return O(n,t),n.prototype.getDefaultCfg=function(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30}},n.prototype.execute=function(){var t=this,n=t.nodes,r=t.edges,o=t.begin,u=n.length;if(0===u)return t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:r};if(1===u)return n[0].x=o[0],n[0].y=o[1],t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:r};var s=t.sortBy,c=t.width,f=t.height,l=t.condense,d=t.preventOverlapPadding,p=t.preventOverlap,v=t.nodeSpacing,g=t.nodeSize,y=[];n.forEach((function(t){y.push(t)}));var m={};if(y.forEach((function(t,e){m[t.id]=e})),("degree"===s||!e(s)||void 0===y[0][s])&&(s="degree",a(n[0].degree))){var b=h(y.length,m,r);y.forEach((function(t,e){t.degree=b[e].all}))}y.sort((function(t,e){return e[s]-t[s]})),c||"undefined"==typeof window||(c=window.innerWidth),f||"undefined"==typeof window||(f=window.innerHeight);var _=t.rows,x=null!=t.cols?t.cols:t.columns;if(t.cells=u,null!=_&&null!=x?(t.rows=_,t.cols=x):null!=_&&null==x?(t.rows=_,t.cols=Math.ceil(t.cells/t.rows)):null==_&&null!=x?(t.cols=x,t.rows=Math.ceil(t.cells/t.cols)):(t.splits=Math.sqrt(t.cells*t.height/t.width),t.rows=Math.round(t.splits),t.cols=Math.round(t.width/t.height*t.splits)),t.rows=Math.max(t.rows,1),t.cols=Math.max(t.cols,1),t.cols*t.rows>t.cells)((S=t.small())-1)*(w=t.large())>=t.cells?t.small(S-1):(w-1)*S>=t.cells&&t.large(w-1);else for(;t.cols*t.rows<t.cells;){var w,S=t.small();((w=t.large())+1)*S>=t.cells?t.large(w+1):t.small(S+1)}if(t.cellWidth=c/t.cols,t.cellHeight=f/t.rows,l&&(t.cellWidth=0,t.cellHeight=0),p||v){var A=E(10,v),T=E(30,g,!1);y.forEach((function(e){e.x&&e.y||(e.x=0,e.y=0);var n,r,o=T(e)||30;i(o)?(n=o[0],r=o[1]):(n=o,r=o);var a=void 0!==A?A(e):d,u=n+a,s=r+a;t.cellWidth=Math.max(t.cellWidth,u),t.cellHeight=Math.max(t.cellHeight,s)}))}t.cellUsed={},t.row=0,t.col=0,t.id2manPos={};for(var I=0;I<y.length;I++){var N=y[I],O=void 0;if(t.position&&(O=t.position(N)),O&&(void 0!==O.row||void 0!==O.col)){var C={row:O.row,col:O.col};if(void 0===C.col)for(C.col=0;t.used(C.row,C.col);)C.col++;else if(void 0===C.row)for(C.row=0;t.used(C.row,C.col);)C.row++;t.id2manPos[N.id]=C,t.use(C.row,C.col)}t.getPos(N)}return t.onLayoutEnd&&t.onLayoutEnd(),{edges:r,nodes:y}},n.prototype.small=function(t){var e,n=this,r=n.rows||5,i=n.cols||5;return null==t?e=Math.min(r,i):Math.min(r,i)===n.rows?n.rows=t:n.cols=t,e},n.prototype.large=function(t){var e,n=this,r=n.rows||5,i=n.cols||5;return null==t?e=Math.max(r,i):Math.max(r,i)===n.rows?n.rows=t:n.cols=t,e},n.prototype.used=function(t,e){return this.cellUsed["c-".concat(t,"-").concat(e)]||!1},n.prototype.use=function(t,e){this.cellUsed["c-".concat(t,"-").concat(e)]=!0},n.prototype.moveToNextCell=function(){var t=this,e=t.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},n.prototype.getPos=function(t){var e,n,r=this,i=r.begin,o=r.cellWidth,a=r.cellHeight,u=r.id2manPos[t.id];if(u)e=u.col*o+o/2+i[0],n=u.row*a+a/2+i[1];else{for(;r.used(r.row,r.col);)r.moveToNextCell();e=r.col*o+o/2+i[0],n=r.row*a+a/2+i[1],r.use(r.row,r.col),r.moveToNextCell()}t.x=e,t.y=n},n.prototype.getType=function(){return"grid"},n}(t),k=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),D=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return k(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.center;return t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),e&&e.forEach((function(e){e.x=.9*(Math.random()-.5)*t.width+n[0],e.y=.9*(Math.random()-.5)*t.height+n[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(t),M=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),R=function(t,e){return t?o(t)?function(e){return t}:t:function(t){return e||1}},P=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=500,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.preventOverlap=!0,n.collideStrength=1,n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.animate=!0,n.updateCfg(e),n}return M(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t,e,n=this,r=n.nodes;if(void 0!==n.timeInterval&&"undefined"!=typeof window&&window.clearInterval(n.timeInterval),r&&0!==r.length){n.width||"undefined"==typeof window||(n.width=window.innerWidth),n.height||"undefined"==typeof window||(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var a=n.center;if(1===r.length)return r[0].x=a[0],r[0].y=a[1],void(null===(e=n.onLayoutEnd)||void 0===e||e.call(n));var u={},s={};r.forEach((function(t,e){o(t.x)||(t.x=Math.random()*n.width),o(t.y)||(t.y=Math.random()*n.height),u[t.id]=t,s[t.id]=e})),n.nodeMap=u,n.nodeIdxMap=s,n.linkDistance=R(n.linkDistance,1),n.nodeStrength=R(n.nodeStrength,1),n.edgeStrength=R(n.edgeStrength,1);var c,l=n.nodeSize;if(n.preventOverlap){var d,p=n.nodeSpacing;d=o(p)?function(){return p}:x(p)?p:function(){return 0},c=l?i(l)?function(t){return Math.max(l[0],l[1])+d(t)}:function(t){return l+d(t)}:function(t){return t.size?i(t.size)?Math.max(t.size[0],t.size[1])+d(t):f(t.size)?Math.max(t.size.width,t.size.height)+d(t):t.size+d(t):10+d(t)}}n.nodeSize=c;var v=n.edges;n.degrees=h(r.length,n.nodeIdxMap,v),n.getMass||(n.getMass=function(t){return t.mass||n.degrees[n.nodeIdxMap[t.id]].all||1}),n.run()}else null===(t=n.onLayoutEnd)||void 0===t||t.call(n)},e.prototype.run=function(){var t,e=this,n=e.maxIteration,r=e.nodes,i=e.workerEnabled,o=e.minMovement,a=e.animate;if(r)if(i||!a){for(var u=0;u<n;u++){var s=e.runOneStep(u);if(e.reachMoveThreshold(r,s,o))break}null===(t=e.onLayoutEnd)||void 0===t||t.call(e)}else{if("undefined"==typeof window)return;var c=0;this.timeInterval=window.setInterval((function(){var t,i;if(r){var a=e.runOneStep(c)||[];e.reachMoveThreshold(r,a,o)&&(null===(t=e.onLayoutEnd)||void 0===t||t.call(e),window.clearInterval(e.timeInterval)),++c>=n&&(null===(i=e.onLayoutEnd)||void 0===i||i.call(e),window.clearInterval(e.timeInterval))}}),0)}},e.prototype.reachMoveThreshold=function(t,e,n){var r=0;return t.forEach((function(t,n){var i=t.x-e[n].x,o=t.y-e[n].y;r+=Math.sqrt(i*i+o*o)})),(r/=t.length)<n},e.prototype.runOneStep=function(t){var e,n=this,r=n.nodes,i=n.edges,o=[],a=[];if(r){r.forEach((function(t,e){o[2*e]=0,o[2*e+1]=0,a[2*e]=0,a[2*e+1]=0})),n.calRepulsive(o,r),i&&n.calAttractive(o,i),n.calGravity(o,r);var u=Math.max(.02,n.interval-.002*t);n.updateVelocity(o,a,u,r);var s=[];return r.forEach((function(t){s.push({x:t.x,y:t.y})})),n.updatePosition(a,u,r),null===(e=n.tick)||void 0===e||e.call(n),s}},e.prototype.calRepulsive=function(t,e){var n=this,r=n.getMass,i=n.factor,o=n.coulombDisScale,a=n.preventOverlap,u=n.collideStrength,s=void 0===u?1:u,c=n.nodeStrength,f=n.nodeSize;e.forEach((function(n,u){var l=r?r(n):1;e.forEach((function(e,d){if(!(u>=d)){var h=n.x-e.x,p=n.y-e.y;0===h&&0===p&&(h=.01*Math.random(),p=.01*Math.random());var v=h*h+p*p,g=Math.sqrt(v),y=(g+.1)*o,m=h/g,b=p/g,_=.5*(c(n)+c(e))*i/(y*y),x=r?r(e):1;if(t[2*u]+=m*_,t[2*u+1]+=b*_,t[2*d]-=m*_,t[2*d+1]-=b*_,a&&(f(n)+f(e))/2>g){var w=s*(c(n)+c(e))*.5/v;t[2*u]+=m*w/l,t[2*u+1]+=b*w/l,t[2*d]-=m*w/x,t[2*d+1]-=b*w/x}}}))}))},e.prototype.calAttractive=function(t,e){var n=this,r=n.nodeMap,i=n.nodeIdxMap,o=n.linkDistance,a=n.edgeStrength,u=n.nodeSize,s=n.getMass;e.forEach((function(e,n){var c=d(e,"source"),f=d(e,"target"),l=r[c],h=r[f],p=h.x-l.x,v=h.y-l.y;0===p&&0===v&&(p=.01*Math.random(),v=.01*Math.random());var g=Math.sqrt(p*p+v*v),y=p/g,m=v/g,b=((o(e,l,h)||1+(u(l)+u(h)||0)/2)-g)*a(e),_=i[c],x=i[f],w=s?s(l):1,E=s?s(h):1;t[2*_]-=y*b/w,t[2*_+1]-=m*b/w,t[2*x]+=y*b/E,t[2*x+1]+=m*b/E}))},e.prototype.calGravity=function(t,e){for(var n=this,r=n.center,i=n.gravity,a=n.degrees,u=e.length,s=0;s<u;s++){var c=e[s],f=c.x-r[0],l=c.y-r[1],d=i;if(n.getCenter){var h=n.getCenter(c,a[s].all);h&&o(h[0])&&o(h[1])&&o(h[2])&&(f=c.x-h[0],l=c.y-h[1],d=h[2])}d&&(t[2*s]-=d*f,t[2*s+1]-=d*l)}},e.prototype.updateVelocity=function(t,e,n,r){var i=this,o=n*i.damping;r.forEach((function(n,r){var a=t[2*r]*o||.01,u=t[2*r+1]*o||.01,s=Math.sqrt(a*a+u*u);if(s>i.maxSpeed){var c=i.maxSpeed/s;a*=c,u*=c}e[2*r]=a,e[2*r+1]=u}))},e.prototype.updatePosition=function(t,e,n){n.forEach((function(n,r){if(o(n.fx)&&o(n.fy))return n.x=n.fx,void(n.y=n.fy);var i=t[2*r]*e,a=t[2*r+1]*e;n.x+=i,n.y+=a}))},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(t);function G(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,u,s,c,f,l,d,h=t._root,p={data:r},v=t._x0,g=t._y0,y=t._x1,m=t._y1;if(!h)return t._root=p,t;for(;h.length;)if((c=e>=(o=(v+y)/2))?v=o:y=o,(f=n>=(a=(g+m)/2))?g=a:m=a,i=h,!(h=h[l=f<<1|c]))return i[l]=p,t;if(u=+t._x.call(null,h.data),s=+t._y.call(null,h.data),e===u&&n===s)return p.next=h,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=e>=(o=(v+y)/2))?v=o:y=o,(f=n>=(a=(g+m)/2))?g=a:m=a}while((l=f<<1|c)==(d=(s>=a)<<1|u>=o));return i[d]=h,i[l]=p,t}function L(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function j(t){return t[0]}function F(t){return t[1]}function U(t,e,n){var r=new B(null==e?j:e,null==n?F:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function B(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 z(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var V=U.prototype=B.prototype;V.copy=function(){var t,e,n=new B(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=z(r),n;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]=z(e));return n},V.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return G(this.cover(e,n),e,n,t)},V.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,c=1/0,f=-1/0,l=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,u[n]=i,r<s&&(s=r),r>f&&(f=r),i<c&&(c=i),i>l&&(l=i));if(s>f||c>l)return this;for(this.cover(s,c).cover(f,l),n=0;n<o;++n)G(this,a[n],u[n],t[n]);return this},V.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;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,u,s=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(u=(e<r)<<1|t<n,(a=new Array(4))[u]=c,c=a,s*=2,u){case 0:i=n+s,o=r+s;break;case 1:n=i-s,o=r+s;break;case 2:i=n+s,r=o-s;break;case 3:n=i-s,r=o-s}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},V.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},V.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]]},V.find=function(t,e,n){var r,i,o,a,u,s,c,f=this._x0,l=this._y0,d=this._x1,h=this._y1,p=[],v=this._root;for(v&&p.push(new L(v,f,l,d,h)),null==n?n=1/0:(f=t-n,l=e-n,d=t+n,h=e+n,n*=n);s=p.pop();)if(!(!(v=s.node)||(i=s.x0)>d||(o=s.y0)>h||(a=s.x1)<f||(u=s.y1)<l))if(v.length){var g=(i+a)/2,y=(o+u)/2;p.push(new L(v[3],g,y,a,u),new L(v[2],i,y,g,u),new L(v[1],g,o,a,y),new L(v[0],i,o,g,y)),(c=(e>=y)<<1|t>=g)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=s)}else{var m=t-+this._x.call(null,v.data),b=e-+this._y.call(null,v.data),_=m*m+b*b;if(_<n){var x=Math.sqrt(n=_);f=t-x,l=e-x,d=t+x,h=e+x,r=v.data}}return r},V.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,u,s,c,f,l,d,h=this._root,p=this._x0,v=this._y0,g=this._x1,y=this._y1;if(!h)return this;if(h.length)for(;;){if((c=o>=(u=(p+g)/2))?p=u:g=u,(f=a>=(s=(v+y)/2))?v=s:y=s,e=h,!(h=h[l=f<<1|c]))return this;if(!h.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(n=e,d=l)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):e?(i?e[l]=i:delete e[l],(h=e[0]||e[1]||e[2]||e[3])&&h===(e[3]||e[2]||e[1]||e[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=i,this)},V.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},V.root=function(){return this._root},V.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},V.visit=function(t){var e,n,r,i,o,a,u=[],s=this._root;for(s&&u.push(new L(s,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(s=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&s.length){var c=(r+o)/2,f=(i+a)/2;(n=s[3])&&u.push(new L(n,c,f,o,a)),(n=s[2])&&u.push(new L(n,r,f,c,a)),(n=s[1])&&u.push(new L(n,c,i,o,f)),(n=s[0])&&u.push(new L(n,r,i,c,f))}return this},V.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new L(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,u=e.y0,s=e.x1,c=e.y1,f=(a+s)/2,l=(u+c)/2;(o=i[0])&&n.push(new L(o,a,u,f,l)),(o=i[1])&&n.push(new L(o,f,u,s,l)),(o=i[2])&&n.push(new L(o,a,l,f,c)),(o=i[3])&&n.push(new L(o,f,l,s,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},V.x=function(t){return arguments.length?(this._x=t,this):this._x},V.y=function(t){return arguments.length?(this._y=t,this):this._y};function W(t){var e=0,n=0,r=0;if(t.length){for(var i=0;i<4;i++)(o=t[i])&&o.weight&&(e+=o.weight,n+=o.x*o.weight,r+=o.y*o.weight);t.x=n/e,t.y=r/e,t.weight=e}else{var o=t;t.x=o.data.x,t.y=o.data.y,t.weight=o.data.weight}}var H=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),X=function(){return X=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},X.apply(this,arguments)},q=function(t,e){return t?o(t)?function(e){return t}:t:function(t){return e||1}},Y=function(t){function e(e){var n=t.call(this)||this;n.maxIteration=1e3,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=500,n.minMovement=.4,n.interval=.02,n.factor=1,n.linkDistance=200,n.gravity=0,n.clusterNodeStrength=20,n.preventOverlap=!0,n.distanceThresholdMode="mean",n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.judgingDistance=0,n.centripetalOptions={leaf:2,single:2,others:1,center:function(t){return{x:n.width/2,y:n.height/2}}};var r=e.getMass;return n.propsGetMass=r,n.updateCfg(e),n}return H(e,t),e.prototype.getCentripetalOptions=function(){var t,e=this,n=e.leafCluster,r=e.clustering,i=e.nodeClusterBy,o=e.nodes,a=e.nodeMap,u=e.clusterNodeStrength,s=function(t){return"function"==typeof u?u(t):u},c={};if(n){t=this.getSameTypeLeafMap()||{};var f=Array.from(new Set(null==o?void 0:o.map((function(t){return t[i]}))))||[];c={single:100,leaf:function(e,n,r){var i=t[e.id]||{},o=i.relativeLeafNodes,a=i.sameTypeLeafNodes;return(null==a?void 0:a.length)===(null==o?void 0:o.length)||1===(null==f?void 0:f.length)?1:s(e)},others:1,center:function(e,n,r){var i,o,a=((null===(i=e.data)||void 0===i?void 0:i.layout)||{}).degree;if(!a)return{x:100,y:100};if(1===a){var u=(t[e.id]||{}).sameTypeLeafNodes,s=void 0===u?[]:u;1===s.length?o=void 0:s.length>1&&(o=m(s))}else o=void 0;return{x:null==o?void 0:o.x,y:null==o?void 0:o.y}}}}if(r){t||(t=this.getSameTypeLeafMap());var l=Array.from(new Set(o.map((function(t,e){return t[i]})))).filter((function(t){return void 0!==t})),d={};l.forEach((function(t){var e=o.filter((function(e){return e[i]===t})).map((function(t){return a[t.id]}));d[t]=m(e)})),c={single:function(t){return s(t)},leaf:function(t){return s(t)},others:function(t){return s(t)},center:function(t,e,n){var r=d[t[i]];return{x:null==r?void 0:r.x,y:null==r?void 0:r.y}}}}this.centripetalOptions=X(X({},this.centripetalOptions),c);var h=this.centripetalOptions,p=h.leaf,v=h.single,g=h.others;p&&"function"!=typeof p&&(this.centripetalOptions.leaf=function(){return p}),v&&"function"!=typeof v&&(this.centripetalOptions.single=function(){return v}),g&&"function"!=typeof g&&(this.centripetalOptions.others=function(){return g})},e.prototype.updateCfg=function(t){t&&Object.assign(this,t)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t=this;t.stop();var e=t.nodes,n=t.edges,r=t.defSpringLen;if(t.judgingDistance=0,e&&0!==e.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var a=t.center;if(1===e.length)return e[0].x=a[0],e[0].y=a[1],void t.onLayoutEnd([X({},e[0])]);t.degreesMap=function(t,e){var n={};return t.forEach((function(t){n[t.id]={in:0,out:0,all:0}})),e?(e.forEach((function(t){var e=d(t,"source"),r=d(t,"target");e&&(n[e].out+=1,n[e].all+=1),r&&(n[r].in+=1,n[r].all+=1)})),n):n}(e,n),t.propsGetMass?t.getMass=t.propsGetMass:t.getMass=function(e){var n=1;o(e.mass)&&(n=e.mass);var r=t.degreesMap[e.id].all;return!r||r<5?n:5*r*n};var u,s=t.nodeSize;if(t.preventOverlap){var c,l=t.nodeSpacing;c=o(l)?function(){return l}:x(l)?l:function(){return 0},u=s?i(s)?function(t){return Math.max(s[0],s[1])+c(t)}:function(t){return s+c(t)}:function(t){return t.size?i(t.size)?Math.max(t.size[0],t.size[1])+c(t):f(t.size)?Math.max(t.size.width,t.size.height)+c(t):t.size+c(t):10+c(t)}}t.nodeSize=u,t.linkDistance=q(t.linkDistance,1),t.nodeStrength=q(t.nodeStrength,1),t.edgeStrength=q(t.edgeStrength,1);var h={},p={};e.forEach((function(e,n){o(e.x)||(e.x=Math.random()*t.width),o(e.y)||(e.y=Math.random()*t.height);var r=t.degreesMap[e.id];h[e.id]=X(X({},e),{data:X(X({},e.data),{size:t.nodeSize(e)||30,layout:{inDegree:r.in,outDegree:r.out,degree:r.all,tDegree:r.in,sDegree:r.out,force:{mass:t.getMass(e),nodeStrength:t.nodeStrength(e)}}})}),p[e.id]=n})),t.nodeMap=h,t.nodeIdxMap=p,t.edgeInfos=[],null==n||n.forEach((function(e){var n=h[e.source],i=h[e.target];n&&i?t.edgeInfos.push({edgeStrength:t.edgeStrength(e),linkDistance:r?r(X(X({},e),{source:n,target:i}),n,i):t.linkDistance(e,n,i)||1+(s(n)+s(n)||0)/2}):elf.edgeInfos.push({})})),this.getCentripetalOptions(),t.onLayoutEnd=t.onLayoutEnd||function(){},t.run()}else t.onLayoutEnd([])},e.prototype.run=function(){var t=this,e=t.maxIteration,n=t.nodes,r=t.workerEnabled,i=t.minMovement,o=t.animate,a=t.nodeMap;if(n){var u=[];n.forEach((function(t,e){u[2*e]=0,u[2*e+1]=0}));var s=e;if(r||!o){for(var c=0;(t.judgingDistance>i||c<1)&&c<s;c++)t.runOneStep(c,u);t.onLayoutEnd(Object.values(a))}else{if("undefined"==typeof window)return;var f=0;this.timeInterval=window.setInterval((function(){n&&(t.runOneStep(f,u),(++f>=s||t.judgingDistance<i)&&(t.onLayoutEnd(Object.values(a)),window.clearInterval(t.timeInterval)))}),0)}}},e.prototype.runOneStep=function(t,e){var n,r=this,i=r.nodes,o=r.edges,a=(r.nodeMap,r.monitor),u=[];if(null==i?void 0:i.length){r.calRepulsive(u),o&&r.calAttractive(u),r.calGravity(u);var s=r.interval;r.updateVelocity(u,e,s),r.updatePosition(e,s),null===(n=r.tick)||void 0===n||n.call(r),a&&a({energy:this.calTotalEnergy(u),nodes:i,edges:o,iterations:t})}},e.prototype.calTotalEnergy=function(t){var e=this.nodes,n=this.nodeMap;if(!(null==e?void 0:e.length))return 0;var r=0;return e.forEach((function(e,i){var o=t[2*i],a=t[2*i+1],u=o*o+a*a,s=n[e.id].data.layout.force.mass;r+=(void 0===s?1:s)*u*.5})),r},e.prototype.calRepulsive=function(t){var e=this,n=e.nodes,r=e.nodeMap,i=e.factor,o=e.coulombDisScale;e.nodeSize,function(t,e,n,r,i){var o=n/r,a=t.map((function(t,n){var r=e[t.id],i=r.data,a=r.x,u=r.y,s=r.size,c=i.layout.force.nodeStrength;return{x:a,y:u,size:s,index:n,vx:0,vy:0,weight:o*c}})),u=U(a,(function(t){return t.x}),(function(t){return t.y})).visitAfter(W);a.forEach((function(t){!function(t,e){e.visit((function(e,n,r,i,o){return function(t,e,n,r,i,o){var a=o.x-t.x||.1,u=o.y-t.y||.1,s=r-e,c=a*a+u*u,f=Math.sqrt(c)*c;if(s*s*.81<c){var l=t.weight/f;return o.vx+=a*l,o.vy+=u*l,!0}if(t.length)return!1;t.data!==o&&(l=t.data.weight/f,o.vx+=a*l,o.vy+=u*l)}(e,n,0,i,0,t)}))}(t,u)})),a.map((function(n,r){var o=e[t[r].id].data.layout.force.mass,a=void 0===o?1:o;i[2*r]=n.vx/a,i[2*r+1]=n.vy/a}))}(n,r,i,o*o,t)},e.prototype.calAttractive=function(t){var e=this,n=e.edges,r=e.nodeMap,i=e.nodeIdxMap,o=e.edgeInfos;e.nodeSize,n.forEach((function(e,n){var a=d(e,"source"),u=d(e,"target"),s=r[a],c=r[u];if(s&&c){var f=c.x-s.x,l=c.y-s.y;f||l||(f=.01*Math.random(),l=.01*Math.random());var h=Math.sqrt(f*f+l*l),p=f/h,v=l/h,g=o[n]||{},y=g.linkDistance,m=void 0===y?200:y,b=g.edgeStrength,_=(m-h)*(void 0===b?200:b),x=1/(s.data.layout.force.mass||1),w=1/(c.data.layout.force.mass||1),E=p*_,S=v*_,A=2*i[a],T=2*i[u];t[A]-=E*x,t[A+1]-=S*x,t[T]+=E*w,t[T+1]+=S*w}}))},e.prototype.calGravity=function(t){var e,n=this,r=n.nodes,i=n.edges,a=void 0===i?[]:i,u=n.nodeMap,s=n.width,c=n.height,f=n.center,l=n.gravity,d=n.degreesMap,h=n.centripetalOptions;if(r)for(var p=r.length,v=0;v<p;v++){var g=2*v,y=u[r[v].id],m=y.data.layout.force.mass,b=void 0===m?1:m,_=0,x=0,w=l,E=d[y.id],S=E.in,A=E.out,T=E.all,I=null===(e=n.getCenter)||void 0===e?void 0:e.call(n,y,T);if(I){var N=I[0],O=I[1],C=I[2];_=y.x-N,x=y.y-O,w=C}else _=y.x-f[0],x=y.y-f[1];if(w&&(t[g]-=w*_/b,t[g+1]-=w*x/b),h){var k=h.leaf,D=h.single,M=h.others,R=h.center,P=(null==R?void 0:R(y,r,a,s,c))||{x:0,y:0,centerStrength:0},G=P.x,L=P.y,j=P.centerStrength;if(!o(G)||!o(L))continue;var F=(y.x-G)/b,U=(y.y-L)/b;if(j&&(t[g]-=j*F,t[g+1]-=j*U),0===T){var B=D(y);if(!B)continue;t[g]-=B*F,t[g+1]-=B*U;continue}if(0===S||0===A){var z=k(y,r,a);if(!z)continue;t[g]-=z*F,t[g+1]-=z*U;continue}var V=M(y);if(!V)continue;t[g]-=V*F,t[g+1]-=V*U}}},e.prototype.updateVelocity=function(t,e,n){var r=this,i=r.nodes,o=r.damping,a=r.maxSpeed;(null==i?void 0:i.length)&&i.forEach((function(r,i){var u=(e[2*i]+t[2*i]*n)*o||.01,s=(e[2*i+1]+t[2*i+1]*n)*o||.01,c=Math.sqrt(u*u+s*s);if(c>a){var f=a/c;u*=f,s*=f}e[2*i]=u,e[2*i+1]=s}))},e.prototype.updatePosition=function(t,e){var n=this,r=n.nodes,i=n.distanceThresholdMode,a=n.nodeMap;if(null==r?void 0:r.length){var u=0;"max"===i?n.judgingDistance=-1/0:"min"===i&&(n.judgingDistance=1/0),r.forEach((function(r,s){var c=a[r.id];if(o(r.fx)&&o(r.fy))return r.x=r.fx,r.y=r.fy,c.x=r.x,void(c.y=r.y);var f=t[2*s]*e,l=t[2*s+1]*e;r.x+=f,r.y+=l,c.x=r.x,c.y=r.y;var d=Math.sqrt(f*f+l*l);switch(i){case"max":n.judgingDistance<d&&(n.judgingDistance=d);break;case"min":n.judgingDistance>d&&(n.judgingDistance=d);break;default:u+=d}})),i&&"mean"!==i||(n.judgingDistance=u/r.length)}else this.judgingDistance=0},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,e=t.nodeClusterBy,n=t.nodes,r=t.edges,i=t.nodeMap,o=t.degreesMap;if(null==n?void 0:n.length){var a={};return n.forEach((function(t,n){1===o[t.id].all&&(a[t.id]=function(t,e,n,r,i,o){var a=i[e.id],u=a.in,s=a.out,c=e,f=[];0===u?(c=b("source",e,n),f=_("both",c,n).map((function(t){return o[t]}))):0===s&&(c=b("target",e,n),f=_("both",c,n).map((function(t){return o[t]}))),f=f.filter((function(t){return i[t.id]&&(0===i[t.id].in||0===i[t.id].out)}));var l=function(t,e,n,r,i){var o=n[e]||"",a=(null==r?void 0:r.filter((function(t){return t[e]===o})))||[];return a=a.filter((function(t){var e,n;return 0===(null===(e=i[t.id])||void 0===e?void 0:e.in)||0===(null===(n=i[t.id])||void 0===n?void 0:n.out)})),a}(0,r,e,f,i);return{coreNode:c,relativeLeafNodes:f,sameTypeLeafNodes:l}}(0,t,r,e,o,i))})),a}},e}(t);function K(t){return function(){return t}}function Z(t){return 1e-6*(t()-.5)}var $={value:()=>{}};function J(){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 Q(r)}function Q(t){this._=t}function tt(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function et(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function nt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=$,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Q.prototype=J.prototype={constructor:Q,on:function(t,e){var n,r=this._,i=tt(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=nt(r[n],t.name,e);else if(null==e)for(n in r)r[n]=nt(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=et(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Q(t)},call:function(t,e){if((n=arguments.length-2)>0)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)}};const rt=J;var it,ot,at=0,ut=0,st=0,ct=0,ft=0,lt=0,dt="object"==typeof performance&&performance.now?performance:Date,ht="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function pt(){return ft||(ht(vt),ft=dt.now()+lt)}function vt(){ft=0}function gt(){this._call=this._time=this._next=null}function yt(t,e,n){var r=new gt;return r.restart(t,e,n),r}function mt(){ft=(ct=dt.now())+lt,at=ut=0;try{!function(){pt(),++at;for(var t,e=it;e;)(t=ft-e._time)>=0&&e._call.call(null,t),e=e._next;--at}()}finally{at=0,function(){for(var t,e,n=it,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:it=e);ot=t,_t(r)}(),ft=0}}function bt(){var t=dt.now(),e=t-ct;e>1e3&&(lt-=e,ct=t)}function _t(t){at||(ut&&(ut=clearTimeout(ut)),t-ft>24?(t<1/0&&(ut=setTimeout(mt,t-dt.now()-lt)),st&&(st=clearInterval(st))):(st||(ct=dt.now(),st=setInterval(bt,1e3)),at=1,ht(mt)))}gt.prototype=yt.prototype={constructor:gt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?pt():+n)+(null==e?0:+e),this._next||ot===this||(ot?ot._next=this:it=this,ot=this),this._call=t,this._time=n,_t()},stop:function(){this._call&&(this._call=null,this._time=1/0,_t())}};const xt=4294967296;function wt(t){return t.x}function Et(t){return t.y}var St=Math.PI*(3-Math.sqrt(5));function At(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=yt(l),c=rt("tick","end"),f=function(){let t=1;return()=>(t=(1664525*t+1013904223)%xt)/xt}();function l(){d(),c.call("tick",e),n<r&&(s.stop(),c.call("end",e))}function d(r){var s,c,f=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(n+=(o-n)*i,u.forEach((function(t){t(n)})),s=0;s<f;++s)null==(c=t[s]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function h(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*St;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,f),e}return null==t&&(t=[]),h(),e={tick:d,restart:function(){return s.restart(l),e},stop:function(){return s.stop(),e},nodes:function(n){return arguments.length?(t=n,h(),u.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(f=t,u.forEach(p),e):f},force:function(t,n){return arguments.length>1?(null==n?u.delete(t):u.set(t,p(n)),e):u.get(t)},find:function(e,n,r){var i,o,a,u,s,c=0,f=t.length;for(null==r?r=1/0:r*=r,c=0;c<f;++c)(a=(i=e-(u=t[c]).x)*i+(o=n-u.y)*o)<r&&(s=u,r=a);return s},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function Tt(){var t,e,n,r,i,o=K(-30),a=1,u=1/0,s=.81;function c(n){var i,o=t.length,a=U(t,wt,Et).visitAfter(l);for(r=n,i=0;i<o;++i)e=t[i],a.visit(d)}function f(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function l(t){var e,n,r,o,a,u=0,s=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(u+=e.value,s+=n,r+=n*e.x,o+=n*e.y);t.x=r/s,t.y=o/s}else{(e=t).x=e.data.x,e.y=e.data.y;do{u+=i[e.data.index]}while(e=e.next)}t.value=u}function d(t,o,c,f){if(!t.value)return!0;var l=t.x-e.x,d=t.y-e.y,h=f-o,p=l*l+d*d;if(h*h/s<p)return p<u&&(0===l&&(p+=(l=Z(n))*l),0===d&&(p+=(d=Z(n))*d),p<a&&(p=Math.sqrt(a*p)),e.vx+=l*t.value*r/p,e.vy+=d*t.value*r/p),!0;if(!(t.length||p>=u)){(t.data!==e||t.next)&&(0===l&&(p+=(l=Z(n))*l),0===d&&(p+=(d=Z(n))*d),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(h=i[t.data.index]*r/p,e.vx+=l*h,e.vy+=d*h)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,f()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:K(+t),f(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c.theta=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c}function It(t,e){var n,r=1;function i(){var i,o,a=n.length,u=0,s=0;for(i=0;i<a;++i)u+=(o=n[i]).x,s+=o.y;for(u=(u/a-t)*r,s=(s/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=u,o.y-=s}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function Nt(t){return t.index}function Ot(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Ct(t){var e,n,r,i,o,a,u=Nt,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=K(30),f=1;function l(r){for(var i=0,u=t.length;i<f;++i)for(var s,c,l,d,h,p,v,g=0;g<u;++g)c=(s=t[g]).source,d=(l=s.target).x+l.vx-c.x-c.vx||Z(a),h=l.y+l.vy-c.y-c.vy||Z(a),d*=p=((p=Math.sqrt(d*d+h*h))-n[g])/p*r*e[g],h*=p,l.vx-=d*(v=o[g]),l.vy-=h*v,c.vx+=d*(v=1-v),c.vy+=h*v}function d(){if(r){var a,s,c=r.length,f=t.length,l=new Map(r.map(((t,e)=>[u(t,e,r),t])));for(a=0,i=new Array(c);a<f;++a)(s=t[a]).index=a,"object"!=typeof s.source&&(s.source=Ot(l,s.source)),"object"!=typeof s.target&&(s.target=Ot(l,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(a=0,o=new Array(f);a<f;++a)s=t[a],o[a]=i[s.source.index]/(i[s.source.index]+i[s.target.index]);e=new Array(f),h(),n=new Array(f),p()}}function h(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+s(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,e){r=t,a=e,d()},l.links=function(e){return arguments.length?(t=e,d(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(f=+t,l):f},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:K(+t),h(),l):s},l.distance=function(t){return arguments.length?(c="function"==typeof t?t:K(+t),p(),l):c},l}function kt(t){return t.x+t.vx}function Dt(t){return t.y+t.vy}function Mt(t){var e,n,r,i=1,o=1;function a(){for(var t,a,s,c,f,l,d,h=e.length,p=0;p<o;++p)for(a=U(e,kt,Dt).visitAfter(u),t=0;t<h;++t)s=e[t],l=n[s.index],d=l*l,c=s.x+s.vx,f=s.y+s.vy,a.visit(v);function v(t,e,n,o,a){var u=t.data,h=t.r,p=l+h;if(!u)return e>c+p||o<c-p||n>f+p||a<f-p;if(u.index>s.index){var v=c-u.x-u.vx,g=f-u.y-u.vy,y=v*v+g*g;y<p*p&&(0===v&&(y+=(v=Z(r))*v),0===g&&(y+=(g=Z(r))*g),y=(p-(y=Math.sqrt(y)))/y*i,s.vx+=(v*=y)*(p=(h*=h)/(d+h)),s.vy+=(g*=y)*p,u.vx-=v*(p=1-p),u.vy-=g*p)}}}function u(t){if(t.data)return t.r=n[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 s(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=K(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,s()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:K(+e),s(),a):t},a}function Rt(t){var e,n,r,i=K(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=K(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:K(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:K(+e),a(),o):t},o}function Pt(t){var e,n,r,i=K(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=K(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:K(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:K(+e),a(),o):t},o}var Gt="GPU_LAYOUT_END",Lt={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},jt=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ft=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.nodeStrength=null,n.edgeStrength=null,n.preventOverlap=!1,n.clusterNodeStrength=null,n.clusterEdgeStrength=null,n.clusterEdgeDistance=null,n.clusterNodeSize=null,n.clusterFociStrength=null,n.linkDistance=50,n.alphaDecay=.028,n.alphaMin=.001,n.alpha=.3,n.collideStrength=1,n.workerEnabled=!1,n.tick=function(){},n.onLayoutEnd=function(){},n.ticking=void 0,e&&n.updateCfg(e),n}return jt(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],nodeStrength:null,edgeStrength:null,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,tick:function(){},onLayoutEnd:function(){},workerEnabled:!1}},e.prototype.init=function(t){var e=this;e.nodes=t.nodes||[];var n=t.edges||[];e.edges=n.map((function(t){var e={},n=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(t).forEach((function(r){n.indexOf(r)>-1||(e[r]=t[r])})),e})),e.ticking=!1},e.prototype.execute=function(t){var e=this,n=e.nodes,r=e.edges;if(!e.ticking){var i=e.forceSimulation,o=e.alphaMin,a=e.alphaDecay,u=e.alpha;if(i)t&&(e.clustering&&e.clusterForce&&(e.clusterForce.nodes(n),e.clusterForce.links(r)),i.nodes(n),r&&e.edgeForce?e.edgeForce.links(r):r&&!e.edgeForce&&(f=Ct().id((function(t){return t.id})).links(r),e.edgeStrength&&f.strength(e.edgeStrength),e.linkDistance&&f.distance(e.linkDistance),e.edgeForce=f,i.force("link",f))),e.preventOverlap&&e.overlapProcess(i),i.alpha(u).restart(),this.ticking=!0;else try{var s=Tt();if(e.nodeStrength&&s.strength(e.nodeStrength),i=At().nodes(n),e.clustering){var c=function(){function t(t){return function(){return t}}var e,n=function(t){return t.cluster},r=t(1),i=t(-1),o=t(100),a=t(.1),u=[0,0],s=[],c={},f=[],l=100,h=100,p={none:{x:0,y:0}},v=[],g="force",y=!0,m=.1;function b(t){if(!y)return b;e.tick(),x();for(var r=0,i=s.length,o=void 0,a=t*m;r<i;++r)(o=s[r]).vx+=(p[n(o)].x-o.x)*a,o.vy+=(p[n(o)].y-o.y)*a}function _(){s&&function(){if(s&&s.length){if(void 0===n(s[0]))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");var t,u,p,g,y,m=(t=[],u=[],p={},y=[],g=function(t){var e={};return t.forEach((function(t){var r=n(t);e[r]||(e[r]={count:0,sumforceNodeSize:0})})),t.forEach((function(t){var i=n(t),o=r(t),a=e[i];a.count=a.count+1,a.sumforceNodeSize=a.sumforceNodeSize+Math.PI*(o*o)*1.3,e[i]=a})),e}(s),y=function(t){var e={},r=[];return t.forEach((function(t){var r=function(t){var e=d(t,"source"),r=d(t,"target"),i=n(c[e]),o=n(c[r]);return i<=o?"".concat(i,"~").concat(o):"".concat(o,"~").concat(i)}(t),i=0;void 0!==e[r]&&(i=e[r]),i+=1,e[r]=i})),Object.entries(e).forEach((function(t){var e=t[0],n=t[1],i=e.split("~")[0],o=e.split("~")[1];void 0!==i&&void 0!==o&&r.push({source:i,target:o,count:n})})),r}(f),Object.keys(g).forEach((function(e,n){var r=g[e];t.push({id:e,size:r.count,r:Math.sqrt(r.sumforceNodeSize/Math.PI)}),p[e]=n})),y.forEach((function(t){var e=d(t,"source"),n=d(t,"target"),r=p[e],i=p[n];void 0!==r&&void 0!==i&&u.push({source:r,target:i,count:t.count})})),{nodes:t,links:u});e=At(m.nodes).force("x",Rt(l).strength(.1)).force("y",Pt(h).strength(.1)).force("collide",Mt((function(t){return t.r})).iterations(4)).force("charge",Tt().strength(i)).force("links",Ct(m.nodes.length?m.links:[]).distance(o).strength(a)),v=e.nodes(),x()}}()}function x(){return p={none:{x:0,y:0}},v.forEach((function(t){p[t.id]={x:t.x-u[0],y:t.y-u[1]}})),p}function w(t){c={},t.forEach((function(t){c[t.id]=t}))}return b.initialize=function(t){s=t,_()},b.template=function(t){return arguments.length?(g=t,_(),b):g},b.groupBy=function(t){return arguments.length?"string"==typeof t?(n=function(e){return e[t]},b):(n=t,b):n},b.enableGrouping=function(t){return arguments.length?(y=t,b):y},b.strength=function(t){return arguments.length?(m=t,b):m},b.centerX=function(t){return arguments.length?(l=t,b):l},b.centerY=function(t){return arguments.length?(h=t,b):h},b.nodes=function(t){return arguments.length?(w(t||[]),s=t||[],b):s},b.links=function(t){return arguments.length?(f=t||[],_(),b):f},b.forceNodeSize=function(e){return arguments.length?(r="function"==typeof e?e:t(+e),_(),b):r},b.nodeSize=b.forceNodeSize,b.forceCharge=function(e){return arguments.length?(i="function"==typeof e?e:t(+e),_(),b):i},b.forceLinkDistance=function(e){return arguments.length?(o="function"==typeof e?e:t(+e),_(),b):o},b.forceLinkStrength=function(e){return arguments.length?(a="function"==typeof e?e:t(+e),_(),b):a},b.offset=function(t){return arguments.length?(u=t,b):u},b.getFocis=x,b}();c.centerX(e.center[0]).centerY(e.center[1]).template("force").strength(e.clusterFociStrength),r&&c.links(r),n&&c.nodes(n),c.forceLinkDistance(e.clusterEdgeDistance).forceLinkStrength(e.clusterEdgeStrength).forceCharge(e.clusterNodeStrength).forceNodeSize(e.clusterNodeSize),e.clusterForce=c,i.force("group",c)}if(i.force("center",It(e.center[0],e.center[1])).force("charge",s).alpha(u).alphaDecay(a).alphaMin(o),e.preventOverlap&&e.overlapProcess(i),r){var f=Ct().id((function(t){return t.id})).links(r);e.edgeStrength&&f.strength(e.edgeStrength),e.linkDistance&&f.distance(e.linkDistance),e.edgeForce=f,i.force("link",f)}if(e.workerEnabled&&!Ut()&&(e.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),e.workerEnabled){i.stop();for(var l=function(t){var e=t.alphaMin(),n=t.alphaTarget(),r=t.alpha(),i=Math.log((e-n)/(r-n))/Math.log(1-t.alphaDecay());return Math.ceil(i)}(i),h=1;h<=l;h++)i.tick(),postMessage({nodes:n,currentTick:h,totalTicks:l,type:"LAYOUT_TICK"},void 0);e.ticking=!1}else i.on("tick",(function(){e.tick()})).on("end",(function(){e.ticking=!1,e.onLayoutEnd&&e.onLayoutEnd()})),e.ticking=!0;e.forceSimulation=i,e.ticking=!0}catch(t){e.ticking=!1,console.warn(t)}}},e.prototype.overlapProcess=function(t){var e,n,r=this,a=r.nodeSize,u=r.nodeSpacing,s=r.collideStrength;if(n=o(u)?function(){return u}:x(u)?u:function(){return 0},a)if(x(a))e=function(t){return a(t)+n(t)};else if(i(a)){var c=(a[0]>a[1]?a[0]:a[1])/2;e=function(t){return c+n(t)}}else if(o(a)){var l=a/2;e=function(t){return l+n(t)}}else e=function(){return 10};else e=function(t){return t.size?i(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+n(t):f(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2+n(t):t.size/2+n(t):10+n(t)};t.force("collisionForce",Mt(e).strength(s))},e.prototype.updateCfg=function(t){var e=this;e.ticking&&(e.forceSimulation.stop(),e.ticking=!1),e.forceSimulation=null,Object.assign(e,t)},e.prototype.destroy=function(){var t=this;t.ticking&&(t.forceSimulation.stop(),t.ticking=!1),t.nodes=null,t.edges=null,t.destroyed=!0},e}(t);function Ut(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}var Bt=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function zt(t,e){var n=t.degree,r=e.degree;return n<r?-1:n>r?1:0}var Vt=function(t){function e(e){var n=t.call(this)||this;return n.radius=null,n.nodeSize=void 0,n.startRadius=null,n.endRadius=null,n.startAngle=0,n.endAngle=2*Math.PI,n.clockwise=!0,n.divisions=1,n.ordering=null,n.angleRatio=1,n.nodes=[],n.edges=[],n.nodeMap={},n.degrees=[],n.width=300,n.height=300,n.updateCfg(e),n}return Bt(e,t),e.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},e.prototype.execute=function(){var t,e=this,n=e.nodes,r=e.edges,i=n.length;if(0!==i){e.width||"undefined"==typeof window||(e.width=window.innerWidth),e.height||"undefined"==typeof window||(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);var o=e.center;if(1===i)return n[0].x=o[0],n[0].y=o[1],void(e.onLayoutEnd&&e.onLayoutEnd());var a=e.radius,u=e.startRadius,s=e.endRadius,c=e.divisions,f=e.startAngle,l=e.endAngle,d=e.angleRatio,p=e.ordering,v=e.clockwise,g=e.nodeSpacing,y=e.nodeSize,m=(l-f)/i,b={};n.forEach((function(t,e){b[t.id]=e})),e.nodeMap=b;var _=h(n.length,b,r);if(e.degrees=_,g){var x=E(10,g),w=E(10,y),S=-1/0;n.forEach((function(t){var e=w(t);S<e&&(S=e)}));var A=0;n.forEach((function(t,e){A+=0===e?S||10:(x(t)||0)+(S||10)})),a=A/(2*Math.PI)}else a||u||s?!u&&s?u=s:u&&!s&&(s=u):a=e.height>e.width?e.width/2:e.height/2;var T=m*d,I=[];I="topology"===p?e.topologyOrdering():"topology-directed"===p?e.topologyOrdering(!0):"degree"===p?e.degreeOrdering():n;for(var N=Math.ceil(i/c),O=0;O<i;++O){var C=a;C||null===u||null===s||(C=u+O*(s-u)/(i-1)),C||(C=10+100*O/(i-1));var k=f+O%N*T+2*Math.PI/c*Math.floor(O/N);v||(k=l-O%N*T-2*Math.PI/c*Math.floor(O/N)),I[O].x=o[0]+Math.cos(k)*C,I[O].y=o[1]+Math.sin(k)*C,I[O].weight=_[O].all}return null===(t=e.onLayoutEnd)||void 0===t||t.call(e),{nodes:I,edges:this.edges}}e.onLayoutEnd&&e.onLayoutEnd()},e.prototype.topologyOrdering=function(t){void 0===t&&(t=!1);var e=this,n=e.degrees,r=e.edges,i=e.nodes,o=l(i),a=e.nodeMap,u=[o[0]],s=[i[0]],c=[],f=i.length;c[0]=!0,function(t,e,n,r){t.forEach((function(e,n){t[n].children=[],t[n].parent=[]})),r?e.forEach((function(e){var r=d(e,"source"),i=d(e,"target"),o=0;r&&(o=n[r]);var a=0;i&&(a=n[i]);var u=t[o].children,s=t[a].parent;u.push(t[a].id),s.push(t[o].id)})):e.forEach((function(e){var r=d(e,"source"),i=d(e,"target"),o=0;r&&(o=n[r]);var a=0;i&&(a=n[i]);var u=t[o].children,s=t[a].children;u.push(t[a].id),s.push(t[o].id)}))}(o,r,a,t);var h=0;return o.forEach((function(t,e){if(0!==e)if(e!==f-1&&n[e].all===n[e+1].all&&!function(t,e,n){for(var r=n.length,i=0;i<r;i++){var o=d(n[i],"source"),a=d(n[i],"target");if(t.id===o&&e.id===a||e.id===o&&t.id===a)return!0}return!1}(u[h],t,r)||c[e]){for(var l=u[h].children,p=!1,v=0;v<l.length;v++){var g=a[l[v]];if(n[g].all===n[e].all&&!c[g]){u.push(o[g]),s.push(i[a[o[g].id]]),c[g]=!0,p=!0;break}}for(var y=0;!p&&(c[y]||(u.push(o[y]),s.push(i[a[o[y].id]]),c[y]=!0,p=!0),++y!==f););}else u.push(t),s.push(i[a[t.id]]),c[e]=!0,h++})),s},e.prototype.degreeOrdering=function(){var t=this.nodes,e=[],n=this.degrees;return t.forEach((function(t,r){t.degree=n[r].all,e.push(t)})),e.sort(zt),e},e.prototype.getType=function(){return"circular"},e}(t),Wt=function(t,e){if("next"!==t&&"prev"!==t)return e},Ht=function(t){t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};const Xt=function(){function t(){var t={};t.prev=t,t.next=t.prev,this.shortcut=t}return t.prototype.dequeue=function(){var t=this.shortcut,e=t.prev;if(e&&e!==t)return Ht(e),e},t.prototype.enqueue=function(t){var e=this.shortcut;t.prev&&t.next&&Ht(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e},t.prototype.toString=function(){for(var t=[],e=this.shortcut,n=e.prev;n!==e;)t.push(JSON.stringify(n,Wt)),n=null==n?void 0:n.prev;return"[".concat(t.join(", "),"]")},t}();var qt;function Yt(t,e){var n=t.get(e)||0;t.set(e,n+1)}function Kt(t,e){var n=t.get(e);void 0!==n&&((n-=1)>0?t.set(e,n):t.delete(e))}function Zt(t,e,n,r){var i=String(e),o=String(n);if(!t&&i>o){var a=i;i=o,o=a}return i+qt.EDGE_KEY_DELIM+o+qt.EDGE_KEY_DELIM+(void 0===r?qt.DEFAULT_EDGE_NAME:r)}function $t(t,e,n,r){var i=String(e),o=String(n),a={v:e,w:n};if(!t&&i>o){var u=a.v;a.v=a.w,a.w=u}return void 0!==r&&(a.name=r),a}function Jt(t,e){return Zt(t,e.v,e.w,e.name)}function Qt(t){return"function"==typeof t}!function(t){t.DEFAULT_EDGE_NAME="\0",t.GRAPH_NODE="\0",t.EDGE_KEY_DELIM=""}(qt||(qt={}));var te=function(t){return t.nodes().map((function(e){var n={id:e,value:t.node(e),parent:t.parent(e)};return void 0===n.value&&delete n.value,void 0===n.parent&&delete n.parent,n}))},ee=function(t){return t.edges().map((function(e){var n=t.edge(e),r={v:e.v,w:e.w,value:n,name:e.name};return void 0===r.name&&delete r.name,void 0===r.value&&delete r.value,r}))},ne=function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:te(t),edges:ee(t),value:t.graph()};return void 0===e.value&&delete e.value,e};function re(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ie(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?re(Object(n),!0).forEach((function(e){oe(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function oe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ue(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,r.key,r)}}var se={compound:!1,multigraph:!1,directed:!0},ce=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ae(this,t),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=qt.GRAPH_NODE,this.label=void 0,this.nodeCountNum=0,this.edgeCountNum=0,this.defaultNodeLabelFn=function(){},this.defaultEdgeLabelFn=function(){},this.parentMap=void 0,this.childrenMap=void 0,this.nodesLabelMap=new Map,this.inEdgesMap=new Map,this.outEdgesMap=new Map,this.predecessorsMap=new Map,this.successorsMap=new Map,this.edgesMap=new Map,this.edgesLabelsMap=new Map,this.isDirected=function(){return e.directed},this.isMultigraph=function(){return e.multigraph},this.isCompound=function(){return e.compound},this.setGraph=function(t){return e.label=t,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(t){return Qt(t)?e.defaultNodeLabelFn=t:e.defaultNodeLabelFn=function(){return t},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(t){return e.nodesLabelMap.get(t)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter((function(t){var n;return!(null===(n=e.inEdgesMap.get(t))||void 0===n?void 0:n.size)}))},this.sinks=function(){return e.nodes().filter((function(t){var n;return!(null===(n=e.outEdgesMap.get(t))||void 0===n?void 0:n.size)}))},this.setNodes=function(t,n){return t.map((function(t){return e.setNode(t,n)})),e},this.hasNode=function(t){return e.nodesLabelMap.has(t)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(t){if(e.isCompound()){var n,r=null===(n=e.parentMap)||void 0===n?void 0:n.get(t);if(r!==e.GRAPH_NODE)return r}},this.removeFromParentsChildList=function(t){var n=e.parentMap.get(t);e.childrenMap.get(n).delete(t)},this.setParent=function(t,n){var r,i;e.checkCompound();for(var o=void 0===n?e.GRAPH_NODE:n,a=e.parent(o);a;){if(t===a)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");a=e.parent(a)}n&&e.setNode(n),e.setNode(t),e.removeFromParentsChildList(t),null===(r=e.parentMap)||void 0===r||r.set(t,o);var u=e.childrenMap.get(o);return u.set(t,!0),null===(i=e.childrenMap)||void 0===i||i.set(o,u),e},this.children=function(t){var n=void 0===t?e.GRAPH_NODE:t;if(e.isCompound()){var r,i=null===(r=e.childrenMap)||void 0===r?void 0:r.get(n);return i?Array.from(i.keys()):void 0}return n===e.GRAPH_NODE?e.nodes():t&&e.hasNode(t)?[]:void 0},this.predecessors=function(t){var n=e.predecessorsMap.get(t);return n?Array.from(n.keys()):void 0},this.successors=function(t){var n=e.successorsMap.get(t);return n?Array.from(n.keys()):void 0},this.neighbors=function(t){var n;if(e.hasNode(t))return Array.from(new Set(null===(n=e.predecessors(t))||void 0===n?void 0:n.concat(e.successors(t))))},this.isLeaf=function(t){var n,r;return e.isDirected()?!(null===(r=e.successors(t))||void 0===r?void 0:r.length):!(null===(n=e.neighbors(t))||void 0===n?void 0:n.length)},this.filterNodes=function(n){var r=e.directed,i=e.multigraph,o=e.compound,a=new t({directed:r,multigraph:i,compound:o});return a.setGraph(e.graph()),e.nodes().forEach((function(t){n(t)&&a.setNode(t,e.node(t))})),e.edges().forEach((function(t){a.hasNode(t.v)&&a.hasNode(t.w)&&a.setEdgeObj(t,e.edge(t))})),o&&a.nodes().forEach((function(t){a.setParent(t,function(t){for(var n=e.parent(t);void 0!==n&&!a.hasNode(n);)n=e.parent(n);return n}(t))})),a},this.setDefaultEdgeLabel=function(t){return Qt(t)?e.defaultEdgeLabelFn=t:e.defaultEdgeLabelFn=function(){return t},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(t,n){return e.setEdge(t.v,t.w,n,t.name)},this.setPath=function(t,n){return t.reduce((function(t,r){return e.setEdge(t,r,n),r})),e},this.edgeFromArgs=function(t,n,r){return e.edge({v:t,w:n,name:r})},this.edge=function(t){return e.edgesLabelsMap.get(Jt(e.isDirected(),t))},this.hasEdge=function(t,n,r){return e.edgesLabelsMap.has(Jt(e.isDirected(),{v:t,w:n,name:r}))},this.removeEdgeObj=function(t){var n=t.v,r=t.w,i=t.name;return e.removeEdge(n,r,i)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(t,n){var r=e.inEdgesMap.get(t);if(r)return Array.from(r.values()).filter((function(t){return!n||t.v===n}))},this.outEdges=function(t,n){var r=e.outEdgesMap.get(t);if(r)return Array.from(r.values()).filter((function(t){return!n||t.w===n}))},this.nodeEdges=function(t,n){var r;if(e.hasNode(t))return null===(r=e.inEdges(t,n))||void 0===r?void 0:r.concat(e.outEdges(t,n))},this.toJSON=function(){return ne(e)},this.nodeInDegree=function(t){var n=e.inEdgesMap.get(t);return n?n.size:0},this.nodeOutDegree=function(t){var n=e.outEdgesMap.get(t);return n?n.size:0},this.nodeDegree=function(t){return e.nodeInDegree(t)+e.nodeOutDegree(t)},this.source=function(t){return t.v},this.target=function(t){return t.w};var r=ie(ie({},se),n);this.compound=r.compound,this.directed=r.directed,this.multigraph=r.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}var e,n;return e=t,n=[{key:"setNode",value:function(t,e){var n,r=this.nodesLabelMap,i=this.defaultNodeLabelFn,o=this.isCompound,a=this.parentMap,u=this.childrenMap,s=this.inEdgesMap,c=this.outEdgesMap,f=this.predecessorsMap,l=this.successorsMap;return r.has(t)?(void 0!==e&&r.set(t,e),this):(r.set(t,e||i(t)),o()&&(null==a||a.set(t,this.GRAPH_NODE),null==u||u.set(t,new Map),(null==u?void 0:u.has(this.GRAPH_NODE))||null==u||u.set(this.GRAPH_NODE,new Map),null==u||null===(n=u.get(this.GRAPH_NODE))||void 0===n||n.set(t,!0)),[s,c,f,l].forEach((function(e){return e.set(t,new Map)})),this.nodeCountNum+=1,this)}},{key:"removeNode",value:function(t){var e=this;if(this.hasNode(t)){var n,r,i,o=function(t){e.removeEdge(t.v,t.w,t.name)},a=this.inEdgesMap,u=this.outEdgesMap,s=this.predecessorsMap,c=this.successorsMap,f=this.nodesLabelMap;this.isCompound()&&(this.removeFromParentsChildList(t),null===(n=this.parentMap)||void 0===n||n.delete(t),null===(r=this.children(t))||void 0===r||r.forEach((function(t){return e.setParent(t)})),null===(i=this.childrenMap)||void 0===i||i.delete(t));var l=a.get(t),d=u.get(t);Array.from(l.values()).forEach((function(t){return o(t)})),Array.from(d.values()).forEach((function(t){return o(t)})),f.delete(t),a.delete(t),u.delete(t),s.delete(t),c.delete(t),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(t,e,n,r){var i,o,a=$t(this.isDirected(),t,e,r),u=Jt(this.isDirected(),a),s=a.v,c=a.w;if(this.edgesLabelsMap.has(u))return this.edgesLabelsMap.set(u,n),this;if(void 0!==r&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(c),this.edgesLabelsMap.set(u,n||this.defaultEdgeLabelFn(s,c,r)),Object.freeze(a),this.edgesMap.set(u,a);var f=this.predecessorsMap.get(c),l=this.successorsMap.get(s);return Yt(f,s),Yt(l,c),null===(i=this.inEdgesMap.get(c))||void 0===i||i.set(u,a),null===(o=this.outEdgesMap.get(s))||void 0===o||o.set(u,a),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(t,e,n){var r=Zt(this.isDirected(),t,e,n);if(this.edgesMap.get(r)){var i=$t(this.isDirected(),t,e,n),o=i.v,a=i.w;this.edgesLabelsMap.delete(r),this.edgesMap.delete(r);var u=this.predecessorsMap.get(a),s=this.successorsMap.get(o);Kt(u,o),Kt(s,a),this.inEdgesMap.get(a).delete(r),this.outEdgesMap.get(o).delete(r),this.edgeCountNum-=1}return this}}],n&&ue(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();ce.fromJSON=function(t){var e=new ce(t.options);return void 0!==t.value&&e.setGraph(t.value),t.nodes.forEach((function(t){e.setNode(t.id,t.value),t.parent&&e.setParent(t.id,t.parent)})),t.edges.forEach((function(t){e.setEdge(t.v,t.w,t.value,t.name)})),e},Error;var fe=function t(e,n,r,i,o,a){i.includes(n)||(i.push(n),r||a.push(n),o(n).forEach((function(n){return t(e,n,r,i,o,a)})),r&&a.push(n))};const le=function(t,e,n){var r=Array.isArray(e)?e:[e],i=function(e){return t.isDirected()?t.successors(e):t.neighbors(e)},o=[],a=[];return r.forEach((function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);fe(t,e,"post"===n,a,i,o)})),o};var de=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),he=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return de(e,t),e}(Xt),pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return de(e,t),e}(ce),ve=function(){return 1},ge=function(t,e,n,r,i){var o,a,u=[];return null===(o=t.inEdges(r.v))||void 0===o||o.forEach((function(r){var o=t.edge(r),a=t.node(r.v);i&&u.push({v:r.v,w:r.w,in:0,out:0}),void 0===a.out&&(a.out=0),a.out-=o,ye(e,n,a)})),null===(a=t.outEdges(r.v))||void 0===a||a.forEach((function(r){var i=t.edge(r),o=r.w,a=t.node(o);void 0===a.in&&(a.in=0),a.in-=i,ye(e,n,a)})),t.removeNode(r.v),i?u:void 0},ye=function(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)};const me=function(t,e){var n;if(t.nodeCount()<=1)return[];var r=function(t,e){var n=new pe,r=0,i=0;t.nodes().forEach((function(t){n.setNode(t,{v:t,in:0,out:0})})),t.edges().forEach((function(t){var o=n.edge(t)||0,a=(null==e?void 0:e(t))||1,u=o+a;n.setEdge(t.v,t.w,u),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));for(var o=[],a=i+r+3,u=0;u<a;u++)o.push(new he);var s=r+1;return n.nodes().forEach((function(t){ye(o,s,n.node(t))})),{buckets:o,zeroIdx:s,graph:n}}(t,e||ve);return null===(n=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.nodeCount();){for(;r=a.dequeue();)ge(t,e,n,r);for(;r=o.dequeue();)ge(t,e,n,r);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(r=e[u].dequeue()){i=i.concat(ge(t,e,n,r,!0));break}}return i}(r.graph,r.buckets,r.zeroIdx).map((function(e){return t.outEdges(e.v,e.w)})))||void 0===n?void 0:n.flat()};var be=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return be(e,t),e}(ce),xe=function(t,e,n,r){var i;do{i="".concat(r).concat(Math.random())}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i},we=function(t){var e=new _e({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach((function(n){var r;(null===(r=t.children(n))||void 0===r?void 0:r.length)||e.setNode(n,t.node(n))})),t.edges().forEach((function(n){e.setEdgeObj(n,t.edge(n))})),e},Ee=function(t,e){var n,r,i=Number(t.x),o=Number(t.y),a=Number(e.x)-i,u=Number(e.y)-o,s=Number(t.width)/2,c=Number(t.height)/2;return a||u?(Math.abs(u)*s>Math.abs(a)*c?(u<0&&(c=-c),n=c*a/u,r=c):(a<0&&(s=-s),n=s,r=s*u/a),{x:i+n,y:o+r}):{x:0,y:0}},Se=function(t){for(var e=[],n=Te(t)+1,r=0;r<n;r++)e.push([]);for(t.nodes().forEach((function(n){var r=t.node(n).rank;void 0!==r&&e[r]&&e[r].push(n)})),r=0;r<n;r++)e[r]=e[r].sort((function(e,n){var r,i,o,a;return o=null===(r=t.node(e))||void 0===r?void 0:r.order,a=null===(i=t.node(n))||void 0===i?void 0:i.order,Number(o)-Number(a)}));return e},Ae=function(t,e,n,r){var i={width:0,height:0};return o(n)&&o(r)&&(i.rank=n,i.order=r),xe(t,"border",i,e)},Te=function(t){var e;return t.nodes().forEach((function(n){var r,i=null===(r=t.node(n))||void 0===r?void 0:r.rank;void 0!==i&&(void 0===e||i>e)&&(e=i)})),e||(e=0),e},Ie=function(t,e){var n=Date.now();try{return e()}finally{console.log("".concat(t," time: ").concat(Date.now()-n,"ms"))}},Ne=function(t,e){return e()},Oe=function(t,e){return t.reduce((function(t,n){return e(t)>e(n)?n:t}))};const Ce=function(t){t.graph().dummyChains=[],t.edges().forEach((function(e){return function(t,e){var n=e.v,r=t.node(n).rank,i=e.w,o=t.node(i).rank,a=e.name,u=t.edge(e),s=u.labelRank;if(o!==r+1){t.removeEdgeObj(e);var c,f,l,d=t.graph();for(l=0,++r;r<o;++l,++r)u.points=[],c=xe(t,"edge",f={edgeLabel:u,width:0,height:0,edgeObj:e,rank:r},"_d"),r===s&&(f.width=u.width,f.height=u.height,f.dummy="edge-label",f.labelpos=u.labelpos),t.setEdge(n,c,{weight:u.weight},a),0===l&&(d.dummyChains||(d.dummyChains=[]),d.dummyChains.push(c)),n=c;t.setEdge(n,i,{weight:u.weight},a)}}(t,e)}))};var ke=function(t){var e,n={},r=function e(r){var i,o,a=t.node(r);return n[r]?a.rank:(n[r]=!0,null===(i=t.outEdges(r))||void 0===i||i.forEach((function(n){var r=e(n.w)-t.edge(n).minlen;r&&(void 0===o||r<o)&&(o=r)})),o||(o=0),a.rank=o,o)};null===(e=t.sources())||void 0===e||e.forEach((function(t){return r(t)}))},De=function(t){var e,n,r={},i=function e(i){var o,a,u=t.node(i);return r[i]?u.rank:(r[i]=!0,null===(o=t.outEdges(i))||void 0===o||o.forEach((function(n){var r=e(n.w)-t.edge(n).minlen;r&&(void 0===a||r<a)&&(a=r)})),a||(a=0),(void 0===n||a<n)&&(n=a),u.rank=a,a)};null===(e=t.sources())||void 0===e||e.forEach((function(t){return i(t)})),void 0===n&&(n=0);var o={},a=function e(n,r){var i,a=t.node(n),u=isNaN(a.layer)?r:a.layer;(void 0===a.rank||a.rank<u)&&(a.rank=u),o[n]||(o[n]=!0,null===(i=t.outEdges(n))||void 0===i||i.map((function(n){e(n.w,u+t.edge(n).minlen)})))};t.nodes().forEach((function(e){var r=t.node(e);isNaN(r.layer)?r.rank-=n:a(e,r.layer)}))},Me=function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen},Re=function(t,e){return t.nodes().forEach((function n(r){e.nodeEdges(r).forEach((function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||Me(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()},Pe=function(t,e){return t.nodes().forEach((function n(r){var i;null===(i=e.nodeEdges(r))||void 0===i||i.forEach((function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||void 0===e.node(a).layer&&Me(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()},Ge=function(t,e){return Oe(e.edges(),(function(n){return t.hasNode(n.v)!==t.hasNode(n.w)?Me(e,n):1/0}))},Le=function(t,e,n){t.nodes().forEach((function(t){e.node(t).rank||(e.node(t).rank=0),e.node(t).rank+=n}))},je=function(t,e){return le(t,e,"pre")},Fe=function(t,e){return le(t,e,"post")},Ue=function(t,e){var n=Fe(t,t.nodes());null==(n=null==n?void 0:n.slice(0,(null==n?void 0:n.length)-1))||n.forEach((function(n){Be(t,e,n)}))},Be=function(t,e,n){var r=t.node(n).parent;t.edgeFromArgs(n,r).cutvalue=ze(t,e,n)},ze=function(t,e,n){var r,i=t.node(n).parent,o=!0,a=e.edgeFromArgs(n,i),u=0;return a||(o=!1,a=e.edgeFromArgs(i,n)),u=a.weight,null===(r=e.nodeEdges(n))||void 0===r||r.forEach((function(r){var a=r.v===n,s=a?r.w:r.v;if(s!==i){var c=a===o,f=e.edge(r).weight;if(u+=c?f:-f,Ke(t,n,s)){var l=t.edgeFromArgs(n,s).cutvalue;u+=c?-l:l}}})),u},Ve=function(t,e){void 0===e&&(e=t.nodes()[0]),We(t,{},1,e)},We=function t(e,n,r,i,o){var a,u=r,s=r,c=e.node(i);return n[i]=!0,null===(a=e.neighbors(i))||void 0===a||a.forEach((function(r){n[r]||(s=t(e,n,s,r,i))})),c.low=u,c.lim=s++,o?c.parent=o:delete c.parent,s},He=function(t){return t.edges().find((function(e){return t.edge(e).cutvalue<0}))},Xe=function(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),u=o,s=!1;o.lim>a.lim&&(u=a,s=!0);var c=e.edges().filter((function(e){return s===Ze(t,t.node(e.v),u)&&s!==Ze(t,t.node(e.w),u)}));return Oe(c,(function(t){return Me(e,t)}))},qe=function(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),Ve(t),Ue(t,e),Ye(t,e)},Ye=function(t,e){var n=t.nodes().find((function(t){var n;return!(null===(n=e.node(t))||void 0===n?void 0:n.parent)})),r=je(t,n);null==(r=null==r?void 0:r.slice(1))||r.forEach((function(n){var r=t.node(n).parent,i=e.edgeFromArgs(n,r),o=!1;i||(i=e.edgeFromArgs(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))},Ke=function(t,e,n){return t.hasEdge(e,n)},Ze=function(t,e,n){return n.low<=e.lim&&e.lim<=n.lim};const $e=function(t){var e=function(t){var e=(new _e).setGraph(t.graph());return t.nodes().forEach((function(n){e.setNode(n,t.node(n))})),t.edges().forEach((function(n){var r=e.edgeFromArgs(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e}(t);ke(e);var n,r,i=function(t){var e,n,r=new _e({directed:!1}),i=t.nodes()[0],o=t.nodeCount();for(r.setNode(i,{});Re(r,t)<o;)e=Ge(r,t),n=r.hasNode(e.v)?Me(t,e):-Me(t,e),Le(r,t,n);return r}(e);for(Ve(i),Ue(i,e);n=He(i);)r=Xe(i,e,n),qe(i,e,n,r)};var Je=ke,Qe=function(t){De(t),function(t){var e,n,r=new _e({directed:!1}),i=t.nodes()[0],o=t.nodeCount();for(r.setNode(i,{});Pe(r,t)<o;)e=Ge(r,t),n=r.hasNode(e.v)?Me(t,e):-Me(t,e),Le(r,t,n)}(t)};const tn=function(t){switch(t.graph().ranker){case"network-simplex":!function(t){$e(t)}(t);break;case"tight-tree":default:Qe(t);break;case"longest-path":Je(t)}};var en=function t(e,n,r,i,o,a,u){var s=e.children(u);if(null==s?void 0:s.length){var c=Ae(e,"_bt"),f=Ae(e,"_bb"),l=e.node(u);e.setParent(c,u),l.borderTop=c,e.setParent(f,u),l.borderBottom=f,null==s||s.forEach((function(s){t(e,n,r,i,o,a,s);var l=e.node(s),d=l.borderTop?l.borderTop:s,h=l.borderBottom?l.borderBottom:s,p=l.borderTop?i:2*i,v=d!==h?1:o-a[u]+1;e.setEdge(c,d,{minlen:v,weight:p,nestingEdge:!0}),e.setEdge(h,f,{minlen:v,weight:p,nestingEdge:!0})})),e.parent(u)||e.setEdge(n,c,{weight:0,minlen:o+a[u]})}else u!==n&&e.setEdge(n,u,{weight:0,minlen:r})},nn=function(t){var e,n={},r=function e(r,i){var o=t.children(r);null==o||o.forEach((function(t){return e(t,i+1)})),n[r]=i};return null===(e=t.children())||void 0===e||e.forEach((function(t){return r(t,1)})),n};const rn=function(t){var e,n=xe(t,"root",{},"_root"),r=nn(t),i=Math.max.apply(Math,Object.values(r));Math.abs(i)===1/0&&(i=1);var o=i-1,a=2*o+1;t.graph().nestingRoot=n,t.edges().forEach((function(e){t.edge(e).minlen*=a}));var u=function(t){var e=0;return t.edges().forEach((function(n){e+=t.edge(n).weight})),e}(t)+1;null===(e=t.children())||void 0===e||e.forEach((function(e){en(t,n,a,u,o,r,e)})),t.graph().nodeRankFactor=a};var on=function(t,e,n,r,i,o){var a={rank:o,borderType:e,width:0,height:0},u=i[e][o-1],s=xe(t,"border",a,n);i[e][o]=s,t.setParent(s,r),u&&t.setEdge(u,s,{weight:1})};const an=function(t){var e,n=function e(n){var r=t.children(n),i=t.node(n);if((null==r?void 0:r.length)&&r.forEach((function(t){return e(t)})),i.hasOwnProperty("minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;o+=1)on(t,"borderLeft","_bl",n,i,o),on(t,"borderRight","_br",n,i,o)}};null===(e=t.children())||void 0===e||e.forEach((function(t){return n(t)}))};var un=function(t){t.nodes().forEach((function(e){sn(t.node(e))})),t.edges().forEach((function(e){sn(t.edge(e))}))},sn=function(t){var e=t.width;t.width=t.height,t.height=e},cn=function(t){(null==t?void 0:t.y)&&(t.y=-t.y)},fn=function(t){var e=t.x;t.x=t.y,t.y=e};const ln=function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"bt"!==n&&"rl"!==n||function(t){t.nodes().forEach((function(e){cn(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return cn(t)})),r.hasOwnProperty("y")&&cn(r)}))}(t),"lr"!==n&&"rl"!==n||(function(t){t.nodes().forEach((function(e){fn(t.node(e))})),t.edges().forEach((function(e){var n,r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach((function(t){return fn(t)})),r.hasOwnProperty("x")&&fn(r)}))}(t),un(t))},dn=function(t){for(var e={},n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})),r=n.map((function(e){return t.node(e).rank})),i=Math.max.apply(Math,r),o=[],a=0;a<i+1;a++)o.push([]);var u=n.sort((function(e,n){return t.node(e).rank-t.node(n).rank})),s=u.filter((function(e){return void 0!==t.node(e).fixorder})),c=s.sort((function(e,n){return t.node(e).fixorder-t.node(n).fixorder}));return null==c||c.forEach((function(n){isNaN(t.node(n).rank)||o[t.node(n).rank].push(n),e[n]=!0})),null==u||u.forEach((function n(r){var i;if(!e.hasOwnProperty(r)){e[r]=!0;var a=t.node(r);isNaN(a.rank)||o[a.rank].push(r),null===(i=t.successors(r))||void 0===i||i.forEach((function(t){return n(t)}))}})),o};var hn=function(t,e,n){for(var r=function(t,e){return null==t?void 0:t.reduce((function(t,n,r){return t[n]=e[r],t}),{})}(n,n.map((function(t,e){return e}))),i=e.map((function(e){var n,i=null===(n=t.outEdges(e))||void 0===n?void 0:n.map((function(e){return{pos:r[e.w]||0,weight:t.edge(e).weight}}));return null==i?void 0:i.sort((function(t,e){return t.pos-e.pos}))})),o=i.flat().filter((function(t){return void 0!==t})),a=1;a<n.length;)a<<=1;var u=2*a-1;a-=1;var s=Array(u).fill(0,0,u),c=0;return null==o||o.forEach((function(t){if(t){var e=t.pos+a;s[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=s[e+1]),s[e=e-1>>1]+=t.weight;c+=t.weight*n}})),c};const pn=function(t,e){for(var n=0,r=1;r<(null==e?void 0:e.length);r+=1)n+=hn(t,e[r-1],e[r]);return n};const vn=function(t,e,n){var r=function(t){for(var e;t.hasNode(e="_root".concat(Math.random())););return e}(t),i=new _e({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return t.nodes().forEach((function(o){var a,u=t.node(o),s=t.parent(o);(u.rank===e||u.minRank<=e&&e<=u.maxRank)&&(i.setNode(o),i.setParent(o,s||r),null===(a=t[n](o))||void 0===a||a.forEach((function(e){var n=e.v===o?e.w:e.v,r=i.edgeFromArgs(n,o),a=void 0!==r?r.weight:0;i.setEdge(n,o,{weight:t.edge(e).weight+a})})),u.hasOwnProperty("minRank")&&i.setNode(o,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]}))})),i};var gn=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?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0};const yn=function(t,e){var n,r,i,o={};return null==t||t.forEach((function(t,e){o[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};var n=o[t.v];void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)})),null===(n=e.edges())||void 0===n||n.forEach((function(t){var e=o[t.v],n=o[t.w];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(o[t.w]))})),function(t){for(var e,n,r=[],i=function(){var i=t.pop();r.push(i),null===(e=i.in.reverse())||void 0===e||e.forEach((function(t){return(e=i,function(t){t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&gn(e,t)})(t);var e})),null===(n=i.out)||void 0===n||n.forEach((function(e){return(n=i,function(e){e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n}))};null==t?void 0:t.length;)i();var o=r.filter((function(t){return!t.merged})),a=["vs","i","barycenter","weight"];return o.map((function(t){var e={};return null==a||a.forEach((function(n){void 0!==t[n]&&(e[n]=t[n])})),e}))}(null===(i=(r=Object.values(o)).filter)||void 0===i?void 0:i.call(r,(function(t){return!t.indegree})))};var mn=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};const bn=function(t,e,n){var r=function(t,e){var n={lhs:[],rhs:[]};return null==t||t.forEach((function(t){var e;(e=t).hasOwnProperty("fixorder")&&!isNaN(e.fixorder)||e.hasOwnProperty("barycenter")?n.lhs.push(t):n.rhs.push(t)})),n}(t),i=r.lhs,o=r.rhs.sort((function(t,e){return-t.i- -e.i})),a=[],u=0,s=0,c=0;null==i||i.sort(function(t,e){return function(n,r){if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i}}(!!e,!!n)),c=mn(a,o,c),null==i||i.forEach((function(t){var e;c+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,s+=t.weight,c=mn(a,o,c)}));var f={vs:a.flat()};return s&&(f.barycenter=u/s,f.weight=s),f};const _n=function t(e,n,r,i,o){var a,u,s,c,f=e.children(n),l=e.node(n),d=l?l.borderLeft:void 0,h=l?l.borderRight:void 0,p={};d&&(f=null==f?void 0:f.filter((function(t){return t!==d&&t!==h})));var v=function(t,e){return e.map((function(e){var n=t.inEdges(e);if(!(null==n?void 0:n.length))return{v:e};var r={sum:0,weight:0};return null==n||n.forEach((function(e){var n=t.edge(e),i=t.node(e.v);r.sum+=n.weight*i.order,r.weight+=n.weight})),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}))}(e,f||[]);null==v||v.forEach((function(n){var o,a,u;if(null===(o=e.children(n.v))||void 0===o?void 0:o.length){var s=t(e,n.v,r,i);p[n.v]=s,s.hasOwnProperty("barycenter")&&(u=s,void 0!==(a=n).barycenter?(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight):(a.barycenter=u.barycenter,a.weight=u.weight))}}));var g=yn(v,r);(function(t,e){null==t||t.forEach((function(t){var n,r=null===(n=t.vs)||void 0===n?void 0:n.map((function(t){return e[t]?e[t].vs:t}));t.vs=r.flat()}))})(g,p),null===(a=g.filter((function(t){return t.vs.length>0})))||void 0===a||a.forEach((function(t){var n=e.node(t.vs[0]);n&&(t.fixorder=n.fixorder,t.order=n.order)}));var y=bn(g,i,o);if(d&&(y.vs=[d,y.vs,h].flat(),null===(u=e.predecessors(d))||void 0===u?void 0:u.length)){var m=e.node((null===(s=e.predecessors(d))||void 0===s?void 0:s[0])||""),b=e.node((null===(c=e.predecessors(h))||void 0===c?void 0:c[0])||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y};var xn=function(t,e,n){return e.map((function(e){return vn(t,e,n)}))},wn=function(t,e,n){var r=new _e;null==t||t.forEach((function(t){for(var i,o=t.graph().root,a=_n(t,o,r,e,n),u=0;u<(null===(i=a.vs)||void 0===i?void 0:i.length);u++){var s=t.node(a.vs[u]);s&&(s.order=u)}!function(t,e,n){var r,i={};null==n||n.forEach((function(n){for(var o,a,u=t.parent(n);u;){if((o=t.parent(u))?(a=i[o],i[o]=u):(a=r,r=u),a&&a!==u)return void e.setEdge(a,u);u=o}}))}(t,r,a.vs)}))},En=function(t,e){null==e||e.forEach((function(e){null==e||e.forEach((function(e,n){t.node(e).order=n}))}))};var Sn=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),An=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Sn(e,t),e}(ce),Tn=function(t,e){var n,r;if(null===(n=t.node(e))||void 0===n?void 0:n.dummy)return null===(r=t.predecessors(e))||void 0===r?void 0:r.find((function(e){return t.node(e).dummy}))},In=function(t,e,n){var r=e,i=n;if(r>i){var o=r;r=i,i=o}var a=t[r];a||(t[r]=a={}),a[i]=!0},Nn=function(t,e,n){var r=e;return r>n&&(r=n),!!t[r]},On=function(t,e,n,r){var i=new An,o=t.graph(),a=Cn(o.nodesep,o.edgesep,r);return null==e||e.forEach((function(e){var r;null==e||e.forEach((function(e){var o=n[e];if(i.setNode(o),r){var u=n[r],s=i.edgeFromArgs(u,o);i.setEdge(u,o,Math.max(a(t,e,r),s||0))}r=e}))})),i};var Cn=function(t,e,n){return function(r,i,o){var a,u=r.node(i),s=r.node(o),c=0;if(c+=u.width/2,u.hasOwnProperty("labelpos"))switch((u.labelpos||"").toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(c+=n?a:-a),a=0,c+=(u.dummy?e:t)/2,c+=(s.dummy?e:t)/2,c+=s.width/2,s.labelpos)switch((s.labelpos||"").toLowerCase()){case"l":a=s.width/2;break;case"r":a=-s.width/2}return a&&(c+=n?a:-a),a=0,c}},kn=function(t,e){return t.node(e).width||0},Dn=function(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)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};const Mn=function(t){var e,n=we(t);!function(t){var e=Se(t),n=t.graph().ranksep,r=0;null==e||e.forEach((function(e){var i=e.map((function(e){return t.node(e).height})),o=Math.max.apply(Math,Dn(Dn([],i,!1),[0],!1));null==e||e.forEach((function(e){t.node(e).y=r+o/2})),r+=o+n}))}(n);var r=function(t){var e=Se(t),n=Object.assign(function(t,e){var n={};return(null==e?void 0:e.length)&&e.reduce((function(e,r){var i=0,o=0,a=e.length,u=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach((function(e,s){var c,f=Tn(t,e),l=f?t.node(f).order:a;(f||e===u)&&(null===(c=r.slice(o,s+1))||void 0===c||c.forEach((function(e){var r;null===(r=t.predecessors(e))||void 0===r||r.forEach((function(r){var o,a=t.node(r),u=a.order;!(u<i||l<u)||a.dummy&&(null===(o=t.node(e))||void 0===o?void 0:o.dummy)||In(n,r,e)}))})),o=s+1,i=l)})),r})),n}(t,e),function(t,e){var n={},r=function(e,r,i,o,a){for(var u,s=[],c=r;c<i;c++)s.push(c);s.forEach((function(r){var i,s;u=e[r],(null===(i=t.node(u))||void 0===i?void 0:i.dummy)&&(null===(s=t.predecessors(u))||void 0===s||s.forEach((function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&In(n,e,u)})))}))};return(null==e?void 0:e.length)&&e.reduce((function(e,n){var i,o=-1,a=0;return null==n||n.forEach((function(u,s){var c;if("border"===(null===(c=t.node(u))||void 0===c?void 0:c.dummy)){var f=t.predecessors(u)||[];f.length&&(i=t.node(f[0]).order,r(n,a,s,o,i),a=s,o=i)}r(n,a,n.length,i,e.length)})),n})),n}(t,e)),r={},i=[];["u","d"].forEach((function(o){i="u"===o?e:Object.values(e).reverse(),["l","r"].forEach((function(e){"r"===e&&(i=i.map((function(t){return Object.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),u=function(t,e,n,r){var i={},o={},a={};return null==e||e.forEach((function(t){null==t||t.forEach((function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),null==e||e.forEach((function(t){var e=-1;null==t||t.forEach((function(t){var u=r(t);if(u.length)for(var s=((u=u.sort((function(t,e){return a[t]-a[e]}))).length-1)/2,c=Math.floor(s),f=Math.ceil(s);c<=f;++c){var l=u[c];o[t]===t&&e<a[l]&&!Nn(n,t,l)&&(o[l]=t,o[t]=i[t]=i[l],e=a[l])}}))})),{root:i,align:o}}(0,i,n,a),s=function(t,e,n,r,i){var o,a={},u=On(t,e,n,i),s=i?"borderLeft":"borderRight",c=function(t,e){for(var n=u.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()};return c((function(t){a[t]=(u.inEdges(t)||[]).reduce((function(t,e){return Math.max(t,(a[e.v]||0)+u.edge(e))}),0)}),u.predecessors.bind(u)),c((function(e){var n=(u.outEdges(e)||[]).reduce((function(t,e){return Math.min(t,(a[e.w]||0)-u.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(a[e]=Math.max(a[e],n))}),u.successors.bind(u)),null===(o=Object.values(r))||void 0===o||o.forEach((function(t){a[t]=a[n[t]]})),a}(t,i,u.root,u.align,"r"===e);"r"===e&&Object.keys(s).forEach((function(t){return s[t]=-s[t]})),r[o+e]=s}))}));var o=function(t,e){return Oe(Object.values(e),(function(e){var n,r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach((function(n){var o=e[n],a=kn(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)})),r-i}))}(t,r);return o&&function(t,e){var n=Object.values(e),r=Math.min.apply(Math,n),i=Math.max.apply(Math,n);["u","d"].forEach((function(n){["l","r"].forEach((function(o){var a,u=n+o,s=t[u];if(s!==e){var c=Object.values(s);(a="l"===o?r-Math.min.apply(Math,c):i-Math.max.apply(Math,c))&&(t[u]={},Object.keys(s).forEach((function(e){t[u][e]=s[e]+a})))}}))}))}(r,o),function(t,e){var n={};return Object.keys(t.ul).forEach((function(r){if(e)n[r]=t[e.toLowerCase()][r];else{var i=Object.values(t).map((function(t){return t[r]}));n[r]=(i[0]+i[1])/2}})),n}(r,t.graph().align)}(n);null===(e=Object.keys(r))||void 0===e||e.forEach((function(t){n.node(t).x=r[t]}))};var Rn=function(){return Rn=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},Rn.apply(this,arguments)},Pn=function(t,e,n){e(" removeSelfEdges",(function(){Jn(t)})),e(" acyclic",(function(){!function(t){var e="greedy"===t.graph().acyclicer?me(t,function(t){return function(e){var n;return(null===(n=t.edge(e))||void 0===n?void 0:n.weight)||1}}(t)):function(t){var e=[],n={},r={};return t.nodes().forEach((function i(o){var a;r[o]||(r[o]=!0,n[o]=!0,null===(a=t.outEdges(o))||void 0===a||a.forEach((function(t){n[t.w]?e.push(t):i(t.w)})),delete n[o])})),e}(t);null==e||e.forEach((function(e){var n=t.edge(e);t.removeEdgeObj(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,"rev-".concat(Math.random()))}))}(t)})),e(" nestingGraph.run",(function(){rn(t)})),e(" rank",(function(){tn(we(t))})),e(" injectEdgeLabelProxies",(function(){Wn(t)})),e(" removeEmptyRanks",(function(){!function(t){var e=t.nodes(),n=e.filter((function(e){var n;return void 0!==(null===(n=t.node(e))||void 0===n?void 0:n.rank)})).map((function(e){return t.node(e).rank})),r=Math.min.apply(Math,n),i=[];e.forEach((function(e){var n,o=((null===(n=t.node(e))||void 0===n?void 0:n.rank)||0)-r;i[o]||(i[o]=[]),i[o].push(e)}));for(var o=0,a=t.graph().nodeRankFactor||0,u=0;u<i.length;u++){var s=i[u];void 0===s?u%a!=0&&(o-=1):o&&(null==s||s.forEach((function(e){var n=t.node(e);n&&(n.rank=n.rank||0,n.rank+=o)})))}}(t)})),e(" nestingGraph.cleanup",(function(){!function(t){var e=t.graph();e.nestingRoot&&t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach((function(e){t.edge(e).nestingEdge&&t.removeEdgeObj(e)}))}(t)})),e(" normalizeRanks",(function(){!function(t){var e=t.nodes().filter((function(e){var n;return void 0!==(null===(n=t.node(e))||void 0===n?void 0:n.rank)})).map((function(e){return t.node(e).rank})),n=Math.min.apply(Math,e);t.nodes().forEach((function(e){var r=t.node(e);r.hasOwnProperty("rank")&&n!==1/0&&(r.rank-=n)}))}(t)})),e(" assignRankMinMax",(function(){Hn(t)})),e(" removeEdgeLabelProxies",(function(){Xn(t)})),e(" normalize.run",(function(){Ce(t)})),e(" parentDummyChains",(function(){!function(t){var e,n=function(t){var e,n={},r=0;return null===(e=t.children())||void 0===e||e.forEach((function e(i){var o,a=r;null===(o=t.children(i))||void 0===o||o.forEach(e),n[i]={low:a,lim:r++}})),n}(t);null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var r,i,o=e,a=t.node(o),u=a.edgeObj;if(u)for(var s=function(t,e,n,r){var i,o,a=[],u=[],s=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>s||c>e[i].lim));for(o=i,i=r;i&&i!==o;)u.push(i),i=t.parent(i);return{lca:o,path:a.concat(u.reverse())}}(t,n,u.v,u.w),c=s.path,f=s.lca,l=0,d=c[l],h=!0;o!==u.w;){if(a=t.node(o),h){for(;d!==f&&(null===(r=t.node(d))||void 0===r?void 0:r.maxRank)<a.rank;)d=c[++l];d===f&&(h=!1)}if(!h){for(;l<c.length-1&&(null===(i=t.node(c[l+1]))||void 0===i?void 0:i.minRank)<=a.rank;)l++;d=c[l]}t.setParent(o,d),o=t.successors(o)[0]}}))}(t)})),e(" addBorderSegments",(function(){an(t)})),n&&n.keepNodeOrder&&e(" initDataOrder",(function(){!function(t,e){var n=t.nodes().filter((function(e){var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)})),r=n.map((function(e){return t.node(e).rank})),i=Math.max.apply(Math,r),o=Array(i+1).fill([]);null==e||e.forEach((function(e){var n=t.node(e);n&&!(null==n?void 0:n.dummy)&&(isNaN(n.rank)||(n.fixorder=o[n.rank].length,o[n.rank].push(e)))}))}(t,n.nodeOrder)})),e(" order",(function(){!function(t){for(var e=Te(t),n=[],r=[],i=1;i<e+1;i++)n.push(i);for(i=e-1;i>-1;i--)r.push(i);var o=xn(t,n,"inEdges"),a=xn(t,r,"outEdges"),u=dn(t);En(t,u);for(var s,c=Number.POSITIVE_INFINITY,f=(i=0,0);f<4;++i,++f)wn(i%2?o:a,i%4>=2),u=Se(t),(d=pn(t,u))<c&&(f=0,s=l(u),c=d);for(u=dn(t),En(t,u),i=0,f=0;f<4;++i,++f){var d;wn(i%2?o:a,i%4>=2,!0),u=Se(t),(d=pn(t,u))<c&&(f=0,s=l(u),c=d)}En(t,s)}(t)})),e(" insertSelfEdges",(function(){Qn(t)})),e(" adjustCoordinateSystem",(function(){!function(t){var e,n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"lr"!==n&&"rl"!==n||un(t)}(t)})),e(" position",(function(){Mn(t)})),e(" positionSelfEdges",(function(){tr(t)})),e(" removeBorderNodes",(function(){$n(t)})),e(" normalize.undo",(function(){!function(t){var e;null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var n,r=t.node(e),i=r.edgeLabel;r.edgeObj&&t.setEdgeObj(r.edgeObj,i);for(var o=e;r.dummy;)n=t.successors(o)[0],t.removeNode(o),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),o=n,r=t.node(o)}))}(t)})),e(" fixupEdgeLabelCoords",(function(){Kn(t)})),e(" undoCoordinateSystem",(function(){ln(t)})),e(" translateGraph",(function(){qn(t)})),e(" assignNodeIntersects",(function(){Yn(t)})),e(" reversePoints",(function(){Zn(t)})),e(" acyclic.undo",(function(){!function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.reversed){t.removeEdgeObj(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}(t)}))},Gn=["nodesep","edgesep","ranksep","marginx","marginy"],Ln={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},jn=["acyclicer","ranker","rankdir","align"],Fn=["width","height","layer","fixorder"],Un={width:0,height:0},Bn=["minlen","weight","width","height","labeloffset"],zn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Vn=["labelpos"],Wn=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={e,rank:(t.node(e.w).rank-r.rank)/2+r.rank};xe(t,"edge-proxy",i,"_ep")}}))},Hn=function(t){var e=0;t.nodes().forEach((function(n){var r,i,o=t.node(n);o.borderTop&&(o.minRank=null===(r=t.node(o.borderTop))||void 0===r?void 0:r.rank,o.maxRank=null===(i=t.node(o.borderBottom))||void 0===i?void 0:i.rank,e=Math.max(e,o.maxRank||-1/0))})),t.graph().maxRank=e},Xn=function(t){t.nodes().forEach((function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))},qn=function(t){var e,n,r=0,i=0,o=t.graph(),a=o.marginx||0,u=o.marginy||0,s=function(t){if(t){var o=t.x,a=t.y,u=t.width,s=t.height;isNaN(o)||isNaN(u)||(void 0===e&&(e=o-u/2),e=Math.min(e,o-u/2),r=Math.max(r,o+u/2)),isNaN(a)||isNaN(s)||(void 0===n&&(n=a-s/2),n=Math.min(n,a-s/2),i=Math.max(i,a+s/2))}};t.nodes().forEach((function(e){s(t.node(e))})),t.edges().forEach((function(e){var n=t.edge(e);(null==n?void 0:n.hasOwnProperty("x"))&&s(n)})),e-=a,n-=u,t.nodes().forEach((function(r){var i=t.node(r);i&&(i.x-=e,i.y-=n)})),t.edges().forEach((function(r){var i,o=t.edge(r);null===(i=o.points)||void 0===i||i.forEach((function(t){t.x-=e,t.y-=n})),o.hasOwnProperty("x")&&(o.x-=e),o.hasOwnProperty("y")&&(o.y-=n)})),o.width=r-e+a,o.height=i-n+u},Yn=function(t){t.edges().forEach((function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(Ee(o,n)),i.points.push(Ee(a,r))}))},Kn=function(t){t.edges().forEach((function(e){var n=t.edge(e);if(null==n?void 0:n.hasOwnProperty("x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))},Zn=function(t){t.edges().forEach((function(e){var n,r=t.edge(e);r.reversed&&(null===(n=r.points)||void 0===n||n.reverse())}))},$n=function(t){t.nodes().forEach((function(e){var n,r,i;if(null===(n=t.children(e))||void 0===n?void 0:n.length){var o=t.node(e),a=t.node(o.borderTop),u=t.node(o.borderBottom),s=t.node(o.borderLeft[(null===(r=o.borderLeft)||void 0===r?void 0:r.length)-1]),c=t.node(o.borderRight[(null===(i=o.borderRight)||void 0===i?void 0:i.length)-1]);o.width=Math.abs((null==c?void 0:c.x)-(null==s?void 0:s.x))||10,o.height=Math.abs((null==u?void 0:u.y)-(null==a?void 0:a.y))||10,o.x=((null==s?void 0:s.x)||0)+o.width/2,o.y=((null==a?void 0:a.y)||0)+o.height/2}})),t.nodes().forEach((function(e){var n;"border"===(null===(n=t.node(e))||void 0===n?void 0:n.dummy)&&t.removeNode(e)}))},Jn=function(t){t.edges().forEach((function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdgeObj(e)}}))},Qn=function(t){var e=Se(t);null==e||e.forEach((function(e){var n=0;null==e||e.forEach((function(e,r){var i,o=t.node(e);o.order=r+n,null===(i=o.selfEdges)||void 0===i||i.forEach((function(e){xe(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete o.selfEdges}))}))},tr=function(t){t.nodes().forEach((function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,u=r.height/2;t.setEdgeObj(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{y:o,x:i+a},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],n.label.x=n.x,n.label.y=n.y}}))},er=function(t,e){var n={};return null==e||e.forEach((function(e){void 0!==t[e]&&(n[e]=+t[e])})),n},nr=function(t){void 0===t&&(t={});var e={};return Object.keys(t).forEach((function(n){e[n.toLowerCase()]=t[n]})),e};const rr=function(t,e){var n=e&&e.debugTiming?Ie:Ne;n("layout",(function(){e&&!e.keepNodeOrder&&e.prevGraph&&n(" inheritOrder",(function(){var n,r;n=t,r=e.prevGraph,n.nodes().forEach((function(t){var e=n.node(t),i=r.node(t);void 0!==i?(e.fixorder=i._order,delete i._order):delete e.fixorder}))}));var r=n(" buildLayoutGraph",(function(){return function(t){var e=new _e({multigraph:!0,compound:!0}),n=nr(t.graph()),r={};return null==jn||jn.forEach((function(t){void 0!==n[t]&&(r[t]=n[t])})),e.setGraph(Object.assign({},Ln,er(n,Gn),r)),t.nodes().forEach((function(n){var r=nr(t.node(n)),i=Rn(Rn({},Un),r),o=er(i,Fn);e.setNode(n,o),e.setParent(n,t.parent(n))})),t.edges().forEach((function(n){var r=nr(t.edge(n)),i={};null==Vn||Vn.forEach((function(t){void 0!==r[t]&&(i[t]=r[t])})),e.setEdgeObj(n,Object.assign({},zn,er(r,Bn),i))})),e}(t)}));e&&!1===e.edgeLabelSpace||n(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,t.nodes().forEach((function(e){var n=t.node(e);isNaN(n.layer)||n.layer||(n.layer=0)})),t.edges().forEach((function(n){var r,i=t.edge(n);i.minlen*=2,"c"!==(null===(r=i.labelpos)||void 0===r?void 0:r.toLowerCase())&&("TB"===e.rankdir||"BT"===e.rankdir?i.width+=i.labeloffset:i.height+=i.labeloffset)}))}(r)}));try{n(" runLayout",(function(){Pn(r,n,e)}))}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void 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}n(" updateInputGraph",(function(){!function(t,e){t.nodes().forEach((function(n){var r,i=t.node(n);if(i){var o=e.node(n);i.x=o.x,i.y=o.y,i._order=o.order,i._rank=o.rank,(null===(r=e.children(n))||void 0===r?void 0:r.length)&&(i.width=o.width,i.height=o.height)}})),t.edges().forEach((function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,i.hasOwnProperty("x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,r)}))}))};var ir=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),or=function(t){function n(e){var n=t.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.ranksep=50,n.controlPoints=!1,n.sortByCombo=!1,n.edgeLabelSpace=!0,n.radial=!1,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.layoutNode=function(t){var e=n.nodes.find((function(e){return e.id===t}));return!e||!1!==e.layout},n.updateCfg(e),n}return ir(n,t),n.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,nodeSize:void 0,nodesepFunc:void 0,ranksepFunc:void 0,nodesep:50,ranksep:50,controlPoints:!1,radial:!1,focusNode:null}},n.prototype.execute=function(){var t,n,r=this,a=this,u=a.nodes,s=a.nodeSize,c=a.rankdir,l=a.combos,h=a.begin,p=a.radial;if(u){var v,g=a.edges||[],y=new _e({multigraph:!0,compound:!0});v=s?i(s)?function(){return s}:function(){return[s,s]}:function(t){return t.size?i(t.size)?t.size:f(t.size)?[t.size.width||40,t.size.height||40]:[t.size,t.size]:[40,40]};var m=w(a.ranksep,50,a.ranksepFunc),b=w(a.nodesep,50,a.nodesepFunc),_=b,x=m;"LR"!==c&&"RL"!==c||(_=m,x=b),y.setDefaultEdgeLabel((function(){return{}})),y.setGraph(a);var E={};this.sortByCombo&&l&&l.forEach((function(t){t.parentId&&(E[t.parentId]||(E[t.parentId]=!0,y.setNode(t.parentId,{})),y.setParent(t.id,t.parentId))})),u.filter((function(t){return!1!==t.layout})).forEach((function(t){var e=v(t),n=x(t),i=_(t),a=e[0]+2*i,u=e[1]+2*n,s=t.layer;o(s)?y.setNode(t.id,{width:a,height:u,layer:s}):y.setNode(t.id,{width:a,height:u}),r.sortByCombo&&t.comboId&&(E[t.comboId]||(E[t.comboId]=!0,y.setNode(t.comboId,{})),y.setParent(t.id,t.comboId))})),g.forEach((function(t){var e=d(t,"source"),n=d(t,"target");r.layoutNode(e)&&r.layoutNode(n)&&y.setEdge(e,n,{weight:t.weight||1})}));var S=void 0;(null===(t=a.preset)||void 0===t?void 0:t.nodes)&&(S=new _e({multigraph:!0,compound:!0}),a.preset.nodes.forEach((function(t){null==S||S.setNode(t.id,t)}))),rr(y,{prevGraph:S,edgeLabelSpace:a.edgeLabelSpace,keepNodeOrder:Boolean(!!a.nodeOrder),nodeOrder:a.nodeOrder});var A=[0,0];if(h){var T=1/0,I=1/0;y.nodes().forEach((function(t){var e=y.node(t);T>e.x&&(T=e.x),I>e.y&&(I=e.y)})),y.edges().forEach((function(t){var e;null===(e=y.edge(t).points)||void 0===e||e.forEach((function(t){T>t.x&&(T=t.x),I>t.y&&(I=t.y)}))})),A[0]=h[0]-T,A[1]=h[1]-I}if(p){var N=this,O=N.focusNode,C=N.ranksep,k=N.getRadialPos,D=e(O)?O:null==O?void 0:O.id,M=D?null===(n=y.node(D))||void 0===n?void 0:n._rank:0,R=[],P="LR"===c||"RL"===c,G=P?"y":"x",L=P?"height":"width",j=1/0,F=-1/0;y.nodes().forEach((function(t){var e=y.node(t),n=u.findIndex((function(e){return e.id===t}));if(u[n]){var r=b(u[n]);if(0===M)R[e._rank]||(R[e._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),R[e._rank].nodes.push(t),R[e._rank].totalWidth+=2*r+e[L],R[e._rank].maxSize<Math.max(e.width,e.height)&&(R[e._rank].maxSize=Math.max(e.width,e.height));else{var i=e._rank-M;if(0===i)R[i]||(R[i]={nodes:[],totalWidth:0,maxSize:-1/0}),R[i].nodes.push(t),R[i].totalWidth+=2*r+e[L],R[i].maxSize<Math.max(e.width,e.height)&&(R[i].maxSize=Math.max(e.width,e.height));else{var o=Math.abs(i);R[o]||(R[o]={left:[],right:[],totalWidth:0,maxSize:-1/0}),R[o].totalWidth+=2*r+e[L],R[o].maxSize<Math.max(e.width,e.height)&&(R[o].maxSize=Math.max(e.width,e.height)),i<0?R[o].left.push(t):R[o].right.push(t)}}var a=e[G]-e[L]/2-r,s=e[G]+e[L]/2+r;a<j&&(j=a),s>F&&(F=s)}}));var U=C||50,B={},z=(F-j)/.9,V=[.5*(j+F-z),.5*(j+F+z)],W=function(t,e,n,r){void 0===n&&(n=-1/0),void 0===r&&(r=[0,1]);var i=n;return t.forEach((function(t){var n=y.node(t);B[t]=e;var o=k(n[G],V,z,e,r),a=o.x,s=o.y,c=u.findIndex((function(e){return e.id===t}));if(u[c]){u[c].x=a+A[0],u[c].y=s+A[1],u[c]._order=n._order;var f=m(u[c]);i<f&&(i=f)}})),i},H=!0;R.forEach((function(t){var e,n,r,i,o,a,s;if((null===(e=null==t?void 0:t.nodes)||void 0===e?void 0:e.length)||(null===(n=null==t?void 0:t.left)||void 0===n?void 0:n.length)||(null===(r=null==t?void 0:t.right)||void 0===r?void 0:r.length)){if(H&&1===t.nodes.length){var c=u.findIndex((function(e){return e.id===t.nodes[0]}));return u[c].x=A[0],u[c].y=A[1],B[t.nodes[0]]=0,U=m(u[c]),void(H=!1)}U=Math.max(U,t.totalWidth/(2*Math.PI));var f=-1/0;if(0===M||(null===(i=t.nodes)||void 0===i?void 0:i.length))f=W(t.nodes,U,f,[0,1]);else{var l=(null===(o=t.left)||void 0===o?void 0:o.length)/((null===(a=t.left)||void 0===a?void 0:a.length)+(null===(s=t.right)||void 0===s?void 0:s.length));f=W(t.left,U,f,[0,l]),f=W(t.right,U,f,[l+.05,1])}U+=f,H=!1,t.maxSize}})),y.edges().forEach((function(t){var e,n,r,i=y.edge(t),o=g.findIndex((function(e){var n=d(e,"source"),r=d(e,"target");return n===t.v&&r===t.w}));if(a.edgeLabelSpace&&a.controlPoints&&"loop"!==g[o].type){var u="x"===G?"y":"x",s=null===(e=null==i?void 0:i.points)||void 0===e?void 0:e.slice(1,i.points.length-1),c=[],f=null===(n=y.node(t.v))||void 0===n?void 0:n[u],l=f-(null===(r=y.node(t.w))||void 0===r?void 0:r[u]),h=B[t.v],p=h-B[t.w];null==s||s.forEach((function(t){var e=(t[u]-f)/l*p+h,n=k(t[G],V,z,e);c.push({x:n.x+A[0],y:n.y+A[1]})})),g[o].controlPoints=c}}))}else y.nodes().forEach((function(t){var e=y.node(t),n=u.findIndex((function(e){return e.id===t}));u[n]&&(u[n].x=e.x+A[0],u[n].y=e.y+A[1],u[n]._order=e._order)})),y.edges().forEach((function(t){var e,n=y.edge(t),r=g.findIndex((function(e){var n=d(e,"source"),r=d(e,"target");return n===t.v&&r===t.w}));a.edgeLabelSpace&&a.controlPoints&&"loop"!==g[r].type&&(g[r].controlPoints=null===(e=null==n?void 0:n.points)||void 0===e?void 0:e.slice(1,n.points.length-1),g[r].controlPoints.forEach((function(t){t.x+=A[0],t.y+=A[1]})))}));return a.onLayoutEnd&&a.onLayoutEnd(),{nodes:u,edges:g}}},n.prototype.getRadialPos=function(t,e,n,r,i){void 0===i&&(i=[0,1]);var o=(t-e[0])/n,a=2*(o=o*(i[1]-i[0])+i[0])*Math.PI;return{x:Math.cos(a)*r,y:Math.sin(a)*r}},n.prototype.getType=function(){return"dagre"},n}(t);const ar={graph:{meta:{rankDir:"TB",nodeSep:50,rankSep:50,edgeSep:5,align:void 0}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};function ur(t={},e=ar){var n,r,i,o;const a=JSON.parse(JSON.stringify(e)),u=(null===(n=null==t?void 0:t.graph)||void 0===n?void 0:n.meta)||{},s=(null===(r=null==t?void 0:t.subScene)||void 0===r?void 0:r.meta)||{},c=(null===(i=null==t?void 0:t.nodeSize)||void 0===i?void 0:i.meta)||{},f=(null===(o=null==t?void 0:t.nodeSize)||void 0===o?void 0:o.node)||{},l=a.nodeSize.bridge;return{graph:{meta:Object.assign(a.graph.meta,u)},subScene:{meta:Object.assign(a.subScene.meta,s)},nodeSize:{meta:Object.assign(a.nodeSize.meta,c),node:Object.assign(a.nodeSize.node,f),bridge:l}}}function sr(t){return`◬${t}◬`}const cr=sr("ROOT"),fr=sr("BRIDGE_GRAPH");var lr,dr,hr,pr;!function(t){t[t.META=0]="META",t[t.NODE=1]="NODE",t[t.BRIDGE=2]="BRIDGE"}(lr||(lr={})),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE",t[t.UNSPECIFIED=2]="UNSPECIFIED"}(dr||(dr={})),function(t){t[t.META=0]="META",t[t.CORE=1]="CORE",t[t.BRIDGE=2]="BRIDGE"}(hr||(hr={})),function(t){t[t.META=0]="META",t[t.OP=1]="OP",t[t.SERIES=2]="SERIES"}(pr||(pr={}));var vr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function gr(t,e){return t(e={exports:{}},e.exports),e.exports}var yr=function(t,e){return t===e||t!=t&&e!=e},mr=function(t,e){for(var n=t.length;n--;)if(yr(t[n][0],e))return n;return-1},br=Array.prototype.splice;function _r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}_r.prototype.clear=function(){this.__data__=[],this.size=0},_r.prototype.delete=function(t){var e=this.__data__,n=mr(e,t);return!(n<0||(n==e.length-1?e.pop():br.call(e,n,1),--this.size,0))},_r.prototype.get=function(t){var e=this.__data__,n=mr(e,t);return n<0?void 0:e[n][1]},_r.prototype.has=function(t){return mr(this.__data__,t)>-1},_r.prototype.set=function(t,e){var n=this.__data__,r=mr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var xr,wr=_r,Er="object"==typeof vr&&vr&&vr.Object===Object&&vr,Sr="object"==typeof self&&self&&self.Object===Object&&self,Ar=Er||Sr||Function("return this")(),Tr=Ar.Symbol,Ir=Object.prototype,Nr=Ir.hasOwnProperty,Or=Ir.toString,Cr=Tr?Tr.toStringTag:void 0,kr=Object.prototype.toString,Dr=Tr?Tr.toStringTag:void 0,Mr=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Dr&&Dr in Object(t)?function(t){var e=Nr.call(t,Cr),n=t[Cr];try{t[Cr]=void 0;var r=!0}catch(t){}var i=Or.call(t);return r&&(e?t[Cr]=n:delete t[Cr]),i}(t):function(t){return kr.call(t)}(t)},Rr=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Pr=function(t){if(!Rr(t))return!1;var e=Mr(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Gr=Ar["__core-js_shared__"],Lr=(xr=/[^.]+$/.exec(Gr&&Gr.keys&&Gr.keys.IE_PROTO||""))?"Symbol(src)_1."+xr:"",jr=Function.prototype.toString,Fr=function(t){if(null!=t){try{return jr.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Ur=/^\[object .+?Constructor\]$/,Br=Function.prototype,zr=Object.prototype,Vr=Br.toString,Wr=zr.hasOwnProperty,Hr=RegExp("^"+Vr.call(Wr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xr=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Rr(t)||function(t){return!!Lr&&Lr in t}(t))&&(Pr(t)?Hr:Ur).test(Fr(t))}(n)?n:void 0},qr=Xr(Ar,"Map"),Yr=Xr(Object,"create"),Kr=Object.prototype.hasOwnProperty,Zr=Object.prototype.hasOwnProperty;function $r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}$r.prototype.clear=function(){this.__data__=Yr?Yr(null):{},this.size=0},$r.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$r.prototype.get=function(t){var e=this.__data__;if(Yr){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Kr.call(e,t)?e[t]:void 0},$r.prototype.has=function(t){var e=this.__data__;return Yr?void 0!==e[t]:Zr.call(e,t)},$r.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Yr&&void 0===e?"__lodash_hash_undefined__":e,this};var Jr=$r,Qr=function(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map};function ti(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ti.prototype.clear=function(){this.size=0,this.__data__={hash:new Jr,map:new(qr||wr),string:new Jr}},ti.prototype.delete=function(t){var e=Qr(this,t).delete(t);return this.size-=e?1:0,e},ti.prototype.get=function(t){return Qr(this,t).get(t)},ti.prototype.has=function(t){return Qr(this,t).has(t)},ti.prototype.set=function(t,e){var n=Qr(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};var ei=ti;function ni(t){var e=this.__data__=new wr(t);this.size=e.size}ni.prototype.clear=function(){this.__data__=new wr,this.size=0},ni.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},ni.prototype.get=function(t){return this.__data__.get(t)},ni.prototype.has=function(t){return this.__data__.has(t)},ni.prototype.set=function(t,e){var n=this.__data__;if(n instanceof wr){var r=n.__data__;if(!qr||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ei(r)}return n.set(t,e),this.size=n.size,this};var ri=ni,ii=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t},oi=function(){try{var t=Xr(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),ai=function(t,e,n){"__proto__"==e&&oi?oi(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},ui=Object.prototype.hasOwnProperty,si=function(t,e,n){var r=t[e];ui.call(t,e)&&yr(r,n)&&(void 0!==n||e in t)||ai(t,e,n)},ci=function(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var u=e[o],s=r?r(n[u],t[u],u,n,t):void 0;void 0===s&&(s=t[u]),i?ai(n,u,s):si(n,u,s)}return n},fi=function(t){return null!=t&&"object"==typeof t},li=function(t){return fi(t)&&"[object Arguments]"==Mr(t)},di=Object.prototype,hi=di.hasOwnProperty,pi=di.propertyIsEnumerable,vi=li(function(){return arguments}())?li:function(t){return fi(t)&&hi.call(t,"callee")&&!pi.call(t,"callee")},gi=Array.isArray,yi=function(){return!1},mi=gr((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n?Ar.Buffer:void 0,o=(i?i.isBuffer:void 0)||yi;t.exports=o})),bi=/^(?:0|[1-9]\d*)$/,_i=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&bi.test(t))&&t>-1&&t%1==0&&t<e},xi=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},wi={};wi["[object Float32Array]"]=wi["[object Float64Array]"]=wi["[object Int8Array]"]=wi["[object Int16Array]"]=wi["[object Int32Array]"]=wi["[object Uint8Array]"]=wi["[object Uint8ClampedArray]"]=wi["[object Uint16Array]"]=wi["[object Uint32Array]"]=!0,wi["[object Arguments]"]=wi["[object Array]"]=wi["[object ArrayBuffer]"]=wi["[object Boolean]"]=wi["[object DataView]"]=wi["[object Date]"]=wi["[object Error]"]=wi["[object Function]"]=wi["[object Map]"]=wi["[object Number]"]=wi["[object Object]"]=wi["[object RegExp]"]=wi["[object Set]"]=wi["[object String]"]=wi["[object WeakMap]"]=!1;var Ei=function(t){return function(e){return t(e)}},Si=gr((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n&&Er.process,o=function(){try{return r&&r.require&&r.require("util").types||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o})),Ai=Si&&Si.isTypedArray,Ti=Ai?Ei(Ai):function(t){return fi(t)&&xi(t.length)&&!!wi[Mr(t)]},Ii=Object.prototype.hasOwnProperty,Ni=function(t,e){var n=gi(t),r=!n&&vi(t),i=!n&&!r&&mi(t),o=!n&&!r&&!i&&Ti(t),a=n||r||i||o,u=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],s=u.length;for(var c in t)!e&&!Ii.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_i(c,s))||u.push(c);return u},Oi=Object.prototype,Ci=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Oi)},ki=function(t,e){return function(n){return t(e(n))}},Di=ki(Object.keys,Object),Mi=Object.prototype.hasOwnProperty,Ri=function(t){if(!Ci(t))return Di(t);var e=[];for(var n in Object(t))Mi.call(t,n)&&"constructor"!=n&&e.push(n);return e},Pi=function(t){return null!=t&&xi(t.length)&&!Pr(t)},Gi=function(t){return Pi(t)?Ni(t):Ri(t)},Li=Object.prototype.hasOwnProperty,ji=function(t){return Pi(t)?Ni(t,!0):function(t){if(!Rr(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Ci(t),n=[];for(var r in t)("constructor"!=r||!e&&Li.call(t,r))&&n.push(r);return n}(t)},Fi=gr((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n?Ar.Buffer:void 0,o=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=o?o(n):new t.constructor(n);return t.copy(r),r}})),Ui=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},Bi=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o},zi=function(){return[]},Vi=Object.prototype.propertyIsEnumerable,Wi=Object.getOwnPropertySymbols,Hi=Wi?function(t){return null==t?[]:(t=Object(t),Bi(Wi(t),(function(e){return Vi.call(t,e)})))}:zi,Xi=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t},qi=ki(Object.getPrototypeOf,Object),Yi=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Xi(e,Hi(t)),t=qi(t);return e}:zi,Ki=function(t,e,n){var r=e(t);return gi(t)?r:Xi(r,n(t))},Zi=function(t){return Ki(t,Gi,Hi)},$i=function(t){return Ki(t,ji,Yi)},Ji=Xr(Ar,"DataView"),Qi=Xr(Ar,"Promise"),to=Xr(Ar,"Set"),eo=Xr(Ar,"WeakMap"),no=Fr(Ji),ro=Fr(qr),io=Fr(Qi),oo=Fr(to),ao=Fr(eo),uo=Mr;(Ji&&"[object DataView]"!=uo(new Ji(new ArrayBuffer(1)))||qr&&"[object Map]"!=uo(new qr)||Qi&&"[object Promise]"!=uo(Qi.resolve())||to&&"[object Set]"!=uo(new to)||eo&&"[object WeakMap]"!=uo(new eo))&&(uo=function(t){var e=Mr(t),n="[object Object]"==e?t.constructor:void 0,r=n?Fr(n):"";if(r)switch(r){case no:return"[object DataView]";case ro:return"[object Map]";case io:return"[object Promise]";case oo:return"[object Set]";case ao:return"[object WeakMap]"}return e});var so=uo,co=Object.prototype.hasOwnProperty,fo=Ar.Uint8Array,lo=function(t){var e=new t.constructor(t.byteLength);return new fo(e).set(new fo(t)),e},ho=/\w*$/,po=Tr?Tr.prototype:void 0,vo=po?po.valueOf:void 0,go=function(t,e){var n=e?lo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)},yo=Object.create,mo=function(){function t(){}return function(e){if(!Rr(e))return{};if(yo)return yo(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),bo=function(t){return"function"!=typeof t.constructor||Ci(t)?{}:mo(qi(t))},_o=Si&&Si.isMap,xo=_o?Ei(_o):function(t){return fi(t)&&"[object Map]"==so(t)},wo=Si&&Si.isSet,Eo=wo?Ei(wo):function(t){return fi(t)&&"[object Set]"==so(t)},So={};So["[object Arguments]"]=So["[object Array]"]=So["[object ArrayBuffer]"]=So["[object DataView]"]=So["[object Boolean]"]=So["[object Date]"]=So["[object Float32Array]"]=So["[object Float64Array]"]=So["[object Int8Array]"]=So["[object Int16Array]"]=So["[object Int32Array]"]=So["[object Map]"]=So["[object Number]"]=So["[object Object]"]=So["[object RegExp]"]=So["[object Set]"]=So["[object String]"]=So["[object Symbol]"]=So["[object Uint8Array]"]=So["[object Uint8ClampedArray]"]=So["[object Uint16Array]"]=So["[object Uint32Array]"]=!0,So["[object Error]"]=So["[object Function]"]=So["[object WeakMap]"]=!1;var Ao=function t(e,n,r,i,o,a){var u,s=1&n,c=2&n,f=4&n;if(r&&(u=o?r(e,i,o,a):r(e)),void 0!==u)return u;if(!Rr(e))return e;var l=gi(e);if(l){if(u=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&co.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!s)return Ui(e,u)}else{var d=so(e),h="[object Function]"==d||"[object GeneratorFunction]"==d;if(mi(e))return Fi(e,s);if("[object Object]"==d||"[object Arguments]"==d||h&&!o){if(u=c||h?{}:bo(e),!s)return c?function(t,e){return ci(t,Yi(t),e)}(e,function(t,e){return t&&ci(e,ji(e),t)}(u,e)):function(t,e){return ci(t,Hi(t),e)}(e,function(t,e){return t&&ci(e,Gi(e),t)}(u,e))}else{if(!So[d])return o?e:{};u=function(t,e,n){var r=t.constructor;switch(e){case"[object ArrayBuffer]":return lo(t);case"[object Boolean]":case"[object Date]":return new r(+t);case"[object DataView]":return function(t,e){var n=e?lo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return go(t,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,ho.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return function(t){return vo?Object(vo.call(t)):{}}(t)}}(e,d,s)}}a||(a=new ri);var p=a.get(e);if(p)return p;a.set(e,u),Eo(e)?e.forEach((function(i){u.add(t(i,n,r,i,e,a))})):xo(e)&&e.forEach((function(i,o){u.set(o,t(i,n,r,o,e,a))}));var v=l?void 0:(f?c?$i:Zi:c?ji:Gi)(e);return ii(v||e,(function(i,o){v&&(i=e[o=i]),si(u,o,t(i,n,r,o,e,a))})),u},To=function(t){return function(){return t}},Io=function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var u=o[++r];if(!1===e(i[u],u,i))break}return t},No=function(t,e){return t&&Io(t,e,Gi)},Oo=function(t,e){return function(e,n){if(null==e)return e;if(!Pi(e))return t(e,n);for(var r=e.length,i=-1,o=Object(e);++i<r&&!1!==n(o[i],i,o););return e}}(No),Co=function(t){return t},ko=function(t){return"function"==typeof t?t:Co},Do=function(t,e){return(gi(t)?ii:Oo)(t,ko(e))},Mo=Do,Ro=function(t,e){var n=[];return Oo(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n};function Po(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ei;++e<n;)this.add(t[e])}Po.prototype.add=Po.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Po.prototype.has=function(t){return this.__data__.has(t)};var Go=Po,Lo=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1},jo=function(t,e){return t.has(e)},Fo=function(t,e,n,r,i,o){var a=1&n,u=t.length,s=e.length;if(u!=s&&!(a&&s>u))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var l=-1,d=!0,h=2&n?new Go:void 0;for(o.set(t,e),o.set(e,t);++l<u;){var p=t[l],v=e[l];if(r)var g=a?r(v,p,l,e,t,o):r(p,v,l,t,e,o);if(void 0!==g){if(g)continue;d=!1;break}if(h){if(!Lo(e,(function(t,e){if(!jo(h,e)&&(p===t||i(p,t,n,r,o)))return h.push(e)}))){d=!1;break}}else if(p!==v&&!i(p,v,n,r,o)){d=!1;break}}return o.delete(t),o.delete(e),d},Uo=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},Bo=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},zo=Tr?Tr.prototype:void 0,Vo=zo?zo.valueOf:void 0,Wo=function(t,e,n,r,i,o,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new fo(t),new fo(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return yr(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=Uo;case"[object Set]":var s=1&r;if(u||(u=Bo),t.size!=e.size&&!s)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var f=Fo(u(t),u(e),r,i,o,a);return a.delete(t),f;case"[object Symbol]":if(Vo)return Vo.call(t)==Vo.call(e)}return!1},Ho=Object.prototype.hasOwnProperty,Xo=Object.prototype.hasOwnProperty,qo=function t(e,n,r,i,o){return e===n||(null==e||null==n||!fi(e)&&!fi(n)?e!=e&&n!=n:function(t,e,n,r,i,o){var a=gi(t),u=gi(e),s=a?"[object Array]":so(t),c=u?"[object Array]":so(e),f="[object Object]"==(s="[object Arguments]"==s?"[object Object]":s),l="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),d=s==c;if(d&&mi(t)){if(!mi(e))return!1;a=!0,f=!1}if(d&&!f)return o||(o=new ri),a||Ti(t)?Fo(t,e,n,r,i,o):Wo(t,e,s,n,r,i,o);if(!(1&n)){var h=f&&Xo.call(t,"__wrapped__"),p=l&&Xo.call(e,"__wrapped__");if(h||p){var v=h?t.value():t,g=p?e.value():e;return o||(o=new ri),i(v,g,n,r,o)}}return!!d&&(o||(o=new ri),function(t,e,n,r,i,o){var a=1&n,u=Zi(t),s=u.length;if(s!=Zi(e).length&&!a)return!1;for(var c=s;c--;){var f=u[c];if(!(a?f in e:Ho.call(e,f)))return!1}var l=o.get(t),d=o.get(e);if(l&&d)return l==e&&d==t;var h=!0;o.set(t,e),o.set(e,t);for(var p=a;++c<s;){var v=t[f=u[c]],g=e[f];if(r)var y=a?r(g,v,f,e,t,o):r(v,g,f,t,e,o);if(!(void 0===y?v===g||i(v,g,n,r,o):y)){h=!1;break}p||(p="constructor"==f)}if(h&&!p){var m=t.constructor,b=e.constructor;m==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof b&&b instanceof b||(h=!1)}return o.delete(t),o.delete(e),h}(t,e,n,r,i,o))}(e,n,r,i,t,o))},Yo=function(t){return t==t&&!Rr(t)},Ko=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}},Zo=function(t){return"symbol"==typeof t||fi(t)&&"[object Symbol]"==Mr(t)},$o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jo=/^\w*$/,Qo=function(t,e){if(gi(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Zo(t))||Jo.test(t)||!$o.test(t)||null!=e&&t in Object(e)};function ta(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(ta.Cache||ei),n}ta.Cache=ei;var ea,na=ta,ra=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ia=/\\(\\)?/g,oa=function(t){var e=na((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ra,(function(t,n,r,i){e.push(r?i.replace(ia,"$1"):n||t)})),e}),(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}(),aa=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i},ua=Tr?Tr.prototype:void 0,sa=ua?ua.toString:void 0,ca=function t(e){if("string"==typeof e)return e;if(gi(e))return aa(e,t)+"";if(Zo(e))return sa?sa.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},fa=function(t){return null==t?"":ca(t)},la=function(t,e){return gi(t)?t:Qo(t,e)?[t]:oa(fa(t))},da=function(t){if("string"==typeof t||Zo(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},ha=function(t,e){for(var n=0,r=(e=la(e,t)).length;null!=t&&n<r;)t=t[da(e[n++])];return n&&n==r?t:void 0},pa=function(t,e){return null!=t&&e in Object(t)},va=function(t,e,n){for(var r=-1,i=(e=la(e,t)).length,o=!1;++r<i;){var a=da(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&xi(i)&&_i(a,i)&&(gi(t)||vi(t))},ga=function(t,e){return null!=t&&va(t,e,pa)},ya=function(t){return function(e){return null==e?void 0:e[t]}},ma=function(t){return"function"==typeof t?t:null==t?Co:"object"==typeof t?gi(t)?function(t,e){return Qo(t)&&Yo(e)?Ko(da(t),e):function(n){var r=function(t,e,n){var r=null==t?void 0:ha(t,e);return void 0===r?void 0:r}(n,t);return void 0===r&&r===e?ga(n,t):qo(e,r,3)}}(t[0],t[1]):function(t){var e=function(t){for(var e=Gi(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Yo(i)]}return e}(t);return 1==e.length&&e[0][2]?Ko(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,r){var i=n.length,o=i;if(null==t)return!o;for(t=Object(t);i--;){var a=n[i];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){var u=(a=n[i])[0],s=t[u],c=a[1];if(a[2]){if(void 0===s&&!(u in t))return!1}else{var f,l=new ri;if(!(void 0===f?qo(c,s,3,r,l):f))return!1}}return!0}(n,0,e)}}(t):function(t){return Qo(t)?ya(da(t)):function(t){return function(e){return ha(e,t)}}(t)}(t)},ba=function(t,e){return(gi(t)?Bi:Ro)(t,ma(e))},_a=Object.prototype.hasOwnProperty,xa=function(t,e){return null!=t&&_a.call(t,e)},wa=function(t,e){return null!=t&&va(t,e,xa)},Ea=Object.prototype.hasOwnProperty,Sa=function(t){return void 0===t},Aa=function(t,e){var n=-1,r=Pi(t)?Array(t.length):[];return Oo(t,(function(t,i,o){r[++n]=e(t,i,o)})),r},Ta=function(t,e){return(gi(t)?aa:Aa)(t,ma(e))},Ia=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n},Na=function(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n},Oa=function(t,e,n){var r=gi(t)?Ia:Na,i=arguments.length<3;return r(t,ma(e),n,i,Oo)},Ca=ya("length"),ka=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Da="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ma="\\ud83c[\\udffb-\\udfff]",Ra="[^\\ud800-\\udfff]",Pa="(?:\\ud83c[\\udde6-\\uddff]){2}",Ga="[\\ud800-\\udbff][\\udc00-\\udfff]",La="(?:"+Da+"|"+Ma+")?",ja="[\\ufe0e\\ufe0f]?"+La+"(?:\\u200d(?:"+[Ra,Pa,Ga].join("|")+")[\\ufe0e\\ufe0f]?"+La+")*",Fa="(?:"+[Ra+Da+"?",Da,Pa,Ga,"[\\ud800-\\udfff]"].join("|")+")",Ua=RegExp(Ma+"(?="+Ma+")|"+Fa+ja,"g"),Ba=Tr?Tr.isConcatSpreadable:void 0,za=function(t){return gi(t)||vi(t)||!!(Ba&&t&&t[Ba])},Va=function t(e,n,r,i,o){var a=-1,u=e.length;for(r||(r=za),o||(o=[]);++a<u;){var s=e[a];n>0&&r(s)?n>1?t(s,n-1,r,i,o):Xi(o,s):i||(o[o.length]=s)}return o},Wa=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},Ha=Math.max,Xa=function(t,e,n){return e=Ha(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=Ha(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=r[i];return u[e]=n(a),Wa(t,this,u)}},qa=oi?function(t,e){return oi(t,"toString",{configurable:!0,enumerable:!1,value:To(e),writable:!0})}:Co,Ya=Date.now,Ka=function(t){var e=0,n=0;return function(){var r=Ya(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(qa),Za=function(t,e){return Ka(Xa(t,e,Co),t+"")},$a=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1},Ja=function(t){return t!=t},Qa=function(t,e){return!(null==t||!t.length)&&function(t,e,n){return e==e?function(t,e,n){for(var r=-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e):$a(t,Ja,0)}(t,e)>-1},tu=to&&1/Bo(new to([,-0]))[1]==1/0?function(t){return new to(t)}:function(){},eu=function(t){return fi(t)&&Pi(t)},nu=Za((function(t){return function(t,e,n){var r=-1,i=Qa,o=t.length,a=!0,u=[],s=u;if(o>=200){var c=tu(t);if(c)return Bo(c);a=!1,i=jo,s=new Go}else s=u;t:for(;++r<o;){var f=t[r],l=f;if(f=0!==f?f:0,a&&l==l){for(var d=s.length;d--;)if(s[d]===l)continue t;u.push(f)}else i(s,l,n)||(s!==u&&s.push(l),u.push(f))}return u}(Va(t,1,eu,!0))})),ru=function(t){return null==t?[]:function(t,e){return aa(e,(function(e){return t[e]}))}(t,Gi(t))};try{ea={clone:function(t){return Ao(t,4)},constant:To,each:Mo,filter:ba,has:wa,isArray:gi,isEmpty:function(t){if(null==t)return!0;if(Pi(t)&&(gi(t)||"string"==typeof t||"function"==typeof t.splice||mi(t)||Ti(t)||vi(t)))return!t.length;var e=so(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(Ci(t))return!Ri(t).length;for(var n in t)if(Ea.call(t,n))return!1;return!0},isFunction:Pr,isUndefined:Sa,keys:Gi,map:Ta,reduce:Oa,size:function(t){if(null==t)return 0;if(Pi(t))return function(t){return"string"==typeof t||!gi(t)&&fi(t)&&"[object String]"==Mr(t)}(t)?function(t){return function(t){return ka.test(t)}(t)?function(t){for(var e=Ua.lastIndex=0;Ua.test(t);)++e;return e}(t):Ca(t)}(t):t.length;var e=so(t);return"[object Map]"==e||"[object Set]"==e?t.size:Ri(t).length},transform:function(t,e,n){var r=gi(t),i=r||mi(t)||Ti(t);if(e=ma(e),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Rr(t)&&Pr(o)?mo(qi(t)):{}}return(i?ii:No)(t,(function(t,r,i){return e(n,t,r,i)})),n},union:nu,values:ru}}catch(ar){}ea||(ea=window._);var iu=ea,ou=au;function au(t){this._isDirected=!iu.has(t,"directed")||t.directed,this._isMultigraph=!!iu.has(t,"multigraph")&&t.multigraph,this._isCompound=!!iu.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=iu.constant(void 0),this._defaultEdgeLabelFn=iu.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function uu(t,e){t[e]?t[e]++:t[e]=1}function su(t,e){--t[e]||delete t[e]}function cu(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}return i+""+o+""+(iu.isUndefined(r)?"\0":r)}function fu(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var u={v:i,w:o};return r&&(u.name=r),u}function lu(t,e){return cu(t,e.v,e.w,e.name)}au.prototype._nodeCount=0,au.prototype._edgeCount=0,au.prototype.isDirected=function(){return this._isDirected},au.prototype.isMultigraph=function(){return this._isMultigraph},au.prototype.isCompound=function(){return this._isCompound},au.prototype.setGraph=function(t){return this._label=t,this},au.prototype.graph=function(){return this._label},au.prototype.setDefaultNodeLabel=function(t){return iu.isFunction(t)||(t=iu.constant(t)),this._defaultNodeLabelFn=t,this},au.prototype.nodeCount=function(){return this._nodeCount},au.prototype.nodes=function(){return iu.keys(this._nodes)},au.prototype.sources=function(){var t=this;return iu.filter(this.nodes(),(function(e){return iu.isEmpty(t._in[e])}))},au.prototype.sinks=function(){var t=this;return iu.filter(this.nodes(),(function(e){return iu.isEmpty(t._out[e])}))},au.prototype.setNodes=function(t,e){var n=arguments,r=this;return iu.each(t,(function(t){n.length>1?r.setNode(t,e):r.setNode(t)})),this},au.prototype.setNode=function(t,e){return iu.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},au.prototype.node=function(t){return this._nodes[t]},au.prototype.hasNode=function(t){return iu.has(this._nodes,t)},au.prototype.removeNode=function(t){var e=this;if(iu.has(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],iu.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),iu.each(iu.keys(this._in[t]),n),delete this._in[t],delete this._preds[t],iu.each(iu.keys(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},au.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(iu.isUndefined(e))e="\0";else{for(var n=e+="";!iu.isUndefined(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},au.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},au.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if("\0"!==e)return e}},au.prototype.children=function(t){if(iu.isUndefined(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return iu.keys(e)}else{if("\0"===t)return this.nodes();if(this.hasNode(t))return[]}},au.prototype.predecessors=function(t){var e=this._preds[t];if(e)return iu.keys(e)},au.prototype.successors=function(t){var e=this._sucs[t];if(e)return iu.keys(e)},au.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return iu.union(e,this.successors(t))},au.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},au.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;iu.each(this._nodes,(function(n,r){t(r)&&e.setNode(r,n)})),iu.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))}));var r={};function i(t){var o=n.parent(t);return void 0===o||e.hasNode(o)?(r[t]=o,o):o in r?r[o]:i(o)}return this._isCompound&&iu.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},au.prototype.setDefaultEdgeLabel=function(t){return iu.isFunction(t)||(t=iu.constant(t)),this._defaultEdgeLabelFn=t,this},au.prototype.edgeCount=function(){return this._edgeCount},au.prototype.edges=function(){return iu.values(this._edgeObjs)},au.prototype.setPath=function(t,e){var n=this,r=arguments;return iu.reduce(t,(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i})),this},au.prototype.setEdge=function(){var t,e,n,r,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,e=o.w,n=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,e=""+e,iu.isUndefined(n)||(n=""+n);var a=cu(this._isDirected,t,e,n);if(iu.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=r),this;if(!iu.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?r:this._defaultEdgeLabelFn(t,e,n);var u=fu(this._isDirected,t,e,n);return t=u.v,e=u.w,Object.freeze(u),this._edgeObjs[a]=u,uu(this._preds[e],t),uu(this._sucs[t],e),this._in[e][a]=u,this._out[t][a]=u,this._edgeCount++,this},au.prototype.edge=function(t,e,n){var r=1===arguments.length?lu(this._isDirected,arguments[0]):cu(this._isDirected,t,e,n);return this._edgeLabels[r]},au.prototype.hasEdge=function(t,e,n){var r=1===arguments.length?lu(this._isDirected,arguments[0]):cu(this._isDirected,t,e,n);return iu.has(this._edgeLabels,r)},au.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?lu(this._isDirected,arguments[0]):cu(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],su(this._preds[e],t),su(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},au.prototype.inEdges=function(t,e){var n=this._in[t];if(n){var r=iu.values(n);return e?iu.filter(r,(function(t){return t.v===e})):r}},au.prototype.outEdges=function(t,e){var n=this._out[t];if(n){var r=iu.values(n);return e?iu.filter(r,(function(t){return t.w===e})):r}},au.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))};var du={Graph:ou,version:"2.1.8"},hu={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:pu(t),edges:vu(t)};return iu.isUndefined(t.graph())||(e.value=iu.clone(t.graph())),e},read:function(t){var e=new ou(t.options).setGraph(t.value);return iu.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),iu.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}};function pu(t){return iu.map(t.nodes(),(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return iu.isUndefined(n)||(i.value=n),iu.isUndefined(r)||(i.parent=r),i}))}function vu(t){return iu.map(t.edges(),(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return iu.isUndefined(e.name)||(r.name=e.name),iu.isUndefined(n)||(r.value=n),r}))}var gu=yu;function yu(){this._arr=[],this._keyIndices={}}yu.prototype.size=function(){return this._arr.length},yu.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},yu.prototype.has=function(t){return iu.has(this._keyIndices,t)},yu.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},yu.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},yu.prototype.add=function(t,e){var n=this._keyIndices;if(t=String(t),!iu.has(n,t)){var r=this._arr,i=r.length;return n[t]=i,r.push({key:t,priority:e}),this._decrease(i),!0}return!1},yu.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},yu.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},yu.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))},yu.prototype._decrease=function(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e},yu.prototype._swap=function(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e};var mu=function(t,e,n,r){return function(t,e,n,r){var i,o,a={},u=new gu,s=function(t){var e=t.v!==i?t.v:t.w,r=a[e],s=n(t),c=o.distance+s;if(s<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+s);c<r.distance&&(r.distance=c,r.predecessor=i,u.decrease(e,c))};for(t.nodes().forEach((function(t){var n=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:n},u.add(t,n)}));u.size()>0&&(i=u.removeMin(),(o=a[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(s);return a}(t,String(e),n||bu,r||function(e){return t.outEdges(e)})},bu=iu.constant(1),_u=function(t){var e=0,n=[],r={},i=[];function o(a){var u=r[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach((function(t){iu.has(r,t)?r[t].onStack&&(u.lowlink=Math.min(u.lowlink,r[t].index)):(o(t),u.lowlink=Math.min(u.lowlink,r[t].lowlink))})),u.lowlink===u.index){var s,c=[];do{s=n.pop(),r[s].onStack=!1,c.push(s)}while(a!==s);i.push(c)}}return t.nodes().forEach((function(t){iu.has(r,t)||o(t)})),i},xu=iu.constant(1),wu=Eu;function Eu(t){var e={},n={},r=[];if(iu.each(t.sinks(),(function i(o){if(iu.has(n,o))throw new Su;iu.has(e,o)||(n[o]=!0,e[o]=!0,iu.each(t.predecessors(o),i),delete n[o],r.push(o))})),iu.size(e)!==t.nodeCount())throw new Su;return r}function Su(){}Eu.CycleException=Su,Su.prototype=new Error;var Au=function(t,e,n){iu.isArray(e)||(e=[e]);var r=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],o={};return iu.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);Tu(t,e,"post"===n,o,r,i)})),i};function Tu(t,e,n,r,i,o){iu.has(r,e)||(r[e]=!0,n||o.push(e),iu.each(i(e),(function(e){Tu(t,e,n,r,i,o)})),n&&o.push(e))}var Iu,Nu={Graph:du.Graph,json:hu,alg:{components:function(t){var e,n={},r=[];function i(r){iu.has(n,r)||(n[r]=!0,e.push(r),iu.each(t.successors(r),i),iu.each(t.predecessors(r),i))}return iu.each(t.nodes(),(function(t){e=[],i(t),e.length&&r.push(e)})),r},dijkstra:mu,dijkstraAll:function(t,e,n){return iu.transform(t.nodes(),(function(r,i){r[i]=mu(t,i,e,n)}),{})},findCycles:function(t){return iu.filter(_u(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))},floydWarshall:function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],u=r.distance+i.distance;u<a.distance&&(a.distance=u,a.predecessor=i.predecessor)}))}))})),r}(t,e||xu,n||function(e){return t.outEdges(e)})},isAcyclic:function(t){try{wu(t)}catch(t){if(t instanceof wu.CycleException)return!1;throw t}return!0},postorder:function(t,e){return Au(t,e,"post")},preorder:function(t,e){return Au(t,e,"pre")},prim:function(t,e){var n,r=new ou,i={},o=new gu;function a(t){var r=t.v===n?t.w:t.v,a=o.priority(r);if(void 0!==a){var u=e(t);u<a&&(i[r]=n,o.decrease(r,u))}}if(0===t.nodeCount())return r;iu.each(t.nodes(),(function(t){o.add(t,Number.POSITIVE_INFINITY),r.setNode(t)})),o.decrease(t.nodes()[0],0);for(var u=!1;o.size()>0;){if(n=o.removeMin(),iu.has(i,n))r.setEdge(n,i[n]);else{if(u)throw new Error("Input graph is not connected: "+t);u=!0}t.nodeEdges(n).forEach(a)}return r},tarjan:_u,topsort:wu},version:du.version};try{Iu=Nu}catch(ar){}Iu||(Iu=window.graphlib);var Ou,Cu=Iu,ku=function(t,e,n){if(!Rr(n))return!1;var r=typeof e;return!!("number"==r?Pi(n)&&_i(e,n.length):"string"==r&&e in n)&&yr(n[e],t)},Du=Object.prototype,Mu=Du.hasOwnProperty,Ru=Za((function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&ku(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],a=ji(o),u=-1,s=a.length;++u<s;){var c=a[u],f=t[c];(void 0===f||yr(f,Du[c])&&!Mu.call(t,c))&&(t[c]=o[c])}return t})),Pu=/^\s+|\s+$/g,Gu=/^[-+]0x[0-9a-f]+$/i,Lu=/^0b[01]+$/i,ju=/^0o[0-7]+$/i,Fu=parseInt,Uu=function(t){return t?1/0===(t=function(t){if("number"==typeof t)return t;if(Zo(t))return NaN;if(Rr(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Rr(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Pu,"");var n=Lu.test(t);return n||ju.test(t)?Fu(t.slice(2),n?2:8):Gu.test(t)?NaN:+t}(t))||-1/0===t?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},Bu=Math.max,zu=function(t,e,n){var r=Object(t);if(!Pi(t)){var i=ma(e);t=Gi(t),e=function(t){return i(r[t],t,r)}}var o=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:function(t){var e=Uu(t),n=e%1;return e==e?n?e-n:e:0}(n);return i<0&&(i=Bu(r+i,0)),$a(t,ma(e),i)}(t,e,n);return o>-1?r[i?t[o]:o]:void 0},Vu=function(t){return null!=t&&t.length?Va(t,1):[]},Wu=function(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],a=e(o);if(null!=a&&(void 0===u?a==a&&!Zo(a):n(a,u)))var u=a,s=o}return s},Hu=function(t,e){return t>e},Xu=function(t,e,n){(void 0!==n&&!yr(t[e],n)||void 0===n&&!(e in t))&&ai(t,e,n)},qu=Function.prototype,Yu=Object.prototype,Ku=qu.toString,Zu=Yu.hasOwnProperty,$u=Ku.call(Object),Ju=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Qu=function t(e,n,r,i,o){e!==n&&Io(n,(function(a,u){if(o||(o=new ri),Rr(a))!function(t,e,n,r,i,o,a){var u=Ju(t,n),s=Ju(e,n),c=a.get(s);if(c)Xu(t,n,c);else{var f=o?o(u,s,n+"",t,e,a):void 0,l=void 0===f;if(l){var d=gi(s),h=!d&&mi(s),p=!d&&!h&&Ti(s);f=s,d||h||p?gi(u)?f=u:eu(u)?f=Ui(u):h?(l=!1,f=Fi(s,!0)):p?(l=!1,f=go(s,!0)):f=[]:function(t){if(!fi(t)||"[object Object]"!=Mr(t))return!1;var e=qi(t);if(null===e)return!0;var n=Zu.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ku.call(n)==$u}(s)||vi(s)?(f=u,vi(u)?f=function(t){return ci(t,ji(t))}(u):Rr(u)&&!Pr(u)||(f=bo(s))):l=!1}l&&(a.set(s,f),i(f,s,r,o,a),a.delete(s)),Xu(t,n,f)}}(e,n,u,r,t,i,o);else{var s=i?i(Ju(e,u),a,u+"",e,n,o):void 0;void 0===s&&(s=a),Xu(e,u,s)}}),ji)},ts=function(t){return Za((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&ku(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++r<i;){var u=n[r];u&&t(e,u,r)}return e}))}((function(t,e,n){Qu(t,e,n)})),es=function(t,e){return t<e},ns=function(t,e,n,r){if(!Rr(t))return t;for(var i=-1,o=(e=la(e,t)).length,a=o-1,u=t;null!=u&&++i<o;){var s=da(e[i]),c=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return t;if(i!=a){var f=u[s];void 0===(c=r?r(f,s,u):void 0)&&(c=Rr(f)?f:_i(e[i+1])?[]:{})}si(u,s,c),u=u[s]}return t},rs=function(t){return Ka(Xa(t,void 0,Vu),t+"")}((function(t,e){return null==t?{}:function(t,e){return function(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],u=ha(t,a);n(0,a)&&ns(o,la(a,t),u)}return o}(t,e,(function(e,n){return ga(t,n)}))}(t,e)})),is=Math.ceil,os=Math.max,as=function(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Zo(t),a=void 0!==e,u=null===e,s=e==e,c=Zo(e);if(!u&&!c&&!o&&t>e||o&&a&&s&&!u&&!c||r&&a&&s||!n&&s||!i)return 1;if(!r&&!o&&!c&&t<e||c&&n&&i&&!r&&!o||u&&n&&i||!a&&i||!s)return-1}return 0},us=Za((function(t,e){if(null==t)return[];var n=e.length;return n>1&&ku(t,e[0],e[1])?e=[]:n>2&&ku(e[0],e[1],e[2])&&(e=[e[0]]),function(t,e,n){e=e.length?aa(e,(function(t){return gi(t)?function(e){return ha(e,1===t.length?t[0]:t)}:t})):[Co];var r=-1;e=aa(e,Ei(ma));var i=Aa(t,(function(t,n,i){return{criteria:aa(e,(function(e){return e(t)})),index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,u=n.length;++r<a;){var s=as(i[r],o[r]);if(s)return r>=u?s:s*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}(t,Va(e,1),[])})),ss=0;try{Ou={cloneDeep:function(t){return Ao(t,5)},constant:To,defaults:Ru,each:Mo,filter:ba,find:zu,flatten:Vu,forEach:Do,forIn:function(t,e){return null==t?t:Io(t,ko(e),ji)},has:wa,isUndefined:Sa,last:function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},map:Ta,mapValues:function(t,e){var n={};return e=ma(e),No(t,(function(t,r,i){ai(n,r,e(t,r,i))})),n},max:function(t){return t&&t.length?Wu(t,Co,Hu):void 0},merge:ts,min:function(t){return t&&t.length?Wu(t,Co,es):void 0},minBy:function(t,e){return t&&t.length?Wu(t,ma(e),es):void 0},now:function(){return Ar.Date.now()},pick:rs,range:function(t,e,n){return n&&"number"!=typeof n&&ku(t,e,n)&&(e=n=void 0),t=Uu(t),void 0===e?(e=t,t=0):e=Uu(e),function(t,e,n,r){for(var i=-1,o=os(is((e-t)/(n||1)),0),a=Array(o);o--;)a[++i]=t,t+=n;return a}(t,e,n=void 0===n?t<e?1:-1:Uu(n))},reduce:Oa,sortBy:us,uniqueId:function(t){var e=++ss;return fa(t)+e},values:ru,zipObject:function(t,e){return function(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var u=r<o?e[r]:void 0;n(a,t[r],u)}return a}(t||[],e||[],si)}}}catch(ar){}Ou||(Ou=window._);var cs=Ou,fs=ls;function ls(){var t={};t._next=t._prev=t,this._sentinel=t}function ds(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function hs(t,e){if("_next"!==t&&"_prev"!==t)return e}ls.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return ds(e),e},ls.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&ds(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},ls.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,hs)),n=n._prev;return"["+t.join(", ")+"]"};var ps=Cu.Graph,vs=cs.constant(1);function gs(t,e,n,r,i){var o=i?[]:void 0;return cs.forEach(t.inEdges(r.v),(function(r){var a=t.edge(r),u=t.node(r.v);i&&o.push({v:r.v,w:r.w}),u.out-=a,ys(e,n,u)})),cs.forEach(t.outEdges(r.v),(function(r){var i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,ys(e,n,a)})),t.removeNode(r.v),o}function ys(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var ms=Cu.Graph,bs={addDummyNode:_s,simplify:function(t){var e=(new ms).setGraph(t.graph());return cs.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n))})),cs.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e},asNonCompoundGraph:function(t){var e=new ms({multigraph:t.isMultigraph()}).setGraph(t.graph());return cs.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),cs.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e},successorWeights:function(t){var e=cs.map(t.nodes(),(function(e){var n={};return cs.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight})),n}));return cs.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=cs.map(t.nodes(),(function(e){var n={};return cs.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight})),n}));return cs.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,o=t.y,a=e.x-i,u=e.y-o,s=t.width/2,c=t.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*s>Math.abs(a)*c?(u<0&&(c=-c),n=c*a/u,r=c):(a<0&&(s=-s),n=s,r=s*u/a),{x:i+n,y:o+r}},buildLayerMatrix:function(t){var e=cs.map(cs.range(xs(t)+1),(function(){return[]}));return cs.forEach(t.nodes(),(function(n){var r=t.node(n),i=r.rank;cs.isUndefined(i)||(e[i][r.order]=n)})),e},normalizeRanks:function(t){var e=cs.min(cs.map(t.nodes(),(function(e){return t.node(e).rank})));cs.forEach(t.nodes(),(function(n){var r=t.node(n);cs.has(r,"rank")&&(r.rank-=e)}))},removeEmptyRanks:function(t){var e=cs.min(cs.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];cs.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var r=0,i=t.graph().nodeRankFactor;cs.forEach(n,(function(e,n){cs.isUndefined(e)&&n%i!=0?--r:r&&cs.forEach(e,(function(e){t.node(e).rank+=r}))}))},addBorderNode:function(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),_s(t,"border",i,e)},maxRank:xs,partition:function(t,e){var n={lhs:[],rhs:[]};return cs.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n},time:function(t,e){var n=cs.now();try{return e()}finally{console.log(t+" time: "+(cs.now()-n)+"ms")}},notime:function(t,e){return e()}};function _s(t,e,n,r){var i;do{i=cs.uniqueId(r)}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function xs(t){return cs.max(cs.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!cs.isUndefined(n))return n})))}var ws=function(t){var e={};cs.forEach(t.sources(),(function n(r){var i=t.node(r);if(cs.has(e,r))return i.rank;e[r]=!0;var o=cs.min(cs.map(t.outEdges(r),(function(e){return n(e.w)-t.edge(e).minlen})));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),i.rank=o}))},Es=function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen},Ss=Cu.Graph,As=Es,Ts=function(t){var e,n,r=new Ss({directed:!1}),i=t.nodes()[0],o=t.nodeCount();for(r.setNode(i,{});Is(r,t)<o;)e=Ns(r,t),n=r.hasNode(e.v)?As(t,e):-As(t,e),Os(r,t,n);return r};function Is(t,e){return cs.forEach(t.nodes(),(function n(r){cs.forEach(e.nodeEdges(r),(function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||As(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()}function Ns(t,e){return cs.minBy(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return As(e,n)}))}function Os(t,e,n){cs.forEach(t.nodes(),(function(t){e.node(t).rank+=n}))}var Cs=Es,ks=ws,Ds=Cu.alg.preorder,Ms=Cu.alg.postorder,Rs=bs.simplify,Ps=Gs;function Gs(t){t=Rs(t),ks(t);var e,n=Ts(t);for(Fs(n),Ls(n,t);e=Bs(n);)Vs(n,t,e,zs(n,t,e))}function Ls(t,e){var n=Ms(t,t.nodes());n=n.slice(0,n.length-1),cs.forEach(n,(function(n){!function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=js(t,e,n)}(t,e,n)}))}function js(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,cs.forEach(e.nodeEdges(n),(function(o){var u,s,c=o.v===n,f=c?o.w:o.v;if(f!==r){var l=c===i,d=e.edge(o).weight;if(a+=l?d:-d,u=n,s=f,t.hasEdge(u,s)){var h=t.edge(n,f).cutvalue;a+=l?-h:h}}})),a}function Fs(t,e){arguments.length<2&&(e=t.nodes()[0]),Us(t,{},1,e)}function Us(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,cs.forEach(t.neighbors(r),(function(i){cs.has(e,i)||(n=Us(t,e,n,i,r))})),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function Bs(t){return cs.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function zs(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),u=o,s=!1;o.lim>a.lim&&(u=a,s=!0);var c=cs.filter(e.edges(),(function(e){return s===Ws(0,t.node(e.v),u)&&s!==Ws(0,t.node(e.w),u)}));return cs.minBy(c,(function(t){return Cs(e,t)}))}function Vs(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),Fs(t),Ls(t,e),function(t,e){var n=cs.find(t.nodes(),(function(t){return!e.node(t).parent})),r=Ds(t,n);r=r.slice(1),cs.forEach(r,(function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))}(t,e)}function Ws(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}Gs.initLowLimValues=Fs,Gs.initCutValues=Ls,Gs.calcCutValue=js,Gs.leaveEdge=Bs,Gs.enterEdge=zs,Gs.exchangeEdges=Vs;var Hs=ws,Xs=Hs;var qs=function(t){var e=bs.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&cs.forEach(o,(function(t){n(t,i+1)})),e[r]=i}return cs.forEach(t.children(),(function(t){n(t,1)})),e}(t),r=cs.max(cs.values(n))-1,i=2*r+1;t.graph().nestingRoot=e,cs.forEach(t.edges(),(function(e){t.edge(e).minlen*=i}));var o=function(t){return cs.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;cs.forEach(t.children(),(function(a){Ys(t,e,i,o,r,n,a)})),t.graph().nodeRankFactor=i};function Ys(t,e,n,r,i,o,a){var u=t.children(a);if(u.length){var s=bs.addBorderNode(t,"_bt"),c=bs.addBorderNode(t,"_bb"),f=t.node(a);t.setParent(s,a),f.borderTop=s,t.setParent(c,a),f.borderBottom=c,cs.forEach(u,(function(u){Ys(t,e,n,r,i,o,u);var f=t.node(u),l=f.borderTop?f.borderTop:u,d=f.borderBottom?f.borderBottom:u,h=f.borderTop?r:2*r,p=l!==d?1:i-o[a]+1;t.setEdge(s,l,{weight:h,minlen:p,nestingEdge:!0}),t.setEdge(d,c,{weight:h,minlen:p,nestingEdge:!0})})),t.parent(a)||t.setEdge(e,s,{weight:0,minlen:i+o[a]})}else a!==e&&t.setEdge(e,a,{weight:0,minlen:n})}function Ks(t,e,n,r,i,o){var a={width:0,height:0,rank:o,borderType:e},u=i[e][o-1],s=bs.addDummyNode(t,"border",a,n);i[e][o]=s,t.setParent(s,r),u&&t.setEdge(u,s,{weight:1})}function Zs(t){cs.forEach(t.nodes(),(function(e){$s(t.node(e))})),cs.forEach(t.edges(),(function(e){$s(t.edge(e))}))}function $s(t){var e=t.width;t.width=t.height,t.height=e}function Js(t){t.y=-t.y}function Qs(t){var e=t.x;t.x=t.y,t.y=e}var tc=function(t,e){for(var n=0,r=1;r<e.length;++r)n+=ec(t,e[r-1],e[r]);return n};function ec(t,e,n){for(var r=cs.zipObject(n,cs.map(n,(function(t,e){return e}))),i=cs.flatten(cs.map(e,(function(e){return cs.sortBy(cs.map(t.outEdges(e),(function(e){return{pos:r[e.w],weight:t.edge(e).weight}})),"pos")})),!0),o=1;o<n.length;)o<<=1;var a=2*o-1;o-=1;var u=cs.map(new Array(a),(function(){return 0})),s=0;return cs.forEach(i.forEach((function(t){var e=t.pos+o;u[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=u[e+1]),u[e=e-1>>1]+=t.weight;s+=t.weight*n}))),s}function nc(t,e,n){for(var r;e.length&&(r=cs.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}var rc=function t(e,n,r,i){var o=e.children(n),a=e.node(n),u=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};u&&(o=cs.filter(o,(function(t){return t!==u&&t!==s})));var f=function(t,e){return cs.map(e,(function(e){var n=t.inEdges(e);if(n.length){var r=cs.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))}(e,o);cs.forEach(f,(function(n){if(e.children(n.v).length){var o=t(e,n.v,r,i);c[n.v]=o,cs.has(o,"barycenter")&&(a=n,u=o,cs.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var l=function(t,e){var n={};return cs.forEach(t,(function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};cs.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)})),cs.forEach(e.edges(),(function(t){var e=n[t.v],r=n[t.w];cs.isUndefined(e)||cs.isUndefined(r)||(r.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){e.merged||(cs.isUndefined(e.barycenter)||cs.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var i=t.pop();e.push(i),cs.forEach(i.in.reverse(),n(i)),cs.forEach(i.out,r(i))}return cs.map(cs.filter(e,(function(t){return!t.merged})),(function(t){return cs.pick(t,["vs","i","barycenter","weight"])}))}(cs.filter(n,(function(t){return!t.indegree})))}(f,r);!function(t,e){cs.forEach(t,(function(t){t.vs=cs.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(l,c);var d=function(t,e){var n,r=bs.partition(t,(function(t){return cs.has(t,"barycenter")})),i=r.lhs,o=cs.sortBy(r.rhs,(function(t){return-t.i})),a=[],u=0,s=0,c=0;i.sort((n=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:n?e.i-t.i:t.i-e.i})),c=nc(a,o,c),cs.forEach(i,(function(t){c+=t.vs.length,a.push(t.vs),u+=t.barycenter*t.weight,s+=t.weight,c=nc(a,o,c)}));var f={vs:cs.flatten(a,!0)};return s&&(f.barycenter=u/s,f.weight=s),f}(l,i);if(u&&(d.vs=cs.flatten([u,d.vs,s],!0),e.predecessors(u).length)){var h=e.node(e.predecessors(u)[0]),p=e.node(e.predecessors(s)[0]);cs.has(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+h.order+p.order)/(d.weight+2),d.weight+=2}return d},ic=Cu.Graph,oc=Cu.Graph;function ac(t,e,n){return cs.map(e,(function(e){return function(t,e,n){var r=function(t){for(var e;t.hasNode(e=cs.uniqueId("_root")););return e}(t),i=new ic({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return cs.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||r),cs.forEach(t[n](o),(function(e){var n=e.v===o?e.w:e.v,r=i.edge(n,o),a=cs.isUndefined(r)?0:r.weight;i.setEdge(n,o,{weight:t.edge(e).weight+a})})),cs.has(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),i}(t,e,n)}))}function uc(t,e){var n=new oc;cs.forEach(t,(function(t){var r=t.graph().root,i=rc(t,r,n,e);cs.forEach(i.vs,(function(e,n){t.node(e).order=n})),function(t,e,n){var r,i={};cs.forEach(n,(function(n){for(var o,a,u=t.parent(n);u;){if((o=t.parent(u))?(a=i[o],i[o]=u):(a=r,r=u),a&&a!==u)return void e.setEdge(a,u);u=o}}))}(t,n,i.vs)}))}function sc(t,e){cs.forEach(e,(function(e){cs.forEach(e,(function(e,n){t.node(e).order=n}))}))}var cc=Cu.Graph;function fc(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function lc(t,e,n){if(e>n){var r=e;e=n,n=r}return cs.has(t[e],n)}var dc=bs.normalizeRanks,hc=bs.removeEmptyRanks,pc=bs,vc=Cu.Graph,gc=["nodesep","edgesep","ranksep","marginx","marginy"],yc={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},mc=["acyclicer","ranker","rankdir","align"],bc=["width","height"],_c={width:0,height:0},xc=["minlen","weight","width","height","labeloffset"],wc={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ec=["labelpos"];function Sc(t,e){return cs.mapValues(cs.pick(t,e),Number)}function Ac(t){var e={};return cs.forEach(t,(function(t,n){e[n.toLowerCase()]=t})),e}var Tc=Cu.Graph,Ic={graphlib:Cu,layout:function(t,e){var n=e&&e.debugTiming?pc.time:pc.notime;n("layout",(function(){var e=n(" buildLayoutGraph",(function(){return function(t){var e=new vc({multigraph:!0,compound:!0}),n=Ac(t.graph());return e.setGraph(cs.merge({},yc,Sc(n,gc),cs.pick(n,mc))),cs.forEach(t.nodes(),(function(n){var r=Ac(t.node(n));e.setNode(n,cs.defaults(Sc(r,bc),_c)),e.setParent(n,t.parent(n))})),cs.forEach(t.edges(),(function(n){var r=Ac(t.edge(n));e.setEdge(n,cs.merge({},wc,Sc(r,xc),cs.pick(r,Ec)))})),e}(t)}));n(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,cs.forEach(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){cs.forEach(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){!function(t){var e="greedy"===t.graph().acyclicer?function(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new ps,r=0,i=0;cs.forEach(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),cs.forEach(t.edges(),(function(t){var o=n.edge(t.v,t.w)||0,a=e(t),u=o+a;n.setEdge(t.v,t.w,u),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));var o=cs.range(i+r+3).map((function(){return new fs})),a=r+1;return cs.forEach(n.nodes(),(function(t){ys(o,a,n.node(t))})),{graph:n,buckets:o,zeroIdx:a}}(t,e||vs),r=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.nodeCount();){for(;r=a.dequeue();)gs(t,e,n,r);for(;r=o.dequeue();)gs(t,e,n,r);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(r=e[u].dequeue()){i=i.concat(gs(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return cs.flatten(cs.map(r,(function(e){return t.outEdges(e.v,e.w)})),!0)}(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},r={};return cs.forEach(t.nodes(),(function i(o){cs.has(r,o)||(r[o]=!0,n[o]=!0,cs.forEach(t.outEdges(o),(function(t){cs.has(n,t.w)?e.push(t):i(t.w)})),delete n[o])})),e}(t);cs.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,cs.uniqueId("rev"))}))}(t)})),e(" nestingGraph.run",(function(){qs(t)})),e(" rank",(function(){!function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){Ps(t)}(t);break;case"tight-tree":!function(t){Hs(t),Ts(t)}(t);break;case"longest-path":Xs(t)}}(pc.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};pc.addDummyNode(t,"edge-proxy",i,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){hc(t)})),e(" nestingGraph.cleanup",(function(){!function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,cs.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}(t)})),e(" normalizeRanks",(function(){dc(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;cs.forEach(t.nodes(),(function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=cs.max(e,r.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){cs.forEach(t.nodes(),(function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){!function(t){t.graph().dummyChains=[],cs.forEach(t.edges(),(function(e){!function(t,e){var n,r,i,o=e.v,a=t.node(o).rank,u=e.w,s=t.node(u).rank,c=e.name,f=t.edge(e),l=f.labelRank;if(s!==a+1){for(t.removeEdge(e),i=0,++a;a<s;++i,++a)f.points=[],r={width:0,height:0,edgeLabel:f,edgeObj:e,rank:a},n=bs.addDummyNode(t,"edge",r,"_d"),a===l&&(r.width=f.width,r.height=f.height,r.dummy="edge-label",r.labelpos=f.labelpos),t.setEdge(o,n,{weight:f.weight},c),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,u,{weight:f.weight},c)}}(t,e)}))}(t)})),e(" parentDummyChains",(function(){!function(t){var e=function(t){var e={},n=0;return cs.forEach(t.children(),(function r(i){var o=n;cs.forEach(t.children(i),r),e[i]={low:o,lim:n++}})),e}(t);cs.forEach(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){var i,o,a=[],u=[],s=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>s||c>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)u.push(i);return{path:a.concat(u.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,u=o.lca,s=0,c=a[s],f=!0;n!==i.w;){if(r=t.node(n),f){for(;(c=a[s])!==u&&t.node(c).maxRank<r.rank;)s++;c===u&&(f=!1)}if(!f){for(;s<a.length-1&&t.node(c=a[s+1]).minRank<=r.rank;)s++;c=a[s]}t.setParent(n,c),n=t.successors(n)[0]}}))}(t)})),e(" addBorderSegments",(function(){!function(t){cs.forEach(t.children(),(function e(n){var r=t.children(n),i=t.node(n);if(r.length&&cs.forEach(r,e),cs.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)Ks(t,"borderLeft","_bl",n,i,o),Ks(t,"borderRight","_br",n,i,o)}}))}(t)})),e(" order",(function(){!function(t){var e=bs.maxRank(t),n=ac(t,cs.range(1,e+1),"inEdges"),r=ac(t,cs.range(e-1,-1,-1),"outEdges"),i=function(t){var e={},n=cs.filter(t.nodes(),(function(e){return!t.children(e).length})),r=cs.max(cs.map(n,(function(e){return t.node(e).rank}))),i=cs.map(cs.range(r+1),(function(){return[]})),o=cs.sortBy(n,(function(e){return t.node(e).rank}));return cs.forEach(o,(function n(r){if(!cs.has(e,r)){e[r]=!0;var o=t.node(r);i[o.rank].push(r),cs.forEach(t.successors(r),n)}})),i}(t);sc(t,i);for(var o,a=Number.POSITIVE_INFINITY,u=0,s=0;s<4;++u,++s){uc(u%2?n:r,u%4>=2),i=bs.buildLayerMatrix(t);var c=tc(t,i);c<a&&(s=0,o=cs.cloneDeep(i),a=c)}sc(t,o)}(t)})),e(" insertSelfEdges",(function(){!function(t){var e=pc.buildLayerMatrix(t);cs.forEach(e,(function(e){var n=0;cs.forEach(e,(function(e,r){var i=t.node(e);i.order=r+n,cs.forEach(i.selfEdges,(function(e){pc.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){!function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||Zs(t)}(t)})),e(" position",(function(){!function(t){(function(t){var e=bs.buildLayerMatrix(t),n=t.graph().ranksep,r=0;cs.forEach(e,(function(e){var i=cs.max(cs.map(e,(function(e){return t.node(e).height})));cs.forEach(e,(function(e){t.node(e).y=r+i/2})),r+=i+n}))})(t=bs.asNonCompoundGraph(t)),cs.forEach(function(t){var e,n=bs.buildLayerMatrix(t),r=cs.merge(function(t,e){var n={};return cs.reduce(e,(function(e,r){var i=0,o=0,a=e.length,u=cs.last(r);return cs.forEach(r,(function(e,s){var c=function(t,e){if(t.node(e).dummy)return cs.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),f=c?t.node(c).order:a;(c||e===u)&&(cs.forEach(r.slice(o,s+1),(function(e){cs.forEach(t.predecessors(e),(function(r){var o=t.node(r),a=o.order;!(a<i||f<a)||o.dummy&&t.node(e).dummy||fc(n,r,e)}))})),o=s+1,i=f)})),r})),n}(t,n),function(t,e){var n={};function r(e,r,i,o,a){var u;cs.forEach(cs.range(r,i),(function(r){u=e[r],t.node(u).dummy&&cs.forEach(t.predecessors(u),(function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&fc(n,e,u)}))}))}return cs.reduce(e,(function(e,n){var i,o=-1,a=0;return cs.forEach(n,(function(u,s){if("border"===t.node(u).dummy){var c=t.predecessors(u);c.length&&(i=t.node(c[0]).order,r(n,a,s,o,i),a=s,o=i)}r(n,a,n.length,i,e.length)})),n})),n}(t,n)),i={};cs.forEach(["u","d"],(function(o){e="u"===o?n:cs.values(n).reverse(),cs.forEach(["l","r"],(function(n){"r"===n&&(e=cs.map(e,(function(t){return cs.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),u=function(t,e,n,r){var i={},o={},a={};return cs.forEach(e,(function(t){cs.forEach(t,(function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),cs.forEach(e,(function(t){var e=-1;cs.forEach(t,(function(t){var u=r(t);if(u.length)for(var s=((u=cs.sortBy(u,(function(t){return a[t]}))).length-1)/2,c=Math.floor(s),f=Math.ceil(s);c<=f;++c){var l=u[c];o[t]===t&&e<a[l]&&!lc(n,t,l)&&(o[l]=t,o[t]=i[t]=i[l],e=a[l])}}))})),{root:i,align:o}}(0,e,r,a),s=function(t,e,n,r,i){var o={},a=function(t,e,n,r){var i=new cc,o=t.graph(),a=function(t,e,n){return function(r,i,o){var a,u=r.node(i),s=r.node(o),c=0;if(c+=u.width/2,cs.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(c+=n?a:-a),a=0,c+=(u.dummy?e:t)/2,c+=(s.dummy?e:t)/2,c+=s.width/2,cs.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=s.width/2;break;case"r":a=-s.width/2}return a&&(c+=n?a:-a),a=0,c}}(o.nodesep,o.edgesep,r);return cs.forEach(e,(function(e){var r;cs.forEach(e,(function(e){var o=n[e];if(i.setNode(o),r){var u=n[r],s=i.edge(u,o);i.setEdge(u,o,Math.max(a(t,e,r),s||0))}r=e}))})),i}(t,e,n,i),u=i?"borderLeft":"borderRight";function s(t,e){for(var n=a.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}return s((function(t){o[t]=a.inEdges(t).reduce((function(t,e){return Math.max(t,o[e.v]+a.edge(e))}),0)}),a.predecessors.bind(a)),s((function(e){var n=a.outEdges(e).reduce((function(t,e){return Math.min(t,o[e.w]-a.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(o[e]=Math.max(o[e],n))}),a.successors.bind(a)),cs.forEach(r,(function(t){o[t]=o[n[t]]})),o}(t,e,u.root,u.align,"r"===n);"r"===n&&(s=cs.mapValues(s,(function(t){return-t}))),i[o+n]=s}))}));var o=function(t,e){return cs.minBy(cs.values(e),(function(e){var n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return cs.forIn(e,(function(e,i){var o=function(t,e){return t.node(e).width}(t,i)/2;n=Math.max(e+o,n),r=Math.min(e-o,r)})),n-r}))}(t,i);return function(t,e){var n=cs.values(e),r=cs.min(n),i=cs.max(n);cs.forEach(["u","d"],(function(n){cs.forEach(["l","r"],(function(o){var a,u=n+o,s=t[u];if(s!==e){var c=cs.values(s);(a="l"===o?r-cs.min(c):i-cs.max(c))&&(t[u]=cs.mapValues(s,(function(t){return t+a})))}}))}))}(i,o),function(t,e){return cs.mapValues(t.ul,(function(n,r){if(e)return t[e.toLowerCase()][r];var i=cs.sortBy(cs.map(t,r));return(i[1]+i[2])/2}))}(i,t.graph().align)}(t),(function(e,n){t.node(n).x=e}))}(t)})),e(" positionSelfEdges",(function(){!function(t){cs.forEach(t.nodes(),(function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,u=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){cs.forEach(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(cs.last(n.borderLeft)),a=t.node(cs.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}})),cs.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){!function(t){cs.forEach(t.graph().dummyChains,(function(e){var n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)}))}(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);if(cs.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){!function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){cs.forEach(t.nodes(),(function(e){Js(t.node(e))})),cs.forEach(t.edges(),(function(e){var n=t.edge(e);cs.forEach(n.points,Js),cs.has(n,"y")&&Js(n)}))}(t),"lr"!==e&&"rl"!==e||(function(t){cs.forEach(t.nodes(),(function(e){Qs(t.node(e))})),cs.forEach(t.edges(),(function(e){var n=t.edge(e);cs.forEach(n.points,Qs),cs.has(n,"x")&&Qs(n)}))}(t),Zs(t))}(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,u=o.marginy||0;function s(t){var o=t.x,a=t.y,u=t.width,s=t.height;e=Math.min(e,o-u/2),n=Math.max(n,o+u/2),r=Math.min(r,a-s/2),i=Math.max(i,a+s/2)}cs.forEach(t.nodes(),(function(e){s(t.node(e))})),cs.forEach(t.edges(),(function(e){var n=t.edge(e);cs.has(n,"x")&&s(n)})),e-=a,r-=u,cs.forEach(t.nodes(),(function(n){var i=t.node(n);i.x-=e,i.y-=r})),cs.forEach(t.edges(),(function(n){var i=t.edge(n);cs.forEach(i.points,(function(t){t.x-=e,t.y-=r})),cs.has(i,"x")&&(i.x-=e),cs.has(i,"y")&&(i.y-=r)})),o.width=n-e+a,o.height=i-r+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(pc.intersectRect(o,n)),i.points.push(pc.intersectRect(a,r))}))}(t)})),e(" reversePoints",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){!function(t){cs.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}(t)}))}(e,n)})),n(" updateInputGraph",(function(){!function(t,e){cs.forEach(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),cs.forEach(t.edges(),(function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,cs.has(i,"x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))},debug:{debugOrdering:function(t){var e=bs.buildLayerMatrix(t),n=new Tc({compound:!0,multigraph:!0}).setGraph({});return cs.forEach(t.nodes(),(function(e){n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)})),cs.forEach(t.edges(),(function(t){n.setEdge(t.v,t.w,{},t.name)})),cs.forEach(e,(function(t,e){var r="layer"+e;n.setNode(r,{rank:"same"}),cs.reduce(t,(function(t,e){return n.setEdge(t,e,{style:"invis"}),e}))})),n}},util:{time:bs.time,notime:bs.notime},version:"0.8.5"},Nc=Ic.graphlib,Oc=Ic.layout;class Cc{constructor(t){this.cardinality=1,this.include=dr.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=lr.NODE,this.name=t.name,this.attr=t.attr||{},this.inputs=t.inputs,this.path=t.path||[],this.width=t.width,this.height=t.height}}class kc{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}class Dc{constructor(t,e={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=dr.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=lr.META,this.path=[],this.name=t,this.metaGraph=Gc(t,hr.META,e)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map((t=>this.metaGraph.node(t)))}leaves(){let t,e=[],n=[this];for(;n.length;){let r=n.shift();r.isGroupNode?(t=r.metaGraph,t.nodes().forEach((e=>n.push(t.node(e))))):e.push(r.name)}return e}}class Mc{constructor(t,e){this.v=t,this.w=e,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(t,e){this.baseEdgeList.push(t)}}function Rc(t,e={}){return new Dc(t,e)}function Pc(t,e){return new Mc(t,e)}function Gc(t,e,n){const r=n||{},i=new Nc.Graph(r);return i.setGraph({name:t,rankdir:r.rankdir,type:e,align:r.align}),i}class Lc{constructor(t={}){this.graphOptions=t,this.index={},this.graphOptions.compound=!0,this.root=Rc(cr,this.graphOptions),this.index[cr]=this.root}getNodeMap(){return this.index}node(t){return this.index[t]}setNode(t,e){this.index[t]=e}getBridgeGraph(t){const e=this.index[t];if(!e)throw Error("Could not find node in hierarchy: "+t);if(!("metaGraph"in e))return null;const n=e;if(n.bridgeGraph)return n.bridgeGraph;const r=Gc(fr,hr.BRIDGE,this.graphOptions);if(n.bridgeGraph=r,!e.parentNode||!("metaGraph"in e.parentNode))return r;const i=e.parentNode;return[i.metaGraph,this.getBridgeGraph(i.name)].forEach((e=>{e.edges().filter((e=>e.v===t||e.w===t)).forEach((n=>{const i=n.w===t;e.edge(n).baseEdgeList.forEach((e=>{const[o,a]=i?[e.w,n.v]:[e.v,n.w],u=this.getChildName(t,o),s={v:i?a:u,w:i?u:a};let c=r.edge(s);c||(c=Pc(s.v,s.w),c.inbound=i,r.setEdge(s.v,s.w,c)),c.addBaseEdge(e,this)}))}))})),r}getChildName(t,e){let n=this.index[e];for(;n;){if(n.parentNode&&n.parentNode.name===t)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+e)}getPredecessors(t){const e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!0)}getSuccessors(t){const e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!1)}getOneWayEdges(t,e){const n=[];if(!t.parentNode||!t.parentNode.isGroupNode)return n;const r=t.parentNode,i=r.metaGraph,o=this.getBridgeGraph(r.name);return jc(i,t,e,n),jc(o,t,e,n),n}}function jc(t,e,n,r){(n?t.inEdges(e.name):t.outEdges(e.name)).forEach((e=>{const n=t.edge(e);r.push(n)}))}class Fc{constructor(t){this.hierarchy=t,this.index={},this.hasSubHierarchy={},this.root=new zc(this.hierarchy.root,this.hierarchy.graphOptions),this.index[t.root.name]=this.root,this.buildSubHierarchy(t.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(t){if(t in this.hasSubHierarchy)return;this.hasSubHierarchy[t]=!0;const e=this.index[t];if(e.node.type!==lr.META)return;const n=e,r=n.node.metaGraph,i=n.coreGraph;r.nodes().forEach((t=>{const e=this.getOrCreateRenderNodeByName(t);i.setNode(t,e)})),r.edges().forEach((t=>{const e=r.edge(t),n=new Bc(e);i.setEdge(t.v,t.w,n)}));const o=n.node.parentNode;if(!o)return;const a=this.getRenderNodeByName(o.name),u=(t,...e)=>e.concat([t?"IN":"OUT"]).join("~~"),s=this.hierarchy.getBridgeGraph(t);s.edges().forEach((e=>{const n=s.edge(e),c=!!r.node(e.w),[f,l]=c?[e.w,e.v]:[e.v,e.w],d=e=>{const n=c?{v:e,w:t}:{v:t,w:e};return a.coreGraph.edge(n)};let h=d(l);h||(h=d(u(c,l,o.name)));const p=u(c,t),v=u(c,l,t);let g=i.node(v);if(!g){let t=i.node(p);if(!t){const e={name:p,type:lr.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:dr.UNSPECIFIED,inbound:c,attr:{}};t=new Uc(e),this.index[p]=t,i.setNode(p,t)}const e={name:v,type:lr.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:dr.UNSPECIFIED,inbound:c,attr:{}};g=new Uc(e),this.index[v]=g,i.setNode(v,g),i.setParent(v,p),t.node.cardinality++}const y=new Bc(n);y.adjoiningMetaEdge=h,c?i.setEdge(v,f,y):i.setEdge(f,v,y)}))}getOrCreateRenderNodeByName(t){if(!t)return null;if(t in this.index)return this.index[t];const e=this.getNodeByName(t);return e?(this.index[t]=e.isGroupNode?new zc(e,this.hierarchy.graphOptions):new Uc(e),this.index[t]):null}getRenderNodeByName(t){return this.index[t]}getNodeByName(t){return this.hierarchy.node(t)}}class Uc{constructor(t){this.node=t,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=t.width||0,this.height=t.height||0,this.displayName=t.name,this.attr=t.attr}}class Bc{constructor(t){this.metaEdge=t,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class zc extends Uc{constructor(t,e){super(t);const n=t.metaGraph.graph();e.compound=!0,this.coreGraph=Gc(n.name,hr.CORE,e)}}function Vc(t,e){t.node.isGroupNode&&function(t,e){const n=ur(e);t.coreGraph.nodes().map((e=>t.coreGraph.node(e))).forEach((t=>{var r,i,o,a,u,s;const{height:c,width:f}=t;switch(t.node.type){case lr.NODE:Object.assign(t,n.nodeSize.node),t.height=c||n.nodeSize.node.height,t.width=f||n.nodeSize.node.width;break;case lr.BRIDGE:Object.assign(t,n.nodeSize.bridge);break;case lr.META:t.expanded?Vc(t,e):(Object.assign(t,n.nodeSize.meta),t.height=n.nodeSize.meta.height,t.width=n.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+t.node.type)}if(!t.expanded){const n=t.attr;!function(t,e=!1){if(t.coreBox.width=t.width,t.coreBox.height=t.height,!e){const e=`${t.displayName}`.length,n=3;t.width=Math.max(t.coreBox.width,e*n)}}(t,e&&(0===t.node.type&&!!(null===(i=null===(r=null==e?void 0:e.nodeSize)||void 0===r?void 0:r.meta)||void 0===i?void 0:i.width)||1===t.node.type&&(!!(null===(a=null===(o=null==e?void 0:e.nodeSize)||void 0===o?void 0:o.node)||void 0===a?void 0:a.width)||!!n.width)||2===t.node.type&&!!(null===(s=null===(u=null==e?void 0:e.nodeSize)||void 0===u?void 0:u.bridge)||void 0===s?void 0:s.width)))}}))}(t,e),t.node.type===lr.META&&function(t,e){const n=ur(e),r=n.subScene.meta;Object.assign(t,r);const{nodeSep:i,rankSep:o,edgeSep:a,align:u}=n.graph.meta,s={nodesep:i,ranksep:o,edgesep:a,align:u};Object.assign(t.coreBox,function(t,e){const{ranksep:n,nodesep:r,edgesep:i,align:o}=e;Object.assign(t.graph(),{ranksep:n,nodesep:r,edgesep:i,align:o});const a=[];if(t.nodes().forEach((e=>{t.node(e).node.type!==lr.BRIDGE&&a.push(e)})),!a.length)return{width:0,height:0};Oc(t);let u=1/0,s=1/0,c=-1/0,f=-1/0;return a.forEach((e=>{const n=t.node(e),r=.5*n.width,i=n.x-r,o=n.x+r;u=i<u?i:u,c=o>c?o:c;const a=.5*n.height,l=n.y-a,d=n.y+a;s=l<s?l:s,f=d>f?d:f})),t.edges().forEach((e=>{const n=t.edge(e),r=t.node(n.metaEdge.v),i=t.node(n.metaEdge.w);if(3===n.points.length&&function(t){let e=Wc(t[0],t[1]);for(let n=1;n<t.length-1;n++){const r=Wc(t[n],t[n+1]);if(Math.abs(r-e)>1)return!1;e=r}return!0}(n.points)){if(null!=r){const t=r.expanded?r.x:Hc(r);n.points[0].x=t}if(null!=i){const t=i.expanded?i.x:Hc(i);n.points[2].x=t}n.points=[n.points[0],n.points[1]]}const o=n.points[n.points.length-2];null!=i&&(n.points[n.points.length-1]=Xc(o,i));const a=n.points[1];null!=r&&(n.points[0]=Xc(a,r)),n.points.forEach((t=>{u=t.x<u?t.x:u,c=t.x>c?t.x:c,s=t.y<s?t.y:s,f=t.y>f?t.y:f}))})),t.nodes().forEach((e=>{const n=t.node(e);n.x-=u,n.y-=s})),t.edges().forEach((e=>{t.edge(e).points.forEach((t=>{t.x-=u,t.y-=s}))})),{width:c-u,height:f-s}}(t.coreGraph,s));let c=0;t.coreGraph.nodeCount()>0&&c++;const f=c<=1?0:c;t.coreBox.width+=f+f,t.coreBox.height=r.labelHeight+t.coreBox.height,t.width=t.coreBox.width+r.paddingLeft+r.paddingRight,t.height=t.paddingTop+t.coreBox.height+t.paddingBottom}(t,e)}function Wc(t,e){const n=e.x-t.x,r=e.y-t.y;return 180*Math.atan(r/n)/Math.PI}function Hc(t){return t.expanded?t.x:t.x-t.width/2+0+t.coreBox.width/2}function Xc(t,e){const n=e.expanded?e.x:Hc(e),r=e.y,i=t.x-n,o=t.y-r;let a,u,s=e.expanded?e.width:e.coreBox.width,c=e.expanded?e.height:e.coreBox.height;return Math.abs(o)*s/2>Math.abs(i)*c/2?(o<0&&(c=-c),a=0===o?0:c/2*i/o,u=c/2):(i<0&&(s=-s),a=s/2,u=0===i?0:s/2*o/i),{x:n+a,y:r+u}}function qc(t,e,n){var r,i,o,a;const u=t.nodes.filter(((t,e,n)=>n.findIndex((e=>e.id===t.id))!==e)).map((t=>t.id));if(u.length)throw new Error(`Duplicated ids found: ${u.join(", ")}`);const s=function(t){const e={nodes:[]},n=t.compound,r=Object.keys(n||{}),i=new Map,o=(t,e=[])=>{if(i.has(t))return i.get(t);for(let i=0;i<r.length;i++){let a=r[i];if(n&&-1!==n[a].indexOf(t))return e.unshift(a),o(a,e)}return 0===e.length&&i.set(t,e),e},a=e=>t.edges.filter((t=>t.w===e)).map((t=>({name:t.v})));return t.nodes.forEach((t=>{const n=t.id,r=[...o(n),n];let i=a(n);e.nodes.push({name:n,path:r,inputs:i,width:t.width,height:t.height,attr:Object.assign({},t)})})),e}(t),c=function(t,e){const n=(t,e)=>{for(let n of e.values())if(n.includes(t))return!0;return!1},r=(t,e=[])=>{if(0===Object.keys(t).length)return[...new Set(e)];const i=new Map(Object.keys(t).map((e=>[e,t[e]]))),o={};for(let[t,r]of i)n(t,i)?o[t]=r:e=e.concat(t,r);return r(o,e)};return r(t).filter((t=>e.includes(t)))}(t.compound||{},(null==e?void 0:e.expanded)||[]),f=function(t,e){return function(t){return new Fc(t)}(function(t,e){const{rankDirection:n,align:r}=e,i=new Lc({rankdir:n,align:r});return function(t,e){Object.keys(e.nodes).forEach((n=>{const r=e.nodes[n],i=r.path;let o=t.root;o.depth=Math.max(i.length,o.depth);for(let e=0;e<i.length&&(o.depth=Math.max(o.depth,i.length-e),o.cardinality+=r.cardinality,e!==i.length-1);e++){const n=i[e];let a=t.node(n);a||(a=Rc(n,t.graphOptions),a.path=r.path.slice(0,e+1),a.parentNode=o,t.setNode(n,a),o.metaGraph.setNode(n,a)),o=a}t.setNode(r.name,r),r.parentNode=o,o.metaGraph.setNode(r.name,r)}))}(i,t),function(t,e){const n=t.getNodeMap();let r=[],i=[];const o=(t,e)=>{let n=0;for(;t;)e[n++]=t.name,t=t.parentNode;return n-1};e.edges.forEach((a=>{r=[],i=[];let u=o(e.nodes[a.v],r),s=o(e.nodes[a.w],i);for(;r[u]===i[s];)if(u--,s--,u<0||s<0)throw Error("No difference found between ancestor paths.");const c=n[r[u+1]],f=r[u],l=i[s];let d=c.metaGraph.edge(f,l);d||(d=Pc(f,l),c.metaGraph.setEdge(f,l,d)),d.addBaseEdge(a,t)}))}(i,t),i}(function(t){const e=new kc;return t.nodes.map((t=>new Cc(t))).forEach((t=>{e.nodes[t.name]=t,t.inputs.forEach((n=>{!function(t,e,n){n.name!==e.name&&t.edges.push(Object.assign(Object.assign({},n.attr),{v:n.name,w:e.name}))}(e,t,n)}))})),e}(t),e))}(s,{rankDirection:(null===(i=null===(r=null==n?void 0:n.graph)||void 0===r?void 0:r.meta)||void 0===i?void 0:i.rankDir)||(null==e?void 0:e.rankDirection)||ar.graph.meta.rankDir,align:(null===(a=null===(o=null==n?void 0:n.graph)||void 0===o?void 0:o.meta)||void 0===a?void 0:a.align)||ar.graph.meta.align});return function(t,e){e.forEach((e=>{const n=t.getRenderInfoNodes().find((t=>t.displayName===e));let r=n&&n.node&&n.node.name||"";const i=t.getRenderNodeByName(r);if(!i)throw new Error(`No nodes found: ${r}`);i.expanded=!0,t.buildSubHierarchy(r)}))}(f,c),Vc(f.root,n),Kc(f.root)}function Yc(t,e,n,r){var i,o;let a=[];const u=(null===(i=n.find((e=>e.id===t)))||void 0===i?void 0:i.path)||[],s=(null===(o=n.find((t=>t.id===e)))||void 0===o?void 0:o.path)||[],c=[cr,...u].slice(0,u.length).reverse(),f=[cr,...s].slice(0,s.length);return c.forEach((i=>{const o=n.find((t=>t.id===i));a=a.concat(o.edges.filter((n=>n.baseEdgeList.some((n=>n.v===((null==r?void 0:r.v)||t)&&n.w===((null==r?void 0:r.w)||e))))))})),f.filter((t=>!c.includes(t))).forEach((i=>{const o=n.find((t=>t.id===i));a=a.concat(o.edges.filter((n=>n.baseEdgeList.some((n=>n.v===((null==r?void 0:r.v)||t)&&n.w===((null==r?void 0:r.w)||e))))))})),a}function Kc(t){const e=t.coreGraph.nodes().map((e=>t.coreGraph.node(e)));return Object.assign(Object.assign({},Zc(t)),{expanded:t.expanded,nodes:t.expanded?(n=e,n.map((t=>t.node.type===lr.META?Kc(t):Zc(t)))):[],edges:t.expanded?$c(t):[]});var n}function Zc(t){return{id:t.node.name,name:t.node.name,type:t.node.type,cardinality:t.node.cardinality,attr:t.attr,parentNodeName:t.node.parentNode?t.node.parentNode.name:null,coreBox:Object.assign({},t.coreBox),x:t.x,y:t.y,width:t.width,height:t.height,radius:t.radius,labelHeight:t.labelHeight,labelOffset:t.labelOffset,outboxWidth:t.outboxWidth,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom,path:t.node.path}}function $c(t){return t.coreGraph.edges().map((e=>({renderInfoEdge:t.coreGraph.edge(e),edge:e}))).filter((({renderInfoEdge:t})=>t.metaEdge)).map((({edge:e,renderInfoEdge:n})=>{const r=function(t,e){const n=e.points.map((t=>Object.assign({},t)));if(e.adjoiningMetaEdge){const r=e.adjoiningMetaEdge.points,i=e.metaEdge.inbound,o=i?r[r.length-1]:r[0],a=n[i?0:n.length-1],u=t.x-t.width/2,s=t.y-t.height/2,c=o.x-u,f=o.y-s,l=-t.paddingLeft,d=-(t.paddingTop+t.labelHeight);a.x=c+l,a.y=f+d}return n}(t,n);return{adjoiningEdge:n.adjoiningMetaEdge?{w:n.adjoiningMetaEdge.metaEdge.w,v:n.adjoiningMetaEdge.metaEdge.v}:null,inbound:n.metaEdge.inbound,w:e.w,v:e.v,points:r,weight:n.weight,baseEdgeList:n.metaEdge.baseEdgeList,parentNodeName:t.node.name}}))}var Jc=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qc=function(){return Qc=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},Qc.apply(this,arguments)},tf=function(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)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},ef=function(t){function e(e){var n=t.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.edgesep=5,n.ranksep=50,n.controlPoints=!0,n.anchorPoint=!0,n.nodes=[],n.edges=[],n.combos=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return Jc(e,t),e.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,begin:void 0,nodeSize:void 0,nodesep:50,ranksep:50,controlPoints:!0,anchorPoint:!0}},e.prototype.init=function(t){var e=t.hiddenNodes||[],n=t.hiddenEdges||[],r=t.hiddenCombos||[];this.nodes=this.getDataByOrder((t.nodes||[]).concat(e)),this.edges=this.getDataByOrder((t.edges||[]).concat(n)),this.combos=(t.combos||[]).concat(r.map((function(t){return Qc(Qc({},t),{collapsed:!0})})))},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges;if(e){var r=t.getLayoutConfig(),i=function(t,e=!1){const n=JSON.parse(JSON.stringify(t)),r={nodes:[n],edges:[...n.edges]};return n.nodes.forEach((function t(e){(0===e.type||1===e.type)&&r.nodes.push(e),0===e.type&&(r.edges=r.edges.concat(e.edges)),Array.isArray(e.nodes)&&e.nodes.forEach(t)})),e&&r.nodes.forEach((t=>{const e=r.nodes.find((e=>e.id===t.parentNodeName));if(e){const n=e.x-e.width/2+e.paddingLeft,r=e.y-e.height/2+e.labelHeight+e.paddingTop;e.id!==cr&&(t.x+=n,t.y+=r),0===t.type&&t.edges.forEach((e=>{e.points.forEach((e=>{e.x+=t.x-t.width/2+t.paddingLeft,e.y+=t.y-t.height/2+t.labelHeight+t.paddingTop}))}))}})),r}(qc(r.graphDef,r.graphOption,r.graphSettings),!0);return this.updatePosition(i),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:n}}},e.prototype.getNodePath=function(t){var e=this.nodes,n=this.combos,r=e.find((function(e){return e.id===t}));return r&&r.comboId?function t(e,r){void 0===r&&(r=[]);var i=n.find((function(t){return t.id===e}));return i?(r.unshift(e),i.parentId?t(i.parentId,r):r):r}(r.comboId,[t]):[t]},e.prototype.getLayoutConfig=function(){var t,e,n,r,o=this,a=o.nodes,u=o.edges,s=o.combos,c=o.nodeSize,l=o.rankdir,d=o.align,h=o.edgesep,p=o.nodesep,v=o.ranksep,g=o.settings,y=(s||[]).reduce((function(t,e){var n=a.filter((function(t){return t.comboId===e.id})).map((function(t){return t.id})),r=(s||[]).filter((function(t){return t.parentId===e.id})).map((function(t){return t.id}));return(n.length||r.length)&&(t[e.id]=tf(tf([],n,!0),r,!0)),t}),{});r=c?i(c)?function(){return c}:function(){return[c,c]}:function(t){return t&&t.size?i(t.size)?t.size:f(t.size)?[t.size.width||40,t.size.height||40]:[t.size,t.size]:[40,40]};var m=function(t){return t&&t.size?i(t.size)?t.size:[t.size,t.size]:[80,40]}(null==s?void 0:s[0]),b=m[0],_=m[1],x=null===(e=null===(t=o.graphSettings)||void 0===t?void 0:t.subScene)||void 0===e?void 0:e.meta,w=(null===(n=s.find((function(t){return!t.collapsed})))||void 0===n?void 0:n.padding)||[20,20,20,20],E=w[0],S=w[1],A=w[2],T=w[3],I={compound:y,nodes:tf([],(a||[]).map((function(t){var e=r(t),n=e[0],i=e[1];return Qc(Qc({},t),{width:n,height:i})})),!0),edges:tf([],(u||[]).map((function(t){return Qc(Qc({},t),{v:t.source,w:t.target})})),!0)},N={expanded:(s||[]).filter((function(t){return!t.collapsed})).map((function(t){return t.id}))},O={graph:{meta:{align:d,rankDir:l,nodeSep:p,edgeSep:h,rankSep:v}},subScene:{meta:{paddingTop:E||(null==x?void 0:x.paddingTop)||20,paddingRight:S||(null==x?void 0:x.paddingRight)||20,paddingBottom:A||(null==x?void 0:x.paddingBottom)||20,paddingLeft:T||(null==x?void 0:x.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:b,height:_}}},C=ur(g,Qc({},ur(O,ar)));return o.graphSettings=C,{graphDef:I,graphOption:N,graphSettings:C}},e.prototype.updatePosition=function(t){var e=t.nodes,n=t.edges;this.updateNodePosition(e,n),this.updateEdgePosition(e,n)},e.prototype.getBegin=function(t,e){var n=this.begin,r=[0,0];if(n){var i=1/0,o=1/0;t.forEach((function(t){i>t.x&&(i=t.x),o>t.y&&(o=t.y)})),e.forEach((function(t){t.points.forEach((function(t){i>t.x&&(i=t.x),o>t.y&&(o=t.y)}))})),r[0]=n[0]-i,r[1]=n[1]-o}return r},e.prototype.updateNodePosition=function(t,e){var n=this,r=n.combos,i=n.nodes,o=n.edges,a=n.anchorPoint,u=n.graphSettings,s=this.getBegin(t,e);t.forEach((function(t){var n,c=t.x,f=t.y,l=t.id,d=t.type,h=t.coreBox;if(d===pr.META&&l!==cr){var p=r.findIndex((function(t){return t.id===l})),v=null===(n=null==u?void 0:u.subScene)||void 0===n?void 0:n.meta;r[p].offsetX=c+s[0],r[p].offsetY=f+s[1],r[p].fixSize=[h.width,h.height],r[p].fixCollapseSize=[h.width,h.height],t.expanded?r[p].padding=[null==v?void 0:v.paddingTop,null==v?void 0:v.paddingRight,null==v?void 0:v.paddingBottom,null==v?void 0:v.paddingLeft]:r[p].padding=[0,0,0,0]}else if(d===pr.OP&&(p=i.findIndex((function(t){return t.id===l})),i[p].x=c+s[0],i[p].y=f+s[1],a)){var g=[],y=e.filter((function(t){return t.v===l})),m=e.filter((function(t){return t.w===l}));y.length>0&&y.forEach((function(e){var n=e.points[0],r=(n.x-c)/t.width+.5,i=(n.y-f)/t.height+.5;g.push([r,i]),e.baseEdgeList.forEach((function(t){var e=o.find((function(e){return e.source===t.v&&e.target===t.w}));e&&(e.sourceAnchor=g.length-1)}))})),m.length>0&&m.forEach((function(e){var n=e.points[e.points.length-1],r=(n.x-c)/t.width+.5,i=(n.y-f)/t.height+.5;g.push([r,i]),e.baseEdgeList.forEach((function(t){var e=o.find((function(e){return e.source===t.v&&e.target===t.w}));e&&(e.targetAnchor=g.length-1)}))})),i[p].anchorPoints=g.length>0?g:i[p].anchorPoints||[]}}))},e.prototype.updateEdgePosition=function(t,e){var n=this,r=n.combos,i=n.edges,o=n.controlPoints,a=this.getBegin(t,e);o&&(r.forEach((function(t){t.inEdges=[],t.outEdges=[]})),i.forEach((function(e){var i,o,u,s,c=t.find((function(t){return t.id===e.source})),f=t.find((function(t){return t.id===e.target})),l=[],d=[];if(c&&f)d=Yc(null==c?void 0:c.id,null==f?void 0:f.id,t);else if(!c||!f){var h=n.getNodePath(e.source),p=n.getNodePath(e.target),v=h.reverse().slice(c?0:1).find((function(e){return t.find((function(t){return t.id===e}))})),g=p.reverse().slice(f?0:1).find((function(e){return t.find((function(t){return t.id===e}))}));c=t.find((function(t){return t.id===v})),f=t.find((function(t){return t.id===g})),d=Yc(null==c?void 0:c.id,null==f?void 0:f.id,t,{v:e.source,w:e.target})}if(l=(l=d.reduce((function(t,e){return tf(tf([],t,!0),e.points.map((function(t){return Qc(Qc({},t),{x:t.x+a[0],y:t.y+a[1]})})),!0)}),[])).slice(1,-1),e.controlPoints=l,(null==f?void 0:f.type)===lr.META){var y=r.findIndex((function(t){return t.id===(null==f?void 0:f.id)}));if(!r[y]||(null===(i=r[y].inEdges)||void 0===i?void 0:i.some((function(t){return t.source===c.id&&t.target===f.id}))))return;null===(o=r[y].inEdges)||void 0===o||o.push({source:c.id,target:f.id,controlPoints:l})}if((null==c?void 0:c.type)===lr.META){if(y=r.findIndex((function(t){return t.id===(null==c?void 0:c.id)})),!r[y]||(null===(u=r[y].outEdges)||void 0===u?void 0:u.some((function(t){return t.source===c.id&&t.target===f.id}))))return;null===(s=r[y].outEdges)||void 0===s||s.push({source:c.id,target:f.id,controlPoints:l})}})))},e.prototype.getType=function(){return"dagreCompound"},e.prototype.getDataByOrder=function(t){return t.every((function(t){return void 0!==t.layoutOrder}))||t.forEach((function(t,e){t.layoutOrder=e})),t.sort((function(t,e){return t.layoutOrder-e.layoutOrder}))},e}(t);const nf=Object.prototype.toString;function rf(t){return nf.call(t).endsWith("Array]")}function of(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!rf(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],u=r+1;u<o;u++)t[u]>a&&(a=t[u]);return a}function af(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!rf(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],u=r+1;u<o;u++)t[u]<a&&(a=t[u]);return a}function uf(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!rf(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!rf(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=af(t),i=of(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,a=void 0===o?n.autoMinMax?r:0:o,u=n.max,s=void 0===u?n.autoMinMax?i:1:u;if(a>=s)throw new RangeError("min option must be smaller than max option");for(var c=(s-a)/(i-r),f=0;f<t.length;f++)e[f]=(t[f]-r)*c+a;return e}const sf=" ".repeat(2),cf=" ".repeat(4);function ff(t,e={}){const{maxRows:n=15,maxColumns:r=10,maxNumSize:i=8,padMinus:o="auto"}=e;return`${t.constructor.name} {\n${sf}[\n${cf}${function(t,e,n,r,i){const{rows:o,columns:a}=t,u=Math.min(o,e),s=Math.min(a,n),c=[];if("auto"===i){i=!1;t:for(let e=0;e<u;e++)for(let n=0;n<s;n++)if(t.get(e,n)<0){i=!0;break t}}for(let e=0;e<u;e++){let n=[];for(let o=0;o<s;o++)n.push(lf(t.get(e,o),r,i));c.push(`${n.join(" ")}`)}return s!==a&&(c[c.length-1]+=` ... ${a-n} more columns`),u!==o&&c.push(`... ${o-e} more rows`),c.join(`\n${cf}`)}(t,n,r,i,o)}\n${sf}]\n${sf}rows: ${t.rows}\n${sf}columns: ${t.columns}\n}`}function lf(t,e,n){return(t>=0&&n?` ${df(t,e-1)}`:df(t,e)).padEnd(e)}function df(t,e){let n=t.toString();if(n.length<=e)return n;let r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function hf(t,e,n){let r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function pf(t,e,n){let r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function vf(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function gf(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function yf(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(bf("startRow",e),bf("endRow",n),bf("startColumn",r),bf("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function mf(t,e=0){let n=[];for(let r=0;r<t;r++)n.push(e);return n}function bf(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function _f(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class xf{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let r=new Ef(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.set(i,t,n[i*e+t]);return r}static rowVector(t){let e=new Ef(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new Ef(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new Ef(t,e)}static ones(t,e){return new Ef(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:r=Math.random}=n;let i=new Ef(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.set(n,t,r());return i}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:r=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(r>=i)throw new RangeError("min must be smaller than max");let a=i-r,u=new Ef(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=r+Math.round(o()*a);u.set(n,t,e)}return u}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let r=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<r;t++)i.set(t,t,n);return i}static diag(t,e,n){let r=t.length;void 0===e&&(e=r),void 0===n&&(n=e);let i=Math.min(r,e,n),o=this.zeros(e,n);for(let e=0;e<i;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new Ef(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new this(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return i}static checkMatrix(t){return xf.isMatrix(t)?t:new Ef(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let r=e;for(let i=e;i<t.rows;i++)t.get(i,n)>t.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);let i=t.get(e,n);for(let r=n;r<t.columns;r++)t.set(e,r,t.get(e,r)/i);for(let r=e+1;r<t.rows;r++){let i=t.get(r,n)/t.get(e,n);t.set(r,n,0);for(let o=n+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*i)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,r=n-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let i=0,o=!1;for(;i<n&&!1===o;)1===t.get(r,i)?o=!0:i++;for(let n=0;n<r;n++){let o=t.get(n,i);for(let a=i;a<e;a++){let e=t.get(n,a)-o*t.get(r,a);t.set(n,a,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let r=new Ef(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){hf(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return Ef.rowVector(this.getRow(t))}setRow(t,e){hf(this,t),e=vf(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){hf(this,t),hf(this,e);for(let n=0;n<this.columns;n++){let r=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,r)}return this}getColumn(t){pf(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return Ef.columnVector(this.getColumn(t))}setColumn(t,e){pf(this,t),e=gf(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){pf(this,t),pf(this,e);for(let n=0;n<this.rows;n++){let r=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,r)}return this}addRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=vf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=gf(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){hf(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){pf(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){_f(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)>t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){_f(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)<t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}maxRow(t){if(hf(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){hf(this,t),_f(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),n[1]=r);return n}minRow(t){if(hf(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){hf(this,t),_f(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),n[1]=r);return n}maxColumn(t){if(pf(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){pf(this,t),_f(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),n[0]=r);return n}minColumn(t){if(pf(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){pf(this,t),_f(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),n[0]=r);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n)*this.get(t,n);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){xf.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}mmul(t){t=Ef.checkMatrix(t);let e=this.rows,n=this.columns,r=t.columns,i=new Ef(e,r),o=new Float64Array(n);for(let a=0;a<r;a++){for(let e=0;e<n;e++)o[e]=t.get(e,a);for(let t=0;t<e;t++){let e=0;for(let r=0;r<n;r++)e+=this.get(t,r)*o[r];i.set(t,a,e)}}return i}strassen2x2(t){t=Ef.checkMatrix(t);let e=new Ef(2,2);const n=this.get(0,0),r=t.get(0,0),i=this.get(0,1),o=t.get(0,1),a=this.get(1,0),u=t.get(1,0),s=this.get(1,1),c=t.get(1,1),f=(n+s)*(r+c),l=(a+s)*r,d=n*(o-c),h=s*(u-r),p=(n+i)*c,v=f+h-p+(i-s)*(u+c),g=d+p,y=l+h,m=f-l+d+(a-n)*(r+o);return e.set(0,0,v),e.set(0,1,g),e.set(1,0,y),e.set(1,1,m),e}strassen3x3(t){t=Ef.checkMatrix(t);let e=new Ef(3,3);const n=this.get(0,0),r=this.get(0,1),i=this.get(0,2),o=this.get(1,0),a=this.get(1,1),u=this.get(1,2),s=this.get(2,0),c=this.get(2,1),f=this.get(2,2),l=t.get(0,0),d=t.get(0,1),h=t.get(0,2),p=t.get(1,0),v=t.get(1,1),g=t.get(1,2),y=t.get(2,0),m=t.get(2,1),b=t.get(2,2),_=(n-o)*(-d+v),x=(-n+o+a)*(l-d+v),w=(o+a)*(-l+d),E=n*l,S=(-n+s+c)*(l-h+g),A=(-n+s)*(h-g),T=(s+c)*(-l+h),I=(-i+c+f)*(v+y-m),N=(i-f)*(v-m),O=i*y,C=(c+f)*(-y+m),k=(-i+a+u)*(g+y-b),D=(i-u)*(g-b),M=(a+u)*(-y+b),R=E+O+r*p,P=(n+r+i-o-a-c-f)*v+x+w+E+I+O+C,G=E+S+T+(n+r+i-a-u-s-c)*g+O+k+M,L=_+a*(-l+d+p-v-g-y+b)+x+E+O+k+D,j=_+x+w+E+u*m,F=O+k+D+M+o*h,U=E+S+A+c*(-l+h+p-v-g-y+m)+I+N+O,B=I+N+O+C+s*d,z=E+S+A+T+f*b;return e.set(0,0,R),e.set(0,1,P),e.set(0,2,G),e.set(1,0,L),e.set(1,1,j),e.set(1,2,F),e.set(2,0,U),e.set(2,1,B),e.set(2,2,z),e}mmulStrassen(t){t=Ef.checkMatrix(t);let e=this.clone(),n=e.rows,r=e.columns,i=t.rows,o=t.columns;function a(t,e,n){let r=t.rows,i=t.columns;if(r===e&&i===n)return t;{let r=xf.zeros(e,n);return r=r.setSubMatrix(t,0,0),r}}r!==i&&console.warn(`Multiplying ${n} x ${r} and ${i} x ${o} matrix: dimensions do not match.`);let u=Math.max(n,i),s=Math.max(r,o);return e=a(e,u,s),function t(e,n,r,i){if(r<=512||i<=512)return e.mmul(n);r%2==1&&i%2==1?(e=a(e,r+1,i+1),n=a(n,r+1,i+1)):r%2==1?(e=a(e,r+1,i),n=a(n,r+1,i)):i%2==1&&(e=a(e,r,i+1),n=a(n,r,i+1));let o=parseInt(e.rows/2,10),u=parseInt(e.columns/2,10),s=e.subMatrix(0,o-1,0,u-1),c=n.subMatrix(0,o-1,0,u-1),f=e.subMatrix(0,o-1,u,e.columns-1),l=n.subMatrix(0,o-1,u,n.columns-1),d=e.subMatrix(o,e.rows-1,0,u-1),h=n.subMatrix(o,n.rows-1,0,u-1),p=e.subMatrix(o,e.rows-1,u,e.columns-1),v=n.subMatrix(o,n.rows-1,u,n.columns-1),g=t(xf.add(s,p),xf.add(c,v),o,u),y=t(xf.add(d,p),c,o,u),m=t(s,xf.sub(l,v),o,u),b=t(p,xf.sub(h,c),o,u),_=t(xf.add(s,f),v,o,u),x=t(xf.sub(d,s),xf.add(c,l),o,u),w=t(xf.sub(f,p),xf.add(h,v),o,u),E=xf.add(g,b);E.sub(_),E.add(w);let S=xf.add(m,_),A=xf.add(y,b),T=xf.sub(g,y);T.add(m),T.add(x);let I=xf.zeros(2*E.rows,2*E.columns);return I=I.setSubMatrix(E,0,0),I=I.setSubMatrix(S,E.rows,0),I=I.setSubMatrix(A,0,E.columns),I=I.setSubMatrix(T,E.rows,E.columns),I.subMatrix(0,r-1,0,i-1)}(e,t=a(t,u,s),u,s)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Ef(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&uf(i,{min:e,max:n,output:i}),r.setRow(t,i)}return r}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Ef(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&uf(i,{min:e,max:n,output:i}),r.setColumn(t,i)}return r}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),r=this.get(e,this.columns-1-n);this.set(e,n,r),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),r=this.get(this.rows-1-n,e);this.set(n,e,r),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=Ef.checkMatrix(t);let e=this.rows,n=this.columns,r=t.rows,i=t.columns,o=new Ef(e*r,n*i);for(let a=0;a<e;a++)for(let e=0;e<n;e++)for(let n=0;n<r;n++)for(let u=0;u<i;u++)o.set(r*a+n,i*e+u,this.get(a,e)*t.get(n,u));return o}kroneckerSum(t){if(t=Ef.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,r=this.kroneckerProduct(Ef.eye(n,n)),i=Ef.eye(e,e).kroneckerProduct(t);return r.add(i)}transpose(){let t=new Ef(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=wf){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=wf){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,r){yf(this,t,e,n,r);let i=new Ef(e-t+1,r-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=r;e++)i.set(o-t,e-n,this.get(o,e));return i}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let r=new Ef(t.length,n-e+1);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);r.set(i,o-e,this.get(t[i],o))}return r}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let r=new Ef(n-e+1,t.length);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);r.set(o-e,i,this.get(o,t[i]))}return r}setSubMatrix(t,e,n){if((t=Ef.checkMatrix(t)).isEmpty())return this;yf(this,e,e+t.rows-1,n,n+t.columns-1);for(let r=0;r<t.rows;r++)for(let i=0;i<t.columns;i++)this.set(e+r,n+i,t.get(r,i));return this}selection(t,e){!function(t,e){if(!rf(e))throw new TypeError("row indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!rf(e))throw new TypeError("column indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let n=new Ef(t.length,e.length);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<e.length;t++){let o=e[t];n.set(r,t,this.get(i,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){let t=new Ef(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(e,n,this.get(e,n));return t}sum(t){switch(t){case"row":return function(t){let e=mf(t.rows);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]+=t.get(n,r);return e}(this);case"column":return function(t){let e=mf(t.columns);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]+=t.get(n,r);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e+=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=mf(t.rows,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]*=t.get(n,r);return e}(this);case"column":return function(t){let e=mf(t.columns,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]*=t.get(n,r);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e*=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:r=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!rf(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<r;a++){let r=0,u=0,s=0;for(let e=0;e<i;e++)s=t.get(a,e)-n[a],r+=s,u+=s*s;e?o.push((u-r*r/i)/(i-1)):o.push((u-r*r/i)/i)}return o}(this,n,r);case"column":if(!rf(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<i;a++){let i=0,u=0,s=0;for(let e=0;e<r;e++)s=t.get(e,a)-n[a],i+=s,u+=s*s;e?o.push((u-i*i/r)/(r-1)):o.push((u-i*i/r)/r)}return o}(this,n,r);case void 0:if("number"!=typeof r)throw new TypeError("mean must be a number");return function(t,e,n){const r=t.rows,i=t.columns,o=r*i;let a=0,u=0,s=0;for(let e=0;e<r;e++)for(let r=0;r<i;r++)s=t.get(e,r)-n,a+=s,u+=s*s;return e?(u-a*a/o)/(o-1):(u-a*a/o)/o}(this,n,r);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!rf(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[n])}(this,n),this;case"column":if(!rf(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[r])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let r=0;for(let e=0;e<t.columns;e++)r+=Math.pow(t.get(n,e),2)/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!rf(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let r=0;for(let e=0;e<t.rows;e++)r+=Math.pow(t.get(e,n),2)/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!rf(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[r])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let r=0;r<t.columns;r++)for(let i=0;i<t.rows;i++)n+=Math.pow(t.get(i,r),2)/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return ff(this,t)}}function wf(t,e){return t-e}xf.prototype.klass="Matrix","undefined"!=typeof Symbol&&(xf.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return ff(this)}),xf.random=xf.rand,xf.randomInt=xf.randInt,xf.diagonal=xf.diag,xf.prototype.diagonal=xf.prototype.diag,xf.identity=xf.eye,xf.prototype.negate=xf.prototype.neg,xf.prototype.tensorProduct=xf.prototype.kroneckerProduct;class Ef extends xf{constructor(t,e){if(super(),Ef.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e))}else{if(!rf(t))throw new TypeError("First argument must be a positive number or an array");{const n=t;if("number"!=typeof(e=(t=n.length)?n[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<t;r++){if(n[r].length!==e)throw new RangeError("Inconsistent array dimensions");if(!n[r].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[r]))}}}this.rows=t,this.columns=e}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return hf(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),hf(this,t,!0),e=Float64Array.from(vf(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){pf(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let r=0;r<t;r++)n[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)n[r-1]=this.data[e][r];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),pf(this,t,!0),e=gf(this,e);for(let n=0;n<this.rows;n++){const r=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)r[i]=this.data[n][i];for(r[i++]=e[n];i<this.columns+1;i++)r[i]=this.data[n][i-1];this.data[n]=r}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t.get(e,n)));return this}}(xf,Ef);class Sf extends xf{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}function Af(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class Tf{constructor(t,e={}){if((t=Sf.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,r=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:a=!1}=e;let u,s=Boolean(i),c=Boolean(o),f=!1;if(n<r)if(a){u=t.transpose(),n=u.rows,r=u.columns,f=!0;let e=s;s=c,c=e}else u=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else u=t.clone();let l=Math.min(n,r),d=Math.min(n+1,r),h=new Float64Array(d),p=new Ef(n,l),v=new Ef(r,r),g=new Float64Array(r),y=new Float64Array(n),m=new Float64Array(d);for(let t=0;t<d;t++)m[t]=t;let b=Math.min(n-1,r),_=Math.max(0,Math.min(r-2,n)),x=Math.max(b,_);for(let t=0;t<x;t++){if(t<b){h[t]=0;for(let e=t;e<n;e++)h[t]=Af(h[t],u.get(e,t));if(0!==h[t]){u.get(t,t)<0&&(h[t]=-h[t]);for(let e=t;e<n;e++)u.set(e,t,u.get(e,t)/h[t]);u.set(t,t,u.get(t,t)+1)}h[t]=-h[t]}for(let e=t+1;e<r;e++){if(t<b&&0!==h[t]){let r=0;for(let i=t;i<n;i++)r+=u.get(i,t)*u.get(i,e);r=-r/u.get(t,t);for(let i=t;i<n;i++)u.set(i,e,u.get(i,e)+r*u.get(i,t))}g[e]=u.get(t,e)}if(s&&t<b)for(let e=t;e<n;e++)p.set(e,t,u.get(e,t));if(t<_){g[t]=0;for(let e=t+1;e<r;e++)g[t]=Af(g[t],g[e]);if(0!==g[t]){g[t+1]<0&&(g[t]=0-g[t]);for(let e=t+1;e<r;e++)g[e]/=g[t];g[t+1]+=1}if(g[t]=-g[t],t+1<n&&0!==g[t]){for(let e=t+1;e<n;e++)y[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<r;n++)y[e]+=g[n]*u.get(e,n);for(let e=t+1;e<r;e++){let r=-g[e]/g[t+1];for(let i=t+1;i<n;i++)u.set(i,e,u.get(i,e)+r*y[i])}}if(c)for(let e=t+1;e<r;e++)v.set(e,t,g[e])}}let w=Math.min(r,n+1);if(b<r&&(h[b]=u.get(b,b)),n<w&&(h[w-1]=0),_+1<w&&(g[_]=u.get(_,w-1)),g[w-1]=0,s){for(let t=b;t<l;t++){for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}for(let t=b-1;t>=0;t--)if(0!==h[t]){for(let e=t+1;e<l;e++){let r=0;for(let i=t;i<n;i++)r+=p.get(i,t)*p.get(i,e);r=-r/p.get(t,t);for(let i=t;i<n;i++)p.set(i,e,p.get(i,e)+r*p.get(i,t))}for(let e=t;e<n;e++)p.set(e,t,-p.get(e,t));p.set(t,t,1+p.get(t,t));for(let e=0;e<t-1;e++)p.set(e,t,0)}else{for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}}if(c)for(let t=r-1;t>=0;t--){if(t<_&&0!==g[t])for(let e=t+1;e<r;e++){let n=0;for(let i=t+1;i<r;i++)n+=v.get(i,t)*v.get(i,e);n=-n/v.get(t+1,t);for(let i=t+1;i<r;i++)v.set(i,e,v.get(i,e)+n*v.get(i,t))}for(let e=0;e<r;e++)v.set(e,t,0);v.set(t,t,1)}let E=w-1,S=0,A=Number.EPSILON;for(;w>0;){let t,e;for(t=w-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+A*Math.abs(h[t]+Math.abs(h[t+1]));if(Math.abs(g[t])<=e||Number.isNaN(g[t])){g[t]=0;break}}if(t===w-2)e=4;else{let n;for(n=w-1;n>=t&&n!==t;n--){let e=(n!==w?Math.abs(g[n]):0)+(n!==t+1?Math.abs(g[n-1]):0);if(Math.abs(h[n])<=A*e){h[n]=0;break}}n===t?e=3:n===w-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=g[w-2];g[w-2]=0;for(let n=w-2;n>=t;n--){let i=Af(h[n],e),o=h[n]/i,a=e/i;if(h[n]=i,n!==t&&(e=-a*g[n-1],g[n-1]=o*g[n-1]),c)for(let t=0;t<r;t++)i=o*v.get(t,n)+a*v.get(t,w-1),v.set(t,w-1,-a*v.get(t,n)+o*v.get(t,w-1)),v.set(t,n,i)}break}case 2:{let e=g[t-1];g[t-1]=0;for(let r=t;r<w;r++){let i=Af(h[r],e),o=h[r]/i,a=e/i;if(h[r]=i,e=-a*g[r],g[r]=o*g[r],s)for(let e=0;e<n;e++)i=o*p.get(e,r)+a*p.get(e,t-1),p.set(e,t-1,-a*p.get(e,r)+o*p.get(e,t-1)),p.set(e,r,i)}break}case 3:{const e=Math.max(Math.abs(h[w-1]),Math.abs(h[w-2]),Math.abs(g[w-2]),Math.abs(h[t]),Math.abs(g[t])),i=h[w-1]/e,o=h[w-2]/e,a=g[w-2]/e,u=h[t]/e,f=g[t]/e,l=((o+i)*(o-i)+a*a)/2,d=i*a*(i*a);let y=0;0===l&&0===d||(y=l<0?0-Math.sqrt(l*l+d):Math.sqrt(l*l+d),y=d/(l+y));let m=(u+i)*(u-i)+y,b=u*f;for(let e=t;e<w-1;e++){let i=Af(m,b);0===i&&(i=Number.MIN_VALUE);let o=m/i,a=b/i;if(e!==t&&(g[e-1]=i),m=o*h[e]+a*g[e],g[e]=o*g[e]-a*h[e],b=a*h[e+1],h[e+1]=o*h[e+1],c)for(let t=0;t<r;t++)i=o*v.get(t,e)+a*v.get(t,e+1),v.set(t,e+1,-a*v.get(t,e)+o*v.get(t,e+1)),v.set(t,e,i);if(i=Af(m,b),0===i&&(i=Number.MIN_VALUE),o=m/i,a=b/i,h[e]=i,m=o*g[e]+a*h[e+1],h[e+1]=-a*g[e]+o*h[e+1],b=a*g[e+1],g[e+1]=o*g[e+1],s&&e<n-1)for(let t=0;t<n;t++)i=o*p.get(t,e)+a*p.get(t,e+1),p.set(t,e+1,-a*p.get(t,e)+o*p.get(t,e+1)),p.set(t,e,i)}g[w-2]=m,S+=1;break}case 4:if(h[t]<=0&&(h[t]=h[t]<0?-h[t]:0,c))for(let e=0;e<=E;e++)v.set(e,t,-v.get(e,t));for(;t<E&&!(h[t]>=h[t+1]);){let e=h[t];if(h[t]=h[t+1],h[t+1]=e,c&&t<r-1)for(let n=0;n<r;n++)e=v.get(n,t+1),v.set(n,t+1,v.get(n,t)),v.set(n,t,e);if(s&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);t++}S=0,w--}}if(f){let t=v;v=p,p=t}this.m=n,this.n=r,this.s=h,this.U=p,this.V=v}solve(t){let e=t,n=this.threshold,r=this.s.length,i=Ef.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=n?i.set(t,t,0):i.set(t,t,1/this.s[t]);let o=this.U,a=this.rightSingularVectors,u=a.mmul(i),s=a.rows,c=o.rows,f=Ef.zeros(s,c);for(let t=0;t<s;t++)for(let e=0;e<c;e++){let n=0;for(let i=0;i<r;i++)n+=u.get(t,i)*o.get(e,i);f.set(t,e,n)}return f.mmul(e)}solveForDiagonal(t){return this.solve(Ef.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,r=t.columns,i=new Ef(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<r;n++)Math.abs(this.s[n])>e&&i.set(o,n,t.get(o,n)/this.s[n]);let o=this.U,a=o.rows,u=o.columns,s=new Ef(n,a);for(let t=0;t<n;t++)for(let e=0;e<a;e++){let n=0;for(let r=0;r<u;r++)n+=i.get(t,r)*o.get(e,r);s.set(t,e,n)}return s}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let r=0,i=n.length;r<i;r++)n[r]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Ef.diag(this.s)}}var If=function(){function t(t){this.distances=t.distances,this.dimension=t.dimension||2,this.linkDistance=t.linkDistance}return t.prototype.layout=function(){var t=this,e=t.dimension,n=t.distances,r=t.linkDistance;try{var i=Ef.mul(Ef.pow(n,2),-.5),o=i.mean("row"),a=i.mean("column"),u=i.mean();i.add(u).subRowVector(o).subColumnVector(a);var s=new Tf(i),c=Ef.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((function(t){return Ef.mul([t],[c]).toJSON()[0].splice(0,e)}))}catch(t){for(var f=[],l=0;l<n.length;l++){var d=Math.random()*r,h=Math.random()*r;f.push([d,h])}return f}},t}();const Nf=If;var Of=function(){function t(t){this.disp=[],this.positions=t.positions,this.adjMatrix=t.adjMatrix,this.focusID=t.focusID,this.radii=t.radii,this.iterations=t.iterations||10,this.height=t.height||10,this.width=t.width||10,this.speed=t.speed||100,this.gravity=t.gravity||10,this.nodeSizeFunc=t.nodeSizeFunc,this.k=t.k||5,this.strictRadial=t.strictRadial,this.nodes=t.nodes}return t.prototype.layout=function(){var t=this,e=t.positions,n=[],r=t.iterations,i=t.width/10;t.maxDisplace=i,t.disp=n;for(var o=0;o<r;o++)e.forEach((function(t,e){n[e]={x:0,y:0}})),t.getRepulsion(),t.updatePositions();return e},t.prototype.getRepulsion=function(){var t=this,e=t.positions,n=t.nodes,r=t.disp,i=t.k,o=t.radii||[];e.forEach((function(a,u){r[u]={x:0,y:0},e.forEach((function(e,s){if(u!==s&&o[u]===o[s]){var c=a[0]-e[0],f=a[1]-e[1],l=Math.sqrt(c*c+f*f);if(0===l){l=1;var d=u>s?1:-1;c=.01*d,f=.01*d}if(l<t.nodeSizeFunc(n[u])/2+t.nodeSizeFunc(n[s])/2){var h=i*i/l;r[u].x+=c/l*h,r[u].y+=f/l*h}}}))}))},t.prototype.updatePositions=function(){var t=this,e=t.positions,n=t.disp,r=t.speed,i=t.strictRadial,o=t.focusID,a=t.maxDisplace||t.width/10;i&&n.forEach((function(t,n){var r=e[n][0]-e[o][0],i=e[n][1]-e[o][1],a=Math.sqrt(r*r+i*i),u=i/a,s=-r/a,c=Math.sqrt(t.x*t.x+t.y*t.y),f=Math.acos((u*t.x+s*t.y)/c);f>Math.PI/2&&(f-=Math.PI/2,u*=-1,s*=-1);var l=Math.cos(f)*c;t.x=u*l,t.y=s*l}));var u=t.radii;e.forEach((function(t,s){if(s!==o){var c=Math.sqrt(n[s].x*n[s].x+n[s].y*n[s].y);if(c>0&&s!==o){var f=Math.min(a*(r/800),c);if(t[0]+=n[s].x/c*f,t[1]+=n[s].y/c*f,i){var l=t[0]-e[o][0],d=t[1]-e[o][1],h=Math.sqrt(l*l+d*d);l=l/h*u[s],d=d/h*u[s],t[0]=e[o][0]+l,t[1]=e[o][1]+d}}}}))},t}();const Cf=Of;var kf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Df(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var Mf=function(t){function n(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(e),n}return kf(n,t),n.prototype.getDefaultCfg=function(){return{maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,strictRadial:!0,maxPreventOverlapIteration:200,sortBy:void 0,sortStrength:10}},n.prototype.execute=function(){var t=this,n=t.nodes,r=t.edges||[];if(n&&0!==n.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var u=t.center;if(1===n.length)return n[0].x=u[0],n[0].y=u[1],void(t.onLayoutEnd&&t.onLayoutEnd());var s=t.linkDistance,c=null;if(e(t.focusNode)){for(var l=!1,d=0;d<n.length;d++)n[d].id===t.focusNode&&(c=n[d],t.focusNode=c,l=!0,d=n.length);l||(c=null)}else c=t.focusNode;c||(c=n[0],t.focusNode=c);var h=function(t,e){var n=-1;return t.forEach((function(t,r){t.id===e&&(n=r)})),n}(n,c.id);h<0&&(h=0),t.focusIndex=h;var g=v({nodes:n,edges:r},!1),y=p(g),m=t.maxToFocus(y,h);t.handleInfinity(y,h,m+1),t.distances=y;var b=y[h],_=t.width||500,w=t.height||500,E=_-u[0]>u[0]?u[0]:_-u[0],S=w-u[1]>u[1]?u[1]:w-u[1];0===E&&(E=_/2),0===S&&(S=w/2);var A=S>E?E:S,T=Math.max.apply(Math,b),I=[];b.forEach((function(e,n){t.unitRadius||(t.unitRadius=A/T),I[n]=e*t.unitRadius})),t.radii=I;var N=t.eIdealDisMatrix();t.eIdealDistances=N;var O=function(t){for(var e=t.length,n=t[0].length,r=[],i=0;i<e;i++){for(var o=[],a=0;a<n;a++)0!==t[i][a]?o.push(1/(t[i][a]*t[i][a])):o.push(0);r.push(o)}return r}(N);t.weights=O;var C=new Nf({linkDistance:s,distances:N}).layout();C.forEach((function(t){a(t[0])&&(t[0]=Math.random()*s),a(t[1])&&(t[1]=Math.random()*s)})),t.positions=C,C.forEach((function(t,e){n[e].x=t[0]+u[0],n[e].y=t[1]+u[1]})),C.forEach((function(t){t[0]-=C[h][0],t[1]-=C[h][1]})),t.run();var k,D=t.preventOverlap,M=t.nodeSize,R=t.strictRadial;if(D){var P,G=t.nodeSpacing;P=o(G)?function(){return G}:x(G)?G:function(){return 0},k=M?i(M)?function(t){return(M[0]>M[1]?M[0]:M[1])+P(t)}:function(t){return M+P(t)}:function(t){return t.size?i(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])+P(t):f(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)+P(t):t.size+P(t):10+P(t)};var L={nodes:n,nodeSizeFunc:k,adjMatrix:g,positions:C,radii:I,height:w,width:_,strictRadial:R,focusID:h,iterations:t.maxPreventOverlapIteration||200,k:C.length/4.5},j=new Cf(L);C=j.layout()}return C.forEach((function(t,e){n[e].x=t[0]+u[0],n[e].y=t[1]+u[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:r}}t.onLayoutEnd&&t.onLayoutEnd()},n.prototype.run=function(){for(var t=this,e=t.maxIteration,n=t.positions||[],r=t.weights||[],i=t.eIdealDistances||[],o=t.radii||[],a=0;a<=e;a++){var u=a/e;t.oneIteration(u,n,o,i,r)}},n.prototype.oneIteration=function(t,e,n,r,i){var o=1-t,a=this.focusIndex;e.forEach((function(u,s){var c=Df(u,[0,0]),f=0===c?0:1/c;if(s!==a){var l=0,d=0,h=0;e.forEach((function(t,e){if(s!==e){var n=Df(u,t),o=0===n?0:1/n,a=r[e][s];h+=i[s][e],l+=i[s][e]*(t[0]+a*(u[0]-t[0])*o),d+=i[s][e]*(t[1]+a*(u[1]-t[1])*o)}}));var p=0===n[s]?0:1/n[s];h*=o,h+=t*p*p,l*=o,l+=t*p*u[0]*f,u[0]=l/h,d*=o,d+=t*p*u[1]*f,u[1]=d/h}}))},n.prototype.eIdealDisMatrix=function(){var t=this,n=t.nodes;if(!n)return[];var r=t.distances,i=t.linkDistance,o=t.radii||[],a=t.unitRadius||50,u=[];return r&&r.forEach((function(r,s){var c=[];r.forEach((function(r,u){if(s===u)c.push(0);else if(o[s]===o[u])if("data"===t.sortBy)c.push(r*(Math.abs(s-u)*t.sortStrength)/(o[s]/a));else if(t.sortBy){var f=n[s][t.sortBy]||0,l=n[u][t.sortBy]||0;e(f)&&(f=f.charCodeAt(0)),e(l)&&(l=l.charCodeAt(0)),c.push(r*(Math.abs(f-l)*t.sortStrength)/(o[s]/a))}else c.push(r*i/(o[s]/a));else{var d=(i+a)/2;c.push(r*d)}})),u.push(c)})),u},n.prototype.handleInfinity=function(t,e,n){for(var r=t.length,i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(var o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(i=0;i<r;i++)if(i!==e)for(o=0;o<r;o++)if(t[i][o]===1/0){var a=Math.abs(t[e][i]-t[e][o]);a=0===a?1:a,t[i][o]=a}},n.prototype.maxToFocus=function(t,e){for(var n=0,r=0;r<t[e].length;r++)t[e][r]!==1/0&&(n=t[e][r]>n?t[e][r]:n);return n},n.prototype.getType=function(){return"radial"},n}(t),Rf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pf=function(t){function n(e){var n=t.call(this)||this;return n.nodeSize=30,n.minNodeSpacing=10,n.nodeSpacing=10,n.preventOverlap=!1,n.equidistant=!1,n.startAngle=1.5*Math.PI,n.clockwise=!0,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.onLayoutEnd=function(){},n.updateCfg(e),n}return Rf(n,t),n.prototype.getDefaultCfg=function(){return{nodeSize:30,minNodeSpacing:10,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"}},n.prototype.execute=function(){var t,n,r=this,a=r.nodes,u=r.edges,s=a.length;if(0!==s){r.width||"undefined"==typeof window||(r.width=window.innerWidth),r.height||"undefined"==typeof window||(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var c=r.center;if(1===s)return a[0].x=c[0],a[0].y=c[1],void(null===(n=r.onLayoutEnd)||void 0===n||n.call(r));var l,d=r.nodeSize,p=r.nodeSpacing,v=[],g=0;l=i(d)?Math.max(d[0],d[1]):d,i(p)?g=Math.max(p[0],p[1]):o(p)&&(g=p),a.forEach((function(t){v.push(t);var e=l;i(t.size)?e=Math.max(t.size[0],t.size[1]):o(t.size)?e=t.size:f(t.size)&&(e=Math.max(t.size.width,t.size.height)),l=Math.max(l,e),x(p)&&(g=Math.max(p(t),g))})),r.clockwise=void 0!==r.counterclockwise?!r.counterclockwise:r.clockwise;var y={},m={};if(v.forEach((function(t,e){y[t.id]=t,m[t.id]=e})),!("degree"!==r.sortBy&&e(r.sortBy)&&void 0!==v[0][r.sortBy]||(r.sortBy="degree",o(a[0].degree)))){var b=h(a.length,m,u);v.forEach((function(t,e){t.degree=b[e].all}))}v.sort((function(t,e){return e[r.sortBy]-t[r.sortBy]})),r.maxValueNode=v[0],r.maxLevelDiff=r.maxLevelDiff||r.maxValueNode[r.sortBy]/4;var _=[[]],w=_[0];v.forEach((function(t){if(w.length>0){var e=Math.abs(w[0][r.sortBy]-t[r.sortBy]);r.maxLevelDiff&&e>=r.maxLevelDiff&&(w=[],_.push(w))}w.push(t)}));var E=l+(g||r.minNodeSpacing);if(!r.preventOverlap){var S=_.length>0&&_[0].length>1,A=(Math.min(r.width,r.height)/2-E)/(_.length+(S?1:0));E=Math.min(E,A)}var T=0;if(_.forEach((function(t){var e=r.sweep;void 0===e&&(e=2*Math.PI-2*Math.PI/t.length);var n=t.dTheta=e/Math.max(1,t.length-1);if(t.length>1&&r.preventOverlap){var i=Math.cos(n)-Math.cos(0),o=Math.sin(n)-Math.sin(0),a=Math.sqrt(E*E/(i*i+o*o));T=Math.max(a,T)}t.r=T,T+=E})),r.equidistant){for(var I=0,N=0,O=0;O<_.length;O++){var C=_[O].r-N;I=Math.max(I,C)}N=0,_.forEach((function(t,e){0===e&&(N=t.r),t.r=N,N+=I}))}return _.forEach((function(t){var e=t.dTheta,n=t.r;t.forEach((function(t,i){var o=r.startAngle+(r.clockwise?1:-1)*e*i;t.x=c[0]+n*Math.cos(o),t.y=c[1]+n*Math.sin(o)}))})),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:a,edges:u}}null===(t=r.onLayoutEnd)||void 0===t||t.call(r)},n.prototype.getType=function(){return"concentric"},n}(t),Gf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Lf=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.linkDistance=50,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return Gf(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges,r=void 0===n?[]:n,i=t.center;if(e&&0!==e.length){if(1===e.length)return e[0].x=i[0],e[0].y=i[1],void(t.onLayoutEnd&&t.onLayoutEnd());var o=t.linkDistance,a=v({nodes:e,edges:r},!1),u=p(a);t.handleInfinity(u);var s,c,f=(s=o,c=[],u.forEach((function(t){var e=[];t.forEach((function(t){e.push(t*s)})),c.push(e)})),c);t.scaledDistances=f;var l=t.runMDS();return t.positions=l,l.forEach((function(t,n){e[n].x=t[0]+i[0],e[n].y=t[1]+i[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:r}}t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.runMDS=function(){var t=this.scaledDistances,e=Ef.mul(Ef.pow(t,2),-.5),n=e.mean("row"),r=e.mean("column"),i=e.mean();e.add(i).subRowVector(n).subColumnVector(r);var o=new Tf(e),a=Ef.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map((function(t){return Ef.mul([t],[a]).toJSON()[0].splice(0,2)}))},e.prototype.handleInfinity=function(t){var e=-999999;t.forEach((function(t){t.forEach((function(t){t!==1/0&&e<t&&(e=t)}))})),t.forEach((function(n,r){n.forEach((function(n,i){n===1/0&&(t[r][i]=e)}))}))},e.prototype.getType=function(){return"mds"},e}(t),jf=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ff=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.workerEnabled=!1,n.gravity=10,n.speed=5,n.clustering=!1,n.clusterGravity=10,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.onLayoutEnd=function(){},n.tick=function(){},n.animate=!0,n.updateCfg(e),n}return jf(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},e.prototype.execute=function(){var t,e,n=this,r=this,i=r.nodes;if(void 0!==r.timeInterval&&"undefined"!=typeof window&&window.clearInterval(r.timeInterval),i&&0!==i.length){r.width||"undefined"==typeof window||(r.width=window.innerWidth),r.height||"undefined"==typeof window||(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var a=r.center;if(1===i.length)return i[0].x=a[0],i[0].y=a[1],void(null===(e=r.onLayoutEnd)||void 0===e||e.call(r));var u={},s={};return i.forEach((function(t,e){o(t.x)||(t.x=Math.random()*n.width),o(t.y)||(t.y=Math.random()*n.height),u[t.id]=t,s[t.id]=e})),r.nodeMap=u,r.nodeIdxMap=s,r.run()}null===(t=r.onLayoutEnd)||void 0===t||t.call(r)},e.prototype.run=function(){var t,e=this,n=e.nodes;if(n){var r=e.edges,i=e.maxIteration,o=e.workerEnabled,a=e.clustering,u=e.animate,s={};if(a&&n.forEach((function(t){void 0===s[t.cluster]&&(s[t.cluster]={name:t.cluster,cx:0,cy:0,count:0})})),o||!u){for(var c=0;c<i;c++)e.runOneStep(s);null===(t=e.onLayoutEnd)||void 0===t||t.call(e)}else{if("undefined"==typeof window)return;var f=0;this.timeInterval=window.setInterval((function(){var t;e.runOneStep(s),++f>=i&&(null===(t=e.onLayoutEnd)||void 0===t||t.call(e),window.clearInterval(e.timeInterval))}),0)}return{nodes:n,edges:r}}},e.prototype.runOneStep=function(t){var e,n=this,r=n.nodes;if(r){var i=n.edges,a=n.center,u=n.gravity,s=n.speed,c=n.clustering,f=n.height*n.width,l=Math.sqrt(f)/10,d=f/(r.length+1),h=Math.sqrt(d),p=[];if(r.forEach((function(t,e){p[e]={x:0,y:0}})),n.applyCalculate(r,i,p,h,d),c){for(var v in t)t[v].cx=0,t[v].cy=0,t[v].count=0;for(var v in r.forEach((function(e){var n=t[e.cluster];o(e.x)&&(n.cx+=e.x),o(e.y)&&(n.cy+=e.y),n.count++})),t)t[v].cx/=t[v].count,t[v].cy/=t[v].count;var g=n.clusterGravity||u;r.forEach((function(e,n){if(o(e.x)&&o(e.y)){var r=t[e.cluster],i=Math.sqrt((e.x-r.cx)*(e.x-r.cx)+(e.y-r.cy)*(e.y-r.cy)),a=h*g;p[n].x-=a*(e.x-r.cx)/i,p[n].y-=a*(e.y-r.cy)/i}}))}r.forEach((function(t,e){if(o(t.x)&&o(t.y)){var n=.01*h*u;p[e].x-=n*(t.x-a[0]),p[e].y-=n*(t.y-a[1])}})),r.forEach((function(t,e){if(o(t.fx)&&o(t.fy))return t.x=t.fx,void(t.y=t.fy);if(o(t.x)&&o(t.y)){var n=Math.sqrt(p[e].x*p[e].x+p[e].y*p[e].y);if(n>0){var r=Math.min(l*(s/800),n);t.x+=p[e].x/n*r,t.y+=p[e].y/n*r}}})),null===(e=n.tick)||void 0===e||e.call(n)}},e.prototype.applyCalculate=function(t,e,n,r,i){this.calRepulsive(t,n,i),e&&this.calAttractive(e,n,r)},e.prototype.calRepulsive=function(t,e,n){t.forEach((function(r,i){e[i]={x:0,y:0},t.forEach((function(t,a){if(i!==a&&o(r.x)&&o(t.x)&&o(r.y)&&o(t.y)){var u=r.x-t.x,s=r.y-t.y,c=u*u+s*s;if(0===c){c=1;var f=i>a?1:-1;u=.01*f,s=.01*f}var l=n/c;e[i].x+=u*l,e[i].y+=s*l}}))}))},e.prototype.calAttractive=function(t,e,n){var r=this;t.forEach((function(t){var i=d(t,"source"),a=d(t,"target");if(i&&a){var u=r.nodeIdxMap[i],s=r.nodeIdxMap[a];if(u!==s){var c=r.nodeMap[i],f=r.nodeMap[a];if(o(f.x)&&o(c.x)&&o(f.y)&&o(c.y)){var l=f.x-c.x,h=f.y-c.y,p=Math.sqrt(l*l+h*h),v=p*p/n;e[s].x-=l/p*v,e[s].y-=h/p*v,e[u].x+=l/p*v,e[u].y+=h/p*v}}}}))},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(t);function Uf(t,e,n,r){n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(r):void 0})}function Bf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zf(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,r.key,r)}}function Vf(t,e,n){return e&&zf(t.prototype,e),n&&zf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wf(t,e,n,r,i){var o={};return Object.keys(r).forEach((function(t){o[t]=r[t]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce((function(n,r){return r(t,e,n)||n}),o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(t,e,o),o=null),o}n(8892);var Hf=n(2662),Xf=n.n(Hf);function qf(t,e,n,r,i,o,a){try{var u=t[o](a),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(r,i)}function Yf(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){qf(o,r,i,a,u,"next",t)}function u(t){qf(o,r,i,a,u,"throw",t)}a(void 0)}))}}var Kf=1;function Zf(){return Kf++}var $f=function t(e){Bf(this,t)},Jf=function(){function t(e){Bf(this,t),this.clazz=void 0,this.components=[],this.entities=[],this.lookup={},this.clazz=e}var e;return Vf(t,[{key:"clear",value:function(){this.components=[],this.entities=[],this.lookup={}}},{key:"contains",value:function(t){return this.lookup[t]>-1}},{key:"create",value:function(t,e){this.lookup[t]=this.components.length;var n=new this.clazz(e||{});return this.components.push(n),this.entities.push(t),n}},{key:"remove",value:function(t){var e=this.lookup[t];e>-1&&e<this.components.length-1&&(this.components[e]=this.components[this.components.length-1],this.entities[e]=this.entities[this.entities.length-1],this.lookup[this.entities[e]]=e),this.components.pop(),this.entities.pop(),delete this.lookup[t]}},{key:"removeKeepSorted",value:function(t){var e=this.lookup[t];if(e>-1){var n=this.entities[e];if(e<this.components.length-1){for(var r=e+1;r<this.components.length;++r)this.components[r-1]=this.components[r];for(var i=e+1;i<this.entities.length;++i)this.entities[i-1]=this.entities[i],this.lookup[this.entities[i-1]]=i-1}this.components.pop(),this.entities.pop(),delete this.lookup[n]}}},{key:"moveItem",value:function(t,e){if(t!==e){for(var n=this.components[t],r=this.entities[t],i=t<e?1:-1,o=t;o!==e;o+=i){var a=o+i;this.components[o]=this.components[a],this.entities[o]=this.entities[a],this.lookup[this.entities[o]]=o}this.components[e]=n,this.entities[e]=r,this.lookup[r]=e}}},{key:"getEntity",value:function(t){return this.entities[t]}},{key:"getComponent",value:function(t){return this.components[t]}},{key:"getComponentByEntity",value:function(t){var e=this.lookup[t];return e>-1?this.components[e]:null}},{key:"getCount",value:function(){return this.components.length}},{key:"getEntityByComponentIndex",value:function(t){for(var e=0,n=Object.keys(this.lookup);e<n.length;e++){var r=n[e],i=Number(r);if(this.lookup[i]===t)return i}return-1}},{key:"find",value:function(t){for(var e=0;e<this.getCount();e++){var n=this.getComponent(e);if(t(n,e))return n}return null}},{key:"findIndex",value:function(t){for(var e=0;e<this.getCount();e++)if(t(this.getComponent(e),e))return e;return-1}},{key:"forEach",value:function(t){for(var e=0,n=Object.keys(this.lookup);e<n.length;e++){var r=n[e],i=Number(r),o=this.lookup[i];t(i,this.getComponent(o))}}},{key:"forEachAsync",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,r=Object.keys(this.lookup);case 1:if(!(n<r.length)){t.next=10;break}return i=r[n],o=Number(i),a=this.lookup[o],t.next=7,e(o,this.getComponent(a));case 7:n++,t.next=1;break;case 10:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"map",value:function(t){for(var e=[],n=0,r=Object.keys(this.lookup);n<r.length;n++){var i=r[n],o=Number(i),a=this.lookup[o];e.push(t(o,this.getComponent(a)))}return e}}]),t}();function Qf(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 tl(t,e){if(t){if("string"==typeof t)return Qf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qf(t,e):void 0}}function el(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){u=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(t,e)||tl(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var nl=n(9311),rl={HierarchyComponentManager:Symbol("HierarchyComponentManager"),TransformComponentManager:Symbol("TransformComponentManager"),NameComponentManager:Symbol("NameComponentManager"),SceneGraphSystem:Symbol("SceneGraphSystem"),FrameGraphSystem:Symbol("FrameGraphSystem"),ResourcePool:Symbol("ResourcePool"),ResourceHandleComponentManager:Symbol("ResourceHandleComponentManager"),PassNodeComponentManager:Symbol("PassNodeComponentManager"),RendererSystem:Symbol("RendererSystem"),RenderPass:Symbol("RenderPass"),RenderPassFactory:Symbol("Factory<IRenderPass>"),Renderable:Symbol("Factory<IRenderPass>"),MeshSystem:Symbol("MeshSystem"),MeshComponentManager:Symbol("MeshComponentManager"),CullableComponentManager:Symbol("CullableComponentManager"),Geometry:Symbol("Geometry"),GeometrySystem:Symbol("GeometrySystem"),GeometryComponentManager:Symbol("GeometryComponentManager"),Material:Symbol("Material"),MaterialSystem:Symbol("MaterialSystem"),MaterialComponentManager:Symbol("MaterialComponentManager"),ForwardRenderPath:Symbol("ForwardRenderPath"),ComputeSystem:Symbol("ComputeSystem"),ComputeComponentManager:Symbol("ComputeComponentManager"),ComputeStrategy:Symbol("ComputeStrategy"),Systems:Symbol("Systems"),World:Symbol("World"),RenderEngine:Symbol("RenderEngine"),WebGPUEngine:Symbol("WebGPUEngine"),WebGLEngine:Symbol("WebGLEngine"),ShaderModuleService:Symbol("ShaderModuleService"),ConfigService:Symbol("ConfigService"),InteractorService:Symbol("InteractorService"),IEventEmitter:Symbol("IEventEmitter"),Light:Symbol("Light")},il=function t(){Bf(this,t),this.index=void 0},ol=function t(){Bf(this,t),this.name=void 0,this.data=void 0,this.execute=void 0,this.tearDown=void 0},al=function(){function t(){Bf(this,t),this.name=void 0,this.refCount=0,this.hasSideEffect=!1,this.devirtualize=[],this.destroy=[],this.reads=[],this.writes=[]}return Vf(t,[{key:"read",value:function(t){return this.reads.find((function(e){return e.index===t.index}))||this.reads.push(t),t}},{key:"sample",value:function(t){return this.read(t),t}},{key:"write",value:function(t,e){var n=this.writes.find((function(t){return t.index===e.index}));if(n)return e;var r=t.getResourceNode(e);r.resource.version++,r.resource.imported&&(this.hasSideEffect=!0);var i=t.createResourceNode(r.resource);return t.getResourceNode(i).writer=this,this.writes.push(i),i}}]),t}();function ul(t,e){return ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ul(t,e)}function sl(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ul(t,e)}function cl(t){return cl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(t)}function fl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ll(t,e){if(e&&("object"===cl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return fl(t)}function dl(t){return dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dl(t)}var hl,pl,vl,gl,yl,ml,bl=function(t){sl(i,(function t(){Bf(this,t),this.first=void 0,this.last=void 0}));var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return(t=r.call.apply(r,[this].concat(n))).version=0,t.refs=0,t.name=void 0,t.imported=void 0,t.priority=void 0,t.discardStart=!0,t.discardEnd=!1,t.descriptor=void 0,t.resource=void 0,t}return Vf(i,[{key:"preExecuteDestroy",value:function(){this.discardEnd=!0}},{key:"postExecuteDestroy",value:function(){this.imported}},{key:"postExecuteDevirtualize",value:function(){this.discardStart=!1}},{key:"preExecuteDevirtualize",value:function(){this.imported}}]),i}(),_l=function t(){Bf(this,t),this.resource=void 0,this.writer=void 0,this.readerCount=0,this.version=void 0};function xl(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function wl(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}var El=(hl=(0,nl.b2)(),pl=(0,nl.f3)(rl.RenderEngine),hl((ml=function(){function t(){Bf(this,t),this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[],Uf(this,"engine",yl,this)}var e,n;return Vf(t,[{key:"execute",value:(n=Yf(Xf().mark((function t(e){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.compile(),t.next=3,this.executePassNodes(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"tearDown",value:function(){this.frameGraphPasses.forEach((function(t){t.tearDown&&t.tearDown()})),this.reset()}},{key:"addPass",value:function(t,e,n,r){var i=new ol;i.execute=n,r&&(i.tearDown=r),i.name=t;var o=new al;return o.name=t,this.passNodes.push(o),this.frameGraphPasses.push(i),e(this,o,i),i}},{key:"getPass",value:function(t){return this.frameGraphPasses.find((function(e){return e.name===t}))}},{key:"compile",value:function(){var t,e=this,n=xl(this.passNodes);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.refCount=r.writes.length+(r.hasSideEffect?1:0),r.reads.forEach((function(t){e.resourceNodes[t.index].readerCount++}))}}catch(t){n.e(t)}finally{n.f()}var i,o=[],a=xl(this.resourceNodes);try{for(a.s();!(i=a.n()).done;){var u=i.value;0===u.readerCount&&o.push(u)}}catch(t){a.e(t)}finally{a.f()}for(;o.length;){var s=o.pop(),c=s&&s.writer;if(c&&0==--c.refCount){var f,l=xl(c.reads);try{for(l.s();!(f=l.n()).done;){var d=f.value,h=this.resourceNodes[d.index];0==--h.readerCount&&o.push(h)}}catch(t){l.e(t)}finally{l.f()}}}this.resourceNodes.forEach((function(t){t.resource.refs+=t.readerCount}));var p,v=xl(this.passNodes);try{for(v.s();!(p=v.n()).done;){var g=p.value;if(g.refCount){var y,m=xl(g.reads);try{for(m.s();!(y=m.n()).done;){var b=y.value,_=this.resourceNodes[b.index].resource;_.first=_.first?_.first:g,_.last=g}}catch(t){m.e(t)}finally{m.f()}var x,w=xl(g.writes);try{for(w.s();!(x=w.n()).done;){var E=x.value,S=this.resourceNodes[E.index].resource;S.first=S.first?S.first:g,S.last=g}}catch(t){w.e(t)}finally{w.f()}}}}catch(t){v.e(t)}finally{v.f()}for(var A=0;A<2;A++){var T,I=xl(this.resourceNodes);try{for(I.s();!(T=I.n()).done;){var N=T.value.resource;if(N.priority===A&&N.refs){var O=N.first,C=N.last;O&&C&&(O.devirtualize.push(N),C.destroy.push(N))}}}catch(t){I.e(t)}finally{I.f()}}}},{key:"executePassNodes",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a,u,s,c,f,l,d,h,p;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=xl(this.passNodes.entries()),t.prev=1,n.s();case 3:if((r=n.n()).done){t.next=18;break}if(i=el(r.value,2),o=i[0],!(a=i[1]).refCount){t.next=16;break}u=xl(a.devirtualize);try{for(u.s();!(s=u.n()).done;)s.value.preExecuteDevirtualize(this.engine)}catch(t){u.e(t)}finally{u.f()}c=xl(a.destroy);try{for(c.s();!(f=c.n()).done;)f.value.preExecuteDestroy(this.engine)}catch(t){c.e(t)}finally{c.f()}return t.next=12,this.frameGraphPasses[o].execute(this,this.frameGraphPasses[o],e);case 12:l=xl(a.devirtualize);try{for(l.s();!(d=l.n()).done;)d.value.postExecuteDevirtualize(this.engine)}catch(t){l.e(t)}finally{l.f()}h=xl(a.destroy);try{for(h.s();!(p=h.n()).done;)p.value.postExecuteDestroy(this.engine)}catch(t){h.e(t)}finally{h.f()}case 16:t.next=3;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(1),n.e(t.t0);case 23:return t.prev=23,n.f(),t.finish(23);case 26:this.reset();case 27:case"end":return t.stop()}}),t,this,[[1,20,23,26]])}))),function(t){return e.apply(this,arguments)})},{key:"reset",value:function(){this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[]}},{key:"getResourceNode",value:function(t){return this.resourceNodes[t.index]}},{key:"createResourceNode",value:function(t){var e=new _l;e.resource=t,e.version=t.version,this.resourceNodes.push(e);var n=new il;return n.index=this.resourceNodes.length-1,n}},{key:"createTexture",value:function(t,e,n){var r=new bl;return r.name=e,r.descriptor=n,this.createResourceNode(r)}},{key:"createRenderTarget",value:function(t,e,n){var r=new bl;return r.name=e,r.descriptor=n,this.createResourceNode(r)}},{key:"present",value:function(t){this.addPass("Present",(function(e,n){n.read(t),n.hasSideEffect=!0}),Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))))}}]),t}(),yl=Wf((gl=ml).prototype,"engine",[pl],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vl=gl))||vl);function Sl(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Al=1e-6,Tl="undefined"!=typeof Float32Array?Float32Array:Array;function Il(){var t=new Tl(4);return Tl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Nl(t,e,n,r){var i=new Tl(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function Ol(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}function Cl(){var t=new Tl(9);return Tl!=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 kl(){var t=new Tl(3);return Tl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Dl(t){var e=new Tl(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Ml(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function Rl(t,e,n){var r=new Tl(3);return r[0]=t,r[1]=e,r[2]=n,r}function Pl(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Gl(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function Ll(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function jl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Fl(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function Ul(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Bl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function zl(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function Vl(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function Wl(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t}Math.random,Math.PI,Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Il();var Hl=jl,Xl=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.hypot(n,r,i)},ql=Ml,Yl=(kl(),9007199254740991),Kl={};Kl["[object Float32Array]"]=Kl["[object Float64Array]"]=Kl["[object Int8Array]"]=Kl["[object Int16Array]"]=Kl["[object Int32Array]"]=Kl["[object Uint8Array]"]=Kl["[object Uint8ClampedArray]"]=Kl["[object Uint16Array]"]=Kl["[object Uint32Array]"]=!0,Kl["[object Arguments]"]=Kl["[object Array]"]=Kl["[object ArrayBuffer]"]=Kl["[object Boolean]"]=Kl["[object DataView]"]=Kl["[object Date]"]=Kl["[object Error]"]=Kl["[object Function]"]=Kl["[object Map]"]=Kl["[object Number]"]=Kl["[object Object]"]=Kl["[object RegExp]"]=Kl["[object Set]"]=Kl["[object String]"]=Kl["[object WeakMap]"]=!1;var Zl=Object.prototype.toString,$l=function(t){return function(t){return!!t&&"object"===cl(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Yl}(t.length)&&!!Kl[Zl.call(t)]};function Jl(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ql(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Jl(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var td,ed,nd,rd,id,od,ad,ud,sd,cd=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).dirty=!0,e.attributes=[],e.indices=void 0,e.indicesBuffer=void 0,e.vertexCount=0,e.maxInstancedCount=void 0,e.aabb=void 0,e.entity=void 0,Object.assign(fl(e),t),e}return Vf(i,[{key:"setAttribute",value:function(t,e,n,r){var i=this.attributes.find((function(e){return e.name===t}));return i?(i.data=e,i.dirty=!0):this.attributes.push(Ql(Ql({dirty:!0,name:t,data:e},n),{},{bufferGetter:r})),this.dirty=!0,this}},{key:"setIndex",value:function(t){return this.indices=new Uint32Array(t.buffer?t.buffer:t),this.dirty=!0,this}},{key:"applyMatrix",value:function(t){var e,n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y,m,b,_,x,w,E,S,A,T,I,N,O,C,k,D=this.attributes.find((function(t){return"position"===t.name})),M=this.attributes.find((function(t){return"normal"===t.name}));if(D&&(D.dirty=!0,D.data&&D.data.length))for(var R=0;R<D.data.length;R+=3){var P=Nl(D.data[R],D.data[R+1],D.data[R+2],1);Ol(P,P,t),$l(D.data)?D.data.set([P[0],P[1],P[2]],R):(D.data[R]=P[0],D.data[R+1]=P[1],D.data[R+2]=P[2])}if(M){var G=(e=Cl(),r=(n=t)[0],i=n[1],o=n[2],a=n[3],u=n[4],s=n[5],c=n[6],f=n[7],l=n[8],d=n[9],h=n[10],p=n[11],v=n[12],g=n[13],y=n[14],m=n[15],(k=(b=r*s-i*u)*(C=h*m-p*y)-(_=r*c-o*u)*(O=d*m-p*g)+(x=r*f-a*u)*(N=d*y-h*g)+(w=i*c-o*s)*(I=l*m-p*v)-(E=i*f-a*s)*(T=l*y-h*v)+(S=o*f-a*c)*(A=l*g-d*v))?(k=1/k,e[0]=(s*C-c*O+f*N)*k,e[1]=(c*I-u*C-f*T)*k,e[2]=(u*O-s*I+f*A)*k,e[3]=(o*O-i*C-a*N)*k,e[4]=(r*C-o*I+a*T)*k,e[5]=(i*I-r*O-a*A)*k,e[6]=(g*S-y*E+m*w)*k,e[7]=(y*x-v*S-m*_)*k,e[8]=(v*E-g*x+m*b)*k,e):null);if(M.data&&M.data.length)for(var L=0;L<M.data.length;L+=3){var j=Rl(M.data[L],M.data[L+1],M.data[L+2]);Wl(j,j,G),Ul(j,j),$l(M.data)?M.data.set([j[0],j[1],j[2]],L):(M.data[L]=j[0],M.data[L+1]=j[1],M.data[L+2]=j[2])}}}}]),i}($f);!function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.MAX_EXT=32776]="MAX_EXT",t[t.MIN_EXT=32775]="MIN_EXT",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.CULL_FACE=2884]="CULL_FACE",t[t.BLEND=3042]="BLEND",t[t.DITHER=3024]="DITHER",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.TEXTURE1=33985]="TEXTURE1",t[t.TEXTURE2=33986]="TEXTURE2",t[t.TEXTURE3=33987]="TEXTURE3",t[t.TEXTURE4=33988]="TEXTURE4",t[t.TEXTURE5=33989]="TEXTURE5",t[t.TEXTURE6=33990]="TEXTURE6",t[t.TEXTURE7=33991]="TEXTURE7",t[t.TEXTURE8=33992]="TEXTURE8",t[t.TEXTURE9=33993]="TEXTURE9",t[t.TEXTURE10=33994]="TEXTURE10",t[t.TEXTURE11=33995]="TEXTURE11",t[t.TEXTURE12=33996]="TEXTURE12",t[t.TEXTURE13=33997]="TEXTURE13",t[t.TEXTURE14=33998]="TEXTURE14",t[t.TEXTURE15=33999]="TEXTURE15",t[t.TEXTURE16=34e3]="TEXTURE16",t[t.TEXTURE17=34001]="TEXTURE17",t[t.TEXTURE18=34002]="TEXTURE18",t[t.TEXTURE19=34003]="TEXTURE19",t[t.TEXTURE20=34004]="TEXTURE20",t[t.TEXTURE21=34005]="TEXTURE21",t[t.TEXTURE22=34006]="TEXTURE22",t[t.TEXTURE23=34007]="TEXTURE23",t[t.TEXTURE24=34008]="TEXTURE24",t[t.TEXTURE25=34009]="TEXTURE25",t[t.TEXTURE26=34010]="TEXTURE26",t[t.TEXTURE27=34011]="TEXTURE27",t[t.TEXTURE28=34012]="TEXTURE28",t[t.TEXTURE29=34013]="TEXTURE29",t[t.TEXTURE30=34014]="TEXTURE30",t[t.TEXTURE31=34015]="TEXTURE31",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.COPY_SRC=1]="COPY_SRC",t[t.COPY_DST=2]="COPY_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"}(td||(td={}));var fd=(ed=(0,nl.b2)(),nd=(0,nl.f3)(rl.GeometryComponentManager),rd=(0,nl.f3)(rl.RenderEngine),ed((sd=function(){function t(){Bf(this,t),Uf(this,"geometry",ad,this),Uf(this,"engine",ud,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(){var e=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.geometry.forEach((function(t,n){n.dirty&&(n.attributes.forEach((function(t){var n;t.dirty&&t.data&&(t.buffer?null===(n=t.buffer)||void 0===n||n.subData({data:t.data,offset:0}):t.buffer=e.engine.createBuffer({data:t.data,type:td.FLOAT}),t.dirty=!1)})),n.indices&&(n.indicesBuffer?n.indicesBuffer.subData({data:n.indices,offset:0}):n.indicesBuffer=e.engine.createElements({data:n.indices,count:n.indices.length,type:td.UNSIGNED_INT,usage:td.STATIC_DRAW})),n.dirty=!1)}));case 1:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.geometry.forEach((function(t,e){e.indicesBuffer&&e.indicesBuffer.destroy(),e.attributes.forEach((function(t){t.buffer&&t.buffer.destroy()}))})),this.geometry.clear()}},{key:"createBufferGeometry",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{vertexCount:3},e=t.vertexCount,n=Zf();return this.geometry.create(n,{vertexCount:e})}},{key:"createInstancedBufferGeometry",value:function(t){var e=t.maxInstancedCount,n=t.vertexCount,r=Zf();return this.geometry.create(r,{maxInstancedCount:e,vertexCount:n})}}]),t}(),ad=Wf((od=sd).prototype,"geometry",[nd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ud=Wf(od.prototype,"engine",[rd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),id=od))||id);function ld(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function dd(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ld(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ld(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var hd,pd,vd,gd,yd,md,bd,_d,xd,wd,Ed=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).vertexShaderGLSL=void 0,e.fragmentShaderGLSL=void 0,e.defines={},e.dirty=!0,e.uniforms=[],e.cull={enable:!0,face:td.BACK},e.depth={enable:!0},e.blend=void 0,e.entity=void 0,e.type=void 0,Object.assign(fl(e),t),e}return Vf(i,[{key:"setDefines",value:function(t){return this.defines=dd(dd({},this.defines),t),this}},{key:"setCull",value:function(t){return this.cull=t,this}},{key:"setDepth",value:function(t){return this.depth=t,this}},{key:"setBlend",value:function(t){return this.blend=t,this}},{key:"setUniform",value:function(t,e){var n=this;if("string"!=typeof t)return Object.keys(t).forEach((function(e){return n.setUniform(e,t[e])})),this;var r=this.uniforms.find((function(e){return e.name===t}));return r?(r.dirty=!0,r.data=e):this.uniforms.push({name:t,dirty:!0,data:e}),this.dirty=!0,this}}]),i}($f);function Sd(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ad(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Sd(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sd(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Td,Id=(hd=(0,nl.b2)(),pd=(0,nl.f3)(rl.MaterialComponentManager),vd=(0,nl.f3)(rl.RenderEngine),gd=(0,nl.f3)(rl.ShaderModuleService),hd((wd=function(){function t(){Bf(this,t),Uf(this,"material",bd,this),Uf(this,"engine",_d,this),Uf(this,"shaderModule",xd,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.material.clear()}},{key:"createShaderMaterial",value:function(t){var e=Zf(),n=t.vertexShader,r=t.fragmentShader,i=[];if(!this.engine.supportWebGPU){var o="material-".concat(e);this.shaderModule.registerModule(o,{vs:t.vertexShader,fs:t.fragmentShader});var a=this.shaderModule.getModule(o);n=a.vs,r=a.fs,a.uniforms&&(i=Object.keys(a.uniforms).map((function(t){return{dirty:!0,name:t,data:a.uniforms[t]}})))}return this.material.create(e,Ad(Ad({vertexShaderGLSL:n,fragmentShaderGLSL:r},t),{},{uniforms:i}))}}]),t}(),bd=Wf((md=wd).prototype,"material",[pd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_d=Wf(md.prototype,"engine",[vd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xd=Wf(md.prototype,"shaderModule",[gd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),yd=md))||yd);!function(t){t[t.Standard=0]="Standard"}(Td||(Td={}));var Nd=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).strategy=Td.Standard,e.visibilityPlaneMask=0,e.visible=!1,Object.assign(fl(e),t),e}return i}($f),Od=function(){function t(e,n){Bf(this,t),this.center=void 0,this.halfExtents=void 0,this.min=kl(),this.max=kl(),this.update(e,n)}return Vf(t,[{key:"update",value:function(t,e){this.center=t||kl(),this.halfExtents=e||Rl(.5,.5,.5),this.min=Hl(this.min,this.center,this.halfExtents),this.max=Ll(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,e){Ll(this.center,e,t),Fl(this.center,this.center,.5),Hl(this.halfExtents,e,t),Fl(this.halfExtents,this.halfExtents,.5),Pl(this.min,t),Pl(this.max,e)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(t){var e=this.center,n=e[0],r=e[1],i=e[2],o=this.halfExtents,a=o[0],u=o[1],s=o[2],c=n-a,f=n+a,l=r-u,d=r+u,h=i-s,p=i+s,v=t.center,g=v[0],y=v[1],m=v[2],b=t.halfExtents,_=b[0],x=b[1],w=b[2],E=g-_,S=g+_,A=y-x,T=y+x,I=m-w,N=m+w;E<c&&(c=E),S>f&&(f=S),A<l&&(l=A),T>d&&(d=T),I<h&&(h=I),N>p&&(p=N),e[0]=.5*(c+f),e[1]=.5*(l+d),e[2]=.5*(h+p),o[0]=.5*(f-c),o[1]=.5*(d-l),o[2]=.5*(p-h),this.min[0]=c,this.min[1]=l,this.min[2]=h,this.max[0]=f,this.max[1]=d,this.max[2]=p}},{key:"intersects",value:function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return n[0]<=r[0]&&e[0]>=i[0]&&n[1]<=r[1]&&e[1]>=i[1]&&n[2]<=r[2]&&e[2]>=i[2]}},{key:"containsPoint",value:function(t){var e=this.getMin(),n=this.getMax();return!(t[0]<e[0]||t[0]>n[0]||t[1]<e[1]||t[1]>n[1]||t[2]<e[2]||t[2]>n[2])}},{key:"getNegativeFarPoint",value:function(t){return 273===t.pnVertexFlag?Pl(kl(),this.min):272===t.pnVertexFlag?Rl(this.min[0],this.min[1],this.max[2]):257===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.min[2]):256===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.max[2]):17===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.min[2]):16===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.max[2]):1===t.pnVertexFlag?Rl(this.max[0],this.max[1],this.min[2]):Rl(this.max[0],this.max[1],this.max[2])}},{key:"getPositiveFarPoint",value:function(t){return 273===t.pnVertexFlag?Pl(kl(),this.max):272===t.pnVertexFlag?Rl(this.max[0],this.max[1],this.min[2]):257===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.max[2]):256===t.pnVertexFlag?Rl(this.max[0],this.min[1],this.min[2]):17===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.max[2]):16===t.pnVertexFlag?Rl(this.min[0],this.max[1],this.min[2]):1===t.pnVertexFlag?Rl(this.min[0],this.min[1],this.max[2]):Rl(this.min[0],this.min[1],this.min[2])}}]),t}();var Cd,kd=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).material=void 0,e.geometry=void 0,e.aabb=new Od,e.aabbDirty=!0,e.model=void 0,e.visible=!0,e.children=[],Object.assign(fl(e),t),e}return i}($f),Dd=function(){function t(e,n){Bf(this,t),this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=e||0,this.normal=n||Rl(0,1,0),this.updatePNVertexFlag()}return Vf(t,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return Bl(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/ql(this.normal);Fl(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&i<=1;return o&&n&&zl(n,t,e,i),o}}]),t}();!function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"}(Cd||(Cd={}));var Md,Rd,Pd,Gd,Ld,jd,Fd,Ud,Bd,zd,Vd,Wd,Hd,Xd,qd=function(){function t(e){if(Bf(this,t),this.planes=[],e)this.planes=e;else for(var n=0;n<6;n++)this.planes.push(new Dd)}return Vf(t,[{key:"extractFromVPMatrix",value:function(t){var e=el(t,16),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=e[9],d=e[10],h=e[11],p=e[12],v=e[13],g=e[14],y=e[15];Gl(this.planes[0].normal,o-n,c-a,h-f),this.planes[0].distance=-(y-p),Gl(this.planes[1].normal,o+n,c+a,h+f),this.planes[1].distance=-(y+p),Gl(this.planes[2].normal,o+r,c+u,h+l),this.planes[2].distance=-(y+v),Gl(this.planes[3].normal,o-r,c-u,h-l),this.planes[3].distance=-(y-v),Gl(this.planes[4].normal,o-i,c-s,h-d),this.planes[4].distance=-(y-g),Gl(this.planes[5].normal,o+i,c+s,h+d),this.planes[5].distance=-(y+g),this.planes.forEach((function(t){t.normalize(),t.updatePNVertexFlag()}))}}]),t}();function Yd(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Kd(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kd(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Kd(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}var Zd=(Md=(0,nl.b2)(),Rd=(0,nl.f3)(rl.MeshComponentManager),Pd=(0,nl.f3)(rl.CullableComponentManager),Gd=(0,nl.f3)(rl.GeometryComponentManager),Ld=(0,nl.f3)(rl.HierarchyComponentManager),jd=(0,nl.f3)(rl.TransformComponentManager),Md((Xd=function(){function t(){Bf(this,t),Uf(this,"mesh",Bd,this),Uf(this,"cullable",zd,this),Uf(this,"geometry",Vd,this),Uf(this,"hierarchy",Wd,this),Uf(this,"transform",Hd,this),this.planes=void 0}var e;return Vf(t,[{key:"setFrustumPlanes",value:function(t){this.planes=t}},{key:"execute",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y,m,b,_,x,w;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Yd(e);try{for(n.s();!(r=n.n()).done;){i=r.value,o=i.getScene(),a=i.getCamera(),u=Yd(o.getEntities());try{for(u.s();!(s=u.n()).done;)c=s.value,(f=this.mesh.getComponentByEntity(c))&&(l=this.hierarchy.getComponentByEntity(c),d=this.cullable.getComponentByEntity(c),h=f.geometry,p=this.transform.getComponentByEntity(c),h&&h.aabb&&p&&f.aabbDirty&&(v=p.worldTransform,g=h.aabb,y=g.center,m=g.halfExtents,b=Vl(kl(),y,v),E=v,(S=Cl())[0]=E[0],S[1]=E[1],S[2]=E[2],S[3]=E[4],S[4]=E[5],S[5]=E[6],S[6]=E[8],S[7]=E[9],S[8]=E[10],_=S,x=Wl(kl(),m,_),f.aabb.update(b,x),f.aabbDirty=!1),d&&h&&(w=this.cullable.getComponentByEntity((null==l?void 0:l.parentID)||-1),d.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(f.aabb,(null==w?void 0:w.visibilityPlaneMask)||Cd.INDETERMINATE,this.planes||a.getFrustum().planes),d.visible=d.visibilityPlaneMask!==Cd.OUTSIDE))}catch(t){u.e(t)}finally{u.f()}}}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return t.stop()}var E,S}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.cullable.clear(),this.mesh.clear()}},{key:"computeVisibilityWithPlaneMask",value:function(t,e,n){if(e===Cd.OUTSIDE||e===Cd.INSIDE)return e;for(var r=Cd.INSIDE,i=0,o=n.length;i<o;++i){var a=i<31?1<<i:0;if(!(i<31&&0==(e&a))){var u=n[i],s=u.normal,c=u.distance;if(Bl(s,t.getNegativeFarPoint(n[i]))+c>0)return Cd.OUTSIDE;Bl(s,t.getPositiveFarPoint(n[i]))+c>0&&(r|=a)}}return r}}]),t}(),Bd=Wf((Ud=Xd).prototype,"mesh",[Rd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),zd=Wf(Ud.prototype,"cullable",[Pd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Vd=Wf(Ud.prototype,"geometry",[Gd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Wd=Wf(Ud.prototype,"hierarchy",[Ld],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Hd=Wf(Ud.prototype,"transform",[jd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Fd=Ud))||Fd);function $d(){var t=new Tl(16);return Tl!=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 Jd(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 Qd(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 th(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=e[9],d=e[10],h=e[11],p=e[12],v=e[13],g=e[14],y=e[15],m=n*u-r*a,b=n*s-i*a,_=n*c-o*a,x=r*s-i*u,w=r*c-o*u,E=i*c-o*s,S=f*v-l*p,A=f*g-d*p,T=f*y-h*p,I=l*g-d*v,N=l*y-h*v,O=d*y-h*g,C=m*O-b*N+_*I+x*T-w*A+E*S;return C?(C=1/C,t[0]=(u*O-s*N+c*I)*C,t[1]=(i*N-r*O-o*I)*C,t[2]=(v*E-g*w+y*x)*C,t[3]=(d*w-l*E-h*x)*C,t[4]=(s*T-a*O-c*A)*C,t[5]=(n*O-i*T+o*A)*C,t[6]=(g*_-p*E-y*b)*C,t[7]=(f*E-d*_+h*b)*C,t[8]=(a*N-u*T+c*S)*C,t[9]=(r*T-n*N-o*S)*C,t[10]=(p*w-v*_+y*m)*C,t[11]=(l*_-f*w-h*m)*C,t[12]=(u*A-a*I-s*S)*C,t[13]=(n*I-r*A+i*S)*C,t[14]=(v*b-p*x-g*m)*C,t[15]=(f*x-l*b+d*m)*C,t):null}function eh(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],d=e[9],h=e[10],p=e[11],v=e[12],g=e[13],y=e[14],m=e[15],b=n[0],_=n[1],x=n[2],w=n[3];return t[0]=b*r+_*u+x*l+w*v,t[1]=b*i+_*s+x*d+w*g,t[2]=b*o+_*c+x*h+w*y,t[3]=b*a+_*f+x*p+w*m,b=n[4],_=n[5],x=n[6],w=n[7],t[4]=b*r+_*u+x*l+w*v,t[5]=b*i+_*s+x*d+w*g,t[6]=b*o+_*c+x*h+w*y,t[7]=b*a+_*f+x*p+w*m,b=n[8],_=n[9],x=n[10],w=n[11],t[8]=b*r+_*u+x*l+w*v,t[9]=b*i+_*s+x*d+w*g,t[10]=b*o+_*c+x*h+w*y,t[11]=b*a+_*f+x*p+w*m,b=n[12],_=n[13],x=n[14],w=n[15],t[12]=b*r+_*u+x*l+w*v,t[13]=b*i+_*s+x*d+w*g,t[14]=b*o+_*c+x*h+w*y,t[15]=b*a+_*f+x*p+w*m,t}function nh(t,e,n){var r,i,o,a,u,s,c,f,l,d,h,p,v=n[0],g=n[1],y=n[2];return e===t?(t[12]=e[0]*v+e[4]*g+e[8]*y+e[12],t[13]=e[1]*v+e[5]*g+e[9]*y+e[13],t[14]=e[2]*v+e[6]*g+e[10]*y+e[14],t[15]=e[3]*v+e[7]*g+e[11]*y+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],d=e[9],h=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=s,t[6]=c,t[7]=f,t[8]=l,t[9]=d,t[10]=h,t[11]=p,t[12]=r*v+u*g+l*y+e[12],t[13]=i*v+s*g+d*y+e[13],t[14]=o*v+c*g+h*y+e[14],t[15]=a*v+f*g+p*y+e[15]),t}function rh(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function ih(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],u=e[6],s=e[8],c=e[9],f=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,u),t[2]=Math.hypot(s,c,f),t}function oh(t,e){var n=new Tl(3);ih(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,u=e[1]*i,s=e[2]*o,c=e[4]*r,f=e[5]*i,l=e[6]*o,d=e[8]*r,h=e[9]*i,p=e[10]*o,v=a+f+p,g=0;return v>0?(g=2*Math.sqrt(v+1),t[3]=.25*g,t[0]=(l-h)/g,t[1]=(d-s)/g,t[2]=(u-c)/g):a>f&&a>p?(g=2*Math.sqrt(1+a-f-p),t[3]=(l-h)/g,t[0]=.25*g,t[1]=(u+c)/g,t[2]=(d+s)/g):f>p?(g=2*Math.sqrt(1+f-a-p),t[3]=(d-s)/g,t[0]=(u+c)/g,t[1]=.25*g,t[2]=(l+h)/g):(g=2*Math.sqrt(1+p-a-f),t[3]=(u-c)/g,t[0]=(d+s)/g,t[1]=(l+h)/g,t[2]=.25*g),t}function ah(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,u=r+r,s=i+i,c=n*a,f=r*a,l=r*u,d=i*a,h=i*u,p=i*s,v=o*a,g=o*u,y=o*s;return t[0]=1-l-p,t[1]=f+y,t[2]=d-g,t[3]=0,t[4]=f-y,t[5]=1-c-p,t[6]=h+v,t[7]=0,t[8]=d+g,t[9]=h-v,t[10]=1-c-l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}var uh,sh,ch,fh,lh,dh,hh,ph,vh,gh,yh,mh,bh,_h,xh,wh,Eh,Sh,Ah,Th,Ih,Nh,Oh,Ch;function kh(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Dh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Dh(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}var Mh,Rh,Ph,Gh,Lh,jh,Fh,Uh,Bh,zh,Vh,Wh,Hh,Xh=(uh=(0,nl.b2)(),sh=(0,nl.f3)(rl.MeshComponentManager),ch=(0,nl.f3)(rl.GeometryComponentManager),fh=(0,nl.f3)(rl.MaterialComponentManager),lh=(0,nl.f3)(rl.CullableComponentManager),dh=(0,nl.f3)(rl.TransformComponentManager),hh=(0,nl.f3)(rl.HierarchyComponentManager),ph=(0,nl.f3)(rl.Systems),vh=(0,nl.t6)(rl.FrameGraphSystem),gh=(0,nl.f3)(rl.RenderEngine),yh=(0,nl.f3)(rl.ResourcePool),uh((Ch=Oh=function(){function t(){var e=this;Bf(this,t),Uf(this,"mesh",_h,this),Uf(this,"geometry",xh,this),Uf(this,"material",wh,this),Uf(this,"cullable",Eh,this),Uf(this,"transform",Sh,this),Uf(this,"hierarchy",Ah,this),Uf(this,"frameGraphSystem",Th,this),Uf(this,"engine",Ih,this),Uf(this,"resourcePool",Nh,this),this.modelCache={},this.setup=function(t,e,n){var r=t.createRenderTarget(e,"color buffer",{width:1,height:1,usage:td.RENDER_ATTACHMENT|td.SAMPLED|td.COPY_SRC});n.data={output:e.write(t,r)}},this.execute=function(){var t=Yf(Xf().mark((function t(n,r,i){var o,a,u,s,c,f;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n.getResourceNode(r.data.output),a=e.resourcePool.getOrCreateResource(o.resource),u=kh(i),t.prev=3,u.s();case 5:if((s=u.n()).done){t.next=11;break}return c=s.value,t.next=9,e.initView(c);case 9:t.next=5;break;case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(3),u.e(t.t0);case 16:return t.prev=16,u.f(),t.finish(16);case 19:f=e.engine.getCanvas(),a.resize({width:f.width,height:f.height}),e.engine.setScissor({enable:!1}),e.engine.clear({framebuffer:a,color:i[0].getClearColor(),depth:1}),e.engine.useFramebuffer(a,(function(){var t,n=kh(i);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.renderView(r)}}catch(t){n.e(t)}finally{n.f()}}));case 24:case"end":return t.stop()}}),t,null,[[3,13,16,19]])})));return function(e,n,r){return t.apply(this,arguments)}}()}var e,n;return Vf(t,[{key:"renderView",value:function(t){var e=t.getScene(),n=t.getCamera(),r=n.getViewTransform(),i=eh($d(),n.getPerspective(),r);n.getFrustum().extractFromVPMatrix(i);var o=t.getViewport(),a=o.x,u=o.y,s=o.width,c=o.height;this.engine.viewport({x:a,y:u,width:s,height:c});var f,l=kh(e.getEntities());try{for(l.s();!(f=l.n()).done;){var d=f.value;this.renderMesh(d,{camera:n,view:t,viewMatrix:r})}}catch(t){l.e(t)}finally{l.f()}}},{key:"renderMesh",value:function(t,e){var n=e.camera,r=e.view,i=e.viewMatrix,o=this.mesh.getComponentByEntity(t);if(o&&o.visible){var a=o.material,u=o.geometry;if(u&&!u.dirty&&a){var s=this.transform.getComponentByEntity(t),c=eh($d(),i,s.worldTransform),f=r.getViewport(),l=f.width,d=f.height;a.setUniform({projectionMatrix:n.getPerspective(),modelViewMatrix:c,modelMatrix:s.worldTransform,viewMatrix:i,cameraPosition:n.getPosition(),u_viewport:[l,d]}),o.model&&(o.model.draw({uniforms:a.uniforms.reduce((function(t,e){return t[e.name]=e.data,t}),{})}),a.uniforms.forEach((function(t){t.dirty=!1})),a.dirty=!1)}}}},{key:"initMesh",value:(n=Yf(Xf().mark((function t(e,n){var r,i,o,a,u,s,c,f;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.mesh.getComponentByEntity(e)){t.next=3;break}return t.abrupt("return");case 3:if(i=r.material,(o=r.geometry)&&!o.dirty&&i){t.next=7;break}return t.abrupt("return");case 7:if(r.model){t.next=24;break}if(a="m-".concat(i.entity,"-g-").concat(o.entity),!this.modelCache[a]){t.next=12;break}return r.model=this.modelCache[a],t.abrupt("return");case 12:return i.setUniform({projectionMatrix:1,modelViewMatrix:1,modelMatrix:1,viewMatrix:1,cameraPosition:1,u_viewport:1}),u=this.engine,s=u.createModel,c=u.createAttribute,f={vs:i.vertexShaderGLSL,fs:i.fragmentShaderGLSL,defines:i.defines,attributes:o.attributes.reduce((function(t,e){return e.data&&e.buffer&&(t[e.name]=c({buffer:e.buffer,attributes:e.attributes,arrayStride:e.arrayStride,stepMode:e.stepMode,divisor:"vertex"===e.stepMode?0:1})),t}),{}),uniforms:i.uniforms.reduce((function(t,e){return t[e.name]=e.data,t}),{}),scissor:{enable:!0,box:function(){return n.getViewport()}}},i.cull&&(f.cull=i.cull),i.depth&&(f.depth=i.depth),i.blend&&(f.blend=i.blend),o.indicesBuffer&&(f.elements=o.indicesBuffer),o.maxInstancedCount&&(f.instances=o.maxInstancedCount,f.count=o.vertexCount||3),t.next=22,s(f);case 22:r.model=t.sent,this.modelCache[a]=r.model;case 24:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"initView",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.getScene(),r=kh(n.getEntities()),t.prev=2,r.s();case 4:if((i=r.n()).done){t.next=10;break}return o=i.value,t.next=8,this.initMesh(o,e);case 8:t.next=4;break;case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(2),r.e(t.t0);case 15:return t.prev=15,r.f(),t.finish(15);case 18:case"end":return t.stop()}}),t,this,[[2,12,15,18]])}))),function(t){return e.apply(this,arguments)})}]),t}(),Oh.IDENTIFIER="Render Pass",_h=Wf((bh=Ch).prototype,"mesh",[sh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xh=Wf(bh.prototype,"geometry",[ch],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),wh=Wf(bh.prototype,"material",[fh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Eh=Wf(bh.prototype,"cullable",[lh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sh=Wf(bh.prototype,"transform",[dh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ah=Wf(bh.prototype,"hierarchy",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Th=Wf(bh.prototype,"frameGraphSystem",[ph,vh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ih=Wf(bh.prototype,"engine",[gh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Nh=Wf(bh.prototype,"resourcePool",[yh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),mh=bh))||mh);function qh(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Yh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Yh(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}var Kh,Zh,$h,Jh,Qh,tp,ep,np,rp,ip,op,ap,up,sp,cp,fp,lp,dp,hp,pp,vp,gp,yp=(Mh=(0,nl.b2)(),Rh=(0,nl.f3)(rl.RenderEngine),Ph=(0,nl.f3)(rl.ResourcePool),Gh=(0,nl.f3)(rl.RenderPassFactory),Lh=(0,nl.f3)(rl.MeshComponentManager),Mh((Hh=Wh=function(){function t(){var e=this;Bf(this,t),Uf(this,"engine",Uh,this),Uf(this,"resourcePool",Bh,this),Uf(this,"renderPassFactory",zh,this),Uf(this,"mesh",Vh,this),this.pickingFBO=void 0,this.views=void 0,this.highlightEnabled=!0,this.highlightColor=[255,0,0,255],this.alreadyInRendering=!1,this.setup=function(t,e,n){var r=t.createRenderTarget(e,"picking fbo",{width:1,height:1});n.data={output:e.write(t,r)},e.hasSideEffect=!0},this.execute=function(){var t=Yf(Xf().mark((function t(n,r,i){var o,a,u;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.views=i,!e.alreadyInRendering){t.next=3;break}return t.abrupt("return");case 3:o=qh(i);try{for(u=function(){var t=a.value,i=t.getViewport(),o=i.width,u=i.height;e.alreadyInRendering=!0;var s=n.getResourceNode(r.data.output);e.pickingFBO=e.resourcePool.getOrCreateResource(s.resource),e.pickingFBO.resize({width:o,height:u}),e.engine.useFramebuffer(e.pickingFBO,(function(){e.engine.clear({framebuffer:e.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});var n,r=e.renderPassFactory(Xh.IDENTIFIER),i=[],o=qh(t.getScene().getEntities());try{for(o.s();!(n=o.n()).done;){var a=n.value,u=e.mesh.getComponentByEntity(a);u.material.setUniform("u_PickingStage",1),i.push(u)}}catch(t){o.e(t)}finally{o.f()}r.renderView(t),i.forEach((function(t){t.material.setUniform("u_PickingStage",2)})),e.alreadyInRendering=!1}))},o.s();!(a=o.n()).done;)u()}catch(t){o.e(t)}finally{o.f()}case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),this.pick=function(t,n){var r,i,o=t.x,a=t.y,u=e.engine,s=u.readPixels,c=u.useFramebuffer,f=n.getViewport(),l=f.width,d=f.height,h=o*window.devicePixelRatio,p=a*window.devicePixelRatio;if(!(h>l||h<0||p>d||p<0))return c(e.pickingFBO,(function(){var t;0===(r=s({x:Math.round(h),y:Math.round(d-(a+1)*window.devicePixelRatio),width:1,height:1,data:new Uint8Array(4),framebuffer:e.pickingFBO}))[0]&&0===r[1]&&0===r[2]||(t=el(r,3),i=t[0]+256*t[1]+65536*t[2]-1,e.highlightEnabled&&e.highlightPickedFeature(r,n))})),i}}return Vf(t,[{key:"enableHighlight",value:function(t){this.highlightEnabled=t}},{key:"setHighlightColor",value:function(t){this.highlightColor=t}},{key:"highlightPickedFeature",value:function(t,e){if(t){var n,r=qh(e.getScene().getEntities());try{for(r.s();!(n=r.n()).done;){var i=n.value,o=this.mesh.getComponentByEntity(i).material;o.setUniform("u_PickingStage",2),o.setUniform("u_PickingColor",[t[0],t[1],t[2]]),o.setUniform("u_HighlightColor",this.highlightColor)}}catch(t){r.e(t)}finally{r.f()}}}}]),t}(),Wh.IDENTIFIER="PixelPicking Pass",Uh=Wf((Fh=Hh).prototype,"engine",[Rh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Bh=Wf(Fh.prototype,"resourcePool",[Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),zh=Wf(Fh.prototype,"renderPassFactory",[Gh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Vh=Wf(Fh.prototype,"mesh",[Lh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),jh=Fh))||jh),mp=(Kh=(0,nl.b2)(),Zh=(0,nl.f3)(rl.RenderEngine),$h=(0,nl.f3)(rl.ResourcePool),Kh((rp=np=function t(){var e=this;Bf(this,t),Uf(this,"engine",tp,this),Uf(this,"resourcePool",ep,this),this.model=void 0,this.setup=function(t,e,n){var r=t.getPass(Xh.IDENTIFIER);if(r){var i=t.createRenderTarget(e,"render to screen",{width:1,height:1});n.data={input:e.read(r.data.output),output:e.write(t,i)}}},this.execute=function(){var t=Yf(Xf().mark((function t(n,r){var i,o,a,u,s,c,f;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=e.engine,o=i.createModel,a=i.createAttribute,u=i.createBuffer,e.model){t.next=6;break}return t.next=4,o({vs:e.engine.supportWebGPU?"layout(location = 0) in vec2 a_Position;\nlayout(location = 0) out vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}":"attribute vec2 a_Position;\n\nvarying vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}",fs:e.engine.supportWebGPU?"layout(set = 0, binding = 0) uniform sampler u_TextureSampler;\nlayout(set = 0, binding = 1) uniform texture2D u_Texture;\n\nlayout(location = 0) in vec2 v_UV;\nlayout(location = 0) out vec4 outColor;\n\nvoid main() {\n outColor = texture(sampler2D(u_Texture, u_TextureSampler), v_UV);\n}":"varying vec2 v_UV;\n\nuniform sampler2D u_Texture;\n\nvoid main() {\n gl_FragColor = vec4(texture2D(u_Texture, v_UV));\n}",attributes:{a_Position:a({buffer:u({data:[-4,-4,4,-4,0,4],type:td.FLOAT}),size:2,arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})},uniforms:{u_Texture:null},depth:{enable:!1},count:3,blend:{enable:!0}});case 4:s=t.sent,e.model=s;case 6:c=n.getResourceNode(r.data.input),f=e.resourcePool.getOrCreateResource(c.resource),e.engine.useFramebuffer(null,(function(){e.engine.clear({framebuffer:null,color:[0,0,0,0],depth:1,stencil:0}),e.model.draw({uniforms:{u_Texture:f}})}));case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),this.tearDown=function(){e.model=void 0}},np.IDENTIFIER="Copy Pass",tp=Wf((Qh=rp).prototype,"engine",[Zh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ep=Wf(Qh.prototype,"resourcePool",[$h],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Jh=Qh))||Jh),bp=(ip=(0,nl.b2)(),op=(0,nl.f3)(rl.Systems),ap=(0,nl.t6)(rl.FrameGraphSystem),up=(0,nl.f3)(rl.RenderPassFactory),sp=(0,nl.f3)(rl.ConfigService),cp=(0,nl.f3)(rl.ResourcePool),ip((gp=function(){function t(){Bf(this,t),Uf(this,"frameGraphSystem",dp,this),Uf(this,"renderPassFactory",hp,this),Uf(this,"configService",pp,this),Uf(this,"resourcePool",vp,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(e){var n,r,i,o,a,u,s,c;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.renderPassFactory(Xh.IDENTIFIER),r=n.setup,i=n.execute,this.frameGraphSystem.addPass(Xh.IDENTIFIER,r,i),o=this.renderPassFactory(mp.IDENTIFIER),a=o.setup,u=o.execute,s=o.tearDown,c=this.frameGraphSystem.addPass(mp.IDENTIFIER,a,u,s),this.frameGraphSystem.present(c.data.output);case 5:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.resourcePool.clean()}},{key:"pick",value:function(t,e){return this.renderPassFactory(yp.IDENTIFIER).pick(t,e)}}]),t}(),dp=Wf((lp=gp).prototype,"frameGraphSystem",[op,ap],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),hp=Wf(lp.prototype,"renderPassFactory",[up],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),pp=Wf(lp.prototype,"configService",[sp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vp=Wf(lp.prototype,"resourcePool",[cp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),fp=lp))||fp);var _p,xp,wp,Ep,Sp,Ap,Tp,Ip,Np,Op,Cp=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).parentID=void 0,Object.assign(fl(e),t),e}return i}($f),kp=(_p=(0,nl.b2)(),xp=(0,nl.f3)(rl.HierarchyComponentManager),wp=(0,nl.f3)(rl.TransformComponentManager),Ep=(0,nl.f3)(rl.MeshComponentManager),_p((Op=function(){function t(){Bf(this,t),Uf(this,"hierarchy",Tp,this),Uf(this,"transform",Ip,this),Uf(this,"mesh",Np,this)}var e;return Vf(t,[{key:"execute",value:(e=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.runTransformUpdateSystem(),this.runHierarchyUpdateSystem();case 2:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.hierarchy.clear(),this.transform.clear()}},{key:"getHierarchyComponentManager",value:function(){return this.hierarchy}},{key:"getTransformComponentManager",value:function(){return this.transform}},{key:"runTransformUpdateSystem",value:function(){var t=this;this.transform.forEach((function(e,n){(n.isDirty()||n.isLocalDirty())&&(t.setMeshAABBDirty(t.mesh.getComponentByEntity(e)),n.updateTransform())}))}},{key:"runHierarchyUpdateSystem",value:function(){var t=this;this.hierarchy.forEach((function(e,n){var r=t.transform.getComponentByEntity(e),i=t.transform.getComponentByEntity(n.parentID);null!==r&&null!==i&&r.updateTransformWithParent(i)}))}},{key:"attach",value:function(t,e,n){this.hierarchy.contains(t)&&this.detach(t),this.hierarchy.create(t,{parentID:e});var r=this.mesh.getComponentByEntity(e);if(this.setMeshAABBDirty(r),r&&-1===r.children.indexOf(t)&&r.children.push(t),this.hierarchy.getCount()>1)for(var i=this.hierarchy.getCount()-1;i>0;--i)for(var o=this.hierarchy.getEntity(i),a=0;a<i;++a)if(this.hierarchy.getComponent(a).parentID===o){this.hierarchy.moveItem(i,a),++i;break}this.hierarchy.getComponentByEntity(t);var u=this.transform.getComponentByEntity(e);null===u&&(u=this.transform.create(e));var s=this.transform.getComponentByEntity(t);null===s&&(s=this.transform.create(t),u=this.transform.getComponentByEntity(e)),s.parent=u,!n&&u&&(s.matrixTransform(th($d(),u.worldTransform)),s.updateTransform()),u&&s.updateTransformWithParent(u)}},{key:"detach",value:function(t){var e=this.hierarchy.getComponentByEntity(t);if(null!==e){var n=this.transform.getComponentByEntity(t);null!==n&&(n.parent=null,n.applyTransform()),this.hierarchy.removeKeepSorted(t);var r=this.mesh.getComponentByEntity(e.parentID);if(r){var i=r.children.indexOf(t);r.children.splice(i,1)}this.setMeshAABBDirty(r)}}},{key:"detachChildren",value:function(t){var e=this.mesh.getComponentByEntity(t);e&&(e.children=[]);for(var n=0;n<this.hierarchy.getCount();){var r;if((null===(r=this.hierarchy.getComponent(n))||void 0===r?void 0:r.parentID)===t){var i=this.hierarchy.getEntity(n);this.detach(i)}else++n}}},{key:"setMeshAABBDirty",value:function(t){t&&(t.aabbDirty=!0)}}]),t}(),Tp=Wf((Ap=Op).prototype,"hierarchy",[xp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ip=Wf(Ap.prototype,"transform",[wp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Np=Wf(Ap.prototype,"mesh",[Ep],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sp=Ap))||Sp);function Dp(){var t=new Tl(4);return Tl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Mp(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 Rp(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=n[0],s=n[1],c=n[2],f=n[3];return t[0]=r*f+a*u+i*c-o*s,t[1]=i*f+a*s+o*u-r*c,t[2]=o*f+a*c+r*s-i*u,t[3]=a*f-r*u-i*s-o*c,t}function Pp(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,u=a?1/a:0;return t[0]=-n*u,t[1]=-r*u,t[2]=-i*u,t[3]=o*u,t}function Gp(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var o=Math.sin(e),a=Math.cos(e),u=Math.sin(n),s=Math.cos(n),c=Math.sin(r),f=Math.cos(r);return t[0]=o*s*f-a*u*c,t[1]=a*u*f+o*s*c,t[2]=a*s*c-o*u*f,t[3]=a*s*f+o*u*c,t}var Lp=Nl,jp=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Fp=Rp,Up=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t};kl(),Rl(1,0,0),Rl(0,1,0),Dp(),Dp(),Cl();var Bp=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e,n,o,a,u,s,c,f,l,d,h,p,v,g,y;return Bf(this,i),(e=r.call(this,t)).dirtyFlag=void 0,e.localDirtyFlag=void 0,e.parent=null,e.localPosition=Rl(0,0,0),e.localRotation=Lp(0,0,0,1),e.localScale=Rl(1,1,1),e.localTransform=$d(),e.position=Rl(0,0,0),e.rotation=Lp(0,0,0,1),e.scaling=Rl(1,1,1),e.worldTransform=$d(),e.matrixTransform=(n=$d(),function(t){eh(n,e.getLocalTransform(),t),ih(e.localScale,n),rh(e.localPosition,n),oh(e.localRotation,n)}),e.rotateRollPitchYaw=(o=Dp(),a=Dp(),u=Dp(),function(t,n,r){e.setDirty(),Gp(o,t,0,0),Gp(a,0,n,0),Gp(u,0,0,r),Rp(e.localRotation,o,e.localRotation),Rp(e.localRotation,e.localRotation,a),Rp(e.localRotation,u,e.localRotation),Up(e.localRotation,e.localRotation)}),e.lerp=(s=kl(),c=Dp(),f=kl(),l=kl(),d=Dp(),h=kl(),function(t,n,r){e.setDirty(),ih(s,t.worldTransform),rh(f,t.worldTransform),oh(c,t.worldTransform),ih(l,n.worldTransform),rh(h,n.worldTransform),oh(d,n.worldTransform),zl(e.localScale,s,l,r),function(t,e,n,r){var i,o,a,u,s,c=e[0],f=e[1],l=e[2],d=e[3],h=n[0],p=n[1],v=n[2],g=n[3];(o=c*h+f*p+l*v+d*g)<0&&(o=-o,h=-h,p=-p,v=-v,g=-g),1-o>Al?(i=Math.acos(o),a=Math.sin(i),u=Math.sin((1-r)*i)/a,s=Math.sin(r*i)/a):(u=1-r,s=r),t[0]=u*c+s*h,t[1]=u*f+s*p,t[2]=u*l+s*v,t[3]=u*d+s*g}(e.localRotation,c,d,r),zl(e.localPosition,f,h,r)}),e.translate=(y=kl(),function(t){return Ll(y,e.getPosition(),t),e.setPosition(y),e.setDirty(!0),fl(e)}),e.translateLocal=function(t){return function(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],u=e[0],s=e[1],c=e[2],f=i*c-o*s,l=o*u-r*c,d=r*s-i*u,h=i*d-o*l,p=o*f-r*d,v=r*l-i*f,g=2*a;f*=g,l*=g,d*=g,h*=2,p*=2,v*=2,t[0]=u+f+h,t[1]=s+l+p,t[2]=c+d+v}(t,t,e.localRotation),Ll(e.localPosition,e.localPosition,t),e.setLocalDirty(!0),fl(e)},e.setPosition=(p=$d(),function(t){return e.position=t,e.setLocalDirty(!0),null===e.parent?Pl(e.localPosition,t):(Jd(p,e.parent.worldTransform),th(p,p),Vl(e.localPosition,t,p)),fl(e)}),e.rotate=(v=Dp(),function(t){if(null===e.parent)Rp(e.localRotation,e.localRotation,t),Up(e.localRotation,e.localRotation);else{var n=e.getRotation(),r=e.parent.getRotation();jp(v,r),Pp(v,v),Rp(v,v,t),Rp(e.localRotation,t,n),Up(e.localRotation,e.localRotation)}return e.setLocalDirty(),fl(e)}),e.rotateLocal=function(t){return Rp(e.localRotation,e.localRotation,t),Up(e.localRotation,e.localRotation),e.setLocalDirty(!0),fl(e)},e.setRotation=(g=Dp(),function(t){return null===e.parent?jp(e.localRotation,t):(jp(g,e.parent.getRotation()),Pp(g,g),jp(e.localRotation,g),Fp(e.localRotation,e.localRotation,t)),e.setLocalDirty(!0),fl(e)}),e}return Vf(i,[{key:"setLocalPosition",value:function(t){Pl(this.localPosition,t),this.setLocalDirty(!0)}},{key:"setLocalScale",value:function(t){Pl(this.localScale,t),this.setLocalDirty(!0)}},{key:"setLocalRotation",value:function(t){return jp(this.localRotation,t),this.setLocalDirty(!0),this}},{key:"isDirty",value:function(){return this.dirtyFlag}},{key:"setDirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t?this.dirtyFlag|=i.DIRTY:this.dirtyFlag&=~i.DIRTY}},{key:"isLocalDirty",value:function(){return this.localDirtyFlag}},{key:"setLocalDirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t?(this.localDirtyFlag|=i.DIRTY,this.setDirty(!0)):this.localDirtyFlag&=~i.DIRTY}},{key:"updateTransform",value:function(){this.isLocalDirty()&&this.getLocalTransform(),this.isDirty()&&null===this.parent&&(Jd(this.worldTransform,this.getLocalTransform()),this.setDirty(!1))}},{key:"updateTransformWithParent",value:function(t){eh(this.worldTransform,t.worldTransform,this.getLocalTransform())}},{key:"applyTransform",value:function(){this.setDirty(),ih(this.localScale,this.worldTransform),rh(this.localPosition,this.worldTransform),oh(this.localRotation,this.worldTransform)}},{key:"clearTransform",value:function(){this.setDirty(),this.localPosition=Rl(0,0,0),this.localRotation=Lp(0,0,0,1),this.localScale=Rl(1,1,1)}},{key:"scaleLocal",value:function(t){return this.setLocalDirty(),e=this.localScale,n=this.localScale,r=t,e[0]=n[0]*r[0],e[1]=n[1]*r[1],e[2]=n[2]*r[2],this;var e,n,r}},{key:"getLocalPosition",value:function(){return this.localPosition}},{key:"getLocalRotation",value:function(){return this.localRotation}},{key:"getLocalScale",value:function(){return this.localScale}},{key:"getLocalTransform",value:function(){return this.localDirtyFlag&&(function(t,e,n,r){var i=e[0],o=e[1],a=e[2],u=e[3],s=i+i,c=o+o,f=a+a,l=i*s,d=i*c,h=i*f,p=o*c,v=o*f,g=a*f,y=u*s,m=u*c,b=u*f,_=r[0],x=r[1],w=r[2];t[0]=(1-(p+g))*_,t[1]=(d+b)*_,t[2]=(h-m)*_,t[3]=0,t[4]=(d-b)*x,t[5]=(1-(l+g))*x,t[6]=(v+y)*x,t[7]=0,t[8]=(h+m)*w,t[9]=(v-y)*w,t[10]=(1-(l+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1}(this.localTransform,this.localRotation,this.localPosition,this.localScale),this.setLocalDirty(!1)),this.localTransform}},{key:"getWorldTransform",value:function(){return this.isLocalDirty()||this.isDirty()?(this.parent&&this.parent.getWorldTransform(),this.updateTransform(),this.worldTransform):this.worldTransform}},{key:"getPosition",value:function(){return rh(this.position,this.worldTransform),this.position}},{key:"getRotation",value:function(){return oh(this.rotation,this.worldTransform),this.rotation}},{key:"getScale",value:function(){return ih(this.scaling,this.worldTransform),this.scaling}}]),i}($f);Bp.DIRTY=1;var zp,Vp,Wp,Hp,Xp,qp,Yp=n(1922),Kp=(zp=(0,nl.b2)(),Vp=(0,nl.f3)(rl.RenderEngine),zp((qp=function(){function t(){Bf(this,t),Uf(this,"engine",Xp,this),this.resourcePool={}}return Vf(t,[{key:"getOrCreateResource",value:function(t){if(!this.resourcePool[t.name]){var e=t.descriptor,n=e.width,r=e.height,i=e.usage;this.resourcePool[t.name]=this.engine.createFramebuffer({color:this.engine.createTexture2D({width:n,height:r,wrapS:td.CLAMP_TO_EDGE,wrapT:td.CLAMP_TO_EDGE,usage:i})})}return this.resourcePool[t.name]}},{key:"clean",value:function(){this.resourcePool={}}}]),t}(),Xp=Wf((Hp=qp).prototype,"engine",[Vp],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Wp=Hp))||Wp);var Zp,$p,Jp,Qp,tv=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(t){var e;return Bf(this,i),(e=r.call(this,t)).name=void 0,e.name=t.name||"",e}return i}($f),ev=(0,nl.b2)()(($p=function(){function t(){Bf(this,t),this.config=void 0}return Vf(t,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),t}(),Zp=$p))||Zp;!function(t){t.PANSTART="PANSTART",t.PANEND="PANEND",t.PANMOVE="PANMOVE",t.PINCH="PINCH",t.KEYDOWN="KEYDOWN",t.KEYUP="KEYUP",t.HOVER="HOVER"}(Qp||(Qp={}));var nv,rv,iv=(0,nl.b2)()(Jp=function(){function t(){Bf(this,t)}return Vf(t,[{key:"listen",value:function(t){}},{key:"on",value:function(t,e){}},{key:"connect",value:function(){}},{key:"disconnect",value:function(){}},{key:"destroy",value:function(){}}]),t}())||Jp,ov=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function av(t){var e={};return{content:t=t.replace(ov,(function(t,n,r){var i=r.split(":"),o=i[0].trim(),a="";switch(i.length>1&&(a=i[1].trim()),n){case"bool":a="true"===a;break;case"float":case"int":a=Number(a);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":a=a?a.replace("[","").replace("]","").split(",").reduce((function(t,e){return t.push(Number(e.trim())),t}),[]):new Array(function(t){var e=0;switch(t){case"vec2":case"ivec2":e=2;break;case"vec3":case"ivec3":e=3;break;case"vec4":case"ivec4":case"mat2":e=4;break;case"mat3":e=9;break;case"mat4":e=16}return e}(n)).fill(0)}return e[o]=a,"uniform ".concat(n," ").concat(o,";\n")})),uniforms:e}}function uv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function sv(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?uv(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uv(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var cv=/precision\s+(high|low|medium)p\s+float/,fv=/#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g,lv=(0,nl.b2)()((rv=function(){function t(){Bf(this,t),this.moduleCache={},this.rawContentCache={}}return Vf(t,[{key:"registerBuiltinModules",value:function(){this.destroy(),this.registerModule("picking",{vs:"attribute vec3 a_PickingColor;\nvarying vec4 v_PickingResult;\n\nuniform vec3 u_PickingColor : [0, 0, 0];\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\nuniform float u_PickingThreshold : 1.0;\nuniform float u_PickingBuffer: 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n abs(vertexColor.r - u_PickingColor.r) < u_PickingThreshold &&\n abs(vertexColor.g - u_PickingColor.g) < u_PickingThreshold &&\n abs(vertexColor.b - u_PickingColor.b) < u_PickingThreshold;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n // compares only in highlight stage\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}",fs:"varying vec4 v_PickingResult;\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 filterHighlightColor(vec4 color) {\n bool selected = bool(v_PickingResult.a);\n\n if (selected) {\n vec4 highLightColor = u_HighlightColor * COLOR_SCALE;\n\n float highLightAlpha = highLightColor.a;\n float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));\n\n vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);\n return vec4(resultRGB, color.a);\n } else {\n return color;\n }\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 filterPickingColor(vec4 color) {\n vec3 pickingColor = v_PickingResult.rgb;\n if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {\n discard;\n }\n return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;\n}\n\n/*\n * Returns picking color if picking is enabled if not\n * highlight color if this item is selected, otherwise unmodified argument.\n */\nvec4 filterColor(vec4 color) {\n return filterPickingColor(filterHighlightColor(color));\n}\n"}),this.registerModule("sdf2d",{vs:"",fs:"/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat sdEquilateralTriangle(vec2 p) {\n float k = sqrt(3.0);\n p.x = abs(p.x) - 1.0;\n p.y = p.y + 1.0/k;\n if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;\n p.x -= clamp( p.x, -2.0, 0.0 );\n return -length(p)*sign(p.y);\n}\n\nfloat sdBox(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);\n}\n\nfloat sdPentagon(vec2 p, float r) {\n vec3 k = vec3(0.809016994,0.587785252,0.726542528);\n p.x = abs(p.x);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagon(vec2 p, float r) {\n vec3 k = vec3(-0.866025404,0.5,0.577350269);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdOctogon(vec2 p, float r) {\n vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );\n p = abs(p);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagram(vec2 p, float r) {\n vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;\n p -= vec2(clamp(p.x,r*k.z,r*k.w),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdRhombus(vec2 p, vec2 b) {\n vec2 q = abs(p);\n float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);\n float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );\n return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );\n}\n\nfloat sdVesica(vec2 p, float r, float d) {\n p = abs(p);\n float b = sqrt(r*r-d*d); // can delay this sqrt\n return ((p.y-b)*d>p.x*b)\n ? length(p-vec2(0.0,b))\n : length(p-vec2(-d,0.0))-r;\n}"})}},{key:"registerModule",value:function(t,e){if(!this.rawContentCache[t]){var n=e.vs,r=void 0===n?"":n,i=e.fs,o=void 0===i?"":i,a=e.uniforms,u=av(r),s=u.content,c=u.uniforms,f=av(o),l=f.content,d=f.uniforms;this.rawContentCache[t]={fs:l,uniforms:sv(sv(sv({},c),d),a),vs:s}}}},{key:"destroy",value:function(){this.moduleCache={},this.rawContentCache={}}},{key:"getModule",value:function(t){var e=this;if(this.moduleCache[t])return this.moduleCache[t];var n,r=this.rawContentCache[t].vs||"",i=this.rawContentCache[t].fs||"",o=this.processModule(r,[],"vs"),a=o.content,u=o.includeList,s=this.processModule(i,[],"fs"),c=s.content,f=s.includeList,l=c,d=(n=u.concat(f).concat(t),n.filter((function(t,e,n){return n.indexOf(t)===e}))).reduce((function(t,n){return sv(sv({},t),e.rawContentCache[n].uniforms)}),{});return cv.test(c)||(l="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n#endif\n"+c),this.moduleCache[t]={fs:l.trim(),uniforms:d,vs:a.trim()},this.moduleCache[t]}},{key:"processModule",value:function(t,e,n){var r=this;return{content:t.replace(fv,(function(t,i){var o=i.split(" ")[0].replace(/"/g,"");if(e.indexOf(o)>-1)return"";var a=r.rawContentCache[o][n];return e.push(o),r.processModule(a||"",e,n).content})),includeList:e}}}]),t}(),nv=rv))||nv,dv=new nl.W2;function hv(){var t=new nl.W2;return t.parent=dv,t.bind(rl.Systems).to(kp).inSingletonScope().whenTargetNamed(rl.SceneGraphSystem),t.bind(rl.Systems).to(El).inSingletonScope().whenTargetNamed(rl.FrameGraphSystem),t.bind(rl.Systems).to(Zd).inSingletonScope().whenTargetNamed(rl.MeshSystem),t.bind(rl.Systems).to(fd).inSingletonScope().whenTargetNamed(rl.GeometrySystem),t.bind(rl.Systems).to(Id).inSingletonScope().whenTargetNamed(rl.MaterialSystem),t.bind(rl.Systems).to(bp).inSingletonScope().whenTargetNamed(rl.RendererSystem),t.bind(rl.ResourcePool).to(Kp).inSingletonScope(),t.bind(rl.ConfigService).to(ev).inSingletonScope(),t.bind(rl.InteractorService).to(iv).inSingletonScope(),t.bind(rl.RenderPass).to(Xh).inSingletonScope().whenTargetNamed(Xh.IDENTIFIER),t.bind(rl.RenderPass).to(mp).inSingletonScope().whenTargetNamed(mp.IDENTIFIER),t.bind(rl.RenderPass).to(yp).inSingletonScope().whenTargetNamed(yp.IDENTIFIER),t.bind(rl.RenderPassFactory).toFactory((function(t){return function(e){return t.container.getNamed(rl.RenderPass,e)}})),t}function pv(t){for(var e=new Od,n=Rl(t[0],t[1],t[2]),r=Rl(t[0],t[1],t[2]),i=3;i<t.length;){var o=t[i++],a=t[i++],u=t[i++];o<n[0]&&(n[0]=o),a<n[1]&&(n[1]=a),u<n[2]&&(n[2]=u),o>r[0]&&(r[0]=o),a>r[1]&&(r[1]=a),u>r[2]&&(r[2]=u)}return e.setMinMax(n,r),e}(0,Yp.Z)(dv,!1),dv.bind(rl.ShaderModuleService).to(lv).inSingletonScope(),dv.bind(rl.NameComponentManager).toConstantValue(new Jf(tv)),dv.bind(rl.HierarchyComponentManager).toConstantValue(new Jf(Cp)),dv.bind(rl.TransformComponentManager).toConstantValue(new Jf(Bp)),dv.bind(rl.MeshComponentManager).toConstantValue(new Jf(kd)),dv.bind(rl.CullableComponentManager).toConstantValue(new Jf(Nd)),dv.bind(rl.GeometryComponentManager).toConstantValue(new Jf(cd)),dv.bind(rl.MaterialComponentManager).toConstantValue(new Jf(Ed));var vv,gv,yv,mv,bv,_v="undefined"!=typeof navigator&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);function xv(t){return"number"==typeof t}function wv(t){return void 0===t?0:t>360||t<-360?t%360:t}function Ev(t,e,n){return xv(t)?Rl(t,e,n):3===t.length?Dl(t):Rl(t[0],t[1],t[2])}kl(),kl(),kl(),kl(),kl(),kl(),n(2697),n(1894),n(1186),n(5275),n(2862),n(9633),function(t){t.Normal="normal",t.PostProcessing="post-processing"}(vv||(vv={})),n(7222),n(5965),n(2391),n(3945),n(7294),n(9586),function(t){t.Void="Void",t.Boolean="Boolean",t.Float="Float",t.Uint32="Uint32",t.Int32="Int32",t.Vector="Vector",t.Vector2Float="vec2<f32>",t.Vector3Float="vec3<f32>",t.Vector4Float="vec4<f32>",t.Vector2Boolean="vec2<bool>",t.Vector3Boolean="vec3<bool>",t.Vector4Boolean="vec4<bool>",t.Vector2Uint="vec2<u32>",t.Vector3Uint="vec3<u32>",t.Vector4Uint="vec4<u32>",t.Vector2Int="vec2<i32>",t.Vector3Int="vec3<i32>",t.Vector4Int="vec4<i32>",t.Matrix="Matrix",t.Matrix3x3Float="mat3x3<f32>",t.Matrix4x4Float="mat4x4<i32>",t.Struct="Struct",t.FloatArray="Float[]",t.Vector4FloatArray="vec4<f32>[]"}(gv||(gv={})),function(t){t.Program="Program",t.Identifier="Identifier",t.VariableDeclaration="VariableDeclaration",t.BlockStatement="BlockStatement",t.ReturnStatement="ReturnStatement",t.FunctionDeclaration="FunctionDeclaration",t.VariableDeclarator="VariableDeclarator",t.AssignmentExpression="AssignmentExpression",t.LogicalExpression="LogicalExpression",t.BinaryExpression="BinaryExpression",t.ArrayExpression="ArrayExpression",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.FunctionExpression="FunctionExpression",t.MemberExpression="MemberExpression",t.ConditionalExpression="ConditionalExpression",t.ExpressionStatement="ExpressionStatement",t.CallExpression="CallExpression",t.NumThreadStatement="NumThreadStatement",t.StorageStatement="StorageStatement",t.DoWhileStatement="DoWhileStatement",t.WhileStatement="WhileStatement",t.ForStatement="ForStatement",t.BreakStatement="BreakStatement",t.ContinueStatement="ContinueStatement",t.IfStatement="IfStatement",t.ImportedFunctionStatement="ImportedFunctionStatement"}(yv||(yv={})),function(t){t.Input="Input",t.Output="Output",t.Uniform="Uniform",t.Workgroup="Workgroup",t.UniformConstant="UniformConstant",t.Image="Image",t.StorageBuffer="StorageBuffer",t.Private="Private",t.Function="Function"}(mv||(mv={})),function(t){t.GLSL100="GLSL100",t.GLSL450="GLSL450",t.WGSL="WGSL"}(bv||(bv={}));var Sv,Av,Tv,Iv,Nv,Ov,Cv,kv,Dv,Mv,Rv=function(){function t(e,n){var r,i;Bf(this,t),this.name=void 0,this.matrix=void 0,this.right=void 0,this.up=void 0,this.forward=void 0,this.position=void 0,this.focalPoint=void 0,this.distanceVector=void 0,this.distance=void 0,this.dollyingStep=void 0,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.name=e,this.matrix=(r=n.matrix,(i=new Tl(16))[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i),this.right=Dl(n.right),this.up=Dl(n.up),this.forward=Dl(n.forward),this.position=Dl(n.position),this.focalPoint=Dl(n.focalPoint),this.distanceVector=Dl(n.distanceVector),this.azimuth=n.azimuth,this.elevation=n.elevation,this.roll=n.roll,this.relAzimuth=n.relAzimuth,this.relElevation=n.relElevation,this.relRoll=n.relRoll,this.dollyingStep=n.dollyingStep,this.distance=n.distance}return Vf(t,[{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getRoll",value:function(){return this.roll}},{key:"retrieve",value:function(t){t.matrix=Jd(t.matrix,this.matrix),t.right=Pl(t.right,this.right),t.up=Pl(t.up,this.up),t.forward=Pl(t.forward,this.forward),t.position=Pl(t.position,this.position),t.focalPoint=Pl(t.focalPoint,this.focalPoint),t.distanceVector=Pl(t.distanceVector,this.distanceVector),t.azimuth=this.azimuth,t.elevation=this.elevation,t.roll=this.roll,t.relAzimuth=this.relAzimuth,t.relElevation=this.relElevation,t.relRoll=this.relRoll,t.dollyingStep=this.dollyingStep,t.distance=this.distance}}]),t}();!function(t){t.ORBITING="ORBITING",t.EXPLORING="EXPLORING",t.TRACKING="TRACKING"}(kv||(kv={})),function(t){t.DEFAULT="DEFAULT",t.ROTATIONAL="ROTATIONAL",t.TRANSLATIONAL="TRANSLATIONAL",t.CINEMATIC="CINEMATIC"}(Dv||(Dv={})),function(t){t.ORTHOGRAPHIC="ORTHOGRAPHIC",t.PERSPECTIVE="PERSPECTIVE"}(Mv||(Mv={}));var Pv,Gv,Lv,jv,Fv,Uv,Bv,zv=Math.PI/180,Vv=180/Math.PI,Wv=(Sv=(0,nl.b2)(),Av=(0,nl.f3)(rl.InteractorService),Sv((Cv=Ov=function(){function t(){Bf(this,t),this.matrix=$d(),this.right=Rl(1,0,0),this.up=Rl(0,1,0),this.forward=Rl(0,0,1),this.position=Rl(0,0,1),this.focalPoint=Rl(0,0,0),this.distanceVector=Rl(0,0,0),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.rotateWorld=!1,Uf(this,"interactor",Nv,this),this.fov=30,this.near=.1,this.far=1e4,this.aspect=1,this.left=void 0,this.rright=void 0,this.top=void 0,this.bottom=void 0,this.zoom=1,this.perspective=$d(),this.view=void 0,this.following=void 0,this.type=kv.EXPLORING,this.trackingMode=Dv.DEFAULT,this.projectionMode=Mv.PERSPECTIVE,this.frustum=new qd,this.landmarks=[],this.landmarkAnimationID=void 0}return Vf(t,[{key:"clone",value:function(){var e=new t;return e.setType(this.type,void 0),e.interactor=this.interactor,e}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.perspective}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"setType",value:function(t,e){return this.type=t,this.type===kv.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===kv.TRACKING&&void 0!==e&&this.setTrackingMode(e),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==kv.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this}},{key:"setWorldRotation",value:function(t){this.rotateWorld=t,this._getAngles()}},{key:"getViewTransform",value:function(){return th($d(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"setMatrix",value:function(t){return this.matrix=t,this._update(),this}},{key:"setAspect",value:function(t){return this.setPerspective(this.near,this.far,this.fov,t),this}},{key:"setViewOffset",value: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===Mv.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}},{key:"clearViewOffset",value:function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===Mv.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}},{key:"setPerspective",value:function(t,e,n,r){return this.projectionMode=Mv.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r,function(t,e,n,r,i){var o,a=1/Math.tan(e/2);t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r)}(this.perspective,this.fov*zv,this.aspect,this.near,this.far),this}},{key:"setOrthographic",value:function(t,e,n,r,i,o){this.projectionMode=Mv.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var a=(this.rright-this.left)/(2*this.zoom),u=(this.top-this.bottom)/(2*this.zoom),s=(this.rright+this.left)/2,c=(this.top+this.bottom)/2,f=s-a,l=s+a,d=c+u,h=c-u;if(void 0!==this.view&&this.view.enabled){var p=(this.rright-this.left)/this.view.fullWidth/this.zoom,v=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l=(f+=p*this.view.offsetX)+p*this.view.width,h=(d-=v*this.view.offsetY)-v*this.view.height}return function(t,e,n,r,i,o,a){var u=1/(e-n),s=1/(r-i),c=1/(o-a);t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*u,t[13]=(i+r)*s,t[14]=(a+o)*c,t[15]=1}(this.perspective,f,l,d,h,i,o),this}},{key:"setPosition",value:function(t,e,n){return this._setPosition(t,e,n),this.setFocalPoint(this.focalPoint),this}},{key:"setFocalPoint",value:function(t,e,n){var r=Rl(0,1,0);if(this.focalPoint=Ev(t,e,n),this.trackingMode===Dv.CINEMATIC){var i=jl(kl(),this.focalPoint,this.position);t=i[0],e=i[1],n=i[2];var o=Ml(i),a=Math.asin(e/o)*Vv,u=90+Math.atan2(n,t)*Vv,s=$d();!function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],u=e[2],s=e[3],c=e[8],f=e[9],l=e[10],d=e[11];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]=o*i-c*r,t[1]=a*i-f*r,t[2]=u*i-l*r,t[3]=s*i-d*r,t[8]=o*r+c*i,t[9]=a*r+f*i,t[10]=u*r+l*i,t[11]=s*r+d*i}(s,s,u*zv),function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],u=e[6],s=e[7],c=e[8],f=e[9],l=e[10],d=e[11];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]=o*i+c*r,t[5]=a*i+f*r,t[6]=u*i+l*r,t[7]=s*i+d*r,t[8]=c*i-o*r,t[9]=f*i-a*r,t[10]=l*i-u*r,t[11]=d*i-s*r}(s,s,a*zv),r=Vl(kl(),[0,1,0],s)}return th(this.matrix,function(t,e,n,r){var i,o,a,u,s,c,f,l,d,h,p=e[0],v=e[1],g=e[2],y=r[0],m=r[1],b=r[2],_=n[0],x=n[1],w=n[2];return Math.abs(p-_)<Al&&Math.abs(v-x)<Al&&Math.abs(g-w)<Al?Qd(t):(f=p-_,l=v-x,d=g-w,i=m*(d*=h=1/Math.hypot(f,l,d))-b*(l*=h),o=b*(f*=h)-y*d,a=y*l-m*f,(h=Math.hypot(i,o,a))?(i*=h=1/h,o*=h,a*=h):(i=0,o=0,a=0),u=l*a-d*o,s=d*i-f*a,c=f*o-l*i,(h=Math.hypot(u,s,c))?(u*=h=1/h,s*=h,c*=h):(u=0,s=0,c=0),t[0]=i,t[1]=u,t[2]=f,t[3]=0,t[4]=o,t[5]=s,t[6]=l,t[7]=0,t[8]=a,t[9]=c,t[10]=d,t[11]=0,t[12]=-(i*p+o*v+a*g),t[13]=-(u*p+s*v+c*g),t[14]=-(f*p+l*v+d*g),t[15]=1,t)}($d(),this.position,this.focalPoint,r)),this._getAxes(),this._getDistance(),this._getAngles(),this}},{key:"setDistance",value:function(t){if(!(this.distance===t||t<0)){this.distance=t,this.distance<2e-4&&(this.distance=2e-4),this.dollyingStep=this.distance/100;var e=kl();t=this.distance;var n=this.forward,r=this.focalPoint;return 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}}},{key:"setMaxDistance",value:function(t){return this.maxDistance=t,this}},{key:"setMinDistance",value:function(t){return this.minDistance=t,this}},{key:"changeAzimuth",value:function(t){return this.setAzimuth(this.azimuth+t),this}},{key:"changeElevation",value:function(t){return this.setElevation(this.elevation+t),this}},{key:"changeRoll",value:function(t){return this.setRoll(this.roll+t),this}},{key:"setAzimuth",value:function(t){return this.azimuth=wv(t),this.computeMatrix(),this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=wv(t),this.computeMatrix(),this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this}},{key:"setRoll",value:function(t){return this.roll=wv(t),this.computeMatrix(),this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this}},{key:"rotate",value:function(t,e,n){if(this.type===kv.EXPLORING){t=wv(t),e=wv(e),n=wv(n);var r=Mp(Dp(),[1,0,0],(this.rotateWorld?1:-1)*e*zv),i=Mp(Dp(),[0,1,0],(this.rotateWorld?1:-1)*t*zv),o=Mp(Dp(),[0,0,1],n*zv),a=Rp(Dp(),i,r);a=Rp(Dp(),a,o);var u=ah($d(),a);nh(this.matrix,this.matrix,[0,0,-this.distance]),eh(this.matrix,this.matrix,u),nh(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation+e)>90)return;this.relElevation=wv(e),this.relAzimuth=wv(t),this.relRoll=wv(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.computeMatrix()}return this._getAxes(),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getPosition():this.type===kv.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,e){var n=Ev(t,e,0),r=Dl(this.position);return Ll(r,r,Fl(kl(),this.right,n[0])),Ll(r,r,Fl(kl(),this.up,n[1])),this._setPosition(r),this}},{key:"dolly",value:function(t){var e=this.forward,n=Dl(this.position),r=this.dollyingStep,i=this.distance+t*this.dollyingStep;return r=Math.max(Math.min(i,this.maxDistance),this.minDistance)-this.distance,n[0]+=r*e[0],n[1]+=r*e[1],n[2]+=r*e[2],this._setPosition(n),this.type===kv.ORBITING||this.type===kv.EXPLORING?this._getDistance():this.type===kv.TRACKING&&Ll(this.focalPoint,n,this.distanceVector),this}},{key:"createLandmark",value:function(t,e){var n=this.clone();n.setPosition(e.position),n.setFocalPoint(e.focalPoint),void 0!==e.roll&&n.setRoll(e.roll);var r=new Rv(t,n);return this.landmarks.push(r),r}},{key:"setLandmark",value:function(t){var e=new Rv(t,this);return this.landmarks.push(e),this}},{key:"gotoLandmark",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,r=this.landmarks.find((function(e){return e.name===t}));if(r){if(0===n)return void r.retrieve(this);void 0!==this.landmarkAnimationID&&window.cancelAnimationFrame(this.landmarkAnimationID),this.interactor.disconnect();var i,o=r.getPosition(),a=r.getFocalPoint(),u=r.getRoll(),s=function t(r){void 0===i&&(i=r);var s,c=r-i,f=(1-Math.cos(c/n*Math.PI))/2,l=kl(),d=kl();if(zl(l,e.focalPoint,a,f),zl(d,e.position,o,f),s=e.roll*(1-f)+u*f,e.setFocalPoint(l),e.setPosition(d),e.setRoll(s),e.computeMatrix(),!(Xl(l,a)+Xl(d,o)>.01))return e.setFocalPoint(l),e.setPosition(d),e.setRoll(s),e.computeMatrix(),void e.interactor.connect();c<n&&(e.landmarkAnimationID=window.requestAnimationFrame(t))};window.requestAnimationFrame(s)}}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles()}},{key:"computeMatrix",value:function(){var t,e,n=Mp(Dp(),[0,0,1],this.roll*zv);Qd(this.matrix),t=Mp(Dp(),[1,0,0],(this.rotateWorld&&this.type!==kv.TRACKING||this.type===kv.TRACKING?1:-1)*this.elevation*zv),e=Mp(Dp(),[0,1,0],(this.rotateWorld&&this.type!==kv.TRACKING||this.type===kv.TRACKING?1:-1)*this.azimuth*zv);var r=Rp(Dp(),e,t);r=Rp(Dp(),r,n);var i=ah($d(),r);this.type===kv.ORBITING||this.type===kv.EXPLORING?(nh(this.matrix,this.matrix,this.focalPoint),eh(this.matrix,this.matrix,i),nh(this.matrix,this.matrix,[0,0,this.distance])):this.type===kv.TRACKING&&(nh(this.matrix,this.matrix,this.position),eh(this.matrix,this.matrix,i))}},{key:"_setPosition",value:function(t,e,n){this.position=Ev(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1}},{key:"_getAxes",value:function(){Pl(this.right,Ev(Ol(Il(),[1,0,0,0],this.matrix))),Pl(this.up,Ev(Ol(Il(),[0,1,0,0],this.matrix))),Pl(this.forward,Ev(Ol(Il(),[0,0,1,0],this.matrix))),Ul(this.right,this.right),Ul(this.up,this.up),Ul(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=Ml(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===kv.TRACKING||this.rotateWorld?(this.elevation=Math.asin(e/r)*Vv,this.azimuth=Math.atan2(-t,-n)*Vv):(this.elevation=-Math.asin(e/r)*Vv,this.azimuth=-Math.atan2(-t,-n)*Vv)}},{key:"_getPosition",value:function(){Pl(this.position,Ev(Ol(Il(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){var t,e;Wl(this.distanceVector,[0,0,-this.distance],(t=Cl(),e=this.matrix,t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t)),Ll(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=jl(kl(),this.focalPoint,this.position),this.distance=Ml(this.distanceVector),this.dollyingStep=this.distance/100}}]),t}(),Ov.ProjectionMode={ORTHOGRAPHIC:"ORTHOGRAPHIC",PERSPECTIVE:"PERSPECTIVE"},Nv=Wf((Iv=Cv).prototype,"interactor",[Av],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Tv=Iv))||Tv),Hv=(Pv=(0,nl.b2)(),Gv=(0,nl.f3)(rl.GeometryComponentManager),Pv((Bv=Uv=function(){function t(){Bf(this,t),this.config=void 0,Uf(this,"geometry",Fv,this),this.entity=void 0,this.component=void 0}return Vf(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.component=this.geometry.create(t),this.component.entity=t,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),t}(),Uv.BOX="box",Uv.SPHERE="sphere",Uv.PLANE="plane",Uv.MERGED="merged",Fv=Wf((jv=Bv).prototype,"geometry",[Gv],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Lv=jv))||Lv),Xv=n(8344);function qv(){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}var Yv={}.toString;var Kv={};Kv["[object Float32Array]"]=Kv["[object Float64Array]"]=Kv["[object Int8Array]"]=Kv["[object Int16Array]"]=Kv["[object Int32Array]"]=Kv["[object Uint8Array]"]=Kv["[object Uint8ClampedArray]"]=Kv["[object Uint16Array]"]=Kv["[object Uint32Array]"]=!0,Kv["[object Arguments]"]=Kv["[object Array]"]=Kv["[object ArrayBuffer]"]=Kv["[object Boolean]"]=Kv["[object DataView]"]=Kv["[object Date]"]=Kv["[object Error]"]=Kv["[object Function]"]=Kv["[object Map]"]=Kv["[object Number]"]=Kv["[object Object]"]=Kv["[object RegExp]"]=Kv["[object Set]"]=Kv["[object String]"]=Kv["[object WeakMap]"]=!1;var Zv,$v,Jv,Qv,tg,eg,ng,rg,ig=Object.prototype.toString,og=function(t){return function(t){return!!t&&"object"===cl(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!!Kv[ig.call(t)]};function ag(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ug(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ag(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ag(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var sg,cg,fg,lg,dg,hg,pg,vg,gg,yg,mg,bg,_g,xg,wg,Eg,Sg,Ag,Tg,Ig,Ng,Og,Cg,kg,Dg,Mg,Rg,Pg,Gg,Lg,jg,Fg,Ug,Bg,zg,Vg=(Zv=(0,nl.b2)(),$v=(0,nl.f3)(rl.RenderEngine),Jv=(0,nl.f3)(rl.ConfigService),Zv((rg=function(){function t(){Bf(this,t),Uf(this,"engine",eg,this),Uf(this,"configService",ng,this),this.entity=Zf(),this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}var e,n,r;return Vf(t,[{key:"init",value:function(){var t=this.configService.get(),e=t.canvas,n=t.engineOptions;this.initPromise=this.engine.init(ug({canvas:e||qv(),swapChainFormat:Xv.EV.BGRA8Unorm,antialiasing:!1},n))}},{key:"setBundle",value:function(t){this.compiledBundle=JSON.parse(JSON.stringify(t))}},{key:"setDispatch",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=t),this}},{key:"setMaxIteration",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=t),this}},{key:"setBinding",value:function(t,e){var n,r=this;if("string"==typeof t){var i=xv(e)||og(e)||(n=e,Array.isArray?Array.isArray(n):function(t,e){return Yv.call(t)==="[object "+e+"]"}(n,"Array"));if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find((function(e){return e.name===t}));if(o)return o.value=e,this;var a=this.compiledBundle.context.uniforms.find((function(e){return e.name===t}));a&&(i?(a.data=e,a.isReferer=!1,a.storageClass===mv.Uniform?this.model&&this.model.updateUniform(t,e):this.model&&this.model.updateBuffer(t,e)):(a.isReferer=!0,a.data=e))}}else Object.keys(t).forEach((function(e){r.setBinding(e,t[e])}));return this}},{key:"execute",value:(r=Yf(Xf().mark((function t(){var e,n,r=this,i=arguments;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=i.length>0&&void 0!==i[0]?i[0]:1,!this.dirty){t.next=6;break}return this.compiledBundle.context&&(e>1?this.compiledBundle.context.maxIteration=e:this.compiledBundle.context.maxIteration++),t.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter((function(t){return t.isReferer})).forEach((function(t){var e=t.data,n=t.name;r.model.confirmInput(e.model,n)})),n=0;n<e;n++)this.model.run();return this.engine.endFrame(),t.abrupt("return",this);case 12:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"getOutput",value:(n=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.model.readData());case 1:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"compile",value:(e=Yf(Xf().mark((function t(){var e,n,r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.initPromise;case 2:return e=ug({},this.compiledBundle.context),n=this.engine.supportWebGPU?this.engine.useWGSL?bv.WGSL:bv.GLSL450:bv.GLSL100,r=this.compiledBundle.shaders[n],e.defines.filter((function(t){return t.runtime})).forEach((function(t){var e="".concat("__DefineValuePlaceholder__").concat(t.name);r=r.replace(e,"".concat(t.value))})),e.shader=r,e.uniforms.forEach((function(t){if(!t.data&&t.storageClass===mv.StorageBuffer){var n=1;t.type===gv.FloatArray?n=1:t.type===gv.Vector4FloatArray&&(n=4),t.data=new Float32Array(e.output.length*n).fill(0)}})),this.compiledBundle.context=e,t.next=11,this.engine.createComputeModel(this.compiledBundle.context);case 11:this.model=t.sent;case 12:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),eg=Wf((tg=rg).prototype,"engine",[$v],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ng=Wf(tg.prototype,"configService",[Jv],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Qv=tg))||Qv),Wg=(sg=(0,nl.b2)(),cg=(0,nl.f3)(rl.MaterialComponentManager),sg((pg=hg=function(){function t(){Bf(this,t),this.config=void 0,Uf(this,"material",dg,this),this.entity=void 0,this.component=void 0}return Vf(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t,e){this.entity=t,this.component=this.material.create(t),this.component.entity=t,this.component.type=e,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),t}(),hg.BASIC="basic",dg=Wf((lg=pg).prototype,"material",[cg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),fg=lg))||fg),Hg=(vg=(0,nl.b2)(),gg=(0,nl.f3)(rl.MeshComponentManager),yg=(0,nl.f3)(rl.CullableComponentManager),mg=(0,nl.f3)(rl.TransformComponentManager),bg=(0,nl.f3)(rl.Systems),_g=(0,nl.t6)(rl.SceneGraphSystem),vg((Ng=Ig=function(){function t(){Bf(this,t),this.attributes={},this.config=void 0,Uf(this,"mesh",Eg,this),Uf(this,"cullable",Sg,this),Uf(this,"transform",Ag,this),Uf(this,"sceneGraphSystem",Tg,this),this.meshComponent=void 0,this.transformComponent=void 0,this.entity=void 0}return Vf(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getTransformComponent",value:function(){return this.transformComponent}},{key:"getMeshComponent",value:function(){return this.meshComponent}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.cullable.create(t),this.meshComponent=this.mesh.create(t),this.transformComponent=this.transform.create(t),this.onEntityCreated()}},{key:"setMaterial",value:function(t){return this.meshComponent.material=t,this}},{key:"setGeometry",value:function(t){return this.meshComponent.geometry=t,this}},{key:"setAttributes",value:function(t){var e=this;Object.keys(t).forEach((function(n){void 0!==t[n]&&t[n]!==e.attributes[n]&&(e.onAttributeChanged({name:n,data:t[n]}),e.attributes[n]=t[n])}))}},{key:"setVisible",value:function(t){var e=this;return this.meshComponent.visible=t,this.meshComponent.children.forEach((function(n){var r=e.mesh.getComponentByEntity(n);r&&(r.visible=t)})),this}},{key:"isVisible",value:function(){return this.meshComponent.visible}},{key:"attach",value:function(t){return this.sceneGraphSystem.attach(this.entity,t.entity),this}},{key:"detach",value:function(){return this.sceneGraphSystem.detach(this.entity),this}},{key:"detachChildren",value:function(){return this.sceneGraphSystem.detachChildren(this.entity),this}},{key:"onEntityCreated",value:function(){}},{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data;this.meshComponent&&this.meshComponent.material&&this.meshComponent.material.setUniform(this.convertAttributeName2UniformName(e),n)}},{key:"convertAttributeName2UniformName",value:function(t){return t}}]),t}(),Ig.POINT="point",Ig.LINE="line",Ig.GRID="grid",Eg=Wf((wg=Ng).prototype,"mesh",[gg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sg=Wf(wg.prototype,"cullable",[yg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ag=Wf(wg.prototype,"transform",[mg],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Tg=Wf(wg.prototype,"sceneGraphSystem",[bg,_g],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xg=wg))||xg),Xg=n(6377),qg=n.n(Xg),Yg=function(){function t(e,n){Bf(this,t),this.attribute=void 0,this.buffer=void 0;var r=n.buffer,i=n.offset,o=n.stride,a=n.normalized,u=n.size,s=n.divisor;this.buffer=r,this.attribute={buffer:r.get(),offset:i||0,stride:o||0,normalized:a||!1,divisor:s||0},u&&(this.attribute.size=u)}return Vf(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),Kg=(Sl(Og={},td.POINTS,"points"),Sl(Og,td.LINES,"lines"),Sl(Og,td.LINE_LOOP,"line loop"),Sl(Og,td.LINE_STRIP,"line strip"),Sl(Og,td.TRIANGLES,"triangles"),Sl(Og,td.TRIANGLE_FAN,"triangle fan"),Sl(Og,td.TRIANGLE_STRIP,"triangle strip"),Og),Zg=(Sl(Cg={},td.STATIC_DRAW,"static"),Sl(Cg,td.DYNAMIC_DRAW,"dynamic"),Sl(Cg,td.STREAM_DRAW,"stream"),Cg),$g=(Sl(kg={},td.BYTE,"int8"),Sl(kg,td.UNSIGNED_INT,"int16"),Sl(kg,td.INT,"int32"),Sl(kg,td.UNSIGNED_BYTE,"uint8"),Sl(kg,td.UNSIGNED_SHORT,"uint16"),Sl(kg,td.UNSIGNED_INT,"uint32"),Sl(kg,td.FLOAT,"float"),kg),Jg=(Sl(Dg={},td.ALPHA,"alpha"),Sl(Dg,td.LUMINANCE,"luminance"),Sl(Dg,td.LUMINANCE_ALPHA,"luminance alpha"),Sl(Dg,td.RGB,"rgb"),Sl(Dg,td.RGBA,"rgba"),Sl(Dg,td.RGBA4,"rgba4"),Sl(Dg,td.RGB5_A1,"rgb5 a1"),Sl(Dg,td.RGB565,"rgb565"),Sl(Dg,td.DEPTH_COMPONENT,"depth"),Sl(Dg,td.DEPTH_STENCIL,"depth stencil"),Dg),Qg=(Sl(Mg={},td.DONT_CARE,"dont care"),Sl(Mg,td.NICEST,"nice"),Sl(Mg,td.FASTEST,"fast"),Mg),ty=(Sl(Rg={},td.NEAREST,"nearest"),Sl(Rg,td.LINEAR,"linear"),Sl(Rg,td.LINEAR_MIPMAP_LINEAR,"mipmap"),Sl(Rg,td.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Sl(Rg,td.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Sl(Rg,td.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),Rg),ey=(Sl(Pg={},td.REPEAT,"repeat"),Sl(Pg,td.CLAMP_TO_EDGE,"clamp"),Sl(Pg,td.MIRRORED_REPEAT,"mirror"),Pg),ny=(Sl(Gg={},td.NONE,"none"),Sl(Gg,td.BROWSER_DEFAULT_WEBGL,"browser"),Gg),ry=(Sl(Lg={},td.NEVER,"never"),Sl(Lg,td.ALWAYS,"always"),Sl(Lg,td.LESS,"less"),Sl(Lg,td.LEQUAL,"lequal"),Sl(Lg,td.GREATER,"greater"),Sl(Lg,td.GEQUAL,"gequal"),Sl(Lg,td.EQUAL,"equal"),Sl(Lg,td.NOTEQUAL,"notequal"),Lg),iy=(Sl(jg={},td.FUNC_ADD,"add"),Sl(jg,td.MIN_EXT,"min"),Sl(jg,td.MAX_EXT,"max"),Sl(jg,td.FUNC_SUBTRACT,"subtract"),Sl(jg,td.FUNC_REVERSE_SUBTRACT,"reverse subtract"),jg),oy=(Sl(Fg={},td.ZERO,"zero"),Sl(Fg,td.ONE,"one"),Sl(Fg,td.SRC_COLOR,"src color"),Sl(Fg,td.ONE_MINUS_SRC_COLOR,"one minus src color"),Sl(Fg,td.SRC_ALPHA,"src alpha"),Sl(Fg,td.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Sl(Fg,td.DST_COLOR,"dst color"),Sl(Fg,td.ONE_MINUS_DST_COLOR,"one minus dst color"),Sl(Fg,td.DST_ALPHA,"dst alpha"),Sl(Fg,td.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Sl(Fg,td.CONSTANT_COLOR,"constant color"),Sl(Fg,td.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Sl(Fg,td.CONSTANT_ALPHA,"constant alpha"),Sl(Fg,td.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Sl(Fg,td.SRC_ALPHA_SATURATE,"src alpha saturate"),Fg),ay=(Sl(Ug={},td.NEVER,"never"),Sl(Ug,td.ALWAYS,"always"),Sl(Ug,td.LESS,"less"),Sl(Ug,td.LEQUAL,"lequal"),Sl(Ug,td.GREATER,"greater"),Sl(Ug,td.GEQUAL,"gequal"),Sl(Ug,td.EQUAL,"equal"),Sl(Ug,td.NOTEQUAL,"notequal"),Ug),uy=(Sl(Bg={},td.ZERO,"zero"),Sl(Bg,td.KEEP,"keep"),Sl(Bg,td.REPLACE,"replace"),Sl(Bg,td.INVERT,"invert"),Sl(Bg,td.INCR,"increment"),Sl(Bg,td.DECR,"decrement"),Sl(Bg,td.INCR_WRAP,"increment wrap"),Sl(Bg,td.DECR_WRAP,"decrement wrap"),Bg),sy=(Sl(zg={},td.FRONT,"front"),Sl(zg,td.BACK,"back"),zg),cy=function(){function t(e,n){Bf(this,t),this.buffer=void 0;var r=n.data,i=n.usage,o=n.type;this.buffer=e.buffer({data:r,usage:Zg[i||td.STATIC_DRAW],type:$g[o||td.UNSIGNED_BYTE]})}return Vf(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(t){var e=t.data,n=t.offset;this.buffer.subdata(e,n)}}]),t}();function fy(t){return function(t){if(Array.isArray(t))return Qf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||tl(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ly={};ly["[object Float32Array]"]=ly["[object Float64Array]"]=ly["[object Int8Array]"]=ly["[object Int16Array]"]=ly["[object Int32Array]"]=ly["[object Uint8Array]"]=ly["[object Uint8ClampedArray]"]=ly["[object Uint16Array]"]=ly["[object Uint32Array]"]=!0,ly["[object Arguments]"]=ly["[object Array]"]=ly["[object ArrayBuffer]"]=ly["[object Boolean]"]=ly["[object DataView]"]=ly["[object Date]"]=ly["[object Error]"]=ly["[object Function]"]=ly["[object Map]"]=ly["[object Number]"]=ly["[object Object]"]=ly["[object RegExp]"]=ly["[object Set]"]=ly["[object String]"]=ly["[object WeakMap]"]=!1;var dy=Object.prototype.toString,hy=function(t){return function(t){return!!t&&"object"===cl(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!!ly[dy.call(t)]};function py(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function vy(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?py(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):py(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var gy=0,yy=function(){function t(e,n){var r=this;Bf(this,t),this.reGl=e,this.context=n,this.entity=Zf(),this.texFBO=void 0,this.computeCommand=void 0,this.textureCache={},this.outputTextureName=void 0,this.swapOutputTextureName=void 0,this.compiledPingpong=void 0,this.dynamicPingpong=void 0;var i={};this.context.uniforms.forEach((function(t){var e=t.name,n=t.type,o=t.data,a=t.isReferer,u=t.storageClass;if(u===mv.StorageBuffer){if(a)r.textureCache[e]={data:void 0},i["".concat(e,"Size")]=function(){return o.compiledBundle.context.output.textureSize};else{r.textureCache[e]=r.calcDataTexture(e,n,o);var s=r.textureCache[e],c=s.textureWidth,f=s.isOutput;i["".concat(e,"Size")]=[c,c],f&&(r.outputTextureName=e,r.context.needPingpong&&(r.outputTextureName="".concat(e,"Output"),r.textureCache[r.outputTextureName]=r.calcDataTexture(e,n,o)))}i[e]=function(){return r.textureCache[e].texture}}else if(u===mv.Uniform){if(o&&(Array.isArray(o)||hy(o))&&o.length>16)throw new Error("invalid data type ".concat(n));i[e]=function(){return t.data}}}));var o=this.getOuputDataTexture(),a=o.textureWidth,u=o.texelCount;i.u_OutputTextureSize=[a,a],i.u_OutputTexelCount=u,this.context.output.textureSize=[a,a];var s={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(this.context.shader),uniforms:i,vert:"attribute vec3 a_Position;\nattribute vec2 a_TexCoord;\n\nvarying vec2 v_TexCoord;\n\nvoid main() {\n gl_Position = vec4(a_Position, 1.0);\n v_TexCoord = a_TexCoord;\n}",primitive:"triangle strip",count:4};this.computeCommand=this.reGl(s)}var e;return Vf(t,[{key:"run",value:function(){var t=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use((function(){t.computeCommand()}))}},{key:"readData",value:(e=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s,c=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.reGl({framebuffer:this.texFBO})((function(){e=c.reGl.read()})),!e){t.next=6;break}if(n=this.getOuputDataTexture(),r=n.originalDataLength,i=n.elementsPerTexel,o=n.typedArrayConstructor,a=void 0===o?Float32Array:o,u=[],4!==i)for(s=0;s<e.length;s+=4)1===i?u.push(e[s]):2===i?u.push(e[s],e[s+1]):u.push(e[s],e[s+1],e[s+2]);else u=e;return t.abrupt("return",new a(u.slice(0,r)));case 6:return t.abrupt("return",new Float32Array);case 7:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"confirmInput",value:function(t,e){var n;this.entity===t.entity?(this.dynamicPingpong=!0,n=this):n=t,this.textureCache[e].id=n.getOuputDataTexture().id,this.textureCache[e].texture=n.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(t,e){var n=this.context.uniforms.find((function(e){return e.name===t}));if(n){var r=this.calcDataTexture(t,n.type,e),i=r.texture,o=r.data;this.textureCache[t].data=o,this.textureCache[t].texture=i}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var t=this.context.output.name;this.textureCache[t].id=this.getOuputDataTexture().id,this.textureCache[t].texture=this.getOuputDataTexture().texture}var e=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=e}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var t=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=t}},{key:"cloneDataTexture",value:function(t){var e=t.data,n=t.textureWidth;return vy(vy({},t),{},{id:gy++,texture:this.reGl.texture({width:n,height:n,data:e,type:"float"})})}},{key:"calcDataTexture",value:function(t,e,n){var r=1;e===gv.Vector4FloatArray&&(r=4);for(var i=[],o=0;o<n.length;o+=r)1===r?i.push(n[o],0,0,0):2===r?i.push(n[o],n[o+1],0,0):3===r?i.push(n[o],n[o+1],n[o+2],0):4===r&&i.push(n[o],n[o+1],n[o+2],n[o+3]);var a=n.length,u=Math.ceil(a/r),s=Math.ceil(Math.sqrt(u)),c=s*s;u<c&&i.push.apply(i,fy(new Array(4*(c-u)).fill(0)));var f=this.reGl.texture({width:s,height:s,data:i,type:"float"});return{id:gy++,data:i,originalDataLength:a,typedArrayConstructor:hy(n)?n.constructor:void 0,textureWidth:s,texture:f,texelCount:u,elementsPerTexel:r,isOutput:t===this.context.output.name}}}]),t}(),my=function(){function t(e,n){Bf(this,t),this.elements=void 0;var r=n.data,i=n.usage,o=n.type,a=n.count;this.elements=e.elements({data:r,usage:Zg[i||td.STATIC_DRAW],type:$g[o||td.UNSIGNED_BYTE],count:a})}return Vf(t,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(t){var e=t.data;this.elements.subdata(e)}},{key:"destroy",value:function(){this.elements.destroy()}}]),t}(),by=function(){function t(e,n){Bf(this,t),this.framebuffer=void 0;var r=n.width,i=n.height,o=n.color,a=n.colors,u=(n.depth,n.stencil,{width:r,height:i});Array.isArray(a)&&(u.colors=a.map((function(t){return t.get()}))),o&&"boolean"!=typeof o&&(u.color=o.get()),this.framebuffer=e.framebuffer(u)}return Vf(t,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(t){var e=t.width,n=t.height;this.framebuffer.resize(e,n)}}]),t}();function _y(t){var e={};return Object.keys(t).forEach((function(n){xy(n,t[n],e,"")})),e}function xy(t,e,n,r){var i,o;null===e||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)&&"number"==typeof e[0]||hy(e)||""===e||void 0!==e.resize?n["".concat(r&&r+".").concat(t)]=e:(o=cl(i=e),null==i||"object"!==o&&"function"!==o||Object.keys(e).forEach((function(i){xy(i,e[i],n,"".concat(r&&r+".").concat(t))})),Array.isArray(e)&&e.forEach((function(e,i){Object.keys(e).forEach((function(o){xy(o,e[o],n,"".concat(r&&r+".").concat(t,"[").concat(i,"]"))}))})))}function wy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ey(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wy(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wy(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Sy,Ay,Ty,Iy=function(){function t(e,n){Bf(this,t),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=e;var r=n.vs,i=n.fs,o=n.defines,a=n.attributes,u=n.uniforms,s=n.primitive,c=n.count,f=n.elements,l=n.depth,d=n.blend,h=n.stencil,p=n.cull,v=n.instances,g=n.scissor,y=n.viewport,m={};u&&(this.uniforms=_y(u),Object.keys(u).forEach((function(t){m[t]=e.prop(t)})));var b={};Object.keys(a).forEach((function(t){b[t]=a[t].get()}));var _=o&&this.generateDefines(o)||"",x={attributes:b,frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(_,"\n").concat(i),uniforms:m,vert:"\n".concat(_,"\n").concat(r),primitive:Kg[void 0===s?td.TRIANGLES:s]};v&&(x.instances=v),c&&(x.count=c),f&&(x.elements=f.get()),g&&(x.scissor=g),y&&(x.viewport=y),this.initDepthDrawParams({depth:l},x),this.initBlendDrawParams({blend:d},x),this.initStencilDrawParams({stencil:h},x),this.initCullDrawParams({cull:p},x),this.drawCommand=e(x)}return Vf(t,[{key:"addUniforms",value:function(t){this.uniforms=Ey(Ey({},this.uniforms),_y(t))}},{key:"draw",value:function(t){var e=Ey(Ey({},this.uniforms),_y(t.uniforms||{})),n={};Object.keys(e).forEach((function(t){var r=cl(e[t]);"boolean"===r||"number"===r||Array.isArray(e[t])||e[t].BYTES_PER_ELEMENT?n[t]=e[t]:"string"===r||(n[t]=e[t].get())})),this.drawCommand(n)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(t,e){var n=t.depth;n&&(e.depth={enable:void 0===n.enable||!!n.enable,mask:void 0===n.mask||!!n.mask,func:ry[n.func||td.LESS],range:n.range||[0,1]})}},{key:"initBlendDrawParams",value:function(t,e){var n=t.blend;if(n){var r=n.enable,i=n.func,o=n.equation,a=n.color,u=void 0===a?[0,0,0,0]:a;e.blend={enable:!!r,func:{srcRGB:oy[i&&i.srcRGB||td.SRC_ALPHA],srcAlpha:oy[i&&i.srcAlpha||td.SRC_ALPHA],dstRGB:oy[i&&i.dstRGB||td.ONE_MINUS_SRC_ALPHA],dstAlpha:oy[i&&i.dstAlpha||td.ONE_MINUS_SRC_ALPHA]},equation:{rgb:iy[o&&o.rgb||td.FUNC_ADD],alpha:iy[o&&o.alpha||td.FUNC_ADD]},color:u}}}},{key:"initStencilDrawParams",value:function(t,e){var n=t.stencil;if(n){var r=n.enable,i=n.mask,o=void 0===i?-1:i,a=n.func,u=void 0===a?{cmp:td.ALWAYS,ref:0,mask:-1}:a,s=n.opFront,c=void 0===s?{fail:td.KEEP,zfail:td.KEEP,zpass:td.KEEP}:s,f=n.opBack,l=void 0===f?{fail:td.KEEP,zfail:td.KEEP,zpass:td.KEEP}:f;e.stencil={enable:!!r,mask:o,func:Ey(Ey({},u),{},{cmp:ay[u.cmp]}),opFront:{fail:uy[c.fail],zfail:uy[c.zfail],zpass:uy[c.zpass]},opBack:{fail:uy[l.fail],zfail:uy[l.zfail],zpass:uy[l.zpass]}}}}},{key:"initCullDrawParams",value:function(t,e){var n=t.cull;if(n){var r=n.enable,i=n.face,o=void 0===i?td.BACK:i;e.cull={enable:!!r,face:sy[o]}}}},{key:"generateDefines",value:function(t){return Object.keys(t).map((function(e){return"#define ".concat(e," ").concat(Number(t[e]))})).join("\n")}}]),t}(),Ny=function(){function t(e,n){Bf(this,t),this.texture=void 0,this.width=void 0,this.height=void 0;var r=n.data,i=n.type,o=void 0===i?td.UNSIGNED_BYTE:i,a=n.width,u=n.height,s=n.flipY,c=void 0!==s&&s,f=n.format,l=void 0===f?td.RGBA:f,d=n.mipmap,h=void 0!==d&&d,p=n.wrapS,v=void 0===p?td.CLAMP_TO_EDGE:p,g=n.wrapT,y=void 0===g?td.CLAMP_TO_EDGE:g,m=n.aniso,b=void 0===m?0:m,_=n.alignment,x=void 0===_?1:_,w=n.premultiplyAlpha,E=void 0!==w&&w,S=n.mag,A=void 0===S?td.NEAREST:S,T=n.min,I=void 0===T?td.NEAREST:T,N=n.colorSpace,O=void 0===N?td.BROWSER_DEFAULT_WEBGL:N;this.width=a,this.height=u;var C={width:a,height:u,type:$g[o],format:Jg[l],wrapS:ey[v],wrapT:ey[y],mag:ty[A],min:ty[I],alignment:x,flipY:c,colorSpace:ny[O],premultiplyAlpha:E,aniso:b};r&&(C.data=r),"number"==typeof h?C.mipmap=Qg[h]:"boolean"==typeof h&&(C.mipmap=h),this.texture=e.texture(C)}return Vf(t,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(t){var e=t.width,n=t.height;this.texture.resize(e,n),this.width=e,this.height=n}},{key:"destroy",value:function(){this.texture.destroy()}}]),t}(),Oy=(0,nl.b2)()((Ay=function(){function t(){var e=this;Bf(this,t),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var t=Yf(Xf().mark((function t(n){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.uniforms){t.next=3;break}return t.next=3,Promise.all(Object.keys(n.uniforms).map(function(){var t=Yf(Xf().mark((function t(e){var r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.uniforms[e]||void 0===n.uniforms[e].load){t.next=5;break}return t.next=3,n.uniforms[e].load();case 3:r=t.sent,n.uniforms[e]=r;case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:return t.abrupt("return",new Iy(e.gl,n));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new Yg(e.gl,t)},this.createBuffer=function(t){return new cy(e.gl,t)},this.createElements=function(t){return new my(e.gl,t)},this.createTexture2D=function(t){return new Ny(e.gl,t)},this.createFramebuffer=function(t){return new by(e.gl,t)},this.useFramebuffer=function(t,n){e.gl({framebuffer:t?t.get():null})(n)},this.createComputeModel=function(){var t=Yf(Xf().mark((function t(n){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new yy(e.gl,n));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.clear=function(t){var n=t.color,r=t.depth,i=t.stencil,o=t.framebuffer,a=void 0===o?null:o,u={color:n,depth:r,stencil:i};u.framebuffer=null===a?a:a.get(),e.gl.clear(u)},this.setScissor=function(t){e.gl&&e.gl._gl&&(t.enable&&t.box?(e.gl._gl.enable(td.SCISSOR_TEST),e.gl._gl.scissor(t.box.x,t.box.y,t.box.width,t.box.height)):e.gl._gl.disable(td.SCISSOR_TEST),e.gl._refresh())},this.viewport=function(t){var n=t.x,r=t.y,i=t.width,o=t.height;e.gl&&e.gl._gl&&(e.gl._gl.viewport(n,r,i,o),e.gl._refresh())},this.readPixels=function(t){var n=t.framebuffer,r={x:t.x,y:t.y,width:t.width,height:t.height};return n&&(r.framebuffer=n.get()),e.gl.read(r)},this.getCanvas=function(){return e.$canvas},this.getGLContext=function(){return e.gl._gl},this.destroy=function(){e.gl&&(e.gl.destroy(),e.inited=!1)}}var e;return Vf(t,[{key:"init",value:(e=Yf(Xf().mark((function t(e){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.inited){t.next=2;break}return t.abrupt("return");case 2:return this.$canvas=e.canvas,t.next=5,new Promise((function(t,n){qg()({canvas:e.canvas,attributes:{alpha:!0,antialias:e.antialias,premultipliedAlpha:!0},pixelRatio:1,extensions:["OES_element_index_uint","OES_texture_float","OES_standard_derivatives","angle_instanced_arrays"],optionalExtensions:["EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture"],profile:!0,onDone:function(e,r){!e&&r||n(e),t(r)}})}));case 5:this.gl=t.sent,this.inited=!0;case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),t}(),Sy=Ay))||Sy;function Cy(t,e){return new Promise((function(e,n){!function(t,e,n,r){if("undefined"!=typeof window){var i=document.getElementsByTagName("head")[0],o=document.createElement("script");o.setAttribute("type","text/javascript"),o.setAttribute("src",t),r&&(o.id=r),o.onload=function(){e&&e()},o.onerror=function(e){n&&n("Unable to load script '".concat(t,"'"),e)},i.appendChild(o)}}(t,(function(){e()}),(function(t,e){n(e)}))}))}function ky(){return Dy.apply(this,arguments)}function Dy(){return(Dy=Yf(Xf().mark((function t(){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!Ty){t.next=2;break}return t.abrupt("return",Ty);case 2:return t.next=4,Cy("https://preview.babylonjs.com/glslang/glslang.js");case 4:return Ty=window.glslang("https://preview.babylonjs.com/glslang/glslang.wasm"),t.abrupt("return",Ty);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var My,Ry,Py,Gy,Ly,jy,Fy,Uy=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.attribute=void 0,this.buffer=void 0;var r=n,i=r.buffer,o=r.offset,a=r.stride,u=r.normalized,s=r.size,c=r.divisor,f=r.arrayStride,l=r.attributes,d=r.stepMode;this.buffer=i,this.attribute={buffer:i.get(),offset:o||0,stride:a||0,normalized:u||!1,divisor:c||0,arrayStride:f||0,attributes:l,stepMode:d||"vertex"},s&&(this.attribute.size=s)}return Vf(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),By=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.buffer=void 0;var r=n,i=r.data,o=r.usage;r.type,this.buffer=this.createBuffer(i instanceof Array?new Float32Array(i):i,o||Xv.FB.Vertex|Xv.FB.CopyDst)}return Vf(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){this.buffer.destroy()}},{key:"subData",value:function(t){var e=t.data,n=t.offset;this.setSubData(this.buffer,n,e instanceof Array?new Float32Array(e):e)}},{key:"createBuffer",value:function(t,e){var n=t.byteLength%4,r={size:t.byteLength+n,usage:e},i=this.engine.device.createBuffer(r);return this.setSubData(i,0,t),i}},{key:"setSubData",value:function(t,e,n){(_v?this.engine.device.getQueue():this.engine.device.defaultQueue).writeBuffer(t,e,n)}}]),t}(),zy=function(){function t(e,n){Bf(this,t),this.engine=e,this.context=n,this.entity=Zf(),this.uniformGPUBufferLayout=[],this.uniformBuffer=void 0,this.vertexBuffers={},this.outputBuffer=void 0,this.bindGroupEntries=void 0,this.bindGroup=void 0,this.computePipeline=void 0}var e,n,r;return Vf(t,[{key:"init",value:(r=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.compileComputePipelineStageDescriptor(this.context.shader);case 2:e=t.sent,n=e.computeStage,r=this.context.uniforms.filter((function(t){return t.storageClass===mv.StorageBuffer})),i=this.context.uniforms.filter((function(t){return t.storageClass===mv.Uniform})),o=i.length?1:0,this.bindGroupEntries=[],o&&(a=0,u=[],i.forEach((function(t){if("number"==typeof t.data)s.uniformGPUBufferLayout.push({name:t.name,offset:a}),a+=4,u.push(t.data);else{var e,n=(null===(e=t.data)||void 0===e?void 0:e.length)||1;3===n&&(n=4,t.data.push(0));var r=a/4%4;if(r>0){var i=4-r;if(n>1&&n<=i)2===n&&(3===i&&(a+=4,u.push(0)),u.push.apply(u,fy(t.data)),s.uniformGPUBufferLayout.push({name:t.name,offset:a}));else{for(var o=0;o<i;o++)a+=4,u.push(0);u.push.apply(u,fy(t.data)),s.uniformGPUBufferLayout.push({name:t.name,offset:a})}}a+=4*n}})),this.uniformBuffer=new By(this.engine,{data:u instanceof Array?new Float32Array(u):u,usage:Xv.FB.Uniform|Xv.FB.CopyDst}),this.bindGroupEntries.push({binding:0,resource:{buffer:this.uniformBuffer.get()}})),r.forEach((function(t){var e;null!==t.data&&(t.type!==gv.Vector4FloatArray&&t.type!==gv.FloatArray||(t.name===s.context.output.name?(e=new By(s.engine,{data:isFinite(Number(t.data))?[t.data]:t.data,usage:Xv.FB.Storage|Xv.FB.CopyDst|Xv.FB.CopySrc}),s.outputBuffer=e,s.context.output={name:t.name,length:isFinite(Number(t.data))?1:t.data.length,typedArrayConstructor:Float32Array,gpuBuffer:e.get()}):t.isReferer?t.data.model&&t.data.model.outputBuffer&&(e=t.data.model.outputBuffer):e=new By(s.engine,{data:isFinite(Number(t.data))?[t.data]:t.data,usage:Xv.FB.Storage|Xv.FB.CopyDst|Xv.FB.CopySrc}),s.vertexBuffers[t.name]=e,s.bindGroupEntries.push({binding:o,resource:{name:t.name,refer:e?void 0:t.data,buffer:e?e.get():void 0}}),o++))})),this.computePipeline=this.engine.device.createComputePipeline({computeStage:n}),console.log(this.bindGroupEntries),this.bindGroup=this.engine.device.createBindGroup({layout:this.computePipeline.getBindGroupLayout(0),entries:this.bindGroupEntries});case 13:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"destroy",value:function(){var t=this;this.uniformBuffer&&this.uniformBuffer.destroy(),Object.keys(this.vertexBuffers).forEach((function(e){return t.vertexBuffers[e].destroy()}))}},{key:"readData",value:(n=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s,c;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=this.context.output)){t.next=16;break}if(n=e.length,r=e.typedArrayConstructor,!(i=e.gpuBuffer)){t.next=16;break}return o=n*r.BYTES_PER_ELEMENT,a=this.engine.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),(u=this.engine.device.createCommandEncoder()).copyBufferToBuffer(i,0,a,0,o),(_v?this.engine.device.getQueue():this.engine.device.defaultQueue).submit([u.finish()]),t.next=12,a.mapAsync(Xv.gc.Read);case 12:return s=a.getMappedRange(),c=new r(s.slice(0)),a.unmap(),t.abrupt("return",c);case 16:return t.abrupt("return",new Float32Array);case 17:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"run",value:function(){var t;this.engine.currentComputePass&&(this.engine.currentComputePass.setPipeline(this.computePipeline),this.engine.currentComputePass.setBindGroup(0,this.bindGroup),(t=this.engine.currentComputePass).dispatch.apply(t,fy(this.context.dispatch)))}},{key:"updateBuffer",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.vertexBuffers[t];r&&r.subData({data:e,offset:n})}},{key:"updateUniform",value:function(t,e){var n=this.uniformGPUBufferLayout.find((function(e){return e.name===t}));n&&this.uniformBuffer.subData({data:Number.isFinite(e)?new Float32Array([e]):new Float32Array(e),offset:n.offset})}},{key:"confirmInput",value:function(t,e){var n=this.vertexBuffers[e],r=t.outputBuffer;if(n&&r&&n!==r){var i=this.engine.device.createCommandEncoder(),o=t.context.output,a=o.length*o.typedArrayConstructor.BYTES_PER_ELEMENT;i.copyBufferToBuffer(r.get(),0,n.get(),0,a),(_v?this.engine.device.getQueue():this.engine.device.defaultQueue).submit([i.finish()])}}},{key:"compileShaderToSpirV",value:function(t,e,n){return this.compileRawShaderToSpirV(n+t,e)}},{key:"compileRawShaderToSpirV",value:function(t,e){return this.engine.glslang.compileGLSL(t,e)}},{key:"compileComputePipelineStageDescriptor",value:(e=Yf(Xf().mark((function t(e){var n;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e,this.engine.options.useWGSL){t.next=6;break}return t.next=5,this.compileShaderToSpirV(e,"compute","#version 450\n");case 5:n=t.sent;case 6:return t.abrupt("return",{computeStage:{module:this.engine.device.createShaderModule({code:n,isWHLSL:_v}),entryPoint:"main"}});case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Vy=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.indexCount=void 0,this.buffer=void 0;var r=n,i=r.data,o=(r.usage,r.type,r.count);this.indexCount=o||0,this.buffer=new By(e,{data:i instanceof Array?new Uint16Array(i):i,usage:Xv.FB.Index|Xv.FB.CopyDst})}return Vf(t,[{key:"get",value:function(){return this.buffer}},{key:"subData",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),Wy=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.colorTexture=void 0,this.depthTexture=void 0,this.width=0,this.height=0;var r=n,i=(r.width,r.height,r.color),o=(r.colors,r.depth);r.stencil,i&&(this.colorTexture=i),o&&(this.depthTexture=o)}return Vf(t,[{key:"get",value:function(){var t,e;return{color:null===(t=this.colorTexture)||void 0===t?void 0:t.get(),depth:null===(e=this.depthTexture)||void 0===e?void 0:e.get()}}},{key:"destroy",value:function(){var t,e;null===(t=this.colorTexture)||void 0===t||t.destroy(),null===(e=this.depthTexture)||void 0===e||e.destroy()}},{key:"resize",value:function(t){var e,n,r=t.width,i=t.height;r===this.width&&i===this.height||(null===(e=this.colorTexture)||void 0===e||e.resize({width:r,height:i}),null===(n=this.depthTexture)||void 0===n||n.resize({width:r,height:i})),this.width=r,this.height=i}}]),t}(),Hy=(Sl(My={},td.POINTS,Xv.YV.PointList),Sl(My,td.LINES,Xv.YV.LineList),Sl(My,td.LINE_LOOP,Xv.YV.LineList),Sl(My,td.LINE_STRIP,Xv.YV.LineStrip),Sl(My,td.TRIANGLES,Xv.YV.TriangleList),Sl(My,td.TRIANGLE_FAN,Xv.YV.TriangleList),Sl(My,td.TRIANGLE_STRIP,Xv.YV.TriangleStrip),My),Xy=(Sl(Ry={},td.NEVER,Xv.wb.Never),Sl(Ry,td.ALWAYS,Xv.wb.Always),Sl(Ry,td.LESS,Xv.wb.Less),Sl(Ry,td.LEQUAL,Xv.wb.LessEqual),Sl(Ry,td.GREATER,Xv.wb.Greater),Sl(Ry,td.GEQUAL,Xv.wb.GreaterEqual),Sl(Ry,td.EQUAL,Xv.wb.Equal),Sl(Ry,td.NOTEQUAL,Xv.wb.NotEqual),Ry),qy=(Sl(Py={},td.FUNC_ADD,Xv.db.Add),Sl(Py,td.MIN_EXT,Xv.db.Min),Sl(Py,td.MAX_EXT,Xv.db.Max),Sl(Py,td.FUNC_SUBTRACT,Xv.db.Subtract),Sl(Py,td.FUNC_REVERSE_SUBTRACT,Xv.db.ReverseSubtract),Py),Yy=(Sl(Gy={},td.ZERO,Xv.zi.Zero),Sl(Gy,td.ONE,Xv.zi.One),Sl(Gy,td.SRC_COLOR,Xv.zi.SrcColor),Sl(Gy,td.ONE_MINUS_SRC_COLOR,Xv.zi.OneMinusSrcColor),Sl(Gy,td.SRC_ALPHA,Xv.zi.SrcAlpha),Sl(Gy,td.ONE_MINUS_SRC_ALPHA,Xv.zi.OneMinusSrcAlpha),Sl(Gy,td.DST_COLOR,Xv.zi.DstColor),Sl(Gy,td.ONE_MINUS_DST_COLOR,Xv.zi.OneMinusDstColor),Sl(Gy,td.DST_ALPHA,Xv.zi.DstAlpha),Sl(Gy,td.ONE_MINUS_DST_ALPHA,Xv.zi.OneMinusDstAlpha),Sl(Gy,td.CONSTANT_COLOR,Xv.zi.BlendColor),Sl(Gy,td.ONE_MINUS_CONSTANT_COLOR,Xv.zi.OneMinusBlendColor),Sl(Gy,td.SRC_ALPHA_SATURATE,Xv.zi.SrcAlphaSaturated),Gy),Ky=(Sl(Ly={},td.ALPHA,"r8unorm"),Sl(Ly,td.RGBA,"rgba8unorm"),Sl(Ly,td.DEPTH_COMPONENT,"depth32float"),Sl(Ly,td.DEPTH_STENCIL,"depth24plus-stencil8"),Ly),Zy=(Sl(jy={},td.NEAREST,"nearest"),Sl(jy,td.LINEAR,"linear"),jy),$y=(Sl(Fy={},td.REPEAT,"repeat"),Sl(Fy,td.CLAMP_TO_EDGE,"clamp-to-edge"),Sl(Fy,td.MIRRORED_REPEAT,"mirror-repeat"),Fy);function Jy(t){var e=t.cull;return e&&e.enable?e.face?e.face===td.FRONT?Xv.Wf.Front:Xv.Wf.Back:void 0:Xv.Wf.None}function Qy(t){var e=t.depth,n=(t.stencil,{compare:Xv.wb.Always,depthFailOp:Xv.xS.Keep,failOp:Xv.xS.Keep,passOp:Xv.xS.Keep});return{depthWriteEnabled:e&&e.enable,depthCompare:Xy[(null==e?void 0:e.func)||td.ALWAYS],format:Xv.EV.Depth24PlusStencil8,stencilFront:n,stencilBack:n,stencilReadMask:4294967295,stencilWriteMask:4294967295}}function tm(t,e){var n=t.blend;return[{format:e,alphaBlend:{srcFactor:Yy[n&&n.func&&n.func.srcAlpha||td.ONE],dstFactor:Yy[n&&n.func&&n.func.dstAlpha||td.ZERO],operation:qy[n&&n.equation&&n.equation.alpha||td.FUNC_ADD]},colorBlend:{srcFactor:Yy[n&&n.func&&n.func.srcRGB||td.ONE],dstFactor:Yy[n&&n.func&&n.func.dstRGB||td.ZERO],operation:qy[n&&n.equation&&n.equation.rgb||td.FUNC_ADD]},writeMask:Xv.Yw.All}]}function em(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function nm(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?em(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):em(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function rm(t){for(var e=0,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0,a=r;o<a.length;o++){var u=a[o];e+=u.length}for(var s=new t(e),c=0,f=0,l=r;f<l.length;f++){var d=l[f];s.set(d,c),c+=d.length}return s}var im,om,am,um=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.pipelineLayout=void 0,this.renderPipeline=void 0,this.uniformsBindGroupLayout=void 0,this.uniformBindGroup=void 0,this.uniformBuffer=void 0,this.uniforms={},this.uniformGPUBufferLayout=[],this.attributeCache={},this.indexBuffer=void 0,this.indexCount=void 0}var e,n;return Vf(t,[{key:"init",value:(n=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s,c,f,l,d,h,p,v,g,y=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.options,n=e.vs,r=e.fs,i=e.attributes,o=e.uniforms,a=e.primitive,e.count,u=e.elements,s=e.depth,c=e.blend,f=e.stencil,l=e.cull,e.instances,t.next=3,this.compilePipelineStageDescriptor(n,r,null);case 3:d=t.sent,h=d.vertexStage,p=d.fragmentStage,o&&this.buildUniformBindGroup(o),u&&(this.indexBuffer=u.get(),this.indexCount=u.indexCount),v={vertexBuffers:Object.keys(i).map((function(t,e){var n=i[t],r=n.get(),o=r.arrayStride,a=r.stepMode,u=r.attributes;return y.attributeCache[t]=n,{arrayStride:o,stepMode:a,attributes:u}}))},g={sampleCount:this.engine.mainPassSampleCount,primitiveTopology:Hy[a||td.TRIANGLES],rasterizationState:nm(nm({},this.getDefaultRasterizationStateDescriptor()),{},{cullMode:Jy({cull:l})}),depthStencilState:Qy({depth:s,stencil:f}),colorStates:tm({blend:c},this.engine.options.swapChainFormat),layout:this.pipelineLayout,vertexStage:h,fragmentStage:p,vertexState:v},this.renderPipeline=this.engine.device.createRenderPipeline(g);case 11:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"addUniforms",value:function(t){this.uniforms=nm(nm({},this.uniforms),_y(t))}},{key:"draw",value:function(t){var e=this,n=this.engine.getCurrentRenderPass(),r=nm(nm({},this.uniforms),_y(t.uniforms||{})),i=[];Object.keys(r).forEach((function(t){var n=cl(r[t]);if("boolean"===n||"number"===n||Array.isArray(r[t])||r[t].BYTES_PER_ELEMENT){var o,a=null===(o=e.uniformGPUBufferLayout.find((function(e){return e.name===t})))||void 0===o?void 0:o.offset;null!==a&&e.uniformBuffer.subData({data:r[t],offset:a})}else{var u,s=null===(u=e.uniformGPUBufferLayout.find((function(e){return e.name===t})))||void 0===u?void 0:u.offset;if(null!==s){var c=r[t].get(),f=c.color||c,l=f.texture,d=f.sampler;d&&(i.push({binding:s,resource:d}),s++),i.push({binding:s,resource:l.createView()})}}})),this.uniformBuffer&&(i[0]={binding:0,resource:{buffer:this.uniformBuffer.get()}}),this.uniformBindGroup=this.engine.device.createBindGroup({layout:this.uniformsBindGroupLayout,entries:i}),this.renderPipeline&&n.setPipeline(this.renderPipeline),n.setBindGroup(0,this.uniformBindGroup),this.indexBuffer&&n.setIndexBuffer(this.indexBuffer.get(),Xv.iD.Uint32,0),Object.keys(this.attributeCache).forEach((function(t,r){n.setVertexBuffer(0+r,e.attributeCache[t].get().buffer,0)})),this.indexBuffer?n.drawIndexed(this.indexCount,this.options.instances||1,0,0,0):n.draw(this.options.count||0,this.options.instances||0,0,0)}},{key:"destroy",value:function(){throw new Error("Method not implemented.")}},{key:"compilePipelineStageDescriptor",value:(e=Yf(Xf().mark((function t(e,n,r){var i,o,a;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i="#version 450\n",o=e,a=n,this.engine.options.useWGSL){t.next=10;break}return t.next=6,this.compileShaderToSpirV(e,"vertex",i);case 6:return o=t.sent,t.next=9,this.compileShaderToSpirV(n,"fragment",i);case 9:a=t.sent;case 10:return t.abrupt("return",this.createPipelineStageDescriptor(o,a));case 11:case"end":return t.stop()}}),t,this)}))),function(t,n,r){return e.apply(this,arguments)})},{key:"compileShaderToSpirV",value:function(t,e,n){return this.compileRawShaderToSpirV(n+t,e)}},{key:"compileRawShaderToSpirV",value:function(t,e){return this.engine.glslang.compileGLSL(t,e)}},{key:"createPipelineStageDescriptor",value:function(t,e){return{vertexStage:{module:this.engine.device.createShaderModule({code:t,isWHLSL:_v}),entryPoint:"main"},fragmentStage:{module:this.engine.device.createShaderModule({code:e,isWHLSL:_v}),entryPoint:"main"}}}},{key:"getDefaultRasterizationStateDescriptor",value:function(){return{frontFace:Xv.zX.CCW,cullMode:Xv.Wf.None,depthBias:0,depthBiasSlopeScale:0,depthBiasClamp:0}}},{key:"buildUniformBindGroup",value:function(t){var e=this,n=0,r=rm.apply(void 0,[Float32Array].concat(fy(Object.keys(t).map((function(r){return t[r]?(e.uniformGPUBufferLayout.push({name:r,offset:n}),n+=4*(t[r].length||1),t[r]):[]}))))),i=[],o=!1;r.length&&(o=!0,i.push({binding:0,visibility:Xv.$X.Fragment|Xv.$X.Vertex,type:Xv.$l.UniformBuffer})),Object.keys(t).filter((function(e){return null===t[e]})).forEach((function(t,n){e.uniformGPUBufferLayout.push({name:t,offset:2*n+(o?1:0)}),i.push({binding:2*n+(o?1:0),visibility:Xv.$X.Fragment,type:Xv.$l.Sampler},{binding:2*n+(o?1:0)+1,visibility:Xv.$X.Fragment,type:Xv.$l.SampledTexture})})),this.uniformsBindGroupLayout=this.engine.device.createBindGroupLayout({entries:i}),this.pipelineLayout=this.engine.device.createPipelineLayout({bindGroupLayouts:[this.uniformsBindGroupLayout]}),o&&(this.uniformBuffer=new By(this.engine,{data:r instanceof Array?new Float32Array(r):r,usage:Xv.FB.Uniform|Xv.FB.CopyDst}))}}]),t}(),sm=function(){function t(e,n){Bf(this,t),this.engine=e,this.options=n,this.texture=void 0,this.sampler=void 0,this.width=void 0,this.height=void 0,this.createTexture()}return Vf(t,[{key:"get",value:function(){return{texture:this.texture,sampler:this.sampler}}},{key:"update",value:function(){}},{key:"resize",value:function(t){var e=t.width,n=t.height;e===this.width&&n===this.height||(this.destroy(),this.createTexture()),this.width=e,this.height=n}},{key:"destroy",value:function(){this.texture&&this.texture.destroy()}},{key:"createTexture",value:function(){var t=this.options,e=(void 0===(t.data,t.type)&&td.UNSIGNED_BYTE,t.width),n=t.height,r=(t.flipY,t.format),i=void 0===r?td.RGBA:r,o=(t.mipmap,t.wrapS),a=void 0===o?td.CLAMP_TO_EDGE:o,u=t.wrapT,s=void 0===u?td.CLAMP_TO_EDGE:u,c=t.aniso,f=void 0===c?0:c,l=(t.alignment,t.premultiplyAlpha,t.mag),d=void 0===l?td.NEAREST:l,h=t.min,p=void 0===h?td.NEAREST:h,v=(void 0===t.colorSpace&&td.BROWSER_DEFAULT_WEBGL,t.usage);this.width=e,this.height=n,this.texture=this.engine.device.createTexture({size:[e,n,1],mipLevelCount:1,sampleCount:1,dimension:Xv.kd.E2d,format:Ky[i],usage:v||Xv.v2.Sampled|Xv.v2.CopyDst}),(!v||v&Xv.v2.Sampled)&&(this.sampler=this.engine.device.createSampler({addressModeU:$y[a],addressModeV:$y[s],addressModeW:$y[a],magFilter:Zy[d],minFilter:Zy[p],maxAnisotropy:f}))}}]),t}(),cm=(0,nl.b2)()((om=function(){function t(){var e=this;Bf(this,t),this.supportWebGPU=!0,this.useWGSL=!1,this.options=void 0,this.canvas=void 0,this.context=void 0,this.glslang=void 0,this.adapter=void 0,this.device=void 0,this.swapChain=void 0,this.mainPassSampleCount=void 0,this.mainTexture=void 0,this.depthTexture=void 0,this.mainColorAttachments=void 0,this.mainTextureExtends=void 0,this.mainDepthAttachment=void 0,this.uploadEncoder=void 0,this.renderEncoder=void 0,this.computeEncoder=void 0,this.renderTargetEncoder=void 0,this.commandBuffers=new Array(4).fill(void 0),this.currentRenderPass=null,this.mainRenderPass=null,this.currentRenderTargetViewDescriptor=void 0,this.currentComputePass=null,this.bundleEncoder=void 0,this.tempBuffers=[],this.currentRenderTarget=null,this.uploadEncoderDescriptor={label:"upload"},this.renderEncoderDescriptor={label:"render"},this.renderTargetEncoderDescriptor={label:"renderTarget"},this.computeEncoderDescriptor={label:"compute"},this.pipelines={},this.computePipelines={},this.defaultSampleCount=4,this.clearDepthValue=1,this.clearStencilValue=0,this.transientViewport={x:1/0,y:0,width:0,height:0},this.cachedViewport={x:0,y:0,width:0,height:0},this.clear=function(t){t.framebuffer;var n=t.color,r=t.depth,i=t.stencil;e.options.supportCompute&&e.startComputePass(),e.currentRenderTarget?(e.currentRenderPass&&e.endRenderTargetRenderPass(),e.startRenderTargetRenderPass(e.currentRenderTarget,n||null,!!r,!!i)):(e.mainColorAttachments[0].loadValue=n||Xv.Ws.Load,e.mainDepthAttachment.depthLoadValue=r||Xv.Ws.Load,e.mainDepthAttachment.stencilLoadValue=i?e.clearStencilValue:Xv.Ws.Load,e.mainRenderPass&&e.endMainRenderPass(),e.startMainRenderPass())},this.createModel=function(){var t=Yf(Xf().mark((function t(n){var r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new um(e,n),t.next=3,r.init();case 3:return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new Uy(e,t)},this.createBuffer=function(t){return new By(e,t)},this.createElements=function(t){return new Vy(e,t)},this.createTexture2D=function(t){return new sm(e,t)},this.createFramebuffer=function(t){return new Wy(e,t)},this.useFramebuffer=function(t,n){e.currentRenderTarget&&e.unbindFramebuffer(e.currentRenderTarget),e.currentRenderTarget=t,e.currentRenderTargetViewDescriptor={dimension:Xv.p_.E2d,arrayLayerCount:1,aspect:Xv.H7.All},e.currentRenderPass=null,n()},this.createComputeModel=function(){var t=Yf(Xf().mark((function t(n){var r;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new zy(e,n),t.next=3,r.init();case 3:return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.getCanvas=function(){return e.canvas},this.getGLContext=function(){throw new Error("Method not implemented.")},this.viewport=function(t){var n=t.x,r=t.y,i=t.width,o=t.height;e.currentRenderPass?e.transientViewport.x!==1/0?e.getCurrentRenderPass().setViewport(e.transientViewport.x,e.transientViewport.y,e.transientViewport.width,e.transientViewport.height,0,1):n===e.cachedViewport.x&&r===e.cachedViewport.y&&i===e.cachedViewport.width&&o===e.cachedViewport.height||(e.cachedViewport={x:n,y:r,width:i,height:o},e.getCurrentRenderPass().setViewport(n,r,i,o,0,1)):e.transientViewport={x:n,y:r,width:i,height:o}},this.readPixels=function(t){throw new Error("Method not implemented.")}}var e,n;return Vf(t,[{key:"isFloatSupported",value:function(){return!0}},{key:"init",value:(n=Yf(Xf().mark((function t(e){return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.canvas=e.canvas,this.options=e,this.useWGSL=!!e.useWGSL,this.mainPassSampleCount=e.antialiasing?this.defaultSampleCount:1,t.next=6,this.initGlslang();case 6:this.initContextAndSwapChain(),this.initMainAttachments();case 8:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"setScissor",value:function(t){throw new Error("Method not implemented.")}},{key:"destroy",value:function(){this.mainTexture&&this.mainTexture.destroy(),this.depthTexture&&this.depthTexture.destroy(),this.tempBuffers.forEach((function(t){return t.destroy()})),this.tempBuffers=[]}},{key:"beginFrame",value:function(){this.uploadEncoder=this.device.createCommandEncoder(this.uploadEncoderDescriptor),this.renderEncoder=this.device.createCommandEncoder(this.renderEncoderDescriptor),this.renderTargetEncoder=this.device.createCommandEncoder(this.renderTargetEncoderDescriptor),this.options.supportCompute&&(this.computeEncoder=this.device.createCommandEncoder(this.computeEncoderDescriptor))}},{key:"endFrame",value:function(){this.options.supportCompute&&this.endComputePass(),this.endMainRenderPass(),this.commandBuffers[0]=this.uploadEncoder.finish(),this.commandBuffers[1]=this.renderEncoder.finish(),this.options.supportCompute&&(this.commandBuffers[2]=this.computeEncoder.finish()),this.commandBuffers[3]=this.renderTargetEncoder.finish(),_v?this.device.getQueue().submit(this.commandBuffers.filter((function(t){return t}))):this.device.defaultQueue.submit(this.commandBuffers.filter((function(t){return t})))}},{key:"getCurrentRenderPass",value:function(){return this.currentRenderTarget&&!this.currentRenderPass?this.startRenderTargetRenderPass(this.currentRenderTarget,null,!1,!1):this.currentRenderPass||this.startMainRenderPass(),this.currentRenderPass}},{key:"initGlslang",value:(e=Yf(Xf().mark((function t(){var e,n;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ky();case 2:return this.glslang=t.sent,t.next=5,null===(e=navigator)||void 0===e||null===(n=e.gpu)||void 0===n?void 0:n.requestAdapter();case 5:return this.adapter=t.sent,t.next=8,this.adapter.requestDevice();case 8:this.device=t.sent;case 9:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"initContextAndSwapChain",value:function(){this.context=this.canvas.getContext(_v?"gpu":"gpupresent"),this.swapChain=this.context.configureSwapChain({device:this.device,format:this.options.swapChainFormat,usage:Xv.v2.OutputAttachment|Xv.v2.CopySrc})}},{key:"initMainAttachments",value:function(){if(this.mainTextureExtends={width:this.canvas.width,height:this.canvas.height,depth:1},this.options.antialiasing){var t={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:Xv.kd.E2d,format:Xv.EV.BGRA8Unorm,usage:Xv.v2.OutputAttachment};this.mainTexture&&this.mainTexture.destroy(),this.mainTexture=this.device.createTexture(t),this.mainColorAttachments=[{attachment:_v?this.mainTexture.createDefaultView():this.mainTexture.createView(),loadValue:[0,0,0,1],storeOp:Xv.EG.Store}]}else this.mainColorAttachments=[{attachment:_v?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),loadValue:[0,0,0,1],storeOp:Xv.EG.Store}];var e={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:Xv.kd.E2d,format:_v?"depth32float-stencil8":Xv.EV.Depth24PlusStencil8,usage:Xv.v2.OutputAttachment};this.depthTexture&&this.depthTexture.destroy(),this.depthTexture=this.device.createTexture(e),this.mainDepthAttachment={attachment:_v?this.depthTexture.createDefaultView():this.depthTexture.createView(),depthLoadValue:this.clearDepthValue,depthStoreOp:Xv.EG.Store,stencilLoadValue:this.clearStencilValue,stencilStoreOp:Xv.EG.Store}}},{key:"startComputePass",value:function(){this.currentComputePass&&this.endComputePass(),this.currentComputePass=this.computeEncoder.beginComputePass()}},{key:"startMainRenderPass",value:function(){this.currentRenderPass&&!this.currentRenderTarget&&this.endMainRenderPass(),this.options.antialiasing?this.mainColorAttachments[0].resolveTarget=_v?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView():this.mainColorAttachments[0].attachment=_v?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),this.currentRenderPass=this.renderEncoder.beginRenderPass({colorAttachments:this.mainColorAttachments,depthStencilAttachment:this.mainDepthAttachment}),this.mainRenderPass=this.currentRenderPass,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"startRenderTargetRenderPass",value:function(t,e,n){var r,i,o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=null===(r=t.get().color)||void 0===r?void 0:r.texture;u&&(o=u.createView(this.currentRenderTargetViewDescriptor));var s,c=null===(i=t.get().depth)||void 0===i?void 0:i.texture;c&&(s=c.createView());var f=this.renderTargetEncoder.beginRenderPass({colorAttachments:[{attachment:o,loadValue:null!==e?e:Xv.Ws.Load,storeOp:Xv.EG.Store}],depthStencilAttachment:c&&s?{attachment:s,depthLoadValue:n?this.clearDepthValue:Xv.Ws.Load,depthStoreOp:Xv.EG.Store,stencilLoadValue:a?this.clearStencilValue:Xv.Ws.Load,stencilStoreOp:Xv.EG.Store}:void 0});this.currentRenderPass=f,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"endMainRenderPass",value:function(){this.currentRenderPass===this.mainRenderPass&&null!==this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport(),this.currentRenderPass=null,this.mainRenderPass=null)}},{key:"endComputePass",value:function(){this.currentComputePass&&(this.currentComputePass.endPass(),this.currentComputePass=null)}},{key:"endRenderTargetRenderPass",value:function(){this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport())}},{key:"resetCachedViewport",value:function(){this.cachedViewport={x:0,y:0,width:0,height:0}}},{key:"unbindFramebuffer",value:function(t){this.currentRenderPass&&this.currentRenderPass!==this.mainRenderPass&&this.endRenderTargetRenderPass(),this.transientViewport.x=1/0,this.currentRenderTarget=null,this.currentRenderPass=this.mainRenderPass}}]),t}(),im=om))||im;var fm,lm=4/64,dm=(0,nl.b2)()(am=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){var t=this.config,e=t.widthSegments,n=void 0===e?1:e,r=t.heightSegments,i=void 0===r?1:r,o=t.depthSegments,a=void 0===o?1:o,u=t.halfExtents,s=n,c=i,f=a,l=el(void 0===u?Rl(.5,.5,.5):u,3),d=l[0],h=l[1],p=l[2],v=[Rl(-d,-h,p),Rl(d,-h,p),Rl(d,h,p),Rl(-d,h,p),Rl(d,-h,-p),Rl(-d,-h,-p),Rl(-d,h,-p),Rl(d,h,-p)],g=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],y=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],m=[],b=[],_=[],x=[],w=[],E=0,S=function(t,e,n){var r,i,o,a;for(o=0;o<=e;o++)for(a=0;a<=n;a++){var u=kl(),s=kl(),c=kl(),f=kl();zl(u,v[g[t][0]],v[g[t][1]],o/e),zl(s,v[g[t][0]],v[g[t][2]],a/n),Hl(c,s,v[g[t][0]]),Ll(f,u,c),r=o/e,i=a/n,m.push(f[0],f[1],f[2]),b.push(y[t][0],y[t][1],y[t][2]),_.push(r,i),r=.875*(r/=3)+lm,i=.875*(i/=3)+lm,r+=t%3/3,i+=Math.floor(t/3)/3,x.push(r,i),o<e&&a<n&&(w.push(E+n+1,E+1,E),w.push(E+n+1,E+n+2,E+1)),E++}};S(0,s,c),S(1,s,c),S(2,s,f),S(3,s,f),S(4,f,c),S(5,f,c);var A=pv(m),T=this.getComponent();T.indices=Uint32Array.from(w),T.aabb=A,T.vertexCount=E,T.attributes=[{dirty:!0,name:"position",data:Float32Array.from(m),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(b),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(_),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),i}(Hv))||am;var hm,pm=(0,nl.b2)()(fm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){var t=this.config.geometries,e=void 0===t?[]:t,n=this.getComponent();n.aabb=new Od;var r=[],i=[],o=0;e.forEach((function(t){var e=t.aabb,a=t.indices,u=t.vertexCount,s=t.attributes;n.aabb.add(e),n.vertexCount+=u,a&&i.push.apply(i,fy(a.map((function(t){return t+o})))),o+=u,s.forEach((function(t,e){r[e]?t.data&&(xv(t.data)?r[e].push(t.data):og(t.data)?r[e].data=function(t,e){if(!t&&!e)throw new Error("Please specify valid arguments for parameters a and b.");if(!e||0===e.length)return t;if(!t||0===t.length)return e;if(Object.prototype.toString.call(t)!==Object.prototype.toString.call(e))throw new Error("The types of the two arguments passed for parameters a and b do not match.");var n=new t.constructor(t.length+e.length);return n.set(t),n.set(e,t.length),n}(r[e].data,t.data):r[e].data=r[e].data.concat(t.data)):(r[e]=t,r[e].dirty=!0)}))})),n.attributes=r,n.indices=Uint32Array.from(i),n.dirty=!0}}]),i}(Hv))||fm;var vm,gm=(0,nl.b2)()(hm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){for(var t=this.config,e=t.halfExtents,n=void 0===e?[.5,.5]:e,r=t.widthSegments,i=void 0===r?5:r,o=t.lengthSegments,a=void 0===o?5:o,u=[],s=[],c=[],f=[],l=0,d=0;d<=i;d++)for(var h=0;h<=a;h++){var p=-n[0]+2*n[0]*d/i,v=-(-n[1]+2*n[1]*h/a),g=d/i,y=h/a;u.push(p,0,v),s.push(0,1,0),c.push(g,y),d<i&&h<a&&(f.push(l+a+1,l+1,l),f.push(l+a+1,l+a+2,l+1)),l++}var m=pv(u),b=this.getComponent();b.indices=Uint32Array.from(f),b.aabb=m,b.vertexCount=l,b.attributes=[{dirty:!0,name:"position",data:Float32Array.from(u),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(s),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(c),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),i}(Hv))||hm;var ym,mm,bm,_m,xm,wm,Em,Sm,Am=(0,nl.b2)()(vm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){return Bf(this,i),r.apply(this,arguments)}return Vf(i,[{key:"onEntityCreated",value:function(){for(var t=this.config,e=t.radius,n=void 0===e?.5:e,r=t.latitudeBands,i=void 0===r?16:r,o=t.longitudeBands,a=void 0===o?16:o,u=[],s=[],c=[],f=[],l=0;l<=i;l++)for(var d=l*Math.PI/i,h=Math.sin(d),p=Math.cos(d),v=0;v<=a;v++){var g=2*v*Math.PI/a-Math.PI/2,y=Math.sin(g),m=Math.cos(g)*h,b=p,_=y*h,x=1-v/a,w=1-l/i;u.push(m*n,b*n,_*n),s.push(m,b,_),c.push(x,w)}for(var E=0;E<i;++E)for(var S=0;S<a;++S){var A=E*(a+1)+S,T=A+a+1;f.push(A+1,T,A),f.push(A+1,T+1,T)}var I=pv(u),N=this.getComponent();N.indices=Uint32Array.from(f),N.aabb=I,N.vertexCount=u.length/3,N.attributes=[{dirty:!0,name:"position",data:Float32Array.from(u),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(s),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(c),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),i}(Hv))||vm;var Tm,Im,Nm,Om,Cm,km,Dm,Mm,Rm,Pm,Gm,Lm,jm=(ym=(0,nl.b2)(),mm=(0,nl.f3)(rl.RenderEngine),bm=(0,nl.f3)(rl.ShaderModuleService),ym((Sm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"engine",wm,fl(t)),Uf(t,"shaderModuleService",Em,fl(t)),t}return Vf(i,[{key:"onEntityCreated",value:function(){var t=this.getComponent(),e=this.engine.supportWebGPU?"layout(set = 0, binding = 0) uniform Uniforms {\n vec4 color;\n mat4 projectionMatrix;\n mat4 modelViewMatrix;\n} uniforms;\n\nlayout(location = 0) in vec3 position;\n// layout(location = 1) in vec3 barycentric;\n\nlayout(location = 0) out vec4 fragColor;\n// layout(location = 1) out vec3 v_Barycentric;\n\nvoid main() {\n gl_Position = uniforms.projectionMatrix * uniforms.modelViewMatrix * vec4(position, 1.0);\n fragColor = uniforms.color;\n // v_Barycentric = barycentric;\n}":'attribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec4 color;\n\nvarying vec4 fragColor;\n\n#pragma include "uv.vert.declaration"\n\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n fragColor = color;\n\n #pragma include "uv.vert.main"\n}',n=this.engine.supportWebGPU?"// layout(set = 0, binding = 1) uniform WireframeUniforms {\n// float lineWidth;\n// vec4 lineColor;\n// } wireframe;\n\nlayout(location = 0) in vec4 fragColor;\n// layout(location = 1) in vec3 v_Barycentric;\n\nlayout(location = 0) out vec4 outColor;\n\n// wireframe\n// float edgeFactor() {\n// vec3 d = fwidth(v_Barycentric);\n// vec3 a3 = smoothstep(vec3(0.0), d * wireframe.lineWidth, v_Barycentric);\n// return min(min(a3.x, a3.y), a3.z);\n// }\n\nvoid main() {\n // outColor = mix(fragColor, wireframe.lineColor, (1.0 - edgeFactor()));\n outColor = fragColor;\n}":'varying vec4 fragColor;\n\n#pragma include "uv.frag.declaration"\n#pragma include "map.frag.declaration"\n\nvoid main() {\n vec4 diffuseColor = fragColor;\n\n #pragma include "map.frag.main"\n\n gl_FragColor = diffuseColor;\n}';this.shaderModuleService.registerModule("material-basic",{vs:e,fs:n});var r=this.shaderModuleService.getModule("material-basic"),i=r.vs,o=r.fs,a=r.uniforms;t.vertexShaderGLSL=i,t.fragmentShaderGLSL=o,t.setUniform(a),this.config.map&&(t.setDefines({USE_UV:1,USE_MAP:1}),t.setUniform({map:this.config.map,uvTransform:Cl()}))}}]),i}(Wg),wm=Wf((xm=Sm).prototype,"engine",[mm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Em=Wf(xm.prototype,"shaderModuleService",[bm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_m=xm))||_m);var Fm,Um,Bm,zm,Vm,Wm,Hm,Xm,qm,Ym,Km,Zm,$m=(Tm=(0,nl.b2)(),Im=(0,nl.f3)(rl.Systems),Nm=(0,nl.t6)(rl.MaterialSystem),Om=(0,nl.f3)(rl.Systems),Cm=(0,nl.t6)(rl.GeometrySystem),km=(0,nl.f3)(rl.ShaderModuleService),Tm((Lm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"materialSystem",Rm,fl(t)),Uf(t,"geometrySystem",Pm,fl(t)),Uf(t,"shaderModuleService",Gm,fl(t)),t}return Vf(i,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();r&&r.material&&("gridColor"===e?(r.material.setUniform("u_GridColor",n),r.material.setUniform("u_GridColor2",n)):"gridSize"===e&&(r.material.setUniform("u_GridSize",n),r.material.setUniform("u_GridSize2",n)))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:"attribute vec3 a_Position;\n\nvarying vec3 v_Position;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvoid main() {\n v_Position = a_Position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_Position, 1.);\n}",fs:"// generate grid, borrow from clay.gl viewer\n// @see https://github.com/pissang/clay-viewer/blob/master/src/graphic/ground.glsl\n#extension GL_OES_standard_derivatives : enable\n\nvarying vec3 v_Position;\n// varying vec3 v_Normal;\n\nuniform float u_GridSize : 5;\nuniform float u_GridSize2 : .5;\nuniform vec4 u_GridColor : [0, 0, 0, 1];\nuniform vec4 u_GridColor2 : [0.3, 0.3, 0.3, 1];\nuniform bool u_GridEnabled : true;\n\n// uniform vec3 u_LightDirection;\n// uniform vec3 u_LightColor;\n// uniform vec3 u_Camera;\n\nvoid main() {\n // vec3 n = v_Normal;\n // vec3 l = normalize(u_LightDirection);\n // float NdotL = clamp(dot(n, l), 0.001, 1.0);\n\n gl_FragColor = vec4(1.);\n\n if (u_GridEnabled) {\n float wx = v_Position.x;\n float wz = v_Position.z;\n // float x0 = abs(fract(wx / u_GridSize - 0.5) - 0.5) / fwidth(wx) * u_GridSize / 2.0;\n // float z0 = abs(fract(wz / u_GridSize - 0.5) - 0.5) / fwidth(wz) * u_GridSize / 2.0;\n\n float x1 = abs(fract(wx / u_GridSize2 - 0.5) - 0.5) / fwidth(wx) * u_GridSize2;\n float z1 = abs(fract(wz / u_GridSize2 - 0.5) - 0.5) / fwidth(wz) * u_GridSize2;\n\n // float v0 = 1.0 - clamp(min(x0, z0), 0.0, 1.0);\n float v1 = 1.0 - clamp(min(x1, z1), 0.0, 1.0);\n // if (v0 > 0.1) {\n // gl_FragColor = mix(gl_FragColor, u_GridColor, v0);\n // }\n // else {\n gl_FragColor = mix(gl_FragColor, u_GridColor2, v1);\n // }\n }\n\n // float shadowFactor = calcShadow(u_ShadowMap, v_PositionFromLight, l, n);\n // vec3 diffuseColor = u_LightColor * NdotL * shadowFactor;\n\n // gl_FragColor.rgb *= diffuseColor;\n}"});var t=this.shaderModuleService.getModule("grid"),e=t.vs,n=t.fs,r=t.uniforms,i=this.materialSystem.createShaderMaterial({vertexShader:e,fragmentShader:n});this.setMaterial(i);var o=this.geometrySystem.createBufferGeometry({vertexCount:4});this.setGeometry(o),i.setCull({enable:!1,face:td.BACK}).setDepth({enable:!0,func:td.LESS}),i.setUniform(r),this.setAttributes({gridColor:this.config.gridColor,gridSize:this.config.gridSize}),o.setIndex([0,3,2,2,1,0]),o.setAttribute("a_Position",Float32Array.from([-4,-1,-4,4,-1,-4,4,-1,4,-4,-1,4]),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})}}]),i}(Hg),Rm=Wf((Mm=Lm).prototype,"materialSystem",[Im,Nm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Pm=Wf(Mm.prototype,"geometrySystem",[Om,Cm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Gm=Wf(Mm.prototype,"shaderModuleService",[km],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Dm=Mm))||Dm),Jm=n(7801),Qm=n(1739);function tb(t,e,n,r,i){eb(e,r,-i),eb(e,r,i),t.push(n),t.push(n)}function eb(t,e,n){t.push([[e[0],e[1]],n])}var nb,rb,ib,ob,ab,ub,sb,cb,fb,lb,db,hb,pb=(Fm=(0,nl.b2)(),Um=(0,nl.f3)(rl.Systems),Bm=(0,nl.t6)(rl.MaterialSystem),zm=(0,nl.f3)(rl.Systems),Vm=(0,nl.t6)(rl.GeometrySystem),Wm=(0,nl.f3)(rl.ShaderModuleService),Fm((Zm=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"materialSystem",qm,fl(t)),Uf(t,"geometrySystem",Ym,fl(t)),Uf(t,"shaderModuleService",Km,fl(t)),t.vertexCount=void 0,t}return Vf(i,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();if(r&&r.material)switch(e){case"dashArray":r.material.setUniform("u_dash_array",n);break;case"dashOffset":r.material.setUniform("u_dash_offset",n);break;case"dashRatio":r.material.setUniform("u_dash_ratio",n);break;case"thickness":r.material.setUniform("u_thickness",n);break;case"color":var i=new Array(this.vertexCount).fill(void 0).map((function(){return n})).reduce((function(t,e){return[].concat(fy(t),fy(e))}),[]);r.geometry.setAttribute("a_color",Float32Array.from(i),{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]})}}},{key:"onEntityCreated",value:function(){var t=this;this.shaderModuleService.registerModule("line",{vs:"attribute vec2 a_pos;\nattribute vec4 a_color;\nattribute float a_line_miter;\nattribute vec2 a_line_normal;\nattribute float a_counters;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform float u_thickness : 0.02;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n v_color = a_color;\n v_counters = a_counters;\n\n vec3 normal = normalize(vec3(a_line_normal, 0.0));\n\n vec4 offset = vec4(normal * u_thickness / 2.0 * a_line_miter, 0.0);\n\n v_normal = vec2(normal * sign(a_line_miter));\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_pos, 0.0, 1.0) + offset;\n}\n",fs:"uniform float u_dash_array : 0.02;\nuniform float u_dash_offset : 0;\nuniform float u_dash_ratio : 0;\nuniform float u_thickness : 0.02;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n float blur = 1. - smoothstep(0.98, 1., length(v_normal));\n\n gl_FragColor = v_color;\n gl_FragColor.a *= blur * ceil(mod(v_counters + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n}"});var e=this.shaderModuleService.getModule("line"),n=e.vs,r=e.fs,i=e.uniforms,o=this.materialSystem.createShaderMaterial({vertexShader:n,fragmentShader:r}),a=function(t,e,n){for(var r=[0,0],i=[0,0],o=[0,0],a=[0,0],u=-1,s=!1,c=null,f=(0,Jm.create)(),l=0,d=[],h=[],p=[],v=[0,0],g=t.length,y=1;y<g;y++){var m=l,b=t[y-1],_=t[y],x=y<t.length-1?t[y+1]:null;if(v.push(y/g,y/g),(0,Qm.o7)(r,_,b),c||(c=[0,0],(0,Qm.mJ)(c,r)),s||(s=!0,tb(h,d,b,c,1)),p.push([m+0,m+1,m+2]),x){(0,Qm.o7)(i,x,_);var w=(0,Qm.x7)(o,a,r,i,1),E=(0,Jm.dot)(o,c)<0?-1:1,S=w>3;if(!isFinite(w)){(0,Qm.mJ)(c,r),tb(h,d,_,c,1),p.push(1===u?[m,m+2,m+3]:[m+2,m+1,m+3]),l+=2,u=E;continue}S?(w=3,v.push(y/g),eb(d,c,-E),h.push(_),eb(d,a,w*E),h.push(_),p.push(u!==-E?[m,m+2,m+3]:[m+2,m+1,m+3]),p.push([m+2,m+3,m+4]),(0,Qm.mJ)(f,i),(0,Jm.copy)(c,f),eb(d,c,-E),h.push(_),l+=3):(tb(h,d,_,a,w),p.push(1===u?[m,m+2,m+3]:[m+2,m+1,m+3]),E=-1,(0,Jm.copy)(c,a),l+=2),u=E}else(0,Qm.mJ)(c,r),tb(h,d,_,c,1),p.push(1===u?[m,m+2,m+3]:[m+2,m+1,m+3]),l+=2}return{normals:d,attrIndex:p,attrPos:h,attrCounters:v}}(this.config.points),u=a.normals,s=a.attrIndex,c=a.attrPos,f=a.attrCounters,l=c.length;this.vertexCount=l;var d=this.geometrySystem.createBufferGeometry({vertexCount:l});this.setMaterial(o),this.setGeometry(d),o.setCull({enable:!1,face:td.BACK}).setUniform(i),this.setAttributes({dashArray:this.config.dashArray,dashOffset:this.config.dashOffset,dashRatio:this.config.dashRatio,thickness:this.config.thickness});var h=[],p=[];u.forEach((function(t){var e=t[0],n=t[1];h.push([e[0],e[1]]),p.push(n)})),d.setIndex(s.reduce((function(t,e){return[].concat(fy(t),fy(e))}),[])),d.setAttribute("a_pos",Float32Array.from(c.reduce((function(t,e){return[].concat(fy(t),fy(e))}),[])),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]});var v=new Array(l).fill(void 0).map((function(){return fy(t.config.color)})).reduce((function(t,e){return[].concat(fy(t),fy(e))}),[]);d.setAttribute("a_color",Float32Array.from(v),{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]}),d.setAttribute("a_line_miter",Float32Array.from(p),{arrayStride:4,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float"}]}),d.setAttribute("a_line_normal",Float32Array.from(h.reduce((function(t,e){return[].concat(fy(t),fy(e))}),[])),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:3,offset:0,format:"float2"}]}),d.setAttribute("a_counters",Float32Array.from(f),{arrayStride:4,stepMode:"vertex",attributes:[{shaderLocation:4,offset:0,format:"float"}]})}}]),i}(Hg),qm=Wf((Xm=Zm).prototype,"materialSystem",[Um,Bm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ym=Wf(Xm.prototype,"geometrySystem",[zm,Vm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Km=Wf(Xm.prototype,"shaderModuleService",[Wm],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Hm=Xm))||Hm);function vb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var gb,yb,mb,bb,_b,xb,wb,Eb,Sb,Ab,Tb=["circle","triangle","square","pentagon","hexagon","octogon","hexagram","rhombus","vesica"],Ib=(nb=(0,nl.b2)(),rb=(0,nl.f3)(rl.Systems),ib=(0,nl.t6)(rl.MaterialSystem),ob=(0,nl.f3)(rl.Systems),ab=(0,nl.t6)(rl.GeometrySystem),ub=(0,nl.f3)(rl.ShaderModuleService),nb((hb=function(t){sl(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=dl(e);if(n){var i=dl(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return ll(this,t)});function i(){var t;Bf(this,i);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return Uf(t=r.call.apply(r,[this].concat(n)),"materialSystem",fb,fl(t)),Uf(t,"geometrySystem",lb,fl(t)),Uf(t,"shaderModuleService",db,fl(t)),t}return Vf(i,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();r&&r.material&&("strokeWidth"===e?r.material.setUniform("u_stroke_width",n):"strokeColor"===e?r.material.setUniform("u_stroke_color",n):"strokeOpacity"===e?r.material.setUniform("u_stroke_opacity",n):"opacity"===e?r.material.setUniform("u_opacity",n):"blur"===e&&r.material.setUniform("u_blur",n))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:'attribute vec2 position;\nattribute vec4 color;\nattribute float shape;\nattribute vec2 offset;\nattribute float size;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nuniform float u_stroke_width : 0.01;\nuniform float u_device_pixel_ratio;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec4 v_data;\nvarying float v_radius;\n\n#pragma include "picking"\n\nvoid main() {\n v_color = color;\n v_radius = size;\n\n lowp float antialiasblur = 1.0 / u_device_pixel_ratio * (size + u_stroke_width);\n\n // construct point coords\n v_data = vec4(position, antialiasblur, shape);\n\n gl_Position = projectionMatrix * modelViewMatrix\n * vec4(position * size + offset, 0.0, 1.0);\n\n setPickingColor(a_PickingColor);\n}',fs:"uniform float u_blur : 0.05;\nuniform float u_opacity : 0.7;\nuniform float u_stroke_width : 0.01;\nuniform vec4 u_stroke_color : [0, 0, 0, 0];\nuniform float u_stroke_opacity : 1;\n\nvarying vec4 v_color;\nvarying vec4 v_data;\nvarying float v_radius;\n\n#pragma include \"sdf2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n float antialiasblur = v_data.z;\n float antialiased_blur = -max(u_blur, antialiasblur);\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n // if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n // } else if (shape == 1) {\n // outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n // inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n // } else if (shape == 2) {\n // outer_df = sdBox(v_data.xy, vec2(1.));\n // inner_df = sdBox(v_data.xy, vec2(r));\n // } else if (shape == 3) {\n // outer_df = sdPentagon(v_data.xy, 0.8);\n // inner_df = sdPentagon(v_data.xy, r * 0.8);\n // } else if (shape == 4) {\n // outer_df = sdHexagon(v_data.xy, 0.8);\n // inner_df = sdHexagon(v_data.xy, r * 0.8);\n // } else if (shape == 5) {\n // outer_df = sdOctogon(v_data.xy, 1.0);\n // inner_df = sdOctogon(v_data.xy, r);\n // } else if (shape == 6) {\n // outer_df = sdHexagram(v_data.xy, 0.52);\n // inner_df = sdHexagram(v_data.xy, r * 0.52);\n // } else if (shape == 7) {\n // outer_df = sdRhombus(v_data.xy, vec2(1.0));\n // inner_df = sdRhombus(v_data.xy, vec2(r));\n // } else if (shape == 8) {\n // outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n // inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n // }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n vec4 strokeColor = u_stroke_color == vec4(0) ? v_color : u_stroke_color;\n\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);\n gl_FragColor.a = gl_FragColor.a * opacity_t;\n\n gl_FragColor = filterColor(gl_FragColor);\n}"});var t=this.shaderModuleService.getModule("grid"),e=t.vs,n=t.fs,r=t.uniforms,i=this.materialSystem.createShaderMaterial({vertexShader:e,fragmentShader:n,cull:{enable:!1},depth:{enable:!1},blend:{enable:!0,func:{srcRGB:td.SRC_ALPHA,dstRGB:td.ONE_MINUS_SRC_ALPHA,srcAlpha:1,dstAlpha:1}}});i.setUniform(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vb(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vb(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({u_device_pixel_ratio:window.devicePixelRatio},r));var o=this.buildAttributes(),a=this.geometrySystem.createInstancedBufferGeometry({maxInstancedCount:o.instancedOffsets.length/2,vertexCount:6});a.setIndex([0,2,1,0,3,2]),a.setAttribute("position",Float32Array.from(o.positions),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]}),a.setAttribute("offset",Float32Array.from(o.instancedOffsets),{arrayStride:8,stepMode:"instance",attributes:[{shaderLocation:1,offset:0,format:"float2"}]}),a.setAttribute("color",Float32Array.from(o.instancedColors),{arrayStride:16,stepMode:"instance",attributes:[{shaderLocation:2,offset:0,format:"float4"}]}),a.setAttribute("size",Float32Array.from(o.instancedSizes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:3,offset:0,format:"float"}]}),a.setAttribute("shape",Float32Array.from(o.instancedShapes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:4,offset:0,format:"float"}]}),a.setAttribute("a_PickingColor",Float32Array.from(o.instancedPickingColors),{arrayStride:12,stepMode:"instance",attributes:[{shaderLocation:6,offset:0,format:"float3"}]}),this.setMaterial(i),this.setGeometry(a)}},{key:"buildAttribute",value:function(t,e,n){var r,i,o,a,u;(r=e.instancedPickingColors).push.apply(r,fy([(u=t.id||n)+1&255,u+1>>8&255,u+1>>8>>8&255])),e.instancedShapes.push(Tb.indexOf(t.shape||"circle")),(i=e.instancedColors).push.apply(i,fy(t.color||[1,0,0,1])),(o=e.instancedOffsets).push.apply(o,fy(t.position||[0,0])),(a=e.instancedSizes).push.apply(a,fy(t.size||[.2,.2]))}},{key:"buildAttributes",value:function(){var t=this,e={positions:[1,1,1,-1,-1,-1,-1,1],instancedOffsets:[],instancedColors:[],instancedSizes:[],instancedShapes:[],instancedPickingColors:[]};return Array.isArray(this.config)?this.config.forEach((function(n,r){t.buildAttribute(n,e,r)})):this.buildAttribute(this.config,e,0),e}}]),i}(Hg),fb=Wf((cb=hb).prototype,"materialSystem",[rb,ib],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),lb=Wf(cb.prototype,"geometrySystem",[ob,ab],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),db=Wf(cb.prototype,"shaderModuleService",[ub],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),sb=cb))||sb);function Nb(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ob(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ob(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Ob(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}var Cb,kb,Db,Mb,Rb,Pb,Gb,Lb,jb,Fb,Ub,Bb,zb=(gb=(0,nl.b2)(),yb=(0,nl.f3)(rl.RenderEngine),mb=(0,nl.f3)(rl.ShaderModuleService),bb=(0,nl.f3)(rl.ConfigService),gb((Ab=function(){function t(){Bf(this,t),this.container=void 0,Uf(this,"engine",wb,this),Uf(this,"shaderModule",Eb,this),Uf(this,"configService",Sb,this),this.inited=!1,this.rendering=!1,this.pendings=[],this.views=[],this.size=void 0}var e,n;return Vf(t,[{key:"init",value:(n=Yf(Xf().mark((function t(){var e,n,r,i,o;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.shaderModule.registerBuiltinModules(),this.shaderModule.registerModule("uv.vert.declaration",{vs:"#ifdef USE_UV\n attribute vec2 uv;\n\t#ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif"}),this.shaderModule.registerModule("uv.vert.main",{vs:"#ifdef USE_UV\n vUv = (uvTransform * vec3(uv, 1)).xy;\n#endif"}),this.shaderModule.registerModule("uv.frag.declaration",{fs:"#if (defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ))\n varying vec2 vUv;\n#endif"}),this.shaderModule.registerModule("map.frag.declaration",{fs:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif"}),this.shaderModule.registerModule("map.frag.main",{fs:"#ifdef USE_MAP\n vec4 texelColor = texture2D(map, vUv);\n // texelColor = mapTexelToLinear(texelColor);\n diffuseColor *= texelColor;\n#endif"}),e=this.container.getAll(rl.Systems),!(n=this.configService.get()).canvas){t.next=30;break}return t.next=11,this.engine.init({canvas:n.canvas,swapChainFormat:Xv.EV.BGRA8Unorm,antialiasing:!1});case 11:r=Nb(e),t.prev=12,r.s();case 14:if((i=r.n()).done){t.next=21;break}if(!(o=i.value).initialize){t.next=19;break}return t.next=19,o.initialize();case 19:t.next=14;break;case 21:t.next=26;break;case 23:t.prev=23,t.t0=t.catch(12),r.e(t.t0);case 26:return t.prev=26,r.f(),t.finish(26);case 29:this.inited=!0;case 30:case"end":return t.stop()}}),t,this,[[12,23,26,29]])}))),function(){return n.apply(this,arguments)})},{key:"render",value:(e=Yf(Xf().mark((function t(){var e,n,r,i,o,a,u,s=arguments;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.inited&&!this.rendering){t.next=2;break}return t.abrupt("return");case 2:for(this.pendings.length&&this.pendings.forEach((function(t){t()})),this.rendering=!0,this.engine.beginFrame(),e=this.container.getAll(rl.Systems),n=s.length,r=new Array(n),i=0;i<n;i++)r[i]=s[i];o=Nb(e),t.prev=8,o.s();case 10:if((a=o.n()).done){t.next=17;break}if(!(u=a.value).execute){t.next=15;break}return t.next=15,u.execute(r);case 15:t.next=10;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(8),o.e(t.t0);case 22:return t.prev=22,o.f(),t.finish(22);case 25:this.engine.endFrame(),this.rendering=!1;case 27:case"end":return t.stop()}}),t,this,[[8,19,22,25]])}))),function(){return e.apply(this,arguments)})},{key:"clear",value:function(t){var e=this;return this.inited?this.engine.clear(t):this.pendings.unshift((function(){e.engine.clear(t),e.pendings.shift()})),this}},{key:"setSize",value:function(t){var e=t.width,n=t.height,r=this.engine.getCanvas();return this.size={width:e,height:n},r.width=e,r.height=n,this}},{key:"getSize",value:function(){return this.size}}]),t}(),wb=Wf((xb=Ab).prototype,"engine",[yb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Eb=Wf(xb.prototype,"shaderModule",[mb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sb=Wf(xb.prototype,"configService",[bb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_b=xb))||_b),Vb=(0,nl.b2)()((kb=function(){function t(){Bf(this,t),this.entities=[]}return Vf(t,[{key:"getEntities",value:function(){return this.entities}},{key:"addRenderable",value:function(t){return this.addEntity(t.getEntity()),this}},{key:"removeRenderable",value:function(t){return this.removeEntity(t.getEntity()),this}},{key:"addLight",value:function(){}},{key:"addEntity",value:function(t){return-1===this.entities.indexOf(t)&&this.entities.push(t),this}},{key:"removeEntity",value:function(t){var e=this.entities.indexOf(t);return this.entities.splice(e,1),this}}]),t}(),Cb=kb))||Cb,Wb=(0,nl.b2)()((Mb=function(){function t(){Bf(this,t),this.cache={}}return Vf(t,[{key:"get",value:function(t){return this.cache[t]}},{key:"set",value:function(t,e){this.cache[t]=e}}]),t}(),Db=Mb))||Db;function Hb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Xb(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Hb(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hb(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var qb,Yb,Kb,Zb,$b,Jb,Qb,t_,e_,n_,r_,i_,o_,a_=(Rb=(0,nl.b2)(),Pb=(0,nl.f3)(Wb),Gb=(0,nl.f3)(rl.RenderEngine),Rb((Bb=function(){function t(){Bf(this,t),Uf(this,"textureCache",Fb,this),Uf(this,"engine",Ub,this),this.config=void 0,this.loaded=!1,this.texture=void 0}var e;return Vf(t,[{key:"setConfig",value:function(t){this.config=t}},{key:"isLoaded",value:function(){return this.loaded}},{key:"load",value:(e=Yf(Xf().mark((function t(){var e=this;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.config.url){t.next=4;break}return t.abrupt("return",new Promise((function(t,n){var r=e.textureCache.get(e.config.url);if(r)t(r);else{var i=new Image;i.crossOrigin="Anonymous",i.src=e.config.url,i.onload=function(){var n=e.engine.createTexture2D(Xb(Xb({},e.config),{},{data:i,width:i.width,height:i.height,flipY:!0}));e.textureCache.set(e.config.url,n),e.texture=n,e.loaded=!0,t(n)},i.onerror=function(){n()}}})));case 4:return this.loaded=!0,this.texture=this.engine.createTexture2D(this.config),t.abrupt("return",this.texture);case 7:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),Fb=Wf((jb=Bb).prototype,"textureCache",[Pb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ub=Wf(jb.prototype,"engine",[Gb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Lb=jb))||Lb),u_=(qb=(0,nl.b2)(),Yb=(0,nl.f3)(rl.Systems),Kb=(0,nl.t6)(rl.RendererSystem),qb((Qb=function(){function t(){Bf(this,t),Uf(this,"rendererSystem",Jb,this),this.camera=void 0,this.scene=void 0,this.viewport={x:0,y:0,width:0,height:0},this.clearColor=[1,1,1,1]}return Vf(t,[{key:"getCamera",value:function(){return this.camera}},{key:"getScene",value:function(){return this.scene}},{key:"getViewport",value:function(){return this.viewport}},{key:"getClearColor",value:function(){return this.clearColor}},{key:"setCamera",value:function(t){return this.camera=t,this}},{key:"setScene",value:function(t){return this.scene=t,this}},{key:"setViewport",value:function(t){return this.viewport=t,this}},{key:"setClearColor",value:function(t){return this.clearColor=t,this}},{key:"pick",value:function(t){return this.rendererSystem.pick(t,this)}}]),t}(),Jb=Wf(($b=Qb).prototype,"rendererSystem",[Yb,Kb],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Zb=$b))||Zb);function s_(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c_(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s_(Object(n),!0).forEach((function(e){Sl(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s_(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var f_=(t_=(0,nl.b2)(),e_=(0,nl.f3)(rl.ConfigService),t_((o_=function(){function t(){Bf(this,t),Uf(this,"configService",i_,this),this.container=void 0}var e;return Vf(t,[{key:"getEngine",value:(e=Yf(Xf().mark((function t(){var e,n,r,i;return Xf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.container.get(rl.RenderEngine),n=this.configService.get(),r=n.canvas,i=n.engineOptions,t.next=4,e.init(c_({canvas:r||qv(),swapChainFormat:Xv.EV.BGRA8Unorm,antialiasing:!1},i));case 4:return t.abrupt("return",e);case 5:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"getTransformComponent",value:function(t){return this.container.get(rl.TransformComponentManager).getComponentByEntity(t)}},{key:"getMeshComponent",value:function(t){return this.container.get(rl.MeshComponentManager).getComponentByEntity(t)}},{key:"setConfig",value:function(t){this.configService.set(t)}},{key:"setContainer",value:function(t){this.container=t}},{key:"getContainer",value:function(){return this.container}},{key:"createEntity",value:function(){return Zf()}},{key:"createScene",value:function(){return this.container.get(Vb)}},{key:"createCamera",value:function(){return this.container.get(Wv)}},{key:"createView",value:function(){return this.container.get(u_)}},{key:"createRenderable",value:function(t,e){var n=t?this.container.getNamed(rl.Renderable,t):this.container.get(Hg),r=Zf();return n.setConfig(e||{}),n.setEntity(r),n}},{key:"createGeometry",value:function(t,e){var n=this.container.getNamed(rl.Geometry,t),r=Zf();return n.setConfig(e||{}),n.setEntity(r),n.getComponent()}},{key:"createMaterial",value:function(t,e){var n=this.container.getNamed(rl.Material,t),r=Zf();return n.setConfig(e||{}),n.setEntity(r,t),n.getComponent()}},{key:"createTexture2D",value:function(t){var e=this.container.get(a_);return e.setConfig(t),e}},{key:"createBufferGeometry",value:function(t){return this.container.getNamed(rl.Systems,rl.GeometrySystem).createBufferGeometry(t)}},{key:"createInstancedBufferGeometry",value:function(t){return this.container.getNamed(rl.Systems,rl.GeometrySystem).createInstancedBufferGeometry(t)}},{key:"createShaderMaterial",value:function(t){return this.container.getNamed(rl.Systems,rl.MaterialSystem).createShaderMaterial(t)}},{key:"createKernel",value:function(t){var e=this.container.get(Vg);return"string"==typeof t?e.setBundle(JSON.parse(t)):e.setBundle(t),e.init(),e}},{key:"createRenderer",value:function(){var t=this.container.get(zb);return t.container=this.container,t.init(),t}},{key:"destroy",value:function(){this.container.getAll(rl.Systems).forEach((function(t){t.tearDown&&t.tearDown()})),this.container.get(rl.RenderEngine).destroy(),this.container.get(rl.InteractorService).destroy()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=hv(),r=navigator.gpu?cm:Oy;n.isBound(rl.RenderEngine)||n.bind(rl.RenderEngine).to(r).inSingletonScope(),n.bind(zb).toSelf(),n.bind(Vg).toSelf(),n.bind(Hg).toSelf(),n.bind(u_).toSelf(),n.bind(Wv).toSelf(),n.bind(Vb).toSelf(),n.bind(t).toSelf(),n.bind(Wb).toSelf(),n.bind(a_).toSelf(),n.bind(rl.Geometry).to(dm).whenTargetNamed(Hv.BOX),n.bind(rl.Geometry).to(Am).whenTargetNamed(Hv.SPHERE),n.bind(rl.Geometry).to(gm).whenTargetNamed(Hv.PLANE),n.bind(rl.Geometry).to(pm).whenTargetNamed(Hv.MERGED),n.bind(rl.Material).to(jm).whenTargetNamed(Wg.BASIC),n.bind(rl.Renderable).to(Ib).whenTargetNamed(Hg.POINT),n.bind(rl.Renderable).to(pb).whenTargetNamed(Hg.LINE),n.bind(rl.Renderable).to($m).whenTargetNamed(Hg.GRID);var i=n.get(t);return i.setContainer(n),i.setConfig(e),i}}]),t}(),i_=Wf((r_=o_).prototype,"configService",[e_],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),n_=r_))||n_),l_=function(t,e){return t?o(t)?function(){return t}:t:function(){return e||1}},d_=function(t){for(var e=[],n=t.length,r=t[0].length,i=function(r){t.forEach((function(t,i){if(e.push(t[r]),i===n-1)for(;e.length%4!=0;)e.push(0)}))},o=0;o<r;o++)i(o);return new Float32Array(e)},h_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},v_=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},g_=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.gravity=10,n.speed=1,n.clustering=!1,n.clusterField="cluster",n.clusterGravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(e),n}return h_(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return p_(this,void 0,void 0,(function(){var t,e,n,r,i,a=this;return v_(this,(function(u){switch(u.label){case 0:return(e=(t=this).nodes)&&0!==e.length?(t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),n=t.center,1===e.length?(e[0].x=n[0],e[0].y=n[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(r={},i={},e.forEach((function(t,e){o(t.x)||(t.x=Math.random()*a.width),o(t.y)||(t.y=Math.random()*a.height),r[t.id]=t,i[t.id]=e})),t.nodeMap=r,t.nodeIdxMap=i,[4,t.run()])):(t.onLayoutEnd&&t.onLayoutEnd(),[2]);case 1:return u.sent(),[2]}}))}))},e.prototype.executeWithWorker=function(t,e){return p_(this,void 0,void 0,(function(){var n,r,i,a,u,s=this;return v_(this,(function(c){switch(c.label){case 0:return r=(n=this).nodes,i=n.center,r&&0!==r.length?1===r.length?(r[0].x=i[0],r[0].y=i[1],[2]):(a={},u={},r.forEach((function(t,e){o(t.x)||(t.x=Math.random()*s.width),o(t.y)||(t.y=Math.random()*s.height),a[t.id]=t,u[t.id]=e})),n.nodeMap=a,n.nodeIdxMap=u,[4,n.run(t,e)]):[2];case 1:return c.sent(),[2]}}))}))},e.prototype.run=function(t,e){return p_(this,void 0,void 0,(function(){var n,r,i,a,u,s,c,f,l,h,p,v,g,y,m,b,_,x,w,E,S,A,T,I,N,O,C=this;return v_(this,(function(k){switch(k.label){case 0:for(r=(n=this).nodes,i=n.edges,a=n.maxIteration,u=n.center,s=n.height*n.width,c=Math.sqrt(s)/10,f=s/(r.length+1),l=Math.sqrt(f),h=n.speed,p=n.clustering,D=[n.clusterField],M=r,R=[],P=D.length,G={},M.forEach((function(t){D.forEach((function(e,n){if(void 0===G[t[e]]&&(G[t[e]]=Object.keys(G).length),R.push(G[t[e]]),n===P-1)for(;R.length%4!=0;)R.push(0)}))})),v={array:new Float32Array(R),count:Object.keys(G).length},g=v.array,y=v.count,r.forEach((function(t,e){var n=0,r=0;o(t.fx)&&o(t.fy)&&(n=t.fx||.001,r=t.fy||.001),g[4*e+1]=n,g[4*e+2]=r})),m=r.length,b=function(t,e){var n=[],r=[],i={},o=0;for(o=0;o<t.length;o++){var a=t[o];i[a.id]=o,n.push(a.x),n.push(a.y),n.push(0),n.push(0),r.push([])}for(o=0;o<e.length;o++){var u=e[o],s=d(u,"source"),c=d(u,"target");isNaN(i[s])||isNaN(i[c])||(r[i[s]].push(i[c]),r[i[c]].push(i[s]))}var f=0;for(o=0;o<t.length;o++){var l=n.length,h=r[o],p=h.length;n[4*o+2]=l,n[4*o+3]=p,f=Math.max(f,p);for(var v=0;v<p;++v){var g=h[v];n.push(+g)}}for(;n.length%4!=0;)n.push(0);return{maxEdgePerVetex:f,array:new Float32Array(n)}}(r,i),_=b.maxEdgePerVetex,x=b.array,w=n.workerEnabled,E=w?f_.create({canvas:t,engineOptions:{supportCompute:!0}}):f_.create({engineOptions:{supportCompute:!0}}),S=n.onLayoutEnd,A=[],T=0;T<y;T++)A.push(0,0,0,0);return I=E.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_K : f32;\\n [[offset 4]] u_K2 : f32;\\n [[offset 8]] u_Center : vec2<f32>;\\n [[offset 16]] u_Gravity : f32;\\n [[offset 20]] u_ClusterGravity : f32;\\n [[offset 24]] u_Speed : f32;\\n [[offset 28]] u_MaxDisplace : f32;\\n [[offset 32]] u_Clustering : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AttributeArray : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar param : f32 = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx = dx + param * xDist;\\ndy = dy + param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < j);\\ndx = dx + param * std::sign;\\ndy = dy + param * std::sign;}}}}\\nreturn vec2<f32>(dx, dy);}\\nfn calcGravity(currentNode : vec4<f32>, nodeAttributes : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar vx : f32 = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nvar vy : f32 = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nvar gf : f32 = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {var clusterIdx : i32 = i32(nodeAttributes.x);\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nvar cvx : f32 = currentNode.x - center.x;\\nvar cvy : f32 = currentNode.y - center.y;\\nvar dist : f32 = std::sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nvar parma : f32 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx = dx + parma * cvx;\\ndy = dy + parma * cvy;}\\nreturn vec2<f32>(dx, dy);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar arr_offset : i32 = i32(std::floor(currentNode.z + 0.5));\\nvar length : i32 = i32(std::floor(currentNode.w + 0.5));\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + i32(p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = select(node_buffer.x, select(node_buffer.y, select(node_buffer.z, node_buffer.w, buf_offset == 2), buf_offset == 1), buf_offset == 0);\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar attractiveF : f32 = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx = dx - xDist * attractiveF;\\ndy = dy - yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < i32(float_j));\\ndx = dx - std::sign * attractiveF;\\ndy = dy - std::sign * attractiveF;}}}\\nreturn vec2<f32>(dx, dy);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nif (i >= __DefineValuePlaceholder__VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes : vec4<f32> = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\ndx = dx + repulsive.x;\\ndy = dy + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode);\\ndx = dx + attractive.x;\\ndy = dy + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(currentNode, nodeAttributes);\\ndx = dx - gravity.x;\\ndy = dy - gravity.y;\\ndx = dx * gWebGPUUniformParams.u_Speed;\\ndy = dy * gWebGPUUniformParams.u_Speed;\\nvar distLength : f32 = std::sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {var limitedDist : f32 = std::min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_K;\\n float u_K2;\\n vec2 u_Center;\\n float u_Gravity;\\n float u_ClusterGravity;\\n float u_Speed;\\n float u_MaxDisplace;\\n float u_Clustering;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AttributeArray[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec2 calcRepulsive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {float dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nfloat vy = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nfloat gf = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= gWebGPUUniformParams.u_Speed;\\ndy *= gWebGPUUniformParams.u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2<f32>","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([m,1,1]).setBinding({u_Data:x,u_K:l,u_K2:f,u_Gravity:n.gravity,u_ClusterGravity:n.clusterGravity||n.gravity||1,u_Speed:h,u_MaxDisplace:c,u_Clustering:p?1:0,u_Center:u,u_AttributeArray:g,u_ClusterCenters:A,MAX_EDGE_PER_VERTEX:_,VERTEX_COUNT:m}),p&&(N=E.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\n\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 0, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_NodeAttributes : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[i];\\nvar sumx : f32 = 0.0;\\nvar sumy : f32 = 0.0;\\nvar count : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var attributes : vec4<f32> = gWebGPUBuffer1.u_NodeAttributes[j];\\nvar clusterIdx : i32 = i32(attributes.x);\\nvar vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx = sumx + vertex.x;\\nsumy = sumy + vertex.y;\\ncount = count + 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4<f32>(sumx / count, sumy / count, count, i);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\n\\nlayout(std430, set = 0, binding = 0) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer1 {\\n vec4 u_NodeAttributes[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {int i = globalInvocationID.x;\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[i];\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = gWebGPUBuffer1.u_NodeAttributes[j];\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([y,1,1]).setBinding({u_Data:x,u_NodeAttributes:g,u_ClusterCenters:A,VERTEX_COUNT:m,CLUSTER_COUNT:y})),O=function(){return p_(C,void 0,void 0,(function(){var n,i;return v_(this,(function(o){switch(o.label){case 0:n=0,o.label=1;case 1:return n<a?[4,I.execute()]:[3,6];case 2:return o.sent(),p?(N.setBinding({u_Data:I}),[4,N.execute()]):[3,4];case 3:o.sent(),I.setBinding({u_ClusterCenters:N}),o.label=4;case 4:I.setBinding({u_MaxDisplace:c*=.99}),o.label=5;case 5:return n++,[3,1];case 6:return[4,I.getOutput()];case 7:return i=o.sent(),t?e.postMessage({type:Gt,vertexEdgeData:i}):r.forEach((function(t,e){var n=i[4*e],r=i[4*e+1];t.x=n,t.y=r})),S&&S(),[2]}}))}))},[4,O()];case 1:return k.sent(),[2]}var D,M,R,P,G}))}))},e.prototype.getType=function(){return"fruchterman-gpu"},e}(t),y_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},b_=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},__=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(e),n}return y_(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return m_(this,void 0,void 0,(function(){var t,e,n,r,i;return b_(this,(function(a){switch(a.label){case 0:return(e=(t=this).nodes)&&0!==e.length?(t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),n=t.center,1===e.length?(e[0].x=n[0],e[0].y=n[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(r={},i={},e.forEach((function(e,n){o(e.x)||(e.x=Math.random()*t.width),o(e.y)||(e.y=Math.random()*t.height),r[e.id]=e,i[e.id]=n})),t.nodeMap=r,t.nodeIdxMap=i,t.nodeStrength=l_(t.nodeStrength,1),t.edgeStrength=l_(t.edgeStrength,1),[4,t.run()])):(t.onLayoutEnd&&t.onLayoutEnd(),[2]);case 1:return a.sent(),[2]}}))}))},e.prototype.executeWithWorker=function(t,e){var n=this,r=n.nodes,i=n.center;if(r&&0!==r.length){if(1===r.length)return r[0].x=i[0],void(r[0].y=i[1]);var a={},u={};r.forEach((function(t,e){o(t.x)||(t.x=Math.random()*n.width),o(t.y)||(t.y=Math.random()*n.height),a[t.id]=t,u[t.id]=e})),n.nodeMap=a,n.nodeIdxMap=u,n.nodeStrength=l_(n.nodeStrength,1),n.edgeStrength=l_(n.edgeStrength,1),n.run(t,e)}},e.prototype.run=function(t,e){return m_(this,void 0,void 0,(function(){var n,r,i,a,u,s,c,f,l,p,v,g,y,m,b,_,x,w,E,S,A,T,I,N,O,C,k,D=this;return b_(this,(function(M){switch(M.label){case 0:for(r=(n=this).nodes,i=n.edges,a=n.maxIteration,n.width||"undefined"==typeof window||(n.width=window.innerWidth),n.height||"undefined"==typeof window||(n.height=window.innerHeight),u=r.length,n.linkDistance=l_(n.linkDistance),n.edgeStrength=l_(n.edgeStrength),s=function(t,e,n,r){var i=[],o=[],a={},u=0;for(u=0;u<t.length;u++){var s=t[u];a[s.id]=u,i.push(s.x),i.push(s.y),i.push(0),i.push(0),o.push([])}for(u=0;u<e.length;u++){var c=e[u],f=d(c,"source"),l=d(c,"target");o[a[f]].push(a[l]),o[a[f]].push(n(c)),o[a[f]].push(r(c)),o[a[f]].push(0),o[a[l]].push(a[f]),o[a[l]].push(n(c)),o[a[l]].push(r(c)),o[a[l]].push(0)}var h=0;for(u=0;u<t.length;u++){var p=i.length,v=o[u],g=v.length;i[4*u+2]=p+1048576*g/4,i[4*u+3]=0,h=Math.max(h,g/4);for(var y=0;y<g;++y){var m=v[y];i.push(+m)}}for(;i.length%4!=0;)i.push(0);return{maxEdgePerVetex:h,array:new Float32Array(i)}}(r,i,n.linkDistance,n.edgeStrength),c=s.maxEdgePerVetex,f=s.array,n.degrees=h(r.length,n.nodeIdxMap,i).map((function(t){return t.all})),l=[],p=[],v=[],g=[],y=[],m=[],b=[],n.getMass||(n.getMass=function(t){return n.degrees[n.nodeIdxMap[t.id]]||1}),_=n.gravity,x=n.center,r.forEach((function(t,e){l.push(n.getMass(t)),p.push(n.nodeStrength(t)),n.degrees[e]||(n.degrees[e]=0);var r=[x[0],x[1],_];if(n.getCenter){var i=n.getCenter(t,n.degrees[e]);i&&o(i[0])&&o(i[1])&&o(i[2])&&(r=i)}v.push(r[0]),g.push(r[1]),y.push(r[2]),o(t.fx)&&o(t.fy)?(m.push(t.fx||.001),b.push(t.fy||.001)):(m.push(0),b.push(0))})),w=d_([l,n.degrees,p,m]),E=d_([v,g,y,b]),S=n.workerEnabled,A=S?f_.create({canvas:t,engineOptions:{supportCompute:!0}}):f_.create({engineOptions:{supportCompute:!0}}),T=n.onLayoutEnd,I=[],f.forEach((function(t){I.push(t)})),N=0;N<4;N++)I.push(0);return O=A.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_damping : f32;\\n [[offset 4]] u_maxSpeed : f32;\\n [[offset 8]] u_minMovement : f32;\\n \\n [[offset 12]] u_coulombDisScale : f32;\\n [[offset 16]] u_factor : f32;\\n \\n \\n [[offset 20]] u_interval : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray1 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\ntype GWebGPUBuffer3 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray2 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 4, set 0]] var<storage_buffer> gWebGPUBuffer3 : GWebGPUBuffer3;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn unpack_float(packedValue : f32) -> vec2<i32> {var packedIntValue : i32 = i32(packedValue);\\nvar v0 : i32 = packedIntValue / 1048576;\\nreturn vec2<i32>(v0, packedIntValue - (v0 * 1048576));}\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar vx : f32 = currentNode.x - nextNode.x;\\nvar vy : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar n_dist : f32 = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar attributesi : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar attributesj : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nvar massi : f32 = attributesi.x;\\nvar nodeStrengthi : f32 = attributesi.z;\\nvar nodeStrengthj : f32 = attributesj.z;\\nvar nodeStrength : f32 = (nodeStrengthi + nodeStrengthj) / 2.0;\\nvar param : f32 = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax = ax + direx * param;\\nay = ay + direy * param;}}\\nreturn vec2<f32>(ax, ay);}\\nfn calcGravity(i : i32, currentNode : vec4<f32>, attributes2 : vec4<f32>) -> vec2<f32> {var vx : f32 = currentNode.x - attributes2.x;\\nvar vy : f32 = currentNode.y - attributes2.y;\\nvar ax : f32 = vx * attributes2.z;\\nvar ay : f32 = vy * attributes2.z;\\nreturn vec2<f32>(ax, ay);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>, attributes1 : vec4<f32>) -> vec2<f32> {var mass : f32 = attributes1.x;\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nvar compressed : vec2<i32> = unpack_float(currentNode.z);\\nvar length : i32 = compressed.x;\\nvar arr_offset : i32 = compressed.y;\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + (4 * p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = node_buffer.x;\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar vx : f32 = nextNode.x - currentNode.x;\\nvar vy : f32 = nextNode.y - currentNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar edgeLength : f32 = node_buffer.y;\\nvar edgeStrength : f32 = node_buffer.z;\\nvar diff : f32 = edgeLength - dist;\\nvar param : f32 = (diff * edgeStrength) / mass;\\nax = ax - direx * param;\\nay = ay - direy * param;}\\nreturn vec2<f32>(ax, ay);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar movement : vec4<f32> = gWebGPUBuffer1.u_AveMovement[0];\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nif ((i >= __DefineValuePlaceholder__VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes1 : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar nodeAttributes2 : vec4<f32> = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\nax = ax + repulsive.x;\\nay = ay + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode, nodeAttributes1);\\nax = ax + attractive.x;\\nay = ay + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(i, currentNode, nodeAttributes2);\\nax = ax - gravity.x;\\nay = ay - gravity.y;\\nvar param : f32 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nvar vx : f32 = ax * param;\\nvar vy : f32 = ay * param;\\nvar vlength : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {var param2 : f32 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nvar distx : f32 = vx * gWebGPUUniformParams.u_interval;\\nvar disty : f32 = vy * gWebGPUUniformParams.u_interval;\\nvar distLength : f32 = std::sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_damping;\\n float u_maxSpeed;\\n float u_minMovement;\\n \\n float u_coulombDisScale;\\n float u_factor;\\n \\n \\n float u_interval;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_NodeAttributeArray1[];\\n} gWebGPUBuffer2;\\n\\nlayout(std430, set = 0, binding = 4) buffer readonly GWebGPUBuffer3 {\\n vec4 u_NodeAttributeArray2[];\\n} gWebGPUBuffer3;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nivec2 unpack_float(float packedValue) {int packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {float ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 attributesj = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {float vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {float mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = gWebGPUBuffer0.u_Data[int(float_j)];\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nvec4 movement = gWebGPUBuffer1.u_AveMovement[0];\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes1 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 nodeAttributes2 = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {float param2 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * gWebGPUUniformParams.u_interval;\\nfloat disty = vy * gWebGPUUniformParams.u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {gl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([u,1,1]).setBinding({u_Data:f,u_damping:n.damping,u_maxSpeed:n.maxSpeed,u_minMovement:n.minMovement,u_coulombDisScale:n.coulombDisScale,u_factor:n.factor,u_NodeAttributeArray1:w,u_NodeAttributeArray2:E,MAX_EDGE_PER_VERTEX:c,VERTEX_COUNT:u,u_AveMovement:I,u_interval:n.interval}),C=A.createKernel('{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_iter : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var movement : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nmovement = movement + vertex.w;}\\nmovement = movement / f32(__DefineValuePlaceholder__VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4<f32>(movement, 0.0, 0.0, 0.0);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_iter;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {float movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = gWebGPUBuffer0.u_Data[j];\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);}\\n","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}').setDispatch([1,1,1]).setBinding({u_Data:f,VERTEX_COUNT:u,u_AveMovement:[0,0,0,0]}),k=function(){return m_(D,void 0,void 0,(function(){var i,o,u;return b_(this,(function(s){switch(s.label){case 0:i=0,s.label=1;case 1:return i<a?[4,O.execute()]:[3,5];case 2:return s.sent(),C.setBinding({u_Data:O}),[4,C.execute()];case 3:s.sent(),o=Math.max(.02,n.interval-.002*i),O.setBinding({u_interval:o,u_AveMovement:C}),s.label=4;case 4:return i++,[3,1];case 5:return[4,O.getOutput()];case 6:return u=s.sent(),t?e.postMessage({type:Gt,vertexEdgeData:u}):r.forEach((function(t,e){var n=u[4*e],r=u[4*e+1];t.x=n,t.y=r})),T&&T(),[2]}}))}))},[4,k()];case 1:return M.sent(),[2]}}))}))},e.prototype.getType=function(){return"gForce-gpu"},e}(t),x_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),w_=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.maxIteration=100,n.gravity=10,n.comboGravity=10,n.linkDistance=10,n.alpha=1,n.alphaMin=.001,n.alphaDecay=1-Math.pow(n.alphaMin,1/300),n.alphaTarget=0,n.velocityDecay=.6,n.edgeStrength=.6,n.nodeStrength=30,n.preventOverlap=!1,n.preventNodeOverlap=!1,n.preventComboOverlap=!1,n.collideStrength=void 0,n.nodeCollideStrength=.5,n.comboCollideStrength=.5,n.comboSpacing=20,n.comboPadding=10,n.optimizeRangeFactor=1,n.onTick=function(){},n.onLayoutEnd=function(){},n.depthAttractiveForceScale=1,n.depthRepulsiveForceScale=2,n.nodes=[],n.edges=[],n.combos=[],n.comboTrees=[],n.width=300,n.height=300,n.bias=[],n.nodeMap={},n.oriComboMap={},n.indexMap={},n.comboMap={},n.previousLayouted=!1,n.updateCfg(e),n}return x_(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:100,center:[0,0],gravity:10,speed:1,comboGravity:30,preventOverlap:!1,preventComboOverlap:!0,preventNodeOverlap:!0,nodeSpacing:void 0,collideStrength:void 0,nodeCollideStrength:.5,comboCollideStrength:.5,comboSpacing:20,comboPadding:10,edgeStrength:.6,nodeStrength:30,linkDistance:10}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.center;if(t.comboTree={id:"comboTreeRoot",depth:-1,children:t.comboTrees},e&&0!==e.length){if(1===e.length)return e[0].x=n[0],e[0].y=n[1],void(t.onLayoutEnd&&t.onLayoutEnd());t.initVals(),t.run(),t.onLayoutEnd&&t.onLayoutEnd()}else t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){var t=this,e=t.nodes,n=t.previousLayouted?t.maxIteration/5:t.maxIteration;t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight);var r=t.center,i=t.velocityDecay,a=t.comboMap;t.previousLayouted||t.initPos(a);for(var u=function(n){var r=[];e.forEach((function(t,e){r[e]={x:0,y:0}})),t.applyCalculate(r),t.applyComboCenterForce(r),e.forEach((function(t,e){o(t.x)&&o(t.y)&&(t.x+=r[e].x*i,t.y+=r[e].y*i)})),t.alpha+=(t.alphaTarget-t.alpha)*t.alphaDecay,t.onTick()},s=0;s<n;s++)u();var c=[0,0];e.forEach((function(t){o(t.x)&&o(t.y)&&(c[0]+=t.x,c[1]+=t.y)})),c[0]/=e.length,c[1]/=e.length;var f=[r[0]-c[0],r[1]-c[1]];e.forEach((function(t,e){o(t.x)&&o(t.y)&&(t.x+=f[0],t.y+=f[1])})),t.combos.forEach((function(t){var e=a[t.id];e&&e.empty&&(t.x=e.cx||t.x,t.y=e.cy||t.y)})),t.previousLayouted=!0},e.prototype.initVals=function(){var t=this,e=t.edges,n=t.nodes,r=t.combos,a={},u={},s={};n.forEach((function(t,e){u[t.id]=t,s[t.id]=e})),t.nodeMap=u,t.indexMap=s;var c={};r.forEach((function(t){c[t.id]=t})),t.oriComboMap=c,t.comboMap=t.getComboMap();var l=t.preventOverlap;t.preventComboOverlap=t.preventComboOverlap||l,t.preventNodeOverlap=t.preventNodeOverlap||l;var h=t.collideStrength;h&&(t.comboCollideStrength=h,t.nodeCollideStrength=h),t.comboCollideStrength=t.comboCollideStrength?t.comboCollideStrength:0,t.nodeCollideStrength=t.nodeCollideStrength?t.nodeCollideStrength:0;for(var p=0;p<e.length;++p){var v=d(e[p],"source"),g=d(e[p],"target");a[v]?a[v]++:a[v]=1,a[g]?a[g]++:a[g]=1}var y=[];for(p=0;p<e.length;++p)v=d(e[p],"source"),g=d(e[p],"target"),y[p]=a[v]/(a[v]+a[g]);this.bias=y;var m,b,_=t.nodeSize,w=t.nodeSpacing;if(b=o(w)?function(){return w}:x(w)?w:function(){return 0},this.nodeSpacing=b,_)if(x(_))m=function(t){return _(t)};else if(i(_)){var E=(_[0]>_[1]?_[0]:_[1])/2;m=function(t){return E}}else{var S=_/2;m=function(t){return S}}else m=function(t){return t.size?i(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2:f(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2:t.size/2:10};this.nodeSize=m;var A,T=t.comboSpacing;A=o(T)?function(){return T}:x(T)?T:function(){return 0},this.comboSpacing=A;var I,N=t.comboPadding;I=o(N)?function(){return N}:i(N)?function(){return Math.max.apply(null,N)}:x(N)?N:function(){return 0},this.comboPadding=I;var O,C=this.linkDistance;C||(C=10),O=o(C)?function(t){return C}:C,this.linkDistance=O;var k,D=this.edgeStrength;D||(D=1),k=o(D)?function(t){return D}:D,this.edgeStrength=k;var M,R=this.nodeStrength;R||(R=30),M=o(R)?function(t){return R}:R,this.nodeStrength=M},e.prototype.initPos=function(t){this.nodes.forEach((function(e,n){var r=e.comboId,i=t[r];r&&i?(e.x=i.cx+100/(n+1),e.y=i.cy+100/(n+1)):(e.x=100/(n+1),e.y=100/(n+1))}))},e.prototype.getComboMap=function(){var t=this,e=t.nodeMap,n=t.comboTrees,r=t.oriComboMap,i={};return(n||[]).forEach((function(n){var a=[];y(n,(function(n){if("node"===n.itemType)return!0;if(!r[n.id])return!0;if(void 0===i[n.id]){var u={id:n.id,name:n.id,cx:0,cy:0,count:0,depth:t.oriComboMap[n.id].depth||0,children:[]};i[n.id]=u}var s=n.children;s&&s.forEach((function(t){if(!i[t.id]&&!e[t.id])return!0;a.push(t)}));var c=i[n.id];if(c.cx=0,c.cy=0,0===a.length){c.empty=!0;var f=r[n.id];c.cx=f.x,c.cy=f.y}return a.forEach((function(t){if(c.count++,"node"!==t.itemType){var n=i[t.id];return o(n.cx)&&(c.cx+=n.cx),void(o(n.cy)&&(c.cy+=n.cy))}var r=e[t.id];r&&(o(r.x)&&(c.cx+=r.x),o(r.y)&&(c.cy+=r.y))})),c.cx/=c.count||1,c.cy/=c.count||1,c.children=a,!0}))})),i},e.prototype.applyComboCenterForce=function(t){var e=this,n=e.gravity,r=e.comboGravity||n,i=this.alpha,a=e.comboTrees,u=e.indexMap,s=e.nodeMap,c=e.comboMap;(a||[]).forEach((function(e){y(e,(function(e){if("node"===e.itemType)return!0;if(!c[e.id])return!0;var n=c[e.id],a=(n.depth+1)/10*.5,f=n.cx,l=n.cy;return n.cx=0,n.cy=0,n.children.forEach((function(e){if("node"!==e.itemType){var d=c[e.id];return d&&o(d.cx)&&(n.cx+=d.cx),void(d&&o(d.cy)&&(n.cy+=d.cy))}var h=s[e.id],p=h.x-f||.005,v=h.y-l||.005,g=Math.sqrt(p*p+v*v),y=u[h.id],m=r*i/g*a;t[y].x-=p*m,t[y].y-=v*m,o(h.x)&&(n.cx+=h.x),o(h.y)&&(n.cy+=h.y)})),n.cx/=n.count||1,n.cy/=n.count||1,!0}))}))},e.prototype.applyCalculate=function(t){var e=this,n=e.comboMap,r=e.nodes,i={};r.forEach((function(t,e){r.forEach((function(n,r){if(!(e<r)){var o=t.x-n.x||.005,a=t.y-n.y||.005,u=o*o+a*a,s=Math.sqrt(u);u<1&&(u=s),i["".concat(t.id,"-").concat(n.id)]={vx:o,vy:a,vl2:u,vl:s},i["".concat(n.id,"-").concat(t.id)]={vl2:u,vl:s,vx:-o,vy:-a}}}))})),e.updateComboSizes(n),e.calRepulsive(t,i),e.calAttractive(t,i),e.preventComboOverlap&&e.comboNonOverlapping(t,n)},e.prototype.updateComboSizes=function(t){var e=this,n=e.comboTrees,r=e.nodeMap,o=e.nodeSize,a=e.comboSpacing,u=e.comboPadding;(n||[]).forEach((function(n){var s=[];y(n,(function(n){if("node"===n.itemType)return!0;var c=t[n.id];if(!c)return!1;var f=n.children;f&&f.forEach((function(e){(t[e.id]||r[e.id])&&s.push(e)})),c.minX=1/0,c.minY=1/0,c.maxX=-1/0,c.maxY=-1/0,s.forEach((function(t){if("node"!==t.itemType)return!0;var e=r[t.id];if(!e)return!0;var n=o(e),i=e.x-n,a=e.y-n,u=e.x+n,s=e.y+n;c.minX>i&&(c.minX=i),c.minY>a&&(c.minY=a),c.maxX<u&&(c.maxX=u),c.maxY<s&&(c.maxY=s)}));var l=e.oriComboMap[n.id].size||10;i(l)&&(l=l[0]);var d=Math.max(c.maxX-c.minX,c.maxY-c.minY,l);return c.r=d/2+a(c)/2+u(c),!0}))}))},e.prototype.comboNonOverlapping=function(t,e){var n=this,r=n.comboTree,i=n.comboCollideStrength,o=n.indexMap,a=n.nodeMap;y(r,(function(n){if(!e[n.id]&&!a[n.id]&&"comboTreeRoot"!==n.id)return!1;var r=n.children;return r&&r.length>1&&r.forEach((function(n,u){if("node"===n.itemType)return!1;var s=e[n.id];s&&r.forEach((function(r,c){if(u<=c)return!1;if("node"===r.itemType)return!1;var f=e[r.id];if(!f)return!1;var l=s.cx-f.cx||.005,d=s.cy-f.cy||.005,h=l*l+d*d,p=s.r||1,v=f.r||1,g=p+v,y=v*v,m=p*p;if(h<g*g){var b=n.children;if(!b||0===b.length)return!1;var _=r.children;if(!_||0===_.length)return!1;var x=Math.sqrt(h),w=(g-x)/x*i,E=l*w,S=d*w,A=y/(m+y),T=1-A;b.forEach((function(e){if("node"!==e.itemType)return!1;if(a[e.id]){var n=o[e.id];_.forEach((function(e){if("node"!==e.itemType)return!1;if(!a[e.id])return!1;var r=o[e.id];t[n].x+=E*A,t[n].y+=S*A,t[r].x-=E*T,t[r].y-=S*T}))}}))}}))})),!0}))},e.prototype.calRepulsive=function(t,e){var n=this,r=n.nodes,i=n.width*n.optimizeRangeFactor,o=n.nodeStrength,a=n.alpha,u=n.nodeCollideStrength,s=n.preventNodeOverlap,c=n.nodeSize,f=n.nodeSpacing,l=n.depthRepulsiveForceScale,d=n.center;r.forEach((function(h,p){if(h.x&&h.y){if(d){var v=n.gravity,g=h.x-d[0]||.005,y=h.y-d[1]||.005,m=Math.sqrt(g*g+y*y);t[p].x-=g*v*a/m,t[p].y-=y*v*a/m}r.forEach((function(n,r){if(p!==r&&n.x&&n.y){var d=e["".concat(h.id,"-").concat(n.id)],v=d.vl2,g=d.vl;if(!(g>i)){var y=e["".concat(h.id,"-").concat(n.id)],m=y.vx,b=y.vy,_=Math.log(Math.abs(n.depth-h.depth)/10)+1||1;_=_<1?1:_,n.comboId!==h.comboId&&(_+=1);var x=_?Math.pow(l,_):1,w=o(n)*a/v*x;if(t[p].x+=m*w,t[p].y+=b*w,p<r&&s){var E=c(h)+f(h)||1,S=c(n)+f(n)||1,A=E+S;if(v<A*A){var T=(A-g)/g*u,I=S*S,N=I/(E*E+I),O=m*T,C=b*T;t[p].x+=O*N,t[p].y+=C*N,N=1-N,t[r].x-=O*N,t[r].y-=C*N}}}}}))}}))},e.prototype.calAttractive=function(t,e){var n=this,r=n.edges,i=n.linkDistance,a=n.alpha,u=n.edgeStrength,s=n.bias,c=n.depthAttractiveForceScale;r.forEach((function(r,f){var l=d(r,"source"),h=d(r,"target");if(l&&h&&l!==h){var p=n.indexMap[l],v=n.indexMap[h],g=n.nodeMap[l],y=n.nodeMap[h];if(g&&y){var m=g.depth===y.depth?0:Math.log(Math.abs(g.depth-y.depth)/10);g.comboId===y.comboId&&(m/=2);var b=m?Math.pow(c,m):1;if(g.comboId!==y.comboId&&1===b?b=c/2:g.comboId===y.comboId&&(b=2),o(y.x)&&o(g.x)&&o(y.y)&&o(g.y)){var _=e["".concat(h,"-").concat(l)],x=_.vl,w=_.vx,E=_.vy,S=(x-i(r))/x*a*u(r)*b,A=w*S,T=E*S,I=s[f];t[v].x-=A*I,t[v].y-=T*I,t[p].x+=A*(1-I),t[p].y+=T*(1-I)}}}}))},e.prototype.getType=function(){return"comboForce"},e}(t),E_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),S_=function(){return S_=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},S_.apply(this,arguments)},A_=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.nodes=[],n.edges=[],n.combos=[],n.comboEdges=[],n.comboPadding=10,n.comboTrees=[],n.updateCfg(e),n}return E_(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.center;if(e&&0!==e.length){if(1===e.length)return e[0].x=n[0],e[0].y=n[1],void(t.onLayoutEnd&&t.onLayoutEnd());t.initVals(),t.run(),t.onLayoutEnd&&t.onLayoutEnd()}else t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){var t,e=this,n=e.nodes,r=e.edges,i=e.combos,o=e.comboEdges,a=e.center,u={};n.forEach((function(t){u[t.id]=t}));var s={};i.forEach((function(t){s[t.id]=t}));var c=e.getInnerGraphs(u),f=[],l=[],d={},h=!0;this.comboTrees.forEach((function(t){var e=c[t.id],n=S_(S_({},t),{x:e.x||s[t.id].x,y:e.y||s[t.id].y,fx:e.fx||s[t.id].fx,fy:e.fy||s[t.id].fy,mass:e.mass||s[t.id].mass,size:e.size});l.push(n),isNaN(n.x)||0===n.x||isNaN(n.y)||0===n.y?(n.x=100*Math.random(),n.y=100*Math.random()):h=!1,f.push(t.id),y(t,(function(e){return e.id!==t.id&&(d[e.id]=t.id),!0}))})),n.forEach((function(t){if(!t.comboId||!s[t.comboId]){var e=S_({},t);l.push(e),isNaN(e.x)||0===e.x||isNaN(e.y)||0===e.y?(e.x=100*Math.random(),e.y=100*Math.random()):h=!1,f.push(t.id)}}));var p=[];if(r.concat(o).forEach((function(t){var e=d[t.source]||t.source,n=d[t.target]||t.target;e!==n&&f.includes(e)&&f.includes(n)&&p.push({source:e,target:n})})),null==l?void 0:l.length){if(1===l.length)l[0].x=a[0],l[0].y=a[1];else{var v={nodes:l,edges:p},g=this.outerLayout||new P({gravity:1,factor:2,linkDistance:function(t,e,n){var r,i,o=(((null===(r=e.size)||void 0===r?void 0:r[0])||30)+((null===(i=n.size)||void 0===i?void 0:i[0])||30))/2;return Math.min(1.5*o,700)}}),m=null===(t=g.getType)||void 0===t?void 0:t.call(g);g.updateCfg({center:a,kg:5,preventOverlap:!0,animate:!1}),h&&Lt[m]&&(l.length<100?new Lf:new C).layout(v),g.layout(v)}l.forEach((function(t){var e=c[t.id];if(e)e.visited=!0,e.x=t.x,e.y=t.y,e.nodes.forEach((function(e){e.x+=t.x,e.y+=t.y}));else{var n=u[t.id];n&&(n.x=t.x,n.y=t.y)}}))}for(var b=Object.keys(c),_=function(t){var e=b[t],n=c[e];if(!n)return"continue";n.nodes.forEach((function(t){n.visited||(t.x+=n.x||0,t.y+=n.y||0),u[t.id]&&(u[t.id].x=t.x,u[t.id].y=t.y)})),s[e]&&(s[e].x=n.x,s[e].y=n.y)},x=b.length-1;x>=0;x--)_(x);return{nodes:n,edges:r,combos:i,comboEdges:o}},e.prototype.getInnerGraphs=function(t){var e=this,n=e.comboTrees,r=e.nodeSize,a=e.edges,u=e.comboPadding,s=e.spacing,c={},f=this.innerLayout||new Pf({sortBy:"id"});return f.center=[0,0],f.preventOverlap=!0,f.nodeSpacing=s,(n||[]).forEach((function(e){y(e,(function(e){var n,s=(null==u?void 0:u(e))||10;if(i(s)&&(s=Math.max.apply(Math,s)),null===(n=e.children)||void 0===n?void 0:n.length){var l=e.children.map((function(e){if("combo"===e.itemType)return c[e.id];var n=t[e.id]||{};return S_(S_({},n),e)})),d=l.map((function(t){return t.id})),h={nodes:l,edges:a.filter((function(t){return d.includes(t.source)&&d.includes(t.target)}))},p=1/0;l.forEach((function(t){var e;t.size||(t.size=(null===(e=c[t.id])||void 0===e?void 0:e.size)||(null==r?void 0:r(t))||[30,30]),o(t.size)&&(t.size=[t.size,t.size]),p>t.size[0]&&(p=t.size[0]),p>t.size[1]&&(p=t.size[1])})),f.layout(h);var v=function(t){var e=1/0,n=1/0,r=-1/0,i=-1/0;return t.forEach((function(t){e>t.x&&(e=t.x),n>t.y&&(n=t.y),r<t.x&&(r=t.x),i<t.y&&(i=t.y)})),{minX:e,minY:n,maxX:r,maxY:i}}(l),g=v.minX,y=v.minY,m=v.maxX,b=v.maxY,_=Math.max(m-g,b-y,p)+2*s;c[e.id]={id:e.id,nodes:l,size:[_,_]}}else if("combo"===e.itemType){var x=s?[2*s,2*s]:[30,30];c[e.id]={id:e.id,nodes:[],size:x}}return!0}))})),c},e.prototype.initVals=function(){var t,e,n=this,r=n.nodeSize,a=n.spacing;if(e=o(a)?function(){return a}:x(a)?a:function(){return 0},this.spacing=e,r)if(x(r))t=function(t){var n=r(t),o=e(t);return i(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+o)/2:((n||10)+o)/2};else if(i(r)){var u=(r[0]>r[1]?r[0]:r[1])/2;t=function(t){return u+e(t)/2}}else{var s=r/2;t=function(t){return s+e(t)/2}}else t=function(t){var n=e(t);return t.size?i(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:f(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+n)/2:(t.size+n)/2:10+n/2};this.nodeSize=t;var c,l=n.comboPadding;c=o(l)?function(){return l}:i(l)?function(){return Math.max.apply(null,l)}:x(l)?l:function(){return 0},this.comboPadding=c},e.prototype.getType=function(){return"comboCombined"},e}(t),T_=function(){function t(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}return t.prototype.distanceTo=function(t){var e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)},t.prototype.setPos=function(t,e){this.rx=t,this.ry=e},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,r=Math.hypot(e,n);r=r<1e-4?1e-4:r;var i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r},t.prototype.in=function(t){return t.contains(this.rx,this.ry)},t.prototype.add=function(e){var n=this.mass+e.mass;return new t({rx:(this.rx*this.mass+e.rx*e.mass)/n,ry:(this.ry*this.mass+e.ry*e.mass)/n,mass:n,degree:this.degree+e.degree})},t}();const I_=T_;const N_=function(){function t(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return t.prototype.getLength=function(){return this.length},t.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},t.prototype.NW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.NE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.SW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t.prototype.SE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t}();var O_=function(){function t(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)}return t.prototype.insert=function(e){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e)):this.body=e},t.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))},t.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},t.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)))},t}();const C_=O_;var k_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),D_=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.kr=5,n.kg=1,n.mode="normal",n.preventOverlap=!1,n.dissuadeHubs=!1,n.barnesHut=void 0,n.maxIteration=0,n.ks=.1,n.ksmax=10,n.tao=.1,n.onLayoutEnd=function(){},n.prune=void 0,n.updateCfg(e),n}return k_(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.onLayoutEnd,r=t.prune,a=t.maxIteration;t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight);for(var u=[],s=e.length,c=0;c<s;c+=1){var l=e[c],d=10,h=10;o(l.size)&&(d=l.size,h=l.size),i(l.size)?(isNaN(l.size[0])||(d=l.size[0]),isNaN(l.size[1])||(h=l.size[1])):f(l.size)&&(d=l.size.width,h=l.size.height),t.getWidth&&!isNaN(t.getWidth(l))&&(h=t.getWidth(l)),t.getHeight&&!isNaN(t.getHeight(l))&&(d=t.getHeight(l));var p=Math.max(d,h);u.push(p)}void 0===t.barnesHut&&s>250&&(t.barnesHut=!0),void 0===t.prune&&s>100&&(t.prune=!0),0!==this.maxIteration||t.prune?0===this.maxIteration&&r&&(a=100,s<=200&&s>100?a=500:s>200&&(a=950),this.maxIteration=a):(a=250,s<=200&&s>100?a=1e3:s>200&&(a=1200),this.maxIteration=a),t.kr||(t.kr=50,s>100&&s<=500?t.kr=20:s>500&&(t.kr=1)),t.kg||(t.kg=20,s>100&&s<=500?t.kg=10:s>500&&(t.kg=1)),this.nodes=t.updateNodesByForces(u),n()},e.prototype.updateNodesByForces=function(t){for(var e=this,n=e.edges,r=e.maxIteration,i=e.nodes,o=n.filter((function(t){return d(t,"source")!==d(t,"target")})),a=i.length,u=o.length,s=[],c={},f={},l=[],h=0;h<a;h+=1)c[i[h].id]=h,s[h]=0,(void 0===i[h].x||isNaN(i[h].x))&&(i[h].x=1e3*Math.random()),(void 0===i[h].y||isNaN(i[h].y))&&(i[h].y=1e3*Math.random()),l.push({x:i[h].x,y:i[h].y});for(h=0;h<u;h+=1){for(var p=void 0,v=void 0,g=0,y=0,m=0;m<a;m+=1){var b=d(o[h],"source"),_=d(o[h],"target");i[m].id===b?(p=i[m],g=m):i[m].id===_&&(v=i[m],y=m),f[h]={sourceIdx:g,targetIdx:y}}p&&(s[c[p.id]]+=1),v&&(s[c[v.id]]+=1)}var x=r;if(i=this.iterate(x,c,f,u,s,t),e.prune){for(m=0;m<u;m+=1)s[f[m].sourceIdx]<=1?(i[f[m].sourceIdx].x=i[f[m].targetIdx].x,i[f[m].sourceIdx].y=i[f[m].targetIdx].y):s[f[m].targetIdx]<=1&&(i[f[m].targetIdx].x=i[f[m].sourceIdx].x,i[f[m].targetIdx].y=i[f[m].sourceIdx].y);e.prune=!1,e.barnesHut=!1,x=100,i=this.iterate(x,c,f,u,s,t)}return i},e.prototype.iterate=function(t,e,n,r,i,o){for(var a=this,u=a.nodes,s=a.kr,c=a.preventOverlap,f=a.barnesHut,l=u.length,d=0,h=t,p=[],v=[],g=[],y=0;y<l;y+=1)if(p[2*y]=0,p[2*y+1]=0,f){var m={id:y,rx:u[y].x,ry:u[y].y,mass:1,g:s,degree:i[y]};g[y]=new I_(m)}for(;h>0;){for(y=0;y<l;y+=1)v[2*y]=p[2*y],v[2*y+1]=p[2*y+1],p[2*y]=0,p[2*y+1]=0;p=this.getAttrForces(h,50,r,e,n,i,o,p),p=f&&(c&&h>50||!c)?this.getOptRepGraForces(p,g,i):this.getRepGraForces(h,50,p,100,o,i);var b=this.updatePos(p,v,d,i);u=b.nodes,d=b.sg,h--,a.tick&&a.tick()}return u},e.prototype.getAttrForces=function(t,e,n,r,i,o,a,u){for(var s=this,c=s.nodes,f=s.preventOverlap,l=s.dissuadeHubs,d=s.mode,h=s.prune,p=0;p<n;p+=1){var v=c[i[p].sourceIdx],g=i[p].sourceIdx,y=c[i[p].targetIdx],m=i[p].targetIdx;if(!h||!(o[g]<=1||o[m]<=1)){var b=[y.x-v.x,y.y-v.y],_=Math.hypot(b[0],b[1]);_=_<1e-4?1e-4:_,b[0]=b[0]/_,b[1]=b[1]/_,f&&t<e&&(_=_-a[g]-a[m]);var x=_,w=x;"linlog"===d&&(w=x=Math.log(1+_)),l&&(x=_/o[g],w=_/o[m]),f&&t<e&&_<=0?(x=0,w=0):f&&t<e&&_>0&&(x=_,w=_),u[2*r[v.id]]+=x*b[0],u[2*r[y.id]]-=w*b[0],u[2*r[v.id]+1]+=x*b[1],u[2*r[y.id]+1]-=w*b[1]}}return u},e.prototype.getRepGraForces=function(t,e,n,r,i,o){for(var a=this,u=a.nodes,s=a.preventOverlap,c=a.kr,f=a.kg,l=a.center,d=a.prune,h=u.length,p=0;p<h;p+=1){for(var v=p+1;v<h;v+=1)if(!d||!(o[p]<=1||o[v]<=1)){var g=[u[v].x-u[p].x,u[v].y-u[p].y],y=Math.hypot(g[0],g[1]);y=y<1e-4?1e-4:y,g[0]=g[0]/y,g[1]=g[1]/y,s&&t<e&&(y=y-i[p]-i[v]);var m=c*(o[p]+1)*(o[v]+1)/y;s&&t<e&&y<0?m=r*(o[p]+1)*(o[v]+1):s&&t<e&&0===y?m=0:s&&t<e&&y>0&&(m=c*(o[p]+1)*(o[v]+1)/y),n[2*p]-=m*g[0],n[2*v]+=m*g[0],n[2*p+1]-=m*g[1],n[2*v+1]+=m*g[1]}var b=[u[p].x-l[0],u[p].y-l[1]],_=Math.hypot(b[0],b[1]);b[0]=b[0]/_,b[1]=b[1]/_;var x=f*(o[p]+1);n[2*p]-=x*b[0],n[2*p+1]-=x*b[1]}return n},e.prototype.getOptRepGraForces=function(t,e,n){for(var r=this,i=r.nodes,o=r.kg,a=r.center,u=r.prune,s=i.length,c=9e10,f=-9e10,l=9e10,d=-9e10,h=0;h<s;h+=1)u&&n[h]<=1||(e[h].setPos(i[h].x,i[h].y),i[h].x>=f&&(f=i[h].x),i[h].x<=c&&(c=i[h].x),i[h].y>=d&&(d=i[h].y),i[h].y<=l&&(l=i[h].y));var p=Math.max(f-c,d-l),v=new N_({xmid:(f+c)/2,ymid:(d+l)/2,length:p,massCenter:a,mass:s}),g=new C_(v);for(h=0;h<s;h+=1)u&&n[h]<=1||e[h].in(v)&&g.insert(e[h]);for(h=0;h<s;h+=1)if(!(u&&n[h]<=1)){e[h].resetForce(),g.updateForce(e[h]),t[2*h]-=e[h].fx,t[2*h+1]-=e[h].fy;var y=[i[h].x-a[0],i[h].y-a[1]],m=Math.hypot(y[0],y[1]);m=m<1e-4?1e-4:m,y[0]=y[0]/m,y[1]=y[1]/m;var b=o*(n[h]+1);t[2*h]-=b*y[0],t[2*h+1]-=b*y[1]}return t},e.prototype.updatePos=function(t,e,n,r){for(var i=this,a=i.nodes,u=i.ks,s=i.tao,c=i.prune,f=i.ksmax,l=a.length,d=[],h=[],p=0,v=0,g=0;g<l;g+=1)if(!(c&&r[g]<=1)){var y=[t[2*g]-e[2*g],t[2*g+1]-e[2*g+1]],m=Math.hypot(y[0],y[1]),b=[t[2*g]+e[2*g],t[2*g+1]+e[2*g+1]],_=Math.hypot(b[0],b[1]);d[g]=m,h[g]=_/2,p+=(r[g]+1)*d[g],v+=(r[g]+1)*h[g]}var x=n;for(n=s*v/p,0!==x&&(n=n>1.5*x?1.5*x:n),g=0;g<l;g+=1)if(!(c&&r[g]<=1||o(a[g].fx)&&o(a[g].fy))){var w=u*n/(1+n*Math.sqrt(d[g])),E=Math.hypot(t[2*g],t[2*g+1]),S=f/(E=E<1e-4?1e-4:E),A=(w=w>S?S:w)*t[2*g],T=w*t[2*g+1];a[g].x+=A,a[g].y+=T}return{nodes:a,sg:n}},e}(t),M_=function(){return M_=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},M_.apply(this,arguments)},R_=function(){function t(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return t.prototype.init=function(e,n,r){this.cells=[],this.CELL_W=r.CELL_W||t.DEFAULT_CELL_W,this.CELL_H=r.CELL_H||t.DEFAULT_CELL_H,this.columnNum=Math.ceil(e/this.CELL_W),this.rowNum=Math.ceil(n/this.CELL_H),t.MIN_DIST=Math.pow(e,2)+Math.pow(n,2);for(var i=0;i<this.columnNum;i++){for(var o=[],a=0;a<this.rowNum;a++){var u={dx:i,dy:a,x:i*this.CELL_W,y:a*this.CELL_H,occupied:!1};o.push(u)}this.cells.push(o)}},t.prototype.findGridByNodeId=function(t){for(var e,n,r=0;r<this.columnNum;r++)for(var i=0;i<this.rowNum;i++)if(this.cells[r][i].node&&(null===(n=null===(e=this.cells[r][i])||void 0===e?void 0:e.node)||void 0===n?void 0:n.id)===t)return{column:r,row:i};return null},t.prototype.sqdist=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},t.prototype.occupyNearest=function(e){for(var n,r=t.MIN_DIST,i=null,o=0;o<this.columnNum;o++)for(var a=0;a<this.rowNum;a++)!this.cells[o][a].occupied&&(n=this.sqdist(e,this.cells[o][a]))<r&&(r=n,i=this.cells[o][a]);return i&&(i.occupied=!0),i},t.prototype.insertColumn=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++){this.cells[n+this.columnNum]=[];for(var r=0;r<this.rowNum;r++)this.cells[n+this.columnNum][r]={dx:n,dy:r,x:n*this.CELL_W,y:r*this.CELL_H,occupied:!1,node:null}}for(n=this.columnNum-1;n>t;n--)for(r=0;r<this.rowNum;r++)this.cells[n+e][r]=M_(M_({},this.cells[n][r]),{x:(n+e)*this.CELL_W,y:r*this.CELL_H}),this.cells[n][r]={x:n*this.CELL_W,y:r*this.CELL_H,occupied:!0,node:null};for(r=0;r<this.additionColumn.length;r++)this.additionColumn[r]>=t&&(this.additionColumn[r]+=e);for(n=0;n<e;n++)this.additionColumn.push(t+n+1);this.columnNum+=e}},t.prototype.insertRow=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++)for(var r=0;r<this.columnNum;r++)this.cells[r][n+this.rowNum]={dx:r,dy:n,x:r*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(r=0;r<this.columnNum;r++)for(n=this.rowNum-1;n>t;n--)this.cells[r][n+e]=M_(M_({},this.cells[r][n]),{dx:r,dy:n+e,x:r*this.CELL_W,y:(n+e)*this.CELL_H}),this.cells[r][n]={dx:r,dy:n,x:r*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(n=0;n<this.additionRow.length;n++)this.additionRow[n]>=t&&(this.additionRow[n]+=e);for(r=0;r<e;r++)this.additionRow.push(t+r+1);this.rowNum+=e}},t.prototype.getNodes=function(){for(var t=[],e=0;e<this.columnNum;e++)for(var n=0;n<this.rowNum;n++)this.cells[e][n].node&&t.push(this.cells[e][n]);return t},t.MIN_DIST=50,t.DEFAULT_CELL_W=80,t.DEFAULT_CELL_H=80,t}();const P_=R_;var G_=1e7,L_=1.5707963267948966,j_=new Map,F_=.8;function U_(t,e){var n=(j_.get(t.id)||[]).find((function(t){return t.source===e.id||t.target===e.id})),r=t.size[0]*t.size[1],i=e.size[0]*e.size[1],o=r>i?e:t,a=r>i?t:e,u=o.x-o.size[0]/2,s=o.y-o.size[1]/2,c=o.x+o.size[0]/2,f=o.y+o.size[1]/2,l=a.x-a.size[0]/2,d=a.y-a.size[1]/2,h=a.x+a.size[0]/2,p=a.y+a.size[1]/2,v=o.x,g=o.y,y=a.x,m=a.y,b=0,_=0;if(c>=l&&h>=u&&f>=d&&p>=s)0===(_=Math.sqrt(Math.pow(y-v,2)+Math.pow(m-g,2)))&&(_=1e-7),b=10/_*100+((c<h?c:h)-(u>l?u:l))*((f<p?f:p)-(s>d?s:d)),b*=G_;else{var x=!1,w=function(t,e,n){var r=t.x-t.size[0]/2,i=t.y-t.size[1]/2,o=t.x+t.size[0]/2,a=t.y+t.size[1]/2,u=e.x-e.size[0]/2,s=e.y-e.size[1]/2,c=e.x+e.size[0]/2,f=e.y+e.size[1]/2,l=t.x,d=t.y,h=e.x,p=e.y,v=h-l,g=Math.atan2(v,p-d),y=0,m=0,b=0,_=0;g>L_?(m=i-f,y=u-o,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),_=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):b=_=0<g&&g<=L_?(m=s-a)>(y=u-o)?parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2)):g<-L_?(m=i-f)>(y=-(c-r))?parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2)):(m=s-a)>(y=Math.abs(v)>(o-r)/2?r-c:v)?parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):parseFloat(y&&0!==g?(y/Math.sin(g)).toFixed(2):m.toFixed(2));var x=parseFloat(g.toFixed(2)),w=n;return n&&(w=1.1780972450961724<x&&x<1.9634954084936207),{distance:Math.abs(b<_?b:_),isHoriz:w}}(o,a,x);_=w.distance,x=w.isHoriz,_<=10?b+=0!==_?n?10+1e7/_:10+1e8/_:G_:(b+=_,n&&(b+=_*_))}return b}function B_(t){for(var e=0,n=0;n<t.length;n++){var r=t[n];(r.x<0||r.y<0||r.x>1200||r.y>800)&&(e+=1e12);for(var i=n+1;i<t.length;i++)e+=U_(r,t[i])}return e}function z_(t,e,n,r){var i=new Map;n.forEach((function(t,e){i.set(t.id,t)}));var o=r.filter((function(e){return e.source===t.id||e.target===t.id}))||[],a=[];o.forEach((function(e){var n=e.source===t.id?e.target:e.source,r=i.get(n);r&&a.push(r)}));for(var u=!0,s=0;s<a.length;s++){var c=a[s],f=180*Math.atan((t.y-c.y)/(c.x-t.y)),l=180*Math.atan((e.y-c.y)/(c.x-e.y)),d=f>70&&f<110,h=l>70&&l<110;if((f<30||f>150)&&!(l<30||l>150)||f*l<0){u=!1;break}if(d&&!h||f*l<0){u=!1;break}if((c.x-t.x)*(c.x-e.x)<0){u=!1;break}if((c.y-t.y)*(c.y-e.y)<0){u=!1;break}}return u}function V_(t,e){for(var n=!1,r=[10,-10,0,0],i=[0,0,10,-10],o=0;o<t.length;++o)for(var a=t[o],u=W_(a,t),s=0;s<r.length;s++)if(z_(a,{x:a.x+r[s],y:a.y+i[s]},t,e)){a.x+=r[s],a.y+=i[s];var c=W_(a,t),f=Math.random();c<u||f<F_&&f>.1?(u=c,n=!0):(a.x-=r[s],a.y-=i[s])}return F_>.1&&(F_*=.5),n?B_(t):0}function W_(t,e){var n=0;(t.x<0||t.y<0||t.x+t.size[0]+20>1200||t.y+t.size[1]+20>800)&&(n+=1e12);for(var r=0;r<e.length;++r)t.id!==e[r].id&&(n+=U_(t,e[r]));return n}var H_=function(){return H_=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},H_.apply(this,arguments)};function X_(t,e){var n=t.nodes,r=t.edges,i=e.width,o=e.height;if(!(null==n?void 0:n.length))return Promise.resolve();var a=[];n.forEach((function(t){if(r.filter((function(e){return e.source===t.id||e.target===t.id})).length>1){var e=H_({},t);delete e.size,a.push(e)}}));var u=[];r.forEach((function(t){var e=a.find((function(e){return e.id===t.source})),n=a.find((function(e){return e.id===t.target}));e&&n&&u.push(t)}));var s=new or({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}).layout({nodes:a,edges:u}).nodes;n.forEach((function(t){var e=(s||[]).find((function(e){return e.id===t.id}));t.x=(null==e?void 0:e.x)||i/2,t.y=(null==e?void 0:e.y)||o/2}));var c=JSON.parse(JSON.stringify(n)),f=JSON.parse(JSON.stringify(r)),l=At().nodes(c).force("link",Ct(f).id((function(t){return t.id})).distance((function(t){return u.find((function(e){return e.source===t.source&&e.target===t.target}))?30:20}))).force("charge",Tt()).force("center",It(i/2,o/2)).force("x",Rt(i/2)).force("y",Pt(o/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise((function(t){l.on("end",(function(){n.forEach((function(t){var e=c.find((function(e){return e.id===t.id}));e&&(t.x=e.x,t.y=e.y)}));var a=Math.min.apply(Math,n.map((function(t){return t.x}))),u=Math.max.apply(Math,n.map((function(t){return t.x}))),s=Math.min.apply(Math,n.map((function(t){return t.y}))),f=Math.max.apply(Math,n.map((function(t){return t.y}))),l=i/(u-a),d=o/(f-s);n.forEach((function(t){void 0!==t.x&&l<1&&(t.x=(t.x-a)*l),void 0!==t.y&&d<1&&(t.y=(t.y-s)*d)})),n.forEach((function(t){t.sizeTemp=t.size,t.size=[10,10]})),function(t,e){if(0===t.length)return{nodes:t,edges:e};t.forEach((function(t){var n=e.filter((function(e){return e.source===t.id||e.target===t.id}));j_.set(t,n)})),t.sort((function(t,e){var n,r;return(null===(n=j_.get(t.id))||void 0===n?void 0:n.length)-(null===(r=j_.get(e.id))||void 0===r?void 0:r.length)}));for(var n=B_(t),r=20,i=1,o=0,a=0;r>0&&!(++a>=50);){var u=V_(t,e);0!==u&&(o=u),i=o-n,n=o,0===i?--r:r=20}t.forEach((function(t){t.x=t.x-t.size[0]/2,t.y=t.y-t.size[1]/2}))}(n,r),n.forEach((function(t){t.size=t.sizeTemp||[],delete t.sizeTemp})),function(t,e){if(!t.nodes||0===t.nodes.length)return t;var n=e.width,r=e.height,i=e.nodeMinGap,o=1e4,a=1e4;t.nodes.forEach((function(t){var e=t.size[0]||50,n=t.size[1]||50;o=Math.min(e,o),a=Math.min(n,a)}));var u=new P_;u.init(n,r,{CELL_H:a,CELL_W:o}),t.nodes.forEach((function(t){var e=u.occupyNearest(t);e&&(e.node={id:t.id,size:t.size},t.x=e.x,t.y=e.y,t.dx=e.dx,t.dy=e.dy)}));for(var s=0;s<t.nodes.length;s++){var c=t.nodes[s],f=u.findGridByNodeId(c.id);if(!f)throw new Error("can not find node cell");var l=f.column,d=f.row;if(c.size[0]+i>o){for(var h=v=Math.ceil((c.size[0]+i)/o)-1,p=0;p<v&&u.additionColumn.indexOf(l+p+1)>-1&&!u.cells[l+p+1][d].node;p++)h--;u.insertColumn(l,h)}if(c.size[1]+i>a){var v;for(h=v=Math.ceil((c.size[1]+i)/a)-1,p=0;p<v&&u.additionRow.indexOf(d+p+1)>-1&&!u.cells[l][d+p+1].node;p++)h--;u.insertRow(d,h)}}for(s=0;s<u.columnNum;s++){var g=function(e){var n=u.cells[s][e];if(n.node){var r=t.nodes.find((function(t){var e;return t.id===(null===(e=null==n?void 0:n.node)||void 0===e?void 0:e.id)}));r&&(r.x=n.x+r.size[0]/2,r.y=n.y+r.size[1]/2)}};for(p=0;p<u.rowNum;p++)g(p)}}({nodes:n,edges:r},e),t()}))}));return d}var q_=function(){var t=function(e,n){return t=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,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Y_=function(t){function e(e){var n=t.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},e&&n.updateCfg(e),n}return q_(e,t),e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges;return null==e||e.forEach((function(t){t.size||(t.size=[50,50])})),X_({nodes:e,edges:n},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then((function(){t.onLayoutEnd&&t.onLayoutEnd()}))},e.prototype.getType=function(){return"er"},e}(t),K_=function(){function t(t){var e=N(t.type);this.layoutInstance=new e(t)}return t.prototype.layout=function(t){return this.layoutInstance.layout(t)},t.prototype.updateCfg=function(t){this.layoutInstance.updateCfg(t)},t.prototype.init=function(t){this.correctLayers(t.nodes),this.layoutInstance.init(t)},t.prototype.correctLayers=function(t){if(null==t?void 0:t.length){var n=1/0,r=[];if(t.forEach((function(t){e(t.layer)&&(t.layer=parseInt(t.layer,10)),void 0===t.layer||isNaN(t.layer)||(r.push(t),t.layer<n&&(n=t.layer))})),n<=0){var i=Math.abs(n)+1;r.forEach((function(t){return t.layer+=i}))}}},t.prototype.execute=function(){this.layoutInstance.execute()},t.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},t.prototype.destroy=function(){return this.layoutInstance.destroy()},t}(),Z_={force:Ft,fruchterman:Ff,forceAtlas2:D_,gForce:P,force2:Y,dagre:or,dagreCompound:ef,circular:Vt,radial:Mf,concentric:Pf,grid:C,mds:Lf,comboForce:w_,comboCombined:A_,random:D,"gForce-gpu":__,"fruchterman-gpu":g_,er:Y_}})(),r})()));
|
|
3
3
|
//# sourceMappingURL=layout.min.js.map
|