df-script 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -12
- package/dist/columnExpressions/ExprBase.d.ts +7 -0
- package/dist/columnExpressions/constants.d.ts +1 -0
- package/dist/columnExpressions/functions/when.d.ts +8 -6
- package/dist/columnExpressions/index.d.ts +1 -0
- package/dist/columnExpressions/mixins/AggregationExpr.d.ts +203 -1
- package/dist/columnExpressions/mixins/ArrayExpr.d.ts +57 -41
- package/dist/columnExpressions/mixins/StringExpr.d.ts +277 -13
- package/dist/columnExpressions/mixins/StructExpr.d.ts +7 -7
- package/dist/columnExpressions/typeInference.d.ts +13 -0
- package/dist/columnExpressions/types.d.ts +1 -1
- package/dist/columnExpressions/utils.d.ts +9 -0
- package/dist/constants.d.ts +29 -0
- package/dist/dataframe/dataframe.d.ts +0 -16
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/dist/types.d.ts +108 -0
- package/dist/utils/array.d.ts +39 -6
- package/dist/utils/binary.d.ts +6 -2
- package/dist/utils/json.d.ts +54 -2
- package/dist/utils/number.d.ts +5 -2
- package/dist/utils/object.d.ts +13 -0
- package/dist/utils/string.d.ts +78 -2
- package/dist/utils/table.d.ts +76 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var nn=Object.defineProperty;var ws=Object.getOwnPropertyDescriptor;var Ss=Object.getOwnPropertyNames;var As=Object.prototype.hasOwnProperty;var Pe=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var hr=(n,e)=>{for(var t in e)nn(n,t,{get:e[t],enumerable:!0})},Ds=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ss(e))!As.call(n,o)&&o!==t&&nn(n,o,{get:()=>e[o],enumerable:!(r=ws(e,o))||r.enumerable});return n};var yr=n=>Ds(nn({},"__esModule",{value:!0}),n);var se,dr,gr,Ye,_r,br,be=k(()=>{"use strict";se="*",dr="*literal*",gr="*coalesce*",Ye="*element*",_r="*struct*",br="*duration*"});var xr=k(()=>{"use strict"});function K(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function Ee(n){if(!K(n))return!1;let e=Object.getPrototypeOf(n);if(e===null)return!0;let t=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof t!="function"?!1:Function.prototype.toString.call(t)===qs}function vr(n){if(typeof n!="function")return!1;let e="";try{e=Function.prototype.toString.call(n)}catch{return!1}if(/^class[\s{]/.test(e))return!0;if(n===Symbol||n===BigInt)return!1;let t=Object.getOwnPropertyDescriptor(n,"prototype");return t&&!t.writable?e.includes("[native code]"):!1}function me(n,e,t,r){if(!K(n))return!1;if(!(Symbol.toStringTag in n))return Object.prototype.toString.call(n)===e;if(!t)return!1;try{return t.call(n,r),!0}catch{return!1}}function U(n){return me(n,Ts,rn)&&rn?!Number.isNaN(rn.call(n)):!1}function xe(n){return me(n,Cs,Ls)}function dt(n){return me(n,Os,Ps)}function gt(n){return me(n,Is,Bs)}function Mr(n){return me(n,ks,$s,"key")}function Ur(n){return K(n)?Symbol.toStringTag in n?n instanceof Error:Object.prototype.toString.call(n)===Es:!1}function Ar(n){return me(n,Ir,on)}function Dr(n){return me(n,Er,sn)}function Tr(n){return me(n,kr,an)}function Cr(n){return me(n,Rr,He)}function Or(n){return me(n,Nr,Xe)}function ce(n){if(!K(n))return n;switch(Object.prototype.toString.call(n)){case Er:if(Dr(n))try{return sn.call(n)}catch{}break;case Ir:if(Ar(n))try{return on.call(n)}catch{}break;case kr:if(Tr(n))try{return an.call(n)}catch{}break;case Rr:if(Cr(n)&&He)try{return He.call(n)}catch{}break;case Nr:if(Or(n)&&Xe)try{return Xe.call(n)}catch{}break}if(Symbol.toStringTag in n){if(Dr(n))try{return sn.call(n)}catch{}else if(Ar(n))try{return on.call(n)}catch{}else if(Tr(n))try{return an.call(n)}catch{}else if(Cr(n)&&He)try{return He.call(n)}catch{}else if(Or(n)&&Xe)try{return Xe.call(n)}catch{}}if(typeof n.valueOf=="function"&&n.valueOf!==Object.prototype.valueOf)try{let t=n.valueOf();if(typeof t!="object"||t===null)return t}catch{}return n}var Ts,Cs,Os,Is,Es,ks,Ir,Er,kr,Rr,Nr,Rs,Ns,wr,Sr,vs,Ms,Us,Fs,js,Vs,Ls,Ps,Bs,rn,$s,on,sn,an,He,Xe,qs,ye=k(()=>{"use strict";Ts="[object Date]",Cs="[object RegExp]",Os="[object Set]",Is="[object Map]",Es="[object Error]",ks="[object URLSearchParams]",Ir="[object String]",Er="[object Number]",kr="[object Boolean]",Rr="[object BigInt]",Nr="[object Symbol]",Rs=typeof Date=="function"?Date.prototype:void 0,Ns=Object.getPrototypeOf(/./),wr=typeof Set=="function"?Set.prototype:void 0,Sr=typeof Map=="function"?Map.prototype:void 0,vs=typeof URLSearchParams=="function"?URLSearchParams.prototype:void 0,Ms=Object.getPrototypeOf(""),Us=Object.getPrototypeOf(0),Fs=Object.getPrototypeOf(!0),js=typeof BigInt=="function"?BigInt.prototype:void 0,Vs=typeof Symbol=="function"?Symbol.prototype:void 0,Ls=Object.getOwnPropertyDescriptor(Ns,"source")?.get,Ps=wr?Object.getOwnPropertyDescriptor(wr,"size")?.get:void 0,Bs=Sr?Object.getOwnPropertyDescriptor(Sr,"size")?.get:void 0,rn=Rs?.valueOf,$s=vs?.has,on=Ms.valueOf,sn=Us.valueOf,an=Fs.valueOf,He=js?.valueOf,Xe=Vs?.valueOf,qs=Function.prototype.toString.call(Object)});var ln,un,Fr=k(()=>{"use strict";ln=1000n,un=1000000n});function F(n,e){return typeof n!="number"?!1:Number.isNaN(n)?e?.allowNaN??e?.allowNonFiniteNumbers??!1:Number.isFinite(n)?!0:e?.allowNonFiniteNumbers??!1}function jr(n){for(let e=1;e<n.length;e++)if(n[e].length!==3)return!1;return!0}function $r(n,e){if(Ks.test(n))return null;let t=n.trim();if(t==="")return null;t.startsWith("(")&&t.endsWith(")")&&(t="-"+t.slice(1,-1).trim());let r=t[t.length-1];(r==="-"||r==="+")&&t.length>1&&(t=r+t.slice(0,-1).trim()),e||(t=t.replace(zs,""));let o=t.includes("."),s=t.includes(",");if(o&&s){let a=t.lastIndexOf("."),i=t.lastIndexOf(","),l=i>a,f=l?".":",",u=l?i:a,c=t.slice(0,u).split(f);return c.length>1&&!jr(c)||c[0].replace(Vr,"").length>3?null:l?t.replace(Lr,"").replace(_t,"."):t.replace(_t,"")}if(s||o){let a=s?",":".",i=t.split(a);if(i.length>2||a===","&&i.length===2&&i[1].length===3){let l=i[0].replace(Vr,"").length;if(l===0){if(a===","||i.length>2)return null}else return l>3?null:jr(i)?t.replace(s?_t:Lr,""):null}if(s)return t.replace(_t,".")}return t}function M(n,{allowNonFiniteNumbers:e=!1,strictNumericString:t=!1,floatScientific:r=!0}={}){if(n==null||typeof n=="symbol")return null;switch(n=ce(n),typeof n){case"number":return F(n,{allowNonFiniteNumbers:e})?n:null;case"boolean":return n?1:0;case"bigint":{let o=Number(n);return F(o,{allowNonFiniteNumbers:e})?o:null}case"object":{if(U(n)){let o=n.getTime();return F(o,{allowNonFiniteNumbers:e})?o:null}return null}case"string":{let o=$r(n,t);if(o===null)return null;if(e){let i=o.toLowerCase();if(i==="nan"||i==="-nan"||i==="+nan")return NaN;if(i==="infinity"||i==="+infinity")return 1/0;if(i==="-infinity")return-1/0}if(Br.test(o)&&!r||!Pr.test(o))return null;let a=Number(o);return F(a,{allowNonFiniteNumbers:e})?a:null}default:return null}}function qr({locale:n="en-US",accountingNegatives:e=!1,fallback:t="NaN",formatNonFinite:r=!1,...o}={}){o.useGrouping===void 0&&(o.useGrouping=!1),o.maximumFractionDigits===void 0&&o.maximumSignificantDigits===void 0&&(o.maximumFractionDigits=20),e&&(o.currencySign="accounting",o.style===void 0&&(o.style="decimal"));let s=new Intl.NumberFormat(n,o);return a=>{if(typeof a=="bigint")return e&&a<0n?`(${s.format(-a)})`:s.format(a);let i=M(a,{allowNonFiniteNumbers:!0});return i===null||Number.isNaN(i)?t:Number.isFinite(i)?e&&i<0?`(${s.format(Math.abs(i))})`:s.format(i):r?t:e&&i===-1/0?`(${s.format(1/0)})`:String(i)}}function cn(n,{floatPrecision:e="Float64",allowNonFiniteNumbers:t=!0,floatScientific:r=!0,strictNumericString:o=!1}={}){let s=M(n,{allowNonFiniteNumbers:t,floatScientific:r,strictNumericString:o});return s===null||(e==="Float32"&&(s=Math.fround(s)),!F(s,{allowNonFiniteNumbers:t}))?null:s}function bt(n,{range:e="Int32"}={}){if(!F(n)||!Number.isInteger(n))return!1;let t=typeof e=="string"?Kr[e]:e;return n>=t.min&&n<=t.max}function de(n,{range:e="Int32",coerce:t="truncate"}={}){let r=M(n);if(r===null)return null;switch(t){case"round":r=Math.round(r);break;case"floor":r=Math.floor(r);break;case"ceil":r=Math.ceil(r);break;case"truncate":r=Math.trunc(r);break}let o=typeof e=="string"?Kr[e]:e;return pe(r,{min:o.min,max:o.max})}function Be(n,{range:e="Int64",truncate:t=!1}={}){if(n==null||typeof n=="symbol")return null;n=ce(n);let r=null;if(typeof n=="bigint")r=n;else if(typeof n=="string"){let s=$r(n,!1);if(s===null||!Pr.test(s))return null;if(Br.test(s)){let a=Number(s);if(!Number.isFinite(a)||!t&&!Number.isInteger(a))return null;r=BigInt(Math.trunc(a))}else{let a=s.indexOf(".");if(a!==-1){if(!t&&/[^0]/.test(s.slice(a+1)))return null;s=s.slice(0,a)}try{r=BigInt(s)}catch{return null}}}else{let s=M(n);if(s===null||!t&&!Number.isInteger(s))return null;r=BigInt(Math.trunc(s))}let o=typeof e=="string"?Ws[e]:e;return pe(r,{min:o.min,max:o.max})}function Gs(n,e){let t=n-e;if(t<0||e<0)return null;if(t>15)return Number.MAX_SAFE_INTEGER;let r=Math.min(e,16),o=Math.pow(10,t)-Math.pow(10,-r);return o>0?o:null}function fn(n,e){let t=n.toString();if(t.includes("e")){let r=Math.pow(10,e);return Math.round(n*r)/r}return+(Math.round(+(t+"e"+e))+"e"+-e)}function xt(n,{precision:e,scale:t}={}){let r=M(n);if(r===null)return null;let o=r;if(t!==void 0&&(o=fn(o,t)),e!==void 0){let a=Gs(e,t??0);a!==null&&(o=pe(o,{min:-a,max:a}))}return o}function pe(n,e){if(!e)return n;let{min:t=null,max:r=null,safe:o=!0}=e;if(t!==null&&r!==null&&t>r)return t;let s=n;if(o&&typeof s=="number"){if(Number.isNaN(s))return t!==null?t:r!==null?r:n;if(s===1/0)return r!==null?r:n;if(s===-1/0)return t!==null?t:n}return t!==null&&s<t?t:r!==null&&s>r?r:s}function zr(n){let e=n|0;return function(){let t=e=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}var Pr,Ks,zs,Br,Vr,Lr,_t,Kr,Ws,Ze=k(()=>{"use strict";ye();Pr=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Ks=/0[xobXOB]/,zs=/[\s_]/g,Br=/[eE]/;Vr=/^[+-]/,Lr=/\./g,_t=/,/g;Kr={Int8:{min:-128,max:127},Int16:{min:-32768,max:32767},Int32:{min:-2147483648,max:2147483647},UInt8:{min:0,max:255},UInt16:{min:0,max:65535},UInt32:{min:0,max:4294967295}};Ws={Int64:{min:-9223372036854775808n,max:9223372036854775807n},UInt64:{min:0n,max:18446744073709551615n}}});function B(n){if(!ArrayBuffer.isView(n))return!1;if(Wr)return Wr.call(n)!==void 0;let e=Object.prototype.toString.call(n);return e!=="[object DataView]"&&e.endsWith("Array]")}function E(n){return Array.isArray(n)||B(n)}function Qe(n){return n==null?[]:Array.isArray(n)?[...n]:B(n)?Array.from(n):[n]}function we(n){let e=Qe(n),t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=String(e[o]);return r}function wt(n,e,t){let r=n.length,o=e<-r||e>=r;if(o&&!t)throw new ie(`Index ${e} is out of bounds for array of length ${r}`);return o?null:n.at(e)??null}function Q(n,e,{mode:t="every",allowNulls:r=!1,allowEmpty:o=!0}={}){if(!E(n))return!1;let s=n.length;if(s===0)return o?t==="every":!1;let a=n,i;if(typeof e=="function")i=vr(e)?f=>f instanceof e:e;else switch(e){case"null":i=l=>l===null;break;case"undefined":i=l=>l===void 0;break;case"nullish":i=l=>l==null;break;case"any":i=()=>!0;break;case"date":i=U;break;case"object":i=K;break;case"plainObject":i=Ee;break;case"number":i=F;break;default:i=l=>typeof l===e;break}if(r){let l=i;i=f=>f==null||l(f)}if(t==="every"){for(let l=0;l<s;l++)if(!i(a[l]))return!1;return!0}else{for(let l=0;l<s;l++)if(i(a[l]))return!0;return!1}}function et(n,{descending:e=!1,nullsLast:t=!0}={}){if(!E(n))return[];let r=n,o=r.length;if(o===0)return[];if(B(n)){let c=r.slice().sort();return e&&c.reverse(),Array.from(c)}let s=[],a=[],i=!0,l=!0,f=!0;for(let c=0;c<o;c++){let m=r[c];if(m==null)a.push(m);else if(s.push(m),f){let p=typeof m;p!=="number"&&(i=!1),p!=="string"&&(l=!1),!i&&!l&&(f=!1)}}return s.length>1&&(i?s.sort(e?(c,m)=>m-c:(c,m)=>c-m):l?s.sort(e?(c,m)=>m.localeCompare(c):(c,m)=>c.localeCompare(m)):s.sort((c,m)=>{let p=typeof c,h=typeof m;if(p!==h){let y=p<h?-1:1;return e?-y:y}return c<m?e?1:-1:c>m?e?-1:1:0})),a.length===0?s:t?s.concat(a):a.concat(s)}function P(n){if(!E(n))return Gr;let e=n.length;if(e===0)return Gr;let t=null,r=null,o=null,s=null,a=0,i=0,l=0,f=0,u=0,c=0;for(let p=0;p<e;p++){let h=n[p];if(h==null||typeof h=="number"&&!F(h,{allowNonFiniteNumbers:!0,allowNaN:!1})){i++;continue}(t==null||h<t)&&(t=h,o=p),(r==null||h>r)&&(r=h,s=p);let y=M(h);if(y!==null){let d=l+y;Math.abs(l)>=Math.abs(y)?f+=l-d+y:f+=y-d+l,l=d,a++;let g=y-u;u+=g/a;let _=y-u;c+=g*_}}let m=a>1?c/(a-1):0;return{sum:a>0?l+f:null,count:a,min:t,max:r,minIdx:o,maxIdx:s,mean:a>0?(l+f)/a:null,variance:m,std:Math.sqrt(m),nullCount:i,len:e,hasNulls:i>0,isNumeric:a>0&&a===e-i}}function Se(n,{strict:e=!1,keySelector:t}={}){let r=Array.from(n),o=new Map;if(e){let a=t??G,i=new Map,l=r.length;for(let u=0;u<l;u++){let c=r[u],m=a(c),p=i.get(m);p===void 0?i.set(m,{val:c,count:1}):p.count++}let f=[];for(let u of i.values())f.push(u.val);for(let u=0;u<l;u++){let c=r[u],m=a(c),p=i.get(m);o.set(c,p.count)}return{values:f,count:f.length,frequencies:o}}let s=r.length;for(let a=0;a<s;a++){let i=r[a];o.set(i,(o.get(i)??0)+1)}return{values:Array.from(o.keys()),count:o.size,frequencies:o}}function Yr(n,{step:e=1,offsetStart:t=0,offsetEnd:r,maxItemsGathered:o,null_on_oob:s=!0}={}){if(n==null)return null;if(o!==void 0&&o<=0)return[];if(e===0)throw new v("Step size step cannot be zero");let a=n.length;if(a===0?t!==0:t>=a||t<-a){if(!s)throw new ie(`Start offset ${t} is out of bounds for array of length ${a}`);return null}let l=t<0?a+t:t,f=r!==void 0?r<0?a+r:r:e>0?a:-1,u=[];if(e>0)for(let c=l;c<f&&c<a&&!(c>=0&&(u.push(n[c]),o!==void 0&&u.length>=o));c+=e);else for(let c=l;c>f&&c>=0&&!(c<a&&(u.push(n[c]),o!==void 0&&u.length>=o));c+=e);return u}function Hr(n,e=",",{ignoreNulls:t=!1,nullValue:r="",prefix:o="",suffix:s="",limit:a,truncationMarker:i="...",valueFormatter:l}={}){let f=n.length,u=[],c=a!==void 0?Math.max(0,a):f,m=!1;for(let p=0;p<f;p++){if(u.length>=c){m=!0;break}let h=n[p];h!=null?u.push(l?l(h,p):String(h)):t||u.push(r)}return o+u.join(e)+(m?i:"")+s}function ke(n,e,t={}){let r=n.length,{mode:o="cumulative",step:s=1,coerce:a=y=>y,condition:i,reverse:l=!1,startIndex:f=l?r-1:0,endIndex:u=l?-1:r}=t,c=l?-1:1,m=f,p=u,h=(y,d)=>{(!i||i(n[y],y,n))&&(n[y]=a(d))};if(o==="constant"){let y=a(e);for(let d=m;l?d>p:d<p;d+=c)h(d,y)}else if(o==="independent")if(typeof s=="function"){let y=0;for(let d=m;l?d>p:d<p;d+=c)h(d,s({index:y,initialValue:e,originalValue:n[d],absoluteIndex:d,targetArray:n})),y++}else for(let y=m;l?y>p:y<p;y+=c)h(y,e+y*s);else{let y=e,d=!0,g=0;for(let _=m;l?_>p:_<p;_+=c)d?(h(_,y),d=!1):(typeof s=="function"?y=s({prev:y,index:g,originalValue:n[_],absoluteIndex:_,targetArray:n}):y=y+s,h(_,y)),g++}}function Xr(n){let e=n.length,t=0,r=new Float64Array(e);for(let s=0;s<e;s++){let a=n[s],i=M(a,{allowNonFiniteNumbers:!0});i!==null&&F(i,{allowNonFiniteNumbers:!0,allowNaN:!1})&&(r[t++]=i)}if(t===0)return null;let o=r.subarray(0,t);return o.sort(),o}function $e(n){let e=Xr(n);if(!e)return null;let t=e.length,r=Math.floor(t/2);return t%2!==0?e[r]:(e[r-1]+e[r])/2}function St(n,e){if(e<0||e>1)return null;let t=Xr(n);if(!t)return null;let r=t.length,o=e*(r-1),s=Math.floor(o),a=Math.ceil(o);return s===a?t[s]:t[s]+(o-s)*(t[a]-t[s])}function At(n){if(!E(n)||n.length===0)return null;let e=new Map,t=n.length,r=0,o=[];for(let s=0;s<t;s++){let a=n[s];if(a==null||typeof a=="number"&&!F(a,{allowNonFiniteNumbers:!0,allowNaN:!1}))continue;let i=(e.get(a)??0)+1;e.set(a,i),i>r?(r=i,o=[a]):i===r&&o.push(a)}return o.length===0?null:et(o)}function Zr(n,e){let t=n.length;if(t===0)return[];let r=Math.trunc(e);if(isNaN(r)||r===0)return Array.isArray(n)?n.slice():Array.from(n);let o=Math.abs(r);if(o>=t)return new Array(t).fill(null);let s=new Array(t);if(r>0){s.fill(null,0,r);for(let a=r;a<t;a++){let i=n[a-r];s[a]=i??null}}else{let a=t-o;for(let i=0;i<a;i++){let l=n[i+o];s[i]=l??null}s.fill(null,a,t)}return s}function mn(n){let e=n.length,t=0,r=0,o=0,s=0,a=0,i=0;for(let m=0;m<e;m++){let p=n[m];if(!p)continue;let h=M(p[0]),y=M(p[1]);if(h===null||y===null)continue;t++;let d=h-r;r+=d/t;let g=h-r,_=y-o;o+=_/t;let T=y-o;i+=d*T,s+=d*g,a+=_*T}if(t<2)return{covariance:null,correlation:null};let l=i/(t-1);if(s===0||a===0)return{covariance:l,correlation:null};let f=Math.sqrt(s*a);if(f===0||Number.isNaN(f))return{covariance:l,correlation:null};let u=i/f,c=Math.max(-1,Math.min(1,u));return{covariance:l,correlation:c}}function Jr(n){let e=n.length,t=new Int32Array(e);for(let s=0;s<e;s++)t[s]=s;t.sort((s,a)=>n[s]-n[a]);let r=new Float64Array(e),o=0;for(;o<e;){let s=o+1;for(;s<e&&n[t[s]]===n[t[o]];)s++;let a=(o+1+s)/2;for(let i=o;i<s;i++)r[t[i]]=a;o=s}return r}function Js(n,e,t){if(t<2)return null;let r=0,o=0,s=0,a=0,i=0;for(let u=0;u<t;u++){let c=n[u],m=e[u],p=c-r;r+=p/(u+1);let h=c-r,y=m-o;o+=y/(u+1);let d=m-o;i+=p*d,s+=p*h,a+=y*d}if(s===0||a===0)return null;let l=Math.sqrt(s*a);if(l===0||Number.isNaN(l))return null;let f=i/l;return Math.max(-1,Math.min(1,f))}function Qr(n){let e=n.length,t=new Float64Array(e),r=new Float64Array(e),o=0;for(let i=0;i<e;i++){let l=n[i];if(l){let f=M(l[0]),u=M(l[1]);f!==null&&u!==null&&(t[o]=f,r[o]=u,o++)}}if(o<2)return null;let s=Jr(t.subarray(0,o)),a=Jr(r.subarray(0,o));return Js(s,a,o)}function eo(n){let e=n.length,t=0,r=0;for(let o=0;o<e;o++){let s=n[o];if(!s)continue;let a=M(s[0]),i=M(s[1]);a===null||i===null||(t+=a*i,r++)}return r>0?t:null}function to(n){let e=n.length,t=0,r=0,o=0;for(let s=0;s<e;s++){let a=n[s];if(!a)continue;let i=M(a[0]),l=M(a[1]);i===null||l===null||(t+=i*l,r+=l,o++)}return o===0||Math.abs(r)<1e-12?null:t/r}function no(n,e){let t=Math.max(0,Math.floor(n||0)),r=Math.max(0,Math.floor(e||0)),o=t*r;if(!bt(o,{range:"UInt32"}))throw new v(`Cartesian product size (${o} rows) exceeds maximum JavaScript array capacity.`);let s=new Array(o),a=new Array(o),i=0;for(let l=0;l<t;l++)for(let f=0;f<r;f++)s[i]=l,a[i]=f,i++;return{leftIndices:s,rightIndices:a}}function Dt(n,e,t={}){let r=t.side==="right",o=t.getValue,s=0,a=n.length;for(;s<a;){let i=s+a>>>1,l=o?o(i,n[i]):n[i];(r?l<=e:l<e)?s=i+1:a=i}return s}var Wr,Gr,tt=k(()=>{"use strict";ye();Ze();Tt();Y();Wr=(()=>{try{let n=new Uint8Array(0),e=Object.getPrototypeOf(n),t=Object.getPrototypeOf(e),r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.get;return r&&r.call(n)==="Uint8Array"?r:void 0}catch{return}})();Gr={sum:null,count:0,min:null,max:null,minIdx:null,maxIdx:null,mean:null,variance:0,std:0,nullCount:0,len:0,hasNulls:!1,isNumeric:!1}});function ro(n){let e=ce(n);return typeof e=="string"?e.trim().length===0:!1}function Ct(n){let e=ce(n);if(e==null)return"";let t=String(e);return typeof RegExp.escape=="function"?RegExp.escape(t):t.replace(Ys,"\\$&")}function qe(n,e=null,t={}){if(n==null)return t.returnStringOnNull?"":null;let{mode:r="both",returnStringOnNull:o=!1,maxScanStart:s=1,maxScanEnd:a=1,maxMatchesStart:i=1,maxMatchesEnd:l=1,trimFirst:f=!1,stringOptions:u}=t,{literal:c=!1,caseInsensitive:m=!1}=u??{},p=(S,b="both")=>b==="start"?S.trimStart():b==="end"?S.trimEnd():S.trim(),h=n;if(f&&e!=null&&(h=p(n,r)),e==null){let S=p(h,r);return o||S!==""?S:null}let y=xe(e)?S=>{try{e.lastIndex=0}catch{}return e.test(S)}:(()=>{let S=new Set(m?e.toLowerCase():e);return b=>S.has(m?b.toLowerCase():b)})(),d=h.length;if(s===1&&i===1&&a===1&&l===1&&!c){let S=0,b=d;if(r==="both"||r==="start")for(;S<d&&y(h[S]);)S++;if(r==="both"||r==="end")for(;b>S&&y(h[b-1]);)b--;let D=S===0&&b===d?h:h.substring(S,b);return o||D!==""?D:null}let _=new Uint8Array(d),T=(S,b,D)=>{if(d===0||D===0)return;let C=S?0:d-1,O=S?d:-1,N=S?1:-1,J=!1,Z=0,W=0;for(let oe=C;oe!==O;oe+=N)if(y(h[oe])){if(!J){if(b!==null&&b>=0&&W>=b||D!==null&&D>=0&&Z>=D)break;J=!0,Z++}_[oe]=1}else if(J=!1,W++,b!==null&&b>=0&&W>=b)break},A=(S,b,D,C,O)=>{if(d===0||O===0||b===0)return;let N=D?0:d-1,J=0,Z=0,W=m?h.toLowerCase():h;for(;N>=0&&N<d&&!(O!==null&&O>=0&&J>=O);){let oe=D?N:N-b+1;if(!D&&oe<0)break;let le=D?W.indexOf(S,oe):W.lastIndexOf(S,oe);if(le===-1)break;let yt=D?le-N:N-(le+b-1);if(Z+=yt,C!==null&&C>=0&&Z>=C)break;for(let Le=0;Le<b;Le++)_[le+Le]=1;J++,N=D?le+b:le-1}};if(r==="both"||r==="start")if(c&&typeof e=="string"){let S=m?e.toLowerCase():e;A(S,e.length,!0,s,i)}else T(!0,s,i);if(r==="both"||r==="end")if(c&&typeof e=="string"){let S=m?e.toLowerCase():e;A(S,e.length,!1,a,l)}else T(!1,a,l);let x="";for(let S=0;S<d;S++)_[S]===0&&(x+=h[S]);return o||x!==""?x:null}function G(n,{depth:e=0,maxDepth:t=50}={}){if(e>t)return"v:circular";if(n===null)return"v:null";if(n===void 0)return"v:undefined";if(U(n))return`d:${n.getTime()}`;if(B(n)){let o=n.toString();return`u:${n.constructor.name}:${o.length}:${o}`}if(Array.isArray(n)){let o=n.length,s=new Array(o),a={depth:e+1,maxDepth:t};for(let i=0;i<o;i++)s[i]=G(n[i],a);return`a:[${s.join("")}]`}if(dt(n)){let o=Array.from(n),s=o.length,a=new Array(s),i={depth:e+1,maxDepth:t};for(let l=0;l<s;l++)a[l]=G(o[l],i);return a.sort(),`set:[${a.join("")}]`}if(gt(n)){let o=Array.from(n.keys()),s=o.length,a=new Array(s),i={depth:e+1,maxDepth:t};for(let l=0;l<s;l++){let f=o[l];a[l]=`${G(f,i)}${"\0"}${G(n.get(f),i)}`}return a.sort(),`map:{${a.join("")}}`}if(typeof n=="object"&&typeof n.toJSON=="function"){let o=n.toJSON();if(o!==n)return`j:${G(o,{depth:e+1,maxDepth:t})}`}if(xe(n)){let o=n.toString();return`r:${o.length}:${o}`}if(Ee(n)){let o=Object.keys(n).sort(),s=o.length,a=new Array(s),i={depth:e+1,maxDepth:t};for(let l=0;l<s;l++){let f=o[l];a[l]=`${G(f,i)}${"\0"}${G(n[f],i)}`}return`o:{${a.join("")}}`}if(typeof n=="function"){let o=n.toString();return`f:${o.length}:${o}`}if(typeof n=="string")return`s:${n.length}:${n}`;if(typeof n=="symbol"){let o=n.toString();return`y:${o.length}:${o}`}if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return`${typeof n}:${n}`;let r=String(n);return`${typeof n}:${r.length}:${r}`}function Qs(n){if(n==null)return[];let e=String(n);if(!e)return[];let r=e.normalize("NFC").replace(Hs,"$1$2").match(Xs)||[],o=[];for(let s=0;s<r.length;s++){let a=r[s];Zs.has(a)||o.push(a)}return o}function nt(n,e){let t=Qs(n),r=t.length;if(r===0)return"";let{format:o}=e;if(o==="camel"||o==="pascal"){let s="";for(let a=0;a<r;a++){let i=t[a];s+=a===0&&o==="camel"?i.toLowerCase():i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}return s}if(o==="kebab"||o==="snake"){let s=o==="kebab"?"-":"_",a=new Array(r);for(let i=0;i<r;i++)a[i]=t[i].toLowerCase();return a.join(s)}return String(n)}var Ys,Hs,Xs,Zs,Tt=k(()=>{"use strict";ye();tt();Ys=/[-\/\\^$*+?.()|\[\]{}]/g;Hs=/(\p{L})['’](\p{L})/gu,Xs=new RegExp(["\\p{Lu}+s(?!\\p{Ll})","\\p{Lu}+(?=\\p{Lu}\\p{Ll})","\\p{Lu}+\\p{Ll}*","\\p{Ll}+","\\p{N}+","\\p{L}+"].join("|"),"gu"),Zs=new Set(["__proto__","proto","constructor","prototype"])});function ni(n){let e=oo.get(n);return e||(e=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),oo.set(n,e)),e}function ri(n,e){let t=`${n}_${e}`,r=so.get(t);return r||(r=new Intl.DateTimeFormat(n,{timeZoneName:"short",timeZone:e}),so.set(t,r)),r}function oi(n){let e=io.get(n);if(e===void 0){try{Intl.DateTimeFormat(void 0,{timeZone:n}),e=!0}catch{e=!1}io.set(n,e)}return e}function he(n){let e=!n||n==="local"?Intl.DateTimeFormat().resolvedOptions().timeZone:n;return oi(e)?e:"UTC"}function ee(n,e=0,t=1,r=0,o=0,s=0,a=0){let i=new Date(0);return i.setUTCFullYear(n,e,t),i.setUTCHours(r,o,s,a),i}function si(n,e,t){let r=[0,3,2,5,0,3,5,1,4,6,2,4],o=n;return e<3&&(o-=1),(o+Math.floor(o/4)-Math.floor(o/100)+Math.floor(o/400)+r[e-1]+t)%7}function re(n,e){let t=he(e);if(t.toUpperCase()==="UTC")return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),dayOfWeek:n.getUTCDay(),timeZone:"UTC"};let o=ni(t).formatToParts(n),s="0",a="0",i="0",l="0",f="0",u="0",c="0";for(let _=0,T=o.length;_<T;_++){let A=o[_];switch(A.type){case"year":s=A.value;break;case"month":a=A.value;break;case"day":i=A.value;break;case"hour":l=A.value;break;case"minute":f=A.value;break;case"second":u=A.value;break;case"fractionalSecond":c=A.value;break}}let m=parseInt(s,10),p=parseInt(a,10),h=parseInt(i,10),y=parseInt(l,10);y===24&&(y=0);let d=Math.round(parseFloat("0."+c)*1e3)||0,g=si(m,p,h);return{year:m,month:p,day:h,hour:y,minute:parseInt(f,10),second:parseInt(u,10),ms:d,dayOfWeek:g,timeZone:t}}function Ke(n,e){let t=he(e);if(t.toUpperCase()==="UTC")return 0;let r=re(n,"UTC"),o=re(n,t),s=ee(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.ms).getTime(),a=ee(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.ms).getTime();return Math.round((a-s)/6e4)}function ao(n,e){let t=n>=0?"+":"-",r=Math.abs(n),o=String(Math.floor(r/60)).padStart(2,"0"),s=String(r%60).padStart(2,"0");return e==="iso"?`${t}${o}:${s}`:`${t}${o}${s}`}function H(n,e){let t=ce(n);if(t==null)return null;let r=null;if(U(t))r=t;else if(typeof t=="number"||typeof t=="bigint")r=new Date(ii(t));else if(typeof t=="string"){if(ro(t))return null;r=new Date(t)}if(!r||!U(r))return null;if(e?.dateOnly){let o=typeof t=="string",s=o&&ti.test(t),a=o&&!s&&!uo.test(t)?"local":"UTC",i=re(r,a);return ee(i.year,i.month-1,i.day)}return r}function It(n){let e=ce(n);if(e==null)return null;let t=null;if(typeof e=="string"){let o=e.trim();if(ei.test(o)){let s=uo.test(o);t=H(`1970-01-01T${o}${s?"":"Z"}`)}}let r=t||H(e);return r?Ne(r,{format:"%H:%M:%S.%ms"}):null}function co(n,e="ms"){let t=n.getTime();switch(e){case"s":return Math.floor(t/1e3);case"ms":return t;case"us":return BigInt(t)*ln;case"ns":return BigInt(t)*un}}function ii(n){if(typeof n=="bigint"){let t=n<0n?-n:n;return t<=30000000000n?Number(n)*1e3:t<=30000000000000n?Number(n):t<=30000000000000000n?Number(n/ln):Number(n/un)}let e=Math.abs(n);return e<=3e10?n*1e3:e<=3e13?n:e<=3e16?Math.floor(n/1e3):Math.floor(n/1e6)}function fo(n){if(!U(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/100)+1}function dn(n,e={field:"week"}){if(!U(n))return null;let t=ee(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r=t.getUTCDay()||7;if(t.setUTCDate(t.getUTCDate()+4-r),e.field==="year")return t.getUTCFullYear();let o=ee(t.getUTCFullYear(),0,1),s=Math.round((t.getTime()-o.getTime())/864e5);return Math.floor(s/7)+1}function mo(n){if(!U(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/1e3)+1}function Et(n,e,t=1){return U(n)?ee(n.getUTCFullYear(),n.getUTCMonth()+e,t):null}function gn(n){if(!U(n))return null;let e=ee(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()).getTime(),t=ee(n.getUTCFullYear(),0,1).getTime();return Math.floor((e-t)/864e5)+1}function po(n){return U(n)?Math.floor(n.getUTCMonth()/3)+1:null}function _n(n){let e;if(U(n))e=n.getUTCFullYear();else if(F(n))e=n;else return!1;return e%4===0&&e%100!==0||e%400===0}function ho(n){return n.replace(/%[FTRD]/g,e=>li[e]||e)}function ui(n){let e=n.replace(":",""),t=e[0]==="+"?1:-1,r=parseInt(e.slice(1,3),10)||0,o=parseInt(e.slice(3,5),10)||0;return t*(r*60+o)}function Ne(n,{format:e,locale:t,timeZone:r="UTC"}){if(!U(n)||typeof e!="string")return"";let o=t&&t.trim()||Intl.DateTimeFormat().resolvedOptions().locale||"en-US",s=ho(e),a=null,i=()=>a??=re(n,r);return s.replace(Ot,(l,f)=>{if(f==="%")return"%";let u=bn[f];return u?u.format(n,o,r,i()):l})}function yo(n,{format:e,strict:t=!0,defaultTimeZone:r="UTC"}){if(typeof n!="string"||typeof e!="string")return null;let o=ho(e),s=[],a="",i=0;Ot.lastIndex=0;let l;for(;(l=Ot.exec(o))!==null;){let y=o.slice(i,l.index);a+=Ct(y);let d=l[1];if(d==="%")a+="\\%";else{let g=bn[d];g&&g.parseRegex?(s.push(g),a+=`(${g.parseRegex})`):a+=Ct(l[0])}i=Ot.lastIndex}a+=Ct(o.slice(i));let f=new RegExp("^\\s*"+a+"\\s*$"),u=n.match(f);if(!u)return t?null:H(n);let c={year:1970,month:1,day:1,hour:0,minute:0,second:0,ms:0,offset:null},m=null,p=!1;for(let y=0;y<s.length;y++){let d=u[y+1],g=s[y],_=g.parseNormalize?g.parseNormalize(d):parseInt(d,10);g.key==="j"&&(p=!0),g.parseField==="ampm"?m=_:g.parseField==="offset"?c.offset=_:g.parseField&&(c[g.parseField]=_)}if(m&&(m==="PM"&&c.hour<12&&(c.hour+=12),m==="AM"&&c.hour===12&&(c.hour=0)),p){let y=_n(c.year)?366:365;if(c.day<1||c.day>y)return null;let d=ee(c.year,0,1);d.setUTCDate(c.day),c.month=d.getUTCMonth()+1,c.day=d.getUTCDate()}let h=ee(c.year,c.month-1,c.day,c.hour,c.minute,c.second,c.ms);if(!U(h)||h.getUTCFullYear()!==c.year||h.getUTCMonth()+1!==c.month||h.getUTCDate()!==c.day||h.getUTCHours()!==c.hour||h.getUTCMinutes()!==c.minute||h.getUTCSeconds()!==c.second||h.getUTCMilliseconds()!==c.ms)return null;if(c.offset)h=new Date(h.getTime()-ui(c.offset)*6e4);else if(r.toUpperCase()!=="UTC"){let y=he(r),d=Ke(h,y);h=new Date(h.getTime()-d*6e4);let g=Ke(h,y);g!==d&&(h=new Date(h.getTime()-(g-d)*6e4))}return U(h)?h:null}function go(n,e,{excludeWeekdays:t=[],holidays:r=[],roll:o}={}){if(!bt(e))throw new ie(`The offset parameter 'n' must be a whole integer. Received: ${e}`);if(t.length===0&&(!r||Array.isArray(r)&&r.length===0||r instanceof Set&&r.size===0)&&!o)return e;if(7-t.length<=0)throw new ie("All weekdays are excluded; cannot offset.");let a=new Set;if(r instanceof Set)for(let c of r){let m=new Date(c);t.includes(m.getUTCDay())||a.add(c)}else if(Array.isArray(r))for(let c=0;c<r.length;c++){let m=H(r[c]);if(!m||t.includes(m.getUTCDay()))continue;let p=ee(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate());a.add(p.getTime())}let i=c=>t.includes(c.getUTCDay())?!0:a.has(c.getTime()),l=ee(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),f=new Date(l.getTime());if(o&&i(f)){if(o==="raise")throw new ie("Start date falls on an excluded day or holiday.");let c=o==="forward"?1:-1;for(;i(f);)f.setUTCDate(f.getUTCDate()+c)}if(e!==0){let c=e>0?1:-1,m=0,p=Math.abs(e);for(;m<p;)f.setUTCDate(f.getUTCDate()+c),i(f)||m++}let u=f.getTime()-l.getTime();return Math.round(u/864e5)}function xn(n,e,t){let r=he(e),o=t?.type??"total",s;if(o==="total")s=Ke(n,r);else{let l=re(n,r).year,f=Ke(ee(l,0,1),r),u=Ke(ee(l,6,1),r),c=Math.min(f,u);o==="daylightSavingTime"?s=Ke(n,r)-c:s=c}switch(t?.format??"milliseconds"){case"minutes":return s;case"hours":return s/60;case"iso":return ao(s,"iso");case"basic":return ao(s,"basic");default:return s*6e4}}function _o(n,e={}){if(!U(n))return null;let t=e.excludeWeekdays??[0,6],r=n.getUTCDay();if(t.includes(r))return!1;let o=e.holidays;if(o){if(o instanceof Set){let s=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(o.has(s))return!1}else if(Array.isArray(o)&&o.length>0){let s=new Set;for(let i=0;i<o.length;i++){let l=H(o[i]);l&&s.add(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))}let a=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(s.has(a))return!1}}return!0}function bo(n,e={}){let t=re(n,e?.timeZone??void 0),r=e?.year??t.year,o=e?.month!=null?e.month-1:t.month-1,s=e?.day??t.day,a=e?.hour??t.hour,i=e?.minute??t.minute,l=e?.second??t.second,f=e?.ms??t.ms;return ee(r,o,s,a,i,l,f)}var ei,uo,ti,oo,so,io,bn,ai,Ot,li,wn=k(()=>{"use strict";Tt();Y();ye();Ze();Fr();ei=/^\d{2}:\d{2}/,uo=/(?:Z|[+-]\d{2}(?::?\d{2})?)$/i,ti=/^\d{4}-\d{2}-\d{2}$/,oo=new Map;so=new Map;io=new Map;bn={Y:{key:"Y",format:(n,e,t,r)=>{let o=r.year;return o>=0?String(o).padStart(4,"0"):"-"+String(Math.abs(o)).padStart(4,"0")},parseRegex:"[+-]?\\d{4,}",parseField:"year"},y:{key:"y",format:(n,e,t,r)=>String(Math.abs(r.year)%100).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"year",parseNormalize:n=>{let e=parseInt(n,10);return e+(e>=69?1900:2e3)}},m:{key:"m",format:(n,e,t,r)=>String(r.month).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"month"},d:{key:"d",format:(n,e,t,r)=>String(r.day).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"day"},e:{key:"e",format:(n,e,t,r)=>String(r.day).padStart(2," "),parseRegex:"\\s?\\d{1,2}",parseField:"day"},H:{key:"H",format:(n,e,t,r)=>String(r.hour).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},I:{key:"I",format:(n,e,t,r)=>String(r.hour%12||12).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},p:{key:"p",format:(n,e,t,r)=>r.hour>=12?"PM":"AM",parseRegex:"AM|PM|am|pm",parseField:"ampm",parseNormalize:n=>n.toUpperCase()},M:{key:"M",format:(n,e,t,r)=>String(r.minute).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"minute"},S:{key:"S",format:(n,e,t,r)=>String(r.second).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"second"},A:{key:"A",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"long",timeZone:he(t)})},a:{key:"a",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"short",timeZone:he(t)})},B:{key:"B",format:(n,e,t)=>n.toLocaleDateString(e,{month:"long",timeZone:he(t)})},b:{key:"b",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:he(t)})},h:{key:"h",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:he(t)})},j:{key:"j",format:(n,e,t,r)=>String(gn(ee(r.year,r.month-1,r.day))??1).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"day",parseNormalize:n=>parseInt(n,10)},u:{key:"u",format:(n,e,t,r)=>String(r.dayOfWeek||7)},w:{key:"w",format:(n,e,t,r)=>String(r.dayOfWeek)},Z:{key:"Z",format:(n,e,t)=>{let r=he(t);if(r.toUpperCase()==="UTC")return"UTC";let o=ri(e,r).formatToParts(n);for(let s=0,a=o.length;s<a;s++)if(o[s].type==="timeZoneName")return o[s].value;return"UTC"}},z:{key:"z",format:(n,e,t)=>xn(n,t,{format:"basic"}),parseRegex:"[+-]\\d{2}(?::?\\d{2})?",parseField:"offset",parseNormalize:n=>n.replace(":","")},ms:{key:"ms",format:(n,e,t,r)=>String(r.ms).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"ms",parseNormalize:n=>parseInt(n,10)},f:{key:"f",format:(n,e,t,r)=>String(r.ms).padStart(3,"0").padEnd(6,"0"),parseRegex:"\\d{1,9}",parseField:"ms",parseNormalize:n=>parseInt(n.padEnd(6,"0").slice(0,3),10)}},ai=Object.keys(bn).concat("%").sort((n,e)=>e.length-n.length),Ot=new RegExp("%("+ai.join("|")+")","g"),li={"%F":"%Y-%m-%d","%T":"%H:%M:%S","%R":"%H:%M","%D":"%m/%d/%y"}});function xo(n,{format:e="json",allowPrimitives:t=!1,trimBeforeParse:r=!1,reviver:o,ndjson:{skipInvalidLines:s=!1,maxLines:a,skipLines:i}={},guard:l,onError:f,fallback:u=ot}={}){if(typeof n!="string")return u!==ot?u:n;let c=r?n.trim():n;if(c==="")return u!==ot?u:n;let m;try{if(e==="ndjson"){let p=[],h=0,y=0,d=0;Sn.lastIndex=0;let g;for(;;){g=Sn.exec(c);let _=g?c.substring(d,g.index):c.substring(d);g&&(d=Sn.lastIndex);let T=_.trim();if(T!==""&&(h++,i===void 0||h>i))if(!t&&!ci(T)){if(!s)throw new v("NDJSON line is not wrapped and primitives are disallowed")}else try{if(p.push(JSON.parse(T,o)),y++,a!==void 0&&y>=a)break}catch(A){if(!s)throw A}if(!g)break}if(p.length===0)throw new Ae("No valid NDJSON lines processed");m=p}else{if(!t&&!fi(c))throw new v("JSON string is not wrapped and primitives are disallowed");m=JSON.parse(c,o)}}catch(p){return f?.(p),u!==ot?u:n}return l&&!l(m)?(f?.(new Error("Parsed value failed guard validation")),u!==ot?u:n):m}function st(n={}){let e=n.bigintStrategy??"string",t=n.handleCircular?new WeakSet:null,o=Array.isArray(n.replacer)?n.replacer.map(String):null,s=a=>e==="number"&&a<=BigInt(Number.MAX_SAFE_INTEGER)&&a>=BigInt(Number.MIN_SAFE_INTEGER)?Number(a):a.toString();return function(i,l){let f=l;if(typeof n.replacer=="function")f=n.replacer.call(this,i,l);else if(o&&i!==""&&!Array.isArray(this)&&!o.includes(i))return;if(f===void 0)return;let u=f===l&&this!=null?this[i]:f;if(typeof n.onCustom=="function"){let c=n.onCustom.call(this,i,u);if(c!==u||c===void 0&&u!==void 0)return c}if(u!==null&&typeof u!="object"&&typeof u!="bigint")return f;if(t&&u!==null&&typeof u=="object"){if(i===""&&(t=new WeakSet),t.has(u))return n.onCircular?n.onCircular.call(this,i,u):"[Circular]";t.add(u)}return typeof u=="bigint"?n.voidBigIntReplacement?f:n.onBigInt?n.onBigInt(u):s(u):B(u)?n.voidTypedArrayReplacement?f:n.onTypedArray?n.onTypedArray(u):Array.from(u):dt(u)?n.voidSetReplacement?f:n.onSet?n.onSet(u):Array.from(u):gt(u)?n.voidMapReplacement?f:n.onMap?n.onMap(u):Array.from(u.entries()):xe(u)?n.voidRegExpReplacement?f:n.onRegExp?n.onRegExp(u):u.toString():U(u)?n.voidDateReplacement?f:n.onDate?n.onDate(u):n.formatDate?n.formatDate(u):u.toISOString():Ur(u)?n.onError?n.onError(u):{name:u.name,message:u.message,stack:u.stack}:Mr(u)?n.onURLSearchParams?n.onURLSearchParams(u):u.toString():f}}var Sn,ot,ci,fi,kt=k(()=>{"use strict";tt();ye();Y();Sn=/\r\n|\n|\r/g,ot=Symbol("no_fallback"),ci=n=>{let e=n.length;if(e<2)return!1;let t=n[0],r=n[e-1];return t==="{"&&r==="}"||t==="["&&r==="]"},fi=n=>{let e=0,t=n.length;for(;e<t&&/\s/.test(n[e]);)e++;let r=t-1;for(;r>=e&&/\s/.test(n[r]);)r--;if(e>=r)return!1;let o=n[e],s=n[r];return o==="{"&&s==="}"||o==="["&&s==="]"}});var ne,ze,Rt,ve,Me,it,Ue,at,Nt=k(()=>{"use strict";ne=class n{matches(e){if(e==null)return!1;if(e instanceof n)return!!(this.equals(e)||this.name.startsWith("Decimal")&&e.name.startsWith("Decimal")&&e.precision===void 0&&e.scale===void 0);if(typeof e=="function"){if(e.prototype instanceof n)return this instanceof e;try{let t=e();if(t instanceof n)return this.constructor===t.constructor}catch{}}return!1}get isNumeric(){return!1}get isInteger(){return!1}get isFloat(){return!1}get isSigned(){return!1}get isUnsigned(){return!1}get isTemporal(){return!1}get isNested(){return!1}get isBoolean(){return!1}get isString(){return!1}get isUtf8(){return!1}get isObject(){return!1}get isNull(){return!1}get isBinary(){return!1}},ze=class extends ne{get isNumeric(){return!0}},Rt=class extends ze{get isInteger(){return!0}},ve=class extends Rt{get isSigned(){return!0}},Me=class extends Rt{get isUnsigned(){return!0}},it=class extends ze{get isFloat(){return!0}},Ue=class extends ne{get isTemporal(){return!0}},at=class extends ne{get isNested(){return!0}}});var An,wo,Dn,So,Tn,Ao,Cn,Mt,On,Do,In,To,En,Co,kn,Oo,Rn,Io,Nn,Ut,vt,vn,Ft,Mn,ut,Un,Eo,Fn,ko,jn,Ro,Vn,No,ge,jt,Ln,vo,lt,Mo,Pn,Uo,Bn,Fo,ct=k(()=>{"use strict";Nt();q();An=class extends ve{name="Int8";coerce(e){return de(e,{range:"Int8"})}equals(e){return e.name==="Int8"}allocate(e){return new Int8Array(e)}},wo=new An,Dn=class extends ve{name="Int16";coerce(e){return de(e,{range:"Int16"})}equals(e){return e.name==="Int16"}allocate(e){return new Int16Array(e)}},So=new Dn,Tn=class extends ve{name="Int32";coerce(e){return de(e,{range:"Int32"})}equals(e){return e.name==="Int32"}allocate(e){return new Int32Array(e)}},Ao=new Tn,Cn=class extends ve{name="Int64";coerce(e){return Be(e,{truncate:!0})}equals(e){return e.name==="Int64"}allocate(e){return new BigInt64Array(e)}},Mt=new Cn,On=class extends Me{name="UInt8";coerce(e){return de(e,{range:"UInt8"})}equals(e){return e.name==="UInt8"}allocate(e){return new Uint8Array(e)}},Do=new On,In=class extends Me{name="UInt16";coerce(e){return de(e,{range:"UInt16"})}equals(e){return e.name==="UInt16"}allocate(e){return new Uint16Array(e)}},To=new In,En=class extends Me{name="UInt32";coerce(e){return de(e,{range:"UInt32"})}equals(e){return e.name==="UInt32"}allocate(e){return new Uint32Array(e)}},Co=new En,kn=class extends Me{name="UInt64";coerce(e){return Be(e,{range:"UInt64"})}equals(e){return e.name==="UInt64"}allocate(e){return new BigUint64Array(e)}},Oo=new kn,Rn=class extends it{name="Float32";coerce(e){return cn(e,{floatPrecision:"Float32"})}equals(e){return e.name==="Float32"}allocate(e){return new Float32Array(e)}},Io=new Rn,Nn=class extends it{name="Float64";coerce(e){return cn(e,{floatPrecision:"Float64"})}equals(e){return e.name==="Float64"}allocate(e){return new Float64Array(e)}},Ut=new Nn,vt=class n extends ze{constructor(t,r){super();this.precision=t;this.scale=r;this.name=t!==void 0&&r!==void 0?`Decimal(${t}, ${r})`:"Decimal"}precision;scale;name;coerce(t){return xt(t,{precision:this.precision,scale:this.scale})}equals(t){return t instanceof n&&this.precision===t.precision&&this.scale===t.scale}allocate(t){return new Array(t).fill(null)}},vn=class extends ne{name="Boolean";get isBoolean(){return!0}coerce(e){return e==null?null:!!e}equals(e){return e.name==="Boolean"}allocate(e){return new Array(e).fill(null)}},Ft=new vn,Mn=class extends ne{name="Utf8";get isString(){return!0}get isUtf8(){return!0}coerce(e){return e==null?null:String(e)}equals(e){return e.name==="Utf8"}allocate(e){return new Array(e).fill(null)}},ut=new Mn,Un=class extends ne{name="Binary";get isBinary(){return!0}coerce(e){return jo(e)}equals(e){return e.name==="Binary"}allocate(e){return new Array(e).fill(null)}},Eo=new Un,Fn=class extends ne{name="Null";get isNull(){return!0}coerce(e){return null}equals(e){return e.name==="Null"}allocate(e){return new Array(e).fill(null)}},ko=new Fn,jn=class extends ne{name="Object";get isObject(){return!0}coerce(e){return e===void 0?null:e}equals(e){return e.name==="Object"}allocate(e){return new Array(e).fill(null)}},Ro=new jn,Vn=class extends Ue{name="Date";coerce(e){return H(e,{dateOnly:!0})}equals(e){return e.name==="Date"}allocate(e){return new Array(e).fill(null)}},No=new Vn,ge=class n extends Ue{name="Datetime";timeUnit;timeZone;constructor(e="ms",t=null){super(),this.timeUnit=e,this.timeZone=t}coerce(e){return H(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit&&e.timeZone===this.timeZone}allocate(e){return new Array(e).fill(null)}},jt=new ge,Ln=class extends Ue{name="Time";coerce(e){return It(e)}equals(e){return e.name==="Time"}allocate(e){return new Array(e).fill(null)}},vo=new Ln,lt=class n extends Ue{name="Duration";timeUnit;constructor(e="ms"){super(),this.timeUnit=e}coerce(e){return M(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit}allocate(e){return new Array(e).fill(null)}},Mo=new lt,Pn=class n extends at{constructor(t){super();this.innerType=t}innerType;name="Array";coerce(t){if(t==null)return null;let r=E(t)?Array.from(t):[t],o=r.length,s=new Array(o);for(let a=0;a<o;a++)s[a]=this.innerType.coerce(r[a]);return s}equals(t){return t instanceof n&&this.innerType.equals(t.innerType)}allocate(t){return new Array(t).fill(null)}},Uo=n=>new Pn(n),Bn=class n extends at{constructor(t){super();this.fields=t}fields;name="Struct";coerce(t){if(!K(t))return null;let r={},o=Object.keys(this.fields),s=o.length;for(let a=0;a<s;a++){let i=o[a],l=this.fields[i];r[i]=l.coerce(t[i])}return r}equals(t){if(!(t instanceof n))return!1;let r=Object.keys(this.fields),o=Object.keys(t.fields);if(r.length!==o.length)return!1;for(let s=0;s<r.length;s++){let a=r[s];if(!this.fields[a].equals(t.fields[a]))return!1}return!0}allocate(t){return new Array(t).fill(null)}},Fo=n=>new Bn(n)});var j,De=k(()=>{"use strict";Nt();ct();ct();Nt();j={Int8:wo,Int16:So,Int32:Ao,Int64:Mt,UInt8:Do,UInt16:To,UInt32:Co,UInt64:Oo,Float32:Io,Float64:Ut,Decimal:(n,e)=>new vt(n,e),Boolean:Ft,Utf8:ut,Binary:Eo,Date:No,Datetime:jt,Time:vo,Duration:Mo,Object:Ro,Null:ko,Array:Uo,Struct:Fo}});function pi(n={}){let e=n.nullValue!==void 0?n.nullValue:"",t=qr(n.numericFormatOptions),r=n.replacerOptions||{},o=i=>n.datetimeFormat?Ne(i,{format:n.datetimeFormat}):n.dateFormat?Ne(i,{format:n.dateFormat}):n.timeFormat?Ne(i,{format:n.timeFormat}):i.toISOString(),s=st({formatDate:o,...r}),a=typeof r.onBigInt=="function";return i=>{if(i==null||typeof i=="symbol"||typeof i=="function")return{str:e,isNumeric:!1};if(typeof i=="bigint"&&!a&&!r.voidBigIntReplacement)return{str:t(i),isNumeric:!0};let l=s.call(null,"",i),f=ce(l);return f==null||typeof f=="symbol"||typeof f=="function"?{str:e,isNumeric:!1}:typeof f=="string"?{str:f,isNumeric:!1}:typeof f=="number"||typeof f=="bigint"?{str:t(f),isNumeric:!0}:typeof f=="boolean"?{str:f?"true":"false",isNumeric:!1}:typeof f=="object"?{str:JSON.stringify(f,st({formatDate:o,...r})),isNumeric:!1}:{str:String(f),isNumeric:!1}}}function Lt(n,e,t={}){let{separator:r=",",quoteChar:o='"',includeHeader:s=!0,lineTerminator:a=`
|
|
2
|
-
`,quoteStyle:
|
|
3
|
-
`)||
|
|
4
|
-
`&&m++):
|
|
5
|
-
`&&(h=!0),h?(f||a.length>0||i!==""||u)&&(a.push(i),s.push(a),a=[],i="",f=!1,u=!1):(f=!0,u=!1,i+=p)}}return(f||a.length>0||i!==""||u)&&(a.push(i),s.push(a)),s}function Lo(n,e={}){let t=new Set(e.nullValues??["","NA","null","NaN"]),r=n.length,o=!0,s=!0,a=!0,i=!0,l=!1;for(let u=0;u<r;u++){let c=n[u].trim();if(!t.has(c)){if(l=!0,o){let m=c.toLowerCase();m!=="true"&&m!=="false"&&m!=="1"&&m!=="0"&&(o=!1)}if(a&&Be(c,{truncate:!1})===null&&(a=!1),s&&M(c,{allowNonFiniteNumbers:!0})===null&&(s=!1),i&&H(c)===null&&(i=!1),!o&&!s&&!a&&!i)break}}let f=new Array(r);if(!l||!o&&!s&&!a&&!i){for(let u=0;u<r;u++){let c=n[u];f[u]=t.has(c.trim())?null:c}return{type:ut,values:f}}if(o){for(let u=0;u<r;u++){let c=n[u].trim();if(t.has(c))f[u]=null;else{let m=c.toLowerCase();f[u]=m==="true"||m==="1"}}return{type:Ft,values:f}}if(a){for(let u=0;u<r;u++){let c=n[u].trim();f[u]=t.has(c)?null:Be(c,{truncate:!1})}return{type:Mt,values:f}}if(s){for(let u=0;u<r;u++){let c=n[u].trim();f[u]=t.has(c)?null:M(c,{allowNonFiniteNumbers:!0})}return{type:Ut,values:f}}if(i){for(let u=0;u<r;u++){let c=n[u].trim();f[u]=t.has(c)?null:H(c)}return{type:jt,values:f}}return{type:ut,values:f}}var Po=k(()=>{"use strict";wn();kt();Ze();De();ye()});function hi(n){return n==null?!1:typeof n=="string"||B(n)?!0:Array.isArray(n)}function jo(n){return hi(n)?Object.prototype.toString.call(n)==="[object Uint8Array]"?n:typeof n=="string"?new TextEncoder().encode(n):B(n)?new Uint8Array(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)):new Uint8Array(n):null}var Bo=k(()=>{"use strict";tt()});function $o(n,e){return e==="us"?n*1e3:e==="ns"?n*1e6:n}var qo=k(()=>{"use strict"});var q=k(()=>{"use strict";ye();Ze();wn();tt();Tt();kt();Po();Bo();qo()});function X(n,e,t,r=""){if(!(n in e))throw new Te(n,`${t} "${n}" does not exist${r}`)}function qn(n,e){let t=Object.keys(n),r=t.length,o=e;for(let s=0;s<r;s++){let a=t[s],i=n[a],l=E(i)?i.length:0;if(o===void 0)o=l;else if(l!==o)throw new te(`Column height mismatch: Column "${a}" has length ${l}, but DataFrame height is ${o}`)}return o===void 0?0:o}function Pt(n,e="Value cannot be null or undefined"){if(n==null)throw new v(e);return n}function Ta(n,e){if(!n)throw new v(e)}var Ko=k(()=>{"use strict";Y();q()});var Ce,z,Te,Fe,ie,te,v,Ae,Y=k(()=>{"use strict";Ko();Ce=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},z=class extends Ce{},Te=class extends z{constructor(e,t){super(t||`Column "${e}" does not exist in the DataFrame.`)}},Fe=class extends Ce{},ie=class extends Ce{},te=class extends Ce{},v=class extends Ce{},Ae=class extends Ce{}});function yi(n,e,t){let r=new Map,o=t.length,s=new Array(o);for(let a=0;a<o;a++){let i=t[a];typeof i=="string"?(X(i,n,"Partition key"," in the DataFrame."),s[a]=n[i]):s[a]=i.evaluate(n,e)}if(o===1){let a=s[0];for(let i=0;i<e;i++){let l=a[i],f=l==null?"":G(l),u=r.get(f);u===void 0&&(u=[],r.set(f,u)),u.push(i)}return r}for(let a=0;a<e;a++){let i=new Array(o);for(let u=0;u<o;u++){let c=s[u][a];i[u]=c==null?"":G(c)}let l=i.join("\0"),f=r.get(l);f===void 0&&(f=[],r.set(l,f)),f.push(a)}return r}function zo(n,e,t){let r=new Array(t);if(t===0)return r;let o=n._partitionBy||[],s=yi(e,t,o),a=n._evaluatePre(n._partitionOpsIndex,e,t);for(let i of s.values()){let l=i.length,f=new Array(l);for(let u=0;u<l;u++)f[u]=a[i[u]];if(n._evaluateWindow){for(let u=0;u<l;u++)r[i[u]]=n._evaluateWindow(f,i,u);continue}if(n._aggFn){let u=n._aggFn(f);for(let c=0;c<l;c++)r[i[c]]=u;continue}for(let u=0;u<l;u++)r[i[u]]=a[i[u]]}return n._evaluatePost(n._partitionOpsIndex,r,e)}function Wo(n){if(!Array.isArray(n)||n.length===0)return{columns:{},height:0};let e=n.length,t=new Set;for(let s=0;s<e;s++){let a=n[s];if(K(a)){let i=Object.keys(a);for(let l=0;l<i.length;l++)t.add(i[l])}}let r=Array.from(t),o={};for(let s=0;s<r.length;s++)o[r[s]]=new Array(e);for(let s=0;s<e;s++){let a=n[s]||{};for(let i=0;i<r.length;i++){let l=r[i],f=a[l];o[l][s]=f===void 0?null:f}}return{columns:o,height:e}}function Go(n,e){let t=Object.keys(n),r=new Array(e);for(let o=0;o<e;o++){let s={};for(let a=0;a<t.length;a++){let i=t[a],l=n[i][o];s[i]=l===void 0?null:l}r[o]=s}return r}function va(n,e,t){let r={};for(let o=0;o<t.length;o++){let s=t[o],a=n[s][e];r[s]=a===void 0?null:a}return r}function Ie(n){if(n.length===0)return j.Utf8;let e=!0,t=!0,r=!0,o=!0,s=!0,a=!0,i=!0,l=!0,f=!1,u=!1,c=[];for(let m=0;m<n.length;m++){let p=n[m];if(p!=null){if(u=!0,p instanceof Uint8Array||(i=!1),!E(p)||p instanceof Uint8Array)a=!1;else{let h=p,y=h.length;for(let d=0;d<y;d++)c.push(h[d])}U(p)&&(f=!0),typeof p!="boolean"&&(e=!1),typeof p!="bigint"&&(o=!1),typeof p!="number"?(r=!1,t=!1):Number.isInteger(p)||(t=!1),!U(p)&&(typeof p!="string"||isNaN(Date.parse(p)))&&(s=!1),(!K(p)||p instanceof Uint8Array)&&(l=!1)}}if(!u)return j.Null;if(i)return j.Binary;if(a){let m=Ie(c);return j.Array(m)}if(e)return j.Boolean;if(o)return j.Int64;if(r&&!t)return j.Float64;if(r&&t){let m=!0;for(let p=0;p<n.length;p++){let h=n[p];if(h!=null&&(h<-2147483648||h>2147483647)){m=!1;break}}return m?j.Int32:j.Float64}return s&&f?j.Datetime:l?j.Object:j.Utf8}function ft(n,e){let t=Object.keys(n),r=t.length,o=e.length,s={};for(let a=0;a<r;a++){let i=t[a],l=n[i],f=B(l)?new l.constructor(o):new Array(o);for(let u=0;u<o;u++)f[u]=l[e[u]];s[i]=f}return s}function Oe(n,e,t){let r=e.length;if(r===1)return G(n[e[0]][t]);let o=new Array(r);for(let s=0;s<r;s++)o[s]=G(n[e[s]][t]);return o.join("\0")}function je(n,e,t){let r=e.allocate?e.allocate(t):new Array(t);if(B(r)){let s=r;for(let a=0;a<t;a++){let i=e.coerce(n[a]);if(i==null){let l=new Array(t);for(let f=0;f<a;f++)l[f]=s[f];l[a]=null;for(let f=a+1;f<t;f++)l[f]=e.coerce(n[f]);return l}s[a]=i}}else for(let s=0;s<t;s++)r[s]=e.coerce(n[s]);return r}function Jo(n,e){if(n)if(typeof n=="string"){if(typeof Pe!="function")throw new Ae("File writing is not supported in this environment (missing require('fs')).");Pe("fs").writeFileSync(n,e,"utf8")}else if(K(n)&&typeof n.write=="function")n.write(e);else throw new v("Invalid file argument. Expected a file path string or a writable stream/object with a write method.")}function Yo(n,e,t,r,o,s,a={}){let{how:i="inner",join_nulls:l=!1,maintain_order:f}=a,u=(b,D,C)=>{if(!l){for(let O=0;O<D.length;O++)if(b[D[O]][C]==null)return null}return Oe(b,D,C)};if(i==="cross")return no(t,r);let c=new Map;for(let b=0;b<r;b++){let D=u(e,s,b);if(D===null)continue;let C=c.get(D);C===void 0&&(C=[],c.set(D,C)),C.push(b)}let m=[],p=[];if(i==="semi"||i==="anti"){for(let b=0;b<t;b++){let D=u(n,o,b),C=D===null?void 0:c.get(D),O=C!==void 0&&C.length>0;(i==="semi"&&O||i==="anti"&&!O)&&(m.push(b),p.push(null))}return{leftIndices:m,rightIndices:p}}let h=i==="outer"||i==="right",y=h?new Set:null;for(let b=0;b<t;b++){let D=u(n,o,b),C=D===null?void 0:c.get(D);if(C===void 0)(i==="left"||i==="outer")&&(m.push(b),p.push(null));else for(let O=0;O<C.length;O++){let N=C[O];h&&y.add(N),m.push(b),p.push(N)}}if(h)for(let b=0;b<r;b++)y.has(b)||(m.push(-1),p.push(b));let d=f||"none";if(d==="none"||d==="left")return{leftIndices:m,rightIndices:p};let g=m.length,_=new Int32Array(g);for(let b=0;b<g;b++)_[b]=b;let T=b=>m[b]===-1?Number.MAX_SAFE_INTEGER:m[b],A=b=>p[b]??Number.MAX_SAFE_INTEGER;d==="right"?_.sort((b,D)=>A(b)-A(D)||b-D):d==="left_right"?_.sort((b,D)=>T(b)-T(D)||A(b)-A(D)||b-D):d==="right_left"&&_.sort((b,D)=>A(b)-A(D)||T(b)-T(D)||b-D);let x=new Array(g),S=new Array(g);for(let b=0;b<g;b++){let D=_[b];x[b]=m[D],S[b]=p[D]}return{leftIndices:x,rightIndices:S}}function Ho(n,e,t,r,o,s,a,i,l={}){let f=l.strategy??"backward",u=l.allow_exact_matches??!0,c=l.check_sorted??!0;X(o,n,"Join on key"," in the left DataFrame."),X(s,e,"Join on key"," in the right DataFrame.");let m=n[o],p=e[s];if(c){let x=(S,b,D,C)=>{for(let O=1;O<b;O++){let N=M(S[O-1]),J=M(S[O]);if(F(N)&&F(J)&&J<N)throw new v(`${C} DataFrame key column "${D}" is not sorted in ascending order at row ${O}.`)}};x(m,t,o,"left"),x(p,r,s,"right")}let h=a.length>0,y=new Map;if(h)for(let x=0;x<r;x++){let S=Oe(e,i,x),b=y.get(S);b||(b=[],y.set(S,b)),b.push(x)}let d=new Array(r);if(!h)for(let x=0;x<r;x++)d[x]=x;let g=new Array(t),_=new Array(t),T=(x,S)=>{let b=S.length;if(b===0)return null;let D=(W,oe)=>M(p[oe])??NaN;if(f==="backward"){let W=Dt(S,x,{side:u?"right":"left",getValue:D})-1;return W>=0?S[W]:null}if(f==="forward"){let W=Dt(S,x,{side:u?"left":"right",getValue:D});return W<b?S[W]:null}let C=Dt(S,x,{side:"right",getValue:D}),O=C-1,N=C;if(u||(O>=0&&D(O,S[O])===x&&O--,N<b&&D(N,S[N])===x&&N++),O<0)return N<b?S[N]:null;if(N>=b)return O>=0?S[O]:null;let J=D(O,S[O]),Z=D(N,S[N]);return Math.abs(x-J)<=Math.abs(x-Z)?S[O]:S[N]},A=l.tolerance!==void 0?M(l.tolerance):null;for(let x=0;x<t;x++){g[x]=x;let S=M(m[x]);if(!F(S)){_[x]=null;continue}let b=h?y.get(Oe(n,a,x))||[]:d;if(b.length===0){_[x]=null;continue}let D=T(S,b);if(D!==null&&A!==null){let C=M(p[D]);(!F(A)||!F(C)||Math.abs(S-C)>A)&&(D=null)}_[x]=D}return{leftIndices:g,rightIndices:_}}function zn(n,e,t,r,o,s,a,i,l={}){let[f="",u="_right"]=l.suffixes||[],c=l.coalesce??!0,m=l.how||"inner",p=o.length,h={},y={},d=new Set(a),g=new Set(i),_=(D,C)=>{let O=C!==""?C:"_left",N=`${D}${O}`,J=1;for(;x.has(N);)N=`${D}${O}_${J++}`;return x.add(N),N},T=(D,C,O=-1)=>{let N=C.length,J=new Array(N);for(let Z=0;Z<N;Z++){let W=C[Z];J[Z]=W!==null&&W!==O?D[W]:null}return J},A=new Map;for(let D=0;D<a.length;D++)A.has(a[D])||A.set(a[D],i[D]);let x=new Set,S=Object.keys(n),b=Object.keys(e);for(let D=0;D<S.length;D++){let C=S[D];(!(C in e)||d.has(C)||g.has(C))&&x.add(C)}for(let D=0;D<S.length;D++){let C=S[D],O=d.has(C),N;C in e&&!O&&!g.has(C)?f!==""?(x.add(C),N=_(C,f)):x.has(C)?N=_(C,f):(N=C,x.add(C)):N=C;let J=n[C],Z=O?A.get(C):null,W=Z?e[Z]:null;if(O&&c){let oe=new Array(p);for(let le=0;le<p;le++){let yt=o[le],Le=s[le],bs=yt!==-1?J[yt]:null,xs=Le!==null&&W?W[Le]:null;oe[le]=bs??xs}h[N]=oe}else h[N]=T(J,o);t[C]?y[N]=t[C]:Z&&r[Z]&&(y[N]=r[Z])}if(m!=="semi"&&m!=="anti")for(let D=0;D<b.length;D++){let C=b[D];if(c&&g.has(C))continue;let O;x.has(C)?O=_(C,u):(O=C,x.add(C)),h[O]=T(e[C],s),r[C]&&(y[O]=r[C])}return V._createDirect(h,y,p)}var Bt=k(()=>{"use strict";We();De();q();Y()});function di(n,e){if(n==null)return null;let t=typeof n=="object"&&U(n)?n.getTime():n;return e(t)}function Xo(n,e,t){if(n==null||e==null)return null;let r=typeof n=="object"&&U(n)?n.getTime():n,o=typeof e=="object"&&U(e)?e.getTime():e;return t(r,o)}function _e(n,e,t){return n._isWindow?zo(n,e,t):n.evaluate(e,t)}var I,L,fe=k(()=>{"use strict";q();ye();Bt();I=n=>e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=di(e[o],n);return r},L=(n,e,t)=>(r,o)=>{let s=r.length,a=n._resolve(e,o,s),i=new Array(s);if(E(a))for(let l=0;l<s;l++)i[l]=Xo(r[l],a[l],t);else for(let l=0;l<s;l++)i[l]=Xo(r[l],a,t);return i}});var w,$,ae=k(()=>{"use strict";Y();fe();w=(n,e)=>{let t=n.constructor,r=n._colNames||n._colName||"",o=new t(r);return Object.assign(o,n),o._ops=e?[...n._ops,e]:[...n._ops],o},$=class n{_ops=[];_outputName="";_isLiteral;_literalValue;_aggFn=null;_castType;_groupingOpsIndex;_partitionOpsIndex;_partitionBy=null;_evaluateWindow;_evaluatePost(e,t,r){let o=this._ops,s=e!==void 0?e:o.length,a=t;for(let i=s;i<o.length;i++)a=o[i](a,r);return a}_evaluatePre(e,t,r){let o=this._getInitialValue(t,r),s=this._ops,a=e!==void 0?e:s.length;for(let i=0;i<a;i++)o=s[i](o,t);return o}_getInitialValue(e,t){let r=this._colName;if(r&&r!=="*"&&!r.startsWith("*")&&!(r in e))throw new Te(r);return(r&&r!=="*"?e[r]:null)||new Array(t).fill(null)}_resolve(e,t,r){return e instanceof n?e._isLiteral&&e._ops.length===1?e._literalValue:_e(e,t,r):e}alias(e){let t=w(this);return t._outputName=e,t}cast(e){let t=w(this,I(r=>e.coerce(r)));return t._castType=e,t}debug(e){return w(this,t=>(console.log(`[DEBUG] ${e?e+": ":""}`,t),t))}evaluate(e,t){return this._evaluatePre(void 0,e,t)}}});var $t,Wn=k(()=>{"use strict";ae();fe();q();$t=class extends ${abs(){return w(this,I(Math.abs))}acos(){return w(this,I(e=>e<-1||e>1?null:Math.acos(e)))}acosh(){return w(this,I(e=>e<1?null:Math.acosh(e)))}add(e){return w(this,L(this,e,(t,r)=>t+r))}asin(){return w(this,I(e=>e<-1||e>1?null:Math.asin(e)))}asinh(){return w(this,I(Math.asinh))}atan(){return w(this,I(Math.atan))}atan2(e){return w(this,L(this,e,Math.atan2))}atanh(){return w(this,I(e=>e<=-1||e>=1?null:Math.atanh(e)))}cbrt(){return w(this,I(Math.cbrt))}ceil(){return w(this,I(Math.ceil))}clip(e=null,t=null){return w(this,I(r=>pe(r,{min:e,max:t})))}copysign(e){return w(this,L(this,e,(t,r)=>Math.abs(t)*(r>=0?1:-1)))}cos(){return w(this,I(Math.cos))}cosh(){return w(this,I(Math.cosh))}degrees(){return w(this,I(e=>e*(180/Math.PI)))}div(e){return w(this,L(this,e,(t,r)=>r===0?null:t/r))}exp(){return w(this,I(Math.exp))}expm1(){return w(this,I(Math.expm1))}floor(){return w(this,I(Math.floor))}floordiv(e){return w(this,L(this,e,(t,r)=>r===0?null:Math.floor(t/r)))}hypot(e){return w(this,L(this,e,Math.hypot))}log(e=Math.E){return w(this,I(t=>t<=0?null:e===Math.E?Math.log(t):Math.log(t)/Math.log(e)))}log1p(){return w(this,I(e=>e<=-1?null:Math.log1p(e)))}mod(e){return w(this,L(this,e,(t,r)=>r===0?null:t%r))}mul(e){return w(this,L(this,e,(t,r)=>t*r))}negate(){return w(this,I(e=>-e))}pow(e){return w(this,L(this,e,Math.pow))}radians(){return w(this,I(e=>e*(Math.PI/180)))}rand(e,{min:t=0,max:r=1,integer:o=!1}={}){return w(this,s=>{let a=s.length,i=new Float64Array(a),l=e!==void 0?zr(e):Math.random,f=r-t;for(let u=0;u<a;u++){let c=l();i[u]=o?Math.floor(c*(f+1))+t:c*f+t}return i})}round(e=0){return w(this,I(t=>fn(t,e)))}round_sig_figs(e){return w(this,I(t=>F(t)?Number(t.toPrecision(e)):t))}sign(){return w(this,I(Math.sign))}sin(){return w(this,I(Math.sin))}sinh(){return w(this,I(Math.sinh))}sqrt(){return w(this,I(e=>e<0?null:Math.sqrt(e)))}sub(e){return w(this,L(this,e,(t,r)=>t-r))}tan(){return w(this,I(Math.tan))}tanh(){return w(this,I(Math.tanh))}trunc(){return w(this,I(Math.trunc))}}});var qt,Gn=k(()=>{"use strict";ae();fe();q();qt=class extends ${and(e){return w(this,(t,r)=>{let o=t.length,s=this._resolve(e,r,o),a=E(s),i=new Array(o);for(let l=0;l<o;l++){let f=t[l],u=a?s[l]:s;f===!1||u===!1?i[l]=!1:f==null||u==null?i[l]=null:i[l]=!0}return i})}not(){return w(this,I(e=>!e))}or(e){return w(this,(t,r)=>{let o=t.length,s=this._resolve(e,r,o),a=E(s),i=new Array(o);for(let l=0;l<o;l++){let f=t[l],u=a?s[l]:s;f===!0||u===!0?i[l]=!0:f==null||u==null?i[l]=null:i[l]=!1}return i})}xor(e){return w(this,L(this,e,(t,r)=>!!t!=!!r))}}});function Zo(n,e,t,r){let o=n.length,s=new Array(o);if(t&&typeof t=="object"&&"evaluate"in t){let a=t.evaluate(e,o);for(let i=0;i<o;i++){let l=n[i];if(l==null)s[i]=null;else{let f=a[i],u=new Set;if(E(f)){let m=f.length;for(let p=0;p<m;p++)u.add(G(f[p]))}else u.add(G(f));let c=u.has(G(l));s[i]=r?!c:c}}}else{let a=E(t)?t:[],i=new Set,l=a.length;for(let f=0;f<l;f++)i.add(G(a[f]));for(let f=0;f<o;f++){let u=n[f];if(u==null)s[f]=null;else{let c=i.has(G(u));s[f]=r?!c:c}}}return s}function Qo(n,e){let{frequencies:t}=Se(n,{strict:!0}),r=n.length,o=new Array(r);for(let s=0;s<r;s++){let a=t.get(n[s])||0;o[s]=e?a>1:a===1}return o}function es(n,e,t){let r=n.length,o=new Array(r);if(E(e))for(let s=0;s<r;s++){let a=n[s],i=e[s];a==null&&i==null?o[s]=!t:a==null||i==null?o[s]=t:o[s]=t?a!==i:a===i}else for(let s=0;s<r;s++){let a=n[s];a==null&&e==null?o[s]=!t:a==null||e==null?o[s]=t:o[s]=t?a!==e:a===e}return o}var Kt,Jn=k(()=>{"use strict";ae();fe();q();Kt=class extends ${between(e,t,r="both"){return w(this,(o,s)=>{let a=o.length,i=this._resolve(e,s,a),l=this._resolve(t,s,a),f=new Array(a),u=E(i),c=E(l);for(let m=0;m<a;m++){let p=o[m],h=u?i[m]:i,y=c?l[m]:l;if(p==null||h==null||y==null)f[m]=null;else{let d=r==="both"||r==="left"?p>=h:p>h,g=r==="both"||r==="right"?p<=y:p<y;f[m]=d&&g}}return f})}eq(e){return w(this,L(this,e,(t,r)=>t===r))}eq_missing(e){return w(this,(t,r)=>{let o=this._resolve(e,r,t.length);return es(t,o,!1)})}ge(e){return w(this,L(this,e,(t,r)=>t>=r))}gt(e){return w(this,L(this,e,(t,r)=>t>r))}has_nulls(){return this._deriveAgg(e=>{for(let t=0;t<e.length;t++)if(e[t]==null)return!0;return!1})}is_close(e,{abs_tol:t=1e-8,rel_tol:r=1e-8,nans_equal:o=!1}={}){return w(this,(s,a)=>{let i=s.length,l=this._resolve(e,a,i),f=E(l),u=new Array(i);for(let c=0;c<i;c++){let m=s[c],p=f?l[c]:l;if(m==null||p==null)u[c]=null;else if(F(m)&&F(p)){let h=Math.abs(m-p),y=Math.max(r*Math.max(Math.abs(m),Math.abs(p)),t);u[c]=h<=y}else Number.isNaN(m)&&Number.isNaN(p)?u[c]=o:u[c]=m===p}return u})}is_duplicated(){return w(this,e=>Qo(e,!0))}is_empty({ignoreNulls:e=!1}={}){return w(this,I(t=>typeof t=="string"?t.length===0:E(t)?e?Q(t,"nullish",{mode:"every"}):t.length===0:null))}is_finite(){return w(this,I(Number.isFinite))}is_in(e){return w(this,(t,r)=>Zo(t,r,e,!1))}is_infinite(){return w(this,I(e=>e===1/0||e===-1/0))}is_nan(){return w(this,I(Number.isNaN))}is_not_nan(){return w(this,I(e=>!Number.isNaN(e)))}is_not_null(){return w(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]!=null;return r})}is_null(){return w(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]==null;return r})}is_unique(){return w(this,e=>Qo(e,!1))}le(e){return w(this,L(this,e,(t,r)=>t<=r))}lt(e){return w(this,L(this,e,(t,r)=>t<r))}ne(e){return w(this,L(this,e,(t,r)=>t!==r))}ne_missing(e){return w(this,(t,r)=>{let o=this._resolve(e,r,t.length);return es(t,o,!0)})}not_in(e){return w(this,(t,r)=>Zo(t,r,e,!0))}}});var Yn,zt,Hn=k(()=>{"use strict";ae();fe();q();Yn=class{constructor(e){this.expr=e}expr;_deriveString(e){return w(this.expr,I(t=>e(String(t))))}_patternGuard(e,t){return e==null?w(this.expr,r=>new Array(r.length).fill(null)):t()}concat(e){return w(this.expr,L(this.expr,e,(t,r)=>String(t)+String(r)))}contains(e){return this._patternGuard(e,()=>this._deriveString(t=>xe(e)?e.test(t):t.includes(e)))}count_matches(e){return this._patternGuard(e,()=>this._deriveString(t=>{if(xe(e)){let r=e.global?e:new RegExp(e.source,e.flags+"g"),o=t.match(r);return o?o.length:0}else{let r=0,o=t.indexOf(e);for(;o!==-1;)r++,o=t.indexOf(e,o+e.length);return r}}))}decode_uri_component(){return this._deriveString(e=>{try{return decodeURIComponent(e)}catch{return e}})}encode_uri_component(){return this._deriveString(e=>{try{return encodeURIComponent(e)}catch{return e}})}ends_with(e){return this._deriveString(t=>t.endsWith(e))}explode(){return this._deriveString(e=>e.split(""))}extract(e,t=0){return this._patternGuard(e,()=>this._deriveString(r=>{let o=r.match(e);return o&&o[t]!==void 0?o[t]:null}))}len(){return this.len_chars()}len_bytes(){return this._deriveString(e=>new TextEncoder().encode(e).length)}len_chars(){return this._deriveString(e=>e.length)}lower(){return this._deriveString(e=>e.toLowerCase())}lpad(e,t=" "){return this._deriveString(r=>r.padStart(e,t))}pad_end(e,t=" "){return this.rpad(e,t)}pad_start(e,t=" "){return this.lpad(e,t)}replace(e,t){return this._patternGuard(e,()=>this._deriveString(r=>r.replace(e,t)))}replace_all(e,t){return this._patternGuard(e,()=>this._deriveString(r=>r.replaceAll(e,t)))}reverse(){return this._deriveString(e=>e.split("").reverse().join(""))}rpad(e,t=" "){return this._deriveString(r=>r.padEnd(e,t))}slice(e,t){return this._deriveString(r=>{let o=e<0?r.length+e:e,s=t!==void 0?o+t:void 0;return r.slice(o,s)})}split(e){return this._deriveString(t=>t.split(e))}starts_with(e){return this._deriveString(t=>t.startsWith(e))}strip_chars(e,t){return this._deriveString(r=>qe(r,e,{mode:"both",...t}))}strip_chars_end(e,t){return this._deriveString(r=>qe(r,e,{mode:"end",...t}))}strip_chars_start(e,t){return this._deriveString(r=>qe(r,e,{mode:"start",...t}))}strip_prefix(e){return this._deriveString(t=>qe(t,e,{mode:"start",maxScanStart:1,maxMatchesStart:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}strip_suffix(e){return this._deriveString(t=>qe(t,e,{mode:"end",maxScanEnd:1,maxMatchesEnd:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}strptime(e){return this._deriveString(t=>yo(t,e))}to_camelcase(){return this._deriveString(e=>nt(e,{format:"camel"}))}to_date(){return this._deriveString(e=>H(e,{dateOnly:!0}))}to_datetime(){return this._deriveString(H)}to_decimal(e,t){return this._deriveString(r=>xt(r,{precision:e,scale:t}))}to_integer(){return this._deriveString(e=>de(e))}to_kebabcase(){return this._deriveString(e=>nt(e,{format:"kebab"}))}to_lowercase(){return this.lower()}to_pascalcase(){return this._deriveString(e=>nt(e,{format:"pascal"}))}to_snakecase(){return this._deriveString(e=>nt(e,{format:"snake"}))}to_time(){return this._deriveString(It)}to_titlecase(){return this._deriveString(e=>e.replace(/\b\w/g,t=>t.toUpperCase()))}to_uppercase(){return this.upper()}trim(){return this.strip_chars()}trim_end(){return this.strip_chars_end()}trim_start(){return this.strip_chars_start()}upper(){return this._deriveString(e=>e.toUpperCase())}zfill(e){return this._deriveString(t=>t.padStart(e,"0"))}},zt=class extends ${get str(){return new Yn(this)}}});var Wt,Xn=k(()=>{"use strict";ae();fe();Y();q();Wt=class extends ${_deriveAgg(e){let t=w(this);return t._aggFn=e,t._groupingOpsIndex=this._ops.length,t._partitionOpsIndex=this._ops.length,t}_deriveAggBinary(e,t){return w(this,L(this,e,(r,o)=>[r,o]))._deriveAgg(t)}all(){return this._deriveAgg(e=>Q(e,t=>!!t,{mode:"every"}))}all_null(){return this._deriveAgg(e=>Q(e,"nullish",{mode:"every"}))}any(){return this._deriveAgg(e=>Q(e,t=>!!t,{mode:"some"}))}any_null(){return this._deriveAgg(e=>Q(e,"nullish",{mode:"some"}))}avg(){return this._deriveAgg(e=>P(e).mean)}corr(e){return this._deriveAggBinary(e,t=>mn(t)?.correlation??null)}count(e={}){return e.includeNulls?this._deriveAgg(t=>t.length):this._deriveAgg(t=>P(t).count)}cov(e){return this._deriveAggBinary(e,t=>mn(t)?.covariance??null)}dot(e){return this._deriveAggBinary(e,t=>eo(t))}first(){return this._deriveAgg(e=>e[0]??null)}implode(){return this._deriveAgg(e=>e)}last(){return this._deriveAgg(e=>e[e.length-1]??null)}max(){return this._deriveAgg(e=>P(e).max)}mean(){return this.avg()}median(){return this._deriveAgg(e=>$e(e))}min(){return this._deriveAgg(e=>P(e).min)}mode(){return this._deriveAgg(e=>At(e))}n_unique(e={}){return this._deriveAgg(t=>Se(t,e).count)}null_count(){return this._deriveAgg(e=>P(e).nullCount)}quantile(e){if(e<0||e>1)throw new ie("Quantile q must be between 0 and 1");return this._deriveAgg(t=>St(t,e))}spearman_corr(e){return this._deriveAggBinary(e,t=>Qr(t))}std(){return this._deriveAgg(e=>P(e).std)}sum(){return this._deriveAgg(e=>P(e).sum)}w_avg(e){return this._deriveAggBinary(e,t=>to(t))}}});function Zn(n,e,t={}){if(e==null)return null;let r=t.dense?"_denseRankCache":"_rankCache",o=n[r];if(!o){let s=n;if(t.ignoreNulls){s=[];let l=n.length;for(let f=0;f<l;f++)n[f]!=null&&s.push(n[f])}t.dense&&(s=Array.from(new Set(s)));let a=et(s);o=new Map;let i=a.length;for(let l=0;l<i;l++){let f=a[l];o.has(f)||o.set(f,l+1)}n[r]=o}return o.get(e)??null}var Gt,Qn=k(()=>{"use strict";ae();q();Gt=class extends ${_partitionBy=this._partitionBy||null;_window(e){let t=w(this);return t._partitionOpsIndex=this._ops.length,t._groupingOpsIndex=this._ops.length,t._evaluateWindow=e,t}_rolling(e,t){return this._window(function(r,o,s){let a=Math.max(0,s-e+1),i=s+1,l=r.slice(a,i);return t(l)})}_cum(e,t,r,o){return this._window(function(s,a,i){let l=t,f=!1,u=e?i:0,c=e?s.length-1:i;for(let m=u;m<=c;m++){let p=s[m];p!=null&&(l=r(l,p),f=!0)}return o?o(l,f):l})}get _isWindow(){return this._partitionBy!==null||this._evaluateWindow!==void 0||this._aggFn!==null}cum_count(e=!1){return this._cum(e,0,t=>t+1)}cum_max(e=!1){return this._cum(e,null,(t,r)=>t===null||r>t?r:t)}cum_min(e=!1){return this._cum(e,null,(t,r)=>t===null||r<t?r:t)}cum_prod(e=!1){return this._cum(e,1,(t,r)=>t*r,(t,r)=>r?t:null)}cum_sum(e=!1){return this._cum(e,0,(t,r)=>t+r)}dense_rank(){return this._window(function(e,t,r){return Zn(e,e[r],{dense:!0})})}lag(e=1,t=null){return this._window(function(r,o,s){let a=t;return s-e>=0&&(a=r[s-e]),a})}lead(e=1,t=null){return this._window(function(r,o,s){let a=t;return s+e<r.length&&(a=r[s+e]),a})}over(e){let t=w(this),r=Array.isArray(e)?e:[e];return t._partitionBy=r,t}rank(){return this._window(function(e,t,r){return Zn(e,e[r])})}rolling_max(e){return this._rolling(e,t=>P(t).max)}rolling_mean(e){return this._rolling(e,t=>P(t).mean)}rolling_median(e){return this._rolling(e,t=>$e(t))}rolling_min(e){return this._rolling(e,t=>P(t).min)}rolling_quantile(e,t){return this._rolling(t,r=>St(r,e))}rolling_rank(e){return this._rolling(e,t=>Zn(t,t[t.length-1],{ignoreNulls:!0}))}rolling_std(e){return this._rolling(e,t=>P(t).std)}rolling_sum(e){return this._rolling(e,t=>P(t).sum)}row_number(){let e=this._window(function(t,r,o){return o+1});return e._outputName="row_number",e}}});var er,Jt,tr=k(()=>{"use strict";ae();fe();q();be();Y();er=class{constructor(e){this.expr=e}expr;_deriveArray(e){return w(this.expr,I(t=>E(t)?e(t):null))}all(){return this._deriveArray(e=>Q(e,t=>!!t,{mode:"every"}))}any(){return this._deriveArray(e=>Q(e,t=>!!t,{mode:"some"}))}contains(e){return this._deriveArray(t=>t.includes(e))}contains_all(e){return this._deriveArray(t=>Q(e,r=>t.includes(r),{mode:"every"}))}contains_any(e){return this._deriveArray(t=>Q(e,r=>t.includes(r),{mode:"some"}))}count_matches(e,t={}){return this._deriveArray(r=>Se(r,t).frequencies.get(e)??0)}filter(e){return w(this.expr,(t,r)=>{let o=t.length,s=new Array(o),a=Object.create(r);for(let i=0;i<o;i++){let l=t[i];if(!E(l)){s[i]=null;continue}let f=l.length;a[Ye]=l;let u=_e(e,a,f),c=[];if(E(u)){let m=Math.min(f,u.length);for(let p=0;p<m;p++)u[p]&&c.push(l[p])}else if(u)for(let m=0;m<f;m++)c.push(l[m]);s[i]=c}return s})}explode({empty_as_null:e=!0,keep_nulls:t=!0}={}){return w(this.expr,r=>{let o=r.length,s=0;for(let f=0;f<o;f++){let u=r[f];if(E(u)){s+=u.length||(e?1:0);continue}if(u!=null){s+=1;continue}t&&(s+=1)}let a=new Array(s),i=new Int32Array(s),l=0;for(let f=0;f<o;f++){let u=r[f];if(E(u)){let c=u.length;if(c>0){for(let m=0;m<c;m++)i[l]=f,a[l++]=u[m];continue}e&&(i[l]=f,a[l++]=null);continue}if(u!=null){i[l]=f,a[l++]=u;continue}t&&(i[l]=f,a[l++]=null)}return a.rowMap=i,a})}first(e=!0){return this.get(0,e)}gather(e,t=!0){return this._deriveArray(r=>{let o=typeof e=="number"?[e]:e,s=o.length,a=new Array(s);for(let i=0;i<s;i++)a[i]=wt(r,o[i],t);return a})}gather_every(e={}){return this._deriveArray(t=>Yr(t,e))}get(e,t=!0){return this._deriveArray(r=>wt(r,e,t))}join(e=",",t={}){return this._deriveArray(r=>Hr(r,e,t))}last(e=!0){return this.get(-1,e)}len(){return this.lengths()}lengths(){return this._deriveArray(e=>e.length)}max(){return this._deriveArray(e=>P(e).max)}max_index(){return this._deriveArray(e=>P(e).maxIdx)}mean(){return this._deriveArray(e=>P(e).mean)}median(){return this._deriveArray(e=>$e(e))}min(){return this._deriveArray(e=>P(e).min)}min_index(){return this._deriveArray(e=>P(e).minIdx)}mode(){return this._deriveArray(e=>At(e))}n_unique(e={}){return this._deriveArray(t=>Se(t,e).count)}reverse(){return this._deriveArray(e=>e.slice().reverse())}shift(e=1){return this._deriveArray(t=>Zr(t,e))}slice(e,t){return this._deriveArray(r=>r.slice(e,t))}splice(e,t,...r){return this._deriveArray(o=>{let s=[...o];return s.splice(e,t??s.length,...r),s})}sort(e){return this._deriveArray(t=>et(t,e))}std(){return this._deriveArray(e=>P(e).std)}sum(){return this._deriveArray(e=>P(e).sum)}to_struct({upper_bound:e,fields:t}={}){return w(this.expr,r=>{let o=r.length,s=new Array(o),a=0;if(Array.isArray(t))a=t.length;else if(typeof e=="number")a=e;else for(let l=0;l<o;l++){let f=r[l];E(f)&&f.length>a&&(a=f.length)}if(a===0)throw new ie("to_struct cannot be evaluated: struct width is 0. Provide an upper_bound, non-empty fields names, or non-empty lists.");let i=new Array(a);for(let l=0;l<a;l++)typeof t=="function"?i[l]=t(l):i[l]=(Array.isArray(t)?t[l]:null)??`field_${l}`;for(let l=0;l<o;l++){let f=r[l];if(!E(f)){s[l]=null;continue}let u={};for(let c=0;c<a;c++)u[i[c]]=wt(f,c,!0);s[l]=u}return s})}unique(e={}){return this._deriveArray(t=>Se(t,e).values)}variance(){return this._deriveArray(e=>P(e).variance)}eval(e){return w(this.expr,(t,r)=>{let o=t.length,s=new Array(o);for(let a=0;a<o;a++){let i=t[a];if(!E(i)){s[a]=null;continue}let l=i.length,f={...r,[Ye]:i};if(e._aggFn!=null&&(e._partitionBy==null||e._partitionBy.length===0)){let c=e._groupingOpsIndex!==void 0?e._groupingOpsIndex:e._ops.length,m=e._evaluatePre(c,f,l),p=e._aggFn(Array.from(m));s[a]=e._evaluatePost(c,[p],f)}else s[a]=_e(e,f,l)}return s})}},Jt=class extends ${get arr(){return new er(this)}}});function ts(n){return Pt(n,"Column reference cannot be null or undefined."),Yt||(Yt=(ue(),yr(ns)).ColumnExpr),Yt.isColExpr(n)?n:new Yt(n)}var Yt,nr,Ht,rr=k(()=>{"use strict";ae();Y();Yt=null;nr=class{constructor(e){this.expr=e;return new Proxy(this,{get(t,r,o){return r in t?Reflect.get(t,r,o):typeof r=="string"?t.field(r):Reflect.get(t,r,o)}})}expr;field(e){return w(this.expr,t=>{let r=t.length,o=new Array(r);for(let s=0;s<r;s++){let a=t[s];o[s]=a!=null&&typeof a=="object"?a[e]:null}return o}).alias(e)}rename_fields(e){return w(this.expr,t=>{let r=t.length,o=new Array(r),s=Object.keys(e),a=s.length;for(let i=0;i<r;i++){let l=t[i];if(l==null||typeof l!="object"){o[i]=null;continue}let f={},u=Object.keys(l),c=u.length;for(let m=0;m<c;m++){let p=u[m];f[p]=l[p]}for(let m=0;m<a;m++){let p=s[m];if(p in f){let h=e[p];f[h]=f[p],delete f[p]}}o[i]=f}return o})}with_fields(e){return w(this.expr,(t,r)=>{let o=t.length,s=new Array(o),a=[];if(Array.isArray(e)){let f=e.length;for(let u=0;u<f;u++){let c=e[u],m=ts(c),p=m._outputName||m._colName;if(!p)throw new v("Expressions passed to struct.with_fields must have a name/alias.");a.push({name:p,expr:m})}}else if(e&&typeof e=="object"){let f=Object.keys(e),u=f.length;for(let c=0;c<u;c++){let m=f[c],p=ts(e[m]);a.push({name:m,expr:p})}}let i=a.length,l=new Array(i);for(let f=0;f<i;f++)l[f]=a[f].expr.evaluate(r,o);for(let f=0;f<o;f++){let u=t[f];if(u==null||typeof u!="object"){s[f]=null;continue}let c={},m=Object.keys(u),p=m.length;for(let h=0;h<p;h++){let y=m[h];c[y]=u[y]}for(let h=0;h<i;h++)c[a[h].name]=l[h][f];s[f]=c}return s})}unnest(){let e=w(this.expr);return e.isUnnest=!0,e.baseExpr=this.expr,e}},Ht=class extends ${get struct(){return new nr(this)}}});var Xt,rs=k(()=>{"use strict";ae();q();Y();Xt=class extends ${fill_null({value:e=void 0,strategy:t=void 0,limit:r=void 0}={}){return w(this,(o,s)=>{let a=o.length,i=Array.from(o);if(t!==void 0)if(t==="zero"||t==="one"||t==="min"||t==="max"||t==="mean"){let l;t==="zero"?l=0:t==="one"?l=1:l=P(o)[t],ke(i,l,{mode:"constant",condition:f=>f==null})}else if(t==="forward"||t==="backward"){let l=t==="forward",f=null,u=0;ke(i,null,{mode:"independent",reverse:!l,step:({originalValue:c})=>c!=null?(f=c,u=0,c):f!==null&&(r===void 0||u<r)?(u++,f):null})}else throw new v(`Unsupported fill_null strategy: "${t}"`);else{let l=this._resolve(e,s,a),f=E(l);ke(i,null,{mode:"independent",step:({index:u,originalValue:c})=>c??(f?l[u]:l)})}return i})}reverse(){return w(this,e=>e.slice().reverse())}}});var ns={};hr(ns,{ColumnExpr:()=>R,resolveColumnSelectors:()=>Ve});function gi(n,e){for(let t of e)for(let r of Object.getOwnPropertyNames(t.prototype))r!=="constructor"&&Object.defineProperty(n.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r)||Object.create(null))}function _i(n,e,t,r){if(!(n instanceof R)){if(K(n)&&"evaluate"in n&&!n._colName){let o=[];for(let s=0;s<e.length;s++)t.has(e[s])||o.push(e[s]);return o}return null}if(n._colNames&&n._colNames.length>0)return n._colNames;if(n._colName==="*"){let o=new Set(n._excludedCols),s=[];for(let a=0;a<e.length;a++){let i=e[a];!o.has(i)&&!t.has(i)&&s.push(i)}return s}if(n._targetType||n._targetTypes&&n._targetTypes.length>0){if(!r)throw new Fe("Cannot resolve DataType column selector without DataFrame schema.");let o=[];for(let s=0;s<e.length;s++){let a=e[s];if(t.has(a))continue;let i=r[a];if(i){if(n._targetType)i.matches(n._targetType)&&o.push(a);else if(n._targetTypes){for(let l=0;l<n._targetTypes.length;l++)if(i.matches(n._targetTypes[l])){o.push(a);break}}}}return o}return null}function Ve(n,e,t,r,o){let s=[],a=t?new Set(t):new Set;for(let i=0;i<n.length;i++){let l=n[i];if(typeof l=="string"){s.push(new R(l));continue}if(K(l)&&l.isUnnest){let u=[],c=l._colName;if(typeof c=="string"&&r&&r[c]&&r[c].name==="Struct"&&(u=Object.keys(r[c].fields)),u.length===0&&o){let h=Object.keys(o)[0],y=h?o[h].length:0,d=l.baseExpr.evaluate(o,y),g=d.length;for(let _=0;_<g;_++){let T=d[_];if(T!=null&&typeof T=="object"){u=Object.keys(T);break}}}let m=u.length;if(m>0){for(let p=0;p<m;p++){let h=u[p],y=l.baseExpr.struct.field(h);s.push(y)}continue}}let f=_i(l,e,a,r);if(f!==null)for(let u=0;u<f.length;u++){let c=new R(f[u]);c._ops=[...l._ops||[]],c._aggFn=l._aggFn,c._partitionOpsIndex=l._partitionOpsIndex,c._groupingOpsIndex=l._groupingOpsIndex,c._partitionBy=l._partitionBy,l._evaluateWindow&&(c._evaluateWindow=l._evaluateWindow),l._outputName&&l._outputName!=="*"&&(c._outputName=l._outputName),s.push(c)}else s.push(l)}return s}var R,ue=k(()=>{"use strict";ae();Wn();Jn();Xn();Qn();Hn();Gn();or();tr();rr();rs();q();De();Y();R=class n extends ${_colName="";_colNames;_excludedCols=[];_targetType;_targetTypes;static isColExpr(e){if(!K(e))return!1;try{return"evaluate"in e&&typeof e.evaluate=="function"}catch{return!1}}static toColExpr(e){return Pt(e,"Column reference cannot be null or undefined."),n.isColExpr(e)?e:new n(e)}constructor(e){super(),Array.isArray(e)?e.some(r=>r instanceof ne||typeof r=="function")?this._targetTypes=e:this._colNames=e.map(String):e instanceof ne||typeof e=="function"?this._targetType=e:(this._colName=String(e),this._outputName=this._colName)}};gi(R,[$t,Kt,Wt,Gt,zt,qt,Zt,Jt,Ht,Xt])});function Ge(n,e={strict:!0}){let t=e,r=new R(dr);return r._literalValue=n,t.name&&(r._outputName=t.name),r._ops.push(o=>{let s=o.length,a=(x,S)=>x===void 0?S:pe(x<0?s+x:x,{min:0,max:s}),i=a(t.startIndex,0),l=a(t.endIndex,s),f=Math.max(0,l-i),u=t.n!==void 0?t.n:f,c=t.strict!==!1;if(c){if(u!==s)throw new te(`Column height mismatch: seq_range length ${u} does not match DataFrame height ${s}`)}else{let x=t.pad??!1,S=t.truncate??!1;if(x&&!S&&u>f)throw new te(`Cannot pad seq_range output: specified length ${u} starting at index ${i} exceeds slice width ${f} (requires truncation).`);if(S&&!x&&u<f)throw new te(`Cannot truncate seq_range output: specified length ${u} starting at index ${i} is less than slice width ${f} (requires padding).`)}let m=s,p=!!t.dtype,h=t.mode||"cumulative",y=t.step!==void 0?t.step:1,d=p?x=>t.dtype.coerce(x):x=>x;if(c){let x=t.dtype?.allocate?t.dtype.allocate(m):new Array(m);return ke(x,n,{mode:h,step:y,coerce:d,startIndex:0,endIndex:m}),x}let g=Math.min(i+u,l),_=t.padValue!==void 0?t.padValue:null,T=d(_);if(h==="constant"&&i===0&&g===m&&!t.dtype){let x=new Array(m);for(let S=0;S<m;S++)x[S]=n;return x}let A=new Array(m);return A.fill(T),ke(A,n,{mode:h,step:y,coerce:d,startIndex:i,endIndex:g}),A}),r}var sr=k(()=>{"use strict";ue();be();Y();q()});function Je(n,e){let t=Ge(n,{strict:!0,mode:"constant",dtype:e?.dtype,name:e?.name});return t._isLiteral=!0,t}var Qt=k(()=>{"use strict";sr()});var os={};hr(os,{duration:()=>ir});function ir(n={}){let e=n.timeUnit??"ms",t=[],r=[[n.weeks,6048e5],[n.days,864e5],[n.hours,36e5],[n.minutes,6e4],[n.seconds,1e3],[n.milliseconds,1],[n.microseconds,.001],[n.nanoseconds,1e-6]];for(let[s,a]of r)if(s!=null){let i=F(s)?Je(s):R.toColExpr(s);t.push({expr:i,multiplier:a})}if(t.length===0)throw new v("At least one duration component must be specified for $df.duration().");let o=new R(br);return o._castType=new lt(e),o._ops.push((s,a)=>{let i=s?s.length:0;if(i===0&&a){let c=Object.keys(a)[0];c&&E(a[c])&&(i=a[c].length)}i===0&&(i=1);let l=new Float64Array(i),f=new Uint8Array(i);for(let c=0;c<t.length;c++){let{expr:m,multiplier:p}=t[c],h=_e(m,a,i);if(E(h)){let y=h,d=y.length;for(let g=0;g<i;g++){if(f[g]===1)continue;let _=M(g<d?y[g]:d===1?y[0]:null);_!=null?l[g]+=_*p:(f[g]=1,l[g]=0)}}else{let y=M(h);if(y!=null){let d=y*p;for(let g=0;g<i;g++)f[g]!==1&&(l[g]+=d)}else{f.fill(1),l.fill(0);break}}}let u=new Array(i);for(let c=0;c<i;c++)if(f[c]===1)u[c]=null;else{let m=Math.round(l[c]*1e6)/1e6;u[c]=$o(m,e)}return u}),o.alias("duration")}var ar=k(()=>{"use strict";ue();Qt();be();fe();ct();Y();q()});var lr,Zt,or=k(()=>{"use strict";ct();Y();ae();fe();q();lr=class{constructor(e){this.expr=e}expr;_colTz(){let e=this.expr._castType;return e instanceof ge?e.timeZone:null}_colTu(){let e=this.expr._castType;return e instanceof ge?e.timeUnit:null}_deriveDate(e){return w(this.expr,I(t=>{let r=H(t);return r?e(r):null}))}cast_time_unit(e){return this.expr.cast(new ge(e,this._colTz()))}century(){return this._deriveDate(fo)}convert_time_zone(e){let t=this._colTz();if(this.expr._castType instanceof ge&&t===null)throw new v('convert_time_zone() requires a timezone-aware Datetime column. Use .dt.replace({ timeZone: "..." }) to assign a timezone first.');return this.expr.cast(new ge(this._colTu()??"ms",e))}date(){return this._deriveDate(e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())))}day(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>re(r,t).day)}days_in_month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>{let o=re(r,t),s=Et(ee(o.year,o.month-1,1),1,0);return s?s.getUTCDate():null})}epoch(e="ms"){return this._deriveDate(t=>co(t,e))}hour(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>re(r,t).hour)}is_business_day(e={}){return this._deriveDate(t=>_o(t,e))}is_leap_year(){return this._deriveDate(_n)}iso_week(){return this._deriveDate(e=>dn(e,{field:"week"}))}iso_year(){return this._deriveDate(e=>dn(e,{field:"year"}))}microsecond(){return this.millisecond().mul(1e3)}millennium(){return this._deriveDate(mo)}millisecond(){return this._deriveDate(e=>e.getUTCMilliseconds())}minute(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>re(r,t).minute)}month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>re(r,t).month)}month_end(){return this._deriveDate(e=>Et(e,1,0))}month_start(){return this._deriveDate(e=>Et(e,0,1))}nanosecond(){return this.millisecond().mul(1e6)}offset_day(e,t={}){let o=t?.excludeWeekdays?.length||t?.holidays||t?.roll?w(this.expr,L(this.expr,e,(a,i)=>{let l=H(a);return l?go(l,i,t):null})):e,{duration:s}=(ar(),yr(os));return this.expr.add(s({days:o}))}ordinal_day(){return this._deriveDate(gn)}quarter(){return this._deriveDate(po)}replace(e){return w(this.expr,I(t=>{let r=H(t);return r?bo(r,e):null}))}second(){return this._deriveDate(e=>e.getUTCSeconds())}strftime(e){let t=this._colTz(),r=t&&!e.timeZone?{...e,timeZone:t}:e;return this._deriveDate(o=>Ne(o,r))}time(){return this._deriveDate(e=>e.toISOString().split("T")[1].slice(0,12))}timestamp(e="ms"){return this.epoch(e)}total_days(){return this.expr.div(864e5)}total_hours(){return this.expr.div(36e5)}total_microseconds(){return this.expr.mul(1e3)}total_milliseconds(){return this.expr}total_minutes(){return this.expr.div(6e4)}total_nanoseconds(){return this.expr.mul(1e6)}total_seconds(){return this.expr.div(1e3)}utc_offset(e,t={}){return w(this.expr,I(r=>{let o=H(r);return o?xn(o,e,t):null}))}week(){return this.iso_week()}weekday(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>re(r,t).dayOfWeek||7)}year(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>re(r,t).year)}},Zt=class extends ${get dt(){return new lr(this)}}});function mt(){return new R("*")}var ss=k(()=>{"use strict";ue()});function is(n){let e=new R("*");return e._excludedCols=Array.isArray(n)?n:[n],e}var as=k(()=>{"use strict";ue()});function ls(...n){let e=n.length===1&&Array.isArray(n[0])?n[0]:n,t=new R(gr);return t._ops.push((r,o)=>{let s=r.length,a=u=>R.isColExpr(u)?u.evaluate(o,s):typeof u=="string"?o[u]||new Array(s).fill(null):u,i=e.length,l=new Array(i);for(let u=0;u<i;u++)l[u]=a(e[u]);let f=new Array(s);for(let u=0;u<s;u++){let c=null;for(let m=0;m<i;m++){let p=l[m],h=E(p)?p[u]:p;if(h!=null){c=h;break}}f[u]=c}return f}),t}var us=k(()=>{"use strict";ue();q();be()});function cs(n){return new cr(n)}var ur,cr,en,fs=k(()=>{"use strict";ue();q();ur=class{_predicates;_values;constructor(e,t){this._predicates=e,this._values=t}then(e){return new en(this._predicates,this._values.concat(e))}},cr=class{_predicates;constructor(e){this._predicates=[e]}then(e){return new en(this._predicates,[e])}},en=class n extends R{_predicates;_values;_otherwiseValue;constructor(e,t,r=null){super(typeof e=="string"?e:"*when*"),this._predicates=Array.isArray(e)?e:[],this._values=t||[],this._otherwiseValue=r,this._ops.push((o,s)=>{let a=o.length,i=p=>R.isColExpr(p)?p.evaluate(s,a):typeof p=="string"&&p in s?s[p]:p,l=this._predicates.length,f=new Array(l),u=new Array(l);for(let p=0;p<l;p++)f[p]=i(this._predicates[p]),u[p]=i(this._values[p]);let c=i(this._otherwiseValue),m=new Array(a);for(let p=0;p<a;p++){let h=!1;for(let y=0;y<l;y++)if((E(f[y])?f[y][p]:f[y])===!0){m[p]=E(u[y])?u[y][p]:u[y],h=!0;break}h||(m[p]=E(c)?c[p]:c)}return m})}when(e){return new ur(this._predicates.concat(e),this._values)}otherwise(e){return new n(this._predicates,this._values,e)}}});function ms(n){return R.toColExpr(n).implode()}var ps=k(()=>{"use strict";ue()});function hs(){return new R(Ye)}var ys=k(()=>{"use strict";ue();be()});function ds(n,...e){let t;Array.isArray(n)||n&&typeof n=="object"&&!R.isColExpr(n)?t=n:t=[n,...e];let r=Je({}).struct.with_fields(t);return delete r._isLiteral,delete r._literalValue,r._colName=_r,r.alias("struct")}var gs=k(()=>{"use strict";ue();Qt();be()});var pt=k(()=>{"use strict";be();xr();ae();Wn();Gn();Jn();Hn();Xn();Qn();or();tr();rr();ue();Qt();ss();as();us();fs();ps();sr();ys();gs();ar();fe()});var tn,_s=k(()=>{"use strict";We();Bt();pt();tn=class{_groups;_keys;_allKeys;_parentColumns;_parentHeight;_parentSchema;constructor(e,t,r,o,s,a){this._groups=e,this._keys=t,this._allKeys=r,this._parentColumns=o,this._parentHeight=s,this._parentSchema=a}to_dataframe(){let e=this._keys.length,t=new Array(e);for(let i=0;i<e;i++)t[i]=String(this._keys[i]);let r=this._groups.size,o={};for(let i=0;i<t.length;i++)o[t[i]]=new Array(r);let s=0;for(let i of this._groups.values()){if(i.length===0)continue;let l=i[0];for(let f=0;f<t.length;f++){let u=t[f],c=this._parentColumns[u][l];o[u][s]=c===void 0?null:c}s++}let a={};for(let i of t)a[i]=this._parentSchema[i];return V._createDirect(o,a,s)}agg(...e){let t=this._allKeys.length,r=new Array(t);for(let c=0;c<t;c++)r[c]=String(this._allKeys[c]);let o=this._keys.length,s=new Array(o);for(let c=0;c<o;c++)s[c]=String(this._keys[c]);let a=Ve(e.flat(),r,s,this._parentSchema,this._parentColumns),i=this._groups.size,l={};for(let c=0;c<s.length;c++)l[s[c]]=new Array(i);let f=0;for(let c of this._groups.values()){if(c.length===0)continue;let m=c[0];for(let p=0;p<s.length;p++){let h=s[p],y=this._parentColumns[h][m];l[h][f]=y===void 0?null:y}f++}for(let c=0;c<a.length;c++){let m=a[c],p=m._outputName||m._colName||"*";if(!m._aggFn)l[p]=m.evaluate(l,i);else{let h=m._evaluatePre(m._groupingOpsIndex,this._parentColumns,this._parentHeight),y=new Array(i),d=0;for(let g of this._groups.values()){if(g.length===0)continue;let _=new Array(g.length);for(let T=0;T<g.length;T++)_[T]=h[g[T]];y[d]=m._aggFn(_),d++}l[p]=m._evaluatePost(m._groupingOpsIndex,y,l)}}let u={};for(let c of s)u[c]=this._parentSchema[c];for(let c of a){let m=c._outputName||c._colName||"*";u[m]=Ie(l[m])}return V._createDirect(l,u,f)}}});function wi(n,e,t){if(n==null)throw new z(`Invalid input to ${e} at index ${t}: item cannot be null or undefined.`);if(n instanceof V)return[n];if(Ee(n))return[new V(n)];if(E(n)){if(Q(n,V,{mode:"every"}))return n;if(Q(n,"plainObject",{mode:"every"}))return[new V(n)];let r=Q(n,V,{mode:"some"});for(let o=0;o<n.length;o++)if(r?!(n[o]instanceof V):!Ee(n[o]))throw new z(r?`Invalid input to ${e} at index ${t}, sub-index ${o}: nested array must contain only DataFrame instances.`:`Invalid input to ${e} at index ${t}, row ${o}: rows must be plain objects.`)}throw new z(`Invalid input to ${e} at index ${t}: expected DataFrame, row array, or column dictionary.`)}function ht(n,{how:e="vertical",horizontal:t}={}){if(n==null)throw new z("Invalid input to concat: rawItems cannot be null or undefined.");let r=Array.isArray(n)?n:[n],o=[];for(let a=0;a<r.length;a++)o.push(...wi(r[a],"concat",a));let s=t?.strict??!0;if(o.length===0)return V._createDirect({},{},0);if(o.length===1&&e!=="horizontal")return o[0];switch(e){case"vertical":{let a=[];for(let h=0;h<o.length;h++)o[h].height>0&&a.push(o[h]);if(a.length===0)return V._createDirect({},{},0);let i=a[0],l=Object.keys(i._columns);for(let h=0;h<o.length;h++){let y=o[h];if(y.height===0)continue;let d=Object.keys(y._columns);if(l.length!==d.length)throw new z(`[Strict Vertical] Column count mismatch at index ${h}.`);for(let g=0;g<l.length;g++){if(l[g]!==d[g])throw new z(`[Strict Vertical] Schema mismatch at position ${g} in DF ${h}. Expected column "${l[g]}", but found "${d[g]}".`);let _=i.schema[l[g]],T=y.schema[l[g]];if(_&&T&&!_.equals(T))throw new Fe(`[Strict Type Check] Schema type mismatch for column "${l[g]}": expected ${_.name}, found ${T.name}.`)}}let f=0;for(let h of o)f+=h.height;let u={},c=o.length;for(let h=0;h<c;h++)if(o[h].height>0){u=o[h].schema;break}Object.keys(u).length===0&&c>0&&(u=o[0].schema);let m={};for(let h of l){let y=u[h],d=!1;for(let _ of o){let T=_._columns[h];if(!T){d=!0;break}if(!B(T)){for(let A=0;A<T.length;A++)if(T[A]==null){d=!0;break}}if(d)break}let g=y&&y.allocate?y.allocate(f):new Array(f).fill(null);d&&B(g)&&(g=new Array(f).fill(null)),m[h]=g}let p=0;for(let h of o){let y=h.height;if(y!==0){for(let d of l){let g=h._columns[d]||new Array(y).fill(null),_=m[d];if(B(_)&&B(g))_.set(g,p);else{let T=_;for(let A=0;A<y;A++)T[p+A]=g[A]}}p+=y}}return V._createDirect(m,u,f)}case"horizontal":{let a=o[0].height;for(let u=1;u<o.length;u++)o[u].height>a&&(a=o[u].height);let i=new Set;for(let u=0;u<o.length;u++){let c=o[u];if(s&&c.height!==a)throw new te(`[Horizontal] Row count mismatch at index ${u}. Expected ${a}, got ${c.height}. Set strict=false to allow padding.`);for(let m of Object.keys(c._columns)){if(i.has(m))throw new z(`[Horizontal] Duplicate column name "${m}" detected. Horizontal concat requires unique names.`);i.add(m)}}let l={},f={};for(let u of o){let c=u.height;Object.assign(f,u.schema);let m=Object.keys(u._columns),p=m.length;for(let h=0;h<p;h++){let y=m[h],d=u._columns[y];if(c===a)l[y]=B(d)?Array.from(d):d;else{let g=new Array(a);for(let _=0;_<c;_++)g[_]=d[_];for(let _=c;_<a;_++)g[_]=null;l[y]=g}}}return V._createDirect(l,f,a)}case"diagonal":{let a=new Set;for(let m of o)for(let p of Object.keys(m._columns))a.add(p);let i=Array.from(a),l=0;for(let m=0;m<o.length;m++)l+=o[m].height;let f={};for(let m of i){let p=null;for(let h of o){let y=h.schema[m];if(y){if(p===null)p=y;else if(!p.equals(y))throw new Fe(`[Strict Type Check] Schema type mismatch for column "${m}": expected ${p.name}, found ${y.name}.`)}}f[m]=p||j.Utf8}let u={};for(let m=0;m<i.length;m++)u[i[m]]=new Array(l).fill(null);let c=0;for(let m=0;m<o.length;m++){let p=o[m],h=p.height;if(h!==0){for(let y=0;y<i.length;y++){let d=i[y],g=u[d],_=p._columns[d];if(_!==void 0)if(B(_)&&B(g))g.set(_,c);else{let T=g;for(let A=0;A<h;A++)T[c+A]=_[A]}else{let T=g;for(let A=0;A<h;A++)T[c+A]=null}}c+=h}}return V._createDirect(u,f,l)}}}var fr=k(()=>{"use strict";We();De();q();Y()});var V,We=k(()=>{"use strict";pt();_s();kt();De();q();Y();fr();Bt();V=class n{_columns;_height;_schema={};static _createDirect(e,t,r){qn(e,r);let o=Object.create(n.prototype);return o._columns=e,o._schema=t,o._height=r,o}constructor(e,t,r){if(Array.isArray(e)){let{columns:o,height:s}=Wo(e);this._columns=o,this._height=s,t?this._applySchema(t):this._inferSchema();return}if(K(e)){this._columns=e,this._height=qn(e,r),t?this._applySchema(t):this._inferSchema();return}this._columns={},this._height=0,t?this._applySchema(t):this._schema={}}_inferSchema(){let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let s=t[o];e[s]=Ie(this._columns[s])}this._applySchema(e)}_applySchema(e){this._schema=e;let t=Object.keys(e),r={};for(let o of t){let s=e[o],a=this._columns[o];r[o]=a?je(a,s,this._height):je(new Array(this._height).fill(null),s,this._height)}this._columns=r}get columns(){return Object.keys(this._columns)}concat(e,t={}){let r=Q(e,n,{mode:"every",allowEmpty:!1})?e:[e];return ht([this,...r],t)}drop(...e){let t=new Set(e.flat()),r={},o={};for(let s of Object.keys(this._columns))t.has(s)||(r[s]=this._columns[s],o[s]=this._schema[s]);return n._createDirect(r,o,this._height)}drop_nulls(e){return this._height===0?this:this.filter(e?new R(e).is_not_null():mt().is_not_null())}get dtypes(){let e=Object.keys(this._columns),t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=this._schema[e[o]];return r}explode(e,t){let r=R.toColExpr(e),o=r._colNames||[r._colName||r._outputName],s=new Set,a=o.length;for(let u=0;u<a;u++){let c=o[u];if(!c)throw new z("Expression passed to explode must have a column name.");X(c,this._columns,"Explode column"),s.add(c)}let i=Object.keys(this._columns),l=[],f=i.length;for(let u=0;u<f;u++){let c=i[u];l.push(s.has(c)?new R(c).arr.explode(t):new R(c))}return this.select(...l)}fill_null(e={}){return this._height===0?this:this.with_columns(mt().fill_null(e))}filter(...e){if(this._height===0)return n._createDirect({},this._schema,0);let t=this._height,r=Object.keys(this._columns),o=r.length,s=[],a=[],i=[],l=e.length;for(let d=0;d<l;d++){let g=e[d];typeof g=="function"?a.push(g):i.push(g)}let f=Ve(i,r,void 0,this._schema,this._columns),u=f.length;for(let d=0;d<u;d++)s.push(f[d].evaluate(this._columns,t));let c=[],m=0,p=null;if(a.length>0){let d=this._columns;p={};for(let g=0;g<o;g++){let _=r[g],T=d[_];Object.defineProperty(p,_,{get(){let A=T[m];return A===void 0?null:A},enumerable:!0,configurable:!0})}}for(let d=0;d<t;d++){let g=!0;for(let _=0;_<s.length;_++)if(!s[_][d]){g=!1;break}if(g){if(p){m=d;for(let _=0;_<a.length;_++)if(!a[_](p)){g=!1;break}}g&&c.push(d)}}let h=ft(this._columns,c),y=c.length;return n._createDirect(h,this._schema,y)}get_schema(){return this._schema}groupby(e){let t=Qe(e),r=new Map,o=this._height,s=we(e);for(let i=0;i<s.length;i++)X(s[i],this._columns,"Grouping key");for(let i=0;i<o;i++){let l=Oe(this._columns,s,i),f=r.get(l);f===void 0&&r.set(l,f=[]),f.push(i)}let a=Object.keys(this._columns);return new tn(r,t,a,this._columns,this._height,this._schema)}head(e=10){return this.limit(e,{offset:0,from:"start"})}clone(){let e={};for(let t of Object.keys(this._columns)){let r=this._columns[t];Array.isArray(r)||B(r)?e[t]=r.slice():e[t]=Array.prototype.slice.call(r)}return n._createDirect(e,{...this._schema},this._height)}get height(){return this._height}hstack(e,t={}){return this.concat(e,{how:"horizontal",horizontal:t})}insert_column(e,t,r){let o=R.toColExpr(r).alias(t),s=Object.keys(this._columns),a=s.length,i=[];for(let f=0;f<a;f++){let u=s[f];u!==t&&i.push(u)}let l=Math.max(0,Math.min(e,i.length));return i.splice(l,0,o),this.select(...i)}item(e,t){let r=this._height,o=Object.keys(this._columns),s=o.length;if(e===void 0&&t===void 0){if(r!==1||s!==1)throw new z("DataFrame.item() can only be called without arguments if the shape is (1, 1).");return this._columns[o[0]][0]}if(e===void 0||t===void 0)throw new z("DataFrame.item() requires both row and column to be specified if not empty.");if(e<0||e>=r)throw new te(`Row index ${e} is out of bounds for DataFrame height ${r}.`);let a;if(typeof t=="number"){if(t<0||t>=s)throw new te(`Column index ${t} is out of bounds for DataFrame width ${s}.`);a=o[t]}else if(a=t,this._columns[a]===void 0)throw new Te(a);return this._columns[a][e]}*iter_columns(){let e=Object.keys(this._columns),t=e.length,r=this._columns;for(let o=0;o<t;o++)yield r[e[o]]}*iter_rows({named:e=!1}={}){let t=Object.keys(this._columns),r=t.length,o=this._columns,s=this._height,a=new Array(r);for(let i=0;i<r;i++)a[i]=o[t[i]];if(e)for(let i=0;i<s;i++){let l={};for(let f=0;f<r;f++)l[t[f]]=a[f][i];yield l}else for(let i=0;i<s;i++){let l=new Array(r);for(let f=0;f<r;f++)l[f]=a[f][i];yield l}}join(e){let{other:t,on:r,leftOn:o,rightOn:s,how:a="inner",suffixes:i=["","_right"],join_nulls:l=!1,coalesce:f=!0,maintain_order:u="none"}=e;if(a==="cross"&&(r!==void 0||o!==void 0||s!==void 0))throw new v('Cannot specify "on", "leftOn", or "rightOn" when how is "cross". Cross joins produce a keyless Cartesian product.');if(r!==void 0&&(o!==void 0||s!==void 0))throw new v('Cannot specify both "on" and "leftOn"/"rightOn" in join(). Use either "on" or both "leftOn" and "rightOn".');if(o!==void 0&&s===void 0||o===void 0&&s!==void 0)throw new v('join() requires both "leftOn" and "rightOn" when specifying heterogeneous join keys.');if(a!=="cross"&&r===void 0&&o===void 0&&s===void 0)throw new v('join() requires either "on" or both "leftOn" and "rightOn" parameters.');let c=[],m=[];if(o!==void 0&&s!==void 0){if(c=we(o),m=we(s),c.length===0||m.length===0)throw new v('join() requires non-empty key arrays in "leftOn" and "rightOn".');if(c.length!==m.length)throw new v(`join() "leftOn" length (${c.length}) must match "rightOn" length (${m.length}).`)}else if(r!==void 0&&(c=we(r),m=c,c.length===0))throw new v('join() requires at least one key column in "on".');for(let g=0;g<c.length;g++)X(c[g],this._columns,"Join key"," in the left DataFrame."),X(m[g],t._columns,"Join key"," in the right DataFrame.");let h={...e,how:a,suffixes:i,join_nulls:l,coalesce:f,maintain_order:typeof u=="boolean"?u?"left":"none":u??"none"},{leftIndices:y,rightIndices:d}=Yo(this._columns,t._columns,this._height,t._height,c,m,h);return zn(this._columns,t._columns,this._schema,t._schema,y,d,c,m,{suffixes:i,coalesce:f,how:a})}join_asof(e){let{other:t,on:r,leftOn:o,rightOn:s,by:a,leftBy:i,rightBy:l,strategy:f="backward",tolerance:u,allow_exact_matches:c=!0,suffixes:m=["","_right"],coalesce:p=!0,check_sorted:h=!0}=e;if(!t||!(t instanceof n))throw new v("join_asof() requires a valid right DataFrame in the 'other' parameter.");let y=String(o??r??""),d=String(s??r??"");if(!y||!d)throw new v('join_asof() requires join key specified via "on", or "leftOn" and "rightOn".');let g=C=>C?Array.isArray(C)?C.map(String):[String(C)]:[],_=g(i??a),T=g(l??a);if(_.length!==T.length)throw new v('join_asof() "by" (or "leftBy" / "rightBy") key lists must have equal lengths.');for(let C=0;C<_.length;C++)X(_[C],this._columns,"Partition key"," in the left DataFrame."),X(T[C],t._columns,"Partition key"," in the right DataFrame.");let A={...e,strategy:f,tolerance:u,allow_exact_matches:c,suffixes:m,coalesce:p,check_sorted:h},{leftIndices:x,rightIndices:S}=Ho(this._columns,t._columns,this._height,t._height,y,d,_,T,A),b=[y,..._],D=[d,...T];return zn(this._columns,t._columns,this._schema,t._schema,x,S,b,D,{suffixes:m,coalesce:p,how:"left"})}limit(e,{offset:t=0,from:r="start"}={}){let o=this._height,s=pe(Math.floor(e),{min:0,max:o}),a=pe(Math.floor(t),{min:0,max:o}),i=a,l=Math.min(a+s,o);r==="end"&&(l=o-a,i=Math.max(l-s,0));let f=l-i,u={},c=Object.keys(this._columns),m=c.length;for(let p=0;p<m;p++){let h=c[p];u[h]=this._columns[h].slice(i,l)}return n._createDirect(u,this._schema,f)}pivot(e){if(this._height===0)return n._createDirect({},{},0);let{index:t,columns:r,values:o}=e,s=we(t),a=s.length;for(let x=0;x<a;x++)X(s[x],this._columns,"Pivot index key");let i=String(r),l=String(o);X(i,this._columns,"Pivot column key"),X(l,this._columns,"Pivot values key");let f=new Map,u=[],c=new Set,m=this._height,p=this._columns[i],h=this._columns[l];for(let x=0;x<m;x++){let S=Oe(this._columns,s,x);c.add(String(p[x])),f.get(S)===void 0&&(f.set(S,f.size),u.push(x))}let y=f.size,d={},g={};for(let x=0;x<a;x++){let S=s[x];d[S]=this._columns[S],this._schema[S]&&(g[S]=this._schema[S])}let _=ft(d,u),T=Array.from(c),A=this._schema[l]||j.Utf8;for(let x=0;x<T.length;x++){let S=T[x];_[S]=new Array(y).fill(null),g[S]=A}for(let x=0;x<m;x++){let S=Oe(this._columns,s,x),b=f.get(S),D=String(p[x]);_[D][b]=h[x]}return n._createDirect(_,g,y)}rename(e){let t=e||{},r={},o={},s=Object.keys(this._columns);for(let i of s){let l=t[i]||i;r[l]=this._columns[i],o[l]=this._schema[i]}if(Object.keys(r).length<s.length)throw new z("Rename collision: Multiple columns mapped to the same output name.");return n._createDirect(r,o,this._height)}reverse(){if(this._height===0)return this;let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let s=t[o];e[s]=this._columns[s].slice().reverse()}return n._createDirect(e,this._schema,this._height)}get schema(){return this._schema}select(...e){let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=Ve(t,r,void 0,this._schema,this._columns),s=o.length;if(s===0)return n._createDirect({},{},this._height);let a={},i={},l=new Array(s),f=new Array(s),u=new Set,c=null;for(let h=0;h<s;h++){let y=o[h],d=y._outputName||y._colName||"*";if(u.has(d))throw new z(`Duplicate column selection: "${d}" is selected multiple times.`);u.add(d);let g=_e(y,this._columns,this._height);l[h]=g,f[h]=d;let _=g&&g.rowMap;if(_)if(c){let T=_.length;if(T!==c.length)throw new te(`Mismatched explode heights: Column "${d}" has length ${T}, but another exploded column has length ${c.length}`);for(let A=0;A<T;A++)if(_[A]!==c[A])throw new te(`Mismatched explode heights: Column "${d}" has mismatched row lengths compared to another exploded column.`)}else c=_}let m=c?c.length:this._height,p=s>0;for(let h=0;h<s;h++){let y=o[h],d=y._aggFn!=null&&(y._partitionBy==null||y._partitionBy.length===0),g=!!y._isLiteral;if(!d&&!g){p=!1;break}}for(let h=0;h<s;h++){let y=f[h],d=l[h],g=d,_=g&&g.rowMap,T=E(d)?d.length:0,A=c&&!_?this._height:m;if(T!==A)throw new te(`Column height mismatch: Column "${y}" has length ${T}, but expected ${A}`);if(c&&!_){let x=c.length;if(B(d)){let S=new g.constructor(x);for(let b=0;b<x;b++)S[b]=g[c[b]];d=S}else{let S=new Array(x);for(let b=0;b<x;b++)S[b]=g[c[b]];d=S}}l[h]=d}p&&(m=1);for(let h=0;h<s;h++){let y=o[h],d=f[h],g=l[h],_=y._colName||d,T=y instanceof R&&y._ops.length===0&&!y._isWindow&&!y._aggFn,x=y._castType||T&&this._schema[_]||Ie(g);i[d]=x,a[d]=je(g,x,m)}return n._createDirect(a,i,m)}get shape(){return[this.height,this.width]}slice(e,t){let r=this._height,o=e<0?Math.max(r+e,0):Math.min(e,r),s=t===void 0?r:t<0?Math.max(r+t,0):Math.min(t,r),a=Math.max(s-o,0);return this.limit(a,{offset:o})}sort(e){if(!e||!e.by||this._height===0)return this;let{by:t,descending:r=!1,nullsLast:o=!0,custom:s}=e,a=Qe(t);for(let h=0;h<a.length;h++){let y=R.toColExpr(a[h]);y._colName&&X(y._colName,this._columns,"Sort key")}let i=Array.isArray(r)?r:new Array(a.length).fill(r),l=a.length,f=new Array(l);for(let h=0;h<l;h++){let y=a[h],d=i[h]?-1:1,g=s&&typeof y=="string"?s[y]:null,_=R.toColExpr(y).evaluate(this._columns,this._height);f[h]={values:_,isDesc:d,customComp:g}}let u=f.length,c=o?1:-1,m=new Array(this._height);for(let h=0;h<this._height;h++)m[h]=h;m.sort((h,y)=>{for(let d=0;d<u;d++){let{values:g,isDesc:_,customComp:T}=f[d],A=g[h],x=g[y];if(T){let b=T(A,x);if(b!==0)return b*_;continue}if(A==null||x==null){if(A===x)continue;return(A==null?1:-1)*c}if(A===x)continue;return(A<x?-1:1)*_}return 0});let p=ft(this._columns,m);return n._createDirect(p,this._schema,this._height)}tail(e=10){return this.limit(e,{offset:0,from:"end"})}to_dict(){return{...this._columns}}to_dicts(){return Go(this._columns,this._height)}to_array(e){if(this._height===0)return[];if(e==null)return new Array(this._height).fill(null);let r=R.toColExpr(e).evaluate(this._columns,this._height);return Array.isArray(r)?r:Array.from(r)}transpose({include_header:e=!1,header_name:t="column",column_names:r}={}){if(this._height===0){let u={},c={};return e&&(u[t]=je([],j.Utf8,0),c[t]=j.Utf8),n._createDirect(u,c,0)}let o=this.columns;typeof r=="string"&&(X(r,this._columns,"column_names"),o=o.filter(u=>u!==r));let s=[];if(typeof r=="string"){let u=this._columns[r];s=new Array(this._height);for(let c=0;c<this._height;c++){let m=u[c];if(m==null)throw new z(`Transpose column_names column "${r}" contains null/undefined at index ${c}`);s[c]=String(m)}}else if(r!=null&&typeof r!="string"&&Symbol.iterator in Object(r)){let u=Array.from(r);if(u.length!==this._height)throw new z(`column_names length (${u.length}) must match the height of the DataFrame (${this._height})`);s=new Array(this._height);for(let c=0;c<this._height;c++)s[c]=String(u[c])}else{s=new Array(this._height);for(let u=0;u<this._height;u++)s[u]=`column_${u}`}let a=new Set;e&&a.add(t);for(let u=0;u<s.length;u++){let c=s[u];if(a.has(c))throw new z(`Duplicate column name in transposed DataFrame: "${c}"`);a.add(c)}let i=o.length,l={},f={};e&&(l[t]=je(o,j.Utf8,i),f[t]=j.Utf8);for(let u=0;u<this._height;u++){let c=s[u],m=new Array(i);for(let h=0;h<i;h++)m[h]=this._columns[o[h]][u];let p=Ie(m);l[c]=je(m,p,i),f[c]=p}return n._createDirect(l,f,i)}unique(e){if(this._height===0)return n._createDirect({},this._schema,0);let t=Qe(e),r=t.length===0?Object.keys(this._columns):t.map(String);for(let f of r)X(f,this._columns,"Unique column key");let o=new Set,s=[],a=this._height;for(let f=0;f<a;f++){let u=Oe(this._columns,r,f);o.has(u)||(o.add(u),s.push(f))}let i=ft(this._columns,s),l=s.length;return n._createDirect(i,this._schema,l)}unpivot(e){let{idVars:t,valueVars:r,varName:o="variable",valueName:s="value"}=e,a=we(t),i=we(r),l=a.length,f=i.length;for(let h of a)X(h,this._columns,"Unpivot id variable key");for(let h of i)X(h,this._columns,"Unpivot value variable key");let u=this._height*f,c={};for(let h=0;h<l;h++)c[a[h]]=new Array(u);c[o]=new Array(u),c[s]=new Array(u);let m=0;for(let h=0;h<this._height;h++)for(let y=0;y<f;y++){let d=i[y];for(let g=0;g<l;g++){let _=a[g];c[_][m]=this._columns[_][h]}c[o][m]=d,c[s][m]=this._columns[d][h],m++}let p={};for(let h of a)p[h]=this._schema[h];return p[o]=j.Utf8,p[s]=Ie(c[s]),n._createDirect(c,p,u)}vstack(e){return this.concat(e,{how:"vertical"})}get width(){return Object.keys(this._columns).length}_normalizeArgs(e){let t=e.flat(),r=[];for(let o of t)if(typeof o=="string")r.push(new R(o));else if(R.isColExpr(o))r.push(o);else if(K(o)){let s=Object.keys(o),a=s.length;for(let i=0;i<a;i++){let l=s[i],f=o[l];if(R.isColExpr(f))r.push(f.alias(l));else{let u=new R(l);u.evaluate=(c,m)=>new Array(m).fill(f),r.push(u)}}}return r}with_columns(...e){if(e.length===0)return this;let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=Ve(t,r,void 0,this._schema,this._columns),s=o.length;if(s===0)return this;let a=new Map;for(let f=0;f<s;f++){let u=o[f],c=u._outputName||u._colName||"*";a.set(c,u)}let i=[],l=r.length;for(let f=0;f<l;f++){let u=r[f];i.push(a.get(u)||new R(u)),a.delete(u)}for(let f of a.values())i.push(f);return this.select(...i)}with_row_index(e="index",t=0){let r=Ge(t,{mode:"independent",dtype:j.UInt32,step:1}),o=this.insert_column(0,e,r);return o._schema[e]=j.UInt32,o}write_json(e,{format:t="json",replacerOptions:r}={}){if(t!=="json"&&t!=="ndjson")throw new v(`Unsupported JSON format: "${t}". Expected "json" or "ndjson".`);let o=r?.replacer===null?void 0:st(r),s;if(t==="ndjson"){let a=this.to_dicts(),i=a.length,l=new Array(i);for(let f=0;f<i;f++)l[f]=JSON.stringify(a[f],o);s=l.join(`
|
|
6
|
-
`)}else
|
|
1
|
+
var kn=Object.defineProperty;var Ks=Object.getOwnPropertyDescriptor;var qs=Object.getOwnPropertyNames;var zs=Object.prototype.hasOwnProperty;var Ze=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var R=(n,e)=>()=>(n&&(e=n(n=0)),e);var Vr=(n,e)=>{for(var t in e)kn(n,t,{get:e[t],enumerable:!0})},Gs=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of qs(e))!zs.call(n,o)&&o!==t&&kn(n,o,{get:()=>e[o],enumerable:!(r=Ks(e,o))||r.enumerable});return n};var $r=n=>Gs(kn({},"__esModule",{value:!0}),n);var oe,Kr,qr,Qe,zr,Gr,Jr,Ae=R(()=>{"use strict";oe="*",Kr="*literal*",qr="*coalesce*",Qe="*element*",zr="*struct*",Gr="*duration*",Jr="*when*"});var Wr=R(()=>{"use strict"});function F(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function Ne(n){if(!F(n))return!1;try{if(!Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)&&Object.prototype.toString.call(n)!==oa)return!1;let e=Object.getPrototypeOf(n);if(e===null)return!0;if(Object.getPrototypeOf(e)!==null||!Object.prototype.hasOwnProperty.call(e,"isPrototypeOf"))return!1;let t=Object.getOwnPropertyDescriptor(e,"toString");if(!t||typeof t.value!="function")return!1;let r=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof r!="function"?!1:Function.prototype.toString.call(r)===Ta}catch{return!1}}function io(n){if(typeof n!="function")return!1;try{let e=Function.prototype.toString.call(n),t=e.replace(/^(?:\s+|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*)+/,"");if(/^(?:@[\w$.]+(?:\([^)]*\))?\s+)*class\b/.test(t))return!0;let r=Object.getOwnPropertyDescriptor(n,"prototype");if(r&&!r.writable&&e.includes("[native code]")){let o=no.length;for(let i=0;i<o;i++)try{return Reflect.construct(n,no[i],Da),!0}catch{}}}catch{return!1}return!1}function Se(n,e,t,r){if(!F(n))return!1;if(t)try{let o=t.call(n);return r!==void 0?o===r:!0}catch{return!1}try{return Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)?!1:Object.prototype.toString.call(n)===e}catch{return!1}}function P(n){if(!F(n))return!1;if(eo)try{return!Number.isNaN(eo.call(n))}catch{return!1}try{return Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)?!1:Object.prototype.toString.call(n)===Js&&!Number.isNaN(n.getTime())}catch{return!1}}function ge(n){return Se(n,Ws,ma)}function jt(n){return Se(n,Xs,pa)}function Bt(n){return Se(n,Hs,ha)}function so(n){if(!F(n))return!1;if(to)try{return to.call(n,"key"),!0}catch{return!1}return Se(n,Zs,void 0)}function ao(n){if(!F(n))return!1;try{if(n instanceof Error)return!0;let e=n;for(;e!==null;){if(!Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)&&Object.prototype.toString.call(e)===Ys)return!0;e=Object.getPrototypeOf(e)}}catch{return!1}return!1}function Mn(n){if(!F(n))return!1;try{let e=ArrayBuffer.isView(n)?n.buffer:n;return Lt(e)||!Pt(e)?!1:"detached"in e&&e.detached!==void 0?e.detached===!0:(ga?.call(e,0,0),!1)}catch{return!0}}function Pt(n){return Se(n,ta,da)}function Lt(n){return Se(n,na,ya)}function lo(n){return Se(n,ra,_a)}function Un(n){return Se(n,Qs,ke,"Uint8Array")}function uo(n){return Se(n,ea,ke,"Uint8ClampedArray")}function ie(n){if(!F(n))return n;let e=ro.length;for(let t=0;t<e;t++){let r=ro[t];if(r)try{return r.call(n)}catch{}}return n}var Js,Ws,Xs,Hs,Ys,Zs,Qs,ea,ta,na,ra,oa,ia,Xr,Hr,Yr,sa,aa,la,ua,ca,fa,ma,pa,ha,Nn,Zr,Qr,ke,da,ga,ya,_a,eo,to,xa,ba,wa,Aa,Sa,Ta,oo,Da,Oa,no,ro,ye=R(()=>{"use strict";Js="[object Date]",Ws="[object RegExp]",Xs="[object Set]",Hs="[object Map]",Ys="[object Error]",Zs="[object URLSearchParams]",Qs="[object Uint8Array]",ea="[object Uint8ClampedArray]",ta="[object ArrayBuffer]",na="[object SharedArrayBuffer]",ra="[object DataView]",oa="[object Object]",ia=typeof Date=="function"?Date.prototype:void 0,Xr=typeof RegExp=="function"?RegExp.prototype:void 0,Hr=typeof Set=="function"?Set.prototype:void 0,Yr=typeof Map=="function"?Map.prototype:void 0,sa=typeof URLSearchParams=="function"?URLSearchParams.prototype:void 0,aa=typeof String=="function"?String.prototype:void 0,la=typeof Number=="function"?Number.prototype:void 0,ua=typeof Boolean=="function"?Boolean.prototype:void 0,ca=typeof BigInt=="function"?BigInt.prototype:void 0,fa=typeof Symbol=="function"?Symbol.prototype:void 0,ma=Xr?Object.getOwnPropertyDescriptor(Xr,"source")?.get:void 0,pa=Hr?Object.getOwnPropertyDescriptor(Hr,"size")?.get:void 0,ha=Yr?Object.getOwnPropertyDescriptor(Yr,"size")?.get:void 0,Nn=typeof ArrayBuffer=="function"?ArrayBuffer.prototype:void 0,Zr=typeof SharedArrayBuffer=="function"?SharedArrayBuffer.prototype:void 0,Qr=typeof DataView=="function"?DataView.prototype:void 0,ke=typeof Uint8Array=="function"?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get:void 0,da=Nn?Object.getOwnPropertyDescriptor(Nn,"byteLength")?.get:void 0,ga=Nn?.slice,ya=Zr?Object.getOwnPropertyDescriptor(Zr,"byteLength")?.get:void 0,_a=Qr?Object.getOwnPropertyDescriptor(Qr,"byteLength")?.get:void 0,eo=ia?.valueOf,to=sa?.has,xa=aa?.valueOf,ba=la?.valueOf,wa=ua?.valueOf,Aa=ca?.valueOf,Sa=fa?.valueOf,Ta=Function.prototype.toString.call(Object);oo=function(){},Da=new Proxy(oo,{construct(){return this}}),Oa=typeof ArrayBuffer=="function"?new ArrayBuffer(0):void 0,no=[[],[oo],[Oa],[{}]];ro=[ba,xa,wa,Aa,Sa]});var Te,co,Me,_t,_e,et,fo,mo,po,vn,Fn,jn,Bn,tt,xt,bt,Ea,ho,go,yo,_o,xo,bo,wo,Ao,So,To,Do,Oo,Eo,Io,Co,Ro,ko,No,Mo,Uo,Pn,vo,xe=R(()=>{"use strict";Te=new TextEncoder,co=6048e5,Me=864e5,_t=36e5,_e=6e4,et=1e3,fo=1,mo=.001,po=1e-6,vn=1e3,Fn=1e6,jn=1000n,Bn=1000000n,tt="\0",xt="",bt=-1,Ea=4294967295,ho=-9223372036854775808n,go=9223372036854775807n,yo=0n,_o=18446744073709551615n,xo=-2147483648,bo=2147483647,wo=0,Ao=Ea,So=-32768,To=32767,Do=0,Oo=65535,Eo=-128,Io=127,Co=0,Ro=255,ko=31,No=127,Mo=55296,Uo=57343,Pn=Object.freeze({9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r"}),vo=Object.freeze({b:"\b",0:"\0",...Object.fromEntries(Object.entries(Pn).map(([n,e])=>[e.slice(1),String.fromCharCode(Number(n))]))})});function v(n,e){return typeof n!="number"?!1:Number.isNaN(n)?e?.allowNaN??e?.allowNonFiniteNumbers??!1:Number.isFinite(n)?!0:e?.allowNonFiniteNumbers??!1}function Fo(n){for(let e=1;e<n.length;e++)if(n[e].length!==3)return!1;return!0}function Vo(n,e){if(Ia.test(n))return null;let t=n.trim();if(t==="")return null;t.startsWith("(")&&t.endsWith(")")&&(t="-"+t.slice(1,-1).trim());let r=t[t.length-1];(r==="-"||r==="+")&&t.length>1&&(t=r+t.slice(0,-1).trim()),e||(t=t.replace(Ca,""));let o=t.includes("."),i=t.includes(",");if(o&&i){let s=t.lastIndexOf("."),a=t.lastIndexOf(","),l=a>s,u=l?".":",",c=l?a:s,f=t.slice(0,c).split(u);return f.length>1&&!Fo(f)||f[0].replace(jo,"").length>3?null:l?t.replace(Bo,"").replace(Vt,"."):t.replace(Vt,"")}if(i||o){let s=i?",":".",a=t.split(s);if(a.length>2||s===","&&a.length===2&&a[1].length===3){let l=a[0].replace(jo,"").length;if(l===0){if(s===","||a.length>2)return null}else return l>3?null:Fo(a)?t.replace(i?Vt:Bo,""):null}if(i)return t.replace(Vt,".")}return t}function j(n,{allowNonFiniteNumbers:e=!1,strictNumericString:t=!1,floatScientific:r=!0}={}){if(n==null||typeof n=="symbol")return null;switch(n=ie(n),typeof n){case"number":return v(n,{allowNonFiniteNumbers:e})?n:null;case"boolean":return n?1:0;case"bigint":{let o=Number(n);return v(o,{allowNonFiniteNumbers:e})?o:null}case"object":{if(P(n)){let o=n.getTime();return v(o,{allowNonFiniteNumbers:e})?o:null}return null}case"string":{let o=Vo(n,t);if(o===null)return null;if(e){let a=o.toLowerCase();if(a==="nan"||a==="-nan"||a==="+nan")return NaN;if(a==="infinity"||a==="+infinity")return 1/0;if(a==="-infinity")return-1/0}if(Lo.test(o)&&!r||!Po.test(o))return null;let s=Number(o);return v(s,{allowNonFiniteNumbers:e})?s:null}default:return null}}function $o({locale:n="en-US",accountingNegatives:e=!1,fallback:t="NaN",formatNonFinite:r=!1,...o}={}){o.useGrouping===void 0&&(o.useGrouping=!1),o.maximumFractionDigits===void 0&&o.maximumSignificantDigits===void 0&&(o.maximumFractionDigits=20),e&&(o.currencySign="accounting",o.style===void 0&&(o.style="decimal"));let i=new Intl.NumberFormat(n,o);return s=>{if(typeof s=="bigint")return e&&s<0n?`(${i.format(-s)})`:i.format(s);let a=j(s,{allowNonFiniteNumbers:!0});return a===null||Number.isNaN(a)?t:Number.isFinite(a)?e&&a<0?`(${i.format(Math.abs(a))})`:i.format(a):r?t:e&&a===-1/0?`(${i.format(1/0)})`:String(a)}}function Ln(n,{floatPrecision:e="Float64",allowNonFiniteNumbers:t=!0,floatScientific:r=!0,strictNumericString:o=!1}={}){let i=j(n,{allowNonFiniteNumbers:t,floatScientific:r,strictNumericString:o});return i===null||(e==="Float32"&&(i=Math.fround(i)),!v(i,{allowNonFiniteNumbers:t}))?null:i}function De(n,{range:e="Int32"}={}){if(!v(n)||!Number.isInteger(n))return!1;let t=typeof e=="string"?Ko[e]:e;return n>=t.min&&n<=t.max}function se(n,{range:e="Int32",coerce:t="truncate"}={}){let r=j(n);if(r===null)return null;switch(t){case"round":r=Math.round(r);break;case"floor":r=Math.floor(r);break;case"ceil":r=Math.ceil(r);break;case"truncate":r=Math.trunc(r);break}let o=typeof e=="string"?Ko[e]:e;return Ee(r,{min:o.min,max:o.max})}function $t(n,{range:e="Int64"}={}){let t=ie(n);if(typeof t!="bigint")return!1;let r=typeof e=="string"?qo[e]:e;return t>=r.min&&t<=r.max}function Oe(n,{range:e="Int64",truncate:t=!1}={}){if(n==null||typeof n=="symbol")return null;try{n=ie(n)}catch{return null}let r=null;if(typeof n=="bigint")r=n;else if(typeof n=="string"){let i=Vo(n,!1);if(i===null||!Po.test(i))return null;if(Lo.test(i)){let s=i.search(/[eE]/),a=i.slice(0,s),l=i.slice(s+1),u=parseInt(l,10);if(Number.isNaN(u)||u>1e5||u<-1e5)return null;let c=a.startsWith("-");(c||a.startsWith("+"))&&(a=a.slice(1));let f=a.indexOf("."),m=a,h=0;f!==-1&&(h=a.length-f-1,m=a.slice(0,f)+a.slice(f+1)),m=m.replace(/^0+/,"")||"0";try{let p=BigInt(m);c&&(p=-p);let d=u-h;if(d>=0)r=p*10n**BigInt(d);else{let g=10n**BigInt(-d),y=p%g;if(!t&&y!==0n)return null;r=p/g}}catch{return null}}else{let s=i.indexOf(".");if(s!==-1){if(!t&&/[^0]/.test(i.slice(s+1)))return null;i=i.slice(0,s)}try{r=BigInt(i)}catch{return null}}}else{let i=j(n);if(i===null||!t&&!Number.isInteger(i))return null;r=BigInt(Math.trunc(i))}let o=typeof e=="string"?qo[e]:e;return r<o.min||r>o.max?null:r}function Ra(n,e){let t=n-e;if(t<0||e<0)return null;if(t>15)return Number.MAX_SAFE_INTEGER;let r=Math.min(e,16),o=Math.pow(10,t)-Math.pow(10,-r);return o>0?o:null}function Vn(n,e){let t=n.toString();if(t.includes("e")){let r=Math.pow(10,e);return Math.round(n*r)/r}return+(Math.round(+(t+"e"+e))+"e"+-e)}function Kt(n,{precision:e,scale:t}={}){let r=j(n);if(r===null)return null;let o=r;if(t!==void 0&&(o=Vn(o,t)),e!==void 0){let s=Ra(e,t??0);s!==null&&(o=Ee(o,{min:-s,max:s}))}return o}function Ee(n,e){if(!e)return n;let{min:t=null,max:r=null,safe:o=!0}=e;if(t!==null&&r!==null&&t>r)return t;let i=n;if(o&&typeof i=="number"){if(Number.isNaN(i))return t!==null?t:r!==null?r:n;if(i===1/0)return r!==null?r:n;if(i===-1/0)return t!==null?t:n}return t!==null&&i<t?t:r!==null&&i>r?r:i}function zo(n){let e=n|0;return function(){let t=e=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}var Po,Ia,Ca,Lo,jo,Bo,Vt,Ko,qo,Ue=R(()=>{"use strict";ye();xe();Po=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Ia=/0[xobXOB]/,Ca=/[\s_]/g,Lo=/[eE]/;jo=/^[+-]/,Bo=/\./g,Vt=/,/g;Ko={Int8:{min:Eo,max:Io},Int16:{min:So,max:To},Int32:{min:xo,max:bo},UInt8:{min:Co,max:Ro},UInt16:{min:Do,max:Oo},UInt32:{min:wo,max:Ao}};qo={Int64:{min:ho,max:go},UInt64:{min:yo,max:_o}}});function K(n){if(!ArrayBuffer.isView(n))return!1;if(ke)return ke.call(n)!==void 0;let e=Object.prototype.toString.call(n);return e!=="[object DataView]"&&e.endsWith("Array]")}function k(n){return Array.isArray(n)||K(n)}function be(n){return n==null?[]:Array.isArray(n)?[...n]:K(n)?Array.from(n):[n]}function qt(n,e,t){let r=n.length,o=e<-r||e>=r;if(o&&!t)throw new ne(`Index ${e} is out of bounds for array of length ${r}`);return o?null:n.at(e)??null}function Wo(n){if(typeof n=="function"){let e=io(n);return{check:e?t=>t instanceof n:t=>!!n(t),coerce:t=>{if(e)return t instanceof n?t:null;let r=n(t);return typeof r=="boolean"?r?t:null:r}}}switch(n){case"string":return{check:e=>typeof e=="string",coerce:e=>String(e)};case"number":return{check:v,coerce:e=>j(e)??NaN};case"boolean":return{check:e=>typeof e=="boolean",coerce:Boolean};case"bigint":return{check:$t,coerce:e=>Oe(e)};case"date":return{check:P,coerce:e=>J(e)};case"object":return{check:F,coerce:e=>F(e)?e:null};case"plainObject":return{check:Ne,coerce:e=>Ne(e)?e:null};case"null":return{check:e=>e===null,coerce:()=>null};case"undefined":return{check:e=>e===void 0,coerce:()=>{}};case"nullish":return{check:e=>e==null,coerce:()=>null};default:return{check:()=>!0,coerce:e=>e}}}function Q(n,e,{mode:t="every",allowNulls:r=!1,allowEmpty:o=!0}={}){if(!k(n))return!1;let i=n,s=i.length;if(s===0)return o?t==="every":!1;let{check:a}=Wo(e);if(t==="every"){for(let l=0;l<s;l++){let u=i[l];if(!(r&&u==null)&&!a(u))return!1}return!0}for(let l=0;l<s;l++){let u=i[l];if(r&&u==null||a(u))return!0}return!1}function ve(n,e="any",{mode:t="every",allowNulls:r=!1,allowEmpty:o=!0}={}){let i=be(n),s=i.length;if(s===0){if(!o)throw new ne("Expected non-empty array");return[]}let{check:a,coerce:l}=Wo(e),u=new Array(s),c=0;for(let f=0;f<s;f++){let m=i[f];if(r&&m==null){u[c++]=m;continue}let h=l(m);if(a(h))u[c++]=h;else if(t==="every")throw new ne(`Failed to convert array item at index ${f} ('${m}') to target type '${e}'`)}if(t==="some"){if(c===0)throw new ne(`No items in array could be converted to target type '${e}'`);c<s&&(u.length=c)}return u}function wt(n,{descending:e=!1,nullsLast:t=!0}={}){if(!k(n))return[];let r=n,o=r.length;if(o===0)return[];if(K(n)){let f=r.slice().sort();return e&&f.reverse(),Array.from(f)}let i=[],s=[],a=!0,l=!0,u=!0;for(let f=0;f<o;f++){let m=r[f];if(m==null)s.push(m);else if(i.push(m),u){let h=typeof m;h!=="number"&&(a=!1),h!=="string"&&(l=!1),!a&&!l&&(u=!1)}}return i.length>1&&(a?i.sort(e?(f,m)=>m-f:(f,m)=>f-m):l?i.sort(e?(f,m)=>m.localeCompare(f):(f,m)=>f.localeCompare(m)):i.sort((f,m)=>{let h=typeof f,p=typeof m;if(h!==p){let d=h<p?-1:1;return e?-d:d}return f<m?e?1:-1:f>m?e?-1:1:0})),s.length===0?i:t?i.concat(s):s.concat(i)}function B(n){if(!k(n))return Go;let e=n.length;if(e===0)return Go;let t=null,r=null,o=null,i=null,s=0,a=0,l=0,u=0,c=0,f=1,m=0,h=0;for(let g=0;g<e;g++){let y=n[g];if(y==null){a++;continue}if(typeof y=="number"&&Number.isNaN(y)){l++,a++;continue}(t==null||y<t)&&(t=y,o=g),(r==null||y>r)&&(r=y,i=g);let _=j(y);if(_!==null){let S=u+_;Math.abs(u)>=Math.abs(_)?c+=u-S+_:c+=_-S+u,u=S,f*=_,s++;let b=_-m;m+=b/s;let x=_-m;h+=b*x}}let p=s>1?h/(s-1):0,d=l>0;return{sum:s>0?u+c:null,product:s>0?f:null,count:s,min:t,max:r,nanMin:d?NaN:t,nanMax:d?NaN:r,minIdx:o,maxIdx:i,mean:s>0?(u+c)/s:null,variance:p,std:Math.sqrt(p),nullCount:a,nanCount:l,len:e,hasNulls:a>0,isNumeric:s>0&&s===e-a}}function Fe(n,{strict:e=!1,keySelector:t}={}){let r=Array.from(n),o=new Map;if(e){let s=t??G,a=new Map,l=r.length;for(let c=0;c<l;c++){let f=r[c],m=s(f),h=a.get(m);h===void 0?a.set(m,{val:f,count:1}):h.count++}let u=[];for(let c of a.values())u.push(c.val);for(let c=0;c<l;c++){let f=r[c],m=s(f),h=a.get(m);o.set(f,h.count)}return{values:u,count:u.length,frequencies:o}}let i=r.length;for(let s=0;s<i;s++){let a=r[s];o.set(a,(o.get(a)??0)+1)}return{values:Array.from(o.keys()),count:o.size,frequencies:o}}function zt(n,{step:e=1,offsetStart:t=0,offsetEnd:r,maxItemsGathered:o,null_on_oob:i=!0}={}){if(n==null)return null;if(o!==void 0&&o<=0)return[];if(e===0)throw new M("Step size step cannot be zero");let s=n.length;if(s===0?t!==0:t>=s||t<-s){if(!i)throw new ne(`Start offset ${t} is out of bounds for array of length ${s}`);return null}let l=t<0?s+t:t,u=r!==void 0?r<0?s+r:r:e>0?s:-1,c=[];if(e>0)for(let f=l;f<u&&f<s&&!(f>=0&&(c.push(n[f]),o!==void 0&&c.length>=o));f+=e);else for(let f=l;f>u&&f>=0&&!(f<s&&(c.push(n[f]),o!==void 0&&c.length>=o));f+=e);return c}function Gt(n,e=",",{ignoreNulls:t=!1,nullValue:r="",prefix:o="",suffix:i="",limit:s,truncationMarker:a="...",valueFormatter:l}={}){let u=n.length,c=[],f=s!==void 0?Math.max(0,s):u,m=!1;for(let h=0;h<u;h++){if(c.length>=f){m=!0;break}let p=n[h];p!=null?c.push(l?l(p,h):String(p)):t||c.push(r)}return o+c.join(e)+(m?a:"")+i}function qe(n,e,t={}){let r=n.length,{mode:o="cumulative",step:i=1,coerce:s=d=>d,condition:a,reverse:l=!1,startIndex:u=l?r-1:0,endIndex:c=l?-1:r}=t,f=l?-1:1,m=u,h=c,p=(d,g)=>{(!a||a(n[d],d,n))&&(n[d]=s(g))};if(o==="constant"){let d=s(e);for(let g=m;l?g>h:g<h;g+=f)p(g,d)}else if(o==="independent")if(typeof i=="function"){let d=0;for(let g=m;l?g>h:g<h;g+=f)p(g,i({index:d,initialValue:e,originalValue:n[g],absoluteIndex:g,targetArray:n})),d++}else for(let d=m;l?d>h:d<h;d+=f)p(d,e+d*i);else{let d=e,g=!0,y=0;for(let _=m;l?_>h:_<h;_+=f)g?(p(_,d),g=!1):(typeof i=="function"?d=i({prev:d,index:y,originalValue:n[_],absoluteIndex:_,targetArray:n}):d=d+i,p(_,d)),y++}}function Xo(n){let e=n.length,t=0,r=new Float64Array(e);for(let i=0;i<e;i++){let s=n[i],a=j(s,{allowNonFiniteNumbers:!0});a!==null&&v(a,{allowNonFiniteNumbers:!0,allowNaN:!1})&&(r[t++]=a)}if(t===0)return null;let o=r.subarray(0,t);return o.sort(),o}function nt(n){let e=Xo(n);if(!e)return null;let t=e.length,r=Math.floor(t/2);return t%2!==0?e[r]:(e[r-1]+e[r])/2}function Jt(n,e){if(e<0||e>1)return null;let t=Xo(n);if(!t)return null;let r=t.length,o=e*(r-1),i=Math.floor(o),s=Math.ceil(o);return i===s?t[i]:t[i]+(o-i)*(t[s]-t[i])}function Wt(n){if(!k(n)||n.length===0)return null;let e=new Map,t=n.length,r=0,o=[];for(let i=0;i<t;i++){let s=n[i];if(s==null||typeof s=="number"&&!v(s,{allowNonFiniteNumbers:!0,allowNaN:!1}))continue;let a=(e.get(s)??0)+1;e.set(s,a),a>r?(r=a,o=[s]):a===r&&o.push(s)}return o.length===0?null:wt(o)}function Ho(n,e){let t=n.length;if(t===0)return[];let r=Math.trunc(e);if(isNaN(r)||r===0)return Array.isArray(n)?n.slice():Array.from(n);let o=Math.abs(r);if(o>=t)return new Array(t).fill(null);let i=new Array(t);if(r>0){i.fill(null,0,r);for(let s=r;s<t;s++){let a=n[s-r];i[s]=a??null}}else{let s=t-o;for(let a=0;a<s;a++){let l=n[a+o];i[a]=l??null}i.fill(null,s,t)}return i}function $n(n){let e=n.length,t=0,r=0,o=0,i=0,s=0,a=0;for(let m=0;m<e;m++){let h=n[m];if(!h)continue;let p=j(h[0]),d=j(h[1]);if(p===null||d===null)continue;t++;let g=p-r;r+=g/t;let y=p-r,_=d-o;o+=_/t;let S=d-o;a+=g*S,i+=g*y,s+=_*S}if(t<2)return{covariance:null,correlation:null};let l=a/(t-1);if(i===0||s===0)return{covariance:l,correlation:null};let u=Math.sqrt(i*s);if(u===0||Number.isNaN(u))return{covariance:l,correlation:null};let c=a/u,f=Math.max(-1,Math.min(1,c));return{covariance:l,correlation:f}}function Jo(n){let e=n.length,t=new Int32Array(e);for(let i=0;i<e;i++)t[i]=i;t.sort((i,s)=>n[i]-n[s]);let r=new Float64Array(e),o=0;for(;o<e;){let i=o+1;for(;i<e&&n[t[i]]===n[t[o]];)i++;let s=(o+1+i)/2;for(let a=o;a<i;a++)r[t[a]]=s;o=i}return r}function ka(n,e,t){if(t<2)return null;let r=0,o=0,i=0,s=0,a=0;for(let c=0;c<t;c++){let f=n[c],m=e[c],h=f-r;r+=h/(c+1);let p=f-r,d=m-o;o+=d/(c+1);let g=m-o;a+=h*g,i+=h*p,s+=d*g}if(i===0||s===0)return null;let l=Math.sqrt(i*s);if(l===0||Number.isNaN(l))return null;let u=a/l;return Math.max(-1,Math.min(1,u))}function Yo(n){let e=n.length,t=new Float64Array(e),r=new Float64Array(e),o=0;for(let a=0;a<e;a++){let l=n[a];if(l){let u=j(l[0]),c=j(l[1]);u!==null&&c!==null&&(t[o]=u,r[o]=c,o++)}}if(o<2)return null;let i=Jo(t.subarray(0,o)),s=Jo(r.subarray(0,o));return ka(i,s,o)}function Zo(n){let e=n.length,t=0,r=0;for(let o=0;o<e;o++){let i=n[o];if(!i)continue;let s=j(i[0]),a=j(i[1]);s===null||a===null||(t+=s*a,r++)}return r>0?t:null}function Qo(n){let e=n.length,t=0,r=0,o=0;for(let i=0;i<e;i++){let s=n[i];if(!s)continue;let a=j(s[0]),l=j(s[1]);a===null||l===null||(t+=a*l,r+=l,o++)}return o===0||Math.abs(r)<1e-12?null:t/r}function ei(n,e){let t=Math.max(0,Math.floor(n||0)),r=Math.max(0,Math.floor(e||0)),o=t*r;if(!De(o,{range:"UInt32"}))throw new M(`Cartesian product size (${o} rows) exceeds maximum JavaScript array capacity.`);let i=new Array(o),s=new Array(o),a=0;for(let l=0;l<t;l++)for(let u=0;u<r;u++)i[a]=l,s[a]=u,a++;return{leftIndices:i,rightIndices:s}}function Xt(n,e,t={}){let r=t.side==="right",o=t.getValue,i=0,s=n.length;for(;i<s;){let a=i+s>>>1,l=o?o(a,n[a]):n[a];(r?l<=e:l<e)?i=a+1:s=a}return i}function ti(n){if(!k(n))return null;let{mean:e,count:t}=B(n);if(t<2||e===null)return null;let r=0,o=0,i=0,s=n.length;for(let a=0;a<s;a++){let l=j(n[a]);if(l===null)continue;let u=l-e,c=u*u;r+=c,o+=c*u,i+=c*c}return r<=0?null:{count:t,mean:e,m2Sum:r,m3Sum:o,m4Sum:i}}function ni(n,e={}){let t=ti(n);if(!t)return null;let{count:r,m2Sum:o,m3Sum:i}=t,s=o/r,l=i/r/Math.pow(s,1.5);if(e?.bias??!0)return v(l)?l:null;if(r<3)return null;let c=Math.sqrt(r*(r-1))/(r-2)*l;return v(c)?c:null}function ri(n,e={}){let t=ti(n);if(!t)return null;let{count:r,m2Sum:o,m4Sum:i}=t,s=o/r,l=i/r/(s*s),u=l-3,c=e?.fisher??!0;if(e?.bias??!0){let p=c?u:l;return v(p)?p:null}if(r<4)return null;let m=(r-1)/((r-2)*(r-3))*((r+1)*u+6),h=c?m:m+3;return v(h)?h:null}function oi(n,e={}){if(!n||n.length===0)return null;let{base:t=Math.E,normalize:r=!0}=e;if(t<=0||t===1)return null;let o=n.length,i=Math.log(t);if(r){let s=new Map,a=0;for(let u=0;u<o;u++){let c=n[u];if(c==null||Number.isNaN(c))continue;let f=G(c);s.set(f,(s.get(f)||0)+1),a++}if(a===0)return null;let l=0;for(let u of s.values()){let c=u/a;c>0&&(l-=c*(Math.log(c)/i))}return v(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}else{let s=[],a=0;for(let c=0;c<o;c++){let f=n[c];if(f==null||Number.isNaN(f))continue;let m=Number(f);if(!v(m)||m<0)return null;m>0&&(s.push(m),a+=m)}if(s.length===0||a<=0)return null;let l=0,u=s.length;for(let c=0;c<u;c++){let f=s[c]/a;f>0&&(l-=f*(Math.log(f)/i))}return v(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}}function Ht(n,e){if(!n||n.length===0)return null;let t=null,r=n.length;for(let o=0;o<r;o++){let i=Oe(n[o],{range:"Int64"});i!==null&&(t=t===null?i:e(t,i))}return t===null?null:t>=Number.MIN_SAFE_INTEGER&&t<=Number.MAX_SAFE_INTEGER?Number(t):t}function Kn(n,e){if(!n||n.length===0)return null;let t=n.length,r=new Array(t),o=new Array(t);for(let s=0;s<t;s++){let a=n[s];r[s]=a?.[0],o[s]=a?.[1]}let i=B(o)[e];return i!==null?r[i]:null}var Go,Yt=R(()=>{"use strict";ye();Ue();Zt();At();X();Go={sum:null,product:null,count:0,min:null,max:null,nanMin:null,nanMax:null,minIdx:null,maxIdx:null,mean:null,variance:0,std:0,nullCount:0,nanCount:0,len:0,hasNulls:!1,isNumeric:!1}});function St(n,e={}){let{format:t="json",allowPrimitives:r=!1,trimBeforeParse:o=!1,reviver:i,ndjson:{skipInvalidLines:s=!1,maxLines:a,skipLines:l}={},guard:u,onError:c}=e,f="fallback"in e,m=f?e.fallback:Na;if(typeof n!="string")return f?m:n;let h=o?n.trim():n;if(h==="")return f?m:n;let p;try{if(t==="ndjson"){let d=[],g=0,y=0,_=0,S=/\r\n|\n|\r/g,b;for(;;){b=S.exec(h);let x=b?h.substring(_,b.index):h.substring(_);b&&(_=S.lastIndex);let A=x.trim();if(A!==""&&(g++,l===void 0||g>l))if(!r&&!Ma(A)){if(!s)throw new M("NDJSON line is not wrapped and primitives are disallowed")}else{if(a!==void 0&&y>=a)break;try{d.push(JSON.parse(A,i)),y++}catch(w){if(!s)throw w}}if(!b)break}if(d.length===0)throw new je("No valid NDJSON lines processed");p=d}else{if(!r&&!Ua(h))throw new M("JSON string is not wrapped and primitives are disallowed");p=JSON.parse(h,i)}if(u&&!u(p))throw new M("Parsed value failed guard validation")}catch(d){if(c)try{c(d)}catch{}return f?m:n}return p}function ze(n={}){let e=n.bigintStrategy??"string",t=n.handleCircular?new WeakSet:null,o=Array.isArray(n.replacer)?n.replacer.map(String):null,i=s=>e==="number"&&s<=BigInt(Number.MAX_SAFE_INTEGER)&&s>=BigInt(Number.MIN_SAFE_INTEGER)?Number(s):s.toString();return function(a,l){let u=l;if(typeof n.replacer=="function")u=n.replacer.call(this,a,l);else if(o&&a!==""&&!Array.isArray(this)&&!o.includes(a))return;if(u===void 0)return;let c=u===l&&this!=null?this[a]:u;if(typeof n.onCustom=="function"){let f=n.onCustom.call(this,a,c);if(f!==c||f===void 0&&c!==void 0)return f}if(c!==null&&typeof c!="object"&&typeof c!="bigint")return u;if(t&&c!==null&&typeof c=="object"){if(a===""&&(t=new WeakSet),t.has(c))return n.onCircular?n.onCircular.call(this,a,c):"[Circular]";t.add(c)}return typeof c=="bigint"?n.voidBigIntReplacement?u:n.onBigInt?n.onBigInt(c):i(c):K(c)?n.voidTypedArrayReplacement?u:n.onTypedArray?n.onTypedArray(c):Array.from(c):jt(c)?n.voidSetReplacement?u:n.onSet?n.onSet(c):Array.from(c):Bt(c)?n.voidMapReplacement?u:n.onMap?n.onMap(c):Array.from(c.entries()):ge(c)?n.voidRegExpReplacement?u:n.onRegExp?n.onRegExp(c):c.toString():P(c)?n.voidDateReplacement?u:n.onDate?n.onDate(c):n.formatDate?n.formatDate(c):c.toISOString():ao(c)?n.onError?n.onError(c):{name:c.name,message:c.message,stack:c.stack}:so(c)?n.onURLSearchParams?n.onURLSearchParams(c):c.toString():u}}function va(n){let e=n.trim().replace(/^\$/,"");if(!e)return[];let t=[],r=/\.\.\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*))\s*\]|\.\.([^\.\[]+)|\.([\w$-]+|\*)|\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*)|(-?\d*(?::-?\d*){0,2}))\s*\]/g,o,i=0;for(;(o=r.exec(e))!==null;){if(o.index!==i)return null;i=r.lastIndex;let[,s,a,l,u,c,f,m,h,p]=o,d=s??a,g=f??m;if(d!==void 0)t.push({type:"rec",key:si(d)});else if(l!==void 0)t.push({type:"rec",key:qn});else if(u!==void 0)t.push({type:"rec",key:u});else if(c!==void 0)t.push(c===qn?{type:"wildcard"}:{type:"prop",key:c});else if(g!==void 0)t.push({type:"prop",key:si(g)});else if(h!==void 0)t.push({type:"wildcard"});else if(p!==void 0)if(p.includes(":")){let[y,_,S]=p.split(":");t.push({type:"slice",start:se(y)??void 0,end:se(_)??void 0,step:se(S)??1})}else{let y=se(p);if(y===null)return null;t.push({type:"idx",idx:y})}}return i===e.length?t:null}function li(n,e,t,r=new Set){if(n==null||!ai(e.key)||typeof n!="object"||r.has(n))return;r.add(n);let o=Array.isArray(n);if(!o&&!F(n))return;e.key===qn?ui(n,{type:"wildcard"},t):!o&&Object.prototype.hasOwnProperty.call(n,e.key)&&t.push(n[e.key]);let i=o?n:Object.values(n);for(let s=0;s<i.length;s++)li(i[s],e,t,r)}function ui(n,e,t){if(n!=null)switch(e.type){case"prop":F(n)&&ai(e.key)&&Object.prototype.hasOwnProperty.call(n,e.key)&&t.push(n[e.key]);break;case"idx":{if(!Array.isArray(n))break;let r=e.idx<0?n.length+e.idx:e.idx;r>=0&&r<n.length&&t.push(n[r]);break}case"slice":{if(!Array.isArray(n)||e.step===0)break;let r=e.step??1,o=e.start??(r>0?0:n.length-1),i=zt(n,{step:r,offsetStart:o,offsetEnd:e.end,null_on_oob:!0});if(i)for(let s=0;s<i.length;s++)t.push(i[s]);break}case"wildcard":{let r=Array.isArray(n)?n:F(n)?Object.values(n):null;if(r)for(let o=0;o<r.length;o++)t.push(r[o]);break}case"rec":li(n,e,t);break}}function ci(n,e){if(n==null||Qt(e))return null;let t=n;if(typeof n=="string"){let s=n.trim();if(s==="")return null;let a=St(s,{allowPrimitives:!0,fallback:ii});if(a===ii)throw new M(`Invalid JSON string encountered in json_path_match: "${n}"`);t=a}let r=va(e);if(r===null)return null;let o=[t];for(let s=0;s<r.length;s++){if(o.length===0)return null;let a=[];for(let l=0;l<o.length;l++)ui(o[l],r[s],a);o=a}if(o.length===0||o[0]==null)return null;let i=o[0];if(typeof i=="object")try{return JSON.stringify(i)}catch{return null}return String(i)}var Na,ii,Ma,Ua,qn,si,ai,Tt=R(()=>{"use strict";Yt();ye();Ue();At();X();xe();Na=Symbol("no_fallback"),ii=Symbol("invalid"),Ma=n=>{let e=n.length;if(e<2)return!1;let t=n[0],r=n[e-1];return t==="{"&&r==="}"||t==="["&&r==="]"},Ua=n=>{let e=0,t=n.length;for(;e<t&&/\s/.test(n[e]);)e++;let r=t-1;for(;r>=e&&/\s/.test(n[r]);)r--;if(e>=r)return!1;let o=n[e],i=n[r];return o==="{"&&i==="}"||o==="["&&i==="]"};qn="*",si=n=>n.replace(/\\(.)/g,(e,t)=>vo[t]??t),ai=n=>n!==void 0&&n!=="__proto__"&&n!=="constructor"&&n!=="prototype"});function Fa(n){return!F(n)||Mn(n)?!1:ArrayBuffer.isView(n)?Un(n)||uo(n)||lo(n):Pt(n)||Lt(n)}function zn(n,e){if(n==null)return!1;try{if(Fa(n))return!0;if(e?.strict)return!1;if(typeof n=="string")return!0;if(ArrayBuffer.isView(n))return!Mn(n);if(Array.isArray(n)){let t=n.length;for(let r=0;r<t;r++)if(!De(n[r],ja))return!1;return!0}}catch{return!1}return!1}function en(n,e){try{if(!zn(n,e))return null;if(Un(n))return n;if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(Pt(n)||Lt(n))return new Uint8Array(n);if(typeof n=="string")return Te.encode(n);if(Array.isArray(n))return Uint8Array.from(n)}catch{return null}return null}var ja,Gn=R(()=>{"use strict";ye();Ue();xe();ja={range:"UInt8"}});function Qt(n){let e=ie(n);return typeof e=="string"?e.trim().length===0:!1}function rt(n,e=null,t={}){if(n==null)return t.returnStringOnNull?"":null;let{mode:r="both",returnStringOnNull:o=!1,maxScanStart:i=1,maxScanEnd:s=1,maxMatchesStart:a=1,maxMatchesEnd:l=1,trimFirst:u=!1,stringOptions:c}=t,{literal:f=!1,caseInsensitive:m=!1}=c??{},h=(A,w="both")=>w==="start"?A.trimStart():w==="end"?A.trimEnd():A.trim(),p=n;if(u&&e!=null&&(p=h(n,r)),e==null){let A=h(p,r);return o||A!==""?A:null}let d=ge(e)?A=>{try{e.lastIndex=0}catch{}return e.test(A)}:(()=>{let A=new Set(m?e.toLowerCase():e);return w=>A.has(m?w.toLowerCase():w)})(),g=p.length;if(i===1&&a===1&&s===1&&l===1&&!f){let A=0,w=g;if(r==="both"||r==="start")for(;A<g&&d(p[A]);)A++;if(r==="both"||r==="end")for(;w>A&&d(p[w-1]);)w--;let D=A===0&&w===g?p:p.substring(A,w);return o||D!==""?D:null}let _=new Uint8Array(g),S=(A,w,D)=>{if(g===0||D===0)return;let O=A?0:g-1,C=A?g:-1,N=A?1:-1,H=!1,Z=0,W=0;for(let le=O;le!==C;le+=N)if(d(p[le])){if(!H){if(w!==null&&w>=0&&W>=w||D!==null&&D>=0&&Z>=D)break;H=!0,Z++}_[le]=1}else if(H=!1,W++,w!==null&&w>=0&&W>=w)break},b=(A,w,D,O,C)=>{if(g===0||C===0||w===0)return;let N=D?0:g-1,H=0,Z=0,W=m?p.toLowerCase():p;for(;N>=0&&N<g&&!(C!==null&&C>=0&&H>=C);){let le=D?N:N-w+1;if(!D&&le<0)break;let fe=D?W.indexOf(A,le):W.lastIndexOf(A,le);if(fe===-1)break;let Ft=D?fe-N:N-(fe+w-1);if(Z+=Ft,O!==null&&O>=0&&Z>=O)break;for(let Ye=0;Ye<w;Ye++)_[fe+Ye]=1;H++,N=D?fe+w:fe-1}};if(r==="both"||r==="start")if(f&&typeof e=="string"){let A=m?e.toLowerCase():e;b(A,e.length,!0,i,a)}else S(!0,i,a);if(r==="both"||r==="end")if(f&&typeof e=="string"){let A=m?e.toLowerCase():e;b(A,e.length,!1,s,l)}else S(!1,s,l);let x="";for(let A=0;A<g;A++)_[A]===0&&(x+=p[A]);return o||x!==""?x:null}function G(n,{depth:e=0,maxDepth:t=50}={}){if(e>t)return"v:circular";if(n===null)return"v:null";if(n===void 0)return"v:undefined";if(P(n))return`d:${n.getTime()}`;if(K(n)){let o=n.toString();return`u:${n.constructor.name}:${o.length}:${o}`}if(Array.isArray(n)){let o=n.length,i=new Array(o),s={depth:e+1,maxDepth:t};for(let a=0;a<o;a++)i[a]=G(n[a],s);return`a:[${i.join(xt)}]`}if(jt(n)){let o=Array.from(n),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++)s[l]=G(o[l],a);return s.sort(),`set:[${s.join(xt)}]`}if(Bt(n)){let o=Array.from(n.keys()),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++){let u=o[l];s[l]=`${G(u,a)}${tt}${G(n.get(u),a)}`}return s.sort(),`map:{${s.join(xt)}}`}if(typeof n=="object"&&typeof n.toJSON=="function"){let o=n.toJSON();if(o!==n)return`j:${G(o,{depth:e+1,maxDepth:t})}`}if(ge(n)){let o=n.toString();return`r:${o.length}:${o}`}if(Ne(n)){let o=Object.keys(n).sort(),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++){let u=o[l];s[l]=`${G(u,a)}${tt}${G(n[u],a)}`}return`o:{${s.join(xt)}}`}if(typeof n=="function"){let o=n.toString();return`f:${o.length}:${o}`}if(typeof n=="string")return`s:${n.length}:${n}`;if(typeof n=="symbol"){let o=n.toString();return`y:${o.length}:${o}`}if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return`${typeof n}:${n}`;let r=String(n);return`${typeof n}:${r.length}:${r}`}function Va(n){if(n==null)return[];let e=String(n);if(!e)return[];let r=e.normalize("NFC").replace(Ba,"$1$2").match(Pa)||[],o=[];for(let i=0;i<r.length;i++){let s=r[i];La.has(s)||o.push(s)}return o}function ot(n,e){let t=Va(n),r=t.length;if(r===0)return"";let{format:o}=e;if(o==="camel"||o==="pascal"||o==="title"){let i=o==="title"?" ":"",s=new Array(r);for(let a=0;a<r;a++){let l=t[a];s[a]=a===0&&o==="camel"?l.toLowerCase():l.charAt(0).toUpperCase()+l.slice(1).toLowerCase()}return s.join(i)}if(o==="kebab"||o==="snake"){let i=o==="kebab"?"-":"_",s=new Array(r);for(let a=0;a<r;a++)s[a]=t[a].toLowerCase();return s.join(i)}return String(n)}function gi(n){return typeof n!="string"&&(n=String(n)),Te.encode(n)}function Ja(n){let e=en(n);if(!e)return"";if(hi&&typeof Uint8Array.prototype.toBase64=="function")return e.toBase64();if(nn)return Dt.from(e).toString("base64");let t="",r=e.length;for(let o=0;o<r;o+=fi){let i=e.subarray(o,o+fi);t+=String.fromCharCode.apply(null,i)}return btoa(t)}function Wa(n){if(typeof n!="string"&&(n=String(n)),nn)return Dt.from(n,"utf-8").toString("hex");let e=gi(n),t=e.length,r="";for(let o=0;o<t;o++)r+=di[e[o]];return r}function Xa(n){typeof n!="string"&&(n=String(n));let e=gi(n);return Ja(e)}function yi(n,e){if(n==null)return null;let t=Ha[e];if(!t)throw new Error(`Unsupported encoding: '${e}'. Supported encodings are 'hex' and 'base64'.`);return t(String(n))}function Ya(n){typeof n!="string"&&(n=String(n));let e=n.replace(qa,r=>Ka[r]),t=e.length%4;return t===0?e:e.padEnd(e.length+(4-t),"=")}function Za(n,e=!0){if(typeof n!="string"&&(n=String(n)),n!==""&&(n.length%4!==0||!za.test(n)))throw new Error("Invalid base64 encoding format");if(hi)return Uint8Array.fromBase64(n,{strict:e});if(nn)return new Uint8Array(Dt.from(n,"base64"));let t=atob(n),r=t.length,o=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=t.charCodeAt(i);return o}function Qa(n){typeof n!="string"&&(n=String(n));let e=n.trim();if(e.length%2!==0||!Ga.test(e))throw new Error("Invalid hex string format");if($a)return Uint8Array.fromHex(e);if(nn){let r=Dt.from(e,"hex");if(r.length!==e.length/2)throw new Error("Invalid hex string format");return new Uint8Array(r)}let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){let o=parseInt(e.substring(r*2,r*2+2),16);if(Number.isNaN(o))throw new Error("Invalid hex string format");t[r]=o}return t}function el(n,e=!0){try{let t=Qa(n);return new TextDecoder("utf-8",{fatal:e}).decode(t)}catch(t){if(e)throw t;return null}}function tl(n,e=!0){try{typeof n!="string"&&(n=String(n));let t=n.trim(),r=Ya(t),o=Za(r,e);return new TextDecoder("utf-8",{fatal:e}).decode(o)}catch(t){if(e)throw t;return null}}function _i(n,e,t={}){if(n==null)return null;let r=nl[e];if(!r)throw new Error(`Unsupported encoding: '${e}'. Supported encodings are 'hex' and 'base64'.`);let o=typeof t=="boolean"?t:t.strict??!0;return r(String(n),o)}function pe(n,e){let t=ie(n);if(t==null)return"";let r=ge(t)?t.source:typeof t=="string"?t:String(t);return(e?.mode??"tc39")==="tc39"?typeof RegExp.escape=="function"&&!rl.test(r)?RegExp.escape(r):r.replace(ol,mi):r.replace(il,mi)}function it(n,e,t){if(n==null||e==null)return null;let r=typeof n=="string"?n:String(n),o=t?.global??!1;try{if(!ge(e)){let a=typeof e=="string"?e:String(e),l=o?"g":"";if(t?.asciiCaseInsensitive&&(l+="i"),(a.includes("\\p{")||a.includes("\\P{"))&&!l.includes("u")&&!l.includes("v"))try{return{reg:new RegExp(a,l+"u"),input:r}}catch{try{return{reg:new RegExp(a,l+"v"),input:r}}catch{}}try{return{reg:new RegExp(a,l),input:r}}catch{return null}}let i=e.flags.replace(/y/g,"");o?i.includes("g")||(i+="g"):i=i.replace(/g/g,""),t?.asciiCaseInsensitive!==void 0&&(i=t.asciiCaseInsensitive?i.includes("i")?i:i+"i":i.replace(/i/g,""));let s=new RegExp(e.source,i);return s.lastIndex=0,{reg:s,input:r}}catch{return null}}function pi(n){let e=Object.create(null);n.index!==void 0&&Object.defineProperty(e,"_index",{value:String(n.index),writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"_length",{value:n.length,writable:!0,enumerable:!1,configurable:!0});for(let t=0;t<n.length;t++)e[String(t)]=n[t]!==void 0?n[t]:null;if(n.groups)for(let t in n.groups){let r=n.groups[t];e[t]=r!==void 0?r:null}return e}function Jn(n,e){if(typeof e=="string")return e in n?n[e]:null;let t=Number(e);if(Number.isNaN(t))return null;let r=Math.trunc(t);if(r>=0)return n[String(r)]??null;let i=(n._length??0)+r;return i>=1?n[String(i)]??null:null}function sl(n,e,t,r,o){let{literal:i=!1,mode:s,asciiCaseInsensitive:a=!1}=r??{},l=i?pe(e,{mode:s}):e,c=it(n,l,{global:!0,asciiCaseInsensitive:a})?.reg??null;if(!c)return[];let f=[];c.lastIndex=0;let m;for(;(m=c.exec(n))!==null;){let h=m.index,p=c.lastIndex,d=o(m,h,p);if(f.push({start:h,end:p,patternIndex:t,payload:d}),h===p){if(h===n.length)break;let g=n.codePointAt(h),y=g!=null&&g>65535?2:1;c.lastIndex=h+y}}return f}function bi(n){if(n.length<=1)return n;n.sort((o,i)=>{if(o.start!==i.start)return o.start-i.start;let s=o.patternIndex??o.i??0,a=i.patternIndex??i.i??0;return s-a});let e=[],t=0,r=n.length;for(let o=0;o<r;o++){let i=n[o];i.start>=t&&(e.push(i),t=i.end)}return e}function wi(n,e,t,r,o){let{overlapping:i=!1,leftmost:s,...a}=t??{},l=s??!0;if(i&&s)throw new M("Cannot specify both 'overlapping' and 'leftmost' as true.");if(n==null||e==null)return null;let u=be(e),c=u.length;if(c===0)return[];if(i){let h=new Array(c);for(let p=0;p<c;p++)h[p]=r(u[p]);return h}let f=[];for(let h=0;h<c;h++){let p=Ot(n,u[h],{...a,global:!1});if(p&&p[0]&&p[0]._index!=null){let d=Number(p[0]._index),g=p[0][0]?.length??0;f.push({i:h,start:d,end:d+g,payload:o(p[0],d)})}}let m=new Array(c).fill(null);if(f.length===0)return m;if(l){let h=bi(f);for(let p=0;p<h.length;p++){let d=h[p];m[d.i]=d.payload}}else{let h=[];f.sort((g,y)=>g.i-y.i);let p=f.length;for(let g=0;g<p;g++){let y=f[g],_=!1,S=h.length;for(let b=0;b<S;b++){let x=h[b],A=!1;if(y.start===y.end&&x.start===x.end?A=y.start===x.start:x.start===x.end?A=x.start>=y.start&&x.start<y.end:y.start===y.end?A=y.start>=x.start&&y.start<x.end:A=y.start<x.end&&y.end>x.start,A){_=!0;break}}_||h.push(y)}let d=h.length;for(let g=0;g<d;g++){let y=h[g];m[y.i]=y.payload}}return m}function Ot(n,e,t){let r=it(n,e,t);if(!r)return null;if(!t?.global){let s=r.input.match(r.reg);return s?[pi(s)]:null}let o=Array.from(r.input.matchAll(r.reg));if(o.length===0)return null;let i=new Array(o.length);for(let s=0;s<o.length;s++)i[s]=pi(o[s]);return i}function Wn(n,e,t){let r=Ot(n,e,t);return r?Jn(r[0],t?.groupIndex??1):null}function Ai(n,e,t){let r=Ot(n,e,{...t,global:!0});if(!r)return null;let o=t?.groupIndex??0,i=new Array(r.length);for(let s=0;s<r.length;s++)i[s]=Jn(r[s],o);return i}function Si(n,e,t){return Ot(n,e,t)?.[0]??null}function Ti(n,e,t){let r=t?.groupIndex??0;return wi(n,e,t,o=>Wn(n,o,{...t,groupIndex:r}),o=>Jn(o,r))}function tn(n,e,t){if(n==null||e==null)return null;let{literal:r=!1,asciiCaseInsensitive:o=!1,mode:i}=t??{};if(r){let l=ge(e),u=pe(e,{mode:i}),c=o?"i":"";if(l)for(let h of["i","u","v","m","s"])e.flags.includes(h)&&!c.includes(h)&&(c+=h);let f=new RegExp(u,c),m=n.match(f);return!m||m.index==null?null:Te.encode(n.slice(0,m.index)).length}let s=Ot(n,e,{...t,global:!1});if(!s||!s[0]||s[0]._index==null)return null;let a=Number(s[0]._index);return Te.encode(n.slice(0,a)).length}function Di(n,e,t){if(t?.literal){if(n==null||e==null)return null;let r=be(e),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=tn(n,r[i],t);return o}return wi(n,e,t,r=>tn(n,r,t),(r,o)=>Te.encode(n.slice(0,o)).length)}function Oi(n,e,t){if(n==null||e==null)return null;let{literal:r=!0,inclusive:o=!1,limit:i,exact:s=!1,strict:a=!1,mode:l,...u}=t??{},c=r?pe(e,{mode:l}):e,f=it(n,c,{...u,global:!0});if(!f)return null;let{reg:m}=f;m.lastIndex=0;let h=[],p=0,d=0,g=i!=null&&i>=0?i:1/0,y;for(;d<g&&(y=m.exec(n))!==null;){let S=y.index,b=m.lastIndex;if(S===b){if(S===n.length)break;let x=n.codePointAt(S),A=x!=null&&x>65535?2:1;if(S>0&&S>=p&&(h.push(n.slice(p,S)),d++,p=S,d>=g))break;m.lastIndex=S+A;continue}h.push(n.slice(p,o?b:S)),p=b,d++}if(h.push(n.slice(p)),i==null||i<0)return h;let _=i+1;if(a&&h.length<_)throw new M(`split exact error: expected string to split into at least ${_} parts, but got ${h.length}`);if(s)for(;h.length<_;)h.push(null);return h}function Ei(n,e,t,r,o,i){return n.replace(/\$\$|\$([$'`&]|\d{1,2}|<[^>]+>)/g,(s,a)=>{if(s==="$$")return"$";if(!a)return s;if(a==="$")return"$";if(a==="&")return e;if(a==="`")return r.slice(0,t);if(a==="'")return r.slice(t+e.length);if(a.startsWith("<")){if(i===void 0)return s;let u=a.slice(1,-1);return i[u]??""}let l=Number(a);if(l>0&&l<=o.length)return o[l-1]??"";if(a.length===2){let u=Number(a[0]);if(u>0&&u<=o.length)return(o[u-1]??"")+a[1]}return s})}function Xn(n,e,t,r){if(n==null||e==null||t==null)return null;let o=typeof n=="string"?n:String(n),{literal:i=!1,n:s,mode:a,...l}=r??{},u=s??(l?.global?1/0:1),c=v(u,{allowNonFiniteNumbers:!0,allowNaN:!1})?Math.trunc(u):1;if(c===0)return o;let f=i?pe(e,{mode:a}):e,m=it(o,f,{...l,global:l?.global??c!==1});if(!m)return o;let{reg:h}=m,p=typeof t=="function";if(c===1||c<0||c===1/0){if(i&&!p){let y=String(t);return o.replace(h,()=>y)}return o.replace(h,t)}let d=0,g=p?"":String(t);return o.replace(h,(...y)=>{if(d++>=c)return y[0];if(p)return String(t(...y));if(i)return g;let _=y.length,S=typeof y[_-1]=="object"&&y[_-1]!==null,b=S?y[_-1]:void 0,x=S?y[_-3]:y[_-2],A=y.slice(1,S?_-3:_-2);return Ei(g,y[0],x,o,A,b)})}function Ii(n,e,t,r){if(n==null||e==null)return null;let o=typeof n=="string"?n:String(n),i,s=null,a=null;if(!Array.isArray(e)&&typeof e=="object")i=Object.keys(e),s=Object.values(e);else if(Array.isArray(e))if(i=e,Array.isArray(t))if(t.length===1&&i.length>1)a=t[0];else{if(t.length!==i.length)throw new M(`replace_many length mismatch: expected ${i.length} replacement strings, got ${t.length}`);s=t}else if(t!=null)a=t;else return o;else return o;let l=i.length;if(l===0)return o;let u=[];for(let p=0;p<l;p++){let d=i[p],g=s?s[p]:a;if(d==null||g==null)continue;let y=sl(o,d,p,r,(_,S)=>{let b=Array.prototype.slice.call(_,1);if(typeof g=="function"){let x=[_[0],...b,S,o];return _.groups!==void 0&&x.push(_.groups),String(g(...x))}return r?.literal?String(g):Ei(String(g),_[0],S,o,b,_.groups)});for(let _=0;_<y.length;_++)u.push(y[_])}if(u.length===0)return o;let c=bi(u),f="",m=0,h=c.length;for(let p=0;p<h;p++){let d=c[p];f+=o.slice(m,d.start)+d.payload,m=d.end}return f+=o.slice(m),f}var Ba,Pa,La,Dt,nn,$a,hi,fi,di,Ka,qa,za,Ga,ru,Ha,nl,rl,xi,ol,il,mi,At=R(()=>{"use strict";ye();Yt();Tt();Gn();Ue();xe();X();Ba=/(\p{L})['’](\p{L})/gu,Pa=new RegExp(["\\p{Lu}+s(?!\\p{Ll})","\\p{Lu}+(?=\\p{Lu}\\p{Ll})","\\p{Lu}+\\p{Ll}*","\\p{Ll}+","\\p{N}+","\\p{L}+"].join("|"),"gu"),La=new Set(["__proto__","proto","constructor","prototype"]);Dt=typeof globalThis<"u"?globalThis.Buffer:void 0,nn=typeof Dt<"u",$a=typeof Uint8Array<"u"&&typeof Uint8Array.fromHex=="function",hi=typeof Uint8Array<"u"&&typeof Uint8Array.fromBase64=="function",fi=8192,di=new Array(256);for(let n=0;n<256;n++)di[n]=n.toString(16).padStart(2,"0");Ka={"-":"+",_:"/"},qa=/[-_]/g,za=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Ga=/^[0-9a-fA-F]*$/,ru=ze({handleCircular:!0});Ha={hex:Wa,base64:Xa};nl={hex:el,base64:tl};rl=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,xi="\\x00-\\x1F\\x7F\\u{D800}-\\u{DFFF}",ol=new RegExp(`[${xi}\\\\^$*+?.()|[\\]{}/#,=<>&!%:;@~'"\`-]`,"gu"),il=new RegExp(`[${xi}]|[\\x20-\\x2F\\x3A-\\x40\\x5B-\\x5E\\x5F\\x60\\x7B-\\x7E]`,"gu"),mi=n=>{let e=n.codePointAt(0),t=e<=ko||e===No,r=n.length===1&&e>=Mo&&e<=Uo;if(t||r){let o=Pn[e];if(o)return o;let i=e.toString(16);return t?`\\x${i.padStart(2,"0")}`:`\\u${i.padStart(4,"0")}`}return"\\"+n}});function ul(n){let e=Ci.get(n);return e||(e=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),Ci.set(n,e)),e}function cl(n,e){let t=`${n}_${e}`,r=Ri.get(t);return r||(r=new Intl.DateTimeFormat(n,{timeZoneName:"short",timeZone:e}),Ri.set(t,r)),r}function fl(n){let e=ki.get(n);if(e===void 0){try{Intl.DateTimeFormat(void 0,{timeZone:n}),e=!0}catch{e=!1}ki.set(n,e)}return e}function we(n){let e=!n||n==="local"?Intl.DateTimeFormat().resolvedOptions().timeZone:n;return fl(e)?e:"UTC"}function ee(n,e=0,t=1,r=0,o=0,i=0,s=0){let a=new Date(0);return a.setUTCFullYear(n,e,t),a.setUTCHours(r,o,i,s),a}function ml(n,e,t){let r=[0,3,2,5,0,3,5,1,4,6,2,4],o=n;return e<3&&(o-=1),(o+Math.floor(o/4)-Math.floor(o/100)+Math.floor(o/400)+r[e-1]+t)%7}function ae(n,e){let t=we(e);if(t.toUpperCase()==="UTC")return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),dayOfWeek:n.getUTCDay(),timeZone:"UTC"};let o=ul(t).formatToParts(n),i="0",s="0",a="0",l="0",u="0",c="0",f="0";for(let _=0,S=o.length;_<S;_++){let b=o[_];switch(b.type){case"year":i=b.value;break;case"month":s=b.value;break;case"day":a=b.value;break;case"hour":l=b.value;break;case"minute":u=b.value;break;case"second":c=b.value;break;case"fractionalSecond":f=b.value;break}}let m=parseInt(i,10),h=parseInt(s,10),p=parseInt(a,10),d=parseInt(l,10);d===24&&(d=0);let g=Math.round(parseFloat("0."+f)*1e3)||0,y=ml(m,h,p);return{year:m,month:h,day:p,hour:d,minute:parseInt(u,10),second:parseInt(c,10),ms:g,dayOfWeek:y,timeZone:t}}function st(n,e){let t=we(e);if(t.toUpperCase()==="UTC")return 0;let r=ae(n,"UTC"),o=ae(n,t),i=ee(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.ms).getTime(),s=ee(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.ms).getTime();return Math.round((s-i)/_e)}function Ni(n,e){let t=n>=0?"+":"-",r=Math.abs(n),o=String(Math.floor(r/60)).padStart(2,"0"),i=String(r%60).padStart(2,"0");return e==="iso"?`${t}${o}:${i}`:`${t}${o}${i}`}function J(n,e){let t=ie(n);if(t==null)return null;let r=null;if(P(t))r=t;else if(typeof t=="number"||typeof t=="bigint")r=new Date(pl(t));else if(typeof t=="string"){if(Qt(t))return null;r=new Date(t)}if(!r||!P(r))return null;if(e?.dateOnly){let o=typeof t=="string",i=o&&ll.test(t),s=o&&!i&&!Mi.test(t)?"local":"UTC",a=ae(r,s);return ee(a.year,a.month-1,a.day)}return r}function on(n){let e=ie(n);if(e==null)return null;let t=null;if(typeof e=="string"){let o=e.trim();if(al.test(o)){let i=Mi.test(o);t=J(`1970-01-01T${o}${i?"":"Z"}`)}}let r=t||J(e);return r?Ge(r,{format:"%H:%M:%S.%ms"}):null}function Ui(n,e="ms"){let t=n.getTime();switch(e){case"s":return Math.floor(t/et);case"ms":return t;case"us":return BigInt(t)*jn;case"ns":return BigInt(t)*Bn}}function pl(n){if(typeof n=="bigint"){let t=n<0n?-n:n;return t<=30000000000n?Number(n)*1e3:t<=30000000000000n?Number(n):t<=30000000000000000n?Number(n/jn):Number(n/Bn)}let e=Math.abs(n);return e<=3e10?n*1e3:e<=3e13?n:e<=3e16?Math.floor(n/1e3):Math.floor(n/1e6)}function vi(n){if(!P(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/100)+1}function Hn(n,e={field:"week"}){if(!P(n))return null;let t=ee(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r=t.getUTCDay()||7;if(t.setUTCDate(t.getUTCDate()+4-r),e.field==="year")return t.getUTCFullYear();let o=ee(t.getUTCFullYear(),0,1),i=Math.round((t.getTime()-o.getTime())/Me);return Math.floor(i/7)+1}function Fi(n){if(!P(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/1e3)+1}function sn(n,e,t=1){return P(n)?ee(n.getUTCFullYear(),n.getUTCMonth()+e,t):null}function Yn(n){if(!P(n))return null;let e=ee(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()).getTime(),t=ee(n.getUTCFullYear(),0,1).getTime();return Math.floor((e-t)/Me)+1}function ji(n){return P(n)?Math.floor(n.getUTCMonth()/3)+1:null}function Zn(n){let e;if(P(n))e=n.getUTCFullYear();else if(v(n))e=n;else return!1;return e%4===0&&e%100!==0||e%400===0}function Bi(n){return n.replace(/%[FTRD]/g,e=>dl[e]||e)}function gl(n){let e=n.replace(":",""),t=e[0]==="+"?1:-1,r=parseInt(e.slice(1,3),10)||0,o=parseInt(e.slice(3,5),10)||0;return t*(r*60+o)}function Ge(n,{format:e,locale:t,timeZone:r="UTC"}){if(!P(n)||typeof e!="string")return"";let o=t&&t.trim()||Intl.DateTimeFormat().resolvedOptions().locale||"en-US",i=Bi(e),s=null,a=()=>s??=ae(n,r);return i.replace(rn,(l,u)=>{if(u==="%")return"%";let c=Qn[u];return c?c.format(n,o,r,a()):l})}function Pi(n,{format:e,strict:t=!0,defaultTimeZone:r="UTC"}){if(typeof n!="string"||typeof e!="string")return null;let o=Bi(e),i=[],s="",a=0;rn.lastIndex=0;let l;for(;(l=rn.exec(o))!==null;){let d=o.slice(a,l.index);s+=pe(d);let g=l[1];if(g==="%")s+="\\%";else{let y=Qn[g];y&&y.parseRegex?(i.push(y),s+=`(${y.parseRegex})`):s+=pe(l[0])}a=rn.lastIndex}s+=pe(o.slice(a));let u=new RegExp("^\\s*"+s+"\\s*$"),c=n.match(u);if(!c)return t?null:J(n);let f={year:1970,month:1,day:1,hour:0,minute:0,second:0,ms:0,offset:null},m=null,h=!1;for(let d=0;d<i.length;d++){let g=c[d+1],y=i[d],_=y.parseNormalize?y.parseNormalize(g):parseInt(g,10);y.key==="j"&&(h=!0),y.parseField==="ampm"?m=_:y.parseField==="offset"?f.offset=_:y.parseField&&(f[y.parseField]=_)}if(m&&(m==="PM"&&f.hour<12&&(f.hour+=12),m==="AM"&&f.hour===12&&(f.hour=0)),h){let d=Zn(f.year)?366:365;if(f.day<1||f.day>d)return null;let g=ee(f.year,0,1);g.setUTCDate(f.day),f.month=g.getUTCMonth()+1,f.day=g.getUTCDate()}let p=ee(f.year,f.month-1,f.day,f.hour,f.minute,f.second,f.ms);if(!P(p)||p.getUTCFullYear()!==f.year||p.getUTCMonth()+1!==f.month||p.getUTCDate()!==f.day||p.getUTCHours()!==f.hour||p.getUTCMinutes()!==f.minute||p.getUTCSeconds()!==f.second||p.getUTCMilliseconds()!==f.ms)return null;if(f.offset)p=new Date(p.getTime()-gl(f.offset)*_e);else if(r.toUpperCase()!=="UTC"){let d=we(r),g=st(p,d);p=new Date(p.getTime()-g*_e);let y=st(p,d);y!==g&&(p=new Date(p.getTime()-(y-g)*_e))}return P(p)?p:null}function Li(n,e,{excludeWeekdays:t=[],holidays:r=[],roll:o}={}){if(!De(e))throw new ne(`The offset parameter 'n' must be a whole integer. Received: ${e}`);if(t.length===0&&(!r||Array.isArray(r)&&r.length===0||r instanceof Set&&r.size===0)&&!o)return e;if(7-t.length<=0)throw new ne("All weekdays are excluded; cannot offset.");let s=new Set;if(r instanceof Set)for(let f of r){let m=new Date(f);t.includes(m.getUTCDay())||s.add(f)}else if(Array.isArray(r))for(let f=0;f<r.length;f++){let m=J(r[f]);if(!m||t.includes(m.getUTCDay()))continue;let h=ee(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate());s.add(h.getTime())}let a=f=>t.includes(f.getUTCDay())?!0:s.has(f.getTime()),l=ee(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),u=new Date(l.getTime());if(o&&a(u)){if(o==="raise")throw new ne("Start date falls on an excluded day or holiday.");let f=o==="forward"?1:-1;for(;a(u);)u.setUTCDate(u.getUTCDate()+f)}if(e!==0){let f=e>0?1:-1,m=0,h=Math.abs(e);for(;m<h;)u.setUTCDate(u.getUTCDate()+f),a(u)||m++}let c=u.getTime()-l.getTime();return Math.round(c/Me)}function er(n,e,t){let r=we(e),o=t?.type??"total",i;if(o==="total")i=st(n,r);else{let l=ae(n,r).year,u=st(ee(l,0,1),r),c=st(ee(l,6,1),r),f=Math.min(u,c);o==="daylightSavingTime"?i=st(n,r)-f:i=f}switch(t?.format??"milliseconds"){case"minutes":return i;case"hours":return i/60;case"iso":return Ni(i,"iso");case"basic":return Ni(i,"basic");default:return i*_e}}function Vi(n,e={}){if(!P(n))return null;let t=e.excludeWeekdays??[0,6],r=n.getUTCDay();if(t.includes(r))return!1;let o=e.holidays;if(o){if(o instanceof Set){let i=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(o.has(i))return!1}else if(Array.isArray(o)&&o.length>0){let i=new Set;for(let a=0;a<o.length;a++){let l=J(o[a]);l&&i.add(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))}let s=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(i.has(s))return!1}}return!0}function $i(n,e={}){let t=ae(n,e?.timeZone??void 0),r=e?.year??t.year,o=e?.month!=null?e.month-1:t.month-1,i=e?.day??t.day,s=e?.hour??t.hour,a=e?.minute??t.minute,l=e?.second??t.second,u=e?.ms??t.ms;return ee(r,o,i,s,a,l,u)}var al,Mi,ll,Ci,Ri,ki,Qn,hl,rn,dl,Zt=R(()=>{"use strict";At();X();ye();Ue();xe();al=/^\d{2}:\d{2}/,Mi=/(?:Z|[+-]\d{2}(?::?\d{2})?)$/i,ll=/^\d{4}-\d{2}-\d{2}$/,Ci=new Map;Ri=new Map;ki=new Map;Qn={Y:{key:"Y",format:(n,e,t,r)=>{let o=r.year;return o>=0?String(o).padStart(4,"0"):"-"+String(Math.abs(o)).padStart(4,"0")},parseRegex:"[+-]?\\d{4,}",parseField:"year"},y:{key:"y",format:(n,e,t,r)=>String(Math.abs(r.year)%100).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"year",parseNormalize:n=>{let e=parseInt(n,10);return e+(e>=69?1900:2e3)}},m:{key:"m",format:(n,e,t,r)=>String(r.month).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"month"},d:{key:"d",format:(n,e,t,r)=>String(r.day).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"day"},e:{key:"e",format:(n,e,t,r)=>String(r.day).padStart(2," "),parseRegex:"\\s?\\d{1,2}",parseField:"day"},H:{key:"H",format:(n,e,t,r)=>String(r.hour).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},I:{key:"I",format:(n,e,t,r)=>String(r.hour%12||12).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},p:{key:"p",format:(n,e,t,r)=>r.hour>=12?"PM":"AM",parseRegex:"AM|PM|am|pm",parseField:"ampm",parseNormalize:n=>n.toUpperCase()},M:{key:"M",format:(n,e,t,r)=>String(r.minute).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"minute"},S:{key:"S",format:(n,e,t,r)=>String(r.second).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"second"},A:{key:"A",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"long",timeZone:we(t)})},a:{key:"a",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"short",timeZone:we(t)})},B:{key:"B",format:(n,e,t)=>n.toLocaleDateString(e,{month:"long",timeZone:we(t)})},b:{key:"b",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:we(t)})},h:{key:"h",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:we(t)})},j:{key:"j",format:(n,e,t,r)=>String(Yn(ee(r.year,r.month-1,r.day))??1).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"day",parseNormalize:n=>parseInt(n,10)},u:{key:"u",format:(n,e,t,r)=>String(r.dayOfWeek||7)},w:{key:"w",format:(n,e,t,r)=>String(r.dayOfWeek)},Z:{key:"Z",format:(n,e,t)=>{let r=we(t);if(r.toUpperCase()==="UTC")return"UTC";let o=cl(e,r).formatToParts(n);for(let i=0,s=o.length;i<s;i++)if(o[i].type==="timeZoneName")return o[i].value;return"UTC"}},z:{key:"z",format:(n,e,t)=>er(n,t,{format:"basic"}),parseRegex:"[+-]\\d{2}(?::?\\d{2})?",parseField:"offset",parseNormalize:n=>n.replace(":","")},ms:{key:"ms",format:(n,e,t,r)=>String(r.ms).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"ms",parseNormalize:n=>parseInt(n,10)},f:{key:"f",format:(n,e,t,r)=>String(r.ms).padStart(3,"0").padEnd(6,"0"),parseRegex:"\\d{1,9}",parseField:"ms",parseNormalize:n=>parseInt(n.padEnd(6,"0").slice(0,3),10)}},hl=Object.keys(Qn).concat("%").sort((n,e)=>e.length-n.length),rn=new RegExp("%("+hl.join("|")+")","g"),dl={"%F":"%Y-%m-%d","%T":"%H:%M:%S","%R":"%H:%M","%D":"%m/%d/%y"}});var te,at,an,Je,We,Et,Xe,It,ln=R(()=>{"use strict";te=class n{matches(e){if(e==null)return!1;if(e instanceof n)return!!(this.equals(e)||this.name.startsWith("Decimal")&&e.name.startsWith("Decimal")&&e.precision===void 0&&e.scale===void 0);if(typeof e=="function"){if(e.prototype instanceof n)return this instanceof e;try{let t=e();if(t instanceof n)return this.constructor===t.constructor}catch{}}return!1}get isNumeric(){return!1}get isInteger(){return!1}get isFloat(){return!1}get isSigned(){return!1}get isUnsigned(){return!1}get isTemporal(){return!1}get isNested(){return!1}get isBoolean(){return!1}get isString(){return!1}get isUtf8(){return!1}get isObject(){return!1}get isNull(){return!1}get isBinary(){return!1}},at=class extends te{get isNumeric(){return!0}},an=class extends at{get isInteger(){return!0}},Je=class extends an{get isSigned(){return!0}},We=class extends an{get isUnsigned(){return!0}},Et=class extends at{get isFloat(){return!0}},Xe=class extends te{get isTemporal(){return!0}},It=class extends te{get isNested(){return!0}}});var tr,Ki,nr,qi,rr,zi,or,un,ir,Gi,sr,Ji,ar,Wi,lr,Xi,lt,Hi,ut,cn,Be,ur,fn,cr,Rt,fr,Yi,mr,Zi,pr,Qi,hr,es,Ie,mn,dr,ts,he,ns,ct,rs,Ct,os,ft=R(()=>{"use strict";ln();q();tr=class extends Je{name="Int8";coerce(e){return se(e,{range:"Int8"})}equals(e){return e.name==="Int8"}allocate(e){return new Int8Array(e)}},Ki=new tr,nr=class extends Je{name="Int16";coerce(e){return se(e,{range:"Int16"})}equals(e){return e.name==="Int16"}allocate(e){return new Int16Array(e)}},qi=new nr,rr=class extends Je{name="Int32";coerce(e){return se(e,{range:"Int32"})}equals(e){return e.name==="Int32"}allocate(e){return new Int32Array(e)}},zi=new rr,or=class extends Je{name="Int64";coerce(e){return Oe(e,{truncate:!0})}equals(e){return e.name==="Int64"}allocate(e){return new BigInt64Array(e)}},un=new or,ir=class extends We{name="UInt8";coerce(e){return se(e,{range:"UInt8"})}equals(e){return e.name==="UInt8"}allocate(e){return new Uint8Array(e)}},Gi=new ir,sr=class extends We{name="UInt16";coerce(e){return se(e,{range:"UInt16"})}equals(e){return e.name==="UInt16"}allocate(e){return new Uint16Array(e)}},Ji=new sr,ar=class extends We{name="UInt32";coerce(e){return se(e,{range:"UInt32"})}equals(e){return e.name==="UInt32"}allocate(e){return new Uint32Array(e)}},Wi=new ar,lr=class extends We{name="UInt64";coerce(e){return Oe(e,{range:"UInt64"})}equals(e){return e.name==="UInt64"}allocate(e){return new BigUint64Array(e)}},Xi=new lr,lt=class extends Et{name="Float32";coerce(e){return Ln(e,{floatPrecision:"Float32"})}equals(e){return e.name==="Float32"}allocate(e){return new Float32Array(e)}},Hi=new lt,ut=class extends Et{name="Float64";coerce(e){return Ln(e,{floatPrecision:"Float64"})}equals(e){return e.name==="Float64"}allocate(e){return new Float64Array(e)}},cn=new ut,Be=class n extends at{constructor(t,r){super();this.precision=t;this.scale=r;this.name=t!==void 0&&r!==void 0?`Decimal(${t}, ${r})`:"Decimal"}precision;scale;name;coerce(t){return Kt(t,{precision:this.precision,scale:this.scale})}equals(t){return t instanceof n&&this.precision===t.precision&&this.scale===t.scale}allocate(t){return new Array(t).fill(null)}},ur=class extends te{name="Boolean";get isBoolean(){return!0}coerce(e){return e==null?null:!!e}equals(e){return e.name==="Boolean"}allocate(e){return new Array(e).fill(null)}},fn=new ur,cr=class extends te{name="Utf8";get isString(){return!0}get isUtf8(){return!0}coerce(e){return e==null?null:String(e)}equals(e){return e.name==="Utf8"}allocate(e){return new Array(e).fill(null)}},Rt=new cr,fr=class extends te{name="Binary";get isBinary(){return!0}coerce(e){return en(e)}equals(e){return e.name==="Binary"}allocate(e){return new Array(e).fill(null)}},Yi=new fr,mr=class extends te{name="Null";get isNull(){return!0}coerce(e){return null}equals(e){return e.name==="Null"}allocate(e){return new Array(e).fill(null)}},Zi=new mr,pr=class extends te{name="Object";get isObject(){return!0}coerce(e){return e===void 0?null:e}equals(e){return e.name==="Object"}allocate(e){return new Array(e).fill(null)}},Qi=new pr,hr=class extends Xe{name="Date";coerce(e){return J(e,{dateOnly:!0})}equals(e){return e.name==="Date"}allocate(e){return new Array(e).fill(null)}},es=new hr,Ie=class n extends Xe{name="Datetime";timeUnit;timeZone;constructor(e="ms",t=null){super(),this.timeUnit=e,this.timeZone=t}coerce(e){return J(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit&&e.timeZone===this.timeZone}allocate(e){return new Array(e).fill(null)}},mn=new Ie,dr=class extends Xe{name="Time";coerce(e){return on(e)}equals(e){return e.name==="Time"}allocate(e){return new Array(e).fill(null)}},ts=new dr,he=class n extends Xe{name="Duration";timeUnit;constructor(e="ms"){super(),this.timeUnit=e}coerce(e){return j(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit}allocate(e){return new Array(e).fill(null)}},ns=new he,ct=class n extends It{constructor(t){super();this.innerType=t}innerType;name="Array";coerce(t){if(t==null)return null;let r=k(t)?Array.from(t):[t],o=r.length,i=new Array(o);for(let s=0;s<o;s++)i[s]=this.innerType.coerce(r[s]);return i}equals(t){return t instanceof n&&this.innerType.equals(t.innerType)}allocate(t){return new Array(t).fill(null)}},rs=n=>new ct(n),Ct=class n extends It{constructor(t){super();this.fields=t}fields;name="Struct";coerce(t){if(!F(t))return null;let r={},o=Object.keys(this.fields),i=o.length;for(let s=0;s<i;s++){let a=o[s],l=this.fields[a];r[a]=l.coerce(t[a])}return r}equals(t){if(!(t instanceof n))return!1;let r=Object.keys(this.fields),o=Object.keys(t.fields);if(r.length!==o.length)return!1;for(let i=0;i<r.length;i++){let s=r[i];if(!this.fields[s].equals(t.fields[s]))return!1}return!0}allocate(t){return new Array(t).fill(null)}},os=n=>new Ct(n)});var E,Ce=R(()=>{"use strict";ln();ft();ft();ln();E={Int8:Ki,Int16:qi,Int32:zi,Int64:un,UInt8:Gi,UInt16:Ji,UInt32:Wi,UInt64:Xi,Float32:Hi,Float64:cn,Decimal:(n,e)=>new Be(n,e),Boolean:fn,Utf8:Rt,Binary:Yi,Date:es,Datetime:mn,Time:ts,Duration:ns,Object:Qi,Null:Zi,Array:rs,Struct:os}});function _l(n={}){let e=n.nullValue!==void 0?n.nullValue:"",t=$o(n.numericFormatOptions),r=n.replacerOptions||{},o=a=>n.datetimeFormat?Ge(a,{format:n.datetimeFormat}):n.dateFormat?Ge(a,{format:n.dateFormat}):n.timeFormat?Ge(a,{format:n.timeFormat}):a.toISOString(),i=ze({formatDate:o,...r}),s=typeof r.onBigInt=="function";return a=>{if(a==null||typeof a=="symbol"||typeof a=="function")return{str:e,isNumeric:!1};if(typeof a=="bigint"&&!s&&!r.voidBigIntReplacement)return{str:t(a),isNumeric:!0};let l=i.call(null,"",a),u=ie(l);return u==null||typeof u=="symbol"||typeof u=="function"?{str:e,isNumeric:!1}:typeof u=="string"?{str:u,isNumeric:!1}:typeof u=="number"||typeof u=="bigint"?{str:t(u),isNumeric:!0}:typeof u=="boolean"?{str:u?"true":"false",isNumeric:!1}:typeof u=="object"?{str:JSON.stringify(u,ze({formatDate:o,...r})),isNumeric:!1}:{str:String(u),isNumeric:!1}}}function hn(n,e,t={}){let{separator:r=",",quoteChar:o='"',includeHeader:i=!0,lineTerminator:s=`
|
|
2
|
+
`,quoteStyle:a="necessary",includeBom:l=!1,onRow:u,...c}=t,f=Object.keys(n),m=f.length,h=[],p=!0,d=_l(c),g=(_,S=!1)=>{let b,x=!1;if(S)b=String(_);else{let w=d(_);b=w.str,x=w.isNumeric}if(a==="never")return b;if(a==="always"){let w=b.split(o).join(o+o);return o+w+o}if(a==="non_numeric"&&!x&&_!=null){let w=b.split(o).join(o+o);return o+w+o}if(b.includes(r)||b.includes(o)||b.includes(`
|
|
3
|
+
`)||b.includes("\r")){let w=b.split(o).join(o+o);return o+w+o}return b},y=_=>{if(p){let S=l?"\uFEFF"+_:_;u?u(S):h.push(S),p=!1}else u?u(s+_):h.push(_)};if(i){let _=new Array(m);for(let S=0;S<m;S++)_[S]=g(f[S],!0);y(_.join(r))}for(let _=0;_<e;_++){let S=new Array(m);for(let b=0;b<m;b++)S[b]=g(n[f[b]][_],!1);y(S.join(r))}return u?l?"\uFEFF":"":h.join(s)}function is(n,e={}){let t=e.separator||",",r=e.quoteChar||'"',o=n;o.startsWith("\uFEFF")&&(o=o.substring("\uFEFF".length));let i=[],s=[],a="",l=!1,u=!1,c=!1,f=o.length;for(let m=0;m<f;m++){let h=o[m];if(l)u=!0,c=!1,h===r?m+1<f&&o[m+1]===r?(a+=r,m++):l=!1:a+=h;else if(h===r)u=!0,c=!1,l=!0;else if(h===t)s.push(a),a="",c=!0;else{let p=!1;h==="\r"?(p=!0,m+1<f&&o[m+1]===`
|
|
4
|
+
`&&m++):h===`
|
|
5
|
+
`&&(p=!0),p?(u||s.length>0||a!==""||c)&&(s.push(a),i.push(s),s=[],a="",u=!1,c=!1):(u=!0,c=!1,a+=h)}}return(u||s.length>0||a!==""||c)&&(s.push(a),i.push(s)),i}function ss(n,e={}){let t=new Set(e.nullValues??["","NA","null","NaN"]),r=n.length,o=!0,i=!0,s=!0,a=!0,l=!1;for(let c=0;c<r;c++){let f=n[c].trim();if(!t.has(f)){if(l=!0,o){let m=f.toLowerCase();m!=="true"&&m!=="false"&&m!=="1"&&m!=="0"&&(o=!1)}if(s&&Oe(f,{truncate:!1})===null&&(s=!1),i&&j(f,{allowNonFiniteNumbers:!0})===null&&(i=!1),a&&J(f)===null&&(a=!1),!o&&!i&&!s&&!a)break}}let u=new Array(r);if(!l||!o&&!i&&!s&&!a){for(let c=0;c<r;c++){let f=n[c];u[c]=t.has(f.trim())?null:f}return{type:Rt,values:u}}if(o){for(let c=0;c<r;c++){let f=n[c].trim();if(t.has(f))u[c]=null;else{let m=f.toLowerCase();u[c]=m==="true"||m==="1"}}return{type:fn,values:u}}if(s){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:Oe(f,{truncate:!1})}return{type:un,values:u}}if(i){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:j(f,{allowNonFiniteNumbers:!0})}return{type:cn,values:u}}if(a){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:J(f)}return{type:mn,values:u}}return{type:Rt,values:u}}var as=R(()=>{"use strict";Zt();Tt();Ue();Ce();ye()});function ls(n,e){return e==="us"?n*1e3:e==="ns"?n*1e6:n}var us=R(()=>{"use strict"});var q=R(()=>{"use strict";ye();Ue();Zt();Yt();At();Tt();as();Gn();us()});function Y(n,e,t,r=""){if(!(n in e))throw new Pe(n,`${t} "${n}" does not exist${r}`)}function yr(n,e){let t=Object.keys(n),r=t.length,o=e;for(let i=0;i<r;i++){let s=t[i],a=n[s],l=k(a)?a.length:0;if(o===void 0)o=l;else if(l!==o)throw new re(`Column height mismatch: Column "${s}" has length ${l}, but DataFrame height is ${o}`)}return o===void 0?0:o}function dn(n,e="Value cannot be null or undefined"){if(n==null)throw new M(e);return n}function Lu(n,e){if(!n)throw new M(e)}var cs=R(()=>{"use strict";X();q()});var Le,z,Pe,He,ne,re,M,je,X=R(()=>{"use strict";cs();Le=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},z=class extends Le{},Pe=class extends z{constructor(e,t){super(t||`Column "${e}" does not exist in the DataFrame.`)}},He=class extends Le{},ne=class extends Le{},re=class extends Le{},M=class extends Le{},je=class extends Le{}});function xl(n,e,t){let r=new Map,o=t.length,i=new Array(o);for(let s=0;s<o;s++){let a=t[s];typeof a=="string"?(Y(a,n,"Partition key"," in the DataFrame."),i[s]=n[a]):i[s]=a.evaluate(n,e)}if(o===1){let s=i[0];for(let a=0;a<e;a++){let l=s[a],u=l==null?"":G(l),c=r.get(u);c===void 0&&(c=[],r.set(u,c)),c.push(a)}return r}for(let s=0;s<e;s++){let a=new Array(o);for(let c=0;c<o;c++){let f=i[c][s];a[c]=f==null?"":G(f)}let l=a.join(tt),u=r.get(l);u===void 0&&(u=[],r.set(l,u)),u.push(s)}return r}function fs(n,e,t){let r=new Array(t);if(t===0)return r;let o=n._partitionBy||[],i=xl(e,t,o),s=n._evaluatePre(n._partitionOpsIndex,e,t);for(let a of i.values()){let l=a.length,u=new Array(l);for(let c=0;c<l;c++)u[c]=s[a[c]];if(n._evaluateWindow){for(let c=0;c<l;c++)r[a[c]]=n._evaluateWindow(u,a,c);continue}if(n._aggFn){let c=n._aggFn(u);for(let f=0;f<l;f++)r[a[f]]=c;continue}for(let c=0;c<l;c++)r[a[c]]=s[a[c]]}return n._evaluatePost(n._partitionOpsIndex,r,e)}function ms(n){if(!Array.isArray(n)||n.length===0)return{columns:{},height:0};let e=n.length,t=new Set;for(let i=0;i<e;i++){let s=n[i];if(F(s)){let a=Object.keys(s);for(let l=0;l<a.length;l++)t.add(a[l])}}let r=Array.from(t),o={};for(let i=0;i<r.length;i++)o[r[i]]=new Array(e);for(let i=0;i<e;i++){let s=n[i]||{};for(let a=0;a<r.length;a++){let l=r[a],u=s[l];o[l][i]=u===void 0?null:u}}return{columns:o,height:e}}function ps(n,e){let t=Object.keys(n),r=new Array(e);for(let o=0;o<e;o++){let i={};for(let s=0;s<t.length;s++){let a=t[s],l=n[a][o];i[a]=l===void 0?null:l}r[o]=i}return r}function Xu(n,e,t){let r={};for(let o=0;o<t.length;o++){let i=t[o],s=n[i][e];r[i]=s===void 0?null:s}return r}function $e(n){if(n.length===0)return E.Utf8;let e=!0,t=!0,r=!0,o=!0,i=!0,s=!0,a=!0,l=!0,u=!1,c=!1,f=[];for(let m=0;m<n.length;m++){let h=n[m];if(h!=null){if(c=!0,h instanceof Uint8Array||(a=!1),!k(h)||h instanceof Uint8Array)s=!1;else{let p=h,d=p.length;for(let g=0;g<d;g++)f.push(p[g])}P(h)&&(u=!0),typeof h!="boolean"&&(e=!1),typeof h!="bigint"&&(o=!1),typeof h!="number"?(r=!1,t=!1):Number.isInteger(h)||(t=!1),!P(h)&&(typeof h!="string"||isNaN(Date.parse(h)))&&(i=!1),(!F(h)||h instanceof Uint8Array)&&(l=!1)}}if(!c)return E.Null;if(a)return E.Binary;if(s){let m=$e(f);return E.Array(m)}if(e)return E.Boolean;if(o)return E.Int64;if(r&&!t)return E.Float64;if(r&&t){let m=!0;for(let h=0;h<n.length;h++){let p=n[h];if(p!=null&&(p<-2147483648||p>2147483647)){m=!1;break}}return m?E.Int32:E.Float64}return i&&u?E.Datetime:l?E.Object:E.Utf8}function kt(n,e){let t=Object.keys(n),r=t.length,o=e.length,i={};for(let s=0;s<r;s++){let a=t[s],l=n[a],u=K(l)?new l.constructor(o):new Array(o);for(let c=0;c<o;c++)u[c]=l[e[c]];i[a]=u}return i}function Ve(n,e,t){let r=e.length;if(r===1)return G(n[e[0]][t]);let o=new Array(r);for(let i=0;i<r;i++)o[i]=G(n[e[i]][t]);return o.join(tt)}function Re(n,e,t){let r=e.allocate?e.allocate(t):new Array(t);if(K(r)){let i=r;for(let s=0;s<t;s++){let a=e.coerce(n[s]);if(a==null){let l=new Array(t);for(let u=0;u<s;u++)l[u]=i[u];l[s]=null;for(let u=s+1;u<t;u++)l[u]=e.coerce(n[u]);return l}i[s]=a}}else for(let i=0;i<t;i++)r[i]=e.coerce(n[i]);return r}function hs(n,e){if(n)if(typeof n=="string"){if(typeof Ze!="function")throw new je("File writing is not supported in this environment (missing require('fs')).");Ze("fs").writeFileSync(n,e,"utf8")}else if(F(n)&&typeof n.write=="function")n.write(e);else throw new M("Invalid file argument. Expected a file path string or a writable stream/object with a write method.")}function ds(n,e,t,r,o,i,s={}){let{how:a="inner",join_nulls:l=!1,maintain_order:u}=s,c=(w,D,O)=>{if(!l){for(let C=0;C<D.length;C++)if(w[D[C]][O]==null)return null}return Ve(w,D,O)};if(a==="cross")return ei(t,r);let f=new Map;for(let w=0;w<r;w++){let D=c(e,i,w);if(D===null)continue;let O=f.get(D);O===void 0&&(O=[],f.set(D,O)),O.push(w)}let m=[],h=[];if(a==="semi"||a==="anti"){for(let w=0;w<t;w++){let D=c(n,o,w),O=D===null?void 0:f.get(D),C=O!==void 0&&O.length>0;(a==="semi"&&C||a==="anti"&&!C)&&(m.push(w),h.push(null))}return{leftIndices:m,rightIndices:h}}let p=a==="outer"||a==="right",d=p?new Set:null;for(let w=0;w<t;w++){let D=c(n,o,w),O=D===null?void 0:f.get(D);if(O===void 0)(a==="left"||a==="outer")&&(m.push(w),h.push(null));else for(let C=0;C<O.length;C++){let N=O[C];p&&d.add(N),m.push(w),h.push(N)}}if(p)for(let w=0;w<r;w++)d.has(w)||(m.push(bt),h.push(w));let g=u||"none";if(g==="none"||g==="left")return{leftIndices:m,rightIndices:h};let y=m.length,_=new Int32Array(y);for(let w=0;w<y;w++)_[w]=w;let S=w=>m[w]===bt?Number.MAX_SAFE_INTEGER:m[w],b=w=>h[w]??Number.MAX_SAFE_INTEGER;g==="right"?_.sort((w,D)=>b(w)-b(D)||w-D):g==="left_right"?_.sort((w,D)=>S(w)-S(D)||b(w)-b(D)||w-D):g==="right_left"&&_.sort((w,D)=>b(w)-b(D)||S(w)-S(D)||w-D);let x=new Array(y),A=new Array(y);for(let w=0;w<y;w++){let D=_[w];x[w]=m[D],A[w]=h[D]}return{leftIndices:x,rightIndices:A}}function gs(n,e,t,r,o,i,s,a,l={}){let u=l.strategy??"backward",c=l.allow_exact_matches??!0,f=l.check_sorted??!0;Y(o,n,"Join on key"," in the left DataFrame."),Y(i,e,"Join on key"," in the right DataFrame.");let m=n[o],h=e[i];if(f){let x=(A,w,D,O)=>{for(let C=1;C<w;C++){let N=j(A[C-1]),H=j(A[C]);if(v(N)&&v(H)&&H<N)throw new M(`${O} DataFrame key column "${D}" is not sorted in ascending order at row ${C}.`)}};x(m,t,o,"left"),x(h,r,i,"right")}let p=s.length>0,d=new Map;if(p)for(let x=0;x<r;x++){let A=Ve(e,a,x),w=d.get(A);w||(w=[],d.set(A,w)),w.push(x)}let g=new Array(r);if(!p)for(let x=0;x<r;x++)g[x]=x;let y=new Array(t),_=new Array(t),S=(x,A)=>{let w=A.length;if(w===0)return null;let D=(W,le)=>j(h[le])??NaN;if(u==="backward"){let W=Xt(A,x,{side:c?"right":"left",getValue:D})-1;return W>=0?A[W]:null}if(u==="forward"){let W=Xt(A,x,{side:c?"left":"right",getValue:D});return W<w?A[W]:null}let O=Xt(A,x,{side:"right",getValue:D}),C=O-1,N=O;if(c||(C>=0&&D(C,A[C])===x&&C--,N<w&&D(N,A[N])===x&&N++),C<0)return N<w?A[N]:null;if(N>=w)return C>=0?A[C]:null;let H=D(C,A[C]),Z=D(N,A[N]);return Math.abs(x-H)<=Math.abs(x-Z)?A[C]:A[N]},b=l.tolerance!==void 0?j(l.tolerance):null;for(let x=0;x<t;x++){y[x]=x;let A=j(m[x]);if(!v(A)){_[x]=null;continue}let w=p?d.get(Ve(n,s,x))||[]:g;if(w.length===0){_[x]=null;continue}let D=S(A,w);if(D!==null&&b!==null){let O=j(h[D]);(!v(b)||!v(O)||Math.abs(A-O)>b)&&(D=null)}_[x]=D}return{leftIndices:y,rightIndices:_}}function _r(n,e,t,r,o,i,s,a,l={}){let[u="",c="_right"]=l.suffixes||[],f=l.coalesce??!0,m=l.how||"inner",h=o.length,p={},d={},g=new Set(s),y=new Set(a),_=(D,O)=>{let C=O!==""?O:"_left",N=`${D}${C}`,H=1;for(;x.has(N);)N=`${D}${C}_${H++}`;return x.add(N),N},S=(D,O,C=bt)=>{let N=O.length,H=new Array(N);for(let Z=0;Z<N;Z++){let W=O[Z];H[Z]=W!==null&&W!==C?D[W]:null}return H},b=new Map;for(let D=0;D<s.length;D++)b.has(s[D])||b.set(s[D],a[D]);let x=new Set,A=Object.keys(n),w=Object.keys(e);for(let D=0;D<A.length;D++){let O=A[D];(!(O in e)||g.has(O)||y.has(O))&&x.add(O)}for(let D=0;D<A.length;D++){let O=A[D],C=g.has(O),N;O in e&&!C&&!y.has(O)?u!==""?(x.add(O),N=_(O,u)):x.has(O)?N=_(O,u):(N=O,x.add(O)):N=O;let H=n[O],Z=C?b.get(O):null,W=Z?e[Z]:null;if(C&&f){let le=new Array(h);for(let fe=0;fe<h;fe++){let Ft=o[fe],Ye=i[fe],Vs=Ft!==bt?H[Ft]:null,$s=Ye!==null&&W?W[Ye]:null;le[fe]=Vs??$s}p[N]=le}else p[N]=S(H,o);t[O]?d[N]=t[O]:Z&&r[Z]&&(d[N]=r[Z])}if(m!=="semi"&&m!=="anti")for(let D=0;D<w.length;D++){let O=w[D];if(f&&y.has(O))continue;let C;x.has(O)?C=_(O,c):(C=O,x.add(O)),p[C]=S(e[O],i),r[O]&&(d[C]=r[O])}return L._createDirect(p,d,h)}var gn=R(()=>{"use strict";mt();Ce();xe();q();X()});function bl(n,e){if(n==null)return null;let t=P(n)?n.getTime():n;return e(t)}function ys(n,e,t){if(n==null||e==null)return null;let r=P(n)?n.getTime():n,o=P(e)?e.getTime():e;return t(r,o)}function de(n,e,t){return n._isWindow?fs(n,e,t):n.evaluate(e,t)}function pt(n,e,t){return typeof n=="object"&&n!==null&&"_ops"in n?de(n,e||{},t):typeof n=="string"&&e!=null&&n in e?e[n]:n}function ht(n,e,t,r){return!k(e)||e.length!==r?!1:typeof n=="object"&&n!==null&&"_ops"in n||typeof n=="string"&&t!=null&&n in t}var I,V,ue=R(()=>{"use strict";q();ye();gn();I=n=>e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=bl(e[o],n);return r},V=(n,e,t)=>{let r=(o,i)=>{let s=o.length,a=n._resolve(e,i,s),l=new Array(s);if(k(a))for(let u=0;u<s;u++)l[u]=ys(o[u],a[u],t);else for(let u=0;u<s;u++)l[u]=ys(o[u],a,t);return l};return r._binaryMeta={left:n,right:e},r}});var T,$,ce=R(()=>{"use strict";X();ue();T=(n,e)=>{let t=n.constructor,r=n._colNames||n._colName||"",o=new t(r);return Object.assign(o,n),o._ops=e?[...n._ops,e]:[...n._ops],e&&e._binaryMeta&&(o._binaryMeta=e._binaryMeta),o},$=class n{_ops=[];_outputName="";_isLiteral;_literalValue;_aggFn=null;_castType;_binaryMeta;_groupingOpsIndex;_partitionOpsIndex;_partitionBy=null;_evaluateWindow;_baseExpr;_fieldName;_isUnnest;_evaluatePost(e,t,r){let o=this._ops,i=e!==void 0?e:o.length,s=t;for(let a=i;a<o.length;a++)s=o[a](s,r);return s}_evaluatePre(e,t,r){let o=this._getInitialValue(t,r),i=this._ops,s=e!==void 0?e:i.length;for(let a=0;a<s;a++)o=i[a](o,t);return o}_getInitialValue(e,t){let r=this._colName;if(r&&r!=="*"&&!r.startsWith("*")&&!(r in e))throw new Pe(r);return(r&&r!=="*"?e[r]:null)||new Array(t).fill(null)}_resolve(e,t,r){return e instanceof n?e._isLiteral&&e._ops.length===1?e._literalValue:de(e,t,r):e}alias(e){let t=T(this);return t._outputName=e,t}cast(e){let t=T(this,I(r=>e.coerce(r)));return t._castType=e,t}debug(e){return T(this,t=>(console.log(`[DEBUG] ${e?e+": ":""}`,t),t))}evaluate(e,t){return this._evaluatePre(void 0,e,t)}}});var yn,xr=R(()=>{"use strict";ce();ue();q();yn=class extends ${abs(){return T(this,I(Math.abs))}acos(){return T(this,I(e=>e<-1||e>1?null:Math.acos(e)))}acosh(){return T(this,I(e=>e<1?null:Math.acosh(e)))}add(e){return T(this,V(this,e,(t,r)=>t+r))}asin(){return T(this,I(e=>e<-1||e>1?null:Math.asin(e)))}asinh(){return T(this,I(Math.asinh))}atan(){return T(this,I(Math.atan))}atan2(e){return T(this,V(this,e,Math.atan2))}atanh(){return T(this,I(e=>e<=-1||e>=1?null:Math.atanh(e)))}cbrt(){return T(this,I(Math.cbrt))}ceil(){return T(this,I(Math.ceil))}clip(e=null,t=null){return T(this,I(r=>Ee(r,{min:e,max:t})))}copysign(e){return T(this,V(this,e,(t,r)=>Math.abs(t)*(r>=0?1:-1)))}cos(){return T(this,I(Math.cos))}cosh(){return T(this,I(Math.cosh))}degrees(){return T(this,I(e=>e*(180/Math.PI)))}div(e){return T(this,V(this,e,(t,r)=>r===0?null:t/r))}exp(){return T(this,I(Math.exp))}expm1(){return T(this,I(Math.expm1))}floor(){return T(this,I(Math.floor))}floordiv(e){return T(this,V(this,e,(t,r)=>r===0?null:Math.floor(t/r)))}hypot(e){return T(this,V(this,e,Math.hypot))}log(e=Math.E){return T(this,I(t=>t<=0?null:e===Math.E?Math.log(t):Math.log(t)/Math.log(e)))}log1p(){return T(this,I(e=>e<=-1?null:Math.log1p(e)))}mod(e){return T(this,V(this,e,(t,r)=>r===0?null:t%r))}mul(e){return T(this,V(this,e,(t,r)=>t*r))}negate(){return T(this,I(e=>-e))}pow(e){return T(this,V(this,e,Math.pow))}radians(){return T(this,I(e=>e*(Math.PI/180)))}rand(e,{min:t=0,max:r=1,integer:o=!1}={}){return T(this,i=>{let s=i.length,a=new Float64Array(s),l=e!==void 0?zo(e):Math.random,u=r-t;for(let c=0;c<s;c++){let f=l();a[c]=o?Math.floor(f*(u+1))+t:f*u+t}return a})}round(e=0){return T(this,I(t=>Vn(t,e)))}round_sig_figs(e){return T(this,I(t=>v(t)?Number(t.toPrecision(e)):t))}sign(){return T(this,I(Math.sign))}sin(){return T(this,I(Math.sin))}sinh(){return T(this,I(Math.sinh))}sqrt(){return T(this,I(e=>e<0?null:Math.sqrt(e)))}sub(e){return T(this,V(this,e,(t,r)=>t-r))}tan(){return T(this,I(Math.tan))}tanh(){return T(this,I(Math.tanh))}trunc(){return T(this,I(Math.trunc))}}});var _n,br=R(()=>{"use strict";ce();ue();q();_n=class extends ${and(e){return T(this,(t,r)=>{let o=t.length,i=this._resolve(e,r,o),s=k(i),a=new Array(o);for(let l=0;l<o;l++){let u=t[l],c=s?i[l]:i;u===!1||c===!1?a[l]=!1:u==null||c==null?a[l]=null:a[l]=!0}return a})}not(){return T(this,I(e=>!e))}or(e){return T(this,(t,r)=>{let o=t.length,i=this._resolve(e,r,o),s=k(i),a=new Array(o);for(let l=0;l<o;l++){let u=t[l],c=s?i[l]:i;u===!0||c===!0?a[l]=!0:u==null||c==null?a[l]=null:a[l]=!1}return a})}xor(e){return T(this,V(this,e,(t,r)=>!!t!=!!r))}}});function _s(n,e,t,r){let o=n.length,i=new Array(o);if(t&&typeof t=="object"&&"evaluate"in t){let s=t.evaluate(e,o);for(let a=0;a<o;a++){let l=n[a];if(l==null)i[a]=null;else{let u=s[a],c=new Set;if(k(u)){let m=u.length;for(let h=0;h<m;h++)c.add(G(u[h]))}else c.add(G(u));let f=c.has(G(l));i[a]=r?!f:f}}}else{let s=k(t)?t:[],a=new Set,l=s.length;for(let u=0;u<l;u++)a.add(G(s[u]));for(let u=0;u<o;u++){let c=n[u];if(c==null)i[u]=null;else{let f=a.has(G(c));i[u]=r?!f:f}}}return i}function xs(n,e){let{frequencies:t}=Fe(n,{strict:!0}),r=n.length,o=new Array(r);for(let i=0;i<r;i++){let s=t.get(n[i])||0;o[i]=e?s>1:s===1}return o}function bs(n,e,t){let r=n.length,o=new Array(r);if(k(e))for(let i=0;i<r;i++){let s=n[i],a=e[i];s==null&&a==null?o[i]=!t:s==null||a==null?o[i]=t:o[i]=t?s!==a:s===a}else for(let i=0;i<r;i++){let s=n[i];s==null&&e==null?o[i]=!t:s==null||e==null?o[i]=t:o[i]=t?s!==e:s===e}return o}var xn,wr=R(()=>{"use strict";ce();ue();q();xn=class extends ${between(e,t,r="both"){return T(this,(o,i)=>{let s=o.length,a=this._resolve(e,i,s),l=this._resolve(t,i,s),u=new Array(s),c=k(a),f=k(l);for(let m=0;m<s;m++){let h=o[m],p=c?a[m]:a,d=f?l[m]:l;if(h==null||p==null||d==null)u[m]=null;else{let g=r==="both"||r==="left"?h>=p:h>p,y=r==="both"||r==="right"?h<=d:h<d;u[m]=g&&y}}return u})}eq(e){return T(this,V(this,e,(t,r)=>t===r))}eq_missing(e){return T(this,(t,r)=>{let o=this._resolve(e,r,t.length);return bs(t,o,!1)})}ge(e){return T(this,V(this,e,(t,r)=>t>=r))}gt(e){return T(this,V(this,e,(t,r)=>t>r))}has_nulls(){return this._deriveAgg(e=>{for(let t=0;t<e.length;t++)if(e[t]==null)return!0;return!1})}is_close(e,{abs_tol:t=1e-8,rel_tol:r=1e-8,nans_equal:o=!1}={}){return T(this,(i,s)=>{let a=i.length,l=this._resolve(e,s,a),u=k(l),c=new Array(a);for(let f=0;f<a;f++){let m=i[f],h=u?l[f]:l;if(m==null||h==null)c[f]=null;else if(v(m)&&v(h)){let p=Math.abs(m-h),d=Math.max(r*Math.max(Math.abs(m),Math.abs(h)),t);c[f]=p<=d}else Number.isNaN(m)&&Number.isNaN(h)?c[f]=o:c[f]=m===h}return c})}is_duplicated(){return T(this,e=>xs(e,!0))}is_empty({ignoreNulls:e=!1}={}){return T(this,I(t=>typeof t=="string"?t.length===0:k(t)?e?Q(t,"nullish",{mode:"every"}):t.length===0:null))}is_finite(){return T(this,I(Number.isFinite))}is_in(e){return T(this,(t,r)=>_s(t,r,e,!1))}is_infinite(){return T(this,I(e=>e===1/0||e===-1/0))}is_nan(){return T(this,I(Number.isNaN))}is_not_nan(){return T(this,I(e=>!Number.isNaN(e)))}is_not_null(){return T(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]!=null;return r})}is_null(){return T(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]==null;return r})}is_unique(){return T(this,e=>xs(e,!1))}le(e){return T(this,V(this,e,(t,r)=>t<=r))}lt(e){return T(this,V(this,e,(t,r)=>t<r))}ne(e){return T(this,V(this,e,(t,r)=>t!==r))}ne_missing(e){return T(this,(t,r)=>{let o=this._resolve(e,r,t.length);return bs(t,o,!0)})}not_in(e){return T(this,(t,r)=>_s(t,r,e,!0))}}});var Ar,bn,Sr=R(()=>{"use strict";ce();ue();xe();q();Ar=class{constructor(e){this.expr=e}expr;_deriveString(e){return T(this.expr,I(t=>e(String(t))))}_patternGuard(e,t){return e==null?T(this.expr,r=>new Array(r.length).fill(null)):t()}_matchPattern(e,t){return t==null?!1:ge(t)?(t.lastIndex=0,t.test(e)):e.includes(t)}concat(e){return T(this.expr,V(this.expr,e,(t,r)=>String(t)+String(r)))}contains(e){return this._patternGuard(e,()=>this._deriveString(t=>this._matchPattern(t,e)))}contains_any(e){return this._patternGuard(e,()=>{let t=Array.isArray(e)?e:[e];return this._deriveString(r=>{let o=t.length;for(let i=0;i<o;i++)if(this._matchPattern(r,t[i]))return!0;return!1})})}count_matches(e,t={}){let r=typeof t=="boolean"?t:t?.literal??!1;return this._patternGuard(e,()=>this._deriveString(o=>{let i=r?pe(e):e,s=it(o,i,{global:!0});if(!s)return 0;let a=s.input.match(s.reg);return a?a.length:0}))}escape_regex(e={}){return this._deriveString(t=>pe(t,e))}decode(e){return this._deriveString(t=>_i(t,e.encoding,e))}encode(e){return this._deriveString(t=>yi(t,e.encoding))}decode_uri_component(){return this._deriveString(e=>{try{return decodeURIComponent(e)}catch{return e}})}encode_uri_component(){return this._deriveString(e=>{try{return encodeURIComponent(e)}catch{return e}})}ends_with(e){return this._deriveString(t=>t.endsWith(e))}explode(){return this._deriveString(e=>e.split(""))}extract(e,t){return this._patternGuard(e,()=>this._deriveString(r=>Wn(r,e,t)))}extract_all(e,t){return this._patternGuard(e,()=>this._deriveString(r=>Ai(r,e,t)??[]))}extract_groups(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>Si(r,e,t)))}extract_many(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>Ti(r,e,t)))}find(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>tn(r,e,t)))}find_many(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>Di(r,e,t)))}head(e=1){return this.slice(0,e)}join(e="",t={}){return T(this.expr,I(r=>{let o=be(r);return o==null?null:Gt(o,e,t)}))}json_decode(e={}){return this._deriveString(t=>St(t,e))}json_path_match(e){return this._deriveString(t=>ci(t,e))}len(){return this.len_chars()}len_bytes(){return this._deriveString(e=>Te.encode(e).length)}len_chars(){return this._deriveString(e=>e.length)}lower(){return this._deriveString(e=>e.toLowerCase())}lpad(e,t=" "){return this._deriveString(r=>r.padStart(e,t))}normalize(e){return this._deriveString(t=>t.normalize(e))}pad_end(e,t=" "){return this.rpad(e,t)}pad_start(e,t=" "){return this.lpad(e,t)}replace(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>Xn(o,e,t,{n:1,...r})??o))}replace_all(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>Xn(o,e,t,{...r,n:-1})??o))}replace_many(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>Ii(o,e,t,r)??o))}reverse(){return this._deriveString(e=>e.split("").reverse().join(""))}rpad(e,t=" "){return this._deriveString(r=>r.padEnd(e,t))}slice(e,t){return this._deriveString(r=>{let o=e<0?r.length+e:e,i=t!==void 0?o+t:void 0;return r.slice(o,i)})}split(e,t){return this._deriveString(r=>Oi(r,e,t))}starts_with(e){return this._deriveString(t=>t.startsWith(e))}strip_chars(e,t){return this._deriveString(r=>rt(r,e,{mode:"both",...t}))}strip_chars_end(e,t){return this._deriveString(r=>rt(r,e,{mode:"end",...t}))}strip_chars_start(e,t){return this._deriveString(r=>rt(r,e,{mode:"start",...t}))}strip_prefix(e){return this._deriveString(t=>rt(t,e,{mode:"start",maxScanStart:1,maxMatchesStart:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}strip_suffix(e){return this._deriveString(t=>rt(t,e,{mode:"end",maxScanEnd:1,maxMatchesEnd:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}tail(e=1){return this.slice(-e)}strptime(e){return this._deriveString(t=>Pi(t,e))}to_camelcase(){return this._deriveString(e=>ot(e,{format:"camel"}))}to_date(){return this._deriveString(e=>J(e,{dateOnly:!0}))}to_datetime(){return this._deriveString(J)}to_decimal(e,t){return this._deriveString(r=>Kt(r,{precision:e,scale:t}))}to_integer(){return this._deriveString(e=>se(e))}to_kebabcase(){return this._deriveString(e=>ot(e,{format:"kebab"}))}to_lowercase(){return this.lower()}to_pascalcase(){return this._deriveString(e=>ot(e,{format:"pascal"}))}to_snakecase(){return this._deriveString(e=>ot(e,{format:"snake"}))}to_time(){return this._deriveString(on)}to_titlecase(){return this._deriveString(e=>ot(e,{format:"title"}))}to_uppercase(){return this.upper()}trim(){return this.strip_chars()}trim_end(){return this.strip_chars_end()}trim_start(){return this.strip_chars_start()}upper(){return this._deriveString(e=>e.toUpperCase())}zfill(e){return this._deriveString(t=>t.padStart(e,"0"))}},bn=class extends ${get str(){return new Ar(this)}}});var wn,Tr=R(()=>{"use strict";ce();ue();X();q();wn=class extends ${_deriveAgg(e){let t=T(this);return t._aggFn=e,t._groupingOpsIndex=this._ops.length,t._partitionOpsIndex=this._ops.length,t}_deriveAggBinary(e,t){return T(this,V(this,e,(r,o)=>[r,o]))._deriveAgg(t)}all(){return this._deriveAgg(e=>Q(e,t=>!!t,{mode:"every"}))}all_null(){return this._deriveAgg(e=>Q(e,"nullish",{mode:"every"}))}any(){return this._deriveAgg(e=>Q(e,t=>!!t,{mode:"some"}))}any_null(){return this._deriveAgg(e=>Q(e,"nullish",{mode:"some"}))}arg_max(){return this._deriveAgg(e=>B(e).maxIdx)}arg_min(){return this._deriveAgg(e=>B(e).minIdx)}avg(){return this._deriveAgg(e=>B(e).mean)}bitwise_and(){return this._deriveAgg(e=>Ht(e,(t,r)=>t&r))}bitwise_or(){return this._deriveAgg(e=>Ht(e,(t,r)=>t|r))}bitwise_xor(){return this._deriveAgg(e=>Ht(e,(t,r)=>t^r))}corr(e){return this._deriveAggBinary(e,t=>$n(t)?.correlation??null)}count(e={}){return e.includeNulls?this._deriveAgg(t=>t.length):this._deriveAgg(t=>B(t).count)}cov(e){return this._deriveAggBinary(e,t=>$n(t)?.covariance??null)}dot(e){return this._deriveAggBinary(e,t=>Zo(t))}entropy(e={base:Math.E,normalize:!0}){return this._deriveAgg(t=>oi(t,e))}first(){return this._deriveAgg(e=>e[0]??null)}implode(){return this._deriveAgg(e=>e)}kurtosis(e={}){return this._deriveAgg(t=>ri(t,e))}last(){return this._deriveAgg(e=>e[e.length-1]??null)}max(){return this._deriveAgg(e=>B(e).max)}max_by(e){return this._deriveAggBinary(e,t=>Kn(t,"maxIdx"))}mean(){return this.avg()}median(){return this._deriveAgg(e=>nt(e))}min(){return this._deriveAgg(e=>B(e).min)}min_by(e){return this._deriveAggBinary(e,t=>Kn(t,"minIdx"))}mode(){return this._deriveAgg(e=>Wt(e))}n_unique(e={}){return this._deriveAgg(t=>Fe(t,e).count)}nan_max(){return this._deriveAgg(e=>B(e).nanMax)}nan_min(){return this._deriveAgg(e=>B(e).nanMin)}null_count(){return this._deriveAgg(e=>B(e).nullCount)}quantile(e){if(e<0||e>1)throw new ne("Quantile q must be between 0 and 1");return this._deriveAgg(t=>Jt(t,e))}product(){return this._deriveAgg(e=>B(e).product)}skew(e={}){return this._deriveAgg(t=>ni(t,e))}spearman_corr(e){return this._deriveAggBinary(e,t=>Yo(t))}std(){return this._deriveAgg(e=>B(e).std)}sum(){return this._deriveAgg(e=>B(e).sum)}variance(){return this._deriveAgg(e=>B(e).variance)}w_avg(e){return this._deriveAggBinary(e,t=>Qo(t))}}});function Dr(n,e,t={}){if(e==null)return null;let r=t.dense?"_denseRankCache":"_rankCache",o=n[r];if(!o){let i=n;if(t.ignoreNulls){i=[];let l=n.length;for(let u=0;u<l;u++)n[u]!=null&&i.push(n[u])}t.dense&&(i=Array.from(new Set(i)));let s=wt(i);o=new Map;let a=s.length;for(let l=0;l<a;l++){let u=s[l];o.has(u)||o.set(u,l+1)}n[r]=o}return o.get(e)??null}var An,Or=R(()=>{"use strict";ce();q();An=class extends ${_partitionBy=this._partitionBy||null;_window(e){let t=T(this);return t._partitionOpsIndex=this._ops.length,t._groupingOpsIndex=this._ops.length,t._evaluateWindow=e,t}_rolling(e,t){return this._window(function(r,o,i){let s=Math.max(0,i-e+1),a=i+1,l=r.slice(s,a);return t(l)})}_cum(e,t,r,o){return this._window(function(i,s,a){let l=t,u=!1,c=e?a:0,f=e?i.length-1:a;for(let m=c;m<=f;m++){let h=i[m];h!=null&&(l=r(l,h),u=!0)}return o?o(l,u):l})}get _isWindow(){return this._partitionBy!==null||this._evaluateWindow!==void 0||this._aggFn!==null}cum_count(e=!1){return this._cum(e,0,t=>t+1)}cum_max(e=!1){return this._cum(e,null,(t,r)=>t===null||r>t?r:t)}cum_min(e=!1){return this._cum(e,null,(t,r)=>t===null||r<t?r:t)}cum_prod(e=!1){return this._cum(e,1,(t,r)=>t*r,(t,r)=>r?t:null)}cum_sum(e=!1){return this._cum(e,0,(t,r)=>t+r)}dense_rank(){return this._window(function(e,t,r){return Dr(e,e[r],{dense:!0})})}lag(e=1,t=null){return this._window(function(r,o,i){let s=t;return i-e>=0&&(s=r[i-e]),s})}lead(e=1,t=null){return this._window(function(r,o,i){let s=t;return i+e<r.length&&(s=r[i+e]),s})}over(e){let t=T(this),r=Array.isArray(e)?e:[e];return t._partitionBy=r,t}rank(){return this._window(function(e,t,r){return Dr(e,e[r])})}rolling_max(e){return this._rolling(e,t=>B(t).max)}rolling_mean(e){return this._rolling(e,t=>B(t).mean)}rolling_median(e){return this._rolling(e,t=>nt(t))}rolling_min(e){return this._rolling(e,t=>B(t).min)}rolling_quantile(e,t){return this._rolling(t,r=>Jt(r,e))}rolling_rank(e){return this._rolling(e,t=>Dr(t,t[t.length-1],{ignoreNulls:!0}))}rolling_std(e){return this._rolling(e,t=>B(t).std)}rolling_sum(e){return this._rolling(e,t=>B(t).sum)}row_number(){let e=this._window(function(t,r,o){return o+1});return e._outputName="row_number",e}}});var Er,Sn,Ir=R(()=>{"use strict";ce();ue();q();Ae();X();Er=class{constructor(e){this.expr=e}expr;_deriveArray(e){return T(this.expr,I(t=>k(t)?e(t):null))}agg(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=t[a];if(!k(l)){i[a]=null;continue}let u=l.length;s[Qe]=l;let c=de(e,s,u);i[a]=k(c)?c[0]??null:c}return i})}all(){return this._deriveArray(e=>Q(e,t=>!!t,{mode:"every"}))}any(){return this._deriveArray(e=>Q(e,t=>!!t,{mode:"some"}))}arg_max(){return this._deriveArray(e=>B(e).maxIdx)}arg_min(){return this._deriveArray(e=>B(e).minIdx)}contains(e){return this._deriveArray(t=>Array.prototype.includes.call(t,e))}contains_all(e){return this._deriveArray(t=>Q(e,r=>Array.prototype.includes.call(t,r),{mode:"every"}))}contains_any(e){return this._deriveArray(t=>Q(e,r=>Array.prototype.includes.call(t,r),{mode:"some"}))}count_matches(e,t={}){return this._deriveArray(r=>Fe(r,t).frequencies.get(e)??0)}filter(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=t[a];if(!k(l)){i[a]=null;continue}let u=l.length;s[Qe]=l;let c=de(e,s,u),f=[];if(k(c)){let m=Math.min(u,c.length);for(let h=0;h<m;h++)c[h]&&f.push(l[h])}else if(c)for(let m=0;m<u;m++)f.push(l[m]);i[a]=f}return i})}explode({empty_as_null:e=!0,keep_nulls:t=!0}={}){return T(this.expr,r=>{let o=r.length,i=0;for(let u=0;u<o;u++){let c=r[u];if(k(c)){i+=c.length||(e?1:0);continue}if(c!=null){i+=1;continue}t&&(i+=1)}let s=new Array(i),a=new Int32Array(i),l=0;for(let u=0;u<o;u++){let c=r[u];if(k(c)){let f=c.length;if(f>0){for(let m=0;m<f;m++)a[l]=u,s[l++]=c[m];continue}e&&(a[l]=u,s[l++]=null);continue}if(c!=null){a[l]=u,s[l++]=c;continue}t&&(a[l]=u,s[l++]=null)}return s.rowMap=a,s})}first(e=!0){return this.get(0,e)}gather(e,t=!0){return this._deriveArray(r=>{let o=typeof e=="number"?[e]:e,i=o.length,s=new Array(i);for(let a=0;a<i;a++)s[a]=qt(r,o[a],t);return s})}gather_every(e={}){return this._deriveArray(t=>zt(t,e))}get(e,t=!0){return this._deriveArray(r=>qt(r,e,t))}join(e=",",t={}){return this._deriveArray(r=>Gt(r,e,t))}last(e=!0){return this.get(-1,e)}len(){return this.lengths()}lengths(){return this._deriveArray(e=>e.length)}max(){return this._deriveArray(e=>B(e).max)}mean(){return this._deriveArray(e=>B(e).mean)}median(){return this._deriveArray(e=>nt(e))}min(){return this._deriveArray(e=>B(e).min)}mode(){return this._deriveArray(e=>Wt(e))}n_unique(e={}){return this._deriveArray(t=>Fe(t,e).count)}reverse(){return this._deriveArray(e=>e.slice().reverse())}shift(e=1){return this._deriveArray(t=>Ho(t,e))}slice(e,t){return this._deriveArray(r=>r.slice(e,t))}splice(e,t,...r){return this._deriveArray(o=>{let i=[...o];return i.splice(e,t??i.length,...r),i})}sort(e){return this._deriveArray(t=>wt(t,e))}std(){return this._deriveArray(e=>B(e).std)}sum(){return this._deriveArray(e=>B(e).sum)}to_struct({upper_bound:e,fields:t}={}){return T(this.expr,r=>{let o=r.length,i=new Array(o),s=0;if(Array.isArray(t))s=t.length;else if(typeof e=="number")s=e;else for(let l=0;l<o;l++){let u=r[l];k(u)&&u.length>s&&(s=u.length)}if(s===0)throw new ne("to_struct cannot be evaluated: struct width is 0. Provide an upper_bound, non-empty fields names, or non-empty lists.");let a=new Array(s);for(let l=0;l<s;l++)typeof t=="function"?a[l]=t(l):a[l]=(Array.isArray(t)?t[l]:null)??`field_${l}`;for(let l=0;l<o;l++){let u=r[l];if(!k(u)){i[l]=null;continue}let c={};for(let f=0;f<s;f++)c[a[f]]=qt(u,f,!0);i[l]=c}return i})}unique(e={}){return this._deriveArray(t=>Fe(t,e).values)}variance(){return this._deriveArray(e=>B(e).variance)}eval(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o);for(let s=0;s<o;s++){let a=t[s];if(!k(a)){i[s]=null;continue}let l=a.length,u={...r,[Qe]:a};if(e._aggFn!=null&&(e._partitionBy==null||e._partitionBy.length===0)){let f=e._groupingOpsIndex!==void 0?e._groupingOpsIndex:e._ops.length,m=e._evaluatePre(f,u,l),h=e._aggFn(Array.from(m));i[s]=e._evaluatePost(f,[h],u)}else i[s]=de(e,u,l)}return i})}},Sn=class extends ${get arr(){return new Er(this)}}});function ws(n){return dn(n,"Column reference cannot be null or undefined."),Tn||(Tn=(me(),$r(As)).ColumnExpr),Tn.isColExpr(n)?n:new Tn(n)}var Tn,Cr,Dn,Rr=R(()=>{"use strict";ce();X();Tn=null;Cr=class{constructor(e){this.expr=e;return new Proxy(this,{get(t,r,o){return r in t?Reflect.get(t,r,o):typeof r=="string"?t.field(r):Reflect.get(t,r,o)}})}expr;field(e){let t=T(this.expr,r=>{let o=r.length,i=new Array(o);for(let s=0;s<o;s++){let a=r[s];i[s]=a!=null&&typeof a=="object"?a[e]:null}return i});return t._baseExpr=this.expr,t._fieldName=e,t.alias(e)}rename_fields(e){return T(this.expr,t=>{let r=t.length,o=new Array(r),i=Object.keys(e),s=i.length;for(let a=0;a<r;a++){let l=t[a];if(l==null||typeof l!="object"){o[a]=null;continue}let u={},c=Object.keys(l),f=c.length;for(let m=0;m<f;m++){let h=c[m];u[h]=l[h]}for(let m=0;m<s;m++){let h=i[m];if(h in u){let p=e[h];u[p]=u[h],delete u[h]}}o[a]=u}return o})}with_fields(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=[];if(Array.isArray(e)){let u=e.length;for(let c=0;c<u;c++){let f=e[c],m=ws(f),h=m._outputName||m._colName;if(!h)throw new M("Expressions passed to struct.with_fields must have a name/alias.");s.push({name:h,expr:m})}}else if(e&&typeof e=="object"){let u=Object.keys(e),c=u.length;for(let f=0;f<c;f++){let m=u[f],h=ws(e[m]);s.push({name:m,expr:h})}}let a=s.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=s[u].expr.evaluate(r,o);for(let u=0;u<o;u++){let c=t[u];if(c==null||typeof c!="object"){i[u]=null;continue}let f={},m=Object.keys(c),h=m.length;for(let p=0;p<h;p++){let d=m[p];f[d]=c[d]}for(let p=0;p<a;p++)f[s[p].name]=l[p][u];i[u]=f}return i})}unnest(){let e=T(this.expr);return e._isUnnest=!0,e._baseExpr=this.expr,e}},Dn=class extends ${get struct(){return new Cr(this)}}});var On,Ss=R(()=>{"use strict";ce();q();X();On=class extends ${fill_null({value:e=void 0,strategy:t=void 0,limit:r=void 0}={}){return T(this,(o,i)=>{let s=o.length,a=Array.from(o);if(t!==void 0)if(t==="zero"||t==="one"||t==="min"||t==="max"||t==="mean"){let l;t==="zero"?l=0:t==="one"?l=1:l=B(o)[t],qe(a,l,{mode:"constant",condition:u=>u==null})}else if(t==="forward"||t==="backward"){let l=t==="forward",u=null,c=0;qe(a,null,{mode:"independent",reverse:!l,step:({originalValue:f})=>f!=null?(u=f,c=0,f):u!==null&&(r===void 0||c<r)?(c++,u):null})}else throw new M(`Unsupported fill_null strategy: "${t}"`);else{let l=this._resolve(e,i,s),u=k(l);qe(a,null,{mode:"independent",step:({index:c,originalValue:f})=>f??(u?l[c]:l)})}return a})}reverse(){return T(this,e=>e.slice().reverse())}}});var As={};Vr(As,{ColumnExpr:()=>U,resolveColumnSelectors:()=>Ke});function wl(n,e){for(let t of e)for(let r of Object.getOwnPropertyNames(t.prototype))r!=="constructor"&&Object.defineProperty(n.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r)||Object.create(null))}function Al(n,e,t,r){if(!(n instanceof U)){if(F(n)&&"evaluate"in n&&!n._colName){let o=[];for(let i=0;i<e.length;i++)t.has(e[i])||o.push(e[i]);return o}return null}if(n._colNames&&n._colNames.length>0)return n._colNames;if(n._colName==="*"){let o=new Set(n._excludedCols),i=[];for(let s=0;s<e.length;s++){let a=e[s];!o.has(a)&&!t.has(a)&&i.push(a)}return i}if(n._targetType||n._targetTypes&&n._targetTypes.length>0){if(!r)throw new He("Cannot resolve DataType column selector without DataFrame schema.");let o=[];for(let i=0;i<e.length;i++){let s=e[i];if(t.has(s))continue;let a=r[s];if(a){if(n._targetType)a.matches(n._targetType)&&o.push(s);else if(n._targetTypes){for(let l=0;l<n._targetTypes.length;l++)if(a.matches(n._targetTypes[l])){o.push(s);break}}}}return o}return null}function Ke(n,e,t,r,o){let i=[],s=t?new Set(t):new Set;for(let a=0;a<n.length;a++){let l=n[a];if(typeof l=="string"){i.push(new U(l));continue}if(F(l)&&l._isUnnest&&l._baseExpr){let c=l._baseExpr,f=[],m=l._colName;if(typeof m=="string"&&r&&r[m]&&r[m].name==="Struct"&&(f=Object.keys(r[m].fields)),f.length===0&&o){let d=Object.keys(o)[0],g=d?o[d].length:0,y=c.evaluate(o,g),_=y.length;for(let S=0;S<_;S++){let b=y[S];if(b!=null&&typeof b=="object"){f=Object.keys(b);break}}}let h=f.length;if(h>0){for(let p=0;p<h;p++){let d=f[p],g=c.struct.field(d);i.push(g)}continue}}let u=Al(l,e,s,r);if(u!==null)for(let c=0;c<u.length;c++){let f=new U(u[c]);f._ops=[...l._ops||[]],f._aggFn=l._aggFn,f._partitionOpsIndex=l._partitionOpsIndex,f._groupingOpsIndex=l._groupingOpsIndex,f._partitionBy=l._partitionBy,l._evaluateWindow&&(f._evaluateWindow=l._evaluateWindow),l._outputName&&l._outputName!=="*"&&(f._outputName=l._outputName),i.push(f)}else i.push(l)}return i}var U,me=R(()=>{"use strict";ce();xr();wr();Tr();Or();Sr();br();kr();Ir();Rr();Ss();q();Ce();X();U=class n extends ${_colName="";_colNames;_excludedCols=[];_targetType;_targetTypes;static isColExpr(e){if(!F(e))return!1;try{return"evaluate"in e&&typeof e.evaluate=="function"}catch{return!1}}static toColExpr(e){return dn(e,"Column reference cannot be null or undefined."),n.isColExpr(e)?e:new n(e)}constructor(e){super(),Array.isArray(e)?e.some(r=>r instanceof te||typeof r=="function")?this._targetTypes=e:this._colNames=e.map(String):e instanceof te||typeof e=="function"?this._targetType=e:(this._colName=String(e),this._outputName=this._colName)}};wl(U,[yn,xn,wn,An,bn,_n,En,Sn,Dn,On])});function dt(n,e={strict:!0}){let t=e,r=new U(Kr);return r._literalValue=n,t.name&&(r._outputName=t.name),r._ops.push(o=>{let i=o.length,s=(x,A)=>x===void 0?A:Ee(x<0?i+x:x,{min:0,max:i}),a=s(t.startIndex,0),l=s(t.endIndex,i),u=Math.max(0,l-a),c=t.n!==void 0?t.n:u,f=t.strict!==!1;if(f){if(c!==i)throw new re(`Column height mismatch: seq_range length ${c} does not match DataFrame height ${i}`)}else{let x=t.pad??!1,A=t.truncate??!1;if(x&&!A&&c>u)throw new re(`Cannot pad seq_range output: specified length ${c} starting at index ${a} exceeds slice width ${u} (requires truncation).`);if(A&&!x&&c<u)throw new re(`Cannot truncate seq_range output: specified length ${c} starting at index ${a} is less than slice width ${u} (requires padding).`)}let m=i,h=!!t.dtype,p=t.mode||"cumulative",d=t.step!==void 0?t.step:1,g=h?x=>t.dtype.coerce(x):x=>x;if(f){let x=t.dtype?.allocate?t.dtype.allocate(m):new Array(m);return qe(x,n,{mode:p,step:d,coerce:g,startIndex:0,endIndex:m}),x}let y=Math.min(a+c,l),_=t.padValue!==void 0?t.padValue:null,S=g(_);if(p==="constant"&&a===0&&y===m&&!t.dtype){let x=new Array(m);for(let A=0;A<m;A++)x[A]=n;return x}let b=new Array(m);return b.fill(S),qe(b,n,{mode:p,step:d,coerce:g,startIndex:a,endIndex:y}),b}),r}var Nr=R(()=>{"use strict";me();Ae();X();q()});function gt(n,e){let t=dt(n,{strict:!0,mode:"constant",dtype:e?.dtype,name:e?.name});return t._isLiteral=!0,t}var In=R(()=>{"use strict";Nr()});var Ts={};Vr(Ts,{duration:()=>Mr});function Mr(n={}){let e=n.timeUnit??"ms",t=[],r=[[n.weeks,co],[n.days,Me],[n.hours,_t],[n.minutes,_e],[n.seconds,et],[n.milliseconds,fo],[n.microseconds,mo],[n.nanoseconds,po]];for(let[i,s]of r)if(i!=null){let a=v(i)?gt(i):U.toColExpr(i);t.push({expr:a,multiplier:s})}if(t.length===0)throw new M("At least one duration component must be specified for $df.duration().");let o=new U(Gr);return o._castType=new he(e),o._ops.push((i,s)=>{let a=i?i.length:0;if(a===0&&s){let f=Object.keys(s)[0];f&&k(s[f])&&(a=s[f].length)}a===0&&(a=1);let l=new Float64Array(a),u=new Uint8Array(a);for(let f=0;f<t.length;f++){let{expr:m,multiplier:h}=t[f],p=de(m,s,a);if(k(p)){let d=p,g=d.length;for(let y=0;y<a;y++){if(u[y]===1)continue;let _=j(y<g?d[y]:g===1?d[0]:null);_!=null?l[y]+=_*h:(u[y]=1,l[y]=0)}}else{let d=j(p);if(d!=null){let g=d*h;for(let y=0;y<a;y++)u[y]!==1&&(l[y]+=g)}else{u.fill(1),l.fill(0);break}}}let c=new Array(a);for(let f=0;f<a;f++)if(u[f]===1)c[f]=null;else{let m=Math.round(l[f]*1e6)/1e6;c[f]=ls(m,e)}return c}),o.alias("duration")}var Ur=R(()=>{"use strict";me();In();Ae();ue();ft();X();q();xe()});var vr,En,kr=R(()=>{"use strict";ft();X();ce();ue();q();xe();vr=class{constructor(e){this.expr=e}expr;_colTz(){let e=this.expr._castType;return e instanceof Ie?e.timeZone:null}_colTu(){let e=this.expr._castType;return e instanceof Ie?e.timeUnit:null}_deriveDate(e){return T(this.expr,I(t=>{let r=J(t);return r?e(r):null}))}cast_time_unit(e){return this.expr.cast(new Ie(e,this._colTz()))}century(){return this._deriveDate(vi)}convert_time_zone(e){let t=this._colTz();if(this.expr._castType instanceof Ie&&t===null)throw new M('convert_time_zone() requires a timezone-aware Datetime column. Use .dt.replace({ timeZone: "..." }) to assign a timezone first.');return this.expr.cast(new Ie(this._colTu()??"ms",e))}date(){return this._deriveDate(e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())))}day(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).day)}days_in_month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>{let o=ae(r,t),i=sn(ee(o.year,o.month-1,1),1,0);return i?i.getUTCDate():null})}epoch(e="ms"){return this._deriveDate(t=>Ui(t,e))}hour(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).hour)}is_business_day(e={}){return this._deriveDate(t=>Vi(t,e))}is_leap_year(){return this._deriveDate(Zn)}iso_week(){return this._deriveDate(e=>Hn(e,{field:"week"}))}iso_year(){return this._deriveDate(e=>Hn(e,{field:"year"}))}microsecond(){return this.millisecond().mul(vn)}millennium(){return this._deriveDate(Fi)}millisecond(){return this._deriveDate(e=>e.getUTCMilliseconds())}minute(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).minute)}month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).month)}month_end(){return this._deriveDate(e=>sn(e,1,0))}month_start(){return this._deriveDate(e=>sn(e,0,1))}nanosecond(){return this.millisecond().mul(Fn)}offset_day(e,t={}){let o=t?.excludeWeekdays?.length||t?.holidays||t?.roll?T(this.expr,V(this.expr,e,(s,a)=>{let l=J(s);return l?Li(l,a,t):null})):e,{duration:i}=(Ur(),$r(Ts));return this.expr.add(i({days:o}))}ordinal_day(){return this._deriveDate(Yn)}quarter(){return this._deriveDate(ji)}replace(e){return T(this.expr,I(t=>{let r=J(t);return r?$i(r,e):null}))}second(){return this._deriveDate(e=>e.getUTCSeconds())}strftime(e){let t=this._colTz(),r=t&&!e.timeZone?{...e,timeZone:t}:e;return this._deriveDate(o=>Ge(o,r))}time(){return this._deriveDate(e=>e.toISOString().split("T")[1].slice(0,12))}timestamp(e="ms"){return this.epoch(e)}total_days(){return this.expr.div(Me)}total_hours(){return this.expr.div(_t)}total_microseconds(){return this.expr.mul(vn)}total_milliseconds(){return this.expr}total_minutes(){return this.expr.div(_e)}total_nanoseconds(){return this.expr.mul(Fn)}total_seconds(){return this.expr.div(et)}utc_offset(e,t={}){return T(this.expr,I(r=>{let o=J(r);return o?er(o,e,t):null}))}week(){return this.iso_week()}weekday(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).dayOfWeek||7)}year(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).year)}},En=class extends ${get dt(){return new vr(this)}}});function Nt(){return new U("*")}var Ds=R(()=>{"use strict";me()});function Os(n){let e=new U("*");return e._excludedCols=Array.isArray(n)?n:[n],e}var Es=R(()=>{"use strict";me()});function Is(...n){let e=n.length===1&&Array.isArray(n[0])?n[0]:n,t=new U(qr);return t._ops.push((r,o)=>{let i=r.length,s=e.length,a=new Array(s),l=new Array(s);for(let c=0;c<s;c++){let f=e[c],m=pt(f,o,i);a[c]=m,l[c]=ht(f,m,o,i)}let u=new Array(i);for(let c=0;c<i;c++){let f=null;for(let m=0;m<s;m++){let h=a[m],p=l[m]?h[c]:h;if(p!=null){f=p;break}}u[c]=f}return u}),t}var Cs=R(()=>{"use strict";me();ue();Ae()});function Rs(n){return new jr(n)}var Fr,jr,Cn,ks=R(()=>{"use strict";me();ue();Ae();Fr=class{_predicates;_values;constructor(e,t){this._predicates=e,this._values=t}then(e){return new Cn(this._predicates,this._values.concat(e))}},jr=class{_predicates;constructor(e){this._predicates=[e]}then(e){return new Cn(this._predicates,[e])}},Cn=class n extends U{_predicates;_values;_otherwise;get _otherwiseValue(){return this._otherwise}get _branchOperands(){return this._otherwise!=null?[...this._values,this._otherwise]:this._values}constructor(e=[],t=[],r=null){super(Jr),this._predicates=Array.isArray(e)?e:[],this._values=t||[],this._otherwise=r,this._ops=[(o,i)=>{let s=o.length,a=this._predicates,l=this._values,u=a.length,c=new Array(u),f=new Array(u),m=new Array(u),h=new Array(u);for(let _=0;_<u;_++){let S=a[_],b=l[_],x=pt(S,i,s),A=pt(b,i,s);c[_]=x,f[_]=A,m[_]=ht(S,x,i,s),h[_]=ht(b,A,i,s)}let p=this._otherwise,d=pt(p,i,s),g=ht(p,d,i,s),y=new Array(s);for(let _=0;_<s;_++){let S=!1;for(let b=0;b<u;b++)if((m[b]?c[b][_]:c[b])===!0){y[_]=h[b]?f[b][_]:f[b],S=!0;break}S||(y[_]=g?d[_]:d)}return y}]}when(e){return new Fr(this._predicates.concat(e),this._values)}otherwise(e){return new n(this._predicates,this._values,e)}}});function Ns(n){return U.toColExpr(n).implode()}var Ms=R(()=>{"use strict";me()});function Us(){return new U(Qe)}var vs=R(()=>{"use strict";me();Ae()});function Fs(n,...e){let t;Array.isArray(n)||n&&typeof n=="object"&&!U.isColExpr(n)?t=n:t=[n,...e];let r=gt({}).struct.with_fields(t);return delete r._isLiteral,delete r._literalValue,r._colName=zr,r.alias("struct")}var js=R(()=>{"use strict";me();In();Ae()});function yt(n,e){if(n==null)return;if(n instanceof te)return n;if(typeof n=="object"&&("_ops"in n||"_literalValue"in n||"_targetType"in n))return Mt(n,e);let t=ie(n);if(typeof t=="string")return e[t]??E.Utf8;if(typeof t=="boolean")return E.Boolean;if(typeof t=="bigint")return $t(t,{range:"Int64"})?E.Int64:E.UInt64;if(v(t))return De(t,{range:"Int32"})?E.Int32:Number.isInteger(t)?E.Int64:E.Float64;if(P(t))return E.Datetime;if(zn(t,{strict:!0}))return E.Binary;if(Array.isArray(t)){let r,o=t.length;for(let i=0;i<o;i++){let s=t[i];if(s!=null&&(r=yt(s,e)))break}return E.Array(r??E.Utf8)}if(K(t)){let r=ke?ke.call(t):t.constructor.name,o=Sl[r];return o?E.Array(o):E.Binary}if(F(t))return E.Object}function Bs(n,e,t){if(!n||!e)return;if(t&&t.length>0){let a=!1;for(let l=0;l<t.length;l++){let u=t[l];if(u!=null){if(typeof u!="boolean"){a=!1;break}a=!0}}if(a)return E.Boolean}let r=n instanceof he,o=e instanceof he,i=n.isTemporal&&!r,s=e.isTemporal&&!o;if(i||s){if(i&&s){let a=n.timeUnit||e.timeUnit||"ms";return new he(a)}return i?n:e}if(r||o)return r?n:e;if(n.isUtf8||e.isUtf8)return E.Utf8;if(n.isNumeric&&e.isNumeric){let a=n instanceof ut||e instanceof ut,l=n instanceof lt||e instanceof lt,u=n instanceof Be||e instanceof Be;if(a||l&&u)return E.Float64;if(l)return E.Float32;if(u)return n instanceof Be?n:e;if(t!==void 0){let m={range:{min:-1/0,max:1/0}},h=t.length;for(let p=0;p<h;p++){let d=t[p];if(v(d)&&!De(d,m))return E.Float64}}if(n===e)return n;let c=n.name,f=e.name;return c.endsWith("64")||f.endsWith("64")?E.Int64:c.endsWith("32")||f.endsWith("32")?c==="UInt32"&&f==="UInt32"?E.UInt32:E.Int32:c.endsWith("16")||f.endsWith("16")?c==="UInt16"&&f==="UInt16"?E.UInt16:E.Int16:c==="UInt8"&&f==="UInt8"?E.UInt8:E.Int8}}function Mt(n,e,t){if(!n)return;if(n._castType)return n._castType;if(n._targetType instanceof te)return n._targetType;if(n._isLiteral&&n._literalValue!==void 0)return yt(n._literalValue,e);if(n._binaryMeta)return Bs(yt(n._binaryMeta.left,e),yt(n._binaryMeta.right,e),t);if(n._branchOperands){let s,a=n._branchOperands.length;for(let l=0;l<a;l++){let u=yt(n._branchOperands[l],e);u&&(s?s!==u&&s.isNumeric&&u.isNumeric&&(s=Bs(s,u,t)??s):s=u)}if(s)return s}if(n._baseExpr&&n._fieldName){let s=yt(n._baseExpr,e);if(s instanceof Ct)return s.fields?.[n._fieldName]}let r=n._colName?e[n._colName]:void 0,o=t?.[0],i=(!n._ops||n._ops.length===0)&&!n._aggFn;if(r){if(r instanceof ct&&(n._isUnnest||t?.rowMap))return r.innerType;if(!(r instanceof ct)&&Array.isArray(o))return E.Array(r);if(i||r.isTemporal&&n._aggFn&&(P(o)||typeof o=="string")||r instanceof he&&n._aggFn&&v(o))return r}if(n._aggFn&&v(o))return!Number.isInteger(o)||r?.isNumeric&&!(r instanceof he)?E.Float64:E.Int32}var Sl,Ps=R(()=>{"use strict";ft();Ce();q();Sl={Float64Array:E.Float64,Float32Array:E.Float32,Int32Array:E.Int32,Int16Array:E.Int16,Int8Array:E.Int8,BigInt64Array:E.Int64,BigUint64Array:E.UInt64,BigUint64:E.UInt64,Uint32Array:E.UInt32,Uint16Array:E.UInt16}});var Ut=R(()=>{"use strict";Ae();Wr();ce();xr();br();wr();Sr();Tr();Or();kr();Ir();Rr();me();In();Ds();Es();Cs();ks();Ms();Nr();vs();js();Ur();Ps();ue()});var Rn,Ls=R(()=>{"use strict";mt();gn();Ut();Rn=class{_groups;_keys;_allKeys;_parentColumns;_parentHeight;_parentSchema;constructor(e,t,r,o,i,s){this._groups=e,this._keys=t,this._allKeys=r,this._parentColumns=o,this._parentHeight=i,this._parentSchema=s}to_dataframe(){let e=this._keys.length,t=new Array(e);for(let a=0;a<e;a++)t[a]=String(this._keys[a]);let r=this._groups.size,o={};for(let a=0;a<t.length;a++)o[t[a]]=new Array(r);let i=0;for(let a of this._groups.values()){if(a.length===0)continue;let l=a[0];for(let u=0;u<t.length;u++){let c=t[u],f=this._parentColumns[c][l];o[c][i]=f===void 0?null:f}i++}let s={};for(let a of t)s[a]=this._parentSchema[a];return L._createDirect(o,s,i)}agg(...e){let t=this._allKeys.length,r=new Array(t);for(let f=0;f<t;f++)r[f]=String(this._allKeys[f]);let o=this._keys.length,i=new Array(o);for(let f=0;f<o;f++)i[f]=String(this._keys[f]);let s=Ke(e.flat(),r,i,this._parentSchema,this._parentColumns),a=this._groups.size,l={};for(let f=0;f<i.length;f++)l[i[f]]=new Array(a);let u=0;for(let f of this._groups.values()){if(f.length===0)continue;let m=f[0];for(let h=0;h<i.length;h++){let p=i[h],d=this._parentColumns[p][m];l[p][u]=d===void 0?null:d}u++}for(let f=0;f<s.length;f++){let m=s[f],h=m._outputName||m._colName||"*";if(!m._aggFn)l[h]=m.evaluate(l,a);else{let p=m._evaluatePre(m._groupingOpsIndex,this._parentColumns,this._parentHeight),d=new Array(a),g=0;for(let y of this._groups.values()){if(y.length===0)continue;let _=new Array(y.length);for(let S=0;S<y.length;S++)_[S]=p[y[S]];d[g]=m._aggFn(_),g++}l[h]=m._evaluatePost(m._groupingOpsIndex,d,l)}}let c={};for(let f of i)c[f]=this._parentSchema[f];for(let f of s){let m=f._outputName||f._colName||"*",h=Mt(f,this._parentSchema,l[m])||$e(l[m]);c[m]=h,l[m]=Re(l[m],h,u)}return L._createDirect(l,c,u)}}});function Tl(n,e,t){if(n==null)throw new z(`Invalid input to ${e} at index ${t}: item cannot be null or undefined.`);if(n instanceof L)return[n];if(Ne(n))return[new L(n)];if(k(n)){if(Q(n,L,{mode:"every"}))return n;if(Q(n,"plainObject",{mode:"every"}))return[new L(n)];let r=Q(n,L,{mode:"some"});for(let o=0;o<n.length;o++)if(r?!(n[o]instanceof L):!Ne(n[o]))throw new z(r?`Invalid input to ${e} at index ${t}, sub-index ${o}: nested array must contain only DataFrame instances.`:`Invalid input to ${e} at index ${t}, row ${o}: rows must be plain objects.`)}throw new z(`Invalid input to ${e} at index ${t}: expected DataFrame, row array, or column dictionary.`)}function vt(n,{how:e="vertical",horizontal:t}={}){if(n==null)throw new z("Invalid input to concat: rawItems cannot be null or undefined.");let r=Array.isArray(n)?n:[n],o=[];for(let s=0;s<r.length;s++)o.push(...Tl(r[s],"concat",s));let i=t?.strict??!0;if(o.length===0)return L._createDirect({},{},0);if(o.length===1&&e!=="horizontal")return o[0];switch(e){case"vertical":{let s=[];for(let p=0;p<o.length;p++)o[p].height>0&&s.push(o[p]);if(s.length===0)return L._createDirect({},{},0);let a=s[0],l=Object.keys(a._columns);for(let p=0;p<o.length;p++){let d=o[p];if(d.height===0)continue;let g=Object.keys(d._columns);if(l.length!==g.length)throw new z(`[Strict Vertical] Column count mismatch at index ${p}.`);for(let y=0;y<l.length;y++){if(l[y]!==g[y])throw new z(`[Strict Vertical] Schema mismatch at position ${y} in DF ${p}. Expected column "${l[y]}", but found "${g[y]}".`);let _=a.schema[l[y]],S=d.schema[l[y]];if(_&&S&&!_.equals(S))throw new He(`[Strict Type Check] Schema type mismatch for column "${l[y]}": expected ${_.name}, found ${S.name}.`)}}let u=0;for(let p of o)u+=p.height;let c={},f=o.length;for(let p=0;p<f;p++)if(o[p].height>0){c=o[p].schema;break}Object.keys(c).length===0&&f>0&&(c=o[0].schema);let m={};for(let p of l){let d=c[p],g=!1;for(let _ of o){let S=_._columns[p];if(!S){g=!0;break}if(!K(S)){for(let b=0;b<S.length;b++)if(S[b]==null){g=!0;break}}if(g)break}let y=d&&d.allocate?d.allocate(u):new Array(u).fill(null);g&&K(y)&&(y=new Array(u).fill(null)),m[p]=y}let h=0;for(let p of o){let d=p.height;if(d!==0){for(let g of l){let y=p._columns[g]||new Array(d).fill(null),_=m[g];if(K(_)&&K(y))_.set(y,h);else{let S=_;for(let b=0;b<d;b++)S[h+b]=y[b]}}h+=d}}return L._createDirect(m,c,u)}case"horizontal":{let s=o[0].height;for(let c=1;c<o.length;c++)o[c].height>s&&(s=o[c].height);let a=new Set;for(let c=0;c<o.length;c++){let f=o[c];if(i&&f.height!==s)throw new re(`[Horizontal] Row count mismatch at index ${c}. Expected ${s}, got ${f.height}. Set strict=false to allow padding.`);for(let m of Object.keys(f._columns)){if(a.has(m))throw new z(`[Horizontal] Duplicate column name "${m}" detected. Horizontal concat requires unique names.`);a.add(m)}}let l={},u={};for(let c of o){let f=c.height;Object.assign(u,c.schema);let m=Object.keys(c._columns),h=m.length;for(let p=0;p<h;p++){let d=m[p],g=c._columns[d];if(f===s)l[d]=K(g)?Array.from(g):g;else{let y=new Array(s);for(let _=0;_<f;_++)y[_]=g[_];for(let _=f;_<s;_++)y[_]=null;l[d]=y}}}return L._createDirect(l,u,s)}case"diagonal":{let s=new Set;for(let m of o)for(let h of Object.keys(m._columns))s.add(h);let a=Array.from(s),l=0;for(let m=0;m<o.length;m++)l+=o[m].height;let u={};for(let m of a){let h=null;for(let p of o){let d=p.schema[m];if(d){if(h===null)h=d;else if(!h.equals(d))throw new He(`[Strict Type Check] Schema type mismatch for column "${m}": expected ${h.name}, found ${d.name}.`)}}u[m]=h||E.Utf8}let c={};for(let m=0;m<a.length;m++)c[a[m]]=new Array(l).fill(null);let f=0;for(let m=0;m<o.length;m++){let h=o[m],p=h.height;if(p!==0){for(let d=0;d<a.length;d++){let g=a[d],y=c[g],_=h._columns[g];if(_!==void 0)if(K(_)&&K(y))y.set(_,f);else{let S=y;for(let b=0;b<p;b++)S[f+b]=_[b]}else{let S=y;for(let b=0;b<p;b++)S[f+b]=null}}f+=p}}return L._createDirect(c,u,l)}}}var Br=R(()=>{"use strict";mt();Ce();q();X()});var L,mt=R(()=>{"use strict";Ut();Ls();Tt();Ce();q();X();Br();gn();L=class n{_columns;_height;_schema={};static _createDirect(e,t,r){yr(e,r);let o=Object.create(n.prototype);return o._columns=e,o._schema=t,o._height=r,o}constructor(e,t,r){if(Array.isArray(e)){let{columns:o,height:i}=ms(e);this._columns=o,this._height=i,t?this._applySchema(t):this._inferSchema();return}if(F(e)){this._columns=e,this._height=yr(e,r),t?this._applySchema(t):this._inferSchema();return}this._columns={},this._height=0,t?this._applySchema(t):this._schema={}}_inferSchema(){let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let i=t[o];e[i]=$e(this._columns[i])}this._applySchema(e)}_applySchema(e){this._schema=e;let t=Object.keys(e),r={};for(let o of t){let i=e[o],s=this._columns[o];r[o]=s?Re(s,i,this._height):Re(new Array(this._height).fill(null),i,this._height)}this._columns=r}get columns(){return Object.keys(this._columns)}concat(e,t={}){let r=Q(e,n,{mode:"every",allowEmpty:!1})?e:[e];return vt([this,...r],t)}drop(...e){let t=new Set(e.flat()),r={},o={};for(let i of Object.keys(this._columns))t.has(i)||(r[i]=this._columns[i],o[i]=this._schema[i]);return n._createDirect(r,o,this._height)}drop_nulls(e){return this._height===0?this:this.filter(e?new U(e).is_not_null():Nt().is_not_null())}get dtypes(){let e=Object.keys(this._columns),t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=this._schema[e[o]];return r}explode(e,t){let r=Array.isArray(e)?e:[e],o=this._normalizeArgs(r),i=Ke(o,Object.keys(this._columns),void 0,this._schema,this._columns),s=new Set,a=i.length;for(let f=0;f<a;f++){let m=i[f],h=m._colName||m._outputName;if(!h||h==="*")throw new z("Expression passed to explode must have a column name.");Y(h,this._columns,"Explode column"),s.add(h)}let l=Object.keys(this._columns),u=[],c=l.length;for(let f=0;f<c;f++){let m=l[f];u.push(s.has(m)?new U(m).arr.explode(t):new U(m))}return this.select(...u)}fill_null(e={}){return this._height===0?this:this.with_columns(Nt().fill_null(e))}filter(...e){if(this._height===0)return n._createDirect({},this._schema,0);let t=this._height,r=Object.keys(this._columns),o=r.length,i=[],s=[],a=[],l=e.length;for(let g=0;g<l;g++){let y=e[g];typeof y=="function"?s.push(y):a.push(y)}let u=Ke(a,r,void 0,this._schema,this._columns),c=u.length;for(let g=0;g<c;g++)i.push(u[g].evaluate(this._columns,t));let f=[],m=0,h=null;if(s.length>0){let g=this._columns;h={};for(let y=0;y<o;y++){let _=r[y],S=g[_];Object.defineProperty(h,_,{get(){let b=S[m];return b===void 0?null:b},enumerable:!0,configurable:!0})}}for(let g=0;g<t;g++){let y=!0;for(let _=0;_<i.length;_++)if(!i[_][g]){y=!1;break}if(y){if(h){m=g;for(let _=0;_<s.length;_++)if(!s[_](h)){y=!1;break}}y&&f.push(g)}}let p=kt(this._columns,f),d=f.length;return n._createDirect(p,this._schema,d)}groupby(e){let t=be(e),r=new Map,o=this._height,i=ve(e,"string");for(let a=0;a<i.length;a++)Y(i[a],this._columns,"Grouping key");for(let a=0;a<o;a++){let l=Ve(this._columns,i,a),u=r.get(l);u===void 0&&r.set(l,u=[]),u.push(a)}let s=Object.keys(this._columns);return new Rn(r,t,s,this._columns,this._height,this._schema)}head(e=10){return this.limit(e,{offset:0,from:"start"})}clone(){let e={};for(let t of Object.keys(this._columns)){let r=this._columns[t];(Array.isArray(r)||K(r))&&(e[t]=r.slice())}return n._createDirect(e,{...this._schema},this._height)}get height(){return this._height}hstack(e,t={}){return this.concat(e,{how:"horizontal",horizontal:t})}insert_column(e,t,r){let o=U.toColExpr(r).alias(t),i=Object.keys(this._columns),s=i.length,a=[];for(let u=0;u<s;u++){let c=i[u];c!==t&&a.push(c)}let l=Math.max(0,Math.min(e,a.length));return a.splice(l,0,o),this.select(...a)}item(e,t){let r=this._height,o=Object.keys(this._columns),i=o.length;if(e===void 0&&t===void 0){if(r!==1||i!==1)throw new z("DataFrame.item() can only be called without arguments if the shape is (1, 1).");return this._columns[o[0]][0]}if(e===void 0||t===void 0)throw new z("DataFrame.item() requires both row and column to be specified if not empty.");if(e<0||e>=r)throw new re(`Row index ${e} is out of bounds for DataFrame height ${r}.`);let s;if(typeof t=="number"){if(t<0||t>=i)throw new re(`Column index ${t} is out of bounds for DataFrame width ${i}.`);s=o[t]}else if(s=t,this._columns[s]===void 0)throw new Pe(s);return this._columns[s][e]}*iter_columns(){let e=Object.keys(this._columns),t=e.length,r=this._columns;for(let o=0;o<t;o++)yield r[e[o]]}*iter_rows({named:e=!1}={}){let t=Object.keys(this._columns),r=t.length,o=this._columns,i=this._height,s=new Array(r);for(let a=0;a<r;a++)s[a]=o[t[a]];if(e)for(let a=0;a<i;a++){let l={};for(let u=0;u<r;u++)l[t[u]]=s[u][a];yield l}else for(let a=0;a<i;a++){let l=new Array(r);for(let u=0;u<r;u++)l[u]=s[u][a];yield l}}join(e){let{other:t,on:r,leftOn:o,rightOn:i,how:s="inner",suffixes:a=["","_right"],join_nulls:l=!1,coalesce:u=!0,maintain_order:c="none"}=e;if(s==="cross"&&(r!==void 0||o!==void 0||i!==void 0))throw new M('Cannot specify "on", "leftOn", or "rightOn" when how is "cross". Cross joins produce a keyless Cartesian product.');if(r!==void 0&&(o!==void 0||i!==void 0))throw new M('Cannot specify both "on" and "leftOn"/"rightOn" in join(). Use either "on" or both "leftOn" and "rightOn".');if(o!==void 0&&i===void 0||o===void 0&&i!==void 0)throw new M('join() requires both "leftOn" and "rightOn" when specifying heterogeneous join keys.');if(s!=="cross"&&r===void 0&&o===void 0&&i===void 0)throw new M('join() requires either "on" or both "leftOn" and "rightOn" parameters.');let f=[],m=[];if(o!==void 0&&i!==void 0){if(f=ve(o,"string"),m=ve(i,"string"),f.length===0||m.length===0)throw new M('join() requires non-empty key arrays in "leftOn" and "rightOn".');if(f.length!==m.length)throw new M(`join() "leftOn" length (${f.length}) must match "rightOn" length (${m.length}).`)}else if(r!==void 0&&(f=ve(r,"string"),m=f,f.length===0))throw new M('join() requires at least one key column in "on".');for(let y=0;y<f.length;y++)Y(f[y],this._columns,"Join key"," in the left DataFrame."),Y(m[y],t._columns,"Join key"," in the right DataFrame.");let p={...e,how:s,suffixes:a,join_nulls:l,coalesce:u,maintain_order:typeof c=="boolean"?c?"left":"none":c??"none"},{leftIndices:d,rightIndices:g}=ds(this._columns,t._columns,this._height,t._height,f,m,p);return _r(this._columns,t._columns,this._schema,t._schema,d,g,f,m,{suffixes:a,coalesce:u,how:s})}join_asof(e){let{other:t,on:r,leftOn:o,rightOn:i,by:s,leftBy:a,rightBy:l,strategy:u="backward",tolerance:c,allow_exact_matches:f=!0,suffixes:m=["","_right"],coalesce:h=!0,check_sorted:p=!0}=e;if(!t||!(t instanceof n))throw new M("join_asof() requires a valid right DataFrame in the 'other' parameter.");let d=String(o??r??""),g=String(i??r??"");if(!d||!g)throw new M('join_asof() requires join key specified via "on", or "leftOn" and "rightOn".');let y=O=>O?Array.isArray(O)?O.map(String):[String(O)]:[],_=y(a??s),S=y(l??s);if(_.length!==S.length)throw new M('join_asof() "by" (or "leftBy" / "rightBy") key lists must have equal lengths.');for(let O=0;O<_.length;O++)Y(_[O],this._columns,"Partition key"," in the left DataFrame."),Y(S[O],t._columns,"Partition key"," in the right DataFrame.");let b={...e,strategy:u,tolerance:c,allow_exact_matches:f,suffixes:m,coalesce:h,check_sorted:p},{leftIndices:x,rightIndices:A}=gs(this._columns,t._columns,this._height,t._height,d,g,_,S,b),w=[d,..._],D=[g,...S];return _r(this._columns,t._columns,this._schema,t._schema,x,A,w,D,{suffixes:m,coalesce:h,how:"left"})}limit(e,{offset:t=0,from:r="start"}={}){let o=this._height,i=Ee(Math.floor(e),{min:0,max:o}),s=Ee(Math.floor(t),{min:0,max:o}),a=s,l=Math.min(s+i,o);r==="end"&&(l=o-s,a=Math.max(l-i,0));let u=l-a,c={},f=Object.keys(this._columns),m=f.length;for(let h=0;h<m;h++){let p=f[h];c[p]=this._columns[p].slice(a,l)}return n._createDirect(c,this._schema,u)}pivot(e){if(this._height===0)return n._createDirect({},{},0);let{index:t,columns:r,values:o}=e,i=ve(t,"string"),s=i.length;for(let x=0;x<s;x++)Y(i[x],this._columns,"Pivot index key");let a=String(r),l=String(o);Y(a,this._columns,"Pivot column key"),Y(l,this._columns,"Pivot values key");let u=new Map,c=[],f=new Set,m=this._height,h=this._columns[a],p=this._columns[l];for(let x=0;x<m;x++){let A=Ve(this._columns,i,x);f.add(String(h[x])),u.get(A)===void 0&&(u.set(A,u.size),c.push(x))}let d=u.size,g={},y={};for(let x=0;x<s;x++){let A=i[x];g[A]=this._columns[A],this._schema[A]&&(y[A]=this._schema[A])}let _=kt(g,c),S=Array.from(f),b=this._schema[l]||E.Utf8;for(let x=0;x<S.length;x++){let A=S[x];_[A]=new Array(d).fill(null),y[A]=b}for(let x=0;x<m;x++){let A=Ve(this._columns,i,x),w=u.get(A),D=String(h[x]);_[D][w]=p[x]}return n._createDirect(_,y,d)}rename(e){let t=e||{},r={},o={},i=Object.keys(this._columns);for(let a of i){let l=t[a]||a;r[l]=this._columns[a],o[l]=this._schema[a]}if(Object.keys(r).length<i.length)throw new z("Rename collision: Multiple columns mapped to the same output name.");return n._createDirect(r,o,this._height)}reverse(){if(this._height===0)return this;let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let i=t[o];e[i]=this._columns[i].slice().reverse()}return n._createDirect(e,this._schema,this._height)}get schema(){return this._schema}select(...e){let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=Ke(t,r,void 0,this._schema,this._columns),i=o.length;if(i===0)return n._createDirect({},{},this._height);let s={},a={},l=new Array(i),u=new Array(i),c=new Set,f=null;for(let p=0;p<i;p++){let d=o[p],g=d._outputName||d._colName||"*";if(c.has(g))throw new z(`Duplicate column selection: "${g}" is selected multiple times.`);c.add(g);let y=de(d,this._columns,this._height);l[p]=y,u[p]=g;let _=y&&y.rowMap;if(_)if(f){let S=_.length;if(S!==f.length)throw new re(`Mismatched explode heights: Column "${g}" has length ${S}, but another exploded column has length ${f.length}`);for(let b=0;b<S;b++)if(_[b]!==f[b])throw new re(`Mismatched explode heights: Column "${g}" has mismatched row lengths compared to another exploded column.`)}else f=_}let m=f?f.length:this._height,h=i>0;for(let p=0;p<i;p++){let d=o[p],g=d._aggFn!=null&&(d._partitionBy==null||d._partitionBy.length===0),y=!!d._isLiteral;if(!g&&!y){h=!1;break}}for(let p=0;p<i;p++){let d=u[p],g=l[p],y=g,_=y&&y.rowMap,S=k(g)?g.length:0,b=f&&!_?this._height:m;if(S!==b)throw new re(`Column height mismatch: Column "${d}" has length ${S}, but expected ${b}`);if(f&&!_){let x=f.length;if(K(g)){let A=new y.constructor(x);for(let w=0;w<x;w++)A[w]=y[f[w]];g=A}else{let A=new Array(x);for(let w=0;w<x;w++)A[w]=y[f[w]];g=A}}l[p]=g}h&&(m=1);for(let p=0;p<i;p++){let d=o[p],g=u[p],y=l[p],_=Mt(d,this._schema,y)||$e(y);a[g]=_,s[g]=Re(y,_,m)}return n._createDirect(s,a,m)}get shape(){return[this.height,this.width]}slice(e,t){let r=this._height,o=e<0?Math.max(r+e,0):Math.min(e,r),i=t===void 0?r:t<0?Math.max(r+t,0):Math.min(t,r),s=Math.max(i-o,0);return this.limit(s,{offset:o})}sort(e){if(!e||!e.by||this._height===0)return this;let{by:t,descending:r=!1,nullsLast:o=!0,custom:i}=e,s=be(t);for(let p=0;p<s.length;p++){let d=U.toColExpr(s[p]);d._colName&&Y(d._colName,this._columns,"Sort key")}let a=Array.isArray(r)?r:new Array(s.length).fill(r),l=s.length,u=new Array(l);for(let p=0;p<l;p++){let d=s[p],g=a[p]?-1:1,y=i&&typeof d=="string"?i[d]:null,_=U.toColExpr(d).evaluate(this._columns,this._height);u[p]={values:_,isDesc:g,customComp:y}}let c=u.length,f=o?1:-1,m=new Array(this._height);for(let p=0;p<this._height;p++)m[p]=p;m.sort((p,d)=>{for(let g=0;g<c;g++){let{values:y,isDesc:_,customComp:S}=u[g],b=y[p],x=y[d];if(S){let w=S(b,x);if(w!==0)return w*_;continue}if(b==null||x==null){if(b===x)continue;return(b==null?1:-1)*f}if(b===x)continue;return(b<x?-1:1)*_}return 0});let h=kt(this._columns,m);return n._createDirect(h,this._schema,this._height)}tail(e=10){return this.limit(e,{offset:0,from:"end"})}to_dict(){return{...this._columns}}to_dicts(){return ps(this._columns,this._height)}to_array(e){if(this._height===0)return[];if(e==null)return new Array(this._height).fill(null);let r=U.toColExpr(e).evaluate(this._columns,this._height);return Array.isArray(r)?r:Array.from(r)}transpose({include_header:e=!1,header_name:t="column",column_names:r}={}){if(this._height===0){let c={},f={};return e&&(c[t]=Re([],E.Utf8,0),f[t]=E.Utf8),n._createDirect(c,f,0)}let o=this.columns;typeof r=="string"&&(Y(r,this._columns,"column_names"),o=o.filter(c=>c!==r));let i=[];if(typeof r=="string"){let c=this._columns[r];i=new Array(this._height);for(let f=0;f<this._height;f++){let m=c[f];if(m==null)throw new z(`Transpose column_names column "${r}" contains null/undefined at index ${f}`);i[f]=String(m)}}else if(r!=null&&typeof r!="string"&&Symbol.iterator in Object(r)){let c=Array.from(r);if(c.length!==this._height)throw new z(`column_names length (${c.length}) must match the height of the DataFrame (${this._height})`);i=new Array(this._height);for(let f=0;f<this._height;f++)i[f]=String(c[f])}else{i=new Array(this._height);for(let c=0;c<this._height;c++)i[c]=`column_${c}`}let s=new Set;e&&s.add(t);for(let c=0;c<i.length;c++){let f=i[c];if(s.has(f))throw new z(`Duplicate column name in transposed DataFrame: "${f}"`);s.add(f)}let a=o.length,l={},u={};e&&(l[t]=Re(o,E.Utf8,a),u[t]=E.Utf8);for(let c=0;c<this._height;c++){let f=i[c],m=new Array(a);for(let p=0;p<a;p++)m[p]=this._columns[o[p]][c];let h=$e(m);l[f]=Re(m,h,a),u[f]=h}return n._createDirect(l,u,a)}unique(e){if(this._height===0)return n._createDirect({},this._schema,0);let t=be(e),r=t.length===0?Object.keys(this._columns):t.map(String);for(let u of r)Y(u,this._columns,"Unique column key");let o=new Set,i=[],s=this._height;for(let u=0;u<s;u++){let c=Ve(this._columns,r,u);o.has(c)||(o.add(c),i.push(u))}let a=kt(this._columns,i),l=i.length;return n._createDirect(a,this._schema,l)}unpivot(e){let{idVars:t,valueVars:r,varName:o="variable",valueName:i="value"}=e,s=ve(t,"string"),a=ve(r,"string"),l=s.length,u=a.length;for(let p of s)Y(p,this._columns,"Unpivot id variable key");for(let p of a)Y(p,this._columns,"Unpivot value variable key");let c=this._height*u,f={};for(let p=0;p<l;p++)f[s[p]]=new Array(c);f[o]=new Array(c),f[i]=new Array(c);let m=0;for(let p=0;p<this._height;p++)for(let d=0;d<u;d++){let g=a[d];for(let y=0;y<l;y++){let _=s[y];f[_][m]=this._columns[_][p]}f[o][m]=g,f[i][m]=this._columns[g][p],m++}let h={};for(let p of s)h[p]=this._schema[p];return h[o]=E.Utf8,h[i]=$e(f[i]),n._createDirect(f,h,c)}vstack(e){return this.concat(e,{how:"vertical"})}get width(){return Object.keys(this._columns).length}_normalizeArgs(e){let t=e.flat(),r=[];for(let o of t)if(typeof o=="string")r.push(new U(o));else if(U.isColExpr(o))r.push(o);else if(F(o)){let i=Object.keys(o),s=i.length;for(let a=0;a<s;a++){let l=i[a],u=o[l];if(U.isColExpr(u))r.push(u.alias(l));else{let c=new U(l);c.evaluate=(f,m)=>new Array(m).fill(u),r.push(c)}}}return r}with_columns(...e){if(e.length===0)return this;let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=Ke(t,r,void 0,this._schema,this._columns),i=o.length;if(i===0)return this;let s=new Map;for(let u=0;u<i;u++){let c=o[u],f=c._outputName||c._colName||"*";s.set(f,c)}let a=[],l=r.length;for(let u=0;u<l;u++){let c=r[u];a.push(s.get(c)||new U(c)),s.delete(c)}for(let u of s.values())a.push(u);return this.select(...a)}with_row_index(e="index",t=0){let r=dt(t,{mode:"independent",dtype:E.UInt32,step:1}),o=this.insert_column(0,e,r);return o._schema[e]=E.UInt32,o}write_json(e,{format:t="json",replacerOptions:r}={}){if(t!=="json"&&t!=="ndjson")throw new M(`Unsupported JSON format: "${t}". Expected "json" or "ndjson".`);let o=r?.replacer===null?void 0:ze(r),i;if(t==="ndjson"){let s=this.to_dicts(),a=s.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=JSON.stringify(s[u],o);i=l.join(`
|
|
6
|
+
`)}else i=JSON.stringify(this.to_dicts(),o);return hs(e,i),i}write_csv(e,t={}){if(e){if(typeof e=="string"){if(typeof Ze!="function")throw new je("File writing is not supported in this environment (missing require('fs')).");let r=Ze("fs"),o=r.openSync(e,"w");try{hn(this._columns,this._height,{...t,onRow:i=>{r.writeSync(o,i,null,"utf8")}})}finally{r.closeSync(o)}}else if(F(e)&&typeof e.write=="function")hn(this._columns,this._height,{...t,onRow:r=>{e.write(r)}});else throw new M("Invalid file argument. Expected a file path string or a writable stream/object with a write method.");return""}return hn(this._columns,this._height,t)}}});Ut();Ut();Ce();Br();mt();q();X();function Pr(n,{format:e="json",trimBeforeParse:t=!0,schema:r,...o}={}){let i=St(n,{format:e,trimBeforeParse:t,...o});if(i===n)throw new z(`Invalid JSON input: must be a valid, non-empty JSON ${e} string.`);let s=Array.isArray(i)?i:F(i)?[i]:[];return new L(s,r)}mt();q();function Lr(n,e={}){let{hasHeader:t=!0,schema:r,inferSchema:o=!0}=e,i=is(n,e);if(i.length===0)return new L({});let s,a;t?(s=i[0],a=i.slice(1)):(s=i[0].map((m,h)=>`column_${h}`),a=i);let l=s.length,u=a.length,c={};for(let m=0;m<l;m++){let h=s[m],p=new Array(u);for(let d=0;d<u;d++)p[d]=a[d][m]!==void 0?a[d][m]:"";c[h]=p}let f={};for(let m=0;m<l;m++){let h=s[m],p=c[h];if(r&&r[h])f[h]=p;else if(o){let{values:d}=ss(p,e);f[h]=d}else f[h]=p}return new L(f,r)}function Dl(n,e){return new L(n,e)}var pp={data:Dl,col:n=>new U(n),all:Nt,exclude:Os,coalesce:Is,concat:vt,read_json:Pr,read_csv:Lr,lit:gt,when:Rs,implode:Ns,seq_range:dt,element:Us,struct:Fs,duration:Mr,DataType:E};Ce();X();export{pp as $df,oe as ALL_COLUMNS_MARKER,wn as AggregationExpr,yn as ArithmeticExpr,rs as Array,rs as ArrayDataType,Sn as ArrayExpr,Er as ArrayExprNamespace,ct as ArrayType,Yi as Binary,fr as BinaryType,fn as Boolean,fn as BooleanDataType,ur as BooleanType,qr as COALESCE_MARKER,U as ColumnExpr,Pe as ColumnNotFoundError,xn as ComparisonExpr,ne as ComputeError,Le as DFScriptError,Gr as DURATION_MARKER,L as DataFrame,z as DataFrameError,te as DataType,E as DataTypeRegistry,es as Date,es as DateDataType,vr as DateTimeExprNamespace,hr as DateType,mn as Datetime,Ie as DatetimeType,Be as DecimalType,ns as Duration,he as DurationType,Qe as ELEMENT_MARKER,$ as ExprBase,Hi as Float32,lt as Float32Type,cn as Float64,ut as Float64Type,Et as FloatDataType,Rn as GroupedData,je as IOStreamError,qi as Int16,nr as Int16Type,zi as Int32,rr as Int32Type,un as Int64,or as Int64Type,Ki as Int8,tr as Int8Type,an as IntegerDataType,M as InvalidArgumentError,Kr as LITERAL_MARKER,_n as LogicalExpr,It as NestedDataType,Zi as Null,mr as NullType,at as NumericDataType,Qi as Object,Qi as ObjectDataType,pr as ObjectType,zr as STRUCT_MARKER,He as SchemaError,re as ShapeError,Je as SignedIntegerType,bn as StringExpr,Ar as StringExprNamespace,os as Struct,Dn as StructExpr,Cr as StructExprNamespace,Ct as StructType,Xe as TemporalDataType,En as TemporalExpr,ts as Time,dr as TimeType,Ji as UInt16,sr as UInt16Type,Wi as UInt32,ar as UInt32Type,Xi as UInt64,lr as UInt64Type,Gi as UInt8,ir as UInt8Type,We as UnsignedIntegerType,Rt as Utf8,cr as Utf8Type,Jr as WHEN_MARKER,jr as When,Cn as WhenThen,Fr as WhenThenChain,An as WindowExpr,gs as alignAsofIndices,ds as alignKeyIndices,Nt as all,Y as assertColumnExists,yr as assertHeight,dn as assertNotNull,Lu as assertValidArgument,Is as coalesce,Re as coerceColumn,ps as columnsToRows,Ve as computeRowHash,vt as concat,Bs as deduceBinaryType,T as derive,Mr as duration,Us as element,ys as evalBinaryOp,bl as evalUnaryOp,pt as evaluateArg,de as evaluateExpression,Os as exclude,kt as gatherColumnsByIndices,Xu as getRowFromColumns,Ns as implode,$e as inferColumnType,ht as isEvaluatedColumn,V as kleeneBinary,I as kleeneUnary,gt as lit,_r as materializeJoinedDataFrame,Lr as read_csv,Pr as read_json,Ke as resolveColumnSelectors,Mt as resolveExprOutputType,yt as resolveOperandType,fs as resolveWindowExpr,ms as rowsToColumns,dt as seq_range,Fs as struct,Rs as when,hs as writeStringToFileOrStream};
|