@vuu-ui/vuu-data-react 0.8.0 → 0.8.1-debug

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -1,2 +1,496 @@
1
- "use strict";var Oe=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var Pt=(i,e)=>{for(var t in e)Oe(i,t,{get:e[t],enumerable:!0})},Ct=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of wt(e))!Ot.call(i,r)&&r!==t&&Oe(i,r,{get:()=>e[r],enumerable:!(s=kt(e,r))||s.enumerable});return i};var St=i=>Ct(Oe({},"__esModule",{value:!0}),i);var Xe=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var N=(i,e,t)=>(Xe(i,e,"read from private field"),t?t.call(i):e.get(i)),Ye=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Pe=(i,e,t,s)=>(Xe(i,e,"write to private field"),s?s.call(i,t):e.set(i,t),t);var fs={};Pt(fs,{MovingWindow:()=>de,addRowsFromInstruments:()=>Xt,getTypeaheadParams:()=>Mt,isViewportMenusAction:()=>dt,isVisualLinkCreatedAction:()=>qt,isVisualLinkRemovedAction:()=>Ht,isVisualLinksAction:()=>pt,isVuuFeatureAction:()=>Zt,isVuuFeatureInvocation:()=>Kt,useDataSource:()=>yt,useServerConnectionQuality:()=>Rt,useServerConnectionStatus:()=>vt,useTypeaheadSuggestions:()=>At,useVuuMenuActions:()=>as,useVuuTables:()=>us});module.exports=St(fs);var Q=require("@vuu-ui/vuu-utils"),C=require("react"),{SELECTED:Ce}=Q.metadataKeys;function yt({dataSource:i,renderBufferSize:e=10}){let[,t]=(0,C.useState)(null),s=(0,C.useRef)(!0),r=(0,C.useRef)(!1),o=(0,C.useRef)(null),n=(0,C.useRef)([]),h=(0,C.useRef)({from:0,to:10}),l=(0,C.useMemo)(()=>new de((0,Q.getFullRange)(h.current,e)),[e]),a=(0,C.useCallback)(c=>{for(let p of c)l.add(p);n.current=l.data.slice(),r.current=!0},[l]),f=(0,C.useCallback)(c=>{c.type==="viewport-update"&&(c.size!==void 0&&l.setRowCount(c.size),c.rows?(a(c.rows),t({})):c.size!==void 0&&(n.current=l.data.slice(),r.current=!0))},[l,a]);(0,C.useEffect)(()=>()=>{o.current&&(cancelAnimationFrame(o.current),o.current=null),s.current=!1},[]);let u=(0,C.useCallback)(c=>{h.current=c;let p=(0,Q.getFullRange)(h.current,e);i.range=p,l.setRange(p.from,p.to)},[i,l,e]);return(0,C.useMemo)(()=>{let{from:c,to:p}=h.current,g=(0,Q.getFullRange)({from:c,to:p},e);i.range=g,l.setRange(g.from,g.to)},[i,l,e]),(0,C.useEffect)(()=>{let{from:c,to:p}=(0,Q.getFullRange)(h.current,e);i.subscribe({range:{from:c,to:p}},f)},[i,f,e]),(0,C.useEffect)(()=>()=>{i.unsubscribe()},[i]),[n.current,l.rowCount,(0,Q.getFullRange)(h.current,e),u]}var de=class{constructor({from:e,to:t}){this.rowCount=0;this.setRowCount=e=>{e<this.data.length&&(this.data.length=e),this.rowCount=e};this.range=new Q.WindowRange(e,t),this.data=new Array(t-e)}add(e){let[t]=e;if(this.isWithinRange(t)){let s=t-this.range.from;this.data[s]=e,this.data[s-1]&&this.data[s-1][Ce]===1&&e[Ce]===0&&(e[Ce]=2),t===this.rowCount-1&&(this.data.length=s+1)}}getAtIndex(e){return this.range.isWithin(e)&&this.data[e-this.range.from]!=null?this.data[e-this.range.from]:void 0}isWithinRange(e){return this.range.isWithin(e)}setRange(e,t){if(e!==this.range.from||t!==this.range.to){let[s,r]=this.range.overlap(e,t),o=new Array(t-e);for(let n=s;n<r;n++){let h=this.getAtIndex(n);if(h){let l=n-e;o[l]=h}}this.data=o,this.range.from=e,this.range.to=t}}};var ee=require("react"),Se=require("@vuu-ui/vuu-data"),vt=()=>{let[i,e]=(0,ee.useState)("disconnected"),t=(0,ee.useCallback)(({status:s})=>{e(s)},[]);return(0,ee.useEffect)(()=>(Se.ConnectionManager.on("connection-status",t),()=>{Se.ConnectionManager.removeListener("connection-status",t)}),[t]),i};var te=require("react"),ye=require("@vuu-ui/vuu-data"),Rt=()=>{let[i,e]=(0,te.useState)(0),t=(0,te.useCallback)(({messages:s})=>{e(s.messagesLength)},[]);return(0,te.useEffect)(()=>(ye.ConnectionManager.on("connection-metrics",t),()=>{ye.ConnectionManager.removeListener("connection-metrics",t)}),[t]),i};var He=require("react"),Ze=require("@vuu-ui/vuu-data"),qe={type:"RPC_CALL",service:"TypeAheadRpcHandler"},Mt=(i,e,t="",s=[])=>t!==""&&!s.includes(t.toLowerCase())?[i,e,t]:[i,e],At=()=>(0,He.useCallback)(async e=>{let t=e.length===2?{method:"getUniqueFieldValues",params:e,...qe}:{method:"getUniqueFieldValuesStartingWith",params:e,...qe};return await(0,Ze.makeRpcCall)(t)},[]);var Tt=0,ue=class{constructor(e,t){this.from=e,this.to=t}},k=class{constructor(e={}){this.id=Tt++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=A.match(e)),t=>{let s=e(t);return s===void 0?null:[this,s]}}};k.closedBy=new k({deserialize:i=>i.split(" ")});k.openedBy=new k({deserialize:i=>i.split(" ")});k.group=new k({deserialize:i=>i.split(" ")});k.contextHash=new k({perNode:!0});k.lookAhead=new k({perNode:!0});k.mounted=new k({perNode:!0});var Vt=Object.create(null),A=class{constructor(e,t,s,r=0){this.name=e,this.props=t,this.id=s,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Vt,s=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new A(e.name||"",t,e.id,s);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(k.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let s in e)for(let r of s.split(" "))t[r]=e[s];return s=>{for(let r=s.prop(k.group),o=-1;o<(r?r.length:0);o++){let n=t[o<0?s.name:r[o]];if(n)return n}}}};A.none=new A("",Object.create(null),0,8);var se=class{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let s of this.types){let r=null;for(let o of e){let n=o(s);n&&(r||(r=Object.assign({},s.props)),r[n[0].id]=n[1])}t.push(r?new A(s.name,r,s.id,s.flags):s)}return new se(t)}},ge=new WeakMap,Ke=new WeakMap,S;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays"})(S||(S={}));var v=class{constructor(e,t,s,r,o){if(this.type=e,this.children=t,this.positions=s,this.length=r,this.props=null,o&&o.length){this.props=Object.create(null);for(let[n,h]of o)this.props[typeof n=="number"?n:n.id]=h}}toString(){let e=this.prop(k.mounted);if(e&&!e.overlay)return e.tree.toString();let t="";for(let s of this.children){let r=s.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new ie(this.topNode,e)}cursorAt(e,t=0,s=0){let r=ge.get(this)||this.topNode,o=new ie(r);return o.moveTo(e,t),ge.set(this,o._tree),o}get topNode(){return new F(this,0,0,null)}resolve(e,t=0){let s=re(ge.get(this)||this.topNode,e,t,!1);return ge.set(this,s),s}resolveInner(e,t=0){let s=re(Ke.get(this)||this.topNode,e,t,!0);return Ke.set(this,s),s}iterate(e){let{enter:t,leave:s,from:r=0,to:o=this.length}=e,n=e.mode||0,h=(n&S.IncludeAnonymous)>0;for(let l=this.cursor(n|S.IncludeAnonymous);;){let a=!1;if(l.from<=o&&l.to>=r&&(!h&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;a=!0}for(;a&&s&&(h||!l.type.isAnonymous)&&s(l),!l.nextSibling();){if(!l.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Ae(A.none,this.children,this.positions,0,this.children.length,0,this.length,(t,s,r)=>new v(this.type,t,s,r,this.propValues),e.makeTree||((t,s,r)=>new v(A.none,t,s,r)))}static build(e){return It(e)}};v.empty=new v(A.none,[],[],0);var fe=class{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new fe(this.buffer,this.index)}},B=class{constructor(e,t,s){this.buffer=e,this.length=t,this.set=s}get type(){return A.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],s=this.buffer[e+3],r=this.set.types[t],o=r.name;if(/\W/.test(o)&&!r.isError&&(o=JSON.stringify(o)),e+=4,s==e)return o;let n=[];for(;e<s;)n.push(this.childString(e)),e=this.buffer[e+3];return o+"("+n.join(",")+")"}findChild(e,t,s,r,o){let{buffer:n}=this,h=-1;for(let l=e;l!=t&&!(et(o,r,n[l+1],n[l+2])&&(h=l,s>0));l=n[l+3]);return h}slice(e,t,s){let r=this.buffer,o=new Uint16Array(t-e),n=0;for(let h=e,l=0;h<t;){o[l++]=r[h++],o[l++]=r[h++]-s;let a=o[l++]=r[h++]-s;o[l++]=r[h++]-e,n=Math.max(n,a)}return new B(o,n,this.set)}};function et(i,e,t,s){switch(i){case-2:return t<e;case-1:return s>=e&&t<e;case 0:return t<e&&s>e;case 1:return t<=e&&s>e;case 2:return s>e;case 4:return!0}}function tt(i,e){let t=i.childBefore(e);for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(i=t,t=s.prevSibling):t=s}return i}function re(i,e,t,s){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let n=!s&&i instanceof F&&i.index<0?null:i.parent;if(!n)return i;i=n}let o=s?0:S.IgnoreOverlays;if(s)for(let n=i,h=n.parent;h;n=h,h=n.parent)n instanceof F&&n.index<0&&((r=h.enter(e,t,o))===null||r===void 0?void 0:r.from)!=n.from&&(i=h);for(;;){let n=i.enter(e,t,o);if(!n)return i;i=n}}var F=class{constructor(e,t,s,r){this._tree=e,this.from=t,this.index=s,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,s,r,o=0){for(let n=this;;){for(let{children:h,positions:l}=n._tree,a=t>0?h.length:-1;e!=a;e+=t){let f=h[e],u=l[e]+n.from;if(et(r,s,u,u+f.length)){if(f instanceof B){if(o&S.ExcludeBuffers)continue;let c=f.findChild(0,f.buffer.length,t,s-u,r);if(c>-1)return new _(new ve(n,f,e,u),null,c)}else if(o&S.IncludeAnonymous||!f.type.isAnonymous||Me(f)){let c;if(!(o&S.IgnoreMounts)&&f.props&&(c=f.prop(k.mounted))&&!c.overlay)return new F(c.tree,u,e,n);let p=new F(f,u,e,n);return o&S.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?f.children.length-1:0,t,s,r)}}}if(o&S.IncludeAnonymous||!n.type.isAnonymous||(n.index>=0?e=n.index+t:e=t<0?-1:n._parent._tree.children.length,n=n._parent,!n))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,s=0){let r;if(!(s&S.IgnoreOverlays)&&(r=this._tree.prop(k.mounted))&&r.overlay){let o=e-this.from;for(let{from:n,to:h}of r.overlay)if((t>0?n<=o:n<o)&&(t<0?h>=o:h>o))return new F(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,s)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new ie(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return re(this,e,t,!1)}resolveInner(e,t=0){return re(this,e,t,!0)}enterUnfinishedNodesBefore(e){return tt(this,e)}getChild(e,t=null,s=null){let r=be(this,e,t,s);return r.length?r[0]:null}getChildren(e,t=null,s=null){return be(this,e,t,s)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return xe(this,e)}};function be(i,e,t,s){let r=i.cursor(),o=[];if(!r.firstChild())return o;if(t!=null){for(;!r.type.is(t);)if(!r.nextSibling())return o}for(;;){if(s!=null&&r.type.is(s))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return s==null?o:[]}}function xe(i,e,t=e.length-1){for(let s=i.parent;t>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(e[t]&&e[t]!=s.name)return!1;t--}}return!0}var ve=class{constructor(e,t,s,r){this.parent=e,this.buffer=t,this.index=s,this.start=r}},_=class{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,s){this.context=e,this._parent=t,this.index=s,this.type=e.buffer.set.types[e.buffer.buffer[s]]}child(e,t,s){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,s);return o<0?null:new _(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,s=0){if(s&S.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new _(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new _(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new _(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new ie(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:s}=this.context,r=this.index+4,o=s.buffer[this.index+3];if(o>r){let n=s.buffer[this.index+1];e.push(s.slice(r,o,n)),t.push(0)}return new v(this.type,e,t,this.to-this.from)}resolve(e,t=0){return re(this,e,t,!1)}resolveInner(e,t=0){return re(this,e,t,!0)}enterUnfinishedNodesBefore(e){return tt(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,s=null){let r=be(this,e,t,s);return r.length?r[0]:null}getChildren(e,t=null,s=null){return be(this,e,t,s)}get node(){return this}matchContext(e){return xe(this,e)}},ie=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof F)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let s=e._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:s,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=s+r.buffer[e+1],this.to=s+r.buffer[e+2],!0}yield(e){return e?e instanceof F?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,s){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,s,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,s);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,s=this.mode){return this.buffer?s&S.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&S.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&S.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,s=this.stack.length-1;if(e<0){let r=s<0?0:this.stack[s]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(s<0?t.buffer.length:t.buffer[this.stack[s]+3]))return this.yieldBuf(r)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,s,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(r.buffer.buffer[o+3]<this.index)return!1;({index:t,parent:s}=r)}else({index:t,_parent:s}=this._tree);for(;s;{index:t,_parent:s}=s)if(t>-1)for(let o=t+e,n=e<0?-1:s._tree.children.length;o!=n;o+=e){let h=s._tree.children[o];if(this.mode&S.IncludeAnonymous||h instanceof B||!h.type.isAnonymous||Me(h))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,s=0;if(e&&e.context==this.buffer)e:for(let r=this.index,o=this.stack.length;o>=0;){for(let n=e;n;n=n._parent)if(n.index==r){if(r==this.index)return n;t=n,s=o+1;break e}r=this.stack[--o]}for(let r=s;r<this.stack.length;r++)t=new _(this.buffer,t,this.stack[r]);return this.bufferNode=new _(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let s=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){s++;continue}this.type.isAnonymous||(r=!0)}for(;r&&t&&t(this),r=this.type.isAnonymous,!this.nextSibling();){if(!s)return;this.parent(),s--,r=!0}}}matchContext(e){if(!this.buffer)return xe(this.node,e);let{buffer:t}=this.buffer,{types:s}=t.set;for(let r=e.length-1,o=this.stack.length-1;r>=0;o--){if(o<0)return xe(this.node,e,r);let n=s[t.buffer[this.stack[o]]];if(!n.isAnonymous){if(e[r]&&e[r]!=n.name)return!1;r--}}return!0}};function Me(i){return i.children.some(e=>e instanceof B||!e.type.isAnonymous||Me(e))}function It(i){var e;let{buffer:t,nodeSet:s,maxBufferLength:r=1024,reused:o=[],minRepeatType:n=s.types.length}=i,h=Array.isArray(t)?new fe(t,t.length):t,l=s.types,a=0,f=0;function u(w,O,d,b,y){let{id:x,start:m,end:P,size:M}=h,V=f;for(;M<0;)if(h.next(),M==-1){let G=o[x];d.push(G),b.push(m-w);return}else if(M==-3){a=x;return}else if(M==-4){f=x;return}else throw new RangeError(`Unrecognized record size: ${M}`);let K=l[x],j,L,Ge=m-w;if(P-m<=r&&(L=W(h.pos-O,y))){let G=new Uint16Array(L.size-L.skip),I=h.pos-L.size,z=G.length;for(;h.pos>I;)z=H(L.start,G,z);j=new B(G,P-L.start,s),Ge=L.start-w}else{let G=h.pos-M;h.next();let I=[],z=[],Y=x>=n?x:-1,J=0,pe=P;for(;h.pos>G;)Y>=0&&h.id==Y&&h.size>=0?(h.end<=pe-r&&(p(I,z,m,J,h.end,pe,Y,V),J=I.length,pe=h.end),h.next()):u(m,G,I,z,Y);if(Y>=0&&J>0&&J<I.length&&p(I,z,m,J,m,pe,Y,V),I.reverse(),z.reverse(),Y>-1&&J>0){let $e=c(K);j=Ae(K,I,z,0,I.length,0,P-m,$e,$e)}else j=g(K,I,z,P-m,V-P)}d.push(j),b.push(Ge)}function c(w){return(O,d,b)=>{let y=0,x=O.length-1,m,P;if(x>=0&&(m=O[x])instanceof v){if(!x&&m.type==w&&m.length==b)return m;(P=m.prop(k.lookAhead))&&(y=d[x]+m.length+P)}return g(w,O,d,b,y)}}function p(w,O,d,b,y,x,m,P){let M=[],V=[];for(;w.length>b;)M.push(w.pop()),V.push(O.pop()+d-y);w.push(g(s.types[m],M,V,x-y,P-x)),O.push(y-d)}function g(w,O,d,b,y=0,x){if(a){let m=[k.contextHash,a];x=x?[m].concat(x):[m]}if(y>25){let m=[k.lookAhead,y];x=x?[m].concat(x):[m]}return new v(w,O,d,b,x)}function W(w,O){let d=h.fork(),b=0,y=0,x=0,m=d.end-r,P={size:0,start:0,skip:0};e:for(let M=d.pos-w;d.pos>M;){let V=d.size;if(d.id==O&&V>=0){P.size=b,P.start=y,P.skip=x,x+=4,b+=4,d.next();continue}let K=d.pos-V;if(V<0||K<M||d.start<m)break;let j=d.id>=n?4:0,L=d.start;for(d.next();d.pos>K;){if(d.size<0)if(d.size==-3)j+=4;else break e;else d.id>=n&&(j+=4);d.next()}y=L,b+=V,x+=j}return(O<0||b==w)&&(P.size=b,P.start=y,P.skip=x),P.size>4?P:void 0}function H(w,O,d){let{id:b,start:y,end:x,size:m}=h;if(h.next(),m>=0&&b<n){let P=d;if(m>4){let M=h.pos-(m-4);for(;h.pos>M;)d=H(w,O,d)}O[--d]=P,O[--d]=x-w,O[--d]=y-w,O[--d]=b}else m==-3?a=b:m==-4&&(f=b);return d}let X=[],Z=[];for(;h.pos>0;)u(i.start||0,i.bufferStart||0,X,Z,-1);let R=(e=i.length)!==null&&e!==void 0?e:X.length?Z[0]+X[0].length:0;return new v(l[i.topID],X.reverse(),Z.reverse(),R)}var Je=new WeakMap;function me(i,e){if(!i.isAnonymous||e instanceof B||e.type!=i)return 1;let t=Je.get(e);if(t==null){t=1;for(let s of e.children){if(s.type!=i||!(s instanceof v)){t=1;break}t+=me(i,s)}Je.set(e,t)}return t}function Ae(i,e,t,s,r,o,n,h,l){let a=0;for(let g=s;g<r;g++)a+=me(i,e[g]);let f=Math.ceil(a*1.5/8),u=[],c=[];function p(g,W,H,X,Z){for(let R=H;R<X;){let w=R,O=W[R],d=me(i,g[R]);for(R++;R<X;R++){let b=me(i,g[R]);if(d+b>=f)break;d+=b}if(R==w+1){if(d>f){let b=g[w];p(b.children,b.positions,0,b.children.length,W[w]+Z);continue}u.push(g[w])}else{let b=W[R-1]+g[R-1].length-O;u.push(Ae(i,g,W,w,R,O,b,null,l))}c.push(O+Z-o)}}return p(e,t,s,r,0),(h||l)(u,c,n)}var ke=class{startParse(e,t,s){return typeof e=="string"&&(e=new Re(e)),s=s?s.length?s.map(r=>new ue(r.from,r.to)):[new ue(0,0)]:[new ue(0,e.length)],this.createParse(e,t||[],s)}parse(e,t,s){let r=this.startParse(e,t,s);for(;;){let o=r.advance();if(o)return o}}},Re=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var xs=new k({perNode:!0});var oe=class{constructor(e,t,s,r,o,n,h,l,a,f=0,u){this.p=e,this.stack=t,this.state=s,this.reducePos=r,this.pos=o,this.score=n,this.buffer=h,this.bufferBase=l,this.curContext=a,this.lookAhead=f,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,s=0){let r=e.parser.context;return new oe(e,[],t,s,s,0,[],0,r?new we(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let s=e>>19,r=e&65535,{parser:o}=this.p,n=o.dynamicPrecedence(r);if(n&&(this.score+=n),s==0){this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r<o.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,4,!0),this.reduceContext(r,this.reducePos);return}let h=this.stack.length-(s-1)*3-(e&262144?6:0),l=h?this.stack[h-2]:this.p.ranges[0].from,a=this.reducePos-l;a>=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=a):this.p.lastBigReductionSize<a&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=a));let f=h?this.stack[h-1]:0,u=this.bufferBase+this.buffer.length-f;if(r<o.minRepeatTerm||e&131072){let c=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,l,c,u+4,!0)}if(e&262144)this.state=this.stack[h];else{let c=this.stack[h-3];this.state=o.getGoto(c,r,!0)}for(;this.stack.length>h;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,t,s,r=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let n=this,h=this.buffer.length;if(h==0&&n.parent&&(h=n.bufferBase-n.parent.bufferBase,n=n.parent),h>0&&n.buffer[h-4]==0&&n.buffer[h-1]>-1){if(t==s)return;if(n.buffer[h-2]>=t){n.buffer[h-2]=s;return}}}if(!o||this.pos==s)this.buffer.push(e,t,s,r);else{let n=this.buffer.length;if(n>0&&this.buffer[n-4]!=0)for(;n>0&&this.buffer[n-2]>s;)this.buffer[n]=this.buffer[n-4],this.buffer[n+1]=this.buffer[n-3],this.buffer[n+2]=this.buffer[n-2],this.buffer[n+3]=this.buffer[n-1],n-=4,r>4&&(r-=4);this.buffer[n]=e,this.buffer[n+1]=t,this.buffer[n+2]=s,this.buffer[n+3]=r}}shift(e,t,s){let r=this.pos;if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=s,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,s,4);else{let o=e,{parser:n}=this.p;(s>this.pos||t<=n.maxNode)&&(this.pos=s,n.stateFlag(o,1)||(this.reducePos=s)),this.pushState(o,r),this.shiftContext(t,r),t<=n.maxNode&&this.buffer.push(t,r,s,4)}}apply(e,t,s){e&65536?this.reduce(e):this.shift(e,t,s)}useNode(e,t){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=e)&&(this.p.reused.push(e),s++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(s,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let s=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new oe(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let s=e<=this.p.parser.maxNode;s&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,s?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Ve(this);;){let s=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(s==0)return!1;if(!(s&65536))return!0;t.reduce(s)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let r=[];for(let o=0,n;o<t.length;o+=2)(n=t[o+1])!=this.state&&this.p.parser.hasAction(n,e)&&r.push(t[o],n);if(this.stack.length<120)for(let o=0;r.length<4<<1&&o<t.length;o+=2){let n=t[o+1];r.some((h,l)=>l&1&&h==n)||r.push(t[o],n)}t=r}let s=[];for(let r=0;r<t.length&&s.length<4;r+=2){let o=t[r+1];if(o==this.state)continue;let n=this.split();n.pushState(o,this.pos),n.storeNode(0,n.pos,n.pos,4,!0),n.shiftContext(t[r],this.pos),n.score-=200,s.push(n)}return s}forceReduce(){let e=this.p.parser.stateSlot(this.state,5);if(!(e&65536))return!1;let{parser:t}=this.p;if(!t.validAction(this.state,e)){let s=e>>19,r=e&65535,o=this.stack.length-s*3;if(o<0||t.getGoto(this.stack[o],r,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.reducePos,this.reducePos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.reducePos,this.reducePos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new we(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},we=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},st;(function(i){i[i.Insert=200]="Insert",i[i.Delete=190]="Delete",i[i.Reduce=100]="Reduce",i[i.MaxNext=4]="MaxNext",i[i.MaxInsertStackDepth=300]="MaxInsertStackDepth",i[i.DampenInsertStackDepth=120]="DampenInsertStackDepth",i[i.MinBigReduction=2e3]="MinBigReduction"})(st||(st={}));var Ve=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,s=e>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},he=class{constructor(e,t,s){this.stack=e,this.pos=t,this.index=s,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new he(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new he(this.stack,this.pos,this.index)}};function ce(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let s=0,r=0;s<i.length;){let o=0;for(;;){let n=i.charCodeAt(s++),h=!1;if(n==126){o=65535;break}n>=92&&n--,n>=34&&n--;let l=n-32;if(l>=46&&(l-=46,h=!0),o+=l,h)break;o*=46}t?t[r++]=o:t=new e(o)}return t}var ne=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},rt=new ne,Ie=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=rt,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let s=this.range,r=this.rangeIndex,o=this.pos+e;for(;o<s.from;){if(!r)return null;let n=this.ranges[--r];o-=s.from-n.to,s=n}for(;t<0?o>s.to:o>=s.to;){if(r==this.ranges.length-1)return null;let n=this.ranges[++r];o+=n.from-s.to,s=n}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,s,r;if(t>=0&&t<this.chunk.length)s=this.pos+e,r=this.chunk.charCodeAt(t);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(s=o,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let n=this.rangeIndex,h=this.range;for(;h.to<=s;)h=this.ranges[++n];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>h.to&&(this.chunk2=this.chunk2.slice(0,h.to-s)),r=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),r}acceptToken(e,t=0){let s=t?this.resolveOffset(t,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=s}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=rt,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let s="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(s+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return s}},$=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:s}=t.p;ut(this.data,e,t,this.id,s.data,s.tokenPrecTable)}};$.prototype.contextual=$.prototype.fallback=$.prototype.extend=!1;var Fe=class{constructor(e,t,s){this.precTable=t,this.elseToken=s,this.data=typeof e=="string"?ce(e):e}token(e,t){let s=e.pos,r=0;for(;ut(this.data,e,t,0,this.data,this.precTable),!(e.token.value>-1);){if(this.elseToken==null)return;if(e.next<0)break;e.advance(),e.reset(e.pos,e.token),r++}r&&(e.reset(s,e.token),e.acceptToken(this.elseToken,r))}};Fe.prototype.contextual=$.prototype.fallback=$.prototype.extend=!1;function ut(i,e,t,s,r,o){let n=0,h=1<<s,{dialect:l}=t.p.parser;e:for(;h&i[n];){let a=i[n+1];for(let p=n+3;p<a;p+=2)if((i[p+1]&h)>0){let g=i[p];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||Dt(g,e.token.value,r,o))){e.acceptToken(g);break}}let f=e.next,u=0,c=i[n+2];if(e.next<0&&c>u&&i[a+c*3-3]==65535&&i[a+c*3-3]==65535){n=i[a+c*3-1];continue e}for(;u<c;){let p=u+c>>1,g=a+p+(p<<1),W=i[g],H=i[g+1]||65536;if(f<W)c=p;else if(f>=H)u=p+1;else{n=i[g+2],e.advance();continue e}}break}}function it(i,e,t){for(let s=e,r;(r=i[s])!=65535;s++)if(r==t)return s-e;return-1}function Dt(i,e,t,s){let r=it(t,s,e);return r<0||it(t,s,i)<r}var D=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),Te=null,nt;(function(i){i[i.Margin=25]="Margin"})(nt||(nt={}));function ot(i,e,t){let s=i.cursor(S.IncludeAnonymous);for(s.moveTo(e);;)if(!(t<0?s.childBefore(e):s.childAfter(e)))for(;;){if((t<0?s.to<e:s.from>e)&&!s.type.isError)return t<0?Math.max(0,Math.min(s.to-1,e-25)):Math.min(i.length,Math.max(s.from+1,e+25));if(t<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return t<0?0:i.length}}var De=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ot(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ot(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let s=this.trees[t],r=this.index[t];if(r==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=s.children[r],n=this.start[t]+s.positions[r];if(n>e)return this.nextStart=n,null;if(o instanceof v){if(n==e){if(n<this.safeFrom)return null;let h=n+o.length;if(h<=this.safeTo){let l=o.prop(k.lookAhead);if(!l||h+l<this.fragment.to)return o}}this.index[t]++,n+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(n),this.index.push(0))}else this.index[t]++,this.nextStart=n+o.length}}},Ne=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(s=>new ne)}getActions(e){let t=0,s=null,{parser:r}=e.p,{tokenizers:o}=r,n=r.stateSlot(e.state,3),h=e.curContext?e.curContext.hash:0,l=0;for(let a=0;a<o.length;a++){if(!(1<<a&n))continue;let f=o[a],u=this.tokens[a];if(!(s&&!f.fallback)&&((f.contextual||u.start!=e.pos||u.mask!=n||u.context!=h)&&(this.updateCachedToken(u,f,e),u.mask=n,u.context=h),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let c=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!f.extend&&(s=u,t>c))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!s&&e.pos==this.stream.end&&(s=new ne,s.value=e.p.parser.eofTerm,s.start=s.end=e.pos,t=this.addActions(e,s.value,s.end,t)),this.mainToken=s,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ne,{pos:s,p:r}=e;return t.start=s,t.end=Math.min(s+1,r.stream.end),t.value=s==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,s){let r=this.stream.clipPos(s.pos);if(t.token(this.stream.reset(r,e),s),e.value>-1){let{parser:o}=s.p;for(let n=0;n<o.specialized.length;n++)if(o.specialized[n]==e.value){let h=o.specializers[n](this.stream.read(e.start,e.end),s);if(h>=0&&s.p.parser.dialect.allows(h>>1)){h&1?e.extended=h>>1:e.value=h>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,s,r){for(let o=0;o<r;o+=3)if(this.actions[o]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=s,r}addActions(e,t,s,r){let{state:o}=e,{parser:n}=e.p,{data:h}=n;for(let l=0;l<2;l++)for(let a=n.stateSlot(o,l?2:1);;a+=3){if(h[a]==65535)if(h[a+1]==1)a=U(h,a+2);else{r==0&&h[a+1]==2&&(r=this.putAction(U(h,a+2),t,s,r));break}h[a]==t&&(r=this.putAction(U(h,a+1),t,s,r))}return r}},ht;(function(i){i[i.Distance=5]="Distance",i[i.MaxRemainingPerStep=3]="MaxRemainingPerStep",i[i.MinBufferLengthPrune=500]="MinBufferLengthPrune",i[i.ForceReduceLimit=10]="ForceReduceLimit",i[i.CutDepth=15e3]="CutDepth",i[i.CutTo=9e3]="CutTo",i[i.MaxLeftAssociativeReductionCount=300]="MaxLeftAssociativeReductionCount",i[i.MaxStackCount=12]="MaxStackCount"})(ht||(ht={}));var Qe=class{constructor(e,t,s,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Ie(t,r),this.tokens=new Ne(e,this.stream),this.topTerm=e.top[1];let{from:o}=r[0];this.stacks=[oe.start(this,e.top[0],o)],this.fragments=s.length&&this.stream.end-o>e.bufferLength*4?new De(s,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,s=this.stacks=[],r,o;if(this.bigReductionCount>300&&e.length==1){let[n]=e;for(;n.forceReduce()&&n.stack.length&&n.stack[n.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let n=0;n<e.length;n++){let h=e[n];for(;;){if(this.tokens.mainToken=null,h.pos>t)s.push(h);else{if(this.advanceStack(h,s,e))continue;{r||(r=[],o=[]),r.push(h);let l=this.tokens.getMainToken(h);o.push(l.value,l.end)}}break}}if(!s.length){let n=r&&Nt(r);if(n)return this.stackToTree(n);if(this.parser.strict)throw D&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let n=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,s);if(n)return this.stackToTree(n.forceAll())}if(this.recovering){let n=this.recovering==1?1:this.recovering*3;if(s.length>n)for(s.sort((h,l)=>l.score-h.score);s.length>n;)s.pop();s.some(h=>h.reducePos>t)&&this.recovering--}else if(s.length>1){e:for(let n=0;n<s.length-1;n++){let h=s[n];for(let l=n+1;l<s.length;l++){let a=s[l];if(h.sameState(a)||h.buffer.length>500&&a.buffer.length>500)if((h.score-a.score||h.buffer.length-a.buffer.length)>0)s.splice(l--,1);else{s.splice(n--,1);continue e}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let n=1;n<s.length;n++)s[n].pos<this.minStackPos&&(this.minStackPos=s[n].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,s){let r=e.pos,{parser:o}=this,n=D?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let a=e.curContext&&e.curContext.tracker.strict,f=a?e.curContext.hash:0;for(let u=this.fragments.nodeAt(r);u;){let c=this.parser.nodeSet.types[u.type.id]==u.type?o.getGoto(e.state,u.type.id):-1;if(c>-1&&u.length&&(!a||(u.prop(k.contextHash)||0)==f))return e.useNode(u,c),D&&console.log(n+this.stackID(e)+` (via reuse of ${o.getName(u.type.id)})`),!0;if(!(u instanceof v)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof v&&u.positions[0]==0)u=p;else break}}let h=o.stateSlot(e.state,4);if(h>0)return e.reduce(h),D&&console.log(n+this.stackID(e)+` (via always-reduce ${o.getName(h&65535)})`),!0;if(e.stack.length>=15e3)for(;e.stack.length>9e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let a=0;a<l.length;){let f=l[a++],u=l[a++],c=l[a++],p=a==l.length||!s,g=p?e:e.split();if(g.apply(f,u,c),D&&console.log(n+this.stackID(g)+` (via ${f&65536?`reduce of ${o.getName(f&65535)}`:"shift"} for ${o.getName(u)} @ ${r}${g==e?"":", split"})`),p)return!0;g.pos>r?t.push(g):s.push(g)}return!1}advanceFully(e,t){let s=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>s)return lt(e,t),!0}}runRecovery(e,t,s){let r=null,o=!1;for(let n=0;n<e.length;n++){let h=e[n],l=t[n<<1],a=t[(n<<1)+1],f=D?this.stackID(h)+" -> ":"";if(h.deadEnd&&(o||(o=!0,h.restart(),D&&console.log(f+this.stackID(h)+" (restarted)"),this.advanceFully(h,s))))continue;let u=h.split(),c=f;for(let p=0;u.forceReduce()&&p<10&&(D&&console.log(c+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,s));p++)D&&(c=this.stackID(u)+" -> ");for(let p of h.recoverByInsert(l))D&&console.log(f+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,s);this.stream.end>h.pos?(a==h.pos&&(a++,l=0),h.recoverByDelete(l,a),D&&console.log(f+this.stackID(h)+` (via recover-delete ${this.parser.getName(l)})`),lt(h,s)):(!r||r.score<h.score)&&(r=h)}return r}stackToTree(e){return e.close(),v.build({buffer:he.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Te||(Te=new WeakMap)).get(e);return t||Te.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function lt(i,e){for(let t=0;t<e.length;t++){let s=e[t];if(s.pos==i.pos&&s.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}var _e=class{constructor(e,t,s){this.source=e,this.flags=t,this.disabled=s}allows(e){return!this.disabled||this.disabled[e]==0}};var q=class extends ke{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let h=0;h<e.repeatNodeCount;h++)t.push("");let s=Object.keys(e.topRules).map(h=>e.topRules[h][1]),r=[];for(let h=0;h<t.length;h++)r.push([]);function o(h,l,a){r[h].push([l,l.deserialize(String(a))])}if(e.nodeProps)for(let h of e.nodeProps){let l=h[0];typeof l=="string"&&(l=k[l]);for(let a=1;a<h.length;){let f=h[a++];if(f>=0)o(f,l,h[a++]);else{let u=h[a+-f];for(let c=-f;c>0;c--)o(h[a++],l,u);a++}}}this.nodeSet=new se(t.map((h,l)=>A.define({name:l>=this.minRepeatTerm?void 0:h,id:l,props:r[l],top:s.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let n=ce(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let h=0;h<this.specializerSpecs.length;h++)this.specialized[h]=this.specializerSpecs[h].term;this.specializers=this.specializerSpecs.map(at),this.states=ce(e.states,Uint32Array),this.data=ce(e.stateData),this.goto=ce(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(h=>typeof h=="number"?new $(n,h):h),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,s){let r=new Qe(this,e,t,s);for(let o of this.wrappers)r=o(r,e,t,s);return r}getGoto(e,t,s=!1){let r=this.goto;if(t>=r[0])return-1;for(let o=r[t+1];;){let n=r[o++],h=n&1,l=r[o++];if(h&&s)return l;for(let a=o+(n>>1);o<a;o++)if(r[o]==e)return l;if(h)return-1}}hasAction(e,t){let s=this.data;for(let r=0;r<2;r++)for(let o=this.stateSlot(e,r?2:1),n;;o+=3){if((n=s[o])==65535)if(s[o+1]==1)n=s[o=U(s,o+2)];else{if(s[o+1]==2)return U(s,o+2);break}if(n==t||n==0)return U(s,o+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){if(t==this.stateSlot(e,4))return!0;for(let s=this.stateSlot(e,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=U(this.data,s+2);else return!1;if(t==U(this.data,s+1))return!0}}nextStates(e){let t=[];for(let s=this.stateSlot(e,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=U(this.data,s+2);else break;if(!(this.data[s+2]&1)){let r=this.data[s+1];t.some((o,n)=>n&1&&o==r)||t.push(this.data[s],r)}}return t}configure(e){let t=Object.assign(Object.create(q.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let s=this.topRules[e.top];if(!s)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=s}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(s=>{let r=e.tokenizers.find(o=>o.from==s);return r?r.to:s})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((s,r)=>{let o=e.specializers.find(h=>h.from==s.external);if(!o)return s;let n=Object.assign(Object.assign({},s),{external:o.to});return t.specializers[r]=at(n),n})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),s=t.map(()=>!1);if(e)for(let o of e.split(" ")){let n=t.indexOf(o);n>=0&&(s[n]=!0)}let r=null;for(let o=0;o<t.length;o++)if(!s[o])for(let n=this.dialects[t[o]],h;(h=this.data[n++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[h]=1;return new _e(e,s,r)}static deserialize(e){return new q(e)}};function U(i,e){return i[e]|i[e+1]<<16}function Nt(i){let e=null;for(let t of i){let s=t.p.stoppedAt;(t.pos==t.p.stream.end||s!=null&&t.pos>s)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function at(i){if(i.external){let e=i.extend?1:0;return(t,s)=>i.external(t,s)<<1|e}return i.get}var Ee=q.deserialize({version:14,states:"%QOVQPOOOOQO'#C_'#C_O_QQO'#C^OOQO'#DO'#DOOvQQO'#C|OOQO'#DR'#DROVQPO'#CuOOQO'#C}'#C}QOQPOOOOQO'#C`'#C`O!UQQO,58xO!dQPO,59VOVQPO,59]OVQPO,59_O!iQPO,59hO!nQQO,59aOOQO'#DQ'#DQOOQO1G.d1G.dO!UQQO1G.qO!yQQO1G.wOOQO1G.y1G.yOOQO'#Cw'#CwOOQO1G/S1G/SOOQO1G.{1G.{O#[QPO'#CnO#dQPO7+$]O!UQQO'#CxO#iQPO,59YOOQO<<Gw<<GwOOQO,59d,59dOOQO-E6v-E6v",stateData:"#q~OoOS~OsPOvUO~OTXOUXOVXOWXOXXOYXO`ZO~Of[Oh]Oj^OmpX~OZ`O[`O]`O^`O~OabO~OseO~Of[Oh]OwgO~Oh]Ofeijeimeiwei~OcjOdbX~OdlO~OcjOdba~O",goto:"#YvPPw}!TPPPPPPPPPPwPP!WPP!ZP!ZP!aP!g!jPPP!p!s!aP#P!aXROU[]XQOU[]RYQRibXTOU[]XVOU[]Rf^QkhRnkRWOQSOQ_UQc[Rd]QaYQhbRmj",nodeNames:"\u26A0 Filter ColumnValueExpression Column Operator Eq NotEq Gt Lt Starts Ends Number String True False ColumnSetExpression In LBrack Values Comma RBrack AndExpression And OrExpression Or ParenthesizedExpression As FilterName",maxTerm:39,skippedNodes:[0],repeatNodeCount:1,tokenData:"6p~RnXY#PYZ#P]^#Ppq#Pqr#brs#mxy$eyz$j|}$o!O!P$t!Q![%S!^!_%_!_!`%d!`!a%i!c!}%n!}#O&V#P#Q&[#R#S%n#T#U&a#U#X%n#X#Y(w#Y#Z+]#Z#]%n#]#^.]#^#c%n#c#d/e#d#g%n#g#h0m#h#i4[#i#o%n~#USo~XY#PYZ#P]^#Ppq#P~#eP!_!`#h~#mOU~~#pWOX#mZ]#m^r#mrs$Ys#O#m#P;'S#m;'S;=`$_<%lO#m~$_O[~~$bP;=`<%l#m~$jOv~~$oOw~~$tOc~~$wP!Q![$z~%PPZ~!Q![$z~%XQZ~!O!P$t!Q![%S~%dOW~~%iOT~~%nOV~P%sUsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%n~&[Oa~~&aOd~R&fYsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c'U#c#g%n#g#h(^#h#o%nR'ZWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#W%n#W#X's#X#o%nR'zUfQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR(eUjQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR(|WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c)f#c#o%nR)kWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#W%n#W#X*T#X#o%nR*YWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h*r#h#o%nR*yUYQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR+bVsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#U+w#U#o%nR+|WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#`%n#`#a,f#a#o%nR,kWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h-T#h#o%nR-YWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#X%n#X#Y-r#Y#o%nR-yU^QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR.bWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c.z#c#o%nR/RU`QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR/jWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g0S#g#o%nR0ZUhQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR0rWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#h%n#h#i1[#i#o%nR1aVsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#U1v#U#o%nR1{WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g2e#g#o%nR2jWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#h%n#h#i3S#i#o%nR3XWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h3q#h#o%nR3xUXQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR4aWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g4y#g#o%nR5OWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#i%n#i#j5h#j#o%nR5mWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#X%n#X#Y6V#Y#o%nR6^U]QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%n",tokenizers:[0,1],topRules:{Filter:[0,1]},tokenPrec:0});var E=require("@vuu-ui/vuu-utils");var T,Le=class{constructor(){Ye(this,T,void 0)}setFilterCombinatorOp(e,t=N(this,T)){(0,E.isMultiClauseFilter)(t)&&t.op===e||Pe(this,T,{op:e,filters:[N(this,T)]})}add(e){if(N(this,T)===void 0)Pe(this,T,e);else if((0,E.isMultiClauseFilter)(N(this,T)))N(this,T).filters.push(e);else throw Error("Invalid filter passed to FilterExpression")}setColumn(e,t=N(this,T)){if((0,E.isMultiClauseFilter)(t)){let s=t.filters.at(-1);s&&this.setColumn(e,s)}else t&&(t.column=e)}setOp(e,t=N(this,T)){if((0,E.isMultiClauseFilter)(t)){let s=t.filters.at(-1);s&&this.setOp(e,s)}else t&&(t.op=e)}setValue(e,t=N(this,T)){var s;if((0,E.isMultiClauseFilter)(t)){let r=t.filters.at(-1);r&&this.setValue(e,r)}else(0,E.isMultiValueFilter)(t)?((s=t.values)!=null||(t.values=[]),t.values.push(e)):(0,E.isSingleValueFilter)(t)&&(t.value=e)}toJSON(e=N(this,T)){return this.name?{...e,name:this.name}:e}};T=new WeakMap;var ze=(i,e)=>{let t=new Le,s=i.cursor();do{let{name:r,from:o,to:n}=s;switch(r){case"ColumnValueExpression":t.add({});break;case"ColumnSetExpression":t.add({op:"in"});break;case"Or":case"And":t.setFilterCombinatorOp(e.substring(o,n));break;case"Column":t.setColumn(e.substring(o,n));break;case"Operator":t.setOp(e.substring(o,n));break;case"String":t.setValue(e.substring(o+1,n-1));break;case"Number":t.setValue(parseFloat(e.substring(o,n)));break;case"True":t.setValue(!0);break;case"False":t.setValue(!1);break;case"FilterName":t.name=e.substring(o,n);break;default:}}while(s.next());return t.toJSON()};var Qt=Ee.configure({strict:!0}),Be=i=>{let e=Qt.parse(i);return ze(e,i)};var ft=new Map,_t=()=>!1,Ue=(i,e)=>{let t=ft.get(e);if(t)return t;try{let s=Be(e);return t=We(i,s),ft.set(e,t),t}catch{return console.warn(`filter-evaluation-utils, failed to parse filter "${e}"`),_t}};function We(i,e){switch(e.op){case"in":return Et(i,e);case"=":return Lt(i,e);case">":return zt(i,e);case">=":return Bt(i,e);case"<":return Ut(i,e);case"<=":return Wt(i,e);case"starts":return jt(i,e);case"and":return Gt(i,e);case"or":return $t(i,e);default:return console.log(`unrecognized filter type ${e.op}`),()=>!0}}var Et=(i,e)=>t=>e.values.indexOf(t[i[e.column]])!==-1,Lt=(i,e)=>t=>t[i[e.column]]===e.value,zt=(i,e)=>t=>t[i[e.column]]>e.value,Bt=(i,e)=>t=>t[i[e.column]]>=e.value,Ut=(i,e)=>t=>t[i[e.column]]<e.value,Wt=(i,e)=>t=>t[i[e.column]]<=e.value,jt=(i,e)=>{let t=e.value;if(typeof t!="string")throw Error("string filter applied to value of wrong type");return s=>{let r=s[i[e.column]];if(typeof r!="string")throw Error("string filter applied to value of wrong type");return r.toLowerCase().startsWith(t.toLowerCase())}},Gt=(i,e)=>{let t=e.filters.map(s=>We(i,s));return s=>t.every(r=>r(s))};function $t(i,e){let t=e.filters.map(s=>We(i,s));return s=>t.some(r=>r(s))}var le=require("@vuu-ui/vuu-utils"),je=require("react"),Xt="addRowsFromInstruments",{KEY:ct}=le.metadataKeys,Yt={},pt=i=>i.type==="vuu-links",qt=i=>i.type==="vuu-link-created",Ht=i=>i.type==="vuu-link-removed",dt=i=>i.type==="vuu-menu",Zt=i=>dt(i)||pt(i),Kt=i=>i.type==="vuu-link-created"||i.type==="vuu-link-removed",Jt=i=>"rpcName"in i,es=i=>"menus"in i,ts=i=>i.name==="ROOT",gt=i=>i.context==="cell",ss=i=>i.context==="row",rs=i=>i.context==="selected-rows",is=(i,e,t=0)=>{switch(i){case"grid":return e==="selected-rows"?t>0:!0;case"header":return e==="grid";default:return!1}},ns=(i,e,t,s,r)=>{if(i==="cell"||i==="row")return Ue(r,s)(e);if(i==="selected-rows"){if(t.length===0)return!1;{let o=Ue(r,s);return t.every(o)}}return!0},os=i=>{let{rpcName:e}=i;return gt(i)?{field:i.field,rowKey:i.rowKey,rpcName:e,value:i.value,type:"VIEW_PORT_MENU_CELL_RPC"}:ss(i)?{rowKey:i.rowKey,row:i.row,rpcName:e,type:"VIEW_PORT_MENU_ROW_RPC"}:rs(i)?{rpcName:e,type:"VIEW_PORT_MENUS_SELECT_RPC"}:{rpcName:e,type:"VIEW_PORT_MENU_TABLE_RPC"}},hs=({filter:i})=>typeof i=="string"&&i.length>0,ls=(i,e)=>{switch(i.context){case"cell":return{...i,field:e.columnName,rowKey:e.row[ct],value:e.row[e.columnMap[e.columnName]]};case"row":return{...i,row:(0,le.getRowRecord)(e.row,e.columnMap),rowKey:e.row[ct]};default:return i}},mt=(i,e,t)=>{var s;return es(i)?i.menus.some(r=>mt(r,e,t)):is(e,i.context,(s=t.selectedRows)==null?void 0:s.length)?e==="grid"&&hs(i)?ns(i.context,t.row,t.selectedRows,i.filter,t.columnMap):gt(i)&&i.field!=="*"?i.field===t.columnName:!0:!1},bt=(i,e,t)=>{if(mt(i,e,t)){if(Jt(i))return{label:i.name,action:"MENU_RPC_CALL",options:ls(i,t)};{let s=i.menus.map(r=>bt(r,e,t)).filter(r=>r!==void 0);if(s.length>0)return{label:i.name,children:s}}}},as=({dataSource:i,menuActionConfig:e=Yt,onRpcResponse:t})=>{let s=(0,je.useCallback)((o,n)=>{let{visualLink:h,visualLinks:l,vuuMenu:a}=e,f=[];if(o==="grid"&&l&&!h&&l.forEach(u=>{let{link:c,label:p}=u,g=p||c.toTable;f.push({label:`Link to ${g}`,action:"link-table",options:u})}),a){let u=bt(a,o,n);ts(a)&&(0,le.isGroupMenuItemDescriptor)(u)?f.push(...u.children):u&&f.push(u)}return f},[e]),r=(0,je.useCallback)((o,n)=>{if(o==="MENU_RPC_CALL"){let h=os(n);return i.menuRpcCall(h).then(l=>{t&&l&&t&&t(l)}),!0}else{if(o==="link-table")return i.visualLink=n,!0;console.log(`useViewServer handleMenuAction, can't handle action type ${o}`)}return!1},[i,t]);return{buildViewserverMenuOptions:s,handleMenuAction:r}};var ae=require("react"),xt=require("@vuu-ui/vuu-data"),us=()=>{let[i,e]=(0,ae.useState)(),t=(0,ae.useCallback)(s=>{let r=new Map;return s.forEach(o=>{r.set(o.table.table,o)}),r},[]);return(0,ae.useEffect)(()=>{async function s(){let r=await(0,xt.getServerAPI)(),{tables:o}=await r.getTableList(),n=t(await Promise.all(o.map(h=>r.getTableSchema(h))));e(n)}s()},[t]),i};
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ MovingWindow: () => MovingWindow,
24
+ addRowsFromInstruments: () => addRowsFromInstruments,
25
+ getTypeaheadParams: () => getTypeaheadParams,
26
+ isViewportMenusAction: () => isViewportMenusAction,
27
+ isVisualLinkCreatedAction: () => isVisualLinkCreatedAction,
28
+ isVisualLinkRemovedAction: () => isVisualLinkRemovedAction,
29
+ isVisualLinksAction: () => isVisualLinksAction,
30
+ isVuuFeatureAction: () => isVuuFeatureAction,
31
+ isVuuFeatureInvocation: () => isVuuFeatureInvocation,
32
+ useDataSource: () => useDataSource,
33
+ useServerConnectionQuality: () => useServerConnectionQuality,
34
+ useServerConnectionStatus: () => useServerConnectionStatus,
35
+ useTypeaheadSuggestions: () => useTypeaheadSuggestions,
36
+ useVuuMenuActions: () => useVuuMenuActions,
37
+ useVuuTables: () => useVuuTables
38
+ });
39
+ module.exports = __toCommonJS(src_exports);
40
+
41
+ // src/hooks/useDataSource.ts
42
+ var import_vuu_utils = require("@vuu-ui/vuu-utils");
43
+ var import_react = require("react");
44
+ var { SELECTED } = import_vuu_utils.metadataKeys;
45
+ function useDataSource({
46
+ dataSource,
47
+ renderBufferSize = 10
48
+ }) {
49
+ const [, forceUpdate] = (0, import_react.useState)(null);
50
+ const isMounted = (0, import_react.useRef)(true);
51
+ const hasUpdated = (0, import_react.useRef)(false);
52
+ const rafHandle = (0, import_react.useRef)(null);
53
+ const data = (0, import_react.useRef)([]);
54
+ const rangeRef = (0, import_react.useRef)({ from: 0, to: 10 });
55
+ const dataWindow = (0, import_react.useMemo)(
56
+ () => new MovingWindow((0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize)),
57
+ [renderBufferSize]
58
+ );
59
+ const setData = (0, import_react.useCallback)(
60
+ (updates) => {
61
+ for (const row of updates) {
62
+ dataWindow.add(row);
63
+ }
64
+ data.current = dataWindow.data.slice();
65
+ hasUpdated.current = true;
66
+ },
67
+ [dataWindow]
68
+ );
69
+ const datasourceMessageHandler = (0, import_react.useCallback)(
70
+ (message) => {
71
+ if (message.type === "viewport-update") {
72
+ if (message.size !== void 0) {
73
+ dataWindow.setRowCount(message.size);
74
+ }
75
+ if (message.rows) {
76
+ setData(message.rows);
77
+ forceUpdate({});
78
+ } else if (message.size !== void 0) {
79
+ data.current = dataWindow.data.slice();
80
+ hasUpdated.current = true;
81
+ }
82
+ }
83
+ },
84
+ [dataWindow, setData]
85
+ );
86
+ (0, import_react.useEffect)(
87
+ () => () => {
88
+ if (rafHandle.current) {
89
+ cancelAnimationFrame(rafHandle.current);
90
+ rafHandle.current = null;
91
+ }
92
+ isMounted.current = false;
93
+ },
94
+ []
95
+ );
96
+ const setRange = (0, import_react.useCallback)(
97
+ (range) => {
98
+ rangeRef.current = range;
99
+ const fullRange = (0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize);
100
+ dataSource.range = fullRange;
101
+ dataWindow.setRange(fullRange.from, fullRange.to);
102
+ },
103
+ [dataSource, dataWindow, renderBufferSize]
104
+ );
105
+ (0, import_react.useMemo)(() => {
106
+ const { from, to } = rangeRef.current;
107
+ const fullRange = (0, import_vuu_utils.getFullRange)({ from, to }, renderBufferSize);
108
+ dataSource.range = fullRange;
109
+ dataWindow.setRange(fullRange.from, fullRange.to);
110
+ }, [dataSource, dataWindow, renderBufferSize]);
111
+ (0, import_react.useEffect)(() => {
112
+ const { from, to } = (0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize);
113
+ dataSource.subscribe(
114
+ {
115
+ range: { from, to }
116
+ },
117
+ datasourceMessageHandler
118
+ );
119
+ }, [dataSource, datasourceMessageHandler, renderBufferSize]);
120
+ (0, import_react.useEffect)(
121
+ () => () => {
122
+ dataSource.unsubscribe();
123
+ },
124
+ [dataSource]
125
+ );
126
+ return [
127
+ data.current,
128
+ dataWindow.rowCount,
129
+ (0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize),
130
+ setRange
131
+ ];
132
+ }
133
+ var MovingWindow = class {
134
+ constructor({ from, to }) {
135
+ this.rowCount = 0;
136
+ this.setRowCount = (rowCount) => {
137
+ if (rowCount < this.data.length) {
138
+ this.data.length = rowCount;
139
+ }
140
+ this.rowCount = rowCount;
141
+ };
142
+ this.range = new import_vuu_utils.WindowRange(from, to);
143
+ this.data = new Array(to - from);
144
+ }
145
+ add(data) {
146
+ const [index] = data;
147
+ if (this.isWithinRange(index)) {
148
+ const internalIndex = index - this.range.from;
149
+ this.data[internalIndex] = data;
150
+ if (this.data[internalIndex - 1]) {
151
+ if (this.data[internalIndex - 1][SELECTED] === 1 && data[SELECTED] === 0) {
152
+ data[SELECTED] = 2;
153
+ }
154
+ }
155
+ if (index === this.rowCount - 1) {
156
+ this.data.length = internalIndex + 1;
157
+ }
158
+ }
159
+ }
160
+ getAtIndex(index) {
161
+ return this.range.isWithin(index) && this.data[index - this.range.from] != null ? this.data[index - this.range.from] : void 0;
162
+ }
163
+ isWithinRange(index) {
164
+ return this.range.isWithin(index);
165
+ }
166
+ setRange(from, to) {
167
+ if (from !== this.range.from || to !== this.range.to) {
168
+ const [overlapFrom, overlapTo] = this.range.overlap(from, to);
169
+ const newData = new Array(to - from);
170
+ for (let i = overlapFrom; i < overlapTo; i++) {
171
+ const data = this.getAtIndex(i);
172
+ if (data) {
173
+ const index = i - from;
174
+ newData[index] = data;
175
+ }
176
+ }
177
+ this.data = newData;
178
+ this.range.from = from;
179
+ this.range.to = to;
180
+ }
181
+ }
182
+ };
183
+
184
+ // src/hooks/useServerConnectionStatus.ts
185
+ var import_react2 = require("react");
186
+ var import_vuu_data = require("@vuu-ui/vuu-data");
187
+ var useServerConnectionStatus = () => {
188
+ const [connectionStatus, setConnectionStatus] = (0, import_react2.useState)("disconnected");
189
+ const handleStatusChange = (0, import_react2.useCallback)(
190
+ ({ status }) => {
191
+ setConnectionStatus(status);
192
+ },
193
+ []
194
+ );
195
+ (0, import_react2.useEffect)(() => {
196
+ import_vuu_data.ConnectionManager.on("connection-status", handleStatusChange);
197
+ return () => {
198
+ import_vuu_data.ConnectionManager.removeListener("connection-status", handleStatusChange);
199
+ };
200
+ }, [handleStatusChange]);
201
+ return connectionStatus;
202
+ };
203
+
204
+ // src/hooks/useServerConnectionQuality.ts
205
+ var import_react3 = require("react");
206
+ var import_vuu_data2 = require("@vuu-ui/vuu-data");
207
+ var useServerConnectionQuality = () => {
208
+ const [messagesPerSecond, setMessagesPerSecond] = (0, import_react3.useState)(0);
209
+ const handleConnectivityMessage = (0, import_react3.useCallback)(({ messages }) => {
210
+ setMessagesPerSecond(messages.messagesLength);
211
+ }, []);
212
+ (0, import_react3.useEffect)(() => {
213
+ import_vuu_data2.ConnectionManager.on("connection-metrics", handleConnectivityMessage);
214
+ return () => {
215
+ import_vuu_data2.ConnectionManager.removeListener(
216
+ "connection-metrics",
217
+ handleConnectivityMessage
218
+ );
219
+ };
220
+ }, [handleConnectivityMessage]);
221
+ return messagesPerSecond;
222
+ };
223
+
224
+ // src/hooks/useTypeaheadSuggestions.ts
225
+ var import_react4 = require("react");
226
+ var import_vuu_data3 = require("@vuu-ui/vuu-data");
227
+ var TYPEAHEAD_MESSAGE_CONSTANTS = {
228
+ type: "RPC_CALL",
229
+ service: "TypeAheadRpcHandler"
230
+ };
231
+ var getTypeaheadParams = (table, column, text = "", selectedValues = []) => {
232
+ if (text !== "" && !selectedValues.includes(text.toLowerCase())) {
233
+ return [table, column, text];
234
+ }
235
+ return [table, column];
236
+ };
237
+ var useTypeaheadSuggestions = () => {
238
+ const getTypeaheadSuggestions = (0, import_react4.useCallback)(
239
+ async (params) => {
240
+ const rpcMessage = params.length === 2 ? {
241
+ method: "getUniqueFieldValues",
242
+ params,
243
+ ...TYPEAHEAD_MESSAGE_CONSTANTS
244
+ } : {
245
+ method: "getUniqueFieldValuesStartingWith",
246
+ params,
247
+ ...TYPEAHEAD_MESSAGE_CONSTANTS
248
+ };
249
+ const suggestions = await (0, import_vuu_data3.makeRpcCall)(rpcMessage);
250
+ return suggestions;
251
+ },
252
+ []
253
+ );
254
+ return getTypeaheadSuggestions;
255
+ };
256
+
257
+ // src/hooks/useVuuMenuActions.ts
258
+ var import_vuu_filter_parser = require("@vuu-ui/vuu-filter-parser");
259
+ var import_vuu_utils2 = require("@vuu-ui/vuu-utils");
260
+ var import_react5 = require("react");
261
+ var addRowsFromInstruments = "addRowsFromInstruments";
262
+ var { KEY } = import_vuu_utils2.metadataKeys;
263
+ var NO_CONFIG = {};
264
+ var isVisualLinksAction = (action) => action.type === "vuu-links";
265
+ var isVisualLinkCreatedAction = (action) => action.type === "vuu-link-created";
266
+ var isVisualLinkRemovedAction = (action) => action.type === "vuu-link-removed";
267
+ var isViewportMenusAction = (action) => action.type === "vuu-menu";
268
+ var isVuuFeatureAction = (action) => isViewportMenusAction(action) || isVisualLinksAction(action);
269
+ var isVuuFeatureInvocation = (action) => action.type === "vuu-link-created" || action.type === "vuu-link-removed";
270
+ var isMenuItem = (menu) => "rpcName" in menu;
271
+ var isGroupMenuItem = (menu) => "menus" in menu;
272
+ var isRoot = (menu) => menu.name === "ROOT";
273
+ var isCellMenu = (options) => options.context === "cell";
274
+ var isRowMenu = (options) => options.context === "row";
275
+ var isSelectionMenu = (options) => options.context === "selected-rows";
276
+ var vuuContextCompatibleWithTableLocation = (uiLocation, vuuContext, selectedRowCount = 0) => {
277
+ switch (uiLocation) {
278
+ case "grid":
279
+ if (vuuContext === "selected-rows") {
280
+ return selectedRowCount > 0;
281
+ } else {
282
+ return true;
283
+ }
284
+ case "header":
285
+ return vuuContext === "grid";
286
+ default:
287
+ return false;
288
+ }
289
+ };
290
+ var gridRowMeetsFilterCriteria = (context, row, selectedRows, filter, columnMap) => {
291
+ if (context === "cell" || context === "row") {
292
+ const filterPredicate = (0, import_vuu_filter_parser.getFilterPredicate)(columnMap, filter);
293
+ return filterPredicate(row);
294
+ } else if (context === "selected-rows") {
295
+ if (selectedRows.length === 0) {
296
+ return false;
297
+ } else {
298
+ const filterPredicate = (0, import_vuu_filter_parser.getFilterPredicate)(columnMap, filter);
299
+ return selectedRows.every(filterPredicate);
300
+ }
301
+ }
302
+ return true;
303
+ };
304
+ var getMenuRpcRequest = (options) => {
305
+ const { rpcName } = options;
306
+ if (isCellMenu(options)) {
307
+ return {
308
+ field: options.field,
309
+ rowKey: options.rowKey,
310
+ rpcName,
311
+ value: options.value,
312
+ type: "VIEW_PORT_MENU_CELL_RPC"
313
+ };
314
+ } else if (isRowMenu(options)) {
315
+ return {
316
+ rowKey: options.rowKey,
317
+ row: options.row,
318
+ rpcName,
319
+ type: "VIEW_PORT_MENU_ROW_RPC"
320
+ };
321
+ } else if (isSelectionMenu(options)) {
322
+ return {
323
+ rpcName,
324
+ type: "VIEW_PORT_MENUS_SELECT_RPC"
325
+ };
326
+ } else {
327
+ return {
328
+ rpcName,
329
+ type: "VIEW_PORT_MENU_TABLE_RPC"
330
+ };
331
+ }
332
+ };
333
+ var hasFilter = ({ filter }) => typeof filter === "string" && filter.length > 0;
334
+ var getMenuItemOptions = (menu, options) => {
335
+ switch (menu.context) {
336
+ case "cell":
337
+ return {
338
+ ...menu,
339
+ field: options.columnName,
340
+ rowKey: options.row[KEY],
341
+ value: options.row[options.columnMap[options.columnName]]
342
+ };
343
+ case "row":
344
+ return {
345
+ ...menu,
346
+ row: (0, import_vuu_utils2.getRowRecord)(options.row, options.columnMap),
347
+ rowKey: options.row[KEY]
348
+ };
349
+ default:
350
+ return menu;
351
+ }
352
+ };
353
+ var menuShouldBeRenderedInThisContext = (menuItem, tableLocation, options) => {
354
+ var _a;
355
+ if (isGroupMenuItem(menuItem)) {
356
+ return menuItem.menus.some(
357
+ (childMenu) => menuShouldBeRenderedInThisContext(childMenu, tableLocation, options)
358
+ );
359
+ }
360
+ if (!vuuContextCompatibleWithTableLocation(
361
+ tableLocation,
362
+ menuItem.context,
363
+ (_a = options.selectedRows) == null ? void 0 : _a.length
364
+ )) {
365
+ return false;
366
+ }
367
+ if (tableLocation === "grid" && hasFilter(menuItem)) {
368
+ return gridRowMeetsFilterCriteria(
369
+ menuItem.context,
370
+ options.row,
371
+ options.selectedRows,
372
+ menuItem.filter,
373
+ options.columnMap
374
+ );
375
+ }
376
+ if (isCellMenu(menuItem) && menuItem.field !== "*") {
377
+ return menuItem.field === options.columnName;
378
+ }
379
+ return true;
380
+ };
381
+ var buildMenuDescriptor = (menu, tableLocation, options) => {
382
+ if (menuShouldBeRenderedInThisContext(menu, tableLocation, options)) {
383
+ if (isMenuItem(menu)) {
384
+ return {
385
+ label: menu.name,
386
+ action: "MENU_RPC_CALL",
387
+ options: getMenuItemOptions(menu, options)
388
+ };
389
+ } else {
390
+ const children = menu.menus.map(
391
+ (childMenu) => buildMenuDescriptor(childMenu, tableLocation, options)
392
+ ).filter(
393
+ (childMenu) => childMenu !== void 0
394
+ );
395
+ if (children.length > 0) {
396
+ return {
397
+ label: menu.name,
398
+ children
399
+ };
400
+ }
401
+ }
402
+ }
403
+ };
404
+ var useVuuMenuActions = ({
405
+ dataSource,
406
+ menuActionConfig = NO_CONFIG,
407
+ onRpcResponse
408
+ }) => {
409
+ const buildViewserverMenuOptions = (0, import_react5.useCallback)(
410
+ (tableLocation, options) => {
411
+ const { visualLink, visualLinks, vuuMenu } = menuActionConfig;
412
+ const descriptors = [];
413
+ if (tableLocation === "grid" && visualLinks && !visualLink) {
414
+ visualLinks.forEach((linkDescriptor) => {
415
+ const { link, label: linkLabel } = linkDescriptor;
416
+ const label = linkLabel ? linkLabel : link.toTable;
417
+ descriptors.push({
418
+ label: `Link to ${label}`,
419
+ action: "link-table",
420
+ options: linkDescriptor
421
+ });
422
+ });
423
+ }
424
+ if (vuuMenu) {
425
+ const menuDescriptor = buildMenuDescriptor(
426
+ vuuMenu,
427
+ tableLocation,
428
+ options
429
+ );
430
+ if (isRoot(vuuMenu) && (0, import_vuu_utils2.isGroupMenuItemDescriptor)(menuDescriptor)) {
431
+ descriptors.push(...menuDescriptor.children);
432
+ } else if (menuDescriptor) {
433
+ descriptors.push(menuDescriptor);
434
+ }
435
+ }
436
+ return descriptors;
437
+ },
438
+ [menuActionConfig]
439
+ );
440
+ const handleMenuAction = (0, import_react5.useCallback)(
441
+ (type, options) => {
442
+ if (type === "MENU_RPC_CALL") {
443
+ const rpcRequest = getMenuRpcRequest(options);
444
+ dataSource.menuRpcCall(rpcRequest).then((rpcResponse) => {
445
+ if (onRpcResponse && rpcResponse) {
446
+ onRpcResponse && onRpcResponse(rpcResponse);
447
+ }
448
+ });
449
+ return true;
450
+ } else if (type === "link-table") {
451
+ return dataSource.visualLink = options, true;
452
+ } else {
453
+ console.log(
454
+ `useViewServer handleMenuAction, can't handle action type ${type}`
455
+ );
456
+ }
457
+ return false;
458
+ },
459
+ [dataSource, onRpcResponse]
460
+ );
461
+ return {
462
+ buildViewserverMenuOptions,
463
+ handleMenuAction
464
+ };
465
+ };
466
+
467
+ // src/hooks/useVuuTables.ts
468
+ var import_react6 = require("react");
469
+ var import_vuu_data4 = require("@vuu-ui/vuu-data");
470
+ var useVuuTables = () => {
471
+ const [tables, setTables] = (0, import_react6.useState)();
472
+ const buildTables = (0, import_react6.useCallback)((schemas) => {
473
+ const vuuTables = /* @__PURE__ */ new Map();
474
+ schemas.forEach((schema) => {
475
+ vuuTables.set(schema.table.table, schema);
476
+ });
477
+ return vuuTables;
478
+ }, []);
479
+ (0, import_react6.useEffect)(() => {
480
+ async function fetchTableMetadata() {
481
+ const server = await (0, import_vuu_data4.getServerAPI)();
482
+ const { tables: tables2 } = await server.getTableList();
483
+ const tableSchemas = buildTables(
484
+ await Promise.all(
485
+ tables2.map(
486
+ (tableDescriptor) => server.getTableSchema(tableDescriptor)
487
+ )
488
+ )
489
+ );
490
+ setTables(tableSchemas);
491
+ }
492
+ fetchTableMetadata();
493
+ }, [buildTables]);
494
+ return tables;
495
+ };
2
496
  //# sourceMappingURL=index.js.map