import{r as e,H as b,n as w,G as h,I as v}from"./index.72e24882.js";import{C as y}from"./choose-partition.93f44af2.js";import{B as i,a as C}from"./browse.0916686d.js";import{F as S}from"./FormLabel.a3eda031.js";import{I as A,S as I,M as P,F as k}from"./TextField.8d6efd58.js";import{D}from"./DataGrid.b013c811.js";import"./Input.ed778d26.js";import"./toPropertyKey.012fc217.js";import"./Checkbox.841ff07f.js";import"./FormControlLabel.93f22896.js";const B=t=>{const o=t.item.data.attributes.structure.npartitions,[n,s]=e.exports.useState(0),[r,a]=e.exports.useState([]),[m,c]=e.exports.useState(!1),u=t.item.data.attributes.structure.columns;e.exports.useEffect(()=>{const l=new AbortController,d=t.item.data.links.partition.replace("{index}",n);async function x(){var g=await C.get(`${d}&format=application/json-seq`,{signal:l.signal});const f=g.data.split(`
`).map(E=>JSON.parse(E));a(f),c(!0)}return x(),()=>{l.abort()}},[t.segments,t.item.data.links.full,t.item.data.links.partition,n]);const p=l=>{a([]),c(!1),s(l)};return e.exports.createElement(i,{sx:{my:4}},e.exports.createElement(b,{maxWidth:"lg"},e.exports.createElement(T,{segments:t.segments,columns:u}),e.exports.createElement(i,{width:"100%",mt:5},e.exports.createElement(w,{id:"table-title",variant:"h6",component:"h2"},"Table"),o>1?e.exports.createElement(i,null,e.exports.createElement(h,{severity:"info"},"This large table is available in ",e.exports.createElement("em",null,"partitions")," (chunks of rows) because the full table may be slow to download and display.",e.exports.createElement("br",null),'In the "Download" tab, you can request the full table as a single file if you wish.'),e.exports.createElement(y,{npartitions:o,value:n,setValue:p})):"",e.exports.createElement(_,{rows:r,columns:u,loading:!m}))))},T=t=>{let o=v();const n=s=>{const r=s.target.value;o(`/browse${t.segments.map(function(a){return"/"+a}).join("")}/${r}`)};return e.exports.createElement(i,null,e.exports.createElement(S,null,e.exports.createElement(A,{id:"column-select-helper-label"},"Go to Column"),e.exports.createElement(I,{labelId:"column-select-label",id:"column-select",value:"",label:"Column",onChange:n},t.columns.map(s=>e.exports.createElement(P,{key:`column-${s}`,value:s},s))),e.exports.createElement(k,null,"Access a single column as an Array.")))},F=10,_=t=>{const[o,n]=e.exports.useState(F),s=t.columns.map(a=>({field:a,headerName:a,width:200})),r=t.rows.map((a,m)=>(a.id=m,a));return e.exports.createElement(D,{...t.loading?{loading:!0}:{},rows:r,columns:s,pagination:!0,pageSize:o,rowsPerPageOptions:[10,30,100],onPageSizeChange:a=>n(a),autoHeight:!0})};export{B as default};
