Spaces:
Running
Running
import{InternMap as P,InternSet as y}from"../internmap@2.0.3/index.4106013c.js";import{InternMap as Fn,InternSet as Rn}from"../internmap@2.0.3/index.4106013c.js";function m(t,n){return t==null||n==null?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function Q(t,n){return t==null||n==null?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function D(t){let n,r,o;t.length!==2?(n=m,r=(a,l)=>m(t(a),l),o=(a,l)=>t(a)-l):(n=t===m||t===Q?t:vt,r=t,o=t);function e(a,l,i=0,h=a.length){if(i<h){if(n(l,l)!==0)return h;do{const s=i+h>>>1;r(a[s],l)<0?i=s+1:h=s}while(i<h)}return i}function f(a,l,i=0,h=a.length){if(i<h){if(n(l,l)!==0)return h;do{const s=i+h>>>1;r(a[s],l)<=0?i=s+1:h=s}while(i<h)}return i}function u(a,l,i=0,h=a.length){const s=e(a,l,i,h-1);return s>i&&o(a[s-1],l)>-o(a[s],l)?s-1:s}return{left:e,center:u,right:f}}function vt(){return 0}function F(t){return t===null?NaN:+t}function*wt(t,n){if(n===void 0)for(let r of t)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let o of t)(o=n(o,++r,t))!=null&&(o=+o)>=o&&(yield o)}}const V=D(m),W=V.right,Mt=V.left,At=D(F).center;var X=W;function xt(t,n){if(!((n=+n)>=0))throw new RangeError("invalid r");let r=t.length;if(!((r=Math.floor(r))>=0))throw new RangeError("invalid length");if(!r||!n)return t;const o=G(n),e=t.slice();return o(t,e,0,r,1),o(e,t,0,r,1),o(t,e,0,r,1),t}const bt=Y(G),Et=Y(Nt);function Y(t){return function(n,r,o=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((o=+o)>=0))throw new RangeError("invalid ry");let{data:e,width:f,height:u}=n;if(!((f=Math.floor(f))>=0))throw new RangeError("invalid width");if(!((u=Math.floor(u!==void 0?u:e.length/f))>=0))throw new RangeError("invalid height");if(!f||!u||!r&&!o)return n;const a=r&&t(r),l=o&&t(o),i=e.slice();return a&&l?($(a,i,e,f,u),$(a,e,i,f,u),$(a,i,e,f,u),v(l,e,i,f,u),v(l,i,e,f,u),v(l,e,i,f,u)):a?($(a,e,i,f,u),$(a,i,e,f,u),$(a,e,i,f,u)):l&&(v(l,e,i,f,u),v(l,i,e,f,u),v(l,e,i,f,u)),n}}function $(t,n,r,o,e){for(let f=0,u=o*e;f<u;)t(n,r,f,f+=o,1)}function v(t,n,r,o,e){for(let f=0,u=o*e;f<o;++f)t(n,r,f,f+u,o)}function Nt(t){const n=G(t);return(r,o,e,f,u)=>{e<<=2,f<<=2,u<<=2,n(r,o,e+0,f+0,u),n(r,o,e+1,f+1,u),n(r,o,e+2,f+2,u),n(r,o,e+3,f+3,u)}}function G(t){const n=Math.floor(t);if(n===t)return St(t);const r=t-n,o=2*t+1;return(e,f,u,a,l)=>{if(!((a-=l)>=u))return;let i=n*f[u];const h=l*n,s=h+l;for(let c=u,d=u+h;c<d;c+=l)i+=f[Math.min(a,c)];for(let c=u,d=a;c<=d;c+=l)i+=f[Math.min(a,c+h)],e[c]=(i+r*(f[Math.max(u,c-s)]+f[Math.min(a,c+s)]))/o,i-=f[Math.max(u,c-h)]}}function St(t){const n=2*t+1;return(r,o,e,f,u)=>{if(!((f-=u)>=e))return;let a=t*o[e];const l=u*t;for(let i=e,h=e+l;i<h;i+=u)a+=o[Math.min(f,i)];for(let i=e,h=f;i<=h;i+=u)a+=o[Math.min(f,i+l)],r[i]=a/n,a-=o[Math.max(e,i-l)]}}function R(t,n){let r=0;if(n===void 0)for(let o of t)o!=null&&(o=+o)>=o&&++r;else{let o=-1;for(let e of t)(e=n(e,++o,t))!=null&&(e=+e)>=e&&++r}return r}function qt(t){return t.length|0}function It(t){return!(t>0)}function Ft(t){return typeof t!="object"||"length"in t?t:Array.from(t)}function Rt(t){return n=>t(...n)}function Tt(...t){const n=typeof t[t.length-1]=="function"&&Rt(t.pop());t=t.map(Ft);const r=t.map(qt),o=t.length-1,e=new Array(o+1).fill(0),f=[];if(o<0||r.some(It))return f;for(;;){f.push(e.map((a,l)=>t[l][a]));let u=o;for(;++e[u]===r[u];){if(u===0)return n?f.map(n):f;e[u--]=0}}}function kt(t,n){var r=0,o=0;return Float64Array.from(t,n===void 0?e=>r+=+e||0:e=>r+=+n(e,o++,t)||0)}function Z(t,n){let r=0,o,e=0,f=0;if(n===void 0)for(let u of t)u!=null&&(u=+u)>=u&&(o=u-e,e+=o/++r,f+=o*(u-e));else{let u=-1;for(let a of t)(a=n(a,++u,t))!=null&&(a=+a)>=a&&(o=a-e,e+=o/++r,f+=o*(a-e))}if(r>1)return f/(r-1)}function tt(t,n){const r=Z(t,n);return r&&Math.sqrt(r)}function T(t,n){let r,o;if(n===void 0)for(const e of t)e!=null&&(r===void 0?e>=e&&(r=o=e):(r>e&&(r=e),o<e&&(o=e)));else{let e=-1;for(let f of t)(f=n(f,++e,t))!=null&&(r===void 0?f>=f&&(r=o=f):(r>f&&(r=f),o<f&&(o=f)))}return[r,o]}let L=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(n){const r=this._partials;let o=0;for(let e=0;e<this._n&&e<32;e++){const f=r[e],u=n+f,a=Math.abs(n)<Math.abs(f)?n-(u-f):f-(u-n);a&&(r[o++]=a),n=u}return r[o]=n,this._n=o+1,this}valueOf(){const n=this._partials;let r=this._n,o,e,f,u=0;if(r>0){for(u=n[--r];r>0&&(o=u,e=n[--r],u=o+e,f=e-(u-o),!f););r>0&&(f<0&&n[r-1]<0||f>0&&n[r-1]>0)&&(e=f*2,o=u+e,e==o-u&&(u=o))}return u}};function _t(t,n){const r=new L;if(n===void 0)for(let o of t)(o=+o)&&r.add(o);else{let o=-1;for(let e of t)(e=+n(e,++o,t))&&r.add(e)}return+r}function jt(t,n){const r=new L;let o=-1;return Float64Array.from(t,n===void 0?e=>r.add(+e||0):e=>r.add(+n(e,++o,t)||0))}function w(t){return t}function nt(t,...n){return M(t,w,w,n)}function rt(t,...n){return M(t,Array.from,w,n)}function et(t,n){for(let r=1,o=n.length;r<o;++r)t=t.flatMap(e=>e.pop().map(([f,u])=>[...e,f,u]));return t}function Ot(t,...n){return et(rt(t,...n),n)}function Ut(t,n,...r){return et(ft(t,n,...r),r)}function ot(t,n,...r){return M(t,w,n,r)}function ft(t,n,...r){return M(t,Array.from,n,r)}function Dt(t,...n){return M(t,w,ut,n)}function Gt(t,...n){return M(t,Array.from,ut,n)}function ut(t){if(t.length!==1)throw new Error("duplicate key");return t[0]}function M(t,n,r,o){return function e(f,u){if(u>=o.length)return r(f);const a=new P,l=o[u++];let i=-1;for(const h of f){const s=l(h,++i,f),c=a.get(s);c?c.push(h):a.set(s,[h])}for(const[h,s]of a)a.set(h,e(s,u));return n(a)}(t,0)}function at(t,n){return Array.from(n,r=>t[r])}function z(t,...n){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");t=Array.from(t);let[r]=n;if(r&&r.length!==2||n.length>1){const o=Uint32Array.from(t,(e,f)=>f);return n.length>1?(n=n.map(e=>t.map(e)),o.sort((e,f)=>{for(const u of n){const a=A(u[e],u[f]);if(a)return a}})):(r=t.map(r),o.sort((e,f)=>A(r[e],r[f]))),at(t,o)}return t.sort(C(r))}function C(t=m){if(t===m)return A;if(typeof t!="function")throw new TypeError("compare is not a function");return(n,r)=>{const o=t(n,r);return o||o===0?o:(t(r,r)===0)-(t(n,n)===0)}}function A(t,n){return(t==null||!(t>=t))-(n==null||!(n>=n))||(t<n?-1:t>n?1:0)}function Lt(t,n,r){return(n.length!==2?z(ot(t,n,r),([o,e],[f,u])=>m(e,u)||m(o,f)):z(nt(t,r),([o,e],[f,u])=>n(e,u)||m(o,f))).map(([o])=>o)}var zt=Array.prototype,Ct=zt.slice;function B(t){return()=>t}const Bt=Math.sqrt(50),Ht=Math.sqrt(10),Jt=Math.sqrt(2);function k(t,n,r){const o=(n-t)/Math.max(0,r),e=Math.floor(Math.log10(o)),f=o/Math.pow(10,e),u=f>=Bt?10:f>=Ht?5:f>=Jt?2:1;let a,l,i;return e<0?(i=Math.pow(10,-e)/u,a=Math.round(t*i),l=Math.round(n*i),a/i<t&&++a,l/i>n&&--l,i=-i):(i=Math.pow(10,e)*u,a=Math.round(t/i),l=Math.round(n/i),a*i<t&&++a,l*i>n&&--l),l<a&&.5<=r&&r<2?k(t,n,r*2):[a,l,i]}function it(t,n,r){if(n=+n,t=+t,r=+r,!(r>0))return[];if(t===n)return[t];const o=n<t,[e,f,u]=o?k(n,t,r):k(t,n,r);if(!(f>=e))return[];const a=f-e+1,l=new Array(a);if(o)if(u<0)for(let i=0;i<a;++i)l[i]=(f-i)/-u;else for(let i=0;i<a;++i)l[i]=(f-i)*u;else if(u<0)for(let i=0;i<a;++i)l[i]=(e+i)/-u;else for(let i=0;i<a;++i)l[i]=(e+i)*u;return l}function x(t,n,r){return n=+n,t=+t,r=+r,k(t,n,r)[2]}function Kt(t,n,r){n=+n,t=+t,r=+r;const o=n<t,e=o?x(n,t,r):x(t,n,r);return(o?-1:1)*(e<0?1/-e:e)}function lt(t,n,r){let o;for(;;){const e=x(t,n,r);if(e===o||e===0||!isFinite(e))return[t,n];e>0?(t=Math.floor(t/e)*e,n=Math.ceil(n/e)*e):e<0&&(t=Math.ceil(t*e)/e,n=Math.floor(n*e)/e),o=e}}function st(t){return Math.max(1,Math.ceil(Math.log(R(t))/Math.LN2)+1)}function ct(){var t=w,n=T,r=st;function o(e){Array.isArray(e)||(e=Array.from(e));var f,u=e.length,a,l,i=new Array(u);for(f=0;f<u;++f)i[f]=t(e[f],f,e);var h=n(i),s=h[0],c=h[1],d=r(i,s,c);if(!Array.isArray(d)){const q=c,I=+d;if(n===T&&([s,c]=lt(s,c,I)),d=it(s,c,I),d[0]<=s&&(l=x(s,c,I)),d[d.length-1]>=c)if(q>=c&&n===T){const g=x(s,c,I);isFinite(g)&&(g>0?c=(Math.floor(c/g)+1)*g:g<0&&(c=(Math.ceil(c*-g)+1)/-g))}else d.pop()}for(var p=d.length,b=0,E=p;d[b]<=s;)++b;for(;d[E-1]>c;)--E;(b||E<p)&&(d=d.slice(b,E),p=E-b);var N=new Array(p+1),U;for(f=0;f<=p;++f)U=N[f]=[],U.x0=f>0?d[f-1]:s,U.x1=f<p?d[f]:c;if(isFinite(l)){if(l>0)for(f=0;f<u;++f)(a=i[f])!=null&&s<=a&&a<=c&&N[Math.min(p,Math.floor((a-s)/l))].push(e[f]);else if(l<0){for(f=0;f<u;++f)if((a=i[f])!=null&&s<=a&&a<=c){const q=Math.floor((s-a)*l);N[Math.min(p,q+(d[q]<=a))].push(e[f])}}}else for(f=0;f<u;++f)(a=i[f])!=null&&s<=a&&a<=c&&N[X(d,a,0,p)].push(e[f]);return N}return o.value=function(e){return arguments.length?(t=typeof e=="function"?e:B(e),o):t},o.domain=function(e){return arguments.length?(n=typeof e=="function"?e:B([e[0],e[1]]),o):n},o.thresholds=function(e){return arguments.length?(r=typeof e=="function"?e:B(Array.isArray(e)?Ct.call(e):e),o):r},o}function H(t,n){let r;if(n===void 0)for(const o of t)o!=null&&(r<o||r===void 0&&o>=o)&&(r=o);else{let o=-1;for(let e of t)(e=n(e,++o,t))!=null&&(r<e||r===void 0&&e>=e)&&(r=e)}return r}function J(t,n){let r,o=-1,e=-1;if(n===void 0)for(const f of t)++e,f!=null&&(r<f||r===void 0&&f>=f)&&(r=f,o=e);else for(let f of t)(f=n(f,++e,t))!=null&&(r<f||r===void 0&&f>=f)&&(r=f,o=e);return o}function _(t,n){let r;if(n===void 0)for(const o of t)o!=null&&(r>o||r===void 0&&o>=o)&&(r=o);else{let o=-1;for(let e of t)(e=n(e,++o,t))!=null&&(r>e||r===void 0&&e>=e)&&(r=e)}return r}function K(t,n){let r,o=-1,e=-1;if(n===void 0)for(const f of t)++e,f!=null&&(r>f||r===void 0&&f>=f)&&(r=f,o=e);else for(let f of t)(f=n(f,++e,t))!=null&&(r>f||r===void 0&&f>=f)&&(r=f,o=e);return o}function j(t,n,r=0,o=1/0,e){if(n=Math.floor(n),r=Math.floor(Math.max(0,r)),o=Math.floor(Math.min(t.length-1,o)),!(r<=n&&n<=o))return t;for(e=e===void 0?A:C(e);o>r;){if(o-r>600){const l=o-r+1,i=n-r+1,h=Math.log(l),s=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*s*(l-s)/l)*(i-l/2<0?-1:1),d=Math.max(r,Math.floor(n-i*s/l+c)),p=Math.min(o,Math.floor(n+(l-i)*s/l+c));j(t,n,d,p,e)}const f=t[n];let u=r,a=o;for(S(t,r,n),e(t[o],f)>0&&S(t,r,o);u<a;){for(S(t,u,a),++u,--a;e(t[u],f)<0;)++u;for(;e(t[a],f)>0;)--a}e(t[r],f)===0?S(t,r,a):(++a,S(t,a,o)),a<=n&&(r=a+1),n<=a&&(o=a-1)}return t}function S(t,n,r){const o=t[n];t[n]=t[r],t[r]=o}function ht(t,n=m){let r,o=!1;if(n.length===1){let e;for(const f of t){const u=n(f);(o?m(u,e)>0:m(u,u)===0)&&(r=f,e=u,o=!0)}}else for(const e of t)(o?n(e,r)>0:n(e,e)===0)&&(r=e,o=!0);return r}function O(t,n,r){if(t=Float64Array.from(wt(t,r)),!(!(o=t.length)||isNaN(n=+n))){if(n<=0||o<2)return _(t);if(n>=1)return H(t);var o,e=(o-1)*n,f=Math.floor(e),u=H(j(t,f).subarray(0,f+1)),a=_(t.subarray(f+1));return u+(a-u)*(e-f)}}function Pt(t,n,r=F){if(!(!(o=t.length)||isNaN(n=+n))){if(n<=0||o<2)return+r(t[0],0,t);if(n>=1)return+r(t[o-1],o-1,t);var o,e=(o-1)*n,f=Math.floor(e),u=+r(t[f],f,t),a=+r(t[f+1],f+1,t);return u+(a-u)*(e-f)}}function dt(t,n,r=F){if(!isNaN(n=+n)){if(o=Float64Array.from(t,(a,l)=>F(r(t[l],l,t))),n<=0)return K(o);if(n>=1)return J(o);var o,e=Uint32Array.from(t,(a,l)=>l),f=o.length-1,u=Math.floor(f*n);return j(e,u,0,f,(a,l)=>A(o[a],o[l])),u=ht(e.subarray(0,u+1),a=>o[a]),u>=0?u:-1}}function Qt(t,n,r){const o=R(t),e=O(t,.75)-O(t,.25);return o&&e?Math.ceil((r-n)/(2*e*Math.pow(o,-1/3))):1}function Vt(t,n,r){const o=R(t),e=tt(t);return o&&e?Math.ceil((r-n)*Math.cbrt(o)/(3.49*e)):1}function Wt(t,n){let r=0,o=0;if(n===void 0)for(let e of t)e!=null&&(e=+e)>=e&&(++r,o+=e);else{let e=-1;for(let f of t)(f=n(f,++e,t))!=null&&(f=+f)>=f&&(++r,o+=f)}if(r)return o/r}function Xt(t,n){return O(t,.5,n)}function Yt(t,n){return dt(t,.5,n)}function*Zt(t){for(const n of t)yield*n}function tn(t){return Array.from(Zt(t))}function nn(t,n){const r=new P;if(n===void 0)for(let f of t)f!=null&&f>=f&&r.set(f,(r.get(f)||0)+1);else{let f=-1;for(let u of t)(u=n(u,++f,t))!=null&&u>=u&&r.set(u,(r.get(u)||0)+1)}let o,e=0;for(const[f,u]of r)u>e&&(e=u,o=f);return o}function rn(t,n=en){const r=[];let o,e=!1;for(const f of t)e&&r.push(n(o,f)),o=f,e=!0;return r}function en(t,n){return[t,n]}function on(t,n,r){t=+t,n=+n,r=(e=arguments.length)<2?(n=t,t=0,1):e<3?1:+r;for(var o=-1,e=Math.max(0,Math.ceil((n-t)/r))|0,f=new Array(e);++o<e;)f[o]=t+o*r;return f}function fn(t,n=m){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let r=Array.from(t);const o=new Float64Array(r.length);n.length!==2&&(r=r.map(n),n=m);const e=(a,l)=>n(r[a],r[l]);let f,u;return t=Uint32Array.from(r,(a,l)=>l),t.sort(n===m?(a,l)=>A(r[a],r[l]):C(e)),t.forEach((a,l)=>{const i=e(a,f===void 0?a:f);i>=0?((f===void 0||i>0)&&(f=a,u=l),o[a]=u):o[a]=NaN}),o}function un(t,n=m){let r,o=!1;if(n.length===1){let e;for(const f of t){const u=n(f);(o?m(u,e)<0:m(u,u)===0)&&(r=f,e=u,o=!0)}}else for(const e of t)(o?n(e,r)<0:n(e,e)===0)&&(r=e,o=!0);return r}function mt(t,n=m){if(n.length===1)return K(t,n);let r,o=-1,e=-1;for(const f of t)++e,(o<0?n(f,f)===0:n(f,r)<0)&&(r=f,o=e);return o}function an(t,n=m){if(n.length===1)return J(t,n);let r,o=-1,e=-1;for(const f of t)++e,(o<0?n(f,f)===0:n(f,r)>0)&&(r=f,o=e);return o}function ln(t,n){const r=mt(t,n);return r<0?void 0:r}var sn=pt(Math.random);function pt(t){return function(n,r=0,o=n.length){let e=o-(r=+r);for(;e;){const f=t()*e--|0,u=n[e+r];n[e+r]=n[f+r],n[f+r]=u}return n}}function cn(t,n){let r=0;if(n===void 0)for(let o of t)(o=+o)&&(r+=o);else{let o=-1;for(let e of t)(e=+n(e,++o,t))&&(r+=e)}return r}function gt(t){if(!(f=t.length))return[];for(var n=-1,r=_(t,hn),o=new Array(r);++n<r;)for(var e=-1,f,u=o[n]=new Array(f);++e<f;)u[e]=t[e][n];return o}function hn(t){return t.length}function dn(){return gt(arguments)}function mn(t,n){if(typeof n!="function")throw new TypeError("test is not a function");let r=-1;for(const o of t)if(!n(o,++r,t))return!1;return!0}function pn(t,n){if(typeof n!="function")throw new TypeError("test is not a function");let r=-1;for(const o of t)if(n(o,++r,t))return!0;return!1}function gn(t,n){if(typeof n!="function")throw new TypeError("test is not a function");const r=[];let o=-1;for(const e of t)n(e,++o,t)&&r.push(e);return r}function yn(t,n){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");if(typeof n!="function")throw new TypeError("mapper is not a function");return Array.from(t,(r,o)=>n(r,o,t))}function $n(t,n,r){if(typeof n!="function")throw new TypeError("reducer is not a function");const o=t[Symbol.iterator]();let e,f,u=-1;if(arguments.length<3){if({done:e,value:r}=o.next(),e)return;++u}for(;{done:e,value:f}=o.next(),!e;)r=n(r,f,++u,t);return r}function vn(t){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(t).reverse()}function wn(t,...n){t=new y(t);for(const r of n)for(const o of r)t.delete(o);return t}function Mn(t,n){const r=n[Symbol.iterator](),o=new y;for(const e of t){if(o.has(e))return!1;let f,u;for(;({value:f,done:u}=r.next())&&!u;){if(Object.is(e,f))return!1;o.add(f)}}return!0}function An(t,...n){t=new y(t),n=n.map(xn);t:for(const r of t)for(const o of n)if(!o.has(r)){t.delete(r);continue t}return t}function xn(t){return t instanceof y?t:new y(t)}function yt(t,n){const r=t[Symbol.iterator](),o=new Set;for(const e of n){const f=$t(e);if(o.has(f))continue;let u,a;for(;{value:u,done:a}=r.next();){if(a)return!1;const l=$t(u);if(o.add(l),Object.is(f,l))break}}return!0}function $t(t){return t!==null&&typeof t=="object"?t.valueOf():t}function bn(t,n){return yt(n,t)}function En(...t){const n=new y;for(const r of t)for(const o of r)n.add(o);return n}export{L as Adder,Fn as InternMap,Rn as InternSet,m as ascending,ct as bin,X as bisect,At as bisectCenter,Mt as bisectLeft,W as bisectRight,D as bisector,xt as blur,bt as blur2,Et as blurImage,R as count,Tt as cross,kt as cumsum,Q as descending,tt as deviation,wn as difference,Mn as disjoint,mn as every,T as extent,jt as fcumsum,gn as filter,Ot as flatGroup,Ut as flatRollup,_t as fsum,ht as greatest,an as greatestIndex,nt as group,Lt as groupSort,rt as groups,ct as histogram,Dt as index,Gt as indexes,An as intersection,un as least,mt as leastIndex,yn as map,H as max,J as maxIndex,Wt as mean,Xt as median,Yt as medianIndex,tn as merge,_ as min,K as minIndex,nn as mode,lt as nice,rn as pairs,at as permute,O as quantile,dt as quantileIndex,Pt as quantileSorted,j as quickselect,on as range,fn as rank,$n as reduce,vn as reverse,ot as rollup,ft as rollups,ln as scan,sn as shuffle,pt as shuffler,pn as some,z as sort,bn as subset,cn as sum,yt as superset,Qt as thresholdFreedmanDiaconis,Vt as thresholdScott,st as thresholdSturges,x as tickIncrement,Kt as tickStep,it as ticks,gt as transpose,En as union,Z as variance,dn as zip}; | |