diff --git a/assets/index-Xl2hxeGS.js b/assets/index-QDBUycz5.js similarity index 94% rename from assets/index-Xl2hxeGS.js rename to assets/index-QDBUycz5.js index bc3bb6a3d..556b551f8 100644 --- a/assets/index-Xl2hxeGS.js +++ b/assets/index-QDBUycz5.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 V6=new WeakMap,wHe=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),EHe=function(){function e(t,n){this.callback=t,this.observer=n}return e}();function SHe(e){return V6.get(e)}function THe(e,t){return e.observers.get(t)}function IHe(e,t){e.observers.delete(t.callback)}function xHe(e,t){t.unobserve()}function CHe(e,t){var n=[],r,i=SHe(e);if(!i)i=new wHe(e),V6.set(e,i);else{var s=THe(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(){JN(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(){JN(r),clearTimeout(r.next),IHe(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 EHe(t,r)),r}function JN(e,t){t===void 0&&(t=!1);var n=V6.get(e.object);z6(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 z6(e,t,n,r,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=KN(t),o=KN(e),a=!1,u=o.length-1;u>=0;u--){var l=o[u],c=e[l];if(YN(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)?z6(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 PHe(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(PHe(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=Zze({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 OHe(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=OHe(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 RHe(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}`}}sHe();function NHe(e){return e.length===2?dHe(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:NHe(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 kHe="Expected a function",gz=NaN,DHe="[object Symbol]",$He=/^\s+|\s+$/g,LHe=/^[-+]0x[0-9a-f]+$/i,MHe=/^0b[01]+$/i,FHe=/^0o[0-7]+$/i,BHe=parseInt,jHe=typeof _o=="object"&&_o&&_o.Object===Object&&_o,UHe=typeof self=="object"&&self&&self.Object===Object&&self,VHe=jHe||UHe||Function("return this")(),zHe=Object.prototype,HHe=zHe.toString,WHe=Math.max,qHe=Math.min,zO=function(){return VHe.Date.now()};function GHe(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(kHe);t=yz(t)||0,ZN(n)&&(c=!!n.leading,f="maxWait"in n,s=f?WHe(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?qHe(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=zO();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(zO())}function T(){var E=zO(),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 ZN(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function YHe(e){return!!e&&typeof e=="object"}function KHe(e){return typeof e=="symbol"||YHe(e)&&HHe.call(e)==DHe}function yz(e){if(typeof e=="number")return e;if(KHe(e))return gz;if(ZN(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ZN(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace($He,"");var n=MHe.test(e);return n||FHe.test(e)?BHe(e.slice(2),n?2:8):LHe.test(e)?gz:+e}var QHe=GHe;const ou=eu(QHe);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?$6("%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 XHe=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 JHe=Object.freeze(Object.defineProperty({__proto__:null,YAxis:use},Symbol.toStringTag,{value:"Module"})),Yi={top:30,left:40,right:80,bottom:50};function ek({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:IVe(J,V=>V[e.y_var]),upperq:P7(J,.75,V=>V[e.y_var]),lowerq:P7(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 P6(E6).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 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 ZHe=Object.freeze(Object.defineProperty({__proto__:null,LineChart:ek,default:ek},Symbol.toStringTag,{value:"Module"})),sp={top:0,left:0,right:0,bottom:0},vz=20,HO=60;function tk({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,HO+sp.left]).domain(a):kv([sp.left,HO+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 P6(E6).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:`${HO}`,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 eWe=Object.freeze(Object.defineProperty({__proto__:null,Sidebar:tk,default:tk},Symbol.toStringTag,{value:"Module"}));function nk({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 $6("%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 tWe=Object.freeze(Object.defineProperty({__proto__:null,RangeSelector:nk,default:nk},Symbol.toStringTag,{value:"Module"}));function rk({guardrail:e,setGuardrail:t,dataname:n,setDataname:r,setSelection:i}){return C.jsxs(C.Fragment,{children:[C.jsx(rt,{children:"Data:"}),C.jsx(JR,{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(JR,{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 nWe=Object.freeze(Object.defineProperty({__proto__:null,Selector:rk,default:rk},Symbol.toStringTag,{value:"Module"})),En=Array.isArray;function io(e){return e!=null?En(e)?e:[e]:[]}function rWe(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(rWe(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)}},sWe=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]()}},oWe=function(e){return e&&sr(e.get)?e:new sWe(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 aWe(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)?uWe(e,t):sr(e[Symbol.iterator])?lWe(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 uWe(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),dWe={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 hWe(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,pWe=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 pWe(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 mWe=/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/;function gWe(e){return e.match(mWe)&&!isNaN(Date.parse(e))}function yWe(e,t=Date.parse){return gWe(e)?t(e):e}const dse=6e4,hse=864e5,pse=6048e5,xr=new Date,Ar=new Date,Dr=e=>(xr.setTime(typeof e=="string"?yWe(e):e),xr);function vWe(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 _We(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 bWe(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 wWe(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 EWe(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 SWe(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 TWe={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:vWe,dayofyear:bWe,week:EWe,utcdatetime:_We,utcdayofyear:wWe,utcweek:SWe,now:Date.now};function H6(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)?IWe(e,t):!1}function IWe(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 CWe=Math.random;function Ng(){return CWe()}const AWe={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 W6(e){return e instanceof Map}function PWe(e){return e instanceof Set}function Vw(e){return W6(e)||PWe(e)}function WO(e){return Array.from(e)}const OWe={has:(e,t)=>Vw(e)?e.has(t):e!=null?Ya(e,t):!1,keys:e=>W6(e)?WO(e.keys()):e!=null?Object.keys(e):[],values:e=>Vw(e)?WO(e.values()):e!=null?Object.values(e):[],entries:e=>Vw(e)?WO(e.entries()):e!=null?Object.entries(e):[],object:e=>e?Object.fromEntries(e):yn};function RWe(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 NWe(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:hWe,equal:H6,recode:RWe,sequence:NWe,...dWe,...TWe,...xWe,...AWe,...OWe,...kWe};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 DWe(e,io(t),io(n))}let DWe=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 $We(e,t){e=Vw(e)?e:new Set(e);let n=t,r=0;for(;e.has(n);)n=t+ ++r;return n}function LWe(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 MWe(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 FWe(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=$We(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 BWe="ArrayPattern",jWe="ArrowFunctionExpression",UWe="FunctionExpression",vf="Identifier",kg="Literal",Ese="MemberExpression",VWe="ObjectExpression",Sse="ObjectPattern",Tse="Property",i1="Column",zWe="Constant",HWe="Dictionary",WWe="Function",qWe="Parameter",Ise="Op",Kn=(e,t)=>{const n=GWe[e.type];return n?n(e,t):Wt(`Unsupported expression construct: ${e.type}`)},qO=(e,t)=>"("+Kn(e.left,t)+" "+e.operator+" "+Kn(e.right,t)+")",GO=(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})`},GWe={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:qO,BinaryExpression:qO,LogicalExpression:qO,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:GO,FunctionExpression:GO,FunctionDeclaration:GO,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 YWe(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 QWe(){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 XWe(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=QWe(),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,XWe(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=>YWe(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=JWe(r,i,r.index))>=0?t=r.value(n,i):(n=r.size,t=e)}},param:[1,1]}};function JWe(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)},ZWe={"==":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=ZWe[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&&eqe(i,e,s,r.keyFor(s.value))}return e}function eqe(e,t,n,r){return r<0?(e.type=kg,e.value=!1,e.raw="false"):(t.type=HWe,n.value=r,n.raw=r+""),!0}function MC(e){return En(e)?e:W6(e)?e.entries():e?Object.entries(e):[]}const kse="row_object";function Dse(e,t){e.type=VWe;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 Y6.expr($se(e))}function K6(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 YO(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 tqe=new TextDecoder("utf-8"),ik=e=>tqe.decode(e),nqe=new TextEncoder,Q6=e=>nqe.encode(e),rqe=e=>typeof e=="boolean",Ls=e=>typeof e=="function",Zf=e=>e!=null&&Object(e)===e,FC=e=>Zf(e)&&Ls(e.then),X6=e=>Zf(e)&&Ls(e[Symbol.iterator]),BC=e=>Zf(e)&&Ls(e[Symbol.asyncIterator]),iqe=e=>Zf(e)&&"done"in e&&"value"in e,Mse=e=>"_getDOMStream"in e&&"_getNodeStream"in e,sqe=e=>Zf(e)&&Ls(e.abort)&&Ls(e.getWriter)&&!Mse(e),oqe=e=>Zf(e)&&Ls(e.end)&&Ls(e.write)&&rqe(e.writable)&&!Mse(e),aqe=e=>Zf(e)&&Ls(e.clear)&&Ls(e.bytes)&&Ls(e.position)&&Ls(e.setPosition)&&Ls(e.capacity)&&Ls(e.getBufferIdentifier)&&Ls(e.createLong),J6=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function uqe(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),sk=e=>(e.next(),e);function*lqe(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof J6?n(t):X6(t)?t:n(t);return yield*sk(function*(i){let s=null;do s=i.next(yield fi(e,s));while(!s.done)}(r[Symbol.iterator]())),new e}const cqe=e=>lqe(Uint8Array,e);function Fse(e,t){return Fd(this,arguments,function*(){if(FC(t))return yield un(yield un(yield*YO(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*YO(My(sk(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 J6?r(t):X6(t)?i(t):BC(t)?t:r(t);return yield un(yield*YO(My(sk(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 fqe=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*hqe(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=cqe(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 KO=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function yqe(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]=KO(e,"end"),n[1]=KO(e,"error");do{if(n[2]=KO(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 vqe=void 0;function vh(e){if(e===null)return"null";if(e===vqe)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 _qe=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[_qe]=!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 bqe(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 QO(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return QO(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 QO(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 eL extends ws{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class tL extends ws{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Nf extends ws{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class nL extends ws{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}class rL extends ws{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}class iL extends ws{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class sL extends ws{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class oL extends ws{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}Object.defineProperty(eL.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(tL.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Nf.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(nL.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(rL.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(iL.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(sL.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(oL.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 aL extends kf{constructor(){super($i.SINGLE)}}class uL extends kf{constructor(){super($i.DOUBLE)}}Object.defineProperty(aoe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(aL.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(uL.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 wqe extends Xm{constructor(){super(nl.DAY)}}class Eqe 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 Sqe extends Zl{constructor(){super(vt.SECOND,32)}}class Tqe extends Zl{constructor(){super(vt.MILLISECOND,32)}}class Iqe extends Zl{constructor(){super(vt.MICROSECOND,64)}}class xqe 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 Cqe extends Jm{constructor(){super(rl.DAY_TIME)}}class Aqe 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 Pqe=(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?Pqe():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 Oqe(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 Oqe(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 Rqe=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},lL=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},Nqe=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},kqe=(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},cL=({values:e},t,n)=>{e[t]=n},doe=({values:e},t,n)=>{e[t]=coe(n)},$qe=(e,t,n)=>{switch(e.type.precision){case $i.HALF:return doe(e,t,n);case $i.SINGLE:case $i.DOUBLE:return cL(e,t,n)}},fL=({values:e},t,n)=>{Rqe(e,t,n.valueOf())},dL=({values:e},t,n)=>{lL(e,t*2,n.valueOf())},hoe=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Lqe=({values:e,valueOffsets:t},n,r)=>foe(e,t,n,r),Mqe=({values:e,valueOffsets:t},n,r)=>{foe(e,t,n,Q6(r))},poe=(e,t,n)=>{e.type.unit===nl.DAY?fL(e,t,n):dL(e,t,n)},hL=({values:e},t,n)=>lL(e,t*2,n/1e3),pL=({values:e},t,n)=>lL(e,t*2,n),mL=({values:e},t,n)=>Nqe(e,t*2,n),gL=({values:e},t,n)=>kqe(e,t*2,n),moe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return hL(e,t,n);case vt.MILLISECOND:return pL(e,t,n);case vt.MICROSECOND:return mL(e,t,n);case vt.NANOSECOND:return gL(e,t,n)}},yL=({values:e},t,n)=>{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},goe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return yL(e,t,n);case vt.MILLISECOND:return vL(e,t,n);case vt.MICROSECOND:return _L(e,t,n);case vt.NANOSECOND:return bL(e,t,n)}},yoe=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Fqe=(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},jqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),Uqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),Vqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),zqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),Hqe=(e,t,n)=>{const r=e.type.children.map(s=>ca.getVisitFn(s.type)),i=n instanceof Map?Vqe(t,n):n instanceof Sn?Uqe(t,n):Array.isArray(n)?jqe(t,n):zqe(t,n);e.type.children.forEach((s,o)=>i(r[o],e.children[o],s,o))},Wqe=(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)},qqe=(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?wL(e,t,n):EL(e,t,n)},wL=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},EL=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},SL=({values:e},t,n)=>{e[t]=n},TL=({values:e},t,n)=>{e[t]=n},IL=({values:e},t,n)=>{e[t]=n},xL=({values:e},t,n)=>{e[t]=n},woe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return SL(e,t,n);case vt.MILLISECOND:return TL(e,t,n);case vt.MICROSECOND:return IL(e,t,n);case vt.NANOSECOND:return xL(e,t,n)}},Gqe=(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 Yqe(this[Pa],this[pm])}}class Yqe{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 Qqe=(e,t)=>864e5*e[t],AL=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Xqe=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,Jqe=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,Eoe=e=>new Date(e),Zqe=(e,t)=>Eoe(Qqe(e,t)),eGe=(e,t)=>Eoe(AL(e,t)),tGe=(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)},nGe=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<Zqe(e,t),Ioe=({values:e},t)=>eGe(e,t*2),ed=({stride:e,values:t},n)=>t[e*n],rGe=({stride:e,values:t},n)=>loe(t[e*n]),xoe=({values:e},t)=>e[t],iGe=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),sGe=({values:e,valueOffsets:t},n)=>Soe(e,t,n),oGe=({values:e,valueOffsets:t},n)=>{const r=Soe(e,t,n);return r!==null?ik(r):null},aGe=({values:e},t)=>e[t],uGe=({type:e,values:t},n)=>e.precision!==$i.HALF?t[n]:loe(t[n]),lGe=(e,t)=>e.type.unit===nl.DAY?Toe(e,t):Ioe(e,t),Coe=({values:e},t)=>1e3*AL(e,t*2),Aoe=({values:e},t)=>AL(e,t*2),Poe=({values:e},t)=>Xqe(e,t*2),Ooe=({values:e},t)=>Jqe(e,t*2),cGe=(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],fGe=(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)}},dGe=({values:e,stride:t},n)=>Z6.decimal(e.subarray(t*n,t*(n+1))),hGe=(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])},pGe=(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))},mGe=(e,t)=>new CL(e,t),gGe=(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)},yGe=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},vGe=(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],_Ge=(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)}},bGe=(e,t)=>{const{stride:n,children:r}=e,s=r[0].slice(t*n,n);return new Sn([s])};_t.prototype.visitNull=xt(tGe);_t.prototype.visitBool=xt(nGe);_t.prototype.visitInt=xt(aGe);_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(uGe);_t.prototype.visitFloat16=xt(rGe);_t.prototype.visitFloat32=xt(ed);_t.prototype.visitFloat64=xt(ed);_t.prototype.visitUtf8=xt(oGe);_t.prototype.visitBinary=xt(sGe);_t.prototype.visitFixedSizeBinary=xt(iGe);_t.prototype.visitDate=xt(lGe);_t.prototype.visitDateDay=xt(Toe);_t.prototype.visitDateMillisecond=xt(Ioe);_t.prototype.visitTimestamp=xt(cGe);_t.prototype.visitTimestampSecond=xt(Coe);_t.prototype.visitTimestampMillisecond=xt(Aoe);_t.prototype.visitTimestampMicrosecond=xt(Poe);_t.prototype.visitTimestampNanosecond=xt(Ooe);_t.prototype.visitTime=xt(fGe);_t.prototype.visitTimeSecond=xt(Roe);_t.prototype.visitTimeMillisecond=xt(Noe);_t.prototype.visitTimeMicrosecond=xt(koe);_t.prototype.visitTimeNanosecond=xt(Doe);_t.prototype.visitDecimal=xt(dGe);_t.prototype.visitList=xt(hGe);_t.prototype.visitStruct=xt(mGe);_t.prototype.visitUnion=xt(gGe);_t.prototype.visitDenseUnion=xt($oe);_t.prototype.visitSparseUnion=xt(Loe);_t.prototype.visitDictionary=xt(yGe);_t.prototype.visitInterval=xt(vGe);_t.prototype.visitIntervalDayTime=xt(Moe);_t.prototype.visitIntervalYearMonth=xt(Foe);_t.prototype.visitDuration=xt(_Ge);_t.prototype.visitDurationSecond=xt(Boe);_t.prototype.visitDurationMillisecond=xt(joe);_t.prototype.visitDurationMicrosecond=xt(Uoe);_t.prototype.visitDurationNanosecond=xt(Voe);_t.prototype.visitFixedSizeList=xt(bGe);_t.prototype.visitMap=xt(pGe);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 EGe)}[Symbol.iterator](){return new wGe(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 wGe{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 EGe{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?dqe(e,n):!1:e instanceof Map?TGe(e):Array.isArray(e)?SGe(e):e instanceof Sn?IGe(e):xGe(e,!0)}function SGe(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 CGe(e,n);case Map:return kz(e,n,n.keys());case jC:case CL:case Object:case void 0:return kz(e,n,t||Object.keys(n))}return n instanceof Sn?AGe(e,n):!1}}function CGe(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 PL(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 PL{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 ok(e,t,i)+ok(e,r,n)+OGe(e,i>>3,r-i>>3)}function OGe(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+=XO(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=XO(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=XO(s.getUint8(i)),i+=1;return r}function XO(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 RGe=-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<=RGe&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-ok(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 NGe=new Fy;function Ji(e){return NGe.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 OL(e,t,n,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function DGe(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new PL(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 DGe(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 $Ge(o)})}class $Ge{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 MGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),FGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),BGe=({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(LGe,0);td.prototype.visitUtf8=MGe;td.prototype.visitBinary=FGe;td.prototype.visitList=BGe;td.prototype.visitFixedSizeList=jGe;td.prototype.visitUnion=UGe;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=>RL(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 NL.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(RL)},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 VGe(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 V6=new WeakMap,wHe=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),EHe=function(){function e(t,n){this.callback=t,this.observer=n}return e}();function SHe(e){return V6.get(e)}function THe(e,t){return e.observers.get(t)}function IHe(e,t){e.observers.delete(t.callback)}function xHe(e,t){t.unobserve()}function CHe(e,t){var n=[],r,i=SHe(e);if(!i)i=new wHe(e),V6.set(e,i);else{var s=THe(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(){JN(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(){JN(r),clearTimeout(r.next),IHe(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 EHe(t,r)),r}function JN(e,t){t===void 0&&(t=!1);var n=V6.get(e.object);z6(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 z6(e,t,n,r,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=KN(t),o=KN(e),a=!1,u=o.length-1;u>=0;u--){var l=o[u],c=e[l];if(YN(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)?z6(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 PHe(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(PHe(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=Zze({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 OHe(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=OHe(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 RHe(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}`}}sHe();function NHe(e){return e.length===2?dHe(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:NHe(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 kHe="Expected a function",gz=NaN,DHe="[object Symbol]",$He=/^\s+|\s+$/g,LHe=/^[-+]0x[0-9a-f]+$/i,MHe=/^0b[01]+$/i,FHe=/^0o[0-7]+$/i,BHe=parseInt,jHe=typeof _o=="object"&&_o&&_o.Object===Object&&_o,UHe=typeof self=="object"&&self&&self.Object===Object&&self,VHe=jHe||UHe||Function("return this")(),zHe=Object.prototype,HHe=zHe.toString,WHe=Math.max,qHe=Math.min,zO=function(){return VHe.Date.now()};function GHe(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(kHe);t=yz(t)||0,ZN(n)&&(c=!!n.leading,f="maxWait"in n,s=f?WHe(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?qHe(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=zO();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(zO())}function T(){var E=zO(),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 ZN(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function YHe(e){return!!e&&typeof e=="object"}function KHe(e){return typeof e=="symbol"||YHe(e)&&HHe.call(e)==DHe}function yz(e){if(typeof e=="number")return e;if(KHe(e))return gz;if(ZN(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ZN(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace($He,"");var n=MHe.test(e);return n||FHe.test(e)?BHe(e.slice(2),n?2:8):LHe.test(e)?gz:+e}var QHe=GHe;const ou=eu(QHe);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?$6("%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 XHe=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 JHe=Object.freeze(Object.defineProperty({__proto__:null,YAxis:use},Symbol.toStringTag,{value:"Module"})),Yi={top:30,left:40,right:80,bottom:50};function ek({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:IVe(J,V=>V[e.y_var]),upperq:P7(J,.75,V=>V[e.y_var]),lowerq:P7(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 P6(E6).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-3,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 ZHe=Object.freeze(Object.defineProperty({__proto__:null,LineChart:ek,default:ek},Symbol.toStringTag,{value:"Module"})),sp={top:0,left:0,right:0,bottom:0},vz=20,HO=60;function tk({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,HO+sp.left]).domain(a):kv([sp.left,HO+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 P6(E6).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:`${HO}`,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 eWe=Object.freeze(Object.defineProperty({__proto__:null,Sidebar:tk,default:tk},Symbol.toStringTag,{value:"Module"}));function nk({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 $6("%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 tWe=Object.freeze(Object.defineProperty({__proto__:null,RangeSelector:nk,default:nk},Symbol.toStringTag,{value:"Module"}));function rk({guardrail:e,setGuardrail:t,dataname:n,setDataname:r,setSelection:i}){return C.jsxs(C.Fragment,{children:[C.jsx(rt,{children:"Data:"}),C.jsx(JR,{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(JR,{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 nWe=Object.freeze(Object.defineProperty({__proto__:null,Selector:rk,default:rk},Symbol.toStringTag,{value:"Module"})),En=Array.isArray;function io(e){return e!=null?En(e)?e:[e]:[]}function rWe(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(rWe(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)}},sWe=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]()}},oWe=function(e){return e&&sr(e.get)?e:new sWe(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 aWe(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)?uWe(e,t):sr(e[Symbol.iterator])?lWe(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 uWe(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),dWe={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 hWe(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,pWe=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 pWe(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 mWe=/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/;function gWe(e){return e.match(mWe)&&!isNaN(Date.parse(e))}function yWe(e,t=Date.parse){return gWe(e)?t(e):e}const dse=6e4,hse=864e5,pse=6048e5,xr=new Date,Ar=new Date,Dr=e=>(xr.setTime(typeof e=="string"?yWe(e):e),xr);function vWe(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 _We(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 bWe(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 wWe(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 EWe(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 SWe(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 TWe={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:vWe,dayofyear:bWe,week:EWe,utcdatetime:_We,utcdayofyear:wWe,utcweek:SWe,now:Date.now};function H6(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)?IWe(e,t):!1}function IWe(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 CWe=Math.random;function Ng(){return CWe()}const AWe={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 W6(e){return e instanceof Map}function PWe(e){return e instanceof Set}function Vw(e){return W6(e)||PWe(e)}function WO(e){return Array.from(e)}const OWe={has:(e,t)=>Vw(e)?e.has(t):e!=null?Ya(e,t):!1,keys:e=>W6(e)?WO(e.keys()):e!=null?Object.keys(e):[],values:e=>Vw(e)?WO(e.values()):e!=null?Object.values(e):[],entries:e=>Vw(e)?WO(e.entries()):e!=null?Object.entries(e):[],object:e=>e?Object.fromEntries(e):yn};function RWe(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 NWe(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:hWe,equal:H6,recode:RWe,sequence:NWe,...dWe,...TWe,...xWe,...AWe,...OWe,...kWe};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 DWe(e,io(t),io(n))}let DWe=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 $We(e,t){e=Vw(e)?e:new Set(e);let n=t,r=0;for(;e.has(n);)n=t+ ++r;return n}function LWe(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 MWe(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 FWe(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=$We(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 BWe="ArrayPattern",jWe="ArrowFunctionExpression",UWe="FunctionExpression",vf="Identifier",kg="Literal",Ese="MemberExpression",VWe="ObjectExpression",Sse="ObjectPattern",Tse="Property",i1="Column",zWe="Constant",HWe="Dictionary",WWe="Function",qWe="Parameter",Ise="Op",Kn=(e,t)=>{const n=GWe[e.type];return n?n(e,t):Wt(`Unsupported expression construct: ${e.type}`)},qO=(e,t)=>"("+Kn(e.left,t)+" "+e.operator+" "+Kn(e.right,t)+")",GO=(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})`},GWe={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:qO,BinaryExpression:qO,LogicalExpression:qO,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:GO,FunctionExpression:GO,FunctionDeclaration:GO,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 YWe(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 QWe(){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 XWe(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=QWe(),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,XWe(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=>YWe(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=JWe(r,i,r.index))>=0?t=r.value(n,i):(n=r.size,t=e)}},param:[1,1]}};function JWe(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)},ZWe={"==":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=ZWe[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&&eqe(i,e,s,r.keyFor(s.value))}return e}function eqe(e,t,n,r){return r<0?(e.type=kg,e.value=!1,e.raw="false"):(t.type=HWe,n.value=r,n.raw=r+""),!0}function MC(e){return En(e)?e:W6(e)?e.entries():e?Object.entries(e):[]}const kse="row_object";function Dse(e,t){e.type=VWe;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 Y6.expr($se(e))}function K6(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 YO(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 tqe=new TextDecoder("utf-8"),ik=e=>tqe.decode(e),nqe=new TextEncoder,Q6=e=>nqe.encode(e),rqe=e=>typeof e=="boolean",Ls=e=>typeof e=="function",Zf=e=>e!=null&&Object(e)===e,FC=e=>Zf(e)&&Ls(e.then),X6=e=>Zf(e)&&Ls(e[Symbol.iterator]),BC=e=>Zf(e)&&Ls(e[Symbol.asyncIterator]),iqe=e=>Zf(e)&&"done"in e&&"value"in e,Mse=e=>"_getDOMStream"in e&&"_getNodeStream"in e,sqe=e=>Zf(e)&&Ls(e.abort)&&Ls(e.getWriter)&&!Mse(e),oqe=e=>Zf(e)&&Ls(e.end)&&Ls(e.write)&&rqe(e.writable)&&!Mse(e),aqe=e=>Zf(e)&&Ls(e.clear)&&Ls(e.bytes)&&Ls(e.position)&&Ls(e.setPosition)&&Ls(e.capacity)&&Ls(e.getBufferIdentifier)&&Ls(e.createLong),J6=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function uqe(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),sk=e=>(e.next(),e);function*lqe(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof J6?n(t):X6(t)?t:n(t);return yield*sk(function*(i){let s=null;do s=i.next(yield fi(e,s));while(!s.done)}(r[Symbol.iterator]())),new e}const cqe=e=>lqe(Uint8Array,e);function Fse(e,t){return Fd(this,arguments,function*(){if(FC(t))return yield un(yield un(yield*YO(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*YO(My(sk(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 J6?r(t):X6(t)?i(t):BC(t)?t:r(t);return yield un(yield*YO(My(sk(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 fqe=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*hqe(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=cqe(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 KO=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function yqe(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]=KO(e,"end"),n[1]=KO(e,"error");do{if(n[2]=KO(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 vqe=void 0;function vh(e){if(e===null)return"null";if(e===vqe)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 _qe=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[_qe]=!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 bqe(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 QO(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return QO(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 QO(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 eL extends ws{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class tL extends ws{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Nf extends ws{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class nL extends ws{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}class rL extends ws{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}class iL extends ws{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class sL extends ws{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class oL extends ws{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}Object.defineProperty(eL.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(tL.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Nf.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(nL.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(rL.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(iL.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(sL.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(oL.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 aL extends kf{constructor(){super($i.SINGLE)}}class uL extends kf{constructor(){super($i.DOUBLE)}}Object.defineProperty(aoe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(aL.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(uL.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 wqe extends Xm{constructor(){super(nl.DAY)}}class Eqe 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 Sqe extends Zl{constructor(){super(vt.SECOND,32)}}class Tqe extends Zl{constructor(){super(vt.MILLISECOND,32)}}class Iqe extends Zl{constructor(){super(vt.MICROSECOND,64)}}class xqe 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 Cqe extends Jm{constructor(){super(rl.DAY_TIME)}}class Aqe 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 Pqe=(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?Pqe():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 Oqe(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 Oqe(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 Rqe=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},lL=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},Nqe=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},kqe=(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},cL=({values:e},t,n)=>{e[t]=n},doe=({values:e},t,n)=>{e[t]=coe(n)},$qe=(e,t,n)=>{switch(e.type.precision){case $i.HALF:return doe(e,t,n);case $i.SINGLE:case $i.DOUBLE:return cL(e,t,n)}},fL=({values:e},t,n)=>{Rqe(e,t,n.valueOf())},dL=({values:e},t,n)=>{lL(e,t*2,n.valueOf())},hoe=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Lqe=({values:e,valueOffsets:t},n,r)=>foe(e,t,n,r),Mqe=({values:e,valueOffsets:t},n,r)=>{foe(e,t,n,Q6(r))},poe=(e,t,n)=>{e.type.unit===nl.DAY?fL(e,t,n):dL(e,t,n)},hL=({values:e},t,n)=>lL(e,t*2,n/1e3),pL=({values:e},t,n)=>lL(e,t*2,n),mL=({values:e},t,n)=>Nqe(e,t*2,n),gL=({values:e},t,n)=>kqe(e,t*2,n),moe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return hL(e,t,n);case vt.MILLISECOND:return pL(e,t,n);case vt.MICROSECOND:return mL(e,t,n);case vt.NANOSECOND:return gL(e,t,n)}},yL=({values:e},t,n)=>{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},goe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return yL(e,t,n);case vt.MILLISECOND:return vL(e,t,n);case vt.MICROSECOND:return _L(e,t,n);case vt.NANOSECOND:return bL(e,t,n)}},yoe=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Fqe=(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},jqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),Uqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),Vqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),zqe=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),Hqe=(e,t,n)=>{const r=e.type.children.map(s=>ca.getVisitFn(s.type)),i=n instanceof Map?Vqe(t,n):n instanceof Sn?Uqe(t,n):Array.isArray(n)?jqe(t,n):zqe(t,n);e.type.children.forEach((s,o)=>i(r[o],e.children[o],s,o))},Wqe=(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)},qqe=(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?wL(e,t,n):EL(e,t,n)},wL=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},EL=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},SL=({values:e},t,n)=>{e[t]=n},TL=({values:e},t,n)=>{e[t]=n},IL=({values:e},t,n)=>{e[t]=n},xL=({values:e},t,n)=>{e[t]=n},woe=(e,t,n)=>{switch(e.type.unit){case vt.SECOND:return SL(e,t,n);case vt.MILLISECOND:return TL(e,t,n);case vt.MICROSECOND:return IL(e,t,n);case vt.NANOSECOND:return xL(e,t,n)}},Gqe=(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 Yqe(this[Pa],this[pm])}}class Yqe{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 Qqe=(e,t)=>864e5*e[t],AL=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Xqe=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,Jqe=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,Eoe=e=>new Date(e),Zqe=(e,t)=>Eoe(Qqe(e,t)),eGe=(e,t)=>Eoe(AL(e,t)),tGe=(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)},nGe=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<Zqe(e,t),Ioe=({values:e},t)=>eGe(e,t*2),ed=({stride:e,values:t},n)=>t[e*n],rGe=({stride:e,values:t},n)=>loe(t[e*n]),xoe=({values:e},t)=>e[t],iGe=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),sGe=({values:e,valueOffsets:t},n)=>Soe(e,t,n),oGe=({values:e,valueOffsets:t},n)=>{const r=Soe(e,t,n);return r!==null?ik(r):null},aGe=({values:e},t)=>e[t],uGe=({type:e,values:t},n)=>e.precision!==$i.HALF?t[n]:loe(t[n]),lGe=(e,t)=>e.type.unit===nl.DAY?Toe(e,t):Ioe(e,t),Coe=({values:e},t)=>1e3*AL(e,t*2),Aoe=({values:e},t)=>AL(e,t*2),Poe=({values:e},t)=>Xqe(e,t*2),Ooe=({values:e},t)=>Jqe(e,t*2),cGe=(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],fGe=(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)}},dGe=({values:e,stride:t},n)=>Z6.decimal(e.subarray(t*n,t*(n+1))),hGe=(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])},pGe=(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))},mGe=(e,t)=>new CL(e,t),gGe=(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)},yGe=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},vGe=(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],_Ge=(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)}},bGe=(e,t)=>{const{stride:n,children:r}=e,s=r[0].slice(t*n,n);return new Sn([s])};_t.prototype.visitNull=xt(tGe);_t.prototype.visitBool=xt(nGe);_t.prototype.visitInt=xt(aGe);_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(uGe);_t.prototype.visitFloat16=xt(rGe);_t.prototype.visitFloat32=xt(ed);_t.prototype.visitFloat64=xt(ed);_t.prototype.visitUtf8=xt(oGe);_t.prototype.visitBinary=xt(sGe);_t.prototype.visitFixedSizeBinary=xt(iGe);_t.prototype.visitDate=xt(lGe);_t.prototype.visitDateDay=xt(Toe);_t.prototype.visitDateMillisecond=xt(Ioe);_t.prototype.visitTimestamp=xt(cGe);_t.prototype.visitTimestampSecond=xt(Coe);_t.prototype.visitTimestampMillisecond=xt(Aoe);_t.prototype.visitTimestampMicrosecond=xt(Poe);_t.prototype.visitTimestampNanosecond=xt(Ooe);_t.prototype.visitTime=xt(fGe);_t.prototype.visitTimeSecond=xt(Roe);_t.prototype.visitTimeMillisecond=xt(Noe);_t.prototype.visitTimeMicrosecond=xt(koe);_t.prototype.visitTimeNanosecond=xt(Doe);_t.prototype.visitDecimal=xt(dGe);_t.prototype.visitList=xt(hGe);_t.prototype.visitStruct=xt(mGe);_t.prototype.visitUnion=xt(gGe);_t.prototype.visitDenseUnion=xt($oe);_t.prototype.visitSparseUnion=xt(Loe);_t.prototype.visitDictionary=xt(yGe);_t.prototype.visitInterval=xt(vGe);_t.prototype.visitIntervalDayTime=xt(Moe);_t.prototype.visitIntervalYearMonth=xt(Foe);_t.prototype.visitDuration=xt(_Ge);_t.prototype.visitDurationSecond=xt(Boe);_t.prototype.visitDurationMillisecond=xt(joe);_t.prototype.visitDurationMicrosecond=xt(Uoe);_t.prototype.visitDurationNanosecond=xt(Voe);_t.prototype.visitFixedSizeList=xt(bGe);_t.prototype.visitMap=xt(pGe);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 EGe)}[Symbol.iterator](){return new wGe(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 wGe{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 EGe{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?dqe(e,n):!1:e instanceof Map?TGe(e):Array.isArray(e)?SGe(e):e instanceof Sn?IGe(e):xGe(e,!0)}function SGe(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 CGe(e,n);case Map:return kz(e,n,n.keys());case jC:case CL:case Object:case void 0:return kz(e,n,t||Object.keys(n))}return n instanceof Sn?AGe(e,n):!1}}function CGe(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 PL(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 PL{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 ok(e,t,i)+ok(e,r,n)+OGe(e,i>>3,r-i>>3)}function OGe(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+=XO(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=XO(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=XO(s.getUint8(i)),i+=1;return r}function XO(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 RGe=-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<=RGe&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-ok(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 NGe=new Fy;function Ji(e){return NGe.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 OL(e,t,n,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function DGe(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new PL(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 DGe(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 $Ge(o)})}class $Ge{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 MGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),FGe=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),BGe=({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(LGe,0);td.prototype.visitUtf8=MGe;td.prototype.visitBinary=FGe;td.prototype.visitList=BGe;td.prototype.visitFixedSizeList=jGe;td.prototype.visitUnion=UGe;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=>RL(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 NL.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(RL)},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 VGe(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 ${zGe(r)}:`).join("")} return false; @@ -223,7 +223,7 @@ Note: ${Rue}. ${Nue}, or ${GQe}.`,kue=` Note: ${Rue}. ${Nue}, or ${YQe}.`,QQe=`The ${kse} method is not valid in multi-table expressions.`;function XQe(e,t){const n=JQe(t);let r=e.root=n;return e.spec=t,e.tuple=null,e.tuple1=null,e.tuple2=null,e.$param=null,e.$op=0,e.scope=new Set,e.paramsRef=new Map,e.columnRef=new Map,WKe(r)?(eXe(r,e),r=r.body):e.join?(e.scope.add(e.tuple1=DQe),e.scope.add(e.tuple2=$Qe),e.scope.add(e.$param=tH)):(e.scope.add(e.tuple=kQe),e.scope.add(e.$param=tH)),pn(r,e,iM),e.root}function JQe(e){try{const t=e.field?ZQe(e):En(e)?el(e):e;return RQe(`expr=(${t})`,NQe).body[0].expression.right}catch{Wt(`Expression parse error: ${e+""}`)}}function ZQe(e){const t=JSON.stringify(e+"");return e.table?`(a,b)=>b[${t}]`:`d=>d[${t}]`}const iM={FunctionDeclaration:Ai("Function definitions"),ForStatement:Ai("For loops"),ForOfStatement:Ai("For-of loops"),ForInStatement:Ai("For-in loops"),WhileStatement:Ai("While loops"),DoWhileStatement:Ai("Do-while loops"),AwaitExpression:Ai("Await expressions"),ArrowFunctionExpression:Ai("Function definitions"),AssignmentExpression:Ai("Assignments"),FunctionExpression:Ai("Function definitions"),NewExpression:Ai('Use of "new"'),UpdateExpression:Ai("Update expressions"),VariableDeclarator(e,t){Ek(e.id,t)},Identifier(e,t,n){Lue(e,t,n)&&!t.scope.has(e.name)&&t.error(e,zQe,KQe)},CallExpression(e,t){const n=Due(e.callee),r=Ose(n)||Rse(n);if(r){if((t.join||t.aggregate===!1)&&q6(n)&&LQe(e,t),(t.join||t.window===!1)&&G6(n)&&MQe(e,t),t.$op=1,t.ast)wk(e,n,t),e.arguments.forEach(i=>pn(i,t,bk));else{const i=t.op(tXe(t,r,n,e.arguments));Object.assign(e,{type:Ise,name:i.id})}return t.$op=0,!1}else Pse(n)?wk(e,n,t):t.error(e,Oue,kue)},MemberExpression(e,t,n){const{object:r,property:i}=e;if(!ti(vf,r))return;const{name:s}=r;if($ue(e)&&ti(vf,i)&&Ya(nM,i.name)){Bue(e,i.name);return}const o=s===t.tuple?0:s===t.tuple1?1:s===t.tuple2?2:-1;if(o>=0)return nH(e,o,t,Mue,n);if(s===t.$param)return nH(e,o,t,rXe);t.paramsRef.has(s)?Wv(e,t.paramsRef.get(s)):t.columnRef.has(s)?Fue(r,s,t,e):Ya(t.params,s)&&Wv(r,s)}};function nH(e,t,n,r,i){const{property:s,computed:o}=e;let a;if(!o)a=s.name;else if(ti(kg,s))a=s.value;else try{pn(s,n,iM,e),a=n.param(s)}catch{n.error(e,jQe)}return r(e,a,t,n,i),!1}const bk={...iM,VariableDeclarator:Ai("Variable declaration in operator call"),Identifier(e,t,n){Lue(e,t,n)&&t.error(e,HQe)},CallExpression(e,t){const n=Due(e.callee);Pse(n)?wk(e,n,t):t.error(e,Oue,kue)}};function eXe(e,t){e.generator&&Ai("Generator functions")(e,t),e.async&&Ai("Async functions")(e,t);const{params:n}=e,r=n.length,i=o=>(a,u)=>t.columnRef.set(a,[u,o]),s=(o,a)=>t.paramsRef.set(o,a);r&&(t.join?(D0(t,n[0],"tuple1",i(1)),r>1&&D0(t,n[1],"tuple2",i(2)),r>2&&D0(t,n[2],"$param",s)):(D0(t,n[0],"tuple",i(0)),r>1&&D0(t,n[1],"$param",s))),t.root=e.body}function D0(e,t,n,r){ti(vf,t)?(e.scope.add(t.name),e[n]=t.name):ti(Sse,t)&&t.properties.forEach(i=>{const s=ti(vf,i.key)?i.key.name:ti(kg,i.key)?i.key.value:e.error(i,FQe);ti(vf,i.value)||e.error(i.value,qQe),r(i.value.name,s)})}function tXe(e,t,n,r){const i=[],s=[],o=t.param[0]||0,a=o+(t.param[1]||0);return r.forEach((u,l)=>{l0?r.join[n-1]:null,o=s&&s.column(t);s&&!o&&r.error(e,rM),r.aggronly&&!r.$op&&r.error(e,BQe),Nse(e,t,n,o,i)}function Fue(e,t,n,r){const[i,s]=n.columnRef.get(t);Mue(e,i,s,n,r)}function rXe(e,t,n,r){r.params&&!Ya(r.params,t)&&r.error(e,VQe),Wv(e,t)}function Wv(e,t){e.type=qWe,e.name=t}function Bue(e,t){e.type=zWe,e.name=t,e.raw=nM[t]}function wk(e,t,n){if(t===kse){const r=n.table;r||n.error(e,QQe),Dse(e,e.arguments.length?e.arguments.map(i=>{const s=n.param(i),o=bs(s)?r.columnName(s):s;return r.column(o)||n.error(i,rM),o}):r.columnNames())}else e.callee={type:WWe,name:t}}function Ek(e,t){ti(vf,e)?t.scope.add(e.name):ti(BWe,e)?e.elements.forEach(n=>Ek(n,t)):ti(Sse,e)?e.properties.forEach(n=>Ek(n.value,t)):t.error(e.id,WQe)}const iXe={[i1]:1,[Ise]:1};function ao(e,t={}){const n=t.generate||iI,r=t.compiler||Y6,i=oXe(t),s={},o={},a=[],u=[];let l=0,c=-1;const f=t.join?r.join:t.index==1?r.expr2:r.expr,d={op(m){const y=sXe(m);return o[y]||(m.id=++c,o[y]=m)},field(m){const y=n(m);return s[y]||(s[y]=++l)},param(m){return ti(kg,m)?m.value:r.param(n(m),i)},value(m,y){a.push(m);const g=y.escape||(t.ast?HKe(y):f(n(y),i));u.push(g),iXe[y.type]&&g!==y&&as(g)&&(g.field=y.name)},error(m,y,g=""){const v=m.start-6,b=m.end-6,S=String(d.spec).slice(v,b);Wt(`${y}: "${S}"${g}`)}};Object.assign(d,t,{params:i});for(const[m,y]of MC(e))d.value(m+"",y.escape?YKe(d,y,i):XQe(d,y));if(t.ast)return{names:a,exprs:u};const h=[];for(const m in s)h[s[m]]=r.expr(m,i);const p=Object.values(o);return p.forEach(m=>m.fields=m.fields.map(y=>h[y])),{names:a,exprs:u,ops:p}}function sXe(e){let t=`${e.name}(${e.fields.concat(e.params).join(",")})`;if(e.frame){const n=e.frame.map(r=>Number.isFinite(r)?Math.abs(r):-1);t+=`[${n},${!!e.peers}]`}return t}function oXe(e){return(e.table?u2(e.table):e.join?{...u2(e.join[1]),...u2(e.join[0])}:{})||{}}function u2(e){return e&&sr(e.params)?e.params():{}}const jue="Expr",xa="ExprList",Uue="ExprNumber",ry="ExprObject",jp="JoinKeys",CI="JoinValues",Vo="Options",sM="OrderKeys",Nc="SelectionList",Ad="TableRef",Up="TableRefList",aXe="Descending",uXe="Query",lXe="Selection",cXe="Verb",fXe="Window";function tA(e,t){return e&&e.expr?new rH({...e,...t}):new rH(t,e)}class rH{constructor(t,n){this.expr=n,Object.assign(this,t)}toString(){return String(this.expr)}toObject(){return{...this,expr:this.toString(),...sr(this.expr)?{func:!0}:{}}}}function dXe(e){return tA(e,{desc:!0})}function _h(e,t,n=0){const r=n?{field:!0,table:n}:{field:!0};return tA(e,t?{expr:t,...r}:r)}function hXe(e,t,n){return tA(e,{window:{frame:t||[-1/0,0],peers:!!n}})}function pXe(e){const t=n=>n;return t.toString=()=>e,t}function iH(e,t){return t=t&&sr(t.query)?t.query():t,t&&sr(t.evaluate)?t.evaluate(null,e):e(t)}function Vue(e){return as(e)&&(En(e.all)||En(e.matches)||En(e.not)||En(e.range))}function qv(e){return e&&sr(e.toObject)?e.toObject():sr(e)?{expr:String(e),func:!0}:En(e)?e.map(qv):as(e)?KC(e,t=>qv(t)):e}function oM(e){return En(e)?e.map(oM):as(e)?En(e.verbs)?uM.from(e):En(e.all)?rg():En(e.range)?BKe(...e.range):En(e.match)?jKe(RegExp(...e.match)):En(e.not)?qae(e.not.map(qv)):mXe(e):e}function mXe(e){let t=e,n=e.expr;if(n!=null){if(e.field===!0?t=n=_h(n):e.func===!0&&(t=n=pXe(n)),as(e.window)){const{frame:r,peers:i}=e.window;t=n=hXe(n,r,i)}e.desc===!0&&(t=dXe(n))}return e===t?KC(e,r=>oM(r)):t}function gXe(e){return En(e)?e.map(yXe):e}function yXe(e){const t=[];return io(e).forEach(n=>{bs(n)?t.push(n):Ui(n)?t.push(_h(n,null)):as(n)&&n.expr||sr(n)?t.push(n):Wt(`Invalid key value: ${n+""}`)}),t}function vXe(e){return En(e)?e.map(_Xe):e}function _Xe(e,t){return t<2?io(e):e}function bXe(e){const t=[];return e.forEach(n=>{const r=n.expr!=null?n.expr:n;if(as(r)&&!sr(r))for(const i in r)t.push(r[i]);else n=bs(r)?r:Ui(r)?_h(n):sr(r)?n:Wt(`Invalid orderby field: ${n+""}`),t.push(n)}),t}const wXe={[jue]:que,[xa]:sg,[Uue]:CXe,[ry]:Uf,[jp]:AXe,[CI]:PXe,[sM]:sg,[Nc]:IXe};function EXe(e,t,n){return t===Ad?sH(e):t===Up?e.map(sH):zue(qv(e),t,n)}function zue(e,t,n){return t===Vo?e&&SXe(e,n):wXe[t](e)}function SXe(e,t={}){const n={};for(const r in e){const i=e[r];n[r]=t[r]?zue(i,t[r]):i}return n}function TXe(e,t){return ao({expr:e},{...t,ast:!0}).exprs[0]}function aM(e){return{type:i1,name:e}}function Hue(e){return{type:i1,index:e}}function Uf(e,t){if(Ui(e))return TXe(e,t);if(e.expr){let n;if(e.field===!0?n=aM(e.expr):e.func===!0&&(n=Uf(e.expr,t)),n)return e.desc&&(n={type:aXe,expr:n}),e.window&&(n={type:fXe,expr:n,...e.window}),n}return Object.keys(e).map(n=>({...Uf(e[n],t),as:n}))}function Wue(e){const t=lXe;return e.all?{type:t,operator:"all"}:e.not?{type:t,operator:"not",arguments:sg(e.not)}:e.range?{type:t,operator:"range",arguments:sg(e.range)}:e.matches?{type:t,operator:"matches",arguments:e.matches}:Wt("Invalid input")}function IXe(e){return io(e).map(xXe).flat()}function xXe(e){return Vue(e)?Wue(e):bs(e)?Hue(e):Ui(e)?aM(e):as(e)?Object.keys(e).map(t=>({type:i1,name:t,as:e[t]})):Wt("Invalid input")}function que(e){return Vue(e)?Wue(e):bs(e)?Hue(e):Ui(e)?aM(e):as(e)?Uf(e):Wt("Invalid input")}function sg(e){return io(e).map(que).flat()}function CXe(e){return bs(e)?e:Uf(e)}function AXe(e){return En(e)?e.map(sg):Uf(e,{join:!0})}function PXe(e){return En(e)?e.map((t,n)=>n<2?sg(t):Uf(t,{join:!0})):Uf(e,{join:!0})}function sH(e){return e&&sr(e.toAST)?e.toAST():e}class Gue{constructor(t,n=[],r=[]){this.verb=t,this.schema=n,n.forEach((i,s)=>{const o=i.type,a=r[s],u=o===jp?gXe(a):o===CI?vXe(a):o===sM?bXe(a):a;this[i.name]=u!==void 0?u:i.default})}static from(t){const n=Sk[t.verb],r=(n.schema||[]).map(({name:i})=>oM(t[i]));return n(...r)}evaluate(t,n){const r=this.schema.map(({name:i,type:s})=>{const o=this[i];return s===Ad?iH(n,o):s===Up?o.map(a=>iH(n,a)):o});return t[this.verb](...r)}toObject(){const t={verb:this.verb};return this.schema.forEach(({name:n})=>{t[n]=qv(this[n])}),t}toAST(){const t={type:cXe,verb:this.verb};return this.schema.forEach(({name:n,type:r,props:i})=>{t[n]=EXe(this[n],r,i)}),t}}function zn(e,t){return Object.assign((...n)=>new Gue(e,t,n),{schema:t})}const Sk={count:zn("count",[{name:"options",type:Vo}]),derive:zn("derive",[{name:"values",type:ry},{name:"options",type:Vo,props:{before:Nc,after:Nc}}]),filter:zn("filter",[{name:"criteria",type:ry}]),groupby:zn("groupby",[{name:"keys",type:xa}]),orderby:zn("orderby",[{name:"keys",type:sM}]),relocate:zn("relocate",[{name:"columns",type:Nc},{name:"options",type:Vo,props:{before:Nc,after:Nc}}]),rename:zn("rename",[{name:"columns",type:Nc}]),rollup:zn("rollup",[{name:"values",type:ry}]),sample:zn("sample",[{name:"size",type:Uue},{name:"options",type:Vo,props:{weight:jue}}]),select:zn("select",[{name:"columns",type:Nc}]),ungroup:zn("ungroup"),unorder:zn("unorder"),reify:zn("reify"),dedupe:zn("dedupe",[{name:"keys",type:xa,default:[]}]),impute:zn("impute",[{name:"values",type:ry},{name:"options",type:Vo,props:{expand:xa}}]),fold:zn("fold",[{name:"values",type:xa},{name:"options",type:Vo}]),pivot:zn("pivot",[{name:"keys",type:xa},{name:"values",type:xa},{name:"options",type:Vo}]),spread:zn("spread",[{name:"values",type:xa},{name:"options",type:Vo}]),unroll:zn("unroll",[{name:"values",type:xa},{name:"options",type:Vo,props:{drop:xa}}]),lookup:zn("lookup",[{name:"table",type:Ad},{name:"on",type:jp},{name:"values",type:xa}]),join:zn("join",[{name:"table",type:Ad},{name:"on",type:jp},{name:"values",type:CI},{name:"options",type:Vo}]),cross:zn("cross",[{name:"table",type:Ad},{name:"values",type:CI},{name:"options",type:Vo}]),semijoin:zn("semijoin",[{name:"table",type:Ad},{name:"on",type:jp}]),antijoin:zn("antijoin",[{name:"table",type:Ad},{name:"on",type:jp}]),concat:zn("concat",[{name:"tables",type:Up}]),union:zn("union",[{name:"tables",type:Up}]),intersect:zn("intersect",[{name:"tables",type:Up}]),except:zn("except",[{name:"tables",type:Up}])};let uM=class Yue extends lse{constructor(t,n,r){super(n),this._verbs=t||[],this._table=r}static from({verbs:t,table:n,params:r}){return new Yue(t.map(Gue.from),r,n)}get[Symbol.toStringTag](){return this._verbs?`Query: ${this._verbs.length} verbs`+(this._table?` on '${this._table}'`:""):"Object"}get length(){return this._verbs.length}get tableName(){return this._table}params(t){return arguments.length?(this._params={...this._params,...t},this):this._params}evaluate(t,n){t=t||n(this._table);for(const r of this._verbs)t=r.evaluate(t.params(this._params),n);return t}toObject(){return oH(this,"toObject")}toJSON(){return this.toObject()}toAST(){return oH(this,"toAST",{type:uXe})}};function oH(e,t,n){return{...n,verbs:e._verbs.map(r=>r[t]()),...e._params?{params:e._params}:null,...e._table?{table:e._table}:null}}function OXe(e,t){return new uM(e._verbs.concat(t),e._params,e._table)}for(const e in Sk){const t=Sk[e];uM.prototype["__"+e]=function(n,...r){return OXe(n,t(...r))}}function Ug(e,t,...n){const r=["_","$"],i=r.slice(0,n.length);return i.push('"use strict"; const '+n.map((s,o)=>s.map((a,u)=>`${r[o]}${u} = ${r[o]}[${u}]`).join(", ")).join(", ")+`; return (${e}) => ${t};`),Function(...i)(...n)}function RXe(e,t=[]){return e.groupby(t.length?t:e.columnNames()).filter("row_number() === 1").ungroup().reify()}function lM(e,t){const n=Mo();return t.forEach((r,i)=>{const s=Ui(r)?r:i;if(s){const o=e.column(i)||Wt(`Unrecognized column: ${i}`);n.add(s,o)}}),e.create(n)}function Kue(e,t,{before:n,after:r}={}){const i=n!=null,s=r!=null;i||s||Wt("relocate requires a before or after option."),i&&s&&Wt("relocate accepts only one of the before or after options."),t=ec(e,t);const o=[...ec(e,i?n:r).keys()],a=i?o[0]:o.pop(),u=new Map;return e.columnNames().forEach(l=>{const c=!t.has(l);if(l===a){s&&c&&u.set(l,l);for(const[f,d]of t)u.set(f,d);if(s)return}c&&u.set(l,l)}),lM(e,u)}function h1(e,t=r=>r,n=""){const r=e.length;if(!r)return"";let i=t(e[0],0);for(let s=1;st?1:e>=t?0:NaN}function NXe(e,t=0,n=e.length){let r=n?e[t++]:yn;for(let i=t;ie[i]&&(r=e[i]);return r}function kXe(e,t=0,n=e.length){let r=n?e[t++]:yn;for(let i=t;i=1)return zb(e[n-1]);const r=(n-1)*t,i=Math.floor(r),s=zb(e[i]);return Lv(s)?s:s+(zb(e[i+1])-s)*(r-i)}class $Xe{constructor(t){this._values=t||[],this._sorted=null,this._start=0}values(t){return this._start&&(this._values=this._values.slice(this._start),this._start=0),t?this._values.slice():this._values}add(t){this._values.push(t),this._sorted=null}rem(){this._start+=1,this._sorted=null}min(){return this._sorted&&this._sorted.length?this._sorted[0]:NXe(this._values,this._start)}max(){return this._sorted&&this._sorted.length?this._sorted[this._sorted.length-1]:kXe(this._values,this._start)}quantile(t){return this._sorted||(this._sorted=this.values(!0),this._sorted.sort(cM)),DXe(this._sorted,t)}}const AI=(e,t,n)=>Ug(t,"{"+h1(e,(r,i)=>`_${i}.${n}(${t});`)+"}",e);function LXe(e,t){const{ops:n,output:r}=MXe(e,t),i=e[0].fields,s=i.length,o=s===0?fM:s===1?FXe:s===2?BXe:Wt("Unsupported field count: "+s);return new o(i,n,r,t)}function MXe(e,t){const n={},r=[];function i(o,a=[]){const u=o+":"+a;if(n[u])return n[u];const l=Ose(o),c=l.create(...a);return t<0&&l.stream&&l.stream.forEach(f=>i(f,[])),l.req&&l.req.forEach(f=>i(f,[])),n[u]=c,r.push(c),c}const s=e.map(o=>{const a=i(o.name,o.params);return a.output=o.id,a});return{ops:r,output:s}}class fM extends VKe{constructor(t,n,r,i){super(r),this._op=n,this._fields=t,this._stream=!!i}init(){const t={count:0,valid:0,stream:this._stream};return this._op.forEach(n=>n.init(t)),t.values&&(t.list=new $Xe),t}write(t,n,r){const i=this._outputs,s=i.length;for(let o=0;os[a][i[u]]:a=>s[a][0];n=n.map(a=>u=>a(u,r,o))}return n}function Vg(e,t,n){if(!t.length)return n;const r=Que(t),i=e.groups(),s=i?i.size:1;return n=n||$C(t.length,()=>Array(s)),s>1?r.forEach(o=>{const a=Jue(e,o,i);for(let u=0;u{const a=Xue(e,o);o.write(a,n,0)}),n}function Que(e,t){const n=[],r={};for(const i of e){const s=i.fields.map(o=>o+"").join(",");(r[s]||(r[s]=[])).push(i)}for(const i in r)n.push(LXe(r[i],t));return n}function Xue(e,t){const n=t.init(),r=e.totalRows(),i=e.data(),s=e.mask();if(e.isOrdered()){const o=e.indices();for(let a=0;a=0;o=s.next(o+1))t.add(n,o,i);else for(let o=0;ot.init()),o=e.data();if(e.isOrdered()){const a=e.indices(),u=a.length;for(let l=0;l=0;u=a.next(u+1))t.add(s[r[u]],u,o)}else{const a=e.totalRows();for(let u=0;u>>1;e(t[s],n)<0?r=s+1:i=s}return r},right(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[s],n)>0?i=s:r=s+1}return r}}}const aH=ele(cM);function jXe(e,t,n,r,i){let s,o,a,u,l;const c=m=>o[m-1]===o[m],f=r.length,d=i.length,h=r.length?Ug(["w","r","k"],"{"+h1(r,(m,y)=>`r[_${y}.id][k]=_${y}.value(w,_${y}.get);`)+"}",r):()=>{},p={i0:0,i1:0,index:0,size:0,peer:c,init(m,y,g,v){p.index=p.i0=p.i1=0,p.size=y.length,s=m,o=y,u=g,l=v,a=i?i.map(b=>b.init()):null;for(let b=0;b0&&c(p.i0)&&(p.i0=aH.left(o,o[p.i0])),p.i1(e.frame||[null,null]).map(t=>Number.isFinite(t)?Math.abs(t):null),VXe=e=>!!e.peers;function zXe(e){const{id:t,name:n,fields:r=[],params:i=[]}=e,s=Rse(n).create(...i);return r.length&&(s.get=r[0]),s.id=t,s}function HXe(e,t,n,r={},i){const s=e.data(),o=WXe(i,s),a=o.length,u=Ug(["r","d","op"],"{"+h1(t,(l,c)=>`_${c}[r] = $${c}(r, d, op);`)+"}",t,n);e.partitions().forEach((l,c)=>{const f=l.length,d=qXe(e,l);for(let p=0;pr[p][c];for(let p=0;p{const i=UXe(r),s=VXe(r),o=`${i},${s}`,{aggOps:a,winOps:u}=n[o]||(n[o]={frame:i,peers:s,aggOps:[],winOps:[]});q6(r.name)?a.push(r):u.push(zXe(r))}),Object.values(n).map(r=>jXe(t,r.frame,r.peers,r.winOps,Que(r.aggOps,r.frame[0]!=null?-1:1)))}function qXe(e,t){if(e.isOrdered()){const n=e.comparator(),r=e.data(),i=t.length,s=new Uint32Array(i);for(let o=1,a=0;oo.add(d,Array(s))),[u,l]=YXe(r),c=e.isGrouped()?e.groups().size:1,f=Vg(e,u,$C(r.length,()=>Array(c)));return l.length?HXe(e,a,n,f,l):KXe(e,a,n,f),e.create(o)}function YXe(e){const t=[],n=[],r=e.length;for(let i=0;ir[l][o[c]]:l=>r[l][0],u=t.length;for(let l=0;l=0;d=i.next(d+1))f[d]=c(d,s,a);else{const d=e.totalRows();for(let h=0;h!e.column(i)),n)}function XXe(e,t){if(t.length===0)return e;const n=e.columnNames();return t.reduce((r,i)=>r.antijoin(i.select(n)),e).dedupe()}const Hb=2147483648,JXe=4294967295;class tle{constructor(t){this._size=t,this._bits=new Uint32Array(Math.ceil(t/32))}get length(){return this._size}count(){const t=this._bits.length;let n=0;for(let r=0;r>5]&Hb>>>t}set(t){this._bits[t>>5]|=Hb>>>t}clear(t){this._bits[t>>5]&=~(Hb>>>t)}scan(t){for(let n=this.next(0);n>=0;n=this.next(n+1))t(n)}next(t){const n=this._bits,r=n.length;let i=t>>5,s=n[i]&JXe>>>t;for(;i=0;)n=this.next(n+1);return n}not(){const t=this._bits,n=t.length;for(let i=0;i>r-1),this}and(t){if(t){const n=this._bits,r=t._bits,i=n.length;for(let s=0;s=0;o=r.next(o+1))t(o,i)&&s.set(o);else for(let o=0;oi[s]}return ZXe(e,r)}function nle(e,{names:t=[],exprs:n=[],ops:r=[]},i={}){if(!t.length)return e;const s=i.limit>0?+i.limit:1/0,o=i.index?i.index===!0?"index":i.index+"":null,a=new Set(i.drop),u=Vh(e,r,n),l=Mo(),c=new Set(t),f=[],d=[],h=[];e.columnNames().forEach(S=>{if(!a.has(S)){const T=l.add(S,[]);c.has(S)||(f.push(e.column(S)),d.push(T))}}),t.forEach(S=>{a.has(S)||(l.has(S)||l.add(S,[]),h.push(l.data[S]))});const p=o?l.add(o,[]):null;let m=0;const y=f.length,g=h.length,v=(S,T)=>{for(let E=0;E{for(let E=0;E{};if(g===1){const S=u[0],T=h[0];e.scan((E,I)=>{const A=io(S(E,I)),R=Math.min(A.length,s);v(E,R);for(let F=0;F{let E=0;const I=u.map(A=>{const R=io(A(S,T));return E=Math.min(Math.max(E,R.length),s),R});v(S,E);for(let A=0;At,(u,l)=>a.map(c=>c(u,l))]},{...i,drop:t})}function Qa(e,t,n,r={window:!1}){const i=new Map,s=o=>{o=bs(o)?t.columnName(o):o,Ui(o)?i.set(o,_h(o)):sr(o)?ec(t,o).forEach(s):as(o)?Hae(i,o):Wt(`Invalid ${e} value: ${o+""}`)};return io(n).forEach(s),r.preparse&&r.preparse(i),ao(i,{table:t,...r})}function nJe(e,t,n){return tJe(e,Qa("fold",e,t),n)}function uH(e,t,n,r){const i=n&&n.length;return rJe(i?iJe(e,n,r):e,t,i)}function rJe(e,{names:t,exprs:n,ops:r},i){const s=Vh(e,r,n),o=i?null:Mo(e),a=e.totalRows();return t.forEach((u,l)=>{const c=e.column(u),f=i?c.data:o.add(u,Array(a)),d=s[l];e.scan(h=>{const p=c.get(h);f[h]=Ma(p)?p:d(h)})}),i?e:e.create(o)}function iJe(e,t,n){const r=e.groups(),i=e.data(),s=(r?r.names:[]).concat(t),o=(r?r.get:[]).concat(t.map(p=>e.getter(p))),a=new Set,u=sI(o);e.scan((p,m)=>a.add(u(p,m)));const l=e.columnNames(),c=Mo(),f=l.map(p=>c.add(p,[]));l.forEach((p,m)=>{const y=i[p],g=f[m];e.scan(v=>g.push(y.get(v)))});const d=sI(o.map((p,m)=>y=>y[m])),h=Ug("v","{"+f.map((p,m)=>`_${m}.push(v[$${m}]);`).join("")+"}",f,l.map(p=>s.indexOf(p)));if(r){let p=r.keys.length;const m=n.reduce((g,v)=>g*v.length,r.size),y=new Uint32Array(m+(p-a.size));y.set(r.keys),lH(r,n,(g,v)=>{a.has(d(g))||(h(g),y[p++]=v[0])}),c.groupby({...r,keys:y})}else lH(r,n,p=>{a.has(d(p))||h(p)});return e.create(c.new())}function lH(e,t,n){const r=e?e.get.length:0,i=e?1:0,s=i+t.length,o=new Int32Array(s),a=new Int32Array(s),u=[];if(e){const{get:c,rows:f,size:d}=e;o[0]=d,u.push((h,p)=>{const m=f[p];for(let y=0;y{const d=f+r;o[f+i]=c.length,u.push((h,p)=>h[d]=c[p])});const l=Array(r+t.length);for(let c=0;c=0;){const f=++a[c];fr[u][l],a=e.length;for(let u=0;u1){const c=i.add(e[u],Array(s));for(let f=0;fe.column(r)?0:Wt(`Invalid impute column ${el(r)}`)),n.expand){const r={preparse:aJe,aggronly:!0},i=Qa("impute",e,n.expand,r),s=hM(e.ungroup(),i);return uH(e,t,i.names,i.names.map(o=>s.get(o,0)))}else return uH(e,t)}function aJe(e){e.forEach((t,n)=>t.field?e.set(n,vse(t+"")):0)}function uJe(e,t){const n=e.columnNames();return t.length?t.reduce((r,i)=>r.semijoin(i.select(n)),e).dedupe():e.reify([])}function rle(e,t){const n=new Map;return e.scan((r,i)=>{const s=t(r,i);s!=null&&s===s&&n.set(s,r)}),n}function lJe(e,t,n){const r=new Map,i=e.length;for(let s=0;s`_${i}.push($${i}(${n}));`)+"}",e,t)}function fJe(e,t,n,{names:r,exprs:i},s={}){const o=e.data(),a=e.indices(!1),u=a.length,l=new Int32Array(u),c=t.data(),f=t.indices(!1),d=f.length,h=new Int32Array(d),p=r.length,m=Mo(),y=Array(p),g=Array(p);for(let S=0;S=c?(f=r,d=t,h=a,p=s,m=i,y=n,g=u,v=o):(f=i,d=n,h=u,p=o,m=r,y=t,g=a,v=s,b=(E,I,A,R)=>e(A,R,E,I));const S=lJe(v,m,y),T=p.length;for(let E=0;E{s=bs(s)?t.columnName(s):s,Ui(s)?r.set(o,_h(s)):sr(s)||as(s)&&s.expr?r.set(o,s):Wt(`Invalid ${e} key value: ${s+""}`)});const i=ao(r,{table:t,aggregate:!1,window:!1});return sI(i.exprs,!0)}function pJe(e,t){const n=new Set(t);return e.filter(r=>n.has(r))}function pM(e,t,n){if(n)Ui(n)?n=[n,n]:En(n)&&n.length===1&&(n=[n[0],n[0]]);else{const r=pJe(e.columnNames(),t.columnNames());r.length||Wt("Natural join requires shared column names."),n=[r,r]}return n}function ile(e,t,n,r){return n.length!==r.length&&Wt("Mismatched number of join keys"),[PI("join",e,n),PI("join",t,r)]}const mJe={aggregate:!1,window:!1},gJe={...mJe,index:1};function cH(e,t,n,r,i={}){n=pM(e,t,n);const s={join:[e,t]};let o;if(En(n)){const[a,u]=n.map(io);o=ile(e,t,a,u),r||(r=yJe(e,a,u,i))}else o=ao({on:n},s).exprs[0],r||(r=[rg(),rg()]);return fJe(e,t,o,vJe(e,t,r,s,i&&i.suffix),i)}function yJe(e,t,n,r){const i=[];t.forEach((o,a)=>Ui(o)&&o===n[a]?i.push(o):0);const s=qae(i);if(r.left&&r.right){const o=new Set(i);return[e.columnNames().map(a=>{const u=`[${el(a)}]`;return o.has(a)?{[a]:`(a, b) => a${u} == null ? b${u} : a${u}`}:a}),s]}return r.right?[s,rg()]:[rg(),s]}function vJe(e,t,n,r,i=[]){if(En(n)){let s,o,a,u=n.length;s=o=a={names:[],exprs:[]},u--&&(s=Qa("join",e,n[0],r)),u--&&(o=Qa("join",t,n[1],gJe)),u--&&(a=ao(n[2],r));const l=new Set,c=new Set(s.names);return o.names.forEach(f=>{c.has(f)&&l.add(f)}),l.size&&(i[0]!==""&&fH(s.names,l,i[0]||"_1"),i[1]!==""&&fH(o.names,l,i[1]||"_2")),{names:s.names.concat(o.names,a.names),exprs:s.exprs.concat(o.exprs,a.exprs)}}else return ao(n,r)}function fH(e,t,n){e.forEach((r,i)=>t.has(r)?e[i]=r+n:0)}function _Je(e,t,n,r={}){const i=new tle(e.totalRows());return(En(n)?bJe:wJe)(i,e,t,n),r.anti&&i.not().and(e.mask()),e.create({filter:i})}function bJe(e,t,n,[r,i]){const s=rle(n,i);t.scan((o,a)=>{s.get(r(o,a))>=0&&e.set(o)})}function wJe(e,t,n,r){const i=t.numRows(),s=n.numRows(),o=t.data(),a=n.data();if(t.isFiltered()||n.isFiltered()){const u=t.indices(!1),l=n.indices(!1);for(let c=0;ca.add(d,Array(u).fill(yn)));const l=rle(t,r),c=Ug(["lr","rr","data"],"{"+h1(i,(d,h)=>`_[${h}][lr] = $[${h}](rr, data);`)+"}",i.map(d=>a.data[d]),Vh(t,o,s)),f=t.data();return e.scan((d,h)=>{const p=l.get(n(d,h));p>=0&&c(d,p,f)}),e.create(a)}function SJe(e,t,n,r){return n=pM(e,t,n),EJe(e,t,[PI("lookup",e,n[0]),PI("lookup",t,n[1])],Qa("lookup",t,r))}const Tk=(e,t)=>e??t;function TJe(e,t,n,r={}){const{keys:i,keyColumn:s}=IJe(e,t,r),o=Tk(r.valueSeparator,"_"),a=n.names.length>1?(l,c)=>c+o+i[l]:l=>i[l],u=i.map(l=>Vg(e,n.ops.map(c=>{if(c.name==="count"){const d=h=>l===s[h]?1:NaN;return d.toString=()=>l+":1",{...c,name:"sum",fields:[d]}}const f=c.fields.map(d=>{const h=(p,m)=>l===s[p]?d(p,m):NaN;return h.toString=()=>l+":"+d,h});return{...c,fields:f}})));return e.create(xJe(n,a,e.groups(),u))}function IJe(e,t,n){const r=n.limit>0?+n.limit:1/0,i=Tk(n.sort,!0),s=Tk(n.keySeparator,"_"),o=Vh(e,t.ops,t.exprs),a=o.length===1?o[0]:(f,d)=>o.map(h=>h(f,d)).join(s),u=Array(e.totalRows());e.scan((f,d)=>u[f]=a(f,d));const l=Vg(e.ungroup(),[{id:0,name:"array_agg_distinct",fields:[f=>u[f]],params:[]}])[0][0],c=i?l.sort():l;return{keys:Number.isFinite(r)?c.slice(0,r):c,keyColumn:u}}function xJe({names:e,exprs:t},n,r,i){const s=r?r.size:1,o=Mo(),a=i.length,u=e.length;let l;const c=(f,d)=>l[f][d];r&&Zue(o,r);for(let f=0;f1)for(let h=0;ht.field?e.set(n,mse(t+"")):0)}function PJe(e,t){const n=new Map;return e.columnNames(r=>(n.set(r,r),0)),lM(e,ec(e,t,n))}function hH(e,t){return hM(e,ao(t,{table:e,aggronly:!0,window:!1}))}function OJe(e,t,n,r){return(t?r?NJe:RJe:r?DJe:kJe)(e.length,e,n,r)}function RJe(e,t,n){const r=n.length;for(let i=0;i=r)return n;for(let i=0;i=i)return n;const s=new Float32Array(i),o=new Uint32Array(i);for(let a=0;as[a]-s[u]);for(let a=0;a{let d=t(f);return a+=d=i?d:Math.min(c.length,d),d});const u=new Uint32Array(a);let l=0;return o.forEach((c,f)=>{const d=t[f],h=u.subarray(l,l+=d);!i&&d===c.length?h.set(c):OJe(h,i,c,n)}),s!==!1&&(o.length>1||!i)&&$Je(u),e.reify(u)}function MJe(e,t,n={}){return LJe(e,FJe(e,t),BJe(e,n.weight),n)}const sle=e=>t=>e.get(t)||0;function FJe(e,t){return bs(t)?()=>t:sle(hM(e,ao({size:t},{table:e,window:!1})).column("size"))}function BJe(e,t){return t==null?null:(t=bs(t)?e.columnName(t):t,sle(Ui(t)?e.column(t):dM(e,ao({w:t},{table:e}),{drop:!0}).column("w")))}function jJe(e,t){return lM(e,ec(e,t))}function UJe(e,{names:t,exprs:n,ops:r=[]},i={}){if(t.length===0)return e;const s=t.length===1&&i.as||[],o=i.drop==null?!0:!!i.drop,a=i.limit==null?s.length||1/0:Math.max(1,+i.limit||1),u=Vh(e,r,n),l=Mo(),c=t.reduce((d,h,p)=>d.set(h,p),new Map),f=(d,h)=>{const p=VJe(e,u[d],a),m=p.length;for(let y=0;y{c.has(d)?(o||l.add(d,e.column(d)),f(c.get(d),d),c.delete(d)):l.add(d,e.column(d))}),c.forEach(f),e.create(l)}function VJe(e,t,n){const r=e.totalRows(),i=[];return e.scan((s,o)=>{const a=io(t(s,o)),u=Math.min(a.length,n);for(;i.length=0;h=d.next(h+1)){const p=o(h,f)+"",m=l[p];u[h]=m??(l[p]=c.push(h)-1)}else for(let h=0;hp=>h(p,f))),{keys:u,get:s,names:t,rows:c,size:c.length}}function YJe(e,t){return qJe(e,Qa("groupby",e,t))}function KJe(e,t){return e.create({order:t})}const QJe=(e,t,n,r)=>`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} : (u > v || v == null) && u != null ? ${r} : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n} - : v !== v && u === u ? ${r} : `;function XJe(e,t){const n=[],r=[],i=[];let s=null,o="0",a="0";e.isGrouped()&&(s=e.groups().keys,o="ka",a="kb");const{ops:u}=ao(t,{table:e,value:(h,p)=>{if(n.push(h),p.escape){const m=y=>`fn[${i.length}](${y}, data)`;r.push([m("a"),m("b")]),i.push(p.escape)}else r.push([iI(p,{index:"a",op:o}),iI(p,{index:"b",op:a})])},window:!1}),l=Vg(e,u),c=(h,p)=>l[h][p],f=n.length;let d="return (a, b) => {"+(c&&e.isGrouped()?"const ka = keys[a], kb = keys[b];":"")+"let u, v; return ";for(let h=0;hr.set(++n+"",s);return t.forEach(s=>{const o=s.expr!=null?s.expr:s;if(as(o)&&!sr(o))for(const a in o)i(o[a]);else i(bs(o)?_h(s,e.columnName(o)):Ui(o)?_h(s):sr(o)?s:Wt(`Invalid orderby field: ${s+""}`))}),XJe(e,r)}function eZe(e,t){const n=e.numRows(),r=n+t.reduce((o,a)=>o+a.numRows(),0);if(n===r)return e;const i=[e,...t],s=Mo();return e.columnNames().forEach(o=>{const a=Array(r);let u=0;i.forEach(l=>{const c=l.column(o)||{get:()=>yn};l.scan(f=>a[u++]=c.get(f))}),s.add(o,a)}),e.create(s.new())}function tZe(e,t){const n=Mo(),r=e.groups(),{get:i,names:s=[],rows:o,size:a=1}=r||{},u=new Uint32Array(a+1);s.forEach(d=>n.add(d,null));const l=r?Jue(e,t,r):[Xue(e,t)];t.outputs().map(d=>n.add(d,[]));const c=u.length-1;let f=0;for(let d=0;d{const m=n.data[h]=Array(f),y=i[p];for(let g=0,v=0;gdH(e,t,n,{anti:!0}),__count:(e,t={})=>hH(e,{[t.as||"count"]:gse()}),__cross:(e,t,n,r)=>cH(e,t,()=>!0,n,{...r,left:!0,right:!0}),__concat:eZe,__dedupe:RXe,__derive:QXe,__except:XXe,__filter:eJe,__fold:nJe,__impute:oJe,__intersect:uJe,__join:cH,__lookup:SJe,__pivot:CJe,__relocate:Kue,__rename:PJe,__rollup:hH,__sample:MJe,__select:jJe,__semijoin:dH,__spread:zJe,__union:HJe,__unroll:WJe,__groupby:YJe,__orderby:JJe,__ungroup:nZe,__unorder:rZe,__reduce:tZe};Object.assign(Al.prototype,iZe);function sZe(e,t){return Al.from(e,t)}function oZe(e){return tA(e,{escape:!0,toString(){Wt("Escaped values can not be serialized.")}})}Al.prototype;const Sa={top:30,left:60,right:80,bottom:50};function ole({data:e,selection:t,parameters:n,dataname:r}){const o=w.useMemo(()=>{const c=e.map(f=>({...f,value:+f[n.y_var]}));return sZe(c)},[e,n]),a=w.useMemo(()=>{const c=Pf(o.filter(oZe(f=>t.includes(f[n.cat_var]))).array("value"));return r==="clean_stocks"?c:[0,c[1]]},[o,t,n,r]),u=w.useMemo(()=>mh([Sa.top,400-Sa.bottom]).domain(Pf(o.array("value")).reverse()),[o,400]),l=yf(r==="clean_stocks"?".0%":",.0f");return(t==null?void 0:t.length)===0?null:C.jsxs("svg",{style:{height:"400px",width:"60px",overflow:"visible"},children:[C.jsx("rect",{y:u(a[1]),height:u(a[0])-u(a[1]),x:Sa.left-10,width:10,opacity:.1,fill:"black"}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",textAnchor:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:25,y:Sa.top-5,children:l(u.domain()[0])}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",textAnchor:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:25,y:400-Sa.bottom+8,children:l(u.domain()[1])}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:Sa.left-5,y:u(a[0]),children:l(a[0])}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:Sa.left-5,y:u(a[1]),children:l(a[1])}),e.map(c=>C.jsx("rect",{opacity:.2,fill:+c[n.y_var]>0?"steelblue":"firebrick",x:0,width:50,y:u(+c[n.y_var]),height:1},"strip")),C.jsx("line",{strokeWidth:2,stroke:"black",style:{fontSize:10,dominantBaseline:"middle"},x1:0,x2:50,y1:u(a[0]),y2:u(a[0])}),C.jsx("line",{strokeWidth:2,stroke:"black",x1:0,x2:50,y1:u(a[1]),y2:u(a[1])}),C.jsx("line",{strokeWidth:2,stroke:"black",x1:0,x2:0,y1:u(a[1]),y2:u(a[0])}),C.jsx("line",{strokeWidth:2,stroke:"black",x1:50,x2:50,y1:u(a[1]),y2:u(a[0])}),C.jsx("path",{fill:"black",opacity:"0.1",d:`M${Sa.left}, ${u(a[1])} L 113, ${Sa.top} L 113, ${400-Sa.bottom} L ${Sa.left}, ${u(a[0])}`})]})}const aZe=Object.freeze(Object.defineProperty({__proto__:null,StripPlot:ole},Symbol.toStringTag,{value:"Module"}));function ale({parameters:e}){const t=e.dataset==="clean_data"?C.jsxs(Y0,{children:["Select any subset of countries to the left of the visualization to support the prompt at the top of the page.",C.jsx("h4",{children:"Background:"}),"You live in a fantasy world that consists of your home country, as well as other 15 countries located across 5 continents: Eldoril, Thundoril, Aerion, Silvoria, and Mystara. Countries within each continent are similar to each other in size and demographics.",C.jsx("h4",{children:"Scenario:"}),"You are an analyst for the Viral Disease Policy Center of your home country at time when there is a new viral disease called",C.jsx("i",{children:" Celestial Sniffles"}),". Luckily, your country has not been affected yet and has time to prepare and decide on a policy to combat it. You have access to the infection data from other countries that implemented one of the 3 available policies: A, B, or C. However, due to socioeconomic factors, the Surgeon General in your country has",C.jsx("i",{children:" already decided on a policy"}),".",C.jsx("h4",{children:"Task:"}),"You are tasked with leading the promotion efforts that make the case for the chosen policy. In the experiment, you will use an interactive data explorer that shows infection data from other countries. You should select a view that best shows (and convinces the population) that your country's"," ",C.jsx("b",{children:"chosen policy is the best policy to combat the disease"}),". After finalizing the view, click the camera button and add a caption or a slogan that will go along with your visualization."]}):C.jsxs(Y0,{children:["Select any subset of stocks to the left of the visualization to support the prompt at the top of the page.",C.jsx("h4",{children:"Scenario:"})," ","You are a financial advisor. Your client approached you asking for help in picking a new investment—an industry fund that equally invests within a single industry. The client prefers to make their decisions"," ",C.jsx("i",{children:"solely based on the data"}),", and not based on any inside knowledge about the type of industry. However, your boss"," ",C.jsx("i",{children:"does"})," ","have inside knowledge and orders you to recommend a specific industry (which is ultimately in the best interest of the client). You cannot disclose this to the client and have to use data to support your recommendations.",C.jsx("h4",{children:"Task:"})," ","In the experiment, you will use an interactive data explorer that shows performance of different stocks from a variety of industries. You should select a view that best shows (and convinces your client) that"," ",C.jsx("b",{children:"the chosen industry fund would be the best investment with the highest returns"}),". After finalizing the view, click the camera button and add a caption or a slogan that will go along with your visualization."]}),n=e.dataset==="clean_data"?C.jsxs(Y0,{children:[C.jsx("h4",{children:"Background:"}),"You live in a fantasy world that consists of your home country, as well as other 15 countries located across 5 continents: Eldoril, Thundoril, Aerion, Silvoria, and Mystara. Countries within each continent are similar to each other in size and demographics.",C.jsx("h4",{children:"Scenario:"}),"There's a new viral disease called"," ",C.jsx("i",{children:"Celestial Sniffles"}),". Most countries in the world have adopted one of 3 major disease containment policies: A, B, or C. Luckily, your country has not been affected yet but you may need to travel to one of the affected countries for work. Afraid of getting sick and stuck abroad with a huge hospital bill, you decide to purchase a traveler's health insurance policy. The price of the policy is very flexible and depends on the amount of coverage you'll get: anywhere between $0 (no coverage) to $100 (full coverage). Since you are not familiar with the disease trends or containment policies, you turn to social media to read what people shared about recent infection rates.",C.jsx("h4",{children:"Task:"}),"In the experiment, you will see a set of visualizations that show infection rates in different countries that adopted one of the containment policies A, B, or C. You can refer to the list of countries to the left of the visualization to see which country adopted which Policy. Based on each visualization, you will be asked to decide"," ",C.jsx("b",{children:"how much to spend on your insurance policy"})," ","and"," ",C.jsx("b",{children:"answer a short survey"}),"."]}):C.jsxs(Y0,{children:[C.jsx("h4",{children:"Scenario:"}),"You have $100 that you would like to invest in"," ",C.jsx("i",{children:"industry funds"})," ","but are not sure how to best allocate that money. An industry fund is composed of all individual stocks pertaining to that industry (e.g., a Pharma fund is composed of Pharma A, Pharma B, and Pharma C stocks). Since you are not familiar with the current market, you turn to social media to read what people shared about recent stock performance.",C.jsx("h4",{children:"Task:"}),"In the experiment, you will see a set of visualizations that show performance of different stocks from a variety of industries. Based on each visualization, you will be asked to decide"," ",C.jsx("b",{children:"how much to invest in a given industry fund"})," ","and"," ",C.jsx("b",{children:"answer a short survey"}),"."]});return C.jsx(ei,{position:"right",children:C.jsxs(em,{width:800,shadow:"md",children:[C.jsx(em.Target,{children:C.jsx(Ws,{variant:"light",color:"gray",compact:!0,children:"Help"})}),C.jsx(em.Dropdown,{children:C.jsx(rt,{size:"sm",children:e.allow_selection?t:n})})]})})}const uZe=Object.freeze(Object.defineProperty({__proto__:null,Help:ale},Symbol.toStringTag,{value:"Module"}));function pH({parameters:e,setAnswer:t}){const[n,r]=w.useState(null),[i,s]=w.useState(e.dataset),[o,a]=w.useState(e.initial_selection),[u,l]=w.useState(null),[c,f]=w.useState([new Date(e.start_date),new Date(e.end_date)]),[d,h]=w.useState(e.guardrail);w.useEffect(()=>{u7e(`./data/${i}.csv`).then(T=>{r(T),l(Array.from(new Set(T.map(E=>JSON.stringify({name:E[e.cat_var],group:E[e.group_var]})))).map(E=>JSON.parse(E)))})},[i,e]);const p=w.useMemo(()=>n&&c?n.filter(T=>new Date(T[e.x_var]).getTime()>=c[0].getTime()).filter(T=>new Date(T[e.x_var]).getTime()<=c[1].getTime()):null,[n,c,e.x_var,i]),m=T=>{s(T),a([])},{actions:y,trrack:g}=w.useMemo(()=>{const T=DC.create(),E=T.register("selection",(R,F)=>(R.selection=F,R)),I=T.register("range",(R,F)=>(R.range=F,R)),A=ise({registry:T,initialState:{selection:[],range:[e.start_date,e.end_date]}});return{actions:{selection:E,range:I},trrack:A}},[e.end_date,e.start_date]),v=w.useCallback(T=>{g.apply("Change daterange",y.range([T[0].toISOString().slice(0,10),T[1].toISOString().slice(0,10)]))},[g,y]),b=w.useMemo(()=>ou(v,200),[v]),S=w.useCallback(T=>{g.apply("Change selection",y.selection(T)),t({status:!0,provenanceGraph:g.graph.backend,answers:{}})},[g,y,t]);return p&&u&&c&&o?C.jsxs(ys,{children:[e.allow_guardrail_selector?C.jsx(wS,{shadow:"sm",radius:"md",p:"md",style:{width:"500px"},children:C.jsx(rk,{guardrail:d,setGuardrail:h,dataname:i,setDataname:m,setSelection:a})}):null,C.jsx(Fm,{children:C.jsxs(wS,{shadow:"md",radius:"md",p:"md",withBorder:!0,children:[e.caption===""?null:C.jsx(Fm,{style:{width:"800px"},children:e.caption?C.jsx(wJ,{children:e.caption}):null}),C.jsxs(ei,{noWrap:!0,children:[e.allow_selection===!1&&e.guardrail!=="juxt_data"?null:C.jsx(ei,{noWrap:!0,children:C.jsx(tk,{parameters:e,data:p,dataname:i,items:u,selection:o,setSelection:a,trackSelection:S,range:c,guardrail:d})}),e.allow_selection===!1&&e.guardrail!=="juxt_data"?null:C.jsx(df,{orientation:"vertical",size:"xs"}),C.jsxs(ys,{children:[C.jsxs(ei,{position:"apart",children:[C.jsxs(ys,{spacing:0,justify:"flex-start",children:[C.jsx(rt,{fw:500,children:i==="clean_stocks"?"Percent change in stock price":"Infections per million people"}),d==="super_summ"?C.jsx(rt,{fz:"xs",c:"dimmed",children:"Shaded area represents the middle 50% of all values."}):null,d==="juxt_summ"?C.jsx(rt,{fz:"xs",c:"dimmed",children:"Bar on the left highlights the range of selection among all data."}):null]}),e.allow_help?C.jsx(ale,{parameters:e}):null]}),C.jsxs(ys,{children:[C.jsxs(ei,{noWrap:!0,children:[d==="juxt_summ"?C.jsx(ole,{parameters:e,data:p,selection:o,dataname:i}):null,C.jsx(ek,{parameters:e,data:p,dataname:i,items:u,selection:o,range:c,guardrail:d})]}),e.allow_time_slider?C.jsx("div",{style:{width:"500px"},children:C.jsx(nk,{parameters:e,setRange:f,trackRange:b})}):null]})]})]})]})})]}):C.jsx(Xf,{})}const lZe=Object.freeze(Object.defineProperty({__proto__:null,DataExplorer:pH,default:pH},Symbol.toStringTag,{value:"Module"})),cZe=Object.assign({"../public/viz-guardrails/AudioTest.tsx":oVe,"../public/viz-guardrails/Color.tsx":aVe,"../public/viz-guardrails/DataExplorer.tsx":lZe,"../public/viz-guardrails/Help.tsx":uZe,"../public/viz-guardrails/LineChart.tsx":ZHe,"../public/viz-guardrails/RangeSelector.tsx":tWe,"../public/viz-guardrails/Selector.tsx":nWe,"../public/viz-guardrails/Sidebar.tsx":eWe,"../public/viz-guardrails/StripPlot.tsx":aZe,"../public/viz-guardrails/XAxis.tsx":XHe,"../public/viz-guardrails/YAxis.tsx":JHe});function fZe({currentConfig:e,provState:t}){const n=hl(),r=`../public/${e.path}`,i=cZe[r].default,s=Ju(),{updateResponseBlockValidation:o,setIframeAnswers:a}=Xu(),u=w.useCallback(({status:l,provenanceGraph:c,answers:f})=>{s(o({location:"sidebar",currentStep:n,status:l,values:f,provenanceGraph:c})),s(a(Object.values(f).map(d=>d)))},[s,o,n,a]);return C.jsx(w.Suspense,{fallback:C.jsx("div",{children:"Loading..."}),children:C.jsx(i,{parameters:e.parameters,setAnswer:u,provenanceState:t})})}function dZe({currentConfig:e}){const[t,n]=w.useState(null);return w.useEffect(()=>{fetch(`${fl}${e.path}`).then(r=>r.text()).then(r=>n(r))},[e]),t===null?null:C.jsx("div",{style:{maxWidth:700,margin:"0 0"},children:C.jsx(ro,{text:t})})}function bh(){return la(e=>e.config)}function ule(){const e=hl(),{setAlertModal:t}=Xu(),n=Ju();w.useEffect(()=>{(new URLSearchParams(window.location.search).get("admin")||"f")==="t"||(window.history.pushState(null,"",window.location.href),window.onpopstate=()=>{window.history.pushState(null,"",window.location.href),n(t({show:!0,message:"Using the browser's back button is prohibited during the study."}))})},[e,t,n])}function lle({provState:e}){var S;const t=bh(),n=sa(),{trialName:r}=uh(),i=t.components[r],s=Z3(),o=uC(i)&&t.baseComponents?J3({},(S=t.baseComponents)==null?void 0:S[i.baseComponent],i):i,a=o.instruction||"",{instructionLocation:u}=o,l=t.uiConfig.sidebar&&(u==="sidebar"||u===void 0),[c,f]=w.useState(null),d=Ju(),{setIsRecording:h}=Xu(),{trialName:p}=uh(),[m,y]=w.useState(null);w.useEffect(()=>{!p||!t||!t.recordStudyAudio||!n.storageEngine||(c&&m&&n.storageEngine.saveAudio(c,m),t.tasksToNotRecordAudio&&t.tasksToNotRecordAudio.includes(p)?(y(null),f(null),d(h(!1))):(navigator.mediaDevices.getUserMedia({audio:!0}).then(E=>{const I=new MediaRecorder(E);I.start(),f(I),d(h(!0))}),y(p)))},[p]),ule();const{storageEngine:g}=sa(),v=Ju(),{setAlertModal:b}=Xu();return w.useEffect(()=>{(g==null?void 0:g.getEngine())!=="firebase"&&v(b({show:!0,message:"There was an issue connecting to the firebase database. This could be caused by a network issue or your adblocker. If you are using an adblocker, please disable it for this website and refresh."}))},[b,g,v]),C.jsxs(C.Fragment,{children:[u==="aboveStimulus"&&C.jsx(ro,{text:a}),C.jsx(UT,{status:s,config:o,location:"aboveStimulus"},`${r}-above-response-block`),C.jsxs(w.Suspense,{fallback:C.jsx("div",{children:"Loading..."}),children:[o.type==="markdown"&&C.jsx(dZe,{currentConfig:o}),o.type==="website"&&C.jsx(rVe,{currentConfig:o}),o.type==="image"&&C.jsx(sVe,{currentConfig:o}),o.type==="react-component"&&C.jsx(fZe,{currentConfig:o,provState:e})]},`${r}-stimulus`),(u==="belowStimulus"||u===void 0&&!l)&&C.jsx(ro,{text:a}),C.jsx("div",{style:{maxWidth:800,margin:"0 0"},children:C.jsx(UT,{status:s,config:o,location:"belowStimulus"},`${r}-below-response-block`)})]})}function hZe(e){const[t]=h$();return C.jsx(c0e,{...e,to:{pathname:e.to,search:t.toString()}})}function pZe(){const e=bh(),{storageEngine:t}=sa(),{answers:n}=la(s=>s),[r,i]=w.useState(!1);return w.useEffect(()=>{const s=setInterval(async()=>{await t.verifyCompletion(n)&&(i(!0),clearInterval(s))},1e3)},[]),ule(),C.jsx(ua,{style:{height:"100%"},children:C.jsx(Fm,{direction:"column",children:r?C.jsx(rt,{size:"xl",display:"block",children:e.uiConfig.studyEndMsg?C.jsx(ro,{text:e.uiConfig.studyEndMsg}):"Thank you for completing the study. You may close this window now."}):C.jsxs(C.Fragment,{children:[C.jsx(rt,{size:"xl",display:"block",children:"Please wait while your answers are uploaded."}),C.jsx(bT,{h:"lg"}),C.jsx(ua,{children:C.jsx(Xf,{color:"blue"})})]})})})}function mZe(e,t=!1){return typeof e=="number"?mH(e,t):mH(e.length,t).map(r=>r.map(i=>e[i]))}function mH(e,t){if(e<0)throw new Error("Latin square size must be > 0");if(e==0)return[];if(e==1)return[[0]];let n=new Array(e);for(let s=0;s(a+1)%e);r.push(o),i=o}if(t&&e%2>0)for(let s=0;s.5-Math.random());e.components=r}else e.order==="latinSquare"&&t&&(e.components=t[n].pop().map(r=>r.startsWith("_orderObj")?e.components[+r.slice(9)]:r));return e.components.slice(0,e.numSamples?e.numSamples:void 0).flat()}function gZe(e,t){const n=Ig(e);return cle(n,t,"root"),n.components.slice(0,n.numSamples?n.numSamples:void 0).flat()}function fle(e,t,n,r=0){const i=n.length>0?`${n}-${r}`:"root";e.order==="latinSquare"&&t.push(i),e.components.forEach((s,o)=>{typeof s!="string"&&fle(s,t,i,o)})}function yZe(e){const t=[];return fle(e,t,"",0),t}function gH(e,t){const n=t.split("-");let r={};n.forEach(o=>{o==="root"?r=e.sequence:r=r.components[+o]});const i=r.components.map((o,a)=>typeof o=="string"?o:`_orderObj${a}`);return mZe(i.sort(()=>.5-Math.random()),!0)}function vZe(e){const n=yZe(e.sequence).map(s=>({[s]:gH(e,s)})).reduce((s,o)=>({...s,...o}),{}),r=e.uiConfig.numSequences||1e3,i=[];return Array.from({length:r}).forEach(()=>{const s=gZe(e.sequence,n);s.push("end"),i.push(s),Object.entries(n).forEach(([o,a])=>{a.length===0&&(n[o]=gH(e,o))})}),i}var _Ze={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},bZe=Object.defineProperty,wZe=Object.defineProperties,EZe=Object.getOwnPropertyDescriptors,OI=Object.getOwnPropertySymbols,dle=Object.prototype.hasOwnProperty,hle=Object.prototype.propertyIsEnumerable,yH=(e,t,n)=>t in e?bZe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vH=(e,t)=>{for(var n in t||(t={}))dle.call(t,n)&&yH(e,n,t[n]);if(OI)for(var n of OI(t))hle.call(t,n)&&yH(e,n,t[n]);return e},SZe=(e,t)=>wZe(e,EZe(t)),TZe=(e,t)=>{var n={};for(var r in e)dle.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&OI)for(var r of OI(e))t.indexOf(r)<0&&hle.call(e,r)&&(n[r]=e[r]);return n},rd=(e,t,n)=>{const r=w.forwardRef((i,s)=>{var o=i,{color:a="currentColor",size:u=24,stroke:l=2,children:c}=o,f=TZe(o,["color","size","stroke","children"]);return w.createElement("svg",vH(SZe(vH({ref:s},_Ze),{width:u,height:u,stroke:a,strokeWidth:l,className:`tabler-icon tabler-icon-${e}`}),f),[...n.map(([d,h])=>w.createElement(d,h)),...c||[]])});return r.propTypes={color:gt.string,size:gt.oneOfType([gt.string,gt.number]),stroke:gt.oneOfType([gt.string,gt.number])},r.displayName=`${t}`,r},IZe=rd("alert-circle","IconAlertCircle",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 8v4",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]]),xZe=rd("arrows-shuffle","IconArrowsShuffle",[["path",{d:"M18 4l3 3l-3 3",key:"svg-0"}],["path",{d:"M18 20l3 -3l-3 -3",key:"svg-1"}],["path",{d:"M3 7h3a5 5 0 0 1 5 5a5 5 0 0 0 5 5h5",key:"svg-2"}],["path",{d:"M21 7h-5a4.978 4.978 0 0 0 -3 1m-4 8a4.984 4.984 0 0 1 -3 1h-3",key:"svg-3"}]]),CZe=rd("code-dots","IconCodeDots",[["path",{d:"M15 12h.01",key:"svg-0"}],["path",{d:"M12 12h.01",key:"svg-1"}],["path",{d:"M9 12h.01",key:"svg-2"}],["path",{d:"M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2",key:"svg-3"}],["path",{d:"M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2",key:"svg-4"}]]),AZe=rd("code-plus","IconCodePlus",[["path",{d:"M9 12h6",key:"svg-0"}],["path",{d:"M12 9v6",key:"svg-1"}],["path",{d:"M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2",key:"svg-2"}],["path",{d:"M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2",key:"svg-3"}]]),PZe=rd("dots-vertical","IconDotsVertical",[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),OZe=rd("mail","IconMail",[["path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z",key:"svg-0"}],["path",{d:"M3 7l9 6l9 -6",key:"svg-1"}]]),_H=rd("schema","IconSchema",[["path",{d:"M5 2h5v4h-5z",key:"svg-0"}],["path",{d:"M15 10h5v4h-5z",key:"svg-1"}],["path",{d:"M5 18h5v4h-5z",key:"svg-2"}],["path",{d:"M5 10h5v4h-5z",key:"svg-3"}],["path",{d:"M10 12h5",key:"svg-4"}],["path",{d:"M7.5 6v4",key:"svg-5"}],["path",{d:"M7.5 14v4",key:"svg-6"}]]),ple=rd("table","IconTable",[["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}]]);const Ik=["description","instruction","answer","correctAnswer","startTime","endTime","duration","taskOrder"],Yw=["participantId","trialId","responseId"];function Kw(e,t){const n=`data:text/json;charset=utf-8,${encodeURIComponent(e)}`,r=document.createElement("a");r.setAttribute("href",n),r.setAttribute("download",t),document.body.appendChild(r),r.click(),r.remove()}function RZe(e,t,n){return Object.entries(t.components).map(([r,i])=>{const s=uC(i)&&i.baseComponent&&t.baseComponents?J3({},t.baseComponents[i.baseComponent],i):i,o=e.answers[r],a=o!==void 0?o:{answer:{},startTime:-1,endTime:-1,windowEvents:[]},u=a.endTime-a.startTime;return Object.entries(a.answer).map(([c,f])=>{const d={participantId:e.participantId,trialId:r,responseId:c,startTime:new Date(a.startTime).toUTCString(),endTime:new Date(a.endTime).toUTCString(),duration:u};return n.includes("description")&&(d.description=s.description),n.includes("instruction")&&(d.instruction=s.instruction),n.includes("answer")&&(d.answer=f),n.includes("correctAnswer")&&(d.correctAnswer=s.correctAnswer),n.includes("taskOrder")&&(d.taskOrder=e.sequence.indexOf(r)),d}).flat()}).flat()}async function NZe(e,t,n,r=[...Yw,...Ik]){const s=(await t.getAllParticipantsData()).map(l=>RZe(l,n,r)).flat(),o=l=>l.replace(/"/g,'""'),a=s.map(l=>r.map(c=>l===null?"":typeof l[c]=="string"?`"${o(l[c])}"`:JSON.stringify(l[c])).join(",")),u=[r.join(","),...a].join(` + : v !== v && u === u ? ${r} : `;function XJe(e,t){const n=[],r=[],i=[];let s=null,o="0",a="0";e.isGrouped()&&(s=e.groups().keys,o="ka",a="kb");const{ops:u}=ao(t,{table:e,value:(h,p)=>{if(n.push(h),p.escape){const m=y=>`fn[${i.length}](${y}, data)`;r.push([m("a"),m("b")]),i.push(p.escape)}else r.push([iI(p,{index:"a",op:o}),iI(p,{index:"b",op:a})])},window:!1}),l=Vg(e,u),c=(h,p)=>l[h][p],f=n.length;let d="return (a, b) => {"+(c&&e.isGrouped()?"const ka = keys[a], kb = keys[b];":"")+"let u, v; return ";for(let h=0;hr.set(++n+"",s);return t.forEach(s=>{const o=s.expr!=null?s.expr:s;if(as(o)&&!sr(o))for(const a in o)i(o[a]);else i(bs(o)?_h(s,e.columnName(o)):Ui(o)?_h(s):sr(o)?s:Wt(`Invalid orderby field: ${s+""}`))}),XJe(e,r)}function eZe(e,t){const n=e.numRows(),r=n+t.reduce((o,a)=>o+a.numRows(),0);if(n===r)return e;const i=[e,...t],s=Mo();return e.columnNames().forEach(o=>{const a=Array(r);let u=0;i.forEach(l=>{const c=l.column(o)||{get:()=>yn};l.scan(f=>a[u++]=c.get(f))}),s.add(o,a)}),e.create(s.new())}function tZe(e,t){const n=Mo(),r=e.groups(),{get:i,names:s=[],rows:o,size:a=1}=r||{},u=new Uint32Array(a+1);s.forEach(d=>n.add(d,null));const l=r?Jue(e,t,r):[Xue(e,t)];t.outputs().map(d=>n.add(d,[]));const c=u.length-1;let f=0;for(let d=0;d{const m=n.data[h]=Array(f),y=i[p];for(let g=0,v=0;gdH(e,t,n,{anti:!0}),__count:(e,t={})=>hH(e,{[t.as||"count"]:gse()}),__cross:(e,t,n,r)=>cH(e,t,()=>!0,n,{...r,left:!0,right:!0}),__concat:eZe,__dedupe:RXe,__derive:QXe,__except:XXe,__filter:eJe,__fold:nJe,__impute:oJe,__intersect:uJe,__join:cH,__lookup:SJe,__pivot:CJe,__relocate:Kue,__rename:PJe,__rollup:hH,__sample:MJe,__select:jJe,__semijoin:dH,__spread:zJe,__union:HJe,__unroll:WJe,__groupby:YJe,__orderby:JJe,__ungroup:nZe,__unorder:rZe,__reduce:tZe};Object.assign(Al.prototype,iZe);function sZe(e,t){return Al.from(e,t)}function oZe(e){return tA(e,{escape:!0,toString(){Wt("Escaped values can not be serialized.")}})}Al.prototype;const Sa={top:30,left:60,right:80,bottom:50};function ole({data:e,selection:t,parameters:n,dataname:r}){const o=w.useMemo(()=>{const c=e.map(f=>({...f,value:+f[n.y_var]}));return sZe(c)},[e,n]),a=w.useMemo(()=>{const c=Pf(o.filter(oZe(f=>t.includes(f[n.cat_var]))).array("value"));return r==="clean_stocks"?c:[0,c[1]]},[o,t,n,r]),u=w.useMemo(()=>mh([Sa.top,400-Sa.bottom]).domain(Pf(o.array("value")).reverse()),[o,400]),l=yf(r==="clean_stocks"?".0%":",.0f");return(t==null?void 0:t.length)===0?null:C.jsxs("svg",{style:{height:"400px",width:"60px",overflow:"visible"},children:[C.jsx("rect",{y:u(a[1]),height:u(a[0])-u(a[1]),x:Sa.left-10,width:10,opacity:.1,fill:"black"}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",textAnchor:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:25,y:Sa.top-5,children:l(u.domain()[0])}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",textAnchor:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:25,y:400-Sa.bottom+8,children:l(u.domain()[1])}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:Sa.left-5,y:u(a[0]),children:l(a[0])}),C.jsx("text",{style:{fontSize:10,dominantBaseline:"middle",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif'},x:Sa.left-5,y:u(a[1]),children:l(a[1])}),e.map(c=>C.jsx("rect",{opacity:.2,fill:+c[n.y_var]>0?"steelblue":"firebrick",x:0,width:50,y:u(+c[n.y_var]),height:1},"strip")),C.jsx("line",{strokeWidth:2,stroke:"black",style:{fontSize:10,dominantBaseline:"middle"},x1:0,x2:50,y1:u(a[0]),y2:u(a[0])}),C.jsx("line",{strokeWidth:2,stroke:"black",x1:0,x2:50,y1:u(a[1]),y2:u(a[1])}),C.jsx("line",{strokeWidth:2,stroke:"black",x1:0,x2:0,y1:u(a[1]),y2:u(a[0])}),C.jsx("line",{strokeWidth:2,stroke:"black",x1:50,x2:50,y1:u(a[1]),y2:u(a[0])}),C.jsx("path",{fill:"black",opacity:"0.1",d:`M${Sa.left}, ${u(a[1])} L 113, ${Sa.top} L 113, ${400-Sa.bottom} L ${Sa.left}, ${u(a[0])}`})]})}const aZe=Object.freeze(Object.defineProperty({__proto__:null,StripPlot:ole},Symbol.toStringTag,{value:"Module"}));function ale({parameters:e}){const t=e.dataset==="clean_data"?C.jsxs(Y0,{children:["Select any subset of countries to the left of the visualization to support the prompt at the top of the page.",C.jsx("h4",{children:"Background:"}),"You live in a fantasy world that consists of your home country, as well as other 15 countries located across 5 continents: Eldoril, Thundoril, Aerion, Silvoria, and Mystara. Countries within each continent are similar to each other in size and demographics.",C.jsx("h4",{children:"Scenario:"}),"You are an analyst for the Viral Disease Policy Center of your home country at time when there is a new viral disease called",C.jsx("i",{children:" Celestial Sniffles"}),". Luckily, your country has not been affected yet and has time to prepare and decide on a policy to combat it. You have access to the infection data from other countries that implemented one of the 3 available policies: A, B, or C. However, due to socioeconomic factors, the Surgeon General in your country has",C.jsx("i",{children:" already decided on a policy"}),".",C.jsx("h4",{children:"Task:"}),"You are tasked with leading the promotion efforts that make the case for the chosen policy. In the experiment, you will use an interactive data explorer that shows infection data from other countries. You should select a view that best shows (and convinces the population) that your country's"," ",C.jsx("b",{children:"chosen policy is the best policy to combat the disease"}),". After finalizing the view, click the camera button and add a caption or a slogan that will go along with your visualization."]}):C.jsxs(Y0,{children:["Select any subset of stocks to the left of the visualization to support the prompt at the top of the page.",C.jsx("h4",{children:"Scenario:"})," ","You are a financial advisor. Your client approached you asking for help in picking a new investment—an industry fund that equally invests within a single industry. The client prefers to make their decisions"," ",C.jsx("i",{children:"solely based on the data"}),", and not based on any inside knowledge about the type of industry. However, your boss"," ",C.jsx("i",{children:"does"})," ","have inside knowledge and orders you to recommend a specific industry (which is ultimately in the best interest of the client). You cannot disclose this to the client and have to use data to support your recommendations.",C.jsx("h4",{children:"Task:"})," ","In the experiment, you will use an interactive data explorer that shows performance of different stocks from a variety of industries. You should select a view that best shows (and convinces your client) that"," ",C.jsx("b",{children:"the chosen industry fund would be the best investment with the highest returns"}),". After finalizing the view, click the camera button and add a caption or a slogan that will go along with your visualization."]}),n=e.dataset==="clean_data"?C.jsxs(Y0,{children:[C.jsx("h4",{children:"Background:"}),"You live in a fantasy world that consists of your home country, as well as other 15 countries located across 5 continents: Eldoril, Thundoril, Aerion, Silvoria, and Mystara. Countries within each continent are similar to each other in size and demographics.",C.jsx("h4",{children:"Scenario:"}),"There's a new viral disease called"," ",C.jsx("i",{children:"Celestial Sniffles"}),". Most countries in the world have adopted one of 3 major disease containment policies: A, B, or C. Luckily, your country has not been affected yet but you may need to travel to one of the affected countries for work. Afraid of getting sick and stuck abroad with a huge hospital bill, you decide to purchase a traveler's health insurance policy. The price of the policy is very flexible and depends on the amount of coverage you'll get: anywhere between $0 (no coverage) to $100 (full coverage). Since you are not familiar with the disease trends or containment policies, you turn to social media to read what people shared about recent infection rates.",C.jsx("h4",{children:"Task:"}),"In the experiment, you will see a set of visualizations that show infection rates in different countries that adopted one of the containment policies A, B, or C. You can refer to the list of countries to the left of the visualization to see which country adopted which Policy. Based on each visualization, you will be asked to decide"," ",C.jsx("b",{children:"how much to spend on your insurance policy"})," ","and"," ",C.jsx("b",{children:"answer a short survey"}),"."]}):C.jsxs(Y0,{children:[C.jsx("h4",{children:"Scenario:"}),"You have $100 that you would like to invest in"," ",C.jsx("i",{children:"industry funds"})," ","but are not sure how to best allocate that money. An industry fund is composed of all individual stocks pertaining to that industry (e.g., a Pharma fund is composed of Pharma A, Pharma B, and Pharma C stocks). Since you are not familiar with the current market, you turn to social media to read what people shared about recent stock performance.",C.jsx("h4",{children:"Task:"}),"In the experiment, you will see a set of visualizations that show performance of different stocks from a variety of industries. Based on each visualization, you will be asked to decide"," ",C.jsx("b",{children:"how much to invest in a given industry fund"})," ","and"," ",C.jsx("b",{children:"answer a short survey"}),"."]});return C.jsx(ei,{position:"right",children:C.jsxs(em,{width:800,shadow:"md",children:[C.jsx(em.Target,{children:C.jsx(Ws,{variant:"light",color:"gray",compact:!0,children:"Help"})}),C.jsx(em.Dropdown,{children:C.jsx(rt,{size:"sm",children:e.allow_selection?t:n})})]})})}const uZe=Object.freeze(Object.defineProperty({__proto__:null,Help:ale},Symbol.toStringTag,{value:"Module"}));function pH({parameters:e,setAnswer:t}){const[n,r]=w.useState(null),[i,s]=w.useState(e.dataset),[o,a]=w.useState(e.initial_selection),[u,l]=w.useState(null),[c,f]=w.useState([new Date(e.start_date),new Date(e.end_date)]),[d,h]=w.useState(e.guardrail);w.useEffect(()=>{u7e(`./data/${i}.csv`).then(T=>{r(T),l(Array.from(new Set(T.map(E=>JSON.stringify({name:E[e.cat_var],group:E[e.group_var]})))).map(E=>JSON.parse(E)))})},[i,e]);const p=w.useMemo(()=>n&&c?n.filter(T=>new Date(T[e.x_var]).getTime()>=c[0].getTime()).filter(T=>new Date(T[e.x_var]).getTime()<=c[1].getTime()):null,[n,c,e.x_var,i]),m=T=>{s(T),a([])},{actions:y,trrack:g}=w.useMemo(()=>{const T=DC.create(),E=T.register("selection",(R,F)=>(R.selection=F,R)),I=T.register("range",(R,F)=>(R.range=F,R)),A=ise({registry:T,initialState:{selection:[],range:[e.start_date,e.end_date]}});return{actions:{selection:E,range:I},trrack:A}},[e.end_date,e.start_date]),v=w.useCallback(T=>{g.apply("Change daterange",y.range([T[0].toISOString().slice(0,10),T[1].toISOString().slice(0,10)]))},[g,y]),b=w.useMemo(()=>ou(v,200),[v]),S=w.useCallback(T=>{g.apply("Change selection",y.selection(T)),t({status:!0,provenanceGraph:g.graph.backend,answers:{}})},[g,y,t]);return p&&u&&c&&o?C.jsxs(ys,{children:[e.allow_guardrail_selector?C.jsx(wS,{shadow:"sm",radius:"md",p:"md",style:{width:"500px"},children:C.jsx(rk,{guardrail:d,setGuardrail:h,dataname:i,setDataname:m,setSelection:a})}):null,C.jsx(Fm,{children:C.jsxs(wS,{shadow:"md",radius:"md",p:"md",withBorder:!0,children:[e.caption===""?null:C.jsx(Fm,{style:{width:"800px"},children:e.caption?C.jsx(wJ,{children:e.caption}):null}),C.jsxs(ei,{noWrap:!0,children:[e.allow_selection===!1&&e.guardrail!=="juxt_data"?null:C.jsx(ei,{noWrap:!0,children:C.jsx(tk,{parameters:e,data:p,dataname:i,items:u,selection:o,setSelection:a,trackSelection:S,range:c,guardrail:d})}),e.allow_selection===!1&&e.guardrail!=="juxt_data"?null:C.jsx(df,{orientation:"vertical",size:"xs"}),C.jsxs(ys,{children:[C.jsxs(ei,{position:"apart",children:[C.jsxs(ys,{spacing:0,justify:"flex-start",children:[C.jsx(rt,{fw:500,children:i==="clean_stocks"?"Percent change in stock price":"Infections per million people"}),d==="super_summ"?C.jsx(rt,{fz:"xs",c:"dimmed",children:"Shaded area contains the industry average and shows the middle 50% of all values in the industry."}):null,d==="juxt_summ"?C.jsx(rt,{fz:"xs",c:"dimmed",children:"Bar on the left highlights the range of selection among all data."}):null]}),e.allow_help?C.jsx(ale,{parameters:e}):null]}),C.jsxs(ys,{children:[C.jsxs(ei,{noWrap:!0,children:[d==="juxt_summ"?C.jsx(ole,{parameters:e,data:p,selection:o,dataname:i}):null,C.jsx(ek,{parameters:e,data:p,dataname:i,items:u,selection:o,range:c,guardrail:d})]}),e.allow_time_slider?C.jsx("div",{style:{width:"500px"},children:C.jsx(nk,{parameters:e,setRange:f,trackRange:b})}):null]})]})]})]})})]}):C.jsx(Xf,{})}const lZe=Object.freeze(Object.defineProperty({__proto__:null,DataExplorer:pH,default:pH},Symbol.toStringTag,{value:"Module"})),cZe=Object.assign({"../public/viz-guardrails/AudioTest.tsx":oVe,"../public/viz-guardrails/Color.tsx":aVe,"../public/viz-guardrails/DataExplorer.tsx":lZe,"../public/viz-guardrails/Help.tsx":uZe,"../public/viz-guardrails/LineChart.tsx":ZHe,"../public/viz-guardrails/RangeSelector.tsx":tWe,"../public/viz-guardrails/Selector.tsx":nWe,"../public/viz-guardrails/Sidebar.tsx":eWe,"../public/viz-guardrails/StripPlot.tsx":aZe,"../public/viz-guardrails/XAxis.tsx":XHe,"../public/viz-guardrails/YAxis.tsx":JHe});function fZe({currentConfig:e,provState:t}){const n=hl(),r=`../public/${e.path}`,i=cZe[r].default,s=Ju(),{updateResponseBlockValidation:o,setIframeAnswers:a}=Xu(),u=w.useCallback(({status:l,provenanceGraph:c,answers:f})=>{s(o({location:"sidebar",currentStep:n,status:l,values:f,provenanceGraph:c})),s(a(Object.values(f).map(d=>d)))},[s,o,n,a]);return C.jsx(w.Suspense,{fallback:C.jsx("div",{children:"Loading..."}),children:C.jsx(i,{parameters:e.parameters,setAnswer:u,provenanceState:t})})}function dZe({currentConfig:e}){const[t,n]=w.useState(null);return w.useEffect(()=>{fetch(`${fl}${e.path}`).then(r=>r.text()).then(r=>n(r))},[e]),t===null?null:C.jsx("div",{style:{maxWidth:700,margin:"0 0"},children:C.jsx(ro,{text:t})})}function bh(){return la(e=>e.config)}function ule(){const e=hl(),{setAlertModal:t}=Xu(),n=Ju();w.useEffect(()=>{(new URLSearchParams(window.location.search).get("admin")||"f")==="t"||(window.history.pushState(null,"",window.location.href),window.onpopstate=()=>{window.history.pushState(null,"",window.location.href),n(t({show:!0,message:"Using the browser's back button is prohibited during the study."}))})},[e,t,n])}function lle({provState:e}){var S;const t=bh(),n=sa(),{trialName:r}=uh(),i=t.components[r],s=Z3(),o=uC(i)&&t.baseComponents?J3({},(S=t.baseComponents)==null?void 0:S[i.baseComponent],i):i,a=o.instruction||"",{instructionLocation:u}=o,l=t.uiConfig.sidebar&&(u==="sidebar"||u===void 0),[c,f]=w.useState(null),d=Ju(),{setIsRecording:h}=Xu(),{trialName:p}=uh(),[m,y]=w.useState(null);w.useEffect(()=>{!p||!t||!t.recordStudyAudio||!n.storageEngine||(c&&m&&n.storageEngine.saveAudio(c,m),t.tasksToNotRecordAudio&&t.tasksToNotRecordAudio.includes(p)?(y(null),f(null),d(h(!1))):(navigator.mediaDevices.getUserMedia({audio:!0}).then(E=>{const I=new MediaRecorder(E);I.start(),f(I),d(h(!0))}),y(p)))},[p]),ule();const{storageEngine:g}=sa(),v=Ju(),{setAlertModal:b}=Xu();return w.useEffect(()=>{(g==null?void 0:g.getEngine())!=="firebase"&&v(b({show:!0,message:"There was an issue connecting to the firebase database. This could be caused by a network issue or your adblocker. If you are using an adblocker, please disable it for this website and refresh."}))},[b,g,v]),C.jsxs(C.Fragment,{children:[u==="aboveStimulus"&&C.jsx(ro,{text:a}),C.jsx(UT,{status:s,config:o,location:"aboveStimulus"},`${r}-above-response-block`),C.jsxs(w.Suspense,{fallback:C.jsx("div",{children:"Loading..."}),children:[o.type==="markdown"&&C.jsx(dZe,{currentConfig:o}),o.type==="website"&&C.jsx(rVe,{currentConfig:o}),o.type==="image"&&C.jsx(sVe,{currentConfig:o}),o.type==="react-component"&&C.jsx(fZe,{currentConfig:o,provState:e})]},`${r}-stimulus`),(u==="belowStimulus"||u===void 0&&!l)&&C.jsx(ro,{text:a}),C.jsx("div",{style:{maxWidth:800,margin:"0 0"},children:C.jsx(UT,{status:s,config:o,location:"belowStimulus"},`${r}-below-response-block`)})]})}function hZe(e){const[t]=h$();return C.jsx(c0e,{...e,to:{pathname:e.to,search:t.toString()}})}function pZe(){const e=bh(),{storageEngine:t}=sa(),{answers:n}=la(s=>s),[r,i]=w.useState(!1);return w.useEffect(()=>{const s=setInterval(async()=>{await t.verifyCompletion(n)&&(i(!0),clearInterval(s))},1e3)},[]),ule(),C.jsx(ua,{style:{height:"100%"},children:C.jsx(Fm,{direction:"column",children:r?C.jsx(rt,{size:"xl",display:"block",children:e.uiConfig.studyEndMsg?C.jsx(ro,{text:e.uiConfig.studyEndMsg}):"Thank you for completing the study. You may close this window now."}):C.jsxs(C.Fragment,{children:[C.jsx(rt,{size:"xl",display:"block",children:"Please wait while your answers are uploaded."}),C.jsx(bT,{h:"lg"}),C.jsx(ua,{children:C.jsx(Xf,{color:"blue"})})]})})})}function mZe(e,t=!1){return typeof e=="number"?mH(e,t):mH(e.length,t).map(r=>r.map(i=>e[i]))}function mH(e,t){if(e<0)throw new Error("Latin square size must be > 0");if(e==0)return[];if(e==1)return[[0]];let n=new Array(e);for(let s=0;s(a+1)%e);r.push(o),i=o}if(t&&e%2>0)for(let s=0;s.5-Math.random());e.components=r}else e.order==="latinSquare"&&t&&(e.components=t[n].pop().map(r=>r.startsWith("_orderObj")?e.components[+r.slice(9)]:r));return e.components.slice(0,e.numSamples?e.numSamples:void 0).flat()}function gZe(e,t){const n=Ig(e);return cle(n,t,"root"),n.components.slice(0,n.numSamples?n.numSamples:void 0).flat()}function fle(e,t,n,r=0){const i=n.length>0?`${n}-${r}`:"root";e.order==="latinSquare"&&t.push(i),e.components.forEach((s,o)=>{typeof s!="string"&&fle(s,t,i,o)})}function yZe(e){const t=[];return fle(e,t,"",0),t}function gH(e,t){const n=t.split("-");let r={};n.forEach(o=>{o==="root"?r=e.sequence:r=r.components[+o]});const i=r.components.map((o,a)=>typeof o=="string"?o:`_orderObj${a}`);return mZe(i.sort(()=>.5-Math.random()),!0)}function vZe(e){const n=yZe(e.sequence).map(s=>({[s]:gH(e,s)})).reduce((s,o)=>({...s,...o}),{}),r=e.uiConfig.numSequences||1e3,i=[];return Array.from({length:r}).forEach(()=>{const s=gZe(e.sequence,n);s.push("end"),i.push(s),Object.entries(n).forEach(([o,a])=>{a.length===0&&(n[o]=gH(e,o))})}),i}var _Ze={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},bZe=Object.defineProperty,wZe=Object.defineProperties,EZe=Object.getOwnPropertyDescriptors,OI=Object.getOwnPropertySymbols,dle=Object.prototype.hasOwnProperty,hle=Object.prototype.propertyIsEnumerable,yH=(e,t,n)=>t in e?bZe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vH=(e,t)=>{for(var n in t||(t={}))dle.call(t,n)&&yH(e,n,t[n]);if(OI)for(var n of OI(t))hle.call(t,n)&&yH(e,n,t[n]);return e},SZe=(e,t)=>wZe(e,EZe(t)),TZe=(e,t)=>{var n={};for(var r in e)dle.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&OI)for(var r of OI(e))t.indexOf(r)<0&&hle.call(e,r)&&(n[r]=e[r]);return n},rd=(e,t,n)=>{const r=w.forwardRef((i,s)=>{var o=i,{color:a="currentColor",size:u=24,stroke:l=2,children:c}=o,f=TZe(o,["color","size","stroke","children"]);return w.createElement("svg",vH(SZe(vH({ref:s},_Ze),{width:u,height:u,stroke:a,strokeWidth:l,className:`tabler-icon tabler-icon-${e}`}),f),[...n.map(([d,h])=>w.createElement(d,h)),...c||[]])});return r.propTypes={color:gt.string,size:gt.oneOfType([gt.string,gt.number]),stroke:gt.oneOfType([gt.string,gt.number])},r.displayName=`${t}`,r},IZe=rd("alert-circle","IconAlertCircle",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 8v4",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]]),xZe=rd("arrows-shuffle","IconArrowsShuffle",[["path",{d:"M18 4l3 3l-3 3",key:"svg-0"}],["path",{d:"M18 20l3 -3l-3 -3",key:"svg-1"}],["path",{d:"M3 7h3a5 5 0 0 1 5 5a5 5 0 0 0 5 5h5",key:"svg-2"}],["path",{d:"M21 7h-5a4.978 4.978 0 0 0 -3 1m-4 8a4.984 4.984 0 0 1 -3 1h-3",key:"svg-3"}]]),CZe=rd("code-dots","IconCodeDots",[["path",{d:"M15 12h.01",key:"svg-0"}],["path",{d:"M12 12h.01",key:"svg-1"}],["path",{d:"M9 12h.01",key:"svg-2"}],["path",{d:"M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2",key:"svg-3"}],["path",{d:"M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2",key:"svg-4"}]]),AZe=rd("code-plus","IconCodePlus",[["path",{d:"M9 12h6",key:"svg-0"}],["path",{d:"M12 9v6",key:"svg-1"}],["path",{d:"M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2",key:"svg-2"}],["path",{d:"M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2",key:"svg-3"}]]),PZe=rd("dots-vertical","IconDotsVertical",[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),OZe=rd("mail","IconMail",[["path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z",key:"svg-0"}],["path",{d:"M3 7l9 6l9 -6",key:"svg-1"}]]),_H=rd("schema","IconSchema",[["path",{d:"M5 2h5v4h-5z",key:"svg-0"}],["path",{d:"M15 10h5v4h-5z",key:"svg-1"}],["path",{d:"M5 18h5v4h-5z",key:"svg-2"}],["path",{d:"M5 10h5v4h-5z",key:"svg-3"}],["path",{d:"M10 12h5",key:"svg-4"}],["path",{d:"M7.5 6v4",key:"svg-5"}],["path",{d:"M7.5 14v4",key:"svg-6"}]]),ple=rd("table","IconTable",[["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}]]);const Ik=["description","instruction","answer","correctAnswer","startTime","endTime","duration","taskOrder"],Yw=["participantId","trialId","responseId"];function Kw(e,t){const n=`data:text/json;charset=utf-8,${encodeURIComponent(e)}`,r=document.createElement("a");r.setAttribute("href",n),r.setAttribute("download",t),document.body.appendChild(r),r.click(),r.remove()}function RZe(e,t,n){return Object.entries(t.components).map(([r,i])=>{const s=uC(i)&&i.baseComponent&&t.baseComponents?J3({},t.baseComponents[i.baseComponent],i):i,o=e.answers[r],a=o!==void 0?o:{answer:{},startTime:-1,endTime:-1,windowEvents:[]},u=a.endTime-a.startTime;return Object.entries(a.answer).map(([c,f])=>{const d={participantId:e.participantId,trialId:r,responseId:c,startTime:new Date(a.startTime).toUTCString(),endTime:new Date(a.endTime).toUTCString(),duration:u};return n.includes("description")&&(d.description=s.description),n.includes("instruction")&&(d.instruction=s.instruction),n.includes("answer")&&(d.answer=f),n.includes("correctAnswer")&&(d.correctAnswer=s.correctAnswer),n.includes("taskOrder")&&(d.taskOrder=e.sequence.indexOf(r)),d}).flat()}).flat()}async function NZe(e,t,n,r=[...Yw,...Ik]){const s=(await t.getAllParticipantsData()).map(l=>RZe(l,n,r)).flat(),o=l=>l.replace(/"/g,'""'),a=s.map(l=>r.map(c=>l===null?"":typeof l[c]=="string"?`"${o(l[c])}"`:JSON.stringify(l[c])).join(",")),u=[r.join(","),...a].join(` `);Kw(u,e)}function kZe({opened:e,close:t,filename:n,studyConfig:r}){const[i,s]=e_e([...Yw,...Ik]),o=w.useCallback(l=>{Yw.every(c=>l.includes(c))&&s(l)},[s]),a=w.useMemo(()=>[...Yw,...Ik],[]),{storageEngine:u}=sa();return u?C.jsxs(zx,{opened:e,size:"lg",onClose:t,title:C.jsx(rt,{size:"xl",children:"Download Tidy CSV"}),centered:!0,radius:"md",padding:"xl",children:[C.jsx(it,{children:C.jsx(See,{searchable:!0,limit:30,nothingFound:"Property not found",data:a,value:i,onChange:o,label:C.jsx(rt,{fw:"bold",size:"lg",children:"Select properties to include in tidy csv:"}),placeholder:"Select atleast one property"})}),C.jsxs(Fm,{mt:"xl",direction:{base:"column",sm:"row"},gap:{base:"sm",sm:"lg"},justify:{sm:"space-around"},children:[C.jsx(Ws,{leftIcon:C.jsx(ple,{}),onClick:()=>NZe(n,u,r,i),children:"Download"}),C.jsx(Ws,{onClick:t,color:"red",children:"Close"})]})]}):null}function DZe({studyConfig:e}){const{storageEngine:t}=sa(),[n,{open:r,close:i}]=I$(!1),[s,o]=w.useState(),[a,u]=w.useState(""),l=e.studyMetadata.title.replace(" ","_");w.useEffect(()=>{async function m(){if(t){const y=await t.getCurrentParticipantId(),g=await t.getParticipantData();u(y),o(g)}}m()},[t]);const c=w.useCallback(async()=>{Kw(JSON.stringify(s,null,2),`${l}_${a}.json`)},[s]),f=e.uiConfig.autoDownloadStudy||!1,d=f&&e.uiConfig.autoDownloadTime||-1,[h,p]=w.useState(Math.floor(d/1e3));return w.useEffect(()=>{const m=setInterval(()=>{p(y=>y-1)},1e3);return h<=0?(c(),clearInterval(m),()=>clearInterval(m)):()=>clearInterval(m)},[h]),C.jsxs(ys,{children:[C.jsx(Ws,{leftIcon:C.jsx(CZe,{}),onClick:()=>Kw(JSON.stringify(s,null,2),`${l}_${a}.json`),display:"block",children:"Download Current (JSON)"}),C.jsx(Ws,{disabled:!(t!=null&&t.isConnected()),leftIcon:C.jsx(AZe,{}),onClick:async()=>{if(!t)return;const m=await t.getAllParticipantsData();Kw(JSON.stringify(m,null,2),`${l}_all.json`)},display:"block",children:"Download All (JSON)"}),C.jsx(Ws,{disabled:!(t!=null&&t.isConnected()),leftIcon:C.jsx(ple,{}),onClick:r,display:"block",children:"Download All (Tidy)"}),f&&C.jsxs(rt,{size:"lg",children:["Study results will be downloaded in"," ",h," ","seconds. If the download does not start automatically, click above to download."]}),C.jsx(kZe,{opened:n,close:i,filename:`${l}_${a}.csv`,studyConfig:e})]})}function nA(e){return e.components.flatMap(t=>typeof t=="string"?t:nA(t))}function bH(e,t){return nA(t).find(i=>e.indexOf(i)!==-1)}function $Ze(e,t){return nA(t).filter(i=>e.indexOf(i)!==-1)}function LZe({step:e,currentStep:t,sequence:n,task:r,studyId:i}){const s=Kf(),[o,{close:a,open:u}]=I$(!1);return C.jsxs(yi,{position:"left",withArrow:!0,arrowSize:10,shadow:"md",opened:o,offset:20,children:[C.jsx(yi.Target,{children:C.jsx("div",{onMouseEnter:u,onMouseLeave:a,children:C.jsx(Cee,{active:e===t,style:{lineHeight:"32px",height:"32px"},label:C.jsx("div",{style:{opacity:n.indexOf(e)===-1?".3":1},children:e===t?C.jsx("strong",{children:e}):e}),onClick:()=>s(`/${i}/${e}`),disabled:n.indexOf(e)===-1})})}),r&&(r.description||r.meta)&&lc.createPortal(C.jsx(yi.Dropdown,{onMouseLeave:a,children:C.jsx(rt,{size:"sm",children:C.jsxs("div",{children:[r.description&&C.jsxs("div",{children:[C.jsx(rt,{fw:900,display:"inline-block",mr:2,children:"Description:"}),C.jsx(rt,{fw:400,component:"span",children:r.description})]}),r.meta&&C.jsxs(rt,{children:[C.jsx(rt,{fw:"900",component:"span",children:"Task Meta: "}),C.jsx("pre",{style:{margin:0,padding:0},children:`${JSON.stringify(r.meta,null,2)}`})]})]})})}),document.body)]})}function mle({sequence:e,order:t,depth:n=0}){const{studyId:r=null}=uh(),i=hl(),s=bh(),o=w.useMemo(()=>{const a=Ig(t);return a.components.sort((u,l)=>{const c=typeof u=="string"?u:bH(e,u),f=typeof l=="string"?l:bH(e,l),d=c?e.indexOf(c):1e4,h=f?e.indexOf(f):1e4;return(d===-1?1e4:d)-(h===-1?1e4:h)}),a},[t,e]);return C.jsx("div",{children:o.components.map((a,u)=>{if(typeof a=="string"){const f=a in s.components&&s.components[a];return C.jsx(LZe,{currentStep:i,sequence:e,step:a,studyId:r,task:f},u)}const l=nA(a),c=$Ze(e,a);return C.jsx(Cee,{label:C.jsxs("div",{style:{opacity:c.length?1:.5},children:["Group:",C.jsxs(_Ie,{ml:5,children:[c.length,"/",l.length]}),C.jsx(rt,{c:"dimmed",display:"inline",mr:5,ml:5,children:a.order}),a.order==="random"||a.order==="latinSquare"?C.jsx(xZe,{size:"15",opacity:.5,style:{marginLeft:"5px",verticalAlign:"middle"}}):null]}),defaultOpened:!0,childrenOffset:32,style:{lineHeight:"32px",height:"32px",position:"sticky",top:`${32*n}px`,backgroundColor:"#fff"},children:C.jsx("div",{style:{borderLeft:"1px solid #e9ecef"},children:C.jsx(mle,{order:a,sequence:e,depth:n+1})})},u)})})}function MZe(){const{showAdmin:e,sequence:t}=la(s=>s),n=hl(),r=bh(),i=w.useMemo(()=>{const s=Ig(r.sequence);return s.components.push("end"),s},[r.sequence]);return e||n==="end"&&r.uiConfig.autoDownloadStudy?C.jsx(C$,{p:"0",width:{base:300},style:{zIndex:0},children:C.jsxs(R$,{p:"0",children:[n==="end"&&C.jsxs("div",{style:{padding:10,paddingBottom:15,borderBottom:"1px solid #e9ecef"},children:[C.jsx(rt,{size:"md",p:10,weight:"bold",children:"Download"}),C.jsx(DZe,{studyConfig:r})]}),C.jsx(rt,{size:"md",p:10,weight:"bold",children:"Study Sequence"}),C.jsx(mle,{order:i,sequence:t})]})}):null}const gle=w.createContext(null),mM=({id:e="waveform",children:t})=>N.createElement("div",{id:e},t),FZe=["audioRate","audioContext","audioScriptProcessor","autoCenter","backend","backgroundColor","barGap","barHeight","barMinHeight","barRadius","barWidth","closeAudioContext","cursorColor","cursorWidth","fillParent","forceDecode","height","hideScrollbar","interact","loopSelection","maxCanvasWidth","mediaControls","mediaType","minPxPerSec","normalize","partialRender","pixelRatio","progressColor","removeMediaElementOnDestroy","renderer","responsive","scrollParent","skipLength","splitChannels","waveColor","autoCenterRate","autoCenterImmediately","drawingContextAttributes","duration","ignoreSilenceMode","rtl","splitChannelsOptions","vertical","xhr"],BZe=e=>e?FZe.reduce((t,n)=>Object.prototype.hasOwnProperty.call(e,n)?Object.assign(Object.assign({},t),{[n]:e[n]}):t,{}):{};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. diff --git a/index.html b/index.html index 776650055..26487c2ec 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ }(window.location)) - +
diff --git a/stage-3/config-stage-3.json b/stage-3/config-stage-3.json index 219ff745e..edf94b61d 100644 --- a/stage-3/config-stage-3.json +++ b/stage-3/config-stage-3.json @@ -53,7 +53,7 @@ "id": "agree", "type": "likert", "location": "belowStimulus", - "prompt": "The visualization supports the idea that stock C yielded the highest returns in the industry in 2023:", + "prompt": "The visualization supports the idea that stock C yielded the highest returns in the entire industry in 2023:", "preset": 5, "leftLabel": "Strongly disagree", "rightLabel": "Strongly agree", @@ -112,7 +112,7 @@ "id": "agree", "type": "likert", "location": "belowStimulus", - "prompt": "The visualization supports the idea that stock E yielded the highest returns in the industry in 2023:", + "prompt": "The visualization supports the idea that stock E yielded the highest returns in the entire industry in 2023:", "preset": 5, "leftLabel": "Strongly disagree", "rightLabel": "Strongly agree", @@ -177,7 +177,7 @@ "id": "agree", "type": "likert", "location": "belowStimulus", - "prompt": "The visualization supports the idea that stock A yielded the highest returns in the industry in 2023:", + "prompt": "The visualization supports the idea that stock A yielded the highest returns in the entire industry in 2023:", "preset": 5, "leftLabel": "Strongly disagree", "rightLabel": "Strongly agree", @@ -492,21 +492,9 @@ "order": "latinSquare", "numSamples": 1, "components": [ - "stock-simple-a-n", - "stock-simple-a-sd", "stock-simple-a-ss", - "stock-simple-a-jd", - "stock-simple-a-js", - "stock-simple-e-n", - "stock-simple-e-sd", "stock-simple-e-ss", - "stock-simple-e-jd", - "stock-simple-e-js", - "stock-simple-c-n", - "stock-simple-c-sd", - "stock-simple-c-ss", - "stock-simple-c-jd", - "stock-simple-c-js" + "stock-simple-c-ss" ] } ]