sqlmesh 0.181.2.dev18__py3-none-any.whl → 0.181.2.dev20__py3-none-any.whl

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.
Files changed (51) hide show
  1. sqlmesh/_version.py +2 -2
  2. {sqlmesh-0.181.2.dev18.dist-info → sqlmesh-0.181.2.dev20.dist-info}/METADATA +1 -1
  3. {sqlmesh-0.181.2.dev18.dist-info → sqlmesh-0.181.2.dev20.dist-info}/RECORD +49 -49
  4. web/client/dist/assets/{Audits-l42KyvAS.js → Audits--i7rYGSa.js} +1 -1
  5. web/client/dist/assets/{Banner-BDixHB-p.js → Banner-DF5cAYB3.js} +1 -1
  6. web/client/dist/assets/{ChevronDownIcon-D_X0FuzI.js → ChevronDownIcon-_pxKYWw3.js} +1 -1
  7. web/client/dist/assets/{ChevronRightIcon-Ci-vtEDD.js → ChevronRightIcon-CefdPe7l.js} +1 -1
  8. web/client/dist/assets/{Content-UFxrHkDI.js → Content-CTSG98TE.js} +1 -1
  9. web/client/dist/assets/{Content-oIWFleXF.js → Content-DP0RBcBf.js} +1 -1
  10. web/client/dist/assets/{Data-CLMGP4j8.js → Data-C_D2LPey.js} +1 -1
  11. web/client/dist/assets/{DataCatalog-3BLO9jd2.js → DataCatalog-C6QIcOlP.js} +1 -1
  12. web/client/dist/assets/{Editor-3TWmSfut.js → Editor-DJCE_ntM.js} +1 -1
  13. web/client/dist/assets/{Editor-CScUJsI9.js → Editor-DmDOoKYg.js} +1 -1
  14. web/client/dist/assets/{Errors-Dg9IT6GW.js → Errors-B0nrU2iZ.js} +1 -1
  15. web/client/dist/assets/{FileExplorer-BtGXfFe1.js → FileExplorer-oDv7Eqdg.js} +1 -1
  16. web/client/dist/assets/{Footer-B_18qn6L.js → Footer-BKOrdgAB.js} +1 -1
  17. web/client/dist/assets/{Header-BIhjjExl.js → Header-BQ_cV1fD.js} +1 -1
  18. web/client/dist/assets/{Input-DZVp-T-c.js → Input-CNRmf1P2.js} +1 -1
  19. web/client/dist/assets/Lineage-Cmw3A5oO.js +1 -0
  20. web/client/dist/assets/{ListboxShow-B9WQbaml.js → ListboxShow-D2SfV_lp.js} +1 -1
  21. web/client/dist/assets/{ModelLineage-MOGS_tcv.js → ModelLineage-Chq1txJw.js} +1 -1
  22. web/client/dist/assets/{Models-C0kma0wJ.js → Models-z9CSIay9.js} +1 -1
  23. web/client/dist/assets/{Page-yGHiQgIZ.js → Page-DNluW_Oq.js} +1 -1
  24. web/client/dist/assets/{Plan-DWtNBwNf.js → Plan-BnEsOAVM.js} +1 -1
  25. web/client/dist/assets/{PlusCircleIcon-DTPvu0Q9.js → PlusCircleIcon-C_oR9H28.js} +1 -1
  26. web/client/dist/assets/{ReportErrors-C0yNCCMn.js → ReportErrors-BS1FbDhZ.js} +1 -1
  27. web/client/dist/assets/{Root-C33PD4Lp.js → Root-DGB1oz4_.js} +1 -1
  28. web/client/dist/assets/{SearchList-DBo20Eyw.js → SearchList-DenwkrNa.js} +1 -1
  29. web/client/dist/assets/{SelectEnvironment-C7g9UP89.js → SelectEnvironment-M4epaYAa.js} +1 -1
  30. web/client/dist/assets/{SourceList--1bRy5wi.js → SourceList-DZowh00b.js} +1 -1
  31. web/client/dist/assets/{SourceListItem-BHapbzta.js → SourceListItem-BCR0gsPk.js} +1 -1
  32. web/client/dist/assets/{SplitPane-CazWmOU8.js → SplitPane-LM6lbO06.js} +1 -1
  33. web/client/dist/assets/{Tests-RpyW36kr.js → Tests-B9FFl0mr.js} +1 -1
  34. web/client/dist/assets/{Welcome-Bp53remK.js → Welcome-Dp8mGwQ0.js} +1 -1
  35. web/client/dist/assets/context-CL_HG-xI.js +65 -0
  36. web/client/dist/assets/{context-BtbAVpZW.js → context-CdQ7jSjG.js} +1 -1
  37. web/client/dist/assets/{editor-DOmheF0n.js → editor-CFjxlO9u.js} +1 -1
  38. web/client/dist/assets/{file-DnIRvHeq.js → file-Dc9MV3mO.js} +1 -1
  39. web/client/dist/assets/{help-CBrid8WS.js → help-DnBhZsmH.js} +1 -1
  40. web/client/dist/assets/{index-C8Tw_Auq.js → index-1Gje0-Tv.js} +1 -1
  41. web/client/dist/assets/{index-BQLGC90G.js → index-BYdIMlzP.js} +1 -1
  42. web/client/dist/assets/{plan-BXjInmzU.js → plan-BBb6522E.js} +1 -1
  43. web/client/dist/assets/{project-Dj_oOi4n.js → project-DyvofLzB.js} +1 -1
  44. web/client/dist/assets/{transition-CnSw8kwk.js → transition-BAtDdXay.js} +1 -1
  45. web/client/dist/index.html +1 -1
  46. web/client/dist/assets/Lineage-DKjxAj6r.js +0 -1
  47. web/client/dist/assets/context-BS6KWtz-.js +0 -61
  48. {sqlmesh-0.181.2.dev18.dist-info → sqlmesh-0.181.2.dev20.dist-info}/WHEEL +0 -0
  49. {sqlmesh-0.181.2.dev18.dist-info → sqlmesh-0.181.2.dev20.dist-info}/entry_points.txt +0 -0
  50. {sqlmesh-0.181.2.dev18.dist-info → sqlmesh-0.181.2.dev20.dist-info}/licenses/LICENSE +0 -0
  51. {sqlmesh-0.181.2.dev18.dist-info → sqlmesh-0.181.2.dev20.dist-info}/top_level.txt +0 -0
