UNPKG

@finos/perspective-viewer-datagrid

Version:

Perspective datagrid plugin based on `regular-table`

10 lines 130 kB
var mo=Object.create;var mr=Object.defineProperty;var bo=Object.getOwnPropertyDescriptor;var yo=Object.getOwnPropertyNames;var vo=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var xo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ko=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of yo(t))!wo.call(e,s)&&s!==o&&mr(e,s,{get:()=>t[s],enumerable:!(n=bo(t,s))||n.enumerable});return e};var Lt=(e,t,o)=>(o=e!=null?mo(vo(e)):{},ko(t||!e||!e.__esModule?mr(o,"default",{value:e,enumerable:!0}):o,e));var ft=xo((_t,ht)=>{(function(){var e,t,o,n,s,d,f,p,m,w,g,E,C,A,S,P,R,B,j,y,ne,I,Ee,q,U,F,le,K,ae,de,oe,ie,we,Ne,fe,me,Re,Te,De,Be,Le,ze,He,$e,be,ye,Jt,bt,je,yt,Zt,V,Qt,er,tr,rr,he,or,sr,ir,lr,nr,ar,cr,Pt,Wt,Ft,dr,_r,hr,vt,wt,fr,xe,ur,Ve,Me,Ut,re,se,Ie,xt,kt,Oe=[].slice;re=function(){var r,i,l,a,c;for(r={},c="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),a=0,i=c.length;a<i;a++)l=c[a],r["[object "+l+"]"]=l.toLowerCase();return function(_){var h;return h=Object.prototype.toString.call(_),r[h]||"object"}}(),bt=function(r,i,l){return i==null&&(i=0),l==null&&(l=1),r<i&&(r=i),r>l&&(r=l),r},se=function(r){return r.length>=3?Array.prototype.slice.call(r):r[0]},ne=function(r){var i,l;for(r._clipped=!1,r._unclipped=r.slice(0),i=l=0;l<3;i=++l)i<3?((r[i]<0||r[i]>255)&&(r._clipped=!0),r[i]<0&&(r[i]=0),r[i]>255&&(r[i]=255)):i===3&&(r[i]<0&&(r[i]=0),r[i]>1&&(r[i]=1));return r._clipped||delete r._unclipped,r},n=Math.PI,xe=Math.round,q=Math.cos,ae=Math.floor,he=Math.pow,je=Math.log,Ve=Math.sin,Me=Math.sqrt,A=Math.atan2,V=Math.max,C=Math.abs,f=n*2,s=n/3,t=n/180,d=180/n,y=function(){return arguments[0]instanceof e?arguments[0]:function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,arguments,function(){})},y.default=y,E=[],typeof ht<"u"&&ht!==null&&ht.exports!=null&&(ht.exports=y),typeof define=="function"&&define.amd?define([],function(){return y}):(fr=typeof _t<"u"&&_t!==null?_t:this,fr.chroma=y),y.version="1.4.1",g={},m=[],w=!1,e=function(){function r(){var i,l,a,c,_,h,u,b,x;for(h=this,l=[],b=0,c=arguments.length;b<c;b++)i=arguments[b],i!=null&&l.push(i);if(l.length>1&&(u=l[l.length-1]),g[u]!=null)h._rgb=ne(g[u](se(l.slice(0,-1))));else{for(w||(m=m.sort(function(L,T){return T.p-L.p}),w=!0),x=0,_=m.length;x<_&&(a=m[x],u=a.test.apply(a,l),!u);x++);u&&(h._rgb=ne(g[u].apply(g,l)))}h._rgb==null&&console.warn("unknown format: "+l),h._rgb==null&&(h._rgb=[0,0,0]),h._rgb.length===3&&h._rgb.push(1)}return r.prototype.toString=function(){return this.hex()},r}(),y._input=g;y.brewer=B={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},function(){var r,i;i=[];for(r in B)i.push(B[r.toLowerCase()]=B[r]);return i}(),Ie={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},y.colors=Ee=Ie,He=function(){var r,i,l,a,c,_,h,u,b;return i=se(arguments),c=i[0],r=i[1],l=i[2],u=(c+16)/116,h=isNaN(r)?u:u+r/500,b=isNaN(l)?u:u-l/200,u=o.Yn*$e(u),h=o.Xn*$e(h),b=o.Zn*$e(b),_=kt(3.2404542*h-1.5371385*u-.4985314*b),a=kt(-.969266*h+1.8760108*u+.041556*b),l=kt(.0556434*h-.2040259*u+1.0572252*b),[_,a,l,i.length>3?i[3]:1]},kt=function(r){return 255*(r<=.00304?12.92*r:1.055*he(r,1/2.4)-.055)},$e=function(r){return r>o.t1?r*r*r:o.t2*(r-o.t0)},o={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Pt=function(){var r,i,l,a,c,_,h,u;return a=se(arguments),l=a[0],i=a[1],r=a[2],c=hr(l,i,r),_=c[0],h=c[1],u=c[2],[116*h-16,500*(_-h),200*(h-u)]},vt=function(r){return(r/=255)<=.04045?r/12.92:he((r+.055)/1.055,2.4)},xt=function(r){return r>o.t3?he(r,1/3):r/o.t2+o.t0},hr=function(){var r,i,l,a,c,_,h;return a=se(arguments),l=a[0],i=a[1],r=a[2],l=vt(l),i=vt(i),r=vt(r),c=xt((.4124564*l+.3575761*i+.1804375*r)/o.Xn),_=xt((.2126729*l+.7151522*i+.072175*r)/o.Yn),h=xt((.0193339*l+.119192*i+.9503041*r)/o.Zn),[c,_,h]},y.lab=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["lab"]),function(){})},g.lab=He,e.prototype.lab=function(){return Pt(this._rgb)},S=function(r){var i,l,a,c,_,h,u,b,x,L,T;return r=function(){var M,k,z;for(z=[],k=0,M=r.length;k<M;k++)c=r[k],z.push(y(c));return z}(),r.length===2?(x=function(){var M,k,z;for(z=[],k=0,M=r.length;k<M;k++)c=r[k],z.push(c.lab());return z}(),_=x[0],h=x[1],i=function(M){var k,z;return z=function(){var N,W;for(W=[],k=N=0;N<=2;k=++N)W.push(_[k]+M*(h[k]-_[k]));return W}(),y.lab.apply(y,z)}):r.length===3?(L=function(){var M,k,z;for(z=[],k=0,M=r.length;k<M;k++)c=r[k],z.push(c.lab());return z}(),_=L[0],h=L[1],u=L[2],i=function(M){var k,z;return z=function(){var N,W;for(W=[],k=N=0;N<=2;k=++N)W.push((1-M)*(1-M)*_[k]+2*(1-M)*M*h[k]+M*M*u[k]);return W}(),y.lab.apply(y,z)}):r.length===4?(T=function(){var M,k,z;for(z=[],k=0,M=r.length;k<M;k++)c=r[k],z.push(c.lab());return z}(),_=T[0],h=T[1],u=T[2],b=T[3],i=function(M){var k,z;return z=function(){var N,W;for(W=[],k=N=0;N<=2;k=++N)W.push((1-M)*(1-M)*(1-M)*_[k]+3*(1-M)*(1-M)*M*h[k]+3*(1-M)*M*M*u[k]+M*M*M*b[k]);return W}(),y.lab.apply(y,z)}):r.length===5&&(l=S(r.slice(0,3)),a=S(r.slice(2,5)),i=function(M){return M<.5?l(M*2):a((M-.5)*2)}),i},y.bezier=function(r){var i;return i=S(r),i.scale=function(){return y.scale(i)},i},y.cubehelix=function(r,i,l,a,c){var _,h,u;return r==null&&(r=300),i==null&&(i=-1.5),l==null&&(l=1),a==null&&(a=1),c==null&&(c=[0,1]),_=0,re(c)==="array"?h=c[1]-c[0]:(h=0,c=[c,c]),u=function(b){var x,L,T,M,k,z,N,W,Z;return x=f*((r+120)/360+i*b),N=he(c[0]+h*b,a),z=_!==0?l[0]+b*_:l,L=z*N*(1-N)/2,M=q(x),Z=Ve(x),W=N+L*(-.14861*M+1.78277*Z),k=N+L*(-.29227*M-.90649*Z),T=N+L*(1.97294*M),y(ne([W*255,k*255,T*255,1]))},u.start=function(b){return b==null?r:(r=b,u)},u.rotations=function(b){return b==null?i:(i=b,u)},u.gamma=function(b){return b==null?a:(a=b,u)},u.hue=function(b){return b==null?l:(l=b,re(l)==="array"?(_=l[1]-l[0],_===0&&(l=l[1])):_=0,u)},u.lightness=function(b){return b==null?c:(re(b)==="array"?(c=b,h=b[1]-b[0]):(c=[b,b],h=0),u)},u.scale=function(){return y.scale(u)},u.hue(l),u},y.random=function(){var r,i,l,a;for(i="0123456789abcdef",r="#",l=a=0;a<6;l=++a)r+=i.charAt(ae(Math.random()*16));return new e(r)},E=[],me=function(r,i,l,a){var c,_,h,u;for(l==null&&(l=.5),a==null&&(a="rgb"),re(r)!=="object"&&(r=y(r)),re(i)!=="object"&&(i=y(i)),h=0,_=E.length;h<_;h++)if(c=E[h],a===c[0]){u=c[1](r,i,l,a);break}if(u==null)throw"color mode "+a+" is not supported";return u.alpha(r.alpha()+l*(i.alpha()-r.alpha()))},y.interpolate=me,e.prototype.interpolate=function(r,i,l){return me(this,r,i,l)},y.mix=me,e.prototype.mix=e.prototype.interpolate,g.rgb=function(){var r,i,l,a;i=se(arguments),l=[];for(r in i)a=i[r],l.push(a);return l},y.rgb=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["rgb"]),function(){})},e.prototype.rgb=function(r){return r==null&&(r=!0),r?this._rgb.map(Math.round).slice(0,3):this._rgb.slice(0,3)},e.prototype.rgba=function(r){return r==null&&(r=!0),r?[Math.round(this._rgb[0]),Math.round(this._rgb[1]),Math.round(this._rgb[2]),this._rgb[3]]:this._rgb.slice(0)},m.push({p:3,test:function(r){var i;if(i=se(arguments),re(i)==="array"&&i.length===3||i.length===4&&re(i[3])==="number"&&i[3]>=0&&i[3]<=1)return"rgb"}}),g.lrgb=g.rgb,De=function(r,i,l,a){var c,_;return c=r._rgb,_=i._rgb,new e(Me(he(c[0],2)*(1-l)+he(_[0],2)*l),Me(he(c[1],2)*(1-l)+he(_[1],2)*l),Me(he(c[2],2)*(1-l)+he(_[2],2)*l),a)},p=function(r){var i,l,a,c,_,h;for(l=1/r.length,h=[0,0,0,0],c=0,a=r.length;c<a;c++)i=r[c],_=i._rgb,h[0]+=he(_[0],2)*l,h[1]+=he(_[1],2)*l,h[2]+=he(_[2],2)*l,h[3]+=_[3]*l;return h[0]=Me(h[0]),h[1]=Me(h[1]),h[2]=Me(h[2]),h[3]>1&&(h[3]=1),new e(ne(h))},E.push(["lrgb",De]),y.average=function(r,i){var l,a,c,_,h,u,b,x,L,T,M,k,z;if(i==null&&(i="rgb"),L=r.length,r=r.map(function(N){return y(N)}),b=r.splice(0,1)[0],i==="lrgb")return p(r);k=b.get(i),_=[],h=0,u=0;for(x in k)k[x]=k[x]||0,_.push(isNaN(k[x])?0:1),i.charAt(x)==="h"&&!isNaN(k[x])&&(l=k[x]/180*n,h+=q(l),u+=Ve(l));for(a=b.alpha(),M=0,T=r.length;M<T;M++){c=r[M],z=c.get(i),a+=c.alpha();for(x in k)isNaN(z[x])||(_[x]+=1,i.charAt(x)==="h"?(l=z[x]/180*n,h+=q(l),u+=Ve(l)):k[x]+=z[x])}for(x in k)if(i.charAt(x)==="h"){for(l=A(u/_[x],h/_[x])/n*180;l<0;)l+=360;for(;l>=360;)l-=360;k[x]=l}else k[x]=k[x]/_[x];return y(k,i).alpha(a/L)},oe=function(r){var i,l,a,c,_,h;if(r.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return(r.length===4||r.length===7)&&(r=r.substr(1)),r.length===3&&(r=r.split(""),r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]),h=parseInt(r,16),c=h>>16,a=h>>8&255,l=h&255,[c,a,l,1];if(r.match(/^#?([A-Fa-f0-9]{8})$/))return r.length===9&&(r=r.substr(1)),h=parseInt(r,16),c=h>>24&255,a=h>>16&255,l=h>>8&255,i=xe((h&255)/255*100)/100,[c,a,l,i];if(g.css!=null&&(_=g.css(r)))return _;throw"unknown color: "+r},lr=function(r,i){var l,a,c,_,h,u,b;return i==null&&(i="auto"),h=r[0],c=r[1],a=r[2],l=r[3],i==="auto"&&(i=l<1?"rgba":"rgb"),h=Math.round(h),c=Math.round(c),a=Math.round(a),b=h<<16|c<<8|a,u="000000"+b.toString(16),u=u.substr(u.length-6),_="0"+xe(l*255).toString(16),_=_.substr(_.length-2),"#"+function(){switch(i.toLowerCase()){case"rgba":return u+_;case"argb":return _+u;default:return u}}()},g.hex=function(r){return oe(r)},y.hex=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["hex"]),function(){})},e.prototype.hex=function(r){return r==null&&(r="auto"),lr(this._rgb,r)},m.push({p:4,test:function(r){if(arguments.length===1&&re(r)==="string")return"hex"}}),Ne=function(){var r,i,l,a,c,_,h,u,b,x,L,T,M,k;if(r=se(arguments),c=r[0],L=r[1],h=r[2],L===0)b=a=i=h*255;else{for(k=[0,0,0],l=[0,0,0],M=h<.5?h*(1+L):h+L-h*L,T=2*h-M,c/=360,k[0]=c+1/3,k[1]=c,k[2]=c-1/3,_=u=0;u<=2;_=++u)k[_]<0&&(k[_]+=1),k[_]>1&&(k[_]-=1),6*k[_]<1?l[_]=T+(M-T)*6*k[_]:2*k[_]<1?l[_]=M:3*k[_]<2?l[_]=T+(M-T)*(2/3-k[_])*6:l[_]=T;x=[xe(l[0]*255),xe(l[1]*255),xe(l[2]*255)],b=x[0],a=x[1],i=x[2]}return r.length>3?[b,a,i,r[3]]:[b,a,i]},ar=function(r,i,l){var a,c,_,h,u;return r!==void 0&&r.length>=3&&(h=r,r=h[0],i=h[1],l=h[2]),r/=255,i/=255,l/=255,_=Math.min(r,i,l),V=Math.max(r,i,l),c=(V+_)/2,V===_?(u=0,a=Number.NaN):u=c<.5?(V-_)/(V+_):(V-_)/(2-V-_),r===V?a=(i-l)/(V-_):i===V?a=2+(l-r)/(V-_):l===V&&(a=4+(r-i)/(V-_)),a*=60,a<0&&(a+=360),[a,u,c]},y.hsl=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["hsl"]),function(){})},g.hsl=Ne,e.prototype.hsl=function(){return ar(this._rgb)},fe=function(){var r,i,l,a,c,_,h,u,b,x,L,T,M,k,z,N,W,Z;if(r=se(arguments),c=r[0],N=r[1],Z=r[2],Z*=255,N===0)b=a=i=Z;else switch(c===360&&(c=0),c>360&&(c-=360),c<0&&(c+=360),c/=60,_=ae(c),l=c-_,h=Z*(1-N),u=Z*(1-N*l),W=Z*(1-N*(1-l)),_){case 0:x=[Z,W,h],b=x[0],a=x[1],i=x[2];break;case 1:L=[u,Z,h],b=L[0],a=L[1],i=L[2];break;case 2:T=[h,Z,W],b=T[0],a=T[1],i=T[2];break;case 3:M=[h,u,Z],b=M[0],a=M[1],i=M[2];break;case 4:k=[W,h,Z],b=k[0],a=k[1],i=k[2];break;case 5:z=[Z,h,u],b=z[0],a=z[1],i=z[2]}return[b,a,i,r.length>3?r[3]:1]},cr=function(){var r,i,l,a,c,_,h,u,b;return h=se(arguments),_=h[0],l=h[1],r=h[2],c=Math.min(_,l,r),V=Math.max(_,l,r),i=V-c,b=V/255,V===0?(a=Number.NaN,u=0):(u=i/V,_===V&&(a=(l-r)/i),l===V&&(a=2+(r-_)/i),r===V&&(a=4+(_-l)/i),a*=60,a<0&&(a+=360)),[a,u,b]},y.hsv=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["hsv"]),function(){})},g.hsv=fe,e.prototype.hsv=function(){return cr(this._rgb)},tr=function(r){var i,l,a;return re(r)==="number"&&r>=0&&r<=16777215?(a=r>>16,l=r>>8&255,i=r&255,[a,l,i,1]):(console.warn("unknown num color: "+r),[0,0,0,1])},dr=function(){var r,i,l,a;return a=se(arguments),l=a[0],i=a[1],r=a[2],(l<<16)+(i<<8)+r},y.num=function(r){return new e(r,"num")},e.prototype.num=function(r){return r==null&&(r="rgb"),dr(this._rgb,r)},g.num=tr,m.push({p:1,test:function(r){if(arguments.length===1&&re(r)==="number"&&r>=0&&r<=16777215)return"num"}}),de=function(){var r,i,l,a,c,_,h,u,b,x,L,T,M,k,z,N,W,Z,ce,D;if(l=se(arguments),u=l[0],c=l[1],i=l[2],c=c/100,h=h/100*255,r=c*255,c===0)T=h=a=i;else switch(u===360&&(u=0),u>360&&(u-=360),u<0&&(u+=360),u/=60,b=ae(u),_=u-b,x=i*(1-c),L=x+r*(1-_),ce=x+r*_,D=x+r,b){case 0:M=[D,ce,x],T=M[0],h=M[1],a=M[2];break;case 1:k=[L,D,x],T=k[0],h=k[1],a=k[2];break;case 2:z=[x,D,ce],T=z[0],h=z[1],a=z[2];break;case 3:N=[x,L,D],T=N[0],h=N[1],a=N[2];break;case 4:W=[ce,x,D],T=W[0],h=W[1],a=W[2];break;case 5:Z=[D,x,L],T=Z[0],h=Z[1],a=Z[2]}return[T,h,a,l.length>3?l[3]:1]},ir=function(){var r,i,l,a,c,_,h,u,b;return b=se(arguments),u=b[0],c=b[1],i=b[2],h=Math.min(u,c,i),V=Math.max(u,c,i),a=V-h,l=a*100/255,r=h/(255-a)*100,a===0?_=Number.NaN:(u===V&&(_=(c-i)/a),c===V&&(_=2+(i-u)/a),i===V&&(_=4+(u-c)/a),_*=60,_<0&&(_+=360)),[_,l,r]},y.hcg=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["hcg"]),function(){})},g.hcg=de,e.prototype.hcg=function(){return ir(this._rgb)},U=function(r){var i,l,a,c,_,h,u,b;if(r=r.toLowerCase(),y.colors!=null&&y.colors[r])return oe(y.colors[r]);if(_=r.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(u=_.slice(1,4),c=h=0;h<=2;c=++h)u[c]=+u[c];u[3]=1}else if(_=r.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(u=_.slice(1,5),c=b=0;b<=3;c=++b)u[c]=+u[c];else if(_=r.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(u=_.slice(1,4),c=i=0;i<=2;c=++i)u[c]=xe(u[c]*2.55);u[3]=1}else if(_=r.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(u=_.slice(1,5),c=l=0;l<=2;c=++l)u[c]=xe(u[c]*2.55);u[3]=+u[3]}else(_=r.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(a=_.slice(1,4),a[1]*=.01,a[2]*=.01,u=Ne(a),u[3]=1):(_=r.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(a=_.slice(1,4),a[1]*=.01,a[2]*=.01,u=Ne(a),u[3]=+_[4]);return u},sr=function(r){var i;if(i=r[3]<1?"rgba":"rgb",i==="rgb")return i+"("+r.slice(0,3).map(xe).join(",")+")";if(i==="rgba")return i+"("+r.slice(0,3).map(xe).join(",")+","+r[3]+")"},wt=function(r){return xe(r*100)/100},we=function(r,i){var l;return l=i<1?"hsla":"hsl",r[0]=wt(r[0]||0),r[1]=wt(r[1]*100)+"%",r[2]=wt(r[2]*100)+"%",l==="hsla"&&(r[3]=i),l+"("+r.join(",")+")"},g.css=function(r){return U(r)},y.css=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["css"]),function(){})},e.prototype.css=function(r){if(r==null&&(r="rgb"),r.slice(0,3)==="rgb")return sr(this._rgb);if(r.slice(0,3)==="hsl")return we(this.hsl(),this.alpha())},g.named=function(r){return oe(Ie[r])},m.push({p:5,test:function(r){if(arguments.length===1&&Ie[r]!=null)return"named"}}),e.prototype.name=function(r){var i,l;arguments.length&&(Ie[r]&&(this._rgb=oe(Ie[r])),this._rgb[3]=1),i=this.hex("rgb");for(l in Ie)if(i===Ie[l])return l;return i},be=function(){var r,i,l,a;return a=se(arguments),l=a[0],r=a[1],i=a[2],i=i*t,[l,q(i)*r,Ve(i)*r]},ye=function(){var r,i,l,a,c,_,h,u,b,x,L;return l=se(arguments),u=l[0],c=l[1],h=l[2],x=be(u,c,h),r=x[0],i=x[1],a=x[2],L=He(r,i,a),b=L[0],_=L[1],a=L[2],[b,_,a,l.length>3?l[3]:1]},ze=function(){var r,i,l,a,c,_;return _=se(arguments),c=_[0],r=_[1],i=_[2],l=Me(r*r+i*i),a=(A(i,r)*d+360)%360,xe(l*1e4)===0&&(a=Number.NaN),[c,l,a]},Wt=function(){var r,i,l,a,c,_,h;return _=se(arguments),c=_[0],l=_[1],i=_[2],h=Pt(c,l,i),a=h[0],r=h[1],i=h[2],ze(a,r,i)},y.lch=function(){var r;return r=se(arguments),new e(r,"lch")},y.hcl=function(){var r;return r=se(arguments),new e(r,"hcl")},g.lch=ye,g.hcl=function(){var r,i,l,a;return a=se(arguments),i=a[0],r=a[1],l=a[2],ye([l,r,i])},e.prototype.lch=function(){return Wt(this._rgb)},e.prototype.hcl=function(){return Wt(this._rgb).reverse()},or=function(r){var i,l,a,c,_,h,u,b,x;return r==null&&(r="rgb"),b=se(arguments),u=b[0],c=b[1],i=b[2],u=u/255,c=c/255,i=i/255,_=1-Math.max(u,Math.max(c,i)),a=_<1?1/(1-_):0,l=(1-u-_)*a,h=(1-c-_)*a,x=(1-i-_)*a,[l,h,x,_]},I=function(){var r,i,l,a,c,_,h,u,b;return i=se(arguments),a=i[0],h=i[1],b=i[2],_=i[3],r=i.length>4?i[4]:1,_===1?[0,0,0,r]:(u=a>=1?0:255*(1-a)*(1-_),c=h>=1?0:255*(1-h)*(1-_),l=b>=1?0:255*(1-b)*(1-_),[u,c,l,r])},g.cmyk=function(){return I(se(arguments))},y.cmyk=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["cmyk"]),function(){})},e.prototype.cmyk=function(){return or(this._rgb)},g.gl=function(){var r,i,l,a,c;for(a=function(){var _,h;_=se(arguments),h=[];for(i in _)c=_[i],h.push(c);return h}.apply(this,arguments),r=l=0;l<=2;r=++l)a[r]*=255;return a},y.gl=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["gl"]),function(){})},e.prototype.gl=function(){var r;return r=this._rgb,[r[0]/255,r[1]/255,r[2]/255,r[3]]},Ft=function(r,i,l){var a;return a=se(arguments),r=a[0],i=a[1],l=a[2],r=yt(r),i=yt(i),l=yt(l),.2126*r+.7152*i+.0722*l},yt=function(r){return r/=255,r<=.03928?r/12.92:he((r+.055)/1.055,2.4)},Le=function(r,i,l,a){var c,_;return c=r._rgb,_=i._rgb,new e(c[0]+l*(_[0]-c[0]),c[1]+l*(_[1]-c[1]),c[2]+l*(_[2]-c[2]),a)},E.push(["rgb",Le]),e.prototype.luminance=function(r,i){var l,a,c,_,h;return i==null&&(i="rgb"),arguments.length?(_=this._rgb,r===0?_=[0,0,0,this._rgb[3]]:r===1?_=[255,255,255,this[3]]:(l=Ft(this._rgb),a=1e-7,c=20,h=function(u,b){var x,L;return L=u.interpolate(b,.5,i),x=L.luminance(),Math.abs(r-x)<a||!c--?L:x>r?h(u,L):h(L,b)},l>r?_=h(y("black"),this).rgba():_=h(this,y("white")).rgba()),y(_).alpha(this.alpha())):Ft(this._rgb)},Ut=function(r){var i,l,a,c;return c=r/100,c<66?(a=255,l=-155.25485562709179-.44596950469579133*(l=c-2)+104.49216199393888*je(l),i=c<20?0:-254.76935184120902+.8274096064007395*(i=c-10)+115.67994401066147*je(i)):(a=351.97690566805693+.114206453784165*(a=c-55)-40.25366309332127*je(a),l=325.4494125711974+.07943456536662342*(l=c-50)-28.0852963507957*je(l),i=255),[a,l,i]},_r=function(){var r,i,l,a,c,_,h,u,b;for(h=se(arguments),_=h[0],l=h[1],r=h[2],c=1e3,a=4e4,i=.4;a-c>i;)b=(a+c)*.5,u=Ut(b),u[2]/u[0]>=r/_?a=b:c=b;return xe(b)},y.temperature=y.kelvin=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["temperature"]),function(){})},g.temperature=g.kelvin=g.K=Ut,e.prototype.temperature=function(){return _r(this._rgb)},e.prototype.kelvin=e.prototype.temperature,y.contrast=function(r,i){var l,a,c,_;return((c=re(r))==="string"||c==="number")&&(r=new e(r)),((_=re(i))==="string"||_==="number")&&(i=new e(i)),l=r.luminance(),a=i.luminance(),l>a?(l+.05)/(a+.05):(a+.05)/(l+.05)},y.distance=function(r,i,l){var a,c,_,h,u,b,x;l==null&&(l="lab"),((u=re(r))==="string"||u==="number")&&(r=new e(r)),((b=re(i))==="string"||b==="number")&&(i=new e(i)),_=r.get(l),h=i.get(l),x=0;for(c in _)a=(_[c]||0)-(h[c]||0),x+=a*a;return Math.sqrt(x)},y.deltaE=function(r,i,l,a){var c,_,h,u,b,x,L,T,M,k,z,N,W,Z,ce,D,Ce,ke,$,Q,pe,v,O,G,Y,H,X;for(l==null&&(l=1),a==null&&(a=1),((Ce=re(r))==="string"||Ce==="number")&&(r=new e(r)),((ke=re(i))==="string"||ke==="number")&&(i=new e(i)),$=r.lab(),c=$[0],h=$[1],b=$[2],Q=i.lab(),_=Q[0],u=Q[1],x=Q[2],L=Me(h*h+b*b),T=Me(u*u+x*x),O=c<16?.511:.040975*c/(1+.01765*c),pe=.0638*L/(1+.0131*L)+.638,D=L<1e-6?0:A(b,h)*180/n;D<0;)D+=360;for(;D>=360;)D-=360;return G=D>=164&&D<=345?.56+C(.2*q(n*(D+168)/180)):.36+C(.4*q(n*(D+35)/180)),M=L*L*L*L,ce=Me(M/(M+1900)),v=pe*(ce*G+1-ce),Z=c-_,W=L-T,z=h-u,N=b-x,k=z*z+N*N-W*W,Y=Z/(l*O),H=W/(a*pe),X=v,Me(Y*Y+H*H+k/(X*X))},e.prototype.get=function(r){var i,l,a,c,_,h;return a=this,_=r.split("."),c=_[0],i=_[1],h=a[c](),i?(l=c.indexOf(i),l>-1?h[l]:console.warn("unknown channel "+i+" in mode "+c)):h},e.prototype.set=function(r,i){var l,a,c,_,h,u;if(c=this,h=r.split("."),_=h[0],l=h[1],l)if(u=c[_](),a=_.indexOf(l),a>-1)if(re(i)==="string")switch(i.charAt(0)){case"+":u[a]+=+i;break;case"-":u[a]+=+i;break;case"*":u[a]*=+i.substr(1);break;case"/":u[a]/=+i.substr(1);break;default:u[a]=+i}else u[a]=i;else console.warn("unknown channel "+l+" in mode "+_);else u=i;return y(u,_).alpha(c.alpha())},e.prototype.clipped=function(){return this._rgb._clipped||!1},e.prototype.alpha=function(r){return arguments.length?y.rgb([this._rgb[0],this._rgb[1],this._rgb[2],r]):this._rgb[3]},e.prototype.darken=function(r){var i,l;return r==null&&(r=1),l=this,i=l.lab(),i[0]-=o.Kn*r,y.lab(i).alpha(l.alpha())},e.prototype.brighten=function(r){return r==null&&(r=1),this.darken(-r)},e.prototype.darker=e.prototype.darken,e.prototype.brighter=e.prototype.brighten,e.prototype.saturate=function(r){var i,l;return r==null&&(r=1),l=this,i=l.lch(),i[1]+=r*o.Kn,i[1]<0&&(i[1]=0),y.lch(i).alpha(l.alpha())},e.prototype.desaturate=function(r){return r==null&&(r=1),this.saturate(-r)},e.prototype.premultiply=function(){var r,i;return i=this.rgb(),r=this.alpha(),y(i[0]*r,i[1]*r,i[2]*r,r)},P=function(r,i,l){if(!P[l])throw"unknown blend mode "+l;return P[l](r,i)},R=function(r){return function(i,l){var a,c;return a=y(l).rgb(),c=y(i).rgb(),y(r(a,c),"rgb")}},K=function(r){return function(i,l){var a,c,_;for(_=[],a=c=0;c<=3;a=++c)_[a]=r(i[a],l[a]);return _}},er=function(r,i){return r},Qt=function(r,i){return r*i/255},F=function(r,i){return r>i?i:r},Jt=function(r,i){return r>i?r:i},ur=function(r,i){return 255*(1-(1-r/255)*(1-i/255))},rr=function(r,i){return i<128?2*r*i/255:255*(1-2*(1-r/255)*(1-i/255))},j=function(r,i){return 255*(1-(1-i/255)/(r/255))},le=function(r,i){return r===255||(r=255*(i/255)/(1-r/255),r>255)?255:r},P.normal=R(K(er)),P.multiply=R(K(Qt)),P.screen=R(K(ur)),P.overlay=R(K(rr)),P.darken=R(K(F)),P.lighten=R(K(Jt)),P.dodge=R(K(le)),P.burn=R(K(j)),y.blend=P,y.analyze=function(r){var i,l,a,c;for(a={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},l=0,i=r.length;l<i;l++)c=r[l],c!=null&&!isNaN(c)&&(a.values.push(c),a.sum+=c,c<a.min&&(a.min=c),c>a.max&&(a.max=c),a.count+=1);return a.domain=[a.min,a.max],a.limits=function(_,h){return y.limits(a,_,h)},a},y.scale=function(r,i){var l,a,c,_,h,u,b,x,L,T,M,k,z,N,W,Z,ce,D,Ce,ke,$,Q,pe;return T="rgb",M=y("#ccc"),W=0,u=!1,h=[0,1],N=[],z=[0,0],l=!1,c=[],k=!1,L=0,x=1,_=!1,a={},Z=!0,b=1,Q=function(v){var O,G,Y,H,X,te;if(v==null&&(v=["#fff","#000"]),v!=null&&re(v)==="string"&&y.brewer!=null&&(v=y.brewer[v]||y.brewer[v.toLowerCase()]||v),re(v)==="array"){for(v.length===1&&(v=[v[0],v[0]]),v=v.slice(0),O=Y=0,H=v.length-1;0<=H?Y<=H:Y>=H;O=0<=H?++Y:--Y)G=v[O],re(G)==="string"&&(v[O]=y(G));for(N.length=0,O=te=0,X=v.length-1;0<=X?te<=X:te>=X;O=0<=X?++te:--te)N.push(O/(v.length-1))}return $(),c=v},Ce=function(v){var O,G;if(l!=null){for(G=l.length-1,O=0;O<G&&v>=l[O];)O++;return O-1}return 0},pe=function(v){return v},ce=function(v){var O,G,Y,H,X;return X=v,l.length>2&&(H=l.length-1,O=Ce(v),Y=l[0]+(l[1]-l[0])*(0+W*.5),G=l[H-1]+(l[H]-l[H-1])*(1-W*.5),X=L+(l[O]+(l[O+1]-l[O])*.5-Y)/(G-Y)*(x-L)),X},ke=function(v,O){var G,Y,H,X,te,ee,_e,J;if(O==null&&(O=!1),isNaN(v)||v===null)return M;if(O?J=v:l&&l.length>2?(G=Ce(v),J=G/(l.length-2)):x!==L?J=(v-L)/(x-L):J=1,O||(J=pe(J)),b!==1&&(J=he(J,b)),J=z[0]+J*(1-z[0]-z[1]),J=Math.min(1,Math.max(0,J)),X=Math.floor(J*1e4),Z&&a[X])Y=a[X];else{if(re(c)==="array")for(H=te=0,_e=N.length-1;0<=_e?te<=_e:te>=_e;H=0<=_e?++te:--te){if(ee=N[H],J<=ee){Y=c[H];break}if(J>=ee&&H===N.length-1){Y=c[H];break}if(J>ee&&J<N[H+1]){J=(J-ee)/(N[H+1]-ee),Y=y.interpolate(c[H],c[H+1],J,T);break}}else re(c)==="function"&&(Y=c(J));Z&&(a[X]=Y)}return Y},$=function(){return a={}},Q(r),D=function(v){var O;return O=y(ke(v)),k&&O[k]?O[k]():O},D.classes=function(v){var O;return v!=null?(re(v)==="array"?(l=v,h=[v[0],v[v.length-1]]):(O=y.analyze(h),v===0?l=[O.min,O.max]:l=y.limits(O,"e",v)),D):l},D.domain=function(v){var O,G,Y,H,X,te,ee;if(!arguments.length)return h;if(L=v[0],x=v[v.length-1],N=[],Y=c.length,v.length===Y&&L!==x)for(X=0,H=v.length;X<H;X++)G=v[X],N.push((G-L)/(x-L));else for(O=ee=0,te=Y-1;0<=te?ee<=te:ee>=te;O=0<=te?++ee:--ee)N.push(O/(Y-1));return h=[L,x],D},D.mode=function(v){return arguments.length?(T=v,$(),D):T},D.range=function(v,O){return Q(v,O),D},D.out=function(v){return k=v,D},D.spread=function(v){return arguments.length?(W=v,D):W},D.correctLightness=function(v){return v==null&&(v=!0),_=v,$(),_?pe=function(O){var G,Y,H,X,te,ee,_e,J,ue;for(G=ke(0,!0).lab()[0],Y=ke(1,!0).lab()[0],_e=G>Y,H=ke(O,!0).lab()[0],te=G+(Y-G)*O,X=H-te,J=0,ue=1,ee=20;Math.abs(X)>.01&&ee-- >0;)(function(){return _e&&(X*=-1),X<0?(J=O,O+=(ue-O)*.5):(ue=O,O+=(J-O)*.5),H=ke(O,!0).lab()[0],X=H-te})();return O}:pe=function(O){return O},D},D.padding=function(v){return v!=null?(re(v)==="number"&&(v=[v,v]),z=v,D):z},D.colors=function(v,O){var G,Y,H,X,te,ee,_e,J,ue;if(arguments.length<2&&(O="hex"),ee=[],arguments.length===0)ee=c.slice(0);else if(v===1)ee=[D(.5)];else if(v>1)Y=h[0],G=h[1]-Y,ee=function(){_e=[];for(var ge=0;0<=v?ge<v:ge>v;0<=v?ge++:ge--)_e.push(ge);return _e}.apply(this).map(function(ge){return D(Y+ge/(v-1)*G)});else{if(r=[],J=[],l&&l.length>2)for(H=ue=1,te=l.length;1<=te?ue<te:ue>te;H=1<=te?++ue:--ue)J.push((l[H-1]+l[H])*.5);else J=h;ee=J.map(function(ge){return D(ge)})}return y[O]&&(ee=ee.map(function(ge){return ge[O]()})),ee},D.cache=function(v){return v!=null?(Z=v,D):Z},D.gamma=function(v){return v!=null?(b=v,D):b},D.nodata=function(v){return v!=null?(M=y(v),D):M},D},y.scales==null&&(y.scales={}),y.scales.cool=function(){return y.scale([y.hsl(180,1,.9),y.hsl(250,.7,.4)])},y.scales.hot=function(){return y.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},y.analyze=function(r,i,l){var a,c,_,h,u,b,x;if(u={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},l==null&&(l=function(){return!0}),a=function(L){L!=null&&!isNaN(L)&&(u.values.push(L),u.sum+=L,L<u.min&&(u.min=L),L>u.max&&(u.max=L),u.count+=1)},x=function(L,T){if(l(L,T))return i!=null&&re(i)==="function"?a(i(L)):i!=null&&re(i)==="string"||re(i)==="number"?a(L[i]):a(L)},re(r)==="array")for(h=0,_=r.length;h<_;h++)b=r[h],x(b);else for(c in r)b=r[c],x(b,c);return u.domain=[u.min,u.max],u.limits=function(L,T){return y.limits(u,L,T)},u},y.limits=function(r,i,l){var a,c,_,h,u,b,x,L,T,M,k,z,N,W,Z,ce,D,Ce,ke,$,Q,pe,v,O,G,Y,H,X,te,ee,_e,J,ue,ge,Xe,Ke,Je,Ze,Qe,et,pr,tt,rt,ot,st,it,lt,nt,at,ct,go,Pe,Et,gr,Ae,dt;if(i==null&&(i="equal"),l==null&&(l=7),re(r)==="array"&&(r=y.analyze(r)),G=r.min,V=r.max,go=r.sum,Ae=r.values.sort(function(Ht,jt){return Ht-jt}),l===1)return[G,V];if(v=[],i.substr(0,1)==="c"&&(v.push(G),v.push(V)),i.substr(0,1)==="e"){for(v.push(G),$=_e=1,Xe=l-1;1<=Xe?_e<=Xe:_e>=Xe;$=1<=Xe?++_e:--_e)v.push(G+$/l*(V-G));v.push(V)}else if(i.substr(0,1)==="l"){if(G<=0)throw"Logarithmic scales are only possible for values > 0";for(Y=Math.LOG10E*je(G),O=Math.LOG10E*je(V),v.push(G),$=dt=1,Ke=l-1;1<=Ke?dt<=Ke:dt>=Ke;$=1<=Ke?++dt:--dt)v.push(he(10,Y+$/l*(O-Y)));v.push(V)}else if(i.substr(0,1)==="q"){for(v.push(G),$=a=1,tt=l-1;1<=tt?a<=tt:a>=tt;$=1<=tt?++a:--a)J=(Ae.length-1)*$/l,ue=ae(J),ue===J?v.push(Ae[ue]):(ge=J-ue,v.push(Ae[ue]*(1-ge)+Ae[ue+1]*ge));v.push(V)}else if(i.substr(0,1)==="k"){for(X=Ae.length,W=new Array(X),Ce=new Array(l),ct=!0,te=0,ce=null,ce=[],ce.push(G),$=c=1,rt=l-1;1<=rt?c<=rt:c>=rt;$=1<=rt?++c:--c)ce.push(G+$/l*(V-G));for(ce.push(V);ct;){for(Q=_=0,ot=l-1;0<=ot?_<=ot:_>=ot;Q=0<=ot?++_:--_)Ce[Q]=0;for($=h=0,st=X-1;0<=st?h<=st:h>=st;$=0<=st?++h:--h){for(gr=Ae[$],H=Number.MAX_VALUE,Q=u=0,it=l-1;0<=it?u<=it:u>=it;Q=0<=it?++u:--u)ke=C(ce[Q]-gr),ke<H&&(H=ke,Z=Q);Ce[Z]++,W[$]=Z}for(ee=new Array(l),Q=b=0,lt=l-1;0<=lt?b<=lt:b>=lt;Q=0<=lt?++b:--b)ee[Q]=null;for($=x=0,nt=X-1;0<=nt?x<=nt:x>=nt;$=0<=nt?++x:--x)D=W[$],ee[D]===null?ee[D]=Ae[$]:ee[D]+=Ae[$];for(Q=L=0,at=l-1;0<=at?L<=at:L>=at;Q=0<=at?++L:--L)ee[Q]*=1/Ce[Q];for(ct=!1,Q=T=0,Je=l-1;0<=Je?T<=Je:T>=Je;Q=0<=Je?++T:--T)if(ee[Q]!==ce[$]){ct=!0;break}ce=ee,te++,te>200&&(ct=!1)}for(pe={},Q=M=0,Ze=l-1;0<=Ze?M<=Ze:M>=Ze;Q=0<=Ze?++M:--M)pe[Q]=[];for($=k=0,Qe=X-1;0<=Qe?k<=Qe:k>=Qe;$=0<=Qe?++k:--k)D=W[$],pe[D].push(Ae[$]);for(Pe=[],Q=z=0,et=l-1;0<=et?z<=et:z>=et;Q=0<=et?++z:--z)Pe.push(pe[Q][0]),Pe.push(pe[Q][pe[Q].length-1]);for(Pe=Pe.sort(function(Ht,jt){return Ht-jt}),v.push(Pe[0]),$=N=1,pr=Pe.length-1;N<=pr;$=N+=2)Et=Pe[$],!isNaN(Et)&&v.indexOf(Et)===-1&&v.push(Et)}return v},ie=function(r,i,l){var a,c,_,h;return a=se(arguments),r=a[0],i=a[1],l=a[2],isNaN(r)&&(r=0),r/=360,r<1/3?(c=(1-i)/3,h=(1+i*q(f*r)/q(s-f*r))/3,_=1-(c+h)):r<2/3?(r-=1/3,h=(1-i)/3,_=(1+i*q(f*r)/q(s-f*r))/3,c=1-(h+_)):(r-=2/3,_=(1-i)/3,c=(1+i*q(f*r)/q(s-f*r))/3,h=1-(_+c)),h=bt(l*h*3),_=bt(l*_*3),c=bt(l*c*3),[h*255,_*255,c*255,a.length>3?a[3]:1]},nr=function(){var r,i,l,a,c,_,h,u;return h=se(arguments),_=h[0],i=h[1],r=h[2],f=Math.PI*2,_/=255,i/=255,r/=255,c=Math.min(_,i,r),a=(_+i+r)/3,u=1-c/a,u===0?l=0:(l=(_-i+(_-r))/2,l/=Math.sqrt((_-i)*(_-i)+(_-r)*(i-r)),l=Math.acos(l),r>i&&(l=f-l),l/=f),[l*360,u,a]},y.hsi=function(){return function(r,i,l){l.prototype=r.prototype;var a=new l,c=r.apply(a,i);return Object(c)===c?c:a}(e,Oe.call(arguments).concat(["hsi"]),function(){})},g.hsi=ie,e.prototype.hsi=function(){return nr(this._rgb)},Re=function(r,i,l,a){var c,_,h,u,b,x,L,T,M,k,z,N,W;return a==="hsl"?(N=r.hsl(),W=i.hsl()):a==="hsv"?(N=r.hsv(),W=i.hsv()):a==="hcg"?(N=r.hcg(),W=i.hcg()):a==="hsi"?(N=r.hsi(),W=i.hsi()):(a==="lch"||a==="hcl")&&(a="hcl",N=r.hcl(),W=i.hcl()),a.substr(0,1)==="h"&&(h=N[0],k=N[1],x=N[2],u=W[0],z=W[1],L=W[2]),!isNaN(h)&&!isNaN(u)?(u>h&&u-h>180?c=u-(h+360):u<h&&h-u>180?c=u+360-h:c=u-h,_=h+l*c):isNaN(h)?isNaN(u)?_=Number.NaN:(_=u,(x===1||x===0)&&a!=="hsv"&&(M=z)):(_=h,(L===1||L===0)&&a!=="hsv"&&(M=k)),M==null&&(M=k+l*(z-k)),b=x+l*(L-x),T=y[a](_,M,b)},E=E.concat(function(){var r,i,l,a;for(l=["hsv","hsl","hsi","hcl","lch","hcg"],a=[],i=0,r=l.length;i<r;i++)Zt=l[i],a.push([Zt,Re]);return a}()),Be=function(r,i,l,a){var c,_;return c=r.num(),_=i.num(),y.num(c+(_-c)*l,"num")},E.push(["num",Be]),Te=function(r,i,l,a){var c,_,h;return _=r.lab(),h=i.lab(),c=new e(_[0]+l*(h[0]-_[0]),_[1]+l*(h[1]-_[1]),_[2]+l*(h[2]-_[2]),a)},E.push(["lab",Te])}).call(_t)});var Ge=new WeakMap,br=!0,Eo=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Lo=Eo?5e6:1e7,Mt=0,qe=0,yr=performance.now();function Mo(){let e=performance.now(),t=e-yr,o=Mt,n=qe*1e3/t,s=1e3/o,d=qe;return Mt=0,qe=0,yr=e,{avg:o,real_fps:n,virtual_fps:s,num_frames:d,elapsed:t}}function So(e){Mt=(Mt*qe+e)/(qe+1),qe+=1}var xr=(e,...t)=>e.map((o,n)=>[o,t[n]]).flat().filter(o=>!!o).join(""),zo=()=>{let e,t=new Promise(o=>{e=o});return t.resolve=e,t},We=new Map;async function Oo(e){return await new Promise(requestAnimationFrame),await We.get(e)}async function kr(e,t){if(We.has(e)&&(await We.get(e),We.has(e))){await We.get(e);return}We.set(e,zo());try{return await t()}finally{let o=We.get(e);We.delete(e),o.resolve()}}var Co=":host{position:absolute;top:0px;left:0px;right:0px;bottom:0px;overflow:scroll;overflow-anchor:none;overscroll-behavior:none;-webkit-overflow-scrolling:touch;}div.rt-virtual-panel{position:absolute;top:0;left:0;right:0;pointer-events:none;}div.rt-scroll-table-clip{position:sticky;contain:strict;overflow-anchor:none;width:100%;height:100%;}div.rt-tree-container{display:flex;align-items:center;height:100%;}slot{position:absolute;overflow:hidden;overflow-anchor:none;}",No=":host ::slotted(table){--regular-table--transform-x:0px;--regular-table--transform-y:0px;--regular-table--clip-x:0px;--regular-table--clip-y:0px;}",Ao=class extends HTMLElement{create_shadow_dom(){this.attachShadow({mode:"open"});let e="<slot></slot>";this.shadowRoot.innerHTML=xr` <style> ${Co} </style> <style> ${No} </style> <div class="rt-virtual-panel"></div> <div class="rt-scroll-table-clip">${e}</div> `;let[,t,o,n]=this.shadowRoot.children;this._sub_cell_style=t,this._table_clip=n,this._virtual_panel=o,this._setup_virtual_scroll()}_setup_virtual_scroll(){this._table_clip&&(this._virtual_mode==="both"||this._virtual_mode==="vertical"?this._table_clip.style.top="0px":this._table_clip.style.removeProperty("top"),this._virtual_mode==="both"||this._virtual_mode==="horizontal"?this._table_clip.style.left="0px":this._table_clip.style.removeProperty("left"),this._virtual_mode!=="both"?this._table_clip.style.contain="none":this._table_clip.style.removeProperty("contain"))}_calculate_viewport(e,t){let{start_row:o,end_row:n}=this._calculate_row_range(e),{start_col:s,end_col:d}=this._calculate_column_range(t);return this._nrows=e,{start_col:s,end_col:d,start_row:o,end_row:n}}_calculate_row_range(e){let{height:t}=this._container_size,o=this._column_sizes.row_height||19,n=this._view_cache.config.column_pivots.length,s=Math.max(1,this._virtual_panel.offsetHeight-t),d=Math.max(Math.ceil(this.scrollTop),0)/s,f=t/o-n,p=Math.max(0,(e||0)-f)*d,m=Math.max(0,Math.min(p+f,e));return{start_row:p,end_row:m}}_calc_start_column(){let e=this._view_cache.config.row_pivots.length,t=0,o=0,n=0;for(;o<this.scrollLeft;){let s=this._column_sizes.indices[t+e];n=this.scrollLeft-o,t+=1,o+=s!==void 0?s:60}return t+=n/(this._column_sizes.indices[t+e-1]||60),Math.max(0,t-1)}_calculate_column_range(e){if(this._virtual_mode==="none"||this._virtual_mode==="vertical")return{start_col:0,end_col:1/0};{let t=this._calc_start_column(),o=this.table_model.num_columns()||Math.min(e,Math.ceil(this._container_size.width/60)),n=t+o+1;return{start_col:t,end_col:n}}}_max_scroll_column(e){let t=0;if(this._view_cache.config.row_pivots.length>0)for(let s of this._column_sizes.indices.slice(0,this._view_cache.config.row_pivots.length))t+=s;let o=this._view_cache.config.row_pivots.length,n=e;for(;t<this._container_size.width&&n>=0;)n--,t+=this._column_sizes.indices[n+o]||60;return Math.min(e-1,n+1)}_validate_viewport({start_col:e,end_col:t,start_row:o,end_row:n}){o=Math.floor(o),n=Math.ceil(n),e=Math.floor(e),t=Math.ceil(t);let s=this._start_col!==e,d=this._start_row!==o||this._end_row!==n||this._end_col!==t;return this._start_col=e,this._end_col=t,this._start_row=o,this._end_row=n,{invalid_column:s,invalid_row:d}}_calc_scrollable_column_width(e){let t=this._view_cache.config.row_pivots.length,o=this._max_scroll_column(e),n=t,s=0;for(;n<o+t;)s+=this._column_sizes.indices[n]||60,n++;if(n<this._column_sizes.indices.length){let d=this._column_sizes.indices.slice(0,this._view_cache.config.row_pivots.length).reduce((f,p)=>f+p,0);s+=Math.max(0,this._column_sizes.indices[n]-(this._container_size.width-d)||0)}return s}_update_virtual_panel_width(e,t){if(e)if(this._virtual_mode==="vertical"||this._virtual_mode==="none")this._virtual_panel.style.width=this._column_sizes.indices.reduce((o,n)=>o+n,0)+"px";else{let o=this._calc_scrollable_column_width(t);if(o!==0){let n=this._container_size.width+o+2;this._virtual_panel.style.width=n+"px"}else this._virtual_panel.style.width="1px"}}_update_virtual_panel_height(e){let{row_height:t=19}=this._column_sizes,o=this._view_cache.config.column_pivots.length*t,n;n=Math.min(Lo,e*t+o),this._virtual_panel.style.height=`${n}px`}async draw(e={}){return typeof e.throttle<"u"&&!e.throttle?await vr.call(this,e):await kr(this,()=>vr.call(this,e))}async _draw_flush(){await Oo(this)}update_sub_cell_offset(e){let t=this._column_sizes.row_height*(e.start_row%1)||0,o=this._column_sizes.indices[(this.table_model._row_headers_length||0)+Math.floor(e.start_col)]*(e.start_col%1)||0,n=this._sub_cell_style.sheet?.cssRules[0].style;n&&(n.setProperty("--regular-table--clip-x",`${o}px`),n.setProperty("--regular-table--clip-y",`${t}px`),n.setProperty("--regular-table--transform-x",`-${o}px`),n.setProperty("--regular-table--transform-y",`-${t}px`))}};async function vr(e){let t=br&&performance.now(),{invalid_viewport:o=!0,preserve_width:n=!1}=e,{num_columns:s,num_rows:d,num_row_headers:f,num_column_headers:p,row_height:m}=await this._view_cache.view(0,0,0,0);f!==void 0&&(this._view_cache.row_pivots=Array(f).fill(0)),p!==void 0&&(this._view_cache.column_pivots=Array(p).fill(0)),this._container_size={width:this._virtual_mode==="none"||this._virtual_mode==="vertical"?1/0:this._table_clip.clientWidth,height:this._virtual_mode==="none"||this._virtual_mode==="horizontal"?1/0:this._table_clip.clientHeight},this._update_virtual_panel_height(d),n||this._update_virtual_panel_width(o,s);let w=this._calculate_viewport(d,s),{invalid_row:g,invalid_column:E}=this._validate_viewport(w);if(this._invalid_schema||g||E||o){let C=[],A=!0;for await(let S of this.table_model.draw(this._container_size,this._view_cache,this._selected_id,n,w,s)){S!==void 0&&(C=C.concat(S)),A&&(this.update_sub_cell_offset(w),A=!1),this._is_styling=!0;let P=this._style_callbacks;for(let R of P)await R({detail:this});if(this._is_styling=!1,!this._invalidated&&S!==void 0)break;this._invalidated=!1}this.table_model.autosize_cells(C,m),this.table_model.header.reset_header_cache(),n||this._update_virtual_panel_width(this._invalid_schema||E,s),this._invalid_schema=!1}else this.update_sub_cell_offset(w);br&&So(performance.now()-t)}var Ro=!1,To=class extends Ao{register_listeners(){this.addEventListener("mousedown",this._on_click_or_dblclick.bind(this)),this.addEventListener("scroll",this._on_scroll.bind(this),{passive:!0}),this._register_glitch_scroll_listeners()}async _on_scroll(e){e.stopPropagation(),await this.draw({invalid_viewport:!1}),this.dispatchEvent(new CustomEvent("regular-table-scroll"))}_register_glitch_scroll_listeners(){this.addEventListener("mousewheel",this._on_mousewheel.bind(this),{passive:!0}),Ro&&(this.addEventListener("touchmove",this._on_touchmove.bind(this)),this.addEventListener("touchstart",this._on_touchstart.bind(this),{passive:!0}))}_on_mousewheel(e){if(!window.safari)return;let{clientWidth:t,clientHeight:o,scrollTop:n,scrollLeft:s}=this;e.preventDefault(),e.returnValue=!1;let d=Math.max(1,this._virtual_panel.offsetHeight-o),f=Math.max(1,this._virtual_panel.offsetWidth-t);this.scrollTop=Math.max(0,Math.min(d,n+e.deltaY)),this.scrollLeft=Math.max(0,Math.min(f,s+e.deltaX)),this._on_scroll(e)}_on_touchmove(e){e.stopPropagation(),e.preventDefault(),e.returnValue=!1;let{clientWidth:t,clientHeight:o}=this,n=Math.max(1,this._virtual_panel.offsetHeight-o),s=Math.max(1,this._virtual_panel.offsetWidth-t);this.scrollTop=Math.min(n,this._memo_scroll_top+(this._memo_touch_startY-e.touches[0].pageY)),this.scrollLeft=Math.min(s,this._memo_scroll_left+(this._memo_touch_startX-e.touches[0].pageX)),this._on_scroll(e)}_on_touchstart(e){this._memo_touch_startY=e.touches[0].pageY,this._memo_touch_startX=e.touches[0].pageX,this._memo_scroll_top=this.scrollTop,this._memo_scroll_left=this.scrollLeft}async _on_dblclick(e){let t=e.target;for(;t.tagName!=="TD"&&t.tagName!=="TH";)if(t=t.parentElement,!this.contains(t))return;let o=e.target.classList.contains("rt-column-resize"),n=Ge.get(t);if(o){e.stopImmediatePropagation(),t.style.minWidth="",t.style.maxWidth="",e.shiftKey?(this._column_sizes.override=[],this._column_sizes.auto=[],this._column_sizes.indices=[]):(this._column_sizes.override[n.size_key]=void 0,this._column_sizes.auto[n.size_key]=void 0,this._column_sizes.indices[n.size_key]=void 0);for(let s of e.shiftKey?[this.table_model.header.cells[this.table_model.header.cells.length-1],...this.table_model.body.cells]:this.table_model.body.cells)for(let d of e.shiftKey?s:[s[n._virtual_x]])d&&(d.style.minWidth="",d.style.maxWidth="",d.classList.remove("rt-cell-clip"));await this.draw()}}async _on_click(e){if(e.button!==0)return;let t=e.target;for(;t.tagName!=="TD"&&t.tagName!=="TH";)if(t=t.parentElement,!this.contains(t))return;let o=e.target.classList.contains("rt-column-resize"),n=Ge.get(t);o&&(this._on_resize_column(e,t,n),e.stopImmediatePropagation())}async _on_click_or_dblclick(e){let t=performance.now();this._last_clicked_time&&t-this._last_clicked_time<500?(this._last_clicked_time=t,await this._on_dblclick(e)):(this._last_clicked_time=t,await this._on_click(e))}_on_resize_column(e,t,o){let{_virtual_x:n,size_key:s}=o,d=e.pageX,f=n+t.colSpan-1,p=this.table_model.header.get_column_header(f),m=this._column_sizes.indices[s],w=E=>kr(this,async()=>await this._on_resize_column_move(E,p,d,m,s,f)),g=()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",g);let E=this._column_sizes.override[s],C=this._column_sizes.indices[s]!==E;this._column_sizes.indices[s]=E,C&&this.draw()};document.addEventListener("mousemove",w),document.addEventListener("mouseup",g)}async _on_resize_column_move(e,t,o,n,s,d){await new Promise(requestAnimationFrame);let f=e.pageX-o,p=Math.max(1,n+f);if(this._column_sizes.override[s]=p,f<0)await this.draw({preserve_width:!0,throttle:!1});else{t.style.minWidth=p+"px",t.style.maxWidth=p+"px";let m=this._column_sizes.auto[s];for(let w of this.table_model.body.cells){let g=w[d];g&&(g.style.maxWidth=g.style.minWidth=p+"px",g.classList.toggle("rt-cell-clip",m>p))}}}},Do=class{constructor(e){this._name=e,this._elements=[],this._index=0}reset(){this._index=0}get(){this._elements[this._index]||(this._elements[this._index]=document.createElement(this._name));let e=this._elements[this._index];return this._index+=1,e}},Er=class{constructor(e,t,o){this._column_sizes=e,this._container=t,this._span_factory=new Do("span"),this.table=o,this.cells=[],this.rows=[]}num_columns(){return this._get_row(Math.max(0,this.rows.length-1)).row_container.length}num_rows(){return this.cells.length}_set_metadata(e,t){Ge.set(e,t)}_get_or_create_metadata(e){if(e===void 0)return{};if(Ge.has(e))return Ge.get(e);{let t={};return Ge.set(e,t),t}}_replace_cell(e,t){let{tr:o,row_container:n}=this._get_row(e),s=n[t];return s&&(o.removeChild(s),n.splice(t,1,void 0)),s}_fetch_cell(e,t){if(!(e<0||t<0))return this.cells[e]?.[t]}_get_row(e){let t=this.rows[e];t||(t=this.rows[e]=document.createElement("tr"),this.table.appendChild(t));let o=this.cells[e];return o||(o=this.cells[e]=[]),{tr:t,row_container:o}}_get_cell(e="TD",t,o){let{tr:n,row_container:s}=this._get_row(t),d=s[o];if(d||(o<s.length?(d=s[o]=document.createElement(e),n.insertBefore(d,s.slice(o+1).find(f=>f))):(d=s[o]=document.createElement(e),n.appendChild(d))),d.tagName!==e){let f=document.createElement(e);n.replaceChild(f,d),this.cells[t].splice(o,1,f),d=f}return d}_clean_columns(e){for(let t=0;t<this.rows.length;t++){let o=this.rows[t],n=this.cells[t];this.cells[t]=n.slice(0,e[t]||e);let s=this.cells[t].filter(d=>d!==void 0).length;for(;o.children[s];)o.removeChild(o.children[s])}}_clean_rows(e){for(;this.table.children[e];)this.table.removeChild(this.table.children[e]);this.rows=this.rows.slice(0,e),this.cells=this.cells.slice(0,e)}},Io=class extends Er{constructor(...e){super(...e),this._group_header_cache=[],this._offset_cache=[]}_draw_group_th(e,t,o){let n=this._get_cell("TH",t,e[t]||0);if(e[t]+=1,n.removeAttribute("colspan"),n.style.minWidth="0",n.textContent="",o instanceof HTMLElement)n.appendChild(o);else{let d=this._span_factory.get("span");d.textContent=o,n.appendChild(d)}let s=this._span_factory.get("span");return s.className="rt-column-resize",n.appendChild(s),n}_draw_group(e,t,o){let n=this._get_or_create_metadata(o);return n.co