@cosmos.gl/graph 2.3.0 → 2.3.1-beta.0
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/index.js +683 -658
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +37 -14
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/Lines/draw-curve-line.vert +7 -2
- package/src/modules/Points/draw-points.vert +19 -1
- package/src/modules/Points/index.ts +13 -1
package/dist/index.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(Vt,tr){typeof exports=="object"&&typeof module<"u"?tr(exports):typeof define=="function"&&define.amd?define(["exports"],tr):(Vt=typeof globalThis<"u"?globalThis:Vt||self,tr(Vt.Cosmos={}))})(this,function(Vt){"use strict";var tr="http://www.w3.org/1999/xhtml";const ff={svg:"http://www.w3.org/2000/svg",xhtml:tr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bi(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),ff.hasOwnProperty(e)?{space:ff[e],local:t}:t}function Xc(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===tr&&e.documentElement.namespaceURI===tr?e.createElement(t):e.createElementNS(n,t)}}function Wc(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function uf(t){var e=Bi(t);return(e.local?Wc:Xc)(e)}function qc(){}function ya(t){return t==null?qc:function(){return this.querySelector(t)}}function Yc(t){typeof t!="function"&&(t=ya(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,f=r[i]=new Array(s),u,l,v=0;v<s;++v)(u=o[v])&&(l=t.call(u,u.__data__,v,o))&&("__data__"in u&&(l.__data__=u.__data__),f[v]=l);return new en(r,this._parents)}function Zc(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Qc(){return[]}function lf(t){return t==null?Qc:function(){return this.querySelectorAll(t)}}function Kc(t){return function(){return Zc(t.apply(this,arguments))}}function Jc(t){typeof t=="function"?t=Kc(t):t=lf(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var s=e[o],f=s.length,u,l=0;l<f;++l)(u=s[l])&&(r.push(t.call(u,u.__data__,l,s)),i.push(u));return new en(r,i)}function cf(t){return function(){return this.matches(t)}}function hf(t){return function(e){return e.matches(t)}}var eh=Array.prototype.find;function th(t){return function(){return eh.call(this.children,t)}}function nh(){return this.firstElementChild}function rh(t){return this.select(t==null?nh:th(typeof t=="function"?t:hf(t)))}var ih=Array.prototype.filter;function oh(){return Array.from(this.children)}function ah(t){return function(){return ih.call(this.children,t)}}function sh(t){return this.selectAll(t==null?oh:ah(typeof t=="function"?t:hf(t)))}function fh(t){typeof t!="function"&&(t=cf(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,f=r[i]=[],u,l=0;l<s;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&f.push(u);return new en(r,this._parents)}function df(t){return new Array(t.length)}function uh(){return new en(this._enter||this._groups.map(df),this._parents)}function Ui(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ui.prototype={constructor:Ui,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function lh(t){return function(){return t}}function ch(t,e,n,r,i,o){for(var s=0,f,u=e.length,l=o.length;s<l;++s)(f=e[s])?(f.__data__=o[s],r[s]=f):n[s]=new Ui(t,o[s]);for(;s<u;++s)(f=e[s])&&(i[s]=f)}function hh(t,e,n,r,i,o,s){var f,u,l=new Map,v=e.length,b=o.length,S=new Array(v),D;for(f=0;f<v;++f)(u=e[f])&&(S[f]=D=s.call(u,u.__data__,f,e)+"",l.has(D)?i[f]=u:l.set(D,u));for(f=0;f<b;++f)D=s.call(t,o[f],f,o)+"",(u=l.get(D))?(r[f]=u,u.__data__=o[f],l.delete(D)):n[f]=new Ui(t,o[f]);for(f=0;f<v;++f)(u=e[f])&&l.get(S[f])===u&&(i[f]=u)}function dh(t){return t.__data__}function mh(t,e){if(!arguments.length)return Array.from(this,dh);var n=e?hh:ch,r=this._parents,i=this._groups;typeof t!="function"&&(t=lh(t));for(var o=i.length,s=new Array(o),f=new Array(o),u=new Array(o),l=0;l<o;++l){var v=r[l],b=i[l],S=b.length,D=ph(t.call(v,v&&v.__data__,l,r)),Y=D.length,Ee=f[l]=new Array(Y),Te=s[l]=new Array(Y),se=u[l]=new Array(S);n(v,b,Ee,Te,se,D,e);for(var Ue=0,He=0,H,fe;Ue<Y;++Ue)if(H=Ee[Ue]){for(Ue>=He&&(He=Ue+1);!(fe=Te[He])&&++He<Y;);H._next=fe||null}}return s=new en(s,r),s._enter=f,s._exit=u,s}function ph(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function vh(){return new en(this._exit||this._groups.map(df),this._parents)}function gh(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function yh(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),f=new Array(i),u=0;u<s;++u)for(var l=n[u],v=r[u],b=l.length,S=f[u]=new Array(b),D,Y=0;Y<b;++Y)(D=l[Y]||v[Y])&&(S[Y]=D);for(;u<i;++u)f[u]=n[u];return new en(f,this._parents)}function xh(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function bh(t){t||(t=_h);function e(b,S){return b&&S?t(b.__data__,S.__data__):!b-!S}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],f=s.length,u=i[o]=new Array(f),l,v=0;v<f;++v)(l=s[v])&&(u[v]=l);u.sort(e)}return new en(i,this._parents).order()}function _h(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Sh(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Th(){return Array.from(this)}function wh(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function Ah(){let t=0;for(const e of this)++t;return t}function Eh(){return!this.node()}function Ph(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length,f;o<s;++o)(f=i[o])&&t.call(f,f.__data__,o,i);return this}function Ch(t){return function(){this.removeAttribute(t)}}function kh(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Lh(t,e){return function(){this.setAttribute(t,e)}}function Fh(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Rh(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Ih(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Dh(t,e){var n=Bi(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?kh:Ch:typeof e=="function"?n.local?Ih:Rh:n.local?Fh:Lh)(n,e))}function mf(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function zh(t){return function(){this.style.removeProperty(t)}}function Oh(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Mh(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Nh(t,e,n){return arguments.length>1?this.each((e==null?zh:typeof e=="function"?Mh:Oh)(t,e,n??"")):Cr(this.node(),t)}function Cr(t,e){return t.style.getPropertyValue(e)||mf(t).getComputedStyle(t,null).getPropertyValue(e)}function Gh(t){return function(){delete this[t]}}function Bh(t,e){return function(){this[t]=e}}function Uh(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Vh(t,e){return arguments.length>1?this.each((e==null?Gh:typeof e=="function"?Uh:Bh)(t,e)):this.node()[t]}function pf(t){return t.trim().split(/^|\s+/)}function xa(t){return t.classList||new vf(t)}function vf(t){this._node=t,this._names=pf(t.getAttribute("class")||"")}vf.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function gf(t,e){for(var n=xa(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function yf(t,e){for(var n=xa(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function $h(t){return function(){gf(this,t)}}function Hh(t){return function(){yf(this,t)}}function jh(t,e){return function(){(e.apply(this,arguments)?gf:yf)(this,t)}}function Xh(t,e){var n=pf(t+"");if(arguments.length<2){for(var r=xa(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?jh:e?$h:Hh)(n,e))}function Wh(){this.textContent=""}function qh(t){return function(){this.textContent=t}}function Yh(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Zh(t){return arguments.length?this.each(t==null?Wh:(typeof t=="function"?Yh:qh)(t)):this.node().textContent}function Qh(){this.innerHTML=""}function Kh(t){return function(){this.innerHTML=t}}function Jh(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function ed(t){return arguments.length?this.each(t==null?Qh:(typeof t=="function"?Jh:Kh)(t)):this.node().innerHTML}function td(){this.nextSibling&&this.parentNode.appendChild(this)}function nd(){return this.each(td)}function rd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function id(){return this.each(rd)}function od(t){var e=typeof t=="function"?t:uf(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ad(){return null}function sd(t,e){var n=typeof t=="function"?t:uf(t),r=e==null?ad:typeof e=="function"?e:ya(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function fd(){var t=this.parentNode;t&&t.removeChild(this)}function ud(){return this.each(fd)}function ld(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function cd(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function hd(t){return this.select(t?cd:ld)}function dd(t){return arguments.length?this.property("__data__",t):this.node().__data__}function md(t){return function(e){t.call(this,e,this.__data__)}}function pd(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function vd(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function gd(t,e,n){return function(){var r=this.__on,i,o=md(e);if(r){for(var s=0,f=r.length;s<f;++s)if((i=r[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function yd(t,e,n){var r=pd(t+""),i,o=r.length,s;if(arguments.length<2){var f=this.node().__on;if(f){for(var u=0,l=f.length,v;u<l;++u)for(i=0,v=f[u];i<o;++i)if((s=r[i]).type===v.type&&s.name===v.name)return v.value}return}for(f=e?gd:vd,i=0;i<o;++i)this.each(f(r[i],e,n));return this}function xf(t,e,n){var r=mf(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function xd(t,e){return function(){return xf(this,t,e)}}function bd(t,e){return function(){return xf(this,t,e.apply(this,arguments))}}function _d(t,e){return this.each((typeof e=="function"?bd:xd)(t,e))}function*Sd(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var bf=[null];function en(t,e){this._groups=t,this._parents=e}function ni(){return new en([[document.documentElement]],bf)}function Td(){return this}en.prototype=ni.prototype={constructor:en,select:Yc,selectAll:Jc,selectChild:rh,selectChildren:sh,filter:fh,data:mh,enter:uh,exit:vh,join:gh,merge:yh,selection:Td,order:xh,sort:bh,call:Sh,nodes:Th,node:wh,size:Ah,empty:Eh,each:Ph,attr:Dh,style:Nh,property:Vh,classed:Xh,text:Zh,html:ed,raise:nd,lower:id,append:od,insert:sd,remove:ud,clone:hd,datum:dd,on:yd,dispatch:_d,[Symbol.iterator]:Sd};function Dt(t){return typeof t=="string"?new en([[document.querySelector(t)]],[document.documentElement]):new en([[t]],bf)}function wd(t){let e;for(;e=t.sourceEvent;)t=e;return t}function kn(t,e){if(t=wd(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Ad={value:()=>{}};function Vi(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new $i(n)}function $i(t){this._=t}function Ed(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}$i.prototype=Vi.prototype={constructor:$i,on:function(t,e){var n=this._,r=Ed(t+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(t=r[o]).type)&&(i=Pd(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<s;)if(i=(t=r[o]).type)n[i]=_f(n[i],t.name,e);else if(e==null)for(i in n)n[i]=_f(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new $i(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},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)}};function Pd(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function _f(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ad,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var kr=0,ri=0,ii=0,Sf=1e3,Hi,oi,ji=0,nr=0,Xi=0,ai=typeof performance=="object"&&performance.now?performance:Date,Tf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ba(){return nr||(Tf(Cd),nr=ai.now()+Xi)}function Cd(){nr=0}function Wi(){this._call=this._time=this._next=null}Wi.prototype=wf.prototype={constructor:Wi,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ba():+n)+(e==null?0:+e),!this._next&&oi!==this&&(oi?oi._next=this:Hi=this,oi=this),this._call=t,this._time=n,_a()},stop:function(){this._call&&(this._call=null,this._time=1/0,_a())}};function wf(t,e,n){var r=new Wi;return r.restart(t,e,n),r}function kd(){ba(),++kr;for(var t=Hi,e;t;)(e=nr-t._time)>=0&&t._call.call(null,e),t=t._next;--kr}function Af(){nr=(ji=ai.now())+Xi,kr=ri=0;try{kd()}finally{kr=0,Fd(),nr=0}}function Ld(){var t=ai.now(),e=t-ji;e>Sf&&(Xi-=e,ji=t)}function Fd(){for(var t,e=Hi,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Hi=n);oi=t,_a(r)}function _a(t){if(!kr){ri&&(ri=clearTimeout(ri));var e=t-nr;e>24?(t<1/0&&(ri=setTimeout(Af,t-ai.now()-Xi)),ii&&(ii=clearInterval(ii))):(ii||(ji=ai.now(),ii=setInterval(Ld,Sf)),kr=1,Tf(Af))}}function Ef(t,e,n){var r=new Wi;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Rd=Vi("start","end","cancel","interrupt"),Id=[],Pf=0,Cf=1,Sa=2,qi=3,kf=4,Ta=5,Yi=6;function Zi(t,e,n,r,i,o){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Dd(t,n,{name:e,index:r,group:i,on:Rd,tween:Id,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Pf})}function wa(t,e){var n=ln(t,e);if(n.state>Pf)throw new Error("too late; already scheduled");return n}function bn(t,e){var n=ln(t,e);if(n.state>qi)throw new Error("too late; already running");return n}function ln(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Dd(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=wf(o,0,n.time);function o(l){n.state=Cf,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var v,b,S,D;if(n.state!==Cf)return u();for(v in r)if(D=r[v],D.name===n.name){if(D.state===qi)return Ef(s);D.state===kf?(D.state=Yi,D.timer.stop(),D.on.call("interrupt",t,t.__data__,D.index,D.group),delete r[v]):+v<e&&(D.state=Yi,D.timer.stop(),D.on.call("cancel",t,t.__data__,D.index,D.group),delete r[v])}if(Ef(function(){n.state===qi&&(n.state=kf,n.timer.restart(f,n.delay,n.time),f(l))}),n.state=Sa,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Sa){for(n.state=qi,i=new Array(S=n.tween.length),v=0,b=-1;v<S;++v)(D=n.tween[v].value.call(t,t.__data__,n.index,n.group))&&(i[++b]=D);i.length=b+1}}function f(l){for(var v=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=Ta,1),b=-1,S=i.length;++b<S;)i[b].call(t,v);n.state===Ta&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){n.state=Yi,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function Qi(t,e){var n=t.__transition,r,i,o=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){o=!1;continue}i=r.state>Sa&&r.state<Ta,r.state=Yi,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}o&&delete t.__transition}}function zd(t){return this.each(function(){Qi(this,t)})}function Aa(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Lf(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function si(){}var fi=.7,Ki=1/fi,Lr="\\s*([+-]?\\d+)\\s*",ui="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Od=/^#([0-9a-f]{3,8})$/,Md=new RegExp(`^rgb\\(${Lr},${Lr},${Lr}\\)$`),Nd=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),Gd=new RegExp(`^rgba\\(${Lr},${Lr},${Lr},${ui}\\)$`),Bd=new RegExp(`^rgba\\(${_n},${_n},${_n},${ui}\\)$`),Ud=new RegExp(`^hsl\\(${ui},${_n},${_n}\\)$`),Vd=new RegExp(`^hsla\\(${ui},${_n},${_n},${ui}\\)$`),Ff={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Aa(si,Un,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Rf,formatHex:Rf,formatHex8:$d,formatHsl:Hd,formatRgb:If,toString:If});function Rf(){return this.rgb().formatHex()}function $d(){return this.rgb().formatHex8()}function Hd(){return Nf(this).formatHsl()}function If(){return this.rgb().formatRgb()}function Un(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Od.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Df(e):n===3?new Zt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Ji(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Ji(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Md.exec(t))?new Zt(e[1],e[2],e[3],1):(e=Nd.exec(t))?new Zt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Gd.exec(t))?Ji(e[1],e[2],e[3],e[4]):(e=Bd.exec(t))?Ji(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Ud.exec(t))?Mf(e[1],e[2]/100,e[3]/100,1):(e=Vd.exec(t))?Mf(e[1],e[2]/100,e[3]/100,e[4]):Ff.hasOwnProperty(t)?Df(Ff[t]):t==="transparent"?new Zt(NaN,NaN,NaN,0):null}function Df(t){return new Zt(t>>16&255,t>>8&255,t&255,1)}function Ji(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zt(t,e,n,r)}function jd(t){return t instanceof si||(t=Un(t)),t?(t=t.rgb(),new Zt(t.r,t.g,t.b,t.opacity)):new Zt}function Ea(t,e,n,r){return arguments.length===1?jd(t):new Zt(t,e,n,r??1)}function Zt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Aa(Zt,Ea,Lf(si,{brighter(t){return t=t==null?Ki:Math.pow(Ki,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?fi:Math.pow(fi,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zt(rr(this.r),rr(this.g),rr(this.b),eo(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:zf,formatHex:zf,formatHex8:Xd,formatRgb:Of,toString:Of}));function zf(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}`}function Xd(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}${ir((isNaN(this.opacity)?1:this.opacity)*255)}`}function Of(){const t=eo(this.opacity);return`${t===1?"rgb(":"rgba("}${rr(this.r)}, ${rr(this.g)}, ${rr(this.b)}${t===1?")":`, ${t})`}`}function eo(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function rr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ir(t){return t=rr(t),(t<16?"0":"")+t.toString(16)}function Mf(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new cn(t,e,n,r)}function Nf(t){if(t instanceof cn)return new cn(t.h,t.s,t.l,t.opacity);if(t instanceof si||(t=Un(t)),!t)return new cn;if(t instanceof cn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,f=o-i,u=(o+i)/2;return f?(e===o?s=(n-r)/f+(n<r)*6:n===o?s=(r-e)/f+2:s=(e-n)/f+4,f/=u<.5?o+i:2-o-i,s*=60):f=u>0&&u<1?0:s,new cn(s,f,u,t.opacity)}function Wd(t,e,n,r){return arguments.length===1?Nf(t):new cn(t,e,n,r??1)}function cn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Aa(cn,Wd,Lf(si,{brighter(t){return t=t==null?Ki:Math.pow(Ki,t),new cn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?fi:Math.pow(fi,t),new cn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Zt(Pa(t>=240?t-240:t+120,i,r),Pa(t,i,r),Pa(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new cn(Gf(this.h),to(this.s),to(this.l),eo(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=eo(this.opacity);return`${t===1?"hsl(":"hsla("}${Gf(this.h)}, ${to(this.s)*100}%, ${to(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Gf(t){return t=(t||0)%360,t<0?t+360:t}function to(t){return Math.max(0,Math.min(1,t||0))}function Pa(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Ca=t=>()=>t;function qd(t,e){return function(n){return t+n*e}}function Yd(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Zd(t){return(t=+t)==1?Bf:function(e,n){return n-e?Yd(e,n,t):Ca(isNaN(e)?n:e)}}function Bf(t,e){var n=e-t;return n?qd(t,n):Ca(isNaN(t)?e:t)}const no=function t(e){var n=Zd(e);function r(i,o){var s=n((i=Ea(i)).r,(o=Ea(o)).r),f=n(i.g,o.g),u=n(i.b,o.b),l=Bf(i.opacity,o.opacity);return function(v){return i.r=s(v),i.g=f(v),i.b=u(v),i.opacity=l(v),i+""}}return r.gamma=t,r}(1);function Qd(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=t[i]*(1-o)+e[i]*o;return r}}function Kd(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Jd(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Fa(t[s],e[s]);for(;s<n;++s)o[s]=e[s];return function(f){for(s=0;s<r;++s)o[s]=i[s](f);return o}}function em(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function hn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function tm(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Fa(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var ka=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,La=new RegExp(ka.source,"g");function nm(t){return function(){return t}}function rm(t){return function(e){return t(e)+""}}function Uf(t,e){var n=ka.lastIndex=La.lastIndex=0,r,i,o,s=-1,f=[],u=[];for(t=t+"",e=e+"";(r=ka.exec(t))&&(i=La.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),f[s]?f[s]+=o:f[++s]=o),(r=r[0])===(i=i[0])?f[s]?f[s]+=i:f[++s]=i:(f[++s]=null,u.push({i:s,x:hn(r,i)})),n=La.lastIndex;return n<e.length&&(o=e.slice(n),f[s]?f[s]+=o:f[++s]=o),f.length<2?u[0]?rm(u[0].x):nm(e):(e=u.length,function(l){for(var v=0,b;v<e;++v)f[(b=u[v]).i]=b.x(l);return f.join("")})}function Fa(t,e){var n=typeof e,r;return e==null||n==="boolean"?Ca(e):(n==="number"?hn:n==="string"?(r=Un(e))?(e=r,no):Uf:e instanceof Un?no:e instanceof Date?em:Kd(e)?Qd:Array.isArray(e)?Jd:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?tm:hn)(t,e)}function im(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Vf=180/Math.PI,Ra={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $f(t,e,n,r,i,o){var s,f,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(f=Math.sqrt(n*n+r*r))&&(n/=f,r/=f,u/=f),t*r<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Vf,skewX:Math.atan(u)*Vf,scaleX:s,scaleY:f}}var ro;function om(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Ra:$f(e.a,e.b,e.c,e.d,e.e,e.f)}function am(t){return t==null||(ro||(ro=document.createElementNS("http://www.w3.org/2000/svg","g")),ro.setAttribute("transform",t),!(t=ro.transform.baseVal.consolidate()))?Ra:(t=t.matrix,$f(t.a,t.b,t.c,t.d,t.e,t.f))}function Hf(t,e,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,v,b,S,D,Y){if(l!==b||v!==S){var Ee=D.push("translate(",null,e,null,n);Y.push({i:Ee-4,x:hn(l,b)},{i:Ee-2,x:hn(v,S)})}else(b||S)&&D.push("translate("+b+e+S+n)}function s(l,v,b,S){l!==v?(l-v>180?v+=360:v-l>180&&(l+=360),S.push({i:b.push(i(b)+"rotate(",null,r)-2,x:hn(l,v)})):v&&b.push(i(b)+"rotate("+v+r)}function f(l,v,b,S){l!==v?S.push({i:b.push(i(b)+"skewX(",null,r)-2,x:hn(l,v)}):v&&b.push(i(b)+"skewX("+v+r)}function u(l,v,b,S,D,Y){if(l!==b||v!==S){var Ee=D.push(i(D)+"scale(",null,",",null,")");Y.push({i:Ee-4,x:hn(l,b)},{i:Ee-2,x:hn(v,S)})}else(b!==1||S!==1)&&D.push(i(D)+"scale("+b+","+S+")")}return function(l,v){var b=[],S=[];return l=t(l),v=t(v),o(l.translateX,l.translateY,v.translateX,v.translateY,b,S),s(l.rotate,v.rotate,b,S),f(l.skewX,v.skewX,b,S),u(l.scaleX,l.scaleY,v.scaleX,v.scaleY,b,S),l=v=null,function(D){for(var Y=-1,Ee=S.length,Te;++Y<Ee;)b[(Te=S[Y]).i]=Te.x(D);return b.join("")}}}var sm=Hf(om,"px, ","px)","deg)"),fm=Hf(am,", ",")",")"),um=1e-12;function jf(t){return((t=Math.exp(t))+1/t)/2}function lm(t){return((t=Math.exp(t))-1/t)/2}function cm(t){return((t=Math.exp(2*t))-1)/(t+1)}const hm=function t(e,n,r){function i(o,s){var f=o[0],u=o[1],l=o[2],v=s[0],b=s[1],S=s[2],D=v-f,Y=b-u,Ee=D*D+Y*Y,Te,se;if(Ee<um)se=Math.log(S/l)/e,Te=function(Ge){return[f+Ge*D,u+Ge*Y,l*Math.exp(e*Ge*se)]};else{var Ue=Math.sqrt(Ee),He=(S*S-l*l+r*Ee)/(2*l*n*Ue),H=(S*S-l*l-r*Ee)/(2*S*n*Ue),fe=Math.log(Math.sqrt(He*He+1)-He),Re=Math.log(Math.sqrt(H*H+1)-H);se=(Re-fe)/e,Te=function(Ge){var Ye=Ge*se,at=jf(fe),ut=l/(n*Ue)*(at*cm(e*Ye+fe)-lm(fe));return[f+ut*D,u+ut*Y,l*at/jf(e*Ye+fe)]}}return Te.duration=se*1e3*e/Math.SQRT2,Te}return i.rho=function(o){var s=Math.max(.001,+o),f=s*s,u=f*f;return t(s,f,u)},i}(Math.SQRT2,2,4);function dm(t,e){var n,r;return function(){var i=bn(this,t),o=i.tween;if(o!==n){r=n=o;for(var s=0,f=r.length;s<f;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function mm(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=bn(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var f={name:e,value:n},u=0,l=i.length;u<l;++u)if(i[u].name===e){i[u]=f;break}u===l&&i.push(f)}o.tween=i}}function pm(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=ln(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===t)return s.value;return null}return this.each((e==null?dm:mm)(n,t,e))}function Ia(t,e,n){var r=t._id;return t.each(function(){var i=bn(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return ln(i,r).value[e]}}function Xf(t,e){var n;return(typeof e=="number"?hn:e instanceof Un?no:(n=Un(e))?(e=n,no):Uf)(t,e)}function vm(t){return function(){this.removeAttribute(t)}}function gm(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ym(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttribute(t);return s===i?null:s===r?o:o=e(r=s,n)}}function xm(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===r?o:o=e(r=s,n)}}function bm(t,e,n){var r,i,o;return function(){var s,f=n(this),u;return f==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=f+"",s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,f)))}}function _m(t,e,n){var r,i,o;return function(){var s,f=n(this),u;return f==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=f+"",s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,f)))}}function Sm(t,e){var n=Bi(t),r=n==="transform"?fm:Xf;return this.attrTween(t,typeof e=="function"?(n.local?_m:bm)(n,r,Ia(this,"attr."+t,e)):e==null?(n.local?gm:vm)(n):(n.local?xm:ym)(n,r,e))}function Tm(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function wm(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Am(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&wm(t,o)),n}return i._value=e,i}function Em(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Tm(t,o)),n}return i._value=e,i}function Pm(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Bi(t);return this.tween(n,(r.local?Am:Em)(r,e))}function Cm(t,e){return function(){wa(this,t).delay=+e.apply(this,arguments)}}function km(t,e){return e=+e,function(){wa(this,t).delay=e}}function Lm(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Cm:km)(e,t)):ln(this.node(),e).delay}function Fm(t,e){return function(){bn(this,t).duration=+e.apply(this,arguments)}}function Rm(t,e){return e=+e,function(){bn(this,t).duration=e}}function Im(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Fm:Rm)(e,t)):ln(this.node(),e).duration}function Dm(t,e){if(typeof e!="function")throw new Error;return function(){bn(this,t).ease=e}}function zm(t){var e=this._id;return arguments.length?this.each(Dm(e,t)):ln(this.node(),e).ease}function Om(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;bn(this,t).ease=n}}function Mm(t){if(typeof t!="function")throw new Error;return this.each(Om(this._id,t))}function Nm(t){typeof t!="function"&&(t=cf(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,f=r[i]=[],u,l=0;l<s;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&f.push(u);return new Ln(r,this._parents,this._name,this._id)}function Gm(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),s=new Array(r),f=0;f<o;++f)for(var u=e[f],l=n[f],v=u.length,b=s[f]=new Array(v),S,D=0;D<v;++D)(S=u[D]||l[D])&&(b[D]=S);for(;f<r;++f)s[f]=e[f];return new Ln(s,this._parents,this._name,this._id)}function Bm(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Um(t,e,n){var r,i,o=Bm(e)?wa:bn;return function(){var s=o(this,t),f=s.on;f!==r&&(i=(r=f).copy()).on(e,n),s.on=i}}function Vm(t,e){var n=this._id;return arguments.length<2?ln(this.node(),n).on.on(t):this.each(Um(n,t,e))}function $m(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Hm(){return this.on("end.remove",$m(this._id))}function jm(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ya(t));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var f=r[s],u=f.length,l=o[s]=new Array(u),v,b,S=0;S<u;++S)(v=f[S])&&(b=t.call(v,v.__data__,S,f))&&("__data__"in v&&(b.__data__=v.__data__),l[S]=b,Zi(l[S],e,n,S,l,ln(v,n)));return new Ln(o,this._parents,e,n)}function Xm(t){var e=this._name,n=this._id;typeof t!="function"&&(t=lf(t));for(var r=this._groups,i=r.length,o=[],s=[],f=0;f<i;++f)for(var u=r[f],l=u.length,v,b=0;b<l;++b)if(v=u[b]){for(var S=t.call(v,v.__data__,b,u),D,Y=ln(v,n),Ee=0,Te=S.length;Ee<Te;++Ee)(D=S[Ee])&&Zi(D,e,n,Ee,S,Y);o.push(S),s.push(v)}return new Ln(o,s,e,n)}var Wm=ni.prototype.constructor;function qm(){return new Wm(this._groups,this._parents)}function Ym(t,e){var n,r,i;return function(){var o=Cr(this,t),s=(this.style.removeProperty(t),Cr(this,t));return o===s?null:o===n&&s===r?i:i=e(n=o,r=s)}}function Wf(t){return function(){this.style.removeProperty(t)}}function Zm(t,e,n){var r,i=n+"",o;return function(){var s=Cr(this,t);return s===i?null:s===r?o:o=e(r=s,n)}}function Qm(t,e,n){var r,i,o;return function(){var s=Cr(this,t),f=n(this),u=f+"";return f==null&&(u=f=(this.style.removeProperty(t),Cr(this,t))),s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,f))}}function Km(t,e){var n,r,i,o="style."+e,s="end."+o,f;return function(){var u=bn(this,t),l=u.on,v=u.value[o]==null?f||(f=Wf(e)):void 0;(l!==n||i!==v)&&(r=(n=l).copy()).on(s,i=v),u.on=r}}function Jm(t,e,n){var r=(t+="")=="transform"?sm:Xf;return e==null?this.styleTween(t,Ym(t,r)).on("end.style."+t,Wf(t)):typeof e=="function"?this.styleTween(t,Qm(t,r,Ia(this,"style."+t,e))).each(Km(this._id,t)):this.styleTween(t,Zm(t,r,e),n).on("end.style."+t,null)}function ep(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function tp(t,e,n){var r,i;function o(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&ep(t,s,n)),r}return o._value=e,o}function np(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,tp(t,e,n??""))}function rp(t){return function(){this.textContent=t}}function ip(t){return function(){var e=t(this);this.textContent=e??""}}function op(t){return this.tween("text",typeof t=="function"?ip(Ia(this,"text",t)):rp(t==null?"":t+""))}function ap(t){return function(e){this.textContent=t.call(this,e)}}function sp(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&ap(i)),e}return r._value=t,r}function fp(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,sp(t))}function up(){for(var t=this._name,e=this._id,n=qf(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],f=s.length,u,l=0;l<f;++l)if(u=s[l]){var v=ln(u,e);Zi(u,t,n,l,s,{time:v.time+v.delay+v.duration,delay:0,duration:v.duration,ease:v.ease})}return new Ln(r,this._parents,t,n)}function lp(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var f={value:s},u={value:function(){--i===0&&o()}};n.each(function(){var l=bn(this,r),v=l.on;v!==t&&(e=(t=v).copy(),e._.cancel.push(f),e._.interrupt.push(f),e._.end.push(u)),l.on=e}),i===0&&o()})}var cp=0;function Ln(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function qf(){return++cp}var Fn=ni.prototype;Ln.prototype={constructor:Ln,select:jm,selectAll:Xm,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:Nm,merge:Gm,selection:qm,transition:up,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:Vm,attr:Sm,attrTween:Pm,style:Jm,styleTween:np,text:op,textTween:fp,remove:Hm,tween:pm,delay:Lm,duration:Im,ease:zm,easeVarying:Mm,end:lp,[Symbol.iterator]:Fn[Symbol.iterator]};function hp(t){return t*t}function dp(t){return t*(2-t)}function mp(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function pp(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var vp={time:null,delay:0,duration:250,ease:pp};function gp(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function yp(t){var e,n;t instanceof Ln?(e=t._id,t=t._name):(e=qf(),(n=vp).time=ba(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],f=s.length,u,l=0;l<f;++l)(u=s[l])&&Zi(u,t,e,l,s,n||gp(u,e));return new Ln(r,this._parents,t,e)}ni.prototype.interrupt=zd,ni.prototype.transition=yp;function Da(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function xp(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var io={exports:{}},bp=io.exports,Yf;function _p(){return Yf||(Yf=1,function(t,e){(function(n,r){t.exports=r()})(bp,function(){var n=function(a){return a instanceof Uint8Array||a instanceof Uint16Array||a instanceof Uint32Array||a instanceof Int8Array||a instanceof Int16Array||a instanceof Int32Array||a instanceof Float32Array||a instanceof Float64Array||a instanceof Uint8ClampedArray},r=function(a,h){for(var _=Object.keys(h),O=0;O<_.length;++O)a[_[O]]=h[_[O]];return a},i=`
|
|
2
|
-
`;function o(a){return typeof atob<"u"?atob(a):"base64:"+a}function s(a){var h=new Error("(regl) "+a);throw console.error(h),h}function f(a,h){a||s(h)}function u(a){return a?": "+a:""}function l(a,h,_){a in h||s("unknown parameter ("+a+")"+u(_)+". possible values: "+Object.keys(h).join())}function
|
|
1
|
+
(function(Vt,tr){typeof exports=="object"&&typeof module<"u"?tr(exports):typeof define=="function"&&define.amd?define(["exports"],tr):(Vt=typeof globalThis<"u"?globalThis:Vt||self,tr(Vt.Cosmos={}))})(this,function(Vt){"use strict";var tr="http://www.w3.org/1999/xhtml";const ff={svg:"http://www.w3.org/2000/svg",xhtml:tr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bi(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),ff.hasOwnProperty(e)?{space:ff[e],local:t}:t}function Xc(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===tr&&e.documentElement.namespaceURI===tr?e.createElement(t):e.createElementNS(n,t)}}function Wc(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function uf(t){var e=Bi(t);return(e.local?Wc:Xc)(e)}function qc(){}function ya(t){return t==null?qc:function(){return this.querySelector(t)}}function Yc(t){typeof t!="function"&&(t=ya(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,f=r[i]=new Array(s),u,l,p=0;p<s;++p)(u=o[p])&&(l=t.call(u,u.__data__,p,o))&&("__data__"in u&&(l.__data__=u.__data__),f[p]=l);return new en(r,this._parents)}function Zc(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Qc(){return[]}function lf(t){return t==null?Qc:function(){return this.querySelectorAll(t)}}function Kc(t){return function(){return Zc(t.apply(this,arguments))}}function Jc(t){typeof t=="function"?t=Kc(t):t=lf(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var s=e[o],f=s.length,u,l=0;l<f;++l)(u=s[l])&&(r.push(t.call(u,u.__data__,l,s)),i.push(u));return new en(r,i)}function cf(t){return function(){return this.matches(t)}}function hf(t){return function(e){return e.matches(t)}}var eh=Array.prototype.find;function th(t){return function(){return eh.call(this.children,t)}}function nh(){return this.firstElementChild}function rh(t){return this.select(t==null?nh:th(typeof t=="function"?t:hf(t)))}var ih=Array.prototype.filter;function oh(){return Array.from(this.children)}function ah(t){return function(){return ih.call(this.children,t)}}function sh(t){return this.selectAll(t==null?oh:ah(typeof t=="function"?t:hf(t)))}function fh(t){typeof t!="function"&&(t=cf(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,f=r[i]=[],u,l=0;l<s;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&f.push(u);return new en(r,this._parents)}function df(t){return new Array(t.length)}function uh(){return new en(this._enter||this._groups.map(df),this._parents)}function Ui(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ui.prototype={constructor:Ui,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function lh(t){return function(){return t}}function ch(t,e,n,r,i,o){for(var s=0,f,u=e.length,l=o.length;s<l;++s)(f=e[s])?(f.__data__=o[s],r[s]=f):n[s]=new Ui(t,o[s]);for(;s<u;++s)(f=e[s])&&(i[s]=f)}function hh(t,e,n,r,i,o,s){var f,u,l=new Map,p=e.length,x=o.length,S=new Array(p),D;for(f=0;f<p;++f)(u=e[f])&&(S[f]=D=s.call(u,u.__data__,f,e)+"",l.has(D)?i[f]=u:l.set(D,u));for(f=0;f<x;++f)D=s.call(t,o[f],f,o)+"",(u=l.get(D))?(r[f]=u,u.__data__=o[f],l.delete(D)):n[f]=new Ui(t,o[f]);for(f=0;f<p;++f)(u=e[f])&&l.get(S[f])===u&&(i[f]=u)}function dh(t){return t.__data__}function mh(t,e){if(!arguments.length)return Array.from(this,dh);var n=e?hh:ch,r=this._parents,i=this._groups;typeof t!="function"&&(t=lh(t));for(var o=i.length,s=new Array(o),f=new Array(o),u=new Array(o),l=0;l<o;++l){var p=r[l],x=i[l],S=x.length,D=ph(t.call(p,p&&p.__data__,l,r)),Y=D.length,Ee=f[l]=new Array(Y),Te=s[l]=new Array(Y),se=u[l]=new Array(S);n(p,x,Ee,Te,se,D,e);for(var Ue=0,He=0,H,fe;Ue<Y;++Ue)if(H=Ee[Ue]){for(Ue>=He&&(He=Ue+1);!(fe=Te[He])&&++He<Y;);H._next=fe||null}}return s=new en(s,r),s._enter=f,s._exit=u,s}function ph(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function vh(){return new en(this._exit||this._groups.map(df),this._parents)}function gh(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function yh(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),f=new Array(i),u=0;u<s;++u)for(var l=n[u],p=r[u],x=l.length,S=f[u]=new Array(x),D,Y=0;Y<x;++Y)(D=l[Y]||p[Y])&&(S[Y]=D);for(;u<i;++u)f[u]=n[u];return new en(f,this._parents)}function xh(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function bh(t){t||(t=_h);function e(x,S){return x&&S?t(x.__data__,S.__data__):!x-!S}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],f=s.length,u=i[o]=new Array(f),l,p=0;p<f;++p)(l=s[p])&&(u[p]=l);u.sort(e)}return new en(i,this._parents).order()}function _h(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Sh(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Th(){return Array.from(this)}function wh(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function Ah(){let t=0;for(const e of this)++t;return t}function Eh(){return!this.node()}function Ph(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length,f;o<s;++o)(f=i[o])&&t.call(f,f.__data__,o,i);return this}function Ch(t){return function(){this.removeAttribute(t)}}function kh(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Lh(t,e){return function(){this.setAttribute(t,e)}}function Fh(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Rh(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Ih(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Dh(t,e){var n=Bi(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?kh:Ch:typeof e=="function"?n.local?Ih:Rh:n.local?Fh:Lh)(n,e))}function mf(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function zh(t){return function(){this.style.removeProperty(t)}}function Oh(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Mh(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Nh(t,e,n){return arguments.length>1?this.each((e==null?zh:typeof e=="function"?Mh:Oh)(t,e,n??"")):Cr(this.node(),t)}function Cr(t,e){return t.style.getPropertyValue(e)||mf(t).getComputedStyle(t,null).getPropertyValue(e)}function Gh(t){return function(){delete this[t]}}function Bh(t,e){return function(){this[t]=e}}function Uh(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Vh(t,e){return arguments.length>1?this.each((e==null?Gh:typeof e=="function"?Uh:Bh)(t,e)):this.node()[t]}function pf(t){return t.trim().split(/^|\s+/)}function xa(t){return t.classList||new vf(t)}function vf(t){this._node=t,this._names=pf(t.getAttribute("class")||"")}vf.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function gf(t,e){for(var n=xa(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function yf(t,e){for(var n=xa(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function $h(t){return function(){gf(this,t)}}function Hh(t){return function(){yf(this,t)}}function jh(t,e){return function(){(e.apply(this,arguments)?gf:yf)(this,t)}}function Xh(t,e){var n=pf(t+"");if(arguments.length<2){for(var r=xa(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?jh:e?$h:Hh)(n,e))}function Wh(){this.textContent=""}function qh(t){return function(){this.textContent=t}}function Yh(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Zh(t){return arguments.length?this.each(t==null?Wh:(typeof t=="function"?Yh:qh)(t)):this.node().textContent}function Qh(){this.innerHTML=""}function Kh(t){return function(){this.innerHTML=t}}function Jh(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function ed(t){return arguments.length?this.each(t==null?Qh:(typeof t=="function"?Jh:Kh)(t)):this.node().innerHTML}function td(){this.nextSibling&&this.parentNode.appendChild(this)}function nd(){return this.each(td)}function rd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function id(){return this.each(rd)}function od(t){var e=typeof t=="function"?t:uf(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ad(){return null}function sd(t,e){var n=typeof t=="function"?t:uf(t),r=e==null?ad:typeof e=="function"?e:ya(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function fd(){var t=this.parentNode;t&&t.removeChild(this)}function ud(){return this.each(fd)}function ld(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function cd(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function hd(t){return this.select(t?cd:ld)}function dd(t){return arguments.length?this.property("__data__",t):this.node().__data__}function md(t){return function(e){t.call(this,e,this.__data__)}}function pd(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function vd(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function gd(t,e,n){return function(){var r=this.__on,i,o=md(e);if(r){for(var s=0,f=r.length;s<f;++s)if((i=r[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function yd(t,e,n){var r=pd(t+""),i,o=r.length,s;if(arguments.length<2){var f=this.node().__on;if(f){for(var u=0,l=f.length,p;u<l;++u)for(i=0,p=f[u];i<o;++i)if((s=r[i]).type===p.type&&s.name===p.name)return p.value}return}for(f=e?gd:vd,i=0;i<o;++i)this.each(f(r[i],e,n));return this}function xf(t,e,n){var r=mf(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function xd(t,e){return function(){return xf(this,t,e)}}function bd(t,e){return function(){return xf(this,t,e.apply(this,arguments))}}function _d(t,e){return this.each((typeof e=="function"?bd:xd)(t,e))}function*Sd(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var bf=[null];function en(t,e){this._groups=t,this._parents=e}function ni(){return new en([[document.documentElement]],bf)}function Td(){return this}en.prototype=ni.prototype={constructor:en,select:Yc,selectAll:Jc,selectChild:rh,selectChildren:sh,filter:fh,data:mh,enter:uh,exit:vh,join:gh,merge:yh,selection:Td,order:xh,sort:bh,call:Sh,nodes:Th,node:wh,size:Ah,empty:Eh,each:Ph,attr:Dh,style:Nh,property:Vh,classed:Xh,text:Zh,html:ed,raise:nd,lower:id,append:od,insert:sd,remove:ud,clone:hd,datum:dd,on:yd,dispatch:_d,[Symbol.iterator]:Sd};function Dt(t){return typeof t=="string"?new en([[document.querySelector(t)]],[document.documentElement]):new en([[t]],bf)}function wd(t){let e;for(;e=t.sourceEvent;)t=e;return t}function kn(t,e){if(t=wd(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Ad={value:()=>{}};function Vi(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new $i(n)}function $i(t){this._=t}function Ed(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}$i.prototype=Vi.prototype={constructor:$i,on:function(t,e){var n=this._,r=Ed(t+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(t=r[o]).type)&&(i=Pd(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<s;)if(i=(t=r[o]).type)n[i]=_f(n[i],t.name,e);else if(e==null)for(i in n)n[i]=_f(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new $i(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},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)}};function Pd(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function _f(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ad,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var kr=0,ri=0,ii=0,Sf=1e3,Hi,oi,ji=0,nr=0,Xi=0,ai=typeof performance=="object"&&performance.now?performance:Date,Tf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ba(){return nr||(Tf(Cd),nr=ai.now()+Xi)}function Cd(){nr=0}function Wi(){this._call=this._time=this._next=null}Wi.prototype=wf.prototype={constructor:Wi,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ba():+n)+(e==null?0:+e),!this._next&&oi!==this&&(oi?oi._next=this:Hi=this,oi=this),this._call=t,this._time=n,_a()},stop:function(){this._call&&(this._call=null,this._time=1/0,_a())}};function wf(t,e,n){var r=new Wi;return r.restart(t,e,n),r}function kd(){ba(),++kr;for(var t=Hi,e;t;)(e=nr-t._time)>=0&&t._call.call(null,e),t=t._next;--kr}function Af(){nr=(ji=ai.now())+Xi,kr=ri=0;try{kd()}finally{kr=0,Fd(),nr=0}}function Ld(){var t=ai.now(),e=t-ji;e>Sf&&(Xi-=e,ji=t)}function Fd(){for(var t,e=Hi,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Hi=n);oi=t,_a(r)}function _a(t){if(!kr){ri&&(ri=clearTimeout(ri));var e=t-nr;e>24?(t<1/0&&(ri=setTimeout(Af,t-ai.now()-Xi)),ii&&(ii=clearInterval(ii))):(ii||(ji=ai.now(),ii=setInterval(Ld,Sf)),kr=1,Tf(Af))}}function Ef(t,e,n){var r=new Wi;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Rd=Vi("start","end","cancel","interrupt"),Id=[],Pf=0,Cf=1,Sa=2,qi=3,kf=4,Ta=5,Yi=6;function Zi(t,e,n,r,i,o){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Dd(t,n,{name:e,index:r,group:i,on:Rd,tween:Id,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Pf})}function wa(t,e){var n=ln(t,e);if(n.state>Pf)throw new Error("too late; already scheduled");return n}function bn(t,e){var n=ln(t,e);if(n.state>qi)throw new Error("too late; already running");return n}function ln(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Dd(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=wf(o,0,n.time);function o(l){n.state=Cf,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var p,x,S,D;if(n.state!==Cf)return u();for(p in r)if(D=r[p],D.name===n.name){if(D.state===qi)return Ef(s);D.state===kf?(D.state=Yi,D.timer.stop(),D.on.call("interrupt",t,t.__data__,D.index,D.group),delete r[p]):+p<e&&(D.state=Yi,D.timer.stop(),D.on.call("cancel",t,t.__data__,D.index,D.group),delete r[p])}if(Ef(function(){n.state===qi&&(n.state=kf,n.timer.restart(f,n.delay,n.time),f(l))}),n.state=Sa,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Sa){for(n.state=qi,i=new Array(S=n.tween.length),p=0,x=-1;p<S;++p)(D=n.tween[p].value.call(t,t.__data__,n.index,n.group))&&(i[++x]=D);i.length=x+1}}function f(l){for(var p=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=Ta,1),x=-1,S=i.length;++x<S;)i[x].call(t,p);n.state===Ta&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){n.state=Yi,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function Qi(t,e){var n=t.__transition,r,i,o=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){o=!1;continue}i=r.state>Sa&&r.state<Ta,r.state=Yi,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}o&&delete t.__transition}}function zd(t){return this.each(function(){Qi(this,t)})}function Aa(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Lf(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function si(){}var fi=.7,Ki=1/fi,Lr="\\s*([+-]?\\d+)\\s*",ui="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Od=/^#([0-9a-f]{3,8})$/,Md=new RegExp(`^rgb\\(${Lr},${Lr},${Lr}\\)$`),Nd=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),Gd=new RegExp(`^rgba\\(${Lr},${Lr},${Lr},${ui}\\)$`),Bd=new RegExp(`^rgba\\(${_n},${_n},${_n},${ui}\\)$`),Ud=new RegExp(`^hsl\\(${ui},${_n},${_n}\\)$`),Vd=new RegExp(`^hsla\\(${ui},${_n},${_n},${ui}\\)$`),Ff={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Aa(si,Un,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Rf,formatHex:Rf,formatHex8:$d,formatHsl:Hd,formatRgb:If,toString:If});function Rf(){return this.rgb().formatHex()}function $d(){return this.rgb().formatHex8()}function Hd(){return Nf(this).formatHsl()}function If(){return this.rgb().formatRgb()}function Un(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Od.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Df(e):n===3?new Zt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Ji(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Ji(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Md.exec(t))?new Zt(e[1],e[2],e[3],1):(e=Nd.exec(t))?new Zt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Gd.exec(t))?Ji(e[1],e[2],e[3],e[4]):(e=Bd.exec(t))?Ji(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Ud.exec(t))?Mf(e[1],e[2]/100,e[3]/100,1):(e=Vd.exec(t))?Mf(e[1],e[2]/100,e[3]/100,e[4]):Ff.hasOwnProperty(t)?Df(Ff[t]):t==="transparent"?new Zt(NaN,NaN,NaN,0):null}function Df(t){return new Zt(t>>16&255,t>>8&255,t&255,1)}function Ji(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zt(t,e,n,r)}function jd(t){return t instanceof si||(t=Un(t)),t?(t=t.rgb(),new Zt(t.r,t.g,t.b,t.opacity)):new Zt}function Ea(t,e,n,r){return arguments.length===1?jd(t):new Zt(t,e,n,r??1)}function Zt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Aa(Zt,Ea,Lf(si,{brighter(t){return t=t==null?Ki:Math.pow(Ki,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?fi:Math.pow(fi,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zt(rr(this.r),rr(this.g),rr(this.b),eo(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:zf,formatHex:zf,formatHex8:Xd,formatRgb:Of,toString:Of}));function zf(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}`}function Xd(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}${ir((isNaN(this.opacity)?1:this.opacity)*255)}`}function Of(){const t=eo(this.opacity);return`${t===1?"rgb(":"rgba("}${rr(this.r)}, ${rr(this.g)}, ${rr(this.b)}${t===1?")":`, ${t})`}`}function eo(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function rr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ir(t){return t=rr(t),(t<16?"0":"")+t.toString(16)}function Mf(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new cn(t,e,n,r)}function Nf(t){if(t instanceof cn)return new cn(t.h,t.s,t.l,t.opacity);if(t instanceof si||(t=Un(t)),!t)return new cn;if(t instanceof cn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,f=o-i,u=(o+i)/2;return f?(e===o?s=(n-r)/f+(n<r)*6:n===o?s=(r-e)/f+2:s=(e-n)/f+4,f/=u<.5?o+i:2-o-i,s*=60):f=u>0&&u<1?0:s,new cn(s,f,u,t.opacity)}function Wd(t,e,n,r){return arguments.length===1?Nf(t):new cn(t,e,n,r??1)}function cn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Aa(cn,Wd,Lf(si,{brighter(t){return t=t==null?Ki:Math.pow(Ki,t),new cn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?fi:Math.pow(fi,t),new cn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Zt(Pa(t>=240?t-240:t+120,i,r),Pa(t,i,r),Pa(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new cn(Gf(this.h),to(this.s),to(this.l),eo(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=eo(this.opacity);return`${t===1?"hsl(":"hsla("}${Gf(this.h)}, ${to(this.s)*100}%, ${to(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Gf(t){return t=(t||0)%360,t<0?t+360:t}function to(t){return Math.max(0,Math.min(1,t||0))}function Pa(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Ca=t=>()=>t;function qd(t,e){return function(n){return t+n*e}}function Yd(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Zd(t){return(t=+t)==1?Bf:function(e,n){return n-e?Yd(e,n,t):Ca(isNaN(e)?n:e)}}function Bf(t,e){var n=e-t;return n?qd(t,n):Ca(isNaN(t)?e:t)}const no=function t(e){var n=Zd(e);function r(i,o){var s=n((i=Ea(i)).r,(o=Ea(o)).r),f=n(i.g,o.g),u=n(i.b,o.b),l=Bf(i.opacity,o.opacity);return function(p){return i.r=s(p),i.g=f(p),i.b=u(p),i.opacity=l(p),i+""}}return r.gamma=t,r}(1);function Qd(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=t[i]*(1-o)+e[i]*o;return r}}function Kd(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Jd(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Fa(t[s],e[s]);for(;s<n;++s)o[s]=e[s];return function(f){for(s=0;s<r;++s)o[s]=i[s](f);return o}}function em(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function hn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function tm(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Fa(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var ka=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,La=new RegExp(ka.source,"g");function nm(t){return function(){return t}}function rm(t){return function(e){return t(e)+""}}function Uf(t,e){var n=ka.lastIndex=La.lastIndex=0,r,i,o,s=-1,f=[],u=[];for(t=t+"",e=e+"";(r=ka.exec(t))&&(i=La.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),f[s]?f[s]+=o:f[++s]=o),(r=r[0])===(i=i[0])?f[s]?f[s]+=i:f[++s]=i:(f[++s]=null,u.push({i:s,x:hn(r,i)})),n=La.lastIndex;return n<e.length&&(o=e.slice(n),f[s]?f[s]+=o:f[++s]=o),f.length<2?u[0]?rm(u[0].x):nm(e):(e=u.length,function(l){for(var p=0,x;p<e;++p)f[(x=u[p]).i]=x.x(l);return f.join("")})}function Fa(t,e){var n=typeof e,r;return e==null||n==="boolean"?Ca(e):(n==="number"?hn:n==="string"?(r=Un(e))?(e=r,no):Uf:e instanceof Un?no:e instanceof Date?em:Kd(e)?Qd:Array.isArray(e)?Jd:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?tm:hn)(t,e)}function im(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Vf=180/Math.PI,Ra={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $f(t,e,n,r,i,o){var s,f,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(f=Math.sqrt(n*n+r*r))&&(n/=f,r/=f,u/=f),t*r<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Vf,skewX:Math.atan(u)*Vf,scaleX:s,scaleY:f}}var ro;function om(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Ra:$f(e.a,e.b,e.c,e.d,e.e,e.f)}function am(t){return t==null||(ro||(ro=document.createElementNS("http://www.w3.org/2000/svg","g")),ro.setAttribute("transform",t),!(t=ro.transform.baseVal.consolidate()))?Ra:(t=t.matrix,$f(t.a,t.b,t.c,t.d,t.e,t.f))}function Hf(t,e,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,p,x,S,D,Y){if(l!==x||p!==S){var Ee=D.push("translate(",null,e,null,n);Y.push({i:Ee-4,x:hn(l,x)},{i:Ee-2,x:hn(p,S)})}else(x||S)&&D.push("translate("+x+e+S+n)}function s(l,p,x,S){l!==p?(l-p>180?p+=360:p-l>180&&(l+=360),S.push({i:x.push(i(x)+"rotate(",null,r)-2,x:hn(l,p)})):p&&x.push(i(x)+"rotate("+p+r)}function f(l,p,x,S){l!==p?S.push({i:x.push(i(x)+"skewX(",null,r)-2,x:hn(l,p)}):p&&x.push(i(x)+"skewX("+p+r)}function u(l,p,x,S,D,Y){if(l!==x||p!==S){var Ee=D.push(i(D)+"scale(",null,",",null,")");Y.push({i:Ee-4,x:hn(l,x)},{i:Ee-2,x:hn(p,S)})}else(x!==1||S!==1)&&D.push(i(D)+"scale("+x+","+S+")")}return function(l,p){var x=[],S=[];return l=t(l),p=t(p),o(l.translateX,l.translateY,p.translateX,p.translateY,x,S),s(l.rotate,p.rotate,x,S),f(l.skewX,p.skewX,x,S),u(l.scaleX,l.scaleY,p.scaleX,p.scaleY,x,S),l=p=null,function(D){for(var Y=-1,Ee=S.length,Te;++Y<Ee;)x[(Te=S[Y]).i]=Te.x(D);return x.join("")}}}var sm=Hf(om,"px, ","px)","deg)"),fm=Hf(am,", ",")",")"),um=1e-12;function jf(t){return((t=Math.exp(t))+1/t)/2}function lm(t){return((t=Math.exp(t))-1/t)/2}function cm(t){return((t=Math.exp(2*t))-1)/(t+1)}const hm=function t(e,n,r){function i(o,s){var f=o[0],u=o[1],l=o[2],p=s[0],x=s[1],S=s[2],D=p-f,Y=x-u,Ee=D*D+Y*Y,Te,se;if(Ee<um)se=Math.log(S/l)/e,Te=function(Ge){return[f+Ge*D,u+Ge*Y,l*Math.exp(e*Ge*se)]};else{var Ue=Math.sqrt(Ee),He=(S*S-l*l+r*Ee)/(2*l*n*Ue),H=(S*S-l*l-r*Ee)/(2*S*n*Ue),fe=Math.log(Math.sqrt(He*He+1)-He),Re=Math.log(Math.sqrt(H*H+1)-H);se=(Re-fe)/e,Te=function(Ge){var Ye=Ge*se,at=jf(fe),ut=l/(n*Ue)*(at*cm(e*Ye+fe)-lm(fe));return[f+ut*D,u+ut*Y,l*at/jf(e*Ye+fe)]}}return Te.duration=se*1e3*e/Math.SQRT2,Te}return i.rho=function(o){var s=Math.max(.001,+o),f=s*s,u=f*f;return t(s,f,u)},i}(Math.SQRT2,2,4);function dm(t,e){var n,r;return function(){var i=bn(this,t),o=i.tween;if(o!==n){r=n=o;for(var s=0,f=r.length;s<f;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function mm(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=bn(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var f={name:e,value:n},u=0,l=i.length;u<l;++u)if(i[u].name===e){i[u]=f;break}u===l&&i.push(f)}o.tween=i}}function pm(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=ln(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===t)return s.value;return null}return this.each((e==null?dm:mm)(n,t,e))}function Ia(t,e,n){var r=t._id;return t.each(function(){var i=bn(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return ln(i,r).value[e]}}function Xf(t,e){var n;return(typeof e=="number"?hn:e instanceof Un?no:(n=Un(e))?(e=n,no):Uf)(t,e)}function vm(t){return function(){this.removeAttribute(t)}}function gm(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ym(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttribute(t);return s===i?null:s===r?o:o=e(r=s,n)}}function xm(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===r?o:o=e(r=s,n)}}function bm(t,e,n){var r,i,o;return function(){var s,f=n(this),u;return f==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=f+"",s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,f)))}}function _m(t,e,n){var r,i,o;return function(){var s,f=n(this),u;return f==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=f+"",s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,f)))}}function Sm(t,e){var n=Bi(t),r=n==="transform"?fm:Xf;return this.attrTween(t,typeof e=="function"?(n.local?_m:bm)(n,r,Ia(this,"attr."+t,e)):e==null?(n.local?gm:vm)(n):(n.local?xm:ym)(n,r,e))}function Tm(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function wm(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Am(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&wm(t,o)),n}return i._value=e,i}function Em(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Tm(t,o)),n}return i._value=e,i}function Pm(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Bi(t);return this.tween(n,(r.local?Am:Em)(r,e))}function Cm(t,e){return function(){wa(this,t).delay=+e.apply(this,arguments)}}function km(t,e){return e=+e,function(){wa(this,t).delay=e}}function Lm(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Cm:km)(e,t)):ln(this.node(),e).delay}function Fm(t,e){return function(){bn(this,t).duration=+e.apply(this,arguments)}}function Rm(t,e){return e=+e,function(){bn(this,t).duration=e}}function Im(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Fm:Rm)(e,t)):ln(this.node(),e).duration}function Dm(t,e){if(typeof e!="function")throw new Error;return function(){bn(this,t).ease=e}}function zm(t){var e=this._id;return arguments.length?this.each(Dm(e,t)):ln(this.node(),e).ease}function Om(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;bn(this,t).ease=n}}function Mm(t){if(typeof t!="function")throw new Error;return this.each(Om(this._id,t))}function Nm(t){typeof t!="function"&&(t=cf(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,f=r[i]=[],u,l=0;l<s;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&f.push(u);return new Ln(r,this._parents,this._name,this._id)}function Gm(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),s=new Array(r),f=0;f<o;++f)for(var u=e[f],l=n[f],p=u.length,x=s[f]=new Array(p),S,D=0;D<p;++D)(S=u[D]||l[D])&&(x[D]=S);for(;f<r;++f)s[f]=e[f];return new Ln(s,this._parents,this._name,this._id)}function Bm(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Um(t,e,n){var r,i,o=Bm(e)?wa:bn;return function(){var s=o(this,t),f=s.on;f!==r&&(i=(r=f).copy()).on(e,n),s.on=i}}function Vm(t,e){var n=this._id;return arguments.length<2?ln(this.node(),n).on.on(t):this.each(Um(n,t,e))}function $m(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Hm(){return this.on("end.remove",$m(this._id))}function jm(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ya(t));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var f=r[s],u=f.length,l=o[s]=new Array(u),p,x,S=0;S<u;++S)(p=f[S])&&(x=t.call(p,p.__data__,S,f))&&("__data__"in p&&(x.__data__=p.__data__),l[S]=x,Zi(l[S],e,n,S,l,ln(p,n)));return new Ln(o,this._parents,e,n)}function Xm(t){var e=this._name,n=this._id;typeof t!="function"&&(t=lf(t));for(var r=this._groups,i=r.length,o=[],s=[],f=0;f<i;++f)for(var u=r[f],l=u.length,p,x=0;x<l;++x)if(p=u[x]){for(var S=t.call(p,p.__data__,x,u),D,Y=ln(p,n),Ee=0,Te=S.length;Ee<Te;++Ee)(D=S[Ee])&&Zi(D,e,n,Ee,S,Y);o.push(S),s.push(p)}return new Ln(o,s,e,n)}var Wm=ni.prototype.constructor;function qm(){return new Wm(this._groups,this._parents)}function Ym(t,e){var n,r,i;return function(){var o=Cr(this,t),s=(this.style.removeProperty(t),Cr(this,t));return o===s?null:o===n&&s===r?i:i=e(n=o,r=s)}}function Wf(t){return function(){this.style.removeProperty(t)}}function Zm(t,e,n){var r,i=n+"",o;return function(){var s=Cr(this,t);return s===i?null:s===r?o:o=e(r=s,n)}}function Qm(t,e,n){var r,i,o;return function(){var s=Cr(this,t),f=n(this),u=f+"";return f==null&&(u=f=(this.style.removeProperty(t),Cr(this,t))),s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,f))}}function Km(t,e){var n,r,i,o="style."+e,s="end."+o,f;return function(){var u=bn(this,t),l=u.on,p=u.value[o]==null?f||(f=Wf(e)):void 0;(l!==n||i!==p)&&(r=(n=l).copy()).on(s,i=p),u.on=r}}function Jm(t,e,n){var r=(t+="")=="transform"?sm:Xf;return e==null?this.styleTween(t,Ym(t,r)).on("end.style."+t,Wf(t)):typeof e=="function"?this.styleTween(t,Qm(t,r,Ia(this,"style."+t,e))).each(Km(this._id,t)):this.styleTween(t,Zm(t,r,e),n).on("end.style."+t,null)}function ep(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function tp(t,e,n){var r,i;function o(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&ep(t,s,n)),r}return o._value=e,o}function np(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,tp(t,e,n??""))}function rp(t){return function(){this.textContent=t}}function ip(t){return function(){var e=t(this);this.textContent=e??""}}function op(t){return this.tween("text",typeof t=="function"?ip(Ia(this,"text",t)):rp(t==null?"":t+""))}function ap(t){return function(e){this.textContent=t.call(this,e)}}function sp(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&ap(i)),e}return r._value=t,r}function fp(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,sp(t))}function up(){for(var t=this._name,e=this._id,n=qf(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],f=s.length,u,l=0;l<f;++l)if(u=s[l]){var p=ln(u,e);Zi(u,t,n,l,s,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Ln(r,this._parents,t,n)}function lp(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var f={value:s},u={value:function(){--i===0&&o()}};n.each(function(){var l=bn(this,r),p=l.on;p!==t&&(e=(t=p).copy(),e._.cancel.push(f),e._.interrupt.push(f),e._.end.push(u)),l.on=e}),i===0&&o()})}var cp=0;function Ln(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function qf(){return++cp}var Fn=ni.prototype;Ln.prototype={constructor:Ln,select:jm,selectAll:Xm,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:Nm,merge:Gm,selection:qm,transition:up,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:Vm,attr:Sm,attrTween:Pm,style:Jm,styleTween:np,text:op,textTween:fp,remove:Hm,tween:pm,delay:Lm,duration:Im,ease:zm,easeVarying:Mm,end:lp,[Symbol.iterator]:Fn[Symbol.iterator]};function hp(t){return t*t}function dp(t){return t*(2-t)}function mp(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function pp(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var vp={time:null,delay:0,duration:250,ease:pp};function gp(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function yp(t){var e,n;t instanceof Ln?(e=t._id,t=t._name):(e=qf(),(n=vp).time=ba(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],f=s.length,u,l=0;l<f;++l)(u=s[l])&&Zi(u,t,e,l,s,n||gp(u,e));return new Ln(r,this._parents,t,e)}ni.prototype.interrupt=zd,ni.prototype.transition=yp;function Da(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function xp(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var io={exports:{}},bp=io.exports,Yf;function _p(){return Yf||(Yf=1,function(t,e){(function(n,r){t.exports=r()})(bp,function(){var n=function(a){return a instanceof Uint8Array||a instanceof Uint16Array||a instanceof Uint32Array||a instanceof Int8Array||a instanceof Int16Array||a instanceof Int32Array||a instanceof Float32Array||a instanceof Float64Array||a instanceof Uint8ClampedArray},r=function(a,h){for(var _=Object.keys(h),O=0;O<_.length;++O)a[_[O]]=h[_[O]];return a},i=`
|
|
2
|
+
`;function o(a){return typeof atob<"u"?atob(a):"base64:"+a}function s(a){var h=new Error("(regl) "+a);throw console.error(h),h}function f(a,h){a||s(h)}function u(a){return a?": "+a:""}function l(a,h,_){a in h||s("unknown parameter ("+a+")"+u(_)+". possible values: "+Object.keys(h).join())}function p(a,h){n(a)||s("invalid parameter type"+u(h)+". must be a typed array")}function x(a,h){switch(h){case"number":return typeof a=="number";case"object":return typeof a=="object";case"string":return typeof a=="string";case"boolean":return typeof a=="boolean";case"function":return typeof a=="function";case"undefined":return typeof a>"u";case"symbol":return typeof a=="symbol"}}function S(a,h,_){x(a,h)||s("invalid parameter type"+u(_)+". expected "+h+", got "+typeof a)}function D(a,h){a>=0&&(a|0)===a||s("invalid parameter type, ("+a+")"+u(h)+". must be a nonnegative integer")}function Y(a,h,_){h.indexOf(a)<0&&s("invalid value"+u(_)+". must be one of: "+h)}var Ee=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function Te(a){Object.keys(a).forEach(function(h){Ee.indexOf(h)<0&&s('invalid regl constructor argument "'+h+'". must be one of '+Ee)})}function se(a,h){for(a=a+"";a.length<h;)a=" "+a;return a}function Ue(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function He(a,h){this.number=a,this.line=h,this.errors=[]}function H(a,h,_){this.file=a,this.line=h,this.message=_}function fe(){var a=new Error,h=(a.stack||a).toString(),_=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(h);if(_)return _[1];var O=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(h);return O?O[1]:"unknown"}function Re(){var a=new Error,h=(a.stack||a).toString(),_=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(h);if(_)return _[1];var O=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(h);return O?O[1]:"unknown"}function Ge(a,h){var _=a.split(`
|
|
3
3
|
`),O=1,j=0,z={unknown:new Ue,0:new Ue};z.unknown.name=z[0].name=h||fe(),z.unknown.lines.push(new He(0,""));for(var B=0;B<_.length;++B){var K=_[B],Q=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(K);if(Q)switch(Q[1]){case"line":var ie=/(\d+)(\s+\d+)?/.exec(Q[2]);ie&&(O=ie[1]|0,ie[2]&&(j=ie[2]|0,j in z||(z[j]=new Ue)));break;case"define":var ae=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Q[2]);ae&&(z[j].name=ae[1]?o(ae[2]):ae[2]);break}z[j].lines.push(new He(O++,K))}return Object.keys(z).forEach(function(oe){var le=z[oe];le.lines.forEach(function(J){le.index[J.number]=J})}),z}function Ye(a){var h=[];return a.split(`
|
|
4
4
|
`).forEach(function(_){if(!(_.length<5)){var O=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(_);O?h.push(new H(O[1]|0,O[2]|0,O[3].trim())):_.length>0&&h.push(new H("unknown",0,_))}}),h}function at(a,h){h.forEach(function(_){var O=a[_.file];if(O){var j=O.index[_.line];if(j){j.errors.push(_),O.hasErrors=!0;return}}a.unknown.hasErrors=!0,a.unknown.lines[0].errors.push(_)})}function ut(a,h,_,O,j){if(!a.getShaderParameter(h,a.COMPILE_STATUS)){var z=a.getShaderInfoLog(h),B=O===a.FRAGMENT_SHADER?"fragment":"vertex";ke(_,"string",B+" shader source must be a string",j);var K=Ge(_,j),Q=Ye(z);at(K,Q),Object.keys(K).forEach(function(ie){var ae=K[ie];if(!ae.hasErrors)return;var oe=[""],le=[""];function J(ne,k){oe.push(ne),le.push(k||"")}J("file number "+ie+": "+ae.name+`
|
|
5
|
-
`,"color:red;text-decoration:underline;font-weight:bold"),ae.lines.forEach(function(ne){if(ne.errors.length>0){J(se(ne.number,4)+"| ","background-color:yellow; font-weight:bold"),J(ne.line+i,"color:red; background-color:yellow; font-weight:bold");var k=0;ne.errors.forEach(function(G){var te=G.message,xe=/^\s*'(.*)'\s*:\s*(.*)$/.exec(te);if(xe){var Z=xe[1];switch(te=xe[2],Z){case"assign":Z="=";break}k=Math.max(ne.line.indexOf(Z,k),0)}else k=0;J(se("| ",6)),J(se("^^^",k+3)+i,"font-weight:bold"),J(se("| ",6)),J(te+i,"font-weight:bold")}),J(se("| ",6)+i)}else J(se(ne.number,4)+"| "),J(ne.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(le[0]=oe.join("%c"),console.log.apply(console,le)):console.log(oe.join(""))}),f.raise("Error compiling "+B+" shader, "+K[0].name)}}function Ae(a,h,_,O,j){if(!a.getProgramParameter(h,a.LINK_STATUS)){var z=a.getProgramInfoLog(h),B=Ge(_,j),K=Ge(O,j),Q='Error linking program with vertex shader, "'+K[0].name+'", and fragment shader "'+B[0].name+'"';typeof document<"u"?console.log("%c"+Q+i+"%c"+z,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Q+i+z),f.raise(Q)}}function lt(a){a._commandRef=fe()}function it(a,h,_,O){lt(a);function j(Q){return Q?O.id(Q):0}a._fragId=j(a.static.frag),a._vertId=j(a.static.vert);function z(Q,ie){Object.keys(ie).forEach(function(ae){Q[O.id(ae)]=!0})}var B=a._uniformSet={};z(B,h.static),z(B,h.dynamic);var K=a._attributeSet={};z(K,_.static),z(K,_.dynamic),a._hasCount="count"in a.static||"count"in a.dynamic||"elements"in a.static||"elements"in a.dynamic}function N(a,h){var _=Re();s(a+" in command "+(h||fe())+(_==="unknown"?"":" called from "+_))}function Ce(a,h,_){a||N(h,_||fe())}function re(a,h,_,O){a in h||N("unknown parameter ("+a+")"+u(_)+". possible values: "+Object.keys(h).join(),O||fe())}function ke(a,h,_,O){b(a,h)||N("invalid parameter type"+u(_)+". expected "+h+", got "+typeof a,O||fe())}function Xe(a){a()}function je(a,h,_){a.texture?Y(a.texture._texture.internalformat,h,"unsupported texture format for attachment"):Y(a.renderbuffer._renderbuffer.format,_,"unsupported renderbuffer format for attachment")}var Qe=33071,Ze=9728,dt=9984,ct=9985,_t=9986,st=9987,$t=5120,Ht=5121,Qt=5122,zn=5123,wo=5124,Ao=5125,On=5126,sr=32819,Tn=32820,Ir=33635,Dr=34042,$n=36193,zt={};zt[$t]=zt[Ht]=1,zt[Qt]=zt[zn]=zt[$n]=zt[Ir]=zt[sr]=zt[Tn]=2,zt[wo]=zt[Ao]=zt[On]=zt[Dr]=4;function fr(a,h){return a===Tn||a===sr||a===Ir?2:a===Dr?4:zt[a]*h}function ur(a){return!(a&a-1)&&!!a}function Eo(a,h,_){var O,j=h.width,z=h.height,B=h.channels;f(j>0&&j<=_.maxTextureSize&&z>0&&z<=_.maxTextureSize,"invalid texture shape"),(a.wrapS!==Qe||a.wrapT!==Qe)&&f(ur(j)&&ur(z),"incompatible wrap mode for texture, both width and height must be power of 2"),h.mipmask===1?j!==1&&z!==1&&f(a.minFilter!==dt&&a.minFilter!==_t&&a.minFilter!==ct&&a.minFilter!==st,"min filter requires mipmap"):(f(ur(j)&&ur(z),"texture must be a square power of 2 to support mipmapping"),f(h.mipmask===(j<<1)-1,"missing or incomplete mipmap data")),h.type===On&&(_.extensions.indexOf("oes_texture_float_linear")<0&&f(a.minFilter===Ze&&a.magFilter===Ze,"filter not supported, must enable oes_texture_float_linear"),f(!a.genMipmaps,"mipmap generation not supported with float textures"));var K=h.images;for(O=0;O<16;++O)if(K[O]){var Q=j>>O,ie=z>>O;f(h.mipmask&1<<O,"missing mipmap data");var ae=K[O];if(f(ae.width===Q&&ae.height===ie,"invalid shape for mip images"),f(ae.format===h.format&&ae.internalformat===h.internalformat&&ae.type===h.type,"incompatible type for mip image"),!ae.compressed)if(ae.data){var oe=Math.ceil(fr(ae.type,B)*Q/ae.unpackAlignment)*ae.unpackAlignment;f(ae.data.byteLength===oe*ie,"invalid data for image, buffer size is inconsistent with image format")}else ae.element||ae.copy}else a.genMipmaps||f((h.mipmask&1<<O)===0,"extra mipmap data");h.compressed&&f(!a.genMipmaps,"mipmap generation for compressed images not supported")}function as(a,h,_,O){var j=a.width,z=a.height,B=a.channels;f(j>0&&j<=O.maxTextureSize&&z>0&&z<=O.maxTextureSize,"invalid texture shape"),f(j===z,"cube map must be square"),f(h.wrapS===Qe&&h.wrapT===Qe,"wrap mode not supported by cube map");for(var K=0;K<_.length;++K){var Q=_[K];f(Q.width===j&&Q.height===z,"inconsistent cube map face shape"),h.genMipmaps&&(f(!Q.compressed,"can not generate mipmap for compressed textures"),f(Q.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var ie=Q.images,ae=0;ae<16;++ae){var oe=ie[ae];if(oe){var le=j>>ae,J=z>>ae;f(Q.mipmask&1<<ae,"missing mipmap data"),f(oe.width===le&&oe.height===J,"invalid shape for mip images"),f(oe.format===a.format&&oe.internalformat===a.internalformat&&oe.type===a.type,"incompatible type for mip image"),oe.compressed||(oe.data?f(oe.data.byteLength===le*J*Math.max(fr(oe.type,B),oe.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):oe.element||oe.copy)}}}}var d=r(f,{optional:Xe,raise:s,commandRaise:N,command:Ce,parameter:l,commandParameter:re,constructor:Te,type:S,commandType:ke,isTypedArray:v,nni:D,oneOf:Y,shaderError:ut,linkError:Ae,callSite:Re,saveCommandRef:lt,saveDrawInfo:it,framebufferFormat:je,guessCommand:fe,texture2D:Eo,textureCube:as}),lr=0,Hn=0,jn=5,Po=6;function wn(a,h){this.id=lr++,this.type=a,this.data=h}function yi(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Mn(a){if(a.length===0)return[];var h=a.charAt(0),_=a.charAt(a.length-1);if(a.length>1&&h===_&&(h==='"'||h==="'"))return['"'+yi(a.substr(1,a.length-2))+'"'];var O=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(a);if(O)return Mn(a.substr(0,O.index)).concat(Mn(O[1])).concat(Mn(a.substr(O.index+O[0].length)));var j=a.split(".");if(j.length===1)return['"'+yi(a)+'"'];for(var z=[],B=0;B<j.length;++B)z=z.concat(Mn(j[B]));return z}function xi(a){return"["+Mn(a).join("][")+"]"}function zr(a,h){return new wn(a,xi(h+""))}function Or(a){return typeof a=="function"&&!a._reglType||a instanceof wn}function an(a,h){if(typeof a=="function")return new wn(Hn,a);if(typeof a=="number"||typeof a=="boolean")return new wn(jn,a);if(Array.isArray(a))return new wn(Po,a.map(function(_,O){return an(_,h+"["+O+"]")}));if(a instanceof wn)return a;d(!1,"invalid option type in uniform "+h)}var Lt={DynamicVariable:wn,define:zr,isDynamic:Or,unbox:an,accessor:xi},cr={next:typeof requestAnimationFrame=="function"?function(a){return requestAnimationFrame(a)}:function(a){return setTimeout(a,16)},cancel:typeof cancelAnimationFrame=="function"?function(a){return cancelAnimationFrame(a)}:clearTimeout},Mr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function ss(){var a={"":0},h=[""];return{id:function(_){var O=a[_];return O||(O=a[_]=h.length,h.push(_),O)},str:function(_){return h[_]}}}function Nr(a,h,_){var O=document.createElement("canvas");r(O.style,{border:0,margin:0,padding:0,top:0,left:0,width:"100%",height:"100%"}),a.appendChild(O),a===document.body&&(O.style.position="absolute",r(a.style,{margin:0,padding:0}));function j(){var K=window.innerWidth,Q=window.innerHeight;if(a!==document.body){var ie=O.getBoundingClientRect();K=ie.right-ie.left,Q=ie.bottom-ie.top}O.width=_*K,O.height=_*Q}var z;a!==document.body&&typeof ResizeObserver=="function"?(z=new ResizeObserver(function(){setTimeout(j)}),z.observe(a)):window.addEventListener("resize",j,!1);function B(){z?z.disconnect():window.removeEventListener("resize",j),a.removeChild(O)}return j(),{canvas:O,onDestroy:B}}function Gr(a,h){function _(O){try{return a.getContext(O,h)}catch{return null}}return _("webgl")||_("experimental-webgl")||_("webgl-experimental")}function fs(a){return typeof a.nodeName=="string"&&typeof a.appendChild=="function"&&typeof a.getBoundingClientRect=="function"}function hr(a){return typeof a.drawArrays=="function"||typeof a.drawElements=="function"}function Co(a){return typeof a=="string"?a.split():(d(Array.isArray(a),"invalid extension array"),a)}function ko(a){return typeof a=="string"?(d(typeof document<"u","not supported outside of DOM"),document.querySelector(a)):a}function Ft(a){var h=a||{},_,O,j,z,B={},K=[],Q=[],ie=typeof window>"u"?1:window.devicePixelRatio,ae=!1,oe=function(ne){ne&&d.raise(ne)},le=function(){};if(typeof h=="string"?(d(typeof document<"u","selector queries only supported in DOM enviroments"),_=document.querySelector(h),d(_,"invalid query string for element")):typeof h=="object"?fs(h)?_=h:hr(h)?(z=h,j=z.canvas):(d.constructor(h),"gl"in h?z=h.gl:"canvas"in h?j=ko(h.canvas):"container"in h&&(O=ko(h.container)),"attributes"in h&&(B=h.attributes,d.type(B,"object","invalid context attributes")),"extensions"in h&&(K=Co(h.extensions)),"optionalExtensions"in h&&(Q=Co(h.optionalExtensions)),"onDone"in h&&(d.type(h.onDone,"function","invalid or missing onDone callback"),oe=h.onDone),"profile"in h&&(ae=!!h.profile),"pixelRatio"in h&&(ie=+h.pixelRatio,d(ie>0,"invalid pixel ratio"))):d.raise("invalid arguments to regl"),_&&(_.nodeName.toLowerCase()==="canvas"?j=_:O=_),!z){if(!j){d(typeof document<"u","must manually specify webgl context outside of DOM environments");var J=Nr(O||document.body,oe,ie);if(!J)return null;j=J.canvas,le=J.onDestroy}B.premultipliedAlpha===void 0&&(B.premultipliedAlpha=!0),z=Gr(j,B)}return z?{gl:z,canvas:j,container:O,extensions:K,optionalExtensions:Q,pixelRatio:ie,profile:ae,onDone:oe,onDestroy:le}:(le(),oe("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Xn(a,h){var _={};function O(B){d.type(B,"string","extension name must be string");var K=B.toLowerCase(),Q;try{Q=_[K]=a.getExtension(K)}catch{}return!!Q}for(var j=0;j<h.extensions.length;++j){var z=h.extensions[j];if(!O(z))return h.onDestroy(),h.onDone('"'+z+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return h.optionalExtensions.forEach(O),{extensions:_,restore:function(){Object.keys(_).forEach(function(B){if(_[B]&&!O(B))throw new Error("(regl): error restoring extension "+B)})}}}function Yt(a,h){for(var _=Array(a),O=0;O<a;++O)_[O]=h(O);return _}var Lo=5120,bi=5121,Fo=5122,Ro=5123,us=5124,sn=5125,Wn=5126;function Io(a){for(var h=16;h<=1<<28;h*=16)if(a<=h)return h;return 0}function _i(a){var h,_;return h=(a>65535)<<4,a>>>=h,_=(a>255)<<3,a>>>=_,h|=_,_=(a>15)<<2,a>>>=_,h|=_,_=(a>3)<<1,a>>>=_,h|=_,h|a>>1}function Br(){var a=Yt(8,function(){return[]});function h(z){var B=Io(z),K=a[_i(B)>>2];return K.length>0?K.pop():new ArrayBuffer(B)}function _(z){a[_i(z.byteLength)>>2].push(z)}function O(z,B){var K=null;switch(z){case Lo:K=new Int8Array(h(B),0,B);break;case bi:K=new Uint8Array(h(B),0,B);break;case Fo:K=new Int16Array(h(2*B),0,B);break;case Ro:K=new Uint16Array(h(2*B),0,B);break;case us:K=new Int32Array(h(4*B),0,B);break;case sn:K=new Uint32Array(h(4*B),0,B);break;case Wn:K=new Float32Array(h(4*B),0,B);break;default:return null}return K.length!==B?K.subarray(0,B):K}function j(z){_(z.buffer)}return{alloc:h,free:_,allocType:O,freeType:j}}var gt=Br();gt.zero=Br();var vn=3408,Do=3410,zo=3411,Oo=3412,Mo=3413,ls=3414,Be=3415,C=33901,ve=33902,De=3379,mt=3386,Ot=34921,At=36347,jt=36348,gn=35661,dr=35660,Si=34930,Mt=36349,No=34076,Go=34024,Pg=7936,Cg=7937,kg=7938,Lg=35724,Fg=34047,Rg=36063,Ig=34852,Bo=3553,nl=34067,Dg=34069,zg=33984,Ti=6408,cs=5126,rl=5121,hs=36160,Og=36053,Mg=36064,Ng=16384,Gg=function(a,h){var _=1;h.ext_texture_filter_anisotropic&&(_=a.getParameter(Fg));var O=1,j=1;h.webgl_draw_buffers&&(O=a.getParameter(Ig),j=a.getParameter(Rg));var z=!!h.oes_texture_float;if(z){var B=a.createTexture();a.bindTexture(Bo,B),a.texImage2D(Bo,0,Ti,1,1,0,Ti,cs,null);var K=a.createFramebuffer();if(a.bindFramebuffer(hs,K),a.framebufferTexture2D(hs,Mg,Bo,B,0),a.bindTexture(Bo,null),a.checkFramebufferStatus(hs)!==Og)z=!1;else{a.viewport(0,0,1,1),a.clearColor(1,0,0,1),a.clear(Ng);var Q=gt.allocType(cs,4);a.readPixels(0,0,1,1,Ti,cs,Q),a.getError()?z=!1:(a.deleteFramebuffer(K),a.deleteTexture(B),z=Q[0]===1),gt.freeType(Q)}}var ie=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),ae=!0;if(!ie){var oe=a.createTexture(),le=gt.allocType(rl,36);a.activeTexture(zg),a.bindTexture(nl,oe),a.texImage2D(Dg,0,Ti,3,3,0,Ti,rl,le),gt.freeType(le),a.bindTexture(nl,null),a.deleteTexture(oe),ae=!a.getError()}return{colorBits:[a.getParameter(Do),a.getParameter(zo),a.getParameter(Oo),a.getParameter(Mo)],depthBits:a.getParameter(ls),stencilBits:a.getParameter(Be),subpixelBits:a.getParameter(vn),extensions:Object.keys(h).filter(function(J){return!!h[J]}),maxAnisotropic:_,maxDrawbuffers:O,maxColorAttachments:j,pointSizeDims:a.getParameter(C),lineWidthDims:a.getParameter(ve),maxViewportDims:a.getParameter(mt),maxCombinedTextureUnits:a.getParameter(gn),maxCubeMapSize:a.getParameter(No),maxRenderbufferSize:a.getParameter(Go),maxTextureUnits:a.getParameter(Si),maxTextureSize:a.getParameter(De),maxAttributes:a.getParameter(Ot),maxVertexUniforms:a.getParameter(At),maxVertexTextureUnits:a.getParameter(dr),maxVaryingVectors:a.getParameter(jt),maxFragmentUniforms:a.getParameter(Mt),glsl:a.getParameter(Lg),renderer:a.getParameter(Cg),vendor:a.getParameter(Pg),version:a.getParameter(kg),readFloat:z,npotTextureCube:ae}};function yn(a){return!!a&&typeof a=="object"&&Array.isArray(a.shape)&&Array.isArray(a.stride)&&typeof a.offset=="number"&&a.shape.length===a.stride.length&&(Array.isArray(a.data)||n(a.data))}var nn=function(a){return Object.keys(a).map(function(h){return a[h]})},Uo={shape:$g,flatten:Vg};function Bg(a,h,_){for(var O=0;O<h;++O)_[O]=a[O]}function Ug(a,h,_,O){for(var j=0,z=0;z<h;++z)for(var B=a[z],K=0;K<_;++K)O[j++]=B[K]}function il(a,h,_,O,j,z){for(var B=z,K=0;K<h;++K)for(var Q=a[K],ie=0;ie<_;++ie)for(var ae=Q[ie],oe=0;oe<O;++oe)j[B++]=ae[oe]}function ol(a,h,_,O,j){for(var z=1,B=_+1;B<h.length;++B)z*=h[B];var K=h[_];if(h.length-_===4){var Q=h[_+1],ie=h[_+2],ae=h[_+3];for(B=0;B<K;++B)il(a[B],Q,ie,ae,O,j),j+=z}else for(B=0;B<K;++B)ol(a[B],h,_+1,O,j),j+=z}function Vg(a,h,_,O){var j=1;if(h.length)for(var z=0;z<h.length;++z)j*=h[z];else j=0;var B=O||gt.allocType(_,j);switch(h.length){case 0:break;case 1:Bg(a,h[0],B);break;case 2:Ug(a,h[0],h[1],B);break;case 3:il(a,h[0],h[1],h[2],B,0);break;default:ol(a,h,0,B,0)}return B}function $g(a){for(var h=[],_=a;_.length;_=_[0])h.push(_.length);return h}var ds={"[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},Hg=5120,jg=5122,Xg=5124,Wg=5121,qg=5123,Yg=5125,Zg=5126,Qg=5126,mr={int8:Hg,int16:jg,int32:Xg,uint8:Wg,uint16:qg,uint32:Yg,float:Zg,float32:Qg},Kg=35048,Jg=35040,Vo={dynamic:Kg,stream:Jg,static:35044},ms=Uo.flatten,al=Uo.shape,sl=35044,ey=35040,ps=5121,vs=5126,qn=[];qn[5120]=1,qn[5122]=2,qn[5124]=4,qn[5121]=1,qn[5123]=2,qn[5125]=4,qn[5126]=4;function $o(a){return ds[Object.prototype.toString.call(a)]|0}function fl(a,h){for(var _=0;_<h.length;++_)a[_]=h[_]}function ul(a,h,_,O,j,z,B){for(var K=0,Q=0;Q<_;++Q)for(var ie=0;ie<O;++ie)a[K++]=h[j*Q+z*ie+B]}function ty(a,h,_,O){var j=0,z={};function B(k){this.id=j++,this.buffer=a.createBuffer(),this.type=k,this.usage=sl,this.byteLength=0,this.dimension=1,this.dtype=ps,this.persistentData=null,_.profile&&(this.stats={size:0})}B.prototype.bind=function(){a.bindBuffer(this.type,this.buffer)},B.prototype.destroy=function(){le(this)};var K=[];function Q(k,G){var te=K.pop();return te||(te=new B(k)),te.bind(),oe(te,G,ey,0,1,!1),te}function ie(k){K.push(k)}function ae(k,G,te){k.byteLength=G.byteLength,a.bufferData(k.type,G,te)}function oe(k,G,te,xe,Z,ge){var me;if(k.usage=te,Array.isArray(G)){if(k.dtype=xe||vs,G.length>0){var Fe;if(Array.isArray(G[0])){me=al(G);for(var X=1,$=1;$<me.length;++$)X*=me[$];k.dimension=X,Fe=ms(G,me,k.dtype),ae(k,Fe,te),ge?k.persistentData=Fe:gt.freeType(Fe)}else if(typeof G[0]=="number"){k.dimension=Z;var Se=gt.allocType(k.dtype,G.length);fl(Se,G),ae(k,Se,te),ge?k.persistentData=Se:gt.freeType(Se)}else n(G[0])?(k.dimension=G[0].length,k.dtype=xe||$o(G[0])||vs,Fe=ms(G,[G.length,G[0].length],k.dtype),ae(k,Fe,te),ge?k.persistentData=Fe:gt.freeType(Fe)):d.raise("invalid buffer data")}}else if(n(G))k.dtype=xe||$o(G),k.dimension=Z,ae(k,G,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(G.buffer)));else if(yn(G)){me=G.shape;var ce=G.stride,ee=G.offset,he=0,de=0,Ve=0,Ne=0;me.length===1?(he=me[0],de=1,Ve=ce[0],Ne=0):me.length===2?(he=me[0],de=me[1],Ve=ce[0],Ne=ce[1]):d.raise("invalid shape"),k.dtype=xe||$o(G.data)||vs,k.dimension=de;var pe=gt.allocType(k.dtype,he*de);ul(pe,G.data,he,de,Ve,Ne,ee),ae(k,pe,te),ge?k.persistentData=pe:gt.freeType(pe)}else G instanceof ArrayBuffer?(k.dtype=ps,k.dimension=Z,ae(k,G,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(G)))):d.raise("invalid buffer data")}function le(k){h.bufferCount--,O(k);var G=k.buffer;d(G,"buffer must not be deleted already"),a.deleteBuffer(G),k.buffer=null,delete z[k.id]}function J(k,G,te,xe){h.bufferCount++;var Z=new B(G);z[Z.id]=Z;function ge(X){var $=sl,Se=null,ce=0,ee=0,he=1;return Array.isArray(X)||n(X)||yn(X)||X instanceof ArrayBuffer?Se=X:typeof X=="number"?ce=X|0:X&&(d.type(X,"object","buffer arguments must be an object, a number or an array"),"data"in X&&(d(Se===null||Array.isArray(Se)||n(Se)||yn(Se),"invalid data for buffer"),Se=X.data),"usage"in X&&(d.parameter(X.usage,Vo,"invalid buffer usage"),$=Vo[X.usage]),"type"in X&&(d.parameter(X.type,mr,"invalid buffer type"),ee=mr[X.type]),"dimension"in X&&(d.type(X.dimension,"number","invalid dimension"),he=X.dimension|0),"length"in X&&(d.nni(ce,"buffer length must be a nonnegative integer"),ce=X.length|0)),Z.bind(),Se?oe(Z,Se,$,ee,he,xe):(ce&&a.bufferData(Z.type,ce,$),Z.dtype=ee||ps,Z.usage=$,Z.dimension=he,Z.byteLength=ce),_.profile&&(Z.stats.size=Z.byteLength*qn[Z.dtype]),ge}function me(X,$){d($+X.byteLength<=Z.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+X.byteLength+" starting from offset "+$+" to a buffer of size "+Z.byteLength),a.bufferSubData(Z.type,$,X)}function Fe(X,$){var Se=($||0)|0,ce;if(Z.bind(),n(X)||X instanceof ArrayBuffer)me(X,Se);else if(Array.isArray(X)){if(X.length>0)if(typeof X[0]=="number"){var ee=gt.allocType(Z.dtype,X.length);fl(ee,X),me(ee,Se),gt.freeType(ee)}else if(Array.isArray(X[0])||n(X[0])){ce=al(X);var he=ms(X,ce,Z.dtype);me(he,Se),gt.freeType(he)}else d.raise("invalid buffer data")}else if(yn(X)){ce=X.shape;var de=X.stride,Ve=0,Ne=0,pe=0,ye=0;ce.length===1?(Ve=ce[0],Ne=1,pe=de[0],ye=0):ce.length===2?(Ve=ce[0],Ne=ce[1],pe=de[0],ye=de[1]):d.raise("invalid shape");var ze=Array.isArray(X.data)?Z.dtype:$o(X.data),$e=gt.allocType(ze,Ve*Ne);ul($e,X.data,Ve,Ne,pe,ye,X.offset),me($e,Se),gt.freeType($e)}else d.raise("invalid data for buffer subdata");return ge}return te||ge(k),ge._reglType="buffer",ge._buffer=Z,ge.subdata=Fe,_.profile&&(ge.stats=Z.stats),ge.destroy=function(){le(Z)},ge}function ne(){nn(z).forEach(function(k){k.buffer=a.createBuffer(),a.bindBuffer(k.type,k.buffer),a.bufferData(k.type,k.persistentData||k.byteLength,k.usage)})}return _.profile&&(h.getTotalBufferSize=function(){var k=0;return Object.keys(z).forEach(function(G){k+=z[G].stats.size}),k}),{create:J,createStream:Q,destroyStream:ie,clear:function(){nn(z).forEach(le),K.forEach(le)},getBuffer:function(k){return k&&k._buffer instanceof B?k._buffer:null},restore:ne,_initBuffer:oe}}var ny=0,ry=0,iy=1,oy=1,ay=4,sy=4,Yn={points:ny,point:ry,lines:iy,line:oy,triangles:ay,triangle:sy,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},fy=0,uy=1,wi=4,ly=5120,Ur=5121,ll=5122,Vr=5123,cl=5124,pr=5125,gs=34963,cy=35040,hy=35044;function dy(a,h,_,O){var j={},z=0,B={uint8:Ur,uint16:Vr};h.oes_element_index_uint&&(B.uint32=pr);function K(ne){this.id=z++,j[this.id]=this,this.buffer=ne,this.primType=wi,this.vertCount=0,this.type=0}K.prototype.bind=function(){this.buffer.bind()};var Q=[];function ie(ne){var k=Q.pop();return k||(k=new K(_.create(null,gs,!0,!1)._buffer)),oe(k,ne,cy,-1,-1,0,0),k}function ae(ne){Q.push(ne)}function oe(ne,k,G,te,xe,Z,ge){ne.buffer.bind();var me;if(k){var Fe=ge;!ge&&(!n(k)||yn(k)&&!n(k.data))&&(Fe=h.oes_element_index_uint?pr:Vr),_._initBuffer(ne.buffer,k,G,Fe,3)}else a.bufferData(gs,Z,G),ne.buffer.dtype=me||Ur,ne.buffer.usage=G,ne.buffer.dimension=3,ne.buffer.byteLength=Z;if(me=ge,!ge){switch(ne.buffer.dtype){case Ur:case ly:me=Ur;break;case Vr:case ll:me=Vr;break;case pr:case cl:me=pr;break;default:d.raise("unsupported type for element array")}ne.buffer.dtype=me}ne.type=me,d(me!==pr||!!h.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var X=xe;X<0&&(X=ne.buffer.byteLength,me===Vr?X>>=1:me===pr&&(X>>=2)),ne.vertCount=X;var $=te;if(te<0){$=wi;var Se=ne.buffer.dimension;Se===1&&($=fy),Se===2&&($=uy),Se===3&&($=wi)}ne.primType=$}function le(ne){O.elementsCount--,d(ne.buffer!==null,"must not double destroy elements"),delete j[ne.id],ne.buffer.destroy(),ne.buffer=null}function J(ne,k){var G=_.create(null,gs,!0),te=new K(G._buffer);O.elementsCount++;function xe(Z){if(!Z)G(),te.primType=wi,te.vertCount=0,te.type=Ur;else if(typeof Z=="number")G(Z),te.primType=wi,te.vertCount=Z|0,te.type=Ur;else{var ge=null,me=hy,Fe=-1,X=-1,$=0,Se=0;Array.isArray(Z)||n(Z)||yn(Z)?ge=Z:(d.type(Z,"object","invalid arguments for elements"),"data"in Z&&(ge=Z.data,d(Array.isArray(ge)||n(ge)||yn(ge),"invalid data for element buffer")),"usage"in Z&&(d.parameter(Z.usage,Vo,"invalid element buffer usage"),me=Vo[Z.usage]),"primitive"in Z&&(d.parameter(Z.primitive,Yn,"invalid element buffer primitive"),Fe=Yn[Z.primitive]),"count"in Z&&(d(typeof Z.count=="number"&&Z.count>=0,"invalid vertex count for elements"),X=Z.count|0),"type"in Z&&(d.parameter(Z.type,B,"invalid buffer type"),Se=B[Z.type]),"length"in Z?$=Z.length|0:($=X,Se===Vr||Se===ll?$*=2:(Se===pr||Se===cl)&&($*=4))),oe(te,ge,me,Fe,X,$,Se)}return xe}return xe(ne),xe._reglType="elements",xe._elements=te,xe.subdata=function(Z,ge){return G.subdata(Z,ge),xe},xe.destroy=function(){le(te)},xe}return{create:J,createStream:ie,destroyStream:ae,getElements:function(ne){return typeof ne=="function"&&ne._elements instanceof K?ne._elements:null},clear:function(){nn(j).forEach(le)}}}var hl=new Float32Array(1),my=new Uint32Array(hl.buffer),py=5123;function dl(a){for(var h=gt.allocType(py,a.length),_=0;_<a.length;++_)if(isNaN(a[_]))h[_]=65535;else if(a[_]===1/0)h[_]=31744;else if(a[_]===-1/0)h[_]=64512;else{hl[0]=a[_];var O=my[0],j=O>>>31<<15,z=(O<<1>>>24)-127,B=O>>13&1023;if(z<-24)h[_]=j;else if(z<-14){var K=-14-z;h[_]=j+(B+1024>>K)}else z>15?h[_]=j+31744:h[_]=j+(z+15<<10)+B}return h}function pt(a){return Array.isArray(a)||n(a)}var ml=function(a){return!(a&a-1)&&!!a},vy=34467,An=3553,ys=34067,Ho=34069,vr=6408,xs=6406,jo=6407,Ai=6409,Xo=6410,pl=32854,bs=32855,vl=36194,gy=32819,yy=32820,xy=33635,by=34042,_s=6402,Wo=34041,Ss=35904,Ts=35906,$r=36193,ws=33776,As=33777,Es=33778,Ps=33779,gl=35986,yl=35987,xl=34798,bl=35840,_l=35841,Sl=35842,Tl=35843,wl=36196,Hr=5121,Cs=5123,ks=5125,Ei=5126,_y=10242,Sy=10243,Ty=10497,Ls=33071,wy=33648,Ay=10240,Ey=10241,Fs=9728,Py=9729,Rs=9984,Al=9985,El=9986,Is=9987,Cy=33170,qo=4352,ky=4353,Ly=4354,Fy=34046,Ry=3317,Iy=37440,Dy=37441,zy=37443,Pl=37444,Pi=33984,Oy=[Rs,El,Al,Is],Yo=[0,Ai,Xo,jo,vr],fn={};fn[Ai]=fn[xs]=fn[_s]=1,fn[Wo]=fn[Xo]=2,fn[jo]=fn[Ss]=3,fn[vr]=fn[Ts]=4;function jr(a){return"[object "+a+"]"}var Cl=jr("HTMLCanvasElement"),kl=jr("OffscreenCanvas"),Ll=jr("CanvasRenderingContext2D"),Fl=jr("ImageBitmap"),Rl=jr("HTMLImageElement"),Il=jr("HTMLVideoElement"),My=Object.keys(ds).concat([Cl,kl,Ll,Fl,Rl,Il]),Xr=[];Xr[Hr]=1,Xr[Ei]=4,Xr[$r]=2,Xr[Cs]=2,Xr[ks]=4;var Nt=[];Nt[pl]=2,Nt[bs]=2,Nt[vl]=2,Nt[Wo]=4,Nt[ws]=.5,Nt[As]=.5,Nt[Es]=1,Nt[Ps]=1,Nt[gl]=.5,Nt[yl]=1,Nt[xl]=1,Nt[bl]=.5,Nt[_l]=.25,Nt[Sl]=.5,Nt[Tl]=.25,Nt[wl]=.5;function Dl(a){return Array.isArray(a)&&(a.length===0||typeof a[0]=="number")}function zl(a){if(!Array.isArray(a))return!1;var h=a.length;return!(h===0||!pt(a[0]))}function gr(a){return Object.prototype.toString.call(a)}function Ol(a){return gr(a)===Cl}function Ml(a){return gr(a)===kl}function Ny(a){return gr(a)===Ll}function Gy(a){return gr(a)===Fl}function By(a){return gr(a)===Rl}function Uy(a){return gr(a)===Il}function Ds(a){if(!a)return!1;var h=gr(a);return My.indexOf(h)>=0?!0:Dl(a)||zl(a)||yn(a)}function Nl(a){return ds[Object.prototype.toString.call(a)]|0}function Vy(a,h){var _=h.length;switch(a.type){case Hr:case Cs:case ks:case Ei:var O=gt.allocType(a.type,_);O.set(h),a.data=O;break;case $r:a.data=dl(h);break;default:d.raise("unsupported texture type, must specify a typed array")}}function Gl(a,h){return gt.allocType(a.type===$r?Ei:a.type,h)}function Bl(a,h){a.type===$r?(a.data=dl(h),gt.freeType(h)):a.data=h}function $y(a,h,_,O,j,z){for(var B=a.width,K=a.height,Q=a.channels,ie=B*K*Q,ae=Gl(a,ie),oe=0,le=0;le<K;++le)for(var J=0;J<B;++J)for(var ne=0;ne<Q;++ne)ae[oe++]=h[_*J+O*le+j*ne+z];Bl(a,ae)}function Zo(a,h,_,O,j,z){var B;if(typeof Nt[a]<"u"?B=Nt[a]:B=fn[a]*Xr[h],z&&(B*=6),j){for(var K=0,Q=_;Q>=1;)K+=B*Q*Q,Q/=2;return K}else return B*_*O}function Hy(a,h,_,O,j,z,B){var K={"don't care":qo,"dont care":qo,nice:Ly,fast:ky},Q={repeat:Ty,clamp:Ls,mirror:wy},ie={nearest:Fs,linear:Py},ae=r({mipmap:Is,"nearest mipmap nearest":Rs,"linear mipmap nearest":Al,"nearest mipmap linear":El,"linear mipmap linear":Is},ie),oe={none:0,browser:Pl},le={uint8:Hr,rgba4:gy,rgb565:xy,"rgb5 a1":yy},J={alpha:xs,luminance:Ai,"luminance alpha":Xo,rgb:jo,rgba:vr,rgba4:pl,"rgb5 a1":bs,rgb565:vl},ne={};h.ext_srgb&&(J.srgb=Ss,J.srgba=Ts),h.oes_texture_float&&(le.float32=le.float=Ei),h.oes_texture_half_float&&(le.float16=le["half float"]=$r),h.webgl_depth_texture&&(r(J,{depth:_s,"depth stencil":Wo}),r(le,{uint16:Cs,uint32:ks,"depth stencil":by})),h.webgl_compressed_texture_s3tc&&r(ne,{"rgb s3tc dxt1":ws,"rgba s3tc dxt1":As,"rgba s3tc dxt3":Es,"rgba s3tc dxt5":Ps}),h.webgl_compressed_texture_atc&&r(ne,{"rgb atc":gl,"rgba atc explicit alpha":yl,"rgba atc interpolated alpha":xl}),h.webgl_compressed_texture_pvrtc&&r(ne,{"rgb pvrtc 4bppv1":bl,"rgb pvrtc 2bppv1":_l,"rgba pvrtc 4bppv1":Sl,"rgba pvrtc 2bppv1":Tl}),h.webgl_compressed_texture_etc1&&(ne["rgb etc1"]=wl);var k=Array.prototype.slice.call(a.getParameter(vy));Object.keys(ne).forEach(function(y){var M=ne[y];k.indexOf(M)>=0&&(J[y]=M)});var G=Object.keys(J);_.textureFormats=G;var te=[];Object.keys(J).forEach(function(y){var M=J[y];te[M]=y});var xe=[];Object.keys(le).forEach(function(y){var M=le[y];xe[M]=y});var Z=[];Object.keys(ie).forEach(function(y){var M=ie[y];Z[M]=y});var ge=[];Object.keys(ae).forEach(function(y){var M=ae[y];ge[M]=y});var me=[];Object.keys(Q).forEach(function(y){var M=Q[y];me[M]=y});var Fe=G.reduce(function(y,M){var I=J[M];return I===Ai||I===xs||I===Ai||I===Xo||I===_s||I===Wo||h.ext_srgb&&(I===Ss||I===Ts)?y[I]=I:I===bs||M.indexOf("rgba")>=0?y[I]=vr:y[I]=jo,y},{});function X(){this.internalformat=vr,this.format=vr,this.type=Hr,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Pl,this.width=0,this.height=0,this.channels=0}function $(y,M){y.internalformat=M.internalformat,y.format=M.format,y.type=M.type,y.compressed=M.compressed,y.premultiplyAlpha=M.premultiplyAlpha,y.flipY=M.flipY,y.unpackAlignment=M.unpackAlignment,y.colorSpace=M.colorSpace,y.width=M.width,y.height=M.height,y.channels=M.channels}function Se(y,M){if(!(typeof M!="object"||!M)){if("premultiplyAlpha"in M&&(d.type(M.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),y.premultiplyAlpha=M.premultiplyAlpha),"flipY"in M&&(d.type(M.flipY,"boolean","invalid texture flip"),y.flipY=M.flipY),"alignment"in M&&(d.oneOf(M.alignment,[1,2,4,8],"invalid texture unpack alignment"),y.unpackAlignment=M.alignment),"colorSpace"in M&&(d.parameter(M.colorSpace,oe,"invalid colorSpace"),y.colorSpace=oe[M.colorSpace]),"type"in M){var I=M.type;d(h.oes_texture_float||!(I==="float"||I==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),d(h.oes_texture_half_float||!(I==="half float"||I==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),d(h.webgl_depth_texture||!(I==="uint16"||I==="uint32"||I==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),d.parameter(I,le,"invalid texture type"),y.type=le[I]}var _e=y.width,Ke=y.height,m=y.channels,c=!1;"shape"in M?(d(Array.isArray(M.shape)&&M.shape.length>=2,"shape must be an array"),_e=M.shape[0],Ke=M.shape[1],M.shape.length===3&&(m=M.shape[2],d(m>0&&m<=4,"invalid number of channels"),c=!0),d(_e>=0&&_e<=_.maxTextureSize,"invalid width"),d(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")):("radius"in M&&(_e=Ke=M.radius,d(_e>=0&&_e<=_.maxTextureSize,"invalid radius")),"width"in M&&(_e=M.width,d(_e>=0&&_e<=_.maxTextureSize,"invalid width")),"height"in M&&(Ke=M.height,d(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")),"channels"in M&&(m=M.channels,d(m>0&&m<=4,"invalid number of channels"),c=!0)),y.width=_e|0,y.height=Ke|0,y.channels=m|0;var T=!1;if("format"in M){var P=M.format;d(h.webgl_depth_texture||!(P==="depth"||P==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),d.parameter(P,J,"invalid texture format");var L=y.internalformat=J[P];y.format=Fe[L],P in le&&("type"in M||(y.type=le[P])),P in ne&&(y.compressed=!0),T=!0}!c&&T?y.channels=fn[y.format]:c&&!T?y.channels!==Yo[y.format]&&(y.format=y.internalformat=Yo[y.channels]):T&&c&&d(y.channels===fn[y.format],"number of channels inconsistent with specified format")}}function ce(y){a.pixelStorei(Iy,y.flipY),a.pixelStorei(Dy,y.premultiplyAlpha),a.pixelStorei(zy,y.colorSpace),a.pixelStorei(Ry,y.unpackAlignment)}function ee(){X.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function he(y,M){var I=null;if(Ds(M)?I=M:M&&(d.type(M,"object","invalid pixel data type"),Se(y,M),"x"in M&&(y.xOffset=M.x|0),"y"in M&&(y.yOffset=M.y|0),Ds(M.data)&&(I=M.data)),d(!y.compressed||I instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),M.copy){d(!I,"can not specify copy and data field for the same texture");var _e=j.viewportWidth,Ke=j.viewportHeight;y.width=y.width||_e-y.xOffset,y.height=y.height||Ke-y.yOffset,y.needsCopy=!0,d(y.xOffset>=0&&y.xOffset<_e&&y.yOffset>=0&&y.yOffset<Ke&&y.width>0&&y.width<=_e&&y.height>0&&y.height<=Ke,"copy texture read out of bounds")}else if(!I)y.width=y.width||1,y.height=y.height||1,y.channels=y.channels||4;else if(n(I))y.channels=y.channels||4,y.data=I,!("type"in M)&&y.type===Hr&&(y.type=Nl(I));else if(Dl(I))y.channels=y.channels||4,Vy(y,I),y.alignment=1,y.needsFree=!0;else if(yn(I)){var m=I.data;!Array.isArray(m)&&y.type===Hr&&(y.type=Nl(m));var c=I.shape,T=I.stride,P,L,A,w,E,p;c.length===3?(A=c[2],p=T[2]):(d(c.length===2,"invalid ndarray pixel data, must be 2 or 3D"),A=1,p=1),P=c[0],L=c[1],w=T[0],E=T[1],y.alignment=1,y.width=P,y.height=L,y.channels=A,y.format=y.internalformat=Yo[A],y.needsFree=!0,$y(y,m,w,E,p,I.offset)}else if(Ol(I)||Ml(I)||Ny(I))Ol(I)||Ml(I)?y.element=I:y.element=I.canvas,y.width=y.element.width,y.height=y.element.height,y.channels=4;else if(Gy(I))y.element=I,y.width=I.width,y.height=I.height,y.channels=4;else if(By(I))y.element=I,y.width=I.naturalWidth,y.height=I.naturalHeight,y.channels=4;else if(Uy(I))y.element=I,y.width=I.videoWidth,y.height=I.videoHeight,y.channels=4;else if(zl(I)){var x=y.width||I[0].length,g=y.height||I.length,R=y.channels;pt(I[0][0])?R=R||I[0][0].length:R=R||1;for(var F=Uo.shape(I),V=1,W=0;W<F.length;++W)V*=F[W];var ue=Gl(y,V);Uo.flatten(I,F,"",ue),Bl(y,ue),y.alignment=1,y.width=x,y.height=g,y.channels=R,y.format=y.internalformat=Yo[R],y.needsFree=!0}y.type===Ei?d(_.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):y.type===$r&&d(_.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function de(y,M,I){var _e=y.element,Ke=y.data,m=y.internalformat,c=y.format,T=y.type,P=y.width,L=y.height;ce(y),_e?a.texImage2D(M,I,c,c,T,_e):y.compressed?a.compressedTexImage2D(M,I,m,P,L,0,Ke):y.needsCopy?(O(),a.copyTexImage2D(M,I,c,y.xOffset,y.yOffset,P,L,0)):a.texImage2D(M,I,c,P,L,0,c,T,Ke||null)}function Ve(y,M,I,_e,Ke){var m=y.element,c=y.data,T=y.internalformat,P=y.format,L=y.type,A=y.width,w=y.height;ce(y),m?a.texSubImage2D(M,Ke,I,_e,P,L,m):y.compressed?a.compressedTexSubImage2D(M,Ke,I,_e,T,A,w,c):y.needsCopy?(O(),a.copyTexSubImage2D(M,Ke,I,_e,y.xOffset,y.yOffset,A,w)):a.texSubImage2D(M,Ke,I,_e,A,w,P,L,c)}var Ne=[];function pe(){return Ne.pop()||new ee}function ye(y){y.needsFree&>.freeType(y.data),ee.call(y),Ne.push(y)}function ze(){X.call(this),this.genMipmaps=!1,this.mipmapHint=qo,this.mipmask=0,this.images=Array(16)}function $e(y,M,I){var _e=y.images[0]=pe();y.mipmask=1,_e.width=y.width=M,_e.height=y.height=I,_e.channels=y.channels=4}function Je(y,M){var I=null;if(Ds(M))I=y.images[0]=pe(),$(I,y),he(I,M),y.mipmask=1;else if(Se(y,M),Array.isArray(M.mipmap))for(var _e=M.mipmap,Ke=0;Ke<_e.length;++Ke)I=y.images[Ke]=pe(),$(I,y),I.width>>=Ke,I.height>>=Ke,he(I,_e[Ke]),y.mipmask|=1<<Ke;else I=y.images[0]=pe(),$(I,y),he(I,M),y.mipmask=1;$(y,y.images[0]),y.compressed&&(y.internalformat===ws||y.internalformat===As||y.internalformat===Es||y.internalformat===Ps)&&d(y.width%4===0&&y.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function vt(y,M){for(var I=y.images,_e=0;_e<I.length;++_e){if(!I[_e])return;de(I[_e],M,_e)}}var yt=[];function tt(){var y=yt.pop()||new ze;X.call(y),y.mipmask=0;for(var M=0;M<16;++M)y.images[M]=null;return y}function Et(y){for(var M=y.images,I=0;I<M.length;++I)M[I]&&ye(M[I]),M[I]=null;yt.push(y)}function ht(){this.minFilter=Fs,this.magFilter=Fs,this.wrapS=Ls,this.wrapT=Ls,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=qo}function Tt(y,M){if("min"in M){var I=M.min;d.parameter(I,ae),y.minFilter=ae[I],Oy.indexOf(y.minFilter)>=0&&!("faces"in M)&&(y.genMipmaps=!0)}if("mag"in M){var _e=M.mag;d.parameter(_e,ie),y.magFilter=ie[_e]}var Ke=y.wrapS,m=y.wrapT;if("wrap"in M){var c=M.wrap;typeof c=="string"?(d.parameter(c,Q),Ke=m=Q[c]):Array.isArray(c)&&(d.parameter(c[0],Q),d.parameter(c[1],Q),Ke=Q[c[0]],m=Q[c[1]])}else{if("wrapS"in M){var T=M.wrapS;d.parameter(T,Q),Ke=Q[T]}if("wrapT"in M){var P=M.wrapT;d.parameter(P,Q),m=Q[P]}}if(y.wrapS=Ke,y.wrapT=m,"anisotropic"in M){var L=M.anisotropic;d(typeof L=="number"&&L>=1&&L<=_.maxAnisotropic,"aniso samples must be between 1 and "),y.anisotropic=M.anisotropic}if("mipmap"in M){var A=!1;switch(typeof M.mipmap){case"string":d.parameter(M.mipmap,K,"invalid mipmap hint"),y.mipmapHint=K[M.mipmap],y.genMipmaps=!0,A=!0;break;case"boolean":A=y.genMipmaps=M.mipmap;break;case"object":d(Array.isArray(M.mipmap),"invalid mipmap type"),y.genMipmaps=!1,A=!0;break;default:d.raise("invalid mipmap type")}A&&!("min"in M)&&(y.minFilter=Rs)}}function Pt(y,M){a.texParameteri(M,Ey,y.minFilter),a.texParameteri(M,Ay,y.magFilter),a.texParameteri(M,_y,y.wrapS),a.texParameteri(M,Sy,y.wrapT),h.ext_texture_filter_anisotropic&&a.texParameteri(M,Fy,y.anisotropic),y.genMipmaps&&(a.hint(Cy,y.mipmapHint),a.generateMipmap(M))}var Ct=0,It={},Gt=_.maxTextureUnits,xt=Array(Gt).map(function(){return null});function qe(y){X.call(this),this.mipmask=0,this.internalformat=vr,this.id=Ct++,this.refCount=1,this.target=y,this.texture=a.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new ht,B.profile&&(this.stats={size:0})}function Bt(y){a.activeTexture(Pi),a.bindTexture(y.target,y.texture)}function ot(){var y=xt[0];y?a.bindTexture(y.target,y.texture):a.bindTexture(An,null)}function Ie(y){var M=y.texture;d(M,"must not double destroy texture");var I=y.unit,_e=y.target;I>=0&&(a.activeTexture(Pi+I),a.bindTexture(_e,null),xt[I]=null),a.deleteTexture(M),y.texture=null,y.params=null,y.pixels=null,y.refCount=0,delete It[y.id],z.textureCount--}r(qe.prototype,{bind:function(){var y=this;y.bindCount+=1;var M=y.unit;if(M<0){for(var I=0;I<Gt;++I){var _e=xt[I];if(_e){if(_e.bindCount>0)continue;_e.unit=-1}xt[I]=y,M=I;break}M>=Gt&&d.raise("insufficient number of texture units"),B.profile&&z.maxTextureUnits<M+1&&(z.maxTextureUnits=M+1),y.unit=M,a.activeTexture(Pi+M),a.bindTexture(y.target,y.texture)}return M},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Ie(this)}});function et(y,M){var I=new qe(An);It[I.id]=I,z.textureCount++;function _e(c,T){var P=I.texInfo;ht.call(P);var L=tt();return typeof c=="number"?typeof T=="number"?$e(L,c|0,T|0):$e(L,c|0,c|0):c?(d.type(c,"object","invalid arguments to regl.texture"),Tt(P,c),Je(L,c)):$e(L,1,1),P.genMipmaps&&(L.mipmask=(L.width<<1)-1),I.mipmask=L.mipmask,$(I,L),d.texture2D(P,L,_),I.internalformat=L.internalformat,_e.width=L.width,_e.height=L.height,Bt(I),vt(L,An),Pt(P,An),ot(),Et(L),B.profile&&(I.stats.size=Zo(I.internalformat,I.type,L.width,L.height,P.genMipmaps,!1)),_e.format=te[I.internalformat],_e.type=xe[I.type],_e.mag=Z[P.magFilter],_e.min=ge[P.minFilter],_e.wrapS=me[P.wrapS],_e.wrapT=me[P.wrapT],_e}function Ke(c,T,P,L){d(!!c,"must specify image data");var A=T|0,w=P|0,E=L|0,p=pe();return $(p,I),p.width=0,p.height=0,he(p,c),p.width=p.width||(I.width>>E)-A,p.height=p.height||(I.height>>E)-w,d(I.type===p.type&&I.format===p.format&&I.internalformat===p.internalformat,"incompatible format for texture.subimage"),d(A>=0&&w>=0&&A+p.width<=I.width&&w+p.height<=I.height,"texture.subimage write out of bounds"),d(I.mipmask&1<<E,"missing mipmap data"),d(p.data||p.element||p.needsCopy,"missing image data"),Bt(I),Ve(p,An,A,w,E),ot(),ye(p),_e}function m(c,T){var P=c|0,L=T|0||P;if(P===I.width&&L===I.height)return _e;_e.width=I.width=P,_e.height=I.height=L,Bt(I);for(var A=0;I.mipmask>>A;++A){var w=P>>A,E=L>>A;if(!w||!E)break;a.texImage2D(An,A,I.format,w,E,0,I.format,I.type,null)}return ot(),B.profile&&(I.stats.size=Zo(I.internalformat,I.type,P,L,!1,!1)),_e}return _e(y,M),_e.subimage=Ke,_e.resize=m,_e._reglType="texture2d",_e._texture=I,B.profile&&(_e.stats=I.stats),_e.destroy=function(){I.decRef()},_e}function nt(y,M,I,_e,Ke,m){var c=new qe(ys);It[c.id]=c,z.cubeCount++;var T=new Array(6);function P(w,E,p,x,g,R){var F,V=c.texInfo;for(ht.call(V),F=0;F<6;++F)T[F]=tt();if(typeof w=="number"||!w){var W=w|0||1;for(F=0;F<6;++F)$e(T[F],W,W)}else if(typeof w=="object")if(E)Je(T[0],w),Je(T[1],E),Je(T[2],p),Je(T[3],x),Je(T[4],g),Je(T[5],R);else if(Tt(V,w),Se(c,w),"faces"in w){var ue=w.faces;for(d(Array.isArray(ue)&&ue.length===6,"cube faces must be a length 6 array"),F=0;F<6;++F)d(typeof ue[F]=="object"&&!!ue[F],"invalid input for cube map face"),$(T[F],c),Je(T[F],ue[F])}else for(F=0;F<6;++F)Je(T[F],w);else d.raise("invalid arguments to cube map");for($(c,T[0]),d.optional(function(){_.npotTextureCube||d(ml(c.width)&&ml(c.height),"your browser does not support non power or two texture dimensions")}),V.genMipmaps?c.mipmask=(T[0].width<<1)-1:c.mipmask=T[0].mipmask,d.textureCube(c,V,T,_),c.internalformat=T[0].internalformat,P.width=T[0].width,P.height=T[0].height,Bt(c),F=0;F<6;++F)vt(T[F],Ho+F);for(Pt(V,ys),ot(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,P.width,P.height,V.genMipmaps,!0)),P.format=te[c.internalformat],P.type=xe[c.type],P.mag=Z[V.magFilter],P.min=ge[V.minFilter],P.wrapS=me[V.wrapS],P.wrapT=me[V.wrapT],F=0;F<6;++F)Et(T[F]);return P}function L(w,E,p,x,g){d(!!E,"must specify image data"),d(typeof w=="number"&&w===(w|0)&&w>=0&&w<6,"invalid face");var R=p|0,F=x|0,V=g|0,W=pe();return $(W,c),W.width=0,W.height=0,he(W,E),W.width=W.width||(c.width>>V)-R,W.height=W.height||(c.height>>V)-F,d(c.type===W.type&&c.format===W.format&&c.internalformat===W.internalformat,"incompatible format for texture.subimage"),d(R>=0&&F>=0&&R+W.width<=c.width&&F+W.height<=c.height,"texture.subimage write out of bounds"),d(c.mipmask&1<<V,"missing mipmap data"),d(W.data||W.element||W.needsCopy,"missing image data"),Bt(c),Ve(W,Ho+w,R,F,V),ot(),ye(W),P}function A(w){var E=w|0;if(E!==c.width){P.width=c.width=E,P.height=c.height=E,Bt(c);for(var p=0;p<6;++p)for(var x=0;c.mipmask>>x;++x)a.texImage2D(Ho+p,x,c.format,E>>x,E>>x,0,c.format,c.type,null);return ot(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,P.width,P.height,!1,!0)),P}}return P(y,M,I,_e,Ke,m),P.subimage=L,P.resize=A,P._reglType="textureCube",P._texture=c,B.profile&&(P.stats=c.stats),P.destroy=function(){c.decRef()},P}function bt(){for(var y=0;y<Gt;++y)a.activeTexture(Pi+y),a.bindTexture(An,null),xt[y]=null;nn(It).forEach(Ie),z.cubeCount=0,z.textureCount=0}B.profile&&(z.getTotalTextureSize=function(){var y=0;return Object.keys(It).forEach(function(M){y+=It[M].stats.size}),y});function Pn(){for(var y=0;y<Gt;++y){var M=xt[y];M&&(M.bindCount=0,M.unit=-1,xt[y]=null)}nn(It).forEach(function(I){I.texture=a.createTexture(),a.bindTexture(I.target,I.texture);for(var _e=0;_e<32;++_e)if((I.mipmask&1<<_e)!==0)if(I.target===An)a.texImage2D(An,_e,I.internalformat,I.width>>_e,I.height>>_e,0,I.internalformat,I.type,null);else for(var Ke=0;Ke<6;++Ke)a.texImage2D(Ho+Ke,_e,I.internalformat,I.width>>_e,I.height>>_e,0,I.internalformat,I.type,null);Pt(I.texInfo,I.target)})}function wr(){for(var y=0;y<Gt;++y){var M=xt[y];M&&(M.bindCount=0,M.unit=-1,xt[y]=null),a.activeTexture(Pi+y),a.bindTexture(An,null),a.bindTexture(ys,null)}}return{create2D:et,createCube:nt,clear:bt,getTexture:function(y){return null},restore:Pn,refresh:wr}}var Zn=36161,Qo=32854,Ul=32855,Vl=36194,$l=33189,Hl=36168,jl=34041,Xl=35907,Wl=34836,ql=34842,Yl=34843,xn=[];xn[Qo]=2,xn[Ul]=2,xn[Vl]=2,xn[$l]=2,xn[Hl]=1,xn[jl]=4,xn[Xl]=4,xn[Wl]=16,xn[ql]=8,xn[Yl]=6;function Zl(a,h,_){return xn[a]*h*_}var jy=function(a,h,_,O,j){var z={rgba4:Qo,rgb565:Vl,"rgb5 a1":Ul,depth:$l,stencil:Hl,"depth stencil":jl};h.ext_srgb&&(z.srgba=Xl),h.ext_color_buffer_half_float&&(z.rgba16f=ql,z.rgb16f=Yl),h.webgl_color_buffer_float&&(z.rgba32f=Wl);var B=[];Object.keys(z).forEach(function(J){var ne=z[J];B[ne]=J});var K=0,Q={};function ie(J){this.id=K++,this.refCount=1,this.renderbuffer=J,this.format=Qo,this.width=0,this.height=0,j.profile&&(this.stats={size:0})}ie.prototype.decRef=function(){--this.refCount<=0&&ae(this)};function ae(J){var ne=J.renderbuffer;d(ne,"must not double destroy renderbuffer"),a.bindRenderbuffer(Zn,null),a.deleteRenderbuffer(ne),J.renderbuffer=null,J.refCount=0,delete Q[J.id],O.renderbufferCount--}function oe(J,ne){var k=new ie(a.createRenderbuffer());Q[k.id]=k,O.renderbufferCount++;function G(xe,Z){var ge=0,me=0,Fe=Qo;if(typeof xe=="object"&&xe){var X=xe;if("shape"in X){var $=X.shape;d(Array.isArray($)&&$.length>=2,"invalid renderbuffer shape"),ge=$[0]|0,me=$[1]|0}else"radius"in X&&(ge=me=X.radius|0),"width"in X&&(ge=X.width|0),"height"in X&&(me=X.height|0);"format"in X&&(d.parameter(X.format,z,"invalid renderbuffer format"),Fe=z[X.format])}else typeof xe=="number"?(ge=xe|0,typeof Z=="number"?me=Z|0:me=ge):xe?d.raise("invalid arguments to renderbuffer constructor"):ge=me=1;if(d(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),!(ge===k.width&&me===k.height&&Fe===k.format))return G.width=k.width=ge,G.height=k.height=me,k.format=Fe,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,Fe,ge,me),d(a.getError()===0,"invalid render buffer format"),j.profile&&(k.stats.size=Zl(k.format,k.width,k.height)),G.format=B[k.format],G}function te(xe,Z){var ge=xe|0,me=Z|0||ge;return ge===k.width&&me===k.height||(d(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),G.width=k.width=ge,G.height=k.height=me,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,k.format,ge,me),d(a.getError()===0,"invalid render buffer format"),j.profile&&(k.stats.size=Zl(k.format,k.width,k.height))),G}return G(J,ne),G.resize=te,G._reglType="renderbuffer",G._renderbuffer=k,j.profile&&(G.stats=k.stats),G.destroy=function(){k.decRef()},G}j.profile&&(O.getTotalRenderbufferSize=function(){var J=0;return Object.keys(Q).forEach(function(ne){J+=Q[ne].stats.size}),J});function le(){nn(Q).forEach(function(J){J.renderbuffer=a.createRenderbuffer(),a.bindRenderbuffer(Zn,J.renderbuffer),a.renderbufferStorage(Zn,J.format,J.width,J.height)}),a.bindRenderbuffer(Zn,null)}return{create:oe,clear:function(){nn(Q).forEach(ae)},restore:le}},Nn=36160,zs=36161,yr=3553,Ko=34069,Ql=36064,Kl=36096,Jl=36128,ec=33306,tc=36053,Xy=36054,Wy=36055,qy=36057,Yy=36061,Zy=36193,Qy=5121,Ky=5126,nc=6407,rc=6408,Jy=6402,ex=[nc,rc],Os=[];Os[rc]=4,Os[nc]=3;var Jo=[];Jo[Qy]=1,Jo[Ky]=4,Jo[Zy]=2;var tx=32854,nx=32855,rx=36194,ix=33189,ox=36168,ic=34041,ax=35907,sx=34836,fx=34842,ux=34843,lx=[tx,nx,rx,ax,fx,ux,sx],Wr={};Wr[tc]="complete",Wr[Xy]="incomplete attachment",Wr[qy]="incomplete dimensions",Wr[Wy]="incomplete, missing attachment",Wr[Yy]="unsupported";function cx(a,h,_,O,j,z){var B={cur:null,next:null,dirty:!1,setFBO:null},K=["rgba"],Q=["rgba4","rgb565","rgb5 a1"];h.ext_srgb&&Q.push("srgba"),h.ext_color_buffer_half_float&&Q.push("rgba16f","rgb16f"),h.webgl_color_buffer_float&&Q.push("rgba32f");var ie=["uint8"];h.oes_texture_half_float&&ie.push("half float","float16"),h.oes_texture_float&&ie.push("float","float32");function ae(ee,he,de){this.target=ee,this.texture=he,this.renderbuffer=de;var Ve=0,Ne=0;he?(Ve=he.width,Ne=he.height):de&&(Ve=de.width,Ne=de.height),this.width=Ve,this.height=Ne}function oe(ee){ee&&(ee.texture&&ee.texture._texture.decRef(),ee.renderbuffer&&ee.renderbuffer._renderbuffer.decRef())}function le(ee,he,de){if(ee)if(ee.texture){var Ve=ee.texture._texture,Ne=Math.max(1,Ve.width),pe=Math.max(1,Ve.height);d(Ne===he&&pe===de,"inconsistent width/height for supplied texture"),Ve.refCount+=1}else{var ye=ee.renderbuffer._renderbuffer;d(ye.width===he&&ye.height===de,"inconsistent width/height for renderbuffer"),ye.refCount+=1}}function J(ee,he){he&&(he.texture?a.framebufferTexture2D(Nn,ee,he.target,he.texture._texture.texture,0):a.framebufferRenderbuffer(Nn,ee,zs,he.renderbuffer._renderbuffer.renderbuffer))}function ne(ee){var he=yr,de=null,Ve=null,Ne=ee;typeof ee=="object"&&(Ne=ee.data,"target"in ee&&(he=ee.target|0)),d.type(Ne,"function","invalid attachment data");var pe=Ne._reglType;return pe==="texture2d"?(de=Ne,d(he===yr)):pe==="textureCube"?(de=Ne,d(he>=Ko&&he<Ko+6,"invalid cube map target")):pe==="renderbuffer"?(Ve=Ne,he=zs):d.raise("invalid regl object for attachment"),new ae(he,de,Ve)}function k(ee,he,de,Ve,Ne){if(de){var pe=O.create2D({width:ee,height:he,format:Ve,type:Ne});return pe._texture.refCount=0,new ae(yr,pe,null)}else{var ye=j.create({width:ee,height:he,format:Ve});return ye._renderbuffer.refCount=0,new ae(zs,null,ye)}}function G(ee){return ee&&(ee.texture||ee.renderbuffer)}function te(ee,he,de){ee&&(ee.texture?ee.texture.resize(he,de):ee.renderbuffer&&ee.renderbuffer.resize(he,de),ee.width=he,ee.height=de)}var xe=0,Z={};function ge(){this.id=xe++,Z[this.id]=this,this.framebuffer=a.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function me(ee){ee.colorAttachments.forEach(oe),oe(ee.depthAttachment),oe(ee.stencilAttachment),oe(ee.depthStencilAttachment)}function Fe(ee){var he=ee.framebuffer;d(he,"must not double destroy framebuffer"),a.deleteFramebuffer(he),ee.framebuffer=null,z.framebufferCount--,delete Z[ee.id]}function X(ee){var he;a.bindFramebuffer(Nn,ee.framebuffer);var de=ee.colorAttachments;for(he=0;he<de.length;++he)J(Ql+he,de[he]);for(he=de.length;he<_.maxColorAttachments;++he)a.framebufferTexture2D(Nn,Ql+he,yr,null,0);a.framebufferTexture2D(Nn,ec,yr,null,0),a.framebufferTexture2D(Nn,Kl,yr,null,0),a.framebufferTexture2D(Nn,Jl,yr,null,0),J(Kl,ee.depthAttachment),J(Jl,ee.stencilAttachment),J(ec,ee.depthStencilAttachment);var Ve=a.checkFramebufferStatus(Nn);!a.isContextLost()&&Ve!==tc&&d.raise("framebuffer configuration not supported, status = "+Wr[Ve]),a.bindFramebuffer(Nn,B.next?B.next.framebuffer:null),B.cur=B.next,a.getError()}function $(ee,he){var de=new ge;z.framebufferCount++;function Ve(pe,ye){var ze;d(B.next!==de,"can not update framebuffer which is currently in use");var $e=0,Je=0,vt=!0,yt=!0,tt=null,Et=!0,ht="rgba",Tt="uint8",Pt=1,Ct=null,It=null,Gt=null,xt=!1;if(typeof pe=="number")$e=pe|0,Je=ye|0||$e;else if(!pe)$e=Je=1;else{d.type(pe,"object","invalid arguments for framebuffer");var qe=pe;if("shape"in qe){var Bt=qe.shape;d(Array.isArray(Bt)&&Bt.length>=2,"invalid shape for framebuffer"),$e=Bt[0],Je=Bt[1]}else"radius"in qe&&($e=Je=qe.radius),"width"in qe&&($e=qe.width),"height"in qe&&(Je=qe.height);("color"in qe||"colors"in qe)&&(tt=qe.color||qe.colors,Array.isArray(tt)&&d(tt.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),tt||("colorCount"in qe&&(Pt=qe.colorCount|0,d(Pt>0,"invalid color buffer count")),"colorTexture"in qe&&(Et=!!qe.colorTexture,ht="rgba4"),"colorType"in qe&&(Tt=qe.colorType,Et?(d(h.oes_texture_float||!(Tt==="float"||Tt==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),d(h.oes_texture_half_float||!(Tt==="half float"||Tt==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Tt==="half float"||Tt==="float16"?(d(h.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),ht="rgba16f"):(Tt==="float"||Tt==="float32")&&(d(h.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),ht="rgba32f"),d.oneOf(Tt,ie,"invalid color type")),"colorFormat"in qe&&(ht=qe.colorFormat,K.indexOf(ht)>=0?Et=!0:Q.indexOf(ht)>=0?Et=!1:d.optional(function(){Et?d.oneOf(qe.colorFormat,K,"invalid color format for texture"):d.oneOf(qe.colorFormat,Q,"invalid color format for renderbuffer")}))),("depthTexture"in qe||"depthStencilTexture"in qe)&&(xt=!!(qe.depthTexture||qe.depthStencilTexture),d(!xt||h.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in qe&&(typeof qe.depth=="boolean"?vt=qe.depth:(Ct=qe.depth,yt=!1)),"stencil"in qe&&(typeof qe.stencil=="boolean"?yt=qe.stencil:(It=qe.stencil,vt=!1)),"depthStencil"in qe&&(typeof qe.depthStencil=="boolean"?vt=yt=qe.depthStencil:(Gt=qe.depthStencil,vt=!1,yt=!1))}var ot=null,Ie=null,et=null,nt=null;if(Array.isArray(tt))ot=tt.map(ne);else if(tt)ot=[ne(tt)];else for(ot=new Array(Pt),ze=0;ze<Pt;++ze)ot[ze]=k($e,Je,Et,ht,Tt);d(h.webgl_draw_buffers||ot.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),d(ot.length<=_.maxColorAttachments,"too many color attachments, not supported"),$e=$e||ot[0].width,Je=Je||ot[0].height,Ct?Ie=ne(Ct):vt&&!yt&&(Ie=k($e,Je,xt,"depth","uint32")),It?et=ne(It):yt&&!vt&&(et=k($e,Je,!1,"stencil","uint8")),Gt?nt=ne(Gt):!Ct&&!It&&yt&&vt&&(nt=k($e,Je,xt,"depth stencil","depth stencil")),d(!!Ct+!!It+!!Gt<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var bt=null;for(ze=0;ze<ot.length;++ze)if(le(ot[ze],$e,Je),d(!ot[ze]||ot[ze].texture&&ex.indexOf(ot[ze].texture._texture.format)>=0||ot[ze].renderbuffer&&lx.indexOf(ot[ze].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+ze+" is invalid"),ot[ze]&&ot[ze].texture){var Pn=Os[ot[ze].texture._texture.format]*Jo[ot[ze].texture._texture.type];bt===null?bt=Pn:d(bt===Pn,"all color attachments much have the same number of bits per pixel.")}return le(Ie,$e,Je),d(!Ie||Ie.texture&&Ie.texture._texture.format===Jy||Ie.renderbuffer&&Ie.renderbuffer._renderbuffer.format===ix,"invalid depth attachment for framebuffer object"),le(et,$e,Je),d(!et||et.renderbuffer&&et.renderbuffer._renderbuffer.format===ox,"invalid stencil attachment for framebuffer object"),le(nt,$e,Je),d(!nt||nt.texture&&nt.texture._texture.format===ic||nt.renderbuffer&&nt.renderbuffer._renderbuffer.format===ic,"invalid depth-stencil attachment for framebuffer object"),me(de),de.width=$e,de.height=Je,de.colorAttachments=ot,de.depthAttachment=Ie,de.stencilAttachment=et,de.depthStencilAttachment=nt,Ve.color=ot.map(G),Ve.depth=G(Ie),Ve.stencil=G(et),Ve.depthStencil=G(nt),Ve.width=de.width,Ve.height=de.height,X(de),Ve}function Ne(pe,ye){d(B.next!==de,"can not resize a framebuffer which is currently in use");var ze=Math.max(pe|0,1),$e=Math.max(ye|0||ze,1);if(ze===de.width&&$e===de.height)return Ve;for(var Je=de.colorAttachments,vt=0;vt<Je.length;++vt)te(Je[vt],ze,$e);return te(de.depthAttachment,ze,$e),te(de.stencilAttachment,ze,$e),te(de.depthStencilAttachment,ze,$e),de.width=Ve.width=ze,de.height=Ve.height=$e,X(de),Ve}return Ve(ee,he),r(Ve,{resize:Ne,_reglType:"framebuffer",_framebuffer:de,destroy:function(){Fe(de),me(de)},use:function(pe){B.setFBO({framebuffer:Ve},pe)}})}function Se(ee){var he=Array(6);function de(Ne){var pe;d(he.indexOf(B.next)<0,"can not update framebuffer which is currently in use");var ye={color:null},ze=0,$e=null,Je="rgba",vt="uint8",yt=1;if(typeof Ne=="number")ze=Ne|0;else if(!Ne)ze=1;else{d.type(Ne,"object","invalid arguments for framebuffer");var tt=Ne;if("shape"in tt){var Et=tt.shape;d(Array.isArray(Et)&&Et.length>=2,"invalid shape for framebuffer"),d(Et[0]===Et[1],"cube framebuffer must be square"),ze=Et[0]}else"radius"in tt&&(ze=tt.radius|0),"width"in tt?(ze=tt.width|0,"height"in tt&&d(tt.height===ze,"must be square")):"height"in tt&&(ze=tt.height|0);("color"in tt||"colors"in tt)&&($e=tt.color||tt.colors,Array.isArray($e)&&d($e.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),$e||("colorCount"in tt&&(yt=tt.colorCount|0,d(yt>0,"invalid color buffer count")),"colorType"in tt&&(d.oneOf(tt.colorType,ie,"invalid color type"),vt=tt.colorType),"colorFormat"in tt&&(Je=tt.colorFormat,d.oneOf(tt.colorFormat,K,"invalid color format for texture"))),"depth"in tt&&(ye.depth=tt.depth),"stencil"in tt&&(ye.stencil=tt.stencil),"depthStencil"in tt&&(ye.depthStencil=tt.depthStencil)}var ht;if($e)if(Array.isArray($e))for(ht=[],pe=0;pe<$e.length;++pe)ht[pe]=$e[pe];else ht=[$e];else{ht=Array(yt);var Tt={radius:ze,format:Je,type:vt};for(pe=0;pe<yt;++pe)ht[pe]=O.createCube(Tt)}for(ye.color=Array(ht.length),pe=0;pe<ht.length;++pe){var Pt=ht[pe];d(typeof Pt=="function"&&Pt._reglType==="textureCube","invalid cube map"),ze=ze||Pt.width,d(Pt.width===ze&&Pt.height===ze,"invalid cube map shape"),ye.color[pe]={target:Ko,data:ht[pe]}}for(pe=0;pe<6;++pe){for(var Ct=0;Ct<ht.length;++Ct)ye.color[Ct].target=Ko+pe;pe>0&&(ye.depth=he[0].depth,ye.stencil=he[0].stencil,ye.depthStencil=he[0].depthStencil),he[pe]?he[pe](ye):he[pe]=$(ye)}return r(de,{width:ze,height:ze,color:ht})}function Ve(Ne){var pe,ye=Ne|0;if(d(ye>0&&ye<=_.maxCubeMapSize,"invalid radius for cube fbo"),ye===de.width)return de;var ze=de.color;for(pe=0;pe<ze.length;++pe)ze[pe].resize(ye);for(pe=0;pe<6;++pe)he[pe].resize(ye);return de.width=de.height=ye,de}return de(ee),r(de,{faces:he,resize:Ve,_reglType:"framebufferCube",destroy:function(){he.forEach(function(Ne){Ne.destroy()})}})}function ce(){B.cur=null,B.next=null,B.dirty=!0,nn(Z).forEach(function(ee){ee.framebuffer=a.createFramebuffer(),X(ee)})}return r(B,{getFramebuffer:function(ee){if(typeof ee=="function"&&ee._reglType==="framebuffer"){var he=ee._framebuffer;if(he instanceof ge)return he}return null},create:$,createCube:Se,clear:function(){nn(Z).forEach(Fe)},restore:ce})}var hx=5126,oc=34962,ea=34963,ac=["attributes","elements","offset","count","primitive","instances"];function Ms(){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=hx,this.offset=0,this.stride=0,this.divisor=0}function dx(a,h,_,O,j,z,B){for(var K=_.maxAttributes,Q=new Array(K),ie=0;ie<K;++ie)Q[ie]=new Ms;var ae=0,oe={},le={Record:Ms,scope:{},state:Q,currentVAO:null,targetVAO:null,restore:ne()?me:function(){},createVAO:Fe,getVAO:G,destroyBuffer:J,setVAO:ne()?te:xe,clear:ne()?Z:function(){}};function J(X){for(var $=0;$<Q.length;++$){var Se=Q[$];Se.buffer===X&&(a.disableVertexAttribArray($),Se.buffer=null)}}function ne(){return h.oes_vertex_array_object}function k(){return h.angle_instanced_arrays}function G(X){return typeof X=="function"&&X._vao?X._vao:null}function te(X){if(X!==le.currentVAO){var $=ne();X?$.bindVertexArrayOES(X.vao):$.bindVertexArrayOES(null),le.currentVAO=X}}function xe(X){if(X!==le.currentVAO){if(X)X.bindAttrs();else{for(var $=k(),Se=0;Se<Q.length;++Se){var ce=Q[Se];ce.buffer?(a.enableVertexAttribArray(Se),ce.buffer.bind(),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offfset),$&&ce.divisor&&$.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}B.elements?a.bindBuffer(ea,B.elements.buffer.buffer):a.bindBuffer(ea,null)}le.currentVAO=X}}function Z(){nn(oe).forEach(function(X){X.destroy()})}function ge(){this.id=++ae,this.attributes=[],this.elements=null,this.ownsElements=!1,this.count=0,this.offset=0,this.instances=-1,this.primitive=4;var X=ne();X?this.vao=X.createVertexArrayOES():this.vao=null,oe[this.id]=this,this.buffers=[]}ge.prototype.bindAttrs=function(){for(var X=k(),$=this.attributes,Se=0;Se<$.length;++Se){var ce=$[Se];ce.buffer?(a.enableVertexAttribArray(Se),a.bindBuffer(oc,ce.buffer.buffer),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offset),X&&ce.divisor&&X.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}for(var ee=$.length;ee<K;++ee)a.disableVertexAttribArray(ee);var he=z.getElements(this.elements);he?a.bindBuffer(ea,he.buffer.buffer):a.bindBuffer(ea,null)},ge.prototype.refresh=function(){var X=ne();X&&(X.bindVertexArrayOES(this.vao),this.bindAttrs(),le.currentVAO=null,X.bindVertexArrayOES(null))},ge.prototype.destroy=function(){if(this.vao){var X=ne();this===le.currentVAO&&(le.currentVAO=null,X.bindVertexArrayOES(null)),X.deleteVertexArrayOES(this.vao),this.vao=null}this.ownsElements&&(this.elements.destroy(),this.elements=null,this.ownsElements=!1),oe[this.id]&&(delete oe[this.id],O.vaoCount-=1)};function me(){var X=ne();X&&nn(oe).forEach(function($){$.refresh()})}function Fe(X){var $=new ge;O.vaoCount+=1;function Se(ce){var ee;if(Array.isArray(ce))ee=ce,$.elements&&$.ownsElements&&$.elements.destroy(),$.elements=null,$.ownsElements=!1,$.offset=0,$.count=0,$.instances=-1,$.primitive=4;else{if(d(typeof ce=="object","invalid arguments for create vao"),d("attributes"in ce,"must specify attributes for vao"),ce.elements){var he=ce.elements;$.ownsElements?typeof he=="function"&&he._reglType==="elements"?($.elements.destroy(),$.ownsElements=!1):($.elements(he),$.ownsElements=!1):z.getElements(ce.elements)?($.elements=ce.elements,$.ownsElements=!1):($.elements=z.create(ce.elements),$.ownsElements=!0)}else $.elements=null,$.ownsElements=!1;ee=ce.attributes,$.offset=0,$.count=-1,$.instances=-1,$.primitive=4,$.elements&&($.count=$.elements._elements.vertCount,$.primitive=$.elements._elements.primType),"offset"in ce&&($.offset=ce.offset|0),"count"in ce&&($.count=ce.count|0),"instances"in ce&&($.instances=ce.instances|0),"primitive"in ce&&(d(ce.primitive in Yn,"bad primitive type: "+ce.primitive),$.primitive=Yn[ce.primitive]),d.optional(()=>{for(var vt=Object.keys(ce),yt=0;yt<vt.length;++yt)d(ac.indexOf(vt[yt])>=0,'invalid option for vao: "'+vt[yt]+'" valid options are '+ac)}),d(Array.isArray(ee),"attributes must be an array")}d(ee.length<K,"too many attributes"),d(ee.length>0,"must specify at least one attribute");var de={},Ve=$.attributes;Ve.length=ee.length;for(var Ne=0;Ne<ee.length;++Ne){var pe=ee[Ne],ye=Ve[Ne]=new Ms,ze=pe.data||pe;if(Array.isArray(ze)||n(ze)||yn(ze)){var $e;$.buffers[Ne]&&($e=$.buffers[Ne],n(ze)&&$e._buffer.byteLength>=ze.byteLength?$e.subdata(ze):($e.destroy(),$.buffers[Ne]=null)),$.buffers[Ne]||($e=$.buffers[Ne]=j.create(pe,oc,!1,!0)),ye.buffer=j.getBuffer($e),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1,de[Ne]=1}else j.getBuffer(pe)?(ye.buffer=j.getBuffer(pe),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1):j.getBuffer(pe.buffer)?(ye.buffer=j.getBuffer(pe.buffer),ye.size=(+pe.size||ye.buffer.dimension)|0,ye.normalized=!!pe.normalized||!1,"type"in pe?(d.parameter(pe.type,mr,"invalid buffer type"),ye.type=mr[pe.type]):ye.type=ye.buffer.dtype,ye.offset=(pe.offset||0)|0,ye.stride=(pe.stride||0)|0,ye.divisor=(pe.divisor||0)|0,ye.state=1,d(ye.size>=1&&ye.size<=4,"size must be between 1 and 4"),d(ye.offset>=0,"invalid offset"),d(ye.stride>=0&&ye.stride<=255,"stride must be between 0 and 255"),d(ye.divisor>=0,"divisor must be positive"),d(!ye.divisor||!!h.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in pe?(d(Ne>0,"first attribute must not be a constant"),ye.x=+pe.x||0,ye.y=+pe.y||0,ye.z=+pe.z||0,ye.w=+pe.w||0,ye.state=2):d(!1,"invalid attribute spec for location "+Ne)}for(var Je=0;Je<$.buffers.length;++Je)!de[Je]&&$.buffers[Je]&&($.buffers[Je].destroy(),$.buffers[Je]=null);return $.refresh(),Se}return Se.destroy=function(){for(var ce=0;ce<$.buffers.length;++ce)$.buffers[ce]&&$.buffers[ce].destroy();$.buffers.length=0,$.ownsElements&&($.elements.destroy(),$.elements=null,$.ownsElements=!1),$.destroy()},Se._vao=$,Se._reglType="vao",Se(X)}return le}var sc=35632,mx=35633,px=35718,vx=35721;function gx(a,h,_,O){var j={},z={};function B(k,G,te,xe){this.name=k,this.id=G,this.location=te,this.info=xe}function K(k,G){for(var te=0;te<k.length;++te)if(k[te].id===G.id){k[te].location=G.location;return}k.push(G)}function Q(k,G,te){var xe=k===sc?j:z,Z=xe[G];if(!Z){var ge=h.str(G);Z=a.createShader(k),a.shaderSource(Z,ge),a.compileShader(Z),d.shaderError(a,Z,ge,k,te),xe[G]=Z}return Z}var ie={},ae=[],oe=0;function le(k,G){this.id=oe++,this.fragId=k,this.vertId=G,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,O.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function J(k,G,te){var xe,Z,ge=Q(sc,k.fragId),me=Q(mx,k.vertId),Fe=k.program=a.createProgram();if(a.attachShader(Fe,ge),a.attachShader(Fe,me),te)for(xe=0;xe<te.length;++xe){var X=te[xe];a.bindAttribLocation(Fe,X[0],X[1])}a.linkProgram(Fe),d.linkError(a,Fe,h.str(k.fragId),h.str(k.vertId),G);var $=a.getProgramParameter(Fe,px);O.profile&&(k.stats.uniformsCount=$);var Se=k.uniforms;for(xe=0;xe<$;++xe)if(Z=a.getActiveUniform(Fe,xe),Z){if(Z.size>1)for(var ce=0;ce<Z.size;++ce){var ee=Z.name.replace("[0]","["+ce+"]");K(Se,new B(ee,h.id(ee),a.getUniformLocation(Fe,ee),Z))}var he=Z.name;Z.size>1&&(he=he.replace("[0]","")),K(Se,new B(he,h.id(he),a.getUniformLocation(Fe,he),Z))}var de=a.getProgramParameter(Fe,vx);O.profile&&(k.stats.attributesCount=de);var Ve=k.attributes;for(xe=0;xe<de;++xe)Z=a.getActiveAttrib(Fe,xe),Z&&K(Ve,new B(Z.name,h.id(Z.name),a.getAttribLocation(Fe,Z.name),Z))}O.profile&&(_.getMaxUniformsCount=function(){var k=0;return ae.forEach(function(G){G.stats.uniformsCount>k&&(k=G.stats.uniformsCount)}),k},_.getMaxAttributesCount=function(){var k=0;return ae.forEach(function(G){G.stats.attributesCount>k&&(k=G.stats.attributesCount)}),k});function ne(){j={},z={};for(var k=0;k<ae.length;++k)J(ae[k],null,ae[k].attributes.map(function(G){return[G.location,G.name]}))}return{clear:function(){var k=a.deleteShader.bind(a);nn(j).forEach(k),j={},nn(z).forEach(k),z={},ae.forEach(function(G){a.deleteProgram(G.program)}),ae.length=0,ie={},_.shaderCount=0},program:function(k,G,te,xe){d.command(k>=0,"missing vertex shader",te),d.command(G>=0,"missing fragment shader",te);var Z=ie[G];Z||(Z=ie[G]={});var ge=Z[k];if(ge&&(ge.refCount++,!xe))return ge;var me=new le(G,k);return _.shaderCount++,J(me,te,xe),ge||(Z[k]=me),ae.push(me),r(me,{destroy:function(){if(me.refCount--,me.refCount<=0){a.deleteProgram(me.program);var Fe=ae.indexOf(me);ae.splice(Fe,1),_.shaderCount--}Z[me.vertId].refCount<=0&&(a.deleteShader(z[me.vertId]),delete z[me.vertId],delete ie[me.fragId][me.vertId]),Object.keys(ie[me.fragId]).length||(a.deleteShader(j[me.fragId]),delete j[me.fragId],delete ie[me.fragId])}})},restore:ne,shader:Q,frag:-1,vert:-1}}var yx=6408,Ci=5121,xx=3333,ta=5126;function bx(a,h,_,O,j,z,B){function K(ae){var oe;h.next===null?(d(j.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),oe=Ci):(d(h.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),oe=h.next.colorAttachments[0].texture._texture.type,d.optional(function(){z.oes_texture_float?(d(oe===Ci||oe===ta,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),oe===ta&&d(B.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):d(oe===Ci,"Reading from a framebuffer is only allowed for the type 'uint8'")}));var le=0,J=0,ne=O.framebufferWidth,k=O.framebufferHeight,G=null;n(ae)?G=ae:ae&&(d.type(ae,"object","invalid arguments to regl.read()"),le=ae.x|0,J=ae.y|0,d(le>=0&&le<O.framebufferWidth,"invalid x offset for regl.read"),d(J>=0&&J<O.framebufferHeight,"invalid y offset for regl.read"),ne=(ae.width||O.framebufferWidth-le)|0,k=(ae.height||O.framebufferHeight-J)|0,G=ae.data||null),G&&(oe===Ci?d(G instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):oe===ta&&d(G instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),d(ne>0&&ne+le<=O.framebufferWidth,"invalid width for read pixels"),d(k>0&&k+J<=O.framebufferHeight,"invalid height for read pixels"),_();var te=ne*k*4;return G||(oe===Ci?G=new Uint8Array(te):oe===ta&&(G=G||new Float32Array(te))),d.isTypedArray(G,"data buffer for regl.read() must be a typedarray"),d(G.byteLength>=te,"data buffer for regl.read() too small"),a.pixelStorei(xx,4),a.readPixels(le,J,ne,k,yx,oe,G),G}function Q(ae){var oe;return h.setFBO({framebuffer:ae.framebuffer},function(){oe=K(ae)}),oe}function ie(ae){return!ae||!("framebuffer"in ae)?K(ae):Q(ae)}return ie}function qr(a){return Array.prototype.slice.call(a)}function Yr(a){return qr(a).join("")}function _x(){var a=0,h=[],_=[];function O(oe){for(var le=0;le<_.length;++le)if(_[le]===oe)return h[le];var J="g"+a++;return h.push(J),_.push(oe),J}function j(){var oe=[];function le(){oe.push.apply(oe,qr(arguments))}var J=[];function ne(){var k="v"+a++;return J.push(k),arguments.length>0&&(oe.push(k,"="),oe.push.apply(oe,qr(arguments)),oe.push(";")),k}return r(le,{def:ne,toString:function(){return Yr([J.length>0?"var "+J.join(",")+";":"",Yr(oe)])}})}function z(){var oe=j(),le=j(),J=oe.toString,ne=le.toString;function k(G,te){le(G,te,"=",oe.def(G,te),";")}return r(function(){oe.apply(oe,qr(arguments))},{def:oe.def,entry:oe,exit:le,save:k,set:function(G,te,xe){k(G,te),oe(G,te,"=",xe,";")},toString:function(){return J()+ne()}})}function B(){var oe=Yr(arguments),le=z(),J=z(),ne=le.toString,k=J.toString;return r(le,{then:function(){return le.apply(le,qr(arguments)),this},else:function(){return J.apply(J,qr(arguments)),this},toString:function(){var G=k();return G&&(G="else{"+G+"}"),Yr(["if(",oe,"){",ne(),"}",G])}})}var K=j(),Q={};function ie(oe,le){var J=[];function ne(){var Z="a"+J.length;return J.push(Z),Z}le=le||0;for(var k=0;k<le;++k)ne();var G=z(),te=G.toString,xe=Q[oe]=r(G,{arg:ne,toString:function(){return Yr(["function(",J.join(),"){",te(),"}"])}});return xe}function ae(){var oe=['"use strict";',K,"return {"];Object.keys(Q).forEach(function(ne){oe.push('"',ne,'":',Q[ne].toString(),",")}),oe.push("}");var le=Yr(oe).replace(/;/g,`;
|
|
5
|
+
`,"color:red;text-decoration:underline;font-weight:bold"),ae.lines.forEach(function(ne){if(ne.errors.length>0){J(se(ne.number,4)+"| ","background-color:yellow; font-weight:bold"),J(ne.line+i,"color:red; background-color:yellow; font-weight:bold");var k=0;ne.errors.forEach(function(G){var te=G.message,xe=/^\s*'(.*)'\s*:\s*(.*)$/.exec(te);if(xe){var Z=xe[1];switch(te=xe[2],Z){case"assign":Z="=";break}k=Math.max(ne.line.indexOf(Z,k),0)}else k=0;J(se("| ",6)),J(se("^^^",k+3)+i,"font-weight:bold"),J(se("| ",6)),J(te+i,"font-weight:bold")}),J(se("| ",6)+i)}else J(se(ne.number,4)+"| "),J(ne.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(le[0]=oe.join("%c"),console.log.apply(console,le)):console.log(oe.join(""))}),f.raise("Error compiling "+B+" shader, "+K[0].name)}}function Ae(a,h,_,O,j){if(!a.getProgramParameter(h,a.LINK_STATUS)){var z=a.getProgramInfoLog(h),B=Ge(_,j),K=Ge(O,j),Q='Error linking program with vertex shader, "'+K[0].name+'", and fragment shader "'+B[0].name+'"';typeof document<"u"?console.log("%c"+Q+i+"%c"+z,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Q+i+z),f.raise(Q)}}function lt(a){a._commandRef=fe()}function it(a,h,_,O){lt(a);function j(Q){return Q?O.id(Q):0}a._fragId=j(a.static.frag),a._vertId=j(a.static.vert);function z(Q,ie){Object.keys(ie).forEach(function(ae){Q[O.id(ae)]=!0})}var B=a._uniformSet={};z(B,h.static),z(B,h.dynamic);var K=a._attributeSet={};z(K,_.static),z(K,_.dynamic),a._hasCount="count"in a.static||"count"in a.dynamic||"elements"in a.static||"elements"in a.dynamic}function N(a,h){var _=Re();s(a+" in command "+(h||fe())+(_==="unknown"?"":" called from "+_))}function Ce(a,h,_){a||N(h,_||fe())}function re(a,h,_,O){a in h||N("unknown parameter ("+a+")"+u(_)+". possible values: "+Object.keys(h).join(),O||fe())}function ke(a,h,_,O){x(a,h)||N("invalid parameter type"+u(_)+". expected "+h+", got "+typeof a,O||fe())}function Xe(a){a()}function je(a,h,_){a.texture?Y(a.texture._texture.internalformat,h,"unsupported texture format for attachment"):Y(a.renderbuffer._renderbuffer.format,_,"unsupported renderbuffer format for attachment")}var Qe=33071,Ze=9728,dt=9984,ct=9985,_t=9986,st=9987,$t=5120,Ht=5121,Qt=5122,zn=5123,wo=5124,Ao=5125,On=5126,sr=32819,Tn=32820,Ir=33635,Dr=34042,$n=36193,zt={};zt[$t]=zt[Ht]=1,zt[Qt]=zt[zn]=zt[$n]=zt[Ir]=zt[sr]=zt[Tn]=2,zt[wo]=zt[Ao]=zt[On]=zt[Dr]=4;function fr(a,h){return a===Tn||a===sr||a===Ir?2:a===Dr?4:zt[a]*h}function ur(a){return!(a&a-1)&&!!a}function Eo(a,h,_){var O,j=h.width,z=h.height,B=h.channels;f(j>0&&j<=_.maxTextureSize&&z>0&&z<=_.maxTextureSize,"invalid texture shape"),(a.wrapS!==Qe||a.wrapT!==Qe)&&f(ur(j)&&ur(z),"incompatible wrap mode for texture, both width and height must be power of 2"),h.mipmask===1?j!==1&&z!==1&&f(a.minFilter!==dt&&a.minFilter!==_t&&a.minFilter!==ct&&a.minFilter!==st,"min filter requires mipmap"):(f(ur(j)&&ur(z),"texture must be a square power of 2 to support mipmapping"),f(h.mipmask===(j<<1)-1,"missing or incomplete mipmap data")),h.type===On&&(_.extensions.indexOf("oes_texture_float_linear")<0&&f(a.minFilter===Ze&&a.magFilter===Ze,"filter not supported, must enable oes_texture_float_linear"),f(!a.genMipmaps,"mipmap generation not supported with float textures"));var K=h.images;for(O=0;O<16;++O)if(K[O]){var Q=j>>O,ie=z>>O;f(h.mipmask&1<<O,"missing mipmap data");var ae=K[O];if(f(ae.width===Q&&ae.height===ie,"invalid shape for mip images"),f(ae.format===h.format&&ae.internalformat===h.internalformat&&ae.type===h.type,"incompatible type for mip image"),!ae.compressed)if(ae.data){var oe=Math.ceil(fr(ae.type,B)*Q/ae.unpackAlignment)*ae.unpackAlignment;f(ae.data.byteLength===oe*ie,"invalid data for image, buffer size is inconsistent with image format")}else ae.element||ae.copy}else a.genMipmaps||f((h.mipmask&1<<O)===0,"extra mipmap data");h.compressed&&f(!a.genMipmaps,"mipmap generation for compressed images not supported")}function as(a,h,_,O){var j=a.width,z=a.height,B=a.channels;f(j>0&&j<=O.maxTextureSize&&z>0&&z<=O.maxTextureSize,"invalid texture shape"),f(j===z,"cube map must be square"),f(h.wrapS===Qe&&h.wrapT===Qe,"wrap mode not supported by cube map");for(var K=0;K<_.length;++K){var Q=_[K];f(Q.width===j&&Q.height===z,"inconsistent cube map face shape"),h.genMipmaps&&(f(!Q.compressed,"can not generate mipmap for compressed textures"),f(Q.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var ie=Q.images,ae=0;ae<16;++ae){var oe=ie[ae];if(oe){var le=j>>ae,J=z>>ae;f(Q.mipmask&1<<ae,"missing mipmap data"),f(oe.width===le&&oe.height===J,"invalid shape for mip images"),f(oe.format===a.format&&oe.internalformat===a.internalformat&&oe.type===a.type,"incompatible type for mip image"),oe.compressed||(oe.data?f(oe.data.byteLength===le*J*Math.max(fr(oe.type,B),oe.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):oe.element||oe.copy)}}}}var d=r(f,{optional:Xe,raise:s,commandRaise:N,command:Ce,parameter:l,commandParameter:re,constructor:Te,type:S,commandType:ke,isTypedArray:p,nni:D,oneOf:Y,shaderError:ut,linkError:Ae,callSite:Re,saveCommandRef:lt,saveDrawInfo:it,framebufferFormat:je,guessCommand:fe,texture2D:Eo,textureCube:as}),lr=0,Hn=0,jn=5,Po=6;function wn(a,h){this.id=lr++,this.type=a,this.data=h}function yi(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Mn(a){if(a.length===0)return[];var h=a.charAt(0),_=a.charAt(a.length-1);if(a.length>1&&h===_&&(h==='"'||h==="'"))return['"'+yi(a.substr(1,a.length-2))+'"'];var O=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(a);if(O)return Mn(a.substr(0,O.index)).concat(Mn(O[1])).concat(Mn(a.substr(O.index+O[0].length)));var j=a.split(".");if(j.length===1)return['"'+yi(a)+'"'];for(var z=[],B=0;B<j.length;++B)z=z.concat(Mn(j[B]));return z}function xi(a){return"["+Mn(a).join("][")+"]"}function zr(a,h){return new wn(a,xi(h+""))}function Or(a){return typeof a=="function"&&!a._reglType||a instanceof wn}function an(a,h){if(typeof a=="function")return new wn(Hn,a);if(typeof a=="number"||typeof a=="boolean")return new wn(jn,a);if(Array.isArray(a))return new wn(Po,a.map(function(_,O){return an(_,h+"["+O+"]")}));if(a instanceof wn)return a;d(!1,"invalid option type in uniform "+h)}var Lt={DynamicVariable:wn,define:zr,isDynamic:Or,unbox:an,accessor:xi},cr={next:typeof requestAnimationFrame=="function"?function(a){return requestAnimationFrame(a)}:function(a){return setTimeout(a,16)},cancel:typeof cancelAnimationFrame=="function"?function(a){return cancelAnimationFrame(a)}:clearTimeout},Mr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function ss(){var a={"":0},h=[""];return{id:function(_){var O=a[_];return O||(O=a[_]=h.length,h.push(_),O)},str:function(_){return h[_]}}}function Nr(a,h,_){var O=document.createElement("canvas");r(O.style,{border:0,margin:0,padding:0,top:0,left:0,width:"100%",height:"100%"}),a.appendChild(O),a===document.body&&(O.style.position="absolute",r(a.style,{margin:0,padding:0}));function j(){var K=window.innerWidth,Q=window.innerHeight;if(a!==document.body){var ie=O.getBoundingClientRect();K=ie.right-ie.left,Q=ie.bottom-ie.top}O.width=_*K,O.height=_*Q}var z;a!==document.body&&typeof ResizeObserver=="function"?(z=new ResizeObserver(function(){setTimeout(j)}),z.observe(a)):window.addEventListener("resize",j,!1);function B(){z?z.disconnect():window.removeEventListener("resize",j),a.removeChild(O)}return j(),{canvas:O,onDestroy:B}}function Gr(a,h){function _(O){try{return a.getContext(O,h)}catch{return null}}return _("webgl")||_("experimental-webgl")||_("webgl-experimental")}function fs(a){return typeof a.nodeName=="string"&&typeof a.appendChild=="function"&&typeof a.getBoundingClientRect=="function"}function hr(a){return typeof a.drawArrays=="function"||typeof a.drawElements=="function"}function Co(a){return typeof a=="string"?a.split():(d(Array.isArray(a),"invalid extension array"),a)}function ko(a){return typeof a=="string"?(d(typeof document<"u","not supported outside of DOM"),document.querySelector(a)):a}function Ft(a){var h=a||{},_,O,j,z,B={},K=[],Q=[],ie=typeof window>"u"?1:window.devicePixelRatio,ae=!1,oe=function(ne){ne&&d.raise(ne)},le=function(){};if(typeof h=="string"?(d(typeof document<"u","selector queries only supported in DOM enviroments"),_=document.querySelector(h),d(_,"invalid query string for element")):typeof h=="object"?fs(h)?_=h:hr(h)?(z=h,j=z.canvas):(d.constructor(h),"gl"in h?z=h.gl:"canvas"in h?j=ko(h.canvas):"container"in h&&(O=ko(h.container)),"attributes"in h&&(B=h.attributes,d.type(B,"object","invalid context attributes")),"extensions"in h&&(K=Co(h.extensions)),"optionalExtensions"in h&&(Q=Co(h.optionalExtensions)),"onDone"in h&&(d.type(h.onDone,"function","invalid or missing onDone callback"),oe=h.onDone),"profile"in h&&(ae=!!h.profile),"pixelRatio"in h&&(ie=+h.pixelRatio,d(ie>0,"invalid pixel ratio"))):d.raise("invalid arguments to regl"),_&&(_.nodeName.toLowerCase()==="canvas"?j=_:O=_),!z){if(!j){d(typeof document<"u","must manually specify webgl context outside of DOM environments");var J=Nr(O||document.body,oe,ie);if(!J)return null;j=J.canvas,le=J.onDestroy}B.premultipliedAlpha===void 0&&(B.premultipliedAlpha=!0),z=Gr(j,B)}return z?{gl:z,canvas:j,container:O,extensions:K,optionalExtensions:Q,pixelRatio:ie,profile:ae,onDone:oe,onDestroy:le}:(le(),oe("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Xn(a,h){var _={};function O(B){d.type(B,"string","extension name must be string");var K=B.toLowerCase(),Q;try{Q=_[K]=a.getExtension(K)}catch{}return!!Q}for(var j=0;j<h.extensions.length;++j){var z=h.extensions[j];if(!O(z))return h.onDestroy(),h.onDone('"'+z+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return h.optionalExtensions.forEach(O),{extensions:_,restore:function(){Object.keys(_).forEach(function(B){if(_[B]&&!O(B))throw new Error("(regl): error restoring extension "+B)})}}}function Yt(a,h){for(var _=Array(a),O=0;O<a;++O)_[O]=h(O);return _}var Lo=5120,bi=5121,Fo=5122,Ro=5123,us=5124,sn=5125,Wn=5126;function Io(a){for(var h=16;h<=1<<28;h*=16)if(a<=h)return h;return 0}function _i(a){var h,_;return h=(a>65535)<<4,a>>>=h,_=(a>255)<<3,a>>>=_,h|=_,_=(a>15)<<2,a>>>=_,h|=_,_=(a>3)<<1,a>>>=_,h|=_,h|a>>1}function Br(){var a=Yt(8,function(){return[]});function h(z){var B=Io(z),K=a[_i(B)>>2];return K.length>0?K.pop():new ArrayBuffer(B)}function _(z){a[_i(z.byteLength)>>2].push(z)}function O(z,B){var K=null;switch(z){case Lo:K=new Int8Array(h(B),0,B);break;case bi:K=new Uint8Array(h(B),0,B);break;case Fo:K=new Int16Array(h(2*B),0,B);break;case Ro:K=new Uint16Array(h(2*B),0,B);break;case us:K=new Int32Array(h(4*B),0,B);break;case sn:K=new Uint32Array(h(4*B),0,B);break;case Wn:K=new Float32Array(h(4*B),0,B);break;default:return null}return K.length!==B?K.subarray(0,B):K}function j(z){_(z.buffer)}return{alloc:h,free:_,allocType:O,freeType:j}}var gt=Br();gt.zero=Br();var vn=3408,Do=3410,zo=3411,Oo=3412,Mo=3413,ls=3414,Be=3415,C=33901,ve=33902,De=3379,mt=3386,Ot=34921,At=36347,jt=36348,gn=35661,dr=35660,Si=34930,Mt=36349,No=34076,Go=34024,Pg=7936,Cg=7937,kg=7938,Lg=35724,Fg=34047,Rg=36063,Ig=34852,Bo=3553,nl=34067,Dg=34069,zg=33984,Ti=6408,cs=5126,rl=5121,hs=36160,Og=36053,Mg=36064,Ng=16384,Gg=function(a,h){var _=1;h.ext_texture_filter_anisotropic&&(_=a.getParameter(Fg));var O=1,j=1;h.webgl_draw_buffers&&(O=a.getParameter(Ig),j=a.getParameter(Rg));var z=!!h.oes_texture_float;if(z){var B=a.createTexture();a.bindTexture(Bo,B),a.texImage2D(Bo,0,Ti,1,1,0,Ti,cs,null);var K=a.createFramebuffer();if(a.bindFramebuffer(hs,K),a.framebufferTexture2D(hs,Mg,Bo,B,0),a.bindTexture(Bo,null),a.checkFramebufferStatus(hs)!==Og)z=!1;else{a.viewport(0,0,1,1),a.clearColor(1,0,0,1),a.clear(Ng);var Q=gt.allocType(cs,4);a.readPixels(0,0,1,1,Ti,cs,Q),a.getError()?z=!1:(a.deleteFramebuffer(K),a.deleteTexture(B),z=Q[0]===1),gt.freeType(Q)}}var ie=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),ae=!0;if(!ie){var oe=a.createTexture(),le=gt.allocType(rl,36);a.activeTexture(zg),a.bindTexture(nl,oe),a.texImage2D(Dg,0,Ti,3,3,0,Ti,rl,le),gt.freeType(le),a.bindTexture(nl,null),a.deleteTexture(oe),ae=!a.getError()}return{colorBits:[a.getParameter(Do),a.getParameter(zo),a.getParameter(Oo),a.getParameter(Mo)],depthBits:a.getParameter(ls),stencilBits:a.getParameter(Be),subpixelBits:a.getParameter(vn),extensions:Object.keys(h).filter(function(J){return!!h[J]}),maxAnisotropic:_,maxDrawbuffers:O,maxColorAttachments:j,pointSizeDims:a.getParameter(C),lineWidthDims:a.getParameter(ve),maxViewportDims:a.getParameter(mt),maxCombinedTextureUnits:a.getParameter(gn),maxCubeMapSize:a.getParameter(No),maxRenderbufferSize:a.getParameter(Go),maxTextureUnits:a.getParameter(Si),maxTextureSize:a.getParameter(De),maxAttributes:a.getParameter(Ot),maxVertexUniforms:a.getParameter(At),maxVertexTextureUnits:a.getParameter(dr),maxVaryingVectors:a.getParameter(jt),maxFragmentUniforms:a.getParameter(Mt),glsl:a.getParameter(Lg),renderer:a.getParameter(Cg),vendor:a.getParameter(Pg),version:a.getParameter(kg),readFloat:z,npotTextureCube:ae}};function yn(a){return!!a&&typeof a=="object"&&Array.isArray(a.shape)&&Array.isArray(a.stride)&&typeof a.offset=="number"&&a.shape.length===a.stride.length&&(Array.isArray(a.data)||n(a.data))}var nn=function(a){return Object.keys(a).map(function(h){return a[h]})},Uo={shape:$g,flatten:Vg};function Bg(a,h,_){for(var O=0;O<h;++O)_[O]=a[O]}function Ug(a,h,_,O){for(var j=0,z=0;z<h;++z)for(var B=a[z],K=0;K<_;++K)O[j++]=B[K]}function il(a,h,_,O,j,z){for(var B=z,K=0;K<h;++K)for(var Q=a[K],ie=0;ie<_;++ie)for(var ae=Q[ie],oe=0;oe<O;++oe)j[B++]=ae[oe]}function ol(a,h,_,O,j){for(var z=1,B=_+1;B<h.length;++B)z*=h[B];var K=h[_];if(h.length-_===4){var Q=h[_+1],ie=h[_+2],ae=h[_+3];for(B=0;B<K;++B)il(a[B],Q,ie,ae,O,j),j+=z}else for(B=0;B<K;++B)ol(a[B],h,_+1,O,j),j+=z}function Vg(a,h,_,O){var j=1;if(h.length)for(var z=0;z<h.length;++z)j*=h[z];else j=0;var B=O||gt.allocType(_,j);switch(h.length){case 0:break;case 1:Bg(a,h[0],B);break;case 2:Ug(a,h[0],h[1],B);break;case 3:il(a,h[0],h[1],h[2],B,0);break;default:ol(a,h,0,B,0)}return B}function $g(a){for(var h=[],_=a;_.length;_=_[0])h.push(_.length);return h}var ds={"[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},Hg=5120,jg=5122,Xg=5124,Wg=5121,qg=5123,Yg=5125,Zg=5126,Qg=5126,mr={int8:Hg,int16:jg,int32:Xg,uint8:Wg,uint16:qg,uint32:Yg,float:Zg,float32:Qg},Kg=35048,Jg=35040,Vo={dynamic:Kg,stream:Jg,static:35044},ms=Uo.flatten,al=Uo.shape,sl=35044,ey=35040,ps=5121,vs=5126,qn=[];qn[5120]=1,qn[5122]=2,qn[5124]=4,qn[5121]=1,qn[5123]=2,qn[5125]=4,qn[5126]=4;function $o(a){return ds[Object.prototype.toString.call(a)]|0}function fl(a,h){for(var _=0;_<h.length;++_)a[_]=h[_]}function ul(a,h,_,O,j,z,B){for(var K=0,Q=0;Q<_;++Q)for(var ie=0;ie<O;++ie)a[K++]=h[j*Q+z*ie+B]}function ty(a,h,_,O){var j=0,z={};function B(k){this.id=j++,this.buffer=a.createBuffer(),this.type=k,this.usage=sl,this.byteLength=0,this.dimension=1,this.dtype=ps,this.persistentData=null,_.profile&&(this.stats={size:0})}B.prototype.bind=function(){a.bindBuffer(this.type,this.buffer)},B.prototype.destroy=function(){le(this)};var K=[];function Q(k,G){var te=K.pop();return te||(te=new B(k)),te.bind(),oe(te,G,ey,0,1,!1),te}function ie(k){K.push(k)}function ae(k,G,te){k.byteLength=G.byteLength,a.bufferData(k.type,G,te)}function oe(k,G,te,xe,Z,ge){var me;if(k.usage=te,Array.isArray(G)){if(k.dtype=xe||vs,G.length>0){var Fe;if(Array.isArray(G[0])){me=al(G);for(var X=1,$=1;$<me.length;++$)X*=me[$];k.dimension=X,Fe=ms(G,me,k.dtype),ae(k,Fe,te),ge?k.persistentData=Fe:gt.freeType(Fe)}else if(typeof G[0]=="number"){k.dimension=Z;var Se=gt.allocType(k.dtype,G.length);fl(Se,G),ae(k,Se,te),ge?k.persistentData=Se:gt.freeType(Se)}else n(G[0])?(k.dimension=G[0].length,k.dtype=xe||$o(G[0])||vs,Fe=ms(G,[G.length,G[0].length],k.dtype),ae(k,Fe,te),ge?k.persistentData=Fe:gt.freeType(Fe)):d.raise("invalid buffer data")}}else if(n(G))k.dtype=xe||$o(G),k.dimension=Z,ae(k,G,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(G.buffer)));else if(yn(G)){me=G.shape;var ce=G.stride,ee=G.offset,he=0,de=0,Ve=0,Ne=0;me.length===1?(he=me[0],de=1,Ve=ce[0],Ne=0):me.length===2?(he=me[0],de=me[1],Ve=ce[0],Ne=ce[1]):d.raise("invalid shape"),k.dtype=xe||$o(G.data)||vs,k.dimension=de;var pe=gt.allocType(k.dtype,he*de);ul(pe,G.data,he,de,Ve,Ne,ee),ae(k,pe,te),ge?k.persistentData=pe:gt.freeType(pe)}else G instanceof ArrayBuffer?(k.dtype=ps,k.dimension=Z,ae(k,G,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(G)))):d.raise("invalid buffer data")}function le(k){h.bufferCount--,O(k);var G=k.buffer;d(G,"buffer must not be deleted already"),a.deleteBuffer(G),k.buffer=null,delete z[k.id]}function J(k,G,te,xe){h.bufferCount++;var Z=new B(G);z[Z.id]=Z;function ge(X){var $=sl,Se=null,ce=0,ee=0,he=1;return Array.isArray(X)||n(X)||yn(X)||X instanceof ArrayBuffer?Se=X:typeof X=="number"?ce=X|0:X&&(d.type(X,"object","buffer arguments must be an object, a number or an array"),"data"in X&&(d(Se===null||Array.isArray(Se)||n(Se)||yn(Se),"invalid data for buffer"),Se=X.data),"usage"in X&&(d.parameter(X.usage,Vo,"invalid buffer usage"),$=Vo[X.usage]),"type"in X&&(d.parameter(X.type,mr,"invalid buffer type"),ee=mr[X.type]),"dimension"in X&&(d.type(X.dimension,"number","invalid dimension"),he=X.dimension|0),"length"in X&&(d.nni(ce,"buffer length must be a nonnegative integer"),ce=X.length|0)),Z.bind(),Se?oe(Z,Se,$,ee,he,xe):(ce&&a.bufferData(Z.type,ce,$),Z.dtype=ee||ps,Z.usage=$,Z.dimension=he,Z.byteLength=ce),_.profile&&(Z.stats.size=Z.byteLength*qn[Z.dtype]),ge}function me(X,$){d($+X.byteLength<=Z.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+X.byteLength+" starting from offset "+$+" to a buffer of size "+Z.byteLength),a.bufferSubData(Z.type,$,X)}function Fe(X,$){var Se=($||0)|0,ce;if(Z.bind(),n(X)||X instanceof ArrayBuffer)me(X,Se);else if(Array.isArray(X)){if(X.length>0)if(typeof X[0]=="number"){var ee=gt.allocType(Z.dtype,X.length);fl(ee,X),me(ee,Se),gt.freeType(ee)}else if(Array.isArray(X[0])||n(X[0])){ce=al(X);var he=ms(X,ce,Z.dtype);me(he,Se),gt.freeType(he)}else d.raise("invalid buffer data")}else if(yn(X)){ce=X.shape;var de=X.stride,Ve=0,Ne=0,pe=0,ye=0;ce.length===1?(Ve=ce[0],Ne=1,pe=de[0],ye=0):ce.length===2?(Ve=ce[0],Ne=ce[1],pe=de[0],ye=de[1]):d.raise("invalid shape");var ze=Array.isArray(X.data)?Z.dtype:$o(X.data),$e=gt.allocType(ze,Ve*Ne);ul($e,X.data,Ve,Ne,pe,ye,X.offset),me($e,Se),gt.freeType($e)}else d.raise("invalid data for buffer subdata");return ge}return te||ge(k),ge._reglType="buffer",ge._buffer=Z,ge.subdata=Fe,_.profile&&(ge.stats=Z.stats),ge.destroy=function(){le(Z)},ge}function ne(){nn(z).forEach(function(k){k.buffer=a.createBuffer(),a.bindBuffer(k.type,k.buffer),a.bufferData(k.type,k.persistentData||k.byteLength,k.usage)})}return _.profile&&(h.getTotalBufferSize=function(){var k=0;return Object.keys(z).forEach(function(G){k+=z[G].stats.size}),k}),{create:J,createStream:Q,destroyStream:ie,clear:function(){nn(z).forEach(le),K.forEach(le)},getBuffer:function(k){return k&&k._buffer instanceof B?k._buffer:null},restore:ne,_initBuffer:oe}}var ny=0,ry=0,iy=1,oy=1,ay=4,sy=4,Yn={points:ny,point:ry,lines:iy,line:oy,triangles:ay,triangle:sy,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},fy=0,uy=1,wi=4,ly=5120,Ur=5121,ll=5122,Vr=5123,cl=5124,pr=5125,gs=34963,cy=35040,hy=35044;function dy(a,h,_,O){var j={},z=0,B={uint8:Ur,uint16:Vr};h.oes_element_index_uint&&(B.uint32=pr);function K(ne){this.id=z++,j[this.id]=this,this.buffer=ne,this.primType=wi,this.vertCount=0,this.type=0}K.prototype.bind=function(){this.buffer.bind()};var Q=[];function ie(ne){var k=Q.pop();return k||(k=new K(_.create(null,gs,!0,!1)._buffer)),oe(k,ne,cy,-1,-1,0,0),k}function ae(ne){Q.push(ne)}function oe(ne,k,G,te,xe,Z,ge){ne.buffer.bind();var me;if(k){var Fe=ge;!ge&&(!n(k)||yn(k)&&!n(k.data))&&(Fe=h.oes_element_index_uint?pr:Vr),_._initBuffer(ne.buffer,k,G,Fe,3)}else a.bufferData(gs,Z,G),ne.buffer.dtype=me||Ur,ne.buffer.usage=G,ne.buffer.dimension=3,ne.buffer.byteLength=Z;if(me=ge,!ge){switch(ne.buffer.dtype){case Ur:case ly:me=Ur;break;case Vr:case ll:me=Vr;break;case pr:case cl:me=pr;break;default:d.raise("unsupported type for element array")}ne.buffer.dtype=me}ne.type=me,d(me!==pr||!!h.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var X=xe;X<0&&(X=ne.buffer.byteLength,me===Vr?X>>=1:me===pr&&(X>>=2)),ne.vertCount=X;var $=te;if(te<0){$=wi;var Se=ne.buffer.dimension;Se===1&&($=fy),Se===2&&($=uy),Se===3&&($=wi)}ne.primType=$}function le(ne){O.elementsCount--,d(ne.buffer!==null,"must not double destroy elements"),delete j[ne.id],ne.buffer.destroy(),ne.buffer=null}function J(ne,k){var G=_.create(null,gs,!0),te=new K(G._buffer);O.elementsCount++;function xe(Z){if(!Z)G(),te.primType=wi,te.vertCount=0,te.type=Ur;else if(typeof Z=="number")G(Z),te.primType=wi,te.vertCount=Z|0,te.type=Ur;else{var ge=null,me=hy,Fe=-1,X=-1,$=0,Se=0;Array.isArray(Z)||n(Z)||yn(Z)?ge=Z:(d.type(Z,"object","invalid arguments for elements"),"data"in Z&&(ge=Z.data,d(Array.isArray(ge)||n(ge)||yn(ge),"invalid data for element buffer")),"usage"in Z&&(d.parameter(Z.usage,Vo,"invalid element buffer usage"),me=Vo[Z.usage]),"primitive"in Z&&(d.parameter(Z.primitive,Yn,"invalid element buffer primitive"),Fe=Yn[Z.primitive]),"count"in Z&&(d(typeof Z.count=="number"&&Z.count>=0,"invalid vertex count for elements"),X=Z.count|0),"type"in Z&&(d.parameter(Z.type,B,"invalid buffer type"),Se=B[Z.type]),"length"in Z?$=Z.length|0:($=X,Se===Vr||Se===ll?$*=2:(Se===pr||Se===cl)&&($*=4))),oe(te,ge,me,Fe,X,$,Se)}return xe}return xe(ne),xe._reglType="elements",xe._elements=te,xe.subdata=function(Z,ge){return G.subdata(Z,ge),xe},xe.destroy=function(){le(te)},xe}return{create:J,createStream:ie,destroyStream:ae,getElements:function(ne){return typeof ne=="function"&&ne._elements instanceof K?ne._elements:null},clear:function(){nn(j).forEach(le)}}}var hl=new Float32Array(1),my=new Uint32Array(hl.buffer),py=5123;function dl(a){for(var h=gt.allocType(py,a.length),_=0;_<a.length;++_)if(isNaN(a[_]))h[_]=65535;else if(a[_]===1/0)h[_]=31744;else if(a[_]===-1/0)h[_]=64512;else{hl[0]=a[_];var O=my[0],j=O>>>31<<15,z=(O<<1>>>24)-127,B=O>>13&1023;if(z<-24)h[_]=j;else if(z<-14){var K=-14-z;h[_]=j+(B+1024>>K)}else z>15?h[_]=j+31744:h[_]=j+(z+15<<10)+B}return h}function pt(a){return Array.isArray(a)||n(a)}var ml=function(a){return!(a&a-1)&&!!a},vy=34467,An=3553,ys=34067,Ho=34069,vr=6408,xs=6406,jo=6407,Ai=6409,Xo=6410,pl=32854,bs=32855,vl=36194,gy=32819,yy=32820,xy=33635,by=34042,_s=6402,Wo=34041,Ss=35904,Ts=35906,$r=36193,ws=33776,As=33777,Es=33778,Ps=33779,gl=35986,yl=35987,xl=34798,bl=35840,_l=35841,Sl=35842,Tl=35843,wl=36196,Hr=5121,Cs=5123,ks=5125,Ei=5126,_y=10242,Sy=10243,Ty=10497,Ls=33071,wy=33648,Ay=10240,Ey=10241,Fs=9728,Py=9729,Rs=9984,Al=9985,El=9986,Is=9987,Cy=33170,qo=4352,ky=4353,Ly=4354,Fy=34046,Ry=3317,Iy=37440,Dy=37441,zy=37443,Pl=37444,Pi=33984,Oy=[Rs,El,Al,Is],Yo=[0,Ai,Xo,jo,vr],fn={};fn[Ai]=fn[xs]=fn[_s]=1,fn[Wo]=fn[Xo]=2,fn[jo]=fn[Ss]=3,fn[vr]=fn[Ts]=4;function jr(a){return"[object "+a+"]"}var Cl=jr("HTMLCanvasElement"),kl=jr("OffscreenCanvas"),Ll=jr("CanvasRenderingContext2D"),Fl=jr("ImageBitmap"),Rl=jr("HTMLImageElement"),Il=jr("HTMLVideoElement"),My=Object.keys(ds).concat([Cl,kl,Ll,Fl,Rl,Il]),Xr=[];Xr[Hr]=1,Xr[Ei]=4,Xr[$r]=2,Xr[Cs]=2,Xr[ks]=4;var Nt=[];Nt[pl]=2,Nt[bs]=2,Nt[vl]=2,Nt[Wo]=4,Nt[ws]=.5,Nt[As]=.5,Nt[Es]=1,Nt[Ps]=1,Nt[gl]=.5,Nt[yl]=1,Nt[xl]=1,Nt[bl]=.5,Nt[_l]=.25,Nt[Sl]=.5,Nt[Tl]=.25,Nt[wl]=.5;function Dl(a){return Array.isArray(a)&&(a.length===0||typeof a[0]=="number")}function zl(a){if(!Array.isArray(a))return!1;var h=a.length;return!(h===0||!pt(a[0]))}function gr(a){return Object.prototype.toString.call(a)}function Ol(a){return gr(a)===Cl}function Ml(a){return gr(a)===kl}function Ny(a){return gr(a)===Ll}function Gy(a){return gr(a)===Fl}function By(a){return gr(a)===Rl}function Uy(a){return gr(a)===Il}function Ds(a){if(!a)return!1;var h=gr(a);return My.indexOf(h)>=0?!0:Dl(a)||zl(a)||yn(a)}function Nl(a){return ds[Object.prototype.toString.call(a)]|0}function Vy(a,h){var _=h.length;switch(a.type){case Hr:case Cs:case ks:case Ei:var O=gt.allocType(a.type,_);O.set(h),a.data=O;break;case $r:a.data=dl(h);break;default:d.raise("unsupported texture type, must specify a typed array")}}function Gl(a,h){return gt.allocType(a.type===$r?Ei:a.type,h)}function Bl(a,h){a.type===$r?(a.data=dl(h),gt.freeType(h)):a.data=h}function $y(a,h,_,O,j,z){for(var B=a.width,K=a.height,Q=a.channels,ie=B*K*Q,ae=Gl(a,ie),oe=0,le=0;le<K;++le)for(var J=0;J<B;++J)for(var ne=0;ne<Q;++ne)ae[oe++]=h[_*J+O*le+j*ne+z];Bl(a,ae)}function Zo(a,h,_,O,j,z){var B;if(typeof Nt[a]<"u"?B=Nt[a]:B=fn[a]*Xr[h],z&&(B*=6),j){for(var K=0,Q=_;Q>=1;)K+=B*Q*Q,Q/=2;return K}else return B*_*O}function Hy(a,h,_,O,j,z,B){var K={"don't care":qo,"dont care":qo,nice:Ly,fast:ky},Q={repeat:Ty,clamp:Ls,mirror:wy},ie={nearest:Fs,linear:Py},ae=r({mipmap:Is,"nearest mipmap nearest":Rs,"linear mipmap nearest":Al,"nearest mipmap linear":El,"linear mipmap linear":Is},ie),oe={none:0,browser:Pl},le={uint8:Hr,rgba4:gy,rgb565:xy,"rgb5 a1":yy},J={alpha:xs,luminance:Ai,"luminance alpha":Xo,rgb:jo,rgba:vr,rgba4:pl,"rgb5 a1":bs,rgb565:vl},ne={};h.ext_srgb&&(J.srgb=Ss,J.srgba=Ts),h.oes_texture_float&&(le.float32=le.float=Ei),h.oes_texture_half_float&&(le.float16=le["half float"]=$r),h.webgl_depth_texture&&(r(J,{depth:_s,"depth stencil":Wo}),r(le,{uint16:Cs,uint32:ks,"depth stencil":by})),h.webgl_compressed_texture_s3tc&&r(ne,{"rgb s3tc dxt1":ws,"rgba s3tc dxt1":As,"rgba s3tc dxt3":Es,"rgba s3tc dxt5":Ps}),h.webgl_compressed_texture_atc&&r(ne,{"rgb atc":gl,"rgba atc explicit alpha":yl,"rgba atc interpolated alpha":xl}),h.webgl_compressed_texture_pvrtc&&r(ne,{"rgb pvrtc 4bppv1":bl,"rgb pvrtc 2bppv1":_l,"rgba pvrtc 4bppv1":Sl,"rgba pvrtc 2bppv1":Tl}),h.webgl_compressed_texture_etc1&&(ne["rgb etc1"]=wl);var k=Array.prototype.slice.call(a.getParameter(vy));Object.keys(ne).forEach(function(y){var M=ne[y];k.indexOf(M)>=0&&(J[y]=M)});var G=Object.keys(J);_.textureFormats=G;var te=[];Object.keys(J).forEach(function(y){var M=J[y];te[M]=y});var xe=[];Object.keys(le).forEach(function(y){var M=le[y];xe[M]=y});var Z=[];Object.keys(ie).forEach(function(y){var M=ie[y];Z[M]=y});var ge=[];Object.keys(ae).forEach(function(y){var M=ae[y];ge[M]=y});var me=[];Object.keys(Q).forEach(function(y){var M=Q[y];me[M]=y});var Fe=G.reduce(function(y,M){var I=J[M];return I===Ai||I===xs||I===Ai||I===Xo||I===_s||I===Wo||h.ext_srgb&&(I===Ss||I===Ts)?y[I]=I:I===bs||M.indexOf("rgba")>=0?y[I]=vr:y[I]=jo,y},{});function X(){this.internalformat=vr,this.format=vr,this.type=Hr,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Pl,this.width=0,this.height=0,this.channels=0}function $(y,M){y.internalformat=M.internalformat,y.format=M.format,y.type=M.type,y.compressed=M.compressed,y.premultiplyAlpha=M.premultiplyAlpha,y.flipY=M.flipY,y.unpackAlignment=M.unpackAlignment,y.colorSpace=M.colorSpace,y.width=M.width,y.height=M.height,y.channels=M.channels}function Se(y,M){if(!(typeof M!="object"||!M)){if("premultiplyAlpha"in M&&(d.type(M.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),y.premultiplyAlpha=M.premultiplyAlpha),"flipY"in M&&(d.type(M.flipY,"boolean","invalid texture flip"),y.flipY=M.flipY),"alignment"in M&&(d.oneOf(M.alignment,[1,2,4,8],"invalid texture unpack alignment"),y.unpackAlignment=M.alignment),"colorSpace"in M&&(d.parameter(M.colorSpace,oe,"invalid colorSpace"),y.colorSpace=oe[M.colorSpace]),"type"in M){var I=M.type;d(h.oes_texture_float||!(I==="float"||I==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),d(h.oes_texture_half_float||!(I==="half float"||I==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),d(h.webgl_depth_texture||!(I==="uint16"||I==="uint32"||I==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),d.parameter(I,le,"invalid texture type"),y.type=le[I]}var _e=y.width,Ke=y.height,m=y.channels,c=!1;"shape"in M?(d(Array.isArray(M.shape)&&M.shape.length>=2,"shape must be an array"),_e=M.shape[0],Ke=M.shape[1],M.shape.length===3&&(m=M.shape[2],d(m>0&&m<=4,"invalid number of channels"),c=!0),d(_e>=0&&_e<=_.maxTextureSize,"invalid width"),d(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")):("radius"in M&&(_e=Ke=M.radius,d(_e>=0&&_e<=_.maxTextureSize,"invalid radius")),"width"in M&&(_e=M.width,d(_e>=0&&_e<=_.maxTextureSize,"invalid width")),"height"in M&&(Ke=M.height,d(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")),"channels"in M&&(m=M.channels,d(m>0&&m<=4,"invalid number of channels"),c=!0)),y.width=_e|0,y.height=Ke|0,y.channels=m|0;var T=!1;if("format"in M){var P=M.format;d(h.webgl_depth_texture||!(P==="depth"||P==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),d.parameter(P,J,"invalid texture format");var L=y.internalformat=J[P];y.format=Fe[L],P in le&&("type"in M||(y.type=le[P])),P in ne&&(y.compressed=!0),T=!0}!c&&T?y.channels=fn[y.format]:c&&!T?y.channels!==Yo[y.format]&&(y.format=y.internalformat=Yo[y.channels]):T&&c&&d(y.channels===fn[y.format],"number of channels inconsistent with specified format")}}function ce(y){a.pixelStorei(Iy,y.flipY),a.pixelStorei(Dy,y.premultiplyAlpha),a.pixelStorei(zy,y.colorSpace),a.pixelStorei(Ry,y.unpackAlignment)}function ee(){X.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function he(y,M){var I=null;if(Ds(M)?I=M:M&&(d.type(M,"object","invalid pixel data type"),Se(y,M),"x"in M&&(y.xOffset=M.x|0),"y"in M&&(y.yOffset=M.y|0),Ds(M.data)&&(I=M.data)),d(!y.compressed||I instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),M.copy){d(!I,"can not specify copy and data field for the same texture");var _e=j.viewportWidth,Ke=j.viewportHeight;y.width=y.width||_e-y.xOffset,y.height=y.height||Ke-y.yOffset,y.needsCopy=!0,d(y.xOffset>=0&&y.xOffset<_e&&y.yOffset>=0&&y.yOffset<Ke&&y.width>0&&y.width<=_e&&y.height>0&&y.height<=Ke,"copy texture read out of bounds")}else if(!I)y.width=y.width||1,y.height=y.height||1,y.channels=y.channels||4;else if(n(I))y.channels=y.channels||4,y.data=I,!("type"in M)&&y.type===Hr&&(y.type=Nl(I));else if(Dl(I))y.channels=y.channels||4,Vy(y,I),y.alignment=1,y.needsFree=!0;else if(yn(I)){var m=I.data;!Array.isArray(m)&&y.type===Hr&&(y.type=Nl(m));var c=I.shape,T=I.stride,P,L,A,w,E,v;c.length===3?(A=c[2],v=T[2]):(d(c.length===2,"invalid ndarray pixel data, must be 2 or 3D"),A=1,v=1),P=c[0],L=c[1],w=T[0],E=T[1],y.alignment=1,y.width=P,y.height=L,y.channels=A,y.format=y.internalformat=Yo[A],y.needsFree=!0,$y(y,m,w,E,v,I.offset)}else if(Ol(I)||Ml(I)||Ny(I))Ol(I)||Ml(I)?y.element=I:y.element=I.canvas,y.width=y.element.width,y.height=y.element.height,y.channels=4;else if(Gy(I))y.element=I,y.width=I.width,y.height=I.height,y.channels=4;else if(By(I))y.element=I,y.width=I.naturalWidth,y.height=I.naturalHeight,y.channels=4;else if(Uy(I))y.element=I,y.width=I.videoWidth,y.height=I.videoHeight,y.channels=4;else if(zl(I)){var b=y.width||I[0].length,g=y.height||I.length,R=y.channels;pt(I[0][0])?R=R||I[0][0].length:R=R||1;for(var F=Uo.shape(I),V=1,W=0;W<F.length;++W)V*=F[W];var ue=Gl(y,V);Uo.flatten(I,F,"",ue),Bl(y,ue),y.alignment=1,y.width=b,y.height=g,y.channels=R,y.format=y.internalformat=Yo[R],y.needsFree=!0}y.type===Ei?d(_.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):y.type===$r&&d(_.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function de(y,M,I){var _e=y.element,Ke=y.data,m=y.internalformat,c=y.format,T=y.type,P=y.width,L=y.height;ce(y),_e?a.texImage2D(M,I,c,c,T,_e):y.compressed?a.compressedTexImage2D(M,I,m,P,L,0,Ke):y.needsCopy?(O(),a.copyTexImage2D(M,I,c,y.xOffset,y.yOffset,P,L,0)):a.texImage2D(M,I,c,P,L,0,c,T,Ke||null)}function Ve(y,M,I,_e,Ke){var m=y.element,c=y.data,T=y.internalformat,P=y.format,L=y.type,A=y.width,w=y.height;ce(y),m?a.texSubImage2D(M,Ke,I,_e,P,L,m):y.compressed?a.compressedTexSubImage2D(M,Ke,I,_e,T,A,w,c):y.needsCopy?(O(),a.copyTexSubImage2D(M,Ke,I,_e,y.xOffset,y.yOffset,A,w)):a.texSubImage2D(M,Ke,I,_e,A,w,P,L,c)}var Ne=[];function pe(){return Ne.pop()||new ee}function ye(y){y.needsFree&>.freeType(y.data),ee.call(y),Ne.push(y)}function ze(){X.call(this),this.genMipmaps=!1,this.mipmapHint=qo,this.mipmask=0,this.images=Array(16)}function $e(y,M,I){var _e=y.images[0]=pe();y.mipmask=1,_e.width=y.width=M,_e.height=y.height=I,_e.channels=y.channels=4}function Je(y,M){var I=null;if(Ds(M))I=y.images[0]=pe(),$(I,y),he(I,M),y.mipmask=1;else if(Se(y,M),Array.isArray(M.mipmap))for(var _e=M.mipmap,Ke=0;Ke<_e.length;++Ke)I=y.images[Ke]=pe(),$(I,y),I.width>>=Ke,I.height>>=Ke,he(I,_e[Ke]),y.mipmask|=1<<Ke;else I=y.images[0]=pe(),$(I,y),he(I,M),y.mipmask=1;$(y,y.images[0]),y.compressed&&(y.internalformat===ws||y.internalformat===As||y.internalformat===Es||y.internalformat===Ps)&&d(y.width%4===0&&y.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function vt(y,M){for(var I=y.images,_e=0;_e<I.length;++_e){if(!I[_e])return;de(I[_e],M,_e)}}var yt=[];function tt(){var y=yt.pop()||new ze;X.call(y),y.mipmask=0;for(var M=0;M<16;++M)y.images[M]=null;return y}function Et(y){for(var M=y.images,I=0;I<M.length;++I)M[I]&&ye(M[I]),M[I]=null;yt.push(y)}function ht(){this.minFilter=Fs,this.magFilter=Fs,this.wrapS=Ls,this.wrapT=Ls,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=qo}function Tt(y,M){if("min"in M){var I=M.min;d.parameter(I,ae),y.minFilter=ae[I],Oy.indexOf(y.minFilter)>=0&&!("faces"in M)&&(y.genMipmaps=!0)}if("mag"in M){var _e=M.mag;d.parameter(_e,ie),y.magFilter=ie[_e]}var Ke=y.wrapS,m=y.wrapT;if("wrap"in M){var c=M.wrap;typeof c=="string"?(d.parameter(c,Q),Ke=m=Q[c]):Array.isArray(c)&&(d.parameter(c[0],Q),d.parameter(c[1],Q),Ke=Q[c[0]],m=Q[c[1]])}else{if("wrapS"in M){var T=M.wrapS;d.parameter(T,Q),Ke=Q[T]}if("wrapT"in M){var P=M.wrapT;d.parameter(P,Q),m=Q[P]}}if(y.wrapS=Ke,y.wrapT=m,"anisotropic"in M){var L=M.anisotropic;d(typeof L=="number"&&L>=1&&L<=_.maxAnisotropic,"aniso samples must be between 1 and "),y.anisotropic=M.anisotropic}if("mipmap"in M){var A=!1;switch(typeof M.mipmap){case"string":d.parameter(M.mipmap,K,"invalid mipmap hint"),y.mipmapHint=K[M.mipmap],y.genMipmaps=!0,A=!0;break;case"boolean":A=y.genMipmaps=M.mipmap;break;case"object":d(Array.isArray(M.mipmap),"invalid mipmap type"),y.genMipmaps=!1,A=!0;break;default:d.raise("invalid mipmap type")}A&&!("min"in M)&&(y.minFilter=Rs)}}function Pt(y,M){a.texParameteri(M,Ey,y.minFilter),a.texParameteri(M,Ay,y.magFilter),a.texParameteri(M,_y,y.wrapS),a.texParameteri(M,Sy,y.wrapT),h.ext_texture_filter_anisotropic&&a.texParameteri(M,Fy,y.anisotropic),y.genMipmaps&&(a.hint(Cy,y.mipmapHint),a.generateMipmap(M))}var Ct=0,It={},Gt=_.maxTextureUnits,xt=Array(Gt).map(function(){return null});function qe(y){X.call(this),this.mipmask=0,this.internalformat=vr,this.id=Ct++,this.refCount=1,this.target=y,this.texture=a.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new ht,B.profile&&(this.stats={size:0})}function Bt(y){a.activeTexture(Pi),a.bindTexture(y.target,y.texture)}function ot(){var y=xt[0];y?a.bindTexture(y.target,y.texture):a.bindTexture(An,null)}function Ie(y){var M=y.texture;d(M,"must not double destroy texture");var I=y.unit,_e=y.target;I>=0&&(a.activeTexture(Pi+I),a.bindTexture(_e,null),xt[I]=null),a.deleteTexture(M),y.texture=null,y.params=null,y.pixels=null,y.refCount=0,delete It[y.id],z.textureCount--}r(qe.prototype,{bind:function(){var y=this;y.bindCount+=1;var M=y.unit;if(M<0){for(var I=0;I<Gt;++I){var _e=xt[I];if(_e){if(_e.bindCount>0)continue;_e.unit=-1}xt[I]=y,M=I;break}M>=Gt&&d.raise("insufficient number of texture units"),B.profile&&z.maxTextureUnits<M+1&&(z.maxTextureUnits=M+1),y.unit=M,a.activeTexture(Pi+M),a.bindTexture(y.target,y.texture)}return M},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Ie(this)}});function et(y,M){var I=new qe(An);It[I.id]=I,z.textureCount++;function _e(c,T){var P=I.texInfo;ht.call(P);var L=tt();return typeof c=="number"?typeof T=="number"?$e(L,c|0,T|0):$e(L,c|0,c|0):c?(d.type(c,"object","invalid arguments to regl.texture"),Tt(P,c),Je(L,c)):$e(L,1,1),P.genMipmaps&&(L.mipmask=(L.width<<1)-1),I.mipmask=L.mipmask,$(I,L),d.texture2D(P,L,_),I.internalformat=L.internalformat,_e.width=L.width,_e.height=L.height,Bt(I),vt(L,An),Pt(P,An),ot(),Et(L),B.profile&&(I.stats.size=Zo(I.internalformat,I.type,L.width,L.height,P.genMipmaps,!1)),_e.format=te[I.internalformat],_e.type=xe[I.type],_e.mag=Z[P.magFilter],_e.min=ge[P.minFilter],_e.wrapS=me[P.wrapS],_e.wrapT=me[P.wrapT],_e}function Ke(c,T,P,L){d(!!c,"must specify image data");var A=T|0,w=P|0,E=L|0,v=pe();return $(v,I),v.width=0,v.height=0,he(v,c),v.width=v.width||(I.width>>E)-A,v.height=v.height||(I.height>>E)-w,d(I.type===v.type&&I.format===v.format&&I.internalformat===v.internalformat,"incompatible format for texture.subimage"),d(A>=0&&w>=0&&A+v.width<=I.width&&w+v.height<=I.height,"texture.subimage write out of bounds"),d(I.mipmask&1<<E,"missing mipmap data"),d(v.data||v.element||v.needsCopy,"missing image data"),Bt(I),Ve(v,An,A,w,E),ot(),ye(v),_e}function m(c,T){var P=c|0,L=T|0||P;if(P===I.width&&L===I.height)return _e;_e.width=I.width=P,_e.height=I.height=L,Bt(I);for(var A=0;I.mipmask>>A;++A){var w=P>>A,E=L>>A;if(!w||!E)break;a.texImage2D(An,A,I.format,w,E,0,I.format,I.type,null)}return ot(),B.profile&&(I.stats.size=Zo(I.internalformat,I.type,P,L,!1,!1)),_e}return _e(y,M),_e.subimage=Ke,_e.resize=m,_e._reglType="texture2d",_e._texture=I,B.profile&&(_e.stats=I.stats),_e.destroy=function(){I.decRef()},_e}function nt(y,M,I,_e,Ke,m){var c=new qe(ys);It[c.id]=c,z.cubeCount++;var T=new Array(6);function P(w,E,v,b,g,R){var F,V=c.texInfo;for(ht.call(V),F=0;F<6;++F)T[F]=tt();if(typeof w=="number"||!w){var W=w|0||1;for(F=0;F<6;++F)$e(T[F],W,W)}else if(typeof w=="object")if(E)Je(T[0],w),Je(T[1],E),Je(T[2],v),Je(T[3],b),Je(T[4],g),Je(T[5],R);else if(Tt(V,w),Se(c,w),"faces"in w){var ue=w.faces;for(d(Array.isArray(ue)&&ue.length===6,"cube faces must be a length 6 array"),F=0;F<6;++F)d(typeof ue[F]=="object"&&!!ue[F],"invalid input for cube map face"),$(T[F],c),Je(T[F],ue[F])}else for(F=0;F<6;++F)Je(T[F],w);else d.raise("invalid arguments to cube map");for($(c,T[0]),d.optional(function(){_.npotTextureCube||d(ml(c.width)&&ml(c.height),"your browser does not support non power or two texture dimensions")}),V.genMipmaps?c.mipmask=(T[0].width<<1)-1:c.mipmask=T[0].mipmask,d.textureCube(c,V,T,_),c.internalformat=T[0].internalformat,P.width=T[0].width,P.height=T[0].height,Bt(c),F=0;F<6;++F)vt(T[F],Ho+F);for(Pt(V,ys),ot(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,P.width,P.height,V.genMipmaps,!0)),P.format=te[c.internalformat],P.type=xe[c.type],P.mag=Z[V.magFilter],P.min=ge[V.minFilter],P.wrapS=me[V.wrapS],P.wrapT=me[V.wrapT],F=0;F<6;++F)Et(T[F]);return P}function L(w,E,v,b,g){d(!!E,"must specify image data"),d(typeof w=="number"&&w===(w|0)&&w>=0&&w<6,"invalid face");var R=v|0,F=b|0,V=g|0,W=pe();return $(W,c),W.width=0,W.height=0,he(W,E),W.width=W.width||(c.width>>V)-R,W.height=W.height||(c.height>>V)-F,d(c.type===W.type&&c.format===W.format&&c.internalformat===W.internalformat,"incompatible format for texture.subimage"),d(R>=0&&F>=0&&R+W.width<=c.width&&F+W.height<=c.height,"texture.subimage write out of bounds"),d(c.mipmask&1<<V,"missing mipmap data"),d(W.data||W.element||W.needsCopy,"missing image data"),Bt(c),Ve(W,Ho+w,R,F,V),ot(),ye(W),P}function A(w){var E=w|0;if(E!==c.width){P.width=c.width=E,P.height=c.height=E,Bt(c);for(var v=0;v<6;++v)for(var b=0;c.mipmask>>b;++b)a.texImage2D(Ho+v,b,c.format,E>>b,E>>b,0,c.format,c.type,null);return ot(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,P.width,P.height,!1,!0)),P}}return P(y,M,I,_e,Ke,m),P.subimage=L,P.resize=A,P._reglType="textureCube",P._texture=c,B.profile&&(P.stats=c.stats),P.destroy=function(){c.decRef()},P}function bt(){for(var y=0;y<Gt;++y)a.activeTexture(Pi+y),a.bindTexture(An,null),xt[y]=null;nn(It).forEach(Ie),z.cubeCount=0,z.textureCount=0}B.profile&&(z.getTotalTextureSize=function(){var y=0;return Object.keys(It).forEach(function(M){y+=It[M].stats.size}),y});function Pn(){for(var y=0;y<Gt;++y){var M=xt[y];M&&(M.bindCount=0,M.unit=-1,xt[y]=null)}nn(It).forEach(function(I){I.texture=a.createTexture(),a.bindTexture(I.target,I.texture);for(var _e=0;_e<32;++_e)if((I.mipmask&1<<_e)!==0)if(I.target===An)a.texImage2D(An,_e,I.internalformat,I.width>>_e,I.height>>_e,0,I.internalformat,I.type,null);else for(var Ke=0;Ke<6;++Ke)a.texImage2D(Ho+Ke,_e,I.internalformat,I.width>>_e,I.height>>_e,0,I.internalformat,I.type,null);Pt(I.texInfo,I.target)})}function wr(){for(var y=0;y<Gt;++y){var M=xt[y];M&&(M.bindCount=0,M.unit=-1,xt[y]=null),a.activeTexture(Pi+y),a.bindTexture(An,null),a.bindTexture(ys,null)}}return{create2D:et,createCube:nt,clear:bt,getTexture:function(y){return null},restore:Pn,refresh:wr}}var Zn=36161,Qo=32854,Ul=32855,Vl=36194,$l=33189,Hl=36168,jl=34041,Xl=35907,Wl=34836,ql=34842,Yl=34843,xn=[];xn[Qo]=2,xn[Ul]=2,xn[Vl]=2,xn[$l]=2,xn[Hl]=1,xn[jl]=4,xn[Xl]=4,xn[Wl]=16,xn[ql]=8,xn[Yl]=6;function Zl(a,h,_){return xn[a]*h*_}var jy=function(a,h,_,O,j){var z={rgba4:Qo,rgb565:Vl,"rgb5 a1":Ul,depth:$l,stencil:Hl,"depth stencil":jl};h.ext_srgb&&(z.srgba=Xl),h.ext_color_buffer_half_float&&(z.rgba16f=ql,z.rgb16f=Yl),h.webgl_color_buffer_float&&(z.rgba32f=Wl);var B=[];Object.keys(z).forEach(function(J){var ne=z[J];B[ne]=J});var K=0,Q={};function ie(J){this.id=K++,this.refCount=1,this.renderbuffer=J,this.format=Qo,this.width=0,this.height=0,j.profile&&(this.stats={size:0})}ie.prototype.decRef=function(){--this.refCount<=0&&ae(this)};function ae(J){var ne=J.renderbuffer;d(ne,"must not double destroy renderbuffer"),a.bindRenderbuffer(Zn,null),a.deleteRenderbuffer(ne),J.renderbuffer=null,J.refCount=0,delete Q[J.id],O.renderbufferCount--}function oe(J,ne){var k=new ie(a.createRenderbuffer());Q[k.id]=k,O.renderbufferCount++;function G(xe,Z){var ge=0,me=0,Fe=Qo;if(typeof xe=="object"&&xe){var X=xe;if("shape"in X){var $=X.shape;d(Array.isArray($)&&$.length>=2,"invalid renderbuffer shape"),ge=$[0]|0,me=$[1]|0}else"radius"in X&&(ge=me=X.radius|0),"width"in X&&(ge=X.width|0),"height"in X&&(me=X.height|0);"format"in X&&(d.parameter(X.format,z,"invalid renderbuffer format"),Fe=z[X.format])}else typeof xe=="number"?(ge=xe|0,typeof Z=="number"?me=Z|0:me=ge):xe?d.raise("invalid arguments to renderbuffer constructor"):ge=me=1;if(d(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),!(ge===k.width&&me===k.height&&Fe===k.format))return G.width=k.width=ge,G.height=k.height=me,k.format=Fe,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,Fe,ge,me),d(a.getError()===0,"invalid render buffer format"),j.profile&&(k.stats.size=Zl(k.format,k.width,k.height)),G.format=B[k.format],G}function te(xe,Z){var ge=xe|0,me=Z|0||ge;return ge===k.width&&me===k.height||(d(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),G.width=k.width=ge,G.height=k.height=me,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,k.format,ge,me),d(a.getError()===0,"invalid render buffer format"),j.profile&&(k.stats.size=Zl(k.format,k.width,k.height))),G}return G(J,ne),G.resize=te,G._reglType="renderbuffer",G._renderbuffer=k,j.profile&&(G.stats=k.stats),G.destroy=function(){k.decRef()},G}j.profile&&(O.getTotalRenderbufferSize=function(){var J=0;return Object.keys(Q).forEach(function(ne){J+=Q[ne].stats.size}),J});function le(){nn(Q).forEach(function(J){J.renderbuffer=a.createRenderbuffer(),a.bindRenderbuffer(Zn,J.renderbuffer),a.renderbufferStorage(Zn,J.format,J.width,J.height)}),a.bindRenderbuffer(Zn,null)}return{create:oe,clear:function(){nn(Q).forEach(ae)},restore:le}},Nn=36160,zs=36161,yr=3553,Ko=34069,Ql=36064,Kl=36096,Jl=36128,ec=33306,tc=36053,Xy=36054,Wy=36055,qy=36057,Yy=36061,Zy=36193,Qy=5121,Ky=5126,nc=6407,rc=6408,Jy=6402,ex=[nc,rc],Os=[];Os[rc]=4,Os[nc]=3;var Jo=[];Jo[Qy]=1,Jo[Ky]=4,Jo[Zy]=2;var tx=32854,nx=32855,rx=36194,ix=33189,ox=36168,ic=34041,ax=35907,sx=34836,fx=34842,ux=34843,lx=[tx,nx,rx,ax,fx,ux,sx],Wr={};Wr[tc]="complete",Wr[Xy]="incomplete attachment",Wr[qy]="incomplete dimensions",Wr[Wy]="incomplete, missing attachment",Wr[Yy]="unsupported";function cx(a,h,_,O,j,z){var B={cur:null,next:null,dirty:!1,setFBO:null},K=["rgba"],Q=["rgba4","rgb565","rgb5 a1"];h.ext_srgb&&Q.push("srgba"),h.ext_color_buffer_half_float&&Q.push("rgba16f","rgb16f"),h.webgl_color_buffer_float&&Q.push("rgba32f");var ie=["uint8"];h.oes_texture_half_float&&ie.push("half float","float16"),h.oes_texture_float&&ie.push("float","float32");function ae(ee,he,de){this.target=ee,this.texture=he,this.renderbuffer=de;var Ve=0,Ne=0;he?(Ve=he.width,Ne=he.height):de&&(Ve=de.width,Ne=de.height),this.width=Ve,this.height=Ne}function oe(ee){ee&&(ee.texture&&ee.texture._texture.decRef(),ee.renderbuffer&&ee.renderbuffer._renderbuffer.decRef())}function le(ee,he,de){if(ee)if(ee.texture){var Ve=ee.texture._texture,Ne=Math.max(1,Ve.width),pe=Math.max(1,Ve.height);d(Ne===he&&pe===de,"inconsistent width/height for supplied texture"),Ve.refCount+=1}else{var ye=ee.renderbuffer._renderbuffer;d(ye.width===he&&ye.height===de,"inconsistent width/height for renderbuffer"),ye.refCount+=1}}function J(ee,he){he&&(he.texture?a.framebufferTexture2D(Nn,ee,he.target,he.texture._texture.texture,0):a.framebufferRenderbuffer(Nn,ee,zs,he.renderbuffer._renderbuffer.renderbuffer))}function ne(ee){var he=yr,de=null,Ve=null,Ne=ee;typeof ee=="object"&&(Ne=ee.data,"target"in ee&&(he=ee.target|0)),d.type(Ne,"function","invalid attachment data");var pe=Ne._reglType;return pe==="texture2d"?(de=Ne,d(he===yr)):pe==="textureCube"?(de=Ne,d(he>=Ko&&he<Ko+6,"invalid cube map target")):pe==="renderbuffer"?(Ve=Ne,he=zs):d.raise("invalid regl object for attachment"),new ae(he,de,Ve)}function k(ee,he,de,Ve,Ne){if(de){var pe=O.create2D({width:ee,height:he,format:Ve,type:Ne});return pe._texture.refCount=0,new ae(yr,pe,null)}else{var ye=j.create({width:ee,height:he,format:Ve});return ye._renderbuffer.refCount=0,new ae(zs,null,ye)}}function G(ee){return ee&&(ee.texture||ee.renderbuffer)}function te(ee,he,de){ee&&(ee.texture?ee.texture.resize(he,de):ee.renderbuffer&&ee.renderbuffer.resize(he,de),ee.width=he,ee.height=de)}var xe=0,Z={};function ge(){this.id=xe++,Z[this.id]=this,this.framebuffer=a.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function me(ee){ee.colorAttachments.forEach(oe),oe(ee.depthAttachment),oe(ee.stencilAttachment),oe(ee.depthStencilAttachment)}function Fe(ee){var he=ee.framebuffer;d(he,"must not double destroy framebuffer"),a.deleteFramebuffer(he),ee.framebuffer=null,z.framebufferCount--,delete Z[ee.id]}function X(ee){var he;a.bindFramebuffer(Nn,ee.framebuffer);var de=ee.colorAttachments;for(he=0;he<de.length;++he)J(Ql+he,de[he]);for(he=de.length;he<_.maxColorAttachments;++he)a.framebufferTexture2D(Nn,Ql+he,yr,null,0);a.framebufferTexture2D(Nn,ec,yr,null,0),a.framebufferTexture2D(Nn,Kl,yr,null,0),a.framebufferTexture2D(Nn,Jl,yr,null,0),J(Kl,ee.depthAttachment),J(Jl,ee.stencilAttachment),J(ec,ee.depthStencilAttachment);var Ve=a.checkFramebufferStatus(Nn);!a.isContextLost()&&Ve!==tc&&d.raise("framebuffer configuration not supported, status = "+Wr[Ve]),a.bindFramebuffer(Nn,B.next?B.next.framebuffer:null),B.cur=B.next,a.getError()}function $(ee,he){var de=new ge;z.framebufferCount++;function Ve(pe,ye){var ze;d(B.next!==de,"can not update framebuffer which is currently in use");var $e=0,Je=0,vt=!0,yt=!0,tt=null,Et=!0,ht="rgba",Tt="uint8",Pt=1,Ct=null,It=null,Gt=null,xt=!1;if(typeof pe=="number")$e=pe|0,Je=ye|0||$e;else if(!pe)$e=Je=1;else{d.type(pe,"object","invalid arguments for framebuffer");var qe=pe;if("shape"in qe){var Bt=qe.shape;d(Array.isArray(Bt)&&Bt.length>=2,"invalid shape for framebuffer"),$e=Bt[0],Je=Bt[1]}else"radius"in qe&&($e=Je=qe.radius),"width"in qe&&($e=qe.width),"height"in qe&&(Je=qe.height);("color"in qe||"colors"in qe)&&(tt=qe.color||qe.colors,Array.isArray(tt)&&d(tt.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),tt||("colorCount"in qe&&(Pt=qe.colorCount|0,d(Pt>0,"invalid color buffer count")),"colorTexture"in qe&&(Et=!!qe.colorTexture,ht="rgba4"),"colorType"in qe&&(Tt=qe.colorType,Et?(d(h.oes_texture_float||!(Tt==="float"||Tt==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),d(h.oes_texture_half_float||!(Tt==="half float"||Tt==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Tt==="half float"||Tt==="float16"?(d(h.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),ht="rgba16f"):(Tt==="float"||Tt==="float32")&&(d(h.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),ht="rgba32f"),d.oneOf(Tt,ie,"invalid color type")),"colorFormat"in qe&&(ht=qe.colorFormat,K.indexOf(ht)>=0?Et=!0:Q.indexOf(ht)>=0?Et=!1:d.optional(function(){Et?d.oneOf(qe.colorFormat,K,"invalid color format for texture"):d.oneOf(qe.colorFormat,Q,"invalid color format for renderbuffer")}))),("depthTexture"in qe||"depthStencilTexture"in qe)&&(xt=!!(qe.depthTexture||qe.depthStencilTexture),d(!xt||h.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in qe&&(typeof qe.depth=="boolean"?vt=qe.depth:(Ct=qe.depth,yt=!1)),"stencil"in qe&&(typeof qe.stencil=="boolean"?yt=qe.stencil:(It=qe.stencil,vt=!1)),"depthStencil"in qe&&(typeof qe.depthStencil=="boolean"?vt=yt=qe.depthStencil:(Gt=qe.depthStencil,vt=!1,yt=!1))}var ot=null,Ie=null,et=null,nt=null;if(Array.isArray(tt))ot=tt.map(ne);else if(tt)ot=[ne(tt)];else for(ot=new Array(Pt),ze=0;ze<Pt;++ze)ot[ze]=k($e,Je,Et,ht,Tt);d(h.webgl_draw_buffers||ot.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),d(ot.length<=_.maxColorAttachments,"too many color attachments, not supported"),$e=$e||ot[0].width,Je=Je||ot[0].height,Ct?Ie=ne(Ct):vt&&!yt&&(Ie=k($e,Je,xt,"depth","uint32")),It?et=ne(It):yt&&!vt&&(et=k($e,Je,!1,"stencil","uint8")),Gt?nt=ne(Gt):!Ct&&!It&&yt&&vt&&(nt=k($e,Je,xt,"depth stencil","depth stencil")),d(!!Ct+!!It+!!Gt<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var bt=null;for(ze=0;ze<ot.length;++ze)if(le(ot[ze],$e,Je),d(!ot[ze]||ot[ze].texture&&ex.indexOf(ot[ze].texture._texture.format)>=0||ot[ze].renderbuffer&&lx.indexOf(ot[ze].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+ze+" is invalid"),ot[ze]&&ot[ze].texture){var Pn=Os[ot[ze].texture._texture.format]*Jo[ot[ze].texture._texture.type];bt===null?bt=Pn:d(bt===Pn,"all color attachments much have the same number of bits per pixel.")}return le(Ie,$e,Je),d(!Ie||Ie.texture&&Ie.texture._texture.format===Jy||Ie.renderbuffer&&Ie.renderbuffer._renderbuffer.format===ix,"invalid depth attachment for framebuffer object"),le(et,$e,Je),d(!et||et.renderbuffer&&et.renderbuffer._renderbuffer.format===ox,"invalid stencil attachment for framebuffer object"),le(nt,$e,Je),d(!nt||nt.texture&&nt.texture._texture.format===ic||nt.renderbuffer&&nt.renderbuffer._renderbuffer.format===ic,"invalid depth-stencil attachment for framebuffer object"),me(de),de.width=$e,de.height=Je,de.colorAttachments=ot,de.depthAttachment=Ie,de.stencilAttachment=et,de.depthStencilAttachment=nt,Ve.color=ot.map(G),Ve.depth=G(Ie),Ve.stencil=G(et),Ve.depthStencil=G(nt),Ve.width=de.width,Ve.height=de.height,X(de),Ve}function Ne(pe,ye){d(B.next!==de,"can not resize a framebuffer which is currently in use");var ze=Math.max(pe|0,1),$e=Math.max(ye|0||ze,1);if(ze===de.width&&$e===de.height)return Ve;for(var Je=de.colorAttachments,vt=0;vt<Je.length;++vt)te(Je[vt],ze,$e);return te(de.depthAttachment,ze,$e),te(de.stencilAttachment,ze,$e),te(de.depthStencilAttachment,ze,$e),de.width=Ve.width=ze,de.height=Ve.height=$e,X(de),Ve}return Ve(ee,he),r(Ve,{resize:Ne,_reglType:"framebuffer",_framebuffer:de,destroy:function(){Fe(de),me(de)},use:function(pe){B.setFBO({framebuffer:Ve},pe)}})}function Se(ee){var he=Array(6);function de(Ne){var pe;d(he.indexOf(B.next)<0,"can not update framebuffer which is currently in use");var ye={color:null},ze=0,$e=null,Je="rgba",vt="uint8",yt=1;if(typeof Ne=="number")ze=Ne|0;else if(!Ne)ze=1;else{d.type(Ne,"object","invalid arguments for framebuffer");var tt=Ne;if("shape"in tt){var Et=tt.shape;d(Array.isArray(Et)&&Et.length>=2,"invalid shape for framebuffer"),d(Et[0]===Et[1],"cube framebuffer must be square"),ze=Et[0]}else"radius"in tt&&(ze=tt.radius|0),"width"in tt?(ze=tt.width|0,"height"in tt&&d(tt.height===ze,"must be square")):"height"in tt&&(ze=tt.height|0);("color"in tt||"colors"in tt)&&($e=tt.color||tt.colors,Array.isArray($e)&&d($e.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),$e||("colorCount"in tt&&(yt=tt.colorCount|0,d(yt>0,"invalid color buffer count")),"colorType"in tt&&(d.oneOf(tt.colorType,ie,"invalid color type"),vt=tt.colorType),"colorFormat"in tt&&(Je=tt.colorFormat,d.oneOf(tt.colorFormat,K,"invalid color format for texture"))),"depth"in tt&&(ye.depth=tt.depth),"stencil"in tt&&(ye.stencil=tt.stencil),"depthStencil"in tt&&(ye.depthStencil=tt.depthStencil)}var ht;if($e)if(Array.isArray($e))for(ht=[],pe=0;pe<$e.length;++pe)ht[pe]=$e[pe];else ht=[$e];else{ht=Array(yt);var Tt={radius:ze,format:Je,type:vt};for(pe=0;pe<yt;++pe)ht[pe]=O.createCube(Tt)}for(ye.color=Array(ht.length),pe=0;pe<ht.length;++pe){var Pt=ht[pe];d(typeof Pt=="function"&&Pt._reglType==="textureCube","invalid cube map"),ze=ze||Pt.width,d(Pt.width===ze&&Pt.height===ze,"invalid cube map shape"),ye.color[pe]={target:Ko,data:ht[pe]}}for(pe=0;pe<6;++pe){for(var Ct=0;Ct<ht.length;++Ct)ye.color[Ct].target=Ko+pe;pe>0&&(ye.depth=he[0].depth,ye.stencil=he[0].stencil,ye.depthStencil=he[0].depthStencil),he[pe]?he[pe](ye):he[pe]=$(ye)}return r(de,{width:ze,height:ze,color:ht})}function Ve(Ne){var pe,ye=Ne|0;if(d(ye>0&&ye<=_.maxCubeMapSize,"invalid radius for cube fbo"),ye===de.width)return de;var ze=de.color;for(pe=0;pe<ze.length;++pe)ze[pe].resize(ye);for(pe=0;pe<6;++pe)he[pe].resize(ye);return de.width=de.height=ye,de}return de(ee),r(de,{faces:he,resize:Ve,_reglType:"framebufferCube",destroy:function(){he.forEach(function(Ne){Ne.destroy()})}})}function ce(){B.cur=null,B.next=null,B.dirty=!0,nn(Z).forEach(function(ee){ee.framebuffer=a.createFramebuffer(),X(ee)})}return r(B,{getFramebuffer:function(ee){if(typeof ee=="function"&&ee._reglType==="framebuffer"){var he=ee._framebuffer;if(he instanceof ge)return he}return null},create:$,createCube:Se,clear:function(){nn(Z).forEach(Fe)},restore:ce})}var hx=5126,oc=34962,ea=34963,ac=["attributes","elements","offset","count","primitive","instances"];function Ms(){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=hx,this.offset=0,this.stride=0,this.divisor=0}function dx(a,h,_,O,j,z,B){for(var K=_.maxAttributes,Q=new Array(K),ie=0;ie<K;++ie)Q[ie]=new Ms;var ae=0,oe={},le={Record:Ms,scope:{},state:Q,currentVAO:null,targetVAO:null,restore:ne()?me:function(){},createVAO:Fe,getVAO:G,destroyBuffer:J,setVAO:ne()?te:xe,clear:ne()?Z:function(){}};function J(X){for(var $=0;$<Q.length;++$){var Se=Q[$];Se.buffer===X&&(a.disableVertexAttribArray($),Se.buffer=null)}}function ne(){return h.oes_vertex_array_object}function k(){return h.angle_instanced_arrays}function G(X){return typeof X=="function"&&X._vao?X._vao:null}function te(X){if(X!==le.currentVAO){var $=ne();X?$.bindVertexArrayOES(X.vao):$.bindVertexArrayOES(null),le.currentVAO=X}}function xe(X){if(X!==le.currentVAO){if(X)X.bindAttrs();else{for(var $=k(),Se=0;Se<Q.length;++Se){var ce=Q[Se];ce.buffer?(a.enableVertexAttribArray(Se),ce.buffer.bind(),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offfset),$&&ce.divisor&&$.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}B.elements?a.bindBuffer(ea,B.elements.buffer.buffer):a.bindBuffer(ea,null)}le.currentVAO=X}}function Z(){nn(oe).forEach(function(X){X.destroy()})}function ge(){this.id=++ae,this.attributes=[],this.elements=null,this.ownsElements=!1,this.count=0,this.offset=0,this.instances=-1,this.primitive=4;var X=ne();X?this.vao=X.createVertexArrayOES():this.vao=null,oe[this.id]=this,this.buffers=[]}ge.prototype.bindAttrs=function(){for(var X=k(),$=this.attributes,Se=0;Se<$.length;++Se){var ce=$[Se];ce.buffer?(a.enableVertexAttribArray(Se),a.bindBuffer(oc,ce.buffer.buffer),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offset),X&&ce.divisor&&X.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}for(var ee=$.length;ee<K;++ee)a.disableVertexAttribArray(ee);var he=z.getElements(this.elements);he?a.bindBuffer(ea,he.buffer.buffer):a.bindBuffer(ea,null)},ge.prototype.refresh=function(){var X=ne();X&&(X.bindVertexArrayOES(this.vao),this.bindAttrs(),le.currentVAO=null,X.bindVertexArrayOES(null))},ge.prototype.destroy=function(){if(this.vao){var X=ne();this===le.currentVAO&&(le.currentVAO=null,X.bindVertexArrayOES(null)),X.deleteVertexArrayOES(this.vao),this.vao=null}this.ownsElements&&(this.elements.destroy(),this.elements=null,this.ownsElements=!1),oe[this.id]&&(delete oe[this.id],O.vaoCount-=1)};function me(){var X=ne();X&&nn(oe).forEach(function($){$.refresh()})}function Fe(X){var $=new ge;O.vaoCount+=1;function Se(ce){var ee;if(Array.isArray(ce))ee=ce,$.elements&&$.ownsElements&&$.elements.destroy(),$.elements=null,$.ownsElements=!1,$.offset=0,$.count=0,$.instances=-1,$.primitive=4;else{if(d(typeof ce=="object","invalid arguments for create vao"),d("attributes"in ce,"must specify attributes for vao"),ce.elements){var he=ce.elements;$.ownsElements?typeof he=="function"&&he._reglType==="elements"?($.elements.destroy(),$.ownsElements=!1):($.elements(he),$.ownsElements=!1):z.getElements(ce.elements)?($.elements=ce.elements,$.ownsElements=!1):($.elements=z.create(ce.elements),$.ownsElements=!0)}else $.elements=null,$.ownsElements=!1;ee=ce.attributes,$.offset=0,$.count=-1,$.instances=-1,$.primitive=4,$.elements&&($.count=$.elements._elements.vertCount,$.primitive=$.elements._elements.primType),"offset"in ce&&($.offset=ce.offset|0),"count"in ce&&($.count=ce.count|0),"instances"in ce&&($.instances=ce.instances|0),"primitive"in ce&&(d(ce.primitive in Yn,"bad primitive type: "+ce.primitive),$.primitive=Yn[ce.primitive]),d.optional(()=>{for(var vt=Object.keys(ce),yt=0;yt<vt.length;++yt)d(ac.indexOf(vt[yt])>=0,'invalid option for vao: "'+vt[yt]+'" valid options are '+ac)}),d(Array.isArray(ee),"attributes must be an array")}d(ee.length<K,"too many attributes"),d(ee.length>0,"must specify at least one attribute");var de={},Ve=$.attributes;Ve.length=ee.length;for(var Ne=0;Ne<ee.length;++Ne){var pe=ee[Ne],ye=Ve[Ne]=new Ms,ze=pe.data||pe;if(Array.isArray(ze)||n(ze)||yn(ze)){var $e;$.buffers[Ne]&&($e=$.buffers[Ne],n(ze)&&$e._buffer.byteLength>=ze.byteLength?$e.subdata(ze):($e.destroy(),$.buffers[Ne]=null)),$.buffers[Ne]||($e=$.buffers[Ne]=j.create(pe,oc,!1,!0)),ye.buffer=j.getBuffer($e),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1,de[Ne]=1}else j.getBuffer(pe)?(ye.buffer=j.getBuffer(pe),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1):j.getBuffer(pe.buffer)?(ye.buffer=j.getBuffer(pe.buffer),ye.size=(+pe.size||ye.buffer.dimension)|0,ye.normalized=!!pe.normalized||!1,"type"in pe?(d.parameter(pe.type,mr,"invalid buffer type"),ye.type=mr[pe.type]):ye.type=ye.buffer.dtype,ye.offset=(pe.offset||0)|0,ye.stride=(pe.stride||0)|0,ye.divisor=(pe.divisor||0)|0,ye.state=1,d(ye.size>=1&&ye.size<=4,"size must be between 1 and 4"),d(ye.offset>=0,"invalid offset"),d(ye.stride>=0&&ye.stride<=255,"stride must be between 0 and 255"),d(ye.divisor>=0,"divisor must be positive"),d(!ye.divisor||!!h.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in pe?(d(Ne>0,"first attribute must not be a constant"),ye.x=+pe.x||0,ye.y=+pe.y||0,ye.z=+pe.z||0,ye.w=+pe.w||0,ye.state=2):d(!1,"invalid attribute spec for location "+Ne)}for(var Je=0;Je<$.buffers.length;++Je)!de[Je]&&$.buffers[Je]&&($.buffers[Je].destroy(),$.buffers[Je]=null);return $.refresh(),Se}return Se.destroy=function(){for(var ce=0;ce<$.buffers.length;++ce)$.buffers[ce]&&$.buffers[ce].destroy();$.buffers.length=0,$.ownsElements&&($.elements.destroy(),$.elements=null,$.ownsElements=!1),$.destroy()},Se._vao=$,Se._reglType="vao",Se(X)}return le}var sc=35632,mx=35633,px=35718,vx=35721;function gx(a,h,_,O){var j={},z={};function B(k,G,te,xe){this.name=k,this.id=G,this.location=te,this.info=xe}function K(k,G){for(var te=0;te<k.length;++te)if(k[te].id===G.id){k[te].location=G.location;return}k.push(G)}function Q(k,G,te){var xe=k===sc?j:z,Z=xe[G];if(!Z){var ge=h.str(G);Z=a.createShader(k),a.shaderSource(Z,ge),a.compileShader(Z),d.shaderError(a,Z,ge,k,te),xe[G]=Z}return Z}var ie={},ae=[],oe=0;function le(k,G){this.id=oe++,this.fragId=k,this.vertId=G,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,O.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function J(k,G,te){var xe,Z,ge=Q(sc,k.fragId),me=Q(mx,k.vertId),Fe=k.program=a.createProgram();if(a.attachShader(Fe,ge),a.attachShader(Fe,me),te)for(xe=0;xe<te.length;++xe){var X=te[xe];a.bindAttribLocation(Fe,X[0],X[1])}a.linkProgram(Fe),d.linkError(a,Fe,h.str(k.fragId),h.str(k.vertId),G);var $=a.getProgramParameter(Fe,px);O.profile&&(k.stats.uniformsCount=$);var Se=k.uniforms;for(xe=0;xe<$;++xe)if(Z=a.getActiveUniform(Fe,xe),Z){if(Z.size>1)for(var ce=0;ce<Z.size;++ce){var ee=Z.name.replace("[0]","["+ce+"]");K(Se,new B(ee,h.id(ee),a.getUniformLocation(Fe,ee),Z))}var he=Z.name;Z.size>1&&(he=he.replace("[0]","")),K(Se,new B(he,h.id(he),a.getUniformLocation(Fe,he),Z))}var de=a.getProgramParameter(Fe,vx);O.profile&&(k.stats.attributesCount=de);var Ve=k.attributes;for(xe=0;xe<de;++xe)Z=a.getActiveAttrib(Fe,xe),Z&&K(Ve,new B(Z.name,h.id(Z.name),a.getAttribLocation(Fe,Z.name),Z))}O.profile&&(_.getMaxUniformsCount=function(){var k=0;return ae.forEach(function(G){G.stats.uniformsCount>k&&(k=G.stats.uniformsCount)}),k},_.getMaxAttributesCount=function(){var k=0;return ae.forEach(function(G){G.stats.attributesCount>k&&(k=G.stats.attributesCount)}),k});function ne(){j={},z={};for(var k=0;k<ae.length;++k)J(ae[k],null,ae[k].attributes.map(function(G){return[G.location,G.name]}))}return{clear:function(){var k=a.deleteShader.bind(a);nn(j).forEach(k),j={},nn(z).forEach(k),z={},ae.forEach(function(G){a.deleteProgram(G.program)}),ae.length=0,ie={},_.shaderCount=0},program:function(k,G,te,xe){d.command(k>=0,"missing vertex shader",te),d.command(G>=0,"missing fragment shader",te);var Z=ie[G];Z||(Z=ie[G]={});var ge=Z[k];if(ge&&(ge.refCount++,!xe))return ge;var me=new le(G,k);return _.shaderCount++,J(me,te,xe),ge||(Z[k]=me),ae.push(me),r(me,{destroy:function(){if(me.refCount--,me.refCount<=0){a.deleteProgram(me.program);var Fe=ae.indexOf(me);ae.splice(Fe,1),_.shaderCount--}Z[me.vertId].refCount<=0&&(a.deleteShader(z[me.vertId]),delete z[me.vertId],delete ie[me.fragId][me.vertId]),Object.keys(ie[me.fragId]).length||(a.deleteShader(j[me.fragId]),delete j[me.fragId],delete ie[me.fragId])}})},restore:ne,shader:Q,frag:-1,vert:-1}}var yx=6408,Ci=5121,xx=3333,ta=5126;function bx(a,h,_,O,j,z,B){function K(ae){var oe;h.next===null?(d(j.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),oe=Ci):(d(h.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),oe=h.next.colorAttachments[0].texture._texture.type,d.optional(function(){z.oes_texture_float?(d(oe===Ci||oe===ta,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),oe===ta&&d(B.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):d(oe===Ci,"Reading from a framebuffer is only allowed for the type 'uint8'")}));var le=0,J=0,ne=O.framebufferWidth,k=O.framebufferHeight,G=null;n(ae)?G=ae:ae&&(d.type(ae,"object","invalid arguments to regl.read()"),le=ae.x|0,J=ae.y|0,d(le>=0&&le<O.framebufferWidth,"invalid x offset for regl.read"),d(J>=0&&J<O.framebufferHeight,"invalid y offset for regl.read"),ne=(ae.width||O.framebufferWidth-le)|0,k=(ae.height||O.framebufferHeight-J)|0,G=ae.data||null),G&&(oe===Ci?d(G instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):oe===ta&&d(G instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),d(ne>0&&ne+le<=O.framebufferWidth,"invalid width for read pixels"),d(k>0&&k+J<=O.framebufferHeight,"invalid height for read pixels"),_();var te=ne*k*4;return G||(oe===Ci?G=new Uint8Array(te):oe===ta&&(G=G||new Float32Array(te))),d.isTypedArray(G,"data buffer for regl.read() must be a typedarray"),d(G.byteLength>=te,"data buffer for regl.read() too small"),a.pixelStorei(xx,4),a.readPixels(le,J,ne,k,yx,oe,G),G}function Q(ae){var oe;return h.setFBO({framebuffer:ae.framebuffer},function(){oe=K(ae)}),oe}function ie(ae){return!ae||!("framebuffer"in ae)?K(ae):Q(ae)}return ie}function qr(a){return Array.prototype.slice.call(a)}function Yr(a){return qr(a).join("")}function _x(){var a=0,h=[],_=[];function O(oe){for(var le=0;le<_.length;++le)if(_[le]===oe)return h[le];var J="g"+a++;return h.push(J),_.push(oe),J}function j(){var oe=[];function le(){oe.push.apply(oe,qr(arguments))}var J=[];function ne(){var k="v"+a++;return J.push(k),arguments.length>0&&(oe.push(k,"="),oe.push.apply(oe,qr(arguments)),oe.push(";")),k}return r(le,{def:ne,toString:function(){return Yr([J.length>0?"var "+J.join(",")+";":"",Yr(oe)])}})}function z(){var oe=j(),le=j(),J=oe.toString,ne=le.toString;function k(G,te){le(G,te,"=",oe.def(G,te),";")}return r(function(){oe.apply(oe,qr(arguments))},{def:oe.def,entry:oe,exit:le,save:k,set:function(G,te,xe){k(G,te),oe(G,te,"=",xe,";")},toString:function(){return J()+ne()}})}function B(){var oe=Yr(arguments),le=z(),J=z(),ne=le.toString,k=J.toString;return r(le,{then:function(){return le.apply(le,qr(arguments)),this},else:function(){return J.apply(J,qr(arguments)),this},toString:function(){var G=k();return G&&(G="else{"+G+"}"),Yr(["if(",oe,"){",ne(),"}",G])}})}var K=j(),Q={};function ie(oe,le){var J=[];function ne(){var Z="a"+J.length;return J.push(Z),Z}le=le||0;for(var k=0;k<le;++k)ne();var G=z(),te=G.toString,xe=Q[oe]=r(G,{arg:ne,toString:function(){return Yr(["function(",J.join(),"){",te(),"}"])}});return xe}function ae(){var oe=['"use strict";',K,"return {"];Object.keys(Q).forEach(function(ne){oe.push('"',ne,'":',Q[ne].toString(),",")}),oe.push("}");var le=Yr(oe).replace(/;/g,`;
|
|
6
6
|
`).replace(/}/g,`}
|
|
7
7
|
`).replace(/{/g,`{
|
|
8
|
-
`),J=Function.apply(null,h.concat(le));return J.apply(null,_)}return{global:K,link:O,block:j,proc:ie,scope:z,cond:B,compile:ae}}var Zr="xyzw".split(""),fc=5121,Qr=1,Ns=2,Gs=0,Bs=1,Us=2,Vs=3,na=4,uc=5,lc=6,cc="dither",hc="blend.enable",dc="blend.color",$s="blend.equation",Hs="blend.func",mc="depth.enable",pc="depth.func",vc="depth.range",gc="depth.mask",js="colorMask",yc="cull.enable",xc="cull.face",Xs="frontFace",Ws="lineWidth",bc="polygonOffset.enable",qs="polygonOffset.offset",_c="sample.alpha",Sc="sample.enable",Ys="sample.coverage",Tc="stencil.enable",wc="stencil.mask",Zs="stencil.func",Qs="stencil.opFront",ki="stencil.opBack",Ac="scissor.enable",ra="scissor.box",Gn="viewport",Li="profile",xr="framebuffer",Fi="vert",Ri="frag",br="elements",_r="primitive",Sr="count",ia="offset",oa="instances",Ii="vao",Ks="Width",Js="Height",Kr=xr+Ks,Jr=xr+Js,Sx=Gn+Ks,Tx=Gn+Js,Ec="drawingBuffer",Pc=Ec+Ks,Cc=Ec+Js,wx=[Hs,$s,Zs,Qs,ki,Ys,Gn,ra,qs],ei=34962,ef=34963,Ax=35632,Ex=35633,kc=3553,Px=34067,Cx=2884,kx=3042,Lx=3024,Fx=2960,Rx=2929,Ix=3089,Dx=32823,zx=32926,Ox=32928,tf=5126,aa=35664,sa=35665,fa=35666,nf=5124,ua=35667,la=35668,ca=35669,rf=35670,ha=35671,da=35672,ma=35673,Di=35674,zi=35675,Oi=35676,Mi=35678,Ni=35680,of=4,Gi=1028,Tr=1029,Lc=2304,af=2305,Mx=32775,Nx=32776,Gx=519,Qn=7680,Fc=0,Rc=1,Ic=32774,Bx=513,Dc=36160,Ux=36064,En={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},zc=["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"],ti={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},Oc={frag:Ax,vert:Ex},sf={cw:Lc,ccw:af};function pa(a){return Array.isArray(a)||n(a)||yn(a)}function Mc(a){return a.sort(function(h,_){return h===Gn?-1:_===Gn?1:h<_?-1:1})}function Rt(a,h,_,O){this.thisDep=a,this.contextDep=h,this.propDep=_,this.append=O}function Jn(a){return a&&!(a.thisDep||a.contextDep||a.propDep)}function St(a){return new Rt(!1,!1,!1,a)}function Kt(a,h){var _=a.type;if(_===Gs){var O=a.data.length;return new Rt(!0,O>=1,O>=2,h)}else if(_===na){var j=a.data;return new Rt(j.thisDep,j.contextDep,j.propDep,h)}else{if(_===uc)return new Rt(!1,!1,!1,h);if(_===lc){for(var z=!1,B=!1,K=!1,Q=0;Q<a.data.length;++Q){var ie=a.data[Q];if(ie.type===Bs)K=!0;else if(ie.type===Us)B=!0;else if(ie.type===Vs)z=!0;else if(ie.type===Gs){z=!0;var ae=ie.data;ae>=1&&(B=!0),ae>=2&&(K=!0)}else ie.type===na&&(z=z||ie.data.thisDep,B=B||ie.data.contextDep,K=K||ie.data.propDep)}return new Rt(z,B,K,h)}else return new Rt(_===Vs,_===Us,_===Bs,h)}}var Nc=new Rt(!1,!1,!1,function(){});function Vx(a,h,_,O,j,z,B,K,Q,ie,ae,oe,le,J,ne){var k=ie.Record,G={add:32774,subtract:32778,"reverse subtract":32779};_.ext_blend_minmax&&(G.min=Mx,G.max=Nx);var te=_.angle_instanced_arrays,xe=_.webgl_draw_buffers,Z=_.oes_vertex_array_object,ge={dirty:!0,profile:ne.profile},me={},Fe=[],X={},$={};function Se(m){return m.replace(".","_")}function ce(m,c,T){var P=Se(m);Fe.push(m),me[P]=ge[P]=!!T,X[P]=c}function ee(m,c,T){var P=Se(m);Fe.push(m),Array.isArray(T)?(ge[P]=T.slice(),me[P]=T.slice()):ge[P]=me[P]=T,$[P]=c}ce(cc,Lx),ce(hc,kx),ee(dc,"blendColor",[0,0,0,0]),ee($s,"blendEquationSeparate",[Ic,Ic]),ee(Hs,"blendFuncSeparate",[Rc,Fc,Rc,Fc]),ce(mc,Rx,!0),ee(pc,"depthFunc",Bx),ee(vc,"depthRange",[0,1]),ee(gc,"depthMask",!0),ee(js,js,[!0,!0,!0,!0]),ce(yc,Cx),ee(xc,"cullFace",Tr),ee(Xs,Xs,af),ee(Ws,Ws,1),ce(bc,Dx),ee(qs,"polygonOffset",[0,0]),ce(_c,zx),ce(Sc,Ox),ee(Ys,"sampleCoverage",[1,!1]),ce(Tc,Fx),ee(wc,"stencilMask",-1),ee(Zs,"stencilFunc",[Gx,0,-1]),ee(Qs,"stencilOpSeparate",[Gi,Qn,Qn,Qn]),ee(ki,"stencilOpSeparate",[Tr,Qn,Qn,Qn]),ce(Ac,Ix),ee(ra,"scissor",[0,0,a.drawingBufferWidth,a.drawingBufferHeight]),ee(Gn,Gn,[0,0,a.drawingBufferWidth,a.drawingBufferHeight]);var he={gl:a,context:le,strings:h,next:me,current:ge,draw:oe,elements:z,buffer:j,shader:ae,attributes:ie.state,vao:ie,uniforms:Q,framebuffer:K,extensions:_,timer:J,isBufferArgs:pa},de={primTypes:Yn,compareFuncs:ti,blendFuncs:En,blendEquations:G,stencilOps:Kn,glTypes:mr,orientationType:sf};d.optional(function(){he.isArrayLike=pt}),xe&&(de.backBuffer=[Tr],de.drawBuffer=Yt(O.maxDrawbuffers,function(m){return m===0?[0]:Yt(m,function(c){return Ux+c})}));var Ve=0;function Ne(){var m=_x(),c=m.link,T=m.global;m.id=Ve++,m.batchId="0";var P=c(he),L=m.shared={props:"a0"};Object.keys(he).forEach(function(x){L[x]=T.def(P,".",x)}),d.optional(function(){m.CHECK=c(d),m.commandStr=d.guessCommand(),m.command=c(m.commandStr),m.assert=function(x,g,R){x("if(!(",g,"))",this.CHECK,".commandRaise(",c(R),",",this.command,");")},de.invalidBlendCombinations=zc});var A=m.next={},w=m.current={};Object.keys($).forEach(function(x){Array.isArray(ge[x])&&(A[x]=T.def(L.next,".",x),w[x]=T.def(L.current,".",x))});var E=m.constants={};Object.keys(de).forEach(function(x){E[x]=T.def(JSON.stringify(de[x]))}),m.invoke=function(x,g){switch(g.type){case Gs:var R=["this",L.context,L.props,m.batchId];return x.def(c(g.data),".call(",R.slice(0,Math.max(g.data.length+1,4)),")");case Bs:return x.def(L.props,g.data);case Us:return x.def(L.context,g.data);case Vs:return x.def("this",g.data);case na:return g.data.append(m,x),g.data.ref;case uc:return g.data.toString();case lc:return g.data.map(function(F){return m.invoke(x,F)})}},m.attribCache={};var p={};return m.scopeAttrib=function(x){var g=h.id(x);if(g in p)return p[g];var R=ie.scope[g];R||(R=ie.scope[g]=new k);var F=p[g]=c(R);return F},m}function pe(m){var c=m.static,T=m.dynamic,P;if(Li in c){var L=!!c[Li];P=St(function(w,E){return L}),P.enable=L}else if(Li in T){var A=T[Li];P=Kt(A,function(w,E){return w.invoke(E,A)})}return P}function ye(m,c){var T=m.static,P=m.dynamic;if(xr in T){var L=T[xr];return L?(L=K.getFramebuffer(L),d.command(L,"invalid framebuffer object"),St(function(w,E){var p=w.link(L),x=w.shared;E.set(x.framebuffer,".next",p);var g=x.context;return E.set(g,"."+Kr,p+".width"),E.set(g,"."+Jr,p+".height"),p})):St(function(w,E){var p=w.shared;E.set(p.framebuffer,".next","null");var x=p.context;return E.set(x,"."+Kr,x+"."+Pc),E.set(x,"."+Jr,x+"."+Cc),"null"})}else if(xr in P){var A=P[xr];return Kt(A,function(w,E){var p=w.invoke(E,A),x=w.shared,g=x.framebuffer,R=E.def(g,".getFramebuffer(",p,")");d.optional(function(){w.assert(E,"!"+p+"||"+R,"invalid framebuffer object")}),E.set(g,".next",R);var F=x.context;return E.set(F,"."+Kr,R+"?"+R+".width:"+F+"."+Pc),E.set(F,"."+Jr,R+"?"+R+".height:"+F+"."+Cc),R})}else return null}function ze(m,c,T){var P=m.static,L=m.dynamic;function A(p){if(p in P){var x=P[p];d.commandType(x,"object","invalid "+p,T.commandStr);var g=!0,R=x.x|0,F=x.y|0,V,W;return"width"in x?(V=x.width|0,d.command(V>=0,"invalid "+p,T.commandStr)):g=!1,"height"in x?(W=x.height|0,d.command(W>=0,"invalid "+p,T.commandStr)):g=!1,new Rt(!g&&c&&c.thisDep,!g&&c&&c.contextDep,!g&&c&&c.propDep,function(Le,be){var q=Le.shared.context,U=V;"width"in x||(U=be.def(q,".",Kr,"-",R));var Pe=W;return"height"in x||(Pe=be.def(q,".",Jr,"-",F)),[R,F,U,Pe]})}else if(p in L){var ue=L[p],Me=Kt(ue,function(Le,be){var q=Le.invoke(be,ue);d.optional(function(){Le.assert(be,q+"&&typeof "+q+'==="object"',"invalid "+p)});var U=Le.shared.context,Pe=be.def(q,".x|0"),we=be.def(q,".y|0"),Oe=be.def('"width" in ',q,"?",q,".width|0:","(",U,".",Kr,"-",Pe,")"),ft=be.def('"height" in ',q,"?",q,".height|0:","(",U,".",Jr,"-",we,")");return d.optional(function(){Le.assert(be,Oe+">=0&&"+ft+">=0","invalid "+p)}),[Pe,we,Oe,ft]});return c&&(Me.thisDep=Me.thisDep||c.thisDep,Me.contextDep=Me.contextDep||c.contextDep,Me.propDep=Me.propDep||c.propDep),Me}else return c?new Rt(c.thisDep,c.contextDep,c.propDep,function(Le,be){var q=Le.shared.context;return[0,0,be.def(q,".",Kr),be.def(q,".",Jr)]}):null}var w=A(Gn);if(w){var E=w;w=new Rt(w.thisDep,w.contextDep,w.propDep,function(p,x){var g=E.append(p,x),R=p.shared.context;return x.set(R,"."+Sx,g[2]),x.set(R,"."+Tx,g[3]),g})}return{viewport:w,scissor_box:A(ra)}}function $e(m,c){var T=m.static,P=typeof T[Ri]=="string"&&typeof T[Fi]=="string";if(P){if(Object.keys(c.dynamic).length>0)return null;var L=c.static,A=Object.keys(L);if(A.length>0&&typeof L[A[0]]=="number"){for(var w=[],E=0;E<A.length;++E)d(typeof L[A[E]]=="number","must specify all vertex attribute locations when using vaos"),w.push([L[A[E]]|0,A[E]]);return w}}return null}function Je(m,c,T){var P=m.static,L=m.dynamic;function A(g){if(g in P){var R=h.id(P[g]);d.optional(function(){ae.shader(Oc[g],R,d.guessCommand())});var F=St(function(){return R});return F.id=R,F}else if(g in L){var V=L[g];return Kt(V,function(W,ue){var Me=W.invoke(ue,V),Le=ue.def(W.shared.strings,".id(",Me,")");return d.optional(function(){ue(W.shared.shader,".shader(",Oc[g],",",Le,",",W.command,");")}),Le})}return null}var w=A(Ri),E=A(Fi),p=null,x;return Jn(w)&&Jn(E)?(p=ae.program(E.id,w.id,null,T),x=St(function(g,R){return g.link(p)})):x=new Rt(w&&w.thisDep||E&&E.thisDep,w&&w.contextDep||E&&E.contextDep,w&&w.propDep||E&&E.propDep,function(g,R){var F=g.shared.shader,V;w?V=w.append(g,R):V=R.def(F,".",Ri);var W;E?W=E.append(g,R):W=R.def(F,".",Fi);var ue=F+".program("+W+","+V;return d.optional(function(){ue+=","+g.command}),R.def(ue+")")}),{frag:w,vert:E,progVar:x,program:p}}function vt(m,c){var T=m.static,P=m.dynamic,L={},A=!1;function w(){if(Ii in T){var be=T[Ii];return be!==null&&ie.getVAO(be)===null&&(be=ie.createVAO(be)),A=!0,L.vao=be,St(function(U){var Pe=ie.getVAO(be);return Pe?U.link(Pe):"null"})}else if(Ii in P){A=!0;var q=P[Ii];return Kt(q,function(U,Pe){var we=U.invoke(Pe,q);return Pe.def(U.shared.vao+".getVAO("+we+")")})}return null}var E=w(),p=!1;function x(){if(br in T){var be=T[br];if(L.elements=be,pa(be)){var q=L.elements=z.create(be,!0);be=z.getElements(q),p=!0}else be&&(be=z.getElements(be),p=!0,d.command(be,"invalid elements",c.commandStr));var U=St(function(we,Oe){if(be){var ft=we.link(be);return we.ELEMENTS=ft,ft}return we.ELEMENTS=null,null});return U.value=be,U}else if(br in P){p=!0;var Pe=P[br];return Kt(Pe,function(we,Oe){var ft=we.shared,Ut=ft.isBufferArgs,Ar=ft.elements,Bn=we.invoke(Oe,Pe),Cn=Oe.def("null"),er=Oe.def(Ut,"(",Bn,")"),Er=we.cond(er).then(Cn,"=",Ar,".createStream(",Bn,");").else(Cn,"=",Ar,".getElements(",Bn,");");return d.optional(function(){we.assert(Er.else,"!"+Bn+"||"+Cn,"invalid elements")}),Oe.entry(Er),Oe.exit(we.cond(er).then(Ar,".destroyStream(",Cn,");")),we.ELEMENTS=Cn,Cn})}else if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(we,Oe){return Oe.def(we.shared.vao+".currentVAO?"+we.shared.elements+".getElements("+we.shared.vao+".currentVAO.elements):null")});return null}var g=x();function R(){if(_r in T){var be=T[_r];return L.primitive=be,d.commandParameter(be,Yn,"invalid primitve",c.commandStr),St(function(U,Pe){return Yn[be]})}else if(_r in P){var q=P[_r];return Kt(q,function(U,Pe){var we=U.constants.primTypes,Oe=U.invoke(Pe,q);return d.optional(function(){U.assert(Pe,Oe+" in "+we,"invalid primitive, must be one of "+Object.keys(Yn))}),Pe.def(we,"[",Oe,"]")})}else{if(p)return Jn(g)?g.value?St(function(U,Pe){return Pe.def(U.ELEMENTS,".primType")}):St(function(){return of}):new Rt(g.thisDep,g.contextDep,g.propDep,function(U,Pe){var we=U.ELEMENTS;return Pe.def(we,"?",we,".primType:",of)});if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(U,Pe){return Pe.def(U.shared.vao+".currentVAO?"+U.shared.vao+".currentVAO.primitive:"+of)})}return null}function F(be,q){if(be in T){var U=T[be]|0;return q?L.offset=U:L.instances=U,d.command(!q||U>=0,"invalid "+be,c.commandStr),St(function(we,Oe){return q&&(we.OFFSET=U),U})}else if(be in P){var Pe=P[be];return Kt(Pe,function(we,Oe){var ft=we.invoke(Oe,Pe);return q&&(we.OFFSET=ft,d.optional(function(){we.assert(Oe,ft+">=0","invalid "+be)})),ft})}else if(q){if(p)return St(function(we,Oe){return we.OFFSET=0,0});if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(we,Oe){return Oe.def(we.shared.vao+".currentVAO?"+we.shared.vao+".currentVAO.offset:0")})}else if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(we,Oe){return Oe.def(we.shared.vao+".currentVAO?"+we.shared.vao+".currentVAO.instances:-1")});return null}var V=F(ia,!0);function W(){if(Sr in T){var be=T[Sr]|0;return L.count=be,d.command(typeof be=="number"&&be>=0,"invalid vertex count",c.commandStr),St(function(){return be})}else if(Sr in P){var q=P[Sr];return Kt(q,function(Oe,ft){var Ut=Oe.invoke(ft,q);return d.optional(function(){Oe.assert(ft,"typeof "+Ut+'==="number"&&'+Ut+">=0&&"+Ut+"===("+Ut+"|0)","invalid vertex count")}),Ut})}else if(p)if(Jn(g)){if(g)return V?new Rt(V.thisDep,V.contextDep,V.propDep,function(Oe,ft){var Ut=ft.def(Oe.ELEMENTS,".vertCount-",Oe.OFFSET);return d.optional(function(){Oe.assert(ft,Ut+">=0","invalid vertex offset/element buffer too small")}),Ut}):St(function(Oe,ft){return ft.def(Oe.ELEMENTS,".vertCount")});var U=St(function(){return-1});return d.optional(function(){U.MISSING=!0}),U}else{var Pe=new Rt(g.thisDep||V.thisDep,g.contextDep||V.contextDep,g.propDep||V.propDep,function(Oe,ft){var Ut=Oe.ELEMENTS;return Oe.OFFSET?ft.def(Ut,"?",Ut,".vertCount-",Oe.OFFSET,":-1"):ft.def(Ut,"?",Ut,".vertCount:-1")});return d.optional(function(){Pe.DYNAMIC=!0}),Pe}else if(A){var we=new Rt(E.thisDep,E.contextDep,E.propDep,function(Oe,ft){return ft.def(Oe.shared.vao,".currentVAO?",Oe.shared.vao,".currentVAO.count:-1")});return we}return null}var ue=R(),Me=W(),Le=F(oa,!1);return{elements:g,primitive:ue,count:Me,instances:Le,offset:V,vao:E,vaoActive:A,elementsActive:p,static:L}}function yt(m,c){var T=m.static,P=m.dynamic,L={};return Fe.forEach(function(A){var w=Se(A);function E(p,x){if(A in T){var g=p(T[A]);L[w]=St(function(){return g})}else if(A in P){var R=P[A];L[w]=Kt(R,function(F,V){return x(F,V,F.invoke(V,R))})}}switch(A){case yc:case hc:case cc:case Tc:case mc:case Ac:case bc:case _c:case Sc:case gc:return E(function(p){return d.commandType(p,"boolean",A,c.commandStr),p},function(p,x,g){return d.optional(function(){p.assert(x,"typeof "+g+'==="boolean"',"invalid flag "+A,p.commandStr)}),g});case pc:return E(function(p){return d.commandParameter(p,ti,"invalid "+A,c.commandStr),ti[p]},function(p,x,g){var R=p.constants.compareFuncs;return d.optional(function(){p.assert(x,g+" in "+R,"invalid "+A+", must be one of "+Object.keys(ti))}),x.def(R,"[",g,"]")});case vc:return E(function(p){return d.command(pt(p)&&p.length===2&&typeof p[0]=="number"&&typeof p[1]=="number"&&p[0]<=p[1],"depth range is 2d array",c.commandStr),p},function(p,x,g){d.optional(function(){p.assert(x,p.shared.isArrayLike+"("+g+")&&"+g+".length===2&&typeof "+g+'[0]==="number"&&typeof '+g+'[1]==="number"&&'+g+"[0]<="+g+"[1]","depth range must be a 2d array")});var R=x.def("+",g,"[0]"),F=x.def("+",g,"[1]");return[R,F]});case Hs:return E(function(p){d.commandType(p,"object","blend.func",c.commandStr);var x="srcRGB"in p?p.srcRGB:p.src,g="srcAlpha"in p?p.srcAlpha:p.src,R="dstRGB"in p?p.dstRGB:p.dst,F="dstAlpha"in p?p.dstAlpha:p.dst;return d.commandParameter(x,En,w+".srcRGB",c.commandStr),d.commandParameter(g,En,w+".srcAlpha",c.commandStr),d.commandParameter(R,En,w+".dstRGB",c.commandStr),d.commandParameter(F,En,w+".dstAlpha",c.commandStr),d.command(zc.indexOf(x+", "+R)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+x+", "+R+")",c.commandStr),[En[x],En[R],En[g],En[F]]},function(p,x,g){var R=p.constants.blendFuncs;d.optional(function(){p.assert(x,g+"&&typeof "+g+'==="object"',"invalid blend func, must be an object")});function F(q,U){var Pe=x.def('"',q,U,'" in ',g,"?",g,".",q,U,":",g,".",q);return d.optional(function(){p.assert(x,Pe+" in "+R,"invalid "+A+"."+q+U+", must be one of "+Object.keys(En))}),Pe}var V=F("src","RGB"),W=F("dst","RGB");d.optional(function(){var q=p.constants.invalidBlendCombinations;p.assert(x,q+".indexOf("+V+'+", "+'+W+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var ue=x.def(R,"[",V,"]"),Me=x.def(R,"[",F("src","Alpha"),"]"),Le=x.def(R,"[",W,"]"),be=x.def(R,"[",F("dst","Alpha"),"]");return[ue,Le,Me,be]});case $s:return E(function(p){if(typeof p=="string")return d.commandParameter(p,G,"invalid "+A,c.commandStr),[G[p],G[p]];if(typeof p=="object")return d.commandParameter(p.rgb,G,A+".rgb",c.commandStr),d.commandParameter(p.alpha,G,A+".alpha",c.commandStr),[G[p.rgb],G[p.alpha]];d.commandRaise("invalid blend.equation",c.commandStr)},function(p,x,g){var R=p.constants.blendEquations,F=x.def(),V=x.def(),W=p.cond("typeof ",g,'==="string"');return d.optional(function(){function ue(Me,Le,be){p.assert(Me,be+" in "+R,"invalid "+Le+", must be one of "+Object.keys(G))}ue(W.then,A,g),p.assert(W.else,g+"&&typeof "+g+'==="object"',"invalid "+A),ue(W.else,A+".rgb",g+".rgb"),ue(W.else,A+".alpha",g+".alpha")}),W.then(F,"=",V,"=",R,"[",g,"];"),W.else(F,"=",R,"[",g,".rgb];",V,"=",R,"[",g,".alpha];"),x(W),[F,V]});case dc:return E(function(p){return d.command(pt(p)&&p.length===4,"blend.color must be a 4d array",c.commandStr),Yt(4,function(x){return+p[x]})},function(p,x,g){return d.optional(function(){p.assert(x,p.shared.isArrayLike+"("+g+")&&"+g+".length===4","blend.color must be a 4d array")}),Yt(4,function(R){return x.def("+",g,"[",R,"]")})});case wc:return E(function(p){return d.commandType(p,"number",w,c.commandStr),p|0},function(p,x,g){return d.optional(function(){p.assert(x,"typeof "+g+'==="number"',"invalid stencil.mask")}),x.def(g,"|0")});case Zs:return E(function(p){d.commandType(p,"object",w,c.commandStr);var x=p.cmp||"keep",g=p.ref||0,R="mask"in p?p.mask:-1;return d.commandParameter(x,ti,A+".cmp",c.commandStr),d.commandType(g,"number",A+".ref",c.commandStr),d.commandType(R,"number",A+".mask",c.commandStr),[ti[x],g,R]},function(p,x,g){var R=p.constants.compareFuncs;d.optional(function(){function ue(){p.assert(x,Array.prototype.join.call(arguments,""),"invalid stencil.func")}ue(g+"&&typeof ",g,'==="object"'),ue('!("cmp" in ',g,")||(",g,".cmp in ",R,")")});var F=x.def('"cmp" in ',g,"?",R,"[",g,".cmp]",":",Qn),V=x.def(g,".ref|0"),W=x.def('"mask" in ',g,"?",g,".mask|0:-1");return[F,V,W]});case Qs:case ki:return E(function(p){d.commandType(p,"object",w,c.commandStr);var x=p.fail||"keep",g=p.zfail||"keep",R=p.zpass||"keep";return d.commandParameter(x,Kn,A+".fail",c.commandStr),d.commandParameter(g,Kn,A+".zfail",c.commandStr),d.commandParameter(R,Kn,A+".zpass",c.commandStr),[A===ki?Tr:Gi,Kn[x],Kn[g],Kn[R]]},function(p,x,g){var R=p.constants.stencilOps;d.optional(function(){p.assert(x,g+"&&typeof "+g+'==="object"',"invalid "+A)});function F(V){return d.optional(function(){p.assert(x,'!("'+V+'" in '+g+")||("+g+"."+V+" in "+R+")","invalid "+A+"."+V+", must be one of "+Object.keys(Kn))}),x.def('"',V,'" in ',g,"?",R,"[",g,".",V,"]:",Qn)}return[A===ki?Tr:Gi,F("fail"),F("zfail"),F("zpass")]});case qs:return E(function(p){d.commandType(p,"object",w,c.commandStr);var x=p.factor|0,g=p.units|0;return d.commandType(x,"number",w+".factor",c.commandStr),d.commandType(g,"number",w+".units",c.commandStr),[x,g]},function(p,x,g){d.optional(function(){p.assert(x,g+"&&typeof "+g+'==="object"',"invalid "+A)});var R=x.def(g,".factor|0"),F=x.def(g,".units|0");return[R,F]});case xc:return E(function(p){var x=0;return p==="front"?x=Gi:p==="back"&&(x=Tr),d.command(!!x,w,c.commandStr),x},function(p,x,g){return d.optional(function(){p.assert(x,g+'==="front"||'+g+'==="back"',"invalid cull.face")}),x.def(g,'==="front"?',Gi,":",Tr)});case Ws:return E(function(p){return d.command(typeof p=="number"&&p>=O.lineWidthDims[0]&&p<=O.lineWidthDims[1],"invalid line width, must be a positive number between "+O.lineWidthDims[0]+" and "+O.lineWidthDims[1],c.commandStr),p},function(p,x,g){return d.optional(function(){p.assert(x,"typeof "+g+'==="number"&&'+g+">="+O.lineWidthDims[0]+"&&"+g+"<="+O.lineWidthDims[1],"invalid line width")}),g});case Xs:return E(function(p){return d.commandParameter(p,sf,w,c.commandStr),sf[p]},function(p,x,g){return d.optional(function(){p.assert(x,g+'==="cw"||'+g+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),x.def(g+'==="cw"?'+Lc+":"+af)});case js:return E(function(p){return d.command(pt(p)&&p.length===4,"color.mask must be length 4 array",c.commandStr),p.map(function(x){return!!x})},function(p,x,g){return d.optional(function(){p.assert(x,p.shared.isArrayLike+"("+g+")&&"+g+".length===4","invalid color.mask")}),Yt(4,function(R){return"!!"+g+"["+R+"]"})});case Ys:return E(function(p){d.command(typeof p=="object"&&p,w,c.commandStr);var x="value"in p?p.value:1,g=!!p.invert;return d.command(typeof x=="number"&&x>=0&&x<=1,"sample.coverage.value must be a number between 0 and 1",c.commandStr),[x,g]},function(p,x,g){d.optional(function(){p.assert(x,g+"&&typeof "+g+'==="object"',"invalid sample.coverage")});var R=x.def('"value" in ',g,"?+",g,".value:1"),F=x.def("!!",g,".invert");return[R,F]})}}),L}function tt(m,c){var T=m.static,P=m.dynamic,L={};return Object.keys(T).forEach(function(A){var w=T[A],E;if(typeof w=="number"||typeof w=="boolean")E=St(function(){return w});else if(typeof w=="function"){var p=w._reglType;p==="texture2d"||p==="textureCube"?E=St(function(x){return x.link(w)}):p==="framebuffer"||p==="framebufferCube"?(d.command(w.color.length>0,'missing color attachment for framebuffer sent to uniform "'+A+'"',c.commandStr),E=St(function(x){return x.link(w.color[0])})):d.commandRaise('invalid data for uniform "'+A+'"',c.commandStr)}else pt(w)?E=St(function(x){var g=x.global.def("[",Yt(w.length,function(R){return d.command(typeof w[R]=="number"||typeof w[R]=="boolean","invalid uniform "+A,x.commandStr),w[R]}),"]");return g}):d.commandRaise('invalid or missing data for uniform "'+A+'"',c.commandStr);E.value=w,L[A]=E}),Object.keys(P).forEach(function(A){var w=P[A];L[A]=Kt(w,function(E,p){return E.invoke(p,w)})}),L}function Et(m,c){var T=m.static,P=m.dynamic,L={};return Object.keys(T).forEach(function(A){var w=T[A],E=h.id(A),p=new k;if(pa(w))p.state=Qr,p.buffer=j.getBuffer(j.create(w,ei,!1,!0)),p.type=0;else{var x=j.getBuffer(w);if(x)p.state=Qr,p.buffer=x,p.type=0;else if(d.command(typeof w=="object"&&w,"invalid data for attribute "+A,c.commandStr),"constant"in w){var g=w.constant;p.buffer="null",p.state=Ns,typeof g=="number"?p.x=g:(d.command(pt(g)&&g.length>0&&g.length<=4,"invalid constant for attribute "+A,c.commandStr),Zr.forEach(function(Le,be){be<g.length&&(p[Le]=g[be])}))}else{pa(w.buffer)?x=j.getBuffer(j.create(w.buffer,ei,!1,!0)):x=j.getBuffer(w.buffer),d.command(!!x,'missing buffer for attribute "'+A+'"',c.commandStr);var R=w.offset|0;d.command(R>=0,'invalid offset for attribute "'+A+'"',c.commandStr);var F=w.stride|0;d.command(F>=0&&F<256,'invalid stride for attribute "'+A+'", must be integer betweeen [0, 255]',c.commandStr);var V=w.size|0;d.command(!("size"in w)||V>0&&V<=4,'invalid size for attribute "'+A+'", must be 1,2,3,4',c.commandStr);var W=!!w.normalized,ue=0;"type"in w&&(d.commandParameter(w.type,mr,"invalid type for attribute "+A,c.commandStr),ue=mr[w.type]);var Me=w.divisor|0;d.optional(function(){"divisor"in w&&(d.command(Me===0||te,'cannot specify divisor for attribute "'+A+'", instancing not supported',c.commandStr),d.command(Me>=0,'invalid divisor for attribute "'+A+'"',c.commandStr));var Le=c.commandStr,be=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(w).forEach(function(q){d.command(be.indexOf(q)>=0,'unknown parameter "'+q+'" for attribute pointer "'+A+'" (valid parameters are '+be+")",Le)})}),p.buffer=x,p.state=Qr,p.size=V,p.normalized=W,p.type=ue||x.dtype,p.offset=R,p.stride=F,p.divisor=Me}}L[A]=St(function(Le,be){var q=Le.attribCache;if(E in q)return q[E];var U={isStream:!1};return Object.keys(p).forEach(function(Pe){U[Pe]=p[Pe]}),p.buffer&&(U.buffer=Le.link(p.buffer),U.type=U.type||U.buffer+".dtype"),q[E]=U,U})}),Object.keys(P).forEach(function(A){var w=P[A];function E(p,x){var g=p.invoke(x,w),R=p.shared,F=p.constants,V=R.isBufferArgs,W=R.buffer;d.optional(function(){p.assert(x,g+"&&(typeof "+g+'==="object"||typeof '+g+'==="function")&&('+V+"("+g+")||"+W+".getBuffer("+g+")||"+W+".getBuffer("+g+".buffer)||"+V+"("+g+'.buffer)||("constant" in '+g+"&&(typeof "+g+'.constant==="number"||'+R.isArrayLike+"("+g+".constant))))",'invalid dynamic attribute "'+A+'"')});var ue={isStream:x.def(!1)},Me=new k;Me.state=Qr,Object.keys(Me).forEach(function(U){ue[U]=x.def(""+Me[U])});var Le=ue.buffer,be=ue.type;x("if(",V,"(",g,")){",ue.isStream,"=true;",Le,"=",W,".createStream(",ei,",",g,");",be,"=",Le,".dtype;","}else{",Le,"=",W,".getBuffer(",g,");","if(",Le,"){",be,"=",Le,".dtype;",'}else if("constant" in ',g,"){",ue.state,"=",Ns,";","if(typeof "+g+'.constant === "number"){',ue[Zr[0]],"=",g,".constant;",Zr.slice(1).map(function(U){return ue[U]}).join("="),"=0;","}else{",Zr.map(function(U,Pe){return ue[U]+"="+g+".constant.length>"+Pe+"?"+g+".constant["+Pe+"]:0;"}).join(""),"}}else{","if(",V,"(",g,".buffer)){",Le,"=",W,".createStream(",ei,",",g,".buffer);","}else{",Le,"=",W,".getBuffer(",g,".buffer);","}",be,'="type" in ',g,"?",F.glTypes,"[",g,".type]:",Le,".dtype;",ue.normalized,"=!!",g,".normalized;");function q(U){x(ue[U],"=",g,".",U,"|0;")}return q("size"),q("offset"),q("stride"),q("divisor"),x("}}"),x.exit("if(",ue.isStream,"){",W,".destroyStream(",Le,");","}"),ue}L[A]=Kt(w,E)}),L}function ht(m){var c=m.static,T=m.dynamic,P={};return Object.keys(c).forEach(function(L){var A=c[L];P[L]=St(function(w,E){return typeof A=="number"||typeof A=="boolean"?""+A:w.link(A)})}),Object.keys(T).forEach(function(L){var A=T[L];P[L]=Kt(A,function(w,E){return w.invoke(E,A)})}),P}function Tt(m,c,T,P,L){var A=m.static,w=m.dynamic;d.optional(function(){var q=[xr,Fi,Ri,br,_r,ia,Sr,oa,Li,Ii].concat(Fe);function U(Pe){Object.keys(Pe).forEach(function(we){d.command(q.indexOf(we)>=0,'unknown parameter "'+we+'"',L.commandStr)})}U(A),U(w)});var E=$e(m,c),p=ye(m),x=ze(m,p,L),g=vt(m,L),R=yt(m,L),F=Je(m,L,E);function V(q){var U=x[q];U&&(R[q]=U)}V(Gn),V(Se(ra));var W=Object.keys(R).length>0,ue={framebuffer:p,draw:g,shader:F,state:R,dirty:W,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(ue.profile=pe(m),ue.uniforms=tt(T,L),ue.drawVAO=ue.scopeVAO=g.vao,!ue.drawVAO&&F.program&&!E&&_.angle_instanced_arrays&&g.static.elements){var Me=!0,Le=F.program.attributes.map(function(q){var U=c.static[q];return Me=Me&&!!U,U});if(Me&&Le.length>0){var be=ie.getVAO(ie.createVAO({attributes:Le,elements:g.static.elements}));ue.drawVAO=new Rt(null,null,null,function(q,U){return q.link(be)}),ue.useVAO=!0}}return E?ue.useVAO=!0:ue.attributes=Et(c,L),ue.context=ht(P),ue}function Pt(m,c,T){var P=m.shared,L=P.context,A=m.scope();Object.keys(T).forEach(function(w){c.save(L,"."+w);var E=T[w],p=E.append(m,c);Array.isArray(p)?A(L,".",w,"=[",p.join(),"];"):A(L,".",w,"=",p,";")}),c(A)}function Ct(m,c,T,P){var L=m.shared,A=L.gl,w=L.framebuffer,E;xe&&(E=c.def(L.extensions,".webgl_draw_buffers"));var p=m.constants,x=p.drawBuffer,g=p.backBuffer,R;T?R=T.append(m,c):R=c.def(w,".next"),P||c("if(",R,"!==",w,".cur){"),c("if(",R,"){",A,".bindFramebuffer(",Dc,",",R,".framebuffer);"),xe&&c(E,".drawBuffersWEBGL(",x,"[",R,".colorAttachments.length]);"),c("}else{",A,".bindFramebuffer(",Dc,",null);"),xe&&c(E,".drawBuffersWEBGL(",g,");"),c("}",w,".cur=",R,";"),P||c("}")}function It(m,c,T){var P=m.shared,L=P.gl,A=m.current,w=m.next,E=P.current,p=P.next,x=m.cond(E,".dirty");Fe.forEach(function(g){var R=Se(g);if(!(R in T.state)){var F,V;if(R in w){F=w[R],V=A[R];var W=Yt(ge[R].length,function(Me){return x.def(F,"[",Me,"]")});x(m.cond(W.map(function(Me,Le){return Me+"!=="+V+"["+Le+"]"}).join("||")).then(L,".",$[R],"(",W,");",W.map(function(Me,Le){return V+"["+Le+"]="+Me}).join(";"),";"))}else{F=x.def(p,".",R);var ue=m.cond(F,"!==",E,".",R);x(ue),R in X?ue(m.cond(F).then(L,".enable(",X[R],");").else(L,".disable(",X[R],");"),E,".",R,"=",F,";"):ue(L,".",$[R],"(",F,");",E,".",R,"=",F,";")}}}),Object.keys(T.state).length===0&&x(E,".dirty=false;"),c(x)}function Gt(m,c,T,P){var L=m.shared,A=m.current,w=L.current,E=L.gl;Mc(Object.keys(T)).forEach(function(p){var x=T[p];if(!(P&&!P(x))){var g=x.append(m,c);if(X[p]){var R=X[p];Jn(x)?g?c(E,".enable(",R,");"):c(E,".disable(",R,");"):c(m.cond(g).then(E,".enable(",R,");").else(E,".disable(",R,");")),c(w,".",p,"=",g,";")}else if(pt(g)){var F=A[p];c(E,".",$[p],"(",g,");",g.map(function(V,W){return F+"["+W+"]="+V}).join(";"),";")}else c(E,".",$[p],"(",g,");",w,".",p,"=",g,";")}})}function xt(m,c){te&&(m.instancing=c.def(m.shared.extensions,".angle_instanced_arrays"))}function qe(m,c,T,P,L){var A=m.shared,w=m.stats,E=A.current,p=A.timer,x=T.profile;function g(){return typeof performance>"u"?"Date.now()":"performance.now()"}var R,F;function V(q){R=c.def(),q(R,"=",g(),";"),typeof L=="string"?q(w,".count+=",L,";"):q(w,".count++;"),J&&(P?(F=c.def(),q(F,"=",p,".getNumPendingQueries();")):q(p,".beginQuery(",w,");"))}function W(q){q(w,".cpuTime+=",g(),"-",R,";"),J&&(P?q(p,".pushScopeStats(",F,",",p,".getNumPendingQueries(),",w,");"):q(p,".endQuery();"))}function ue(q){var U=c.def(E,".profile");c(E,".profile=",q,";"),c.exit(E,".profile=",U,";")}var Me;if(x){if(Jn(x)){x.enable?(V(c),W(c.exit),ue("true")):ue("false");return}Me=x.append(m,c),ue(Me)}else Me=c.def(E,".profile");var Le=m.block();V(Le),c("if(",Me,"){",Le,"}");var be=m.block();W(be),c.exit("if(",Me,"){",be,"}")}function Bt(m,c,T,P,L){var A=m.shared;function w(p){switch(p){case aa:case ua:case ha:return 2;case sa:case la:case da:return 3;case fa:case ca:case ma:return 4;default:return 1}}function E(p,x,g){var R=A.gl,F=c.def(p,".location"),V=c.def(A.attributes,"[",F,"]"),W=g.state,ue=g.buffer,Me=[g.x,g.y,g.z,g.w],Le=["buffer","normalized","offset","stride"];function be(){c("if(!",V,".buffer){",R,".enableVertexAttribArray(",F,");}");var U=g.type,Pe;if(g.size?Pe=c.def(g.size,"||",x):Pe=x,c("if(",V,".type!==",U,"||",V,".size!==",Pe,"||",Le.map(function(Oe){return V+"."+Oe+"!=="+g[Oe]}).join("||"),"){",R,".bindBuffer(",ei,",",ue,".buffer);",R,".vertexAttribPointer(",[F,Pe,U,g.normalized,g.stride,g.offset],");",V,".type=",U,";",V,".size=",Pe,";",Le.map(function(Oe){return V+"."+Oe+"="+g[Oe]+";"}).join(""),"}"),te){var we=g.divisor;c("if(",V,".divisor!==",we,"){",m.instancing,".vertexAttribDivisorANGLE(",[F,we],");",V,".divisor=",we,";}")}}function q(){c("if(",V,".buffer){",R,".disableVertexAttribArray(",F,");",V,".buffer=null;","}if(",Zr.map(function(U,Pe){return V+"."+U+"!=="+Me[Pe]}).join("||"),"){",R,".vertexAttrib4f(",F,",",Me,");",Zr.map(function(U,Pe){return V+"."+U+"="+Me[Pe]+";"}).join(""),"}")}W===Qr?be():W===Ns?q():(c("if(",W,"===",Qr,"){"),be(),c("}else{"),q(),c("}"))}P.forEach(function(p){var x=p.name,g=T.attributes[x],R;if(g){if(!L(g))return;R=g.append(m,c)}else{if(!L(Nc))return;var F=m.scopeAttrib(x);d.optional(function(){m.assert(c,F+".state","missing attribute "+x)}),R={},Object.keys(new k).forEach(function(V){R[V]=c.def(F,".",V)})}E(m.link(p),w(p.info.type),R)})}function ot(m,c,T,P,L,A){for(var w=m.shared,E=w.gl,p={},x,g=0;g<P.length;++g){var R=P[g],F=R.name,V=R.info.type,W=R.info.size,ue=T.uniforms[F];if(W>1){if(!ue)continue;var Me=F.replace("[0]","");if(p[Me])continue;p[Me]=1}var Le=m.link(R),be=Le+".location",q;if(ue){if(!L(ue))continue;if(Jn(ue)){var U=ue.value;if(d.command(U!==null&&typeof U<"u",'missing uniform "'+F+'"',m.commandStr),V===Mi||V===Ni){d.command(typeof U=="function"&&(V===Mi&&(U._reglType==="texture2d"||U._reglType==="framebuffer")||V===Ni&&(U._reglType==="textureCube"||U._reglType==="framebufferCube")),"invalid texture for uniform "+F,m.commandStr);var Pe=m.link(U._texture||U.color[0]._texture);c(E,".uniform1i(",be,",",Pe+".bind());"),c.exit(Pe,".unbind();")}else if(V===Di||V===zi||V===Oi){d.optional(function(){d.command(pt(U),"invalid matrix for uniform "+F,m.commandStr),d.command(V===Di&&U.length===4||V===zi&&U.length===9||V===Oi&&U.length===16,"invalid length for matrix uniform "+F,m.commandStr)});var we=m.global.def("new Float32Array(["+Array.prototype.slice.call(U)+"])"),Oe=2;V===zi?Oe=3:V===Oi&&(Oe=4),c(E,".uniformMatrix",Oe,"fv(",be,",false,",we,");")}else{switch(V){case tf:W===1?d.commandType(U,"number","uniform "+F,m.commandStr):d.command(pt(U)&&U.length===W,"uniform "+F,m.commandStr),x="1f";break;case aa:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=W*2,"uniform "+F,m.commandStr),x="2f";break;case sa:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=W*3,"uniform "+F,m.commandStr),x="3f";break;case fa:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=W*4,"uniform "+F,m.commandStr),x="4f";break;case rf:W===1?d.commandType(U,"boolean","uniform "+F,m.commandStr):d.command(pt(U)&&U.length===W,"uniform "+F,m.commandStr),x="1i";break;case nf:W===1?d.commandType(U,"number","uniform "+F,m.commandStr):d.command(pt(U)&&U.length===W,"uniform "+F,m.commandStr),x="1i";break;case ha:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=W*2,"uniform "+F,m.commandStr),x="2i";break;case ua:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=W*2,"uniform "+F,m.commandStr),x="2i";break;case da:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=W*3,"uniform "+F,m.commandStr),x="3i";break;case la:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=W*3,"uniform "+F,m.commandStr),x="3i";break;case ma:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=W*4,"uniform "+F,m.commandStr),x="4i";break;case ca:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=W*4,"uniform "+F,m.commandStr),x="4i";break}W>1?(x+="v",U=m.global.def("["+Array.prototype.slice.call(U)+"]")):U=pt(U)?Array.prototype.slice.call(U):U,c(E,".uniform",x,"(",be,",",U,");")}continue}else q=ue.append(m,c)}else{if(!L(Nc))continue;q=c.def(w.uniforms,"[",h.id(F),"]")}V===Mi?(d(!Array.isArray(q),"must specify a scalar prop for textures"),c("if(",q,"&&",q,'._reglType==="framebuffer"){',q,"=",q,".color[0];","}")):V===Ni&&(d(!Array.isArray(q),"must specify a scalar prop for cube maps"),c("if(",q,"&&",q,'._reglType==="framebufferCube"){',q,"=",q,".color[0];","}")),d.optional(function(){function rn(Jt,va){m.assert(c,Jt,'bad data or missing for uniform "'+F+'". '+va)}function Pr(Jt,va){va===1&&d(!Array.isArray(q),"must not specify an array type for uniform"),rn("Array.isArray("+q+") && typeof "+q+'[0]===" '+Jt+'" || typeof '+q+'==="'+Jt+'"',"invalid type, expected "+Jt)}function un(Jt,va,ga){Array.isArray(q)?d(q.length&&q.length%Jt===0&&q.length<=Jt*ga,"must have length of "+(ga===1?"":"n * ")+Jt):rn(w.isArrayLike+"("+q+")&&"+q+".length && "+q+".length % "+Jt+" === 0 && "+q+".length<="+Jt*ga,"invalid vector, should have length of "+(ga===1?"":"n * ")+Jt,m.commandStr)}function jc(Jt){d(!Array.isArray(q),"must not specify a value type"),rn("typeof "+q+'==="function"&&'+q+'._reglType==="texture'+(Jt===kc?"2d":"Cube")+'"',"invalid texture type",m.commandStr)}switch(V){case nf:Pr("number",W);break;case ua:un(2,"number",W);break;case la:un(3,"number",W);break;case ca:un(4,"number",W);break;case tf:Pr("number",W);break;case aa:un(2,"number",W);break;case sa:un(3,"number",W);break;case fa:un(4,"number",W);break;case rf:Pr("boolean",W);break;case ha:un(2,"boolean",W);break;case da:un(3,"boolean",W);break;case ma:un(4,"boolean",W);break;case Di:un(4,"number",W);break;case zi:un(9,"number",W);break;case Oi:un(16,"number",W);break;case Mi:jc(kc);break;case Ni:jc(Px);break}});var ft=1;switch(V){case Mi:case Ni:var Ut=c.def(q,"._texture");c(E,".uniform1i(",be,",",Ut,".bind());"),c.exit(Ut,".unbind();");continue;case nf:case rf:x="1i";break;case ua:case ha:x="2i",ft=2;break;case la:case da:x="3i",ft=3;break;case ca:case ma:x="4i",ft=4;break;case tf:x="1f";break;case aa:x="2f",ft=2;break;case sa:x="3f",ft=3;break;case fa:x="4f",ft=4;break;case Di:x="Matrix2fv";break;case zi:x="Matrix3fv";break;case Oi:x="Matrix4fv";break}if(x.indexOf("Matrix")===-1&&W>1&&(x+="v",ft=1),x.charAt(0)==="M"){c(E,".uniform",x,"(",be,",");var Ar=Math.pow(V-Di+2,2),Bn=m.global.def("new Float32Array(",Ar,")");Array.isArray(q)?c("false,(",Yt(Ar,function(rn){return Bn+"["+rn+"]="+q[rn]}),",",Bn,")"):c("false,(Array.isArray(",q,")||",q," instanceof Float32Array)?",q,":(",Yt(Ar,function(rn){return Bn+"["+rn+"]="+q+"["+rn+"]"}),",",Bn,")"),c(");")}else if(ft>1){for(var Cn=[],er=[],Er=0;Er<ft;++Er)Array.isArray(q)?er.push(q[Er]):er.push(c.def(q+"["+Er+"]")),A&&Cn.push(c.def());A&&c("if(!",m.batchId,"||",Cn.map(function(rn,Pr){return rn+"!=="+er[Pr]}).join("||"),"){",Cn.map(function(rn,Pr){return rn+"="+er[Pr]+";"}).join("")),c(E,".uniform",x,"(",be,",",er.join(","),");"),A&&c("}")}else{if(d(!Array.isArray(q),"uniform value must not be an array"),A){var Hc=c.def();c("if(!",m.batchId,"||",Hc,"!==",q,"){",Hc,"=",q,";")}c(E,".uniform",x,"(",be,",",q,");"),A&&c("}")}}}function Ie(m,c,T,P){var L=m.shared,A=L.gl,w=L.draw,E=P.draw;function p(){var Pe=E.elements,we,Oe=c;return Pe?((Pe.contextDep&&P.contextDynamic||Pe.propDep)&&(Oe=T),we=Pe.append(m,Oe),E.elementsActive&&Oe("if("+we+")"+A+".bindBuffer("+ef+","+we+".buffer.buffer);")):(we=Oe.def(),Oe(we,"=",w,".",br,";","if(",we,"){",A,".bindBuffer(",ef,",",we,".buffer.buffer);}","else if(",L.vao,".currentVAO){",we,"=",m.shared.elements+".getElements("+L.vao,".currentVAO.elements);",Z?"":"if("+we+")"+A+".bindBuffer("+ef+","+we+".buffer.buffer);","}")),we}function x(){var Pe=E.count,we,Oe=c;return Pe?((Pe.contextDep&&P.contextDynamic||Pe.propDep)&&(Oe=T),we=Pe.append(m,Oe),d.optional(function(){Pe.MISSING&&m.assert(c,"false","missing vertex count"),Pe.DYNAMIC&&m.assert(Oe,we+">=0","missing vertex count")})):(we=Oe.def(w,".",Sr),d.optional(function(){m.assert(Oe,we+">=0","missing vertex count")})),we}var g=p();function R(Pe){var we=E[Pe];return we?we.contextDep&&P.contextDynamic||we.propDep?we.append(m,T):we.append(m,c):c.def(w,".",Pe)}var F=R(_r),V=R(ia),W=x();if(typeof W=="number"){if(W===0)return}else T("if(",W,"){"),T.exit("}");var ue,Me;te&&(ue=R(oa),Me=m.instancing);var Le=g+".type",be=E.elements&&Jn(E.elements)&&!E.vaoActive;function q(){function Pe(){T(Me,".drawElementsInstancedANGLE(",[F,W,Le,V+"<<(("+Le+"-"+fc+")>>1)",ue],");")}function we(){T(Me,".drawArraysInstancedANGLE(",[F,V,W,ue],");")}g&&g!=="null"?be?Pe():(T("if(",g,"){"),Pe(),T("}else{"),we(),T("}")):we()}function U(){function Pe(){T(A+".drawElements("+[F,W,Le,V+"<<(("+Le+"-"+fc+")>>1)"]+");")}function we(){T(A+".drawArrays("+[F,V,W]+");")}g&&g!=="null"?be?Pe():(T("if(",g,"){"),Pe(),T("}else{"),we(),T("}")):we()}te&&(typeof ue!="number"||ue>=0)?typeof ue=="string"?(T("if(",ue,">0){"),q(),T("}else if(",ue,"<0){"),U(),T("}")):q():U()}function et(m,c,T,P,L){var A=Ne(),w=A.proc("body",L);return d.optional(function(){A.commandStr=c.commandStr,A.command=A.link(c.commandStr)}),te&&(A.instancing=w.def(A.shared.extensions,".angle_instanced_arrays")),m(A,w,T,P),A.compile().body}function nt(m,c,T,P){xt(m,c),T.useVAO?T.drawVAO?c(m.shared.vao,".setVAO(",T.drawVAO.append(m,c),");"):c(m.shared.vao,".setVAO(",m.shared.vao,".targetVAO);"):(c(m.shared.vao,".setVAO(null);"),Bt(m,c,T,P.attributes,function(){return!0})),ot(m,c,T,P.uniforms,function(){return!0},!1),Ie(m,c,c,T)}function bt(m,c){var T=m.proc("draw",1);xt(m,T),Pt(m,T,c.context),Ct(m,T,c.framebuffer),It(m,T,c),Gt(m,T,c.state),qe(m,T,c,!1,!0);var P=c.shader.progVar.append(m,T);if(T(m.shared.gl,".useProgram(",P,".program);"),c.shader.program)nt(m,T,c,c.shader.program);else{T(m.shared.vao,".setVAO(null);");var L=m.global.def("{}"),A=T.def(P,".id"),w=T.def(L,"[",A,"]");T(m.cond(w).then(w,".call(this,a0);").else(w,"=",L,"[",A,"]=",m.link(function(E){return et(nt,m,c,E,1)}),"(",P,");",w,".call(this,a0);"))}Object.keys(c.state).length>0&&T(m.shared.current,".dirty=true;"),m.shared.vao&&T(m.shared.vao,".setVAO(null);")}function Pn(m,c,T,P){m.batchId="a1",xt(m,c);function L(){return!0}Bt(m,c,T,P.attributes,L),ot(m,c,T,P.uniforms,L,!1),Ie(m,c,c,T)}function wr(m,c,T,P){xt(m,c);var L=T.contextDep,A=c.def(),w="a0",E="a1",p=c.def();m.shared.props=p,m.batchId=A;var x=m.scope(),g=m.scope();c(x.entry,"for(",A,"=0;",A,"<",E,";++",A,"){",p,"=",w,"[",A,"];",g,"}",x.exit);function R(Le){return Le.contextDep&&L||Le.propDep}function F(Le){return!R(Le)}if(T.needsContext&&Pt(m,g,T.context),T.needsFramebuffer&&Ct(m,g,T.framebuffer),Gt(m,g,T.state,R),T.profile&&R(T.profile)&&qe(m,g,T,!1,!0),P)T.useVAO?T.drawVAO?R(T.drawVAO)?g(m.shared.vao,".setVAO(",T.drawVAO.append(m,g),");"):x(m.shared.vao,".setVAO(",T.drawVAO.append(m,x),");"):x(m.shared.vao,".setVAO(",m.shared.vao,".targetVAO);"):(x(m.shared.vao,".setVAO(null);"),Bt(m,x,T,P.attributes,F),Bt(m,g,T,P.attributes,R)),ot(m,x,T,P.uniforms,F,!1),ot(m,g,T,P.uniforms,R,!0),Ie(m,x,g,T);else{var V=m.global.def("{}"),W=T.shader.progVar.append(m,g),ue=g.def(W,".id"),Me=g.def(V,"[",ue,"]");g(m.shared.gl,".useProgram(",W,".program);","if(!",Me,"){",Me,"=",V,"[",ue,"]=",m.link(function(Le){return et(Pn,m,T,Le,2)}),"(",W,");}",Me,".call(this,a0[",A,"],",A,");")}}function y(m,c){var T=m.proc("batch",2);m.batchId="0",xt(m,T);var P=!1,L=!0;Object.keys(c.context).forEach(function(V){P=P||c.context[V].propDep}),P||(Pt(m,T,c.context),L=!1);var A=c.framebuffer,w=!1;A?(A.propDep?P=w=!0:A.contextDep&&P&&(w=!0),w||Ct(m,T,A)):Ct(m,T,null),c.state.viewport&&c.state.viewport.propDep&&(P=!0);function E(V){return V.contextDep&&P||V.propDep}It(m,T,c),Gt(m,T,c.state,function(V){return!E(V)}),(!c.profile||!E(c.profile))&&qe(m,T,c,!1,"a1"),c.contextDep=P,c.needsContext=L,c.needsFramebuffer=w;var p=c.shader.progVar;if(p.contextDep&&P||p.propDep)wr(m,T,c,null);else{var x=p.append(m,T);if(T(m.shared.gl,".useProgram(",x,".program);"),c.shader.program)wr(m,T,c,c.shader.program);else{T(m.shared.vao,".setVAO(null);");var g=m.global.def("{}"),R=T.def(x,".id"),F=T.def(g,"[",R,"]");T(m.cond(F).then(F,".call(this,a0,a1);").else(F,"=",g,"[",R,"]=",m.link(function(V){return et(wr,m,c,V,2)}),"(",x,");",F,".call(this,a0,a1);"))}}Object.keys(c.state).length>0&&T(m.shared.current,".dirty=true;"),m.shared.vao&&T(m.shared.vao,".setVAO(null);")}function M(m,c){var T=m.proc("scope",3);m.batchId="a2";var P=m.shared,L=P.current;Pt(m,T,c.context),c.framebuffer&&c.framebuffer.append(m,T),Mc(Object.keys(c.state)).forEach(function(w){var E=c.state[w],p=E.append(m,T);pt(p)?p.forEach(function(x,g){T.set(m.next[w],"["+g+"]",x)}):T.set(P.next,"."+w,p)}),qe(m,T,c,!0,!0),[br,ia,Sr,oa,_r].forEach(function(w){var E=c.draw[w];E&&T.set(P.draw,"."+w,""+E.append(m,T))}),Object.keys(c.uniforms).forEach(function(w){var E=c.uniforms[w].append(m,T);Array.isArray(E)&&(E="["+E.join()+"]"),T.set(P.uniforms,"["+h.id(w)+"]",E)}),Object.keys(c.attributes).forEach(function(w){var E=c.attributes[w].append(m,T),p=m.scopeAttrib(w);Object.keys(new k).forEach(function(x){T.set(p,"."+x,E[x])})}),c.scopeVAO&&T.set(P.vao,".targetVAO",c.scopeVAO.append(m,T));function A(w){var E=c.shader[w];E&&T.set(P.shader,"."+w,E.append(m,T))}A(Fi),A(Ri),Object.keys(c.state).length>0&&(T(L,".dirty=true;"),T.exit(L,".dirty=true;")),T("a1(",m.shared.context,",a0,",m.batchId,");")}function I(m){if(!(typeof m!="object"||pt(m))){for(var c=Object.keys(m),T=0;T<c.length;++T)if(Lt.isDynamic(m[c[T]]))return!0;return!1}}function _e(m,c,T){var P=c.static[T];if(!P||!I(P))return;var L=m.global,A=Object.keys(P),w=!1,E=!1,p=!1,x=m.global.def("{}");A.forEach(function(R){var F=P[R];if(Lt.isDynamic(F)){typeof F=="function"&&(F=P[R]=Lt.unbox(F));var V=Kt(F,null);w=w||V.thisDep,p=p||V.propDep,E=E||V.contextDep}else{switch(L(x,".",R,"="),typeof F){case"number":L(F);break;case"string":L('"',F,'"');break;case"object":Array.isArray(F)&&L("[",F.join(),"]");break;default:L(m.link(F));break}L(";")}});function g(R,F){A.forEach(function(V){var W=P[V];if(Lt.isDynamic(W)){var ue=R.invoke(F,W);F(x,".",V,"=",ue,";")}})}c.dynamic[T]=new Lt.DynamicVariable(na,{thisDep:w,contextDep:E,propDep:p,ref:x,append:g}),delete c.static[T]}function Ke(m,c,T,P,L){var A=Ne();A.stats=A.link(L),Object.keys(c.static).forEach(function(E){_e(A,c,E)}),wx.forEach(function(E){_e(A,m,E)});var w=Tt(m,c,T,P,A);return bt(A,w),M(A,w),y(A,w),r(A.compile(),{destroy:function(){w.shader.program.destroy()}})}return{next:me,current:ge,procs:function(){var m=Ne(),c=m.proc("poll"),T=m.proc("refresh"),P=m.block();c(P),T(P);var L=m.shared,A=L.gl,w=L.next,E=L.current;P(E,".dirty=false;"),Ct(m,c),Ct(m,T,null,!0);var p;te&&(p=m.link(te)),_.oes_vertex_array_object&&T(m.link(_.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var x=0;x<O.maxAttributes;++x){var g=T.def(L.attributes,"[",x,"]"),R=m.cond(g,".buffer");R.then(A,".enableVertexAttribArray(",x,");",A,".bindBuffer(",ei,",",g,".buffer.buffer);",A,".vertexAttribPointer(",x,",",g,".size,",g,".type,",g,".normalized,",g,".stride,",g,".offset);").else(A,".disableVertexAttribArray(",x,");",A,".vertexAttrib4f(",x,",",g,".x,",g,".y,",g,".z,",g,".w);",g,".buffer=null;"),T(R),te&&T(p,".vertexAttribDivisorANGLE(",x,",",g,".divisor);")}return T(m.shared.vao,".currentVAO=null;",m.shared.vao,".setVAO(",m.shared.vao,".targetVAO);"),Object.keys(X).forEach(function(F){var V=X[F],W=P.def(w,".",F),ue=m.block();ue("if(",W,"){",A,".enable(",V,")}else{",A,".disable(",V,")}",E,".",F,"=",W,";"),T(ue),c("if(",W,"!==",E,".",F,"){",ue,"}")}),Object.keys($).forEach(function(F){var V=$[F],W=ge[F],ue,Me,Le=m.block();if(Le(A,".",V,"("),pt(W)){var be=W.length;ue=m.global.def(w,".",F),Me=m.global.def(E,".",F),Le(Yt(be,function(q){return ue+"["+q+"]"}),");",Yt(be,function(q){return Me+"["+q+"]="+ue+"["+q+"];"}).join("")),c("if(",Yt(be,function(q){return ue+"["+q+"]!=="+Me+"["+q+"]"}).join("||"),"){",Le,"}")}else ue=P.def(w,".",F),Me=P.def(E,".",F),Le(ue,");",E,".",F,"=",ue,";"),c("if(",ue,"!==",Me,"){",Le,"}");T(Le)}),m.compile()}(),compile:Ke}}function $x(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var Hx=34918,jx=34919,Gc=35007,Xx=function(a,h){if(!h.ext_disjoint_timer_query)return null;var _=[];function O(){return _.pop()||h.ext_disjoint_timer_query.createQueryEXT()}function j(te){_.push(te)}var z=[];function B(te){var xe=O();h.ext_disjoint_timer_query.beginQueryEXT(Gc,xe),z.push(xe),J(z.length-1,z.length,te)}function K(){h.ext_disjoint_timer_query.endQueryEXT(Gc)}function Q(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var ie=[];function ae(){return ie.pop()||new Q}function oe(te){ie.push(te)}var le=[];function J(te,xe,Z){var ge=ae();ge.startQueryIndex=te,ge.endQueryIndex=xe,ge.sum=0,ge.stats=Z,le.push(ge)}var ne=[],k=[];function G(){var te,xe,Z=z.length;if(Z!==0){k.length=Math.max(k.length,Z+1),ne.length=Math.max(ne.length,Z+1),ne[0]=0,k[0]=0;var ge=0;for(te=0,xe=0;xe<z.length;++xe){var me=z[xe];h.ext_disjoint_timer_query.getQueryObjectEXT(me,jx)?(ge+=h.ext_disjoint_timer_query.getQueryObjectEXT(me,Hx),j(me)):z[te++]=me,ne[xe+1]=ge,k[xe+1]=te}for(z.length=te,te=0,xe=0;xe<le.length;++xe){var Fe=le[xe],X=Fe.startQueryIndex,$=Fe.endQueryIndex;Fe.sum+=ne[$]-ne[X];var Se=k[X],ce=k[$];ce===Se?(Fe.stats.gpuTime+=Fe.sum/1e6,oe(Fe)):(Fe.startQueryIndex=Se,Fe.endQueryIndex=ce,le[te++]=Fe)}le.length=te}}return{beginQuery:B,endQuery:K,pushScopeStats:J,update:G,getNumPendingQueries:function(){return z.length},clear:function(){_.push.apply(_,z);for(var te=0;te<_.length;te++)h.ext_disjoint_timer_query.deleteQueryEXT(_[te]);z.length=0,_.length=0},restore:function(){z.length=0,_.length=0}}},Wx=16384,qx=256,Yx=1024,Zx=34962,Bc="webglcontextlost",Uc="webglcontextrestored",Vc=1,Qx=2,Kx=3;function $c(a,h){for(var _=0;_<a.length;++_)if(a[_]===h)return _;return-1}function Jx(a){var h=Ft(a);if(!h)return null;var _=h.gl,O=_.getContextAttributes(),j=_.isContextLost(),z=Xn(_,h);if(!z)return null;var B=ss(),K=$x(),Q=z.extensions,ie=Xx(_,Q),ae=Mr(),oe=_.drawingBufferWidth,le=_.drawingBufferHeight,J={tick:0,time:0,viewportWidth:oe,viewportHeight:le,framebufferWidth:oe,framebufferHeight:le,drawingBufferWidth:oe,drawingBufferHeight:le,pixelRatio:h.pixelRatio},ne={},k={elements:null,primitive:4,count:-1,offset:0,instances:-1},G=Gg(_,Q),te=ty(_,K,h,ge),xe=dy(_,Q,te,K),Z=dx(_,Q,G,K,te,xe,k);function ge(Ie){return Z.destroyBuffer(Ie)}var me=gx(_,B,K,h),Fe=Hy(_,Q,G,function(){Se.procs.poll()},J,K,h),X=jy(_,Q,G,K,h),$=cx(_,Q,G,Fe,X,K),Se=Vx(_,B,Q,G,te,xe,Fe,$,ne,Z,me,k,J,ie,h),ce=bx(_,$,Se.procs.poll,J,O,Q,G),ee=Se.next,he=_.canvas,de=[],Ve=[],Ne=[],pe=[h.onDestroy],ye=null;function ze(){if(de.length===0){ie&&ie.update(),ye=null;return}ye=cr.next(ze),Gt();for(var Ie=de.length-1;Ie>=0;--Ie){var et=de[Ie];et&&et(J,null,0)}_.flush(),ie&&ie.update()}function $e(){!ye&&de.length>0&&(ye=cr.next(ze))}function Je(){ye&&(cr.cancel(ze),ye=null)}function vt(Ie){Ie.preventDefault(),j=!0,Je(),Ve.forEach(function(et){et()})}function yt(Ie){_.getError(),j=!1,z.restore(),me.restore(),te.restore(),Fe.restore(),X.restore(),$.restore(),Z.restore(),ie&&ie.restore(),Se.procs.refresh(),$e(),Ne.forEach(function(et){et()})}he&&(he.addEventListener(Bc,vt,!1),he.addEventListener(Uc,yt,!1));function tt(){de.length=0,Je(),he&&(he.removeEventListener(Bc,vt),he.removeEventListener(Uc,yt)),me.clear(),$.clear(),X.clear(),Z.clear(),Fe.clear(),xe.clear(),te.clear(),ie&&ie.clear(),pe.forEach(function(Ie){Ie()})}function Et(Ie){d(!!Ie,"invalid args to regl({...})"),d.type(Ie,"object","invalid args to regl({...})");function et(L){var A=r({},L);delete A.uniforms,delete A.attributes,delete A.context,delete A.vao,"stencil"in A&&A.stencil.op&&(A.stencil.opBack=A.stencil.opFront=A.stencil.op,delete A.stencil.op);function w(E){if(E in A){var p=A[E];delete A[E],Object.keys(p).forEach(function(x){A[E+"."+x]=p[x]})}}return w("blend"),w("depth"),w("cull"),w("stencil"),w("polygonOffset"),w("scissor"),w("sample"),"vao"in L&&(A.vao=L.vao),A}function nt(L,A){var w={},E={};return Object.keys(L).forEach(function(p){var x=L[p];if(Lt.isDynamic(x)){E[p]=Lt.unbox(x,p);return}else if(A&&Array.isArray(x)){for(var g=0;g<x.length;++g)if(Lt.isDynamic(x[g])){E[p]=Lt.unbox(x,p);return}}w[p]=x}),{dynamic:E,static:w}}var bt=nt(Ie.context||{},!0),Pn=nt(Ie.uniforms||{},!0),wr=nt(Ie.attributes||{},!1),y=nt(et(Ie),!1),M={gpuTime:0,cpuTime:0,count:0},I=Se.compile(y,wr,Pn,bt,M),_e=I.draw,Ke=I.batch,m=I.scope,c=[];function T(L){for(;c.length<L;)c.push(null);return c}function P(L,A){var w;if(j&&d.raise("context lost"),typeof L=="function")return m.call(this,null,L,0);if(typeof A=="function")if(typeof L=="number")for(w=0;w<L;++w)m.call(this,null,A,w);else if(Array.isArray(L))for(w=0;w<L.length;++w)m.call(this,L[w],A,w);else return m.call(this,L,A,0);else if(typeof L=="number"){if(L>0)return Ke.call(this,T(L|0),L|0)}else if(Array.isArray(L)){if(L.length)return Ke.call(this,L,L.length)}else return _e.call(this,L)}return r(P,{stats:M,destroy:function(){I.destroy()}})}var ht=$.setFBO=Et({framebuffer:Lt.define.call(null,Vc,"framebuffer")});function Tt(Ie,et){var nt=0;Se.procs.poll();var bt=et.color;bt&&(_.clearColor(+bt[0]||0,+bt[1]||0,+bt[2]||0,+bt[3]||0),nt|=Wx),"depth"in et&&(_.clearDepth(+et.depth),nt|=qx),"stencil"in et&&(_.clearStencil(et.stencil|0),nt|=Yx),d(!!nt,"called regl.clear with no buffer specified"),_.clear(nt)}function Pt(Ie){if(d(typeof Ie=="object"&&Ie,"regl.clear() takes an object as input"),"framebuffer"in Ie)if(Ie.framebuffer&&Ie.framebuffer_reglType==="framebufferCube")for(var et=0;et<6;++et)ht(r({framebuffer:Ie.framebuffer.faces[et]},Ie),Tt);else ht(Ie,Tt);else Tt(null,Ie)}function Ct(Ie){d.type(Ie,"function","regl.frame() callback must be a function"),de.push(Ie);function et(){var nt=$c(de,Ie);d(nt>=0,"cannot cancel a frame twice");function bt(){var Pn=$c(de,bt);de[Pn]=de[de.length-1],de.length-=1,de.length<=0&&Je()}de[nt]=bt}return $e(),{cancel:et}}function It(){var Ie=ee.viewport,et=ee.scissor_box;Ie[0]=Ie[1]=et[0]=et[1]=0,J.viewportWidth=J.framebufferWidth=J.drawingBufferWidth=Ie[2]=et[2]=_.drawingBufferWidth,J.viewportHeight=J.framebufferHeight=J.drawingBufferHeight=Ie[3]=et[3]=_.drawingBufferHeight}function Gt(){J.tick+=1,J.time=qe(),It(),Se.procs.poll()}function xt(){Fe.refresh(),It(),Se.procs.refresh(),ie&&ie.update()}function qe(){return(Mr()-ae)/1e3}xt();function Bt(Ie,et){d.type(et,"function","listener callback must be a function");var nt;switch(Ie){case"frame":return Ct(et);case"lost":nt=Ve;break;case"restore":nt=Ne;break;case"destroy":nt=pe;break;default:d.raise("invalid event, must be one of frame,lost,restore,destroy")}return nt.push(et),{cancel:function(){for(var bt=0;bt<nt.length;++bt)if(nt[bt]===et){nt[bt]=nt[nt.length-1],nt.pop();return}}}}var ot=r(Et,{clear:Pt,prop:Lt.define.bind(null,Vc),context:Lt.define.bind(null,Qx),this:Lt.define.bind(null,Kx),draw:Et({}),buffer:function(Ie){return te.create(Ie,Zx,!1,!1)},elements:function(Ie){return xe.create(Ie,!1)},texture:Fe.create2D,cube:Fe.createCube,renderbuffer:X.create,framebuffer:$.create,framebufferCube:$.createCube,vao:Z.createVAO,attributes:O,frame:Ct,on:Bt,limits:G,hasExtension:function(Ie){return G.extensions.indexOf(Ie.toLowerCase())>=0},read:ce,destroy:tt,_gl:_,_refresh:xt,poll:function(){Gt(),ie&&ie.update()},now:qe,stats:K});return h.onDone(null,ot),ot}return Jx})}(io)),io.exports}var Sp=_p();const Tp=Da(Sp),wp="#b3b3b3",Ap=void 0,Ep=void 0,Pp=1,Cp=4,kp="#666666",Lp=.1,Fp=1,Rp=1,Ip="#222222",We={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,arrowSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,arrowLinks:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",focusedPointRingColor:"white",focusedPointIndex:void 0,useClassicQuadtree:!1,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,repulsionQuadtreeLevels:12,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},Dp=.7,zp=.95,Op=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Zf,setPrototypeOf:Qf,isFrozen:Mp,getPrototypeOf:Np,getOwnPropertyDescriptor:Gp}=Object;let{freeze:Xt,seal:on,create:Kf}=Object,{apply:za,construct:Oa}=typeof Reflect<"u"&&Reflect;Xt||(Xt=function(e){return e}),on||(on=function(e){return e}),za||(za=function(e,n,r){return e.apply(n,r)}),Oa||(Oa=function(e,n){return new e(...n)});const oo=qt(Array.prototype.forEach),Bp=qt(Array.prototype.lastIndexOf),Jf=qt(Array.prototype.pop),li=qt(Array.prototype.push),Up=qt(Array.prototype.splice),ao=qt(String.prototype.toLowerCase),Ma=qt(String.prototype.toString),eu=qt(String.prototype.match),ci=qt(String.prototype.replace),Vp=qt(String.prototype.indexOf),$p=qt(String.prototype.trim),dn=qt(Object.prototype.hasOwnProperty),Wt=qt(RegExp.prototype.test),hi=Hp(TypeError);function qt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return za(t,e,r)}}function Hp(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Oa(t,n)}}function rt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ao;Qf&&Qf(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=n(i);o!==i&&(Mp(e)||(e[r]=o),i=o)}t[i]=!0}return t}function jp(t){for(let e=0;e<t.length;e++)dn(t,e)||(t[e]=null);return t}function Rn(t){const e=Kf(null);for(const[n,r]of Zf(t))dn(t,n)&&(Array.isArray(r)?e[n]=jp(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=Rn(r):e[n]=r);return e}function di(t,e){for(;t!==null;){const r=Gp(t,e);if(r){if(r.get)return qt(r.get);if(typeof r.value=="function")return qt(r.value)}t=Np(t)}function n(){return null}return n}const tu=Xt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Na=Xt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ga=Xt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Xp=Xt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ba=Xt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Wp=Xt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nu=Xt(["#text"]),ru=Xt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ua=Xt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),iu=Xt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),so=Xt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qp=on(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Yp=on(/<%[\w\W]*|[\w\W]*%>/gm),Zp=on(/\$\{[\w\W]*/gm),Qp=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),Kp=on(/^aria-[\-\w]+$/),ou=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Jp=on(/^(?:\w+script|data):/i),e0=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),au=on(/^html$/i),t0=on(/^[a-z][.\w]*(-[.\w]+)+$/i);var su=Object.freeze({__proto__:null,ARIA_ATTR:Kp,ATTR_WHITESPACE:e0,CUSTOM_ELEMENT:t0,DATA_ATTR:Qp,DOCTYPE_NAME:au,ERB_EXPR:Yp,IS_ALLOWED_URI:ou,IS_SCRIPT_OR_DATA:Jp,MUSTACHE_EXPR:qp,TMPLIT_EXPR:Zp});const mi={element:1,text:3,progressingInstruction:7,comment:8,document:9},n0=function(){return typeof window>"u"?null:window},r0=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},fu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function uu(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n0();const e=Be=>uu(Be);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==mi.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:f,Element:u,NodeFilter:l,NamedNodeMap:v=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:b,DOMParser:S,trustedTypes:D}=t,Y=u.prototype,Ee=di(Y,"cloneNode"),Te=di(Y,"remove"),se=di(Y,"nextSibling"),Ue=di(Y,"childNodes"),He=di(Y,"parentNode");if(typeof s=="function"){const Be=n.createElement("template");Be.content&&Be.content.ownerDocument&&(n=Be.content.ownerDocument)}let H,fe="";const{implementation:Re,createNodeIterator:Ge,createDocumentFragment:Ye,getElementsByTagName:at}=n,{importNode:ut}=r;let Ae=fu();e.isSupported=typeof Zf=="function"&&typeof He=="function"&&Re&&Re.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:lt,ERB_EXPR:it,TMPLIT_EXPR:N,DATA_ATTR:Ce,ARIA_ATTR:re,IS_SCRIPT_OR_DATA:ke,ATTR_WHITESPACE:Xe,CUSTOM_ELEMENT:je}=su;let{IS_ALLOWED_URI:Qe}=su,Ze=null;const dt=rt({},[...tu,...Na,...Ga,...Ba,...nu]);let ct=null;const _t=rt({},[...ru,...Ua,...iu,...so]);let st=Object.seal(Kf(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$t=null,Ht=null,Qt=!0,zn=!0,wo=!1,Ao=!0,On=!1,sr=!0,Tn=!1,Ir=!1,Dr=!1,$n=!1,zt=!1,fr=!1,ur=!0,Eo=!1;const as="user-content-";let d=!0,lr=!1,Hn={},jn=null;const Po=rt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let wn=null;const yi=rt({},["audio","video","img","source","image","track"]);let Mn=null;const xi=rt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),zr="http://www.w3.org/1998/Math/MathML",Or="http://www.w3.org/2000/svg",an="http://www.w3.org/1999/xhtml";let Lt=an,cr=!1,Mr=null;const ss=rt({},[zr,Or,an],Ma);let Nr=rt({},["mi","mo","mn","ms","mtext"]),Gr=rt({},["annotation-xml"]);const fs=rt({},["title","style","font","a","script"]);let hr=null;const Co=["application/xhtml+xml","text/html"],ko="text/html";let Ft=null,Xn=null;const Yt=n.createElement("form"),Lo=function(C){return C instanceof RegExp||C instanceof Function},bi=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xn&&Xn===C)){if((!C||typeof C!="object")&&(C={}),C=Rn(C),hr=Co.indexOf(C.PARSER_MEDIA_TYPE)===-1?ko:C.PARSER_MEDIA_TYPE,Ft=hr==="application/xhtml+xml"?Ma:ao,Ze=dn(C,"ALLOWED_TAGS")?rt({},C.ALLOWED_TAGS,Ft):dt,ct=dn(C,"ALLOWED_ATTR")?rt({},C.ALLOWED_ATTR,Ft):_t,Mr=dn(C,"ALLOWED_NAMESPACES")?rt({},C.ALLOWED_NAMESPACES,Ma):ss,Mn=dn(C,"ADD_URI_SAFE_ATTR")?rt(Rn(xi),C.ADD_URI_SAFE_ATTR,Ft):xi,wn=dn(C,"ADD_DATA_URI_TAGS")?rt(Rn(yi),C.ADD_DATA_URI_TAGS,Ft):yi,jn=dn(C,"FORBID_CONTENTS")?rt({},C.FORBID_CONTENTS,Ft):Po,$t=dn(C,"FORBID_TAGS")?rt({},C.FORBID_TAGS,Ft):Rn({}),Ht=dn(C,"FORBID_ATTR")?rt({},C.FORBID_ATTR,Ft):Rn({}),Hn=dn(C,"USE_PROFILES")?C.USE_PROFILES:!1,Qt=C.ALLOW_ARIA_ATTR!==!1,zn=C.ALLOW_DATA_ATTR!==!1,wo=C.ALLOW_UNKNOWN_PROTOCOLS||!1,Ao=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,On=C.SAFE_FOR_TEMPLATES||!1,sr=C.SAFE_FOR_XML!==!1,Tn=C.WHOLE_DOCUMENT||!1,$n=C.RETURN_DOM||!1,zt=C.RETURN_DOM_FRAGMENT||!1,fr=C.RETURN_TRUSTED_TYPE||!1,Dr=C.FORCE_BODY||!1,ur=C.SANITIZE_DOM!==!1,Eo=C.SANITIZE_NAMED_PROPS||!1,d=C.KEEP_CONTENT!==!1,lr=C.IN_PLACE||!1,Qe=C.ALLOWED_URI_REGEXP||ou,Lt=C.NAMESPACE||an,Nr=C.MATHML_TEXT_INTEGRATION_POINTS||Nr,Gr=C.HTML_INTEGRATION_POINTS||Gr,st=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Lo(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(st.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Lo(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(st.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(st.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),On&&(zn=!1),zt&&($n=!0),Hn&&(Ze=rt({},nu),ct=[],Hn.html===!0&&(rt(Ze,tu),rt(ct,ru)),Hn.svg===!0&&(rt(Ze,Na),rt(ct,Ua),rt(ct,so)),Hn.svgFilters===!0&&(rt(Ze,Ga),rt(ct,Ua),rt(ct,so)),Hn.mathMl===!0&&(rt(Ze,Ba),rt(ct,iu),rt(ct,so))),C.ADD_TAGS&&(Ze===dt&&(Ze=Rn(Ze)),rt(Ze,C.ADD_TAGS,Ft)),C.ADD_ATTR&&(ct===_t&&(ct=Rn(ct)),rt(ct,C.ADD_ATTR,Ft)),C.ADD_URI_SAFE_ATTR&&rt(Mn,C.ADD_URI_SAFE_ATTR,Ft),C.FORBID_CONTENTS&&(jn===Po&&(jn=Rn(jn)),rt(jn,C.FORBID_CONTENTS,Ft)),d&&(Ze["#text"]=!0),Tn&&rt(Ze,["html","head","body"]),Ze.table&&(rt(Ze,["tbody"]),delete $t.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw hi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw hi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');H=C.TRUSTED_TYPES_POLICY,fe=H.createHTML("")}else H===void 0&&(H=r0(D,i)),H!==null&&typeof fe=="string"&&(fe=H.createHTML(""));Xt&&Xt(C),Xn=C}},Fo=rt({},[...Na,...Ga,...Xp]),Ro=rt({},[...Ba,...Wp]),us=function(C){let ve=He(C);(!ve||!ve.tagName)&&(ve={namespaceURI:Lt,tagName:"template"});const De=ao(C.tagName),mt=ao(ve.tagName);return Mr[C.namespaceURI]?C.namespaceURI===Or?ve.namespaceURI===an?De==="svg":ve.namespaceURI===zr?De==="svg"&&(mt==="annotation-xml"||Nr[mt]):!!Fo[De]:C.namespaceURI===zr?ve.namespaceURI===an?De==="math":ve.namespaceURI===Or?De==="math"&&Gr[mt]:!!Ro[De]:C.namespaceURI===an?ve.namespaceURI===Or&&!Gr[mt]||ve.namespaceURI===zr&&!Nr[mt]?!1:!Ro[De]&&(fs[De]||!Fo[De]):!!(hr==="application/xhtml+xml"&&Mr[C.namespaceURI]):!1},sn=function(C){li(e.removed,{element:C});try{He(C).removeChild(C)}catch{Te(C)}},Wn=function(C,ve){try{li(e.removed,{attribute:ve.getAttributeNode(C),from:ve})}catch{li(e.removed,{attribute:null,from:ve})}if(ve.removeAttribute(C),C==="is")if($n||zt)try{sn(ve)}catch{}else try{ve.setAttribute(C,"")}catch{}},Io=function(C){let ve=null,De=null;if(Dr)C="<remove></remove>"+C;else{const At=eu(C,/^[\r\n\t ]+/);De=At&&At[0]}hr==="application/xhtml+xml"&&Lt===an&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const mt=H?H.createHTML(C):C;if(Lt===an)try{ve=new S().parseFromString(mt,hr)}catch{}if(!ve||!ve.documentElement){ve=Re.createDocument(Lt,"template",null);try{ve.documentElement.innerHTML=cr?fe:mt}catch{}}const Ot=ve.body||ve.documentElement;return C&&De&&Ot.insertBefore(n.createTextNode(De),Ot.childNodes[0]||null),Lt===an?at.call(ve,Tn?"html":"body")[0]:Tn?ve.documentElement:Ot},_i=function(C){return Ge.call(C.ownerDocument||C,C,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Br=function(C){return C instanceof b&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof v)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},gt=function(C){return typeof f=="function"&&C instanceof f};function vn(Be,C,ve){oo(Be,De=>{De.call(e,C,ve,Xn)})}const Do=function(C){let ve=null;if(vn(Ae.beforeSanitizeElements,C,null),Br(C))return sn(C),!0;const De=Ft(C.nodeName);if(vn(Ae.uponSanitizeElement,C,{tagName:De,allowedTags:Ze}),sr&&C.hasChildNodes()&&!gt(C.firstElementChild)&&Wt(/<[/\w!]/g,C.innerHTML)&&Wt(/<[/\w!]/g,C.textContent)||C.nodeType===mi.progressingInstruction||sr&&C.nodeType===mi.comment&&Wt(/<[/\w]/g,C.data))return sn(C),!0;if(!Ze[De]||$t[De]){if(!$t[De]&&Oo(De)&&(st.tagNameCheck instanceof RegExp&&Wt(st.tagNameCheck,De)||st.tagNameCheck instanceof Function&&st.tagNameCheck(De)))return!1;if(d&&!jn[De]){const mt=He(C)||C.parentNode,Ot=Ue(C)||C.childNodes;if(Ot&&mt){const At=Ot.length;for(let jt=At-1;jt>=0;--jt){const gn=Ee(Ot[jt],!0);gn.__removalCount=(C.__removalCount||0)+1,mt.insertBefore(gn,se(C))}}}return sn(C),!0}return C instanceof u&&!us(C)||(De==="noscript"||De==="noembed"||De==="noframes")&&Wt(/<\/no(script|embed|frames)/i,C.innerHTML)?(sn(C),!0):(On&&C.nodeType===mi.text&&(ve=C.textContent,oo([lt,it,N],mt=>{ve=ci(ve,mt," ")}),C.textContent!==ve&&(li(e.removed,{element:C.cloneNode()}),C.textContent=ve)),vn(Ae.afterSanitizeElements,C,null),!1)},zo=function(C,ve,De){if(ur&&(ve==="id"||ve==="name")&&(De in n||De in Yt))return!1;if(!(zn&&!Ht[ve]&&Wt(Ce,ve))){if(!(Qt&&Wt(re,ve))){if(!ct[ve]||Ht[ve]){if(!(Oo(C)&&(st.tagNameCheck instanceof RegExp&&Wt(st.tagNameCheck,C)||st.tagNameCheck instanceof Function&&st.tagNameCheck(C))&&(st.attributeNameCheck instanceof RegExp&&Wt(st.attributeNameCheck,ve)||st.attributeNameCheck instanceof Function&&st.attributeNameCheck(ve))||ve==="is"&&st.allowCustomizedBuiltInElements&&(st.tagNameCheck instanceof RegExp&&Wt(st.tagNameCheck,De)||st.tagNameCheck instanceof Function&&st.tagNameCheck(De))))return!1}else if(!Mn[ve]){if(!Wt(Qe,ci(De,Xe,""))){if(!((ve==="src"||ve==="xlink:href"||ve==="href")&&C!=="script"&&Vp(De,"data:")===0&&wn[C])){if(!(wo&&!Wt(ke,ci(De,Xe,"")))){if(De)return!1}}}}}}return!0},Oo=function(C){return C!=="annotation-xml"&&eu(C,je)},Mo=function(C){vn(Ae.beforeSanitizeAttributes,C,null);const{attributes:ve}=C;if(!ve||Br(C))return;const De={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ct,forceKeepAttr:void 0};let mt=ve.length;for(;mt--;){const Ot=ve[mt],{name:At,namespaceURI:jt,value:gn}=Ot,dr=Ft(At),Si=gn;let Mt=At==="value"?Si:$p(Si);if(De.attrName=dr,De.attrValue=Mt,De.keepAttr=!0,De.forceKeepAttr=void 0,vn(Ae.uponSanitizeAttribute,C,De),Mt=De.attrValue,Eo&&(dr==="id"||dr==="name")&&(Wn(At,C),Mt=as+Mt),sr&&Wt(/((--!?|])>)|<\/(style|title)/i,Mt)){Wn(At,C);continue}if(De.forceKeepAttr)continue;if(!De.keepAttr){Wn(At,C);continue}if(!Ao&&Wt(/\/>/i,Mt)){Wn(At,C);continue}On&&oo([lt,it,N],Go=>{Mt=ci(Mt,Go," ")});const No=Ft(C.nodeName);if(!zo(No,dr,Mt)){Wn(At,C);continue}if(H&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!jt)switch(D.getAttributeType(No,dr)){case"TrustedHTML":{Mt=H.createHTML(Mt);break}case"TrustedScriptURL":{Mt=H.createScriptURL(Mt);break}}if(Mt!==Si)try{jt?C.setAttributeNS(jt,At,Mt):C.setAttribute(At,Mt),Br(C)?sn(C):Jf(e.removed)}catch{Wn(At,C)}}vn(Ae.afterSanitizeAttributes,C,null)},ls=function Be(C){let ve=null;const De=_i(C);for(vn(Ae.beforeSanitizeShadowDOM,C,null);ve=De.nextNode();)vn(Ae.uponSanitizeShadowNode,ve,null),Do(ve),Mo(ve),ve.content instanceof o&&Be(ve.content);vn(Ae.afterSanitizeShadowDOM,C,null)};return e.sanitize=function(Be){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=null,De=null,mt=null,Ot=null;if(cr=!Be,cr&&(Be="<!-->"),typeof Be!="string"&&!gt(Be))if(typeof Be.toString=="function"){if(Be=Be.toString(),typeof Be!="string")throw hi("dirty is not a string, aborting")}else throw hi("toString is not a function");if(!e.isSupported)return Be;if(Ir||bi(C),e.removed=[],typeof Be=="string"&&(lr=!1),lr){if(Be.nodeName){const gn=Ft(Be.nodeName);if(!Ze[gn]||$t[gn])throw hi("root node is forbidden and cannot be sanitized in-place")}}else if(Be instanceof f)ve=Io("<!---->"),De=ve.ownerDocument.importNode(Be,!0),De.nodeType===mi.element&&De.nodeName==="BODY"||De.nodeName==="HTML"?ve=De:ve.appendChild(De);else{if(!$n&&!On&&!Tn&&Be.indexOf("<")===-1)return H&&fr?H.createHTML(Be):Be;if(ve=Io(Be),!ve)return $n?null:fr?fe:""}ve&&Dr&&sn(ve.firstChild);const At=_i(lr?Be:ve);for(;mt=At.nextNode();)Do(mt),Mo(mt),mt.content instanceof o&&ls(mt.content);if(lr)return Be;if($n){if(zt)for(Ot=Ye.call(ve.ownerDocument);ve.firstChild;)Ot.appendChild(ve.firstChild);else Ot=ve;return(ct.shadowroot||ct.shadowrootmode)&&(Ot=ut.call(r,Ot,!0)),Ot}let jt=Tn?ve.outerHTML:ve.innerHTML;return Tn&&Ze["!doctype"]&&ve.ownerDocument&&ve.ownerDocument.doctype&&ve.ownerDocument.doctype.name&&Wt(au,ve.ownerDocument.doctype.name)&&(jt="<!DOCTYPE "+ve.ownerDocument.doctype.name+`>
|
|
8
|
+
`),J=Function.apply(null,h.concat(le));return J.apply(null,_)}return{global:K,link:O,block:j,proc:ie,scope:z,cond:B,compile:ae}}var Zr="xyzw".split(""),fc=5121,Qr=1,Ns=2,Gs=0,Bs=1,Us=2,Vs=3,na=4,uc=5,lc=6,cc="dither",hc="blend.enable",dc="blend.color",$s="blend.equation",Hs="blend.func",mc="depth.enable",pc="depth.func",vc="depth.range",gc="depth.mask",js="colorMask",yc="cull.enable",xc="cull.face",Xs="frontFace",Ws="lineWidth",bc="polygonOffset.enable",qs="polygonOffset.offset",_c="sample.alpha",Sc="sample.enable",Ys="sample.coverage",Tc="stencil.enable",wc="stencil.mask",Zs="stencil.func",Qs="stencil.opFront",ki="stencil.opBack",Ac="scissor.enable",ra="scissor.box",Gn="viewport",Li="profile",xr="framebuffer",Fi="vert",Ri="frag",br="elements",_r="primitive",Sr="count",ia="offset",oa="instances",Ii="vao",Ks="Width",Js="Height",Kr=xr+Ks,Jr=xr+Js,Sx=Gn+Ks,Tx=Gn+Js,Ec="drawingBuffer",Pc=Ec+Ks,Cc=Ec+Js,wx=[Hs,$s,Zs,Qs,ki,Ys,Gn,ra,qs],ei=34962,ef=34963,Ax=35632,Ex=35633,kc=3553,Px=34067,Cx=2884,kx=3042,Lx=3024,Fx=2960,Rx=2929,Ix=3089,Dx=32823,zx=32926,Ox=32928,tf=5126,aa=35664,sa=35665,fa=35666,nf=5124,ua=35667,la=35668,ca=35669,rf=35670,ha=35671,da=35672,ma=35673,Di=35674,zi=35675,Oi=35676,Mi=35678,Ni=35680,of=4,Gi=1028,Tr=1029,Lc=2304,af=2305,Mx=32775,Nx=32776,Gx=519,Qn=7680,Fc=0,Rc=1,Ic=32774,Bx=513,Dc=36160,Ux=36064,En={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},zc=["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"],ti={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},Oc={frag:Ax,vert:Ex},sf={cw:Lc,ccw:af};function pa(a){return Array.isArray(a)||n(a)||yn(a)}function Mc(a){return a.sort(function(h,_){return h===Gn?-1:_===Gn?1:h<_?-1:1})}function Rt(a,h,_,O){this.thisDep=a,this.contextDep=h,this.propDep=_,this.append=O}function Jn(a){return a&&!(a.thisDep||a.contextDep||a.propDep)}function St(a){return new Rt(!1,!1,!1,a)}function Kt(a,h){var _=a.type;if(_===Gs){var O=a.data.length;return new Rt(!0,O>=1,O>=2,h)}else if(_===na){var j=a.data;return new Rt(j.thisDep,j.contextDep,j.propDep,h)}else{if(_===uc)return new Rt(!1,!1,!1,h);if(_===lc){for(var z=!1,B=!1,K=!1,Q=0;Q<a.data.length;++Q){var ie=a.data[Q];if(ie.type===Bs)K=!0;else if(ie.type===Us)B=!0;else if(ie.type===Vs)z=!0;else if(ie.type===Gs){z=!0;var ae=ie.data;ae>=1&&(B=!0),ae>=2&&(K=!0)}else ie.type===na&&(z=z||ie.data.thisDep,B=B||ie.data.contextDep,K=K||ie.data.propDep)}return new Rt(z,B,K,h)}else return new Rt(_===Vs,_===Us,_===Bs,h)}}var Nc=new Rt(!1,!1,!1,function(){});function Vx(a,h,_,O,j,z,B,K,Q,ie,ae,oe,le,J,ne){var k=ie.Record,G={add:32774,subtract:32778,"reverse subtract":32779};_.ext_blend_minmax&&(G.min=Mx,G.max=Nx);var te=_.angle_instanced_arrays,xe=_.webgl_draw_buffers,Z=_.oes_vertex_array_object,ge={dirty:!0,profile:ne.profile},me={},Fe=[],X={},$={};function Se(m){return m.replace(".","_")}function ce(m,c,T){var P=Se(m);Fe.push(m),me[P]=ge[P]=!!T,X[P]=c}function ee(m,c,T){var P=Se(m);Fe.push(m),Array.isArray(T)?(ge[P]=T.slice(),me[P]=T.slice()):ge[P]=me[P]=T,$[P]=c}ce(cc,Lx),ce(hc,kx),ee(dc,"blendColor",[0,0,0,0]),ee($s,"blendEquationSeparate",[Ic,Ic]),ee(Hs,"blendFuncSeparate",[Rc,Fc,Rc,Fc]),ce(mc,Rx,!0),ee(pc,"depthFunc",Bx),ee(vc,"depthRange",[0,1]),ee(gc,"depthMask",!0),ee(js,js,[!0,!0,!0,!0]),ce(yc,Cx),ee(xc,"cullFace",Tr),ee(Xs,Xs,af),ee(Ws,Ws,1),ce(bc,Dx),ee(qs,"polygonOffset",[0,0]),ce(_c,zx),ce(Sc,Ox),ee(Ys,"sampleCoverage",[1,!1]),ce(Tc,Fx),ee(wc,"stencilMask",-1),ee(Zs,"stencilFunc",[Gx,0,-1]),ee(Qs,"stencilOpSeparate",[Gi,Qn,Qn,Qn]),ee(ki,"stencilOpSeparate",[Tr,Qn,Qn,Qn]),ce(Ac,Ix),ee(ra,"scissor",[0,0,a.drawingBufferWidth,a.drawingBufferHeight]),ee(Gn,Gn,[0,0,a.drawingBufferWidth,a.drawingBufferHeight]);var he={gl:a,context:le,strings:h,next:me,current:ge,draw:oe,elements:z,buffer:j,shader:ae,attributes:ie.state,vao:ie,uniforms:Q,framebuffer:K,extensions:_,timer:J,isBufferArgs:pa},de={primTypes:Yn,compareFuncs:ti,blendFuncs:En,blendEquations:G,stencilOps:Kn,glTypes:mr,orientationType:sf};d.optional(function(){he.isArrayLike=pt}),xe&&(de.backBuffer=[Tr],de.drawBuffer=Yt(O.maxDrawbuffers,function(m){return m===0?[0]:Yt(m,function(c){return Ux+c})}));var Ve=0;function Ne(){var m=_x(),c=m.link,T=m.global;m.id=Ve++,m.batchId="0";var P=c(he),L=m.shared={props:"a0"};Object.keys(he).forEach(function(b){L[b]=T.def(P,".",b)}),d.optional(function(){m.CHECK=c(d),m.commandStr=d.guessCommand(),m.command=c(m.commandStr),m.assert=function(b,g,R){b("if(!(",g,"))",this.CHECK,".commandRaise(",c(R),",",this.command,");")},de.invalidBlendCombinations=zc});var A=m.next={},w=m.current={};Object.keys($).forEach(function(b){Array.isArray(ge[b])&&(A[b]=T.def(L.next,".",b),w[b]=T.def(L.current,".",b))});var E=m.constants={};Object.keys(de).forEach(function(b){E[b]=T.def(JSON.stringify(de[b]))}),m.invoke=function(b,g){switch(g.type){case Gs:var R=["this",L.context,L.props,m.batchId];return b.def(c(g.data),".call(",R.slice(0,Math.max(g.data.length+1,4)),")");case Bs:return b.def(L.props,g.data);case Us:return b.def(L.context,g.data);case Vs:return b.def("this",g.data);case na:return g.data.append(m,b),g.data.ref;case uc:return g.data.toString();case lc:return g.data.map(function(F){return m.invoke(b,F)})}},m.attribCache={};var v={};return m.scopeAttrib=function(b){var g=h.id(b);if(g in v)return v[g];var R=ie.scope[g];R||(R=ie.scope[g]=new k);var F=v[g]=c(R);return F},m}function pe(m){var c=m.static,T=m.dynamic,P;if(Li in c){var L=!!c[Li];P=St(function(w,E){return L}),P.enable=L}else if(Li in T){var A=T[Li];P=Kt(A,function(w,E){return w.invoke(E,A)})}return P}function ye(m,c){var T=m.static,P=m.dynamic;if(xr in T){var L=T[xr];return L?(L=K.getFramebuffer(L),d.command(L,"invalid framebuffer object"),St(function(w,E){var v=w.link(L),b=w.shared;E.set(b.framebuffer,".next",v);var g=b.context;return E.set(g,"."+Kr,v+".width"),E.set(g,"."+Jr,v+".height"),v})):St(function(w,E){var v=w.shared;E.set(v.framebuffer,".next","null");var b=v.context;return E.set(b,"."+Kr,b+"."+Pc),E.set(b,"."+Jr,b+"."+Cc),"null"})}else if(xr in P){var A=P[xr];return Kt(A,function(w,E){var v=w.invoke(E,A),b=w.shared,g=b.framebuffer,R=E.def(g,".getFramebuffer(",v,")");d.optional(function(){w.assert(E,"!"+v+"||"+R,"invalid framebuffer object")}),E.set(g,".next",R);var F=b.context;return E.set(F,"."+Kr,R+"?"+R+".width:"+F+"."+Pc),E.set(F,"."+Jr,R+"?"+R+".height:"+F+"."+Cc),R})}else return null}function ze(m,c,T){var P=m.static,L=m.dynamic;function A(v){if(v in P){var b=P[v];d.commandType(b,"object","invalid "+v,T.commandStr);var g=!0,R=b.x|0,F=b.y|0,V,W;return"width"in b?(V=b.width|0,d.command(V>=0,"invalid "+v,T.commandStr)):g=!1,"height"in b?(W=b.height|0,d.command(W>=0,"invalid "+v,T.commandStr)):g=!1,new Rt(!g&&c&&c.thisDep,!g&&c&&c.contextDep,!g&&c&&c.propDep,function(Le,be){var q=Le.shared.context,U=V;"width"in b||(U=be.def(q,".",Kr,"-",R));var Pe=W;return"height"in b||(Pe=be.def(q,".",Jr,"-",F)),[R,F,U,Pe]})}else if(v in L){var ue=L[v],Me=Kt(ue,function(Le,be){var q=Le.invoke(be,ue);d.optional(function(){Le.assert(be,q+"&&typeof "+q+'==="object"',"invalid "+v)});var U=Le.shared.context,Pe=be.def(q,".x|0"),we=be.def(q,".y|0"),Oe=be.def('"width" in ',q,"?",q,".width|0:","(",U,".",Kr,"-",Pe,")"),ft=be.def('"height" in ',q,"?",q,".height|0:","(",U,".",Jr,"-",we,")");return d.optional(function(){Le.assert(be,Oe+">=0&&"+ft+">=0","invalid "+v)}),[Pe,we,Oe,ft]});return c&&(Me.thisDep=Me.thisDep||c.thisDep,Me.contextDep=Me.contextDep||c.contextDep,Me.propDep=Me.propDep||c.propDep),Me}else return c?new Rt(c.thisDep,c.contextDep,c.propDep,function(Le,be){var q=Le.shared.context;return[0,0,be.def(q,".",Kr),be.def(q,".",Jr)]}):null}var w=A(Gn);if(w){var E=w;w=new Rt(w.thisDep,w.contextDep,w.propDep,function(v,b){var g=E.append(v,b),R=v.shared.context;return b.set(R,"."+Sx,g[2]),b.set(R,"."+Tx,g[3]),g})}return{viewport:w,scissor_box:A(ra)}}function $e(m,c){var T=m.static,P=typeof T[Ri]=="string"&&typeof T[Fi]=="string";if(P){if(Object.keys(c.dynamic).length>0)return null;var L=c.static,A=Object.keys(L);if(A.length>0&&typeof L[A[0]]=="number"){for(var w=[],E=0;E<A.length;++E)d(typeof L[A[E]]=="number","must specify all vertex attribute locations when using vaos"),w.push([L[A[E]]|0,A[E]]);return w}}return null}function Je(m,c,T){var P=m.static,L=m.dynamic;function A(g){if(g in P){var R=h.id(P[g]);d.optional(function(){ae.shader(Oc[g],R,d.guessCommand())});var F=St(function(){return R});return F.id=R,F}else if(g in L){var V=L[g];return Kt(V,function(W,ue){var Me=W.invoke(ue,V),Le=ue.def(W.shared.strings,".id(",Me,")");return d.optional(function(){ue(W.shared.shader,".shader(",Oc[g],",",Le,",",W.command,");")}),Le})}return null}var w=A(Ri),E=A(Fi),v=null,b;return Jn(w)&&Jn(E)?(v=ae.program(E.id,w.id,null,T),b=St(function(g,R){return g.link(v)})):b=new Rt(w&&w.thisDep||E&&E.thisDep,w&&w.contextDep||E&&E.contextDep,w&&w.propDep||E&&E.propDep,function(g,R){var F=g.shared.shader,V;w?V=w.append(g,R):V=R.def(F,".",Ri);var W;E?W=E.append(g,R):W=R.def(F,".",Fi);var ue=F+".program("+W+","+V;return d.optional(function(){ue+=","+g.command}),R.def(ue+")")}),{frag:w,vert:E,progVar:b,program:v}}function vt(m,c){var T=m.static,P=m.dynamic,L={},A=!1;function w(){if(Ii in T){var be=T[Ii];return be!==null&&ie.getVAO(be)===null&&(be=ie.createVAO(be)),A=!0,L.vao=be,St(function(U){var Pe=ie.getVAO(be);return Pe?U.link(Pe):"null"})}else if(Ii in P){A=!0;var q=P[Ii];return Kt(q,function(U,Pe){var we=U.invoke(Pe,q);return Pe.def(U.shared.vao+".getVAO("+we+")")})}return null}var E=w(),v=!1;function b(){if(br in T){var be=T[br];if(L.elements=be,pa(be)){var q=L.elements=z.create(be,!0);be=z.getElements(q),v=!0}else be&&(be=z.getElements(be),v=!0,d.command(be,"invalid elements",c.commandStr));var U=St(function(we,Oe){if(be){var ft=we.link(be);return we.ELEMENTS=ft,ft}return we.ELEMENTS=null,null});return U.value=be,U}else if(br in P){v=!0;var Pe=P[br];return Kt(Pe,function(we,Oe){var ft=we.shared,Ut=ft.isBufferArgs,Ar=ft.elements,Bn=we.invoke(Oe,Pe),Cn=Oe.def("null"),er=Oe.def(Ut,"(",Bn,")"),Er=we.cond(er).then(Cn,"=",Ar,".createStream(",Bn,");").else(Cn,"=",Ar,".getElements(",Bn,");");return d.optional(function(){we.assert(Er.else,"!"+Bn+"||"+Cn,"invalid elements")}),Oe.entry(Er),Oe.exit(we.cond(er).then(Ar,".destroyStream(",Cn,");")),we.ELEMENTS=Cn,Cn})}else if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(we,Oe){return Oe.def(we.shared.vao+".currentVAO?"+we.shared.elements+".getElements("+we.shared.vao+".currentVAO.elements):null")});return null}var g=b();function R(){if(_r in T){var be=T[_r];return L.primitive=be,d.commandParameter(be,Yn,"invalid primitve",c.commandStr),St(function(U,Pe){return Yn[be]})}else if(_r in P){var q=P[_r];return Kt(q,function(U,Pe){var we=U.constants.primTypes,Oe=U.invoke(Pe,q);return d.optional(function(){U.assert(Pe,Oe+" in "+we,"invalid primitive, must be one of "+Object.keys(Yn))}),Pe.def(we,"[",Oe,"]")})}else{if(v)return Jn(g)?g.value?St(function(U,Pe){return Pe.def(U.ELEMENTS,".primType")}):St(function(){return of}):new Rt(g.thisDep,g.contextDep,g.propDep,function(U,Pe){var we=U.ELEMENTS;return Pe.def(we,"?",we,".primType:",of)});if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(U,Pe){return Pe.def(U.shared.vao+".currentVAO?"+U.shared.vao+".currentVAO.primitive:"+of)})}return null}function F(be,q){if(be in T){var U=T[be]|0;return q?L.offset=U:L.instances=U,d.command(!q||U>=0,"invalid "+be,c.commandStr),St(function(we,Oe){return q&&(we.OFFSET=U),U})}else if(be in P){var Pe=P[be];return Kt(Pe,function(we,Oe){var ft=we.invoke(Oe,Pe);return q&&(we.OFFSET=ft,d.optional(function(){we.assert(Oe,ft+">=0","invalid "+be)})),ft})}else if(q){if(v)return St(function(we,Oe){return we.OFFSET=0,0});if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(we,Oe){return Oe.def(we.shared.vao+".currentVAO?"+we.shared.vao+".currentVAO.offset:0")})}else if(A)return new Rt(E.thisDep,E.contextDep,E.propDep,function(we,Oe){return Oe.def(we.shared.vao+".currentVAO?"+we.shared.vao+".currentVAO.instances:-1")});return null}var V=F(ia,!0);function W(){if(Sr in T){var be=T[Sr]|0;return L.count=be,d.command(typeof be=="number"&&be>=0,"invalid vertex count",c.commandStr),St(function(){return be})}else if(Sr in P){var q=P[Sr];return Kt(q,function(Oe,ft){var Ut=Oe.invoke(ft,q);return d.optional(function(){Oe.assert(ft,"typeof "+Ut+'==="number"&&'+Ut+">=0&&"+Ut+"===("+Ut+"|0)","invalid vertex count")}),Ut})}else if(v)if(Jn(g)){if(g)return V?new Rt(V.thisDep,V.contextDep,V.propDep,function(Oe,ft){var Ut=ft.def(Oe.ELEMENTS,".vertCount-",Oe.OFFSET);return d.optional(function(){Oe.assert(ft,Ut+">=0","invalid vertex offset/element buffer too small")}),Ut}):St(function(Oe,ft){return ft.def(Oe.ELEMENTS,".vertCount")});var U=St(function(){return-1});return d.optional(function(){U.MISSING=!0}),U}else{var Pe=new Rt(g.thisDep||V.thisDep,g.contextDep||V.contextDep,g.propDep||V.propDep,function(Oe,ft){var Ut=Oe.ELEMENTS;return Oe.OFFSET?ft.def(Ut,"?",Ut,".vertCount-",Oe.OFFSET,":-1"):ft.def(Ut,"?",Ut,".vertCount:-1")});return d.optional(function(){Pe.DYNAMIC=!0}),Pe}else if(A){var we=new Rt(E.thisDep,E.contextDep,E.propDep,function(Oe,ft){return ft.def(Oe.shared.vao,".currentVAO?",Oe.shared.vao,".currentVAO.count:-1")});return we}return null}var ue=R(),Me=W(),Le=F(oa,!1);return{elements:g,primitive:ue,count:Me,instances:Le,offset:V,vao:E,vaoActive:A,elementsActive:v,static:L}}function yt(m,c){var T=m.static,P=m.dynamic,L={};return Fe.forEach(function(A){var w=Se(A);function E(v,b){if(A in T){var g=v(T[A]);L[w]=St(function(){return g})}else if(A in P){var R=P[A];L[w]=Kt(R,function(F,V){return b(F,V,F.invoke(V,R))})}}switch(A){case yc:case hc:case cc:case Tc:case mc:case Ac:case bc:case _c:case Sc:case gc:return E(function(v){return d.commandType(v,"boolean",A,c.commandStr),v},function(v,b,g){return d.optional(function(){v.assert(b,"typeof "+g+'==="boolean"',"invalid flag "+A,v.commandStr)}),g});case pc:return E(function(v){return d.commandParameter(v,ti,"invalid "+A,c.commandStr),ti[v]},function(v,b,g){var R=v.constants.compareFuncs;return d.optional(function(){v.assert(b,g+" in "+R,"invalid "+A+", must be one of "+Object.keys(ti))}),b.def(R,"[",g,"]")});case vc:return E(function(v){return d.command(pt(v)&&v.length===2&&typeof v[0]=="number"&&typeof v[1]=="number"&&v[0]<=v[1],"depth range is 2d array",c.commandStr),v},function(v,b,g){d.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===2&&typeof "+g+'[0]==="number"&&typeof '+g+'[1]==="number"&&'+g+"[0]<="+g+"[1]","depth range must be a 2d array")});var R=b.def("+",g,"[0]"),F=b.def("+",g,"[1]");return[R,F]});case Hs:return E(function(v){d.commandType(v,"object","blend.func",c.commandStr);var b="srcRGB"in v?v.srcRGB:v.src,g="srcAlpha"in v?v.srcAlpha:v.src,R="dstRGB"in v?v.dstRGB:v.dst,F="dstAlpha"in v?v.dstAlpha:v.dst;return d.commandParameter(b,En,w+".srcRGB",c.commandStr),d.commandParameter(g,En,w+".srcAlpha",c.commandStr),d.commandParameter(R,En,w+".dstRGB",c.commandStr),d.commandParameter(F,En,w+".dstAlpha",c.commandStr),d.command(zc.indexOf(b+", "+R)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+b+", "+R+")",c.commandStr),[En[b],En[R],En[g],En[F]]},function(v,b,g){var R=v.constants.blendFuncs;d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid blend func, must be an object")});function F(q,U){var Pe=b.def('"',q,U,'" in ',g,"?",g,".",q,U,":",g,".",q);return d.optional(function(){v.assert(b,Pe+" in "+R,"invalid "+A+"."+q+U+", must be one of "+Object.keys(En))}),Pe}var V=F("src","RGB"),W=F("dst","RGB");d.optional(function(){var q=v.constants.invalidBlendCombinations;v.assert(b,q+".indexOf("+V+'+", "+'+W+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var ue=b.def(R,"[",V,"]"),Me=b.def(R,"[",F("src","Alpha"),"]"),Le=b.def(R,"[",W,"]"),be=b.def(R,"[",F("dst","Alpha"),"]");return[ue,Le,Me,be]});case $s:return E(function(v){if(typeof v=="string")return d.commandParameter(v,G,"invalid "+A,c.commandStr),[G[v],G[v]];if(typeof v=="object")return d.commandParameter(v.rgb,G,A+".rgb",c.commandStr),d.commandParameter(v.alpha,G,A+".alpha",c.commandStr),[G[v.rgb],G[v.alpha]];d.commandRaise("invalid blend.equation",c.commandStr)},function(v,b,g){var R=v.constants.blendEquations,F=b.def(),V=b.def(),W=v.cond("typeof ",g,'==="string"');return d.optional(function(){function ue(Me,Le,be){v.assert(Me,be+" in "+R,"invalid "+Le+", must be one of "+Object.keys(G))}ue(W.then,A,g),v.assert(W.else,g+"&&typeof "+g+'==="object"',"invalid "+A),ue(W.else,A+".rgb",g+".rgb"),ue(W.else,A+".alpha",g+".alpha")}),W.then(F,"=",V,"=",R,"[",g,"];"),W.else(F,"=",R,"[",g,".rgb];",V,"=",R,"[",g,".alpha];"),b(W),[F,V]});case dc:return E(function(v){return d.command(pt(v)&&v.length===4,"blend.color must be a 4d array",c.commandStr),Yt(4,function(b){return+v[b]})},function(v,b,g){return d.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===4","blend.color must be a 4d array")}),Yt(4,function(R){return b.def("+",g,"[",R,"]")})});case wc:return E(function(v){return d.commandType(v,"number",w,c.commandStr),v|0},function(v,b,g){return d.optional(function(){v.assert(b,"typeof "+g+'==="number"',"invalid stencil.mask")}),b.def(g,"|0")});case Zs:return E(function(v){d.commandType(v,"object",w,c.commandStr);var b=v.cmp||"keep",g=v.ref||0,R="mask"in v?v.mask:-1;return d.commandParameter(b,ti,A+".cmp",c.commandStr),d.commandType(g,"number",A+".ref",c.commandStr),d.commandType(R,"number",A+".mask",c.commandStr),[ti[b],g,R]},function(v,b,g){var R=v.constants.compareFuncs;d.optional(function(){function ue(){v.assert(b,Array.prototype.join.call(arguments,""),"invalid stencil.func")}ue(g+"&&typeof ",g,'==="object"'),ue('!("cmp" in ',g,")||(",g,".cmp in ",R,")")});var F=b.def('"cmp" in ',g,"?",R,"[",g,".cmp]",":",Qn),V=b.def(g,".ref|0"),W=b.def('"mask" in ',g,"?",g,".mask|0:-1");return[F,V,W]});case Qs:case ki:return E(function(v){d.commandType(v,"object",w,c.commandStr);var b=v.fail||"keep",g=v.zfail||"keep",R=v.zpass||"keep";return d.commandParameter(b,Kn,A+".fail",c.commandStr),d.commandParameter(g,Kn,A+".zfail",c.commandStr),d.commandParameter(R,Kn,A+".zpass",c.commandStr),[A===ki?Tr:Gi,Kn[b],Kn[g],Kn[R]]},function(v,b,g){var R=v.constants.stencilOps;d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid "+A)});function F(V){return d.optional(function(){v.assert(b,'!("'+V+'" in '+g+")||("+g+"."+V+" in "+R+")","invalid "+A+"."+V+", must be one of "+Object.keys(Kn))}),b.def('"',V,'" in ',g,"?",R,"[",g,".",V,"]:",Qn)}return[A===ki?Tr:Gi,F("fail"),F("zfail"),F("zpass")]});case qs:return E(function(v){d.commandType(v,"object",w,c.commandStr);var b=v.factor|0,g=v.units|0;return d.commandType(b,"number",w+".factor",c.commandStr),d.commandType(g,"number",w+".units",c.commandStr),[b,g]},function(v,b,g){d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid "+A)});var R=b.def(g,".factor|0"),F=b.def(g,".units|0");return[R,F]});case xc:return E(function(v){var b=0;return v==="front"?b=Gi:v==="back"&&(b=Tr),d.command(!!b,w,c.commandStr),b},function(v,b,g){return d.optional(function(){v.assert(b,g+'==="front"||'+g+'==="back"',"invalid cull.face")}),b.def(g,'==="front"?',Gi,":",Tr)});case Ws:return E(function(v){return d.command(typeof v=="number"&&v>=O.lineWidthDims[0]&&v<=O.lineWidthDims[1],"invalid line width, must be a positive number between "+O.lineWidthDims[0]+" and "+O.lineWidthDims[1],c.commandStr),v},function(v,b,g){return d.optional(function(){v.assert(b,"typeof "+g+'==="number"&&'+g+">="+O.lineWidthDims[0]+"&&"+g+"<="+O.lineWidthDims[1],"invalid line width")}),g});case Xs:return E(function(v){return d.commandParameter(v,sf,w,c.commandStr),sf[v]},function(v,b,g){return d.optional(function(){v.assert(b,g+'==="cw"||'+g+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),b.def(g+'==="cw"?'+Lc+":"+af)});case js:return E(function(v){return d.command(pt(v)&&v.length===4,"color.mask must be length 4 array",c.commandStr),v.map(function(b){return!!b})},function(v,b,g){return d.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===4","invalid color.mask")}),Yt(4,function(R){return"!!"+g+"["+R+"]"})});case Ys:return E(function(v){d.command(typeof v=="object"&&v,w,c.commandStr);var b="value"in v?v.value:1,g=!!v.invert;return d.command(typeof b=="number"&&b>=0&&b<=1,"sample.coverage.value must be a number between 0 and 1",c.commandStr),[b,g]},function(v,b,g){d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid sample.coverage")});var R=b.def('"value" in ',g,"?+",g,".value:1"),F=b.def("!!",g,".invert");return[R,F]})}}),L}function tt(m,c){var T=m.static,P=m.dynamic,L={};return Object.keys(T).forEach(function(A){var w=T[A],E;if(typeof w=="number"||typeof w=="boolean")E=St(function(){return w});else if(typeof w=="function"){var v=w._reglType;v==="texture2d"||v==="textureCube"?E=St(function(b){return b.link(w)}):v==="framebuffer"||v==="framebufferCube"?(d.command(w.color.length>0,'missing color attachment for framebuffer sent to uniform "'+A+'"',c.commandStr),E=St(function(b){return b.link(w.color[0])})):d.commandRaise('invalid data for uniform "'+A+'"',c.commandStr)}else pt(w)?E=St(function(b){var g=b.global.def("[",Yt(w.length,function(R){return d.command(typeof w[R]=="number"||typeof w[R]=="boolean","invalid uniform "+A,b.commandStr),w[R]}),"]");return g}):d.commandRaise('invalid or missing data for uniform "'+A+'"',c.commandStr);E.value=w,L[A]=E}),Object.keys(P).forEach(function(A){var w=P[A];L[A]=Kt(w,function(E,v){return E.invoke(v,w)})}),L}function Et(m,c){var T=m.static,P=m.dynamic,L={};return Object.keys(T).forEach(function(A){var w=T[A],E=h.id(A),v=new k;if(pa(w))v.state=Qr,v.buffer=j.getBuffer(j.create(w,ei,!1,!0)),v.type=0;else{var b=j.getBuffer(w);if(b)v.state=Qr,v.buffer=b,v.type=0;else if(d.command(typeof w=="object"&&w,"invalid data for attribute "+A,c.commandStr),"constant"in w){var g=w.constant;v.buffer="null",v.state=Ns,typeof g=="number"?v.x=g:(d.command(pt(g)&&g.length>0&&g.length<=4,"invalid constant for attribute "+A,c.commandStr),Zr.forEach(function(Le,be){be<g.length&&(v[Le]=g[be])}))}else{pa(w.buffer)?b=j.getBuffer(j.create(w.buffer,ei,!1,!0)):b=j.getBuffer(w.buffer),d.command(!!b,'missing buffer for attribute "'+A+'"',c.commandStr);var R=w.offset|0;d.command(R>=0,'invalid offset for attribute "'+A+'"',c.commandStr);var F=w.stride|0;d.command(F>=0&&F<256,'invalid stride for attribute "'+A+'", must be integer betweeen [0, 255]',c.commandStr);var V=w.size|0;d.command(!("size"in w)||V>0&&V<=4,'invalid size for attribute "'+A+'", must be 1,2,3,4',c.commandStr);var W=!!w.normalized,ue=0;"type"in w&&(d.commandParameter(w.type,mr,"invalid type for attribute "+A,c.commandStr),ue=mr[w.type]);var Me=w.divisor|0;d.optional(function(){"divisor"in w&&(d.command(Me===0||te,'cannot specify divisor for attribute "'+A+'", instancing not supported',c.commandStr),d.command(Me>=0,'invalid divisor for attribute "'+A+'"',c.commandStr));var Le=c.commandStr,be=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(w).forEach(function(q){d.command(be.indexOf(q)>=0,'unknown parameter "'+q+'" for attribute pointer "'+A+'" (valid parameters are '+be+")",Le)})}),v.buffer=b,v.state=Qr,v.size=V,v.normalized=W,v.type=ue||b.dtype,v.offset=R,v.stride=F,v.divisor=Me}}L[A]=St(function(Le,be){var q=Le.attribCache;if(E in q)return q[E];var U={isStream:!1};return Object.keys(v).forEach(function(Pe){U[Pe]=v[Pe]}),v.buffer&&(U.buffer=Le.link(v.buffer),U.type=U.type||U.buffer+".dtype"),q[E]=U,U})}),Object.keys(P).forEach(function(A){var w=P[A];function E(v,b){var g=v.invoke(b,w),R=v.shared,F=v.constants,V=R.isBufferArgs,W=R.buffer;d.optional(function(){v.assert(b,g+"&&(typeof "+g+'==="object"||typeof '+g+'==="function")&&('+V+"("+g+")||"+W+".getBuffer("+g+")||"+W+".getBuffer("+g+".buffer)||"+V+"("+g+'.buffer)||("constant" in '+g+"&&(typeof "+g+'.constant==="number"||'+R.isArrayLike+"("+g+".constant))))",'invalid dynamic attribute "'+A+'"')});var ue={isStream:b.def(!1)},Me=new k;Me.state=Qr,Object.keys(Me).forEach(function(U){ue[U]=b.def(""+Me[U])});var Le=ue.buffer,be=ue.type;b("if(",V,"(",g,")){",ue.isStream,"=true;",Le,"=",W,".createStream(",ei,",",g,");",be,"=",Le,".dtype;","}else{",Le,"=",W,".getBuffer(",g,");","if(",Le,"){",be,"=",Le,".dtype;",'}else if("constant" in ',g,"){",ue.state,"=",Ns,";","if(typeof "+g+'.constant === "number"){',ue[Zr[0]],"=",g,".constant;",Zr.slice(1).map(function(U){return ue[U]}).join("="),"=0;","}else{",Zr.map(function(U,Pe){return ue[U]+"="+g+".constant.length>"+Pe+"?"+g+".constant["+Pe+"]:0;"}).join(""),"}}else{","if(",V,"(",g,".buffer)){",Le,"=",W,".createStream(",ei,",",g,".buffer);","}else{",Le,"=",W,".getBuffer(",g,".buffer);","}",be,'="type" in ',g,"?",F.glTypes,"[",g,".type]:",Le,".dtype;",ue.normalized,"=!!",g,".normalized;");function q(U){b(ue[U],"=",g,".",U,"|0;")}return q("size"),q("offset"),q("stride"),q("divisor"),b("}}"),b.exit("if(",ue.isStream,"){",W,".destroyStream(",Le,");","}"),ue}L[A]=Kt(w,E)}),L}function ht(m){var c=m.static,T=m.dynamic,P={};return Object.keys(c).forEach(function(L){var A=c[L];P[L]=St(function(w,E){return typeof A=="number"||typeof A=="boolean"?""+A:w.link(A)})}),Object.keys(T).forEach(function(L){var A=T[L];P[L]=Kt(A,function(w,E){return w.invoke(E,A)})}),P}function Tt(m,c,T,P,L){var A=m.static,w=m.dynamic;d.optional(function(){var q=[xr,Fi,Ri,br,_r,ia,Sr,oa,Li,Ii].concat(Fe);function U(Pe){Object.keys(Pe).forEach(function(we){d.command(q.indexOf(we)>=0,'unknown parameter "'+we+'"',L.commandStr)})}U(A),U(w)});var E=$e(m,c),v=ye(m),b=ze(m,v,L),g=vt(m,L),R=yt(m,L),F=Je(m,L,E);function V(q){var U=b[q];U&&(R[q]=U)}V(Gn),V(Se(ra));var W=Object.keys(R).length>0,ue={framebuffer:v,draw:g,shader:F,state:R,dirty:W,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(ue.profile=pe(m),ue.uniforms=tt(T,L),ue.drawVAO=ue.scopeVAO=g.vao,!ue.drawVAO&&F.program&&!E&&_.angle_instanced_arrays&&g.static.elements){var Me=!0,Le=F.program.attributes.map(function(q){var U=c.static[q];return Me=Me&&!!U,U});if(Me&&Le.length>0){var be=ie.getVAO(ie.createVAO({attributes:Le,elements:g.static.elements}));ue.drawVAO=new Rt(null,null,null,function(q,U){return q.link(be)}),ue.useVAO=!0}}return E?ue.useVAO=!0:ue.attributes=Et(c,L),ue.context=ht(P),ue}function Pt(m,c,T){var P=m.shared,L=P.context,A=m.scope();Object.keys(T).forEach(function(w){c.save(L,"."+w);var E=T[w],v=E.append(m,c);Array.isArray(v)?A(L,".",w,"=[",v.join(),"];"):A(L,".",w,"=",v,";")}),c(A)}function Ct(m,c,T,P){var L=m.shared,A=L.gl,w=L.framebuffer,E;xe&&(E=c.def(L.extensions,".webgl_draw_buffers"));var v=m.constants,b=v.drawBuffer,g=v.backBuffer,R;T?R=T.append(m,c):R=c.def(w,".next"),P||c("if(",R,"!==",w,".cur){"),c("if(",R,"){",A,".bindFramebuffer(",Dc,",",R,".framebuffer);"),xe&&c(E,".drawBuffersWEBGL(",b,"[",R,".colorAttachments.length]);"),c("}else{",A,".bindFramebuffer(",Dc,",null);"),xe&&c(E,".drawBuffersWEBGL(",g,");"),c("}",w,".cur=",R,";"),P||c("}")}function It(m,c,T){var P=m.shared,L=P.gl,A=m.current,w=m.next,E=P.current,v=P.next,b=m.cond(E,".dirty");Fe.forEach(function(g){var R=Se(g);if(!(R in T.state)){var F,V;if(R in w){F=w[R],V=A[R];var W=Yt(ge[R].length,function(Me){return b.def(F,"[",Me,"]")});b(m.cond(W.map(function(Me,Le){return Me+"!=="+V+"["+Le+"]"}).join("||")).then(L,".",$[R],"(",W,");",W.map(function(Me,Le){return V+"["+Le+"]="+Me}).join(";"),";"))}else{F=b.def(v,".",R);var ue=m.cond(F,"!==",E,".",R);b(ue),R in X?ue(m.cond(F).then(L,".enable(",X[R],");").else(L,".disable(",X[R],");"),E,".",R,"=",F,";"):ue(L,".",$[R],"(",F,");",E,".",R,"=",F,";")}}}),Object.keys(T.state).length===0&&b(E,".dirty=false;"),c(b)}function Gt(m,c,T,P){var L=m.shared,A=m.current,w=L.current,E=L.gl;Mc(Object.keys(T)).forEach(function(v){var b=T[v];if(!(P&&!P(b))){var g=b.append(m,c);if(X[v]){var R=X[v];Jn(b)?g?c(E,".enable(",R,");"):c(E,".disable(",R,");"):c(m.cond(g).then(E,".enable(",R,");").else(E,".disable(",R,");")),c(w,".",v,"=",g,";")}else if(pt(g)){var F=A[v];c(E,".",$[v],"(",g,");",g.map(function(V,W){return F+"["+W+"]="+V}).join(";"),";")}else c(E,".",$[v],"(",g,");",w,".",v,"=",g,";")}})}function xt(m,c){te&&(m.instancing=c.def(m.shared.extensions,".angle_instanced_arrays"))}function qe(m,c,T,P,L){var A=m.shared,w=m.stats,E=A.current,v=A.timer,b=T.profile;function g(){return typeof performance>"u"?"Date.now()":"performance.now()"}var R,F;function V(q){R=c.def(),q(R,"=",g(),";"),typeof L=="string"?q(w,".count+=",L,";"):q(w,".count++;"),J&&(P?(F=c.def(),q(F,"=",v,".getNumPendingQueries();")):q(v,".beginQuery(",w,");"))}function W(q){q(w,".cpuTime+=",g(),"-",R,";"),J&&(P?q(v,".pushScopeStats(",F,",",v,".getNumPendingQueries(),",w,");"):q(v,".endQuery();"))}function ue(q){var U=c.def(E,".profile");c(E,".profile=",q,";"),c.exit(E,".profile=",U,";")}var Me;if(b){if(Jn(b)){b.enable?(V(c),W(c.exit),ue("true")):ue("false");return}Me=b.append(m,c),ue(Me)}else Me=c.def(E,".profile");var Le=m.block();V(Le),c("if(",Me,"){",Le,"}");var be=m.block();W(be),c.exit("if(",Me,"){",be,"}")}function Bt(m,c,T,P,L){var A=m.shared;function w(v){switch(v){case aa:case ua:case ha:return 2;case sa:case la:case da:return 3;case fa:case ca:case ma:return 4;default:return 1}}function E(v,b,g){var R=A.gl,F=c.def(v,".location"),V=c.def(A.attributes,"[",F,"]"),W=g.state,ue=g.buffer,Me=[g.x,g.y,g.z,g.w],Le=["buffer","normalized","offset","stride"];function be(){c("if(!",V,".buffer){",R,".enableVertexAttribArray(",F,");}");var U=g.type,Pe;if(g.size?Pe=c.def(g.size,"||",b):Pe=b,c("if(",V,".type!==",U,"||",V,".size!==",Pe,"||",Le.map(function(Oe){return V+"."+Oe+"!=="+g[Oe]}).join("||"),"){",R,".bindBuffer(",ei,",",ue,".buffer);",R,".vertexAttribPointer(",[F,Pe,U,g.normalized,g.stride,g.offset],");",V,".type=",U,";",V,".size=",Pe,";",Le.map(function(Oe){return V+"."+Oe+"="+g[Oe]+";"}).join(""),"}"),te){var we=g.divisor;c("if(",V,".divisor!==",we,"){",m.instancing,".vertexAttribDivisorANGLE(",[F,we],");",V,".divisor=",we,";}")}}function q(){c("if(",V,".buffer){",R,".disableVertexAttribArray(",F,");",V,".buffer=null;","}if(",Zr.map(function(U,Pe){return V+"."+U+"!=="+Me[Pe]}).join("||"),"){",R,".vertexAttrib4f(",F,",",Me,");",Zr.map(function(U,Pe){return V+"."+U+"="+Me[Pe]+";"}).join(""),"}")}W===Qr?be():W===Ns?q():(c("if(",W,"===",Qr,"){"),be(),c("}else{"),q(),c("}"))}P.forEach(function(v){var b=v.name,g=T.attributes[b],R;if(g){if(!L(g))return;R=g.append(m,c)}else{if(!L(Nc))return;var F=m.scopeAttrib(b);d.optional(function(){m.assert(c,F+".state","missing attribute "+b)}),R={},Object.keys(new k).forEach(function(V){R[V]=c.def(F,".",V)})}E(m.link(v),w(v.info.type),R)})}function ot(m,c,T,P,L,A){for(var w=m.shared,E=w.gl,v={},b,g=0;g<P.length;++g){var R=P[g],F=R.name,V=R.info.type,W=R.info.size,ue=T.uniforms[F];if(W>1){if(!ue)continue;var Me=F.replace("[0]","");if(v[Me])continue;v[Me]=1}var Le=m.link(R),be=Le+".location",q;if(ue){if(!L(ue))continue;if(Jn(ue)){var U=ue.value;if(d.command(U!==null&&typeof U<"u",'missing uniform "'+F+'"',m.commandStr),V===Mi||V===Ni){d.command(typeof U=="function"&&(V===Mi&&(U._reglType==="texture2d"||U._reglType==="framebuffer")||V===Ni&&(U._reglType==="textureCube"||U._reglType==="framebufferCube")),"invalid texture for uniform "+F,m.commandStr);var Pe=m.link(U._texture||U.color[0]._texture);c(E,".uniform1i(",be,",",Pe+".bind());"),c.exit(Pe,".unbind();")}else if(V===Di||V===zi||V===Oi){d.optional(function(){d.command(pt(U),"invalid matrix for uniform "+F,m.commandStr),d.command(V===Di&&U.length===4||V===zi&&U.length===9||V===Oi&&U.length===16,"invalid length for matrix uniform "+F,m.commandStr)});var we=m.global.def("new Float32Array(["+Array.prototype.slice.call(U)+"])"),Oe=2;V===zi?Oe=3:V===Oi&&(Oe=4),c(E,".uniformMatrix",Oe,"fv(",be,",false,",we,");")}else{switch(V){case tf:W===1?d.commandType(U,"number","uniform "+F,m.commandStr):d.command(pt(U)&&U.length===W,"uniform "+F,m.commandStr),b="1f";break;case aa:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=W*2,"uniform "+F,m.commandStr),b="2f";break;case sa:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=W*3,"uniform "+F,m.commandStr),b="3f";break;case fa:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=W*4,"uniform "+F,m.commandStr),b="4f";break;case rf:W===1?d.commandType(U,"boolean","uniform "+F,m.commandStr):d.command(pt(U)&&U.length===W,"uniform "+F,m.commandStr),b="1i";break;case nf:W===1?d.commandType(U,"number","uniform "+F,m.commandStr):d.command(pt(U)&&U.length===W,"uniform "+F,m.commandStr),b="1i";break;case ha:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=W*2,"uniform "+F,m.commandStr),b="2i";break;case ua:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=W*2,"uniform "+F,m.commandStr),b="2i";break;case da:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=W*3,"uniform "+F,m.commandStr),b="3i";break;case la:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=W*3,"uniform "+F,m.commandStr),b="3i";break;case ma:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=W*4,"uniform "+F,m.commandStr),b="4i";break;case ca:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=W*4,"uniform "+F,m.commandStr),b="4i";break}W>1?(b+="v",U=m.global.def("["+Array.prototype.slice.call(U)+"]")):U=pt(U)?Array.prototype.slice.call(U):U,c(E,".uniform",b,"(",be,",",U,");")}continue}else q=ue.append(m,c)}else{if(!L(Nc))continue;q=c.def(w.uniforms,"[",h.id(F),"]")}V===Mi?(d(!Array.isArray(q),"must specify a scalar prop for textures"),c("if(",q,"&&",q,'._reglType==="framebuffer"){',q,"=",q,".color[0];","}")):V===Ni&&(d(!Array.isArray(q),"must specify a scalar prop for cube maps"),c("if(",q,"&&",q,'._reglType==="framebufferCube"){',q,"=",q,".color[0];","}")),d.optional(function(){function rn(Jt,va){m.assert(c,Jt,'bad data or missing for uniform "'+F+'". '+va)}function Pr(Jt,va){va===1&&d(!Array.isArray(q),"must not specify an array type for uniform"),rn("Array.isArray("+q+") && typeof "+q+'[0]===" '+Jt+'" || typeof '+q+'==="'+Jt+'"',"invalid type, expected "+Jt)}function un(Jt,va,ga){Array.isArray(q)?d(q.length&&q.length%Jt===0&&q.length<=Jt*ga,"must have length of "+(ga===1?"":"n * ")+Jt):rn(w.isArrayLike+"("+q+")&&"+q+".length && "+q+".length % "+Jt+" === 0 && "+q+".length<="+Jt*ga,"invalid vector, should have length of "+(ga===1?"":"n * ")+Jt,m.commandStr)}function jc(Jt){d(!Array.isArray(q),"must not specify a value type"),rn("typeof "+q+'==="function"&&'+q+'._reglType==="texture'+(Jt===kc?"2d":"Cube")+'"',"invalid texture type",m.commandStr)}switch(V){case nf:Pr("number",W);break;case ua:un(2,"number",W);break;case la:un(3,"number",W);break;case ca:un(4,"number",W);break;case tf:Pr("number",W);break;case aa:un(2,"number",W);break;case sa:un(3,"number",W);break;case fa:un(4,"number",W);break;case rf:Pr("boolean",W);break;case ha:un(2,"boolean",W);break;case da:un(3,"boolean",W);break;case ma:un(4,"boolean",W);break;case Di:un(4,"number",W);break;case zi:un(9,"number",W);break;case Oi:un(16,"number",W);break;case Mi:jc(kc);break;case Ni:jc(Px);break}});var ft=1;switch(V){case Mi:case Ni:var Ut=c.def(q,"._texture");c(E,".uniform1i(",be,",",Ut,".bind());"),c.exit(Ut,".unbind();");continue;case nf:case rf:b="1i";break;case ua:case ha:b="2i",ft=2;break;case la:case da:b="3i",ft=3;break;case ca:case ma:b="4i",ft=4;break;case tf:b="1f";break;case aa:b="2f",ft=2;break;case sa:b="3f",ft=3;break;case fa:b="4f",ft=4;break;case Di:b="Matrix2fv";break;case zi:b="Matrix3fv";break;case Oi:b="Matrix4fv";break}if(b.indexOf("Matrix")===-1&&W>1&&(b+="v",ft=1),b.charAt(0)==="M"){c(E,".uniform",b,"(",be,",");var Ar=Math.pow(V-Di+2,2),Bn=m.global.def("new Float32Array(",Ar,")");Array.isArray(q)?c("false,(",Yt(Ar,function(rn){return Bn+"["+rn+"]="+q[rn]}),",",Bn,")"):c("false,(Array.isArray(",q,")||",q," instanceof Float32Array)?",q,":(",Yt(Ar,function(rn){return Bn+"["+rn+"]="+q+"["+rn+"]"}),",",Bn,")"),c(");")}else if(ft>1){for(var Cn=[],er=[],Er=0;Er<ft;++Er)Array.isArray(q)?er.push(q[Er]):er.push(c.def(q+"["+Er+"]")),A&&Cn.push(c.def());A&&c("if(!",m.batchId,"||",Cn.map(function(rn,Pr){return rn+"!=="+er[Pr]}).join("||"),"){",Cn.map(function(rn,Pr){return rn+"="+er[Pr]+";"}).join("")),c(E,".uniform",b,"(",be,",",er.join(","),");"),A&&c("}")}else{if(d(!Array.isArray(q),"uniform value must not be an array"),A){var Hc=c.def();c("if(!",m.batchId,"||",Hc,"!==",q,"){",Hc,"=",q,";")}c(E,".uniform",b,"(",be,",",q,");"),A&&c("}")}}}function Ie(m,c,T,P){var L=m.shared,A=L.gl,w=L.draw,E=P.draw;function v(){var Pe=E.elements,we,Oe=c;return Pe?((Pe.contextDep&&P.contextDynamic||Pe.propDep)&&(Oe=T),we=Pe.append(m,Oe),E.elementsActive&&Oe("if("+we+")"+A+".bindBuffer("+ef+","+we+".buffer.buffer);")):(we=Oe.def(),Oe(we,"=",w,".",br,";","if(",we,"){",A,".bindBuffer(",ef,",",we,".buffer.buffer);}","else if(",L.vao,".currentVAO){",we,"=",m.shared.elements+".getElements("+L.vao,".currentVAO.elements);",Z?"":"if("+we+")"+A+".bindBuffer("+ef+","+we+".buffer.buffer);","}")),we}function b(){var Pe=E.count,we,Oe=c;return Pe?((Pe.contextDep&&P.contextDynamic||Pe.propDep)&&(Oe=T),we=Pe.append(m,Oe),d.optional(function(){Pe.MISSING&&m.assert(c,"false","missing vertex count"),Pe.DYNAMIC&&m.assert(Oe,we+">=0","missing vertex count")})):(we=Oe.def(w,".",Sr),d.optional(function(){m.assert(Oe,we+">=0","missing vertex count")})),we}var g=v();function R(Pe){var we=E[Pe];return we?we.contextDep&&P.contextDynamic||we.propDep?we.append(m,T):we.append(m,c):c.def(w,".",Pe)}var F=R(_r),V=R(ia),W=b();if(typeof W=="number"){if(W===0)return}else T("if(",W,"){"),T.exit("}");var ue,Me;te&&(ue=R(oa),Me=m.instancing);var Le=g+".type",be=E.elements&&Jn(E.elements)&&!E.vaoActive;function q(){function Pe(){T(Me,".drawElementsInstancedANGLE(",[F,W,Le,V+"<<(("+Le+"-"+fc+")>>1)",ue],");")}function we(){T(Me,".drawArraysInstancedANGLE(",[F,V,W,ue],");")}g&&g!=="null"?be?Pe():(T("if(",g,"){"),Pe(),T("}else{"),we(),T("}")):we()}function U(){function Pe(){T(A+".drawElements("+[F,W,Le,V+"<<(("+Le+"-"+fc+")>>1)"]+");")}function we(){T(A+".drawArrays("+[F,V,W]+");")}g&&g!=="null"?be?Pe():(T("if(",g,"){"),Pe(),T("}else{"),we(),T("}")):we()}te&&(typeof ue!="number"||ue>=0)?typeof ue=="string"?(T("if(",ue,">0){"),q(),T("}else if(",ue,"<0){"),U(),T("}")):q():U()}function et(m,c,T,P,L){var A=Ne(),w=A.proc("body",L);return d.optional(function(){A.commandStr=c.commandStr,A.command=A.link(c.commandStr)}),te&&(A.instancing=w.def(A.shared.extensions,".angle_instanced_arrays")),m(A,w,T,P),A.compile().body}function nt(m,c,T,P){xt(m,c),T.useVAO?T.drawVAO?c(m.shared.vao,".setVAO(",T.drawVAO.append(m,c),");"):c(m.shared.vao,".setVAO(",m.shared.vao,".targetVAO);"):(c(m.shared.vao,".setVAO(null);"),Bt(m,c,T,P.attributes,function(){return!0})),ot(m,c,T,P.uniforms,function(){return!0},!1),Ie(m,c,c,T)}function bt(m,c){var T=m.proc("draw",1);xt(m,T),Pt(m,T,c.context),Ct(m,T,c.framebuffer),It(m,T,c),Gt(m,T,c.state),qe(m,T,c,!1,!0);var P=c.shader.progVar.append(m,T);if(T(m.shared.gl,".useProgram(",P,".program);"),c.shader.program)nt(m,T,c,c.shader.program);else{T(m.shared.vao,".setVAO(null);");var L=m.global.def("{}"),A=T.def(P,".id"),w=T.def(L,"[",A,"]");T(m.cond(w).then(w,".call(this,a0);").else(w,"=",L,"[",A,"]=",m.link(function(E){return et(nt,m,c,E,1)}),"(",P,");",w,".call(this,a0);"))}Object.keys(c.state).length>0&&T(m.shared.current,".dirty=true;"),m.shared.vao&&T(m.shared.vao,".setVAO(null);")}function Pn(m,c,T,P){m.batchId="a1",xt(m,c);function L(){return!0}Bt(m,c,T,P.attributes,L),ot(m,c,T,P.uniforms,L,!1),Ie(m,c,c,T)}function wr(m,c,T,P){xt(m,c);var L=T.contextDep,A=c.def(),w="a0",E="a1",v=c.def();m.shared.props=v,m.batchId=A;var b=m.scope(),g=m.scope();c(b.entry,"for(",A,"=0;",A,"<",E,";++",A,"){",v,"=",w,"[",A,"];",g,"}",b.exit);function R(Le){return Le.contextDep&&L||Le.propDep}function F(Le){return!R(Le)}if(T.needsContext&&Pt(m,g,T.context),T.needsFramebuffer&&Ct(m,g,T.framebuffer),Gt(m,g,T.state,R),T.profile&&R(T.profile)&&qe(m,g,T,!1,!0),P)T.useVAO?T.drawVAO?R(T.drawVAO)?g(m.shared.vao,".setVAO(",T.drawVAO.append(m,g),");"):b(m.shared.vao,".setVAO(",T.drawVAO.append(m,b),");"):b(m.shared.vao,".setVAO(",m.shared.vao,".targetVAO);"):(b(m.shared.vao,".setVAO(null);"),Bt(m,b,T,P.attributes,F),Bt(m,g,T,P.attributes,R)),ot(m,b,T,P.uniforms,F,!1),ot(m,g,T,P.uniforms,R,!0),Ie(m,b,g,T);else{var V=m.global.def("{}"),W=T.shader.progVar.append(m,g),ue=g.def(W,".id"),Me=g.def(V,"[",ue,"]");g(m.shared.gl,".useProgram(",W,".program);","if(!",Me,"){",Me,"=",V,"[",ue,"]=",m.link(function(Le){return et(Pn,m,T,Le,2)}),"(",W,");}",Me,".call(this,a0[",A,"],",A,");")}}function y(m,c){var T=m.proc("batch",2);m.batchId="0",xt(m,T);var P=!1,L=!0;Object.keys(c.context).forEach(function(V){P=P||c.context[V].propDep}),P||(Pt(m,T,c.context),L=!1);var A=c.framebuffer,w=!1;A?(A.propDep?P=w=!0:A.contextDep&&P&&(w=!0),w||Ct(m,T,A)):Ct(m,T,null),c.state.viewport&&c.state.viewport.propDep&&(P=!0);function E(V){return V.contextDep&&P||V.propDep}It(m,T,c),Gt(m,T,c.state,function(V){return!E(V)}),(!c.profile||!E(c.profile))&&qe(m,T,c,!1,"a1"),c.contextDep=P,c.needsContext=L,c.needsFramebuffer=w;var v=c.shader.progVar;if(v.contextDep&&P||v.propDep)wr(m,T,c,null);else{var b=v.append(m,T);if(T(m.shared.gl,".useProgram(",b,".program);"),c.shader.program)wr(m,T,c,c.shader.program);else{T(m.shared.vao,".setVAO(null);");var g=m.global.def("{}"),R=T.def(b,".id"),F=T.def(g,"[",R,"]");T(m.cond(F).then(F,".call(this,a0,a1);").else(F,"=",g,"[",R,"]=",m.link(function(V){return et(wr,m,c,V,2)}),"(",b,");",F,".call(this,a0,a1);"))}}Object.keys(c.state).length>0&&T(m.shared.current,".dirty=true;"),m.shared.vao&&T(m.shared.vao,".setVAO(null);")}function M(m,c){var T=m.proc("scope",3);m.batchId="a2";var P=m.shared,L=P.current;Pt(m,T,c.context),c.framebuffer&&c.framebuffer.append(m,T),Mc(Object.keys(c.state)).forEach(function(w){var E=c.state[w],v=E.append(m,T);pt(v)?v.forEach(function(b,g){T.set(m.next[w],"["+g+"]",b)}):T.set(P.next,"."+w,v)}),qe(m,T,c,!0,!0),[br,ia,Sr,oa,_r].forEach(function(w){var E=c.draw[w];E&&T.set(P.draw,"."+w,""+E.append(m,T))}),Object.keys(c.uniforms).forEach(function(w){var E=c.uniforms[w].append(m,T);Array.isArray(E)&&(E="["+E.join()+"]"),T.set(P.uniforms,"["+h.id(w)+"]",E)}),Object.keys(c.attributes).forEach(function(w){var E=c.attributes[w].append(m,T),v=m.scopeAttrib(w);Object.keys(new k).forEach(function(b){T.set(v,"."+b,E[b])})}),c.scopeVAO&&T.set(P.vao,".targetVAO",c.scopeVAO.append(m,T));function A(w){var E=c.shader[w];E&&T.set(P.shader,"."+w,E.append(m,T))}A(Fi),A(Ri),Object.keys(c.state).length>0&&(T(L,".dirty=true;"),T.exit(L,".dirty=true;")),T("a1(",m.shared.context,",a0,",m.batchId,");")}function I(m){if(!(typeof m!="object"||pt(m))){for(var c=Object.keys(m),T=0;T<c.length;++T)if(Lt.isDynamic(m[c[T]]))return!0;return!1}}function _e(m,c,T){var P=c.static[T];if(!P||!I(P))return;var L=m.global,A=Object.keys(P),w=!1,E=!1,v=!1,b=m.global.def("{}");A.forEach(function(R){var F=P[R];if(Lt.isDynamic(F)){typeof F=="function"&&(F=P[R]=Lt.unbox(F));var V=Kt(F,null);w=w||V.thisDep,v=v||V.propDep,E=E||V.contextDep}else{switch(L(b,".",R,"="),typeof F){case"number":L(F);break;case"string":L('"',F,'"');break;case"object":Array.isArray(F)&&L("[",F.join(),"]");break;default:L(m.link(F));break}L(";")}});function g(R,F){A.forEach(function(V){var W=P[V];if(Lt.isDynamic(W)){var ue=R.invoke(F,W);F(b,".",V,"=",ue,";")}})}c.dynamic[T]=new Lt.DynamicVariable(na,{thisDep:w,contextDep:E,propDep:v,ref:b,append:g}),delete c.static[T]}function Ke(m,c,T,P,L){var A=Ne();A.stats=A.link(L),Object.keys(c.static).forEach(function(E){_e(A,c,E)}),wx.forEach(function(E){_e(A,m,E)});var w=Tt(m,c,T,P,A);return bt(A,w),M(A,w),y(A,w),r(A.compile(),{destroy:function(){w.shader.program.destroy()}})}return{next:me,current:ge,procs:function(){var m=Ne(),c=m.proc("poll"),T=m.proc("refresh"),P=m.block();c(P),T(P);var L=m.shared,A=L.gl,w=L.next,E=L.current;P(E,".dirty=false;"),Ct(m,c),Ct(m,T,null,!0);var v;te&&(v=m.link(te)),_.oes_vertex_array_object&&T(m.link(_.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var b=0;b<O.maxAttributes;++b){var g=T.def(L.attributes,"[",b,"]"),R=m.cond(g,".buffer");R.then(A,".enableVertexAttribArray(",b,");",A,".bindBuffer(",ei,",",g,".buffer.buffer);",A,".vertexAttribPointer(",b,",",g,".size,",g,".type,",g,".normalized,",g,".stride,",g,".offset);").else(A,".disableVertexAttribArray(",b,");",A,".vertexAttrib4f(",b,",",g,".x,",g,".y,",g,".z,",g,".w);",g,".buffer=null;"),T(R),te&&T(v,".vertexAttribDivisorANGLE(",b,",",g,".divisor);")}return T(m.shared.vao,".currentVAO=null;",m.shared.vao,".setVAO(",m.shared.vao,".targetVAO);"),Object.keys(X).forEach(function(F){var V=X[F],W=P.def(w,".",F),ue=m.block();ue("if(",W,"){",A,".enable(",V,")}else{",A,".disable(",V,")}",E,".",F,"=",W,";"),T(ue),c("if(",W,"!==",E,".",F,"){",ue,"}")}),Object.keys($).forEach(function(F){var V=$[F],W=ge[F],ue,Me,Le=m.block();if(Le(A,".",V,"("),pt(W)){var be=W.length;ue=m.global.def(w,".",F),Me=m.global.def(E,".",F),Le(Yt(be,function(q){return ue+"["+q+"]"}),");",Yt(be,function(q){return Me+"["+q+"]="+ue+"["+q+"];"}).join("")),c("if(",Yt(be,function(q){return ue+"["+q+"]!=="+Me+"["+q+"]"}).join("||"),"){",Le,"}")}else ue=P.def(w,".",F),Me=P.def(E,".",F),Le(ue,");",E,".",F,"=",ue,";"),c("if(",ue,"!==",Me,"){",Le,"}");T(Le)}),m.compile()}(),compile:Ke}}function $x(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var Hx=34918,jx=34919,Gc=35007,Xx=function(a,h){if(!h.ext_disjoint_timer_query)return null;var _=[];function O(){return _.pop()||h.ext_disjoint_timer_query.createQueryEXT()}function j(te){_.push(te)}var z=[];function B(te){var xe=O();h.ext_disjoint_timer_query.beginQueryEXT(Gc,xe),z.push(xe),J(z.length-1,z.length,te)}function K(){h.ext_disjoint_timer_query.endQueryEXT(Gc)}function Q(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var ie=[];function ae(){return ie.pop()||new Q}function oe(te){ie.push(te)}var le=[];function J(te,xe,Z){var ge=ae();ge.startQueryIndex=te,ge.endQueryIndex=xe,ge.sum=0,ge.stats=Z,le.push(ge)}var ne=[],k=[];function G(){var te,xe,Z=z.length;if(Z!==0){k.length=Math.max(k.length,Z+1),ne.length=Math.max(ne.length,Z+1),ne[0]=0,k[0]=0;var ge=0;for(te=0,xe=0;xe<z.length;++xe){var me=z[xe];h.ext_disjoint_timer_query.getQueryObjectEXT(me,jx)?(ge+=h.ext_disjoint_timer_query.getQueryObjectEXT(me,Hx),j(me)):z[te++]=me,ne[xe+1]=ge,k[xe+1]=te}for(z.length=te,te=0,xe=0;xe<le.length;++xe){var Fe=le[xe],X=Fe.startQueryIndex,$=Fe.endQueryIndex;Fe.sum+=ne[$]-ne[X];var Se=k[X],ce=k[$];ce===Se?(Fe.stats.gpuTime+=Fe.sum/1e6,oe(Fe)):(Fe.startQueryIndex=Se,Fe.endQueryIndex=ce,le[te++]=Fe)}le.length=te}}return{beginQuery:B,endQuery:K,pushScopeStats:J,update:G,getNumPendingQueries:function(){return z.length},clear:function(){_.push.apply(_,z);for(var te=0;te<_.length;te++)h.ext_disjoint_timer_query.deleteQueryEXT(_[te]);z.length=0,_.length=0},restore:function(){z.length=0,_.length=0}}},Wx=16384,qx=256,Yx=1024,Zx=34962,Bc="webglcontextlost",Uc="webglcontextrestored",Vc=1,Qx=2,Kx=3;function $c(a,h){for(var _=0;_<a.length;++_)if(a[_]===h)return _;return-1}function Jx(a){var h=Ft(a);if(!h)return null;var _=h.gl,O=_.getContextAttributes(),j=_.isContextLost(),z=Xn(_,h);if(!z)return null;var B=ss(),K=$x(),Q=z.extensions,ie=Xx(_,Q),ae=Mr(),oe=_.drawingBufferWidth,le=_.drawingBufferHeight,J={tick:0,time:0,viewportWidth:oe,viewportHeight:le,framebufferWidth:oe,framebufferHeight:le,drawingBufferWidth:oe,drawingBufferHeight:le,pixelRatio:h.pixelRatio},ne={},k={elements:null,primitive:4,count:-1,offset:0,instances:-1},G=Gg(_,Q),te=ty(_,K,h,ge),xe=dy(_,Q,te,K),Z=dx(_,Q,G,K,te,xe,k);function ge(Ie){return Z.destroyBuffer(Ie)}var me=gx(_,B,K,h),Fe=Hy(_,Q,G,function(){Se.procs.poll()},J,K,h),X=jy(_,Q,G,K,h),$=cx(_,Q,G,Fe,X,K),Se=Vx(_,B,Q,G,te,xe,Fe,$,ne,Z,me,k,J,ie,h),ce=bx(_,$,Se.procs.poll,J,O,Q,G),ee=Se.next,he=_.canvas,de=[],Ve=[],Ne=[],pe=[h.onDestroy],ye=null;function ze(){if(de.length===0){ie&&ie.update(),ye=null;return}ye=cr.next(ze),Gt();for(var Ie=de.length-1;Ie>=0;--Ie){var et=de[Ie];et&&et(J,null,0)}_.flush(),ie&&ie.update()}function $e(){!ye&&de.length>0&&(ye=cr.next(ze))}function Je(){ye&&(cr.cancel(ze),ye=null)}function vt(Ie){Ie.preventDefault(),j=!0,Je(),Ve.forEach(function(et){et()})}function yt(Ie){_.getError(),j=!1,z.restore(),me.restore(),te.restore(),Fe.restore(),X.restore(),$.restore(),Z.restore(),ie&&ie.restore(),Se.procs.refresh(),$e(),Ne.forEach(function(et){et()})}he&&(he.addEventListener(Bc,vt,!1),he.addEventListener(Uc,yt,!1));function tt(){de.length=0,Je(),he&&(he.removeEventListener(Bc,vt),he.removeEventListener(Uc,yt)),me.clear(),$.clear(),X.clear(),Z.clear(),Fe.clear(),xe.clear(),te.clear(),ie&&ie.clear(),pe.forEach(function(Ie){Ie()})}function Et(Ie){d(!!Ie,"invalid args to regl({...})"),d.type(Ie,"object","invalid args to regl({...})");function et(L){var A=r({},L);delete A.uniforms,delete A.attributes,delete A.context,delete A.vao,"stencil"in A&&A.stencil.op&&(A.stencil.opBack=A.stencil.opFront=A.stencil.op,delete A.stencil.op);function w(E){if(E in A){var v=A[E];delete A[E],Object.keys(v).forEach(function(b){A[E+"."+b]=v[b]})}}return w("blend"),w("depth"),w("cull"),w("stencil"),w("polygonOffset"),w("scissor"),w("sample"),"vao"in L&&(A.vao=L.vao),A}function nt(L,A){var w={},E={};return Object.keys(L).forEach(function(v){var b=L[v];if(Lt.isDynamic(b)){E[v]=Lt.unbox(b,v);return}else if(A&&Array.isArray(b)){for(var g=0;g<b.length;++g)if(Lt.isDynamic(b[g])){E[v]=Lt.unbox(b,v);return}}w[v]=b}),{dynamic:E,static:w}}var bt=nt(Ie.context||{},!0),Pn=nt(Ie.uniforms||{},!0),wr=nt(Ie.attributes||{},!1),y=nt(et(Ie),!1),M={gpuTime:0,cpuTime:0,count:0},I=Se.compile(y,wr,Pn,bt,M),_e=I.draw,Ke=I.batch,m=I.scope,c=[];function T(L){for(;c.length<L;)c.push(null);return c}function P(L,A){var w;if(j&&d.raise("context lost"),typeof L=="function")return m.call(this,null,L,0);if(typeof A=="function")if(typeof L=="number")for(w=0;w<L;++w)m.call(this,null,A,w);else if(Array.isArray(L))for(w=0;w<L.length;++w)m.call(this,L[w],A,w);else return m.call(this,L,A,0);else if(typeof L=="number"){if(L>0)return Ke.call(this,T(L|0),L|0)}else if(Array.isArray(L)){if(L.length)return Ke.call(this,L,L.length)}else return _e.call(this,L)}return r(P,{stats:M,destroy:function(){I.destroy()}})}var ht=$.setFBO=Et({framebuffer:Lt.define.call(null,Vc,"framebuffer")});function Tt(Ie,et){var nt=0;Se.procs.poll();var bt=et.color;bt&&(_.clearColor(+bt[0]||0,+bt[1]||0,+bt[2]||0,+bt[3]||0),nt|=Wx),"depth"in et&&(_.clearDepth(+et.depth),nt|=qx),"stencil"in et&&(_.clearStencil(et.stencil|0),nt|=Yx),d(!!nt,"called regl.clear with no buffer specified"),_.clear(nt)}function Pt(Ie){if(d(typeof Ie=="object"&&Ie,"regl.clear() takes an object as input"),"framebuffer"in Ie)if(Ie.framebuffer&&Ie.framebuffer_reglType==="framebufferCube")for(var et=0;et<6;++et)ht(r({framebuffer:Ie.framebuffer.faces[et]},Ie),Tt);else ht(Ie,Tt);else Tt(null,Ie)}function Ct(Ie){d.type(Ie,"function","regl.frame() callback must be a function"),de.push(Ie);function et(){var nt=$c(de,Ie);d(nt>=0,"cannot cancel a frame twice");function bt(){var Pn=$c(de,bt);de[Pn]=de[de.length-1],de.length-=1,de.length<=0&&Je()}de[nt]=bt}return $e(),{cancel:et}}function It(){var Ie=ee.viewport,et=ee.scissor_box;Ie[0]=Ie[1]=et[0]=et[1]=0,J.viewportWidth=J.framebufferWidth=J.drawingBufferWidth=Ie[2]=et[2]=_.drawingBufferWidth,J.viewportHeight=J.framebufferHeight=J.drawingBufferHeight=Ie[3]=et[3]=_.drawingBufferHeight}function Gt(){J.tick+=1,J.time=qe(),It(),Se.procs.poll()}function xt(){Fe.refresh(),It(),Se.procs.refresh(),ie&&ie.update()}function qe(){return(Mr()-ae)/1e3}xt();function Bt(Ie,et){d.type(et,"function","listener callback must be a function");var nt;switch(Ie){case"frame":return Ct(et);case"lost":nt=Ve;break;case"restore":nt=Ne;break;case"destroy":nt=pe;break;default:d.raise("invalid event, must be one of frame,lost,restore,destroy")}return nt.push(et),{cancel:function(){for(var bt=0;bt<nt.length;++bt)if(nt[bt]===et){nt[bt]=nt[nt.length-1],nt.pop();return}}}}var ot=r(Et,{clear:Pt,prop:Lt.define.bind(null,Vc),context:Lt.define.bind(null,Qx),this:Lt.define.bind(null,Kx),draw:Et({}),buffer:function(Ie){return te.create(Ie,Zx,!1,!1)},elements:function(Ie){return xe.create(Ie,!1)},texture:Fe.create2D,cube:Fe.createCube,renderbuffer:X.create,framebuffer:$.create,framebufferCube:$.createCube,vao:Z.createVAO,attributes:O,frame:Ct,on:Bt,limits:G,hasExtension:function(Ie){return G.extensions.indexOf(Ie.toLowerCase())>=0},read:ce,destroy:tt,_gl:_,_refresh:xt,poll:function(){Gt(),ie&&ie.update()},now:qe,stats:K});return h.onDone(null,ot),ot}return Jx})}(io)),io.exports}var Sp=_p();const Tp=Da(Sp),wp="#b3b3b3",Ap=void 0,Ep=void 0,Pp=1,Cp=4,kp="#666666",Lp=.1,Fp=1,Rp=1,Ip="#222222",We={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,arrowSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,arrowLinks:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",focusedPointRingColor:"white",focusedPointIndex:void 0,useClassicQuadtree:!1,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,repulsionQuadtreeLevels:12,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},Dp=.7,zp=.95,Op=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Zf,setPrototypeOf:Qf,isFrozen:Mp,getPrototypeOf:Np,getOwnPropertyDescriptor:Gp}=Object;let{freeze:Xt,seal:on,create:Kf}=Object,{apply:za,construct:Oa}=typeof Reflect<"u"&&Reflect;Xt||(Xt=function(e){return e}),on||(on=function(e){return e}),za||(za=function(e,n,r){return e.apply(n,r)}),Oa||(Oa=function(e,n){return new e(...n)});const oo=qt(Array.prototype.forEach),Bp=qt(Array.prototype.lastIndexOf),Jf=qt(Array.prototype.pop),li=qt(Array.prototype.push),Up=qt(Array.prototype.splice),ao=qt(String.prototype.toLowerCase),Ma=qt(String.prototype.toString),eu=qt(String.prototype.match),ci=qt(String.prototype.replace),Vp=qt(String.prototype.indexOf),$p=qt(String.prototype.trim),dn=qt(Object.prototype.hasOwnProperty),Wt=qt(RegExp.prototype.test),hi=Hp(TypeError);function qt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return za(t,e,r)}}function Hp(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Oa(t,n)}}function rt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ao;Qf&&Qf(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=n(i);o!==i&&(Mp(e)||(e[r]=o),i=o)}t[i]=!0}return t}function jp(t){for(let e=0;e<t.length;e++)dn(t,e)||(t[e]=null);return t}function Rn(t){const e=Kf(null);for(const[n,r]of Zf(t))dn(t,n)&&(Array.isArray(r)?e[n]=jp(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=Rn(r):e[n]=r);return e}function di(t,e){for(;t!==null;){const r=Gp(t,e);if(r){if(r.get)return qt(r.get);if(typeof r.value=="function")return qt(r.value)}t=Np(t)}function n(){return null}return n}const tu=Xt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Na=Xt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ga=Xt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Xp=Xt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ba=Xt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Wp=Xt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nu=Xt(["#text"]),ru=Xt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ua=Xt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),iu=Xt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),so=Xt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qp=on(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Yp=on(/<%[\w\W]*|[\w\W]*%>/gm),Zp=on(/\$\{[\w\W]*/gm),Qp=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),Kp=on(/^aria-[\-\w]+$/),ou=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Jp=on(/^(?:\w+script|data):/i),e0=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),au=on(/^html$/i),t0=on(/^[a-z][.\w]*(-[.\w]+)+$/i);var su=Object.freeze({__proto__:null,ARIA_ATTR:Kp,ATTR_WHITESPACE:e0,CUSTOM_ELEMENT:t0,DATA_ATTR:Qp,DOCTYPE_NAME:au,ERB_EXPR:Yp,IS_ALLOWED_URI:ou,IS_SCRIPT_OR_DATA:Jp,MUSTACHE_EXPR:qp,TMPLIT_EXPR:Zp});const mi={element:1,text:3,progressingInstruction:7,comment:8,document:9},n0=function(){return typeof window>"u"?null:window},r0=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},fu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function uu(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n0();const e=Be=>uu(Be);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==mi.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:f,Element:u,NodeFilter:l,NamedNodeMap:p=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:x,DOMParser:S,trustedTypes:D}=t,Y=u.prototype,Ee=di(Y,"cloneNode"),Te=di(Y,"remove"),se=di(Y,"nextSibling"),Ue=di(Y,"childNodes"),He=di(Y,"parentNode");if(typeof s=="function"){const Be=n.createElement("template");Be.content&&Be.content.ownerDocument&&(n=Be.content.ownerDocument)}let H,fe="";const{implementation:Re,createNodeIterator:Ge,createDocumentFragment:Ye,getElementsByTagName:at}=n,{importNode:ut}=r;let Ae=fu();e.isSupported=typeof Zf=="function"&&typeof He=="function"&&Re&&Re.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:lt,ERB_EXPR:it,TMPLIT_EXPR:N,DATA_ATTR:Ce,ARIA_ATTR:re,IS_SCRIPT_OR_DATA:ke,ATTR_WHITESPACE:Xe,CUSTOM_ELEMENT:je}=su;let{IS_ALLOWED_URI:Qe}=su,Ze=null;const dt=rt({},[...tu,...Na,...Ga,...Ba,...nu]);let ct=null;const _t=rt({},[...ru,...Ua,...iu,...so]);let st=Object.seal(Kf(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$t=null,Ht=null,Qt=!0,zn=!0,wo=!1,Ao=!0,On=!1,sr=!0,Tn=!1,Ir=!1,Dr=!1,$n=!1,zt=!1,fr=!1,ur=!0,Eo=!1;const as="user-content-";let d=!0,lr=!1,Hn={},jn=null;const Po=rt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let wn=null;const yi=rt({},["audio","video","img","source","image","track"]);let Mn=null;const xi=rt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),zr="http://www.w3.org/1998/Math/MathML",Or="http://www.w3.org/2000/svg",an="http://www.w3.org/1999/xhtml";let Lt=an,cr=!1,Mr=null;const ss=rt({},[zr,Or,an],Ma);let Nr=rt({},["mi","mo","mn","ms","mtext"]),Gr=rt({},["annotation-xml"]);const fs=rt({},["title","style","font","a","script"]);let hr=null;const Co=["application/xhtml+xml","text/html"],ko="text/html";let Ft=null,Xn=null;const Yt=n.createElement("form"),Lo=function(C){return C instanceof RegExp||C instanceof Function},bi=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xn&&Xn===C)){if((!C||typeof C!="object")&&(C={}),C=Rn(C),hr=Co.indexOf(C.PARSER_MEDIA_TYPE)===-1?ko:C.PARSER_MEDIA_TYPE,Ft=hr==="application/xhtml+xml"?Ma:ao,Ze=dn(C,"ALLOWED_TAGS")?rt({},C.ALLOWED_TAGS,Ft):dt,ct=dn(C,"ALLOWED_ATTR")?rt({},C.ALLOWED_ATTR,Ft):_t,Mr=dn(C,"ALLOWED_NAMESPACES")?rt({},C.ALLOWED_NAMESPACES,Ma):ss,Mn=dn(C,"ADD_URI_SAFE_ATTR")?rt(Rn(xi),C.ADD_URI_SAFE_ATTR,Ft):xi,wn=dn(C,"ADD_DATA_URI_TAGS")?rt(Rn(yi),C.ADD_DATA_URI_TAGS,Ft):yi,jn=dn(C,"FORBID_CONTENTS")?rt({},C.FORBID_CONTENTS,Ft):Po,$t=dn(C,"FORBID_TAGS")?rt({},C.FORBID_TAGS,Ft):Rn({}),Ht=dn(C,"FORBID_ATTR")?rt({},C.FORBID_ATTR,Ft):Rn({}),Hn=dn(C,"USE_PROFILES")?C.USE_PROFILES:!1,Qt=C.ALLOW_ARIA_ATTR!==!1,zn=C.ALLOW_DATA_ATTR!==!1,wo=C.ALLOW_UNKNOWN_PROTOCOLS||!1,Ao=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,On=C.SAFE_FOR_TEMPLATES||!1,sr=C.SAFE_FOR_XML!==!1,Tn=C.WHOLE_DOCUMENT||!1,$n=C.RETURN_DOM||!1,zt=C.RETURN_DOM_FRAGMENT||!1,fr=C.RETURN_TRUSTED_TYPE||!1,Dr=C.FORCE_BODY||!1,ur=C.SANITIZE_DOM!==!1,Eo=C.SANITIZE_NAMED_PROPS||!1,d=C.KEEP_CONTENT!==!1,lr=C.IN_PLACE||!1,Qe=C.ALLOWED_URI_REGEXP||ou,Lt=C.NAMESPACE||an,Nr=C.MATHML_TEXT_INTEGRATION_POINTS||Nr,Gr=C.HTML_INTEGRATION_POINTS||Gr,st=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Lo(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(st.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Lo(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(st.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(st.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),On&&(zn=!1),zt&&($n=!0),Hn&&(Ze=rt({},nu),ct=[],Hn.html===!0&&(rt(Ze,tu),rt(ct,ru)),Hn.svg===!0&&(rt(Ze,Na),rt(ct,Ua),rt(ct,so)),Hn.svgFilters===!0&&(rt(Ze,Ga),rt(ct,Ua),rt(ct,so)),Hn.mathMl===!0&&(rt(Ze,Ba),rt(ct,iu),rt(ct,so))),C.ADD_TAGS&&(Ze===dt&&(Ze=Rn(Ze)),rt(Ze,C.ADD_TAGS,Ft)),C.ADD_ATTR&&(ct===_t&&(ct=Rn(ct)),rt(ct,C.ADD_ATTR,Ft)),C.ADD_URI_SAFE_ATTR&&rt(Mn,C.ADD_URI_SAFE_ATTR,Ft),C.FORBID_CONTENTS&&(jn===Po&&(jn=Rn(jn)),rt(jn,C.FORBID_CONTENTS,Ft)),d&&(Ze["#text"]=!0),Tn&&rt(Ze,["html","head","body"]),Ze.table&&(rt(Ze,["tbody"]),delete $t.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw hi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw hi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');H=C.TRUSTED_TYPES_POLICY,fe=H.createHTML("")}else H===void 0&&(H=r0(D,i)),H!==null&&typeof fe=="string"&&(fe=H.createHTML(""));Xt&&Xt(C),Xn=C}},Fo=rt({},[...Na,...Ga,...Xp]),Ro=rt({},[...Ba,...Wp]),us=function(C){let ve=He(C);(!ve||!ve.tagName)&&(ve={namespaceURI:Lt,tagName:"template"});const De=ao(C.tagName),mt=ao(ve.tagName);return Mr[C.namespaceURI]?C.namespaceURI===Or?ve.namespaceURI===an?De==="svg":ve.namespaceURI===zr?De==="svg"&&(mt==="annotation-xml"||Nr[mt]):!!Fo[De]:C.namespaceURI===zr?ve.namespaceURI===an?De==="math":ve.namespaceURI===Or?De==="math"&&Gr[mt]:!!Ro[De]:C.namespaceURI===an?ve.namespaceURI===Or&&!Gr[mt]||ve.namespaceURI===zr&&!Nr[mt]?!1:!Ro[De]&&(fs[De]||!Fo[De]):!!(hr==="application/xhtml+xml"&&Mr[C.namespaceURI]):!1},sn=function(C){li(e.removed,{element:C});try{He(C).removeChild(C)}catch{Te(C)}},Wn=function(C,ve){try{li(e.removed,{attribute:ve.getAttributeNode(C),from:ve})}catch{li(e.removed,{attribute:null,from:ve})}if(ve.removeAttribute(C),C==="is")if($n||zt)try{sn(ve)}catch{}else try{ve.setAttribute(C,"")}catch{}},Io=function(C){let ve=null,De=null;if(Dr)C="<remove></remove>"+C;else{const At=eu(C,/^[\r\n\t ]+/);De=At&&At[0]}hr==="application/xhtml+xml"&&Lt===an&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const mt=H?H.createHTML(C):C;if(Lt===an)try{ve=new S().parseFromString(mt,hr)}catch{}if(!ve||!ve.documentElement){ve=Re.createDocument(Lt,"template",null);try{ve.documentElement.innerHTML=cr?fe:mt}catch{}}const Ot=ve.body||ve.documentElement;return C&&De&&Ot.insertBefore(n.createTextNode(De),Ot.childNodes[0]||null),Lt===an?at.call(ve,Tn?"html":"body")[0]:Tn?ve.documentElement:Ot},_i=function(C){return Ge.call(C.ownerDocument||C,C,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Br=function(C){return C instanceof x&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof p)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},gt=function(C){return typeof f=="function"&&C instanceof f};function vn(Be,C,ve){oo(Be,De=>{De.call(e,C,ve,Xn)})}const Do=function(C){let ve=null;if(vn(Ae.beforeSanitizeElements,C,null),Br(C))return sn(C),!0;const De=Ft(C.nodeName);if(vn(Ae.uponSanitizeElement,C,{tagName:De,allowedTags:Ze}),sr&&C.hasChildNodes()&&!gt(C.firstElementChild)&&Wt(/<[/\w!]/g,C.innerHTML)&&Wt(/<[/\w!]/g,C.textContent)||C.nodeType===mi.progressingInstruction||sr&&C.nodeType===mi.comment&&Wt(/<[/\w]/g,C.data))return sn(C),!0;if(!Ze[De]||$t[De]){if(!$t[De]&&Oo(De)&&(st.tagNameCheck instanceof RegExp&&Wt(st.tagNameCheck,De)||st.tagNameCheck instanceof Function&&st.tagNameCheck(De)))return!1;if(d&&!jn[De]){const mt=He(C)||C.parentNode,Ot=Ue(C)||C.childNodes;if(Ot&&mt){const At=Ot.length;for(let jt=At-1;jt>=0;--jt){const gn=Ee(Ot[jt],!0);gn.__removalCount=(C.__removalCount||0)+1,mt.insertBefore(gn,se(C))}}}return sn(C),!0}return C instanceof u&&!us(C)||(De==="noscript"||De==="noembed"||De==="noframes")&&Wt(/<\/no(script|embed|frames)/i,C.innerHTML)?(sn(C),!0):(On&&C.nodeType===mi.text&&(ve=C.textContent,oo([lt,it,N],mt=>{ve=ci(ve,mt," ")}),C.textContent!==ve&&(li(e.removed,{element:C.cloneNode()}),C.textContent=ve)),vn(Ae.afterSanitizeElements,C,null),!1)},zo=function(C,ve,De){if(ur&&(ve==="id"||ve==="name")&&(De in n||De in Yt))return!1;if(!(zn&&!Ht[ve]&&Wt(Ce,ve))){if(!(Qt&&Wt(re,ve))){if(!ct[ve]||Ht[ve]){if(!(Oo(C)&&(st.tagNameCheck instanceof RegExp&&Wt(st.tagNameCheck,C)||st.tagNameCheck instanceof Function&&st.tagNameCheck(C))&&(st.attributeNameCheck instanceof RegExp&&Wt(st.attributeNameCheck,ve)||st.attributeNameCheck instanceof Function&&st.attributeNameCheck(ve))||ve==="is"&&st.allowCustomizedBuiltInElements&&(st.tagNameCheck instanceof RegExp&&Wt(st.tagNameCheck,De)||st.tagNameCheck instanceof Function&&st.tagNameCheck(De))))return!1}else if(!Mn[ve]){if(!Wt(Qe,ci(De,Xe,""))){if(!((ve==="src"||ve==="xlink:href"||ve==="href")&&C!=="script"&&Vp(De,"data:")===0&&wn[C])){if(!(wo&&!Wt(ke,ci(De,Xe,"")))){if(De)return!1}}}}}}return!0},Oo=function(C){return C!=="annotation-xml"&&eu(C,je)},Mo=function(C){vn(Ae.beforeSanitizeAttributes,C,null);const{attributes:ve}=C;if(!ve||Br(C))return;const De={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ct,forceKeepAttr:void 0};let mt=ve.length;for(;mt--;){const Ot=ve[mt],{name:At,namespaceURI:jt,value:gn}=Ot,dr=Ft(At),Si=gn;let Mt=At==="value"?Si:$p(Si);if(De.attrName=dr,De.attrValue=Mt,De.keepAttr=!0,De.forceKeepAttr=void 0,vn(Ae.uponSanitizeAttribute,C,De),Mt=De.attrValue,Eo&&(dr==="id"||dr==="name")&&(Wn(At,C),Mt=as+Mt),sr&&Wt(/((--!?|])>)|<\/(style|title)/i,Mt)){Wn(At,C);continue}if(De.forceKeepAttr)continue;if(!De.keepAttr){Wn(At,C);continue}if(!Ao&&Wt(/\/>/i,Mt)){Wn(At,C);continue}On&&oo([lt,it,N],Go=>{Mt=ci(Mt,Go," ")});const No=Ft(C.nodeName);if(!zo(No,dr,Mt)){Wn(At,C);continue}if(H&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!jt)switch(D.getAttributeType(No,dr)){case"TrustedHTML":{Mt=H.createHTML(Mt);break}case"TrustedScriptURL":{Mt=H.createScriptURL(Mt);break}}if(Mt!==Si)try{jt?C.setAttributeNS(jt,At,Mt):C.setAttribute(At,Mt),Br(C)?sn(C):Jf(e.removed)}catch{Wn(At,C)}}vn(Ae.afterSanitizeAttributes,C,null)},ls=function Be(C){let ve=null;const De=_i(C);for(vn(Ae.beforeSanitizeShadowDOM,C,null);ve=De.nextNode();)vn(Ae.uponSanitizeShadowNode,ve,null),Do(ve),Mo(ve),ve.content instanceof o&&Be(ve.content);vn(Ae.afterSanitizeShadowDOM,C,null)};return e.sanitize=function(Be){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=null,De=null,mt=null,Ot=null;if(cr=!Be,cr&&(Be="<!-->"),typeof Be!="string"&&!gt(Be))if(typeof Be.toString=="function"){if(Be=Be.toString(),typeof Be!="string")throw hi("dirty is not a string, aborting")}else throw hi("toString is not a function");if(!e.isSupported)return Be;if(Ir||bi(C),e.removed=[],typeof Be=="string"&&(lr=!1),lr){if(Be.nodeName){const gn=Ft(Be.nodeName);if(!Ze[gn]||$t[gn])throw hi("root node is forbidden and cannot be sanitized in-place")}}else if(Be instanceof f)ve=Io("<!---->"),De=ve.ownerDocument.importNode(Be,!0),De.nodeType===mi.element&&De.nodeName==="BODY"||De.nodeName==="HTML"?ve=De:ve.appendChild(De);else{if(!$n&&!On&&!Tn&&Be.indexOf("<")===-1)return H&&fr?H.createHTML(Be):Be;if(ve=Io(Be),!ve)return $n?null:fr?fe:""}ve&&Dr&&sn(ve.firstChild);const At=_i(lr?Be:ve);for(;mt=At.nextNode();)Do(mt),Mo(mt),mt.content instanceof o&&ls(mt.content);if(lr)return Be;if($n){if(zt)for(Ot=Ye.call(ve.ownerDocument);ve.firstChild;)Ot.appendChild(ve.firstChild);else Ot=ve;return(ct.shadowroot||ct.shadowrootmode)&&(Ot=ut.call(r,Ot,!0)),Ot}let jt=Tn?ve.outerHTML:ve.innerHTML;return Tn&&Ze["!doctype"]&&ve.ownerDocument&&ve.ownerDocument.doctype&&ve.ownerDocument.doctype.name&&Wt(au,ve.ownerDocument.doctype.name)&&(jt="<!DOCTYPE "+ve.ownerDocument.doctype.name+`>
|
|
9
9
|
`+jt),On&&oo([lt,it,N],gn=>{jt=ci(jt,gn," ")}),H&&fr?H.createHTML(jt):jt},e.setConfig=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bi(Be),Ir=!0},e.clearConfig=function(){Xn=null,Ir=!1},e.isValidAttribute=function(Be,C,ve){Xn||bi({});const De=Ft(Be),mt=Ft(C);return zo(De,mt,ve)},e.addHook=function(Be,C){typeof C=="function"&&li(Ae[Be],C)},e.removeHook=function(Be,C){if(C!==void 0){const ve=Bp(Ae[Be],C);return ve===-1?void 0:Up(Ae[Be],ve,1)[0]}return Jf(Ae[Be])},e.removeHooks=function(Be){Ae[Be]=[]},e.removeAllHooks=function(){Ae=fu()},e}var i0=uu();const lu=t=>typeof t=="function",Va=t=>Array.isArray(t),cu=t=>t instanceof Object,hu=t=>t instanceof Object?t.constructor.name!=="Function"&&t.constructor.name!=="Object":!1,$a=t=>cu(t)&&!Va(t)&&!lu(t)&&!hu(t);function Vn(t){let e;if(Va(t))e=t;else{const n=Un(t),r=n==null?void 0:n.rgb();e=[(r==null?void 0:r.r)||0,(r==null?void 0:r.g)||0,(r==null?void 0:r.b)||0,(n==null?void 0:n.opacity)??1]}return[e[0]/255,e[1]/255,e[2]/255,e[3]]}function du(t,e,n){return .2126*t+.7152*e+.0722*n}function tn(t,e){let n=new Float32Array;return t({framebuffer:e})(()=>{n=t.read()}),n}function mu(t,e,n){return Math.min(Math.max(t,e),n)}function mn(t){return t!=null&&!Number.isNaN(t)}function pu(t,e){return i0.sanitize(t,{ALLOWED_TAGS:["a","b","i","em","strong","span","div","p","br"],ALLOWED_ATTR:["href","target","class","id","style"],ALLOW_DATA_ATTR:!1,...e})}class o0{constructor(){this.enableSimulation=We.enableSimulation,this.backgroundColor=Ip,this.spaceSize=We.spaceSize,this.pointColor=wp,this.pointGreyoutOpacity=Ap,this.pointGreyoutColor=Ep,this.pointSize=Cp,this.pointOpacity=Pp,this.pointSizeScale=We.pointSizeScale,this.hoveredPointCursor=We.hoveredPointCursor,this.renderHoveredPointRing=We.renderHoveredPointRing,this.hoveredPointRingColor=We.hoveredPointRingColor,this.focusedPointRingColor=We.focusedPointRingColor,this.focusedPointIndex=We.focusedPointIndex,this.linkColor=kp,this.linkOpacity=Fp,this.linkGreyoutOpacity=Lp,this.linkWidth=Rp,this.linkWidthScale=We.linkWidthScale,this.renderLinks=We.renderLinks,this.curvedLinks=We.curvedLinks,this.curvedLinkSegments=We.curvedLinkSegments,this.curvedLinkWeight=We.curvedLinkWeight,this.curvedLinkControlPointDistance=We.curvedLinkControlPointDistance,this.linkArrows=We.arrowLinks,this.linkArrowsSizeScale=We.arrowSizeScale,this.scaleLinksOnZoom=We.scaleLinksOnZoom,this.linkVisibilityDistanceRange=We.linkVisibilityDistanceRange,this.linkVisibilityMinTransparency=We.linkVisibilityMinTransparency,this.useClassicQuadtree=We.useClassicQuadtree,this.simulationDecay=We.simulation.decay,this.simulationGravity=We.simulation.gravity,this.simulationCenter=We.simulation.center,this.simulationRepulsion=We.simulation.repulsion,this.simulationRepulsionTheta=We.simulation.repulsionTheta,this.simulationRepulsionQuadtreeLevels=We.simulation.repulsionQuadtreeLevels,this.simulationLinkSpring=We.simulation.linkSpring,this.simulationLinkDistance=We.simulation.linkDistance,this.simulationLinkDistRandomVariationRange=We.simulation.linkDistRandomVariationRange,this.simulationRepulsionFromMouse=We.simulation.repulsionFromMouse,this.enableRightClickRepulsion=We.enableRightClickRepulsion,this.simulationFriction=We.simulation.friction,this.simulationCluster=We.simulation.cluster,this.onSimulationStart=void 0,this.onSimulationTick=void 0,this.onSimulationEnd=void 0,this.onSimulationPause=void 0,this.onSimulationRestart=void 0,this.onClick=void 0,this.onMouseMove=void 0,this.onPointMouseOver=void 0,this.onPointMouseOut=void 0,this.onZoomStart=void 0,this.onZoom=void 0,this.onZoomEnd=void 0,this.onDragStart=void 0,this.onDrag=void 0,this.onDragEnd=void 0,this.showFPSMonitor=We.showFPSMonitor,this.pixelRatio=We.pixelRatio,this.scalePointsOnZoom=We.scalePointsOnZoom,this.initialZoomLevel=void 0,this.enableZoom=We.enableZoom,this.enableSimulationDuringZoom=We.enableSimulationDuringZoom,this.enableDrag=We.enableDrag,this.fitViewOnInit=We.fitViewOnInit,this.fitViewDelay=We.fitViewDelay,this.fitViewPadding=We.fitViewPadding,this.fitViewDuration=We.fitViewDuration,this.fitViewByPointsInRect=void 0,this.randomSeed=void 0,this.pointSamplingDistance=We.pointSamplingDistance,this.attribution=We.attribution,this.rescalePositions=We.rescalePositions}init(e){Object.keys(e).forEach(n=>{this.deepMergeConfig(this.getConfig(),e,n)})}deepMergeConfig(e,n,r){$a(e[r])&&$a(n[r])?Object.keys(n[r]).forEach(i=>{this.deepMergeConfig(e[r],n[r],i)}):e[r]=n[r]}getConfig(){return this}}class In{constructor(e,n,r,i,o){this.reglInstance=e,this.config=n,this.store=r,this.data=i,o&&(this.points=o)}}var a0=`#ifdef GL_ES
|
|
10
10
|
precision highp float;
|
|
11
11
|
#endif
|
|
@@ -169,7 +169,7 @@ void main() {
|
|
|
169
169
|
|
|
170
170
|
gl_FragColor = vec4(velocity.rg, 0.0, 0.0);
|
|
171
171
|
}
|
|
172
|
-
`}var Ha=(t=>(t.OUTGOING="outgoing",t.INCOMING="incoming",t))(Ha||{});class vu extends In{constructor(){super(...arguments),this.linkFirstIndicesAndAmount=new Float32Array,this.indices=new Float32Array,this.maxPointDegree=0}create(e){const{reglInstance:n,store:{pointsTextureSize:r,linksTextureSize:i},data:o}=this;if(!r||!i)return;this.linkFirstIndicesAndAmount=new Float32Array(r*r*4),this.indices=new Float32Array(i*i*4);const s=new Float32Array(i*i*4),f=new Float32Array(i*i*4),u=e==="incoming"?o.sourceIndexToTargetIndices:o.targetIndexToSourceIndices;this.maxPointDegree=0;let l=0;u==null||u.forEach((
|
|
172
|
+
`}var Ha=(t=>(t.OUTGOING="outgoing",t.INCOMING="incoming",t))(Ha||{});class vu extends In{constructor(){super(...arguments),this.linkFirstIndicesAndAmount=new Float32Array,this.indices=new Float32Array,this.maxPointDegree=0}create(e){const{reglInstance:n,store:{pointsTextureSize:r,linksTextureSize:i},data:o}=this;if(!r||!i)return;this.linkFirstIndicesAndAmount=new Float32Array(r*r*4),this.indices=new Float32Array(i*i*4);const s=new Float32Array(i*i*4),f=new Float32Array(i*i*4),u=e==="incoming"?o.sourceIndexToTargetIndices:o.targetIndexToSourceIndices;this.maxPointDegree=0;let l=0;u==null||u.forEach((p,x)=>{p&&(this.linkFirstIndicesAndAmount[x*4+0]=l%i,this.linkFirstIndicesAndAmount[x*4+1]=Math.floor(l/i),this.linkFirstIndicesAndAmount[x*4+2]=p.length??0,p.forEach(([S,D])=>{var H,fe,Re;this.indices[l*4+0]=S%r,this.indices[l*4+1]=Math.floor(S/r);const Y=((H=o.degree)==null?void 0:H[S])??0,Ee=((fe=o.degree)==null?void 0:fe[x])??0,Te=Y+Ee,se=Te!==0?Y/Te:.5,Ue=Math.min(Y,Ee);let He=((Re=o.linkStrength)==null?void 0:Re[D])??1/Math.max(Ue,1);He=Math.sqrt(He),s[l*4+0]=se,s[l*4+1]=He,f[l*4]=this.store.getRandomFloat(0,1),l+=1}),this.maxPointDegree=Math.max(this.maxPointDegree,p.length??0))}),this.linkFirstIndicesAndAmountTexture||(this.linkFirstIndicesAndAmountTexture=n.texture()),this.linkFirstIndicesAndAmountTexture({data:this.linkFirstIndicesAndAmount,shape:[r,r,4],type:"float"}),this.linkFirstIndicesAndAmountFbo||(this.linkFirstIndicesAndAmountFbo=n.framebuffer()),this.linkFirstIndicesAndAmountFbo({color:this.linkFirstIndicesAndAmountTexture,depth:!1,stencil:!1}),this.indicesTexture||(this.indicesTexture=n.texture()),this.indicesTexture({data:this.indices,shape:[i,i,4],type:"float"}),this.indicesFbo||(this.indicesFbo=n.framebuffer()),this.indicesFbo({color:this.indicesTexture,depth:!1,stencil:!1}),this.biasAndStrengthTexture||(this.biasAndStrengthTexture=n.texture()),this.biasAndStrengthTexture({data:s,shape:[i,i,4],type:"float"}),this.biasAndStrengthFbo||(this.biasAndStrengthFbo=n.framebuffer()),this.biasAndStrengthFbo({color:this.biasAndStrengthTexture,depth:!1,stencil:!1}),this.randomDistanceTexture||(this.randomDistanceTexture=n.texture()),this.randomDistanceTexture({data:f,shape:[i,i,4],type:"float"}),this.randomDistanceFbo||(this.randomDistanceFbo=n.framebuffer()),this.randomDistanceFbo({color:this.randomDistanceTexture,depth:!1,stencil:!1})}initPrograms(){const{reglInstance:e,config:n,store:r,points:i}=this;this.runCommand||(this.runCommand=e({frag:()=>h0(this.maxPointDegree),vert:kt,framebuffer:()=>i==null?void 0:i.velocityFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>i==null?void 0:i.previousPositionFbo,linkSpring:()=>n.simulationLinkSpring,linkDistance:()=>n.simulationLinkDistance,linkDistRandomVariationRange:()=>n.simulationLinkDistRandomVariationRange,linkInfoTexture:()=>this.linkFirstIndicesAndAmountFbo,linkIndicesTexture:()=>this.indicesFbo,linkPropertiesTexture:()=>this.biasAndStrengthFbo,linkRandomDistanceTexture:()=>this.randomDistanceFbo,pointsTextureSize:()=>r.pointsTextureSize,linksTextureSize:()=>r.linksTextureSize,alpha:()=>r.alpha}}))}run(){var e;(e=this.runCommand)==null||e.call(this)}}var gu=`#ifdef GL_ES
|
|
173
173
|
precision highp float;
|
|
174
174
|
#endif
|
|
175
175
|
|
|
@@ -372,7 +372,7 @@ void main() {
|
|
|
372
372
|
addVelocity += calcAdd(vec2(x, y), l, c);
|
|
373
373
|
addVelocity += addVelocity * random.rg;
|
|
374
374
|
}
|
|
375
|
-
`;function i(o){if(o>=e)return r;{const s=Math.pow(2,o+1),f=new Array(o+1-n).fill(0).map((l,
|
|
375
|
+
`;function i(o){if(o>=e)return r;{const s=Math.pow(2,o+1),f=new Array(o+1-n).fill(0).map((l,p)=>`pow(2.0, ${o-(p+n)}.0) * i${p+n}`).join("+"),u=new Array(o+1-n).fill(0).map((l,p)=>`pow(2.0, ${o-(p+n)}.0) * j${p+n}`).join("+");return`
|
|
376
376
|
for (float ij${o} = 0.0; ij${o} < 4.0; ij${o} += 1.0) {
|
|
377
377
|
float i${o} = 0.0;
|
|
378
378
|
float j${o} = 0.0;
|
|
@@ -531,7 +531,7 @@ void main() {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
gl_FragColor = velocity;
|
|
534
|
-
}`;class T0 extends In{create(){var u;const{reglInstance:e,store:n,data:r}=this,{pointsTextureSize:i}=n;if(r.pointsNumber===void 0||!r.pointClusters&&!r.clusterPositions)return;this.clusterCount=(r.pointClusters??[]).reduce((l,
|
|
534
|
+
}`;class T0 extends In{create(){var u;const{reglInstance:e,store:n,data:r}=this,{pointsTextureSize:i}=n;if(r.pointsNumber===void 0||!r.pointClusters&&!r.clusterPositions)return;this.clusterCount=(r.pointClusters??[]).reduce((l,p)=>p===void 0||p<0?l:Math.max(l,p),0)+1,this.clustersTextureSize=Math.ceil(Math.sqrt(this.clusterCount));const o=new Float32Array(i*i*4),s=new Float32Array(this.clustersTextureSize*this.clustersTextureSize*4).fill(-1),f=new Float32Array(i*i*4).fill(1);if(r.clusterPositions)for(let l=0;l<this.clusterCount;++l)s[l*4+0]=r.clusterPositions[l*2+0]??-1,s[l*4+1]=r.clusterPositions[l*2+1]??-1;for(let l=0;l<r.pointsNumber;++l){const p=(u=r.pointClusters)==null?void 0:u[l];p===void 0?(o[l*4+0]=-1,o[l*4+1]=-1):(o[l*4+0]=p%this.clustersTextureSize,o[l*4+1]=Math.floor(p/this.clustersTextureSize)),r.clusterStrength&&(f[l*4+0]=r.clusterStrength[l]??1)}this.clusterTexture||(this.clusterTexture=e.texture()),this.clusterTexture({data:o,shape:[i,i,4],type:"float"}),this.clusterFbo||(this.clusterFbo=e.framebuffer()),this.clusterFbo({color:this.clusterTexture,depth:!1,stencil:!1}),this.clusterPositionsTexture||(this.clusterPositionsTexture=e.texture()),this.clusterPositionsTexture({data:s,shape:[this.clustersTextureSize,this.clustersTextureSize,4],type:"float"}),this.clusterPositionsFbo||(this.clusterPositionsFbo=e.framebuffer()),this.clusterPositionsFbo({color:this.clusterPositionsTexture,depth:!1,stencil:!1}),this.clusterForceCoefficientTexture||(this.clusterForceCoefficientTexture=e.texture()),this.clusterForceCoefficientTexture({data:f,shape:[i,i,4],type:"float"}),this.clusterForceCoefficientFbo||(this.clusterForceCoefficientFbo=e.framebuffer()),this.clusterForceCoefficientFbo({color:this.clusterForceCoefficientTexture,depth:!1,stencil:!1}),this.centermassTexture||(this.centermassTexture=e.texture()),this.centermassTexture({data:new Float32Array(this.clustersTextureSize*this.clustersTextureSize*4).fill(0),shape:[this.clustersTextureSize,this.clustersTextureSize,4],type:"float"}),this.centermassFbo||(this.centermassFbo=e.framebuffer()),this.centermassFbo({color:this.centermassTexture,depth:!1,stencil:!1}),this.pointIndices||(this.pointIndices=e.buffer(0)),this.pointIndices(or(n.pointsTextureSize))}initPrograms(){const{reglInstance:e,store:n,data:r,points:i}=this;r.pointClusters!==void 0&&(this.clearCentermassCommand||(this.clearCentermassCommand=e({frag:ar,vert:kt,framebuffer:()=>this.centermassFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.calculateCentermassCommand||(this.calculateCentermassCommand=e({frag:b0,vert:_0,framebuffer:()=>this.centermassFbo,primitive:"points",count:()=>r.pointsNumber??0,attributes:{pointIndices:{buffer:this.pointIndices,size:2}},uniforms:{positionsTexture:()=>i==null?void 0:i.previousPositionFbo,pointsTextureSize:()=>n.pointsTextureSize,clusterTexture:()=>this.clusterFbo,clustersTextureSize:()=>this.clustersTextureSize},blend:{enable:!0,func:{src:"one",dst:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1},stencil:{enable:!1}})),this.applyForcesCommand||(this.applyForcesCommand=e({frag:S0,vert:kt,framebuffer:()=>i==null?void 0:i.velocityFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>i==null?void 0:i.previousPositionFbo,clusterTexture:()=>this.clusterFbo,centermassTexture:()=>this.centermassFbo,clusterPositionsTexture:()=>this.clusterPositionsFbo,clusterForceCoefficient:()=>this.clusterForceCoefficientFbo,alpha:()=>n.alpha,clustersTextureSize:()=>this.clustersTextureSize,clusterCoefficient:()=>this.config.simulationCluster}})))}calculateCentermass(){var e,n;(e=this.clearCentermassCommand)==null||e.call(this),(n=this.calculateCentermassCommand)==null||n.call(this)}run(){var e;!this.data.pointClusters&&!this.data.clusterPositions||(this.calculateCentermass(),(e=this.applyForcesCommand)==null||e.call(this))}}var fo={exports:{}},w0=fo.exports,xu;function A0(){return xu||(xu=1,function(t,e){(function(n,r){t.exports=r()})(w0,function(){var n=`<div class="gl-box">
|
|
535
535
|
<svg viewBox="0 0 55 60">
|
|
536
536
|
<text x="27" y="56" class="gl-fps">00 FPS</text>
|
|
537
537
|
<text x="28" y="8" class="gl-mem"></text>
|
|
@@ -607,7 +607,7 @@ void main() {
|
|
|
607
607
|
#gl-bench .opacity {
|
|
608
608
|
stroke: #448844;
|
|
609
609
|
}
|
|
610
|
-
`;class i{constructor(s,f={}){this.css=r,this.svg=n,this.paramLogger=()=>{},this.chartLogger=()=>{},this.chartLen=20,this.chartHz=20,this.names=[],this.cpuAccums=[],this.gpuAccums=[],this.activeAccums=[],this.chart=new Array(this.chartLen),this.now=()=>performance&&performance.now?performance.now():Date.now(),this.updateUI=()=>{[].forEach.call(this.nodes["gl-gpu-svg"],S=>{S.style.display=this.trackGPU?"inline":"none"})},Object.assign(this,f),this.detected=0,this.finished=[],this.isFramebuffer=0,this.frameId=0;let u,l=0,
|
|
610
|
+
`;class i{constructor(s,f={}){this.css=r,this.svg=n,this.paramLogger=()=>{},this.chartLogger=()=>{},this.chartLen=20,this.chartHz=20,this.names=[],this.cpuAccums=[],this.gpuAccums=[],this.activeAccums=[],this.chart=new Array(this.chartLen),this.now=()=>performance&&performance.now?performance.now():Date.now(),this.updateUI=()=>{[].forEach.call(this.nodes["gl-gpu-svg"],S=>{S.style.display=this.trackGPU?"inline":"none"})},Object.assign(this,f),this.detected=0,this.finished=[],this.isFramebuffer=0,this.frameId=0;let u,l=0,p,x=S=>{++l<20?u=requestAnimationFrame(x):(this.detected=Math.ceil(1e3*l/(S-p)/70),cancelAnimationFrame(u)),p||(p=S)};if(requestAnimationFrame(x),s){const S=async(Y,Ee)=>Promise.resolve(setTimeout(()=>{s.getError();const Te=this.now()-Y;Ee.forEach((se,Ue)=>{se&&(this.gpuAccums[Ue]+=Te)})},0)),D=(Y,Ee,Te)=>function(){const se=Ee.now();Y.apply(Te,arguments),Ee.trackGPU&&Ee.finished.push(S(se,Ee.activeAccums.slice(0)))};["drawArrays","drawElements","drawArraysInstanced","drawBuffers","drawElementsInstanced","drawRangeElements"].forEach(Y=>{s[Y]&&(s[Y]=D(s[Y],this,s))}),s.getExtension=((Y,Ee)=>function(){let Te=Y.apply(s,arguments);return Te&&["drawElementsInstancedANGLE","drawBuffersWEBGL"].forEach(se=>{Te[se]&&(Te[se]=D(Te[se],Ee,Te))}),Te})(s.getExtension,this)}if(!this.withoutUI){this.dom||(this.dom=document.body);let S=document.createElement("div");S.id="gl-bench",this.dom.appendChild(S),this.dom.insertAdjacentHTML("afterbegin",'<style id="gl-bench-style">'+this.css+"</style>"),this.dom=S,this.dom.addEventListener("click",()=>{this.trackGPU=!this.trackGPU,this.updateUI()}),this.paramLogger=((D,Y,Ee)=>{const Te=["gl-cpu","gl-gpu","gl-mem","gl-fps","gl-gpu-svg","gl-chart"],se=Object.assign({},Te);return Te.forEach(Ue=>se[Ue]=Y.getElementsByClassName(Ue)),this.nodes=se,(Ue,He,H,fe,Re,Ge,Ye)=>{se["gl-cpu"][Ue].style.strokeDasharray=(He*.27).toFixed(0)+" 100",se["gl-gpu"][Ue].style.strokeDasharray=(H*.27).toFixed(0)+" 100",se["gl-mem"][Ue].innerHTML=Ee[Ue]?Ee[Ue]:fe?"mem: "+fe.toFixed(0)+"mb":"",se["gl-fps"][Ue].innerHTML=Re.toFixed(0)+" FPS",D(Ee[Ue],He,H,fe,Re,Ge,Ye)}})(this.paramLogger,this.dom,this.names),this.chartLogger=((D,Y)=>{let Ee={"gl-chart":Y.getElementsByClassName("gl-chart")};return(Te,se,Ue)=>{let He="",H=se.length;for(let fe=0;fe<H;fe++){let Re=(Ue+fe+1)%H;se[Re]!=null&&(He=He+" "+(55*fe/(H-1)).toFixed(1)+","+(45-se[Re]*22/60/this.detected).toFixed(1))}Ee["gl-chart"][Te].setAttribute("points",He),D(this.names[Te],se,Ue)}})(this.chartLogger,this.dom)}}addUI(s){this.names.indexOf(s)==-1&&(this.names.push(s),this.dom&&(this.dom.insertAdjacentHTML("beforeend",this.svg),this.updateUI()),this.cpuAccums.push(0),this.gpuAccums.push(0),this.activeAccums.push(!1))}nextFrame(s){this.frameId++;const f=s||this.now();if(this.frameId<=1)this.paramFrame=this.frameId,this.paramTime=f;else{let u=f-this.paramTime;if(u>=1e3){const l=this.frameId-this.paramFrame,p=l/u*1e3;for(let x=0;x<this.names.length;x++){const S=this.cpuAccums[x]/u*100,D=this.gpuAccums[x]/u*100,Y=performance&&performance.memory?performance.memory.usedJSHeapSize/(1<<20):0;this.paramLogger(x,S,D,Y,p,u,l),this.cpuAccums[x]=0,Promise.all(this.finished).then(()=>{this.gpuAccums[x]=0,this.finished=[]})}this.paramFrame=this.frameId,this.paramTime=f}}if(!this.detected||!this.chartFrame)this.chartFrame=this.frameId,this.chartTime=f,this.circularId=0;else{let u=f-this.chartTime,l=this.chartHz*u/1e3;for(;--l>0&&this.detected;){const x=(this.frameId-this.chartFrame)/u*1e3;this.chart[this.circularId%this.chartLen]=x;for(let S=0;S<this.names.length;S++)this.chartLogger(S,this.chart,this.circularId);this.circularId++,this.chartFrame=this.frameId,this.chartTime=f}}}begin(s){this.updateAccums(s)}end(s){this.updateAccums(s)}updateAccums(s){let f=this.names.indexOf(s);f==-1&&(f=this.names.length,this.addUI(s));const u=this.now(),l=u-this.t0;for(let p=0;p<f+1;p++)this.activeAccums[p]&&(this.cpuAccums[p]+=l);this.activeAccums[f]=!this.activeAccums[f],this.t0=u}}return i})}(fo)),fo.exports}var E0=A0();const P0=Da(E0),C0=`
|
|
611
611
|
#gl-bench {
|
|
612
612
|
position:absolute;
|
|
613
613
|
right:0;
|
|
@@ -758,7 +758,11 @@ float calculateArrowWidth(float arrowWidth) {
|
|
|
758
758
|
if (scaleLinksOnZoom) {
|
|
759
759
|
return arrowWidth;
|
|
760
760
|
} else {
|
|
761
|
-
|
|
761
|
+
|
|
762
|
+
arrowWidth = arrowWidth / transformationMatrix[0][0];
|
|
763
|
+
|
|
764
|
+
arrowWidth *= min(5.0, max(1.0, transformationMatrix[0][0] * 0.01));
|
|
765
|
+
return arrowWidth;
|
|
762
766
|
}
|
|
763
767
|
}
|
|
764
768
|
|
|
@@ -795,7 +799,8 @@ void main() {
|
|
|
795
799
|
float arrowWidth = linkWidth * k;
|
|
796
800
|
arrowWidth *= arrowSizeScale;
|
|
797
801
|
|
|
798
|
-
|
|
802
|
+
|
|
803
|
+
float arrowWidthDifference = max(0.0, arrowWidth - linkWidth);
|
|
799
804
|
|
|
800
805
|
|
|
801
806
|
float arrowWidthPx = calculateArrowWidth(arrowWidth);
|
|
@@ -854,7 +859,7 @@ void main() {
|
|
|
854
859
|
vec3 final = transformationMatrix * vec3(p, 1);
|
|
855
860
|
|
|
856
861
|
gl_Position = vec4(final.rg, 0, 1);
|
|
857
|
-
}`;function uo(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function R0(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _u(t){let e,n,r;t.length!==2?(e=uo,n=(f,u)=>uo(t(f),u),r=(f,u)=>t(f)-u):(e=t===uo||t===R0?t:I0,n=t,r=t);function i(f,u,l=0,v=f.length){if(l<v){if(e(u,u)!==0)return v;do{const b=l+v>>>1;n(f[b],u)<0?l=b+1:v=b}while(l<v)}return l}function o(f,u,l=0,v=f.length){if(l<v){if(e(u,u)!==0)return v;do{const b=l+v>>>1;n(f[b],u)<=0?l=b+1:v=b}while(l<v)}return l}function s(f,u,l=0,v=f.length){const b=i(f,u,l,v-1);return b>l&&r(f[b-1],u)>-r(f[b],u)?b-1:b}return{left:i,center:s,right:o}}function I0(){return 0}function D0(t){return t===null?NaN:+t}const z0=_u(uo).right;_u(D0).center;function Su(t,e){let n,r;for(const i of t)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));return[n,r]}var ja=Math.sqrt(50),Xa=Math.sqrt(10),Wa=Math.sqrt(2);function O0(t,e,n){var r,i=-1,o,s,f;if(e=+e,t=+t,n=+n,t===e&&n>0)return[t];if((r=e<t)&&(o=t,t=e,e=o),(f=Tu(t,e,n))===0||!isFinite(f))return[];if(f>0){let u=Math.round(t/f),l=Math.round(e/f);for(u*f<t&&++u,l*f>e&&--l,s=new Array(o=l-u+1);++i<o;)s[i]=(u+i)*f}else{f=-f;let u=Math.round(t*f),l=Math.round(e*f);for(u/f<t&&++u,l/f>e&&--l,s=new Array(o=l-u+1);++i<o;)s[i]=(u+i)/f}return r&&s.reverse(),s}function Tu(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=ja?10:o>=Xa?5:o>=Wa?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ja?10:o>=Xa?5:o>=Wa?2:1)}function M0(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=ja?i*=10:o>=Xa?i*=5:o>=Wa&&(i*=2),e<t?-i:i}function N0(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r<i;)o[r]=t+r*n;return o}function wu(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function G0(t){return function(){return t}}function B0(t){return+t}var Au=[0,1];function Sn(t){return t}function qa(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:G0(isNaN(e)?NaN:.5)}function U0(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function V0(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i<r?(r=qa(i,r),o=n(s,o)):(r=qa(r,i),o=n(o,s)),function(f){return o(r(f))}}function $0(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=qa(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(f){var u=z0(t,f,1,r)-1;return o[u](i[u](f))}}function Eu(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Pu(){var t=Au,e=Au,n=Fa,r,i,o,s=Sn,f,u,l;function v(){var S=Math.min(t.length,e.length);return s!==Sn&&(s=U0(t[0],t[S-1])),f=S>2?$0:V0,u=l=null,b}function b(S){return S==null||isNaN(S=+S)?o:(u||(u=f(t.map(r),e,n)))(r(s(S)))}return b.invert=function(S){return s(i((l||(l=f(e,t.map(r),hn)))(S)))},b.domain=function(S){return arguments.length?(t=Array.from(S,B0),v()):t.slice()},b.range=function(S){return arguments.length?(e=Array.from(S),v()):e.slice()},b.rangeRound=function(S){return e=Array.from(S),n=im,v()},b.clamp=function(S){return arguments.length?(s=S?!0:Sn,v()):s!==Sn},b.interpolate=function(S){return arguments.length?(n=S,v()):n},b.unknown=function(S){return arguments.length?(o=S,b):o},function(S,D){return r=S,i=D,v()}}function H0(){return Pu()(Sn,Sn)}function j0(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function lo(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Fr(t){return t=lo(Math.abs(t)),t?t[1]:NaN}function X0(t,e){return function(n,r){for(var i=n.length,o=[],s=0,f=t[0],u=0;i>0&&f>0&&(u+f+1>r&&(f=Math.max(1,r-u)),o.push(n.substring(i-=f,i+f)),!((u+=f+1)>r));)f=t[s=(s+1)%t.length];return o.reverse().join(e)}}function W0(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var q0=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function co(t){if(!(e=q0.exec(t)))throw new Error("invalid format: "+t);var e;return new Ya({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}co.prototype=Ya.prototype;function Ya(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Ya.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Y0(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Cu;function Z0(t,e){var n=lo(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Cu=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+lo(t,Math.max(0,e+o-1))[0]}function ku(t,e){var n=lo(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Lu={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:j0,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ku(t*100,e),r:ku,s:Z0,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Fu(t){return t}var Ru=Array.prototype.map,Iu=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Q0(t){var e=t.grouping===void 0||t.thousands===void 0?Fu:X0(Ru.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?Fu:W0(Ru.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",f=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function l(b){b=co(b);var S=b.fill,D=b.align,Y=b.sign,Ee=b.symbol,Te=b.zero,se=b.width,Ue=b.comma,He=b.precision,H=b.trim,fe=b.type;fe==="n"?(Ue=!0,fe="g"):Lu[fe]||(He===void 0&&(He=12),H=!0,fe="g"),(Te||S==="0"&&D==="=")&&(Te=!0,S="0",D="=");var Re=Ee==="$"?n:Ee==="#"&&/[boxX]/.test(fe)?"0"+fe.toLowerCase():"",Ge=Ee==="$"?r:/[%p]/.test(fe)?s:"",Ye=Lu[fe],at=/[defgprs%]/.test(fe);He=He===void 0?6:/[gprs]/.test(fe)?Math.max(1,Math.min(21,He)):Math.max(0,Math.min(20,He));function ut(Ae){var lt=Re,it=Ge,N,Ce,re;if(fe==="c")it=Ye(Ae)+it,Ae="";else{Ae=+Ae;var ke=Ae<0||1/Ae<0;if(Ae=isNaN(Ae)?u:Ye(Math.abs(Ae),He),H&&(Ae=Y0(Ae)),ke&&+Ae==0&&Y!=="+"&&(ke=!1),lt=(ke?Y==="("?Y:f:Y==="-"||Y==="("?"":Y)+lt,it=(fe==="s"?Iu[8+Cu/3]:"")+it+(ke&&Y==="("?")":""),at){for(N=-1,Ce=Ae.length;++N<Ce;)if(re=Ae.charCodeAt(N),48>re||re>57){it=(re===46?i+Ae.slice(N+1):Ae.slice(N))+it,Ae=Ae.slice(0,N);break}}}Ue&&!Te&&(Ae=e(Ae,1/0));var Xe=lt.length+Ae.length+it.length,je=Xe<se?new Array(se-Xe+1).join(S):"";switch(Ue&&Te&&(Ae=e(je+Ae,je.length?se-it.length:1/0),je=""),D){case"<":Ae=lt+Ae+it+je;break;case"=":Ae=lt+je+Ae+it;break;case"^":Ae=je.slice(0,Xe=je.length>>1)+lt+Ae+it+je.slice(Xe);break;default:Ae=je+lt+Ae+it;break}return o(Ae)}return ut.toString=function(){return b+""},ut}function v(b,S){var D=l((b=co(b),b.type="f",b)),Y=Math.max(-8,Math.min(8,Math.floor(Fr(S)/3)))*3,Ee=Math.pow(10,-Y),Te=Iu[8+Y/3];return function(se){return D(Ee*se)+Te}}return{format:l,formatPrefix:v}}var ho,Du,zu;K0({thousands:",",grouping:[3],currency:["$",""]});function K0(t){return ho=Q0(t),Du=ho.format,zu=ho.formatPrefix,ho}function J0(t){return Math.max(0,-Fr(Math.abs(t)))}function ev(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Fr(e)/3)))*3-Fr(Math.abs(t)))}function tv(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Fr(e)-Fr(t))+1}function nv(t,e,n,r){var i=M0(t,e,n),o;switch(r=co(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=ev(i,s))&&(r.precision=o),zu(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=tv(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=J0(i))&&(r.precision=o-(r.type==="%")*2);break}}return Du(r)}function Ou(t){var e=t.domain;return t.ticks=function(n){var r=e();return O0(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return nv(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],f=r[o],u,l,v=10;for(f<s&&(l=s,s=f,f=l,l=i,i=o,o=l);v-- >0;){if(l=Tu(s,f,n),l===u)return r[i]=s,r[o]=f,e(r);if(l>0)s=Math.floor(s/l)*l,f=Math.ceil(f/l)*l;else if(l<0)s=Math.ceil(s*l)/l,f=Math.floor(f*l)/l;else break;u=l}return t},t}function Za(){var t=H0();return t.copy=function(){return Eu(t,Za())},wu.apply(t,arguments),Ou(t)}function Mu(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function rv(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function iv(t){return t<0?-t*t:t*t}function ov(t){var e=t(Sn,Sn),n=1;function r(){return n===1?t(Sn,Sn):n===.5?t(rv,iv):t(Mu(n),Mu(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Ou(e)}function Nu(){var t=ov(Pu());return t.copy=function(){return Eu(t,Nu()).exponent(t.exponent())},wu.apply(t,arguments),t}const av=t=>{const e=Nu().exponent(2).range([0,1]).domain([-1,1]),n=N0(0,t).map(i=>-.5+i/t);n.push(.5);const r=new Array(n.length*2);return n.forEach((i,o)=>{r[o*2]=[e(i*2),.5],r[o*2+1]=[e(i*2),-.5]}),r};class sv extends In{initPrograms(){const{reglInstance:e,config:n,store:r}=this;this.drawCurveCommand||(this.drawCurveCommand=e({vert:F0,frag:L0,attributes:{position:{buffer:()=>this.curveLineBuffer,divisor:0},pointA:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},pointB:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*2,stride:Float32Array.BYTES_PER_ELEMENT*4},color:{buffer:()=>this.colorBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},width:{buffer:()=>this.widthBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1},arrow:{buffer:()=>this.arrowBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1}},uniforms:{positionsTexture:()=>{var i;return(i=this.points)==null?void 0:i.currentPositionFbo},pointGreyoutStatus:()=>{var i;return(i=this.points)==null?void 0:i.greyoutStatusFbo},transformationMatrix:()=>r.transform,pointsTextureSize:()=>r.pointsTextureSize,widthScale:()=>n.linkWidthScale,arrowSizeScale:()=>n.linkArrowsSizeScale,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,linkVisibilityDistanceRange:()=>n.linkVisibilityDistanceRange,linkVisibilityMinTransparency:()=>n.linkVisibilityMinTransparency,linkOpacity:()=>n.linkOpacity,greyoutOpacity:()=>n.linkGreyoutOpacity,scaleLinksOnZoom:()=>n.scaleLinksOnZoom,maxPointSize:()=>r.maxPointSize,curvedWeight:()=>n.curvedLinkWeight,curvedLinkControlPointDistance:()=>n.curvedLinkControlPointDistance,curvedLinkSegments:()=>n.curvedLinks?n.curvedLinkSegments??We.curvedLinkSegments:1},cull:{enable:!0,face:"back"},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1},count:()=>{var i;return((i=this.curveLineGeometry)==null?void 0:i.length)??0},instances:()=>this.data.linksNumber??0,primitive:"triangle strip"}))}draw(){var e;this.pointsBuffer&&(this.colorBuffer||this.updateColor(),this.widthBuffer||this.updateWidth(),this.arrowBuffer||this.updateArrow(),this.curveLineGeometry||this.updateCurveLineGeometry(),(e=this.drawCurveCommand)==null||e.call(this))}updatePointsBuffer(){const{reglInstance:e,data:n,store:r}=this;if(n.linksNumber===void 0||n.links===void 0)return;const i=new Float32Array(n.linksNumber*4);for(let o=0;o<n.linksNumber;o++){const s=n.links[o*2],f=n.links[o*2+1],u=s%r.pointsTextureSize,l=Math.floor(s/r.pointsTextureSize),v=f%r.pointsTextureSize,b=Math.floor(f/r.pointsTextureSize),S=o*4;i[S]=u,i[S+1]=l,i[S+2]=v,i[S+3]=b}this.pointsBuffer||(this.pointsBuffer=e.buffer(0)),this.pointsBuffer(i)}updateColor(){const{reglInstance:e,data:n}=this;this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(n.linkColors??new Float32Array)}updateWidth(){const{reglInstance:e,data:n}=this;this.widthBuffer||(this.widthBuffer=e.buffer(0)),this.widthBuffer(n.linkWidths??new Float32Array)}updateArrow(){const{reglInstance:e,data:n}=this;this.arrowBuffer||(this.arrowBuffer=e.buffer(0)),this.arrowBuffer(n.linkArrows??new Float32Array)}updateCurveLineGeometry(){const{reglInstance:e,config:{curvedLinks:n,curvedLinkSegments:r}}=this;this.curveLineGeometry=av(n?r??We.curvedLinkSegments:1),this.curveLineBuffer||(this.curveLineBuffer=e.buffer(0)),this.curveLineBuffer(this.curveLineGeometry)}}var fv=`#ifdef GL_ES
|
|
862
|
+
}`;function uo(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function R0(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _u(t){let e,n,r;t.length!==2?(e=uo,n=(f,u)=>uo(t(f),u),r=(f,u)=>t(f)-u):(e=t===uo||t===R0?t:I0,n=t,r=t);function i(f,u,l=0,p=f.length){if(l<p){if(e(u,u)!==0)return p;do{const x=l+p>>>1;n(f[x],u)<0?l=x+1:p=x}while(l<p)}return l}function o(f,u,l=0,p=f.length){if(l<p){if(e(u,u)!==0)return p;do{const x=l+p>>>1;n(f[x],u)<=0?l=x+1:p=x}while(l<p)}return l}function s(f,u,l=0,p=f.length){const x=i(f,u,l,p-1);return x>l&&r(f[x-1],u)>-r(f[x],u)?x-1:x}return{left:i,center:s,right:o}}function I0(){return 0}function D0(t){return t===null?NaN:+t}const z0=_u(uo).right;_u(D0).center;function Su(t,e){let n,r;for(const i of t)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));return[n,r]}var ja=Math.sqrt(50),Xa=Math.sqrt(10),Wa=Math.sqrt(2);function O0(t,e,n){var r,i=-1,o,s,f;if(e=+e,t=+t,n=+n,t===e&&n>0)return[t];if((r=e<t)&&(o=t,t=e,e=o),(f=Tu(t,e,n))===0||!isFinite(f))return[];if(f>0){let u=Math.round(t/f),l=Math.round(e/f);for(u*f<t&&++u,l*f>e&&--l,s=new Array(o=l-u+1);++i<o;)s[i]=(u+i)*f}else{f=-f;let u=Math.round(t*f),l=Math.round(e*f);for(u/f<t&&++u,l/f>e&&--l,s=new Array(o=l-u+1);++i<o;)s[i]=(u+i)/f}return r&&s.reverse(),s}function Tu(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=ja?10:o>=Xa?5:o>=Wa?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ja?10:o>=Xa?5:o>=Wa?2:1)}function M0(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=ja?i*=10:o>=Xa?i*=5:o>=Wa&&(i*=2),e<t?-i:i}function N0(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r<i;)o[r]=t+r*n;return o}function wu(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function G0(t){return function(){return t}}function B0(t){return+t}var Au=[0,1];function Sn(t){return t}function qa(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:G0(isNaN(e)?NaN:.5)}function U0(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function V0(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i<r?(r=qa(i,r),o=n(s,o)):(r=qa(r,i),o=n(o,s)),function(f){return o(r(f))}}function $0(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=qa(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(f){var u=z0(t,f,1,r)-1;return o[u](i[u](f))}}function Eu(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Pu(){var t=Au,e=Au,n=Fa,r,i,o,s=Sn,f,u,l;function p(){var S=Math.min(t.length,e.length);return s!==Sn&&(s=U0(t[0],t[S-1])),f=S>2?$0:V0,u=l=null,x}function x(S){return S==null||isNaN(S=+S)?o:(u||(u=f(t.map(r),e,n)))(r(s(S)))}return x.invert=function(S){return s(i((l||(l=f(e,t.map(r),hn)))(S)))},x.domain=function(S){return arguments.length?(t=Array.from(S,B0),p()):t.slice()},x.range=function(S){return arguments.length?(e=Array.from(S),p()):e.slice()},x.rangeRound=function(S){return e=Array.from(S),n=im,p()},x.clamp=function(S){return arguments.length?(s=S?!0:Sn,p()):s!==Sn},x.interpolate=function(S){return arguments.length?(n=S,p()):n},x.unknown=function(S){return arguments.length?(o=S,x):o},function(S,D){return r=S,i=D,p()}}function H0(){return Pu()(Sn,Sn)}function j0(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function lo(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Fr(t){return t=lo(Math.abs(t)),t?t[1]:NaN}function X0(t,e){return function(n,r){for(var i=n.length,o=[],s=0,f=t[0],u=0;i>0&&f>0&&(u+f+1>r&&(f=Math.max(1,r-u)),o.push(n.substring(i-=f,i+f)),!((u+=f+1)>r));)f=t[s=(s+1)%t.length];return o.reverse().join(e)}}function W0(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var q0=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function co(t){if(!(e=q0.exec(t)))throw new Error("invalid format: "+t);var e;return new Ya({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}co.prototype=Ya.prototype;function Ya(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Ya.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Y0(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Cu;function Z0(t,e){var n=lo(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Cu=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+lo(t,Math.max(0,e+o-1))[0]}function ku(t,e){var n=lo(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Lu={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:j0,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ku(t*100,e),r:ku,s:Z0,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Fu(t){return t}var Ru=Array.prototype.map,Iu=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Q0(t){var e=t.grouping===void 0||t.thousands===void 0?Fu:X0(Ru.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?Fu:W0(Ru.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",f=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function l(x){x=co(x);var S=x.fill,D=x.align,Y=x.sign,Ee=x.symbol,Te=x.zero,se=x.width,Ue=x.comma,He=x.precision,H=x.trim,fe=x.type;fe==="n"?(Ue=!0,fe="g"):Lu[fe]||(He===void 0&&(He=12),H=!0,fe="g"),(Te||S==="0"&&D==="=")&&(Te=!0,S="0",D="=");var Re=Ee==="$"?n:Ee==="#"&&/[boxX]/.test(fe)?"0"+fe.toLowerCase():"",Ge=Ee==="$"?r:/[%p]/.test(fe)?s:"",Ye=Lu[fe],at=/[defgprs%]/.test(fe);He=He===void 0?6:/[gprs]/.test(fe)?Math.max(1,Math.min(21,He)):Math.max(0,Math.min(20,He));function ut(Ae){var lt=Re,it=Ge,N,Ce,re;if(fe==="c")it=Ye(Ae)+it,Ae="";else{Ae=+Ae;var ke=Ae<0||1/Ae<0;if(Ae=isNaN(Ae)?u:Ye(Math.abs(Ae),He),H&&(Ae=Y0(Ae)),ke&&+Ae==0&&Y!=="+"&&(ke=!1),lt=(ke?Y==="("?Y:f:Y==="-"||Y==="("?"":Y)+lt,it=(fe==="s"?Iu[8+Cu/3]:"")+it+(ke&&Y==="("?")":""),at){for(N=-1,Ce=Ae.length;++N<Ce;)if(re=Ae.charCodeAt(N),48>re||re>57){it=(re===46?i+Ae.slice(N+1):Ae.slice(N))+it,Ae=Ae.slice(0,N);break}}}Ue&&!Te&&(Ae=e(Ae,1/0));var Xe=lt.length+Ae.length+it.length,je=Xe<se?new Array(se-Xe+1).join(S):"";switch(Ue&&Te&&(Ae=e(je+Ae,je.length?se-it.length:1/0),je=""),D){case"<":Ae=lt+Ae+it+je;break;case"=":Ae=lt+je+Ae+it;break;case"^":Ae=je.slice(0,Xe=je.length>>1)+lt+Ae+it+je.slice(Xe);break;default:Ae=je+lt+Ae+it;break}return o(Ae)}return ut.toString=function(){return x+""},ut}function p(x,S){var D=l((x=co(x),x.type="f",x)),Y=Math.max(-8,Math.min(8,Math.floor(Fr(S)/3)))*3,Ee=Math.pow(10,-Y),Te=Iu[8+Y/3];return function(se){return D(Ee*se)+Te}}return{format:l,formatPrefix:p}}var ho,Du,zu;K0({thousands:",",grouping:[3],currency:["$",""]});function K0(t){return ho=Q0(t),Du=ho.format,zu=ho.formatPrefix,ho}function J0(t){return Math.max(0,-Fr(Math.abs(t)))}function ev(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Fr(e)/3)))*3-Fr(Math.abs(t)))}function tv(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Fr(e)-Fr(t))+1}function nv(t,e,n,r){var i=M0(t,e,n),o;switch(r=co(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=ev(i,s))&&(r.precision=o),zu(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=tv(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=J0(i))&&(r.precision=o-(r.type==="%")*2);break}}return Du(r)}function Ou(t){var e=t.domain;return t.ticks=function(n){var r=e();return O0(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return nv(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],f=r[o],u,l,p=10;for(f<s&&(l=s,s=f,f=l,l=i,i=o,o=l);p-- >0;){if(l=Tu(s,f,n),l===u)return r[i]=s,r[o]=f,e(r);if(l>0)s=Math.floor(s/l)*l,f=Math.ceil(f/l)*l;else if(l<0)s=Math.ceil(s*l)/l,f=Math.floor(f*l)/l;else break;u=l}return t},t}function Za(){var t=H0();return t.copy=function(){return Eu(t,Za())},wu.apply(t,arguments),Ou(t)}function Mu(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function rv(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function iv(t){return t<0?-t*t:t*t}function ov(t){var e=t(Sn,Sn),n=1;function r(){return n===1?t(Sn,Sn):n===.5?t(rv,iv):t(Mu(n),Mu(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Ou(e)}function Nu(){var t=ov(Pu());return t.copy=function(){return Eu(t,Nu()).exponent(t.exponent())},wu.apply(t,arguments),t}const av=t=>{const e=Nu().exponent(2).range([0,1]).domain([-1,1]),n=N0(0,t).map(i=>-.5+i/t);n.push(.5);const r=new Array(n.length*2);return n.forEach((i,o)=>{r[o*2]=[e(i*2),.5],r[o*2+1]=[e(i*2),-.5]}),r};class sv extends In{initPrograms(){const{reglInstance:e,config:n,store:r}=this;this.drawCurveCommand||(this.drawCurveCommand=e({vert:F0,frag:L0,attributes:{position:{buffer:()=>this.curveLineBuffer,divisor:0},pointA:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},pointB:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*2,stride:Float32Array.BYTES_PER_ELEMENT*4},color:{buffer:()=>this.colorBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},width:{buffer:()=>this.widthBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1},arrow:{buffer:()=>this.arrowBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1}},uniforms:{positionsTexture:()=>{var i;return(i=this.points)==null?void 0:i.currentPositionFbo},pointGreyoutStatus:()=>{var i;return(i=this.points)==null?void 0:i.greyoutStatusFbo},transformationMatrix:()=>r.transform,pointsTextureSize:()=>r.pointsTextureSize,widthScale:()=>n.linkWidthScale,arrowSizeScale:()=>n.linkArrowsSizeScale,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,linkVisibilityDistanceRange:()=>n.linkVisibilityDistanceRange,linkVisibilityMinTransparency:()=>n.linkVisibilityMinTransparency,linkOpacity:()=>n.linkOpacity,greyoutOpacity:()=>n.linkGreyoutOpacity,scaleLinksOnZoom:()=>n.scaleLinksOnZoom,maxPointSize:()=>r.maxPointSize,curvedWeight:()=>n.curvedLinkWeight,curvedLinkControlPointDistance:()=>n.curvedLinkControlPointDistance,curvedLinkSegments:()=>n.curvedLinks?n.curvedLinkSegments??We.curvedLinkSegments:1},cull:{enable:!0,face:"back"},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1},count:()=>{var i;return((i=this.curveLineGeometry)==null?void 0:i.length)??0},instances:()=>this.data.linksNumber??0,primitive:"triangle strip"}))}draw(){var e;this.pointsBuffer&&(this.colorBuffer||this.updateColor(),this.widthBuffer||this.updateWidth(),this.arrowBuffer||this.updateArrow(),this.curveLineGeometry||this.updateCurveLineGeometry(),(e=this.drawCurveCommand)==null||e.call(this))}updatePointsBuffer(){const{reglInstance:e,data:n,store:r}=this;if(n.linksNumber===void 0||n.links===void 0)return;const i=new Float32Array(n.linksNumber*4);for(let o=0;o<n.linksNumber;o++){const s=n.links[o*2],f=n.links[o*2+1],u=s%r.pointsTextureSize,l=Math.floor(s/r.pointsTextureSize),p=f%r.pointsTextureSize,x=Math.floor(f/r.pointsTextureSize),S=o*4;i[S]=u,i[S+1]=l,i[S+2]=p,i[S+3]=x}this.pointsBuffer||(this.pointsBuffer=e.buffer(0)),this.pointsBuffer(i)}updateColor(){const{reglInstance:e,data:n}=this;this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(n.linkColors??new Float32Array)}updateWidth(){const{reglInstance:e,data:n}=this;this.widthBuffer||(this.widthBuffer=e.buffer(0)),this.widthBuffer(n.linkWidths??new Float32Array)}updateArrow(){const{reglInstance:e,data:n}=this;this.arrowBuffer||(this.arrowBuffer=e.buffer(0)),this.arrowBuffer(n.linkArrows??new Float32Array)}updateCurveLineGeometry(){const{reglInstance:e,config:{curvedLinks:n,curvedLinkSegments:r}}=this;this.curveLineGeometry=av(n?r??We.curvedLinkSegments:1),this.curveLineBuffer||(this.curveLineBuffer=e.buffer(0)),this.curveLineBuffer(this.curveLineGeometry)}}var fv=`#ifdef GL_ES
|
|
858
863
|
precision highp float;
|
|
859
864
|
#endif
|
|
860
865
|
|
|
@@ -898,6 +903,8 @@ uniform vec4 backgroundColor;
|
|
|
898
903
|
uniform bool scalePointsOnZoom;
|
|
899
904
|
uniform float maxPointSize;
|
|
900
905
|
uniform bool darkenGreyout;
|
|
906
|
+
uniform bool renderOnlySelected;
|
|
907
|
+
uniform bool renderOnlyUnselected;
|
|
901
908
|
|
|
902
909
|
varying vec2 textureCoords;
|
|
903
910
|
varying vec3 rgbColor;
|
|
@@ -917,6 +924,23 @@ float calculatePointSize(float size) {
|
|
|
917
924
|
void main() {
|
|
918
925
|
textureCoords = pointIndices;
|
|
919
926
|
|
|
927
|
+
|
|
928
|
+
vec4 greyoutStatus = texture2D(pointGreyoutStatus, (textureCoords + 0.5) / pointsTextureSize);
|
|
929
|
+
bool isSelected = greyoutStatus.r == 0.0;
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
if (renderOnlySelected && !isSelected) {
|
|
933
|
+
gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
|
|
934
|
+
gl_PointSize = 0.0;
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
if (renderOnlyUnselected && isSelected) {
|
|
938
|
+
gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
|
|
939
|
+
gl_PointSize = 0.0;
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
|
|
920
944
|
vec4 pointPosition = texture2D(positionsTexture, (textureCoords + 0.5) / pointsTextureSize);
|
|
921
945
|
vec2 point = pointPosition.rg;
|
|
922
946
|
|
|
@@ -932,7 +956,6 @@ void main() {
|
|
|
932
956
|
alpha = color.a * pointOpacity;
|
|
933
957
|
|
|
934
958
|
|
|
935
|
-
vec4 greyoutStatus = texture2D(pointGreyoutStatus, (textureCoords + 0.5) / pointsTextureSize);
|
|
936
959
|
if (greyoutStatus.r > 0.0) {
|
|
937
960
|
if (greyoutColor[0] != -1.0) {
|
|
938
961
|
rgbColor = greyoutColor.rgb;
|
|
@@ -1320,7 +1343,7 @@ void main() {
|
|
|
1320
1343
|
}
|
|
1321
1344
|
|
|
1322
1345
|
gl_FragColor = pointPosition;
|
|
1323
|
-
}`;class _v extends In{constructor(){super(...arguments),this.polygonPathLength=0}updatePositions(){const{reglInstance:e,store:n,data:r,config:{rescalePositions:i,enableSimulation:o}}=this,{pointsTextureSize:s}=n;if(!s||!r.pointPositions||r.pointsNumber===void 0)return;const f=new Float32Array(s*s*4);let u=i;i===void 0&&!o&&(u=!0),this.dontRescale&&(u=!1),u?this.rescaleInitialNodePositions():this.dontRescale||(this.scaleX=void 0,this.scaleY=void 0),this.dontRescale=void 0;for(let l=0;l<r.pointsNumber;++l)f[l*4+0]=r.pointPositions[l*2+0],f[l*4+1]=r.pointPositions[l*2+1],f[l*4+2]=l;this.currentPositionFbo||(this.currentPositionFbo=e.framebuffer()),this.currentPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.previousPositionFbo||(this.previousPositionFbo=e.framebuffer()),this.previousPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.config.enableSimulation&&(this.velocityFbo||(this.velocityFbo=e.framebuffer()),this.velocityFbo({color:e.texture({data:new Float32Array(s*s*4).fill(0),shape:[s,s,4],type:"float"}),depth:!1,stencil:!1})),this.selectedTexture||(this.selectedTexture=e.texture()),this.selectedTexture({data:f,shape:[s,s,4],type:"float"}),this.selectedFbo||(this.selectedFbo=e.framebuffer()),this.selectedFbo({color:this.selectedTexture,depth:!1,stencil:!1}),this.hoveredFbo||(this.hoveredFbo=e.framebuffer()),this.hoveredFbo({shape:[2,2],colorType:"float",depth:!1,stencil:!1}),this.drawPointIndices||(this.drawPointIndices=e.buffer(0)),this.drawPointIndices(or(n.pointsTextureSize)),this.hoveredPointIndices||(this.hoveredPointIndices=e.buffer(0)),this.hoveredPointIndices(or(n.pointsTextureSize)),this.sampledPointIndices||(this.sampledPointIndices=e.buffer(0)),this.sampledPointIndices(or(n.pointsTextureSize)),this.updateGreyoutStatus(),this.updateSampledPointsGrid(),this.trackPointsByIndices()}initPrograms(){const{reglInstance:e,config:n,store:r,data:i}=this;n.enableSimulation&&(this.updatePositionCommand||(this.updatePositionCommand=e({frag:yv,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,velocity:()=>this.velocityFbo,friction:()=>n.simulationFriction,spaceSize:()=>r.adjustedSpaceSize}}))),this.dragPointCommand||(this.dragPointCommand=e({frag:bv,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,mousePos:()=>r.mousePosition,index:()=>{var o;return((o=r.hoveredPoint)==null?void 0:o.index)??-1}}})),this.drawCommand||(this.drawCommand=e({frag:fv,vert:uv,primitive:"points",count:()=>i.pointsNumber??0,attributes:{pointIndices:{buffer:this.drawPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1},color:{buffer:()=>this.colorBuffer,size:4}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointGreyoutStatus:()=>this.greyoutStatusFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,pointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,greyoutColor:()=>r.greyoutPointColor,backgroundColor:()=>r.backgroundColor,darkenGreyout:()=>r.darkenGreyout,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>r.maxPointSize},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.findPointsOnAreaSelectionCommand||(this.findPointsOnAreaSelectionCommand=e({frag:lv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointSize:()=>this.sizeFbo,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,sizeScale:()=>n.pointSizeScale,transformationMatrix:()=>r.transform,ratio:()=>n.pixelRatio,"selection[0]":()=>r.selectedArea[0],"selection[1]":()=>r.selectedArea[1],scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>r.maxPointSize}})),this.findPointsOnPolygonSelectionCommand||(this.findPointsOnPolygonSelectionCommand=e({frag:cv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,transformationMatrix:()=>r.transform,polygonPathTexture:()=>this.polygonPathTexture,polygonPathLength:()=>this.polygonPathLength}})),this.clearHoveredFboCommand||(this.clearHoveredFboCommand=e({frag:ar,vert:kt,framebuffer:this.hoveredFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.findHoveredPointCommand||(this.findHoveredPointCommand=e({frag:mv,vert:pv,primitive:"points",count:()=>i.pointsNumber??0,framebuffer:()=>this.hoveredFbo,attributes:{pointIndices:{buffer:this.hoveredPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1}},uniforms:{positionsTexture:()=>this.currentPositionFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,mousePosition:()=>r.screenMousePosition,maxPointSize:()=>r.maxPointSize},depth:{enable:!1,mask:!1}})),this.clearSampledPointsFboCommand||(this.clearSampledPointsFboCommand=e({frag:ar,vert:kt,framebuffer:()=>this.sampledPointsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.fillSampledPointsFboCommand||(this.fillSampledPointsFboCommand=e({frag:vv,vert:gv,primitive:"points",count:()=>i.pointsNumber??0,framebuffer:()=>this.sampledPointsFbo,attributes:{pointIndices:{buffer:this.sampledPointIndices,size:2}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize},depth:{enable:!1,mask:!1}})),this.drawHighlightedCommand||(this.drawHighlightedCommand=e({frag:hv,vert:dv,attributes:{vertexCoord:wt(e)},primitive:"triangle strip",count:4,uniforms:{color:e.prop("color"),width:e.prop("width"),pointIndex:e.prop("pointIndex"),size:e.prop("size"),positionsTexture:()=>this.currentPositionFbo,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>r.maxPointSize,pointGreyoutStatusTexture:()=>this.greyoutStatusFbo,universalPointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,darkenGreyout:()=>r.darkenGreyout,backgroundColor:()=>r.backgroundColor,greyoutColor:()=>r.greyoutPointColor},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.trackPointsCommand||(this.trackPointsCommand=e({frag:xv,vert:kt,framebuffer:()=>this.trackedPositionsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,trackedIndices:()=>this.trackedIndicesFbo,pointsTextureSize:()=>r.pointsTextureSize}}))}updateColor(){const{reglInstance:e,store:{pointsTextureSize:n},data:r}=this;n&&(this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(r.pointColors))}updateGreyoutStatus(){const{reglInstance:e,store:{selectedIndices:n,pointsTextureSize:r}}=this;if(!r)return;const i=new Float32Array(r*r*4).fill(n?1:0);if(n)for(const o of n)i[o*4]=0;this.greyoutStatusTexture||(this.greyoutStatusTexture=e.texture()),this.greyoutStatusTexture({data:i,width:r,height:r,type:"float"}),this.greyoutStatusFbo||(this.greyoutStatusFbo=e.framebuffer()),this.greyoutStatusFbo({color:this.greyoutStatusTexture,depth:!1,stencil:!1})}updateSize(){const{reglInstance:e,store:{pointsTextureSize:n},data:r}=this;if(!n||r.pointsNumber===void 0||r.pointSizes===void 0)return;this.sizeBuffer||(this.sizeBuffer=e.buffer(0)),this.sizeBuffer(r.pointSizes);const i=new Float32Array(n*n*4);for(let o=0;o<r.pointsNumber;o++)i[o*4]=r.pointSizes[o];this.sizeTexture||(this.sizeTexture=e.texture()),this.sizeTexture({data:i,width:n,height:n,type:"float"}),this.sizeFbo||(this.sizeFbo=e.framebuffer()),this.sizeFbo({color:this.sizeTexture,depth:!1,stencil:!1})}updateSampledPointsGrid(){const{store:{screenSize:e},config:{pointSamplingDistance:n},reglInstance:r}=this;let i=n??Math.min(...e)/2;i===0&&(i=We.pointSamplingDistance);const o=Math.ceil(e[0]/i),s=Math.ceil(e[1]/i);this.sampledPointsFbo||(this.sampledPointsFbo=r.framebuffer()),this.sampledPointsFbo({shape:[o,s],depth:!1,stencil:!1,colorType:"float"})}trackPoints(){var e,n;(e=this.trackedIndices)!=null&&e.length&&((n=this.trackPointsCommand)==null||n.call(this))}draw(){var o,s,f,u,l;const{config:{renderHoveredPointRing:e,pointSize:n},store:r,data:i}=this;this.colorBuffer||this.updateColor(),this.sizeBuffer||this.updateSize(),(o=this.drawCommand)==null||o.call(this),e&&r.hoveredPoint&&((f=this.drawHighlightedCommand)==null||f.call(this,{width:.85,color:r.hoveredPointRingColor,pointIndex:r.hoveredPoint.index,size:((s=i.pointSizes)==null?void 0:s[r.hoveredPoint.index])??n})),r.focusedPoint&&((l=this.drawHighlightedCommand)==null||l.call(this,{width:.75,color:r.focusedPointRingColor,pointIndex:r.focusedPoint.index,size:((u=i.pointSizes)==null?void 0:u[r.focusedPoint.index])??n}))}updatePosition(){var e;(e=this.updatePositionCommand)==null||e.call(this),this.swapFbo()}drag(){var e;(e=this.dragPointCommand)==null||e.call(this),this.swapFbo()}findPointsOnAreaSelection(){var e;(e=this.findPointsOnAreaSelectionCommand)==null||e.call(this)}findPointsOnPolygonSelection(){var e;(e=this.findPointsOnPolygonSelectionCommand)==null||e.call(this)}updatePolygonPath(e){const{reglInstance:n}=this;if(this.polygonPathLength=e.length,e.length===0){this.polygonPathTexture=void 0,this.polygonPathFbo=void 0;return}const r=Math.ceil(Math.sqrt(e.length)),i=new Float32Array(r*r*4);for(const[o,s]of e.entries()){const[f,u]=s;i[o*4]=f,i[o*4+1]=u,i[o*4+2]=0,i[o*4+3]=0}this.polygonPathTexture||(this.polygonPathTexture=n.texture()),this.polygonPathTexture({data:i,width:r,height:r,type:"float"}),this.polygonPathFbo||(this.polygonPathFbo=n.framebuffer()),this.polygonPathFbo({color:this.polygonPathTexture,depth:!1,stencil:!1})}findHoveredPoint(){var e,n;(e=this.clearHoveredFboCommand)==null||e.call(this),(n=this.findHoveredPointCommand)==null||n.call(this)}trackPointsByIndices(e){const{store:{pointsTextureSize:n},reglInstance:r}=this;if(this.trackedIndices=e,!(e!=null&&e.length))return;const i=Math.ceil(Math.sqrt(e.length)),o=new Float32Array(i*i*4).fill(-1);for(const[s,f]of e.entries())f!==void 0&&(o[s*4]=f%n,o[s*4+1]=Math.floor(f/n),o[s*4+2]=0,o[s*4+3]=0);this.trackedIndicesTexture||(this.trackedIndicesTexture=r.texture()),this.trackedIndicesTexture({data:o,width:i,height:i,type:"float"}),this.trackedIndicesFbo||(this.trackedIndicesFbo=r.framebuffer()),this.trackedIndicesFbo({color:this.trackedIndicesTexture,depth:!1,stencil:!1}),this.trackedPositionsFbo||(this.trackedPositionsFbo=r.framebuffer()),this.trackedPositionsFbo({shape:[i,i],depth:!1,stencil:!1,colorType:"float"}),this.trackPoints()}getTrackedPositionsMap(){const e=new Map;if(!this.trackedIndices)return e;const n=tn(this.reglInstance,this.trackedPositionsFbo);for(let r=0;r<n.length/4;r+=1){const i=n[r*4],o=n[r*4+1],s=this.trackedIndices[r];i!==void 0&&o!==void 0&&s!==void 0&&e.set(s,[i,o])}return e}getSampledPointPositionsMap(){var r,i;const e=new Map;if(!this.sampledPointsFbo)return e;(r=this.clearSampledPointsFboCommand)==null||r.call(this),(i=this.fillSampledPointsFboCommand)==null||i.call(this);const n=tn(this.reglInstance,this.sampledPointsFbo);for(let o=0;o<n.length/4;o++){const s=n[o*4],f=!!n[o*4+1],u=n[o*4+2],l=n[o*4+3];f&&s!==void 0&&u!==void 0&&l!==void 0&&e.set(s,[u,l])}return e}getSampledPoints(){var i,o;const e=[],n=[];if(!this.sampledPointsFbo)return{indices:e,positions:n};(i=this.clearSampledPointsFboCommand)==null||i.call(this),(o=this.fillSampledPointsFboCommand)==null||o.call(this);const r=tn(this.reglInstance,this.sampledPointsFbo);for(let s=0;s<r.length/4;s++){const f=r[s*4],u=!!r[s*4+1],l=r[s*4+2],v=r[s*4+3];u&&f!==void 0&&l!==void 0&&v!==void 0&&(e.push(f),n.push(l,v))}return{indices:e,positions:n}}getTrackedPositionsArray(){const e=[];if(!this.trackedIndices)return e;e.length=this.trackedIndices.length*2;const n=tn(this.reglInstance,this.trackedPositionsFbo);for(let r=0;r<n.length/4;r+=1){const i=n[r*4],o=n[r*4+1],s=this.trackedIndices[r];i!==void 0&&o!==void 0&&s!==void 0&&(e[r*2]=i,e[r*2+1]=o)}return e}swapFbo(){const e=this.previousPositionFbo;this.previousPositionFbo=this.currentPositionFbo,this.currentPositionFbo=e}rescaleInitialNodePositions(){const{config:{spaceSize:e}}=this;if(!this.data.pointPositions||!e)return;const n=this.data.pointPositions,r=n.length/2;let i=1/0,o=-1/0,s=1/0,f=-1/0;for(let Te=0;Te<n.length;Te+=2){const se=n[Te],Ue=n[Te+1];i=Math.min(i,se),o=Math.max(o,se),s=Math.min(s,Ue),f=Math.max(f,Ue)}const u=o-i,l=f-s,v=Math.max(u,l);if(v>e){this.scaleX=void 0,this.scaleY=void 0;return}const b=e*e*.001,D=(r>b?e*Math.max(1.2,Math.sqrt(r)/e):e*.1)/v,Y=(v-u)/2*D,Ee=(v-l)/2*D;this.scaleX=Te=>(Te-i)*D+Y,this.scaleY=Te=>(Te-s)*D+Ee;for(let Te=0;Te<r;Te++)this.data.pointPositions[Te*2]=this.scaleX(n[Te*2]),this.data.pointPositions[Te*2+1]=this.scaleY(n[Te*2+1])}}var Gu=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Sv(){var t=new Gu(9);return Gu!=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 Bu(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],f=e[4],u=e[5],l=e[6],v=e[7],b=e[8],S=n[0],D=n[1];return t[0]=r,t[1]=i,t[2]=o,t[3]=s,t[4]=f,t[5]=u,t[6]=S*r+D*s+l,t[7]=S*i+D*f+v,t[8]=S*o+D*u+b,t}function Qa(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Tv(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var mo={exports:{}},wv=mo.exports,Uu;function Av(){return Uu||(Uu=1,function(t){(function(e,n,r){function i(u){var l=this,v=f();l.next=function(){var b=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=b-(l.c=b|0)},l.c=1,l.s0=v(" "),l.s1=v(" "),l.s2=v(" "),l.s0-=v(u),l.s0<0&&(l.s0+=1),l.s1-=v(u),l.s1<0&&(l.s1+=1),l.s2-=v(u),l.s2<0&&(l.s2+=1),v=null}function o(u,l){return l.c=u.c,l.s0=u.s0,l.s1=u.s1,l.s2=u.s2,l}function s(u,l){var v=new i(u),b=l&&l.state,S=v.next;return S.int32=function(){return v.next()*4294967296|0},S.double=function(){return S()+(S()*2097152|0)*11102230246251565e-32},S.quick=S,b&&(typeof b=="object"&&o(b,v),S.state=function(){return o(v,{})}),S}function f(){var u=4022871197,l=function(v){v=String(v);for(var b=0;b<v.length;b++){u+=v.charCodeAt(b);var S=.02519603282416938*u;u=S>>>0,S-=u,S*=u,u=S>>>0,S-=u,u+=S*4294967296}return(u>>>0)*23283064365386963e-26};return l}n&&n.exports?n.exports=s:this.alea=s})(wv,t)}(mo)),mo.exports}var po={exports:{}},Ev=po.exports,Vu;function Pv(){return Vu||(Vu=1,function(t){(function(e,n,r){function i(f){var u=this,l="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var b=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^b^b>>>8},f===(f|0)?u.x=f:l+=f;for(var v=0;v<l.length+64;v++)u.x^=l.charCodeAt(v)|0,u.next()}function o(f,u){return u.x=f.x,u.y=f.y,u.z=f.z,u.w=f.w,u}function s(f,u){var l=new i(f),v=u&&u.state,b=function(){return(l.next()>>>0)/4294967296};return b.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},b.int32=l.next,b.quick=b,v&&(typeof v=="object"&&o(v,l),b.state=function(){return o(l,{})}),b}n&&n.exports?n.exports=s:this.xor128=s})(Ev,t)}(po)),po.exports}var vo={exports:{}},Cv=vo.exports,$u;function kv(){return $u||($u=1,function(t){(function(e,n,r){function i(f){var u=this,l="";u.next=function(){var b=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(b^b<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,f===(f|0)?u.x=f:l+=f;for(var v=0;v<l.length+64;v++)u.x^=l.charCodeAt(v)|0,v==l.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function o(f,u){return u.x=f.x,u.y=f.y,u.z=f.z,u.w=f.w,u.v=f.v,u.d=f.d,u}function s(f,u){var l=new i(f),v=u&&u.state,b=function(){return(l.next()>>>0)/4294967296};return b.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},b.int32=l.next,b.quick=b,v&&(typeof v=="object"&&o(v,l),b.state=function(){return o(l,{})}),b}n&&n.exports?n.exports=s:this.xorwow=s})(Cv,t)}(vo)),vo.exports}var go={exports:{}},Lv=go.exports,Hu;function Fv(){return Hu||(Hu=1,function(t){(function(e,n,r){function i(f){var u=this;u.next=function(){var v=u.x,b=u.i,S,D;return S=v[b],S^=S>>>7,D=S^S<<24,S=v[b+1&7],D^=S^S>>>10,S=v[b+3&7],D^=S^S>>>3,S=v[b+4&7],D^=S^S<<7,S=v[b+7&7],S=S^S<<13,D^=S^S<<9,v[b]=D,u.i=b+1&7,D};function l(v,b){var S,D=[];if(b===(b|0))D[0]=b;else for(b=""+b,S=0;S<b.length;++S)D[S&7]=D[S&7]<<15^b.charCodeAt(S)+D[S+1&7]<<13;for(;D.length<8;)D.push(0);for(S=0;S<8&&D[S]===0;++S);for(S==8?D[7]=-1:D[S],v.x=D,v.i=0,S=256;S>0;--S)v.next()}l(u,f)}function o(f,u){return u.x=f.x.slice(),u.i=f.i,u}function s(f,u){f==null&&(f=+new Date);var l=new i(f),v=u&&u.state,b=function(){return(l.next()>>>0)/4294967296};return b.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},b.int32=l.next,b.quick=b,v&&(v.x&&o(v,l),b.state=function(){return o(l,{})}),b}n&&n.exports?n.exports=s:this.xorshift7=s})(Lv,t)}(go)),go.exports}var yo={exports:{}},Rv=yo.exports,ju;function Iv(){return ju||(ju=1,function(t){(function(e,n,r){function i(f){var u=this;u.next=function(){var v=u.w,b=u.X,S=u.i,D,Y;return u.w=v=v+1640531527|0,Y=b[S+34&127],D=b[S=S+1&127],Y^=Y<<13,D^=D<<17,Y^=Y>>>15,D^=D>>>12,Y=b[S]=Y^D,u.i=S,Y+(v^v>>>16)|0};function l(v,b){var S,D,Y,Ee,Te,se=[],Ue=128;for(b===(b|0)?(D=b,b=null):(b=b+"\0",D=0,Ue=Math.max(Ue,b.length)),Y=0,Ee=-32;Ee<Ue;++Ee)b&&(D^=b.charCodeAt((Ee+32)%b.length)),Ee===0&&(Te=D),D^=D<<10,D^=D>>>15,D^=D<<4,D^=D>>>13,Ee>=0&&(Te=Te+1640531527|0,S=se[Ee&127]^=D+Te,Y=S==0?Y+1:0);for(Y>=128&&(se[(b&&b.length||0)&127]=-1),Y=127,Ee=4*128;Ee>0;--Ee)D=se[Y+34&127],S=se[Y=Y+1&127],D^=D<<13,S^=S<<17,D^=D>>>15,S^=S>>>12,se[Y]=D^S;v.w=Te,v.X=se,v.i=Y}l(u,f)}function o(f,u){return u.i=f.i,u.w=f.w,u.X=f.X.slice(),u}function s(f,u){f==null&&(f=+new Date);var l=new i(f),v=u&&u.state,b=function(){return(l.next()>>>0)/4294967296};return b.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},b.int32=l.next,b.quick=b,v&&(v.X&&o(v,l),b.state=function(){return o(l,{})}),b}n&&n.exports?n.exports=s:this.xor4096=s})(Rv,t)}(yo)),yo.exports}var xo={exports:{}},Dv=xo.exports,Xu;function zv(){return Xu||(Xu=1,function(t){(function(e,n,r){function i(f){var u=this,l="";u.next=function(){var b=u.b,S=u.c,D=u.d,Y=u.a;return b=b<<25^b>>>7^S,S=S-D|0,D=D<<24^D>>>8^Y,Y=Y-b|0,u.b=b=b<<20^b>>>12^S,u.c=S=S-D|0,u.d=D<<16^S>>>16^Y,u.a=Y-b|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,f===Math.floor(f)?(u.a=f/4294967296|0,u.b=f|0):l+=f;for(var v=0;v<l.length+20;v++)u.b^=l.charCodeAt(v)|0,u.next()}function o(f,u){return u.a=f.a,u.b=f.b,u.c=f.c,u.d=f.d,u}function s(f,u){var l=new i(f),v=u&&u.state,b=function(){return(l.next()>>>0)/4294967296};return b.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},b.int32=l.next,b.quick=b,v&&(typeof v=="object"&&o(v,l),b.state=function(){return o(l,{})}),b}n&&n.exports?n.exports=s:this.tychei=s})(Dv,t)}(xo)),xo.exports}var bo={exports:{}};const Ov=xp(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Mv=bo.exports,Wu;function Nv(){return Wu||(Wu=1,function(t){(function(e,n,r){var i=256,o=6,s=52,f="random",u=r.pow(i,o),l=r.pow(2,s),v=l*2,b=i-1,S;function D(H,fe,Re){var Ge=[];fe=fe==!0?{entropy:!0}:fe||{};var Ye=se(Te(fe.entropy?[H,He(n)]:H??Ue(),3),Ge),at=new Y(Ge),ut=function(){for(var Ae=at.g(o),lt=u,it=0;Ae<l;)Ae=(Ae+it)*i,lt*=i,it=at.g(1);for(;Ae>=v;)Ae/=2,lt/=2,it>>>=1;return(Ae+it)/lt};return ut.int32=function(){return at.g(4)|0},ut.quick=function(){return at.g(4)/4294967296},ut.double=ut,se(He(at.S),n),(fe.pass||Re||function(Ae,lt,it,N){return N&&(N.S&&Ee(N,at),Ae.state=function(){return Ee(at,{})}),it?(r[f]=Ae,lt):Ae})(ut,Ye,"global"in fe?fe.global:this==r,fe.state)}function Y(H){var fe,Re=H.length,Ge=this,Ye=0,at=Ge.i=Ge.j=0,ut=Ge.S=[];for(Re||(H=[Re++]);Ye<i;)ut[Ye]=Ye++;for(Ye=0;Ye<i;Ye++)ut[Ye]=ut[at=b&at+H[Ye%Re]+(fe=ut[Ye])],ut[at]=fe;(Ge.g=function(Ae){for(var lt,it=0,N=Ge.i,Ce=Ge.j,re=Ge.S;Ae--;)lt=re[N=b&N+1],it=it*i+re[b&(re[N]=re[Ce=b&Ce+lt])+(re[Ce]=lt)];return Ge.i=N,Ge.j=Ce,it})(i)}function Ee(H,fe){return fe.i=H.i,fe.j=H.j,fe.S=H.S.slice(),fe}function Te(H,fe){var Re=[],Ge=typeof H,Ye;if(fe&&Ge=="object")for(Ye in H)try{Re.push(Te(H[Ye],fe-1))}catch{}return Re.length?Re:Ge=="string"?H:H+"\0"}function se(H,fe){for(var Re=H+"",Ge,Ye=0;Ye<Re.length;)fe[b&Ye]=b&(Ge^=fe[b&Ye]*19)+Re.charCodeAt(Ye++);return He(fe)}function Ue(){try{var H;return S&&(H=S.randomBytes)?H=H(i):(H=new Uint8Array(i),(e.crypto||e.msCrypto).getRandomValues(H)),He(H)}catch{var fe=e.navigator,Re=fe&&fe.plugins;return[+new Date,e,Re,e.screen,He(n)]}}function He(H){return String.fromCharCode.apply(0,H)}if(se(r.random(),n),t.exports){t.exports=D;try{S=Ov}catch{}}else r["seed"+f]=D})(typeof self<"u"?self:Mv,[],Math)}(bo)),bo.exports}var Ka,qu;function Gv(){if(qu)return Ka;qu=1;var t=Av(),e=Pv(),n=kv(),r=Fv(),i=Iv(),o=zv(),s=Nv();return s.alea=t,s.xor128=e,s.xorwow=n,s.xorshift7=r,s.xor4096=i,s.tychei=o,Ka=s,Ka}var Bv=Gv();const Uv=Da(Bv);function Vv(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,Hv(r.key),r)}}function Ja(t,e,n){return e&&Vv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yu(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,es(t,e)}function es(t,e){return es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},es(t,e)}function $v(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Hv(t){var e=$v(t,"string");return typeof e=="symbol"?e:String(e)}var _o=function(){function t(){}var e=t.prototype;return e._seed=function(r,i){if(r===(r||0))return r;for(var o=""+r,s=0,f=0;f<o.length;++f)s^=o.charCodeAt(f)|0;return s},t}(),Zu=function(t){Yu(e,t);function e(r,i){var o;return o=t.call(this)||this,o._rng=void 0,o.seed(r,i),o}var n=e.prototype;return n.next=function(){return this._rng()},n.seed=function(i,o){this._rng=i},n.clone=function(i,o){return new e(this._rng,o)},Ja(e,[{key:"name",get:function(){return"function"}}]),e}(_o),Qu=function(){var t=[].slice.call(arguments),e=t,n=e[0],r=n===void 0?"default":n;switch(typeof r){case"object":if(r instanceof _o)return r;break;case"function":return new Zu(r);case"number":case"string":default:return new Zu(Uv.apply(void 0,t))}throw new Error('invalid RNG "'+r+'"')},jv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){return t.next()*(n-e)+e}};function pn(t){return new Xv(t)}var Xv=function(e){var n=this;this.n=void 0,this.isInt=function(){if(Number.isInteger(n.n))return n;throw new Error("Expected number to be an integer, got "+n.n)},this.isPositive=function(){if(n.n>0)return n;throw new Error("Expected number to be positive, got "+n.n)},this.lessThan=function(r){if(n.n<r)return n;throw new Error("Expected number to be less than "+r+", got "+n.n)},this.greaterThanOrEqual=function(r){if(n.n>=r)return n;throw new Error("Expected number to be greater than or equal to "+r+", got "+n.n)},this.greaterThan=function(r){if(n.n>r)return n;throw new Error("Expected number to be greater than "+r+", got "+n.n)},this.n=e},Wv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),n===void 0&&(n=e===void 0?1:e,e=0),pn(e).isInt(),pn(n).isInt(),function(){return Math.floor(t.next()*(n-e+1)+e)}},qv=function(t){return function(){return t.next()>=.5}},Yv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){var r,i,o;do r=t.next()*2-1,i=t.next()*2-1,o=r*r+i*i;while(!o||o>1);return e+n*i*Math.sqrt(-2*Math.log(o)/o)}},Zv=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=1);var r=t.normal(e,n);return function(){return Math.exp(r())}},Qv=function(t,e){return e===void 0&&(e=.5),pn(e).greaterThanOrEqual(0).lessThan(1),function(){return Math.floor(t.next()+e)}},Kv=function(t,e,n){return e===void 0&&(e=1),n===void 0&&(n=.5),pn(e).isInt().isPositive(),pn(n).greaterThanOrEqual(0).lessThan(1),function(){for(var r=0,i=0;r++<e;)t.next()<n&&i++;return i}},Jv=function(t,e){e===void 0&&(e=.5),pn(e).greaterThan(0).lessThan(1);var n=1/Math.log(1-e);return function(){return Math.floor(1+Math.log(t.next())*n)}},eg=[0,0,.6931471805599453,1.791759469228055,3.1780538303479458,4.787491742782046,6.579251212010101,8.525161361065415,10.60460290274525,12.801827480081469],tg=function(e){return eg[e]},ng=.9189385332046727,rg=function(t,e){if(e===void 0&&(e=1),pn(e).isPositive(),e<10){var n=Math.exp(-e);return function(){for(var u=n,l=0,v=t.next();v>u;)v=v-u,u=e*u/++l;return l}}else{var r=Math.sqrt(e),i=.931+2.53*r,o=-.059+.02483*i,s=1.1239+1.1328/(i-3.4),f=.9277-3.6224/(i-2);return function(){for(;;){var u=void 0,l=t.next();if(l<=.86*f)return u=l/f-.43,Math.floor((2*o/(.5-Math.abs(u))+i)*u+e+.445);l>=f?u=t.next()-.5:(u=l/f-.93,u=(u<0?-.5:.5)-u,l=t.next()*f);var v=.5-Math.abs(u);if(!(v<.013&&l>v)){var b=Math.floor((2*o/v+i)*u+e+.445);if(l=l*s/(o/(v*v)+i),b>=10){var S=(b+.5)*Math.log(e/b)-e-ng+b-(.08333333333333333-(.002777777777777778-1/(1260*b*b))/(b*b))/b;if(Math.log(l*r)<=S)return b}else if(b>=0){var D,Y=(D=tg(b))!=null?D:0;if(Math.log(l)<=b*Math.log(e)-e-Y)return b}}}}}},ig=function(t,e){return e===void 0&&(e=1),pn(e).isPositive(),function(){return-Math.log(1-t.next())/e}},og=function(t,e){return e===void 0&&(e=1),pn(e).isInt().greaterThanOrEqual(0),function(){for(var n=0,r=0;r<e;++r)n+=t.next();return n}},ag=function(t,e){e===void 0&&(e=1),pn(e).isInt().isPositive();var n=t.irwinHall(e);return function(){return n()/e}},sg=function(t,e){e===void 0&&(e=1),pn(e).greaterThanOrEqual(0);var n=1/e;return function(){return 1/Math.pow(1-t.next(),n)}},fg=function(t){Yu(e,t);function e(){return t.apply(this,arguments)||this}var n=e.prototype;return n.next=function(){return Math.random()},n.seed=function(i,o){},n.clone=function(){return new e},Ja(e,[{key:"name",get:function(){return"default"}}]),e}(_o),Ku=function(){function t(n){var r=this;this._rng=void 0,this._patch=void 0,this._cache={},this.next=function(){return r._rng.next()},this.float=function(i,o){return r.uniform(i,o)()},this.int=function(i,o){return r.uniformInt(i,o)()},this.integer=function(i,o){return r.uniformInt(i,o)()},this.bool=function(){return r.uniformBoolean()()},this.boolean=function(){return r.uniformBoolean()()},this.uniform=function(i,o){return r._memoize("uniform",jv,i,o)},this.uniformInt=function(i,o){return r._memoize("uniformInt",Wv,i,o)},this.uniformBoolean=function(){return r._memoize("uniformBoolean",qv)},this.normal=function(i,o){return Yv(r,i,o)},this.logNormal=function(i,o){return Zv(r,i,o)},this.bernoulli=function(i){return Qv(r,i)},this.binomial=function(i,o){return Kv(r,i,o)},this.geometric=function(i){return Jv(r,i)},this.poisson=function(i){return rg(r,i)},this.exponential=function(i){return ig(r,i)},this.irwinHall=function(i){return og(r,i)},this.bates=function(i){return ag(r,i)},this.pareto=function(i){return sg(r,i)},n&&n instanceof _o?this.use(n):this.use(new fg),this._cache={}}var e=t.prototype;return e.clone=function(){var r=[].slice.call(arguments);return r.length?new t(Qu.apply(void 0,r)):new t(this.rng.clone())},e.use=function(){this._rng=Qu.apply(void 0,[].slice.call(arguments))},e.patch=function(){if(this._patch)throw new Error("Math.random already patched");this._patch=Math.random,Math.random=this.uniform()},e.unpatch=function(){this._patch&&(Math.random=this._patch,delete this._patch)},e.choice=function(r){if(!Array.isArray(r))throw new Error("Random.choice expected input to be an array, got "+typeof r);var i=r==null?void 0:r.length;if(i>0){var o=this.uniformInt(0,i-1)();return r[o]}else return},e._memoize=function(r,i){var o=[].slice.call(arguments,2),s=""+o.join(";"),f=this._cache[r];return(f===void 0||f.key!==s)&&(f={key:s,distribution:i.apply(void 0,[this].concat(o))},this._cache[r]=f),f.distribution},Ja(t,[{key:"rng",get:function(){return this._rng}}]),t}();new Ku;const ts=.001,ns=64;class ug{constructor(){this.pointsTextureSize=0,this.linksTextureSize=0,this.alpha=1,this.transform=Sv(),this.screenSize=[0,0],this.mousePosition=[0,0],this.screenMousePosition=[0,0],this.selectedArea=[[0,0],[0,0]],this.isSimulationRunning=!1,this.simulationProgress=0,this.selectedIndices=null,this.maxPointSize=ns,this.hoveredPoint=void 0,this.focusedPoint=void 0,this.draggingPointIndex=void 0,this.adjustedSpaceSize=We.spaceSize,this.isSpaceKeyPressed=!1,this.hoveredPointRingColor=[1,1,1,Dp],this.focusedPointRingColor=[1,1,1,zp],this.greyoutPointColor=[-1,-1,-1,-1],this.darkenGreyout=!1,this.alphaTarget=0,this.scalePointX=Za(),this.scalePointY=Za(),this.random=new Ku,this._backgroundColor=[0,0,0,0],this.alphaDecay=e=>1-Math.pow(ts,1/e)}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e;const n=du(e[0],e[1],e[2]);document.documentElement.style.setProperty("--cosmosgl-attribution-color",n>.65?"black":"white"),document.documentElement.style.setProperty("--cosmosgl-error-message-color",n>.65?"black":"white"),this.div&&(this.div.style.backgroundColor=`rgba(${e[0]*255}, ${e[1]*255}, ${e[2]*255}, ${e[3]})`),this.darkenGreyout=n<.65}addRandomSeed(e){this.random=this.random.clone(e)}getRandomFloat(e,n){return this.random.float(e,n)}adjustSpaceSize(e,n){e>=n?(this.adjustedSpaceSize=n/2,console.warn(`The \`spaceSize\` has been reduced to ${this.adjustedSpaceSize} due to WebGL limits`)):this.adjustedSpaceSize=e}updateScreenSize(e,n){const{adjustedSpaceSize:r}=this;this.screenSize=[e,n],this.scalePointX.domain([0,r]).range([(e-r)/2,(e+r)/2]),this.scalePointY.domain([r,0]).range([(n-r)/2,(n+r)/2])}scaleX(e){return this.scalePointX(e)}scaleY(e){return this.scalePointY(e)}setHoveredPointRingColor(e){const n=Vn(e);this.hoveredPointRingColor[0]=n[0],this.hoveredPointRingColor[1]=n[1],this.hoveredPointRingColor[2]=n[2]}setFocusedPointRingColor(e){const n=Vn(e);this.focusedPointRingColor[0]=n[0],this.focusedPointRingColor[1]=n[1],this.focusedPointRingColor[2]=n[2]}setGreyoutPointColor(e){if(e===void 0){this.greyoutPointColor=[-1,-1,-1,-1];return}const n=Vn(e);this.greyoutPointColor[0]=n[0],this.greyoutPointColor[1]=n[1],this.greyoutPointColor[2]=n[2],this.greyoutPointColor[3]=n[3]}setFocusedPoint(e){e!==void 0?this.focusedPoint={index:e}:this.focusedPoint=void 0}addAlpha(e){return(this.alphaTarget-this.alpha)*this.alphaDecay(e)}}const lg={passive:!1},pi={capture:!0,passive:!1};function rs(t){t.stopImmediatePropagation()}function Rr(t){t.preventDefault(),t.stopImmediatePropagation()}function Ju(t){var e=t.document.documentElement,n=Dt(t).on("dragstart.drag",Rr,pi);"onselectstart"in e?n.on("selectstart.drag",Rr,pi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function el(t,e){var n=t.document.documentElement,r=Dt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Rr,pi),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const So=t=>()=>t;function is(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:s,y:f,dx:u,dy:l,dispatch:v}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:v}})}is.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function cg(t){return!t.ctrlKey&&!t.button}function hg(){return this.parentNode}function dg(t,e){return e??{x:t.x,y:t.y}}function mg(){return navigator.maxTouchPoints||"ontouchstart"in this}function pg(){var t=cg,e=hg,n=dg,r=mg,i={},o=Vi("start","drag","end"),s=0,f,u,l,v,b=0;function S(H){H.on("mousedown.drag",D).filter(r).on("touchstart.drag",Te).on("touchmove.drag",se,lg).on("touchend.drag touchcancel.drag",Ue).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function D(H,fe){if(!(v||!t.call(this,H,fe))){var Re=He(this,e.call(this,H,fe),H,fe,"mouse");Re&&(Dt(H.view).on("mousemove.drag",Y,pi).on("mouseup.drag",Ee,pi),Ju(H.view),rs(H),l=!1,f=H.clientX,u=H.clientY,Re("start",H))}}function Y(H){if(Rr(H),!l){var fe=H.clientX-f,Re=H.clientY-u;l=fe*fe+Re*Re>b}i.mouse("drag",H)}function Ee(H){Dt(H.view).on("mousemove.drag mouseup.drag",null),el(H.view,l),Rr(H),i.mouse("end",H)}function Te(H,fe){if(t.call(this,H,fe)){var Re=H.changedTouches,Ge=e.call(this,H,fe),Ye=Re.length,at,ut;for(at=0;at<Ye;++at)(ut=He(this,Ge,H,fe,Re[at].identifier,Re[at]))&&(rs(H),ut("start",H,Re[at]))}}function se(H){var fe=H.changedTouches,Re=fe.length,Ge,Ye;for(Ge=0;Ge<Re;++Ge)(Ye=i[fe[Ge].identifier])&&(Rr(H),Ye("drag",H,fe[Ge]))}function Ue(H){var fe=H.changedTouches,Re=fe.length,Ge,Ye;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),Ge=0;Ge<Re;++Ge)(Ye=i[fe[Ge].identifier])&&(rs(H),Ye("end",H,fe[Ge]))}function He(H,fe,Re,Ge,Ye,at){var ut=o.copy(),Ae=kn(at||Re,fe),lt,it,N;if((N=n.call(H,new is("beforestart",{sourceEvent:Re,target:S,identifier:Ye,active:s,x:Ae[0],y:Ae[1],dx:0,dy:0,dispatch:ut}),Ge))!=null)return lt=N.x-Ae[0]||0,it=N.y-Ae[1]||0,function Ce(re,ke,Xe){var je=Ae,Qe;switch(re){case"start":i[Ye]=Ce,Qe=s++;break;case"end":delete i[Ye],--s;case"drag":Ae=kn(Xe||ke,fe),Qe=s;break}ut.call(re,H,new is(re,{sourceEvent:ke,subject:N,target:S,identifier:Ye,active:Qe,x:Ae[0]+lt,y:Ae[1]+it,dx:Ae[0]-je[0],dy:Ae[1]-je[1],dispatch:ut}),Ge)}}return S.filter=function(H){return arguments.length?(t=typeof H=="function"?H:So(!!H),S):t},S.container=function(H){return arguments.length?(e=typeof H=="function"?H:So(H),S):e},S.subject=function(H){return arguments.length?(n=typeof H=="function"?H:So(H),S):n},S.touchable=function(H){return arguments.length?(r=typeof H=="function"?H:So(!!H),S):r},S.on=function(){var H=o.on.apply(o,arguments);return H===o?S:H},S.clickDistance=function(H){return arguments.length?(b=(H=+H)*H,S):Math.sqrt(b)},S}const To=t=>()=>t;function vg(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Dn(t,e,n){this.k=t,this.x=e,this.y=n}Dn.prototype={constructor:Dn,scale:function(t){return t===1?this:new Dn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Dn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vi=new Dn(1,0,0);Dn.prototype;function os(t){t.stopImmediatePropagation()}function gi(t){t.preventDefault(),t.stopImmediatePropagation()}function gg(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function yg(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function tl(){return this.__zoom||vi}function xg(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function bg(){return navigator.maxTouchPoints||"ontouchstart"in this}function _g(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Sg(){var t=gg,e=yg,n=_g,r=xg,i=bg,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],f=250,u=hm,l=Vi("start","zoom","end"),v,b,S,D=500,Y=150,Ee=0,Te=10;function se(N){N.property("__zoom",tl).on("wheel.zoom",Ye,{passive:!1}).on("mousedown.zoom",at).on("dblclick.zoom",ut).filter(i).on("touchstart.zoom",Ae).on("touchmove.zoom",lt).on("touchend.zoom touchcancel.zoom",it).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}se.transform=function(N,Ce,re,ke){var Xe=N.selection?N.selection():N;Xe.property("__zoom",tl),N!==Xe?fe(N,Ce,re,ke):Xe.interrupt().each(function(){Re(this,arguments).event(ke).start().zoom(null,typeof Ce=="function"?Ce.apply(this,arguments):Ce).end()})},se.scaleBy=function(N,Ce,re,ke){se.scaleTo(N,function(){var Xe=this.__zoom.k,je=typeof Ce=="function"?Ce.apply(this,arguments):Ce;return Xe*je},re,ke)},se.scaleTo=function(N,Ce,re,ke){se.transform(N,function(){var Xe=e.apply(this,arguments),je=this.__zoom,Qe=re==null?H(Xe):typeof re=="function"?re.apply(this,arguments):re,Ze=je.invert(Qe),dt=typeof Ce=="function"?Ce.apply(this,arguments):Ce;return n(He(Ue(je,dt),Qe,Ze),Xe,s)},re,ke)},se.translateBy=function(N,Ce,re,ke){se.transform(N,function(){return n(this.__zoom.translate(typeof Ce=="function"?Ce.apply(this,arguments):Ce,typeof re=="function"?re.apply(this,arguments):re),e.apply(this,arguments),s)},null,ke)},se.translateTo=function(N,Ce,re,ke,Xe){se.transform(N,function(){var je=e.apply(this,arguments),Qe=this.__zoom,Ze=ke==null?H(je):typeof ke=="function"?ke.apply(this,arguments):ke;return n(vi.translate(Ze[0],Ze[1]).scale(Qe.k).translate(typeof Ce=="function"?-Ce.apply(this,arguments):-Ce,typeof re=="function"?-re.apply(this,arguments):-re),je,s)},ke,Xe)};function Ue(N,Ce){return Ce=Math.max(o[0],Math.min(o[1],Ce)),Ce===N.k?N:new Dn(Ce,N.x,N.y)}function He(N,Ce,re){var ke=Ce[0]-re[0]*N.k,Xe=Ce[1]-re[1]*N.k;return ke===N.x&&Xe===N.y?N:new Dn(N.k,ke,Xe)}function H(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function fe(N,Ce,re,ke){N.on("start.zoom",function(){Re(this,arguments).event(ke).start()}).on("interrupt.zoom end.zoom",function(){Re(this,arguments).event(ke).end()}).tween("zoom",function(){var Xe=this,je=arguments,Qe=Re(Xe,je).event(ke),Ze=e.apply(Xe,je),dt=re==null?H(Ze):typeof re=="function"?re.apply(Xe,je):re,ct=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),_t=Xe.__zoom,st=typeof Ce=="function"?Ce.apply(Xe,je):Ce,$t=u(_t.invert(dt).concat(ct/_t.k),st.invert(dt).concat(ct/st.k));return function(Ht){if(Ht===1)Ht=st;else{var Qt=$t(Ht),zn=ct/Qt[2];Ht=new Dn(zn,dt[0]-Qt[0]*zn,dt[1]-Qt[1]*zn)}Qe.zoom(null,Ht)}})}function Re(N,Ce,re){return!re&&N.__zooming||new Ge(N,Ce)}function Ge(N,Ce){this.that=N,this.args=Ce,this.active=0,this.sourceEvent=null,this.extent=e.apply(N,Ce),this.taps=0}Ge.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,Ce){return this.mouse&&N!=="mouse"&&(this.mouse[1]=Ce.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=Ce.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=Ce.invert(this.touch1[0])),this.that.__zoom=Ce,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var Ce=Dt(this.that).datum();l.call(N,this.that,new vg(N,{sourceEvent:this.sourceEvent,target:se,transform:this.that.__zoom,dispatch:l}),Ce)}};function Ye(N,...Ce){if(!t.apply(this,arguments))return;var re=Re(this,Ce).event(N),ke=this.__zoom,Xe=Math.max(o[0],Math.min(o[1],ke.k*Math.pow(2,r.apply(this,arguments)))),je=kn(N);if(re.wheel)(re.mouse[0][0]!==je[0]||re.mouse[0][1]!==je[1])&&(re.mouse[1]=ke.invert(re.mouse[0]=je)),clearTimeout(re.wheel);else{if(ke.k===Xe)return;re.mouse=[je,ke.invert(je)],Qi(this),re.start()}gi(N),re.wheel=setTimeout(Qe,Y),re.zoom("mouse",n(He(Ue(ke,Xe),re.mouse[0],re.mouse[1]),re.extent,s));function Qe(){re.wheel=null,re.end()}}function at(N,...Ce){if(S||!t.apply(this,arguments))return;var re=N.currentTarget,ke=Re(this,Ce,!0).event(N),Xe=Dt(N.view).on("mousemove.zoom",dt,!0).on("mouseup.zoom",ct,!0),je=kn(N,re),Qe=N.clientX,Ze=N.clientY;Ju(N.view),os(N),ke.mouse=[je,this.__zoom.invert(je)],Qi(this),ke.start();function dt(_t){if(gi(_t),!ke.moved){var st=_t.clientX-Qe,$t=_t.clientY-Ze;ke.moved=st*st+$t*$t>Ee}ke.event(_t).zoom("mouse",n(He(ke.that.__zoom,ke.mouse[0]=kn(_t,re),ke.mouse[1]),ke.extent,s))}function ct(_t){Xe.on("mousemove.zoom mouseup.zoom",null),el(_t.view,ke.moved),gi(_t),ke.event(_t).end()}}function ut(N,...Ce){if(t.apply(this,arguments)){var re=this.__zoom,ke=kn(N.changedTouches?N.changedTouches[0]:N,this),Xe=re.invert(ke),je=re.k*(N.shiftKey?.5:2),Qe=n(He(Ue(re,je),ke,Xe),e.apply(this,Ce),s);gi(N),f>0?Dt(this).transition().duration(f).call(fe,Qe,ke,N):Dt(this).call(se.transform,Qe,ke,N)}}function Ae(N,...Ce){if(t.apply(this,arguments)){var re=N.touches,ke=re.length,Xe=Re(this,Ce,N.changedTouches.length===ke).event(N),je,Qe,Ze,dt;for(os(N),Qe=0;Qe<ke;++Qe)Ze=re[Qe],dt=kn(Ze,this),dt=[dt,this.__zoom.invert(dt),Ze.identifier],Xe.touch0?!Xe.touch1&&Xe.touch0[2]!==dt[2]&&(Xe.touch1=dt,Xe.taps=0):(Xe.touch0=dt,je=!0,Xe.taps=1+!!v);v&&(v=clearTimeout(v)),je&&(Xe.taps<2&&(b=dt[0],v=setTimeout(function(){v=null},D)),Qi(this),Xe.start())}}function lt(N,...Ce){if(this.__zooming){var re=Re(this,Ce).event(N),ke=N.changedTouches,Xe=ke.length,je,Qe,Ze,dt;for(gi(N),je=0;je<Xe;++je)Qe=ke[je],Ze=kn(Qe,this),re.touch0&&re.touch0[2]===Qe.identifier?re.touch0[0]=Ze:re.touch1&&re.touch1[2]===Qe.identifier&&(re.touch1[0]=Ze);if(Qe=re.that.__zoom,re.touch1){var ct=re.touch0[0],_t=re.touch0[1],st=re.touch1[0],$t=re.touch1[1],Ht=(Ht=st[0]-ct[0])*Ht+(Ht=st[1]-ct[1])*Ht,Qt=(Qt=$t[0]-_t[0])*Qt+(Qt=$t[1]-_t[1])*Qt;Qe=Ue(Qe,Math.sqrt(Ht/Qt)),Ze=[(ct[0]+st[0])/2,(ct[1]+st[1])/2],dt=[(_t[0]+$t[0])/2,(_t[1]+$t[1])/2]}else if(re.touch0)Ze=re.touch0[0],dt=re.touch0[1];else return;re.zoom("touch",n(He(Qe,Ze,dt),re.extent,s))}}function it(N,...Ce){if(this.__zooming){var re=Re(this,Ce).event(N),ke=N.changedTouches,Xe=ke.length,je,Qe;for(os(N),S&&clearTimeout(S),S=setTimeout(function(){S=null},D),je=0;je<Xe;++je)Qe=ke[je],re.touch0&&re.touch0[2]===Qe.identifier?delete re.touch0:re.touch1&&re.touch1[2]===Qe.identifier&&delete re.touch1;if(re.touch1&&!re.touch0&&(re.touch0=re.touch1,delete re.touch1),re.touch0)re.touch0[1]=this.__zoom.invert(re.touch0[0]);else if(re.end(),re.taps===2&&(Qe=kn(Qe,this),Math.hypot(b[0]-Qe[0],b[1]-Qe[1])<Te)){var Ze=Dt(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return se.wheelDelta=function(N){return arguments.length?(r=typeof N=="function"?N:To(+N),se):r},se.filter=function(N){return arguments.length?(t=typeof N=="function"?N:To(!!N),se):t},se.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:To(!!N),se):i},se.extent=function(N){return arguments.length?(e=typeof N=="function"?N:To([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),se):e},se.scaleExtent=function(N){return arguments.length?(o[0]=+N[0],o[1]=+N[1],se):[o[0],o[1]]},se.translateExtent=function(N){return arguments.length?(s[0][0]=+N[0][0],s[1][0]=+N[1][0],s[0][1]=+N[0][1],s[1][1]=+N[1][1],se):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},se.constrain=function(N){return arguments.length?(n=N,se):n},se.duration=function(N){return arguments.length?(f=+N,se):f},se.interpolate=function(N){return arguments.length?(u=N,se):u},se.on=function(){var N=l.on.apply(l,arguments);return N===l?se:N},se.clickDistance=function(N){return arguments.length?(Ee=(N=+N)*N,se):Math.sqrt(Ee)},se.tapDistance=function(N){return arguments.length?(Te=+N,se):Te},se}class Tg{constructor(e,n){this.eventTransform=vi,this.behavior=Sg().scaleExtent([.001,1/0]).on("start",r=>{var o,s;this.isRunning=!0;const i=!!r.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomStart)==null||s.call(o,r,i)}).on("zoom",r=>{var S,D;this.eventTransform=r.transform;const{eventTransform:{x:i,y:o,k:s},store:{transform:f,screenSize:u}}=this,l=u[0],v=u[1];if(!l||!v)return;Tv(f,l,v),Bu(f,f,[i,o]),Qa(f,f,[s,s]),Bu(f,f,[l/2,v/2]),Qa(f,f,[l/2,v/2]),Qa(f,f,[1,-1]);const b=!!r.sourceEvent;(D=(S=this.config)==null?void 0:S.onZoom)==null||D.call(S,r,b)}).on("end",r=>{var o,s;this.isRunning=!1;const i=!!r.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomEnd)==null||s.call(o,r,i)}),this.isRunning=!1,this.store=e,this.config=n}getTransform(e,n,r=.1){if(e.length===0)return this.eventTransform;const{store:{screenSize:i}}=this,o=i[0],s=i[1],f=Su(e.map(se=>se[0])),u=Su(e.map(se=>se[1]));f[0]=this.store.scaleX(f[0]),f[1]=this.store.scaleX(f[1]),u[0]=this.store.scaleY(u[0]),u[1]=this.store.scaleY(u[1]),f[0]===f[1]&&(f[0]-=.5,f[1]+=.5),u[0]===u[1]&&(u[0]+=.5,u[1]-=.5);const l=o*(1-r*2)/(f[1]-f[0]),v=s*(1-r*2)/(u[0]-u[1]),b=mu(n??Math.min(l,v),...this.behavior.scaleExtent()),S=(f[1]+f[0])/2,D=(u[1]+u[0])/2,Y=o/2-S*b,Ee=s/2-D*b;return vi.translate(Y,Ee).scale(b)}getDistanceToPoint(e){const{x:n,y:r,k:i}=this.eventTransform,o=this.getTransform([e],i),s=n-o.x,f=r-o.y;return Math.sqrt(s*s+f*f)}getMiddlePointTransform(e){const{store:{screenSize:n},eventTransform:{x:r,y:i,k:o}}=this,s=n[0],f=n[1],u=(s/2-r)/o,l=(f/2-i)/o,v=this.store.scaleX(e[0]),b=this.store.scaleY(e[1]),S=(u+v)/2,D=(l+b)/2,Y=1,Ee=s/2-S*Y,Te=f/2-D*Y;return vi.translate(Ee,Te).scale(Y)}convertScreenToSpacePosition(e){const{eventTransform:{x:n,y:r,k:i},store:{screenSize:o}}=this,s=o[0],f=o[1],u=(e[0]-n)/i,l=(e[1]-r)/i,v=[u,f-l];return v[0]-=(s-this.store.adjustedSpaceSize)/2,v[1]-=(f-this.store.adjustedSpaceSize)/2,v}convertSpaceToScreenPosition(e){const n=this.eventTransform.applyX(this.store.scaleX(e[0])),r=this.eventTransform.applyY(this.store.scaleY(e[1]));return[n,r]}convertSpaceToScreenRadius(e){const{config:{scalePointsOnZoom:n},store:{maxPointSize:r},eventTransform:{k:i}}=this;let o=e*2;return n?o*=i:o*=Math.min(5,Math.max(1,i*.01)),Math.min(o,r)/2}}class wg{constructor(e,n){this.isActive=!1,this.behavior=pg().subject(r=>this.store.hoveredPoint&&!this.store.isSpaceKeyPressed?{x:r.x,y:r.y}:void 0).on("start",r=>{var i,o;this.store.hoveredPoint&&(this.store.draggingPointIndex=this.store.hoveredPoint.index,this.isActive=!0,(o=(i=this.config)==null?void 0:i.onDragStart)==null||o.call(i,r))}).on("drag",r=>{var i,o;(o=(i=this.config)==null?void 0:i.onDrag)==null||o.call(i,r)}).on("end",r=>{var i,o;this.isActive=!1,this.store.draggingPointIndex=void 0,(o=(i=this.config)==null?void 0:i.onDragEnd)==null||o.call(i,r)}),this.store=e,this.config=n}}function Ag(t){const e=document.createElement("div");return e.style.cssText=`
|
|
1346
|
+
}`;class _v extends In{constructor(){super(...arguments),this.polygonPathLength=0}updatePositions(){const{reglInstance:e,store:n,data:r,config:{rescalePositions:i,enableSimulation:o}}=this,{pointsTextureSize:s}=n;if(!s||!r.pointPositions||r.pointsNumber===void 0)return;const f=new Float32Array(s*s*4);let u=i;i===void 0&&!o&&(u=!0),this.dontRescale&&(u=!1),u?this.rescaleInitialNodePositions():this.dontRescale||(this.scaleX=void 0,this.scaleY=void 0),this.dontRescale=void 0;for(let l=0;l<r.pointsNumber;++l)f[l*4+0]=r.pointPositions[l*2+0],f[l*4+1]=r.pointPositions[l*2+1],f[l*4+2]=l;this.currentPositionFbo||(this.currentPositionFbo=e.framebuffer()),this.currentPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.previousPositionFbo||(this.previousPositionFbo=e.framebuffer()),this.previousPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.config.enableSimulation&&(this.velocityFbo||(this.velocityFbo=e.framebuffer()),this.velocityFbo({color:e.texture({data:new Float32Array(s*s*4).fill(0),shape:[s,s,4],type:"float"}),depth:!1,stencil:!1})),this.selectedTexture||(this.selectedTexture=e.texture()),this.selectedTexture({data:f,shape:[s,s,4],type:"float"}),this.selectedFbo||(this.selectedFbo=e.framebuffer()),this.selectedFbo({color:this.selectedTexture,depth:!1,stencil:!1}),this.hoveredFbo||(this.hoveredFbo=e.framebuffer()),this.hoveredFbo({shape:[2,2],colorType:"float",depth:!1,stencil:!1}),this.drawPointIndices||(this.drawPointIndices=e.buffer(0)),this.drawPointIndices(or(n.pointsTextureSize)),this.hoveredPointIndices||(this.hoveredPointIndices=e.buffer(0)),this.hoveredPointIndices(or(n.pointsTextureSize)),this.sampledPointIndices||(this.sampledPointIndices=e.buffer(0)),this.sampledPointIndices(or(n.pointsTextureSize)),this.updateGreyoutStatus(),this.updateSampledPointsGrid(),this.trackPointsByIndices()}initPrograms(){const{reglInstance:e,config:n,store:r,data:i}=this;n.enableSimulation&&(this.updatePositionCommand||(this.updatePositionCommand=e({frag:yv,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,velocity:()=>this.velocityFbo,friction:()=>n.simulationFriction,spaceSize:()=>r.adjustedSpaceSize}}))),this.dragPointCommand||(this.dragPointCommand=e({frag:bv,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,mousePos:()=>r.mousePosition,index:()=>{var o;return((o=r.hoveredPoint)==null?void 0:o.index)??-1}}})),this.drawCommand||(this.drawCommand=e({frag:fv,vert:uv,primitive:"points",count:()=>i.pointsNumber??0,attributes:{pointIndices:{buffer:this.drawPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1},color:{buffer:()=>this.colorBuffer,size:4}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointGreyoutStatus:()=>this.greyoutStatusFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,pointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,greyoutColor:()=>r.greyoutPointColor,backgroundColor:()=>r.backgroundColor,darkenGreyout:()=>r.darkenGreyout,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>r.maxPointSize,renderOnlySelected:e.prop("renderOnlySelected"),renderOnlyUnselected:e.prop("renderOnlyUnselected")},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.findPointsOnAreaSelectionCommand||(this.findPointsOnAreaSelectionCommand=e({frag:lv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointSize:()=>this.sizeFbo,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,sizeScale:()=>n.pointSizeScale,transformationMatrix:()=>r.transform,ratio:()=>n.pixelRatio,"selection[0]":()=>r.selectedArea[0],"selection[1]":()=>r.selectedArea[1],scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>r.maxPointSize}})),this.findPointsOnPolygonSelectionCommand||(this.findPointsOnPolygonSelectionCommand=e({frag:cv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,transformationMatrix:()=>r.transform,polygonPathTexture:()=>this.polygonPathTexture,polygonPathLength:()=>this.polygonPathLength}})),this.clearHoveredFboCommand||(this.clearHoveredFboCommand=e({frag:ar,vert:kt,framebuffer:this.hoveredFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.findHoveredPointCommand||(this.findHoveredPointCommand=e({frag:mv,vert:pv,primitive:"points",count:()=>i.pointsNumber??0,framebuffer:()=>this.hoveredFbo,attributes:{pointIndices:{buffer:this.hoveredPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1}},uniforms:{positionsTexture:()=>this.currentPositionFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,mousePosition:()=>r.screenMousePosition,maxPointSize:()=>r.maxPointSize},depth:{enable:!1,mask:!1}})),this.clearSampledPointsFboCommand||(this.clearSampledPointsFboCommand=e({frag:ar,vert:kt,framebuffer:()=>this.sampledPointsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.fillSampledPointsFboCommand||(this.fillSampledPointsFboCommand=e({frag:vv,vert:gv,primitive:"points",count:()=>i.pointsNumber??0,framebuffer:()=>this.sampledPointsFbo,attributes:{pointIndices:{buffer:this.sampledPointIndices,size:2}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize},depth:{enable:!1,mask:!1}})),this.drawHighlightedCommand||(this.drawHighlightedCommand=e({frag:hv,vert:dv,attributes:{vertexCoord:wt(e)},primitive:"triangle strip",count:4,uniforms:{color:e.prop("color"),width:e.prop("width"),pointIndex:e.prop("pointIndex"),size:e.prop("size"),positionsTexture:()=>this.currentPositionFbo,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>r.pointsTextureSize,transformationMatrix:()=>r.transform,spaceSize:()=>r.adjustedSpaceSize,screenSize:()=>r.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>r.maxPointSize,pointGreyoutStatusTexture:()=>this.greyoutStatusFbo,universalPointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,darkenGreyout:()=>r.darkenGreyout,backgroundColor:()=>r.backgroundColor,greyoutColor:()=>r.greyoutPointColor},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.trackPointsCommand||(this.trackPointsCommand=e({frag:xv,vert:kt,framebuffer:()=>this.trackedPositionsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,trackedIndices:()=>this.trackedIndicesFbo,pointsTextureSize:()=>r.pointsTextureSize}}))}updateColor(){const{reglInstance:e,store:{pointsTextureSize:n},data:r}=this;n&&(this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(r.pointColors))}updateGreyoutStatus(){const{reglInstance:e,store:{selectedIndices:n,pointsTextureSize:r}}=this;if(!r)return;const i=new Float32Array(r*r*4).fill(n?1:0);if(n)for(const o of n)i[o*4]=0;this.greyoutStatusTexture||(this.greyoutStatusTexture=e.texture()),this.greyoutStatusTexture({data:i,width:r,height:r,type:"float"}),this.greyoutStatusFbo||(this.greyoutStatusFbo=e.framebuffer()),this.greyoutStatusFbo({color:this.greyoutStatusTexture,depth:!1,stencil:!1})}updateSize(){const{reglInstance:e,store:{pointsTextureSize:n},data:r}=this;if(!n||r.pointsNumber===void 0||r.pointSizes===void 0)return;this.sizeBuffer||(this.sizeBuffer=e.buffer(0)),this.sizeBuffer(r.pointSizes);const i=new Float32Array(n*n*4);for(let o=0;o<r.pointsNumber;o++)i[o*4]=r.pointSizes[o];this.sizeTexture||(this.sizeTexture=e.texture()),this.sizeTexture({data:i,width:n,height:n,type:"float"}),this.sizeFbo||(this.sizeFbo=e.framebuffer()),this.sizeFbo({color:this.sizeTexture,depth:!1,stencil:!1})}updateSampledPointsGrid(){const{store:{screenSize:e},config:{pointSamplingDistance:n},reglInstance:r}=this;let i=n??Math.min(...e)/2;i===0&&(i=We.pointSamplingDistance);const o=Math.ceil(e[0]/i),s=Math.ceil(e[1]/i);this.sampledPointsFbo||(this.sampledPointsFbo=r.framebuffer()),this.sampledPointsFbo({shape:[o,s],depth:!1,stencil:!1,colorType:"float"})}trackPoints(){var e,n;(e=this.trackedIndices)!=null&&e.length&&((n=this.trackPointsCommand)==null||n.call(this))}draw(){var o,s,f,u,l,p,x;const{config:{renderHoveredPointRing:e,pointSize:n},store:r,data:i}=this;this.colorBuffer||this.updateColor(),this.sizeBuffer||this.updateSize(),r.selectedIndices&&r.selectedIndices.length>0?((o=this.drawCommand)==null||o.call(this,{renderOnlySelected:!1,renderOnlyUnselected:!0}),(s=this.drawCommand)==null||s.call(this,{renderOnlySelected:!0,renderOnlyUnselected:!1})):(f=this.drawCommand)==null||f.call(this,{renderOnlySelected:!1,renderOnlyUnselected:!1}),e&&r.hoveredPoint&&((l=this.drawHighlightedCommand)==null||l.call(this,{width:.85,color:r.hoveredPointRingColor,pointIndex:r.hoveredPoint.index,size:((u=i.pointSizes)==null?void 0:u[r.hoveredPoint.index])??n})),r.focusedPoint&&((x=this.drawHighlightedCommand)==null||x.call(this,{width:.75,color:r.focusedPointRingColor,pointIndex:r.focusedPoint.index,size:((p=i.pointSizes)==null?void 0:p[r.focusedPoint.index])??n}))}updatePosition(){var e;(e=this.updatePositionCommand)==null||e.call(this),this.swapFbo()}drag(){var e;(e=this.dragPointCommand)==null||e.call(this),this.swapFbo()}findPointsOnAreaSelection(){var e;(e=this.findPointsOnAreaSelectionCommand)==null||e.call(this)}findPointsOnPolygonSelection(){var e;(e=this.findPointsOnPolygonSelectionCommand)==null||e.call(this)}updatePolygonPath(e){const{reglInstance:n}=this;if(this.polygonPathLength=e.length,e.length===0){this.polygonPathTexture=void 0,this.polygonPathFbo=void 0;return}const r=Math.ceil(Math.sqrt(e.length)),i=new Float32Array(r*r*4);for(const[o,s]of e.entries()){const[f,u]=s;i[o*4]=f,i[o*4+1]=u,i[o*4+2]=0,i[o*4+3]=0}this.polygonPathTexture||(this.polygonPathTexture=n.texture()),this.polygonPathTexture({data:i,width:r,height:r,type:"float"}),this.polygonPathFbo||(this.polygonPathFbo=n.framebuffer()),this.polygonPathFbo({color:this.polygonPathTexture,depth:!1,stencil:!1})}findHoveredPoint(){var e,n;(e=this.clearHoveredFboCommand)==null||e.call(this),(n=this.findHoveredPointCommand)==null||n.call(this)}trackPointsByIndices(e){const{store:{pointsTextureSize:n},reglInstance:r}=this;if(this.trackedIndices=e,!(e!=null&&e.length))return;const i=Math.ceil(Math.sqrt(e.length)),o=new Float32Array(i*i*4).fill(-1);for(const[s,f]of e.entries())f!==void 0&&(o[s*4]=f%n,o[s*4+1]=Math.floor(f/n),o[s*4+2]=0,o[s*4+3]=0);this.trackedIndicesTexture||(this.trackedIndicesTexture=r.texture()),this.trackedIndicesTexture({data:o,width:i,height:i,type:"float"}),this.trackedIndicesFbo||(this.trackedIndicesFbo=r.framebuffer()),this.trackedIndicesFbo({color:this.trackedIndicesTexture,depth:!1,stencil:!1}),this.trackedPositionsFbo||(this.trackedPositionsFbo=r.framebuffer()),this.trackedPositionsFbo({shape:[i,i],depth:!1,stencil:!1,colorType:"float"}),this.trackPoints()}getTrackedPositionsMap(){const e=new Map;if(!this.trackedIndices)return e;const n=tn(this.reglInstance,this.trackedPositionsFbo);for(let r=0;r<n.length/4;r+=1){const i=n[r*4],o=n[r*4+1],s=this.trackedIndices[r];i!==void 0&&o!==void 0&&s!==void 0&&e.set(s,[i,o])}return e}getSampledPointPositionsMap(){var r,i;const e=new Map;if(!this.sampledPointsFbo)return e;(r=this.clearSampledPointsFboCommand)==null||r.call(this),(i=this.fillSampledPointsFboCommand)==null||i.call(this);const n=tn(this.reglInstance,this.sampledPointsFbo);for(let o=0;o<n.length/4;o++){const s=n[o*4],f=!!n[o*4+1],u=n[o*4+2],l=n[o*4+3];f&&s!==void 0&&u!==void 0&&l!==void 0&&e.set(s,[u,l])}return e}getSampledPoints(){var i,o;const e=[],n=[];if(!this.sampledPointsFbo)return{indices:e,positions:n};(i=this.clearSampledPointsFboCommand)==null||i.call(this),(o=this.fillSampledPointsFboCommand)==null||o.call(this);const r=tn(this.reglInstance,this.sampledPointsFbo);for(let s=0;s<r.length/4;s++){const f=r[s*4],u=!!r[s*4+1],l=r[s*4+2],p=r[s*4+3];u&&f!==void 0&&l!==void 0&&p!==void 0&&(e.push(f),n.push(l,p))}return{indices:e,positions:n}}getTrackedPositionsArray(){const e=[];if(!this.trackedIndices)return e;e.length=this.trackedIndices.length*2;const n=tn(this.reglInstance,this.trackedPositionsFbo);for(let r=0;r<n.length/4;r+=1){const i=n[r*4],o=n[r*4+1],s=this.trackedIndices[r];i!==void 0&&o!==void 0&&s!==void 0&&(e[r*2]=i,e[r*2+1]=o)}return e}swapFbo(){const e=this.previousPositionFbo;this.previousPositionFbo=this.currentPositionFbo,this.currentPositionFbo=e}rescaleInitialNodePositions(){const{config:{spaceSize:e}}=this;if(!this.data.pointPositions||!e)return;const n=this.data.pointPositions,r=n.length/2;let i=1/0,o=-1/0,s=1/0,f=-1/0;for(let Te=0;Te<n.length;Te+=2){const se=n[Te],Ue=n[Te+1];i=Math.min(i,se),o=Math.max(o,se),s=Math.min(s,Ue),f=Math.max(f,Ue)}const u=o-i,l=f-s,p=Math.max(u,l);if(p>e){this.scaleX=void 0,this.scaleY=void 0;return}const x=e*e*.001,D=(r>x?e*Math.max(1.2,Math.sqrt(r)/e):e*.1)/p,Y=(p-u)/2*D,Ee=(p-l)/2*D;this.scaleX=Te=>(Te-i)*D+Y,this.scaleY=Te=>(Te-s)*D+Ee;for(let Te=0;Te<r;Te++)this.data.pointPositions[Te*2]=this.scaleX(n[Te*2]),this.data.pointPositions[Te*2+1]=this.scaleY(n[Te*2+1])}}var Gu=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Sv(){var t=new Gu(9);return Gu!=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 Bu(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],f=e[4],u=e[5],l=e[6],p=e[7],x=e[8],S=n[0],D=n[1];return t[0]=r,t[1]=i,t[2]=o,t[3]=s,t[4]=f,t[5]=u,t[6]=S*r+D*s+l,t[7]=S*i+D*f+p,t[8]=S*o+D*u+x,t}function Qa(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Tv(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var mo={exports:{}},wv=mo.exports,Uu;function Av(){return Uu||(Uu=1,function(t){(function(e,n,r){function i(u){var l=this,p=f();l.next=function(){var x=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=x-(l.c=x|0)},l.c=1,l.s0=p(" "),l.s1=p(" "),l.s2=p(" "),l.s0-=p(u),l.s0<0&&(l.s0+=1),l.s1-=p(u),l.s1<0&&(l.s1+=1),l.s2-=p(u),l.s2<0&&(l.s2+=1),p=null}function o(u,l){return l.c=u.c,l.s0=u.s0,l.s1=u.s1,l.s2=u.s2,l}function s(u,l){var p=new i(u),x=l&&l.state,S=p.next;return S.int32=function(){return p.next()*4294967296|0},S.double=function(){return S()+(S()*2097152|0)*11102230246251565e-32},S.quick=S,x&&(typeof x=="object"&&o(x,p),S.state=function(){return o(p,{})}),S}function f(){var u=4022871197,l=function(p){p=String(p);for(var x=0;x<p.length;x++){u+=p.charCodeAt(x);var S=.02519603282416938*u;u=S>>>0,S-=u,S*=u,u=S>>>0,S-=u,u+=S*4294967296}return(u>>>0)*23283064365386963e-26};return l}n&&n.exports?n.exports=s:this.alea=s})(wv,t)}(mo)),mo.exports}var po={exports:{}},Ev=po.exports,Vu;function Pv(){return Vu||(Vu=1,function(t){(function(e,n,r){function i(f){var u=this,l="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var x=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^x^x>>>8},f===(f|0)?u.x=f:l+=f;for(var p=0;p<l.length+64;p++)u.x^=l.charCodeAt(p)|0,u.next()}function o(f,u){return u.x=f.x,u.y=f.y,u.z=f.z,u.w=f.w,u}function s(f,u){var l=new i(f),p=u&&u.state,x=function(){return(l.next()>>>0)/4294967296};return x.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},x.int32=l.next,x.quick=x,p&&(typeof p=="object"&&o(p,l),x.state=function(){return o(l,{})}),x}n&&n.exports?n.exports=s:this.xor128=s})(Ev,t)}(po)),po.exports}var vo={exports:{}},Cv=vo.exports,$u;function kv(){return $u||($u=1,function(t){(function(e,n,r){function i(f){var u=this,l="";u.next=function(){var x=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(x^x<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,f===(f|0)?u.x=f:l+=f;for(var p=0;p<l.length+64;p++)u.x^=l.charCodeAt(p)|0,p==l.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function o(f,u){return u.x=f.x,u.y=f.y,u.z=f.z,u.w=f.w,u.v=f.v,u.d=f.d,u}function s(f,u){var l=new i(f),p=u&&u.state,x=function(){return(l.next()>>>0)/4294967296};return x.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},x.int32=l.next,x.quick=x,p&&(typeof p=="object"&&o(p,l),x.state=function(){return o(l,{})}),x}n&&n.exports?n.exports=s:this.xorwow=s})(Cv,t)}(vo)),vo.exports}var go={exports:{}},Lv=go.exports,Hu;function Fv(){return Hu||(Hu=1,function(t){(function(e,n,r){function i(f){var u=this;u.next=function(){var p=u.x,x=u.i,S,D;return S=p[x],S^=S>>>7,D=S^S<<24,S=p[x+1&7],D^=S^S>>>10,S=p[x+3&7],D^=S^S>>>3,S=p[x+4&7],D^=S^S<<7,S=p[x+7&7],S=S^S<<13,D^=S^S<<9,p[x]=D,u.i=x+1&7,D};function l(p,x){var S,D=[];if(x===(x|0))D[0]=x;else for(x=""+x,S=0;S<x.length;++S)D[S&7]=D[S&7]<<15^x.charCodeAt(S)+D[S+1&7]<<13;for(;D.length<8;)D.push(0);for(S=0;S<8&&D[S]===0;++S);for(S==8?D[7]=-1:D[S],p.x=D,p.i=0,S=256;S>0;--S)p.next()}l(u,f)}function o(f,u){return u.x=f.x.slice(),u.i=f.i,u}function s(f,u){f==null&&(f=+new Date);var l=new i(f),p=u&&u.state,x=function(){return(l.next()>>>0)/4294967296};return x.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},x.int32=l.next,x.quick=x,p&&(p.x&&o(p,l),x.state=function(){return o(l,{})}),x}n&&n.exports?n.exports=s:this.xorshift7=s})(Lv,t)}(go)),go.exports}var yo={exports:{}},Rv=yo.exports,ju;function Iv(){return ju||(ju=1,function(t){(function(e,n,r){function i(f){var u=this;u.next=function(){var p=u.w,x=u.X,S=u.i,D,Y;return u.w=p=p+1640531527|0,Y=x[S+34&127],D=x[S=S+1&127],Y^=Y<<13,D^=D<<17,Y^=Y>>>15,D^=D>>>12,Y=x[S]=Y^D,u.i=S,Y+(p^p>>>16)|0};function l(p,x){var S,D,Y,Ee,Te,se=[],Ue=128;for(x===(x|0)?(D=x,x=null):(x=x+"\0",D=0,Ue=Math.max(Ue,x.length)),Y=0,Ee=-32;Ee<Ue;++Ee)x&&(D^=x.charCodeAt((Ee+32)%x.length)),Ee===0&&(Te=D),D^=D<<10,D^=D>>>15,D^=D<<4,D^=D>>>13,Ee>=0&&(Te=Te+1640531527|0,S=se[Ee&127]^=D+Te,Y=S==0?Y+1:0);for(Y>=128&&(se[(x&&x.length||0)&127]=-1),Y=127,Ee=4*128;Ee>0;--Ee)D=se[Y+34&127],S=se[Y=Y+1&127],D^=D<<13,S^=S<<17,D^=D>>>15,S^=S>>>12,se[Y]=D^S;p.w=Te,p.X=se,p.i=Y}l(u,f)}function o(f,u){return u.i=f.i,u.w=f.w,u.X=f.X.slice(),u}function s(f,u){f==null&&(f=+new Date);var l=new i(f),p=u&&u.state,x=function(){return(l.next()>>>0)/4294967296};return x.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},x.int32=l.next,x.quick=x,p&&(p.X&&o(p,l),x.state=function(){return o(l,{})}),x}n&&n.exports?n.exports=s:this.xor4096=s})(Rv,t)}(yo)),yo.exports}var xo={exports:{}},Dv=xo.exports,Xu;function zv(){return Xu||(Xu=1,function(t){(function(e,n,r){function i(f){var u=this,l="";u.next=function(){var x=u.b,S=u.c,D=u.d,Y=u.a;return x=x<<25^x>>>7^S,S=S-D|0,D=D<<24^D>>>8^Y,Y=Y-x|0,u.b=x=x<<20^x>>>12^S,u.c=S=S-D|0,u.d=D<<16^S>>>16^Y,u.a=Y-x|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,f===Math.floor(f)?(u.a=f/4294967296|0,u.b=f|0):l+=f;for(var p=0;p<l.length+20;p++)u.b^=l.charCodeAt(p)|0,u.next()}function o(f,u){return u.a=f.a,u.b=f.b,u.c=f.c,u.d=f.d,u}function s(f,u){var l=new i(f),p=u&&u.state,x=function(){return(l.next()>>>0)/4294967296};return x.double=function(){do var S=l.next()>>>11,D=(l.next()>>>0)/4294967296,Y=(S+D)/(1<<21);while(Y===0);return Y},x.int32=l.next,x.quick=x,p&&(typeof p=="object"&&o(p,l),x.state=function(){return o(l,{})}),x}n&&n.exports?n.exports=s:this.tychei=s})(Dv,t)}(xo)),xo.exports}var bo={exports:{}};const Ov=xp(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Mv=bo.exports,Wu;function Nv(){return Wu||(Wu=1,function(t){(function(e,n,r){var i=256,o=6,s=52,f="random",u=r.pow(i,o),l=r.pow(2,s),p=l*2,x=i-1,S;function D(H,fe,Re){var Ge=[];fe=fe==!0?{entropy:!0}:fe||{};var Ye=se(Te(fe.entropy?[H,He(n)]:H??Ue(),3),Ge),at=new Y(Ge),ut=function(){for(var Ae=at.g(o),lt=u,it=0;Ae<l;)Ae=(Ae+it)*i,lt*=i,it=at.g(1);for(;Ae>=p;)Ae/=2,lt/=2,it>>>=1;return(Ae+it)/lt};return ut.int32=function(){return at.g(4)|0},ut.quick=function(){return at.g(4)/4294967296},ut.double=ut,se(He(at.S),n),(fe.pass||Re||function(Ae,lt,it,N){return N&&(N.S&&Ee(N,at),Ae.state=function(){return Ee(at,{})}),it?(r[f]=Ae,lt):Ae})(ut,Ye,"global"in fe?fe.global:this==r,fe.state)}function Y(H){var fe,Re=H.length,Ge=this,Ye=0,at=Ge.i=Ge.j=0,ut=Ge.S=[];for(Re||(H=[Re++]);Ye<i;)ut[Ye]=Ye++;for(Ye=0;Ye<i;Ye++)ut[Ye]=ut[at=x&at+H[Ye%Re]+(fe=ut[Ye])],ut[at]=fe;(Ge.g=function(Ae){for(var lt,it=0,N=Ge.i,Ce=Ge.j,re=Ge.S;Ae--;)lt=re[N=x&N+1],it=it*i+re[x&(re[N]=re[Ce=x&Ce+lt])+(re[Ce]=lt)];return Ge.i=N,Ge.j=Ce,it})(i)}function Ee(H,fe){return fe.i=H.i,fe.j=H.j,fe.S=H.S.slice(),fe}function Te(H,fe){var Re=[],Ge=typeof H,Ye;if(fe&&Ge=="object")for(Ye in H)try{Re.push(Te(H[Ye],fe-1))}catch{}return Re.length?Re:Ge=="string"?H:H+"\0"}function se(H,fe){for(var Re=H+"",Ge,Ye=0;Ye<Re.length;)fe[x&Ye]=x&(Ge^=fe[x&Ye]*19)+Re.charCodeAt(Ye++);return He(fe)}function Ue(){try{var H;return S&&(H=S.randomBytes)?H=H(i):(H=new Uint8Array(i),(e.crypto||e.msCrypto).getRandomValues(H)),He(H)}catch{var fe=e.navigator,Re=fe&&fe.plugins;return[+new Date,e,Re,e.screen,He(n)]}}function He(H){return String.fromCharCode.apply(0,H)}if(se(r.random(),n),t.exports){t.exports=D;try{S=Ov}catch{}}else r["seed"+f]=D})(typeof self<"u"?self:Mv,[],Math)}(bo)),bo.exports}var Ka,qu;function Gv(){if(qu)return Ka;qu=1;var t=Av(),e=Pv(),n=kv(),r=Fv(),i=Iv(),o=zv(),s=Nv();return s.alea=t,s.xor128=e,s.xorwow=n,s.xorshift7=r,s.xor4096=i,s.tychei=o,Ka=s,Ka}var Bv=Gv();const Uv=Da(Bv);function Vv(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,Hv(r.key),r)}}function Ja(t,e,n){return e&&Vv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yu(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,es(t,e)}function es(t,e){return es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},es(t,e)}function $v(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Hv(t){var e=$v(t,"string");return typeof e=="symbol"?e:String(e)}var _o=function(){function t(){}var e=t.prototype;return e._seed=function(r,i){if(r===(r||0))return r;for(var o=""+r,s=0,f=0;f<o.length;++f)s^=o.charCodeAt(f)|0;return s},t}(),Zu=function(t){Yu(e,t);function e(r,i){var o;return o=t.call(this)||this,o._rng=void 0,o.seed(r,i),o}var n=e.prototype;return n.next=function(){return this._rng()},n.seed=function(i,o){this._rng=i},n.clone=function(i,o){return new e(this._rng,o)},Ja(e,[{key:"name",get:function(){return"function"}}]),e}(_o),Qu=function(){var t=[].slice.call(arguments),e=t,n=e[0],r=n===void 0?"default":n;switch(typeof r){case"object":if(r instanceof _o)return r;break;case"function":return new Zu(r);case"number":case"string":default:return new Zu(Uv.apply(void 0,t))}throw new Error('invalid RNG "'+r+'"')},jv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){return t.next()*(n-e)+e}};function pn(t){return new Xv(t)}var Xv=function(e){var n=this;this.n=void 0,this.isInt=function(){if(Number.isInteger(n.n))return n;throw new Error("Expected number to be an integer, got "+n.n)},this.isPositive=function(){if(n.n>0)return n;throw new Error("Expected number to be positive, got "+n.n)},this.lessThan=function(r){if(n.n<r)return n;throw new Error("Expected number to be less than "+r+", got "+n.n)},this.greaterThanOrEqual=function(r){if(n.n>=r)return n;throw new Error("Expected number to be greater than or equal to "+r+", got "+n.n)},this.greaterThan=function(r){if(n.n>r)return n;throw new Error("Expected number to be greater than "+r+", got "+n.n)},this.n=e},Wv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),n===void 0&&(n=e===void 0?1:e,e=0),pn(e).isInt(),pn(n).isInt(),function(){return Math.floor(t.next()*(n-e+1)+e)}},qv=function(t){return function(){return t.next()>=.5}},Yv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){var r,i,o;do r=t.next()*2-1,i=t.next()*2-1,o=r*r+i*i;while(!o||o>1);return e+n*i*Math.sqrt(-2*Math.log(o)/o)}},Zv=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=1);var r=t.normal(e,n);return function(){return Math.exp(r())}},Qv=function(t,e){return e===void 0&&(e=.5),pn(e).greaterThanOrEqual(0).lessThan(1),function(){return Math.floor(t.next()+e)}},Kv=function(t,e,n){return e===void 0&&(e=1),n===void 0&&(n=.5),pn(e).isInt().isPositive(),pn(n).greaterThanOrEqual(0).lessThan(1),function(){for(var r=0,i=0;r++<e;)t.next()<n&&i++;return i}},Jv=function(t,e){e===void 0&&(e=.5),pn(e).greaterThan(0).lessThan(1);var n=1/Math.log(1-e);return function(){return Math.floor(1+Math.log(t.next())*n)}},eg=[0,0,.6931471805599453,1.791759469228055,3.1780538303479458,4.787491742782046,6.579251212010101,8.525161361065415,10.60460290274525,12.801827480081469],tg=function(e){return eg[e]},ng=.9189385332046727,rg=function(t,e){if(e===void 0&&(e=1),pn(e).isPositive(),e<10){var n=Math.exp(-e);return function(){for(var u=n,l=0,p=t.next();p>u;)p=p-u,u=e*u/++l;return l}}else{var r=Math.sqrt(e),i=.931+2.53*r,o=-.059+.02483*i,s=1.1239+1.1328/(i-3.4),f=.9277-3.6224/(i-2);return function(){for(;;){var u=void 0,l=t.next();if(l<=.86*f)return u=l/f-.43,Math.floor((2*o/(.5-Math.abs(u))+i)*u+e+.445);l>=f?u=t.next()-.5:(u=l/f-.93,u=(u<0?-.5:.5)-u,l=t.next()*f);var p=.5-Math.abs(u);if(!(p<.013&&l>p)){var x=Math.floor((2*o/p+i)*u+e+.445);if(l=l*s/(o/(p*p)+i),x>=10){var S=(x+.5)*Math.log(e/x)-e-ng+x-(.08333333333333333-(.002777777777777778-1/(1260*x*x))/(x*x))/x;if(Math.log(l*r)<=S)return x}else if(x>=0){var D,Y=(D=tg(x))!=null?D:0;if(Math.log(l)<=x*Math.log(e)-e-Y)return x}}}}}},ig=function(t,e){return e===void 0&&(e=1),pn(e).isPositive(),function(){return-Math.log(1-t.next())/e}},og=function(t,e){return e===void 0&&(e=1),pn(e).isInt().greaterThanOrEqual(0),function(){for(var n=0,r=0;r<e;++r)n+=t.next();return n}},ag=function(t,e){e===void 0&&(e=1),pn(e).isInt().isPositive();var n=t.irwinHall(e);return function(){return n()/e}},sg=function(t,e){e===void 0&&(e=1),pn(e).greaterThanOrEqual(0);var n=1/e;return function(){return 1/Math.pow(1-t.next(),n)}},fg=function(t){Yu(e,t);function e(){return t.apply(this,arguments)||this}var n=e.prototype;return n.next=function(){return Math.random()},n.seed=function(i,o){},n.clone=function(){return new e},Ja(e,[{key:"name",get:function(){return"default"}}]),e}(_o),Ku=function(){function t(n){var r=this;this._rng=void 0,this._patch=void 0,this._cache={},this.next=function(){return r._rng.next()},this.float=function(i,o){return r.uniform(i,o)()},this.int=function(i,o){return r.uniformInt(i,o)()},this.integer=function(i,o){return r.uniformInt(i,o)()},this.bool=function(){return r.uniformBoolean()()},this.boolean=function(){return r.uniformBoolean()()},this.uniform=function(i,o){return r._memoize("uniform",jv,i,o)},this.uniformInt=function(i,o){return r._memoize("uniformInt",Wv,i,o)},this.uniformBoolean=function(){return r._memoize("uniformBoolean",qv)},this.normal=function(i,o){return Yv(r,i,o)},this.logNormal=function(i,o){return Zv(r,i,o)},this.bernoulli=function(i){return Qv(r,i)},this.binomial=function(i,o){return Kv(r,i,o)},this.geometric=function(i){return Jv(r,i)},this.poisson=function(i){return rg(r,i)},this.exponential=function(i){return ig(r,i)},this.irwinHall=function(i){return og(r,i)},this.bates=function(i){return ag(r,i)},this.pareto=function(i){return sg(r,i)},n&&n instanceof _o?this.use(n):this.use(new fg),this._cache={}}var e=t.prototype;return e.clone=function(){var r=[].slice.call(arguments);return r.length?new t(Qu.apply(void 0,r)):new t(this.rng.clone())},e.use=function(){this._rng=Qu.apply(void 0,[].slice.call(arguments))},e.patch=function(){if(this._patch)throw new Error("Math.random already patched");this._patch=Math.random,Math.random=this.uniform()},e.unpatch=function(){this._patch&&(Math.random=this._patch,delete this._patch)},e.choice=function(r){if(!Array.isArray(r))throw new Error("Random.choice expected input to be an array, got "+typeof r);var i=r==null?void 0:r.length;if(i>0){var o=this.uniformInt(0,i-1)();return r[o]}else return},e._memoize=function(r,i){var o=[].slice.call(arguments,2),s=""+o.join(";"),f=this._cache[r];return(f===void 0||f.key!==s)&&(f={key:s,distribution:i.apply(void 0,[this].concat(o))},this._cache[r]=f),f.distribution},Ja(t,[{key:"rng",get:function(){return this._rng}}]),t}();new Ku;const ts=.001,ns=64;class ug{constructor(){this.pointsTextureSize=0,this.linksTextureSize=0,this.alpha=1,this.transform=Sv(),this.screenSize=[0,0],this.mousePosition=[0,0],this.screenMousePosition=[0,0],this.selectedArea=[[0,0],[0,0]],this.isSimulationRunning=!1,this.simulationProgress=0,this.selectedIndices=null,this.maxPointSize=ns,this.hoveredPoint=void 0,this.focusedPoint=void 0,this.draggingPointIndex=void 0,this.adjustedSpaceSize=We.spaceSize,this.isSpaceKeyPressed=!1,this.hoveredPointRingColor=[1,1,1,Dp],this.focusedPointRingColor=[1,1,1,zp],this.greyoutPointColor=[-1,-1,-1,-1],this.darkenGreyout=!1,this.alphaTarget=0,this.scalePointX=Za(),this.scalePointY=Za(),this.random=new Ku,this._backgroundColor=[0,0,0,0],this.alphaDecay=e=>1-Math.pow(ts,1/e)}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e;const n=du(e[0],e[1],e[2]);document.documentElement.style.setProperty("--cosmosgl-attribution-color",n>.65?"black":"white"),document.documentElement.style.setProperty("--cosmosgl-error-message-color",n>.65?"black":"white"),this.div&&(this.div.style.backgroundColor=`rgba(${e[0]*255}, ${e[1]*255}, ${e[2]*255}, ${e[3]})`),this.darkenGreyout=n<.65}addRandomSeed(e){this.random=this.random.clone(e)}getRandomFloat(e,n){return this.random.float(e,n)}adjustSpaceSize(e,n){e>=n?(this.adjustedSpaceSize=n/2,console.warn(`The \`spaceSize\` has been reduced to ${this.adjustedSpaceSize} due to WebGL limits`)):this.adjustedSpaceSize=e}updateScreenSize(e,n){const{adjustedSpaceSize:r}=this;this.screenSize=[e,n],this.scalePointX.domain([0,r]).range([(e-r)/2,(e+r)/2]),this.scalePointY.domain([r,0]).range([(n-r)/2,(n+r)/2])}scaleX(e){return this.scalePointX(e)}scaleY(e){return this.scalePointY(e)}setHoveredPointRingColor(e){const n=Vn(e);this.hoveredPointRingColor[0]=n[0],this.hoveredPointRingColor[1]=n[1],this.hoveredPointRingColor[2]=n[2]}setFocusedPointRingColor(e){const n=Vn(e);this.focusedPointRingColor[0]=n[0],this.focusedPointRingColor[1]=n[1],this.focusedPointRingColor[2]=n[2]}setGreyoutPointColor(e){if(e===void 0){this.greyoutPointColor=[-1,-1,-1,-1];return}const n=Vn(e);this.greyoutPointColor[0]=n[0],this.greyoutPointColor[1]=n[1],this.greyoutPointColor[2]=n[2],this.greyoutPointColor[3]=n[3]}setFocusedPoint(e){e!==void 0?this.focusedPoint={index:e}:this.focusedPoint=void 0}addAlpha(e){return(this.alphaTarget-this.alpha)*this.alphaDecay(e)}}const lg={passive:!1},pi={capture:!0,passive:!1};function rs(t){t.stopImmediatePropagation()}function Rr(t){t.preventDefault(),t.stopImmediatePropagation()}function Ju(t){var e=t.document.documentElement,n=Dt(t).on("dragstart.drag",Rr,pi);"onselectstart"in e?n.on("selectstart.drag",Rr,pi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function el(t,e){var n=t.document.documentElement,r=Dt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Rr,pi),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const So=t=>()=>t;function is(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:s,y:f,dx:u,dy:l,dispatch:p}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:p}})}is.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function cg(t){return!t.ctrlKey&&!t.button}function hg(){return this.parentNode}function dg(t,e){return e??{x:t.x,y:t.y}}function mg(){return navigator.maxTouchPoints||"ontouchstart"in this}function pg(){var t=cg,e=hg,n=dg,r=mg,i={},o=Vi("start","drag","end"),s=0,f,u,l,p,x=0;function S(H){H.on("mousedown.drag",D).filter(r).on("touchstart.drag",Te).on("touchmove.drag",se,lg).on("touchend.drag touchcancel.drag",Ue).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function D(H,fe){if(!(p||!t.call(this,H,fe))){var Re=He(this,e.call(this,H,fe),H,fe,"mouse");Re&&(Dt(H.view).on("mousemove.drag",Y,pi).on("mouseup.drag",Ee,pi),Ju(H.view),rs(H),l=!1,f=H.clientX,u=H.clientY,Re("start",H))}}function Y(H){if(Rr(H),!l){var fe=H.clientX-f,Re=H.clientY-u;l=fe*fe+Re*Re>x}i.mouse("drag",H)}function Ee(H){Dt(H.view).on("mousemove.drag mouseup.drag",null),el(H.view,l),Rr(H),i.mouse("end",H)}function Te(H,fe){if(t.call(this,H,fe)){var Re=H.changedTouches,Ge=e.call(this,H,fe),Ye=Re.length,at,ut;for(at=0;at<Ye;++at)(ut=He(this,Ge,H,fe,Re[at].identifier,Re[at]))&&(rs(H),ut("start",H,Re[at]))}}function se(H){var fe=H.changedTouches,Re=fe.length,Ge,Ye;for(Ge=0;Ge<Re;++Ge)(Ye=i[fe[Ge].identifier])&&(Rr(H),Ye("drag",H,fe[Ge]))}function Ue(H){var fe=H.changedTouches,Re=fe.length,Ge,Ye;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),Ge=0;Ge<Re;++Ge)(Ye=i[fe[Ge].identifier])&&(rs(H),Ye("end",H,fe[Ge]))}function He(H,fe,Re,Ge,Ye,at){var ut=o.copy(),Ae=kn(at||Re,fe),lt,it,N;if((N=n.call(H,new is("beforestart",{sourceEvent:Re,target:S,identifier:Ye,active:s,x:Ae[0],y:Ae[1],dx:0,dy:0,dispatch:ut}),Ge))!=null)return lt=N.x-Ae[0]||0,it=N.y-Ae[1]||0,function Ce(re,ke,Xe){var je=Ae,Qe;switch(re){case"start":i[Ye]=Ce,Qe=s++;break;case"end":delete i[Ye],--s;case"drag":Ae=kn(Xe||ke,fe),Qe=s;break}ut.call(re,H,new is(re,{sourceEvent:ke,subject:N,target:S,identifier:Ye,active:Qe,x:Ae[0]+lt,y:Ae[1]+it,dx:Ae[0]-je[0],dy:Ae[1]-je[1],dispatch:ut}),Ge)}}return S.filter=function(H){return arguments.length?(t=typeof H=="function"?H:So(!!H),S):t},S.container=function(H){return arguments.length?(e=typeof H=="function"?H:So(H),S):e},S.subject=function(H){return arguments.length?(n=typeof H=="function"?H:So(H),S):n},S.touchable=function(H){return arguments.length?(r=typeof H=="function"?H:So(!!H),S):r},S.on=function(){var H=o.on.apply(o,arguments);return H===o?S:H},S.clickDistance=function(H){return arguments.length?(x=(H=+H)*H,S):Math.sqrt(x)},S}const To=t=>()=>t;function vg(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Dn(t,e,n){this.k=t,this.x=e,this.y=n}Dn.prototype={constructor:Dn,scale:function(t){return t===1?this:new Dn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Dn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vi=new Dn(1,0,0);Dn.prototype;function os(t){t.stopImmediatePropagation()}function gi(t){t.preventDefault(),t.stopImmediatePropagation()}function gg(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function yg(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function tl(){return this.__zoom||vi}function xg(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function bg(){return navigator.maxTouchPoints||"ontouchstart"in this}function _g(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Sg(){var t=gg,e=yg,n=_g,r=xg,i=bg,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],f=250,u=hm,l=Vi("start","zoom","end"),p,x,S,D=500,Y=150,Ee=0,Te=10;function se(N){N.property("__zoom",tl).on("wheel.zoom",Ye,{passive:!1}).on("mousedown.zoom",at).on("dblclick.zoom",ut).filter(i).on("touchstart.zoom",Ae).on("touchmove.zoom",lt).on("touchend.zoom touchcancel.zoom",it).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}se.transform=function(N,Ce,re,ke){var Xe=N.selection?N.selection():N;Xe.property("__zoom",tl),N!==Xe?fe(N,Ce,re,ke):Xe.interrupt().each(function(){Re(this,arguments).event(ke).start().zoom(null,typeof Ce=="function"?Ce.apply(this,arguments):Ce).end()})},se.scaleBy=function(N,Ce,re,ke){se.scaleTo(N,function(){var Xe=this.__zoom.k,je=typeof Ce=="function"?Ce.apply(this,arguments):Ce;return Xe*je},re,ke)},se.scaleTo=function(N,Ce,re,ke){se.transform(N,function(){var Xe=e.apply(this,arguments),je=this.__zoom,Qe=re==null?H(Xe):typeof re=="function"?re.apply(this,arguments):re,Ze=je.invert(Qe),dt=typeof Ce=="function"?Ce.apply(this,arguments):Ce;return n(He(Ue(je,dt),Qe,Ze),Xe,s)},re,ke)},se.translateBy=function(N,Ce,re,ke){se.transform(N,function(){return n(this.__zoom.translate(typeof Ce=="function"?Ce.apply(this,arguments):Ce,typeof re=="function"?re.apply(this,arguments):re),e.apply(this,arguments),s)},null,ke)},se.translateTo=function(N,Ce,re,ke,Xe){se.transform(N,function(){var je=e.apply(this,arguments),Qe=this.__zoom,Ze=ke==null?H(je):typeof ke=="function"?ke.apply(this,arguments):ke;return n(vi.translate(Ze[0],Ze[1]).scale(Qe.k).translate(typeof Ce=="function"?-Ce.apply(this,arguments):-Ce,typeof re=="function"?-re.apply(this,arguments):-re),je,s)},ke,Xe)};function Ue(N,Ce){return Ce=Math.max(o[0],Math.min(o[1],Ce)),Ce===N.k?N:new Dn(Ce,N.x,N.y)}function He(N,Ce,re){var ke=Ce[0]-re[0]*N.k,Xe=Ce[1]-re[1]*N.k;return ke===N.x&&Xe===N.y?N:new Dn(N.k,ke,Xe)}function H(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function fe(N,Ce,re,ke){N.on("start.zoom",function(){Re(this,arguments).event(ke).start()}).on("interrupt.zoom end.zoom",function(){Re(this,arguments).event(ke).end()}).tween("zoom",function(){var Xe=this,je=arguments,Qe=Re(Xe,je).event(ke),Ze=e.apply(Xe,je),dt=re==null?H(Ze):typeof re=="function"?re.apply(Xe,je):re,ct=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),_t=Xe.__zoom,st=typeof Ce=="function"?Ce.apply(Xe,je):Ce,$t=u(_t.invert(dt).concat(ct/_t.k),st.invert(dt).concat(ct/st.k));return function(Ht){if(Ht===1)Ht=st;else{var Qt=$t(Ht),zn=ct/Qt[2];Ht=new Dn(zn,dt[0]-Qt[0]*zn,dt[1]-Qt[1]*zn)}Qe.zoom(null,Ht)}})}function Re(N,Ce,re){return!re&&N.__zooming||new Ge(N,Ce)}function Ge(N,Ce){this.that=N,this.args=Ce,this.active=0,this.sourceEvent=null,this.extent=e.apply(N,Ce),this.taps=0}Ge.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,Ce){return this.mouse&&N!=="mouse"&&(this.mouse[1]=Ce.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=Ce.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=Ce.invert(this.touch1[0])),this.that.__zoom=Ce,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var Ce=Dt(this.that).datum();l.call(N,this.that,new vg(N,{sourceEvent:this.sourceEvent,target:se,transform:this.that.__zoom,dispatch:l}),Ce)}};function Ye(N,...Ce){if(!t.apply(this,arguments))return;var re=Re(this,Ce).event(N),ke=this.__zoom,Xe=Math.max(o[0],Math.min(o[1],ke.k*Math.pow(2,r.apply(this,arguments)))),je=kn(N);if(re.wheel)(re.mouse[0][0]!==je[0]||re.mouse[0][1]!==je[1])&&(re.mouse[1]=ke.invert(re.mouse[0]=je)),clearTimeout(re.wheel);else{if(ke.k===Xe)return;re.mouse=[je,ke.invert(je)],Qi(this),re.start()}gi(N),re.wheel=setTimeout(Qe,Y),re.zoom("mouse",n(He(Ue(ke,Xe),re.mouse[0],re.mouse[1]),re.extent,s));function Qe(){re.wheel=null,re.end()}}function at(N,...Ce){if(S||!t.apply(this,arguments))return;var re=N.currentTarget,ke=Re(this,Ce,!0).event(N),Xe=Dt(N.view).on("mousemove.zoom",dt,!0).on("mouseup.zoom",ct,!0),je=kn(N,re),Qe=N.clientX,Ze=N.clientY;Ju(N.view),os(N),ke.mouse=[je,this.__zoom.invert(je)],Qi(this),ke.start();function dt(_t){if(gi(_t),!ke.moved){var st=_t.clientX-Qe,$t=_t.clientY-Ze;ke.moved=st*st+$t*$t>Ee}ke.event(_t).zoom("mouse",n(He(ke.that.__zoom,ke.mouse[0]=kn(_t,re),ke.mouse[1]),ke.extent,s))}function ct(_t){Xe.on("mousemove.zoom mouseup.zoom",null),el(_t.view,ke.moved),gi(_t),ke.event(_t).end()}}function ut(N,...Ce){if(t.apply(this,arguments)){var re=this.__zoom,ke=kn(N.changedTouches?N.changedTouches[0]:N,this),Xe=re.invert(ke),je=re.k*(N.shiftKey?.5:2),Qe=n(He(Ue(re,je),ke,Xe),e.apply(this,Ce),s);gi(N),f>0?Dt(this).transition().duration(f).call(fe,Qe,ke,N):Dt(this).call(se.transform,Qe,ke,N)}}function Ae(N,...Ce){if(t.apply(this,arguments)){var re=N.touches,ke=re.length,Xe=Re(this,Ce,N.changedTouches.length===ke).event(N),je,Qe,Ze,dt;for(os(N),Qe=0;Qe<ke;++Qe)Ze=re[Qe],dt=kn(Ze,this),dt=[dt,this.__zoom.invert(dt),Ze.identifier],Xe.touch0?!Xe.touch1&&Xe.touch0[2]!==dt[2]&&(Xe.touch1=dt,Xe.taps=0):(Xe.touch0=dt,je=!0,Xe.taps=1+!!p);p&&(p=clearTimeout(p)),je&&(Xe.taps<2&&(x=dt[0],p=setTimeout(function(){p=null},D)),Qi(this),Xe.start())}}function lt(N,...Ce){if(this.__zooming){var re=Re(this,Ce).event(N),ke=N.changedTouches,Xe=ke.length,je,Qe,Ze,dt;for(gi(N),je=0;je<Xe;++je)Qe=ke[je],Ze=kn(Qe,this),re.touch0&&re.touch0[2]===Qe.identifier?re.touch0[0]=Ze:re.touch1&&re.touch1[2]===Qe.identifier&&(re.touch1[0]=Ze);if(Qe=re.that.__zoom,re.touch1){var ct=re.touch0[0],_t=re.touch0[1],st=re.touch1[0],$t=re.touch1[1],Ht=(Ht=st[0]-ct[0])*Ht+(Ht=st[1]-ct[1])*Ht,Qt=(Qt=$t[0]-_t[0])*Qt+(Qt=$t[1]-_t[1])*Qt;Qe=Ue(Qe,Math.sqrt(Ht/Qt)),Ze=[(ct[0]+st[0])/2,(ct[1]+st[1])/2],dt=[(_t[0]+$t[0])/2,(_t[1]+$t[1])/2]}else if(re.touch0)Ze=re.touch0[0],dt=re.touch0[1];else return;re.zoom("touch",n(He(Qe,Ze,dt),re.extent,s))}}function it(N,...Ce){if(this.__zooming){var re=Re(this,Ce).event(N),ke=N.changedTouches,Xe=ke.length,je,Qe;for(os(N),S&&clearTimeout(S),S=setTimeout(function(){S=null},D),je=0;je<Xe;++je)Qe=ke[je],re.touch0&&re.touch0[2]===Qe.identifier?delete re.touch0:re.touch1&&re.touch1[2]===Qe.identifier&&delete re.touch1;if(re.touch1&&!re.touch0&&(re.touch0=re.touch1,delete re.touch1),re.touch0)re.touch0[1]=this.__zoom.invert(re.touch0[0]);else if(re.end(),re.taps===2&&(Qe=kn(Qe,this),Math.hypot(x[0]-Qe[0],x[1]-Qe[1])<Te)){var Ze=Dt(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return se.wheelDelta=function(N){return arguments.length?(r=typeof N=="function"?N:To(+N),se):r},se.filter=function(N){return arguments.length?(t=typeof N=="function"?N:To(!!N),se):t},se.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:To(!!N),se):i},se.extent=function(N){return arguments.length?(e=typeof N=="function"?N:To([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),se):e},se.scaleExtent=function(N){return arguments.length?(o[0]=+N[0],o[1]=+N[1],se):[o[0],o[1]]},se.translateExtent=function(N){return arguments.length?(s[0][0]=+N[0][0],s[1][0]=+N[1][0],s[0][1]=+N[0][1],s[1][1]=+N[1][1],se):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},se.constrain=function(N){return arguments.length?(n=N,se):n},se.duration=function(N){return arguments.length?(f=+N,se):f},se.interpolate=function(N){return arguments.length?(u=N,se):u},se.on=function(){var N=l.on.apply(l,arguments);return N===l?se:N},se.clickDistance=function(N){return arguments.length?(Ee=(N=+N)*N,se):Math.sqrt(Ee)},se.tapDistance=function(N){return arguments.length?(Te=+N,se):Te},se}class Tg{constructor(e,n){this.eventTransform=vi,this.behavior=Sg().scaleExtent([.001,1/0]).on("start",r=>{var o,s;this.isRunning=!0;const i=!!r.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomStart)==null||s.call(o,r,i)}).on("zoom",r=>{var S,D;this.eventTransform=r.transform;const{eventTransform:{x:i,y:o,k:s},store:{transform:f,screenSize:u}}=this,l=u[0],p=u[1];if(!l||!p)return;Tv(f,l,p),Bu(f,f,[i,o]),Qa(f,f,[s,s]),Bu(f,f,[l/2,p/2]),Qa(f,f,[l/2,p/2]),Qa(f,f,[1,-1]);const x=!!r.sourceEvent;(D=(S=this.config)==null?void 0:S.onZoom)==null||D.call(S,r,x)}).on("end",r=>{var o,s;this.isRunning=!1;const i=!!r.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomEnd)==null||s.call(o,r,i)}),this.isRunning=!1,this.store=e,this.config=n}getTransform(e,n,r=.1){if(e.length===0)return this.eventTransform;const{store:{screenSize:i}}=this,o=i[0],s=i[1],f=Su(e.map(se=>se[0])),u=Su(e.map(se=>se[1]));f[0]=this.store.scaleX(f[0]),f[1]=this.store.scaleX(f[1]),u[0]=this.store.scaleY(u[0]),u[1]=this.store.scaleY(u[1]),f[0]===f[1]&&(f[0]-=.5,f[1]+=.5),u[0]===u[1]&&(u[0]+=.5,u[1]-=.5);const l=o*(1-r*2)/(f[1]-f[0]),p=s*(1-r*2)/(u[0]-u[1]),x=mu(n??Math.min(l,p),...this.behavior.scaleExtent()),S=(f[1]+f[0])/2,D=(u[1]+u[0])/2,Y=o/2-S*x,Ee=s/2-D*x;return vi.translate(Y,Ee).scale(x)}getDistanceToPoint(e){const{x:n,y:r,k:i}=this.eventTransform,o=this.getTransform([e],i),s=n-o.x,f=r-o.y;return Math.sqrt(s*s+f*f)}getMiddlePointTransform(e){const{store:{screenSize:n},eventTransform:{x:r,y:i,k:o}}=this,s=n[0],f=n[1],u=(s/2-r)/o,l=(f/2-i)/o,p=this.store.scaleX(e[0]),x=this.store.scaleY(e[1]),S=(u+p)/2,D=(l+x)/2,Y=1,Ee=s/2-S*Y,Te=f/2-D*Y;return vi.translate(Ee,Te).scale(Y)}convertScreenToSpacePosition(e){const{eventTransform:{x:n,y:r,k:i},store:{screenSize:o}}=this,s=o[0],f=o[1],u=(e[0]-n)/i,l=(e[1]-r)/i,p=[u,f-l];return p[0]-=(s-this.store.adjustedSpaceSize)/2,p[1]-=(f-this.store.adjustedSpaceSize)/2,p}convertSpaceToScreenPosition(e){const n=this.eventTransform.applyX(this.store.scaleX(e[0])),r=this.eventTransform.applyY(this.store.scaleY(e[1]));return[n,r]}convertSpaceToScreenRadius(e){const{config:{scalePointsOnZoom:n},store:{maxPointSize:r},eventTransform:{k:i}}=this;let o=e*2;return n?o*=i:o*=Math.min(5,Math.max(1,i*.01)),Math.min(o,r)/2}}class wg{constructor(e,n){this.isActive=!1,this.behavior=pg().subject(r=>this.store.hoveredPoint&&!this.store.isSpaceKeyPressed?{x:r.x,y:r.y}:void 0).on("start",r=>{var i,o;this.store.hoveredPoint&&(this.store.draggingPointIndex=this.store.hoveredPoint.index,this.isActive=!0,(o=(i=this.config)==null?void 0:i.onDragStart)==null||o.call(i,r))}).on("drag",r=>{var i,o;(o=(i=this.config)==null?void 0:i.onDrag)==null||o.call(i,r)}).on("end",r=>{var i,o;this.isActive=!1,this.store.draggingPointIndex=void 0,(o=(i=this.config)==null?void 0:i.onDragEnd)==null||o.call(i,r)}),this.store=e,this.config=n}}function Ag(t){const e=document.createElement("div");return e.style.cssText=`
|
|
1324
1347
|
color: var(--cosmosgl-error-message-color);
|
|
1325
1348
|
padding: 0em 2em;
|
|
1326
1349
|
position: absolute;
|
|
@@ -1331,7 +1354,7 @@ void main() {
|
|
|
1331
1354
|
font-size: 1rem;
|
|
1332
1355
|
text-align: center;
|
|
1333
1356
|
user-select: none;
|
|
1334
|
-
`,e.textContent="Sorry, your device or browser does not support the required WebGL features for this visualization",t.appendChild(e),e}class Eg{constructor(e,n){this.config=new o0,this.graph=new k0(this.config),this.requestAnimationFrameId=0,this.isRightClickMouse=!1,this.store=new ug,this.zoomInstance=new Tg(this.store,this.config),this.dragInstance=new wg(this.store,this.config),this._findHoveredPointExecutionCount=0,this._isMouseOnCanvas=!1,this._isFirstRenderAfterInit=!0,this._needsPointPositionsUpdate=!1,this._needsPointColorUpdate=!1,this._needsPointSizeUpdate=!1,this._needsLinksUpdate=!1,this._needsLinkColorUpdate=!1,this._needsLinkWidthUpdate=!1,this._needsLinkArrowUpdate=!1,this._needsPointClusterUpdate=!1,this._needsForceManyBodyUpdate=!1,this._needsForceLinkUpdate=!1,this._needsForceCenterUpdate=!1,this._isDestroyed=!1,n&&this.config.init(n),this.store.div=e;const r=document.createElement("canvas");r.style.width="100%",r.style.height="100%",this.store.div.appendChild(r),this.addAttribution();const i=r.clientWidth,o=r.clientHeight;r.width=i*this.config.pixelRatio,r.height=o*this.config.pixelRatio,this.canvas=r;let s;try{s=Tp({canvas:this.canvas,attributes:{antialias:!1,preserveDrawingBuffer:!0},extensions:["OES_texture_float","ANGLE_instanced_arrays"]})}catch{Ag(this.store.div),this._isDestroyed=!0;return}this.reglInstance=s,this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.store.updateScreenSize(i,o),this.canvasD3Selection=Dt(this.canvas),this.canvasD3Selection.on("mouseenter.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mousemove.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mouseleave.cosmos",()=>{this._isMouseOnCanvas=!1}),Dt(document).on("keydown.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!0)}).on("keyup.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!1)}),this.zoomInstance.behavior.on("start.detect",f=>{this.currentEvent=f}).on("zoom.detect",f=>{!!f.sourceEvent&&this.updateMousePosition(f.sourceEvent),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f}),this.dragInstance.behavior.on("start.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}).on("drag.detect",f=>{this.dragInstance.isActive&&this.updateMousePosition(f),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}),this.canvasD3Selection.call(this.dragInstance.behavior).call(this.zoomInstance.behavior).on("click",this.onClick.bind(this)).on("mousemove",this.onMouseMove.bind(this)).on("contextmenu",this.onRightClickMouse.bind(this)),(!this.config.enableZoom||!this.config.enableDrag)&&this.updateZoomDragBehaviors(),this.setZoomLevel(this.config.initialZoomLevel??1),this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??ns)/this.config.pixelRatio,this.points=new _v(this.reglInstance,this.config,this.store,this.graph),this.lines=new sv(this.reglInstance,this.config,this.store,this.graph,this.points),this.config.enableSimulation&&(this.forceGravity=new c0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceCenter=new u0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceManyBody=this.config.useClassicQuadtree?new g0(this.reglInstance,this.config,this.store,this.graph,this.points):new p0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkIncoming=new vu(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkOutgoing=new vu(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceMouse=new x0(this.reglInstance,this.config,this.store,this.graph,this.points)),this.clusters=new T0(this.reglInstance,this.config,this.store,this.graph,this.points),this.store.backgroundColor=Vn(this.config.backgroundColor),this.config.hoveredPointRingColor&&this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor),this.config.focusedPointRingColor&&this.store.setFocusedPointRingColor(this.config.focusedPointRingColor),this.config.focusedPointIndex!==void 0&&this.store.setFocusedPoint(this.config.focusedPointIndex),this.config.pointGreyoutColor&&this.store.setGreyoutPointColor(this.config.pointGreyoutColor),this.config.showFPSMonitor&&(this.fpsMonitor=new bu(this.canvas)),this.config.randomSeed!==void 0&&this.store.addRandomSeed(this.config.randomSeed)}get progress(){return this._isDestroyed?0:this.store.simulationProgress}get isSimulationRunning(){return this._isDestroyed?!1:this.store.isSimulationRunning}get maxPointSize(){return this._isDestroyed?0:this.store.maxPointSize}setConfig(e){var r;if(this._isDestroyed||!this.reglInstance||!this.points||!this.lines||!this.clusters)return;const n={...this.config};this.config.init(e),n.pointColor!==this.config.pointColor&&(this.graph.updatePointColor(),this.points.updateColor()),n.pointSize!==this.config.pointSize&&(this.graph.updatePointSize(),this.points.updateSize()),n.linkColor!==this.config.linkColor&&(this.graph.updateLinkColor(),this.lines.updateColor()),n.linkWidth!==this.config.linkWidth&&(this.graph.updateLinkWidth(),this.lines.updateWidth()),n.linkArrows!==this.config.linkArrows&&(this.graph.updateArrows(),this.lines.updateArrow()),(n.curvedLinkSegments!==this.config.curvedLinkSegments||n.curvedLinks!==this.config.curvedLinks)&&this.lines.updateCurveLineGeometry(),n.backgroundColor!==this.config.backgroundColor&&(this.store.backgroundColor=Vn(this.config.backgroundColor)),n.hoveredPointRingColor!==this.config.hoveredPointRingColor&&this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor),n.focusedPointRingColor!==this.config.focusedPointRingColor&&this.store.setFocusedPointRingColor(this.config.focusedPointRingColor),n.pointGreyoutColor!==this.config.pointGreyoutColor&&this.store.setGreyoutPointColor(this.config.pointGreyoutColor),n.focusedPointIndex!==this.config.focusedPointIndex&&this.store.setFocusedPoint(this.config.focusedPointIndex),(n.spaceSize!==this.config.spaceSize||n.simulationRepulsionQuadtreeLevels!==this.config.simulationRepulsionQuadtreeLevels)&&(this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.resizeCanvas(!0),this.update(this.store.isSimulationRunning?this.store.alpha:0)),n.showFPSMonitor!==this.config.showFPSMonitor&&(this.config.showFPSMonitor?this.fpsMonitor=new bu(this.canvas):((r=this.fpsMonitor)==null||r.destroy(),this.fpsMonitor=void 0)),n.pixelRatio!==this.config.pixelRatio&&(this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??ns)/this.config.pixelRatio),(n.enableZoom!==this.config.enableZoom||n.enableDrag!==this.config.enableDrag)&&this.updateZoomDragBehaviors()}setPointPositions(e,n){this._isDestroyed||!this.points||(this.graph.inputPointPositions=e,this.points.dontRescale=n,this._needsPointPositionsUpdate=!0,this._needsLinksUpdate=!0,this._needsPointColorUpdate=!0,this._needsPointSizeUpdate=!0,this._needsPointClusterUpdate=!0,this._needsForceManyBodyUpdate=!0,this._needsForceLinkUpdate=!0,this._needsForceCenterUpdate=!0)}setPointColors(e){this._isDestroyed||(this.graph.inputPointColors=e,this._needsPointColorUpdate=!0)}getPointColors(){return this._isDestroyed?new Float32Array:this.graph.pointColors??new Float32Array}setPointSizes(e){this._isDestroyed||(this.graph.inputPointSizes=e,this._needsPointSizeUpdate=!0)}getPointSizes(){return this._isDestroyed?new Float32Array:this.graph.pointSizes??new Float32Array}setLinks(e){this._isDestroyed||(this.graph.inputLinks=e,this._needsLinksUpdate=!0,this._needsLinkColorUpdate=!0,this._needsLinkWidthUpdate=!0,this._needsLinkArrowUpdate=!0,this._needsForceLinkUpdate=!0)}setLinkColors(e){this._isDestroyed||(this.graph.inputLinkColors=e,this._needsLinkColorUpdate=!0)}getLinkColors(){return this._isDestroyed?new Float32Array:this.graph.linkColors??new Float32Array}setLinkWidths(e){this._isDestroyed||(this.graph.inputLinkWidths=e,this._needsLinkWidthUpdate=!0)}getLinkWidths(){return this._isDestroyed?new Float32Array:this.graph.linkWidths??new Float32Array}setLinkArrows(e){this._isDestroyed||(this.graph.linkArrowsBoolean=e,this._needsLinkArrowUpdate=!0)}setLinkStrength(e){this._isDestroyed||(this.graph.inputLinkStrength=e,this._needsForceLinkUpdate=!0)}setPointClusters(e){this._isDestroyed||(this.graph.inputPointClusters=e,this._needsPointClusterUpdate=!0)}setClusterPositions(e){this._isDestroyed||(this.graph.inputClusterPositions=e,this._needsPointClusterUpdate=!0)}setPointClusterStrength(e){this._isDestroyed||(this.graph.inputClusterStrength=e,this._needsPointClusterUpdate=!0)}render(e){if(this._isDestroyed||!this.reglInstance)return;this.graph.update();const{fitViewOnInit:n,fitViewDelay:r,fitViewPadding:i,fitViewDuration:o,fitViewByPointsInRect:s,initialZoomLevel:f}=this.config;if(!this.graph.pointsNumber&&!this.graph.linksNumber){this.stopFrames(),Dt(this.canvas).style("cursor",null),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0});return}this._isFirstRenderAfterInit&&n&&f===void 0&&(this._fitViewOnInitTimeoutID=window.setTimeout(()=>{s?this.setZoomTransformByPointPositions(s,o,void 0,i):this.fitView(o,i)},r)),this._isFirstRenderAfterInit=!1,this.update(e)}zoomToPointByIndex(e,n=700,r=Op,i=!0){if(this._isDestroyed||!this.reglInstance||!this.points||!this.canvasD3Selection)return;const{store:{screenSize:o}}=this,s=tn(this.reglInstance,this.points.currentPositionFbo);if(e===void 0)return;const f=s[e*4+0],u=s[e*4+1];if(f===void 0||u===void 0)return;const l=this.zoomInstance.getDistanceToPoint([f,u]),v=i?r:Math.max(this.getZoomLevel(),r);if(l<Math.min(o[0],o[1]))this.setZoomTransformByPointPositions([f,u],n,v);else{const b=this.zoomInstance.getTransform([[f,u]],v),S=this.zoomInstance.getMiddlePointTransform([f,u]);this.canvasD3Selection.transition().ease(hp).duration(n/2).call(this.zoomInstance.behavior.transform,S).transition().ease(dp).duration(n/2).call(this.zoomInstance.behavior.transform,b)}}zoom(e,n=0){this._isDestroyed||this.setZoomLevel(e,n)}setZoomLevel(e,n=0){this._isDestroyed||!this.canvasD3Selection||(n===0?this.canvasD3Selection.call(this.zoomInstance.behavior.scaleTo,e):this.canvasD3Selection.transition().duration(n).call(this.zoomInstance.behavior.scaleTo,e))}getZoomLevel(){return this._isDestroyed?0:this.zoomInstance.eventTransform.k}getPointPositions(){if(this._isDestroyed||!this.reglInstance||!this.points)return[];if(this.graph.pointsNumber===void 0)return[];const e=[],n=tn(this.reglInstance,this.points.currentPositionFbo);e.length=this.graph.pointsNumber*2;for(let r=0;r<this.graph.pointsNumber;r+=1){const i=n[r*4+0],o=n[r*4+1];i!==void 0&&o!==void 0&&(e[r*2]=i,e[r*2+1]=o)}return e}getClusterPositions(){if(this._isDestroyed||!this.reglInstance||!this.clusters)return[];if(this.graph.pointClusters===void 0||this.clusters.clusterCount===void 0)return[];this.clusters.calculateCentermass();const e=[],n=tn(this.reglInstance,this.clusters.centermassFbo);e.length=this.clusters.clusterCount*2;for(let r=0;r<e.length/2;r+=1){const i=n[r*4+0],o=n[r*4+1],s=n[r*4+2];i!==void 0&&o!==void 0&&s!==void 0&&(e[r*2]=i/s,e[r*2+1]=o/s)}return e}fitView(e=250,n=.1){this._isDestroyed||this.setZoomTransformByPointPositions(this.getPointPositions(),e,void 0,n)}fitViewByPointIndices(e,n=250,r=.1){if(this._isDestroyed)return;const i=this.getPointPositions(),o=new Array(e.length*2);for(const[s,f]of e.entries())o[s*2]=i[f*2],o[s*2+1]=i[f*2+1];this.setZoomTransformByPointPositions(o,n,void 0,r)}fitViewByPointPositions(e,n=250,r=.1){this._isDestroyed||this.setZoomTransformByPointPositions(e,n,void 0,r)}getPointsInRect(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;const n=this.store.screenSize[1];return this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection(),tn(this.reglInstance,this.points.selectedFbo).map((i,o)=>o%4===0&&i!==0?o/4:-1).filter(i=>i!==-1)}getPointsInRange(e){return this.getPointsInRect(e)}getPointsInPolygon(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;if(e.length<3)return new Float32Array;const n=this.store.screenSize[1],r=e.map(([o,s])=>[o,n-s]);return this.points.updatePolygonPath(r),this.points.findPointsOnPolygonSelection(),tn(this.reglInstance,this.points.selectedFbo).map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}selectPointsInRect(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){const n=this.store.screenSize[1];this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection();const r=tn(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=r.map((i,o)=>o%4===0&&i!==0?o/4:-1).filter(i=>i!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointsInRange(e){return this.selectPointsInRect(e)}selectPointsInPolygon(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){if(e.length<3){console.warn("Polygon path requires at least 3 points to form a polygon.");return}const n=this.store.screenSize[1],r=e.map(([o,s])=>[o,n-s]);this.points.updatePolygonPath(r),this.points.findPointsOnPolygonSelection();const i=tn(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=i.map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointByIndex(e,n=!1){if(!this._isDestroyed)if(n){const r=this.graph.getAdjacentIndices(e)??[];this.selectPointsByIndices([e,...r])}else this.selectPointsByIndices([e])}selectPointsByIndices(e){this._isDestroyed||!this.points||(e?e.length===0?this.store.selectedIndices=new Float32Array:this.store.selectedIndices=new Float32Array(e.filter(n=>n!==void 0)):this.store.selectedIndices=null,this.points.updateGreyoutStatus())}unselectPoints(){this._isDestroyed||!this.points||(this.store.selectedIndices=null,this.points.updateGreyoutStatus())}getSelectedIndices(){if(this._isDestroyed)return null;const{selectedIndices:e}=this.store;return e?Array.from(e):null}getAdjacentIndices(e){if(!this._isDestroyed)return this.graph.getAdjacentIndices(e)}spaceToScreenPosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertSpaceToScreenPosition(e)}screenToSpacePosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertScreenToSpacePosition(e)}spaceToScreenRadius(e){return this._isDestroyed?0:this.zoomInstance.convertSpaceToScreenRadius(e)}getPointRadiusByIndex(e){var n;if(!this._isDestroyed)return(n=this.graph.pointSizes)==null?void 0:n[e]}trackPointPositionsByIndices(e){this._isDestroyed||!this.points||this.points.trackPointsByIndices(e)}getTrackedPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getTrackedPositionsMap()}getTrackedPointPositionsArray(){return this._isDestroyed||!this.points?[]:this.points.getTrackedPositionsArray()}getSampledPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getSampledPointPositionsMap()}getSampledPoints(){return this._isDestroyed||!this.points?{indices:[],positions:[]}:this.points.getSampledPoints()}getScaleX(){if(!(this._isDestroyed||!this.points))return this.points.scaleX}getScaleY(){if(!(this._isDestroyed||!this.points))return this.points.scaleY}start(e=1){var n,r;this._isDestroyed||this.graph.pointsNumber&&(e>0&&(this.store.isSimulationRunning=!0,this.store.simulationProgress=0,(r=(n=this.config).onSimulationStart)==null||r.call(n)),this.store.alpha=e,this.stopFrames(),this.frame())}pause(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!1,(n=(e=this.config).onSimulationPause)==null||n.call(e))}restart(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!0,(n=(e=this.config).onSimulationRestart)==null||n.call(e))}step(){this._isDestroyed||(this.store.isSimulationRunning=!1,this.stopFrames(),this.frame())}destroy(){var e,n,r,i;this._isDestroyed||!this.reglInstance||(window.clearTimeout(this._fitViewOnInitTimeoutID),this.stopFrames(),this.canvasD3Selection&&this.canvasD3Selection.on("mouseenter.cosmos",null).on("mousemove.cosmos",null).on("mouseleave.cosmos",null).on("click",null).on("mousemove",null).on("contextmenu",null).on(".drag",null).on(".zoom",null),Dt(document).on("keydown.cosmos",null).on("keyup.cosmos",null),(e=this.zoomInstance)!=null&&e.behavior&&this.zoomInstance.behavior.on("start.detect",null).on("zoom.detect",null).on("end.detect",null),(n=this.dragInstance)!=null&&n.behavior&&this.dragInstance.behavior.on("start.detect",null).on("drag.detect",null).on("end.detect",null),(r=this.fpsMonitor)==null||r.destroy(),this.reglInstance.destroy(),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0}),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.attributionDivElement&&this.attributionDivElement.parentNode&&this.attributionDivElement.parentNode.removeChild(this.attributionDivElement),(i=document.getElementById("gl-bench-style"))==null||i.remove(),this.canvasD3Selection=void 0,this.reglInstance=void 0,this.attributionDivElement=void 0,this._isDestroyed=!0)}create(){var e,n,r,i,o;this._isDestroyed||!this.points||!this.lines||(this._needsPointPositionsUpdate&&this.points.updatePositions(),this._needsPointColorUpdate&&this.points.updateColor(),this._needsPointSizeUpdate&&this.points.updateSize(),this._needsLinksUpdate&&this.lines.updatePointsBuffer(),this._needsLinkColorUpdate&&this.lines.updateColor(),this._needsLinkWidthUpdate&&this.lines.updateWidth(),this._needsLinkArrowUpdate&&this.lines.updateArrow(),this._needsForceManyBodyUpdate&&((e=this.forceManyBody)==null||e.create()),this._needsForceLinkUpdate&&((n=this.forceLinkIncoming)==null||n.create(Ha.INCOMING),(r=this.forceLinkOutgoing)==null||r.create(Ha.OUTGOING)),this._needsForceCenterUpdate&&((i=this.forceCenter)==null||i.create()),this._needsPointClusterUpdate&&((o=this.clusters)==null||o.create()),this._needsPointPositionsUpdate=!1,this._needsPointColorUpdate=!1,this._needsPointSizeUpdate=!1,this._needsLinksUpdate=!1,this._needsLinkColorUpdate=!1,this._needsLinkWidthUpdate=!1,this._needsLinkArrowUpdate=!1,this._needsPointClusterUpdate=!1,this._needsForceManyBodyUpdate=!1,this._needsForceLinkUpdate=!1,this._needsForceCenterUpdate=!1)}flatten(e){return e.flat()}pair(e){const n=new Array(e.length/2);for(let r=0;r<e.length/2;r++)n[r]=[e[r*2],e[r*2+1]];return n}update(e=this.store.alpha){const{graph:n}=this;this.store.pointsTextureSize=Math.ceil(Math.sqrt(n.pointsNumber??0)),this.store.linksTextureSize=Math.ceil(Math.sqrt((n.linksNumber??0)*2)),this.create(),this.initPrograms(),this.store.hoveredPoint=void 0,this.start(e)}initPrograms(){var e,n,r,i,o,s;this._isDestroyed||!this.points||!this.lines||!this.clusters||(this.points.initPrograms(),this.lines.initPrograms(),(e=this.forceGravity)==null||e.initPrograms(),(n=this.forceLinkIncoming)==null||n.initPrograms(),(r=this.forceLinkOutgoing)==null||r.initPrograms(),(i=this.forceMouse)==null||i.initPrograms(),(o=this.forceManyBody)==null||o.initPrograms(),(s=this.forceCenter)==null||s.initPrograms(),this.clusters.initPrograms())}frame(){const{config:{simulationGravity:e,simulationCenter:n,renderLinks:r,enableSimulation:i},store:{alpha:o,isSimulationRunning:s}}=this;o<ts&&s&&this.end(),this.store.pointsTextureSize&&(this.requestAnimationFrameId=window.requestAnimationFrame(f=>{var u,l,v,b,S,D,Y,Ee,Te,se,Ue,He,H,fe,Re,Ge,Ye,at,ut,Ae,lt,it,N,Ce,re,ke;(u=this.fpsMonitor)==null||u.begin(),this.resizeCanvas(),this.dragInstance.isActive||this.findHoveredPoint(),i&&(this.isRightClickMouse&&this.config.enableRightClickRepulsion&&((l=this.forceMouse)==null||l.run(),(v=this.points)==null||v.updatePosition()),s&&!(this.zoomInstance.isRunning&&!this.config.enableSimulationDuringZoom)&&(e&&((b=this.forceGravity)==null||b.run(),(S=this.points)==null||S.updatePosition()),n&&((D=this.forceCenter)==null||D.run(),(Y=this.points)==null||Y.updatePosition()),(Ee=this.forceManyBody)==null||Ee.run(),(Te=this.points)==null||Te.updatePosition(),this.store.linksTextureSize&&((se=this.forceLinkIncoming)==null||se.run(),(Ue=this.points)==null||Ue.updatePosition(),(He=this.forceLinkOutgoing)==null||He.run(),(H=this.points)==null||H.updatePosition()),(this.graph.pointClusters||this.graph.clusterPositions)&&((fe=this.clusters)==null||fe.run(),(Re=this.points)==null||Re.updatePosition()),this.store.alpha+=this.store.addAlpha(this.config.simulationDecay??We.simulation.decay),this.isRightClickMouse&&this.config.enableRightClickRepulsion&&(this.store.alpha=Math.max(this.store.alpha,.1)),this.store.simulationProgress=Math.sqrt(Math.min(1,ts/this.store.alpha)),(ut=(at=this.config).onSimulationTick)==null||ut.call(at,this.store.alpha,(Ge=this.store.hoveredPoint)==null?void 0:Ge.index,(Ye=this.store.hoveredPoint)==null?void 0:Ye.position)),(Ae=this.points)==null||Ae.trackPoints()),(lt=this.reglInstance)==null||lt.clear({color:this.store.backgroundColor,depth:1,stencil:0}),r&&this.store.linksTextureSize&&((it=this.lines)==null||it.draw()),(N=this.points)==null||N.draw(),this.dragInstance.isActive&&((Ce=this.points)==null||Ce.drag(),(re=this.points)==null||re.drag()),(ke=this.fpsMonitor)==null||ke.end(f),this.currentEvent=void 0,this.frame()}))}stopFrames(){this.requestAnimationFrameId&&window.cancelAnimationFrame(this.requestAnimationFrameId)}end(){var e,n;this.store.isSimulationRunning=!1,this.store.simulationProgress=1,(n=(e=this.config).onSimulationEnd)==null||n.call(e)}onClick(e){var n,r,i,o;(o=(i=this.config).onClick)==null||o.call(i,(n=this.store.hoveredPoint)==null?void 0:n.index,(r=this.store.hoveredPoint)==null?void 0:r.position,e)}updateMousePosition(e){if(!e)return;const n=e.offsetX??e.x,r=e.offsetY??e.y;n===void 0||r===void 0||(this.store.mousePosition=this.zoomInstance.convertScreenToSpacePosition([n,r]),this.store.screenMousePosition=[n,this.store.screenSize[1]-r])}onMouseMove(e){var n,r,i,o;this.currentEvent=e,this.updateMousePosition(e),this.isRightClickMouse=e.which===3,(o=(i=this.config).onMouseMove)==null||o.call(i,(n=this.store.hoveredPoint)==null?void 0:n.index,(r=this.store.hoveredPoint)==null?void 0:r.position,this.currentEvent)}onRightClickMouse(e){e.preventDefault()}resizeCanvas(e=!1){var s,f,u;const n=this.canvas.width,r=this.canvas.height,i=this.canvas.clientWidth,o=this.canvas.clientHeight;if(e||n!==i*this.config.pixelRatio||r!==o*this.config.pixelRatio){const[l,v]=this.store.screenSize,{k:b}=this.zoomInstance.eventTransform,S=this.zoomInstance.convertScreenToSpacePosition([l/2,v/2]);this.store.updateScreenSize(i,o),this.canvas.width=i*this.config.pixelRatio,this.canvas.height=o*this.config.pixelRatio,(s=this.reglInstance)==null||s.poll(),(f=this.canvasD3Selection)==null||f.call(this.zoomInstance.behavior.transform,this.zoomInstance.getTransform([S],b)),(u=this.points)==null||u.updateSampledPointsGrid()}}setZoomTransformByPointPositions(e,n=250,r,i){var s;this.resizeCanvas();const o=this.zoomInstance.getTransform(this.pair(e),r,i);(s=this.canvasD3Selection)==null||s.transition().ease(mp).duration(n).call(this.zoomInstance.behavior.transform,o)}updateZoomDragBehaviors(){var e,n,r,i;this.config.enableDrag?(e=this.canvasD3Selection)==null||e.call(this.dragInstance.behavior):(n=this.canvasD3Selection)==null||n.call(this.dragInstance.behavior).on(".drag",null),this.config.enableZoom?(r=this.canvasD3Selection)==null||r.call(this.zoomInstance.behavior):(i=this.canvasD3Selection)==null||i.call(this.zoomInstance.behavior).on("wheel.zoom",null)}findHoveredPoint(){var o,s,f,u,l;if(!this._isMouseOnCanvas||!this.reglInstance||!this.points)return;if(this._findHoveredPointExecutionCount<2){this._findHoveredPointExecutionCount+=1;return}this._findHoveredPointExecutionCount=0,this.points.findHoveredPoint();let e=!1,n=!1;const r=tn(this.reglInstance,this.points.hoveredFbo);if(r[1]){const v=r[0];((o=this.store.hoveredPoint)==null?void 0:o.index)!==v&&(e=!0);const b=r[2],S=r[3];this.store.hoveredPoint={index:v,position:[b,S]}}else this.store.hoveredPoint&&(n=!0),this.store.hoveredPoint=void 0;e&&this.store.hoveredPoint&&((f=(s=this.config).onPointMouseOver)==null||f.call(s,this.store.hoveredPoint.index,this.store.hoveredPoint.position,this.currentEvent)),n&&((l=(u=this.config).onPointMouseOut)==null||l.call(u,this.currentEvent)),this.updateCanvasCursor()}updateCanvasCursor(){const{hoveredPointCursor:e}=this.config;this.dragInstance.isActive?Dt(this.canvas).style("cursor","grabbing"):this.store.hoveredPoint?!this.config.enableDrag||this.store.isSpaceKeyPressed?Dt(this.canvas).style("cursor",e):Dt(this.canvas).style("cursor","grab"):Dt(this.canvas).style("cursor",null)}addAttribution(){var e;this.config.attribution&&(this.attributionDivElement=document.createElement("div"),this.attributionDivElement.style.cssText=`
|
|
1357
|
+
`,e.textContent="Sorry, your device or browser does not support the required WebGL features for this visualization",t.appendChild(e),e}class Eg{constructor(e,n){this.config=new o0,this.graph=new k0(this.config),this.requestAnimationFrameId=0,this.isRightClickMouse=!1,this.store=new ug,this.zoomInstance=new Tg(this.store,this.config),this.dragInstance=new wg(this.store,this.config),this._findHoveredPointExecutionCount=0,this._isMouseOnCanvas=!1,this._isFirstRenderAfterInit=!0,this._needsPointPositionsUpdate=!1,this._needsPointColorUpdate=!1,this._needsPointSizeUpdate=!1,this._needsLinksUpdate=!1,this._needsLinkColorUpdate=!1,this._needsLinkWidthUpdate=!1,this._needsLinkArrowUpdate=!1,this._needsPointClusterUpdate=!1,this._needsForceManyBodyUpdate=!1,this._needsForceLinkUpdate=!1,this._needsForceCenterUpdate=!1,this._isDestroyed=!1,n&&this.config.init(n),this.store.div=e;const r=document.createElement("canvas");r.style.width="100%",r.style.height="100%",this.store.div.appendChild(r),this.addAttribution();const i=r.clientWidth,o=r.clientHeight;r.width=i*this.config.pixelRatio,r.height=o*this.config.pixelRatio,this.canvas=r;let s;try{s=Tp({canvas:this.canvas,attributes:{antialias:!1,preserveDrawingBuffer:!0},extensions:["OES_texture_float","ANGLE_instanced_arrays"]})}catch{Ag(this.store.div),this._isDestroyed=!0;return}this.reglInstance=s,this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.store.updateScreenSize(i,o),this.canvasD3Selection=Dt(this.canvas),this.canvasD3Selection.on("mouseenter.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mousemove.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mouseleave.cosmos",()=>{this._isMouseOnCanvas=!1}),Dt(document).on("keydown.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!0)}).on("keyup.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!1)}),this.zoomInstance.behavior.on("start.detect",f=>{this.currentEvent=f}).on("zoom.detect",f=>{!!f.sourceEvent&&this.updateMousePosition(f.sourceEvent),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f}),this.dragInstance.behavior.on("start.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}).on("drag.detect",f=>{this.dragInstance.isActive&&this.updateMousePosition(f),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}),this.canvasD3Selection.call(this.dragInstance.behavior).call(this.zoomInstance.behavior).on("click",this.onClick.bind(this)).on("mousemove",this.onMouseMove.bind(this)).on("contextmenu",this.onRightClickMouse.bind(this)),(!this.config.enableZoom||!this.config.enableDrag)&&this.updateZoomDragBehaviors(),this.setZoomLevel(this.config.initialZoomLevel??1),this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??ns)/this.config.pixelRatio,this.points=new _v(this.reglInstance,this.config,this.store,this.graph),this.lines=new sv(this.reglInstance,this.config,this.store,this.graph,this.points),this.config.enableSimulation&&(this.forceGravity=new c0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceCenter=new u0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceManyBody=this.config.useClassicQuadtree?new g0(this.reglInstance,this.config,this.store,this.graph,this.points):new p0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkIncoming=new vu(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkOutgoing=new vu(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceMouse=new x0(this.reglInstance,this.config,this.store,this.graph,this.points)),this.clusters=new T0(this.reglInstance,this.config,this.store,this.graph,this.points),this.store.backgroundColor=Vn(this.config.backgroundColor),this.config.hoveredPointRingColor&&this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor),this.config.focusedPointRingColor&&this.store.setFocusedPointRingColor(this.config.focusedPointRingColor),this.config.focusedPointIndex!==void 0&&this.store.setFocusedPoint(this.config.focusedPointIndex),this.config.pointGreyoutColor&&this.store.setGreyoutPointColor(this.config.pointGreyoutColor),this.config.showFPSMonitor&&(this.fpsMonitor=new bu(this.canvas)),this.config.randomSeed!==void 0&&this.store.addRandomSeed(this.config.randomSeed)}get progress(){return this._isDestroyed?0:this.store.simulationProgress}get isSimulationRunning(){return this._isDestroyed?!1:this.store.isSimulationRunning}get maxPointSize(){return this._isDestroyed?0:this.store.maxPointSize}setConfig(e){var r;if(this._isDestroyed||!this.reglInstance||!this.points||!this.lines||!this.clusters)return;const n={...this.config};this.config.init(e),n.pointColor!==this.config.pointColor&&(this.graph.updatePointColor(),this.points.updateColor()),n.pointSize!==this.config.pointSize&&(this.graph.updatePointSize(),this.points.updateSize()),n.linkColor!==this.config.linkColor&&(this.graph.updateLinkColor(),this.lines.updateColor()),n.linkWidth!==this.config.linkWidth&&(this.graph.updateLinkWidth(),this.lines.updateWidth()),n.linkArrows!==this.config.linkArrows&&(this.graph.updateArrows(),this.lines.updateArrow()),(n.curvedLinkSegments!==this.config.curvedLinkSegments||n.curvedLinks!==this.config.curvedLinks)&&this.lines.updateCurveLineGeometry(),n.backgroundColor!==this.config.backgroundColor&&(this.store.backgroundColor=Vn(this.config.backgroundColor)),n.hoveredPointRingColor!==this.config.hoveredPointRingColor&&this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor),n.focusedPointRingColor!==this.config.focusedPointRingColor&&this.store.setFocusedPointRingColor(this.config.focusedPointRingColor),n.pointGreyoutColor!==this.config.pointGreyoutColor&&this.store.setGreyoutPointColor(this.config.pointGreyoutColor),n.focusedPointIndex!==this.config.focusedPointIndex&&this.store.setFocusedPoint(this.config.focusedPointIndex),(n.spaceSize!==this.config.spaceSize||n.simulationRepulsionQuadtreeLevels!==this.config.simulationRepulsionQuadtreeLevels)&&(this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.resizeCanvas(!0),this.update(this.store.isSimulationRunning?this.store.alpha:0)),n.showFPSMonitor!==this.config.showFPSMonitor&&(this.config.showFPSMonitor?this.fpsMonitor=new bu(this.canvas):((r=this.fpsMonitor)==null||r.destroy(),this.fpsMonitor=void 0)),n.pixelRatio!==this.config.pixelRatio&&(this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??ns)/this.config.pixelRatio),(n.enableZoom!==this.config.enableZoom||n.enableDrag!==this.config.enableDrag)&&this.updateZoomDragBehaviors()}setPointPositions(e,n){this._isDestroyed||!this.points||(this.graph.inputPointPositions=e,this.points.dontRescale=n,this._needsPointPositionsUpdate=!0,this._needsLinksUpdate=!0,this._needsPointColorUpdate=!0,this._needsPointSizeUpdate=!0,this._needsPointClusterUpdate=!0,this._needsForceManyBodyUpdate=!0,this._needsForceLinkUpdate=!0,this._needsForceCenterUpdate=!0)}setPointColors(e){this._isDestroyed||(this.graph.inputPointColors=e,this._needsPointColorUpdate=!0)}getPointColors(){return this._isDestroyed?new Float32Array:this.graph.pointColors??new Float32Array}setPointSizes(e){this._isDestroyed||(this.graph.inputPointSizes=e,this._needsPointSizeUpdate=!0)}getPointSizes(){return this._isDestroyed?new Float32Array:this.graph.pointSizes??new Float32Array}setLinks(e){this._isDestroyed||(this.graph.inputLinks=e,this._needsLinksUpdate=!0,this._needsLinkColorUpdate=!0,this._needsLinkWidthUpdate=!0,this._needsLinkArrowUpdate=!0,this._needsForceLinkUpdate=!0)}setLinkColors(e){this._isDestroyed||(this.graph.inputLinkColors=e,this._needsLinkColorUpdate=!0)}getLinkColors(){return this._isDestroyed?new Float32Array:this.graph.linkColors??new Float32Array}setLinkWidths(e){this._isDestroyed||(this.graph.inputLinkWidths=e,this._needsLinkWidthUpdate=!0)}getLinkWidths(){return this._isDestroyed?new Float32Array:this.graph.linkWidths??new Float32Array}setLinkArrows(e){this._isDestroyed||(this.graph.linkArrowsBoolean=e,this._needsLinkArrowUpdate=!0)}setLinkStrength(e){this._isDestroyed||(this.graph.inputLinkStrength=e,this._needsForceLinkUpdate=!0)}setPointClusters(e){this._isDestroyed||(this.graph.inputPointClusters=e,this._needsPointClusterUpdate=!0)}setClusterPositions(e){this._isDestroyed||(this.graph.inputClusterPositions=e,this._needsPointClusterUpdate=!0)}setPointClusterStrength(e){this._isDestroyed||(this.graph.inputClusterStrength=e,this._needsPointClusterUpdate=!0)}render(e){if(this._isDestroyed||!this.reglInstance)return;this.graph.update();const{fitViewOnInit:n,fitViewDelay:r,fitViewPadding:i,fitViewDuration:o,fitViewByPointsInRect:s,initialZoomLevel:f}=this.config;if(!this.graph.pointsNumber&&!this.graph.linksNumber){this.stopFrames(),Dt(this.canvas).style("cursor",null),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0});return}this._isFirstRenderAfterInit&&n&&f===void 0&&(this._fitViewOnInitTimeoutID=window.setTimeout(()=>{s?this.setZoomTransformByPointPositions(s,o,void 0,i):this.fitView(o,i)},r)),this._isFirstRenderAfterInit=!1,this.update(e)}zoomToPointByIndex(e,n=700,r=Op,i=!0){if(this._isDestroyed||!this.reglInstance||!this.points||!this.canvasD3Selection)return;const{store:{screenSize:o}}=this,s=tn(this.reglInstance,this.points.currentPositionFbo);if(e===void 0)return;const f=s[e*4+0],u=s[e*4+1];if(f===void 0||u===void 0)return;const l=this.zoomInstance.getDistanceToPoint([f,u]),p=i?r:Math.max(this.getZoomLevel(),r);if(l<Math.min(o[0],o[1]))this.setZoomTransformByPointPositions([f,u],n,p);else{const x=this.zoomInstance.getTransform([[f,u]],p),S=this.zoomInstance.getMiddlePointTransform([f,u]);this.canvasD3Selection.transition().ease(hp).duration(n/2).call(this.zoomInstance.behavior.transform,S).transition().ease(dp).duration(n/2).call(this.zoomInstance.behavior.transform,x)}}zoom(e,n=0){this._isDestroyed||this.setZoomLevel(e,n)}setZoomLevel(e,n=0){this._isDestroyed||!this.canvasD3Selection||(n===0?this.canvasD3Selection.call(this.zoomInstance.behavior.scaleTo,e):this.canvasD3Selection.transition().duration(n).call(this.zoomInstance.behavior.scaleTo,e))}getZoomLevel(){return this._isDestroyed?0:this.zoomInstance.eventTransform.k}getPointPositions(){if(this._isDestroyed||!this.reglInstance||!this.points)return[];if(this.graph.pointsNumber===void 0)return[];const e=[],n=tn(this.reglInstance,this.points.currentPositionFbo);e.length=this.graph.pointsNumber*2;for(let r=0;r<this.graph.pointsNumber;r+=1){const i=n[r*4+0],o=n[r*4+1];i!==void 0&&o!==void 0&&(e[r*2]=i,e[r*2+1]=o)}return e}getClusterPositions(){if(this._isDestroyed||!this.reglInstance||!this.clusters)return[];if(this.graph.pointClusters===void 0||this.clusters.clusterCount===void 0)return[];this.clusters.calculateCentermass();const e=[],n=tn(this.reglInstance,this.clusters.centermassFbo);e.length=this.clusters.clusterCount*2;for(let r=0;r<e.length/2;r+=1){const i=n[r*4+0],o=n[r*4+1],s=n[r*4+2];i!==void 0&&o!==void 0&&s!==void 0&&(e[r*2]=i/s,e[r*2+1]=o/s)}return e}fitView(e=250,n=.1){this._isDestroyed||this.setZoomTransformByPointPositions(this.getPointPositions(),e,void 0,n)}fitViewByPointIndices(e,n=250,r=.1){if(this._isDestroyed)return;const i=this.getPointPositions(),o=new Array(e.length*2);for(const[s,f]of e.entries())o[s*2]=i[f*2],o[s*2+1]=i[f*2+1];this.setZoomTransformByPointPositions(o,n,void 0,r)}fitViewByPointPositions(e,n=250,r=.1){this._isDestroyed||this.setZoomTransformByPointPositions(e,n,void 0,r)}getPointsInRect(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;const n=this.store.screenSize[1];return this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection(),tn(this.reglInstance,this.points.selectedFbo).map((i,o)=>o%4===0&&i!==0?o/4:-1).filter(i=>i!==-1)}getPointsInRange(e){return this.getPointsInRect(e)}getPointsInPolygon(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;if(e.length<3)return new Float32Array;const n=this.store.screenSize[1],r=e.map(([o,s])=>[o,n-s]);return this.points.updatePolygonPath(r),this.points.findPointsOnPolygonSelection(),tn(this.reglInstance,this.points.selectedFbo).map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}selectPointsInRect(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){const n=this.store.screenSize[1];this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection();const r=tn(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=r.map((i,o)=>o%4===0&&i!==0?o/4:-1).filter(i=>i!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointsInRange(e){return this.selectPointsInRect(e)}selectPointsInPolygon(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){if(e.length<3){console.warn("Polygon path requires at least 3 points to form a polygon.");return}const n=this.store.screenSize[1],r=e.map(([o,s])=>[o,n-s]);this.points.updatePolygonPath(r),this.points.findPointsOnPolygonSelection();const i=tn(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=i.map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointByIndex(e,n=!1){if(!this._isDestroyed)if(n){const r=this.graph.getAdjacentIndices(e)??[];this.selectPointsByIndices([e,...r])}else this.selectPointsByIndices([e])}selectPointsByIndices(e){this._isDestroyed||!this.points||(e?e.length===0?this.store.selectedIndices=new Float32Array:this.store.selectedIndices=new Float32Array(e.filter(n=>n!==void 0)):this.store.selectedIndices=null,this.points.updateGreyoutStatus())}unselectPoints(){this._isDestroyed||!this.points||(this.store.selectedIndices=null,this.points.updateGreyoutStatus())}getSelectedIndices(){if(this._isDestroyed)return null;const{selectedIndices:e}=this.store;return e?Array.from(e):null}getAdjacentIndices(e){if(!this._isDestroyed)return this.graph.getAdjacentIndices(e)}spaceToScreenPosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertSpaceToScreenPosition(e)}screenToSpacePosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertScreenToSpacePosition(e)}spaceToScreenRadius(e){return this._isDestroyed?0:this.zoomInstance.convertSpaceToScreenRadius(e)}getPointRadiusByIndex(e){var n;if(!this._isDestroyed)return(n=this.graph.pointSizes)==null?void 0:n[e]}trackPointPositionsByIndices(e){this._isDestroyed||!this.points||this.points.trackPointsByIndices(e)}getTrackedPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getTrackedPositionsMap()}getTrackedPointPositionsArray(){return this._isDestroyed||!this.points?[]:this.points.getTrackedPositionsArray()}getSampledPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getSampledPointPositionsMap()}getSampledPoints(){return this._isDestroyed||!this.points?{indices:[],positions:[]}:this.points.getSampledPoints()}getScaleX(){if(!(this._isDestroyed||!this.points))return this.points.scaleX}getScaleY(){if(!(this._isDestroyed||!this.points))return this.points.scaleY}start(e=1){var n,r;this._isDestroyed||this.graph.pointsNumber&&(e>0&&(this.store.isSimulationRunning=!0,this.store.simulationProgress=0,(r=(n=this.config).onSimulationStart)==null||r.call(n)),this.store.alpha=e,this.stopFrames(),this.frame())}pause(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!1,(n=(e=this.config).onSimulationPause)==null||n.call(e))}restart(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!0,(n=(e=this.config).onSimulationRestart)==null||n.call(e))}step(){this._isDestroyed||(this.store.isSimulationRunning=!1,this.stopFrames(),this.frame())}destroy(){var e,n,r,i;this._isDestroyed||!this.reglInstance||(window.clearTimeout(this._fitViewOnInitTimeoutID),this.stopFrames(),this.canvasD3Selection&&this.canvasD3Selection.on("mouseenter.cosmos",null).on("mousemove.cosmos",null).on("mouseleave.cosmos",null).on("click",null).on("mousemove",null).on("contextmenu",null).on(".drag",null).on(".zoom",null),Dt(document).on("keydown.cosmos",null).on("keyup.cosmos",null),(e=this.zoomInstance)!=null&&e.behavior&&this.zoomInstance.behavior.on("start.detect",null).on("zoom.detect",null).on("end.detect",null),(n=this.dragInstance)!=null&&n.behavior&&this.dragInstance.behavior.on("start.detect",null).on("drag.detect",null).on("end.detect",null),(r=this.fpsMonitor)==null||r.destroy(),this.reglInstance.destroy(),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0}),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.attributionDivElement&&this.attributionDivElement.parentNode&&this.attributionDivElement.parentNode.removeChild(this.attributionDivElement),(i=document.getElementById("gl-bench-style"))==null||i.remove(),this.canvasD3Selection=void 0,this.reglInstance=void 0,this.attributionDivElement=void 0,this._isDestroyed=!0)}create(){var e,n,r,i,o;this._isDestroyed||!this.points||!this.lines||(this._needsPointPositionsUpdate&&this.points.updatePositions(),this._needsPointColorUpdate&&this.points.updateColor(),this._needsPointSizeUpdate&&this.points.updateSize(),this._needsLinksUpdate&&this.lines.updatePointsBuffer(),this._needsLinkColorUpdate&&this.lines.updateColor(),this._needsLinkWidthUpdate&&this.lines.updateWidth(),this._needsLinkArrowUpdate&&this.lines.updateArrow(),this._needsForceManyBodyUpdate&&((e=this.forceManyBody)==null||e.create()),this._needsForceLinkUpdate&&((n=this.forceLinkIncoming)==null||n.create(Ha.INCOMING),(r=this.forceLinkOutgoing)==null||r.create(Ha.OUTGOING)),this._needsForceCenterUpdate&&((i=this.forceCenter)==null||i.create()),this._needsPointClusterUpdate&&((o=this.clusters)==null||o.create()),this._needsPointPositionsUpdate=!1,this._needsPointColorUpdate=!1,this._needsPointSizeUpdate=!1,this._needsLinksUpdate=!1,this._needsLinkColorUpdate=!1,this._needsLinkWidthUpdate=!1,this._needsLinkArrowUpdate=!1,this._needsPointClusterUpdate=!1,this._needsForceManyBodyUpdate=!1,this._needsForceLinkUpdate=!1,this._needsForceCenterUpdate=!1)}flatten(e){return e.flat()}pair(e){const n=new Array(e.length/2);for(let r=0;r<e.length/2;r++)n[r]=[e[r*2],e[r*2+1]];return n}update(e=this.store.alpha){const{graph:n}=this;this.store.pointsTextureSize=Math.ceil(Math.sqrt(n.pointsNumber??0)),this.store.linksTextureSize=Math.ceil(Math.sqrt((n.linksNumber??0)*2)),this.create(),this.initPrograms(),this.store.hoveredPoint=void 0,this.start(e)}initPrograms(){var e,n,r,i,o,s;this._isDestroyed||!this.points||!this.lines||!this.clusters||(this.points.initPrograms(),this.lines.initPrograms(),(e=this.forceGravity)==null||e.initPrograms(),(n=this.forceLinkIncoming)==null||n.initPrograms(),(r=this.forceLinkOutgoing)==null||r.initPrograms(),(i=this.forceMouse)==null||i.initPrograms(),(o=this.forceManyBody)==null||o.initPrograms(),(s=this.forceCenter)==null||s.initPrograms(),this.clusters.initPrograms())}frame(){const{config:{simulationGravity:e,simulationCenter:n,renderLinks:r,enableSimulation:i},store:{alpha:o,isSimulationRunning:s}}=this;o<ts&&s&&this.end(),this.store.pointsTextureSize&&(this.requestAnimationFrameId=window.requestAnimationFrame(f=>{var u,l,p,x,S,D,Y,Ee,Te,se,Ue,He,H,fe,Re,Ge,Ye,at,ut,Ae,lt,it,N,Ce,re,ke;(u=this.fpsMonitor)==null||u.begin(),this.resizeCanvas(),this.dragInstance.isActive||this.findHoveredPoint(),i&&(this.isRightClickMouse&&this.config.enableRightClickRepulsion&&((l=this.forceMouse)==null||l.run(),(p=this.points)==null||p.updatePosition()),s&&!(this.zoomInstance.isRunning&&!this.config.enableSimulationDuringZoom)&&(e&&((x=this.forceGravity)==null||x.run(),(S=this.points)==null||S.updatePosition()),n&&((D=this.forceCenter)==null||D.run(),(Y=this.points)==null||Y.updatePosition()),(Ee=this.forceManyBody)==null||Ee.run(),(Te=this.points)==null||Te.updatePosition(),this.store.linksTextureSize&&((se=this.forceLinkIncoming)==null||se.run(),(Ue=this.points)==null||Ue.updatePosition(),(He=this.forceLinkOutgoing)==null||He.run(),(H=this.points)==null||H.updatePosition()),(this.graph.pointClusters||this.graph.clusterPositions)&&((fe=this.clusters)==null||fe.run(),(Re=this.points)==null||Re.updatePosition()),this.store.alpha+=this.store.addAlpha(this.config.simulationDecay??We.simulation.decay),this.isRightClickMouse&&this.config.enableRightClickRepulsion&&(this.store.alpha=Math.max(this.store.alpha,.1)),this.store.simulationProgress=Math.sqrt(Math.min(1,ts/this.store.alpha)),(ut=(at=this.config).onSimulationTick)==null||ut.call(at,this.store.alpha,(Ge=this.store.hoveredPoint)==null?void 0:Ge.index,(Ye=this.store.hoveredPoint)==null?void 0:Ye.position)),(Ae=this.points)==null||Ae.trackPoints()),(lt=this.reglInstance)==null||lt.clear({color:this.store.backgroundColor,depth:1,stencil:0}),r&&this.store.linksTextureSize&&((it=this.lines)==null||it.draw()),(N=this.points)==null||N.draw(),this.dragInstance.isActive&&((Ce=this.points)==null||Ce.drag(),(re=this.points)==null||re.drag()),(ke=this.fpsMonitor)==null||ke.end(f),this.currentEvent=void 0,this.frame()}))}stopFrames(){this.requestAnimationFrameId&&window.cancelAnimationFrame(this.requestAnimationFrameId)}end(){var e,n;this.store.isSimulationRunning=!1,this.store.simulationProgress=1,(n=(e=this.config).onSimulationEnd)==null||n.call(e)}onClick(e){var n,r,i,o;(o=(i=this.config).onClick)==null||o.call(i,(n=this.store.hoveredPoint)==null?void 0:n.index,(r=this.store.hoveredPoint)==null?void 0:r.position,e)}updateMousePosition(e){if(!e)return;const n=e.offsetX??e.x,r=e.offsetY??e.y;n===void 0||r===void 0||(this.store.mousePosition=this.zoomInstance.convertScreenToSpacePosition([n,r]),this.store.screenMousePosition=[n,this.store.screenSize[1]-r])}onMouseMove(e){var n,r,i,o;this.currentEvent=e,this.updateMousePosition(e),this.isRightClickMouse=e.which===3,(o=(i=this.config).onMouseMove)==null||o.call(i,(n=this.store.hoveredPoint)==null?void 0:n.index,(r=this.store.hoveredPoint)==null?void 0:r.position,this.currentEvent)}onRightClickMouse(e){e.preventDefault()}resizeCanvas(e=!1){var s,f,u;const n=this.canvas.width,r=this.canvas.height,i=this.canvas.clientWidth,o=this.canvas.clientHeight;if(e||n!==i*this.config.pixelRatio||r!==o*this.config.pixelRatio){const[l,p]=this.store.screenSize,{k:x}=this.zoomInstance.eventTransform,S=this.zoomInstance.convertScreenToSpacePosition([l/2,p/2]);this.store.updateScreenSize(i,o),this.canvas.width=i*this.config.pixelRatio,this.canvas.height=o*this.config.pixelRatio,(s=this.reglInstance)==null||s.poll(),(f=this.canvasD3Selection)==null||f.call(this.zoomInstance.behavior.transform,this.zoomInstance.getTransform([S],x)),(u=this.points)==null||u.updateSampledPointsGrid()}}setZoomTransformByPointPositions(e,n=250,r,i){var s;this.resizeCanvas();const o=this.zoomInstance.getTransform(this.pair(e),r,i);(s=this.canvasD3Selection)==null||s.transition().ease(mp).duration(n).call(this.zoomInstance.behavior.transform,o)}updateZoomDragBehaviors(){var e,n,r,i;this.config.enableDrag?(e=this.canvasD3Selection)==null||e.call(this.dragInstance.behavior):(n=this.canvasD3Selection)==null||n.call(this.dragInstance.behavior).on(".drag",null),this.config.enableZoom?(r=this.canvasD3Selection)==null||r.call(this.zoomInstance.behavior):(i=this.canvasD3Selection)==null||i.call(this.zoomInstance.behavior).on("wheel.zoom",null)}findHoveredPoint(){var o,s,f,u,l;if(!this._isMouseOnCanvas||!this.reglInstance||!this.points)return;if(this._findHoveredPointExecutionCount<2){this._findHoveredPointExecutionCount+=1;return}this._findHoveredPointExecutionCount=0,this.points.findHoveredPoint();let e=!1,n=!1;const r=tn(this.reglInstance,this.points.hoveredFbo);if(r[1]){const p=r[0];((o=this.store.hoveredPoint)==null?void 0:o.index)!==p&&(e=!0);const x=r[2],S=r[3];this.store.hoveredPoint={index:p,position:[x,S]}}else this.store.hoveredPoint&&(n=!0),this.store.hoveredPoint=void 0;e&&this.store.hoveredPoint&&((f=(s=this.config).onPointMouseOver)==null||f.call(s,this.store.hoveredPoint.index,this.store.hoveredPoint.position,this.currentEvent)),n&&((l=(u=this.config).onPointMouseOut)==null||l.call(u,this.currentEvent)),this.updateCanvasCursor()}updateCanvasCursor(){const{hoveredPointCursor:e}=this.config;this.dragInstance.isActive?Dt(this.canvas).style("cursor","grabbing"):this.store.hoveredPoint?!this.config.enableDrag||this.store.isSpaceKeyPressed?Dt(this.canvas).style("cursor",e):Dt(this.canvas).style("cursor","grab"):Dt(this.canvas).style("cursor",null)}addAttribution(){var e;this.config.attribution&&(this.attributionDivElement=document.createElement("div"),this.attributionDivElement.style.cssText=`
|
|
1335
1358
|
user-select: none;
|
|
1336
1359
|
position: absolute;
|
|
1337
1360
|
bottom: 0;
|