diff --git a/assets/index-CQ74RUmS.js b/assets/index-Aw5fbeSx.js similarity index 95% rename from assets/index-CQ74RUmS.js rename to assets/index-Aw5fbeSx.js index 175443332..2595d43ee 100644 --- a/assets/index-CQ74RUmS.js +++ b/assets/index-Aw5fbeSx.js @@ -199,7 +199,7 @@ Error generating stack: `+s.message+` * https://github.com/Starcounter-Jack/JSON-Patch * (c) 2017-2021 Joachim Wester * MIT license - */var z6=new WeakMap,bHe=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),wHe=function(){function e(t,n){this.callback=t,this.observer=n}return e}();function EHe(e){return z6.get(e)}function SHe(e,t){return e.observers.get(t)}function THe(e,t){e.observers.delete(t.callback)}function IHe(e,t){t.unobserve()}function xHe(e,t){var n=[],r,i=EHe(e);if(!i)i=new bHe(e),z6.set(e,i);else{var s=SHe(i,t);r=s&&s.observer}if(r)return r;if(r={},i.value=Gs(e),t){r.callback=t,r.next=null;var o=function(){ZN(r)},a=function(){clearTimeout(r.next),r.next=setTimeout(o)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return r.patches=n,r.object=e,r.unobserve=function(){ZN(r),clearTimeout(r.next),THe(i,r),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new wHe(t,r)),r}function ZN(e,t){t===void 0&&(t=!1);var n=z6.get(e.object);H6(n.value,e.object,e.patches,"",t),e.patches.length&&kC(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function H6(e,t,n,r,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=QN(t),o=QN(e),a=!1,u=o.length-1;u>=0;u--){var l=o[u],c=e[l];if(KN(t,l)&&!(t[l]===void 0&&c!==void 0&&Array.isArray(t)===!1)){var f=t[l];typeof c=="object"&&c!=null&&typeof f=="object"&&f!=null&&Array.isArray(c)===Array.isArray(f)?H6(c,f,n,r+"/"+vd(l),i):c!==f&&(i&&n.push({op:"test",path:r+"/"+vd(l),value:Gs(c)}),n.push({op:"replace",path:r+"/"+vd(l),value:Gs(f)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+vd(l),value:Gs(c)}),n.push({op:"remove",path:r+"/"+vd(l)}),a=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}))}if(!(!a&&s.length==o.length))for(var u=0;u(e.TRAVERSAL_START="Traversal_Start",e.TRAVERSAL_END="Traversal_End",e))(ey||{});function jw(e,t){const n=e.state;if(n.type==="checkpoint")return n.val;const{checkpointRef:r}=n,i=t[r],s=sse(i,e,t);s.shift();const o=s.map(u=>t[u]).map(u=>u.state.val).reduce((u,l)=>[...u,...l],[]),a=jw(i,t);return kC(a,Gs(o),!0,!1).newDocument}function AHe(e,t){const n=Object.keys(e).length;return new Set(t.map(r=>r.path.split("/")[0])).size{n=!0}),r.listen(ey.TRAVERSAL_END,()=>{n=!1});const o={add(c,f=i.current.id){i.update(i.addMetadata({id:f,meta:c}))},latestOfType(c,f=i.current.id){var d;return(d=i.backend.nodes[f].meta[c])==null?void 0:d.at(-1)},allOfType(c,f=i.current.id){return i.backend.nodes[f].meta[c]},latest(c=i.current.id){const f=i.backend.nodes[c].meta,d=Object.keys(f).reduce((h,p)=>{const m=f[p].at(-1);return m&&(h[p]=m),h},{});return Object.keys(d).length>0?d:void 0},all(c=i.current.id){return i.backend.nodes[c].meta},types(c=i.current.id){return Object.keys(i.backend.nodes[c].meta)}},a={add(c,f=i.current.id){i.update(i.addArtifact({id:f,artifact:c}))},latest(c=i.current.id){return i.backend.nodes[c].artifacts.at(-1)},all(c=i.current.id){return i.backend.nodes[c].artifacts}},u={add(c,f=i.current.id){o.add({annotation:c},f)},latest(c=i.current.id){var f;return(f=o.latestOfType("annotation",c))==null?void 0:f.val},all(c=i.current.id){var f;return(f=o.allOfType("annotation",c))==null?void 0:f.map(d=>d.val)}},l={add(c=i.current.id){o.add({bookmark:!0},c)},remove(c=i.current.id){o.add({bookmark:!1},c)},is(c=i.current.id){var f;return!!((f=o.latestOfType("bookmark",c))!=null&&f.val)},toggle(c=i.current.id){l.is(c)?l.remove(c):l.add(c)}};return{registry:e,get isTraversing(){return n},getState(c=i.current){return jw(c,i.backend.nodes)},graph:i,get current(){return i.current},get root(){return i.root},record({label:c,state:f,sideEffects:d,eventType:h,onlySideEffects:p=!1}){let m=null,y=null;const g=jw(this.current,this.graph.backend.nodes);if(p)y={type:"checkpoint",val:f};else{const v=rse(g,f);if(AHe(f,v)==="checkpoint")y={type:"checkpoint",val:f};else{const b=this.current.state.type==="checkpoint"?this.current.id:this.current.state.checkpointRef;y={type:"patch",val:v,checkpointRef:b}}}if(!y)throw new Error(`Could not calculate new state. Previous state is: ${JSON.stringify(this.current.state,null,2)}`);if(m=Jze({label:c,state:y,parent:this.current,sideEffects:d,event:h}),!m)throw new Error("State Node creation failed!");i.update(i.addNode(m))},async apply(c,f){const d=e.get(f.type),h=jw(this.current,this.graph.backend.nodes);if(d.config.hasSideEffects){const{do:p=f,undo:m}=d.func(f.payload);this.record({label:c,state:h,sideEffects:{do:[p],undo:[m]},eventType:d.config.eventType})}else{const p=d.func(h,f.payload);this.record({label:c,state:p,sideEffects:{do:[],undo:[]},eventType:d.config.eventType})}},async to(c){r.fire(ey.TRAVERSAL_START);const f=sse(i.current,i.backend.nodes[c],i.backend.nodes),d=[];for(let h=0;h0?this.to(f.children[c==="oldest"?0:f.children.length-1]):Promise.resolve(console.warn("Already at latest in this branch!"))},currentChange(c,f=!1){return i.currentChange(c,{skipOnNew:f})},done(){console.log("Setup later for URL sharing.")},tree(){return ose(i.root,i.backend.nodes)},on(c,f){r.listen(c,f)},export(){return JSON.stringify(i.backend)},exportObject(){return JSON.parse(JSON.stringify(i.backend))},import(c){const f=JSON.parse(c),d=f.current;f.current=f.root,i.update(i.load(f)),this.to(d)},importObject(c){const f=c.current;c.current=c.root,i.update(i.load(c)),this.to(f)},metadata:o,artifact:a,annotations:u,bookmarks:l}}function PHe(e,t,n){let[r,i]=[e,t];r.level>i.level&&([r,i]=[i,r]);let s=i.level-r.level;for(;zu(i)&&s!==0;)i=n[i.parent],s-=1;if(r.id===i.id)return r.id;for(;r.id!==i.id;)zu(r)&&(r=n[r.parent]),zu(i)&&(i=n[i.parent]);return r.id}function sse(e,t,n){const r=PHe(e,t,n),i=n[r],s=[],o=[];let[a,u]=[e,t];for(;a.id!==i.id;)s.push(a),zu(a)&&(a=n[a.parent]);for(s.push(a);u.id!==i.id;)o.push(u),zu(u)&&(u=n[u.parent]);const l=o.reverse();return[...s,...l].map(c=>c.id)}function OHe(e,t){if(zu(e)&&e.parent===t.id)return!0;if(zu(t)&&t.parent===e.id)return!1;throw new Error("Incorrect use of function. Nodes are not connected to each other.")}function ose(e,t){return{...e,children:e.children.map(n=>ose(t[n],t)),name:`${e.label}`}}iHe();function RHe(e){return e.length===2?fHe(e):e}class DC{static create(){return new DC}constructor(){this.registry=new Map}has(t){return this.registry.has(t)}register(t,n,r){const i=n.length===2;if(n.length>2)throw new Error("Incorrect action function signature. Action function can only have two arguments at most!");if(this.has(t))throw new Error(`Already registered: ${t}`);const{label:s=t,eventType:o=t}=r||{};return this.registry.set(t,{func:RHe(n),config:{hasSideEffects:!i,label:typeof s=="string"?()=>s:s,eventType:o}}),ju(t)}get(t){const n=this.registry.get(t);if(!n)throw new Error(`Not registered: ${t}`);return n}}var NHe="Expected a function",gz=NaN,kHe="[object Symbol]",DHe=/^\s+|\s+$/g,$He=/^[-+]0x[0-9a-f]+$/i,LHe=/^0b[01]+$/i,MHe=/^0o[0-7]+$/i,FHe=parseInt,BHe=typeof _o=="object"&&_o&&_o.Object===Object&&_o,jHe=typeof self=="object"&&self&&self.Object===Object&&self,UHe=BHe||jHe||Function("return this")(),VHe=Object.prototype,zHe=VHe.toString,HHe=Math.max,WHe=Math.min,HO=function(){return UHe.Date.now()};function qHe(e,t,n){var r,i,s,o,a,u,l=0,c=!1,f=!1,d=!0;if(typeof e!="function")throw new TypeError(NHe);t=yz(t)||0,ek(n)&&(c=!!n.leading,f="maxWait"in n,s=f?HHe(yz(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d);function h(E){var I=r,A=i;return r=i=void 0,l=E,o=e.apply(A,I),o}function p(E){return l=E,a=setTimeout(g,t),c?h(E):o}function m(E){var I=E-u,A=E-l,R=t-I;return f?WHe(R,s-A):R}function y(E){var I=E-u,A=E-l;return u===void 0||I>=t||I<0||f&&A>=s}function g(){var E=HO();if(y(E))return v(E);a=setTimeout(g,m(E))}function v(E){return a=void 0,d&&r?h(E):(r=i=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,r=u=i=a=void 0}function S(){return a===void 0?o:v(HO())}function T(){var E=HO(),I=y(E);if(r=arguments,i=this,u=E,I){if(a===void 0)return p(u);if(f)return a=setTimeout(g,t),h(u)}return a===void 0&&(a=setTimeout(g,t)),o}return T.cancel=b,T.flush=S,T}function ek(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function GHe(e){return!!e&&typeof e=="object"}function YHe(e){return typeof e=="symbol"||GHe(e)&&zHe.call(e)==kHe}function yz(e){if(typeof e=="number")return e;if(YHe(e))return gz;if(ek(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ek(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(DHe,"");var n=LHe.test(e);return n||MHe.test(e)?FHe(e.slice(2),n?2:8):$He.test(e)?gz:+e}var KHe=qHe;const ou=eu(KHe);function ase({xScale:e,yRange:t,vertPosition:n,ticks:r,isDate:i=!1,showLines:s=!0}){const o=w.useMemo(()=>r.length>1?Math.abs(r[1].offset-r[0].offset):e.range()[0]-e.range()[1],[r,e]),a=w.useCallback(u=>(i?L6("%b%e, %Y"):yf(".2s"))(u),[i]);return C.jsxs(C.Fragment,{children:[s?C.jsx("path",{transform:`translate(0, ${t[1]})`,d:["M",e.range()[0],0,"H",e.range()[1]].join(" "),fill:"none",stroke:"lightgray"}):null,r.map(({value:u,offset:l})=>C.jsxs("g",{transform:`translate(${l}, ${n})`,children:[C.jsx("line",{y2:"6",stroke:"currentColor"}),s?C.jsx("line",{y2:`${-(t[0]-t[1])}`,stroke:"lightgray"}):null,C.jsx("foreignObject",{x:0-o/2,y:10,width:o,height:20,children:C.jsx(ua,{children:C.jsx(Wx,{withinPortal:!0,label:u,children:C.jsx(rt,{px:2,size:10,style:{textAlign:"center",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:+u==0?0:a(i?new Date(u):u)})})})})]},`${u}test`))]})}const QHe=Object.freeze(Object.defineProperty({__proto__:null,XAxis:ase},Symbol.toStringTag,{value:"Module"}));function use({dataset:e,yScale:t,xRange:n,horizontalPosition:r}){const i=w.useMemo(()=>t.ticks(6).map(o=>({value:o,yOffset:t(o)})),[t]),s=w.useMemo(()=>e==="clean_stocks"?yf(",.0%"):t.domain()[1]<5?yf(",.2r"):yf(",.0f"),[e,t]);return C.jsx(C.Fragment,{children:i.map(({value:o,yOffset:a})=>C.jsxs("g",{transform:`translate(${r}, ${a})`,children:[C.jsx("line",{x2:`${n[1]-n[0]}`,stroke:`${o===0?"black":"gainsboro"}`,strokeWidth:o===0?1:.4}),C.jsx("text",{style:{dominantBaseline:"middle",fontSize:"10px",textAnchor:"end",transform:"translateX(-6px)",fill:"black",font:"Roboto"},children:s(o)},o)]},o))})}const XHe=Object.freeze(Object.defineProperty({__proto__:null,YAxis:use},Symbol.toStringTag,{value:"Module"})),Yi={top:30,left:40,right:80,bottom:50};function tk({parameters:e,data:t,dataname:n,items:r,selection:i,range:s,guardrail:o}){const[a,u]=w.useState(null),l=R=>i!=null&&i.includes(R)?!a||a.length===0?!0:a.includes(R):!1,c=w.useMemo(()=>{const R=r.filter(L=>i==null?void 0:i.includes(L.name)).map(L=>L.group);return r.filter(L=>R==null?void 0:R.includes(L.group)).filter(L=>!(i!=null&&i.includes(L.name))).map(L=>L.name)},[i,r,n]),f=w.useMemo(()=>{const R=r.map(J=>J.group),F=t.filter(J=>R==null?void 0:R.includes(J[e.group_var]));return[...vVe(F,J=>({mean:PO(J,.5,V=>V[e.y_var]),upperq:PO(J,.75,V=>V[e.y_var]),lowerq:PO(J,.25,V=>V[e.y_var])}),J=>J[e.x_var])].flatMap(([J,V])=>({date:J,mean:V.mean,upperq:V.upperq,lowerq:V.lowerq}))},[t,r,e,n]),d=n==="clean_data"?800-Yi.left-Yi.right-60:800-Yi.left-Yi.right,h=400-Yi.top-Yi.bottom,{yMin:p,yMax:m}=w.useMemo(()=>{let R=[];switch(o){case"super_data":R=i==null?void 0:i.concat(c);break;default:R=i;break}const F=t.filter(ae=>R.includes(ae[e.cat_var])).map(ae=>+ae[e.y_var]).filter(ae=>ae!==null),[L,B]=n==="clean_stocks"?Pf(F):[0,Pf(F)[1]],[J,V]=[zT(f.map(ae=>ae.lowerq)),Pv(f.map(ae=>ae.upperq))],re=o==="super_summ"?zT([L,J]):L,oe=o==="super_summ"?Pv([B,V]):B;return{yMin:re,yMax:oe}},[t,i,o,f,c,e,n]),y=w.useMemo(()=>s?kv([Yi.left,d+Yi.left]).domain(s):kv([Yi.left,d+Yi.left]).domain([new Date(e.start_date),new Date(e.end_date)]),[d,s,e,n]),g=w.useMemo(()=>mh([h+Yi.top,Yi.top]).domain([p,m]).nice(),[h,m,p,n]),v=w.useMemo(()=>{const R=Array.from(new Set(t.map(F=>F[e.cat_var])));return O6(S6).domain(R)},[t,e,n]),b=w.useMemo(()=>{if(!y||!g)return;const R=$y();return R.x(L=>y(Ld("%Y-%m-%d")(L[e.x_var]))),R.y(L=>g(L[e.y_var])),R.curve(Mp),i==null?void 0:i.map(L=>({country:L,path:R(t.filter(B=>B[e.cat_var]===L))}))},[t,y,g,i,e,n]),S=w.useMemo(()=>{if(o!=="super_data")return null;const R=$y();return R.x(L=>y(Ld("%Y-%m-%d")(L[e.x_var]))),R.y(L=>g(L[e.y_var])),R.curve(Mp),c==null?void 0:c.map(L=>({country:L,path:R(t.filter(B=>B[e.cat_var]===L))}))},[t,y,g,o,c,e,n]),T=w.useMemo(()=>{if(o!=="super_summ")return null;const R=$y();R.x(J=>y(Ld("%Y-%m-%d")(J.date))),R.y(J=>g(J.mean)),R.curve(Mp);const F=R(f),L=Xie();L.x(J=>y(Ld("%Y-%m-%d")(J.date))),L.y0(J=>g(J.lowerq)),L.y1(J=>g(J.upperq)),L.curve(Mp);const B=L(f);return{meanLine:F,confidenceBands:B,data:f}},[y,g,o,f,n]),E=w.useMemo(()=>n==="clean_stocks"?"Market Index":"Average",[n]),I=R=>R==="Eldoril North"?"Policy A":R.split(" ")[0]==="Silvoria"||R.split(" ")[0]==="Mystara"?"Policy C":R==="Average"?"all policies":"Policy B",A=w.useMemo(()=>{let F=null;switch(o){case"super_data":F=i==null?void 0:i.concat(S==null?void 0:S.map(B=>B.country));break;case"super_summ":F=i==null?void 0:i.concat([E]);break;default:F=i;break}const L=F==null?void 0:F.map(B=>({country:B,country_policy:n==="clean_data"?`${B} (${I(B)})`:B,label_pos:B===E?T==null?void 0:T.data.slice(-1).map(J=>g(J.mean))[0]:t.filter(J=>J[e.cat_var]===B).slice(-1).map(J=>g(J[e.y_var]))[0]})).sort((B,J)=>B.label_pos=10||(L[B].label_pos=L[B].label_pos-10+J)}return L},[t,i,g,o,E,e,S,T,n]);return(i==null?void 0:i.length)===0?C.jsx(ua,{style:{width:"800px",height:"400px"},children:C.jsx(rt,{fs:"italic",c:"dimmed",children:"Select an item to view the chart."})}):C.jsxs("svg",{id:"baseLineChart",style:{height:"400px",width:"800px",fontFamily:'"Helvetica Neue", "Helvetica", "Arial", sans-serif'},children:[C.jsxs("g",{id:"axes",children:[C.jsx(ase,{isDate:!0,xScale:y,yRange:g.range(),vertPosition:h+Yi.top,showLines:!1,ticks:y.ticks(6).map(R=>({value:R.toString(),offset:y(R)}))}),C.jsx(use,{dataset:n,yScale:g,horizontalPosition:Yi.left,xRange:y.range()})]}),C.jsx("svg",{style:{width:`${d}`},children:S==null?void 0:S.map(R=>C.jsx("g",{children:C.jsx("path",{id:`${R.country}`,fill:"none",stroke:l(R.country)?v(R.country):"gray",strokeDasharray:"4,1",strokeWidth:.5,d:R.path},`${R.country}_key`)},`${R.country}_g`))},"control_lines"),C.jsx("svg",{style:{width:`${d}`},children:T?C.jsxs("g",{children:[C.jsx("path",{id:"confidenceBands",fill:"lightgray",opacity:.25,stroke:"none",d:T.confidenceBands},"confidenceBands_key"),C.jsx("path",{id:"meanLine",fill:"none",stroke:"gray",strokeDasharray:"4,1",strokeWidth:.5,d:T.meanLine},"meanLine_key")]},"summary_g"):null},"control_bands"),C.jsxs("svg",{style:{width:`${d}`},children:[b==null?void 0:b.map(R=>C.jsx("g",{children:C.jsx("path",{id:`${R.country}`,fill:"none",stroke:l(R.country)?v(R.country):"gainsboro",strokeWidth:a!=null&&a.includes(R.country)?2:1.5,d:R.path},`${R.country}_key`)},`${R.country}_g`)),A==null?void 0:A.map(R=>C.jsx("foreignObject",{x:d+Yi.left+5,y:R.label_pos-7,width:Yi.right+60,height:20,children:C.jsx(rt,{px:2,size:10,color:l(R.country)?v(R.country):"silver",onMouseOver:F=>{const L=F.target;i!=null&&i.includes(L.innerText)&&u([L.innerText])},onMouseOut:()=>u([]),children:R.country_policy})},`${R.country}_label`))]},"lines")]})}const JHe=Object.freeze(Object.defineProperty({__proto__:null,LineChart:tk,default:tk},Symbol.toStringTag,{value:"Module"})),sp={top:0,left:0,right:0,bottom:0},vz=20,WO=60;function nk({parameters:e,data:t,dataname:n,items:r,selection:i,setSelection:s,trackSelection:o,range:a,guardrail:u}){const l=w.useMemo(()=>a?kv([sp.left,WO+sp.left]).domain(a):kv([sp.left,WO+sp.left]).domain([new Date(e.start_date),new Date(e.end_date)]),[e,a]),c=w.useMemo(()=>{const p=t.filter(g=>r==null?void 0:r.map(v=>v.name).includes(g[e.cat_var])).map(g=>+g[e.y_var]).filter(g=>g!==null),[m,y]=Pf(p);return mh([vz+sp.top,sp.top]).domain([m,y]).nice()},[e,t,r]),f=w.useMemo(()=>{const p=Array.from(new Set(t.map(m=>m[e.cat_var])));return O6(S6).domain(p)},[e,t]),d=w.useMemo(()=>{if(u!=="juxt_data")return null;const p=Xie();p.x(g=>l(Ld("%Y-%m-%d")(g[e.x_var]))),p.y0(()=>c(0)),p.y1(g=>c(g[e.y_var])),p.curve(Mp);const m=$y();return m.x(g=>l(Ld("%Y-%m-%d")(g[e.x_var]))),m.y(g=>c(g[e.y_var])),m.curve(Mp),r==null?void 0:r.map(g=>({country:g.name,path:m(t.filter(v=>v[e.cat_var]===g.name)),area:p(t.filter(v=>v[e.cat_var]===g.name))}))},[e,u,t,r,l,c]),h=w.useMemo(()=>e.allow_selection===!1?"none":"block",[e]);return C.jsx(Mm.Group,{defaultValue:i,orientation:"vertical",onChange:p=>{s(p),o(p)},spacing:0,offset:"sm",styles:e.allow_selection===!1?{root:{pointerEvents:"none"}}:{root:{pointerEvents:"auto"}},children:r==null?void 0:r.map(p=>C.jsxs(C.Fragment,{children:[p.name==="Eldoril North"?C.jsx(df,{size:"xs",label:"Policy A",labelPosition:"left",color:"black"}):null,p.name==="Eldoril West"?C.jsx(df,{size:"xs",label:"Policy B",labelPosition:"left",color:"black"}):null,p.name==="Silvoria North"?C.jsx(df,{size:"xs",label:"Policy C",labelPosition:"left",color:"black"}):null,C.jsxs(Rl,{grow:!0,gutter:8,columns:2,children:[C.jsx(Rl.Col,{span:1,children:C.jsx(Mm,{value:p.name,label:p.name,color:e.allow_selection?"blue":"gray",styles:{root:{display:"flex",alignItems:"flex-end",padding:"2px 0"},inner:{display:h}},children:p.name},`${p.name}_checkbox`)},`${p.name}_grid1`),C.jsx(Rl.Col,{span:u==="juxt_data"?"auto":3,children:C.jsxs("svg",{style:{width:`${WO}`,height:`${vz}`},children:[C.jsx("path",{id:`${p.name}_sparkarea`,fill:i!=null&&i.includes(p.name)?f(p.name):"gray",stroke:"none",opacity:.25,d:d==null?void 0:d.filter(m=>m.country===p.name)[0].area},`${p.name}_sparkarea`),C.jsx("path",{id:`${p.name}_spark`,fill:"none",stroke:i!=null&&i.includes(p.name)?f(p.name):"gray",strokeWidth:.75,d:d==null?void 0:d.filter(m=>m.country===p.name)[0].path},`${p.name}_spark`)]},`${p.name}_sparksvg`)},`${p.name}_grid2`)]},`${p.name}_grid`)]}))},`${n}_checkboxgroup`)}const ZHe=Object.freeze(Object.defineProperty({__proto__:null,Sidebar:nk,default:nk},Symbol.toStringTag,{value:"Module"}));function rk({parameters:e,setRange:t,trackRange:n}){function r(s){return kv([0,100]).domain([new Date(e.start_date),new Date(e.end_date)]).invert(s)}function i(s){const o=r(s);return L6("%b %e, %Y")(o)}return C.jsx(pte,{defaultValue:[0,100],label:s=>i(s),labelAlwaysOn:!0,disabled:!e.allow_time_slider,onChange:([s,o])=>{t([r(s),r(o)]),n([r(s),r(o)])}})}const eWe=Object.freeze(Object.defineProperty({__proto__:null,RangeSelector:rk,default:rk},Symbol.toStringTag,{value:"Module"}));function ik({guardrail:e,setGuardrail:t,dataname:n,setDataname:r,setSelection:i}){return C.jsxs(C.Fragment,{children:[C.jsx(rt,{children:"Data:"}),C.jsx(ZR,{value:n,onChange:s=>{r(s),i([])},data:[{value:"clean_data",label:"Viral"},{value:"clean_stocks",label:"Stock"}]}),C.jsx(rt,{children:"Guardrail:"}),C.jsx(ZR,{value:e,onChange:s=>{t(s)},data:[{value:"none",label:"None"},{value:"super_data",label:"Sup. Data"},{value:"super_summ",label:"Sup. Summ."},{value:"juxt_data",label:"Juxt. Data"},{value:"juxt_summ",label:"Juxt. Summ."}]})]})}const tWe=Object.freeze(Object.defineProperty({__proto__:null,Selector:ik,default:ik},Symbol.toStringTag,{value:"Module"})),En=Array.isArray;function io(e){return e!=null?En(e)?e:[e]:[]}function nWe(e=0,t=1/0){return`${_z(e)} < row_number() && row_number() <= ${_z(t)}`}function _z(e){return e<0?`count() + ${e}`:e}class lse{constructor(t){t&&(this._params=t)}params(t){return arguments.length?(t&&(this._params={...this._params,...t}),this):this._params}reify(t){return this.__reify(this,t)}count(t){return this.__count(this,t)}derive(t,n){return this.__derive(this,t,n)}filter(t){return this.__filter(this,t)}slice(t,n){return this.filter(nWe(t,n)).reify()}groupby(...t){return this.__groupby(this,t.flat())}orderby(...t){return this.__orderby(this,t.flat())}relocate(t,n){return this.__relocate(this,io(t),n)}rename(...t){return this.__rename(this,t.flat())}rollup(t){return this.__rollup(this,t)}sample(t,n){return this.__sample(this,t,n)}select(...t){return this.__select(this,t.flat())}ungroup(){return this.__ungroup(this)}unorder(){return this.__unorder(this)}dedupe(...t){return this.__dedupe(this,t.flat())}impute(t,n){return this.__impute(this,t,n)}fold(t,n){return this.__fold(this,t,n)}pivot(t,n,r){return this.__pivot(this,t,n,r)}spread(t,n){return this.__spread(this,t,n)}unroll(t,n){return this.__unroll(this,t,n)}lookup(t,n,...r){return this.__lookup(this,t,n,r.flat())}join(t,n,r,i){return this.__join(this,t,n,r,i)}join_left(t,n,r,i){const s={...i,left:!0,right:!1};return this.__join(this,t,n,r,s)}join_right(t,n,r,i){const s={...i,left:!1,right:!0};return this.__join(this,t,n,r,s)}join_full(t,n,r,i){const s={...i,left:!0,right:!0};return this.__join(this,t,n,r,s)}cross(t,n,r){return this.__cross(this,t,n,r)}semijoin(t,n){return this.__semijoin(this,t,n)}antijoin(t,n){return this.__antijoin(this,t,n)}concat(...t){return this.__concat(this,t.flat())}union(...t){return this.__union(this,t.flat())}intersect(...t){return this.__intersect(this,t.flat())}except(...t){return this.__except(this,t.flat())}}function Wt(e){throw Error(e)}function bs(e){return typeof e=="number"}function sr(e){return typeof e=="function"}function $C(e,t){const n=Array(e);if(sr(t))for(let r=0;r=0;a=s.next(a+1))r[++o]=a;else for(let a=0;aa(l,c,u))}return(t||!i)&&(this._index=r),r}partitions(t=!0){if(this._partitions)return this._partitions;if(!this.isGrouped())return[this.indices(t)];const{keys:n,size:r}=this._group,i=$C(r,()=>[]),s=this._index,o=this.mask(),a=this.numRows();if(s&&this.isOrdered())for(let u=0,l;u=0;u=o.next(u+1))i[n[u]].push(u);else for(let u=0;uu(f,d,l))}return(t||!this.isOrdered())&&(this._partitions=i),i}scan(t,n,r=1/0,i=0){const s=this._mask,o=this._nrows,a=this._data;let u=i||0;if(u>o)return;const l=Math.min(o,u+r),c=()=>u=this._total;if(n&&this.isOrdered()||s&&this._index){const f=this.indices(),d=this._data;for(;u-1;u=s.next(u+1))t(u,a,c)}else for(;ur.push(s),!0,n-t,t),this.reify(r)}reduce(t){return this.__reduce(this,t)}},iWe=class{constructor(t){this.data=t}get length(){return this.data.length}get(t){return this.data[t]}[Symbol.iterator](){return this.data[Symbol.iterator]()}},sWe=function(e){return e&&sr(e.get)?e:new iWe(e)};function Xl(e){return e instanceof Date}function as(e){return e===Object(e)}function rI(e){return e instanceof RegExp}function Ui(e){return typeof e=="string"}function oWe(e,t){const n=r=>Wt(`Illegal argument type: ${r||typeof e}`);return e instanceof Map?bz(e.entries(),t):Xl(e)?n("Date"):rI(e)?n("RegExp"):Ui(e)?n():En(e)?aWe(e,t):sr(e[Symbol.iterator])?uWe(e,t):as(e)?bz(Object.entries(e),t):n()}function bz(e,t=["key","value"]){const n=[],r=[];for(const[s,o]of e)n.push(s),r.push(o);const i={};return t[0]&&(i[t[0]]=n),t[1]&&(i[t[1]]=r),i}function aWe(e,t){const n=e.length,r={},i=s=>r[s]=Array(n);if(n){t=t||Object.keys(e[0]);const s=t.map(i),o=s.length;for(let a=0;an[o]=[];let i,s;for(const o of e){i||(t=t||Object.keys(o),i=t.map(r),s=i.length);for(let a=0;aMd(e)||Ui(e),fWe={compact:e=>Md(e)?e.filter(t=>Ma(t)):e,concat:(...e)=>[].concat(...e),includes:(e,t,n)=>R0(e)?e.includes(t,n):!1,indexof:(e,t)=>R0(e)?e.indexOf(t):-1,join:(e,t)=>Md(e)?e.join(t):yn,lastindexof:(e,t)=>R0(e)?e.lastIndexOf(t):-1,length:e=>R0(e)?e.length:0,pluck:(e,t)=>Md(e)?e.map(n=>Ma(n)?n[t]:yn):yn,reverse:e=>Md(e)?e.slice().reverse():Ui(e)?e.split("").reverse().join(""):yn,slice:(e,t,n)=>R0(e)?e.slice(t,n):yn};function dWe(e,t,n,r,i){return e==null?null:en?1/0:(e=Math.max(t,Math.min(e,n)),t+r*Math.floor(1e-14+(e-t)/r+(i||0)))}function Uw(e,t,n="0"){const r=e+"",i=r.length;return i(e<10?"0":"")+e,hWe=e=>e<0?"-"+Uw(-e,6):e>9999?"+"+Uw(e,6):Uw(e,4);function cse(e,t,n,r,i,s,o,a,u){const l=a?"Z":"";return hWe(e)+"-"+su(t+1)+"-"+su(n)+(!u||o?"T"+su(r)+":"+su(i)+":"+su(s)+"."+Uw(o,3)+l:s?"T"+su(r)+":"+su(i)+":"+su(s)+l:i||r||!a?"T"+su(r)+":"+su(i)+l:"")}function fse(e,t){return isNaN(e)?"Invalid Date":cse(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds(),!1,t)}function LC(e,t){return isNaN(e)?"Invalid Date":cse(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds(),!0,t)}const pWe=/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/;function mWe(e){return e.match(pWe)&&!isNaN(Date.parse(e))}function gWe(e,t=Date.parse){return mWe(e)?t(e):e}const dse=6e4,hse=864e5,pse=6048e5,xr=new Date,Ar=new Date,Dr=e=>(xr.setTime(typeof e=="string"?gWe(e):e),xr);function yWe(e,t,n,r,i,s,o){return arguments.length?new Date(e,t||0,n??1,r||0,i||0,s||0,o||0):new Date(Date.now())}function vWe(e,t,n,r,i,s,o){return arguments.length?new Date(Date.UTC(e,t||0,n??1,r||0,i||0,s||0,o||0)):new Date(Date.now())}function _We(e){Ar.setTime(+e),Ar.setHours(0,0,0,0),xr.setTime(+Ar),xr.setMonth(0),xr.setDate(1);const t=(Ar.getTimezoneOffset()-xr.getTimezoneOffset())*dse;return Math.floor(1+(Ar-xr-t)/hse)}function bWe(e){Ar.setTime(+e),Ar.setUTCHours(0,0,0,0);const t=Date.UTC(Ar.getUTCFullYear(),0,1);return Math.floor(1+(Ar-t)/hse)}function wWe(e,t){const n=t||0;Ar.setTime(+e),Ar.setDate(Ar.getDate()-(Ar.getDay()+7-n)%7),Ar.setHours(0,0,0,0),xr.setTime(+e),xr.setMonth(0),xr.setDate(1),xr.setDate(1-(xr.getDay()+7-n)%7),xr.setHours(0,0,0,0);const r=(Ar.getTimezoneOffset()-xr.getTimezoneOffset())*dse;return Math.floor((1+(Ar-xr)-r)/pse)}function EWe(e,t){const n=t||0;return Ar.setTime(+e),Ar.setUTCDate(Ar.getUTCDate()-(Ar.getUTCDay()+7-n)%7),Ar.setUTCHours(0,0,0,0),xr.setTime(+e),xr.setUTCMonth(0),xr.setUTCDate(1),xr.setUTCDate(1-(xr.getUTCDay()+7-n)%7),xr.setUTCHours(0,0,0,0),Math.floor((1+(Ar-xr))/pse)}const SWe={format_date:(e,t)=>fse(Dr(e),!t),format_utcdate:(e,t)=>LC(Dr(e),!t),timestamp:e=>+Dr(e),year:e=>Dr(e).getFullYear(),quarter:e=>Math.floor(Dr(e).getMonth()/3),month:e=>Dr(e).getMonth(),date:e=>Dr(e).getDate(),dayofweek:e=>Dr(e).getDay(),hours:e=>Dr(e).getHours(),minutes:e=>Dr(e).getMinutes(),seconds:e=>Dr(e).getSeconds(),milliseconds:e=>Dr(e).getMilliseconds(),utcyear:e=>Dr(e).getUTCFullYear(),utcquarter:e=>Math.floor(Dr(e).getUTCMonth()/3),utcmonth:e=>Dr(e).getUTCMonth(),utcdate:e=>Dr(e).getUTCDate(),utcdayofweek:e=>Dr(e).getUTCDay(),utchours:e=>Dr(e).getUTCHours(),utcminutes:e=>Dr(e).getUTCMinutes(),utcseconds:e=>Dr(e).getUTCSeconds(),utcmilliseconds:e=>Dr(e).getUTCMilliseconds(),datetime:yWe,dayofyear:_We,week:wWe,utcdatetime:vWe,utcdayofyear:bWe,utcweek:EWe,now:Date.now};function W6(e,t){return e==null||t==null||e!==e||t!==t?!1:e===t?!0:Xl(e)||Xl(t)?+e==+t:rI(e)&&rI(t)?e+""==t+"":as(e)&&as(t)?TWe(e,t):!1}function TWe(e,t){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(e.length||t.length)return Ez(e,t);const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||(n.sort(),r.sort(),!Ez(n,r,(s,o)=>s===o)))return!1;const i=n.length;for(let s=0;sJSON.parse(e),to_json:e=>JSON.stringify(e)};let xWe=Math.random;function Ng(){return xWe()}const CWe={random:Ng,is_nan:Number.isNaN,is_finite:Number.isFinite,abs:Math.abs,cbrt:Math.cbrt,ceil:Math.ceil,clz32:Math.clz32,exp:Math.exp,expm1:Math.expm1,floor:Math.floor,fround:Math.fround,greatest:Math.max,least:Math.min,log:Math.log,log10:Math.log10,log1p:Math.log1p,log2:Math.log2,pow:Math.pow,round:Math.round,sign:Math.sign,sqrt:Math.sqrt,trunc:Math.trunc,degrees:e=>180*e/Math.PI,radians:e=>Math.PI*e/180,acos:Math.acos,acosh:Math.acosh,asin:Math.asin,asinh:Math.asinh,atan:Math.atan,atan2:Math.atan2,atanh:Math.atanh,cos:Math.cos,cosh:Math.cosh,sin:Math.sin,sinh:Math.sinh,tan:Math.tan,tanh:Math.tanh};function q6(e){return e instanceof Map}function AWe(e){return e instanceof Set}function Vw(e){return q6(e)||AWe(e)}function qO(e){return Array.from(e)}const PWe={has:(e,t)=>Vw(e)?e.has(t):e!=null?Ya(e,t):!1,keys:e=>q6(e)?qO(e.keys()):e!=null?Object.keys(e):[],values:e=>Vw(e)?qO(e.values()):e!=null?Object.values(e):[],entries:e=>Vw(e)?qO(e.entries()):e!=null?Object.entries(e):[],object:e=>e?Object.fromEntries(e):yn};function OWe(e,t,n){if(t instanceof Map){if(t.has(e))return t.get(e)}else if(Ya(t,e))return t[e];return n!==void 0?n:e}function RWe(e,t,n){let r=arguments.length;e=+e,t=+t,n=r<2?(t=e,e=0,1):r<3?1:+n,r=Math.max(0,Math.ceil((t-e)/n))|0;const i=new Array(r);for(let s=0;se==null?e:new Date(e),parse_float:e=>e==null?e:Number.parseFloat(e),parse_int:(e,t)=>e==null?e:Number.parseInt(e,t),endswith:(e,t,n)=>e==null?!1:String(e).endsWith(t,n),match:(e,t,n)=>{const r=e==null?e:String(e).match(t);return n==null||r==null?r:typeof n=="number"?r[n]:r.groups?r.groups[n]:null},normalize:(e,t)=>e==null?e:String(e).normalize(t),padend:(e,t,n)=>e==null?e:String(e).padEnd(t,n),padstart:(e,t,n)=>e==null?e:String(e).padStart(t,n),upper:e=>e==null?e:String(e).toUpperCase(),lower:e=>e==null?e:String(e).toLowerCase(),repeat:(e,t)=>e==null?e:String(e).repeat(t),replace:(e,t,n)=>e==null?e:String(e).replace(t,String(n)),substring:(e,t,n)=>e==null?e:String(e).substring(t,n),split:(e,t,n)=>e==null?[]:String(e).split(t,n),startswith:(e,t,n)=>e==null?!1:String(e).startsWith(t,n),trim:e=>e==null?e:String(e).trim()},Bp={bin:dWe,equal:W6,recode:OWe,sequence:RWe,...fWe,...SWe,...IWe,...CWe,...PWe,...NWe};function Lv(e){return typeof e=="bigint"}function el(e){return e===void 0?e+"":Lv(e)?e+"n":JSON.stringify(e)}function Vt(e,t=[],n=[]){return new kWe(e,io(t),io(n))}let kWe=class{constructor(t,n,r){this.name=t,this.fields=n,this.params=r}toString(){const t=[...this.fields.map(n=>`d[${el(n)}]`),...this.params.map(el)];return`d => op.${this.name}(${t})`}toObject(){return{expr:this.toString(),func:!0}}};const mse=e=>Vt("any",e),gse=()=>Vt("count"),yse=e=>Vt("array_agg",e),vse=e=>Vt("array_agg_distinct",e),_se=(e,t)=>Vt("map_agg",[e,t]),bse=(e,t)=>Vt("object_agg",[e,t]),wse=(e,t)=>Vt("entries_agg",[e,t]);({...Bp});function DWe(e,t){e=Vw(e)?e:new Set(e);let n=t,r=0;for(;e.has(n);)n=t+ ++r;return n}function $We(e,t){if(!e||!t)return e;const{keys:n,rows:r,size:i}=e,s=new Int32Array(i);t.scan(c=>s[n[c]]=1);const o=s.reduce((c,f)=>c+f,0);if(o===i)return e;const a=Array(o);let u=0;for(let c=0;cl[c]=s[n[c]]),{...e,keys:l,rows:a,size:u}}function LWe(e,t,n,r){const{keys:i,rows:s,size:o}=e;let a=s,u=o,l=null;if(n){l=new Int32Array(o),t(p=>l[i[p]]=1);const h=l.reduce((p,m)=>p+m,0);if(h!==o){a=Array(h),u=0;for(let p=0;pf[++c]=l[i[h]]:h=>f[++c]=i[h]),{...e,keys:f,rows:a,size:u}}function MWe(e,t,n,r){const i=r==="map"||r===!0?_se:r==="entries"?wse:r==="object"?bse:Wt('groups option must be "map", "entries", or "object".'),{names:s}=e.groups(),o=DWe(e.columnNames(),"_");let a=e.select().reify(t).create({data:{[o]:n}}).rollup({[o]:yse(o)});for(let u=s.length;--u>=0;)a=a.groupby(s.slice(0,u)).rollup({[o]:i(s[u],o)});return a.get(o)}const FWe="ArrayPattern",BWe="ArrowFunctionExpression",jWe="FunctionExpression",vf="Identifier",kg="Literal",Ese="MemberExpression",UWe="ObjectExpression",Sse="ObjectPattern",Tse="Property",i1="Column",VWe="Constant",zWe="Dictionary",HWe="Function",WWe="Parameter",Ise="Op",Kn=(e,t)=>{const n=qWe[e.type];return n?n(e,t):Wt(`Unsupported expression construct: ${e.type}`)},GO=(e,t)=>"("+Kn(e.left,t)+" "+e.operator+" "+Kn(e.right,t)+")",YO=(e,t)=>"("+fu(e.params,t)+")=>"+Kn(e.body,t),Sz=(e,t)=>Kn(e.callee,t)+"("+fu(e.arguments,t)+")",fu=(e,t,n=",")=>e.map(r=>Kn(r,t)).join(n),xse=e=>e.computed?`[${el(e.name)}]`:`.${e.name}`,Tz=(e,t,n)=>{const r=e.table||"";return`data${r}${xse(e)}.${n}(${t.index}${r})`},qWe={Constant:e=>e.raw,Column:(e,t)=>Tz(e,t,"get"),Dictionary:(e,t)=>Tz(e,t,"key"),Function:e=>`fn.${e.name}`,Parameter:e=>`$${xse(e)}`,Op:(e,t)=>`op(${el(e.name)},${t.op||t.index})`,Literal:e=>e.raw,Identifier:e=>e.name,TemplateLiteral:(e,t)=>{const{quasis:n,expressions:r}=e,i=r.length;let s=n[0].value.raw;for(let o=0;o{const n=!e.computed,r=Kn(e.object,t),i=Kn(e.property,t);return r+(n?"."+i:"["+i+"]")},CallExpression:Sz,NewExpression:(e,t)=>"new "+Sz(e,t),ArrayExpression:(e,t)=>"["+fu(e.elements,t)+"]",AssignmentExpression:GO,BinaryExpression:GO,LogicalExpression:GO,UnaryExpression:(e,t)=>"("+e.operator+Kn(e.argument,t)+")",ConditionalExpression:(e,t)=>"("+Kn(e.test,t)+"?"+Kn(e.consequent,t)+":"+Kn(e.alternate,t)+")",ObjectExpression:(e,t)=>"({"+fu(e.properties,t)+"})",Property:(e,t)=>{const n=Kn(e.key,t);return(e.computed?`[${n}]`:n)+":"+Kn(e.value,t)},ArrowFunctionExpression:YO,FunctionExpression:YO,FunctionDeclaration:YO,ArrayPattern:(e,t)=>"["+fu(e.elements,t)+"]",ObjectPattern:(e,t)=>"{"+fu(e.properties,t)+"}",VariableDeclaration:(e,t)=>e.kind+" "+fu(e.declarations,t,","),VariableDeclarator:(e,t)=>Kn(e.id,t)+"="+Kn(e.init,t),SpreadElement:(e,t)=>"..."+Kn(e.argument,t),BlockStatement:(e,t)=>"{"+fu(e.body,t,";")+";}",BreakStatement:()=>"break",ExpressionStatement:(e,t)=>Kn(e.expression,t),IfStatement:(e,t)=>"if ("+Kn(e.test,t)+")"+Kn(e.consequent,t)+(e.alternate?" else "+Kn(e.alternate,t):""),SwitchStatement:(e,t)=>"switch ("+Kn(e.discriminant,t)+") {"+fu(e.cases,t,"")+"}",SwitchCase:(e,t)=>(e.test?"case "+Kn(e.test,t):"default")+": "+fu(e.consequent,t,";")+";",ReturnStatement:(e,t)=>"return "+Kn(e.argument,t),Program:(e,t)=>Kn(e.body[0],t)};function iI(e,t={index:"row"}){return Kn(e,t)}function GWe(e,t,n=15,r=!0,i=0,s){const a=Math.LN10;if(s==null){const u=Math.ceil(Math.log(n)/a),l=t-e||Math.abs(e)||1,c=[5,2];for(s=Math.max(i,Math.pow(10,Math.round(Math.log(l)/a)-u));Math.ceil(l/s)>n;)s*=10;const f=c.length;for(let d=0;d=i&&l/h<=n&&(s=h)}}if(r){let u=Math.log(s);const l=u>=0?0:~~(-u/a)+1,c=Math.pow(10,-l-1);u=Math.floor(e/s+c)*s,e=e0&&(t+=","),t+=`"${r}":${Km(e[r])}`;return t+="}",t}function sI(e,t){const n=e.length;return n===1?(r,i)=>Km(e[0](r,i)):(r,i)=>{let s="";for(let o=0;o0&&(s+="|");const a=e[o](r,i);if(t&&(a==null||a!==a))return null;s+=Km(a)}return s}}function KWe(){const e=new Map;return{count(){return e.size},values(){return Array.from(e.values(),t=>t.v)},increment(t){const n=Km(t),r=e.get(n);r?++r.n:e.set(n,{v:t,n:1})},decrement(t){const n=Km(t),r=e.get(n);r.n===1?e.delete(n):--r.n},forEach(t){e.forEach(({v:n,n:r})=>t(n,r))}}}function Sl(){}function QWe(e,t=0,n=e.length){let r=e[t++];for(let i=t;iXr({value:e=>e.count}),param:[]},array_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>e.list.values(e.stream)}),param:[1]},object_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>Object.fromEntries(e.list.values())}),param:[2]},map_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>new Map(e.list.values())}),param:[2]},entries_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>e.list.values(e.stream)}),param:[2]},any:{create:()=>Xr({add:(e,t)=>{e.any==null&&(e.any=t)},value:e=>e.valid?e.any:yn}),param:[1]},valid:{create:()=>Xr({value:e=>e.valid}),param:[1]},invalid:{create:()=>Xr({value:e=>e.count-e.valid}),param:[1]},distinct:{create:()=>({init:e=>e.distinct=KWe(),value:e=>e.distinct.count()+(e.valid===e.count?0:1),add:(e,t)=>e.distinct.increment(t),rem:(e,t)=>e.distinct.decrement(t)}),param:[1]},array_agg_distinct:{create:()=>Xr({value:e=>e.distinct.values()}),param:[1],req:["distinct"]},mode:{create:()=>Xr({value:e=>{let t=yn,n=0;return e.distinct.forEach((r,i)=>{i>n&&(n=i,t=r)}),t}}),param:[1],req:["distinct"]},sum:{create:()=>({init:e=>e.sum=0,value:e=>e.valid?e.sum:yn,add:(e,t)=>Lv(t)?e.sum===0?e.sum=t:e.sum+=t:e.sum+=+t,rem:(e,t)=>e.sum-=t}),param:[1]},product:{create:()=>({init:e=>Iz(e,1),value:e=>e.valid?e.product_v?Iz(e,QWe(e.list.values())):e.product:void 0,add:(e,t)=>Lv(t)&&e.product===1?e.product=t:e.product*=t,rem:(e,t)=>t==0||t===1/0||t===-1/0?e.product_v=!0:e.product/=t}),param:[1],stream:["array_agg"]},mean:{create:()=>({init:e=>e.mean=0,value:e=>e.valid?e.mean:yn,add:(e,t)=>{e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid},rem:(e,t)=>{e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean}}),param:[1]},average:{create:()=>Xr({value:e=>e.valid?e.mean:yn}),param:[1],req:["mean"]},variance:{create:()=>({init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):yn,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean)}),param:[1],req:["mean"]},variancep:{create:()=>Xr({value:e=>e.valid>1?e.dev/e.valid:yn}),param:[1],req:["variance"]},stdev:{create:()=>Xr({value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):yn}),param:[1],req:["variance"]},stdevp:{create:()=>Xr({value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):yn}),param:[1],req:["variance"]},min:{create:()=>({init:e=>e.min=yn,value:e=>e.min=Number.isNaN(e.min)?e.list.min():e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)}}),param:[1],stream:["array_agg"]},max:{create:()=>({init:e=>e.max=yn,value:e=>e.max=Number.isNaN(e.max)?e.list.max():e.max,add:(e,t)=>{(t>e.max||e.max===yn)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)}}),param:[1],stream:["array_agg"]},quantile:{create:e=>Xr({value:t=>t.list.quantile(e)}),param:[1,1],req:["array_agg"]},median:{create:()=>Xr({value:e=>e.list.quantile(.5)}),param:[1],req:["array_agg"]},covariance:{create:()=>({init:e=>{e.cov=e.mean_x=e.mean_y=e.dev_x=e.dev_y=0},value:e=>e.valid>1?e.cov/(e.valid-1):yn,add:(e,t,n)=>{const r=t-e.mean_x,i=n-e.mean_y;e.mean_x+=r/e.valid,e.mean_y+=i/e.valid;const s=n-e.mean_y;e.dev_x+=r*(t-e.mean_x),e.dev_y+=i*s,e.cov+=r*s},rem:(e,t,n)=>{const r=t-e.mean_x,i=n-e.mean_y;e.mean_x-=e.valid?r/e.valid:e.mean_x,e.mean_y-=e.valid?i/e.valid:e.mean_y;const s=n-e.mean_y;e.dev_x-=r*(t-e.mean_x),e.dev_y-=i*s,e.cov-=r*s}}),param:[2]},covariancep:{create:()=>Xr({value:e=>e.valid>1?e.cov/e.valid:yn}),param:[2],req:["covariance"]},corr:{create:()=>Xr({value:e=>e.valid>1?e.cov/(Math.sqrt(e.dev_x)*Math.sqrt(e.dev_y)):yn}),param:[2],req:["covariance"]},bins:{create:(e,t,n,r)=>Xr({value:i=>GWe(i.min,i.max,e,t,n,r)}),param:[1,4],req:["min","max"]}},xz={create(){let e;return{init:()=>e=1,value:t=>{const n=t.index;return n&&!t.peer(n)?e=n+1:e}}},param:[]},Cz={create(){let e;return{init:()=>e=0,value:t=>{const{index:n,peer:r,size:i}=t;let s=n;if(ee.index+1}},param:[]},rank:xz,avg_rank:{create(){let e,t;return{init:()=>(e=-1,t=1),value:n=>{const r=n.index;if(r>=e){for(t=e=r+1;n.peer(e);t+=++e);t/=e-r}return t}}},param:[]},dense_rank:{create(){let e;return{init:()=>e=1,value:t=>{const n=t.index;return n&&!t.peer(n)?++e:e}}},param:[]},percent_rank:{create(){const{init:e,value:t}=xz.create();return{init:e,value:n=>(t(n)-1)/(n.size-1)}},param:[]},cume_dist:Cz,ntile:{create(e){e=+e,e>0||Wt("ntile num must be greater than zero.");const{init:t,value:n}=Cz.create();return{init:t,value:r=>Math.ceil(e*n(r))}},param:[0,1]},lag:{create(e,t=yn){return e=+e||1,{init:Sl,value:(n,r)=>{const i=n.index-e;return i>=0?n.value(i,r):t}}},param:[1,2]},lead:{create(e,t=yn){return e=+e||1,{init:Sl,value:(n,r)=>{const i=n.index+e;return ie.value(e.i0,t)}},param:[1]},last_value:{create(){return{init:Sl,value:(e,t)=>e.value(e.i1-1,t)}},param:[1]},nth_value:{create(e){return e=+e,e>0||Wt("nth_value nth must be greater than zero."),{init:Sl,value:(t,n)=>{const r=t.i0+(e-1);return rt=e,value:(n,r)=>{const i=n.value(n.index,r);return Ma(i)?t=i:t}}},param:[1,1]},fill_up:{create(e=yn){let t,n;return{init:()=>(t=e,n=-1),value:(r,i)=>r.index<=n?t:(n=XWe(r,i,r.index))>=0?t=r.value(n,i):(n=r.size,t=e)}},param:[1,1]}};function XWe(e,t,n){for(const r=e.size;nN0(e,t,n),expr:(e,t)=>N0(`(row,data,op)=>${e}`,Bp,t),expr2:(e,t)=>N0(`(row0,data0,row,data)=>${e}`,Bp,t),join:(e,t)=>N0(`(row1,data1,row2,data2)=>${e}`,Bp,t),param:(e,t)=>N0(e,Bp,t)},JWe={"==":1,"!=":1,"===":1,"!==":1};function Nse(e,t,n=0,r,i){if(e.type=i1,e.name=t,e.table=n,i&&r&&sr(r.keyFor)){const s=JWe[i.operator]?i.left===e?i.right:i.left:i.callee&&i.callee.name==="equal"?i.arguments[i.arguments[0]===e?1:0]:null;s&&s.type===kg&&ZWe(i,e,s,r.keyFor(s.value))}return e}function ZWe(e,t,n,r){return r<0?(e.type=kg,e.value=!1,e.raw="false"):(t.type=zWe,n.value=r,n.raw=r+""),!0}function MC(e){return En(e)?e:q6(e)?e.entries():e?Object.entries(e):[]}const kse="row_object";function Dse(e,t){e.type=UWe;const n=e.properties=[];for(const r of MC(t)){const[i,s]=En(r)?r:[r,r];n.push({type:Tse,key:{type:kg,raw:el(s)},value:Nse({computed:!0},i)})}return e}function $se(e){return iI(Dse({},e))}function Lse(e){return K6.expr($se(e))}function Q6(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function un(e){return this instanceof un?(this.v=e,this):new un(e)}function Fd(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){s.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{u(r[d](h))}catch(p){f(s[0][3],p)}}function u(d){d.value instanceof un?Promise.resolve(d.value.v).then(l,c):f(s[0][2],d)}function l(d){a("next",d)}function c(d){a("throw",d)}function f(d,h){d(h),s.shift(),s.length&&a(s[0][0],s[0][1])}}function KO(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,s){t[i]=e[i]?function(o){return(n=!n)?{value:un(e[i](o)),done:!1}:s?s(o):o}:s}}function My(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Az=="function"?Az(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(o){return new Promise(function(a,u){o=e[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}const eqe=new TextDecoder("utf-8"),sk=e=>eqe.decode(e),tqe=new TextEncoder,X6=e=>tqe.encode(e),nqe=e=>typeof e=="boolean",Ls=e=>typeof e=="function",Zf=e=>e!=null&&Object(e)===e,FC=e=>Zf(e)&&Ls(e.then),J6=e=>Zf(e)&&Ls(e[Symbol.iterator]),BC=e=>Zf(e)&&Ls(e[Symbol.asyncIterator]),rqe=e=>Zf(e)&&"done"in e&&"value"in e,Mse=e=>"_getDOMStream"in e&&"_getNodeStream"in e,iqe=e=>Zf(e)&&Ls(e.abort)&&Ls(e.getWriter)&&!Mse(e),sqe=e=>Zf(e)&&Ls(e.end)&&Ls(e.write)&&nqe(e.writable)&&!Mse(e),oqe=e=>Zf(e)&&Ls(e.clear)&&Ls(e.bytes)&&Ls(e.position)&&Ls(e.setPosition)&&Ls(e.capacity)&&Ls(e.getBufferIdentifier)&&Ls(e.createLong),Z6=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function aqe(e){const t=e[0]?[e[0]]:[];let n,r,i,s;for(let o,a,u=0,l=0,c=e.length;++uc+f.byteLength,0);let i,s,o,a=0,u=-1;const l=Math.min(t||Number.POSITIVE_INFINITY,r);for(const c=n.length;++ufi(Int32Array,e),Mn=e=>fi(Uint8Array,e),ok=e=>(e.next(),e);function*uqe(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Z6?n(t):J6(t)?t:n(t);return yield*ok(function*(i){let s=null;do s=i.next(yield fi(e,s));while(!s.done)}(r[Symbol.iterator]())),new e}const lqe=e=>uqe(Uint8Array,e);function Fse(e,t){return Fd(this,arguments,function*(){if(FC(t))return yield un(yield un(yield*KO(My(Fse(e,yield un(t))))));const r=function(o){return Fd(this,arguments,function*(){yield yield un(yield un(o))})},i=function(o){return Fd(this,arguments,function*(){yield un(yield*KO(My(ok(function*(a){let u=null;do u=a.next(yield u==null?void 0:u.value);while(!u.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Z6?r(t):J6(t)?i(t):BC(t)?t:r(t);return yield un(yield*KO(My(ok(function(o){return Fd(this,arguments,function*(){let a=null;do a=yield un(o.next(yield yield un(fi(e,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield un(new e)})}const cqe=e=>Fse(Uint8Array,e);function Bse(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r0)do if(e[n]!==t[n])return!1;while(++n(e.next(),e);function*dqe(e){let t,n=!1,r=[],i,s,o,a=0;function u(){return s==="peek"?tl(r,o)[0]:([i,r,a]=tl(r,o),i)}({cmd:s,size:o}=yield null);const l=lqe(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield u());while(o0&&(i.push(s),u+=s.byteLength),n||a<=u)do({cmd:o,size:a}=yield yield un(l()));while(a0&&(i.push(Mn(s)),u+=s.byteLength),n||a<=u)do({cmd:o,size:a}=yield yield un(l()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Il(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Il(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=Mn(n)),n})}}const QO=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function gqe(e){return Fd(this,arguments,function*(){const n=[];let r="error",i=!1,s=null,o,a,u=0,l=[],c;function f(){return o==="peek"?tl(l,a)[0]:([c,l,u]=tl(l,a),c)}if({cmd:o,size:a}=yield yield un(null),e.isTTY)return yield yield un(new Uint8Array(0)),yield un(null);try{n[0]=QO(e,"end"),n[1]=QO(e,"error");do{if(n[2]=QO(e,"readable"),[r,s]=yield un(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-u)?(c=Mn(e.read(a-u)),c.byteLength0&&(l.push(c),u+=c.byteLength)),i||a<=u)do({cmd:o,size:a}=yield yield un(f()));while(a{for(const[g,v]of h)e.off(g,v);try{const g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var gs;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(gs||(gs={}));var so;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(so||(so={}));var $i;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})($i||($i={}));var nl;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(nl||(nl={}));var vt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(vt||(vt={}));var rl;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(rl||(rl={}));var pi;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(pi||(pi={}));var G;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(G||(G={}));var _l;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(_l||(_l={}));const yqe=void 0;function vh(e){if(e===null)return"null";if(e===yqe)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>vh(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}const vqe=Symbol.for("isArrowBigNum");function ru(e,...t){return t.length===0?Object.setPrototypeOf(fi(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}ru.prototype[vqe]=!0;ru.prototype.toJSON=function(){return`"${Fv(this)}"`};ru.prototype.valueOf=function(){return jse(this)};ru.prototype.toString=function(){return Fv(this)};ru.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return jse(this);case"string":return Fv(this);case"default":return _qe(this)}return Fv(this)};function dm(...e){return ru.apply(this,e)}function hm(...e){return ru.apply(this,e)}function Mv(...e){return ru.apply(this,e)}Object.setPrototypeOf(dm.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(hm.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Mv.prototype,Object.create(Uint32Array.prototype));Object.assign(dm.prototype,ru.prototype,{constructor:dm,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(hm.prototype,ru.prototype,{constructor:hm,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Mv.prototype,ru.prototype,{constructor:Mv,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function jse(e){const{buffer:t,byteOffset:n,length:r,signed:i}=e,s=new BigUint64Array(t,n,r),o=i&&s.at(-1)&BigInt(1)<{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return XO(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return XO(e);t=t.slice();let r=1;for(let s=0;se.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Fv(e);function XO(e){let t="";const n=new Uint32Array(2);let r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let s=-1;const o=r.length-1;do{for(n[0]=r[s=0];sNumber.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var Use,Vse,zse,Hse,Wse,qse,Gse,Yse,Kse,Qse,Xse,Jse,Zse,eoe,toe,noe,roe,ioe,soe,ooe;class Bt{static isNull(t){return(t==null?void 0:t.typeId)===G.Null}static isInt(t){return(t==null?void 0:t.typeId)===G.Int}static isFloat(t){return(t==null?void 0:t.typeId)===G.Float}static isBinary(t){return(t==null?void 0:t.typeId)===G.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===G.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===G.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===G.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===G.Date}static isTime(t){return(t==null?void 0:t.typeId)===G.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===G.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===G.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===G.Duration}static isList(t){return(t==null?void 0:t.typeId)===G.List}static isStruct(t){return(t==null?void 0:t.typeId)===G.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===G.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===G.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===G.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===G.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===G.Dictionary}static isDenseUnion(t){return Bt.isUnion(t)&&t.mode===so.Dense}static isSparseUnion(t){return Bt.isUnion(t)&&t.mode===so.Sparse}get typeId(){return G.NONE}}Use=Symbol.toStringTag;Bt[Use]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(Bt.prototype);let Jl=class extends Bt{toString(){return"Null"}get typeId(){return G.Null}};Vse=Symbol.toStringTag;Jl[Vse]=(e=>e[Symbol.toStringTag]="Null")(Jl.prototype);class ws extends Bt{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return G.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}zse=Symbol.toStringTag;ws[zse]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(ws.prototype);class tL extends ws{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class nL extends ws{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Nf extends ws{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class rL extends ws{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}class iL extends ws{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}class sL extends ws{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class oL extends ws{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class aL extends ws{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}Object.defineProperty(tL.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(nL.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Nf.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(rL.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(iL.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(sL.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(oL.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(aL.prototype,"ArrayType",{value:BigUint64Array});class kf extends Bt{constructor(t){super(),this.precision=t}get typeId(){return G.Float}get ArrayType(){switch(this.precision){case $i.HALF:return Uint16Array;case $i.SINGLE:return Float32Array;case $i.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Hse=Symbol.toStringTag;kf[Hse]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(kf.prototype);class aoe extends kf{constructor(){super($i.HALF)}}class uL extends kf{constructor(){super($i.SINGLE)}}class lL extends kf{constructor(){super($i.DOUBLE)}}Object.defineProperty(aoe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(uL.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(lL.prototype,"ArrayType",{value:Float64Array});let Bv=class extends Bt{constructor(){super()}get typeId(){return G.Binary}toString(){return"Binary"}};Wse=Symbol.toStringTag;Bv[Wse]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Bv.prototype);let Qm=class extends Bt{constructor(){super()}get typeId(){return G.Utf8}toString(){return"Utf8"}};qse=Symbol.toStringTag;Qm[qse]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Qm.prototype);let jv=class extends Bt{constructor(){super()}get typeId(){return G.Bool}toString(){return"Bool"}};Gse=Symbol.toStringTag;jv[Gse]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(jv.prototype);let aI=class extends Bt{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return G.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Yse=Symbol.toStringTag;aI[Yse]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(aI.prototype);class Xm extends Bt{constructor(t){super(),this.unit=t}get typeId(){return G.Date}toString(){return`Date${(this.unit+1)*32}<${nl[this.unit]}>`}}Kse=Symbol.toStringTag;Xm[Kse]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Xm.prototype);class bqe extends Xm{constructor(){super(nl.DAY)}}class wqe extends Xm{constructor(){super(nl.MILLISECOND)}}class Zl extends Bt{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return G.Time}toString(){return`Time${this.bitWidth}<${vt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Qse=Symbol.toStringTag;Zl[Qse]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Zl.prototype);class Eqe extends Zl{constructor(){super(vt.SECOND,32)}}class Sqe extends Zl{constructor(){super(vt.MILLISECOND,32)}}class Tqe extends Zl{constructor(){super(vt.MICROSECOND,64)}}class Iqe extends Zl{constructor(){super(vt.NANOSECOND,64)}}class uI extends Bt{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return G.Timestamp}toString(){return`Timestamp<${vt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Xse=Symbol.toStringTag;uI[Xse]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(uI.prototype);class Jm extends Bt{constructor(t){super(),this.unit=t}get typeId(){return G.Interval}toString(){return`Interval<${rl[this.unit]}>`}}Jse=Symbol.toStringTag;Jm[Jse]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Jm.prototype);class xqe extends Jm{constructor(){super(rl.DAY_TIME)}}class Cqe extends Jm{constructor(){super(rl.YEAR_MONTH)}}let lI=class extends Bt{constructor(t){super(),this.unit=t}get typeId(){return G.Duration}toString(){return`Duration<${vt[this.unit]}>`}};Zse=Symbol.toStringTag;lI[Zse]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(lI.prototype);let Zm=class extends Bt{constructor(t){super(),this.children=[t]}get typeId(){return G.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};eoe=Symbol.toStringTag;Zm[eoe]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Zm.prototype);class rs extends Bt{constructor(t){super(),this.children=t}get typeId(){return G.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}toe=Symbol.toStringTag;rs[toe]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(rs.prototype);class Uv extends Bt{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}get typeId(){return G.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}noe=Symbol.toStringTag;Uv[noe]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Uv.prototype);let cI=class extends Bt{constructor(t){super(),this.byteWidth=t}get typeId(){return G.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};roe=Symbol.toStringTag;cI[roe]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(cI.prototype);let eg=class extends Bt{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return G.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};ioe=Symbol.toStringTag;eg[ioe]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(eg.prototype);class Vv extends Bt{constructor(t,n=!1){var r,i,s;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t==null?void 0:t.type)===null||r===void 0)&&r.children)){const o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get typeId(){return G.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}soe=Symbol.toStringTag;Vv[soe]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Vv.prototype);const Aqe=(e=>()=>++e)(-1);class Df extends Bt{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Aqe():Ka(r)}get typeId(){return G.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}ooe=Symbol.toStringTag;Df[ooe]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Df.prototype);function pu(e){const t=e;switch(e.typeId){case G.Decimal:return e.bitWidth/32;case G.Timestamp:return 2;case G.Date:return 1+t.unit;case G.Interval:return 1+t.unit;case G.FixedSizeList:return t.listSize;case G.FixedSizeBinary:return t.byteWidth;default:return 1}}class qt{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return Pqe(this,t,n)}getVisitFnByTypeId(t,n=!0){return pp(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}}function Pqe(e,t,n=!0){return typeof t=="number"?pp(e,t,n):typeof t=="string"&&t in G?pp(e,G[t],n):t&&t instanceof Bt?pp(e,Oz(t),n):t!=null&&t.type&&t.type instanceof Bt?pp(e,Oz(t.type),n):pp(e,G.NONE,n)}function pp(e,t,n=!0){let r=null;switch(t){case G.Null:r=e.visitNull;break;case G.Bool:r=e.visitBool;break;case G.Int:r=e.visitInt;break;case G.Int8:r=e.visitInt8||e.visitInt;break;case G.Int16:r=e.visitInt16||e.visitInt;break;case G.Int32:r=e.visitInt32||e.visitInt;break;case G.Int64:r=e.visitInt64||e.visitInt;break;case G.Uint8:r=e.visitUint8||e.visitInt;break;case G.Uint16:r=e.visitUint16||e.visitInt;break;case G.Uint32:r=e.visitUint32||e.visitInt;break;case G.Uint64:r=e.visitUint64||e.visitInt;break;case G.Float:r=e.visitFloat;break;case G.Float16:r=e.visitFloat16||e.visitFloat;break;case G.Float32:r=e.visitFloat32||e.visitFloat;break;case G.Float64:r=e.visitFloat64||e.visitFloat;break;case G.Utf8:r=e.visitUtf8;break;case G.Binary:r=e.visitBinary;break;case G.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case G.Date:r=e.visitDate;break;case G.DateDay:r=e.visitDateDay||e.visitDate;break;case G.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case G.Timestamp:r=e.visitTimestamp;break;case G.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case G.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case G.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case G.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case G.Time:r=e.visitTime;break;case G.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case G.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case G.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case G.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case G.Decimal:r=e.visitDecimal;break;case G.List:r=e.visitList;break;case G.Struct:r=e.visitStruct;break;case G.Union:r=e.visitUnion;break;case G.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case G.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case G.Dictionary:r=e.visitDictionary;break;case G.Interval:r=e.visitInterval;break;case G.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case G.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case G.Duration:r=e.visitDuration;break;case G.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case G.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case G.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case G.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case G.FixedSizeList:r=e.visitFixedSizeList;break;case G.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${G[t]}'`)}function Oz(e){switch(e.typeId){case G.Null:return G.Null;case G.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?G.Int8:G.Uint8;case 16:return n?G.Int16:G.Uint16;case 32:return n?G.Int32:G.Uint32;case 64:return n?G.Int64:G.Uint64}return G.Int}case G.Float:switch(e.precision){case $i.HALF:return G.Float16;case $i.SINGLE:return G.Float32;case $i.DOUBLE:return G.Float64}return G.Float;case G.Binary:return G.Binary;case G.Utf8:return G.Utf8;case G.Bool:return G.Bool;case G.Decimal:return G.Decimal;case G.Time:switch(e.unit){case vt.SECOND:return G.TimeSecond;case vt.MILLISECOND:return G.TimeMillisecond;case vt.MICROSECOND:return G.TimeMicrosecond;case vt.NANOSECOND:return G.TimeNanosecond}return G.Time;case G.Timestamp:switch(e.unit){case vt.SECOND:return G.TimestampSecond;case vt.MILLISECOND:return G.TimestampMillisecond;case vt.MICROSECOND:return G.TimestampMicrosecond;case vt.NANOSECOND:return G.TimestampNanosecond}return G.Timestamp;case G.Date:switch(e.unit){case nl.DAY:return G.DateDay;case nl.MILLISECOND:return G.DateMillisecond}return G.Date;case G.Interval:switch(e.unit){case rl.DAY_TIME:return G.IntervalDayTime;case rl.YEAR_MONTH:return G.IntervalYearMonth}return G.Interval;case G.Duration:switch(e.unit){case vt.SECOND:return G.DurationSecond;case vt.MILLISECOND:return G.DurationMillisecond;case vt.MICROSECOND:return G.DurationMicrosecond;case vt.NANOSECOND:return G.DurationNanosecond}return G.Duration;case G.Map:return G.Map;case G.List:return G.List;case G.Struct:return G.Struct;case G.Union:switch(e.mode){case so.Dense:return G.DenseUnion;case so.Sparse:return G.SparseUnion}return G.Union;case G.FixedSizeBinary:return G.FixedSizeBinary;case G.FixedSizeList:return G.FixedSizeList;case G.Dictionary:return G.Dictionary}throw new Error(`Unrecognized type '${G[e.typeId]}'`)}qt.prototype.visitInt8=null;qt.prototype.visitInt16=null;qt.prototype.visitInt32=null;qt.prototype.visitInt64=null;qt.prototype.visitUint8=null;qt.prototype.visitUint16=null;qt.prototype.visitUint32=null;qt.prototype.visitUint64=null;qt.prototype.visitFloat16=null;qt.prototype.visitFloat32=null;qt.prototype.visitFloat64=null;qt.prototype.visitDateDay=null;qt.prototype.visitDateMillisecond=null;qt.prototype.visitTimestampSecond=null;qt.prototype.visitTimestampMillisecond=null;qt.prototype.visitTimestampMicrosecond=null;qt.prototype.visitTimestampNanosecond=null;qt.prototype.visitTimeSecond=null;qt.prototype.visitTimeMillisecond=null;qt.prototype.visitTimeMicrosecond=null;qt.prototype.visitTimeNanosecond=null;qt.prototype.visitDenseUnion=null;qt.prototype.visitSparseUnion=null;qt.prototype.visitIntervalDayTime=null;qt.prototype.visitIntervalYearMonth=null;qt.prototype.visitDuration=null;qt.prototype.visitDurationSecond=null;qt.prototype.visitDurationMillisecond=null;qt.prototype.visitDurationMicrosecond=null;qt.prototype.visitDurationNanosecond=null;const uoe=new Float64Array(1),op=new Uint32Array(uoe.buffer);function loe(e){const t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function coe(e){if(e!==e)return 32256;uoe[0]=e;const t=(op[1]&2147483648)>>16&65535;let n=op[1]&2146435072,r=0;return n>=1089470464?op[0]>0?n=31744:(n=(n&2080374784)>>16,r=(op[1]&1048575)>>10):n<=1056964608?(r=1048576+(op[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(op[1]&1048575)+512>>10),t|n|r&65535}class It extends qt{}function Ot(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const Oqe=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},cL=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},Rqe=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},Nqe=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},foe=(e,t,n,r)=>{if(n+1{const i=e+n;r?t[i>>3]|=1<>3]&=~(1<{e[t]=n},fL=({values:e},t,n)=>{e[t]=n},doe=({values:e},t,n)=>{e[t]=coe(n)},Dqe=(e,t,n)=>{switch(e.type.precision){case $i.HALF:return doe(e,t,n);case $i.SINGLE:case $i.DOUBLE:return fL(e,t,n)}},dL=({values:e},t,n)=>{Oqe(e,t,n.valueOf())},hL=({values:e},t,n)=>{cL(e,t*2,n.valueOf())},hoe=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},$qe=({values:e,valueOffsets:t},n,r)=>foe(e,t,n,r),Lqe=({values:e,valueOffsets:t},n,r)=>{foe(e,t,n,X6(r))},poe=(e,t,n)=>{e.type.unit===nl.DAY?dL(e,t,n):hL(e,t,n)},pL=({values:e},t,n)=>cL(e,t*2,n/1e3),mL=({values:e},t,n)=>cL(e,t*2,n),gL=({values:e},t,n)=>Rqe(e,t*2,n),yL=({values:e},t,n)=>Nqe(e,t*2,n),moe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return pL(e,t,n);case vt.MILLISECOND:return mL(e,t,n);case vt.MICROSECOND:return gL(e,t,n);case vt.NANOSECOND:return yL(e,t,n)}},vL=({values:e},t,n)=>{e[t]=n},_L=({values:e},t,n)=>{e[t]=n},bL=({values:e},t,n)=>{e[t]=n},wL=({values:e},t,n)=>{e[t]=n},goe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return vL(e,t,n);case vt.MILLISECOND:return _L(e,t,n);case vt.MICROSECOND:return bL(e,t,n);case vt.NANOSECOND:return wL(e,t,n)}},yoe=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Mqe=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,s=ca.getVisitFn(r);if(Array.isArray(n))for(let o=-1,a=i[t],u=i[t+1];a{const r=e.children[0],{valueOffsets:i}=e,s=ca.getVisitFn(r);let{[t]:o,[t+1]:a}=i;const u=n instanceof Map?n.entries():Object.entries(n);for(const l of u)if(s(r,o,l),++o>=a)break},Bqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),jqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),Uqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),Vqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),zqe=(e,t,n)=>{const r=e.type.children.map(s=>ca.getVisitFn(s.type)),i=n instanceof Map?Uqe(t,n):n instanceof Sn?jqe(t,n):Array.isArray(n)?Bqe(t,n):Vqe(t,n);e.type.children.forEach((s,o)=>i(r[o],e.children[o],s,o))},Hqe=(e,t,n)=>{e.type.mode===so.Dense?voe(e,t,n):_oe(e,t,n)},voe=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ca.visit(i,e.valueOffsets[t],n)},_oe=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ca.visit(i,t,n)},Wqe=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},boe=(e,t,n)=>{e.type.unit===rl.DAY_TIME?EL(e,t,n):SL(e,t,n)},EL=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},SL=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},TL=({values:e},t,n)=>{e[t]=n},IL=({values:e},t,n)=>{e[t]=n},xL=({values:e},t,n)=>{e[t]=n},CL=({values:e},t,n)=>{e[t]=n},woe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return TL(e,t,n);case vt.MILLISECOND:return IL(e,t,n);case vt.MICROSECOND:return xL(e,t,n);case vt.NANOSECOND:return CL(e,t,n)}},qqe=(e,t,n)=>{const{stride:r}=e,i=e.children[0],s=ca.getVisitFn(i);if(Array.isArray(n))for(let o=-1,a=t*r;++o`${vh(t)}: ${vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Gqe(this[Pa],this[pm])}}class Gqe{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return tn.name)}has(t,n){return t[Pa].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Pa].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[Pa].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=oo.visit(t[Pa].children[r],t[pm]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Pa].type.children.findIndex(s=>s.name===n);return i!==-1?(ca.visit(t[Pa].children[i],t[pm],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class _t extends qt{}function xt(e){return(t,n)=>t.getValid(n)?e(t,n):null}const Kqe=(e,t)=>864e5*e[t],PL=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Qqe=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,Xqe=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,Eoe=e=>new Date(e),Jqe=(e,t)=>Eoe(Kqe(e,t)),Zqe=(e,t)=>Eoe(PL(e,t)),eGe=(e,t)=>null,Soe=(e,t,n)=>{if(n+1>=t.length)return null;const r=t[n],i=t[n+1];return e.subarray(r,i)},tGe=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<Jqe(e,t),Ioe=({values:e},t)=>Zqe(e,t*2),ed=({stride:e,values:t},n)=>t[e*n],nGe=({stride:e,values:t},n)=>loe(t[e*n]),xoe=({values:e},t)=>e[t],rGe=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),iGe=({values:e,valueOffsets:t},n)=>Soe(e,t,n),sGe=({values:e,valueOffsets:t},n)=>{const r=Soe(e,t,n);return r!==null?sk(r):null},oGe=({values:e},t)=>e[t],aGe=({type:e,values:t},n)=>e.precision!==$i.HALF?t[n]:loe(t[n]),uGe=(e,t)=>e.type.unit===nl.DAY?Toe(e,t):Ioe(e,t),Coe=({values:e},t)=>1e3*PL(e,t*2),Aoe=({values:e},t)=>PL(e,t*2),Poe=({values:e},t)=>Qqe(e,t*2),Ooe=({values:e},t)=>Xqe(e,t*2),lGe=(e,t)=>{switch(e.type.unit){case vt.SECOND:return Coe(e,t);case vt.MILLISECOND:return Aoe(e,t);case vt.MICROSECOND:return Poe(e,t);case vt.NANOSECOND:return Ooe(e,t)}},Roe=({values:e},t)=>e[t],Noe=({values:e},t)=>e[t],koe=({values:e},t)=>e[t],Doe=({values:e},t)=>e[t],cGe=(e,t)=>{switch(e.type.unit){case vt.SECOND:return Roe(e,t);case vt.MILLISECOND:return Noe(e,t);case vt.MICROSECOND:return koe(e,t);case vt.NANOSECOND:return Doe(e,t)}},fGe=({values:e,stride:t},n)=>eL.decimal(e.subarray(t*n,t*(n+1))),dGe=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:s,[t*r+1]:o}=n,u=i[0].slice(s,o-s);return new Sn([u])},hGe=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:s}=n,o=r[0];return new jC(o.slice(i,s-i))},pGe=(e,t)=>new AL(e,t),mGe=(e,t)=>e.type.mode===so.Dense?$oe(e,t):Loe(e,t),$oe=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return oo.visit(r,e.valueOffsets[t])},Loe=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return oo.visit(r,t)},gGe=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},yGe=(e,t)=>e.type.unit===rl.DAY_TIME?Moe(e,t):Foe(e,t),Moe=({values:e},t)=>e.subarray(2*t,2*(t+1)),Foe=({values:e},t)=>{const n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},Boe=({values:e},t)=>e[t],joe=({values:e},t)=>e[t],Uoe=({values:e},t)=>e[t],Voe=({values:e},t)=>e[t],vGe=(e,t)=>{switch(e.type.unit){case vt.SECOND:return Boe(e,t);case vt.MILLISECOND:return joe(e,t);case vt.MICROSECOND:return Uoe(e,t);case vt.NANOSECOND:return Voe(e,t)}},_Ge=(e,t)=>{const{stride:n,children:r}=e,s=r[0].slice(t*n,n);return new Sn([s])};_t.prototype.visitNull=xt(eGe);_t.prototype.visitBool=xt(tGe);_t.prototype.visitInt=xt(oGe);_t.prototype.visitInt8=xt(ed);_t.prototype.visitInt16=xt(ed);_t.prototype.visitInt32=xt(ed);_t.prototype.visitInt64=xt(xoe);_t.prototype.visitUint8=xt(ed);_t.prototype.visitUint16=xt(ed);_t.prototype.visitUint32=xt(ed);_t.prototype.visitUint64=xt(xoe);_t.prototype.visitFloat=xt(aGe);_t.prototype.visitFloat16=xt(nGe);_t.prototype.visitFloat32=xt(ed);_t.prototype.visitFloat64=xt(ed);_t.prototype.visitUtf8=xt(sGe);_t.prototype.visitBinary=xt(iGe);_t.prototype.visitFixedSizeBinary=xt(rGe);_t.prototype.visitDate=xt(uGe);_t.prototype.visitDateDay=xt(Toe);_t.prototype.visitDateMillisecond=xt(Ioe);_t.prototype.visitTimestamp=xt(lGe);_t.prototype.visitTimestampSecond=xt(Coe);_t.prototype.visitTimestampMillisecond=xt(Aoe);_t.prototype.visitTimestampMicrosecond=xt(Poe);_t.prototype.visitTimestampNanosecond=xt(Ooe);_t.prototype.visitTime=xt(cGe);_t.prototype.visitTimeSecond=xt(Roe);_t.prototype.visitTimeMillisecond=xt(Noe);_t.prototype.visitTimeMicrosecond=xt(koe);_t.prototype.visitTimeNanosecond=xt(Doe);_t.prototype.visitDecimal=xt(fGe);_t.prototype.visitList=xt(dGe);_t.prototype.visitStruct=xt(pGe);_t.prototype.visitUnion=xt(mGe);_t.prototype.visitDenseUnion=xt($oe);_t.prototype.visitSparseUnion=xt(Loe);_t.prototype.visitDictionary=xt(gGe);_t.prototype.visitInterval=xt(yGe);_t.prototype.visitIntervalDayTime=xt(Moe);_t.prototype.visitIntervalYearMonth=xt(Foe);_t.prototype.visitDuration=xt(vGe);_t.prototype.visitDurationSecond=xt(Boe);_t.prototype.visitDurationMillisecond=xt(joe);_t.prototype.visitDurationMicrosecond=xt(Uoe);_t.prototype.visitDurationNanosecond=xt(Voe);_t.prototype.visitFixedSizeList=xt(_Ge);_t.prototype.visitMap=xt(hGe);const oo=new _t,La=Symbol.for("keys"),mm=Symbol.for("vals");class jC{constructor(t){return this[La]=new Sn([t.children[0]]).memoize(),this[mm]=t.children[1],new Proxy(this,new wGe)}[Symbol.iterator](){return new bGe(this[La],this[mm])}get size(){return this[La].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[La],n=this[mm],r={};for(let i=-1,s=t.length;++i`${vh(t)}: ${vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class bGe{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),oo.visit(this.vals,t)]})}}class wGe{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[La].toArray().map(String)}has(t,n){return t[La].includes(n)}getOwnPropertyDescriptor(t,n){if(t[La].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[La].indexOf(n);if(r!==-1){const i=oo.visit(Reflect.get(t,mm),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[La].indexOf(n);return i!==-1?(ca.visit(Reflect.get(t,mm),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(jC.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[La]:{writable:!0,enumerable:!1,configurable:!1,value:null},[mm]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Rz;function zoe(e,t,n,r){const{length:i=0}=e;let s=typeof t!="number"?0:t,o=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),r?r(e,s,o):[s,o]}const Nz=e=>e!==e;function Dg(e){if(typeof e!=="object"||e===null)return Nz(e)?Nz:n=>n===e;if(e instanceof Date){const n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?fqe(e,n):!1:e instanceof Map?SGe(e):Array.isArray(e)?EGe(e):e instanceof Sn?TGe(e):IGe(e,!0)}function EGe(e){const t=[];for(let n=-1,r=e.length;++n!1;const r=[];for(let i=-1,s=n.length;++i{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return xGe(e,n);case Map:return kz(e,n,n.keys());case jC:case AL:case Object:case void 0:return kz(e,n,t||Object.keys(n))}return n instanceof Sn?CGe(e,n):!1}}function xGe(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r>r}function fI(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength>3):Woe(new OL(n,e,t,null,Hoe)).subarray(0,r)),i}return n}function Woe(e){const t=[];let n=0,r=0,i=0;for(const o of e)o&&(i|=1<0)&&(t[n++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class OL{constructor(t,n,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8===0?0:8-t%8);return ak(e,t,i)+ak(e,r,n)+PGe(e,i>>3,r-i>>3)}function PGe(e,t,n){let r=0,i=Math.trunc(t);const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=JO(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=JO(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=JO(s.getUint8(i)),i+=1;return r}function JO(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const OGe=-1;class Ln{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return Bt.isSparseUnion(t)?this.children.some(n=>n.nullable):Bt.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(Bt.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=OGe&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-ak(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let u;s instanceof Ln?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=pu(t),s&&((u=s[0])&&(this.valueOffsets=u),(u=s[1])&&(this.values=u),(u=s[2])&&(this.nullBitmap=u),(u=s[3])&&(this.typeIds=u)))}getValid(t){const{type:n}=this;if(Bt.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===so.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<>3;(!s||s.byteLength<=c)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0&&s.set(fI(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s,_nullCount:-1}));const f=s[c];r=(f&l)!==0,n?s[c]=f|l:s[c]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,o=this.children){return new Ln(t,n,r,i,s,o,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?r:1,u=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,o,u,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===G.Null)return this.clone(this.type,0,t,0);const{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<0&&i.set(fI(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[_l.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),s)}_sliceBuffers(t,n,r,i){let s;const{buffers:o}=this;return(s=o[_l.TYPE])&&(o[_l.TYPE]=s.subarray(t,t+n)),(s=o[_l.OFFSET])&&(o[_l.OFFSET]=s.subarray(t,t+n+1))||(s=o[_l.DATA])&&(o[_l.DATA]=i===6?s:s.subarray(r*t,r*(t+n))),o}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}Ln.prototype.children=Object.freeze([]);class Fy extends qt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new Ln(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.data),s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,i,s])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.data),s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,void 0,s],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=Mn(t.nullBitmap),{length:o=i.reduce((u,{length:l})=>Math.max(u,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=fi(n.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(Bt.isSparseUnion(n))return new Ln(n,r,o,a,[void 0,void 0,void 0,s],i);const u=k0(t.valueOffsets);return new Ln(n,r,o,a,[u,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.indices.ArrayType,t.data),{["dictionary"]:o=new Sn([new Fy().visit({type:n.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Fy().visit({type:n.valueType})}=t,s=Mn(t.nullBitmap),{["length"]:o=i.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Fy().visit({type:n.childType})}=t,s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,void 0,s],[i])}}const RGe=new Fy;function Ji(e){return RGe.visit(e)}class Dz{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext+n.nullCount,0)}function Goe(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Yoe(e,t,n,r){const i=[];for(let s=-1,o=e.length;++s=r)break;if(n>=u+l)continue;if(u>=n&&u+l<=r){i.push(a);continue}const c=Math.max(0,n-u),f=Math.min(r-u,l);i.push(a.slice(c,f-c))}return i.length===0&&i.push(e[0].slice(0,0)),i}function RL(e,t,n,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function kGe(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new OL(n,e.offset+(t||0),e.length,n,Hoe)){if(!i)return r;++r}return-1}function $t(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case G.Union:break;case G.Dictionary:break;default:return kGe(e,n)}const r=oo.getVisitFn(e),i=Dg(t);for(let s=(n||0)-1,o=e.length;++s{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Dz(e.data.length,r=>{const s=e.data[r].length,o=e.slice(n,n+s);return n+=s,new DGe(o)})}class DGe{constructor(t){this.vector=t,this.index=0}next(){return this.indexe+t;class td extends qt{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===vt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+il.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+il.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}}const LGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),MGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),FGe=({valueOffsets:e,stride:t,children:n},r)=>{const i=n[0],{[r*t]:s}=e,{[r*t+1]:o}=e,a=il.getVisitFn(i.type),u=i.slice(s,o-s);let l=8;for(let c=-1,f=o-s;++c{const r=t[0],i=r.slice(n*e,e),s=il.getVisitFn(r.type);let o=0;for(let a=-1,u=i.length;++ae.type.mode===so.Dense?Joe(e,t):Zoe(e,t),Joe=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{const s=e.typeIdToChildIndex[n[i]];return 8+il.visit(t[s],r[i])},Zoe=({children:e},t)=>4+il.visitMany(e,e.map(()=>t)).reduce($Ge,0);td.prototype.visitUtf8=LGe;td.prototype.visitBinary=MGe;td.prototype.visitList=FGe;td.prototype.visitFixedSizeList=BGe;td.prototype.visitUnion=jGe;td.prototype.visitDenseUnion=Joe;td.prototype.visitSparseUnion=Zoe;const il=new td;var eae;const tae={},nae={};class Sn{constructor(t){var n,r,i;const s=t[0]instanceof Sn?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof Ln)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:u,indexOf:l,byteLength:c}=tae[o.typeId],f=s[0];this.isValid=d=>NL(f,d),this.get=d=>a(f,d),this.set=(d,h)=>u(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>c(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,nae[o.typeId]),this._offsets=Goe(s);break}this.data=s,this.type=o,this.stride=pu(o),this.numChildren=(i=(r=o.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return qoe(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${G[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return kL.visit(this)}concat(...t){return new Sn(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new Sn(zoe(this,t,n,({data:r,_offsets:i},s,o)=>Yoe(r,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,length:r,stride:i,ArrayType:s}=this;switch(t.typeId){case G.Int:case G.Float:case G.Decimal:case G.Time:case G.Timestamp:switch(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((o,{values:a,length:u})=>(o.array.set(a.subarray(0,u*i),o.offset),o.offset+=u*i,o),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&tn[t])):null}get isMemoized(){return Bt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Bt.isDictionary(this.type)){const t=new hI(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new Sn(n)}return new hI(this)}unmemoize(){if(Bt.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new Sn(n)}return this}}eae=Symbol.toStringTag;Sn[eae]=(e=>{e.type=Bt.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;const t=Object.keys(G).map(n=>G[n]).filter(n=>typeof n=="number"&&n!==G.NONE);for(const n of t){const r=oo.getVisitFnByTypeId(n),i=ca.getVisitFnByTypeId(n),s=dI.getVisitFnByTypeId(n),o=il.getVisitFnByTypeId(n);tae[n]={get:r,set:i,indexOf:s,byteLength:o},nae[n]=Object.create(e,{isValid:{value:gm(NL)},get:{value:gm(oo.getVisitFnByTypeId(n))},set:{value:Koe(ca.getVisitFnByTypeId(n))},indexOf:{value:Qoe(dI.getVisitFnByTypeId(n))},getByteLength:{value:gm(il.getVisitFnByTypeId(n))}})}return"Vector"})(Sn.prototype);class hI extends Sn{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const u=n.call(this,o);return s[o]=u,u}}),Object.defineProperty(this,"set",{value(o,a){r.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new hI(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Sn(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}function UGe(e){if(!e||e.length<=0)return function(i){return!0};let t="";const n=e.filter(r=>r===r);return n.length>0&&(t=` + */var z6=new WeakMap,bHe=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),wHe=function(){function e(t,n){this.callback=t,this.observer=n}return e}();function EHe(e){return z6.get(e)}function SHe(e,t){return e.observers.get(t)}function THe(e,t){e.observers.delete(t.callback)}function IHe(e,t){t.unobserve()}function xHe(e,t){var n=[],r,i=EHe(e);if(!i)i=new bHe(e),z6.set(e,i);else{var s=SHe(i,t);r=s&&s.observer}if(r)return r;if(r={},i.value=Gs(e),t){r.callback=t,r.next=null;var o=function(){ZN(r)},a=function(){clearTimeout(r.next),r.next=setTimeout(o)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return r.patches=n,r.object=e,r.unobserve=function(){ZN(r),clearTimeout(r.next),THe(i,r),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new wHe(t,r)),r}function ZN(e,t){t===void 0&&(t=!1);var n=z6.get(e.object);H6(n.value,e.object,e.patches,"",t),e.patches.length&&kC(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function H6(e,t,n,r,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=QN(t),o=QN(e),a=!1,u=o.length-1;u>=0;u--){var l=o[u],c=e[l];if(KN(t,l)&&!(t[l]===void 0&&c!==void 0&&Array.isArray(t)===!1)){var f=t[l];typeof c=="object"&&c!=null&&typeof f=="object"&&f!=null&&Array.isArray(c)===Array.isArray(f)?H6(c,f,n,r+"/"+vd(l),i):c!==f&&(i&&n.push({op:"test",path:r+"/"+vd(l),value:Gs(c)}),n.push({op:"replace",path:r+"/"+vd(l),value:Gs(f)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+vd(l),value:Gs(c)}),n.push({op:"remove",path:r+"/"+vd(l)}),a=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}))}if(!(!a&&s.length==o.length))for(var u=0;u(e.TRAVERSAL_START="Traversal_Start",e.TRAVERSAL_END="Traversal_End",e))(ey||{});function jw(e,t){const n=e.state;if(n.type==="checkpoint")return n.val;const{checkpointRef:r}=n,i=t[r],s=sse(i,e,t);s.shift();const o=s.map(u=>t[u]).map(u=>u.state.val).reduce((u,l)=>[...u,...l],[]),a=jw(i,t);return kC(a,Gs(o),!0,!1).newDocument}function AHe(e,t){const n=Object.keys(e).length;return new Set(t.map(r=>r.path.split("/")[0])).size{n=!0}),r.listen(ey.TRAVERSAL_END,()=>{n=!1});const o={add(c,f=i.current.id){i.update(i.addMetadata({id:f,meta:c}))},latestOfType(c,f=i.current.id){var d;return(d=i.backend.nodes[f].meta[c])==null?void 0:d.at(-1)},allOfType(c,f=i.current.id){return i.backend.nodes[f].meta[c]},latest(c=i.current.id){const f=i.backend.nodes[c].meta,d=Object.keys(f).reduce((h,p)=>{const m=f[p].at(-1);return m&&(h[p]=m),h},{});return Object.keys(d).length>0?d:void 0},all(c=i.current.id){return i.backend.nodes[c].meta},types(c=i.current.id){return Object.keys(i.backend.nodes[c].meta)}},a={add(c,f=i.current.id){i.update(i.addArtifact({id:f,artifact:c}))},latest(c=i.current.id){return i.backend.nodes[c].artifacts.at(-1)},all(c=i.current.id){return i.backend.nodes[c].artifacts}},u={add(c,f=i.current.id){o.add({annotation:c},f)},latest(c=i.current.id){var f;return(f=o.latestOfType("annotation",c))==null?void 0:f.val},all(c=i.current.id){var f;return(f=o.allOfType("annotation",c))==null?void 0:f.map(d=>d.val)}},l={add(c=i.current.id){o.add({bookmark:!0},c)},remove(c=i.current.id){o.add({bookmark:!1},c)},is(c=i.current.id){var f;return!!((f=o.latestOfType("bookmark",c))!=null&&f.val)},toggle(c=i.current.id){l.is(c)?l.remove(c):l.add(c)}};return{registry:e,get isTraversing(){return n},getState(c=i.current){return jw(c,i.backend.nodes)},graph:i,get current(){return i.current},get root(){return i.root},record({label:c,state:f,sideEffects:d,eventType:h,onlySideEffects:p=!1}){let m=null,y=null;const g=jw(this.current,this.graph.backend.nodes);if(p)y={type:"checkpoint",val:f};else{const v=rse(g,f);if(AHe(f,v)==="checkpoint")y={type:"checkpoint",val:f};else{const b=this.current.state.type==="checkpoint"?this.current.id:this.current.state.checkpointRef;y={type:"patch",val:v,checkpointRef:b}}}if(!y)throw new Error(`Could not calculate new state. Previous state is: ${JSON.stringify(this.current.state,null,2)}`);if(m=Jze({label:c,state:y,parent:this.current,sideEffects:d,event:h}),!m)throw new Error("State Node creation failed!");i.update(i.addNode(m))},async apply(c,f){const d=e.get(f.type),h=jw(this.current,this.graph.backend.nodes);if(d.config.hasSideEffects){const{do:p=f,undo:m}=d.func(f.payload);this.record({label:c,state:h,sideEffects:{do:[p],undo:[m]},eventType:d.config.eventType})}else{const p=d.func(h,f.payload);this.record({label:c,state:p,sideEffects:{do:[],undo:[]},eventType:d.config.eventType})}},async to(c){r.fire(ey.TRAVERSAL_START);const f=sse(i.current,i.backend.nodes[c],i.backend.nodes),d=[];for(let h=0;h0?this.to(f.children[c==="oldest"?0:f.children.length-1]):Promise.resolve(console.warn("Already at latest in this branch!"))},currentChange(c,f=!1){return i.currentChange(c,{skipOnNew:f})},done(){console.log("Setup later for URL sharing.")},tree(){return ose(i.root,i.backend.nodes)},on(c,f){r.listen(c,f)},export(){return JSON.stringify(i.backend)},exportObject(){return JSON.parse(JSON.stringify(i.backend))},import(c){const f=JSON.parse(c),d=f.current;f.current=f.root,i.update(i.load(f)),this.to(d)},importObject(c){const f=c.current;c.current=c.root,i.update(i.load(c)),this.to(f)},metadata:o,artifact:a,annotations:u,bookmarks:l}}function PHe(e,t,n){let[r,i]=[e,t];r.level>i.level&&([r,i]=[i,r]);let s=i.level-r.level;for(;zu(i)&&s!==0;)i=n[i.parent],s-=1;if(r.id===i.id)return r.id;for(;r.id!==i.id;)zu(r)&&(r=n[r.parent]),zu(i)&&(i=n[i.parent]);return r.id}function sse(e,t,n){const r=PHe(e,t,n),i=n[r],s=[],o=[];let[a,u]=[e,t];for(;a.id!==i.id;)s.push(a),zu(a)&&(a=n[a.parent]);for(s.push(a);u.id!==i.id;)o.push(u),zu(u)&&(u=n[u.parent]);const l=o.reverse();return[...s,...l].map(c=>c.id)}function OHe(e,t){if(zu(e)&&e.parent===t.id)return!0;if(zu(t)&&t.parent===e.id)return!1;throw new Error("Incorrect use of function. Nodes are not connected to each other.")}function ose(e,t){return{...e,children:e.children.map(n=>ose(t[n],t)),name:`${e.label}`}}iHe();function RHe(e){return e.length===2?fHe(e):e}class DC{static create(){return new DC}constructor(){this.registry=new Map}has(t){return this.registry.has(t)}register(t,n,r){const i=n.length===2;if(n.length>2)throw new Error("Incorrect action function signature. Action function can only have two arguments at most!");if(this.has(t))throw new Error(`Already registered: ${t}`);const{label:s=t,eventType:o=t}=r||{};return this.registry.set(t,{func:RHe(n),config:{hasSideEffects:!i,label:typeof s=="string"?()=>s:s,eventType:o}}),ju(t)}get(t){const n=this.registry.get(t);if(!n)throw new Error(`Not registered: ${t}`);return n}}var NHe="Expected a function",gz=NaN,kHe="[object Symbol]",DHe=/^\s+|\s+$/g,$He=/^[-+]0x[0-9a-f]+$/i,LHe=/^0b[01]+$/i,MHe=/^0o[0-7]+$/i,FHe=parseInt,BHe=typeof _o=="object"&&_o&&_o.Object===Object&&_o,jHe=typeof self=="object"&&self&&self.Object===Object&&self,UHe=BHe||jHe||Function("return this")(),VHe=Object.prototype,zHe=VHe.toString,HHe=Math.max,WHe=Math.min,HO=function(){return UHe.Date.now()};function qHe(e,t,n){var r,i,s,o,a,u,l=0,c=!1,f=!1,d=!0;if(typeof e!="function")throw new TypeError(NHe);t=yz(t)||0,ek(n)&&(c=!!n.leading,f="maxWait"in n,s=f?HHe(yz(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d);function h(E){var I=r,A=i;return r=i=void 0,l=E,o=e.apply(A,I),o}function p(E){return l=E,a=setTimeout(g,t),c?h(E):o}function m(E){var I=E-u,A=E-l,R=t-I;return f?WHe(R,s-A):R}function y(E){var I=E-u,A=E-l;return u===void 0||I>=t||I<0||f&&A>=s}function g(){var E=HO();if(y(E))return v(E);a=setTimeout(g,m(E))}function v(E){return a=void 0,d&&r?h(E):(r=i=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,r=u=i=a=void 0}function S(){return a===void 0?o:v(HO())}function T(){var E=HO(),I=y(E);if(r=arguments,i=this,u=E,I){if(a===void 0)return p(u);if(f)return a=setTimeout(g,t),h(u)}return a===void 0&&(a=setTimeout(g,t)),o}return T.cancel=b,T.flush=S,T}function ek(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function GHe(e){return!!e&&typeof e=="object"}function YHe(e){return typeof e=="symbol"||GHe(e)&&zHe.call(e)==kHe}function yz(e){if(typeof e=="number")return e;if(YHe(e))return gz;if(ek(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ek(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(DHe,"");var n=LHe.test(e);return n||MHe.test(e)?FHe(e.slice(2),n?2:8):$He.test(e)?gz:+e}var KHe=qHe;const ou=eu(KHe);function ase({xScale:e,yRange:t,vertPosition:n,ticks:r,isDate:i=!1,showLines:s=!0}){const o=w.useMemo(()=>r.length>1?Math.abs(r[1].offset-r[0].offset):e.range()[0]-e.range()[1],[r,e]),a=w.useCallback(u=>(i?L6("%b%e, %Y"):yf(".2s"))(u),[i]);return C.jsxs(C.Fragment,{children:[s?C.jsx("path",{transform:`translate(0, ${t[1]})`,d:["M",e.range()[0],0,"H",e.range()[1]].join(" "),fill:"none",stroke:"lightgray"}):null,r.map(({value:u,offset:l})=>C.jsxs("g",{transform:`translate(${l}, ${n})`,children:[C.jsx("line",{y2:"6",stroke:"currentColor"}),s?C.jsx("line",{y2:`${-(t[0]-t[1])}`,stroke:"lightgray"}):null,C.jsx("foreignObject",{x:0-o/2,y:10,width:o,height:20,children:C.jsx(ua,{children:C.jsx(Wx,{withinPortal:!0,label:u,children:C.jsx(rt,{px:2,size:10,style:{textAlign:"center",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:+u==0?0:a(i?new Date(u):u)})})})})]},`${u}test`))]})}const QHe=Object.freeze(Object.defineProperty({__proto__:null,XAxis:ase},Symbol.toStringTag,{value:"Module"}));function use({dataset:e,yScale:t,xRange:n,horizontalPosition:r}){const i=w.useMemo(()=>t.ticks(6).map(o=>({value:o,yOffset:t(o)})),[t]),s=w.useMemo(()=>e==="clean_stocks"?yf(",.0%"):t.domain()[1]<5?yf(",.2r"):yf(",.0f"),[e,t]);return C.jsx(C.Fragment,{children:i.map(({value:o,yOffset:a})=>C.jsxs("g",{transform:`translate(${r}, ${a})`,children:[C.jsx("line",{x2:`${n[1]-n[0]}`,stroke:`${o===0?"black":"gainsboro"}`,strokeWidth:o===0?1:.4}),C.jsx("text",{style:{dominantBaseline:"middle",fontSize:"10px",textAnchor:"end",transform:"translateX(-6px)",fill:"black",font:"Roboto"},children:s(o)},o)]},o))})}const XHe=Object.freeze(Object.defineProperty({__proto__:null,YAxis:use},Symbol.toStringTag,{value:"Module"})),Yi={top:30,left:40,right:80,bottom:50};function tk({parameters:e,data:t,dataname:n,items:r,selection:i,range:s,guardrail:o}){const[a,u]=w.useState(null),l=R=>i!=null&&i.includes(R)?!a||a.length===0?!0:a.includes(R):!1,c=w.useMemo(()=>{const R=r.filter(L=>i==null?void 0:i.includes(L.name)).map(L=>L.group);return r.filter(L=>R==null?void 0:R.includes(L.group)).filter(L=>!(i!=null&&i.includes(L.name))).map(L=>L.name)},[i,r,n]),f=w.useMemo(()=>{const R=r.map(J=>J.group),F=t.filter(J=>R==null?void 0:R.includes(J[e.group_var]));return[...vVe(F,J=>({mean:PO(J,.5,V=>V[e.y_var]),upperq:PO(J,.75,V=>V[e.y_var]),lowerq:PO(J,.25,V=>V[e.y_var])}),J=>J[e.x_var])].flatMap(([J,V])=>({date:J,mean:V.mean,upperq:V.upperq,lowerq:V.lowerq}))},[t,r,e,n]),d=n==="clean_data"?800-Yi.left-Yi.right-60:800-Yi.left-Yi.right,h=400-Yi.top-Yi.bottom,{yMin:p,yMax:m}=w.useMemo(()=>{let R=[];switch(o){case"super_data":R=i==null?void 0:i.concat(c);break;default:R=i;break}const F=t.filter(ae=>R.includes(ae[e.cat_var])).map(ae=>+ae[e.y_var]).filter(ae=>ae!==null),[L,B]=n==="clean_stocks"?Pf(F):[0,Pf(F)[1]],[J,V]=[zT(f.map(ae=>ae.lowerq)),Pv(f.map(ae=>ae.upperq))],re=o==="super_summ"?zT([L,J]):L,oe=o==="super_summ"?Pv([B,V]):B;return{yMin:re,yMax:oe}},[t,i,o,f,c,e,n]),y=w.useMemo(()=>s?kv([Yi.left,d+Yi.left]).domain(s):kv([Yi.left,d+Yi.left]).domain([new Date(e.start_date),new Date(e.end_date)]),[d,s,e,n]),g=w.useMemo(()=>mh([h+Yi.top,Yi.top]).domain([p,m]).nice(),[h,m,p,n]),v=w.useMemo(()=>{const R=Array.from(new Set(t.map(F=>F[e.cat_var])));return O6(S6).domain(R)},[t,e,n]),b=w.useMemo(()=>{if(!y||!g)return;const R=$y();return R.x(L=>y(Ld("%Y-%m-%d")(L[e.x_var]))),R.y(L=>g(L[e.y_var])),R.curve(Mp),i==null?void 0:i.map(L=>({country:L,path:R(t.filter(B=>B[e.cat_var]===L))}))},[t,y,g,i,e,n]),S=w.useMemo(()=>{if(o!=="super_data")return null;const R=$y();return R.x(L=>y(Ld("%Y-%m-%d")(L[e.x_var]))),R.y(L=>g(L[e.y_var])),R.curve(Mp),c==null?void 0:c.map(L=>({country:L,path:R(t.filter(B=>B[e.cat_var]===L))}))},[t,y,g,o,c,e,n]),T=w.useMemo(()=>{if(o!=="super_summ")return null;const R=$y();R.x(J=>y(Ld("%Y-%m-%d")(J.date))),R.y(J=>g(J.mean)),R.curve(Mp);const F=R(f),L=Xie();L.x(J=>y(Ld("%Y-%m-%d")(J.date))),L.y0(J=>g(J.lowerq)),L.y1(J=>g(J.upperq)),L.curve(Mp);const B=L(f);return{meanLine:F,confidenceBands:B,data:f}},[y,g,o,f,n]),E=w.useMemo(()=>n==="clean_stocks"?"Industry Average":"Average",[n]),I=R=>R==="Eldoril North"?"Policy A":R.split(" ")[0]==="Silvoria"||R.split(" ")[0]==="Mystara"?"Policy C":R==="Average"?"all policies":"Policy B",A=w.useMemo(()=>{let F=null;switch(o){case"super_data":F=i==null?void 0:i.concat(S==null?void 0:S.map(B=>B.country));break;case"super_summ":F=i==null?void 0:i.concat([E]);break;default:F=i;break}const L=F==null?void 0:F.map(B=>({country:B,country_policy:n==="clean_data"?`${B} (${I(B)})`:B,label_pos:B===E?T==null?void 0:T.data.slice(-1).map(J=>g(J.mean))[0]:t.filter(J=>J[e.cat_var]===B).slice(-1).map(J=>g(J[e.y_var]))[0]})).sort((B,J)=>B.label_pos=10||(L[B].label_pos=L[B].label_pos-10+J)}return L},[t,i,g,o,E,e,S,T,n]);return(i==null?void 0:i.length)===0?C.jsx(ua,{style:{width:"800px",height:"400px"},children:C.jsx(rt,{fs:"italic",c:"dimmed",children:"Select an item to view the chart."})}):C.jsxs("svg",{id:"baseLineChart",style:{height:"400px",width:"800px",fontFamily:'"Helvetica Neue", "Helvetica", "Arial", sans-serif'},children:[C.jsxs("g",{id:"axes",children:[C.jsx(ase,{isDate:!0,xScale:y,yRange:g.range(),vertPosition:h+Yi.top,showLines:!1,ticks:y.ticks(6).map(R=>({value:R.toString(),offset:y(R)}))}),C.jsx(use,{dataset:n,yScale:g,horizontalPosition:Yi.left,xRange:y.range()})]}),C.jsx("svg",{style:{width:`${d}`},children:S==null?void 0:S.map(R=>C.jsx("g",{children:C.jsx("path",{id:`${R.country}`,fill:"none",stroke:l(R.country)?v(R.country):"gray",strokeDasharray:"4,1",strokeWidth:.5,d:R.path},`${R.country}_key`)},`${R.country}_g`))},"control_lines"),C.jsx("svg",{style:{width:`${d}`},children:T?C.jsxs("g",{children:[C.jsx("path",{id:"confidenceBands",fill:"lightgray",opacity:.25,stroke:"none",d:T.confidenceBands},"confidenceBands_key"),C.jsx("path",{id:"meanLine",fill:"none",stroke:"gray",strokeDasharray:"4,1",strokeWidth:.5,d:T.meanLine},"meanLine_key")]},"summary_g"):null},"control_bands"),C.jsxs("svg",{style:{width:`${d}`},children:[b==null?void 0:b.map(R=>C.jsx("g",{children:C.jsx("path",{id:`${R.country}`,fill:"none",stroke:l(R.country)?v(R.country):"gainsboro",strokeWidth:a!=null&&a.includes(R.country)?2:1.5,d:R.path},`${R.country}_key`)},`${R.country}_g`)),A==null?void 0:A.map(R=>C.jsx("foreignObject",{x:d+Yi.left+5,y:R.label_pos-7,width:Yi.right+60,height:20,children:C.jsx(rt,{px:2,size:10,color:l(R.country)?v(R.country):"silver",onMouseOver:F=>{const L=F.target;i!=null&&i.includes(L.innerText)&&u([L.innerText])},onMouseOut:()=>u([]),children:R.country_policy})},`${R.country}_label`))]},"lines")]})}const JHe=Object.freeze(Object.defineProperty({__proto__:null,LineChart:tk,default:tk},Symbol.toStringTag,{value:"Module"})),sp={top:0,left:0,right:0,bottom:0},vz=20,WO=60;function nk({parameters:e,data:t,dataname:n,items:r,selection:i,setSelection:s,trackSelection:o,range:a,guardrail:u}){const l=w.useMemo(()=>a?kv([sp.left,WO+sp.left]).domain(a):kv([sp.left,WO+sp.left]).domain([new Date(e.start_date),new Date(e.end_date)]),[e,a]),c=w.useMemo(()=>{const p=t.filter(g=>r==null?void 0:r.map(v=>v.name).includes(g[e.cat_var])).map(g=>+g[e.y_var]).filter(g=>g!==null),[m,y]=Pf(p);return mh([vz+sp.top,sp.top]).domain([m,y]).nice()},[e,t,r]),f=w.useMemo(()=>{const p=Array.from(new Set(t.map(m=>m[e.cat_var])));return O6(S6).domain(p)},[e,t]),d=w.useMemo(()=>{if(u!=="juxt_data")return null;const p=Xie();p.x(g=>l(Ld("%Y-%m-%d")(g[e.x_var]))),p.y0(()=>c(0)),p.y1(g=>c(g[e.y_var])),p.curve(Mp);const m=$y();return m.x(g=>l(Ld("%Y-%m-%d")(g[e.x_var]))),m.y(g=>c(g[e.y_var])),m.curve(Mp),r==null?void 0:r.map(g=>({country:g.name,path:m(t.filter(v=>v[e.cat_var]===g.name)),area:p(t.filter(v=>v[e.cat_var]===g.name))}))},[e,u,t,r,l,c]),h=w.useMemo(()=>e.allow_selection===!1?"none":"block",[e]);return C.jsx(Mm.Group,{defaultValue:i,orientation:"vertical",onChange:p=>{s(p),o(p)},spacing:0,offset:"sm",styles:e.allow_selection===!1?{root:{pointerEvents:"none"}}:{root:{pointerEvents:"auto"}},children:r==null?void 0:r.map(p=>C.jsxs(C.Fragment,{children:[p.name==="Eldoril North"?C.jsx(df,{size:"xs",label:"Policy A",labelPosition:"left",color:"black"}):null,p.name==="Eldoril West"?C.jsx(df,{size:"xs",label:"Policy B",labelPosition:"left",color:"black"}):null,p.name==="Silvoria North"?C.jsx(df,{size:"xs",label:"Policy C",labelPosition:"left",color:"black"}):null,C.jsxs(Rl,{grow:!0,gutter:8,columns:2,children:[C.jsx(Rl.Col,{span:1,children:C.jsx(Mm,{value:p.name,label:p.name,color:e.allow_selection?"blue":"gray",styles:{root:{display:"flex",alignItems:"flex-end",padding:"2px 0"},inner:{display:h}},children:p.name},`${p.name}_checkbox`)},`${p.name}_grid1`),C.jsx(Rl.Col,{span:u==="juxt_data"?"auto":3,children:C.jsxs("svg",{style:{width:`${WO}`,height:`${vz}`},children:[C.jsx("path",{id:`${p.name}_sparkarea`,fill:i!=null&&i.includes(p.name)?f(p.name):"gray",stroke:"none",opacity:.25,d:d==null?void 0:d.filter(m=>m.country===p.name)[0].area},`${p.name}_sparkarea`),C.jsx("path",{id:`${p.name}_spark`,fill:"none",stroke:i!=null&&i.includes(p.name)?f(p.name):"gray",strokeWidth:.75,d:d==null?void 0:d.filter(m=>m.country===p.name)[0].path},`${p.name}_spark`)]},`${p.name}_sparksvg`)},`${p.name}_grid2`)]},`${p.name}_grid`)]}))},`${n}_checkboxgroup`)}const ZHe=Object.freeze(Object.defineProperty({__proto__:null,Sidebar:nk,default:nk},Symbol.toStringTag,{value:"Module"}));function rk({parameters:e,setRange:t,trackRange:n}){function r(s){return kv([0,100]).domain([new Date(e.start_date),new Date(e.end_date)]).invert(s)}function i(s){const o=r(s);return L6("%b %e, %Y")(o)}return C.jsx(pte,{defaultValue:[0,100],label:s=>i(s),labelAlwaysOn:!0,disabled:!e.allow_time_slider,onChange:([s,o])=>{t([r(s),r(o)]),n([r(s),r(o)])}})}const eWe=Object.freeze(Object.defineProperty({__proto__:null,RangeSelector:rk,default:rk},Symbol.toStringTag,{value:"Module"}));function ik({guardrail:e,setGuardrail:t,dataname:n,setDataname:r,setSelection:i}){return C.jsxs(C.Fragment,{children:[C.jsx(rt,{children:"Data:"}),C.jsx(ZR,{value:n,onChange:s=>{r(s),i([])},data:[{value:"clean_data",label:"Viral"},{value:"clean_stocks",label:"Stock"}]}),C.jsx(rt,{children:"Guardrail:"}),C.jsx(ZR,{value:e,onChange:s=>{t(s)},data:[{value:"none",label:"None"},{value:"super_data",label:"Sup. Data"},{value:"super_summ",label:"Sup. Summ."},{value:"juxt_data",label:"Juxt. Data"},{value:"juxt_summ",label:"Juxt. Summ."}]})]})}const tWe=Object.freeze(Object.defineProperty({__proto__:null,Selector:ik,default:ik},Symbol.toStringTag,{value:"Module"})),En=Array.isArray;function io(e){return e!=null?En(e)?e:[e]:[]}function nWe(e=0,t=1/0){return`${_z(e)} < row_number() && row_number() <= ${_z(t)}`}function _z(e){return e<0?`count() + ${e}`:e}class lse{constructor(t){t&&(this._params=t)}params(t){return arguments.length?(t&&(this._params={...this._params,...t}),this):this._params}reify(t){return this.__reify(this,t)}count(t){return this.__count(this,t)}derive(t,n){return this.__derive(this,t,n)}filter(t){return this.__filter(this,t)}slice(t,n){return this.filter(nWe(t,n)).reify()}groupby(...t){return this.__groupby(this,t.flat())}orderby(...t){return this.__orderby(this,t.flat())}relocate(t,n){return this.__relocate(this,io(t),n)}rename(...t){return this.__rename(this,t.flat())}rollup(t){return this.__rollup(this,t)}sample(t,n){return this.__sample(this,t,n)}select(...t){return this.__select(this,t.flat())}ungroup(){return this.__ungroup(this)}unorder(){return this.__unorder(this)}dedupe(...t){return this.__dedupe(this,t.flat())}impute(t,n){return this.__impute(this,t,n)}fold(t,n){return this.__fold(this,t,n)}pivot(t,n,r){return this.__pivot(this,t,n,r)}spread(t,n){return this.__spread(this,t,n)}unroll(t,n){return this.__unroll(this,t,n)}lookup(t,n,...r){return this.__lookup(this,t,n,r.flat())}join(t,n,r,i){return this.__join(this,t,n,r,i)}join_left(t,n,r,i){const s={...i,left:!0,right:!1};return this.__join(this,t,n,r,s)}join_right(t,n,r,i){const s={...i,left:!1,right:!0};return this.__join(this,t,n,r,s)}join_full(t,n,r,i){const s={...i,left:!0,right:!0};return this.__join(this,t,n,r,s)}cross(t,n,r){return this.__cross(this,t,n,r)}semijoin(t,n){return this.__semijoin(this,t,n)}antijoin(t,n){return this.__antijoin(this,t,n)}concat(...t){return this.__concat(this,t.flat())}union(...t){return this.__union(this,t.flat())}intersect(...t){return this.__intersect(this,t.flat())}except(...t){return this.__except(this,t.flat())}}function Wt(e){throw Error(e)}function bs(e){return typeof e=="number"}function sr(e){return typeof e=="function"}function $C(e,t){const n=Array(e);if(sr(t))for(let r=0;r=0;a=s.next(a+1))r[++o]=a;else for(let a=0;aa(l,c,u))}return(t||!i)&&(this._index=r),r}partitions(t=!0){if(this._partitions)return this._partitions;if(!this.isGrouped())return[this.indices(t)];const{keys:n,size:r}=this._group,i=$C(r,()=>[]),s=this._index,o=this.mask(),a=this.numRows();if(s&&this.isOrdered())for(let u=0,l;u=0;u=o.next(u+1))i[n[u]].push(u);else for(let u=0;uu(f,d,l))}return(t||!this.isOrdered())&&(this._partitions=i),i}scan(t,n,r=1/0,i=0){const s=this._mask,o=this._nrows,a=this._data;let u=i||0;if(u>o)return;const l=Math.min(o,u+r),c=()=>u=this._total;if(n&&this.isOrdered()||s&&this._index){const f=this.indices(),d=this._data;for(;u-1;u=s.next(u+1))t(u,a,c)}else for(;ur.push(s),!0,n-t,t),this.reify(r)}reduce(t){return this.__reduce(this,t)}},iWe=class{constructor(t){this.data=t}get length(){return this.data.length}get(t){return this.data[t]}[Symbol.iterator](){return this.data[Symbol.iterator]()}},sWe=function(e){return e&&sr(e.get)?e:new iWe(e)};function Xl(e){return e instanceof Date}function as(e){return e===Object(e)}function rI(e){return e instanceof RegExp}function Ui(e){return typeof e=="string"}function oWe(e,t){const n=r=>Wt(`Illegal argument type: ${r||typeof e}`);return e instanceof Map?bz(e.entries(),t):Xl(e)?n("Date"):rI(e)?n("RegExp"):Ui(e)?n():En(e)?aWe(e,t):sr(e[Symbol.iterator])?uWe(e,t):as(e)?bz(Object.entries(e),t):n()}function bz(e,t=["key","value"]){const n=[],r=[];for(const[s,o]of e)n.push(s),r.push(o);const i={};return t[0]&&(i[t[0]]=n),t[1]&&(i[t[1]]=r),i}function aWe(e,t){const n=e.length,r={},i=s=>r[s]=Array(n);if(n){t=t||Object.keys(e[0]);const s=t.map(i),o=s.length;for(let a=0;an[o]=[];let i,s;for(const o of e){i||(t=t||Object.keys(o),i=t.map(r),s=i.length);for(let a=0;aMd(e)||Ui(e),fWe={compact:e=>Md(e)?e.filter(t=>Ma(t)):e,concat:(...e)=>[].concat(...e),includes:(e,t,n)=>R0(e)?e.includes(t,n):!1,indexof:(e,t)=>R0(e)?e.indexOf(t):-1,join:(e,t)=>Md(e)?e.join(t):yn,lastindexof:(e,t)=>R0(e)?e.lastIndexOf(t):-1,length:e=>R0(e)?e.length:0,pluck:(e,t)=>Md(e)?e.map(n=>Ma(n)?n[t]:yn):yn,reverse:e=>Md(e)?e.slice().reverse():Ui(e)?e.split("").reverse().join(""):yn,slice:(e,t,n)=>R0(e)?e.slice(t,n):yn};function dWe(e,t,n,r,i){return e==null?null:en?1/0:(e=Math.max(t,Math.min(e,n)),t+r*Math.floor(1e-14+(e-t)/r+(i||0)))}function Uw(e,t,n="0"){const r=e+"",i=r.length;return i(e<10?"0":"")+e,hWe=e=>e<0?"-"+Uw(-e,6):e>9999?"+"+Uw(e,6):Uw(e,4);function cse(e,t,n,r,i,s,o,a,u){const l=a?"Z":"";return hWe(e)+"-"+su(t+1)+"-"+su(n)+(!u||o?"T"+su(r)+":"+su(i)+":"+su(s)+"."+Uw(o,3)+l:s?"T"+su(r)+":"+su(i)+":"+su(s)+l:i||r||!a?"T"+su(r)+":"+su(i)+l:"")}function fse(e,t){return isNaN(e)?"Invalid Date":cse(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds(),!1,t)}function LC(e,t){return isNaN(e)?"Invalid Date":cse(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds(),!0,t)}const pWe=/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/;function mWe(e){return e.match(pWe)&&!isNaN(Date.parse(e))}function gWe(e,t=Date.parse){return mWe(e)?t(e):e}const dse=6e4,hse=864e5,pse=6048e5,xr=new Date,Ar=new Date,Dr=e=>(xr.setTime(typeof e=="string"?gWe(e):e),xr);function yWe(e,t,n,r,i,s,o){return arguments.length?new Date(e,t||0,n??1,r||0,i||0,s||0,o||0):new Date(Date.now())}function vWe(e,t,n,r,i,s,o){return arguments.length?new Date(Date.UTC(e,t||0,n??1,r||0,i||0,s||0,o||0)):new Date(Date.now())}function _We(e){Ar.setTime(+e),Ar.setHours(0,0,0,0),xr.setTime(+Ar),xr.setMonth(0),xr.setDate(1);const t=(Ar.getTimezoneOffset()-xr.getTimezoneOffset())*dse;return Math.floor(1+(Ar-xr-t)/hse)}function bWe(e){Ar.setTime(+e),Ar.setUTCHours(0,0,0,0);const t=Date.UTC(Ar.getUTCFullYear(),0,1);return Math.floor(1+(Ar-t)/hse)}function wWe(e,t){const n=t||0;Ar.setTime(+e),Ar.setDate(Ar.getDate()-(Ar.getDay()+7-n)%7),Ar.setHours(0,0,0,0),xr.setTime(+e),xr.setMonth(0),xr.setDate(1),xr.setDate(1-(xr.getDay()+7-n)%7),xr.setHours(0,0,0,0);const r=(Ar.getTimezoneOffset()-xr.getTimezoneOffset())*dse;return Math.floor((1+(Ar-xr)-r)/pse)}function EWe(e,t){const n=t||0;return Ar.setTime(+e),Ar.setUTCDate(Ar.getUTCDate()-(Ar.getUTCDay()+7-n)%7),Ar.setUTCHours(0,0,0,0),xr.setTime(+e),xr.setUTCMonth(0),xr.setUTCDate(1),xr.setUTCDate(1-(xr.getUTCDay()+7-n)%7),xr.setUTCHours(0,0,0,0),Math.floor((1+(Ar-xr))/pse)}const SWe={format_date:(e,t)=>fse(Dr(e),!t),format_utcdate:(e,t)=>LC(Dr(e),!t),timestamp:e=>+Dr(e),year:e=>Dr(e).getFullYear(),quarter:e=>Math.floor(Dr(e).getMonth()/3),month:e=>Dr(e).getMonth(),date:e=>Dr(e).getDate(),dayofweek:e=>Dr(e).getDay(),hours:e=>Dr(e).getHours(),minutes:e=>Dr(e).getMinutes(),seconds:e=>Dr(e).getSeconds(),milliseconds:e=>Dr(e).getMilliseconds(),utcyear:e=>Dr(e).getUTCFullYear(),utcquarter:e=>Math.floor(Dr(e).getUTCMonth()/3),utcmonth:e=>Dr(e).getUTCMonth(),utcdate:e=>Dr(e).getUTCDate(),utcdayofweek:e=>Dr(e).getUTCDay(),utchours:e=>Dr(e).getUTCHours(),utcminutes:e=>Dr(e).getUTCMinutes(),utcseconds:e=>Dr(e).getUTCSeconds(),utcmilliseconds:e=>Dr(e).getUTCMilliseconds(),datetime:yWe,dayofyear:_We,week:wWe,utcdatetime:vWe,utcdayofyear:bWe,utcweek:EWe,now:Date.now};function W6(e,t){return e==null||t==null||e!==e||t!==t?!1:e===t?!0:Xl(e)||Xl(t)?+e==+t:rI(e)&&rI(t)?e+""==t+"":as(e)&&as(t)?TWe(e,t):!1}function TWe(e,t){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(e.length||t.length)return Ez(e,t);const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||(n.sort(),r.sort(),!Ez(n,r,(s,o)=>s===o)))return!1;const i=n.length;for(let s=0;sJSON.parse(e),to_json:e=>JSON.stringify(e)};let xWe=Math.random;function Ng(){return xWe()}const CWe={random:Ng,is_nan:Number.isNaN,is_finite:Number.isFinite,abs:Math.abs,cbrt:Math.cbrt,ceil:Math.ceil,clz32:Math.clz32,exp:Math.exp,expm1:Math.expm1,floor:Math.floor,fround:Math.fround,greatest:Math.max,least:Math.min,log:Math.log,log10:Math.log10,log1p:Math.log1p,log2:Math.log2,pow:Math.pow,round:Math.round,sign:Math.sign,sqrt:Math.sqrt,trunc:Math.trunc,degrees:e=>180*e/Math.PI,radians:e=>Math.PI*e/180,acos:Math.acos,acosh:Math.acosh,asin:Math.asin,asinh:Math.asinh,atan:Math.atan,atan2:Math.atan2,atanh:Math.atanh,cos:Math.cos,cosh:Math.cosh,sin:Math.sin,sinh:Math.sinh,tan:Math.tan,tanh:Math.tanh};function q6(e){return e instanceof Map}function AWe(e){return e instanceof Set}function Vw(e){return q6(e)||AWe(e)}function qO(e){return Array.from(e)}const PWe={has:(e,t)=>Vw(e)?e.has(t):e!=null?Ya(e,t):!1,keys:e=>q6(e)?qO(e.keys()):e!=null?Object.keys(e):[],values:e=>Vw(e)?qO(e.values()):e!=null?Object.values(e):[],entries:e=>Vw(e)?qO(e.entries()):e!=null?Object.entries(e):[],object:e=>e?Object.fromEntries(e):yn};function OWe(e,t,n){if(t instanceof Map){if(t.has(e))return t.get(e)}else if(Ya(t,e))return t[e];return n!==void 0?n:e}function RWe(e,t,n){let r=arguments.length;e=+e,t=+t,n=r<2?(t=e,e=0,1):r<3?1:+n,r=Math.max(0,Math.ceil((t-e)/n))|0;const i=new Array(r);for(let s=0;se==null?e:new Date(e),parse_float:e=>e==null?e:Number.parseFloat(e),parse_int:(e,t)=>e==null?e:Number.parseInt(e,t),endswith:(e,t,n)=>e==null?!1:String(e).endsWith(t,n),match:(e,t,n)=>{const r=e==null?e:String(e).match(t);return n==null||r==null?r:typeof n=="number"?r[n]:r.groups?r.groups[n]:null},normalize:(e,t)=>e==null?e:String(e).normalize(t),padend:(e,t,n)=>e==null?e:String(e).padEnd(t,n),padstart:(e,t,n)=>e==null?e:String(e).padStart(t,n),upper:e=>e==null?e:String(e).toUpperCase(),lower:e=>e==null?e:String(e).toLowerCase(),repeat:(e,t)=>e==null?e:String(e).repeat(t),replace:(e,t,n)=>e==null?e:String(e).replace(t,String(n)),substring:(e,t,n)=>e==null?e:String(e).substring(t,n),split:(e,t,n)=>e==null?[]:String(e).split(t,n),startswith:(e,t,n)=>e==null?!1:String(e).startsWith(t,n),trim:e=>e==null?e:String(e).trim()},Bp={bin:dWe,equal:W6,recode:OWe,sequence:RWe,...fWe,...SWe,...IWe,...CWe,...PWe,...NWe};function Lv(e){return typeof e=="bigint"}function el(e){return e===void 0?e+"":Lv(e)?e+"n":JSON.stringify(e)}function Vt(e,t=[],n=[]){return new kWe(e,io(t),io(n))}let kWe=class{constructor(t,n,r){this.name=t,this.fields=n,this.params=r}toString(){const t=[...this.fields.map(n=>`d[${el(n)}]`),...this.params.map(el)];return`d => op.${this.name}(${t})`}toObject(){return{expr:this.toString(),func:!0}}};const mse=e=>Vt("any",e),gse=()=>Vt("count"),yse=e=>Vt("array_agg",e),vse=e=>Vt("array_agg_distinct",e),_se=(e,t)=>Vt("map_agg",[e,t]),bse=(e,t)=>Vt("object_agg",[e,t]),wse=(e,t)=>Vt("entries_agg",[e,t]);({...Bp});function DWe(e,t){e=Vw(e)?e:new Set(e);let n=t,r=0;for(;e.has(n);)n=t+ ++r;return n}function $We(e,t){if(!e||!t)return e;const{keys:n,rows:r,size:i}=e,s=new Int32Array(i);t.scan(c=>s[n[c]]=1);const o=s.reduce((c,f)=>c+f,0);if(o===i)return e;const a=Array(o);let u=0;for(let c=0;cl[c]=s[n[c]]),{...e,keys:l,rows:a,size:u}}function LWe(e,t,n,r){const{keys:i,rows:s,size:o}=e;let a=s,u=o,l=null;if(n){l=new Int32Array(o),t(p=>l[i[p]]=1);const h=l.reduce((p,m)=>p+m,0);if(h!==o){a=Array(h),u=0;for(let p=0;pf[++c]=l[i[h]]:h=>f[++c]=i[h]),{...e,keys:f,rows:a,size:u}}function MWe(e,t,n,r){const i=r==="map"||r===!0?_se:r==="entries"?wse:r==="object"?bse:Wt('groups option must be "map", "entries", or "object".'),{names:s}=e.groups(),o=DWe(e.columnNames(),"_");let a=e.select().reify(t).create({data:{[o]:n}}).rollup({[o]:yse(o)});for(let u=s.length;--u>=0;)a=a.groupby(s.slice(0,u)).rollup({[o]:i(s[u],o)});return a.get(o)}const FWe="ArrayPattern",BWe="ArrowFunctionExpression",jWe="FunctionExpression",vf="Identifier",kg="Literal",Ese="MemberExpression",UWe="ObjectExpression",Sse="ObjectPattern",Tse="Property",i1="Column",VWe="Constant",zWe="Dictionary",HWe="Function",WWe="Parameter",Ise="Op",Kn=(e,t)=>{const n=qWe[e.type];return n?n(e,t):Wt(`Unsupported expression construct: ${e.type}`)},GO=(e,t)=>"("+Kn(e.left,t)+" "+e.operator+" "+Kn(e.right,t)+")",YO=(e,t)=>"("+fu(e.params,t)+")=>"+Kn(e.body,t),Sz=(e,t)=>Kn(e.callee,t)+"("+fu(e.arguments,t)+")",fu=(e,t,n=",")=>e.map(r=>Kn(r,t)).join(n),xse=e=>e.computed?`[${el(e.name)}]`:`.${e.name}`,Tz=(e,t,n)=>{const r=e.table||"";return`data${r}${xse(e)}.${n}(${t.index}${r})`},qWe={Constant:e=>e.raw,Column:(e,t)=>Tz(e,t,"get"),Dictionary:(e,t)=>Tz(e,t,"key"),Function:e=>`fn.${e.name}`,Parameter:e=>`$${xse(e)}`,Op:(e,t)=>`op(${el(e.name)},${t.op||t.index})`,Literal:e=>e.raw,Identifier:e=>e.name,TemplateLiteral:(e,t)=>{const{quasis:n,expressions:r}=e,i=r.length;let s=n[0].value.raw;for(let o=0;o{const n=!e.computed,r=Kn(e.object,t),i=Kn(e.property,t);return r+(n?"."+i:"["+i+"]")},CallExpression:Sz,NewExpression:(e,t)=>"new "+Sz(e,t),ArrayExpression:(e,t)=>"["+fu(e.elements,t)+"]",AssignmentExpression:GO,BinaryExpression:GO,LogicalExpression:GO,UnaryExpression:(e,t)=>"("+e.operator+Kn(e.argument,t)+")",ConditionalExpression:(e,t)=>"("+Kn(e.test,t)+"?"+Kn(e.consequent,t)+":"+Kn(e.alternate,t)+")",ObjectExpression:(e,t)=>"({"+fu(e.properties,t)+"})",Property:(e,t)=>{const n=Kn(e.key,t);return(e.computed?`[${n}]`:n)+":"+Kn(e.value,t)},ArrowFunctionExpression:YO,FunctionExpression:YO,FunctionDeclaration:YO,ArrayPattern:(e,t)=>"["+fu(e.elements,t)+"]",ObjectPattern:(e,t)=>"{"+fu(e.properties,t)+"}",VariableDeclaration:(e,t)=>e.kind+" "+fu(e.declarations,t,","),VariableDeclarator:(e,t)=>Kn(e.id,t)+"="+Kn(e.init,t),SpreadElement:(e,t)=>"..."+Kn(e.argument,t),BlockStatement:(e,t)=>"{"+fu(e.body,t,";")+";}",BreakStatement:()=>"break",ExpressionStatement:(e,t)=>Kn(e.expression,t),IfStatement:(e,t)=>"if ("+Kn(e.test,t)+")"+Kn(e.consequent,t)+(e.alternate?" else "+Kn(e.alternate,t):""),SwitchStatement:(e,t)=>"switch ("+Kn(e.discriminant,t)+") {"+fu(e.cases,t,"")+"}",SwitchCase:(e,t)=>(e.test?"case "+Kn(e.test,t):"default")+": "+fu(e.consequent,t,";")+";",ReturnStatement:(e,t)=>"return "+Kn(e.argument,t),Program:(e,t)=>Kn(e.body[0],t)};function iI(e,t={index:"row"}){return Kn(e,t)}function GWe(e,t,n=15,r=!0,i=0,s){const a=Math.LN10;if(s==null){const u=Math.ceil(Math.log(n)/a),l=t-e||Math.abs(e)||1,c=[5,2];for(s=Math.max(i,Math.pow(10,Math.round(Math.log(l)/a)-u));Math.ceil(l/s)>n;)s*=10;const f=c.length;for(let d=0;d=i&&l/h<=n&&(s=h)}}if(r){let u=Math.log(s);const l=u>=0?0:~~(-u/a)+1,c=Math.pow(10,-l-1);u=Math.floor(e/s+c)*s,e=e0&&(t+=","),t+=`"${r}":${Km(e[r])}`;return t+="}",t}function sI(e,t){const n=e.length;return n===1?(r,i)=>Km(e[0](r,i)):(r,i)=>{let s="";for(let o=0;o0&&(s+="|");const a=e[o](r,i);if(t&&(a==null||a!==a))return null;s+=Km(a)}return s}}function KWe(){const e=new Map;return{count(){return e.size},values(){return Array.from(e.values(),t=>t.v)},increment(t){const n=Km(t),r=e.get(n);r?++r.n:e.set(n,{v:t,n:1})},decrement(t){const n=Km(t),r=e.get(n);r.n===1?e.delete(n):--r.n},forEach(t){e.forEach(({v:n,n:r})=>t(n,r))}}}function Sl(){}function QWe(e,t=0,n=e.length){let r=e[t++];for(let i=t;iXr({value:e=>e.count}),param:[]},array_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>e.list.values(e.stream)}),param:[1]},object_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>Object.fromEntries(e.list.values())}),param:[2]},map_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>new Map(e.list.values())}),param:[2]},entries_agg:{create:()=>Xr({init:e=>e.values=!0,value:e=>e.list.values(e.stream)}),param:[2]},any:{create:()=>Xr({add:(e,t)=>{e.any==null&&(e.any=t)},value:e=>e.valid?e.any:yn}),param:[1]},valid:{create:()=>Xr({value:e=>e.valid}),param:[1]},invalid:{create:()=>Xr({value:e=>e.count-e.valid}),param:[1]},distinct:{create:()=>({init:e=>e.distinct=KWe(),value:e=>e.distinct.count()+(e.valid===e.count?0:1),add:(e,t)=>e.distinct.increment(t),rem:(e,t)=>e.distinct.decrement(t)}),param:[1]},array_agg_distinct:{create:()=>Xr({value:e=>e.distinct.values()}),param:[1],req:["distinct"]},mode:{create:()=>Xr({value:e=>{let t=yn,n=0;return e.distinct.forEach((r,i)=>{i>n&&(n=i,t=r)}),t}}),param:[1],req:["distinct"]},sum:{create:()=>({init:e=>e.sum=0,value:e=>e.valid?e.sum:yn,add:(e,t)=>Lv(t)?e.sum===0?e.sum=t:e.sum+=t:e.sum+=+t,rem:(e,t)=>e.sum-=t}),param:[1]},product:{create:()=>({init:e=>Iz(e,1),value:e=>e.valid?e.product_v?Iz(e,QWe(e.list.values())):e.product:void 0,add:(e,t)=>Lv(t)&&e.product===1?e.product=t:e.product*=t,rem:(e,t)=>t==0||t===1/0||t===-1/0?e.product_v=!0:e.product/=t}),param:[1],stream:["array_agg"]},mean:{create:()=>({init:e=>e.mean=0,value:e=>e.valid?e.mean:yn,add:(e,t)=>{e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid},rem:(e,t)=>{e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean}}),param:[1]},average:{create:()=>Xr({value:e=>e.valid?e.mean:yn}),param:[1],req:["mean"]},variance:{create:()=>({init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):yn,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean)}),param:[1],req:["mean"]},variancep:{create:()=>Xr({value:e=>e.valid>1?e.dev/e.valid:yn}),param:[1],req:["variance"]},stdev:{create:()=>Xr({value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):yn}),param:[1],req:["variance"]},stdevp:{create:()=>Xr({value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):yn}),param:[1],req:["variance"]},min:{create:()=>({init:e=>e.min=yn,value:e=>e.min=Number.isNaN(e.min)?e.list.min():e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)}}),param:[1],stream:["array_agg"]},max:{create:()=>({init:e=>e.max=yn,value:e=>e.max=Number.isNaN(e.max)?e.list.max():e.max,add:(e,t)=>{(t>e.max||e.max===yn)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)}}),param:[1],stream:["array_agg"]},quantile:{create:e=>Xr({value:t=>t.list.quantile(e)}),param:[1,1],req:["array_agg"]},median:{create:()=>Xr({value:e=>e.list.quantile(.5)}),param:[1],req:["array_agg"]},covariance:{create:()=>({init:e=>{e.cov=e.mean_x=e.mean_y=e.dev_x=e.dev_y=0},value:e=>e.valid>1?e.cov/(e.valid-1):yn,add:(e,t,n)=>{const r=t-e.mean_x,i=n-e.mean_y;e.mean_x+=r/e.valid,e.mean_y+=i/e.valid;const s=n-e.mean_y;e.dev_x+=r*(t-e.mean_x),e.dev_y+=i*s,e.cov+=r*s},rem:(e,t,n)=>{const r=t-e.mean_x,i=n-e.mean_y;e.mean_x-=e.valid?r/e.valid:e.mean_x,e.mean_y-=e.valid?i/e.valid:e.mean_y;const s=n-e.mean_y;e.dev_x-=r*(t-e.mean_x),e.dev_y-=i*s,e.cov-=r*s}}),param:[2]},covariancep:{create:()=>Xr({value:e=>e.valid>1?e.cov/e.valid:yn}),param:[2],req:["covariance"]},corr:{create:()=>Xr({value:e=>e.valid>1?e.cov/(Math.sqrt(e.dev_x)*Math.sqrt(e.dev_y)):yn}),param:[2],req:["covariance"]},bins:{create:(e,t,n,r)=>Xr({value:i=>GWe(i.min,i.max,e,t,n,r)}),param:[1,4],req:["min","max"]}},xz={create(){let e;return{init:()=>e=1,value:t=>{const n=t.index;return n&&!t.peer(n)?e=n+1:e}}},param:[]},Cz={create(){let e;return{init:()=>e=0,value:t=>{const{index:n,peer:r,size:i}=t;let s=n;if(ee.index+1}},param:[]},rank:xz,avg_rank:{create(){let e,t;return{init:()=>(e=-1,t=1),value:n=>{const r=n.index;if(r>=e){for(t=e=r+1;n.peer(e);t+=++e);t/=e-r}return t}}},param:[]},dense_rank:{create(){let e;return{init:()=>e=1,value:t=>{const n=t.index;return n&&!t.peer(n)?++e:e}}},param:[]},percent_rank:{create(){const{init:e,value:t}=xz.create();return{init:e,value:n=>(t(n)-1)/(n.size-1)}},param:[]},cume_dist:Cz,ntile:{create(e){e=+e,e>0||Wt("ntile num must be greater than zero.");const{init:t,value:n}=Cz.create();return{init:t,value:r=>Math.ceil(e*n(r))}},param:[0,1]},lag:{create(e,t=yn){return e=+e||1,{init:Sl,value:(n,r)=>{const i=n.index-e;return i>=0?n.value(i,r):t}}},param:[1,2]},lead:{create(e,t=yn){return e=+e||1,{init:Sl,value:(n,r)=>{const i=n.index+e;return ie.value(e.i0,t)}},param:[1]},last_value:{create(){return{init:Sl,value:(e,t)=>e.value(e.i1-1,t)}},param:[1]},nth_value:{create(e){return e=+e,e>0||Wt("nth_value nth must be greater than zero."),{init:Sl,value:(t,n)=>{const r=t.i0+(e-1);return rt=e,value:(n,r)=>{const i=n.value(n.index,r);return Ma(i)?t=i:t}}},param:[1,1]},fill_up:{create(e=yn){let t,n;return{init:()=>(t=e,n=-1),value:(r,i)=>r.index<=n?t:(n=XWe(r,i,r.index))>=0?t=r.value(n,i):(n=r.size,t=e)}},param:[1,1]}};function XWe(e,t,n){for(const r=e.size;nN0(e,t,n),expr:(e,t)=>N0(`(row,data,op)=>${e}`,Bp,t),expr2:(e,t)=>N0(`(row0,data0,row,data)=>${e}`,Bp,t),join:(e,t)=>N0(`(row1,data1,row2,data2)=>${e}`,Bp,t),param:(e,t)=>N0(e,Bp,t)},JWe={"==":1,"!=":1,"===":1,"!==":1};function Nse(e,t,n=0,r,i){if(e.type=i1,e.name=t,e.table=n,i&&r&&sr(r.keyFor)){const s=JWe[i.operator]?i.left===e?i.right:i.left:i.callee&&i.callee.name==="equal"?i.arguments[i.arguments[0]===e?1:0]:null;s&&s.type===kg&&ZWe(i,e,s,r.keyFor(s.value))}return e}function ZWe(e,t,n,r){return r<0?(e.type=kg,e.value=!1,e.raw="false"):(t.type=zWe,n.value=r,n.raw=r+""),!0}function MC(e){return En(e)?e:q6(e)?e.entries():e?Object.entries(e):[]}const kse="row_object";function Dse(e,t){e.type=UWe;const n=e.properties=[];for(const r of MC(t)){const[i,s]=En(r)?r:[r,r];n.push({type:Tse,key:{type:kg,raw:el(s)},value:Nse({computed:!0},i)})}return e}function $se(e){return iI(Dse({},e))}function Lse(e){return K6.expr($se(e))}function Q6(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function un(e){return this instanceof un?(this.v=e,this):new un(e)}function Fd(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){s.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{u(r[d](h))}catch(p){f(s[0][3],p)}}function u(d){d.value instanceof un?Promise.resolve(d.value.v).then(l,c):f(s[0][2],d)}function l(d){a("next",d)}function c(d){a("throw",d)}function f(d,h){d(h),s.shift(),s.length&&a(s[0][0],s[0][1])}}function KO(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,s){t[i]=e[i]?function(o){return(n=!n)?{value:un(e[i](o)),done:!1}:s?s(o):o}:s}}function My(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Az=="function"?Az(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(o){return new Promise(function(a,u){o=e[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}const eqe=new TextDecoder("utf-8"),sk=e=>eqe.decode(e),tqe=new TextEncoder,X6=e=>tqe.encode(e),nqe=e=>typeof e=="boolean",Ls=e=>typeof e=="function",Zf=e=>e!=null&&Object(e)===e,FC=e=>Zf(e)&&Ls(e.then),J6=e=>Zf(e)&&Ls(e[Symbol.iterator]),BC=e=>Zf(e)&&Ls(e[Symbol.asyncIterator]),rqe=e=>Zf(e)&&"done"in e&&"value"in e,Mse=e=>"_getDOMStream"in e&&"_getNodeStream"in e,iqe=e=>Zf(e)&&Ls(e.abort)&&Ls(e.getWriter)&&!Mse(e),sqe=e=>Zf(e)&&Ls(e.end)&&Ls(e.write)&&nqe(e.writable)&&!Mse(e),oqe=e=>Zf(e)&&Ls(e.clear)&&Ls(e.bytes)&&Ls(e.position)&&Ls(e.setPosition)&&Ls(e.capacity)&&Ls(e.getBufferIdentifier)&&Ls(e.createLong),Z6=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function aqe(e){const t=e[0]?[e[0]]:[];let n,r,i,s;for(let o,a,u=0,l=0,c=e.length;++uc+f.byteLength,0);let i,s,o,a=0,u=-1;const l=Math.min(t||Number.POSITIVE_INFINITY,r);for(const c=n.length;++ufi(Int32Array,e),Mn=e=>fi(Uint8Array,e),ok=e=>(e.next(),e);function*uqe(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Z6?n(t):J6(t)?t:n(t);return yield*ok(function*(i){let s=null;do s=i.next(yield fi(e,s));while(!s.done)}(r[Symbol.iterator]())),new e}const lqe=e=>uqe(Uint8Array,e);function Fse(e,t){return Fd(this,arguments,function*(){if(FC(t))return yield un(yield un(yield*KO(My(Fse(e,yield un(t))))));const r=function(o){return Fd(this,arguments,function*(){yield yield un(yield un(o))})},i=function(o){return Fd(this,arguments,function*(){yield un(yield*KO(My(ok(function*(a){let u=null;do u=a.next(yield u==null?void 0:u.value);while(!u.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Z6?r(t):J6(t)?i(t):BC(t)?t:r(t);return yield un(yield*KO(My(ok(function(o){return Fd(this,arguments,function*(){let a=null;do a=yield un(o.next(yield yield un(fi(e,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield un(new e)})}const cqe=e=>Fse(Uint8Array,e);function Bse(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r0)do if(e[n]!==t[n])return!1;while(++n(e.next(),e);function*dqe(e){let t,n=!1,r=[],i,s,o,a=0;function u(){return s==="peek"?tl(r,o)[0]:([i,r,a]=tl(r,o),i)}({cmd:s,size:o}=yield null);const l=lqe(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield u());while(o0&&(i.push(s),u+=s.byteLength),n||a<=u)do({cmd:o,size:a}=yield yield un(l()));while(a0&&(i.push(Mn(s)),u+=s.byteLength),n||a<=u)do({cmd:o,size:a}=yield yield un(l()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Il(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Il(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=Mn(n)),n})}}const QO=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function gqe(e){return Fd(this,arguments,function*(){const n=[];let r="error",i=!1,s=null,o,a,u=0,l=[],c;function f(){return o==="peek"?tl(l,a)[0]:([c,l,u]=tl(l,a),c)}if({cmd:o,size:a}=yield yield un(null),e.isTTY)return yield yield un(new Uint8Array(0)),yield un(null);try{n[0]=QO(e,"end"),n[1]=QO(e,"error");do{if(n[2]=QO(e,"readable"),[r,s]=yield un(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-u)?(c=Mn(e.read(a-u)),c.byteLength0&&(l.push(c),u+=c.byteLength)),i||a<=u)do({cmd:o,size:a}=yield yield un(f()));while(a{for(const[g,v]of h)e.off(g,v);try{const g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var gs;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(gs||(gs={}));var so;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(so||(so={}));var $i;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})($i||($i={}));var nl;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(nl||(nl={}));var vt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(vt||(vt={}));var rl;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(rl||(rl={}));var pi;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(pi||(pi={}));var G;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(G||(G={}));var _l;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(_l||(_l={}));const yqe=void 0;function vh(e){if(e===null)return"null";if(e===yqe)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>vh(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}const vqe=Symbol.for("isArrowBigNum");function ru(e,...t){return t.length===0?Object.setPrototypeOf(fi(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}ru.prototype[vqe]=!0;ru.prototype.toJSON=function(){return`"${Fv(this)}"`};ru.prototype.valueOf=function(){return jse(this)};ru.prototype.toString=function(){return Fv(this)};ru.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return jse(this);case"string":return Fv(this);case"default":return _qe(this)}return Fv(this)};function dm(...e){return ru.apply(this,e)}function hm(...e){return ru.apply(this,e)}function Mv(...e){return ru.apply(this,e)}Object.setPrototypeOf(dm.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(hm.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Mv.prototype,Object.create(Uint32Array.prototype));Object.assign(dm.prototype,ru.prototype,{constructor:dm,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(hm.prototype,ru.prototype,{constructor:hm,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Mv.prototype,ru.prototype,{constructor:Mv,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function jse(e){const{buffer:t,byteOffset:n,length:r,signed:i}=e,s=new BigUint64Array(t,n,r),o=i&&s.at(-1)&BigInt(1)<{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return XO(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return XO(e);t=t.slice();let r=1;for(let s=0;se.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Fv(e);function XO(e){let t="";const n=new Uint32Array(2);let r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let s=-1;const o=r.length-1;do{for(n[0]=r[s=0];sNumber.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var Use,Vse,zse,Hse,Wse,qse,Gse,Yse,Kse,Qse,Xse,Jse,Zse,eoe,toe,noe,roe,ioe,soe,ooe;class Bt{static isNull(t){return(t==null?void 0:t.typeId)===G.Null}static isInt(t){return(t==null?void 0:t.typeId)===G.Int}static isFloat(t){return(t==null?void 0:t.typeId)===G.Float}static isBinary(t){return(t==null?void 0:t.typeId)===G.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===G.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===G.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===G.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===G.Date}static isTime(t){return(t==null?void 0:t.typeId)===G.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===G.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===G.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===G.Duration}static isList(t){return(t==null?void 0:t.typeId)===G.List}static isStruct(t){return(t==null?void 0:t.typeId)===G.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===G.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===G.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===G.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===G.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===G.Dictionary}static isDenseUnion(t){return Bt.isUnion(t)&&t.mode===so.Dense}static isSparseUnion(t){return Bt.isUnion(t)&&t.mode===so.Sparse}get typeId(){return G.NONE}}Use=Symbol.toStringTag;Bt[Use]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(Bt.prototype);let Jl=class extends Bt{toString(){return"Null"}get typeId(){return G.Null}};Vse=Symbol.toStringTag;Jl[Vse]=(e=>e[Symbol.toStringTag]="Null")(Jl.prototype);class ws extends Bt{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return G.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}zse=Symbol.toStringTag;ws[zse]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(ws.prototype);class tL extends ws{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class nL extends ws{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Nf extends ws{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class rL extends ws{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}class iL extends ws{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}class sL extends ws{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class oL extends ws{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class aL extends ws{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}Object.defineProperty(tL.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(nL.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Nf.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(rL.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(iL.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(sL.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(oL.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(aL.prototype,"ArrayType",{value:BigUint64Array});class kf extends Bt{constructor(t){super(),this.precision=t}get typeId(){return G.Float}get ArrayType(){switch(this.precision){case $i.HALF:return Uint16Array;case $i.SINGLE:return Float32Array;case $i.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Hse=Symbol.toStringTag;kf[Hse]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(kf.prototype);class aoe extends kf{constructor(){super($i.HALF)}}class uL extends kf{constructor(){super($i.SINGLE)}}class lL extends kf{constructor(){super($i.DOUBLE)}}Object.defineProperty(aoe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(uL.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(lL.prototype,"ArrayType",{value:Float64Array});let Bv=class extends Bt{constructor(){super()}get typeId(){return G.Binary}toString(){return"Binary"}};Wse=Symbol.toStringTag;Bv[Wse]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Bv.prototype);let Qm=class extends Bt{constructor(){super()}get typeId(){return G.Utf8}toString(){return"Utf8"}};qse=Symbol.toStringTag;Qm[qse]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Qm.prototype);let jv=class extends Bt{constructor(){super()}get typeId(){return G.Bool}toString(){return"Bool"}};Gse=Symbol.toStringTag;jv[Gse]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(jv.prototype);let aI=class extends Bt{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return G.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Yse=Symbol.toStringTag;aI[Yse]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(aI.prototype);class Xm extends Bt{constructor(t){super(),this.unit=t}get typeId(){return G.Date}toString(){return`Date${(this.unit+1)*32}<${nl[this.unit]}>`}}Kse=Symbol.toStringTag;Xm[Kse]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Xm.prototype);class bqe extends Xm{constructor(){super(nl.DAY)}}class wqe extends Xm{constructor(){super(nl.MILLISECOND)}}class Zl extends Bt{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return G.Time}toString(){return`Time${this.bitWidth}<${vt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Qse=Symbol.toStringTag;Zl[Qse]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Zl.prototype);class Eqe extends Zl{constructor(){super(vt.SECOND,32)}}class Sqe extends Zl{constructor(){super(vt.MILLISECOND,32)}}class Tqe extends Zl{constructor(){super(vt.MICROSECOND,64)}}class Iqe extends Zl{constructor(){super(vt.NANOSECOND,64)}}class uI extends Bt{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return G.Timestamp}toString(){return`Timestamp<${vt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Xse=Symbol.toStringTag;uI[Xse]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(uI.prototype);class Jm extends Bt{constructor(t){super(),this.unit=t}get typeId(){return G.Interval}toString(){return`Interval<${rl[this.unit]}>`}}Jse=Symbol.toStringTag;Jm[Jse]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Jm.prototype);class xqe extends Jm{constructor(){super(rl.DAY_TIME)}}class Cqe extends Jm{constructor(){super(rl.YEAR_MONTH)}}let lI=class extends Bt{constructor(t){super(),this.unit=t}get typeId(){return G.Duration}toString(){return`Duration<${vt[this.unit]}>`}};Zse=Symbol.toStringTag;lI[Zse]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(lI.prototype);let Zm=class extends Bt{constructor(t){super(),this.children=[t]}get typeId(){return G.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};eoe=Symbol.toStringTag;Zm[eoe]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Zm.prototype);class rs extends Bt{constructor(t){super(),this.children=t}get typeId(){return G.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}toe=Symbol.toStringTag;rs[toe]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(rs.prototype);class Uv extends Bt{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}get typeId(){return G.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}noe=Symbol.toStringTag;Uv[noe]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Uv.prototype);let cI=class extends Bt{constructor(t){super(),this.byteWidth=t}get typeId(){return G.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};roe=Symbol.toStringTag;cI[roe]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(cI.prototype);let eg=class extends Bt{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return G.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};ioe=Symbol.toStringTag;eg[ioe]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(eg.prototype);class Vv extends Bt{constructor(t,n=!1){var r,i,s;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t==null?void 0:t.type)===null||r===void 0)&&r.children)){const o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get typeId(){return G.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}soe=Symbol.toStringTag;Vv[soe]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Vv.prototype);const Aqe=(e=>()=>++e)(-1);class Df extends Bt{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Aqe():Ka(r)}get typeId(){return G.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}ooe=Symbol.toStringTag;Df[ooe]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Df.prototype);function pu(e){const t=e;switch(e.typeId){case G.Decimal:return e.bitWidth/32;case G.Timestamp:return 2;case G.Date:return 1+t.unit;case G.Interval:return 1+t.unit;case G.FixedSizeList:return t.listSize;case G.FixedSizeBinary:return t.byteWidth;default:return 1}}class qt{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return Pqe(this,t,n)}getVisitFnByTypeId(t,n=!0){return pp(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}}function Pqe(e,t,n=!0){return typeof t=="number"?pp(e,t,n):typeof t=="string"&&t in G?pp(e,G[t],n):t&&t instanceof Bt?pp(e,Oz(t),n):t!=null&&t.type&&t.type instanceof Bt?pp(e,Oz(t.type),n):pp(e,G.NONE,n)}function pp(e,t,n=!0){let r=null;switch(t){case G.Null:r=e.visitNull;break;case G.Bool:r=e.visitBool;break;case G.Int:r=e.visitInt;break;case G.Int8:r=e.visitInt8||e.visitInt;break;case G.Int16:r=e.visitInt16||e.visitInt;break;case G.Int32:r=e.visitInt32||e.visitInt;break;case G.Int64:r=e.visitInt64||e.visitInt;break;case G.Uint8:r=e.visitUint8||e.visitInt;break;case G.Uint16:r=e.visitUint16||e.visitInt;break;case G.Uint32:r=e.visitUint32||e.visitInt;break;case G.Uint64:r=e.visitUint64||e.visitInt;break;case G.Float:r=e.visitFloat;break;case G.Float16:r=e.visitFloat16||e.visitFloat;break;case G.Float32:r=e.visitFloat32||e.visitFloat;break;case G.Float64:r=e.visitFloat64||e.visitFloat;break;case G.Utf8:r=e.visitUtf8;break;case G.Binary:r=e.visitBinary;break;case G.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case G.Date:r=e.visitDate;break;case G.DateDay:r=e.visitDateDay||e.visitDate;break;case G.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case G.Timestamp:r=e.visitTimestamp;break;case G.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case G.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case G.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case G.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case G.Time:r=e.visitTime;break;case G.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case G.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case G.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case G.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case G.Decimal:r=e.visitDecimal;break;case G.List:r=e.visitList;break;case G.Struct:r=e.visitStruct;break;case G.Union:r=e.visitUnion;break;case G.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case G.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case G.Dictionary:r=e.visitDictionary;break;case G.Interval:r=e.visitInterval;break;case G.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case G.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case G.Duration:r=e.visitDuration;break;case G.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case G.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case G.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case G.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case G.FixedSizeList:r=e.visitFixedSizeList;break;case G.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${G[t]}'`)}function Oz(e){switch(e.typeId){case G.Null:return G.Null;case G.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?G.Int8:G.Uint8;case 16:return n?G.Int16:G.Uint16;case 32:return n?G.Int32:G.Uint32;case 64:return n?G.Int64:G.Uint64}return G.Int}case G.Float:switch(e.precision){case $i.HALF:return G.Float16;case $i.SINGLE:return G.Float32;case $i.DOUBLE:return G.Float64}return G.Float;case G.Binary:return G.Binary;case G.Utf8:return G.Utf8;case G.Bool:return G.Bool;case G.Decimal:return G.Decimal;case G.Time:switch(e.unit){case vt.SECOND:return G.TimeSecond;case vt.MILLISECOND:return G.TimeMillisecond;case vt.MICROSECOND:return G.TimeMicrosecond;case vt.NANOSECOND:return G.TimeNanosecond}return G.Time;case G.Timestamp:switch(e.unit){case vt.SECOND:return G.TimestampSecond;case vt.MILLISECOND:return G.TimestampMillisecond;case vt.MICROSECOND:return G.TimestampMicrosecond;case vt.NANOSECOND:return G.TimestampNanosecond}return G.Timestamp;case G.Date:switch(e.unit){case nl.DAY:return G.DateDay;case nl.MILLISECOND:return G.DateMillisecond}return G.Date;case G.Interval:switch(e.unit){case rl.DAY_TIME:return G.IntervalDayTime;case rl.YEAR_MONTH:return G.IntervalYearMonth}return G.Interval;case G.Duration:switch(e.unit){case vt.SECOND:return G.DurationSecond;case vt.MILLISECOND:return G.DurationMillisecond;case vt.MICROSECOND:return G.DurationMicrosecond;case vt.NANOSECOND:return G.DurationNanosecond}return G.Duration;case G.Map:return G.Map;case G.List:return G.List;case G.Struct:return G.Struct;case G.Union:switch(e.mode){case so.Dense:return G.DenseUnion;case so.Sparse:return G.SparseUnion}return G.Union;case G.FixedSizeBinary:return G.FixedSizeBinary;case G.FixedSizeList:return G.FixedSizeList;case G.Dictionary:return G.Dictionary}throw new Error(`Unrecognized type '${G[e.typeId]}'`)}qt.prototype.visitInt8=null;qt.prototype.visitInt16=null;qt.prototype.visitInt32=null;qt.prototype.visitInt64=null;qt.prototype.visitUint8=null;qt.prototype.visitUint16=null;qt.prototype.visitUint32=null;qt.prototype.visitUint64=null;qt.prototype.visitFloat16=null;qt.prototype.visitFloat32=null;qt.prototype.visitFloat64=null;qt.prototype.visitDateDay=null;qt.prototype.visitDateMillisecond=null;qt.prototype.visitTimestampSecond=null;qt.prototype.visitTimestampMillisecond=null;qt.prototype.visitTimestampMicrosecond=null;qt.prototype.visitTimestampNanosecond=null;qt.prototype.visitTimeSecond=null;qt.prototype.visitTimeMillisecond=null;qt.prototype.visitTimeMicrosecond=null;qt.prototype.visitTimeNanosecond=null;qt.prototype.visitDenseUnion=null;qt.prototype.visitSparseUnion=null;qt.prototype.visitIntervalDayTime=null;qt.prototype.visitIntervalYearMonth=null;qt.prototype.visitDuration=null;qt.prototype.visitDurationSecond=null;qt.prototype.visitDurationMillisecond=null;qt.prototype.visitDurationMicrosecond=null;qt.prototype.visitDurationNanosecond=null;const uoe=new Float64Array(1),op=new Uint32Array(uoe.buffer);function loe(e){const t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function coe(e){if(e!==e)return 32256;uoe[0]=e;const t=(op[1]&2147483648)>>16&65535;let n=op[1]&2146435072,r=0;return n>=1089470464?op[0]>0?n=31744:(n=(n&2080374784)>>16,r=(op[1]&1048575)>>10):n<=1056964608?(r=1048576+(op[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(op[1]&1048575)+512>>10),t|n|r&65535}class It extends qt{}function Ot(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const Oqe=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},cL=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},Rqe=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},Nqe=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},foe=(e,t,n,r)=>{if(n+1{const i=e+n;r?t[i>>3]|=1<>3]&=~(1<{e[t]=n},fL=({values:e},t,n)=>{e[t]=n},doe=({values:e},t,n)=>{e[t]=coe(n)},Dqe=(e,t,n)=>{switch(e.type.precision){case $i.HALF:return doe(e,t,n);case $i.SINGLE:case $i.DOUBLE:return fL(e,t,n)}},dL=({values:e},t,n)=>{Oqe(e,t,n.valueOf())},hL=({values:e},t,n)=>{cL(e,t*2,n.valueOf())},hoe=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},$qe=({values:e,valueOffsets:t},n,r)=>foe(e,t,n,r),Lqe=({values:e,valueOffsets:t},n,r)=>{foe(e,t,n,X6(r))},poe=(e,t,n)=>{e.type.unit===nl.DAY?dL(e,t,n):hL(e,t,n)},pL=({values:e},t,n)=>cL(e,t*2,n/1e3),mL=({values:e},t,n)=>cL(e,t*2,n),gL=({values:e},t,n)=>Rqe(e,t*2,n),yL=({values:e},t,n)=>Nqe(e,t*2,n),moe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return pL(e,t,n);case vt.MILLISECOND:return mL(e,t,n);case vt.MICROSECOND:return gL(e,t,n);case vt.NANOSECOND:return yL(e,t,n)}},vL=({values:e},t,n)=>{e[t]=n},_L=({values:e},t,n)=>{e[t]=n},bL=({values:e},t,n)=>{e[t]=n},wL=({values:e},t,n)=>{e[t]=n},goe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return vL(e,t,n);case vt.MILLISECOND:return _L(e,t,n);case vt.MICROSECOND:return bL(e,t,n);case vt.NANOSECOND:return wL(e,t,n)}},yoe=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Mqe=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,s=ca.getVisitFn(r);if(Array.isArray(n))for(let o=-1,a=i[t],u=i[t+1];a{const r=e.children[0],{valueOffsets:i}=e,s=ca.getVisitFn(r);let{[t]:o,[t+1]:a}=i;const u=n instanceof Map?n.entries():Object.entries(n);for(const l of u)if(s(r,o,l),++o>=a)break},Bqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),jqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),Uqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),Vqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),zqe=(e,t,n)=>{const r=e.type.children.map(s=>ca.getVisitFn(s.type)),i=n instanceof Map?Uqe(t,n):n instanceof Sn?jqe(t,n):Array.isArray(n)?Bqe(t,n):Vqe(t,n);e.type.children.forEach((s,o)=>i(r[o],e.children[o],s,o))},Hqe=(e,t,n)=>{e.type.mode===so.Dense?voe(e,t,n):_oe(e,t,n)},voe=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ca.visit(i,e.valueOffsets[t],n)},_oe=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ca.visit(i,t,n)},Wqe=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},boe=(e,t,n)=>{e.type.unit===rl.DAY_TIME?EL(e,t,n):SL(e,t,n)},EL=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},SL=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},TL=({values:e},t,n)=>{e[t]=n},IL=({values:e},t,n)=>{e[t]=n},xL=({values:e},t,n)=>{e[t]=n},CL=({values:e},t,n)=>{e[t]=n},woe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return TL(e,t,n);case vt.MILLISECOND:return IL(e,t,n);case vt.MICROSECOND:return xL(e,t,n);case vt.NANOSECOND:return CL(e,t,n)}},qqe=(e,t,n)=>{const{stride:r}=e,i=e.children[0],s=ca.getVisitFn(i);if(Array.isArray(n))for(let o=-1,a=t*r;++o`${vh(t)}: ${vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Gqe(this[Pa],this[pm])}}class Gqe{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return tn.name)}has(t,n){return t[Pa].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Pa].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[Pa].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=oo.visit(t[Pa].children[r],t[pm]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Pa].type.children.findIndex(s=>s.name===n);return i!==-1?(ca.visit(t[Pa].children[i],t[pm],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class _t extends qt{}function xt(e){return(t,n)=>t.getValid(n)?e(t,n):null}const Kqe=(e,t)=>864e5*e[t],PL=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Qqe=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,Xqe=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,Eoe=e=>new Date(e),Jqe=(e,t)=>Eoe(Kqe(e,t)),Zqe=(e,t)=>Eoe(PL(e,t)),eGe=(e,t)=>null,Soe=(e,t,n)=>{if(n+1>=t.length)return null;const r=t[n],i=t[n+1];return e.subarray(r,i)},tGe=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<Jqe(e,t),Ioe=({values:e},t)=>Zqe(e,t*2),ed=({stride:e,values:t},n)=>t[e*n],nGe=({stride:e,values:t},n)=>loe(t[e*n]),xoe=({values:e},t)=>e[t],rGe=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),iGe=({values:e,valueOffsets:t},n)=>Soe(e,t,n),sGe=({values:e,valueOffsets:t},n)=>{const r=Soe(e,t,n);return r!==null?sk(r):null},oGe=({values:e},t)=>e[t],aGe=({type:e,values:t},n)=>e.precision!==$i.HALF?t[n]:loe(t[n]),uGe=(e,t)=>e.type.unit===nl.DAY?Toe(e,t):Ioe(e,t),Coe=({values:e},t)=>1e3*PL(e,t*2),Aoe=({values:e},t)=>PL(e,t*2),Poe=({values:e},t)=>Qqe(e,t*2),Ooe=({values:e},t)=>Xqe(e,t*2),lGe=(e,t)=>{switch(e.type.unit){case vt.SECOND:return Coe(e,t);case vt.MILLISECOND:return Aoe(e,t);case vt.MICROSECOND:return Poe(e,t);case vt.NANOSECOND:return Ooe(e,t)}},Roe=({values:e},t)=>e[t],Noe=({values:e},t)=>e[t],koe=({values:e},t)=>e[t],Doe=({values:e},t)=>e[t],cGe=(e,t)=>{switch(e.type.unit){case vt.SECOND:return Roe(e,t);case vt.MILLISECOND:return Noe(e,t);case vt.MICROSECOND:return koe(e,t);case vt.NANOSECOND:return Doe(e,t)}},fGe=({values:e,stride:t},n)=>eL.decimal(e.subarray(t*n,t*(n+1))),dGe=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:s,[t*r+1]:o}=n,u=i[0].slice(s,o-s);return new Sn([u])},hGe=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:s}=n,o=r[0];return new jC(o.slice(i,s-i))},pGe=(e,t)=>new AL(e,t),mGe=(e,t)=>e.type.mode===so.Dense?$oe(e,t):Loe(e,t),$oe=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return oo.visit(r,e.valueOffsets[t])},Loe=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return oo.visit(r,t)},gGe=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},yGe=(e,t)=>e.type.unit===rl.DAY_TIME?Moe(e,t):Foe(e,t),Moe=({values:e},t)=>e.subarray(2*t,2*(t+1)),Foe=({values:e},t)=>{const n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},Boe=({values:e},t)=>e[t],joe=({values:e},t)=>e[t],Uoe=({values:e},t)=>e[t],Voe=({values:e},t)=>e[t],vGe=(e,t)=>{switch(e.type.unit){case vt.SECOND:return Boe(e,t);case vt.MILLISECOND:return joe(e,t);case vt.MICROSECOND:return Uoe(e,t);case vt.NANOSECOND:return Voe(e,t)}},_Ge=(e,t)=>{const{stride:n,children:r}=e,s=r[0].slice(t*n,n);return new Sn([s])};_t.prototype.visitNull=xt(eGe);_t.prototype.visitBool=xt(tGe);_t.prototype.visitInt=xt(oGe);_t.prototype.visitInt8=xt(ed);_t.prototype.visitInt16=xt(ed);_t.prototype.visitInt32=xt(ed);_t.prototype.visitInt64=xt(xoe);_t.prototype.visitUint8=xt(ed);_t.prototype.visitUint16=xt(ed);_t.prototype.visitUint32=xt(ed);_t.prototype.visitUint64=xt(xoe);_t.prototype.visitFloat=xt(aGe);_t.prototype.visitFloat16=xt(nGe);_t.prototype.visitFloat32=xt(ed);_t.prototype.visitFloat64=xt(ed);_t.prototype.visitUtf8=xt(sGe);_t.prototype.visitBinary=xt(iGe);_t.prototype.visitFixedSizeBinary=xt(rGe);_t.prototype.visitDate=xt(uGe);_t.prototype.visitDateDay=xt(Toe);_t.prototype.visitDateMillisecond=xt(Ioe);_t.prototype.visitTimestamp=xt(lGe);_t.prototype.visitTimestampSecond=xt(Coe);_t.prototype.visitTimestampMillisecond=xt(Aoe);_t.prototype.visitTimestampMicrosecond=xt(Poe);_t.prototype.visitTimestampNanosecond=xt(Ooe);_t.prototype.visitTime=xt(cGe);_t.prototype.visitTimeSecond=xt(Roe);_t.prototype.visitTimeMillisecond=xt(Noe);_t.prototype.visitTimeMicrosecond=xt(koe);_t.prototype.visitTimeNanosecond=xt(Doe);_t.prototype.visitDecimal=xt(fGe);_t.prototype.visitList=xt(dGe);_t.prototype.visitStruct=xt(pGe);_t.prototype.visitUnion=xt(mGe);_t.prototype.visitDenseUnion=xt($oe);_t.prototype.visitSparseUnion=xt(Loe);_t.prototype.visitDictionary=xt(gGe);_t.prototype.visitInterval=xt(yGe);_t.prototype.visitIntervalDayTime=xt(Moe);_t.prototype.visitIntervalYearMonth=xt(Foe);_t.prototype.visitDuration=xt(vGe);_t.prototype.visitDurationSecond=xt(Boe);_t.prototype.visitDurationMillisecond=xt(joe);_t.prototype.visitDurationMicrosecond=xt(Uoe);_t.prototype.visitDurationNanosecond=xt(Voe);_t.prototype.visitFixedSizeList=xt(_Ge);_t.prototype.visitMap=xt(hGe);const oo=new _t,La=Symbol.for("keys"),mm=Symbol.for("vals");class jC{constructor(t){return this[La]=new Sn([t.children[0]]).memoize(),this[mm]=t.children[1],new Proxy(this,new wGe)}[Symbol.iterator](){return new bGe(this[La],this[mm])}get size(){return this[La].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[La],n=this[mm],r={};for(let i=-1,s=t.length;++i`${vh(t)}: ${vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class bGe{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),oo.visit(this.vals,t)]})}}class wGe{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[La].toArray().map(String)}has(t,n){return t[La].includes(n)}getOwnPropertyDescriptor(t,n){if(t[La].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[La].indexOf(n);if(r!==-1){const i=oo.visit(Reflect.get(t,mm),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[La].indexOf(n);return i!==-1?(ca.visit(Reflect.get(t,mm),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(jC.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[La]:{writable:!0,enumerable:!1,configurable:!1,value:null},[mm]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Rz;function zoe(e,t,n,r){const{length:i=0}=e;let s=typeof t!="number"?0:t,o=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),r?r(e,s,o):[s,o]}const Nz=e=>e!==e;function Dg(e){if(typeof e!=="object"||e===null)return Nz(e)?Nz:n=>n===e;if(e instanceof Date){const n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?fqe(e,n):!1:e instanceof Map?SGe(e):Array.isArray(e)?EGe(e):e instanceof Sn?TGe(e):IGe(e,!0)}function EGe(e){const t=[];for(let n=-1,r=e.length;++n!1;const r=[];for(let i=-1,s=n.length;++i{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return xGe(e,n);case Map:return kz(e,n,n.keys());case jC:case AL:case Object:case void 0:return kz(e,n,t||Object.keys(n))}return n instanceof Sn?CGe(e,n):!1}}function xGe(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r>r}function fI(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength>3):Woe(new OL(n,e,t,null,Hoe)).subarray(0,r)),i}return n}function Woe(e){const t=[];let n=0,r=0,i=0;for(const o of e)o&&(i|=1<0)&&(t[n++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class OL{constructor(t,n,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8===0?0:8-t%8);return ak(e,t,i)+ak(e,r,n)+PGe(e,i>>3,r-i>>3)}function PGe(e,t,n){let r=0,i=Math.trunc(t);const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=JO(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=JO(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=JO(s.getUint8(i)),i+=1;return r}function JO(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const OGe=-1;class Ln{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return Bt.isSparseUnion(t)?this.children.some(n=>n.nullable):Bt.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(Bt.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=OGe&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-ak(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let u;s instanceof Ln?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=pu(t),s&&((u=s[0])&&(this.valueOffsets=u),(u=s[1])&&(this.values=u),(u=s[2])&&(this.nullBitmap=u),(u=s[3])&&(this.typeIds=u)))}getValid(t){const{type:n}=this;if(Bt.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===so.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<>3;(!s||s.byteLength<=c)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0&&s.set(fI(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s,_nullCount:-1}));const f=s[c];r=(f&l)!==0,n?s[c]=f|l:s[c]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,o=this.children){return new Ln(t,n,r,i,s,o,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?r:1,u=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,o,u,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===G.Null)return this.clone(this.type,0,t,0);const{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<0&&i.set(fI(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[_l.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),s)}_sliceBuffers(t,n,r,i){let s;const{buffers:o}=this;return(s=o[_l.TYPE])&&(o[_l.TYPE]=s.subarray(t,t+n)),(s=o[_l.OFFSET])&&(o[_l.OFFSET]=s.subarray(t,t+n+1))||(s=o[_l.DATA])&&(o[_l.DATA]=i===6?s:s.subarray(r*t,r*(t+n))),o}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}Ln.prototype.children=Object.freeze([]);class Fy extends qt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new Ln(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.data),s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,i,s])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.data),s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,void 0,s],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=Mn(t.nullBitmap),{length:o=i.reduce((u,{length:l})=>Math.max(u,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=fi(n.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(Bt.isSparseUnion(n))return new Ln(n,r,o,a,[void 0,void 0,void 0,s],i);const u=k0(t.valueOffsets);return new Ln(n,r,o,a,[u,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.indices.ArrayType,t.data),{["dictionary"]:o=new Sn([new Fy().visit({type:n.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=Mn(t.nullBitmap),s=fi(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Fy().visit({type:n.valueType})}=t,s=Mn(t.nullBitmap),{["length"]:o=i.length/pu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ln(n,r,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Fy().visit({type:n.childType})}=t,s=Mn(t.nullBitmap),o=k0(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new Ln(n,r,a,u,[o,void 0,s],[i])}}const RGe=new Fy;function Ji(e){return RGe.visit(e)}class Dz{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext+n.nullCount,0)}function Goe(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Yoe(e,t,n,r){const i=[];for(let s=-1,o=e.length;++s=r)break;if(n>=u+l)continue;if(u>=n&&u+l<=r){i.push(a);continue}const c=Math.max(0,n-u),f=Math.min(r-u,l);i.push(a.slice(c,f-c))}return i.length===0&&i.push(e[0].slice(0,0)),i}function RL(e,t,n,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function kGe(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new OL(n,e.offset+(t||0),e.length,n,Hoe)){if(!i)return r;++r}return-1}function $t(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case G.Union:break;case G.Dictionary:break;default:return kGe(e,n)}const r=oo.getVisitFn(e),i=Dg(t);for(let s=(n||0)-1,o=e.length;++s{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Dz(e.data.length,r=>{const s=e.data[r].length,o=e.slice(n,n+s);return n+=s,new DGe(o)})}class DGe{constructor(t){this.vector=t,this.index=0}next(){return this.indexe+t;class td extends qt{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===vt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+il.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+il.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}}const LGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),MGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),FGe=({valueOffsets:e,stride:t,children:n},r)=>{const i=n[0],{[r*t]:s}=e,{[r*t+1]:o}=e,a=il.getVisitFn(i.type),u=i.slice(s,o-s);let l=8;for(let c=-1,f=o-s;++c{const r=t[0],i=r.slice(n*e,e),s=il.getVisitFn(r.type);let o=0;for(let a=-1,u=i.length;++ae.type.mode===so.Dense?Joe(e,t):Zoe(e,t),Joe=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{const s=e.typeIdToChildIndex[n[i]];return 8+il.visit(t[s],r[i])},Zoe=({children:e},t)=>4+il.visitMany(e,e.map(()=>t)).reduce($Ge,0);td.prototype.visitUtf8=LGe;td.prototype.visitBinary=MGe;td.prototype.visitList=FGe;td.prototype.visitFixedSizeList=BGe;td.prototype.visitUnion=jGe;td.prototype.visitDenseUnion=Joe;td.prototype.visitSparseUnion=Zoe;const il=new td;var eae;const tae={},nae={};class Sn{constructor(t){var n,r,i;const s=t[0]instanceof Sn?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof Ln)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:u,indexOf:l,byteLength:c}=tae[o.typeId],f=s[0];this.isValid=d=>NL(f,d),this.get=d=>a(f,d),this.set=(d,h)=>u(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>c(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,nae[o.typeId]),this._offsets=Goe(s);break}this.data=s,this.type=o,this.stride=pu(o),this.numChildren=(i=(r=o.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return qoe(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${G[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return kL.visit(this)}concat(...t){return new Sn(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new Sn(zoe(this,t,n,({data:r,_offsets:i},s,o)=>Yoe(r,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,length:r,stride:i,ArrayType:s}=this;switch(t.typeId){case G.Int:case G.Float:case G.Decimal:case G.Time:case G.Timestamp:switch(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((o,{values:a,length:u})=>(o.array.set(a.subarray(0,u*i),o.offset),o.offset+=u*i,o),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&tn[t])):null}get isMemoized(){return Bt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Bt.isDictionary(this.type)){const t=new hI(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new Sn(n)}return new hI(this)}unmemoize(){if(Bt.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new Sn(n)}return this}}eae=Symbol.toStringTag;Sn[eae]=(e=>{e.type=Bt.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;const t=Object.keys(G).map(n=>G[n]).filter(n=>typeof n=="number"&&n!==G.NONE);for(const n of t){const r=oo.getVisitFnByTypeId(n),i=ca.getVisitFnByTypeId(n),s=dI.getVisitFnByTypeId(n),o=il.getVisitFnByTypeId(n);tae[n]={get:r,set:i,indexOf:s,byteLength:o},nae[n]=Object.create(e,{isValid:{value:gm(NL)},get:{value:gm(oo.getVisitFnByTypeId(n))},set:{value:Koe(ca.getVisitFnByTypeId(n))},indexOf:{value:Qoe(dI.getVisitFnByTypeId(n))},getByteLength:{value:gm(il.getVisitFnByTypeId(n))}})}return"Vector"})(Sn.prototype);class hI extends Sn{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const u=n.call(this,o);return s[o]=u,u}}),Object.defineProperty(this,"set",{value(o,a){r.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new hI(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Sn(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}function UGe(e){if(!e||e.length<=0)return function(i){return!0};let t="";const n=e.filter(r=>r===r);return n.length>0&&(t=` switch (x) {${n.map(r=>` case ${VGe(r)}:`).join("")} return false; diff --git a/index.html b/index.html index 6a5698b19..d74e2eb0b 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ }(window.location)) - +