(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=e(r);fetch(r.href,s)}})();function Wa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ms={exports:{}},z={};/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Q=typeof Symbol=="function"&&Symbol.for,lr=Q?Symbol.for("react.element"):60103,ur=Q?Symbol.for("react.portal"):60106,mi=Q?Symbol.for("react.fragment"):60107,gi=Q?Symbol.for("react.strict_mode"):60108,bi=Q?Symbol.for("react.profiler"):60114,wi=Q?Symbol.for("react.provider"):60109,_i=Q?Symbol.for("react.context"):60110,dr=Q?Symbol.for("react.async_mode"):60111,vi=Q?Symbol.for("react.concurrent_mode"):60111,Si=Q?Symbol.for("react.forward_ref"):60112,Ii=Q?Symbol.for("react.suspense"):60113,Ya=Q?Symbol.for("react.suspense_list"):60120,Oi=Q?Symbol.for("react.memo"):60115,Bi=Q?Symbol.for("react.lazy"):60116,Ka=Q?Symbol.for("react.block"):60121,Za=Q?Symbol.for("react.fundamental"):60117,Ja=Q?Symbol.for("react.responder"):60118,Ha=Q?Symbol.for("react.scope"):60119;function bt(n){if(typeof n=="object"&&n!==null){var t=n.$$typeof;switch(t){case lr:switch(n=n.type,n){case dr:case vi:case mi:case bi:case gi:case Ii:return n;default:switch(n=n&&n.$$typeof,n){case _i:case Si:case Bi:case Oi:case wi:return n;default:return t}}case ur:return t}}}function Ls(n){return bt(n)===vi}z.AsyncMode=dr;z.ConcurrentMode=vi;z.ContextConsumer=_i;z.ContextProvider=wi;z.Element=lr;z.ForwardRef=Si;z.Fragment=mi;z.Lazy=Bi;z.Memo=Oi;z.Portal=ur;z.Profiler=bi;z.StrictMode=gi;z.Suspense=Ii;z.isAsyncMode=function(n){return Ls(n)||bt(n)===dr};z.isConcurrentMode=Ls;z.isContextConsumer=function(n){return bt(n)===_i};z.isContextProvider=function(n){return bt(n)===wi};z.isElement=function(n){return typeof n=="object"&&n!==null&&n.$$typeof===lr};z.isForwardRef=function(n){return bt(n)===Si};z.isFragment=function(n){return bt(n)===mi};z.isLazy=function(n){return bt(n)===Bi};z.isMemo=function(n){return bt(n)===Oi};z.isPortal=function(n){return bt(n)===ur};z.isProfiler=function(n){return bt(n)===bi};z.isStrictMode=function(n){return bt(n)===gi};z.isSuspense=function(n){return bt(n)===Ii};z.isValidElementType=function(n){return typeof n=="string"||typeof n=="function"||n===mi||n===vi||n===bi||n===gi||n===Ii||n===Ya||typeof n=="object"&&n!==null&&(n.$$typeof===Bi||n.$$typeof===Oi||n.$$typeof===wi||n.$$typeof===_i||n.$$typeof===Si||n.$$typeof===Za||n.$$typeof===Ja||n.$$typeof===Ha||n.$$typeof===Ka)};z.typeOf=bt;Ms.exports=z;var Xa=Ms.exports,xs=Xa,Ga={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},qa={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Cs={};Cs[xs.ForwardRef]=Ga;Cs[xs.Memo]=qa;var Us={exports:{}},V={};/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var qr=Object.getOwnPropertySymbols,Qa=Object.prototype.hasOwnProperty,tc=Object.prototype.propertyIsEnumerable;function ec(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function nc(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var i=Object.getOwnPropertyNames(t).map(function(s){return t[s]});if(i.join("")!=="0123456789")return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(s){r[s]=s}),Object.keys(Object.assign({},r)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var ic=nc()?Object.assign:function(n,t){for(var e,i=ec(n),r,s=1;s<arguments.length;s++){e=Object(arguments[s]);for(var o in e)Qa.call(e,o)&&(i[o]=e[o]);if(qr){r=qr(e);for(var a=0;a<r.length;a++)tc.call(e,r[a])&&(i[r[a]]=e[r[a]])}}return i};/** @license React v16.14.0
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hr=ic,At=typeof Symbol=="function"&&Symbol.for,bn=At?Symbol.for("react.element"):60103,rc=At?Symbol.for("react.portal"):60106,sc=At?Symbol.for("react.fragment"):60107,oc=At?Symbol.for("react.strict_mode"):60108,ac=At?Symbol.for("react.profiler"):60114,cc=At?Symbol.for("react.provider"):60109,lc=At?Symbol.for("react.context"):60110,uc=At?Symbol.for("react.forward_ref"):60112,dc=At?Symbol.for("react.suspense"):60113,hc=At?Symbol.for("react.memo"):60115,fc=At?Symbol.for("react.lazy"):60116,Qr=typeof Symbol=="function"&&Symbol.iterator;function wn(n){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+n,e=1;e<arguments.length;e++)t+="&args[]="+encodeURIComponent(arguments[e]);return"Minified React error #"+n+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Rs={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Es={};function Qe(n,t,e){this.props=n,this.context=t,this.refs=Es,this.updater=e||Rs}Qe.prototype.isReactComponent={};Qe.prototype.setState=function(n,t){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error(wn(85));this.updater.enqueueSetState(this,n,t,"setState")};Qe.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Ps(){}Ps.prototype=Qe.prototype;function fr(n,t,e){this.props=n,this.context=t,this.refs=Es,this.updater=e||Rs}var pr=fr.prototype=new Ps;pr.constructor=fr;hr(pr,Qe.prototype);pr.isPureReactComponent=!0;var yr={current:null},js=Object.prototype.hasOwnProperty,zs={key:!0,ref:!0,__self:!0,__source:!0};function Vs(n,t,e){var i,r={},s=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)js.call(t,i)&&!zs.hasOwnProperty(i)&&(r[i]=t[i]);var a=arguments.length-2;if(a===1)r.children=e;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];r.children=c}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:bn,type:n,key:s,ref:o,props:r,_owner:yr.current}}function pc(n,t){return{$$typeof:bn,type:n.type,key:t,ref:n.ref,props:n.props,_owner:n._owner}}function mr(n){return typeof n=="object"&&n!==null&&n.$$typeof===bn}function yc(n){var t={"=":"=0",":":"=2"};return"$"+(""+n).replace(/[=:]/g,function(e){return t[e]})}var $s=/\/+/g,jn=[];function Ws(n,t,e,i){if(jn.length){var r=jn.pop();return r.result=n,r.keyPrefix=t,r.func=e,r.context=i,r.count=0,r}return{result:n,keyPrefix:t,func:e,context:i,count:0}}function Ys(n){n.result=null,n.keyPrefix=null,n.func=null,n.context=null,n.count=0,10>jn.length&&jn.push(n)}function Wi(n,t,e,i){var r=typeof n;(r==="undefined"||r==="boolean")&&(n=null);var s=!1;if(n===null)s=!0;else switch(r){case"string":case"number":s=!0;break;case"object":switch(n.$$typeof){case bn:case rc:s=!0}}if(s)return e(i,n,t===""?"."+Mi(n,0):t),1;if(s=0,t=t===""?".":t+":",Array.isArray(n))for(var o=0;o<n.length;o++){r=n[o];var a=t+Mi(r,o);s+=Wi(r,a,e,i)}else if(n===null||typeof n!="object"?a=null:(a=Qr&&n[Qr]||n["@@iterator"],a=typeof a=="function"?a:null),typeof a=="function")for(n=a.call(n),o=0;!(r=n.next()).done;)r=r.value,a=t+Mi(r,o++),s+=Wi(r,a,e,i);else if(r==="object")throw e=""+n,Error(wn(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e,""));return s}function Yi(n,t,e){return n==null?0:Wi(n,"",t,e)}function Mi(n,t){return typeof n=="object"&&n!==null&&n.key!=null?yc(n.key):t.toString(36)}function mc(n,t){n.func.call(n.context,t,n.count++)}function gc(n,t,e){var i=n.result,r=n.keyPrefix;n=n.func.call(n.context,t,n.count++),Array.isArray(n)?Ki(n,i,e,function(s){return s}):n!=null&&(mr(n)&&(n=pc(n,r+(!n.key||t&&t.key===n.key?"":(""+n.key).replace($s,"$&/")+"/")+e)),i.push(n))}function Ki(n,t,e,i,r){var s="";e!=null&&(s=(""+e).replace($s,"$&/")+"/"),t=Ws(t,s,i,r),Yi(n,gc,t),Ys(t)}var Ks={current:null};function ee(){var n=Ks.current;if(n===null)throw Error(wn(321));return n}var bc={ReactCurrentDispatcher:Ks,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:yr,IsSomeRendererActing:{current:!1},assign:hr};V.Children={map:function(n,t,e){if(n==null)return n;var i=[];return Ki(n,i,null,t,e),i},forEach:function(n,t,e){if(n==null)return n;t=Ws(null,null,t,e),Yi(n,mc,t),Ys(t)},count:function(n){return Yi(n,function(){return null},null)},toArray:function(n){var t=[];return Ki(n,t,null,function(e){return e}),t},only:function(n){if(!mr(n))throw Error(wn(143));return n}};V.Component=Qe;V.Fragment=sc;V.Profiler=ac;V.PureComponent=fr;V.StrictMode=oc;V.Suspense=dc;V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bc;V.cloneElement=function(n,t,e){if(n==null)throw Error(wn(267,n));var i=hr({},n.props),r=n.key,s=n.ref,o=n._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=yr.current),t.key!==void 0&&(r=""+t.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(c in t)js.call(t,c)&&!zs.hasOwnProperty(c)&&(i[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)i.children=e;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];i.children=a}return{$$typeof:bn,type:n.type,key:r,ref:s,props:i,_owner:o}};V.createContext=function(n,t){return t===void 0&&(t=null),n={$$typeof:lc,_calculateChangedBits:t,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null},n.Provider={$$typeof:cc,_context:n},n.Consumer=n};V.createElement=Vs;V.createFactory=function(n){var t=Vs.bind(null,n);return t.type=n,t};V.createRef=function(){return{current:null}};V.forwardRef=function(n){return{$$typeof:uc,render:n}};V.isValidElement=mr;V.lazy=function(n){return{$$typeof:fc,_ctor:n,_status:-1,_result:null}};V.memo=function(n,t){return{$$typeof:hc,type:n,compare:t===void 0?null:t}};V.useCallback=function(n,t){return ee().useCallback(n,t)};V.useContext=function(n,t){return ee().useContext(n,t)};V.useDebugValue=function(){};V.useEffect=function(n,t){return ee().useEffect(n,t)};V.useImperativeHandle=function(n,t,e){return ee().useImperativeHandle(n,t,e)};V.useLayoutEffect=function(n,t){return ee().useLayoutEffect(n,t)};V.useMemo=function(n,t){return ee().useMemo(n,t)};V.useReducer=function(n,t,e){return ee().useReducer(n,t,e)};V.useRef=function(n){return ee().useRef(n)};V.useState=function(n){return ee().useState(n)};V.version="16.14.0";Us.exports=V;var wc=Us.exports;const _c=Wa(wc);function g(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(l){try{u(i.next(l))}catch(h){o(h)}}function c(l){try{u(i.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):r(l.value).then(a,c)}u((i=i.apply(n,t||[])).next())})}function ts(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(n){return this instanceof D?(this.v=n,this):new D(n)}function Et(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=e.apply(n,t||[]),r,s=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(f){i[f]&&(r[f]=function(p){return new Promise(function(y,k){s.push([f,p,y,k])>1||a(f,p)})})}function a(f,p){try{c(i[f](p))}catch(y){h(s[0][3],y)}}function c(f){f.value instanceof D?Promise.resolve(f.value.v).then(u,l):h(s[0][2],f)}function u(f){a("next",f)}function l(f){a("throw",f)}function h(f,p){f(p),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Mn(n){var t,e;return t={},i("next"),i("throw",function(r){throw r}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(r,s){t[r]=n[r]?function(o){return(e=!e)?{value:D(n[r](o)),done:!1}:s?s(o):o}:s}}function De(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n[Symbol.asyncIterator],e;return t?t.call(n):(n=typeof ts=="function"?ts(n):n[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(s){e[s]=n[s]&&function(o){return new Promise(function(a,c){o=n[s](o),r(a,c,o.done,o.value)})}}function r(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}const vc=new TextDecoder("utf-8"),Zi=n=>vc.decode(n),Sc=new TextEncoder,gr=n=>Sc.encode(n),[Md,Ic]=(()=>{const n=()=>{throw new Error("BigInt is not available in this environment")};function t(){throw n()}return t.asIntN=()=>{throw n()},t.asUintN=()=>{throw n()},typeof BigInt<"u"?[BigInt,!0]:[t,!1]})(),[_n,Ld]=(()=>{const n=()=>{throw new Error("BigInt64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw n()}static from(){throw n()}constructor(){throw n()}}return typeof BigInt64Array<"u"?[BigInt64Array,!0]:[t,!1]})(),[vn,xd]=(()=>{const n=()=>{throw new Error("BigUint64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw n()}static from(){throw n()}constructor(){throw n()}}return typeof BigUint64Array<"u"?[BigUint64Array,!0]:[t,!1]})(),Oc=n=>typeof n=="number",Zs=n=>typeof n=="boolean",G=n=>typeof n=="function",lt=n=>n!=null&&Object(n)===n,ce=n=>lt(n)&&G(n.then),Sn=n=>lt(n)&&G(n[Symbol.iterator]),tn=n=>lt(n)&&G(n[Symbol.asyncIterator]),Ji=n=>lt(n)&&lt(n.schema),Js=n=>lt(n)&&"done"in n&&"value"in n,Hs=n=>lt(n)&&G(n.stat)&&Oc(n.fd),Xs=n=>lt(n)&&br(n.body),Ai=n=>"_getDOMStream"in n&&"_getNodeStream"in n,Bc=n=>lt(n)&&G(n.abort)&&G(n.getWriter)&&!Ai(n),br=n=>lt(n)&&G(n.cancel)&&G(n.getReader)&&!Ai(n),Ac=n=>lt(n)&&G(n.end)&&G(n.write)&&Zs(n.writable)&&!Ai(n),Gs=n=>lt(n)&&G(n.read)&&G(n.pipe)&&Zs(n.readable)&&!Ai(n),Fc=n=>lt(n)&&G(n.clear)&&G(n.bytes)&&G(n.position)&&G(n.setPosition)&&G(n.capacity)&&G(n.getBufferIdentifier)&&G(n.createLong),wr=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Dc(n){const t=n[0]?[n[0]]:[];let e,i,r,s;for(let o,a,c=0,u=0,l=n.length;++c<l;){if(o=t[u],a=n[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++u]=a);continue}if({byteOffset:e,byteLength:r}=o,{byteOffset:i,byteLength:s}=a,e+r<i||i+s<e){a&&(t[++u]=a);continue}t[u]=new Uint8Array(o.buffer,e,i-e+s)}return t}function es(n,t,e=0,i=t.byteLength){const r=n.byteLength,s=new Uint8Array(n.buffer,n.byteOffset,r),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,r));return s.set(o,e),n}function Vt(n,t){const e=Dc(n),i=e.reduce((l,h)=>l+h.byteLength,0);let r,s,o,a=0,c=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,i);for(const l=e.length;++c<l;){if(r=e[c],s=r.subarray(0,Math.min(r.length,u-a)),u<=a+s.length){s.length<r.length?e[c]=r.subarray(s.length):s.length===r.length&&c++,o?es(o,s,a):o=s;break}es(o||(o=new Uint8Array(u)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),i-(o?o.byteLength:0)]}function W(n,t){let e=Js(t)?t.value:t;return e instanceof n?n===Uint8Array?new n(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=gr(e)),e instanceof ArrayBuffer?new n(e):e instanceof wr?new n(e):Fc(e)?W(n,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new n(0):new n(e.buffer,e.byteOffset,e.byteLength/n.BYTES_PER_ELEMENT):n.from(e)):new n(0)}const nn=n=>W(Int32Array,n),x=n=>W(Uint8Array,n),Hi=n=>(n.next(),n);function*Tc(n,t){const e=function*(r){yield r},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof wr?e(t):Sn(t)?t:e(t);return yield*Hi(function*(r){let s=null;do s=r.next(yield W(n,s));while(!s.done)}(i[Symbol.iterator]())),new n}const kc=n=>Tc(Uint8Array,n);function qs(n,t){return Et(this,arguments,function*(){if(ce(t))return yield D(yield D(yield*Mn(De(qs(n,yield D(t))))));const i=function(o){return Et(this,arguments,function*(){yield yield D(yield D(o))})},r=function(o){return Et(this,arguments,function*(){yield D(yield*Mn(De(Hi(function*(a){let c=null;do c=a.next(yield c==null?void 0:c.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof wr?i(t):Sn(t)?r(t):tn(t)?t:i(t);return yield D(yield*Mn(De(Hi(function(o){return Et(this,arguments,function*(){let a=null;do a=yield D(o.next(yield yield D(W(n,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield D(new n)})}const Nc=n=>qs(Uint8Array,n);function _r(n,t,e){if(n!==0){e=e.slice(0,t+1);for(let i=-1;++i<=t;)e[i]+=n}return e}function Mc(n,t){let e=0;const i=n.length;if(i!==t.length)return!1;if(i>0)do if(n[e]!==t[e])return!1;while(++e<i);return!0}const _t={fromIterable(n){return Dn(Lc(n))},fromAsyncIterable(n){return Dn(xc(n))},fromDOMStream(n){return Dn(Cc(n))},fromNodeStream(n){return Dn(Rc(n))},toDOMStream(n,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(n,t){throw new Error('"toNodeStream" not available in this environment')}},Dn=n=>(n.next(),n);function*Lc(n){let t,e=!1,i=[],r,s,o,a=0;function c(){return s==="peek"?Vt(i,o)[0]:([r,i,a]=Vt(i,o),r)}({cmd:s,size:o}=yield null);const u=kc(n)[Symbol.iterator]();try{do if({done:t,value:r}=Number.isNaN(o-a)?u.next():u.next(o-a),!t&&r.byteLength>0&&(i.push(r),a+=r.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(l){(e=!0)&&typeof u.throw=="function"&&u.throw(l)}finally{e===!1&&typeof u.return=="function"&&u.return(null)}return null}function xc(n){return Et(this,arguments,function*(){let e,i=!1,r=[],s,o,a,c=0;function u(){return o==="peek"?Vt(r,a)[0]:([s,r,c]=Vt(r,a),s)}({cmd:o,size:a}=yield yield D(null));const l=Nc(n)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield D(l.next()):yield D(l.next(a-c)),!e&&s.byteLength>0&&(r.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield D(u()));while(a<c);while(!e)}catch(h){(i=!0)&&typeof l.throw=="function"&&(yield D(l.throw(h)))}finally{i===!1&&typeof l.return=="function"&&(yield D(l.return(new Uint8Array(0))))}return yield D(null)})}function Cc(n){return Et(this,arguments,function*(){let e=!1,i=!1,r=[],s,o,a,c=0;function u(){return o==="peek"?Vt(r,a)[0]:([s,r,c]=Vt(r,a),s)}({cmd:o,size:a}=yield yield D(null));const l=new Uc(n);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield D(l.read()):yield D(l.read(a-c)),!e&&s.byteLength>0&&(r.push(x(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield D(u()));while(a<c);while(!e)}catch(h){(i=!0)&&(yield D(l.cancel(h)))}finally{i===!1?yield D(l.cancel()):n.locked&&l.releaseLock()}return yield D(null)})}class Uc{constructor(t){this.source=t,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(t){return g(this,void 0,void 0,function*(){const{reader:e,source:i}=this;e&&(yield e.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return g(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=x(e)),e})}}const Li=(n,t)=>{const e=r=>i([t,r]);let i;return[t,e,new Promise(r=>(i=r)&&n.once(t,e))]};function Rc(n){return Et(this,arguments,function*(){const e=[];let i="error",r=!1,s=null,o,a,c=0,u=[],l;function h(){return o==="peek"?Vt(u,a)[0]:([l,u,c]=Vt(u,a),l)}if({cmd:o,size:a}=yield yield D(null),n.isTTY)return yield yield D(new Uint8Array(0)),yield D(null);try{e[0]=Li(n,"end"),e[1]=Li(n,"error");do{if(e[2]=Li(n,"readable"),[i,s]=yield D(Promise.race(e.map(p=>p[2]))),i==="error")break;if((r=i==="end")||(Number.isFinite(a-c)?(l=x(n.read(a-c)),l.byteLength<a-c&&(l=x(n.read()))):l=x(n.read()),l.byteLength>0&&(u.push(l),c+=l.byteLength)),r||a<=c)do({cmd:o,size:a}=yield yield D(h()));while(a<c)}while(!r)}finally{yield D(f(e,i==="error"?s:null))}return yield D(null);function f(p,y){return l=u=null,new Promise((k,b)=>{for(const[N,$]of p)n.off(N,$);try{const N=n.destroy;N&&N.call(n,y),y=void 0}catch(N){y=N||y}finally{y!=null?b(y):k()}})}})}var yt;(function(n){n[n.V1=0]="V1",n[n.V2=1]="V2",n[n.V3=2]="V3",n[n.V4=3]="V4",n[n.V5=4]="V5"})(yt||(yt={}));var mt;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(mt||(mt={}));var ct;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(ct||(ct={}));var te;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(te||(te={}));var C;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(C||(C={}));var le;(function(n){n[n.YEAR_MONTH=0]="YEAR_MONTH",n[n.DAY_TIME=1]="DAY_TIME",n[n.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(le||(le={}));var R;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})(R||(R={}));var d;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.Float=3]="Float",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct=13]="Struct",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Dictionary=-1]="Dictionary",n[n.Int8=-2]="Int8",n[n.Int16=-3]="Int16",n[n.Int32=-4]="Int32",n[n.Int64=-5]="Int64",n[n.Uint8=-6]="Uint8",n[n.Uint16=-7]="Uint16",n[n.Uint32=-8]="Uint32",n[n.Uint64=-9]="Uint64",n[n.Float16=-10]="Float16",n[n.Float32=-11]="Float32",n[n.Float64=-12]="Float64",n[n.DateDay=-13]="DateDay",n[n.DateMillisecond=-14]="DateMillisecond",n[n.TimestampSecond=-15]="TimestampSecond",n[n.TimestampMillisecond=-16]="TimestampMillisecond",n[n.TimestampMicrosecond=-17]="TimestampMicrosecond",n[n.TimestampNanosecond=-18]="TimestampNanosecond",n[n.TimeSecond=-19]="TimeSecond",n[n.TimeMillisecond=-20]="TimeMillisecond",n[n.TimeMicrosecond=-21]="TimeMicrosecond",n[n.TimeNanosecond=-22]="TimeNanosecond",n[n.DenseUnion=-23]="DenseUnion",n[n.SparseUnion=-24]="SparseUnion",n[n.IntervalDayTime=-25]="IntervalDayTime",n[n.IntervalYearMonth=-26]="IntervalYearMonth"})(d||(d={}));var Zt;(function(n){n[n.OFFSET=0]="OFFSET",n[n.DATA=1]="DATA",n[n.VALIDITY=2]="VALIDITY",n[n.TYPE=3]="TYPE"})(Zt||(Zt={}));const Ec=void 0;function un(n){if(n===null)return"null";if(n===Ec)return"undefined";switch(typeof n){case"number":return`${n}`;case"bigint":return`${n}`;case"string":return`"${n}"`}return typeof n[Symbol.toPrimitive]=="function"?n[Symbol.toPrimitive]("string"):ArrayBuffer.isView(n)?n instanceof _n||n instanceof vn?`[${[...n].map(t=>un(t))}]`:`[${n}]`:ArrayBuffer.isView(n)?`[${n}]`:JSON.stringify(n,(t,e)=>typeof e=="bigint"?`${e}`:e)}const Pc=Symbol.for("isArrowBigNum");function Ft(n,...t){return t.length===0?Object.setPrototypeOf(W(this.TypedArray,n),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(n,...t),this.constructor.prototype)}Ft.prototype[Pc]=!0;Ft.prototype.toJSON=function(){return`"${Te(this)}"`};Ft.prototype.valueOf=function(){return Qs(this)};Ft.prototype.toString=function(){return Te(this)};Ft.prototype[Symbol.toPrimitive]=function(n="default"){switch(n){case"number":return Qs(this);case"string":return Te(this);case"default":return Xi(this)}return Te(this)};function ze(...n){return Ft.apply(this,n)}function Ve(...n){return Ft.apply(this,n)}function dn(...n){return Ft.apply(this,n)}Object.setPrototypeOf(ze.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Ve.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(dn.prototype,Object.create(Uint32Array.prototype));Object.assign(ze.prototype,Ft.prototype,{constructor:ze,signed:!0,TypedArray:Int32Array,BigIntArray:_n});Object.assign(Ve.prototype,Ft.prototype,{constructor:Ve,signed:!1,TypedArray:Uint32Array,BigIntArray:vn});Object.assign(dn.prototype,Ft.prototype,{constructor:dn,signed:!0,TypedArray:Uint32Array,BigIntArray:vn});function Qs(n){const{buffer:t,byteOffset:e,length:i,signed:r}=n,s=new vn(t,e,i),o=r&&s[s.length-1]&BigInt(1)<<BigInt(63);let a=BigInt(o?1:0),c=BigInt(0);if(o){for(const u of s)a+=~u*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(const u of s)a+=u*(BigInt(1)<<BigInt(32)*c++);return a}let Te,Xi;Ic?(Xi=n=>n.byteLength===8?new n.BigIntArray(n.buffer,n.byteOffset,1)[0]:xi(n),Te=n=>n.byteLength===8?`${new n.BigIntArray(n.buffer,n.byteOffset,1)[0]}`:xi(n)):(Te=xi,Xi=Te);function xi(n){let t="";const e=new Uint32Array(2);let i=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2);const r=new Uint32Array((i=new Uint16Array(i).reverse()).buffer);let s=-1;const o=i.length-1;do{for(e[0]=i[s=0];s<o;)i[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+i[s];i[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(r[0]||r[1]||r[2]||r[3]);return t??"0"}class vr{static new(t,e){switch(e){case!0:return new ze(t);case!1:return new Ve(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case _n:return new ze(t)}return t.byteLength===16?new dn(t):new Ve(t)}static signed(t){return new ze(t)}static unsigned(t){return new Ve(t)}static decimal(t){return new dn(t)}constructor(t,e){return vr.new(t,e)}}var to,eo,no,io,ro,so,oo,ao,co,lo,uo,ho,fo,po,yo,mo,go,bo,wo;class w{static isNull(t){return(t==null?void 0:t.typeId)===d.Null}static isInt(t){return(t==null?void 0:t.typeId)===d.Int}static isFloat(t){return(t==null?void 0:t.typeId)===d.Float}static isBinary(t){return(t==null?void 0:t.typeId)===d.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===d.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===d.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===d.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===d.Date}static isTime(t){return(t==null?void 0:t.typeId)===d.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===d.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===d.Interval}static isList(t){return(t==null?void 0:t.typeId)===d.List}static isStruct(t){return(t==null?void 0:t.typeId)===d.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===d.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===d.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===d.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===d.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===d.Dictionary}static isDenseUnion(t){return w.isUnion(t)&&t.mode===mt.Dense}static isSparseUnion(t){return w.isUnion(t)&&t.mode===mt.Sparse}get typeId(){return d.NONE}}to=Symbol.toStringTag;w[to]=(n=>(n.children=null,n.ArrayType=Array,n[Symbol.toStringTag]="DataType"))(w.prototype);let ue=class extends w{toString(){return"Null"}get typeId(){return d.Null}};eo=Symbol.toStringTag;ue[eo]=(n=>n[Symbol.toStringTag]="Null")(ue.prototype);class de extends w{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return d.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?_n:vn}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}no=Symbol.toStringTag;de[no]=(n=>(n.isSigned=null,n.bitWidth=null,n[Symbol.toStringTag]="Int"))(de.prototype);class hn extends de{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(hn.prototype,"ArrayType",{value:Int32Array});class fn extends w{constructor(t){super(),this.precision=t}get typeId(){return d.Float}get ArrayType(){switch(this.precision){case ct.HALF:return Uint16Array;case ct.SINGLE:return Float32Array;case ct.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}io=Symbol.toStringTag;fn[io]=(n=>(n.precision=null,n[Symbol.toStringTag]="Float"))(fn.prototype);let zn=class extends w{constructor(){super()}get typeId(){return d.Binary}toString(){return"Binary"}};ro=Symbol.toStringTag;zn[ro]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Binary"))(zn.prototype);let Vn=class extends w{constructor(){super()}get typeId(){return d.Utf8}toString(){return"Utf8"}};so=Symbol.toStringTag;Vn[so]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Utf8"))(Vn.prototype);let $n=class extends w{constructor(){super()}get typeId(){return d.Bool}toString(){return"Bool"}};oo=Symbol.toStringTag;$n[oo]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Bool"))($n.prototype);let Wn=class extends w{constructor(t,e,i=128){super(),this.scale=t,this.precision=e,this.bitWidth=i}get typeId(){return d.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};ao=Symbol.toStringTag;Wn[ao]=(n=>(n.scale=null,n.precision=null,n.ArrayType=Uint32Array,n[Symbol.toStringTag]="Decimal"))(Wn.prototype);class Yn extends w{constructor(t){super(),this.unit=t}get typeId(){return d.Date}toString(){return`Date${(this.unit+1)*32}<${te[this.unit]}>`}}co=Symbol.toStringTag;Yn[co]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Date"))(Yn.prototype);class pn extends w{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return d.Time}toString(){return`Time${this.bitWidth}<${C[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return _n}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}lo=Symbol.toStringTag;pn[lo]=(n=>(n.unit=null,n.bitWidth=null,n[Symbol.toStringTag]="Time"))(pn.prototype);class Kn extends w{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return d.Timestamp}toString(){return`Timestamp<${C[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}uo=Symbol.toStringTag;Kn[uo]=(n=>(n.unit=null,n.timezone=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Timestamp"))(Kn.prototype);class Zn extends w{constructor(t){super(),this.unit=t}get typeId(){return d.Interval}toString(){return`Interval<${le[this.unit]}>`}}ho=Symbol.toStringTag;Zn[ho]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Interval"))(Zn.prototype);let Jn=class extends w{constructor(t){super(),this.children=[t]}get typeId(){return d.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};fo=Symbol.toStringTag;Jn[fo]=(n=>(n.children=null,n[Symbol.toStringTag]="List"))(Jn.prototype);class nt extends w{constructor(t){super(),this.children=t}get typeId(){return d.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}po=Symbol.toStringTag;nt[po]=(n=>(n.children=null,n[Symbol.toStringTag]="Struct"))(nt.prototype);class Hn extends w{constructor(t,e,i){super(),this.mode=t,this.children=i,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((r,s,o)=>(r[s]=o)&&r||r,Object.create(null))}get typeId(){return d.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}yo=Symbol.toStringTag;Hn[yo]=(n=>(n.mode=null,n.typeIds=null,n.children=null,n.typeIdToChildIndex=null,n.ArrayType=Int8Array,n[Symbol.toStringTag]="Union"))(Hn.prototype);let Xn=class extends w{constructor(t){super(),this.byteWidth=t}get typeId(){return d.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};mo=Symbol.toStringTag;Xn[mo]=(n=>(n.byteWidth=null,n.ArrayType=Uint8Array,n[Symbol.toStringTag]="FixedSizeBinary"))(Xn.prototype);let Gn=class extends w{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return d.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};go=Symbol.toStringTag;Gn[go]=(n=>(n.children=null,n.listSize=null,n[Symbol.toStringTag]="FixedSizeList"))(Gn.prototype);class qn extends w{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return d.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}bo=Symbol.toStringTag;qn[bo]=(n=>(n.children=null,n.keysSorted=null,n[Symbol.toStringTag]="Map_"))(qn.prototype);const jc=(n=>()=>++n)(-1);class Ke extends w{constructor(t,e,i,r){super(),this.indices=e,this.dictionary=t,this.isOrdered=r||!1,this.id=i==null?jc():typeof i=="number"?i:i.low}get typeId(){return d.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}wo=Symbol.toStringTag;Ke[wo]=(n=>(n.id=null,n.indices=null,n.isOrdered=null,n.dictionary=null,n[Symbol.toStringTag]="Dictionary"))(Ke.prototype);function Jt(n){const t=n;switch(n.typeId){case d.Decimal:return n.bitWidth/32;case d.Timestamp:return 2;case d.Date:return 1+t.unit;case d.Interval:return 1+t.unit;case d.FixedSizeList:return t.listSize;case d.FixedSizeBinary:return t.byteWidth;default:return 1}}class L{visitMany(t,...e){return t.map((i,r)=>this.visit(i,...e.map(s=>s[r])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return zc(this,t,e)}getVisitFnByTypeId(t,e=!0){return xe(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function zc(n,t,e=!0){return typeof t=="number"?xe(n,t,e):typeof t=="string"&&t in d?xe(n,d[t],e):t&&t instanceof w?xe(n,ns(t),e):t!=null&&t.type&&t.type instanceof w?xe(n,ns(t.type),e):xe(n,d.NONE,e)}function xe(n,t,e=!0){let i=null;switch(t){case d.Null:i=n.visitNull;break;case d.Bool:i=n.visitBool;break;case d.Int:i=n.visitInt;break;case d.Int8:i=n.visitInt8||n.visitInt;break;case d.Int16:i=n.visitInt16||n.visitInt;break;case d.Int32:i=n.visitInt32||n.visitInt;break;case d.Int64:i=n.visitInt64||n.visitInt;break;case d.Uint8:i=n.visitUint8||n.visitInt;break;case d.Uint16:i=n.visitUint16||n.visitInt;break;case d.Uint32:i=n.visitUint32||n.visitInt;break;case d.Uint64:i=n.visitUint64||n.visitInt;break;case d.Float:i=n.visitFloat;break;case d.Float16:i=n.visitFloat16||n.visitFloat;break;case d.Float32:i=n.visitFloat32||n.visitFloat;break;case d.Float64:i=n.visitFloat64||n.visitFloat;break;case d.Utf8:i=n.visitUtf8;break;case d.Binary:i=n.visitBinary;break;case d.FixedSizeBinary:i=n.visitFixedSizeBinary;break;case d.Date:i=n.visitDate;break;case d.DateDay:i=n.visitDateDay||n.visitDate;break;case d.DateMillisecond:i=n.visitDateMillisecond||n.visitDate;break;case d.Timestamp:i=n.visitTimestamp;break;case d.TimestampSecond:i=n.visitTimestampSecond||n.visitTimestamp;break;case d.TimestampMillisecond:i=n.visitTimestampMillisecond||n.visitTimestamp;break;case d.TimestampMicrosecond:i=n.visitTimestampMicrosecond||n.visitTimestamp;break;case d.TimestampNanosecond:i=n.visitTimestampNanosecond||n.visitTimestamp;break;case d.Time:i=n.visitTime;break;case d.TimeSecond:i=n.visitTimeSecond||n.visitTime;break;case d.TimeMillisecond:i=n.visitTimeMillisecond||n.visitTime;break;case d.TimeMicrosecond:i=n.visitTimeMicrosecond||n.visitTime;break;case d.TimeNanosecond:i=n.visitTimeNanosecond||n.visitTime;break;case d.Decimal:i=n.visitDecimal;break;case d.List:i=n.visitList;break;case d.Struct:i=n.visitStruct;break;case d.Union:i=n.visitUnion;break;case d.DenseUnion:i=n.visitDenseUnion||n.visitUnion;break;case d.SparseUnion:i=n.visitSparseUnion||n.visitUnion;break;case d.Dictionary:i=n.visitDictionary;break;case d.Interval:i=n.visitInterval;break;case d.IntervalDayTime:i=n.visitIntervalDayTime||n.visitInterval;break;case d.IntervalYearMonth:i=n.visitIntervalYearMonth||n.visitInterval;break;case d.FixedSizeList:i=n.visitFixedSizeList;break;case d.Map:i=n.visitMap;break}if(typeof i=="function")return i;if(!e)return()=>null;throw new Error(`Unrecognized type '${d[t]}'`)}function ns(n){switch(n.typeId){case d.Null:return d.Null;case d.Int:{const{bitWidth:t,isSigned:e}=n;switch(t){case 8:return e?d.Int8:d.Uint8;case 16:return e?d.Int16:d.Uint16;case 32:return e?d.Int32:d.Uint32;case 64:return e?d.Int64:d.Uint64}return d.Int}case d.Float:switch(n.precision){case ct.HALF:return d.Float16;case ct.SINGLE:return d.Float32;case ct.DOUBLE:return d.Float64}return d.Float;case d.Binary:return d.Binary;case d.Utf8:return d.Utf8;case d.Bool:return d.Bool;case d.Decimal:return d.Decimal;case d.Time:switch(n.unit){case C.SECOND:return d.TimeSecond;case C.MILLISECOND:return d.TimeMillisecond;case C.MICROSECOND:return d.TimeMicrosecond;case C.NANOSECOND:return d.TimeNanosecond}return d.Time;case d.Timestamp:switch(n.unit){case C.SECOND:return d.TimestampSecond;case C.MILLISECOND:return d.TimestampMillisecond;case C.MICROSECOND:return d.TimestampMicrosecond;case C.NANOSECOND:return d.TimestampNanosecond}return d.Timestamp;case d.Date:switch(n.unit){case te.DAY:return d.DateDay;case te.MILLISECOND:return d.DateMillisecond}return d.Date;case d.Interval:switch(n.unit){case le.DAY_TIME:return d.IntervalDayTime;case le.YEAR_MONTH:return d.IntervalYearMonth}return d.Interval;case d.Map:return d.Map;case d.List:return d.List;case d.Struct:return d.Struct;case d.Union:switch(n.mode){case mt.Dense:return d.DenseUnion;case mt.Sparse:return d.SparseUnion}return d.Union;case d.FixedSizeBinary:return d.FixedSizeBinary;case d.FixedSizeList:return d.FixedSizeList;case d.Dictionary:return d.Dictionary}throw new Error(`Unrecognized type '${d[n.typeId]}'`)}L.prototype.visitInt8=null;L.prototype.visitInt16=null;L.prototype.visitInt32=null;L.prototype.visitInt64=null;L.prototype.visitUint8=null;L.prototype.visitUint16=null;L.prototype.visitUint32=null;L.prototype.visitUint64=null;L.prototype.visitFloat16=null;L.prototype.visitFloat32=null;L.prototype.visitFloat64=null;L.prototype.visitDateDay=null;L.prototype.visitDateMillisecond=null;L.prototype.visitTimestampSecond=null;L.prototype.visitTimestampMillisecond=null;L.prototype.visitTimestampMicrosecond=null;L.prototype.visitTimestampNanosecond=null;L.prototype.visitTimeSecond=null;L.prototype.visitTimeMillisecond=null;L.prototype.visitTimeMicrosecond=null;L.prototype.visitTimeNanosecond=null;L.prototype.visitDenseUnion=null;L.prototype.visitSparseUnion=null;L.prototype.visitIntervalDayTime=null;L.prototype.visitIntervalYearMonth=null;const _o=new Float64Array(1),Le=new Uint32Array(_o.buffer);function vo(n){const t=(n&31744)>>10,e=(n&1023)/1024,i=Math.pow(-1,(n&32768)>>15);switch(t){case 31:return i*(e?Number.NaN:1/0);case 0:return i*(e?6103515625e-14*e:0)}return i*Math.pow(2,t-15)*(1+e)}function Vc(n){if(n!==n)return 32256;_o[0]=n;const t=(Le[1]&2147483648)>>16&65535;let e=Le[1]&2146435072,i=0;return e>=1089470464?Le[0]>0?e=31744:(e=(e&2080374784)>>16,i=(Le[1]&1048575)>>10):e<=1056964608?(i=1048576+(Le[1]&1048575),i=1048576+(i<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,i=(Le[1]&1048575)+512>>10),t|e|i&65535}class O extends L{}function F(n){return(t,e,i)=>{if(t.setValid(e,i!=null))return n(t,e,i)}}const $c=(n,t,e)=>{n[t]=Math.trunc(e/864e5)},Sr=(n,t,e)=>{n[t]=Math.trunc(e%4294967296),n[t+1]=Math.trunc(e/4294967296)},Wc=(n,t,e)=>{n[t]=Math.trunc(e*1e3%4294967296),n[t+1]=Math.trunc(e*1e3/4294967296)},Yc=(n,t,e)=>{n[t]=Math.trunc(e*1e6%4294967296),n[t+1]=Math.trunc(e*1e6/4294967296)},So=(n,t,e,i)=>{if(e+1<t.length){const{[e]:r,[e+1]:s}=t;n.set(i.subarray(0,s-r),r)}},Kc=({offset:n,values:t},e,i)=>{const r=n+e;i?t[r>>3]|=1<<r%8:t[r>>3]&=~(1<<r%8)},ne=({values:n},t,e)=>{n[t]=e},Ir=({values:n},t,e)=>{n[t]=e},Io=({values:n},t,e)=>{n[t]=Vc(e)},Zc=(n,t,e)=>{switch(n.type.precision){case ct.HALF:return Io(n,t,e);case ct.SINGLE:case ct.DOUBLE:return Ir(n,t,e)}},Oo=({values:n},t,e)=>{$c(n,t,e.valueOf())},Bo=({values:n},t,e)=>{Sr(n,t*2,e.valueOf())},Jc=({stride:n,values:t},e,i)=>{t.set(i.subarray(0,n),n*e)},Hc=({values:n,valueOffsets:t},e,i)=>So(n,t,e,i),Xc=({values:n,valueOffsets:t},e,i)=>{So(n,t,e,gr(i))},Gc=(n,t,e)=>{n.type.unit===te.DAY?Oo(n,t,e):Bo(n,t,e)},Ao=({values:n},t,e)=>Sr(n,t*2,e/1e3),Fo=({values:n},t,e)=>Sr(n,t*2,e),Do=({values:n},t,e)=>Wc(n,t*2,e),To=({values:n},t,e)=>Yc(n,t*2,e),qc=(n,t,e)=>{switch(n.type.unit){case C.SECOND:return Ao(n,t,e);case C.MILLISECOND:return Fo(n,t,e);case C.MICROSECOND:return Do(n,t,e);case C.NANOSECOND:return To(n,t,e)}},ko=({values:n},t,e)=>{n[t]=e},No=({values:n},t,e)=>{n[t]=e},Mo=({values:n},t,e)=>{n[t]=e},Lo=({values:n},t,e)=>{n[t]=e},Qc=(n,t,e)=>{switch(n.type.unit){case C.SECOND:return ko(n,t,e);case C.MILLISECOND:return No(n,t,e);case C.MICROSECOND:return Mo(n,t,e);case C.NANOSECOND:return Lo(n,t,e)}},tl=({values:n,stride:t},e,i)=>{n.set(i.subarray(0,t),t*e)},el=(n,t,e)=>{const i=n.children[0],r=n.valueOffsets,s=It.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=r[t],c=r[t+1];a<c;)s(i,a++,e[++o]);else for(let o=-1,a=r[t],c=r[t+1];a<c;)s(i,a++,e.get(++o))},nl=(n,t,e)=>{const i=n.children[0],{valueOffsets:r}=n,s=It.getVisitFn(i);let{[t]:o,[t+1]:a}=r;const c=e instanceof Map?e.entries():Object.entries(e);for(const u of c)if(s(i,o,u),++o>=a)break},il=(n,t)=>(e,i,r,s)=>i&&e(i,n,t[s]),rl=(n,t)=>(e,i,r,s)=>i&&e(i,n,t.get(s)),sl=(n,t)=>(e,i,r,s)=>i&&e(i,n,t.get(r.name)),ol=(n,t)=>(e,i,r,s)=>i&&e(i,n,t[r.name]),al=(n,t,e)=>{const i=n.type.children.map(s=>It.getVisitFn(s.type)),r=e instanceof Map?sl(t,e):e instanceof E?rl(t,e):Array.isArray(e)?il(t,e):ol(t,e);n.type.children.forEach((s,o)=>r(i[o],n.children[o],s,o))},cl=(n,t,e)=>{n.type.mode===mt.Dense?xo(n,t,e):Co(n,t,e)},xo=(n,t,e)=>{const i=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[i];It.visit(r,n.valueOffsets[t],e)},Co=(n,t,e)=>{const i=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[i];It.visit(r,t,e)},ll=(n,t,e)=>{var i;(i=n.dictionary)===null||i===void 0||i.set(n.values[t],e)},ul=(n,t,e)=>{n.type.unit===le.DAY_TIME?Uo(n,t,e):Ro(n,t,e)},Uo=({values:n},t,e)=>{n.set(e.subarray(0,2),2*t)},Ro=({values:n},t,e)=>{n[t]=e[0]*12+e[1]%12},dl=(n,t,e)=>{const{stride:i}=n,r=n.children[0],s=It.getVisitFn(r);if(Array.isArray(e))for(let o=-1,a=t*i;++o<i;)s(r,a+o,e[o]);else for(let o=-1,a=t*i;++o<i;)s(r,a+o,e.get(o))};O.prototype.visitBool=F(Kc);O.prototype.visitInt=F(ne);O.prototype.visitInt8=F(ne);O.prototype.visitInt16=F(ne);O.prototype.visitInt32=F(ne);O.prototype.visitInt64=F(ne);O.prototype.visitUint8=F(ne);O.prototype.visitUint16=F(ne);O.prototype.visitUint32=F(ne);O.prototype.visitUint64=F(ne);O.prototype.visitFloat=F(Zc);O.prototype.visitFloat16=F(Io);O.prototype.visitFloat32=F(Ir);O.prototype.visitFloat64=F(Ir);O.prototype.visitUtf8=F(Xc);O.prototype.visitBinary=F(Hc);O.prototype.visitFixedSizeBinary=F(Jc);O.prototype.visitDate=F(Gc);O.prototype.visitDateDay=F(Oo);O.prototype.visitDateMillisecond=F(Bo);O.prototype.visitTimestamp=F(qc);O.prototype.visitTimestampSecond=F(Ao);O.prototype.visitTimestampMillisecond=F(Fo);O.prototype.visitTimestampMicrosecond=F(Do);O.prototype.visitTimestampNanosecond=F(To);O.prototype.visitTime=F(Qc);O.prototype.visitTimeSecond=F(ko);O.prototype.visitTimeMillisecond=F(No);O.prototype.visitTimeMicrosecond=F(Mo);O.prototype.visitTimeNanosecond=F(Lo);O.prototype.visitDecimal=F(tl);O.prototype.visitList=F(el);O.prototype.visitStruct=F(al);O.prototype.visitUnion=F(cl);O.prototype.visitDenseUnion=F(xo);O.prototype.visitSparseUnion=F(Co);O.prototype.visitDictionary=F(ll);O.prototype.visitInterval=F(ul);O.prototype.visitIntervalDayTime=F(Uo);O.prototype.visitIntervalYearMonth=F(Ro);O.prototype.visitFixedSizeList=F(dl);O.prototype.visitMap=F(nl);const It=new O,Ot=Symbol.for("parent"),$e=Symbol.for("rowIndex");class Or{constructor(t,e){return this[Ot]=t,this[$e]=e,new Proxy(this,new fl)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[$e],e=this[Ot],i=e.type.children,r={};for(let s=-1,o=i.length;++s<o;)r[i[s].name]=ut.visit(e.children[s],t);return r}toString(){return`{${[...this].map(([t,e])=>`${un(t)}: ${un(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new hl(this[Ot],this[$e])}}class hl{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ut.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Or.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ot]:{writable:!0,enumerable:!1,configurable:!1,value:null},[$e]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class fl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ot].type.children.map(e=>e.name)}has(t,e){return t[Ot].type.children.findIndex(i=>i.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ot].type.children.findIndex(i=>i.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[Ot].type.children.findIndex(r=>r.name===e);if(i!==-1){const r=ut.visit(t[Ot].children[i],t[$e]);return Reflect.set(t,e,r),r}}set(t,e,i){const r=t[Ot].type.children.findIndex(s=>s.name===e);return r!==-1?(It.visit(t[Ot].children[r],t[$e],i),Reflect.set(t,e,i)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,i):!1}}class _ extends L{}function B(n){return(t,e)=>t.getValid(e)?n(t,e):null}const pl=(n,t)=>864e5*n[t],Br=(n,t)=>4294967296*n[t+1]+(n[t]>>>0),yl=(n,t)=>4294967296*(n[t+1]/1e3)+(n[t]>>>0)/1e3,ml=(n,t)=>4294967296*(n[t+1]/1e6)+(n[t]>>>0)/1e6,Eo=n=>new Date(n),gl=(n,t)=>Eo(pl(n,t)),bl=(n,t)=>Eo(Br(n,t)),wl=(n,t)=>null,Po=(n,t,e)=>{if(e+1>=t.length)return null;const i=t[e],r=t[e+1];return n.subarray(i,r)},_l=({offset:n,values:t},e)=>{const i=n+e;return(t[i>>3]&1<<i%8)!==0},jo=({values:n},t)=>gl(n,t),zo=({values:n},t)=>bl(n,t*2),pe=({stride:n,values:t},e)=>t[n*e],vl=({stride:n,values:t},e)=>vo(t[n*e]),Vo=({values:n},t)=>n[t],Sl=({stride:n,values:t},e)=>t.subarray(n*e,n*(e+1)),Il=({values:n,valueOffsets:t},e)=>Po(n,t,e),Ol=({values:n,valueOffsets:t},e)=>{const i=Po(n,t,e);return i!==null?Zi(i):null},Bl=({values:n},t)=>n[t],Al=({type:n,values:t},e)=>n.precision!==ct.HALF?t[e]:vo(t[e]),Fl=(n,t)=>n.type.unit===te.DAY?jo(n,t):zo(n,t),$o=({values:n},t)=>1e3*Br(n,t*2),Wo=({values:n},t)=>Br(n,t*2),Yo=({values:n},t)=>yl(n,t*2),Ko=({values:n},t)=>ml(n,t*2),Dl=(n,t)=>{switch(n.type.unit){case C.SECOND:return $o(n,t);case C.MILLISECOND:return Wo(n,t);case C.MICROSECOND:return Yo(n,t);case C.NANOSECOND:return Ko(n,t)}},Zo=({values:n},t)=>n[t],Jo=({values:n},t)=>n[t],Ho=({values:n},t)=>n[t],Xo=({values:n},t)=>n[t],Tl=(n,t)=>{switch(n.type.unit){case C.SECOND:return Zo(n,t);case C.MILLISECOND:return Jo(n,t);case C.MICROSECOND:return Ho(n,t);case C.NANOSECOND:return Xo(n,t)}},kl=({values:n,stride:t},e)=>vr.decimal(n.subarray(t*e,t*(e+1))),Nl=(n,t)=>{const{valueOffsets:e,stride:i,children:r}=n,{[t*i]:s,[t*i+1]:o}=e,c=r[0].slice(s,o-s);return new E([c])},Ml=(n,t)=>{const{valueOffsets:e,children:i}=n,{[t]:r,[t+1]:s}=e,o=i[0];return new Ar(o.slice(r,s-r))},Ll=(n,t)=>new Or(n,t),xl=(n,t)=>n.type.mode===mt.Dense?Go(n,t):qo(n,t),Go=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[e];return ut.visit(i,n.valueOffsets[t])},qo=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[e];return ut.visit(i,t)},Cl=(n,t)=>{var e;return(e=n.dictionary)===null||e===void 0?void 0:e.get(n.values[t])},Ul=(n,t)=>n.type.unit===le.DAY_TIME?Qo(n,t):ta(n,t),Qo=({values:n},t)=>n.subarray(2*t,2*(t+1)),ta=({values:n},t)=>{const e=n[t],i=new Int32Array(2);return i[0]=Math.trunc(e/12),i[1]=Math.trunc(e%12),i},Rl=(n,t)=>{const{stride:e,children:i}=n,s=i[0].slice(t*e,e);return new E([s])};_.prototype.visitNull=B(wl);_.prototype.visitBool=B(_l);_.prototype.visitInt=B(Bl);_.prototype.visitInt8=B(pe);_.prototype.visitInt16=B(pe);_.prototype.visitInt32=B(pe);_.prototype.visitInt64=B(Vo);_.prototype.visitUint8=B(pe);_.prototype.visitUint16=B(pe);_.prototype.visitUint32=B(pe);_.prototype.visitUint64=B(Vo);_.prototype.visitFloat=B(Al);_.prototype.visitFloat16=B(vl);_.prototype.visitFloat32=B(pe);_.prototype.visitFloat64=B(pe);_.prototype.visitUtf8=B(Ol);_.prototype.visitBinary=B(Il);_.prototype.visitFixedSizeBinary=B(Sl);_.prototype.visitDate=B(Fl);_.prototype.visitDateDay=B(jo);_.prototype.visitDateMillisecond=B(zo);_.prototype.visitTimestamp=B(Dl);_.prototype.visitTimestampSecond=B($o);_.prototype.visitTimestampMillisecond=B(Wo);_.prototype.visitTimestampMicrosecond=B(Yo);_.prototype.visitTimestampNanosecond=B(Ko);_.prototype.visitTime=B(Tl);_.prototype.visitTimeSecond=B(Zo);_.prototype.visitTimeMillisecond=B(Jo);_.prototype.visitTimeMicrosecond=B(Ho);_.prototype.visitTimeNanosecond=B(Xo);_.prototype.visitDecimal=B(kl);_.prototype.visitList=B(Nl);_.prototype.visitStruct=B(Ll);_.prototype.visitUnion=B(xl);_.prototype.visitDenseUnion=B(Go);_.prototype.visitSparseUnion=B(qo);_.prototype.visitDictionary=B(Cl);_.prototype.visitInterval=B(Ul);_.prototype.visitIntervalDayTime=B(Qo);_.prototype.visitIntervalYearMonth=B(ta);_.prototype.visitFixedSizeList=B(Rl);_.prototype.visitMap=B(Ml);const ut=new _,Mt=Symbol.for("keys"),We=Symbol.for("vals");class Ar{constructor(t){return this[Mt]=new E([t.children[0]]).memoize(),this[We]=t.children[1],new Proxy(this,new Pl)}[Symbol.iterator](){return new El(this[Mt],this[We])}get size(){return this[Mt].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Mt],e=this[We],i={};for(let r=-1,s=t.length;++r<s;)i[t.get(r)]=ut.visit(e,r);return i}toString(){return`{${[...this].map(([t,e])=>`${un(t)}: ${un(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class El{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ut.visit(this.vals,t)]})}}class Pl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Mt].toArray().map(String)}has(t,e){return t[Mt].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Mt].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[Mt].indexOf(e);if(i!==-1){const r=ut.visit(Reflect.get(t,We),i);return Reflect.set(t,e,r),r}}set(t,e,i){const r=t[Mt].indexOf(e);return r!==-1?(It.visit(Reflect.get(t,We),r,i),Reflect.set(t,e,i)):Reflect.has(t,e)?Reflect.set(t,e,i):!1}}Object.defineProperties(Ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Mt]:{writable:!0,enumerable:!1,configurable:!1,value:null},[We]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let is;function ea(n,t,e,i){const{length:r=0}=n;let s=typeof t!="number"?0:t,o=typeof e!="number"?r:e;return s<0&&(s=(s%r+r)%r),o<0&&(o=(o%r+r)%r),o<s&&(is=s,s=o,o=is),o>r&&(o=r),i?i(n,s,o):[s,o]}const rs=n=>n!==n;function en(n){if(typeof n!=="object"||n===null)return rs(n)?rs:e=>e===n;if(n instanceof Date){const e=n.valueOf();return i=>i instanceof Date?i.valueOf()===e:!1}return ArrayBuffer.isView(n)?e=>e?Mc(n,e):!1:n instanceof Map?zl(n):Array.isArray(n)?jl(n):n instanceof E?Vl(n):$l(n,!0)}function jl(n){const t=[];for(let e=-1,i=n.length;++e<i;)t[e]=en(n[e]);return Fi(t)}function zl(n){let t=-1;const e=[];for(const i of n.values())e[++t]=en(i);return Fi(e)}function Vl(n){const t=[];for(let e=-1,i=n.length;++e<i;)t[e]=en(n.get(e));return Fi(t)}function $l(n,t=!1){const e=Object.keys(n);if(!t&&e.length===0)return()=>!1;const i=[];for(let r=-1,s=e.length;++r<s;)i[r]=en(n[e[r]]);return Fi(i,e)}function Fi(n,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Wl(n,e);case Map:return ss(n,e,e.keys());case Ar:case Or:case Object:case void 0:return ss(n,e,t||Object.keys(e))}return e instanceof E?Yl(n,e):!1}}function Wl(n,t){const e=n.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!n[i](t[i]))return!1;return!0}function Yl(n,t){const e=n.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!n[i](t.get(i)))return!1;return!0}function ss(n,t,e){const i=e[Symbol.iterator](),r=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let o=0;const a=n.length;let c=s.next(),u=i.next(),l=r.next();for(;o<a&&!u.done&&!l.done&&!c.done&&!(u.value!==l.value||!n[o](c.value));++o,u=i.next(),l=r.next(),c=s.next());return o===a&&u.done&&l.done&&c.done?!0:(i.return&&i.return(),r.return&&r.return(),s.return&&s.return(),!1)}function na(n,t,e,i){return(e&1<<i)!==0}function Kl(n,t,e,i){return(e&1<<i)>>i}function Fr(n,t,e){const i=e.byteLength+7&-8;if(n>0||e.byteLength<i){const r=new Uint8Array(i);return r.set(n%8===0?e.subarray(n>>3):Qn(new Dr(e,n,t,null,na)).subarray(0,i)),r}return e}function Qn(n){const t=[];let e=0,i=0,r=0;for(const o of n)o&&(r|=1<<i),++i===8&&(t[e++]=r,r=i=0);(e===0||i>0)&&(t[e++]=r);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class Dr{constructor(t,e,i,r,s){this.bytes=t,this.length=i,this.context=r,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[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 Gi(n,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(const o of new Dr(n,t,e-t,n,Kl))s+=o;return s}const i=e>>3<<3,r=t+(t%8===0?0:8-t%8);return Gi(n,t,r)+Gi(n,i,e)+Zl(n,r>>3,i-r>>3)}function Zl(n,t,e){let i=0,r=Math.trunc(t);const s=new DataView(n.buffer,n.byteOffset,n.byteLength),o=e===void 0?n.byteLength:r+e;for(;o-r>=4;)i+=Ci(s.getUint32(r)),r+=4;for(;o-r>=2;)i+=Ci(s.getUint16(r)),r+=2;for(;o-r>=1;)i+=Ci(s.getUint8(r)),r+=1;return i}function Ci(n){let t=Math.trunc(n);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Jl=-1;class K{constructor(t,e,i,r,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(r||0,-1));let c;s instanceof K?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Jt(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let t=0;const{valueOffsets:e,values:i,nullBitmap:r,typeIds:s}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),r&&(t+=r.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){let t=this._nullCount,e;return t<=Jl&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-Gi(e,this.offset,this.offset+this.length)),t}getValid(t){if(this.nullable&&this.nullCount>0){const e=this.offset+t;return(this.nullBitmap[e>>3]&1<<e%8)!==0}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){const{nullBitmap:c}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:c,_nullCount:0})}const{nullBitmap:i,offset:r}=this,s=r+t>>3,o=(r+t)%8,a=i[s]>>o&1;return e?a===0&&(i[s]|=1<<o,this._nullCount=this.nullCount+1):a===1&&(i[s]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,i=this.length,r=this._nullCount,s=this,o=this.children){return new K(t,e,i,r,s,o,this.dictionary)}slice(t,e){const{stride:i,typeId:r,children:s}=this,o=+(this._nullCount===0)-1,a=r===16?i:1,c=this._sliceBuffers(t,e,i,r);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===d.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:i}=this,r=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);r[e>>3]=(1<<e-(e&-8))-1,i>0&&r.set(Fr(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[Zt.VALIDITY]=r,this.clone(this.type,0,t,i+(t-e),s)}_sliceBuffers(t,e,i,r){let s;const{buffers:o}=this;return(s=o[Zt.TYPE])&&(o[Zt.TYPE]=s.subarray(t,t+e)),(s=o[Zt.OFFSET])&&(o[Zt.OFFSET]=s.subarray(t,t+e+1))||(s=o[Zt.DATA])&&(o[Zt.DATA]=r===6?s:s.subarray(i*t,i*(t+e))),o}_sliceChildren(t,e,i){return t.map(r=>r.slice(e,i))}}K.prototype.children=Object.freeze([]);class an extends L{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:i=0,["length"]:r=0}=t;return new K(e,i,r,0)}visitBool(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitInt(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitFloat(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitUtf8(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.data),s=x(t.nullBitmap),o=nn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new K(e,i,a,c,[o,r,s])}visitBinary(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.data),s=x(t.nullBitmap),o=nn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new K(e,i,a,c,[o,r,s])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/Jt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitDate(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/Jt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitTimestamp(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/Jt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitTime(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/Jt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitDecimal(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/Jt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitList(t){const{["type"]:e,["offset"]:i=0,["child"]:r}=t,s=x(t.nullBitmap),o=nn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new K(e,i,a,c,[o,void 0,s],[r])}visitStruct(t){const{["type"]:e,["offset"]:i=0,["children"]:r=[]}=t,s=x(t.nullBitmap),{length:o=r.reduce((c,{length:u})=>Math.max(c,u),0),nullCount:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,void 0,s],r)}visitUnion(t){const{["type"]:e,["offset"]:i=0,["children"]:r=[]}=t,s=x(t.nullBitmap),o=W(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;if(w.isSparseUnion(e))return new K(e,i,a,c,[void 0,void 0,s,o],r);const u=nn(t.valueOffsets);return new K(e,i,a,c,[u,void 0,s,o],r)}visitDictionary(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.indices.ArrayType,t.data),{["dictionary"]:o=new E([new an().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new K(e,i,a,c,[void 0,s,r],[],o)}visitInterval(t){const{["type"]:e,["offset"]:i=0}=t,r=x(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/Jt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,s,r])}visitFixedSizeList(t){const{["type"]:e,["offset"]:i=0,["child"]:r=new an().visit({type:e.valueType})}=t,s=x(t.nullBitmap),{["length"]:o=r.length/Jt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new K(e,i,o,a,[void 0,void 0,s],[r])}visitMap(t){const{["type"]:e,["offset"]:i=0,["child"]:r=new an().visit({type:e.childType})}=t,s=x(t.nullBitmap),o=nn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new K(e,i,a,c,[o,void 0,s],[r])}}function M(n){return new an().visit(n)}class os{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function ia(n){return n.reduce((t,e)=>t+e.nullCount,0)}function ra(n){return n.reduce((t,e,i)=>(t[i+1]=t[i]+e.length,t),new Uint32Array(n.length+1))}function sa(n,t,e,i){const r=[];for(let s=-1,o=n.length;++s<o;){const a=n[s],c=t[s],{length:u}=a;if(c>=i)break;if(e>=c+u)continue;if(c>=e&&c+u<=i){r.push(a);continue}const l=Math.max(0,e-c),h=Math.min(i-c,u);r.push(a.slice(l,h-l))}return r.length===0&&r.push(n[0].slice(0,0)),r}function Tr(n,t,e,i){let r=0,s=0,o=t.length-1;do{if(r>=o-1)return e<t[o]?i(n,r,e-t[r]):null;s=r+Math.trunc((o-r)*.5),e<t[s]?o=s:r=s}while(r<o)}function kr(n,t){return n.getValid(t)}function Ye(n){function t(e,i,r){return n(e[i],r)}return function(e){const i=this.data;return Tr(i,this._offsets,e,t)}}function oa(n){let t;function e(i,r,s){return n(i[r],s,t)}return function(i,r){const s=this.data;t=r;const o=Tr(s,this._offsets,i,e);return t=void 0,o}}function aa(n){let t;function e(i,r,s){let o=s,a=0,c=0;for(let u=r-1,l=i.length;++u<l;){const h=i[u];if(~(a=n(h,t,o)))return c+a;o=0,c+=h.length}return-1}return function(i,r){t=i;const s=this.data,o=typeof r!="number"?e(s,0,0):Tr(s,this._offsets,r,e);return t=void 0,o}}class v extends L{}function Hl(n,t){return t===null&&n.length>0?0:-1}function Xl(n,t){const{nullBitmap:e}=n;if(!e||n.nullCount<=0)return-1;let i=0;for(const r of new Dr(e,n.offset+(t||0),n.length,e,na)){if(!r)return i;++i}return-1}function T(n,t,e){if(t===void 0)return-1;if(t===null)return Xl(n,e);const i=ut.getVisitFn(n),r=en(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(r(i(n,s)))return s;return-1}function ca(n,t,e){const i=ut.getVisitFn(n),r=en(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(r(i(n,s)))return s;return-1}v.prototype.visitNull=Hl;v.prototype.visitBool=T;v.prototype.visitInt=T;v.prototype.visitInt8=T;v.prototype.visitInt16=T;v.prototype.visitInt32=T;v.prototype.visitInt64=T;v.prototype.visitUint8=T;v.prototype.visitUint16=T;v.prototype.visitUint32=T;v.prototype.visitUint64=T;v.prototype.visitFloat=T;v.prototype.visitFloat16=T;v.prototype.visitFloat32=T;v.prototype.visitFloat64=T;v.prototype.visitUtf8=T;v.prototype.visitBinary=T;v.prototype.visitFixedSizeBinary=T;v.prototype.visitDate=T;v.prototype.visitDateDay=T;v.prototype.visitDateMillisecond=T;v.prototype.visitTimestamp=T;v.prototype.visitTimestampSecond=T;v.prototype.visitTimestampMillisecond=T;v.prototype.visitTimestampMicrosecond=T;v.prototype.visitTimestampNanosecond=T;v.prototype.visitTime=T;v.prototype.visitTimeSecond=T;v.prototype.visitTimeMillisecond=T;v.prototype.visitTimeMicrosecond=T;v.prototype.visitTimeNanosecond=T;v.prototype.visitDecimal=T;v.prototype.visitList=T;v.prototype.visitStruct=T;v.prototype.visitUnion=T;v.prototype.visitDenseUnion=ca;v.prototype.visitSparseUnion=ca;v.prototype.visitDictionary=T;v.prototype.visitInterval=T;v.prototype.visitIntervalDayTime=T;v.prototype.visitIntervalYearMonth=T;v.prototype.visitFixedSizeList=T;v.prototype.visitMap=T;const ti=new v;class S extends L{}function A(n){const{type:t}=n;if(n.nullCount===0&&n.stride===1&&(t.typeId===d.Timestamp||t instanceof de&&t.bitWidth!==64||t instanceof pn&&t.bitWidth!==64||t instanceof fn&&t.precision!==ct.HALF))return new os(n.data.length,i=>{const r=n.data[i];return r.values.subarray(0,r.length)[Symbol.iterator]()});let e=0;return new os(n.data.length,i=>{const s=n.data[i].length,o=n.slice(e,e+s);return e+=s,new Gl(o)})}class Gl{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}S.prototype.visitNull=A;S.prototype.visitBool=A;S.prototype.visitInt=A;S.prototype.visitInt8=A;S.prototype.visitInt16=A;S.prototype.visitInt32=A;S.prototype.visitInt64=A;S.prototype.visitUint8=A;S.prototype.visitUint16=A;S.prototype.visitUint32=A;S.prototype.visitUint64=A;S.prototype.visitFloat=A;S.prototype.visitFloat16=A;S.prototype.visitFloat32=A;S.prototype.visitFloat64=A;S.prototype.visitUtf8=A;S.prototype.visitBinary=A;S.prototype.visitFixedSizeBinary=A;S.prototype.visitDate=A;S.prototype.visitDateDay=A;S.prototype.visitDateMillisecond=A;S.prototype.visitTimestamp=A;S.prototype.visitTimestampSecond=A;S.prototype.visitTimestampMillisecond=A;S.prototype.visitTimestampMicrosecond=A;S.prototype.visitTimestampNanosecond=A;S.prototype.visitTime=A;S.prototype.visitTimeSecond=A;S.prototype.visitTimeMillisecond=A;S.prototype.visitTimeMicrosecond=A;S.prototype.visitTimeNanosecond=A;S.prototype.visitDecimal=A;S.prototype.visitList=A;S.prototype.visitStruct=A;S.prototype.visitUnion=A;S.prototype.visitDenseUnion=A;S.prototype.visitSparseUnion=A;S.prototype.visitDictionary=A;S.prototype.visitInterval=A;S.prototype.visitIntervalDayTime=A;S.prototype.visitIntervalYearMonth=A;S.prototype.visitFixedSizeList=A;S.prototype.visitMap=A;const Nr=new S,ql=(n,t)=>n+t;class ye extends L{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===C.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((i,r)=>i+$t.visit(r,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((i,r)=>i+$t.visit(r,e),0)}visitDictionary(t,e){var i;return t.type.indices.bitWidth/8+(((i=t.dictionary)===null||i===void 0?void 0:i.getByteLength(t.values[e]))||0)}}const Ql=({valueOffsets:n},t)=>8+(n[t+1]-n[t]),tu=({valueOffsets:n},t)=>8+(n[t+1]-n[t]),eu=({valueOffsets:n,stride:t,children:e},i)=>{const r=e[0],{[i*t]:s}=n,{[i*t+1]:o}=n,a=$t.getVisitFn(r.type),c=r.slice(s,o-s);let u=8;for(let l=-1,h=o-s;++l<h;)u+=a(c,l);return u},nu=({stride:n,children:t},e)=>{const i=t[0],r=i.slice(e*n,n),s=$t.getVisitFn(i.type);let o=0;for(let a=-1,c=r.length;++a<c;)o+=s(r,a);return o},iu=(n,t)=>n.type.mode===mt.Dense?la(n,t):ua(n,t),la=({type:n,children:t,typeIds:e,valueOffsets:i},r)=>{const s=n.typeIdToChildIndex[e[r]];return 8+$t.visit(t[s],i[r])},ua=({children:n},t)=>4+$t.visitMany(n,n.map(()=>t)).reduce(ql,0);ye.prototype.visitUtf8=Ql;ye.prototype.visitBinary=tu;ye.prototype.visitList=eu;ye.prototype.visitFixedSizeList=nu;ye.prototype.visitUnion=iu;ye.prototype.visitDenseUnion=la;ye.prototype.visitSparseUnion=ua;const $t=new ye;var da;const ha={},fa={};class E{constructor(t){var e,i,r;const s=t[0]instanceof E?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof K)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:c,indexOf:u,byteLength:l}=ha[o.typeId],h=s[0];this.isValid=f=>kr(h,f),this.get=f=>a(h,f),this.set=(f,p)=>c(h,f,p),this.indexOf=f=>u(h,f),this.getByteLength=f=>l(h,f),this._offsets=[0,h.length];break}default:Object.setPrototypeOf(this,fa[o.typeId]),this._offsets=ra(s);break}this.data=s,this.type=o,this.stride=Jt(o),this.numChildren=(r=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0,this.length=this._offsets[this._offsets.length-1]}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((t,e)=>t+e.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=ia(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${d[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return Nr.visit(this)}concat(...t){return new E(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new E(ea(this,t,e,({data:i,_offsets:r},s,o)=>sa(i,r,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:i,stride:r,ArrayType:s}=this;switch(t.typeId){case d.Int:case d.Float:case d.Decimal:case d.Time:case d.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,i*r);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*r),o.offset),o.offset+=c*r,o),{array:new s(i*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new E(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return w.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(w.isDictionary(this.type)){const t=new ei(this.data[0].dictionary),e=this.data.map(i=>{const r=i.clone();return r.dictionary=t,r});return new E(e)}return new ei(this)}unmemoize(){if(w.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(i=>{const r=i.clone();return r.dictionary=t,r});return new E(e)}return this}}da=Symbol.toStringTag;E[da]=(n=>{n.type=w.prototype,n.data=[],n.length=0,n.stride=1,n.numChildren=0,n._nullCount=-1,n._byteLength=-1,n._offsets=new Uint32Array([0]),n[Symbol.isConcatSpreadable]=!0;const t=Object.keys(d).map(e=>d[e]).filter(e=>typeof e=="number"&&e!==d.NONE);for(const e of t){const i=ut.getVisitFnByTypeId(e),r=It.getVisitFnByTypeId(e),s=ti.getVisitFnByTypeId(e),o=$t.getVisitFnByTypeId(e);ha[e]={get:i,set:r,indexOf:s,byteLength:o},fa[e]=Object.create(n,{isValid:{value:Ye(kr)},get:{value:Ye(ut.getVisitFnByTypeId(e))},set:{value:oa(It.getVisitFnByTypeId(e))},indexOf:{value:aa(ti.getVisitFnByTypeId(e))},getByteLength:{value:Ye($t.getVisitFnByTypeId(e))}})}return"Vector"})(E.prototype);class ei extends E{constructor(t){super(t.data);const e=this.get,i=this.set,r=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){i.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new ei(r.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new E(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class qi{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,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(t,e,i,r){return t.prep(8,24),t.writeInt64(r),t.pad(4),t.writeInt32(i),t.writeInt64(e),t.offset()}}const Ui=2,Lt=4,Xt=4,Y=4,oe=new Int32Array(2),as=new Float32Array(oe.buffer),cs=new Float64Array(oe.buffer),Tn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;let qt=class Qi{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?Qi.ZERO:new Qi(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};qt.ZERO=new qt(0,0);var tr;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(tr||(tr={}));let Ze=class pa{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new pa(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return new qt(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new qt(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return oe[0]=this.readInt32(t),as[0]}readFloat64(t){return oe[Tn?0:1]=this.readInt32(t),oe[Tn?1:0]=this.readInt32(t+4),cs[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){as[0]=e,this.writeInt32(t,oe[0])}writeFloat64(t,e){cs[0]=e,this.writeInt32(t,oe[Tn?0:1]),this.writeInt32(t+4,oe[Tn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Lt+Xt)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<Xt;e++)t+=String.fromCharCode(this.readInt8(this.position_+Lt+e));return t}__offset(t,e){const i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const i=this.readInt32(t);let r="",s=0;if(t+=Lt,e===tr.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;s<i;){let o;const a=this.readUint8(t+s++);if(a<192)o=a;else{const c=this.readUint8(t+s++);if(a<224)o=(a&31)<<6|c&63;else{const u=this.readUint8(t+s++);if(a<240)o=(a&15)<<12|(c&63)<<6|u&63;else{const l=this.readUint8(t+s++);o=(a&7)<<18|(c&63)<<12|(u&63)<<6|l&63}}}o<65536?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode((o>>10)+55296,(o&1023)+56320))}return r}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+Lt}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=Xt)throw new Error("FlatBuffers: file identifier must be length "+Xt);for(let e=0;e<Xt;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+Lt+e))return!1;return!0}createLong(t,e){return qt.create(t,e)}createScalarList(t,e){const i=[];for(let r=0;r<e;++r)t(r)!==null&&i.push(t(r));return i}createObjList(t,e){const i=[];for(let r=0;r<e;++r){const s=t(r);s!==null&&i.push(s.unpack())}return i}},ya=class ma{constructor(t){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;let e;t?e=t:e=1024,this.bb=Ze.allocate(e),this.space=e}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(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);const i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){const r=this.bb.capacity();this.bb=ma.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||!e.equals(i))&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=e<<1,r=Ze.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r}addOffset(t){this.prep(Lt,0),this.writeInt32(this.offset()-t+Lt)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=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 t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const r=2;this.addInt16(t-this.object_start);const s=(i+r)*Ui;this.addInt16(s);let o=0;const a=this.space;t:for(e=0;e<this.vtables.length;e++){const c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let u=Ui;u<s;u+=Ui)if(this.bb.readInt16(a+u)!=this.bb.readInt16(c+u))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){const r=i?Y:0;if(e){const s=e;if(this.prep(this.minalign,Lt+Xt+r),s.length!=Xt)throw new Error("FlatBuffers: file identifier must be length "+Xt);for(let o=Xt-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Lt+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(this.bb.readInt16(r+e)!=0))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(Lt,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let i=0;for(;i<t.length;){let r;const s=t.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const o=t.charCodeAt(i++);r=(s<<10)+o+-56613888}r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(r&63|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let i=0,r=this.space,s=this.bb.bytes();i<e.length;i++)s[r++]=e[i];return this.endVector()}createLong(t,e){return qt.create(t,e)}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let i=0;i<t.length;++i){const r=t[i];if(r!==null)e.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}};class q{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new q).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+Y),(e||new q).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,i){return q.startKeyValue(t),q.addKey(t,e),q.addValue(t,i),q.endKeyValue(t)}}var Je;(function(n){n[n.V1=0]="V1",n[n.V2=1]="V2",n[n.V3=2]="V3",n[n.V4=3]="V4",n[n.V5=4]="V5"})(Je||(Je={}));var He;(function(n){n[n.Little=0]="Little",n[n.Big=1]="Big"})(He||(He={}));var ni;(function(n){n[n.DenseArray=0]="DenseArray"})(ni||(ni={}));class pt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+Y),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,i){return pt.startInt(t),pt.addBitWidth(t,e),pt.addIsSigned(t,i),pt.endInt(t)}}class Gt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+Y),(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new pt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):ni.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,ni.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class ve{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+Y),(e||new ve).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ve.startBinary(t),ve.endBinary(t)}}class Se{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+Y),(e||new Se).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Se.startBool(t),Se.endBool(t)}}var ii;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(ii||(ii={}));let Ln=class Ce{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+Y),(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ii.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,ii.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Ce.startDate(t),Ce.addUnit(t,e),Ce.endDate(t)}};class st{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new st).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+Y),(e||new st).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,i,r){return st.startDecimal(t),st.addPrecision(t,e),st.addScale(t,i),st.addBitWidth(t,r),st.endDecimal(t)}}var Xe;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(Xe||(Xe={}));class xt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+Y),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return xt.startFixedSizeBinary(t),xt.addByteWidth(t,e),xt.endFixedSizeBinary(t)}}class Ct{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+Y),(e||new Ct).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return Ct.startFixedSizeList(t),Ct.addListSize(t,e),Ct.endFixedSizeList(t)}}var ri;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(ri||(ri={}));class Ut{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+Y),(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ri.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,ri.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return Ut.startFloatingPoint(t),Ut.addPrecision(t,e),Ut.endFloatingPoint(t)}}var si;(function(n){n[n.YEAR_MONTH=0]="YEAR_MONTH",n[n.DAY_TIME=1]="DAY_TIME",n[n.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(si||(si={}));class Rt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new Rt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+Y),(e||new Rt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):si.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,si.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Rt.startInterval(t),Rt.addUnit(t,e),Rt.endInterval(t)}}class Ie{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+Y),(e||new Ie).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Ie.startList(t),Ie.endList(t)}}let xn=class Ue{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+Y),(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Ue.startMap(t),Ue.addKeysSorted(t,e),Ue.endMap(t)}};class Oe{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+Y),(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Oe.startNull(t),Oe.endNull(t)}}class Be{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+Y),(e||new Be).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Be.startStruct_(t),Be.endStruct_(t)}}class vt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+Y),(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xe.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Xe.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return vt.startTime(t),vt.addUnit(t,e),vt.addBitWidth(t,i),vt.endTime(t)}}class St{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new St).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+Y),(e||new St).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xe.SECOND}timezone(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Xe.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return St.startTimestamp(t),St.addUnit(t,e),St.addTimezone(t,i),St.endTimestamp(t)}}var oi;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(oi||(oi={}));class ot{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+Y),(e||new ot).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):oi.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,oi.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,i){return ot.startUnion(t),ot.addMode(t,e),ot.addTypeIds(t,i),ot.endUnion(t)}}class Ae{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+Y),(e||new Ae).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ae.startUtf8(t),Ae.endUtf8(t)}}var J;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.FloatingPoint=3]="FloatingPoint",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct_=13]="Struct_",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Duration=18]="Duration",n[n.LargeBinary=19]="LargeBinary",n[n.LargeUtf8=20]="LargeUtf8",n[n.LargeList=21]="LargeList"})(J||(J={}));let wt=class Cn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new Cn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+Y),(e||new Cn).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):J.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new Gt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const i=this.bb.__offset(this.bb_pos,14);return i?(e||new Cn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,16);return i?(e||new q).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,J.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}},Tt=class Kt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+Y),(e||new Kt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):He.Little}fields(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new q).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):this.bb.createLong(0,0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,He.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,i,r,s){return Kt.startSchema(t),Kt.addEndianness(t,e),Kt.addFields(t,i),Kt.addCustomMetadata(t,r),Kt.addFeatures(t,s),Kt.endSchema(t)}};class ft{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+Y),(e||new ft).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Je.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Tt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new qi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const i=this.bb.__offset(this.bb_pos,10);return i?(e||new qi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new q).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Je.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}class P{constructor(t=[],e,i){this.fields=t||[],this.metadata=e||new Map,i||(i=er(t)),this.dictionaries=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){const e=new Set(t),i=this.fields.filter(r=>e.has(r.name));return new P(i,this.metadata)}selectAt(t){const e=t.map(i=>this.fields[i]).filter(Boolean);return new P(e,this.metadata)}assign(...t){const e=t[0]instanceof P?t[0]:Array.isArray(t[0])?new P(t[0]):new P(t),i=[...this.fields],r=kn(kn(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{const c=i.findIndex(u=>u.name===a.name);return~c?(i[c]=a.clone({metadata:kn(kn(new Map,i[c].metadata),a.metadata)}))&&!1:!0}),o=er(s,new Map);return new P([...i,...s],r,new Map([...this.dictionaries,...o]))}}P.prototype.fields=null;P.prototype.metadata=null;P.prototype.dictionaries=null;class Z{constructor(t,e,i=!1,r){this.name=t,this.type=e,this.nullable=i,this.metadata=r||new Map}static new(...t){let[e,i,r,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],i===void 0&&(i=t[0].type),r===void 0&&(r=t[0].nullable),s===void 0&&(s=t[0].metadata)),new Z(`${e}`,i,r,s)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,i,r,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,i=this.type,r=this.nullable,s=this.metadata]=t:{name:e=this.name,type:i=this.type,nullable:r=this.nullable,metadata:s=this.metadata}=t[0],Z.new(e,i,r,s)}}Z.prototype.type=null;Z.prototype.name=null;Z.prototype.nullable=null;Z.prototype.metadata=null;function kn(n,t){return new Map([...n||new Map,...t||new Map])}function er(n,t=new Map){for(let e=-1,i=n.length;++e<i;){const s=n[e].type;if(w.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&er(s.children,t)}return t}var ls=qt,ru=ya,su=Ze;class yn{constructor(t,e=yt.V4,i,r){this.schema=t,this.version=e,i&&(this._recordBatches=i),r&&(this._dictionaryBatches=r)}static decode(t){t=new su(x(t));const e=ft.getRootAsFooter(t),i=P.decode(e.schema());return new ou(i,e)}static encode(t){const e=new ru,i=P.encode(e,t.schema);ft.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())he.encode(e,o);const r=e.endVector();ft.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())he.encode(e,o);const s=e.endVector();return ft.startFooter(e),ft.addSchema(e,i),ft.addVersion(e,yt.V4),ft.addRecordBatches(e,r),ft.addDictionaries(e,s),ft.finishFooterBuffer(e,ft.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let t,e=-1,i=this.numRecordBatches;++e<i;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,i=this.numDictionaries;++e<i;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}}class ou extends yn{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const e=this._footer.recordBatches(t);if(e)return he.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return he.decode(e)}return null}}class he{constructor(t,e,i){this.metaDataLength=t,this.offset=typeof i=="number"?i:i.low,this.bodyLength=typeof e=="number"?e:e.low}static decode(t){return new he(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:i}=e,r=new ls(e.offset,0),s=new ls(e.bodyLength,0);return qi.createBlock(t,r,i,s)}}const H=Object.freeze({done:!0,value:void 0});class us{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class Mr{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class au extends Mr{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return g(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(H);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return _t.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return _t.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return g(this,void 0,void 0,function*(){return yield this.abort(t),H})}return(t){return g(this,void 0,void 0,function*(){return yield this.close(),H})}read(t){return g(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return g(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){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((e,i)=>{this.resolvers.push({resolve:e,reject:i})}):Promise.resolve(H)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Un extends au{write(t){if((t=x(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Zi(this.toUint8Array(!0)):this.toUint8Array(!1).then(Zi)}toUint8Array(t=!1){return t?Vt(this._values)[0]:g(this,void 0,void 0,function*(){var e,i;const r=[];let s=0;try{for(var o=De(this),a;a=yield o.next(),!a.done;){const c=a.value;r.push(c),s+=c.byteLength}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&(yield i.call(o))}finally{if(e)throw e.error}}return Vt(r,s)[0]})}}class ai{constructor(t){t&&(this.source=new cu(_t.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Ge{constructor(t){t instanceof Ge?this.source=t.source:t instanceof Un?this.source=new be(_t.fromAsyncIterable(t)):Gs(t)?this.source=new be(_t.fromNodeStream(t)):br(t)?this.source=new be(_t.fromDOMStream(t)):Xs(t)?this.source=new be(_t.fromDOMStream(t.body)):Sn(t)?this.source=new be(_t.fromIterable(t)):ce(t)?this.source=new be(_t.fromAsyncIterable(t)):tn(t)&&(this.source=new be(_t.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class cu{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||H)}return(t){return Object.create(this.source.return&&this.source.return(t)||H)}}class be{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return g(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return g(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return g(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return g(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return g(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||H;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return g(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||H;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class ds extends ai{constructor(t,e){super(),this.position=0,this.buffer=x(t),this.size=typeof e>"u"?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:i}=this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:e,size:i,position:r}=this;return e&&r<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,r+Math.min(i-r,t)),e.subarray(r,this.position)):null}readAt(t,e){const i=this.buffer,r=Math.min(this.size,t+e);return i?i.subarray(t,r):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class ci extends Ge{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=g(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return g(this,void 0,void 0,function*(){const{buffer:e,byteOffset:i}=yield this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)})}seek(t){return g(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return g(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:e,size:i,position:r}=this;if(e&&r<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=r,o=0,a=0;const c=Math.min(i,s+Math.min(i-s,t)),u=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<u.byteLength;)({bytesRead:a}=yield e.read(u,o,u.byteLength-o,s));return u}return null})}readAt(t,e){return g(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:i,size:r}=this;if(i&&t+e<r){const s=Math.min(r,t+e),o=new Uint8Array(s-t);return(yield i.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return g(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return g(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return g(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const lu=65536;function je(n){return n<0&&(n=4294967295+n+1),`0x${n.toString(16)}`}const qe=8,Lr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class ga{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let r=e[3]*i[3];this.buffer[0]=r&65535;let s=r>>>16;return r=e[2]*i[3],s+=r,r=e[3]*i[2]>>>0,s+=r,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<r?lu:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*i[3]+e[2]*i[2]+e[3]*i[1],this.buffer[1]+=e[0]*i[3]+e[1]*i[2]+e[2]*i[1]+e[3]*i[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${je(this.buffer[1])} ${je(this.buffer[0])}`}}class j extends ga{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return j.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return j.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const i=t.length,r=new j(e);for(let s=0;s<i;){const o=qe<i-s?qe:i-s,a=new j(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new j(new Uint32Array([Lr[o],0]));r.times(c),r.plus(a),s+=o}return r}static convertArray(t){const e=new Uint32Array(t.length*2);for(let i=-1,r=t.length;++i<r;)j.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new j(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new j(new Uint32Array(t.buffer)).plus(e)}}class rt extends ga{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){const e=this.buffer[1]<<0,i=t.buffer[1]<<0;return e<i||e===i&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return rt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return rt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const i=t.startsWith("-"),r=t.length,s=new rt(e);for(let o=i?1:0;o<r;){const a=qe<r-o?qe:r-o,c=new rt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),u=new rt(new Uint32Array([Lr[a],0]));s.times(u),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){const e=new Uint32Array(t.length*2);for(let i=-1,r=t.length;++i<r;)rt.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new rt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new rt(new Uint32Array(t.buffer)).plus(e)}}class kt{constructor(t){this.buffer=t}high(){return new rt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new rt(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(t){const e=new j(new Uint32Array([this.buffer[3],0])),i=new j(new Uint32Array([this.buffer[2],0])),r=new j(new Uint32Array([this.buffer[1],0])),s=new j(new Uint32Array([this.buffer[0],0])),o=new j(new Uint32Array([t.buffer[3],0])),a=new j(new Uint32Array([t.buffer[2],0])),c=new j(new Uint32Array([t.buffer[1],0])),u=new j(new Uint32Array([t.buffer[0],0]));let l=j.multiply(s,u);this.buffer[0]=l.low();const h=new j(new Uint32Array([l.high(),0]));return l=j.multiply(r,u),h.plus(l),l=j.multiply(s,c),h.plus(l),this.buffer[1]=h.low(),this.buffer[3]=h.lessThan(l)?1:0,this.buffer[2]=h.high(),new j(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(j.multiply(i,u)).plus(j.multiply(r,c)).plus(j.multiply(s,a)),this.buffer[3]+=j.multiply(e,u).plus(j.multiply(i,c)).plus(j.multiply(r,a)).plus(j.multiply(s,o)).low(),this}plus(t){const e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${je(this.buffer[3])} ${je(this.buffer[2])} ${je(this.buffer[1])} ${je(this.buffer[0])}`}static multiply(t,e){return new kt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new kt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return kt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return kt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const i=t.startsWith("-"),r=t.length,s=new kt(e);for(let o=i?1:0;o<r;){const a=qe<r-o?qe:r-o,c=new kt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),u=new kt(new Uint32Array([Lr[a],0,0,0]));s.times(u),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){const e=new Uint32Array(t.length*4);for(let i=-1,r=t.length;++i<r;)kt.from(t[i],new Uint32Array(e.buffer,e.byteOffset+4*4*i,4));return e}}class ba extends L{constructor(t,e,i,r){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=i,this.dictionaries=r}visit(t){return super.visit(t instanceof Z?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return M({type:t,length:e})}visitBool(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===mt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:i}=this.nextFieldNode()){return M({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,i=this.nextBufferRange()){return e>0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class uu extends ba{constructor(t,e,i,r){super(new Uint8Array(0),e,i,r),this.sources=t}readNullBitmap(t,e,{offset:i}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Qn(this.sources[i])}readOffsets(t,{offset:e}=this.nextBufferRange()){return W(Uint8Array,W(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return W(Uint8Array,W(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:i}=this;return w.isTimestamp(t)||(w.isInt(t)||w.isTime(t))&&t.bitWidth===64||w.isDate(t)&&t.unit===te.MILLISECOND?W(Uint8Array,rt.convertArray(i[e])):w.isDecimal(t)?W(Uint8Array,kt.convertArray(i[e])):w.isBinary(t)||w.isFixedSizeBinary(t)?du(i[e]):w.isBool(t)?Qn(i[e]):w.isUtf8(t)?gr(i[e].join("")):W(Uint8Array,W(t.ArrayType,i[e].map(r=>+r)))}}function du(n){const t=n.join(""),e=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)e[i>>1]=Number.parseInt(t.slice(i,i+2),16);return e}class I extends L{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((i,r)=>this.compareFields(i,e[r]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function dt(n,t){return t instanceof n.constructor}function In(n,t){return n===t||dt(n,t)}function ie(n,t){return n===t||dt(n,t)&&n.bitWidth===t.bitWidth&&n.isSigned===t.isSigned}function Di(n,t){return n===t||dt(n,t)&&n.precision===t.precision}function hu(n,t){return n===t||dt(n,t)&&n.byteWidth===t.byteWidth}function xr(n,t){return n===t||dt(n,t)&&n.unit===t.unit}function On(n,t){return n===t||dt(n,t)&&n.unit===t.unit&&n.timezone===t.timezone}function Bn(n,t){return n===t||dt(n,t)&&n.unit===t.unit&&n.bitWidth===t.bitWidth}function fu(n,t){return n===t||dt(n,t)&&n.children.length===t.children.length&&fe.compareManyFields(n.children,t.children)}function pu(n,t){return n===t||dt(n,t)&&n.children.length===t.children.length&&fe.compareManyFields(n.children,t.children)}function Cr(n,t){return n===t||dt(n,t)&&n.mode===t.mode&&n.typeIds.every((e,i)=>e===t.typeIds[i])&&fe.compareManyFields(n.children,t.children)}function yu(n,t){return n===t||dt(n,t)&&n.id===t.id&&n.isOrdered===t.isOrdered&&fe.visit(n.indices,t.indices)&&fe.visit(n.dictionary,t.dictionary)}function Ur(n,t){return n===t||dt(n,t)&&n.unit===t.unit}function mu(n,t){return n===t||dt(n,t)&&n.listSize===t.listSize&&n.children.length===t.children.length&&fe.compareManyFields(n.children,t.children)}function gu(n,t){return n===t||dt(n,t)&&n.keysSorted===t.keysSorted&&n.children.length===t.children.length&&fe.compareManyFields(n.children,t.children)}I.prototype.visitNull=In;I.prototype.visitBool=In;I.prototype.visitInt=ie;I.prototype.visitInt8=ie;I.prototype.visitInt16=ie;I.prototype.visitInt32=ie;I.prototype.visitInt64=ie;I.prototype.visitUint8=ie;I.prototype.visitUint16=ie;I.prototype.visitUint32=ie;I.prototype.visitUint64=ie;I.prototype.visitFloat=Di;I.prototype.visitFloat16=Di;I.prototype.visitFloat32=Di;I.prototype.visitFloat64=Di;I.prototype.visitUtf8=In;I.prototype.visitBinary=In;I.prototype.visitFixedSizeBinary=hu;I.prototype.visitDate=xr;I.prototype.visitDateDay=xr;I.prototype.visitDateMillisecond=xr;I.prototype.visitTimestamp=On;I.prototype.visitTimestampSecond=On;I.prototype.visitTimestampMillisecond=On;I.prototype.visitTimestampMicrosecond=On;I.prototype.visitTimestampNanosecond=On;I.prototype.visitTime=Bn;I.prototype.visitTimeSecond=Bn;I.prototype.visitTimeMillisecond=Bn;I.prototype.visitTimeMicrosecond=Bn;I.prototype.visitTimeNanosecond=Bn;I.prototype.visitDecimal=In;I.prototype.visitList=fu;I.prototype.visitStruct=pu;I.prototype.visitUnion=Cr;I.prototype.visitDenseUnion=Cr;I.prototype.visitSparseUnion=Cr;I.prototype.visitDictionary=yu;I.prototype.visitInterval=Ur;I.prototype.visitIntervalDayTime=Ur;I.prototype.visitIntervalYearMonth=Ur;I.prototype.visitFixedSizeList=mu;I.prototype.visitMap=gu;const fe=new I;function nr(n,t){return fe.compareSchemas(n,t)}function Ri(n,t){return bu(n,t.map(e=>e.data.concat()))}function bu(n,t){const e=[...n.fields],i=[],r={numBatches:t.reduce((h,f)=>Math.max(h,f.length),0)};let s=0,o=0,a=-1;const c=t.length;let u,l=[];for(;r.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)l[a]=u=t[a].shift(),o=Math.min(o,u?u.length:o);Number.isFinite(o)&&(l=wu(e,o,l,t,r),o>0&&(i[s++]=M({type:new nt(e),length:o,nullCount:0,children:l.slice()})))}return[n=n.assign(e),i.map(h=>new at(n,h))]}function wu(n,t,e,i,r){var s;const o=(t+63&-64)>>3;for(let a=-1,c=i.length;++a<c;){const u=e[a],l=u==null?void 0:u.length;if(l>=t)l===t?e[a]=u:(e[a]=u.slice(0,t),r.numBatches=Math.max(r.numBatches,i[a].unshift(u.slice(t,l-t))));else{const h=n[a];n[a]=h.clone({nullable:!0}),e[a]=(s=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:M({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var wa;class et{constructor(...t){var e,i;if(t.length===0)return this.batches=[],this.schema=new P([]),this._offsets=[0],this;let r,s;t[0]instanceof P&&(r=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());const o=c=>{if(c){if(c instanceof at)return[c];if(c instanceof et)return c.batches;if(c instanceof K){if(c.type instanceof nt)return[new at(new P(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(u=>o(u));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(u=>o(u));if(typeof c=="object"){const u=Object.keys(c),l=u.map(p=>new E([c[p]])),h=new P(u.map((p,y)=>new Z(String(p),l[y].type))),[,f]=Ri(h,l);return f.length===0?[new at(c)]:f}}}return[]},a=t.flatMap(c=>o(c));if(r=(i=r??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&i!==void 0?i:new P([]),!(r instanceof P))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const c of a){if(!(c instanceof at))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!nr(r,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=r,this.batches=a,this._offsets=s??ra(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=ia(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?Nr.visit(new E(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
  ${this.toArray().join(`,
  `)}
]`}concat(...t){const e=this.schema,i=this.data.concat(t.flatMap(({data:r})=>r));return new et(e,i.map(r=>new at(e,r)))}slice(t,e){const i=this.schema;[t,e]=ea({length:this.numRows},t,e);const r=sa(this.data,this._offsets,t,e);return new et(i,r.map(s=>new at(i,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const e=this.data.map(i=>i.children[t]);if(e.length===0){const{type:i}=this.schema.fields[t],r=M({type:i,length:0,nullCount:0});e.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new E(e)}return null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(r=>r.name===t),e)}setChildAt(t,e){let i=this.schema,r=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new E([M({type:new ue,length:this.numRows})]));const s=i.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,u)=>this.getChildAt(u));[s[t],a[t]]=[o,e],[i,r]=Ri(i,a)}return new et(i,r)}select(t){const e=this.schema.fields.reduce((i,r,s)=>i.set(r.name,s),new Map);return this.selectAt(t.map(i=>e.get(i)).filter(i=>i>-1))}selectAt(t){const e=this.schema.selectAt(t),i=this.batches.map(r=>r.selectAt(t));return new et(e,i)}assign(t){const e=this.schema.fields,[i,r]=t.schema.fields.reduce((a,c,u)=>{const[l,h]=a,f=e.findIndex(p=>p.name===c.name);return~f?h[f]=u:l.push(u),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,r[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new et(...Ri(s,o))}}wa=Symbol.toStringTag;et[wa]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=Ye(kr),n.get=Ye(ut.getVisitFn(d.Struct)),n.set=oa(It.getVisitFn(d.Struct)),n.indexOf=aa(ti.getVisitFn(d.Struct)),n.getByteLength=Ye($t.getVisitFn(d.Struct)),"Table"))(et.prototype);var _a;let at=class sn{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof P))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=M({nullCount:0,type:new nt(this.schema.fields),children:this.schema.fields.map(e=>M({type:e.type,nullCount:0}))})]=t,!(this.data instanceof K))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=hs(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:i,children:r,length:s}=Object.keys(e).reduce((c,u,l)=>(c.children[l]=e[u],c.length=Math.max(c.length,e[u].length),c.fields[l]=Z.new({name:u,type:e[u].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new P(i),a=M({type:new nt(i),length:s,children:r,nullCount:0});[this.schema,this.data]=hs(o,a.children,s);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=va(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(t){return this.data.getValid(t)}get(t){return ut.visit(this.data,t)}set(t,e){return It.visit(this.data,t,e)}indexOf(t,e){return ti.visit(this.data,t,e)}getByteLength(t){return $t.visit(this.data,t)}[Symbol.iterator](){return Nr.visit(new E([this.data]))}toArray(){return[...this]}concat(...t){return new et(this.schema,[this,...t])}slice(t,e){const[i]=new E([this.data]).slice(t,e).data;return new sn(this.schema,i)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new E([this.data.children[t]]):null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(r=>r.name===t),e)}setChildAt(t,e){let i=this.schema,r=this.data;if(t>-1&&t<this.numCols){e||(e=new E([M({type:new ue,length:this.numRows})]));const s=i.fields.slice(),o=r.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],i=new P(s,new Map(this.schema.metadata)),r=M({type:new nt(s),children:o})}return new sn(i,r)}select(t){const e=this.schema.select(t),i=new nt(e.fields),r=[];for(const s of t){const o=this.schema.fields.findIndex(a=>a.name===s);~o&&(r[o]=this.data.children[o])}return new sn(e,M({type:i,length:this.numRows,children:r}))}selectAt(t){const e=this.schema.selectAt(t),i=t.map(s=>this.data.children[s]).filter(Boolean),r=M({type:new nt(e.fields),length:this.numRows,children:i});return new sn(e,r)}};_a=Symbol.toStringTag;at[_a]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(at.prototype);function hs(n,t,e=t.reduce((i,r)=>Math.max(i,r.length),0)){var i;const r=[...n.fields],s=[...t],o=(e+63&-64)>>3;for(const[a,c]of n.fields.entries()){const u=t[a];(!u||u.length!==e)&&(r[a]=c.clone({nullable:!0}),s[a]=(i=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:M({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[n.assign(r),M({type:new nt(r),length:e,children:s})]}function va(n,t,e=new Map){for(let i=-1,r=n.length;++i<r;){const o=n[i].type,a=t[i];if(w.isDictionary(o)){if(!e.has(o.id))a.dictionary&&e.set(o.id,a.dictionary);else if(e.get(o.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&va(o.children,a.children,e)}return e}class Rr extends at{constructor(t){const e=t.fields.map(r=>M({type:r.type})),i=M({type:new nt(t.fields),nullCount:0,children:e});super(t,i)}}var li;(function(n){n[n.BUFFER=0]="BUFFER"})(li||(li={}));var ui;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(ui||(ui={}));class ae{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+Y),(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):ui.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):li.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ui.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,li.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return ae.startBodyCompression(t),ae.addCodec(t,e),ae.addMethod(t,i),ae.endBodyCompression(t)}}class Sa{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,i){return t.prep(8,16),t.writeInt64(i),t.writeInt64(e),t.offset()}}let Ia=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,i){return t.prep(8,16),t.writeInt64(i),t.writeInt64(e),t.offset()}},Ht=class ir{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new ir).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+Y),(e||new ir).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}nodes(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new Ia).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new Sa).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new ae).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}},Re=class rr{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new rr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+Y),(e||new rr).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ht).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var di;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})(di||(di={}));let se=class Dt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+Y),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Je.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):di.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new q).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Je.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,di.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,0))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,i,r,s,o){return Dt.startMessage(t),Dt.addVersion(t,e),Dt.addHeaderType(t,i),Dt.addHeader(t,r),Dt.addBodyLength(t,s),Dt.addCustomMetadata(t,o),Dt.endMessage(t)}};var _u=qt;class vu extends L{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Oe.startNull(e),Oe.endNull(e)}visitInt(t,e){return pt.startInt(e),pt.addBitWidth(e,t.bitWidth),pt.addIsSigned(e,t.isSigned),pt.endInt(e)}visitFloat(t,e){return Ut.startFloatingPoint(e),Ut.addPrecision(e,t.precision),Ut.endFloatingPoint(e)}visitBinary(t,e){return ve.startBinary(e),ve.endBinary(e)}visitBool(t,e){return Se.startBool(e),Se.endBool(e)}visitUtf8(t,e){return Ae.startUtf8(e),Ae.endUtf8(e)}visitDecimal(t,e){return st.startDecimal(e),st.addScale(e,t.scale),st.addPrecision(e,t.precision),st.addBitWidth(e,t.bitWidth),st.endDecimal(e)}visitDate(t,e){return Ln.startDate(e),Ln.addUnit(e,t.unit),Ln.endDate(e)}visitTime(t,e){return vt.startTime(e),vt.addUnit(e,t.unit),vt.addBitWidth(e,t.bitWidth),vt.endTime(e)}visitTimestamp(t,e){const i=t.timezone&&e.createString(t.timezone)||void 0;return St.startTimestamp(e),St.addUnit(e,t.unit),i!==void 0&&St.addTimezone(e,i),St.endTimestamp(e)}visitInterval(t,e){return Rt.startInterval(e),Rt.addUnit(e,t.unit),Rt.endInterval(e)}visitList(t,e){return Ie.startList(e),Ie.endList(e)}visitStruct(t,e){return Be.startStruct_(e),Be.endStruct_(e)}visitUnion(t,e){ot.startTypeIdsVector(e,t.typeIds.length);const i=ot.createTypeIdsVector(e,t.typeIds);return ot.startUnion(e),ot.addMode(e,t.mode),ot.addTypeIds(e,i),ot.endUnion(e)}visitDictionary(t,e){const i=this.visit(t.indices,e);return Gt.startDictionaryEncoding(e),Gt.addId(e,new _u(t.id,0)),Gt.addIsOrdered(e,t.isOrdered),i!==void 0&&Gt.addIndexType(e,i),Gt.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return xt.startFixedSizeBinary(e),xt.addByteWidth(e,t.byteWidth),xt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Ct.startFixedSizeList(e),Ct.addListSize(e,t.listSize),Ct.endFixedSizeList(e)}visitMap(t,e){return xn.startMap(e),xn.addKeysSorted(e,t.keysSorted),xn.endMap(e)}}const Ei=new vu;function Su(n,t=new Map){return new P(Ou(n,t),Rn(n.customMetadata),t)}function Oa(n){return new gt(n.count,Ba(n.columns),Aa(n.columns))}function Iu(n){return new Wt(Oa(n.data),n.id,n.isDelta)}function Ou(n,t){return(n.fields||[]).filter(Boolean).map(e=>Z.fromJSON(e,t))}function fs(n,t){return(n.children||[]).filter(Boolean).map(e=>Z.fromJSON(e,t))}function Ba(n){return(n||[]).reduce((t,e)=>[...t,new Me(e.count,Bu(e.VALIDITY)),...Ba(e.children)],[])}function Aa(n,t=[]){for(let e=-1,i=(n||[]).length;++e<i;){const r=n[e];r.VALIDITY&&t.push(new Pt(t.length,r.VALIDITY.length)),r.TYPE&&t.push(new Pt(t.length,r.TYPE.length)),r.OFFSET&&t.push(new Pt(t.length,r.OFFSET.length)),r.DATA&&t.push(new Pt(t.length,r.DATA.length)),t=Aa(r.children,t)}return t}function Bu(n){return(n||[]).reduce((t,e)=>t+ +(e===0),0)}function Au(n,t){let e,i,r,s,o,a;return!t||!(s=n.dictionary)?(o=ys(n,fs(n,t)),r=new Z(n.name,o,n.nullable,Rn(n.customMetadata))):t.has(e=s.id)?(i=(i=s.indexType)?ps(i):new hn,a=new Ke(t.get(e),i,e,s.isOrdered),r=new Z(n.name,a,n.nullable,Rn(n.customMetadata))):(i=(i=s.indexType)?ps(i):new hn,t.set(e,o=ys(n,fs(n,t))),a=new Ke(o,i,e,s.isOrdered),r=new Z(n.name,a,n.nullable,Rn(n.customMetadata))),r||null}function Rn(n){return new Map(Object.entries(n||{}))}function ps(n){return new de(n.isSigned,n.bitWidth)}function ys(n,t){const e=n.type.name;switch(e){case"NONE":return new ue;case"null":return new ue;case"binary":return new zn;case"utf8":return new Vn;case"bool":return new $n;case"list":return new Jn((t||[])[0]);case"struct":return new nt(t||[]);case"struct_":return new nt(t||[])}switch(e){case"int":{const i=n.type;return new de(i.isSigned,i.bitWidth)}case"floatingpoint":{const i=n.type;return new fn(ct[i.precision])}case"decimal":{const i=n.type;return new Wn(i.scale,i.precision,i.bitWidth)}case"date":{const i=n.type;return new Yn(te[i.unit])}case"time":{const i=n.type;return new pn(C[i.unit],i.bitWidth)}case"timestamp":{const i=n.type;return new Kn(C[i.unit],i.timezone)}case"interval":{const i=n.type;return new Zn(le[i.unit])}case"union":{const i=n.type;return new Hn(mt[i.mode],i.typeIds||[],t||[])}case"fixedsizebinary":{const i=n.type;return new Xn(i.byteWidth)}case"fixedsizelist":{const i=n.type;return new Gn(i.listSize,(t||[])[0])}case"map":{const i=n.type;return new qn((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var ke=qt,Fu=ya,Du=Ze;class it{constructor(t,e,i,r){this._version=e,this._headerType=i,this.body=new Uint8Array(0),r&&(this._createHeader=()=>r),this._bodyLength=typeof t=="number"?t:t.low}static fromJSON(t,e){const i=new it(0,yt.V4,e);return i._createHeader=Tu(t,e),i}static decode(t){t=new Du(x(t));const e=se.getRootAsMessage(t),i=e.bodyLength(),r=e.version(),s=e.headerType(),o=new it(i,r,s);return o._createHeader=ku(e,s),o}static encode(t){const e=new Fu;let i=-1;return t.isSchema()?i=P.encode(e,t.header()):t.isRecordBatch()?i=gt.encode(e,t.header()):t.isDictionaryBatch()&&(i=Wt.encode(e,t.header())),se.startMessage(e),se.addVersion(e,yt.V4),se.addHeader(e,i),se.addHeaderType(e,t.headerType),se.addBodyLength(e,new ke(t.bodyLength,0)),se.finishMessageBuffer(e,se.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof P)return new it(0,yt.V4,R.Schema,t);if(t instanceof gt)return new it(e,yt.V4,R.RecordBatch,t);if(t instanceof Wt)return new it(e,yt.V4,R.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}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===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}}class gt{constructor(t,e,i){this._nodes=e,this._buffers=i,this._length=typeof t=="number"?t:t.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}}class Wt{constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=typeof e=="number"?e:e.low}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}}class Pt{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}}class Me{constructor(t,e){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof e=="number"?e:e.low}}function Tu(n,t){return()=>{switch(t){case R.Schema:return P.fromJSON(n);case R.RecordBatch:return gt.fromJSON(n);case R.DictionaryBatch:return Wt.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function ku(n,t){return()=>{switch(t){case R.Schema:return P.decode(n.header(new Tt));case R.RecordBatch:return gt.decode(n.header(new Ht),n.version());case R.DictionaryBatch:return Wt.decode(n.header(new Re),n.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}Z.encode=zu;Z.decode=Pu;Z.fromJSON=Au;P.encode=ju;P.decode=Nu;P.fromJSON=Su;gt.encode=Vu;gt.decode=Mu;gt.fromJSON=Oa;Wt.encode=$u;Wt.decode=Lu;Wt.fromJSON=Iu;Me.encode=Wu;Me.decode=Cu;Pt.encode=Yu;Pt.decode=xu;function Nu(n,t=new Map){const e=Eu(n,t);return new P(e,En(n),t)}function Mu(n,t=yt.V4){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new gt(n.length(),Uu(n),Ru(n,t))}function Lu(n,t=yt.V4){return new Wt(gt.decode(n.data(),t),n.id(),n.isDelta())}function xu(n){return new Pt(n.offset(),n.length())}function Cu(n){return new Me(n.length(),n.nullCount())}function Uu(n){const t=[];for(let e,i=-1,r=-1,s=n.nodesLength();++i<s;)(e=n.nodes(i))&&(t[++r]=Me.decode(e));return t}function Ru(n,t){const e=[];for(let i,r=-1,s=-1,o=n.buffersLength();++r<o;)(i=n.buffers(r))&&(t<yt.V4&&(i.bb_pos+=8*(r+1)),e[++s]=Pt.decode(i));return e}function Eu(n,t){const e=[];for(let i,r=-1,s=-1,o=n.fieldsLength();++r<o;)(i=n.fields(r))&&(e[++s]=Z.decode(i,t));return e}function ms(n,t){const e=[];for(let i,r=-1,s=-1,o=n.childrenLength();++r<o;)(i=n.children(r))&&(e[++s]=Z.decode(i,t));return e}function Pu(n,t){let e,i,r,s,o,a;return!t||!(a=n.dictionary())?(r=bs(n,ms(n,t)),i=new Z(n.name(),r,n.nullable(),En(n))):t.has(e=a.id().low)?(s=(s=a.indexType())?gs(s):new hn,o=new Ke(t.get(e),s,e,a.isOrdered()),i=new Z(n.name(),o,n.nullable(),En(n))):(s=(s=a.indexType())?gs(s):new hn,t.set(e,r=bs(n,ms(n,t))),o=new Ke(r,s,e,a.isOrdered()),i=new Z(n.name(),o,n.nullable(),En(n))),i||null}function En(n){const t=new Map;if(n)for(let e,i,r=-1,s=Math.trunc(n.customMetadataLength());++r<s;)(e=n.customMetadata(r))&&(i=e.key())!=null&&t.set(i,e.value());return t}function gs(n){return new de(n.isSigned(),n.bitWidth())}function bs(n,t){const e=n.typeType();switch(e){case J.NONE:return new ue;case J.Null:return new ue;case J.Binary:return new zn;case J.Utf8:return new Vn;case J.Bool:return new $n;case J.List:return new Jn((t||[])[0]);case J.Struct_:return new nt(t||[])}switch(e){case J.Int:{const i=n.type(new pt);return new de(i.isSigned(),i.bitWidth())}case J.FloatingPoint:{const i=n.type(new Ut);return new fn(i.precision())}case J.Decimal:{const i=n.type(new st);return new Wn(i.scale(),i.precision(),i.bitWidth())}case J.Date:{const i=n.type(new Ln);return new Yn(i.unit())}case J.Time:{const i=n.type(new vt);return new pn(i.unit(),i.bitWidth())}case J.Timestamp:{const i=n.type(new St);return new Kn(i.unit(),i.timezone())}case J.Interval:{const i=n.type(new Rt);return new Zn(i.unit())}case J.Union:{const i=n.type(new ot);return new Hn(i.mode(),i.typeIdsArray()||[],t||[])}case J.FixedSizeBinary:{const i=n.type(new xt);return new Xn(i.byteWidth())}case J.FixedSizeList:{const i=n.type(new Ct);return new Gn(i.listSize(),(t||[])[0])}case J.Map:{const i=n.type(new xn);return new qn((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${J[e]}" (${e})`)}function ju(n,t){const e=t.fields.map(s=>Z.encode(n,s));Tt.startFieldsVector(n,e.length);const i=Tt.createFieldsVector(n,e),r=t.metadata&&t.metadata.size>0?Tt.createCustomMetadataVector(n,[...t.metadata].map(([s,o])=>{const a=n.createString(`${s}`),c=n.createString(`${o}`);return q.startKeyValue(n),q.addKey(n,a),q.addValue(n,c),q.endKeyValue(n)})):-1;return Tt.startSchema(n),Tt.addFields(n,i),Tt.addEndianness(n,Ku?He.Little:He.Big),r!==-1&&Tt.addCustomMetadata(n,r),Tt.endSchema(n)}function zu(n,t){let e=-1,i=-1,r=-1;const s=t.type;let o=t.typeId;w.isDictionary(s)?(o=s.dictionary.typeId,r=Ei.visit(s,n),i=Ei.visit(s.dictionary,n)):i=Ei.visit(s,n);const a=(s.children||[]).map(l=>Z.encode(n,l)),c=wt.createChildrenVector(n,a),u=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(n,[...t.metadata].map(([l,h])=>{const f=n.createString(`${l}`),p=n.createString(`${h}`);return q.startKeyValue(n),q.addKey(n,f),q.addValue(n,p),q.endKeyValue(n)})):-1;return t.name&&(e=n.createString(t.name)),wt.startField(n),wt.addType(n,i),wt.addTypeType(n,o),wt.addChildren(n,c),wt.addNullable(n,!!t.nullable),e!==-1&&wt.addName(n,e),r!==-1&&wt.addDictionary(n,r),u!==-1&&wt.addCustomMetadata(n,u),wt.endField(n)}function Vu(n,t){const e=t.nodes||[],i=t.buffers||[];Ht.startNodesVector(n,e.length);for(const o of e.slice().reverse())Me.encode(n,o);const r=n.endVector();Ht.startBuffersVector(n,i.length);for(const o of i.slice().reverse())Pt.encode(n,o);const s=n.endVector();return Ht.startRecordBatch(n),Ht.addLength(n,new ke(t.length,0)),Ht.addNodes(n,r),Ht.addBuffers(n,s),Ht.endRecordBatch(n)}function $u(n,t){const e=gt.encode(n,t.data);return Re.startDictionaryBatch(n),Re.addId(n,new ke(t.id,0)),Re.addIsDelta(n,t.isDelta),Re.addData(n,e),Re.endDictionaryBatch(n)}function Wu(n,t){return Ia.createFieldNode(n,new ke(t.length,0),new ke(t.nullCount,0))}function Yu(n,t){return Sa.createBuffer(n,new ke(t.offset,0),new ke(t.length,0))}const Ku=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),Er=n=>`Expected ${R[n]} Message in stream, but was null or length 0.`,Pr=n=>`Header pointer of flatbuffer-encoded ${R[n]} Message is null or length 0.`,Fa=(n,t)=>`Expected to read ${n} metadata bytes, but only read ${t}.`,Da=(n,t)=>`Expected to read ${n} bytes for message body, but only read ${t}.`;class Ta{constructor(t){this.source=t instanceof ai?t:new ai(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?H:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Er(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=x(this.source.read(t));if(e.byteLength<t)throw new Error(Da(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=R.Schema,i=this.readMessage(e),r=i==null?void 0:i.header();if(t&&!r)throw new Error(Pr(e));return r}readMetadataLength(){const t=this.source.read(Ti),e=t&&new Ze(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}}readMetadata(t){const e=this.source.read(t);if(!e)return H;if(e.byteLength<t)throw new Error(Fa(t,e.byteLength));return{done:!1,value:it.decode(e)}}}class Zu{constructor(t,e){this.source=t instanceof Ge?t:Hs(t)?new ci(t,e):new Ge(t)}[Symbol.asyncIterator](){return this}next(){return g(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done||t.value===-1&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?H:t})}throw(t){return g(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return g(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return g(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Er(t));return e.value})}readMessageBody(t){return g(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const e=x(yield this.source.read(t));if(e.byteLength<t)throw new Error(Da(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return g(this,void 0,void 0,function*(){const e=R.Schema,i=yield this.readMessage(e),r=i==null?void 0:i.header();if(t&&!r)throw new Error(Pr(e));return r})}readMetadataLength(){return g(this,void 0,void 0,function*(){const t=yield this.source.read(Ti),e=t&&new Ze(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}})}readMetadata(t){return g(this,void 0,void 0,function*(){const e=yield this.source.read(t);if(!e)return H;if(e.byteLength<t)throw new Error(Fa(t,e.byteLength));return{done:!1,value:it.decode(e)}})}}class Ju extends Ta{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof us?t:new us(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:it.fromJSON(t.schema,R.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:it.fromJSON(e,R.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:it.fromJSON(e,R.RecordBatch)}}return this._body=[],H}readMessageBody(t){return e(this._body);function e(i){return(i||[]).reduce((r,s)=>[...r,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Er(t));return e.value}readSchema(){const t=R.Schema,e=this.readMessage(t),i=e==null?void 0:e.header();if(!e||!i)throw new Error(Pr(t));return i}}const Ti=4,sr="ARROW1",mn=new Uint8Array(sr.length);for(let n=0;n<sr.length;n+=1)mn[n]=sr.codePointAt(n);function jr(n,t=0){for(let e=-1,i=mn.length;++e<i;)if(mn[e]!==n[t+e])return!1;return!0}const An=mn.length,ka=An+Ti,Hu=An*2+Ti;class Qt extends Mr{constructor(t){super(),this._impl=t}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(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){const e=this._impl.open(t);return ce(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return _t.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return _t.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Qt?t:Ji(t)?Qu(t):Hs(t)?nd(t):ce(t)?g(this,void 0,void 0,function*(){return yield Qt.from(yield t)}):Xs(t)||br(t)||Gs(t)||tn(t)?ed(new Ge(t)):td(new ai(t))}static readAll(t){return t instanceof Qt?t.isSync()?ws(t):_s(t):Ji(t)||ArrayBuffer.isView(t)||Sn(t)||Js(t)?ws(t):_s(t)}}class hi extends Qt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Et(this,arguments,function*(){yield D(yield*Mn(De(this[Symbol.iterator]())))})}}class fi extends Qt{constructor(t){super(t),this._impl=t}readAll(){var t,e;return g(this,void 0,void 0,function*(){const i=new Array;try{for(var r=De(this),s;s=yield r.next(),!s.done;){const o=s.value;i.push(o)}}catch(o){t={error:o}}finally{try{s&&!s.done&&(e=r.return)&&(yield e.call(r))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Na extends hi{constructor(t){super(t),this._impl=t}}class Xu extends fi{constructor(t){super(t),this._impl=t}}class Ma{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const i=this._loadVectors(t,e,this.schema.fields),r=M({type:new nt(this.schema.fields),length:t.length,children:i});return new at(this.schema,r)}_loadDictionaryBatch(t,e){const{id:i,isDelta:r}=t,{dictionaries:s,schema:o}=this,a=s.get(i);if(r||!a){const c=o.dictionaries.get(i),u=this._loadVectors(t.data,e,[c]);return(a&&r?a.concat(new E(u)):new E(u)).memoize()}return a.memoize()}_loadVectors(t,e,i){return new ba(e,t.nodes,t.buffers,this.dictionaries).visitMany(i)}}class pi extends Ma{constructor(t,e){super(e),this._reader=Ji(t)?new Ju(this._handle=t):new Ta(this._handle=t)}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(t){return this.closed||(this.autoDestroy=xa(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):H}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):H}next(){if(this.closed)return H;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),r=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,r)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),r=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,r);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Rr(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class yi extends Ma{constructor(t,e){super(e),this._reader=new Zu(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return g(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return g(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=xa(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return g(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):H})}return(t){return g(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):H})}next(){return g(this,void 0,void 0,function*(){if(this.closed)return H;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),r=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,r)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),r=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,r);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Rr(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return g(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class La extends pi{constructor(t,e){super(t instanceof ds?t:new ds(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){const r=this._reader.readMessage(R.RecordBatch);if(r!=null&&r.isRecordBatch()){const s=r.header(),o=this._reader.readMessageBody(r.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;const i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){const r=this._reader.readMessage(R.DictionaryBatch);if(r!=null&&r.isDictionaryBatch()){const s=r.header(),o=this._reader.readMessageBody(r.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-ka,i=t.readInt32(e),r=t.readAt(e-i,i);return yn.decode(r)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}}class Gu extends yi{constructor(t,...e){const i=typeof e[0]!="number"?e.shift():void 0,r=e[0]instanceof Map?e.shift():void 0;super(t instanceof ci?t:new ci(t,i),r)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return g(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return g(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());const i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){const r=yield this._reader.readMessage(R.RecordBatch);if(r!=null&&r.isRecordBatch()){const s=r.header(),o=yield this._reader.readMessageBody(r.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return g(this,void 0,void 0,function*(){const i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){const r=yield this._reader.readMessage(R.DictionaryBatch);if(r!=null&&r.isDictionaryBatch()){const s=r.header(),o=yield this._reader.readMessageBody(r.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return g(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-ka,i=yield t.readInt32(e),r=yield t.readAt(e-i,i);return yn.decode(r)})}_readNextMessageAndValidate(t){return g(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}}class qu extends pi{constructor(t,e){super(t,e)}_loadVectors(t,e,i){return new uu(e,t.nodes,t.buffers,this.dictionaries).visitMany(i)}}function xa(n,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:n.autoDestroy}function*ws(n){const t=Qt.from(n);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function _s(n){return Et(this,arguments,function*(){const e=yield D(Qt.from(n));try{if(!(yield D(e.open({autoDestroy:!1}))).closed)do yield yield D(e);while(!(yield D(e.reset().open())).closed)}finally{yield D(e.cancel())}})}function Qu(n){return new hi(new qu(n))}function td(n){const t=n.peek(An+7&-8);return t&&t.byteLength>=4?jr(t)?new Na(new La(n.read())):new hi(new pi(n)):new hi(new pi(function*(){}()))}function ed(n){return g(this,void 0,void 0,function*(){const t=yield n.peek(An+7&-8);return t&&t.byteLength>=4?jr(t)?new Na(new La(yield n.read())):new fi(new yi(n)):new fi(new yi(function(){return Et(this,arguments,function*(){})}()))})}function nd(n){return g(this,void 0,void 0,function*(){const{size:t}=yield n.stat(),e=new ci(n,t);return t>=Hu&&jr(yield e.readAt(0,An+7&-8))?new Xu(new Gu(e)):new fi(new yi(e))})}class X extends L{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...t){const e=r=>r.flatMap(s=>Array.isArray(s)?e(s):s instanceof at?s.data.children:s.data),i=new X;return i.visitMany(e(t)),i}visit(t){if(t instanceof E)return this.visitMany(t.data),this;const{type:e}=t;if(!w.isDictionary(e)){const{length:i,nullCount:r}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");w.isNull(e)||Bt.call(this,r<=0?new Uint8Array(0):Fr(t.offset,i,t.nullBitmap)),this.nodes.push(new Me(i,r))}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function Bt(n){const t=n.byteLength+7&-8;return this.buffers.push(n),this.bufferRegions.push(new Pt(this._byteLength,t)),this._byteLength+=t,this}function id(n){const{type:t,length:e,typeIds:i,valueOffsets:r}=n;if(Bt.call(this,i),t.mode===mt.Sparse)return or.call(this,n);if(t.mode===mt.Dense){if(n.offset<=0)return Bt.call(this,r),or.call(this,n);{const s=i.reduce((l,h)=>Math.max(l,h),i[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),c=new Int32Array(e),u=_r(-r[0],e,r);for(let l,h,f=-1;++f<e;)(h=a[l=i[f]])===-1&&(h=a[l]=u[l]),c[f]=u[f]-h,++o[l];Bt.call(this,c);for(let l,h=-1,f=t.children.length;++h<f;)if(l=n.children[h]){const p=t.typeIds[h],y=Math.min(e,o[p]);this.visit(l.slice(a[p],y))}}}return this}function rd(n){let t;return n.nullCount>=n.length?Bt.call(this,new Uint8Array(0)):(t=n.values)instanceof Uint8Array?Bt.call(this,Fr(n.offset,n.length,t)):Bt.call(this,Qn(n.values))}function me(n){return Bt.call(this,n.values.subarray(0,n.length*n.stride))}function Ca(n){const{length:t,values:e,valueOffsets:i}=n,r=i[0],s=i[t],o=Math.min(s-r,e.byteLength-r);return Bt.call(this,_r(-i[0],t,i)),Bt.call(this,e.subarray(r,r+o)),this}function zr(n){const{length:t,valueOffsets:e}=n;return e&&Bt.call(this,_r(e[0],t,e)),this.visit(n.children[0])}function or(n){return this.visitMany(n.type.children.map((t,e)=>n.children[e]).filter(Boolean))[0]}X.prototype.visitBool=rd;X.prototype.visitInt=me;X.prototype.visitFloat=me;X.prototype.visitUtf8=Ca;X.prototype.visitBinary=Ca;X.prototype.visitFixedSizeBinary=me;X.prototype.visitDate=me;X.prototype.visitTimestamp=me;X.prototype.visitTime=me;X.prototype.visitDecimal=me;X.prototype.visitList=zr;X.prototype.visitStruct=or;X.prototype.visitUnion=id;X.prototype.visitInterval=me;X.prototype.visitFixedSizeList=zr;X.prototype.visitMap=zr;class Ua extends Mr{constructor(t){super(),this._position=0,this._started=!1,this._sink=new Un,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,lt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ce(t)?t.then(e=>this.writeAll(e)):tn(t)?Yr(this,t):Wr(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Un?this._sink=t:(this._sink=new Un,t&&Bc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Ac(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!nr(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof et&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof at&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!nr(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof at?t instanceof Rr||this._writeRecordBatch(t):t instanceof et?this.writeAll(t.batches):Sn(t)&&this.writeAll(t)}_writeMessage(t,e=8){const i=e-1,r=it.encode(t),s=r.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+i&~i,c=a-s-o;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new he(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new he(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(r),this._writePadding(c)}_write(t){if(this._started){const e=x(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(it.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(mn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:i,bufferRegions:r,buffers:s}=X.assemble(t),o=new gt(t.numRows,i,r),a=it.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,i=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));const{byteLength:r,nodes:s,bufferRegions:o,buffers:a}=X.assemble(new E([t])),c=new gt(t.length,s,o),u=new Wt(c,e,i),l=it.from(u,r);return this._writeMessage(l)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,i,r;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(i=e.byteLength)>0&&(this._write(e),(r=(i+7&-8)-i)>0&&this._writePadding(r));return this}_writeDictionaries(t){for(let[e,i]of t.dictionaries){let r=this._dictionaryDeltaOffsets.get(e)||0;if(r===0||(i=i==null?void 0:i.slice(r)).length>0)for(const s of i.data)this._writeDictionaryBatch(s,e,r>0),r+=s.length}return this}}class Vr extends Ua{static writeAll(t,e){const i=new Vr(e);return ce(t)?t.then(r=>i.writeAll(r)):tn(t)?Yr(i,t):Wr(i,t)}}class $r extends Ua{static writeAll(t){const e=new $r;return ce(t)?t.then(i=>e.writeAll(i)):tn(t)?Yr(e,t):Wr(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const e=yn.encode(new yn(t,yt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function Wr(n,t){let e=t;t instanceof et&&(e=t.batches,n.reset(void 0,t.schema));for(const i of e)n.write(i);return n.finish()}function Yr(n,t){var e,i,r,s;return g(this,void 0,void 0,function*(){try{for(e=De(t);i=yield e.next(),!i.done;){const o=i.value;n.write(o)}}catch(o){r={error:o}}finally{try{i&&!i.done&&(s=e.return)&&(yield s.call(e))}finally{if(r)throw r.error}}return n.finish()})}function on(n){const t=Qt.from(n);return ce(t)?t.then(e=>on(e)):t.isAsync()?t.readAll().then(e=>new et(e)):new et(t.readAll())}function Pi(n,t="stream"){return(t==="stream"?Vr:$r).writeAll(n).toUint8Array(!0)}var vs=function(){function n(t,e,i,r){var s=this;this.getCell=function(o,a){var c=o<s.headerRows&&a<s.headerColumns,u=o>=s.headerRows&&a<s.headerColumns,l=o<s.headerRows&&a>=s.headerColumns;if(c){var h=["blank"];return a>0&&h.push("level"+o),{type:"blank",classNames:h.join(" "),content:""}}else if(l){var f=a-s.headerColumns,h=["col_heading","level"+o,"col"+f];return{type:"columns",classNames:h.join(" "),content:s.getContent(s.columnsTable,f,o)}}else if(u){var p=o-s.headerRows,h=["row_heading","level"+a,"row"+p];return{type:"index",id:"T_".concat(s.uuid,"level").concat(a,"_row").concat(p),classNames:h.join(" "),content:s.getContent(s.indexTable,p,a)}}else{var p=o-s.headerRows,f=a-s.headerColumns,h=["data","row"+p,"col"+f],y=s.styler?s.getContent(s.styler.displayValuesTable,p,f):s.getContent(s.dataTable,p,f);return{type:"data",id:"T_".concat(s.uuid,"row").concat(p,"_col").concat(f),classNames:h.join(" "),content:y}}},this.getContent=function(o,a,c){var u=o.getChildAt(c);if(u===null)return"";var l=s.getColumnTypeId(o,c);switch(l){case d.Timestamp:return s.nanosToDate(u.get(a));default:return u.get(a)}},this.dataTable=on(t),this.indexTable=on(e),this.columnsTable=on(i),this.styler=r?{caption:r.caption,displayValuesTable:on(r.displayValues),styles:r.styles,uuid:r.uuid}:void 0}return Object.defineProperty(n.prototype,"rows",{get:function(){return this.indexTable.numRows+this.columnsTable.numCols},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"columns",{get:function(){return this.indexTable.numCols+this.columnsTable.numRows},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"headerRows",{get:function(){return this.rows-this.dataRows},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"headerColumns",{get:function(){return this.columns-this.dataColumns},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dataRows",{get:function(){return this.dataTable.numRows},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dataColumns",{get:function(){return this.dataTable.numCols},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"uuid",{get:function(){return this.styler&&this.styler.uuid},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"caption",{get:function(){return this.styler&&this.styler.caption},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"styles",{get:function(){return this.styler&&this.styler.styles},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"table",{get:function(){return this.dataTable},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"index",{get:function(){return this.indexTable},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"columnTable",{get:function(){return this.columnsTable},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){return{data:Pi(this.dataTable),index:Pi(this.indexTable),columns:Pi(this.columnsTable)}},n.prototype.getColumnTypeId=function(t,e){return t.schema.fields[e].type.typeId},n.prototype.nanosToDate=function(t){return new Date(t/1e6)},n}(),cn=function(){return cn=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},cn.apply(this,arguments)},ln;(function(n){n.COMPONENT_READY="streamlit:componentReady",n.SET_COMPONENT_VALUE="streamlit:setComponentValue",n.SET_FRAME_HEIGHT="streamlit:setFrameHeight"})(ln||(ln={}));var Ne=function(){function n(){}return n.API_VERSION=1,n.RENDER_EVENT="streamlit:render",n.events=new EventTarget,n.registeredMessageListener=!1,n.setComponentReady=function(){n.registeredMessageListener||(window.addEventListener("message",n.onMessageEvent),n.registeredMessageListener=!0),n.sendBackMsg(ln.COMPONENT_READY,{apiVersion:n.API_VERSION})},n.setFrameHeight=function(t){t===void 0&&(t=document.body.scrollHeight),t!==n.lastFrameHeight&&(n.lastFrameHeight=t,n.sendBackMsg(ln.SET_FRAME_HEIGHT,{height:t}))},n.setComponentValue=function(t){var e;t instanceof vs?(e="dataframe",t=t.serialize()):od(t)?(e="bytes",t=new Uint8Array(t.buffer)):t instanceof ArrayBuffer?(e="bytes",t=new Uint8Array(t)):e="json",n.sendBackMsg(ln.SET_COMPONENT_VALUE,{value:t,dataType:e})},n.onMessageEvent=function(t){var e=t.data.type;switch(e){case n.RENDER_EVENT:n.onRenderMessage(t.data);break}},n.onRenderMessage=function(t){var e=t.args;e==null&&(console.error("Got null args in onRenderMessage. This should never happen"),e={});var i=t.dfs&&t.dfs.length>0?n.argsDataframeToObject(t.dfs):{};e=cn(cn({},e),i);var r=!!t.disabled,s=t.theme;s&&sd(s);var o={disabled:r,args:e,theme:s},a=new CustomEvent(n.RENDER_EVENT,{detail:o});n.events.dispatchEvent(a)},n.argsDataframeToObject=function(t){var e=t.map(function(i){var r=i.key,s=i.value;return[r,n.toArrowTable(s)]});return Object.fromEntries(e)},n.toArrowTable=function(t){var e,i=(e=t.data,e.data),r=e.index,s=e.columns,o=e.styler;return new vs(i,r,s,o)},n.sendBackMsg=function(t,e){window.parent.postMessage(cn({isStreamlitMessage:!0,type:t},e),"*")},n}(),sd=function(n){var t=document.createElement("style");document.head.appendChild(t),t.innerHTML=`
    :root {
      --primary-color: `.concat(n.primaryColor,`;
      --background-color: `).concat(n.backgroundColor,`;
      --secondary-background-color: `).concat(n.secondaryBackgroundColor,`;
      --text-color: `).concat(n.textColor,`;
      --font: `).concat(n.font,`;
    }

    body {
      background-color: var(--background-color);
      color: var(--text-color);
    }
  `)};function od(n){var t=!1;try{t=n instanceof BigInt64Array||n instanceof BigUint64Array}catch{}return n instanceof Int8Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int16Array||n instanceof Uint16Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Float32Array||n instanceof Float64Array||t}var ad=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();(function(n){ad(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.componentDidMount=function(){Ne.setFrameHeight()},t.prototype.componentDidUpdate=function(){Ne.setFrameHeight()},t})(_c.PureComponent);function Nt(n,t){var e={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&t.indexOf(i)<0&&(e[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(i=Object.getOwnPropertySymbols(n);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(e[i[r]]=n[i[r]])}return e}var _e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Zr(n,t){return n(t={exports:{}},t.exports),t.exports}var we=Zr(function(n,t){Object.defineProperty(t,"__esModule",{value:!0});var e=function(){function i(){var r=this;this.locked=new Map,this.addToLocked=function(s,o){var a=r.locked.get(s);a===void 0?o===void 0?r.locked.set(s,[]):r.locked.set(s,[o]):o!==void 0&&(a.unshift(o),r.locked.set(s,a))},this.isLocked=function(s){return r.locked.has(s)},this.lock=function(s){return new Promise(function(o,a){r.isLocked(s)?r.addToLocked(s,o):(r.addToLocked(s),o())})},this.unlock=function(s){var o=r.locked.get(s);if(o!==void 0&&o.length!==0){var a=o.pop();r.locked.set(s,o),a!==void 0&&setTimeout(a,0)}else r.locked.delete(s)}}return i.getInstance=function(){return i.instance===void 0&&(i.instance=new i),i.instance},i}();t.default=function(){return e.getInstance()}});Kr(we);var cd=Kr(Zr(function(n,t){var e=_e&&_e.__awaiter||function(l,h,f,p){return new(f||(f=Promise))(function(y,k){function b(U){try{$(p.next(U))}catch(m){k(m)}}function N(U){try{$(p.throw(U))}catch(m){k(m)}}function $(U){U.done?y(U.value):new f(function(m){m(U.value)}).then(b,N)}$((p=p.apply(l,h||[])).next())})},i=_e&&_e.__generator||function(l,h){var f,p,y,k,b={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return k={next:N(0),throw:N(1),return:N(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function N($){return function(U){return function(m){if(f)throw new TypeError("Generator is already executing.");for(;b;)try{if(f=1,p&&(y=2&m[0]?p.return:m[0]?p.throw||((y=p.return)&&y.call(p),0):p.next)&&!(y=y.call(p,m[1])).done)return y;switch(p=0,y&&(m=[2&m[0],y.value]),m[0]){case 0:case 1:y=m;break;case 4:return b.label++,{value:m[1],done:!1};case 5:b.label++,p=m[1],m=[0];continue;case 7:m=b.ops.pop(),b.trys.pop();continue;default:if(y=b.trys,!((y=y.length>0&&y[y.length-1])||m[0]!==6&&m[0]!==2)){b=0;continue}if(m[0]===3&&(!y||m[1]>y[0]&&m[1]<y[3])){b.label=m[1];break}if(m[0]===6&&b.label<y[1]){b.label=y[1],y=m;break}if(y&&b.label<y[2]){b.label=y[2],b.ops.push(m);break}y[2]&&b.ops.pop(),b.trys.pop();continue}m=h.call(l,b)}catch(ht){m=[6,ht],p=0}finally{f=y=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([$,U])}}},r=_e;Object.defineProperty(t,"__esModule",{value:!0});var s="browser-tabs-lock-key",o={key:function(l){return e(r,void 0,void 0,function(){return i(this,function(h){throw new Error("Unsupported")})})},getItem:function(l){return e(r,void 0,void 0,function(){return i(this,function(h){throw new Error("Unsupported")})})},clear:function(){return e(r,void 0,void 0,function(){return i(this,function(l){return[2,window.localStorage.clear()]})})},removeItem:function(l){return e(r,void 0,void 0,function(){return i(this,function(h){throw new Error("Unsupported")})})},setItem:function(l,h){return e(r,void 0,void 0,function(){return i(this,function(f){throw new Error("Unsupported")})})},keySync:function(l){return window.localStorage.key(l)},getItemSync:function(l){return window.localStorage.getItem(l)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(l){return window.localStorage.removeItem(l)},setItemSync:function(l,h){return window.localStorage.setItem(l,h)}};function a(l){return new Promise(function(h){return setTimeout(h,l)})}function c(l){for(var h="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",f="",p=0;p<l;p++)f+=h[Math.floor(Math.random()*h.length)];return f}var u=function(){function l(h){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+c(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=h,l.waiters===void 0&&(l.waiters=[])}return l.prototype.acquireLock=function(h,f){return f===void 0&&(f=5e3),e(this,void 0,void 0,function(){var p,y,k,b,N,$,U;return i(this,function(m){switch(m.label){case 0:p=Date.now()+c(4),y=Date.now()+f,k=s+"-"+h,b=this.storageHandler===void 0?o:this.storageHandler,m.label=1;case 1:return Date.now()<y?[4,a(30)]:[3,8];case 2:return m.sent(),b.getItemSync(k)!==null?[3,5]:(N=this.id+"-"+h+"-"+p,[4,a(Math.floor(25*Math.random()))]);case 3:return m.sent(),b.setItemSync(k,JSON.stringify({id:this.id,iat:p,timeoutKey:N,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,a(30)];case 4:return m.sent(),($=b.getItemSync(k))!==null&&(U=JSON.parse($)).id===this.id&&U.iat===p?(this.acquiredIatSet.add(p),this.refreshLockWhileAcquired(k,p),[2,!0]):[3,7];case 5:return l.lockCorrector(this.storageHandler===void 0?o:this.storageHandler),[4,this.waitForSomethingToChange(y)];case 6:m.sent(),m.label=7;case 7:return p=Date.now()+c(4),[3,1];case 8:return[2,!1]}})})},l.prototype.refreshLockWhileAcquired=function(h,f){return e(this,void 0,void 0,function(){var p=this;return i(this,function(y){return setTimeout(function(){return e(p,void 0,void 0,function(){var k,b,N;return i(this,function($){switch($.label){case 0:return[4,we.default().lock(f)];case 1:return $.sent(),this.acquiredIatSet.has(f)?(k=this.storageHandler===void 0?o:this.storageHandler,(b=k.getItemSync(h))===null?(we.default().unlock(f),[2]):((N=JSON.parse(b)).timeRefreshed=Date.now(),k.setItemSync(h,JSON.stringify(N)),we.default().unlock(f),this.refreshLockWhileAcquired(h,f),[2])):(we.default().unlock(f),[2])}})})},1e3),[2]})})},l.prototype.waitForSomethingToChange=function(h){return e(this,void 0,void 0,function(){return i(this,function(f){switch(f.label){case 0:return[4,new Promise(function(p){var y=!1,k=Date.now(),b=!1;function N(){if(b||(window.removeEventListener("storage",N),l.removeFromWaiting(N),clearTimeout($),b=!0),!y){y=!0;var U=50-(Date.now()-k);U>0?setTimeout(p,U):p(null)}}window.addEventListener("storage",N),l.addToWaiting(N);var $=setTimeout(N,Math.max(0,h-Date.now()))})];case 1:return f.sent(),[2]}})})},l.addToWaiting=function(h){this.removeFromWaiting(h),l.waiters!==void 0&&l.waiters.push(h)},l.removeFromWaiting=function(h){l.waiters!==void 0&&(l.waiters=l.waiters.filter(function(f){return f!==h}))},l.notifyWaiters=function(){l.waiters!==void 0&&l.waiters.slice().forEach(function(h){return h()})},l.prototype.releaseLock=function(h){return e(this,void 0,void 0,function(){return i(this,function(f){switch(f.label){case 0:return[4,this.releaseLock__private__(h)];case 1:return[2,f.sent()]}})})},l.prototype.releaseLock__private__=function(h){return e(this,void 0,void 0,function(){var f,p,y,k;return i(this,function(b){switch(b.label){case 0:return f=this.storageHandler===void 0?o:this.storageHandler,p=s+"-"+h,(y=f.getItemSync(p))===null?[2]:(k=JSON.parse(y)).id!==this.id?[3,2]:[4,we.default().lock(k.iat)];case 1:b.sent(),this.acquiredIatSet.delete(k.iat),f.removeItemSync(p),we.default().unlock(k.iat),l.notifyWaiters(),b.label=2;case 2:return[2]}})})},l.lockCorrector=function(h){for(var f=Date.now()-5e3,p=h,y=[],k=0;;){var b=p.keySync(k);if(b===null)break;y.push(b),k++}for(var N=!1,$=0;$<y.length;$++){var U=y[$];if(U.includes(s)){var m=p.getItemSync(U);if(m!==null){var ht=JSON.parse(m);(ht.timeRefreshed===void 0&&ht.timeAcquired<f||ht.timeRefreshed!==void 0&&ht.timeRefreshed<f)&&(p.removeItemSync(U),N=!0)}}}N&&l.notifyWaiters()},l.waiters=void 0,l}();t.default=u}));const ld={timeoutInSeconds:60},Ra={name:"auth0-spa-js",version:"2.1.3"},Ea=()=>Date.now();class tt extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,tt.prototype)}static fromPayload({error:t,error_description:e}){return new tt(t,e)}}class ki extends tt{constructor(t,e,i,r=null){super(t,e),this.state=i,this.appState=r,Object.setPrototypeOf(this,ki.prototype)}}class gn extends tt{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,gn.prototype)}}class Jr extends gn{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,Jr.prototype)}}class Hr extends tt{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,Hr.prototype)}}class Xr extends tt{constructor(t,e,i){super(t,e),this.mfa_token=i,Object.setPrototypeOf(this,Xr.prototype)}}class Ni extends tt{constructor(t,e){super("missing_refresh_token",`Missing Refresh Token (audience: '${Ss(t,["default"])}', scope: '${Ss(e)}')`),this.audience=t,this.scope=e,Object.setPrototypeOf(this,Ni.prototype)}}function Ss(n,t=[]){return n&&!t.includes(n)?n:""}const Pn=()=>window.crypto,ji=()=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(Pn().getRandomValues(new Uint8Array(43))).forEach(e=>t+=n[e%n.length]),t},Is=n=>btoa(n),ar=n=>{var{clientId:t}=n,e=Nt(n,["clientId"]);return new URLSearchParams((i=>Object.keys(i).filter(r=>i[r]!==void 0).reduce((r,s)=>Object.assign(Object.assign({},r),{[s]:i[s]}),{}))(Object.assign({client_id:t},e))).toString()},Os=n=>(t=>decodeURIComponent(atob(t).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(n.replace(/_/g,"/").replace(/-/g,"+")),ud=async(n,t)=>{const e=await fetch(n,t);return{ok:e.ok,json:await e.json()}},dd=async(n,t,e)=>{const i=new AbortController;let r;return t.signal=i.signal,Promise.race([ud(n,t),new Promise((s,o)=>{r=setTimeout(()=>{i.abort(),o(new Error("Timeout when executing 'fetch'"))},e)})]).finally(()=>{clearTimeout(r)})},hd=async(n,t,e,i,r,s,o)=>{return a={auth:{audience:t,scope:e},timeout:r,fetchUrl:n,fetchOptions:i,useFormData:o},c=s,new Promise(function(u,l){const h=new MessageChannel;h.port1.onmessage=function(f){f.data.error?l(new Error(f.data.error)):u(f.data),h.port1.close()},c.postMessage(a,[h.port2])});var a,c},fd=async(n,t,e,i,r,s,o=1e4)=>r?hd(n,t,e,i,o,r,s):dd(n,i,o);async function pd(n,t){var{baseUrl:e,timeout:i,audience:r,scope:s,auth0Client:o,useFormData:a}=n,c=Nt(n,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const u=a?ar(c):JSON.stringify(c);return await async function(l,h,f,p,y,k,b){let N,$=null;for(let re=0;re<3;re++)try{N=await fd(l,f,p,y,k,b,h),$=null;break}catch($a){$=$a}if($)throw $;const U=N.json,{error:m,error_description:ht}=U,Fn=Nt(U,["error","error_description"]),{ok:Yt}=N;if(!Yt){const re=ht||`HTTP error. Unable to fetch ${l}`;throw m==="mfa_required"?new Xr(m,re,Fn.mfa_token):m==="missing_refresh_token"?new Ni(f,p):new tt(m||"request_error",re)}return Fn}(`${e}/oauth/token`,i,r||"default",s,{method:"POST",body:u,headers:{"Content-Type":a?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(o||Ra))}},t,a)}const Nn=(...n)=>{return(t=n.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(t))).join(" ");var t};class jt{constructor(t,e="@@auth0spajs@@",i){this.prefix=e,this.suffix=i,this.clientId=t.clientId,this.scope=t.scope,this.audience=t.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(t){const[e,i,r,s]=t.split("::");return new jt({clientId:i,scope:s,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:i,client_id:r}=t;return new jt({scope:e,audience:i,clientId:r})}}class yd{set(t,e){localStorage.setItem(t,JSON.stringify(e))}get(t){const e=window.localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch{return}}remove(t){localStorage.removeItem(t)}allKeys(){return Object.keys(window.localStorage).filter(t=>t.startsWith("@@auth0spajs@@"))}}class Pa{constructor(){this.enclosedCache=function(){let t={};return{set(e,i){t[e]=i},get(e){const i=t[e];if(i)return i},remove(e){delete t[e]},allKeys:()=>Object.keys(t)}}()}}class md{constructor(t,e,i){this.cache=t,this.keyManifest=e,this.nowProvider=i||Ea}async setIdToken(t,e,i){var r;const s=this.getIdTokenCacheKey(t);await this.cache.set(s,{id_token:e,decodedToken:i}),await((r=this.keyManifest)===null||r===void 0?void 0:r.add(s))}async getIdToken(t){const e=await this.cache.get(this.getIdTokenCacheKey(t.clientId));if(!e&&t.scope&&t.audience){const i=await this.get(t);return!i||!i.id_token||!i.decodedToken?void 0:{id_token:i.id_token,decodedToken:i.decodedToken}}if(e)return{id_token:e.id_token,decodedToken:e.decodedToken}}async get(t,e=0){var i;let r=await this.cache.get(t.toKey());if(!r){const a=await this.getCacheKeys();if(!a)return;const c=this.matchExistingCacheKey(t,a);c&&(r=await this.cache.get(c))}if(!r)return;const s=await this.nowProvider(),o=Math.floor(s/1e3);return r.expiresAt-e<o?r.body.refresh_token?(r.body={refresh_token:r.body.refresh_token},await this.cache.set(t.toKey(),r),r.body):(await this.cache.remove(t.toKey()),void await((i=this.keyManifest)===null||i===void 0?void 0:i.remove(t.toKey()))):r.body}async set(t){var e;const i=new jt({clientId:t.client_id,scope:t.scope,audience:t.audience}),r=await this.wrapCacheEntry(t);await this.cache.set(i.toKey(),r),await((e=this.keyManifest)===null||e===void 0?void 0:e.add(i.toKey()))}async clear(t){var e;const i=await this.getCacheKeys();i&&(await i.filter(r=>!t||r.includes(t)).reduce(async(r,s)=>{await r,await this.cache.remove(s)},Promise.resolve()),await((e=this.keyManifest)===null||e===void 0?void 0:e.clear()))}async wrapCacheEntry(t){const e=await this.nowProvider();return{body:t,expiresAt:Math.floor(e/1e3)+t.expires_in}}async getCacheKeys(){var t;return this.keyManifest?(t=await this.keyManifest.get())===null||t===void 0?void 0:t.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(t){return new jt({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter(i=>{var r;const s=jt.fromKey(i),o=new Set(s.scope&&s.scope.split(" ")),a=((r=t.scope)===null||r===void 0?void 0:r.split(" "))||[],c=s.scope&&a.reduce((u,l)=>u&&o.has(l),!0);return s.prefix==="@@auth0spajs@@"&&s.clientId===t.clientId&&s.audience===t.audience&&c})[0]}}class gd{constructor(t,e,i){this.storage=t,this.clientId=e,this.cookieDomain=i,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(t){this.storage.save(this.storageKey,t,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const rn=n=>typeof n=="number",bd=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],wd=n=>{if(!n.id_token)throw new Error("ID token is required but missing");const t=(s=>{const o=s.split("."),[a,c,u]=o;if(o.length!==3||!a||!c||!u)throw new Error("ID token could not be decoded");const l=JSON.parse(Os(c)),h={__raw:s},f={};return Object.keys(l).forEach(p=>{h[p]=l[p],bd.includes(p)||(f[p]=l[p])}),{encoded:{header:a,payload:c,signature:u},header:JSON.parse(Os(a)),claims:h,user:f}})(n.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==n.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${n.iss}", found "${t.claims.iss}"`);if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(t.header.alg!=="RS256")throw new Error(`Signature algorithm of "${t.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!t.claims.aud||typeof t.claims.aud!="string"&&!Array.isArray(t.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(n.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${n.aud}" but was not one of "${t.claims.aud.join(", ")}"`);if(t.claims.aud.length>1){if(!t.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(t.claims.azp!==n.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${n.aud}", found "${t.claims.azp}"`)}}else if(t.claims.aud!==n.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${n.aud}" but found "${t.claims.aud}"`);if(n.nonce){if(!t.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==n.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${n.nonce}", found "${t.claims.nonce}"`)}if(n.max_age&&!rn(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(t.claims.exp==null||!rn(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!rn(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const e=n.leeway||60,i=new Date(n.now||Date.now()),r=new Date(0);if(r.setUTCSeconds(t.claims.exp+e),i>r)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${i}) is after expiration time (${r})`);if(t.claims.nbf!=null&&rn(t.claims.nbf)){const s=new Date(0);if(s.setUTCSeconds(t.claims.nbf-e),i<s)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${i}) is before ${s}`)}if(t.claims.auth_time!=null&&rn(t.claims.auth_time)){const s=new Date(0);if(s.setUTCSeconds(parseInt(t.claims.auth_time)+n.max_age+e),i>s)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${i}) is after last auth at ${s}`)}if(n.organization){const s=n.organization.trim();if(s.startsWith("org_")){const o=s;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(o!==t.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${o}", found "${t.claims.org_id}"`)}else{const o=s.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(o!==t.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${o}", found "${t.claims.org_name}"`)}}return t};var Fe=Zr(function(n,t){var e=_e&&_e.__assign||function(){return e=Object.assign||function(c){for(var u,l=1,h=arguments.length;l<h;l++)for(var f in u=arguments[l])Object.prototype.hasOwnProperty.call(u,f)&&(c[f]=u[f]);return c},e.apply(this,arguments)};function i(c,u){if(!u)return"";var l="; "+c;return u===!0?l:l+"="+u}function r(c,u,l){return encodeURIComponent(c).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(u).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(h){if(typeof h.expires=="number"){var f=new Date;f.setMilliseconds(f.getMilliseconds()+864e5*h.expires),h.expires=f}return i("Expires",h.expires?h.expires.toUTCString():"")+i("Domain",h.domain)+i("Path",h.path)+i("Secure",h.secure)+i("SameSite",h.sameSite)}(l)}function s(c){for(var u={},l=c?c.split("; "):[],h=/(%[\dA-F]{2})+/gi,f=0;f<l.length;f++){var p=l[f].split("="),y=p.slice(1).join("=");y.charAt(0)==='"'&&(y=y.slice(1,-1));try{u[p[0].replace(h,decodeURIComponent)]=y.replace(h,decodeURIComponent)}catch{}}return u}function o(){return s(document.cookie)}function a(c,u,l){document.cookie=r(c,u,e({path:"/"},l))}t.__esModule=!0,t.encode=r,t.parse=s,t.getAll=o,t.get=function(c){return o()[c]},t.set=a,t.remove=function(c,u){a(c,"",e(e({},u),{expires:-1}))}});Kr(Fe),Fe.encode,Fe.parse,Fe.getAll;var _d=Fe.get,ja=Fe.set,za=Fe.remove;const Ee={get(n){const t=_d(n);if(t!==void 0)return JSON.parse(t)},save(n,t,e){let i={};window.location.protocol==="https:"&&(i={secure:!0,sameSite:"none"}),e!=null&&e.daysUntilExpire&&(i.expires=e.daysUntilExpire),e!=null&&e.cookieDomain&&(i.domain=e.cookieDomain),ja(n,JSON.stringify(t),i)},remove(n,t){let e={};t!=null&&t.cookieDomain&&(e.domain=t.cookieDomain),za(n,e)}},vd={get(n){return Ee.get(n)||Ee.get(`_legacy_${n}`)},save(n,t,e){let i={};window.location.protocol==="https:"&&(i={secure:!0}),e!=null&&e.daysUntilExpire&&(i.expires=e.daysUntilExpire),e!=null&&e.cookieDomain&&(i.domain=e.cookieDomain),ja(`_legacy_${n}`,JSON.stringify(t),i),Ee.save(n,t,e)},remove(n,t){let e={};t!=null&&t.cookieDomain&&(e.domain=t.cookieDomain),za(n,e),Ee.remove(n,t),Ee.remove(`_legacy_${n}`,t)}},Sd={get(n){if(typeof sessionStorage>"u")return;const t=sessionStorage.getItem(n);return t!=null?JSON.parse(t):void 0},save(n,t){sessionStorage.setItem(n,JSON.stringify(t))},remove(n){sessionStorage.removeItem(n)}};function Id(n,t,e){var i=t===void 0?null:t,r=function(c,u){var l=atob(c);if(u){for(var h=new Uint8Array(l.length),f=0,p=l.length;f<p;++f)h[f]=l.charCodeAt(f);return String.fromCharCode.apply(null,new Uint16Array(h.buffer))}return l}(n,e!==void 0&&e),s=r.indexOf(`
`,10)+1,o=r.substring(s)+(i?"//# sourceMappingURL="+i:""),a=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(a)}var Bs,As,Fs,zi,Od=(Bs="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",As=null,Fs=!1,function(n){return zi=zi||Id(Bs,As,Fs),new Worker(zi,n)});const Vi={};class Bd{constructor(t,e){this.cache=t,this.clientId=e,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(t){var e;const i=new Set(((e=await this.cache.get(this.manifestKey))===null||e===void 0?void 0:e.keys)||[]);i.add(t),await this.cache.set(this.manifestKey,{keys:[...i]})}async remove(t){const e=await this.cache.get(this.manifestKey);if(e){const i=new Set(e.keys);return i.delete(t),i.size>0?await this.cache.set(this.manifestKey,{keys:[...i]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(t){return`@@auth0spajs@@::${t}`}}const Ad={memory:()=>new Pa().enclosedCache,localstorage:()=>new yd},Ds=n=>Ad[n],Ts=n=>{const{openUrl:t,onRedirect:e}=n,i=Nt(n,["openUrl","onRedirect"]);return Object.assign(Object.assign({},i),{openUrl:t===!1||t?t:e})},$i=new cd;class Fd{constructor(t){let e,i;if(this.userCache=new Pa().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await $i.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),t.authorizationParams)}),typeof window<"u"&&(()=>{if(!Pn())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(Pn().subtle===void 0)throw new Error(`
      auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
    `)})(),t.cache&&t.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),t.cache)i=t.cache;else{if(e=t.cacheLocation||"memory",!Ds(e))throw new Error(`Invalid cache location "${e}"`);i=Ds(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=t.legacySameSiteCookie===!1?Ee:vd,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(o=>`auth0.${o}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=t.sessionCheckExpiryDays||1;const r=t.useCookiesForTransactions?this.cookieStorage:Sd;var s;this.scope=Nn("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new gd(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||Ea,this.cacheManager=new md(i,i.allKeys?void 0:new Bd(i,this.options.clientId),this.nowProvider),this.domainUrl=(s=this.options.domain,/^https?:\/\//.test(s)?s:`https://${s}`),this.tokenIssuer=((o,a)=>o?o.startsWith("https://")?o:`https://${o}/`:`${a}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&e==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Od)}_url(t){const e=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Ra)));return`${this.domainUrl}${t}&auth0Client=${e}`}_authorizeUrl(t){return this._url(`/authorize?${ar(t)}`)}async _verifyIdToken(t,e,i){const r=await this.nowProvider();return wd({iss:this.tokenIssuer,aud:this.options.clientId,id_token:t,nonce:e,organization:i,leeway:this.options.leeway,max_age:(s=this.options.authorizationParams.max_age,typeof s!="string"?s:parseInt(s,10)||void 0),now:r});var s}_processOrgHint(t){t?this.cookieStorage.save(this.orgHintCookieName,t,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(t,e,i){const r=Is(ji()),s=Is(ji()),o=ji(),a=(l=>{const h=new Uint8Array(l);return(f=>{const p={"+":"-","/":"_","=":""};return f.replace(/[+/=]/g,y=>p[y])})(window.btoa(String.fromCharCode(...Array.from(h))))})(await(async l=>await Pn().subtle.digest({name:"SHA-256"},new TextEncoder().encode(l)))(o)),c=((l,h,f,p,y,k,b,N)=>Object.assign(Object.assign(Object.assign({client_id:l.clientId},l.authorizationParams),f),{scope:Nn(h,f.scope),response_type:"code",response_mode:N||"query",state:p,nonce:y,redirect_uri:b||l.authorizationParams.redirect_uri,code_challenge:k,code_challenge_method:"S256"}))(this.options,this.scope,t,r,s,a,t.redirect_uri||this.options.authorizationParams.redirect_uri||i,e==null?void 0:e.response_mode),u=this._authorizeUrl(c);return{nonce:s,code_verifier:o,scope:c.scope,audience:c.audience||"default",redirect_uri:c.redirect_uri,state:r,url:u}}async loginWithPopup(t,e){var i;if(t=t||{},!(e=e||{}).popup&&(e.popup=(a=>{const c=window.screenX+(window.innerWidth-400)/2,u=window.screenY+(window.innerHeight-600)/2;return window.open(a,"auth0:authorize:popup",`left=${c},top=${u},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!e.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const r=await this._prepareAuthorizeUrl(t.authorizationParams||{},{response_mode:"web_message"},window.location.origin);e.popup.location.href=r.url;const s=await(a=>new Promise((c,u)=>{let l;const h=setInterval(()=>{a.popup&&a.popup.closed&&(clearInterval(h),clearTimeout(f),window.removeEventListener("message",l,!1),u(new Hr(a.popup)))},1e3),f=setTimeout(()=>{clearInterval(h),u(new Jr(a.popup)),window.removeEventListener("message",l,!1)},1e3*(a.timeoutInSeconds||60));l=function(p){if(p.data&&p.data.type==="authorization_response"){if(clearTimeout(f),clearInterval(h),window.removeEventListener("message",l,!1),a.popup.close(),p.data.response.error)return u(tt.fromPayload(p.data.response));c(p.data.response)}},window.addEventListener("message",l)}))(Object.assign(Object.assign({},e),{timeoutInSeconds:e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==s.state)throw new tt("state_mismatch","Invalid state");const o=((i=t.authorizationParams)===null||i===void 0?void 0:i.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:s.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:o})}async getUser(){var t;const e=await this._getIdTokenFromCache();return(t=e==null?void 0:e.decodedToken)===null||t===void 0?void 0:t.user}async getIdTokenClaims(){var t;const e=await this._getIdTokenFromCache();return(t=e==null?void 0:e.decodedToken)===null||t===void 0?void 0:t.claims}async loginWithRedirect(t={}){var e;const i=Ts(t),{openUrl:r,fragment:s,appState:o}=i,a=Nt(i,["openUrl","fragment","appState"]),c=((e=a.authorizationParams)===null||e===void 0?void 0:e.organization)||this.options.authorizationParams.organization,u=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:l}=u,h=Nt(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:o}),c&&{organization:c}));const f=s?`${l}#${s}`:l;r?await r(f):window.location.assign(f)}async handleRedirectCallback(t=window.location.href){const e=t.split("?").slice(1);if(e.length===0)throw new Error("There are no query params available for parsing.");const{state:i,code:r,error:s,error_description:o}=(h=>{h.indexOf("#")>-1&&(h=h.substring(0,h.indexOf("#")));const f=new URLSearchParams(h);return{state:f.get("state"),code:f.get("code")||void 0,error:f.get("error")||void 0,error_description:f.get("error_description")||void 0}})(e.join("")),a=this.transactionManager.get();if(!a)throw new tt("missing_transaction","Invalid state");if(this.transactionManager.remove(),s)throw new ki(s,o||s,i,a.appState);if(!a.code_verifier||a.state&&a.state!==i)throw new tt("state_mismatch","Invalid state");const c=a.organization,u=a.nonce,l=a.redirect_uri;return await this._requestToken(Object.assign({audience:a.audience,scope:a.scope,code_verifier:a.code_verifier,grant_type:"authorization_code",code:r},l?{redirect_uri:l}:{}),{nonceIn:u,organization:c}),{appState:a.appState}}async checkSession(t){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(t)}catch{}}async getTokenSilently(t={}){var e;const i=Object.assign(Object.assign({cacheMode:"on"},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:Nn(this.scope,(e=t.authorizationParams)===null||e===void 0?void 0:e.scope)})}),r=await((s,o)=>{let a=Vi[o];return a||(a=s().finally(()=>{delete Vi[o],a=null}),Vi[o]=a),a})(()=>this._getTokenSilently(i),`${this.options.clientId}::${i.authorizationParams.audience}::${i.authorizationParams.scope}`);return t.detailedResponse?r:r==null?void 0:r.access_token}async _getTokenSilently(t){const{cacheMode:e}=t,i=Nt(t,["cacheMode"]);if(e!=="off"){const r=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId});if(r)return r}if(e!=="cache-only"){if(!await(async(r,s=3)=>{for(let o=0;o<s;o++)if(await r())return!0;return!1})(()=>$i.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new gn;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),e!=="off"){const u=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId});if(u)return u}const r=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(i):await this._getTokenFromIFrame(i),{id_token:s,access_token:o,oauthTokenScope:a,expires_in:c}=r;return Object.assign(Object.assign({id_token:s,access_token:o},a?{scope:a}:null),{expires_in:c})}finally{await $i.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(t={},e={}){var i;const r=Object.assign(Object.assign({},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:Nn(this.scope,(i=t.authorizationParams)===null||i===void 0?void 0:i.scope)})});return e=Object.assign(Object.assign({},ld),e),await this.loginWithPopup(r,e),(await this.cacheManager.get(new jt({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){t.clientId!==null?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const e=t.logoutParams||{},{federated:i}=e,r=Nt(e,["federated"]),s=i?"&federated":"";return this._url(`/v2/logout?${ar(Object.assign({clientId:t.clientId},r))}`)+s}async logout(t={}){const e=Ts(t),{openUrl:i}=e,r=Nt(e,["openUrl"]);t.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const s=this._buildLogoutUrl(r);i?await i(s):i!==!1&&window.location.assign(s)}async _getTokenFromIFrame(t){const e=Object.assign(Object.assign({},t.authorizationParams),{prompt:"none"}),i=this.cookieStorage.get(this.orgHintCookieName);i&&!e.organization&&(e.organization=i);const{url:r,state:s,nonce:o,code_verifier:a,redirect_uri:c,scope:u,audience:l}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new tt("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const h=t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,f=await((y,k,b=60)=>new Promise((N,$)=>{const U=window.document.createElement("iframe");U.setAttribute("width","0"),U.setAttribute("height","0"),U.style.display="none";const m=()=>{window.document.body.contains(U)&&(window.document.body.removeChild(U),window.removeEventListener("message",ht,!1))};let ht;const Fn=setTimeout(()=>{$(new gn),m()},1e3*b);ht=function(Yt){if(Yt.origin!=k||!Yt.data||Yt.data.type!=="authorization_response")return;const re=Yt.source;re&&re.close(),Yt.data.response.error?$(tt.fromPayload(Yt.data.response)):N(Yt.data.response),clearTimeout(Fn),window.removeEventListener("message",ht,!1),setTimeout(m,2e3)},window.addEventListener("message",ht,!1),window.document.body.appendChild(U),U.setAttribute("src",y)}))(r,this.domainUrl,h);if(s!==f.state)throw new tt("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:a,code:f.code,grant_type:"authorization_code",redirect_uri:c,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:o,organization:e.organization});return Object.assign(Object.assign({},p),{scope:u,oauthTokenScope:p.scope,audience:l})}catch(h){throw h.error==="login_required"&&this.logout({openUrl:!1}),h}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new jt({scope:t.authorizationParams.scope,audience:t.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(e&&e.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw new Ni(t.authorizationParams.audience||"default",t.authorizationParams.scope)}const i=t.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,r=typeof t.timeoutInSeconds=="number"?1e3*t.timeoutInSeconds:null;try{const s=await this._requestToken(Object.assign(Object.assign(Object.assign({},t.authorizationParams),{grant_type:"refresh_token",refresh_token:e&&e.refresh_token,redirect_uri:i}),r&&{timeout:r}));return Object.assign(Object.assign({},s),{scope:t.authorizationParams.scope,oauthTokenScope:s.scope,audience:t.authorizationParams.audience||"default"})}catch(s){if((s.message.indexOf("Missing Refresh Token")>-1||s.message&&s.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw s}}async _saveEntryInCache(t){const{id_token:e,decodedToken:i}=t,r=Nt(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:e,decodedToken:i}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const t=this.options.authorizationParams.audience||"default",e=await this.cacheManager.getIdToken(new jt({clientId:this.options.clientId,audience:t,scope:this.scope})),i=this.userCache.get("@@user@@");return e&&e.id_token===(i==null?void 0:i.id_token)?i:(this.userCache.set("@@user@@",e),e)}async _getEntryFromCache({scope:t,audience:e,clientId:i}){const r=await this.cacheManager.get(new jt({scope:t,audience:e,clientId:i}),60);if(r&&r.access_token){const{access_token:s,oauthTokenScope:o,expires_in:a}=r,c=await this._getIdTokenFromCache();return c&&Object.assign(Object.assign({id_token:c.id_token,access_token:s},o?{scope:o}:null),{expires_in:a})}}async _requestToken(t,e){const{nonceIn:i,organization:r}=e||{},s=await pd(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},t),this.worker),o=await this._verifyIdToken(s.id_token,i,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:o,scope:t.scope,audience:t.audience||"default"}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||o.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:o})}}async function Dd(n){const t=new Fd(n);return await t.checkSession(),t}const ge=document.body.appendChild(document.createElement("div")),zt=ge.appendChild(document.createElement("button"));zt.className="log";zt.textContent="Login";ge.style.display="flex";ge.style.flexDirection="column";ge.style.color="rgb(104, 85, 224)";ge.style.fontWeight="600";ge.style.margin="0";ge.style.padding="10px";const ks=ge.appendChild(document.createTextNode("")),Td=document.createElement("pre");document.body.appendChild(Td);let Pe,cr;const Va=async()=>{const n=await Pe.logout();console.log({logoutResult:n}),zt.textContent="Login",zt.removeEventListener("click",Va),zt.addEventListener("click",Gr)},Gr=async()=>{const{domain:n,client_id:t,audience:e}=cr;zt.textContent="working...",console.log("Callback urls set to: ",Ns()),Pe=await Dd({domain:n,clientId:t,authorizationParams:{redirect_uri:Ns(),audience:e},cacheLocation:"localstorage",useRefreshTokens:!0});try{await Pe.loginWithPopup(),ks.textContent=""}catch(o){console.error(o),ks.textContent="Popup blocked, please try again or enable popups ";return}const i=await Pe.getUser();console.log({user:i});let r=null;try{const o={authorizationParams:{audience:e}};r=await Pe.getTokenSilently(o)}catch(o){if(console.error(o),o instanceof ki&&(o.error==="consent_required"||o.error==="login_required")){console.log("asking user for permission to their profile");const a={authorizationParams:{audience:e}};r=await Pe.getTokenWithPopup(a)}}let s=JSON.parse(JSON.stringify(i));s.token=r,console.log({userCopy:s}),Ne.setComponentValue(s),zt.textContent="Logout",zt.removeEventListener("click",Gr),zt.addEventListener("click",Va)};zt.onclick=Gr;function kd(n){if(!Nd(n))throw new Error("Event is not of type StreamlitEventDetailAuth0Args");cr=n.detail.args,console.log("args from python",{auth0EventArgs:cr}),Ne.setFrameHeight()}Ne.events.addEventListener(Ne.RENDER_EVENT,kd);Ne.setComponentReady();const Ns=()=>{if(window.parent!==window){const n=new URL(document.location.href),t=n.origin,e=decodeURIComponent(n.pathname);return t+e}else return window.location.origin};function Nd(n){return n!==null&&"detail"in n&&"args"in n.detail}
