@hema-to/regl-scatterplot 1.14.1 → 1.16.0-hemato.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/README.md +94 -0
- package/dist/regl-scatterplot.esm.d.ts +2 -0
- package/dist/regl-scatterplot.esm.js +1678 -1538
- package/dist/regl-scatterplot.js +1747 -1756
- package/dist/regl-scatterplot.min.js +3 -8
- package/dist/types.d.ts +6 -7
- package/package.json +27 -27
- package/src/constants.js +1 -0
- package/src/index.js +217 -43
- package/src/kdbush-worker.js +0 -1
- package/src/kdbush.js +2 -3
- package/src/lasso-manager/index.js +6 -8
- package/src/renderer.js +2 -22
- package/src/spline-curve-worker.js +0 -3
- package/src/types.d.ts +6 -7
- package/src/utils.js +40 -4
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pub-sub-es"),require("regl")):"function"==typeof define&&define.amd?define(["exports","pub-sub-es","regl"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).createScatterplot={},e.createPubSub,e.createREGL)}(this,(function(e,n,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(n),i=r(t);function a(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function c(e,n,t,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,o)}function l(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function s(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=y(e))||n){t&&(e=t);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(c)throw i}}}}function u(e,n,t){return(n=p(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function f(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function d(){d=function(){return n};var e,n={},t=Object.prototype,r=t.hasOwnProperty,o=Object.defineProperty||function(e,n,t){e[n]=t.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{s({},"")}catch(e){s=function(e,n,t){return e[n]=t}}function u(e,n,t,r){var i=n&&n.prototype instanceof g?n:g,a=Object.create(i.prototype),c=new O(r||[]);return o(a,"_invoke",{value:I(e,t,c)}),a}function f(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}n.wrap=u;var v="suspendedStart",h="suspendedYield",p="executing",y="completed",m={};function g(){}function w(){}function x(){}var b={};s(b,a,(function(){return this}));var P=Object.getPrototypeOf,S=P&&P(P(R([])));S&&S!==t&&r.call(S,a)&&(b=S);var A=x.prototype=g.prototype=Object.create(b);function E(e){["next","throw","return"].forEach((function(n){s(e,n,(function(e){return this._invoke(n,e)}))}))}function M(e,n){function t(o,i,a,c){var l=f(e[o],e,i);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==typeof u&&r.call(u,"__await")?n.resolve(u.__await).then((function(e){t("next",e,a,c)}),(function(e){t("throw",e,a,c)})):n.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return t("throw",e,a,c)}))}c(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new n((function(n,o){t(e,r,n,o)}))}return i=i?i.then(o,o):o()}})}function I(n,t,r){var o=v;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var l=C(c,r);if(l){if(l===m)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===v)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var s=f(n,t,r);if("normal"===s.type){if(o=r.done?y:h,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function C(n,t){var r=t.method,o=n.iterator[r];if(o===e)return t.delegate=null,"throw"===r&&n.iterator.return&&(t.method="return",t.arg=e,C(n,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=f(o,n.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,m;var a=i.arg;return a?a.done?(t[n.resultName]=a.value,t.next=n.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,m):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function T(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function L(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function R(n){if(n||""===n){var t=n[a];if(t)return t.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length)){var o=-1,i=function t(){for(;++o<n.length;)if(r.call(n,o))return t.value=n[o],t.done=!1,t;return t.value=e,t.done=!0,t};return i.next=i}}throw new TypeError(typeof n+" is not iterable")}return w.prototype=x,o(A,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:w,configurable:!0}),w.displayName=s(x,l,"GeneratorFunction"),n.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return!!n&&(n===w||"GeneratorFunction"===(n.displayName||n.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,s(e,l,"GeneratorFunction")),e.prototype=Object.create(A),e},n.awrap=function(e){return{__await:e}},E(M.prototype),s(M.prototype,c,(function(){return this})),n.AsyncIterator=M,n.async=function(e,t,r,o,i){void 0===i&&(i=Promise);var a=new M(u(e,t,r,o),i);return n.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(A),s(A,l,"Generator"),s(A,a,(function(){return this})),s(A,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var n=Object(e),t=[];for(var r in n)t.push(r);return t.reverse(),function e(){for(;t.length;){var r=t.pop();if(r in n)return e.value=r,e.done=!1,e}return e.done=!0,e}},n.values=R,O.prototype={constructor:O,reset:function(n){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!n)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var t=this;function o(r,o){return c.type="throw",c.arg=n,t.next=r,o&&(t.method="next",t.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,n){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=n,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&n&&(this.next=n),m},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),L(t),m}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var r=t.completion;if("throw"===r.type){var o=r.arg;L(t)}return o}}throw Error("illegal catch attempt")},delegateYield:function(n,t,r){return this.delegate={iterator:R(n),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=e),m}},n}function v(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,c=[],l=!0,s=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=i.call(t)).done)&&(c.push(r.value),c.length!==n);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,n)||y(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){var n=function(e,n){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}function y(e,n){if(e){if("string"==typeof e)return a(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,n):void 0}}const m=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,g=e=>e,w=(e,n)=>{if(e===n)return!0;if(e.length!==n.length)return!1;const t=new Set(e),r=new Set(n);return t.size===r.size&&n.every((e=>t.has(e)))},x=(e,n=(e=>e))=>{const t=[];for(let r=0;r<e;r++)t.push(n(r,e));return t},b=(e,...n)=>(n.forEach((n=>{const t=Object.keys(n).reduce(((e,t)=>(e[t]=Object.getOwnPropertyDescriptor(n,t),e)),{});Object.getOwnPropertySymbols(n).forEach((e=>{const r=Object.getOwnPropertyDescriptor(n,e);r.enumerable&&(t[e]=r)})),Object.defineProperties(e,t)})),e),P=(e,n)=>t=>b(t,{get[e](){return n}}),S=(e=1)=>new Promise((n=>{let t=0;const r=()=>requestAnimationFrame((()=>{t++,t<e?r():n()}));r()})),A=(e,n,t=null)=>{let r,o=0;t=null===t?n:t;const i=(...n)=>{clearTimeout(r),r=setTimeout((()=>{o>0&&(e(...n),o=0)}),t)};let a=!1;const c=(...t)=>{a?(o++,i(...t)):(e(...t),i(...t),a=!0,o=0,setTimeout((()=>{a=!1}),n))};return c.reset=()=>{a=!1},c.cancel=()=>{clearTimeout(r)},c.now=(...n)=>e(...n),c};var E,M="undefined"!=typeof Float32Array?Float32Array:Array;function I(){var e=new M(16);return M!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function C(e){var n=new M(16);return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function T(e,n){var t=n[0],r=n[1],o=n[2],i=n[3],a=n[4],c=n[5],l=n[6],s=n[7],u=n[8],f=n[9],d=n[10],v=n[11],h=n[12],p=n[13],y=n[14],m=n[15],g=t*c-r*a,w=t*l-o*a,x=t*s-i*a,b=r*l-o*c,P=r*s-i*c,S=o*s-i*l,A=u*p-f*h,E=u*y-d*h,M=u*m-v*h,I=f*y-d*p,C=f*m-v*p,T=d*m-v*y,L=g*T-w*C+x*I+b*M-P*E+S*A;return L?(L=1/L,e[0]=(c*T-l*C+s*I)*L,e[1]=(o*C-r*T-i*I)*L,e[2]=(p*S-y*P+m*b)*L,e[3]=(d*P-f*S-v*b)*L,e[4]=(l*M-a*T-s*E)*L,e[5]=(t*T-o*M+i*E)*L,e[6]=(y*x-h*S-m*w)*L,e[7]=(u*S-d*x+v*w)*L,e[8]=(a*C-c*M+s*A)*L,e[9]=(r*M-t*C-i*A)*L,e[10]=(h*P-p*x+m*g)*L,e[11]=(f*x-u*P-v*g)*L,e[12]=(c*E-a*I-l*A)*L,e[13]=(t*I-r*E+o*A)*L,e[14]=(p*w-h*b-y*g)*L,e[15]=(u*b-f*w+d*g)*L,e):null}function L(e,n,t){var r=n[0],o=n[1],i=n[2],a=n[3],c=n[4],l=n[5],s=n[6],u=n[7],f=n[8],d=n[9],v=n[10],h=n[11],p=n[12],y=n[13],m=n[14],g=n[15],w=t[0],x=t[1],b=t[2],P=t[3];return e[0]=w*r+x*c+b*f+P*p,e[1]=w*o+x*l+b*d+P*y,e[2]=w*i+x*s+b*v+P*m,e[3]=w*a+x*u+b*h+P*g,w=t[4],x=t[5],b=t[6],P=t[7],e[4]=w*r+x*c+b*f+P*p,e[5]=w*o+x*l+b*d+P*y,e[6]=w*i+x*s+b*v+P*m,e[7]=w*a+x*u+b*h+P*g,w=t[8],x=t[9],b=t[10],P=t[11],e[8]=w*r+x*c+b*f+P*p,e[9]=w*o+x*l+b*d+P*y,e[10]=w*i+x*s+b*v+P*m,e[11]=w*a+x*u+b*h+P*g,w=t[12],x=t[13],b=t[14],P=t[15],e[12]=w*r+x*c+b*f+P*p,e[13]=w*o+x*l+b*d+P*y,e[14]=w*i+x*s+b*v+P*m,e[15]=w*a+x*u+b*h+P*g,e}function O(e,n){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function R(e,n){return e[0]=n[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function B(e,n,t){var r=n[0],o=n[1],i=n[2],a=n[3];return e[0]=t[0]*r+t[4]*o+t[8]*i+t[12]*a,e[1]=t[1]*r+t[5]*o+t[9]*i+t[13]*a,e[2]=t[2]*r+t[6]*o+t[10]*i+t[14]*a,e[3]=t[3]*r+t[7]*o+t[11]*i+t[15]*a,e}Math.hypot||(Math.hypot=function(){for(var e=0,n=arguments.length;n--;)e+=arguments[n]*arguments[n];return Math.sqrt(e)}),E=new M(4),M!=Float32Array&&(E[0]=0,E[1]=0,E[2]=0,E[3]=0),function(){var e=function(){var e=new M(2);return M!=Float32Array&&(e[0]=0,e[1]=0),e}()}();const D=(e=[0,0],n=1,t=0,r=[0,0],o=[[0,1/0],[0,1/0]],i=[[-1/0,1/0],[-1/0,1/0]])=>{const a=new Float32Array(16),c=new Float32Array(16),l=new Float32Array(16);let s=I(),u=[...r.slice(0,2),0,1];const f=Array.isArray(o[0])?[...o[0]]:[...o],d=Array.isArray(o[0])?[...o[1]]:[...o],v=Array.isArray(i[0])?[...i[0]]:[...i],h=Array.isArray(i[0])?[...i[1]]:[...i],p=()=>function(e,n){var t=n[0],r=n[1],o=n[2],i=n[4],a=n[5],c=n[6],l=n[8],s=n[9],u=n[10];return e[0]=Math.hypot(t,r,o),e[1]=Math.hypot(i,a,c),e[2]=Math.hypot(l,s,u),e}(a,s).slice(0,2),y=()=>{const e=p();return Math.min(e[0],e[1])},m=()=>{const e=p();return Math.max(e[0],e[1])},g=([e=0,n=0]=[],t=1,r=0)=>{s=I(),w([-e,-n]),b(r),x(1/t)},w=([e=0,n=0]=[])=>{a[0]=e,a[1]=n,a[2]=0;const t=O(c,a);L(s,t,s)},x=(e,n)=>{const t=Array.isArray(e);let r=t?e[0]:e,o=t?e[1]:e;if(r<=0||o<=0||1===r&&1===o)return;const i=p(),v=i[0]*r,h=i[1]*o;if(r=Math.max(f[0],Math.min(v,f[1]))/i[0],o=Math.max(d[0],Math.min(h,d[1]))/i[1],1===r&&1===o)return;a[0]=r,a[1]=o,a[2]=1;const y=R(c,a),m=n?[...n,0]:u,g=O(a,m);L(s,g,L(s,y,L(s,T(l,g),s)))},b=e=>{const n=I();!function(e,n,t){var r,o,i,a=t[0],c=t[1],l=t[2],s=Math.hypot(a,c,l);s<1e-6||(a*=s=1/s,c*=s,l*=s,r=Math.sin(n),i=1-(o=Math.cos(n)),e[0]=a*a*i+o,e[1]=c*a*i+l*r,e[2]=l*a*i-c*r,e[3]=0,e[4]=a*c*i-l*r,e[5]=c*c*i+o,e[6]=l*c*i+a*r,e[7]=0,e[8]=a*l*i+c*r,e[9]=c*l*i-a*r,e[10]=l*l*i+o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1)}(n,e,[0,0,1]),L(s,n,s)},P=e=>{!e||e.length<16||(s=e)};return g(e,n,t),{get translation(){return function(e,n){return e[0]=n[12],e[1]=n[13],e[2]=n[14],e}(a,s).slice(0,2)},get target(){return B(a,u,T(l,s)).slice(0,2)},get scaling(){return p()},get minScaling(){return y()},get maxScaling(){return m()},get scaleBounds(){return[[...f],[...d]]},get translationBounds(){return[[...v],[...h]]},get distance(){return(()=>{const e=p();return[1/e[0],1/e[1]]})()},get minDistance(){return 1/y()},get maxDistance(){return 1/m()},get rotation(){return Math.acos(s[0]/m())},get view(){return s},get viewCenter(){return u.slice(0,2)},lookAt:g,translate:w,pan:w,rotate:b,scale:x,zoom:x,reset:()=>{g(e,n,t)},set:(...e)=>(console.warn("`set()` is deprecated. Please use `setView()` instead."),P(...e)),setScaleBounds:e=>{const n=Array.isArray(e[0]);f[0]=n?e[0][0]:e[0],f[1]=n?e[0][1]:e[1],d[0]=n?e[1][0]:e[0],d[1]=n?e[1][1]:e[1]},setTranslationBounds:e=>{const n=Array.isArray(e[0]);v[0]=n?e[0][0]:e[0],v[1]=n?e[0][1]:e[1],h[0]=n?e[1][0]:e[0],h[1]=n?e[1][1]:e[1]},setView:P,setViewCenter:e=>{u=[...e.slice(0,2),0,1]}}},z=["pan","rotate"],N={alt:"altKey",cmd:"metaKey",ctrl:"ctrlKey",meta:"metaKey",shift:"shiftKey"},k=(e,{distance:n=1,target:t=[0,0],rotation:r=0,isNdc:o=!0,isFixed:i=!1,isPan:a=!0,isPanInverted:c=[!1,!0],panSpeed:l=1,isRotate:s=!0,rotateSpeed:u=1,defaultMouseDownMoveAction:f="pan",mouseDownMoveModKey:d="alt",isZoom:v=!0,zoomSpeed:h=1,viewCenter:p,scaleBounds:y,translationBounds:m,onKeyDown:g=(()=>{}),onKeyUp:w=(()=>{}),onMouseDown:x=(()=>{}),onMouseUp:b=(()=>{}),onMouseMove:P=(()=>{}),onWheel:S=(()=>{})}={})=>{let A=D(t,n,r,p,y,m),E=0,M=0,I=0,C=0,T=0,L=0,O=!1,R=0,B=1,k=1,j=1,F=!1,_=!1,V=!1,W="pan"===f,Z=a,G=a,U=c,K=c,q=v,H=v;const Y=()=>{Z=Array.isArray(a)?Boolean(a[0]):a,G=Array.isArray(a)?Boolean(a[1]):a,U=Array.isArray(c)?Boolean(c[0]):c,K=Array.isArray(c)?Boolean(c[1]):c,q=Array.isArray(v)?Boolean(v[0]):v,H=Array.isArray(v)?Boolean(v[1]):v};Y();const X=o?e=>e/B*2*j:e=>e,$=o?e=>e/k*2:e=>-e,J=o?e=>(e/B*2-1)*j:e=>e,Q=o?e=>1-e/k*2:e=>e,ee=()=>{const n=e.getBoundingClientRect();B=n.width,k=n.height,j=B/k},ne=e=>{V=!1,w(e)},te=e=>{V=e[N[d]],g(e)},re=e=>{O=!1,b(e)},oe=e=>{O=1===e.buttons,x(e)},ie=void 0!==document.createEvent("MouseEvent").offsetX?e=>{I=e.offsetX,C=e.offsetY}:n=>{const t=e.getBoundingClientRect();I=n.clientX-t.left,C=n.clientY-t.top},ae=e=>{E=e.clientX,M=e.clientY},ce=e=>{ae(e),P(e)},le=e=>{if((q||H)&&!i){e.preventDefault(),ae(e),ie(e);const n=1===e.deltaMode?12:1;R+=n*(e.deltaY||e.deltaX||0)}S(e)};window.addEventListener("keydown",te,{passive:!0}),window.addEventListener("keyup",ne,{passive:!0}),e.addEventListener("mousedown",oe,{passive:!0}),window.addEventListener("mouseup",re,{passive:!0}),window.addEventListener("mousemove",ce,{passive:!0}),e.addEventListener("wheel",le,{passive:!1}),A.config=({defaultMouseDownMoveAction:e=null,isFixed:n=null,isPan:t=null,isPanInverted:r=null,isRotate:o=null,isZoom:p=null,panSpeed:y=null,rotateSpeed:m=null,zoomSpeed:g=null,mouseDownMoveModKey:w=null}={})=>{f=null!==e&&z.includes(e)?e:f,W="pan"===f,i=null!==n?n:i,a=null!==t?t:a,c=null!==r?r:c,s=null!==o?o:s,v=null!==p?p:v,l=+y>0?y:l,u=+m>0?m:u,h=+g>0?g:h,Y(),d=null!==w&&Object.keys(N).includes(w)?w:d},A.dispose=()=>{A=void 0,window.removeEventListener("keydown",te),window.removeEventListener("keyup",ne),e.removeEventListener("mousedown",oe),window.removeEventListener("mouseup",re),window.removeEventListener("mousemove",ce),e.removeEventListener("wheel",le)},A.refresh=ee,A.tick=()=>{if(i){const e=_;return _=!1,e}F=!1;const e=E,n=M;if((Z||G)&&O&&(W&&!V||!W&&V)){const t=Z?X(l*(U?T-e:e-T)):0,r=G?$(l*(K?L-n:n-L)):0;0===t&&0===r||(A.pan([t,r]),F=!0)}if((q||H)&&R){const e=h*Math.exp(R/k),n=J(I),t=Q(C);A.scale([q?1/e:1,H?1/e:1],[n,t]),F=!0}if(s&&O&&(W&&V||!W&&!V)&&Math.abs(T-e)+Math.abs(L-n)>0){const t=B/2,r=k/2,o=T-t,i=r-L,a=e-t,c=r-n,l=function(e,n){var t=e[0],r=e[1],o=n[0],i=n[1],a=Math.sqrt(t*t+r*r)*Math.sqrt(o*o+i*i),c=a&&(t*o+r*i)/a;return Math.acos(Math.min(Math.max(c,-1),1))}([o,i],[a,c]),s=o*c-a*i;A.rotate(u*l*Math.sign(s)),F=!0}R=0,T=e,L=n;const t=F||_;return _=!1,t};const se=e=>function(){e.apply(null,arguments),_=!0};return A.lookAt=se(A.lookAt),A.translate=se(A.translate),A.pan=se(A.pan),A.rotate=se(A.rotate),A.scale=se(A.scale),A.zoom=se(A.zoom),A.reset=se(A.reset),A.set=se(A.set),A.setScaleBounds=se(A.setScaleBounds),A.setTranslationBounds=se(A.setTranslationBounds),A.setView=se(A.setView),A.setViewCenter=se(A.setViewCenter),ee(),A};function j(e,n,t=2){const r=e.length;let o=function(e,n,t,r,o){let i;if(o===function(e,n,t,r){let o=0;for(let i=n,a=t-r;i<t;i+=r)o+=(e[a]-e[i])*(e[i+1]+e[a+1]),a=i;return o}(e,n,t,r)>0)for(let o=n;o<t;o+=r)i=ne(o/r|0,e[o],e[o+1],i);else for(let o=t-r;o>=n;o-=r)i=ne(o/r|0,e[o],e[o+1],i);i&&Y(i,i.next)&&(te(i),i=i.next);return i}(e,0,r,t,!0);const i=[];if(!o||o.next===o.prev)return i;let a,c,l;if(e.length>80*t){a=1/0,c=1/0;let n=-1/0,o=-1/0;for(let i=t;i<r;i+=t){const t=e[i],r=e[i+1];t<a&&(a=t),r<c&&(c=r),t>n&&(n=t),r>o&&(o=r)}l=Math.max(n-a,o-c),l=0!==l?32767/l:0}return _(o,i,t,a,c,l,0),i}function F(e,n){if(!e)return e;n||(n=e);let t,r=e;do{if(t=!1,r.steiner||!Y(r,r.next)&&0!==H(r.prev,r,r.next))r=r.next;else{if(te(r),r=n=r.prev,r===r.next)break;t=!0}}while(t||r!==n);return n}function _(e,n,t,r,o,i,a){if(!e)return;!a&&i&&function(e,n,t,r){let o=e;do{0===o.z&&(o.z=U(o.x,o.y,n,t,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){let n,t=1;do{let r,o=e;e=null;let i=null;for(n=0;o;){n++;let a=o,c=0;for(let e=0;e<t&&(c++,a=a.nextZ,a);e++);let l=t;for(;c>0||l>0&&a;)0!==c&&(0===l||!a||o.z<=a.z)?(r=o,o=o.nextZ,c--):(r=a,a=a.nextZ,l--),i?i.nextZ=r:e=r,r.prevZ=i,i=r;o=a}i.nextZ=null,t*=2}while(n>1)}(o)}(e,r,o,i);let c=e;for(;e.prev!==e.next;){const l=e.prev,s=e.next;if(i?W(e,r,o,i):V(e))n.push(l.i,e.i,s.i),te(e),e=s.next,c=s.next;else if((e=s)===c){a?1===a?_(e=Z(F(e),n),n,t,r,o,i,2):2===a&&G(e,n,t,r,o,i):_(F(e),n,t,r,o,i,1);break}}}function V(e){const n=e.prev,t=e,r=e.next;if(H(n,t,r)>=0)return!1;const o=n.x,i=t.x,a=r.x,c=n.y,l=t.y,s=r.y,u=Math.min(o,i,a),f=Math.min(c,l,s),d=Math.max(o,i,a),v=Math.max(c,l,s);let h=r.next;for(;h!==n;){if(h.x>=u&&h.x<=d&&h.y>=f&&h.y<=v&&K(o,c,i,l,a,s,h.x,h.y)&&H(h.prev,h,h.next)>=0)return!1;h=h.next}return!0}function W(e,n,t,r){const o=e.prev,i=e,a=e.next;if(H(o,i,a)>=0)return!1;const c=o.x,l=i.x,s=a.x,u=o.y,f=i.y,d=a.y,v=Math.min(c,l,s),h=Math.min(u,f,d),p=Math.max(c,l,s),y=Math.max(u,f,d),m=U(v,h,n,t,r),g=U(p,y,n,t,r);let w=e.prevZ,x=e.nextZ;for(;w&&w.z>=m&&x&&x.z<=g;){if(w.x>=v&&w.x<=p&&w.y>=h&&w.y<=y&&w!==o&&w!==a&&K(c,u,l,f,s,d,w.x,w.y)&&H(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,x.x>=v&&x.x<=p&&x.y>=h&&x.y<=y&&x!==o&&x!==a&&K(c,u,l,f,s,d,x.x,x.y)&&H(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;w&&w.z>=m;){if(w.x>=v&&w.x<=p&&w.y>=h&&w.y<=y&&w!==o&&w!==a&&K(c,u,l,f,s,d,w.x,w.y)&&H(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;x&&x.z<=g;){if(x.x>=v&&x.x<=p&&x.y>=h&&x.y<=y&&x!==o&&x!==a&&K(c,u,l,f,s,d,x.x,x.y)&&H(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Z(e,n){let t=e;do{const r=t.prev,o=t.next.next;!Y(r,o)&&X(r,t,t.next,o)&&Q(r,o)&&Q(o,r)&&(n.push(r.i,t.i,o.i),te(t),te(t.next),t=e=o),t=t.next}while(t!==e);return F(t)}function G(e,n,t,r,o,i){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&q(a,e)){let c=ee(a,e);return a=F(a,a.next),c=F(c,c.next),_(a,n,t,r,o,i,0),void _(c,n,t,r,o,i,0)}e=e.next}a=a.next}while(a!==e)}function U(e,n,t,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-t)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*o|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function K(e,n,t,r,o,i,a,c){return!(e===a&&n===c)&&function(e,n,t,r,o,i,a,c){return(o-a)*(n-c)>=(e-a)*(i-c)&&(e-a)*(r-c)>=(t-a)*(n-c)&&(t-a)*(i-c)>=(o-a)*(r-c)}(e,n,t,r,o,i,a,c)}function q(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!function(e,n){let t=e;do{if(t.i!==e.i&&t.next.i!==e.i&&t.i!==n.i&&t.next.i!==n.i&&X(t,t.next,e,n))return!0;t=t.next}while(t!==e);return!1}(e,n)&&(Q(e,n)&&Q(n,e)&&function(e,n){let t=e,r=!1;const o=(e.x+n.x)/2,i=(e.y+n.y)/2;do{t.y>i!=t.next.y>i&&t.next.y!==t.y&&o<(t.next.x-t.x)*(i-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next}while(t!==e);return r}(e,n)&&(H(e.prev,e,n.prev)||H(e,n.prev,n))||Y(e,n)&&H(e.prev,e,e.next)>0&&H(n.prev,n,n.next)>0)}function H(e,n,t){return(n.y-e.y)*(t.x-n.x)-(n.x-e.x)*(t.y-n.y)}function Y(e,n){return e.x===n.x&&e.y===n.y}function X(e,n,t,r){const o=J(H(e,n,t)),i=J(H(e,n,r)),a=J(H(t,r,e)),c=J(H(t,r,n));return o!==i&&a!==c||(!(0!==o||!$(e,t,n))||(!(0!==i||!$(e,r,n))||(!(0!==a||!$(t,e,r))||!(0!==c||!$(t,n,r)))))}function $(e,n,t){return n.x<=Math.max(e.x,t.x)&&n.x>=Math.min(e.x,t.x)&&n.y<=Math.max(e.y,t.y)&&n.y>=Math.min(e.y,t.y)}function J(e){return e>0?1:e<0?-1:0}function Q(e,n){return H(e.prev,e,e.next)<0?H(e,n,e.next)>=0&&H(e,e.prev,n)>=0:H(e,n,e.prev)<0||H(e,e.next,n)<0}function ee(e,n){const t=re(e.i,e.x,e.y),r=re(n.i,n.x,n.y),o=e.next,i=n.prev;return e.next=n,n.prev=e,t.next=o,o.prev=t,r.next=t,t.prev=r,i.next=r,r.prev=i,r}function ne(e,n,t,r){const o=re(e,n,t);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function te(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function re(e,n,t){return{i:e,x:n,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const oe=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),ie=Float32Array.BYTES_PER_ELEMENT,ae=e=>e.length>0&&Array.isArray(e[0]),{push:ce,splice:le}=Array.prototype;function se(e,n=1,t=1){const r=[],o=new Array(2*n);for(let i=0,a=e.length/n;i<a;i++){const a=i*n;for(let r=0;r<n;r++){const i=e[a+r];o[r]=i,o[r+n]=i*t}ce.apply(r,o)}return r}function ue(e,n,t,r){const o=new Array(r),i=n*r;for(let n=0;n<r;n++)o[n]=e[i+n];return le.call(e,t*r,0,...o),e}const fe=(e,{projection:n=oe,model:t=oe,view:r=oe,points:o=[],colorIndices:i=[],color:a=[.8,.5,0,1],opacity:c=null,opacities:l=[],width:s=1,widths:u=[],miter:f=!0,is2d:d=!1,zPos2d:v=0}={})=>{if(!e)return void console.error("Regl instance is undefined.");const h=new Float32Array(16);let p,y,m,g,w,x,b,P,S,A,E,M,I,C,T,O,R,B,D=d?2:3;const z=()=>+(l.length===y||null!==c),N=()=>{A=e.buffer(),E=e.buffer(),M=e.buffer(),T=e.buffer(),O={prevPosition:{buffer:()=>A,offset:0,stride:3*ie},currPosition:{buffer:()=>A,offset:3*ie*2,stride:3*ie},nextPosition:{buffer:()=>A,offset:3*ie*4,stride:3*ie},opacity:{buffer:()=>E,offset:2*ie,stride:ie},offsetScale:{buffer:()=>M,offset:2*ie,stride:ie},colorIndex:{buffer:()=>T,offset:2*ie,stride:ie}},R=e.elements(),B=e({attributes:O,depth:{enable:!d},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},uniforms:{projectionViewModel:(e,n)=>{const t=e.projection||n.projection,r=e.model||n.model,o=e.view||n.view;return L(h,t,L(h,o,r))},aspectRatio:({viewportWidth:e,viewportHeight:n})=>e/n,colorTex:()=>I,colorTexRes:()=>C,colorTexEps:()=>.5/C,pixelRatio:({pixelRatio:e})=>e,width:({pixelRatio:e,viewportHeight:n})=>s/n*e,useOpacity:z,useColorOpacity:()=>Number(!z()),miter:Number(Boolean(f))},elements:()=>R,vert:"\nuniform mat4 projectionViewModel;\nuniform float aspectRatio;\n\nuniform sampler2D colorTex;\nuniform float colorTexRes;\nuniform float colorTexEps;\nuniform float width;\nuniform float useOpacity;\nuniform float useColorOpacity;\nuniform int miter;\n\nattribute vec3 prevPosition;\nattribute vec3 currPosition;\nattribute vec3 nextPosition;\nattribute float opacity;\nattribute float offsetScale;\nattribute float colorIndex;\n\nvarying vec4 color;\n\nvoid main() {\n vec2 aspectVec = vec2(aspectRatio, 1.0);\n vec4 prevProjected = projectionViewModel * vec4(prevPosition, 1.0);\n vec4 currProjected = projectionViewModel * vec4(currPosition, 1.0);\n vec4 nextProjected = projectionViewModel * vec4(nextPosition, 1.0);\n\n // get 2D screen space with W divide and aspect correction\n vec2 prevScreen = prevProjected.xy / prevProjected.w * aspectVec;\n vec2 currScreen = currProjected.xy / currProjected.w * aspectVec;\n vec2 nextScreen = nextProjected.xy / nextProjected.w * aspectVec;\n\n float len = width;\n\n // starting point uses (next - current)\n vec2 dir = vec2(0.0);\n if (currScreen == prevScreen) {\n dir = normalize(nextScreen - currScreen);\n }\n // ending point uses (current - previous)\n else if (currScreen == nextScreen) {\n dir = normalize(currScreen - prevScreen);\n }\n // somewhere in middle, needs a join\n else {\n // get directions from (C - B) and (B - A)\n vec2 dirA = normalize((currScreen - prevScreen));\n if (miter == 1) {\n vec2 dirB = normalize((nextScreen - currScreen));\n // now compute the miter join normal and length\n vec2 tangent = normalize(dirA + dirB);\n vec2 perp = vec2(-dirA.y, dirA.x);\n vec2 miter = vec2(-tangent.y, tangent.x);\n len = width / dot(miter, perp);\n dir = tangent;\n } else {\n dir = dirA;\n }\n }\n\n vec2 normal = vec2(-dir.y, dir.x) * len;\n normal.x /= aspectRatio;\n vec4 offset = vec4(normal * offsetScale, 0.0, 0.0);\n gl_Position = currProjected + offset;\n\n // Get color from texture\n float colorRowIndex = floor((colorIndex + colorTexEps) / colorTexRes);\n vec2 colorTexIndex = vec2(\n (colorIndex / colorTexRes) - colorRowIndex + colorTexEps,\n colorRowIndex / colorTexRes + colorTexEps\n );\n\n color = texture2D(colorTex, colorTexIndex);\n color.a = useColorOpacity * color.a + useOpacity * opacity;\n}",frag:"\nprecision mediump float;\nvarying vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"})},k=()=>{1===p&&o.length%D>0&&console.warn(`The length of points (${y}) does not match the dimensions (${D}). Incomplete points are ignored.`),g=o.flat().slice(0,y*D),d&&(g=function(e,n,t,r=0){const o=[],i=new Array(t).fill(r);for(let t=0,r=e.length/n;t<r;t++){const r=t*n;for(let t=0;t<n;t++)i[t]=e[r+t];ce.apply(o,i)}return o}(g,2,3,v)),i.length!==y&&(i=new Array(y).fill(0)),u.length!==y&&(u=new Array(y).fill(1));const e=i.slice(),n=l.length===y?l.slice():new Array(y).fill(null===c?1:c),t=u.slice();let r=0;for(const o of m){const i=r+o-1;ue(g,i,i,3),ue(g,r,r,3),ue(e,i,i,1),ue(e,r,r,1),ue(n,i,i,1),ue(n,r,r,1),ue(t,i,i,1),ue(t,r,r,1),r+=o+2}w=new Float32Array(se(g,3)),x=se(e),b=se(n),P=se(t,1,-1),S=((e,n=[])=>{let t=0;for(const r of e){for(let e=0;e<r-1;e++){const r=t+2*e,o=r+1,i=r+2,a=r+3;n.push(r,o,i,i,o,a)}t+=2*(r+2)}return n})(m),A({usage:"dynamic",type:"float",length:w.length*ie,data:w}),E({usage:"dynamic",type:"float",length:b.length*ie,data:b}),M({usage:"dynamic",type:"float",length:P.length*ie,data:P}),T({usage:"dynamic",type:"float",length:x.length*ie,data:x}),R({primitive:"triangles",usage:"dynamic",type:S.length>65536?"uint32":"uint16",data:S})},j=()=>{F(),N()},F=()=>{o=[],g=[],w=new Float32Array,P=[],S=[],A.destroy(),M.destroy(),R.destroy()},_=(e,n)=>{const t=n.flat(2);return t.length===y?t:t.length===p?m.flatMap(((e,n)=>Array(e).fill(t[n]))):e},V=(e=[],{colorIndices:n=i,opacities:t=l,widths:r=u,is2d:a=d}={})=>{D=(d=a)?2:3,p=ae(o=e)?o.length:1,m=ae(o)?o.map((e=>Math.floor(e.length/D))):[Math.floor(o.length/D)],y=m.reduce(((e,n)=>e+n),0),i=_(i,n),l=_(l,t),u=_(u,r),o&&y>1?k():j()},W=()=>{const n=ae(a)?a:[a];C=Math.max(2,Math.ceil(Math.sqrt(n.length)));const t=new Uint8Array(C**2*4);n.forEach(((e,n)=>{t[4*n]=Math.min(255,Math.max(0,Math.round(255*e[0]))),t[4*n+1]=Math.min(255,Math.max(0,Math.round(255*e[1]))),t[4*n+2]=Math.min(255,Math.max(0,Math.round(255*e[2]))),t[4*n+3]=Number.isNaN(+e[3])?255:Math.min(255,Math.max(0,Math.round(255*e[3])))})),I=e.texture({data:t,shape:[C,C,4]})};return N(),W(),o&&o.length>1&&V(o),{clear:j,destroy:F,draw:({projection:e,model:i,view:a}={})=>{e&&(n=e),i&&(t=i),a&&(r=a),o&&o.length>1&&B({projection:n,model:t,view:r})},getPoints:()=>o,setPoints:V,getData:()=>({points:w,widths:P,opacities:b,colorIndices:x}),getBuffer:()=>({points:A,widths:M,opacities:E,colorIndices:T}),getStyle:()=>({color:a,miter:f,width:s}),setStyle:({color:e,opacity:n,miter:t,width:r}={})=>{var o;e&&((e,n=c)=>{a=e,c=n,I&&I.destroy(),W()})(e,n||c),t&&(f=Boolean(t)),void 0!==(o=r)&&Number.isFinite(o)&&(s=r)}}};
|
|
2
|
-
|
|
3
|
-
* KDBush - A fast static index for 2D points
|
|
4
|
-
* @license ISC License
|
|
5
|
-
* @copyright Vladimir Agafonkin 2018
|
|
6
|
-
* @version 4.0.2
|
|
7
|
-
* @see https://github.com/mourner/kdbush/
|
|
8
|
-
*/var de,ve=function(){var e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],n=function(){function n(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,i=arguments.length>3?arguments[3]:void 0;if(function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),isNaN(t)||t<0)throw new Error("Unexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;var a=e.indexOf(this.ArrayType),c=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(o,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+c+l+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+a]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}return r=n,i=[{key:"from",value:function(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var r=v(new Uint8Array(t,0,2),2),o=r[0],i=r[1];if(219!==o)throw new Error("Data does not appear to be in a KDBush format.");var a=i>>4;if(1!==a)throw new Error("Got v".concat(a," data when expected v").concat(1,"."));var c=e[15&i];if(!c)throw new Error("Unrecognized array type.");var l=v(new Uint16Array(t,2,1),1)[0];return new n(v(new Uint32Array(t,4,1),1)[0],l,c,t)}}],(o=[{key:"add",value:function(e,n){var t=this._pos>>1;return this.ids[t]=t,this.coords[this._pos++]=e,this.coords[this._pos++]=n,t}},{key:"finish",value:function(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return t(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}},{key:"range",value:function(e,n,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var o=this.ids,i=this.coords,a=this.nodeSize,c=[0,o.length-1,0],l=[];c.length;){var s=c.pop()||0,u=c.pop()||0,f=c.pop()||0;if(u-f<=a)for(var d=f;d<=u;d++){var v=i[2*d],h=i[2*d+1];v>=e&&v<=t&&h>=n&&h<=r&&l.push(o[d])}else{var p=f+u>>1,y=i[2*p],m=i[2*p+1];y>=e&&y<=t&&m>=n&&m<=r&&l.push(o[p]),(0===s?e<=y:n<=m)&&(c.push(f),c.push(p-1),c.push(1-s)),(0===s?t>=y:r>=m)&&(c.push(p+1),c.push(u),c.push(1-s))}}return l}},{key:"within",value:function(e,n,t){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var r=this.ids,o=this.coords,i=this.nodeSize,c=[0,r.length-1,0],l=[],s=t*t;c.length;){var u=c.pop()||0,f=c.pop()||0,d=c.pop()||0;if(f-d<=i)for(var v=d;v<=f;v++)a(o[2*v],o[2*v+1],e,n)<=s&&l.push(r[v]);else{var h=d+f>>1,p=o[2*h],y=o[2*h+1];a(p,y,e,n)<=s&&l.push(r[h]),(0===u?e-t<=p:n-t<=y)&&(c.push(d),c.push(h-1),c.push(1-u)),(0===u?e+t>=p:n+t>=y)&&(c.push(h+1),c.push(f),c.push(1-u))}}return l}}])&&l(r.prototype,o),i&&l(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}();function t(e,n,o,i,a,c){if(!(a-i<=o)){var l=i+a>>1;r(e,n,l,i,a,c),t(e,n,o,i,l-1,1-c),t(e,n,o,l+1,a,1-c)}}function r(e,n,t,i,a,c){for(;a>i;){if(a-i>600){var l=a-i+1,s=t-i+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(s-l/2<0?-1:1);r(e,n,t,Math.max(i,Math.floor(t-s*f/l+d)),Math.min(a,Math.floor(t+(l-s)*f/l+d)),c)}var v=n[2*t+c],h=i,p=a;for(o(e,n,i,t),n[2*a+c]>v&&o(e,n,i,a);h<p;){for(o(e,n,h,p),h++,p--;n[2*h+c]<v;)h++;for(;n[2*p+c]>v;)p--}n[2*i+c]===v?o(e,n,i,p):o(e,n,++p,a),p<=t&&(i=p+1),t<=p&&(a=p-1)}}function o(e,n,t,r){i(e,t,r),i(n,2*t,2*r),i(n,2*t+1,2*r+1)}function i(e,n,t){var r=e[n];e[n]=e[t],e[t]=r}function a(e,n,t,r){var o=e-t,i=n-r;return o*o+i*i}return n},he=function(){addEventListener("message",(function(e){var n=e.data.points;0===n.length&&self.postMessage({error:new Error("Invalid point data")});var t,r=new KDBush(n.length,e.data.nodeSize),o=s(n);try{for(o.s();!(t=o.n()).done;){var i=v(t.value,2),a=i[0],c=i[1];r.add(a,c)}}catch(e){o.e(e)}finally{o.f()}r.finish(),postMessage(r.data,[r.data])}))},pe=ve(),ye=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{nodeSize:16,useWorker:void 0};return new Promise((function(t,r){if(e instanceof ArrayBuffer)t(pe.from(e));else if((e.length<1e6||!1===n.useWorker)&&!0!==n.useWorker){var o,i=new pe(e.length,n.nodeSize),a=s(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;i.add(c[0],c[1])}}catch(e){a.e(e)}finally{a.f()}i.finish(),t(i)}else{var l=function(e){var n=ve.toString(),t=e.toString(),r="const createKDBushClass = ".concat(n,";")+"KDBush = createKDBushClass();"+"const createWorker = ".concat(t,";")+"createWorker();",o=new Blob([r],{type:"text/javascript"}),i=URL.createObjectURL(o),a=new Worker(i,{name:"KDBush"});return URL.revokeObjectURL(i),a}(he);l.onmessage=function(e){e.data.error?r(e.data.error):t(pe.from(e.data)),l.terminate()},l.postMessage({points:e,nodeSize:n.nodeSize})}}))},me="auto",ge=Float32Array.BYTES_PER_ELEMENT,we=["OES_texture_float","OES_element_index_uint","WEBGL_color_buffer_float","EXT_float_blend"],xe={color:[0,0,0,0],depth:1},be="panZoom",Pe="lasso",Se="rotate",Ae=[be,Pe,Se],Ee=be,Me={cubicIn:e=>e*e*e,cubicInOut:m,cubicOut:e=>--e*e*e+1,linear:e=>e,quadIn:e=>e*e,quadInOut:e=>e<.5?2*e*e:(4-2*e)*e-1,quadOut:e=>e*(2-e)},Ie=m,Ce="continuous",Te="categorical",Le=[Ce,Te],Oe="deselect",Re="lassoEnd",Be=[Oe,Re],De=[0,.666666667,1,1],ze=Re,Ne=750,ke=500,je=100,Fe=250,_e="intersect",Ve="lasso",We="rotate",Ze="merge",Ge="remove",Ue=[Ve,We,_e,Ze,Ge],Ke="alt",qe="cmd",He="ctrl",Ye="meta",Xe="shift",$e=[Ke,qe,He,Ye,Xe],Je=u(u(u(u({},Ge,Ke),We,Ke),Ve,Xe),Ze,qe),Qe=me,en=me,nn=null,tn=null,rn=null,on=null,an=null,cn=[.66,.66,.66,1],ln=[0,.55,1,1],sn=[1,1,1,1],un=[0,0,0,1],fn=null,dn=[.66,.66,.66,.2],vn=[0,.55,1,1],hn=[1,1,1,1],pn=[1,1,1,.5],yn=[0,0],mn=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),gn=[1,1,1,.5],wn=new Set(["z","valueZ","valueA","value1","category"]),xn=new Set(["w","valueW","valueB","value2","value"]),bn=15e3,Pn=Symbol("SKIP_DEPRECATION_VALUE_TRANSLATION"),Sn="Points have not been drawn",An="The instance was already destroyed",En=function(e,n){return"".concat(e,"ms ease-out effectIn ").concat(n,"ms 1 normal forwards")},Mn=function(e,n){return"".concat(e,"ms linear leftSpinIn ").concat(n,"ms 1 normal forwards")},In=function(e,n){return"".concat(e,"ms linear rightSpinIn ").concat(n,"ms 1 normal forwards")},Cn=function(e,n){return"".concat(e,"ms linear circleIn ").concat(n,"ms 1 normal forwards")},Tn=function(e,n,t){return"\n @keyframes mainIn {\n 0% {\n color: ".concat(n,";\n opacity: 0;\n }\n 0%, ").concat(e,"% {\n color: ").concat(n,";\n opacity: 1;\n }\n 100% {\n color: ").concat(t,";\n opacity: 0.8;\n }\n }\n")},Ln=function(e,n,t,r){return"\n @keyframes effectIn {\n 0%, ".concat(e,"% {\n opacity: ").concat(t,";\n transform: scale(").concat(r,");\n }\n ").concat(n,"% {\n opacity: 0.66;\n transform: scale(1.5);\n }\n 99% {\n opacity: 0;\n transform: scale(2);\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")},On=function(e,n){return"\n @keyframes leftSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(360deg);\n }\n }\n")},Rn=function(e,n){return"\n @keyframes rightSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(180deg);\n }\n }\n")},Bn=function(e){return"".concat(e,"ms linear effectOut 0s 1 normal forwards")},Dn=function(e){return"".concat(e,"ms linear leftSpinOut 0s 1 normal forwards")},zn=function(e){return"".concat(e,"ms linear rightSpinOut 0s 1 normal forwards")},Nn=function(e){return"".concat(e,"ms linear circleOut 0s 1 normal forwards")},kn=function(e,n){return"\n @keyframes mainOut {\n 0% {\n color: ".concat(e,";\n }\n 100% {\n color: ").concat(n,";\n }\n }\n")},jn=function(e,n){return"\n @keyframes rightSpinOut {\n 0%, ".concat(e,"% {\n transform: rotate(").concat(n,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n")},Fn=function(e){return"\n @keyframes leftSpinOut {\n 0% {\n transform: rotate(".concat(e,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n }\n")},_n=function(e,n,t){return"\n @keyframes circleOut {\n 0%, ".concat(e,"% {\n clip-path: ").concat(n,";\n opacity: ").concat(t,";\n }\n ").concat(e+.01,"% {\n clip-path: inset(0 0 0 50%);\n opacity: ").concat(t,";\n }\n 100% {\n clip-path: inset(0 0 0 50%);\n opacity: 0;\n }\n }\n")},Vn=function(e){return null===e?arguments.length>1&&void 0!==arguments[1]?arguments[1]:null:e},Wn=function(){if(!de){var e=document.createElement("style");document.head.appendChild(e),de=e.sheet}return de},Zn=function(e){var n=Wn(),t=n.rules.length;return n.insertRule(e,t),t},Gn=function(e){Wn().deleteRule(e)},Un="".concat(2500,"ms ease scaleInFadeOut 0s 1 normal backwards"),Kn=null,qn="".concat(250,"ms ease fadeScaleOut 0s 1 normal backwards"),Hn=null,Yn=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.onDraw,r=void 0===t?g:t,o=n.onStart,i=void 0===o?g:o,a=n.onEnd,c=void 0===a?g:a,l=n.enableInitiator,s=void 0===l||l,u=n.initiatorParentElement,f=void 0===u?document.body:u,d=n.longPressIndicatorParentElement,p=void 0===d?document.body:d,y=n.minDelay,m=void 0===y?8:y,w=n.minDist,x=void 0===w?2:w,E=n.pointNorm,M=void 0===E?g:E,I=n.type,C=void 0===I?"freeform":I,T=n.brushSize,L=s,O=f,R=p,B=r,D=i,z=c,N=m,k=x,j=M,F=C,_=void 0===T?24:T,V=document.createElement("div"),W=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);V.id="lasso-initiator-".concat(W),V.style.position="fixed",V.style.display="flex",V.style.justifyContent="center",V.style.alignItems="center",V.style.zIndex=99,V.style.width="4rem",V.style.height="4rem",V.style.borderRadius="4rem",V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)";var Z,G=function(){var e=document.createElement("div"),n=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);e.id="lasso-long-press-".concat(n),e.style.position="fixed",e.style.width="1.25rem",e.style.height="1.25rem",e.style.pointerEvents="none",e.style.transform="translate(-50%,-50%)";var t=document.createElement("div");t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.width="1.25rem",t.style.height="1.25rem",t.style.clipPath="inset(0px 0px 0px 50%)",t.style.opacity=0,e.appendChild(t);var r=document.createElement("div");r.style.position="absolute",r.style.top=0,r.style.left=0,r.style.width="0.8rem",r.style.height="0.8rem",r.style.border="0.2rem solid currentcolor",r.style.borderRadius="0.8rem",r.style.clipPath="inset(0px 50% 0px 0px)",r.style.transform="rotate(0deg)",t.appendChild(r);var o=document.createElement("div");o.style.position="absolute",o.style.top=0,o.style.left=0,o.style.width="0.8rem",o.style.height="0.8rem",o.style.border="0.2rem solid currentcolor",o.style.borderRadius="0.8rem",o.style.clipPath="inset(0px 50% 0px 0px)",o.style.transform="rotate(0deg)",t.appendChild(o);var i=document.createElement("div");return i.style.position="absolute",i.style.top=0,i.style.left=0,i.style.width="1.25rem",i.style.height="1.25rem",i.style.borderRadius="1.25rem",i.style.background="currentcolor",i.style.transform="scale(0)",i.style.opacity=0,e.appendChild(i),{longPress:e,longPressCircle:t,longPressCircleLeft:r,longPressCircleRight:o,longPressEffect:i}}(),U=G.longPress,K=G.longPressCircle,q=G.longPressCircleLeft,H=G.longPressCircleRight,Y=G.longPressEffect,X=!1,$=!1,J=[],Q=[],ee=[],ne=[],te=!1,re=null,oe=null,ie=null,ae=null,ce=null,le=null,se=null,ue=null,fe=null,de=null,ve=function(){X=!1};window.addEventListener("mouseup",ve);var he,pe=function(){V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)"},ye=function(e,n){var t=getComputedStyle(e),r=+t.opacity,o=t.transform.match(/([0-9.-]+)+/g),i=+o[0],a=+o[1],c=Math.sqrt(i*i+a*a),l=Math.atan2(a,i)*(180/Math.PI);return{opacity:r,scale:c,rotate:l=n&&l<=0?360+l:l}},me=function(e){if(L&&!X){var n=e.clientX,t=e.clientY;V.style.top="".concat(t,"px"),V.style.left="".concat(n,"px");var r=ye(V),o=r.opacity,i=r.scale,a=r.rotate;V.style.opacity=o,V.style.transform="translate(-50%,-50%) scale(".concat(i,") rotate(").concat(a,"deg)"),V.style.animation="none",S().then((function(){null!==Kn&&Gn(Kn),Kn=Zn(function(e,n,t){return"\n@keyframes scaleInFadeOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 10% {\n opacity: 1;\n transform: translate(-50%,-50%) scale(1) rotate(").concat(t+20,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0.9) rotate(").concat(t+60,"deg);\n }\n}\n")}(o,i,a)),V.style.animation=Un,S().then((function(){pe()}))}))}},ge=function(){var e=ye(V),n=e.opacity,t=e.scale,r=e.rotate;V.style.opacity=n,V.style.transform="translate(-50%,-50%) scale(".concat(t,") rotate(").concat(r,"deg)"),V.style.animation="none",S(2).then((function(){null!==Hn&&Gn(Hn),Hn=Zn(function(e,n,t){return"\n@keyframes fadeScaleOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0) rotate(").concat(t,"deg);\n }\n}\n")}(n,t,r)),V.style.animation=qn,S().then((function(){pe()}))}))},we=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{time:Ne,extraTime:ke,delay:je},r=t.time,o=void 0===r?Ne:r,i=t.extraTime,a=void 0===i?ke:i,c=t.delay,l=void 0===c?je:c;te=!0;var s=getComputedStyle(U);U.style.color=s.color,U.style.top="".concat(n,"px"),U.style.left="".concat(e,"px"),U.style.animation="none";var u=getComputedStyle(K);K.style.clipPath=u.clipPath,K.style.opacity=u.opacity,K.style.animation="none";var f=ye(Y);Y.style.opacity=f.opacity,Y.style.transform="scale(".concat(f.scale,")"),Y.style.animation="none";var d=ye(q);q.style.transform="rotate(".concat(d.rotate,"deg)"),q.style.animation="none";var v=ye(H);H.style.transform="rotate(".concat(v.rotate,"deg)"),H.style.animation="none",S().then((function(){if(te){null!==ce&&Gn(ce),null!==ae&&Gn(ae),null!==ie&&Gn(ie),null!==oe&&Gn(oe),null!==re&&Gn(re);var e=function(e){var n,t,r,o,i,a=e.time,c=void 0===a?Ne:a,l=e.extraTime,s=void 0===l?ke:l,u=e.delay,f=void 0===u?je:u,d=e.currentColor,v=e.targetColor,h=e.effectOpacity,p=e.effectScale,y=e.circleLeftRotation,m=e.circleRightRotation,g=e.circleClipPath,w=e.circleOpacity,x=y/360,b=function(e,n,t){return(1-e)*n+t}(x,c,s),P=Math.round((1-x)*c/b*100),S=Math.round(P/2),A=P+(100-P)/4;return{rules:{main:Tn(P,d,v),effect:Ln(P,A,h,p),circleRight:Rn(S,m),circleLeft:On(P,y),circle:(r=S,o=g,i=w,"\n @keyframes circleIn {\n 0% {\n clip-path: ".concat(o,";\n opacity: ").concat(i,";\n }\n ").concat(r,"% {\n clip-path: ").concat(o,";\n opacity: 1;\n }\n ").concat(r+.01,"%, 100% {\n clip-path: inset(0);\n opacity: 1;\n }\n }\n"))},names:{main:(n=b,t=f,"".concat(n,"ms ease-out mainIn ").concat(t,"ms 1 normal forwards")),effect:En(b,f),circleLeft:Mn(b,f),circleRight:In(b,f),circle:Cn(b,f)}}}({time:o,extraTime:a,delay:l,currentColor:s.color||"currentcolor",targetColor:U.dataset.activeColor,effectOpacity:f.opacity||0,effectScale:f.scale||0,circleLeftRotation:d.rotate||0,circleRightRotation:v.rotate||0,circleClipPath:u.clipPath||"inset(0 0 0 50%)",circleOpacity:u.opacity||0}),n=e.rules,t=e.names;re=Zn(n.main),oe=Zn(n.effect),ie=Zn(n.circleLeft),ae=Zn(n.circleRight),ce=Zn(n.circle),U.style.animation=t.main,Y.style.animation=t.effect,q.style.animation=t.circleLeft,H.style.animation=t.circleRight,K.style.animation=t.circle}}))},xe=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{time:Fe}).time,n=void 0===e?Fe:e;if(te){te=!1;var t=getComputedStyle(U);U.style.color=t.color,U.style.animation="none";var r=getComputedStyle(K);K.style.clipPath=r.clipPath,K.style.opacity=r.opacity,K.style.animation="none";var o=ye(Y);Y.style.opacity=o.opacity,Y.style.transform="scale(".concat(o.scale,")"),Y.style.animation="none";var i="x"===r.clipPath.slice(-2,-1),a=ye(q,i);q.style.transform="rotate(".concat(a.rotate,"deg)"),q.style.animation="none";var c=ye(H);H.style.transform="rotate(".concat(c.rotate,"deg)"),H.style.animation="none",S().then((function(){null!==de&&Gn(de),null!==fe&&Gn(fe),null!==ue&&Gn(ue),null!==se&&Gn(se),null!==le&&Gn(le);var e=function(e){var n,t,r,o=e.time,i=void 0===o?Fe:o,a=e.currentColor,c=e.targetColor,l=e.effectOpacity,s=e.effectScale,u=e.circleLeftRotation,f=e.circleRightRotation,d=e.circleClipPath,v=e.circleOpacity,h=u/360,p=h*i,y=Math.min(100,100*h),m=y>50?Math.round(100*(1-50/y)):0;return{rules:{main:kn(a,c),effect:(t=l,r=s,"\n @keyframes effectOut {\n 0% {\n opacity: ".concat(t,";\n transform: scale(").concat(r,");\n }\n 99% {\n opacity: 0;\n transform: scale(").concat(r+.5,");\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")),circleRight:jn(m,f),circleLeft:Fn(u),circle:_n(m,d,v)},names:{main:(n=p,"".concat(n,"ms linear mainOut 0s 1 normal forwards")),effect:Bn(p),circleRight:Dn(p),circleLeft:zn(p),circle:Nn(p)}}}({time:n,currentColor:t.color||"currentcolor",targetColor:U.dataset.color,effectOpacity:o.opacity||0,effectScale:o.scale||0,circleLeftRotation:a.rotate||0,circleRightRotation:c.rotate||0,circleClipPath:r.clipPath||"inset(0px)",circleOpacity:r.opacity||1}),i=e.rules,l=e.names;le=Zn(i.main),se=Zn(i.effect),ue=Zn(i.circleLeft),fe=Zn(i.circleRight),de=Zn(i.circle),U.style.animation=l.main,Y.style.animation=l.effect,q.style.animation=l.circleLeft,H.style.animation=l.circleRight,K.style.animation=l.circle}))}},be=function(){B(J,Q)},Pe=function(e){J.push(e),Q.push(e[0],e[1])},Se=function(e){var n=v(e,2),t=n[0],r=n[1],o=v(J[0],2),i=o[0],a=o[1];J[1]=[t,a],J[2]=[t,r],J[3]=[i,r],J[4]=[i,a],Q[2]=t,Q[3]=a,Q[4]=t,Q[5]=r,Q[6]=i,Q[7]=r,Q[8]=i,Q[9]=a},Ae=function(e){ee.push(e)},Ee=function(e,n,t){var r,o=v(e,2),i=o[0],a=o[1],c=v(n,2),l=i-c[0],s=a-c[1],u=(r=[l,s],Math.sqrt(r.reduce(((e,n)=>e+n**2),0)));return[+s/u*t,-l/u*t]},Me=function(e){var n=ee.at(-1),t=Math.abs(j([0,0])[0]-j([_/2,0])[0]),r=v(Ee(e,n,t),2),o=r[0],i=r[1],a=ee.length;if(1===a){var c=[n[0]+o,n[1]+i],l=[n[0]-o,n[1]-i];J.push(c,l),Q.push(c[0],c[1],l[0],l[1]),ne.push([o,i])}else{var s=v(Ee(e,n,t),2);o=s[0],i=s[1];var u=v(function(e,n,t){if(0===e.length)return 0;if(1===e.length)return e[0];for(var r=Math.pow(2,-1/n),o=Math.max(0,e.length-t),i=e.slice(o),a=0,c=0,l=0,s=i.length-1;s>=0;s--){var u=i.length-1-s,f=Math.pow(r,u);a+=i[s][0]*f,c+=i[s][1]*f,l+=f}return[a/l,c/l]}([].concat(h(ne),[[o,i]]),1,10),2);o=u[0],i=u[1];var f=v(ne.at(-1),2),d=(o+f[0])/2,p=(i+f[1])/2,y=[n[0]+d,n[1]+p],m=[n[0]-d,n[1]-p];J.splice(a-1,2,y,m),Q.splice(2*(a-1),4,y[0],y[1],m[0],m[1]),ne.splice(a,1,[d,p])}var g=[e[0]+o,e[1]+i],w=[e[0]-o,e[1]-i];J.splice(a,0,g,w),Q.splice(2*a,0,g[0],g[1],w[0],w[1]),ee.push(e),ne.push([o,i])},Ie=Pe,Ce=Pe,Te=function(e){if(Z){(t=e[0],r=e[1],o=Z[0],i=Z[1],Math.sqrt((t-o)**2+(r-i)**2))>k&&(Z=e,Ie(j(e)),J.length>1&&be())}else{$||($=!0,D()),Z=e;var n=j(e);Ce(n)}var t,r,o,i},Le=A(Te,N,N),Oe=function(n,t){var r=function(n){var t=e.getBoundingClientRect(),r=t.left,o=t.top;return[n.clientX-r,n.clientY-o]}(n);return t?Le(r):Te(r)},Re=function(){J=[],Q=[],ee=[],ne=[],Z=void 0,be()},Be=function(e){me(e)},De=function(){X=!0,$=!0,Re(),D()},ze=function(){ge()},_e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.intersect,t=void 0!==n&&n,r=e.merge,o=void 0!==r&&r,i=e.remove,a=void 0!==i&&i;$=!1;var c=h(J),l=h(Q);return Le.cancel(),Re(),c.length>0&&z(c,l,{intersect:t,merge:o,remove:a}),c},Ve=function(e){return"onDraw"===e?B:"onStart"===e?D:"onEnd"===e?z:"enableInitiator"===e?L:"minDelay"===e?N:"minDist"===e?k:"pointNorm"===e?j:"type"===e?F:"brushSize"===e?_:void 0},We=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onDraw,t=void 0===n?null:n,r=e.onStart,o=void 0===r?null:r,i=e.onEnd,a=void 0===i?null:i,c=e.enableInitiator,l=void 0===c?null:c,s=e.initiatorParentElement,u=void 0===s?null:s,f=e.longPressIndicatorParentElement,d=void 0===f?null:f,v=e.minDelay,h=void 0===v?null:v,p=e.minDist,y=void 0===p?null:p,m=e.pointNorm,g=void 0===m?null:m,w=e.type,x=void 0===w?null:w,b=e.brushSize,P=void 0===b?null:b;B=Vn(t,B),D=Vn(o,D),z=Vn(a,z),L=Vn(l,L),N=Vn(h,N),k=Vn(y,k),j=Vn(g,j),_=Vn(P,_),null!==u&&u!==O&&(O.removeChild(V),u.appendChild(V),O=u),null!==d&&d!==R&&(R.removeChild(U),d.appendChild(U),R=d),L?(V.addEventListener("click",Be),V.addEventListener("mousedown",De),V.addEventListener("mouseleave",ze)):(V.removeEventListener("mousedown",De),V.removeEventListener("mouseleave",ze)),null!==x&&function(e){switch(e){case"rectangle":F=e,Ie=Se,Ce=Pe;break;case"brush":F=e,Ie=Me,Ce=Ae;break;default:F="freeform",Ie=Pe,Ce=Pe}}(x)},Ze=function(){O.removeChild(V),R.removeChild(U),window.removeEventListener("mouseup",ve),V.removeEventListener("click",Be),V.removeEventListener("mousedown",De),V.removeEventListener("mouseleave",ze)};return O.appendChild(V),R.appendChild(U),We({onDraw:B,onStart:D,onEnd:z,enableInitiator:L,initiatorParentElement:O,type:F,brushSize:_}),((...e)=>n=>e.reduce(((e,n)=>n(e)),n))(P("initiator",V),P("longPressIndicator",U),(function(e){return b(e,{clear:Re,destroy:Ze,end:_e,extend:Oe,get:Ve,set:We,showInitiator:me,hideInitiator:ge,showLongPressIndicator:we,hideLongPressIndicator:xe})}),(he=Yn,e=>b({__proto__:{constructor:he}},e)))({})},Xn=function(e,n){return!!e&&we.reduce((function(t,r){return e.hasExtension(r)?t:(n||console.warn("WebGL: ".concat(r," extension not supported. Scatterplot might not render properly")),!1)}),!0)},$n=function(e){var n,t=e.getContext("webgl",{antialias:!0,preserveDrawingBuffer:!0}),r=[],o=s(we);try{for(o.s();!(n=o.n()).done;){var a=n.value;t.getExtension(a)?r.push(a):console.warn("WebGL: ".concat(a," extension not supported. Scatterplot might not render properly"))}}catch(e){o.e(e)}finally{o.f()}return i.default({gl:t,extensions:r})},Jn=function(e,n,t,r){return Math.sqrt(Math.pow(e-t,2)+Math.pow(n-r,2))},Qn=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,et=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).minLength,r=void 0===t?0:t;return Array.isArray(e)&&e.length>=r&&e.every(n)},nt=function(e){return!Number.isNaN(+e)&&+e>=0},tt=function(e){return!Number.isNaN(+e)&&+e>0},rt=function(e,n){return function(t){return e.indexOf(t)>=0?t:n}},ot=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bn;return new Promise((function(r,o){(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bn;return new Promise((function(r,o){var i=new Image;n&&(i.crossOrigin="anonymous"),i.src=e,i.onload=function(){r(i)};var a=function(){o(new Error("IMAGE_LOAD_ERROR"))};i.onerror=a,setTimeout(a,t)}))})(n,0!==n.indexOf(window.location.origin)&&-1===n.indexOf("base64"),t).then((function(n){r(e.texture(n))})).catch((function(e){o(e)}))}))},it=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return[].concat(h(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.replace(Qn,(function(e,n,t,r){return"#".concat(n).concat(n).concat(t).concat(t).concat(r).concat(r)})).substring(1).match(/.{2}/g).map((function(e){return Number.parseInt(e,16)/Math.pow(255,n)}))}(e,n)),[Math.pow(255,!n)])},at=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,ct=function(e){return e>=0&&e<=1},lt=function(e){return Array.isArray(e)&&e.every(ct)};function st(e,n,t,r,o,i){return(t-e)*(i-n)-(o-e)*(r-n)}var ut=function(e){for(var n=v(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),t=n[0],r=n[1],o=0,i=0,a=e.length-2;i<e.length;i+=2){var c=e[i],l=e[i+1],s=e[a],u=e[a+1];if(l<=r){if(u>r)st(c,l,s,u,t,r)>0&&o++}else if(u<=r){st(c,l,s,u,t,r)<0&&o--}a=i}return 0!==o},ft=function(e){return"string"==typeof e||e instanceof String},dt=function(e){return Number.isInteger(e)&&e>=0&&e<=255},vt=function(e){return Array.isArray(e)&&e.every(dt)},ht=function(e){return Array.isArray(e)&&e.length>0&&(Array.isArray(e[0])||ft(e[0]))},pt=function(e,n){return e>n?e:n},yt=function(e,n){return e<n?e:n},mt=function(e,n){if(4===(r=e).length&&(lt(r)||vt(r))){var t=lt(e);return n&&t||!n&&!t?e:n&&!t?e.map((function(e){return e/255})):e.map((function(e){return 255*e}))}var r,o,i;if(3===(o=e).length&&(lt(o)||vt(o))){var a=Math.pow(255,!n),c=lt(e);return[].concat(n&&c||!n&&!c?h(e):h(n&&!c?e.map((function(e){return e/255})):e.map((function(e){return 255*e}))),[a])}return i=e,at.test(i)?it(e,n):(console.warn("Only HEX, RGB, and RGBA are handled by this function. Returning white instead."),n?[1,1,1,1]:[255,255,255,255])},gt=function(e){return.21*e[0]+.72*e[1]+.07*e[2]},wt=function(e){return new Promise((function(n,t){if(!e||Array.isArray(e))n(e);else{var r=Array.isArray(e.x)||ArrayBuffer.isView(e.x)?e.x.length:0,o=(Array.isArray(e.x)||ArrayBuffer.isView(e.x))&&function(n){return e.x[n]},i=(Array.isArray(e.y)||ArrayBuffer.isView(e.y))&&function(n){return e.y[n]},a=(Array.isArray(e.line)||ArrayBuffer.isView(e.line))&&function(n){return e.line[n]},c=(Array.isArray(e.lineOrder)||ArrayBuffer.isView(e.lineOrder))&&function(n){return e.lineOrder[n]},l=Object.keys(e),s=(d=l.find((function(e){return wn.has(e)})))&&(Array.isArray(e[d])||ArrayBuffer.isView(e[d]))&&function(n){return e[d][n]},u=(f=l.find((function(e){return xn.has(e)})))&&(Array.isArray(e[f])||ArrayBuffer.isView(e[f]))&&function(n){return e[f][n]};o&&i&&s&&u&&a&&c?n(e.x.map((function(e,n){return[e,i(n),s(n),u(n),a(n),c(n)]}))):o&&i&&s&&u&&a?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n),u(n),a(n)]}))):o&&i&&s&&u?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n),u(n)]}))):o&&i&&s?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n)]}))):o&&i?n(Array.from({length:r},(function(e,n){return[o(n),i(n)]}))):t(new Error("You need to specify at least x and y"))}var f,d}))},xt=function(e){return Number.isFinite(e.y)&&!("x"in e)},bt=function(e){return Number.isFinite(e.x)&&!("y"in e)},Pt=function(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height)},St=function(e){return Number.isFinite(e.x1)&&Number.isFinite(e.y1)&&Number.isFinite(e.x2)&&Number.isFinite(e.x2)},At=function(e){return"vertices"in e&&e.vertices.length>1},Et=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.regl,t=e.canvas,r=void 0===t?document.createElement("canvas"):t,o=e.gamma,i=void 0===o?1:o,a=!1;n||(n=$n(r));var c=Xn(n),l=[r.width,r.height],s=n.framebuffer({width:l[0],height:l[1],colorFormat:"rgba",colorType:"float"}),u=n({vert:"\n precision highp float;\n attribute vec2 xy;\n void main () {\n gl_Position = vec4(xy, 0, 1);\n }",frag:"\n precision highp float;\n uniform vec2 srcRes;\n uniform sampler2D src;\n uniform float gamma;\n\n vec3 approxLinearToSRGB (vec3 rgb, float gamma) {\n return pow(clamp(rgb, vec3(0), vec3(1)), vec3(1.0 / gamma));\n }\n\n void main () {\n vec4 color = texture2D(src, gl_FragCoord.xy / srcRes);\n gl_FragColor = vec4(approxLinearToSRGB(color.rgb, gamma), color.a);\n }",attributes:{xy:[-4,-4,4,-4,0,4]},uniforms:{src:function(){return s},srcRes:function(){return l},gamma:function(){return i}},count:3,depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}}}),f=new Set,d=n.frame((function(){for(var e=f.values(),n=e.next();!n.done;)n.value(),n=e.next()})),v=function(e,n){var t=void 0===e?Math.min(window.innerWidth,window.screen.availWidth):e,o=void 0===n?Math.min(window.innerHeight,window.screen.availHeight):n;r.width=t*window.devicePixelRatio,r.height=o*window.devicePixelRatio,l[0]=r.width,l[1]=r.height,s.resize.apply(s,l)},h=function(){v()};e.canvas||(window.addEventListener("resize",h),window.addEventListener("orientationchange",h),v());return{get canvas(){return r},get regl(){return n},get gamma(){return i},set gamma(e){i=+e},get isSupported(){return c},get isDestroyed(){return a},render:function(e,t){n.clear(xe),s.use((function(){n.clear(xe),e()})),u(),function(e){var n=e.getContext("2d");n.clearRect(0,0,e.width,e.height),n.drawImage(r,(r.width-e.width)/2,(r.height-e.height)/2,e.width,e.height,0,0,e.width,e.height)}(t)},resize:v,onFrame:function(e){return f.add(e),function(){f.delete(e)}},refresh:function(){n.poll()},destroy:function(){a=!0,window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),d.cancel(),r=void 0,n.destroy(),n=void 0}}};const Mt=e=>`\nprecision highp float;\n\nuniform sampler2D colorTex;\nuniform float colorTexRes;\nuniform float colorTexEps;\nuniform sampler2D stateTex;\nuniform float stateTexRes;\nuniform float stateTexEps;\nuniform float devicePixelRatio;\nuniform sampler2D encodingTex;\nuniform float encodingTexRes;\nuniform float encodingTexEps;\nuniform float pointSizeExtra;\nuniform float pointOpacityMax;\nuniform float pointOpacityScale;\nuniform float numPoints;\nuniform float globalState;\nuniform float isColoredByZ;\nuniform float isColoredByW;\nuniform float isOpacityByZ;\nuniform float isOpacityByW;\nuniform float isOpacityByDensity;\nuniform float isSizedByZ;\nuniform float isSizedByW;\nuniform float isPixelAligned;\nuniform float colorMultiplicator;\nuniform float opacityMultiplicator;\nuniform float opacityDensity;\nuniform float sizeMultiplicator;\nuniform float numColorStates;\nuniform float pointScale;\nuniform float drawingBufferWidth;\nuniform float drawingBufferHeight;\nuniform mat4 modelViewProjection;\n\nattribute vec2 stateIndex;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nvoid main() {\n vec4 state = texture2D(stateTex, stateIndex);\n\n if (isPixelAligned < 0.5) {\n gl_Position = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n } else {\n vec4 clipSpacePosition = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n vec2 ndcPosition = clipSpacePosition.xy / clipSpacePosition.w;\n vec2 pixelPos = 0.5 * (ndcPosition + 1.0) * vec2(drawingBufferWidth, drawingBufferHeight);\n pixelPos = floor(pixelPos + 0.5); // Snap to nearest pixel\n vec2 snappedPosition = (pixelPos / vec2(drawingBufferWidth, drawingBufferHeight)) * 2.0 - 1.0;\n gl_Position = vec4(snappedPosition, 0.0, 1.0);\n }\n\n\n // Determine color index\n float colorIndexZ = isColoredByZ * floor(state.z * colorMultiplicator);\n float colorIndexW = isColoredByW * floor(state.w * colorMultiplicator);\n\n // Multiply by the number of color states per color\n // I.e., normal, active, hover, background, etc.\n float colorIndex = (colorIndexZ + colorIndexW) * numColorStates;\n\n // Half a "pixel" or "texel" in texture coordinates\n float colorLinearIndex = colorIndex + globalState;\n\n // Need to add cEps here to avoid floating point issue that can lead to\n // dramatic changes in which color is loaded as floor(3/2.9999) = 1 but\n // floor(3/3.0001) = 0!\n float colorRowIndex = floor((colorLinearIndex + colorTexEps) / colorTexRes);\n\n vec2 colorTexIndex = vec2(\n (colorLinearIndex / colorTexRes) - colorRowIndex + colorTexEps,\n colorRowIndex / colorTexRes + colorTexEps\n );\n\n color = texture2D(colorTex, colorTexIndex);\n\n // Retrieve point size\n float pointSizeIndexZ = isSizedByZ * floor(state.z * sizeMultiplicator);\n float pointSizeIndexW = isSizedByW * floor(state.w * sizeMultiplicator);\n float pointSizeIndex = pointSizeIndexZ + pointSizeIndexW;\n\n float pointSizeRowIndex = floor((pointSizeIndex + encodingTexEps) / encodingTexRes);\n vec2 pointSizeTexIndex = vec2(\n (pointSizeIndex / encodingTexRes) - pointSizeRowIndex + encodingTexEps,\n pointSizeRowIndex / encodingTexRes + encodingTexEps\n );\n float pointSize = texture2D(encodingTex, pointSizeTexIndex).x;\n\n // Retrieve opacity\n ${3===e?"":`\n if (isOpacityByDensity < 0.5) {\n float opacityIndexZ = isOpacityByZ * floor(state.z * opacityMultiplicator);\n float opacityIndexW = isOpacityByW * floor(state.w * opacityMultiplicator);\n float opacityIndex = opacityIndexZ + opacityIndexW;\n\n float opacityRowIndex = floor((opacityIndex + encodingTexEps) / encodingTexRes);\n vec2 opacityTexIndex = vec2(\n (opacityIndex / encodingTexRes) - opacityRowIndex + encodingTexEps,\n opacityRowIndex / encodingTexRes + encodingTexEps\n );\n color.a = texture2D(encodingTex, opacityTexIndex)[${1+e}];\n } else {\n color.a = min(1.0, opacityDensity + globalState);\n }\n `}\n\n color.a = min(pointOpacityMax, color.a) * pointOpacityScale;\n finalPointSize = (pointSize * pointScale) + pointSizeExtra;\n gl_PointSize = finalPointSize;\n}\n`;var It=function(){var e=function(e,n,t,r,o){var i=.5*(r-n),a=.5*(o-t);return(2*t-2*r+i+a)*e*e*e+(-3*t+3*r-2*i-a)*e*e+i*e+t},n=function(n,t,r){var o=r*n,i=Math.floor(o),a=o-i,c=t[Math.max(0,i-1)],l=t[i],s=t[Math.min(r,i+1)],u=t[Math.min(r,i+2)];return[e(a,c[0],l[0],s[0],u[0]),e(a,c[1],l[1],s[1],u[1])]},t=function(e,n,t){var r=n[0],o=n[1],i=t[0]-r,a=t[1]-o;if(0!==i||0!==a){var c=((e[0]-r)*i+(e[1]-o)*a)/(i*i+a*a);c>1?(r=t[0],o=t[1]):c>0&&(r+=i*c,o+=a*c)}return(i=e[0]-r)*i+(a=e[1]-o)*a},r=function(e,n,o,i,a){for(var c,l=i,s=n+1;s<o;s++){var u=t(e[s],e[n],e[o]);u>l&&(c=s,l=u)}l>i&&(c-n>1&&r(e,n,c,i,a),a.push(e[c]),o-c>1&&r(e,c,o,i,a))},o=function(e,n){var t=e.length-1,o=[e[0]];return r(e,0,t,n,o),o.push(e[t]),o};self.onmessage=function(e){(e.data.points?+e.data.points.length:0)||self.postMessage({error:new Error("No points provided")}),e.data.points;var t=function(e){var n={},t=!Number.isNaN(+e[0][5]);return e.forEach((function(e){var r=e[4];n[r]||(n[r]=[]),t?n[r][e[5]]=e:n[r].push(e)})),Object.entries(n).forEach((function(e){n[e[0]]=e[1].filter((function(e){return e})),n[e[0]].reference=e[1][0]})),n}(e.data.points);self.postMessage({points:Object.entries(t).reduce((function(t,r){return t[r[0]]=function(e){for(var t,r,i,a,c,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=l.maxIntPointsPerSegment,u=void 0===s?100:s,f=l.tolerance,d=void 0===f?.002:f,v=e.length,h=v-1,p=h*u+1,y=Math.pow(d,2),m=[],g=0;g<v-1;g++){var w=[e[g].slice(0,2)];t=e[g];for(var x=1;x<u;x++){var b=n((g*u+x)/p,e,h);r=t[0],i=t[1],a=b[0],c=b[1],Math.pow(r-a,2)+Math.pow(i-c,2)>y&&(w.push(b),t=b)}w.push(e[g+1]),w=o(w,y),m=m.concat(w.slice(0,w.length-1))}return m.push(e[e.length-1].slice(0,2)),m.flat()}(r[1],e.data.options),t[r[0]].reference=r[1].reference,t}),{})})}},Ct=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{tolerance:.002,maxIntPointsPerSegment:100};return new Promise((function(t,r){var o,i=(o=It,new Worker(window.URL.createObjectURL(new Blob([`(${o.toString()})()`],{type:"text/javascript"}))));i.onmessage=function(e){e.data.error?r(e.data.error):t(e.data.points),i.terminate()},i.postMessage({points:e,options:n})}))},Tt={showRecticle:{replacement:"showReticle",removalVersion:"2",translation:g},recticleColor:{replacement:"reticleColor",removalVersion:"2",translation:g},keyMap:{replacement:"actionKeyMap",removalVersion:"2",translation:function(e){return Object.entries(e).reduce((function(e,n){var t=v(n,2),r=t[0],o=t[1];return e[o]?e[o]=[].concat(h(e[o]),[r]):e[o]=r,e}),{})}}},Lt=function(e){var n,t=Object.keys(e).filter((function(e){return Tt[e]})),r=s(t);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=Tt[o],a=i.replacement,c=i.removalVersion,l=i.translation;console.warn('regl-scatterplot: the "'.concat(o,'" property is deprecated and will be removed in v').concat(c,'. Please use "').concat(a,'" instead.')),e[Tt[o].replacement]=e[o]!==Pn?l(e[o]):e[o],delete e[o]}}catch(e){r.e(e)}finally{r.f()}return e},Ot=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.allowSegment,o=void 0!==r&&r,i=t.allowDensity,a=void 0!==i&&i,c=t.allowInherit,l=void 0!==c&&c;return wn.has(e)?"valueZ":xn.has(e)?"valueW":"segment"===e?o?"segment":n:"density"===e?a?"density":n:"inherit"===e&&l?"inherit":n},Rt=function(e){switch(e){case"valueZ":return 2;case"valueW":return 3;default:return null}};e.checkSupport=Xn,e.createRegl=$n,e.createRenderer=Et,e.createSpatialIndex=function(e,n){return wt(e).then((function(e){return ye(e,{useWorker:n})})).then((function(e){return e.data}))},e.createTextureFromUrl=ot,e.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=o.default({async:!e.syncEvents,caseInsensitive:!0}),t=new Float32Array(16),r=new Float32Array(16),i=[0,0];Lt(e);var a=e.renderer,l=e.antiAliasing,p=void 0===l?.5:l,y=e.pixelAligned,m=void 0!==y&&y,b=e.backgroundColor,P=void 0===b?un:b,S=e.backgroundImage,E=void 0===S?null:S,M=e.canvas,I=void 0===M?document.createElement("canvas"):M,O=e.colorBy,D=void 0===O?an:O,z=e.deselectOnDblClick,N=void 0===z||z,F=e.deselectOnEscape,_=void 0===F||F,V=e.lassoColor,W=void 0===V?De:V,Z=e.lassoLineWidth,G=void 0===Z?2:Z,U=e.lassoMinDelay,K=void 0===U?10:U,q=e.lassoMinDist,H=void 0===q?3:q,Y=e.lassoMode,X=void 0===Y?null:Y,$=e.lassoClearEvent,J=void 0===$?ze:$,Q=e.lassoInitiator,ee=void 0!==Q&&Q,ne=e.lassoInitiatorParentElement,te=void 0===ne?document.body:ne,re=e.lassoLongPressIndicatorParentElement,oe=void 0===re?document.body:re,ie=e.lassoOnLongPress,ae=void 0!==ie&&ie,ce=e.lassoLongPressTime,le=void 0===ce?Ne:ce,se=e.lassoLongPressAfterEffectTime,ue=void 0===se?ke:se,de=e.lassoLongPressEffectDelay,ve=void 0===de?je:de,he=e.lassoLongPressRevertEffectTime,pe=void 0===he?Fe:he,we=e.lassoType,xe=void 0===we?"lasso":we,wn=e.lassoBrushSize,xn=void 0===wn?24:wn,En=e.actionKeyMap,Mn=void 0===En?Je:En,In=e.mouseMode,Cn=void 0===In?Ee:In,Tn=e.showReticle,Ln=void 0!==Tn&&Tn,On=e.reticleColor,Rn=void 0===On?gn:On,Bn=e.pointColor,Dn=void 0===Bn?cn:Bn,zn=e.pointColorActive,Nn=void 0===zn?ln:zn,kn=e.pointColorHover,jn=void 0===kn?sn:kn,Fn=e.showPointConnections,_n=void 0!==Fn&&Fn,Vn=e.pointConnectionColor,Wn=void 0===Vn?dn:Vn,Zn=e.pointConnectionColorActive,Gn=void 0===Zn?vn:Zn,Un=e.pointConnectionColorHover,Kn=void 0===Un?hn:Un,qn=e.pointConnectionColorBy,Hn=void 0===qn?fn:qn,Xn=e.pointConnectionOpacity,$n=void 0===Xn?null:Xn,Qn=e.pointConnectionOpacityBy,it=void 0===Qn?rn:Qn,at=e.pointConnectionOpacityActive,ct=void 0===at?.66:at,lt=e.pointConnectionSize,st=void 0===lt?2:lt,dt=e.pointConnectionSizeActive,vt=void 0===dt?2:dt,It=e.pointConnectionSizeBy,Tt=void 0===It?tn:It,Bt=e.pointConnectionMaxIntPointsPerSegment,Dt=void 0===Bt?100:Bt,zt=e.pointConnectionTolerance,Nt=void 0===zt?.002:zt,kt=e.pointSize,jt=void 0===kt?6:kt,Ft=e.pointSizeSelected,_t=void 0===Ft?2:Ft,Vt=e.pointSizeMouseDetection,Wt=void 0===Vt?"auto":Vt,Zt=e.pointOutlineWidth,Gt=void 0===Zt?2:Zt,Ut=e.opacity,Kt=void 0===Ut?me:Ut,qt=e.opacityBy,Ht=void 0===qt?on:qt,Yt=e.opacityByDensityFill,Xt=void 0===Yt?.15:Yt,$t=e.opacityInactiveMax,Jt=void 0===$t?1:$t,Qt=e.opacityInactiveScale,er=void 0===Qt?1:Qt,nr=e.sizeBy,tr=void 0===nr?nn:nr,rr=e.pointScaleMode,or=void 0===rr?"asinh":rr,ir=e.height,ar=void 0===ir?en:ir,cr=e.width,lr=void 0===cr?Qe:cr,sr=e.annotationLineColor,ur=void 0===sr?pn:sr,fr=e.annotationLineWidth,dr=void 0===fr?1:fr,vr=e.annotationHVLineLimit,hr=void 0===vr?1e3:vr,pr=e.cameraIsFixed,yr=void 0!==pr&&pr,mr=lr===me?1:lr,gr=ar===me?1:ar,wr=e.performanceMode,xr=void 0!==wr&&wr,br=e.opacityByDensityDebounceTime,Pr=void 0===br?25:br,Sr=e.spatialIndexUseWorker,Ar=void 0===Sr?undefined:Sr,Er=Boolean(e.renderPointsAsSquares||xr),Mr=Boolean(e.disableAlphaBlending||xr);Cn=rt(Ae,be)(Cn),a||(a=Et({regl:e.regl,gamma:e.gamma})),P=mt(P,!0),W=mt(W,!0),Rn=mt(Rn,!0);var Ir,Cr,Tr,Lr,Or,Rr,Br,Dr,zr,Nr,kr,jr,Fr,_r,Vr,Wr,Zr,Gr,Ur=!1,Kr=!1,qr=gt(P),Hr=!1,Yr=null,Xr=[0,0],$r=-1,Jr=[],Qr=new Set,eo=new Set,no=!1,to=new Set,ro=[],oo=0,io=0,ao=!1,co=[],lo=e.aspectRatio||1,so=!1,uo=!0,fo=!1;Dn=ht(Dn)?h(Dn):[Dn],Nn=ht(Nn)?h(Nn):[Nn],jn=ht(jn)?h(jn):[jn],Dn=Dn.map((function(e){return mt(e,!0)})),Nn=Nn.map((function(e){return mt(e,!0)})),jn=jn.map((function(e){return mt(e,!0)})),Kt=!Array.isArray(Kt)&&Number.isNaN(+Kt)?Dn[0][3]:Kt,Kt=et(Kt,nt,{minLength:1})?h(Kt):[Kt];var vo,ho,po,yo,mo=1/(jt=et(jt,nt,{minLength:1})?h(jt):[jt])[0];Wn="inherit"===Wn?h(Dn):(Wn=ht(Wn)?h(Wn):[Wn]).map((function(e){return mt(e,!0)})),Gn="inherit"===Gn?h(Nn):(Gn=ht(Gn)?h(Gn):[Gn]).map((function(e){return mt(e,!0)})),Kn="inherit"===Kn?h(jn):(Kn=ht(Kn)?h(Kn):[Kn]).map((function(e){return mt(e,!0)})),$n="inherit"===$n?h(Kt):et($n,nt,{minLength:1})?h($n):[$n],st="inherit"===st?h(jt):et(st,nt,{minLength:1})?h(st):[st],D=Ot(D,an),Ht=Ot(Ht,on,{allowDensity:!0}),tr=Ot(tr,nn),Hn=Ot(Hn,fn,{allowSegment:!0,allowInherit:!0}),it=Ot(it,rn,{allowSegment:!0}),Tt=Ot(Tt,tn,{allowSegment:!0});var go,wo,xo,bo,Po,So,Ao,Eo,Mo,Io,Co,To,Lo=0,Oo=0,Ro=!1,Bo=null,Do=Ln,zo=0,No=0,ko=!1,jo=!1,Fo=!1,_o=!1,Vo=Te,Wo=Te,Zo=!1,Go=e.xScale||null,Uo=e.yScale||null,Ko=0,qo=0,Ho=0,Yo=0;Go&&(Ko=Go.domain()[0],qo=Go.domain()[1]-Go.domain()[0],Go.range([0,mr])),Uo&&(Ho=Uo.domain()[0],Yo=Uo.domain()[1]-Uo.domain()[0],Uo.range([gr,0]));var Xo=function(e){return e/mr*2-1},$o=function(e){return 1+e/gr*-2},Jo=function(e,n){var r=[e,n,1,1];return B(r,r,T(t,L(t,Rr,L(t,Ir.view,Dr)))),r.slice(0,2)},Qo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=ia(),t=(Wr[1]-Zr[1])/I.height;return(_r*n+e)*t},ei=function(){return no?ro.filter((function(e,n){return to.has(n)})):ro},ni=function(e,n,t,r){var o=Lr.range(e,n,t,r);return no?o.filter((function(e){return to.has(e)})):o},ti=function(){var e,n=v([Xo(i[0]),$o(i[1])],2),t=n[0],r=n[1],o=v(Jo(t,r),2),a=o[0],c=o[1],l=Qo(4),u=l,f=-1,d=s(ni(a-l,c-l,a+l,c+l));try{for(d.s();!(e=d.n()).done;){var h=e.value,p=v(ro[h],2),y=p[0],m=p[1],g=Jn(y,m,a,c);g<u&&(u=g,f=h)}}catch(e){d.e(e)}finally{d.f()}return f},ri=function(e){var n,t,r,o,i,a=function(e){for(var n=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=0;i<e.length;i+=2)n=e[i]<n?e[i]:n,t=e[i]>t?e[i]:t,r=e[i+1]<r?e[i+1]:r,o=e[i+1]>o?e[i+1]:o;return[n,r,t,o]}(e);if(n=v(a,4),t=n[0],r=n[1],o=n[2],i=n[3],!(Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(i)&&o-t>0&&i-r>0))return[];var c,l=[],u=s(ni.apply(void 0,h(a)));try{for(u.s();!(c=u.n()).done;){var f=c.value;ut(e,ro[f])&&l.push(f)}}catch(e){u.e(e)}finally{u.f()}return l},oi=function(){co=[],Cr&&Cr.clear()},ii=function(e){return e&&e.length>4},ai=function(e,n){if(!kr&&_n&&ii(ro[e[0]])){var t,r=0===n,o=1===n?function(e){return eo.add(e)}:g,i=Object.keys(e.reduce((function(e,n){var t=ro[n];return e[Array.isArray(t[4])?t[4][0]:t[4]]=!0,e}),{})),a=zr.getData().opacities,c=i.filter((function(e){return!eo.has(+e)})),l=s(c);try{for(l.s();!(t=l.n()).done;){var u=t.value,f=Nr[u][0],d=Nr[u][2],v=4*f+2*Nr[u][3],h=v+2*d+4;void 0===a.__original__&&(a.__original__=a.slice());for(var p=v;p<h;p++)a[p]=r?a.__original__[p]:ct;o(u)}}catch(e){l.e(e)}finally{l.f()}zr.getBuffer().opacities.subdata(a,0)}},ci=function(e){return[e%Lo/Lo+Oo,Math.floor(e/Lo)/Lo+Oo]},li=function(e){return no&&!to.has(e)},si=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;J===Oe&&oi(),Jr.length>0&&(t||n.publish("deselect"),eo.clear(),ai(Jr,0),Jr=[],Qr.clear(),uo=!0)},ui=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.intersect,o=void 0!==r&&r,i=t.merge,a=void 0!==i&&i,c=t.remove,l=void 0!==c&&c,s=t.preventEvent,u=void 0!==s&&s,f=Array.isArray(e)?e:[e],d=h(Jr);if(o){var v=new Set(f);if(Jr=Jr.length>0?Jr.filter((function(e){return v.has(e)})):f,d.length===Jr.length)return void(uo=!0)}else if(a){if(Jr=((e,n)=>{const t=[];return e.forEach((e=>{t[e]=!0})),n.forEach((e=>{t[e]=!0})),t.reduce(((e,n,t)=>(n&&e.push(t),e)),[])})(Jr,f),d.length===Jr.length)return void(uo=!0)}else if(l){var p=new Set(f);if(Jr=Jr.filter((function(e){return!p.has(e)})),d.length===Jr.length)return void(uo=!0)}else{var y;if((null===(y=Jr)||void 0===y?void 0:y.length)>0&&ai(Jr,0),d.length>0&&0===f.length)return void si({preventEvent:u});Jr=f}if(w(d,Jr))uo=!0;else{var m=[];Qr.clear(),eo.clear();for(var g=Jr.length-1;g>=0;g--){var x=Jr[g];x<0||x>=oo||li(x)?Jr.splice(g,1):(Qr.add(x),m.push.apply(m,ci(x)))}wo({usage:"dynamic",type:"float",data:m}),ai(Jr,1),u||n.publish("select",{points:Jr}),uo=!0}},fi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.showReticleOnce,o=void 0!==r&&r,i=t.preventEvent,a=void 0!==i&&i,c=!1;if(!(no&&!to.has(e))&&e>=0&&e<oo){c=!0;var l=To,s=e!==To;+l>=0&&s&&!Qr.has(l)&&ai([l],0),To=e,xo.subdata(ci(e)),Qr.has(e)||ai([e],2),s&&!a&&n.publish("pointover",To)}else(c=+To>=0)&&(Qr.has(To)||ai([To],0),a||n.publish("pointout",To)),To=void 0;c&&(uo=!0,fo=o)},di=function(e){var n=I.getBoundingClientRect();return i[0]=e.clientX-n.left,i[1]=e.clientY-n.top,[].concat(i)},vi=Yn(I,{onStart:function(){Ir.config({isFixed:!0}),Hr=!0,ao=!0,oi(),$r>=0&&(clearTimeout($r),$r=-1),n.publish("lassoStart")},onDraw:function(e,t){co=e,Cr.setPoints(t),n.publish("lassoExtend",{coordinates:e})},onEnd:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.intersect,i=void 0!==o&&o,a=r.merge,c=void 0!==a&&a,l=r.remove,s=void 0!==l&&l;Ir.config({isFixed:yr}),co=h(e);var u=ri(t);ui(u,{intersect:i,merge:c,remove:s}),n.publish("lassoEnd",{coordinates:co}),J===Re&&oi()},enableInitiator:ee,initiatorParentElement:te,longPressIndicatorParentElement:oe,pointNorm:function(e){var n=v(e,2),t=n[0],r=n[1];return Jo(Xo(t),$o(r))},minDelay:K,minDist:"brush"===xe?Math.max(3,H):H,type:xe}),hi=function(e,n){switch(Mn[n]){case Ke:return e.altKey;case qe:return e.metaKey;case He:return e.ctrlKey;case Ye:return e.metaKey;case Xe:return e.shiftKey;default:return!1}},pi=function(e){jo&&1===e.buttons&&(Hr=!0,Yr=performance.now(),Xr=di(e),!(ao=Cn===Pe||hi(e,Ve))&&ae&&(vi.showLongPressIndicator(e.clientX,e.clientY,{time:le,extraTime:ue,delay:ve}),$r=setTimeout((function(){$r=-1,ao=!0}),le)))},yi=function(e){if(jo){if(Hr=!1,$r>=0&&(clearTimeout($r),$r=-1),ao){e.preventDefault(),ao=!1;var n=!!X;vi.end({intersect:n?"intersect"===X:hi(e,_e),merge:n?"merge"===X:hi(e,Ze),remove:n?"remove"===X:hi(e,Ge)})}ae&&vi.hideLongPressIndicator({time:pe})}},mi=function(e){if(jo){e.preventDefault();var n=di(e);if(!(Jn.apply(void 0,h(n).concat(h(Xr)))>=H)){var t=performance.now()-Yr;if(!ee||t<500){var r=ti();r>=0?(Jr.length>0&&J===Oe&&oi(),ui([r],{merge:hi(e,Ze),remove:hi(e,Ge)})):Vr||(Vr=setTimeout((function(){Vr=null,vi.showInitiator(e)}),200))}}}},gi=function(e){vi.hideInitiator(),Vr&&(clearTimeout(Vr),Vr=null),N&&(e.preventDefault(),si())},wi=function(e){if(_o||(Zo=function(e){return document.elementsFromPoint(e.clientX,e.clientY).some((function(e){return e===I}))}(e),_o=!0),jo&&(Zo||Hr)){var n=di(e),t=Jn.apply(void 0,h(n).concat(h(Xr)))>=H;Zo&&!ao&&fi(ti()),ao?(e.preventDefault(),vi.extend(e,!0)):Hr&&ae&&t&&vi.hideLongPressIndicator({time:pe}),$r>=0&&t&&(clearTimeout($r),$r=-1),Hr&&(uo=!0)}},xi=function(){To=void 0,Zo=!1,_o=!1,jo&&(+To>=0&&!Qr.has(To)&&ai([To],0),yi(),uo=!0)},bi=function(){var e=Math.max(jt.length,Kt.length);No=Math.max(2,Math.ceil(Math.sqrt(e)));for(var n=new Float32Array(4*Math.pow(No,2)),t=0;t<e;t++){n[4*t]=jt[t]||0,n[4*t+1]=Math.min(1,Kt[t]||0);var r=Number((Nn[t]||Nn[0])[3]);n[4*t+2]=Math.min(1,Number.isNaN(r)?1:r);var o=Number((jn[t]||jn[0])[3]);n[4*t+3]=Math.min(1,Number.isNaN(o)?1:o)}return a.regl.texture({data:n,shape:[No,No,4],type:"float"})},Pi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dn,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nn,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jn,r=e.length,o=n.length,i=t.length,a=[];if(r===o&&o===i)for(var c=0;c<r;c++)a.push(e[c],n[c],t[c],P);else for(var l=0;l<r;l++){var s=[e[l][0],e[l][1],e[l][2],1],u=D===an?n[0]:s,f=D===an?t[0]:s;a.push(e[l],u,f,P)}return a},Si=function(){var e=Pi(),n=e.length;zo=Math.max(2,Math.ceil(Math.sqrt(n)));var t=new Float32Array(4*Math.pow(zo,2));return e.forEach((function(e,n){t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),a.regl.texture({data:t,shape:[zo,zo,4],type:"float"})},Ai=function(){Rr=R([],[1/(Or=mr/gr),1,1]),Br=R([],[1/Or,1,1]),Dr=R([],[lo,1,1])},Ei=function(e,n){return function(t){if(t&&0!==t.length){var r=h(e()),o=ht(t)?t:[t];if(o=o.map((function(e){return mt(e,!0)})),i=r,a=o,!(Array.isArray(i)&&Array.isArray(a)&&i.length===a.length&&(0===i.length||Array.isArray(i[0])&&Array.isArray(a[0])&&i.every((function(e,n){var t=v(e,4),r=t[0],o=t[1],i=t[2],c=t[3],l=v(a[n],4),s=l[0],u=l[1],f=l[2],d=l[3];return r===s&&o===u&&i===f&&c===d}))))){var i,a;Io&&Io.destroy();try{n(o),Io=Si()}catch(e){console.error("Invalid colors. Switching back to default colors."),n(r),Io=Si()}}}}},Mi=Ei((function(){return Dn}),(function(e){Dn=e})),Ii=Ei((function(){return Nn}),(function(e){Nn=e})),Ci=Ei((function(){return jn}),(function(e){jn=e})),Ti=function(){if(Go||Uo){var e,n,t,r,o,i,a=v((e=Jo(-1,-1),n=Jo(1,1),t=(e[0]+1)/2,r=(n[0]+1)/2,o=(e[1]+1)/2,i=(n[1]+1)/2,[[Ko+t*qo,Ko+r*qo],[Ho+o*Yo,Ho+i*Yo]]),2),c=a[0],l=a[1];Go&&Go.domain(c),Uo&&Uo.domain(l)}},Li=function(e,n){gr=Math.max(1,e),I.height=Math.floor(gr*window.devicePixelRatio),Uo&&(Uo.range([gr,0]),n||Ti())},Oi=function(e){if(e===me)return ar=e,I.style.height="100%",void window.requestAnimationFrame((function(){I&&Li(I.getBoundingClientRect().height)}));!+e||+e<=0||(Li(ar=+e),I.style.height="".concat(ar,"px"))},Ri=function(){_r=Wt,Wt===me&&(_r=Array.isArray(jt)?jt.reduce(((e,n)=>n>e?n:e),-1/0):jt)},Bi=function(e){var n=Array.isArray(jt)?h(jt):jt;et(e,nt,{minLength:1})?jt=h(e):tt(+e)&&(jt=[+e]),n===jt||w(n,jt)||(Co&&Co.destroy(),mo=1/jt[0],Co=bi(),Ri())},Di=function(e,n){mr=Math.max(1,e),I.width=Math.floor(mr*window.devicePixelRatio),Go&&(Go.range([0,mr]),n||Ti())},zi=function(e){if(e===me)return lr=e,I.style.width="100%",void window.requestAnimationFrame((function(){I&&Di(I.getBoundingClientRect().width)}));!+e||+e<=0||(Di(lr=+e),I.style.width="".concat(mr,"px"))},Ni=function(e){switch(e){case"valueZ":return Vo;case"valueW":return Wo;default:return null}},ki=function(e,n){return e===Ce?function(e){return Math.round(e*(n.length-1))}:g},ji=function(){return p},Fi=function(){return[I.width,I.height]},_i=function(){return Io},Vi=function(){return zo},Wi=function(){return.5/zo},Zi=function(){return window.devicePixelRatio},Gi=function(){return wo},Ui=function(){return Co},Ki=function(){return No},qi=function(){return.5/No},Hi=function(){return 0},Yi=function(){return po||vo},Xi=function(){return Lo},$i=function(){return.5/Lo},Ji=function(){return Br},Qi=function(){return Ir.view},ea=function(){return Dr},na=function(){return L(r,Br,L(r,Ir.view,Dr))},ta=function(){return window.devicePixelRatio},ra=function(){return pt(mo,Ir.scaling[0])*window.devicePixelRatio},oa=function(){return Ir.scaling[0]>1?Math.asinh(pt(1,Ir.scaling[0]))/Math.asinh(1)*window.devicePixelRatio:pt(mo,Ir.scaling[0])*window.devicePixelRatio},ia=oa;"linear"===or?ia=ra:"constant"===or&&(ia=ta);var aa=function(){return no?to.size:oo},ca=function(){return Jr.length},la=function(){return ca()>0?Jt:1},sa=function(){return ca()>0?er:1},ua=function(){return+("valueZ"===D)},fa=function(){return+("valueW"===D)},da=function(){return+("valueZ"===Ht)},va=function(){return+("valueW"===Ht)},ha=function(){return+("density"===Ht)},pa=function(){return+("valueZ"===tr)},ya=function(){return+("valueW"===tr)},ma=function(){return+m},ga=function(){return"valueZ"===D?Vo===Ce?Dn.length-1:1:Wo===Ce?Dn.length-1:1},wa=function(){return"valueZ"===Ht?Vo===Ce?Kt.length-1:1:Wo===Ce?Kt.length-1:1},xa=function(){return"valueZ"===tr?Vo===Ce?jt.length-1:1:Wo===Ce?jt.length-1:1},ba=function(e){if("density"!==Ht)return 1;var n=ia(),t=jt[0]*n,r=2/(2/Ir.view[0])*(2/(2/Ir.view[5])),o=e.viewportHeight,i=e.viewportWidth,a=Xt*i*o/(io*t*t)*yt(1,r);a*=Er?1:1/(.25*Math.PI);var c=pt(1,t)+.5;return a*=Math.pow(t/c,2),yt(1,pt(0,a))},Pa=a.regl({framebuffer:function(){return yo},vert:"precision highp float;\n\nattribute vec2 position;\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // map normalized device coords to texture coords\n particleTextureIndex = 0.5 * (1.0 + position);\n\n gl_Position = vec4(position, 0, 1);\n}",frag:"precision highp float;\n\nuniform sampler2D startStateTex;\nuniform sampler2D endStateTex;\nuniform float t;\n\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // Interpolate x, y, and value\n vec3 start = texture2D(startStateTex, particleTextureIndex).xyw;\n vec3 end = texture2D(endStateTex, particleTextureIndex).xyw;\n vec3 curr = start * (1.0 - t) + end * t;\n\n // The category cannot be interpolated\n float endCategory = texture2D(endStateTex, particleTextureIndex).z;\n\n gl_FragColor = vec4(curr.xy, endCategory, curr.z);\n}",attributes:{position:[-4,0,4,4,4,-4]},uniforms:{startStateTex:function(){return ho},endStateTex:function(){return vo},t:function(e,n){return n.t}},count:3}),Sa=function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:la,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:sa;return a.regl({frag:Er?"precision highp float;\n\nvarying vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n":"\nprecision highp float;\n\nuniform float antiAliasing;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nvoid main() {\n vec2 c = gl_PointCoord * 2.0 - 1.0;\n float sdf = length(c) * finalPointSize;\n float alpha = linearstep(finalPointSize + antiAliasing, finalPointSize - antiAliasing, sdf);\n\n gl_FragColor = vec4(color.rgb, alpha * color.a);\n}\n",vert:Mt(r),blend:{enable:!Mr,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},attributes:{stateIndex:{buffer:t,size:2}},uniforms:{antiAliasing:ji,resolution:Fi,modelViewProjection:na,devicePixelRatio:Zi,pointScale:function(){return ia()},encodingTex:Ui,encodingTexRes:Ki,encodingTexEps:qi,pointOpacityMax:o,pointOpacityScale:i,pointSizeExtra:e,globalState:r,colorTex:_i,colorTexRes:Vi,colorTexEps:Wi,stateTex:Yi,stateTexRes:Xi,stateTexEps:$i,isColoredByZ:ua,isColoredByW:fa,isOpacityByZ:da,isOpacityByW:va,isOpacityByDensity:ha,isSizedByZ:pa,isSizedByW:ya,isPixelAligned:ma,colorMultiplicator:ga,opacityMultiplicator:wa,opacityDensity:ba,sizeMultiplicator:xa,numColorStates:4,drawingBufferWidth:function(e){return e.drawingBufferWidth},drawingBufferHeight:function(e){return e.drawingBufferHeight}},count:n,primitive:"points"})},Aa=Sa(Hi,aa,(function(){return go})),Ea=Sa(Hi,(function(){return 1}),(function(){return xo}),2,(function(){return 1}),(function(){return 1})),Ma=Sa((function(){return(_t+2*Gt)*window.devicePixelRatio}),ca,Gi,1,(function(){return 1}),(function(){return 1})),Ia=Sa((function(){return(_t+Gt)*window.devicePixelRatio}),ca,Gi,3,(function(){return 1}),(function(){return 1})),Ca=Sa((function(){return _t*window.devicePixelRatio}),ca,Gi,1,(function(){return 1}),(function(){return 1})),Ta=a.regl({frag:"\nprecision mediump float;\n\nuniform sampler2D texture;\n\nvarying vec2 uv;\n\nvoid main () {\n gl_FragColor = texture2D(texture, uv);\n}\n",vert:"\nprecision mediump float;\n\nuniform mat4 modelViewProjection;\n\nattribute vec2 position;\n\nvarying vec2 uv;\n\nvoid main () {\n uv = position;\n gl_Position = modelViewProjection * vec4(-1.0 + 2.0 * uv.x, 1.0 - 2.0 * uv.y, 0, 1);\n}\n",attributes:{position:[0,1,0,0,1,0,0,1,1,1,1,0]},uniforms:{modelViewProjection:na,texture:function(){return E}},count:6}),La=a.regl({vert:"\n precision mediump float;\n uniform mat4 modelViewProjection;\n attribute vec2 position;\n void main () {\n gl_Position = modelViewProjection * vec4(position, 0, 1);\n }",frag:"\n precision mediump float;\n uniform vec4 color;\n void main () {\n gl_FragColor = vec4(color.rgb, 0.2);\n }",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},attributes:{position:function(){return co}},uniforms:{modelViewProjection:na,color:function(){return W}},elements:function(){return j(Cr.getPoints())}}),Oa=function(e){for(var n=new Float32Array(2*e),t=0,r=0;r<e;++r){var o=ci(r);n[t]=o[0],n[t+1]=o[1],t+=2}return n},Ra=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.length;Lo=Math.max(2,Math.ceil(Math.sqrt(t))),Oo=.5/Lo;for(var r=new Float32Array(4*Math.pow(Lo,2)),o=!0,i=!0,c=0,l=0,s=0,u=0;u<t;++u)r[c=4*u]=e[u][0],r[c+1]=e[u][1],l=e[u][2]||0,s=e[u][3]||0,r[c+2]=l,r[c+3]=s,o&&(o=Number.isInteger(l)),i&&(i=Number.isInteger(s));return Vo=n.z&&Le.includes(n.z)?n.z:o?Te:Ce,Wo=n.w&&Le.includes(n.w)?n.w:i?Te:Ce,a.regl.texture({data:r,shape:[Lo,Lo,4],type:"float"})},Ba=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(t){jo=!1;var r=(null==n?void 0:n.preventFilterReset)&&e.length===oo;oo=e.length,io=oo,vo&&vo.destroy(),vo=Ra(e,{z:n.zDataType,w:n.wDataType}),r||go({usage:"static",type:"float",data:Oa(oo)}),ye(n.spatialIndex||e,{useWorker:Ar}).then((function(n){Lr=n,ro=e,jo=!0})).then(t)}))},Da=function(e,n){bo=Ir.target,Po=e,So=Ir.distance[0],Ao=n},za=function(e){var n="inherit"===Hn?D:Hn;if("segment"===n){var t=Wn.length-1;return t<1?[]:e.reduce((function(e,n,r){for(var o=0,i=[],a=2;a<n.length;a+=2){var c=Math.sqrt(Math.pow(n[a-2]-n[a],2)+Math.pow(n[a-1]-n[a+1],2));i.push(c),o+=c}e[r]=[0];for(var l=0,s=0;s<n.length/2-1;s++)l+=i[s],e[r].push(4*Math.floor(l/o*t));return e}),[])}if(n){var r=Rt(n),o=ki(Ni(n),"inherit"===Hn?Dn:Wn);return Nr.reduce((function(e,n){var t=v(n,2),i=t[0],a=t[1];return e[i]=4*o(a[r]),e}),[])}return new Array(Nr.length).fill(0)},Na=function(){var e="inherit"===it?Ht:it;if("segment"===e){var n=$n.length-1;return n<1?[]:Nr.reduce((function(e,t){var r=v(t,3),o=r[0];r[1];var i=r[2];return e[o]=x(i,(function(e){return $n[Math.floor(e/(i-1)*n)]})),e}),[])}if(e){var t=Rt(e),r="inherit"===it?Kt:$n,o=ki(Ni(e),r);return Nr.reduce((function(e,n){var i=v(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e}),[])}},ka=function(){var e="inherit"===Tt?tr:Tt;if("segment"===e){var n=st.length-1;return n<1?[]:Nr.reduce((function(e,t){var r=v(t,3),o=r[0];r[1];var i=r[2];return e[o]=x(i,(function(e){return st[Math.floor(e/(i-1)*n)]})),e}),[])}if(e){var t=Rt(e),r="inherit"===Tt?jt:st,o=ki(Ni(e),r);return Nr.reduce((function(e,n){var i=v(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e}),[])}},ja=function(e){return new Promise((function(n){zr.setPoints([]),(null==e?void 0:e.length)>0?(kr=!0,Ct(e,{maxIntPointsPerSegment:Dt,tolerance:Nt}).then((function(e){!function(e){Nr=[];var n=0;Object.keys(e).forEach((function(t,r){Nr[t]=[r,e[t].reference,e[t].length/2,n],n+=e[t].length/2}))}(e);var t=Object.values(e);zr.setPoints(1===t.length?t[0]:t,{colorIndices:za(t),opacities:Na(),widths:ka()}),kr=!1,n()}))):n()}))},Fa=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,r=void 0!==t&&t;no=!0,to.clear();var o,i=Array.isArray(e)?e:[e],a=[],c=[],l=[],u=s(i);try{for(u.s();!(o=u.n()).done;){var f=o.value;!Number.isFinite(f)||f<0||f>=oo||(a.push(f),to.add(f),Qr.has(f)&&l.push(f))}}catch(e){u.e(e)}finally{u.f()}var d,v=s(function(e){for(var n=e.length,t=1;t<n;t++){for(var r=e[t],o=t-1;o>-1&&r<e[o];)e[o+1]=e[o],o--;e[o+1]=r}return e}([].concat(a)));try{for(v.s();!(d=v.n()).done;){var h=d.value;c.push.apply(c,ci(h))}}catch(e){v.e(e)}finally{v.f()}return go.subdata(c),ui(l,{preventEvent:r}),to.has(To)||fi(-1,{preventEvent:r}),new Promise((function(e){var t=function(){n.subscribe("draw",(function(){r||n.publish("filter",{points:a}),e()}),1),uo=!0};_n||ii(ro[0])?ja(ei()).then((function(){r||n.publish("pointConnectionsDraw"),ui(l,{preventEvent:r}),t()})):t()}))},_a=function(){return ni(Zr[0],Zr[1],Wr[0],Wr[1])},Va=A((function(){io=_a().length}),Pr),Wa=function(){return Boolean(ho&&po)},Za=function(){return Boolean(void 0!==bo&&void 0!==Po&&void 0!==So&&void 0!==Ao)},Ga=function(e,n){Bo||(Bo=performance.now());var t,r,o,i=performance.now()-Bo,a=(t=n(i/e),r=0,o=1,Math.min(o,Math.max(r,t)));return Wa()&&Pa({t:a}),Za()&&function(e){var n=v(bo,2),t=n[0],r=n[1],o=v(Po,2),i=1-e,a=t*i+o[0]*e,c=r*i+o[1]*e,l=So*i+Ao*e;Ir.lookAt([a,c],l)}(a),i<e},Ua=function(){Ro=!1,Bo=null,Eo=void 0,Mo=void 0,Ln=Do,ho&&(ho.destroy(),ho=void 0),po&&(po.destroy(),po=void 0),bo=void 0,Po=void 0,So=void 0,Ao=void 0,n.publish("transitionEnd")},Ka=function(e){var t=e.duration,r=void 0===t?500:t,o=e.easing,i=void 0===o?Ie:o;Ro&&n.publish("transitionEnd"),Ro=!0,Bo=null,Eo=r,Mo=ft(i)?Me[i]||Ie:i,Do=Ln,Ln=!1,n.publish("transitionStart")},qa=function(e){return Kr?Promise.reject(new An):(Fo=!1,0===e.length?new Promise((function(e){Tr.clear(),n.subscribe("draw",e,1),Fo=!0,uo=!0})):new Promise((function(t){var r,o=[],i=new Map,a=[],c=[],l=-1,u=function(e){c.push(e.lineWidth||dr);var n=mt(e.lineColor||ur,!0),t="[".concat(n.join(","),"]");if(i.has(t)){var r=i.get(t).idx;a.push(r)}else{var o=++l;i.set(t,{idx:o,color:n}),a.push(o)}},f=s(e);try{for(f.s();!(r=f.n()).done;){var d,v,h,p,y=r.value;if(xt(y))o.push([null!==(d=y.x1)&&void 0!==d?d:-hr,y.y,null!==(v=y.x2)&&void 0!==v?v:hr,y.y]),u(y);else if(bt(y))o.push([y.x,null!==(h=y.y1)&&void 0!==h?h:-hr,y.x,null!==(p=y.y2)&&void 0!==p?p:hr]),u(y);else St(y)?(o.push([y.x1,y.y1,y.x2,y.y1,y.x2,y.y2,y.x1,y.y2,y.x1,y.y1]),u(y)):Pt(y)?(o.push([y.x,y.y,y.x+y.width,y.y,y.x+y.width,y.y+y.height,y.x,y.y+y.height,y.x,y.y]),u(y)):At(y)&&(o.push(y.vertices.flatMap(g)),u(y))}}catch(e){f.e(e)}finally{f.f()}Tr.setStyle({color:Array.from(i.values()).sort((function(e,n){return e.idx>n.idx?1:-1})).map((function(e){return e.color}))}),Tr.setPoints(1===o.length?o.flat():o,{colorIndices:a,widths:c}),n.subscribe("draw",t,1),Fo=!0,uo=!0})))},Ha=function(e){return function(){var t=e.apply(void 0,arguments);return uo=!0,new Promise((function(e){n.subscribe("draw",(function(){return e(t)}),1)}))}},Ya=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r){var o=B([],[e.x+e.width/2,e.y+e.height/2,0,0],Dr).slice(0,2),i=2*Math.atan(1),a=Or/lo,c=e.height*a>=e.width?e.height/2/Math.tan(i/2):e.width/2/Math.tan(i/2)/a;t.transition?(Ir.config({isFixed:!0}),Da(o,c),n.subscribe("transitionEnd",(function(){r(),Ir.config({isFixed:yr})}),1),Ka({duration:t.transitionDuration,easing:t.transitionEasing})):(Ir.lookAt(o,c),n.subscribe("draw",r,1),uo=!0)}))},Xa=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(o){r.transition?(Ir.config({isFixed:!0}),Da(e,t),n.subscribe("transitionEnd",(function(){o(),Ir.config({isFixed:yr})}),1),Ka({duration:r.transitionDuration,easing:r.transitionEasing})):(Ir.lookAt(e,t),n.subscribe("draw",o,1),uo=!0)}))},$a=function(){zr.setStyle({color:Pi(Wn,Gn,Kn),opacity:null===$n?null:$n[0],width:st[0]})},Ja=function(){var e=Math.round(qr)>.5?0:255;vi.initiator.style.border="1px dashed rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.33)"),vi.initiator.style.background="rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.1)")},Qa=function(){var e=Math.round(qr)>.5?0:255;vi.longPressIndicator.style.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")"),vi.longPressIndicator.dataset.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")");var n=W.map((function(e){return Math.round(255*e)}));vi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")},ec=function(e){e&&Ir.setView(e)},nc=function(e){(Mn=Object.entries(e).reduce((function(e,n){var t=v(n,2),r=t[0],o=t[1];return $e.includes(o)&&Ue.includes(r)&&(e[r]=o),e}),{}))[We]?Ir.config({isRotate:!0,mouseDownMoveModKey:Mn[We]}):Ir.config({isRotate:!1})},tc=function(e,n){return function(t){if("inherit"===t)e(h(n()));else{var r=ht(t)?t:[t];e(r.map((function(e){return mt(e,!0)})))}$a()}},rc=tc((function(e){Wn=e}),(function(){return Dn})),oc=tc((function(e){Gn=e}),(function(){return Nn})),ic=tc((function(e){Kn=e}),(function(){return jn})),ac=function(e){p=Number(e)||.5},cc=function(e){m=Boolean(e)},lc=function(){var e,t,r,o,i,c,l,s,u,f,d,v,p,y,m,g,x,b,S,A,M,C,T,L,O,R,B,z,k,j,F,V,Z,U,q,Y,$,Q,ne,re,ie,ce,se,fe,de,he,ye=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Kr?Promise.reject(new Error(An)):(Lt(ye),void 0===ye.backgroundColor&&void 0===ye.background||(e=ye.backgroundColor||ye.background)&&(P=mt(e,!0),qr=gt(P),Ja(),Qa()),void 0!==ye.backgroundImage&&((t=ye.backgroundImage)?ft(t)?ot(a.regl,t).then((function(e){E=e,uo=!0,n.publish("backgroundImageReady")})).catch((function(){console.error("Count not create texture from ".concat(t)),E=null})):E="texture2d"===t._reglType?t:null:E=null),void 0!==ye.cameraTarget&&(r=ye.cameraTarget)&&Ir.lookAt(r,Ir.distance[0],Ir.rotation),void 0!==ye.cameraDistance&&(o=ye.cameraDistance)>0&&Ir.lookAt(Ir.target,o,Ir.rotation),void 0!==ye.cameraRotation&&null!==(i=ye.cameraRotation)&&Ir.lookAt(Ir.target,Ir.distance[0],i),void 0!==ye.cameraView&&ec(ye.cameraView),void 0!==ye.cameraIsFixed&&(c=ye.cameraIsFixed,yr=Boolean(c),Ir.config({isFixed:yr})),void 0!==ye.colorBy&&(l=ye.colorBy,D=Ot(l,an)),void 0!==ye.pointColor&&Mi(ye.pointColor),void 0!==ye.pointColorActive&&Ii(ye.pointColorActive),void 0!==ye.pointColorHover&&Ci(ye.pointColorHover),void 0!==ye.pointSize&&Bi(ye.pointSize),void 0!==ye.pointSizeSelected&&(!+(s=ye.pointSizeSelected)||+s<0||(_t=+s)),void 0!==ye.pointSizeMouseDetection&&(u=ye.pointSizeMouseDetection,Wt=u,Ri()),void 0!==ye.sizeBy&&function(e){tr=Ot(e,nn)}(ye.sizeBy),void 0!==ye.opacity&&(f=ye.opacity,d=Array.isArray(Kt)?h(Kt):Kt,et(f,nt,{minLength:1})?Kt=h(f):tt(+f)&&(Kt=[+f]),d===Kt||w(d,Kt)||(Co&&Co.destroy(),Co=bi())),void 0!==ye.showPointConnections&&(v=ye.showPointConnections,(_n=!!v)?jo&&ii(ro[0])&&ja(ei()).then((function(){n.publish("pointConnectionsDraw"),uo=!0})):ja()),void 0!==ye.pointConnectionColor&&rc(ye.pointConnectionColor),void 0!==ye.pointConnectionColorActive&&oc(ye.pointConnectionColorActive),void 0!==ye.pointConnectionColorHover&&ic(ye.pointConnectionColorHover),void 0!==ye.pointConnectionColorBy&&function(e){Hn=Ot(e,fn,{allowSegment:!0,allowInherit:!0})}(ye.pointConnectionColorBy),void 0!==ye.pointConnectionOpacityBy&&function(e){it=Ot(e,rn,{allowSegment:!0})}(ye.pointConnectionOpacityBy),void 0!==ye.pointConnectionOpacity&&function(e){et(e,nt,{minLength:1})&&($n=h(e)),tt(+e)&&($n=[+e]),Wn=Wn.map((function(e){return e[3]=Number.isNaN(+$n[0])?e[3]:+$n[0],e})),$a()}(ye.pointConnectionOpacity),void 0!==ye.pointConnectionOpacityActive&&function(e){!Number.isNaN(+e)&&+e&&(ct=+e)}(ye.pointConnectionOpacityActive),void 0!==ye.pointConnectionSize&&(p=ye.pointConnectionSize,et(p,nt,{minLength:1})&&(st=h(p)),tt(+p)&&(st=[+p]),$a()),void 0!==ye.pointConnectionSizeActive&&(y=ye.pointConnectionSizeActive,!Number.isNaN(+y)&&+y&&(vt=Math.max(0,y))),void 0!==ye.pointConnectionSizeBy&&function(e){Tt=Ot(e,tn,{allowSegment:!0})}(ye.pointConnectionSizeBy),void 0!==ye.pointConnectionMaxIntPointsPerSegment&&(m=ye.pointConnectionMaxIntPointsPerSegment,Dt=Math.max(0,m)),void 0!==ye.pointConnectionTolerance&&(g=ye.pointConnectionTolerance,Nt=Math.max(0,g)),void 0!==ye.pointScaleMode&&function(e){switch(e){case"linear":or=e,ia=ra;break;case"constant":or=e,ia=ta;break;default:or="asinh",ia=oa}}(ye.pointScaleMode),void 0!==ye.opacityBy&&function(e){Ht=Ot(e,on,{allowDensity:!0})}(ye.opacityBy),void 0!==ye.lassoColor&&function(e){if(e){W=mt(e,!0),Cr.setStyle({color:W});var n=W.map((function(e){return Math.round(255*e)}));vi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")}}(ye.lassoColor),void 0!==ye.lassoLineWidth&&(x=ye.lassoLineWidth,Number.isNaN(+x)||+x<1||(G=+x,Cr.setStyle({width:G}))),void 0!==ye.lassoMinDelay&&+(b=ye.lassoMinDelay)&&(K=+b,vi.set({minDelay:K})),void 0!==ye.lassoMinDist&&+(S=ye.lassoMinDist)&&(H=+S,vi.set({minDist:H})),void 0!==ye.lassoClearEvent&&(A=ye.lassoClearEvent,J=rt(Be,J)(A)),void 0!==ye.lassoInitiator&&(M=ye.lassoInitiator,ee=Boolean(M),vi.set({enableInitiator:ee})),void 0!==ye.lassoInitiatorParentElement&&(C=ye.lassoInitiatorParentElement,te=C,vi.set({initiatorParentElement:te})),void 0!==ye.lassoLongPressIndicatorParentElement&&(T=ye.lassoLongPressIndicatorParentElement,oe=T,vi.set({longPressIndicatorParentElement:oe})),void 0!==ye.lassoOnLongPress&&(L=ye.lassoOnLongPress,ae=Boolean(L)),void 0!==ye.lassoLongPressTime&&(O=ye.lassoLongPressTime,le=Number(O)),void 0!==ye.lassoLongPressAfterEffectTime&&(R=ye.lassoLongPressAfterEffectTime,ue=Number(R)),void 0!==ye.lassoLongPressEffectDelay&&(B=ye.lassoLongPressEffectDelay,ve=Number(B)),void 0!==ye.lassoLongPressRevertEffectTime&&function(e){pe=Number(e)}(ye.lassoLongPressRevertEffectTime),void 0!==ye.lassoType&&("brush"===(z=ye.lassoType)?vi.set({type:z,minDist:Math.max(3,H)}):vi.set({type:z,minDist:H}),xe=vi.get("type")),void 0!==ye.lassoMode&&(k=ye.lassoMode,X=k),void 0!==ye.lassoBrushSize&&(j=ye.lassoBrushSize,xn=Number(j)||xn,vi.set({brushSize:xn})),void 0!==ye.actionKeyMap&&nc(ye.actionKeyMap),void 0!==ye.mouseMode&&(F=ye.mouseMode,Cn=rt(Ae,be)(F),Ir.config({defaultMouseDownMoveAction:Cn===Se?"rotate":"pan"})),void 0!==ye.showReticle&&null!==(V=ye.showReticle)&&(Ln=V),void 0!==ye.reticleColor&&(Z=ye.reticleColor)&&(Rn=mt(Z,!0),jr.setStyle({color:Rn}),Fr.setStyle({color:Rn})),void 0!==ye.pointOutlineWidth&&(!+(U=ye.pointOutlineWidth)||+U<0||(Gt=+U)),void 0!==ye.height&&Oi(ye.height),void 0!==ye.width&&zi(ye.width),void 0!==ye.aspectRatio&&(+(q=ye.aspectRatio)<=0||(lo=q)),void 0!==ye.xScale&&(Y=ye.xScale)&&(Go=Y,Ko=Y.domain()[0],qo=Y?Y.domain()[1]-Y.domain()[0]:0,Go.range([0,mr]),Ti()),void 0!==ye.yScale&&($=ye.yScale)&&(Ho=(Uo=$).domain()[0],Yo=Uo?Uo.domain()[1]-Uo.domain()[0]:0,Uo.range([gr,0]),Ti()),void 0!==ye.deselectOnDblClick&&(Q=ye.deselectOnDblClick,N=!!Q),void 0!==ye.deselectOnEscape&&(ne=ye.deselectOnEscape,_=!!ne),void 0!==ye.opacityByDensityFill&&(re=ye.opacityByDensityFill,Xt=+re),void 0!==ye.opacityInactiveMax&&(ie=ye.opacityInactiveMax,Jt=+ie),void 0!==ye.opacityInactiveScale&&(ce=ye.opacityInactiveScale,er=+ce),void 0!==ye.gamma&&(se=ye.gamma,a.gamma=se),void 0!==ye.annotationLineColor&&(fe=ye.annotationLineColor,ur=mt(fe)),void 0!==ye.annotationLineWidth&&(de=ye.annotationLineWidth,dr=+de),void 0!==ye.annotationHVLineLimit&&(he=ye.annotationHVLineLimit,hr=+he),void 0!==ye.antiAliasing&&ac(ye.antiAliasing),void 0!==ye.pixelAligned&&cc(ye.pixelAligned),new Promise((function(e){window.requestAnimationFrame((function(){!Kr&&I&&(Ai(),Ir.refresh(),a.refresh(),wc(),e())}))})))},sc=function(){Ir||(Ir=k(I,{isFixed:yr,isPanInverted:[!1,!0],defaultMouseDownMoveAction:Cn===Se?"rotate":"pan"})),e.cameraView?Ir.setView(C(e.cameraView)):e.cameraTarget||e.cameraDistance||e.cameraRotation?Ir.lookAt(h(e.cameraTarget||yn),e.cameraDistance||1,e.cameraRotation||0):Ir.setView(C(mn)),Wr=Jo(1,1),Zr=Jo(-1,-1)},uc=function(e){if("Escape"===e.key)_&&si()},fc=function(){Zo=!0,_o=!0},dc=function(){fi(),Zo=!1,_o=!0,uo=!0},vc=function(){uo=!0},hc=function(){Ba([]),zr.clear()},pc=function(){qa([])},yc=function(){var e=lr===me,n=ar===me;if(e||n){var t=I.getBoundingClientRect(),r=t.width,o=t.height;e&&Di(r,!0),n&&Li(o,!0),Ai(),Ti(),uo=!0}Ir.refresh()},mc=function(){var e,t=(e=d().mark((function e(t){var r,o,i,c,l,s,u,f,v,h,y,g,w;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.style.userSelect="none",r=window.devicePixelRatio,o=jt,i=lr,c=ar,l=a.canvas.width/r,s=a.canvas.height/r,u=m,f=p,v=(null==t?void 0:t.scale)||1,h=Array.isArray(jt)?jt.map((function(e){return e*v})):jt*v,y=mr*v,g=gr*v,Bi(h),zi(y),Oi(g),cc((null==t?void 0:t.pixelAligned)||m),ac((null==t?void 0:t.antiAliasing)||p),a.resize(lr,ar),a.refresh(),e.next=22,new Promise((function(e){n.subscribe("draw",e,1),wc()}));case 22:return w=I.getContext("2d").getImageData(0,0,I.width,I.height),a.resize(l,s),a.refresh(),Bi(o),zi(i),Oi(c),cc(u),ac(f),e.next=32,new Promise((function(e){n.subscribe("draw",e,1),wc()}));case 32:return I.style.userSelect=null,e.abrupt("return",w);case 34:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,o){var i=e.apply(n,t);function a(e){c(i,r,o,a,l,"next",e)}function l(e){c(i,r,o,a,l,"throw",e)}a(void 0)}))});return function(e){return t.apply(this,arguments)}}(),gc=a.onFrame((function(){if(ko=Ir.tick(),(jo||Fo)&&(uo||Ro)){Ro&&!Ga(Eo,Mo)&&Ua(),ko&&(Wr=Jo(1,1),Zr=Jo(-1,-1),"density"===Ht&&Va()),a.render((function(){var e;!function(e,n){Br[0]=e/Or,Br[5]=n}(I.width/a.canvas.width,I.height/a.canvas.height),null!==(e=E)&&void 0!==e&&e._reglType&&Ta(),co.length>2&&La(),Ro||zr.draw({projection:Ji(),model:ea(),view:Qi()});var n=aa();jo&&n>0&&Aa(),Hr||!Ln&&!fo||function(){if(To>=0){var e=v(ro[To].slice(0,2),2),n=[e[0],e[1],0,1];L(t,Br,L(t,Ir.view,Dr)),B(n,n,t),jr.setPoints([-1,n[1],1,n[1]]),Fr.setPoints([n[0],1,n[0],-1]),jr.draw(),Fr.draw(),Sa((function(){return(_t+2*Gt)*window.devicePixelRatio}),(function(){return 1}),xo,1)(),Sa((function(){return(_t+Gt)*window.devicePixelRatio}),(function(){return 1}),xo,3)()}}(),To>=0&&Ea(),Jr.length>0&&(Ma(),Ia(),Ca()),Tr.draw({projection:Ji(),model:ea(),view:Qi()}),Cr.draw({projection:Ji(),model:ea(),view:Qi()})}),I);var e={view:Ir.view,isViewChanged:ko,camera:Ir,xScale:Go,yScale:Uo};ko&&(Ti(),so?so=!1:n.publish("view",e)),uo=!1,fo=!1,n.publish("drawing",e,{async:!1}),n.publish("draw",e)}})),wc=function(){uo=!0};return function(){Ai(),sc(),Ti(),Cr=fe(a.regl,{color:W,width:G,is2d:!0}),zr=fe(a.regl,{color:Pi(Wn,Gn,Kn),opacity:null===$n?null:$n[0],width:st[0],is2d:!0}),jr=fe(a.regl,{color:Rn,width:1,is2d:!0}),Fr=fe(a.regl,{color:Rn,width:1,is2d:!0}),Tr=fe(a.regl,{color:ur,width:dr,is2d:!0}),Ri(),I.addEventListener("wheel",vc),go=a.regl.buffer(),wo=a.regl.buffer(),xo=a.regl.buffer({usage:"dynamic",type:"float",length:2*ge}),Io=Si(),Co=bi();var e=lc({backgroundImage:E,width:lr,height:ar,actionKeyMap:Mn});Ja(),Qa(),window.addEventListener("keyup",uc,!1),window.addEventListener("blur",xi,!1),window.addEventListener("mouseup",yi,!1),window.addEventListener("mousemove",wi,!1),I.addEventListener("mousedown",pi,!1),I.addEventListener("mouseenter",fc,!1),I.addEventListener("mouseleave",dc,!1),I.addEventListener("click",mi,!1),I.addEventListener("dblclick",gi,!1),"ResizeObserver"in window?(Gr=new ResizeObserver(yc)).observe(I):(window.addEventListener("resize",yc),window.addEventListener("orientationchange",yc)),e.then((function(){n.publish("init")}))}(),{get isSupported(){return a.isSupported},clear:Ha((function(){hc(),pc()})),clearPoints:Ha(hc),clearPointConnections:Ha((function(){zr.clear()})),clearAnnotations:Ha(pc),createTextureFromUrl:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bn;return ot(a.regl,e,n)},deselect:si,destroy:function(){jo=!1,Fo=!1,Kr=!0,gc(),window.removeEventListener("keyup",uc,!1),window.removeEventListener("blur",xi,!1),window.removeEventListener("mouseup",yi,!1),window.removeEventListener("mousemove",wi,!1),I.removeEventListener("mousedown",pi,!1),I.removeEventListener("mouseenter",fc,!1),I.removeEventListener("mouseleave",dc,!1),I.removeEventListener("click",mi,!1),I.removeEventListener("dblclick",gi,!1),I.removeEventListener("wheel",vc,!1),Gr?Gr.disconnect():(window.removeEventListener("resize",yc),window.removeEventListener("orientationchange",yc)),I=void 0,Ir.dispose(),Ir=void 0,Cr.destroy(),vi.destroy(),zr.destroy(),jr.destroy(),Fr.destroy(),Io&&Io.destroy(),Co&&Co.destroy(),e.renderer||a.isDestroyed||a.destroy(),n.publish("destroy"),n.clear()},draw:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Kr?Promise.reject(new Error(An)):Ur?Promise.reject(new Error("Ignoring draw call as the previous draw call has not yet finished. To avoid this warning `await` the draw call.")):(Ur=!0,wt(e).then((function(e){return new Promise((function(r){if(Kr)r();else{var o=!1;t.preventFilterReset&&(null==e?void 0:e.length)===oo||(no=!1,to.clear());var i=e&&ii(e[0])&&(_n||t.showPointConnectionsOnce),c=t.zDataType,l=t.wDataType;new Promise((function(s){e?(t.transition&&(e.length===oo?o=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!vo)return!1;if(Ro){var t=ho;ho=po,t.destroy()}else ho=vo;return po=Ra(e,n),yo=a.regl.framebuffer({color:po,depth:!1,stencil:!1}),vo=void 0,!0}(e,{z:c,w:l}):console.warn("Cannot transition! The number of points between the previous and current draw call must be identical.")),Ba(e,{zDataType:c,wDataType:l,preventFilterReset:t.preventFilterReset,spatialIndex:t.spatialIndex}).then((function(){void 0!==t.hover&&fi(t.hover,{preventEvent:!0}),void 0!==t.select&&ui(t.select,{preventEvent:!0}),void 0!==t.filter&&Fa(t.filter,{preventEvent:!0}),i?ja(e).then((function(){n.publish("pointConnectionsDraw"),uo=!0,fo=t.showReticleOnce})).then((function(){return r()})):s()}))):s()})).then((function(){t.transition&&o?(i?Promise.all([new Promise((function(e){n.subscribe("transitionEnd",(function(){uo=!0,fo=t.showReticleOnce,e()}),1)})),new Promise((function(e){n.subscribe("pointConnectionsDraw",e,1)}))]).then((function(){return r()})):n.subscribe("transitionEnd",(function(){uo=!0,fo=t.showReticleOnce,r()}),1),Ka({duration:t.transitionDuration,easing:t.transitionEasing})):(i?Promise.all([new Promise((function(e){n.subscribe("draw",e,1)})),new Promise((function(e){n.subscribe("pointConnectionsDraw",e,1)}))]).then((function(){return r()})):n.subscribe("draw",(function(){return r()}),1),uo=!0,fo=t.showReticleOnce)}))}})).finally((function(){Ur=!1}))})))},drawAnnotations:qa,filter:Fa,get:function(e){var n,t=v(Object.keys(Lt(u({},e,Pn))),1)[0];return"aspectRatio"===t?lo:"background"===t||"backgroundColor"===t?P:"backgroundImage"===t?E:"camera"===t?Ir:"cameraTarget"===t?Ir.target:"cameraDistance"===t?Ir.distance[0]:"cameraRotation"===t?Ir.rotation:"cameraView"===t?Ir.view:"cameraIsFixed"===t?yr:"canvas"===t?I:"colorBy"===t?D:"sizeBy"===t?tr:"deselectOnDblClick"===t?N:"deselectOnEscape"===t?_:"height"===t?ar:"lassoColor"===t?W:"lassoLineWidth"===t?G:"lassoMinDelay"===t?K:"lassoMinDist"===t?H:"lassoClearEvent"===t?J:"lassoInitiator"===t?ee:"lassoInitiatorElement"===t?vi.initiator:"lassoInitiatorParentElement"===t?te:"lassoLongPressIndicatorParentElement"===t?oe:"lassoOnLongPress"===t?ae:"lassoType"===t?xe:"lassoBrushSize"===t?xn:"mouseMode"===t?Cn:"opacity"===t?1===Kt.length?Kt[0]:Kt:"opacityBy"===t?Ht:"opacityByDensityFill"===t?Xt:"opacityByDensityDebounceTime"===t?Pr:"opacityInactiveMax"===t?Jt:"opacityInactiveScale"===t?er:"points"===t?ro:"hoveredPoint"===t?To:"selectedPoints"===t?h(Jr):"filteredPoints"===t?no?Array.from(to):Array.from({length:ro.length},(function(e,n){return n})):"pointsInView"===t?_a():"pointColor"===t?1===Dn.length?Dn[0]:Dn:"pointColorActive"===t?1===Nn.length?Nn[0]:Nn:"pointColorHover"===t?1===jn.length?jn[0]:jn:"pointOutlineWidth"===t?Gt:"pointSize"===t?1===jt.length?jt[0]:jt:"pointSizeSelected"===t?_t:"pointSizeMouseDetection"===t?Wt:"showPointConnections"===t?_n:"pointConnectionColor"===t?1===Wn.length?Wn[0]:Wn:"pointConnectionColorActive"===t?1===Gn.length?Gn[0]:Gn:"pointConnectionColorHover"===t?1===Kn.length?Kn[0]:Kn:"pointConnectionColorBy"===t?Hn:"pointConnectionOpacity"===t?1===$n.length?$n[0]:$n:"pointConnectionOpacityBy"===t?it:"pointConnectionOpacityActive"===t?ct:"pointConnectionSize"===t?1===st.length?st[0]:st:"pointConnectionSizeActive"===t?vt:"pointConnectionSizeBy"===t?Tt:"pointConnectionMaxIntPointsPerSegment"===t?Dt:"pointConnectionTolerance"===t?Nt:"pointScaleMode"===t?or:"reticleColor"===t?Rn:"regl"===t?a.regl:"showReticle"===t?Ln:"version"===t?"1.14.1+1.0.1":"width"===t?lr:"xScale"===t?Go:"yScale"===t?Uo:"performanceMode"===t?xr:"renderPointsAsSquares"===t?Er:"disableAlphaBlending"===t?Mr:"gamma"===t?a.gamma:"renderer"===t?a:"isDestroyed"===t?Kr:"isDrawing"===t?Ur:"isPointsDrawn"===t?jo:"isPointsFiltered"===t?no:"isAnnotationsDrawn"===t?Fo:"zDataType"===t?Vo:"wDataType"===t?Wo:"spatialIndex"===t?null===(n=Lr)||void 0===n?void 0:n.data:"annotationLineColor"===t?ur:"annotationLineWidth"===t?dr:"annotationHVLineLimit"===t?hr:"antiAliasing"===t?p:"pixelAligned"===t?m:"actionKeyMap"===t?function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach((function(n){u(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},Mn):void 0},getScreenPosition:function(e){if(!jo)throw new Error(Sn);var n=ro[e];if(n){var r=[n[0],n[1],0,1];return L(t,Rr,L(t,Ir.view,Dr)),B(r,r,t),[mr*(r[0]+1)/2,gr*(.5-r[1]/2)]}},hover:fi,redraw:wc,refresh:a.refresh,reset:Ha((function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;sc(),Ti(),t||n.publish("view",{view:Ir.view,camera:Ir,xScale:Go,yScale:Uo})})),select:ui,set:lc,export:function(e){return void 0===e?I.getContext("2d").getImageData(0,0,I.width,I.height):mc(e)},subscribe:n.subscribe,unfilter:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;return no=!1,to.clear(),go.subdata(Oa(oo)),new Promise((function(e){var r=function(){n.subscribe("draw",(function(){t||n.publish("unfilter"),e()}),1),uo=!0};_n||ii(ro[0])?ja(ei()).then((function(){t||n.publish("pointConnectionsDraw"),r()})):r()}))},unsubscribe:n.unsubscribe,view:function(e){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,t=void 0!==n&&n;ec(e),uo=!0,so=t},zoomToLocation:Xa,zoomToArea:Ya,zoomToPoints:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!jo)return Promise.reject(new Error(Sn));var t=function(e){var n,t=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=s(e);try{for(a.s();!(n=a.n()).done;){var c=n.value,l=v(ro[c],2),u=l[0],f=l[1];t=Math.min(t,u),r=Math.max(r,u),o=Math.min(o,f),i=Math.max(i,f)}}catch(e){a.e(e)}finally{a.f()}return{x:t,y:o,width:r-t,height:i-o}}(e),r=t.x+t.width/2,o=t.y+t.height/2,i=Qo(),a=1+(n.padding||0),c=Math.max(t.width,i)*a,l=Math.max(t.height,i)*a;return Ya({x:r-c/2,y:o-l/2,width:c,height:l},n)},zoomToOrigin:function(){return Xa([0,0],1,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pub-sub-es"),require("regl")):"function"==typeof define&&define.amd?define(["exports","pub-sub-es","regl"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).createScatterplot={},e.createPubSub,e.createREGL)}(this,function(e,n,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(n),i=r(t);function a(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function c(e,n,t,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,o)}function l(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,m(r.key),r)}}function s(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=y(e))||n){t&&(e=t);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(c)throw i}}}}function u(e,n,t){return(n=m(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function f(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function d(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
+
var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function i(t,r,o,i){var l=r&&r.prototype instanceof c?r:c,s=Object.create(l.prototype);return v(s,"_invoke",function(t,r,o){var i,c,l,s=0,u=o||[],f=!1,d={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(n,t){return i=n,c=0,l=e,d.n=t,a}};function v(t,r){for(c=t,l=r,n=0;!f&&s&&!o&&n<u.length;n++){var o,i=u[n],v=d.p,p=i[2];t>3?(o=p===r)&&(l=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=v&&((o=t<2&&v<i[1])?(c=0,d.v=r,d.n=i[1]):v<p&&(o=t<3||i[0]>r||r>p)&&(i[4]=t,i[5]=r,d.n=p,c=0))}if(o||t>1)return a;throw f=!0,r}return function(o,u,p){if(s>1)throw TypeError("Generator is already running");for(f&&1===u&&v(u,p),c=u,l=p;(n=c<2?e:l)||!f;){i||(c?c<3?(c>1&&(d.n=-1),v(c,l)):d.n=l:d.v=l);try{if(s=2,i){if(c||(o="next"),n=i[o]){if(!(n=n.call(i,l)))throw TypeError("iterator result is not an object");if(!n.done)return n;l=n.value,c<2&&(c=0)}else 1===c&&(n=i.return)&&n.call(i),c<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((n=(f=d.n<0)?l:t.call(r,d))!==a)break}catch(n){i=e,c=1,l=n}finally{s=1}}return{value:n,done:f}}}(t,o,i),!0),s}var a={};function c(){}function l(){}function s(){}n=Object.getPrototypeOf;var u=[][r]?n(n([][r]())):(v(n={},r,function(){return this}),n),f=s.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,v(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=s,v(f,"constructor",s),v(s,"constructor",l),l.displayName="GeneratorFunction",v(s,o,"GeneratorFunction"),v(f),v(f,o,"Generator"),v(f,r,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(d=function(){return{w:i,m:p}})()}function v(e,n,t,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}v=function(e,n,t,r){function i(n,t){v(e,n,function(e){return this._invoke(n,t,e)})}n?o?o(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(i("next",0),i("throw",1),i("return",2))},v(e,n,t,r)}function p(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,c=[],l=!0,s=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=i.call(t)).done)&&(c.push(r.value),c.length!==n);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,n)||y(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){var n=function(e,n){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}function y(e,n){if(e){if("string"==typeof e)return a(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,n):void 0}}const g=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,w=e=>e,x=(e,n)=>{if(e===n)return!0;if(e.length!==n.length)return!1;const t=new Set(e),r=new Set(n);return t.size===r.size&&n.every(e=>t.has(e))},b=(e,n=w)=>{const t=[];for(let r=0;r<e;r++)t.push(n(r,e));return t},S=(e,...n)=>(n.forEach(n=>{const t=Object.keys(n).reduce((e,t)=>(e[t]=Object.getOwnPropertyDescriptor(n,t),e),{});Object.getOwnPropertySymbols(n).forEach(e=>{const r=Object.getOwnPropertyDescriptor(n,e);r?.enumerable&&(t[e]=r)}),Object.defineProperties(e,t)}),e);const P=(e,n)=>t=>S(t,{get[e](){return n}}),A=(e=1)=>new Promise(n=>{let t=0;const r=()=>requestAnimationFrame(()=>{t++,t<e?r():n(void 0)});r()}),E=(e,n,t)=>{let r,o=0;t=null===t?n:t;const i=(...n)=>{clearTimeout(r),r=setTimeout(()=>{o>0&&(e(...n),o=0)},t)};let a=!1;const c=(...t)=>{a?(o++,i(...t)):(e(...t),i(...t),a=!0,o=0,setTimeout(()=>{a=!1},n))};return c.reset=()=>{a=!1},c.cancel=()=>{clearTimeout(r)},c.now=(...n)=>e(...n),c};var M,I="undefined"!=typeof Float32Array?Float32Array:Array;function C(){var e=new I(16);return I!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function T(e){var n=new I(16);return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function O(e,n){var t=n[0],r=n[1],o=n[2],i=n[3],a=n[4],c=n[5],l=n[6],s=n[7],u=n[8],f=n[9],d=n[10],v=n[11],p=n[12],h=n[13],m=n[14],y=n[15],g=t*c-r*a,w=t*l-o*a,x=t*s-i*a,b=r*l-o*c,S=r*s-i*c,P=o*s-i*l,A=u*h-f*p,E=u*m-d*p,M=u*y-v*p,I=f*m-d*h,C=f*y-v*h,T=d*y-v*m,O=g*T-w*C+x*I+b*M-S*E+P*A;return O?(O=1/O,e[0]=(c*T-l*C+s*I)*O,e[1]=(o*C-r*T-i*I)*O,e[2]=(h*P-m*S+y*b)*O,e[3]=(d*S-f*P-v*b)*O,e[4]=(l*M-a*T-s*E)*O,e[5]=(t*T-o*M+i*E)*O,e[6]=(m*x-p*P-y*w)*O,e[7]=(u*P-d*x+v*w)*O,e[8]=(a*C-c*M+s*A)*O,e[9]=(r*M-t*C-i*A)*O,e[10]=(p*S-h*x+y*g)*O,e[11]=(f*x-u*S-v*g)*O,e[12]=(c*E-a*I-l*A)*O,e[13]=(t*I-r*E+o*A)*O,e[14]=(h*w-p*b-m*g)*O,e[15]=(u*b-f*w+d*g)*O,e):null}function R(e,n,t){var r=n[0],o=n[1],i=n[2],a=n[3],c=n[4],l=n[5],s=n[6],u=n[7],f=n[8],d=n[9],v=n[10],p=n[11],h=n[12],m=n[13],y=n[14],g=n[15],w=t[0],x=t[1],b=t[2],S=t[3];return e[0]=w*r+x*c+b*f+S*h,e[1]=w*o+x*l+b*d+S*m,e[2]=w*i+x*s+b*v+S*y,e[3]=w*a+x*u+b*p+S*g,w=t[4],x=t[5],b=t[6],S=t[7],e[4]=w*r+x*c+b*f+S*h,e[5]=w*o+x*l+b*d+S*m,e[6]=w*i+x*s+b*v+S*y,e[7]=w*a+x*u+b*p+S*g,w=t[8],x=t[9],b=t[10],S=t[11],e[8]=w*r+x*c+b*f+S*h,e[9]=w*o+x*l+b*d+S*m,e[10]=w*i+x*s+b*v+S*y,e[11]=w*a+x*u+b*p+S*g,w=t[12],x=t[13],b=t[14],S=t[15],e[12]=w*r+x*c+b*f+S*h,e[13]=w*o+x*l+b*d+S*m,e[14]=w*i+x*s+b*v+S*y,e[15]=w*a+x*u+b*p+S*g,e}function B(e,n){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,n){return e[0]=n[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function D(e,n,t){var r=n[0],o=n[1],i=n[2],a=n[3];return e[0]=t[0]*r+t[4]*o+t[8]*i+t[12]*a,e[1]=t[1]*r+t[5]*o+t[9]*i+t[13]*a,e[2]=t[2]*r+t[6]*o+t[10]*i+t[14]*a,e[3]=t[3]*r+t[7]*o+t[11]*i+t[15]*a,e}M=new I(4),I!=Float32Array&&(M[0]=0,M[1]=0,M[2]=0,M[3]=0),function(){var e=function(){var e=new I(2);return I!=Float32Array&&(e[0]=0,e[1]=0),e}()}();const z=(e=[0,0],n=1,t=0,r=[0,0],o=[[0,1/0],[0,1/0]],i=[[-1/0,1/0],[-1/0,1/0]])=>{const a=new Float32Array(16),c=new Float32Array(16),l=new Float32Array(16);let s=C(),u=[...r.slice(0,2),0,1];const f=Array.isArray(o[0])?[...o[0]]:[...o],d=Array.isArray(o[0])?[...o[1]]:[...o],v=Array.isArray(i[0])?[...i[0]]:[...i],p=Array.isArray(i[0])?[...i[1]]:[...i],h=()=>function(e,n){var t=n[0],r=n[1],o=n[2],i=n[4],a=n[5],c=n[6],l=n[8],s=n[9],u=n[10];return e[0]=Math.sqrt(t*t+r*r+o*o),e[1]=Math.sqrt(i*i+a*a+c*c),e[2]=Math.sqrt(l*l+s*s+u*u),e}(a,s).slice(0,2),m=()=>{const e=h();return Math.min(e[0],e[1])},y=()=>{const e=h();return Math.max(e[0],e[1])},g=([e=0,n=0]=[],t=1,r=0)=>{s=C(),w([-e,-n]),b(r),x(1/t)},w=([e=0,n=0]=[])=>{a[0]=e,a[1]=n,a[2]=0;const t=B(c,a);R(s,t,s)},x=(e,n)=>{const t=Array.isArray(e);let r=t?e[0]:e,o=t?e[1]:e;if(r<=0||o<=0||1===r&&1===o)return;const i=h(),v=i[0]*r,p=i[1]*o;if(r=Math.max(f[0],Math.min(v,f[1]))/i[0],o=Math.max(d[0],Math.min(p,d[1]))/i[1],1===r&&1===o)return;a[0]=r,a[1]=o,a[2]=1;const m=L(c,a),y=n?[...n,0]:u,g=B(a,y);R(s,g,R(s,m,R(s,O(l,g),s)))},b=e=>{const n=C();!function(e,n,t){var r,o,i,a=t[0],c=t[1],l=t[2],s=Math.sqrt(a*a+c*c+l*l);s<1e-6||(a*=s=1/s,c*=s,l*=s,r=Math.sin(n),i=1-(o=Math.cos(n)),e[0]=a*a*i+o,e[1]=c*a*i+l*r,e[2]=l*a*i-c*r,e[3]=0,e[4]=a*c*i-l*r,e[5]=c*c*i+o,e[6]=l*c*i+a*r,e[7]=0,e[8]=a*l*i+c*r,e[9]=c*l*i-a*r,e[10]=l*l*i+o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1)}(n,e,[0,0,1]),R(s,n,s)},S=e=>{!e||e.length<16||(s=e)};return g(e,n,t),{get translation(){return function(e,n){return e[0]=n[12],e[1]=n[13],e[2]=n[14],e}(a,s).slice(0,2)},get target(){return D(a,u,O(l,s)).slice(0,2)},get scaling(){return h()},get minScaling(){return m()},get maxScaling(){return y()},get scaleBounds(){return[[...f],[...d]]},get translationBounds(){return[[...v],[...p]]},get distance(){return(()=>{const e=h();return[1/e[0],1/e[1]]})()},get minDistance(){return 1/m()},get maxDistance(){return 1/y()},get rotation(){return Math.acos(s[0]/y())},get view(){return s},get viewCenter(){return u.slice(0,2)},lookAt:g,translate:w,pan:w,rotate:b,scale:x,zoom:x,reset:()=>{g(e,n,t)},set:(...e)=>(console.warn("`set()` is deprecated. Please use `setView()` instead."),S(...e)),setScaleBounds:e=>{const n=Array.isArray(e[0]);f[0]=n?e[0][0]:e[0],f[1]=n?e[0][1]:e[1],d[0]=n?e[1][0]:e[0],d[1]=n?e[1][1]:e[1]},setTranslationBounds:e=>{const n=Array.isArray(e[0]);v[0]=n?e[0][0]:e[0],v[1]=n?e[0][1]:e[1],p[0]=n?e[1][0]:e[0],p[1]=n?e[1][1]:e[1]},setView:S,setViewCenter:e=>{u=[...e.slice(0,2),0,1]}}},N=["pan","rotate"],F={alt:"altKey",cmd:"metaKey",ctrl:"ctrlKey",meta:"metaKey",shift:"shiftKey"},j=(e,{distance:n=1,target:t=[0,0],rotation:r=0,isNdc:o=!0,isFixed:i=!1,isPan:a=!0,isPanInverted:c=[!1,!0],panSpeed:l=1,isRotate:s=!0,rotateSpeed:u=1,defaultMouseDownMoveAction:f="pan",mouseDownMoveModKey:d="alt",isZoom:v=!0,zoomSpeed:p=1,viewCenter:h,scaleBounds:m,translationBounds:y,onKeyDown:g=()=>{},onKeyUp:w=()=>{},onMouseDown:x=()=>{},onMouseUp:b=()=>{},onMouseMove:S=()=>{},onWheel:P=()=>{}}={})=>{let A=z(t,n,r,h,m,y),E=0,M=0,I=0,C=0,T=0,O=0,R=!1,B=0,L=1,D=1,j=1,k=!1,_=!1,V=!1,W="pan"===f,Z=a,G=a,U=c,K=c,q=v,H=v;const Y=()=>{Z=Array.isArray(a)?Boolean(a[0]):a,G=Array.isArray(a)?Boolean(a[1]):a,U=Array.isArray(c)?Boolean(c[0]):c,K=Array.isArray(c)?Boolean(c[1]):c,q=Array.isArray(v)?Boolean(v[0]):v,H=Array.isArray(v)?Boolean(v[1]):v};Y();const X=o?e=>e/L*2*j:e=>e,$=o?e=>e/D*2:e=>-e,J=o?e=>(e/L*2-1)*j:e=>e,Q=o?e=>1-e/D*2:e=>e,ee=()=>{const n=e.getBoundingClientRect();L=n.width,D=n.height,j=L/D},ne=e=>{V=!1,w(e)},te=e=>{V=e[F[d]],g(e)},re=e=>{R=!1,b(e)},oe=e=>{R=1===e.buttons,x(e)},ie=void 0!==document.createEvent("MouseEvent").offsetX?e=>{I=e.offsetX,C=e.offsetY}:n=>{const t=e.getBoundingClientRect();I=n.clientX-t.left,C=n.clientY-t.top},ae=e=>{E=e.clientX,M=e.clientY},ce=e=>{ae(e),S(e)},le=e=>{if((q||H)&&!i){e.preventDefault(),ae(e),ie(e);const n=1===e.deltaMode?12:1;B+=n*(e.deltaY||e.deltaX||0)}P(e)};window.addEventListener("keydown",te,{passive:!0}),window.addEventListener("keyup",ne,{passive:!0}),e.addEventListener("mousedown",oe,{passive:!0}),window.addEventListener("mouseup",re,{passive:!0}),window.addEventListener("mousemove",ce,{passive:!0}),e.addEventListener("wheel",le,{passive:!1}),A.config=({defaultMouseDownMoveAction:e=null,isFixed:n=null,isPan:t=null,isPanInverted:r=null,isRotate:o=null,isZoom:h=null,panSpeed:m=null,rotateSpeed:y=null,zoomSpeed:g=null,mouseDownMoveModKey:w=null}={})=>{f=null!==e&&N.includes(e)?e:f,W="pan"===f,i=null!==n?n:i,a=null!==t?t:a,c=null!==r?r:c,s=null!==o?o:s,v=null!==h?h:v,l=+m>0?m:l,u=+y>0?y:u,p=+g>0?g:p,Y(),d=null!==w&&Object.keys(F).includes(w)?w:d},A.dispose=()=>{A=void 0,window.removeEventListener("keydown",te),window.removeEventListener("keyup",ne),e.removeEventListener("mousedown",oe),window.removeEventListener("mouseup",re),window.removeEventListener("mousemove",ce),e.removeEventListener("wheel",le)},A.refresh=ee,A.tick=()=>{if(i){const e=_;return _=!1,e}k=!1;const e=E,n=M;if((Z||G)&&R&&(W&&!V||!W&&V)){const t=Z?X(l*(U?T-e:e-T)):0,r=G?$(l*(K?O-n:n-O)):0;0===t&&0===r||(A.pan([t,r]),k=!0)}if((q||H)&&B){const e=p*Math.exp(B/D),n=J(I),t=Q(C);A.scale([q?1/e:1,H?1/e:1],[n,t]),k=!0}if(s&&R&&(W&&V||!W&&!V)&&Math.abs(T-e)+Math.abs(O-n)>0){const i=L/2,l=D/2,s=T-i,d=l-O,v=e-i,p=l-n,h=(r=[v,p],o=(t=[s,d])[0],a=t[1],c=r[0],f=r[1],Math.abs(Math.atan2(a*c-o*f,o*c+a*f))),m=s*p-v*d;A.rotate(u*h*Math.sign(m)),k=!0}var t,r,o,a,c,f;B=0,T=e,O=n;const d=k||_;return _=!1,d};const se=e=>function(){e.apply(null,arguments),_=!0};return A.lookAt=se(A.lookAt),A.translate=se(A.translate),A.pan=se(A.pan),A.rotate=se(A.rotate),A.scale=se(A.scale),A.zoom=se(A.zoom),A.reset=se(A.reset),A.set=se(A.set),A.setScaleBounds=se(A.setScaleBounds),A.setTranslationBounds=se(A.setTranslationBounds),A.setView=se(A.setView),A.setViewCenter=se(A.setViewCenter),ee(),A};function k(e,n,t=2){const r=e.length;let o=function(e,n,t,r,o){let i;if(o===function(e,n,t,r){let o=0;for(let i=n,a=t-r;i<t;i+=r)o+=(e[a]-e[i])*(e[i+1]+e[a+1]),a=i;return o}(e,n,t,r)>0)for(let o=n;o<t;o+=r)i=te(o/r|0,e[o],e[o+1],i);else for(let o=t-r;o>=n;o-=r)i=te(o/r|0,e[o],e[o+1],i);i&&X(i,i.next)&&(re(i),i=i.next);return i}(e,0,r,t,!0);const i=[];if(!o||o.next===o.prev)return i;let a,c,l;if(e.length>80*t){a=e[0],c=e[1];let n=a,o=c;for(let i=t;i<r;i+=t){const t=e[i],r=e[i+1];t<a&&(a=t),r<c&&(c=r),t>n&&(n=t),r>o&&(o=r)}l=Math.max(n-a,o-c),l=0!==l?32767/l:0}return V(o,i,t,a,c,l,0),i}function _(e,n){if(!e)return e;n||(n=e);let t,r=e;do{if(t=!1,r.steiner||!X(r,r.next)&&0!==Y(r.prev,r,r.next))r=r.next;else{if(re(r),r=n=r.prev,r===r.next)break;t=!0}}while(t||r!==n);return n}function V(e,n,t,r,o,i,a){if(!e)return;!a&&i&&function(e,n,t,r){let o=e;do{0===o.z&&(o.z=K(o.x,o.y,n,t,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){let n,t=1;do{let r,o=e;e=null;let i=null;for(n=0;o;){n++;let a=o,c=0;for(let e=0;e<t&&(c++,a=a.nextZ,a);e++);let l=t;for(;c>0||l>0&&a;)0!==c&&(0===l||!a||o.z<=a.z)?(r=o,o=o.nextZ,c--):(r=a,a=a.nextZ,l--),i?i.nextZ=r:e=r,r.prevZ=i,i=r;o=a}i.nextZ=null,t*=2}while(n>1)}(o)}(e,r,o,i);let c=e;for(;e.prev!==e.next;){const l=e.prev,s=e.next;if(i?Z(e,r,o,i):W(e))n.push(l.i,e.i,s.i),re(e),e=s.next,c=s.next;else if((e=s)===c){a?1===a?V(e=G(_(e),n),n,t,r,o,i,2):2===a&&U(e,n,t,r,o,i):V(_(e),n,t,r,o,i,1);break}}}function W(e){const n=e.prev,t=e,r=e.next;if(Y(n,t,r)>=0)return!1;const o=n.x,i=t.x,a=r.x,c=n.y,l=t.y,s=r.y,u=Math.min(o,i,a),f=Math.min(c,l,s),d=Math.max(o,i,a),v=Math.max(c,l,s);let p=r.next;for(;p!==n;){if(p.x>=u&&p.x<=d&&p.y>=f&&p.y<=v&&q(o,c,i,l,a,s,p.x,p.y)&&Y(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Z(e,n,t,r){const o=e.prev,i=e,a=e.next;if(Y(o,i,a)>=0)return!1;const c=o.x,l=i.x,s=a.x,u=o.y,f=i.y,d=a.y,v=Math.min(c,l,s),p=Math.min(u,f,d),h=Math.max(c,l,s),m=Math.max(u,f,d),y=K(v,p,n,t,r),g=K(h,m,n,t,r);let w=e.prevZ,x=e.nextZ;for(;w&&w.z>=y&&x&&x.z<=g;){if(w.x>=v&&w.x<=h&&w.y>=p&&w.y<=m&&w!==o&&w!==a&&q(c,u,l,f,s,d,w.x,w.y)&&Y(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,x.x>=v&&x.x<=h&&x.y>=p&&x.y<=m&&x!==o&&x!==a&&q(c,u,l,f,s,d,x.x,x.y)&&Y(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;w&&w.z>=y;){if(w.x>=v&&w.x<=h&&w.y>=p&&w.y<=m&&w!==o&&w!==a&&q(c,u,l,f,s,d,w.x,w.y)&&Y(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;x&&x.z<=g;){if(x.x>=v&&x.x<=h&&x.y>=p&&x.y<=m&&x!==o&&x!==a&&q(c,u,l,f,s,d,x.x,x.y)&&Y(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function G(e,n){let t=e;do{const r=t.prev,o=t.next.next;!X(r,o)&&$(r,t,t.next,o)&&ee(r,o)&&ee(o,r)&&(n.push(r.i,t.i,o.i),re(t),re(t.next),t=e=o),t=t.next}while(t!==e);return _(t)}function U(e,n,t,r,o,i){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&H(a,e)){let c=ne(a,e);return a=_(a,a.next),c=_(c,c.next),V(a,n,t,r,o,i,0),void V(c,n,t,r,o,i,0)}e=e.next}a=a.next}while(a!==e)}function K(e,n,t,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-t)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*o|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function q(e,n,t,r,o,i,a,c){return!(e===a&&n===c)&&function(e,n,t,r,o,i,a,c){return(o-a)*(n-c)>=(e-a)*(i-c)&&(e-a)*(r-c)>=(t-a)*(n-c)&&(t-a)*(i-c)>=(o-a)*(r-c)}(e,n,t,r,o,i,a,c)}function H(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!function(e,n){let t=e;do{if(t.i!==e.i&&t.next.i!==e.i&&t.i!==n.i&&t.next.i!==n.i&&$(t,t.next,e,n))return!0;t=t.next}while(t!==e);return!1}(e,n)&&(ee(e,n)&&ee(n,e)&&function(e,n){let t=e,r=!1;const o=(e.x+n.x)/2,i=(e.y+n.y)/2;do{t.y>i!=t.next.y>i&&t.next.y!==t.y&&o<(t.next.x-t.x)*(i-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next}while(t!==e);return r}(e,n)&&(Y(e.prev,e,n.prev)||Y(e,n.prev,n))||X(e,n)&&Y(e.prev,e,e.next)>0&&Y(n.prev,n,n.next)>0)}function Y(e,n,t){return(n.y-e.y)*(t.x-n.x)-(n.x-e.x)*(t.y-n.y)}function X(e,n){return e.x===n.x&&e.y===n.y}function $(e,n,t,r){const o=Q(Y(e,n,t)),i=Q(Y(e,n,r)),a=Q(Y(t,r,e)),c=Q(Y(t,r,n));return o!==i&&a!==c||(!(0!==o||!J(e,t,n))||(!(0!==i||!J(e,r,n))||(!(0!==a||!J(t,e,r))||!(0!==c||!J(t,n,r)))))}function J(e,n,t){return n.x<=Math.max(e.x,t.x)&&n.x>=Math.min(e.x,t.x)&&n.y<=Math.max(e.y,t.y)&&n.y>=Math.min(e.y,t.y)}function Q(e){return e>0?1:e<0?-1:0}function ee(e,n){return Y(e.prev,e,e.next)<0?Y(e,n,e.next)>=0&&Y(e,e.prev,n)>=0:Y(e,n,e.prev)<0||Y(e,e.next,n)<0}function ne(e,n){const t=oe(e.i,e.x,e.y),r=oe(n.i,n.x,n.y),o=e.next,i=n.prev;return e.next=n,n.prev=e,t.next=o,o.prev=t,r.next=t,t.prev=r,i.next=r,r.prev=i,r}function te(e,n,t,r){const o=oe(e,n,t);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function re(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function oe(e,n,t){return{i:e,x:n,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const ie=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),ae=Float32Array.BYTES_PER_ELEMENT,ce=e=>e.length>0&&Array.isArray(e[0]),{push:le,splice:se}=Array.prototype;function ue(e,n=1,t=1){const r=[],o=new Array(2*n);for(let i=0,a=e.length/n;i<a;i++){const a=i*n;for(let r=0;r<n;r++){const i=e[a+r];o[r]=i,o[r+n]=i*t}le.apply(r,o)}return r}function fe(e,n,t,r){const o=new Array(r),i=n*r;for(let n=0;n<r;n++)o[n]=e[i+n];return se.call(e,t*r,0,...o),e}const de=(e,{projection:n=ie,model:t=ie,view:r=ie,points:o=[],colorIndices:i=[],color:a=[.8,.5,0,1],opacity:c=null,opacities:l=[],width:s=1,widths:u=[],miter:f=!0,is2d:d=!1,zPos2d:v=0}={})=>{if(!e)return void console.error("Regl instance is undefined.");const p=new Float32Array(16);let h,m,y,g,w,x,b,S,P,A,E,M,I,C,T,O,B,L,D=d?2:3;const z=()=>+(l.length===m||null!==c),N=()=>{A=e.buffer(),E=e.buffer(),M=e.buffer(),T=e.buffer(),O={prevPosition:{buffer:()=>A,offset:0,stride:3*ae},currPosition:{buffer:()=>A,offset:3*ae*2,stride:3*ae},nextPosition:{buffer:()=>A,offset:3*ae*4,stride:3*ae},opacity:{buffer:()=>E,offset:2*ae,stride:ae},offsetScale:{buffer:()=>M,offset:2*ae,stride:ae},colorIndex:{buffer:()=>T,offset:2*ae,stride:ae}},B=e.elements(),L=e({attributes:O,depth:{enable:!d},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},uniforms:{projectionViewModel:(e,n)=>{const t=e.projection||n.projection,r=e.model||n.model,o=e.view||n.view;return R(p,t,R(p,o,r))},aspectRatio:({viewportWidth:e,viewportHeight:n})=>e/n,colorTex:()=>I,colorTexRes:()=>C,colorTexEps:()=>.5/C,pixelRatio:({pixelRatio:e})=>e,width:({pixelRatio:e,viewportHeight:n})=>s/n*e,useOpacity:z,useColorOpacity:()=>Number(!z()),miter:Number(Boolean(f))},elements:()=>B,vert:"\nuniform mat4 projectionViewModel;\nuniform float aspectRatio;\n\nuniform sampler2D colorTex;\nuniform float colorTexRes;\nuniform float colorTexEps;\nuniform float width;\nuniform float useOpacity;\nuniform float useColorOpacity;\nuniform int miter;\n\nattribute vec3 prevPosition;\nattribute vec3 currPosition;\nattribute vec3 nextPosition;\nattribute float opacity;\nattribute float offsetScale;\nattribute float colorIndex;\n\nvarying vec4 color;\n\nvoid main() {\n vec2 aspectVec = vec2(aspectRatio, 1.0);\n vec4 prevProjected = projectionViewModel * vec4(prevPosition, 1.0);\n vec4 currProjected = projectionViewModel * vec4(currPosition, 1.0);\n vec4 nextProjected = projectionViewModel * vec4(nextPosition, 1.0);\n\n // get 2D screen space with W divide and aspect correction\n vec2 prevScreen = prevProjected.xy / prevProjected.w * aspectVec;\n vec2 currScreen = currProjected.xy / currProjected.w * aspectVec;\n vec2 nextScreen = nextProjected.xy / nextProjected.w * aspectVec;\n\n float len = width;\n\n // starting point uses (next - current)\n vec2 dir = vec2(0.0);\n if (currScreen == prevScreen) {\n dir = normalize(nextScreen - currScreen);\n }\n // ending point uses (current - previous)\n else if (currScreen == nextScreen) {\n dir = normalize(currScreen - prevScreen);\n }\n // somewhere in middle, needs a join\n else {\n // get directions from (C - B) and (B - A)\n vec2 dirA = normalize((currScreen - prevScreen));\n if (miter == 1) {\n vec2 dirB = normalize((nextScreen - currScreen));\n // now compute the miter join normal and length\n vec2 tangent = normalize(dirA + dirB);\n vec2 perp = vec2(-dirA.y, dirA.x);\n vec2 miter = vec2(-tangent.y, tangent.x);\n len = width / dot(miter, perp);\n dir = tangent;\n } else {\n dir = dirA;\n }\n }\n\n vec2 normal = vec2(-dir.y, dir.x) * len;\n normal.x /= aspectRatio;\n vec4 offset = vec4(normal * offsetScale, 0.0, 0.0);\n gl_Position = currProjected + offset;\n\n // Get color from texture\n float colorRowIndex = floor((colorIndex + colorTexEps) / colorTexRes);\n vec2 colorTexIndex = vec2(\n (colorIndex / colorTexRes) - colorRowIndex + colorTexEps,\n colorRowIndex / colorTexRes + colorTexEps\n );\n\n color = texture2D(colorTex, colorTexIndex);\n color.a = useColorOpacity * color.a + useOpacity * opacity;\n}",frag:"\nprecision mediump float;\nvarying vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"})},F=()=>{1===h&&o.length%D>0&&console.warn(`The length of points (${m}) does not match the dimensions (${D}). Incomplete points are ignored.`),g=o.flat().slice(0,m*D),d&&(g=function(e,n,t,r=0){const o=[],i=new Array(t).fill(r);for(let t=0,r=e.length/n;t<r;t++){const r=t*n;for(let t=0;t<n;t++)i[t]=e[r+t];le.apply(o,i)}return o}(g,2,3,v)),i.length!==m&&(i=new Array(m).fill(0)),u.length!==m&&(u=new Array(m).fill(1));const e=i.slice(),n=l.length===m?l.slice():new Array(m).fill(null===c?1:c),t=u.slice();let r=0;for(const o of y){const i=r+o-1;fe(g,i,i,3),fe(g,r,r,3),fe(e,i,i,1),fe(e,r,r,1),fe(n,i,i,1),fe(n,r,r,1),fe(t,i,i,1),fe(t,r,r,1),r+=o+2}w=new Float32Array(ue(g,3)),x=ue(e),b=ue(n),S=ue(t,1,-1),P=((e,n=[])=>{let t=0;for(const r of e){for(let e=0;e<r-1;e++){const r=t+2*e,o=r+1,i=r+2,a=r+3;n.push(r,o,i,i,o,a)}t+=2*(r+2)}return n})(y),A({usage:"dynamic",type:"float",length:w.length*ae,data:w}),E({usage:"dynamic",type:"float",length:b.length*ae,data:b}),M({usage:"dynamic",type:"float",length:S.length*ae,data:S}),T({usage:"dynamic",type:"float",length:x.length*ae,data:x}),B({primitive:"triangles",usage:"dynamic",type:P.length>65536?"uint32":"uint16",data:P})},j=()=>{k(),N()},k=()=>{o=[],g=[],w=new Float32Array,S=[],P=[],A.destroy(),M.destroy(),B.destroy()},_=(e,n)=>{const t=n.flat(2);return t.length===m?t:t.length===h?y.flatMap((e,n)=>Array(e).fill(t[n])):e},V=(e=[],{colorIndices:n=i,opacities:t=l,widths:r=u,is2d:a=d}={})=>{D=(d=a)?2:3,h=ce(o=e)?o.length:1,y=ce(o)?o.map(e=>Math.floor(e.length/D)):[Math.floor(o.length/D)],m=y.reduce((e,n)=>e+n,0),i=_(i,n),l=_(l,t),u=_(u,r),o&&m>1?F():j()},W=()=>{const n=ce(a)?a:[a];C=Math.max(2,Math.ceil(Math.sqrt(n.length)));const t=new Uint8Array(C**2*4);n.forEach((e,n)=>{t[4*n]=Math.min(255,Math.max(0,Math.round(255*e[0]))),t[4*n+1]=Math.min(255,Math.max(0,Math.round(255*e[1]))),t[4*n+2]=Math.min(255,Math.max(0,Math.round(255*e[2]))),t[4*n+3]=Number.isNaN(+e[3])?255:Math.min(255,Math.max(0,Math.round(255*e[3])))}),I=e.texture({data:t,shape:[C,C,4]})};return N(),W(),o&&o.length>1&&V(o),{clear:j,destroy:k,draw:({projection:e,model:i,view:a}={})=>{e&&(n=e),i&&(t=i),a&&(r=a),o&&o.length>1&&L({projection:n,model:t,view:r})},getPoints:()=>o,setPoints:V,getData:()=>({points:w,widths:S,opacities:b,colorIndices:x}),getBuffer:()=>({points:A,widths:M,opacities:E,colorIndices:T}),getStyle:()=>({color:a,miter:f,width:s}),setStyle:({color:e,opacity:n,miter:t,width:r}={})=>{var o;e&&((e,n=c)=>{a=e,c=n,I&&I.destroy(),W()})(e,n||c),t&&(f=Boolean(t)),void 0!==(o=r)&&Number.isFinite(o)&&(s=r)}}};var ve,pe="auto",he=Float32Array.BYTES_PER_ELEMENT,me=["OES_texture_float","OES_element_index_uint","WEBGL_color_buffer_float","EXT_float_blend"],ye={color:[0,0,0,0],depth:1},ge="panZoom",we="lasso",xe="rotate",be=[ge,we,xe],Se=ge,Pe={cubicIn:e=>e*e*e,cubicInOut:g,cubicOut:e=>--e*e*e+1,linear:e=>e,quadIn:e=>e*e,quadInOut:e=>e<.5?2*e*e:(4-2*e)*e-1,quadOut:e=>e*(2-e)},Ae=g,Ee="continuous",Me="categorical",Ie=[Ee,Me],Ce="deselect",Te="lassoEnd",Oe=[Ce,Te],Re=[0,.666666667,1,1],Be=Te,Le=750,De=500,ze=100,Ne=250,Fe="intersect",je="lasso",ke="rotate",_e="merge",Ve="remove",We=[je,ke,Fe,_e,Ve],Ze="alt",Ge="cmd",Ue="ctrl",Ke="meta",qe="shift",He=[Ze,Ge,Ue,Ke,qe],Ye=u(u(u(u({},Ve,Ze),ke,Ze),je,qe),_e,Ge),Xe=pe,$e=pe,Je=null,Qe=null,en=null,nn=null,tn=null,rn=[.66,.66,.66,1],on=[0,.55,1,1],an=[1,1,1,1],cn=[0,0,0,1],ln=null,sn=[.66,.66,.66,.2],un=[0,.55,1,1],fn=[1,1,1,1],dn=[1,1,1,.5],vn=[0,0],pn=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),hn=[1,1,1,.5],mn=new Set(["z","valueZ","valueA","value1","category"]),yn=new Set(["w","valueW","valueB","value2","value"]),gn=15e3,wn=Symbol("SKIP_DEPRECATION_VALUE_TRANSLATION"),xn="Points have not been drawn",bn="The instance was already destroyed",Sn=function(){var e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],n=function(){function n(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,i=arguments.length>3?arguments[3]:void 0;if(function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),isNaN(t)||t<0)throw new Error("Unexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;var a=e.indexOf(this.ArrayType),c=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(o,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+c+l+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+a]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}return r=n,i=[{key:"from",value:function(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var r=p(new Uint8Array(t,0,2),2),o=r[0],i=r[1];if(219!==o)throw new Error("Data does not appear to be in a KDBush format.");var a=i>>4;if(1!==a)throw new Error("Got v".concat(a," data when expected v").concat(1,"."));var c=e[15&i];if(!c)throw new Error("Unrecognized array type.");var l=p(new Uint16Array(t,2,1),1)[0];return new n(p(new Uint32Array(t,4,1),1)[0],l,c,t)}}],(o=[{key:"add",value:function(e,n){var t=this._pos>>1;return this.ids[t]=t,this.coords[this._pos++]=e,this.coords[this._pos++]=n,t}},{key:"finish",value:function(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return t(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}},{key:"range",value:function(e,n,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var o=this.ids,i=this.coords,a=this.nodeSize,c=[0,o.length-1,0],l=[];c.length;){var s=c.pop()||0,u=c.pop()||0,f=c.pop()||0;if(u-f<=a)for(var d=f;d<=u;d++){var v=i[2*d],p=i[2*d+1];v>=e&&v<=t&&p>=n&&p<=r&&l.push(o[d])}else{var h=f+u>>1,m=i[2*h],y=i[2*h+1];m>=e&&m<=t&&y>=n&&y<=r&&l.push(o[h]),(0===s?e<=m:n<=y)&&(c.push(f),c.push(h-1),c.push(1-s)),(0===s?t>=m:r>=y)&&(c.push(h+1),c.push(u),c.push(1-s))}}return l}},{key:"within",value:function(e,n,t){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var r=this.ids,o=this.coords,i=this.nodeSize,c=[0,r.length-1,0],l=[],s=t*t;c.length;){var u=c.pop()||0,f=c.pop()||0,d=c.pop()||0;if(f-d<=i)for(var v=d;v<=f;v++)a(o[2*v],o[2*v+1],e,n)<=s&&l.push(r[v]);else{var p=d+f>>1,h=o[2*p],m=o[2*p+1];a(h,m,e,n)<=s&&l.push(r[p]),(0===u?e-t<=h:n-t<=m)&&(c.push(d),c.push(p-1),c.push(1-u)),(0===u?e+t>=h:n+t>=m)&&(c.push(p+1),c.push(f),c.push(1-u))}}return l}}])&&l(r.prototype,o),i&&l(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}();function t(e,n,o,i,a,c){if(!(a-i<=o)){var l=i+a>>1;r(e,n,l,i,a,c),t(e,n,o,i,l-1,1-c),t(e,n,o,l+1,a,1-c)}}function r(e,n,t,i,a,c){for(;a>i;){if(a-i>600){var l=a-i+1,s=t-i+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(s-l/2<0?-1:1);r(e,n,t,Math.max(i,Math.floor(t-s*f/l+d)),Math.min(a,Math.floor(t+(l-s)*f/l+d)),c)}var v=n[2*t+c],p=i,h=a;for(o(e,n,i,t),n[2*a+c]>v&&o(e,n,i,a);p<h;){for(o(e,n,p,h),p++,h--;n[2*p+c]<v;)p++;for(;n[2*h+c]>v;)h--}n[2*i+c]===v?o(e,n,i,h):o(e,n,++h,a),h<=t&&(i=h+1),t<=h&&(a=h-1)}}function o(e,n,t,r){i(e,t,r),i(n,2*t,2*r),i(n,2*t+1,2*r+1)}function i(e,n,t){var r=e[n];e[n]=e[t],e[t]=r}function a(e,n,t,r){var o=e-t,i=n-r;return o*o+i*i}return n},Pn=function(){addEventListener("message",function(e){var n=e.data.points;0===n.length&&self.postMessage({error:new Error("Invalid point data")});var t,r=new KDBush(n.length,e.data.nodeSize),o=s(n);try{for(o.s();!(t=o.n()).done;){var i=p(t.value,2),a=i[0],c=i[1];r.add(a,c)}}catch(e){o.e(e)}finally{o.f()}r.finish(),postMessage(r.data,[r.data])})},An=Sn(),En=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{nodeSize:16,useWorker:void 0};return new Promise(function(t,r){if(e instanceof ArrayBuffer)t(An.from(e));else if((e.length<1e6||!1===n.useWorker)&&!0!==n.useWorker){var o,i=new An(e.length,n.nodeSize),a=s(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;i.add(c[0],c[1])}}catch(e){a.e(e)}finally{a.f()}i.finish(),t(i)}else{var l=function(e){var n=Sn.toString(),t=e.toString(),r="const createKDBushClass = ".concat(n,";")+"KDBush = createKDBushClass();"+"const createWorker = ".concat(t,";")+"createWorker();",o=new Blob([r],{type:"text/javascript"}),i=URL.createObjectURL(o),a=new Worker(i,{name:"KDBush"});return URL.revokeObjectURL(i),a}(Pn);l.onmessage=function(e){e.data.error?r(e.data.error):t(An.from(e.data)),l.terminate()},l.postMessage({points:e,nodeSize:n.nodeSize})}})},Mn=function(e,n){return"".concat(e,"ms ease-out effectIn ").concat(n,"ms 1 normal forwards")},In=function(e,n){return"".concat(e,"ms linear leftSpinIn ").concat(n,"ms 1 normal forwards")},Cn=function(e,n){return"".concat(e,"ms linear rightSpinIn ").concat(n,"ms 1 normal forwards")},Tn=function(e,n){return"".concat(e,"ms linear circleIn ").concat(n,"ms 1 normal forwards")},On=function(e,n,t){return"\n @keyframes mainIn {\n 0% {\n color: ".concat(n,";\n opacity: 0;\n }\n 0%, ").concat(e,"% {\n color: ").concat(n,";\n opacity: 1;\n }\n 100% {\n color: ").concat(t,";\n opacity: 0.8;\n }\n }\n")},Rn=function(e,n,t,r){return"\n @keyframes effectIn {\n 0%, ".concat(e,"% {\n opacity: ").concat(t,";\n transform: scale(").concat(r,");\n }\n ").concat(n,"% {\n opacity: 0.66;\n transform: scale(1.5);\n }\n 99% {\n opacity: 0;\n transform: scale(2);\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")},Bn=function(e,n){return"\n @keyframes leftSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(360deg);\n }\n }\n")},Ln=function(e,n){return"\n @keyframes rightSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(180deg);\n }\n }\n")},Dn=function(e){return"".concat(e,"ms linear effectOut 0s 1 normal forwards")},zn=function(e){return"".concat(e,"ms linear leftSpinOut 0s 1 normal forwards")},Nn=function(e){return"".concat(e,"ms linear rightSpinOut 0s 1 normal forwards")},Fn=function(e){return"".concat(e,"ms linear circleOut 0s 1 normal forwards")},jn=function(e,n){return"\n @keyframes mainOut {\n 0% {\n color: ".concat(e,";\n }\n 100% {\n color: ").concat(n,";\n }\n }\n")},kn=function(e,n){return"\n @keyframes rightSpinOut {\n 0%, ".concat(e,"% {\n transform: rotate(").concat(n,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n")},_n=function(e){return"\n @keyframes leftSpinOut {\n 0% {\n transform: rotate(".concat(e,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n }\n")},Vn=function(e,n,t){return"\n @keyframes circleOut {\n 0%, ".concat(e,"% {\n clip-path: ").concat(n,";\n opacity: ").concat(t,";\n }\n ").concat(e+.01,"% {\n clip-path: inset(0 0 0 50%);\n opacity: ").concat(t,";\n }\n 100% {\n clip-path: inset(0 0 0 50%);\n opacity: 0;\n }\n }\n")},Wn=function(e){return null===e?arguments.length>1&&void 0!==arguments[1]?arguments[1]:null:e},Zn=function(){if(!ve){var e=document.createElement("style");document.head.appendChild(e),ve=e.sheet}return ve},Gn=function(e){var n=Zn(),t=n.rules.length;return n.insertRule(e,t),t},Un=function(e){Zn().deleteRule(e)},Kn="".concat(2500,"ms ease scaleInFadeOut 0s 1 normal backwards"),qn=null,Hn="".concat(250,"ms ease fadeScaleOut 0s 1 normal backwards"),Yn=null,Xn=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.onDraw,r=void 0===t?w:t,o=n.onStart,i=void 0===o?w:o,a=n.onEnd,c=void 0===a?w:a,l=n.enableInitiator,s=void 0===l||l,u=n.initiatorParentElement,f=void 0===u?document.body:u,d=n.longPressIndicatorParentElement,v=void 0===d?document.body:d,m=n.minDelay,y=void 0===m?8:m,g=n.minDist,x=void 0===g?2:g,b=n.pointNorm,M=void 0===b?w:b,I=n.type,C=void 0===I?"freeform":I,T=n.brushSize,O=s,R=f,B=v,L=r,D=i,z=c,N=y,F=x,j=M,k=C,_=void 0===T?24:T,V=document.createElement("div"),W=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);V.id="lasso-initiator-".concat(W),V.style.position="fixed",V.style.display="flex",V.style.justifyContent="center",V.style.alignItems="center",V.style.zIndex=99,V.style.width="4rem",V.style.height="4rem",V.style.borderRadius="4rem",V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)";var Z,G=function(){var e=document.createElement("div"),n=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);e.id="lasso-long-press-".concat(n),e.style.position="fixed",e.style.width="1.25rem",e.style.height="1.25rem",e.style.pointerEvents="none",e.style.transform="translate(-50%,-50%)";var t=document.createElement("div");t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.width="1.25rem",t.style.height="1.25rem",t.style.clipPath="inset(0px 0px 0px 50%)",t.style.opacity=0,e.appendChild(t);var r=document.createElement("div");r.style.position="absolute",r.style.top=0,r.style.left=0,r.style.width="0.8rem",r.style.height="0.8rem",r.style.border="0.2rem solid currentcolor",r.style.borderRadius="0.8rem",r.style.clipPath="inset(0px 50% 0px 0px)",r.style.transform="rotate(0deg)",t.appendChild(r);var o=document.createElement("div");o.style.position="absolute",o.style.top=0,o.style.left=0,o.style.width="0.8rem",o.style.height="0.8rem",o.style.border="0.2rem solid currentcolor",o.style.borderRadius="0.8rem",o.style.clipPath="inset(0px 50% 0px 0px)",o.style.transform="rotate(0deg)",t.appendChild(o);var i=document.createElement("div");return i.style.position="absolute",i.style.top=0,i.style.left=0,i.style.width="1.25rem",i.style.height="1.25rem",i.style.borderRadius="1.25rem",i.style.background="currentcolor",i.style.transform="scale(0)",i.style.opacity=0,e.appendChild(i),{longPress:e,longPressCircle:t,longPressCircleLeft:r,longPressCircleRight:o,longPressEffect:i}}(),U=G.longPress,K=G.longPressCircle,q=G.longPressCircleLeft,H=G.longPressCircleRight,Y=G.longPressEffect,X=!1,$=!1,J=[],Q=[],ee=[],ne=[],te=!1,re=null,oe=null,ie=null,ae=null,ce=null,le=null,se=null,ue=null,fe=null,de=null,ve=function(){X=!1};window.addEventListener("mouseup",ve);var pe,he=function(){V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)"},me=function(e,n){var t=getComputedStyle(e),r=+t.opacity,o=t.transform.match(/([0-9.-]+)+/g),i=+o[0],a=+o[1],c=Math.sqrt(i*i+a*a),l=Math.atan2(a,i)*(180/Math.PI);return{opacity:r,scale:c,rotate:l=n&&l<=0?360+l:l}},ye=function(e){if(O&&!X){var n=e.clientX,t=e.clientY;V.style.top="".concat(t,"px"),V.style.left="".concat(n,"px");var r=me(V),o=r.opacity,i=r.scale,a=r.rotate;V.style.opacity=o,V.style.transform="translate(-50%,-50%) scale(".concat(i,") rotate(").concat(a,"deg)"),V.style.animation="none",A().then(function(){null!==qn&&Un(qn),qn=Gn(function(e,n,t){return"\n@keyframes scaleInFadeOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 10% {\n opacity: 1;\n transform: translate(-50%,-50%) scale(1) rotate(").concat(t+20,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0.9) rotate(").concat(t+60,"deg);\n }\n}\n")}(o,i,a)),V.style.animation=Kn,A().then(function(){he()})})}},ge=function(){var e=me(V),n=e.opacity,t=e.scale,r=e.rotate;V.style.opacity=n,V.style.transform="translate(-50%,-50%) scale(".concat(t,") rotate(").concat(r,"deg)"),V.style.animation="none",A(2).then(function(){null!==Yn&&Un(Yn),Yn=Gn(function(e,n,t){return"\n@keyframes fadeScaleOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0) rotate(").concat(t,"deg);\n }\n}\n")}(n,t,r)),V.style.animation=Hn,A().then(function(){he()})})},we=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{time:Le,extraTime:De,delay:ze},r=t.time,o=void 0===r?Le:r,i=t.extraTime,a=void 0===i?De:i,c=t.delay,l=void 0===c?ze:c;te=!0;var s=getComputedStyle(U);U.style.color=s.color,U.style.top="".concat(n,"px"),U.style.left="".concat(e,"px"),U.style.animation="none";var u=getComputedStyle(K);K.style.clipPath=u.clipPath,K.style.opacity=u.opacity,K.style.animation="none";var f=me(Y);Y.style.opacity=f.opacity,Y.style.transform="scale(".concat(f.scale,")"),Y.style.animation="none";var d=me(q);q.style.transform="rotate(".concat(d.rotate,"deg)"),q.style.animation="none";var v=me(H);H.style.transform="rotate(".concat(v.rotate,"deg)"),H.style.animation="none",A().then(function(){if(te){null!==ce&&Un(ce),null!==ae&&Un(ae),null!==ie&&Un(ie),null!==oe&&Un(oe),null!==re&&Un(re);var e=function(e){var n,t,r,o,i,a=e.time,c=void 0===a?Le:a,l=e.extraTime,s=void 0===l?De:l,u=e.delay,f=void 0===u?ze:u,d=e.currentColor,v=e.targetColor,p=e.effectOpacity,h=e.effectScale,m=e.circleLeftRotation,y=e.circleRightRotation,g=e.circleClipPath,w=e.circleOpacity,x=m/360,b=function(e,n,t){return(1-e)*n+t}(x,c,s),S=Math.round((1-x)*c/b*100),P=Math.round(S/2),A=S+(100-S)/4;return{rules:{main:On(S,d,v),effect:Rn(S,A,p,h),circleRight:Ln(P,y),circleLeft:Bn(S,m),circle:(r=P,o=g,i=w,"\n @keyframes circleIn {\n 0% {\n clip-path: ".concat(o,";\n opacity: ").concat(i,";\n }\n ").concat(r,"% {\n clip-path: ").concat(o,";\n opacity: 1;\n }\n ").concat(r+.01,"%, 100% {\n clip-path: inset(0);\n opacity: 1;\n }\n }\n"))},names:{main:(n=b,t=f,"".concat(n,"ms ease-out mainIn ").concat(t,"ms 1 normal forwards")),effect:Mn(b,f),circleLeft:In(b,f),circleRight:Cn(b,f),circle:Tn(b,f)}}}({time:o,extraTime:a,delay:l,currentColor:s.color||"currentcolor",targetColor:U.dataset.activeColor,effectOpacity:f.opacity||0,effectScale:f.scale||0,circleLeftRotation:d.rotate||0,circleRightRotation:v.rotate||0,circleClipPath:u.clipPath||"inset(0 0 0 50%)",circleOpacity:u.opacity||0}),n=e.rules,t=e.names;re=Gn(n.main),oe=Gn(n.effect),ie=Gn(n.circleLeft),ae=Gn(n.circleRight),ce=Gn(n.circle),U.style.animation=t.main,Y.style.animation=t.effect,q.style.animation=t.circleLeft,H.style.animation=t.circleRight,K.style.animation=t.circle}})},xe=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{time:Ne}).time,n=void 0===e?Ne:e;if(te){te=!1;var t=getComputedStyle(U);U.style.color=t.color,U.style.animation="none";var r=getComputedStyle(K);K.style.clipPath=r.clipPath,K.style.opacity=r.opacity,K.style.animation="none";var o=me(Y);Y.style.opacity=o.opacity,Y.style.transform="scale(".concat(o.scale,")"),Y.style.animation="none";var i="x"===r.clipPath.slice(-2,-1),a=me(q,i);q.style.transform="rotate(".concat(a.rotate,"deg)"),q.style.animation="none";var c=me(H);H.style.transform="rotate(".concat(c.rotate,"deg)"),H.style.animation="none",A().then(function(){null!==de&&Un(de),null!==fe&&Un(fe),null!==ue&&Un(ue),null!==se&&Un(se),null!==le&&Un(le);var e=function(e){var n,t,r,o=e.time,i=void 0===o?Ne:o,a=e.currentColor,c=e.targetColor,l=e.effectOpacity,s=e.effectScale,u=e.circleLeftRotation,f=e.circleRightRotation,d=e.circleClipPath,v=e.circleOpacity,p=u/360,h=p*i,m=Math.min(100,100*p),y=m>50?Math.round(100*(1-50/m)):0;return{rules:{main:jn(a,c),effect:(t=l,r=s,"\n @keyframes effectOut {\n 0% {\n opacity: ".concat(t,";\n transform: scale(").concat(r,");\n }\n 99% {\n opacity: 0;\n transform: scale(").concat(r+.5,");\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")),circleRight:kn(y,f),circleLeft:_n(u),circle:Vn(y,d,v)},names:{main:(n=h,"".concat(n,"ms linear mainOut 0s 1 normal forwards")),effect:Dn(h),circleRight:zn(h),circleLeft:Nn(h),circle:Fn(h)}}}({time:n,currentColor:t.color||"currentcolor",targetColor:U.dataset.color,effectOpacity:o.opacity||0,effectScale:o.scale||0,circleLeftRotation:a.rotate||0,circleRightRotation:c.rotate||0,circleClipPath:r.clipPath||"inset(0px)",circleOpacity:r.opacity||1}),i=e.rules,l=e.names;le=Gn(i.main),se=Gn(i.effect),ue=Gn(i.circleLeft),fe=Gn(i.circleRight),de=Gn(i.circle),U.style.animation=l.main,Y.style.animation=l.effect,q.style.animation=l.circleLeft,H.style.animation=l.circleRight,K.style.animation=l.circle})}},be=function(){L(J,Q)},Se=function(e){J.push(e),Q.push(e[0],e[1])},Pe=function(e){var n=p(e,2),t=n[0],r=n[1],o=p(J[0],2),i=o[0],a=o[1];J[1]=[t,a],J[2]=[t,r],J[3]=[i,r],J[4]=[i,a],Q[2]=t,Q[3]=a,Q[4]=t,Q[5]=r,Q[6]=i,Q[7]=r,Q[8]=i,Q[9]=a},Ae=function(e){ee.push(e)},Ee=function(e,n,t){var r,o=p(e,2),i=o[0],a=o[1],c=p(n,2),l=i-c[0],s=a-c[1],u=(r=[l,s],Math.sqrt(r.reduce((e,n)=>e+n**2,0)));return[+s/u*t,-l/u*t]},Me=function(e){var n=ee.at(-1),t=Math.abs(j([0,0])[0]-j([_/2,0])[0]),r=p(Ee(e,n,t),2),o=r[0],i=r[1],a=ee.length;if(1===a){var c=[n[0]+o,n[1]+i],l=[n[0]-o,n[1]-i];J.push(c,l),Q.push(c[0],c[1],l[0],l[1]),ne.push([o,i])}else{var s=p(Ee(e,n,t),2);o=s[0],i=s[1];var u=p(function(e,n,t){if(0===e.length)return 0;if(1===e.length)return e[0];for(var r=Math.pow(2,-1/n),o=Math.max(0,e.length-t),i=e.slice(o),a=0,c=0,l=0,s=i.length-1;s>=0;s--){var u=i.length-1-s,f=Math.pow(r,u);a+=i[s][0]*f,c+=i[s][1]*f,l+=f}return[a/l,c/l]}([].concat(h(ne),[[o,i]]),1,10),2);o=u[0],i=u[1];var f=p(ne.at(-1),2),d=(o+f[0])/2,v=(i+f[1])/2,m=[n[0]+d,n[1]+v],y=[n[0]-d,n[1]-v];J.splice(a-1,2,m,y),Q.splice(2*(a-1),4,m[0],m[1],y[0],y[1]),ne.splice(a,1,[d,v])}var g=[e[0]+o,e[1]+i],w=[e[0]-o,e[1]-i];J.splice(a,0,g,w),Q.splice(2*a,0,g[0],g[1],w[0],w[1]),ee.push(e),ne.push([o,i])},Ie=Se,Ce=Se,Te=function(e){if(Z){(t=e[0],r=e[1],o=Z[0],i=Z[1],Math.sqrt((t-o)**2+(r-i)**2))>F&&(Z=e,Ie(j(e)),J.length>1&&be())}else{$||($=!0,D()),Z=e;var n=j(e);Ce(n)}var t,r,o,i},Oe=E(Te,N,N),Re=function(n,t){var r=function(n){var t=e.getBoundingClientRect(),r=t.left,o=t.top;return[n.clientX-r,n.clientY-o]}(n);return t?Oe(r):Te(r)},Be=function(){J=[],Q=[],ee=[],ne=[],Z=void 0,be()},Fe=function(e){ye(e)},je=function(){X=!0,$=!0,Be(),D()},ke=function(){ge()},_e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.intersect,t=void 0!==n&&n,r=e.merge,o=void 0!==r&&r,i=e.remove,a=void 0!==i&&i;$=!1;var c=h(J),l=h(Q);return Oe.cancel(),Be(),c.length>0&&z(c,l,{intersect:t,merge:o,remove:a}),c},Ve=function(e){return"onDraw"===e?L:"onStart"===e?D:"onEnd"===e?z:"enableInitiator"===e?O:"minDelay"===e?N:"minDist"===e?F:"pointNorm"===e?j:"type"===e?k:"brushSize"===e?_:void 0},We=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onDraw,t=void 0===n?null:n,r=e.onStart,o=void 0===r?null:r,i=e.onEnd,a=void 0===i?null:i,c=e.enableInitiator,l=void 0===c?null:c,s=e.initiatorParentElement,u=void 0===s?null:s,f=e.longPressIndicatorParentElement,d=void 0===f?null:f,v=e.minDelay,p=void 0===v?null:v,h=e.minDist,m=void 0===h?null:h,y=e.pointNorm,g=void 0===y?null:y,w=e.type,x=void 0===w?null:w,b=e.brushSize,S=void 0===b?null:b;L=Wn(t,L),D=Wn(o,D),z=Wn(a,z),O=Wn(l,O),N=Wn(p,N),F=Wn(m,F),j=Wn(g,j),_=Wn(S,_),null!==u&&u!==R&&(R.removeChild(V),u.appendChild(V),R=u),null!==d&&d!==B&&(B.removeChild(U),d.appendChild(U),B=d),O?(V.addEventListener("click",Fe),V.addEventListener("mousedown",je),V.addEventListener("mouseleave",ke)):(V.removeEventListener("mousedown",je),V.removeEventListener("mouseleave",ke)),null!==x&&function(e){switch(e){case"rectangle":k=e,Ie=Pe,Ce=Se;break;case"brush":k=e,Ie=Me,Ce=Ae;break;default:k="freeform",Ie=Se,Ce=Se}}(x)},Ze=function(){R.removeChild(V),B.removeChild(U),window.removeEventListener("mouseup",ve),V.removeEventListener("click",Fe),V.removeEventListener("mousedown",je),V.removeEventListener("mouseleave",ke)};return R.appendChild(V),B.appendChild(U),We({onDraw:L,onStart:D,onEnd:z,enableInitiator:O,initiatorParentElement:R,type:k,brushSize:_}),function(...e){return n=>e.reduce((e,n)=>n(e),n)}(P("initiator",V),P("longPressIndicator",U),function(e){return S(e,{clear:Be,destroy:Ze,end:_e,extend:Re,get:Ve,set:We,showInitiator:ye,hideInitiator:ge,showLongPressIndicator:we,hideLongPressIndicator:xe})},(pe=Xn,e=>S({__proto__:{constructor:pe}},e)))({})};const $n=e=>`\nprecision highp float;\n\nuniform sampler2D colorTex;\nuniform float colorTexRes;\nuniform float colorTexEps;\nuniform sampler2D stateTex;\nuniform float stateTexRes;\nuniform float stateTexEps;\nuniform float devicePixelRatio;\nuniform sampler2D encodingTex;\nuniform float encodingTexRes;\nuniform float encodingTexEps;\nuniform float pointSizeExtra;\nuniform float pointOpacityMax;\nuniform float pointOpacityScale;\nuniform float numPoints;\nuniform float globalState;\nuniform float isColoredByZ;\nuniform float isColoredByW;\nuniform float isOpacityByZ;\nuniform float isOpacityByW;\nuniform float isOpacityByDensity;\nuniform float isSizedByZ;\nuniform float isSizedByW;\nuniform float isPixelAligned;\nuniform float colorMultiplicator;\nuniform float opacityMultiplicator;\nuniform float opacityDensity;\nuniform float sizeMultiplicator;\nuniform float numColorStates;\nuniform float pointScale;\nuniform float drawingBufferWidth;\nuniform float drawingBufferHeight;\nuniform mat4 modelViewProjection;\n\nattribute vec2 stateIndex;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nvoid main() {\n vec4 state = texture2D(stateTex, stateIndex);\n\n if (isPixelAligned < 0.5) {\n gl_Position = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n } else {\n vec4 clipSpacePosition = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n vec2 ndcPosition = clipSpacePosition.xy / clipSpacePosition.w;\n vec2 pixelPos = 0.5 * (ndcPosition + 1.0) * vec2(drawingBufferWidth, drawingBufferHeight);\n pixelPos = floor(pixelPos + 0.5); // Snap to nearest pixel\n vec2 snappedPosition = (pixelPos / vec2(drawingBufferWidth, drawingBufferHeight)) * 2.0 - 1.0;\n gl_Position = vec4(snappedPosition, 0.0, 1.0);\n }\n\n\n // Determine color index\n float colorIndexZ = isColoredByZ * floor(state.z * colorMultiplicator);\n float colorIndexW = isColoredByW * floor(state.w * colorMultiplicator);\n\n // Multiply by the number of color states per color\n // I.e., normal, active, hover, background, etc.\n float colorIndex = (colorIndexZ + colorIndexW) * numColorStates;\n\n // Half a "pixel" or "texel" in texture coordinates\n float colorLinearIndex = colorIndex + globalState;\n\n // Need to add cEps here to avoid floating point issue that can lead to\n // dramatic changes in which color is loaded as floor(3/2.9999) = 1 but\n // floor(3/3.0001) = 0!\n float colorRowIndex = floor((colorLinearIndex + colorTexEps) / colorTexRes);\n\n vec2 colorTexIndex = vec2(\n (colorLinearIndex / colorTexRes) - colorRowIndex + colorTexEps,\n colorRowIndex / colorTexRes + colorTexEps\n );\n\n color = texture2D(colorTex, colorTexIndex);\n\n // Retrieve point size\n float pointSizeIndexZ = isSizedByZ * floor(state.z * sizeMultiplicator);\n float pointSizeIndexW = isSizedByW * floor(state.w * sizeMultiplicator);\n float pointSizeIndex = pointSizeIndexZ + pointSizeIndexW;\n\n float pointSizeRowIndex = floor((pointSizeIndex + encodingTexEps) / encodingTexRes);\n vec2 pointSizeTexIndex = vec2(\n (pointSizeIndex / encodingTexRes) - pointSizeRowIndex + encodingTexEps,\n pointSizeRowIndex / encodingTexRes + encodingTexEps\n );\n float pointSize = texture2D(encodingTex, pointSizeTexIndex).x;\n\n // Retrieve opacity\n ${3===e?"":`\n if (isOpacityByDensity < 0.5) {\n float opacityIndexZ = isOpacityByZ * floor(state.z * opacityMultiplicator);\n float opacityIndexW = isOpacityByW * floor(state.w * opacityMultiplicator);\n float opacityIndex = opacityIndexZ + opacityIndexW;\n\n float opacityRowIndex = floor((opacityIndex + encodingTexEps) / encodingTexRes);\n vec2 opacityTexIndex = vec2(\n (opacityIndex / encodingTexRes) - opacityRowIndex + encodingTexEps,\n opacityRowIndex / encodingTexRes + encodingTexEps\n );\n color.a = texture2D(encodingTex, opacityTexIndex)[${1+e}];\n } else {\n color.a = min(1.0, opacityDensity + globalState);\n }\n `}\n\n color.a = min(pointOpacityMax, color.a) * pointOpacityScale;\n finalPointSize = (pointSize * pointScale) + pointSizeExtra;\n gl_PointSize = finalPointSize;\n}\n`;var Jn=function(e,n){return!!e&&me.reduce(function(t,r){return e.hasExtension(r)?t:(n||console.warn("WebGL: ".concat(r," extension not supported. Scatterplot might not render properly")),!1)},!0)},Qn=function(e){var n,t=e.getContext("webgl",{antialias:!0,preserveDrawingBuffer:!0}),r=[],o=s(me);try{for(o.s();!(n=o.n()).done;){var a=n.value;t.getExtension(a)?r.push(a):console.warn("WebGL: ".concat(a," extension not supported. Scatterplot might not render properly"))}}catch(e){o.e(e)}finally{o.f()}return i.default({gl:t,extensions:r})},et=function(e,n,t,r){return Math.sqrt(Math.pow(e-t,2)+Math.pow(n-r,2))},nt=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,tt=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).minLength,r=void 0===t?0:t;return Array.isArray(e)&&e.length>=r&&e.every(n)},rt=function(e){return!Number.isNaN(+e)&&+e>=0},ot=function(e){return!Number.isNaN(+e)&&+e>0},it=function(e,n){return function(t){return e.indexOf(t)>=0?t:n}},at=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gn;return new Promise(function(r,o){(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gn;return new Promise(function(r,o){var i=new Image;n&&(i.crossOrigin="anonymous"),i.src=e,i.onload=function(){r(i)};var a=function(){o(new Error("IMAGE_LOAD_ERROR"))};i.onerror=a,setTimeout(a,t)})})(n,0!==n.indexOf(window.location.origin)&&-1===n.indexOf("base64"),t).then(function(n){r(e.texture(n))}).catch(function(e){o(e)})})},ct=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return[].concat(h(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.replace(nt,function(e,n,t,r){return"#".concat(n).concat(n).concat(t).concat(t).concat(r).concat(r)}).substring(1).match(/.{2}/g).map(function(e){return Number.parseInt(e,16)/Math.pow(255,n)})}(e,n)),[Math.pow(255,!n)])},lt=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,st=function(e){return e>=0&&e<=1},ut=function(e){return Array.isArray(e)&&e.every(st)};function ft(e,n,t,r,o,i){return(t-e)*(i-n)-(o-e)*(r-n)}var dt=function(e){for(var n=p(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),t=n[0],r=n[1],o=0,i=0,a=e.length-2;i<e.length;i+=2){var c=e[i],l=e[i+1],s=e[a],u=e[a+1];if(l<=r){if(u>r)ft(c,l,s,u,t,r)>0&&o++}else if(u<=r){ft(c,l,s,u,t,r)<0&&o--}a=i}return 0!==o},vt=function(e){return"string"==typeof e||e instanceof String},pt=function(e){return Number.isInteger(e)&&e>=0&&e<=255},ht=function(e){return Array.isArray(e)&&e.every(pt)},mt=function(e){return Array.isArray(e)&&e.length>0&&(Array.isArray(e[0])||vt(e[0]))},yt=function(e,n){return e>n?e:n},gt=function(e,n){return e<n?e:n},wt=function(e,n){if(4===(r=e).length&&(ut(r)||ht(r))){var t=ut(e);return n&&t||!n&&!t?e:n&&!t?e.map(function(e){return e/255}):e.map(function(e){return 255*e})}var r,o,i;if(3===(o=e).length&&(ut(o)||ht(o))){var a=Math.pow(255,!n),c=ut(e);return[].concat(n&&c||!n&&!c?h(e):h(n&&!c?e.map(function(e){return e/255}):e.map(function(e){return 255*e})),[a])}return i=e,lt.test(i)?ct(e,n):(console.warn("Only HEX, RGB, and RGBA are handled by this function. Returning white instead."),n?[1,1,1,1]:[255,255,255,255])},xt=function(e){return.21*e[0]+.72*e[1]+.07*e[2]},bt=function(e){return new Promise(function(n,t){if(!e||Array.isArray(e))n(e);else{var r=Array.isArray(e.x)||ArrayBuffer.isView(e.x)?e.x.length:0,o=(Array.isArray(e.x)||ArrayBuffer.isView(e.x))&&function(n){return e.x[n]},i=(Array.isArray(e.y)||ArrayBuffer.isView(e.y))&&function(n){return e.y[n]},a=(Array.isArray(e.line)||ArrayBuffer.isView(e.line))&&function(n){return e.line[n]},c=(Array.isArray(e.lineOrder)||ArrayBuffer.isView(e.lineOrder))&&function(n){return e.lineOrder[n]},l=Object.keys(e),s=(d=l.find(function(e){return mn.has(e)}))&&(Array.isArray(e[d])||ArrayBuffer.isView(e[d]))&&function(n){return e[d][n]},u=(f=l.find(function(e){return yn.has(e)}))&&(Array.isArray(e[f])||ArrayBuffer.isView(e[f]))&&function(n){return e[f][n]};o&&i&&s&&u&&a&&c?n(e.x.map(function(e,n){return[e,i(n),s(n),u(n),a(n),c(n)]})):o&&i&&s&&u&&a?n(Array.from({length:r},function(e,n){return[o(n),i(n),s(n),u(n),a(n)]})):o&&i&&s&&u?n(Array.from({length:r},function(e,n){return[o(n),i(n),s(n),u(n)]})):o&&i&&s?n(Array.from({length:r},function(e,n){return[o(n),i(n),s(n)]})):o&&i?n(Array.from({length:r},function(e,n){return[o(n),i(n)]})):t(new Error("You need to specify at least x and y"))}var f,d})},St=function(e){return Number.isFinite(e.y)&&!("x"in e)},Pt=function(e){return Number.isFinite(e.x)&&!("y"in e)},At=function(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height)},Et=function(e){return Number.isFinite(e.x1)&&Number.isFinite(e.y1)&&Number.isFinite(e.x2)&&Number.isFinite(e.x2)},Mt=function(e){return"vertices"in e&&e.vertices.length>1},It=function(e){for(var n=e.length,t=1;t<n;t++){for(var r=e[t],o=t-1;o>-1&&r<e[o];)e[o+1]=e[o],o--;e[o+1]=r}return e},Ct=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.regl,t=e.canvas,r=void 0===t?document.createElement("canvas"):t,o=e.gamma,i=void 0===o?1:o,a=!1;n||(n=Qn(r));var c=Jn(n),l=[r.width,r.height],s=n.framebuffer({width:l[0],height:l[1],colorFormat:"rgba",colorType:"float"}),u=n({vert:"\n precision highp float;\n attribute vec2 xy;\n void main () {\n gl_Position = vec4(xy, 0, 1);\n }",frag:"\n precision highp float;\n uniform vec2 srcRes;\n uniform sampler2D src;\n uniform float gamma;\n\n vec3 approxLinearToSRGB (vec3 rgb, float gamma) {\n return pow(clamp(rgb, vec3(0), vec3(1)), vec3(1.0 / gamma));\n }\n\n void main () {\n vec4 color = texture2D(src, gl_FragCoord.xy / srcRes);\n gl_FragColor = vec4(approxLinearToSRGB(color.rgb, gamma), color.a);\n }",attributes:{xy:[-4,-4,4,-4,0,4]},uniforms:{src:function(){return s},srcRes:function(){return l},gamma:function(){return i}},count:3,depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}}}),f=new Set,d=n.frame(function(){for(var e=f.values(),n=e.next();!n.done;)n.value(),n=e.next()}),v=function(e,n){var t=null==e?window.innerWidth:e,o=null==n?window.innerHeight:n;r.width=t*window.devicePixelRatio,r.height=o*window.devicePixelRatio,l[0]=r.width,l[1]=r.height,s.resize.apply(s,l)},p=function(){v()};e.canvas||(window.addEventListener("resize",p),window.addEventListener("orientationchange",p),v());return{get canvas(){return r},get regl(){return n},get gamma(){return i},set gamma(e){i=+e},get isSupported(){return c},get isDestroyed(){return a},render:function(e,t){n.clear(ye),s.use(function(){n.clear(ye),e()}),u(),function(e){var n=e.getContext("2d");n.clearRect(0,0,e.width,e.height),n.drawImage(r,(r.width-e.width)/2,(r.height-e.height)/2,e.width,e.height,0,0,e.width,e.height)}(t)},resize:v,onFrame:function(e){return f.add(e),function(){f.delete(e)}},refresh:function(){n.poll()},destroy:function(){a=!0,window.removeEventListener("resize",p),window.removeEventListener("orientationchange",p),d.cancel(),r=void 0,n.destroy(),n=void 0}}},Tt=function(){var e=function(e,n,t,r,o){var i=.5*(r-n),a=.5*(o-t);return(2*t-2*r+i+a)*e*e*e+(-3*t+3*r-2*i-a)*e*e+i*e+t},n=function(n,t,r){var o=r*n,i=Math.floor(o),a=o-i,c=t[Math.max(0,i-1)],l=t[i],s=t[Math.min(r,i+1)],u=t[Math.min(r,i+2)];return[e(a,c[0],l[0],s[0],u[0]),e(a,c[1],l[1],s[1],u[1])]},t=function(e,n,t,r){return Math.pow(e-t,2)+Math.pow(n-r,2)},r=function(e,n,t){var r=n[0],o=n[1],i=t[0]-r,a=t[1]-o;if(0!==i||0!==a){var c=((e[0]-r)*i+(e[1]-o)*a)/(i*i+a*a);c>1?(r=t[0],o=t[1]):c>0&&(r+=i*c,o+=a*c)}return(i=e[0]-r)*i+(a=e[1]-o)*a},o=function(e,n,t,i,a){for(var c,l=i,s=n+1;s<t;s++){var u=r(e[s],e[n],e[t]);u>l&&(c=s,l=u)}l>i&&(c-n>1&&o(e,n,c,i,a),a.push(e[c]),t-c>1&&o(e,c,t,i,a))},i=function(e,n){var t=e.length-1,r=[e[0]];return o(e,0,t,n,r),r.push(e[t]),r};self.onmessage=function(e){(e.data.points?+e.data.points.length:0)||self.postMessage({error:new Error("No points provided")}),e.data.points;var r=function(e){var n={},t=!Number.isNaN(+e[0][5]);return e.forEach(function(e){var r=e[4];n[r]||(n[r]=[]),t?n[r][e[5]]=e:n[r].push(e)}),Object.entries(n).forEach(function(e){n[e[0]]=e[1].filter(function(e){return e}),n[e[0]].reference=e[1][0]}),n}(e.data.points);self.postMessage({points:Object.entries(r).reduce(function(r,o){return r[o[0]]=function(e){for(var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.maxIntPointsPerSegment,c=void 0===a?100:a,l=o.tolerance,s=void 0===l?.002:l,u=e.length,f=u-1,d=f*c+1,v=Math.pow(s,2),p=[],h=0;h<u-1;h++){var m=[e[h].slice(0,2)];r=e[h];for(var y=1;y<c;y++){var g=n((h*c+y)/d,e,f);t(r[0],r[1],g[0],g[1])>v&&(m.push(g),r=g)}m.push(e[h+1]),m=i(m,v),p=p.concat(m.slice(0,m.length-1))}return p.push(e[e.length-1].slice(0,2)),p.flat()}(o[1],e.data.options),r[o[0]].reference=o[1].reference,r},{})})}},Ot=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{tolerance:.002,maxIntPointsPerSegment:100};return new Promise(function(t,r){var o,i=(o=Tt,new Worker(window.URL.createObjectURL(new Blob([`(${o.toString()})()`],{type:"text/javascript"}))));i.onmessage=function(e){e.data.error?r(e.data.error):t(e.data.points),i.terminate()},i.postMessage({points:e,options:n})})},Rt={showRecticle:{replacement:"showReticle",removalVersion:"2",translation:w},recticleColor:{replacement:"reticleColor",removalVersion:"2",translation:w},keyMap:{replacement:"actionKeyMap",removalVersion:"2",translation:function(e){return Object.entries(e).reduce(function(e,n){var t=p(n,2),r=t[0],o=t[1];return e[o]?e[o]=[].concat(h(e[o]),[r]):e[o]=r,e},{})}}},Bt=function(e){var n,t=Object.keys(e).filter(function(e){return Rt[e]}),r=s(t);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=Rt[o],a=i.replacement,c=i.removalVersion,l=i.translation;console.warn('regl-scatterplot: the "'.concat(o,'" property is deprecated and will be removed in v').concat(c,'. Please use "').concat(a,'" instead.')),e[Rt[o].replacement]=e[o]!==wn?l(e[o]):e[o],delete e[o]}}catch(e){r.e(e)}finally{r.f()}return e},Lt=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.allowSegment,o=void 0!==r&&r,i=t.allowDensity,a=void 0!==i&&i,c=t.allowInherit,l=void 0!==c&&c;return mn.has(e)?"valueZ":yn.has(e)?"valueW":"segment"===e?o?"segment":n:"density"===e?a?"density":n:"inherit"===e&&l?"inherit":n},Dt=function(e){switch(e){case"valueZ":return 2;case"valueW":return 3;default:return null}};e.checkSupport=Jn,e.createRegl=Qn,e.createRenderer=Ct,e.createSpatialIndex=function(e,n){return bt(e).then(function(e){return En(e,{useWorker:n})}).then(function(e){return e.data})},e.createTextureFromUrl=at,e.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=o.default({async:!e.syncEvents,caseInsensitive:!0}),t=new Float32Array(16),r=new Float32Array(16),i=[0,0];Bt(e);var a=e.renderer,l=e.antiAliasing,v=void 0===l?.5:l,m=e.pixelAligned,y=void 0!==m&&m,g=e.backgroundColor,S=void 0===g?cn:g,P=e.backgroundImage,A=void 0===P?null:P,M=e.canvas,I=void 0===M?document.createElement("canvas"):M,C=e.colorBy,B=void 0===C?tn:C,z=e.deselectOnDblClick,N=void 0===z||z,F=e.deselectOnEscape,_=void 0===F||F,V=e.lassoColor,W=void 0===V?Re:V,Z=e.lassoLineWidth,G=void 0===Z?2:Z,U=e.lassoMinDelay,K=void 0===U?10:U,q=e.lassoMinDist,H=void 0===q?3:q,Y=e.lassoMode,X=void 0===Y?null:Y,$=e.lassoClearEvent,J=void 0===$?Be:$,Q=e.lassoInitiator,ee=void 0!==Q&&Q,ne=e.lassoInitiatorParentElement,te=void 0===ne?document.body:ne,re=e.lassoLongPressIndicatorParentElement,oe=void 0===re?document.body:re,ie=e.lassoOnLongPress,ae=void 0!==ie&&ie,ce=e.lassoLongPressTime,le=void 0===ce?Le:ce,se=e.lassoLongPressAfterEffectTime,ue=void 0===se?De:se,fe=e.lassoLongPressEffectDelay,ve=void 0===fe?ze:fe,me=e.lassoLongPressRevertEffectTime,ye=void 0===me?Ne:me,mn=e.lassoType,yn=void 0===mn?"lasso":mn,Sn=e.lassoBrushSize,Pn=void 0===Sn?24:Sn,Mn=e.actionKeyMap,In=void 0===Mn?Ye:Mn,Cn=e.mouseMode,Tn=void 0===Cn?Se:Cn,On=e.showReticle,Rn=void 0!==On&&On,Bn=e.reticleColor,Ln=void 0===Bn?hn:Bn,Dn=e.pointColor,zn=void 0===Dn?rn:Dn,Nn=e.pointColorActive,Fn=void 0===Nn?on:Nn,jn=e.pointColorHover,kn=void 0===jn?an:jn,_n=e.showPointConnections,Vn=void 0!==_n&&_n,Wn=e.pointConnectionColor,Zn=void 0===Wn?sn:Wn,Gn=e.pointConnectionColorActive,Un=void 0===Gn?un:Gn,Kn=e.pointConnectionColorHover,qn=void 0===Kn?fn:Kn,Hn=e.pointConnectionColorBy,Yn=void 0===Hn?ln:Hn,Jn=e.pointConnectionOpacity,Qn=void 0===Jn?null:Jn,nt=e.pointConnectionOpacityBy,ct=void 0===nt?en:nt,lt=e.pointConnectionOpacityActive,st=void 0===lt?.66:lt,ut=e.pointConnectionSize,ft=void 0===ut?2:ut,pt=e.pointConnectionSizeActive,ht=void 0===pt?2:pt,Tt=e.pointConnectionSizeBy,Rt=void 0===Tt?Qe:Tt,zt=e.pointConnectionMaxIntPointsPerSegment,Nt=void 0===zt?100:zt,Ft=e.pointConnectionTolerance,jt=void 0===Ft?.002:Ft,kt=e.pointSize,_t=void 0===kt?6:kt,Vt=e.pointSizeSelected,Wt=void 0===Vt?2:Vt,Zt=e.pointSizeMouseDetection,Gt=void 0===Zt?"auto":Zt,Ut=e.pointOutlineWidth,Kt=void 0===Ut?2:Ut,qt=e.opacity,Ht=void 0===qt?pe:qt,Yt=e.opacityBy,Xt=void 0===Yt?nn:Yt,$t=e.opacityByDensityFill,Jt=void 0===$t?.15:$t,Qt=e.opacityInactiveMax,er=void 0===Qt?1:Qt,nr=e.opacityInactiveScale,tr=void 0===nr?1:nr,rr=e.sizeBy,or=void 0===rr?Je:rr,ir=e.pointOrder,ar=void 0===ir?null:ir,cr=e.pointScaleMode,lr=void 0===cr?"asinh":cr,sr=e.height,ur=void 0===sr?$e:sr,fr=e.width,dr=void 0===fr?Xe:fr,vr=e.annotationLineColor,pr=void 0===vr?dn:vr,hr=e.annotationLineWidth,mr=void 0===hr?1:hr,yr=e.annotationHVLineLimit,gr=void 0===yr?1e3:yr,wr=e.cameraIsFixed,xr=void 0!==wr&&wr,br=dr===pe?1:dr,Sr=ur===pe?1:ur,Pr=e.performanceMode,Ar=void 0!==Pr&&Pr,Er=e.opacityByDensityDebounceTime,Mr=void 0===Er?25:Er,Ir=e.spatialIndexUseWorker,Cr=void 0===Ir?undefined:Ir,Tr=Boolean(e.renderPointsAsSquares||Ar),Or=Boolean(e.disableAlphaBlending||Ar);Tn=it(be,ge)(Tn),a||(a=Ct({regl:e.regl,gamma:e.gamma})),S=wt(S,!0),W=wt(W,!0),Ln=wt(Ln,!0);var Rr,Br,Lr,Dr,zr,Nr,Fr,jr,kr,_r,Vr,Wr,Zr,Gr,Ur,Kr,qr,Hr,Yr=!1,Xr=!1,$r=xt(S),Jr=!1,Qr=null,eo=[0,0],no=-1,to=[],ro=new Set,oo=new Set,io=!1,ao=new Set,co=[],lo=0,so=0,uo=!1,fo=[],vo=e.aspectRatio||1,po=!1,ho=!0,mo=!1;zn=mt(zn)?h(zn):[zn],Fn=mt(Fn)?h(Fn):[Fn],kn=mt(kn)?h(kn):[kn],zn=zn.map(function(e){return wt(e,!0)}),Fn=Fn.map(function(e){return wt(e,!0)}),kn=kn.map(function(e){return wt(e,!0)}),Ht=!Array.isArray(Ht)&&Number.isNaN(+Ht)?zn[0][3]:Ht,Ht=tt(Ht,rt,{minLength:1})?h(Ht):[Ht];var yo,go,wo,xo,bo=1/(_t=tt(_t,rt,{minLength:1})?h(_t):[_t])[0];Zn="inherit"===Zn?h(zn):(Zn=mt(Zn)?h(Zn):[Zn]).map(function(e){return wt(e,!0)}),Un="inherit"===Un?h(Fn):(Un=mt(Un)?h(Un):[Un]).map(function(e){return wt(e,!0)}),qn="inherit"===qn?h(kn):(qn=mt(qn)?h(qn):[qn]).map(function(e){return wt(e,!0)}),Qn="inherit"===Qn?h(Ht):tt(Qn,rt,{minLength:1})?h(Qn):[Qn],ft="inherit"===ft?h(_t):tt(ft,rt,{minLength:1})?h(ft):[ft],B=Lt(B,tn),Xt=Lt(Xt,nn,{allowDensity:!0}),or=Lt(or,Je),Yn=Lt(Yn,ln,{allowSegment:!0,allowInherit:!0}),ct=Lt(ct,en,{allowSegment:!0}),Rt=Lt(Rt,Qe,{allowSegment:!0});var So,Po,Ao,Eo,Mo,Io,Co,To,Oo,Ro,Bo,Lo,Do=0,zo=0,No=null,Fo=null,jo=!1,ko=null,_o=Rn,Vo=0,Wo=0,Zo=!1,Go=!1,Uo=!1,Ko=!1,qo=Me,Ho=Me,Yo=!1,Xo=e.xScale||null,$o=e.yScale||null,Jo=0,Qo=0,ei=0,ni=0;Xo&&(Jo=Xo.domain()[0],Qo=Xo.domain()[1]-Xo.domain()[0],Xo.range([0,br])),$o&&(ei=$o.domain()[0],ni=$o.domain()[1]-$o.domain()[0],$o.range([Sr,0]));var ti=function(e){return e/br*2-1},ri=function(e){return 1+e/Sr*-2},oi=function(e,n){var r=[e,n,1,1];return D(r,r,O(t,R(t,Nr,R(t,Rr.view,jr)))),r.slice(0,2)},ii=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=da(),t=(Kr[1]-qr[1])/I.height;return(Gr*n+e)*t},ai=function(){return io?co.filter(function(e,n){return ao.has(n)}):co},ci=function(e,n,t,r){var o=Dr.range(e,n,t,r);return io?o.filter(function(e){return ao.has(e)}):o},li=function(){var e,n=p([ti(i[0]),ri(i[1])],2),t=n[0],r=n[1],o=p(oi(t,r),2),a=o[0],c=o[1],l=ii(4),u=l,f=-1,d=s(ci(a-l,c-l,a+l,c+l));try{for(d.s();!(e=d.n()).done;){var v=e.value,h=p(co[v],2),m=h[0],y=h[1],g=et(m,y,a,c);g<u&&(u=g,f=v)}}catch(e){d.e(e)}finally{d.f()}return f},si=function(e){var n,t,r,o,i,a=function(e){for(var n=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=0;i<e.length;i+=2)n=e[i]<n?e[i]:n,t=e[i]>t?e[i]:t,r=e[i+1]<r?e[i+1]:r,o=e[i+1]>o?e[i+1]:o;return[n,r,t,o]}(e);if(n=p(a,4),t=n[0],r=n[1],o=n[2],i=n[3],!(Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(i)&&o-t>0&&i-r>0))return[];var c,l=[],u=s(ci.apply(void 0,h(a)));try{for(u.s();!(c=u.n()).done;){var f=c.value;dt(e,co[f])&&l.push(f)}}catch(e){u.e(e)}finally{u.f()}return l},ui=function(){fo=[],Br&&Br.clear()},fi=function(e){return e&&e.length>4},di=function(e,n){if(!Vr&&Vn&&fi(co[e[0]])){var t,r=0===n,o=1===n?function(e){return oo.add(e)}:w,i=Object.keys(e.reduce(function(e,n){var t=co[n];return e[Array.isArray(t[4])?t[4][0]:t[4]]=!0,e},{})),a=kr.getData().opacities,c=i.filter(function(e){return!oo.has(+e)}),l=s(c);try{for(l.s();!(t=l.n()).done;){var u=t.value,f=_r[u][0],d=_r[u][2],v=4*f+2*_r[u][3],p=v+2*d+4;void 0===a.__original__&&(a.__original__=a.slice());for(var h=v;h<p;h++)a[h]=r?a.__original__[h]:st;o(u)}}catch(e){l.e(e)}finally{l.f()}kr.getBuffer().opacities.subdata(a,0)}},vi=function(e){return[e%Do/Do+zo,Math.floor(e/Do)/Do+zo]},pi=function(e){return io&&!ao.has(e)},hi=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;J===Ce&&ui(),to.length>0&&(t||n.publish("deselect"),oo.clear(),di(to,0),to=[],ro.clear(),ho=!0)},mi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.intersect,o=void 0!==r&&r,i=t.merge,a=void 0!==i&&i,c=t.remove,l=void 0!==c&&c,s=t.preventEvent,u=void 0!==s&&s,f=Array.isArray(e)?e:[e],d=h(to);if(o){var v=new Set(f);if(to=to.length>0?to.filter(function(e){return v.has(e)}):f,d.length===to.length)return void(ho=!0)}else if(a){if(to=((e,n)=>{const t=[];return e.forEach(e=>{t[e]=!0}),n.forEach(e=>{t[e]=!0}),t.reduce((e,n,t)=>(n&&e.push(t),e),[])})(to,f),d.length===to.length)return void(ho=!0)}else if(l){var p=new Set(f);if(to=to.filter(function(e){return!p.has(e)}),d.length===to.length)return void(ho=!0)}else{var m;if((null===(m=to)||void 0===m?void 0:m.length)>0&&di(to,0),d.length>0&&0===f.length)return void hi({preventEvent:u});to=f}if(x(d,to))ho=!0;else{var y=[];ro.clear(),oo.clear();for(var g=to.length-1;g>=0;g--){var w=to[g];w<0||w>=lo||pi(w)?to.splice(g,1):(ro.add(w),y.push.apply(y,vi(w)))}Po({usage:"dynamic",type:"float",data:y}),di(to,1),u||n.publish("select",{points:to,lassoMode:X}),ho=!0}},yi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.showReticleOnce,o=void 0!==r&&r,i=t.preventEvent,a=void 0!==i&&i,c=!1;if(!(io&&!ao.has(e))&&e>=0&&e<lo){c=!0;var l=Lo,s=e!==Lo;+l>=0&&s&&!ro.has(l)&&di([l],0),Lo=e,Ao.subdata(vi(e)),ro.has(e)||di([e],2),s&&!a&&n.publish("pointover",Lo)}else(c=+Lo>=0)&&(ro.has(Lo)||di([Lo],0),a||n.publish("pointout",Lo)),Lo=void 0;c&&(ho=!0,mo=o)},gi=function(e){var n=I.getBoundingClientRect();return i[0]=e.clientX-n.left,i[1]=e.clientY-n.top,[].concat(i)},wi=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.intersect,i=void 0!==o&&o,a=r.merge,c=void 0!==a&&a,l=r.remove,s=void 0!==l&&l;Rr.config({isFixed:xr}),fo=h(e);var u=si(t);mi(u,{intersect:i,merge:c,remove:s}),n.publish("lassoEnd",{coordinates:fo}),J===Te&&ui()},xi=Xn(I,{onStart:function(){Rr.config({isFixed:!0}),Jr=!0,uo=!0,ui(),no>=0&&(clearTimeout(no),no=-1),n.publish("lassoStart")},onDraw:function(e,t){fo=e,Br.setPoints(t),n.publish("lassoExtend",{coordinates:e})},onEnd:wi,enableInitiator:ee,initiatorParentElement:te,longPressIndicatorParentElement:oe,pointNorm:function(e){var n=p(e,2),t=n[0],r=n[1];return oi(ti(t),ri(r))},minDelay:K,minDist:"brush"===yn?Math.max(3,H):H,type:yn}),bi=function(e,n){switch(In[n]){case Ze:return e.altKey;case Ge:return e.metaKey;case Ue:return e.ctrlKey;case Ke:return e.metaKey;case qe:return e.shiftKey;default:return!1}},Si=function(e){Go&&1===e.buttons&&(Jr=!0,Qr=performance.now(),eo=gi(e),!(uo=Tn===we||bi(e,je))&&ae&&(xi.showLongPressIndicator(e.clientX,e.clientY,{time:le,extraTime:ue,delay:ve}),no=setTimeout(function(){no=-1,uo=!0},le)))},Pi=function(e){if(Go){if(Jr=!1,no>=0&&(clearTimeout(no),no=-1),uo){e.preventDefault(),uo=!1;var n=!!X;xi.end({intersect:n?"intersect"===X:bi(e,Fe),merge:n?"merge"===X:bi(e,_e),remove:n?"remove"===X:bi(e,Ve)})}ae&&xi.hideLongPressIndicator({time:ye})}},Ai=function(e){if(Go){e.preventDefault();var n=gi(e);if(!(et.apply(void 0,h(n).concat(h(eo)))>=H)){var t=performance.now()-Qr;if(!ee||t<500){var r=li();r>=0?(to.length>0&&J===Ce&&ui(),mi([r],{merge:bi(e,_e),remove:bi(e,Ve)})):Ur||(Ur=setTimeout(function(){Ur=null,xi.showInitiator(e)},200))}}}},Ei=function(e){xi.hideInitiator(),Ur&&(clearTimeout(Ur),Ur=null),N&&(e.preventDefault(),hi())},Mi=function(e){if(Ko||(Yo=function(e){return document.elementsFromPoint(e.clientX,e.clientY).some(function(e){return e===I})}(e),Ko=!0),Go&&(Yo||Jr)){var n=gi(e),t=et.apply(void 0,h(n).concat(h(eo)))>=H;Yo&&!uo&&yi(li()),uo?(e.preventDefault(),xi.extend(e,!0)):Jr&&ae&&t&&xi.hideLongPressIndicator({time:ye}),no>=0&&t&&(clearTimeout(no),no=-1),Jr&&(ho=!0)}},Ii=function(){Lo=void 0,Yo=!1,Ko=!1,Go&&(+Lo>=0&&!ro.has(Lo)&&di([Lo],0),Pi(),ho=!0)},Ci=function(){var e=Math.max(_t.length,Ht.length);Wo=Math.max(2,Math.ceil(Math.sqrt(e)));for(var n=new Float32Array(4*Math.pow(Wo,2)),t=0;t<e;t++){n[4*t]=_t[t]||0,n[4*t+1]=Math.min(1,Ht[t]||0);var r=Number((Fn[t]||Fn[0])[3]);n[4*t+2]=Math.min(1,Number.isNaN(r)?1:r);var o=Number((kn[t]||kn[0])[3]);n[4*t+3]=Math.min(1,Number.isNaN(o)?1:o)}return a.regl.texture({data:n,shape:[Wo,Wo,4],type:"float"})},Ti=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zn,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fn,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:kn,r=e.length,o=n.length,i=t.length,a=[];if(r===o&&o===i)for(var c=0;c<r;c++)a.push(e[c],n[c],t[c],S);else for(var l=0;l<r;l++){var s=[e[l][0],e[l][1],e[l][2],1],u=B===tn?n[0]:s,f=B===tn?t[0]:s;a.push(e[l],u,f,S)}return a},Oi=function(){var e=Ti(),n=e.length;Vo=Math.max(2,Math.ceil(Math.sqrt(n)));var t=new Float32Array(4*Math.pow(Vo,2));return e.forEach(function(e,n){t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]}),a.regl.texture({data:t,shape:[Vo,Vo,4],type:"float"})},Ri=function(){Nr=L([],[1/(zr=br/Sr),1,1]),Fr=L([],[1/zr,1,1]),jr=L([],[vo,1,1])},Bi=function(e,n){return function(t){if(t&&0!==t.length){var r=h(e()),o=mt(t)?t:[t];if(o=o.map(function(e){return wt(e,!0)}),i=r,a=o,!(Array.isArray(i)&&Array.isArray(a)&&i.length===a.length&&(0===i.length||Array.isArray(i[0])&&Array.isArray(a[0])&&i.every(function(e,n){var t=p(e,4),r=t[0],o=t[1],i=t[2],c=t[3],l=p(a[n],4),s=l[0],u=l[1],f=l[2],d=l[3];return r===s&&o===u&&i===f&&c===d})))){var i,a;Ro&&Ro.destroy();try{n(o),Ro=Oi()}catch(e){console.error("Invalid colors. Switching back to default colors."),n(r),Ro=Oi()}}}}},Li=Bi(function(){return zn},function(e){zn=e}),Di=Bi(function(){return Fn},function(e){Fn=e}),zi=Bi(function(){return kn},function(e){kn=e}),Ni=function(){if(Xo||$o){var e,n,t,r,o,i,a=p((e=oi(-1,-1),n=oi(1,1),t=(e[0]+1)/2,r=(n[0]+1)/2,o=(e[1]+1)/2,i=(n[1]+1)/2,[[Jo+t*Qo,Jo+r*Qo],[ei+o*ni,ei+i*ni]]),2),c=a[0],l=a[1];Xo&&Xo.domain(c),$o&&$o.domain(l)}},Fi=function(e,n){Sr=Math.max(1,e),I.height=Math.floor(Sr*window.devicePixelRatio),$o&&($o.range([Sr,0]),n||Ni())},ji=function(e){if(e===pe)return ur=e,I.style.height="100%",void window.requestAnimationFrame(function(){I&&Fi(I.getBoundingClientRect().height)});!+e||+e<=0||(Fi(ur=+e),I.style.height="".concat(ur,"px"))},ki=function(){Gr=Gt,Gt===pe&&(Gr=Array.isArray(_t)?_t.reduce((e,n)=>n>e?n:e,Number.NEGATIVE_INFINITY):_t)},_i=function(e){var n=Array.isArray(_t)?h(_t):_t;tt(e,rt,{minLength:1})?_t=h(e):ot(+e)&&(_t=[+e]),n===_t||x(n,_t)||(Bo&&Bo.destroy(),bo=1/_t[0],Bo=Ci(),ki())},Vi=function(e,n){br=Math.max(1,e),I.width=Math.floor(br*window.devicePixelRatio),Xo&&(Xo.range([0,br]),n||Ni())},Wi=function(e){if(e===pe)return dr=e,I.style.width="100%",void window.requestAnimationFrame(function(){I&&Vi(I.getBoundingClientRect().width)});!+e||+e<=0||(Vi(dr=+e),I.style.width="".concat(br,"px"))},Zi=function(e){switch(e){case"valueZ":return qo;case"valueW":return Ho;default:return null}},Gi=function(e,n){return e===Ee?function(e){return Math.round(e*(n.length-1))}:w},Ui=function(){return v},Ki=function(){return[I.width,I.height]},qi=function(){return Ro},Hi=function(){return Vo},Yi=function(){return.5/Vo},Xi=function(){return window.devicePixelRatio},$i=function(){return Po},Ji=function(){return Bo},Qi=function(){return Wo},ea=function(){return.5/Wo},na=function(){return 0},ta=function(){return wo||yo},ra=function(){return Do},oa=function(){return.5/Do},ia=function(){return Fr},aa=function(){return Rr.view},ca=function(){return jr},la=function(){return R(r,Fr,R(r,Rr.view,jr))},sa=function(){return window.devicePixelRatio},ua=function(){return yt(bo,Rr.scaling[0])*window.devicePixelRatio},fa=function(){return Rr.scaling[0]>1?Math.asinh(yt(1,Rr.scaling[0]))/Math.asinh(1)*window.devicePixelRatio:yt(bo,Rr.scaling[0])*window.devicePixelRatio},da=fa;"linear"===lr?da=ua:"constant"===lr&&(da=sa);var va=function(){return io?ao.size:lo},pa=function(){return to.length},ha=function(){return pa()>0?er:1},ma=function(){return pa()>0?tr:1},ya=function(){return+("valueZ"===B)},ga=function(){return+("valueW"===B)},wa=function(){return+("valueZ"===Xt)},xa=function(){return+("valueW"===Xt)},ba=function(){return+("density"===Xt)},Sa=function(){return+("valueZ"===or)},Pa=function(){return+("valueW"===or)},Aa=function(){return+y},Ea=function(){return"valueZ"===B?qo===Ee?zn.length-1:1:Ho===Ee?zn.length-1:1},Ma=function(){return"valueZ"===Xt?qo===Ee?Ht.length-1:1:Ho===Ee?Ht.length-1:1},Ia=function(){return"valueZ"===or?qo===Ee?_t.length-1:1:Ho===Ee?_t.length-1:1},Ca=function(e){if("density"!==Xt)return 1;var n=da(),t=_t[0]*n,r=2/(2/Rr.view[0])*(2/(2/Rr.view[5])),o=e.viewportHeight,i=e.viewportWidth,a=Jt*i*o/(so*t*t)*gt(1,r);a*=Tr?1:1/(.25*Math.PI);var c=yt(1,t)+.5;return a*=Math.pow(t/c,2),gt(1,yt(0,a))},Ta=a.regl({framebuffer:function(){return xo},vert:"precision highp float;\n\nattribute vec2 position;\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // map normalized device coords to texture coords\n particleTextureIndex = 0.5 * (1.0 + position);\n\n gl_Position = vec4(position, 0, 1);\n}",frag:"precision highp float;\n\nuniform sampler2D startStateTex;\nuniform sampler2D endStateTex;\nuniform float t;\n\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // Interpolate x, y, and value\n vec3 start = texture2D(startStateTex, particleTextureIndex).xyw;\n vec3 end = texture2D(endStateTex, particleTextureIndex).xyw;\n vec3 curr = start * (1.0 - t) + end * t;\n\n // The category cannot be interpolated\n float endCategory = texture2D(endStateTex, particleTextureIndex).z;\n\n gl_FragColor = vec4(curr.xy, endCategory, curr.z);\n}",attributes:{position:[-4,0,4,4,4,-4]},uniforms:{startStateTex:function(){return go},endStateTex:function(){return yo},t:function(e,n){return n.t}},count:3}),Oa=function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ha,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:ma;return a.regl({frag:Tr?"precision highp float;\n\nvarying vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n":"\nprecision highp float;\n\nuniform float antiAliasing;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nvoid main() {\n vec2 c = gl_PointCoord * 2.0 - 1.0;\n float sdf = length(c) * finalPointSize;\n float alpha = linearstep(finalPointSize + antiAliasing, finalPointSize - antiAliasing, sdf);\n\n gl_FragColor = vec4(color.rgb, alpha * color.a);\n}\n",vert:$n(r),blend:{enable:!Or,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},attributes:{stateIndex:{buffer:t,size:2}},uniforms:{antiAliasing:Ui,resolution:Ki,modelViewProjection:la,devicePixelRatio:Xi,pointScale:function(){return da()},encodingTex:Ji,encodingTexRes:Qi,encodingTexEps:ea,pointOpacityMax:o,pointOpacityScale:i,pointSizeExtra:e,globalState:r,colorTex:qi,colorTexRes:Hi,colorTexEps:Yi,stateTex:ta,stateTexRes:ra,stateTexEps:oa,isColoredByZ:ya,isColoredByW:ga,isOpacityByZ:wa,isOpacityByW:xa,isOpacityByDensity:ba,isSizedByZ:Sa,isSizedByW:Pa,isPixelAligned:Aa,colorMultiplicator:Ea,opacityMultiplicator:Ma,opacityDensity:Ca,sizeMultiplicator:Ia,numColorStates:4,drawingBufferWidth:function(e){return e.drawingBufferWidth},drawingBufferHeight:function(e){return e.drawingBufferHeight}},count:n,primitive:"points"})},Ra=Oa(na,va,function(){return So}),Ba=Oa(na,function(){return 1},function(){return Ao},2,function(){return 1},function(){return 1}),La=Oa(function(){return(Wt+2*Kt)*window.devicePixelRatio},pa,$i,1,function(){return 1},function(){return 1}),Da=Oa(function(){return(Wt+Kt)*window.devicePixelRatio},pa,$i,3,function(){return 1},function(){return 1}),za=Oa(function(){return Wt*window.devicePixelRatio},pa,$i,1,function(){return 1},function(){return 1}),Na=a.regl({frag:"\nprecision mediump float;\n\nuniform sampler2D texture;\n\nvarying vec2 uv;\n\nvoid main () {\n gl_FragColor = texture2D(texture, uv);\n}\n",vert:"\nprecision mediump float;\n\nuniform mat4 modelViewProjection;\n\nattribute vec2 position;\n\nvarying vec2 uv;\n\nvoid main () {\n uv = position;\n gl_Position = modelViewProjection * vec4(-1.0 + 2.0 * uv.x, 1.0 - 2.0 * uv.y, 0, 1);\n}\n",attributes:{position:[0,1,0,0,1,0,0,1,1,1,1,0]},uniforms:{modelViewProjection:la,texture:function(){return A}},count:6}),Fa=a.regl({vert:"\n precision mediump float;\n uniform mat4 modelViewProjection;\n attribute vec2 position;\n void main () {\n gl_Position = modelViewProjection * vec4(position, 0, 1);\n }",frag:"\n precision mediump float;\n uniform vec4 color;\n void main () {\n gl_FragColor = vec4(color.rgb, 0.2);\n }",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},attributes:{position:function(){return fo}},uniforms:{modelViewProjection:la,color:function(){return W}},elements:function(){return k(Br.getPoints())}}),ja=function(){if(null===ar)return No=null,void(Fo=null);for(var e=new Set,n=[],t=0;t<ar.length;t++){var r=ar[t];Number.isFinite(r)&&r>=0&&r<lo&&!e.has(r)&&(n.push(r),e.add(r))}for(var o=0;o<lo;o++)e.has(o)||n.push(o);No=n,Fo=new Float32Array(2*n.length);for(var i=0,a=0;a<n.length;a++){var c=vi(n[a]);Fo[i]=c[0],Fo[i+1]=c[1],i+=2}},ka=function(e){return null!==Fo?Fo:function(e){for(var n=new Float32Array(2*e),t=0,r=0;r<e;++r){var o=vi(r);n[t]=o[0],n[t+1]=o[1],t+=2}return n}(e)},_a=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.length;Do=Math.max(2,Math.ceil(Math.sqrt(t))),zo=.5/Do;for(var r=new Float32Array(4*Math.pow(Do,2)),o=!0,i=!0,c=0,l=0,s=0,u=0;u<t;++u)r[c=4*u]=e[u][0],r[c+1]=e[u][1],l=e[u][2]||0,s=e[u][3]||0,r[c+2]=l,r[c+3]=s,o&&(o=Number.isInteger(l)),i&&(i=Number.isInteger(s));return qo=n.z&&Ie.includes(n.z)?n.z:o?Me:Ee,Ho=n.w&&Ie.includes(n.w)?n.w:i?Me:Ee,a.regl.texture({data:r,shape:[Do,Do,4],type:"float"})},Va=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(t){Go=!1;var r=(null==n?void 0:n.preventFilterReset)&&e.length===lo,o=lo;lo=e.length,so=lo,o>0&&lo!==o&&(ar=null,No=null,Fo=null),yo&&yo.destroy(),yo=_a(e,{z:n.zDataType,w:n.wDataType}),r||(ja(),So({usage:"static",type:"float",data:ka(lo)})),En(n.spatialIndex||e,{useWorker:Cr}).then(function(n){Dr=n,co=e,Go=!0}).then(t)})},Wa=function(e,n){Eo=Rr.target,Mo=e,Io=Rr.distance[0],Co=n},Za=function(e){var n="inherit"===Yn?B:Yn;if("segment"===n){var t=Zn.length-1;return t<1?[]:e.reduce(function(e,n,r){for(var o=0,i=[],a=2;a<n.length;a+=2){var c=Math.sqrt(Math.pow(n[a-2]-n[a],2)+Math.pow(n[a-1]-n[a+1],2));i.push(c),o+=c}e[r]=[0];for(var l=0,s=0;s<n.length/2-1;s++)l+=i[s],e[r].push(4*Math.floor(l/o*t));return e},[])}if(n){var r=Dt(n),o=Gi(Zi(n),"inherit"===Yn?zn:Zn);return _r.reduce(function(e,n){var t=p(n,2),i=t[0],a=t[1];return e[i]=4*o(a[r]),e},[])}return new Array(_r.length).fill(0)},Ga=function(){var e="inherit"===ct?Xt:ct;if("segment"===e){var n=Qn.length-1;return n<1?[]:_r.reduce(function(e,t){var r=p(t,3),o=r[0];r[1];var i=r[2];return e[o]=b(i,function(e){return Qn[Math.floor(e/(i-1)*n)]}),e},[])}if(e){var t=Dt(e),r="inherit"===ct?Ht:Qn,o=Gi(Zi(e),r);return _r.reduce(function(e,n){var i=p(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e},[])}},Ua=function(){var e="inherit"===Rt?or:Rt;if("segment"===e){var n=ft.length-1;return n<1?[]:_r.reduce(function(e,t){var r=p(t,3),o=r[0];r[1];var i=r[2];return e[o]=b(i,function(e){return ft[Math.floor(e/(i-1)*n)]}),e},[])}if(e){var t=Dt(e),r="inherit"===Rt?_t:ft,o=Gi(Zi(e),r);return _r.reduce(function(e,n){var i=p(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e},[])}},Ka=function(e){return new Promise(function(n){kr.setPoints([]),(null==e?void 0:e.length)>0?(Vr=!0,Ot(e,{maxIntPointsPerSegment:Nt,tolerance:jt}).then(function(e){!function(e){_r=[];var n=0;Object.keys(e).forEach(function(t,r){_r[t]=[r,e[t].reference,e[t].length/2,n],n+=e[t].length/2})}(e);var t=Object.values(e);kr.setPoints(1===t.length?t[0]:t,{colorIndices:Za(t),opacities:Ga(),widths:Ua()}),Vr=!1,n()})):n()})},qa=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,r=void 0!==t&&t;io=!0,ao.clear();var o,i,a=Array.isArray(e)?e:[e],c=[],l=[],u=[],f=s(a);try{for(f.s();!(o=f.n()).done;){var d=o.value;!Number.isFinite(d)||d<0||d>=lo||(c.push(d),ao.add(d),ro.has(d)&&u.push(d))}}catch(e){f.e(e)}finally{f.f()}if(null!==No){i=[];for(var v=0;v<No.length;v++)ao.has(No[v])&&i.push(No[v])}else i=It([].concat(c));var p,h=s(i);try{for(h.s();!(p=h.n()).done;){var m=p.value;l.push.apply(l,vi(m))}}catch(e){h.e(e)}finally{h.f()}return So.subdata(l),mi(u,{preventEvent:r}),ao.has(Lo)||yi(-1,{preventEvent:r}),new Promise(function(e){var t=function(){n.subscribe("draw",function(){r||n.publish("filter",{points:c}),e()},1),ho=!0};Vn||fi(co[0])?Ka(ai()).then(function(){r||n.publish("pointConnectionsDraw"),mi(u,{preventEvent:r}),t()}):t()})},Ha=function(){return ci(qr[0],qr[1],Kr[0],Kr[1])},Ya=E(function(){so=Ha().length},Mr),Xa=function(){return Boolean(go&&wo)},$a=function(){return Boolean(void 0!==Eo&&void 0!==Mo&&void 0!==Io&&void 0!==Co)},Ja=function(e,n){ko||(ko=performance.now());var t,r,o,i=performance.now()-ko,a=(t=n(i/e),r=0,o=1,Math.min(o,Math.max(r,t)));return Xa()&&Ta({t:a}),$a()&&function(e){var n=p(Eo,2),t=n[0],r=n[1],o=p(Mo,2),i=1-e,a=t*i+o[0]*e,c=r*i+o[1]*e,l=Io*i+Co*e;Rr.lookAt([a,c],l)}(a),i<e},Qa=function(){jo=!1,ko=null,To=void 0,Oo=void 0,Rn=_o,go&&(go.destroy(),go=void 0),wo&&(wo.destroy(),wo=void 0),Eo=void 0,Mo=void 0,Io=void 0,Co=void 0,n.publish("transitionEnd")},ec=function(e){var t=e.duration,r=void 0===t?500:t,o=e.easing,i=void 0===o?Ae:o;jo&&n.publish("transitionEnd"),jo=!0,ko=null,To=r,Oo=vt(i)?Pe[i]||Ae:i,_o=Rn,Rn=!1,n.publish("transitionStart")},nc=function(e){return Xr?Promise.reject(new bn):(Uo=!1,0===e.length?new Promise(function(e){Lr.clear(),n.subscribe("draw",e,1),Uo=!0,ho=!0}):new Promise(function(t){var r,o=[],i=new Map,a=[],c=[],l=-1,u=function(e){c.push(e.lineWidth||mr);var n=wt(e.lineColor||pr,!0),t="[".concat(n.join(","),"]");if(i.has(t)){var r=i.get(t).idx;a.push(r)}else{var o=++l;i.set(t,{idx:o,color:n}),a.push(o)}},f=s(e);try{for(f.s();!(r=f.n()).done;){var d,v,p,h,m=r.value;if(St(m))o.push([null!==(d=m.x1)&&void 0!==d?d:-gr,m.y,null!==(v=m.x2)&&void 0!==v?v:gr,m.y]),u(m);else if(Pt(m))o.push([m.x,null!==(p=m.y1)&&void 0!==p?p:-gr,m.x,null!==(h=m.y2)&&void 0!==h?h:gr]),u(m);else Et(m)?(o.push([m.x1,m.y1,m.x2,m.y1,m.x2,m.y2,m.x1,m.y2,m.x1,m.y1]),u(m)):At(m)?(o.push([m.x,m.y,m.x+m.width,m.y,m.x+m.width,m.y+m.height,m.x,m.y+m.height,m.x,m.y]),u(m)):Mt(m)&&(o.push(m.vertices.flatMap(w)),u(m))}}catch(e){f.e(e)}finally{f.f()}Lr.setStyle({color:Array.from(i.values()).sort(function(e,n){return e.idx>n.idx?1:-1}).map(function(e){return e.color})}),Lr.setPoints(1===o.length?o.flat():o,{colorIndices:a,widths:c}),n.subscribe("draw",t,1),Uo=!0,ho=!0}))},tc=function(e){return function(){var t=e.apply(void 0,arguments);return ho=!0,new Promise(function(e){n.subscribe("draw",function(){return e(t)},1)})}},rc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(r){var o=D([],[e.x+e.width/2,e.y+e.height/2,0,0],jr).slice(0,2),i=2*Math.atan(1),a=zr/vo,c=e.height*a>=e.width?e.height/2/Math.tan(i/2):e.width/2/Math.tan(i/2)/a;t.transition?(Rr.config({isFixed:!0}),Wa(o,c),n.subscribe("transitionEnd",function(){r(),Rr.config({isFixed:xr})},1),ec({duration:t.transitionDuration,easing:t.transitionEasing})):(Rr.lookAt(o,c),n.subscribe("draw",r,1),ho=!0)})},oc=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(o){r.transition?(Rr.config({isFixed:!0}),Wa(e,t),n.subscribe("transitionEnd",function(){o(),Rr.config({isFixed:xr})},1),ec({duration:r.transitionDuration,easing:r.transitionEasing})):(Rr.lookAt(e,t),n.subscribe("draw",o,1),ho=!0)})},ic=function(){kr.setStyle({color:Ti(Zn,Un,qn),opacity:null===Qn?null:Qn[0],width:ft[0]})},ac=function(){var e=Math.round($r)>.5?0:255;xi.initiator.style.border="1px dashed rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.33)"),xi.initiator.style.background="rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.1)")},cc=function(){var e=Math.round($r)>.5?0:255;xi.longPressIndicator.style.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")"),xi.longPressIndicator.dataset.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")");var n=W.map(function(e){return Math.round(255*e)});xi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")},lc=function(e){e&&Rr.setView(e)},sc=function(e){(In=Object.entries(e).reduce(function(e,n){var t=p(n,2),r=t[0],o=t[1];return He.includes(o)&&We.includes(r)&&(e[r]=o),e},{}))[ke]?Rr.config({isRotate:!0,mouseDownMoveModKey:In[ke]}):Rr.config({isRotate:!1})},uc=function(e,n){return function(t){if("inherit"===t)e(h(n()));else{var r=mt(t)?t:[t];e(r.map(function(e){return wt(e,!0)}))}ic()}},fc=uc(function(e){Zn=e},function(){return zn}),dc=uc(function(e){Un=e},function(){return Fn}),vc=uc(function(e){qn=e},function(){return kn}),pc=function(e){v=Number(e)||.5},hc=function(e){y=Boolean(e)},mc=function(){var e,t,r,o,i,c,l,u,f,d,v,p,m,y,g,w,b,P,E,M,C,T,O,R,L,D,z,F,j,k,V,Z,U,q,Y,$,Q,ne,re,ie,ce,se,fe,de,pe,he,me=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Xr?Promise.reject(new Error(bn)):(Bt(me),void 0===me.backgroundColor&&void 0===me.background||(e=me.backgroundColor||me.background)&&(S=wt(e,!0),$r=xt(S),ac(),cc()),void 0!==me.backgroundImage&&((t=me.backgroundImage)?vt(t)?at(a.regl,t).then(function(e){A=e,ho=!0,n.publish("backgroundImageReady")}).catch(function(){console.error("Count not create texture from ".concat(t)),A=null}):A="texture2d"===t._reglType?t:null:A=null),void 0!==me.cameraTarget&&(r=me.cameraTarget)&&Rr.lookAt(r,Rr.distance[0],Rr.rotation),void 0!==me.cameraDistance&&(o=me.cameraDistance)>0&&Rr.lookAt(Rr.target,o,Rr.rotation),void 0!==me.cameraRotation&&null!==(i=me.cameraRotation)&&Rr.lookAt(Rr.target,Rr.distance[0],i),void 0!==me.cameraView&&lc(me.cameraView),void 0!==me.cameraIsFixed&&(c=me.cameraIsFixed,xr=Boolean(c),Rr.config({isFixed:xr})),void 0!==me.colorBy&&(l=me.colorBy,B=Lt(l,tn)),void 0!==me.pointColor&&Li(me.pointColor),void 0!==me.pointColorActive&&Di(me.pointColorActive),void 0!==me.pointColorHover&&zi(me.pointColorHover),void 0!==me.pointSize&&_i(me.pointSize),void 0!==me.pointSizeSelected&&(!+(u=me.pointSizeSelected)||+u<0||(Wt=+u)),void 0!==me.pointSizeMouseDetection&&(f=me.pointSizeMouseDetection,Gt=f,ki()),void 0!==me.sizeBy&&function(e){or=Lt(e,Je)}(me.sizeBy),void 0!==me.pointOrder&&function(e){if(null==e)ar=null;else{if(!Array.isArray(e)&&!ArrayBuffer.isView(e))return;ar=e}if(Go)if(ja(),io){var n=[];if(null!==No)for(var t=0;t<No.length;t++)ao.has(No[t])&&n.push.apply(n,vi(No[t]));else{var r,o=s(It(h(ao)));try{for(o.s();!(r=o.n()).done;){var i=r.value;n.push.apply(n,vi(i))}}catch(e){o.e(e)}finally{o.f()}}So.subdata(n)}else So.subdata(ka(lo))}(me.pointOrder),void 0!==me.opacity&&(d=me.opacity,v=Array.isArray(Ht)?h(Ht):Ht,tt(d,rt,{minLength:1})?Ht=h(d):ot(+d)&&(Ht=[+d]),v===Ht||x(v,Ht)||(Bo&&Bo.destroy(),Bo=Ci())),void 0!==me.showPointConnections&&(p=me.showPointConnections,(Vn=!!p)?Go&&fi(co[0])&&Ka(ai()).then(function(){n.publish("pointConnectionsDraw"),ho=!0}):Ka()),void 0!==me.pointConnectionColor&&fc(me.pointConnectionColor),void 0!==me.pointConnectionColorActive&&dc(me.pointConnectionColorActive),void 0!==me.pointConnectionColorHover&&vc(me.pointConnectionColorHover),void 0!==me.pointConnectionColorBy&&function(e){Yn=Lt(e,ln,{allowSegment:!0,allowInherit:!0})}(me.pointConnectionColorBy),void 0!==me.pointConnectionOpacityBy&&function(e){ct=Lt(e,en,{allowSegment:!0})}(me.pointConnectionOpacityBy),void 0!==me.pointConnectionOpacity&&function(e){tt(e,rt,{minLength:1})&&(Qn=h(e)),ot(+e)&&(Qn=[+e]),Zn=Zn.map(function(e){return e[3]=Number.isNaN(+Qn[0])?e[3]:+Qn[0],e}),ic()}(me.pointConnectionOpacity),void 0!==me.pointConnectionOpacityActive&&function(e){!Number.isNaN(+e)&&+e&&(st=+e)}(me.pointConnectionOpacityActive),void 0!==me.pointConnectionSize&&(m=me.pointConnectionSize,tt(m,rt,{minLength:1})&&(ft=h(m)),ot(+m)&&(ft=[+m]),ic()),void 0!==me.pointConnectionSizeActive&&(y=me.pointConnectionSizeActive,!Number.isNaN(+y)&&+y&&(ht=Math.max(0,y))),void 0!==me.pointConnectionSizeBy&&function(e){Rt=Lt(e,Qe,{allowSegment:!0})}(me.pointConnectionSizeBy),void 0!==me.pointConnectionMaxIntPointsPerSegment&&(g=me.pointConnectionMaxIntPointsPerSegment,Nt=Math.max(0,g)),void 0!==me.pointConnectionTolerance&&(w=me.pointConnectionTolerance,jt=Math.max(0,w)),void 0!==me.pointScaleMode&&function(e){switch(e){case"linear":lr=e,da=ua;break;case"constant":lr=e,da=sa;break;default:lr="asinh",da=fa}}(me.pointScaleMode),void 0!==me.opacityBy&&function(e){Xt=Lt(e,nn,{allowDensity:!0})}(me.opacityBy),void 0!==me.lassoColor&&function(e){if(e){W=wt(e,!0),Br.setStyle({color:W});var n=W.map(function(e){return Math.round(255*e)});xi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")}}(me.lassoColor),void 0!==me.lassoLineWidth&&(b=me.lassoLineWidth,Number.isNaN(+b)||+b<1||(G=+b,Br.setStyle({width:G}))),void 0!==me.lassoMinDelay&&+(P=me.lassoMinDelay)&&(K=+P,xi.set({minDelay:K})),void 0!==me.lassoMinDist&&+(E=me.lassoMinDist)&&(H=+E,xi.set({minDist:H})),void 0!==me.lassoClearEvent&&(M=me.lassoClearEvent,J=it(Oe,J)(M)),void 0!==me.lassoInitiator&&(C=me.lassoInitiator,ee=Boolean(C),xi.set({enableInitiator:ee})),void 0!==me.lassoInitiatorParentElement&&(T=me.lassoInitiatorParentElement,te=T,xi.set({initiatorParentElement:te})),void 0!==me.lassoLongPressIndicatorParentElement&&(O=me.lassoLongPressIndicatorParentElement,oe=O,xi.set({longPressIndicatorParentElement:oe})),void 0!==me.lassoOnLongPress&&(R=me.lassoOnLongPress,ae=Boolean(R)),void 0!==me.lassoLongPressTime&&(L=me.lassoLongPressTime,le=Number(L)),void 0!==me.lassoLongPressAfterEffectTime&&(D=me.lassoLongPressAfterEffectTime,ue=Number(D)),void 0!==me.lassoLongPressEffectDelay&&(z=me.lassoLongPressEffectDelay,ve=Number(z)),void 0!==me.lassoLongPressRevertEffectTime&&function(e){ye=Number(e)}(me.lassoLongPressRevertEffectTime),void 0!==me.lassoType&&("brush"===(F=me.lassoType)?xi.set({type:F,minDist:Math.max(3,H)}):xi.set({type:F,minDist:H}),yn=xi.get("type")),void 0!==me.lassoMode&&(j=me.lassoMode,X=j),void 0!==me.lassoBrushSize&&(k=me.lassoBrushSize,Pn=Number(k)||Pn,xi.set({brushSize:Pn})),void 0!==me.actionKeyMap&&sc(me.actionKeyMap),void 0!==me.mouseMode&&(V=me.mouseMode,Tn=it(be,ge)(V),Rr.config({defaultMouseDownMoveAction:Tn===xe?"rotate":"pan"})),void 0!==me.showReticle&&null!==(Z=me.showReticle)&&(Rn=Z),void 0!==me.reticleColor&&(U=me.reticleColor)&&(Ln=wt(U,!0),Wr.setStyle({color:Ln}),Zr.setStyle({color:Ln})),void 0!==me.pointOutlineWidth&&(!+(q=me.pointOutlineWidth)||+q<0||(Kt=+q)),void 0!==me.height&&ji(me.height),void 0!==me.width&&Wi(me.width),void 0!==me.aspectRatio&&(+(Y=me.aspectRatio)<=0||(vo=Y)),void 0!==me.xScale&&($=me.xScale)&&(Xo=$,Jo=$.domain()[0],Qo=$?$.domain()[1]-$.domain()[0]:0,Xo.range([0,br]),Ni()),void 0!==me.yScale&&(Q=me.yScale)&&(ei=($o=Q).domain()[0],ni=$o?$o.domain()[1]-$o.domain()[0]:0,$o.range([Sr,0]),Ni()),void 0!==me.deselectOnDblClick&&(ne=me.deselectOnDblClick,N=!!ne),void 0!==me.deselectOnEscape&&(re=me.deselectOnEscape,_=!!re),void 0!==me.opacityByDensityFill&&(ie=me.opacityByDensityFill,Jt=+ie),void 0!==me.opacityInactiveMax&&(ce=me.opacityInactiveMax,er=+ce),void 0!==me.opacityInactiveScale&&(se=me.opacityInactiveScale,tr=+se),void 0!==me.gamma&&(fe=me.gamma,a.gamma=fe),void 0!==me.annotationLineColor&&(de=me.annotationLineColor,pr=wt(de)),void 0!==me.annotationLineWidth&&(pe=me.annotationLineWidth,mr=+pe),void 0!==me.annotationHVLineLimit&&(he=me.annotationHVLineLimit,gr=+he),void 0!==me.antiAliasing&&pc(me.antiAliasing),void 0!==me.pixelAligned&&hc(me.pixelAligned),new Promise(function(e){window.requestAnimationFrame(function(){!Xr&&I&&(Ri(),Rr.refresh(),a.refresh(),Ic(),e())})}))},yc=function(){Rr||(Rr=j(I,{isFixed:xr,isPanInverted:[!1,!0],defaultMouseDownMoveAction:Tn===xe?"rotate":"pan"})),e.cameraView?Rr.setView(T(e.cameraView)):e.cameraTarget||e.cameraDistance||e.cameraRotation?Rr.lookAt(h(e.cameraTarget||vn),e.cameraDistance||1,e.cameraRotation||0):Rr.setView(T(pn)),Kr=oi(1,1),qr=oi(-1,-1)},gc=function(e){if("Escape"===e.key)_&&hi()},wc=function(){Yo=!0,Ko=!0},xc=function(){yi(),Yo=!1,Ko=!0,ho=!0},bc=function(){ho=!0},Sc=function(){Va([]),kr.clear()},Pc=function(){nc([])},Ac=function(){var e=dr===pe,n=ur===pe;if(e||n){var t=I.getBoundingClientRect(),r=t.width,o=t.height;e&&Vi(r,!0),n&&Fi(o,!0),Ri(),Ni(),ho=!0}Rr.refresh()},Ec=function(){var e,t=(e=d().m(function e(t){var r,o,i,c,l,s,u,f,p,h,m,g,w;return d().w(function(e){for(;;)switch(e.n){case 0:return I.style.userSelect="none",r=window.devicePixelRatio,o=_t,i=dr,c=ur,l=a.canvas.width/r,s=a.canvas.height/r,u=y,f=v,p=(null==t?void 0:t.scale)||1,h=Array.isArray(_t)?_t.map(function(e){return e*p}):_t*p,m=br*p,g=Sr*p,_i(h),Wi(m),ji(g),hc((null==t?void 0:t.pixelAligned)||y),pc((null==t?void 0:t.antiAliasing)||v),a.resize(dr,ur),a.refresh(),e.n=1,new Promise(function(e){n.subscribe("draw",e,1),Ic()});case 1:return w=I.getContext("2d").getImageData(0,0,I.width,I.height),a.resize(l,s),a.refresh(),_i(o),Wi(i),ji(c),hc(u),pc(f),e.n=2,new Promise(function(e){n.subscribe("draw",e,1),Ic()});case 2:return I.style.userSelect=null,e.a(2,w)}},e)}),function(){var n=this,t=arguments;return new Promise(function(r,o){var i=e.apply(n,t);function a(e){c(i,r,o,a,l,"next",e)}function l(e){c(i,r,o,a,l,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}(),Mc=a.onFrame(function(){if(Zo=Rr.tick(),(Go||Uo)&&(ho||jo)){jo&&!Ja(To,Oo)&&Qa(),Zo&&(Kr=oi(1,1),qr=oi(-1,-1),"density"===Xt&&Ya()),a.render(function(){var e;!function(e,n){Fr[0]=e/zr,Fr[5]=n}(I.width/a.canvas.width,I.height/a.canvas.height),null!==(e=A)&&void 0!==e&&e._reglType&&Na(),fo.length>2&&Fa(),jo||kr.draw({projection:ia(),model:ca(),view:aa()});var n=va();Go&&n>0&&Ra(),Jr||!Rn&&!mo||function(){if(Lo>=0){var e=p(co[Lo].slice(0,2),2),n=[e[0],e[1],0,1];R(t,Fr,R(t,Rr.view,jr)),D(n,n,t),Wr.setPoints([-1,n[1],1,n[1]]),Zr.setPoints([n[0],1,n[0],-1]),Wr.draw(),Zr.draw(),Oa(function(){return(Wt+2*Kt)*window.devicePixelRatio},function(){return 1},Ao,1)(),Oa(function(){return(Wt+Kt)*window.devicePixelRatio},function(){return 1},Ao,3)()}}(),Lo>=0&&Ba(),to.length>0&&(La(),Da(),za()),Lr.draw({projection:ia(),model:ca(),view:aa()}),Br.draw({projection:ia(),model:ca(),view:aa()})},I);var e={view:Rr.view,isViewChanged:Zo,camera:Rr,xScale:Xo,yScale:$o};Zo&&(Ni(),po?po=!1:n.publish("view",e)),ho=!1,mo=!1,n.publish("drawing",e,{async:!1}),n.publish("draw",e)}}),Ic=function(){ho=!0};return function(){Ri(),yc(),Ni(),Br=de(a.regl,{color:W,width:G,is2d:!0}),kr=de(a.regl,{color:Ti(Zn,Un,qn),opacity:null===Qn?null:Qn[0],width:ft[0],is2d:!0}),Wr=de(a.regl,{color:Ln,width:1,is2d:!0}),Zr=de(a.regl,{color:Ln,width:1,is2d:!0}),Lr=de(a.regl,{color:pr,width:mr,is2d:!0}),ki(),I.addEventListener("wheel",bc),So=a.regl.buffer(),Po=a.regl.buffer(),Ao=a.regl.buffer({usage:"dynamic",type:"float",length:2*he}),Ro=Oi(),Bo=Ci();var e=mc({backgroundImage:A,width:dr,height:ur,actionKeyMap:In});ac(),cc(),window.addEventListener("keyup",gc,!1),window.addEventListener("blur",Ii,!1),window.addEventListener("mouseup",Pi,!1),window.addEventListener("mousemove",Mi,!1),I.addEventListener("mousedown",Si,!1),I.addEventListener("mouseenter",wc,!1),I.addEventListener("mouseleave",xc,!1),I.addEventListener("click",Ai,!1),I.addEventListener("dblclick",Ei,!1),"ResizeObserver"in window?(Hr=new ResizeObserver(Ac)).observe(I):(window.addEventListener("resize",Ac),window.addEventListener("orientationchange",Ac)),e.then(function(){n.publish("init")})}(),{attachSpatialIndex:function(e){Dr=function(e){return An.from(e)}(e)},get isSupported(){return a.isSupported},clear:tc(function(){Sc(),Pc()}),clearPoints:tc(Sc),clearPointConnections:tc(function(){kr.clear()}),clearAnnotations:tc(Pc),createTextureFromUrl:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gn;return at(a.regl,e,n)},deselect:hi,destroy:function(){Go=!1,Uo=!1,Xr=!0,Mc(),window.removeEventListener("keyup",gc,!1),window.removeEventListener("blur",Ii,!1),window.removeEventListener("mouseup",Pi,!1),window.removeEventListener("mousemove",Mi,!1),I.removeEventListener("mousedown",Si,!1),I.removeEventListener("mouseenter",wc,!1),I.removeEventListener("mouseleave",xc,!1),I.removeEventListener("click",Ai,!1),I.removeEventListener("dblclick",Ei,!1),I.removeEventListener("wheel",bc,!1),Hr?Hr.disconnect():(window.removeEventListener("resize",Ac),window.removeEventListener("orientationchange",Ac)),I=void 0,Rr.dispose(),Rr=void 0,Br.destroy(),xi.destroy(),kr.destroy(),Wr.destroy(),Zr.destroy(),Ro&&Ro.destroy(),Bo&&Bo.destroy(),e.renderer||a.isDestroyed||a.destroy(),n.publish("destroy"),n.clear()},draw:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Xr?Promise.reject(new Error(bn)):Yr?Promise.reject(new Error("Ignoring draw call as the previous draw call has not yet finished. To avoid this warning `await` the draw call.")):(Yr=!0,bt(e).then(function(e){return new Promise(function(r){if(Xr)r();else{var o=!1;t.preventFilterReset&&(null==e?void 0:e.length)===lo||(io=!1,ao.clear());var i=e&&fi(e[0])&&(Vn||t.showPointConnectionsOnce),c=t.zDataType,l=t.wDataType;new Promise(function(s){e?(t.transition&&(e.length===lo?o=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!yo)return!1;if(jo){var t=go;go=wo,t.destroy()}else go=yo;return wo=_a(e,n),xo=a.regl.framebuffer({color:wo,depth:!1,stencil:!1}),yo=void 0,!0}(e,{z:c,w:l}):console.warn("Cannot transition! The number of points between the previous and current draw call must be identical.")),Va(e,{zDataType:c,wDataType:l,preventFilterReset:t.preventFilterReset,spatialIndex:t.spatialIndex}).then(function(){void 0!==t.hover&&yi(t.hover,{preventEvent:!0}),void 0!==t.select&&mi(t.select,{preventEvent:!0}),void 0!==t.filter&&qa(t.filter,{preventEvent:!0}),i?Ka(e).then(function(){n.publish("pointConnectionsDraw"),ho=!0,mo=t.showReticleOnce}).then(function(){return r()}):s()})):s()}).then(function(){t.transition&&o?(i?Promise.all([new Promise(function(e){n.subscribe("transitionEnd",function(){ho=!0,mo=t.showReticleOnce,e()},1)}),new Promise(function(e){n.subscribe("pointConnectionsDraw",e,1)})]).then(function(){return r()}):n.subscribe("transitionEnd",function(){ho=!0,mo=t.showReticleOnce,r()},1),ec({duration:t.transitionDuration,easing:t.transitionEasing})):(i?Promise.all([new Promise(function(e){n.subscribe("draw",e,1)}),new Promise(function(e){n.subscribe("pointConnectionsDraw",e,1)})]).then(function(){return r()}):n.subscribe("draw",function(){return r()},1),ho=!0,mo=t.showReticleOnce)})}}).finally(function(){Yr=!1})}))},drawAnnotations:nc,filter:qa,get:function(e){var n,t=p(Object.keys(Bt(u({},e,wn))),1)[0];return"aspectRatio"===t?vo:"background"===t||"backgroundColor"===t?S:"backgroundImage"===t?A:"camera"===t?Rr:"cameraTarget"===t?Rr.target:"cameraDistance"===t?Rr.distance[0]:"cameraRotation"===t?Rr.rotation:"cameraView"===t?Rr.view:"cameraIsFixed"===t?xr:"canvas"===t?I:"colorBy"===t?B:"sizeBy"===t?or:"pointOrder"===t?null!==ar?h(ar):null:"deselectOnDblClick"===t?N:"deselectOnEscape"===t?_:"height"===t?ur:"lassoColor"===t?W:"lassoLineWidth"===t?G:"lassoMinDelay"===t?K:"lassoMinDist"===t?H:"lassoClearEvent"===t?J:"lassoInitiator"===t?ee:"lassoInitiatorElement"===t?xi.initiator:"lassoInitiatorParentElement"===t?te:"lassoLongPressIndicatorParentElement"===t?oe:"lassoOnLongPress"===t?ae:"lassoType"===t?yn:"lassoBrushSize"===t?Pn:"mouseMode"===t?Tn:"opacity"===t?1===Ht.length?Ht[0]:Ht:"opacityBy"===t?Xt:"opacityByDensityFill"===t?Jt:"opacityByDensityDebounceTime"===t?Mr:"opacityInactiveMax"===t?er:"opacityInactiveScale"===t?tr:"points"===t?co:"hoveredPoint"===t?Lo:"selectedPoints"===t?h(to):"filteredPoints"===t?io?Array.from(ao):Array.from({length:co.length},function(e,n){return n}):"pointsInView"===t?Ha():"pointColor"===t?1===zn.length?zn[0]:zn:"pointColorActive"===t?1===Fn.length?Fn[0]:Fn:"pointColorHover"===t?1===kn.length?kn[0]:kn:"pointOutlineWidth"===t?Kt:"pointSize"===t?1===_t.length?_t[0]:_t:"pointSizeSelected"===t?Wt:"pointSizeMouseDetection"===t?Gt:"showPointConnections"===t?Vn:"pointConnectionColor"===t?1===Zn.length?Zn[0]:Zn:"pointConnectionColorActive"===t?1===Un.length?Un[0]:Un:"pointConnectionColorHover"===t?1===qn.length?qn[0]:qn:"pointConnectionColorBy"===t?Yn:"pointConnectionOpacity"===t?1===Qn.length?Qn[0]:Qn:"pointConnectionOpacityBy"===t?ct:"pointConnectionOpacityActive"===t?st:"pointConnectionSize"===t?1===ft.length?ft[0]:ft:"pointConnectionSizeActive"===t?ht:"pointConnectionSizeBy"===t?Rt:"pointConnectionMaxIntPointsPerSegment"===t?Nt:"pointConnectionTolerance"===t?jt:"pointScaleMode"===t?lr:"reticleColor"===t?Ln:"regl"===t?a.regl:"showReticle"===t?Rn:"version"===t?"1.16.0-hemato.0":"width"===t?dr:"xScale"===t?Xo:"yScale"===t?$o:"performanceMode"===t?Ar:"renderPointsAsSquares"===t?Tr:"disableAlphaBlending"===t?Or:"gamma"===t?a.gamma:"renderer"===t?a:"isDestroyed"===t?Xr:"isDrawing"===t?Yr:"isPointsDrawn"===t?Go:"isPointsFiltered"===t?io:"isAnnotationsDrawn"===t?Uo:"zDataType"===t?qo:"wDataType"===t?Ho:"spatialIndex"===t?null===(n=Dr)||void 0===n?void 0:n.data:"annotationLineColor"===t?pr:"annotationLineWidth"===t?mr:"annotationHVLineLimit"===t?gr:"antiAliasing"===t?v:"pixelAligned"===t?y:"actionKeyMap"===t?function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach(function(n){u(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}({},In):void 0},getScreenPosition:function(e){if(!Go)throw new Error(xn);var n=co[e];if(n){var r=[n[0],n[1],0,1];return R(t,Nr,R(t,Rr.view,jr)),D(r,r,t),[br*(r[0]+1)/2,Sr*(.5-r[1]/2)]}},hover:yi,lassoSelect:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.merge,r=void 0!==t&&t,o=n.remove,i=void 0!==o&&o,a=n.isGl,c=void 0!==a&&a;if(!function(e){if(!Array.isArray(e)||e.length<3)return!1;var n,t=s(e);try{for(t.s();!(n=t.n()).done;){var r=n.value;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return!1}}catch(e){t.e(e)}finally{t.f()}return!0}(e))throw new Error("Lasso selection requires at least 3 vertices as [x, y] coordinate pairs");var l,u,f=function(e){var n=h(e),t=e.at(0),r=e.at(-1);return t[0]===r[0]&&t[1]===r[1]||n.push(t),n}(e);if(c)l=f,u=f.flat();else{if(u=function(e){if(!Xo||!$o)return console.warn("xScale and yScale must be defined for programmatic lasso selection"),null;var n,t=[],r=s(e);try{for(r.s();!(n=r.n()).done;){var o=p(n.value,2),i=o[0],a=o[1],c=p(oi((i-Jo)/Qo*2-1,(a-ei)/ni*2-1),2),l=c[0],u=c[1];t.push(l,u)}}catch(e){r.e(e)}finally{r.f()}return t}(f),!u)throw new Error("xScale and yScale must be defined to convert lasso vertices from data space to GL space");l=[];for(var d=0;d<u.length;d+=2)l.push([u[d],u[d+1]])}wi(l,u,{merge:r,remove:i})},redraw:Ic,refresh:a.refresh,reset:tc(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;yc(),Ni(),t||n.publish("view",{view:Rr.view,camera:Rr,xScale:Xo,yScale:$o})}),select:mi,set:mc,export:function(e){return void 0===e?I.getContext("2d").getImageData(0,0,I.width,I.height):Ec(e)},subscribe:n.subscribe,unfilter:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;return io=!1,ao.clear(),So.subdata(ka(lo)),new Promise(function(e){var r=function(){n.subscribe("draw",function(){t||n.publish("unfilter"),e()},1),ho=!0};Vn||fi(co[0])?Ka(ai()).then(function(){t||n.publish("pointConnectionsDraw"),r()}):r()})},unsubscribe:n.unsubscribe,view:function(e){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,t=void 0!==n&&n;lc(e),ho=!0,po=t},zoomToLocation:oc,zoomToArea:rc,zoomToPoints:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Go)return Promise.reject(new Error(xn));var t=function(e){var n,t=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=s(e);try{for(a.s();!(n=a.n()).done;){var c=n.value,l=p(co[c],2),u=l[0],f=l[1];t=Math.min(t,u),r=Math.max(r,u),o=Math.min(o,f),i=Math.max(i,f)}}catch(e){a.e(e)}finally{a.f()}return{x:t,y:o,width:r-t,height:i-o}}(e),r=t.x+t.width/2,o=t.y+t.height/2,i=ii(),a=1+(n.padding||0),c=Math.max(t.width,i)*a,l=Math.max(t.height,i)*a;return rc({x:r-c/2,y:o-l/2,width:c,height:l},n)},zoomToOrigin:function(){return oc([0,0],1,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}}},Object.defineProperty(e,"__esModule",{value:!0})});
|