var Ur=n=>{throw TypeError(n)};var Ra=(n,t,e)=>t.has(n)||Ur("Cannot "+e);var Tn=(n,t,e)=>t.has(n)?Ur("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e);var Ot=(n,t,e)=>(Ra(n,t,"access private method"),e);(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 Ua(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ti={exports:{}},k={};/** @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 kr;function ka(){if(kr)return k;kr=1;var n=typeof Symbol=="function"&&Symbol.for,t=n?Symbol.for("react.element"):60103,e=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,r=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,c=n?Symbol.for("react.async_mode"):60111,l=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,y=n?Symbol.for("react.memo"):60115,b=n?Symbol.for("react.lazy"):60116,C=n?Symbol.for("react.block"):60121,St=n?Symbol.for("react.fundamental"):60117,X=n?Symbol.for("react.responder"):60118,Mt=n?Symbol.for("react.scope"):60119;function Q(g){if(typeof g=="object"&&g!==null){var mt=g.$$typeof;switch(mt){case t:switch(g=g.type,g){case c:case l:case i:case s:case r:case f:return g;default:switch(g=g&&g.$$typeof,g){case a:case u:case b:case y:case o:return g;default:return mt}}case e:return mt}}}function Qt(g){return Q(g)===l}return k.AsyncMode=c,k.ConcurrentMode=l,k.ContextConsumer=a,k.ContextProvider=o,k.Element=t,k.ForwardRef=u,k.Fragment=i,k.Lazy=b,k.Memo=y,k.Portal=e,k.Profiler=s,k.StrictMode=r,k.Suspense=f,k.isAsyncMode=function(g){return Qt(g)||Q(g)===c},k.isConcurrentMode=Qt,k.isContextConsumer=function(g){return Q(g)===a},k.isContextProvider=function(g){return Q(g)===o},k.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===t},k.isForwardRef=function(g){return Q(g)===u},k.isFragment=function(g){return Q(g)===i},k.isLazy=function(g){return Q(g)===b},k.isMemo=function(g){return Q(g)===y},k.isPortal=function(g){return Q(g)===e},k.isProfiler=function(g){return Q(g)===s},k.isStrictMode=function(g){return Q(g)===r},k.isSuspense=function(g){return Q(g)===f},k.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===i||g===l||g===s||g===r||g===f||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===b||g.$$typeof===y||g.$$typeof===o||g.$$typeof===a||g.$$typeof===u||g.$$typeof===St||g.$$typeof===X||g.$$typeof===Mt||g.$$typeof===C)},k.typeOf=Q,k}var Pr;function Pa(){return Pr||(Pr=1,Ti.exports=ka()),Ti.exports}var Mi,jr;function ja(){if(jr)return Mi;jr=1;var n=Pa(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},e={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[n.ForwardRef]=i,s[n.Memo]=r;function o(b){return n.isMemo(b)?r:s[b.$$typeof]||t}var a=Object.defineProperty,c=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,u=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,m=Object.prototype;function y(b,C,St){if(typeof C!="string"){if(m){var X=f(C);X&&X!==m&&y(b,X,St)}var Mt=c(C);l&&(Mt=Mt.concat(l(C)));for(var Q=o(b),Qt=o(C),g=0;g<Mt.length;++g){var mt=Mt[g];if(!e[mt]&&!(St&&St[mt])&&!(Qt&&Qt[mt])&&!(Q&&Q[mt])){var Dn=u(C,mt);try{a(b,mt,Dn)}catch{}}}}return b}return Mi=y,Mi}ja();var Ei={exports:{}},P={};/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var Ni,$r;function $a(){if($r)return Ni;$r=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;function i(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function r(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(o).map(function(u){return o[u]});if(c.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(u){l[u]=u}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ni=r()?Object.assign:function(s,o){for(var a,c=i(s),l,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(n){l=n(a);for(var m=0;m<l.length;m++)e.call(a,l[m])&&(c[l[m]]=a[l[m]])}}return c},Ni}/** @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 Vr;function Va(){if(Vr)return P;Vr=1;var n=$a(),t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,i=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,o=t?Symbol.for("react.profiler"):60114,a=t?Symbol.for("react.provider"):60109,c=t?Symbol.for("react.context"):60110,l=t?Symbol.for("react.forward_ref"):60112,u=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,y=typeof Symbol=="function"&&Symbol.iterator;function b(d){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+d,T=1;T<arguments.length;T++)p+="&args[]="+encodeURIComponent(arguments[T]);return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},St={};function X(d,p,T){this.props=d,this.context=p,this.refs=St,this.updater=T||C}X.prototype.isReactComponent={},X.prototype.setState=function(d,p){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error(b(85));this.updater.enqueueSetState(this,d,p,"setState")},X.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function Mt(){}Mt.prototype=X.prototype;function Q(d,p,T){this.props=d,this.context=p,this.refs=St,this.updater=T||C}var Qt=Q.prototype=new Mt;Qt.constructor=Q,n(Qt,X.prototype),Qt.isPureReactComponent=!0;var g={current:null},mt=Object.prototype.hasOwnProperty,Dn={key:!0,ref:!0,__self:!0,__source:!0};function Ii(d,p,T){var z,L={},et=null,It=null;if(p!=null)for(z in p.ref!==void 0&&(It=p.ref),p.key!==void 0&&(et=""+p.key),p)mt.call(p,z)&&!Dn.hasOwnProperty(z)&&(L[z]=p[z]);var q=arguments.length-2;if(q===1)L.children=T;else if(1<q){for(var at=Array(q),ee=0;ee<q;ee++)at[ee]=arguments[ee+2];L.children=at}if(d&&d.defaultProps)for(z in q=d.defaultProps,q)L[z]===void 0&&(L[z]=q[z]);return{$$typeof:e,type:d,key:et,ref:It,props:L,_owner:g.current}}function Ea(d,p){return{$$typeof:e,type:d.type,key:p,ref:d.ref,props:d.props,_owner:d._owner}}function Oi(d){return typeof d=="object"&&d!==null&&d.$$typeof===e}function Na(d){var p={"=":"=0",":":"=2"};return"$"+(""+d).replace(/[=:]/g,function(T){return p[T]})}var xr=/\/+/g,Fn=[];function Lr(d,p,T,z){if(Fn.length){var L=Fn.pop();return L.result=d,L.keyPrefix=p,L.func=T,L.context=z,L.count=0,L}return{result:d,keyPrefix:p,func:T,context:z,count:0}}function Cr(d){d.result=null,d.keyPrefix=null,d.func=null,d.context=null,d.count=0,10>Fn.length&&Fn.push(d)}function Bi(d,p,T,z){var L=typeof d;(L==="undefined"||L==="boolean")&&(d=null);var et=!1;if(d===null)et=!0;else switch(L){case"string":case"number":et=!0;break;case"object":switch(d.$$typeof){case e:case i:et=!0}}if(et)return T(z,d,p===""?"."+Di(d,0):p),1;if(et=0,p=p===""?".":p+":",Array.isArray(d))for(var It=0;It<d.length;It++){L=d[It];var q=p+Di(L,It);et+=Bi(L,q,T,z)}else if(d===null||typeof d!="object"?q=null:(q=y&&d[y]||d["@@iterator"],q=typeof q=="function"?q:null),typeof q=="function")for(d=q.call(d),It=0;!(L=d.next()).done;)L=L.value,q=p+Di(L,It++),et+=Bi(L,q,T,z);else if(L==="object")throw T=""+d,Error(b(31,T==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":T,""));return et}function Ai(d,p,T){return d==null?0:Bi(d,"",p,T)}function Di(d,p){return typeof d=="object"&&d!==null&&d.key!=null?Na(d.key):p.toString(36)}function xa(d,p){d.func.call(d.context,p,d.count++)}function La(d,p,T){var z=d.result,L=d.keyPrefix;d=d.func.call(d.context,p,d.count++),Array.isArray(d)?Fi(d,z,T,function(et){return et}):d!=null&&(Oi(d)&&(d=Ea(d,L+(!d.key||p&&p.key===d.key?"":(""+d.key).replace(xr,"$&/")+"/")+T)),z.push(d))}function Fi(d,p,T,z,L){var et="";T!=null&&(et=(""+T).replace(xr,"$&/")+"/"),p=Lr(p,et,z,L),Ai(d,La,p),Cr(p)}var Rr={current:null};function te(){var d=Rr.current;if(d===null)throw Error(b(321));return d}var Ca={ReactCurrentDispatcher:Rr,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:g,IsSomeRendererActing:{current:!1},assign:n};return P.Children={map:function(d,p,T){if(d==null)return d;var z=[];return Fi(d,z,null,p,T),z},forEach:function(d,p,T){if(d==null)return d;p=Lr(null,null,p,T),Ai(d,xa,p),Cr(p)},count:function(d){return Ai(d,function(){return null},null)},toArray:function(d){var p=[];return Fi(d,p,null,function(T){return T}),p},only:function(d){if(!Oi(d))throw Error(b(143));return d}},P.Component=X,P.Fragment=r,P.Profiler=o,P.PureComponent=Q,P.StrictMode=s,P.Suspense=u,P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ca,P.cloneElement=function(d,p,T){if(d==null)throw Error(b(267,d));var z=n({},d.props),L=d.key,et=d.ref,It=d._owner;if(p!=null){if(p.ref!==void 0&&(et=p.ref,It=g.current),p.key!==void 0&&(L=""+p.key),d.type&&d.type.defaultProps)var q=d.type.defaultProps;for(at in p)mt.call(p,at)&&!Dn.hasOwnProperty(at)&&(z[at]=p[at]===void 0&&q!==void 0?q[at]:p[at])}var at=arguments.length-2;if(at===1)z.children=T;else if(1<at){q=Array(at);for(var ee=0;ee<at;ee++)q[ee]=arguments[ee+2];z.children=q}return{$$typeof:e,type:d.type,key:L,ref:et,props:z,_owner:It}},P.createContext=function(d,p){return p===void 0&&(p=null),d={$$typeof:c,_calculateChangedBits:p,_currentValue:d,_currentValue2:d,_threadCount:0,Provider:null,Consumer:null},d.Provider={$$typeof:a,_context:d},d.Consumer=d},P.createElement=Ii,P.createFactory=function(d){var p=Ii.bind(null,d);return p.type=d,p},P.createRef=function(){return{current:null}},P.forwardRef=function(d){return{$$typeof:l,render:d}},P.isValidElement=Oi,P.lazy=function(d){return{$$typeof:m,_ctor:d,_status:-1,_result:null}},P.memo=function(d,p){return{$$typeof:f,type:d,compare:p===void 0?null:p}},P.useCallback=function(d,p){return te().useCallback(d,p)},P.useContext=function(d,p){return te().useContext(d,p)},P.useDebugValue=function(){},P.useEffect=function(d,p){return te().useEffect(d,p)},P.useImperativeHandle=function(d,p,T){return te().useImperativeHandle(d,p,T)},P.useLayoutEffect=function(d,p){return te().useLayoutEffect(d,p)},P.useMemo=function(d,p){return te().useMemo(d,p)},P.useReducer=function(d,p,T){return te().useReducer(d,p,T)},P.useRef=function(d){return te().useRef(d)},P.useState=function(d){return te().useState(d)},P.version="16.14.0",P}var zr;function za(){return zr||(zr=1,Ei.exports=Va()),Ei.exports}var Ya=za();const Wa=Ua(Ya);function _(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(u){try{l(i.next(u))}catch(f){o(f)}}function c(u){try{l(i.throw(u))}catch(f){o(f)}}function l(u){u.done?s(u.value):r(u.value).then(a,c)}l((i=i.apply(n,t||[])).next())})}function Yr(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 M(n){return this instanceof M?(this.v=n,this):new M(n)}function Wt(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=e.apply(n,t||[]),r,s=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),r[Symbol.asyncIterator]=function(){return this},r;function o(y){return function(b){return Promise.resolve(b).then(y,f)}}function a(y,b){i[y]&&(r[y]=function(C){return new Promise(function(St,X){s.push([y,C,St,X])>1||c(y,C)})},b&&(r[y]=b(r[y])))}function c(y,b){try{l(i[y](b))}catch(C){m(s[0][3],C)}}function l(y){y.value instanceof M?Promise.resolve(y.value.v).then(u,f):m(s[0][2],y)}function u(y){c("next",y)}function f(y){c("throw",y)}function m(y,b){y(b),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Ln(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:M(n[r](o)),done:!1}:s?s(o):o}:s}}function xe(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 Yr=="function"?Yr(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(l){s({value:l,done:a})},o)}}const Ha=new TextDecoder("utf-8"),$i=n=>Ha.decode(n),Za=new TextEncoder,rr=n=>Za.encode(n),[If,Ga]=(()=>{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]})(),[vn]=(()=>{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]})(),[wn]=(()=>{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]})(),qa=n=>typeof n=="number",Ds=n=>typeof n=="boolean",nt=n=>typeof n=="function",ft=n=>n!=null&&Object(n)===n,me=n=>ft(n)&&nt(n.then),Sn=n=>ft(n)&&nt(n[Symbol.iterator]),sn=n=>ft(n)&&nt(n[Symbol.asyncIterator]),Vi=n=>ft(n)&&ft(n.schema),Fs=n=>ft(n)&&"done"in n&&"value"in n,Ts=n=>ft(n)&&nt(n.stat)&&qa(n.fd),Ms=n=>ft(n)&&sr(n.body),_i=n=>"_getDOMStream"in n&&"_getNodeStream"in n,Ka=n=>ft(n)&&nt(n.abort)&&nt(n.getWriter)&&!_i(n),sr=n=>ft(n)&&nt(n.cancel)&&nt(n.getReader)&&!_i(n),Ja=n=>ft(n)&&nt(n.end)&&nt(n.write)&&Ds(n.writable)&&!_i(n),Es=n=>ft(n)&&nt(n.read)&&nt(n.pipe)&&Ds(n.readable)&&!_i(n),Xa=n=>ft(n)&&nt(n.clear)&&nt(n.bytes)&&nt(n.position)&&nt(n.setPosition)&&nt(n.capacity)&&nt(n.getBufferIdentifier)&&nt(n.createLong),or=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Qa(n){const t=n[0]?[n[0]]:[];let e,i,r,s;for(let o,a,c=0,l=0,u=n.length;++c<u;){if(o=t[l],a=n[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:r}=o,{byteOffset:i,byteLength:s}=a,e+r<i||i+s<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,i-e+s)}return t}function Wr(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 Gt(n,t){const e=Qa(n),i=e.reduce((u,f)=>u+f.byteLength,0);let r,s,o,a=0,c=-1;const l=Math.min(t||Number.POSITIVE_INFINITY,i);for(const u=e.length;++c<u;){if(r=e[c],s=r.subarray(0,Math.min(r.length,l-a)),l<=a+s.length){s.length<r.length?e[c]=r.subarray(s.length):s.length===r.length&&c++,o?Wr(o,s,a):o=s;break}Wr(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),i-(o?o.byteLength:0)]}function W(n,t){let e=Fs(t)?t.value:t;return e instanceof n?n===Uint8Array?new n(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=rr(e)),e instanceof ArrayBuffer?new n(e):e instanceof or?new n(e):Xa(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 an=n=>W(Int32Array,n),R=n=>W(Uint8Array,n),zi=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 or?e(t):Sn(t)?t:e(t);return yield*zi((function*(r){let s=null;do s=r.next(yield W(n,s));while(!s.done)})(i[Symbol.iterator]())),new n}const ec=n=>tc(Uint8Array,n);function Ns(n,t){return Wt(this,arguments,function*(){if(me(t))return yield M(yield M(yield*Ln(xe(Ns(n,yield M(t))))));const i=function(o){return Wt(this,arguments,function*(){yield yield M(yield M(o))})},r=function(o){return Wt(this,arguments,function*(){yield M(yield*Ln(xe(zi((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 or?i(t):Sn(t)?r(t):sn(t)?t:i(t);return yield M(yield*Ln(xe(zi((function(o){return Wt(this,arguments,function*(){let a=null;do a=yield M(o.next(yield yield M(W(n,a))));while(!a.done)})})(s[Symbol.asyncIterator]()))))),yield M(new n)})}const nc=n=>Ns(Uint8Array,n);function ar(n,t,e){if(n!==0){e=e.slice(0,t+1);for(let i=-1;++i<=t;)e[i]+=n}return e}function ic(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 At={fromIterable(n){return Mn(rc(n))},fromAsyncIterable(n){return Mn(sc(n))},fromDOMStream(n){return Mn(oc(n))},fromNodeStream(n){return Mn(cc(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')}},Mn=n=>(n.next(),n);function*rc(n){let t,e=!1,i=[],r,s,o,a=0;function c(){return s==="peek"?Gt(i,o)[0]:([r,i,a]=Gt(i,o),r)}({cmd:s,size:o}=yield null);const l=ec(n)[Symbol.iterator]();try{do if({done:t,value:r}=Number.isNaN(o-a)?l.next():l.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(u){(e=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function sc(n){return Wt(this,arguments,function*(){let e,i=!1,r=[],s,o,a,c=0;function l(){return o==="peek"?Gt(r,a)[0]:([s,r,c]=Gt(r,a),s)}({cmd:o,size:a}=yield yield M(null));const u=nc(n)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield M(u.next()):yield M(u.next(a-c)),!e&&s.byteLength>0&&(r.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield M(l()));while(a<c);while(!e)}catch(f){(i=!0)&&typeof u.throw=="function"&&(yield M(u.throw(f)))}finally{i===!1&&typeof u.return=="function"&&(yield M(u.return(new Uint8Array(0))))}return yield M(null)})}function oc(n){return Wt(this,arguments,function*(){let e=!1,i=!1,r=[],s,o,a,c=0;function l(){return o==="peek"?Gt(r,a)[0]:([s,r,c]=Gt(r,a),s)}({cmd:o,size:a}=yield yield M(null));const u=new ac(n);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield M(u.read()):yield M(u.read(a-c)),!e&&s.byteLength>0&&(r.push(R(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield M(l()));while(a<c);while(!e)}catch(f){(i=!0)&&(yield M(u.cancel(f)))}finally{i===!1?yield M(u.cancel()):n.locked&&u.releaseLock()}return yield M(null)})}class ac{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 _(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 _(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=R(e)),e})}}const xi=(n,t)=>{const e=r=>i([t,r]);let i;return[t,e,new Promise(r=>(i=r)&&n.once(t,e))]};function cc(n){return Wt(this,arguments,function*(){const e=[];let i="error",r=!1,s=null,o,a,c=0,l=[],u;function f(){return o==="peek"?Gt(l,a)[0]:([u,l,c]=Gt(l,a),u)}if({cmd:o,size:a}=yield yield M(null),n.isTTY)return yield yield M(new Uint8Array(0)),yield M(null);try{e[0]=xi(n,"end"),e[1]=xi(n,"error");do{if(e[2]=xi(n,"readable"),[i,s]=yield M(Promise.race(e.map(y=>y[2]))),i==="error")break;if((r=i==="end")||(Number.isFinite(a-c)?(u=R(n.read(a-c)),u.byteLength<a-c&&(u=R(n.read()))):u=R(n.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),r||a<=c)do({cmd:o,size:a}=yield yield M(f()));while(a<c)}while(!r)}finally{yield M(m(e,i==="error"?s:null))}return yield M(null);function m(y,b){return u=l=null,new Promise((C,St)=>{for(const[X,Mt]of y)n.off(X,Mt);try{const X=n.destroy;X&&X.call(n,b),b=void 0}catch(X){b=X||b}finally{b!=null?St(b):C()}})}})}var _t;(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"})(_t||(_t={}));var vt;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(vt||(vt={}));var dt;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(dt||(dt={}));var ue;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(ue||(ue={}));var U;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(U||(U={}));var ge;(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"})(ge||(ge={}));var j;(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"})(j||(j={}));var h;(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"})(h||(h={}));var ie;(function(n){n[n.OFFSET=0]="OFFSET",n[n.DATA=1]="DATA",n[n.VALIDITY=2]="VALIDITY",n[n.TYPE=3]="TYPE"})(ie||(ie={}));const lc=void 0;function fn(n){if(n===null)return"null";if(n===lc)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 vn||n instanceof wn?`[${[...n].map(t=>fn(t))}]`:`[${n}]`:ArrayBuffer.isView(n)?`[${n}]`:JSON.stringify(n,(t,e)=>typeof e=="bigint"?`${e}`:e)}const uc=Symbol.for("isArrowBigNum");function xt(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)}xt.prototype[uc]=!0;xt.prototype.toJSON=function(){return`"${Le(this)}"`};xt.prototype.valueOf=function(){return xs(this)};xt.prototype.toString=function(){return Le(this)};xt.prototype[Symbol.toPrimitive]=function(n="default"){switch(n){case"number":return xs(this);case"string":return Le(this);case"default":return Yi(this)}return Le(this)};function Ye(...n){return xt.apply(this,n)}function We(...n){return xt.apply(this,n)}function pn(...n){return xt.apply(this,n)}Object.setPrototypeOf(Ye.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(We.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(pn.prototype,Object.create(Uint32Array.prototype));Object.assign(Ye.prototype,xt.prototype,{constructor:Ye,signed:!0,TypedArray:Int32Array,BigIntArray:vn});Object.assign(We.prototype,xt.prototype,{constructor:We,signed:!1,TypedArray:Uint32Array,BigIntArray:wn});Object.assign(pn.prototype,xt.prototype,{constructor:pn,signed:!0,TypedArray:Uint32Array,BigIntArray:wn});function xs(n){const{buffer:t,byteOffset:e,length:i,signed:r}=n,s=new wn(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 l of s)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(const l of s)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}let Le,Yi;Ga?(Yi=(n=>n.byteLength===8?new n.BigIntArray(n.buffer,n.byteOffset,1)[0]:Li(n)),Le=(n=>n.byteLength===8?`${new n.BigIntArray(n.buffer,n.byteOffset,1)[0]}`:Li(n))):(Le=Li,Yi=Le);function Li(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 cr{static new(t,e){switch(e){case!0:return new Ye(t);case!1:return new We(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case vn:return new Ye(t)}return t.byteLength===16?new pn(t):new We(t)}static signed(t){return new Ye(t)}static unsigned(t){return new We(t)}static decimal(t){return new pn(t)}constructor(t,e){return cr.new(t,e)}}var Ls,Cs,Rs,Us,ks,Ps,js,$s,Vs,zs,Ys,Ws,Hs,Zs,Gs,qs,Ks,Js,Xs;class v{static isNull(t){return(t==null?void 0:t.typeId)===h.Null}static isInt(t){return(t==null?void 0:t.typeId)===h.Int}static isFloat(t){return(t==null?void 0:t.typeId)===h.Float}static isBinary(t){return(t==null?void 0:t.typeId)===h.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===h.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===h.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===h.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===h.Date}static isTime(t){return(t==null?void 0:t.typeId)===h.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===h.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===h.Interval}static isList(t){return(t==null?void 0:t.typeId)===h.List}static isStruct(t){return(t==null?void 0:t.typeId)===h.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===h.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===h.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===h.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===h.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===h.Dictionary}static isDenseUnion(t){return v.isUnion(t)&&t.mode===vt.Dense}static isSparseUnion(t){return v.isUnion(t)&&t.mode===vt.Sparse}get typeId(){return h.NONE}}Ls=Symbol.toStringTag;v[Ls]=(n=>(n.children=null,n.ArrayType=Array,n[Symbol.toStringTag]="DataType"))(v.prototype);let be=class extends v{toString(){return"Null"}get typeId(){return h.Null}};Cs=Symbol.toStringTag;be[Cs]=(n=>n[Symbol.toStringTag]="Null")(be.prototype);class _e extends v{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return h.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?vn:wn}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Rs=Symbol.toStringTag;_e[Rs]=(n=>(n.isSigned=null,n.bitWidth=null,n[Symbol.toStringTag]="Int"))(_e.prototype);class yn extends _e{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(yn.prototype,"ArrayType",{value:Int32Array});class mn extends v{constructor(t){super(),this.precision=t}get typeId(){return h.Float}get ArrayType(){switch(this.precision){case dt.HALF:return Uint16Array;case dt.SINGLE:return Float32Array;case dt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Us=Symbol.toStringTag;mn[Us]=(n=>(n.precision=null,n[Symbol.toStringTag]="Float"))(mn.prototype);let Yn=class extends v{constructor(){super()}get typeId(){return h.Binary}toString(){return"Binary"}};ks=Symbol.toStringTag;Yn[ks]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Binary"))(Yn.prototype);let Wn=class extends v{constructor(){super()}get typeId(){return h.Utf8}toString(){return"Utf8"}};Ps=Symbol.toStringTag;Wn[Ps]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Utf8"))(Wn.prototype);let Hn=class extends v{constructor(){super()}get typeId(){return h.Bool}toString(){return"Bool"}};js=Symbol.toStringTag;Hn[js]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Bool"))(Hn.prototype);let Zn=class extends v{constructor(t,e,i=128){super(),this.scale=t,this.precision=e,this.bitWidth=i}get typeId(){return h.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};$s=Symbol.toStringTag;Zn[$s]=(n=>(n.scale=null,n.precision=null,n.ArrayType=Uint32Array,n[Symbol.toStringTag]="Decimal"))(Zn.prototype);class Gn extends v{constructor(t){super(),this.unit=t}get typeId(){return h.Date}toString(){return`Date${(this.unit+1)*32}<${ue[this.unit]}>`}}Vs=Symbol.toStringTag;Gn[Vs]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Date"))(Gn.prototype);class gn extends v{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return h.Time}toString(){return`Time${this.bitWidth}<${U[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return vn}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}zs=Symbol.toStringTag;gn[zs]=(n=>(n.unit=null,n.bitWidth=null,n[Symbol.toStringTag]="Time"))(gn.prototype);class qn extends v{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return h.Timestamp}toString(){return`Timestamp<${U[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Ys=Symbol.toStringTag;qn[Ys]=(n=>(n.unit=null,n.timezone=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Timestamp"))(qn.prototype);class Kn extends v{constructor(t){super(),this.unit=t}get typeId(){return h.Interval}toString(){return`Interval<${ge[this.unit]}>`}}Ws=Symbol.toStringTag;Kn[Ws]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Interval"))(Kn.prototype);let Jn=class extends v{constructor(t){super(),this.children=[t]}get typeId(){return h.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}};Hs=Symbol.toStringTag;Jn[Hs]=(n=>(n.children=null,n[Symbol.toStringTag]="List"))(Jn.prototype);class st extends v{constructor(t){super(),this.children=t}get typeId(){return h.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Zs=Symbol.toStringTag;st[Zs]=(n=>(n.children=null,n[Symbol.toStringTag]="Struct"))(st.prototype);class Xn extends v{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 h.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Gs=Symbol.toStringTag;Xn[Gs]=(n=>(n.mode=null,n.typeIds=null,n.children=null,n.typeIdToChildIndex=null,n.ArrayType=Int8Array,n[Symbol.toStringTag]="Union"))(Xn.prototype);let Qn=class extends v{constructor(t){super(),this.byteWidth=t}get typeId(){return h.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};qs=Symbol.toStringTag;Qn[qs]=(n=>(n.byteWidth=null,n.ArrayType=Uint8Array,n[Symbol.toStringTag]="FixedSizeBinary"))(Qn.prototype);let ti=class extends v{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return h.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}>`}};Ks=Symbol.toStringTag;ti[Ks]=(n=>(n.children=null,n.listSize=null,n[Symbol.toStringTag]="FixedSizeList"))(ti.prototype);class ei extends v{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return h.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(", ")}}>`}}Js=Symbol.toStringTag;ei[Js]=(n=>(n.children=null,n.keysSorted=null,n[Symbol.toStringTag]="Map_"))(ei.prototype);const hc=(n=>()=>++n)(-1);class Je extends v{constructor(t,e,i,r){super(),this.indices=e,this.dictionary=t,this.isOrdered=r||!1,this.id=i==null?hc():typeof i=="number"?i:i.low}get typeId(){return h.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}>`}}Xs=Symbol.toStringTag;Je[Xs]=(n=>(n.id=null,n.indices=null,n.isOrdered=null,n.dictionary=null,n[Symbol.toStringTag]="Dictionary"))(Je.prototype);function re(n){const t=n;switch(n.typeId){case h.Decimal:return n.bitWidth/32;case h.Timestamp:return 2;case h.Date:return 1+t.unit;case h.Interval:return 1+t.unit;case h.FixedSizeList:return t.listSize;case h.FixedSizeBinary:return t.byteWidth;default:return 1}}class x{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 dc(this,t,e)}getVisitFnByTypeId(t,e=!0){return ke(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 dc(n,t,e=!0){return typeof t=="number"?ke(n,t,e):typeof t=="string"&&t in h?ke(n,h[t],e):t&&t instanceof v?ke(n,Hr(t),e):t!=null&&t.type&&t.type instanceof v?ke(n,Hr(t.type),e):ke(n,h.NONE,e)}function ke(n,t,e=!0){let i=null;switch(t){case h.Null:i=n.visitNull;break;case h.Bool:i=n.visitBool;break;case h.Int:i=n.visitInt;break;case h.Int8:i=n.visitInt8||n.visitInt;break;case h.Int16:i=n.visitInt16||n.visitInt;break;case h.Int32:i=n.visitInt32||n.visitInt;break;case h.Int64:i=n.visitInt64||n.visitInt;break;case h.Uint8:i=n.visitUint8||n.visitInt;break;case h.Uint16:i=n.visitUint16||n.visitInt;break;case h.Uint32:i=n.visitUint32||n.visitInt;break;case h.Uint64:i=n.visitUint64||n.visitInt;break;case h.Float:i=n.visitFloat;break;case h.Float16:i=n.visitFloat16||n.visitFloat;break;case h.Float32:i=n.visitFloat32||n.visitFloat;break;case h.Float64:i=n.visitFloat64||n.visitFloat;break;case h.Utf8:i=n.visitUtf8;break;case h.Binary:i=n.visitBinary;break;case h.FixedSizeBinary:i=n.visitFixedSizeBinary;break;case h.Date:i=n.visitDate;break;case h.DateDay:i=n.visitDateDay||n.visitDate;break;case h.DateMillisecond:i=n.visitDateMillisecond||n.visitDate;break;case h.Timestamp:i=n.visitTimestamp;break;case h.TimestampSecond:i=n.visitTimestampSecond||n.visitTimestamp;break;case h.TimestampMillisecond:i=n.visitTimestampMillisecond||n.visitTimestamp;break;case h.TimestampMicrosecond:i=n.visitTimestampMicrosecond||n.visitTimestamp;break;case h.TimestampNanosecond:i=n.visitTimestampNanosecond||n.visitTimestamp;break;case h.Time:i=n.visitTime;break;case h.TimeSecond:i=n.visitTimeSecond||n.visitTime;break;case h.TimeMillisecond:i=n.visitTimeMillisecond||n.visitTime;break;case h.TimeMicrosecond:i=n.visitTimeMicrosecond||n.visitTime;break;case h.TimeNanosecond:i=n.visitTimeNanosecond||n.visitTime;break;case h.Decimal:i=n.visitDecimal;break;case h.List:i=n.visitList;break;case h.Struct:i=n.visitStruct;break;case h.Union:i=n.visitUnion;break;case h.DenseUnion:i=n.visitDenseUnion||n.visitUnion;break;case h.SparseUnion:i=n.visitSparseUnion||n.visitUnion;break;case h.Dictionary:i=n.visitDictionary;break;case h.Interval:i=n.visitInterval;break;case h.IntervalDayTime:i=n.visitIntervalDayTime||n.visitInterval;break;case h.IntervalYearMonth:i=n.visitIntervalYearMonth||n.visitInterval;break;case h.FixedSizeList:i=n.visitFixedSizeList;break;case h.Map:i=n.visitMap;break}if(typeof i=="function")return i;if(!e)return()=>null;throw new Error(`Unrecognized type '${h[t]}'`)}function Hr(n){switch(n.typeId){case h.Null:return h.Null;case h.Int:{const{bitWidth:t,isSigned:e}=n;switch(t){case 8:return e?h.Int8:h.Uint8;case 16:return e?h.Int16:h.Uint16;case 32:return e?h.Int32:h.Uint32;case 64:return e?h.Int64:h.Uint64}return h.Int}case h.Float:switch(n.precision){case dt.HALF:return h.Float16;case dt.SINGLE:return h.Float32;case dt.DOUBLE:return h.Float64}return h.Float;case h.Binary:return h.Binary;case h.Utf8:return h.Utf8;case h.Bool:return h.Bool;case h.Decimal:return h.Decimal;case h.Time:switch(n.unit){case U.SECOND:return h.TimeSecond;case U.MILLISECOND:return h.TimeMillisecond;case U.MICROSECOND:return h.TimeMicrosecond;case U.NANOSECOND:return h.TimeNanosecond}return h.Time;case h.Timestamp:switch(n.unit){case U.SECOND:return h.TimestampSecond;case U.MILLISECOND:return h.TimestampMillisecond;case U.MICROSECOND:return h.TimestampMicrosecond;case U.NANOSECOND:return h.TimestampNanosecond}return h.Timestamp;case h.Date:switch(n.unit){case ue.DAY:return h.DateDay;case ue.MILLISECOND:return h.DateMillisecond}return h.Date;case h.Interval:switch(n.unit){case ge.DAY_TIME:return h.IntervalDayTime;case ge.YEAR_MONTH:return h.IntervalYearMonth}return h.Interval;case h.Map:return h.Map;case h.List:return h.List;case h.Struct:return h.Struct;case h.Union:switch(n.mode){case vt.Dense:return h.DenseUnion;case vt.Sparse:return h.SparseUnion}return h.Union;case h.FixedSizeBinary:return h.FixedSizeBinary;case h.FixedSizeList:return h.FixedSizeList;case h.Dictionary:return h.Dictionary}throw new Error(`Unrecognized type '${h[n.typeId]}'`)}x.prototype.visitInt8=null;x.prototype.visitInt16=null;x.prototype.visitInt32=null;x.prototype.visitInt64=null;x.prototype.visitUint8=null;x.prototype.visitUint16=null;x.prototype.visitUint32=null;x.prototype.visitUint64=null;x.prototype.visitFloat16=null;x.prototype.visitFloat32=null;x.prototype.visitFloat64=null;x.prototype.visitDateDay=null;x.prototype.visitDateMillisecond=null;x.prototype.visitTimestampSecond=null;x.prototype.visitTimestampMillisecond=null;x.prototype.visitTimestampMicrosecond=null;x.prototype.visitTimestampNanosecond=null;x.prototype.visitTimeSecond=null;x.prototype.visitTimeMillisecond=null;x.prototype.visitTimeMicrosecond=null;x.prototype.visitTimeNanosecond=null;x.prototype.visitDenseUnion=null;x.prototype.visitSparseUnion=null;x.prototype.visitIntervalDayTime=null;x.prototype.visitIntervalYearMonth=null;const Qs=new Float64Array(1),Ue=new Uint32Array(Qs.buffer);function to(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 fc(n){if(n!==n)return 32256;Qs[0]=n;const t=(Ue[1]&2147483648)>>16&65535;let e=Ue[1]&2146435072,i=0;return e>=1089470464?Ue[0]>0?e=31744:(e=(e&2080374784)>>16,i=(Ue[1]&1048575)>>10):e<=1056964608?(i=1048576+(Ue[1]&1048575),i=1048576+(i<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,i=(Ue[1]&1048575)+512>>10),t|e|i&65535}class B extends x{}function F(n){return(t,e,i)=>{if(t.setValid(e,i!=null))return n(t,e,i)}}const pc=(n,t,e)=>{n[t]=Math.trunc(e/864e5)},lr=(n,t,e)=>{n[t]=Math.trunc(e%4294967296),n[t+1]=Math.trunc(e/4294967296)},yc=(n,t,e)=>{n[t]=Math.trunc(e*1e3%4294967296),n[t+1]=Math.trunc(e*1e3/4294967296)},mc=(n,t,e)=>{n[t]=Math.trunc(e*1e6%4294967296),n[t+1]=Math.trunc(e*1e6/4294967296)},eo=(n,t,e,i)=>{if(e+1<t.length){const{[e]:r,[e+1]:s}=t;n.set(i.subarray(0,s-r),r)}},gc=({offset:n,values:t},e,i)=>{const r=n+e;i?t[r>>3]|=1<<r%8:t[r>>3]&=~(1<<r%8)},he=({values:n},t,e)=>{n[t]=e},ur=({values:n},t,e)=>{n[t]=e},no=({values:n},t,e)=>{n[t]=fc(e)},bc=(n,t,e)=>{switch(n.type.precision){case dt.HALF:return no(n,t,e);case dt.SINGLE:case dt.DOUBLE:return ur(n,t,e)}},io=({values:n},t,e)=>{pc(n,t,e.valueOf())},ro=({values:n},t,e)=>{lr(n,t*2,e.valueOf())},_c=({stride:n,values:t},e,i)=>{t.set(i.subarray(0,n),n*e)},vc=({values:n,valueOffsets:t},e,i)=>eo(n,t,e,i),wc=({values:n,valueOffsets:t},e,i)=>{eo(n,t,e,rr(i))},Sc=(n,t,e)=>{n.type.unit===ue.DAY?io(n,t,e):ro(n,t,e)},so=({values:n},t,e)=>lr(n,t*2,e/1e3),oo=({values:n},t,e)=>lr(n,t*2,e),ao=({values:n},t,e)=>yc(n,t*2,e),co=({values:n},t,e)=>mc(n,t*2,e),Ic=(n,t,e)=>{switch(n.type.unit){case U.SECOND:return so(n,t,e);case U.MILLISECOND:return oo(n,t,e);case U.MICROSECOND:return ao(n,t,e);case U.NANOSECOND:return co(n,t,e)}},lo=({values:n},t,e)=>{n[t]=e},uo=({values:n},t,e)=>{n[t]=e},ho=({values:n},t,e)=>{n[t]=e},fo=({values:n},t,e)=>{n[t]=e},Oc=(n,t,e)=>{switch(n.type.unit){case U.SECOND:return lo(n,t,e);case U.MILLISECOND:return uo(n,t,e);case U.MICROSECOND:return ho(n,t,e);case U.NANOSECOND:return fo(n,t,e)}},Bc=({values:n,stride:t},e,i)=>{n.set(i.subarray(0,t),t*e)},Ac=(n,t,e)=>{const i=n.children[0],r=n.valueOffsets,s=Tt.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))},Dc=(n,t,e)=>{const i=n.children[0],{valueOffsets:r}=n,s=Tt.getVisitFn(i);let{[t]:o,[t+1]:a}=r;const c=e instanceof Map?e.entries():Object.entries(e);for(const l of c)if(s(i,o,l),++o>=a)break},Fc=(n,t)=>(e,i,r,s)=>i&&e(i,n,t[s]),Tc=(n,t)=>(e,i,r,s)=>i&&e(i,n,t.get(s)),Mc=(n,t)=>(e,i,r,s)=>i&&e(i,n,t.get(r.name)),Ec=(n,t)=>(e,i,r,s)=>i&&e(i,n,t[r.name]),Nc=(n,t,e)=>{const i=n.type.children.map(s=>Tt.getVisitFn(s.type)),r=e instanceof Map?Mc(t,e):e instanceof $?Tc(t,e):Array.isArray(e)?Fc(t,e):Ec(t,e);n.type.children.forEach((s,o)=>r(i[o],n.children[o],s,o))},xc=(n,t,e)=>{n.type.mode===vt.Dense?po(n,t,e):yo(n,t,e)},po=(n,t,e)=>{const i=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[i];Tt.visit(r,n.valueOffsets[t],e)},yo=(n,t,e)=>{const i=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[i];Tt.visit(r,t,e)},Lc=(n,t,e)=>{var i;(i=n.dictionary)===null||i===void 0||i.set(n.values[t],e)},Cc=(n,t,e)=>{n.type.unit===ge.DAY_TIME?mo(n,t,e):go(n,t,e)},mo=({values:n},t,e)=>{n.set(e.subarray(0,2),2*t)},go=({values:n},t,e)=>{n[t]=e[0]*12+e[1]%12},Rc=(n,t,e)=>{const{stride:i}=n,r=n.children[0],s=Tt.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))};B.prototype.visitBool=F(gc);B.prototype.visitInt=F(he);B.prototype.visitInt8=F(he);B.prototype.visitInt16=F(he);B.prototype.visitInt32=F(he);B.prototype.visitInt64=F(he);B.prototype.visitUint8=F(he);B.prototype.visitUint16=F(he);B.prototype.visitUint32=F(he);B.prototype.visitUint64=F(he);B.prototype.visitFloat=F(bc);B.prototype.visitFloat16=F(no);B.prototype.visitFloat32=F(ur);B.prototype.visitFloat64=F(ur);B.prototype.visitUtf8=F(wc);B.prototype.visitBinary=F(vc);B.prototype.visitFixedSizeBinary=F(_c);B.prototype.visitDate=F(Sc);B.prototype.visitDateDay=F(io);B.prototype.visitDateMillisecond=F(ro);B.prototype.visitTimestamp=F(Ic);B.prototype.visitTimestampSecond=F(so);B.prototype.visitTimestampMillisecond=F(oo);B.prototype.visitTimestampMicrosecond=F(ao);B.prototype.visitTimestampNanosecond=F(co);B.prototype.visitTime=F(Oc);B.prototype.visitTimeSecond=F(lo);B.prototype.visitTimeMillisecond=F(uo);B.prototype.visitTimeMicrosecond=F(ho);B.prototype.visitTimeNanosecond=F(fo);B.prototype.visitDecimal=F(Bc);B.prototype.visitList=F(Ac);B.prototype.visitStruct=F(Nc);B.prototype.visitUnion=F(xc);B.prototype.visitDenseUnion=F(po);B.prototype.visitSparseUnion=F(yo);B.prototype.visitDictionary=F(Lc);B.prototype.visitInterval=F(Cc);B.prototype.visitIntervalDayTime=F(mo);B.prototype.visitIntervalYearMonth=F(go);B.prototype.visitFixedSizeList=F(Rc);B.prototype.visitMap=F(Dc);const Tt=new B,Et=Symbol.for("parent"),He=Symbol.for("rowIndex");class hr{constructor(t,e){return this[Et]=t,this[He]=e,new Proxy(this,new kc)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[He],e=this[Et],i=e.type.children,r={};for(let s=-1,o=i.length;++s<o;)r[i[s].name]=pt.visit(e.children[s],t);return r}toString(){return`{${[...this].map(([t,e])=>`${fn(t)}: ${fn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Uc(this[Et],this[He])}}class Uc{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,pt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(hr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Et]:{writable:!0,enumerable:!1,configurable:!1,value:null},[He]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class kc{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Et].type.children.map(e=>e.name)}has(t,e){return t[Et].type.children.findIndex(i=>i.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Et].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[Et].type.children.findIndex(r=>r.name===e);if(i!==-1){const r=pt.visit(t[Et].children[i],t[He]);return Reflect.set(t,e,r),r}}set(t,e,i){const r=t[Et].type.children.findIndex(s=>s.name===e);return r!==-1?(Tt.visit(t[Et].children[r],t[He],i),Reflect.set(t,e,i)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,i):!1}}class w extends x{}function A(n){return(t,e)=>t.getValid(e)?n(t,e):null}const Pc=(n,t)=>864e5*n[t],dr=(n,t)=>4294967296*n[t+1]+(n[t]>>>0),jc=(n,t)=>4294967296*(n[t+1]/1e3)+(n[t]>>>0)/1e3,$c=(n,t)=>4294967296*(n[t+1]/1e6)+(n[t]>>>0)/1e6,bo=n=>new Date(n),Vc=(n,t)=>bo(Pc(n,t)),zc=(n,t)=>bo(dr(n,t)),Yc=(n,t)=>null,_o=(n,t,e)=>{if(e+1>=t.length)return null;const i=t[e],r=t[e+1];return n.subarray(i,r)},Wc=({offset:n,values:t},e)=>{const i=n+e;return(t[i>>3]&1<<i%8)!==0},vo=({values:n},t)=>Vc(n,t),wo=({values:n},t)=>zc(n,t*2),Ie=({stride:n,values:t},e)=>t[n*e],Hc=({stride:n,values:t},e)=>to(t[n*e]),So=({values:n},t)=>n[t],Zc=({stride:n,values:t},e)=>t.subarray(n*e,n*(e+1)),Gc=({values:n,valueOffsets:t},e)=>_o(n,t,e),qc=({values:n,valueOffsets:t},e)=>{const i=_o(n,t,e);return i!==null?$i(i):null},Kc=({values:n},t)=>n[t],Jc=({type:n,values:t},e)=>n.precision!==dt.HALF?t[e]:to(t[e]),Xc=(n,t)=>n.type.unit===ue.DAY?vo(n,t):wo(n,t),Io=({values:n},t)=>1e3*dr(n,t*2),Oo=({values:n},t)=>dr(n,t*2),Bo=({values:n},t)=>jc(n,t*2),Ao=({values:n},t)=>$c(n,t*2),Qc=(n,t)=>{switch(n.type.unit){case U.SECOND:return Io(n,t);case U.MILLISECOND:return Oo(n,t);case U.MICROSECOND:return Bo(n,t);case U.NANOSECOND:return Ao(n,t)}},Do=({values:n},t)=>n[t],Fo=({values:n},t)=>n[t],To=({values:n},t)=>n[t],Mo=({values:n},t)=>n[t],tl=(n,t)=>{switch(n.type.unit){case U.SECOND:return Do(n,t);case U.MILLISECOND:return Fo(n,t);case U.MICROSECOND:return To(n,t);case U.NANOSECOND:return Mo(n,t)}},el=({values:n,stride:t},e)=>cr.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 $([c])},il=(n,t)=>{const{valueOffsets:e,children:i}=n,{[t]:r,[t+1]:s}=e,o=i[0];return new fr(o.slice(r,s-r))},rl=(n,t)=>new hr(n,t),sl=(n,t)=>n.type.mode===vt.Dense?Eo(n,t):No(n,t),Eo=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[e];return pt.visit(i,n.valueOffsets[t])},No=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[e];return pt.visit(i,t)},ol=(n,t)=>{var e;return(e=n.dictionary)===null||e===void 0?void 0:e.get(n.values[t])},al=(n,t)=>n.type.unit===ge.DAY_TIME?xo(n,t):Lo(n,t),xo=({values:n},t)=>n.subarray(2*t,2*(t+1)),Lo=({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},cl=(n,t)=>{const{stride:e,children:i}=n,s=i[0].slice(t*e,e);return new $([s])};w.prototype.visitNull=A(Yc);w.prototype.visitBool=A(Wc);w.prototype.visitInt=A(Kc);w.prototype.visitInt8=A(Ie);w.prototype.visitInt16=A(Ie);w.prototype.visitInt32=A(Ie);w.prototype.visitInt64=A(So);w.prototype.visitUint8=A(Ie);w.prototype.visitUint16=A(Ie);w.prototype.visitUint32=A(Ie);w.prototype.visitUint64=A(So);w.prototype.visitFloat=A(Jc);w.prototype.visitFloat16=A(Hc);w.prototype.visitFloat32=A(Ie);w.prototype.visitFloat64=A(Ie);w.prototype.visitUtf8=A(qc);w.prototype.visitBinary=A(Gc);w.prototype.visitFixedSizeBinary=A(Zc);w.prototype.visitDate=A(Xc);w.prototype.visitDateDay=A(vo);w.prototype.visitDateMillisecond=A(wo);w.prototype.visitTimestamp=A(Qc);w.prototype.visitTimestampSecond=A(Io);w.prototype.visitTimestampMillisecond=A(Oo);w.prototype.visitTimestampMicrosecond=A(Bo);w.prototype.visitTimestampNanosecond=A(Ao);w.prototype.visitTime=A(tl);w.prototype.visitTimeSecond=A(Do);w.prototype.visitTimeMillisecond=A(Fo);w.prototype.visitTimeMicrosecond=A(To);w.prototype.visitTimeNanosecond=A(Mo);w.prototype.visitDecimal=A(el);w.prototype.visitList=A(nl);w.prototype.visitStruct=A(rl);w.prototype.visitUnion=A(sl);w.prototype.visitDenseUnion=A(Eo);w.prototype.visitSparseUnion=A(No);w.prototype.visitDictionary=A(ol);w.prototype.visitInterval=A(al);w.prototype.visitIntervalDayTime=A(xo);w.prototype.visitIntervalYearMonth=A(Lo);w.prototype.visitFixedSizeList=A(cl);w.prototype.visitMap=A(il);const pt=new w,Pt=Symbol.for("keys"),Ze=Symbol.for("vals");class fr{constructor(t){return this[Pt]=new $([t.children[0]]).memoize(),this[Ze]=t.children[1],new Proxy(this,new ul)}[Symbol.iterator](){return new ll(this[Pt],this[Ze])}get size(){return this[Pt].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Pt],e=this[Ze],i={};for(let r=-1,s=t.length;++r<s;)i[t.get(r)]=pt.visit(e,r);return i}toString(){return`{${[...this].map(([t,e])=>`${fn(t)}: ${fn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class ll{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),pt.visit(this.vals,t)]})}}class ul{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Pt].toArray().map(String)}has(t,e){return t[Pt].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Pt].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[Pt].indexOf(e);if(i!==-1){const r=pt.visit(Reflect.get(t,Ze),i);return Reflect.set(t,e,r),r}}set(t,e,i){const r=t[Pt].indexOf(e);return r!==-1?(Tt.visit(Reflect.get(t,Ze),r,i),Reflect.set(t,e,i)):Reflect.has(t,e)?Reflect.set(t,e,i):!1}}Object.defineProperties(fr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Pt]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ze]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Zr;function Co(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&&(Zr=s,s=o,o=Zr),o>r&&(o=r),i?i(n,s,o):[s,o]}const Gr=n=>n!==n;function on(n){if(typeof n!=="object"||n===null)return Gr(n)?Gr: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?ic(n,e):!1:n instanceof Map?dl(n):Array.isArray(n)?hl(n):n instanceof $?fl(n):pl(n,!0)}function hl(n){const t=[];for(let e=-1,i=n.length;++e<i;)t[e]=on(n[e]);return vi(t)}function dl(n){let t=-1;const e=[];for(const i of n.values())e[++t]=on(i);return vi(e)}function fl(n){const t=[];for(let e=-1,i=n.length;++e<i;)t[e]=on(n.get(e));return vi(t)}function pl(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]=on(n[e[r]]);return vi(i,e)}function vi(n,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return yl(n,e);case Map:return qr(n,e,e.keys());case fr:case hr:case Object:case void 0:return qr(n,e,t||Object.keys(e))}return e instanceof $?ml(n,e):!1}}function yl(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 ml(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 qr(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(),l=i.next(),u=r.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!n[o](c.value));++o,l=i.next(),u=r.next(),c=s.next());return o===a&&l.done&&u.done&&c.done?!0:(i.return&&i.return(),r.return&&r.return(),s.return&&s.return(),!1)}function Ro(n,t,e,i){return(e&1<<i)!==0}function gl(n,t,e,i){return(e&1<<i)>>i}function pr(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):ni(new yr(e,n,t,null,Ro)).subarray(0,i)),r}return e}function ni(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 yr{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 Wi(n,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(const o of new yr(n,t,e-t,n,gl))s+=o;return s}const i=e>>3<<3,r=t+(t%8===0?0:8-t%8);return Wi(n,t,r)+Wi(n,i,e)+bl(n,r>>3,i-r>>3)}function bl(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 _l=-1;class Z{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 Z?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=re(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<=_l&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-Wi(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 Z(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===h.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(pr(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[ie.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[ie.TYPE])&&(o[ie.TYPE]=s.subarray(t,t+e)),(s=o[ie.OFFSET])&&(o[ie.OFFSET]=s.subarray(t,t+e+1))||(s=o[ie.DATA])&&(o[ie.DATA]=r===6?s:s.subarray(i*t,i*(t+e))),o}_sliceChildren(t,e,i){return t.map(r=>r.slice(e,i))}}Z.prototype.children=Object.freeze([]);class un extends x{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:i=0,["length"]:r=0}=t;return new Z(e,i,r,0)}visitBool(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitInt(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitFloat(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitUtf8(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.data),s=R(t.nullBitmap),o=an(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Z(e,i,a,c,[o,r,s])}visitBinary(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.data),s=R(t.nullBitmap),o=an(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Z(e,i,a,c,[o,r,s])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/re(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitDate(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/re(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitTimestamp(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/re(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitTime(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/re(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitDecimal(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/re(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitList(t){const{["type"]:e,["offset"]:i=0,["child"]:r}=t,s=R(t.nullBitmap),o=an(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Z(e,i,a,c,[o,void 0,s],[r])}visitStruct(t){const{["type"]:e,["offset"]:i=0,["children"]:r=[]}=t,s=R(t.nullBitmap),{length:o=r.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,void 0,s],r)}visitUnion(t){const{["type"]:e,["offset"]:i=0,["children"]:r=[]}=t,s=R(t.nullBitmap),o=W(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;if(v.isSparseUnion(e))return new Z(e,i,a,c,[void 0,void 0,s,o],r);const l=an(t.valueOffsets);return new Z(e,i,a,c,[l,void 0,s,o],r)}visitDictionary(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.indices.ArrayType,t.data),{["dictionary"]:o=new $([new un().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Z(e,i,a,c,[void 0,s,r],[],o)}visitInterval(t){const{["type"]:e,["offset"]:i=0}=t,r=R(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/re(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,s,r])}visitFixedSizeList(t){const{["type"]:e,["offset"]:i=0,["child"]:r=new un().visit({type:e.valueType})}=t,s=R(t.nullBitmap),{["length"]:o=r.length/re(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Z(e,i,o,a,[void 0,void 0,s],[r])}visitMap(t){const{["type"]:e,["offset"]:i=0,["child"]:r=new un().visit({type:e.childType})}=t,s=R(t.nullBitmap),o=an(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Z(e,i,a,c,[o,void 0,s],[r])}}function N(n){return new un().visit(n)}class Kr{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 Uo(n){return n.reduce((t,e)=>t+e.nullCount,0)}function ko(n){return n.reduce((t,e,i)=>(t[i+1]=t[i]+e.length,t),new Uint32Array(n.length+1))}function Po(n,t,e,i){const r=[];for(let s=-1,o=n.length;++s<o;){const a=n[s],c=t[s],{length:l}=a;if(c>=i)break;if(e>=c+l)continue;if(c>=e&&c+l<=i){r.push(a);continue}const u=Math.max(0,e-c),f=Math.min(i-c,l);r.push(a.slice(u,f-u))}return r.length===0&&r.push(n[0].slice(0,0)),r}function mr(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 gr(n,t){return n.getValid(t)}function Ge(n){function t(e,i,r){return n(e[i],r)}return function(e){const i=this.data;return mr(i,this._offsets,e,t)}}function jo(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=mr(s,this._offsets,i,e);return t=void 0,o}}function $o(n){let t;function e(i,r,s){let o=s,a=0,c=0;for(let l=r-1,u=i.length;++l<u;){const f=i[l];if(~(a=n(f,t,o)))return c+a;o=0,c+=f.length}return-1}return function(i,r){t=i;const s=this.data,o=typeof r!="number"?e(s,0,0):mr(s,this._offsets,r,e);return t=void 0,o}}class S extends x{}function vl(n,t){return t===null&&n.length>0?0:-1}function wl(n,t){const{nullBitmap:e}=n;if(!e||n.nullCount<=0)return-1;let i=0;for(const r of new yr(e,n.offset+(t||0),n.length,e,Ro)){if(!r)return i;++i}return-1}function E(n,t,e){if(t===void 0)return-1;if(t===null)return wl(n,e);const i=pt.getVisitFn(n),r=on(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(r(i(n,s)))return s;return-1}function Vo(n,t,e){const i=pt.getVisitFn(n),r=on(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(r(i(n,s)))return s;return-1}S.prototype.visitNull=vl;S.prototype.visitBool=E;S.prototype.visitInt=E;S.prototype.visitInt8=E;S.prototype.visitInt16=E;S.prototype.visitInt32=E;S.prototype.visitInt64=E;S.prototype.visitUint8=E;S.prototype.visitUint16=E;S.prototype.visitUint32=E;S.prototype.visitUint64=E;S.prototype.visitFloat=E;S.prototype.visitFloat16=E;S.prototype.visitFloat32=E;S.prototype.visitFloat64=E;S.prototype.visitUtf8=E;S.prototype.visitBinary=E;S.prototype.visitFixedSizeBinary=E;S.prototype.visitDate=E;S.prototype.visitDateDay=E;S.prototype.visitDateMillisecond=E;S.prototype.visitTimestamp=E;S.prototype.visitTimestampSecond=E;S.prototype.visitTimestampMillisecond=E;S.prototype.visitTimestampMicrosecond=E;S.prototype.visitTimestampNanosecond=E;S.prototype.visitTime=E;S.prototype.visitTimeSecond=E;S.prototype.visitTimeMillisecond=E;S.prototype.visitTimeMicrosecond=E;S.prototype.visitTimeNanosecond=E;S.prototype.visitDecimal=E;S.prototype.visitList=E;S.prototype.visitStruct=E;S.prototype.visitUnion=E;S.prototype.visitDenseUnion=Vo;S.prototype.visitSparseUnion=Vo;S.prototype.visitDictionary=E;S.prototype.visitInterval=E;S.prototype.visitIntervalDayTime=E;S.prototype.visitIntervalYearMonth=E;S.prototype.visitFixedSizeList=E;S.prototype.visitMap=E;const ii=new S;class I extends x{}function D(n){const{type:t}=n;if(n.nullCount===0&&n.stride===1&&(t.typeId===h.Timestamp||t instanceof _e&&t.bitWidth!==64||t instanceof gn&&t.bitWidth!==64||t instanceof mn&&t.precision!==dt.HALF))return new Kr(n.data.length,i=>{const r=n.data[i];return r.values.subarray(0,r.length)[Symbol.iterator]()});let e=0;return new Kr(n.data.length,i=>{const s=n.data[i].length,o=n.slice(e,e+s);return e+=s,new Sl(o)})}class Sl{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}}I.prototype.visitNull=D;I.prototype.visitBool=D;I.prototype.visitInt=D;I.prototype.visitInt8=D;I.prototype.visitInt16=D;I.prototype.visitInt32=D;I.prototype.visitInt64=D;I.prototype.visitUint8=D;I.prototype.visitUint16=D;I.prototype.visitUint32=D;I.prototype.visitUint64=D;I.prototype.visitFloat=D;I.prototype.visitFloat16=D;I.prototype.visitFloat32=D;I.prototype.visitFloat64=D;I.prototype.visitUtf8=D;I.prototype.visitBinary=D;I.prototype.visitFixedSizeBinary=D;I.prototype.visitDate=D;I.prototype.visitDateDay=D;I.prototype.visitDateMillisecond=D;I.prototype.visitTimestamp=D;I.prototype.visitTimestampSecond=D;I.prototype.visitTimestampMillisecond=D;I.prototype.visitTimestampMicrosecond=D;I.prototype.visitTimestampNanosecond=D;I.prototype.visitTime=D;I.prototype.visitTimeSecond=D;I.prototype.visitTimeMillisecond=D;I.prototype.visitTimeMicrosecond=D;I.prototype.visitTimeNanosecond=D;I.prototype.visitDecimal=D;I.prototype.visitList=D;I.prototype.visitStruct=D;I.prototype.visitUnion=D;I.prototype.visitDenseUnion=D;I.prototype.visitSparseUnion=D;I.prototype.visitDictionary=D;I.prototype.visitInterval=D;I.prototype.visitIntervalDayTime=D;I.prototype.visitIntervalYearMonth=D;I.prototype.visitFixedSizeList=D;I.prototype.visitMap=D;const br=new I,Il=(n,t)=>n+t;class Oe extends x{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===U.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((i,r)=>i+qt.visit(r,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((i,r)=>i+qt.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 Ol=({valueOffsets:n},t)=>8+(n[t+1]-n[t]),Bl=({valueOffsets:n},t)=>8+(n[t+1]-n[t]),Al=({valueOffsets:n,stride:t,children:e},i)=>{const r=e[0],{[i*t]:s}=n,{[i*t+1]:o}=n,a=qt.getVisitFn(r.type),c=r.slice(s,o-s);let l=8;for(let u=-1,f=o-s;++u<f;)l+=a(c,u);return l},Dl=({stride:n,children:t},e)=>{const i=t[0],r=i.slice(e*n,n),s=qt.getVisitFn(i.type);let o=0;for(let a=-1,c=r.length;++a<c;)o+=s(r,a);return o},Fl=(n,t)=>n.type.mode===vt.Dense?zo(n,t):Yo(n,t),zo=({type:n,children:t,typeIds:e,valueOffsets:i},r)=>{const s=n.typeIdToChildIndex[e[r]];return 8+qt.visit(t[s],i[r])},Yo=({children:n},t)=>4+qt.visitMany(n,n.map(()=>t)).reduce(Il,0);Oe.prototype.visitUtf8=Ol;Oe.prototype.visitBinary=Bl;Oe.prototype.visitList=Al;Oe.prototype.visitFixedSizeList=Dl;Oe.prototype.visitUnion=Fl;Oe.prototype.visitDenseUnion=zo;Oe.prototype.visitSparseUnion=Yo;const qt=new Oe;var Wo;const Ho={},Zo={};class ${constructor(t){var e,i,r;const s=t[0]instanceof $?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof Z)))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:l,byteLength:u}=Ho[o.typeId],f=s[0];this.isValid=m=>gr(f,m),this.get=m=>a(f,m),this.set=(m,y)=>c(f,m,y),this.indexOf=m=>l(f,m),this.getByteLength=m=>u(f,m),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,Zo[o.typeId]),this._offsets=ko(s);break}this.data=s,this.type=o,this.stride=re(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=Uo(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${h[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 br.visit(this)}concat(...t){return new $(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new $(Co(this,t,e,({data:i,_offsets:r},s,o)=>Po(i,r,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:i,stride:r,ArrayType:s}=this;switch(t.typeId){case h.Int:case h.Float:case h.Decimal:case h.Time:case h.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 $(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return v.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(v.isDictionary(this.type)){const t=new ri(this.data[0].dictionary),e=this.data.map(i=>{const r=i.clone();return r.dictionary=t,r});return new $(e)}return new ri(this)}unmemoize(){if(v.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)}return this}}Wo=Symbol.toStringTag;$[Wo]=(n=>{n.type=v.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(h).map(e=>h[e]).filter(e=>typeof e=="number"&&e!==h.NONE);for(const e of t){const i=pt.getVisitFnByTypeId(e),r=Tt.getVisitFnByTypeId(e),s=ii.getVisitFnByTypeId(e),o=qt.getVisitFnByTypeId(e);Ho[e]={get:i,set:r,indexOf:s,byteLength:o},Zo[e]=Object.create(n,{isValid:{value:Ge(gr)},get:{value:Ge(pt.getVisitFnByTypeId(e))},set:{value:jo(Tt.getVisitFnByTypeId(e))},indexOf:{value:$o(ii.getVisitFnByTypeId(e))},getByteLength:{value:Ge(qt.getVisitFnByTypeId(e))}})}return"Vector"})($.prototype);class ri extends ${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 ri(r.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new $(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Hi{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 Ri=2,jt=4,oe=4,H=4,pe=new Int32Array(2),Jr=new Float32Array(pe.buffer),Xr=new Float64Array(pe.buffer),En=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;let ce=class Zi{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?Zi.ZERO:new Zi(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};ce.ZERO=new ce(0,0);var Gi;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Gi||(Gi={}));let Xe=class Go{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new Go(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 ce(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new ce(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return pe[0]=this.readInt32(t),Jr[0]}readFloat64(t){return pe[En?0:1]=this.readInt32(t),pe[En?1:0]=this.readInt32(t+4),Xr[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){Jr[0]=e,this.writeInt32(t,pe[0])}writeFloat64(t,e){Xr[0]=e,this.writeInt32(t,pe[En?0:1]),this.writeInt32(t+4,pe[En?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+jt+oe)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<oe;e++)t+=String.fromCharCode(this.readInt8(this.position_+jt+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+=jt,e===Gi.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 l=this.readUint8(t+s++);if(a<240)o=(a&15)<<12|(c&63)<<6|l&63;else{const u=this.readUint8(t+s++);o=(a&7)<<18|(c&63)<<12|(l&63)<<6|u&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)+jt}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=oe)throw new Error("FlatBuffers: file identifier must be length "+oe);for(let e=0;e<oe;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+jt+e))return!1;return!0}createLong(t,e){return ce.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}},qo=class Ko{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=Xe.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=Ko.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=Xe.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r}addOffset(t){this.prep(jt,0),this.writeInt32(this.offset()-t+jt)}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)*Ri;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 l=Ri;l<s;l+=Ri)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))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?H:0;if(e){const s=e;if(this.prep(this.minalign,jt+oe+r),s.length!=oe)throw new Error("FlatBuffers: file identifier must be length "+oe);for(let o=oe-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,jt+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(jt,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 ce.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 it{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 it).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+H),(e||new it).__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 it.startKeyValue(t),it.addKey(t,e),it.addValue(t,i),it.endKeyValue(t)}}var Qe;(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"})(Qe||(Qe={}));var tn;(function(n){n[n.Little=0]="Little",n[n.Big=1]="Big"})(tn||(tn={}));var si;(function(n){n[n.DenseArray=0]="DenseArray"})(si||(si={}));class bt{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 bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+H),(e||new bt).__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 bt.startInt(t),bt.addBitWidth(t,e),bt.addIsSigned(t,i),bt.endInt(t)}}class ae{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 ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+H),(e||new ae).__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 bt).__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):si.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,si.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class De{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 De).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+H),(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return De.startBinary(t),De.endBinary(t)}}class Fe{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 Fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+H),(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Fe.startBool(t),Fe.endBool(t)}}var oi;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(oi||(oi={}));let Cn=class Pe{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 Pe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+H),(e||new Pe).__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):oi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,oi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Pe.startDate(t),Pe.addUnit(t,e),Pe.endDate(t)}};class lt{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 lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+H),(e||new lt).__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 lt.startDecimal(t),lt.addPrecision(t,e),lt.addScale(t,i),lt.addBitWidth(t,r),lt.endDecimal(t)}}var en;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(en||(en={}));class $t{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 $t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+H),(e||new $t).__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 $t.startFixedSizeBinary(t),$t.addByteWidth(t,e),$t.endFixedSizeBinary(t)}}class Vt{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 Vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+H),(e||new Vt).__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 Vt.startFixedSizeList(t),Vt.addListSize(t,e),Vt.endFixedSizeList(t)}}var ai;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(ai||(ai={}));class zt{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 zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+H),(e||new zt).__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):ai.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,ai.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return zt.startFloatingPoint(t),zt.addPrecision(t,e),zt.endFloatingPoint(t)}}var ci;(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"})(ci||(ci={}));class Yt{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 Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+H),(e||new Yt).__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):ci.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,ci.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Yt.startInterval(t),Yt.addUnit(t,e),Yt.endInterval(t)}}class Te{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 Te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+H),(e||new Te).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Te.startList(t),Te.endList(t)}}let Rn=class je{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 je).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+H),(e||new je).__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 je.startMap(t),je.addKeysSorted(t,e),je.endMap(t)}};class Me{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 Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+H),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Me.startNull(t),Me.endNull(t)}}class Ee{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 Ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+H),(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ee.startStruct_(t),Ee.endStruct_(t)}}class Dt{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 Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+H),(e||new Dt).__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):en.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,en.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return Dt.startTime(t),Dt.addUnit(t,e),Dt.addBitWidth(t,i),Dt.endTime(t)}}class Ft{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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+H),(e||new Ft).__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):en.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,en.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return Ft.startTimestamp(t),Ft.addUnit(t,e),Ft.addTimezone(t,i),Ft.endTimestamp(t)}}var li;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(li||(li={}));class ut{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 ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+H),(e||new ut).__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):li.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,li.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 ut.startUnion(t),ut.addMode(t,e),ut.addTypeIds(t,i),ut.endUnion(t)}}class Ne{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 Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+H),(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ne.startUtf8(t),Ne.endUtf8(t)}}var K;(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"})(K||(K={}));let Bt=class Un{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 Un).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+H),(e||new Un).__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):K.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 ae).__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 Un).__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 it).__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,K.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()}},Ut=class ne{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 ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+H),(e||new ne).__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):tn.Little}fields(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new Bt).__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 it).__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,tn.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 ne.startSchema(t),ne.addEndianness(t,e),ne.addFields(t,i),ne.addCustomMetadata(t,r),ne.addFeatures(t,s),ne.endSchema(t)}};class gt{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 gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+H),(e||new gt).__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):Qe.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ut).__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 Hi).__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 Hi).__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 it).__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,Qe.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 V{constructor(t=[],e,i){this.fields=t||[],this.metadata=e||new Map,i||(i=qi(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 V(i,this.metadata)}selectAt(t){const e=t.map(i=>this.fields[i]).filter(Boolean);return new V(e,this.metadata)}assign(...t){const e=t[0]instanceof V?t[0]:Array.isArray(t[0])?new V(t[0]):new V(t),i=[...this.fields],r=Nn(Nn(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{const c=i.findIndex(l=>l.name===a.name);return~c?(i[c]=a.clone({metadata:Nn(Nn(new Map,i[c].metadata),a.metadata)}))&&!1:!0}),o=qi(s,new Map);return new V([...i,...s],r,new Map([...this.dictionaries,...o]))}}V.prototype.fields=null;V.prototype.metadata=null;V.prototype.dictionaries=null;class G{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 G(`${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],G.new(e,i,r,s)}}G.prototype.type=null;G.prototype.name=null;G.prototype.nullable=null;G.prototype.metadata=null;function Nn(n,t){return new Map([...n||new Map,...t||new Map])}function qi(n,t=new Map){for(let e=-1,i=n.length;++e<i;){const s=n[e].type;if(v.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&&qi(s.children,t)}return t}var Qr=ce,Tl=qo,Ml=Xe;class bn{constructor(t,e=_t.V4,i,r){this.schema=t,this.version=e,i&&(this._recordBatches=i),r&&(this._dictionaryBatches=r)}static decode(t){t=new Ml(R(t));const e=gt.getRootAsFooter(t),i=V.decode(e.schema());return new El(i,e)}static encode(t){const e=new Tl,i=V.encode(e,t.schema);gt.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())ve.encode(e,o);const r=e.endVector();gt.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())ve.encode(e,o);const s=e.endVector();return gt.startFooter(e),gt.addSchema(e,i),gt.addVersion(e,_t.V4),gt.addRecordBatches(e,r),gt.addDictionaries(e,s),gt.finishFooterBuffer(e,gt.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 El extends bn{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 ve.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return ve.decode(e)}return null}}class ve{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 ve(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:i}=e,r=new Qr(e.offset,0),s=new Qr(e.bodyLength,0);return Hi.createBlock(t,r,i,s)}}const J=Object.freeze({done:!0,value:void 0});class ts{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class _r{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 Nl extends _r{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return _(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(J);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return At.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return At.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return _(this,void 0,void 0,function*(){return yield this.abort(t),J})}return(t){return _(this,void 0,void 0,function*(){return yield this.close(),J})}read(t){return _(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return _(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(J)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class kn extends Nl{write(t){if((t=R(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?$i(this.toUint8Array(!0)):this.toUint8Array(!1).then($i)}toUint8Array(t=!1){return t?Gt(this._values)[0]:_(this,void 0,void 0,function*(){var e,i;const r=[];let s=0;try{for(var o=xe(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 Gt(r,s)[0]})}}class ui{constructor(t){t&&(this.source=new xl(At.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 nn{constructor(t){t instanceof nn?this.source=t.source:t instanceof kn?this.source=new Ae(At.fromAsyncIterable(t)):Es(t)?this.source=new Ae(At.fromNodeStream(t)):sr(t)?this.source=new Ae(At.fromDOMStream(t)):Ms(t)?this.source=new Ae(At.fromDOMStream(t.body)):Sn(t)?this.source=new Ae(At.fromIterable(t)):me(t)?this.source=new Ae(At.fromAsyncIterable(t)):sn(t)&&(this.source=new Ae(At.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 xl{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)||J)}return(t){return Object.create(this.source.return&&this.source.return(t)||J)}}class Ae{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return _(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return _(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return _(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return _(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return _(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||J;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return _(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||J;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class es extends ui{constructor(t,e){super(),this.position=0,this.buffer=R(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 hi extends nn{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=_(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return _(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 _(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 _(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)),l=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,s));return l}return null})}readAt(t,e){return _(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 _(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return _(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return _(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const Ll=65536;function Ve(n){return n<0&&(n=4294967295+n+1),`0x${n.toString(16)}`}const rn=8,vr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Jo{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?Ll: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`${Ve(this.buffer[1])} ${Ve(this.buffer[0])}`}}class Y extends Jo{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return Y.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Y.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const i=t.length,r=new Y(e);for(let s=0;s<i;){const o=rn<i-s?rn:i-s,a=new Y(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new Y(new Uint32Array([vr[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;)Y.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new Y(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Y(new Uint32Array(t.buffer)).plus(e)}}class ct extends Jo{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 ct.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return ct.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const i=t.startsWith("-"),r=t.length,s=new ct(e);for(let o=i?1:0;o<r;){const a=rn<r-o?rn:r-o,c=new ct(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new ct(new Uint32Array([vr[a],0]));s.times(l),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;)ct.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new ct(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ct(new Uint32Array(t.buffer)).plus(e)}}class kt{constructor(t){this.buffer=t}high(){return new ct(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ct(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 Y(new Uint32Array([this.buffer[3],0])),i=new Y(new Uint32Array([this.buffer[2],0])),r=new Y(new Uint32Array([this.buffer[1],0])),s=new Y(new Uint32Array([this.buffer[0],0])),o=new Y(new Uint32Array([t.buffer[3],0])),a=new Y(new Uint32Array([t.buffer[2],0])),c=new Y(new Uint32Array([t.buffer[1],0])),l=new Y(new Uint32Array([t.buffer[0],0]));let u=Y.multiply(s,l);this.buffer[0]=u.low();const f=new Y(new Uint32Array([u.high(),0]));return u=Y.multiply(r,l),f.plus(u),u=Y.multiply(s,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Y(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Y.multiply(i,l)).plus(Y.multiply(r,c)).plus(Y.multiply(s,a)),this.buffer[3]+=Y.multiply(e,l).plus(Y.multiply(i,c)).plus(Y.multiply(r,a)).plus(Y.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`${Ve(this.buffer[3])} ${Ve(this.buffer[2])} ${Ve(this.buffer[1])} ${Ve(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=rn<r-o?rn:r-o,c=new kt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new kt(new Uint32Array([vr[a],0,0,0]));s.times(l),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+16*i,4));return e}}class Xo extends x{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 G?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return N({type:t,length:e})}visitBool(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({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 N({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 N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({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 N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===vt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({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 N({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 N({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 N({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:i}=this.nextFieldNode()){return N({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 N({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 Cl extends Xo{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):ni(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 v.isTimestamp(t)||(v.isInt(t)||v.isTime(t))&&t.bitWidth===64||v.isDate(t)&&t.unit===ue.MILLISECOND?W(Uint8Array,ct.convertArray(i[e])):v.isDecimal(t)?W(Uint8Array,kt.convertArray(i[e])):v.isBinary(t)||v.isFixedSizeBinary(t)?Rl(i[e]):v.isBool(t)?ni(i[e]):v.isUtf8(t)?rr(i[e].join("")):W(Uint8Array,W(t.ArrayType,i[e].map(r=>+r)))}}function Rl(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 O extends x{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 yt(n,t){return t instanceof n.constructor}function In(n,t){return n===t||yt(n,t)}function de(n,t){return n===t||yt(n,t)&&n.bitWidth===t.bitWidth&&n.isSigned===t.isSigned}function wi(n,t){return n===t||yt(n,t)&&n.precision===t.precision}function Ul(n,t){return n===t||yt(n,t)&&n.byteWidth===t.byteWidth}function wr(n,t){return n===t||yt(n,t)&&n.unit===t.unit}function On(n,t){return n===t||yt(n,t)&&n.unit===t.unit&&n.timezone===t.timezone}function Bn(n,t){return n===t||yt(n,t)&&n.unit===t.unit&&n.bitWidth===t.bitWidth}function kl(n,t){return n===t||yt(n,t)&&n.children.length===t.children.length&&we.compareManyFields(n.children,t.children)}function Pl(n,t){return n===t||yt(n,t)&&n.children.length===t.children.length&&we.compareManyFields(n.children,t.children)}function Sr(n,t){return n===t||yt(n,t)&&n.mode===t.mode&&n.typeIds.every((e,i)=>e===t.typeIds[i])&&we.compareManyFields(n.children,t.children)}function jl(n,t){return n===t||yt(n,t)&&n.id===t.id&&n.isOrdered===t.isOrdered&&we.visit(n.indices,t.indices)&&we.visit(n.dictionary,t.dictionary)}function Ir(n,t){return n===t||yt(n,t)&&n.unit===t.unit}function $l(n,t){return n===t||yt(n,t)&&n.listSize===t.listSize&&n.children.length===t.children.length&&we.compareManyFields(n.children,t.children)}function Vl(n,t){return n===t||yt(n,t)&&n.keysSorted===t.keysSorted&&n.children.length===t.children.length&&we.compareManyFields(n.children,t.children)}O.prototype.visitNull=In;O.prototype.visitBool=In;O.prototype.visitInt=de;O.prototype.visitInt8=de;O.prototype.visitInt16=de;O.prototype.visitInt32=de;O.prototype.visitInt64=de;O.prototype.visitUint8=de;O.prototype.visitUint16=de;O.prototype.visitUint32=de;O.prototype.visitUint64=de;O.prototype.visitFloat=wi;O.prototype.visitFloat16=wi;O.prototype.visitFloat32=wi;O.prototype.visitFloat64=wi;O.prototype.visitUtf8=In;O.prototype.visitBinary=In;O.prototype.visitFixedSizeBinary=Ul;O.prototype.visitDate=wr;O.prototype.visitDateDay=wr;O.prototype.visitDateMillisecond=wr;O.prototype.visitTimestamp=On;O.prototype.visitTimestampSecond=On;O.prototype.visitTimestampMillisecond=On;O.prototype.visitTimestampMicrosecond=On;O.prototype.visitTimestampNanosecond=On;O.prototype.visitTime=Bn;O.prototype.visitTimeSecond=Bn;O.prototype.visitTimeMillisecond=Bn;O.prototype.visitTimeMicrosecond=Bn;O.prototype.visitTimeNanosecond=Bn;O.prototype.visitDecimal=In;O.prototype.visitList=kl;O.prototype.visitStruct=Pl;O.prototype.visitUnion=Sr;O.prototype.visitDenseUnion=Sr;O.prototype.visitSparseUnion=Sr;O.prototype.visitDictionary=jl;O.prototype.visitInterval=Ir;O.prototype.visitIntervalDayTime=Ir;O.prototype.visitIntervalYearMonth=Ir;O.prototype.visitFixedSizeList=$l;O.prototype.visitMap=Vl;const we=new O;function Ki(n,t){return we.compareSchemas(n,t)}function Ui(n,t){return zl(n,t.map(e=>e.data.concat()))}function zl(n,t){const e=[...n.fields],i=[],r={numBatches:t.reduce((f,m)=>Math.max(f,m.length),0)};let s=0,o=0,a=-1;const c=t.length;let l,u=[];for(;r.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=Yl(e,o,u,t,r),o>0&&(i[s++]=N({type:new st(e),length:o,nullCount:0,children:u.slice()})))}return[n=n.assign(e),i.map(f=>new ht(n,f))]}function Yl(n,t,e,i,r){var s;const o=(t+63&-64)>>3;for(let a=-1,c=i.length;++a<c;){const l=e[a],u=l==null?void 0:l.length;if(u>=t)u===t?e[a]=l:(e[a]=l.slice(0,t),r.numBatches=Math.max(r.numBatches,i[a].unshift(l.slice(t,u-t))));else{const f=n[a];n[a]=f.clone({nullable:!0}),e[a]=(s=l==null?void 0:l._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:N({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Qo;class rt{constructor(...t){var e,i;if(t.length===0)return this.batches=[],this.schema=new V([]),this._offsets=[0],this;let r,s;t[0]instanceof V&&(r=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());const o=c=>{if(c){if(c instanceof ht)return[c];if(c instanceof rt)return c.batches;if(c instanceof Z){if(c.type instanceof st)return[new ht(new V(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){const l=Object.keys(c),u=l.map(y=>new $([c[y]])),f=new V(l.map((y,b)=>new G(String(y),u[b].type))),[,m]=Ui(f,u);return m.length===0?[new ht(c)]:m}}}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 V([]),!(r instanceof V))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const c of a){if(!(c instanceof ht))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Ki(r,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=r,this.batches=a,this._offsets=s??ko(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=Uo(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?br.visit(new $(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 rt(e,i.map(r=>new ht(e,r)))}slice(t,e){const i=this.schema;[t,e]=Co({length:this.numRows},t,e);const r=Po(this.data,this._offsets,t,e);return new rt(i,r.map(s=>new ht(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=N({type:i,length:0,nullCount:0});e.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new $(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 $([N({type:new be,length:this.numRows})]));const s=i.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[i,r]=Ui(i,a)}return new rt(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 rt(e,i)}assign(t){const e=this.schema.fields,[i,r]=t.schema.fields.reduce((a,c,l)=>{const[u,f]=a,m=e.findIndex(y=>y.name===c.name);return~m?f[m]=l:u.push(l),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 rt(...Ui(s,o))}}Qo=Symbol.toStringTag;rt[Qo]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=Ge(gr),n.get=Ge(pt.getVisitFn(h.Struct)),n.set=jo(Tt.getVisitFn(h.Struct)),n.indexOf=$o(ii.getVisitFn(h.Struct)),n.getByteLength=Ge(qt.getVisitFn(h.Struct)),"Table"))(rt.prototype);var ta;let ht=class cn{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof V))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=N({nullCount:0,type:new st(this.schema.fields),children:this.schema.fields.map(e=>N({type:e.type,nullCount:0}))})]=t,!(this.data instanceof Z))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=ns(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:i,children:r,length:s}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=G.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new V(i),a=N({type:new st(i),length:s,children:r,nullCount:0});[this.schema,this.data]=ns(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=ea(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 pt.visit(this.data,t)}set(t,e){return Tt.visit(this.data,t,e)}indexOf(t,e){return ii.visit(this.data,t,e)}getByteLength(t){return qt.visit(this.data,t)}[Symbol.iterator](){return br.visit(new $([this.data]))}toArray(){return[...this]}concat(...t){return new rt(this.schema,[this,...t])}slice(t,e){const[i]=new $([this.data]).slice(t,e).data;return new cn(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 $([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 $([N({type:new be,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 V(s,new Map(this.schema.metadata)),r=N({type:new st(s),children:o})}return new cn(i,r)}select(t){const e=this.schema.select(t),i=new st(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 cn(e,N({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=N({type:new st(e.fields),length:this.numRows,children:i});return new cn(e,r)}};ta=Symbol.toStringTag;ht[ta]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ht.prototype);function ns(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 l=t[a];(!l||l.length!==e)&&(r[a]=c.clone({nullable:!0}),s[a]=(i=l==null?void 0:l._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:N({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[n.assign(r),N({type:new st(r),length:e,children:s})]}function ea(n,t,e=new Map){for(let i=-1,r=n.length;++i<r;){const o=n[i].type,a=t[i];if(v.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&&ea(o.children,a.children,e)}return e}class Or extends ht{constructor(t){const e=t.fields.map(r=>N({type:r.type})),i=N({type:new st(t.fields),nullCount:0,children:e});super(t,i)}}var di;(function(n){n[n.BUFFER=0]="BUFFER"})(di||(di={}));var fi;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(fi||(fi={}));class ye{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 ye).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+H),(e||new ye).__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):fi.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):di.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,fi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,di.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return ye.startBodyCompression(t),ye.addCodec(t,e),ye.addMethod(t,i),ye.endBodyCompression(t)}}class na{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()}},se=class Ji{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 Ji).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+H),(e||new Ji).__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 na).__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 ye).__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()}},$e=class Xi{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 Xi).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+H),(e||new Xi).__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 se).__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 pi;(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"})(pi||(pi={}));let fe=class Rt{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 Rt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+H),(e||new Rt).__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):Qe.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):pi.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 it).__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,Qe.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,pi.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 Rt.startMessage(t),Rt.addVersion(t,e),Rt.addHeaderType(t,i),Rt.addHeader(t,r),Rt.addBodyLength(t,s),Rt.addCustomMetadata(t,o),Rt.endMessage(t)}};var Wl=ce;class Hl extends x{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Me.startNull(e),Me.endNull(e)}visitInt(t,e){return bt.startInt(e),bt.addBitWidth(e,t.bitWidth),bt.addIsSigned(e,t.isSigned),bt.endInt(e)}visitFloat(t,e){return zt.startFloatingPoint(e),zt.addPrecision(e,t.precision),zt.endFloatingPoint(e)}visitBinary(t,e){return De.startBinary(e),De.endBinary(e)}visitBool(t,e){return Fe.startBool(e),Fe.endBool(e)}visitUtf8(t,e){return Ne.startUtf8(e),Ne.endUtf8(e)}visitDecimal(t,e){return lt.startDecimal(e),lt.addScale(e,t.scale),lt.addPrecision(e,t.precision),lt.addBitWidth(e,t.bitWidth),lt.endDecimal(e)}visitDate(t,e){return Cn.startDate(e),Cn.addUnit(e,t.unit),Cn.endDate(e)}visitTime(t,e){return Dt.startTime(e),Dt.addUnit(e,t.unit),Dt.addBitWidth(e,t.bitWidth),Dt.endTime(e)}visitTimestamp(t,e){const i=t.timezone&&e.createString(t.timezone)||void 0;return Ft.startTimestamp(e),Ft.addUnit(e,t.unit),i!==void 0&&Ft.addTimezone(e,i),Ft.endTimestamp(e)}visitInterval(t,e){return Yt.startInterval(e),Yt.addUnit(e,t.unit),Yt.endInterval(e)}visitList(t,e){return Te.startList(e),Te.endList(e)}visitStruct(t,e){return Ee.startStruct_(e),Ee.endStruct_(e)}visitUnion(t,e){ut.startTypeIdsVector(e,t.typeIds.length);const i=ut.createTypeIdsVector(e,t.typeIds);return ut.startUnion(e),ut.addMode(e,t.mode),ut.addTypeIds(e,i),ut.endUnion(e)}visitDictionary(t,e){const i=this.visit(t.indices,e);return ae.startDictionaryEncoding(e),ae.addId(e,new Wl(t.id,0)),ae.addIsOrdered(e,t.isOrdered),i!==void 0&&ae.addIndexType(e,i),ae.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return $t.startFixedSizeBinary(e),$t.addByteWidth(e,t.byteWidth),$t.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Vt.startFixedSizeList(e),Vt.addListSize(e,t.listSize),Vt.endFixedSizeList(e)}visitMap(t,e){return Rn.startMap(e),Rn.addKeysSorted(e,t.keysSorted),Rn.endMap(e)}}const ki=new Hl;function Zl(n,t=new Map){return new V(ql(n,t),Pn(n.customMetadata),t)}function ra(n){return new wt(n.count,sa(n.columns),oa(n.columns))}function Gl(n){return new Kt(ra(n.data),n.id,n.isDelta)}function ql(n,t){return(n.fields||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function is(n,t){return(n.children||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function sa(n){return(n||[]).reduce((t,e)=>[...t,new Re(e.count,Kl(e.VALIDITY)),...sa(e.children)],[])}function oa(n,t=[]){for(let e=-1,i=(n||[]).length;++e<i;){const r=n[e];r.VALIDITY&&t.push(new Ht(t.length,r.VALIDITY.length)),r.TYPE&&t.push(new Ht(t.length,r.TYPE.length)),r.OFFSET&&t.push(new Ht(t.length,r.OFFSET.length)),r.DATA&&t.push(new Ht(t.length,r.DATA.length)),t=oa(r.children,t)}return t}function Kl(n){return(n||[]).reduce((t,e)=>t+ +(e===0),0)}function Jl(n,t){let e,i,r,s,o,a;return!t||!(s=n.dictionary)?(o=ss(n,is(n,t)),r=new G(n.name,o,n.nullable,Pn(n.customMetadata))):t.has(e=s.id)?(i=(i=s.indexType)?rs(i):new yn,a=new Je(t.get(e),i,e,s.isOrdered),r=new G(n.name,a,n.nullable,Pn(n.customMetadata))):(i=(i=s.indexType)?rs(i):new yn,t.set(e,o=ss(n,is(n,t))),a=new Je(o,i,e,s.isOrdered),r=new G(n.name,a,n.nullable,Pn(n.customMetadata))),r||null}function Pn(n){return new Map(Object.entries(n||{}))}function rs(n){return new _e(n.isSigned,n.bitWidth)}function ss(n,t){const e=n.type.name;switch(e){case"NONE":return new be;case"null":return new be;case"binary":return new Yn;case"utf8":return new Wn;case"bool":return new Hn;case"list":return new Jn((t||[])[0]);case"struct":return new st(t||[]);case"struct_":return new st(t||[])}switch(e){case"int":{const i=n.type;return new _e(i.isSigned,i.bitWidth)}case"floatingpoint":{const i=n.type;return new mn(dt[i.precision])}case"decimal":{const i=n.type;return new Zn(i.scale,i.precision,i.bitWidth)}case"date":{const i=n.type;return new Gn(ue[i.unit])}case"time":{const i=n.type;return new gn(U[i.unit],i.bitWidth)}case"timestamp":{const i=n.type;return new qn(U[i.unit],i.timezone)}case"interval":{const i=n.type;return new Kn(ge[i.unit])}case"union":{const i=n.type;return new Xn(vt[i.mode],i.typeIds||[],t||[])}case"fixedsizebinary":{const i=n.type;return new Qn(i.byteWidth)}case"fixedsizelist":{const i=n.type;return new ti(i.listSize,(t||[])[0])}case"map":{const i=n.type;return new ei((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Ce=ce,Xl=qo,Ql=Xe;class ot{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 ot(0,_t.V4,e);return i._createHeader=tu(t,e),i}static decode(t){t=new Ql(R(t));const e=fe.getRootAsMessage(t),i=e.bodyLength(),r=e.version(),s=e.headerType(),o=new ot(i,r,s);return o._createHeader=eu(e,s),o}static encode(t){const e=new Xl;let i=-1;return t.isSchema()?i=V.encode(e,t.header()):t.isRecordBatch()?i=wt.encode(e,t.header()):t.isDictionaryBatch()&&(i=Kt.encode(e,t.header())),fe.startMessage(e),fe.addVersion(e,_t.V4),fe.addHeader(e,i),fe.addHeaderType(e,t.headerType),fe.addBodyLength(e,new Ce(t.bodyLength,0)),fe.finishMessageBuffer(e,fe.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof V)return new ot(0,_t.V4,j.Schema,t);if(t instanceof wt)return new ot(e,_t.V4,j.RecordBatch,t);if(t instanceof Kt)return new ot(e,_t.V4,j.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===j.Schema}isRecordBatch(){return this.headerType===j.RecordBatch}isDictionaryBatch(){return this.headerType===j.DictionaryBatch}}class wt{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 Kt{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 Ht{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}}class Re{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 j.Schema:return V.fromJSON(n);case j.RecordBatch:return wt.fromJSON(n);case j.DictionaryBatch:return Kt.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${j[t]}, type: ${t} }`)})}function eu(n,t){return(()=>{switch(t){case j.Schema:return V.decode(n.header(new Ut));case j.RecordBatch:return wt.decode(n.header(new se),n.version());case j.DictionaryBatch:return Kt.decode(n.header(new $e),n.version())}throw new Error(`Unrecognized Message type: { name: ${j[t]}, type: ${t} }`)})}G.encode=du;G.decode=uu;G.fromJSON=Jl;V.encode=hu;V.decode=nu;V.fromJSON=Zl;wt.encode=fu;wt.decode=iu;wt.fromJSON=ra;Kt.encode=pu;Kt.decode=ru;Kt.fromJSON=Gl;Re.encode=yu;Re.decode=ou;Ht.encode=mu;Ht.decode=su;function nu(n,t=new Map){const e=lu(n,t);return new V(e,jn(n),t)}function iu(n,t=_t.V4){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new wt(n.length(),au(n),cu(n,t))}function ru(n,t=_t.V4){return new Kt(wt.decode(n.data(),t),n.id(),n.isDelta())}function su(n){return new Ht(n.offset(),n.length())}function ou(n){return new Re(n.length(),n.nullCount())}function au(n){const t=[];for(let e,i=-1,r=-1,s=n.nodesLength();++i<s;)(e=n.nodes(i))&&(t[++r]=Re.decode(e));return t}function cu(n,t){const e=[];for(let i,r=-1,s=-1,o=n.buffersLength();++r<o;)(i=n.buffers(r))&&(t<_t.V4&&(i.bb_pos+=8*(r+1)),e[++s]=Ht.decode(i));return e}function lu(n,t){const e=[];for(let i,r=-1,s=-1,o=n.fieldsLength();++r<o;)(i=n.fields(r))&&(e[++s]=G.decode(i,t));return e}function os(n,t){const e=[];for(let i,r=-1,s=-1,o=n.childrenLength();++r<o;)(i=n.children(r))&&(e[++s]=G.decode(i,t));return e}function uu(n,t){let e,i,r,s,o,a;return!t||!(a=n.dictionary())?(r=cs(n,os(n,t)),i=new G(n.name(),r,n.nullable(),jn(n))):t.has(e=a.id().low)?(s=(s=a.indexType())?as(s):new yn,o=new Je(t.get(e),s,e,a.isOrdered()),i=new G(n.name(),o,n.nullable(),jn(n))):(s=(s=a.indexType())?as(s):new yn,t.set(e,r=cs(n,os(n,t))),o=new Je(r,s,e,a.isOrdered()),i=new G(n.name(),o,n.nullable(),jn(n))),i||null}function jn(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 as(n){return new _e(n.isSigned(),n.bitWidth())}function cs(n,t){const e=n.typeType();switch(e){case K.NONE:return new be;case K.Null:return new be;case K.Binary:return new Yn;case K.Utf8:return new Wn;case K.Bool:return new Hn;case K.List:return new Jn((t||[])[0]);case K.Struct_:return new st(t||[])}switch(e){case K.Int:{const i=n.type(new bt);return new _e(i.isSigned(),i.bitWidth())}case K.FloatingPoint:{const i=n.type(new zt);return new mn(i.precision())}case K.Decimal:{const i=n.type(new lt);return new Zn(i.scale(),i.precision(),i.bitWidth())}case K.Date:{const i=n.type(new Cn);return new Gn(i.unit())}case K.Time:{const i=n.type(new Dt);return new gn(i.unit(),i.bitWidth())}case K.Timestamp:{const i=n.type(new Ft);return new qn(i.unit(),i.timezone())}case K.Interval:{const i=n.type(new Yt);return new Kn(i.unit())}case K.Union:{const i=n.type(new ut);return new Xn(i.mode(),i.typeIdsArray()||[],t||[])}case K.FixedSizeBinary:{const i=n.type(new $t);return new Qn(i.byteWidth())}case K.FixedSizeList:{const i=n.type(new Vt);return new ti(i.listSize(),(t||[])[0])}case K.Map:{const i=n.type(new Rn);return new ei((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${K[e]}" (${e})`)}function hu(n,t){const e=t.fields.map(s=>G.encode(n,s));Ut.startFieldsVector(n,e.length);const i=Ut.createFieldsVector(n,e),r=t.metadata&&t.metadata.size>0?Ut.createCustomMetadataVector(n,[...t.metadata].map(([s,o])=>{const a=n.createString(`${s}`),c=n.createString(`${o}`);return it.startKeyValue(n),it.addKey(n,a),it.addValue(n,c),it.endKeyValue(n)})):-1;return Ut.startSchema(n),Ut.addFields(n,i),Ut.addEndianness(n,gu?tn.Little:tn.Big),r!==-1&&Ut.addCustomMetadata(n,r),Ut.endSchema(n)}function du(n,t){let e=-1,i=-1,r=-1;const s=t.type;let o=t.typeId;v.isDictionary(s)?(o=s.dictionary.typeId,r=ki.visit(s,n),i=ki.visit(s.dictionary,n)):i=ki.visit(s,n);const a=(s.children||[]).map(u=>G.encode(n,u)),c=Bt.createChildrenVector(n,a),l=t.metadata&&t.metadata.size>0?Bt.createCustomMetadataVector(n,[...t.metadata].map(([u,f])=>{const m=n.createString(`${u}`),y=n.createString(`${f}`);return it.startKeyValue(n),it.addKey(n,m),it.addValue(n,y),it.endKeyValue(n)})):-1;return t.name&&(e=n.createString(t.name)),Bt.startField(n),Bt.addType(n,i),Bt.addTypeType(n,o),Bt.addChildren(n,c),Bt.addNullable(n,!!t.nullable),e!==-1&&Bt.addName(n,e),r!==-1&&Bt.addDictionary(n,r),l!==-1&&Bt.addCustomMetadata(n,l),Bt.endField(n)}function fu(n,t){const e=t.nodes||[],i=t.buffers||[];se.startNodesVector(n,e.length);for(const o of e.slice().reverse())Re.encode(n,o);const r=n.endVector();se.startBuffersVector(n,i.length);for(const o of i.slice().reverse())Ht.encode(n,o);const s=n.endVector();return se.startRecordBatch(n),se.addLength(n,new Ce(t.length,0)),se.addNodes(n,r),se.addBuffers(n,s),se.endRecordBatch(n)}function pu(n,t){const e=wt.encode(n,t.data);return $e.startDictionaryBatch(n),$e.addId(n,new Ce(t.id,0)),$e.addIsDelta(n,t.isDelta),$e.addData(n,e),$e.endDictionaryBatch(n)}function yu(n,t){return ia.createFieldNode(n,new Ce(t.length,0),new Ce(t.nullCount,0))}function mu(n,t){return na.createBuffer(n,new Ce(t.offset,0),new Ce(t.length,0))}const gu=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),Br=n=>`Expected ${j[n]} Message in stream, but was null or length 0.`,Ar=n=>`Header pointer of flatbuffer-encoded ${j[n]} Message is null or length 0.`,aa=(n,t)=>`Expected to read ${n} metadata bytes, but only read ${t}.`,ca=(n,t)=>`Expected to read ${n} bytes for message body, but only read ${t}.`;class la{constructor(t){this.source=t instanceof ui?t:new ui(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?J: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(Br(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=R(this.source.read(t));if(e.byteLength<t)throw new Error(ca(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=j.Schema,i=this.readMessage(e),r=i==null?void 0:i.header();if(t&&!r)throw new Error(Ar(e));return r}readMetadataLength(){const t=this.source.read(Si),e=t&&new Xe(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 J;if(e.byteLength<t)throw new Error(aa(t,e.byteLength));return{done:!1,value:ot.decode(e)}}}class bu{constructor(t,e){this.source=t instanceof nn?t:Ts(t)?new hi(t,e):new nn(t)}[Symbol.asyncIterator](){return this}next(){return _(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?J:t})}throw(t){return _(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return _(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return _(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(Br(t));return e.value})}readMessageBody(t){return _(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const e=R(yield this.source.read(t));if(e.byteLength<t)throw new Error(ca(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return _(this,void 0,void 0,function*(){const e=j.Schema,i=yield this.readMessage(e),r=i==null?void 0:i.header();if(t&&!r)throw new Error(Ar(e));return r})}readMetadataLength(){return _(this,void 0,void 0,function*(){const t=yield this.source.read(Si),e=t&&new Xe(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}})}readMetadata(t){return _(this,void 0,void 0,function*(){const e=yield this.source.read(t);if(!e)return J;if(e.byteLength<t)throw new Error(aa(t,e.byteLength));return{done:!1,value:ot.decode(e)}})}}class _u extends la{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ts?t:new ts(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ot.fromJSON(t.schema,j.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ot.fromJSON(e,j.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ot.fromJSON(e,j.RecordBatch)}}return this._body=[],J}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(Br(t));return e.value}readSchema(){const t=j.Schema,e=this.readMessage(t),i=e==null?void 0:e.header();if(!e||!i)throw new Error(Ar(t));return i}}const Si=4,Qi="ARROW1",_n=new Uint8Array(Qi.length);for(let n=0;n<Qi.length;n+=1)_n[n]=Qi.codePointAt(n);function Dr(n,t=0){for(let e=-1,i=_n.length;++e<i;)if(_n[e]!==n[t+e])return!1;return!0}const An=_n.length,ua=An+Si,vu=An*2+Si;class le extends _r{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 me(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 At.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return At.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 le?t:Vi(t)?Ou(t):Ts(t)?Du(t):me(t)?_(this,void 0,void 0,function*(){return yield le.from(yield t)}):Ms(t)||sr(t)||Es(t)||sn(t)?Au(new nn(t)):Bu(new ui(t))}static readAll(t){return t instanceof le?t.isSync()?ls(t):us(t):Vi(t)||ArrayBuffer.isView(t)||Sn(t)||Fs(t)?ls(t):us(t)}}class yi extends le{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Wt(this,arguments,function*(){yield M(yield*Ln(xe(this[Symbol.iterator]())))})}}class mi extends le{constructor(t){super(t),this._impl=t}readAll(){var t,e;return _(this,void 0,void 0,function*(){const i=new Array;try{for(var r=xe(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 ha extends yi{constructor(t){super(t),this._impl=t}}class wu extends mi{constructor(t){super(t),this._impl=t}}class da{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=N({type:new st(this.schema.fields),length:t.length,children:i});return new ht(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),l=this._loadVectors(t.data,e,[c]);return(a&&r?a.concat(new $(l)):new $(l)).memoize()}return a.memoize()}_loadVectors(t,e,i){return new Xo(e,t.nodes,t.buffers,this.dictionaries).visitMany(i)}}class gi extends da{constructor(t,e){super(e),this._reader=Vi(t)?new _u(this._handle=t):new la(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=pa(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):J}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):J}next(){if(this.closed)return J;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 Or(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class bi extends da{constructor(t,e){super(e),this._reader=new bu(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return _(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 _(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=pa(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return _(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):J})}return(t){return _(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):J})}next(){return _(this,void 0,void 0,function*(){if(this.closed)return J;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 Or(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return _(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class fa extends gi{constructor(t,e){super(t instanceof es?t:new es(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(j.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(j.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-ua,i=t.readInt32(e),r=t.readAt(e-i,i);return bn.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 Su extends bi{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 hi?t:new hi(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 _(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 _(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(j.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 _(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(j.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 _(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-ua,i=yield t.readInt32(e),r=yield t.readAt(e-i,i);return bn.decode(r)})}_readNextMessageAndValidate(t){return _(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 Iu extends gi{constructor(t,e){super(t,e)}_loadVectors(t,e,i){return new Cl(e,t.nodes,t.buffers,this.dictionaries).visitMany(i)}}function pa(n,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:n.autoDestroy}function*ls(n){const t=le.from(n);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function us(n){return Wt(this,arguments,function*(){const e=yield M(le.from(n));try{if(!(yield M(e.open({autoDestroy:!1}))).closed)do yield yield M(e);while(!(yield M(e.reset().open())).closed)}finally{yield M(e.cancel())}})}function Ou(n){return new yi(new Iu(n))}function Bu(n){const t=n.peek(An+7&-8);return t&&t.byteLength>=4?Dr(t)?new ha(new fa(n.read())):new yi(new gi(n)):new yi(new gi((function*(){})()))}function Au(n){return _(this,void 0,void 0,function*(){const t=yield n.peek(An+7&-8);return t&&t.byteLength>=4?Dr(t)?new ha(new fa(yield n.read())):new mi(new bi(n)):new mi(new bi((function(){return Wt(this,arguments,function*(){})})()))})}function Du(n){return _(this,void 0,void 0,function*(){const{size:t}=yield n.stat(),e=new hi(n,t);return t>=vu&&Dr(yield e.readAt(0,An+7&-8))?new wu(new Su(e)):new mi(new bi(e))})}class tt extends x{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 ht?s.data.children:s.data),i=new tt;return i.visitMany(e(t)),i}visit(t){if(t instanceof $)return this.visitMany(t.data),this;const{type:e}=t;if(!v.isDictionary(e)){const{length:i,nullCount:r}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");v.isNull(e)||Nt.call(this,r<=0?new Uint8Array(0):pr(t.offset,i,t.nullBitmap)),this.nodes.push(new Re(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 Nt(n){const t=n.byteLength+7&-8;return this.buffers.push(n),this.bufferRegions.push(new Ht(this._byteLength,t)),this._byteLength+=t,this}function Fu(n){const{type:t,length:e,typeIds:i,valueOffsets:r}=n;if(Nt.call(this,i),t.mode===vt.Sparse)return tr.call(this,n);if(t.mode===vt.Dense){if(n.offset<=0)return Nt.call(this,r),tr.call(this,n);{const s=i.reduce((u,f)=>Math.max(u,f),i[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),c=new Int32Array(e),l=ar(-r[0],e,r);for(let u,f,m=-1;++m<e;)(f=a[u=i[m]])===-1&&(f=a[u]=l[u]),c[m]=l[m]-f,++o[u];Nt.call(this,c);for(let u,f=-1,m=t.children.length;++f<m;)if(u=n.children[f]){const y=t.typeIds[f],b=Math.min(e,o[y]);this.visit(u.slice(a[y],b))}}}return this}function Tu(n){let t;return n.nullCount>=n.length?Nt.call(this,new Uint8Array(0)):(t=n.values)instanceof Uint8Array?Nt.call(this,pr(n.offset,n.length,t)):Nt.call(this,ni(n.values))}function Be(n){return Nt.call(this,n.values.subarray(0,n.length*n.stride))}function ya(n){const{length:t,values:e,valueOffsets:i}=n,r=i[0],s=i[t],o=Math.min(s-r,e.byteLength-r);return Nt.call(this,ar(-i[0],t,i)),Nt.call(this,e.subarray(r,r+o)),this}function Fr(n){const{length:t,valueOffsets:e}=n;return e&&Nt.call(this,ar(e[0],t,e)),this.visit(n.children[0])}function tr(n){return this.visitMany(n.type.children.map((t,e)=>n.children[e]).filter(Boolean))[0]}tt.prototype.visitBool=Tu;tt.prototype.visitInt=Be;tt.prototype.visitFloat=Be;tt.prototype.visitUtf8=ya;tt.prototype.visitBinary=ya;tt.prototype.visitFixedSizeBinary=Be;tt.prototype.visitDate=Be;tt.prototype.visitTimestamp=Be;tt.prototype.visitTime=Be;tt.prototype.visitDecimal=Be;tt.prototype.visitList=Fr;tt.prototype.visitStruct=tr;tt.prototype.visitUnion=Fu;tt.prototype.visitInterval=Be;tt.prototype.visitFixedSizeList=Fr;tt.prototype.visitMap=Fr;class ma extends _r{constructor(t){super(),this._position=0,this._started=!1,this._sink=new kn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,ft(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 me(t)?t.then(e=>this.writeAll(e)):sn(t)?Nr(this,t):Er(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 kn?this._sink=t:(this._sink=new kn,t&&Ka(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Ja(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||!Ki(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 rt&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof ht&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!Ki(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof ht?t instanceof Or||this._writeRecordBatch(t):t instanceof rt?this.writeAll(t.batches):Sn(t)&&this.writeAll(t)}_writeMessage(t,e=8){const i=e-1,r=ot.encode(t),s=r.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+i&~i,c=a-s-o;return t.headerType===j.RecordBatch?this._recordBatchBlocks.push(new ve(a,t.bodyLength,this._position)):t.headerType===j.DictionaryBatch&&this._dictionaryBlocks.push(new ve(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=R(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ot.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(_n)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:i,bufferRegions:r,buffers:s}=tt.assemble(t),o=new wt(t.numRows,i,r),a=ot.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}=tt.assemble(new $([t])),c=new wt(t.length,s,o),l=new Kt(c,e,i),u=ot.from(l,r);return this._writeMessage(u)._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 Tr extends ma{static writeAll(t,e){const i=new Tr(e);return me(t)?t.then(r=>i.writeAll(r)):sn(t)?Nr(i,t):Er(i,t)}}class Mr extends ma{static writeAll(t){const e=new Mr;return me(t)?t.then(i=>e.writeAll(i)):sn(t)?Nr(e,t):Er(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const e=bn.encode(new bn(t,_t.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function Er(n,t){let e=t;t instanceof rt&&(e=t.batches,n.reset(void 0,t.schema));for(const i of e)n.write(i);return n.finish()}function Nr(n,t){var e,i,r,s;return _(this,void 0,void 0,function*(){try{for(e=xe(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 ln(n){const t=le.from(n);return me(t)?t.then(e=>ln(e)):t.isAsync()?t.readAll().then(e=>new rt(e)):new rt(t.readAll())}function Pi(n,t="stream"){return(t==="stream"?Tr:Mr).writeAll(n).toUint8Array(!0)}var hs=(function(){function n(t,e,i,r){var s=this;this.getCell=function(o,a){var c=o<s.headerRows&&a<s.headerColumns,l=o>=s.headerRows&&a<s.headerColumns,u=o<s.headerRows&&a>=s.headerColumns;if(c){var f=["blank"];return a>0&&f.push("level"+o),{type:"blank",classNames:f.join(" "),content:""}}else if(u){var m=a-s.headerColumns,f=["col_heading","level"+o,"col"+m];return{type:"columns",classNames:f.join(" "),content:s.getContent(s.columnsTable,m,o)}}else if(l){var y=o-s.headerRows,f=["row_heading","level"+a,"row"+y];return{type:"index",id:"T_".concat(s.uuid,"level").concat(a,"_row").concat(y),classNames:f.join(" "),content:s.getContent(s.indexTable,y,a)}}else{var y=o-s.headerRows,m=a-s.headerColumns,f=["data","row"+y,"col"+m],b=s.styler?s.getContent(s.styler.displayValuesTable,y,m):s.getContent(s.dataTable,y,m);return{type:"data",id:"T_".concat(s.uuid,"row").concat(y,"_col").concat(m),classNames:f.join(" "),content:b}}},this.getContent=function(o,a,c){var l=o.getChildAt(c);if(l===null)return"";var u=s.getColumnTypeId(o,c);switch(u){case h.Timestamp:return s.nanosToDate(l.get(a));default:return l.get(a)}},this.dataTable=ln(t),this.indexTable=ln(e),this.columnsTable=ln(i),this.styler=r?{caption:r.caption,displayValuesTable:ln(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})(),hn=function(){return hn=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},hn.apply(this,arguments)},dn;(function(n){n.COMPONENT_READY="streamlit:componentReady",n.SET_COMPONENT_VALUE="streamlit:setComponentValue",n.SET_FRAME_HEIGHT="streamlit:setFrameHeight"})(dn||(dn={}));var Se=(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(dn.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(dn.SET_FRAME_HEIGHT,{height:t}))},n.setComponentValue=function(t){var e;t instanceof hs?(e="dataframe",t=t.serialize()):Eu(t)?(e="bytes",t=new Uint8Array(t.buffer)):t instanceof ArrayBuffer?(e="bytes",t=new Uint8Array(t)):e="json",n.sendBackMsg(dn.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=hn(hn({},e),i);var r=!!t.disabled,s=t.theme;s&&Mu(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 hs(i,r,s,o)},n.sendBackMsg=function(t,e){window.parent.postMessage(hn({isStreamlitMessage:!0,type:t},e),"*")},n})(),Mu=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 Eu(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 Nu=(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){Nu(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.componentDidMount=function(){Se.setFrameHeight()},t.prototype.componentDidUpdate=function(){Se.setFrameHeight()},t})(Wa.PureComponent);let ga=class{constructor(t){this.cache={node:t}}isUINode(){return!0}get node(){return this.cache.node}};function xu(n){const t={};return n.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,e=>{const[i,r]=e.split("=");t[i]=r}),t}function Lu(n){Object.defineProperties(n,{QueryParams:{get:function(){return xu(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}})}let ba=class extends Array{constructor(...t){super(...t)}clear(){return this.length=0,this}getItemById(t){return this.find(e=>e.element.id===t)}getItemsByTagName(t){return this.filter(e=>e.element.tagName.toLowerCase()===t.toLowerCase())}getElementsByClassName(t){return this.filter(e=>{var i;return(i=e.element.classList)==null?void 0:i.contains(t)})}querySelector(t){var i;const e=(i=globalThis==null?void 0:globalThis.document)==null?void 0:i.querySelector(t);return e&&this.find(r=>r.element===e)||null}querySelectorAll(t){var i;const e=(i=globalThis==null?void 0:globalThis.document)==null?void 0:i.querySelectorAll(t);return Array.from(e).map(r=>this.find(s=>s.element===r)).filter(Boolean)}};const Cu=new ba,Ru={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(n){const t=Object.keys(n),e=Object.values(n);for(let i=0;i<t.length;i++)this.default[t[i]]=e[i]},init:()=>{},renderingMode:"spa",isSSC:!1},Uu={store:new Map,index:0,register:function(n){this.store.set(this.index++,n)},reset(){this.index=0,this.store.clear()}},ku={ui_index:0,get_ui_index:function(){return this.ui_index++},register_ui:function(n){}};var Pu={store:new Map,index:0,session_storage:null,register:function(n){this.store.set(this.index++,n)},update:function(n,t){}};function _a(){globalThis!=null&&globalThis.__Ziko__||(globalThis.__Ziko__={__UI__:Cu,__HYDRATION__:Uu,__State__:Pu,__Config__:Ru,__CACHE__:ku,__PROVIDERS__:{}},Lu(__Ziko__))}_a();let ju=class extends ga{constructor(){super()}init(t,e,i,r){var s,o,a,c,l;if(this.target=globalThis.__Ziko__.__Config__.default.target||((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body),typeof t=="string")switch(i){case"html":t=(o=globalThis==null?void 0:globalThis.document)==null?void 0:o.createElement(t);break;case"svg":t=(a=globalThis==null?void 0:globalThis.document)==null?void 0:a.createElementNS("http://www.w3.org/2000/svg",t);break;default:throw Error("Not supported")}else this.target=t==null?void 0:t.parentElement;Object.assign(this.cache,{name:e,isInteractive:!1,parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,attributes:{},filters:{},temp:{}}),this.events={ptr:null,mouse:null,wheel:null,key:null,drag:null,drop:null,click:null,clipboard:null,focus:null,swipe:null,custom:null},this.observer={resize:null,intersection:null},t&&Object.assign(this.cache,{element:t}),this.items=new ba,globalThis.__Ziko__.__UI__[this.cache.name]?(c=globalThis.__Ziko__.__UI__[this.cache.name])==null||c.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&r&&((l=this==null?void 0:this.render)==null||l.call(this)),globalThis.__Ziko__.__UI__.push(this)}get element(){return this.cache.element}[Symbol.iterator](){return this.items[Symbol.iterator]()}maintain(){for(let t=0;t<this.items.length;t++)Object.defineProperty(this,t,{value:this.items[t],writable:!0,configurable:!0,enumerable:!1})}isInteractive(){return this.cache.isInteractive}isUIElement(){return!0}};function $u(n,...t){t.forEach(e=>Vu(n,e))}function Vu(n,t){const e=Object.getOwnPropertyDescriptors(t);for(const i of Reflect.ownKeys(e)){const r=e[i];"get"in r||"set"in r||typeof r.value!="function"?Object.defineProperty(Object.getPrototypeOf(n),i,r):typeof r.value=="function"&&(Object.getPrototypeOf(n).hasOwnProperty(i)||Object.defineProperty(Object.getPrototypeOf(n),i,r))}}function zu(n=this.target,t=0){var e;return t>0?(setTimeout(()=>this.mount(n,0),t),this):this.isBody?this:(n!=null&&n.isUIElement&&(n=n.element),this.target=n,(e=this.target)==null||e.appendChild(this.element),this)}function Yu(n=0){var t,e;return n>0?(setTimeout(()=>this.unmount(0),n),this):(this.cache.parent?this.cache.parent.remove(this):(e=(t=this.target)==null?void 0:t.children)!=null&&e.length&&[...this.target.children].includes(this.element)&&this.target.removeChild(this.element),this)}const Wu=Object.freeze(Object.defineProperty({__proto__:null,mount:zu,unmount:Yu},Symbol.toStringTag,{value:"Module"}));globalThis.__Ziko__||_a();const va=n=>{var t,e;return typeof n=="function"&&((e=(t=n==null?void 0:n())==null?void 0:t.isStateGetter)==null?void 0:e.call(t))},Hu=(n="")=>n.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),Zu=(n="")=>n.length===0?!1:/^[a-z][a-zA-Z0-9]*$/.test(n);let Gu=class extends ga{constructor(...t){var e;super("span","text",!1,...t),this.element=(e=globalThis==null?void 0:globalThis.document)==null?void 0:e.createTextNode(...t)}isText(){return!0}};const er=(...n)=>new Gu(...n);async function qu(n,t,...e){var i,r,s,o,a,c;if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let l=0;l<e.length;l++){if(["number","string"].includes(typeof e[l])&&(e[l]=er(e[l])),e[l]instanceof Function){const u=e[l]();u.isStateGetter&&(e[l]=er(u.value),u._subscribe(f=>e[l].element.textContent=f,e[l]))}if(typeof(globalThis==null?void 0:globalThis.Node)=="function"&&e[l]instanceof(globalThis==null?void 0:globalThis.Node)&&(e[l]=new this.constructor(e[l])),(i=e[l])!=null&&i.isUINode)e[l].cache.parent=this,(r=this.element)==null||r[n](e[l].element),e[l].target=this.element,this.items[t](e[l]);else if(e[l]instanceof Promise){const u=await e[l];u.cache.parent=this,(s=this.element)==null||s[n](u.element),u.target=this.element,this.items[t](u)}else e[l]instanceof Object&&((o=e[l])!=null&&o.style&&this.style((a=e[l])==null?void 0:a.style),(c=e[l])!=null&&c.attr&&Object.entries(e[l].attr).forEach(u=>this.setAttr(""+u[0],u[1])))}return this.maintain(),this}function ds(n,t){var e;globalThis.SVGAElement&&this.element instanceof globalThis.SVGAElement&&(n=Zu(n)?Hu(n):n),!(this!=null&&this.attr[n]&&(this==null?void 0:this.attr[n])===t)&&(va(t)?t()._subscribe(r=>{var s;return(s=this.element)==null?void 0:s.setAttribute(n,r)},this):(e=this.element)==null||e.setAttribute(n,t),Object.assign(this.cache.attributes,{[n]:t}))}function Ku(n,t){if(n instanceof Object){const[e,i]=[Object.keys(n),Object.values(n)];for(let r=0;r<e.length;r++)i[r]instanceof Array&&(t[r]=i[r].join(" ")),ds.call(this,e[r],i[r])}else t instanceof Array&&(t=t.join(" ")),ds.call(this,n,t);return this}function Ju(...n){var t;for(let e=0;e<n.length;e++)(t=this.element)==null||t.removeAttribute(n[e]);return this}function Xu(n){return n=is_camelcase(n)?camel2hyphencase(n):n,this.element.attributes[n].value}function Qu(n=!0){return this.setAttr("contenteditable",n),this}const th=Object.freeze(Object.defineProperty({__proto__:null,getAttr:Xu,removeAttr:Ju,setAttr:Ku,setContentEditable:Qu},Symbol.toStringTag,{value:"Module"}));function eh(...n){return qu.call(this,"append","push",...n),this}function nh(...n){return this.__addItem__.call(this,"prepend","unshift",...n),this}function ih(n,...t){var e;if(n>=this.element.children.length)this.append(...t);else for(let i=0;i<t.length;i++)["number","string"].includes(typeof t[i])&&(t[i]=er(t[i])),(e=this.element)==null||e.insertBefore(t[i].element,this.items[n].element),this.items.splice(n,0,t[i]);return this}function rh(...n){const t=e=>{var i;typeof e=="number"&&(e=this.items[e]),e!=null&&e.isUIElement&&((i=this.element)==null||i.removeChild(e.element)),this.items=this.items.filter(r=>r!==e)};for(let e=0;e<n.length;e++)t(n[e]);for(let e=0;e<this.items.length;e++)Object.assign(this,{[[e]]:this.items[e]});return this}function sh(){var n;return(n=this==null?void 0:this.items)==null||n.forEach(t=>t.unmount()),this.element.innerHTML="",this}function oh(n){return this.cache.element.replaceWith(n),this.cache.element=n,this}function ah(n){var t;return n!=null&&n.isUIElement&&(n=n.element),(t=this.element)==null||t.after(n),this}function ch(n){var t;return n!=null&&n.isUIElement&&(n=n.element),(t=this.element)==null||t.before(n),this}const lh=Object.freeze(Object.defineProperty({__proto__:null,after:ah,append:eh,before:ch,clear:sh,insertAt:ih,prepend:nh,remove:rh,replaceElementWith:oh},Symbol.toStringTag,{value:"Module"})),Lt={Click:["Click","DblClick","ClickAway"],Ptr:["PtrMove","PtrDown","PtrUp","PtrLeave","PtrEnter","PtrOut","PtrCancel"],Mouse:["MouseMove","MouseDown","MouseUp","MouseEnter","MouseLeave","MouseOut"],Key:["KeyDown","KeyPress","KeyUp"],Clipboard:["Copy","Cut","Paste"],Focus:["focus","blur"],Drag:["Drag","DragStart","DragEnd","Drop"],Wheel:["Wheel"],View:["EnterView","ExitView","ResizeView"],Swipe:["SwipeLeft","SwipeUp","SwipeRight","SwipeDown"]};function uh(n,t,e,i){var r,s;this.cache.currentEvent=t,this.cache.event=n,e==null||e.call(this),i!=null&&i.hasOwnProperty("prototype")?i==null||i.call(this):i==null||i.call(null,this),this.cache.preventDefault[t]&&n.preventDefault(),this.cache.stopPropagation[t]&&n.stopPropagation(),this.cache.stopImmediatePropagation[t]&&n.stopImmediatePropagation(),(s=(r=this.cache.callbacks)[t])==null||s.call(r,this)}function fs(n,...t){return(t.length===0?Object.keys(this.cache.paused):t).forEach(i=>{var r;this.cache.paused.hasOwnProperty(i)&&((r=this.targetElement)==null||r[n](i,this.cache.__controllers__[i],this.cache.options[i]),this.cache.paused[i]=n==="removeEventListener")}),this}const ps=(n="")=>n.startsWith("Ptr")?`pointer${n.split("Ptr")[1].toLowerCase()}`:n.toLowerCase();var qe,$n,As;let Jt=(As=class{constructor(t,e=null,i=[],r,s){Tn(this,qe);this.target=e,this.cache={signature:t,currentEvent:null,event:null,options:{},preventDefault:{},stopPropagation:{},stopImmediatePropagation:{},paused:{},callbacks:{},__controllers__:{}},i&&this._register_events(i,r,s)}_register_events(t,e,i,r=!0){const s=t==null?void 0:t.map(o=>ps(o));return s==null||s.forEach((o,a)=>{this.cache.preventDefault[o]=!1,this.cache.options[o]={},this.cache.paused[o]=!1,this.cache.__controllers__[o]=c=>uh.call(this,c,o,e,i),r&&(this[`on${t[a]}`]=c=>this.__onEvent(o,this.cache.options[o],{},c))}),this}__onEvent(t,e,i,r){return r?(this.cache.callbacks[t]=r,this.__handle(t,this.cache.__controllers__[t],e,i),this):this}get targetElement(){var t;return(t=this.target)==null?void 0:t.element}get isParent(){var t,e;return((t=this.target)==null?void 0:t.element)===((e=this.event)==null?void 0:e.srcElement)}get item(){var t;return(t=this.target.find(e=>{var i;return e.element==((i=this.event)==null?void 0:i.srcElement)}))==null?void 0:t[0]}get currentEvent(){return this.cache.currentEvent}get event(){return this.cache.event}get detail(){return this.cache.event.detail}setTarget(t){return this.target=t,this}__handle(t,e,i){var r;return(r=this.targetElement)==null||r.addEventListener(t,e,i),this}preventDefault(...t){return Ot(this,qe,$n).call(this,"preventDefault",...t)}stopPropagation(...t){return Ot(this,qe,$n).call(this,"stopPropagation",...t)}stopImmediatePropagation(...t){return Ot(this,qe,$n).call(this,"stopImmediatePropagation",...t)}setEventOptions(t,e){const i=ps(t);return this.pause(),Object.assign(this.cache.options[i],e),this.resume(),this}pause(...t){return fs.call(this,"removeEventListener",...t)}resume(...t){return fs.call(this,"addEventListener",...t)}dispose(){return this.pause(),this.target.events[this.cache.signature]=null,this}},qe=new WeakSet,$n=function(t,...e){return(e.length===0?Object.keys(this.cache[t]):e).forEach(r=>{this.cache[t].hasOwnProperty(r)&&(this.cache[t][r]=!0)}),this},As);function hh(){switch(this.currentEvent){case"keydown":this.kd=this.event.key;break;case"keypress":this.kp=this.event.key;break;case"keyup":this.ku=this.event.key;break}}function dh(){const n=this.targetElement.getBoundingClientRect(),t=this.event;let e=t.clientX-n.left|0,i=t.clientY-n.top|0;if(this.cache.useNormalisedCoordinates){const r=this.targetElement.clientWidth,s=this.targetElement.clientHeight;e=+(e/r*2-1).toFixed(8),i=+(i/s*-2+1).toFixed(8)}switch(this.currentEvent){case"pointerdown":this.dx=e,this.dy=i,this.isDown=!0;break;case"pointermove":this.mx=e,this.my=i,this.isMoving=!0;break;case"pointerup":this.ux=e,this.uy=i,this.isDown=!1,this.isMoving=!1;break}}function fh(){const n=this.targetElement.getBoundingClientRect(),t=this.event;let e=t.clientX-n.left|0,i=t.clientY-n.top|0;if(this.cache.useNormalisedCoordinates){const r=this.targetElement.clientWidth,s=this.targetElement.clientHeight;e=+(e/r*2-1).toFixed(8),i=+(i/s*-2+1).toFixed(8)}switch(this.currentEvent){case"mousedown":this.dx=e,this.dy=i,this.isDown=!0;break;case"mousemove":this.mx=e,this.my=i,this.isMoving=!0;break;case"mouserup":this.ux=e,this.uy=i,this.isDown=!1,this.isMoving=!1;break}}let wa=class extends Jt{constructor(t,e=null,i=[],r,s){super(t,e,i,r,s),Object.assign(this.cache,{useNormalisedCoordinates:!1}),this.isDown=!1,this.isMoving=!1,this.dx=0,this.dy=0,this.mx=0,this.my=0,this.ux=0,this.uy=0}get isDragging(){return this.isDown&&this.isMoving}useNormalisedCoordinates(t=!0){return this.cache.useNormalisedCoordinates=t,this}},ph=class extends Event{constructor(t,e){super("clickaway",{bubbles:!0,cancelable:!0}),this.originalEvent=t,this.targetElement=e}};function yh(n){var e;function t(i){if(!n.contains(i.target)){const r=new ph(i,n);n.dispatchEvent(r)}}return(e=globalThis==null?void 0:globalThis.document)==null||e.addEventListener("click",t),()=>{var i;return(i=globalThis==null?void 0:globalThis.document)==null?void 0:i.removeEventListener("click",t)}}const nr=(n,t)=>{let e=0;return(...i)=>{const r=new Date().getTime();r-e<t||(e=r,n(...i))}};let ys=class extends CustomEvent{constructor(t,e,{bubbles:i=!0,cancelable:r=!0}={}){super(t,{detail:e,bubbles:i,cancelable:r})}};function mh(n,{intersection:t=!0,resize:e=!0,threshold:i=0,throttleResize:r=100,throttleEnterExit:s=0}={}){let o,a;const c=m=>{for(let y of m){const{width:b,height:C}=y.contentRect;n.dispatchEvent(new ys("resizeview",{width:b,height:C,entry:y}))}},l=r>0?nr(c,r):c,u=m=>{for(let y of m){const b=y.isIntersecting?"enterview":"exitview";n.dispatchEvent(new ys(b,y))}},f=s>0?nr(u,s):u;return t&&(o=new IntersectionObserver(f,{threshold:i}),o.observe(n)),e&&(a=new ResizeObserver(l),a.observe(n)),()=>{o&&(o.unobserve(n),o.disconnect()),a&&(a.unobserve(n),a.disconnect())}}let gh=class extends CustomEvent{constructor(t,e){super(t,{detail:e,bubbles:!0,cancelable:!0})}};function bh(n,t=50,e=100,i=500){let r=0,s=0,o=0,a=!1;function c(u){r=u.clientX,s=u.clientY,o=performance.now(),a=!0}function l(u){if(!a)return;a=!1;const f=u.clientX-r,m=u.clientY-s,y=performance.now()-o;let b=null,C=null;y<=i&&(Math.abs(f)>=t&&Math.abs(m)<=e?(b=f<0?"left":"right",C="swipe"+b):Math.abs(m)>=t&&Math.abs(f)<=e&&(b=m<0?"up":"down",C="swipe"+b)),C&&n.dispatchEvent(new gh(C,{direction:b,distX:f,distY:m,originalEvent:u}))}return n.addEventListener("pointerdown",c,{passive:!0}),n.addEventListener("pointerup",l,{passive:!0}),()=>{n.removeEventListener("pointerdown",c),n.removeEventListener("pointerup",l)}}const _h=(n,t)=>(yh(n.element),new Jt("click",n,Lt.Click,null,t)),vh=(n,t)=>new Jt("clipboard",n,Lt.Clipboard,null,t),wh=(n,t)=>new Jt("drag",n,Lt.Drag,null,t),Sh=(n,t)=>new Jt("focus",n,Lt.Focus,null,t),Ih=(n,t)=>new Jt("key",n,Lt.Key,hh,t),Oh=(n,t)=>new wa("mouse",n,Lt.Mouse,fh,t),Bh=(n,t)=>new wa("ptr",n,Lt.Ptr,dh,t),Ah=(n,t)=>new Jt("wheel",n,Lt.Wheel,null,t),Dh=(n,t)=>(mh(n.element),new Jt("view",n,Lt.View,null,t)),Fh=(n,t)=>(bh(n.element),new Jt("swipe",n,Lt.Swipe,null,t));let Th=class extends Jt{constructor(t,e,i){super("custom",t,e,Mh,i)}_register_events(t){return super._register_events(t,null,null,!1),this}emit(t,e={}){const i=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return this.targetElement.dispatchEvent(i),this}on(t,...e){return this.cache.options.hasOwnProperty(t)||this._register_events([t]),this.__onEvent(t,this.cache.options[t],{},...e),this}};function Mh(){}const ms=(n,t,e)=>new Th(n,t,e),Eh={ptr:Bh,mouse:Oh,key:Ih,click:_h,drag:wh,clipboard:vh,focus:Sh,wheel:Ah,view:Dh,swipe:Fh},Sa={on(n,...t){return this.events.custom||(this.events.custom=ms(this)),this.events.custom.on(n,...t),this},emit(n,t={}){return this.events.custom||(this.events.custom=ms(this)),this.events.custom.emit(n,t),this}};Object.entries(Lt).forEach(([n,t])=>{const e=n.toLowerCase();t.forEach(i=>{const r=`on${i}`;Sa[r]=function(s){return this.events[e]||(this.events[e]=Eh[e](this)),this.events[e][r](s),this}})});function Nh(n){return this.items.at(n)}function xh(n){return this.items.forEach(n),this}function Lh(n){return this.items.map(n)}function Ch(n){return this.items.filter(n)}const Rh=Object.freeze(Object.defineProperty({__proto__:null,at:Nh,find:Ch,forEach:xh,map:Lh},Symbol.toStringTag,{value:"Module"}));function Uh(n){var t;if(!((t=this.element)!=null&&t.style))return this;for(let e in n){const i=n[e];if(va(i)){const r=i();Object.assign(this.element.style,{[e]:r.value}),r._subscribe(s=>{console.log({newValue:s}),Object.assign(this.element.style,{[e]:s})})}else Object.assign(this.element.style,{[e]:i})}return this}function kh(n,t){return this.style({width:n,height:t})}function Ph(){}function jh(){}function $h(n,{duration:t=1e3,iterations:e=1,easing:i="ease"}={}){var r;return(r=this.element)==null||r.animate(n,{duration:t,iterations:e,easing:i}),this}const Vh=Object.freeze(Object.defineProperty({__proto__:null,animate:$h,hide:Ph,show:jh,size:kh,style:Uh},Symbol.toStringTag,{value:"Module"}));class zh{constructor(t,e){this.cache={category:e,target:t,listeners:{},currentEvent:null}}get element(){return this.cache.target.element}get currentEvent(){return this.cache.currentEvent}addListener(t,e){return this.cache.listeners[t]={paused:!1,callback:()=>{this.cache.listeners[t].paused||(this.cache.currentEvent=t,e.call(this,this))}},this.element.addEventListener(t,this.cache.listeners[t].callback),this}removeListener(t){return this.element.removeEventListener(t,this.cache.listeners[t].callback),this}pause(t){return this.cache.listeners[t].paused=!0,this}resume(t){return this.cache.listeners[t].paused=!1,this}}let ze=class extends ju{constructor({element:t,name:e="",type:i="html",render:r=__Ziko__.__Config__.default.render}={}){super(),this.exp={events:{}},$u(this,Wu,th,lh,Vh,Rh,Sa),t&&this.init(t,e,i,r)}_on(t,e,{details_setter:i,category:r="global"}={}){r&&!this.exp.events.hasOwnProperty(r)&&(this.exp.events[r]=new zh(this,r));const s=this.exp.events[r];s.addListener(t,e),i&&i.call(s)}_off(t,e="global"){this.exp.events[e].removeListener(t)}get element(){return this.cache.element}isInteractive(){return this.cache.isInteractive}useClient(t){return this.cache.isInteractive||(this.element.setAttribute("data-hydration-index",globalThis.__Ziko__.__HYDRATION__.index),globalThis.__Ziko__.__HYDRATION__.register(()=>this),this.cache.isInteractive=!0),t&&this.element.setAttribute("data-hydration-directive",t),this}get st(){return this.cache.style}get attr(){return this.cache.attributes}get evt(){return this.events}get html(){return this.element.innerHTML}get text(){return this.element.textContent}get isBody(){return this.element===(globalThis==null?void 0:globalThis.document.body)}get parent(){return this.cache.parent}get width(){return this.element.getBoundingClientRect().width}get height(){return this.element.getBoundingClientRect().height}get top(){return this.element.getBoundingClientRect().top}get right(){return this.element.getBoundingClientRect().right}get bottom(){return this.element.getBoundingClientRect().bottom}get left(){return this.element.getBoundingClientRect().left}};const Yh=n=>(...t)=>{var r;const e=t[0];return((r=e==null?void 0:e.isUIElement)==null?void 0:r.call(e))||Wh(e)?new n({},...t):new n(e,...t.slice(1))};function Wh(n){return typeof n!="object"&&typeof n!="function"||n===null}const Hh=["a","abb","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","ipnut","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],Zh=["svg","g","defs","symbol","use","image","switch","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","textPath","altGlyph","altGlyphDef","altGlyphItem","glyph","glyphRef","linearGradient","radialGradient","pattern","solidColor","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncR","feFuncG","feFuncB","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","script","desc","title","metadata","foreignObject"],Gh=["math","annotation","merror","mfrac","mi","mprescripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"],qh=new Proxy({},{get(n,t){if(typeof t!="string")return;let e=t.replaceAll("_","-").toLowerCase(),i;return Hh.includes(e)&&(i="html"),Zh.includes(e)&&(i="svg"),Gh.includes(e)&&(i="mathml"),(...r)=>r.length===0?new ze({element:e,name:e,type:i}):["string","number"].includes(typeof r[0])||r[0]instanceof ze||typeof r[0]=="function"&&r[0]().isStateGetter()?new ze({element:e,name:e,type:i}).append(...r):new ze({element:e,type:i}).setAttr(r.shift()).append(...r)}});class Ia{constructor(t){this.cache={node:t}}isZikoUINode(){return!0}get node(){return this.cache.node}}function Kh(n){const t={};return n.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi,e=>{const[i,r]=e.split("=");t[i]=r}),t}function Jh(n){Object.defineProperties(n,{QueryParams:{get:function(){return Kh(globalThis.location.search.substring(1))},configurable:!1,enumerable:!0},HashParams:{get:function(){return globalThis.location.hash.substring(1).split("#")},configurable:!1,enumerable:!0}})}class Oa extends Array{constructor(...t){super(...t)}clear(){return this.length=0,this}getItemById(t){return this.find(e=>e.element.id===t)}getItemsByTagName(t){return this.filter(e=>e.element.tagName.toLowerCase()===t.toLowerCase())}getElementsByClassName(t){return this.filter(e=>{var i;return(i=e.element.classList)==null?void 0:i.contains(t)})}querySelector(t){var i;const e=(i=globalThis==null?void 0:globalThis.document)==null?void 0:i.querySelector(t);return e&&this.find(r=>r.element===e)||null}querySelectorAll(t){var i;const e=(i=globalThis==null?void 0:globalThis.document)==null?void 0:i.querySelectorAll(t);return Array.from(e).map(r=>this.find(s=>s.element===r)).filter(Boolean)}}const Xh=new Oa,Qh={default:{target:null,render:!0,math:{mode:"deg"}},setDefault:function(n){const t=Object.keys(n),e=Object.values(n);for(let i=0;i<t.length;i++)this.default[t[i]]=e[i]},init:()=>{},renderingMode:"spa",isSSC:!1},td={store:new Map,index:0,register:function(n){this.store.set(this.index++,n)},reset(){this.index=0,this.store.clear()}},ed={ui_index:0,get_ui_index:function(){return this.ui_index++},register_ui:function(n){}};var nd={store:new Map,index:0,session_storage:null,register:function(n){this.store.set(this.index++,n)},update:function(n,t){}};function Ba(){globalThis!=null&&globalThis.__Ziko__||(globalThis.__Ziko__={__UI__:Xh,__HYDRATION__:td,__State__:nd,__Config__:Qh,__CACHE__:ed},Jh(__Ziko__))}Ba();class id extends Ia{constructor(){super()}init(t,e,i,r){var s,o,a,c,l;if(this.target=globalThis.__Ziko__.__Config__.default.target||((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body),typeof t=="string")switch(i){case"html":t=(o=globalThis==null?void 0:globalThis.document)==null?void 0:o.createElement(t);break;case"svg":t=(a=globalThis==null?void 0:globalThis.document)==null?void 0:a.createElementNS("http://www.w3.org/2000/svg",t);break;default:throw Error("Not supported")}else this.target=t==null?void 0:t.parentElement;Object.assign(this.cache,{name:e,isInteractive:!1,parent:null,isBody:!1,isRoot:!1,isHidden:!1,isFrozzen:!1,legacyParent:null,attributes:{},filters:{},temp:{}}),this.events={ptr:null,mouse:null,wheel:null,key:null,drag:null,drop:null,click:null,clipboard:null,focus:null,swipe:null,custom:null},this.observer={resize:null,intersection:null},t&&Object.assign(this.cache,{element:t}),this.items=new Oa,globalThis.__Ziko__.__UI__[this.cache.name]?(c=globalThis.__Ziko__.__UI__[this.cache.name])==null||c.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this],t&&r&&((l=this==null?void 0:this.render)==null||l.call(this)),globalThis.__Ziko__.__UI__.push(this)}get element(){return this.cache.element}[Symbol.iterator](){return this.items[Symbol.iterator]()}maintain(){for(let t=0;t<this.items.length;t++)Object.defineProperty(this,t,{value:this.items[t],writable:!0,configurable:!0,enumerable:!1})}isInteractive(){return this.cache.isInteractive}isUIElement(){return!0}}function rd(n,...t){t.forEach(e=>sd(n,e))}function sd(n,t){const e=Object.getOwnPropertyDescriptors(t);for(const i of Reflect.ownKeys(e)){const r=e[i];"get"in r||"set"in r||typeof r.value!="function"?Object.defineProperty(Object.getPrototypeOf(n),i,r):typeof r.value=="function"&&(Object.getPrototypeOf(n).hasOwnProperty(i)||Object.defineProperty(Object.getPrototypeOf(n),i,r))}}function od(n=this.target,t=0){var e;return t>0?(setTimeout(()=>this.mount(n,0),t),this):this.isBody?this:(n!=null&&n.isUIElement&&(n=n.element),this.target=n,(e=this.target)==null||e.appendChild(this.element),this)}function ad(n=0){var t,e;return n>0?(setTimeout(()=>this.unmount(0),n),this):(this.cache.parent?this.cache.parent.remove(this):(e=(t=this.target)==null?void 0:t.children)!=null&&e.length&&[...this.target.children].includes(this.element)&&this.target.removeChild(this.element),this)}const cd=Object.freeze(Object.defineProperty({__proto__:null,mount:od,unmount:ad},Symbol.toStringTag,{value:"Module"}));globalThis.__Ziko__||Ba();const Aa=n=>{var t,e;return typeof n=="function"&&((e=(t=n==null?void 0:n())==null?void 0:t.isStateGetter)==null?void 0:e.call(t))},ld=(n="")=>n.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),ud=(n="")=>n.length===0?!1:/^[a-z][a-zA-Z0-9]*$/.test(n);class hd extends Ia{constructor(...t){var e;super("span","text",!1,...t),this.element=(e=globalThis==null?void 0:globalThis.document)==null?void 0:e.createTextNode(...t)}isText(){return!0}}const ir=(...n)=>new hd(...n);async function dd(n,t,...e){var i,r,s,o,a,c;if(this.cache.isFrozzen)return console.warn("You can't append new item to frozzen element"),this;for(let l=0;l<e.length;l++){if(["number","string"].includes(typeof e[l])&&(e[l]=ir(e[l])),e[l]instanceof Function){const u=e[l]();u.isStateGetter&&(e[l]=ir(u.value),u._subscribe(f=>e[l].element.textContent=f,e[l]))}if(typeof(globalThis==null?void 0:globalThis.Node)=="function"&&e[l]instanceof(globalThis==null?void 0:globalThis.Node)&&(e[l]=new this.constructor(e[l])),(i=e[l])!=null&&i.isZikoUINode)e[l].cache.parent=this,(r=this.element)==null||r[n](e[l].element),e[l].target=this.element,this.items[t](e[l]);else if(e[l]instanceof Promise){const u=await e[l];u.cache.parent=this,(s=this.element)==null||s[n](u.element),u.target=this.element,this.items[t](u)}else e[l]instanceof Object&&((o=e[l])!=null&&o.style&&this.style((a=e[l])==null?void 0:a.style),(c=e[l])!=null&&c.attr&&Object.entries(e[l].attr).forEach(u=>this.setAttr(""+u[0],u[1])))}return this.maintain(),this}function gs(n,t){var e;globalThis.SVGAElement&&this.element instanceof globalThis.SVGAElement&&(n=ud(n)?ld(n):n),!(this!=null&&this.attr[n]&&(this==null?void 0:this.attr[n])===t)&&(Aa(t)?t()._subscribe(r=>{var s;return(s=this.element)==null?void 0:s.setAttribute(n,r)},this):(e=this.element)==null||e.setAttribute(n,t),Object.assign(this.cache.attributes,{[n]:t}))}function fd(n,t){if(n instanceof Object){const[e,i]=[Object.keys(n),Object.values(n)];for(let r=0;r<e.length;r++)i[r]instanceof Array&&(t[r]=i[r].join(" ")),gs.call(this,e[r],i[r])}else t instanceof Array&&(t=t.join(" ")),gs.call(this,n,t);return this}function pd(...n){var t;for(let e=0;e<n.length;e++)(t=this.element)==null||t.removeAttribute(n[e]);return this}function yd(n){return n=is_camelcase(n)?camel2hyphencase(n):n,this.element.attributes[n].value}function md(n=!0){return this.setAttr("contenteditable",n),this}const gd=Object.freeze(Object.defineProperty({__proto__:null,getAttr:yd,removeAttr:pd,setAttr:fd,setContentEditable:md},Symbol.toStringTag,{value:"Module"}));function bd(...n){return dd.call(this,"append","push",...n),this}function _d(...n){return this.__addItem__.call(this,"prepend","unshift",...n),this}function vd(n,...t){var e;if(n>=this.element.children.length)this.append(...t);else for(let i=0;i<t.length;i++)["number","string"].includes(typeof t[i])&&(t[i]=ir(t[i])),(e=this.element)==null||e.insertBefore(t[i].element,this.items[n].element),this.items.splice(n,0,t[i]);return this}function wd(...n){const t=e=>{var i;typeof e=="number"&&(e=this.items[e]),e!=null&&e.isUIElement&&((i=this.element)==null||i.removeChild(e.element)),this.items=this.items.filter(r=>r!==e)};for(let e=0;e<n.length;e++)t(n[e]);for(let e=0;e<this.items.length;e++)Object.assign(this,{[[e]]:this.items[e]});return this}function Sd(){var n;return(n=this==null?void 0:this.items)==null||n.forEach(t=>t.unmount()),this.element.innerHTML="",this}function Id(n){return this.cache.element.replaceWith(n),this.cache.element=n,this}function Od(n){var t;return n!=null&&n.isUIElement&&(n=n.element),(t=this.element)==null||t.after(n),this}function Bd(n){var t;return n!=null&&n.isUIElement&&(n=n.element),(t=this.element)==null||t.before(n),this}const Ad=Object.freeze(Object.defineProperty({__proto__:null,after:Od,append:bd,before:Bd,clear:Sd,insertAt:vd,prepend:_d,remove:wd,replaceElementWith:Id},Symbol.toStringTag,{value:"Module"})),Ct={Click:["Click","DblClick","ClickAway"],Ptr:["PtrMove","PtrDown","PtrUp","PtrLeave","PtrEnter","PtrOut","PtrCancel"],Mouse:["MouseMove","MouseDown","MouseUp","MouseEnter","MouseLeave","MouseOut"],Key:["KeyDown","KeyPress","KeyUp"],Clipboard:["Copy","Cut","Paste"],Focus:["focus","blur"],Drag:["Drag","DragStart","DragEnd","Drop"],Wheel:["Wheel"],View:["EnterView","ExitView","ResizeView"],Swipe:["SwipeLeft","SwipeUp","SwipeRight","SwipeDown"]};function Dd(n,t,e,i){var r,s;this.cache.currentEvent=t,this.cache.event=n,e==null||e.call(this),i!=null&&i.hasOwnProperty("prototype")?i==null||i.call(this):i==null||i.call(null,this),this.cache.preventDefault[t]&&n.preventDefault(),this.cache.stopPropagation[t]&&n.stopPropagation(),this.cache.stopImmediatePropagation[t]&&n.stopImmediatePropagation(),(s=(r=this.cache.callbacks)[t])==null||s.call(r,this)}function bs(n,...t){return(t.length===0?Object.keys(this.cache.paused):t).forEach(i=>{var r;this.cache.paused.hasOwnProperty(i)&&((r=this.targetElement)==null||r[n](i,this.cache.__controllers__[i],this.cache.options[i]),this.cache.paused[i]=n==="removeEventListener")}),this}const _s=(n="")=>n.startsWith("Ptr")?`pointer${n.split("Ptr")[1].toLowerCase()}`:n.toLowerCase();var Ke,Vn;class Xt{constructor(t,e=null,i=[],r,s){Tn(this,Ke);this.target=e,this.cache={signature:t,currentEvent:null,event:null,options:{},preventDefault:{},stopPropagation:{},stopImmediatePropagation:{},paused:{},callbacks:{},__controllers__:{}},i&&this._register_events(i,r,s)}_register_events(t,e,i,r=!0){const s=t==null?void 0:t.map(o=>_s(o));return s==null||s.forEach((o,a)=>{this.cache.preventDefault[o]=!1,this.cache.options[o]={},this.cache.paused[o]=!1,this.cache.__controllers__[o]=c=>Dd.call(this,c,o,e,i),r&&(this[`on${t[a]}`]=c=>this.__onEvent(o,this.cache.options[o],{},c))}),this}__onEvent(t,e,i,r){return r?(this.cache.callbacks[t]=r,this.__handle(t,this.cache.__controllers__[t],e,i),this):this}get targetElement(){var t;return(t=this.target)==null?void 0:t.element}get isParent(){var t,e;return((t=this.target)==null?void 0:t.element)===((e=this.event)==null?void 0:e.srcElement)}get item(){var t;return(t=this.target.find(e=>{var i;return e.element==((i=this.event)==null?void 0:i.srcElement)}))==null?void 0:t[0]}get currentEvent(){return this.cache.currentEvent}get event(){return this.cache.event}get detail(){return this.cache.event.detail}setTarget(t){return this.target=t,this}__handle(t,e,i){var r;return(r=this.targetElement)==null||r.addEventListener(t,e,i),this}preventDefault(...t){return Ot(this,Ke,Vn).call(this,"preventDefault",...t)}stopPropagation(...t){return Ot(this,Ke,Vn).call(this,"stopPropagation",...t)}stopImmediatePropagation(...t){return Ot(this,Ke,Vn).call(this,"stopImmediatePropagation",...t)}setEventOptions(t,e){const i=_s(t);return this.pause(),Object.assign(this.cache.options[i],e),this.resume(),this}pause(...t){return bs.call(this,"removeEventListener",...t)}resume(...t){return bs.call(this,"addEventListener",...t)}dispose(){return this.pause(),this.target.events[this.cache.signature]=null,this}}Ke=new WeakSet,Vn=function(t,...e){return(e.length===0?Object.keys(this.cache[t]):e).forEach(r=>{this.cache[t].hasOwnProperty(r)&&(this.cache[t][r]=!0)}),this};function Fd(){switch(this.currentEvent){case"keydown":this.kd=this.event.key;break;case"keypress":this.kp=this.event.key;break;case"keyup":this.ku=this.event.key;break}}function Td(){const n=this.targetElement.getBoundingClientRect(),t=this.event;let e=t.clientX-n.left|0,i=t.clientY-n.top|0;if(this.cache.useNormalisedCoordinates){const r=this.targetElement.clientWidth,s=this.targetElement.clientHeight;e=+(e/r*2-1).toFixed(8),i=+(i/s*-2+1).toFixed(8)}switch(this.currentEvent){case"pointerdown":this.dx=e,this.dy=i,this.isDown=!0;break;case"pointermove":this.mx=e,this.my=i,this.isMoving=!0;break;case"pointerup":this.ux=e,this.uy=i,this.isDown=!1,this.isMoving=!1;break}}function Md(){const n=this.targetElement.getBoundingClientRect(),t=this.event;let e=t.clientX-n.left|0,i=t.clientY-n.top|0;if(this.cache.useNormalisedCoordinates){const r=this.targetElement.clientWidth,s=this.targetElement.clientHeight;e=+(e/r*2-1).toFixed(8),i=+(i/s*-2+1).toFixed(8)}switch(this.currentEvent){case"mousedown":this.dx=e,this.dy=i,this.isDown=!0;break;case"mousemove":this.mx=e,this.my=i,this.isMoving=!0;break;case"mouserup":this.ux=e,this.uy=i,this.isDown=!1,this.isMoving=!1;break}}class Da extends Xt{constructor(t,e=null,i=[],r,s){super(t,e,i,r,s),Object.assign(this.cache,{useNormalisedCoordinates:!1}),this.isDown=!1,this.isMoving=!1,this.dx=0,this.dy=0,this.mx=0,this.my=0,this.ux=0,this.uy=0}get isDragging(){return this.isDown&&this.isMoving}useNormalisedCoordinates(t=!0){return this.cache.useNormalisedCoordinates=t,this}}class Ed extends Event{constructor(t,e){super("clickaway",{bubbles:!0,cancelable:!0}),this.originalEvent=t,this.targetElement=e}}function Nd(n){var e;console.log(n);function t(i){if(!n.contains(i.target)){const r=new Ed(i,n);n.dispatchEvent(r)}}return(e=globalThis==null?void 0:globalThis.document)==null||e.addEventListener("click",t),()=>{var i;return(i=globalThis==null?void 0:globalThis.document)==null?void 0:i.removeEventListener("click",t)}}const vs=(n,t)=>{let e=0;return(...i)=>{const r=new Date().getTime();r-e<t||(e=r,n(...i))}};class ws extends CustomEvent{constructor(t,e,{bubbles:i=!0,cancelable:r=!0}={}){super(t,{detail:e,bubbles:i,cancelable:r})}}function xd(n,{intersection:t=!0,resize:e=!0,threshold:i=0,throttleResize:r=100,throttleEnterExit:s=0}={}){let o,a;const c=m=>{for(let y of m){const{width:b,height:C}=y.contentRect;n.dispatchEvent(new ws("resizeview",{width:b,height:C,entry:y}))}},l=r>0?vs(c,r):c,u=m=>{for(let y of m){const b=y.isIntersecting?"enterview":"exitview";n.dispatchEvent(new ws(b,y))}},f=s>0?vs(u,s):u;return t&&(o=new IntersectionObserver(f,{threshold:i}),o.observe(n)),e&&(a=new ResizeObserver(l),a.observe(n)),()=>{o&&(o.unobserve(n),o.disconnect()),a&&(a.unobserve(n),a.disconnect())}}class Ld extends CustomEvent{constructor(t,e){super(t,{detail:e,bubbles:!0,cancelable:!0})}}function Cd(n,t=50,e=100,i=500){let r=0,s=0,o=0,a=!1;function c(u){r=u.clientX,s=u.clientY,o=performance.now(),a=!0}function l(u){if(!a)return;a=!1;const f=u.clientX-r,m=u.clientY-s,y=performance.now()-o;let b=null,C=null;y<=i&&(Math.abs(f)>=t&&Math.abs(m)<=e?(b=f<0?"left":"right",C="swipe"+b):Math.abs(m)>=t&&Math.abs(f)<=e&&(b=m<0?"up":"down",C="swipe"+b)),C&&n.dispatchEvent(new Ld(C,{direction:b,distX:f,distY:m,originalEvent:u}))}return n.addEventListener("pointerdown",c,{passive:!0}),n.addEventListener("pointerup",l,{passive:!0}),()=>{n.removeEventListener("pointerdown",c),n.removeEventListener("pointerup",l)}}const Rd=(n,t)=>(Nd(n.element),new Xt("click",n,Ct.Click,null,t)),Ud=(n,t)=>new Xt("clipboard",n,Ct.Clipboard,null,t),kd=(n,t)=>new Xt("drag",n,Ct.Drag,null,t),Pd=(n,t)=>new Xt("focus",n,Ct.Focus,null,t),jd=(n,t)=>new Xt("key",n,Ct.Key,Fd,t),$d=(n,t)=>new Da("mouse",n,Ct.Mouse,Md,t),Vd=(n,t)=>new Da("ptr",n,Ct.Ptr,Td,t),zd=(n,t)=>new Xt("wheel",n,Ct.Wheel,null,t),Yd=(n,t)=>(xd(n.element),new Xt("view",n,Ct.View,null,t)),Wd=(n,t)=>(Cd(n.element),new Xt("swipe",n,Ct.Swipe,null,t));class Hd extends Xt{constructor(t,e,i){super("custom",t,e,Zd,i)}_register_events(t){return super._register_events(t,null,null,!1),this}emit(t,e={}){const i=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return this.targetElement.dispatchEvent(i),this}on(t,...e){return this.cache.options.hasOwnProperty(t)||this._register_events([t]),this.__onEvent(t,this.cache.options[t],{},...e),this}}function Zd(){}const Ss=(n,t,e)=>new Hd(n,t,e),Gd={ptr:Vd,mouse:$d,key:jd,click:Rd,drag:kd,clipboard:Ud,focus:Pd,wheel:zd,view:Yd,swipe:Wd},Fa={on(n,...t){return this.events.custom||(this.events.custom=Ss(this)),this.events.custom.on(n,...t),this},emit(n,t={}){return this.events.custom||(this.events.custom=Ss(this)),this.events.custom.emit(n,t),this}};Object.entries(Ct).forEach(([n,t])=>{const e=n.toLowerCase();t.forEach(i=>{const r=`on${i}`;Fa[r]=function(s){return this.events[e]||(this.events[e]=Gd[e](this)),this.events[e][r](s),this}})});function qd(n){return this.items.at(n)}function Kd(n){return this.items.forEach(n),this}function Jd(n){return this.items.map(n)}function Xd(n){return this.items.filter(n)}const Qd=Object.freeze(Object.defineProperty({__proto__:null,at:qd,find:Xd,forEach:Kd,map:Jd},Symbol.toStringTag,{value:"Module"}));function tf(n){var t;if(!((t=this.element)!=null&&t.style))return this;for(let e in n){const i=n[e];if(Aa(i)){const r=i();Object.assign(this.element.style,{[e]:r.value}),r._subscribe(s=>{console.log({newValue:s}),Object.assign(this.element.style,{[e]:s})})}else Object.assign(this.element.style,{[e]:i})}return this}function ef(n,t){return this.style({width:n,height:t})}function nf(){}function rf(){}function sf(n,{duration:t=1e3,iterations:e=1,easing:i="ease"}={}){var r;return(r=this.element)==null||r.animate(n,{duration:t,iterations:e,easing:i}),this}const of=Object.freeze(Object.defineProperty({__proto__:null,animate:sf,hide:nf,show:rf,size:ef,style:tf},Symbol.toStringTag,{value:"Module"}));class xn extends id{constructor({element:t,name:e="",type:i="html",render:r=__Ziko__.__Config__.default.render}={}){super(),rd(this,cd,gd,Ad,of,Qd,Fa),t&&this.init(t,e,i,r)}get element(){return this.cache.element}isInteractive(){return this.cache.isInteractive}useClient(t){return this.cache.isInteractive||(this.element.setAttribute("data-hydration-index",globalThis.__Ziko__.__HYDRATION__.index),globalThis.__Ziko__.__HYDRATION__.register(()=>this),this.cache.isInteractive=!0),t&&this.element.setAttribute("data-hydration-directive",t),this}get st(){return this.cache.style}get attr(){return this.cache.attributes}get evt(){return this.events}get html(){return this.element.innerHTML}get text(){return this.element.textContent}get isBody(){return this.element===(globalThis==null?void 0:globalThis.document.body)}get parent(){return this.cache.parent}get width(){return this.element.getBoundingClientRect().width}get height(){return this.element.getBoundingClientRect().height}get top(){return this.element.getBoundingClientRect().top}get right(){return this.element.getBoundingClientRect().right}get bottom(){return this.element.getBoundingClientRect().bottom}get left(){return this.element.getBoundingClientRect().left}}const af=["a","abb","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","ipnut","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],cf=["svg","g","defs","symbol","use","image","switch","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","textPath","altGlyph","altGlyphDef","altGlyphItem","glyph","glyphRef","linearGradient","radialGradient","pattern","solidColor","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncR","feFuncG","feFuncB","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","script","desc","title","metadata","foreignObject"],lf=["math","annotation","merror","mfrac","mi","mprescripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"],uf=new Proxy({},{get(n,t){if(typeof t!="string")return;let e=t.replaceAll("_","-").toLowerCase(),i;return af.includes(e)&&(i="html"),cf.includes(e)&&(i="svg"),lf.includes(e)&&(i="mathml"),(...r)=>r.length===0?new xn({element:e,name:e,type:i}):["string","number"].includes(typeof r[0])||r[0]instanceof xn||typeof r[0]=="function"&&r[0]().isStateGetter()?new xn({element:e,name:e,type:i}).append(...r):new xn({element:e,type:i}).setAttr(r.shift()).append(...r)}}),{svg:Yf}=uf,hf={m:"margin",mx:"marginInline",my:"marginBlock",mt:"marginTop",mb:"marginBottom",ml:"marginLeft",mr:"marginRight",p:"padding",px:"paddingInline",py:"paddingBlock",pt:"paddingTop",pb:"paddingBottom",pl:"paddingLeft",pr:"paddingRight",bg:"background",bgColor:"backgroundColor",w:"width",h:"height",f:"font"},ji=["xs","sm","md","lg","xl","xxl"],Is={xs:300,sm:600,md:960,lg:1280,xl:1920,xxl:1/0},df=()=>Object.create({xs:{},sm:{},md:{},lg:{},xl:{},xxl:{}});function ff(n){return n.startsWith("margin")||n.startsWith("padding")||["gap"].includes(n)}function Os(n,t){return typeof t=="number"&&ff(n)?`calc(var(--zextra-base-spacing) * ${t})`:t}function pf(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}class yf extends ze{sx(t={}){const e={},i={};for(let s in t){const o=hf[s]??s,a=t[s];if(pf(a)){const c={};for(let l in a)c[l]=Os(o,a[l]);i[o]=c}else e[o]=Os(o,a)}this.style(e);const r=df();for(let s in i)for(let o of ji)r[o][s]=i[s][o]??i[s].base??"";this.onResizeView(nr(()=>{const s=this.width;for(let o of ji)if(r[o]&&s<Is[o])return this.style(r[o])},30)),console.log({BREAKPOINTS:ji,BREAKPOINTS_MAP:Is,BREAKPOINTS_STYLES_MAP:r})}}const{ul:mf,li:gf,a:bf}=qh;var Zt,Ta,zn,Ma;class _f extends yf{constructor({content:e=document.body,depth:i=6,labelFn:r}={}){super({element:"nav"});Tn(this,Zt);this.setAttr({class:"zextra-toc"}),this.content=e instanceof ze?e.element:e,this.toc_list=mf(),this.depth=i,this.labelFn=r,this.observer=null,this.append(this.toc_list),Ot(this,Zt,Ma).call(this)}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null)}refresh(){Ot(this,Zt,zn).call(this)}}Zt=new WeakSet,Ta=function(){if(Array.isArray(this.depth))return this.depth.map(i=>`h${i}`).join(", ");const e=Math.min(Math.max(this.depth,1),6);return Array.from({length:e},(i,r)=>`h${r+1}`).join(", ")},zn=function(){const e=this.content??document.body;if(!e)return!1;const i=Ot(this,Zt,Ta).call(this),r=e.querySelectorAll(i);if(r.length===0)return!1;this.toc_list.element.replaceChildren();const s=Array.isArray(this.depth)?[...this.depth].sort((o,a)=>o-a):Array.from({length:this.depth},(o,a)=>a+1);return r.forEach((o,a)=>{o.id||(o.id=`heading-${a+1}`);const c=parseInt(o.tagName[1]),l=s.indexOf(c),u=this.labelFn?this.labelFn(o,c):o.textContent;gf({},bf({href:`#${o.id}`},u)).style({marginLeft:`${l*15}px`}).mount(this.toc_list)}),!0},Ma=function(){Ot(this,Zt,zn).call(this)||(this.observer=new MutationObserver(()=>{var r;Ot(this,Zt,zn).call(this)&&((r=this.observer)==null||r.disconnect(),this.observer=null)}),(()=>{const r=this.content??document.body;r?this.observer.observe(r,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{var o;const s=this.content??document.body;s&&((o=this.observer)==null||o.observe(s,{childList:!0,subtree:!0}))},{once:!0})})())};const vf=Yh(_f),Bs=document.getElementById("root");function wf(n){const t=n.detail,{theme:e,args:i}=t,{style:r,usehash:s}=i;Bs.innerHTML="";const{backgroundColor:o,primaryColor:a}=e;vf({content:parent.document.body}).style({backgroundColor:o,border:`2px solid ${a}`,...r}).mount(Bs).toc_list.element.querySelectorAll("a").forEach(u=>{u.addEventListener("click",f=>{f.preventDefault();const y=u.getAttribute("href").replace("#","");try{const b=parent.document.getElementById(y);b&&(b.scrollIntoView({behavior:"smooth"}),s&&parent.history.replaceState(null,"",`#${y}`))}catch{window.parent.postMessage({type:"toc-scroll",id:y},"*")}Se.setComponentValue({last_clicked_id:y})})}),Se.setFrameHeight()}Se.events.addEventListener(Se.RENDER_EVENT,wf);Se.setComponentReady();Se.setFrameHeight();
