df-script 1.6.0 → 1.7.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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/dist/api.d.ts +2 -1
  3. package/dist/assets/index-DBhGK6Tp.css +1 -0
  4. package/dist/assets/index-DEJEV_tU.js +195 -0
  5. package/dist/columnExpressions/ColumnExpr.d.ts +12 -5
  6. package/dist/columnExpressions/ExprBase.d.ts +26 -12
  7. package/dist/columnExpressions/constants.d.ts +1 -0
  8. package/dist/columnExpressions/functions/all.d.ts +23 -0
  9. package/dist/columnExpressions/functions/coalesce.d.ts +29 -0
  10. package/dist/columnExpressions/functions/element.d.ts +25 -0
  11. package/dist/columnExpressions/functions/exclude.d.ts +24 -0
  12. package/dist/columnExpressions/functions/implode.d.ts +28 -0
  13. package/dist/columnExpressions/functions/lit.d.ts +27 -0
  14. package/dist/columnExpressions/functions/seq_range.d.ts +36 -0
  15. package/dist/columnExpressions/functions/struct.d.ts +31 -0
  16. package/dist/columnExpressions/functions/when.d.ts +36 -6
  17. package/dist/columnExpressions/index.d.ts +1 -0
  18. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +334 -0
  19. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +609 -0
  20. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +533 -5
  21. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +353 -0
  22. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +82 -0
  23. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +40 -0
  24. package/dist/columnExpressions/mixins/StringExpr.d.ts +656 -3
  25. package/dist/columnExpressions/mixins/StructExpr.d.ts +70 -0
  26. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +530 -4
  27. package/dist/columnExpressions/mixins/WindowExpr.d.ts +313 -2
  28. package/dist/columnExpressions/types.d.ts +1 -0
  29. package/dist/dataframe/dataframe.d.ts +932 -2
  30. package/dist/dataframe/grouped/grouped.d.ts +41 -6
  31. package/dist/dataframe/types.d.ts +1 -0
  32. package/dist/dataframe/utils.d.ts +1 -0
  33. package/dist/datatypes/types.d.ts +45 -0
  34. package/dist/exceptions/index.d.ts +23 -0
  35. package/dist/functions/concat.d.ts +50 -0
  36. package/dist/functions/read_csv.d.ts +9 -0
  37. package/dist/functions/read_json.d.ts +7 -2
  38. package/dist/index.html +17 -0
  39. package/dist/index.js +5 -5
  40. package/dist/index.mjs +6 -0
  41. package/dist/types.d.ts +47 -14
  42. package/dist/utils/array.d.ts +32 -1
  43. package/dist/utils/csv.d.ts +1 -0
  44. package/dist/utils/date.d.ts +10 -27
  45. package/dist/utils/json.d.ts +1 -0
  46. package/dist/utils/number.d.ts +1 -0
  47. package/dist/utils/object.d.ts +1 -0
  48. package/dist/utils/string.d.ts +12 -0
  49. package/package.json +18 -4
  50. package/dist/columnExpressions/mixins/ListExpr.d.ts +0 -39
  51. package/dist/utils/guards.d.ts +0 -13
  52. package/dist/utils/list.d.ts +0 -217
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ var Ke=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var Bo=Object.getOwnPropertyNames;var $o=Object.prototype.hasOwnProperty;var Ut=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var R=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ko=(n,t)=>{for(var e in t)Ke(n,e,{get:t[e],enumerable:!0})},qo=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bo(t))!$o.call(n,o)&&o!==e&&Ke(n,o,{get:()=>t[o],enumerable:!(r=Po(t,o))||r.enumerable});return n};var Wo=n=>qo(Ke({},"__esModule",{value:!0}),n);var nt,Gn,zn,$t,Hn,Ft=R(()=>{"use strict";nt="*",Gn="*literal*",zn="*coalesce*",$t="*element*",Hn="*struct*"});function P(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function Tt(n){if(!P(n))return!1;let t=Object.getPrototypeOf(n);if(t===null)return!0;let e=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof e!="function"?!1:Function.prototype.toString.call(e)===cs}function ar(n){if(typeof n!="function")return!1;let t="";try{t=Function.prototype.toString.call(n)}catch{return!1}if(/^class[\s{]/.test(t))return!0;if(n===Symbol||n===BigInt)return!1;let e=Object.getOwnPropertyDescriptor(n,"prototype");return e&&!e.writable?t.includes("[native code]"):!1}function lt(n,t,e,r){if(!P(n))return!1;if(!(Symbol.toStringTag in n))return Object.prototype.toString.call(n)===t;if(!e)return!1;try{return e.call(n,r),!0}catch{return!1}}function M(n){return lt(n,Go,qe)&&qe?!Number.isNaN(qe.call(n)):!1}function dt(n){return lt(n,zo,is)}function ie(n){return lt(n,Ho,as)}function ae(n){return lt(n,Jo,ls)}function lr(n){return lt(n,Xo,us,"key")}function ur(n){return P(n)?Symbol.toStringTag in n?n instanceof Error:Object.prototype.toString.call(n)===Yo:!1}function Xn(n){return lt(n,nr,We)}function Zn(n){return lt(n,rr,Ge)}function Qn(n){return lt(n,or,ze)}function tr(n){return lt(n,sr,Kt)}function er(n){return lt(n,ir,qt)}function it(n){if(!P(n))return n;switch(Object.prototype.toString.call(n)){case rr:if(Zn(n))try{return Ge.call(n)}catch{}break;case nr:if(Xn(n))try{return We.call(n)}catch{}break;case or:if(Qn(n))try{return ze.call(n)}catch{}break;case sr:if(tr(n)&&Kt)try{return Kt.call(n)}catch{}break;case ir:if(er(n)&&qt)try{return qt.call(n)}catch{}break}if(Symbol.toStringTag in n){if(Zn(n))try{return Ge.call(n)}catch{}else if(Xn(n))try{return We.call(n)}catch{}else if(Qn(n))try{return ze.call(n)}catch{}else if(tr(n)&&Kt)try{return Kt.call(n)}catch{}else if(er(n)&&qt)try{return qt.call(n)}catch{}}if(typeof n.valueOf=="function"&&n.valueOf!==Object.prototype.valueOf)try{let e=n.valueOf();if(typeof e!="object"||e===null)return e}catch{}return n}var Go,zo,Ho,Jo,Yo,Xo,nr,rr,or,sr,ir,Zo,Qo,Jn,Yn,ts,es,ns,rs,os,ss,is,as,ls,qe,us,We,Ge,ze,Kt,qt,cs,gt=R(()=>{"use strict";Go="[object Date]",zo="[object RegExp]",Ho="[object Set]",Jo="[object Map]",Yo="[object Error]",Xo="[object URLSearchParams]",nr="[object String]",rr="[object Number]",or="[object Boolean]",sr="[object BigInt]",ir="[object Symbol]",Zo=typeof Date=="function"?Date.prototype:void 0,Qo=Object.getPrototypeOf(/./),Jn=typeof Set=="function"?Set.prototype:void 0,Yn=typeof Map=="function"?Map.prototype:void 0,ts=typeof URLSearchParams=="function"?URLSearchParams.prototype:void 0,es=Object.getPrototypeOf(""),ns=Object.getPrototypeOf(0),rs=Object.getPrototypeOf(!0),os=typeof BigInt=="function"?BigInt.prototype:void 0,ss=typeof Symbol=="function"?Symbol.prototype:void 0,is=Object.getOwnPropertyDescriptor(Qo,"source")?.get,as=Jn?Object.getOwnPropertyDescriptor(Jn,"size")?.get:void 0,ls=Yn?Object.getOwnPropertyDescriptor(Yn,"size")?.get:void 0,qe=Zo?.valueOf,us=ts?.has,We=es.valueOf,Ge=ns.valueOf,ze=rs.valueOf,Kt=os?.valueOf,qt=ss?.valueOf,cs=Function.prototype.toString.call(Object)});function z(n,t){return typeof n!="number"?!1:Number.isNaN(n)?t?.allowNaN??t?.allowNonFiniteNumbers??!1:Number.isFinite(n)?!0:t?.allowNonFiniteNumbers??!1}function cr(n){for(let t=1;t<n.length;t++)if(n[t].length!==3)return!1;return!0}function yr(n,t){if(fs.test(n))return null;let e=n.trim();if(e==="")return null;e.startsWith("(")&&e.endsWith(")")&&(e="-"+e.slice(1,-1).trim());let r=e[e.length-1];(r==="-"||r==="+")&&e.length>1&&(e=r+e.slice(0,-1).trim()),t||(e=e.replace(ms,""));let o=e.includes("."),s=e.includes(",");if(o&&s){let i=e.lastIndexOf("."),a=e.lastIndexOf(","),l=a>i,c=l?".":",",u=l?a:i,f=e.slice(0,u).split(c);return f.length>1&&!cr(f)||f[0].replace(fr,"").length>3?null:l?e.replace(mr,"").replace(le,"."):e.replace(le,"")}if(s||o){let i=s?",":".",a=e.split(i);if(a.length>2||i===","&&a.length===2&&a[1].length===3){let l=a[0].replace(fr,"").length;if(l===0){if(i===","||a.length>2)return null}else return l>3?null:cr(a)?e.replace(s?le:mr,""):null}if(s)return e.replace(le,".")}return e}function K(n,{allowNonFiniteNumbers:t=!1,strictNumericString:e=!1,floatScientific:r=!0}={}){if(n==null||typeof n=="symbol")return null;switch(n=it(n),typeof n){case"number":return z(n,{allowNonFiniteNumbers:t})?n:null;case"boolean":return n?1:0;case"bigint":{let o=Number(n);return z(o,{allowNonFiniteNumbers:t})?o:null}case"object":{if(M(n)){let o=n.getTime();return z(o,{allowNonFiniteNumbers:t})?o:null}return null}case"string":{let o=yr(n,e);if(o===null)return null;if(t){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(hr.test(o)&&!r||!pr.test(o))return null;let i=Number(o);return z(i,{allowNonFiniteNumbers:t})?i:null}default:return null}}function dr({locale:n="en-US",accountingNegatives:t=!1,fallback:e="NaN",formatNonFinite:r=!1,...o}={}){o.useGrouping===void 0&&(o.useGrouping=!1),o.maximumFractionDigits===void 0&&o.maximumSignificantDigits===void 0&&(o.maximumFractionDigits=20),t&&(o.currencySign="accounting",o.style===void 0&&(o.style="decimal"));let s=new Intl.NumberFormat(n,o);return i=>{if(typeof i=="bigint")return t&&i<0n?`(${s.format(-i)})`:s.format(i);let a=K(i,{allowNonFiniteNumbers:!0});return a===null||Number.isNaN(a)?e:Number.isFinite(a)?t&&a<0?`(${s.format(Math.abs(a))})`:s.format(a):r?e:t&&a===-1/0?`(${s.format(1/0)})`:String(a)}}function He(n,{floatPrecision:t="Float64",allowNonFiniteNumbers:e=!0,floatScientific:r=!0,strictNumericString:o=!1}={}){let s=K(n,{allowNonFiniteNumbers:e,floatScientific:r,strictNumericString:o});return s===null||(t==="Float32"&&(s=Math.fround(s)),!z(s,{allowNonFiniteNumbers:e}))?null:s}function br(n,{range:t="Int32"}={}){if(!z(n)||!Number.isInteger(n))return!1;let e=typeof t=="string"?gr[t]:t;return n>=e.min&&n<=e.max}function pt(n,{range:t="Int32",coerce:e="truncate"}={}){let r=K(n);if(r===null)return null;switch(e){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 t=="string"?gr[t]:t;return ut(r,{min:o.min,max:o.max})}function Mt(n,{range:t="Int64",truncate:e=!1}={}){if(n==null||typeof n=="symbol")return null;n=it(n);let r=null;if(typeof n=="bigint")r=n;else if(typeof n=="string"){let s=yr(n,!1);if(s===null||!pr.test(s))return null;if(hr.test(s)){let i=Number(s);if(!Number.isFinite(i)||!e&&!Number.isInteger(i))return null;r=BigInt(Math.trunc(i))}else{let i=s.indexOf(".");if(i!==-1){if(!e&&/[^0]/.test(s.slice(i+1)))return null;s=s.slice(0,i)}try{r=BigInt(s)}catch{return null}}}else{let s=K(n);if(s===null||!e&&!Number.isInteger(s))return null;r=BigInt(Math.trunc(s))}let o=typeof t=="string"?ps[t]:t;return ut(r,{min:o.min,max:o.max})}function hs(n,t){let e=n-t;if(e<0||t<0)return null;if(e>15)return Number.H;let r=Math.min(t,16),o=Math.pow(10,e)-Math.pow(10,-r);return o>0?o:null}function Je(n,t){let e=n.toString();if(e.includes("e")){let r=Math.pow(10,t);return Math.round(n*r)/r}return+(Math.round(+(e+"e"+t))+"e"+-t)}function ue(n,{precision:t,scale:e}={}){let r=K(n);if(r===null)return null;let o=r;if(e!==void 0&&(o=Je(o,e)),t!==void 0){let i=hs(t,e??0);i!==null&&(o=ut(o,{min:-i,max:i}))}return o}function ut(n,t){if(!t)return n;let{min:e=null,max:r=null,safe:o=!0}=t;if(e!==null&&r!==null&&e>r)return e;let s=n;if(o&&typeof s=="number"){if(Number.isNaN(s))return e!==null?e:r!==null?r:n;if(s===1/0)return r!==null?r:n;if(s===-1/0)return e!==null?e:n}return e!==null&&s<e?e:r!==null&&s>r?r:s}function xr(n){let t=n|0;return function(){let e=t=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var pr,fs,ms,hr,fr,mr,le,gr,ps,Wt=R(()=>{"use strict";gt();pr=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,fs=/0[xobXOB]/,ms=/[\s_]/g,hr=/[eE]/;fr=/^[+-]/,mr=/\./g,le=/,/g;gr={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}};ps={Int64:{min:-9223372036854775808n,max:9223372036854775807n},UInt64:{min:0n,max:18446744073709551615n}}});function L(n){if(!ArrayBuffer.isView(n))return!1;if(wr)return wr.call(n)!==void 0;let t=Object.prototype.toString.call(n);return t!=="[object DataView]"&&t.endsWith("Array]")}function O(n){return Array.isArray(n)||L(n)}function Gt(n){return n==null?[]:Array.isArray(n)?[...n]:L(n)?Array.from(n):[n]}function Nt(n){let t=Gt(n),e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=String(t[o]);return r}function ce(n,t,e){let r=n.length,o=t<-r||t>=r;if(o&&!e)throw new ct(`Index ${t} is out of bounds for array of length ${r}`);return o?null:n.at(t)??null}function H(n,t,{mode:e="every",allowNulls:r=!1,allowEmpty:o=!0}={}){if(!O(n))return!1;let s=n.length;if(s===0)return o?e==="every":!1;let i=n,a;if(typeof t=="function")a=ar(t)?c=>c instanceof t:t;else switch(t){case"null":a=l=>l===null;break;case"undefined":a=l=>l===void 0;break;case"nullish":a=l=>l==null;break;case"any":a=()=>!0;break;case"date":a=M;break;case"object":a=P;break;case"plainObject":a=Tt;break;case"number":a=z;break;default:a=l=>typeof l===t;break}if(r){let l=a;a=c=>c==null||l(c)}if(e==="every"){for(let l=0;l<s;l++)if(!a(i[l]))return!1;return!0}else{for(let l=0;l<s;l++)if(a(i[l]))return!0;return!1}}function zt(n,{descending:t=!1,nullsLast:e=!0}={}){if(!O(n))return[];let r=n,o=r.length;if(o===0)return[];if(L(n)){let f=r.slice().sort();return t&&f.reverse(),Array.from(f)}let s=[],i=[],a=!0,l=!0,c=!0;for(let f=0;f<o;f++){let m=r[f];if(m==null)i.push(m);else if(s.push(m),c){let h=typeof m;h!=="number"&&(a=!1),h!=="string"&&(l=!1),!a&&!l&&(c=!1)}}return s.length>1&&(a?s.sort(t?(f,m)=>m-f:(f,m)=>f-m):l?s.sort(t?(f,m)=>m.localeCompare(f):(f,m)=>f.localeCompare(m)):s.sort((f,m)=>{let h=typeof f,p=typeof m;if(h!==p){let y=h<p?-1:1;return t?-y:y}return f<m?t?1:-1:f>m?t?-1:1:0})),i.length===0?s:e?s.concat(i):i.concat(s)}function N(n){if(!O(n))return Sr;let t=n.length;if(t===0)return Sr;let e=null,r=null,o=null,s=null,i=0,a=0,l=0,c=0,u=0,f=0;for(let h=0;h<t;h++){let p=n[h];if(p==null||typeof p=="number"&&!z(p,{allowNonFiniteNumbers:!0,allowNaN:!1})){a++;continue}(e==null||p<e)&&(e=p,o=h),(r==null||p>r)&&(r=p,s=h);let y=K(p);if(y!==null){let d=l+y;Math.abs(l)>=Math.abs(y)?c+=l-d+y:c+=y-d+l,l=d,i++;let g=y-u;u+=g/i;let b=y-u;f+=g*b}}let m=i>1?f/(i-1):0;return{sum:i>0?l+c:null,count:i,min:e,max:r,minIdx:o,maxIdx:s,mean:i>0?(l+c)/i:null,variance:m,std:Math.sqrt(m),nullCount:a,len:t,hasNulls:a>0,isNumeric:i>0&&i===t-a}}function bt(n,{strict:t=!1,keySelector:e}={}){let r=Array.from(n),o=new Map;if(t){let i=e??W,a=new Map,l=r.length;for(let u=0;u<l;u++){let f=r[u],m=i(f),h=a.get(m);h===void 0?a.set(m,{val:f,count:1}):h.count++}let c=[];for(let u of a.values())c.push(u.val);for(let u=0;u<l;u++){let f=r[u],m=i(f),h=a.get(m);o.set(f,h.count)}return{values:c,count:c.length,frequencies:o}}let s=r.length;for(let i=0;i<s;i++){let a=r[i];o.set(a,(o.get(a)??0)+1)}return{values:Array.from(o.keys()),count:o.size,frequencies:o}}function Cr(n,{step:t=1,offsetStart:e=0,offsetEnd:r,maxItemsGathered:o,ut:s=!0}={}){if(n==null)return null;if(o!==void 0&&o<=0)return[];if(t===0)throw new Error("Step size step cannot be zero");let i=n.length;if(i===0?e!==0:e>=i||e<-i){if(!s)throw new Error(`Start offset ${e} is out of bounds for array of length ${i}`);return null}let l=e<0?i+e:e,c=r!==void 0?r<0?i+r:r:t>0?i:-1,u=[];if(t>0)for(let f=l;f<c&&f<i&&!(f>=0&&(u.push(n[f]),o!==void 0&&u.length>=o));f+=t);else for(let f=l;f>c&&f>=0&&!(f<i&&(u.push(n[f]),o!==void 0&&u.length>=o));f+=t);return u}function Dr(n,t=",",{ignoreNulls:e=!1,nullValue:r="",prefix:o="",suffix:s="",limit:i,truncationMarker:a="...",valueFormatter:l}={}){let c=n.length,u=[],f=i!==void 0?Math.max(0,i):c,m=!1;for(let h=0;h<c;h++){if(u.length>=f){m=!0;break}let p=n[h];p!=null?u.push(l?l(p,h):String(p)):e||u.push(r)}return o+u.join(t)+(m?a:"")+s}function Ct(n,t,e={}){let r=n.length,{mode:o="cumulative",step:s=1,coerce:i=y=>y,condition:a,reverse:l=!1,startIndex:c=l?r-1:0,endIndex:u=l?-1:r}=e,f=l?-1:1,m=c,h=u,p=(y,d)=>{(!a||a(n[y],y,n))&&(n[y]=i(d))};if(o==="constant"){let y=i(t);for(let d=m;l?d>h:d<h;d+=f)p(d,y)}else if(o==="independent")if(typeof s=="function"){let y=0;for(let d=m;l?d>h:d<h;d+=f)p(d,s({index:y,initialValue:t,originalValue:n[d],absoluteIndex:d,targetArray:n})),y++}else for(let y=m;l?y>h:y<h;y+=f)p(y,t+y*s);else{let y=t,d=!0,g=0;for(let b=m;l?b>h:b<h;b+=f)d?(p(b,y),d=!1):(typeof s=="function"?y=s({prev:y,index:g,originalValue:n[b],absoluteIndex:b,targetArray:n}):y=y+s,p(b,y)),g++}}function Ar(n){let t=n.length,e=0,r=new Float64Array(t);for(let s=0;s<t;s++){let i=n[s],a=K(i,{allowNonFiniteNumbers:!0});a!==null&&z(a,{allowNonFiniteNumbers:!0,allowNaN:!1})&&(r[e++]=a)}if(e===0)return null;let o=r.subarray(0,e);return o.sort(),o}function jt(n){let t=Ar(n);if(!t)return null;let e=t.length,r=Math.floor(e/2);return e%2!==0?t[r]:(t[r-1]+t[r])/2}function fe(n,t){if(t<0||t>1)return null;let e=Ar(n);if(!e)return null;let r=e.length,o=t*(r-1),s=Math.floor(o),i=Math.ceil(o);return s===i?e[s]:e[s]+(o-s)*(e[i]-e[s])}function me(n){if(!O(n)||n.length===0)return null;let t=new Map,e=n.length,r=0,o=[];for(let s=0;s<e;s++){let i=n[s];if(i==null||typeof i=="number"&&!z(i,{allowNonFiniteNumbers:!0,allowNaN:!1}))continue;let a=(t.get(i)??0)+1;t.set(i,a),a>r?(r=a,o=[i]):a===r&&o.push(i)}return o.length===0?null:zt(o)}function Or(n,t){let e=n.length;if(e===0)return[];let r=Math.trunc(t);if(isNaN(r)||r===0)return Array.isArray(n)?n.slice():Array.from(n);let o=Math.abs(r);if(o>=e)return new Array(e).fill(null);let s=new Array(e);if(r>0){s.fill(null,0,r);for(let i=r;i<e;i++){let a=n[i-r];s[i]=a??null}}else{let i=e-o;for(let a=0;a<i;a++){let l=n[a+o];s[a]=l??null}s.fill(null,i,e)}return s}function Ye(n){let t=n.length,e=0,r=0,o=0,s=0,i=0,a=0;for(let m=0;m<t;m++){let h=n[m];if(!h)continue;let p=K(h[0]),y=K(h[1]);if(p===null||y===null)continue;e++;let d=p-r;r+=d/e;let g=p-r,b=y-o;o+=b/e;let S=y-o;a+=d*S,s+=d*g,i+=b*S}if(e<2)return{covariance:null,correlation:null};let l=a/(e-1);if(s===0||i===0)return{covariance:l,correlation:null};let c=Math.sqrt(s*i);if(c===0||Number.isNaN(c))return{covariance:l,correlation:null};let u=a/c,f=Math.max(-1,Math.min(1,u));return{covariance:l,correlation:f}}function Tr(n){let t=n.length,e=new Int32Array(t);for(let s=0;s<t;s++)e[s]=s;e.sort((s,i)=>n[s]-n[i]);let r=new Float64Array(t),o=0;for(;o<t;){let s=o+1;for(;s<t&&n[e[s]]===n[e[o]];)s++;let i=(o+1+s)/2;for(let a=o;a<s;a++)r[e[a]]=i;o=s}return r}function ys(n,t,e){if(e<2)return null;let r=0,o=0,s=0,i=0,a=0;for(let u=0;u<e;u++){let f=n[u],m=t[u],h=f-r;r+=h/(u+1);let p=f-r,y=m-o;o+=y/(u+1);let d=m-o;a+=h*d,s+=h*p,i+=y*d}if(s===0||i===0)return null;let l=Math.sqrt(s*i);if(l===0||Number.isNaN(l))return null;let c=a/l;return Math.max(-1,Math.min(1,c))}function kr(n){let t=n.length,e=new Float64Array(t),r=new Float64Array(t),o=0;for(let a=0;a<t;a++){let l=n[a];if(l){let c=K(l[0]),u=K(l[1]);c!==null&&u!==null&&(e[o]=c,r[o]=u,o++)}}if(o<2)return null;let s=Tr(e.subarray(0,o)),i=Tr(r.subarray(0,o));return ys(s,i,o)}function Ir(n){let t=n.length,e=0,r=0;for(let o=0;o<t;o++){let s=n[o];if(!s)continue;let i=K(s[0]),a=K(s[1]);i===null||a===null||(e+=i*a,r++)}return r>0?e:null}function Er(n){let t=n.length,e=0,r=0,o=0;for(let s=0;s<t;s++){let i=n[s];if(!i)continue;let a=K(i[0]),l=K(i[1]);a===null||l===null||(e+=a*l,r+=l,o++)}return o===0||Math.abs(r)<1e-12?null:e/r}var wr,Sr,Ht=R(()=>{"use strict";gt();Wt();pe();rt();wr=(()=>{try{let n=new Uint8Array(0),t=Object.getPrototypeOf(n),e=Object.getPrototypeOf(t),r=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.get;return r&&r.call(n)==="Uint8Array"?r:void 0}catch{return}})();Sr={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 Rr(n){let t=it(n);return typeof t=="string"?t.trim().length===0:!1}function he(n){let t=it(n);if(t==null)return"";let e=String(t);return typeof RegExp.escape=="function"?RegExp.escape(e):e.replace(ds,"\\$&")}function _t(n,t=null,e={}){if(n==null)return e.returnStringOnNull?"":null;let{mode:r="both",returnStringOnNull:o=!1,maxScanStart:s=1,maxScanEnd:i=1,maxMatchesStart:a=1,maxMatchesEnd:l=1,trimFirst:c=!1,stringOptions:u}=e,{literal:f=!1,caseInsensitive:m=!1}=u??{},h=(T,D="both")=>D==="start"?T.trimStart():D==="end"?T.trimEnd():T.trim(),p=n;if(c&&t!=null&&(p=h(n,r)),t==null){let T=h(p,r);return o||T!==""?T:null}let y=dt(t)?T=>{try{t.lastIndex=0}catch{}return t.test(T)}:(()=>{let T=new Set(m?t.toLowerCase():t);return D=>T.has(m?D.toLowerCase():D)})(),d=p.length;if(s===1&&a===1&&i===1&&l===1&&!f){let T=0,D=d;if(r==="both"||r==="start")for(;T<d&&y(p[T]);)T++;if(r==="both"||r==="end")for(;D>T&&y(p[D-1]);)D--;let v=T===0&&D===d?p:p.substring(T,D);return o||v!==""?v:null}let b=new Uint8Array(d),S=(T,D,v)=>{if(d===0||v===0)return;let mt=T?0:d-1,at=T?d:-1,I=T?1:-1,E=!1,V=0,q=0;for(let J=mt;J!==at;J+=I)if(y(p[J])){if(!E){if(D!==null&&D>=0&&q>=D||v!==null&&v>=0&&V>=v)break;E=!0,V++}b[J]=1}else if(E=!1,q++,D!==null&&D>=0&&q>=D)break},w=(T,D,v,mt,at)=>{if(d===0||at===0||D===0)return;let I=v?0:d-1,E=0,V=0,q=m?p.toLowerCase():p;for(;I>=0&&I<d&&!(at!==null&&at>=0&&E>=at);){let J=v?I:I-D+1;if(!v&&J<0)break;let Y=v?q.indexOf(T,J):q.lastIndexOf(T,J);if(Y===-1)break;let st=v?Y-I:I-(Y+D-1);if(V+=st,mt!==null&&mt>=0&&V>=mt)break;for(let et=0;et<D;et++)b[Y+et]=1;E++,I=v?Y+D:Y-1}};if(r==="both"||r==="start")if(f&&typeof t=="string"){let T=m?t.toLowerCase():t;w(T,t.length,!0,s,a)}else S(!0,s,a);if(r==="both"||r==="end")if(f&&typeof t=="string"){let T=m?t.toLowerCase():t;w(T,t.length,!1,i,l)}else S(!1,i,l);let C="";for(let T=0;T<d;T++)b[T]===0&&(C+=p[T]);return o||C!==""?C:null}function W(n,{depth:t=0,maxDepth:e=50}={}){if(t>e)return"v:circular";if(n===null)return"v:null";if(n===void 0)return"v:undefined";if(M(n))return`d:${n.getTime()}`;if(L(n))return`u:${n.constructor.name}:${n.toString()}`;if(Array.isArray(n)){let r=n.length,o=new Array(r),s={depth:t+1,maxDepth:e};for(let i=0;i<r;i++)o[i]=W(n[i],s);return`a:[${o.join(",")}]`}if(ie(n)){let r=Array.from(n),o=r.length,s=new Array(o),i={depth:t+1,maxDepth:e};for(let a=0;a<o;a++)s[a]=W(r[a],i);return s.sort(),`set:[${s.join(",")}]`}if(ae(n)){let r=Array.from(n.keys()),o=r.length,s=new Array(o),i={depth:t+1,maxDepth:e};for(let a=0;a<o;a++){let l=r[a];s[a]=`${W(l,i)}:${W(n.get(l),i)}`}return s.sort(),`map:{${s.join(",")}}`}if(typeof n=="object"&&typeof n.toJSON=="function"){let r=n.toJSON();if(r!==n)return`j:${W(r,{depth:t+1,maxDepth:e})}`}if(Tt(n)){let r=Object.keys(n).sort(),o=r.length,s=new Array(o),i={depth:t+1,maxDepth:e};for(let a=0;a<o;a++){let l=r[a];s[a]=`${l}:${W(n[l],i)}`}return`o:{${s.join(",")}}`}return dt(n)?`r:${n.toString()}`:typeof n=="function"?`f:${n.toString()}`:typeof n=="string"?`s:${n}`:typeof n=="symbol"?`y:${n.toString()}`:`${typeof n}:${n}`}function ws(n){if(n==null)return[];let t=String(n);if(!t)return[];let r=t.normalize("NFC").replace(gs,"$1$2").match(bs)||[],o=[];for(let s=0;s<r.length;s++){let i=r[s];xs.has(i)||o.push(i)}return o}function Jt(n,t){let e=ws(n),r=e.length;if(r===0)return"";let{format:o}=t;if(o==="camel"||o==="pascal"){let s="";for(let i=0;i<r;i++){let a=e[i];s+=i===0&&o==="camel"?a.toLowerCase():a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()}return s}if(o==="kebab"||o==="snake"){let s=o==="kebab"?"-":"_",i=new Array(r);for(let a=0;a<r;a++)i[a]=e[a].toLowerCase();return i.join(s)}return String(n)}var ds,gs,bs,xs,pe=R(()=>{"use strict";gt();Ht();ds=/[-\/\\^$*+?.()|\[\]{}]/g;gs=/(\p{L})['’](\p{L})/gu,bs=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"),xs=new Set(["__proto__","proto","constructor","prototype"])});var Xe,Ze,Ur=R(()=>{"use strict";Xe=1000n,Ze=1000000n});function Ds(n){let t=Fr.get(n);return t||(t=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}),Fr.set(n,t)),t}function As(n,t){let e=`${n}_${t}`,r=Mr.get(e);return r||(r=new Intl.DateTimeFormat(n,{timeZoneName:"short",timeZone:t}),Mr.set(e,r)),r}function Os(n){let t=Nr.get(n);if(t===void 0){try{Intl.DateTimeFormat(void 0,{timeZone:n}),t=!0}catch{t=!1}Nr.set(n,t)}return t}function ht(n){let t=!n||n==="local"?Intl.DateTimeFormat().resolvedOptions().timeZone:n;return Os(t)?t:"UTC"}function Z(n,t=0,e=1,r=0,o=0,s=0,i=0){let a=new Date(0);return a.setUTCFullYear(n,t,e),a.setUTCHours(r,o,s,i),a}function ks(n,t,e){let r=[0,3,2,5,0,3,5,1,4,6,2,4],o=n;return t<3&&(o-=1),(o+Math.floor(o/4)-Math.floor(o/100)+Math.floor(o/400)+r[t-1]+e)%7}function Yt(n,t){let e=ht(t);if(e.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()};let o=Ds(e).formatToParts(n),s="0",i="0",a="0",l="0",c="0",u="0",f="0";for(let b=0,S=o.length;b<S;b++){let w=o[b];switch(w.type){case"year":s=w.value;break;case"month":i=w.value;break;case"day":a=w.value;break;case"hour":l=w.value;break;case"minute":c=w.value;break;case"second":u=w.value;break;case"fractionalSecond":f=w.value;break}}let m=parseInt(s,10),h=parseInt(i,10),p=parseInt(a,10),y=parseInt(l,10);y===24&&(y=0);let d=Math.round(parseFloat("0."+f)*1e3)||0,g=ks(m,h,p);return{year:m,month:h,day:p,hour:y,minute:parseInt(c,10),second:parseInt(u,10),ms:d,dayOfWeek:g}}function vt(n,t,e){if(t.toUpperCase()==="UTC")return 0;let r=Yt(n,"UTC"),o=e||Yt(n,t),s=Z(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.ms).getTime(),i=Z(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.ms).getTime();return Math.round((i-s)/6e4)}function jr(n,t){let e=n>=0?"+":"-",r=Math.abs(n),o=String(Math.floor(r/60)).padStart(2,"0"),s=String(r%60).padStart(2,"0");return t==="iso"?`${e}${o}:${s}`:`${e}${o}${s}`}function G(n,t){let e=it(n);if(e==null)return null;let r=null;if(M(e))r=e;else if(typeof e=="number"||typeof e=="bigint")r=new Date(Is(e));else if(typeof e=="string"){if(Rr(e))return null;r=new Date(e)}if(!r||!M(r))return null;if(t?.dateOnly){let o=typeof e=="string",s=o&&Cs.test(e),i=o&&!s&&!vr.test(e)?"local":"UTC",a=Yt(r,i);return Z(a.year,a.month-1,a.day)}return r}function de(n){let t=it(n);if(t==null)return null;let e=null;if(typeof t=="string"){let o=t.trim();if(Ts.test(o)){let s=vr.test(o);e=G(`1970-01-01T${o}${s?"":"Z"}`)}}let r=e||G(t);return r?Dt(r,{format:"%H:%M:%S.%ms"}):null}function Lr(n,t="ms"){let e=n.getTime();switch(t){case"s":return Math.floor(e/1e3);case"ms":return e;case"us":return BigInt(e)*Xe;case"ns":return BigInt(e)*Ze}}function Is(n){if(typeof n=="bigint"){let e=n<0n?-n:n;return e<=30000000000n?Number(n)*1e3:e<=30000000000000n?Number(n):e<=30000000000000000n?Number(n/Xe):Number(n/Ze)}let t=Math.abs(n);return t<=3e10?n*1e3:t<=3e13?n:t<=3e16?Math.floor(n/1e3):Math.floor(n/1e6)}function Vr(n){if(!M(n))return null;let t=n.getUTCFullYear();return Math.floor((t-1)/100)+1}function nn(n,t={field:"week"}){if(!M(n))return null;let e=Z(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r=e.getUTCDay()||7;if(e.setUTCDate(e.getUTCDate()+4-r),t.field==="year")return e.getUTCFullYear();let o=Z(e.getUTCFullYear(),0,1),s=Math.round((e.getTime()-o.getTime())/864e5);return Math.floor(s/7)+1}function Pr(n){if(!M(n))return null;let t=n.getUTCFullYear();return Math.floor((t-1)/1e3)+1}function ge(n,t,e=1){return M(n)?Z(n.getUTCFullYear(),n.getUTCMonth()+t,e):null}function rn(n){if(!M(n))return null;let t=Z(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()).getTime(),e=Z(n.getUTCFullYear(),0,1).getTime();return Math.floor((t-e)/864e5)+1}function Br(n){return M(n)?Math.floor(n.getUTCMonth()/3)+1:null}function on(n){let t;if(M(n))t=n.getUTCFullYear();else if(z(n))t=n;else return!1;return t%4===0&&t%100!==0||t%400===0}function $r(n){return n.replace(/%[FTRD]/g,t=>Rs[t]||t)}function Qe(n,t){return new Date(n.getTime()-t*60*1e3)}function Us(n){let t=n.replace(":",""),e=t[0]==="+"?1:-1,r=parseInt(t.slice(1,3),10)||0,o=parseInt(t.slice(3,5),10)||0;return e*(r*60+o)}function Dt(n,{format:t,locale:e,timeZone:r="UTC"}){if(!M(n)||typeof t!="string")return"";let o=e&&e.trim()||Intl.DateTimeFormat().resolvedOptions().locale||"en-US",s=$r(t),i=null,a=()=>i??=Yt(n,r);return s.replace(ye,(l,c)=>{if(c==="%")return"%";let u=sn[c];return u?u.format(n,o,r,a()):l})}function Kr(n,{format:t,strict:e=!0,defaultTimeZone:r="UTC"}){if(typeof n!="string"||typeof t!="string")return null;let o=$r(t),s=[],i="",a=0;ye.lastIndex=0;let l;for(;(l=ye.exec(o))!==null;){let y=o.slice(a,l.index);i+=he(y);let d=l[1];if(d==="%")i+="\\%";else{let g=sn[d];g&&g.parseRegex?(s.push(g),i+=`(${g.parseRegex})`):i+=he(l[0])}a=ye.lastIndex}i+=he(o.slice(a));let c=new RegExp("^\\s*"+i+"\\s*$"),u=n.match(c);if(!u)return e?null:G(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 y=0;y<s.length;y++){let d=u[y+1],g=s[y],b=g.parseNormalize?g.parseNormalize(d):parseInt(d,10);g.key==="j"&&(h=!0),g.parseField==="ampm"?m=b:g.parseField==="offset"?f.offset=b:g.parseField&&(f[g.parseField]=b)}if(m&&(m==="PM"&&f.hour<12&&(f.hour+=12),m==="AM"&&f.hour===12&&(f.hour=0)),h){let y=on(f.year)?366:365;if(f.day<1||f.day>y)return null;let d=Z(f.year,0,1);d.setUTCDate(f.day),f.month=d.getUTCMonth()+1,f.day=d.getUTCDate()}let p=Z(f.year,f.month-1,f.day,f.hour,f.minute,f.second,f.ms);if(!M(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=Qe(p,Us(f.offset));else if(r.toUpperCase()!=="UTC"){let y=ht(r),d=vt(p,y);p=Qe(p,d);let g=vt(p,y);g!==d&&(p=Qe(p,g-d))}return M(p)?p:null}function an(n,t,{excludeWeekdays:e=[],holidays:r=[],roll:o}={}){if(!br(t))throw new ct(`The offset parameter 'n' must be a whole integer. Received: ${t}`);if(7-e.length<=0)throw new ct("All weekdays are excluded; cannot offset.");let i=new Set;if(r instanceof Set)for(let m of r){let h=new Date(m);e.includes(h.getUTCDay())||i.add(m)}else if(Array.isArray(r))for(let m=0;m<r.length;m++){let h=G(r[m]);if(!h||e.includes(h.getUTCDay()))continue;let p=Z(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate());i.add(p.getTime())}let a=m=>e.includes(m.getUTCDay())?!0:i.has(m.getTime()),l=Z(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(o&&a(l)){if(o==="raise")throw new ct("Start date falls on an excluded day or holiday.");let m=o==="forward"?1:-1;for(;a(l);)l.setUTCDate(l.getUTCDate()+m)}if(t===0)return l;let c=t>0?1:-1,u=0,f=Math.abs(t);for(;u<f;)l.setUTCDate(l.getUTCDate()+c),a(l)||u++;return l}function ln(n,t,e){let r=ht(t),o=e?.type??"total",s;if(o==="total")s=vt(n,r);else{let a=Yt(n,r),l=a.year,c=vt(Z(l,0,1),r),u=vt(Z(l,6,1),r),f=Math.min(c,u);o==="daylightSavingTime"?s=vt(n,r,a)-f:s=f}switch(e?.format??"milliseconds"){case"minutes":return s;case"hours":return s/60;case"iso":return jr(s,"iso");case"basic":return jr(s,"basic");default:return s*6e4}}function qr(n,t={}){if(!M(n))return null;let e=t.excludeWeekdays??[0,6],r=n.getUTCDay();if(e.includes(r))return!1;let o=t.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 a=0;a<o.length;a++){let l=G(o[a]);l&&s.add(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))}let i=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(s.has(i))return!1}}return!0}var Ts,vr,Cs,Fr,Mr,Nr,sn,Es,ye,Rs,un=R(()=>{"use strict";pe();rt();gt();Wt();Ur();Ts=/^\d{2}:\d{2}/,vr=/(?:Z|[+-]\d{2}(?::?\d{2})?)$/i,Cs=/^\d{4}-\d{2}-\d{2}$/,Fr=new Map;Mr=new Map;Nr=new Map;sn={Y:{key:"Y",format:(n,t,e,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,t,e,r)=>String(Math.abs(r.year)%100).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"year",parseNormalize:n=>{let t=parseInt(n,10);return t+(t>=69?1900:2e3)}},m:{key:"m",format:(n,t,e,r)=>String(r.month).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"month"},d:{key:"d",format:(n,t,e,r)=>String(r.day).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"day"},e:{key:"e",format:(n,t,e,r)=>String(r.day).padStart(2," "),parseRegex:"\\s?\\d{1,2}",parseField:"day"},H:{key:"H",format:(n,t,e,r)=>String(r.hour).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},I:{key:"I",format:(n,t,e,r)=>String(r.hour%12||12).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},p:{key:"p",format:(n,t,e,r)=>r.hour>=12?"PM":"AM",parseRegex:"AM|PM|am|pm",parseField:"ampm",parseNormalize:n=>n.toUpperCase()},M:{key:"M",format:(n,t,e,r)=>String(r.minute).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"minute"},S:{key:"S",format:(n,t,e,r)=>String(r.second).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"second"},A:{key:"A",format:(n,t,e)=>n.toLocaleDateString(t,{weekday:"long",timeZone:ht(e)})},a:{key:"a",format:(n,t,e)=>n.toLocaleDateString(t,{weekday:"short",timeZone:ht(e)})},B:{key:"B",format:(n,t,e)=>n.toLocaleDateString(t,{month:"long",timeZone:ht(e)})},b:{key:"b",format:(n,t,e)=>n.toLocaleDateString(t,{month:"short",timeZone:ht(e)})},h:{key:"h",format:(n,t,e)=>n.toLocaleDateString(t,{month:"short",timeZone:ht(e)})},j:{key:"j",format:(n,t,e,r)=>String(rn(Z(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,t,e,r)=>String(r.dayOfWeek||7)},w:{key:"w",format:(n,t,e,r)=>String(r.dayOfWeek)},Z:{key:"Z",format:(n,t,e)=>{let r=ht(e);if(r.toUpperCase()==="UTC")return"UTC";let o=As(t,r).formatToParts(n);for(let s=0,i=o.length;s<i;s++)if(o[s].type==="timeZoneName")return o[s].value;return"UTC"}},z:{key:"z",format:(n,t,e)=>ln(n,e,{format:"basic"}),parseRegex:"[+-]\\d{2}(?::?\\d{2})?",parseField:"offset",parseNormalize:n=>n.replace(":","")},ms:{key:"ms",format:(n,t,e,r)=>String(r.ms).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"ms",parseNormalize:n=>parseInt(n,10)},f:{key:"f",format:(n,t,e,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)}},Es=Object.keys(sn).concat("%").sort((n,t)=>t.length-n.length),ye=new RegExp("%("+Es.join("|")+")","g"),Rs={"%F":"%Y-%m-%d","%T":"%H:%M:%S","%R":"%H:%M","%D":"%m/%d/%y"}});function Wr(n,{format:t="json",allowPrimitives:e=!1,trimBeforeParse:r=!1,reviver:o,ndjson:{skipInvalidLines:s=!1,maxLines:i,skipLines:a}={},guard:l,onError:c,fallback:u=Xt}={}){if(typeof n!="string")return u!==Xt?u:n;let f=r?n.trim():n;if(f==="")return u!==Xt?u:n;let m;try{if(t==="ndjson"){let h=[],p=0,y=0,d=0;cn.lastIndex=0;let g;for(;;){g=cn.exec(f);let b=g?f.substring(d,g.index):f.substring(d);g&&(d=cn.lastIndex);let S=b.trim();if(S!==""&&(p++,a===void 0||p>a))if(!e&&!Fs(S)){if(!s)throw new Error("NDJSON line is not wrapped and primitives are disallowed")}else try{if(h.push(JSON.parse(S,o)),y++,i!==void 0&&y>=i)break}catch(w){if(!s)throw w}if(!g)break}if(h.length===0)throw new Error("No valid NDJSON lines processed");m=h}else{if(!e&&!Ms(f))throw new Error("JSON string is not wrapped and primitives are disallowed");m=JSON.parse(f,o)}}catch(h){return c?.(h),u!==Xt?u:n}return l&&!l(m)?(c?.(new Error("Parsed value failed guard validation")),u!==Xt?u:n):m}function Zt(n={}){let t=n.bigintStrategy??"string",e=n.handleCircular?new WeakSet:null,o=Array.isArray(n.replacer)?n.replacer.map(String):null,s=i=>t==="number"&&i<=BigInt(Number.H)&&i>=BigInt(Number.ct)?Number(i):i.toString();return function(a,l){let c=l;if(typeof n.replacer=="function")c=n.replacer.call(this,a,l);else if(o&&a!==""&&!Array.isArray(this)&&!o.includes(a))return;if(c===void 0)return;let u=c===l&&this!=null?this[a]:c;if(typeof n.onCustom=="function"){let f=n.onCustom.call(this,a,u);if(f!==u||f===void 0&&u!==void 0)return f}if(u!==null&&typeof u!="object"&&typeof u!="bigint")return c;if(e&&u!==null&&typeof u=="object"){if(a===""&&(e=new WeakSet),e.has(u))return n.onCircular?n.onCircular.call(this,a,u):"[Circular]";e.add(u)}return typeof u=="bigint"?n.voidBigIntReplacement?c:n.onBigInt?n.onBigInt(u):s(u):L(u)?n.voidTypedArrayReplacement?c:n.onTypedArray?n.onTypedArray(u):Array.from(u):ie(u)?n.voidSetReplacement?c:n.onSet?n.onSet(u):Array.from(u):ae(u)?n.voidMapReplacement?c:n.onMap?n.onMap(u):Array.from(u.entries()):dt(u)?n.voidRegExpReplacement?c:n.onRegExp?n.onRegExp(u):u.toString():M(u)?n.voidDateReplacement?c: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}:lr(u)?n.onURLSearchParams?n.onURLSearchParams(u):u.toString():c}}var cn,Xt,Fs,Ms,be=R(()=>{"use strict";Ht();gt();cn=/\r\n|\n|\r/g,Xt=Symbol("no_fallback"),Fs=n=>{let t=n.length;if(t<2)return!1;let e=n[0],r=n[t-1];return e==="{"&&r==="}"||e==="["&&r==="]"},Ms=n=>{let t=0,e=n.length;for(;t<e&&/\s/.test(n[t]);)t++;let r=e-1;for(;r>=t&&/\s/.test(n[r]);)r--;if(t>=r)return!1;let o=n[t],s=n[r];return o==="{"&&s==="}"||o==="["&&s==="]"}});var Q,Lt,xe,At,Ot,Qt,kt,te,we=R(()=>{"use strict";Q=class n{matches(t){if(t==null)return!1;if(t instanceof n)return!!(this.equals(t)||this.name.startsWith("Decimal")&&t.name.startsWith("Decimal")&&t.precision===void 0&&t.scale===void 0);if(typeof t=="function"){if(t.prototype instanceof n)return this instanceof t;try{let e=t();if(e instanceof n)return this.constructor===e.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}},Lt=class extends Q{get isNumeric(){return!0}},xe=class extends Lt{get isInteger(){return!0}},At=class extends xe{get isSigned(){return!0}},Ot=class extends xe{get isUnsigned(){return!0}},Qt=class extends Lt{get isFloat(){return!0}},kt=class extends Q{get isTemporal(){return!0}},te=class extends Q{get isNested(){return!0}}});var fn,Gr,mn,zr,pn,Hr,hn,Te,yn,Jr,dn,Yr,gn,Xr,bn,Zr,xn,Qr,wn,Ce,Se,Sn,De,Tn,ee,Cn,to,Dn,eo,An,no,On,ro,kn,Ae,In,oo,En,so,Rn,io,Un,ao,Fn=R(()=>{"use strict";we();B();fn=class extends At{name="Int8";coerce(t){return pt(t,{range:"Int8"})}equals(t){return t.name==="Int8"}allocate(t){return new Int8Array(t)}},Gr=new fn,mn=class extends At{name="Int16";coerce(t){return pt(t,{range:"Int16"})}equals(t){return t.name==="Int16"}allocate(t){return new Int16Array(t)}},zr=new mn,pn=class extends At{name="Int32";coerce(t){return pt(t,{range:"Int32"})}equals(t){return t.name==="Int32"}allocate(t){return new Int32Array(t)}},Hr=new pn,hn=class extends At{name="Int64";coerce(t){return Mt(t,{truncate:!0})}equals(t){return t.name==="Int64"}allocate(t){return new BigInt64Array(t)}},Te=new hn,yn=class extends Ot{name="UInt8";coerce(t){return pt(t,{range:"UInt8"})}equals(t){return t.name==="UInt8"}allocate(t){return new Uint8Array(t)}},Jr=new yn,dn=class extends Ot{name="UInt16";coerce(t){return pt(t,{range:"UInt16"})}equals(t){return t.name==="UInt16"}allocate(t){return new Uint16Array(t)}},Yr=new dn,gn=class extends Ot{name="UInt32";coerce(t){return pt(t,{range:"UInt32"})}equals(t){return t.name==="UInt32"}allocate(t){return new Uint32Array(t)}},Xr=new gn,bn=class extends Ot{name="UInt64";coerce(t){return Mt(t,{range:"UInt64"})}equals(t){return t.name==="UInt64"}allocate(t){return new BigUint64Array(t)}},Zr=new bn,xn=class extends Qt{name="Float32";coerce(t){return He(t,{floatPrecision:"Float32"})}equals(t){return t.name==="Float32"}allocate(t){return new Float32Array(t)}},Qr=new xn,wn=class extends Qt{name="Float64";coerce(t){return He(t,{floatPrecision:"Float64"})}equals(t){return t.name==="Float64"}allocate(t){return new Float64Array(t)}},Ce=new wn,Se=class n extends Lt{constructor(e,r){super();this.precision=e;this.scale=r;this.name=e!==void 0&&r!==void 0?`Decimal(${e}, ${r})`:"Decimal"}precision;scale;name;coerce(e){return ue(e,{precision:this.precision,scale:this.scale})}equals(e){return e instanceof n&&this.precision===e.precision&&this.scale===e.scale}allocate(e){return new Array(e).fill(null)}},Sn=class extends Q{name="Boolean";get isBoolean(){return!0}coerce(t){return t==null?null:!!t}equals(t){return t.name==="Boolean"}allocate(t){return new Array(t).fill(null)}},De=new Sn,Tn=class extends Q{name="Utf8";get isString(){return!0}get isUtf8(){return!0}coerce(t){return t==null?null:String(t)}equals(t){return t.name==="Utf8"}allocate(t){return new Array(t).fill(null)}},ee=new Tn,Cn=class extends Q{name="Binary";get isBinary(){return!0}coerce(t){return lo(t)}equals(t){return t.name==="Binary"}allocate(t){return new Array(t).fill(null)}},to=new Cn,Dn=class extends Q{name="Null";get isNull(){return!0}coerce(t){return null}equals(t){return t.name==="Null"}allocate(t){return new Array(t).fill(null)}},eo=new Dn,An=class extends Q{name="Object";get isObject(){return!0}coerce(t){return t===void 0?null:t}equals(t){return t.name==="Object"}allocate(t){return new Array(t).fill(null)}},no=new An,On=class extends kt{name="Date";coerce(t){return G(t,{dateOnly:!0})}equals(t){return t.name==="Date"}allocate(t){return new Array(t).fill(null)}},ro=new On,kn=class extends kt{name="Datetime";coerce(t){return G(t)}equals(t){return t.name==="Datetime"}allocate(t){return new Array(t).fill(null)}},Ae=new kn,In=class extends kt{name="Time";coerce(t){return de(t)}equals(t){return t.name==="Time"}allocate(t){return new Array(t).fill(null)}},oo=new In,En=class extends kt{name="Duration";coerce(t){return K(t)}equals(t){return t.name==="Duration"}allocate(t){return new Array(t).fill(null)}},so=new En,Rn=class n extends te{constructor(e){super();this.innerType=e}innerType;name="Array";coerce(e){if(e==null)return null;let r=O(e)?Array.from(e):[e],o=r.length,s=new Array(o);for(let i=0;i<o;i++)s[i]=this.innerType.coerce(r[i]);return s}equals(e){return e instanceof n&&this.innerType.equals(e.innerType)}allocate(e){return new Array(e).fill(null)}},io=n=>new Rn(n),Un=class n extends te{constructor(e){super();this.fields=e}fields;name="Struct";coerce(e){if(!P(e))return null;let r={},o=Object.keys(this.fields),s=o.length;for(let i=0;i<s;i++){let a=o[i],l=this.fields[a];r[a]=l.coerce(e[a])}return r}equals(e){if(!(e instanceof n))return!1;let r=Object.keys(this.fields),o=Object.keys(e.fields);if(r.length!==o.length)return!1;for(let s=0;s<r.length;s++){let i=r[s];if(!this.fields[i].equals(e.fields[i]))return!1}return!0}allocate(e){return new Array(e).fill(null)}},ao=n=>new Un(n)});var F,xt=R(()=>{"use strict";we();Fn();Fn();we();F={Int8:Gr,Int16:zr,Int32:Hr,Int64:Te,UInt8:Jr,UInt16:Yr,UInt32:Xr,UInt64:Zr,Float32:Qr,Float64:Ce,Decimal:(n,t)=>new Se(n,t),Boolean:De,Utf8:ee,Binary:to,Date:ro,Datetime:Ae,Time:oo,Duration:so,Object:no,Null:eo,Array:io,Struct:ao}});function js(n={}){let t=n.nullValue!==void 0?n.nullValue:"",e=dr(n.numericFormatOptions),r=n.replacerOptions||{},o=a=>n.datetimeFormat?Dt(a,{format:n.datetimeFormat}):n.dateFormat?Dt(a,{format:n.dateFormat}):n.timeFormat?Dt(a,{format:n.timeFormat}):a.toISOString(),s=Zt({formatDate:o,...r}),i=typeof r.onBigInt=="function";return a=>{if(a==null||typeof a=="symbol"||typeof a=="function")return{str:t,isNumeric:!1};if(typeof a=="bigint"&&!i&&!r.voidBigIntReplacement)return{str:e(a),isNumeric:!0};let l=s.call(null,"",a),c=it(l);return c==null||typeof c=="symbol"||typeof c=="function"?{str:t,isNumeric:!1}:typeof c=="string"?{str:c,isNumeric:!1}:typeof c=="number"||typeof c=="bigint"?{str:e(c),isNumeric:!0}:typeof c=="boolean"?{str:c?"true":"false",isNumeric:!1}:typeof c=="object"?{str:JSON.stringify(c,Zt({formatDate:o,...r})),isNumeric:!1}:{str:String(c),isNumeric:!1}}}function ke(n,t,e={}){let{separator:r=",",quoteChar:o='"',includeHeader:s=!0,lineTerminator:i=`
2
+ `,quoteStyle:a="necessary",includeBom:l=!1,onRow:c,...u}=e,f=Object.keys(n),m=f.length,h=[],p=!0,y=js(u),d=(b,S=!1)=>{let w,C=!1;if(S)w=String(b);else{let D=y(b);w=D.str,C=D.isNumeric}if(a==="never")return w;if(a==="always"){let D=w.split(o).join(o+o);return o+D+o}if(a==="non_numeric"&&!C&&b!=null){let D=w.split(o).join(o+o);return o+D+o}if(w.includes(r)||w.includes(o)||w.includes(`
3
+ `)||w.includes("\r")){let D=w.split(o).join(o+o);return o+D+o}return w},g=b=>{if(p){let S=l?"\uFEFF"+b:b;c?c(S):h.push(S),p=!1}else c?c(i+b):h.push(b)};if(s){let b=new Array(m);for(let S=0;S<m;S++)b[S]=d(f[S],!0);g(b.join(r))}for(let b=0;b<t;b++){let S=new Array(m);for(let w=0;w<m;w++)S[w]=d(n[f[w]][b],!1);g(S.join(r))}return c?l?"\uFEFF":"":h.join(i)}function uo(n,t={}){let e=t.separator||",",r=t.quoteChar||'"',o=n;o.startsWith("\uFEFF")&&(o=o.substring("\uFEFF".length));let s=[],i=[],a="",l=!1,c=!1,u=!1,f=o.length;for(let m=0;m<f;m++){let h=o[m];if(l)c=!0,u=!1,h===r?m+1<f&&o[m+1]===r?(a+=r,m++):l=!1:a+=h;else if(h===r)c=!0,u=!1,l=!0;else if(h===e)i.push(a),a="",u=!0;else{let p=!1;h==="\r"?(p=!0,m+1<f&&o[m+1]===`
4
+ `&&m++):h===`
5
+ `&&(p=!0),p?(c||i.length>0||a!==""||u)&&(i.push(a),s.push(i),i=[],a="",c=!1,u=!1):(c=!0,u=!1,a+=h)}}return(c||i.length>0||a!==""||u)&&(i.push(a),s.push(i)),s}function co(n,t={}){let e=new Set(t.nullValues??["","NA","null","NaN"]),r=n.length,o=!0,s=!0,i=!0,a=!0,l=!1;for(let u=0;u<r;u++){let f=n[u].trim();if(!e.has(f)){if(l=!0,o){let m=f.toLowerCase();m!=="true"&&m!=="false"&&m!=="1"&&m!=="0"&&(o=!1)}if(i&&Mt(f,{truncate:!1})===null&&(i=!1),s&&K(f,{allowNonFiniteNumbers:!0})===null&&(s=!1),a&&G(f)===null&&(a=!1),!o&&!s&&!i&&!a)break}}let c=new Array(r);if(!l||!o&&!s&&!i&&!a){for(let u=0;u<r;u++){let f=n[u];c[u]=e.has(f.trim())?null:f}return{type:ee,values:c}}if(o){for(let u=0;u<r;u++){let f=n[u].trim();if(e.has(f))c[u]=null;else{let m=f.toLowerCase();c[u]=m==="true"||m==="1"}}return{type:De,values:c}}if(i){for(let u=0;u<r;u++){let f=n[u].trim();c[u]=e.has(f)?null:Mt(f,{truncate:!1})}return{type:Te,values:c}}if(s){for(let u=0;u<r;u++){let f=n[u].trim();c[u]=e.has(f)?null:K(f,{allowNonFiniteNumbers:!0})}return{type:Ce,values:c}}if(a){for(let u=0;u<r;u++){let f=n[u].trim();c[u]=e.has(f)?null:G(f)}return{type:Ae,values:c}}return{type:ee,values:c}}var fo=R(()=>{"use strict";un();be();Wt();xt();gt()});function _s(n){return n==null?!1:typeof n=="string"||L(n)?!0:Array.isArray(n)}function lo(n){return _s(n)?Object.prototype.toString.call(n)==="[object Uint8Array]"?n:typeof n=="string"?new TextEncoder().encode(n):L(n)?new Uint8Array(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)):new Uint8Array(n):null}var mo=R(()=>{"use strict";Ht()});var B=R(()=>{"use strict";gt();Wt();un();Ht();pe();be();fo();mo()});function tt(n,t,e,r=""){if(!(n in t))throw new wt(n,`${e} "${n}" does not exist${r}`)}function Nn(n,t){let e=Object.keys(n),r=e.length,o=t;for(let s=0;s<r;s++){let i=e[s],a=n[i],l=O(a)?a.length:0;if(o===void 0)o=l;else if(l!==o)throw new X(`Column height mismatch: Column "${i}" has length ${l}, but DataFrame height is ${o}`)}return o===void 0?0:o}var po=R(()=>{"use strict";rt();B()});var Vt,$,wt,ne,ct,X,rt=R(()=>{"use strict";po();Vt=class extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},$=class extends Vt{},wt=class extends ${constructor(t,e){super(e||`Column "${t}" does not exist in the DataFrame.`)}},ne=class extends Vt{},ct=class extends Vt{},X=class extends Vt{}});function Ls(n,t,e){let r=new Map,o=e.length,s=new Array(o);for(let i=0;i<o;i++){let a=e[i];typeof a=="string"?(tt(a,n,"Partition key"," in the DataFrame."),s[i]=n[a]):s[i]=a.evaluate(n,t)}if(o===1){let i=s[0];for(let a=0;a<t;a++){let l=i[a],c=l==null?"":W(l),u=r.get(c);u===void 0&&(u=[],r.set(c,u)),u.push(a)}return r}for(let i=0;i<t;i++){let a=new Array(o);for(let u=0;u<o;u++){let f=s[u][i];a[u]=f==null?"":W(f)}let l=a.join("\0"),c=r.get(l);c===void 0&&(c=[],r.set(l,c)),c.push(i)}return r}function ho(n,t,e){let r=new Array(e);if(e===0)return r;let o=n.p||[],s=Ls(t,e,o),i=n.U(n.T,t,e);for(let a of s.values()){let l=a.length,c=new Array(l);for(let u=0;u<l;u++)c[u]=i[a[u]];if(n.b){for(let u=0;u<l;u++)r[a[u]]=n.b(c,a,u);continue}if(n.m){let u=n.m(c);for(let f=0;f<l;f++)r[a[f]]=u;continue}for(let u=0;u<l;u++)r[a[u]]=i[a[u]]}return n.v(n.T,r,t)}function yo(n){if(!Array.isArray(n)||n.length===0)return{columns:{},height:0};let t=n.length,e=new Set;for(let s=0;s<t;s++){let i=n[s];if(P(i)){let a=Object.keys(i);for(let l=0;l<a.length;l++)e.add(a[l])}}let r=Array.from(e),o={};for(let s=0;s<r.length;s++)o[r[s]]=new Array(t);for(let s=0;s<t;s++){let i=n[s]||{};for(let a=0;a<r.length;a++){let l=r[a],c=i[l];o[l][s]=c===void 0?null:c}}return{columns:o,height:t}}function go(n,t){let e=Object.keys(n),r=new Array(t);for(let o=0;o<t;o++){let s={};for(let i=0;i<e.length;i++){let a=e[i],l=n[a][o];s[a]=l===void 0?null:l}r[o]=s}return r}function Ji(n,t,e){let r={};for(let o=0;o<e.length;o++){let s=e[o],i=n[s][t];r[s]=i===void 0?null:i}return r}function St(n){if(n.length===0)return F.Utf8;let t=!0,e=!0,r=!0,o=!0,s=!0,i=!0,a=!0,l=!0,c=!1,u=!1,f=[];for(let m=0;m<n.length;m++){let h=n[m];if(h!=null){if(u=!0,h instanceof Uint8Array||(a=!1),!O(h)||h instanceof Uint8Array)i=!1;else{let p=h,y=p.length;for(let d=0;d<y;d++)f.push(p[d])}M(h)&&(c=!0),typeof h!="boolean"&&(t=!1),typeof h!="bigint"&&(o=!1),typeof h!="number"?(r=!1,e=!1):Number.isInteger(h)||(e=!1),!M(h)&&(typeof h!="string"||isNaN(Date.parse(h)))&&(s=!1),(!P(h)||h instanceof Uint8Array)&&(l=!1)}}if(!u)return F.Utf8;if(a)return F.Binary;if(i){let m=St(f);return F.Array(m)}if(t)return F.Boolean;if(o)return F.Int64;if(r&&!e)return F.Float64;if(r&&e){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?F.Int32:F.Float64}return s&&c?F.Datetime:l?F.Object:F.Utf8}function re(n,t){let e=Object.keys(n),r=e.length,o=t.length,s={};for(let i=0;i<r;i++){let a=e[i],l=n[a],c=L(l)?new l.constructor(o):new Array(o);for(let u=0;u<o;u++)c[u]=l[t[u]];s[a]=c}return s}function Pt(n,t,e){let r=t.length;if(r===1){let s=n[t[0]][e];return s==null?"":W(s)}let o=new Array(r);for(let s=0;s<r;s++){let i=n[t[s]][e];o[s]=i==null?"":W(i)}return o.join("\0")}function It(n,t,e){let r=t.allocate?t.allocate(e):new Array(e);if(L(r)){let s=r;for(let i=0;i<e;i++){let a=t.coerce(n[i]);if(a==null){let l=new Array(e);for(let c=0;c<i;c++)l[c]=s[c];l[i]=null;for(let c=i+1;c<e;c++)l[c]=t.coerce(n[c]);return l}s[i]=a}}else for(let s=0;s<e;s++)r[s]=t.coerce(n[s]);return r}function bo(n,t){if(n)if(typeof n=="string"){if(typeof Ut!="function")throw new Error("File writing is not supported in this environment (missing require('fs')).");Ut("fs").writeFileSync(n,t,"utf8")}else if(P(n)&&typeof n.write=="function")n.write(t);else throw new TypeError("Invalid file argument. Expected a file path string or a writable stream/object with a write method.")}var Ie=R(()=>{"use strict";xt();B();rt()});function Et(n,t,e){return n.P?ho(n,t,e):n.evaluate(t,e)}var A,U,yt=R(()=>{"use strict";B();Ie();A=n=>t=>{let e=t.length,r=new Array(e);for(let o=0;o<e;o++){let s=t[o];r[o]=s==null?null:n(s)}return r},U=(n,t,e)=>(r,o)=>{let s=r.length,i=n.y(t,o,s),a=new Array(s);if(O(i))for(let l=0;l<s;l++){let c=r[l],u=i[l];a[l]=c==null||u==null?null:e(c,u)}else for(let l=0;l<s;l++){let c=r[l];a[l]=c==null||i==null?null:e(c,i)}return a}});var x,j,ot=R(()=>{"use strict";rt();yt();x=(n,t)=>{let e=n.constructor,r=n.C||n.u||"",o=new e(r);return Object.assign(o,n),o.c=t?[...n.c,t]:[...n.c],o},j=class n{c=[];f="";N;L;m=null;d;T;p=null;b;v(t,e,r){let o=this.c,s=t!==void 0?t:o.length,i=e;for(let a=s;a<o.length;a++)i=o[a](i,r);return i}U(t,e,r){let o=this.Y(e,r),s=this.c,i=t!==void 0?t:s.length;for(let a=0;a<i;a++)o=s[a](o,e);return o}Y(t,e){let r=this.u;if(r&&r!=="*"&&!r.startsWith("*")&&!(r in t))throw new wt(r);return(r&&r!=="*"?t[r]:null)||new Array(e).fill(null)}y(t,e,r){return t instanceof n?t.N&&t.c.length===1?t.L:Et(t,e,r):t}alias(t){let e=x(this);return e.f=t,e}cast(t){return x(this,e=>{let r=e.length,o=new Array(r);for(let s=0;s<r;s++)o[s]=t.coerce(e[s]);return o})}debug(t){return x(this,e=>(console.log(`[DEBUG] ${t?t+": ":""}`,e),e))}evaluate(t,e){return this.U(void 0,t,e)}}});var Ee,xo=R(()=>{"use strict";ot();yt();B();Ee=class extends j{abs(){return x(this,A(Math.abs))}acos(){return x(this,A(t=>t<-1||t>1?null:Math.acos(t)))}acosh(){return x(this,A(t=>t<1?null:Math.acosh(t)))}add(t){return x(this,U(this,t,(e,r)=>e+r))}asin(){return x(this,A(t=>t<-1||t>1?null:Math.asin(t)))}asinh(){return x(this,A(Math.asinh))}atan(){return x(this,A(Math.atan))}atan2(t){return x(this,U(this,t,Math.atan2))}atanh(){return x(this,A(t=>t<=-1||t>=1?null:Math.atanh(t)))}cbrt(){return x(this,A(Math.cbrt))}ceil(){return x(this,A(Math.ceil))}clip(t=null,e=null){return x(this,A(r=>ut(r,{min:t,max:e})))}copysign(t){return x(this,U(this,t,(e,r)=>Math.abs(e)*(r>=0?1:-1)))}cos(){return x(this,A(Math.cos))}cosh(){return x(this,A(Math.cosh))}degrees(){return x(this,A(t=>t*(180/Math.PI)))}div(t){return x(this,U(this,t,(e,r)=>r===0?null:e/r))}exp(){return x(this,A(Math.exp))}expm1(){return x(this,A(Math.expm1))}floor(){return x(this,A(Math.floor))}floordiv(t){return x(this,U(this,t,(e,r)=>r===0?null:Math.floor(e/r)))}hypot(t){return x(this,U(this,t,Math.hypot))}log(t=Math.E){return x(this,A(e=>e<=0?null:t===Math.E?Math.log(e):Math.log(e)/Math.log(t)))}log1p(){return x(this,A(t=>t<=-1?null:Math.log1p(t)))}mod(t){return x(this,U(this,t,(e,r)=>r===0?null:e%r))}mul(t){return x(this,U(this,t,(e,r)=>e*r))}negate(){return x(this,A(t=>-t))}pow(t){return x(this,U(this,t,Math.pow))}radians(){return x(this,A(t=>t*(Math.PI/180)))}rand(t,{min:e=0,max:r=1,integer:o=!1}={}){return x(this,s=>{let i=s.length,a=new Float64Array(i),l=t!==void 0?xr(t):Math.random,c=r-e;for(let u=0;u<i;u++){let f=l();a[u]=o?Math.floor(f*(c+1))+e:f*c+e}return a})}round(t=0){return x(this,A(e=>Je(e,t)))}ft(t){return x(this,A(e=>z(e)?Number(e.toPrecision(t)):e))}sign(){return x(this,A(Math.sign))}sin(){return x(this,A(Math.sin))}sinh(){return x(this,A(Math.sinh))}sqrt(){return x(this,A(t=>t<0?null:Math.sqrt(t)))}sub(t){return x(this,U(this,t,(e,r)=>e-r))}tan(){return x(this,A(Math.tan))}tanh(){return x(this,A(Math.tanh))}trunc(){return x(this,A(Math.trunc))}}});var Re,wo=R(()=>{"use strict";ot();yt();B();Re=class extends j{and(t){return x(this,(e,r)=>{let o=e.length,s=this.y(t,r,o),i=O(s),a=new Array(o);for(let l=0;l<o;l++){let c=e[l],u=i?s[l]:s;c===!1||u===!1?a[l]=!1:c==null||u==null?a[l]=null:a[l]=!0}return a})}not(){return x(this,A(t=>!t))}or(t){return x(this,(e,r)=>{let o=e.length,s=this.y(t,r,o),i=O(s),a=new Array(o);for(let l=0;l<o;l++){let c=e[l],u=i?s[l]:s;c===!0||u===!0?a[l]=!0:c==null||u==null?a[l]=null:a[l]=!1}return a})}xor(t){return x(this,U(this,t,(e,r)=>!!e!=!!r))}}});function So(n,t,e,r){let o=n.length,s=new Array(o);if(e&&typeof e=="object"&&"evaluate"in e){let i=e.evaluate(t,o);for(let a=0;a<o;a++){let l=n[a];if(l==null)s[a]=null;else{let c=i[a],u=new Set;if(O(c)){let m=c.length;for(let h=0;h<m;h++)u.add(W(c[h]))}else u.add(W(c));let f=u.has(W(l));s[a]=r?!f:f}}}else{let i=O(e)?e:[],a=new Set,l=i.length;for(let c=0;c<l;c++)a.add(W(i[c]));for(let c=0;c<o;c++){let u=n[c];if(u==null)s[c]=null;else{let f=a.has(W(u));s[c]=r?!f:f}}}return s}function To(n,t){let{frequencies:e}=bt(n,{strict:!0}),r=n.length,o=new Array(r);for(let s=0;s<r;s++){let i=e.get(n[s])||0;o[s]=t?i>1:i===1}return o}function Co(n,t,e){let r=n.length,o=new Array(r);if(O(t))for(let s=0;s<r;s++){let i=n[s],a=t[s];i==null&&a==null?o[s]=!e:i==null||a==null?o[s]=e:o[s]=e?i!==a:i===a}else for(let s=0;s<r;s++){let i=n[s];i==null&&t==null?o[s]=!e:i==null||t==null?o[s]=e:o[s]=e?i!==t:i===t}return o}var Ue,Do=R(()=>{"use strict";ot();yt();B();Ue=class extends j{between(t,e,r="both"){return x(this,(o,s)=>{let i=o.length,a=this.y(t,s,i),l=this.y(e,s,i),c=new Array(i),u=O(a),f=O(l);for(let m=0;m<i;m++){let h=o[m],p=u?a[m]:a,y=f?l[m]:l;if(h==null||p==null||y==null)c[m]=null;else{let d=r==="both"||r==="left"?h>=p:h>p,g=r==="both"||r==="right"?h<=y:h<y;c[m]=d&&g}}return c})}eq(t){return x(this,U(this,t,(e,r)=>e===r))}mt(t){return x(this,(e,r)=>{let o=this.y(t,r,e.length);return Co(e,o,!1)})}ge(t){return x(this,U(this,t,(e,r)=>e>=r))}gt(t){return x(this,U(this,t,(e,r)=>e>r))}pt(){return this.l(t=>{for(let e=0;e<t.length;e++)if(t[e]==null)return!0;return!1})}ht(t,{yt:e=1e-8,bt:r=1e-8,xt:o=!1}={}){return x(this,(s,i)=>{let a=s.length,l=this.y(t,i,a),c=O(l),u=new Array(a);for(let f=0;f<a;f++){let m=s[f],h=c?l[f]:l;if(m==null||h==null)u[f]=null;else if(z(m)&&z(h)){let p=Math.abs(m-h),y=Math.max(r*Math.max(Math.abs(m),Math.abs(h)),e);u[f]=p<=y}else Number.isNaN(m)&&Number.isNaN(h)?u[f]=o:u[f]=m===h}return u})}wt(){return x(this,t=>To(t,!0))}St({ignoreNulls:t=!1}={}){return x(this,A(e=>typeof e=="string"?e.length===0:O(e)?t?H(e,"nullish",{mode:"every"}):e.length===0:null))}Tt(){return x(this,A(Number.isFinite))}Ct(t){return x(this,(e,r)=>So(e,r,t,!1))}Dt(){return x(this,A(t=>t===1/0||t===-1/0))}At(){return x(this,A(Number.isNaN))}Ot(){return x(this,A(t=>!Number.isNaN(t)))}B(){return x(this,t=>{let e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=t[o]!=null;return r})}kt(){return x(this,t=>{let e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=t[o]==null;return r})}Et(){return x(this,t=>To(t,!1))}le(t){return x(this,U(this,t,(e,r)=>e<=r))}lt(t){return x(this,U(this,t,(e,r)=>e<r))}ne(t){return x(this,U(this,t,(e,r)=>e!==r))}It(t){return x(this,(e,r)=>{let o=this.y(t,r,e.length);return Co(e,o,!0)})}Rt(t){return x(this,(e,r)=>So(e,r,t,!0))}}});var jn,Fe,Ao=R(()=>{"use strict";ot();yt();B();jn=class{constructor(t){this.expr=t}expr;r(t){return x(this.expr,A(e=>t(String(e))))}O(t,e){return t==null?x(this.expr,r=>new Array(r.length).fill(null)):e()}concat(t){return x(this.expr,U(this.expr,t,(e,r)=>String(e)+String(r)))}contains(t){return this.O(t,()=>this.r(e=>dt(t)?t.test(e):e.includes(t)))}X(t){return this.O(t,()=>this.r(e=>{if(dt(t)){let r=t.global?t:new RegExp(t.source,t.flags+"g"),o=e.match(r);return o?o.length:0}else{let r=0,o=e.indexOf(t);for(;o!==-1;)r++,o=e.indexOf(t,o+t.length);return r}}))}Ft(){return this.r(t=>{try{return decodeURIComponent(t)}catch{return t}})}Ut(){return this.r(t=>{try{return encodeURIComponent(t)}catch{return t}})}Nt(t){return this.r(e=>e.endsWith(t))}explode(){return this.r(t=>t.split(""))}extract(t,e=0){return this.O(t,()=>this.r(r=>{let o=r.match(t);return o&&o[e]!==void 0?o[e]:null}))}len(){return this.Z()}Mt(){return this.r(t=>new TextEncoder().encode(t).length)}Z(){return this.r(t=>t.length)}lower(){return this.r(t=>t.toLowerCase())}lpad(t,e=" "){return this.r(r=>r.padStart(t,e))}jt(t,e=" "){return this.rpad(t,e)}_t(t,e=" "){return this.lpad(t,e)}replace(t,e){return this.O(t,()=>this.r(r=>r.replace(t,e)))}vt(t,e){return this.O(t,()=>this.r(r=>r.replaceAll(t,e)))}reverse(){return this.r(t=>t.split("").reverse().join(""))}rpad(t,e=" "){return this.r(r=>r.padEnd(t,e))}slice(t,e){return this.r(r=>{let o=t<0?r.length+t:t,s=e!==void 0?o+e:void 0;return r.slice(o,s)})}split(t){return this.r(e=>e.split(t))}Lt(t){return this.r(e=>e.startsWith(t))}Q(t,e){return this.r(r=>_t(r,t,{mode:"both",...e}))}tt(t,e){return this.r(r=>_t(r,t,{mode:"end",...e}))}et(t,e){return this.r(r=>_t(r,t,{mode:"start",...e}))}Vt(t){return this.r(e=>_t(e,t,{mode:"start",maxScanStart:1,maxMatchesStart:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}Pt(t){return this.r(e=>_t(e,t,{mode:"end",maxScanEnd:1,maxMatchesEnd:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}strptime(t){return this.r(e=>Kr(e,t))}Bt(){return this.r(t=>Jt(t,{format:"camel"}))}$t(){return this.r(t=>G(t,{dateOnly:!0}))}Kt(){return this.r(G)}qt(t,e){return this.r(r=>ue(r,{precision:t,scale:e}))}Jt(){return this.r(t=>pt(t))}Wt(){return this.r(t=>Jt(t,{format:"kebab"}))}Gt(){return this.lower()}zt(){return this.r(t=>Jt(t,{format:"pascal"}))}Ht(){return this.r(t=>Jt(t,{format:"snake"}))}Yt(){return this.r(de)}Xt(){return this.r(t=>t.replace(/\b\w/g,e=>e.toUpperCase()))}Zt(){return this.upper()}trim(){return this.Q()}Qt(){return this.tt()}te(){return this.et()}upper(){return this.r(t=>t.toUpperCase())}zfill(t){return this.r(e=>e.padStart(t,"0"))}},Fe=class extends j{get str(){return new jn(this)}}});var Me,Oo=R(()=>{"use strict";ot();yt();rt();B();Me=class extends j{l(t){let e=x(this);return e.m=t,e.d=this.c.length,e.T=this.c.length,e}k(t,e){return x(this,U(this,t,(r,o)=>[r,o])).l(e)}all(){return this.l(t=>H(t,e=>!!e,{mode:"every"}))}ee(){return this.l(t=>H(t,"nullish",{mode:"every"}))}any(){return this.l(t=>H(t,e=>!!e,{mode:"some"}))}re(){return this.l(t=>H(t,"nullish",{mode:"some"}))}avg(){return this.l(t=>N(t).mean)}corr(t){return this.k(t,e=>Ye(e)?.correlation??null)}count(t={}){return t.includeNulls?this.l(e=>e.length):this.l(e=>N(e).count)}cov(t){return this.k(t,e=>Ye(e)?.covariance??null)}dot(t){return this.k(t,e=>Ir(e))}first(){return this.l(t=>t[0]??null)}implode(){return this.l(t=>t)}last(){return this.l(t=>t[t.length-1]??null)}max(){return this.l(t=>N(t).max)}mean(){return this.avg()}median(){return this.l(t=>jt(t))}min(){return this.l(t=>N(t).min)}mode(){return this.l(t=>me(t))}nt(t={}){return this.l(e=>bt(e,t).count)}oe(){return this.l(t=>N(t).nullCount)}quantile(t){if(t<0||t>1)throw new ct("Quantile q must be between 0 and 1");return this.l(e=>fe(e,t))}se(t){return this.k(t,e=>kr(e))}std(){return this.l(t=>N(t).std)}sum(){return this.l(t=>N(t).sum)}ie(t){return this.k(t,e=>Er(e))}}});function _n(n,t,e={}){if(t==null)return null;let r=e.dense?"_denseRankCache":"_rankCache",o=n[r];if(!o){let s=n;if(e.ignoreNulls){s=[];let l=n.length;for(let c=0;c<l;c++)n[c]!=null&&s.push(n[c])}e.dense&&(s=Array.from(new Set(s)));let i=zt(s);o=new Map;let a=i.length;for(let l=0;l<a;l++){let c=i[l];o.has(c)||o.set(c,l+1)}n[r]=o}return o.get(t)??null}var Ne,ko=R(()=>{"use strict";ot();B();Ne=class extends j{p=this.p||null;x(t){let e=x(this);return e.T=this.c.length,e.d=this.c.length,e.b=t,e}g(t,e){return this.x(function(r,o,s){let i=Math.max(0,s-t+1),a=s+1,l=r.slice(i,a);return e(l)})}I(t,e,r,o){return this.x(function(s,i,a){let l=e,c=!1,u=t?a:0,f=t?s.length-1:a;for(let m=u;m<=f;m++){let h=s[m];h!=null&&(l=r(l,h),c=!0)}return o?o(l,c):l})}get P(){return this.p!==null||this.b!==void 0||this.m!==null}ae(t=!1){return this.I(t,0,e=>e+1)}ue(t=!1){return this.I(t,null,(e,r)=>e===null||r>e?r:e)}ce(t=!1){return this.I(t,null,(e,r)=>e===null||r<e?r:e)}fe(t=!1){return this.I(t,1,(e,r)=>e*r,(e,r)=>r?e:null)}me(t=!1){return this.I(t,0,(e,r)=>e+r)}pe(){return this.x(function(t,e,r){return _n(t,t[r],{dense:!0})})}lag(t=1,e=null){return this.x(function(r,o,s){let i=e;return s-t>=0&&(i=r[s-t]),i})}lead(t=1,e=null){return this.x(function(r,o,s){let i=e;return s+t<r.length&&(i=r[s+t]),i})}over(t){let e=x(this),r=Array.isArray(t)?t:[t];return e.p=r,e}rank(){return this.x(function(t,e,r){return _n(t,t[r])})}he(t){return this.g(t,e=>N(e).max)}ye(t){return this.g(t,e=>N(e).mean)}de(t){return this.g(t,e=>jt(e))}be(t){return this.g(t,e=>N(e).min)}xe(t,e){return this.g(e,r=>fe(r,t))}we(t){return this.g(t,e=>_n(e,e[e.length-1],{ignoreNulls:!0}))}Se(t){return this.g(t,e=>N(e).std)}Te(t){return this.g(t,e=>N(e).sum)}Ce(){let t=this.x(function(e,r,o){return o+1});return t.f="row_number",t}}});var vn,je,Io=R(()=>{"use strict";ot();yt();B();vn=class{constructor(t){this.expr=t}expr;i(t){return x(this.expr,A(e=>{let r=G(e);return r?t(r):null}))}w(t){return x(this.expr,A(e=>typeof e=="number"?t(e):null))}century(){return this.i(Vr)}date(){return this.i(t=>new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())))}day(){return this.i(t=>t.getUTCDate())}De(){return this.i(t=>{let e=ge(t,1,0);return e?e.getUTCDate():null})}epoch(t="ms"){return this.i(e=>Lr(e,t))}hour(){return this.i(t=>t.getUTCHours())}Ae(t={}){return this.i(e=>qr(e,t))}Oe(){return this.i(on)}rt(){return this.i(t=>nn(t,{field:"week"}))}ke(){return this.i(t=>nn(t,{field:"year"}))}microsecond(){return this.i(t=>t.getUTCMilliseconds()*1e3)}millennium(){return this.i(Pr)}millisecond(){return this.i(t=>t.getUTCMilliseconds())}minute(){return this.i(t=>t.getUTCMinutes())}month(){return this.i(t=>t.getUTCMonth()+1)}Ee(){return this.i(t=>ge(t,1,0))}Ie(){return this.i(t=>ge(t,0,1))}nanosecond(){return this.i(t=>t.getUTCMilliseconds()*1e6)}Re(t,{excludeWeekdays:e=[0,6],...r}={}){let o={excludeWeekdays:e,...r};return x(this.expr,U(this.expr,t,(s,i)=>{let a=G(s);return a?an(a,i,o):null}))}Fe(t,e={}){return x(this.expr,U(this.expr,t,(r,o)=>{let s=G(r);return s?an(s,o,e):null}))}Ue(){return this.i(rn)}quarter(){return this.i(Br)}second(){return this.i(t=>t.getUTCSeconds())}strftime(t){return this.i(e=>Dt(e,t))}time(){return this.i(t=>t.toISOString().split("T")[1].slice(0,12))}timestamp(t="ms"){return this.epoch(t)}Ne(t){return this.strftime(t)}Me(){return this.w(t=>t/864e5)}je(){return this.w(t=>t/36e5)}_e(){return this.w(t=>t*1e3)}ve(){return this.w(t=>t)}Le(){return this.w(t=>t/6e4)}Ve(){return this.w(t=>t*1e6)}Pe(){return this.w(t=>t/1e3)}Be(t,e={}){return x(this.expr,A(r=>{let o=G(r);return o?ln(o,t,e):null}))}week(){return this.rt()}weekday(){return this.i(t=>t.getUTCDay()||7)}year(){return this.i(t=>t.getUTCFullYear())}},je=class extends j{get dt(){return new vn(this)}}});var Ln,_e,Eo=R(()=>{"use strict";ot();yt();B();Ft();Ln=class{constructor(t){this.expr=t}expr;s(t){return x(this.expr,A(e=>O(e)?t(e):null))}all(){return this.s(t=>H(t,e=>!!e,{mode:"every"}))}any(){return this.s(t=>H(t,e=>!!e,{mode:"some"}))}contains(t){return this.s(e=>e.includes(t))}$e(t){return this.s(e=>H(t,r=>e.includes(r),{mode:"every"}))}Ke(t){return this.s(e=>H(t,r=>e.includes(r),{mode:"some"}))}X(t,e={}){return this.s(r=>bt(r,e).frequencies.get(t)??0)}filter(t){return x(this.expr,(e,r)=>{let o=e.length,s=new Array(o),i=Object.create(r);for(let a=0;a<o;a++){let l=e[a];if(!O(l)){s[a]=null;continue}let c=l.length;i[$t]=l;let u=Et(t,i,c),f=[];if(O(u)){let m=Math.min(c,u.length);for(let h=0;h<m;h++)u[h]&&f.push(l[h])}else if(u)for(let m=0;m<c;m++)f.push(l[m]);s[a]=f}return s})}explode({qe:t=!0,Je:e=!0}={}){return x(this.expr,r=>{let o=r.length,s=0;for(let c=0;c<o;c++){let u=r[c];if(O(u)){s+=u.length||(t?1:0);continue}if(u!=null){s+=1;continue}e&&(s+=1)}let i=new Array(s),a=new Int32Array(s),l=0;for(let c=0;c<o;c++){let u=r[c];if(O(u)){let f=u.length;if(f>0){for(let m=0;m<f;m++)a[l]=c,i[l++]=u[m];continue}t&&(a[l]=c,i[l++]=null);continue}if(u!=null){a[l]=c,i[l++]=u;continue}e&&(a[l]=c,i[l++]=null)}return i.rowMap=a,i})}first(t=!0){return this.get(0,t)}gather(t,e=!0){return this.s(r=>{let o=typeof t=="number"?[t]:t,s=o.length,i=new Array(s);for(let a=0;a<s;a++)i[a]=ce(r,o[a],e);return i})}We(t={}){return this.s(e=>Cr(e,t))}get(t,e=!0){return this.s(r=>ce(r,t,e))}join(t=",",e={}){return this.s(r=>Dr(r,t,e))}last(t=!0){return this.get(-1,t)}len(){return this.lengths()}lengths(){return this.s(t=>t.length)}max(){return this.s(t=>N(t).max)}Ge(){return this.s(t=>N(t).maxIdx)}mean(){return this.s(t=>N(t).mean)}median(){return this.s(t=>jt(t))}min(){return this.s(t=>N(t).min)}ze(){return this.s(t=>N(t).minIdx)}mode(){return this.s(t=>me(t))}nt(t={}){return this.s(e=>bt(e,t).count)}reverse(){return this.s(t=>t.slice().reverse())}shift(t=1){return this.s(e=>Or(e,t))}slice(t,e){return this.s(r=>r.slice(t,e))}splice(t,e,...r){return this.s(o=>{let s=[...o];return s.splice(t,e??s.length,...r),s})}sort(t){return this.s(e=>zt(e,t))}std(){return this.s(t=>N(t).std)}sum(){return this.s(t=>N(t).sum)}He({Ye:t,fields:e}={}){return x(this.expr,r=>{let o=r.length,s=new Array(o),i=0;if(Array.isArray(e))i=e.length;else if(typeof t=="number")i=t;else for(let l=0;l<o;l++){let c=r[l];O(c)&&c.length>i&&(i=c.length)}if(i===0)throw new Error("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(i);for(let l=0;l<i;l++)typeof e=="function"?a[l]=e(l):a[l]=(Array.isArray(e)?e[l]:null)??`field_${l}`;for(let l=0;l<o;l++){let c=r[l];if(!O(c)){s[l]=null;continue}let u={};for(let f=0;f<i;f++)u[a[f]]=ce(c,f,!0);s[l]=u}return s})}unique(t={}){return this.s(e=>bt(e,t).values)}variance(){return this.s(t=>N(t).variance)}eval(t){return x(this.expr,(e,r)=>{let o=e.length,s=new Array(o);for(let i=0;i<o;i++){let a=e[i];if(!O(a)){s[i]=null;continue}let l=a.length,c={...r,[$t]:a};if(t.m!=null&&(t.p==null||t.p.length===0)){let f=t.d!==void 0?t.d:t.c.length,m=t.U(f,c,l),h=t.m(Array.from(m));s[i]=t.v(f,[h],c)}else s[i]=Et(t,c,l)}return s})}},_e=class extends j{get arr(){return new Ln(this)}}});var ve,Ro=R(()=>{"use strict";ot();B();ve=class extends j{$({value:t=void 0,strategy:e=void 0,limit:r=void 0}={}){return x(this,(o,s)=>{let i=o.length,a=Array.from(o);if(e!==void 0)if(e==="zero"||e==="one"||e==="min"||e==="max"||e==="mean"){let l;e==="zero"?l=0:e==="one"?l=1:l=N(o)[e],Ct(a,l,{mode:"constant",condition:c=>c==null})}else if(e==="forward"||e==="backward"){let l=e==="forward",c=null,u=0;Ct(a,null,{mode:"independent",reverse:!l,step:({originalValue:f})=>f!=null?(c=f,u=0,f):c!==null&&(r===void 0||u<r)?(u++,c):null})}else throw new Error(`Unsupported fill_null strategy: "${e}"`);else{let l=this.y(t,s,i),c=O(l);Ct(a,null,{mode:"independent",step:({index:u,originalValue:f})=>f??(c?l[u]:l)})}return a})}reverse(){return x(this,t=>t.slice().reverse())}}});var Uo={};Ko(Uo,{ColumnExpr:()=>k,resolveColumnSelectors:()=>Rt});function Bs(n,t){for(let e of t)for(let r of Object.getOwnPropertyNames(e.prototype))r!=="constructor"&&Object.defineProperty(n.prototype,r,Object.getOwnPropertyDescriptor(e.prototype,r)||Object.create(null))}function $s(n,t,e,r){if(!(n instanceof k)){if(P(n)&&"evaluate"in n&&!n.u){let o=[];for(let s=0;s<t.length;s++)e.has(t[s])||o.push(t[s]);return o}return null}if(n.C&&n.C.length>0)return n.C;if(n.u==="*"){let o=new Set(n.K),s=[];for(let i=0;i<t.length;i++){let a=t[i];!o.has(a)&&!e.has(a)&&s.push(a)}return s}if(n.M||n.D&&n.D.length>0){if(!r)throw new Error("Cannot resolve DataType column selector without DataFrame schema.");let o=[];for(let s=0;s<t.length;s++){let i=t[s];if(e.has(i))continue;let a=r[i];if(a){if(n.M)a.matches(n.M)&&o.push(i);else if(n.D){for(let l=0;l<n.D.length;l++)if(a.matches(n.D[l])){o.push(i);break}}}}return o}return null}function Rt(n,t,e,r,o){let s=[],i=e?new Set(e):new Set;for(let a=0;a<n.length;a++){let l=n[a];if(typeof l=="string"){s.push(new k(l));continue}if(P(l)&&l.isUnnest){let u=[],f=l.u;if(typeof f=="string"&&r&&r[f]&&r[f].name==="Struct"&&(u=Object.keys(r[f].fields)),u.length===0&&o){let p=Object.keys(o)[0],y=p?o[p].length:0,d=l.baseExpr.evaluate(o,y),g=d.length;for(let b=0;b<g;b++){let S=d[b];if(S!=null&&typeof S=="object"){u=Object.keys(S);break}}}let m=u.length;if(m>0){for(let h=0;h<m;h++){let p=u[h],y=l.baseExpr.struct.field(p);s.push(y)}continue}}let c=$s(l,t,i,r);if(c!==null)for(let u=0;u<c.length;u++){let f=new k(c[u]);f.c=[...l.c||[]],f.m=l.m,f.T=l.T,f.d=l.d,f.p=l.p,l.b&&(f.b=l.b),l.f&&l.f!=="*"&&(f.f=l.f),s.push(f)}else s.push(l)}return s}var k,ft=R(()=>{"use strict";ot();xo();Do();Oo();ko();Ao();wo();Io();Eo();Fo();Ro();B();xt();k=class n extends j{u="";C;K=[];M;D;static isColExpr(t){if(!P(t))return!1;try{return"evaluate"in t&&typeof t.evaluate=="function"}catch{return!1}}static toColExpr(t){if(t==null)throw new Error("Column reference cannot be null or undefined.");return n.isColExpr(t)?t:new n(t)}constructor(t){super(),Array.isArray(t)?t.some(r=>r instanceof Q||typeof r=="function")?this.D=t:this.C=t.map(String):t instanceof Q||typeof t=="function"?this.M=t:(this.u=String(t),this.f=this.u)}};Bs(k,[Ee,Ue,Me,Ne,Fe,Re,je,_e,Le,ve])});function Mo(n){if(n==null)throw new Error("Column reference cannot be null or undefined.");return Ve||(Ve=(ft(),Wo(Uo)).ColumnExpr),Ve.isColExpr(n)?n:new Ve(n)}var Ve,Vn,Le,Fo=R(()=>{"use strict";ot();Ve=null;Vn=class{constructor(t){this.expr=t;return new Proxy(this,{get(e,r,o){return r in e?Reflect.get(e,r,o):typeof r=="string"?e.field(r):Reflect.get(e,r,o)}})}expr;field(t){return x(this.expr,e=>{let r=e.length,o=new Array(r);for(let s=0;s<r;s++){let i=e[s];o[s]=i!=null&&typeof i=="object"?i[t]:null}return o}).alias(t)}Xe(t){return x(this.expr,e=>{let r=e.length,o=new Array(r),s=Object.keys(t),i=s.length;for(let a=0;a<r;a++){let l=e[a];if(l==null||typeof l!="object"){o[a]=null;continue}let c={},u=Object.keys(l),f=u.length;for(let m=0;m<f;m++){let h=u[m];c[h]=l[h]}for(let m=0;m<i;m++){let h=s[m];if(h in c){let p=t[h];c[p]=c[h],delete c[h]}}o[a]=c}return o})}ot(t){return x(this.expr,(e,r)=>{let o=e.length,s=new Array(o),i=[];if(Array.isArray(t)){let c=t.length;for(let u=0;u<c;u++){let f=t[u],m=Mo(f),h=m.f||m.u;if(!h)throw new Error("Expressions passed to struct.with_fields must have a name/alias.");i.push({name:h,expr:m})}}else if(t&&typeof t=="object"){let c=Object.keys(t),u=c.length;for(let f=0;f<u;f++){let m=c[f],h=Mo(t[m]);i.push({name:m,expr:h})}}let a=i.length,l=new Array(a);for(let c=0;c<a;c++)l[c]=i[c].expr.evaluate(r,o);for(let c=0;c<o;c++){let u=e[c];if(u==null||typeof u!="object"){s[c]=null;continue}let f={},m=Object.keys(u),h=m.length;for(let p=0;p<h;p++){let y=m[p];f[y]=u[y]}for(let p=0;p<a;p++)f[i[p].name]=l[p][c];s[c]=f}return s})}unnest(){let t=x(this.expr);return t.isUnnest=!0,t.baseExpr=this.expr,t}},Le=class extends j{get struct(){return new Vn(this)}}});ft();Ft();rt();B();function Bt(n,t={strict:!0}){let e=t,r=new k(Gn);return r.L=n,e.name&&(r.f=e.name),r.c.push(o=>{let s=o.length,i=(C,T)=>C===void 0?T:ut(C<0?s+C:C,{min:0,max:s}),a=i(e.startIndex,0),l=i(e.endIndex,s),c=Math.max(0,l-a),u=e.n!==void 0?e.n:c,f=e.strict!==!1;if(f){if(u!==s)throw new X(`Column height mismatch: seq_range length ${u} does not match DataFrame height ${s}`)}else{let C=e.pad??!1,T=e.truncate??!1;if(C&&!T&&u>c)throw new X(`Cannot pad seq_range output: specified length ${u} starting at index ${a} exceeds slice width ${c} (requires truncation).`);if(T&&!C&&u<c)throw new X(`Cannot truncate seq_range output: specified length ${u} starting at index ${a} is less than slice width ${c} (requires padding).`)}let m=s,h=!!e.dtype,p=e.mode||"cumulative",y=e.step!==void 0?e.step:1,d=h?C=>e.dtype.coerce(C):C=>C;if(f){let C=e.dtype?.allocate?e.dtype.allocate(m):new Array(m);return Ct(C,n,{mode:p,step:y,coerce:d,startIndex:0,endIndex:m}),C}let g=Math.min(a+u,l),b=e.padValue!==void 0?e.padValue:null,S=d(b);if(p==="constant"&&a===0&&g===m&&!e.dtype){let C=new Array(m);for(let T=0;T<m;T++)C[T]=n;return C}let w=new Array(m);return w.fill(S),Ct(w,n,{mode:p,step:y,coerce:d,startIndex:a,endIndex:g}),w}),r}function Pe(n,t){let e=Bt(n,{strict:!0,mode:"constant",dtype:t?.dtype,name:t?.name});return e.N=!0,e}ft();function oe(){return new k("*")}ft();function No(n){let t=new k("*");return t.K=Array.isArray(n)?n:[n],t}ft();B();Ft();function jo(...n){let t=n.length===1&&Array.isArray(n[0])?n[0]:n,e=new k(zn);return e.c.push((r,o)=>{let s=r.length,i=u=>k.isColExpr(u)?u.evaluate(o,s):typeof u=="string"?o[u]||new Array(s).fill(null):u,a=t.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=i(t[u]);let c=new Array(s);for(let u=0;u<s;u++){let f=null;for(let m=0;m<a;m++){let h=l[m],p=O(h)?h[u]:h;if(p!=null){f=p;break}}c[u]=f}return c}),e}ft();B();var Pn=class{h;S;constructor(t,e){this.h=t,this.S=e}then(t){return new Be(this.h,this.S.concat(t))}},Bn=class{h;constructor(t){this.h=[t]}then(t){return new Be(this.h,[t])}},Be=class n extends k{h;S;q;constructor(t,e,r=null){super(typeof t=="string"?t:"*when*"),this.h=Array.isArray(t)?t:[],this.S=e||[],this.q=r,this.c.push((o,s)=>{let i=o.length,a=h=>k.isColExpr(h)?h.evaluate(s,i):typeof h=="string"&&h in s?s[h]:h,l=this.h.length,c=new Array(l),u=new Array(l);for(let h=0;h<l;h++)c[h]=a(this.h[h]),u[h]=a(this.S[h]);let f=a(this.q),m=new Array(i);for(let h=0;h<i;h++){let p=!1;for(let y=0;y<l;y++)if((O(c[y])?c[y][h]:c[y])===!0){m[h]=O(u[y])?u[y][h]:u[y],p=!0;break}p||(m[h]=O(f)?f[h]:f)}return m})}when(t){return new Pn(this.h.concat(t),this.S)}otherwise(t){return new n(this.h,this.S,t)}};function _o(n){return new Bn(n)}ft();function vo(n){return k.toColExpr(n).implode()}ft();Ft();function Lo(){return new k($t)}ft();Ft();function Vo(n,...t){let e;Array.isArray(n)||n&&typeof n=="object"&&!k.isColExpr(n)?e=n:e=[n,...t];let r=Pe({}).struct.ot(e);return delete r.N,delete r.L,r.u=Hn,r.alias("struct")}Ie();var $e=class{A;R;V;F;J;j;constructor(t,e,r,o,s,i){this.A=t,this.R=e,this.V=r,this.F=o,this.J=s,this.j=i}Ze(){let t=this.R.length,e=new Array(t);for(let a=0;a<t;a++)e[a]=String(this.R[a]);let r=this.A.size,o={};for(let a=0;a<e.length;a++)o[e[a]]=new Array(r);let s=0;for(let a of this.A.values()){if(a.length===0)continue;let l=a[0];for(let c=0;c<e.length;c++){let u=e[c],f=this.F[u][l];o[u][s]=f===void 0?null:f}s++}let i={};for(let a of e)i[a]=this.j[a];return _.a(o,i,s)}agg(...t){let e=this.V.length,r=new Array(e);for(let f=0;f<e;f++)r[f]=String(this.V[f]);let o=this.R.length,s=new Array(o);for(let f=0;f<o;f++)s[f]=String(this.R[f]);let i=Rt(t.flat(),r,s,this.j,this.F),a=this.A.size,l={};for(let f=0;f<s.length;f++)l[s[f]]=new Array(a);let c=0;for(let f of this.A.values()){if(f.length===0)continue;let m=f[0];for(let h=0;h<s.length;h++){let p=s[h],y=this.F[p][m];l[p][c]=y===void 0?null:y}c++}for(let f=0;f<i.length;f++){let m=i[f],h=m.f||m.u||"*";if(!m.m)l[h]=m.evaluate(l,a);else{let p=m.U(m.d,this.F,this.J),y=new Array(a),d=0;for(let g of this.A.values()){if(g.length===0)continue;let b=new Array(g.length);for(let S=0;S<g.length;S++)b[S]=p[g[S]];y[d]=m.m(b),d++}l[h]=m.v(m.d,y,l)}}let u={};for(let f of s)u[f]=this.j[f];for(let f of i){let m=f.f||f.u||"*";u[m]=St(l[m])}return _.a(l,u,c)}};be();xt();B();rt();xt();B();rt();function Ks(n,t,e){if(n==null)throw new $(`Invalid input to ${t} at index ${e}: item cannot be null or undefined.`);if(n instanceof _)return[n];if(Tt(n))return[new _(n)];if(O(n)){if(H(n,_,{mode:"every"}))return n;if(H(n,"plainObject",{mode:"every"}))return[new _(n)];let r=H(n,_,{mode:"some"});for(let o=0;o<n.length;o++)if(r?!(n[o]instanceof _):!Tt(n[o]))throw new $(r?`Invalid input to ${t} at index ${e}, sub-index ${o}: nested array must contain only DataFrame instances.`:`Invalid input to ${t} at index ${e}, row ${o}: rows must be plain objects.`)}throw new $(`Invalid input to ${t} at index ${e}: expected DataFrame, row array, or column dictionary.`)}function se(n,{how:t="vertical",horizontal:e}={}){if(n==null)throw new $("Invalid input to concat: rawItems cannot be null or undefined.");let r=Array.isArray(n)?n:[n],o=[];for(let i=0;i<r.length;i++)o.push(...Ks(r[i],"concat",i));let s=e?.strict??!0;if(o.length===0)return _.a({},{},0);if(o.length===1&&t!=="horizontal")return o[0];switch(t){case"vertical":{let i=[];for(let p=0;p<o.length;p++)o[p].height>0&&i.push(o[p]);if(i.length===0)return _.a({},{},0);let a=i[0],l=Object.keys(a.t);for(let p=0;p<o.length;p++){let y=o[p];if(y.height===0)continue;let d=Object.keys(y.t);if(l.length!==d.length)throw new $(`[Strict Vertical] Column count mismatch at index ${p}.`);for(let g=0;g<l.length;g++){if(l[g]!==d[g])throw new $(`[Strict Vertical] Schema mismatch at position ${g} in DF ${p}. Expected column "${l[g]}", but found "${d[g]}".`);let b=a.schema[l[g]],S=y.schema[l[g]];if(b&&S&&!b.equals(S))throw new ne(`[Strict Type Check] Schema type mismatch for column "${l[g]}": expected ${b.name}, found ${S.name}.`)}}let c=0;for(let p of o)c+=p.height;let u={},f=o.length;for(let p=0;p<f;p++)if(o[p].height>0){u=o[p].schema;break}Object.keys(u).length===0&&f>0&&(u=o[0].schema);let m={};for(let p of l){let y=u[p],d=!1;for(let b of o){let S=b.t[p];if(!S){d=!0;break}if(!L(S)){for(let w=0;w<S.length;w++)if(S[w]==null){d=!0;break}}if(d)break}let g=y&&y.allocate?y.allocate(c):new Array(c).fill(null);d&&L(g)&&(g=new Array(c).fill(null)),m[p]=g}let h=0;for(let p of o){let y=p.height;if(y!==0){for(let d of l){let g=p.t[d]||new Array(y).fill(null),b=m[d];if(L(b)&&L(g))b.set(g,h);else{let S=b;for(let w=0;w<y;w++)S[h+w]=g[w]}}h+=y}}return _.a(m,u,c)}case"horizontal":{let i=o[0].height;for(let u=1;u<o.length;u++)o[u].height>i&&(i=o[u].height);let a=new Set;for(let u=0;u<o.length;u++){let f=o[u];if(s&&f.height!==i)throw new X(`[Horizontal] Row count mismatch at index ${u}. Expected ${i}, got ${f.height}. Set strict=false to allow padding.`);for(let m of Object.keys(f.t)){if(a.has(m))throw new $(`[Horizontal] Duplicate column name "${m}" detected. Horizontal concat requires unique names.`);a.add(m)}}let l={},c={};for(let u of o){let f=u.height;Object.assign(c,u.schema);let m=Object.keys(u.t),h=m.length;for(let p=0;p<h;p++){let y=m[p],d=u.t[y];if(f===i)l[y]=L(d)?Array.from(d):d;else{let g=new Array(i);for(let b=0;b<f;b++)g[b]=d[b];for(let b=f;b<i;b++)g[b]=null;l[y]=g}}}return _.a(l,c,i)}case"diagonal":{let i=new Set;for(let m of o)for(let h of Object.keys(m.t))i.add(h);let a=Array.from(i),l=0;for(let m=0;m<o.length;m++)l+=o[m].height;let c={};for(let m of a){let h=null;for(let p of o){let y=p.schema[m];if(y){if(h===null)h=y;else if(!h.equals(y))throw new ne(`[Strict Type Check] Schema type mismatch for column "${m}": expected ${h.name}, found ${y.name}.`)}}c[m]=h||F.Utf8}let u={};for(let m=0;m<a.length;m++)u[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 y=0;y<a.length;y++){let d=a[y],g=u[d],b=h.t[d];if(b!==void 0)if(L(b)&&L(g))g.set(b,f);else{let S=g;for(let w=0;w<p;w++)S[f+w]=b[w]}else{let S=g;for(let w=0;w<p;w++)S[f+w]=null}}f+=p}}return _.a(u,c,l)}}}Ie();var _=class n{t;e;o={};static a(t,e,r){Nn(t,r);let o=Object.create(n.prototype);return o.t=t,o.o=e,o.e=r,o}constructor(t,e,r){if(Array.isArray(t)){let{columns:o,height:s}=yo(t);this.t=o,this.e=s,e?this._(e):this.W();return}if(P(t)){this.t=t,this.e=Nn(t,r),e?this._(e):this.W();return}this.t={},this.e=0,e?this._(e):this.o={}}W(){let t={},e=Object.keys(this.t),r=e.length;for(let o=0;o<r;o++){let s=e[o];t[s]=St(this.t[s])}this._(t)}_(t){this.o=t;let e=Object.keys(t),r={};for(let o of e){let s=t[o],i=this.t[o];r[o]=i?It(i,s,this.e):It(new Array(this.e).fill(null),s,this.e)}this.t=r}get columns(){return Object.keys(this.t)}concat(t,e={}){let r=H(t,n,{mode:"every",allowEmpty:!1})?t:[t];return se([this,...r],e)}drop(...t){let e=new Set(t.flat()),r={},o={};for(let s of Object.keys(this.t))e.has(s)||(r[s]=this.t[s],o[s]=this.o[s]);return n.a(r,o,this.e)}Qe(t){return this.e===0?this:this.filter(t?new k(t).B():oe().B())}get dtypes(){let t=Object.keys(this.t),e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=this.o[t[o]];return r}explode(t,e){let r=k.toColExpr(t),o=r.C||[r.u||r.f],s=new Set,i=o.length;for(let u=0;u<i;u++){let f=o[u];if(!f)throw new $("Expression passed to explode must have a column name.");tt(f,this.t,"Explode column"),s.add(f)}let a=Object.keys(this.t),l=[],c=a.length;for(let u=0;u<c;u++){let f=a[u];l.push(s.has(f)?new k(f).arr.explode(e):new k(f))}return this.select(...l)}$(t={}){return this.e===0?this:this.st(oe().$(t))}filter(...t){if(this.e===0)return n.a({},this.o,0);let e=this.e,r=Object.keys(this.t),o=r.length,s=[],i=[],a=[],l=t.length;for(let d=0;d<l;d++){let g=t[d];typeof g=="function"?i.push(g):a.push(g)}let c=Rt(a,r,void 0,this.o,this.t),u=c.length;for(let d=0;d<u;d++)s.push(c[d].evaluate(this.t,e));let f=[],m=0,h=null;if(i.length>0){let d=this.t;h={};for(let g=0;g<o;g++){let b=r[g],S=d[b];Object.defineProperty(h,b,{get(){let w=S[m];return w===void 0?null:w},enumerable:!0,configurable:!0})}}for(let d=0;d<e;d++){let g=!0;for(let b=0;b<s.length;b++)if(!s[b][d]){g=!1;break}if(g){if(h){m=d;for(let b=0;b<i.length;b++)if(!i[b](h)){g=!1;break}}g&&f.push(d)}}let p=re(this.t,f),y=f.length;return n.a(p,this.o,y)}tn(){return this.o}groupby(t){let e=Gt(t),r=new Map,o=this.e,s=Nt(t);for(let a=0;a<s.length;a++)tt(s[a],this.t,"Grouping key");for(let a=0;a<o;a++){let l=Pt(this.t,s,a),c=r.get(l);c===void 0&&r.set(l,c=[]),c.push(a)}let i=Object.keys(this.t);return new $e(r,e,i,this.t,this.e,this.o)}head(t=10){return this.limit(t,{offset:0,from:"start"})}get height(){return this.e}hstack(t,e={}){return this.concat(t,{how:"horizontal",horizontal:e})}it(t,e,r){let o=k.toColExpr(r).alias(e),s=Object.keys(this.t),i=s.length,a=[];for(let c=0;c<i;c++){let u=s[c];u!==e&&a.push(u)}let l=Math.max(0,Math.min(t,a.length));return a.splice(l,0,o),this.select(...a)}item(t,e){let r=this.e,o=Object.keys(this.t),s=o.length;if(t===void 0&&e===void 0){if(r!==1||s!==1)throw new $("DataFrame.item() can only be called without arguments if the shape is (1, 1).");return this.t[o[0]][0]}if(t===void 0||e===void 0)throw new $("DataFrame.item() requires both row and column to be specified if not empty.");if(t<0||t>=r)throw new X(`Row index ${t} is out of bounds for DataFrame height ${r}.`);let i;if(typeof e=="number"){if(e<0||e>=s)throw new X(`Column index ${e} is out of bounds for DataFrame width ${s}.`);i=o[e]}else if(i=e,this.t[i]===void 0)throw new wt(i);return this.t[i][t]}*en(){let t=Object.keys(this.t),e=t.length,r=this.t;for(let o=0;o<e;o++)yield r[t[o]]}*nn({named:t=!1}={}){let e=Object.keys(this.t),r=e.length,o=this.t,s=this.e,i=new Array(r);for(let a=0;a<r;a++)i[a]=o[e[a]];if(t)for(let a=0;a<s;a++){let l={};for(let c=0;c<r;c++)l[e[c]]=i[c][a];yield l}else for(let a=0;a<s;a++){let l=new Array(r);for(let c=0;c<r;c++)l[c]=i[c][a];yield l}}join(t){let{other:e,on:r,how:o="inner",suffixes:s=["","_right"]}=t,i=Nt(r);for(let I=0;I<i.length;I++){let E=i[I];tt(E,this.t,"Join key"," in the left DataFrame."),tt(E,e.t,"Join key"," in the right DataFrame.")}let[a,l]=s,c=Object.keys(this.t),u=Object.keys(e.t),f=new Set(i),m=c.length,h=u.length,p=(I,E)=>{let V=i.length;for(let q=0;q<V;q++)if(I[i[q]][E]==null)return null;return Pt(I,i,E)},y=new Map,d=e.e,g=e.t;for(let I=0;I<d;I++){let E=p(g,I);if(E===null)continue;let V=y.get(E);V===void 0&&(V=[],y.set(E,V)),V.push(I)}let b=this.e,S=this.t,w=[],C=[],T=o==="outer"||o==="right",D=T?new Set:null;for(let I=0;I<b;I++){let E=p(S,I),V=E===null?void 0:y.get(E);if(V===void 0)(o==="left"||o==="outer")&&(w.push(I),C.push(null));else for(let q=0;q<V.length;q++){let J=V[q];T&&D.add(J),w.push(I),C.push(J)}}if(T)for(let I=0;I<d;I++)D.has(I)||(w.push(-1),C.push(I));let v=w.length,mt={},at={};for(let I=0;I<m;I++){let E=c[I],V=E in e.t&&!f.has(E)?`${E}${a}`:E,q=this.t[E],J=f.has(E),Y=new Array(v);if(J){let st=e.t[E];for(let et=0;et<v;et++){let qn=w[et];if(qn!==-1)Y[et]=q[qn];else{let Wn=C[et];Y[et]=Wn!==null?st[Wn]:null}}}else for(let st=0;st<v;st++){let et=w[st];Y[st]=et!==-1?q[et]:null}mt[V]=Y,this.o[E]&&(at[V]=this.o[E])}for(let I=0;I<h;I++){let E=u[I];if(!f.has(E)){let V=E in this.t?`${E}${l}`:E,q=e.t[E],J=new Array(v);for(let Y=0;Y<v;Y++){let st=C[Y];J[Y]=st!==null?q[st]:null}mt[V]=J,e.o[E]&&(at[V]=e.o[E])}}return n.a(mt,at,v)}limit(t,{offset:e=0,from:r="start"}={}){let o=this.e,s=ut(Math.floor(t),{min:0,max:o}),i=ut(Math.floor(e),{min:0,max:o}),a=i,l=Math.min(i+s,o);r==="end"&&(l=o-i,a=Math.max(l-s,0));let c=l-a,u={},f=Object.keys(this.t),m=f.length;for(let h=0;h<m;h++){let p=f[h];u[p]=this.t[p].slice(a,l)}return n.a(u,this.o,c)}pivot(t){if(this.e===0)return n.a({},{},0);let{index:e,columns:r,values:o}=t,s=Nt(e),i=s.length;for(let C=0;C<i;C++)tt(s[C],this.t,"Pivot index key");let a=String(r),l=String(o);tt(a,this.t,"Pivot column key"),tt(l,this.t,"Pivot values key");let c=new Map,u=[],f=new Set,m=this.e,h=this.t[a],p=this.t[l];for(let C=0;C<m;C++){let T=Pt(this.t,s,C);f.add(String(h[C])),c.get(T)===void 0&&(c.set(T,c.size),u.push(C))}let y=c.size,d={},g={};for(let C=0;C<i;C++){let T=s[C];d[T]=this.t[T],this.o[T]&&(g[T]=this.o[T])}let b=re(d,u),S=Array.from(f),w=this.o[l]||F.Utf8;for(let C=0;C<S.length;C++){let T=S[C];b[T]=new Array(y).fill(null),g[T]=w}for(let C=0;C<m;C++){let T=Pt(this.t,s,C),D=c.get(T),v=String(h[C]);b[v][D]=p[C]}return n.a(b,g,y)}rename(t){let e=t||{},r={},o={},s=Object.keys(this.t);for(let a of s){let l=e[a]||a;r[l]=this.t[a],o[l]=this.o[a]}if(Object.keys(r).length<s.length)throw new $("Rename collision: Multiple columns mapped to the same output name.");return n.a(r,o,this.e)}reverse(){if(this.e===0)return this;let t={},e=Object.keys(this.t),r=e.length;for(let o=0;o<r;o++){let s=e[o];t[s]=this.t[s].slice().reverse()}return n.a(t,this.o,this.e)}get schema(){return this.o}select(...t){let e=this.G(t),r=Object.keys(this.t),o=Rt(e,r,void 0,this.o,this.t),s=o.length;if(s===0)return n.a({},{},this.e);let i={},a={},l=new Array(s),c=new Array(s),u=new Set,f=null;for(let p=0;p<s;p++){let y=o[p],d=y.f||y.u||"*";if(u.has(d))throw new $(`Duplicate column selection: "${d}" is selected multiple times.`);u.add(d);let g=Et(y,this.t,this.e);l[p]=g,c[p]=d;let b=g&&g.rowMap;if(b)if(f){let S=b.length;if(S!==f.length)throw new X(`Mismatched explode heights: Column "${d}" has length ${S}, but another exploded column has length ${f.length}`);for(let w=0;w<S;w++)if(b[w]!==f[w])throw new X(`Mismatched explode heights: Column "${d}" has mismatched row lengths compared to another exploded column.`)}else f=b}let m=f?f.length:this.e,h=s>0;for(let p=0;p<s;p++){let y=o[p],d=y.m!=null&&(y.p==null||y.p.length===0),g=!!y.N;if(!d&&!g){h=!1;break}}for(let p=0;p<s;p++){let y=c[p],d=l[p],g=d,b=g&&g.rowMap,S=O(d)?d.length:0,w=f&&!b?this.e:m;if(S!==w)throw new X(`Column height mismatch: Column "${y}" has length ${S}, but expected ${w}`);if(f&&!b){let C=f.length;if(L(d)){let T=new g.constructor(C);for(let D=0;D<C;D++)T[D]=g[f[D]];d=T}else{let T=new Array(C);for(let D=0;D<C;D++)T[D]=g[f[D]];d=T}}l[p]=d}h&&(m=1);for(let p=0;p<s;p++){let y=o[p],d=c[p],g=l[p],b=y.u||d,w=y instanceof k&&y.c.length===0&&!y.P&&!y.m&&this.o[b]||St(g);a[d]=w,i[d]=It(g,w,m)}return n.a(i,a,m)}get shape(){return[this.height,this.width]}slice(t,e){let r=this.e,o=t<0?Math.max(r+t,0):Math.min(t,r),s=e===void 0?r:e<0?Math.max(r+e,0):Math.min(e,r),i=Math.max(s-o,0);return this.limit(i,{offset:o})}sort(t){if(!t||!t.by||this.e===0)return this;let{by:e,descending:r=!1,nullsLast:o=!0,custom:s}=t,i=Gt(e);for(let p=0;p<i.length;p++){let y=k.toColExpr(i[p]);y.u&&tt(y.u,this.t,"Sort key")}let a=Array.isArray(r)?r:new Array(i.length).fill(r),l=i.length,c=new Array(l);for(let p=0;p<l;p++){let y=i[p],d=a[p]?-1:1,g=s&&typeof y=="string"?s[y]:null,b=k.toColExpr(y).evaluate(this.t,this.e);c[p]={values:b,isDesc:d,customComp:g}}let u=c.length,f=o?1:-1,m=new Array(this.e);for(let p=0;p<this.e;p++)m[p]=p;m.sort((p,y)=>{for(let d=0;d<u;d++){let{values:g,isDesc:b,customComp:S}=c[d],w=g[p],C=g[y];if(S){let D=S(w,C);if(D!==0)return D*b;continue}if(w==null||C==null){if(w===C)continue;return(w==null?1:-1)*f}if(w===C)continue;return(w<C?-1:1)*b}return 0});let h=re(this.t,m);return n.a(h,this.o,this.e)}tail(t=10){return this.limit(t,{offset:0,from:"end"})}rn(){return{...this.t}}z(){return go(this.t,this.e)}sn(t){if(this.e===0)return[];if(t==null)return new Array(this.e).fill(null);let r=k.toColExpr(t).evaluate(this.t,this.e);return Array.isArray(r)?r:Array.from(r)}transpose({an:t=!1,ln:e="column",un:r}={}){if(this.e===0){let u={},f={};return t&&(u[e]=It([],F.Utf8,0),f[e]=F.Utf8),n.a(u,f,0)}let o=this.columns;typeof r=="string"&&(tt(r,this.t,"column_names"),o=o.filter(u=>u!==r));let s=[];if(typeof r=="string"){let u=this.t[r];s=new Array(this.e);for(let f=0;f<this.e;f++){let m=u[f];if(m==null)throw new $(`Transpose column_names column "${r}" contains null/undefined at index ${f}`);s[f]=String(m)}}else if(r!=null&&typeof r!="string"&&Symbol.iterator in Object(r)){let u=Array.from(r);if(u.length!==this.e)throw new $(`column_names length (${u.length}) must match the height of the DataFrame (${this.e})`);s=new Array(this.e);for(let f=0;f<this.e;f++)s[f]=String(u[f])}else{s=new Array(this.e);for(let u=0;u<this.e;u++)s[u]=`column_${u}`}let i=new Set;t&&i.add(e);for(let u=0;u<s.length;u++){let f=s[u];if(i.has(f))throw new $(`Duplicate column name in transposed DataFrame: "${f}"`);i.add(f)}let a=o.length,l={},c={};t&&(l[e]=It(o,F.Utf8,a),c[e]=F.Utf8);for(let u=0;u<this.e;u++){let f=s[u],m=new Array(a);for(let p=0;p<a;p++)m[p]=this.t[o[p]][u];let h=St(m);l[f]=It(m,h,a),c[f]=h}return n.a(l,c,a)}unique(t){if(this.e===0)return n.a({},this.o,0);let e=Gt(t),r=e.length===0?Object.keys(this.t):e.map(String);for(let c of r)tt(c,this.t,"Unique column key");let o=new Set,s=[],i=this.e;for(let c=0;c<i;c++){let u=Pt(this.t,r,c);o.has(u)||(o.add(u),s.push(c))}let a=re(this.t,s),l=s.length;return n.a(a,this.o,l)}unpivot(t){let{idVars:e,valueVars:r,varName:o="variable",valueName:s="value"}=t,i=Nt(e),a=Nt(r),l=i.length,c=a.length;for(let p of i)tt(p,this.t,"Unpivot id variable key");for(let p of a)tt(p,this.t,"Unpivot value variable key");let u=this.e*c,f={};for(let p=0;p<l;p++)f[i[p]]=new Array(u);f[o]=new Array(u),f[s]=new Array(u);let m=0;for(let p=0;p<this.e;p++)for(let y=0;y<c;y++){let d=a[y];for(let g=0;g<l;g++){let b=i[g];f[b][m]=this.t[b][p]}f[o][m]=d,f[s][m]=this.t[d][p],m++}let h={};for(let p of i)h[p]=this.o[p];return h[o]=F.Utf8,h[s]=St(f[s]),n.a(f,h,u)}vstack(t){return this.concat(t,{how:"vertical"})}get width(){return Object.keys(this.t).length}G(t){let e=t.flat(),r=[];for(let o of e)if(typeof o=="string")r.push(new k(o));else if(k.isColExpr(o))r.push(o);else if(P(o)){let s=Object.keys(o),i=s.length;for(let a=0;a<i;a++){let l=s[a],c=o[l];if(k.isColExpr(c))r.push(c.alias(l));else{let u=new k(l);u.evaluate=(f,m)=>new Array(m).fill(c),r.push(u)}}}return r}st(...t){if(t.length===0)return this;let e=this.G(t),r=Object.keys(this.t),o=Rt(e,r,void 0,this.o,this.t),s=o.length;if(s===0)return this;let i=new Map;for(let c=0;c<s;c++){let u=o[c],f=u.f||u.u||"*";i.set(f,u)}let a=[],l=r.length;for(let c=0;c<l;c++){let u=r[c];a.push(i.get(u)||new k(u)),i.delete(u)}for(let c of i.values())a.push(c);return this.select(...a)}cn(t="index",e=0){let r=Bt(e,{mode:"independent",dtype:F.UInt32,step:1}),o=this.it(0,t,r);return o.o[t]=F.UInt32,o}fn(t,{format:e="json",replacerOptions:r}={}){if(e!=="json"&&e!=="ndjson")throw new TypeError(`Unsupported JSON format: "${e}". Expected "json" or "ndjson".`);let o=r?.replacer===null?void 0:Zt(r),s;if(e==="ndjson"){let i=this.z(),a=i.length,l=new Array(a);for(let c=0;c<a;c++)l[c]=JSON.stringify(i[c],o);s=l.join(`
6
+ `)}else s=JSON.stringify(this.z(),o);return bo(t,s),s}mn(t,e={}){if(t){if(typeof t=="string"){if(typeof Ut!="function")throw new Error("File writing is not supported in this environment (missing require('fs')).");let r=Ut("fs"),o=r.openSync(t,"w");try{ke(this.t,this.e,{...e,onRow:s=>{r.writeSync(o,s,null,"utf8")}})}finally{r.closeSync(o)}}else if(P(t)&&typeof t.write=="function")ke(this.t,this.e,{...e,onRow:r=>{t.write(r)}});else throw new TypeError("Invalid file argument. Expected a file path string or a writable stream/object with a write method.");return""}return ke(this.t,this.e,e)}};xt();B();rt();function $n(n,{format:t="json",trimBeforeParse:e=!0,schema:r,...o}={}){let s=Wr(n,{format:t,trimBeforeParse:e,...o});if(s===n)throw new $(`Invalid JSON input: must be a valid, non-empty JSON ${t} string.`);let i=Array.isArray(s)?s:P(s)?[s]:[];return new _(i,r)}B();function Kn(n,t={}){let{hasHeader:e=!0,schema:r,inferSchema:o=!0}=t,s=uo(n,t);if(s.length===0)return new _({});let i,a;e?(i=s[0],a=s.slice(1)):(i=s[0].map((m,h)=>`column_${h}`),a=s);let l=i.length,c=a.length,u={};for(let m=0;m<l;m++){let h=i[m],p=new Array(c);for(let y=0;y<c;y++)p[y]=a[y][m]!==void 0?a[y][m]:"";u[h]=p}let f={};for(let m=0;m<l;m++){let h=i[m],p=u[h];if(r&&r[h])f[h]=p;else if(o){let{values:y}=co(p,t);f[h]=y}else f[h]=p}return new _(f,r)}function qs(n,t){return new _(n,t)}var hu={data:qs,col:n=>new k(n),all:oe,exclude:No,coalesce:jo,concat:se,pn:$n,hn:Kn,lit:Pe,when:_o,implode:vo,yn:Bt,element:Lo,struct:Vo,DataType:F};xt();rt();export{hu as $df,nt as ALL_COLUMNS_MARKER,Me as AggregationExpr,Ee as ArithmeticExpr,io as Array,io as ArrayDataType,_e as ArrayExpr,Ln as ArrayExprNamespace,Rn as ArrayType,to as Binary,Cn as BinaryType,De as Boolean,De as BooleanDataType,Sn as BooleanType,zn as COALESCE_MARKER,k as ColumnExpr,wt as ColumnNotFoundError,Ue as ComparisonExpr,ct as ComputeError,Vt as DFScriptError,_ as DataFrame,$ as DataFrameError,Q as DataType,F as DataTypeRegistry,ro as Date,ro as DateDataType,vn as DateTimeExprNamespace,On as DateType,Ae as Datetime,kn as DatetimeType,Se as DecimalType,so as Duration,En as DurationType,$t as ELEMENT_MARKER,j as ExprBase,Qr as Float32,xn as Float32Type,Ce as Float64,wn as Float64Type,Qt as FloatDataType,$e as GroupedData,zr as Int16,mn as Int16Type,Hr as Int32,pn as Int32Type,Te as Int64,hn as Int64Type,Gr as Int8,fn as Int8Type,xe as IntegerDataType,Gn as LITERAL_MARKER,Re as LogicalExpr,te as NestedDataType,eo as Null,Dn as NullType,Lt as NumericDataType,no as Object,no as ObjectDataType,An as ObjectType,Hn as STRUCT_MARKER,ne as SchemaError,X as ShapeError,At as SignedIntegerType,Fe as StringExpr,jn as StringExprNamespace,ao as Struct,Le as StructExpr,Vn as StructExprNamespace,Un as StructType,kt as TemporalDataType,je as TemporalExpr,oo as Time,In as TimeType,Yr as UInt16,dn as UInt16Type,Xr as UInt32,gn as UInt32Type,Zr as UInt64,bn as UInt64Type,Jr as UInt8,yn as UInt8Type,Ot as UnsignedIntegerType,ee as Utf8,Tn as Utf8Type,Bn as When,Be as WhenThen,Pn as WhenThenChain,Ne as WindowExpr,oe as all,tt as assertColumnExists,Nn as assertHeight,jo as coalesce,It as coerceColumn,go as columnsToRows,Pt as computeRowHash,se as concat,x as derive,Lo as element,Et as evaluateExpression,No as exclude,re as gatherColumnsByIndices,Ji as getRowFromColumns,vo as implode,St as inferColumnType,U as kleeneBinary,A as kleeneUnary,Pe as lit,Kn as read_csv,$n as read_json,Rt as resolveColumnSelectors,ho as resolveWindowExpr,yo as rowsToColumns,Bt as seq_range,Vo as struct,_o as when,bo as writeStringToFileOrStream};
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /** @typefile */
1
2
  import type { DataFrame } from "./dataframe/dataframe";
2
3
  import type { RegisteredDataType } from "./datatypes";
3
4
  export type { RegisteredDataType };
@@ -20,30 +21,58 @@ export type AggFn<V, R = any> = (values: V[]) => R;
20
21
  export type OpFn = (vals: ColumnData, columns: ColumnDict) => ColumnData;
21
22
  export type IntoExpr = string | IExpr;
22
23
  export interface IExpr {
23
- ops: OpFn[];
24
- colName?: string;
25
- outputName?: string;
26
- isLiteral?: boolean;
27
- literalValue?: any;
28
- aggFn?: AggFn<any> | null;
29
- groupingOpsIndex?: number;
30
- partitionOpsIndex?: number;
31
- partitionBy?: (string | IExpr)[] | null;
32
- windowOp?: {
24
+ _ops: OpFn[];
25
+ _colName?: string;
26
+ _outputName?: string;
27
+ _isLiteral?: boolean;
28
+ _literalValue?: any;
29
+ _aggFn?: AggFn<any> | null;
30
+ _groupingOpsIndex?: number;
31
+ _partitionOpsIndex?: number;
32
+ _partitionBy?: (string | IExpr)[] | null;
33
+ _windowOp?: {
33
34
  type: string;
34
35
  [key: string]: any;
35
36
  } | null;
36
- isWindow?: boolean;
37
+ _isWindow?: boolean;
37
38
  alias(name: string): this;
38
39
  cast(dataType: RegisteredDataType): this;
39
40
  _resolve(val: any, columns: ColumnDict, height: number): ColumnData | any;
40
41
  evaluate(columns: ColumnDict, height: number): ColumnData;
41
- evaluatePre(opsIndex: number | undefined, columns: ColumnDict, height: number): ColumnData;
42
- evaluatePost(opsIndex: number | undefined, aggregatedArray: any[], columns: ColumnDict): ColumnData;
43
- evaluateWindow?(groupPreValues: any[], partitionIndices: number[], currentIndex: number): any;
42
+ _evaluatePre(opsIndex: number | undefined, columns: ColumnDict, height: number): ColumnData;
43
+ _evaluatePost(opsIndex: number | undefined, aggregatedArray: any[], columns: ColumnDict): ColumnData;
44
+ _evaluateWindow?(groupPreValues: any[], partitionIndices: number[], currentIndex: number): any;
44
45
  debug(label?: string): this;
45
46
  }
46
47
  export type TimeUnit = "s" | "ms" | "us" | "ns";
48
+ export type DateDiffUnit = "ms" | "milliseconds" | "s" | "seconds" | "m" | "minutes" | "h" | "hours" | "d" | "days" | "w" | "weeks" | "mo" | "months" | "q" | "quarters" | "y" | "years";
49
+ export interface DateDiffOptions {
50
+ roundMode?: "exact" | "floor" | "ceil" | "round" | "trunc";
51
+ }
52
+ export interface StrptimeOptions {
53
+ format: string;
54
+ strict?: boolean;
55
+ defaultTimeZone?: string;
56
+ }
57
+ export interface StrftimeOptions {
58
+ format: string;
59
+ locale?: string;
60
+ timeZone?: string;
61
+ }
62
+ export type BusinessDayRollType = "raise" | "forward" | "backward";
63
+ export interface IsBusinessDayOptions {
64
+ holidays?: (Date | string | number)[] | Set<number>;
65
+ excludeWeekdays?: number[];
66
+ }
67
+ export interface BusinessDayOffsetOptions extends IsBusinessDayOptions {
68
+ roll?: BusinessDayRollType;
69
+ }
70
+ export type UtcOffsetType = "base" | "total" | "daylightSavingTime";
71
+ export type UtcOffsetFormat = "milliseconds" | "minutes" | "hours" | "iso" | "basic";
72
+ export interface UtcOffsetOptions {
73
+ type?: UtcOffsetType;
74
+ format?: UtcOffsetFormat;
75
+ }
47
76
  /** Concatenation Configuration */
48
77
  export type ConcatHow = "vertical" | "horizontal" | "diagonal";
49
78
  export interface HorizontalConcatOptions {
@@ -73,3 +102,7 @@ export interface FillNullOptions {
73
102
  strategy?: FillNullStrategy;
74
103
  limit?: number;
75
104
  }
105
+ export interface ToStructOptions {
106
+ fields?: string[] | ((idx: number) => string);
107
+ upper_bound?: number;
108
+ }
@@ -1,4 +1,4 @@
1
- import type { AnyTypedArray } from "../types";
1
+ import type { AnyTypedArray, ColumnData } from "../types";
2
2
  export declare function isTypedArray(v: unknown): v is AnyTypedArray;
3
3
  export declare function isArrayOrTypedArray(v: unknown): v is any[] | AnyTypedArray;
4
4
  export type ArrayItemType = "string" | "number" | "boolean" | "bigint" | "object" | "plainObject" | "date" | "any" | "null" | "undefined" | "nullish" | (new (...args: any[]) => any) | ((v: unknown) => boolean);
@@ -10,6 +10,7 @@ export type IsArrayOfTypeOptionsParams = {
10
10
  };
11
11
  export declare function toValidArray<T>(val: T | T[] | null | undefined): T[];
12
12
  export declare function toValidStringArray(val: unknown): string[];
13
+ export declare function getArrayElement(arr: any[] | AnyTypedArray, index: number, null_on_oob: boolean): any;
13
14
  export declare function isArrayOfType(arr: unknown, type: ArrayItemType, { mode, allowNulls, allowEmpty }?: IsArrayOfTypeOptionsParams): boolean;
14
15
  export interface SortArrayOptions {
15
16
  descending?: boolean;
@@ -21,6 +22,8 @@ export declare function getArrayStats(arr: unknown): {
21
22
  count: number;
22
23
  min: any;
23
24
  max: any;
25
+ minIdx: number | null;
26
+ maxIdx: number | null;
24
27
  mean: number | null;
25
28
  variance: number;
26
29
  std: number;
@@ -215,3 +218,31 @@ export declare function computeQuantile(values: ArrayLike<any>, q: number): numb
215
218
  * Returns an array of the most frequent values, sorted, or null if empty/no mode.
216
219
  */
217
220
  export declare function computeMode(values: ArrayLike<any>): any[] | null;
221
+ export declare function shiftArray(arr: any[] | AnyTypedArray, n: number): any[];
222
+ /**
223
+ * Robust, single-pass computation using Welford's algorithm to calculate
224
+ * covariance, variances, and correlation simultaneously with high numerical stability.
225
+ */
226
+ export declare function computeStatisticalMatrix(pairs: ColumnData<[any, any]>): {
227
+ covariance: number | null;
228
+ correlation: number | null;
229
+ } | null;
230
+ /**
231
+ * Core mathematical engine that runs a high-performance, single-pass Welford calculation
232
+ * directly on two flat, unzipped numeric buffers to maximize memory efficiency.
233
+ */
234
+ export declare function computeCorrelationOfFlatArrays(xArr: ArrayLike<number>, yArr: ArrayLike<number>, count: number): number | null;
235
+ /**
236
+ * Computes Spearman Rank Correlation Coefficient
237
+ * Optimized to achieve near-zero secondary allocations.
238
+ */
239
+ export declare function computeSpearmanCorrelation(pairs: ColumnData<[any, any]>): number | null;
240
+ /**
241
+ * Computes the dot product of two arrays of pairs.
242
+ */
243
+ export declare function computeDotProduct(pairs: ColumnData<[any, any]>): number | null;
244
+ /**
245
+ * Computes the weighted average of two arrays of pairs.
246
+ * Defensive against absolute sum-zero weight errors.
247
+ */
248
+ export declare function computeWeightedAverage(pairs: ColumnData<[any, any]>): number | null;
@@ -1,3 +1,4 @@
1
+ /** @internalfile */
1
2
  import type { ColumnDict } from "../types";
2
3
  import { type SafeJsonReplacerOptions } from "./json";
3
4
  import { type NumericFormatOptions } from "./number";
@@ -1,28 +1,6 @@
1
- import type { TimeUnit } from "../types";
2
- /**
3
- * Matches string values beginning with standard hour-and-minute formatting.
4
- * Examples:
5
- * - "12:34" (matches "12:34")
6
- * - "10:37:16.123" (matches "10:37")
7
- * - "2026-05-25" (does not match)
8
- * */
1
+ import type { TimeUnit, StrptimeOptions, StrftimeOptions, IsBusinessDayOptions, BusinessDayOffsetOptions, DateDiffUnit, DateDiffOptions, UtcOffsetOptions } from "../types";
9
2
  export declare const TIME_PREFIX_REGEX: RegExp;
10
- /**
11
- * Matches timezone offset indicators at the end of a string.
12
- * Examples:
13
- * - "12:34:56Z" (matches "Z")
14
- * - "12:34:56+02:00" (matches "+02:00")
15
- * - "12:34:56-0500" (matches "-0500")
16
- * - "12:34:56-05" (matches "-05")
17
- * - "12:34:56" (does not match)
18
- */
19
3
  export declare const ZONE_OFFSET_REGEX: RegExp;
20
- /**
21
- * Matches strict ISO 8601 date-only format (YYYY-MM-DD).
22
- * Examples:
23
- * - "2026-05-25" (matches)
24
- * - "2026-05-25T10:37:16Z" (does not match)
25
- */
26
4
  export declare const ISO_DATE_ONLY_REGEX: RegExp;
27
5
  export declare function toValidDate(input: unknown, options?: {
28
6
  dateOnly?: boolean;
@@ -31,13 +9,18 @@ export declare function toValidTime(val: unknown): string | null;
31
9
  export declare function toEpoch(d: Date, unit?: TimeUnit): number | bigint;
32
10
  export declare function normalizeEpochToMs(n: number | bigint): number;
33
11
  export declare function getCentury(d: Date): number | null;
34
- export declare function getISOWeek(d: Date): number | null;
12
+ export declare function getISO(d: Date, options?: {
13
+ field: "week" | "year";
14
+ }): number | null;
35
15
  export declare function getMillennium(d: Date): number | null;
36
16
  export declare function getMonthOffset(d: Date, monthOffset: number, day?: number): Date | null;
17
+ export declare function dateDiff(d1: Date, d2: Date, unit: DateDiffUnit, { roundMode }?: DateDiffOptions): number | null;
37
18
  export declare function getOrdinalDay(d: Date): number | null;
38
19
  export declare function getQuarter(d: Date): number | null;
39
20
  export declare function isLeapYear(yOrDate: number | Date): boolean;
40
21
  export declare const FORMAT_REGEX: RegExp;
41
- export declare function expandFormatShorthands(format: string): string;
42
- export declare function strftime(d: Date, format: string, locale?: string, timeZone?: string): string;
43
- export declare function strptime(str: string, format: string, strict?: boolean, defaultTimeZone?: string): Date | null;
22
+ export declare function strftime(d: Date, { format, locale, timeZone }: StrftimeOptions): string;
23
+ export declare function strptime(str: string, { format, strict, defaultTimeZone }: StrptimeOptions): Date | null;
24
+ export declare function offsetDay(d: Date, n: number | any, { excludeWeekdays, holidays, roll }?: BusinessDayOffsetOptions): Date;
25
+ export declare function getTimeZoneOffset(d: Date, timeZone?: string, options?: UtcOffsetOptions): number | string;
26
+ export declare function isBusinessDay(d: Date, options?: IsBusinessDayOptions): boolean | null;
@@ -1,3 +1,4 @@
1
+ /** @internalfile */
1
2
  import type { JSONFormat } from "../types";
2
3
  export interface NDJSONParseOptions {
3
4
  /**
@@ -65,6 +65,7 @@ export interface IntOptions {
65
65
  range?: IntRange;
66
66
  coerce?: IntCoerceType;
67
67
  }
68
+ export declare function isValidInt(v: unknown, { range }?: IntOptions): v is number;
68
69
  export declare function toValidInt(v: unknown, { range, coerce }?: IntOptions): number | null;
69
70
  export declare const BIGINT_RANGES: {
70
71
  readonly Int64: {
@@ -1,3 +1,4 @@
1
+ /** @internalfile */
1
2
  export declare const TAG_DATE = "[object Date]";
2
3
  export declare const TAG_REGEXP = "[object RegExp]";
3
4
  export declare const TAG_SET = "[object Set]";
@@ -53,3 +53,15 @@ export declare function toCanonicalString(val: any, { depth, maxDepth }?: {
53
53
  depth?: number;
54
54
  maxDepth?: number;
55
55
  }): string;
56
+ export interface ChangeCaseOptions {
57
+ format: "camel" | "kebab" | "pascal" | "snake";
58
+ }
59
+ /**
60
+ * Fully robust, Unicode-aware string tokenization engine.
61
+ * Guarded against prototype pollution, type errors, and NFD text formatting.
62
+ */
63
+ export declare function toWords(str: any): string[];
64
+ /**
65
+ * High-performance, predictable case converter
66
+ */
67
+ export declare function changeCase(str: any, options: ChangeCaseOptions): string;
package/package.json CHANGED
@@ -1,18 +1,28 @@
1
1
  {
2
2
  "name": "df-script",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "A zero-dependency, high-performance, expression-based DataFrame library for TypeScript/JavaScript.",
5
5
  "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
6
7
  "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "sideEffects": false,
7
16
  "files": [
8
17
  "dist",
9
18
  "LICENSE",
10
19
  "README.md"
11
20
  ],
12
21
  "scripts": {
13
- "build": "tsc --emitDeclarationOnly && esbuild src/index.ts --bundle --minify --outfile=dist/index.js --platform=node",
22
+ "build": "tsc --emitDeclarationOnly && esbuild src/index.ts --bundle --minify --outfile=dist/index.js --platform=node --mangle-props=^_ && esbuild src/index.ts --bundle --minify --outfile=dist/index.mjs --platform=neutral --format=esm --external:fs --mangle-props=^_",
14
23
  "test": "tsx _tests/run_all_project_tests.ts",
15
- "prepublishOnly": "npm run build"
24
+ "prepublishOnly": "npm run build",
25
+ "extract-docs": "node scripts/extract-docs.mjs"
16
26
  },
17
27
  "keywords": [
18
28
  "dataframe",
@@ -20,9 +30,13 @@
20
30
  "pandas",
21
31
  "data-analysis",
22
32
  "typescript",
33
+ "javascript",
23
34
  "columnar",
24
35
  "data-science",
25
- "zero-dependency"
36
+ "zero-dependency",
37
+ "data-manipulation",
38
+ "csv",
39
+ "expression-engine"
26
40
  ],
27
41
  "author": "Trent Morris",
28
42
  "license": "MIT",
@@ -1,39 +0,0 @@
1
- import { ExprBase } from "../ExprBase";
2
- import { SortListOptions, StepSliceListOptions } from "../../utils";
3
- import type { UniqueListStatsOptions, JoinListOptions, ExplodeOptions, IExpr } from "../../types";
4
- export declare class ListExprNamespace {
5
- expr: any;
6
- constructor(expr: any);
7
- _deriveList(fn: (arr: any[] | ArrayBufferView) => any): any;
8
- all(): any;
9
- any(): any;
10
- contains(item: any): any;
11
- contains_all(items: ArrayLike<any>): any;
12
- contains_any(items: ArrayLike<any>): any;
13
- count_matches(item: any): any;
14
- drop_nulls(): any;
15
- explode({ empty_as_null, keep_nulls }?: ExplodeOptions): any;
16
- first(null_on_oob?: boolean): any;
17
- gather(indices: number | ArrayLike<number>, null_on_oob?: boolean): any;
18
- gather_every(options?: StepSliceListOptions): any;
19
- get(index: number, null_on_oob?: boolean): any;
20
- join(separator?: string, options?: JoinListOptions): any;
21
- last(null_on_oob?: boolean): any;
22
- len(): any;
23
- lengths(): any;
24
- max(): any;
25
- mean(): any;
26
- median(): any;
27
- min(): any;
28
- mode(): any;
29
- n_unique(options?: UniqueListStatsOptions): any;
30
- reverse(): any;
31
- slice(offset: number, length?: number): any;
32
- sort(options?: SortListOptions): any;
33
- sum(): any;
34
- unique(options?: UniqueListStatsOptions): any;
35
- eval(expr: IExpr): any;
36
- }
37
- export declare class ListExpr extends ExprBase {
38
- get list(): ListExprNamespace;
39
- }
@@ -1,13 +0,0 @@
1
- import type { ValidScalarTypes } from "../types";
2
- /** Array Guards **/
3
- export type AnyTypedArray = ArrayBufferView & ArrayLike<number | bigint> & Iterable<number | bigint>;
4
- export declare function isTypedArray(v: unknown): v is AnyTypedArray;
5
- export declare function isArrayOrTypedArray(v: unknown): v is any[] | AnyTypedArray;
6
- export declare function isObj(v: unknown): v is Record<PropertyKey, unknown>;
7
- export declare function isPlainObj(v: unknown): v is Record<PropertyKey, unknown>;
8
- /** Class Guards **/
9
- export declare function isClass(v: unknown): v is new (...args: any[]) => any;
10
- /** Scalar & Conversion Guards **/
11
- export declare function isScalar<V>(v: V): v is Extract<V, Exclude<ValidScalarTypes, null | undefined>>;
12
- export declare function isValidBinary(v: unknown): v is string | any[] | AnyTypedArray;
13
- export declare function toValidBinary(v: unknown): Uint8Array | null;