n.byteLength===8?new n.BigIntArray(n.buffer,n.byteOffset,1)[0]:ub(n),Vd=n=>n.byteLength===8?`${new n.BigIntArray(n.buffer,n.byteOffset,1)[0]}`:ub(n)):(Vd=ub,Gb=Vd);function ub(n){let e="";const r=new Uint32Array(2);let C=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2);const D=new Uint32Array((C=new Uint16Array(C).reverse()).buffer);let T=-1;const p=C.length-1;do{for(r[0]=C[T=0];T(n.children=null,n.ArrayType=Array,n[Symbol.toStringTag]="DataType"))(_i.prototype);let Gf=class extends _i{toString(){return"Null"}get typeId(){return Jn.Null}};$4=Symbol.toStringTag;Gf[$4]=(n=>n[Symbol.toStringTag]="Null")(Gf.prototype);class qf extends _i{constructor(e,r){super(),this.isSigned=e,this.bitWidth=r}get typeId(){return Jn.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?Ym:$m}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Z4=Symbol.toStringTag;qf[Z4]=(n=>(n.isSigned=null,n.bitWidth=null,n[Symbol.toStringTag]="Int"))(qf.prototype);class Lm extends qf{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Lm.prototype,"ArrayType",{value:Int32Array});class Im extends _i{constructor(e){super(),this.precision=e}get typeId(){return Jn.Float}get ArrayType(){switch(this.precision){case Yl.HALF:return Uint16Array;case Yl.SINGLE:return Float32Array;case Yl.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}X4=Symbol.toStringTag;Im[X4]=(n=>(n.precision=null,n[Symbol.toStringTag]="Float"))(Im.prototype);let Pv=class extends _i{constructor(){super()}get typeId(){return Jn.Binary}toString(){return"Binary"}};K4=Symbol.toStringTag;Pv[K4]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Binary"))(Pv.prototype);let Ov=class extends _i{constructor(){super()}get typeId(){return Jn.Utf8}toString(){return"Utf8"}};J4=Symbol.toStringTag;Ov[J4]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Utf8"))(Ov.prototype);let Dv=class extends _i{constructor(){super()}get typeId(){return Jn.Bool}toString(){return"Bool"}};Q4=Symbol.toStringTag;Dv[Q4]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Bool"))(Dv.prototype);let zv=class extends _i{constructor(e,r,C=128){super(),this.scale=e,this.precision=r,this.bitWidth=C}get typeId(){return Jn.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};ek=Symbol.toStringTag;zv[ek]=(n=>(n.scale=null,n.precision=null,n.ArrayType=Uint32Array,n[Symbol.toStringTag]="Decimal"))(zv.prototype);class Fv extends _i{constructor(e){super(),this.unit=e}get typeId(){return Jn.Date}toString(){return`Date${(this.unit+1)*32}<${nf[this.unit]}>`}}tk=Symbol.toStringTag;Fv[tk]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Date"))(Fv.prototype);class Rm extends _i{constructor(e,r){super(),this.unit=e,this.bitWidth=r}get typeId(){return Jn.Time}toString(){return`Time${this.bitWidth}<${wa[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return Ym}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}nk=Symbol.toStringTag;Rm[nk]=(n=>(n.unit=null,n.bitWidth=null,n[Symbol.toStringTag]="Time"))(Rm.prototype);class Bv extends _i{constructor(e,r){super(),this.unit=e,this.timezone=r}get typeId(){return Jn.Timestamp}toString(){return`Timestamp<${wa[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}rk=Symbol.toStringTag;Bv[rk]=(n=>(n.unit=null,n.timezone=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Timestamp"))(Bv.prototype);class Nv extends _i{constructor(e){super(),this.unit=e}get typeId(){return Jn.Interval}toString(){return`Interval<${Hf[this.unit]}>`}}ik=Symbol.toStringTag;Nv[ik]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Interval"))(Nv.prototype);let Vv=class extends _i{constructor(e){super(),this.children=[e]}get typeId(){return Jn.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}};ak=Symbol.toStringTag;Vv[ak]=(n=>(n.children=null,n[Symbol.toStringTag]="List"))(Vv.prototype);class bl extends _i{constructor(e){super(),this.children=e}get typeId(){return Jn.Struct}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}ok=Symbol.toStringTag;bl[ok]=(n=>(n.children=null,n[Symbol.toStringTag]="Struct"))(bl.prototype);class jv extends _i{constructor(e,r,C){super(),this.mode=e,this.children=C,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((D,T,p)=>(D[T]=p)&&D||D,Object.create(null))}get typeId(){return Jn.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}sk=Symbol.toStringTag;jv[sk]=(n=>(n.mode=null,n.typeIds=null,n.children=null,n.typeIdToChildIndex=null,n.ArrayType=Int8Array,n[Symbol.toStringTag]="Union"))(jv.prototype);let Uv=class extends _i{constructor(e){super(),this.byteWidth=e}get typeId(){return Jn.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};lk=Symbol.toStringTag;Uv[lk]=(n=>(n.byteWidth=null,n.ArrayType=Uint8Array,n[Symbol.toStringTag]="FixedSizeBinary"))(Uv.prototype);let Hv=class extends _i{constructor(e,r){super(),this.listSize=e,this.children=[r]}get typeId(){return Jn.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}>`}};uk=Symbol.toStringTag;Hv[uk]=(n=>(n.children=null,n.listSize=null,n[Symbol.toStringTag]="FixedSizeList"))(Hv.prototype);class Gv extends _i{constructor(e,r=!1){super(),this.children=[e],this.keysSorted=r}get typeId(){return Jn.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(e=>`${e.name}:${e.type}`).join(", ")}}>`}}ck=Symbol.toStringTag;Gv[ck]=(n=>(n.children=null,n.keysSorted=null,n[Symbol.toStringTag]="Map_"))(Gv.prototype);const z9=(n=>()=>++n)(-1);class Kp extends _i{constructor(e,r,C,D){super(),this.indices=r,this.dictionary=e,this.isOrdered=D||!1,this.id=C==null?z9():typeof C=="number"?C:C.low}get typeId(){return Jn.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}>`}}hk=Symbol.toStringTag;Kp[hk]=(n=>(n.id=null,n.indices=null,n.isOrdered=null,n.dictionary=null,n[Symbol.toStringTag]="Dictionary"))(Kp.prototype);function Wh(n){const e=n;switch(n.typeId){case Jn.Decimal:return n.bitWidth/32;case Jn.Timestamp:return 2;case Jn.Date:return 1+e.unit;case Jn.Interval:return 1+e.unit;case Jn.FixedSizeList:return e.listSize;case Jn.FixedSizeBinary:return e.byteWidth;default:return 1}}class aa{visitMany(e,...r){return e.map((C,D)=>this.visit(C,...r.map(T=>T[D])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,r=!0){return F9(this,e,r)}getVisitFnByTypeId(e,r=!0){return Rp(this,e,r)}visitNull(e,...r){return null}visitBool(e,...r){return null}visitInt(e,...r){return null}visitFloat(e,...r){return null}visitUtf8(e,...r){return null}visitBinary(e,...r){return null}visitFixedSizeBinary(e,...r){return null}visitDate(e,...r){return null}visitTimestamp(e,...r){return null}visitTime(e,...r){return null}visitDecimal(e,...r){return null}visitList(e,...r){return null}visitStruct(e,...r){return null}visitUnion(e,...r){return null}visitDictionary(e,...r){return null}visitInterval(e,...r){return null}visitFixedSizeList(e,...r){return null}visitMap(e,...r){return null}}function F9(n,e,r=!0){return typeof e=="number"?Rp(n,e,r):typeof e=="string"&&e in Jn?Rp(n,Jn[e],r):e&&e instanceof _i?Rp(n,K3(e),r):e!=null&&e.type&&e.type instanceof _i?Rp(n,K3(e.type),r):Rp(n,Jn.NONE,r)}function Rp(n,e,r=!0){let C=null;switch(e){case Jn.Null:C=n.visitNull;break;case Jn.Bool:C=n.visitBool;break;case Jn.Int:C=n.visitInt;break;case Jn.Int8:C=n.visitInt8||n.visitInt;break;case Jn.Int16:C=n.visitInt16||n.visitInt;break;case Jn.Int32:C=n.visitInt32||n.visitInt;break;case Jn.Int64:C=n.visitInt64||n.visitInt;break;case Jn.Uint8:C=n.visitUint8||n.visitInt;break;case Jn.Uint16:C=n.visitUint16||n.visitInt;break;case Jn.Uint32:C=n.visitUint32||n.visitInt;break;case Jn.Uint64:C=n.visitUint64||n.visitInt;break;case Jn.Float:C=n.visitFloat;break;case Jn.Float16:C=n.visitFloat16||n.visitFloat;break;case Jn.Float32:C=n.visitFloat32||n.visitFloat;break;case Jn.Float64:C=n.visitFloat64||n.visitFloat;break;case Jn.Utf8:C=n.visitUtf8;break;case Jn.Binary:C=n.visitBinary;break;case Jn.FixedSizeBinary:C=n.visitFixedSizeBinary;break;case Jn.Date:C=n.visitDate;break;case Jn.DateDay:C=n.visitDateDay||n.visitDate;break;case Jn.DateMillisecond:C=n.visitDateMillisecond||n.visitDate;break;case Jn.Timestamp:C=n.visitTimestamp;break;case Jn.TimestampSecond:C=n.visitTimestampSecond||n.visitTimestamp;break;case Jn.TimestampMillisecond:C=n.visitTimestampMillisecond||n.visitTimestamp;break;case Jn.TimestampMicrosecond:C=n.visitTimestampMicrosecond||n.visitTimestamp;break;case Jn.TimestampNanosecond:C=n.visitTimestampNanosecond||n.visitTimestamp;break;case Jn.Time:C=n.visitTime;break;case Jn.TimeSecond:C=n.visitTimeSecond||n.visitTime;break;case Jn.TimeMillisecond:C=n.visitTimeMillisecond||n.visitTime;break;case Jn.TimeMicrosecond:C=n.visitTimeMicrosecond||n.visitTime;break;case Jn.TimeNanosecond:C=n.visitTimeNanosecond||n.visitTime;break;case Jn.Decimal:C=n.visitDecimal;break;case Jn.List:C=n.visitList;break;case Jn.Struct:C=n.visitStruct;break;case Jn.Union:C=n.visitUnion;break;case Jn.DenseUnion:C=n.visitDenseUnion||n.visitUnion;break;case Jn.SparseUnion:C=n.visitSparseUnion||n.visitUnion;break;case Jn.Dictionary:C=n.visitDictionary;break;case Jn.Interval:C=n.visitInterval;break;case Jn.IntervalDayTime:C=n.visitIntervalDayTime||n.visitInterval;break;case Jn.IntervalYearMonth:C=n.visitIntervalYearMonth||n.visitInterval;break;case Jn.FixedSizeList:C=n.visitFixedSizeList;break;case Jn.Map:C=n.visitMap;break}if(typeof C=="function")return C;if(!r)return()=>null;throw new Error(`Unrecognized type '${Jn[e]}'`)}function K3(n){switch(n.typeId){case Jn.Null:return Jn.Null;case Jn.Int:{const{bitWidth:e,isSigned:r}=n;switch(e){case 8:return r?Jn.Int8:Jn.Uint8;case 16:return r?Jn.Int16:Jn.Uint16;case 32:return r?Jn.Int32:Jn.Uint32;case 64:return r?Jn.Int64:Jn.Uint64}return Jn.Int}case Jn.Float:switch(n.precision){case Yl.HALF:return Jn.Float16;case Yl.SINGLE:return Jn.Float32;case Yl.DOUBLE:return Jn.Float64}return Jn.Float;case Jn.Binary:return Jn.Binary;case Jn.Utf8:return Jn.Utf8;case Jn.Bool:return Jn.Bool;case Jn.Decimal:return Jn.Decimal;case Jn.Time:switch(n.unit){case wa.SECOND:return Jn.TimeSecond;case wa.MILLISECOND:return Jn.TimeMillisecond;case wa.MICROSECOND:return Jn.TimeMicrosecond;case wa.NANOSECOND:return Jn.TimeNanosecond}return Jn.Time;case Jn.Timestamp:switch(n.unit){case wa.SECOND:return Jn.TimestampSecond;case wa.MILLISECOND:return Jn.TimestampMillisecond;case wa.MICROSECOND:return Jn.TimestampMicrosecond;case wa.NANOSECOND:return Jn.TimestampNanosecond}return Jn.Timestamp;case Jn.Date:switch(n.unit){case nf.DAY:return Jn.DateDay;case nf.MILLISECOND:return Jn.DateMillisecond}return Jn.Date;case Jn.Interval:switch(n.unit){case Hf.DAY_TIME:return Jn.IntervalDayTime;case Hf.YEAR_MONTH:return Jn.IntervalYearMonth}return Jn.Interval;case Jn.Map:return Jn.Map;case Jn.List:return Jn.List;case Jn.Struct:return Jn.Struct;case Jn.Union:switch(n.mode){case xu.Dense:return Jn.DenseUnion;case xu.Sparse:return Jn.SparseUnion}return Jn.Union;case Jn.FixedSizeBinary:return Jn.FixedSizeBinary;case Jn.FixedSizeList:return Jn.FixedSizeList;case Jn.Dictionary:return Jn.Dictionary}throw new Error(`Unrecognized type '${Jn[n.typeId]}'`)}aa.prototype.visitInt8=null;aa.prototype.visitInt16=null;aa.prototype.visitInt32=null;aa.prototype.visitInt64=null;aa.prototype.visitUint8=null;aa.prototype.visitUint16=null;aa.prototype.visitUint32=null;aa.prototype.visitUint64=null;aa.prototype.visitFloat16=null;aa.prototype.visitFloat32=null;aa.prototype.visitFloat64=null;aa.prototype.visitDateDay=null;aa.prototype.visitDateMillisecond=null;aa.prototype.visitTimestampSecond=null;aa.prototype.visitTimestampMillisecond=null;aa.prototype.visitTimestampMicrosecond=null;aa.prototype.visitTimestampNanosecond=null;aa.prototype.visitTimeSecond=null;aa.prototype.visitTimeMillisecond=null;aa.prototype.visitTimeMicrosecond=null;aa.prototype.visitTimeNanosecond=null;aa.prototype.visitDenseUnion=null;aa.prototype.visitSparseUnion=null;aa.prototype.visitIntervalDayTime=null;aa.prototype.visitIntervalYearMonth=null;const fk=new Float64Array(1),Ap=new Uint32Array(fk.buffer);function dk(n){const e=(n&31744)>>10,r=(n&1023)/1024,C=Math.pow(-1,(n&32768)>>15);switch(e){case 31:return C*(r?Number.NaN:1/0);case 0:return C*(r?6103515625e-14*r:0)}return C*Math.pow(2,e-15)*(1+r)}function B9(n){if(n!==n)return 32256;fk[0]=n;const e=(Ap[1]&2147483648)>>16&65535;let r=Ap[1]&2146435072,C=0;return r>=1089470464?Ap[0]>0?r=31744:(r=(r&2080374784)>>16,C=(Ap[1]&1048575)>>10):r<=1056964608?(C=1048576+(Ap[1]&1048575),C=1048576+(C<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,C=(Ap[1]&1048575)+512>>10),e|r|C&65535}class Ci extends aa{}function Pi(n){return(e,r,C)=>{if(e.setValid(r,C!=null))return n(e,r,C)}}const N9=(n,e,r)=>{n[e]=Math.trunc(r/864e5)},b2=(n,e,r)=>{n[e]=Math.trunc(r%4294967296),n[e+1]=Math.trunc(r/4294967296)},V9=(n,e,r)=>{n[e]=Math.trunc(r*1e3%4294967296),n[e+1]=Math.trunc(r*1e3/4294967296)},j9=(n,e,r)=>{n[e]=Math.trunc(r*1e6%4294967296),n[e+1]=Math.trunc(r*1e6/4294967296)},pk=(n,e,r,C)=>{if(r+1{const D=n+r;C?e[D>>3]|=1<>3]&=~(1<{n[e]=r},x2=({values:n},e,r)=>{n[e]=r},mk=({values:n},e,r)=>{n[e]=B9(r)},H9=(n,e,r)=>{switch(n.type.precision){case Yl.HALF:return mk(n,e,r);case Yl.SINGLE:case Yl.DOUBLE:return x2(n,e,r)}},gk=({values:n},e,r)=>{N9(n,e,r.valueOf())},vk=({values:n},e,r)=>{b2(n,e*2,r.valueOf())},G9=({stride:n,values:e},r,C)=>{e.set(C.subarray(0,n),n*r)},q9=({values:n,valueOffsets:e},r,C)=>pk(n,e,r,C),W9=({values:n,valueOffsets:e},r,C)=>{pk(n,e,r,p2(C))},Y9=(n,e,r)=>{n.type.unit===nf.DAY?gk(n,e,r):vk(n,e,r)},yk=({values:n},e,r)=>b2(n,e*2,r/1e3),bk=({values:n},e,r)=>b2(n,e*2,r),xk=({values:n},e,r)=>V9(n,e*2,r),_k=({values:n},e,r)=>j9(n,e*2,r),$9=(n,e,r)=>{switch(n.type.unit){case wa.SECOND:return yk(n,e,r);case wa.MILLISECOND:return bk(n,e,r);case wa.MICROSECOND:return xk(n,e,r);case wa.NANOSECOND:return _k(n,e,r)}},wk=({values:n},e,r)=>{n[e]=r},Tk=({values:n},e,r)=>{n[e]=r},kk=({values:n},e,r)=>{n[e]=r},Mk=({values:n},e,r)=>{n[e]=r},Z9=(n,e,r)=>{switch(n.type.unit){case wa.SECOND:return wk(n,e,r);case wa.MILLISECOND:return Tk(n,e,r);case wa.MICROSECOND:return kk(n,e,r);case wa.NANOSECOND:return Mk(n,e,r)}},X9=({values:n,stride:e},r,C)=>{n.set(C.subarray(0,e),e*r)},K9=(n,e,r)=>{const C=n.children[0],D=n.valueOffsets,T=nc.getVisitFn(C);if(Array.isArray(r))for(let p=-1,t=D[e],d=D[e+1];t{const C=n.children[0],{valueOffsets:D}=n,T=nc.getVisitFn(C);let{[e]:p,[e+1]:t}=D;const d=r instanceof Map?r.entries():Object.entries(r);for(const g of d)if(T(C,p,g),++p>=t)break},Q9=(n,e)=>(r,C,D,T)=>C&&r(C,n,e[T]),eL=(n,e)=>(r,C,D,T)=>C&&r(C,n,e.get(T)),tL=(n,e)=>(r,C,D,T)=>C&&r(C,n,e.get(D.name)),nL=(n,e)=>(r,C,D,T)=>C&&r(C,n,e[D.name]),rL=(n,e,r)=>{const C=n.type.children.map(T=>nc.getVisitFn(T.type)),D=r instanceof Map?tL(e,r):r instanceof Ta?eL(e,r):Array.isArray(r)?Q9(e,r):nL(e,r);n.type.children.forEach((T,p)=>D(C[p],n.children[p],T,p))},iL=(n,e,r)=>{n.type.mode===xu.Dense?Ak(n,e,r):Sk(n,e,r)},Ak=(n,e,r)=>{const C=n.type.typeIdToChildIndex[n.typeIds[e]],D=n.children[C];nc.visit(D,n.valueOffsets[e],r)},Sk=(n,e,r)=>{const C=n.type.typeIdToChildIndex[n.typeIds[e]],D=n.children[C];nc.visit(D,e,r)},aL=(n,e,r)=>{var C;(C=n.dictionary)===null||C===void 0||C.set(n.values[e],r)},oL=(n,e,r)=>{n.type.unit===Hf.DAY_TIME?Ck(n,e,r):Ek(n,e,r)},Ck=({values:n},e,r)=>{n.set(r.subarray(0,2),2*e)},Ek=({values:n},e,r)=>{n[e]=r[0]*12+r[1]%12},sL=(n,e,r)=>{const{stride:C}=n,D=n.children[0],T=nc.getVisitFn(D);if(Array.isArray(r))for(let p=-1,t=e*C;++p`${Cm(e)}: ${Cm(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new lL(this[Ec],this[Gp])}}class lL{constructor(e,r){this.childIndex=0,this.children=e.children,this.rowIndex=r,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return er.name)}has(e,r){return e[Ec].type.children.findIndex(C=>C.name===r)!==-1}getOwnPropertyDescriptor(e,r){if(e[Ec].type.children.findIndex(C=>C.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];const C=e[Ec].type.children.findIndex(D=>D.name===r);if(C!==-1){const D=Xl.visit(e[Ec].children[C],e[Gp]);return Reflect.set(e,r,D),D}}set(e,r,C){const D=e[Ec].type.children.findIndex(T=>T.name===r);return D!==-1?(nc.visit(e[Ec].children[D],e[Gp],C),Reflect.set(e,r,C)):Reflect.has(e,r)||typeof r=="symbol"?Reflect.set(e,r,C):!1}}class Ti extends aa{}function Ei(n){return(e,r)=>e.getValid(r)?n(e,r):null}const cL=(n,e)=>864e5*n[e],w2=(n,e)=>4294967296*n[e+1]+(n[e]>>>0),hL=(n,e)=>4294967296*(n[e+1]/1e3)+(n[e]>>>0)/1e3,fL=(n,e)=>4294967296*(n[e+1]/1e6)+(n[e]>>>0)/1e6,Lk=n=>new Date(n),dL=(n,e)=>Lk(cL(n,e)),pL=(n,e)=>Lk(w2(n,e)),mL=(n,e)=>null,Ik=(n,e,r)=>{if(r+1>=e.length)return null;const C=e[r],D=e[r+1];return n.subarray(C,D)},gL=({offset:n,values:e},r)=>{const C=n+r;return(e[C>>3]&1<dL(n,e),Pk=({values:n},e)=>pL(n,e*2),Kf=({stride:n,values:e},r)=>e[n*r],vL=({stride:n,values:e},r)=>dk(e[n*r]),Ok=({values:n},e)=>n[e],yL=({stride:n,values:e},r)=>e.subarray(n*r,n*(r+1)),bL=({values:n,valueOffsets:e},r)=>Ik(n,e,r),xL=({values:n,valueOffsets:e},r)=>{const C=Ik(n,e,r);return C!==null?jb(C):null},_L=({values:n},e)=>n[e],wL=({type:n,values:e},r)=>n.precision!==Yl.HALF?e[r]:dk(e[r]),TL=(n,e)=>n.type.unit===nf.DAY?Rk(n,e):Pk(n,e),Dk=({values:n},e)=>1e3*w2(n,e*2),zk=({values:n},e)=>w2(n,e*2),Fk=({values:n},e)=>hL(n,e*2),Bk=({values:n},e)=>fL(n,e*2),kL=(n,e)=>{switch(n.type.unit){case wa.SECOND:return Dk(n,e);case wa.MILLISECOND:return zk(n,e);case wa.MICROSECOND:return Fk(n,e);case wa.NANOSECOND:return Bk(n,e)}},Nk=({values:n},e)=>n[e],Vk=({values:n},e)=>n[e],jk=({values:n},e)=>n[e],Uk=({values:n},e)=>n[e],ML=(n,e)=>{switch(n.type.unit){case wa.SECOND:return Nk(n,e);case wa.MILLISECOND:return Vk(n,e);case wa.MICROSECOND:return jk(n,e);case wa.NANOSECOND:return Uk(n,e)}},AL=({values:n,stride:e},r)=>y2.decimal(n.subarray(e*r,e*(r+1))),SL=(n,e)=>{const{valueOffsets:r,stride:C,children:D}=n,{[e*C]:T,[e*C+1]:p}=r,d=D[0].slice(T,p-T);return new Ta([d])},CL=(n,e)=>{const{valueOffsets:r,children:C}=n,{[e]:D,[e+1]:T}=r,p=C[0];return new T2(p.slice(D,T-D))},EL=(n,e)=>new _2(n,e),LL=(n,e)=>n.type.mode===xu.Dense?Hk(n,e):Gk(n,e),Hk=(n,e)=>{const r=n.type.typeIdToChildIndex[n.typeIds[e]],C=n.children[r];return Xl.visit(C,n.valueOffsets[e])},Gk=(n,e)=>{const r=n.type.typeIdToChildIndex[n.typeIds[e]],C=n.children[r];return Xl.visit(C,e)},IL=(n,e)=>{var r;return(r=n.dictionary)===null||r===void 0?void 0:r.get(n.values[e])},RL=(n,e)=>n.type.unit===Hf.DAY_TIME?qk(n,e):Wk(n,e),qk=({values:n},e)=>n.subarray(2*e,2*(e+1)),Wk=({values:n},e)=>{const r=n[e],C=new Int32Array(2);return C[0]=Math.trunc(r/12),C[1]=Math.trunc(r%12),C},PL=(n,e)=>{const{stride:r,children:C}=n,T=C[0].slice(e*r,r);return new Ta([T])};Ti.prototype.visitNull=Ei(mL);Ti.prototype.visitBool=Ei(gL);Ti.prototype.visitInt=Ei(_L);Ti.prototype.visitInt8=Ei(Kf);Ti.prototype.visitInt16=Ei(Kf);Ti.prototype.visitInt32=Ei(Kf);Ti.prototype.visitInt64=Ei(Ok);Ti.prototype.visitUint8=Ei(Kf);Ti.prototype.visitUint16=Ei(Kf);Ti.prototype.visitUint32=Ei(Kf);Ti.prototype.visitUint64=Ei(Ok);Ti.prototype.visitFloat=Ei(wL);Ti.prototype.visitFloat16=Ei(vL);Ti.prototype.visitFloat32=Ei(Kf);Ti.prototype.visitFloat64=Ei(Kf);Ti.prototype.visitUtf8=Ei(xL);Ti.prototype.visitBinary=Ei(bL);Ti.prototype.visitFixedSizeBinary=Ei(yL);Ti.prototype.visitDate=Ei(TL);Ti.prototype.visitDateDay=Ei(Rk);Ti.prototype.visitDateMillisecond=Ei(Pk);Ti.prototype.visitTimestamp=Ei(kL);Ti.prototype.visitTimestampSecond=Ei(Dk);Ti.prototype.visitTimestampMillisecond=Ei(zk);Ti.prototype.visitTimestampMicrosecond=Ei(Fk);Ti.prototype.visitTimestampNanosecond=Ei(Bk);Ti.prototype.visitTime=Ei(ML);Ti.prototype.visitTimeSecond=Ei(Nk);Ti.prototype.visitTimeMillisecond=Ei(Vk);Ti.prototype.visitTimeMicrosecond=Ei(jk);Ti.prototype.visitTimeNanosecond=Ei(Uk);Ti.prototype.visitDecimal=Ei(AL);Ti.prototype.visitList=Ei(SL);Ti.prototype.visitStruct=Ei(EL);Ti.prototype.visitUnion=Ei(LL);Ti.prototype.visitDenseUnion=Ei(Hk);Ti.prototype.visitSparseUnion=Ei(Gk);Ti.prototype.visitDictionary=Ei(IL);Ti.prototype.visitInterval=Ei(RL);Ti.prototype.visitIntervalDayTime=Ei(qk);Ti.prototype.visitIntervalYearMonth=Ei(Wk);Ti.prototype.visitFixedSizeList=Ei(PL);Ti.prototype.visitMap=Ei(CL);const Xl=new Ti,lh=Symbol.for("keys"),qp=Symbol.for("vals");class T2{constructor(e){return this[lh]=new Ta([e.children[0]]).memoize(),this[qp]=e.children[1],new Proxy(this,new DL)}[Symbol.iterator](){return new OL(this[lh],this[qp])}get size(){return this[lh].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[lh],r=this[qp],C={};for(let D=-1,T=e.length;++D`${Cm(e)}: ${Cm(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class OL{constructor(e,r){this.keys=e,this.vals=r,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),Xl.visit(this.vals,e)]})}}class DL{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[lh].toArray().map(String)}has(e,r){return e[lh].includes(r)}getOwnPropertyDescriptor(e,r){if(e[lh].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];const C=e[lh].indexOf(r);if(C!==-1){const D=Xl.visit(Reflect.get(e,qp),C);return Reflect.set(e,r,D),D}}set(e,r,C){const D=e[lh].indexOf(r);return D!==-1?(nc.visit(Reflect.get(e,qp),D,C),Reflect.set(e,r,C)):Reflect.has(e,r)?Reflect.set(e,r,C):!1}}Object.defineProperties(T2.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[lh]:{writable:!0,enumerable:!1,configurable:!1,value:null},[qp]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let J3;function Yk(n,e,r,C){const{length:D=0}=n;let T=typeof e!="number"?0:e,p=typeof r!="number"?D:r;return T<0&&(T=(T%D+D)%D),p<0&&(p=(p%D+D)%D),pD&&(p=D),C?C(n,T,p):[T,p]}const Q3=n=>n!==n;function v0(n){if(typeof n!=="object"||n===null)return Q3(n)?Q3:r=>r===n;if(n instanceof Date){const r=n.valueOf();return C=>C instanceof Date?C.valueOf()===r:!1}return ArrayBuffer.isView(n)?r=>r?C9(n,r):!1:n instanceof Map?FL(n):Array.isArray(n)?zL(n):n instanceof Ta?BL(n):NL(n,!0)}function zL(n){const e=[];for(let r=-1,C=n.length;++r!1;const C=[];for(let D=-1,T=r.length;++D{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return VL(n,r);case Map:return e5(n,r,r.keys());case T2:case _2:case Object:case void 0:return e5(n,r,e||Object.keys(r))}return r instanceof Ta?jL(n,r):!1}}function VL(n,e){const r=n.length;if(e.length!==r)return!1;for(let C=-1;++C>C}function k2(n,e,r){const C=r.byteLength+7&-8;if(n>0||r.byteLength>3):qv(new M2(r,n,e,null,$k)).subarray(0,C)),D}return r}function qv(n){const e=[];let r=0,C=0,D=0;for(const p of n)p&&(D|=1<0)&&(e[r++]=D);const T=new Uint8Array(e.length+7&-8);return T.set(e),T}class M2{constructor(e,r,C,D,T){this.bytes=e,this.length=C,this.context=D,this.get=T,this.bit=r%8,this.byteIndex=r>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,D=e+(e%8===0?0:8-e%8);return qb(n,e,D)+qb(n,C,r)+HL(n,D>>3,C-D>>3)}function HL(n,e,r){let C=0,D=Math.trunc(e);const T=new DataView(n.buffer,n.byteOffset,n.byteLength),p=r===void 0?n.byteLength:D+r;for(;p-D>=4;)C+=cb(T.getUint32(D)),D+=4;for(;p-D>=2;)C+=cb(T.getUint16(D)),D+=2;for(;p-D>=1;)C+=cb(T.getUint8(D)),D+=1;return C}function cb(n){let e=Math.trunc(n);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const GL=-1;class Qa{constructor(e,r,C,D,T,p=[],t){this.type=e,this.children=p,this.dictionary=t,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(C||0,0)),this._nullCount=Math.floor(Math.max(D||0,-1));let d;T instanceof Qa?(this.stride=T.stride,this.values=T.values,this.typeIds=T.typeIds,this.nullBitmap=T.nullBitmap,this.valueOffsets=T.valueOffsets):(this.stride=Wh(e),T&&((d=T[0])&&(this.valueOffsets=d),(d=T[1])&&(this.values=d),(d=T[2])&&(this.nullBitmap=d),(d=T[3])&&(this.typeIds=d))),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 e=0;const{valueOffsets:r,values:C,nullBitmap:D,typeIds:T}=this;return r&&(e+=r.byteLength),C&&(e+=C.byteLength),D&&(e+=D.byteLength),T&&(e+=T.byteLength),this.children.reduce((p,t)=>p+t.byteLength,e)}get nullCount(){let e=this._nullCount,r;return e<=GL&&(r=this.nullBitmap)&&(this._nullCount=e=this.length-qb(r,this.offset,this.offset+this.length)),e}getValid(e){if(this.nullable&&this.nullCount>0){const r=this.offset+e;return(this.nullBitmap[r>>3]&1<>3){const{nullBitmap:d}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:d,_nullCount:0})}const{nullBitmap:C,offset:D}=this,T=D+e>>3,p=(D+e)%8,t=C[T]>>p&1;return r?t===0&&(C[T]|=1<>3).fill(255,0,r>>3);D[r>>3]=(1<0&&D.set(k2(this.offset,r,this.nullBitmap),0);const T=this.buffers;return T[qh.VALIDITY]=D,this.clone(this.type,0,e,C+(e-r),T)}_sliceBuffers(e,r,C,D){let T;const{buffers:p}=this;return(T=p[qh.TYPE])&&(p[qh.TYPE]=T.subarray(e,e+r)),(T=p[qh.OFFSET])&&(p[qh.OFFSET]=T.subarray(e,e+r+1))||(T=p[qh.DATA])&&(p[qh.DATA]=D===6?T:T.subarray(C*e,C*(e+r))),p}_sliceChildren(e,r,C){return e.map(D=>D.slice(r,C))}}Qa.prototype.children=Object.freeze([]);class mm extends aa{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:r,["offset"]:C=0,["length"]:D=0}=e;return new Qa(r,C,D,0)}visitBool(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length>>3,["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitInt(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length,["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitFloat(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length,["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitUtf8(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.data),T=_a(e.nullBitmap),p=rm(e.valueOffsets),{["length"]:t=p.length-1,["nullCount"]:d=e.nullBitmap?-1:0}=e;return new Qa(r,C,t,d,[p,D,T])}visitBinary(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.data),T=_a(e.nullBitmap),p=rm(e.valueOffsets),{["length"]:t=p.length-1,["nullCount"]:d=e.nullBitmap?-1:0}=e;return new Qa(r,C,t,d,[p,D,T])}visitFixedSizeBinary(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length/Wh(r),["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitDate(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length/Wh(r),["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitTimestamp(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length/Wh(r),["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitTime(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length/Wh(r),["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitDecimal(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length/Wh(r),["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitList(e){const{["type"]:r,["offset"]:C=0,["child"]:D}=e,T=_a(e.nullBitmap),p=rm(e.valueOffsets),{["length"]:t=p.length-1,["nullCount"]:d=e.nullBitmap?-1:0}=e;return new Qa(r,C,t,d,[p,void 0,T],[D])}visitStruct(e){const{["type"]:r,["offset"]:C=0,["children"]:D=[]}=e,T=_a(e.nullBitmap),{length:p=D.reduce((d,{length:g})=>Math.max(d,g),0),nullCount:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,void 0,T],D)}visitUnion(e){const{["type"]:r,["offset"]:C=0,["children"]:D=[]}=e,T=_a(e.nullBitmap),p=qa(r.ArrayType,e.typeIds),{["length"]:t=p.length,["nullCount"]:d=e.nullBitmap?-1:0}=e;if(_i.isSparseUnion(r))return new Qa(r,C,t,d,[void 0,void 0,T,p],D);const g=rm(e.valueOffsets);return new Qa(r,C,t,d,[g,void 0,T,p],D)}visitDictionary(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.indices.ArrayType,e.data),{["dictionary"]:p=new Ta([new mm().visit({type:r.dictionary})])}=e,{["length"]:t=T.length,["nullCount"]:d=e.nullBitmap?-1:0}=e;return new Qa(r,C,t,d,[void 0,T,D],[],p)}visitInterval(e){const{["type"]:r,["offset"]:C=0}=e,D=_a(e.nullBitmap),T=qa(r.ArrayType,e.data),{["length"]:p=T.length/Wh(r),["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,T,D])}visitFixedSizeList(e){const{["type"]:r,["offset"]:C=0,["child"]:D=new mm().visit({type:r.valueType})}=e,T=_a(e.nullBitmap),{["length"]:p=D.length/Wh(r),["nullCount"]:t=e.nullBitmap?-1:0}=e;return new Qa(r,C,p,t,[void 0,void 0,T],[D])}visitMap(e){const{["type"]:r,["offset"]:C=0,["child"]:D=new mm().visit({type:r.childType})}=e,T=_a(e.nullBitmap),p=rm(e.valueOffsets),{["length"]:t=p.length-1,["nullCount"]:d=e.nullBitmap?-1:0}=e;return new Qa(r,C,t,d,[p,void 0,T],[D])}}function ra(n){return new mm().visit(n)}class t5{constructor(e=0,r){this.numChunks=e,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe+r.nullCount,0)}function Xk(n){return n.reduce((e,r,C)=>(e[C+1]=e[C]+r.length,e),new Uint32Array(n.length+1))}function Kk(n,e,r,C){const D=[];for(let T=-1,p=n.length;++T=C)break;if(r>=d+g)continue;if(d>=r&&d+g<=C){D.push(t);continue}const i=Math.max(0,r-d),M=Math.min(C-d,g);D.push(t.slice(i,M-i))}return D.length===0&&D.push(n[0].slice(0,0)),D}function A2(n,e,r,C){let D=0,T=0,p=e.length-1;do{if(D>=p-1)return r0?0:-1}function WL(n,e){const{nullBitmap:r}=n;if(!r||n.nullCount<=0)return-1;let C=0;for(const D of new M2(r,n.offset+(e||0),n.length,r,$k)){if(!D)return C;++C}return-1}function Vi(n,e,r){if(e===void 0)return-1;if(e===null)return WL(n,r);const C=Xl.getVisitFn(n),D=v0(e);for(let T=(r||0)-1,p=n.length;++T{const D=n.data[C];return D.values.subarray(0,D.length)[Symbol.iterator]()});let r=0;return new t5(n.data.length,C=>{const T=n.data[C].length,p=n.slice(r,r+T);return r+=T,new YL(p)})}class YL{constructor(e){this.vector=e,this.index=0}next(){return this.indexn+e;class Jf extends aa{visitNull(e,r){return 0}visitInt(e,r){return e.type.bitWidth/8}visitFloat(e,r){return e.type.ArrayType.BYTES_PER_ELEMENT}visitBool(e,r){return 1/8}visitDecimal(e,r){return e.type.bitWidth/8}visitDate(e,r){return(e.type.unit+1)*4}visitTime(e,r){return e.type.bitWidth/8}visitTimestamp(e,r){return e.type.unit===wa.SECOND?4:8}visitInterval(e,r){return(e.type.unit+1)*4}visitStruct(e,r){return e.children.reduce((C,D)=>C+_h.visit(D,r),0)}visitFixedSizeBinary(e,r){return e.type.byteWidth}visitMap(e,r){return 8+e.children.reduce((C,D)=>C+_h.visit(D,r),0)}visitDictionary(e,r){var C;return e.type.indices.bitWidth/8+(((C=e.dictionary)===null||C===void 0?void 0:C.getByteLength(e.values[r]))||0)}}const ZL=({valueOffsets:n},e)=>8+(n[e+1]-n[e]),XL=({valueOffsets:n},e)=>8+(n[e+1]-n[e]),KL=({valueOffsets:n,stride:e,children:r},C)=>{const D=r[0],{[C*e]:T}=n,{[C*e+1]:p}=n,t=_h.getVisitFn(D.type),d=D.slice(T,p-T);let g=8;for(let i=-1,M=p-T;++i{const C=e[0],D=C.slice(r*n,n),T=_h.getVisitFn(C.type);let p=0;for(let t=-1,d=D.length;++tn.type.mode===xu.Dense?tM(n,e):nM(n,e),tM=({type:n,children:e,typeIds:r,valueOffsets:C},D)=>{const T=n.typeIdToChildIndex[r[D]];return 8+_h.visit(e[T],C[D])},nM=({children:n},e)=>4+_h.visitMany(n,n.map(()=>e)).reduce($L,0);Jf.prototype.visitUtf8=ZL;Jf.prototype.visitBinary=XL;Jf.prototype.visitList=KL;Jf.prototype.visitFixedSizeList=JL;Jf.prototype.visitUnion=QL;Jf.prototype.visitDenseUnion=tM;Jf.prototype.visitSparseUnion=nM;const _h=new Jf;var rM;const iM={},aM={};class Ta{constructor(e){var r,C,D;const T=e[0]instanceof Ta?e.flatMap(t=>t.data):e;if(T.length===0||T.some(t=>!(t instanceof Qa)))throw new TypeError("Vector constructor expects an Array of Data instances.");const p=(r=T[0])===null||r===void 0?void 0:r.type;switch(T.length){case 0:this._offsets=[0];break;case 1:{const{get:t,set:d,indexOf:g,byteLength:i}=iM[p.typeId],M=T[0];this.isValid=v=>S2(M,v),this.get=v=>t(M,v),this.set=(v,f)=>d(M,v,f),this.indexOf=v=>g(M,v),this.getByteLength=v=>i(M,v),this._offsets=[0,M.length];break}default:Object.setPrototypeOf(this,aM[p.typeId]),this._offsets=Xk(T);break}this.data=T,this.type=p,this.stride=Wh(p),this.numChildren=(D=(C=p.children)===null||C===void 0?void 0:C.length)!==null&&D!==void 0?D:0,this.length=this._offsets[this._offsets.length-1]}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((e,r)=>e+r.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=Zk(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Jn[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}set(e,r){}indexOf(e,r){return-1}includes(e,r){return this.indexOf(e,r)>0}getByteLength(e){return 0}[Symbol.iterator](){return C2.visit(this)}concat(...e){return new Ta(this.data.concat(e.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(e,r){return new Ta(Yk(this,e,r,({data:C,_offsets:D},T,p)=>Kk(C,D,T,p)))}toJSON(){return[...this]}toArray(){const{type:e,data:r,length:C,stride:D,ArrayType:T}=this;switch(e.typeId){case Jn.Int:case Jn.Float:case Jn.Decimal:case Jn.Time:case Jn.Timestamp:switch(r.length){case 0:return new T;case 1:return r[0].values.subarray(0,C*D);default:return r.reduce((p,{values:t,length:d})=>(p.array.set(t.subarray(0,d*D),p.offset),p.offset+=d*D,p),{array:new T(C*D),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(C=>C.name===e))}getChildAt(e){return e>-1&&er[e])):null}get isMemoized(){return _i.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(_i.isDictionary(this.type)){const e=new Yv(this.data[0].dictionary),r=this.data.map(C=>{const D=C.clone();return D.dictionary=e,D});return new Ta(r)}return new Yv(this)}unmemoize(){if(_i.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),r=this.data.map(C=>{const D=C.clone();return D.dictionary=e,D});return new Ta(r)}return this}}rM=Symbol.toStringTag;Ta[rM]=(n=>{n.type=_i.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 e=Object.keys(Jn).map(r=>Jn[r]).filter(r=>typeof r=="number"&&r!==Jn.NONE);for(const r of e){const C=Xl.getVisitFnByTypeId(r),D=nc.getVisitFnByTypeId(r),T=Wv.getVisitFnByTypeId(r),p=_h.getVisitFnByTypeId(r);iM[r]={get:C,set:D,indexOf:T,byteLength:p},aM[r]=Object.create(n,{isValid:{value:Wp(S2)},get:{value:Wp(Xl.getVisitFnByTypeId(r))},set:{value:Jk(nc.getVisitFnByTypeId(r))},indexOf:{value:Qk(Wv.getVisitFnByTypeId(r))},getByteLength:{value:Wp(_h.getVisitFnByTypeId(r))}})}return"Vector"})(Ta.prototype);class Yv extends Ta{constructor(e){super(e.data);const r=this.get,C=this.set,D=this.slice,T=new Array(this.length);Object.defineProperty(this,"get",{value(p){const t=T[p];if(t!==void 0)return t;const d=r.call(this,p);return T[p]=d,d}}),Object.defineProperty(this,"set",{value(p,t){C.call(this,p,t),T[p]=t}}),Object.defineProperty(this,"slice",{value:(p,t)=>new Yv(D.call(this,p,t))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ta(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Wb{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,r,C,D){return e.prep(8,24),e.writeInt64(D),e.pad(4),e.writeInt32(C),e.writeInt64(r),e.offset()}}const hb=2,uh=4,$h=4,Wa=4,Pf=new Int32Array(2),n5=new Float32Array(Pf.buffer),r5=new Float64Array(Pf.buffer),av=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;let Jh=class Yb{constructor(e,r){this.low=e|0,this.high=r|0}static create(e,r){return e==0&&r==0?Yb.ZERO:new Yb(e,r)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}};Jh.ZERO=new Jh(0,0);var $b;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})($b||($b={}));let Jp=class oM{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new oM(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new Jh(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new Jh(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return Pf[0]=this.readInt32(e),n5[0]}readFloat64(e){return Pf[av?0:1]=this.readInt32(e),Pf[av?1:0]=this.readInt32(e+4),r5[0]}writeInt8(e,r){this.bytes_[e]=r}writeUint8(e,r){this.bytes_[e]=r}writeInt16(e,r){this.bytes_[e]=r,this.bytes_[e+1]=r>>8}writeUint16(e,r){this.bytes_[e]=r,this.bytes_[e+1]=r>>8}writeInt32(e,r){this.bytes_[e]=r,this.bytes_[e+1]=r>>8,this.bytes_[e+2]=r>>16,this.bytes_[e+3]=r>>24}writeUint32(e,r){this.bytes_[e]=r,this.bytes_[e+1]=r>>8,this.bytes_[e+2]=r>>16,this.bytes_[e+3]=r>>24}writeInt64(e,r){this.writeInt32(e,r.low),this.writeInt32(e+4,r.high)}writeUint64(e,r){this.writeUint32(e,r.low),this.writeUint32(e+4,r.high)}writeFloat32(e,r){n5[0]=r,this.writeInt32(e,Pf[0])}writeFloat64(e,r){r5[0]=r,this.writeInt32(e,Pf[av?0:1]),this.writeInt32(e+4,Pf[av?1:0])}getBufferIdentifier(){if(this.bytes_.length>10)+55296,(p&1024-1)+56320))}return D}__union_with_string(e,r){return typeof e=="string"?this.__string(r):this.__union(e,r)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+uh}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=$h)throw new Error("FlatBuffers: file identifier must be length "+$h);for(let r=0;r<$h;r++)if(e.charCodeAt(r)!=this.readInt8(this.position()+uh+r))return!1;return!0}createLong(e,r){return Jh.create(e,r)}createScalarList(e,r){const C=[];for(let D=0;Dthis.minalign&&(this.minalign=e);const C=~(this.bb.capacity()-this.space+r)+1&e-1;for(;this.space=0&&this.vtable[r]==0;r--);const C=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?e-this.vtable[r]:0);const D=2;this.addInt16(e-this.object_start);const T=(C+D)*hb;this.addInt16(T);let p=0;const t=this.space;e:for(r=0;r=0;p--)this.writeInt8(T.charCodeAt(p))}this.prep(this.minalign,uh+D),this.addOffset(e),D&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,r){this.finish(e,r,!0)}requiredField(e,r){const C=this.bb.capacity()-e,D=C-this.bb.readInt32(C);if(!(this.bb.readInt16(D+r)!=0))throw new Error("FlatBuffers: field "+r+" must be set")}startVector(e,r,C){this.notNested(),this.vector_num_elems=r,this.prep(uh,e*r),this.prep(C,e*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const r=this.createString(e);return this.string_maps.set(e,r),r}createString(e){if(!e)return 0;let r;if(e instanceof Uint8Array)r=e;else{r=[];let C=0;for(;C=56320)D=T;else{const p=e.charCodeAt(C++);D=(T<<10)+p+(65536-56623104-56320)}D<128?r.push(D):(D<2048?r.push(D>>6&31|192):(D<65536?r.push(D>>12&15|224):r.push(D>>18&7|240,D>>12&63|128),r.push(D>>6&63|128)),r.push(D&63|128))}}this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length);for(let C=0,D=this.space,T=this.bb.bytes();C=0;C--)e.addInt32(r[C]);return e.endVector()}static startTypeIdsVector(e,r){e.startVector(4,r,4)}static endUnion(e){return e.endObject()}static createUnion(e,r,C){return Gl.startUnion(e),Gl.addMode(e,r),Gl.addTypeIds(e,C),Gl.endUnion(e)}}class Pd{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsUtf8(e,r){return(r||new Pd).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,r){return e.setPosition(e.position()+Wa),(r||new Pd).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return Pd.startUtf8(e),Pd.endUtf8(e)}}var Ao;(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"})(Ao||(Ao={}));let qu=class yv{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsField(e,r){return(r||new yv).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,r){return e.setPosition(e.position()+Wa),(r||new yv).__init(e.readInt32(e.position())+e.position(),e)}name(e){const r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):Ao.NONE}type(e){const r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(e,this.bb_pos+r):null}dictionary(e){const r=this.bb.__offset(this.bb_pos,12);return r?(e||new Zh).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(e,r){const C=this.bb.__offset(this.bb_pos,14);return C?(r||new yv).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+C)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,r){const C=this.bb.__offset(this.bb_pos,16);return C?(r||new cs).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+C)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,r){e.addFieldOffset(0,r,0)}static addNullable(e,r){e.addFieldInt8(1,+r,0)}static addTypeType(e,r){e.addFieldInt8(2,r,Ao.NONE)}static addType(e,r){e.addFieldOffset(3,r,0)}static addDictionary(e,r){e.addFieldOffset(4,r,0)}static addChildren(e,r){e.addFieldOffset(5,r,0)}static createChildrenVector(e,r){e.startVector(4,r.length,4);for(let C=r.length-1;C>=0;C--)e.addOffset(r[C]);return e.endVector()}static startChildrenVector(e,r){e.startVector(4,r,4)}static addCustomMetadata(e,r){e.addFieldOffset(6,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let C=r.length-1;C>=0;C--)e.addOffset(r[C]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static endField(e){return e.endObject()}},ih=class Hh{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsSchema(e,r){return(r||new Hh).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,r){return e.setPosition(e.position()+Wa),(r||new Hh).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):e0.Little}fields(e,r){const C=this.bb.__offset(this.bb_pos,6);return C?(r||new qu).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+C)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,r){const C=this.bb.__offset(this.bb_pos,8);return C?(r||new cs).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+C)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+e*8):this.bb.createLong(0,0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,r){e.addFieldInt16(0,r,e0.Little)}static addFields(e,r){e.addFieldOffset(1,r,0)}static createFieldsVector(e,r){e.startVector(4,r.length,4);for(let C=r.length-1;C>=0;C--)e.addOffset(r[C]);return e.endVector()}static startFieldsVector(e,r){e.startVector(4,r,4)}static addCustomMetadata(e,r){e.addFieldOffset(2,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let C=r.length-1;C>=0;C--)e.addOffset(r[C]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static addFeatures(e,r){e.addFieldOffset(3,r,0)}static createFeaturesVector(e,r){e.startVector(8,r.length,8);for(let C=r.length-1;C>=0;C--)e.addInt64(r[C]);return e.endVector()}static startFeaturesVector(e,r){e.startVector(8,r,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,r){e.finish(r)}static finishSizePrefixedSchemaBuffer(e,r){e.finish(r,void 0,!0)}static createSchema(e,r,C,D,T){return Hh.startSchema(e),Hh.addEndianness(e,r),Hh.addFields(e,C),Hh.addCustomMetadata(e,D),Hh.addFeatures(e,T),Hh.endSchema(e)}};class fu{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsFooter(e,r){return(r||new fu).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,r){return e.setPosition(e.position()+Wa),(r||new fu).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Qp.V1}schema(e){const r=this.bb.__offset(this.bb_pos,6);return r?(e||new ih).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(e,r){const C=this.bb.__offset(this.bb_pos,8);return C?(r||new Wb).__init(this.bb.__vector(this.bb_pos+C)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,r){const C=this.bb.__offset(this.bb_pos,10);return C?(r||new Wb).__init(this.bb.__vector(this.bb_pos+C)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,r){const C=this.bb.__offset(this.bb_pos,12);return C?(r||new cs).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+C)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,r){e.addFieldInt16(0,r,Qp.V1)}static addSchema(e,r){e.addFieldOffset(1,r,0)}static addDictionaries(e,r){e.addFieldOffset(2,r,0)}static startDictionariesVector(e,r){e.startVector(24,r,8)}static addRecordBatches(e,r){e.addFieldOffset(3,r,0)}static startRecordBatchesVector(e,r){e.startVector(24,r,8)}static addCustomMetadata(e,r){e.addFieldOffset(4,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let C=r.length-1;C>=0;C--)e.addOffset(r[C]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,r){e.finish(r)}static finishSizePrefixedFooterBuffer(e,r){e.finish(r,void 0,!0)}}class Ea{constructor(e=[],r,C){this.fields=e||[],this.metadata=r||new Map,C||(C=Zb(e)),this.dictionaries=C}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,r)=>`${r}: ${e}`).join(", ")} }>`}select(e){const r=new Set(e),C=this.fields.filter(D=>r.has(D.name));return new Ea(C,this.metadata)}selectAt(e){const r=e.map(C=>this.fields[C]).filter(Boolean);return new Ea(r,this.metadata)}assign(...e){const r=e[0]instanceof Ea?e[0]:Array.isArray(e[0])?new Ea(e[0]):new Ea(e),C=[...this.fields],D=ov(ov(new Map,this.metadata),r.metadata),T=r.fields.filter(t=>{const d=C.findIndex(g=>g.name===t.name);return~d?(C[d]=t.clone({metadata:ov(ov(new Map,C[d].metadata),t.metadata)}))&&!1:!0}),p=Zb(T,new Map);return new Ea([...C,...T],D,new Map([...this.dictionaries,...p]))}}Ea.prototype.fields=null;Ea.prototype.metadata=null;Ea.prototype.dictionaries=null;class ao{constructor(e,r,C=!1,D){this.name=e,this.type=r,this.nullable=C,this.metadata=D||new Map}static new(...e){let[r,C,D,T]=e;return e[0]&&typeof e[0]=="object"&&({name:r}=e[0],C===void 0&&(C=e[0].type),D===void 0&&(D=e[0].nullable),T===void 0&&(T=e[0].metadata)),new ao(`${r}`,C,D,T)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[r,C,D,T]=e;return!e[0]||typeof e[0]!="object"?[r=this.name,C=this.type,D=this.nullable,T=this.metadata]=e:{name:r=this.name,type:C=this.type,nullable:D=this.nullable,metadata:T=this.metadata}=e[0],ao.new(r,C,D,T)}}ao.prototype.type=null;ao.prototype.name=null;ao.prototype.nullable=null;ao.prototype.metadata=null;function ov(n,e){return new Map([...n||new Map,...e||new Map])}function Zb(n,e=new Map){for(let r=-1,C=n.length;++r0&&Zb(T.children,e)}return e}var i5=Jh,eI=sM,tI=Jp;class Pm{constructor(e,r=gu.V4,C,D){this.schema=e,this.version=r,C&&(this._recordBatches=C),D&&(this._dictionaryBatches=D)}static decode(e){e=new tI(_a(e));const r=fu.getRootAsFooter(e),C=Ea.decode(r.schema());return new nI(C,r)}static encode(e){const r=new eI,C=Ea.encode(r,e.schema);fu.startRecordBatchesVector(r,e.numRecordBatches);for(const p of[...e.recordBatches()].slice().reverse())Wf.encode(r,p);const D=r.endVector();fu.startDictionariesVector(r,e.numDictionaries);for(const p of[...e.dictionaryBatches()].slice().reverse())Wf.encode(r,p);const T=r.endVector();return fu.startFooter(r),fu.addSchema(r,C),fu.addVersion(r,gu.V4),fu.addRecordBatches(r,D),fu.addDictionaries(r,T),fu.finishFooterBuffer(r,fu.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let e,r=-1,C=this.numRecordBatches;++r=0&&e=0&&e=0&&e=0&ðis._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return yi(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(So);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return $u.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return $u.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return yi(this,void 0,void 0,function*(){return yield this.abort(e),So})}return(e){return yi(this,void 0,void 0,function*(){return yield this.close(),So})}read(e){return yi(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return yi(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,C)=>{this.resolvers.push({resolve:r,reject:C})}):Promise.resolve(So)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class bv extends rI{write(e){if((e=_a(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?jb(this.toUint8Array(!0)):this.toUint8Array(!1).then(jb)}toUint8Array(e=!1){return e?xh(this._values)[0]:(()=>yi(this,void 0,void 0,function*(){var r,C;const D=[];let T=0;try{for(var p=Nd(this),t;t=yield p.next(),!t.done;){const d=t.value;D.push(d),T+=d.byteLength}}catch(d){r={error:d}}finally{try{t&&!t.done&&(C=p.return)&&(yield C.call(p))}finally{if(r)throw r.error}}return xh(D,T)[0]}))()}}class Qv{constructor(e){e&&(this.source=new iI($u.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class n0{constructor(e){e instanceof n0?this.source=e.source:e instanceof bv?this.source=new xd($u.fromAsyncIterable(e)):G4(e)?this.source=new xd($u.fromNodeStream(e)):m2(e)?this.source=new xd($u.fromDOMStream(e)):H4(e)?this.source=new xd($u.fromDOMStream(e.body)):Zm(e)?this.source=new xd($u.fromIterable(e)):Uf(e)?this.source=new xd($u.fromAsyncIterable(e)):g0(e)&&(this.source=new xd($u.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class iI{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,r="read"){return this.source.next({cmd:r,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||So)}return(e){return Object.create(this.source.return&&this.source.return(e)||So)}}class xd{constructor(e){this.source=e,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(e){return yi(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return yi(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return yi(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e,r="read"){return yi(this,void 0,void 0,function*(){return yield this.source.next({cmd:r,size:e})})}throw(e){return yi(this,void 0,void 0,function*(){const r=this.source.throw&&(yield this.source.throw(e))||So;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(e){return yi(this,void 0,void 0,function*(){const r=this.source.return&&(yield this.source.return(e))||So;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}}class o5 extends Qv{constructor(e,r){super(),this.position=0,this.buffer=_a(e),this.size=typeof r>"u"?this.buffer.byteLength:r}readInt32(e){const{buffer:r,byteOffset:C}=this.readAt(e,4);return new DataView(r,C).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),eyi(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending}))()}readInt32(e){return yi(this,void 0,void 0,function*(){const{buffer:r,byteOffset:C}=yield this.readAt(e,4);return new DataView(r,C).getInt32(0,!0)})}seek(e){return yi(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),C=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let D=r[3]*C[3];this.buffer[0]=D&65535;let T=D>>>16;return D=r[2]*C[3],T+=D,D=r[3]*C[2]>>>0,T+=D,this.buffer[0]+=T<<16,this.buffer[1]=T>>>0>>16,this.buffer[1]+=r[1]*C[3]+r[2]*C[2]+r[3]*C[1],this.buffer[1]+=r[0]*C[3]+r[1]*C[2]+r[2]*C[1]+r[3]*C[0]<<16,this}_plus(e){const r=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],r>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(e){return this.buffer[1]>>0,r[2]=this.buffer[2]+e.buffer[2]>>>0,r[1]=this.buffer[1]+e.buffer[1]>>>0,r[0]=this.buffer[0]+e.buffer[0]>>>0,r[0]>>0&&++r[1],r[1]>>0&&++r[2],r[2]>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${zp(this.buffer[3])} ${zp(this.buffer[2])} ${zp(this.buffer[1])} ${zp(this.buffer[0])}`}static multiply(e,r){return new ah(new Uint32Array(e.buffer)).times(r)}static add(e,r){return new ah(new Uint32Array(e.buffer)).plus(r)}static from(e,r=new Uint32Array(4)){return ah.fromString(typeof e=="string"?e:e.toString(),r)}static fromNumber(e,r=new Uint32Array(4)){return ah.fromString(e.toString(),r)}static fromString(e,r=new Uint32Array(4)){const C=e.startsWith("-"),D=e.length,T=new ah(r);for(let p=C?1:0;p0&&this.readData(e,C)||new Uint8Array(0)}readOffsets(e,r){return this.readData(e,r)}readTypeIds(e,r){return this.readData(e,r)}readData(e,{length:r,offset:C}=this.nextBufferRange()){return this.bytes.subarray(C,C+r)}readDictionary(e){return this.dictionaries.get(e.id)}}class oI extends cM{constructor(e,r,C,D){super(new Uint8Array(0),r,C,D),this.sources=e}readNullBitmap(e,r,{offset:C}=this.nextBufferRange()){return r<=0?new Uint8Array(0):qv(this.sources[C])}readOffsets(e,{offset:r}=this.nextBufferRange()){return qa(Uint8Array,qa(Int32Array,this.sources[r]))}readTypeIds(e,{offset:r}=this.nextBufferRange()){return qa(Uint8Array,qa(e.ArrayType,this.sources[r]))}readData(e,{offset:r}=this.nextBufferRange()){const{sources:C}=this;return _i.isTimestamp(e)||(_i.isInt(e)||_i.isTime(e))&&e.bitWidth===64||_i.isDate(e)&&e.unit===nf.MILLISECOND?qa(Uint8Array,Vl.convertArray(C[r])):_i.isDecimal(e)?qa(Uint8Array,ah.convertArray(C[r])):_i.isBinary(e)||_i.isFixedSizeBinary(e)?sI(C[r]):_i.isBool(e)?qv(C[r]):_i.isUtf8(e)?p2(C[r].join("")):qa(Uint8Array,qa(e.ArrayType,C[r].map(D=>+D)))}}function sI(n){const e=n.join(""),r=new Uint8Array(e.length/2);for(let C=0;C>1]=Number.parseInt(e.slice(C,C+2),16);return r}class Ai extends aa{compareSchemas(e,r){return e===r||r instanceof e.constructor&&this.compareManyFields(e.fields,r.fields)}compareManyFields(e,r){return e===r||Array.isArray(e)&&Array.isArray(r)&&e.length===r.length&&e.every((C,D)=>this.compareFields(C,r[D]))}compareFields(e,r){return e===r||r instanceof e.constructor&&e.name===r.name&&e.nullable===r.nullable&&this.visit(e.type,r.type)}}function Kl(n,e){return e instanceof n.constructor}function Xm(n,e){return n===e||Kl(n,e)}function hf(n,e){return n===e||Kl(n,e)&&n.bitWidth===e.bitWidth&&n.isSigned===e.isSigned}function Gy(n,e){return n===e||Kl(n,e)&&n.precision===e.precision}function lI(n,e){return n===e||Kl(n,e)&&n.byteWidth===e.byteWidth}function I2(n,e){return n===e||Kl(n,e)&&n.unit===e.unit}function Km(n,e){return n===e||Kl(n,e)&&n.unit===e.unit&&n.timezone===e.timezone}function Jm(n,e){return n===e||Kl(n,e)&&n.unit===e.unit&&n.bitWidth===e.bitWidth}function uI(n,e){return n===e||Kl(n,e)&&n.children.length===e.children.length&&Yf.compareManyFields(n.children,e.children)}function cI(n,e){return n===e||Kl(n,e)&&n.children.length===e.children.length&&Yf.compareManyFields(n.children,e.children)}function R2(n,e){return n===e||Kl(n,e)&&n.mode===e.mode&&n.typeIds.every((r,C)=>r===e.typeIds[C])&&Yf.compareManyFields(n.children,e.children)}function hI(n,e){return n===e||Kl(n,e)&&n.id===e.id&&n.isOrdered===e.isOrdered&&Yf.visit(n.indices,e.indices)&&Yf.visit(n.dictionary,e.dictionary)}function P2(n,e){return n===e||Kl(n,e)&&n.unit===e.unit}function fI(n,e){return n===e||Kl(n,e)&&n.listSize===e.listSize&&n.children.length===e.children.length&&Yf.compareManyFields(n.children,e.children)}function dI(n,e){return n===e||Kl(n,e)&&n.keysSorted===e.keysSorted&&n.children.length===e.children.length&&Yf.compareManyFields(n.children,e.children)}Ai.prototype.visitNull=Xm;Ai.prototype.visitBool=Xm;Ai.prototype.visitInt=hf;Ai.prototype.visitInt8=hf;Ai.prototype.visitInt16=hf;Ai.prototype.visitInt32=hf;Ai.prototype.visitInt64=hf;Ai.prototype.visitUint8=hf;Ai.prototype.visitUint16=hf;Ai.prototype.visitUint32=hf;Ai.prototype.visitUint64=hf;Ai.prototype.visitFloat=Gy;Ai.prototype.visitFloat16=Gy;Ai.prototype.visitFloat32=Gy;Ai.prototype.visitFloat64=Gy;Ai.prototype.visitUtf8=Xm;Ai.prototype.visitBinary=Xm;Ai.prototype.visitFixedSizeBinary=lI;Ai.prototype.visitDate=I2;Ai.prototype.visitDateDay=I2;Ai.prototype.visitDateMillisecond=I2;Ai.prototype.visitTimestamp=Km;Ai.prototype.visitTimestampSecond=Km;Ai.prototype.visitTimestampMillisecond=Km;Ai.prototype.visitTimestampMicrosecond=Km;Ai.prototype.visitTimestampNanosecond=Km;Ai.prototype.visitTime=Jm;Ai.prototype.visitTimeSecond=Jm;Ai.prototype.visitTimeMillisecond=Jm;Ai.prototype.visitTimeMicrosecond=Jm;Ai.prototype.visitTimeNanosecond=Jm;Ai.prototype.visitDecimal=Xm;Ai.prototype.visitList=uI;Ai.prototype.visitStruct=cI;Ai.prototype.visitUnion=R2;Ai.prototype.visitDenseUnion=R2;Ai.prototype.visitSparseUnion=R2;Ai.prototype.visitDictionary=hI;Ai.prototype.visitInterval=P2;Ai.prototype.visitIntervalDayTime=P2;Ai.prototype.visitIntervalYearMonth=P2;Ai.prototype.visitFixedSizeList=fI;Ai.prototype.visitMap=dI;const Yf=new Ai;function Xb(n,e){return Yf.compareSchemas(n,e)}function fb(n,e){return pI(n,e.map(r=>r.data.concat()))}function pI(n,e){const r=[...n.fields],C=[],D={numBatches:e.reduce((M,v)=>Math.max(M,v.length),0)};let T=0,p=0,t=-1;const d=e.length;let g,i=[];for(;D.numBatches-- >0;){for(p=Number.POSITIVE_INFINITY,t=-1;++t0&&(C[T++]=ra({type:new bl(r),length:p,nullCount:0,children:i.slice()})))}return[n=n.assign(r),C.map(M=>new ql(n,M))]}function mI(n,e,r,C,D){var T;const p=(e+63&-64)>>3;for(let t=-1,d=C.length;++t=e)i===e?r[t]=g:(r[t]=g.slice(0,e),D.numBatches=Math.max(D.numBatches,C[t].unshift(g.slice(e,i-e))));else{const M=n[t];n[t]=M.clone({nullable:!0}),r[t]=(T=g==null?void 0:g._changeLengthAndBackfillNullBitmap(e))!==null&&T!==void 0?T:ra({type:M.type,length:e,nullCount:e,nullBitmap:new Uint8Array(p)})}}return r}var hM;class ml{constructor(...e){var r,C;if(e.length===0)return this.batches=[],this.schema=new Ea([]),this._offsets=[0],this;let D,T;e[0]instanceof Ea&&(D=e.shift()),e[e.length-1]instanceof Uint32Array&&(T=e.pop());const p=d=>{if(d){if(d instanceof ql)return[d];if(d instanceof ml)return d.batches;if(d instanceof Qa){if(d.type instanceof bl)return[new ql(new Ea(d.type.children),d)]}else{if(Array.isArray(d))return d.flatMap(g=>p(g));if(typeof d[Symbol.iterator]=="function")return[...d].flatMap(g=>p(g));if(typeof d=="object"){const g=Object.keys(d),i=g.map(f=>new Ta([d[f]])),M=new Ea(g.map((f,l)=>new ao(String(f),i[l].type))),[,v]=fb(M,i);return v.length===0?[new ql(d)]:v}}}return[]},t=e.flatMap(d=>p(d));if(D=(C=D??((r=t[0])===null||r===void 0?void 0:r.schema))!==null&&C!==void 0?C:new Ea([]),!(D instanceof Ea))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const d of t){if(!(d instanceof ql))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Xb(D,d.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=D,this.batches=t,this._offsets=T??Xk(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,r)=>e+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Zk(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}set(e,r){}indexOf(e,r){return-1}getByteLength(e){return 0}[Symbol.iterator](){return this.batches.length>0?C2.visit(new Ta(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
${this.toArray().join(`,
`)}
-]`}concat(...e){const r=this.schema,C=this.data.concat(e.flatMap(({data:D})=>D));return new vl(r,C.map(D=>new Wl(r,D)))}slice(e,r){const C=this.schema;[e,r]=Wk({length:this.numRows},e,r);const D=Xk(this.data,this._offsets,e,r);return new vl(C,D.map(k=>new Wl(C,k)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===e))}getChildAt(e){if(e>-1&&eC.children[e]);if(r.length===0){const{type:C}=this.schema.fields[e],D=ia({type:C,length:0,nullCount:0});r.push(D._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ta(r)}return null}setChild(e,r){var C;return this.setChildAt((C=this.schema.fields)===null||C===void 0?void 0:C.findIndex(D=>D.name===e),r)}setChildAt(e,r){let C=this.schema,D=[...this.batches];if(e>-1&ðis.getChildAt(y));[k[e],t[e]]=[m,r],[C,D]=hb(C,t)}return new vl(C,D)}select(e){const r=this.schema.fields.reduce((C,D,k)=>C.set(D.name,k),new Map);return this.selectAt(e.map(C=>r.get(C)).filter(C=>C>-1))}selectAt(e){const r=this.schema.selectAt(e),C=this.batches.map(D=>D.selectAt(e));return new vl(r,C)}assign(e){const r=this.schema.fields,[C,D]=e.schema.fields.reduce((t,d,y)=>{const[i,M]=t,v=r.findIndex(h=>h.name===d.name);return~v?M[v]=y:i.push(y),t},[[],[]]),k=this.schema.assign(e.schema),m=[...r.map((t,d)=>[d,D[d]]).map(([t,d])=>d===void 0?this.getChildAt(t):e.getChildAt(d)),...C.map(t=>e.getChildAt(t))].filter(Boolean);return new vl(...hb(k,m))}}cM=Symbol.toStringTag;vl[cM]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=Wp(S2),n.get=Wp(Xl.getVisitFn(Jn.Struct)),n.set=Kk(rc.getVisitFn(Jn.Struct)),n.indexOf=Jk(Wv.getVisitFn(Jn.Struct)),n.getByteLength=Wp(wf.getVisitFn(Jn.Struct)),"Table"))(vl.prototype);var fM;let Wl=class sm{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof Ea))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=ia({nullCount:0,type:new xl(this.schema.fields),children:this.schema.fields.map(r=>ia({type:r.type,nullCount:0}))})]=e,!(this.data instanceof Qa))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=s5(this.schema,this.data.children);break}case 1:{const[r]=e,{fields:C,children:D,length:k}=Object.keys(r).reduce((d,y,i)=>(d.children[i]=r[y],d.length=Math.max(d.length,r[y].length),d.fields[i]=ao.new({name:y,type:r[y].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),m=new Ea(C),t=ia({type:new xl(C),length:k,children:D,nullCount:0});[this.schema,this.data]=s5(m,t.children,k);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=hM(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return Xl.visit(this.data,e)}set(e,r){return rc.visit(this.data,e,r)}indexOf(e,r){return Wv.visit(this.data,e,r)}getByteLength(e){return wf.visit(this.data,e)}[Symbol.iterator](){return C2.visit(new Ta([this.data]))}toArray(){return[...this]}concat(...e){return new vl(this.schema,[this,...e])}slice(e,r){const[C]=new Ta([this.data]).slice(e,r).data;return new sm(this.schema,C)}getChild(e){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(C=>C.name===e))}getChildAt(e){return e>-1&&eD.name===e),r)}setChildAt(e,r){let C=this.schema,D=this.data;if(e>-1&&et.name===k);~m&&(D[m]=this.data.children[m])}return new sm(r,ia({type:C,length:this.numRows,children:D}))}selectAt(e){const r=this.schema.selectAt(e),C=e.map(k=>this.data.children[k]).filter(Boolean),D=ia({type:new xl(r.fields),length:this.numRows,children:C});return new sm(r,D)}};fM=Symbol.toStringTag;Wl[fM]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Wl.prototype);function s5(n,e,r=e.reduce((C,D)=>Math.max(C,D.length),0)){var C;const D=[...n.fields],k=[...e],m=(r+63&-64)>>3;for(const[t,d]of n.fields.entries()){const y=e[t];(!y||y.length!==r)&&(D[t]=d.clone({nullable:!0}),k[t]=(C=y==null?void 0:y._changeLengthAndBackfillNullBitmap(r))!==null&&C!==void 0?C:ia({type:d.type,length:r,nullCount:r,nullBitmap:new Uint8Array(m)}))}return[n.assign(D),ia({type:new xl(D),length:r,children:k})]}function hM(n,e,r=new Map){for(let C=-1,D=n.length;++C0&&hM(m.children,t.children,r)}return r}class O2 extends Wl{constructor(e){const r=e.fields.map(D=>ia({type:D.type})),C=ia({type:new xl(e.fields),nullCount:0,children:r});super(e,C)}}var ty;(function(n){n[n.BUFFER=0]="BUFFER"})(ty||(ty={}));var ny;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(ny||(ny={}));class Oh{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsBodyCompression(e,r){return(r||new Oh).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,r){return e.setPosition(e.position()+Wa),(r||new Oh).__init(e.readInt32(e.position())+e.position(),e)}codec(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):ny.LZ4_FRAME}method(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):ty.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,r){e.addFieldInt8(0,r,ny.LZ4_FRAME)}static addMethod(e,r){e.addFieldInt8(1,r,ty.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,r,C){return Oh.startBodyCompression(e),Oh.addCodec(e,r),Oh.addMethod(e,C),Oh.endBodyCompression(e)}}let dM=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,r,C){return e.prep(8,16),e.writeInt64(C),e.writeInt64(r),e.offset()}},pM=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,r,C){return e.prep(8,16),e.writeInt64(C),e.writeInt64(r),e.offset()}},Yf=class Kb{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsRecordBatch(e,r){return(r||new Kb).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,r){return e.setPosition(e.position()+Wa),(r||new Kb).__init(e.readInt32(e.position())+e.position(),e)}length(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}nodes(e,r){const C=this.bb.__offset(this.bb_pos,6);return C?(r||new pM).__init(this.bb.__vector(this.bb_pos+C)+e*16,this.bb):null}nodesLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,r){const C=this.bb.__offset(this.bb_pos,8);return C?(r||new dM).__init(this.bb.__vector(this.bb_pos+C)+e*16,this.bb):null}buffersLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){const r=this.bb.__offset(this.bb_pos,10);return r?(e||new Oh).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,r){e.addFieldInt64(0,r,e.createLong(0,0))}static addNodes(e,r){e.addFieldOffset(1,r,0)}static startNodesVector(e,r){e.startVector(16,r,8)}static addBuffers(e,r){e.addFieldOffset(2,r,0)}static startBuffersVector(e,r){e.startVector(16,r,8)}static addCompression(e,r){e.addFieldOffset(3,r,0)}static endRecordBatch(e){return e.endObject()}},Dp=class Jb{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsDictionaryBatch(e,r){return(r||new Jb).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,r){return e.setPosition(e.position()+Wa),(r||new Jb).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}data(e){const r=this.bb.__offset(this.bb_pos,6);return r?(e||new Yf).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,r){e.addFieldInt64(0,r,e.createLong(0,0))}static addData(e,r){e.addFieldOffset(1,r,0)}static addIsDelta(e,r){e.addFieldInt8(2,+r,0)}static endDictionaryBatch(e){return e.endObject()}};var ry;(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"})(ry||(ry={}));let Eh=class rf{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsMessage(e,r){return(r||new rf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,r){return e.setPosition(e.position()+Wa),(r||new rf).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Qp.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):ry.NONE}header(e){const r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(e,this.bb_pos+r):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}customMetadata(e,r){const C=this.bb.__offset(this.bb_pos,12);return C?(r||new hs).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+C)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,r){e.addFieldInt16(0,r,Qp.V1)}static addHeaderType(e,r){e.addFieldInt8(1,r,ry.NONE)}static addHeader(e,r){e.addFieldOffset(2,r,0)}static addBodyLength(e,r){e.addFieldInt64(3,r,e.createLong(0,0))}static addCustomMetadata(e,r){e.addFieldOffset(4,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let C=r.length-1;C>=0;C--)e.addOffset(r[C]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,r){e.finish(r)}static finishSizePrefixedMessageBuffer(e,r){e.finish(r,void 0,!0)}static createMessage(e,r,C,D,k,m){return rf.startMessage(e),rf.addVersion(e,r),rf.addHeaderType(e,C),rf.addHeader(e,D),rf.addBodyLength(e,k),rf.addCustomMetadata(e,m),rf.endMessage(e)}};var mI=Qf;class gI extends aa{visit(e,r){return e==null||r==null?void 0:super.visit(e,r)}visitNull(e,r){return Id.startNull(r),Id.endNull(r)}visitInt(e,r){return mu.startInt(r),mu.addBitWidth(r,e.bitWidth),mu.addIsSigned(r,e.isSigned),mu.endInt(r)}visitFloat(e,r){return df.startFloatingPoint(r),df.addPrecision(r,e.precision),df.endFloatingPoint(r)}visitBinary(e,r){return Cd.startBinary(r),Cd.endBinary(r)}visitBool(e,r){return Ed.startBool(r),Ed.endBool(r)}visitUtf8(e,r){return Pd.startUtf8(r),Pd.endUtf8(r)}visitDecimal(e,r){return Gl.startDecimal(r),Gl.addScale(r,e.scale),Gl.addPrecision(r,e.precision),Gl.addBitWidth(r,e.bitWidth),Gl.endDecimal(r)}visitDate(e,r){return gv.startDate(r),gv.addUnit(r,e.unit),gv.endDate(r)}visitTime(e,r){return Xu.startTime(r),Xu.addUnit(r,e.unit),Xu.addBitWidth(r,e.bitWidth),Xu.endTime(r)}visitTimestamp(e,r){const C=e.timezone&&r.createString(e.timezone)||void 0;return Ku.startTimestamp(r),Ku.addUnit(r,e.unit),C!==void 0&&Ku.addTimezone(r,C),Ku.endTimestamp(r)}visitInterval(e,r){return pf.startInterval(r),pf.addUnit(r,e.unit),pf.endInterval(r)}visitList(e,r){return Ld.startList(r),Ld.endList(r)}visitStruct(e,r){return Rd.startStruct_(r),Rd.endStruct_(r)}visitUnion(e,r){ql.startTypeIdsVector(r,e.typeIds.length);const C=ql.createTypeIdsVector(r,e.typeIds);return ql.startUnion(r),ql.addMode(r,e.mode),ql.addTypeIds(r,C),ql.endUnion(r)}visitDictionary(e,r){const C=this.visit(e.indices,r);return Xf.startDictionaryEncoding(r),Xf.addId(r,new mI(e.id,0)),Xf.addIsOrdered(r,e.isOrdered),C!==void 0&&Xf.addIndexType(r,C),Xf.endDictionaryEncoding(r)}visitFixedSizeBinary(e,r){return ff.startFixedSizeBinary(r),ff.addByteWidth(r,e.byteWidth),ff.endFixedSizeBinary(r)}visitFixedSizeList(e,r){return hf.startFixedSizeList(r),hf.addListSize(r,e.listSize),hf.endFixedSizeList(r)}visitMap(e,r){return vv.startMap(r),vv.addKeysSorted(r,e.keysSorted),vv.endMap(r)}}const db=new gI;function vI(n,e=new Map){return new Ea(bI(n,e),xv(n.customMetadata),e)}function mM(n){return new _u(n.count,gM(n.columns),vM(n.columns))}function yI(n){return new Tf(mM(n.data),n.id,n.isDelta)}function bI(n,e){return(n.fields||[]).filter(Boolean).map(r=>ao.fromJSON(r,e))}function l5(n,e){return(n.children||[]).filter(Boolean).map(r=>ao.fromJSON(r,e))}function gM(n){return(n||[]).reduce((e,r)=>[...e,new Jd(r.count,xI(r.VALIDITY)),...gM(r.children)],[])}function vM(n,e=[]){for(let r=-1,C=(n||[]).length;++re+ +(r===0),0)}function _I(n,e){let r,C,D,k,m,t;return!e||!(k=n.dictionary)?(m=c5(n,l5(n,e)),D=new ao(n.name,m,n.nullable,xv(n.customMetadata))):e.has(r=k.id)?(C=(C=k.indexType)?u5(C):new Lm,t=new Kp(e.get(r),C,r,k.isOrdered),D=new ao(n.name,t,n.nullable,xv(n.customMetadata))):(C=(C=k.indexType)?u5(C):new Lm,e.set(r,m=c5(n,l5(n,e))),t=new Kp(m,C,r,k.isOrdered),D=new ao(n.name,t,n.nullable,xv(n.customMetadata))),D||null}function xv(n){return new Map(Object.entries(n||{}))}function u5(n){return new qh(n.isSigned,n.bitWidth)}function c5(n,e){const r=n.type.name;switch(r){case"NONE":return new Gh;case"null":return new Gh;case"binary":return new Pv;case"utf8":return new Ov;case"bool":return new Dv;case"list":return new Vv((e||[])[0]);case"struct":return new xl(e||[]);case"struct_":return new xl(e||[])}switch(r){case"int":{const C=n.type;return new qh(C.isSigned,C.bitWidth)}case"floatingpoint":{const C=n.type;return new Im($l[C.precision])}case"decimal":{const C=n.type;return new zv(C.scale,C.precision,C.bitWidth)}case"date":{const C=n.type;return new Fv(rh[C.unit])}case"time":{const C=n.type;return new Rm(wa[C.unit],C.bitWidth)}case"timestamp":{const C=n.type;return new Bv(wa[C.unit],C.timezone)}case"interval":{const C=n.type;return new Nv(Hh[C.unit])}case"union":{const C=n.type;return new jv(xu[C.mode],C.typeIds||[],e||[])}case"fixedsizebinary":{const C=n.type;return new Uv(C.byteWidth)}case"fixedsizelist":{const C=n.type;return new Hv(C.listSize,(e||[])[0])}case"map":{const C=n.type;return new Gv((e||[])[0],C.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var Gd=Qf,wI=oM,TI=Jp;class _l{constructor(e,r,C,D){this._version=r,this._headerType=C,this.body=new Uint8Array(0),D&&(this._createHeader=()=>D),this._bodyLength=typeof e=="number"?e:e.low}static fromJSON(e,r){const C=new _l(0,gu.V4,r);return C._createHeader=kI(e,r),C}static decode(e){e=new TI(_a(e));const r=Eh.getRootAsMessage(e),C=r.bodyLength(),D=r.version(),k=r.headerType(),m=new _l(C,D,k);return m._createHeader=MI(r,k),m}static encode(e){const r=new wI;let C=-1;return e.isSchema()?C=Ea.encode(r,e.header()):e.isRecordBatch()?C=_u.encode(r,e.header()):e.isDictionaryBatch()&&(C=Tf.encode(r,e.header())),Eh.startMessage(r),Eh.addVersion(r,gu.V4),Eh.addHeader(r,C),Eh.addHeaderType(r,e.headerType),Eh.addBodyLength(r,new Gd(e.bodyLength,0)),Eh.finishMessageBuffer(r,Eh.endMessage(r)),r.asUint8Array()}static from(e,r=0){if(e instanceof Ea)return new _l(0,gu.V4,Ca.Schema,e);if(e instanceof _u)return new _l(r,gu.V4,Ca.RecordBatch,e);if(e instanceof Tf)return new _l(r,gu.V4,Ca.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Ca.Schema}isRecordBatch(){return this.headerType===Ca.RecordBatch}isDictionaryBatch(){return this.headerType===Ca.DictionaryBatch}}class _u{constructor(e,r,C){this._nodes=r,this._buffers=C,this._length=typeof e=="number"?e:e.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}}class Tf{constructor(e,r,C=!1){this._data=e,this._isDelta=C,this._id=typeof r=="number"?r:r.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 vf{constructor(e,r){this.offset=typeof e=="number"?e:e.low,this.length=typeof r=="number"?r:r.low}}class Jd{constructor(e,r){this.length=typeof e=="number"?e:e.low,this.nullCount=typeof r=="number"?r:r.low}}function kI(n,e){return()=>{switch(e){case Ca.Schema:return Ea.fromJSON(n);case Ca.RecordBatch:return _u.fromJSON(n);case Ca.DictionaryBatch:return Tf.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${Ca[e]}, type: ${e} }`)}}function MI(n,e){return()=>{switch(e){case Ca.Schema:return Ea.decode(n.header(new af));case Ca.RecordBatch:return _u.decode(n.header(new Yf),n.version());case Ca.DictionaryBatch:return Tf.decode(n.header(new Dp),n.version())}throw new Error(`Unrecognized Message type: { name: ${Ca[e]}, type: ${e} }`)}}ao.encode=zI;ao.decode=OI;ao.fromJSON=_I;Ea.encode=DI;Ea.decode=AI;Ea.fromJSON=vI;_u.encode=FI;_u.decode=SI;_u.fromJSON=mM;Tf.encode=BI;Tf.decode=CI;Tf.fromJSON=yI;Jd.encode=NI;Jd.decode=LI;vf.encode=VI;vf.decode=EI;function AI(n,e=new Map){const r=PI(n,e);return new Ea(r,_v(n),e)}function SI(n,e=gu.V4){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new _u(n.length(),II(n),RI(n,e))}function CI(n,e=gu.V4){return new Tf(_u.decode(n.data(),e),n.id(),n.isDelta())}function EI(n){return new vf(n.offset(),n.length())}function LI(n){return new Jd(n.length(),n.nullCount())}function II(n){const e=[];for(let r,C=-1,D=-1,k=n.nodesLength();++Cao.encode(n,k));af.startFieldsVector(n,r.length);const C=af.createFieldsVector(n,r),D=e.metadata&&e.metadata.size>0?af.createCustomMetadataVector(n,[...e.metadata].map(([k,m])=>{const t=n.createString(`${k}`),d=n.createString(`${m}`);return hs.startKeyValue(n),hs.addKey(n,t),hs.addValue(n,d),hs.endKeyValue(n)})):-1;return af.startSchema(n),af.addFields(n,C),af.addEndianness(n,jI?e0.Little:e0.Big),D!==-1&&af.addCustomMetadata(n,D),af.endSchema(n)}function zI(n,e){let r=-1,C=-1,D=-1;const k=e.type;let m=e.typeId;_i.isDictionary(k)?(m=k.dictionary.typeId,D=db.visit(k,n),C=db.visit(k.dictionary,n)):C=db.visit(k,n);const t=(k.children||[]).map(i=>ao.encode(n,i)),d=Wu.createChildrenVector(n,t),y=e.metadata&&e.metadata.size>0?Wu.createCustomMetadataVector(n,[...e.metadata].map(([i,M])=>{const v=n.createString(`${i}`),h=n.createString(`${M}`);return hs.startKeyValue(n),hs.addKey(n,v),hs.addValue(n,h),hs.endKeyValue(n)})):-1;return e.name&&(r=n.createString(e.name)),Wu.startField(n),Wu.addType(n,C),Wu.addTypeType(n,m),Wu.addChildren(n,d),Wu.addNullable(n,!!e.nullable),r!==-1&&Wu.addName(n,r),D!==-1&&Wu.addDictionary(n,D),y!==-1&&Wu.addCustomMetadata(n,y),Wu.endField(n)}function FI(n,e){const r=e.nodes||[],C=e.buffers||[];Yf.startNodesVector(n,r.length);for(const m of r.slice().reverse())Jd.encode(n,m);const D=n.endVector();Yf.startBuffersVector(n,C.length);for(const m of C.slice().reverse())vf.encode(n,m);const k=n.endVector();return Yf.startRecordBatch(n),Yf.addLength(n,new Gd(e.length,0)),Yf.addNodes(n,D),Yf.addBuffers(n,k),Yf.endRecordBatch(n)}function BI(n,e){const r=_u.encode(n,e.data);return Dp.startDictionaryBatch(n),Dp.addId(n,new Gd(e.id,0)),Dp.addIsDelta(n,e.isDelta),Dp.addData(n,r),Dp.endDictionaryBatch(n)}function NI(n,e){return pM.createFieldNode(n,new Gd(e.length,0),new Gd(e.nullCount,0))}function VI(n,e){return dM.createBuffer(n,new Gd(e.offset,0),new Gd(e.length,0))}const jI=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),D2=n=>`Expected ${Ca[n]} Message in stream, but was null or length 0.`,z2=n=>`Header pointer of flatbuffer-encoded ${Ca[n]} Message is null or length 0.`,yM=(n,e)=>`Expected to read ${n} metadata bytes, but only read ${e}.`,bM=(n,e)=>`Expected to read ${n} bytes for message body, but only read ${e}.`;class xM{constructor(e){this.source=e instanceof Qv?e:new Qv(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?So:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let r;if((r=this.next()).done)return null;if(e!=null&&r.value.headerType!==e)throw new Error(D2(e));return r.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const r=_a(this.source.read(e));if(r.byteLength[...D,...k.VALIDITY&&[k.VALIDITY]||[],...k.TYPE&&[k.TYPE]||[],...k.OFFSET&&[k.OFFSET]||[],...k.DATA&&[k.DATA]||[],...r(k.children)],[])}}readMessage(e){let r;if((r=this.next()).done)return null;if(e!=null&&r.value.headerType!==e)throw new Error(D2(e));return r.value}readSchema(){const e=Ca.Schema,r=this.readMessage(e),C=r==null?void 0:r.header();if(!r||!C)throw new Error(z2(e));return C}}const qy=4,Qb="ARROW1",Om=new Uint8Array(Qb.length);for(let n=0;nthis):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Zu.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Zu.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,r){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof eh?e:Ub(e)?YI(e):j4(e)?KI(e):Uh(e)?(()=>yi(this,void 0,void 0,function*(){return yield eh.from(yield e)}))():U4(e)||m2(e)||H4(e)||g0(e)?XI(new n0(e)):ZI(new Qv(e))}static readAll(e){return e instanceof eh?e.isSync()?p5(e):m5(e):Ub(e)||ArrayBuffer.isView(e)||Zm(e)||V4(e)?p5(e):m5(e)}}class iy extends eh{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return gf(this,arguments,function*(){yield zi(yield*mv(Nd(this[Symbol.iterator]())))})}}class ay extends eh{constructor(e){super(e),this._impl=e}readAll(){var e,r;return yi(this,void 0,void 0,function*(){const C=new Array;try{for(var D=Nd(this),k;k=yield D.next(),!k.done;){const m=k.value;C.push(m)}}catch(m){e={error:m}}finally{try{k&&!k.done&&(r=D.return)&&(yield r.call(D))}finally{if(e)throw e.error}}return C})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class wM extends iy{constructor(e){super(e),this._impl=e}}class qI extends ay{constructor(e){super(e),this._impl=e}}class TM{constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,r){const C=this._loadVectors(e,r,this.schema.fields),D=ia({type:new xl(this.schema.fields),length:e.length,children:C});return new Wl(this.schema,D)}_loadDictionaryBatch(e,r){const{id:C,isDelta:D}=e,{dictionaries:k,schema:m}=this,t=k.get(C);if(D||!t){const d=m.dictionaries.get(C),y=this._loadVectors(e.data,r,[d]);return(t&&D?t.concat(new Ta(y)):new Ta(y)).memoize()}return t.memoize()}_loadVectors(e,r,C){return new uM(r,e.nodes,e.buffers,this.dictionaries).visitMany(C)}}class oy extends TM{constructor(e,r){super(r),this._reader=Ub(e)?new HI(this._handle=e):new xM(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=MM(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):So}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):So}next(){if(this.closed)return So;let e;const{_reader:r}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const C=e.header(),D=r.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(C,D)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const C=e.header(),D=r.readMessageBody(e.bodyLength),k=this._loadDictionaryBatch(C,D);this.dictionaries.set(C.id,k)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new O2(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class sy extends TM{constructor(e,r){super(r),this._reader=new UI(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return yi(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return yi(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=MM(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return yi(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):So})}return(e){return yi(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):So})}next(){return yi(this,void 0,void 0,function*(){if(this.closed)return So;let e;const{_reader:r}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const C=e.header(),D=yield r.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(C,D)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const C=e.header(),D=yield r.readMessageBody(e.bodyLength),k=this._loadDictionaryBatch(C,D);this.dictionaries.set(C.id,k)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new O2(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return yi(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class kM extends oy{constructor(e,r){super(e instanceof o5?e:new o5(e),r)}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(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var r;if(this.closed)return null;this._footer||this.open();const C=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(e);if(C&&this._handle.seek(C.offset)){const D=this._reader.readMessage(Ca.RecordBatch);if(D!=null&&D.isRecordBatch()){const k=D.header(),m=this._reader.readMessageBody(D.bodyLength);return this._loadRecordBatch(k,m)}}return null}_readDictionaryBatch(e){var r;const C=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(e);if(C&&this._handle.seek(C.offset)){const D=this._reader.readMessage(Ca.DictionaryBatch);if(D!=null&&D.isDictionaryBatch()){const k=D.header(),m=this._reader.readMessageBody(D.bodyLength),t=this._loadDictionaryBatch(k,m);this.dictionaries.set(k.id,t)}}}_readFooter(){const{_handle:e}=this,r=e.size-_M,C=e.readInt32(r),D=e.readAt(r-C,C);return Pm.decode(D)}_readNextMessageAndValidate(e){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return yi(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const C of this._footer.dictionaryBatches())C&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,e)})}readRecordBatch(e){var r;return yi(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());const C=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(e);if(C&&(yield this._handle.seek(C.offset))){const D=yield this._reader.readMessage(Ca.RecordBatch);if(D!=null&&D.isRecordBatch()){const k=D.header(),m=yield this._reader.readMessageBody(D.bodyLength);return this._loadRecordBatch(k,m)}}return null})}_readDictionaryBatch(e){var r;return yi(this,void 0,void 0,function*(){const C=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(e);if(C&&(yield this._handle.seek(C.offset))){const D=yield this._reader.readMessage(Ca.DictionaryBatch);if(D!=null&&D.isDictionaryBatch()){const k=D.header(),m=yield this._reader.readMessageBody(D.bodyLength),t=this._loadDictionaryBatch(k,m);this.dictionaries.set(k.id,t)}}})}_readFooter(){return yi(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const r=e.size-_M,C=yield e.readInt32(r),D=yield e.readAt(r-C,C);return Pm.decode(D)})}_readNextMessageAndValidate(e){return yi(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?F2(e)?new wM(new kM(n.read())):new iy(new oy(n)):new iy(new oy(function*(){}()))}function XI(n){return yi(this,void 0,void 0,function*(){const e=yield n.peek(Qm+7&-8);return e&&e.byteLength>=4?F2(e)?new wM(new kM(yield n.read())):new ay(new sy(n)):new ay(new sy(function(){return gf(this,arguments,function*(){})}()))})}function KI(n){return yi(this,void 0,void 0,function*(){const{size:e}=yield n.stat(),r=new ey(n,e);return e>=GI&&F2(yield r.readAt(0,Qm+7&-8))?new qI(new WI(r)):new ay(new sy(r))})}class ts extends aa{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...e){const r=D=>D.flatMap(k=>Array.isArray(k)?r(k):k instanceof Wl?k.data.children:k.data),C=new ts;return C.visitMany(r(e)),C}visit(e){if(e instanceof Ta)return this.visitMany(e.data),this;const{type:r}=e;if(!_i.isDictionary(r)){const{length:C,nullCount:D}=e;if(C>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");_i.isNull(r)||zc.call(this,D<=0?new Uint8Array(0):k2(e.offset,C,e.nullBitmap)),this.nodes.push(new Jd(C,D))}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function zc(n){const e=n.byteLength+7&-8;return this.buffers.push(n),this.bufferRegions.push(new vf(this._byteLength,e)),this._byteLength+=e,this}function JI(n){const{type:e,length:r,typeIds:C,valueOffsets:D}=n;if(zc.call(this,C),e.mode===xu.Sparse)return ex.call(this,n);if(e.mode===xu.Dense){if(n.offset<=0)return zc.call(this,D),ex.call(this,n);{const k=C.reduce((i,M)=>Math.max(i,M),C[0]),m=new Int32Array(k+1),t=new Int32Array(k+1).fill(-1),d=new Int32Array(r),y=v2(-D[0],r,D);for(let i,M,v=-1;++v=n.length?zc.call(this,new Uint8Array(0)):(e=n.values)instanceof Uint8Array?zc.call(this,k2(n.offset,n.length,e)):zc.call(this,qv(n.values))}function Qh(n){return zc.call(this,n.values.subarray(0,n.length*n.stride))}function AM(n){const{length:e,values:r,valueOffsets:C}=n,D=C[0],k=C[e],m=Math.min(k-D,r.byteLength-D);return zc.call(this,v2(-C[0],e,C)),zc.call(this,r.subarray(D,D+m)),this}function B2(n){const{length:e,valueOffsets:r}=n;return r&&zc.call(this,v2(r[0],e,r)),this.visit(n.children[0])}function ex(n){return this.visitMany(n.type.children.map((e,r)=>n.children[r]).filter(Boolean))[0]}ts.prototype.visitBool=QI;ts.prototype.visitInt=Qh;ts.prototype.visitFloat=Qh;ts.prototype.visitUtf8=AM;ts.prototype.visitBinary=AM;ts.prototype.visitFixedSizeBinary=Qh;ts.prototype.visitDate=Qh;ts.prototype.visitTimestamp=Qh;ts.prototype.visitTime=Qh;ts.prototype.visitDecimal=Qh;ts.prototype.visitList=B2;ts.prototype.visitStruct=ex;ts.prototype.visitUnion=JI;ts.prototype.visitInterval=Qh;ts.prototype.visitFixedSizeList=B2;ts.prototype.visitMap=B2;class SM extends E2{constructor(e){super(),this._position=0,this._started=!1,this._sink=new bv,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Zl(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,r){throw new Error('"throughDOM" not available in this environment')}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Uh(e)?e.then(r=>this.writeAll(r)):g0(e)?U2(this,e):j2(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,r=null){return e===this._sink||e instanceof bv?this._sink=e:(this._sink=new bv,e&&x9(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&_9(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!r||!Xb(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(e){let r=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof vl&&!(r=e.schema))return this.finish()&&void 0;if(e instanceof Wl&&!(r=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Xb(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}e instanceof Wl?e instanceof O2||this._writeRecordBatch(e):e instanceof vl?this.writeAll(e.batches):Zm(e)&&this.writeAll(e)}_writeMessage(e,r=8){const C=r-1,D=_l.encode(e),k=D.byteLength,m=this._writeLegacyIpcFormat?4:8,t=k+m+C&~C,d=t-k-m;return e.headerType===Ca.RecordBatch?this._recordBatchBlocks.push(new Wh(t,e.bodyLength,this._position)):e.headerType===Ca.DictionaryBatch&&this._dictionaryBlocks.push(new Wh(t,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(t-m)),k>0&&this._write(D),this._writePadding(d)}_write(e){if(this._started){const r=_a(e);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(e){return this._writeMessage(_l.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Om)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){const{byteLength:r,nodes:C,bufferRegions:D,buffers:k}=ts.assemble(e),m=new _u(e.numRows,C,D),t=_l.from(m,r);return this._writeDictionaries(e)._writeMessage(t)._writeBodyBuffers(k)}_writeDictionaryBatch(e,r,C=!1){this._dictionaryDeltaOffsets.set(r,e.length+(this._dictionaryDeltaOffsets.get(r)||0));const{byteLength:D,nodes:k,bufferRegions:m,buffers:t}=ts.assemble(new Ta([e])),d=new _u(e.length,k,m),y=new Tf(d,r,C),i=_l.from(y,D);return this._writeMessage(i)._writeBodyBuffers(t)}_writeBodyBuffers(e){let r,C,D;for(let k=-1,m=e.length;++k0&&(this._write(r),(D=(C+7&-8)-C)>0&&this._writePadding(D));return this}_writeDictionaries(e){for(let[r,C]of e.dictionaries){let D=this._dictionaryDeltaOffsets.get(r)||0;if(D===0||(C=C==null?void 0:C.slice(D)).length>0)for(const k of C.data)this._writeDictionaryBatch(k,r,D>0),D+=k.length}return this}}class N2 extends SM{static writeAll(e,r){const C=new N2(r);return Uh(e)?e.then(D=>C.writeAll(D)):g0(e)?U2(C,e):j2(C,e)}}class V2 extends SM{static writeAll(e){const r=new V2;return Uh(e)?e.then(C=>r.writeAll(C)):g0(e)?U2(r,e):j2(r,e)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeFooter(e){const r=Pm.encode(new Pm(e,gu.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}}function j2(n,e){let r=e;e instanceof vl&&(r=e.batches,n.reset(void 0,e.schema));for(const C of r)n.write(C);return n.finish()}function U2(n,e){var r,C,D,k;return yi(this,void 0,void 0,function*(){try{for(r=Nd(e);C=yield r.next(),!C.done;){const m=C.value;n.write(m)}}catch(m){D={error:m}}finally{try{C&&!C.done&&(k=r.return)&&(yield k.call(r))}finally{if(D)throw D.error}}return n.finish()})}function lm(n){const e=eh.from(n);return Uh(e)?e.then(r=>lm(r)):e.isAsync()?e.readAll().then(r=>new vl(r)):new vl(e.readAll())}function pb(n,e="stream"){return(e==="stream"?N2:V2).writeAll(n).toUint8Array(!0)}var tx=function(){function n(e,r,C,D){var k=this;this.getCell=function(m,t){var d=m=k.headerRows&&t=k.headerColumns;if(d){var M=["blank"];return t>0&&M.push("level"+m),{type:"blank",classNames:M.join(" "),content:""}}else if(i){var v=t-k.headerColumns,M=["col_heading","level"+m,"col"+v];return{type:"columns",classNames:M.join(" "),content:k.getContent(k.columnsTable,v,m)}}else if(y){var h=m-k.headerRows,M=["row_heading","level"+t,"row"+h];return{type:"index",id:"T_".concat(k.uuid,"level").concat(t,"_row").concat(h),classNames:M.join(" "),content:k.getContent(k.indexTable,h,t)}}else{var h=m-k.headerRows,v=t-k.headerColumns,M=["data","row"+h,"col"+v],l=k.styler?k.getContent(k.styler.displayValuesTable,h,v):k.getContent(k.dataTable,h,v);return{type:"data",id:"T_".concat(k.uuid,"row").concat(h,"_col").concat(v),classNames:M.join(" "),content:l}}},this.getContent=function(m,t,d){var y=m.getChildAt(d);if(y===null)return"";var i=k.getColumnTypeId(m,d);switch(i){case Jn.Timestamp:return k.nanosToDate(y.get(t));default:return y.get(t)}},this.dataTable=lm(e),this.indexTable=lm(r),this.columnsTable=lm(C),this.styler=D?{caption:D.caption,displayValuesTable:lm(D.displayValues),styles:D.styles,uuid:D.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:pb(this.dataTable),index:pb(this.indexTable),columns:pb(this.columnsTable)}},n.prototype.getColumnTypeId=function(e,r){return e.schema.fields[r].type.typeId},n.prototype.nanosToDate=function(e){return new Date(e/1e6)},n}(),gm=globalThis&&globalThis.__assign||function(){return gm=Object.assign||function(n){for(var e,r=1,C=arguments.length;r0?n.argsDataframeToObject(e.dfs):{};r=gm(gm({},r),C);var D=!!e.disabled,k=e.theme;k&&eR(k);var m={disabled:D,args:r,theme:k},t=new CustomEvent(n.RENDER_EVENT,{detail:m});n.events.dispatchEvent(t)},n.argsDataframeToObject=function(e){var r=e.map(function(C){var D=C.key,k=C.value;return[D,n.toArrowTable(k)]});return Object.fromEntries(r)},n.toArrowTable=function(e){var r,C=(r=e.data,r.data),D=r.index,k=r.columns,m=r.styler;return new tx(C,D,k,m)},n.sendBackMsg=function(e,r){window.parent.postMessage(gm({isStreamlitMessage:!0,type:e},r),"*")},n}(),eR=function(n){var e=document.createElement("style");document.head.appendChild(e),e.innerHTML=`
+]`}concat(...e){const r=this.schema,C=this.data.concat(e.flatMap(({data:D})=>D));return new ml(r,C.map(D=>new ql(r,D)))}slice(e,r){const C=this.schema;[e,r]=Yk({length:this.numRows},e,r);const D=Kk(this.data,this._offsets,e,r);return new ml(C,D.map(T=>new ql(C,T)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===e))}getChildAt(e){if(e>-1&&eC.children[e]);if(r.length===0){const{type:C}=this.schema.fields[e],D=ra({type:C,length:0,nullCount:0});r.push(D._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ta(r)}return null}setChild(e,r){var C;return this.setChildAt((C=this.schema.fields)===null||C===void 0?void 0:C.findIndex(D=>D.name===e),r)}setChildAt(e,r){let C=this.schema,D=[...this.batches];if(e>-1&ðis.getChildAt(g));[T[e],t[e]]=[p,r],[C,D]=fb(C,t)}return new ml(C,D)}select(e){const r=this.schema.fields.reduce((C,D,T)=>C.set(D.name,T),new Map);return this.selectAt(e.map(C=>r.get(C)).filter(C=>C>-1))}selectAt(e){const r=this.schema.selectAt(e),C=this.batches.map(D=>D.selectAt(e));return new ml(r,C)}assign(e){const r=this.schema.fields,[C,D]=e.schema.fields.reduce((t,d,g)=>{const[i,M]=t,v=r.findIndex(f=>f.name===d.name);return~v?M[v]=g:i.push(g),t},[[],[]]),T=this.schema.assign(e.schema),p=[...r.map((t,d)=>[d,D[d]]).map(([t,d])=>d===void 0?this.getChildAt(t):e.getChildAt(d)),...C.map(t=>e.getChildAt(t))].filter(Boolean);return new ml(...fb(T,p))}}hM=Symbol.toStringTag;ml[hM]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=Wp(S2),n.get=Wp(Xl.getVisitFn(Jn.Struct)),n.set=Jk(nc.getVisitFn(Jn.Struct)),n.indexOf=Qk(Wv.getVisitFn(Jn.Struct)),n.getByteLength=Wp(_h.getVisitFn(Jn.Struct)),"Table"))(ml.prototype);var fM;let ql=class sm{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof Ea))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=ra({nullCount:0,type:new bl(this.schema.fields),children:this.schema.fields.map(r=>ra({type:r.type,nullCount:0}))})]=e,!(this.data instanceof Qa))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=s5(this.schema,this.data.children);break}case 1:{const[r]=e,{fields:C,children:D,length:T}=Object.keys(r).reduce((d,g,i)=>(d.children[i]=r[g],d.length=Math.max(d.length,r[g].length),d.fields[i]=ao.new({name:g,type:r[g].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),p=new Ea(C),t=ra({type:new bl(C),length:T,children:D,nullCount:0});[this.schema,this.data]=s5(p,t.children,T);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=dM(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return Xl.visit(this.data,e)}set(e,r){return nc.visit(this.data,e,r)}indexOf(e,r){return Wv.visit(this.data,e,r)}getByteLength(e){return _h.visit(this.data,e)}[Symbol.iterator](){return C2.visit(new Ta([this.data]))}toArray(){return[...this]}concat(...e){return new ml(this.schema,[this,...e])}slice(e,r){const[C]=new Ta([this.data]).slice(e,r).data;return new sm(this.schema,C)}getChild(e){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(C=>C.name===e))}getChildAt(e){return e>-1&&eD.name===e),r)}setChildAt(e,r){let C=this.schema,D=this.data;if(e>-1&&et.name===T);~p&&(D[p]=this.data.children[p])}return new sm(r,ra({type:C,length:this.numRows,children:D}))}selectAt(e){const r=this.schema.selectAt(e),C=e.map(T=>this.data.children[T]).filter(Boolean),D=ra({type:new bl(r.fields),length:this.numRows,children:C});return new sm(r,D)}};fM=Symbol.toStringTag;ql[fM]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ql.prototype);function s5(n,e,r=e.reduce((C,D)=>Math.max(C,D.length),0)){var C;const D=[...n.fields],T=[...e],p=(r+63&-64)>>3;for(const[t,d]of n.fields.entries()){const g=e[t];(!g||g.length!==r)&&(D[t]=d.clone({nullable:!0}),T[t]=(C=g==null?void 0:g._changeLengthAndBackfillNullBitmap(r))!==null&&C!==void 0?C:ra({type:d.type,length:r,nullCount:r,nullBitmap:new Uint8Array(p)}))}return[n.assign(D),ra({type:new bl(D),length:r,children:T})]}function dM(n,e,r=new Map){for(let C=-1,D=n.length;++C0&&dM(p.children,t.children,r)}return r}class O2 extends ql{constructor(e){const r=e.fields.map(D=>ra({type:D.type})),C=ra({type:new bl(e.fields),nullCount:0,children:r});super(e,C)}}var ty;(function(n){n[n.BUFFER=0]="BUFFER"})(ty||(ty={}));var ny;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(ny||(ny={}));class Of{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsBodyCompression(e,r){return(r||new Of).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,r){return e.setPosition(e.position()+Wa),(r||new Of).__init(e.readInt32(e.position())+e.position(),e)}codec(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):ny.LZ4_FRAME}method(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):ty.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,r){e.addFieldInt8(0,r,ny.LZ4_FRAME)}static addMethod(e,r){e.addFieldInt8(1,r,ty.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,r,C){return Of.startBodyCompression(e),Of.addCodec(e,r),Of.addMethod(e,C),Of.endBodyCompression(e)}}let pM=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,r,C){return e.prep(8,16),e.writeInt64(C),e.writeInt64(r),e.offset()}},mM=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,r,C){return e.prep(8,16),e.writeInt64(C),e.writeInt64(r),e.offset()}},Yh=class Kb{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsRecordBatch(e,r){return(r||new Kb).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,r){return e.setPosition(e.position()+Wa),(r||new Kb).__init(e.readInt32(e.position())+e.position(),e)}length(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}nodes(e,r){const C=this.bb.__offset(this.bb_pos,6);return C?(r||new mM).__init(this.bb.__vector(this.bb_pos+C)+e*16,this.bb):null}nodesLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,r){const C=this.bb.__offset(this.bb_pos,8);return C?(r||new pM).__init(this.bb.__vector(this.bb_pos+C)+e*16,this.bb):null}buffersLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){const r=this.bb.__offset(this.bb_pos,10);return r?(e||new Of).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,r){e.addFieldInt64(0,r,e.createLong(0,0))}static addNodes(e,r){e.addFieldOffset(1,r,0)}static startNodesVector(e,r){e.startVector(16,r,8)}static addBuffers(e,r){e.addFieldOffset(2,r,0)}static startBuffersVector(e,r){e.startVector(16,r,8)}static addCompression(e,r){e.addFieldOffset(3,r,0)}static endRecordBatch(e){return e.endObject()}},Dp=class Jb{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsDictionaryBatch(e,r){return(r||new Jb).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,r){return e.setPosition(e.position()+Wa),(r||new Jb).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}data(e){const r=this.bb.__offset(this.bb_pos,6);return r?(e||new Yh).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,r){e.addFieldInt64(0,r,e.createLong(0,0))}static addData(e,r){e.addFieldOffset(1,r,0)}static addIsDelta(e,r){e.addFieldInt8(2,+r,0)}static endDictionaryBatch(e){return e.endObject()}};var ry;(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"})(ry||(ry={}));let Ef=class rh{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsMessage(e,r){return(r||new rh).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,r){return e.setPosition(e.position()+Wa),(r||new rh).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Qp.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):ry.NONE}header(e){const r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(e,this.bb_pos+r):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}customMetadata(e,r){const C=this.bb.__offset(this.bb_pos,12);return C?(r||new cs).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+C)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,r){e.addFieldInt16(0,r,Qp.V1)}static addHeaderType(e,r){e.addFieldInt8(1,r,ry.NONE)}static addHeader(e,r){e.addFieldOffset(2,r,0)}static addBodyLength(e,r){e.addFieldInt64(3,r,e.createLong(0,0))}static addCustomMetadata(e,r){e.addFieldOffset(4,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let C=r.length-1;C>=0;C--)e.addOffset(r[C]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,r){e.finish(r)}static finishSizePrefixedMessageBuffer(e,r){e.finish(r,void 0,!0)}static createMessage(e,r,C,D,T,p){return rh.startMessage(e),rh.addVersion(e,r),rh.addHeaderType(e,C),rh.addHeader(e,D),rh.addBodyLength(e,T),rh.addCustomMetadata(e,p),rh.endMessage(e)}};var gI=Jh;class vI extends aa{visit(e,r){return e==null||r==null?void 0:super.visit(e,r)}visitNull(e,r){return Id.startNull(r),Id.endNull(r)}visitInt(e,r){return mu.startInt(r),mu.addBitWidth(r,e.bitWidth),mu.addIsSigned(r,e.isSigned),mu.endInt(r)}visitFloat(e,r){return fh.startFloatingPoint(r),fh.addPrecision(r,e.precision),fh.endFloatingPoint(r)}visitBinary(e,r){return Cd.startBinary(r),Cd.endBinary(r)}visitBool(e,r){return Ed.startBool(r),Ed.endBool(r)}visitUtf8(e,r){return Pd.startUtf8(r),Pd.endUtf8(r)}visitDecimal(e,r){return Hl.startDecimal(r),Hl.addScale(r,e.scale),Hl.addPrecision(r,e.precision),Hl.addBitWidth(r,e.bitWidth),Hl.endDecimal(r)}visitDate(e,r){return gv.startDate(r),gv.addUnit(r,e.unit),gv.endDate(r)}visitTime(e,r){return Zu.startTime(r),Zu.addUnit(r,e.unit),Zu.addBitWidth(r,e.bitWidth),Zu.endTime(r)}visitTimestamp(e,r){const C=e.timezone&&r.createString(e.timezone)||void 0;return Xu.startTimestamp(r),Xu.addUnit(r,e.unit),C!==void 0&&Xu.addTimezone(r,C),Xu.endTimestamp(r)}visitInterval(e,r){return dh.startInterval(r),dh.addUnit(r,e.unit),dh.endInterval(r)}visitList(e,r){return Ld.startList(r),Ld.endList(r)}visitStruct(e,r){return Rd.startStruct_(r),Rd.endStruct_(r)}visitUnion(e,r){Gl.startTypeIdsVector(r,e.typeIds.length);const C=Gl.createTypeIdsVector(r,e.typeIds);return Gl.startUnion(r),Gl.addMode(r,e.mode),Gl.addTypeIds(r,C),Gl.endUnion(r)}visitDictionary(e,r){const C=this.visit(e.indices,r);return Zh.startDictionaryEncoding(r),Zh.addId(r,new gI(e.id,0)),Zh.addIsOrdered(r,e.isOrdered),C!==void 0&&Zh.addIndexType(r,C),Zh.endDictionaryEncoding(r)}visitFixedSizeBinary(e,r){return ch.startFixedSizeBinary(r),ch.addByteWidth(r,e.byteWidth),ch.endFixedSizeBinary(r)}visitFixedSizeList(e,r){return hh.startFixedSizeList(r),hh.addListSize(r,e.listSize),hh.endFixedSizeList(r)}visitMap(e,r){return vv.startMap(r),vv.addKeysSorted(r,e.keysSorted),vv.endMap(r)}}const db=new vI;function yI(n,e=new Map){return new Ea(xI(n,e),xv(n.customMetadata),e)}function gM(n){return new _u(n.count,vM(n.columns),yM(n.columns))}function bI(n){return new wh(gM(n.data),n.id,n.isDelta)}function xI(n,e){return(n.fields||[]).filter(Boolean).map(r=>ao.fromJSON(r,e))}function l5(n,e){return(n.children||[]).filter(Boolean).map(r=>ao.fromJSON(r,e))}function vM(n){return(n||[]).reduce((e,r)=>[...e,new Jd(r.count,_I(r.VALIDITY)),...vM(r.children)],[])}function yM(n,e=[]){for(let r=-1,C=(n||[]).length;++re+ +(r===0),0)}function wI(n,e){let r,C,D,T,p,t;return!e||!(T=n.dictionary)?(p=c5(n,l5(n,e)),D=new ao(n.name,p,n.nullable,xv(n.customMetadata))):e.has(r=T.id)?(C=(C=T.indexType)?u5(C):new Lm,t=new Kp(e.get(r),C,r,T.isOrdered),D=new ao(n.name,t,n.nullable,xv(n.customMetadata))):(C=(C=T.indexType)?u5(C):new Lm,e.set(r,p=c5(n,l5(n,e))),t=new Kp(p,C,r,T.isOrdered),D=new ao(n.name,t,n.nullable,xv(n.customMetadata))),D||null}function xv(n){return new Map(Object.entries(n||{}))}function u5(n){return new qf(n.isSigned,n.bitWidth)}function c5(n,e){const r=n.type.name;switch(r){case"NONE":return new Gf;case"null":return new Gf;case"binary":return new Pv;case"utf8":return new Ov;case"bool":return new Dv;case"list":return new Vv((e||[])[0]);case"struct":return new bl(e||[]);case"struct_":return new bl(e||[])}switch(r){case"int":{const C=n.type;return new qf(C.isSigned,C.bitWidth)}case"floatingpoint":{const C=n.type;return new Im(Yl[C.precision])}case"decimal":{const C=n.type;return new zv(C.scale,C.precision,C.bitWidth)}case"date":{const C=n.type;return new Fv(nf[C.unit])}case"time":{const C=n.type;return new Rm(wa[C.unit],C.bitWidth)}case"timestamp":{const C=n.type;return new Bv(wa[C.unit],C.timezone)}case"interval":{const C=n.type;return new Nv(Hf[C.unit])}case"union":{const C=n.type;return new jv(xu[C.mode],C.typeIds||[],e||[])}case"fixedsizebinary":{const C=n.type;return new Uv(C.byteWidth)}case"fixedsizelist":{const C=n.type;return new Hv(C.listSize,(e||[])[0])}case"map":{const C=n.type;return new Gv((e||[])[0],C.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var Gd=Jh,TI=sM,kI=Jp;class xl{constructor(e,r,C,D){this._version=r,this._headerType=C,this.body=new Uint8Array(0),D&&(this._createHeader=()=>D),this._bodyLength=typeof e=="number"?e:e.low}static fromJSON(e,r){const C=new xl(0,gu.V4,r);return C._createHeader=MI(e,r),C}static decode(e){e=new kI(_a(e));const r=Ef.getRootAsMessage(e),C=r.bodyLength(),D=r.version(),T=r.headerType(),p=new xl(C,D,T);return p._createHeader=AI(r,T),p}static encode(e){const r=new TI;let C=-1;return e.isSchema()?C=Ea.encode(r,e.header()):e.isRecordBatch()?C=_u.encode(r,e.header()):e.isDictionaryBatch()&&(C=wh.encode(r,e.header())),Ef.startMessage(r),Ef.addVersion(r,gu.V4),Ef.addHeader(r,C),Ef.addHeaderType(r,e.headerType),Ef.addBodyLength(r,new Gd(e.bodyLength,0)),Ef.finishMessageBuffer(r,Ef.endMessage(r)),r.asUint8Array()}static from(e,r=0){if(e instanceof Ea)return new xl(0,gu.V4,Ca.Schema,e);if(e instanceof _u)return new xl(r,gu.V4,Ca.RecordBatch,e);if(e instanceof wh)return new xl(r,gu.V4,Ca.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Ca.Schema}isRecordBatch(){return this.headerType===Ca.RecordBatch}isDictionaryBatch(){return this.headerType===Ca.DictionaryBatch}}class _u{constructor(e,r,C){this._nodes=r,this._buffers=C,this._length=typeof e=="number"?e:e.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}}class wh{constructor(e,r,C=!1){this._data=e,this._isDelta=C,this._id=typeof r=="number"?r:r.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 gh{constructor(e,r){this.offset=typeof e=="number"?e:e.low,this.length=typeof r=="number"?r:r.low}}class Jd{constructor(e,r){this.length=typeof e=="number"?e:e.low,this.nullCount=typeof r=="number"?r:r.low}}function MI(n,e){return()=>{switch(e){case Ca.Schema:return Ea.fromJSON(n);case Ca.RecordBatch:return _u.fromJSON(n);case Ca.DictionaryBatch:return wh.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${Ca[e]}, type: ${e} }`)}}function AI(n,e){return()=>{switch(e){case Ca.Schema:return Ea.decode(n.header(new ih));case Ca.RecordBatch:return _u.decode(n.header(new Yh),n.version());case Ca.DictionaryBatch:return wh.decode(n.header(new Dp),n.version())}throw new Error(`Unrecognized Message type: { name: ${Ca[e]}, type: ${e} }`)}}ao.encode=FI;ao.decode=DI;ao.fromJSON=wI;Ea.encode=zI;Ea.decode=SI;Ea.fromJSON=yI;_u.encode=BI;_u.decode=CI;_u.fromJSON=gM;wh.encode=NI;wh.decode=EI;wh.fromJSON=bI;Jd.encode=VI;Jd.decode=II;gh.encode=jI;gh.decode=LI;function SI(n,e=new Map){const r=OI(n,e);return new Ea(r,_v(n),e)}function CI(n,e=gu.V4){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new _u(n.length(),RI(n),PI(n,e))}function EI(n,e=gu.V4){return new wh(_u.decode(n.data(),e),n.id(),n.isDelta())}function LI(n){return new gh(n.offset(),n.length())}function II(n){return new Jd(n.length(),n.nullCount())}function RI(n){const e=[];for(let r,C=-1,D=-1,T=n.nodesLength();++Cao.encode(n,T));ih.startFieldsVector(n,r.length);const C=ih.createFieldsVector(n,r),D=e.metadata&&e.metadata.size>0?ih.createCustomMetadataVector(n,[...e.metadata].map(([T,p])=>{const t=n.createString(`${T}`),d=n.createString(`${p}`);return cs.startKeyValue(n),cs.addKey(n,t),cs.addValue(n,d),cs.endKeyValue(n)})):-1;return ih.startSchema(n),ih.addFields(n,C),ih.addEndianness(n,UI?e0.Little:e0.Big),D!==-1&&ih.addCustomMetadata(n,D),ih.endSchema(n)}function FI(n,e){let r=-1,C=-1,D=-1;const T=e.type;let p=e.typeId;_i.isDictionary(T)?(p=T.dictionary.typeId,D=db.visit(T,n),C=db.visit(T.dictionary,n)):C=db.visit(T,n);const t=(T.children||[]).map(i=>ao.encode(n,i)),d=qu.createChildrenVector(n,t),g=e.metadata&&e.metadata.size>0?qu.createCustomMetadataVector(n,[...e.metadata].map(([i,M])=>{const v=n.createString(`${i}`),f=n.createString(`${M}`);return cs.startKeyValue(n),cs.addKey(n,v),cs.addValue(n,f),cs.endKeyValue(n)})):-1;return e.name&&(r=n.createString(e.name)),qu.startField(n),qu.addType(n,C),qu.addTypeType(n,p),qu.addChildren(n,d),qu.addNullable(n,!!e.nullable),r!==-1&&qu.addName(n,r),D!==-1&&qu.addDictionary(n,D),g!==-1&&qu.addCustomMetadata(n,g),qu.endField(n)}function BI(n,e){const r=e.nodes||[],C=e.buffers||[];Yh.startNodesVector(n,r.length);for(const p of r.slice().reverse())Jd.encode(n,p);const D=n.endVector();Yh.startBuffersVector(n,C.length);for(const p of C.slice().reverse())gh.encode(n,p);const T=n.endVector();return Yh.startRecordBatch(n),Yh.addLength(n,new Gd(e.length,0)),Yh.addNodes(n,D),Yh.addBuffers(n,T),Yh.endRecordBatch(n)}function NI(n,e){const r=_u.encode(n,e.data);return Dp.startDictionaryBatch(n),Dp.addId(n,new Gd(e.id,0)),Dp.addIsDelta(n,e.isDelta),Dp.addData(n,r),Dp.endDictionaryBatch(n)}function VI(n,e){return mM.createFieldNode(n,new Gd(e.length,0),new Gd(e.nullCount,0))}function jI(n,e){return pM.createBuffer(n,new Gd(e.offset,0),new Gd(e.length,0))}const UI=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),D2=n=>`Expected ${Ca[n]} Message in stream, but was null or length 0.`,z2=n=>`Header pointer of flatbuffer-encoded ${Ca[n]} Message is null or length 0.`,bM=(n,e)=>`Expected to read ${n} metadata bytes, but only read ${e}.`,xM=(n,e)=>`Expected to read ${n} bytes for message body, but only read ${e}.`;class _M{constructor(e){this.source=e instanceof Qv?e:new Qv(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?So:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let r;if((r=this.next()).done)return null;if(e!=null&&r.value.headerType!==e)throw new Error(D2(e));return r.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const r=_a(this.source.read(e));if(r.byteLength[...D,...T.VALIDITY&&[T.VALIDITY]||[],...T.TYPE&&[T.TYPE]||[],...T.OFFSET&&[T.OFFSET]||[],...T.DATA&&[T.DATA]||[],...r(T.children)],[])}}readMessage(e){let r;if((r=this.next()).done)return null;if(e!=null&&r.value.headerType!==e)throw new Error(D2(e));return r.value}readSchema(){const e=Ca.Schema,r=this.readMessage(e),C=r==null?void 0:r.header();if(!r||!C)throw new Error(z2(e));return C}}const qy=4,Qb="ARROW1",Om=new Uint8Array(Qb.length);for(let n=0;nthis):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return $u.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return $u.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,r){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Qh?e:Ub(e)?ZI(e):U4(e)?JI(e):Uf(e)?(()=>yi(this,void 0,void 0,function*(){return yield Qh.from(yield e)}))():H4(e)||m2(e)||G4(e)||g0(e)?KI(new n0(e)):XI(new Qv(e))}static readAll(e){return e instanceof Qh?e.isSync()?p5(e):m5(e):Ub(e)||ArrayBuffer.isView(e)||Zm(e)||j4(e)?p5(e):m5(e)}}class iy extends Qh{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return mh(this,arguments,function*(){yield zi(yield*mv(Nd(this[Symbol.iterator]())))})}}class ay extends Qh{constructor(e){super(e),this._impl=e}readAll(){var e,r;return yi(this,void 0,void 0,function*(){const C=new Array;try{for(var D=Nd(this),T;T=yield D.next(),!T.done;){const p=T.value;C.push(p)}}catch(p){e={error:p}}finally{try{T&&!T.done&&(r=D.return)&&(yield r.call(D))}finally{if(e)throw e.error}}return C})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class TM extends iy{constructor(e){super(e),this._impl=e}}class WI extends ay{constructor(e){super(e),this._impl=e}}class kM{constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,r){const C=this._loadVectors(e,r,this.schema.fields),D=ra({type:new bl(this.schema.fields),length:e.length,children:C});return new ql(this.schema,D)}_loadDictionaryBatch(e,r){const{id:C,isDelta:D}=e,{dictionaries:T,schema:p}=this,t=T.get(C);if(D||!t){const d=p.dictionaries.get(C),g=this._loadVectors(e.data,r,[d]);return(t&&D?t.concat(new Ta(g)):new Ta(g)).memoize()}return t.memoize()}_loadVectors(e,r,C){return new cM(r,e.nodes,e.buffers,this.dictionaries).visitMany(C)}}class oy extends kM{constructor(e,r){super(r),this._reader=Ub(e)?new GI(this._handle=e):new _M(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=AM(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):So}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):So}next(){if(this.closed)return So;let e;const{_reader:r}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const C=e.header(),D=r.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(C,D)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const C=e.header(),D=r.readMessageBody(e.bodyLength),T=this._loadDictionaryBatch(C,D);this.dictionaries.set(C.id,T)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new O2(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class sy extends kM{constructor(e,r){super(r),this._reader=new HI(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return yi(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return yi(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=AM(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return yi(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):So})}return(e){return yi(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):So})}next(){return yi(this,void 0,void 0,function*(){if(this.closed)return So;let e;const{_reader:r}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const C=e.header(),D=yield r.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(C,D)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const C=e.header(),D=yield r.readMessageBody(e.bodyLength),T=this._loadDictionaryBatch(C,D);this.dictionaries.set(C.id,T)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new O2(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return yi(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class MM extends oy{constructor(e,r){super(e instanceof o5?e:new o5(e),r)}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(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var r;if(this.closed)return null;this._footer||this.open();const C=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(e);if(C&&this._handle.seek(C.offset)){const D=this._reader.readMessage(Ca.RecordBatch);if(D!=null&&D.isRecordBatch()){const T=D.header(),p=this._reader.readMessageBody(D.bodyLength);return this._loadRecordBatch(T,p)}}return null}_readDictionaryBatch(e){var r;const C=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(e);if(C&&this._handle.seek(C.offset)){const D=this._reader.readMessage(Ca.DictionaryBatch);if(D!=null&&D.isDictionaryBatch()){const T=D.header(),p=this._reader.readMessageBody(D.bodyLength),t=this._loadDictionaryBatch(T,p);this.dictionaries.set(T.id,t)}}}_readFooter(){const{_handle:e}=this,r=e.size-wM,C=e.readInt32(r),D=e.readAt(r-C,C);return Pm.decode(D)}_readNextMessageAndValidate(e){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return yi(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const C of this._footer.dictionaryBatches())C&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,e)})}readRecordBatch(e){var r;return yi(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());const C=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(e);if(C&&(yield this._handle.seek(C.offset))){const D=yield this._reader.readMessage(Ca.RecordBatch);if(D!=null&&D.isRecordBatch()){const T=D.header(),p=yield this._reader.readMessageBody(D.bodyLength);return this._loadRecordBatch(T,p)}}return null})}_readDictionaryBatch(e){var r;return yi(this,void 0,void 0,function*(){const C=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(e);if(C&&(yield this._handle.seek(C.offset))){const D=yield this._reader.readMessage(Ca.DictionaryBatch);if(D!=null&&D.isDictionaryBatch()){const T=D.header(),p=yield this._reader.readMessageBody(D.bodyLength),t=this._loadDictionaryBatch(T,p);this.dictionaries.set(T.id,t)}}})}_readFooter(){return yi(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const r=e.size-wM,C=yield e.readInt32(r),D=yield e.readAt(r-C,C);return Pm.decode(D)})}_readNextMessageAndValidate(e){return yi(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?F2(e)?new TM(new MM(n.read())):new iy(new oy(n)):new iy(new oy(function*(){}()))}function KI(n){return yi(this,void 0,void 0,function*(){const e=yield n.peek(Qm+7&-8);return e&&e.byteLength>=4?F2(e)?new TM(new MM(yield n.read())):new ay(new sy(n)):new ay(new sy(function(){return mh(this,arguments,function*(){})}()))})}function JI(n){return yi(this,void 0,void 0,function*(){const{size:e}=yield n.stat(),r=new ey(n,e);return e>=qI&&F2(yield r.readAt(0,Qm+7&-8))?new WI(new YI(r)):new ay(new sy(r))})}class Qo extends aa{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...e){const r=D=>D.flatMap(T=>Array.isArray(T)?r(T):T instanceof ql?T.data.children:T.data),C=new Qo;return C.visitMany(r(e)),C}visit(e){if(e instanceof Ta)return this.visitMany(e.data),this;const{type:r}=e;if(!_i.isDictionary(r)){const{length:C,nullCount:D}=e;if(C>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");_i.isNull(r)||zc.call(this,D<=0?new Uint8Array(0):k2(e.offset,C,e.nullBitmap)),this.nodes.push(new Jd(C,D))}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function zc(n){const e=n.byteLength+7&-8;return this.buffers.push(n),this.bufferRegions.push(new gh(this._byteLength,e)),this._byteLength+=e,this}function QI(n){const{type:e,length:r,typeIds:C,valueOffsets:D}=n;if(zc.call(this,C),e.mode===xu.Sparse)return ex.call(this,n);if(e.mode===xu.Dense){if(n.offset<=0)return zc.call(this,D),ex.call(this,n);{const T=C.reduce((i,M)=>Math.max(i,M),C[0]),p=new Int32Array(T+1),t=new Int32Array(T+1).fill(-1),d=new Int32Array(r),g=v2(-D[0],r,D);for(let i,M,v=-1;++v=n.length?zc.call(this,new Uint8Array(0)):(e=n.values)instanceof Uint8Array?zc.call(this,k2(n.offset,n.length,e)):zc.call(this,qv(n.values))}function Qf(n){return zc.call(this,n.values.subarray(0,n.length*n.stride))}function SM(n){const{length:e,values:r,valueOffsets:C}=n,D=C[0],T=C[e],p=Math.min(T-D,r.byteLength-D);return zc.call(this,v2(-C[0],e,C)),zc.call(this,r.subarray(D,D+p)),this}function B2(n){const{length:e,valueOffsets:r}=n;return r&&zc.call(this,v2(r[0],e,r)),this.visit(n.children[0])}function ex(n){return this.visitMany(n.type.children.map((e,r)=>n.children[r]).filter(Boolean))[0]}Qo.prototype.visitBool=eR;Qo.prototype.visitInt=Qf;Qo.prototype.visitFloat=Qf;Qo.prototype.visitUtf8=SM;Qo.prototype.visitBinary=SM;Qo.prototype.visitFixedSizeBinary=Qf;Qo.prototype.visitDate=Qf;Qo.prototype.visitTimestamp=Qf;Qo.prototype.visitTime=Qf;Qo.prototype.visitDecimal=Qf;Qo.prototype.visitList=B2;Qo.prototype.visitStruct=ex;Qo.prototype.visitUnion=QI;Qo.prototype.visitInterval=Qf;Qo.prototype.visitFixedSizeList=B2;Qo.prototype.visitMap=B2;class CM extends E2{constructor(e){super(),this._position=0,this._started=!1,this._sink=new bv,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Zl(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,r){throw new Error('"throughDOM" not available in this environment')}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Uf(e)?e.then(r=>this.writeAll(r)):g0(e)?U2(this,e):j2(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,r=null){return e===this._sink||e instanceof bv?this._sink=e:(this._sink=new bv,e&&_9(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&w9(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!r||!Xb(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(e){let r=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof ml&&!(r=e.schema))return this.finish()&&void 0;if(e instanceof ql&&!(r=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Xb(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}e instanceof ql?e instanceof O2||this._writeRecordBatch(e):e instanceof ml?this.writeAll(e.batches):Zm(e)&&this.writeAll(e)}_writeMessage(e,r=8){const C=r-1,D=xl.encode(e),T=D.byteLength,p=this._writeLegacyIpcFormat?4:8,t=T+p+C&~C,d=t-T-p;return e.headerType===Ca.RecordBatch?this._recordBatchBlocks.push(new Wf(t,e.bodyLength,this._position)):e.headerType===Ca.DictionaryBatch&&this._dictionaryBlocks.push(new Wf(t,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(t-p)),T>0&&this._write(D),this._writePadding(d)}_write(e){if(this._started){const r=_a(e);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(e){return this._writeMessage(xl.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Om)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){const{byteLength:r,nodes:C,bufferRegions:D,buffers:T}=Qo.assemble(e),p=new _u(e.numRows,C,D),t=xl.from(p,r);return this._writeDictionaries(e)._writeMessage(t)._writeBodyBuffers(T)}_writeDictionaryBatch(e,r,C=!1){this._dictionaryDeltaOffsets.set(r,e.length+(this._dictionaryDeltaOffsets.get(r)||0));const{byteLength:D,nodes:T,bufferRegions:p,buffers:t}=Qo.assemble(new Ta([e])),d=new _u(e.length,T,p),g=new wh(d,r,C),i=xl.from(g,D);return this._writeMessage(i)._writeBodyBuffers(t)}_writeBodyBuffers(e){let r,C,D;for(let T=-1,p=e.length;++T0&&(this._write(r),(D=(C+7&-8)-C)>0&&this._writePadding(D));return this}_writeDictionaries(e){for(let[r,C]of e.dictionaries){let D=this._dictionaryDeltaOffsets.get(r)||0;if(D===0||(C=C==null?void 0:C.slice(D)).length>0)for(const T of C.data)this._writeDictionaryBatch(T,r,D>0),D+=T.length}return this}}class N2 extends CM{static writeAll(e,r){const C=new N2(r);return Uf(e)?e.then(D=>C.writeAll(D)):g0(e)?U2(C,e):j2(C,e)}}class V2 extends CM{static writeAll(e){const r=new V2;return Uf(e)?e.then(C=>r.writeAll(C)):g0(e)?U2(r,e):j2(r,e)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeFooter(e){const r=Pm.encode(new Pm(e,gu.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}}function j2(n,e){let r=e;e instanceof ml&&(r=e.batches,n.reset(void 0,e.schema));for(const C of r)n.write(C);return n.finish()}function U2(n,e){var r,C,D,T;return yi(this,void 0,void 0,function*(){try{for(r=Nd(e);C=yield r.next(),!C.done;){const p=C.value;n.write(p)}}catch(p){D={error:p}}finally{try{C&&!C.done&&(T=r.return)&&(yield T.call(r))}finally{if(D)throw D.error}}return n.finish()})}function lm(n){const e=Qh.from(n);return Uf(e)?e.then(r=>lm(r)):e.isAsync()?e.readAll().then(r=>new ml(r)):new ml(e.readAll())}function pb(n,e="stream"){return(e==="stream"?N2:V2).writeAll(n).toUint8Array(!0)}var tx=function(){function n(e,r,C,D){var T=this;this.getCell=function(p,t){var d=p=T.headerRows&&t=T.headerColumns;if(d){var M=["blank"];return t>0&&M.push("level"+p),{type:"blank",classNames:M.join(" "),content:""}}else if(i){var v=t-T.headerColumns,M=["col_heading","level"+p,"col"+v];return{type:"columns",classNames:M.join(" "),content:T.getContent(T.columnsTable,v,p)}}else if(g){var f=p-T.headerRows,M=["row_heading","level"+t,"row"+f];return{type:"index",id:"T_".concat(T.uuid,"level").concat(t,"_row").concat(f),classNames:M.join(" "),content:T.getContent(T.indexTable,f,t)}}else{var f=p-T.headerRows,v=t-T.headerColumns,M=["data","row"+f,"col"+v],l=T.styler?T.getContent(T.styler.displayValuesTable,f,v):T.getContent(T.dataTable,f,v);return{type:"data",id:"T_".concat(T.uuid,"row").concat(f,"_col").concat(v),classNames:M.join(" "),content:l}}},this.getContent=function(p,t,d){var g=p.getChildAt(d);if(g===null)return"";var i=T.getColumnTypeId(p,d);switch(i){case Jn.Timestamp:return T.nanosToDate(g.get(t));default:return g.get(t)}},this.dataTable=lm(e),this.indexTable=lm(r),this.columnsTable=lm(C),this.styler=D?{caption:D.caption,displayValuesTable:lm(D.displayValues),styles:D.styles,uuid:D.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:pb(this.dataTable),index:pb(this.indexTable),columns:pb(this.columnsTable)}},n.prototype.getColumnTypeId=function(e,r){return e.schema.fields[r].type.typeId},n.prototype.nanosToDate=function(e){return new Date(e/1e6)},n}(),gm=globalThis&&globalThis.__assign||function(){return gm=Object.assign||function(n){for(var e,r=1,C=arguments.length;r0?n.argsDataframeToObject(e.dfs):{};r=gm(gm({},r),C);var D=!!e.disabled,T=e.theme;T&&tR(T);var p={disabled:D,args:r,theme:T},t=new CustomEvent(n.RENDER_EVENT,{detail:p});n.events.dispatchEvent(t)},n.argsDataframeToObject=function(e){var r=e.map(function(C){var D=C.key,T=C.value;return[D,n.toArrowTable(T)]});return Object.fromEntries(r)},n.toArrowTable=function(e){var r,C=(r=e.data,r.data),D=r.index,T=r.columns,p=r.styler;return new tx(C,D,T,p)},n.sendBackMsg=function(e,r){window.parent.postMessage(gm({isStreamlitMessage:!0,type:e},r),"*")},n}(),tR=function(n){var e=document.createElement("style");document.head.appendChild(e),e.innerHTML=`
:root {
--primary-color: `.concat(n.primaryColor,`;
--background-color: `).concat(n.backgroundColor,`;
@@ -36,15 +36,15 @@ object-assign
background-color: var(--background-color);
color: var(--text-color);
}
- `)};function tR(n){var e=!1;try{e=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||e}var nR=globalThis&&globalThis.__extends||function(){var n=function(e,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,D){C.__proto__=D}||function(C,D){for(var k in D)Object.prototype.hasOwnProperty.call(D,k)&&(C[k]=D[k])},n(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");n(e,r);function C(){this.constructor=e}e.prototype=r===null?Object.create(r):(C.prototype=r.prototype,new C)}}();(function(n){nR(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.componentDidMount=function(){$u.setFrameHeight()},e.prototype.componentDidUpdate=function(){$u.setFrameHeight()},e})(m9.PureComponent);const Mu=i2("selection",{state:()=>({scanIndex:void 0,massIndex:void 0,proteinIndex:void 0,tagIndex:void 0,selectedObservedMass:void 0,AApos:void 0,tagData:void 0,counter:void 0,id:void 0,heatmap_deconv:void 0,heatmap_raw:void 0}),getters:{selectedScanIndex:n=>n.scanIndex,selectedMassIndex:n=>n.massIndex,selectedProteinIndex:n=>n.proteinIndex,selectedTagIndex:n=>n.tagIndex,selectedAApos:n=>n.AApos,selectedTag:n=>n.tagData,selectedDeconvHeatmap:n=>n.heatmap_deconv,selectedRawHeatmap:n=>n.heatmap_raw,selectedObservedMassFromFragmentTable:n=>n.selectedObservedMass},actions:{updateSelectedScan(n){this.scanIndex=n},updateSelectedMass(n){this.massIndex=n},updateSelectedProtein(n){this.proteinIndex=n},updateSelectedTag(n){this.tagIndex=n},selectedAminoAcid(n){this.selectedObservedMass=n},updateSelectedAA(n){this.AApos=n},updateTagData(n){this.tagData=n},updateRawHeatmapSelection(n){this.heatmap_raw=n},updateDeconvHeatmapSelection(n){this.heatmap_deconv=n}}}),Cs=i2("streamlit-data",{state:()=>({renderData:null,dataForDrawing:{},dataset:"",hash:""}),getters:{args:n=>{var e;return(e=n.renderData)==null?void 0:e.args},components(){return this.args.components},allDataForDrawing:n=>n.dataForDrawing,sequenceData:n=>n.dataForDrawing.sequence_data,settings:n=>n.dataForDrawing.settings,internalFragmentData:n=>n.dataForDrawing.internal_fragment_data,theme:n=>{var e;return(e=n.renderData)==null?void 0:e.theme}},actions:{updateRenderData(n){var D;if(Mu().$patch(k=>{if(n.args.selection_store.id!==k.id)for(const m in k)k[m]=void 0;Object.assign(k,n.args.selection_store)}),console.log(n.args.selection_store.id),this.hash===n.args.hash)return;this.hash=n.args.hash,delete n.args.selection_store,delete n.args.hash,this.dataForDrawing={},this.dataset=(D=n.args)==null?void 0:D.dataset,this.renderData=n;function r(k){if(typeof k=="bigint")return Number(k);if(k instanceof Ta){const m=[];for(let t=0;t{if(m instanceof tx){const t=[],d=m.table.schema.fields.map(y=>y.name);for(let y=0;y{var h;i[M]=r((h=m.table.getChildAt(v))==null?void 0:h.get(y))}),t.push(i)}this.dataForDrawing[k]=t}else this.dataForDrawing[k]=m})}}});var CM={exports:{}};(function(n,e){/*! For license information please see plotly.min.js.LICENSE.txt */(function(r,C){n.exports=C()})(self,function(){return function(){var r={98847:function(k,m,t){var d=t(71828),y={"X,X div":'direction:ltr;font-family:"Open Sans",verdana,arial,sans-serif;margin:0;padding:0;',"X input,X button":'font-family:"Open Sans",verdana,arial,sans-serif;',"X input:focus,X button:focus":"outline:none;","X a":"text-decoration:none;","X a:hover":"text-decoration:none;","X .crisp":"shape-rendering:crispEdges;","X .user-select-none":"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;","X svg":"overflow:hidden;","X svg a":"fill:#447adb;","X svg a:hover":"fill:#3c6dc5;","X .main-svg":"position:absolute;top:0;left:0;pointer-events:none;","X .main-svg .draglayer":"pointer-events:all;","X .cursor-default":"cursor:default;","X .cursor-pointer":"cursor:pointer;","X .cursor-crosshair":"cursor:crosshair;","X .cursor-move":"cursor:move;","X .cursor-col-resize":"cursor:col-resize;","X .cursor-row-resize":"cursor:row-resize;","X .cursor-ns-resize":"cursor:ns-resize;","X .cursor-ew-resize":"cursor:ew-resize;","X .cursor-sw-resize":"cursor:sw-resize;","X .cursor-s-resize":"cursor:s-resize;","X .cursor-se-resize":"cursor:se-resize;","X .cursor-w-resize":"cursor:w-resize;","X .cursor-e-resize":"cursor:e-resize;","X .cursor-nw-resize":"cursor:nw-resize;","X .cursor-n-resize":"cursor:n-resize;","X .cursor-ne-resize":"cursor:ne-resize;","X .cursor-grab":"cursor:-webkit-grab;cursor:grab;","X .modebar":"position:absolute;top:2px;right:2px;","X .ease-bg":"-webkit-transition:background-color .3s ease 0s;-moz-transition:background-color .3s ease 0s;-ms-transition:background-color .3s ease 0s;-o-transition:background-color .3s ease 0s;transition:background-color .3s ease 0s;","X .modebar--hover>:not(.watermark)":"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":'content:"";position:absolute;background:rgba(0,0,0,0);border:6px solid rgba(0,0,0,0);z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;',"X [data-title]:after":"content:attr(data-title);background:#69738a;color:#fff;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid rgba(0,0,0,0);border-left-color:#69738a;margin-top:8px;margin-right:-30px;",Y:'font-family:"Open Sans",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;',"Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var i in y){var M=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");d.addStyleRule(M,y[i])}},98222:function(k,m,t){k.exports=t(82887)},27206:function(k,m,t){k.exports=t(60822)},59893:function(k,m,t){k.exports=t(23381)},5224:function(k,m,t){k.exports=t(83832)},59509:function(k,m,t){k.exports=t(72201)},75557:function(k,m,t){k.exports=t(91815)},40338:function(k,m,t){k.exports=t(21462)},35080:function(k,m,t){k.exports=t(51319)},61396:function(k,m,t){k.exports=t(57516)},40549:function(k,m,t){k.exports=t(98128)},49866:function(k,m,t){k.exports=t(99442)},36089:function(k,m,t){k.exports=t(93740)},19548:function(k,m,t){k.exports=t(8729)},35831:function(k,m,t){k.exports=t(93814)},61039:function(k,m,t){k.exports=t(14382)},97040:function(k,m,t){k.exports=t(51759)},77986:function(k,m,t){k.exports=t(10421)},24296:function(k,m,t){k.exports=t(43102)},58872:function(k,m,t){k.exports=t(92165)},29626:function(k,m,t){k.exports=t(3325)},65591:function(k,m,t){k.exports=t(36071)},69738:function(k,m,t){k.exports=t(43905)},92650:function(k,m,t){k.exports=t(35902)},35630:function(k,m,t){k.exports=t(69816)},73434:function(k,m,t){k.exports=t(94507)},27909:function(k,m,t){var d=t(19548);d.register([t(27206),t(5224),t(58872),t(65591),t(69738),t(92650),t(49866),t(25743),t(6197),t(97040),t(85461),t(73434),t(54201),t(81299),t(47645),t(35630),t(77986),t(83043),t(93005),t(96881),t(4534),t(50581),t(40549),t(77900),t(47582),t(35080),t(21641),t(17280),t(5861),t(29626),t(10021),t(65317),t(96268),t(61396),t(35831),t(16122),t(46163),t(40344),t(40338),t(48131),t(36089),t(55334),t(75557),t(19440),t(99488),t(59893),t(97393),t(98222),t(61039),t(24296),t(66398),t(59509)]),k.exports=d},46163:function(k,m,t){k.exports=t(15154)},96881:function(k,m,t){k.exports=t(64943)},50581:function(k,m,t){k.exports=t(21164)},55334:function(k,m,t){k.exports=t(54186)},65317:function(k,m,t){k.exports=t(94873)},10021:function(k,m,t){k.exports=t(67618)},54201:function(k,m,t){k.exports=t(58810)},5861:function(k,m,t){k.exports=t(20593)},16122:function(k,m,t){k.exports=t(29396)},83043:function(k,m,t){k.exports=t(13551)},48131:function(k,m,t){k.exports=t(46858)},47582:function(k,m,t){k.exports=t(17988)},21641:function(k,m,t){k.exports=t(68868)},96268:function(k,m,t){k.exports=t(20467)},19440:function(k,m,t){k.exports=t(91271)},99488:function(k,m,t){k.exports=t(21461)},97393:function(k,m,t){k.exports=t(85956)},25743:function(k,m,t){k.exports=t(52979)},66398:function(k,m,t){k.exports=t(32275)},17280:function(k,m,t){k.exports=t(6419)},77900:function(k,m,t){k.exports=t(61510)},81299:function(k,m,t){k.exports=t(87619)},93005:function(k,m,t){k.exports=t(93601)},40344:function(k,m,t){k.exports=t(96595)},47645:function(k,m,t){k.exports=t(70954)},6197:function(k,m,t){k.exports=t(47462)},4534:function(k,m,t){k.exports=t(17659)},85461:function(k,m,t){k.exports=t(19990)},82884:function(k){k.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]},50215:function(k,m,t){var d=t(82884),y=t(41940),i=t(85555),M=t(44467).templatedArray;t(24695),k.exports=M("annotation",{visible:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},text:{valType:"string",editType:"calc+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calc+arraydraw"},font:y({editType:"calc+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:d.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:d.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calc+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},ax:{valType:"any",editType:"calc+arraydraw"},ay:{valType:"any",editType:"calc+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calc+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calc+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calc+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calc+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:y({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},3749:function(k,m,t){var d=t(71828),y=t(89298),i=t(92605).draw;function M(h){var l=h._fullLayout;d.filterVisible(l.annotations).forEach(function(a){var u=y.getFromId(h,a.xref),s=y.getFromId(h,a.yref),o=y.getRefType(a.xref),c=y.getRefType(a.yref);a._extremes={},o==="range"&&v(a,u),c==="range"&&v(a,s)})}function v(h,l){var a,u=l._id,s=u.charAt(0),o=h[s],c=h["a"+s],f=h[s+"ref"],p=h["a"+s+"ref"],w=h["_"+s+"padplus"],g=h["_"+s+"padminus"],S={x:1,y:-1}[s]*h[s+"shift"],x=3*h.arrowsize*h.arrowwidth||0,T=x+S,E=x-S,_=3*h.startarrowsize*h.arrowwidth||0,A=_+S,L=_-S;if(p===f){var b=y.findExtremes(l,[l.r2c(o)],{ppadplus:T,ppadminus:E}),R=y.findExtremes(l,[l.r2c(c)],{ppadplus:Math.max(w,A),ppadminus:Math.max(g,L)});a={min:[b.min[0],R.min[0]],max:[b.max[0],R.max[0]]}}else A=c?A+c:A,L=c?L-c:L,a=y.findExtremes(l,[l.r2c(o)],{ppadplus:Math.max(w,T,A),ppadminus:Math.max(g,E,L)});h._extremes[u]=a}k.exports=function(h){var l=h._fullLayout;if(d.filterVisible(l.annotations).length&&h._fullData.length)return d.syncOrAsync([i,M],h)}},44317:function(k,m,t){var d=t(71828),y=t(73972),i=t(44467).arrayEditor;function M(h,l){var a,u,s,o,c,f,p,w=h._fullLayout.annotations,g=[],S=[],x=[],T=(l||[]).length;for(a=0;a0||a.explicitOff.length>0},onClick:function(h,l){var a,u,s=M(h,l),o=s.on,c=s.off.concat(s.explicitOff),f={},p=h._fullLayout.annotations;if(o.length||c.length){for(a=0;a.6666666666666666?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[yt]}for(var Be=!1,ze=["x","y"],je=0;je1)&&(ot===st?((Vt=ft.r2fraction(T["a"+$e]))<0||Vt>1)&&(Be=!0):Be=!0),ge=ft._offset+ft.r2p(T[$e]),Ve=.5}else{var Ke=qt==="domain";$e==="x"?(Ee=T[$e],ge=Ke?ft._offset+ft._length*Ee:ge=O.l+O.w*Ee):(Ee=1-T[$e],ge=Ke?ft._offset+ft._length*Ee:ge=O.t+O.h*Ee),Ve=T.showarrow?.5:Ee}if(T.showarrow){Bt.head=ge;var Je=T["a"+$e];if(Ye=Et*Le(.5,T.xanchor)-kt*Le(.5,T.yanchor),ot===st){var qe=h.getRefType(ot);qe==="domain"?($e==="y"&&(Je=1-Je),Bt.tail=ft._offset+ft._length*Je):qe==="paper"?$e==="y"?(Je=1-Je,Bt.tail=O.t+O.h*Je):Bt.tail=O.l+O.w*Je:Bt.tail=ft._offset+ft.r2p(Je),we=Ye}else Bt.tail=ge+Je,we=Ye+Je;Bt.text=Bt.tail+Ye;var nt=I[$e==="x"?"width":"height"];if(st==="paper"&&(Bt.head=M.constrain(Bt.head,1,nt-1)),ot==="pixel"){var ht=-Math.max(Bt.tail-3,Bt.text),Re=Math.min(Bt.tail+3,Bt.text)-nt;ht>0?(Bt.tail+=ht,Bt.text+=ht):Re>0&&(Bt.tail-=Re,Bt.text-=Re)}Bt.tail+=Ot,Bt.head+=Ot}else we=Ye=xt*Le(Ve,Ft),Bt.text=ge+Ye;Bt.text+=Ot,Ye+=Ot,we+=Ot,T["_"+$e+"padplus"]=xt/2+we,T["_"+$e+"padminus"]=xt/2-we,T["_"+$e+"size"]=xt,T["_"+$e+"shift"]=Ye}if(Be)te.remove();else{var Ne=0,Qe=0;if(T.align!=="left"&&(Ne=(ae-Se)*(T.align==="center"?.5:1)),T.valign!=="top"&&(Qe=(he-Ce)*(T.valign==="middle"?.5:1)),_e)Pe.select("svg").attr({x:Q+Ne-1,y:Q+Qe}).call(a.setClipUrl,ie?j:null,x);else{var ut=Q+Qe-Me.top,dt=Q+Ne-Me.left;ye.call(s.positionText,dt,ut).call(a.setClipUrl,ie?j:null,x)}oe.select("rect").call(a.setRect,Q,Q,ae,he),re.call(a.setRect,Z/2,Z/2,be-Z,ke-Z),te.call(a.setTranslate,Math.round(Y.x.text-be/2),Math.round(Y.y.text-ke/2)),q.attr({transform:"rotate("+U+","+Y.x.text+","+Y.y.text+")"});var _t,It=function(Lt,yt){G.selectAll(".annotation-arrow-g").remove();var Pt=Y.x.head,wt=Y.y.head,Rt=Y.x.tail+Lt,Nt=Y.y.tail+yt,$t=Y.x.text+Lt,Wt=Y.y.text+yt,Xt=M.rotationXYMatrix(U,$t,Wt),Qt=M.apply2DTransform(Xt),rn=M.apply2DTransform2(Xt),xn=+re.attr("width"),un=+re.attr("height"),An=$t-.5*xn,$n=An+xn,kn=Wt-.5*un,sn=kn+un,Tn=[[An,kn,An,sn],[An,sn,$n,sn],[$n,sn,$n,kn],[$n,kn,An,kn]].map(rn);if(!Tn.reduce(function(or,vr){return or^!!M.segmentsIntersect(Pt,wt,Pt+1e6,wt+1e6,vr[0],vr[1],vr[2],vr[3])},!1)){Tn.forEach(function(or){var vr=M.segmentsIntersect(Rt,Nt,Pt,wt,or[0],or[1],or[2],or[3]);vr&&(Rt=vr.x,Nt=vr.y)});var dn=T.arrowwidth,pn=T.arrowcolor,Dn=T.arrowside,In=G.append("g").style({opacity:l.opacity(pn)}).classed("annotation-arrow-g",!0),jn=In.append("path").attr("d","M"+Rt+","+Nt+"L"+Pt+","+wt).style("stroke-width",dn+"px").call(l.stroke,l.rgb(pn));if(p(jn,Dn,T),z.annotationPosition&&jn.node().parentNode&&!_){var Gn=Pt,qn=wt;if(T.standoff){var lr=Math.sqrt(Math.pow(Pt-Rt,2)+Math.pow(wt-Nt,2));Gn+=T.standoff*(Rt-Pt)/lr,qn+=T.standoff*(Nt-wt)/lr}var rr,Sr,yr=In.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(Rt-Gn)+","+(Nt-qn),transform:v(Gn,qn)}).style("stroke-width",dn+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");c.init({element:yr.node(),gd:x,prepFn:function(){var or=a.getTranslate(te);rr=or.x,Sr=or.y,A&&A.autorange&&B(A._name+".autorange",!0),L&&L.autorange&&B(L._name+".autorange",!0)},moveFn:function(or,vr){var _r=Qt(rr,Sr),Kt=_r[0]+or,bn=_r[1]+vr;te.call(a.setTranslate,Kt,bn),N("x",g(A,or,"x",O,T)),N("y",g(L,vr,"y",O,T)),T.axref===T.xref&&N("ax",g(A,or,"ax",O,T)),T.ayref===T.yref&&N("ay",g(L,vr,"ay",O,T)),In.attr("transform",v(or,vr)),q.attr({transform:"rotate("+U+","+Kt+","+bn+")"})},doneFn:function(){y.call("_guiRelayout",x,W());var or=document.querySelector(".js-notes-box-panel");or&&or.redraw(or.selectedObj)}})}}};T.showarrow&&It(0,0),H&&c.init({element:te.node(),gd:x,prepFn:function(){_t=q.attr("transform")},moveFn:function(Lt,yt){var Pt="pointer";if(T.showarrow)T.axref===T.xref?N("ax",g(A,Lt,"ax",O,T)):N("ax",T.ax+Lt),T.ayref===T.yref?N("ay",g(L,yt,"ay",O.w,T)):N("ay",T.ay+yt),It(Lt,yt);else{if(_)return;var wt,Rt;if(A)wt=g(A,Lt,"x",O,T);else{var Nt=T._xsize/O.w,$t=T.x+(T._xshift-T.xshift)/O.w-Nt/2;wt=c.align($t+Lt/O.w,Nt,0,1,T.xanchor)}if(L)Rt=g(L,yt,"y",O,T);else{var Wt=T._ysize/O.h,Xt=T.y-(T._yshift+T.yshift)/O.h-Wt/2;Rt=c.align(Xt-yt/O.h,Wt,0,1,T.yanchor)}N("x",wt),N("y",Rt),A&&L||(Pt=c.getCursor(A?.5:wt,L?.5:Rt,T.xanchor,T.yanchor))}q.attr({transform:v(Lt,yt)+_t}),o(te,Pt)},clickFn:function(Lt,yt){T.captureevents&&x.emit("plotly_clickannotation",de(yt))},doneFn:function(){o(te),y.call("_guiRelayout",x,W());var Lt=document.querySelector(".js-notes-box-panel");Lt&&Lt.redraw(Lt.selectedObj)}})}}}k.exports={draw:function(x){var T=x._fullLayout;T._infolayer.selectAll(".annotation").remove();for(var E=0;E=0,_=u.indexOf("end")>=0,A=g.backoff*x+s.standoff,L=S.backoff*T+s.startstandoff;if(w.nodeName==="line"){o={x:+a.attr("x1"),y:+a.attr("y1")},c={x:+a.attr("x2"),y:+a.attr("y2")};var b=o.x-c.x,R=o.y-c.y;if(p=(f=Math.atan2(R,b))+Math.PI,A&&L&&A+L>Math.sqrt(b*b+R*R))return void G();if(A){if(A*A>b*b+R*R)return void G();var I=A*Math.cos(f),O=A*Math.sin(f);c.x+=I,c.y+=O,a.attr({x2:c.x,y2:c.y})}if(L){if(L*L>b*b+R*R)return void G();var z=L*Math.cos(f),F=L*Math.sin(f);o.x-=z,o.y-=F,a.attr({x1:o.x,y1:o.y})}}else if(w.nodeName==="path"){var B=w.getTotalLength(),N="";if(B1){s=!0;break}}s?M.fullLayout._infolayer.select(".annotation-"+M.id+'[data-index="'+a+'"]').remove():(u._pdata=y(M.glplot.cameraParams,[v.xaxis.r2l(u.x)*h[0],v.yaxis.r2l(u.y)*h[1],v.zaxis.r2l(u.z)*h[2]]),d(M.graphDiv,u,a,M.id,u._xa,u._ya))}}},2468:function(k,m,t){var d=t(73972),y=t(71828);k.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:t(26997)}}},layoutAttributes:t(26997),handleDefaults:t(20226),includeBasePlot:function(i,M){var v=d.subplotsRegistry.gl3d;if(v)for(var h=v.attrRegex,l=Object.keys(i),a=0;a=0)))return u;if(p===3)c[p]>1&&(c[p]=1);else if(c[p]>=1)return u}var w=Math.round(255*c[0])+", "+Math.round(255*c[1])+", "+Math.round(255*c[2]);return f?"rgba("+w+", "+c[3]+")":"rgb("+w+")"}M.tinyRGB=function(u){var s=u.toRgb();return"rgb("+Math.round(s.r)+", "+Math.round(s.g)+", "+Math.round(s.b)+")"},M.rgb=function(u){return M.tinyRGB(d(u))},M.opacity=function(u){return u?d(u).getAlpha():0},M.addOpacity=function(u,s){var o=d(u).toRgb();return"rgba("+Math.round(o.r)+", "+Math.round(o.g)+", "+Math.round(o.b)+", "+s+")"},M.combine=function(u,s){var o=d(u).toRgb();if(o.a===1)return d(u).toRgbString();var c=d(s||l).toRgb(),f=c.a===1?c:{r:255*(1-c.a)+c.r*c.a,g:255*(1-c.a)+c.g*c.a,b:255*(1-c.a)+c.b*c.a},p={r:f.r*(1-o.a)+o.r*o.a,g:f.g*(1-o.a)+o.g*o.a,b:f.b*(1-o.a)+o.b*o.a};return d(p).toRgbString()},M.contrast=function(u,s,o){var c=d(u);return c.getAlpha()!==1&&(c=d(M.combine(u,l))),(c.isDark()?s?c.lighten(s):l:o?c.darken(o):h).toString()},M.stroke=function(u,s){var o=d(s);u.style({stroke:M.tinyRGB(o),"stroke-opacity":o.getAlpha()})},M.fill=function(u,s){var o=d(s);u.style({fill:M.tinyRGB(o),"fill-opacity":o.getAlpha()})},M.clean=function(u){if(u&&typeof u=="object"){var s,o,c,f,p=Object.keys(u);for(s=0;s0?Je>=Ne:Je<=Ne));qe++)Je>ut&&Je0?Je>=Ne:Je<=Ne));qe++)Je>Ke[0]&&Je1){var ot=Math.pow(10,Math.floor(Math.log(st)/Math.LN10));Ye*=ot*l.roundUp(st/ot,[2,5,10]),(Math.abs(_e.start)/_e.size+1e-6)%1<2e-6&&(Ee.tick0=0)}Ee.dtick=Ye}Ee.domain=W?[ge+Q/ue.h,ge+ke-Q/ue.h]:[ge+X/ue.w,ge+ke-X/ue.w],Ee.setScale(),F.attr("transform",a(Math.round(ue.l),Math.round(ue.t)));var ft,bt=F.select("."+L.cbtitleunshift).attr("transform",a(-Math.round(ue.l),-Math.round(ue.t))),Et=Ee.ticklabelposition,kt=Ee.title.font.size,xt=F.select("."+L.cbaxis),Ft=0,Ot=0;function Bt(qt,Vt){var Ke={propContainer:Ee,propName:B._propPrefix+"title",traceIndex:B._traceIndex,_meta:B._meta,placeholder:oe._dfltTitle.colorbar,containerGroup:F.select("."+L.cbtitle)},Je=qt.charAt(0)==="h"?qt.substr(1):"h"+qt;F.selectAll("."+Je+",."+Je+"-math-group").remove(),f.draw(N,qt,u(Ke,Vt||{}))}return l.syncOrAsync([i.previousPromises,function(){var qt,Vt;(W&&Ve||!W&&!Ve)&&(me==="top"&&(qt=X+ue.l+ue.w*re,Vt=Q+ue.t+ue.h*(1-ge-ke)+3+.75*kt),me==="bottom"&&(qt=X+ue.l+ue.w*re,Vt=Q+ue.t+ue.h*(1-ge)-3-.25*kt),me==="right"&&(Vt=Q+ue.t+ue.h*ie+3+.75*kt,qt=X+ue.l+ue.w*ge),Bt(Ee._id+"title",{attributes:{x:qt,y:Vt,"text-anchor":W?"start":"middle"}}))},function(){if(!W&&!Ve||W&&Ve){var qt,Vt=F.select("."+L.cbtitle),Ke=Vt.select("text"),Je=[-q/2,q/2],qe=Vt.select(".h"+Ee._id+"title-math-group").node(),nt=15.6;if(Ke.node()&&(nt=parseInt(Ke.node().style.fontSize,10)*E),qe?(qt=o.bBox(qe),Ot=qt.width,(Ft=qt.height)>nt&&(Je[1]-=(Ft-nt)/2)):Ke.node()&&!Ke.classed(L.jsPlaceholder)&&(qt=o.bBox(Ke.node()),Ot=qt.width,Ft=qt.height),W){if(Ft){if(Ft+=5,me==="top")Ee.domain[1]-=Ft/ue.h,Je[1]*=-1;else{Ee.domain[0]+=Ft/ue.h;var ht=p.lineCount(Ke);Je[1]+=(1-ht)*nt}Vt.attr("transform",a(Je[0],Je[1])),Ee.setScale()}}else Ot&&(me==="right"&&(Ee.domain[0]+=(Ot+kt/2)/ue.w),Vt.attr("transform",a(Je[0],Je[1])),Ee.setScale())}F.selectAll("."+L.cbfills+",."+L.cblines).attr("transform",W?a(0,Math.round(ue.h*(1-Ee.domain[1]))):a(Math.round(ue.w*Ee.domain[0]),0)),xt.attr("transform",W?a(0,Math.round(-ue.t)):a(Math.round(-ue.l),0));var Re=F.select("."+L.cbfills).selectAll("rect."+L.cbfill).attr("style","").data(Se);Re.enter().append("rect").classed(L.cbfill,!0).style("stroke","none"),Re.exit().remove();var Ne=pe.map(Ee.c2p).map(Math.round).sort(function(It,Lt){return It-Lt});Re.each(function(It,Lt){var yt=[Lt===0?pe[0]:(Se[Lt]+Se[Lt-1])/2,Lt===Se.length-1?pe[1]:(Se[Lt]+Se[Lt+1])/2].map(Ee.c2p).map(Math.round);W&&(yt[1]=l.constrain(yt[1]+(yt[1]>yt[0])?1:-1,Ne[0],Ne[1]));var Pt=d.select(this).attr(W?"x":"y",Le).attr(W?"y":"x",d.min(yt)).attr(W?"width":"height",Math.max(ae,2)).attr(W?"height":"width",Math.max(d.max(yt)-d.min(yt),2));if(B._fillgradient)o.gradient(Pt,N,B._id,W?"vertical":"horizontalreversed",B._fillgradient,"fill");else{var wt=Pe(It).replace("e-","");Pt.attr("fill",y(wt).toHexString())}});var Qe=F.select("."+L.cblines).selectAll("path."+L.cbline).data(ye.color&&ye.width?Ce:[]);Qe.enter().append("path").classed(L.cbline,!0),Qe.exit().remove(),Qe.each(function(It){var Lt=Le,yt=Math.round(Ee.c2p(It))+ye.width/2%1;d.select(this).attr("d","M"+(W?Lt+","+yt:yt+","+Lt)+(W?"h":"v")+ae).call(o.lineGroupStyle,ye.width,xe(It),ye.dash)}),xt.selectAll("g."+Ee._id+"tick,path").remove();var ut=Le+ae+(q||0)/2-(B.ticks==="outside"?1:0),dt=v.calcTicks(Ee),_t=v.getTickSigns(Ee)[2];return v.drawTicks(N,Ee,{vals:Ee.ticks==="inside"?v.clipEnds(Ee,dt):dt,layer:xt,path:v.makeTickPath(Ee,ut,_t),transFn:v.makeTransTickFn(Ee)}),v.drawLabels(N,Ee,{vals:dt,layer:xt,transFn:v.makeTransTickLabelFn(Ee),labelFns:v.makeLabelFns(Ee,ut)})},function(){if(W&&!Ve||!W&&Ve){var qt,Vt,Ke=Ee.position||0,Je=Ee._offset+Ee._length/2;if(me==="right")Vt=Je,qt=ue.l+ue.w*Ke+10+kt*(Ee.showticklabels?1:.5);else if(qt=Je,me==="bottom"&&(Vt=ue.t+ue.h*Ke+10+(Et.indexOf("inside")===-1?Ee.tickfont.size:0)+(Ee.ticks!=="intside"&&B.ticklen||0)),me==="top"){var qe=de.text.split("
").length;Vt=ue.t+ue.h*Ke+10-ae-E*kt*qe}Bt((W?"h":"v")+Ee._id+"title",{avoid:{selection:d.select(N).selectAll("g."+Ee._id+"tick"),side:me,offsetTop:W?0:ue.t,offsetLeft:W?ue.l:0,maxShift:W?oe.width:oe.height},attributes:{x:qt,y:Vt,"text-anchor":"middle"},transform:{rotate:W?-90:0,offset:0}})}},i.previousPromises,function(){var qt,Vt=ae+q/2;Et.indexOf("inside")===-1&&(qt=o.bBox(xt.node()),Vt+=W?qt.width:qt.height),ft=bt.select("text");var Ke=0,Je=W&&me==="top",qe=!W&&me==="right",nt=0;if(ft.node()&&!ft.classed(L.jsPlaceholder)){var ht,Re=bt.select(".h"+Ee._id+"title-math-group").node();Re&&(W&&Ve||!W&&!Ve)?(Ke=(qt=o.bBox(Re)).width,ht=qt.height):(Ke=(qt=o.bBox(bt.node())).right-ue.l-(W?Le:we),ht=qt.bottom-ue.t-(W?we:Le),W||me!=="top"||(Vt+=qt.height,nt=qt.height)),qe&&(ft.attr("transform",a(Ke/2+kt/2,0)),Ke*=2),Vt=Math.max(Vt,W?Ke:ht)}var Ne=2*(W?X:Q)+Vt+H+q/2,Qe=0;!W&&de.text&&Z==="bottom"&&ie<=0&&(Ne+=Qe=Ne/2,nt+=Qe),oe._hColorbarMoveTitle=Qe,oe._hColorbarMoveCBTitle=nt;var ut=H+q;F.select("."+L.cbbg).attr("x",(W?Le:we)-ut/2-(W?X:0)).attr("y",(W?we:Le)-(W?be:Q+nt-Qe)).attr(W?"width":"height",Math.max(Ne-Qe,2)).attr(W?"height":"width",Math.max(be+ut,2)).call(c.fill,ne).call(c.stroke,B.bordercolor).style("stroke-width",H);var dt=qe?Math.max(Ke-10,0):0;if(F.selectAll("."+L.cboutline).attr("x",(W?Le:we+X)+dt).attr("y",(W?we+Q-be:Le)+(Je?Ft:0)).attr(W?"width":"height",Math.max(ae,2)).attr(W?"height":"width",Math.max(be-(W?2*Q+Ft:2*X+dt),2)).call(c.stroke,B.outlinecolor).style({fill:"none","stroke-width":q}),F.attr("transform",a(ue.l-(W?Be*Ne:0),ue.t-(W?0:(1-ze)*Ne-nt))),!W&&(H||y(ne).getAlpha()&&!y.equals(oe.paper_bgcolor,ne))){var _t=xt.selectAll("text"),It=_t[0].length,Lt=F.select("."+L.cbbg).node(),yt=o.bBox(Lt),Pt=o.getTranslate(F);_t.each(function(Qt,rn){var xn=It-1;if(rn===0||rn===xn){var un,An=o.bBox(this),$n=o.getTranslate(this);if(rn===xn){var kn=An.right+$n.x;(un=yt.right+Pt.x+we-H-2+re-kn)>0&&(un=0)}else if(rn===0){var sn=An.left+$n.x;(un=yt.left+Pt.x+we+H+2-sn)<0&&(un=0)}un&&(It<3?this.setAttribute("transform","translate("+un+",0) "+this.getAttribute("transform")):this.setAttribute("visibility","hidden"))}})}var wt={},Rt=_[te],Nt=A[te],$t=_[Z],Wt=A[Z],Xt=Ne-ae;W?(Y==="pixels"?(wt.y=ie,wt.t=be*$t,wt.b=be*Wt):(wt.t=wt.b=0,wt.yt=ie+j*$t,wt.yb=ie-j*Wt),G==="pixels"?(wt.x=re,wt.l=Ne*Rt,wt.r=Ne*Nt):(wt.l=Xt*Rt,wt.r=Xt*Nt,wt.xl=re-U*Rt,wt.xr=re+U*Nt)):(Y==="pixels"?(wt.x=re,wt.l=be*Rt,wt.r=be*Nt):(wt.l=wt.r=0,wt.xl=re+j*Rt,wt.xr=re-j*Nt),G==="pixels"?(wt.y=1-ie,wt.t=Ne*$t,wt.b=Ne*Wt):(wt.t=Xt*$t,wt.b=Xt*Wt,wt.yt=ie-U*$t,wt.yb=ie+U*Wt)),i.autoMargin(N,B._id,wt)}],N)}(O,I,b);z&&z.then&&(b._promises||[]).push(z),b._context.edits.colorbarPosition&&function(F,B,N){var W,j,Y,U=B.orientation==="v",G=N._fullLayout._size;h.init({element:F.node(),gd:N,prepFn:function(){W=F.attr("transform"),s(F)},moveFn:function(q,H){F.attr("transform",W+a(q,H)),j=h.align((U?B._uFrac:B._vFrac)+q/G.w,U?B._thickFrac:B._lenFrac,0,1,B.xanchor),Y=h.align((U?B._vFrac:1-B._uFrac)-H/G.h,U?B._lenFrac:B._thickFrac,0,1,B.yanchor);var ne=h.getCursor(j,Y,B.xanchor,B.yanchor);s(F,ne)},doneFn:function(){if(s(F),j!==void 0&&Y!==void 0){var q={};q[B._propPrefix+"x"]=j,q[B._propPrefix+"y"]=Y,B._traceIndex!==void 0?M.call("_guiRestyle",N,q,B._traceIndex):M.call("_guiRelayout",N,q)}}})}(O,I,b)}),R.exit().each(function(I){i.autoMargin(b,I._id)}).remove(),R.order()}}},76228:function(k,m,t){var d=t(71828);k.exports=function(y){return d.isPlainObject(y.colorbar)}},12311:function(k,m,t){k.exports={moduleType:"component",name:"colorbar",attributes:t(63583),supplyDefaults:t(62499),draw:t(98981).draw,hasColorbar:t(76228)}},50693:function(k,m,t){var d=t(63583),y=t(30587).counter,i=t(78607),M=t(63282).scales;function v(h){return"`"+h+"`"}i(M),k.exports=function(h,l){h=h||"";var a,u=(l=l||{}).cLetter||"c",s=("onlyIfNumerical"in l&&l.onlyIfNumerical,"noScale"in l?l.noScale:h==="marker.line"),o="showScaleDflt"in l?l.showScaleDflt:u==="z",c=typeof l.colorscaleDflt=="string"?M[l.colorscaleDflt]:null,f=l.editTypeOverride||"",p=h?h+".":"";"colorAttr"in l?(a=l.colorAttr,l.colorAttr):v(p+(a={z:"z",c:"color"}[u]));var w=u+"auto",g=u+"min",S=u+"max",x=u+"mid",T={};T[g]=T[S]=void 0;var E={};E[w]=!1;var _={};return a==="color"&&(_.color={valType:"color",arrayOk:!0,editType:f||"style"},l.anim&&(_.color.anim=!0)),_[w]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:T},_[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:E},_[S]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:E},_[x]={valType:"number",dflt:null,editType:"calc",impliedEdits:T},_.colorscale={valType:"colorscale",editType:"calc",dflt:c,impliedEdits:{autocolorscale:!1}},_.autocolorscale={valType:"boolean",dflt:l.autoColorDflt!==!1,editType:"calc",impliedEdits:{colorscale:void 0}},_.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(_.showscale={valType:"boolean",dflt:o,editType:"calc"},_.colorbar=d),l.noColorAxis||(_.coloraxis={valType:"subplotid",regex:y("coloraxis"),dflt:null,editType:"calc"}),_}},78803:function(k,m,t){var d=t(92770),y=t(71828),i=t(52075).extractOpts;k.exports=function(M,v,h){var l,a=M._fullLayout,u=h.vals,s=h.containerStr,o=s?y.nestedProperty(v,s).get():v,c=i(o),f=c.auto!==!1,p=c.min,w=c.max,g=c.mid,S=function(){return y.aggNums(Math.min,null,u)},x=function(){return y.aggNums(Math.max,null,u)};p===void 0?p=S():f&&(p=o._colorAx&&d(p)?Math.min(p,S()):S()),w===void 0?w=x():f&&(w=o._colorAx&&d(w)?Math.max(w,x()):x()),f&&g!==void 0&&(w-g>g-p?p=g-(w-g):w-g=0?a.colorscale.sequential:a.colorscale.sequentialminus,c._sync("colorscale",l))}},33046:function(k,m,t){var d=t(71828),y=t(52075).hasColorscale,i=t(52075).extractOpts;k.exports=function(M,v){function h(f,p){var w=f["_"+p];w!==void 0&&(f[p]=w)}function l(f,p){var w=p.container?d.nestedProperty(f,p.container).get():f;if(w)if(w.coloraxis)w._colorAx=v[w.coloraxis];else{var g=i(w),S=g.auto;(S||g.min===void 0)&&h(w,p.min),(S||g.max===void 0)&&h(w,p.max),g.autocolorscale&&h(w,"colorscale")}}for(var a=0;a=0;S--,x++){var T=p[S];g[x]=[1-T[0],T[1]]}return g}function c(p,w){w=w||{};for(var g=p.domain,S=p.range,x=S.length,T=new Array(x),E=0;E1.3333333333333333-h?v:h}},70461:function(k,m,t){var d=t(71828),y=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];k.exports=function(i,M,v,h){return i=v==="left"?0:v==="center"?1:v==="right"?2:d.constrain(Math.floor(3*i),0,2),M=h==="bottom"?0:h==="middle"?1:h==="top"?2:d.constrain(Math.floor(3*M),0,2),y[M][i]}},64505:function(k,m){m.selectMode=function(t){return t==="lasso"||t==="select"},m.drawMode=function(t){return t==="drawclosedpath"||t==="drawopenpath"||t==="drawline"||t==="drawrect"||t==="drawcircle"},m.openMode=function(t){return t==="drawline"||t==="drawopenpath"},m.rectMode=function(t){return t==="select"||t==="drawline"||t==="drawrect"||t==="drawcircle"},m.freeMode=function(t){return t==="lasso"||t==="drawclosedpath"||t==="drawopenpath"},m.selectingOrDrawing=function(t){return m.freeMode(t)||m.rectMode(t)}},28569:function(k,m,t){var d=t(48956),y=t(57035),i=t(38520),M=t(71828).removeElement,v=t(85555),h=k.exports={};h.align=t(92807),h.getCursor=t(70461);var l=t(26041);function a(){var s=document.createElement("div");s.className="dragcover";var o=s.style;return o.position="fixed",o.left=0,o.right=0,o.top=0,o.bottom=0,o.zIndex=999999999,o.background="none",document.body.appendChild(s),s}function u(s){return d(s.changedTouches?s.changedTouches[0]:s,document.body)}h.unhover=l.wrapped,h.unhoverRaw=l.raw,h.init=function(s){var o,c,f,p,w,g,S,x,T=s.gd,E=1,_=T._context.doubleClickDelay,A=s.element;T._mouseDownTime||(T._mouseDownTime=0),A.style.pointerEvents="all",A.onmousedown=b,i?(A._ontouchstart&&A.removeEventListener("touchstart",A._ontouchstart),A._ontouchstart=b,A.addEventListener("touchstart",b,{passive:!1})):A.ontouchstart=b;var L=s.clampFn||function(O,z,F){return Math.abs(O)_&&(E=Math.max(E-1,1)),T._dragged)s.doneFn&&s.doneFn();else if(s.clickFn&&s.clickFn(E,g),!x){var z;try{z=new MouseEvent("click",O)}catch{var F=u(O);(z=document.createEvent("MouseEvents")).initMouseEvent("click",O.bubbles,O.cancelable,O.view,O.detail,O.screenX,O.screenY,F[0],F[1],O.ctrlKey,O.altKey,O.shiftKey,O.metaKey,O.button,O.relatedTarget)}S.dispatchEvent(z)}T._dragging=!1,T._dragged=!1}else T._dragged=!1}},h.coverSlip=a},26041:function(k,m,t){var d=t(11086),y=t(79990),i=t(24401).getGraphDiv,M=t(26675),v=k.exports={};v.wrapped=function(h,l,a){(h=i(h))._fullLayout&&y.clear(h._fullLayout._uid+M.HOVERID),v.raw(h,l,a)},v.raw=function(h,l){var a=h._fullLayout,u=h._hoverdata;l||(l={}),l.target&&!h._dragged&&d.triggerHandler(h,"plotly_beforehover",l)===!1||(a._hoverlayer.selectAll("g").remove(),a._hoverlayer.selectAll("line").remove(),a._hoverlayer.selectAll("circle").remove(),h._hoverdata=void 0,l.target&&u&&h.emit("plotly_unhover",{event:l,points:u}))}},79952:function(k,m){m.P={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"},m.u={shape:{valType:"enumerated",values:["","/","\\","x","-","|","+","."],dflt:"",arrayOk:!0,editType:"style"},fillmode:{valType:"enumerated",values:["replace","overlay"],dflt:"replace",editType:"style"},bgcolor:{valType:"color",arrayOk:!0,editType:"style"},fgcolor:{valType:"color",arrayOk:!0,editType:"style"},fgopacity:{valType:"number",editType:"style",min:0,max:1},size:{valType:"number",min:0,dflt:8,arrayOk:!0,editType:"style"},solidity:{valType:"number",min:0,max:1,dflt:.3,arrayOk:!0,editType:"style"},editType:"style"}},91424:function(k,m,t){var d=t(39898),y=t(71828),i=y.numberFormat,M=t(92770),v=t(84267),h=t(73972),l=t(7901),a=t(21081),u=y.strTranslate,s=t(63893),o=t(77922),c=t(18783).LINE_SPACING,f=t(37822).DESELECTDIM,p=t(34098),w=t(39984),g=t(23469).appendArrayPointValue,S=k.exports={};function x(_e,Me,Se){var Ce=Me.fillpattern,ae=Ce&&S.getPatternAttr(Ce.shape,0,"");if(ae){var he=S.getPatternAttr(Ce.bgcolor,0,null),be=S.getPatternAttr(Ce.fgcolor,0,null),ke=Ce.fgopacity,Le=S.getPatternAttr(Ce.size,0,8),Be=S.getPatternAttr(Ce.solidity,0,.3),ze=Me.uid;S.pattern(_e,"point",Se,ze,ae,Le,Be,void 0,Ce.fillmode,he,be,ke)}else Me.fillcolor&&_e.call(l.fill,Me.fillcolor)}S.font=function(_e,Me,Se,Ce){y.isPlainObject(Me)&&(Ce=Me.color,Se=Me.size,Me=Me.family),Me&&_e.style("font-family",Me),Se+1&&_e.style("font-size",Se+"px"),Ce&&_e.call(l.fill,Ce)},S.setPosition=function(_e,Me,Se){_e.attr("x",Me).attr("y",Se)},S.setSize=function(_e,Me,Se){_e.attr("width",Me).attr("height",Se)},S.setRect=function(_e,Me,Se,Ce,ae){_e.call(S.setPosition,Me,Se).call(S.setSize,Ce,ae)},S.translatePoint=function(_e,Me,Se,Ce){var ae=Se.c2p(_e.x),he=Ce.c2p(_e.y);return!!(M(ae)&&M(he)&&Me.node())&&(Me.node().nodeName==="text"?Me.attr("x",ae).attr("y",he):Me.attr("transform",u(ae,he)),!0)},S.translatePoints=function(_e,Me,Se){_e.each(function(Ce){var ae=d.select(this);S.translatePoint(Ce,ae,Me,Se)})},S.hideOutsideRangePoint=function(_e,Me,Se,Ce,ae,he){Me.attr("display",Se.isPtWithinRange(_e,ae)&&Ce.isPtWithinRange(_e,he)?null:"none")},S.hideOutsideRangePoints=function(_e,Me){if(Me._hasClipOnAxisFalse){var Se=Me.xaxis,Ce=Me.yaxis;_e.each(function(ae){var he=ae[0].trace,be=he.xcalendar,ke=he.ycalendar,Le=h.traceIs(he,"bar-like")?".bartext":".point,.textpoint";_e.selectAll(Le).each(function(Be){S.hideOutsideRangePoint(Be,d.select(this),Se,Ce,be,ke)})})}},S.crispRound=function(_e,Me,Se){return Me&&M(Me)?_e._context.staticPlot?Me:Me<1?1:Math.round(Me):Se||0},S.singleLineStyle=function(_e,Me,Se,Ce,ae){Me.style("fill","none");var he=(((_e||[])[0]||{}).trace||{}).line||{},be=Se||he.width||0,ke=ae||he.dash||"";l.stroke(Me,Ce||he.color),S.dashLine(Me,ke,be)},S.lineGroupStyle=function(_e,Me,Se,Ce){_e.style("fill","none").each(function(ae){var he=(((ae||[])[0]||{}).trace||{}).line||{},be=Me||he.width||0,ke=Ce||he.dash||"";d.select(this).call(l.stroke,Se||he.color).call(S.dashLine,ke,be)})},S.dashLine=function(_e,Me,Se){Se=+Se||0,Me=S.dashStyle(Me,Se),_e.style({"stroke-dasharray":Me,"stroke-width":Se+"px"})},S.dashStyle=function(_e,Me){Me=+Me||1;var Se=Math.max(Me,3);return _e==="solid"?_e="":_e==="dot"?_e=Se+"px,"+Se+"px":_e==="dash"?_e=3*Se+"px,"+3*Se+"px":_e==="longdash"?_e=5*Se+"px,"+5*Se+"px":_e==="dashdot"?_e=3*Se+"px,"+Se+"px,"+Se+"px,"+Se+"px":_e==="longdashdot"&&(_e=5*Se+"px,"+2*Se+"px,"+Se+"px,"+2*Se+"px"),_e},S.singleFillStyle=function(_e,Me){var Se=d.select(_e.node());x(_e,((Se.data()[0]||[])[0]||{}).trace||{},Me)},S.fillGroupStyle=function(_e,Me){_e.style("stroke-width",0).each(function(Se){var Ce=d.select(this);Se[0].trace&&x(Ce,Se[0].trace,Me)})};var T=t(90998);S.symbolNames=[],S.symbolFuncs=[],S.symbolBackOffs=[],S.symbolNeedLines={},S.symbolNoDot={},S.symbolNoFill={},S.symbolList=[],Object.keys(T).forEach(function(_e){var Me=T[_e],Se=Me.n;S.symbolList.push(Se,String(Se),_e,Se+100,String(Se+100),_e+"-open"),S.symbolNames[Se]=_e,S.symbolFuncs[Se]=Me.f,S.symbolBackOffs[Se]=Me.backoff||0,Me.needLine&&(S.symbolNeedLines[Se]=!0),Me.noDot?S.symbolNoDot[Se]=!0:S.symbolList.push(Se+200,String(Se+200),_e+"-dot",Se+300,String(Se+300),_e+"-open-dot"),Me.noFill&&(S.symbolNoFill[Se]=!0)});var E=S.symbolNames.length;function _(_e,Me,Se,Ce){var ae=_e%100;return S.symbolFuncs[ae](Me,Se,Ce)+(_e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}S.symbolNumber=function(_e){if(M(_e))_e=+_e;else if(typeof _e=="string"){var Me=0;_e.indexOf("-open")>0&&(Me=100,_e=_e.replace("-open","")),_e.indexOf("-dot")>0&&(Me+=200,_e=_e.replace("-dot","")),(_e=S.symbolNames.indexOf(_e))>=0&&(_e+=Me)}return _e%100>=E||_e>=400?0:Math.floor(Math.max(_e,0))};var A={x1:1,x2:0,y1:0,y2:0},L={x1:0,x2:0,y1:1,y2:0},b=i("~f"),R={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:A},horizontalreversed:{node:"linearGradient",attrs:A,reversed:!0},vertical:{node:"linearGradient",attrs:L},verticalreversed:{node:"linearGradient",attrs:L,reversed:!0}};S.gradient=function(_e,Me,Se,Ce,ae,he){for(var be=ae.length,ke=R[Ce],Le=new Array(be),Be=0;Be