PageSourceSearch

https://exploremydata.com/assets/view-4XAxPa3d.js

js exploremydata.com collected 2026-09-25 20:07:39 UTC 58,496 bytes, 13 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/textToCsv-CVZHs0IY.js","assets/util-CkZ8KZK2.js","assets/csvShared-8k83eY5V.js","assets/vendor-papaparse-Btpkh8vH.js","assets/cjs-helpers-D6-XlEtG.js","assets/detectTableRegion-B60ufQHb.js","assets/jsonFlatten-BvwKgkrC.js","assets/jsonRelaxed-DdfPn7XG.js","assets/xmlToCsv-DiDxuxdQ.js","assets/xmlParser-BQP2i025.js","assets/duckdbLite-BZJanxnx.js","assets/duckdb-wasm-Dy5MCI5t.js","assets/vendor-arrow-A8Yy6zVL.js","assets/vendor-BeeS_Sk0.js","assets/vendor-DB0Q8XAf.css","assets/sqliteParser-D406xhIa.js","assets/vite-preload-ckwbz45p.js","assets/pdfParser-BPKa0u6N.js","assets/polyfills-1THQ3rSd.js","assets/vendor-fflate-CXh1ITwj.js","assets/staleBundle-B9uSr-c7.js","assets/schemaGrouping-Cr-OBP6k.js","assets/docParser-hcQtJ3mo.js","assets/viewTree-CFfBg-Zl.js","assets/dom-D3eB0Nlx.js"])))=>i.map(i=>d[i]);
2var fe=Object.defineProperty;var me=(r,e,t)=>e in r?fe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var m=(r,e,t)=>me(r,typeof e!="symbol"?e+"":e,t);import{_ as $}from"./vite-preload-ckwbz45p.js";import{escapeHtml as E,formatCount as b,formatBytes as Z,stripExtension as pe,extensionOf as we,emptyPreview as ge}from"./util-CkZ8KZK2.js";import{el as v}from"./dom-D3eB0Nlx.js";import{p as Q}from"./promptDialog-CqM-wAnZ.js";import{r as be,p as ye,a as xe,d as ve}from"./detectTableRegion-B60ufQHb.js";import{delimiterFromOption as Ce}from"./csvShared-8k83eY5V.js";import"./vendor-papaparse-Btpkh8vH.js";import"./cjs-helpers-D6-XlEtG.js";class $e{constructor(e=1024){m(this,"buffer");m(this,"length",0);this.buffer=new Uint32Array(Math.max(1,e))}push(e){if(this.length===this.buffer.length){const t=new Uint32Array(this.buffer.length*2);t.set(this.buffer),this.buffer=t}this.buffer[this.length++]=e}get size(){return this.length}finish(){return this.buffer.slice(0,this.length)}}class F{constructor(e){m(this,"parts",[]);m(this,"cursor",0);m(this,"offsets",new $e);this.name=e,this.offsets.push(0)}push(e){this.parts.push(e),this.cursor+=e.length,this.offsets.push(this.cursor),this.parts.length>=4096&&(this.parts=[this.parts.join("")])}get rowCount(){return this.offsets.size-1}finish(){return{name:this.name,text:this.parts.join(""),offsets:this.offsets.finish()}}}function A(r,e){var s;const t=r.map(n=>new F(n));for(const n of e)for(let i=0;i<t.length;i++)(s=t[i])==null||s.push(n[i]??"");return{columns:t.map(n=>n.finish()),rowCount:e.length}}function R(r,e,t){const s=r.columns[t];return!s||e<0||e>=r.rowCount?"":s.text.slice(s.offsets[e],s.offsets[e+1])}const Ee=2e3,ke=new Set(["true","false","yes","no","y","n","t","f","0","1"]),Te=new Set(["true","false","yes","no"]),Se=new Set(["","-","n/a","na","null","nil","none","#n/a","nan"]),_e=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Re=/^(https?:\/\/|www\.)\S+$/i,Le=/^\+?[\d][\d\s().-]{6,20}$/,Ae=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,De=/^\d{1,2}\/\d{1,2}\/\d{2,4}$/,Me=/^\d{1,2}\.\d{1,2}\.\d{4}$/,Ie=/^\d{1,2}[ -](jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*[ -]\d{2,4}$/i,Pe=/[$£€¥₹]/,Oe=/^0\d/;function re(r){return Se.has(r.trim().toLowerCase())}function J(r){const e=r.trim();if(e==="")return null;let t=e.replace(/^[$£€¥₹]\s?/,"").replace(/\s?[$£€¥₹]$/,""),s=!1;if(/^\(.*\)$/.test(t)&&(s=!0,t=t.slice(1,-1)),t.endsWith("%")&&(t=t.slice(0,-1)),t=t.replace(/,/g,"").trim(),t===""||!/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(t))return null;const i=Number(t);return Number.isFinite(i)?s?-i:i:null}function N(r){const e=r.trim();if(e==="")return null;if(Ae.test(e)){const t=Date.parse(e.length===10?`${e}T00:00:00Z`:e);return Number.isNaN(t)?null:t}if(De.test(e)||Me.test(e)||Ie.test(e)){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function Ne(r,e,t){const s={nonBlank:0,numeric:0,integer:0,date:0,boolean:0,strictBoolean:0,email:0,url:0,phone:0,currency:0,percent:0,leadingZero:0,distinct:new Set,blanks:0};for(let n=0;n<t;n++){const o=R(r,n,e).trim();if(o===""||re(o)){s.blanks++;continue}s.nonBlank++,s.distinct.size<=512&&s.distinct.add(o);const a=o.toLowerCase();ke.has(a)&&s.boolean++,Te.has(a)&&s.strictBoolean++,Oe.test(o)&&s.leadingZero++,Pe.test(o)&&s.currency++,o.endsWith("%")&&s.percent++;const c=J(o);c!==null?(s.numeric++,Number.isInteger(c)&&!o.includes(".")&&s.integer++):N(o)!==null?s.date++:_e.test(o)?s.email++:Re.test(o)?s.url++:Le.test(o)&&s.phone++,c===null&&N(o)}return s}const O=.9;function Be(r,e,t){var d;const s=Math.min(r.rowCount,Ee),n=((d=r.columns[e])==null?void 0:d.name)??`column_${e+1}`,i=Ne(r,e,s),o=i.nonBlank;let a="text";if(o>0){const h=u=>u/o;i.leadingZero>0&&h(i.numeric)>=O?a="text":i.strictBoolean===o?a="boolean":h(i.numeric)>=O?a=i.integer===i.numeric?"integer":"number":h(i.date)>=O?a="date":h(i.boolean)===1&&i.distinct.size<=2&&(a="boolean")}const c=qe(n,a,i,o);return{name:n,type:a,role:c,align:a==="integer"||a==="number"?"right":"left",sampled:o,blanks:i.blanks,leadingZeros:i.leadingZero>0}}function qe(r,e,t,s){const n=r.toLowerCase();if(s===0)return"text";const i=o=>o/s;return i(t.email)>=.8?"email":i(t.url)>=.8?"url":e==="date"?"date":i(t.currency)>=.8?"currency":i(t.percent)>=.8?"percent":e==="text"&&i(t.phone)>
2=.8?"phone":e==="text"&&t.leadingZero>0&&i(t.numeric)>=O||/(^|[_\s-])(id|uuid|guid|key|code|sku|isbn)([_\s-]|$)/.test(n)?"id":/(price|amount|revenue|cost|total|salary|spend|sales|fee|balance)/.test(n)&&(e==="number"||e==="integer")?"currency":e==="integer"&&/(count|qty|quantity|units|number|n_|num_)/.test(n)?"count":e==="integer"||e==="number"?"measure":e==="text"&&t.distinct.size<=50&&t.distinct.size*2<=s||e==="boolean"?"category":"text"}const V={integer:"int",number:"num",date:"date",boolean:"bool",text:"text"},U={currency:"currency",percent:"percent",email:"email",url:"url",id:"id",phone:"phone",date:"date",count:"count",measure:"measure",category:"category",text:"text"},He=1e5,W=2e5;function je(r,e,t,s){const n=r.rowCount,i=Math.min(n,W),o=new Map;let a=!1,c=0;const l=[];let d=1/0,h=-1/0,u="",f="";for(let w=0;w<i;w++){const x=R(r,w,e).trim();if(x===""||re(x)){c++;continue}if(o.size<He?o.set(x,(o.get(x)??0)+1):a=!0,t.type==="integer"||t.type==="number"){const C=J(x);C!==null&&l.push(C)}else if(t.type==="date"){const C=N(x);C!==null&&(C<d&&(d=C,u=x),C>h&&(h=C,f=x))}}const p={name:t.name,type:t.type,role:t.role,rows:i,blanks:c,distinct:o.size,distinctCapped:a};if(l.length>0){l.sort((y,x)=>y-x);let w=0;for(const y of l)w+=y;const g=l.length>>1;p.numeric={min:l[0],max:l[l.length-1],mean:w/l.length,median:l.length%2===1?l[g]:(l[g-1]+l[g])/2,sum:w}}return u!==""&&(p.dates={min:u,max:f}),p.top=[...o.entries()].sort((w,g)=>g[1]-w[1]||(w[0]<g[0]?-1:1)).slice(0,5).map(([w,g])=>({value:w,count:g})),p}function G(r,e,t,s,n){const i=n.type==="integer"||n.type==="number",o=n.type==="date",a=new Float64Array(i||o?r.rowCount:0);if(i||o)for(let u=0;u<e.length;u++){const f=e[u],p=R(r,f,t).trim(),w=i?J(p):N(p);a[f]=w===null?NaN:w}const c=s==="asc"?1:-1,l=e.slice(),d=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),h=Array.from(l).sort((u,f)=>{if(i||o){const y=a[u],x=a[f],C=Number.isNaN(y),_=Number.isNaN(x);return C&&_?u-f:C?1:_?-1:y===x?u-f:(y<x?-1:1)*c}const p=R(r,u,t),w=R(r,f,t);if(p===""&&w==="")return u-f;if(p==="")return 1;if(w==="")return-1;const g=d.compare(p,w);return g===0?u-f:g*c});return Uint32Array.from(h)}function ze(r,e,t){const s=t.trim().split(/\s+/).filter(a=>a.length>0);if(s.length===0)return null;const n=e.map(a=>a.toLowerCase()),i=s.map(a=>{const c=a.indexOf(":");if(c>0){const l=n.indexOf(a.slice(0,c).toLowerCase());if(l>=0)return{col:l,needle:a.slice(c+1).toLowerCase()}}return{col:-1,needle:a.toLowerCase()}}),o=[];for(let a=0;a<r.rowCount;a++){let c=!0;for(const l of i){if(l.needle==="")continue;let d=!1;if(l.col>=0)d=R(r,a,l.col).toLowerCase().includes(l.needle);else for(let h=0;h<r.columns.length;h++)if(R(r,a,h).toLowerCase().includes(l.needle)){d=!0;break}if(!d){c=!1;break}}c&&o.push(a)}return Uint32Array.from(o)}function I(r){const e=new Uint32Array(r);for(let t=0;t<r;t++)e[t]=t;return e}class Fe{constructor(e){m(this,"store");m(this,"refs");m(this,"nextColId");m(this,"nextAddedId",-1);m(this,"edits",new Map);m(this,"deleted",new Set);m(this,"addedIds",[]);m(this,"undoStack",[]);m(this,"redoStack",[]);m(this,"metaCache",new Map);m(this,"order");m(this,"sort",null);m(this,"query","");this.store=e,this.refs=e.columns.map((t,s)=>({id:s,name:t.name,source:s})),this.nextColId=e.columns.length,this.order=Int32Array.from(I(e.rowCount))}get columns(){return this.refs}get names(){return this.refs.map(e=>e.name)}get visibleRows(){return this.order.length}get totalRows(){return this.store.rowCount+this.addedIds.length-this.deleted.size}get fileRows(){return this.store.rowCount}get edited(){return this.edits.size>0||this.deleted.size>0||this.addedIds.length>0}value(e,t){const s=this.edits.get(e);if(s){const i=s.get(t);if(i!==void 0)return i}if(e<0)return"";const n=this.refs.find(i=>i.id===t);return!n||n.source===null?"":R(this.store,e,n.source)}rowValues(e){return this.refs.map(t=>this.value(e,t.id))}columnMeta(e){const t=this.metaCache.get(e);if(t)return t;const s=this.refs.find(i=>i.id===e),n=s&&s.source!==null?{...Be(this.store,s.source),name:s.name}:{name:(s==null?void 0:s.name)??"",type:"text",role:"text",align:"left",sampled:0,blanks:0,leadingZeros:!1};return this.metaCache.set(e,n),n}storeFor(e){const t=this.refs.find(s=>s.id===e);return!t||t.source===null?null:{store:this.store,index:t.source}}reorder(){const e=this.query.trim()===""?I(this.store.rowCount):ze(this.store,this.storeNames(),this.query)??I(this.store.rowCount);let t=[];for(let n=0;n<e.length;n++){const i=e[n];this.deleted.has(i)||t.push(i)}for(const n of this.addedIds)this.deleted.has(n)||(this.query.trim()===""||this.matchesOverlay(n))&&t.pu
2sh(n);if(this.query.trim()!==""&&this.edits.size>0){const n=new Set(t);for(const i of this.edits.keys()){if(i<0||this.deleted.has(i))continue;const o=this.matchesOverlay(i);o&&!n.has(i)&&t.push(i),!o&&n.has(i)&&(t=t.filter(a=>a!==i))}t.sort((i,o)=>(i??0)<0||(o??0)<0?0:(i??0)-(o??0))}let s=Int32Array.from(t);this.sort&&(s=this.sortIds(s,this.sort.colId,this.sort.direction)),this.order=s}storeNames(){return this.refs.filter(e=>e.source!==null).map(e=>{var t;return((t=this.store.columns[e.source])==null?void 0:t.name)??e.name})}matchesOverlay(e){const t=this.query.trim().toLowerCase().split(/\s+/).filter(Boolean),s=this.rowValues(e).map(n=>n.toLowerCase());return t.every(n=>{const i=n.indexOf(":");if(i>0){const o=this.refs.findIndex(a=>a.name.toLowerCase()===n.slice(0,i));if(o>=0)return(s[o]??"").includes(n.slice(i+1))}return s.some(o=>o.includes(n))})}sortIds(e,t,s){const n=this.refs.find(d=>d.id===t);if(!n)return e;const i=this.columnMeta(t);if(n.source!==null&&this.edits.size===0&&this.addedIds.length===0){const d=new Uint32Array(e.length);for(let f=0;f<e.length;f++)d[f]=e[f]??0;const h=G(this.store,d,n.source,s,i),u=new Int32Array(h.length);for(let f=0;f<h.length;f++)u[f]=h[f]??0;return u}const a=A([n.name],Array.from(e,d=>[this.value(d,t)])),c=G(a,I(e.length),0,s,i),l=new Int32Array(c.length);for(let d=0;d<c.length;d++)l[d]=e[c[d]??0]??0;return l}setQuery(e){this.query=e,this.reorder()}toggleSort(e){var t;((t=this.sort)==null?void 0:t.colId)===e?this.sort=this.sort.direction==="asc"?{colId:e,direction:"desc"}:null:this.sort={colId:e,direction:"asc"},this.reorder()}applyCell(e,t){const s=t?e.next:e.prev;let n=this.edits.get(e.rowId);if(s===void 0){n==null||n.delete(e.colId),n&&n.size===0&&this.edits.delete(e.rowId);return}n||(n=new Map,this.edits.set(e.rowId,n)),n.set(e.colId,s)}overlayOf(e,t){var s;return(s=this.edits.get(e))==null?void 0:s.get(t)}setCells(e){const t=[];for(const s of e){const n=this.overlayOf(s.rowId,s.colId);
2this.value(s.rowId,s.colId)!==s.value&&t.push({rowId:s.rowId,colId:s.colId,...n!==void 0?{prev:n}:{},next:s.value})}if(t.length!==0){for(const s of t)this.applyCell(s,!0);this.push({kind:"cells",changes:t})}}setCell(e,t,s){this.setCells([{rowId:e,colId:t,value:s}])}addRow(e=1){const t=[];for(let s=0;s<e;s++)t.push(this.nextAddedId--);return this.addedIds.push(...t),this.push({kind:"addRows",ids:t}),this.reorder(),t}deleteRows(e){const t=e.filter(s=>!this.deleted.has(s));if(t.length!==0){for(const s of t)this.deleted.add(s);this.push({kind:"deleteRows",ids:t}),this.reorder()}}addColumn(e,t=this.refs.length){const s={id:this.nextColId++,name:this.uniqueName(e),source:null};return this.refs.splice(t,0,s),this.push({kind:"addColumn",ref:s,at:t}),s}deleteColumn(e){const t=this.refs.findIndex(i=>i.id===e);if(t<0||this.refs.length===1)return;const s=this.refs[t],n=[];for(const[i,o]of this.edits){const a=o.get(e);a!==void 0&&n.push({rowId:i,colId:e,prev:a})}for(const i of n)this.applyCell(i,!0);this.refs.splice(t,1),this.metaCache.delete(e),this.push({kind:"deleteColumn",ref:s,at:t,values:n})}renameColumn(e,t){const s=this.refs.find(o=>o.id===e);if(!s)return;const n=this.uniqueName(t.trim()===""?s.name:t.trim(),e);if(n===s.name)return;const i=s.name;s.name=n,this.metaCache.delete(e),this.push({kind:"rename",colId:e,prev:i,next:n})}uniqueName(e,t){const s=new Set(this.refs.filter(i=>i.id!==t).map(i=>i.name));if(!s.has(e))return e;let n=2;for(;s.has(`${e}_${n}`);)n++;return`${e}_${n}`}pasteBlock(e,t,s){const n=[];let i=!1;for(let o=0;o<s.length;o++){const a=this.order[e+o],c=s[o];if(a===void 0||!c){i=!0;break}for(let l=0;l<c.length;l++){const d=this.refs[t+l];if(!d){i=!0;continue}n.push({rowId:a,colId:d.id,value:c[l]??""})}}return this.setCells(n),{clipped:i}}replaceAll(e){const t=Ve(e);if(!t)return 0;const s=e.colId===null?this.refs:this.refs.filter(i=>i.id===e.colId),n=[];for(let i=0;i<this.order.length;i++){const o=this.order[i];for(const a of s){const c=this.value(o,a.id),l=t(c);l!==null&&l!==c&&n.push({rowId:o,colId:a.id,value:l})}}return this.setCells(n),n.length}findMatches(e,t=5e3){const s=ae(e);if(!s)return[];const n=e.colId===null?this.refs.map((o,a)=>a):[this.refs.findIndex(o=>o.id===e.colId)].filter(o=>o>=0),i=[];for(let o=0;o<this.order.length&&i.length<t;o++){const a=this.order[o];for(const c of n){const l=this.refs[c];if(l&&s(this.value(a,l.id))&&i.push({row:o,col:c}),i.length>=t)break}}return i}push(e){this.undoStack.push(e),this.redoStack=[],this.undoStack.length>200&&this.undoStack.shift()}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}undo(){const e=this.undoStack.pop();return e?(this.invert(e,!1),this.redoStack.push(e),this.reorder(),!0):!1}redo(){const e=this.redoStack.pop();return e?(this.invert(e,!0),this.undoStack.push(e),this.reorder(),!0):!1}invert(e,t){switch(e.kind){case"cells":for(const s of e.changes)this.applyCell(s,t);break;case"addRows":t?this.addedIds.push(...e.ids):this.addedIds=this.addedIds.filter(s=>!e.ids.includes(s));break;case"deleteRows":for(const s of e.ids)t?this.deleted.add(s):this.deleted.delete(s);break;case"addColumn":t?this.refs.splice(e.at,0,e.ref):this.refs=this.refs.filter(s=>s.id!==e.ref.id);break;case"deleteColumn":if(t){for(const s of e.values)this.applyCell(s,!0);this.refs=this.refs.filter(s=>s.id!==e.ref.id)}else{this.refs.splice(e.at,0,e.ref);for(const s of e.values)this.applyCell(s,!1)}break;case"rename":{const s=this.refs.find(n=>n.id===e.colId);s&&(s.name=t?e.next:e.prev),this.metaCache.delete(e.colId);break}}}}function ae(r){if(r.find==="")return null;if(r.regex){let t;try{t=new RegExp(r.find,r.caseSensitive?"":"i")}catch{return null}return s=>r.wholeCell?new RegExp(`^(?:${t.source})$`,t.flags).test(s):t.test(s)}const e=r.caseSensitive?r.find:r.find.toLowerCase();return t=>{const s=r.caseSensitive?t:t.toLowerCase();return r.wholeCell?s===e:s.includes(e)}}function Ve(r){const e=ae(r);if(!e)return null;if(r.regex){let t;try{t=new RegExp(r.find,r.caseSensitive?"g":"gi")}catch{return null}return s=>e(s)?r.wholeCell?r.replace:(t.lastIndex=0,s.replace(t,r.replace)):null}return t=>{if(!e(t))return null;if(r.wholeCell)return r.replace;if(r.caseSensitive)return t.split(r.find).join(r.replace);const s=r.find.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return t.replace(new RegExp(s,"gi"),r.replace)}}function Ue(r){const e=r.replace(/\r\n?/g,`
3`).replace(/\n$/,"");return e===""?[]:e.split(`
4`).map(t=>t.split("	"))}const D=28,ee=52,te=8,se=96,We=320,j="inline-flex min-h-[30px] items-center justify-center gap-1 rounded-lg border border-border bg-surface px-2.5 py-1 text-xs font-medium text-text-secondary transition-colors hover:border-accent hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40",P="rounded-lg border border-border bg-surface px-2 py-1 text-xs text-text-primary placeholder:text-text-tertiary";class Ke{constructor(e,t,s){m(this,"model");m(this,"host");m(this,"options");m(this,"viewport");m(this,"spacer");m(this,"body");m(this,"headRow");m(this,"status");m(this,"popover",null);m(this,"editorCell",null);m(this,"widths",[]);m(this,"freeze",0);m(this,"selection",null);m(this,"anchor",null);m(this,"dragging",!1);m(this,"firstPainted",-1);m(this,"lastPainted",-1);m(this,"disposed",!1);m(this,"findState",{find:"",replace:"",regex:!1,caseSensitive:!1,wholeCell:!1,colId:null});m(this,"findHits",[]);m(this,"findIndex",0);m(this,"onCellMouseDown",e=>{const t=this.cellFrom(e.target);t&&(this.viewport.focus({preventScroll:!0}),e.shiftKey&&this.anchor?this.selection={r1:this.anchor.r,c1:this.anchor.c,r2:t.r,c2:t.c}:(this.anchor=t,this.selection={r1:t.r,c1:t.c,r2:t.r,c2:t.c},this.dragging=!0),this.paintBody(!0))});m(this,"onCellMouseOver",e=>{if(!this.dragging||!this.anchor)return;const t=this.cellFrom(e.target);t&&(this.selection={r1:this.anchor.r,c1:this.anchor.c,r2:t.r,c2:t.c},this.paintBody(!0))});m(this,"onDocumentMouseUp",()=>{this.dragging=!1});m(this,"onDocumentClick",e=>{this.popover&&(e.target instanceof Node&&this.popover.contains(e.target)||this.closePopover())});m(this,"onCellDoubleClick",e=>{const t=this.cellFrom(e.target);t&&this.startEdit(t.r,t.c)});this.host=e,this.options=s,this.model=new Fe(t),this.model.reorder(),this.measure(),this.build()}get table(){return this.model}dispose(){this.disposed=!0,this.closePopover(),document.removeEventListener("mouseup",this.onDocumentMouseUp),document.removeEventListener("click",this.onDocumentClick,!0),this.host.innerHTML=""}measure(){const e=this.model.columns;this.widths=e.map((t,s)=>{let n=t.name.length;const i=Math.min(this.model.order.length,60);for(let o=0;o<i;o++){const a=this.model.value(this.model.order[o],t.id);a.length>n&&(n=a.length)}return Math.max(se,Math.min(We,22+n*7.4))})}build(){this.host.innerHTML="",this.host.className="flex flex-col gap-2",this.host.appendChild(this.buildToolbar()),this.options.editable&&this.host.appendChild(this.buildFindPanel());const e=v("div","relative overflow-hidden rounded-lg border border-border bg-surface");this.viewport=v("div","relative overflow-auto"),this.viewport.style.height="26rem",this.viewport.tabIndex=0,this.viewport.setAttribute("role","grid"),this.viewport.setAttribute("aria-label",`${this.options.filename} table`),this.viewport.dataset.qc="view-grid",this.headRow=v("div","sticky top-0 z-20 flex w-max border-b border-border bg-surface-secondary"),this.headRow.style.height=`${ee}px`,this.spacer=v("div","relative w-max"),this.body=v("div","absolute left-0 top-0 w-max will-change-transform"),this.spacer.appendChild(this.body),this.viewport.append(this.headRow,this.spacer),e.appendChild(this.viewport),this.host.appendChild(e),this.status=v("p","text-xs text-text-tertiary"),this.status.setAttribute("role","status"),this.host.appendChild(this.status),this.options.footnote&&this.host.insertAdjacentHTML("beforeend",`<p class="text-xs text-text-tertiary">${E(this.options.footnote)}</p>`),this.viewport.addEventListener("scroll",()=>this.paintBody()),this.viewport.addEventListener("keydown",t=>this.onKeyDown(t)),this.viewport.addEventListener("paste",t=>this.onPaste(t)),document.addEventListener("mouseup",this.onDocumentMouseUp),document.addEventListener("click",this.onDocumentClick,!0),this.wireCells(),this.paintHeader(),this.paintBody(!0),this.paintStatus()}totalWidth(){return this.widths.reduce((e,t)=>
4e+t,0)}frozenOffset(e){let t=0;for(let s=0;s<e;s++)t+=this.widths[s]??0;return t}buildToolbar(){const e=v("div","flex flex-wrap items-center gap-2"),t=v("input",`${P} w-48`);t.type="search",t.placeholder=`Filter ${b(this.model.totalRows)} rows…`,t.setAttribute("aria-label","Filter rows as you type"),t.dataset.qc="view-filter";let s;if(t.addEventListener("input",()=>{clearTimeout(s),s=setTimeout(()=>{this.model.setQuery(t.value),this.selection=null,this.paintBody(!0),this.paintStatus()},140)}),e.appendChild(t),this.options.editable){e.append(this.button("+ Row",()=>{const a=this.model.addRow();this.paintBody(!0),this.paintStatus(),this.changed();const c=Array.from(this.model.order).indexOf(a[0]??0);c>=0&&this.scrollToRow(c)}),this.button("+ Column",()=>{(async()=>{const a=await Q({title:"Add a column",label:"Column name",initialValue:`column_${this.model.columns.length+1}`,confirmLabel:"Add column",validate:c=>this.model.columns.some(l=>l.name===c)?"That column name is already in this table.":null});a!==null&&(this.model.addColumn(a),this.widths.push(se),this.rebuild())})()}),this.button("Delete rows",()=>this.deleteSelectedRows()),this.button("Delete column",()=>this.deleteSelectedColumn()));const i=this.button("Undo",()=>{this.model.undo()&&this.rebuild()}),o=this.button("Redo",()=>{this.model.redo()&&this.rebuild()});i.dataset.qc="view-undo",o.dataset.qc="view-redo",i.disabled=!this.model.canUndo,o.disabled=!this.model.canRedo,e.append(i,o)}e.appendChild(this.freezeSelect()),e.appendChild(this.copyAsMenu());const n=this.button("Download CSV",()=>this.download("csv"));if(n.className=`${j} border-accent text-text-primary`,n.dataset.qc="view-download-csv",e.appendChild(n),e.appendChild(this.button(".xlsx",()=>this.download("xlsx"))),this.options.explorerHref){const i=v("a",`${j} no-underline`,"Open in Data Explorer");i.href=this.options.explorerHref,i.dataset.qc="view-explorer",i.addEventListener("click",o=>{o.metaKey||o.ctrlKey||o.shiftKey||o.button!==0||this.options.onExplorer&&(o.preventDefault(),this.options.onExplorer())}),e.appendChild(i)}return e}button(e,t){const s=v("button",j,E(e));return s.type="button",s.addEventListener("click",t),s}freezeSelect(){const e=v("label","inline-flex items-center gap-1 text-xs text-text-tertiary"),t=v("select",P),s=Math.min(3,this.model.columns.length);return t.innerHTML=['<option value="0">No freeze</option>',...Array.from({length:s},(n,i)=>{const o=i+1;return`<option value="${o}">Freeze ${o} col${o===1?"":"s"}</option>`})].join(""),t.value=String(this.freeze),t.setAttribute("aria-label","Freeze the first columns"),t.dataset.qc="view-freeze",t.addEventListener("change",()=>{this.freeze=Number(t.value)||0,this.paintHeader(),this.paintBody(!0)}),e.appendChild(t),e}copyAsMenu(){const e=v("div","relative inline-flex"),t=this.button("Copy as",()=>{s.hidden=!s.hidden});t.dataset.qc="view-copyas",t.setAttribute("aria-haspopup","true");const s=v("div","absolute right-0 top-full z-30 mt-1 w-44 rounded-lg border border-border bg-surface p-1 shadow-lg");s.hidden=!0;const n=[["TSV (pastes into Excel)","tsv"],["CSV","csv"],["Markdown table","markdown"],["JSON","json"]];for(const[i,o]of n){const a=v("button","block w-full rounded px-2 py-1.5 text-left text-xs text-text-secondary hover:bg-surface-secondary hover:text-text-primary",E(i));a.type="button",a.dataset.qcKey=`copyas:${o}`,a.addEventListener("click",()=>{s.hidden=!0,this.copyAs(o,t)}),s.appendChild(a)}return e.append(t,s),e}buildFindPanel(){const e=v("div","flex flex-wrap items-center gap-2 rounded-lg border border-border bg-surface-secondary px-2 py-2"),t=v("input",`${P} w-40`);t.placeholder="Find",t.setAttribute("aria-label","Find"),t.dataset.qc="view-find";const s=v("input",`${P} w-40`);s.placeholder="Replace with",s.setAttribute("aria-label","Replace with"),s.dataset.qc="view-replace";const n=v("span","text-xs text-text-tertiary","");n.dataset.qc="view-find-count";const i=[["Aa","caseSensitive"],[".*","regex"],["Whole cell","wholeCell"]],o=()=>{this.findState.find=t.value,this.findState.replace=s.value,this.findHits=this.model.findMatches(this.findState),this.findIndex=0,n.textContent=t.value===""?"":this.findHits.length===0?"no matches":`${b(this.findHits.length)} match${this.findHits.length===1?"":"es"}`};t.addEventListener("input",o),s.addEventListener("input",o),e.append(t,
4s);for(const[a,c]of i){const l=v("label","inline-flex items-center gap-1 text-xs text-text-secondary"),d=v("input");d.type="checkbox",d.className="accent-accent",d.dataset.qcKey=`find:${String(c)}`,d.addEventListener("change",()=>{this.findState[c]=d.checked,o()}),l.append(d,document.createTextNode(a)),e.appendChild(l)}return e.append(this.button("Next",()=>{this.findHits.length!==0&&(this.findIndex=(this.findIndex+1)%this.findHits.length,this.gotoHit())}),this.button("Replace all",()=>{this.findState.find=t.value,this.findState.replace=s.value;const a=this.model.replaceAll(this.findState);this.rebuild(),this.announce(a===0?"Nothing matched, so nothing changed.":`Replaced in ${b(a)} cell${a===1?"":"s"}. Undo puts them all back.`)}),n),e}gotoHit(){const e=this.findHits[this.findIndex];e&&(this.selection={r1:e.row,c1:e.col,r2:e.row,c2:e.col},this.anchor={r:e.row,c:e.col},this.scrollToRow(e.row),this.paintBody(!0))}paintHeader(){const e=this.model.columns;this.headRow.innerHTML="",this.headRow.style.width=`${this.totalWidth()}px`,this.headRow.style.minWidth="100%",e.forEach((t,s)=>{var u;const n=this.model.columnMeta(t.id),i=s<this.freeze,o=v("div",`relative flex flex-col justify-center gap-0.5 border-r border-border px-2 py-1 ${i?"sticky z-10 bg-surface-secondary":""}`);o.style.width=`${this.widths[s]}px`,o.style.minWidth=`${this.widths[s]}px`,i&&(o.style.left=`${this.frozenOffset(s)}px`),o.setAttribute("role","columnheader");const a=((u=this.model.sort)==null?void 0:u.colId)===t.id?this.model.sort.direction:null,c=a==="asc"?" ↑":a==="desc"?" ↓":"",l=v("button","flex items-center gap-1 truncate text-left text-xs font-semibold text-text-primary hover:text-accent",`<span class="truncate">${E(t.name)}</span><span aria-hidden="true">${c}</span>`);l.type="button",l.title=`${t.name} — click to sort`,l.dataset.qcKey=`sort:${s}`,l.addEventListener("click",()=>{this.model.toggleSort(t.id),this.paintHeader(),this.paintBody(!0),this.paintStatus()}),this.options.editable&&l.addEventListener("dblclick",f=>{f.preventDefault(),(async()=>{const p=await Q({title:"Rename column",label:"Column name",initialValue:t.name,confirmLabel:"Rename",validate:w=>w!==t.name&&this.model.columns.some(g=>g.name===w)?"That column name is already in this table.":null});p!==null&&(this.model.renameColumn(t.id,p),this.rebuild())})()});const d=v("div","flex items-center gap-1");d.insertAdjacentHTML("beforeend",`<span class="rounded bg-accent-light px-1 py-0.5 text-[0.6rem] font-medium uppercase tracking-wide text-text-secondary">${E(V[n.type])}</span>`+(U[n.role]!==V[n.type]?`<span class="rounded bg-surface px-1 py-0.5 text-[0.6rem] text-text-tertiary">${E(U[n.role])}</span>`:""));const h=v("button","ml-auto rounded px-1 text-[0.7rem] text-text-tertiary hover:text-accent","&#931;");h.type="button",h.title=`Statistics for ${t.name}`,h.setAttribute("aria-label",`Statistics for ${t.name}`),h.dataset.qcKey=`stats:${s}`,h.addEventListener("click",f=>{f.stopPropagation(),this.openStats(t,h)}),d.appendChild(h),o.append(l,d),this.headRow.appendChild(o)})}paintBody(e=!1){if(this.disposed)return;const t=this.model.order.length;this.spacer.style.height=`${Math.max(t*D,1)}px`,this.spacer.style.width=`${this.totalWidth()}px`,this.spacer.style.minWidth="100%",this.body.style.minWidth="100%";const s=Math.max(0,this.viewport.scrollTop-ee),n=Math.ceil((this.viewport.clientHeight||420)/D),i=Math.max(0,Math.floor(s/D)-te),o=Math.min(t,i+n+te*2);if(!e&&i===this.firstPainted&&o===this.lastPainted)return;this.firstPainted=i,this.lastPainted=o,this.body.style.transform=`translateY(${i*D}px)`;const a=this.model.columns,c=[];for(let l=i;l<o;l++){const d=this.model.order[l],h=d<0;c.push(`<div class="flex min-w-full ${l%2===1?"bg-surface-secondary/60":""}" role="row" data-row="${l}" style="height:${D}px">`);for(let u=0;u<a.length;u++){const f=a[u],p=this.model.columnMeta(f.id),w=this.model.value(d,f.id),g=u<this.freeze,y=this.isSelected(l,u),x=`width:${this.widths[u]}px;min-width:${this.widths[u]}px${g?`;left:${this.frozenOffset(u)}px`:""}`;c.push(`<div role="gridcell" data-r="${l}" data-c="${u}" tabindex="-1" style="${x}" class="truncate border-b border-r border-border px-2 py-1 text-xs leading-5 ${p.align==="right"?"text-right font-mono tabular-nums":"text-left"} ${g?"sticky z-10 bg-surface":""} ${y?"bg-accent-light ring-1 ring-inset ring-accent":""} ${h?"text-accent":"text-text-primary"}" title="${E(w.slice(0,300))}">${E(w)}</div>`)}c.push("</div>")}this.body.innerHTML=c.join("")}wireCells(){this.body.addEventListener("mousedown",this.onCellMouseDown),this.body.addEventListener("mouseover",this.onCellMouseOver),this.options.editable&&this.body.addEventListener("dblclick",this.onCellDoubleClick)}cellFrom(e){const t=e instanceof HTMLElement?e.closest("[data-r]"):null;return t?{r:Number(t.dataset.r),c:Number(t.dataset.c)}:null}isSelected(e,t){const s=this.selection;return s?e>=Math.min(s.r1,s.r2)&&e<=Math.max(s.r1,s.r2)&&t>=Math.min(s.c1,s.c2)&&t<=Math.max(s.c1,s.c2):!1}paintStatus(){const e=this.model.totalRows,t=this.model.visibleRows,s=this.model.columns.length,n=t!==e,i=this.model.edited?" · edited, not yet downloaded":"";this.status.textContent=`${b(t)}${n?` of ${b(e)}`:""} row${t===1?"":"s"} × ${b(s)} column${s===1?"":"s"}${i}`}announce(e){this.status.textContent=e,setTimeout(()=>this.paintStatus(),4e3)}rebuild(){this.model.reorder(),this.measure(),this.paintHeader(),this.paintBody(!0),this.paintStatus(),this.refreshUndo(),this.changed()}refreshUndo(){const e=this.host.querySelector('[data-qc="view-undo"]'),t=this.host.querySelector('[data-qc="view-redo"]');e&&(e.disabled=!this.model.canUndo),t&&(t.disabled=!this.model.canRedo)}changed(){var e,t;(t=(e=this.options).onChange)==null||t.call(e)}scrollToRow(e){this.viewport.scrollTop=Math.max(0,e*D-this.viewport.clientHeight/2),this.paintBody(!0)}startEdit(e,t){if(!this.options.editable)return;const s=this.body.querySelector(`[data-r="${e}"][data-c="${t}"]`);if(!s)return;const n=this.model.order[e],i=this.model.columns[t];if(n===void 0||!i)return;const o=v("input","h-full w-full bg-surface px-1 text-xs text-text-primary outline-none ring-2 ring-accent");o.value=this.model.value(n,i.id),s.textContent="",s.appendChild(o),this.editorCell=s,o.focus(),o.select();const a=c=>{this.editorCell===s&&(this.editorCell=null,c&&this.model.setCell(n,i.id,o.value),this.paintBody(!0),this.paintStatus(),this.refreshUndo(),c&&this.changed(),this.viewport.focus({preventScroll:!0}))};o.addEventListener("blur",()=>a(!0)),o.addEventListener("keydown",c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),a(!0)):c.key==="Escape"&&(c.preventDefault(),a(!1))})}deleteSelectedRows(){const e=this.selection;if(!e){this.announce("Select a row first, then Delete rows.");return}const t=Math.min(e.r1,e.r2),s=Math.max(e.r1,e.r2),n=[];for(let i=t;i<=s;i++){const o=this.model.order[i];o!==void 0&&n.push(o)}this.model.deleteRows(n),this.selection=null,this.rebuild(),this.announce(`Deleted ${b(n.length)} row${n.length===1?"":"s"}. Undo puts them back.`)}deleteSelectedColumn(){const e=this.selection;if(!e){this.announce("Select a cell in the column first, then Delete column.");return}const t=this.model.columns[Math.min(e.c1,e.c2)];if(!t)return;if(this.model.columns.length===1){this.announce("A table needs at least one column.");return}const s=this.model.columns.indexOf(t);this.model.deleteColumn(t.id),this.widths.splice(s,1),this.selection=null,this.rebuild(),this.announce(`Deleted "${t.name}". Undo puts it back.`)}onPaste(e){var o;if(!this.options.editable||!this.selection)return;const t=((o=e.clipboardData)==null?void 0:o.getData("text/plain"))??"";if(t==="")return;e.preventDefault();const s=Ue(t),n=this.selection,{clipped:i}=this.model.pasteBlock(Math.min(n.r1,n.r2),Math.min(n.c1,n.c2),s);this.rebuild(),this.announce(i?"Pasted. Part of the block ran past the edge of the table and was left out.":`Pasted ${b(s.length)} row${s.length===1?"":"s"}.`)}onKeyDown(e){const t=e.key,s=e.metaKey||e.ctrlKey;if(s&&t.toLowerCase()==="c"){e.preventDefault(),this.copyAs("tsv",null);return}if(s&&t.toLowerCase()==="a"){e.preventDefault(),this.selection={r1:0,c1:0,r2:this.model.order.length-1,c2:this.model.columns.length-1},this.paintBody(!0);return}if(this.options.editable&&s&&t.toLowerCase()==="z"){e.preventDefault(),(e.shiftKey?this.model.redo():this.model.undo())&&this.rebuild();return}if(this.options.editable&&s&&t.toLowerCase()==="y"){e.preventDefault(),this.model.redo()&&this.rebuild();return}if(!this.anchor)return;const n={ArrowDown:[1,0],ArrowUp:[-1,0],ArrowLeft:[0,-1],ArrowRight:[0,1],PageDown:[20,0],PageUp:[-20,0]};if(n[t]){e.preventDefault();const[i,o]=n[t],a=ne(this.anchor.r+i,0,this.model.order.length-1),c=ne(this.anchor.c+o,0,this.model.columns.length-1);e.shiftKey&&this.selection?this.selection={...this.selection,r2:a,c2:c}:(this.anchor={r:a,c},this.selection={r1:a,c1:c,r2:a,c2:c}),this.scrollToRow(a);return}if(this.options.editable){if(t==="Enter"||t==="F2"){e.preventDefault(),this.startEdit(this.anchor.r,this.anchor.c);return}(t==="Delete"||t==="Backspace")&&this.selection&&(e.preventDefault(),this.clearSelection())}}clearSelection(){const e=this.selection;if(!e)return;const t=[];for(let s=Math.min(e.r1,e.r2);s<=Math.max(e.r1,e.r2);s++)for(let n=Math.min(e.c1,e.c2);n<=Math.max(e.c1,e.c2);n++){const i=this.model.order[s],o=this.model.columns[n];i!==void 0&&o&&t.push({rowId:i,colId:o.id,value:""})}this.model.setCells(t),this.rebuild()}
4closePopover(){var e;(e=this.popover)==null||e.remove(),this.popover=null}openStats(e,t){this.closePopover();const s=this.model.storeFor(e.id),n=this.model.columnMeta(e.id),i=s?je(s.store,s.index,n):{name:e.name,type:n.type,role:n.role,rows:0,blanks:0,distinct:0,distinctCapped:!1,top:[]},o=v("div","absolute z-40 w-64 rounded-lg border border-border bg-surface p-3 text-xs shadow-xl");o.dataset.qc="view-stats",o.setAttribute("role","dialog"),o.setAttribute("aria-label",`Statistics for ${e.name}`),o.innerHTML=Xe(i,this.model.fileRows);const a=v("button","mt-2 text-[0.7rem] text-accent underline","Close");a.type="button",a.addEventListener("click",()=>this.closePopover()),o.appendChild(a);const c=t.getBoundingClientRect(),l=this.host.getBoundingClientRect();o.style.top=`${c.bottom-l.top+4}px`,o.style.left=`${Math.max(0,Math.min(c.left-l.left,l.width-260))}px`,this.host.style.position="relative",this.host.appendChild(o),this.popover=o}exportRegion(){const e=this.model.columns,t=this.selection,s=t&&t.r1===t.r2&&t.c1===t.c2;if(!t||s)return{columns:e.map(c=>c.name),rows:Array.from(this.model.order,c=>this.model.rowValues(c))};const n=Math.min(t.c1,t.c2),i=Math.max(t.c1,t.c2),o=e.slice(n,i+1).map(c=>c.name),a=[];for(let c=Math.min(t.r1,t.r2);c<=Math.max(t.r1,t.r2);c++){const l=this.model.order[c];l!==void 0&&a.push(e.slice(n,i+1).map(d=>this.model.value(l,d.id)))}return{columns:o,rows:a}}async copyAs(e,t){const{columns:s,rows:n}=this.exportRegion(),i=Je(e,s,n),{copyText:o}=await $(async()=>{const{copyText:a}=await import("./dom-D3eB0Nlx.js");return{copyText:a}},[]);try{if(await o(i),this.announce(`Copied ${b(n.length)} row${n.length===1?"":"s"} as ${e.toUpperCase()}.`),t){const a=t.textContent??"Copy as";t.textContent="Copied",setTimeout(()=>{t.textContent=a},1600)}}catch{this.announce("Copy failed. Select the cells and use your browser's own copy.")}}csvText(){const e=this.model.columns,t=[e.map(s=>K(s.name)).join(",")];for(let s=0;s<this.model.order.length;s++){const n=this.model.order[s];t.push(e.map(i=>K(this.model.value(n,i.id))).join(","))}return`${t.join(`
5`)}
6`}async download(e){var d,h,u,f;const{downloadBlob:t}=await $(async()=>{const{downloadBlob:p}=await import("./dom-D3eB0Nlx.js");return{downloadBlob:p}},[]),s=this.options.filename.replace(/\.[^.]+$/,"")||"table";if(e==="csv"){t(new Blob([this.csvText()],{type:"text/csv;charset=utf-8"}),`${s}.csv`),(h=(d=this.options).onDownload)==null||h.call(d,"csv"),this.announce(`Downloading ${s}.csv.`);return}this.announce("Building the workbook…");const n=await $(()=>import("./vendor-xlsx-DCwg6k6L.js"),[]),o=[this.model.columns.map(p=>p.name)];for(let p=0;p<this.model.order.length;p++)o.push(this.model.rowValues(this.model.order[p]));const a=n.utils.aoa_to_sheet(o),c=n.utils.book_new();n.utils.book_append_sheet(c,a,"Data");const l=n.write(c,{bookType:"xlsx",type:"array"});t(new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),`${s}.xlsx`),(f=(u=this.options).onDownload)==null||f.call(u,"xlsx"),this.announce(`Downloading ${s}.xlsx.`)}}function ne(r,e,t){return Math.max(e,Math.min(t,r))}function K(r){return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r}function Je(r,e,t){if(r==="tsv")return[e,...t].map(s=>s.map(n=>n.replace(/[\t\n\r]/g," ")).join("	")).join(`
7`);if(r==="csv")return[e,...t].map(s=>s.map(K).join(",")).join(`
8`);if(r==="markdown"){const s=a=>a.replace(/\|/g,"\\|").replace(/\n/g," "),n=`| ${e.map(s).join(" | ")} |`,i=`| ${e.map(()=>"---").join(" | ")} |`,o=t.map(a=>`| ${a.map(s).join(" | ")} |`);return[n,i,...o].join(`
9`)}return JSON.stringify(t.map(s=>Object.fromEntries(e.map((n,i)=>[n,s[i]??""]))),null,2)}function Xe(r,e){const t=n=>Number.isInteger(n)?b(n):n.toLocaleString("en-US",{maximumFractionDigits:4}),s=[`<p class="mb-1 font-semibold text-text-primary">${E(r.name)}</p>`,`<p class="mb-2 text-text-tertiary">${E(V[r.type])} · ${E(U[r.role])}</p>`,'<dl class="space-y-0.5 text-text-secondary">',S("Rows read",b(r.rows)),S("Blank",`${b(r.blanks)}`),S("Distinct",`${r.distinctCapped?"over ":""}${b(r.distinct)}`)];return r.numeric&&s.push(S("Min",t(r.numeric.min)),S("Max",t(r.numeric.max)),S("Mean",t(r.numeric.mean)),S("Median",t(r.numeric.median)),S("Sum",t(r.numeric.sum))),r.dates&&s.push(S("Earliest",r.dates.min),S("Latest",r.dates.max)),s.push("</dl>"),r.top&&r.top.length>0&&s.push('<p class="mt-2 mb-1 font-medium text-text-secondary">Most common</p><ul class="space-y-0.5 text-text-tertiary">',...r.top.map(n=>`<li class="flex justify-between gap-2"><span class="truncate">${E(n.value)}</span><span>${b(n.count)}</span></li>`),"</ul>"),e>W&&s.push(`<p class="mt-2 text-[0.65rem] text-text-tertiary">Read from the first ${b(W)} rows.</p>`),s.join("")}function S(r,e){return`<div class="flex justify-between gap-2"><dt>${E(r)}</dt><dd class="font-mono text-text-primary">${E(e)}</dd></div>`}const z=[",","	",";","|"],Ye=8*1024*1024;function Ze(r){const e=[];let t=new Map,s=!1,n=0;const i=()=>{e.push(z.map(l=>t.get(l)??0)),t=new Map,n++};for(let l=0;l<r.length&&n<12;l++){const d=r[l];if(d==='"'){s=!s;continue}if(!s){if(d===`
10`){i();continue}d!=="\r"&&z.includes(d)&&t.set(d,(t.get(d)??0)+1)}}t.size>0&&n<12&&i();const o=e.length>1?e.slice(0,-1):e;if(o.length===0)return",";let a=",",c=-1;return z.forEach((l,d)=>{const h=o.map(w=>w[d]??0),u=h[0]??0;if(u===0)return;const p=(h.every(w=>w===u)?1e3:0)+u;p>c&&(c=p,a=l)}),c<0?",":a}class Qe{constructor(e,t){m(this,"field","");m(this,"row",[]);m(this,"inQuotes",!1);m(this,"quoteJustClosed",!1);m(this,"sawCr",!1);m(this,"rowHasContent",!1);m(this,"carry","");this.delimiter=e,this.onRow=t}push(e){const t=this.carry===""?e:this.carry+e;this.carry="";const s=this.delimiter,n=s.length;for(let i=0;i<t.length;i++){const o=t[i];if(this.inQuotes){if(o==='"'){this.quoteJustClosed?(this.field+='"',this.quoteJustClosed=!1):this.quoteJustClosed=!0;continue}if(this.quoteJustClosed)this.inQuotes=!1,this.quoteJustClosed=!1;else{this.field+=o;continue}}if(!(this.sawCr&&(this.sawCr=!1,o===`
11`))){if(o==='"'&&this.field.length===0){this.inQuotes=!0,this.rowHasContent=!0;continue}if(o===s[0]){if(n===1){this.endField();continue}if(t.startsWith(s,i)){this.endField(),i+=n-1;continue}if(t.length-i<n&&s.startsWith(t.slice(i))){this.carry=t.slice(i);return}}if(o===`
12`){this.endRow();continue}if(o==="\r"){this.sawCr=!0,this.endRow();continue}this.field+=o,this.rowHasContent=!0}}}end(){this.carry!==""&&(this.field+=this.carry,this.rowHasContent=!0,this.carry=""),(this.inQuotes||this.field.length>0||this.row.length>0||this.rowHasContent)&&this.endRow()}endField(){this.row.push(this.field),this.field="",this.rowHasContent=!0}endRow(){this.row.push(this.field),this.field="";const e=this.row;this.row=[];const t=!this.rowHasContent&&e.length===1&&e[0]==="";this.rowHasContent=!1,!t&&this.onRow(e)}}class Ge{constructor(e={}){m(this,"builders",[]);m(this,"names",[]);m(this,"rows",0);m(this,"headerTaken",!1);m(this,"short",0);m(this,"long",0);m(this,"widest",0);m(this,"truncated",0);m(this,"accept",e=>{var t;if(this.full){this.truncated++;return}if(!this.headerTaken){if(this.headerTaken=!0,(this.options.header??"f
12irst-row")==="first-row"){this.names=et(e),this.builders=this.names.map(s=>new F(s)),this.widest=e.length;return}this.names=e.map((s,n)=>`column${n}`),this.builders=this.names.map(s=>new F(s)),this.widest=e.length}this.widest=Math.max(this.widest,e.length),e.length<this.builders.length?this.short++:e.length>this.builders.length&&this.long++;for(let s=0;s<this.builders.length;s++)(t=this.builders[s])==null||t.push(e[s]??"");this.rows++});this.options=e}get full(){const e=this.options.maxRows;return e!==void 0&&this.rows>=e}finish(e){return{store:{columns:this.builders.map(s=>s.finish()),rowCount:this.rows},delimiter:e,short:this.short,long:this.long,widest:this.widest,truncated:this.truncated}}}function et(r){const e=new Map;return r.map((t,s)=>{const n=t.trim()===""?`column${s}`:t.trim(),i=e.get(n)??0;return e.set(n,i+1),i===0?n:`${n}_${i+1}`})}function X(r,e={}){const t=r.charCodeAt(0)===65279?r.slice(1):r,s=be(t),n=[...s.warnings];let i=s.text;const o=e.delimiter??s.delimiter,a=ye(i,{delimiter:o,maxChars:Ye});a&&(i=i.slice(a.start,a.end),n.push(...xe(a)));const c=o??(a==null?void 0:a.delimiter)??Ze(i.slice(0,64*1024)),l=new Ge(e),d=new Qe(c,l.accept);d.push(i),d.end();const h=l.finish(c);return n.length>0?{...h,warnings:n}:h}const tt=2*1024*1024,ie=250*1024*1024,L=2e6;function B(r,e){const t=[...r.warnings??[]];return r.short>0&&t.push(`${b(r.short)} row${r.short===1?"":"s"} in ${e} had fewer values than the header row. The missing cells are shown blank.`),r.long>0&&t.push(`${b(r.long)} row${r.long===1?"":"s"} had more values than the ${b(r.store.columns.length)}-column header (the widest had ${b(r.widest)}). The extra values are not shown. Open it in the full editor to keep them.`),r.truncated>0&&t.push(`This file has more than ${b(L)} rows. The grid is showing the first ${b(L)}. Open it in the full editor to work with all of them.`),t}async function st(r,e,t,s){if(r&&r.size>tt&&typeof Worker<"u")try{return await nt(r,t,s)}catch{}t.onProgress("Reading the file…",.1);const n=e===void 0&&r?ve(new Uint8Array(await r.arrayBuffer())):null,i=e??(n==null?void 0:n.text)??"";t.onProgress("Parsing rows…",.5);const o=X(i,{delimiter:s,maxRows:L});return t.onProgress("Building the grid…",.95),{store:o.store,warnings:[...n!=null&&n.warning?[n.warning]:[],...B(o,"this file")],parts:[{label:"Table",rowCount:o.store.rowCount,columnCount:o.store.columns.length}],selected:"Table",summary:[le(o.delimiter)]}}async function nt(r,e,t){const s=await $(()=>import("./viewCsvWorker-DR4XRhuf.js"),[]),n=new s.default;try{return await new Promise((i,o)=>{const a=()=>o(new DOMException("Cancelled","AbortError"));e.signal.addEventListener("abort",a,{once:!0}),n.addEventListener("message",c=>{const l=c.data;if(l.kind==="progress"){const u=(l.loaded??0)/Math.max(1,l.total??1);e.onProgress(`Reading ${Math.round(u*100)}% of the file…`,u);return}if(l.kind==="error"){o(new Error(l.message??"The reader failed."));return}const d={columns:l.columns??[],rowCount:l.rowCount??0},h={store:d,delimiter:l.delimiter??",",short:l.short??0,long:l.long??0,widest:l.widest??0,truncated:l.truncated??0,warnings:l.warnings??[]};e.onProgress("Building the grid…",1),i({store:d,warnings:B(h,"this file"),parts:[{label:"Table",rowCount:d.rowCount,columnCount:d.columns.length}],selected:"Table",summary:[le(h.delimiter),"read off the main thread"]})}),n.addEventListener("error",c=>o(new Error(c.message))),n.postMessage({file:r,options:{delimiter:t,maxRows:L}})})}finally{n.terminate()}}function le(r){return`${{",":"comma",";":"semicolon","	":"tab","|":"pipe"}[r]??`"${r}"`}-delimited`}async function it(r,e,t){t.onProgress("Reading the text…",.2);const s=e??(r?await r.text():""),{textToRows:n,DELIMITER_LABELS:i}=await $(async()=>{const{textToRows:h,DELIMITER_LABELS:u}=await import("./textToCsv-CVZHs0IY.js");return{textToRows:h,DELIMITER_LABELS:u}},__vite__mapDeps([0,1,2,3,4,5]));t.onProgress("Working out the column boundaries…",.6);const o=n(s,"auto","auto",!0),a=o.rows[0]??[],c=o.rows.slice(1),l=A(a,c),d=o.plan.kind==="fixed"?`fixed-width columns, boundaries detected at ${b(a.length)}
12 positions`:o.plan.kind==="single"?"one column, no separator found":`${i[o.plan.delimiter]??"delimiter"}-separated`;return{store:l,warnings:o.warnings,parts:[{label:"Table",rowCount:l.rowCount,columnCount:a.length}],selected:"Table",side:{kind:"text",text:s},summary:[d,...o.summary]}}async function ot(r,e,t){t.onProgress("Reading the JSON…",.2);const s=e??(r?await r.text():""),{jsonToTable:n,parseJsonInput:i}=await $(async()=>{const{jsonToTable:h,parseJsonInput:u}=await import("./jsonFlatten-BvwKgkrC.js");return{jsonToTable:h,parseJsonInput:u}},__vite__mapDeps([6,1,7]));t.onProgress("Flattening nested fields…",.6);const{columns:o,rows:a,warnings:c}=n(s),l=A(o,a);let d=null;try{d=JSON.parse(s)}catch{try{const h=i(s);d=h.records.length===1?h.records[0]:h.records}catch{}}return{store:l,warnings:c,parts:[{label:"Records",rowCount:l.rowCount,columnCount:o.length}],selected:"Records",side:{kind:"json",value:d},summary:[`${b(l.rowCount)} record${l.rowCount===1?"":"s"}`]}}async function rt(r,e,t){t.onProgress("Reading the XML…",.2);const s=e??(r?await r.text():""),{xmlToTable:n}=await $(async()=>{const{xmlToTable:c}=await import("./xmlToCsv-DiDxuxdQ.js");return{xmlToTable:c}},__vite__mapDeps([8,9,1,2,3,4,5,6,7]));t.onProgress("Building the table…",.6);const{columns:i,rows:o,warnings:a}=n(s);return{store:A(i,o),warnings:a,parts:[{label:"Records",rowCount:o.length,columnCount:i.length}],selected:"Records",side:{kind:"xml",text:s},summary:[`${b(o.length)} element${o.length===1?"":"s"}`]}}async function at(r,e,t){var p;t.onProgress("Reading the workbook…",.2);const s=await $(()=>import("./vendor-xlsx-DCwg6k6L.js"),[]),n=s.read(new Uint8Array(await r.arrayBuffer()),{type:"array",cellDates:!0});if(n.SheetNames.length===0)throw new Error("That workbook has no sheets in it.");t.onProgress("Measuring the sheets…",.5);const i=n.SheetNames.map(w=>{const g=n.Sheets[w],y=g==null?void 0:g["!ref"];if(!y)return{label:w,rowCount:0,columnCount:0};const x=s.utils.decode_range(y);return{label:w,rowCount:Math.max(0,x.e.r-x.s.r),columnCount:x.e.c-x.s.c+1}}),o=e&&n.SheetNames.includes(e)?e:((p=i.find(w=>(w.rowCount??0)>0))==null?void 0:p.label)??n.SheetNames[0];t.onProgress(`Reading "${o}"…`,.75);const a=n.Sheets[o],l=(a?s.utils.sheet_to_json(a,{header:1,raw:!1,blankrows:!1,defval:""}):[]).map(w=>w.map(g=>g==null?"":String(g))),d=l.shift()??[],h=l.reduce((w,g)=>Math.max(w,g.length),d.length),u=Array.from({length:h},(w,g)=>{const y=(d[g]??"").trim();return y===""?`column_${g+1}`:y}),f=[];return e&&!n.SheetNames.includes(e)&&f.push(`The sheet "${e}" is not in this workbook, so "${o}" is shown.`),f.push("Cell values are shown as Excel displays them. Formulas are shown as their last calculated result, and cell colors and fonts are not carried over."),{store:A(u,l),warnings:f,parts:i,selected:o,summary:[`${b(n.SheetNames.length)} sheet${n.SheetNames.length===1?"":"s"}`,`showing "${o}"`]}}async function lt(r,e){const{cleanup:t,countRows:s,duckdbFailure:n,initDuckDBLite:i,queryTable:o,previewSelectList:a}=await $(async()=>{const{cleanup:f,countRows:p,duckdbFailure:w,initDuckDBLite:g,queryTable:y,previewSelectList:x}=await import("./duckdbLite-BZJanxnx.js");return{cleanup:f,countRows:p,duckdbFailure:w,initDuckDBLite:g,queryTable:y,previewSelectList:x}},__vite__mapDeps([10,11,12,13,4,14])),{db:c,conn:l}=await i(f=>e.onProgress(f,.2));e.onProgress("Reading the Parquet file…",.5);const d=new Uint8Array(await r.arrayBuffer()),h="qc_view.parquet";await t(c,[h]),await c.registerFileBuffer(h,d);const u="qc_view_parquet";try{await l.query(`CREATE OR REPLACE VIEW ${u} AS SELECT * FROM read_parquet('${h}')`);const f=await s(l,u),p=Math.min(f,L);e.onProgress(`Loading ${b(p)} rows…`,.8);const w=await l.query(`DESCRIBE ${u}`),g=[];for(const _ of w.toArray()){const k=_;g.push({name:String(k.column_name??""),type:String(k.column_type??"")})}const{columns:y,rows:x}=await o(l,`SELECT ${a(g)} FROM ${u} LIMIT ${p}`),C=[];return f>p&&C.push(`This file has ${b(f)} rows. The grid is showing the first ${b(p)}. Open it in the full editor for all of them.`),{store:A(y,x),warnings:C,parts:[{label:"Table",rowCount:f,columnCount:y.length}],selected:"Table",summary:[`${b(f)} row${f===1?"":"s"}`,`${b(g.length)} column${g.length===1?"":"s"}`,"read with DuckDB"]}}catch(f){throw n(f,"parquet")}finally{await l.query(`DROP VIEW IF EXISTS ${u}`).catch(()=>{}),await t(c,[h])}}function oe(r){return`"${r.replace(/"/g,'""')}"`}async function ct(r,e,t){var w;const s=new Uint8Array(await r.arrayBuffer());if(s.length>=16&&new TextDecoder().decode(s.slice(0,15))==="SQLite format 3")return ce(new File([s],r.name.replace(/\.(db|duckdb)$/i,".sqlite")),e,t);const{cleanup:i,countRows:o,duckdbFailure:a,initDuckDBLite:c,queryTable:l,previewSelectList:d}=await $(async()=>{const{cleanup:g,countRows:y,duckdbFailure:x,initDuckDBLite:C,queryTable:_,previewSelectList:k}=await import("./duckdbLite-BZJanxnx.js");return{cleanup:g,countRows:y,duckdbFailure:x,initDuckDBLite:C,queryTable:_,previewSelectList:k}},__vite__mapDeps([10,11,12,13,4,14])),{db:h,conn:u}=await c(g=>t.onProgress(g,.2)),f="qc_view.duckdb";await i(h,[f]),await h.registerFileBuffer(f,s);const p="qc_view_db";try{t.onProgress("Opening the database…",.5),await u.query(`ATTACH '${f}' AS ${p} (READ_ONLY)`);const y=(await l(u,`SELECT table_name FROM information_schema.tables WHERE table_catalog = '${p}' AND table_schema = 'main' ORDER BY table_name`)).rows.map(T=>T[0]??"").filter(T=>T!=="");if(y.length===0)throw new Error("There are no tables in that database file.");t.onProgress("Counting rows…",.65);const x=[];for(const T of y){const M=await o(u,`${p}.main.${oe(T)}`);x.push({label:T,rowCount:M})}const C=e&&y.includes(e)?e:y[0],_=`${p}.main.${oe(C)}`,k=((w=x.find(T=>T.label===C))==null?void 0:w.rowCount)??0,q=Math.min(k,L);t.onProgress(`Reading "${C}"…`,.85);const de=await u.query(`DESCRIBE ${_}`),Y=[];for(const T of de.toArray()){const M=T;Y.push({name:String(M.column_name??""),type:String(M.column_type??"")})}const{columns:he,rows:ue}=await l(u,`SELECT ${d(Y)} FROM ${_} LIMIT ${q}`),H=[];return e&&!y.includes(e)&&H.push(`There is no table called "${e}" here, so "${C}" is shown.`),k>q&&H.push(`"${C}" has ${b(k)} rows. The grid is showing the first ${b(q)}.`),{store:A(he,ue),warnings:H,parts:x,selected:C,summary:[`${b(y.length)} table${y.length===1?"":"s"}`,`showing "${C}"`,`${b(k)} row${k===1?"":"s"}`]}}catch(g){throw a(g,"parquet")}finally{await u.query(`DETACH ${p}`).catch(()=>{}),await i(h,[f])}}async function ce(r,e,t){t.onProgress("Opening the database…",.3);const{parseSqliteToTables:s}=await $(async()=>{const{parseSqliteToTables:f}=await import("./sqliteParser-D406xhIa.js");return{parseSqliteToTables:f}},__vite__mapDeps([15,16])),{ndjsonToTable:n}=await $(async()=>{const{ndjsonToTable:f}=await import("./jsonFlatten-BvwKgkrC.js");return{ndjsonToTable:f}},__vite__mapDeps([6,1,7])),i=await s(r);if(i.length===0)throw new Error("Every table in that database is empty, so there is nothing to show.");const o=i.map(f=>f.name),a=e&&o.includes(e)?e:o[0];t.onProgress(`Reading "${a}"…`,.7);const c=i.find(f=>f.name===a)??i[0],{columns:l,rows:d,warnings:h}=n(c.jsonl),u=i.map(f=>({label:f.name,rowCount:f.jsonl===""?0:f.jsonl.trimEnd().split(`
13`).length}));return e&&!o.includes(e)&&h.unshift(`The table "${e}" has no rows, so "${a}" is shown instead.`),{store:A(l,d),warnings:h,parts:u,selected:a,summary:[`${b(i.length)} table${i.length===1?"":"s"}`,`showing "${a}"`]}}async function dt(r,e,t){await $(()=>import("./polyfills-1THQ3rSd.js"),[]);const{parsePdfToCSV:s}=await $(async()=>{const{parsePdfToCSV:h}=await import("./pdfParser-BPKa0u6N.js").then(u=>u.a);return{parsePdfToCSV:h}},__vite__mapDeps([17,16,18,19,20,21]));t.onProgress("Scanning the PDF for tables…",.3);const n=await s(r,{onProgress:h=>t.onProgress(h,.5),onPasswordNeeded:h=>t.requestPassword(h)}),i=n.tables;if(i.length===0)throw new Error("No tables were found in that PDF.");const o=i.map((h,u)=>h.label||`Table ${u+1}`),a=e&&o.includes(e)?e:o[0],c=Math.max(0,o.indexOf(a));t.onProgress("Building the grid…",.9);const l=X(i[c].csv,{maxRows:L}),d=[...B(l,`"${a}"`)];return n.warning&&d.unshift(n.warning),i.length>1&&d.push(`${b(i.length)} tables were detected. Use the picker to move between them.`),{store:l.store,warnings:d,parts:i.map((h,u)=>({label:o[u],...typeof h.rowCount=="number"?{rowCount:h.rowCount}:{},...typeof h.columnCount=="number"?{columnCount:h.columnCount}:{}})),selected:a,summary:[`${b(i.length)} table${i.length===1?"":"s"} found`,`showing "${a}"`]}}async function ht(r,e,t){t.onProgress("Reading the document…",.3);const{parseDocToCSV:s}=await $(async()=>{const{parseDocToCSV:d}=await import("./docParser-hcQtJ3mo.js");return{parseDocToCSV:d}},__vite__mapDeps([22,16])),n=await s(r);if(n.tables.length===0)throw new Error("No tables were found in that document.");const i=n.tables.map((d,h)=>d.label||`Table ${h+1}`),o=e&&i.includes(e)?e:i[0],a=Math.max(0,i.indexOf(o));t.onProgress("Building the grid…",.8);const c=X(n.tables[a].csv,{maxRows:L}),l=[...B(c,`"${o}"`)];return n.warning&&l.unshift(n.warning),n.tables.length>1&&l.push(`${b(n.tables.length)} tables were found in this document. Use the picker to move between them.`),{store:c.store,warnings:l,parts:n.tables.map((d,h)=>({label:i[h]})),selected:o,summary:[`${b(n.tables.length)} table${n.tables.length===1?"":"s"} found`,`showing "${o}"`]}}const ut={csv:"delimited",tsv:"delimited",txt:"text",json:"json",jsonl:"json",ndjson:"json",xml:"xml",xlsx:"workbook",xlsm:"workbook",xls:"workbook",parquet:"parquet",duckdb:"database",db:"database",sqlite:"sqlite",sqlite3:"sqlite",pdf:"pdf",doc:"doc",docx:"doc"};function ft(r,e){const t=ut[we(e)];return t?r==="delimited"&&t==="text"?"delimited":r==="text"&&t==="delimited"?"text":r==="database"&&t==="sqlite"?"sqlite":t:r}async function mt(r,e){const{file:t,text:s,ctx:n,sheet:i}=e;switch(r){case"delimited":return st(t,s,n,Ce(e.options.delimiter));case"text":return it(t,s,n);case"json":return ot(t,s,n);case"xml":return rt(t,s,n);case"workbook":if(!t)throw new Error("Pick a workbook file to open.");return at(t,i,n);case"parquet":if(!t)throw new Error("Pick a .parquet file to open.");return lt(t,n);case"database":if(!t)throw new Error("Pick a database file to open.");return ct(t,i,n);case"sqlite":if(!t)throw new Error("Pick a database file to open.");return ce(t,i,n);case"pdf":if(!t)throw new Error("Pick a PDF to open.");return dt(t,i,n);case"doc":if(!t)throw new Error("Pick a Word document to open.");return ht(t,i,n)}}function pt(r){return r.parts.map(e=>e.rowCount===void 0?e.label:`${e.label} (${b(e.rowCount)} row${e.rowCount===1?"":"s"})`)}const wt={workbook:"Sheet",database:"Table",sqlite:"Table",pdf:"Table",doc:"Table"};function St(r){return async t=>{const s=ft(r.format,t.filename);if(t.file&&t.file.size>ie)throw new Error(`That file is ${Z(t.file.size)}. This page holds files up to ${Z(ie)} in a browser tab. The full editor streams up to 1 GB without loading it all at once.`);const n=await mt(s,t);if(t.ctx.signal.aborted)throw new DOMException("Cancelled","AbortError");
13if(n.store.columns.length===0)throw new Error("There are no columns in that file, so there is nothing to show.");const i=n.store.rowCount,o=n.store.columns.length,a=pe(t.filename)||"table",c=`Opened ${t.filename}: ${b(i)} row${i===1?"":"s"}, ${b(o)} column${o===1?"":"s"}. The counter above follows what you filter and sort.`;let l=null;return{status:"ok",output:{filename:`${a}.csv`,blob:new Blob([],{type:"text/csv"}),preview:ge(),warnings:n.warnings,summary:n.summary,customView:{ownActions:!0,meta:c,render:h=>{const u=n.side,f=document.createElement("div"),p=document.createElement("div");p.hidden=!0,u&&(u.kind==="json"||u.kind==="xml")&&h.appendChild(gt(f,p,u)),h.append(f,p),l=new Ke(f,n.store,{editable:r.editable??!1,filename:t.filename,explorerHref:"/app",...r.footnote?{footnote:r.footnote}:{}})},dispose:()=>{l==null||l.dispose(),l=null}},...n.parts.length>1?{discovered:{kind:"sheets",sheets:n.parts.map(h=>h.label),selected:n.selected,labels:pt(n),pickerLabel:wt[s]??"Part"}}:{}}}}}function gt(r,e,t){const s=document.createElement("div");s.className="mb-2 inline-flex rounded-lg border border-border bg-surface-secondary p-0.5",s.setAttribute("role","tablist");let n=!1;const i=[["Table","table"],[t.kind==="xml"?"XML tree":"JSON tree","tree"]],o=[],a=c=>{r.hidden=c!=="table",e.hidden=c!=="tree",o.forEach((l,d)=>{var u;const h=((u=i[d])==null?void 0:u[1])===c;l.setAttribute("aria-selected",String(h)),l.className=`inline-flex min-h-[30px] items-center rounded-md px-3 py-1 text-xs font-medium transition-colors ${h?"bg-surface text-text-primary shadow-sm":"text-text-secondary hover:text-text-primary"}`}),c==="tree"&&!n&&(n=!0,$(async()=>{const{renderJsonTree:l,renderXmlTree:d}=await import("./viewTree-CFfBg-Zl.js");return{renderJsonTree:l,renderXmlTree:d}},__vite__mapDeps([23,24,1])).then(({renderJsonTree:l,renderXmlTree:d})=>{t.kind==="xml"?d(e,t.text):l(e,t.value)}))};for(const[c,l]of i){const d=document.createElement("button");d.type="button",d.textContent=c,d.setAttribute("role","tab"),d.dataset.qcKey=`viewtab:${l}`,d.addEventListener("click",()=>a(l)),o.push(d),s.appendChild(d)}return a("table"),s}export{St as createViewEngine};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.