@@ -79,4 +79,4 @@ Error generating stack: `+f.message+`
79
79
  */function po(){return po=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},po.apply(this,arguments)}function Jg(r,e){if(r==null)return{};var t={},s=Object.keys(r),a,u;for(u=0;u<s.length;u++)a=s[u],!(e.indexOf(a)>=0)&&(t[a]=r[a]);return t}function hb(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function pb(r,e){return r.button===0&&(!e||e==="_self")&&!hb(r)}const yb=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],mb=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],gb="6";try{window.__reactRouterVersion=gb}catch{}function vb(r,e){return O1({basename:e==null?void 0:e.basename,future:po({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:J_({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||wb(),routes:r,mapRouteProperties:fb,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation,window:e==null?void 0:e.window}).initialize()}function wb(){var r;let e=(r=window)==null?void 0:r.__staticRouterHydrationData;return e&&e.errors&&(e=po({},e,{errors:Sb(e.errors)})),e}function Sb(r){if(!r)return null;let e=Object.entries(r),t={};for(let[s,a]of e)if(a&&a.__type==="RouteErrorResponse")t[s]=new xu(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let u=window[a.__subType];if(typeof u=="function")try{let d=new u(a.message);d.stack="",t[s]=d}catch{}}if(t[s]==null){let u=new Error(a.message);u.stack="",t[s]=u}}else t[s]=a;return t}const Xg=P.createContext({isTransitioning:!1}),_b=P.createContext(new Map),bb="startTransition",Im=XS[bb],Ib="flushSync",Em=R_[Ib];function Eb(r){Im?Im(r):r()}function pa(r){Em?Em(r):r()}class xb{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=s=>{this.status==="pending"&&(this.status="resolved",e(s))},this.reject=s=>{this.status==="pending"&&(this.status="rejected",t(s))}})}}function Db(r){let{fallbackElement:e,router:t,future:s}=r,[a,u]=P.useState(t.state),[d,h]=P.useState(),[p,m]=P.useState({isTransitioning:!1}),[g,v]=P.useState(),[b,I]=P.useState(),[M,B]=P.useState(),A=P.useRef(new Map),{v7_startTransition:K}=s||{},W=P.useCallback(V=>{K?Eb(V):V()},[K]),Y=P.useCallback((V,we)=>{let{deletedFetchers:ce,flushSync:Ge,viewTransitionOpts:He}=we;V.fetchers.forEach((dt,At)=>{dt.data!==void 0&&A.current.set(At,dt.data)}),ce.forEach(dt=>A.current.delete(dt));let et=t.window==null||t.window.document==null||typeof t.window.document.startViewTransition!="function";if(!He||et){Ge?pa(()=>u(V)):W(()=>u(V));return}if(Ge){pa(()=>{b&&(g&&g.resolve(),b.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:He.currentLocation,nextLocation:He.nextLocation})});let dt=t.window.document.startViewTransition(()=>{pa(()=>u(V))});dt.finished.finally(()=>{pa(()=>{v(void 0),I(void 0),h(void 0),m({isTransitioning:!1})})}),pa(()=>I(dt));return}b?(g&&g.resolve(),b.skipTransition(),B({state:V,currentLocation:He.currentLocation,nextLocation:He.nextLocation})):(h(V),m({isTransitioning:!0,flushSync:!1,currentLocation:He.currentLocation,nextLocation:He.nextLocation}))},[t.window,b,g,A,W]);P.useLayoutEffect(()=>t.subscribe(Y),[t,Y]),P.useEffect(()=>{p.isTransitioning&&!p.flushSync&&v(new xb)},[p]),P.useEffect(()=>{if(g&&d&&t.window){let V=d,we=g.promise,ce=t.window.document.startViewTransition(async()=>{W(()=>u(V)),await we});ce.finished.finally(()=>{v(void 0),I(void 0),h(void 0),m({isTransitioning:!1})}),I(ce)}},[W,d,g,t.window]),P.useEffect(()=>{g&&d&&a.location.key===d.location.key&&g.resolve()},[g,b,a.location,d]),P.useEffect(()=>{!p.isTransitioning&&M&&(h(M.state),m({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}),B(void 0))},[p.isTransitioning,M]),P.useEffect(()=>{},[]);let q=P.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:V=>t.navigate(V),push:(V,we,ce)=>t.navigate(V,{state:we,preventScrollReset:ce==null?void 0:ce.preventScrollReset}),replace:(V,we,ce)=>t.navigate(V,{replace:!0,state:we,preventScrollReset:ce==null?void 0:ce.preventScrollReset})}),[t]),pe=t.basename||"/",le=P.useMemo(()=>({router:t,navigator:q,static:!1,basename:pe}),[t,q,pe]),C=P.useMemo(()=>({v7_relativeSplatPath:t.future.v7_relativeSplatPath}),[t.future.v7_relativeSplatPath]);return P.useEffect(()=>cb(s,t.future),[s,t.future]),P.createElement(P.Fragment,null,P.createElement(Ua.Provider,{value:le},P.createElement(Qf.Provider,{value:a},P.createElement(_b.Provider,{value:A.current},P.createElement(Xg.Provider,{value:p},P.createElement(db,{basename:pe,location:a.location,navigationType:a.historyAction,navigator:q,future:C},a.initialized||t.future.v7_partialHydration?P.createElement(Ob,{routes:t.routes,future:t.future,state:a}):e))))),null)}const Ob=P.memo(Cb);function Cb(r){let{routes:e,future:t,state:s}=r;return X1(e,void 0,s,t)}const Rb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Fb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Zg=P.forwardRef(function(e,t){let{onClick:s,relative:a,reloadDocument:u,replace:d,state:h,target:p,to:m,preventScrollReset:g,viewTransition:v}=e,b=Jg(e,yb),{basename:I}=P.useContext(ji),M,B=!1;if(typeof m=="string"&&Fb.test(m)&&(M=m,Rb))try{let Y=new URL(window.location.href),q=m.startsWith("//")?new URL(Y.protocol+m):new URL(m),pe=Zr(q.pathname,I);q.origin===Y.origin&&pe!=null?m=pe+q.search+q.hash:B=!0}catch{}let A=K1(m,{relative:a}),K=Ab(m,{replace:d,state:h,target:p,preventScrollReset:g,relative:a,viewTransition:v});function W(Y){s&&s(Y),Y.defaultPrevented||K(Y)}return P.createElement("a",po({},b,{href:M||A,onClick:B||u?s:W,ref:t,target:p}))}),_D=P.forwardRef(function(e,t){let{"aria-current":s="page",caseSensitive:a=!1,className:u="",end:d=!1,style:h,to:p,viewTransition:m,children:g}=e,v=Jg(e,mb),b=oc(p,{relative:v.relative}),I=za(),M=P.useContext(Qf),{navigator:B,basename:A}=P.useContext(ji),K=M!=null&&Lb(b)&&m===!0,W=B.encodeLocation?B.encodeLocation(b).pathname:b.pathname,Y=I.pathname,q=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;a||(Y=Y.toLowerCase(),q=q?q.toLowerCase():null,W=W.toLowerCase()),q&&A&&(q=Zr(q,A)||q);const pe=W!=="/"&&W.endsWith("/")?W.length-1:W.length;let le=Y===W||!d&&Y.startsWith(W)&&Y.charAt(pe)==="/",C=q!=null&&(q===W||!d&&q.startsWith(W)&&q.charAt(W.length)==="/"),V={isActive:le,isPending:C,isTransitioning:K},we=le?s:void 0,ce;typeof u=="function"?ce=u(V):ce=[u,le?"active":null,C?"pending":null,K?"transitioning":null].filter(Boolean).join(" ");let Ge=typeof h=="function"?h(V):h;return P.createElement(Zg,po({},v,{"aria-current":we,className:ce,ref:t,style:Ge,to:p,viewTransition:m}),typeof g=="function"?g(V):g)});var Sf;(function(r){r.UseScrollRestoration="useScrollRestoration",r.UseSubmit="useSubmit",r.UseSubmitFetcher="useSubmitFetcher",r.UseFetcher="useFetcher",r.useViewTransitionState="useViewTransitionState"})(Sf||(Sf={}));var xm;(function(r){r.UseFetcher="useFetcher",r.UseFetchers="useFetchers",r.UseScrollRestoration="useScrollRestoration"})(xm||(xm={}));function Mb(r){let e=P.useContext(Ua);return e||Ne(!1),e}function Ab(r,e){let{target:t,replace:s,state:a,preventScrollReset:u,relative:d,viewTransition:h}=e===void 0?{}:e,p=q1(),m=za(),g=oc(r,{relative:d});return P.useCallback(v=>{if(pb(v,t)){v.preventDefault();let b=s!==void 0?s:ps(m)===ps(g);p(r,{replace:b,state:a,preventScrollReset:u,relative:d,viewTransition:h})}},[m,p,g,s,a,t,r,u,d,h])}function Lb(r,e){e===void 0&&(e={});let t=P.useContext(Xg);t==null&&Ne(!1);let{basename:s}=Mb(Sf.useViewTransitionState),a=oc(r,{relative:e.relative});if(!t.isTransitioning)return!1;let u=Zr(t.currentLocation.pathname,s)||t.currentLocation.pathname,d=Zr(t.nextLocation.pathname,s)||t.nextLocation.pathname;return Eu(a.pathname,d)!=null||Eu(a.pathname,u)!=null}function ev(r){var e,t,s="";if(typeof r=="string"||typeof r=="number")s+=r;else if(typeof r=="object")if(Array.isArray(r)){var a=r.length;for(e=0;e<a;e++)r[e]&&(t=ev(r[e]))&&(s&&(s+=" "),s+=t)}else for(t in r)r[t]&&(s&&(s+=" "),s+=t);return s}function Cr(){for(var r,e,t=0,s="",a=arguments.length;t<a;t++)(r=arguments[t])&&(e=ev(r))&&(s&&(s+=" "),s+=e);return s}const Ft={xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},at={Primary:"primary",Alternative:"alternative",Secondary:"secondary",Success:"success",Danger:"danger",Warning:"warning",Info:"info",Neutral:"neutral"},bD={Left:"left",Right:"right"},Dm=new Map([[Ft.sm,""],[Ft.md,"-2"],[Ft.lg,"-4"]]);function Om({size:r=Ft.sm,orientation:e="horizontal",className:t}){return N.jsx("span",{className:Cr(["block border-divider",e==="horizontal"&&`w-full border-b${Dm.get(r)??""}`,e==="vertical"&&`h-full border-r${Dm.get(r)??""}`],t)})}const tv=function({children:e}){return N.jsx(N.Fragment,{children:e})};function Pb({children:r,layout:e="vertical"}){return N.jsx("div",{className:Cr("font-sans w-full h-full flex overflow-hidden",e==="horizontal"?"flex-row":"flex-col"),children:r})}tv.Page=Pb;const ID={Circle:"circle"},ED={Ghost:"ghost"},Tb=new Map([["primary","border-primary-500 bg-primary-500 hover:bg-primary-400 active:bg-primary-400 text-light"],["alternative","border-neutral-300 bg-neutral-5 hover:bg-neutral-20 active:bg-neutral-200 text-neutral-600"],["secondary","border-secondary-500 bg-secondary-500 hover:bg-secondary-600 active:bg-secondary-400 text-neutral-100"],["success","border-success-500 bg-success-500 hover:bg-success-600 active:bg-success-400 text-neutral-100"],["danger","border-danger-500 bg-danger-500 hover:bg-danger-600 active:bg-danger-400 text-neutral-100"],["warning","border-warning-500 bg-warning-500 hover:bg-warning-600 active:bg-warning-400 text-neutral-100"],["neutral","border-neutral-200 bg-neutral-200 hover:bg-neutral-300 active:bg-neutral-300 text-primary-900"],["info","border-transparent bg-neutral-10 dark:bg-neutral-20 active:bg-neutral-10 text-neutral-700 dark:text-neutral-200"]]),Bb=new Map([["rounded","rounded-md"],["square","rounded-none"],["circle","rounded-full"]]),Nb=new Map([[Ft.xs,"text-xs leading-2 border"],[Ft.sm,"px-2 py-[0.125rem] text-xs leading-4 border-2"],[Ft.md,"px-3 py-2 text-base leading-6 border-2"],[Ft.lg,"px-4 py-3 text-lg border-4"]]),xD=nv(hs.forwardRef(Ub)),kb=nv(hs.forwardRef(jb));function Ub({type:r="button",disabled:e=!1,children:t=[],form:s,autoFocus:a,tabIndex:u,onClick:d,className:h},p){return N.jsx("button",{ref:p,type:r,autoFocus:a,tabIndex:u,form:s,disabled:e,onClick:d,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),d==null||d(m))},className:h,children:t})}function jb({children:r=[],autoFocus:e,tabIndex:t,className:s},a){return N.jsx("div",{ref:a,autoFocus:e,tabIndex:t,className:s,children:r})}function nv(r){return hs.forwardRef(function({type:t="button",disabled:s=!1,variant:a="primary",shape:u="rounded",size:d=Ft.md,children:h=[],className:p,form:m,autoFocus:g,tabIndex:v,onClick:b},I){return N.jsx(r,{ref:I,type:t,disabled:s,form:m,autoFocus:g,tabIndex:v,onClick:b,className:Cr("whitespace-nowrap flex m-1 items-center justify-center font-bold","focus:ring-4 focus:outline-none focus:border-secondary-500","ring-secondary-300 ring-opacity-60 ring-offset ring-offset-secondary-100",Bb.get(u),Nb.get(d),s?"opacity-50 bg-neutral-10 dark:bg-neutral-20 border-transparent text-prose cursor-not-allowed":Tb.get(a),p),children:h})})}function vn({description:r,link:e,headline:t="Not Found",message:s="Go Back Home"}){return N.jsx(tv.Page,{children:N.jsx("div",{className:"flex items-center justify-center w-full h-full",children:N.jsxs("div",{className:"text-center",children:[N.jsx("h1",{className:"text-[4rem] md:text-[6rem] lg:text-[9rem] text-secondary-10 dark:text-primary-10 mb-4",children:t}),ln(r)&&N.jsx("p",{className:"mb-10 py-5 px-4 text-neutral-70 dark:text-primary-70 w-full bg-primary-10 rounded-md",children:r}),ln(e)&&N.jsx("div",{className:"inline-block",children:N.jsx(kb,{variant:at.Alternative,children:N.jsx(Zg,{to:e,children:s})})})]})})})}function us({style:r,className:e,variant:t=at.Info}){return N.jsxs("svg",{style:r,className:Cr("animate-spin bg-transparent rounded-full",e),viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg","aria-label":"Loading",role:"img",children:[N.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 59.7128C31.3054 68.5494 50.8763 63.3054 59.7128 48C68.5494 32.6946 63.3054 13.1237 48 4.28719C32.6946 -4.54937 13.1237 0.694636 4.28719 16C-4.54937 31.3054 0.694637 50.8763 16 59.7128ZM23 47.5885C31.6093 52.559 42.6179 49.6093 47.5885 41C52.559 32.3907 49.6093 21.3821 41 16.4115C32.3907 11.441 21.3821 14.3907 16.4115 23C11.441 31.6093 14.3907 42.6179 23 47.5885Z",className:"fill-theme-lighter"}),N.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.5827 26.5161C49.2259 21.9157 46.1691 17.8082 41.6875 15.2208C37.4263 12.7606 32.6191 12.103 28.1488 13.0114L25.1365 1.76921C32.4854 0.0988895 40.4586 1.08788 47.5 5.15321C54.7617 9.34574 59.6854 16.0326 61.8138 23.5067L50.5827 26.5161Z",className:Cr(t===at.Primary&&"fill-primary-500",t===at.Secondary&&"fill-secondary-500",t===at.Success&&"fill-success-500",t===at.Warning&&"fill-warning-500",t===at.Danger&&"fill-danger-500",t===at.Info&&"fill-neutral-500"),stroke:Cr(t===at.Primary&&"var(--color-primary-500)",t===at.Secondary&&"var(--color-secondary-500)",t===at.Success&&"var(--color-success-500)",t===at.Warning&&"var(--color-warning-500)",t===at.Danger&&"var(--color-danger-500)",t===at.Info&&"var(--color-neutral-500)"),strokeWidth:"4"})]})}function zb({as:r="p",size:e=Ft.sm,variant:t=at.Info,text:s,className:a}){const u=r;return N.jsx(u,{className:Cr("font-bold whitespace-nowrap",t===at.Primary&&"text-primary-600 dark:text-primary-400",t===at.Secondary&&"text-secondary-600 dark:text-secondary-400",t===at.Success&&"text-success-600 dark:text-success-400",t===at.Warning&&"text-warning-600 dark:text-warning-400",t===at.Danger&&"text-danger-600 dark:text-danger-400",t===at.Info&&"text-neutral-600 dark:text-neutral-400",e===Ft.xs&&"text-xs",e===Ft.sm&&"text-md",e===Ft.md&&"text-lg",e===Ft.lg&&"text-2xl",e===Ft.xl&&"text-4xl",a),children:s})}function Ys({hasSpinner:r=!1,size:e=Ft.sm,variant:t=at.Info,text:s,children:a,className:u}){return N.jsx("span",{className:Cr(t===at.Primary&&"text-primary-600 dark:text-primary-400",t===at.Secondary&&"text-secondary-600 dark:text-secondary-400",t===at.Success&&"text-success-600 dark:text-success-400",t===at.Warning&&"text-warning-600 dark:text-warning-400",t===at.Danger&&"text-danger-600 dark:text-danger-400",t===at.Info&&"text-neutral-600 dark:text-neutral-400",u),children:N.jsxs("span",{className:"flex items-center w-full",children:[r&&N.jsx(us,{variant:t,className:Cr(e===Ft.xs&&"w-2 h-2 mr-2",e===Ft.sm&&"w-3 h-3 mr-2",e===Ft.md&&"w-4 h-4 mr-2",e===Ft.lg&&"w-5 h-5 mr-4",e===Ft.xl&&"w-6 h-6 mr-4")}),ln(s)?N.jsx(zb,{size:e,variant:t,text:s}):a]})})}var Cm=function(){return Cm=Object.assign||function(e){for(var t,s=1,a=arguments.length;s<a;s++){t=arguments[s];for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u])}return e},Cm.apply(this,arguments)};function DD(r,e){var t={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(r);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(r,s[a])&&(t[s[a]]=r[s[a]]);return t}function Re(r,e,t,s){function a(u){return u instanceof t?u:new t(function(d){d(u)})}return new(t||(t=Promise))(function(u,d){function h(g){try{m(s.next(g))}catch(v){d(v)}}function p(g){try{m(s.throw(g))}catch(v){d(v)}}function m(g){g.done?u(g.value):a(g.value).then(h,p)}m((s=s.apply(r,e||[])).next())})}function Rm(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],s=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&s>=r.length&&(r=void 0),{value:r&&r[s++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function OD(r,e,t){if(t||arguments.length===2)for(var s=0,a=e.length,u;s<a;s++)(u||!(s in e))&&(u||(u=Array.prototype.slice.call(e,0,s)),u[s]=e[s]);return r.concat(u||Array.prototype.slice.call(e))}function Le(r){return this instanceof Le?(this.v=r,this):new Le(r)}function Or(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=t.apply(r,e||[]),a,u=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),h("next"),h("throw"),h("return",d),a[Symbol.asyncIterator]=function(){return this},a;function d(I){return function(M){return Promise.resolve(M).then(I,v)}}function h(I,M){s[I]&&(a[I]=function(B){return new Promise(function(A,K){u.push([I,B,A,K])>1||p(I,B)})},M&&(a[I]=M(a[I])))}function p(I,M){try{m(s[I](M))}catch(B){b(u[0][3],B)}}function m(I){I.value instanceof Le?Promise.resolve(I.value.v).then(g,v):b(u[0][2],I)}function g(I){p("next",I)}function v(I){p("throw",I)}function b(I,M){I(M),u.shift(),u.length&&p(u[0][0],u[0][1])}}function cu(r){var e,t;return e={},s("next"),s("throw",function(a){throw a}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(a,u){e[a]=r[a]?function(d){return(t=!t)?{value:Le(r[a](d)),done:!1}:u?u(d):d}:u}}function ao(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Rm=="function"?Rm(r):r[Symbol.iterator](),t={},s("next"),s("throw"),s("return"),t[Symbol.asyncIterator]=function(){return this},t);function s(u){t[u]=r[u]&&function(d){return new Promise(function(h,p){d=r[u](d),a(h,p,d.done,d.value)})}}function a(u,d,h,p){Promise.resolve(p).then(function(m){u({value:m,done:h})},d)}}const Vb=new TextDecoder("utf-8"),_f=r=>Vb.decode(r),$b=new TextEncoder,Kf=r=>$b.encode(r),Wb=r=>typeof r=="number",Qb=r=>typeof r=="boolean",an=r=>typeof r=="function",or=r=>r!=null&&Object(r)===r,La=r=>or(r)&&an(r.then),ac=r=>or(r)&&an(r[Symbol.iterator]),qf=r=>or(r)&&an(r[Symbol.asyncIterator]),bf=r=>or(r)&&or(r.schema),rv=r=>or(r)&&"done"in r&&"value"in r,iv=r=>or(r)&&an(r.stat)&&Wb(r.fd),sv=r=>or(r)&&Yf(r.body),ov=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Yf=r=>or(r)&&an(r.cancel)&&an(r.getReader)&&!ov(r),av=r=>or(r)&&an(r.read)&&an(r.pipe)&&Qb(r.readable)&&!ov(r),Hb=r=>or(r)&&an(r.clear)&&an(r.bytes)&&an(r.position)&&an(r.setPosition)&&an(r.capacity)&&an(r.getBufferIdentifier)&&an(r.createLong),Gf=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Kb(r){const e=r[0]?[r[0]]:[];let t,s,a,u;for(let d,h,p=0,m=0,g=r.length;++p<g;){if(d=e[m],h=r[p],!d||!h||d.buffer!==h.buffer||h.byteOffset<d.byteOffset){h&&(e[++m]=h);continue}if({byteOffset:t,byteLength:a}=d,{byteOffset:s,byteLength:u}=h,t+a<s||s+u<t){h&&(e[++m]=h);continue}e[m]=new Uint8Array(d.buffer,t,s-t+u)}return e}function Fm(r,e,t=0,s=e.byteLength){const a=r.byteLength,u=new Uint8Array(r.buffer,r.byteOffset,a),d=new Uint8Array(e.buffer,e.byteOffset,Math.min(s,a));return u.set(d,t),r}function Rr(r,e){const t=Kb(r),s=t.reduce((g,v)=>g+v.byteLength,0);let a,u,d,h=0,p=-1;const m=Math.min(e||Number.POSITIVE_INFINITY,s);for(const g=t.length;++p<g;){if(a=t[p],u=a.subarray(0,Math.min(a.length,m-h)),m<=h+u.length){u.length<a.length?t[p]=a.subarray(u.length):u.length===a.length&&p++,d?Fm(d,u,h):d=u;break}Fm(d||(d=new Uint8Array(m)),u,h),h+=u.length}return[d||new Uint8Array(0),t.slice(p),s-(d?d.byteLength:0)]}function it(r,e){let t=rv(e)?e.value:e;return t instanceof r?r===Uint8Array?new r(t.buffer,t.byteOffset,t.byteLength):t:t?(typeof t=="string"&&(t=Kf(t)),t instanceof ArrayBuffer?new r(t):t instanceof Gf?new r(t):Hb(t)?it(r,t.bytes()):ArrayBuffer.isView(t)?t.byteLength<=0?new r(0):new r(t.buffer,t.byteOffset,t.byteLength/r.BYTES_PER_ELEMENT):r.from(t)):new r(0)}const ya=r=>it(Int32Array,r),Mm=r=>it(BigInt64Array,r),We=r=>it(Uint8Array,r),If=r=>(r.next(),r);function*qb(r,e){const t=function*(a){yield a},s=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Gf?t(e):ac(e)?e:t(e);return yield*If(function*(a){let u=null;do u=a.next(yield it(r,u));while(!u.done)}(s[Symbol.iterator]())),new r}const Yb=r=>qb(Uint8Array,r);function lv(r,e){return Or(this,arguments,function*(){if(La(e))return yield Le(yield Le(yield*cu(ao(lv(r,yield Le(e))))));const s=function(d){return Or(this,arguments,function*(){yield yield Le(yield Le(d))})},a=function(d){return Or(this,arguments,function*(){yield Le(yield*cu(ao(If(function*(h){let p=null;do p=h.next(yield p==null?void 0:p.value);while(!p.done)}(d[Symbol.iterator]())))))})},u=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Gf?s(e):ac(e)?a(e):qf(e)?e:s(e);return yield Le(yield*cu(ao(If(function(d){return Or(this,arguments,function*(){let h=null;do h=yield Le(d.next(yield yield Le(it(r,h))));while(!h.done)})}(u[Symbol.asyncIterator]()))))),yield Le(new r)})}const Gb=r=>lv(Uint8Array,r);function Jb(r,e){let t=0;const s=r.length;if(s!==e.length)return!1;if(s>0)do if(r[t]!==e[t])return!1;while(++t<s);return!0}const jn={fromIterable(r){return su(Xb(r))},fromAsyncIterable(r){return su(Zb(r))},fromDOMStream(r){return su(eI(r))},fromNodeStream(r){return su(nI(r))},toDOMStream(r,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,e){throw new Error('"toNodeStream" not available in this environment')}},su=r=>(r.next(),r);function*Xb(r){let e,t=!1,s=[],a,u,d,h=0;function p(){return u==="peek"?Rr(s,d)[0]:([a,s,h]=Rr(s,d),a)}({cmd:u,size:d}=(yield null)||{cmd:"read",size:0});const m=Yb(r)[Symbol.iterator]();try{do if({done:e,value:a}=Number.isNaN(d-h)?m.next():m.next(d-h),!e&&a.byteLength>0&&(s.push(a),h+=a.byteLength),e||d<=h)do({cmd:u,size:d}=yield p());while(d<h);while(!e)}catch(g){(t=!0)&&typeof m.throw=="function"&&m.throw(g)}finally{t===!1&&typeof m.return=="function"&&m.return(null)}return null}function Zb(r){return Or(this,arguments,function*(){let t,s=!1,a=[],u,d,h,p=0;function m(){return d==="peek"?Rr(a,h)[0]:([u,a,p]=Rr(a,h),u)}({cmd:d,size:h}=(yield yield Le(null))||{cmd:"read",size:0});const g=Gb(r)[Symbol.asyncIterator]();try{do if({done:t,value:u}=Number.isNaN(h-p)?yield Le(g.next()):yield Le(g.next(h-p)),!t&&u.byteLength>0&&(a.push(u),p+=u.byteLength),t||h<=p)do({cmd:d,size:h}=yield yield Le(m()));while(h<p);while(!t)}catch(v){(s=!0)&&typeof g.throw=="function"&&(yield Le(g.throw(v)))}finally{s===!1&&typeof g.return=="function"&&(yield Le(g.return(new Uint8Array(0))))}return yield Le(null)})}function eI(r){return Or(this,arguments,function*(){let t=!1,s=!1,a=[],u,d,h,p=0;function m(){return d==="peek"?Rr(a,h)[0]:([u,a,p]=Rr(a,h),u)}({cmd:d,size:h}=(yield yield Le(null))||{cmd:"read",size:0});const g=new tI(r);try{do if({done:t,value:u}=Number.isNaN(h-p)?yield Le(g.read()):yield Le(g.read(h-p)),!t&&u.byteLength>0&&(a.push(We(u)),p+=u.byteLength),t||h<=p)do({cmd:d,size:h}=yield yield Le(m()));while(h<p);while(!t)}catch(v){(s=!0)&&(yield Le(g.cancel(v)))}finally{s===!1?yield Le(g.cancel()):r.locked&&g.releaseLock()}return yield Le(null)})}class tI{constructor(e){this.source=e,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return Re(this,void 0,void 0,function*(){const{reader:t,source:s}=this;t&&(yield t.cancel(e).catch(()=>{})),s&&s.locked&&this.releaseLock()})}read(e){return Re(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const t=yield this.reader.read();return!t.done&&(t.value=We(t)),t})}}const sf=(r,e)=>{const t=a=>s([e,a]);let s;return[e,t,new Promise(a=>(s=a)&&r.once(e,t))]};function nI(r){return Or(this,arguments,function*(){const t=[];let s="error",a=!1,u=null,d,h,p=0,m=[],g;function v(){return d==="peek"?Rr(m,h)[0]:([g,m,p]=Rr(m,h),g)}if({cmd:d,size:h}=(yield yield Le(null))||{cmd:"read",size:0},r.isTTY)return yield yield Le(new Uint8Array(0)),yield Le(null);try{t[0]=sf(r,"end"),t[1]=sf(r,"error");do{if(t[2]=sf(r,"readable"),[s,u]=yield Le(Promise.race(t.map(I=>I[2]))),s==="error")break;if((a=s==="end")||(Number.isFinite(h-p)?(g=We(r.read(h-p)),g.byteLength<h-p&&(g=We(r.read()))):g=We(r.read()),g.byteLength>0&&(m.push(g),p+=g.byteLength)),a||h<=p)do({cmd:d,size:h}=yield yield Le(v()));while(h<p)}while(!a)}finally{yield Le(b(t,s==="error"?u:null))}return yield Le(null);function b(I,M){return g=m=null,new Promise((B,A)=>{for(const[K,W]of I)r.off(K,W);try{const K=r.destroy;K&&K.call(r,M),M=void 0}catch(K){M=K||M}finally{M!=null?A(M):B()}})}})}var Tt;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Tt||(Tt={}));var bn;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(bn||(bn={}));var tn;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(tn||(tn={}));var Wn;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Wn||(Wn={}));var _e;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(_e||(_e={}));var Fr;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Fr||(Fr={}));const of=2,Er=4,Kr=4,Ze=4,Li=new Int32Array(2),Am=new Float32Array(Li.buffer),Lm=new Float64Array(Li.buffer),ou=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Ef;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Ef||(Ef={}));let yo=class uv{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new uv(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return Li[0]=this.readInt32(e),Am[0]}readFloat64(e){return Li[ou?0:1]=this.readInt32(e),Li[ou?1:0]=this.readInt32(e+4),Lm[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){Am[0]=t,this.writeInt32(e,Li[0])}writeFloat64(e,t){Lm[0]=t,this.writeInt32(e,Li[ou?0:1]),this.writeInt32(e+4,Li[ou?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Er+Kr)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<Kr;t++)e+=String.fromCharCode(this.readInt8(this.position_+Er+t));return e}__offset(e,t){const s=e-this.readInt32(e);return t<this.readInt16(s)?this.readInt16(s+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const s=this.readInt32(e);e+=Er;const a=this.bytes_.subarray(e,e+s);return t===Ef.UTF8_BYTES?a:this.text_decoder_.decode(a)}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Er}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=Kr)throw new Error("FlatBuffers: file identifier must be length "+Kr);for(let t=0;t<Kr;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+Er+t))return!1;return!0}createScalarList(e,t){const s=[];for(let a=0;a<t;++a){const u=e(a);u!==null&&s.push(u)}return s}createObjList(e,t){const s=[];for(let a=0;a<t;++a){const u=e(a);u!==null&&s.push(u.unpack())}return s}},cv=class dv{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let t;e?t=e:t=1024,this.bb=yo.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const s=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<s+e+t;){const a=this.bb.capacity();this.bb=dv.growByteBuffer(this.bb),this.space+=this.bb.capacity()-a}this.pad(s)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,s){(this.force_defaults||t!=s)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,s){(this.force_defaults||t!=s)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,s){(this.force_defaults||t!=s)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,s){(this.force_defaults||t!==s)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,s){(this.force_defaults||t!=s)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,s){(this.force_defaults||t!=s)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,s){(this.force_defaults||t!=s)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,s){t!=s&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const s=t<<1,a=yo.allocate(s);return a.setPosition(s-t),a.bytes().set(e.bytes(),s-t),a}addOffset(e){this.prep(Er,0),this.writeInt32(this.offset()-e+Er)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const s=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const a=2;this.addInt16(e-this.object_start);const u=(s+a)*of;this.addInt16(u);let d=0;const h=this.space;e:for(t=0;t<this.vtables.length;t++){const p=this.bb.capacity()-this.vtables[t];if(u==this.bb.readInt16(p)){for(let m=of;m<u;m+=of)if(this.bb.readInt16(h+m)!=this.bb.readInt16(p+m))continue e;d=this.vtables[t];break}}return d?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,d-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,s){const a=s?Ze:0;if(t){const u=t;if(this.prep(this.minalign,Er+Kr+a),u.length!=Kr)throw new TypeError("FlatBuffers: file identifier must be length "+Kr);for(let d=Kr-1;d>=0;d--)this.writeInt8(u.charCodeAt(d))}this.prep(this.minalign,Er+a),this.addOffset(e),a&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const s=this.bb.capacity()-e,a=s-this.bb.readInt32(s);if(!(t<this.bb.readInt16(a)&&this.bb.readInt16(a+t)!=0))throw new TypeError("FlatBuffers: field "+t+" must be set")}startVector(e,t,s){this.notNested(),this.vector_num_elems=t,this.prep(Er,e*t),this.prep(s,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return e instanceof Uint8Array?t=e:t=this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let s=0;s<e.length;++s){const a=e[s];if(a!==null)t.push(this.createObjectOffset(a));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}};var Ou;(function(r){r[r.BUFFER=0]="BUFFER"})(Ou||(Ou={}));var Cu;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Cu||(Cu={}));class Pi{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(e,t){return(t||new Pi).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,t){return e.setPosition(e.position()+Ze),(t||new Pi).__init(e.readInt32(e.position())+e.position(),e)}codec(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):Cu.LZ4_FRAME}method(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):Ou.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,Cu.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,Ou.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,t,s){return Pi.startBodyCompression(e),Pi.addCodec(e,t),Pi.addMethod(e,s),Pi.endBodyCompression(e)}}class fv{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,s){return e.prep(8,16),e.writeInt64(BigInt(s??0)),e.writeInt64(BigInt(t??0)),e.offset()}}let hv=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,s){return e.prep(8,16),e.writeInt64(BigInt(s??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Wr=class xf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(e,t){return(t||new xf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,t){return e.setPosition(e.position()+Ze),(t||new xf).__init(e.readInt32(e.position())+e.position(),e)}length(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}nodes(e,t){const s=this.bb.__offset(this.bb_pos,6);return s?(t||new hv).__init(this.bb.__vector(this.bb_pos+s)+e*16,this.bb):null}nodesLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){const s=this.bb.__offset(this.bb_pos,8);return s?(t||new fv).__init(this.bb.__vector(this.bb_pos+s)+e*16,this.bb):null}buffersLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){const t=this.bb.__offset(this.bb_pos,10);return t?(e||new Pi).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static endRecordBatch(e){return e.endObject()}},Gs=class Df{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(e,t){return(t||new Df).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,t){return e.setPosition(e.position()+Ze),(t||new Df).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}data(e){const t=this.bb.__offset(this.bb_pos,6);return t?(e||new Wr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}};var mo;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(mo||(mo={}));var Ru;(function(r){r[r.DenseArray=0]="DenseArray"})(Ru||(Ru={}));class Fn{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(e,t){return(t||new Fn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInt(e,t){return e.setPosition(e.position()+Ze),(t||new Fn).__init(e.readInt32(e.position())+e.position(),e)}bitWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(e,t,s){return Fn.startInt(e),Fn.addBitWidth(e,t),Fn.addIsSigned(e,s),Fn.endInt(e)}}class qr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(e,t){return(t||new qr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryEncoding(e,t){return e.setPosition(e.position()+Ze),(t||new qr).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}indexType(e){const t=this.bb.__offset(this.bb_pos,6);return t?(e||new Fn).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):Ru.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,Ru.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}}class jt{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(e,t){return(t||new jt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKeyValue(e,t){return e.setPosition(e.position()+Ze),(t||new jt).__init(e.readInt32(e.position())+e.position(),e)}key(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(e,t,s){return jt.startKeyValue(e),jt.addKey(e,t),jt.addValue(e,s),jt.endKeyValue(e)}}let Pm=class wa{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(e,t){return(t||new wa).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinary(e,t){return e.setPosition(e.position()+Ze),(t||new wa).__init(e.readInt32(e.position())+e.position(),e)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(e){return wa.startBinary(e),wa.endBinary(e)}},Tm=class Sa{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(e,t){return(t||new Sa).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBool(e,t){return e.setPosition(e.position()+Ze),(t||new Sa).__init(e.readInt32(e.position())+e.position(),e)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(e){return Sa.startBool(e),Sa.endBool(e)}},du=class Js{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(e,t){return(t||new Js).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDate(e,t){return e.setPosition(e.position()+Ze),(t||new Js).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Wn.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,Wn.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(e,t){return Js.startDate(e),Js.addUnit(e,t),Js.endDate(e)}},Xs=class Mi{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(e,t){return(t||new Mi).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDecimal(e,t){return e.setPosition(e.position()+Ze),(t||new Mi).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(e,t,s,a){return Mi.startDecimal(e),Mi.addPrecision(e,t),Mi.addScale(e,s),Mi.addBitWidth(e,a),Mi.endDecimal(e)}},fu=class Zs{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(e,t){return(t||new Zs).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDuration(e,t){return e.setPosition(e.position()+Ze),(t||new Zs).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_e.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,_e.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(e,t){return Zs.startDuration(e),Zs.addUnit(e,t),Zs.endDuration(e)}},hu=class eo{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(e,t){return(t||new eo).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeBinary(e,t){return e.setPosition(e.position()+Ze),(t||new eo).__init(e.readInt32(e.position())+e.position(),e)}byteWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(e,t){return eo.startFixedSizeBinary(e),eo.addByteWidth(e,t),eo.endFixedSizeBinary(e)}},pu=class to{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(e,t){return(t||new to).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeList(e,t){return e.setPosition(e.position()+Ze),(t||new to).__init(e.readInt32(e.position())+e.position(),e)}listSize(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(e,t){return to.startFixedSizeList(e),to.addListSize(e,t),to.endFixedSizeList(e)}};class xr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(e,t){return(t||new xr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFloatingPoint(e,t){return e.setPosition(e.position()+Ze),(t||new xr).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):tn.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,tn.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(e,t){return xr.startFloatingPoint(e),xr.addPrecision(e,t),xr.endFloatingPoint(e)}}class Dr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(e,t){return(t||new Dr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInterval(e,t){return e.setPosition(e.position()+Ze),(t||new Dr).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Fr.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,Fr.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(e,t){return Dr.startInterval(e),Dr.addUnit(e,t),Dr.endInterval(e)}}let Bm=class _a{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(e,t){return(t||new _a).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeBinary(e,t){return e.setPosition(e.position()+Ze),(t||new _a).__init(e.readInt32(e.position())+e.position(),e)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(e){return _a.startLargeBinary(e),_a.endLargeBinary(e)}},Nm=class ba{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(e,t){return(t||new ba).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeUtf8(e,t){return e.setPosition(e.position()+Ze),(t||new ba).__init(e.readInt32(e.position())+e.position(),e)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(e){return ba.startLargeUtf8(e),ba.endLargeUtf8(e)}},km=class Ia{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(e,t){return(t||new Ia).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsList(e,t){return e.setPosition(e.position()+Ze),(t||new Ia).__init(e.readInt32(e.position())+e.position(),e)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(e){return Ia.startList(e),Ia.endList(e)}},yu=class no{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(e,t){return(t||new no).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMap(e,t){return e.setPosition(e.position()+Ze),(t||new no).__init(e.readInt32(e.position())+e.position(),e)}keysSorted(){const e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(e,t){return no.startMap(e),no.addKeysSorted(e,t),no.endMap(e)}},Um=class Ea{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(e,t){return(t||new Ea).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNull(e,t){return e.setPosition(e.position()+Ze),(t||new Ea).__init(e.readInt32(e.position())+e.position(),e)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(e){return Ea.startNull(e),Ea.endNull(e)}};class fs{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(e,t){return(t||new fs).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsStruct_(e,t){return e.setPosition(e.position()+Ze),(t||new fs).__init(e.readInt32(e.position())+e.position(),e)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(e){return fs.startStruct_(e),fs.endStruct_(e)}}class zn{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(e,t){return(t||new zn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTime(e,t){return e.setPosition(e.position()+Ze),(t||new zn).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_e.MILLISECOND}bitWidth(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,_e.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(e,t,s){return zn.startTime(e),zn.addUnit(e,t),zn.addBitWidth(e,s),zn.endTime(e)}}class Vn{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(e,t){return(t||new Vn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTimestamp(e,t){return e.setPosition(e.position()+Ze),(t||new Vn).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_e.SECOND}timezone(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,_e.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(e,t,s){return Vn.startTimestamp(e),Vn.addUnit(e,t),Vn.addTimezone(e,s),Vn.endTimestamp(e)}}class _n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(e,t){return(t||new _n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUnion(e,t){return e.setPosition(e.position()+Ze),(t||new _n).__init(e.readInt32(e.position())+e.position(),e)}mode(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):bn.Sparse}typeIds(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){const e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,bn.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addInt32(t[s]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(e,t,s){return _n.startUnion(e),_n.addMode(e,t),_n.addTypeIds(e,s),_n.endUnion(e)}}let jm=class xa{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(e,t){return(t||new xa).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,t){return e.setPosition(e.position()+Ze),(t||new xa).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return xa.startUtf8(e),xa.endUtf8(e)}};var pt;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(pt||(pt={}));let kn=class mu{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(e,t){return(t||new mu).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,t){return e.setPosition(e.position()+Ze),(t||new mu).__init(e.readInt32(e.position())+e.position(),e)}name(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):pt.NONE}type(e){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){const t=this.bb.__offset(this.bb_pos,12);return t?(e||new qr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(e,t){const s=this.bb.__offset(this.bb_pos,14);return s?(t||new mu).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,16);return s?(t||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,pt.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}},br=class $r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(e,t){return(t||new $r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,t){return e.setPosition(e.position()+Ze),(t||new $r).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):mo.Little}fields(e,t){const s=this.bb.__offset(this.bb_pos,6);return s?(t||new kn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,8);return s?(t||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,mo.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let s=t.length-1;s>=0;s--)e.addInt64(t[s]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,t){e.finish(t)}static finishSizePrefixedSchemaBuffer(e,t){e.finish(t,void 0,!0)}static createSchema(e,t,s,a,u){return $r.startSchema(e),$r.addEndianness(e,t),$r.addFields(e,s),$r.addCustomMetadata(e,a),$r.addFeatures(e,u),$r.endSchema(e)}};var Je;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(Je||(Je={}));var x;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(x||(x={}));var Qr;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Qr||(Qr={}));const rI=void 0;function Pa(r){if(r===null)return"null";if(r===rI)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(e=>Pa(e))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(e,t)=>typeof t=="bigint"?`${t}`:t)}function wt(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function pv(r,e){return wt(r/e)+wt(r%e)/wt(e)}const iI=Symbol.for("isArrowBigNum");function lr(r,...e){return e.length===0?Object.setPrototypeOf(it(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...e),this.constructor.prototype)}lr.prototype[iI]=!0;lr.prototype.toJSON=function(){return`"${Ba(this)}"`};lr.prototype.valueOf=function(r){return yv(this,r)};lr.prototype.toString=function(){return Ba(this)};lr.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return yv(this);case"string":return Ba(this);case"default":return aI(this)}return Ba(this)};function lo(...r){return lr.apply(this,r)}function uo(...r){return lr.apply(this,r)}function Ta(...r){return lr.apply(this,r)}Object.setPrototypeOf(lo.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(uo.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ta.prototype,Object.create(Uint32Array.prototype));Object.assign(lo.prototype,lr.prototype,{constructor:lo,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(uo.prototype,lr.prototype,{constructor:uo,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ta.prototype,lr.prototype,{constructor:Ta,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const sI=BigInt(4294967296)*BigInt(4294967296),oI=sI-BigInt(1);function yv(r,e){const{buffer:t,byteOffset:s,byteLength:a,signed:u}=r,d=new BigUint64Array(t,s,a/8),h=u&&d.at(-1)&BigInt(1)<<BigInt(63);let p=BigInt(0),m=0;if(h){for(const g of d)p|=(g^oI)*(BigInt(1)<<BigInt(64*m++));p*=BigInt(-1),p-=BigInt(1)}else for(const g of d)p|=g*(BigInt(1)<<BigInt(64*m++));if(typeof e=="number"){const g=BigInt(Math.pow(10,e)),v=p/g,b=p%g;return wt(v)+wt(b)/wt(g)}return wt(p)}function Ba(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return af(r);let e=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return af(r);e=e.slice();let s=1;for(let u=0;u<e.length;u++){const d=e[u],h=~d+s;e[u]=h,s&=d===0?1:0}return`-${af(e)}`}function aI(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Ba(r)}function af(r){let e="";const t=new Uint32Array(2);let s=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);const a=new Uint32Array((s=new Uint16Array(s).reverse()).buffer);let u=-1;const d=s.length-1;do{for(t[0]=s[u=0];u<d;)s[u++]=t[1]=t[0]/10,t[0]=(t[0]-t[1]*10<<16)+s[u];s[u]=t[1]=t[0]/10,t[0]=t[0]-t[1]*10,e=`${t[0]}${e}`}while(a[0]||a[1]||a[2]||a[3]);return e??"0"}class Jf{static new(e,t){switch(t){case!0:return new lo(e);case!1:return new uo(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new lo(e)}return e.byteLength===16?new Ta(e):new uo(e)}static signed(e){return new lo(e)}static unsigned(e){return new uo(e)}static decimal(e){return new Ta(e)}constructor(e,t){return Jf.new(e,t)}}var mv,gv,vv,wv,Sv,_v,bv,Iv,Ev,xv,Dv,Ov,Cv,Rv,Fv,Mv,Av,Lv,Pv,Tv,Bv,Nv;class ue{static isNull(e){return(e==null?void 0:e.typeId)===x.Null}static isInt(e){return(e==null?void 0:e.typeId)===x.Int}static isFloat(e){return(e==null?void 0:e.typeId)===x.Float}static isBinary(e){return(e==null?void 0:e.typeId)===x.Binary}static isLargeBinary(e){return(e==null?void 0:e.typeId)===x.LargeBinary}static isUtf8(e){return(e==null?void 0:e.typeId)===x.Utf8}static isLargeUtf8(e){return(e==null?void 0:e.typeId)===x.LargeUtf8}static isBool(e){return(e==null?void 0:e.typeId)===x.Bool}static isDecimal(e){return(e==null?void 0:e.typeId)===x.Decimal}static isDate(e){return(e==null?void 0:e.typeId)===x.Date}static isTime(e){return(e==null?void 0:e.typeId)===x.Time}static isTimestamp(e){return(e==null?void 0:e.typeId)===x.Timestamp}static isInterval(e){return(e==null?void 0:e.typeId)===x.Interval}static isDuration(e){return(e==null?void 0:e.typeId)===x.Duration}static isList(e){return(e==null?void 0:e.typeId)===x.List}static isStruct(e){return(e==null?void 0:e.typeId)===x.Struct}static isUnion(e){return(e==null?void 0:e.typeId)===x.Union}static isFixedSizeBinary(e){return(e==null?void 0:e.typeId)===x.FixedSizeBinary}static isFixedSizeList(e){return(e==null?void 0:e.typeId)===x.FixedSizeList}static isMap(e){return(e==null?void 0:e.typeId)===x.Map}static isDictionary(e){return(e==null?void 0:e.typeId)===x.Dictionary}static isDenseUnion(e){return ue.isUnion(e)&&e.mode===bn.Dense}static isSparseUnion(e){return ue.isUnion(e)&&e.mode===bn.Sparse}constructor(e){this.typeId=e}}mv=Symbol.toStringTag;ue[mv]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(ue.prototype);class Ni extends ue{constructor(){super(x.Null)}toString(){return"Null"}}gv=Symbol.toStringTag;Ni[gv]=(r=>r[Symbol.toStringTag]="Null")(Ni.prototype);class ys extends ue{constructor(e,t){super(x.Int),this.isSigned=e,this.bitWidth=t}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}vv=Symbol.toStringTag;ys[vv]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(ys.prototype);class Na extends ys{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Na.prototype,"ArrayType",{value:Int32Array});class Fu extends ue{constructor(e){super(x.Float),this.precision=e}get ArrayType(){switch(this.precision){case tn.HALF:return Uint16Array;case tn.SINGLE:return Float32Array;case tn.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}wv=Symbol.toStringTag;Fu[wv]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Fu.prototype);class Mu extends ue{constructor(){super(x.Binary)}toString(){return"Binary"}}Sv=Symbol.toStringTag;Mu[Sv]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Mu.prototype);class Au extends ue{constructor(){super(x.LargeBinary)}toString(){return"LargeBinary"}}_v=Symbol.toStringTag;Au[_v]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Au.prototype);class Lu extends ue{constructor(){super(x.Utf8)}toString(){return"Utf8"}}bv=Symbol.toStringTag;Lu[bv]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Lu.prototype);class Pu extends ue{constructor(){super(x.LargeUtf8)}toString(){return"LargeUtf8"}}Iv=Symbol.toStringTag;Pu[Iv]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Pu.prototype);class Tu extends ue{constructor(){super(x.Bool)}toString(){return"Bool"}}Ev=Symbol.toStringTag;Tu[Ev]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Tu.prototype);class Bu extends ue{constructor(e,t,s=128){super(x.Decimal),this.scale=e,this.precision=t,this.bitWidth=s}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}xv=Symbol.toStringTag;Bu[xv]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Bu.prototype);class Nu extends ue{constructor(e){super(x.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${Wn[this.unit]}>`}get ArrayType(){return this.unit===Wn.DAY?Int32Array:BigInt64Array}}Dv=Symbol.toStringTag;Nu[Dv]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Nu.prototype);class ku extends ue{constructor(e,t){super(x.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${_e[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Ov=Symbol.toStringTag;ku[Ov]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(ku.prototype);class Uu extends ue{constructor(e,t){super(x.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${_e[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Cv=Symbol.toStringTag;Uu[Cv]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Uu.prototype);class ju extends ue{constructor(e){super(x.Interval),this.unit=e}toString(){return`Interval<${Fr[this.unit]}>`}}Rv=Symbol.toStringTag;ju[Rv]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(ju.prototype);class zu extends ue{constructor(e){super(x.Duration),this.unit=e}toString(){return`Duration<${_e[this.unit]}>`}}Fv=Symbol.toStringTag;zu[Fv]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(zu.prototype);class Vu extends ue{constructor(e){super(x.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}Mv=Symbol.toStringTag;Vu[Mv]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Vu.prototype);class un extends ue{constructor(e){super(x.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}Av=Symbol.toStringTag;un[Av]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(un.prototype);class $u extends ue{constructor(e,t,s){super(x.Union),this.mode=e,this.children=s,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((a,u,d)=>(a[u]=d)&&a||a,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}Lv=Symbol.toStringTag;$u[Lv]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))($u.prototype);class Wu extends ue{constructor(e){super(x.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Pv=Symbol.toStringTag;Wu[Pv]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Wu.prototype);class Qu extends ue{constructor(e,t){super(x.FixedSizeList),this.listSize=e,this.children=[t]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Tv=Symbol.toStringTag;Qu[Tv]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Qu.prototype);class Hu extends ue{constructor(e,t=!1){var s,a,u;if(super(x.Map),this.children=[e],this.keysSorted=t,e&&(e.name="entries",!((s=e==null?void 0:e.type)===null||s===void 0)&&s.children)){const d=(a=e==null?void 0:e.type)===null||a===void 0?void 0:a.children[0];d&&(d.name="key");const h=(u=e==null?void 0:e.type)===null||u===void 0?void 0:u.children[1];h&&(h.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}Bv=Symbol.toStringTag;Hu[Bv]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Hu.prototype);const lI=(r=>()=>++r)(-1);class go extends ue{constructor(e,t,s,a){super(x.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=a||!1,this.id=s==null?lI():wt(s)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}Nv=Symbol.toStringTag;go[Nv]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(go.prototype);function Hr(r){const e=r;switch(r.typeId){case x.Decimal:return r.bitWidth/32;case x.Interval:return 1+e.unit;case x.FixedSizeList:return e.listSize;case x.FixedSizeBinary:return e.byteWidth;default:return 1}}class ke{visitMany(e,...t){return e.map((s,a)=>this.visit(s,...t.map(u=>u[a])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return uI(this,e,t)}getVisitFnByTypeId(e,t=!0){return ro(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}}function uI(r,e,t=!0){return typeof e=="number"?ro(r,e,t):typeof e=="string"&&e in x?ro(r,x[e],t):e&&e instanceof ue?ro(r,zm(e),t):e!=null&&e.type&&e.type instanceof ue?ro(r,zm(e.type),t):ro(r,x.NONE,t)}function ro(r,e,t=!0){let s=null;switch(e){case x.Null:s=r.visitNull;break;case x.Bool:s=r.visitBool;break;case x.Int:s=r.visitInt;break;case x.Int8:s=r.visitInt8||r.visitInt;break;case x.Int16:s=r.visitInt16||r.visitInt;break;case x.Int32:s=r.visitInt32||r.visitInt;break;case x.Int64:s=r.visitInt64||r.visitInt;break;case x.Uint8:s=r.visitUint8||r.visitInt;break;case x.Uint16:s=r.visitUint16||r.visitInt;break;case x.Uint32:s=r.visitUint32||r.visitInt;break;case x.Uint64:s=r.visitUint64||r.visitInt;break;case x.Float:s=r.visitFloat;break;case x.Float16:s=r.visitFloat16||r.visitFloat;break;case x.Float32:s=r.visitFloat32||r.visitFloat;break;case x.Float64:s=r.visitFloat64||r.visitFloat;break;case x.Utf8:s=r.visitUtf8;break;case x.LargeUtf8:s=r.visitLargeUtf8;break;case x.Binary:s=r.visitBinary;break;case x.LargeBinary:s=r.visitLargeBinary;break;case x.FixedSizeBinary:s=r.visitFixedSizeBinary;break;case x.Date:s=r.visitDate;break;case x.DateDay:s=r.visitDateDay||r.visitDate;break;case x.DateMillisecond:s=r.visitDateMillisecond||r.visitDate;break;case x.Timestamp:s=r.visitTimestamp;break;case x.TimestampSecond:s=r.visitTimestampSecond||r.visitTimestamp;break;case x.TimestampMillisecond:s=r.visitTimestampMillisecond||r.visitTimestamp;break;case x.TimestampMicrosecond:s=r.visitTimestampMicrosecond||r.visitTimestamp;break;case x.TimestampNanosecond:s=r.visitTimestampNanosecond||r.visitTimestamp;break;case x.Time:s=r.visitTime;break;case x.TimeSecond:s=r.visitTimeSecond||r.visitTime;break;case x.TimeMillisecond:s=r.visitTimeMillisecond||r.visitTime;break;case x.TimeMicrosecond:s=r.visitTimeMicrosecond||r.visitTime;break;case x.TimeNanosecond:s=r.visitTimeNanosecond||r.visitTime;break;case x.Decimal:s=r.visitDecimal;break;case x.List:s=r.visitList;break;case x.Struct:s=r.visitStruct;break;case x.Union:s=r.visitUnion;break;case x.DenseUnion:s=r.visitDenseUnion||r.visitUnion;break;case x.SparseUnion:s=r.visitSparseUnion||r.visitUnion;break;case x.Dictionary:s=r.visitDictionary;break;case x.Interval:s=r.visitInterval;break;case x.IntervalDayTime:s=r.visitIntervalDayTime||r.visitInterval;break;case x.IntervalYearMonth:s=r.visitIntervalYearMonth||r.visitInterval;break;case x.Duration:s=r.visitDuration;break;case x.DurationSecond:s=r.visitDurationSecond||r.visitDuration;break;case x.DurationMillisecond:s=r.visitDurationMillisecond||r.visitDuration;break;case x.DurationMicrosecond:s=r.visitDurationMicrosecond||r.visitDuration;break;case x.DurationNanosecond:s=r.visitDurationNanosecond||r.visitDuration;break;case x.FixedSizeList:s=r.visitFixedSizeList;break;case x.Map:s=r.visitMap;break}if(typeof s=="function")return s;if(!t)return()=>null;throw new Error(`Unrecognized type '${x[e]}'`)}function zm(r){switch(r.typeId){case x.Null:return x.Null;case x.Int:{const{bitWidth:e,isSigned:t}=r;switch(e){case 8:return t?x.Int8:x.Uint8;case 16:return t?x.Int16:x.Uint16;case 32:return t?x.Int32:x.Uint32;case 64:return t?x.Int64:x.Uint64}return x.Int}case x.Float:switch(r.precision){case tn.HALF:return x.Float16;case tn.SINGLE:return x.Float32;case tn.DOUBLE:return x.Float64}return x.Float;case x.Binary:return x.Binary;case x.LargeBinary:return x.LargeBinary;case x.Utf8:return x.Utf8;case x.LargeUtf8:return x.LargeUtf8;case x.Bool:return x.Bool;case x.Decimal:return x.Decimal;case x.Time:switch(r.unit){case _e.SECOND:return x.TimeSecond;case _e.MILLISECOND:return x.TimeMillisecond;case _e.MICROSECOND:return x.TimeMicrosecond;case _e.NANOSECOND:return x.TimeNanosecond}return x.Time;case x.Timestamp:switch(r.unit){case _e.SECOND:return x.TimestampSecond;case _e.MILLISECOND:return x.TimestampMillisecond;case _e.MICROSECOND:return x.TimestampMicrosecond;case _e.NANOSECOND:return x.TimestampNanosecond}return x.Timestamp;case x.Date:switch(r.unit){case Wn.DAY:return x.DateDay;case Wn.MILLISECOND:return x.DateMillisecond}return x.Date;case x.Interval:switch(r.unit){case Fr.DAY_TIME:return x.IntervalDayTime;case Fr.YEAR_MONTH:return x.IntervalYearMonth}return x.Interval;case x.Duration:switch(r.unit){case _e.SECOND:return x.DurationSecond;case _e.MILLISECOND:return x.DurationMillisecond;case _e.MICROSECOND:return x.DurationMicrosecond;case _e.NANOSECOND:return x.DurationNanosecond}return x.Duration;case x.Map:return x.Map;case x.List:return x.List;case x.Struct:return x.Struct;case x.Union:switch(r.mode){case bn.Dense:return x.DenseUnion;case bn.Sparse:return x.SparseUnion}return x.Union;case x.FixedSizeBinary:return x.FixedSizeBinary;case x.FixedSizeList:return x.FixedSizeList;case x.Dictionary:return x.Dictionary}throw new Error(`Unrecognized type '${x[r.typeId]}'`)}ke.prototype.visitInt8=null;ke.prototype.visitInt16=null;ke.prototype.visitInt32=null;ke.prototype.visitInt64=null;ke.prototype.visitUint8=null;ke.prototype.visitUint16=null;ke.prototype.visitUint32=null;ke.prototype.visitUint64=null;ke.prototype.visitFloat16=null;ke.prototype.visitFloat32=null;ke.prototype.visitFloat64=null;ke.prototype.visitDateDay=null;ke.prototype.visitDateMillisecond=null;ke.prototype.visitTimestampSecond=null;ke.prototype.visitTimestampMillisecond=null;ke.prototype.visitTimestampMicrosecond=null;ke.prototype.visitTimestampNanosecond=null;ke.prototype.visitTimeSecond=null;ke.prototype.visitTimeMillisecond=null;ke.prototype.visitTimeMicrosecond=null;ke.prototype.visitTimeNanosecond=null;ke.prototype.visitDenseUnion=null;ke.prototype.visitSparseUnion=null;ke.prototype.visitIntervalDayTime=null;ke.prototype.visitIntervalYearMonth=null;ke.prototype.visitDuration=null;ke.prototype.visitDurationSecond=null;ke.prototype.visitDurationMillisecond=null;ke.prototype.visitDurationMicrosecond=null;ke.prototype.visitDurationNanosecond=null;const kv=new Float64Array(1),Ks=new Uint32Array(kv.buffer);function Uv(r){const e=(r&31744)>>10,t=(r&1023)/1024,s=Math.pow(-1,(r&32768)>>15);switch(e){case 31:return s*(t?Number.NaN:1/0);case 0:return s*(t?6103515625e-14*t:0)}return s*Math.pow(2,e-15)*(1+t)}function cI(r){if(r!==r)return 32256;kv[0]=r;const e=(Ks[1]&2147483648)>>16&65535;let t=Ks[1]&2146435072,s=0;return t>=1089470464?Ks[0]>0?t=31744:(t=(t&2080374784)>>16,s=(Ks[1]&1048575)>>10):t<=1056964608?(s=1048576+(Ks[1]&1048575),s=1048576+(s<<(t>>20)-998)>>21,t=0):(t=t-1056964608>>10,s=(Ks[1]&1048575)+512>>10),e|t|s&65535}class be extends ke{}function xe(r){return(e,t,s)=>{if(e.setValid(t,s!=null))return r(e,t,s)}}const dI=(r,e,t)=>{r[e]=Math.floor(t/864e5)},jv=(r,e,t,s)=>{if(t+1<e.length){const a=wt(e[t]),u=wt(e[t+1]);r.set(s.subarray(0,u-a),a)}},fI=({offset:r,values:e},t,s)=>{const a=r+t;s?e[a>>3]|=1<<a%8:e[a>>3]&=~(1<<a%8)},ni=({values:r},e,t)=>{r[e]=t},Xf=({values:r},e,t)=>{r[e]=t},zv=({values:r},e,t)=>{r[e]=cI(t)},hI=(r,e,t)=>{switch(r.type.precision){case tn.HALF:return zv(r,e,t);case tn.SINGLE:case tn.DOUBLE:return Xf(r,e,t)}},Vv=({values:r},e,t)=>{dI(r,e,t.valueOf())},$v=({values:r},e,t)=>{r[e]=BigInt(t)},pI=({stride:r,values:e},t,s)=>{e.set(s.subarray(0,r),r*t)},Wv=({values:r,valueOffsets:e},t,s)=>jv(r,e,t,s),Qv=({values:r,valueOffsets:e},t,s)=>jv(r,e,t,Kf(s)),yI=(r,e,t)=>{r.type.unit===Wn.DAY?Vv(r,e,t):$v(r,e,t)},Hv=({values:r},e,t)=>{r[e]=BigInt(t/1e3)},Kv=({values:r},e,t)=>{r[e]=BigInt(t)},qv=({values:r},e,t)=>{r[e]=BigInt(t*1e3)},Yv=({values:r},e,t)=>{r[e]=BigInt(t*1e6)},mI=(r,e,t)=>{switch(r.type.unit){case _e.SECOND:return Hv(r,e,t);case _e.MILLISECOND:return Kv(r,e,t);case _e.MICROSECOND:return qv(r,e,t);case _e.NANOSECOND:return Yv(r,e,t)}},Gv=({values:r},e,t)=>{r[e]=t},Jv=({values:r},e,t)=>{r[e]=t},Xv=({values:r},e,t)=>{r[e]=t},Zv=({values:r},e,t)=>{r[e]=t},gI=(r,e,t)=>{switch(r.type.unit){case _e.SECOND:return Gv(r,e,t);case _e.MILLISECOND:return Jv(r,e,t);case _e.MICROSECOND:return Xv(r,e,t);case _e.NANOSECOND:return Zv(r,e,t)}},vI=({values:r,stride:e},t,s)=>{r.set(s.subarray(0,e),e*t)},wI=(r,e,t)=>{const s=r.children[0],a=r.valueOffsets,u=Qn.getVisitFn(s);if(Array.isArray(t))for(let d=-1,h=a[e],p=a[e+1];h<p;)u(s,h++,t[++d]);else for(let d=-1,h=a[e],p=a[e+1];h<p;)u(s,h++,t.get(++d))},SI=(r,e,t)=>{const s=r.children[0],{valueOffsets:a}=r,u=Qn.getVisitFn(s);let{[e]:d,[e+1]:h}=a;const p=t instanceof Map?t.entries():Object.entries(t);for(const m of p)if(u(s,d,m),++d>=h)break},_I=(r,e)=>(t,s,a,u)=>s&&t(s,r,e[u]),bI=(r,e)=>(t,s,a,u)=>s&&t(s,r,e.get(u)),II=(r,e)=>(t,s,a,u)=>s&&t(s,r,e.get(a.name)),EI=(r,e)=>(t,s,a,u)=>s&&t(s,r,e[a.name]),xI=(r,e,t)=>{const s=r.type.children.map(u=>Qn.getVisitFn(u.type)),a=t instanceof Map?II(e,t):t instanceof lt?bI(e,t):Array.isArray(t)?_I(e,t):EI(e,t);r.type.children.forEach((u,d)=>a(s[d],r.children[d],u,d))},DI=(r,e,t)=>{r.type.mode===bn.Dense?e0(r,e,t):t0(r,e,t)},e0=(r,e,t)=>{const s=r.type.typeIdToChildIndex[r.typeIds[e]],a=r.children[s];Qn.visit(a,r.valueOffsets[e],t)},t0=(r,e,t)=>{const s=r.type.typeIdToChildIndex[r.typeIds[e]],a=r.children[s];Qn.visit(a,e,t)},OI=(r,e,t)=>{var s;(s=r.dictionary)===null||s===void 0||s.set(r.values[e],t)},CI=(r,e,t)=>{r.type.unit===Fr.DAY_TIME?n0(r,e,t):r0(r,e,t)},n0=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},r0=({values:r},e,t)=>{r[e]=t[0]*12+t[1]%12},i0=({values:r},e,t)=>{r[e]=t},s0=({values:r},e,t)=>{r[e]=t},o0=({values:r},e,t)=>{r[e]=t},a0=({values:r},e,t)=>{r[e]=t},RI=(r,e,t)=>{switch(r.type.unit){case _e.SECOND:return i0(r,e,t);case _e.MILLISECOND:return s0(r,e,t);case _e.MICROSECOND:return o0(r,e,t);case _e.NANOSECOND:return a0(r,e,t)}},FI=(r,e,t)=>{const{stride:s}=r,a=r.children[0],u=Qn.getVisitFn(a);if(Array.isArray(t))for(let d=-1,h=e*s;++d<s;)u(a,h+d,t[d]);else for(let d=-1,h=e*s;++d<s;)u(a,h+d,t.get(d))};be.prototype.visitBool=xe(fI);be.prototype.visitInt=xe(ni);be.prototype.visitInt8=xe(ni);be.prototype.visitInt16=xe(ni);be.prototype.visitInt32=xe(ni);be.prototype.visitInt64=xe(ni);be.prototype.visitUint8=xe(ni);be.prototype.visitUint16=xe(ni);be.prototype.visitUint32=xe(ni);be.prototype.visitUint64=xe(ni);be.prototype.visitFloat=xe(hI);be.prototype.visitFloat16=xe(zv);be.prototype.visitFloat32=xe(Xf);be.prototype.visitFloat64=xe(Xf);be.prototype.visitUtf8=xe(Qv);be.prototype.visitLargeUtf8=xe(Qv);be.prototype.visitBinary=xe(Wv);be.prototype.visitLargeBinary=xe(Wv);be.prototype.visitFixedSizeBinary=xe(pI);be.prototype.visitDate=xe(yI);be.prototype.visitDateDay=xe(Vv);be.prototype.visitDateMillisecond=xe($v);be.prototype.visitTimestamp=xe(mI);be.prototype.visitTimestampSecond=xe(Hv);be.prototype.visitTimestampMillisecond=xe(Kv);be.prototype.visitTimestampMicrosecond=xe(qv);be.prototype.visitTimestampNanosecond=xe(Yv);be.prototype.visitTime=xe(gI);be.prototype.visitTimeSecond=xe(Gv);be.prototype.visitTimeMillisecond=xe(Jv);be.prototype.visitTimeMicrosecond=xe(Xv);be.prototype.visitTimeNanosecond=xe(Zv);be.prototype.visitDecimal=xe(vI);be.prototype.visitList=xe(wI);be.prototype.visitStruct=xe(xI);be.prototype.visitUnion=xe(DI);be.prototype.visitDenseUnion=xe(e0);be.prototype.visitSparseUnion=xe(t0);be.prototype.visitDictionary=xe(OI);be.prototype.visitInterval=xe(CI);be.prototype.visitIntervalDayTime=xe(n0);be.prototype.visitIntervalYearMonth=xe(r0);be.prototype.visitDuration=xe(RI);be.prototype.visitDurationSecond=xe(i0);be.prototype.visitDurationMillisecond=xe(s0);be.prototype.visitDurationMicrosecond=xe(o0);be.prototype.visitDurationNanosecond=xe(a0);be.prototype.visitFixedSizeList=xe(FI);be.prototype.visitMap=xe(SI);const Qn=new be,rr=Symbol.for("parent"),co=Symbol.for("rowIndex");class Zf{constructor(e,t){return this[rr]=e,this[co]=t,new Proxy(this,LI)}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[co],t=this[rr],s=t.type.children,a={};for(let u=-1,d=s.length;++u<d;)a[s[u].name]=In.visit(t.children[u],e);return a}toString(){return`{${[...this].map(([e,t])=>`${Pa(e)}: ${Pa(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new MI(this[rr],this[co])}}class MI{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,In.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Zf.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[rr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[co]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class AI{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[rr].type.children.map(t=>t.name)}has(e,t){return e[rr].type.children.some(s=>s.name===t)}getOwnPropertyDescriptor(e,t){if(e[rr].type.children.some(s=>s.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];const s=e[rr].type.children.findIndex(a=>a.name===t);if(s!==-1){const a=In.visit(e[rr].children[s],e[co]);return Reflect.set(e,t,a),a}}set(e,t,s){const a=e[rr].type.children.findIndex(u=>u.name===t);return a!==-1?(Qn.visit(e[rr].children[a],e[co],s),Reflect.set(e,t,s)):Reflect.has(e,t)||typeof t=="symbol"?Reflect.set(e,t,s):!1}}const LI=new AI;class ye extends ke{}function Ie(r){return(e,t)=>e.getValid(t)?r(e,t):null}const PI=(r,e)=>864e5*r[e],TI=(r,e)=>null,l0=(r,e,t)=>{if(t+1>=e.length)return null;const s=wt(e[t]),a=wt(e[t+1]);return r.subarray(s,a)},BI=({offset:r,values:e},t)=>{const s=r+t;return(e[s>>3]&1<<s%8)!==0},u0=({values:r},e)=>PI(r,e),c0=({values:r},e)=>wt(r[e]),zi=({stride:r,values:e},t)=>e[r*t],NI=({stride:r,values:e},t)=>Uv(e[r*t]),d0=({values:r},e)=>r[e],kI=({stride:r,values:e},t)=>e.subarray(r*t,r*(t+1)),f0=({values:r,valueOffsets:e},t)=>l0(r,e,t),h0=({values:r,valueOffsets:e},t)=>{const s=l0(r,e,t);return s!==null?_f(s):null},UI=({values:r},e)=>r[e],jI=({type:r,values:e},t)=>r.precision!==tn.HALF?e[t]:Uv(e[t]),zI=(r,e)=>r.type.unit===Wn.DAY?u0(r,e):c0(r,e),p0=({values:r},e)=>1e3*wt(r[e]),y0=({values:r},e)=>wt(r[e]),m0=({values:r},e)=>pv(r[e],BigInt(1e3)),g0=({values:r},e)=>pv(r[e],BigInt(1e6)),VI=(r,e)=>{switch(r.type.unit){case _e.SECOND:return p0(r,e);case _e.MILLISECOND:return y0(r,e);case _e.MICROSECOND:return m0(r,e);case _e.NANOSECOND:return g0(r,e)}},v0=({values:r},e)=>r[e],w0=({values:r},e)=>r[e],S0=({values:r},e)=>r[e],_0=({values:r},e)=>r[e],$I=(r,e)=>{switch(r.type.unit){case _e.SECOND:return v0(r,e);case _e.MILLISECOND:return w0(r,e);case _e.MICROSECOND:return S0(r,e);case _e.NANOSECOND:return _0(r,e)}},WI=({values:r,stride:e},t)=>Jf.decimal(r.subarray(e*t,e*(t+1))),QI=(r,e)=>{const{valueOffsets:t,stride:s,children:a}=r,{[e*s]:u,[e*s+1]:d}=t,p=a[0].slice(u,d-u);return new lt([p])},HI=(r,e)=>{const{valueOffsets:t,children:s}=r,{[e]:a,[e+1]:u}=t,d=s[0];return new eh(d.slice(a,u-a))},KI=(r,e)=>new Zf(r,e),qI=(r,e)=>r.type.mode===bn.Dense?b0(r,e):I0(r,e),b0=(r,e)=>{const t=r.type.typeIdToChildIndex[r.typeIds[e]],s=r.children[t];return In.visit(s,r.valueOffsets[e])},I0=(r,e)=>{const t=r.type.typeIdToChildIndex[r.typeIds[e]],s=r.children[t];return In.visit(s,e)},YI=(r,e)=>{var t;return(t=r.dictionary)===null||t===void 0?void 0:t.get(r.values[e])},GI=(r,e)=>r.type.unit===Fr.DAY_TIME?E0(r,e):x0(r,e),E0=({values:r},e)=>r.subarray(2*e,2*(e+1)),x0=({values:r},e)=>{const t=r[e],s=new Int32Array(2);return s[0]=Math.trunc(t/12),s[1]=Math.trunc(t%12),s},D0=({values:r},e)=>r[e],O0=({values:r},e)=>r[e],C0=({values:r},e)=>r[e],R0=({values:r},e)=>r[e],JI=(r,e)=>{switch(r.type.unit){case _e.SECOND:return D0(r,e);case _e.MILLISECOND:return O0(r,e);case _e.MICROSECOND:return C0(r,e);case _e.NANOSECOND:return R0(r,e)}},XI=(r,e)=>{const{stride:t,children:s}=r,u=s[0].slice(e*t,t);return new lt([u])};ye.prototype.visitNull=Ie(TI);ye.prototype.visitBool=Ie(BI);ye.prototype.visitInt=Ie(UI);ye.prototype.visitInt8=Ie(zi);ye.prototype.visitInt16=Ie(zi);ye.prototype.visitInt32=Ie(zi);ye.prototype.visitInt64=Ie(d0);ye.prototype.visitUint8=Ie(zi);ye.prototype.visitUint16=Ie(zi);ye.prototype.visitUint32=Ie(zi);ye.prototype.visitUint64=Ie(d0);ye.prototype.visitFloat=Ie(jI);ye.prototype.visitFloat16=Ie(NI);ye.prototype.visitFloat32=Ie(zi);ye.prototype.visitFloat64=Ie(zi);ye.prototype.visitUtf8=Ie(h0);ye.prototype.visitLargeUtf8=Ie(h0);ye.prototype.visitBinary=Ie(f0);ye.prototype.visitLargeBinary=Ie(f0);ye.prototype.visitFixedSizeBinary=Ie(kI);ye.prototype.visitDate=Ie(zI);ye.prototype.visitDateDay=Ie(u0);ye.prototype.visitDateMillisecond=Ie(c0);ye.prototype.visitTimestamp=Ie(VI);ye.prototype.visitTimestampSecond=Ie(p0);ye.prototype.visitTimestampMillisecond=Ie(y0);ye.prototype.visitTimestampMicrosecond=Ie(m0);ye.prototype.visitTimestampNanosecond=Ie(g0);ye.prototype.visitTime=Ie($I);ye.prototype.visitTimeSecond=Ie(v0);ye.prototype.visitTimeMillisecond=Ie(w0);ye.prototype.visitTimeMicrosecond=Ie(S0);ye.prototype.visitTimeNanosecond=Ie(_0);ye.prototype.visitDecimal=Ie(WI);ye.prototype.visitList=Ie(QI);ye.prototype.visitStruct=Ie(KI);ye.prototype.visitUnion=Ie(qI);ye.prototype.visitDenseUnion=Ie(b0);ye.prototype.visitSparseUnion=Ie(I0);ye.prototype.visitDictionary=Ie(YI);ye.prototype.visitInterval=Ie(GI);ye.prototype.visitIntervalDayTime=Ie(E0);ye.prototype.visitIntervalYearMonth=Ie(x0);ye.prototype.visitDuration=Ie(JI);ye.prototype.visitDurationSecond=Ie(D0);ye.prototype.visitDurationMillisecond=Ie(O0);ye.prototype.visitDurationMicrosecond=Ie(C0);ye.prototype.visitDurationNanosecond=Ie(R0);ye.prototype.visitFixedSizeList=Ie(XI);ye.prototype.visitMap=Ie(HI);const In=new ye,io=Symbol.for("keys"),fo=Symbol.for("vals"),so=Symbol.for("kKeysAsStrings"),Of=Symbol.for("_kKeysAsStrings");class eh{constructor(e){return this[io]=new lt([e.children[0]]).memoize(),this[fo]=e.children[1],new Proxy(this,new eE)}get[so](){return this[Of]||(this[Of]=Array.from(this[io].toArray(),String))}[Symbol.iterator](){return new ZI(this[io],this[fo])}get size(){return this[io].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[io],t=this[fo],s={};for(let a=-1,u=e.length;++a<u;)s[e.get(a)]=In.visit(t,a);return s}toString(){return`{${[...this].map(([e,t])=>`${Pa(e)}: ${Pa(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class ZI{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),In.visit(this.vals,e)]})}}class eE{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[so]}has(e,t){return e[so].includes(t)}getOwnPropertyDescriptor(e,t){if(e[so].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];const s=e[so].indexOf(t);if(s!==-1){const a=In.visit(Reflect.get(e,fo),s);return Reflect.set(e,t,a),a}}set(e,t,s){const a=e[so].indexOf(t);return a!==-1?(Qn.visit(Reflect.get(e,fo),a,s),Reflect.set(e,t,s)):Reflect.has(e,t)?Reflect.set(e,t,s):!1}}Object.defineProperties(eh.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[io]:{writable:!0,enumerable:!1,configurable:!1,value:null},[fo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Of]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Vm;function F0(r,e,t,s){const{length:a=0}=r;let u=typeof e!="number"?0:e,d=typeof t!="number"?a:t;return u<0&&(u=(u%a+a)%a),d<0&&(d=(d%a+a)%a),d<u&&(Vm=u,u=d,d=Vm),d>a&&(d=a),s?s(r,u,d):[u,d]}const th=(r,e)=>r<0?e+r:r,$m=r=>r!==r;function bo(r){if(typeof r!=="object"||r===null)return $m(r)?$m:t=>t===r;if(r instanceof Date){const t=r.valueOf();return s=>s instanceof Date?s.valueOf()===t:!1}return ArrayBuffer.isView(r)?t=>t?Jb(r,t):!1:r instanceof Map?nE(r):Array.isArray(r)?tE(r):r instanceof lt?rE(r):iE(r,!0)}function tE(r){const e=[];for(let t=-1,s=r.length;++t<s;)e[t]=bo(r[t]);return lc(e)}function nE(r){let e=-1;const t=[];for(const s of r.values())t[++e]=bo(s);return lc(t)}function rE(r){const e=[];for(let t=-1,s=r.length;++t<s;)e[t]=bo(r.get(t));return lc(e)}function iE(r,e=!1){const t=Object.keys(r);if(!e&&t.length===0)return()=>!1;const s=[];for(let a=-1,u=t.length;++a<u;)s[a]=bo(r[t[a]]);return lc(s,t)}function lc(r,e){return t=>{if(!t||typeof t!="object")return!1;switch(t.constructor){case Array:return sE(r,t);case Map:return Wm(r,t,t.keys());case eh:case Zf:case Object:case void 0:return Wm(r,t,e||Object.keys(t))}return t instanceof lt?oE(r,t):!1}}function sE(r,e){const t=r.length;if(e.length!==t)return!1;for(let s=-1;++s<t;)if(!r[s](e[s]))return!1;return!0}function oE(r,e){const t=r.length;if(e.length!==t)return!1;for(let s=-1;++s<t;)if(!r[s](e.get(s)))return!1;return!0}function Wm(r,e,t){const s=t[Symbol.iterator](),a=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),u=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let d=0;const h=r.length;let p=u.next(),m=s.next(),g=a.next();for(;d<h&&!m.done&&!g.done&&!p.done&&!(m.value!==g.value||!r[d](p.value));++d,m=s.next(),g=a.next(),p=u.next());return d===h&&m.done&&g.done&&p.done?!0:(s.return&&s.return(),a.return&&a.return(),u.return&&u.return(),!1)}function M0(r,e,t,s){return(t&1<<s)!==0}function aE(r,e,t,s){return(t&1<<s)>>s}function Qm(r,e,t){const s=t.byteLength+7&-8;if(r>0||t.byteLength<s){const a=new Uint8Array(s);return a.set(r%8===0?t.subarray(r>>3):Cf(new nh(t,r,e,null,M0)).subarray(0,s)),a}return t}function Cf(r){const e=[];let t=0,s=0,a=0;for(const d of r)d&&(a|=1<<s),++s===8&&(e[t++]=a,a=s=0);(t===0||s>0)&&(e[t++]=a);const u=new Uint8Array(e.length+7&-8);return u.set(e),u}class nh{constructor(e,t,s,a,u){this.bytes=e,this.length=s,this.context=a,this.get=u,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}function Rf(r,e,t){if(t-e<=0)return 0;if(t-e<8){let u=0;for(const d of new nh(r,e,t-e,r,aE))u+=d;return u}const s=t>>3<<3,a=e+(e%8===0?0:8-e%8);return Rf(r,e,a)+Rf(r,s,t)+lE(r,a>>3,s-a>>3)}function lE(r,e,t){let s=0,a=Math.trunc(e);const u=new DataView(r.buffer,r.byteOffset,r.byteLength),d=t===void 0?r.byteLength:a+t;for(;d-a>=4;)s+=lf(u.getUint32(a)),a+=4;for(;d-a>=2;)s+=lf(u.getUint16(a)),a+=2;for(;d-a>=1;)s+=lf(u.getUint8(a)),a+=1;return s}function lf(r){let e=Math.trunc(r);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const uE=-1;let yt=class Ff{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return ue.isSparseUnion(e)?this.children.some(t=>t.nullable):ue.isDenseUnion(e)?this.children.some(t=>t.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:t,values:s,nullBitmap:a,typeIds:u}=this;return t&&(e+=t.byteLength),s&&(e+=s.byteLength),a&&(e+=a.byteLength),u&&(e+=u.byteLength),this.children.reduce((d,h)=>d+h.byteLength,e)}get nullCount(){if(ue.isUnion(this.type))return this.children.reduce((s,a)=>s+a.nullCount,0);let e=this._nullCount,t;return e<=uE&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-Rf(t,this.offset,this.offset+this.length)),e}constructor(e,t,s,a,u,d=[],h){this.type=e,this.children=d,this.dictionary=h,this.offset=Math.floor(Math.max(t||0,0)),this.length=Math.floor(Math.max(s||0,0)),this._nullCount=Math.floor(Math.max(a||0,-1));let p;u instanceof Ff?(this.stride=u.stride,this.values=u.values,this.typeIds=u.typeIds,this.nullBitmap=u.nullBitmap,this.valueOffsets=u.valueOffsets):(this.stride=Hr(e),u&&((p=u[0])&&(this.valueOffsets=p),(p=u[1])&&(this.values=p),(p=u[2])&&(this.nullBitmap=p),(p=u[3])&&(this.typeIds=p)))}getValid(e){const{type:t}=this;if(ue.isUnion(t)){const s=t,a=this.children[s.typeIdToChildIndex[this.typeIds[e]]],u=s.mode===bn.Dense?this.valueOffsets[e]:e;return a.getValid(u)}if(this.nullable&&this.nullCount>0){const s=this.offset+e;return(this.nullBitmap[s>>3]&1<<s%8)!==0}return!0}setValid(e,t){let s;const{type:a}=this;if(ue.isUnion(a)){const u=a,d=this.children[u.typeIdToChildIndex[this.typeIds[e]]],h=u.mode===bn.Dense?this.valueOffsets[e]:e;s=d.getValid(h),d.setValid(h,t)}else{let{nullBitmap:u}=this;const{offset:d,length:h}=this,p=d+e,m=1<<p%8,g=p>>3;(!u||u.byteLength<=g)&&(u=new Uint8Array((d+h+63&-64)>>3).fill(255),this.nullCount>0?(u.set(Qm(d,h,this.nullBitmap),0),Object.assign(this,{nullBitmap:u})):Object.assign(this,{nullBitmap:u,_nullCount:0}));const v=u[g];s=(v&m)!==0,u[g]=t?v|m:v&~m}return s!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(e=this.type,t=this.offset,s=this.length,a=this._nullCount,u=this,d=this.children){return new Ff(e,t,s,a,u,d,this.dictionary)}slice(e,t){const{stride:s,typeId:a,children:u}=this,d=+(this._nullCount===0)-1,h=a===16?s:1,p=this._sliceBuffers(e,t,s,a);return this.clone(this.type,this.offset+e,t,d,p,u.length===0||this.valueOffsets?u:this._sliceChildren(u,h*e,h*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===x.Null)return this.clone(this.type,0,e,0);const{length:t,nullCount:s}=this,a=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);a[t>>3]=(1<<t-(t&-8))-1,s>0&&a.set(Qm(this.offset,t,this.nullBitmap),0);const u=this.buffers;return u[Qr.VALIDITY]=a,this.clone(this.type,0,e,s+(e-t),u)}_sliceBuffers(e,t,s,a){let u;const{buffers:d}=this;return(u=d[Qr.TYPE])&&(d[Qr.TYPE]=u.subarray(e,e+t)),(u=d[Qr.OFFSET])&&(d[Qr.OFFSET]=u.subarray(e,e+t+1))||(u=d[Qr.DATA])&&(d[Qr.DATA]=a===6?u:u.subarray(s*e,s*(e+t))),d}_sliceChildren(e,t,s){return e.map(a=>a.slice(t,s))}};yt.prototype.children=Object.freeze([]);class Ra extends ke{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:t,["offset"]:s=0,["length"]:a=0}=e;return new yt(t,s,a,a)}visitBool(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length>>3,["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitInt(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length,["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitFloat(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length,["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitUtf8(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.data),u=We(e.nullBitmap),d=ya(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new yt(t,s,h,p,[d,a,u])}visitLargeUtf8(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.data),u=We(e.nullBitmap),d=Mm(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new yt(t,s,h,p,[d,a,u])}visitBinary(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.data),u=We(e.nullBitmap),d=ya(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new yt(t,s,h,p,[d,a,u])}visitLargeBinary(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.data),u=We(e.nullBitmap),d=Mm(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new yt(t,s,h,p,[d,a,u])}visitFixedSizeBinary(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length/Hr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitDate(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length/Hr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitTimestamp(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length/Hr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitTime(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length/Hr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitDecimal(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length/Hr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitList(e){const{["type"]:t,["offset"]:s=0,["child"]:a}=e,u=We(e.nullBitmap),d=ya(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new yt(t,s,h,p,[d,void 0,u],[a])}visitStruct(e){const{["type"]:t,["offset"]:s=0,["children"]:a=[]}=e,u=We(e.nullBitmap),{length:d=a.reduce((p,{length:m})=>Math.max(p,m),0),nullCount:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,void 0,u],a)}visitUnion(e){const{["type"]:t,["offset"]:s=0,["children"]:a=[]}=e,u=it(t.ArrayType,e.typeIds),{["length"]:d=u.length,["nullCount"]:h=-1}=e;if(ue.isSparseUnion(t))return new yt(t,s,d,h,[void 0,void 0,void 0,u],a);const p=ya(e.valueOffsets);return new yt(t,s,d,h,[p,void 0,void 0,u],a)}visitDictionary(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.indices.ArrayType,e.data),{["dictionary"]:d=new lt([new Ra().visit({type:t.dictionary})])}=e,{["length"]:h=u.length,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new yt(t,s,h,p,[void 0,u,a],[],d)}visitInterval(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length/Hr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitDuration(e){const{["type"]:t,["offset"]:s=0}=e,a=We(e.nullBitmap),u=it(t.ArrayType,e.data),{["length"]:d=u.length,["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,u,a])}visitFixedSizeList(e){const{["type"]:t,["offset"]:s=0,["child"]:a=new Ra().visit({type:t.valueType})}=e,u=We(e.nullBitmap),{["length"]:d=a.length/Hr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new yt(t,s,d,h,[void 0,void 0,u],[a])}visitMap(e){const{["type"]:t,["offset"]:s=0,["child"]:a=new Ra().visit({type:t.childType})}=e,u=We(e.nullBitmap),d=ya(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new yt(t,s,h,p,[d,void 0,u],[a])}}const cE=new Ra;function Be(r){return cE.visit(r)}class Hm{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function dE(r){return r.some(e=>e.nullable)}function A0(r){return r.reduce((e,t)=>e+t.nullCount,0)}function L0(r){return r.reduce((e,t,s)=>(e[s+1]=e[s]+t.length,e),new Uint32Array(r.length+1))}function P0(r,e,t,s){const a=[];for(let u=-1,d=r.length;++u<d;){const h=r[u],p=e[u],{length:m}=h;if(p>=s)break;if(t>=p+m)continue;if(p>=t&&p+m<=s){a.push(h);continue}const g=Math.max(0,t-p),v=Math.min(s-p,m);a.push(h.slice(g,v-g))}return a.length===0&&a.push(r[0].slice(0,0)),a}function rh(r,e,t,s){let a=0,u=0,d=e.length-1;do{if(a>=d-1)return t<e[d]?s(r,a,t-e[a]):null;u=a+Math.trunc((d-a)*.5),t<e[u]?d=u:a=u}while(a<d)}function ih(r,e){return r.getValid(e)}function Ku(r){function e(t,s,a){return r(t[s],a)}return function(t){const s=this.data;return rh(s,this._offsets,t,e)}}function T0(r){let e;function t(s,a,u){return r(s[a],u,e)}return function(s,a){const u=this.data;e=a;const d=rh(u,this._offsets,s,t);return e=void 0,d}}function B0(r){let e;function t(s,a,u){let d=u,h=0,p=0;for(let m=a-1,g=s.length;++m<g;){const v=s[m];if(~(h=r(v,e,d)))return p+h;d=0,p+=v.length}return-1}return function(s,a){e=s;const u=this.data,d=typeof a!="number"?t(u,0,0):rh(u,this._offsets,a,t);return e=void 0,d}}class me extends ke{}function fE(r,e){return e===null&&r.length>0?0:-1}function hE(r,e){const{nullBitmap:t}=r;if(!t||r.nullCount<=0)return-1;let s=0;for(const a of new nh(t,r.offset+(e||0),r.length,t,M0)){if(!a)return s;++s}return-1}function Oe(r,e,t){if(e===void 0)return-1;if(e===null)switch(r.typeId){case x.Union:break;case x.Dictionary:break;default:return hE(r,t)}const s=In.getVisitFn(r),a=bo(e);for(let u=(t||0)-1,d=r.length;++u<d;)if(a(s(r,u)))return u;return-1}function N0(r,e,t){const s=In.getVisitFn(r),a=bo(e);for(let u=(t||0)-1,d=r.length;++u<d;)if(a(s(r,u)))return u;return-1}me.prototype.visitNull=fE;me.prototype.visitBool=Oe;me.prototype.visitInt=Oe;me.prototype.visitInt8=Oe;me.prototype.visitInt16=Oe;me.prototype.visitInt32=Oe;me.prototype.visitInt64=Oe;me.prototype.visitUint8=Oe;me.prototype.visitUint16=Oe;me.prototype.visitUint32=Oe;me.prototype.visitUint64=Oe;me.prototype.visitFloat=Oe;me.prototype.visitFloat16=Oe;me.prototype.visitFloat32=Oe;me.prototype.visitFloat64=Oe;me.prototype.visitUtf8=Oe;me.prototype.visitLargeUtf8=Oe;me.prototype.visitBinary=Oe;me.prototype.visitLargeBinary=Oe;me.prototype.visitFixedSizeBinary=Oe;me.prototype.visitDate=Oe;me.prototype.visitDateDay=Oe;me.prototype.visitDateMillisecond=Oe;me.prototype.visitTimestamp=Oe;me.prototype.visitTimestampSecond=Oe;me.prototype.visitTimestampMillisecond=Oe;me.prototype.visitTimestampMicrosecond=Oe;me.prototype.visitTimestampNanosecond=Oe;me.prototype.visitTime=Oe;me.prototype.visitTimeSecond=Oe;me.prototype.visitTimeMillisecond=Oe;me.prototype.visitTimeMicrosecond=Oe;me.prototype.visitTimeNanosecond=Oe;me.prototype.visitDecimal=Oe;me.prototype.visitList=Oe;me.prototype.visitStruct=Oe;me.prototype.visitUnion=Oe;me.prototype.visitDenseUnion=N0;me.prototype.visitSparseUnion=N0;me.prototype.visitDictionary=Oe;me.prototype.visitInterval=Oe;me.prototype.visitIntervalDayTime=Oe;me.prototype.visitIntervalYearMonth=Oe;me.prototype.visitDuration=Oe;me.prototype.visitDurationSecond=Oe;me.prototype.visitDurationMillisecond=Oe;me.prototype.visitDurationMicrosecond=Oe;me.prototype.visitDurationNanosecond=Oe;me.prototype.visitFixedSizeList=Oe;me.prototype.visitMap=Oe;const qu=new me;class ge extends ke{}function Ee(r){const{type:e}=r;if(r.nullCount===0&&r.stride===1&&(ue.isInt(e)&&e.bitWidth!==64||ue.isTime(e)&&e.bitWidth!==64||ue.isFloat(e)&&e.precision!==tn.HALF))return new Hm(r.data.length,s=>{const a=r.data[s];return a.values.subarray(0,a.length)[Symbol.iterator]()});let t=0;return new Hm(r.data.length,s=>{const u=r.data[s].length,d=r.slice(t,t+u);return t+=u,new pE(d)})}class pE{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}ge.prototype.visitNull=Ee;ge.prototype.visitBool=Ee;ge.prototype.visitInt=Ee;ge.prototype.visitInt8=Ee;ge.prototype.visitInt16=Ee;ge.prototype.visitInt32=Ee;ge.prototype.visitInt64=Ee;ge.prototype.visitUint8=Ee;ge.prototype.visitUint16=Ee;ge.prototype.visitUint32=Ee;ge.prototype.visitUint64=Ee;ge.prototype.visitFloat=Ee;ge.prototype.visitFloat16=Ee;ge.prototype.visitFloat32=Ee;ge.prototype.visitFloat64=Ee;ge.prototype.visitUtf8=Ee;ge.prototype.visitLargeUtf8=Ee;ge.prototype.visitBinary=Ee;ge.prototype.visitLargeBinary=Ee;ge.prototype.visitFixedSizeBinary=Ee;ge.prototype.visitDate=Ee;ge.prototype.visitDateDay=Ee;ge.prototype.visitDateMillisecond=Ee;ge.prototype.visitTimestamp=Ee;ge.prototype.visitTimestampSecond=Ee;ge.prototype.visitTimestampMillisecond=Ee;ge.prototype.visitTimestampMicrosecond=Ee;ge.prototype.visitTimestampNanosecond=Ee;ge.prototype.visitTime=Ee;ge.prototype.visitTimeSecond=Ee;ge.prototype.visitTimeMillisecond=Ee;ge.prototype.visitTimeMicrosecond=Ee;ge.prototype.visitTimeNanosecond=Ee;ge.prototype.visitDecimal=Ee;ge.prototype.visitList=Ee;ge.prototype.visitStruct=Ee;ge.prototype.visitUnion=Ee;ge.prototype.visitDenseUnion=Ee;ge.prototype.visitSparseUnion=Ee;ge.prototype.visitDictionary=Ee;ge.prototype.visitInterval=Ee;ge.prototype.visitIntervalDayTime=Ee;ge.prototype.visitIntervalYearMonth=Ee;ge.prototype.visitDuration=Ee;ge.prototype.visitDurationSecond=Ee;ge.prototype.visitDurationMillisecond=Ee;ge.prototype.visitDurationMicrosecond=Ee;ge.prototype.visitDurationNanosecond=Ee;ge.prototype.visitFixedSizeList=Ee;ge.prototype.visitMap=Ee;const sh=new ge;var k0;const U0={},j0={};class lt{constructor(e){var t,s,a;const u=e[0]instanceof lt?e.flatMap(h=>h.data):e;if(u.length===0||u.some(h=>!(h instanceof yt)))throw new TypeError("Vector constructor expects an Array of Data instances.");const d=(t=u[0])===null||t===void 0?void 0:t.type;switch(u.length){case 0:this._offsets=[0];break;case 1:{const{get:h,set:p,indexOf:m}=U0[d.typeId],g=u[0];this.isValid=v=>ih(g,v),this.get=v=>h(g,v),this.set=(v,b)=>p(g,v,b),this.indexOf=v=>m(g,v),this._offsets=[0,g.length];break}default:Object.setPrototypeOf(this,j0[d.typeId]),this._offsets=L0(u);break}this.data=u,this.type=d,this.stride=Hr(d),this.numChildren=(a=(s=d.children)===null||s===void 0?void 0:s.length)!==null&&a!==void 0?a:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return dE(this.data)}get nullCount(){return A0(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${x[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(th(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return sh.visit(this)}concat(...e){return new lt(this.data.concat(e.flatMap(t=>t.data).flat(Number.POSITIVE_INFINITY)))}slice(e,t){return new lt(F0(this,e,t,({data:s,_offsets:a},u,d)=>P0(s,a,u,d)))}toJSON(){return[...this]}toArray(){const{type:e,data:t,length:s,stride:a,ArrayType:u}=this;switch(e.typeId){case x.Int:case x.Float:case x.Decimal:case x.Time:case x.Timestamp:switch(t.length){case 0:return new u;case 1:return t[0].values.subarray(0,s*a);default:return t.reduce((d,{values:h,length:p})=>(d.array.set(h.subarray(0,p*a),d.offset),d.offset+=p*a,d),{array:new u(s*a),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var t;return this.getChildAt((t=this.type.children)===null||t===void 0?void 0:t.findIndex(s=>s.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new lt(this.data.map(({children:t})=>t[e])):null}get isMemoized(){return ue.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(ue.isDictionary(this.type)){const e=new Yu(this.data[0].dictionary),t=this.data.map(s=>{const a=s.clone();return a.dictionary=e,a});return new lt(t)}return new Yu(this)}unmemoize(){if(ue.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),t=this.data.map(s=>{const a=s.clone();return a.dictionary=e,a});return new lt(t)}return this}}k0=Symbol.toStringTag;lt[k0]=(r=>{r.type=ue.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const e=Object.keys(x).map(t=>x[t]).filter(t=>typeof t=="number"&&t!==x.NONE);for(const t of e){const s=In.getVisitFnByTypeId(t),a=Qn.getVisitFnByTypeId(t),u=qu.getVisitFnByTypeId(t);U0[t]={get:s,set:a,indexOf:u},j0[t]=Object.create(r,{isValid:{value:Ku(ih)},get:{value:Ku(In.getVisitFnByTypeId(t))},set:{value:T0(Qn.getVisitFnByTypeId(t))},indexOf:{value:B0(qu.getVisitFnByTypeId(t))}})}return"Vector"})(lt.prototype);class Yu extends lt{constructor(e){super(e.data);const t=this.get,s=this.set,a=this.slice,u=new Array(this.length);Object.defineProperty(this,"get",{value(d){const h=u[d];if(h!==void 0)return h;const p=t.call(this,d);return u[d]=p,p}}),Object.defineProperty(this,"set",{value(d,h){s.call(this,d,h),u[d]=h}}),Object.defineProperty(this,"slice",{value:(d,h)=>new Yu(a.call(this,d,h))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new lt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Mf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,t,s,a){return e.prep(8,24),e.writeInt64(BigInt(a??0)),e.pad(4),e.writeInt32(s),e.writeInt64(BigInt(t??0)),e.offset()}}let wr=class Af{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(e,t){return(t||new Af).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,t){return e.setPosition(e.position()+Ze),(t||new Af).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Tt.V1}schema(e){const t=this.bb.__offset(this.bb_pos,6);return t?(e||new br).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){const s=this.bb.__offset(this.bb_pos,8);return s?(t||new Mf).__init(this.bb.__vector(this.bb_pos+s)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){const s=this.bb.__offset(this.bb_pos,10);return s?(t||new Mf).__init(this.bb.__vector(this.bb_pos+s)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,12);return s?(t||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,Tt.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}};class Xe{constructor(e=[],t,s,a=Tt.V5){this.fields=e||[],this.metadata=t||new Map,s||(s=Lf(this.fields)),this.dictionaries=s,this.metadataVersion=a}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(", ")} }>`}select(e){const t=new Set(e),s=this.fields.filter(a=>t.has(a.name));return new Xe(s,this.metadata)}selectAt(e){const t=e.map(s=>this.fields[s]).filter(Boolean);return new Xe(t,this.metadata)}assign(...e){const t=e[0]instanceof Xe?e[0]:Array.isArray(e[0])?new Xe(e[0]):new Xe(e),s=[...this.fields],a=au(au(new Map,this.metadata),t.metadata),u=t.fields.filter(h=>{const p=s.findIndex(m=>m.name===h.name);return~p?(s[p]=h.clone({metadata:au(au(new Map,s[p].metadata),h.metadata)}))&&!1:!0}),d=Lf(u,new Map);return new Xe([...s,...u],a,new Map([...this.dictionaries,...d]))}}Xe.prototype.fields=null;Xe.prototype.metadata=null;Xe.prototype.dictionaries=null;class St{static new(...e){let[t,s,a,u]=e;return e[0]&&typeof e[0]=="object"&&({name:t}=e[0],s===void 0&&(s=e[0].type),a===void 0&&(a=e[0].nullable),u===void 0&&(u=e[0].metadata)),new St(`${t}`,s,a,u)}constructor(e,t,s=!1,a){this.name=e,this.type=t,this.nullable=s,this.metadata=a||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[t,s,a,u]=e;return!e[0]||typeof e[0]!="object"?[t=this.name,s=this.type,a=this.nullable,u=this.metadata]=e:{name:t=this.name,type:s=this.type,nullable:a=this.nullable,metadata:u=this.metadata}=e[0],St.new(t,s,a,u)}}St.prototype.type=null;St.prototype.name=null;St.prototype.nullable=null;St.prototype.metadata=null;function au(r,e){return new Map([...r||new Map,...e||new Map])}function Lf(r,e=new Map){for(let t=-1,s=r.length;++t<s;){const u=r[t].type;if(ue.isDictionary(u)){if(!e.has(u.id))e.set(u.id,u.dictionary);else if(e.get(u.id)!==u.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}u.children&&u.children.length>0&&Lf(u.children,e)}return e}var yE=cv,mE=yo;class oh{static decode(e){e=new mE(We(e));const t=wr.getRootAsFooter(e),s=Xe.decode(t.schema(),new Map,t.version());return new gE(s,t)}static encode(e){const t=new yE,s=Xe.encode(t,e.schema);wr.startRecordBatchesVector(t,e.numRecordBatches);for(const d of[...e.recordBatches()].slice().reverse())vo.encode(t,d);const a=t.endVector();wr.startDictionariesVector(t,e.numDictionaries);for(const d of[...e.dictionaryBatches()].slice().reverse())vo.encode(t,d);const u=t.endVector();return wr.startFooter(t),wr.addSchema(t,s),wr.addVersion(t,Tt.V5),wr.addRecordBatches(t,a),wr.addDictionaries(t,u),wr.finishFooterBuffer(t,wr.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=Tt.V5,s,a){this.schema=e,this.version=t,s&&(this._recordBatches=s),a&&(this._dictionaryBatches=a)}*recordBatches(){for(let e,t=-1,s=this.numRecordBatches;++t<s;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,s=this.numDictionaries;++t<s;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}}class gE extends oh{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){const t=this._footer.recordBatches(e);if(t)return vo.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){const t=this._footer.dictionaries(e);if(t)return vo.decode(t)}return null}}class vo{static decode(e){return new vo(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,t){const{metaDataLength:s}=t,a=BigInt(t.offset),u=BigInt(t.bodyLength);return Mf.createBlock(e,a,s,u)}constructor(e,t,s){this.metaDataLength=e,this.offset=wt(s),this.bodyLength=wt(t)}}const Dt=Object.freeze({done:!0,value:void 0});class Km{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class z0{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class vE extends z0{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return Re(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Dt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return jn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return jn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return Re(this,void 0,void 0,function*(){return yield this.abort(e),Dt})}return(e){return Re(this,void 0,void 0,function*(){return yield this.close(),Dt})}read(e){return Re(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return Re(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((t,s)=>{this.resolvers.push({resolve:t,reject:s})}):Promise.resolve(Dt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class wE extends vE{write(e){if((e=We(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?_f(this.toUint8Array(!0)):this.toUint8Array(!1).then(_f)}toUint8Array(e=!1){return e?Rr(this._values)[0]:Re(this,void 0,void 0,function*(){var t,s,a,u;const d=[];let h=0;try{for(var p=!0,m=ao(this),g;g=yield m.next(),t=g.done,!t;p=!0){u=g.value,p=!1;const v=u;d.push(v),h+=v.byteLength}}catch(v){s={error:v}}finally{try{!p&&!t&&(a=m.return)&&(yield a.call(m))}finally{if(s)throw s.error}}return Rr(d,h)[0]})}}class Gu{constructor(e){e&&(this.source=new SE(jn.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class wo{constructor(e){e instanceof wo?this.source=e.source:e instanceof wE?this.source=new os(jn.fromAsyncIterable(e)):av(e)?this.source=new os(jn.fromNodeStream(e)):Yf(e)?this.source=new os(jn.fromDOMStream(e)):sv(e)?this.source=new os(jn.fromDOMStream(e.body)):ac(e)?this.source=new os(jn.fromIterable(e)):La(e)?this.source=new os(jn.fromAsyncIterable(e)):qf(e)&&(this.source=new os(jn.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class SE{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,t="read"){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Dt)}return(e){return Object.create(this.source.return&&this.source.return(e)||Dt)}}class os{constructor(e){this.source=e,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}cancel(e){return Re(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return Re(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return Re(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return Re(this,arguments,void 0,function*(t,s="read"){return yield this.source.next({cmd:s,size:t})})}throw(e){return Re(this,void 0,void 0,function*(){const t=this.source.throw&&(yield this.source.throw(e))||Dt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return Re(this,void 0,void 0,function*(){const t=this.source.return&&(yield this.source.return(e))||Dt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}}class qm extends Gu{constructor(e,t){super(),this.position=0,this.buffer=We(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){const{buffer:t,byteOffset:s}=this.readAt(e,4);return new DataView(t,s).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){const{buffer:t,size:s,position:a}=this;return t&&a<s?(typeof e!="number"&&(e=Number.POSITIVE_INFINITY),this.position=Math.min(s,a+Math.min(s-a,e)),t.subarray(a,this.position)):null}readAt(e,t){const s=this.buffer,a=Math.min(this.size,e+t);return s?s.subarray(e,a):new Uint8Array(t)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}}class Ju extends wo{constructor(e,t){super(),this.position=0,this._handle=e,typeof t=="number"?this.size=t:this._pending=Re(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return Re(this,void 0,void 0,function*(){const{buffer:t,byteOffset:s}=yield this.readAt(e,4);return new DataView(t,s).getInt32(0,!0)})}seek(e){return Re(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return Re(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:t,size:s,position:a}=this;if(t&&a<s){typeof e!="number"&&(e=Number.POSITIVE_INFINITY);let u=a,d=0,h=0;const p=Math.min(s,u+Math.min(s-u,e)),m=new Uint8Array(Math.max(0,(this.position=p)-u));for(;(u+=h)<p&&(d+=h)<m.byteLength;)({bytesRead:h}=yield t.read(m,d,m.byteLength-d,u));return m}return null})}readAt(e,t){return Re(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:s,size:a}=this;if(s&&e+t<a){const u=Math.min(a,e+t),d=new Uint8Array(u-e);return(yield s.read(d,0,t,e)).buffer}return new Uint8Array(t)})}close(){return Re(this,void 0,void 0,function*(){const e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return Re(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return Re(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}}const _E=65536;function oo(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}const So=8,ah=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class V0{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){const t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),s=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let a=t[3]*s[3];this.buffer[0]=a&65535;let u=a>>>16;return a=t[2]*s[3],u+=a,a=t[3]*s[2]>>>0,u+=a,this.buffer[0]+=u<<16,this.buffer[1]=u>>>0<a?_E:0,this.buffer[1]+=u>>>16,this.buffer[1]+=t[1]*s[3]+t[2]*s[2]+t[3]*s[1],this.buffer[1]+=t[0]*s[3]+t[1]*s[2]+t[2]*s[1]+t[3]*s[0]<<16,this}_plus(e){const t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${oo(this.buffer[1])} ${oo(this.buffer[0])}`}}class rt extends V0{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,t=new Uint32Array(2)){return rt.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return rt.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){const s=e.length,a=new rt(t);for(let u=0;u<s;){const d=So<s-u?So:s-u,h=new rt(new Uint32Array([Number.parseInt(e.slice(u,u+d),10),0])),p=new rt(new Uint32Array([ah[d],0]));a.times(p),a.plus(h),u+=d}return a}static convertArray(e){const t=new Uint32Array(e.length*2);for(let s=-1,a=e.length;++s<a;)rt.from(e[s],new Uint32Array(t.buffer,t.byteOffset+2*s*4,2));return t}static multiply(e,t){return new rt(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new rt(new Uint32Array(e.buffer)).plus(t)}}class Sn extends V0{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){const t=this.buffer[1]<<0,s=e.buffer[1]<<0;return t<s||t===s&&this.buffer[0]<e.buffer[0]}static from(e,t=new Uint32Array(2)){return Sn.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return Sn.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){const s=e.startsWith("-"),a=e.length,u=new Sn(t);for(let d=s?1:0;d<a;){const h=So<a-d?So:a-d,p=new Sn(new Uint32Array([Number.parseInt(e.slice(d,d+h),10),0])),m=new Sn(new Uint32Array([ah[h],0]));u.times(m),u.plus(p),d+=h}return s?u.negate():u}static convertArray(e){const t=new Uint32Array(e.length*2);for(let s=-1,a=e.length;++s<a;)Sn.from(e[s],new Uint32Array(t.buffer,t.byteOffset+2*s*4,2));return t}static multiply(e,t){return new Sn(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new Sn(new Uint32Array(e.buffer)).plus(t)}}class Ir{constructor(e){this.buffer=e}high(){return new Sn(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Sn(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(e){const t=new rt(new Uint32Array([this.buffer[3],0])),s=new rt(new Uint32Array([this.buffer[2],0])),a=new rt(new Uint32Array([this.buffer[1],0])),u=new rt(new Uint32Array([this.buffer[0],0])),d=new rt(new Uint32Array([e.buffer[3],0])),h=new rt(new Uint32Array([e.buffer[2],0])),p=new rt(new Uint32Array([e.buffer[1],0])),m=new rt(new Uint32Array([e.buffer[0],0]));let g=rt.multiply(u,m);this.buffer[0]=g.low();const v=new rt(new Uint32Array([g.high(),0]));return g=rt.multiply(a,m),v.plus(g),g=rt.multiply(u,p),v.plus(g),this.buffer[1]=v.low(),this.buffer[3]=v.lessThan(g)?1:0,this.buffer[2]=v.high(),new rt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(rt.multiply(s,m)).plus(rt.multiply(a,p)).plus(rt.multiply(u,h)),this.buffer[3]+=rt.multiply(t,m).plus(rt.multiply(s,p)).plus(rt.multiply(a,h)).plus(rt.multiply(u,d)).low(),this}plus(e){const t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${oo(this.buffer[3])} ${oo(this.buffer[2])} ${oo(this.buffer[1])} ${oo(this.buffer[0])}`}static multiply(e,t){return new Ir(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new Ir(new Uint32Array(e.buffer)).plus(t)}static from(e,t=new Uint32Array(4)){return Ir.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(4)){return Ir.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(4)){const s=e.startsWith("-"),a=e.length,u=new Ir(t);for(let d=s?1:0;d<a;){const h=So<a-d?So:a-d,p=new Ir(new Uint32Array([Number.parseInt(e.slice(d,d+h),10),0,0,0])),m=new Ir(new Uint32Array([ah[h],0,0,0]));u.times(m),u.plus(p),d+=h}return s?u.negate():u}static convertArray(e){const t=new Uint32Array(e.length*4);for(let s=-1,a=e.length;++s<a;)Ir.from(e[s],new Uint32Array(t.buffer,t.byteOffset+4*4*s,4));return t}}class $0 extends ke{constructor(e,t,s,a,u=Tt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=t,this.buffers=s,this.dictionaries=a,this.metadataVersion=u}visit(e){return super.visit(e instanceof St?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return Be({type:e,length:t})}visitBool(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitInt(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinary(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitFixedSizeBinary(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitDate(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitTime(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitList(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:s}=this.nextFieldNode()){return this.metadataVersion<Tt.V5&&this.readNullBitmap(e,s),e.mode===bn.Sparse?this.visitSparseUnion(e,{length:t,nullCount:s}):this.visitDenseUnion(e,{length:t,nullCount:s})}visitDenseUnion(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:s}=this.nextFieldNode()){return Be({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,s=this.nextBufferRange()){return t>0&&this.readData(e,s)||new Uint8Array(0)}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:s}=this.nextBufferRange()){return this.bytes.subarray(s,s+t)}readDictionary(e){return this.dictionaries.get(e.id)}}class bE extends $0{constructor(e,t,s,a,u){super(new Uint8Array(0),t,s,a,u),this.sources=e}readNullBitmap(e,t,{offset:s}=this.nextBufferRange()){return t<=0?new Uint8Array(0):Cf(this.sources[s])}readOffsets(e,{offset:t}=this.nextBufferRange()){return it(Uint8Array,it(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return it(Uint8Array,it(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){const{sources:s}=this;return ue.isTimestamp(e)||(ue.isInt(e)||ue.isTime(e))&&e.bitWidth===64||ue.isDuration(e)||ue.isDate(e)&&e.unit===Wn.MILLISECOND?it(Uint8Array,Sn.convertArray(s[t])):ue.isDecimal(e)?it(Uint8Array,Ir.convertArray(s[t])):ue.isBinary(e)||ue.isLargeBinary(e)||ue.isFixedSizeBinary(e)?IE(s[t]):ue.isBool(e)?Cf(s[t]):ue.isUtf8(e)||ue.isLargeUtf8(e)?Kf(s[t].join("")):it(Uint8Array,it(e.ArrayType,s[t].map(a=>+a)))}}function IE(r){const e=r.join(""),t=new Uint8Array(e.length/2);for(let s=0;s<e.length;s+=2)t[s>>1]=Number.parseInt(e.slice(s,s+2),16);return t}class ve extends ke{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((s,a)=>this.compareFields(s,t[a]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}}function dn(r,e){return e instanceof r.constructor}function ms(r,e){return r===e||dn(r,e)}function ri(r,e){return r===e||dn(r,e)&&r.bitWidth===e.bitWidth&&r.isSigned===e.isSigned}function uc(r,e){return r===e||dn(r,e)&&r.precision===e.precision}function EE(r,e){return r===e||dn(r,e)&&r.byteWidth===e.byteWidth}function lh(r,e){return r===e||dn(r,e)&&r.unit===e.unit}function Va(r,e){return r===e||dn(r,e)&&r.unit===e.unit&&r.timezone===e.timezone}function $a(r,e){return r===e||dn(r,e)&&r.unit===e.unit&&r.bitWidth===e.bitWidth}function xE(r,e){return r===e||dn(r,e)&&r.children.length===e.children.length&&ki.compareManyFields(r.children,e.children)}function DE(r,e){return r===e||dn(r,e)&&r.children.length===e.children.length&&ki.compareManyFields(r.children,e.children)}function uh(r,e){return r===e||dn(r,e)&&r.mode===e.mode&&r.typeIds.every((t,s)=>t===e.typeIds[s])&&ki.compareManyFields(r.children,e.children)}function OE(r,e){return r===e||dn(r,e)&&r.id===e.id&&r.isOrdered===e.isOrdered&&ki.visit(r.indices,e.indices)&&ki.visit(r.dictionary,e.dictionary)}function ch(r,e){return r===e||dn(r,e)&&r.unit===e.unit}function Wa(r,e){return r===e||dn(r,e)&&r.unit===e.unit}function CE(r,e){return r===e||dn(r,e)&&r.listSize===e.listSize&&r.children.length===e.children.length&&ki.compareManyFields(r.children,e.children)}function RE(r,e){return r===e||dn(r,e)&&r.keysSorted===e.keysSorted&&r.children.length===e.children.length&&ki.compareManyFields(r.children,e.children)}ve.prototype.visitNull=ms;ve.prototype.visitBool=ms;ve.prototype.visitInt=ri;ve.prototype.visitInt8=ri;ve.prototype.visitInt16=ri;ve.prototype.visitInt32=ri;ve.prototype.visitInt64=ri;ve.prototype.visitUint8=ri;ve.prototype.visitUint16=ri;ve.prototype.visitUint32=ri;ve.prototype.visitUint64=ri;ve.prototype.visitFloat=uc;ve.prototype.visitFloat16=uc;ve.prototype.visitFloat32=uc;ve.prototype.visitFloat64=uc;ve.prototype.visitUtf8=ms;ve.prototype.visitLargeUtf8=ms;ve.prototype.visitBinary=ms;ve.prototype.visitLargeBinary=ms;ve.prototype.visitFixedSizeBinary=EE;ve.prototype.visitDate=lh;ve.prototype.visitDateDay=lh;ve.prototype.visitDateMillisecond=lh;ve.prototype.visitTimestamp=Va;ve.prototype.visitTimestampSecond=Va;ve.prototype.visitTimestampMillisecond=Va;ve.prototype.visitTimestampMicrosecond=Va;ve.prototype.visitTimestampNanosecond=Va;ve.prototype.visitTime=$a;ve.prototype.visitTimeSecond=$a;ve.prototype.visitTimeMillisecond=$a;ve.prototype.visitTimeMicrosecond=$a;ve.prototype.visitTimeNanosecond=$a;ve.prototype.visitDecimal=ms;ve.prototype.visitList=xE;ve.prototype.visitStruct=DE;ve.prototype.visitUnion=uh;ve.prototype.visitDenseUnion=uh;ve.prototype.visitSparseUnion=uh;ve.prototype.visitDictionary=OE;ve.prototype.visitInterval=ch;ve.prototype.visitIntervalDayTime=ch;ve.prototype.visitIntervalYearMonth=ch;ve.prototype.visitDuration=Wa;ve.prototype.visitDurationSecond=Wa;ve.prototype.visitDurationMillisecond=Wa;ve.prototype.visitDurationMicrosecond=Wa;ve.prototype.visitDurationNanosecond=Wa;ve.prototype.visitFixedSizeList=CE;ve.prototype.visitMap=RE;const ki=new ve;function FE(r,e){return ki.compareSchemas(r,e)}function uf(r,e){return ME(r,e.map(t=>t.data.concat()))}function ME(r,e){const t=[...r.fields],s=[],a={numBatches:e.reduce((v,b)=>Math.max(v,b.length),0)};let u=0,d=0,h=-1;const p=e.length;let m,g=[];for(;a.numBatches-- >0;){for(d=Number.POSITIVE_INFINITY,h=-1;++h<p;)g[h]=m=e[h].shift(),d=Math.min(d,m?m.length:d);Number.isFinite(d)&&(g=AE(t,d,g,e,a),d>0&&(s[u++]=Be({type:new un(t),length:d,nullCount:0,children:g.slice()})))}return[r=r.assign(t),s.map(v=>new ir(r,v))]}function AE(r,e,t,s,a){var u;const d=(e+63&-64)>>3;for(let h=-1,p=s.length;++h<p;){const m=t[h],g=m==null?void 0:m.length;if(g>=e)g===e?t[h]=m:(t[h]=m.slice(0,e),a.numBatches=Math.max(a.numBatches,s[h].unshift(m.slice(e,g-e))));else{const v=r[h];r[h]=v.clone({nullable:!0}),t[h]=(u=m==null?void 0:m._changeLengthAndBackfillNullBitmap(e))!==null&&u!==void 0?u:Be({type:v.type,length:e,nullCount:e,nullBitmap:new Uint8Array(d)})}}return t}var W0;class $n{constructor(...e){var t,s;if(e.length===0)return this.batches=[],this.schema=new Xe([]),this._offsets=[0],this;let a,u;e[0]instanceof Xe&&(a=e.shift()),e.at(-1)instanceof Uint32Array&&(u=e.pop());const d=p=>{if(p){if(p instanceof ir)return[p];if(p instanceof $n)return p.batches;if(p instanceof yt){if(p.type instanceof un)return[new ir(new Xe(p.type.children),p)]}else{if(Array.isArray(p))return p.flatMap(m=>d(m));if(typeof p[Symbol.iterator]=="function")return[...p].flatMap(m=>d(m));if(typeof p=="object"){const m=Object.keys(p),g=m.map(I=>new lt([p[I]])),v=a??new Xe(m.map((I,M)=>new St(String(I),g[M].type,g[M].nullable))),[,b]=uf(v,g);return b.length===0?[new ir(p)]:b}}}return[]},h=e.flatMap(p=>d(p));if(a=(s=a??((t=h[0])===null||t===void 0?void 0:t.schema))!==null&&s!==void 0?s:new Xe([]),!(a instanceof Xe))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const p of h){if(!(p instanceof ir))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!FE(a,p.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=a,this.batches=h,this._offsets=u??L0(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=A0(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(th(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?sh.visit(new lt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
80
80
  ${this.toArray().join(`,
81
81
  `)}
82
- ]`}concat(...e){const t=this.schema,s=this.data.concat(e.flatMap(({data:a})=>a));return new $n(t,s.map(a=>new ir(t,a)))}slice(e,t){const s=this.schema;[e,t]=F0({length:this.numRows},e,t);const a=P0(this.data,this._offsets,e,t);return new $n(s,a.map(u=>new ir(s,u)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){const t=this.data.map(s=>s.children[e]);if(t.length===0){const{type:s}=this.schema.fields[e],a=Be({type:s,length:0,nullCount:0});t.push(a._changeLengthAndBackfillNullBitmap(this.numRows))}return new lt(t)}return null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=[...this.batches];if(e>-1&&e<this.numCols){t||(t=new lt([Be({type:new Ni,length:this.numRows})]));const u=s.fields.slice(),d=u[e].clone({type:t.type}),h=this.schema.fields.map((p,m)=>this.getChildAt(m));[u[e],h[e]]=[d,t],[s,a]=uf(s,h)}return new $n(s,a)}select(e){const t=this.schema.fields.reduce((s,a,u)=>s.set(a.name,u),new Map);return this.selectAt(e.map(s=>t.get(s)).filter(s=>s>-1))}selectAt(e){const t=this.schema.selectAt(e),s=this.batches.map(a=>a.selectAt(e));return new $n(t,s)}assign(e){const t=this.schema.fields,[s,a]=e.schema.fields.reduce((h,p,m)=>{const[g,v]=h,b=t.findIndex(I=>I.name===p.name);return~b?v[b]=m:g.push(m),h},[[],[]]),u=this.schema.assign(e.schema),d=[...t.map((h,p)=>[p,a[p]]).map(([h,p])=>p===void 0?this.getChildAt(h):e.getChildAt(p)),...s.map(h=>e.getChildAt(h))].filter(Boolean);return new $n(...uf(u,d))}}W0=Symbol.toStringTag;$n[W0]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Ku(ih),r.get=Ku(In.getVisitFn(x.Struct)),r.set=T0(Qn.getVisitFn(x.Struct)),r.indexOf=B0(qu.getVisitFn(x.Struct)),"Table"))($n.prototype);var Q0;let ir=class Da{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof Xe))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Be({nullCount:0,type:new un(this.schema.fields),children:this.schema.fields.map(t=>Be({type:t.type,nullCount:0}))})]=e,!(this.data instanceof yt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ym(this.schema,this.data.children);break}case 1:{const[t]=e,{fields:s,children:a,length:u}=Object.keys(t).reduce((p,m,g)=>(p.children[g]=t[m],p.length=Math.max(p.length,t[m].length),p.fields[g]=St.new({name:m,type:t[m].type,nullable:!0}),p),{length:0,fields:new Array,children:new Array}),d=new Xe(s),h=Be({type:new un(s),length:u,children:a,nullCount:0});[this.schema,this.data]=Ym(d,h.children,u);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=H0(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return In.visit(this.data,e)}at(e){return this.get(th(e,this.numRows))}set(e,t){return Qn.visit(this.data,e,t)}indexOf(e,t){return qu.visit(this.data,e,t)}[Symbol.iterator](){return sh.visit(new lt([this.data]))}toArray(){return[...this]}concat(...e){return new $n(this.schema,[this,...e])}slice(e,t){const[s]=new lt([this.data]).slice(e,t).data;return new Da(this.schema,s)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)===null||t===void 0?void 0:t.findIndex(s=>s.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new lt([this.data.children[e]]):null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=this.data;if(e>-1&&e<this.numCols){t||(t=new lt([Be({type:new Ni,length:this.numRows})]));const u=s.fields.slice(),d=a.children.slice(),h=u[e].clone({type:t.type});[u[e],d[e]]=[h,t.data[0]],s=new Xe(u,new Map(this.schema.metadata)),a=Be({type:new un(u),children:d})}return new Da(s,a)}select(e){const t=this.schema.select(e),s=new un(t.fields),a=[];for(const u of e){const d=this.schema.fields.findIndex(h=>h.name===u);~d&&(a[d]=this.data.children[d])}return new Da(t,Be({type:s,length:this.numRows,children:a}))}selectAt(e){const t=this.schema.selectAt(e),s=e.map(u=>this.data.children[u]).filter(Boolean),a=Be({type:new un(t.fields),length:this.numRows,children:s});return new Da(t,a)}};Q0=Symbol.toStringTag;ir[Q0]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ir.prototype);function Ym(r,e,t=e.reduce((s,a)=>Math.max(s,a.length),0)){var s;const a=[...r.fields],u=[...e],d=(t+63&-64)>>3;for(const[h,p]of r.fields.entries()){const m=e[h];(!m||m.length!==t)&&(a[h]=p.clone({nullable:!0}),u[h]=(s=m==null?void 0:m._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:Be({type:p.type,length:t,nullCount:t,nullBitmap:new Uint8Array(d)}))}return[r.assign(a),Be({type:new un(a),length:t,children:u})]}function H0(r,e,t=new Map){var s,a;if(((s=r==null?void 0:r.length)!==null&&s!==void 0?s:0)>0&&(r==null?void 0:r.length)===(e==null?void 0:e.length))for(let u=-1,d=r.length;++u<d;){const{type:h}=r[u],p=e[u];for(const m of[p,...((a=p==null?void 0:p.dictionary)===null||a===void 0?void 0:a.data)||[]])H0(h.children,m==null?void 0:m.children,t);if(ue.isDictionary(h)){const{id:m}=h;if(!t.has(m))p!=null&&p.dictionary&&t.set(m,p.dictionary);else if(t.get(m)!==p.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return t}class K0 extends ir{constructor(e){const t=e.fields.map(a=>Be({type:a.type})),s=Be({type:new un(e.fields),nullCount:0,children:t});super(e,s)}}let Ri=class Sr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(e,t){return(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,t){return e.setPosition(e.position()+Ze),(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Tt.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Je.NONE}header(e){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,12);return s?(t||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,Tt.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,Je.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt("0"))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(e,t,s,a,u,d){return Sr.startMessage(e),Sr.addVersion(e,t),Sr.addHeaderType(e,s),Sr.addHeader(e,a),Sr.addBodyLength(e,u),Sr.addCustomMetadata(e,d),Sr.endMessage(e)}};class LE extends ke{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return Um.startNull(t),Um.endNull(t)}visitInt(e,t){return Fn.startInt(t),Fn.addBitWidth(t,e.bitWidth),Fn.addIsSigned(t,e.isSigned),Fn.endInt(t)}visitFloat(e,t){return xr.startFloatingPoint(t),xr.addPrecision(t,e.precision),xr.endFloatingPoint(t)}visitBinary(e,t){return Pm.startBinary(t),Pm.endBinary(t)}visitLargeBinary(e,t){return Bm.startLargeBinary(t),Bm.endLargeBinary(t)}visitBool(e,t){return Tm.startBool(t),Tm.endBool(t)}visitUtf8(e,t){return jm.startUtf8(t),jm.endUtf8(t)}visitLargeUtf8(e,t){return Nm.startLargeUtf8(t),Nm.endLargeUtf8(t)}visitDecimal(e,t){return Xs.startDecimal(t),Xs.addScale(t,e.scale),Xs.addPrecision(t,e.precision),Xs.addBitWidth(t,e.bitWidth),Xs.endDecimal(t)}visitDate(e,t){return du.startDate(t),du.addUnit(t,e.unit),du.endDate(t)}visitTime(e,t){return zn.startTime(t),zn.addUnit(t,e.unit),zn.addBitWidth(t,e.bitWidth),zn.endTime(t)}visitTimestamp(e,t){const s=e.timezone&&t.createString(e.timezone)||void 0;return Vn.startTimestamp(t),Vn.addUnit(t,e.unit),s!==void 0&&Vn.addTimezone(t,s),Vn.endTimestamp(t)}visitInterval(e,t){return Dr.startInterval(t),Dr.addUnit(t,e.unit),Dr.endInterval(t)}visitDuration(e,t){return fu.startDuration(t),fu.addUnit(t,e.unit),fu.endDuration(t)}visitList(e,t){return km.startList(t),km.endList(t)}visitStruct(e,t){return fs.startStruct_(t),fs.endStruct_(t)}visitUnion(e,t){_n.startTypeIdsVector(t,e.typeIds.length);const s=_n.createTypeIdsVector(t,e.typeIds);return _n.startUnion(t),_n.addMode(t,e.mode),_n.addTypeIds(t,s),_n.endUnion(t)}visitDictionary(e,t){const s=this.visit(e.indices,t);return qr.startDictionaryEncoding(t),qr.addId(t,BigInt(e.id)),qr.addIsOrdered(t,e.isOrdered),s!==void 0&&qr.addIndexType(t,s),qr.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return hu.startFixedSizeBinary(t),hu.addByteWidth(t,e.byteWidth),hu.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return pu.startFixedSizeList(t),pu.addListSize(t,e.listSize),pu.endFixedSizeList(t)}visitMap(e,t){return yu.startMap(t),yu.addKeysSorted(t,e.keysSorted),yu.endMap(t)}}const cf=new LE;function PE(r,e=new Map){return new Xe(BE(r,e),gu(r.metadata),e)}function q0(r){return new ar(r.count,Y0(r.columns),G0(r.columns))}function TE(r){return new ei(q0(r.data),r.id,r.isDelta)}function BE(r,e){return(r.fields||[]).filter(Boolean).map(t=>St.fromJSON(t,e))}function Gm(r,e){return(r.children||[]).filter(Boolean).map(t=>St.fromJSON(t,e))}function Y0(r){return(r||[]).reduce((e,t)=>[...e,new Io(t.count,NE(t.VALIDITY)),...Y0(t.children)],[])}function G0(r,e=[]){for(let t=-1,s=(r||[]).length;++t<s;){const a=r[t];a.VALIDITY&&e.push(new Gr(e.length,a.VALIDITY.length)),a.TYPE_ID&&e.push(new Gr(e.length,a.TYPE_ID.length)),a.OFFSET&&e.push(new Gr(e.length,a.OFFSET.length)),a.DATA&&e.push(new Gr(e.length,a.DATA.length)),e=G0(a.children,e)}return e}function NE(r){return(r||[]).reduce((e,t)=>e+ +(t===0),0)}function kE(r,e){let t,s,a,u,d,h;return!e||!(u=r.dictionary)?(d=Xm(r,Gm(r,e)),a=new St(r.name,d,r.nullable,gu(r.metadata))):e.has(t=u.id)?(s=(s=u.indexType)?Jm(s):new Na,h=new go(e.get(t),s,t,u.isOrdered),a=new St(r.name,h,r.nullable,gu(r.metadata))):(s=(s=u.indexType)?Jm(s):new Na,e.set(t,d=Xm(r,Gm(r,e))),h=new go(d,s,t,u.isOrdered),a=new St(r.name,h,r.nullable,gu(r.metadata))),a||null}function gu(r=[]){return new Map(r.map(({key:e,value:t})=>[e,t]))}function Jm(r){return new ys(r.isSigned,r.bitWidth)}function Xm(r,e){const t=r.type.name;switch(t){case"NONE":return new Ni;case"null":return new Ni;case"binary":return new Mu;case"largebinary":return new Au;case"utf8":return new Lu;case"largeutf8":return new Pu;case"bool":return new Tu;case"list":return new Vu((e||[])[0]);case"struct":return new un(e||[]);case"struct_":return new un(e||[])}switch(t){case"int":{const s=r.type;return new ys(s.isSigned,s.bitWidth)}case"floatingpoint":{const s=r.type;return new Fu(tn[s.precision])}case"decimal":{const s=r.type;return new Bu(s.scale,s.precision,s.bitWidth)}case"date":{const s=r.type;return new Nu(Wn[s.unit])}case"time":{const s=r.type;return new ku(_e[s.unit],s.bitWidth)}case"timestamp":{const s=r.type;return new Uu(_e[s.unit],s.timezone)}case"interval":{const s=r.type;return new ju(Fr[s.unit])}case"duration":{const s=r.type;return new zu(_e[s.unit])}case"union":{const s=r.type,[a,...u]=(s.mode+"").toLowerCase(),d=a.toUpperCase()+u.join("");return new $u(bn[d],s.typeIds||[],e||[])}case"fixedsizebinary":{const s=r.type;return new Wu(s.byteWidth)}case"fixedsizelist":{const s=r.type;return new Qu(s.listSize,(e||[])[0])}case"map":{const s=r.type;return new Hu((e||[])[0],s.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}var UE=cv,jE=yo;class sr{static fromJSON(e,t){const s=new sr(0,Tt.V5,t);return s._createHeader=zE(e,t),s}static decode(e){e=new jE(We(e));const t=Ri.getRootAsMessage(e),s=t.bodyLength(),a=t.version(),u=t.headerType(),d=new sr(s,a,u);return d._createHeader=VE(t,u),d}static encode(e){const t=new UE;let s=-1;return e.isSchema()?s=Xe.encode(t,e.header()):e.isRecordBatch()?s=ar.encode(t,e.header()):e.isDictionaryBatch()&&(s=ei.encode(t,e.header())),Ri.startMessage(t),Ri.addVersion(t,Tt.V5),Ri.addHeader(t,s),Ri.addHeaderType(t,e.headerType),Ri.addBodyLength(t,BigInt(e.bodyLength)),Ri.finishMessageBuffer(t,Ri.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof Xe)return new sr(0,Tt.V5,Je.Schema,e);if(e instanceof ar)return new sr(t,Tt.V5,Je.RecordBatch,e);if(e instanceof ei)return new sr(t,Tt.V5,Je.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Je.Schema}isRecordBatch(){return this.headerType===Je.RecordBatch}isDictionaryBatch(){return this.headerType===Je.DictionaryBatch}constructor(e,t,s,a){this._version=t,this._headerType=s,this.body=new Uint8Array(0),a&&(this._createHeader=()=>a),this._bodyLength=wt(e)}}class ar{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,s){this._nodes=t,this._buffers=s,this._length=wt(e)}}class ei{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,s=!1){this._data=e,this._isDelta=s,this._id=wt(t)}}class Gr{constructor(e,t){this.offset=wt(e),this.length=wt(t)}}class Io{constructor(e,t){this.length=wt(e),this.nullCount=wt(t)}}function zE(r,e){return()=>{switch(e){case Je.Schema:return Xe.fromJSON(r);case Je.RecordBatch:return ar.fromJSON(r);case Je.DictionaryBatch:return ei.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Je[e]}, type: ${e} }`)}}function VE(r,e){return()=>{switch(e){case Je.Schema:return Xe.decode(r.header(new br),new Map,r.version());case Je.RecordBatch:return ar.decode(r.header(new Wr),r.version());case Je.DictionaryBatch:return ei.decode(r.header(new Gs),r.version())}throw new Error(`Unrecognized Message type: { name: ${Je[e]}, type: ${e} }`)}}St.encode=ZE;St.decode=JE;St.fromJSON=kE;Xe.encode=XE;Xe.decode=$E;Xe.fromJSON=PE;ar.encode=ex;ar.decode=WE;ar.fromJSON=q0;ei.encode=tx;ei.decode=QE;ei.fromJSON=TE;Io.encode=nx;Io.decode=KE;Gr.encode=rx;Gr.decode=HE;function $E(r,e=new Map,t=Tt.V5){const s=GE(r,e);return new Xe(s,vu(r),e,t)}function WE(r,e=Tt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new ar(r.length(),qE(r),YE(r,e))}function QE(r,e=Tt.V5){return new ei(ar.decode(r.data(),e),r.id(),r.isDelta())}function HE(r){return new Gr(r.offset(),r.length())}function KE(r){return new Io(r.length(),r.nullCount())}function qE(r){const e=[];for(let t,s=-1,a=-1,u=r.nodesLength();++s<u;)(t=r.nodes(s))&&(e[++a]=Io.decode(t));return e}function YE(r,e){const t=[];for(let s,a=-1,u=-1,d=r.buffersLength();++a<d;)(s=r.buffers(a))&&(e<Tt.V4&&(s.bb_pos+=8*(a+1)),t[++u]=Gr.decode(s));return t}function GE(r,e){const t=[];for(let s,a=-1,u=-1,d=r.fieldsLength();++a<d;)(s=r.fields(a))&&(t[++u]=St.decode(s,e));return t}function Zm(r,e){const t=[];for(let s,a=-1,u=-1,d=r.childrenLength();++a<d;)(s=r.children(a))&&(t[++u]=St.decode(s,e));return t}function JE(r,e){let t,s,a,u,d,h;return!e||!(h=r.dictionary())?(a=tg(r,Zm(r,e)),s=new St(r.name(),a,r.nullable(),vu(r))):e.has(t=wt(h.id()))?(u=(u=h.indexType())?eg(u):new Na,d=new go(e.get(t),u,t,h.isOrdered()),s=new St(r.name(),d,r.nullable(),vu(r))):(u=(u=h.indexType())?eg(u):new Na,e.set(t,a=tg(r,Zm(r,e))),d=new go(a,u,t,h.isOrdered()),s=new St(r.name(),d,r.nullable(),vu(r))),s||null}function vu(r){const e=new Map;if(r)for(let t,s,a=-1,u=Math.trunc(r.customMetadataLength());++a<u;)(t=r.customMetadata(a))&&(s=t.key())!=null&&e.set(s,t.value());return e}function eg(r){return new ys(r.isSigned(),r.bitWidth())}function tg(r,e){const t=r.typeType();switch(t){case pt.NONE:return new Ni;case pt.Null:return new Ni;case pt.Binary:return new Mu;case pt.LargeBinary:return new Au;case pt.Utf8:return new Lu;case pt.LargeUtf8:return new Pu;case pt.Bool:return new Tu;case pt.List:return new Vu((e||[])[0]);case pt.Struct_:return new un(e||[])}switch(t){case pt.Int:{const s=r.type(new Fn);return new ys(s.isSigned(),s.bitWidth())}case pt.FloatingPoint:{const s=r.type(new xr);return new Fu(s.precision())}case pt.Decimal:{const s=r.type(new Xs);return new Bu(s.scale(),s.precision(),s.bitWidth())}case pt.Date:{const s=r.type(new du);return new Nu(s.unit())}case pt.Time:{const s=r.type(new zn);return new ku(s.unit(),s.bitWidth())}case pt.Timestamp:{const s=r.type(new Vn);return new Uu(s.unit(),s.timezone())}case pt.Interval:{const s=r.type(new Dr);return new ju(s.unit())}case pt.Duration:{const s=r.type(new fu);return new zu(s.unit())}case pt.Union:{const s=r.type(new _n);return new $u(s.mode(),s.typeIdsArray()||[],e||[])}case pt.FixedSizeBinary:{const s=r.type(new hu);return new Wu(s.byteWidth())}case pt.FixedSizeList:{const s=r.type(new pu);return new Qu(s.listSize(),(e||[])[0])}case pt.Map:{const s=r.type(new yu);return new Hu((e||[])[0],s.keysSorted())}}throw new Error(`Unrecognized type: "${pt[t]}" (${t})`)}function XE(r,e){const t=e.fields.map(u=>St.encode(r,u));br.startFieldsVector(r,t.length);const s=br.createFieldsVector(r,t),a=e.metadata&&e.metadata.size>0?br.createCustomMetadataVector(r,[...e.metadata].map(([u,d])=>{const h=r.createString(`${u}`),p=r.createString(`${d}`);return jt.startKeyValue(r),jt.addKey(r,h),jt.addValue(r,p),jt.endKeyValue(r)})):-1;return br.startSchema(r),br.addFields(r,s),br.addEndianness(r,ix?mo.Little:mo.Big),a!==-1&&br.addCustomMetadata(r,a),br.endSchema(r)}function ZE(r,e){let t=-1,s=-1,a=-1;const u=e.type;let d=e.typeId;ue.isDictionary(u)?(d=u.dictionary.typeId,a=cf.visit(u,r),s=cf.visit(u.dictionary,r)):s=cf.visit(u,r);const h=(u.children||[]).map(g=>St.encode(r,g)),p=kn.createChildrenVector(r,h),m=e.metadata&&e.metadata.size>0?kn.createCustomMetadataVector(r,[...e.metadata].map(([g,v])=>{const b=r.createString(`${g}`),I=r.createString(`${v}`);return jt.startKeyValue(r),jt.addKey(r,b),jt.addValue(r,I),jt.endKeyValue(r)})):-1;return e.name&&(t=r.createString(e.name)),kn.startField(r),kn.addType(r,s),kn.addTypeType(r,d),kn.addChildren(r,p),kn.addNullable(r,!!e.nullable),t!==-1&&kn.addName(r,t),a!==-1&&kn.addDictionary(r,a),m!==-1&&kn.addCustomMetadata(r,m),kn.endField(r)}function ex(r,e){const t=e.nodes||[],s=e.buffers||[];Wr.startNodesVector(r,t.length);for(const d of t.slice().reverse())Io.encode(r,d);const a=r.endVector();Wr.startBuffersVector(r,s.length);for(const d of s.slice().reverse())Gr.encode(r,d);const u=r.endVector();return Wr.startRecordBatch(r),Wr.addLength(r,BigInt(e.length)),Wr.addNodes(r,a),Wr.addBuffers(r,u),Wr.endRecordBatch(r)}function tx(r,e){const t=ar.encode(r,e.data);return Gs.startDictionaryBatch(r),Gs.addId(r,BigInt(e.id)),Gs.addIsDelta(r,e.isDelta),Gs.addData(r,t),Gs.endDictionaryBatch(r)}function nx(r,e){return hv.createFieldNode(r,BigInt(e.length),BigInt(e.nullCount))}function rx(r,e){return fv.createBuffer(r,BigInt(e.offset),BigInt(e.length))}const ix=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),dh=r=>`Expected ${Je[r]} Message in stream, but was null or length 0.`,fh=r=>`Header pointer of flatbuffer-encoded ${Je[r]} Message is null or length 0.`,J0=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,X0=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`;class Z0{constructor(e){this.source=e instanceof Gu?e:new Gu(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?Dt:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(dh(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const t=We(this.source.read(e));if(t.byteLength<e)throw new Error(X0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){const t=Je.Schema,s=this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(fh(t));return a}readMetadataLength(){const e=this.source.read(cc),t=e&&new yo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}}readMetadata(e){const t=this.source.read(e);if(!t)return Dt;if(t.byteLength<e)throw new Error(J0(e,t.byteLength));return{done:!1,value:sr.decode(t)}}}class sx{constructor(e,t){this.source=e instanceof wo?e:iv(e)?new Ju(e,t):new wo(e)}[Symbol.asyncIterator](){return this}next(){return Re(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?Dt:e})}throw(e){return Re(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return Re(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return Re(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(dh(e));return t.value})}readMessageBody(e){return Re(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);const t=We(yield this.source.read(e));if(t.byteLength<e)throw new Error(X0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return Re(this,arguments,void 0,function*(e=!1){const t=Je.Schema,s=yield this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(fh(t));return a})}readMetadataLength(){return Re(this,void 0,void 0,function*(){const e=yield this.source.read(cc),t=e&&new yo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}})}readMetadata(e){return Re(this,void 0,void 0,function*(){const t=yield this.source.read(e);if(!t)return Dt;if(t.byteLength<e)throw new Error(J0(e,t.byteLength));return{done:!1,value:sr.decode(t)}})}}class ox extends Z0{constructor(e){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof Km?e:new Km(e)}next(){const{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:sr.fromJSON(e.schema,Je.Schema)};if(this._dictionaryIndex<e.dictionaries.length){const t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:sr.fromJSON(t,Je.DictionaryBatch)}}if(this._batchIndex<e.batches.length){const t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:sr.fromJSON(t,Je.RecordBatch)}}return this._body=[],Dt}readMessageBody(e){return t(this._body);function t(s){return(s||[]).reduce((a,u)=>[...a,...u.VALIDITY&&[u.VALIDITY]||[],...u.TYPE_ID&&[u.TYPE_ID]||[],...u.OFFSET&&[u.OFFSET]||[],...u.DATA&&[u.DATA]||[],...t(u.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(dh(e));return t.value}readSchema(){const e=Je.Schema,t=this.readMessage(e),s=t==null?void 0:t.header();if(!t||!s)throw new Error(fh(e));return s}}const cc=4,Pf="ARROW1",Xu=new Uint8Array(Pf.length);for(let r=0;r<Pf.length;r+=1)Xu[r]=Pf.codePointAt(r);function hh(r,e=0){for(let t=-1,s=Xu.length;++t<s;)if(Xu[t]!==r[e+t])return!1;return!0}const Qa=Xu.length,ew=Qa+cc,ax=Qa*2+cc;class Xr extends z0{constructor(e){super(),this._impl=e}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){const t=this._impl.open(e);return La(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return jn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return jn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Xr?e:bf(e)?dx(e):iv(e)?px(e):La(e)?Re(this,void 0,void 0,function*(){return yield Xr.from(yield e)}):sv(e)||Yf(e)||av(e)||qf(e)?hx(new wo(e)):fx(new Gu(e))}static readAll(e){return e instanceof Xr?e.isSync()?ng(e):rg(e):bf(e)||ArrayBuffer.isView(e)||ac(e)||rv(e)?ng(e):rg(e)}}class Zu extends Xr{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Or(this,arguments,function*(){yield Le(yield*cu(ao(this[Symbol.iterator]())))})}}class ec extends Xr{constructor(e){super(e),this._impl=e}readAll(){return Re(this,void 0,void 0,function*(){var e,t,s,a;const u=new Array;try{for(var d=!0,h=ao(this),p;p=yield h.next(),e=p.done,!e;d=!0){a=p.value,d=!1;const m=a;u.push(m)}}catch(m){t={error:m}}finally{try{!d&&!e&&(s=h.return)&&(yield s.call(h))}finally{if(t)throw t.error}}return u})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class tw extends Zu{constructor(e){super(e),this._impl=e}}class lx extends ec{constructor(e){super(e),this._impl=e}}class nw{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t){const s=this._loadVectors(e,t,this.schema.fields),a=Be({type:new un(this.schema.fields),length:e.length,children:s});return new ir(this.schema,a)}_loadDictionaryBatch(e,t){const{id:s,isDelta:a}=e,{dictionaries:u,schema:d}=this,h=u.get(s),p=d.dictionaries.get(s),m=this._loadVectors(e.data,t,[p]);return(h&&a?h.concat(new lt(m)):new lt(m)).memoize()}_loadVectors(e,t,s){return new $0(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(s)}}class tc extends nw{constructor(e,t){super(t),this._reader=bf(e)?new ox(this._handle=e):new Z0(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=iw(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Dt}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Dt}next(){if(this.closed)return Dt;let e;const{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new K0(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class nc extends nw{constructor(e,t){super(t),this._reader=new sx(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Re(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return Re(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=iw(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return Re(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Dt})}return(e){return Re(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Dt})}next(){return Re(this,void 0,void 0,function*(){if(this.closed)return Dt;let e;const{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new K0(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return Re(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class rw extends tc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof qm?e:new qm(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(Je.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null}_readDictionaryBatch(e){var t;const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(Je.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}}_readFooter(){const{_handle:e}=this,t=e.size-ew,s=e.readInt32(t),a=e.readAt(t-s,s);return oh.decode(a)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(this._recordBatchIndex);if(s&&this._handle.seek(s.offset))return this._reader.readMessage(e)}return null}}class ux extends nc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){const s=typeof t[0]!="number"?t.shift():void 0,a=t[0]instanceof Map?t.shift():void 0;super(e instanceof Ju?e:new Ju(e,s),a)}isFile(){return!0}isAsync(){return!0}open(e){const t=Object.create(null,{open:{get:()=>super.open}});return Re(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const s of this._footer.dictionaryBatches())s&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return Re(this,void 0,void 0,function*(){var t;if(this.closed)return null;this._footer||(yield this.open());const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(Je.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null})}_readDictionaryBatch(e){return Re(this,void 0,void 0,function*(){var t;const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(Je.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}})}_readFooter(){return Re(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const t=e.size-ew,s=yield e.readInt32(t),a=yield e.readAt(t-s,s);return oh.decode(a)})}_readNextMessageAndValidate(e){return Re(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}}class cx extends tc{constructor(e,t){super(e,t)}_loadVectors(e,t,s){return new bE(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(s)}}function iw(r,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:r.autoDestroy}function*ng(r){const e=Xr.from(r);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function rg(r){return Or(this,arguments,function*(){const t=yield Le(Xr.from(r));try{if(!(yield Le(t.open({autoDestroy:!1}))).closed)do yield yield Le(t);while(!(yield Le(t.reset().open())).closed)}finally{yield Le(t.cancel())}})}function dx(r){return new Zu(new cx(r))}function fx(r){const e=r.peek(Qa+7&-8);return e&&e.byteLength>=4?hh(e)?new tw(new rw(r.read())):new Zu(new tc(r)):new Zu(new tc(function*(){}()))}function hx(r){return Re(this,void 0,void 0,function*(){const e=yield r.peek(Qa+7&-8);return e&&e.byteLength>=4?hh(e)?new tw(new rw(yield r.read())):new ec(new nc(r)):new ec(new nc(function(){return Or(this,arguments,function*(){})}()))})}function px(r){return Re(this,void 0,void 0,function*(){const{size:e}=yield r.stat(),t=new Ju(r,e);return e>=ax&&hh(yield t.readAt(0,Qa+7&-8))?new lx(new ux(t)):new ec(new nc(t))})}function sw(r){const e=Xr.from(r);return La(e)?e.then(t=>sw(t)):e.isAsync()?e.readAll().then(t=>new $n(t)):new $n(e.readAll())}async function Mt(r,e){const{url:t,method:s,params:a,data:u,headers:d,credentials:h,mode:p,cache:m}=r,g=Object.keys({...a}).length>0,v=t.replace(/([^:]\/)\/+/g,"$1"),b=new URL(ow(v),window.location.origin);if(g){const I=Object.entries({...a}).reduce((M,[B,A])=>(A!=null&&(M[B]=String(A)),M),{});b.search=new URLSearchParams(I).toString()}return await new Promise((I,M)=>{fetch(b,{method:s,credentials:h,mode:p,cache:m,headers:yx(d),body:mx(u),signal:e==null?void 0:e.signal}).then(async B=>{if(B.status===204)return{ok:!0};const A=B.headers.get("Content-Type");if(Yt(A))return{ok:!1,message:"Empty response"};if(B.status>=400)try{const q=await B.json();throw q.status=q.status??B.status,q}catch(q){throw{message:B.statusText,...q}}const K=A.includes("text/event-stream"),W=A.includes("application/json"),Y=A.includes("application/vnd.apache.arrow.stream");if(W)return await B.json();if(Y)return await sw(B);if(K){const pe=(await B.text()).trim().replace("data: ","").trim();return JSON.parse(pe)}}).then(I).catch(M)})}function yx(r){return{"Content-Type":"application/json",...r??{}}}function mx(r){try{return JSON.stringify(r)}catch{return""}}function ow(r="/"){let e=`${Oa(window.__BASE_URL__)?"/":window.__BASE_URL__}/${r}`;for(;e.includes("//");)e=e.replaceAll("//","/");return e}const lu={python:"python",sql:"sql",seed:"seed",external:"external",source:"source"},_r={editor:"editor",files:"files","data-catalog":"data-catalog",plans:"plans",tests:"tests",audits:"audits",errors:"errors",data:"data",lineage:"lineage"},RD={NUMBER_1:1,NUMBER_2:2,NUMBER_3:3},FD={init:"init",success:"success",fail:"fail"},gx=(r,e)=>Mt({url:"/api/commands/apply",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),vx=(r,e)=>Mt({url:"/api/commands/evaluate",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),wx=(r,e)=>Mt({url:"/api/commands/fetchdf",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),Sx=(r,e)=>Mt({url:"/api/commands/render",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),_x=r=>Mt({url:"/api/files",method:"GET"},r),bx=(r,e)=>Mt({url:`/api/files/${r}`,method:"GET"},e),Ix=(r,e,t)=>Mt({url:`/api/files/${r}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),MD=(r,e)=>Mt({url:`/api/files/${r}`,method:"DELETE"},e),AD=(r,e,t)=>Mt({url:`/api/directories/${r}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),LD=(r,e)=>Mt({url:`/api/directories/${r}`,method:"DELETE"},e),Ex=(r,e)=>Mt({url:"/api/plan",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),xx=r=>Mt({url:"/api/plan/cancel",method:"POST"},r),Dx=r=>Mt({url:"/api/environments",method:"GET"},r),PD=(r,e)=>Mt({url:`/api/environments/${r}`,method:"DELETE"},e),Ox=(r,e,t,s)=>Mt({url:`/api/lineage/${r}/${e}`,method:"GET",params:t},s),Cx=(r,e)=>Mt({url:`/api/lineage/${r}`,method:"GET"},e),Rx=r=>Mt({url:"/api/models",method:"GET"},r),Fx=(r,e)=>Mt({url:`/api/models/${r}`,method:"GET"},e),Mx=r=>Mt({url:"/api/meta",method:"GET"},r),Ax=r=>Mt({url:"/api/modules",method:"GET"},r),Lx=(r,e)=>Mt({url:"/api/table_diff",method:"GET",params:r},e),Vr=P.lazy(()=>cn(()=>import("./Root-C33PD4Lp.js"),[])),Px=P.lazy(()=>cn(()=>import("./Editor-CScUJsI9.js"),[])),Tx=P.lazy(()=>cn(()=>import("./Plan-DWtNBwNf.js"),[])),Bx=P.lazy(()=>cn(()=>import("./Content-UFxrHkDI.js"),[])),Nx=P.lazy(()=>cn(()=>import("./DataCatalog-3BLO9jd2.js"),[])),kx=P.lazy(()=>cn(()=>import("./Tests-RpyW36kr.js"),[])),Ux=P.lazy(()=>cn(()=>import("./Audits-l42KyvAS.js"),[])),jx=P.lazy(()=>cn(()=>import("./Data-CLMGP4j8.js"),[])),df=P.lazy(()=>cn(()=>import("./Models-C0kma0wJ.js"),[])),zx=P.lazy(()=>cn(()=>import("./Lineage-DKjxAj6r.js"),[])),Vx=P.lazy(()=>cn(()=>import("./Errors-Dg9IT6GW.js"),[])),$x=P.lazy(()=>cn(()=>import("./Content-oIWFleXF.js"),[])),tr=P.lazy(()=>cn(()=>import("./Welcome-Bp53remK.js"),[])),ot={Home:"/",Editor:"/editor",DataCatalog:"/data-catalog",DataCatalogModels:"/data-catalog/models",Data:"/data",Lineage:"/lineage",LineageModels:"/lineage/models",Tests:"/tests",Audits:"/audits",Errors:"/errors",Plan:"/plan",NotFound:"/not-found"},ig={plan:[_r.plans]};function Wx(r){const e=[{path:"*",element:ic(r.list)?N.jsx(vn,{link:ot.Home,message:"Back To Main"}):N.jsx(vn,{headline:"Empty"})},{path:ot.Home,element:N.jsx(Vr,{})},...[{path:ot.Editor,element:N.jsx(Vr,{content:N.jsx(Px,{})})},{path:ot.DataCatalog,element:N.jsx(Vr,{content:N.jsx(df,{route:ot.DataCatalog})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.DataCatalog,message:"Back To Data Catalog"})},{path:"models",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.DataCatalog,message:"Back To Data Catalog"})},{path:":modelName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(Nx,{})})}]}]},{path:ot.Data,element:N.jsx(Vr,{content:N.jsx(df,{route:ot.Data})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Data,message:"Back To Data"})},{path:"models",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Data,message:"Back To Data"})},{path:":modelName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(jx,{})})}]}]},{path:ot.Lineage,element:N.jsx(Vr,{content:N.jsx(df,{route:ot.Lineage})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Lineage,message:"Back To Lineage"})},{path:"models",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Lineage,message:"Back To Lineage"})},{path:":modelName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(zx,{})})}]}]},{path:ot.Errors,element:N.jsx(Vr,{content:N.jsx(Vx,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to errors report",tagline:"Here you can see all the errors that occurred."})},{path:"*",element:N.jsx(vn,{link:ot.Errors,message:"Back To Errors"})},{path:":id",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx($x,{})})}]},{path:ot.Plan,element:N.jsx(Vr,{content:N.jsx(Tx,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:N.jsx(vn,{link:ot.Plan,message:"Back To Plan"})},{path:"environments",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:N.jsx(vn,{link:ot.Plan,message:"Back To Plan"})},{path:":environmentName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(Bx,{})})}]}]},{path:ot.Tests,element:N.jsx(Vr,{content:N.jsx(kx,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to tests report",tagline:"Here you can run tests and see the results."})},{path:"*",element:N.jsx(vn,{link:ot.Tests,message:"Back To Tests"})}]},{path:ot.Audits,element:N.jsx(Vr,{content:N.jsx(Ux,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to audits report",tagline:"Here you can run audits and see the results."})},{path:"*",element:N.jsx(vn,{link:ot.Audits,message:"Back To Audits"})}]}].filter(t=>{var a;const s=t.path.replace("/","");return Yt(ig[s])?r.list.includes(s):(a=ig[s])==null?void 0:a.some(u=>r.list.includes(u))})].filter(Boolean);return vb(e,{basename:ow()})}const zt={API:"api",General:"general",RunPlan:"run-plan",ApplyPlan:"apply-plan",CancelPlan:"cancel-plan",Environments:"environments",Models:"models",Fetchdf:"fetchdf",EvaluateModel:"evaluate-model",RenderQuery:"render-query",ColumnLineage:"column-lineage",ModelLineage:"model-lineage",Meta:"meta",Modules:"modules",FileExplorer:"file-explorer",Table:"table",TableDiff:"table-diff",SaveFile:"save-file"},aw=P.createContext({errors:new Set,addError:()=>({removeError:()=>{},error:{}}),removeError:()=>{},clearErrors:()=>{}});function Qx({children:r}){const[e,t]=P.useState(new Set);function s(d,h){const p={id:ff(),key:d,status:h.status,timestamp:h.timestamp??Date.now(),message:h.message,description:h.description,type:h.type,origin:h.origin,trigger:h.trigger,stack:h.stack,traceback:h.traceback};return t(m=>new Set(m.add(p))),{removeError:()=>a(p),error:p}}function a(d){t(h=>(h.forEach(p=>{(p===d||p.key===d)&&h.delete(p)}),new Set(h)))}function u(){t(new Set)}return N.jsx(aw.Provider,{value:{errors:e,addError:s,removeError:a,clearErrors:u},children:r})}function ph(){return P.useContext(aw)}const lw=60*1e3,Hx=5*lw,dc=10*lw;function Kx(r){return nn({queryKey:["/api/modules"],queryFn:Ax,enabled:!0},{...r,errorKey:zt.Modules,trigger:"API -> useApiModules"})}function TD(r){return nn({queryKey:["/api/meta"],queryFn:Mx,enabled:!0},{...r,errorKey:zt.Meta,trigger:"API -> useApiMeta"})}function BD(r){return nn({queryKey:["/api/models"],queryFn:Rx},{...r,errorKey:zt.Models,trigger:"API -> useApiModels"})}function ND(r,e){return nn({queryKey:["/api/models",r],queryFn:async({signal:t})=>await Fx(r,{signal:t})},{...e,errorKey:zt.Models,trigger:"API -> useApiModel"})}function kD(r){return nn({queryKey:["/api/files"],queryFn:_x},{...r,errorKey:zt.FileExplorer,trigger:"API -> useApiFiles"})}function UD(r,e){return nn({queryKey:["/api/files",r],queryFn:async({signal:t})=>await bx(r,{signal:t})},{...e,errorKey:zt.FileExplorer,trigger:"API -> useApiFileByPath"})}function jD(r,e){return nn({queryKey:["/api/lineage",r],queryFn:async({signal:t})=>await Cx(r,{signal:t})},{...e,errorKey:zt.ModelLineage,trigger:"API -> useApiModelLineage"})}function zD(r,e,t,s){return nn({queryKey:["/api/lineage",r,e],queryFn:async({signal:a})=>await Ox(r,e,s,{signal:a})},{...t,errorKey:zt.ColumnLineage,trigger:"API -> useApiColumnLineage"})}function VD(r){return nn({queryKey:["/api/environments"],queryFn:Dx},{...r,errorKey:zt.Environments,trigger:"API -> useApiEnvironments"})}function $D(r){return nn({queryKey:["/api/commands/apply"],queryFn:xx},{...r,errorKey:zt.CancelPlan,trigger:"API -> useApiCancelPlan"})}function WD(r,e,t){return nn({queryKey:["/api/plan",r],async queryFn({signal:s}){return await Ex({environment:r,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:zt.RunPlan,trigger:"API -> useApiPlanRun"})}function QD(r,e,t){return nn({queryKey:["/api/commands/apply",r],async queryFn({signal:s}){return await gx({environment:r,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:zt.ApplyPlan,trigger:"API -> useApiPlanApply"})}function HD(r,e){return nn({queryKey:["/api/commands/fetchd"],queryFn:async({signal:t})=>await wx(r,{signal:t})},{...e,errorKey:zt.Fetchdf,trigger:"API -> useApiFetchdf",delay:dc})}function KD(r,e){return nn({queryKey:["/api/commands/render"],queryFn:async({signal:t})=>await Sx(r,{signal:t})},{...e,errorKey:zt.RenderQuery,trigger:"API -> useApiRender",delay:dc})}function qD(r,e){return nn({queryKey:["/api/commands/table_diff"],queryFn:async({signal:t})=>await Lx(r,{signal:t})},{...e,errorKey:zt.TableDiff,trigger:"API -> useApiTableDiff",delay:dc})}function YD(r,e){return nn({queryKey:["/api/commands/evaluate"],queryFn:async({signal:t})=>await vx(r,{signal:t})},{...e,errorKey:zt.EvaluateModel,trigger:"API -> useApiEvaluate",delay:dc})}function GD(r){const{addError:e}=ph();return K_({mutationFn:async({path:t,body:s})=>await Ix(t,s),onError(t){e(zt.SaveFile,t)},async onMutate({path:t}){await r.cancelQueries({queryKey:["/api/files",t]})}})}function nn(r,{delay:e=Hx,removeTimeoutErrorAfter:t,errorKey:s=zt.API,trigger:a}){const u=r.queryKey.join(" -> "),d=Uf(),{addError:h}=ph(),[p,m]=P.useState(!1);let g,v=function(){console.log(`[REQUEST TIMEOUT] ${u} id: ${String(g)} timed out after ${e}ms`);const{removeError:q}=h(s,{message:"Request timed out",description:`Request ${u} with timeoutId: ${String(g)} timed out after ${e}ms`,timestamp:Date.now(),origin:"useQueryTimeout",trigger:a});m(!0),M(),ln(t)&&setTimeout(()=>q(),t)};function b(){console.log(`[CLEAR TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`),clearTimeout(g),g=void 0,v=void 0}function I(){g=setTimeout(()=>{v==null||v()},e),console.log(`[START TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`)}function M(){b(),d.cancelQueries({queryKey:r.queryKey}),console.log(`[REQUEST CANCELED] ${u} at ${Date.now()}`)}function B(Y){b(),Ca(Y)||Y.name==="AbortError"?console.log(`[REQUEST ABORTED] ${u} aborted by React Query at ${Date.now()}`):(console.log(`[REQUEST FAILED] ${u} failed at ${Date.now()}`),h(s,Y))}function A(){b(),console.log(`[REQUEST COMPLETED] ${u} completed at ${Date.now()}`)}async function K(...Y){return I(),r.queryFn(...Y)}const W=H_({cacheTime:0,enabled:!1,queryKey:r.queryKey,queryFn:K,meta:{...r.meta,onError:B,onSuccess:A}});return{...W,refetch:async(...Y)=>new Promise(q=>{W.refetch(...Y,{throwOnError:!0}).then(q).catch(pe=>pe)}),cancel:M,isTimeout:p}}class uw{constructor(e){bt(this,"_initial");bt(this,"isModel",!0);Yt(e)?this._initial=Object.assign({id:ff()}):this._initial=ln(e==null?void 0:e.id)?e:new Proxy(Object.assign(e??{},{id:ff()}),{set(){throw new Error("Cannot change initial file")}})}get initial(){return this._initial}get id(){return this.initial.id}}class sg extends uw{constructor(t=[]){super();bt(this,"modules",new Set);this.modules=new Set(t)}get list(){return Array.from(this.modules)}get isEmpty(){return this.modules.size===0}get hasErrors(){return this.modules.has(_r.errors)}get hasEditor(){return this.modules.has(_r.editor)}get hasFiles(){return this.modules.has(_r.files)}get hasProjectEditor(){return this.hasEditor&&this.hasFiles}get hasOnlyProjectEditor(){return this.modules.size===2&&this.hasProjectEditor}get hasOnlyDataCatalog(){return this.modules.size===1&&this.hasDataCatalog}get hasProjectEditorAndModule(){return this.modules.size===3&&this.hasProjectEditor&&Bi(this.hasErrors)}get hasDataCatalog(){return this.modules.has(_r["data-catalog"])}get hasPlans(){return this.modules.has(_r.plans)}get hasOnlyPlans(){return this.modules.size===1&&this.hasPlans}get hasOnlyPlansAndErrors(){return this.modules.size===2&&this.hasPlans&&this.hasErrors}get hasTests(){return this.modules.has(_r.tests)}get hasAudits(){return this.modules.has(_r.audits)}get hasData(){return this.modules.has(_r.data)}get hasLineage(){return this.modules.has(_r.lineage)}get hasModuleAndErrors(){return this.hasErrors&&(this.modules.size===2||this.modules.size===3&&this.hasProjectEditor)}get hasSingleModule(){return this.modules.size===1}get showModuleNavigation(){return this.isEmpty||this.hasSingleModule||this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule?!0:Bi(this.isEmpty)}get showHistoryNavigation(){return this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule||this.hasDataCatalog?!0:Bi(this.isEmpty)}get showNavigation(){return this.hasErrors||this.hasPlans||this.showHistoryNavigation}update(t=[]){this.modules=new Set(t)}defaultNavigationRoute(){return this.hasEditor?ot.Editor:this.hasPlans?ot.Plan:this.hasDataCatalog?ot.DataCatalog:ot.NotFound}}class qx extends uw{constructor(t){super(t!=null&&t.isModel?t.initial:{...t,dialect:(t==null?void 0:t.dialect)??"Default",columns:(t==null?void 0:t.columns)??[],details:(t==null?void 0:t.details)??{}});bt(this,"_details",{});bt(this,"_detailsIndex","");bt(this,"name");bt(this,"fqn");bt(this,"path");bt(this,"full_path");bt(this,"dialect");bt(this,"type");bt(this,"columns");bt(this,"default_catalog");bt(this,"description");bt(this,"sql");bt(this,"definition");bt(this,"hash");this.name=encodeURI(this.initial.name),this.fqn=encodeURI(this.initial.fqn),this.default_catalog=this.initial.default_catalog,this.path=this.initial.path,this.full_path=this.initial.full_path,this.dialect=this.initial.dialect,this.description=this.initial.description,this.sql=this.initial.sql,this.definition=this.initial.definition,this.columns=this.initial.columns??[],this.type=this.initial.type,this.hash=this.initial.hash,this.details=this.initial.details??{}}get defaultCatalog(){return this.default_catalog}get details(){return this._details}set details(t){const s=[];for(const a of Object.values(t))ic(a)?a.forEach(u=>{s.push(...Object.values(u))}):s.push(a);this._details=t,this._detailsIndex=s.join(" ")}get index(){return[this.displayName,this.path,this.type,...this.columns.map(t=>Object.values(t)).flat(),this._detailsIndex,this.dialect,this.description].filter(Boolean).join(" ").toLowerCase()}get isModelPython(){return this.type===lu.python}get isModelSQL(){return this.type===lu.sql}get isModelSeed(){return this.type===lu.seed}get isModelExternal(){return this.type===lu.external}get displayName(){return decodeURI(this.name)}update(t={}){for(const[s,a]of Object.entries(t))s==="columns"?this.columns=a:s==="details"?this.details=a:s==="name"?this.name=encodeURI(a):s==="fqn"?this.fqn=encodeURI(a):s==="type"?this.type=a:s==="default_catalog"?this.default_catalog=a:s==="description"?this.description=a:s in this&&(this[s]=a)}}const og=r=>{let e;const t=new Set,s=(m,g)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const b=e;e=g??(typeof v!="object"||v===null)?v:Object.assign({},e,v),t.forEach(I=>I(e,b))}},a=()=>e,h={setState:s,getState:a,getInitialState:()=>p,subscribe:m=>(t.add(m),()=>t.delete(m))},p=e=r(s,a,h);return h},Yx=r=>r?og(r):og,Gx=r=>r;function Jx(r,e=Gx){const t=hs.useSyncExternalStore(r.subscribe,()=>e(r.getState()),()=>e(r.getInitialState()));return hs.useDebugValue(t),t}const ag=r=>{const e=Yx(r),t=s=>Jx(e,s);return Object.assign(t,e),t},Xx=r=>r?ag(r):ag,ma={Empty:"",Prod:"prod"},Yr={Local:"local",Remote:"remote"},[lg,Zx]=wg("profile");class en{constructor(e,t,s=ma.Prod,a=!1,u=!1){bt(this,"_initial");bt(this,"_type");bt(this,"_createFrom");bt(this,"_isPinned",!1);bt(this,"_isDefault",!1);bt(this,"isModel",!0);this._initial=e,this._type=t??Yr.Local,this._createFrom=this._isDefault?ma.Empty:s,this._isPinned=a,this._isDefault=u}get id(){return this._initial.plan_id??""}get name(){return this._initial.name??ma.Empty}get type(){return this._type}get createFrom(){return this._createFrom}get isProd(){return this.name===ma.Prod}get isDefault(){return this._isDefault}set isDefault(e){this._isDefault=e}get isPinned(){return this._isPinned||this.isDefault||this.isProd}set isPinned(e){this._isPinned=e}get isInitial(){var e;return Oa((e=this._initial)==null?void 0:e.plan_id)}get isLocal(){return this._type===Yr.Local}get isRemote(){return this._type===Yr.Remote}get isSyncronized(){return this.isRemote&&Bi(this.isInitial)}get isInitialProd(){return this.isInitial&&this.isProd}setType(e){this._type=e}setCreatedFrom(e){this._createFrom=e}update(e){this._initial=e}static save({environment:e,environments:t}){const s={};ln(e)&&(s.environment={name:e.name,plan_id:e.id,type:e.type,createFrom:e.createFrom,isPinned:e.isPinned,isDefault:e.isDefault}),ln(t)&&(s.environments=en.getOnlyLocal(t).map(a=>({name:a.name,plan_id:a.id,type:a.type,createFrom:a.createFrom,isPinned:a.isPinned,isDefault:a.isDefault}))),Zx(s)}static getOnlyLocal(e=[]){return e.filter(t=>Bi(Oa(t.name))&&t.isLocal)}static getOnlyRemote(e=[]){return e.filter(t=>Bi(Oa(t.name))&&t.isRemote)}static getEnvironment(){const{environment:e}=lg()??{};if(Yt(e))return;const{name:t,plan_id:s,type:a,createFrom:u,isPinned:d,isDefault:h}=e;return new en({name:t,plan_id:s},a,u,d,h)}static getEnvironments(){const e=lg(),t=new Map;ln(e)&&ln(e.environment)&&t.set(e.environment.name,e.environment),ln(e)&&ln(e.environments)&&e.environments.forEach(a=>t.set(a.name,a));const s=[];return Array.from(t.entries()).forEach(([a,u])=>{s.push(new en({name:a,plan_id:u.plan_id},u.type,u.createFrom,u.isPinned,u.isDefault))}),gg(s)&&s.push(new en({name:ma.Prod},Yr.Local)),s}static sort(e){return e.sort(t=>t.isRemote?-1:1),e}}const ug="prod",cw=new Set(en.getEnvironments()),cg=en.getEnvironment()??cw.values().next().value,dg=Xx((r,e)=>({version:void 0,modules:new sg,splitPaneSizes:[20,80],showConfirmation:!1,confirmations:[],environment:cg,environments:cw,initialStartDate:void 0,initialEndDate:void 0,models:new Map,lastSelectedModel:void 0,setLastSelectedModel(t){r(()=>({lastSelectedModel:t}))},setModules(t){r(()=>({modules:new sg(t.list)}))},isModel(t){return e().models.has(t)},setSplitPaneSizes(t){r(()=>({splitPaneSizes:t}))},setVersion(t){r(()=>({version:t}))},setShowConfirmation(t){r(()=>({showConfirmation:t}))},addConfirmation(t){r(s=>(s.confirmations.push(t),{confirmations:Array.from(s.confirmations)}))},removeConfirmation(){const t=e();t.confirmations.shift(),r(()=>({confirmations:Array.from(t.confirmations)}))},setModels(t=[]){const s=e();r(()=>({models:t.reduce((a,u)=>{const d=new qx(u);let h=s.models.get(d.path)??s.models.get(d.name)??s.models.get(d.fqn);return Yt(h)?h=d:h.update(u),a.set(h.name,h),a.set(h.fqn,h),a.set(h.path,h),a},new Map)}))},getNextEnvironment(){return e().environments.values().next().value??cg},isExistingEnvironment(t){const s=e();if(t.isModel)return s.environments.has(t);let a=!1;return s.environments.forEach(u=>{u.name===t&&(a=!0)}),a},setEnvironment(t){r(()=>(en.save({environment:t}),{environment:t}))},addLocalEnvironment(t,s=ug){r(a=>{if(Oa(t))return a;const u=new en({name:t},Yr.Local,s);return a.environments.add(u),a.setEnvironment(u),en.save({environments:Array.from(a.environments)}),{environments:new Set(a.environments)}})},removeLocalEnvironment(t){r(s=>(s.environments.delete(t),en.save({environments:Array.from(s.environments)}),{environments:new Set(s.environments)}))},addRemoteEnvironments(t=[],s,a=[]){r(u=>{const d=Array.from(u.environments);t.forEach(I=>{let M=d.find(({name:B})=>I.name===B);Yt(M)?(M=new en(I,Yr.Remote),d.push(M)):(M.update(I),M.setType(Yr.Remote)),u.environment.name===I.name&&u.environment.update(I),M.isInitial&&M.isDefault&&u.setEnvironment(M)}),a.forEach(I=>{const M=d.find(({name:B})=>I===B);Yt(M)?d.push(new en({name:I},Yr.Local,void 0,!0)):M.isPinned=!0});const h=en.getEnvironment();let p,m,g;d.forEach(I=>{switch(I.name){case ug:p=I;break;case(h==null?void 0:h.name):m=I;break;case s:I.isDefault=!0,g=I}});const v=u.environment??m??g,b=ZS(p==null?void 0:p.isInitial)?p:v;return en.save({environments:d,environment:b}),en.sort(d),{environment:b,environments:new Set(d)}})},hasRemoteEnvironments(){const t=e();return Array.from(t.environments).some(({type:s})=>s===Yr.Remote)}}));function fg({children:r,className:e}){return N.jsx("div",{className:Cr("flex justify-center items-center w-full h-full",e),children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:r})]})})}const dw=!!(window.__IS_HEADLESS__??!1),hg=dw?void 0:P.lazy(()=>cn(()=>import("./Header-BIhjjExl.js"),[])),pg=dw?void 0:P.lazy(()=>cn(()=>import("./Footer-B_18qn6L.js"),[]));function eD(){const{addError:r}=ph(),e=dg(h=>h.modules),t=dg(h=>h.setModules),{refetch:s,cancel:a,isFetching:u}=Kx();P.useEffect(()=>(s().then(({data:h})=>{e.update(h),t(e)}).catch(h=>r(zt.Modules,h)),()=>{a()}),[]);const d=Wx(e);return N.jsxs(N.Fragment,{children:[ln(hg)&&N.jsxs(N.Fragment,{children:[N.jsx(hg,{}),N.jsx(Om,{})]}),N.jsx("main",{className:"h-full overflow-hidden relative",children:u?N.jsx(fg,{className:"absolute w-full h-full bg-theme z-10",children:"Building Modules..."}):N.jsx(P.Suspense,{fallback:N.jsx(fg,{children:"Loading Page..."}),children:ic(e.list)?N.jsx(Db,{router:d}):N.jsx(vn,{description:"No Modules Found"})})}),ln(pg)&&N.jsxs(N.Fragment,{children:[N.jsx(Om,{}),N.jsx(pg,{})]})]})}const tD=new I_({queryCache:new Rg({onError(r,e){e.meta.onError(r)},onSuccess(r,e){e.meta.onSuccess()}}),defaultOptions:{queries:{networkMode:"always",refetchOnWindowFocus:!1,retry:!1,staleTime:1/0}}});u_.createRoot(nD()).render(N.jsx(hs.StrictMode,{children:N.jsx(L_,{client:tD,children:N.jsx(r_,{children:N.jsx(Qx,{children:N.jsx(eD,{})})})})}));function nD(){const r="root";let e=document.getElementById(r);if(ln(e))return e;const t=document.body,s=t.children[0];return e=document.createElement("div"),e.id=r,e.className="h-full w-full flex flex-col justify-start",s instanceof HTMLElement?t.insertBefore(e,s):t.appendChild(e),e}export{PD as $,kD as A,xD as B,FD as C,sD as D,qs as E,gg as F,zt as G,tv as H,Om as I,Oa as J,RD as K,Ys as L,en as M,_D as N,SD as O,hD as P,dD as Q,hs as R,us as S,zb as T,wD as U,vn as V,gD as W,aD as X,nv as Y,ED as Z,cn as _,dg as a,uw as a0,Xx as a1,Tf as a2,mg as a3,ND as a4,cD as a5,KD as a6,YD as a7,fg as a8,mD as a9,wg as aA,ff as aB,ID as aC,jD as aD,oD as aa,e_ as ab,Mg as ac,C_ as ad,DD as ae,Cm as af,OD as ag,AD as ah,Ix as ai,MD as aj,LD as ak,qD as al,HD as am,wx as an,iD as ao,rc as ap,M_ as aq,yD as ar,bD as as,Uf as at,UD as au,GD as av,pD as aw,lD as ax,zD as ay,lu as az,Bi as b,Cr as c,ph as d,ot as e,XS as f,ZS as g,ic as h,ln as i,N as j,VD as k,WD as l,Ft as m,at as n,uD as o,QD as p,$D as q,P as r,fD as s,q1 as t,vD as u,BD as v,Yt as w,ow as x,za as y,TD as z};
82
+ ]`}concat(...e){const t=this.schema,s=this.data.concat(e.flatMap(({data:a})=>a));return new $n(t,s.map(a=>new ir(t,a)))}slice(e,t){const s=this.schema;[e,t]=F0({length:this.numRows},e,t);const a=P0(this.data,this._offsets,e,t);return new $n(s,a.map(u=>new ir(s,u)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){const t=this.data.map(s=>s.children[e]);if(t.length===0){const{type:s}=this.schema.fields[e],a=Be({type:s,length:0,nullCount:0});t.push(a._changeLengthAndBackfillNullBitmap(this.numRows))}return new lt(t)}return null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=[...this.batches];if(e>-1&&e<this.numCols){t||(t=new lt([Be({type:new Ni,length:this.numRows})]));const u=s.fields.slice(),d=u[e].clone({type:t.type}),h=this.schema.fields.map((p,m)=>this.getChildAt(m));[u[e],h[e]]=[d,t],[s,a]=uf(s,h)}return new $n(s,a)}select(e){const t=this.schema.fields.reduce((s,a,u)=>s.set(a.name,u),new Map);return this.selectAt(e.map(s=>t.get(s)).filter(s=>s>-1))}selectAt(e){const t=this.schema.selectAt(e),s=this.batches.map(a=>a.selectAt(e));return new $n(t,s)}assign(e){const t=this.schema.fields,[s,a]=e.schema.fields.reduce((h,p,m)=>{const[g,v]=h,b=t.findIndex(I=>I.name===p.name);return~b?v[b]=m:g.push(m),h},[[],[]]),u=this.schema.assign(e.schema),d=[...t.map((h,p)=>[p,a[p]]).map(([h,p])=>p===void 0?this.getChildAt(h):e.getChildAt(p)),...s.map(h=>e.getChildAt(h))].filter(Boolean);return new $n(...uf(u,d))}}W0=Symbol.toStringTag;$n[W0]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Ku(ih),r.get=Ku(In.getVisitFn(x.Struct)),r.set=T0(Qn.getVisitFn(x.Struct)),r.indexOf=B0(qu.getVisitFn(x.Struct)),"Table"))($n.prototype);var Q0;let ir=class Da{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof Xe))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Be({nullCount:0,type:new un(this.schema.fields),children:this.schema.fields.map(t=>Be({type:t.type,nullCount:0}))})]=e,!(this.data instanceof yt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ym(this.schema,this.data.children);break}case 1:{const[t]=e,{fields:s,children:a,length:u}=Object.keys(t).reduce((p,m,g)=>(p.children[g]=t[m],p.length=Math.max(p.length,t[m].length),p.fields[g]=St.new({name:m,type:t[m].type,nullable:!0}),p),{length:0,fields:new Array,children:new Array}),d=new Xe(s),h=Be({type:new un(s),length:u,children:a,nullCount:0});[this.schema,this.data]=Ym(d,h.children,u);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=H0(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return In.visit(this.data,e)}at(e){return this.get(th(e,this.numRows))}set(e,t){return Qn.visit(this.data,e,t)}indexOf(e,t){return qu.visit(this.data,e,t)}[Symbol.iterator](){return sh.visit(new lt([this.data]))}toArray(){return[...this]}concat(...e){return new $n(this.schema,[this,...e])}slice(e,t){const[s]=new lt([this.data]).slice(e,t).data;return new Da(this.schema,s)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)===null||t===void 0?void 0:t.findIndex(s=>s.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new lt([this.data.children[e]]):null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=this.data;if(e>-1&&e<this.numCols){t||(t=new lt([Be({type:new Ni,length:this.numRows})]));const u=s.fields.slice(),d=a.children.slice(),h=u[e].clone({type:t.type});[u[e],d[e]]=[h,t.data[0]],s=new Xe(u,new Map(this.schema.metadata)),a=Be({type:new un(u),children:d})}return new Da(s,a)}select(e){const t=this.schema.select(e),s=new un(t.fields),a=[];for(const u of e){const d=this.schema.fields.findIndex(h=>h.name===u);~d&&(a[d]=this.data.children[d])}return new Da(t,Be({type:s,length:this.numRows,children:a}))}selectAt(e){const t=this.schema.selectAt(e),s=e.map(u=>this.data.children[u]).filter(Boolean),a=Be({type:new un(t.fields),length:this.numRows,children:s});return new Da(t,a)}};Q0=Symbol.toStringTag;ir[Q0]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ir.prototype);function Ym(r,e,t=e.reduce((s,a)=>Math.max(s,a.length),0)){var s;const a=[...r.fields],u=[...e],d=(t+63&-64)>>3;for(const[h,p]of r.fields.entries()){const m=e[h];(!m||m.length!==t)&&(a[h]=p.clone({nullable:!0}),u[h]=(s=m==null?void 0:m._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:Be({type:p.type,length:t,nullCount:t,nullBitmap:new Uint8Array(d)}))}return[r.assign(a),Be({type:new un(a),length:t,children:u})]}function H0(r,e,t=new Map){var s,a;if(((s=r==null?void 0:r.length)!==null&&s!==void 0?s:0)>0&&(r==null?void 0:r.length)===(e==null?void 0:e.length))for(let u=-1,d=r.length;++u<d;){const{type:h}=r[u],p=e[u];for(const m of[p,...((a=p==null?void 0:p.dictionary)===null||a===void 0?void 0:a.data)||[]])H0(h.children,m==null?void 0:m.children,t);if(ue.isDictionary(h)){const{id:m}=h;if(!t.has(m))p!=null&&p.dictionary&&t.set(m,p.dictionary);else if(t.get(m)!==p.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return t}class K0 extends ir{constructor(e){const t=e.fields.map(a=>Be({type:a.type})),s=Be({type:new un(e.fields),nullCount:0,children:t});super(e,s)}}let Ri=class Sr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(e,t){return(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,t){return e.setPosition(e.position()+Ze),(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Tt.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Je.NONE}header(e){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,12);return s?(t||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,Tt.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,Je.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt("0"))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(e,t,s,a,u,d){return Sr.startMessage(e),Sr.addVersion(e,t),Sr.addHeaderType(e,s),Sr.addHeader(e,a),Sr.addBodyLength(e,u),Sr.addCustomMetadata(e,d),Sr.endMessage(e)}};class LE extends ke{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return Um.startNull(t),Um.endNull(t)}visitInt(e,t){return Fn.startInt(t),Fn.addBitWidth(t,e.bitWidth),Fn.addIsSigned(t,e.isSigned),Fn.endInt(t)}visitFloat(e,t){return xr.startFloatingPoint(t),xr.addPrecision(t,e.precision),xr.endFloatingPoint(t)}visitBinary(e,t){return Pm.startBinary(t),Pm.endBinary(t)}visitLargeBinary(e,t){return Bm.startLargeBinary(t),Bm.endLargeBinary(t)}visitBool(e,t){return Tm.startBool(t),Tm.endBool(t)}visitUtf8(e,t){return jm.startUtf8(t),jm.endUtf8(t)}visitLargeUtf8(e,t){return Nm.startLargeUtf8(t),Nm.endLargeUtf8(t)}visitDecimal(e,t){return Xs.startDecimal(t),Xs.addScale(t,e.scale),Xs.addPrecision(t,e.precision),Xs.addBitWidth(t,e.bitWidth),Xs.endDecimal(t)}visitDate(e,t){return du.startDate(t),du.addUnit(t,e.unit),du.endDate(t)}visitTime(e,t){return zn.startTime(t),zn.addUnit(t,e.unit),zn.addBitWidth(t,e.bitWidth),zn.endTime(t)}visitTimestamp(e,t){const s=e.timezone&&t.createString(e.timezone)||void 0;return Vn.startTimestamp(t),Vn.addUnit(t,e.unit),s!==void 0&&Vn.addTimezone(t,s),Vn.endTimestamp(t)}visitInterval(e,t){return Dr.startInterval(t),Dr.addUnit(t,e.unit),Dr.endInterval(t)}visitDuration(e,t){return fu.startDuration(t),fu.addUnit(t,e.unit),fu.endDuration(t)}visitList(e,t){return km.startList(t),km.endList(t)}visitStruct(e,t){return fs.startStruct_(t),fs.endStruct_(t)}visitUnion(e,t){_n.startTypeIdsVector(t,e.typeIds.length);const s=_n.createTypeIdsVector(t,e.typeIds);return _n.startUnion(t),_n.addMode(t,e.mode),_n.addTypeIds(t,s),_n.endUnion(t)}visitDictionary(e,t){const s=this.visit(e.indices,t);return qr.startDictionaryEncoding(t),qr.addId(t,BigInt(e.id)),qr.addIsOrdered(t,e.isOrdered),s!==void 0&&qr.addIndexType(t,s),qr.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return hu.startFixedSizeBinary(t),hu.addByteWidth(t,e.byteWidth),hu.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return pu.startFixedSizeList(t),pu.addListSize(t,e.listSize),pu.endFixedSizeList(t)}visitMap(e,t){return yu.startMap(t),yu.addKeysSorted(t,e.keysSorted),yu.endMap(t)}}const cf=new LE;function PE(r,e=new Map){return new Xe(BE(r,e),gu(r.metadata),e)}function q0(r){return new ar(r.count,Y0(r.columns),G0(r.columns))}function TE(r){return new ei(q0(r.data),r.id,r.isDelta)}function BE(r,e){return(r.fields||[]).filter(Boolean).map(t=>St.fromJSON(t,e))}function Gm(r,e){return(r.children||[]).filter(Boolean).map(t=>St.fromJSON(t,e))}function Y0(r){return(r||[]).reduce((e,t)=>[...e,new Io(t.count,NE(t.VALIDITY)),...Y0(t.children)],[])}function G0(r,e=[]){for(let t=-1,s=(r||[]).length;++t<s;){const a=r[t];a.VALIDITY&&e.push(new Gr(e.length,a.VALIDITY.length)),a.TYPE_ID&&e.push(new Gr(e.length,a.TYPE_ID.length)),a.OFFSET&&e.push(new Gr(e.length,a.OFFSET.length)),a.DATA&&e.push(new Gr(e.length,a.DATA.length)),e=G0(a.children,e)}return e}function NE(r){return(r||[]).reduce((e,t)=>e+ +(t===0),0)}function kE(r,e){let t,s,a,u,d,h;return!e||!(u=r.dictionary)?(d=Xm(r,Gm(r,e)),a=new St(r.name,d,r.nullable,gu(r.metadata))):e.has(t=u.id)?(s=(s=u.indexType)?Jm(s):new Na,h=new go(e.get(t),s,t,u.isOrdered),a=new St(r.name,h,r.nullable,gu(r.metadata))):(s=(s=u.indexType)?Jm(s):new Na,e.set(t,d=Xm(r,Gm(r,e))),h=new go(d,s,t,u.isOrdered),a=new St(r.name,h,r.nullable,gu(r.metadata))),a||null}function gu(r=[]){return new Map(r.map(({key:e,value:t})=>[e,t]))}function Jm(r){return new ys(r.isSigned,r.bitWidth)}function Xm(r,e){const t=r.type.name;switch(t){case"NONE":return new Ni;case"null":return new Ni;case"binary":return new Mu;case"largebinary":return new Au;case"utf8":return new Lu;case"largeutf8":return new Pu;case"bool":return new Tu;case"list":return new Vu((e||[])[0]);case"struct":return new un(e||[]);case"struct_":return new un(e||[])}switch(t){case"int":{const s=r.type;return new ys(s.isSigned,s.bitWidth)}case"floatingpoint":{const s=r.type;return new Fu(tn[s.precision])}case"decimal":{const s=r.type;return new Bu(s.scale,s.precision,s.bitWidth)}case"date":{const s=r.type;return new Nu(Wn[s.unit])}case"time":{const s=r.type;return new ku(_e[s.unit],s.bitWidth)}case"timestamp":{const s=r.type;return new Uu(_e[s.unit],s.timezone)}case"interval":{const s=r.type;return new ju(Fr[s.unit])}case"duration":{const s=r.type;return new zu(_e[s.unit])}case"union":{const s=r.type,[a,...u]=(s.mode+"").toLowerCase(),d=a.toUpperCase()+u.join("");return new $u(bn[d],s.typeIds||[],e||[])}case"fixedsizebinary":{const s=r.type;return new Wu(s.byteWidth)}case"fixedsizelist":{const s=r.type;return new Qu(s.listSize,(e||[])[0])}case"map":{const s=r.type;return new Hu((e||[])[0],s.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}var UE=cv,jE=yo;class sr{static fromJSON(e,t){const s=new sr(0,Tt.V5,t);return s._createHeader=zE(e,t),s}static decode(e){e=new jE(We(e));const t=Ri.getRootAsMessage(e),s=t.bodyLength(),a=t.version(),u=t.headerType(),d=new sr(s,a,u);return d._createHeader=VE(t,u),d}static encode(e){const t=new UE;let s=-1;return e.isSchema()?s=Xe.encode(t,e.header()):e.isRecordBatch()?s=ar.encode(t,e.header()):e.isDictionaryBatch()&&(s=ei.encode(t,e.header())),Ri.startMessage(t),Ri.addVersion(t,Tt.V5),Ri.addHeader(t,s),Ri.addHeaderType(t,e.headerType),Ri.addBodyLength(t,BigInt(e.bodyLength)),Ri.finishMessageBuffer(t,Ri.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof Xe)return new sr(0,Tt.V5,Je.Schema,e);if(e instanceof ar)return new sr(t,Tt.V5,Je.RecordBatch,e);if(e instanceof ei)return new sr(t,Tt.V5,Je.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Je.Schema}isRecordBatch(){return this.headerType===Je.RecordBatch}isDictionaryBatch(){return this.headerType===Je.DictionaryBatch}constructor(e,t,s,a){this._version=t,this._headerType=s,this.body=new Uint8Array(0),a&&(this._createHeader=()=>a),this._bodyLength=wt(e)}}class ar{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,s){this._nodes=t,this._buffers=s,this._length=wt(e)}}class ei{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,s=!1){this._data=e,this._isDelta=s,this._id=wt(t)}}class Gr{constructor(e,t){this.offset=wt(e),this.length=wt(t)}}class Io{constructor(e,t){this.length=wt(e),this.nullCount=wt(t)}}function zE(r,e){return()=>{switch(e){case Je.Schema:return Xe.fromJSON(r);case Je.RecordBatch:return ar.fromJSON(r);case Je.DictionaryBatch:return ei.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Je[e]}, type: ${e} }`)}}function VE(r,e){return()=>{switch(e){case Je.Schema:return Xe.decode(r.header(new br),new Map,r.version());case Je.RecordBatch:return ar.decode(r.header(new Wr),r.version());case Je.DictionaryBatch:return ei.decode(r.header(new Gs),r.version())}throw new Error(`Unrecognized Message type: { name: ${Je[e]}, type: ${e} }`)}}St.encode=ZE;St.decode=JE;St.fromJSON=kE;Xe.encode=XE;Xe.decode=$E;Xe.fromJSON=PE;ar.encode=ex;ar.decode=WE;ar.fromJSON=q0;ei.encode=tx;ei.decode=QE;ei.fromJSON=TE;Io.encode=nx;Io.decode=KE;Gr.encode=rx;Gr.decode=HE;function $E(r,e=new Map,t=Tt.V5){const s=GE(r,e);return new Xe(s,vu(r),e,t)}function WE(r,e=Tt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new ar(r.length(),qE(r),YE(r,e))}function QE(r,e=Tt.V5){return new ei(ar.decode(r.data(),e),r.id(),r.isDelta())}function HE(r){return new Gr(r.offset(),r.length())}function KE(r){return new Io(r.length(),r.nullCount())}function qE(r){const e=[];for(let t,s=-1,a=-1,u=r.nodesLength();++s<u;)(t=r.nodes(s))&&(e[++a]=Io.decode(t));return e}function YE(r,e){const t=[];for(let s,a=-1,u=-1,d=r.buffersLength();++a<d;)(s=r.buffers(a))&&(e<Tt.V4&&(s.bb_pos+=8*(a+1)),t[++u]=Gr.decode(s));return t}function GE(r,e){const t=[];for(let s,a=-1,u=-1,d=r.fieldsLength();++a<d;)(s=r.fields(a))&&(t[++u]=St.decode(s,e));return t}function Zm(r,e){const t=[];for(let s,a=-1,u=-1,d=r.childrenLength();++a<d;)(s=r.children(a))&&(t[++u]=St.decode(s,e));return t}function JE(r,e){let t,s,a,u,d,h;return!e||!(h=r.dictionary())?(a=tg(r,Zm(r,e)),s=new St(r.name(),a,r.nullable(),vu(r))):e.has(t=wt(h.id()))?(u=(u=h.indexType())?eg(u):new Na,d=new go(e.get(t),u,t,h.isOrdered()),s=new St(r.name(),d,r.nullable(),vu(r))):(u=(u=h.indexType())?eg(u):new Na,e.set(t,a=tg(r,Zm(r,e))),d=new go(a,u,t,h.isOrdered()),s=new St(r.name(),d,r.nullable(),vu(r))),s||null}function vu(r){const e=new Map;if(r)for(let t,s,a=-1,u=Math.trunc(r.customMetadataLength());++a<u;)(t=r.customMetadata(a))&&(s=t.key())!=null&&e.set(s,t.value());return e}function eg(r){return new ys(r.isSigned(),r.bitWidth())}function tg(r,e){const t=r.typeType();switch(t){case pt.NONE:return new Ni;case pt.Null:return new Ni;case pt.Binary:return new Mu;case pt.LargeBinary:return new Au;case pt.Utf8:return new Lu;case pt.LargeUtf8:return new Pu;case pt.Bool:return new Tu;case pt.List:return new Vu((e||[])[0]);case pt.Struct_:return new un(e||[])}switch(t){case pt.Int:{const s=r.type(new Fn);return new ys(s.isSigned(),s.bitWidth())}case pt.FloatingPoint:{const s=r.type(new xr);return new Fu(s.precision())}case pt.Decimal:{const s=r.type(new Xs);return new Bu(s.scale(),s.precision(),s.bitWidth())}case pt.Date:{const s=r.type(new du);return new Nu(s.unit())}case pt.Time:{const s=r.type(new zn);return new ku(s.unit(),s.bitWidth())}case pt.Timestamp:{const s=r.type(new Vn);return new Uu(s.unit(),s.timezone())}case pt.Interval:{const s=r.type(new Dr);return new ju(s.unit())}case pt.Duration:{const s=r.type(new fu);return new zu(s.unit())}case pt.Union:{const s=r.type(new _n);return new $u(s.mode(),s.typeIdsArray()||[],e||[])}case pt.FixedSizeBinary:{const s=r.type(new hu);return new Wu(s.byteWidth())}case pt.FixedSizeList:{const s=r.type(new pu);return new Qu(s.listSize(),(e||[])[0])}case pt.Map:{const s=r.type(new yu);return new Hu((e||[])[0],s.keysSorted())}}throw new Error(`Unrecognized type: "${pt[t]}" (${t})`)}function XE(r,e){const t=e.fields.map(u=>St.encode(r,u));br.startFieldsVector(r,t.length);const s=br.createFieldsVector(r,t),a=e.metadata&&e.metadata.size>0?br.createCustomMetadataVector(r,[...e.metadata].map(([u,d])=>{const h=r.createString(`${u}`),p=r.createString(`${d}`);return jt.startKeyValue(r),jt.addKey(r,h),jt.addValue(r,p),jt.endKeyValue(r)})):-1;return br.startSchema(r),br.addFields(r,s),br.addEndianness(r,ix?mo.Little:mo.Big),a!==-1&&br.addCustomMetadata(r,a),br.endSchema(r)}function ZE(r,e){let t=-1,s=-1,a=-1;const u=e.type;let d=e.typeId;ue.isDictionary(u)?(d=u.dictionary.typeId,a=cf.visit(u,r),s=cf.visit(u.dictionary,r)):s=cf.visit(u,r);const h=(u.children||[]).map(g=>St.encode(r,g)),p=kn.createChildrenVector(r,h),m=e.metadata&&e.metadata.size>0?kn.createCustomMetadataVector(r,[...e.metadata].map(([g,v])=>{const b=r.createString(`${g}`),I=r.createString(`${v}`);return jt.startKeyValue(r),jt.addKey(r,b),jt.addValue(r,I),jt.endKeyValue(r)})):-1;return e.name&&(t=r.createString(e.name)),kn.startField(r),kn.addType(r,s),kn.addTypeType(r,d),kn.addChildren(r,p),kn.addNullable(r,!!e.nullable),t!==-1&&kn.addName(r,t),a!==-1&&kn.addDictionary(r,a),m!==-1&&kn.addCustomMetadata(r,m),kn.endField(r)}function ex(r,e){const t=e.nodes||[],s=e.buffers||[];Wr.startNodesVector(r,t.length);for(const d of t.slice().reverse())Io.encode(r,d);const a=r.endVector();Wr.startBuffersVector(r,s.length);for(const d of s.slice().reverse())Gr.encode(r,d);const u=r.endVector();return Wr.startRecordBatch(r),Wr.addLength(r,BigInt(e.length)),Wr.addNodes(r,a),Wr.addBuffers(r,u),Wr.endRecordBatch(r)}function tx(r,e){const t=ar.encode(r,e.data);return Gs.startDictionaryBatch(r),Gs.addId(r,BigInt(e.id)),Gs.addIsDelta(r,e.isDelta),Gs.addData(r,t),Gs.endDictionaryBatch(r)}function nx(r,e){return hv.createFieldNode(r,BigInt(e.length),BigInt(e.nullCount))}function rx(r,e){return fv.createBuffer(r,BigInt(e.offset),BigInt(e.length))}const ix=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),dh=r=>`Expected ${Je[r]} Message in stream, but was null or length 0.`,fh=r=>`Header pointer of flatbuffer-encoded ${Je[r]} Message is null or length 0.`,J0=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,X0=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`;class Z0{constructor(e){this.source=e instanceof Gu?e:new Gu(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?Dt:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(dh(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const t=We(this.source.read(e));if(t.byteLength<e)throw new Error(X0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){const t=Je.Schema,s=this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(fh(t));return a}readMetadataLength(){const e=this.source.read(cc),t=e&&new yo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}}readMetadata(e){const t=this.source.read(e);if(!t)return Dt;if(t.byteLength<e)throw new Error(J0(e,t.byteLength));return{done:!1,value:sr.decode(t)}}}class sx{constructor(e,t){this.source=e instanceof wo?e:iv(e)?new Ju(e,t):new wo(e)}[Symbol.asyncIterator](){return this}next(){return Re(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?Dt:e})}throw(e){return Re(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return Re(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return Re(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(dh(e));return t.value})}readMessageBody(e){return Re(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);const t=We(yield this.source.read(e));if(t.byteLength<e)throw new Error(X0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return Re(this,arguments,void 0,function*(e=!1){const t=Je.Schema,s=yield this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(fh(t));return a})}readMetadataLength(){return Re(this,void 0,void 0,function*(){const e=yield this.source.read(cc),t=e&&new yo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}})}readMetadata(e){return Re(this,void 0,void 0,function*(){const t=yield this.source.read(e);if(!t)return Dt;if(t.byteLength<e)throw new Error(J0(e,t.byteLength));return{done:!1,value:sr.decode(t)}})}}class ox extends Z0{constructor(e){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof Km?e:new Km(e)}next(){const{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:sr.fromJSON(e.schema,Je.Schema)};if(this._dictionaryIndex<e.dictionaries.length){const t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:sr.fromJSON(t,Je.DictionaryBatch)}}if(this._batchIndex<e.batches.length){const t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:sr.fromJSON(t,Je.RecordBatch)}}return this._body=[],Dt}readMessageBody(e){return t(this._body);function t(s){return(s||[]).reduce((a,u)=>[...a,...u.VALIDITY&&[u.VALIDITY]||[],...u.TYPE_ID&&[u.TYPE_ID]||[],...u.OFFSET&&[u.OFFSET]||[],...u.DATA&&[u.DATA]||[],...t(u.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(dh(e));return t.value}readSchema(){const e=Je.Schema,t=this.readMessage(e),s=t==null?void 0:t.header();if(!t||!s)throw new Error(fh(e));return s}}const cc=4,Pf="ARROW1",Xu=new Uint8Array(Pf.length);for(let r=0;r<Pf.length;r+=1)Xu[r]=Pf.codePointAt(r);function hh(r,e=0){for(let t=-1,s=Xu.length;++t<s;)if(Xu[t]!==r[e+t])return!1;return!0}const Qa=Xu.length,ew=Qa+cc,ax=Qa*2+cc;class Xr extends z0{constructor(e){super(),this._impl=e}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){const t=this._impl.open(e);return La(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return jn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return jn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Xr?e:bf(e)?dx(e):iv(e)?px(e):La(e)?Re(this,void 0,void 0,function*(){return yield Xr.from(yield e)}):sv(e)||Yf(e)||av(e)||qf(e)?hx(new wo(e)):fx(new Gu(e))}static readAll(e){return e instanceof Xr?e.isSync()?ng(e):rg(e):bf(e)||ArrayBuffer.isView(e)||ac(e)||rv(e)?ng(e):rg(e)}}class Zu extends Xr{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Or(this,arguments,function*(){yield Le(yield*cu(ao(this[Symbol.iterator]())))})}}class ec extends Xr{constructor(e){super(e),this._impl=e}readAll(){return Re(this,void 0,void 0,function*(){var e,t,s,a;const u=new Array;try{for(var d=!0,h=ao(this),p;p=yield h.next(),e=p.done,!e;d=!0){a=p.value,d=!1;const m=a;u.push(m)}}catch(m){t={error:m}}finally{try{!d&&!e&&(s=h.return)&&(yield s.call(h))}finally{if(t)throw t.error}}return u})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class tw extends Zu{constructor(e){super(e),this._impl=e}}class lx extends ec{constructor(e){super(e),this._impl=e}}class nw{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t){const s=this._loadVectors(e,t,this.schema.fields),a=Be({type:new un(this.schema.fields),length:e.length,children:s});return new ir(this.schema,a)}_loadDictionaryBatch(e,t){const{id:s,isDelta:a}=e,{dictionaries:u,schema:d}=this,h=u.get(s),p=d.dictionaries.get(s),m=this._loadVectors(e.data,t,[p]);return(h&&a?h.concat(new lt(m)):new lt(m)).memoize()}_loadVectors(e,t,s){return new $0(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(s)}}class tc extends nw{constructor(e,t){super(t),this._reader=bf(e)?new ox(this._handle=e):new Z0(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=iw(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Dt}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Dt}next(){if(this.closed)return Dt;let e;const{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new K0(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class nc extends nw{constructor(e,t){super(t),this._reader=new sx(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Re(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return Re(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=iw(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return Re(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Dt})}return(e){return Re(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Dt})}next(){return Re(this,void 0,void 0,function*(){if(this.closed)return Dt;let e;const{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new K0(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return Re(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class rw extends tc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof qm?e:new qm(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(Je.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null}_readDictionaryBatch(e){var t;const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(Je.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}}_readFooter(){const{_handle:e}=this,t=e.size-ew,s=e.readInt32(t),a=e.readAt(t-s,s);return oh.decode(a)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(this._recordBatchIndex);if(s&&this._handle.seek(s.offset))return this._reader.readMessage(e)}return null}}class ux extends nc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){const s=typeof t[0]!="number"?t.shift():void 0,a=t[0]instanceof Map?t.shift():void 0;super(e instanceof Ju?e:new Ju(e,s),a)}isFile(){return!0}isAsync(){return!0}open(e){const t=Object.create(null,{open:{get:()=>super.open}});return Re(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const s of this._footer.dictionaryBatches())s&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return Re(this,void 0,void 0,function*(){var t;if(this.closed)return null;this._footer||(yield this.open());const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(Je.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null})}_readDictionaryBatch(e){return Re(this,void 0,void 0,function*(){var t;const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(Je.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}})}_readFooter(){return Re(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const t=e.size-ew,s=yield e.readInt32(t),a=yield e.readAt(t-s,s);return oh.decode(a)})}_readNextMessageAndValidate(e){return Re(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}}class cx extends tc{constructor(e,t){super(e,t)}_loadVectors(e,t,s){return new bE(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(s)}}function iw(r,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:r.autoDestroy}function*ng(r){const e=Xr.from(r);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function rg(r){return Or(this,arguments,function*(){const t=yield Le(Xr.from(r));try{if(!(yield Le(t.open({autoDestroy:!1}))).closed)do yield yield Le(t);while(!(yield Le(t.reset().open())).closed)}finally{yield Le(t.cancel())}})}function dx(r){return new Zu(new cx(r))}function fx(r){const e=r.peek(Qa+7&-8);return e&&e.byteLength>=4?hh(e)?new tw(new rw(r.read())):new Zu(new tc(r)):new Zu(new tc(function*(){}()))}function hx(r){return Re(this,void 0,void 0,function*(){const e=yield r.peek(Qa+7&-8);return e&&e.byteLength>=4?hh(e)?new tw(new rw(yield r.read())):new ec(new nc(r)):new ec(new nc(function(){return Or(this,arguments,function*(){})}()))})}function px(r){return Re(this,void 0,void 0,function*(){const{size:e}=yield r.stat(),t=new Ju(r,e);return e>=ax&&hh(yield t.readAt(0,Qa+7&-8))?new lx(new ux(t)):new ec(new nc(t))})}function sw(r){const e=Xr.from(r);return La(e)?e.then(t=>sw(t)):e.isAsync()?e.readAll().then(t=>new $n(t)):new $n(e.readAll())}async function Mt(r,e){const{url:t,method:s,params:a,data:u,headers:d,credentials:h,mode:p,cache:m}=r,g=Object.keys({...a}).length>0,v=t.replace(/([^:]\/)\/+/g,"$1"),b=new URL(ow(v),window.location.origin);if(g){const I=Object.entries({...a}).reduce((M,[B,A])=>(A!=null&&(M[B]=String(A)),M),{});b.search=new URLSearchParams(I).toString()}return await new Promise((I,M)=>{fetch(b,{method:s,credentials:h,mode:p,cache:m,headers:yx(d),body:mx(u),signal:e==null?void 0:e.signal}).then(async B=>{if(B.status===204)return{ok:!0};const A=B.headers.get("Content-Type");if(Yt(A))return{ok:!1,message:"Empty response"};if(B.status>=400)try{const q=await B.json();throw q.status=q.status??B.status,q}catch(q){throw{message:B.statusText,...q}}const K=A.includes("text/event-stream"),W=A.includes("application/json"),Y=A.includes("application/vnd.apache.arrow.stream");if(W)return await B.json();if(Y)return await sw(B);if(K){const pe=(await B.text()).trim().replace("data: ","").trim();return JSON.parse(pe)}}).then(I).catch(M)})}function yx(r){return{"Content-Type":"application/json",...r??{}}}function mx(r){try{return JSON.stringify(r)}catch{return""}}function ow(r="/"){let e=`${Oa(window.__BASE_URL__)?"/":window.__BASE_URL__}/${r}`;for(;e.includes("//");)e=e.replaceAll("//","/");return e}const lu={python:"python",sql:"sql",seed:"seed",external:"external",source:"source"},_r={editor:"editor",files:"files","data-catalog":"data-catalog",plans:"plans",tests:"tests",audits:"audits",errors:"errors",data:"data",lineage:"lineage"},RD={NUMBER_1:1,NUMBER_2:2,NUMBER_3:3},FD={init:"init",success:"success",fail:"fail"},gx=(r,e)=>Mt({url:"/api/commands/apply",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),vx=(r,e)=>Mt({url:"/api/commands/evaluate",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),wx=(r,e)=>Mt({url:"/api/commands/fetchdf",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),Sx=(r,e)=>Mt({url:"/api/commands/render",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),_x=r=>Mt({url:"/api/files",method:"GET"},r),bx=(r,e)=>Mt({url:`/api/files/${r}`,method:"GET"},e),Ix=(r,e,t)=>Mt({url:`/api/files/${r}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),MD=(r,e)=>Mt({url:`/api/files/${r}`,method:"DELETE"},e),AD=(r,e,t)=>Mt({url:`/api/directories/${r}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),LD=(r,e)=>Mt({url:`/api/directories/${r}`,method:"DELETE"},e),Ex=(r,e)=>Mt({url:"/api/plan",method:"POST",headers:{"Content-Type":"application/json"},data:r},e),xx=r=>Mt({url:"/api/plan/cancel",method:"POST"},r),Dx=r=>Mt({url:"/api/environments",method:"GET"},r),PD=(r,e)=>Mt({url:`/api/environments/${r}`,method:"DELETE"},e),Ox=(r,e,t,s)=>Mt({url:`/api/lineage/${r}/${e}`,method:"GET",params:t},s),Cx=(r,e)=>Mt({url:`/api/lineage/${r}`,method:"GET"},e),Rx=r=>Mt({url:"/api/models",method:"GET"},r),Fx=(r,e)=>Mt({url:`/api/models/${r}`,method:"GET"},e),Mx=r=>Mt({url:"/api/meta",method:"GET"},r),Ax=r=>Mt({url:"/api/modules",method:"GET"},r),Lx=(r,e)=>Mt({url:"/api/table_diff",method:"GET",params:r},e),Vr=P.lazy(()=>cn(()=>import("./Root-DGB1oz4_.js"),[])),Px=P.lazy(()=>cn(()=>import("./Editor-DmDOoKYg.js"),[])),Tx=P.lazy(()=>cn(()=>import("./Plan-BnEsOAVM.js"),[])),Bx=P.lazy(()=>cn(()=>import("./Content-CTSG98TE.js"),[])),Nx=P.lazy(()=>cn(()=>import("./DataCatalog-C6QIcOlP.js"),[])),kx=P.lazy(()=>cn(()=>import("./Tests-B9FFl0mr.js"),[])),Ux=P.lazy(()=>cn(()=>import("./Audits--i7rYGSa.js"),[])),jx=P.lazy(()=>cn(()=>import("./Data-C_D2LPey.js"),[])),df=P.lazy(()=>cn(()=>import("./Models-z9CSIay9.js"),[])),zx=P.lazy(()=>cn(()=>import("./Lineage-Cmw3A5oO.js"),[])),Vx=P.lazy(()=>cn(()=>import("./Errors-B0nrU2iZ.js"),[])),$x=P.lazy(()=>cn(()=>import("./Content-DP0RBcBf.js"),[])),tr=P.lazy(()=>cn(()=>import("./Welcome-Dp8mGwQ0.js"),[])),ot={Home:"/",Editor:"/editor",DataCatalog:"/data-catalog",DataCatalogModels:"/data-catalog/models",Data:"/data",Lineage:"/lineage",LineageModels:"/lineage/models",Tests:"/tests",Audits:"/audits",Errors:"/errors",Plan:"/plan",NotFound:"/not-found"},ig={plan:[_r.plans]};function Wx(r){const e=[{path:"*",element:ic(r.list)?N.jsx(vn,{link:ot.Home,message:"Back To Main"}):N.jsx(vn,{headline:"Empty"})},{path:ot.Home,element:N.jsx(Vr,{})},...[{path:ot.Editor,element:N.jsx(Vr,{content:N.jsx(Px,{})})},{path:ot.DataCatalog,element:N.jsx(Vr,{content:N.jsx(df,{route:ot.DataCatalog})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.DataCatalog,message:"Back To Data Catalog"})},{path:"models",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.DataCatalog,message:"Back To Data Catalog"})},{path:":modelName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(Nx,{})})}]}]},{path:ot.Data,element:N.jsx(Vr,{content:N.jsx(df,{route:ot.Data})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Data,message:"Back To Data"})},{path:"models",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Data,message:"Back To Data"})},{path:":modelName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(jx,{})})}]}]},{path:ot.Lineage,element:N.jsx(Vr,{content:N.jsx(df,{route:ot.Lineage})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Lineage,message:"Back To Lineage"})},{path:"models",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:N.jsx(vn,{link:ot.Lineage,message:"Back To Lineage"})},{path:":modelName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(zx,{})})}]}]},{path:ot.Errors,element:N.jsx(Vr,{content:N.jsx(Vx,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to errors report",tagline:"Here you can see all the errors that occurred."})},{path:"*",element:N.jsx(vn,{link:ot.Errors,message:"Back To Errors"})},{path:":id",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx($x,{})})}]},{path:ot.Plan,element:N.jsx(Vr,{content:N.jsx(Tx,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:N.jsx(vn,{link:ot.Plan,message:"Back To Plan"})},{path:"environments",children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:N.jsx(vn,{link:ot.Plan,message:"Back To Plan"})},{path:":environmentName",element:N.jsx(P.Suspense,{fallback:N.jsx("div",{className:"flex justify-center items-center w-full h-full",children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:N.jsx(Bx,{})})}]}]},{path:ot.Tests,element:N.jsx(Vr,{content:N.jsx(kx,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to tests report",tagline:"Here you can run tests and see the results."})},{path:"*",element:N.jsx(vn,{link:ot.Tests,message:"Back To Tests"})}]},{path:ot.Audits,element:N.jsx(Vr,{content:N.jsx(Ux,{})}),children:[{index:!0,element:N.jsx(tr,{headline:"Welcome to audits report",tagline:"Here you can run audits and see the results."})},{path:"*",element:N.jsx(vn,{link:ot.Audits,message:"Back To Audits"})}]}].filter(t=>{var a;const s=t.path.replace("/","");return Yt(ig[s])?r.list.includes(s):(a=ig[s])==null?void 0:a.some(u=>r.list.includes(u))})].filter(Boolean);return vb(e,{basename:ow()})}const zt={API:"api",General:"general",RunPlan:"run-plan",ApplyPlan:"apply-plan",CancelPlan:"cancel-plan",Environments:"environments",Models:"models",Fetchdf:"fetchdf",EvaluateModel:"evaluate-model",RenderQuery:"render-query",ColumnLineage:"column-lineage",ModelLineage:"model-lineage",Meta:"meta",Modules:"modules",FileExplorer:"file-explorer",Table:"table",TableDiff:"table-diff",SaveFile:"save-file"},aw=P.createContext({errors:new Set,addError:()=>({removeError:()=>{},error:{}}),removeError:()=>{},clearErrors:()=>{}});function Qx({children:r}){const[e,t]=P.useState(new Set);function s(d,h){const p={id:ff(),key:d,status:h.status,timestamp:h.timestamp??Date.now(),message:h.message,description:h.description,type:h.type,origin:h.origin,trigger:h.trigger,stack:h.stack,traceback:h.traceback};return t(m=>new Set(m.add(p))),{removeError:()=>a(p),error:p}}function a(d){t(h=>(h.forEach(p=>{(p===d||p.key===d)&&h.delete(p)}),new Set(h)))}function u(){t(new Set)}return N.jsx(aw.Provider,{value:{errors:e,addError:s,removeError:a,clearErrors:u},children:r})}function ph(){return P.useContext(aw)}const lw=60*1e3,Hx=5*lw,dc=10*lw;function Kx(r){return nn({queryKey:["/api/modules"],queryFn:Ax,enabled:!0},{...r,errorKey:zt.Modules,trigger:"API -> useApiModules"})}function TD(r){return nn({queryKey:["/api/meta"],queryFn:Mx,enabled:!0},{...r,errorKey:zt.Meta,trigger:"API -> useApiMeta"})}function BD(r){return nn({queryKey:["/api/models"],queryFn:Rx},{...r,errorKey:zt.Models,trigger:"API -> useApiModels"})}function ND(r,e){return nn({queryKey:["/api/models",r],queryFn:async({signal:t})=>await Fx(r,{signal:t})},{...e,errorKey:zt.Models,trigger:"API -> useApiModel"})}function kD(r){return nn({queryKey:["/api/files"],queryFn:_x},{...r,errorKey:zt.FileExplorer,trigger:"API -> useApiFiles"})}function UD(r,e){return nn({queryKey:["/api/files",r],queryFn:async({signal:t})=>await bx(r,{signal:t})},{...e,errorKey:zt.FileExplorer,trigger:"API -> useApiFileByPath"})}function jD(r,e){return nn({queryKey:["/api/lineage",r],queryFn:async({signal:t})=>await Cx(r,{signal:t})},{...e,errorKey:zt.ModelLineage,trigger:"API -> useApiModelLineage"})}function zD(r,e,t,s){return nn({queryKey:["/api/lineage",r,e],queryFn:async({signal:a})=>await Ox(r,e,s,{signal:a})},{...t,errorKey:zt.ColumnLineage,trigger:"API -> useApiColumnLineage"})}function VD(r){return nn({queryKey:["/api/environments"],queryFn:Dx},{...r,errorKey:zt.Environments,trigger:"API -> useApiEnvironments"})}function $D(r){return nn({queryKey:["/api/commands/apply"],queryFn:xx},{...r,errorKey:zt.CancelPlan,trigger:"API -> useApiCancelPlan"})}function WD(r,e,t){return nn({queryKey:["/api/plan",r],async queryFn({signal:s}){return await Ex({environment:r,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:zt.RunPlan,trigger:"API -> useApiPlanRun"})}function QD(r,e,t){return nn({queryKey:["/api/commands/apply",r],async queryFn({signal:s}){return await gx({environment:r,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:zt.ApplyPlan,trigger:"API -> useApiPlanApply"})}function HD(r,e){return nn({queryKey:["/api/commands/fetchd"],queryFn:async({signal:t})=>await wx(r,{signal:t})},{...e,errorKey:zt.Fetchdf,trigger:"API -> useApiFetchdf",delay:dc})}function KD(r,e){return nn({queryKey:["/api/commands/render"],queryFn:async({signal:t})=>await Sx(r,{signal:t})},{...e,errorKey:zt.RenderQuery,trigger:"API -> useApiRender",delay:dc})}function qD(r,e){return nn({queryKey:["/api/commands/table_diff"],queryFn:async({signal:t})=>await Lx(r,{signal:t})},{...e,errorKey:zt.TableDiff,trigger:"API -> useApiTableDiff",delay:dc})}function YD(r,e){return nn({queryKey:["/api/commands/evaluate"],queryFn:async({signal:t})=>await vx(r,{signal:t})},{...e,errorKey:zt.EvaluateModel,trigger:"API -> useApiEvaluate",delay:dc})}function GD(r){const{addError:e}=ph();return K_({mutationFn:async({path:t,body:s})=>await Ix(t,s),onError(t){e(zt.SaveFile,t)},async onMutate({path:t}){await r.cancelQueries({queryKey:["/api/files",t]})}})}function nn(r,{delay:e=Hx,removeTimeoutErrorAfter:t,errorKey:s=zt.API,trigger:a}){const u=r.queryKey.join(" -> "),d=Uf(),{addError:h}=ph(),[p,m]=P.useState(!1);let g,v=function(){console.log(`[REQUEST TIMEOUT] ${u} id: ${String(g)} timed out after ${e}ms`);const{removeError:q}=h(s,{message:"Request timed out",description:`Request ${u} with timeoutId: ${String(g)} timed out after ${e}ms`,timestamp:Date.now(),origin:"useQueryTimeout",trigger:a});m(!0),M(),ln(t)&&setTimeout(()=>q(),t)};function b(){console.log(`[CLEAR TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`),clearTimeout(g),g=void 0,v=void 0}function I(){g=setTimeout(()=>{v==null||v()},e),console.log(`[START TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`)}function M(){b(),d.cancelQueries({queryKey:r.queryKey}),console.log(`[REQUEST CANCELED] ${u} at ${Date.now()}`)}function B(Y){b(),Ca(Y)||Y.name==="AbortError"?console.log(`[REQUEST ABORTED] ${u} aborted by React Query at ${Date.now()}`):(console.log(`[REQUEST FAILED] ${u} failed at ${Date.now()}`),h(s,Y))}function A(){b(),console.log(`[REQUEST COMPLETED] ${u} completed at ${Date.now()}`)}async function K(...Y){return I(),r.queryFn(...Y)}const W=H_({cacheTime:0,enabled:!1,queryKey:r.queryKey,queryFn:K,meta:{...r.meta,onError:B,onSuccess:A}});return{...W,refetch:async(...Y)=>new Promise(q=>{W.refetch(...Y,{throwOnError:!0}).then(q).catch(pe=>pe)}),cancel:M,isTimeout:p}}class uw{constructor(e){bt(this,"_initial");bt(this,"isModel",!0);Yt(e)?this._initial=Object.assign({id:ff()}):this._initial=ln(e==null?void 0:e.id)?e:new Proxy(Object.assign(e??{},{id:ff()}),{set(){throw new Error("Cannot change initial file")}})}get initial(){return this._initial}get id(){return this.initial.id}}class sg extends uw{constructor(t=[]){super();bt(this,"modules",new Set);this.modules=new Set(t)}get list(){return Array.from(this.modules)}get isEmpty(){return this.modules.size===0}get hasErrors(){return this.modules.has(_r.errors)}get hasEditor(){return this.modules.has(_r.editor)}get hasFiles(){return this.modules.has(_r.files)}get hasProjectEditor(){return this.hasEditor&&this.hasFiles}get hasOnlyProjectEditor(){return this.modules.size===2&&this.hasProjectEditor}get hasOnlyDataCatalog(){return this.modules.size===1&&this.hasDataCatalog}get hasProjectEditorAndModule(){return this.modules.size===3&&this.hasProjectEditor&&Bi(this.hasErrors)}get hasDataCatalog(){return this.modules.has(_r["data-catalog"])}get hasPlans(){return this.modules.has(_r.plans)}get hasOnlyPlans(){return this.modules.size===1&&this.hasPlans}get hasOnlyPlansAndErrors(){return this.modules.size===2&&this.hasPlans&&this.hasErrors}get hasTests(){return this.modules.has(_r.tests)}get hasAudits(){return this.modules.has(_r.audits)}get hasData(){return this.modules.has(_r.data)}get hasLineage(){return this.modules.has(_r.lineage)}get hasModuleAndErrors(){return this.hasErrors&&(this.modules.size===2||this.modules.size===3&&this.hasProjectEditor)}get hasSingleModule(){return this.modules.size===1}get showModuleNavigation(){return this.isEmpty||this.hasSingleModule||this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule?!0:Bi(this.isEmpty)}get showHistoryNavigation(){return this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule||this.hasDataCatalog?!0:Bi(this.isEmpty)}get showNavigation(){return this.hasErrors||this.hasPlans||this.showHistoryNavigation}update(t=[]){this.modules=new Set(t)}defaultNavigationRoute(){return this.hasEditor?ot.Editor:this.hasPlans?ot.Plan:this.hasDataCatalog?ot.DataCatalog:ot.NotFound}}class qx extends uw{constructor(t){super(t!=null&&t.isModel?t.initial:{...t,dialect:(t==null?void 0:t.dialect)??"Default",columns:(t==null?void 0:t.columns)??[],details:(t==null?void 0:t.details)??{}});bt(this,"_details",{});bt(this,"_detailsIndex","");bt(this,"name");bt(this,"fqn");bt(this,"path");bt(this,"full_path");bt(this,"dialect");bt(this,"type");bt(this,"columns");bt(this,"default_catalog");bt(this,"description");bt(this,"sql");bt(this,"definition");bt(this,"hash");this.name=encodeURI(this.initial.name),this.fqn=encodeURI(this.initial.fqn),this.default_catalog=this.initial.default_catalog,this.path=this.initial.path,this.full_path=this.initial.full_path,this.dialect=this.initial.dialect,this.description=this.initial.description,this.sql=this.initial.sql,this.definition=this.initial.definition,this.columns=this.initial.columns??[],this.type=this.initial.type,this.hash=this.initial.hash,this.details=this.initial.details??{}}get defaultCatalog(){return this.default_catalog}get details(){return this._details}set details(t){const s=[];for(const a of Object.values(t))ic(a)?a.forEach(u=>{s.push(...Object.values(u))}):s.push(a);this._details=t,this._detailsIndex=s.join(" ")}get index(){return[this.displayName,this.path,this.type,...this.columns.map(t=>Object.values(t)).flat(),this._detailsIndex,this.dialect,this.description].filter(Boolean).join(" ").toLowerCase()}get isModelPython(){return this.type===lu.python}get isModelSQL(){return this.type===lu.sql}get isModelSeed(){return this.type===lu.seed}get isModelExternal(){return this.type===lu.external}get displayName(){return decodeURI(this.name)}update(t={}){for(const[s,a]of Object.entries(t))s==="columns"?this.columns=a:s==="details"?this.details=a:s==="name"?this.name=encodeURI(a):s==="fqn"?this.fqn=encodeURI(a):s==="type"?this.type=a:s==="default_catalog"?this.default_catalog=a:s==="description"?this.description=a:s in this&&(this[s]=a)}}const og=r=>{let e;const t=new Set,s=(m,g)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const b=e;e=g??(typeof v!="object"||v===null)?v:Object.assign({},e,v),t.forEach(I=>I(e,b))}},a=()=>e,h={setState:s,getState:a,getInitialState:()=>p,subscribe:m=>(t.add(m),()=>t.delete(m))},p=e=r(s,a,h);return h},Yx=r=>r?og(r):og,Gx=r=>r;function Jx(r,e=Gx){const t=hs.useSyncExternalStore(r.subscribe,()=>e(r.getState()),()=>e(r.getInitialState()));return hs.useDebugValue(t),t}const ag=r=>{const e=Yx(r),t=s=>Jx(e,s);return Object.assign(t,e),t},Xx=r=>r?ag(r):ag,ma={Empty:"",Prod:"prod"},Yr={Local:"local",Remote:"remote"},[lg,Zx]=wg("profile");class en{constructor(e,t,s=ma.Prod,a=!1,u=!1){bt(this,"_initial");bt(this,"_type");bt(this,"_createFrom");bt(this,"_isPinned",!1);bt(this,"_isDefault",!1);bt(this,"isModel",!0);this._initial=e,this._type=t??Yr.Local,this._createFrom=this._isDefault?ma.Empty:s,this._isPinned=a,this._isDefault=u}get id(){return this._initial.plan_id??""}get name(){return this._initial.name??ma.Empty}get type(){return this._type}get createFrom(){return this._createFrom}get isProd(){return this.name===ma.Prod}get isDefault(){return this._isDefault}set isDefault(e){this._isDefault=e}get isPinned(){return this._isPinned||this.isDefault||this.isProd}set isPinned(e){this._isPinned=e}get isInitial(){var e;return Oa((e=this._initial)==null?void 0:e.plan_id)}get isLocal(){return this._type===Yr.Local}get isRemote(){return this._type===Yr.Remote}get isSyncronized(){return this.isRemote&&Bi(this.isInitial)}get isInitialProd(){return this.isInitial&&this.isProd}setType(e){this._type=e}setCreatedFrom(e){this._createFrom=e}update(e){this._initial=e}static save({environment:e,environments:t}){const s={};ln(e)&&(s.environment={name:e.name,plan_id:e.id,type:e.type,createFrom:e.createFrom,isPinned:e.isPinned,isDefault:e.isDefault}),ln(t)&&(s.environments=en.getOnlyLocal(t).map(a=>({name:a.name,plan_id:a.id,type:a.type,createFrom:a.createFrom,isPinned:a.isPinned,isDefault:a.isDefault}))),Zx(s)}static getOnlyLocal(e=[]){return e.filter(t=>Bi(Oa(t.name))&&t.isLocal)}static getOnlyRemote(e=[]){return e.filter(t=>Bi(Oa(t.name))&&t.isRemote)}static getEnvironment(){const{environment:e}=lg()??{};if(Yt(e))return;const{name:t,plan_id:s,type:a,createFrom:u,isPinned:d,isDefault:h}=e;return new en({name:t,plan_id:s},a,u,d,h)}static getEnvironments(){const e=lg(),t=new Map;ln(e)&&ln(e.environment)&&t.set(e.environment.name,e.environment),ln(e)&&ln(e.environments)&&e.environments.forEach(a=>t.set(a.name,a));const s=[];return Array.from(t.entries()).forEach(([a,u])=>{s.push(new en({name:a,plan_id:u.plan_id},u.type,u.createFrom,u.isPinned,u.isDefault))}),gg(s)&&s.push(new en({name:ma.Prod},Yr.Local)),s}static sort(e){return e.sort(t=>t.isRemote?-1:1),e}}const ug="prod",cw=new Set(en.getEnvironments()),cg=en.getEnvironment()??cw.values().next().value,dg=Xx((r,e)=>({version:void 0,modules:new sg,splitPaneSizes:[20,80],showConfirmation:!1,confirmations:[],environment:cg,environments:cw,initialStartDate:void 0,initialEndDate:void 0,models:new Map,lastSelectedModel:void 0,setLastSelectedModel(t){r(()=>({lastSelectedModel:t}))},setModules(t){r(()=>({modules:new sg(t.list)}))},isModel(t){return e().models.has(t)},setSplitPaneSizes(t){r(()=>({splitPaneSizes:t}))},setVersion(t){r(()=>({version:t}))},setShowConfirmation(t){r(()=>({showConfirmation:t}))},addConfirmation(t){r(s=>(s.confirmations.push(t),{confirmations:Array.from(s.confirmations)}))},removeConfirmation(){const t=e();t.confirmations.shift(),r(()=>({confirmations:Array.from(t.confirmations)}))},setModels(t=[]){const s=e();r(()=>({models:t.reduce((a,u)=>{const d=new qx(u);let h=s.models.get(d.path)??s.models.get(d.name)??s.models.get(d.fqn);return Yt(h)?h=d:h.update(u),a.set(h.name,h),a.set(h.fqn,h),a.set(h.path,h),a},new Map)}))},getNextEnvironment(){return e().environments.values().next().value??cg},isExistingEnvironment(t){const s=e();if(t.isModel)return s.environments.has(t);let a=!1;return s.environments.forEach(u=>{u.name===t&&(a=!0)}),a},setEnvironment(t){r(()=>(en.save({environment:t}),{environment:t}))},addLocalEnvironment(t,s=ug){r(a=>{if(Oa(t))return a;const u=new en({name:t},Yr.Local,s);return a.environments.add(u),a.setEnvironment(u),en.save({environments:Array.from(a.environments)}),{environments:new Set(a.environments)}})},removeLocalEnvironment(t){r(s=>(s.environments.delete(t),en.save({environments:Array.from(s.environments)}),{environments:new Set(s.environments)}))},addRemoteEnvironments(t=[],s,a=[]){r(u=>{const d=Array.from(u.environments);t.forEach(I=>{let M=d.find(({name:B})=>I.name===B);Yt(M)?(M=new en(I,Yr.Remote),d.push(M)):(M.update(I),M.setType(Yr.Remote)),u.environment.name===I.name&&u.environment.update(I),M.isInitial&&M.isDefault&&u.setEnvironment(M)}),a.forEach(I=>{const M=d.find(({name:B})=>I===B);Yt(M)?d.push(new en({name:I},Yr.Local,void 0,!0)):M.isPinned=!0});const h=en.getEnvironment();let p,m,g;d.forEach(I=>{switch(I.name){case ug:p=I;break;case(h==null?void 0:h.name):m=I;break;case s:I.isDefault=!0,g=I}});const v=u.environment??m??g,b=ZS(p==null?void 0:p.isInitial)?p:v;return en.save({environments:d,environment:b}),en.sort(d),{environment:b,environments:new Set(d)}})},hasRemoteEnvironments(){const t=e();return Array.from(t.environments).some(({type:s})=>s===Yr.Remote)}}));function fg({children:r,className:e}){return N.jsx("div",{className:Cr("flex justify-center items-center w-full h-full",e),children:N.jsxs(Ys,{className:"inline-block",children:[N.jsx(us,{className:"w-3 h-3 border border-neutral-10 mr-4"}),N.jsx("h3",{className:"text-md",children:r})]})})}const dw=!!(window.__IS_HEADLESS__??!1),hg=dw?void 0:P.lazy(()=>cn(()=>import("./Header-BQ_cV1fD.js"),[])),pg=dw?void 0:P.lazy(()=>cn(()=>import("./Footer-BKOrdgAB.js"),[]));function eD(){const{addError:r}=ph(),e=dg(h=>h.modules),t=dg(h=>h.setModules),{refetch:s,cancel:a,isFetching:u}=Kx();P.useEffect(()=>(s().then(({data:h})=>{e.update(h),t(e)}).catch(h=>r(zt.Modules,h)),()=>{a()}),[]);const d=Wx(e);return N.jsxs(N.Fragment,{children:[ln(hg)&&N.jsxs(N.Fragment,{children:[N.jsx(hg,{}),N.jsx(Om,{})]}),N.jsx("main",{className:"h-full overflow-hidden relative",children:u?N.jsx(fg,{className:"absolute w-full h-full bg-theme z-10",children:"Building Modules..."}):N.jsx(P.Suspense,{fallback:N.jsx(fg,{children:"Loading Page..."}),children:ic(e.list)?N.jsx(Db,{router:d}):N.jsx(vn,{description:"No Modules Found"})})}),ln(pg)&&N.jsxs(N.Fragment,{children:[N.jsx(Om,{}),N.jsx(pg,{})]})]})}const tD=new I_({queryCache:new Rg({onError(r,e){e.meta.onError(r)},onSuccess(r,e){e.meta.onSuccess()}}),defaultOptions:{queries:{networkMode:"always",refetchOnWindowFocus:!1,retry:!1,staleTime:1/0}}});u_.createRoot(nD()).render(N.jsx(hs.StrictMode,{children:N.jsx(L_,{client:tD,children:N.jsx(r_,{children:N.jsx(Qx,{children:N.jsx(eD,{})})})})}));function nD(){const r="root";let e=document.getElementById(r);if(ln(e))return e;const t=document.body,s=t.children[0];return e=document.createElement("div"),e.id=r,e.className="h-full w-full flex flex-col justify-start",s instanceof HTMLElement?t.insertBefore(e,s):t.appendChild(e),e}export{PD as $,kD as A,xD as B,FD as C,sD as D,qs as E,gg as F,zt as G,tv as H,Om as I,Oa as J,RD as K,Ys as L,en as M,_D as N,SD as O,hD as P,dD as Q,hs as R,us as S,zb as T,wD as U,vn as V,gD as W,aD as X,nv as Y,ED as Z,cn as _,dg as a,uw as a0,Xx as a1,Tf as a2,mg as a3,ND as a4,cD as a5,KD as a6,YD as a7,fg as a8,mD as a9,wg as aA,ff as aB,ID as aC,jD as aD,oD as aa,e_ as ab,Mg as ac,C_ as ad,DD as ae,Cm as af,OD as ag,AD as ah,Ix as ai,MD as aj,LD as ak,qD as al,HD as am,wx as an,iD as ao,rc as ap,M_ as aq,yD as ar,bD as as,Uf as at,UD as au,GD as av,pD as aw,lD as ax,zD as ay,lu as az,Bi as b,Cr as c,ph as d,ot as e,XS as f,ZS as g,ic as h,ln as i,N as j,VD as k,WD as l,Ft as m,at as n,uD as o,QD as p,$D as q,P as r,fD as s,q1 as t,vD as u,BD as v,Yt as w,ow as x,za as y,TD as z};