df-script 1.9.0 → 2.0.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 (59) hide show
  1. package/README.md +148 -235
  2. package/dist/api.d.ts +41 -36
  3. package/dist/columnExpressions/ColumnExpr.d.ts +5 -8
  4. package/dist/columnExpressions/functions/all.d.ts +13 -13
  5. package/dist/columnExpressions/functions/coalesce.d.ts +2 -2
  6. package/dist/columnExpressions/functions/duration.d.ts +16 -21
  7. package/dist/columnExpressions/functions/element.d.ts +10 -10
  8. package/dist/columnExpressions/functions/exclude.d.ts +14 -14
  9. package/dist/columnExpressions/functions/implode.d.ts +7 -7
  10. package/dist/columnExpressions/functions/lit.d.ts +9 -9
  11. package/dist/columnExpressions/functions/seqRange.d.ts +69 -0
  12. package/dist/columnExpressions/functions/struct.d.ts +6 -6
  13. package/dist/columnExpressions/functions/when.d.ts +25 -28
  14. package/dist/columnExpressions/index.d.ts +3 -7
  15. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +550 -221
  16. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +701 -327
  17. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +508 -212
  18. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +398 -201
  19. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +59 -29
  20. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +23 -9
  21. package/dist/columnExpressions/mixins/StandardExpr.d.ts +3234 -0
  22. package/dist/columnExpressions/mixins/StringExpr.d.ts +1163 -524
  23. package/dist/columnExpressions/mixins/StructExpr.d.ts +67 -25
  24. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +518 -212
  25. package/dist/columnExpressions/mixins/WindowExpr.d.ts +270 -102
  26. package/dist/columnExpressions/typeInference.d.ts +3 -3
  27. package/dist/columnExpressions/types.d.ts +5 -0
  28. package/dist/columnExpressions/utils.d.ts +7 -0
  29. package/dist/constants.d.ts +11 -2
  30. package/dist/dataframe/dataframe.d.ts +755 -592
  31. package/dist/dataframe/grouped/grouped.d.ts +24 -6
  32. package/dist/dataframe/grouped.d.ts +70 -0
  33. package/dist/dataframe/index.d.ts +1 -1
  34. package/dist/dataframe/lazy.d.ts +37 -0
  35. package/dist/dataframe/types.d.ts +46 -22
  36. package/dist/dataframe/utils.d.ts +10 -4
  37. package/dist/datatypes/index.d.ts +11 -4
  38. package/dist/expressions.js +1 -0
  39. package/dist/expressions.mjs +1 -0
  40. package/dist/functions/concat.d.ts +68 -16
  41. package/dist/functions/index.d.ts +2 -2
  42. package/dist/functions/readCsv.d.ts +35 -0
  43. package/dist/functions/readJson.d.ts +33 -0
  44. package/dist/index.js +5 -6
  45. package/dist/index.mjs +5 -6
  46. package/dist/types.d.ts +42 -9
  47. package/dist/utils/array.d.ts +17 -14
  48. package/dist/utils/csv.d.ts +4 -1
  49. package/dist/utils/date.d.ts +3 -19
  50. package/dist/utils/duration.d.ts +7 -5
  51. package/dist/utils/json.d.ts +5 -3
  52. package/dist/utils/object.d.ts +0 -18
  53. package/dist/utils/string.d.ts +5 -0
  54. package/dist/utils.js +4 -0
  55. package/dist/utils.mjs +4 -0
  56. package/package.json +29 -8
  57. package/dist/assets/index-DBhGK6Tp.css +0 -1
  58. package/dist/assets/index-DEJEV_tU.js +0 -195
  59. package/dist/index.html +0 -17
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
- "use strict";var nr=Object.defineProperty;var Ks=Object.getOwnPropertyDescriptor;var qs=Object.getOwnPropertyNames;var zs=Object.prototype.hasOwnProperty;var R=(n,e)=>()=>(n&&(e=n(n=0)),e);var rr=(n,e)=>{for(var t in e)nr(n,t,{get:e[t],enumerable:!0})},Gs=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of qs(e))!zs.call(n,o)&&o!==t&&nr(n,o,{get:()=>e[o],enumerable:!(r=Ks(e,o))||r.enumerable});return n};var or=n=>Gs(nr({},"__esModule",{value:!0}),n);var oe,ir,sr,We,ar,lr,ur,Te=R(()=>{"use strict";oe="*",ir="*literal*",sr="*coalesce*",We="*element*",ar="*struct*",lr="*duration*",ur="*when*"});var To=R(()=>{"use strict"});function F(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function Pe(n){if(!F(n))return!1;try{if(!Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)&&Object.prototype.toString.call(n)!==oa)return!1;let e=Object.getPrototypeOf(n);if(e===null)return!0;if(Object.getPrototypeOf(e)!==null||!Object.prototype.hasOwnProperty.call(e,"isPrototypeOf"))return!1;let t=Object.getOwnPropertyDescriptor(e,"toString");if(!t||typeof t.value!="function")return!1;let r=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof r!="function"?!1:Function.prototype.toString.call(r)===Ta}catch{return!1}}function vo(n){if(typeof n!="function")return!1;try{let e=Function.prototype.toString.call(n),t=e.replace(/^(?:\s+|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*)+/,"");if(/^(?:@[\w$.]+(?:\([^)]*\))?\s+)*class\b/.test(t))return!0;let r=Object.getOwnPropertyDescriptor(n,"prototype");if(r&&!r.writable&&e.includes("[native code]")){let o=No.length;for(let i=0;i<o;i++)try{return Reflect.construct(n,No[i],Da),!0}catch{}}}catch{return!1}return!1}function De(n,e,t,r){if(!F(n))return!1;if(t)try{let o=t.call(n);return r!==void 0?o===r:!0}catch{return!1}try{return Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)?!1:Object.prototype.toString.call(n)===e}catch{return!1}}function P(n){if(!F(n))return!1;if(Ro)try{return!Number.isNaN(Ro.call(n))}catch{return!1}try{return Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)?!1:Object.prototype.toString.call(n)===Js&&!Number.isNaN(n.getTime())}catch{return!1}}function ge(n){return De(n,Ws,ma)}function Qt(n){return De(n,Xs,pa)}function en(n){return De(n,Hs,ha)}function Fo(n){if(!F(n))return!1;if(ko)try{return ko.call(n,"key"),!0}catch{return!1}return De(n,Zs,void 0)}function jo(n){if(!F(n))return!1;try{if(n instanceof Error)return!0;let e=n;for(;e!==null;){if(!Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)&&Object.prototype.toString.call(e)===Ys)return!0;e=Object.getPrototypeOf(e)}}catch{return!1}return!1}function fr(n){if(!F(n))return!1;try{let e=ArrayBuffer.isView(n)?n.buffer:n;return nn(e)||!tn(e)?!1:"detached"in e&&e.detached!==void 0?e.detached===!0:(ga?.call(e,0,0),!1)}catch{return!0}}function tn(n){return De(n,ta,da)}function nn(n){return De(n,na,ya)}function Bo(n){return De(n,ra,_a)}function mr(n){return De(n,Qs,Be,"Uint8Array")}function Po(n){return De(n,ea,Be,"Uint8ClampedArray")}function ie(n){if(!F(n))return n;let e=Mo.length;for(let t=0;t<e;t++){let r=Mo[t];if(r)try{return r.call(n)}catch{}}return n}var Js,Ws,Xs,Hs,Ys,Zs,Qs,ea,ta,na,ra,oa,ia,Do,Oo,Eo,sa,aa,la,ua,ca,fa,ma,pa,ha,cr,Io,Co,Be,da,ga,ya,_a,Ro,ko,xa,ba,wa,Aa,Sa,Ta,Uo,Da,Oa,No,Mo,ye=R(()=>{"use strict";Js="[object Date]",Ws="[object RegExp]",Xs="[object Set]",Hs="[object Map]",Ys="[object Error]",Zs="[object URLSearchParams]",Qs="[object Uint8Array]",ea="[object Uint8ClampedArray]",ta="[object ArrayBuffer]",na="[object SharedArrayBuffer]",ra="[object DataView]",oa="[object Object]",ia=typeof Date=="function"?Date.prototype:void 0,Do=typeof RegExp=="function"?RegExp.prototype:void 0,Oo=typeof Set=="function"?Set.prototype:void 0,Eo=typeof Map=="function"?Map.prototype:void 0,sa=typeof URLSearchParams=="function"?URLSearchParams.prototype:void 0,aa=typeof String=="function"?String.prototype:void 0,la=typeof Number=="function"?Number.prototype:void 0,ua=typeof Boolean=="function"?Boolean.prototype:void 0,ca=typeof BigInt=="function"?BigInt.prototype:void 0,fa=typeof Symbol=="function"?Symbol.prototype:void 0,ma=Do?Object.getOwnPropertyDescriptor(Do,"source")?.get:void 0,pa=Oo?Object.getOwnPropertyDescriptor(Oo,"size")?.get:void 0,ha=Eo?Object.getOwnPropertyDescriptor(Eo,"size")?.get:void 0,cr=typeof ArrayBuffer=="function"?ArrayBuffer.prototype:void 0,Io=typeof SharedArrayBuffer=="function"?SharedArrayBuffer.prototype:void 0,Co=typeof DataView=="function"?DataView.prototype:void 0,Be=typeof Uint8Array=="function"?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get:void 0,da=cr?Object.getOwnPropertyDescriptor(cr,"byteLength")?.get:void 0,ga=cr?.slice,ya=Io?Object.getOwnPropertyDescriptor(Io,"byteLength")?.get:void 0,_a=Co?Object.getOwnPropertyDescriptor(Co,"byteLength")?.get:void 0,Ro=ia?.valueOf,ko=sa?.has,xa=aa?.valueOf,ba=la?.valueOf,wa=ua?.valueOf,Aa=ca?.valueOf,Sa=fa?.valueOf,Ta=Function.prototype.toString.call(Object);Uo=function(){},Da=new Proxy(Uo,{construct(){return this}}),Oa=typeof ArrayBuffer=="function"?new ArrayBuffer(0):void 0,No=[[],[Uo],[Oa],[{}]];Mo=[ba,xa,wa,Aa,Sa]});var Oe,Lo,Le,Dt,_e,lt,Vo,$o,Ko,pr,hr,dr,gr,ut,Ot,Et,Ea,qo,zo,Go,Jo,Wo,Xo,Ho,Yo,Zo,Qo,ei,ti,ni,ri,oi,ii,si,ai,li,ui,yr,ci,xe=R(()=>{"use strict";Oe=new TextEncoder,Lo=6048e5,Le=864e5,Dt=36e5,_e=6e4,lt=1e3,Vo=1,$o=.001,Ko=1e-6,pr=1e3,hr=1e6,dr=1000n,gr=1000000n,ut="\0",Ot="",Et=-1,Ea=4294967295,qo=-9223372036854775808n,zo=9223372036854775807n,Go=0n,Jo=18446744073709551615n,Wo=-2147483648,Xo=2147483647,Ho=0,Yo=Ea,Zo=-32768,Qo=32767,ei=0,ti=65535,ni=-128,ri=127,oi=0,ii=255,si=31,ai=127,li=55296,ui=57343,yr=Object.freeze({9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r"}),ci=Object.freeze({b:"\b",0:"\0",...Object.fromEntries(Object.entries(yr).map(([n,e])=>[e.slice(1),String.fromCharCode(Number(n))]))})});function v(n,e){return typeof n!="number"?!1:Number.isNaN(n)?e?.allowNaN??e?.allowNonFiniteNumbers??!1:Number.isFinite(n)?!0:e?.allowNonFiniteNumbers??!1}function fi(n){for(let e=1;e<n.length;e++)if(n[e].length!==3)return!1;return!0}function gi(n,e){if(Ia.test(n))return null;let t=n.trim();if(t==="")return null;t.startsWith("(")&&t.endsWith(")")&&(t="-"+t.slice(1,-1).trim());let r=t[t.length-1];(r==="-"||r==="+")&&t.length>1&&(t=r+t.slice(0,-1).trim()),e||(t=t.replace(Ca,""));let o=t.includes("."),i=t.includes(",");if(o&&i){let s=t.lastIndexOf("."),a=t.lastIndexOf(","),l=a>s,u=l?".":",",c=l?a:s,f=t.slice(0,c).split(u);return f.length>1&&!fi(f)||f[0].replace(mi,"").length>3?null:l?t.replace(pi,"").replace(rn,"."):t.replace(rn,"")}if(i||o){let s=i?",":".",a=t.split(s);if(a.length>2||s===","&&a.length===2&&a[1].length===3){let l=a[0].replace(mi,"").length;if(l===0){if(s===","||a.length>2)return null}else return l>3?null:fi(a)?t.replace(i?rn:pi,""):null}if(i)return t.replace(rn,".")}return t}function j(n,{allowNonFiniteNumbers:e=!1,strictNumericString:t=!1,floatScientific:r=!0}={}){if(n==null||typeof n=="symbol")return null;switch(n=ie(n),typeof n){case"number":return v(n,{allowNonFiniteNumbers:e})?n:null;case"boolean":return n?1:0;case"bigint":{let o=Number(n);return v(o,{allowNonFiniteNumbers:e})?o:null}case"object":{if(P(n)){let o=n.getTime();return v(o,{allowNonFiniteNumbers:e})?o:null}return null}case"string":{let o=gi(n,t);if(o===null)return null;if(e){let a=o.toLowerCase();if(a==="nan"||a==="-nan"||a==="+nan")return NaN;if(a==="infinity"||a==="+infinity")return 1/0;if(a==="-infinity")return-1/0}if(di.test(o)&&!r||!hi.test(o))return null;let s=Number(o);return v(s,{allowNonFiniteNumbers:e})?s:null}default:return null}}function yi({locale:n="en-US",accountingNegatives:e=!1,fallback:t="NaN",formatNonFinite:r=!1,...o}={}){o.useGrouping===void 0&&(o.useGrouping=!1),o.maximumFractionDigits===void 0&&o.maximumSignificantDigits===void 0&&(o.maximumFractionDigits=20),e&&(o.currencySign="accounting",o.style===void 0&&(o.style="decimal"));let i=new Intl.NumberFormat(n,o);return s=>{if(typeof s=="bigint")return e&&s<0n?`(${i.format(-s)})`:i.format(s);let a=j(s,{allowNonFiniteNumbers:!0});return a===null||Number.isNaN(a)?t:Number.isFinite(a)?e&&a<0?`(${i.format(Math.abs(a))})`:i.format(a):r?t:e&&a===-1/0?`(${i.format(1/0)})`:String(a)}}function _r(n,{floatPrecision:e="Float64",allowNonFiniteNumbers:t=!0,floatScientific:r=!0,strictNumericString:o=!1}={}){let i=j(n,{allowNonFiniteNumbers:t,floatScientific:r,strictNumericString:o});return i===null||(e==="Float32"&&(i=Math.fround(i)),!v(i,{allowNonFiniteNumbers:t}))?null:i}function Ee(n,{range:e="Int32"}={}){if(!v(n)||!Number.isInteger(n))return!1;let t=typeof e=="string"?_i[e]:e;return n>=t.min&&n<=t.max}function se(n,{range:e="Int32",coerce:t="truncate"}={}){let r=j(n);if(r===null)return null;switch(t){case"round":r=Math.round(r);break;case"floor":r=Math.floor(r);break;case"ceil":r=Math.ceil(r);break;case"truncate":r=Math.trunc(r);break}let o=typeof e=="string"?_i[e]:e;return Ce(r,{min:o.min,max:o.max})}function on(n,{range:e="Int64"}={}){let t=ie(n);if(typeof t!="bigint")return!1;let r=typeof e=="string"?xi[e]:e;return t>=r.min&&t<=r.max}function Ie(n,{range:e="Int64",truncate:t=!1}={}){if(n==null||typeof n=="symbol")return null;try{n=ie(n)}catch{return null}let r=null;if(typeof n=="bigint")r=n;else if(typeof n=="string"){let i=gi(n,!1);if(i===null||!hi.test(i))return null;if(di.test(i)){let s=i.search(/[eE]/),a=i.slice(0,s),l=i.slice(s+1),u=parseInt(l,10);if(Number.isNaN(u)||u>1e5||u<-1e5)return null;let c=a.startsWith("-");(c||a.startsWith("+"))&&(a=a.slice(1));let f=a.indexOf("."),m=a,h=0;f!==-1&&(h=a.length-f-1,m=a.slice(0,f)+a.slice(f+1)),m=m.replace(/^0+/,"")||"0";try{let p=BigInt(m);c&&(p=-p);let d=u-h;if(d>=0)r=p*10n**BigInt(d);else{let g=10n**BigInt(-d),y=p%g;if(!t&&y!==0n)return null;r=p/g}}catch{return null}}else{let s=i.indexOf(".");if(s!==-1){if(!t&&/[^0]/.test(i.slice(s+1)))return null;i=i.slice(0,s)}try{r=BigInt(i)}catch{return null}}}else{let i=j(n);if(i===null||!t&&!Number.isInteger(i))return null;r=BigInt(Math.trunc(i))}let o=typeof e=="string"?xi[e]:e;return r<o.min||r>o.max?null:r}function Ra(n,e){let t=n-e;if(t<0||e<0)return null;if(t>15)return Number.MAX_SAFE_INTEGER;let r=Math.min(e,16),o=Math.pow(10,t)-Math.pow(10,-r);return o>0?o:null}function xr(n,e){let t=n.toString();if(t.includes("e")){let r=Math.pow(10,e);return Math.round(n*r)/r}return+(Math.round(+(t+"e"+e))+"e"+-e)}function sn(n,{precision:e,scale:t}={}){let r=j(n);if(r===null)return null;let o=r;if(t!==void 0&&(o=xr(o,t)),e!==void 0){let s=Ra(e,t??0);s!==null&&(o=Ce(o,{min:-s,max:s}))}return o}function Ce(n,e){if(!e)return n;let{min:t=null,max:r=null,safe:o=!0}=e;if(t!==null&&r!==null&&t>r)return t;let i=n;if(o&&typeof i=="number"){if(Number.isNaN(i))return t!==null?t:r!==null?r:n;if(i===1/0)return r!==null?r:n;if(i===-1/0)return t!==null?t:n}return t!==null&&i<t?t:r!==null&&i>r?r:i}function bi(n){let e=n|0;return function(){let t=e=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}var hi,Ia,Ca,di,mi,pi,rn,_i,xi,Ve=R(()=>{"use strict";ye();xe();hi=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Ia=/0[xobXOB]/,Ca=/[\s_]/g,di=/[eE]/;mi=/^[+-]/,pi=/\./g,rn=/,/g;_i={Int8:{min:ni,max:ri},Int16:{min:Zo,max:Qo},Int32:{min:Wo,max:Xo},UInt8:{min:oi,max:ii},UInt16:{min:ei,max:ti},UInt32:{min:Ho,max:Yo}};xi={Int64:{min:qo,max:zo},UInt64:{min:Go,max:Jo}}});function K(n){if(!ArrayBuffer.isView(n))return!1;if(Be)return Be.call(n)!==void 0;let e=Object.prototype.toString.call(n);return e!=="[object DataView]"&&e.endsWith("Array]")}function k(n){return Array.isArray(n)||K(n)}function be(n){return n==null?[]:Array.isArray(n)?[...n]:K(n)?Array.from(n):[n]}function an(n,e,t){let r=n.length,o=e<-r||e>=r;if(o&&!t)throw new ne(`Index ${e} is out of bounds for array of length ${r}`);return o?null:n.at(e)??null}function Si(n){if(typeof n=="function"){let e=vo(n);return{check:e?t=>t instanceof n:t=>!!n(t),coerce:t=>{if(e)return t instanceof n?t:null;let r=n(t);return typeof r=="boolean"?r?t:null:r}}}switch(n){case"string":return{check:e=>typeof e=="string",coerce:e=>String(e)};case"number":return{check:v,coerce:e=>j(e)??NaN};case"boolean":return{check:e=>typeof e=="boolean",coerce:Boolean};case"bigint":return{check:on,coerce:e=>Ie(e)};case"date":return{check:P,coerce:e=>J(e)};case"object":return{check:F,coerce:e=>F(e)?e:null};case"plainObject":return{check:Pe,coerce:e=>Pe(e)?e:null};case"null":return{check:e=>e===null,coerce:()=>null};case"undefined":return{check:e=>e===void 0,coerce:()=>{}};case"nullish":return{check:e=>e==null,coerce:()=>null};default:return{check:()=>!0,coerce:e=>e}}}function ee(n,e,{mode:t="every",allowNulls:r=!1,allowEmpty:o=!0}={}){if(!k(n))return!1;let i=n,s=i.length;if(s===0)return o?t==="every":!1;let{check:a}=Si(e);if(t==="every"){for(let l=0;l<s;l++){let u=i[l];if(!(r&&u==null)&&!a(u))return!1}return!0}for(let l=0;l<s;l++){let u=i[l];if(r&&u==null||a(u))return!0}return!1}function $e(n,e="any",{mode:t="every",allowNulls:r=!1,allowEmpty:o=!0}={}){let i=be(n),s=i.length;if(s===0){if(!o)throw new ne("Expected non-empty array");return[]}let{check:a,coerce:l}=Si(e),u=new Array(s),c=0;for(let f=0;f<s;f++){let m=i[f];if(r&&m==null){u[c++]=m;continue}let h=l(m);if(a(h))u[c++]=h;else if(t==="every")throw new ne(`Failed to convert array item at index ${f} ('${m}') to target type '${e}'`)}if(t==="some"){if(c===0)throw new ne(`No items in array could be converted to target type '${e}'`);c<s&&(u.length=c)}return u}function It(n,{descending:e=!1,nullsLast:t=!0}={}){if(!k(n))return[];let r=n,o=r.length;if(o===0)return[];if(K(n)){let f=r.slice().sort();return e&&f.reverse(),Array.from(f)}let i=[],s=[],a=!0,l=!0,u=!0;for(let f=0;f<o;f++){let m=r[f];if(m==null)s.push(m);else if(i.push(m),u){let h=typeof m;h!=="number"&&(a=!1),h!=="string"&&(l=!1),!a&&!l&&(u=!1)}}return i.length>1&&(a?i.sort(e?(f,m)=>m-f:(f,m)=>f-m):l?i.sort(e?(f,m)=>m.localeCompare(f):(f,m)=>f.localeCompare(m)):i.sort((f,m)=>{let h=typeof f,p=typeof m;if(h!==p){let d=h<p?-1:1;return e?-d:d}return f<m?e?1:-1:f>m?e?-1:1:0})),s.length===0?i:t?i.concat(s):s.concat(i)}function B(n){if(!k(n))return wi;let e=n.length;if(e===0)return wi;let t=null,r=null,o=null,i=null,s=0,a=0,l=0,u=0,c=0,f=1,m=0,h=0;for(let g=0;g<e;g++){let y=n[g];if(y==null){a++;continue}if(typeof y=="number"&&Number.isNaN(y)){l++,a++;continue}(t==null||y<t)&&(t=y,o=g),(r==null||y>r)&&(r=y,i=g);let _=j(y);if(_!==null){let S=u+_;Math.abs(u)>=Math.abs(_)?c+=u-S+_:c+=_-S+u,u=S,f*=_,s++;let b=_-m;m+=b/s;let x=_-m;h+=b*x}}let p=s>1?h/(s-1):0,d=l>0;return{sum:s>0?u+c:null,product:s>0?f:null,count:s,min:t,max:r,nanMin:d?NaN:t,nanMax:d?NaN:r,minIdx:o,maxIdx:i,mean:s>0?(u+c)/s:null,variance:p,std:Math.sqrt(p),nullCount:a,nanCount:l,len:e,hasNulls:a>0,isNumeric:s>0&&s===e-a}}function Ke(n,{strict:e=!1,keySelector:t}={}){let r=Array.from(n),o=new Map;if(e){let s=t??G,a=new Map,l=r.length;for(let c=0;c<l;c++){let f=r[c],m=s(f),h=a.get(m);h===void 0?a.set(m,{val:f,count:1}):h.count++}let u=[];for(let c of a.values())u.push(c.val);for(let c=0;c<l;c++){let f=r[c],m=s(f),h=a.get(m);o.set(f,h.count)}return{values:u,count:u.length,frequencies:o}}let i=r.length;for(let s=0;s<i;s++){let a=r[s];o.set(a,(o.get(a)??0)+1)}return{values:Array.from(o.keys()),count:o.size,frequencies:o}}function ln(n,{step:e=1,offsetStart:t=0,offsetEnd:r,maxItemsGathered:o,null_on_oob:i=!0}={}){if(n==null)return null;if(o!==void 0&&o<=0)return[];if(e===0)throw new M("Step size step cannot be zero");let s=n.length;if(s===0?t!==0:t>=s||t<-s){if(!i)throw new ne(`Start offset ${t} is out of bounds for array of length ${s}`);return null}let l=t<0?s+t:t,u=r!==void 0?r<0?s+r:r:e>0?s:-1,c=[];if(e>0)for(let f=l;f<u&&f<s&&!(f>=0&&(c.push(n[f]),o!==void 0&&c.length>=o));f+=e);else for(let f=l;f>u&&f>=0&&!(f<s&&(c.push(n[f]),o!==void 0&&c.length>=o));f+=e);return c}function un(n,e=",",{ignoreNulls:t=!1,nullValue:r="",prefix:o="",suffix:i="",limit:s,truncationMarker:a="...",valueFormatter:l}={}){let u=n.length,c=[],f=s!==void 0?Math.max(0,s):u,m=!1;for(let h=0;h<u;h++){if(c.length>=f){m=!0;break}let p=n[h];p!=null?c.push(l?l(p,h):String(p)):t||c.push(r)}return o+c.join(e)+(m?a:"")+i}function Xe(n,e,t={}){let r=n.length,{mode:o="cumulative",step:i=1,coerce:s=d=>d,condition:a,reverse:l=!1,startIndex:u=l?r-1:0,endIndex:c=l?-1:r}=t,f=l?-1:1,m=u,h=c,p=(d,g)=>{(!a||a(n[d],d,n))&&(n[d]=s(g))};if(o==="constant"){let d=s(e);for(let g=m;l?g>h:g<h;g+=f)p(g,d)}else if(o==="independent")if(typeof i=="function"){let d=0;for(let g=m;l?g>h:g<h;g+=f)p(g,i({index:d,initialValue:e,originalValue:n[g],absoluteIndex:g,targetArray:n})),d++}else for(let d=m;l?d>h:d<h;d+=f)p(d,e+d*i);else{let d=e,g=!0,y=0;for(let _=m;l?_>h:_<h;_+=f)g?(p(_,d),g=!1):(typeof i=="function"?d=i({prev:d,index:y,originalValue:n[_],absoluteIndex:_,targetArray:n}):d=d+i,p(_,d)),y++}}function Ti(n){let e=n.length,t=0,r=new Float64Array(e);for(let i=0;i<e;i++){let s=n[i],a=j(s,{allowNonFiniteNumbers:!0});a!==null&&v(a,{allowNonFiniteNumbers:!0,allowNaN:!1})&&(r[t++]=a)}if(t===0)return null;let o=r.subarray(0,t);return o.sort(),o}function ct(n){let e=Ti(n);if(!e)return null;let t=e.length,r=Math.floor(t/2);return t%2!==0?e[r]:(e[r-1]+e[r])/2}function cn(n,e){if(e<0||e>1)return null;let t=Ti(n);if(!t)return null;let r=t.length,o=e*(r-1),i=Math.floor(o),s=Math.ceil(o);return i===s?t[i]:t[i]+(o-i)*(t[s]-t[i])}function fn(n){if(!k(n)||n.length===0)return null;let e=new Map,t=n.length,r=0,o=[];for(let i=0;i<t;i++){let s=n[i];if(s==null||typeof s=="number"&&!v(s,{allowNonFiniteNumbers:!0,allowNaN:!1}))continue;let a=(e.get(s)??0)+1;e.set(s,a),a>r?(r=a,o=[s]):a===r&&o.push(s)}return o.length===0?null:It(o)}function Di(n,e){let t=n.length;if(t===0)return[];let r=Math.trunc(e);if(isNaN(r)||r===0)return Array.isArray(n)?n.slice():Array.from(n);let o=Math.abs(r);if(o>=t)return new Array(t).fill(null);let i=new Array(t);if(r>0){i.fill(null,0,r);for(let s=r;s<t;s++){let a=n[s-r];i[s]=a??null}}else{let s=t-o;for(let a=0;a<s;a++){let l=n[a+o];i[a]=l??null}i.fill(null,s,t)}return i}function br(n){let e=n.length,t=0,r=0,o=0,i=0,s=0,a=0;for(let m=0;m<e;m++){let h=n[m];if(!h)continue;let p=j(h[0]),d=j(h[1]);if(p===null||d===null)continue;t++;let g=p-r;r+=g/t;let y=p-r,_=d-o;o+=_/t;let S=d-o;a+=g*S,i+=g*y,s+=_*S}if(t<2)return{covariance:null,correlation:null};let l=a/(t-1);if(i===0||s===0)return{covariance:l,correlation:null};let u=Math.sqrt(i*s);if(u===0||Number.isNaN(u))return{covariance:l,correlation:null};let c=a/u,f=Math.max(-1,Math.min(1,c));return{covariance:l,correlation:f}}function Ai(n){let e=n.length,t=new Int32Array(e);for(let i=0;i<e;i++)t[i]=i;t.sort((i,s)=>n[i]-n[s]);let r=new Float64Array(e),o=0;for(;o<e;){let i=o+1;for(;i<e&&n[t[i]]===n[t[o]];)i++;let s=(o+1+i)/2;for(let a=o;a<i;a++)r[t[a]]=s;o=i}return r}function ka(n,e,t){if(t<2)return null;let r=0,o=0,i=0,s=0,a=0;for(let c=0;c<t;c++){let f=n[c],m=e[c],h=f-r;r+=h/(c+1);let p=f-r,d=m-o;o+=d/(c+1);let g=m-o;a+=h*g,i+=h*p,s+=d*g}if(i===0||s===0)return null;let l=Math.sqrt(i*s);if(l===0||Number.isNaN(l))return null;let u=a/l;return Math.max(-1,Math.min(1,u))}function Oi(n){let e=n.length,t=new Float64Array(e),r=new Float64Array(e),o=0;for(let a=0;a<e;a++){let l=n[a];if(l){let u=j(l[0]),c=j(l[1]);u!==null&&c!==null&&(t[o]=u,r[o]=c,o++)}}if(o<2)return null;let i=Ai(t.subarray(0,o)),s=Ai(r.subarray(0,o));return ka(i,s,o)}function Ei(n){let e=n.length,t=0,r=0;for(let o=0;o<e;o++){let i=n[o];if(!i)continue;let s=j(i[0]),a=j(i[1]);s===null||a===null||(t+=s*a,r++)}return r>0?t:null}function Ii(n){let e=n.length,t=0,r=0,o=0;for(let i=0;i<e;i++){let s=n[i];if(!s)continue;let a=j(s[0]),l=j(s[1]);a===null||l===null||(t+=a*l,r+=l,o++)}return o===0||Math.abs(r)<1e-12?null:t/r}function Ci(n,e){let t=Math.max(0,Math.floor(n||0)),r=Math.max(0,Math.floor(e||0)),o=t*r;if(!Ee(o,{range:"UInt32"}))throw new M(`Cartesian product size (${o} rows) exceeds maximum JavaScript array capacity.`);let i=new Array(o),s=new Array(o),a=0;for(let l=0;l<t;l++)for(let u=0;u<r;u++)i[a]=l,s[a]=u,a++;return{leftIndices:i,rightIndices:s}}function mn(n,e,t={}){let r=t.side==="right",o=t.getValue,i=0,s=n.length;for(;i<s;){let a=i+s>>>1,l=o?o(a,n[a]):n[a];(r?l<=e:l<e)?i=a+1:s=a}return i}function Ri(n){if(!k(n))return null;let{mean:e,count:t}=B(n);if(t<2||e===null)return null;let r=0,o=0,i=0,s=n.length;for(let a=0;a<s;a++){let l=j(n[a]);if(l===null)continue;let u=l-e,c=u*u;r+=c,o+=c*u,i+=c*c}return r<=0?null:{count:t,mean:e,m2Sum:r,m3Sum:o,m4Sum:i}}function ki(n,e={}){let t=Ri(n);if(!t)return null;let{count:r,m2Sum:o,m3Sum:i}=t,s=o/r,l=i/r/Math.pow(s,1.5);if(e?.bias??!0)return v(l)?l:null;if(r<3)return null;let c=Math.sqrt(r*(r-1))/(r-2)*l;return v(c)?c:null}function Ni(n,e={}){let t=Ri(n);if(!t)return null;let{count:r,m2Sum:o,m4Sum:i}=t,s=o/r,l=i/r/(s*s),u=l-3,c=e?.fisher??!0;if(e?.bias??!0){let p=c?u:l;return v(p)?p:null}if(r<4)return null;let m=(r-1)/((r-2)*(r-3))*((r+1)*u+6),h=c?m:m+3;return v(h)?h:null}function Mi(n,e={}){if(!n||n.length===0)return null;let{base:t=Math.E,normalize:r=!0}=e;if(t<=0||t===1)return null;let o=n.length,i=Math.log(t);if(r){let s=new Map,a=0;for(let u=0;u<o;u++){let c=n[u];if(c==null||Number.isNaN(c))continue;let f=G(c);s.set(f,(s.get(f)||0)+1),a++}if(a===0)return null;let l=0;for(let u of s.values()){let c=u/a;c>0&&(l-=c*(Math.log(c)/i))}return v(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}else{let s=[],a=0;for(let c=0;c<o;c++){let f=n[c];if(f==null||Number.isNaN(f))continue;let m=Number(f);if(!v(m)||m<0)return null;m>0&&(s.push(m),a+=m)}if(s.length===0||a<=0)return null;let l=0,u=s.length;for(let c=0;c<u;c++){let f=s[c]/a;f>0&&(l-=f*(Math.log(f)/i))}return v(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}}function pn(n,e){if(!n||n.length===0)return null;let t=null,r=n.length;for(let o=0;o<r;o++){let i=Ie(n[o],{range:"Int64"});i!==null&&(t=t===null?i:e(t,i))}return t===null?null:t>=Number.MIN_SAFE_INTEGER&&t<=Number.MAX_SAFE_INTEGER?Number(t):t}function wr(n,e){if(!n||n.length===0)return null;let t=n.length,r=new Array(t),o=new Array(t);for(let s=0;s<t;s++){let a=n[s];r[s]=a?.[0],o[s]=a?.[1]}let i=B(o)[e];return i!==null?r[i]:null}var wi,hn=R(()=>{"use strict";ye();Ve();dn();Ct();X();wi={sum:null,product:null,count:0,min:null,max:null,nanMin:null,nanMax:null,minIdx:null,maxIdx:null,mean:null,variance:0,std:0,nullCount:0,nanCount:0,len:0,hasNulls:!1,isNumeric:!1}});function Rt(n,e={}){let{format:t="json",allowPrimitives:r=!1,trimBeforeParse:o=!1,reviver:i,ndjson:{skipInvalidLines:s=!1,maxLines:a,skipLines:l}={},guard:u,onError:c}=e,f="fallback"in e,m=f?e.fallback:Na;if(typeof n!="string")return f?m:n;let h=o?n.trim():n;if(h==="")return f?m:n;let p;try{if(t==="ndjson"){let d=[],g=0,y=0,_=0,S=/\r\n|\n|\r/g,b;for(;;){b=S.exec(h);let x=b?h.substring(_,b.index):h.substring(_);b&&(_=S.lastIndex);let A=x.trim();if(A!==""&&(g++,l===void 0||g>l))if(!r&&!Ma(A)){if(!s)throw new M("NDJSON line is not wrapped and primitives are disallowed")}else{if(a!==void 0&&y>=a)break;try{d.push(JSON.parse(A,i)),y++}catch(w){if(!s)throw w}}if(!b)break}if(d.length===0)throw new Re("No valid NDJSON lines processed");p=d}else{if(!r&&!Ua(h))throw new M("JSON string is not wrapped and primitives are disallowed");p=JSON.parse(h,i)}if(u&&!u(p))throw new M("Parsed value failed guard validation")}catch(d){if(c)try{c(d)}catch{}return f?m:n}return p}function He(n={}){let e=n.bigintStrategy??"string",t=n.handleCircular?new WeakSet:null,o=Array.isArray(n.replacer)?n.replacer.map(String):null,i=s=>e==="number"&&s<=BigInt(Number.MAX_SAFE_INTEGER)&&s>=BigInt(Number.MIN_SAFE_INTEGER)?Number(s):s.toString();return function(a,l){let u=l;if(typeof n.replacer=="function")u=n.replacer.call(this,a,l);else if(o&&a!==""&&!Array.isArray(this)&&!o.includes(a))return;if(u===void 0)return;let c=u===l&&this!=null?this[a]:u;if(typeof n.onCustom=="function"){let f=n.onCustom.call(this,a,c);if(f!==c||f===void 0&&c!==void 0)return f}if(c!==null&&typeof c!="object"&&typeof c!="bigint")return u;if(t&&c!==null&&typeof c=="object"){if(a===""&&(t=new WeakSet),t.has(c))return n.onCircular?n.onCircular.call(this,a,c):"[Circular]";t.add(c)}return typeof c=="bigint"?n.voidBigIntReplacement?u:n.onBigInt?n.onBigInt(c):i(c):K(c)?n.voidTypedArrayReplacement?u:n.onTypedArray?n.onTypedArray(c):Array.from(c):Qt(c)?n.voidSetReplacement?u:n.onSet?n.onSet(c):Array.from(c):en(c)?n.voidMapReplacement?u:n.onMap?n.onMap(c):Array.from(c.entries()):ge(c)?n.voidRegExpReplacement?u:n.onRegExp?n.onRegExp(c):c.toString():P(c)?n.voidDateReplacement?u:n.onDate?n.onDate(c):n.formatDate?n.formatDate(c):c.toISOString():jo(c)?n.onError?n.onError(c):{name:c.name,message:c.message,stack:c.stack}:Fo(c)?n.onURLSearchParams?n.onURLSearchParams(c):c.toString():u}}function va(n){let e=n.trim().replace(/^\$/,"");if(!e)return[];let t=[],r=/\.\.\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*))\s*\]|\.\.([^\.\[]+)|\.([\w$-]+|\*)|\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*)|(-?\d*(?::-?\d*){0,2}))\s*\]/g,o,i=0;for(;(o=r.exec(e))!==null;){if(o.index!==i)return null;i=r.lastIndex;let[,s,a,l,u,c,f,m,h,p]=o,d=s??a,g=f??m;if(d!==void 0)t.push({type:"rec",key:vi(d)});else if(l!==void 0)t.push({type:"rec",key:Ar});else if(u!==void 0)t.push({type:"rec",key:u});else if(c!==void 0)t.push(c===Ar?{type:"wildcard"}:{type:"prop",key:c});else if(g!==void 0)t.push({type:"prop",key:vi(g)});else if(h!==void 0)t.push({type:"wildcard"});else if(p!==void 0)if(p.includes(":")){let[y,_,S]=p.split(":");t.push({type:"slice",start:se(y)??void 0,end:se(_)??void 0,step:se(S)??1})}else{let y=se(p);if(y===null)return null;t.push({type:"idx",idx:y})}}return i===e.length?t:null}function ji(n,e,t,r=new Set){if(n==null||!Fi(e.key)||typeof n!="object"||r.has(n))return;r.add(n);let o=Array.isArray(n);if(!o&&!F(n))return;e.key===Ar?Bi(n,{type:"wildcard"},t):!o&&Object.prototype.hasOwnProperty.call(n,e.key)&&t.push(n[e.key]);let i=o?n:Object.values(n);for(let s=0;s<i.length;s++)ji(i[s],e,t,r)}function Bi(n,e,t){if(n!=null)switch(e.type){case"prop":F(n)&&Fi(e.key)&&Object.prototype.hasOwnProperty.call(n,e.key)&&t.push(n[e.key]);break;case"idx":{if(!Array.isArray(n))break;let r=e.idx<0?n.length+e.idx:e.idx;r>=0&&r<n.length&&t.push(n[r]);break}case"slice":{if(!Array.isArray(n)||e.step===0)break;let r=e.step??1,o=e.start??(r>0?0:n.length-1),i=ln(n,{step:r,offsetStart:o,offsetEnd:e.end,null_on_oob:!0});if(i)for(let s=0;s<i.length;s++)t.push(i[s]);break}case"wildcard":{let r=Array.isArray(n)?n:F(n)?Object.values(n):null;if(r)for(let o=0;o<r.length;o++)t.push(r[o]);break}case"rec":ji(n,e,t);break}}function Pi(n,e){if(n==null||gn(e))return null;let t=n;if(typeof n=="string"){let s=n.trim();if(s==="")return null;let a=Rt(s,{allowPrimitives:!0,fallback:Ui});if(a===Ui)throw new M(`Invalid JSON string encountered in json_path_match: "${n}"`);t=a}let r=va(e);if(r===null)return null;let o=[t];for(let s=0;s<r.length;s++){if(o.length===0)return null;let a=[];for(let l=0;l<o.length;l++)Bi(o[l],r[s],a);o=a}if(o.length===0||o[0]==null)return null;let i=o[0];if(typeof i=="object")try{return JSON.stringify(i)}catch{return null}return String(i)}var Na,Ui,Ma,Ua,Ar,vi,Fi,kt=R(()=>{"use strict";hn();ye();Ve();Ct();X();xe();Na=Symbol("no_fallback"),Ui=Symbol("invalid"),Ma=n=>{let e=n.length;if(e<2)return!1;let t=n[0],r=n[e-1];return t==="{"&&r==="}"||t==="["&&r==="]"},Ua=n=>{let e=0,t=n.length;for(;e<t&&/\s/.test(n[e]);)e++;let r=t-1;for(;r>=e&&/\s/.test(n[r]);)r--;if(e>=r)return!1;let o=n[e],i=n[r];return o==="{"&&i==="}"||o==="["&&i==="]"};Ar="*",vi=n=>n.replace(/\\(.)/g,(e,t)=>ci[t]??t),Fi=n=>n!==void 0&&n!=="__proto__"&&n!=="constructor"&&n!=="prototype"});function Fa(n){return!F(n)||fr(n)?!1:ArrayBuffer.isView(n)?mr(n)||Po(n)||Bo(n):tn(n)||nn(n)}function Sr(n,e){if(n==null)return!1;try{if(Fa(n))return!0;if(e?.strict)return!1;if(typeof n=="string")return!0;if(ArrayBuffer.isView(n))return!fr(n);if(Array.isArray(n)){let t=n.length;for(let r=0;r<t;r++)if(!Ee(n[r],ja))return!1;return!0}}catch{return!1}return!1}function yn(n,e){try{if(!Sr(n,e))return null;if(mr(n))return n;if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(tn(n)||nn(n))return new Uint8Array(n);if(typeof n=="string")return Oe.encode(n);if(Array.isArray(n))return Uint8Array.from(n)}catch{return null}return null}var ja,Tr=R(()=>{"use strict";ye();Ve();xe();ja={range:"UInt8"}});function gn(n){let e=ie(n);return typeof e=="string"?e.trim().length===0:!1}function ft(n,e=null,t={}){if(n==null)return t.returnStringOnNull?"":null;let{mode:r="both",returnStringOnNull:o=!1,maxScanStart:i=1,maxScanEnd:s=1,maxMatchesStart:a=1,maxMatchesEnd:l=1,trimFirst:u=!1,stringOptions:c}=t,{literal:f=!1,caseInsensitive:m=!1}=c??{},h=(A,w="both")=>w==="start"?A.trimStart():w==="end"?A.trimEnd():A.trim(),p=n;if(u&&e!=null&&(p=h(n,r)),e==null){let A=h(p,r);return o||A!==""?A:null}let d=ge(e)?A=>{try{e.lastIndex=0}catch{}return e.test(A)}:(()=>{let A=new Set(m?e.toLowerCase():e);return w=>A.has(m?w.toLowerCase():w)})(),g=p.length;if(i===1&&a===1&&s===1&&l===1&&!f){let A=0,w=g;if(r==="both"||r==="start")for(;A<g&&d(p[A]);)A++;if(r==="both"||r==="end")for(;w>A&&d(p[w-1]);)w--;let D=A===0&&w===g?p:p.substring(A,w);return o||D!==""?D:null}let _=new Uint8Array(g),S=(A,w,D)=>{if(g===0||D===0)return;let O=A?0:g-1,C=A?g:-1,N=A?1:-1,Y=!1,Q=0,W=0;for(let le=O;le!==C;le+=N)if(d(p[le])){if(!Y){if(w!==null&&w>=0&&W>=w||D!==null&&D>=0&&Q>=D)break;Y=!0,Q++}_[le]=1}else if(Y=!1,W++,w!==null&&w>=0&&W>=w)break},b=(A,w,D,O,C)=>{if(g===0||C===0||w===0)return;let N=D?0:g-1,Y=0,Q=0,W=m?p.toLowerCase():p;for(;N>=0&&N<g&&!(C!==null&&C>=0&&Y>=C);){let le=D?N:N-w+1;if(!D&&le<0)break;let fe=D?W.indexOf(A,le):W.lastIndexOf(A,le);if(fe===-1)break;let Zt=D?fe-N:N-(fe+w-1);if(Q+=Zt,O!==null&&O>=0&&Q>=O)break;for(let at=0;at<w;at++)_[fe+at]=1;Y++,N=D?fe+w:fe-1}};if(r==="both"||r==="start")if(f&&typeof e=="string"){let A=m?e.toLowerCase():e;b(A,e.length,!0,i,a)}else S(!0,i,a);if(r==="both"||r==="end")if(f&&typeof e=="string"){let A=m?e.toLowerCase():e;b(A,e.length,!1,s,l)}else S(!1,s,l);let x="";for(let A=0;A<g;A++)_[A]===0&&(x+=p[A]);return o||x!==""?x:null}function G(n,{depth:e=0,maxDepth:t=50}={}){if(e>t)return"v:circular";if(n===null)return"v:null";if(n===void 0)return"v:undefined";if(P(n))return`d:${n.getTime()}`;if(K(n)){let o=n.toString();return`u:${n.constructor.name}:${o.length}:${o}`}if(Array.isArray(n)){let o=n.length,i=new Array(o),s={depth:e+1,maxDepth:t};for(let a=0;a<o;a++)i[a]=G(n[a],s);return`a:[${i.join(Ot)}]`}if(Qt(n)){let o=Array.from(n),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++)s[l]=G(o[l],a);return s.sort(),`set:[${s.join(Ot)}]`}if(en(n)){let o=Array.from(n.keys()),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++){let u=o[l];s[l]=`${G(u,a)}${ut}${G(n.get(u),a)}`}return s.sort(),`map:{${s.join(Ot)}}`}if(typeof n=="object"&&typeof n.toJSON=="function"){let o=n.toJSON();if(o!==n)return`j:${G(o,{depth:e+1,maxDepth:t})}`}if(ge(n)){let o=n.toString();return`r:${o.length}:${o}`}if(Pe(n)){let o=Object.keys(n).sort(),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++){let u=o[l];s[l]=`${G(u,a)}${ut}${G(n[u],a)}`}return`o:{${s.join(Ot)}}`}if(typeof n=="function"){let o=n.toString();return`f:${o.length}:${o}`}if(typeof n=="string")return`s:${n.length}:${n}`;if(typeof n=="symbol"){let o=n.toString();return`y:${o.length}:${o}`}if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return`${typeof n}:${n}`;let r=String(n);return`${typeof n}:${r.length}:${r}`}function Va(n){if(n==null)return[];let e=String(n);if(!e)return[];let r=e.normalize("NFC").replace(Ba,"$1$2").match(Pa)||[],o=[];for(let i=0;i<r.length;i++){let s=r[i];La.has(s)||o.push(s)}return o}function mt(n,e){let t=Va(n),r=t.length;if(r===0)return"";let{format:o}=e;if(o==="camel"||o==="pascal"||o==="title"){let i=o==="title"?" ":"",s=new Array(r);for(let a=0;a<r;a++){let l=t[a];s[a]=a===0&&o==="camel"?l.toLowerCase():l.charAt(0).toUpperCase()+l.slice(1).toLowerCase()}return s.join(i)}if(o==="kebab"||o==="snake"){let i=o==="kebab"?"-":"_",s=new Array(r);for(let a=0;a<r;a++)s[a]=t[a].toLowerCase();return s.join(i)}return String(n)}function zi(n){return typeof n!="string"&&(n=String(n)),Oe.encode(n)}function Ja(n){let e=yn(n);if(!e)return"";if(Ki&&typeof Uint8Array.prototype.toBase64=="function")return e.toBase64();if(xn)return Nt.from(e).toString("base64");let t="",r=e.length;for(let o=0;o<r;o+=Li){let i=e.subarray(o,o+Li);t+=String.fromCharCode.apply(null,i)}return btoa(t)}function Wa(n){if(typeof n!="string"&&(n=String(n)),xn)return Nt.from(n,"utf-8").toString("hex");let e=zi(n),t=e.length,r="";for(let o=0;o<t;o++)r+=qi[e[o]];return r}function Xa(n){typeof n!="string"&&(n=String(n));let e=zi(n);return Ja(e)}function Gi(n,e){if(n==null)return null;let t=Ha[e];if(!t)throw new Error(`Unsupported encoding: '${e}'. Supported encodings are 'hex' and 'base64'.`);return t(String(n))}function Ya(n){typeof n!="string"&&(n=String(n));let e=n.replace(qa,r=>Ka[r]),t=e.length%4;return t===0?e:e.padEnd(e.length+(4-t),"=")}function Za(n,e=!0){if(typeof n!="string"&&(n=String(n)),n!==""&&(n.length%4!==0||!za.test(n)))throw new Error("Invalid base64 encoding format");if(Ki)return Uint8Array.fromBase64(n,{strict:e});if(xn)return new Uint8Array(Nt.from(n,"base64"));let t=atob(n),r=t.length,o=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=t.charCodeAt(i);return o}function Qa(n){typeof n!="string"&&(n=String(n));let e=n.trim();if(e.length%2!==0||!Ga.test(e))throw new Error("Invalid hex string format");if($a)return Uint8Array.fromHex(e);if(xn){let r=Nt.from(e,"hex");if(r.length!==e.length/2)throw new Error("Invalid hex string format");return new Uint8Array(r)}let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){let o=parseInt(e.substring(r*2,r*2+2),16);if(Number.isNaN(o))throw new Error("Invalid hex string format");t[r]=o}return t}function el(n,e=!0){try{let t=Qa(n);return new TextDecoder("utf-8",{fatal:e}).decode(t)}catch(t){if(e)throw t;return null}}function tl(n,e=!0){try{typeof n!="string"&&(n=String(n));let t=n.trim(),r=Ya(t),o=Za(r,e);return new TextDecoder("utf-8",{fatal:e}).decode(o)}catch(t){if(e)throw t;return null}}function Ji(n,e,t={}){if(n==null)return null;let r=nl[e];if(!r)throw new Error(`Unsupported encoding: '${e}'. Supported encodings are 'hex' and 'base64'.`);let o=typeof t=="boolean"?t:t.strict??!0;return r(String(n),o)}function de(n,e){let t=ie(n);if(t==null)return"";let r=ge(t)?t.source:typeof t=="string"?t:String(t);return(e?.mode??"tc39")==="tc39"?typeof RegExp.escape=="function"&&!rl.test(r)?RegExp.escape(r):r.replace(ol,Vi):r.replace(il,Vi)}function pt(n,e,t){if(n==null||e==null)return null;let r=typeof n=="string"?n:String(n),o=t?.global??!1;try{if(!ge(e)){let a=typeof e=="string"?e:String(e),l=o?"g":"";if(t?.asciiCaseInsensitive&&(l+="i"),(a.includes("\\p{")||a.includes("\\P{"))&&!l.includes("u")&&!l.includes("v"))try{return{reg:new RegExp(a,l+"u"),input:r}}catch{try{return{reg:new RegExp(a,l+"v"),input:r}}catch{}}try{return{reg:new RegExp(a,l),input:r}}catch{return null}}let i=e.flags.replace(/y/g,"");o?i.includes("g")||(i+="g"):i=i.replace(/g/g,""),t?.asciiCaseInsensitive!==void 0&&(i=t.asciiCaseInsensitive?i.includes("i")?i:i+"i":i.replace(/i/g,""));let s=new RegExp(e.source,i);return s.lastIndex=0,{reg:s,input:r}}catch{return null}}function $i(n){let e=Object.create(null);n.index!==void 0&&Object.defineProperty(e,"_index",{value:String(n.index),writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"_length",{value:n.length,writable:!0,enumerable:!1,configurable:!0});for(let t=0;t<n.length;t++)e[String(t)]=n[t]!==void 0?n[t]:null;if(n.groups)for(let t in n.groups){let r=n.groups[t];e[t]=r!==void 0?r:null}return e}function Dr(n,e){if(typeof e=="string")return e in n?n[e]:null;let t=Number(e);if(Number.isNaN(t))return null;let r=Math.trunc(t);if(r>=0)return n[String(r)]??null;let i=(n._length??0)+r;return i>=1?n[String(i)]??null:null}function sl(n,e,t,r,o){let{literal:i=!1,mode:s,asciiCaseInsensitive:a=!1}=r??{},l=i?de(e,{mode:s}):e,c=pt(n,l,{global:!0,asciiCaseInsensitive:a})?.reg??null;if(!c)return[];let f=[];c.lastIndex=0;let m;for(;(m=c.exec(n))!==null;){let h=m.index,p=c.lastIndex,d=o(m,h,p);if(f.push({start:h,end:p,patternIndex:t,payload:d}),h===p){if(h===n.length)break;let g=n.codePointAt(h),y=g!=null&&g>65535?2:1;c.lastIndex=h+y}}return f}function Xi(n){if(n.length<=1)return n;n.sort((o,i)=>{if(o.start!==i.start)return o.start-i.start;let s=o.patternIndex??o.i??0,a=i.patternIndex??i.i??0;return s-a});let e=[],t=0,r=n.length;for(let o=0;o<r;o++){let i=n[o];i.start>=t&&(e.push(i),t=i.end)}return e}function Hi(n,e,t,r,o){let{overlapping:i=!1,leftmost:s,...a}=t??{},l=s??!0;if(i&&s)throw new M("Cannot specify both 'overlapping' and 'leftmost' as true.");if(n==null||e==null)return null;let u=be(e),c=u.length;if(c===0)return[];if(i){let h=new Array(c);for(let p=0;p<c;p++)h[p]=r(u[p]);return h}let f=[];for(let h=0;h<c;h++){let p=Mt(n,u[h],{...a,global:!1});if(p&&p[0]&&p[0]._index!=null){let d=Number(p[0]._index),g=p[0][0]?.length??0;f.push({i:h,start:d,end:d+g,payload:o(p[0],d)})}}let m=new Array(c).fill(null);if(f.length===0)return m;if(l){let h=Xi(f);for(let p=0;p<h.length;p++){let d=h[p];m[d.i]=d.payload}}else{let h=[];f.sort((g,y)=>g.i-y.i);let p=f.length;for(let g=0;g<p;g++){let y=f[g],_=!1,S=h.length;for(let b=0;b<S;b++){let x=h[b],A=!1;if(y.start===y.end&&x.start===x.end?A=y.start===x.start:x.start===x.end?A=x.start>=y.start&&x.start<y.end:y.start===y.end?A=y.start>=x.start&&y.start<x.end:A=y.start<x.end&&y.end>x.start,A){_=!0;break}}_||h.push(y)}let d=h.length;for(let g=0;g<d;g++){let y=h[g];m[y.i]=y.payload}}return m}function Mt(n,e,t){let r=pt(n,e,t);if(!r)return null;if(!t?.global){let s=r.input.match(r.reg);return s?[$i(s)]:null}let o=Array.from(r.input.matchAll(r.reg));if(o.length===0)return null;let i=new Array(o.length);for(let s=0;s<o.length;s++)i[s]=$i(o[s]);return i}function Or(n,e,t){let r=Mt(n,e,t);return r?Dr(r[0],t?.groupIndex??1):null}function Yi(n,e,t){let r=Mt(n,e,{...t,global:!0});if(!r)return null;let o=t?.groupIndex??0,i=new Array(r.length);for(let s=0;s<r.length;s++)i[s]=Dr(r[s],o);return i}function Zi(n,e,t){return Mt(n,e,t)?.[0]??null}function Qi(n,e,t){let r=t?.groupIndex??0;return Hi(n,e,t,o=>Or(n,o,{...t,groupIndex:r}),o=>Dr(o,r))}function _n(n,e,t){if(n==null||e==null)return null;let{literal:r=!1,asciiCaseInsensitive:o=!1,mode:i}=t??{};if(r){let l=ge(e),u=de(e,{mode:i}),c=o?"i":"";if(l)for(let h of["i","u","v","m","s"])e.flags.includes(h)&&!c.includes(h)&&(c+=h);let f=new RegExp(u,c),m=n.match(f);return!m||m.index==null?null:Oe.encode(n.slice(0,m.index)).length}let s=Mt(n,e,{...t,global:!1});if(!s||!s[0]||s[0]._index==null)return null;let a=Number(s[0]._index);return Oe.encode(n.slice(0,a)).length}function es(n,e,t){if(t?.literal){if(n==null||e==null)return null;let r=be(e),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=_n(n,r[i],t);return o}return Hi(n,e,t,r=>_n(n,r,t),(r,o)=>Oe.encode(n.slice(0,o)).length)}function ts(n,e,t){if(n==null||e==null)return null;let{literal:r=!0,inclusive:o=!1,limit:i,exact:s=!1,strict:a=!1,mode:l,...u}=t??{},c=r?de(e,{mode:l}):e,f=pt(n,c,{...u,global:!0});if(!f)return null;let{reg:m}=f;m.lastIndex=0;let h=[],p=0,d=0,g=i!=null&&i>=0?i:1/0,y;for(;d<g&&(y=m.exec(n))!==null;){let S=y.index,b=m.lastIndex;if(S===b){if(S===n.length)break;let x=n.codePointAt(S),A=x!=null&&x>65535?2:1;if(S>0&&S>=p&&(h.push(n.slice(p,S)),d++,p=S,d>=g))break;m.lastIndex=S+A;continue}h.push(n.slice(p,o?b:S)),p=b,d++}if(h.push(n.slice(p)),i==null||i<0)return h;let _=i+1;if(a&&h.length<_)throw new M(`split exact error: expected string to split into at least ${_} parts, but got ${h.length}`);if(s)for(;h.length<_;)h.push(null);return h}function ns(n,e,t,r,o,i){return n.replace(/\$\$|\$([$'`&]|\d{1,2}|<[^>]+>)/g,(s,a)=>{if(s==="$$")return"$";if(!a)return s;if(a==="$")return"$";if(a==="&")return e;if(a==="`")return r.slice(0,t);if(a==="'")return r.slice(t+e.length);if(a.startsWith("<")){if(i===void 0)return s;let u=a.slice(1,-1);return i[u]??""}let l=Number(a);if(l>0&&l<=o.length)return o[l-1]??"";if(a.length===2){let u=Number(a[0]);if(u>0&&u<=o.length)return(o[u-1]??"")+a[1]}return s})}function Er(n,e,t,r){if(n==null||e==null||t==null)return null;let o=typeof n=="string"?n:String(n),{literal:i=!1,n:s,mode:a,...l}=r??{},u=s??(l?.global?1/0:1),c=v(u,{allowNonFiniteNumbers:!0,allowNaN:!1})?Math.trunc(u):1;if(c===0)return o;let f=i?de(e,{mode:a}):e,m=pt(o,f,{...l,global:l?.global??c!==1});if(!m)return o;let{reg:h}=m,p=typeof t=="function";if(c===1||c<0||c===1/0){if(i&&!p){let y=String(t);return o.replace(h,()=>y)}return o.replace(h,t)}let d=0,g=p?"":String(t);return o.replace(h,(...y)=>{if(d++>=c)return y[0];if(p)return String(t(...y));if(i)return g;let _=y.length,S=typeof y[_-1]=="object"&&y[_-1]!==null,b=S?y[_-1]:void 0,x=S?y[_-3]:y[_-2],A=y.slice(1,S?_-3:_-2);return ns(g,y[0],x,o,A,b)})}function rs(n,e,t,r){if(n==null||e==null)return null;let o=typeof n=="string"?n:String(n),i,s=null,a=null;if(!Array.isArray(e)&&typeof e=="object")i=Object.keys(e),s=Object.values(e);else if(Array.isArray(e))if(i=e,Array.isArray(t))if(t.length===1&&i.length>1)a=t[0];else{if(t.length!==i.length)throw new M(`replace_many length mismatch: expected ${i.length} replacement strings, got ${t.length}`);s=t}else if(t!=null)a=t;else return o;else return o;let l=i.length;if(l===0)return o;let u=[];for(let p=0;p<l;p++){let d=i[p],g=s?s[p]:a;if(d==null||g==null)continue;let y=sl(o,d,p,r,(_,S)=>{let b=Array.prototype.slice.call(_,1);if(typeof g=="function"){let x=[_[0],...b,S,o];return _.groups!==void 0&&x.push(_.groups),String(g(...x))}return r?.literal?String(g):ns(String(g),_[0],S,o,b,_.groups)});for(let _=0;_<y.length;_++)u.push(y[_])}if(u.length===0)return o;let c=Xi(u),f="",m=0,h=c.length;for(let p=0;p<h;p++){let d=c[p];f+=o.slice(m,d.start)+d.payload,m=d.end}return f+=o.slice(m),f}var Ba,Pa,La,Nt,xn,$a,Ki,Li,qi,Ka,qa,za,Ga,su,Ha,nl,rl,Wi,ol,il,Vi,Ct=R(()=>{"use strict";ye();hn();kt();Tr();Ve();xe();X();Ba=/(\p{L})['’](\p{L})/gu,Pa=new RegExp(["\\p{Lu}+s(?!\\p{Ll})","\\p{Lu}+(?=\\p{Lu}\\p{Ll})","\\p{Lu}+\\p{Ll}*","\\p{Ll}+","\\p{N}+","\\p{L}+"].join("|"),"gu"),La=new Set(["__proto__","proto","constructor","prototype"]);Nt=typeof globalThis<"u"?globalThis.Buffer:void 0,xn=typeof Nt<"u",$a=typeof Uint8Array<"u"&&typeof Uint8Array.fromHex=="function",Ki=typeof Uint8Array<"u"&&typeof Uint8Array.fromBase64=="function",Li=8192,qi=new Array(256);for(let n=0;n<256;n++)qi[n]=n.toString(16).padStart(2,"0");Ka={"-":"+",_:"/"},qa=/[-_]/g,za=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Ga=/^[0-9a-fA-F]*$/,su=He({handleCircular:!0});Ha={hex:Wa,base64:Xa};nl={hex:el,base64:tl};rl=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Wi="\\x00-\\x1F\\x7F\\u{D800}-\\u{DFFF}",ol=new RegExp(`[${Wi}\\\\^$*+?.()|[\\]{}/#,=<>&!%:;@~'"\`-]`,"gu"),il=new RegExp(`[${Wi}]|[\\x20-\\x2F\\x3A-\\x40\\x5B-\\x5E\\x5F\\x60\\x7B-\\x7E]`,"gu"),Vi=n=>{let e=n.codePointAt(0),t=e<=si||e===ai,r=n.length===1&&e>=li&&e<=ui;if(t||r){let o=yr[e];if(o)return o;let i=e.toString(16);return t?`\\x${i.padStart(2,"0")}`:`\\u${i.padStart(4,"0")}`}return"\\"+n}});function ul(n){let e=os.get(n);return e||(e=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),os.set(n,e)),e}function cl(n,e){let t=`${n}_${e}`,r=is.get(t);return r||(r=new Intl.DateTimeFormat(n,{timeZoneName:"short",timeZone:e}),is.set(t,r)),r}function fl(n){let e=ss.get(n);if(e===void 0){try{Intl.DateTimeFormat(void 0,{timeZone:n}),e=!0}catch{e=!1}ss.set(n,e)}return e}function we(n){let e=!n||n==="local"?Intl.DateTimeFormat().resolvedOptions().timeZone:n;return fl(e)?e:"UTC"}function te(n,e=0,t=1,r=0,o=0,i=0,s=0){let a=new Date(0);return a.setUTCFullYear(n,e,t),a.setUTCHours(r,o,i,s),a}function ml(n,e,t){let r=[0,3,2,5,0,3,5,1,4,6,2,4],o=n;return e<3&&(o-=1),(o+Math.floor(o/4)-Math.floor(o/100)+Math.floor(o/400)+r[e-1]+t)%7}function ae(n,e){let t=we(e);if(t.toUpperCase()==="UTC")return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),dayOfWeek:n.getUTCDay(),timeZone:"UTC"};let o=ul(t).formatToParts(n),i="0",s="0",a="0",l="0",u="0",c="0",f="0";for(let _=0,S=o.length;_<S;_++){let b=o[_];switch(b.type){case"year":i=b.value;break;case"month":s=b.value;break;case"day":a=b.value;break;case"hour":l=b.value;break;case"minute":u=b.value;break;case"second":c=b.value;break;case"fractionalSecond":f=b.value;break}}let m=parseInt(i,10),h=parseInt(s,10),p=parseInt(a,10),d=parseInt(l,10);d===24&&(d=0);let g=Math.round(parseFloat("0."+f)*1e3)||0,y=ml(m,h,p);return{year:m,month:h,day:p,hour:d,minute:parseInt(u,10),second:parseInt(c,10),ms:g,dayOfWeek:y,timeZone:t}}function ht(n,e){let t=we(e);if(t.toUpperCase()==="UTC")return 0;let r=ae(n,"UTC"),o=ae(n,t),i=te(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.ms).getTime(),s=te(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.ms).getTime();return Math.round((s-i)/_e)}function as(n,e){let t=n>=0?"+":"-",r=Math.abs(n),o=String(Math.floor(r/60)).padStart(2,"0"),i=String(r%60).padStart(2,"0");return e==="iso"?`${t}${o}:${i}`:`${t}${o}${i}`}function J(n,e){let t=ie(n);if(t==null)return null;let r=null;if(P(t))r=t;else if(typeof t=="number"||typeof t=="bigint")r=new Date(pl(t));else if(typeof t=="string"){if(gn(t))return null;r=new Date(t)}if(!r||!P(r))return null;if(e?.dateOnly){let o=typeof t=="string",i=o&&ll.test(t),s=o&&!i&&!ls.test(t)?"local":"UTC",a=ae(r,s);return te(a.year,a.month-1,a.day)}return r}function wn(n){let e=ie(n);if(e==null)return null;let t=null;if(typeof e=="string"){let o=e.trim();if(al.test(o)){let i=ls.test(o);t=J(`1970-01-01T${o}${i?"":"Z"}`)}}let r=t||J(e);return r?Ye(r,{format:"%H:%M:%S.%ms"}):null}function us(n,e="ms"){let t=n.getTime();switch(e){case"s":return Math.floor(t/lt);case"ms":return t;case"us":return BigInt(t)*dr;case"ns":return BigInt(t)*gr}}function pl(n){if(typeof n=="bigint"){let t=n<0n?-n:n;return t<=30000000000n?Number(n)*1e3:t<=30000000000000n?Number(n):t<=30000000000000000n?Number(n/dr):Number(n/gr)}let e=Math.abs(n);return e<=3e10?n*1e3:e<=3e13?n:e<=3e16?Math.floor(n/1e3):Math.floor(n/1e6)}function cs(n){if(!P(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/100)+1}function Ir(n,e={field:"week"}){if(!P(n))return null;let t=te(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r=t.getUTCDay()||7;if(t.setUTCDate(t.getUTCDate()+4-r),e.field==="year")return t.getUTCFullYear();let o=te(t.getUTCFullYear(),0,1),i=Math.round((t.getTime()-o.getTime())/Le);return Math.floor(i/7)+1}function fs(n){if(!P(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/1e3)+1}function An(n,e,t=1){return P(n)?te(n.getUTCFullYear(),n.getUTCMonth()+e,t):null}function Cr(n){if(!P(n))return null;let e=te(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()).getTime(),t=te(n.getUTCFullYear(),0,1).getTime();return Math.floor((e-t)/Le)+1}function ms(n){return P(n)?Math.floor(n.getUTCMonth()/3)+1:null}function Rr(n){let e;if(P(n))e=n.getUTCFullYear();else if(v(n))e=n;else return!1;return e%4===0&&e%100!==0||e%400===0}function ps(n){return n.replace(/%[FTRD]/g,e=>dl[e]||e)}function gl(n){let e=n.replace(":",""),t=e[0]==="+"?1:-1,r=parseInt(e.slice(1,3),10)||0,o=parseInt(e.slice(3,5),10)||0;return t*(r*60+o)}function Ye(n,{format:e,locale:t,timeZone:r="UTC"}){if(!P(n)||typeof e!="string")return"";let o=t&&t.trim()||Intl.DateTimeFormat().resolvedOptions().locale||"en-US",i=ps(e),s=null,a=()=>s??=ae(n,r);return i.replace(bn,(l,u)=>{if(u==="%")return"%";let c=kr[u];return c?c.format(n,o,r,a()):l})}function hs(n,{format:e,strict:t=!0,defaultTimeZone:r="UTC"}){if(typeof n!="string"||typeof e!="string")return null;let o=ps(e),i=[],s="",a=0;bn.lastIndex=0;let l;for(;(l=bn.exec(o))!==null;){let d=o.slice(a,l.index);s+=de(d);let g=l[1];if(g==="%")s+="\\%";else{let y=kr[g];y&&y.parseRegex?(i.push(y),s+=`(${y.parseRegex})`):s+=de(l[0])}a=bn.lastIndex}s+=de(o.slice(a));let u=new RegExp("^\\s*"+s+"\\s*$"),c=n.match(u);if(!c)return t?null:J(n);let f={year:1970,month:1,day:1,hour:0,minute:0,second:0,ms:0,offset:null},m=null,h=!1;for(let d=0;d<i.length;d++){let g=c[d+1],y=i[d],_=y.parseNormalize?y.parseNormalize(g):parseInt(g,10);y.key==="j"&&(h=!0),y.parseField==="ampm"?m=_:y.parseField==="offset"?f.offset=_:y.parseField&&(f[y.parseField]=_)}if(m&&(m==="PM"&&f.hour<12&&(f.hour+=12),m==="AM"&&f.hour===12&&(f.hour=0)),h){let d=Rr(f.year)?366:365;if(f.day<1||f.day>d)return null;let g=te(f.year,0,1);g.setUTCDate(f.day),f.month=g.getUTCMonth()+1,f.day=g.getUTCDate()}let p=te(f.year,f.month-1,f.day,f.hour,f.minute,f.second,f.ms);if(!P(p)||p.getUTCFullYear()!==f.year||p.getUTCMonth()+1!==f.month||p.getUTCDate()!==f.day||p.getUTCHours()!==f.hour||p.getUTCMinutes()!==f.minute||p.getUTCSeconds()!==f.second||p.getUTCMilliseconds()!==f.ms)return null;if(f.offset)p=new Date(p.getTime()-gl(f.offset)*_e);else if(r.toUpperCase()!=="UTC"){let d=we(r),g=ht(p,d);p=new Date(p.getTime()-g*_e);let y=ht(p,d);y!==g&&(p=new Date(p.getTime()-(y-g)*_e))}return P(p)?p:null}function ds(n,e,{excludeWeekdays:t=[],holidays:r=[],roll:o}={}){if(!Ee(e))throw new ne(`The offset parameter 'n' must be a whole integer. Received: ${e}`);if(t.length===0&&(!r||Array.isArray(r)&&r.length===0||r instanceof Set&&r.size===0)&&!o)return e;if(7-t.length<=0)throw new ne("All weekdays are excluded; cannot offset.");let s=new Set;if(r instanceof Set)for(let f of r){let m=new Date(f);t.includes(m.getUTCDay())||s.add(f)}else if(Array.isArray(r))for(let f=0;f<r.length;f++){let m=J(r[f]);if(!m||t.includes(m.getUTCDay()))continue;let h=te(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate());s.add(h.getTime())}let a=f=>t.includes(f.getUTCDay())?!0:s.has(f.getTime()),l=te(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),u=new Date(l.getTime());if(o&&a(u)){if(o==="raise")throw new ne("Start date falls on an excluded day or holiday.");let f=o==="forward"?1:-1;for(;a(u);)u.setUTCDate(u.getUTCDate()+f)}if(e!==0){let f=e>0?1:-1,m=0,h=Math.abs(e);for(;m<h;)u.setUTCDate(u.getUTCDate()+f),a(u)||m++}let c=u.getTime()-l.getTime();return Math.round(c/Le)}function Nr(n,e,t){let r=we(e),o=t?.type??"total",i;if(o==="total")i=ht(n,r);else{let l=ae(n,r).year,u=ht(te(l,0,1),r),c=ht(te(l,6,1),r),f=Math.min(u,c);o==="daylightSavingTime"?i=ht(n,r)-f:i=f}switch(t?.format??"milliseconds"){case"minutes":return i;case"hours":return i/60;case"iso":return as(i,"iso");case"basic":return as(i,"basic");default:return i*_e}}function gs(n,e={}){if(!P(n))return null;let t=e.excludeWeekdays??[0,6],r=n.getUTCDay();if(t.includes(r))return!1;let o=e.holidays;if(o){if(o instanceof Set){let i=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(o.has(i))return!1}else if(Array.isArray(o)&&o.length>0){let i=new Set;for(let a=0;a<o.length;a++){let l=J(o[a]);l&&i.add(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))}let s=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(i.has(s))return!1}}return!0}function ys(n,e={}){let t=ae(n,e?.timeZone??void 0),r=e?.year??t.year,o=e?.month!=null?e.month-1:t.month-1,i=e?.day??t.day,s=e?.hour??t.hour,a=e?.minute??t.minute,l=e?.second??t.second,u=e?.ms??t.ms;return te(r,o,i,s,a,l,u)}var al,ls,ll,os,is,ss,kr,hl,bn,dl,dn=R(()=>{"use strict";Ct();X();ye();Ve();xe();al=/^\d{2}:\d{2}/,ls=/(?:Z|[+-]\d{2}(?::?\d{2})?)$/i,ll=/^\d{4}-\d{2}-\d{2}$/,os=new Map;is=new Map;ss=new Map;kr={Y:{key:"Y",format:(n,e,t,r)=>{let o=r.year;return o>=0?String(o).padStart(4,"0"):"-"+String(Math.abs(o)).padStart(4,"0")},parseRegex:"[+-]?\\d{4,}",parseField:"year"},y:{key:"y",format:(n,e,t,r)=>String(Math.abs(r.year)%100).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"year",parseNormalize:n=>{let e=parseInt(n,10);return e+(e>=69?1900:2e3)}},m:{key:"m",format:(n,e,t,r)=>String(r.month).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"month"},d:{key:"d",format:(n,e,t,r)=>String(r.day).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"day"},e:{key:"e",format:(n,e,t,r)=>String(r.day).padStart(2," "),parseRegex:"\\s?\\d{1,2}",parseField:"day"},H:{key:"H",format:(n,e,t,r)=>String(r.hour).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},I:{key:"I",format:(n,e,t,r)=>String(r.hour%12||12).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},p:{key:"p",format:(n,e,t,r)=>r.hour>=12?"PM":"AM",parseRegex:"AM|PM|am|pm",parseField:"ampm",parseNormalize:n=>n.toUpperCase()},M:{key:"M",format:(n,e,t,r)=>String(r.minute).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"minute"},S:{key:"S",format:(n,e,t,r)=>String(r.second).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"second"},A:{key:"A",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"long",timeZone:we(t)})},a:{key:"a",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"short",timeZone:we(t)})},B:{key:"B",format:(n,e,t)=>n.toLocaleDateString(e,{month:"long",timeZone:we(t)})},b:{key:"b",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:we(t)})},h:{key:"h",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:we(t)})},j:{key:"j",format:(n,e,t,r)=>String(Cr(te(r.year,r.month-1,r.day))??1).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"day",parseNormalize:n=>parseInt(n,10)},u:{key:"u",format:(n,e,t,r)=>String(r.dayOfWeek||7)},w:{key:"w",format:(n,e,t,r)=>String(r.dayOfWeek)},Z:{key:"Z",format:(n,e,t)=>{let r=we(t);if(r.toUpperCase()==="UTC")return"UTC";let o=cl(e,r).formatToParts(n);for(let i=0,s=o.length;i<s;i++)if(o[i].type==="timeZoneName")return o[i].value;return"UTC"}},z:{key:"z",format:(n,e,t)=>Nr(n,t,{format:"basic"}),parseRegex:"[+-]\\d{2}(?::?\\d{2})?",parseField:"offset",parseNormalize:n=>n.replace(":","")},ms:{key:"ms",format:(n,e,t,r)=>String(r.ms).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"ms",parseNormalize:n=>parseInt(n,10)},f:{key:"f",format:(n,e,t,r)=>String(r.ms).padStart(3,"0").padEnd(6,"0"),parseRegex:"\\d{1,9}",parseField:"ms",parseNormalize:n=>parseInt(n.padEnd(6,"0").slice(0,3),10)}},hl=Object.keys(kr).concat("%").sort((n,e)=>e.length-n.length),bn=new RegExp("%("+hl.join("|")+")","g"),dl={"%F":"%Y-%m-%d","%T":"%H:%M:%S","%R":"%H:%M","%D":"%m/%d/%y"}});var Z,Ze,Ut,qe,ze,dt,Ge,gt,Sn=R(()=>{"use strict";Z=class n{matches(e){if(e==null)return!1;if(e instanceof n)return!!(this.equals(e)||this.name.startsWith("Decimal")&&e.name.startsWith("Decimal")&&e.precision===void 0&&e.scale===void 0);if(typeof e=="function"){if(e.prototype instanceof n)return this instanceof e;try{let t=e();if(t instanceof n)return this.constructor===t.constructor}catch{}}return!1}get isNumeric(){return!1}get isInteger(){return!1}get isFloat(){return!1}get isSigned(){return!1}get isUnsigned(){return!1}get isTemporal(){return!1}get isNested(){return!1}get isBoolean(){return!1}get isString(){return!1}get isUtf8(){return!1}get isObject(){return!1}get isNull(){return!1}get isBinary(){return!1}},Ze=class extends Z{get isNumeric(){return!0}},Ut=class extends Ze{get isInteger(){return!0}},qe=class extends Ut{get isSigned(){return!0}},ze=class extends Ut{get isUnsigned(){return!0}},dt=class extends Ze{get isFloat(){return!0}},Ge=class extends Z{get isTemporal(){return!0}},gt=class extends Z{get isNested(){return!0}}});var Tn,Mr,Dn,Ur,On,vr,En,vt,In,Fr,Cn,jr,Rn,Br,kn,Pr,Qe,Lr,et,Ft,ke,Nn,jt,Mn,_t,Un,Vr,vn,$r,Fn,Kr,jn,qr,Ae,Bt,Bn,zr,me,Gr,tt,Jr,yt,Wr,xt=R(()=>{"use strict";Sn();z();Tn=class extends qe{name="Int8";coerce(e){return se(e,{range:"Int8"})}equals(e){return e.name==="Int8"}allocate(e){return new Int8Array(e)}},Mr=new Tn,Dn=class extends qe{name="Int16";coerce(e){return se(e,{range:"Int16"})}equals(e){return e.name==="Int16"}allocate(e){return new Int16Array(e)}},Ur=new Dn,On=class extends qe{name="Int32";coerce(e){return se(e,{range:"Int32"})}equals(e){return e.name==="Int32"}allocate(e){return new Int32Array(e)}},vr=new On,En=class extends qe{name="Int64";coerce(e){return Ie(e,{truncate:!0})}equals(e){return e.name==="Int64"}allocate(e){return new BigInt64Array(e)}},vt=new En,In=class extends ze{name="UInt8";coerce(e){return se(e,{range:"UInt8"})}equals(e){return e.name==="UInt8"}allocate(e){return new Uint8Array(e)}},Fr=new In,Cn=class extends ze{name="UInt16";coerce(e){return se(e,{range:"UInt16"})}equals(e){return e.name==="UInt16"}allocate(e){return new Uint16Array(e)}},jr=new Cn,Rn=class extends ze{name="UInt32";coerce(e){return se(e,{range:"UInt32"})}equals(e){return e.name==="UInt32"}allocate(e){return new Uint32Array(e)}},Br=new Rn,kn=class extends ze{name="UInt64";coerce(e){return Ie(e,{range:"UInt64"})}equals(e){return e.name==="UInt64"}allocate(e){return new BigUint64Array(e)}},Pr=new kn,Qe=class extends dt{name="Float32";coerce(e){return _r(e,{floatPrecision:"Float32"})}equals(e){return e.name==="Float32"}allocate(e){return new Float32Array(e)}},Lr=new Qe,et=class extends dt{name="Float64";coerce(e){return _r(e,{floatPrecision:"Float64"})}equals(e){return e.name==="Float64"}allocate(e){return new Float64Array(e)}},Ft=new et,ke=class n extends Ze{constructor(t,r){super();this.precision=t;this.scale=r;this.name=t!==void 0&&r!==void 0?`Decimal(${t}, ${r})`:"Decimal"}precision;scale;name;coerce(t){return sn(t,{precision:this.precision,scale:this.scale})}equals(t){return t instanceof n&&this.precision===t.precision&&this.scale===t.scale}allocate(t){return new Array(t).fill(null)}},Nn=class extends Z{name="Boolean";get isBoolean(){return!0}coerce(e){return e==null?null:!!e}equals(e){return e.name==="Boolean"}allocate(e){return new Array(e).fill(null)}},jt=new Nn,Mn=class extends Z{name="Utf8";get isString(){return!0}get isUtf8(){return!0}coerce(e){return e==null?null:String(e)}equals(e){return e.name==="Utf8"}allocate(e){return new Array(e).fill(null)}},_t=new Mn,Un=class extends Z{name="Binary";get isBinary(){return!0}coerce(e){return yn(e)}equals(e){return e.name==="Binary"}allocate(e){return new Array(e).fill(null)}},Vr=new Un,vn=class extends Z{name="Null";get isNull(){return!0}coerce(e){return null}equals(e){return e.name==="Null"}allocate(e){return new Array(e).fill(null)}},$r=new vn,Fn=class extends Z{name="Object";get isObject(){return!0}coerce(e){return e===void 0?null:e}equals(e){return e.name==="Object"}allocate(e){return new Array(e).fill(null)}},Kr=new Fn,jn=class extends Ge{name="Date";coerce(e){return J(e,{dateOnly:!0})}equals(e){return e.name==="Date"}allocate(e){return new Array(e).fill(null)}},qr=new jn,Ae=class n extends Ge{name="Datetime";timeUnit;timeZone;constructor(e="ms",t=null){super(),this.timeUnit=e,this.timeZone=t}coerce(e){return J(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit&&e.timeZone===this.timeZone}allocate(e){return new Array(e).fill(null)}},Bt=new Ae,Bn=class extends Ge{name="Time";coerce(e){return wn(e)}equals(e){return e.name==="Time"}allocate(e){return new Array(e).fill(null)}},zr=new Bn,me=class n extends Ge{name="Duration";timeUnit;constructor(e="ms"){super(),this.timeUnit=e}coerce(e){return j(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit}allocate(e){return new Array(e).fill(null)}},Gr=new me,tt=class n extends gt{constructor(t){super();this.innerType=t}innerType;name="Array";coerce(t){if(t==null)return null;let r=k(t)?Array.from(t):[t],o=r.length,i=new Array(o);for(let s=0;s<o;s++)i[s]=this.innerType.coerce(r[s]);return i}equals(t){return t instanceof n&&this.innerType.equals(t.innerType)}allocate(t){return new Array(t).fill(null)}},Jr=n=>new tt(n),yt=class n extends gt{constructor(t){super();this.fields=t}fields;name="Struct";coerce(t){if(!F(t))return null;let r={},o=Object.keys(this.fields),i=o.length;for(let s=0;s<i;s++){let a=o[s],l=this.fields[a];r[a]=l.coerce(t[a])}return r}equals(t){if(!(t instanceof n))return!1;let r=Object.keys(this.fields),o=Object.keys(t.fields);if(r.length!==o.length)return!1;for(let i=0;i<r.length;i++){let s=r[i];if(!this.fields[s].equals(t.fields[s]))return!1}return!0}allocate(t){return new Array(t).fill(null)}},Wr=n=>new yt(n)});var E,Ne=R(()=>{"use strict";Sn();xt();xt();Sn();E={Int8:Mr,Int16:Ur,Int32:vr,Int64:vt,UInt8:Fr,UInt16:jr,UInt32:Br,UInt64:Pr,Float32:Lr,Float64:Ft,Decimal:(n,e)=>new ke(n,e),Boolean:jt,Utf8:_t,Binary:Vr,Date:qr,Datetime:Bt,Time:zr,Duration:Gr,Object:Kr,Null:$r,Array:Jr,Struct:Wr}});function _l(n={}){let e=n.nullValue!==void 0?n.nullValue:"",t=yi(n.numericFormatOptions),r=n.replacerOptions||{},o=a=>n.datetimeFormat?Ye(a,{format:n.datetimeFormat}):n.dateFormat?Ye(a,{format:n.dateFormat}):n.timeFormat?Ye(a,{format:n.timeFormat}):a.toISOString(),i=He({formatDate:o,...r}),s=typeof r.onBigInt=="function";return a=>{if(a==null||typeof a=="symbol"||typeof a=="function")return{str:e,isNumeric:!1};if(typeof a=="bigint"&&!s&&!r.voidBigIntReplacement)return{str:t(a),isNumeric:!0};let l=i.call(null,"",a),u=ie(l);return u==null||typeof u=="symbol"||typeof u=="function"?{str:e,isNumeric:!1}:typeof u=="string"?{str:u,isNumeric:!1}:typeof u=="number"||typeof u=="bigint"?{str:t(u),isNumeric:!0}:typeof u=="boolean"?{str:u?"true":"false",isNumeric:!1}:typeof u=="object"?{str:JSON.stringify(u,He({formatDate:o,...r})),isNumeric:!1}:{str:String(u),isNumeric:!1}}}function Ln(n,e,t={}){let{separator:r=",",quoteChar:o='"',includeHeader:i=!0,lineTerminator:s=`
2
- `,quoteStyle:a="necessary",includeBom:l=!1,onRow:u,...c}=t,f=Object.keys(n),m=f.length,h=[],p=!0,d=_l(c),g=(_,S=!1)=>{let b,x=!1;if(S)b=String(_);else{let w=d(_);b=w.str,x=w.isNumeric}if(a==="never")return b;if(a==="always"){let w=b.split(o).join(o+o);return o+w+o}if(a==="non_numeric"&&!x&&_!=null){let w=b.split(o).join(o+o);return o+w+o}if(b.includes(r)||b.includes(o)||b.includes(`
3
- `)||b.includes("\r")){let w=b.split(o).join(o+o);return o+w+o}return b},y=_=>{if(p){let S=l?"\uFEFF"+_:_;u?u(S):h.push(S),p=!1}else u?u(s+_):h.push(_)};if(i){let _=new Array(m);for(let S=0;S<m;S++)_[S]=g(f[S],!0);y(_.join(r))}for(let _=0;_<e;_++){let S=new Array(m);for(let b=0;b<m;b++)S[b]=g(n[f[b]][_],!1);y(S.join(r))}return u?l?"\uFEFF":"":h.join(s)}function _s(n,e={}){let t=e.separator||",",r=e.quoteChar||'"',o=n;o.startsWith("\uFEFF")&&(o=o.substring("\uFEFF".length));let i=[],s=[],a="",l=!1,u=!1,c=!1,f=o.length;for(let m=0;m<f;m++){let h=o[m];if(l)u=!0,c=!1,h===r?m+1<f&&o[m+1]===r?(a+=r,m++):l=!1:a+=h;else if(h===r)u=!0,c=!1,l=!0;else if(h===t)s.push(a),a="",c=!0;else{let p=!1;h==="\r"?(p=!0,m+1<f&&o[m+1]===`
4
- `&&m++):h===`
5
- `&&(p=!0),p?(u||s.length>0||a!==""||c)&&(s.push(a),i.push(s),s=[],a="",u=!1,c=!1):(u=!0,c=!1,a+=h)}}return(u||s.length>0||a!==""||c)&&(s.push(a),i.push(s)),i}function xs(n,e={}){let t=new Set(e.nullValues??["","NA","null","NaN"]),r=n.length,o=!0,i=!0,s=!0,a=!0,l=!1;for(let c=0;c<r;c++){let f=n[c].trim();if(!t.has(f)){if(l=!0,o){let m=f.toLowerCase();m!=="true"&&m!=="false"&&m!=="1"&&m!=="0"&&(o=!1)}if(s&&Ie(f,{truncate:!1})===null&&(s=!1),i&&j(f,{allowNonFiniteNumbers:!0})===null&&(i=!1),a&&J(f)===null&&(a=!1),!o&&!i&&!s&&!a)break}}let u=new Array(r);if(!l||!o&&!i&&!s&&!a){for(let c=0;c<r;c++){let f=n[c];u[c]=t.has(f.trim())?null:f}return{type:_t,values:u}}if(o){for(let c=0;c<r;c++){let f=n[c].trim();if(t.has(f))u[c]=null;else{let m=f.toLowerCase();u[c]=m==="true"||m==="1"}}return{type:jt,values:u}}if(s){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:Ie(f,{truncate:!1})}return{type:vt,values:u}}if(i){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:j(f,{allowNonFiniteNumbers:!0})}return{type:Ft,values:u}}if(a){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:J(f)}return{type:Bt,values:u}}return{type:_t,values:u}}var bs=R(()=>{"use strict";dn();kt();Ve();Ne();ye()});function ws(n,e){return e==="us"?n*1e3:e==="ns"?n*1e6:n}var As=R(()=>{"use strict"});var z=R(()=>{"use strict";ye();Ve();dn();hn();Ct();kt();bs();Tr();As()});function H(n,e,t,r=""){if(!(n in e))throw new Me(n,`${t} "${n}" does not exist${r}`)}function Vn(n,e){let t=Object.keys(n),r=t.length,o=e;for(let i=0;i<r;i++){let s=t[i],a=n[s],l=k(a)?a.length:0;if(o===void 0)o=l;else if(l!==o)throw new re(`Column height mismatch: Column "${s}" has length ${l}, but DataFrame height is ${o}`)}return o===void 0?0:o}function Pt(n,e="Value cannot be null or undefined"){if(n==null)throw new M(e);return n}function xl(n,e){if(!n)throw new M(e)}var Ss=R(()=>{"use strict";X();z()});var Ue,q,Me,Je,ne,re,M,Re,X=R(()=>{"use strict";Ss();Ue=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},q=class extends Ue{},Me=class extends q{constructor(e,t){super(t||`Column "${e}" does not exist in the DataFrame.`)}},Je=class extends Ue{},ne=class extends Ue{},re=class extends Ue{},M=class extends Ue{},Re=class extends Ue{}});function bl(n,e,t){let r=new Map,o=t.length,i=new Array(o);for(let s=0;s<o;s++){let a=t[s];typeof a=="string"?(H(a,n,"Partition key"," in the DataFrame."),i[s]=n[a]):i[s]=a.evaluate(n,e)}if(o===1){let s=i[0];for(let a=0;a<e;a++){let l=s[a],u=l==null?"":G(l),c=r.get(u);c===void 0&&(c=[],r.set(u,c)),c.push(a)}return r}for(let s=0;s<e;s++){let a=new Array(o);for(let c=0;c<o;c++){let f=i[c][s];a[c]=f==null?"":G(f)}let l=a.join(ut),u=r.get(l);u===void 0&&(u=[],r.set(l,u)),u.push(s)}return r}function Hr(n,e,t){let r=new Array(t);if(t===0)return r;let o=n._partitionBy||[],i=bl(e,t,o),s=n._evaluatePre(n._partitionOpsIndex,e,t);for(let a of i.values()){let l=a.length,u=new Array(l);for(let c=0;c<l;c++)u[c]=s[a[c]];if(n._evaluateWindow){for(let c=0;c<l;c++)r[a[c]]=n._evaluateWindow(u,a,c);continue}if(n._aggFn){let c=n._aggFn(u);for(let f=0;f<l;f++)r[a[f]]=c;continue}for(let c=0;c<l;c++)r[a[c]]=s[a[c]]}return n._evaluatePost(n._partitionOpsIndex,r,e)}function Yr(n){if(!Array.isArray(n)||n.length===0)return{columns:{},height:0};let e=n.length,t=new Set;for(let i=0;i<e;i++){let s=n[i];if(F(s)){let a=Object.keys(s);for(let l=0;l<a.length;l++)t.add(a[l])}}let r=Array.from(t),o={};for(let i=0;i<r.length;i++)o[r[i]]=new Array(e);for(let i=0;i<e;i++){let s=n[i]||{};for(let a=0;a<r.length;a++){let l=r[a],u=s[l];o[l][i]=u===void 0?null:u}}return{columns:o,height:e}}function Zr(n,e){let t=Object.keys(n),r=new Array(e);for(let o=0;o<e;o++){let i={};for(let s=0;s<t.length;s++){let a=t[s],l=n[a][o];i[a]=l===void 0?null:l}r[o]=i}return r}function wl(n,e,t){let r={};for(let o=0;o<t.length;o++){let i=t[o],s=n[i][e];r[i]=s===void 0?null:s}return r}function Fe(n){if(n.length===0)return E.Utf8;let e=!0,t=!0,r=!0,o=!0,i=!0,s=!0,a=!0,l=!0,u=!1,c=!1,f=[];for(let m=0;m<n.length;m++){let h=n[m];if(h!=null){if(c=!0,h instanceof Uint8Array||(a=!1),!k(h)||h instanceof Uint8Array)s=!1;else{let p=h,d=p.length;for(let g=0;g<d;g++)f.push(p[g])}P(h)&&(u=!0),typeof h!="boolean"&&(e=!1),typeof h!="bigint"&&(o=!1),typeof h!="number"?(r=!1,t=!1):Number.isInteger(h)||(t=!1),!P(h)&&(typeof h!="string"||isNaN(Date.parse(h)))&&(i=!1),(!F(h)||h instanceof Uint8Array)&&(l=!1)}}if(!c)return E.Null;if(a)return E.Binary;if(s){let m=Fe(f);return E.Array(m)}if(e)return E.Boolean;if(o)return E.Int64;if(r&&!t)return E.Float64;if(r&&t){let m=!0;for(let h=0;h<n.length;h++){let p=n[h];if(p!=null&&(p<-2147483648||p>2147483647)){m=!1;break}}return m?E.Int32:E.Float64}return i&&u?E.Datetime:l?E.Object:E.Utf8}function bt(n,e){let t=Object.keys(n),r=t.length,o=e.length,i={};for(let s=0;s<r;s++){let a=t[s],l=n[a],u=K(l)?new l.constructor(o):new Array(o);for(let c=0;c<o;c++)u[c]=l[e[c]];i[a]=u}return i}function ve(n,e,t){let r=e.length;if(r===1)return G(n[e[0]][t]);let o=new Array(r);for(let i=0;i<r;i++)o[i]=G(n[e[i]][t]);return o.join(ut)}function Se(n,e,t){let r=e.allocate?e.allocate(t):new Array(t);if(K(r)){let i=r;for(let s=0;s<t;s++){let a=e.coerce(n[s]);if(a==null){let l=new Array(t);for(let u=0;u<s;u++)l[u]=i[u];l[s]=null;for(let u=s+1;u<t;u++)l[u]=e.coerce(n[u]);return l}i[s]=a}}else for(let i=0;i<t;i++)r[i]=e.coerce(n[i]);return r}function Qr(n,e){if(n)if(typeof n=="string"){if(typeof require!="function")throw new Re("File writing is not supported in this environment (missing require('fs')).");require("fs").writeFileSync(n,e,"utf8")}else if(F(n)&&typeof n.write=="function")n.write(e);else throw new M("Invalid file argument. Expected a file path string or a writable stream/object with a write method.")}function eo(n,e,t,r,o,i,s={}){let{how:a="inner",join_nulls:l=!1,maintain_order:u}=s,c=(w,D,O)=>{if(!l){for(let C=0;C<D.length;C++)if(w[D[C]][O]==null)return null}return ve(w,D,O)};if(a==="cross")return Ci(t,r);let f=new Map;for(let w=0;w<r;w++){let D=c(e,i,w);if(D===null)continue;let O=f.get(D);O===void 0&&(O=[],f.set(D,O)),O.push(w)}let m=[],h=[];if(a==="semi"||a==="anti"){for(let w=0;w<t;w++){let D=c(n,o,w),O=D===null?void 0:f.get(D),C=O!==void 0&&O.length>0;(a==="semi"&&C||a==="anti"&&!C)&&(m.push(w),h.push(null))}return{leftIndices:m,rightIndices:h}}let p=a==="outer"||a==="right",d=p?new Set:null;for(let w=0;w<t;w++){let D=c(n,o,w),O=D===null?void 0:f.get(D);if(O===void 0)(a==="left"||a==="outer")&&(m.push(w),h.push(null));else for(let C=0;C<O.length;C++){let N=O[C];p&&d.add(N),m.push(w),h.push(N)}}if(p)for(let w=0;w<r;w++)d.has(w)||(m.push(Et),h.push(w));let g=u||"none";if(g==="none"||g==="left")return{leftIndices:m,rightIndices:h};let y=m.length,_=new Int32Array(y);for(let w=0;w<y;w++)_[w]=w;let S=w=>m[w]===Et?Number.MAX_SAFE_INTEGER:m[w],b=w=>h[w]??Number.MAX_SAFE_INTEGER;g==="right"?_.sort((w,D)=>b(w)-b(D)||w-D):g==="left_right"?_.sort((w,D)=>S(w)-S(D)||b(w)-b(D)||w-D):g==="right_left"&&_.sort((w,D)=>b(w)-b(D)||S(w)-S(D)||w-D);let x=new Array(y),A=new Array(y);for(let w=0;w<y;w++){let D=_[w];x[w]=m[D],A[w]=h[D]}return{leftIndices:x,rightIndices:A}}function to(n,e,t,r,o,i,s,a,l={}){let u=l.strategy??"backward",c=l.allow_exact_matches??!0,f=l.check_sorted??!0;H(o,n,"Join on key"," in the left DataFrame."),H(i,e,"Join on key"," in the right DataFrame.");let m=n[o],h=e[i];if(f){let x=(A,w,D,O)=>{for(let C=1;C<w;C++){let N=j(A[C-1]),Y=j(A[C]);if(v(N)&&v(Y)&&Y<N)throw new M(`${O} DataFrame key column "${D}" is not sorted in ascending order at row ${C}.`)}};x(m,t,o,"left"),x(h,r,i,"right")}let p=s.length>0,d=new Map;if(p)for(let x=0;x<r;x++){let A=ve(e,a,x),w=d.get(A);w||(w=[],d.set(A,w)),w.push(x)}let g=new Array(r);if(!p)for(let x=0;x<r;x++)g[x]=x;let y=new Array(t),_=new Array(t),S=(x,A)=>{let w=A.length;if(w===0)return null;let D=(W,le)=>j(h[le])??NaN;if(u==="backward"){let W=mn(A,x,{side:c?"right":"left",getValue:D})-1;return W>=0?A[W]:null}if(u==="forward"){let W=mn(A,x,{side:c?"left":"right",getValue:D});return W<w?A[W]:null}let O=mn(A,x,{side:"right",getValue:D}),C=O-1,N=O;if(c||(C>=0&&D(C,A[C])===x&&C--,N<w&&D(N,A[N])===x&&N++),C<0)return N<w?A[N]:null;if(N>=w)return C>=0?A[C]:null;let Y=D(C,A[C]),Q=D(N,A[N]);return Math.abs(x-Y)<=Math.abs(x-Q)?A[C]:A[N]},b=l.tolerance!==void 0?j(l.tolerance):null;for(let x=0;x<t;x++){y[x]=x;let A=j(m[x]);if(!v(A)){_[x]=null;continue}let w=p?d.get(ve(n,s,x))||[]:g;if(w.length===0){_[x]=null;continue}let D=S(A,w);if(D!==null&&b!==null){let O=j(h[D]);(!v(b)||!v(O)||Math.abs(A-O)>b)&&(D=null)}_[x]=D}return{leftIndices:y,rightIndices:_}}function $n(n,e,t,r,o,i,s,a,l={}){let[u="",c="_right"]=l.suffixes||[],f=l.coalesce??!0,m=l.how||"inner",h=o.length,p={},d={},g=new Set(s),y=new Set(a),_=(D,O)=>{let C=O!==""?O:"_left",N=`${D}${C}`,Y=1;for(;x.has(N);)N=`${D}${C}_${Y++}`;return x.add(N),N},S=(D,O,C=Et)=>{let N=O.length,Y=new Array(N);for(let Q=0;Q<N;Q++){let W=O[Q];Y[Q]=W!==null&&W!==C?D[W]:null}return Y},b=new Map;for(let D=0;D<s.length;D++)b.has(s[D])||b.set(s[D],a[D]);let x=new Set,A=Object.keys(n),w=Object.keys(e);for(let D=0;D<A.length;D++){let O=A[D];(!(O in e)||g.has(O)||y.has(O))&&x.add(O)}for(let D=0;D<A.length;D++){let O=A[D],C=g.has(O),N;O in e&&!C&&!y.has(O)?u!==""?(x.add(O),N=_(O,u)):x.has(O)?N=_(O,u):(N=O,x.add(O)):N=O;let Y=n[O],Q=C?b.get(O):null,W=Q?e[Q]:null;if(C&&f){let le=new Array(h);for(let fe=0;fe<h;fe++){let Zt=o[fe],at=i[fe],Vs=Zt!==Et?Y[Zt]:null,$s=at!==null&&W?W[at]:null;le[fe]=Vs??$s}p[N]=le}else p[N]=S(Y,o);t[O]?d[N]=t[O]:Q&&r[Q]&&(d[N]=r[Q])}if(m!=="semi"&&m!=="anti")for(let D=0;D<w.length;D++){let O=w[D];if(f&&y.has(O))continue;let C;x.has(O)?C=_(O,c):(C=O,x.add(O)),p[C]=S(e[O],i),r[O]&&(d[C]=r[O])}return L._createDirect(p,d,h)}var Kn=R(()=>{"use strict";wt();Ne();xe();z();X()});function Ts(n,e){if(n==null)return null;let t=P(n)?n.getTime():n;return e(t)}function no(n,e,t){if(n==null||e==null)return null;let r=P(n)?n.getTime():n,o=P(e)?e.getTime():e;return t(r,o)}function pe(n,e,t){return n._isWindow?Hr(n,e,t):n.evaluate(e,t)}function nt(n,e,t){return typeof n=="object"&&n!==null&&"_ops"in n?pe(n,e||{},t):typeof n=="string"&&e!=null&&n in e?e[n]:n}function rt(n,e,t,r){return!k(e)||e.length!==r?!1:typeof n=="object"&&n!==null&&"_ops"in n||typeof n=="string"&&t!=null&&n in t}var I,V,ue=R(()=>{"use strict";z();ye();Kn();I=n=>e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=Ts(e[o],n);return r},V=(n,e,t)=>{let r=(o,i)=>{let s=o.length,a=n._resolve(e,i,s),l=new Array(s);if(k(a))for(let u=0;u<s;u++)l[u]=no(o[u],a[u],t);else for(let u=0;u<s;u++)l[u]=no(o[u],a,t);return l};return r._binaryMeta={left:n,right:e},r}});var T,$,ce=R(()=>{"use strict";X();ue();T=(n,e)=>{let t=n.constructor,r=n._colNames||n._colName||"",o=new t(r);return Object.assign(o,n),o._ops=e?[...n._ops,e]:[...n._ops],e&&e._binaryMeta&&(o._binaryMeta=e._binaryMeta),o},$=class n{_ops=[];_outputName="";_isLiteral;_literalValue;_aggFn=null;_castType;_binaryMeta;_groupingOpsIndex;_partitionOpsIndex;_partitionBy=null;_evaluateWindow;_baseExpr;_fieldName;_isUnnest;_evaluatePost(e,t,r){let o=this._ops,i=e!==void 0?e:o.length,s=t;for(let a=i;a<o.length;a++)s=o[a](s,r);return s}_evaluatePre(e,t,r){let o=this._getInitialValue(t,r),i=this._ops,s=e!==void 0?e:i.length;for(let a=0;a<s;a++)o=i[a](o,t);return o}_getInitialValue(e,t){let r=this._colName;if(r&&r!=="*"&&!r.startsWith("*")&&!(r in e))throw new Me(r);return(r&&r!=="*"?e[r]:null)||new Array(t).fill(null)}_resolve(e,t,r){return e instanceof n?e._isLiteral&&e._ops.length===1?e._literalValue:pe(e,t,r):e}alias(e){let t=T(this);return t._outputName=e,t}cast(e){let t=T(this,I(r=>e.coerce(r)));return t._castType=e,t}debug(e){return T(this,t=>(console.log(`[DEBUG] ${e?e+": ":""}`,t),t))}evaluate(e,t){return this._evaluatePre(void 0,e,t)}}});var Lt,ro=R(()=>{"use strict";ce();ue();z();Lt=class extends ${abs(){return T(this,I(Math.abs))}acos(){return T(this,I(e=>e<-1||e>1?null:Math.acos(e)))}acosh(){return T(this,I(e=>e<1?null:Math.acosh(e)))}add(e){return T(this,V(this,e,(t,r)=>t+r))}asin(){return T(this,I(e=>e<-1||e>1?null:Math.asin(e)))}asinh(){return T(this,I(Math.asinh))}atan(){return T(this,I(Math.atan))}atan2(e){return T(this,V(this,e,Math.atan2))}atanh(){return T(this,I(e=>e<=-1||e>=1?null:Math.atanh(e)))}cbrt(){return T(this,I(Math.cbrt))}ceil(){return T(this,I(Math.ceil))}clip(e=null,t=null){return T(this,I(r=>Ce(r,{min:e,max:t})))}copysign(e){return T(this,V(this,e,(t,r)=>Math.abs(t)*(r>=0?1:-1)))}cos(){return T(this,I(Math.cos))}cosh(){return T(this,I(Math.cosh))}degrees(){return T(this,I(e=>e*(180/Math.PI)))}div(e){return T(this,V(this,e,(t,r)=>r===0?null:t/r))}exp(){return T(this,I(Math.exp))}expm1(){return T(this,I(Math.expm1))}floor(){return T(this,I(Math.floor))}floordiv(e){return T(this,V(this,e,(t,r)=>r===0?null:Math.floor(t/r)))}hypot(e){return T(this,V(this,e,Math.hypot))}log(e=Math.E){return T(this,I(t=>t<=0?null:e===Math.E?Math.log(t):Math.log(t)/Math.log(e)))}log1p(){return T(this,I(e=>e<=-1?null:Math.log1p(e)))}mod(e){return T(this,V(this,e,(t,r)=>r===0?null:t%r))}mul(e){return T(this,V(this,e,(t,r)=>t*r))}negate(){return T(this,I(e=>-e))}pow(e){return T(this,V(this,e,Math.pow))}radians(){return T(this,I(e=>e*(Math.PI/180)))}rand(e,{min:t=0,max:r=1,integer:o=!1}={}){return T(this,i=>{let s=i.length,a=new Float64Array(s),l=e!==void 0?bi(e):Math.random,u=r-t;for(let c=0;c<s;c++){let f=l();a[c]=o?Math.floor(f*(u+1))+t:f*u+t}return a})}round(e=0){return T(this,I(t=>xr(t,e)))}round_sig_figs(e){return T(this,I(t=>v(t)?Number(t.toPrecision(e)):t))}sign(){return T(this,I(Math.sign))}sin(){return T(this,I(Math.sin))}sinh(){return T(this,I(Math.sinh))}sqrt(){return T(this,I(e=>e<0?null:Math.sqrt(e)))}sub(e){return T(this,V(this,e,(t,r)=>t-r))}tan(){return T(this,I(Math.tan))}tanh(){return T(this,I(Math.tanh))}trunc(){return T(this,I(Math.trunc))}}});var Vt,oo=R(()=>{"use strict";ce();ue();z();Vt=class extends ${and(e){return T(this,(t,r)=>{let o=t.length,i=this._resolve(e,r,o),s=k(i),a=new Array(o);for(let l=0;l<o;l++){let u=t[l],c=s?i[l]:i;u===!1||c===!1?a[l]=!1:u==null||c==null?a[l]=null:a[l]=!0}return a})}not(){return T(this,I(e=>!e))}or(e){return T(this,(t,r)=>{let o=t.length,i=this._resolve(e,r,o),s=k(i),a=new Array(o);for(let l=0;l<o;l++){let u=t[l],c=s?i[l]:i;u===!0||c===!0?a[l]=!0:u==null||c==null?a[l]=null:a[l]=!1}return a})}xor(e){return T(this,V(this,e,(t,r)=>!!t!=!!r))}}});function Ds(n,e,t,r){let o=n.length,i=new Array(o);if(t&&typeof t=="object"&&"evaluate"in t){let s=t.evaluate(e,o);for(let a=0;a<o;a++){let l=n[a];if(l==null)i[a]=null;else{let u=s[a],c=new Set;if(k(u)){let m=u.length;for(let h=0;h<m;h++)c.add(G(u[h]))}else c.add(G(u));let f=c.has(G(l));i[a]=r?!f:f}}}else{let s=k(t)?t:[],a=new Set,l=s.length;for(let u=0;u<l;u++)a.add(G(s[u]));for(let u=0;u<o;u++){let c=n[u];if(c==null)i[u]=null;else{let f=a.has(G(c));i[u]=r?!f:f}}}return i}function Os(n,e){let{frequencies:t}=Ke(n,{strict:!0}),r=n.length,o=new Array(r);for(let i=0;i<r;i++){let s=t.get(n[i])||0;o[i]=e?s>1:s===1}return o}function Es(n,e,t){let r=n.length,o=new Array(r);if(k(e))for(let i=0;i<r;i++){let s=n[i],a=e[i];s==null&&a==null?o[i]=!t:s==null||a==null?o[i]=t:o[i]=t?s!==a:s===a}else for(let i=0;i<r;i++){let s=n[i];s==null&&e==null?o[i]=!t:s==null||e==null?o[i]=t:o[i]=t?s!==e:s===e}return o}var $t,io=R(()=>{"use strict";ce();ue();z();$t=class extends ${between(e,t,r="both"){return T(this,(o,i)=>{let s=o.length,a=this._resolve(e,i,s),l=this._resolve(t,i,s),u=new Array(s),c=k(a),f=k(l);for(let m=0;m<s;m++){let h=o[m],p=c?a[m]:a,d=f?l[m]:l;if(h==null||p==null||d==null)u[m]=null;else{let g=r==="both"||r==="left"?h>=p:h>p,y=r==="both"||r==="right"?h<=d:h<d;u[m]=g&&y}}return u})}eq(e){return T(this,V(this,e,(t,r)=>t===r))}eq_missing(e){return T(this,(t,r)=>{let o=this._resolve(e,r,t.length);return Es(t,o,!1)})}ge(e){return T(this,V(this,e,(t,r)=>t>=r))}gt(e){return T(this,V(this,e,(t,r)=>t>r))}has_nulls(){return this._deriveAgg(e=>{for(let t=0;t<e.length;t++)if(e[t]==null)return!0;return!1})}is_close(e,{abs_tol:t=1e-8,rel_tol:r=1e-8,nans_equal:o=!1}={}){return T(this,(i,s)=>{let a=i.length,l=this._resolve(e,s,a),u=k(l),c=new Array(a);for(let f=0;f<a;f++){let m=i[f],h=u?l[f]:l;if(m==null||h==null)c[f]=null;else if(v(m)&&v(h)){let p=Math.abs(m-h),d=Math.max(r*Math.max(Math.abs(m),Math.abs(h)),t);c[f]=p<=d}else Number.isNaN(m)&&Number.isNaN(h)?c[f]=o:c[f]=m===h}return c})}is_duplicated(){return T(this,e=>Os(e,!0))}is_empty({ignoreNulls:e=!1}={}){return T(this,I(t=>typeof t=="string"?t.length===0:k(t)?e?ee(t,"nullish",{mode:"every"}):t.length===0:null))}is_finite(){return T(this,I(Number.isFinite))}is_in(e){return T(this,(t,r)=>Ds(t,r,e,!1))}is_infinite(){return T(this,I(e=>e===1/0||e===-1/0))}is_nan(){return T(this,I(Number.isNaN))}is_not_nan(){return T(this,I(e=>!Number.isNaN(e)))}is_not_null(){return T(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]!=null;return r})}is_null(){return T(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]==null;return r})}is_unique(){return T(this,e=>Os(e,!1))}le(e){return T(this,V(this,e,(t,r)=>t<=r))}lt(e){return T(this,V(this,e,(t,r)=>t<r))}ne(e){return T(this,V(this,e,(t,r)=>t!==r))}ne_missing(e){return T(this,(t,r)=>{let o=this._resolve(e,r,t.length);return Es(t,o,!0)})}not_in(e){return T(this,(t,r)=>Ds(t,r,e,!0))}}});var qn,Kt,so=R(()=>{"use strict";ce();ue();xe();z();qn=class{constructor(e){this.expr=e}expr;_deriveString(e){return T(this.expr,I(t=>e(String(t))))}_patternGuard(e,t){return e==null?T(this.expr,r=>new Array(r.length).fill(null)):t()}_matchPattern(e,t){return t==null?!1:ge(t)?(t.lastIndex=0,t.test(e)):e.includes(t)}concat(e){return T(this.expr,V(this.expr,e,(t,r)=>String(t)+String(r)))}contains(e){return this._patternGuard(e,()=>this._deriveString(t=>this._matchPattern(t,e)))}contains_any(e){return this._patternGuard(e,()=>{let t=Array.isArray(e)?e:[e];return this._deriveString(r=>{let o=t.length;for(let i=0;i<o;i++)if(this._matchPattern(r,t[i]))return!0;return!1})})}count_matches(e,t={}){let r=typeof t=="boolean"?t:t?.literal??!1;return this._patternGuard(e,()=>this._deriveString(o=>{let i=r?de(e):e,s=pt(o,i,{global:!0});if(!s)return 0;let a=s.input.match(s.reg);return a?a.length:0}))}escape_regex(e={}){return this._deriveString(t=>de(t,e))}decode(e){return this._deriveString(t=>Ji(t,e.encoding,e))}encode(e){return this._deriveString(t=>Gi(t,e.encoding))}decode_uri_component(){return this._deriveString(e=>{try{return decodeURIComponent(e)}catch{return e}})}encode_uri_component(){return this._deriveString(e=>{try{return encodeURIComponent(e)}catch{return e}})}ends_with(e){return this._deriveString(t=>t.endsWith(e))}explode(){return this._deriveString(e=>e.split(""))}extract(e,t){return this._patternGuard(e,()=>this._deriveString(r=>Or(r,e,t)))}extract_all(e,t){return this._patternGuard(e,()=>this._deriveString(r=>Yi(r,e,t)??[]))}extract_groups(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>Zi(r,e,t)))}extract_many(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>Qi(r,e,t)))}find(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>_n(r,e,t)))}find_many(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>es(r,e,t)))}head(e=1){return this.slice(0,e)}join(e="",t={}){return T(this.expr,I(r=>{let o=be(r);return o==null?null:un(o,e,t)}))}json_decode(e={}){return this._deriveString(t=>Rt(t,e))}json_path_match(e){return this._deriveString(t=>Pi(t,e))}len(){return this.len_chars()}len_bytes(){return this._deriveString(e=>Oe.encode(e).length)}len_chars(){return this._deriveString(e=>e.length)}lower(){return this._deriveString(e=>e.toLowerCase())}lpad(e,t=" "){return this._deriveString(r=>r.padStart(e,t))}normalize(e){return this._deriveString(t=>t.normalize(e))}pad_end(e,t=" "){return this.rpad(e,t)}pad_start(e,t=" "){return this.lpad(e,t)}replace(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>Er(o,e,t,{n:1,...r})??o))}replace_all(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>Er(o,e,t,{...r,n:-1})??o))}replace_many(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>rs(o,e,t,r)??o))}reverse(){return this._deriveString(e=>e.split("").reverse().join(""))}rpad(e,t=" "){return this._deriveString(r=>r.padEnd(e,t))}slice(e,t){return this._deriveString(r=>{let o=e<0?r.length+e:e,i=t!==void 0?o+t:void 0;return r.slice(o,i)})}split(e,t){return this._deriveString(r=>ts(r,e,t))}starts_with(e){return this._deriveString(t=>t.startsWith(e))}strip_chars(e,t){return this._deriveString(r=>ft(r,e,{mode:"both",...t}))}strip_chars_end(e,t){return this._deriveString(r=>ft(r,e,{mode:"end",...t}))}strip_chars_start(e,t){return this._deriveString(r=>ft(r,e,{mode:"start",...t}))}strip_prefix(e){return this._deriveString(t=>ft(t,e,{mode:"start",maxScanStart:1,maxMatchesStart:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}strip_suffix(e){return this._deriveString(t=>ft(t,e,{mode:"end",maxScanEnd:1,maxMatchesEnd:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}tail(e=1){return this.slice(-e)}strptime(e){return this._deriveString(t=>hs(t,e))}to_camelcase(){return this._deriveString(e=>mt(e,{format:"camel"}))}to_date(){return this._deriveString(e=>J(e,{dateOnly:!0}))}to_datetime(){return this._deriveString(J)}to_decimal(e,t){return this._deriveString(r=>sn(r,{precision:e,scale:t}))}to_integer(){return this._deriveString(e=>se(e))}to_kebabcase(){return this._deriveString(e=>mt(e,{format:"kebab"}))}to_lowercase(){return this.lower()}to_pascalcase(){return this._deriveString(e=>mt(e,{format:"pascal"}))}to_snakecase(){return this._deriveString(e=>mt(e,{format:"snake"}))}to_time(){return this._deriveString(wn)}to_titlecase(){return this._deriveString(e=>mt(e,{format:"title"}))}to_uppercase(){return this.upper()}trim(){return this.strip_chars()}trim_end(){return this.strip_chars_end()}trim_start(){return this.strip_chars_start()}upper(){return this._deriveString(e=>e.toUpperCase())}zfill(e){return this._deriveString(t=>t.padStart(e,"0"))}},Kt=class extends ${get str(){return new qn(this)}}});var qt,ao=R(()=>{"use strict";ce();ue();X();z();qt=class extends ${_deriveAgg(e){let t=T(this);return t._aggFn=e,t._groupingOpsIndex=this._ops.length,t._partitionOpsIndex=this._ops.length,t}_deriveAggBinary(e,t){return T(this,V(this,e,(r,o)=>[r,o]))._deriveAgg(t)}all(){return this._deriveAgg(e=>ee(e,t=>!!t,{mode:"every"}))}all_null(){return this._deriveAgg(e=>ee(e,"nullish",{mode:"every"}))}any(){return this._deriveAgg(e=>ee(e,t=>!!t,{mode:"some"}))}any_null(){return this._deriveAgg(e=>ee(e,"nullish",{mode:"some"}))}arg_max(){return this._deriveAgg(e=>B(e).maxIdx)}arg_min(){return this._deriveAgg(e=>B(e).minIdx)}avg(){return this._deriveAgg(e=>B(e).mean)}bitwise_and(){return this._deriveAgg(e=>pn(e,(t,r)=>t&r))}bitwise_or(){return this._deriveAgg(e=>pn(e,(t,r)=>t|r))}bitwise_xor(){return this._deriveAgg(e=>pn(e,(t,r)=>t^r))}corr(e){return this._deriveAggBinary(e,t=>br(t)?.correlation??null)}count(e={}){return e.includeNulls?this._deriveAgg(t=>t.length):this._deriveAgg(t=>B(t).count)}cov(e){return this._deriveAggBinary(e,t=>br(t)?.covariance??null)}dot(e){return this._deriveAggBinary(e,t=>Ei(t))}entropy(e={base:Math.E,normalize:!0}){return this._deriveAgg(t=>Mi(t,e))}first(){return this._deriveAgg(e=>e[0]??null)}implode(){return this._deriveAgg(e=>e)}kurtosis(e={}){return this._deriveAgg(t=>Ni(t,e))}last(){return this._deriveAgg(e=>e[e.length-1]??null)}max(){return this._deriveAgg(e=>B(e).max)}max_by(e){return this._deriveAggBinary(e,t=>wr(t,"maxIdx"))}mean(){return this.avg()}median(){return this._deriveAgg(e=>ct(e))}min(){return this._deriveAgg(e=>B(e).min)}min_by(e){return this._deriveAggBinary(e,t=>wr(t,"minIdx"))}mode(){return this._deriveAgg(e=>fn(e))}n_unique(e={}){return this._deriveAgg(t=>Ke(t,e).count)}nan_max(){return this._deriveAgg(e=>B(e).nanMax)}nan_min(){return this._deriveAgg(e=>B(e).nanMin)}null_count(){return this._deriveAgg(e=>B(e).nullCount)}quantile(e){if(e<0||e>1)throw new ne("Quantile q must be between 0 and 1");return this._deriveAgg(t=>cn(t,e))}product(){return this._deriveAgg(e=>B(e).product)}skew(e={}){return this._deriveAgg(t=>ki(t,e))}spearman_corr(e){return this._deriveAggBinary(e,t=>Oi(t))}std(){return this._deriveAgg(e=>B(e).std)}sum(){return this._deriveAgg(e=>B(e).sum)}variance(){return this._deriveAgg(e=>B(e).variance)}w_avg(e){return this._deriveAggBinary(e,t=>Ii(t))}}});function lo(n,e,t={}){if(e==null)return null;let r=t.dense?"_denseRankCache":"_rankCache",o=n[r];if(!o){let i=n;if(t.ignoreNulls){i=[];let l=n.length;for(let u=0;u<l;u++)n[u]!=null&&i.push(n[u])}t.dense&&(i=Array.from(new Set(i)));let s=It(i);o=new Map;let a=s.length;for(let l=0;l<a;l++){let u=s[l];o.has(u)||o.set(u,l+1)}n[r]=o}return o.get(e)??null}var zt,uo=R(()=>{"use strict";ce();z();zt=class extends ${_partitionBy=this._partitionBy||null;_window(e){let t=T(this);return t._partitionOpsIndex=this._ops.length,t._groupingOpsIndex=this._ops.length,t._evaluateWindow=e,t}_rolling(e,t){return this._window(function(r,o,i){let s=Math.max(0,i-e+1),a=i+1,l=r.slice(s,a);return t(l)})}_cum(e,t,r,o){return this._window(function(i,s,a){let l=t,u=!1,c=e?a:0,f=e?i.length-1:a;for(let m=c;m<=f;m++){let h=i[m];h!=null&&(l=r(l,h),u=!0)}return o?o(l,u):l})}get _isWindow(){return this._partitionBy!==null||this._evaluateWindow!==void 0||this._aggFn!==null}cum_count(e=!1){return this._cum(e,0,t=>t+1)}cum_max(e=!1){return this._cum(e,null,(t,r)=>t===null||r>t?r:t)}cum_min(e=!1){return this._cum(e,null,(t,r)=>t===null||r<t?r:t)}cum_prod(e=!1){return this._cum(e,1,(t,r)=>t*r,(t,r)=>r?t:null)}cum_sum(e=!1){return this._cum(e,0,(t,r)=>t+r)}dense_rank(){return this._window(function(e,t,r){return lo(e,e[r],{dense:!0})})}lag(e=1,t=null){return this._window(function(r,o,i){let s=t;return i-e>=0&&(s=r[i-e]),s})}lead(e=1,t=null){return this._window(function(r,o,i){let s=t;return i+e<r.length&&(s=r[i+e]),s})}over(e){let t=T(this),r=Array.isArray(e)?e:[e];return t._partitionBy=r,t}rank(){return this._window(function(e,t,r){return lo(e,e[r])})}rolling_max(e){return this._rolling(e,t=>B(t).max)}rolling_mean(e){return this._rolling(e,t=>B(t).mean)}rolling_median(e){return this._rolling(e,t=>ct(t))}rolling_min(e){return this._rolling(e,t=>B(t).min)}rolling_quantile(e,t){return this._rolling(t,r=>cn(r,e))}rolling_rank(e){return this._rolling(e,t=>lo(t,t[t.length-1],{ignoreNulls:!0}))}rolling_std(e){return this._rolling(e,t=>B(t).std)}rolling_sum(e){return this._rolling(e,t=>B(t).sum)}row_number(){let e=this._window(function(t,r,o){return o+1});return e._outputName="row_number",e}}});var zn,Gt,co=R(()=>{"use strict";ce();ue();z();Te();X();zn=class{constructor(e){this.expr=e}expr;_deriveArray(e){return T(this.expr,I(t=>k(t)?e(t):null))}agg(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=t[a];if(!k(l)){i[a]=null;continue}let u=l.length;s[We]=l;let c=pe(e,s,u);i[a]=k(c)?c[0]??null:c}return i})}all(){return this._deriveArray(e=>ee(e,t=>!!t,{mode:"every"}))}any(){return this._deriveArray(e=>ee(e,t=>!!t,{mode:"some"}))}arg_max(){return this._deriveArray(e=>B(e).maxIdx)}arg_min(){return this._deriveArray(e=>B(e).minIdx)}contains(e){return this._deriveArray(t=>Array.prototype.includes.call(t,e))}contains_all(e){return this._deriveArray(t=>ee(e,r=>Array.prototype.includes.call(t,r),{mode:"every"}))}contains_any(e){return this._deriveArray(t=>ee(e,r=>Array.prototype.includes.call(t,r),{mode:"some"}))}count_matches(e,t={}){return this._deriveArray(r=>Ke(r,t).frequencies.get(e)??0)}filter(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=t[a];if(!k(l)){i[a]=null;continue}let u=l.length;s[We]=l;let c=pe(e,s,u),f=[];if(k(c)){let m=Math.min(u,c.length);for(let h=0;h<m;h++)c[h]&&f.push(l[h])}else if(c)for(let m=0;m<u;m++)f.push(l[m]);i[a]=f}return i})}explode({empty_as_null:e=!0,keep_nulls:t=!0}={}){return T(this.expr,r=>{let o=r.length,i=0;for(let u=0;u<o;u++){let c=r[u];if(k(c)){i+=c.length||(e?1:0);continue}if(c!=null){i+=1;continue}t&&(i+=1)}let s=new Array(i),a=new Int32Array(i),l=0;for(let u=0;u<o;u++){let c=r[u];if(k(c)){let f=c.length;if(f>0){for(let m=0;m<f;m++)a[l]=u,s[l++]=c[m];continue}e&&(a[l]=u,s[l++]=null);continue}if(c!=null){a[l]=u,s[l++]=c;continue}t&&(a[l]=u,s[l++]=null)}return s.rowMap=a,s})}first(e=!0){return this.get(0,e)}gather(e,t=!0){return this._deriveArray(r=>{let o=typeof e=="number"?[e]:e,i=o.length,s=new Array(i);for(let a=0;a<i;a++)s[a]=an(r,o[a],t);return s})}gather_every(e={}){return this._deriveArray(t=>ln(t,e))}get(e,t=!0){return this._deriveArray(r=>an(r,e,t))}join(e=",",t={}){return this._deriveArray(r=>un(r,e,t))}last(e=!0){return this.get(-1,e)}len(){return this.lengths()}lengths(){return this._deriveArray(e=>e.length)}max(){return this._deriveArray(e=>B(e).max)}mean(){return this._deriveArray(e=>B(e).mean)}median(){return this._deriveArray(e=>ct(e))}min(){return this._deriveArray(e=>B(e).min)}mode(){return this._deriveArray(e=>fn(e))}n_unique(e={}){return this._deriveArray(t=>Ke(t,e).count)}reverse(){return this._deriveArray(e=>e.slice().reverse())}shift(e=1){return this._deriveArray(t=>Di(t,e))}slice(e,t){return this._deriveArray(r=>r.slice(e,t))}splice(e,t,...r){return this._deriveArray(o=>{let i=[...o];return i.splice(e,t??i.length,...r),i})}sort(e){return this._deriveArray(t=>It(t,e))}std(){return this._deriveArray(e=>B(e).std)}sum(){return this._deriveArray(e=>B(e).sum)}to_struct({upper_bound:e,fields:t}={}){return T(this.expr,r=>{let o=r.length,i=new Array(o),s=0;if(Array.isArray(t))s=t.length;else if(typeof e=="number")s=e;else for(let l=0;l<o;l++){let u=r[l];k(u)&&u.length>s&&(s=u.length)}if(s===0)throw new ne("to_struct cannot be evaluated: struct width is 0. Provide an upper_bound, non-empty fields names, or non-empty lists.");let a=new Array(s);for(let l=0;l<s;l++)typeof t=="function"?a[l]=t(l):a[l]=(Array.isArray(t)?t[l]:null)??`field_${l}`;for(let l=0;l<o;l++){let u=r[l];if(!k(u)){i[l]=null;continue}let c={};for(let f=0;f<s;f++)c[a[f]]=an(u,f,!0);i[l]=c}return i})}unique(e={}){return this._deriveArray(t=>Ke(t,e).values)}variance(){return this._deriveArray(e=>B(e).variance)}eval(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o);for(let s=0;s<o;s++){let a=t[s];if(!k(a)){i[s]=null;continue}let l=a.length,u={...r,[We]:a};if(e._aggFn!=null&&(e._partitionBy==null||e._partitionBy.length===0)){let f=e._groupingOpsIndex!==void 0?e._groupingOpsIndex:e._ops.length,m=e._evaluatePre(f,u,l),h=e._aggFn(Array.from(m));i[s]=e._evaluatePost(f,[h],u)}else i[s]=pe(e,u,l)}return i})}},Gt=class extends ${get arr(){return new zn(this)}}});function Is(n){return Pt(n,"Column reference cannot be null or undefined."),Gn||(Gn=(he(),or(Cs)).ColumnExpr),Gn.isColExpr(n)?n:new Gn(n)}var Gn,Jn,Jt,fo=R(()=>{"use strict";ce();X();Gn=null;Jn=class{constructor(e){this.expr=e;return new Proxy(this,{get(t,r,o){return r in t?Reflect.get(t,r,o):typeof r=="string"?t.field(r):Reflect.get(t,r,o)}})}expr;field(e){let t=T(this.expr,r=>{let o=r.length,i=new Array(o);for(let s=0;s<o;s++){let a=r[s];i[s]=a!=null&&typeof a=="object"?a[e]:null}return i});return t._baseExpr=this.expr,t._fieldName=e,t.alias(e)}rename_fields(e){return T(this.expr,t=>{let r=t.length,o=new Array(r),i=Object.keys(e),s=i.length;for(let a=0;a<r;a++){let l=t[a];if(l==null||typeof l!="object"){o[a]=null;continue}let u={},c=Object.keys(l),f=c.length;for(let m=0;m<f;m++){let h=c[m];u[h]=l[h]}for(let m=0;m<s;m++){let h=i[m];if(h in u){let p=e[h];u[p]=u[h],delete u[h]}}o[a]=u}return o})}with_fields(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=[];if(Array.isArray(e)){let u=e.length;for(let c=0;c<u;c++){let f=e[c],m=Is(f),h=m._outputName||m._colName;if(!h)throw new M("Expressions passed to struct.with_fields must have a name/alias.");s.push({name:h,expr:m})}}else if(e&&typeof e=="object"){let u=Object.keys(e),c=u.length;for(let f=0;f<c;f++){let m=u[f],h=Is(e[m]);s.push({name:m,expr:h})}}let a=s.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=s[u].expr.evaluate(r,o);for(let u=0;u<o;u++){let c=t[u];if(c==null||typeof c!="object"){i[u]=null;continue}let f={},m=Object.keys(c),h=m.length;for(let p=0;p<h;p++){let d=m[p];f[d]=c[d]}for(let p=0;p<a;p++)f[s[p].name]=l[p][u];i[u]=f}return i})}unnest(){let e=T(this.expr);return e._isUnnest=!0,e._baseExpr=this.expr,e}},Jt=class extends ${get struct(){return new Jn(this)}}});var Wn,Rs=R(()=>{"use strict";ce();z();X();Wn=class extends ${fill_null({value:e=void 0,strategy:t=void 0,limit:r=void 0}={}){return T(this,(o,i)=>{let s=o.length,a=Array.from(o);if(t!==void 0)if(t==="zero"||t==="one"||t==="min"||t==="max"||t==="mean"){let l;t==="zero"?l=0:t==="one"?l=1:l=B(o)[t],Xe(a,l,{mode:"constant",condition:u=>u==null})}else if(t==="forward"||t==="backward"){let l=t==="forward",u=null,c=0;Xe(a,null,{mode:"independent",reverse:!l,step:({originalValue:f})=>f!=null?(u=f,c=0,f):u!==null&&(r===void 0||c<r)?(c++,u):null})}else throw new M(`Unsupported fill_null strategy: "${t}"`);else{let l=this._resolve(e,i,s),u=k(l);Xe(a,null,{mode:"independent",step:({index:c,originalValue:f})=>f??(u?l[c]:l)})}return a})}reverse(){return T(this,e=>e.slice().reverse())}}});var Cs={};rr(Cs,{ColumnExpr:()=>U,resolveColumnSelectors:()=>je});function Al(n,e){for(let t of e)for(let r of Object.getOwnPropertyNames(t.prototype))r!=="constructor"&&Object.defineProperty(n.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r)||Object.create(null))}function Sl(n,e,t,r){if(!(n instanceof U)){if(F(n)&&"evaluate"in n&&!n._colName){let o=[];for(let i=0;i<e.length;i++)t.has(e[i])||o.push(e[i]);return o}return null}if(n._colNames&&n._colNames.length>0)return n._colNames;if(n._colName==="*"){let o=new Set(n._excludedCols),i=[];for(let s=0;s<e.length;s++){let a=e[s];!o.has(a)&&!t.has(a)&&i.push(a)}return i}if(n._targetType||n._targetTypes&&n._targetTypes.length>0){if(!r)throw new Je("Cannot resolve DataType column selector without DataFrame schema.");let o=[];for(let i=0;i<e.length;i++){let s=e[i];if(t.has(s))continue;let a=r[s];if(a){if(n._targetType)a.matches(n._targetType)&&o.push(s);else if(n._targetTypes){for(let l=0;l<n._targetTypes.length;l++)if(a.matches(n._targetTypes[l])){o.push(s);break}}}}return o}return null}function je(n,e,t,r,o){let i=[],s=t?new Set(t):new Set;for(let a=0;a<n.length;a++){let l=n[a];if(typeof l=="string"){i.push(new U(l));continue}if(F(l)&&l._isUnnest&&l._baseExpr){let c=l._baseExpr,f=[],m=l._colName;if(typeof m=="string"&&r&&r[m]&&r[m].name==="Struct"&&(f=Object.keys(r[m].fields)),f.length===0&&o){let d=Object.keys(o)[0],g=d?o[d].length:0,y=c.evaluate(o,g),_=y.length;for(let S=0;S<_;S++){let b=y[S];if(b!=null&&typeof b=="object"){f=Object.keys(b);break}}}let h=f.length;if(h>0){for(let p=0;p<h;p++){let d=f[p],g=c.struct.field(d);i.push(g)}continue}}let u=Sl(l,e,s,r);if(u!==null)for(let c=0;c<u.length;c++){let f=new U(u[c]);f._ops=[...l._ops||[]],f._aggFn=l._aggFn,f._partitionOpsIndex=l._partitionOpsIndex,f._groupingOpsIndex=l._groupingOpsIndex,f._partitionBy=l._partitionBy,l._evaluateWindow&&(f._evaluateWindow=l._evaluateWindow),l._outputName&&l._outputName!=="*"&&(f._outputName=l._outputName),i.push(f)}else i.push(l)}return i}var U,he=R(()=>{"use strict";ce();ro();io();ao();uo();so();oo();mo();co();fo();Rs();z();Ne();X();U=class n extends ${_colName="";_colNames;_excludedCols=[];_targetType;_targetTypes;static isColExpr(e){if(!F(e))return!1;try{return"evaluate"in e&&typeof e.evaluate=="function"}catch{return!1}}static toColExpr(e){return Pt(e,"Column reference cannot be null or undefined."),n.isColExpr(e)?e:new n(e)}constructor(e){super(),Array.isArray(e)?e.some(r=>r instanceof Z||typeof r=="function")?this._targetTypes=e:this._colNames=e.map(String):e instanceof Z||typeof e=="function"?this._targetType=e:(this._colName=String(e),this._outputName=this._colName)}};Al(U,[Lt,$t,qt,zt,Kt,Vt,Wt,Gt,Jt,Wn])});function ot(n,e={strict:!0}){let t=e,r=new U(ir);return r._literalValue=n,t.name&&(r._outputName=t.name),r._ops.push(o=>{let i=o.length,s=(x,A)=>x===void 0?A:Ce(x<0?i+x:x,{min:0,max:i}),a=s(t.startIndex,0),l=s(t.endIndex,i),u=Math.max(0,l-a),c=t.n!==void 0?t.n:u,f=t.strict!==!1;if(f){if(c!==i)throw new re(`Column height mismatch: seq_range length ${c} does not match DataFrame height ${i}`)}else{let x=t.pad??!1,A=t.truncate??!1;if(x&&!A&&c>u)throw new re(`Cannot pad seq_range output: specified length ${c} starting at index ${a} exceeds slice width ${u} (requires truncation).`);if(A&&!x&&c<u)throw new re(`Cannot truncate seq_range output: specified length ${c} starting at index ${a} is less than slice width ${u} (requires padding).`)}let m=i,h=!!t.dtype,p=t.mode||"cumulative",d=t.step!==void 0?t.step:1,g=h?x=>t.dtype.coerce(x):x=>x;if(f){let x=t.dtype?.allocate?t.dtype.allocate(m):new Array(m);return Xe(x,n,{mode:p,step:d,coerce:g,startIndex:0,endIndex:m}),x}let y=Math.min(a+c,l),_=t.padValue!==void 0?t.padValue:null,S=g(_);if(p==="constant"&&a===0&&y===m&&!t.dtype){let x=new Array(m);for(let A=0;A<m;A++)x[A]=n;return x}let b=new Array(m);return b.fill(S),Xe(b,n,{mode:p,step:d,coerce:g,startIndex:a,endIndex:y}),b}),r}var po=R(()=>{"use strict";he();Te();X();z()});function it(n,e){let t=ot(n,{strict:!0,mode:"constant",dtype:e?.dtype,name:e?.name});return t._isLiteral=!0,t}var Xn=R(()=>{"use strict";po()});var ks={};rr(ks,{duration:()=>Hn});function Hn(n={}){let e=n.timeUnit??"ms",t=[],r=[[n.weeks,Lo],[n.days,Le],[n.hours,Dt],[n.minutes,_e],[n.seconds,lt],[n.milliseconds,Vo],[n.microseconds,$o],[n.nanoseconds,Ko]];for(let[i,s]of r)if(i!=null){let a=v(i)?it(i):U.toColExpr(i);t.push({expr:a,multiplier:s})}if(t.length===0)throw new M("At least one duration component must be specified for $df.duration().");let o=new U(lr);return o._castType=new me(e),o._ops.push((i,s)=>{let a=i?i.length:0;if(a===0&&s){let f=Object.keys(s)[0];f&&k(s[f])&&(a=s[f].length)}a===0&&(a=1);let l=new Float64Array(a),u=new Uint8Array(a);for(let f=0;f<t.length;f++){let{expr:m,multiplier:h}=t[f],p=pe(m,s,a);if(k(p)){let d=p,g=d.length;for(let y=0;y<a;y++){if(u[y]===1)continue;let _=j(y<g?d[y]:g===1?d[0]:null);_!=null?l[y]+=_*h:(u[y]=1,l[y]=0)}}else{let d=j(p);if(d!=null){let g=d*h;for(let y=0;y<a;y++)u[y]!==1&&(l[y]+=g)}else{u.fill(1),l.fill(0);break}}}let c=new Array(a);for(let f=0;f<a;f++)if(u[f]===1)c[f]=null;else{let m=Math.round(l[f]*1e6)/1e6;c[f]=ws(m,e)}return c}),o.alias("duration")}var ho=R(()=>{"use strict";he();Xn();Te();ue();xt();X();z();xe()});var Yn,Wt,mo=R(()=>{"use strict";xt();X();ce();ue();z();xe();Yn=class{constructor(e){this.expr=e}expr;_colTz(){let e=this.expr._castType;return e instanceof Ae?e.timeZone:null}_colTu(){let e=this.expr._castType;return e instanceof Ae?e.timeUnit:null}_deriveDate(e){return T(this.expr,I(t=>{let r=J(t);return r?e(r):null}))}cast_time_unit(e){return this.expr.cast(new Ae(e,this._colTz()))}century(){return this._deriveDate(cs)}convert_time_zone(e){let t=this._colTz();if(this.expr._castType instanceof Ae&&t===null)throw new M('convert_time_zone() requires a timezone-aware Datetime column. Use .dt.replace({ timeZone: "..." }) to assign a timezone first.');return this.expr.cast(new Ae(this._colTu()??"ms",e))}date(){return this._deriveDate(e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())))}day(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).day)}days_in_month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>{let o=ae(r,t),i=An(te(o.year,o.month-1,1),1,0);return i?i.getUTCDate():null})}epoch(e="ms"){return this._deriveDate(t=>us(t,e))}hour(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).hour)}is_business_day(e={}){return this._deriveDate(t=>gs(t,e))}is_leap_year(){return this._deriveDate(Rr)}iso_week(){return this._deriveDate(e=>Ir(e,{field:"week"}))}iso_year(){return this._deriveDate(e=>Ir(e,{field:"year"}))}microsecond(){return this.millisecond().mul(pr)}millennium(){return this._deriveDate(fs)}millisecond(){return this._deriveDate(e=>e.getUTCMilliseconds())}minute(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).minute)}month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).month)}month_end(){return this._deriveDate(e=>An(e,1,0))}month_start(){return this._deriveDate(e=>An(e,0,1))}nanosecond(){return this.millisecond().mul(hr)}offset_day(e,t={}){let o=t?.excludeWeekdays?.length||t?.holidays||t?.roll?T(this.expr,V(this.expr,e,(s,a)=>{let l=J(s);return l?ds(l,a,t):null})):e,{duration:i}=(ho(),or(ks));return this.expr.add(i({days:o}))}ordinal_day(){return this._deriveDate(Cr)}quarter(){return this._deriveDate(ms)}replace(e){return T(this.expr,I(t=>{let r=J(t);return r?ys(r,e):null}))}second(){return this._deriveDate(e=>e.getUTCSeconds())}strftime(e){let t=this._colTz(),r=t&&!e.timeZone?{...e,timeZone:t}:e;return this._deriveDate(o=>Ye(o,r))}time(){return this._deriveDate(e=>e.toISOString().split("T")[1].slice(0,12))}timestamp(e="ms"){return this.epoch(e)}total_days(){return this.expr.div(Le)}total_hours(){return this.expr.div(Dt)}total_microseconds(){return this.expr.mul(pr)}total_milliseconds(){return this.expr}total_minutes(){return this.expr.div(_e)}total_nanoseconds(){return this.expr.mul(hr)}total_seconds(){return this.expr.div(lt)}utc_offset(e,t={}){return T(this.expr,I(r=>{let o=J(r);return o?Nr(o,e,t):null}))}week(){return this.iso_week()}weekday(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).dayOfWeek||7)}year(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).year)}},Wt=class extends ${get dt(){return new Yn(this)}}});function At(){return new U("*")}var Ns=R(()=>{"use strict";he()});function go(n){let e=new U("*");return e._excludedCols=Array.isArray(n)?n:[n],e}var Ms=R(()=>{"use strict";he()});function yo(...n){let e=n.length===1&&Array.isArray(n[0])?n[0]:n,t=new U(sr);return t._ops.push((r,o)=>{let i=r.length,s=e.length,a=new Array(s),l=new Array(s);for(let c=0;c<s;c++){let f=e[c],m=nt(f,o,i);a[c]=m,l[c]=rt(f,m,o,i)}let u=new Array(i);for(let c=0;c<i;c++){let f=null;for(let m=0;m<s;m++){let h=a[m],p=l[m]?h[c]:h;if(p!=null){f=p;break}}u[c]=f}return u}),t}var Us=R(()=>{"use strict";he();ue();Te()});function _o(n){return new Qn(n)}var Zn,Qn,Xt,vs=R(()=>{"use strict";he();ue();Te();Zn=class{_predicates;_values;constructor(e,t){this._predicates=e,this._values=t}then(e){return new Xt(this._predicates,this._values.concat(e))}},Qn=class{_predicates;constructor(e){this._predicates=[e]}then(e){return new Xt(this._predicates,[e])}},Xt=class n extends U{_predicates;_values;_otherwise;get _otherwiseValue(){return this._otherwise}get _branchOperands(){return this._otherwise!=null?[...this._values,this._otherwise]:this._values}constructor(e=[],t=[],r=null){super(ur),this._predicates=Array.isArray(e)?e:[],this._values=t||[],this._otherwise=r,this._ops=[(o,i)=>{let s=o.length,a=this._predicates,l=this._values,u=a.length,c=new Array(u),f=new Array(u),m=new Array(u),h=new Array(u);for(let _=0;_<u;_++){let S=a[_],b=l[_],x=nt(S,i,s),A=nt(b,i,s);c[_]=x,f[_]=A,m[_]=rt(S,x,i,s),h[_]=rt(b,A,i,s)}let p=this._otherwise,d=nt(p,i,s),g=rt(p,d,i,s),y=new Array(s);for(let _=0;_<s;_++){let S=!1;for(let b=0;b<u;b++)if((m[b]?c[b][_]:c[b])===!0){y[_]=h[b]?f[b][_]:f[b],S=!0;break}S||(y[_]=g?d[_]:d)}return y}]}when(e){return new Zn(this._predicates.concat(e),this._values)}otherwise(e){return new n(this._predicates,this._values,e)}}});function xo(n){return U.toColExpr(n).implode()}var Fs=R(()=>{"use strict";he()});function bo(){return new U(We)}var js=R(()=>{"use strict";he();Te()});function wo(n,...e){let t;Array.isArray(n)||n&&typeof n=="object"&&!U.isColExpr(n)?t=n:t=[n,...e];let r=it({}).struct.with_fields(t);return delete r._isLiteral,delete r._literalValue,r._colName=ar,r.alias("struct")}var Bs=R(()=>{"use strict";he();Xn();Te()});function st(n,e){if(n==null)return;if(n instanceof Z)return n;if(typeof n=="object"&&("_ops"in n||"_literalValue"in n||"_targetType"in n))return St(n,e);let t=ie(n);if(typeof t=="string")return e[t]??E.Utf8;if(typeof t=="boolean")return E.Boolean;if(typeof t=="bigint")return on(t,{range:"Int64"})?E.Int64:E.UInt64;if(v(t))return Ee(t,{range:"Int32"})?E.Int32:Number.isInteger(t)?E.Int64:E.Float64;if(P(t))return E.Datetime;if(Sr(t,{strict:!0}))return E.Binary;if(Array.isArray(t)){let r,o=t.length;for(let i=0;i<o;i++){let s=t[i];if(s!=null&&(r=st(s,e)))break}return E.Array(r??E.Utf8)}if(K(t)){let r=Be?Be.call(t):t.constructor.name,o=Tl[r];return o?E.Array(o):E.Binary}if(F(t))return E.Object}function Ao(n,e,t){if(!n||!e)return;if(t&&t.length>0){let a=!1;for(let l=0;l<t.length;l++){let u=t[l];if(u!=null){if(typeof u!="boolean"){a=!1;break}a=!0}}if(a)return E.Boolean}let r=n instanceof me,o=e instanceof me,i=n.isTemporal&&!r,s=e.isTemporal&&!o;if(i||s){if(i&&s){let a=n.timeUnit||e.timeUnit||"ms";return new me(a)}return i?n:e}if(r||o)return r?n:e;if(n.isUtf8||e.isUtf8)return E.Utf8;if(n.isNumeric&&e.isNumeric){let a=n instanceof et||e instanceof et,l=n instanceof Qe||e instanceof Qe,u=n instanceof ke||e instanceof ke;if(a||l&&u)return E.Float64;if(l)return E.Float32;if(u)return n instanceof ke?n:e;if(t!==void 0){let m={range:{min:-1/0,max:1/0}},h=t.length;for(let p=0;p<h;p++){let d=t[p];if(v(d)&&!Ee(d,m))return E.Float64}}if(n===e)return n;let c=n.name,f=e.name;return c.endsWith("64")||f.endsWith("64")?E.Int64:c.endsWith("32")||f.endsWith("32")?c==="UInt32"&&f==="UInt32"?E.UInt32:E.Int32:c.endsWith("16")||f.endsWith("16")?c==="UInt16"&&f==="UInt16"?E.UInt16:E.Int16:c==="UInt8"&&f==="UInt8"?E.UInt8:E.Int8}}function St(n,e,t){if(!n)return;if(n._castType)return n._castType;if(n._targetType instanceof Z)return n._targetType;if(n._isLiteral&&n._literalValue!==void 0)return st(n._literalValue,e);if(n._binaryMeta)return Ao(st(n._binaryMeta.left,e),st(n._binaryMeta.right,e),t);if(n._branchOperands){let s,a=n._branchOperands.length;for(let l=0;l<a;l++){let u=st(n._branchOperands[l],e);u&&(s?s!==u&&s.isNumeric&&u.isNumeric&&(s=Ao(s,u,t)??s):s=u)}if(s)return s}if(n._baseExpr&&n._fieldName){let s=st(n._baseExpr,e);if(s instanceof yt)return s.fields?.[n._fieldName]}let r=n._colName?e[n._colName]:void 0,o=t?.[0],i=(!n._ops||n._ops.length===0)&&!n._aggFn;if(r){if(r instanceof tt&&(n._isUnnest||t?.rowMap))return r.innerType;if(!(r instanceof tt)&&Array.isArray(o))return E.Array(r);if(i||r.isTemporal&&n._aggFn&&(P(o)||typeof o=="string")||r instanceof me&&n._aggFn&&v(o))return r}if(n._aggFn&&v(o))return!Number.isInteger(o)||r?.isNumeric&&!(r instanceof me)?E.Float64:E.Int32}var Tl,Ps=R(()=>{"use strict";xt();Ne();z();Tl={Float64Array:E.Float64,Float32Array:E.Float32,Int32Array:E.Int32,Int16Array:E.Int16,Int8Array:E.Int8,BigInt64Array:E.Int64,BigUint64Array:E.UInt64,BigUint64:E.UInt64,Uint32Array:E.UInt32,Uint16Array:E.UInt16}});var Ht=R(()=>{"use strict";Te();To();ce();ro();oo();io();so();ao();uo();mo();co();fo();he();Xn();Ns();Ms();Us();vs();Fs();po();js();Bs();ho();Ps();ue()});var Yt,Ls=R(()=>{"use strict";wt();Kn();Ht();Yt=class{_groups;_keys;_allKeys;_parentColumns;_parentHeight;_parentSchema;constructor(e,t,r,o,i,s){this._groups=e,this._keys=t,this._allKeys=r,this._parentColumns=o,this._parentHeight=i,this._parentSchema=s}to_dataframe(){let e=this._keys.length,t=new Array(e);for(let a=0;a<e;a++)t[a]=String(this._keys[a]);let r=this._groups.size,o={};for(let a=0;a<t.length;a++)o[t[a]]=new Array(r);let i=0;for(let a of this._groups.values()){if(a.length===0)continue;let l=a[0];for(let u=0;u<t.length;u++){let c=t[u],f=this._parentColumns[c][l];o[c][i]=f===void 0?null:f}i++}let s={};for(let a of t)s[a]=this._parentSchema[a];return L._createDirect(o,s,i)}agg(...e){let t=this._allKeys.length,r=new Array(t);for(let f=0;f<t;f++)r[f]=String(this._allKeys[f]);let o=this._keys.length,i=new Array(o);for(let f=0;f<o;f++)i[f]=String(this._keys[f]);let s=je(e.flat(),r,i,this._parentSchema,this._parentColumns),a=this._groups.size,l={};for(let f=0;f<i.length;f++)l[i[f]]=new Array(a);let u=0;for(let f of this._groups.values()){if(f.length===0)continue;let m=f[0];for(let h=0;h<i.length;h++){let p=i[h],d=this._parentColumns[p][m];l[p][u]=d===void 0?null:d}u++}for(let f=0;f<s.length;f++){let m=s[f],h=m._outputName||m._colName||"*";if(!m._aggFn)l[h]=m.evaluate(l,a);else{let p=m._evaluatePre(m._groupingOpsIndex,this._parentColumns,this._parentHeight),d=new Array(a),g=0;for(let y of this._groups.values()){if(y.length===0)continue;let _=new Array(y.length);for(let S=0;S<y.length;S++)_[S]=p[y[S]];d[g]=m._aggFn(_),g++}l[h]=m._evaluatePost(m._groupingOpsIndex,d,l)}}let c={};for(let f of i)c[f]=this._parentSchema[f];for(let f of s){let m=f._outputName||f._colName||"*",h=St(f,this._parentSchema,l[m])||Fe(l[m]);c[m]=h,l[m]=Se(l[m],h,u)}return L._createDirect(l,c,u)}}});function Dl(n,e,t){if(n==null)throw new q(`Invalid input to ${e} at index ${t}: item cannot be null or undefined.`);if(n instanceof L)return[n];if(Pe(n))return[new L(n)];if(k(n)){if(ee(n,L,{mode:"every"}))return n;if(ee(n,"plainObject",{mode:"every"}))return[new L(n)];let r=ee(n,L,{mode:"some"});for(let o=0;o<n.length;o++)if(r?!(n[o]instanceof L):!Pe(n[o]))throw new q(r?`Invalid input to ${e} at index ${t}, sub-index ${o}: nested array must contain only DataFrame instances.`:`Invalid input to ${e} at index ${t}, row ${o}: rows must be plain objects.`)}throw new q(`Invalid input to ${e} at index ${t}: expected DataFrame, row array, or column dictionary.`)}function Tt(n,{how:e="vertical",horizontal:t}={}){if(n==null)throw new q("Invalid input to concat: rawItems cannot be null or undefined.");let r=Array.isArray(n)?n:[n],o=[];for(let s=0;s<r.length;s++)o.push(...Dl(r[s],"concat",s));let i=t?.strict??!0;if(o.length===0)return L._createDirect({},{},0);if(o.length===1&&e!=="horizontal")return o[0];switch(e){case"vertical":{let s=[];for(let p=0;p<o.length;p++)o[p].height>0&&s.push(o[p]);if(s.length===0)return L._createDirect({},{},0);let a=s[0],l=Object.keys(a._columns);for(let p=0;p<o.length;p++){let d=o[p];if(d.height===0)continue;let g=Object.keys(d._columns);if(l.length!==g.length)throw new q(`[Strict Vertical] Column count mismatch at index ${p}.`);for(let y=0;y<l.length;y++){if(l[y]!==g[y])throw new q(`[Strict Vertical] Schema mismatch at position ${y} in DF ${p}. Expected column "${l[y]}", but found "${g[y]}".`);let _=a.schema[l[y]],S=d.schema[l[y]];if(_&&S&&!_.equals(S))throw new Je(`[Strict Type Check] Schema type mismatch for column "${l[y]}": expected ${_.name}, found ${S.name}.`)}}let u=0;for(let p of o)u+=p.height;let c={},f=o.length;for(let p=0;p<f;p++)if(o[p].height>0){c=o[p].schema;break}Object.keys(c).length===0&&f>0&&(c=o[0].schema);let m={};for(let p of l){let d=c[p],g=!1;for(let _ of o){let S=_._columns[p];if(!S){g=!0;break}if(!K(S)){for(let b=0;b<S.length;b++)if(S[b]==null){g=!0;break}}if(g)break}let y=d&&d.allocate?d.allocate(u):new Array(u).fill(null);g&&K(y)&&(y=new Array(u).fill(null)),m[p]=y}let h=0;for(let p of o){let d=p.height;if(d!==0){for(let g of l){let y=p._columns[g]||new Array(d).fill(null),_=m[g];if(K(_)&&K(y))_.set(y,h);else{let S=_;for(let b=0;b<d;b++)S[h+b]=y[b]}}h+=d}}return L._createDirect(m,c,u)}case"horizontal":{let s=o[0].height;for(let c=1;c<o.length;c++)o[c].height>s&&(s=o[c].height);let a=new Set;for(let c=0;c<o.length;c++){let f=o[c];if(i&&f.height!==s)throw new re(`[Horizontal] Row count mismatch at index ${c}. Expected ${s}, got ${f.height}. Set strict=false to allow padding.`);for(let m of Object.keys(f._columns)){if(a.has(m))throw new q(`[Horizontal] Duplicate column name "${m}" detected. Horizontal concat requires unique names.`);a.add(m)}}let l={},u={};for(let c of o){let f=c.height;Object.assign(u,c.schema);let m=Object.keys(c._columns),h=m.length;for(let p=0;p<h;p++){let d=m[p],g=c._columns[d];if(f===s)l[d]=K(g)?Array.from(g):g;else{let y=new Array(s);for(let _=0;_<f;_++)y[_]=g[_];for(let _=f;_<s;_++)y[_]=null;l[d]=y}}}return L._createDirect(l,u,s)}case"diagonal":{let s=new Set;for(let m of o)for(let h of Object.keys(m._columns))s.add(h);let a=Array.from(s),l=0;for(let m=0;m<o.length;m++)l+=o[m].height;let u={};for(let m of a){let h=null;for(let p of o){let d=p.schema[m];if(d){if(h===null)h=d;else if(!h.equals(d))throw new Je(`[Strict Type Check] Schema type mismatch for column "${m}": expected ${h.name}, found ${d.name}.`)}}u[m]=h||E.Utf8}let c={};for(let m=0;m<a.length;m++)c[a[m]]=new Array(l).fill(null);let f=0;for(let m=0;m<o.length;m++){let h=o[m],p=h.height;if(p!==0){for(let d=0;d<a.length;d++){let g=a[d],y=c[g],_=h._columns[g];if(_!==void 0)if(K(_)&&K(y))y.set(_,f);else{let S=y;for(let b=0;b<p;b++)S[f+b]=_[b]}else{let S=y;for(let b=0;b<p;b++)S[f+b]=null}}f+=p}}return L._createDirect(c,u,l)}}}var So=R(()=>{"use strict";wt();Ne();z();X()});var L,wt=R(()=>{"use strict";Ht();Ls();kt();Ne();z();X();So();Kn();L=class n{_columns;_height;_schema={};static _createDirect(e,t,r){Vn(e,r);let o=Object.create(n.prototype);return o._columns=e,o._schema=t,o._height=r,o}constructor(e,t,r){if(Array.isArray(e)){let{columns:o,height:i}=Yr(e);this._columns=o,this._height=i,t?this._applySchema(t):this._inferSchema();return}if(F(e)){this._columns=e,this._height=Vn(e,r),t?this._applySchema(t):this._inferSchema();return}this._columns={},this._height=0,t?this._applySchema(t):this._schema={}}_inferSchema(){let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let i=t[o];e[i]=Fe(this._columns[i])}this._applySchema(e)}_applySchema(e){this._schema=e;let t=Object.keys(e),r={};for(let o of t){let i=e[o],s=this._columns[o];r[o]=s?Se(s,i,this._height):Se(new Array(this._height).fill(null),i,this._height)}this._columns=r}get columns(){return Object.keys(this._columns)}concat(e,t={}){let r=ee(e,n,{mode:"every",allowEmpty:!1})?e:[e];return Tt([this,...r],t)}drop(...e){let t=new Set(e.flat()),r={},o={};for(let i of Object.keys(this._columns))t.has(i)||(r[i]=this._columns[i],o[i]=this._schema[i]);return n._createDirect(r,o,this._height)}drop_nulls(e){return this._height===0?this:this.filter(e?new U(e).is_not_null():At().is_not_null())}get dtypes(){let e=Object.keys(this._columns),t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=this._schema[e[o]];return r}explode(e,t){let r=Array.isArray(e)?e:[e],o=this._normalizeArgs(r),i=je(o,Object.keys(this._columns),void 0,this._schema,this._columns),s=new Set,a=i.length;for(let f=0;f<a;f++){let m=i[f],h=m._colName||m._outputName;if(!h||h==="*")throw new q("Expression passed to explode must have a column name.");H(h,this._columns,"Explode column"),s.add(h)}let l=Object.keys(this._columns),u=[],c=l.length;for(let f=0;f<c;f++){let m=l[f];u.push(s.has(m)?new U(m).arr.explode(t):new U(m))}return this.select(...u)}fill_null(e={}){return this._height===0?this:this.with_columns(At().fill_null(e))}filter(...e){if(this._height===0)return n._createDirect({},this._schema,0);let t=this._height,r=Object.keys(this._columns),o=r.length,i=[],s=[],a=[],l=e.length;for(let g=0;g<l;g++){let y=e[g];typeof y=="function"?s.push(y):a.push(y)}let u=je(a,r,void 0,this._schema,this._columns),c=u.length;for(let g=0;g<c;g++)i.push(u[g].evaluate(this._columns,t));let f=[],m=0,h=null;if(s.length>0){let g=this._columns;h={};for(let y=0;y<o;y++){let _=r[y],S=g[_];Object.defineProperty(h,_,{get(){let b=S[m];return b===void 0?null:b},enumerable:!0,configurable:!0})}}for(let g=0;g<t;g++){let y=!0;for(let _=0;_<i.length;_++)if(!i[_][g]){y=!1;break}if(y){if(h){m=g;for(let _=0;_<s.length;_++)if(!s[_](h)){y=!1;break}}y&&f.push(g)}}let p=bt(this._columns,f),d=f.length;return n._createDirect(p,this._schema,d)}groupby(e){let t=be(e),r=new Map,o=this._height,i=$e(e,"string");for(let a=0;a<i.length;a++)H(i[a],this._columns,"Grouping key");for(let a=0;a<o;a++){let l=ve(this._columns,i,a),u=r.get(l);u===void 0&&r.set(l,u=[]),u.push(a)}let s=Object.keys(this._columns);return new Yt(r,t,s,this._columns,this._height,this._schema)}head(e=10){return this.limit(e,{offset:0,from:"start"})}clone(){let e={};for(let t of Object.keys(this._columns)){let r=this._columns[t];(Array.isArray(r)||K(r))&&(e[t]=r.slice())}return n._createDirect(e,{...this._schema},this._height)}get height(){return this._height}hstack(e,t={}){return this.concat(e,{how:"horizontal",horizontal:t})}insert_column(e,t,r){let o=U.toColExpr(r).alias(t),i=Object.keys(this._columns),s=i.length,a=[];for(let u=0;u<s;u++){let c=i[u];c!==t&&a.push(c)}let l=Math.max(0,Math.min(e,a.length));return a.splice(l,0,o),this.select(...a)}item(e,t){let r=this._height,o=Object.keys(this._columns),i=o.length;if(e===void 0&&t===void 0){if(r!==1||i!==1)throw new q("DataFrame.item() can only be called without arguments if the shape is (1, 1).");return this._columns[o[0]][0]}if(e===void 0||t===void 0)throw new q("DataFrame.item() requires both row and column to be specified if not empty.");if(e<0||e>=r)throw new re(`Row index ${e} is out of bounds for DataFrame height ${r}.`);let s;if(typeof t=="number"){if(t<0||t>=i)throw new re(`Column index ${t} is out of bounds for DataFrame width ${i}.`);s=o[t]}else if(s=t,this._columns[s]===void 0)throw new Me(s);return this._columns[s][e]}*iter_columns(){let e=Object.keys(this._columns),t=e.length,r=this._columns;for(let o=0;o<t;o++)yield r[e[o]]}*iter_rows({named:e=!1}={}){let t=Object.keys(this._columns),r=t.length,o=this._columns,i=this._height,s=new Array(r);for(let a=0;a<r;a++)s[a]=o[t[a]];if(e)for(let a=0;a<i;a++){let l={};for(let u=0;u<r;u++)l[t[u]]=s[u][a];yield l}else for(let a=0;a<i;a++){let l=new Array(r);for(let u=0;u<r;u++)l[u]=s[u][a];yield l}}join(e){let{other:t,on:r,leftOn:o,rightOn:i,how:s="inner",suffixes:a=["","_right"],join_nulls:l=!1,coalesce:u=!0,maintain_order:c="none"}=e;if(s==="cross"&&(r!==void 0||o!==void 0||i!==void 0))throw new M('Cannot specify "on", "leftOn", or "rightOn" when how is "cross". Cross joins produce a keyless Cartesian product.');if(r!==void 0&&(o!==void 0||i!==void 0))throw new M('Cannot specify both "on" and "leftOn"/"rightOn" in join(). Use either "on" or both "leftOn" and "rightOn".');if(o!==void 0&&i===void 0||o===void 0&&i!==void 0)throw new M('join() requires both "leftOn" and "rightOn" when specifying heterogeneous join keys.');if(s!=="cross"&&r===void 0&&o===void 0&&i===void 0)throw new M('join() requires either "on" or both "leftOn" and "rightOn" parameters.');let f=[],m=[];if(o!==void 0&&i!==void 0){if(f=$e(o,"string"),m=$e(i,"string"),f.length===0||m.length===0)throw new M('join() requires non-empty key arrays in "leftOn" and "rightOn".');if(f.length!==m.length)throw new M(`join() "leftOn" length (${f.length}) must match "rightOn" length (${m.length}).`)}else if(r!==void 0&&(f=$e(r,"string"),m=f,f.length===0))throw new M('join() requires at least one key column in "on".');for(let y=0;y<f.length;y++)H(f[y],this._columns,"Join key"," in the left DataFrame."),H(m[y],t._columns,"Join key"," in the right DataFrame.");let p={...e,how:s,suffixes:a,join_nulls:l,coalesce:u,maintain_order:typeof c=="boolean"?c?"left":"none":c??"none"},{leftIndices:d,rightIndices:g}=eo(this._columns,t._columns,this._height,t._height,f,m,p);return $n(this._columns,t._columns,this._schema,t._schema,d,g,f,m,{suffixes:a,coalesce:u,how:s})}join_asof(e){let{other:t,on:r,leftOn:o,rightOn:i,by:s,leftBy:a,rightBy:l,strategy:u="backward",tolerance:c,allow_exact_matches:f=!0,suffixes:m=["","_right"],coalesce:h=!0,check_sorted:p=!0}=e;if(!t||!(t instanceof n))throw new M("join_asof() requires a valid right DataFrame in the 'other' parameter.");let d=String(o??r??""),g=String(i??r??"");if(!d||!g)throw new M('join_asof() requires join key specified via "on", or "leftOn" and "rightOn".');let y=O=>O?Array.isArray(O)?O.map(String):[String(O)]:[],_=y(a??s),S=y(l??s);if(_.length!==S.length)throw new M('join_asof() "by" (or "leftBy" / "rightBy") key lists must have equal lengths.');for(let O=0;O<_.length;O++)H(_[O],this._columns,"Partition key"," in the left DataFrame."),H(S[O],t._columns,"Partition key"," in the right DataFrame.");let b={...e,strategy:u,tolerance:c,allow_exact_matches:f,suffixes:m,coalesce:h,check_sorted:p},{leftIndices:x,rightIndices:A}=to(this._columns,t._columns,this._height,t._height,d,g,_,S,b),w=[d,..._],D=[g,...S];return $n(this._columns,t._columns,this._schema,t._schema,x,A,w,D,{suffixes:m,coalesce:h,how:"left"})}limit(e,{offset:t=0,from:r="start"}={}){let o=this._height,i=Ce(Math.floor(e),{min:0,max:o}),s=Ce(Math.floor(t),{min:0,max:o}),a=s,l=Math.min(s+i,o);r==="end"&&(l=o-s,a=Math.max(l-i,0));let u=l-a,c={},f=Object.keys(this._columns),m=f.length;for(let h=0;h<m;h++){let p=f[h];c[p]=this._columns[p].slice(a,l)}return n._createDirect(c,this._schema,u)}pivot(e){if(this._height===0)return n._createDirect({},{},0);let{index:t,columns:r,values:o}=e,i=$e(t,"string"),s=i.length;for(let x=0;x<s;x++)H(i[x],this._columns,"Pivot index key");let a=String(r),l=String(o);H(a,this._columns,"Pivot column key"),H(l,this._columns,"Pivot values key");let u=new Map,c=[],f=new Set,m=this._height,h=this._columns[a],p=this._columns[l];for(let x=0;x<m;x++){let A=ve(this._columns,i,x);f.add(String(h[x])),u.get(A)===void 0&&(u.set(A,u.size),c.push(x))}let d=u.size,g={},y={};for(let x=0;x<s;x++){let A=i[x];g[A]=this._columns[A],this._schema[A]&&(y[A]=this._schema[A])}let _=bt(g,c),S=Array.from(f),b=this._schema[l]||E.Utf8;for(let x=0;x<S.length;x++){let A=S[x];_[A]=new Array(d).fill(null),y[A]=b}for(let x=0;x<m;x++){let A=ve(this._columns,i,x),w=u.get(A),D=String(h[x]);_[D][w]=p[x]}return n._createDirect(_,y,d)}rename(e){let t=e||{},r={},o={},i=Object.keys(this._columns);for(let a of i){let l=t[a]||a;r[l]=this._columns[a],o[l]=this._schema[a]}if(Object.keys(r).length<i.length)throw new q("Rename collision: Multiple columns mapped to the same output name.");return n._createDirect(r,o,this._height)}reverse(){if(this._height===0)return this;let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let i=t[o];e[i]=this._columns[i].slice().reverse()}return n._createDirect(e,this._schema,this._height)}get schema(){return this._schema}select(...e){let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=je(t,r,void 0,this._schema,this._columns),i=o.length;if(i===0)return n._createDirect({},{},this._height);let s={},a={},l=new Array(i),u=new Array(i),c=new Set,f=null;for(let p=0;p<i;p++){let d=o[p],g=d._outputName||d._colName||"*";if(c.has(g))throw new q(`Duplicate column selection: "${g}" is selected multiple times.`);c.add(g);let y=pe(d,this._columns,this._height);l[p]=y,u[p]=g;let _=y&&y.rowMap;if(_)if(f){let S=_.length;if(S!==f.length)throw new re(`Mismatched explode heights: Column "${g}" has length ${S}, but another exploded column has length ${f.length}`);for(let b=0;b<S;b++)if(_[b]!==f[b])throw new re(`Mismatched explode heights: Column "${g}" has mismatched row lengths compared to another exploded column.`)}else f=_}let m=f?f.length:this._height,h=i>0;for(let p=0;p<i;p++){let d=o[p],g=d._aggFn!=null&&(d._partitionBy==null||d._partitionBy.length===0),y=!!d._isLiteral;if(!g&&!y){h=!1;break}}for(let p=0;p<i;p++){let d=u[p],g=l[p],y=g,_=y&&y.rowMap,S=k(g)?g.length:0,b=f&&!_?this._height:m;if(S!==b)throw new re(`Column height mismatch: Column "${d}" has length ${S}, but expected ${b}`);if(f&&!_){let x=f.length;if(K(g)){let A=new y.constructor(x);for(let w=0;w<x;w++)A[w]=y[f[w]];g=A}else{let A=new Array(x);for(let w=0;w<x;w++)A[w]=y[f[w]];g=A}}l[p]=g}h&&(m=1);for(let p=0;p<i;p++){let d=o[p],g=u[p],y=l[p],_=St(d,this._schema,y)||Fe(y);a[g]=_,s[g]=Se(y,_,m)}return n._createDirect(s,a,m)}get shape(){return[this.height,this.width]}slice(e,t){let r=this._height,o=e<0?Math.max(r+e,0):Math.min(e,r),i=t===void 0?r:t<0?Math.max(r+t,0):Math.min(t,r),s=Math.max(i-o,0);return this.limit(s,{offset:o})}sort(e){if(!e||!e.by||this._height===0)return this;let{by:t,descending:r=!1,nullsLast:o=!0,custom:i}=e,s=be(t);for(let p=0;p<s.length;p++){let d=U.toColExpr(s[p]);d._colName&&H(d._colName,this._columns,"Sort key")}let a=Array.isArray(r)?r:new Array(s.length).fill(r),l=s.length,u=new Array(l);for(let p=0;p<l;p++){let d=s[p],g=a[p]?-1:1,y=i&&typeof d=="string"?i[d]:null,_=U.toColExpr(d).evaluate(this._columns,this._height);u[p]={values:_,isDesc:g,customComp:y}}let c=u.length,f=o?1:-1,m=new Array(this._height);for(let p=0;p<this._height;p++)m[p]=p;m.sort((p,d)=>{for(let g=0;g<c;g++){let{values:y,isDesc:_,customComp:S}=u[g],b=y[p],x=y[d];if(S){let w=S(b,x);if(w!==0)return w*_;continue}if(b==null||x==null){if(b===x)continue;return(b==null?1:-1)*f}if(b===x)continue;return(b<x?-1:1)*_}return 0});let h=bt(this._columns,m);return n._createDirect(h,this._schema,this._height)}tail(e=10){return this.limit(e,{offset:0,from:"end"})}to_dict(){return{...this._columns}}to_dicts(){return Zr(this._columns,this._height)}to_array(e){if(this._height===0)return[];if(e==null)return new Array(this._height).fill(null);let r=U.toColExpr(e).evaluate(this._columns,this._height);return Array.isArray(r)?r:Array.from(r)}transpose({include_header:e=!1,header_name:t="column",column_names:r}={}){if(this._height===0){let c={},f={};return e&&(c[t]=Se([],E.Utf8,0),f[t]=E.Utf8),n._createDirect(c,f,0)}let o=this.columns;typeof r=="string"&&(H(r,this._columns,"column_names"),o=o.filter(c=>c!==r));let i=[];if(typeof r=="string"){let c=this._columns[r];i=new Array(this._height);for(let f=0;f<this._height;f++){let m=c[f];if(m==null)throw new q(`Transpose column_names column "${r}" contains null/undefined at index ${f}`);i[f]=String(m)}}else if(r!=null&&typeof r!="string"&&Symbol.iterator in Object(r)){let c=Array.from(r);if(c.length!==this._height)throw new q(`column_names length (${c.length}) must match the height of the DataFrame (${this._height})`);i=new Array(this._height);for(let f=0;f<this._height;f++)i[f]=String(c[f])}else{i=new Array(this._height);for(let c=0;c<this._height;c++)i[c]=`column_${c}`}let s=new Set;e&&s.add(t);for(let c=0;c<i.length;c++){let f=i[c];if(s.has(f))throw new q(`Duplicate column name in transposed DataFrame: "${f}"`);s.add(f)}let a=o.length,l={},u={};e&&(l[t]=Se(o,E.Utf8,a),u[t]=E.Utf8);for(let c=0;c<this._height;c++){let f=i[c],m=new Array(a);for(let p=0;p<a;p++)m[p]=this._columns[o[p]][c];let h=Fe(m);l[f]=Se(m,h,a),u[f]=h}return n._createDirect(l,u,a)}unique(e){if(this._height===0)return n._createDirect({},this._schema,0);let t=be(e),r=t.length===0?Object.keys(this._columns):t.map(String);for(let u of r)H(u,this._columns,"Unique column key");let o=new Set,i=[],s=this._height;for(let u=0;u<s;u++){let c=ve(this._columns,r,u);o.has(c)||(o.add(c),i.push(u))}let a=bt(this._columns,i),l=i.length;return n._createDirect(a,this._schema,l)}unpivot(e){let{idVars:t,valueVars:r,varName:o="variable",valueName:i="value"}=e,s=$e(t,"string"),a=$e(r,"string"),l=s.length,u=a.length;for(let p of s)H(p,this._columns,"Unpivot id variable key");for(let p of a)H(p,this._columns,"Unpivot value variable key");let c=this._height*u,f={};for(let p=0;p<l;p++)f[s[p]]=new Array(c);f[o]=new Array(c),f[i]=new Array(c);let m=0;for(let p=0;p<this._height;p++)for(let d=0;d<u;d++){let g=a[d];for(let y=0;y<l;y++){let _=s[y];f[_][m]=this._columns[_][p]}f[o][m]=g,f[i][m]=this._columns[g][p],m++}let h={};for(let p of s)h[p]=this._schema[p];return h[o]=E.Utf8,h[i]=Fe(f[i]),n._createDirect(f,h,c)}vstack(e){return this.concat(e,{how:"vertical"})}get width(){return Object.keys(this._columns).length}_normalizeArgs(e){let t=e.flat(),r=[];for(let o of t)if(typeof o=="string")r.push(new U(o));else if(U.isColExpr(o))r.push(o);else if(F(o)){let i=Object.keys(o),s=i.length;for(let a=0;a<s;a++){let l=i[a],u=o[l];if(U.isColExpr(u))r.push(u.alias(l));else{let c=new U(l);c.evaluate=(f,m)=>new Array(m).fill(u),r.push(c)}}}return r}with_columns(...e){if(e.length===0)return this;let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=je(t,r,void 0,this._schema,this._columns),i=o.length;if(i===0)return this;let s=new Map;for(let u=0;u<i;u++){let c=o[u],f=c._outputName||c._colName||"*";s.set(f,c)}let a=[],l=r.length;for(let u=0;u<l;u++){let c=r[u];a.push(s.get(c)||new U(c)),s.delete(c)}for(let u of s.values())a.push(u);return this.select(...a)}with_row_index(e="index",t=0){let r=ot(t,{mode:"independent",dtype:E.UInt32,step:1}),o=this.insert_column(0,e,r);return o._schema[e]=E.UInt32,o}write_json(e,{format:t="json",replacerOptions:r}={}){if(t!=="json"&&t!=="ndjson")throw new M(`Unsupported JSON format: "${t}". Expected "json" or "ndjson".`);let o=r?.replacer===null?void 0:He(r),i;if(t==="ndjson"){let s=this.to_dicts(),a=s.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=JSON.stringify(s[u],o);i=l.join(`
6
- `)}else i=JSON.stringify(this.to_dicts(),o);return Qr(e,i),i}write_csv(e,t={}){if(e){if(typeof e=="string"){if(typeof require!="function")throw new Re("File writing is not supported in this environment (missing require('fs')).");let r=require("fs"),o=r.openSync(e,"w");try{Ln(this._columns,this._height,{...t,onRow:i=>{r.writeSync(o,i,null,"utf8")}})}finally{r.closeSync(o)}}else if(F(e)&&typeof e.write=="function")Ln(this._columns,this._height,{...t,onRow:r=>{e.write(r)}});else throw new M("Invalid file argument. Expected a file path string or a writable stream/object with a write method.");return""}return Ln(this._columns,this._height,t)}}});var Il={};rr(Il,{$df:()=>El,ALL_COLUMNS_MARKER:()=>oe,AggregationExpr:()=>qt,ArithmeticExpr:()=>Lt,Array:()=>Jr,ArrayDataType:()=>Jr,ArrayExpr:()=>Gt,ArrayExprNamespace:()=>zn,ArrayType:()=>tt,Binary:()=>Vr,BinaryType:()=>Un,Boolean:()=>jt,BooleanDataType:()=>jt,BooleanType:()=>Nn,COALESCE_MARKER:()=>sr,ColumnExpr:()=>U,ColumnNotFoundError:()=>Me,ComparisonExpr:()=>$t,ComputeError:()=>ne,DFScriptError:()=>Ue,DURATION_MARKER:()=>lr,DataFrame:()=>L,DataFrameError:()=>q,DataType:()=>Z,DataTypeRegistry:()=>E,Date:()=>qr,DateDataType:()=>qr,DateTimeExprNamespace:()=>Yn,DateType:()=>jn,Datetime:()=>Bt,DatetimeType:()=>Ae,DecimalType:()=>ke,Duration:()=>Gr,DurationType:()=>me,ELEMENT_MARKER:()=>We,ExprBase:()=>$,Float32:()=>Lr,Float32Type:()=>Qe,Float64:()=>Ft,Float64Type:()=>et,FloatDataType:()=>dt,GroupedData:()=>Yt,IOStreamError:()=>Re,Int16:()=>Ur,Int16Type:()=>Dn,Int32:()=>vr,Int32Type:()=>On,Int64:()=>vt,Int64Type:()=>En,Int8:()=>Mr,Int8Type:()=>Tn,IntegerDataType:()=>Ut,InvalidArgumentError:()=>M,LITERAL_MARKER:()=>ir,LogicalExpr:()=>Vt,NestedDataType:()=>gt,Null:()=>$r,NullType:()=>vn,NumericDataType:()=>Ze,Object:()=>Kr,ObjectDataType:()=>Kr,ObjectType:()=>Fn,STRUCT_MARKER:()=>ar,SchemaError:()=>Je,ShapeError:()=>re,SignedIntegerType:()=>qe,StringExpr:()=>Kt,StringExprNamespace:()=>qn,Struct:()=>Wr,StructExpr:()=>Jt,StructExprNamespace:()=>Jn,StructType:()=>yt,TemporalDataType:()=>Ge,TemporalExpr:()=>Wt,Time:()=>zr,TimeType:()=>Bn,UInt16:()=>jr,UInt16Type:()=>Cn,UInt32:()=>Br,UInt32Type:()=>Rn,UInt64:()=>Pr,UInt64Type:()=>kn,UInt8:()=>Fr,UInt8Type:()=>In,UnsignedIntegerType:()=>ze,Utf8:()=>_t,Utf8Type:()=>Mn,WHEN_MARKER:()=>ur,When:()=>Qn,WhenThen:()=>Xt,WhenThenChain:()=>Zn,WindowExpr:()=>zt,alignAsofIndices:()=>to,alignKeyIndices:()=>eo,all:()=>At,assertColumnExists:()=>H,assertHeight:()=>Vn,assertNotNull:()=>Pt,assertValidArgument:()=>xl,coalesce:()=>yo,coerceColumn:()=>Se,columnsToRows:()=>Zr,computeRowHash:()=>ve,concat:()=>Tt,deduceBinaryType:()=>Ao,derive:()=>T,duration:()=>Hn,element:()=>bo,evalBinaryOp:()=>no,evalUnaryOp:()=>Ts,evaluateArg:()=>nt,evaluateExpression:()=>pe,exclude:()=>go,gatherColumnsByIndices:()=>bt,getRowFromColumns:()=>wl,implode:()=>xo,inferColumnType:()=>Fe,isEvaluatedColumn:()=>rt,kleeneBinary:()=>V,kleeneUnary:()=>I,lit:()=>it,materializeJoinedDataFrame:()=>$n,read_csv:()=>tr,read_json:()=>er,resolveColumnSelectors:()=>je,resolveExprOutputType:()=>St,resolveOperandType:()=>st,resolveWindowExpr:()=>Hr,rowsToColumns:()=>Yr,seq_range:()=>ot,struct:()=>wo,when:()=>_o,writeStringToFileOrStream:()=>Qr});module.exports=or(Il);Ht();Ht();Ne();So();wt();z();X();function er(n,{format:e="json",trimBeforeParse:t=!0,schema:r,...o}={}){let i=Rt(n,{format:e,trimBeforeParse:t,...o});if(i===n)throw new q(`Invalid JSON input: must be a valid, non-empty JSON ${e} string.`);let s=Array.isArray(i)?i:F(i)?[i]:[];return new L(s,r)}wt();z();function tr(n,e={}){let{hasHeader:t=!0,schema:r,inferSchema:o=!0}=e,i=_s(n,e);if(i.length===0)return new L({});let s,a;t?(s=i[0],a=i.slice(1)):(s=i[0].map((m,h)=>`column_${h}`),a=i);let l=s.length,u=a.length,c={};for(let m=0;m<l;m++){let h=s[m],p=new Array(u);for(let d=0;d<u;d++)p[d]=a[d][m]!==void 0?a[d][m]:"";c[h]=p}let f={};for(let m=0;m<l;m++){let h=s[m],p=c[h];if(r&&r[h])f[h]=p;else if(o){let{values:d}=xs(p,e);f[h]=d}else f[h]=p}return new L(f,r)}function Ol(n,e){return new L(n,e)}var El={data:Ol,col:n=>new U(n),all:At,exclude:go,coalesce:yo,concat:Tt,read_json:er,read_csv:tr,lit:it,when:_o,implode:xo,seq_range:ot,element:bo,struct:wo,duration:Hn,DataType:E};Ne();X();0&&(module.exports={$df,ALL_COLUMNS_MARKER,AggregationExpr,ArithmeticExpr,Array,ArrayDataType,ArrayExpr,ArrayExprNamespace,ArrayType,Binary,BinaryType,Boolean,BooleanDataType,BooleanType,COALESCE_MARKER,ColumnExpr,ColumnNotFoundError,ComparisonExpr,ComputeError,DFScriptError,DURATION_MARKER,DataFrame,DataFrameError,DataType,DataTypeRegistry,Date,DateDataType,DateTimeExprNamespace,DateType,Datetime,DatetimeType,DecimalType,Duration,DurationType,ELEMENT_MARKER,ExprBase,Float32,Float32Type,Float64,Float64Type,FloatDataType,GroupedData,IOStreamError,Int16,Int16Type,Int32,Int32Type,Int64,Int64Type,Int8,Int8Type,IntegerDataType,InvalidArgumentError,LITERAL_MARKER,LogicalExpr,NestedDataType,Null,NullType,NumericDataType,Object,ObjectDataType,ObjectType,STRUCT_MARKER,SchemaError,ShapeError,SignedIntegerType,StringExpr,StringExprNamespace,Struct,StructExpr,StructExprNamespace,StructType,TemporalDataType,TemporalExpr,Time,TimeType,UInt16,UInt16Type,UInt32,UInt32Type,UInt64,UInt64Type,UInt8,UInt8Type,UnsignedIntegerType,Utf8,Utf8Type,WHEN_MARKER,When,WhenThen,WhenThenChain,WindowExpr,alignAsofIndices,alignKeyIndices,all,assertColumnExists,assertHeight,assertNotNull,assertValidArgument,coalesce,coerceColumn,columnsToRows,computeRowHash,concat,deduceBinaryType,derive,duration,element,evalBinaryOp,evalUnaryOp,evaluateArg,evaluateExpression,exclude,gatherColumnsByIndices,getRowFromColumns,implode,inferColumnType,isEvaluatedColumn,kleeneBinary,kleeneUnary,lit,materializeJoinedDataFrame,read_csv,read_json,resolveColumnSelectors,resolveExprOutputType,resolveOperandType,resolveWindowExpr,rowsToColumns,seq_range,struct,when,writeStringToFileOrStream});
1
+ "use strict";var De=Object.defineProperty;var Ma=Object.getOwnPropertyDescriptor;var Ua=Object.getOwnPropertyNames;var Fa=Object.prototype.hasOwnProperty;var ja=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var j=(e,t)=>()=>(e&&(t=e(e=0)),t);var kr=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})},va=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ua(t))!Fa.call(e,o)&&o!==n&&De(e,o,{get:()=>t[o],enumerable:!(r=Ma(t,o))||r.enumerable});return e};var Mr=e=>va(De({},"__esModule",{value:!0}),e);var T=(e,t,n)=>ja(e,typeof t!="symbol"?t+"":t,n);var pt,Ur,Fr,pn,jr,Ba,vr,Qt=j(()=>{"use strict";pt="*",Ur="*literal*",Fr="*coalesce*",pn="*element*",jr="*struct*",Ba="*duration*",vr="*when*"});var ai=j(()=>{"use strict"});function v(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Vt(e){if(!v(e))return!1;try{if(!Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)&&Object.prototype.toString.call(e)!==Ya)return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;if(Object.getPrototypeOf(t)!==null||!Object.prototype.hasOwnProperty.call(t,"isPrototypeOf"))return!1;let n=Object.getOwnPropertyDescriptor(t,"toString");if(!n||typeof n.value!="function")return!1;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r!="function"?!1:Function.prototype.toString.call(r)===hl}catch{return!1}}function bi(e){if(typeof e!="function")return!1;try{let t=Function.prototype.toString.call(e),n=t.replace(/^(?:\s+|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*)+/,"");if(/^(?:@[\w$.]+(?:\([^)]*\))?\s+)*class\b/.test(n))return!0;let r=Object.getOwnPropertyDescriptor(e,"prototype");if(r&&!r.writable&&t.includes("[native code]")){let o=di.length;for(let i=0;i<o;i++)try{return Reflect.construct(e,di[i],gl),!0}catch{}}}catch{return!1}return!1}function Lt(e,t,n,r){if(!v(e))return!1;if(n)try{let o=n.call(e);return r!==void 0?o===r:!0}catch{return!1}try{return Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)?!1:Object.prototype.toString.call(e)===t}catch{return!1}}function L(e){if(!v(e))return!1;if(pi)try{return!Number.isNaN(pi.call(e))}catch{return!1}try{return Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)?!1:Object.prototype.toString.call(e)===Pa&&!Number.isNaN(e.getTime())}catch{return!1}}function yt(e){return Lt(e,Va,ol)}function Ce(e){return Lt(e,La,il)}function Re(e){return Lt(e,$a,sl)}function xi(e){if(!v(e))return!1;if(yi)try{return yi.call(e,"key"),!0}catch{return!1}return Lt(e,qa,void 0)}function wi(e){if(!v(e))return!1;try{if(e instanceof Error)return!0;let t=e;for(;t!==null;){if(!Object.prototype.hasOwnProperty.call(t,Symbol.toStringTag)&&Object.prototype.toString.call(t)===Ka)return!0;t=Object.getPrototypeOf(t)}}catch{return!1}return!1}function _e(e){if(!v(e))return!1;try{let t=ArrayBuffer.isView(e)?e.buffer:e;return ke(t)||!Ne(t)?!1:"detached"in t&&t.detached!==void 0?t.detached===!0:(ll?.call(t,0,0),!1)}catch{return!0}}function Ne(e){return Lt(e,Wa,al)}function ke(e){return Lt(e,za,ul)}function Ai(e){return Lt(e,Xa,cl)}function Pr(e){return Lt(e,Ga,tn,"Uint8Array")}function Si(e){return Lt(e,Ja,tn,"Uint8ClampedArray")}function tt(e){if(!v(e))return e;let t=hi.length;for(let n=0;n<t;n++){let r=hi[n];if(r)try{return r.call(e)}catch{}}return e}var Pa,Va,La,$a,Ka,qa,Ga,Ja,Wa,za,Xa,Ya,Ha,li,ui,ci,Za,Qa,tl,nl,el,rl,ol,il,sl,Br,fi,mi,tn,al,ll,ul,cl,pi,yi,fl,ml,pl,yl,dl,hl,gi,gl,bl,di,hi,Rt=j(()=>{"use strict";Pa="[object Date]",Va="[object RegExp]",La="[object Set]",$a="[object Map]",Ka="[object Error]",qa="[object URLSearchParams]",Ga="[object Uint8Array]",Ja="[object Uint8ClampedArray]",Wa="[object ArrayBuffer]",za="[object SharedArrayBuffer]",Xa="[object DataView]",Ya="[object Object]",Ha=typeof Date=="function"?Date.prototype:void 0,li=typeof RegExp=="function"?RegExp.prototype:void 0,ui=typeof Set=="function"?Set.prototype:void 0,ci=typeof Map=="function"?Map.prototype:void 0,Za=typeof URLSearchParams=="function"?URLSearchParams.prototype:void 0,Qa=typeof String=="function"?String.prototype:void 0,tl=typeof Number=="function"?Number.prototype:void 0,nl=typeof Boolean=="function"?Boolean.prototype:void 0,el=typeof BigInt=="function"?BigInt.prototype:void 0,rl=typeof Symbol=="function"?Symbol.prototype:void 0,ol=li?Object.getOwnPropertyDescriptor(li,"source")?.get:void 0,il=ui?Object.getOwnPropertyDescriptor(ui,"size")?.get:void 0,sl=ci?Object.getOwnPropertyDescriptor(ci,"size")?.get:void 0,Br=typeof ArrayBuffer=="function"?ArrayBuffer.prototype:void 0,fi=typeof SharedArrayBuffer=="function"?SharedArrayBuffer.prototype:void 0,mi=typeof DataView=="function"?DataView.prototype:void 0,tn=typeof Uint8Array=="function"?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get:void 0,al=Br?Object.getOwnPropertyDescriptor(Br,"byteLength")?.get:void 0,ll=Br?.slice,ul=fi?Object.getOwnPropertyDescriptor(fi,"byteLength")?.get:void 0,cl=mi?Object.getOwnPropertyDescriptor(mi,"byteLength")?.get:void 0,pi=Ha?.valueOf,yi=Za?.has,fl=Qa?.valueOf,ml=tl?.valueOf,pl=nl?.valueOf,yl=el?.valueOf,dl=rl?.valueOf,hl=Function.prototype.toString.call(Object);gi=function(){},gl=new Proxy(gi,{construct(){return this}}),bl=typeof ArrayBuffer=="function"?new ArrayBuffer(0):void 0,di=[[],[gi],[bl],[{}]];hi=[ml,fl,pl,yl,dl]});var Oi,Ti,nn,Vr,Lr,Me,Tt,Zn,Mt,_t,Ue,kn,Fe,Qn,te,$r,Kr,qr,ne,ee,yn,xl,Ei,Ii,Di,Ci,Ri,_i,Ni,ki,Mi,Ui,Fi,ji,vi,Bi,Pi,Vi,Li,$i,Gr,Ki,qi,Jr,Wr,Gi,Et=j(()=>{"use strict";Oi="\\r\\n|\\n|\\r",Ti=/\r\n|\n|\r/,nn=new TextEncoder,Vr=new TextDecoder("utf-8"),Lr=new TextDecoder("utf-8",{fatal:!0}),Me=6048e5,Tt=864e5,Zn=36e5,Mt=6e4,_t=1e3,Ue=1,kn=.001,Fe=1e-6,Qn=1e3,te=1e6,$r=1000n,Kr=1000000n,qr=Object.freeze({sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}),ne="\0",ee="",yn=-1,xl=4294967295,Ei=-9223372036854775808n,Ii=9223372036854775807n,Di=0n,Ci=18446744073709551615n,Ri=-2147483648,_i=2147483647,Ni=0,ki=xl,Mi=-32768,Ui=32767,Fi=0,ji=65535,vi=-128,Bi=127,Pi=0,Vi=255,Li=31,$i=127,Gr=55296,Ki=56319,qi=56320,Jr=57343,Wr=Object.freeze({9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r"}),Gi=Object.freeze({b:"\b",0:"\0",...Object.fromEntries(Object.entries(Wr).map(([e,t])=>[t.slice(1),String.fromCharCode(Number(e))]))})});function U(e,t){return typeof e!="number"?!1:Number.isNaN(e)?t?.allowNaN??t?.allowNonFiniteNumbers??!1:Number.isFinite(e)?!0:t?.allowNonFiniteNumbers??!1}function Ji(e){for(let t=1;t<e.length;t++)if(e[t].length!==3)return!1;return!0}function Hi(e,t){if(wl.test(e))return null;let n=e.trim();if(n==="")return null;n.startsWith("(")&&n.endsWith(")")&&(n="-"+n.slice(1,-1).trim());let r=n[n.length-1];(r==="-"||r==="+")&&n.length>1&&(n=r+n.slice(0,-1).trim()),t||(n=n.replace(Al,""));let o=n.includes("."),i=n.includes(",");if(o&&i){let s=n.lastIndexOf("."),a=n.lastIndexOf(","),l=a>s,c=l?".":",",u=l?a:s,f=n.slice(0,u).split(c);return f.length>1&&!Ji(f)||f[0].replace(Wi,"").length>3?null:l?n.replace(zi,"").replace(je,"."):n.replace(je,"")}if(i||o){let s=i?",":".",a=n.split(s);if(a.length>2||s===","&&a.length===2&&a[1].length===3){let l=a[0].replace(Wi,"").length;if(l===0){if(s===","||a.length>2)return null}else return l>3?null:Ji(a)?n.replace(i?je:zi,""):null}if(i)return n.replace(je,".")}return n}function $(e,{allowNonFiniteNumbers:t=!1,strictNumericString:n=!1,floatScientific:r=!0}={}){if(e==null||typeof e=="symbol")return null;switch(e=tt(e),typeof e){case"number":return U(e,{allowNonFiniteNumbers:t})?e:null;case"boolean":return e?1:0;case"bigint":{let o=Number(e);return U(o,{allowNonFiniteNumbers:t})?o:null}case"object":{if(L(e)){let o=e.getTime();return U(o,{allowNonFiniteNumbers:t})?o:null}return null}case"string":{let o=Hi(e,n);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(Yi.test(o)&&!r||!Xi.test(o))return null;let s=Number(o);return U(s,{allowNonFiniteNumbers:t})?s:null}default:return null}}function Zi({locale:e="en-US",accountingNegatives:t=!1,fallback:n="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 i=new Intl.NumberFormat(e,o);return s=>{if(typeof s=="bigint")return t&&s<0n?`(${i.format(-s)})`:i.format(s);let a=$(s,{allowNonFiniteNumbers:!0});return a===null||Number.isNaN(a)?n:Number.isFinite(a)?t&&a<0?`(${i.format(Math.abs(a))})`:i.format(a):r?n:t&&a===-1/0?`(${i.format(1/0)})`:String(a)}}function zr(e,{floatPrecision:t="Float64",allowNonFiniteNumbers:n=!0,floatScientific:r=!0,strictNumericString:o=!1}={}){let i=$(e,{allowNonFiniteNumbers:n,floatScientific:r,strictNumericString:o});return i===null||(t==="Float32"&&(i=Math.fround(i)),!U(i,{allowNonFiniteNumbers:n}))?null:i}function ve(e,t,n){if(!e)return null;let r=typeof e=="string"?t[e]:e;return r&&typeof r.min===n&&typeof r.max===n?r:null}function At(e,{range:t="Int32"}={}){if(!U(e)||!Number.isInteger(e))return!1;let n=ve(t,Qi,"number");return n!=null&&e>=n.min&&e<=n.max}function bt(e,{range:t="Int32",coerce:n="truncate"}={}){let r=$(e);if(r===null)return null;switch(n){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=ve(t,Qi,"number");return o!=null?z(r,{min:o.min,max:o.max}):null}function Mn(e,{range:t="Int64"}={}){let n=tt(e);if(typeof n!="bigint")return!1;let r=ve(t,ts,"bigint");return r!=null&&n>=r.min&&n<=r.max}function en(e,{range:t="Int64",truncate:n=!1}={}){if(e==null||typeof e=="symbol")return null;try{e=tt(e)}catch{return null}let r=null;if(typeof e=="bigint")r=e;else if(typeof e=="string"){let i=Hi(e,!1);if(i===null||!Xi.test(i))return null;if(Yi.test(i)){let s=i.search(/[eE]/),a=i.slice(0,s),l=i.slice(s+1),c=parseInt(l,10);if(Number.isNaN(c)||c>1e5||c<-1e5)return null;let u=a.startsWith("-");(u||a.startsWith("+"))&&(a=a.slice(1));let f=a.indexOf("."),p=a,m=0;f!==-1&&(m=a.length-f-1,p=a.slice(0,f)+a.slice(f+1)),p=p.replace(/^0+/,"")||"0";try{let y=BigInt(p);u&&(y=-y);let d=c-m;if(d>=0)r=y*10n**BigInt(d);else{let h=10n**BigInt(-d),g=y%h;if(!n&&g!==0n)return null;r=y/h}}catch{return null}}else{let s=i.indexOf(".");if(s!==-1){if(!n&&/[^0]/.test(i.slice(s+1)))return null;i=i.slice(0,s)}try{r=BigInt(i)}catch{return null}}}else{let i=$(e);if(i===null||!n&&!Number.isInteger(i))return null;r=BigInt(Math.trunc(i))}let o=ve(t,ts,"bigint");return!o||r<o.min||r>o.max?null:r}function Sl(e,t){let n=e-t;if(n<0||t<0)return null;if(n>15)return Number.K;let r=z(t,{min:0,max:16}),o=Math.pow(10,n)-Math.pow(10,-r);return o>0?o:null}function Xr(e,t){if(!Number.isFinite(e))return e;let n=e.toString();if(n.includes("e")){let r=Math.pow(10,t);return Math.round(e*r)/r}return+(Math.round(+(n+"e"+t))+"e"+-t)}function Be(e,{precision:t,scale:n}={}){let r=$(e);if(r===null)return null;let o=r;if(n!==void 0&&(o=Xr(o,n)),t!==void 0){let s=Sl(t,n??0);s!==null&&(o=z(o,{min:-s,max:s}))}return o}function z(e,t){if(!t)return e;let{min:n=null,max:r=null,safe:o=!0}=t;if(n!==null&&r!==null&&n>r)return n;let i=e;if(o&&typeof i=="number"){if(Number.isNaN(i))return n!==null?n:r!==null?r:e;if(i===1/0)return r!==null?r:e;if(i===-1/0)return n!==null?n:e}return n!==null&&i<n?n:r!==null&&i>r?r:i}function ns(e){let t=e|0;return function(){let n=t=t+1831565813|0;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}var Xi,wl,Al,Yi,Wi,zi,je,Qi,ts,$t=j(()=>{"use strict";Rt();Et();Xi=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,wl=/0[xobXOB]/,Al=/[\s_\u200B-\u200D\uFEFF]/g,Yi=/[eE]/;Wi=/^[+-]/,zi=/\./g,je=/,/g;Qi={Int8:{min:vi,max:Bi},Int16:{min:Mi,max:Ui},Int32:{min:Ri,max:_i},UInt8:{min:Pi,max:Vi},UInt16:{min:Fi,max:ji},UInt32:{min:Ni,max:ki}};ts={Int64:{min:Ei,max:Ii},UInt64:{min:Di,max:Ci}}});function it(e){if(!ArrayBuffer.isView(e))return!1;if(tn)return tn.call(e)!==void 0;let t=Object.prototype.toString.call(e);return t!=="[object DataView]"&&t.endsWith("Array]")}function V(e){return Array.isArray(e)||it(e)}function xt(e){return e==null?[]:Array.isArray(e)?[...e]:it(e)?Array.from(e):[e]}function Un(e,t,n){let r=e.length,o=t<-r||t>=r;if(o&&!n)throw new ot(`Index ${t} is out of bounds for array of length ${r}`);return o?null:e.at(t)??null}function os(e){if(typeof e=="function"){let t=bi(e);return{check:t?n=>n instanceof e:n=>!!e(n),coerce:n=>{if(t)return n instanceof e?n:null;let r=e(n);return typeof r=="boolean"?r?n:null:r}}}switch(e){case"string":return{check:t=>typeof t=="string",coerce:t=>String(t)};case"number":return{check:U,coerce:t=>$(t)??NaN};case"boolean":return{check:t=>typeof t=="boolean",coerce:Boolean};case"bigint":return{check:Mn,coerce:t=>en(t)};case"date":return{check:L,coerce:t=>X(t)};case"object":return{check:v,coerce:t=>v(t)?t:null};case"plainObject":return{check:Vt,coerce:t=>Vt(t)?t:null};case"null":return{check:t=>t===null,coerce:()=>null};case"undefined":return{check:t=>t===void 0,coerce:()=>{}};case"nullish":return{check:t=>t==null,coerce:()=>null};default:return{check:()=>!0,coerce:t=>t}}}function H(e,t,{mode:n="every",allowNulls:r=!1,allowEmpty:o=!0}={}){if(!V(e))return!1;let i=e,s=i.length;if(s===0)return o?n==="every":!1;let{check:a}=os(t);if(n==="every"){for(let l=0;l<s;l++){let c=i[l];if(!(r&&c==null)&&!a(c))return!1}return!0}for(let l=0;l<s;l++){let c=i[l];if(r&&c==null||a(c))return!0}return!1}function Nt(e,t="any",{mode:n="every",allowNulls:r=!1,allowEmpty:o=!0}={}){let i=xt(e),s=i.length;if(s===0){if(!o)throw new ot("Expected non-empty array");return[]}let{check:a,coerce:l}=os(t),c=new Array(s),u=0;for(let f=0;f<s;f++){let p=i[f];if(r&&p==null){c[u++]=p;continue}let m=l(p);if(a(m))c[u++]=m;else if(n==="every")throw new ot(`Failed to convert array item at index ${f} ('${p}') to target type '${t}'`)}if(n==="some"){if(u===0)throw new ot(`No items in array could be converted to target type '${t}'`);u<s&&(c.length=u)}return c}function Yr(e,t,{descending:n=!1,nullsLast:r=!0,customComp:o}={}){let s=!!(Array.isArray(n)?n[0]:n)?-1:1;if(typeof o=="function")return o(e,t)*s;if(Object.is(e,t)||e==null&&t==null)return 0;if(e==null||t==null)return(e==null?1:-1)*(r?1:-1);let a=L(e),l=L(t);if(a!==l)return a?-1:1;if(a&&l)return(e.getTime()<t.getTime()?-1:e.getTime()>t.getTime()?1:0)*s;let c=typeof e,u=typeof t,f=c==="number"||c==="bigint",p=u==="number"||u==="bigint",m=Number.isNaN(e),y=Number.isNaN(t);return m&&y?0:m||y?(m?1:-1)*(r?1:-1):f&&p?(e<t?-1:e>t?1:0)*s:c!==u?c<u?-1:1:c==="string"?e.localeCompare(t)*s:(e<t?-1:e>t?1:0)*s}function re(e,{descending:t=!1,nullsLast:n=!0,customComp:r}={}){if(!V(e))return[];let o=e,i=o.length;if(i<=1)return it(e)?Array.from(o):i===0?[]:[o[0]];let s=!!(Array.isArray(t)?t[0]:t),a=e instanceof Float32Array||e instanceof Float64Array;if(it(e)&&!r&&n&&(!a||!s)){let c=o.slice().sort();return s&&c.reverse(),Array.from(c)}let l=new Array(i);for(let c=0;c<i;c++)l[c]=o[c];return l.sort((c,u)=>Yr(c,u,{descending:t,nullsLast:n,customComp:r}))}function K(e){if(!V(e))return es;let t=e.length;if(t===0)return es;let n=null,r=null,o=null,i=null,s=0,a=0,l=0,c=0,u=0,f=1,p=0,m=0;for(let h=0;h<t;h++){let g=e[h];if(g==null){a++;continue}if(typeof g=="number"&&Number.isNaN(g)){l++,a++;continue}(n==null||g<n)&&(n=g,o=h),(r==null||g>r)&&(r=g,i=h);let x=$(g);if(x!==null){let b=c+x;Math.abs(c)>=Math.abs(x)?u+=c-b+x:u+=x-b+c,c=b,f*=x,s++;let O=x-p;p+=O/s;let w=x-p;m+=O*w}}let y=s>1?m/(s-1):0,d=l>0;return{sum:s>0?c+u:null,product:s>0?f:null,count:s,min:n,max:r,nanMin:d?NaN:n,nanMax:d?NaN:r,minIdx:o,maxIdx:i,mean:s>0?(c+u)/s:null,variance:y,std:Math.sqrt(y),nullCount:a,nanCount:l,len:t,hasNulls:a>0,isNumeric:s>0&&s===t-a}}function rn(e,{strict:t=!1,keySelector:n}={}){let r=Array.from(e),o=new Map;if(t){let s=n??ut,a=new Map,l=r.length;for(let u=0;u<l;u++){let f=r[u],p=s(f),m=a.get(p);m===void 0?a.set(p,{val:f,count:1}):m.count++}let c=[];for(let u of a.values())c.push(u.val);for(let u=0;u<l;u++){let f=r[u],p=s(f),m=a.get(p);o.set(f,m.count)}return{values:c,count:c.length,frequencies:o}}let i=r.length;for(let s=0;s<i;s++){let a=r[s];o.set(a,(o.get(a)??0)+1)}return{values:Array.from(o.keys()),count:o.size,frequencies:o}}function Pe(e,{step:t=1,offsetStart:n=0,offsetEnd:r,maxItemsGathered:o,nullOnOob:i=!0}={}){if(e==null)return null;if(o!==void 0&&o<=0)return[];if(t===0)throw new N("Step size step cannot be zero");let s=e.length;if(s===0?n!==0:n>=s||n<-s){if(!i)throw new ot(`Start offset ${n} is out of bounds for array of length ${s}`);return null}let l=n<0?s+n:n,c=r!==void 0?r<0?s+r:r:t>0?s:-1,u=[];if(t>0)for(let f=l;f<c&&f<s&&!(f>=0&&(u.push(e[f]),o!==void 0&&u.length>=o));f+=t);else for(let f=l;f>c&&f>=0&&!(f<s&&(u.push(e[f]),o!==void 0&&u.length>=o));f+=t);return u}function Ve(e,t=",",{ignoreNulls:n=!1,nullValue:r="",prefix:o="",suffix:i="",limit:s,truncationMarker:a="...",valueFormatter:l}={}){let c=e.length,u=[],f=z(s??c,{min:0}),p=!1;for(let m=0;m<c;m++){if(u.length>=f){p=!0;break}let y=e[m];y!=null?u.push(l?l(y,m):String(y)):n||u.push(r)}return o+u.join(t)+(p?a:"")+i}function is(e,t,n={}){let r=e.length,{mode:o="cumulative",step:i=1,coerce:s=d=>d,condition:a,reverse:l=!1,startIndex:c=l?r-1:0,endIndex:u=l?-1:r}=n,f=l?-1:1,p=c,m=u,y=(d,h)=>{(!a||a(e[d],d,e))&&(e[d]=s(h))};if(o==="constant"){let d=s(t);for(let h=p;l?h>m:h<m;h+=f)y(h,d)}else if(o==="independent")if(typeof i=="function"){let d=0;for(let h=p;l?h>m:h<m;h+=f)y(h,i({index:d,initialValue:t,originalValue:e[h],absoluteIndex:h,targetArray:e})),d++}else for(let d=p;l?d>m:d<m;d+=f)y(d,t+d*i);else{let d=t,h=!0,g=0;for(let x=p;l?x>m:x<m;x+=f)h?(y(x,d),h=!1):(typeof i=="function"?d=i({prev:d,index:g,originalValue:e[x],absoluteIndex:x,targetArray:e}):d=d+i,y(x,d)),g++}}function Ol(e){let t=e.length,n=0,r=new Float64Array(t);for(let i=0;i<t;i++){let s=e[i],a=$(s,{allowNonFiniteNumbers:!0});a!==null&&U(a,{allowNonFiniteNumbers:!0,allowNaN:!1})&&(r[n++]=a)}if(n===0)return null;let o=r.subarray(0,n);return o.sort(),o}function dn(e,t){if(t<0||t>1)return null;let n=Ol(e);if(!n)return null;let r=n.length,o=t*(r-1),i=Math.floor(o),s=Math.ceil(o);return i===s?n[i]:n[i]+(o-i)*(n[s]-n[i])}function Le(e){if(!V(e)||e.length===0)return null;let t=new Map,n=e.length,r=0,o=[];for(let i=0;i<n;i++){let s=e[i];if(s==null||typeof s=="number"&&!U(s,{allowNonFiniteNumbers:!0,allowNaN:!1}))continue;let a=(t.get(s)??0)+1;t.set(s,a),a>r?(r=a,o=[s]):a===r&&o.push(s)}return o.length===0?null:re(o)}function ss(e,t){let n=e.length;if(n===0)return[];let r=Math.trunc(t);if(isNaN(r)||r===0)return xt(e);let o=Math.abs(r);if(o>=n)return new Array(n).fill(null);let i=new Array(n);if(r>0){i.fill(null,0,r);for(let s=r;s<n;s++){let a=e[s-r];i[s]=a??null}}else{let s=n-o;for(let a=0;a<s;a++){let l=e[a+o];i[a]=l??null}i.fill(null,s,n)}return i}function as(e){let t=e.length,n=new Float64Array(t),r=new Float64Array(t),o=0;for(let i=0;i<t;i++){let s=e[i];if(!s)continue;let a=$(s[0]),l=$(s[1]);a===null||l===null||(n[o]=a,r[o]=l,o++)}return{xArr:n,yArr:r,count:o}}function ls(e,t,n){if(n<2)return null;let r=0,o=0,i=0,s=0,a=0;for(let f=0;f<n;f++){let p=e[f],m=t[f],y=p-r;r+=y/(f+1);let d=p-r,h=m-o;o+=h/(f+1);let g=m-o;a+=y*g,i+=y*d,s+=h*g}let l=a/(n-1);if(i===0||s===0)return{covariance:l,correlation:null};let c=Math.sqrt(i*s);if(c===0||Number.isNaN(c))return{covariance:l,correlation:null};let u=z(a/c,{min:-1,max:1});return{covariance:l,correlation:u}}function Hr(e){let{xArr:t,yArr:n,count:r}=as(e);return r<2?{covariance:null,correlation:null}:ls(t,n,r)??{covariance:null,correlation:null}}function rs(e){let t=e.length,n=new Int32Array(t);for(let i=0;i<t;i++)n[i]=i;n.sort((i,s)=>e[i]-e[s]);let r=new Float64Array(t),o=0;for(;o<t;){let i=o+1;for(;i<t&&e[n[i]]===e[n[o]];)i++;let s=(o+1+i)/2;for(let a=o;a<i;a++)r[n[a]]=s;o=i}return r}function Tl(e,t,n){let r=ls(e,t,n);return r?r.correlation:null}function us(e){let{xArr:t,yArr:n,count:r}=as(e);if(r<2)return null;let o=rs(t.subarray(0,r)),i=rs(n.subarray(0,r));return Tl(o,i,r)}function cs(e){let t=e.length,n=0,r=0;for(let o=0;o<t;o++){let i=e[o];if(!i)continue;let s=$(i[0]),a=$(i[1]);s===null||a===null||(n+=s*a,r++)}return r>0?n:null}function fs(e){let t=e.length,n=0,r=0,o=0;for(let i=0;i<t;i++){let s=e[i];if(!s)continue;let a=$(s[0]),l=$(s[1]);a===null||l===null||(n+=a*l,r+=l,o++)}return o===0||Math.abs(r)<1e-12?null:n/r}function ms(e,t){let n=z(Math.floor(e||0),{min:0}),r=z(Math.floor(t||0),{min:0}),o=n*r;if(!At(o,{range:"UInt32"}))throw new N(`Cartesian product size (${o} rows) exceeds maximum JavaScript array capacity.`);let i=new Array(o),s=new Array(o),a=0;for(let l=0;l<n;l++)for(let c=0;c<r;c++)i[a]=l,s[a]=c,a++;return{leftIndices:i,rightIndices:s}}function hn(e,t,n={}){let r=n.side==="right",o=n.getValue,i=0,s=e.length;for(;i<s;){let a=i+s>>>1,l=o?o(a,e[a]):e[a];(r?l<=t:l<t)?i=a+1:s=a}return i}function ps(e){if(!V(e))return null;let{mean:t,count:n}=K(e);if(n<2||t===null)return null;let r=0,o=0,i=0,s=e.length;for(let a=0;a<s;a++){let l=$(e[a]);if(l===null)continue;let c=l-t,u=c*c;r+=u,o+=u*c,i+=u*u}return r<=0?null:{count:n,mean:t,m2Sum:r,m3Sum:o,m4Sum:i}}function ys(e,t={}){let n=ps(e);if(!n)return null;let{count:r,m2Sum:o,m3Sum:i}=n,s=o/r,l=i/r/Math.pow(s,1.5);if(t?.bias??!0)return U(l)?l:null;if(r<3)return null;let u=Math.sqrt(r*(r-1))/(r-2)*l;return U(u)?u:null}function ds(e,t={}){let n=ps(e);if(!n)return null;let{count:r,m2Sum:o,m4Sum:i}=n,s=o/r,l=i/r/(s*s),c=l-3,u=t?.fisher??!0;if(t?.bias??!0){let y=u?c:l;return U(y)?y:null}if(r<4)return null;let p=(r-1)/((r-2)*(r-3))*((r+1)*c+6),m=u?p:p+3;return U(m)?m:null}function hs(e,t={}){if(!e||e.length===0)return null;let{base:n=Math.E,normalize:r=!0}=t;if(n<=0||n===1)return null;let o=e.length,i=Math.log(n);if(r){let s=new Map,a=0;for(let c=0;c<o;c++){let u=e[c];if(u==null||Number.isNaN(u))continue;let f=ut(u);s.set(f,(s.get(f)||0)+1),a++}if(a===0)return null;let l=0;for(let c of s.values()){let u=c/a;u>0&&(l-=u*(Math.log(u)/i))}return U(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}else{let s=[],a=0;for(let u=0;u<o;u++){let f=e[u];if(f==null||Number.isNaN(f))continue;let p=Number(f);if(!U(p)||p<0)return null;p>0&&(s.push(p),a+=p)}if(s.length===0||a<=0)return null;let l=0,c=s.length;for(let u=0;u<c;u++){let f=s[u]/a;f>0&&(l-=f*(Math.log(f)/i))}return U(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}}function $e(e,t){if(!e||e.length===0)return null;let n=null,r=e.length;for(let o=0;o<r;o++){let i=en(e[o],{range:"Int64"});i!==null&&(n=n===null?i:t(n,i))}return n===null?null:n>=Number.St&&n<=Number.K?Number(n):n}function Zr(e,t){if(!e||e.length===0)return null;let n=e.length,r=new Array(n),o=new Array(n);for(let s=0;s<n;s++){let a=e[s];r[s]=a?.[0],o[s]=a?.[1]}let i=K(o)[t];return i!==null?r[i]:null}function Fn(e,t,n={}){if(!e||e.length===0)return[];let r=e.length,{nullify:o=!1}=n,i=V(t);if(!i&&!t)return o?new Array(r).fill(null):[];let s=[];for(let a=0;a<r;a++)(i?t[a]:t)?s.push(e[a]):o&&s.push(null);return s}var es,oe=j(()=>{"use strict";Rt();$t();ie();gn();nt();es={sum:null,product:null,count:0,min:null,max:null,nanMin:null,nanMax:null,minIdx:null,maxIdx:null,mean:null,variance:0,std:0,nullCount:0,nanCount:0,len:0,hasNulls:!1,isNumeric:!1}});function bs(e,t={}){let n=t?.trim?dt(e)??"":e,r=n.length;if(r<2)return!1;let o=n[0],i=n[r-1];return o==="{"&&i==="}"||o==="["&&i==="]"}function se(e,t={}){let n="fallback"in t?t.fallback:e;if(typeof e!="string")return n;let{format:r="json",allowPrimitives:o=!1,trimBeforeParse:i=!1,reviver:s,ndjson:a={},guard:l,onError:c}=t,u=i?e.trim():e;try{let f;if(r==="ndjson"){let{skipInvalidLines:p=!1,maxLines:m,skipLines:y=0}=a,d=[],h=new RegExp(Oi,"g"),g=0,x=0;for(;m===void 0||d.length<m;){let O=h.exec(u),w=(O?u.substring(g,O.index):u.substring(g)).trim();if(O&&(g=h.lastIndex),w===""){if(!O)break;continue}if(x++,x<=y){if(!O)break;continue}if(!o&&!bs(w)){if(!p)throw new N("NDJSON line is not wrapped and primitives are disallowed");if(!O)break;continue}try{d.push(JSON.parse(w,s))}catch(S){if(!p)throw S}if(!O)break}let b=x>y;if(d.length===0&&b&&m!==0)throw new Kt("No valid NDJSON lines processed");f=d}else{if(!o&&!bs(u,{trim:!i}))throw new N("JSON string is not wrapped and primitives are disallowed");f=JSON.parse(u,s)}if(l&&!l(f))throw new N("Parsed value failed guard validation");return f}catch(f){try{c?.(f)}catch{}return n}}function on(e={}){let t=e.bigintStrategy??"string",n=e.handleCircular?new WeakSet:null,r=Array.isArray(e.replacer)?e.replacer.map(String):null;return function(i,s){let a=s;if(typeof e.replacer=="function")a=e.replacer.call(this,i,s);else if(r&&i!==""&&!Array.isArray(this)&&!r.includes(i))return;if(a===void 0)return;let l=a===s&&this!=null?this[i]:a;if(typeof e.onCustom=="function"){let f=e.onCustom.call(this,i,l);if(f!==l||f===void 0&&l!==void 0)return f}let c=a!==null&&typeof a=="object"||typeof a=="bigint"?a:l,u=v(c)?tt(c):c;if(u!==null&&typeof u!="object"&&typeof u!="bigint")return a;if(n&&(v(u)||Array.isArray(u))){if(i===""&&(n=new WeakSet),n.has(u))return e.onCircular?e.onCircular.call(this,i,u):"[Circular]";n.add(u)}return typeof u=="bigint"?e.voidBigIntReplacement?a:e.onBigInt?e.onBigInt(u):t==="number"&&Mn(u,{range:{min:BigInt(Number.St),max:BigInt(Number.K)}})?Number(u):u.toString():it(u)?e.voidTypedArrayReplacement?a:e.onTypedArray?e.onTypedArray(u):Array.from(u):Ce(u)?e.voidSetReplacement?a:e.onSet?e.onSet(u):Array.from(u):Re(u)?e.voidMapReplacement?a:e.onMap?e.onMap(u):Array.from(u.entries()):yt(u)?e.voidRegExpReplacement?a:e.onRegExp?e.onRegExp(u):u.toString():L(u)?e.voidDateReplacement?a:e.onDate?e.onDate(u):e.formatDate?e.formatDate(u):u.toISOString():wi(u)?e.onError?e.onError(u):{name:u.name,message:u.message,stack:u.stack}:xi(u)?e.onURLSearchParams?e.onURLSearchParams(u):u.toString():a}}function El(e){let t=e.trim().replace(/^\$/,"");if(!t)return[];let n=[],r=/\.\.\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*))\s*\]|\.\.([^\.\[]+)|\.([\w$-]+|\*)|\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*)|(-?\d*(?::-?\d*){0,2}))\s*\]/g,o,i=0;for(;(o=r.exec(t))!==null;){if(o.index!==i)return null;i=r.lastIndex;let[,s,a,l,c,u,f,p,m,y]=o,d=s??a,h=f??p;if(d!==void 0)n.push({type:"rec",key:xs(d)});else if(l!==void 0)n.push({type:"rec",key:Qr});else if(c!==void 0)n.push({type:"rec",key:c});else if(u!==void 0)n.push(u===Qr?{type:"wildcard"}:{type:"prop",key:u});else if(h!==void 0)n.push({type:"prop",key:xs(h)});else if(m!==void 0)n.push({type:"wildcard"});else if(y!==void 0)if(y.includes(":")){let[g,x,b]=y.split(":");n.push({type:"slice",start:bt(g)??void 0,end:bt(x)??void 0,step:bt(b)??1})}else{let g=bt(y);if(g===null)return null;n.push({type:"idx",idx:g})}}return i===t.length?n:null}function As(e,t,n,r=new Set){if(e==null||!ws(t.key)||typeof e!="object"||r.has(e))return;r.add(e);let o=Array.isArray(e);if(!o&&!v(e))return;t.key===Qr?Ss(e,{type:"wildcard"},n):!o&&Object.prototype.hasOwnProperty.call(e,t.key)&&n.push(e[t.key]);let i=o?e:Object.values(e);for(let s=0;s<i.length;s++)As(i[s],t,n,r)}function Ss(e,t,n){if(e!=null)switch(t.type){case"prop":v(e)&&ws(t.key)&&Object.prototype.hasOwnProperty.call(e,t.key)&&n.push(e[t.key]);break;case"idx":{if(!Array.isArray(e))break;let r=t.idx<0?e.length+t.idx:t.idx;r>=0&&r<e.length&&n.push(e[r]);break}case"slice":{if(!Array.isArray(e)||t.step===0)break;let r=t.step??1,o=t.start??(r>0?0:e.length-1),i=Pe(e,{step:r,offsetStart:o,offsetEnd:t.end,nullOnOob:!0});if(i)for(let s=0;s<i.length;s++)n.push(i[s]);break}case"wildcard":{let r=Array.isArray(e)?e:v(e)?Object.values(e):null;if(r)for(let o=0;o<r.length;o++)n.push(r[o]);break}case"rec":As(e,t,n);break}}function Os(e,t){if(e==null||Ts(t))return null;let n=e;if(typeof e=="string"){let s=e.trim();if(s==="")return null;let a=se(s,{allowPrimitives:!0,fallback:gs});if(a===gs)throw new N(`Invalid JSON string encountered in jsonPathMatch: "${e}"`);n=a}let r=El(t);if(r===null)return null;let o=[n];for(let s=0;s<r.length;s++){if(o.length===0)return null;let a=[];for(let l=0;l<o.length;l++)Ss(o[l],r[s],a);o=a}if(o.length===0||o[0]==null)return null;let i=o[0];if(v(i)||Array.isArray(i))try{return JSON.stringify(i,on({handleCircular:!0}))}catch{return null}return String(i)}var gs,Qr,xs,ws,ae=j(()=>{"use strict";oe();Rt();$t();gn();nt();Et();gs=Symbol("invalid");Qr="*",xs=e=>e.replace(/\\(.)/g,(t,n)=>Gi[n]??n),ws=e=>e!==void 0&&e!=="__proto__"&&e!=="constructor"&&e!=="prototype"});function Il(e){return!v(e)||_e(e)?!1:ArrayBuffer.isView(e)?Pr(e)||Si(e)||Ai(e):Ne(e)||ke(e)}function Is(e,t){if(e==null)return!1;try{if(Il(e))return!0;if(t?.strict)return!1;if(typeof e=="string")return!0;if(ArrayBuffer.isView(e))return!_e(e);if(Array.isArray(e))return H(e,Es)}catch{return!1}return!1}function Ke(e,t){if(e==null)return null;try{if(Pr(e))return e;if(_e(e))return null;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Ne(e)||ke(e))return new Uint8Array(e);if(t?.strict)return null;if(typeof e=="string")return nn.encode(e);if(Array.isArray(e)&&H(e,Es))return Uint8Array.from(e)}catch{return null}return null}var Dl,Es,to=j(()=>{"use strict";Rt();$t();oe();Et();Dl={range:"UInt8"},Es=e=>At(e,Dl)});function Ts(e){let t=tt(e);return typeof t=="string"?t.trim().length===0:!1}function Ds(e,t="both"){return t==="start"?e.trimStart():t==="end"?e.trimEnd():e.trim()}function dt(e,t=null,n={}){let{mode:r="both",returnStringOnNull:o=!1,maxScanStart:i=1,maxScanEnd:s=1,maxMatchesStart:a=1,maxMatchesEnd:l=1,trimFirst:c=!1,stringOptions:u}=n;if(e==null)return o?"":null;let f=R=>o||R.length>0?R:null;if(t==null)return f(Ds(e,r));let p=c?Ds(e,r):e,m=p.length;if(m===0)return o?"":null;let y=yt(t);if(!y&&typeof t!="string"||typeof t=="string"&&t.length===0)return f(p);let{literal:d=!1,caseInsensitive:h=!1}=u??{},g=y?t:d?It(t):`[${It(t)}]+`,x=y&&t.ignoreCase||h,b=vs(p,g,0,{asciiCaseInsensitive:x},()=>null),O=b.length;if(O===0)return f(p);let w=new Uint8Array(m),S=!1,I=(R,F,E)=>{if(E===0)return;let _=0,P=R?0:m,W=0,B=R?0:O-1,lt=R?O:-1,kt=R?1:-1;for(let ft=B;ft!==lt;ft+=kt){let mt=b[ft],zn=R?mt.start-P:P-mt.end;if(zn>0&&(_+=zn,F!==null&&F>=0&&_>=F)||((zn>0||d||W===0)&&W++,E!==null&&E>=0&&W>E))break;for(let mn=mt.start;mn<mt.end;mn++)w[mn]=1;S=!0,P=R?mt.end:mt.start}};if((r==="both"||r==="start")&&I(!0,i,a),(r==="both"||r==="end")&&I(!1,s,l),!S)return f(p);let C="";for(let R=0;R<m;R++)w[R]===0&&(C+=p[R]);return f(C)}function ut(e,{depth:t=0,maxDepth:n=50}={}){if(t>n)return"v:circular";if(e===null)return"v:null";if(e===void 0)return"v:undefined";if(e=tt(e),L(e))return`d:${e.getTime()}`;if(it(e)){let o=e.toString();return`u:${e.constructor.name}:${o.length}:${o}`}if(Array.isArray(e)){let o=e.length,i=new Array(o),s={depth:t+1,maxDepth:n};for(let a=0;a<o;a++)i[a]=ut(e[a],s);return`a:[${i.join(ee)}]`}if(Ce(e)){let o=Array.from(e),i=o.length,s=new Array(i),a={depth:t+1,maxDepth:n};for(let l=0;l<i;l++)s[l]=ut(o[l],a);return s.sort(),`set:[${s.join(ee)}]`}if(Re(e)){let o=Array.from(e.keys()),i=o.length,s=new Array(i),a={depth:t+1,maxDepth:n};for(let l=0;l<i;l++){let c=o[l],u;try{u=e.get(c)}catch{u="v:error"}s[l]=`${ut(c,a)}${ne}${ut(u,a)}`}return s.sort(),`map:{${s.join(ee)}}`}if(typeof e=="object"&&typeof e.toJSON=="function")try{let o=e.toJSON();if(o!==e)return`j:${ut(o,{depth:t+1,maxDepth:n})}`}catch{}if(yt(e)){let o=e.toString();return`r:${o.length}:${o}`}if(Vt(e)){let o=Object.keys(e).sort(),i=o.length,s=new Array(i),a={depth:t+1,maxDepth:n};for(let l=0;l<i;l++){let c=o[l],u;try{u=e[c]}catch{u="v:error"}s[l]=`${ut(c,a)}${ne}${ut(u,a)}`}return`o:{${s.join(ee)}}`}if(typeof e=="function"){let o=e.toString();return`f:${o.length}:${o}`}if(typeof e=="string")return`s:${e.length}:${e}`;if(typeof e=="symbol"){let o=e.toString();return`y:${o.length}:${o}`}if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return`${typeof e}:${e}`;let r=String(e);return`${typeof e}:${r.length}:${r}`}function Nl(e){if(e==null)return[];let t=String(e);if(!t)return[];let r=t.normalize("NFC").replace(Cl,"$1").match(Rl)||[],o=[];for(let i=0;i<r.length;i++){let s=r[i];_l.has(s)||o.push(s)}return o}function no(e,t=0){let n=e.codePointAt(t);return n!=null&&n>65535?2:1}function vn(e,t){let n=Nl(e),r=n.length;if(r===0)return"";let{format:o}=t??{};if(o==="camel"||o==="pascal"||o==="title"){let i=o==="title"?" ":"",s=new Array(r);for(let a=0;a<r;a++){let l=n[a];if(a===0&&o==="camel")s[a]=l.toLowerCase();else{let c=no(l,0);s[a]=l.slice(0,c).toUpperCase()+l.slice(c).toLowerCase()}}return s.join(i)}if(o==="kebab"||o==="snake"){let i=o==="kebab"?"-":"_",s=new Array(r);for(let a=0;a<r;a++)s[a]=n[a].toLowerCase();return s.join(i)}return n.join(" ")}function Ms(e){return typeof e!="string"&&(e=String(e)),nn.encode(e)}function vl(e){let t=Ke(e);if(!t)return"";if(Ns&&typeof Uint8Array.prototype.toBase64=="function")return t.toBase64();if(qe)return le.from(t).toString("base64");let n="",r=t.length;for(let o=0;o<r;o+=Cs){let i=t.subarray(o,o+Cs);n+=String.fromCharCode.apply(null,i)}return btoa(n)}function Bl(e){if(typeof e!="string"&&(e=String(e)),qe)return le.from(e,"utf-8").toString("hex");let t=Ms(e),n=t.length,r="";for(let o=0;o<n;o++)r+=ks[t[o]];return r}function Pl(e){typeof e!="string"&&(e=String(e));let t=Ms(e);return vl(t)}function Us(e,t){if(e==null)return null;let n=Vl[t];if(!n)throw new Error(`Unsupported encoding: '${t}'. Supported encodings are 'hex' and 'base64'.`);return n(String(e))}function Ll(e){typeof e!="string"&&(e=String(e));let t=e.replace(Ul,r=>Ml[r]),n=t.length%4;return n===0?t:t.padEnd(t.length+(4-n),"=")}function $l(e,t=!0){if(typeof e!="string"&&(e=String(e)),e!==""&&(e.length%4!==0||!Fl.test(e)))throw new Error("Invalid base64 encoding format");if(Ns)return Uint8Array.fromBase64(e,{strict:t});if(qe)return new Uint8Array(le.from(e,"base64"));let n=atob(e),r=n.length,o=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=n.charCodeAt(i);return o}function Kl(e){typeof e!="string"&&(e=String(e));let t=e.trim();if(t.length%2!==0||!jl.test(t))throw new Error("Invalid hex string format");if(kl)return Uint8Array.fromHex(t);if(qe){let r=le.from(t,"hex");if(r.length!==t.length/2)throw new Error("Invalid hex string format");return new Uint8Array(r)}let n=new Uint8Array(t.length/2);for(let r=0;r<n.length;r++){let o=parseInt(t.substring(r*2,r*2+2),16);if(Number.isNaN(o))throw new Error("Invalid hex string format");n[r]=o}return n}function ql(e,t=!0){if(e==null)return null;try{let n=Kl(e);return(t?Lr:Vr).decode(n)}catch(n){if(t)throw n;return null}}function Gl(e,t=!0){if(e==null)return null;try{let n=typeof e=="string"?e.trim():String(e).trim(),r=Ll(n),o=$l(r,t);return(t?Lr:Vr).decode(o)}catch(n){if(t)throw n;return null}}function Fs(e,t,n={}){if(e==null)return null;let r=Jl[t];if(!r)throw new Error(`Unsupported encoding: '${t}'. Supported encodings are 'hex' and 'base64'.`);let o=typeof n=="boolean"?n:n.strict??!0;return r(String(e),o)}function Yl(e,t={}){if(!At(e,{range:"UInt16"}))return!1;let{type:n="all"}=t;switch(n){case"high":return e>=Gr&&e<=Ki;case"low":return e>=qi&&e<=Jr;case"all":return e>=Gr&&e<=Jr;default:return!1}}function Rs(e){let t=e.codePointAt(0),n=t<=Li||t===$i,r=e.length===1&&Yl(t);if(n||r){let o=Wr[t];if(o)return o;let i=t.toString(16);return n?`\\x${i.padStart(2,"0")}`:`\\u${i.padStart(4,"0")}`}return"\\"+e}function It(e,t){let n=tt(e);if(n==null)return"";let r=yt(n)?n.source:typeof n=="string"?n:String(n);return(t?.mode??"tc39")==="tc39"?typeof RegExp.escape=="function"&&!Wl.test(r)?RegExp.escape(r):r.replace(zl,Rs):r.replace(Xl,Rs)}function bn(e,t,n){if(e==null||t==null)return null;let r=typeof e=="string"?e:String(e),o=n?.global??!1;try{let i=yt(t),s=i?t.source:typeof t=="string"?t:String(t),a=i?t.flags.replace(/y/g,""):"";if(o?a.includes("g")||(a+="g"):a=a.replace(/g/g,""),n?.asciiCaseInsensitive!==void 0&&(a=n.asciiCaseInsensitive?a.includes("i")?a:a+"i":a.replace(/i/g,"")),(s.includes("\\p{")||s.includes("\\P{"))&&!a.includes("u")&&!a.includes("v"))try{let c=new RegExp(s,a+"u");return c.lastIndex=0,{reg:c,input:r}}catch{try{let c=new RegExp(s,a+"v");return c.lastIndex=0,{reg:c,input:r}}catch{}}let l=new RegExp(s,a);return l.lastIndex=0,{reg:l,input:r}}catch{return null}}function _s(e){let t=Object.create(null);e.index!==void 0&&Object.defineProperty(t,"_index",{value:String(e.index),writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"_length",{value:e.length,writable:!0,enumerable:!1,configurable:!0});for(let n=0;n<e.length;n++)t[String(n)]=e[n]!==void 0?e[n]:null;if(e.groups)for(let n in e.groups){let r=e.groups[n];t[n]=r!==void 0?r:null}return t}function eo(e,t){if(typeof t=="string")return t in e?e[t]:null;let n=Number(t);if(Number.isNaN(n))return null;let r=Math.trunc(n);if(r>=0)return e[String(r)]??null;let i=(e.It??0)+r;return i>=1?e[String(i)]??null:null}function vs(e,t,n,r,o){let{literal:i=!1,mode:s,asciiCaseInsensitive:a=!1}=r??{},l=i?It(t,{mode:s}):t,u=bn(e,l,{global:!0,asciiCaseInsensitive:a})?.reg??null;if(!u)return[];let f=[];u.lastIndex=0;let p;for(;(p=u.exec(e))!==null;){let m=p.index,y=u.lastIndex,d=o(p,m,y);if(f.push({start:m,end:y,patternIndex:n,payload:d}),m===y){if(m===e.length)break;u.lastIndex=m+no(e,m)}}return f}function Bs(e){if(e.length<=1)return e;e.sort((o,i)=>{if(o.start!==i.start)return o.start-i.start;let s=o.patternIndex??o.i??0,a=i.patternIndex??i.i??0;return s-a});let t=[],n=0,r=e.length;for(let o=0;o<r;o++){let i=e[o];i.start>=n&&(t.push(i),n=i.end)}return t}function Ps(e,t,n,r,o){let{overlapping:i=!1,leftmost:s,...a}=n??{},l=s??!0;if(i&&s)throw new N("Cannot specify both 'overlapping' and 'leftmost' as true.");if(e==null||t==null)return null;let c=xt(t),u=c.length;if(u===0)return[];if(i){let m=new Array(u);for(let y=0;y<u;y++)m[y]=r(c[y]);return m}let f=[];for(let m=0;m<u;m++){let y=Ge(e,c[m],{...a,global:!1});if(y&&y[0]&&y[0].At!=null){let d=Number(y[0].At),h=y[0][0]?.length??0;f.push({i:m,start:d,end:d+h,payload:o(y[0],d)})}}let p=new Array(u).fill(null);if(f.length===0)return p;if(l){let m=Bs(f);for(let y=0;y<m.length;y++){let d=m[y];p[d.i]=d.payload}}else{let m=[];f.sort((h,g)=>h.i-g.i);let y=f.length;for(let h=0;h<y;h++){let g=f[h],x=!1,b=m.length;for(let O=0;O<b;O++){let w=m[O],S=!1;if(g.start===g.end&&w.start===w.end?S=g.start===w.start:w.start===w.end?S=w.start>=g.start&&w.start<g.end:g.start===g.end?S=g.start>=w.start&&g.start<w.end:S=g.start<w.end&&g.end>w.start,S){x=!0;break}}x||m.push(g)}let d=m.length;for(let h=0;h<d;h++){let g=m[h];p[g.i]=g.payload}}return p}function Ge(e,t,n){let r=bn(e,t,n);if(!r)return null;if(!n?.global){let s=r.input.match(r.reg);return s?[_s(s)]:null}let o=Array.from(r.input.matchAll(r.reg));if(o.length===0)return null;let i=new Array(o.length);for(let s=0;s<o.length;s++)i[s]=_s(o[s]);return i}function ro(e,t,n){let r=Ge(e,t,n);return r?eo(r[0],n?.groupIndex??1):null}function Vs(e,t,n){let r=Ge(e,t,{...n,global:!0});if(!r)return null;let o=n?.groupIndex??0,i=new Array(r.length);for(let s=0;s<r.length;s++)i[s]=eo(r[s],o);return i}function Ls(e,t,n){return Ge(e,t,n)?.[0]??null}function $s(e,t,n){let r=n?.groupIndex??0;return Ps(e,t,n,o=>ro(e,o,{...n,groupIndex:r}),o=>eo(o,r))}function oo(e,t){return yt(e)?new RegExp(It(e,{mode:t}),e.flags):It(e,{mode:t})}function jn(e,t,n){if(e==null||t==null)return null;let{literal:r=!1,mode:o,...i}=n??{},s=r?oo(t,o):t,a=bn(e,s,{...i,global:!1});if(!a)return null;let l=a.input.match(a.reg);return!l||l.index==null?null:nn.encode(a.input.slice(0,l.index)).length}function Ks(e,t,n){if(n?.literal){if(e==null||t==null)return null;let r=xt(t),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=jn(e,r[i],n);return o}return Ps(e,t,n,r=>jn(e,r,n),(r,o)=>nn.encode(e.slice(0,o)).length)}function qs(e,t,n){if(e==null||t==null)return null;let{literal:r=!0,inclusive:o=!1,limit:i,exact:s=!1,strict:a=!1,mode:l,...c}=n??{},u=r?oo(t,l):t,f=bn(e,u,{...c,global:!0});if(!f)return null;let{reg:p}=f;p.lastIndex=0;let m=[],y=0,d=0,h=i!=null&&i>=0?i:1/0,g;for(;d<h&&(g=p.exec(e))!==null;){let b=g.index,O=p.lastIndex;if(b===O){if(b===e.length||b>0&&b>=y&&(m.push(e.slice(y,b)),d++,y=b,d>=h))break;p.lastIndex=b+no(e,b);continue}m.push(e.slice(y,o?O:b)),y=O,d++}if(m.push(e.slice(y)),i==null||i<0)return m;let x=i+1;if(a&&m.length<x)throw new N(`split exact error: expected string to split into at least ${x} parts, but got ${m.length}`);if(s)for(;m.length<x;)m.push(null);return m}function Gs(e,t,n,r,o,i){return e.includes("$")?e.replace(/\$\$|\$([$'`&]|\d{1,2}|<[^>]+>)/g,(s,a)=>{if(s==="$$"||a==="$")return"$";if(!a)return s;if(a==="&")return t;if(a==="`")return r.slice(0,n);if(a==="'")return r.slice(n+t.length);if(a.startsWith("<"))return i?i[a.slice(1,-1)]??"":s;let l=Number(a);if(l>0&&l<=o.length)return o[l-1]??"";if(a.length===2){let c=Number(a[0]);if(c>0&&c<=o.length)return(o[c-1]??"")+a[1]}return s}):e}function ue(e,t,n,r){if(e==null||t==null||n==null)return null;let o=typeof e=="string"?e:String(e),{literal:i=!1,n:s,mode:a,...l}=r??{},c=s??(l?.global?1/0:1),u=U(c,{allowNonFiniteNumbers:!0,allowNaN:!1})?Math.trunc(c):1;if(u===0)return o;let f=i?oo(t,a):t,p=bn(o,f,{...l,global:l?.global??u!==1});if(!p)return o;let{reg:m}=p,y=typeof n=="function";if(u===1||u<0||u===1/0){if(i&&!y){let g=String(n);return o.replace(m,()=>g)}return o.replace(m,n)}let d=0,h=y?"":String(n);return o.replace(m,(...g)=>{if(d++>=u)return g[0];if(y)return String(n(...g));if(i)return h;let x=g.length,b=typeof g[x-1]=="object"&&g[x-1]!==null,O=b?g[x-1]:void 0,w=b?g[x-3]:g[x-2],S=g.slice(1,b?x-3:x-2);return Gs(h,g[0],w,o,S,O)})}function Js(e,t,n,r){if(e==null||t==null)return null;let o=typeof e=="string"?e:String(e),i=Vt(t);if(!i&&!Array.isArray(t))return o;let s=i?Object.keys(t):t,a=s.length;if(a===0)return o;let l=null,c=null;if(i)l=Object.values(t);else if(Array.isArray(n))if(n.length===1&&a>1)c=n[0];else{if(n.length!==a)throw new N(`replaceMany length mismatch: expected ${a} replacement strings, got ${n.length}`);l=n}else if(n!=null)c=n;else return o;let u=[];for(let d=0;d<a;d++){let h=s[d],g=l?l[d]:c;if(h==null||g==null)continue;let x=vs(o,h,d,r,(b,O)=>{let w=Array.prototype.slice.call(b,1);if(typeof g=="function"){let I=[b[0],...w,O,o];return b.groups!==void 0&&I.push(b.groups),String(g(...I))}let S=String(g);return r?.literal?S:Gs(S,b[0],O,o,w,b.groups)});for(let b=0;b<x.length;b++)u.push(x[b])}if(u.length===0)return o;let f=Bs(u),p="",m=0,y=f.length;for(let d=0;d<y;d++){let h=f[d];p+=o.slice(m,h.start)+h.payload,m=h.end}return p+=o.slice(m),p}var Cl,Rl,_l,le,qe,kl,Ns,Cs,ks,Ml,Ul,Fl,jl,Xu,Vl,Jl,Wl,js,zl,Xl,gn=j(()=>{"use strict";Rt();oe();ae();to();$t();Et();nt();Cl=/(\p{L})['’]+(?=\p{L})/gu,Rl=new RegExp(["[\\p{Lu}\\p{M}]+s(?![\\p{Ll}\\p{M}])","[\\p{Lu}\\p{M}]+(?=[\\p{Lu}\\p{M}][\\p{Ll}\\p{M}])","[\\p{Lu}\\p{M}]+[\\p{Ll}\\p{M}]*","[\\p{Ll}\\p{M}]+","\\p{N}+","[\\p{L}\\p{M}]+"].join("|"),"gu"),_l=new Set(["__proto__","proto","constructor","prototype"]);le=typeof globalThis<"u"?globalThis.Buffer:void 0,qe=typeof le<"u",kl=typeof Uint8Array<"u"&&typeof Uint8Array.fromHex=="function",Ns=typeof Uint8Array<"u"&&typeof Uint8Array.fromBase64=="function",Cs=8192,ks=new Array(256);for(let e=0;e<256;e++)ks[e]=e.toString(16).padStart(2,"0");Ml={"-":"+",_:"/"},Ul=/[-_]/g,Fl=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,jl=/^[0-9a-fA-F]*$/,Xu=on({handleCircular:!0});Vl={hex:Bl,base64:Pl};Jl={hex:ql,base64:Gl};Wl=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,js="\\x00-\\x1F\\x7F\\u{D800}-\\u{DFFF}",zl=new RegExp(`[${js}\\\\^$*+?.()|[\\]{}/#,=<>&!%:;@~'"\`-]`,"gu"),Xl=new RegExp(`[${js}]|[\\x20-\\x2F\\x3A-\\x40\\x5B-\\x5E\\x5F\\x60\\x7B-\\x7E]`,"gu")});function Ql(e){let t=Ws.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),Ws.set(e,t)),t}function tu(e,t){let n=`${e}_${t}`,r=zs.get(n);return r||(r=new Intl.DateTimeFormat(e,{timeZoneName:"short",timeZone:t}),zs.set(n,r)),r}function nu(e){let t=Xs.get(e);if(t===void 0){try{Intl.DateTimeFormat(void 0,{timeZone:e}),t=!0}catch{t=!1}Xs.set(e,t)}return t}function We(e){let t=!e||e==="local"?Intl.DateTimeFormat().resolvedOptions().timeZone:e;return nu(t)?t:"UTC"}function et(e,t=0,n=1,r=0,o=0,i=0,s=0){let a=new Date(0);return a.setUTCFullYear(e,t,n),a.setUTCHours(r,o,i,s),a}function ze(e,t){let n=We(t);if(n.toUpperCase()==="UTC")return{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),ms:e.getUTCMilliseconds(),dayOfWeek:e.getUTCDay(),timeZone:"UTC"};let o=Ql(n).formatToParts(e),i={year:"0",month:"0",day:"0",hour:"0",minute:"0",second:"0",fractionalSecond:"0"};for(let p=0,m=o.length;p<m;p++){let y=o[p];y.type in i&&(i[y.type]=y.value)}let s=parseInt(i.year,10),a=parseInt(i.month,10),l=parseInt(i.day,10),c=parseInt(i.hour,10);c===24&&(c=0);let u=Math.round(parseFloat("0."+i.fractionalSecond)*1e3)||0,f=et(s,a-1,l).getUTCDay();return{year:s,month:a,day:l,hour:c,minute:parseInt(i.minute,10),second:parseInt(i.second,10),ms:u,dayOfWeek:f,timeZone:n}}function ce(e,t){if(t.toUpperCase()==="UTC")return 0;let n=ze(e,t),r=et(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.ms).getTime();return Math.round((r-e.getTime())/Mt)}function X(e,t){let n=tt(e);if(n==null)return null;let r=null;if(L(n))r=n;else if(typeof n=="number"||typeof n=="bigint")r=new Date(eu(n));else if(typeof n=="string"){let o=n.trim();if(o.length===0)return null;r=new Date(o)}return!r||!L(r)?null:t?.dateOnly?et(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()):r}function Xe(e){let t=tt(e);if(t==null)return null;let n=null;if(typeof t=="string"){let o=t.trim();if(Hl.test(o)){let i=Zl.test(o);n=X(`1970-01-01T${o}${i?"":"Z"}`)}}let r=n??X(t);return r?fe(r,{format:"%H:%M:%S.%ms"}):null}function Hs(e,t="ms"){let n=e.getTime();switch(t){case"s":return Math.floor(n/_t);case"ms":return n;case"us":return BigInt(n)*$r;case"ns":return BigInt(n)*Kr}}function eu(e){if(typeof e=="bigint"){let n=e<0n?-e:e;return n<=30000000000n?Number(e)*_t:n<=100000000000000n?Number(e):n<=100000000000000000n?Number(e/$r):Number(e/Kr)}let t=Math.abs(e);return t<=3e10?e*_t:t<=1e14?e:t<=1e17?Math.floor(e/Qn):Math.floor(e/te)}function Zs(e){if(!L(e))return null;let t=et(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()).getTime(),n=et(e.getUTCFullYear(),0,1).getTime();return Math.floor((t-n)/Tt)+1}function Ys(e,t,n,r="week"){let o=et(e,t-1,n);if(o.setUTCDate(o.getUTCDate()+4-(o.getUTCDay()||7)),r==="year")return o.getUTCFullYear();let i=Zs(o);return i!=null?Math.floor((i-1)/7)+1:null}function ta(e){return e.replace(/%[FTRDh]/g,t=>ou[t]||t)}function fe(e,{format:t,locale:n,timeZone:r="UTC"}){if(!L(e)||typeof t!="string")return"";let o=We(r),i=n&&n.trim()||Intl.DateTimeFormat().resolvedOptions().locale||"en-US",s=ta(t),a=null,l=()=>a??(a=ze(e,o));return s.replace(Qs,(c,u)=>{if(u==="%")return"%";let f=io[u];return f?f.c(e,i,o,l()):c})}function iu(e){let t=e.replace(":",""),n=t[0]==="+"?1:-1,r=parseInt(t.slice(1,3),10)||0,o=parseInt(t.slice(3,5),10)||0;return n*(r*60+o)}function na(e,{format:t,strict:n=!0,defaultTimeZone:r="UTC"}){if(typeof e!="string"||typeof t!="string")return null;let o=ta(t),i=[],s=0,a="";o.replace(Qs,(m,y,d)=>{if(a+=It(o.slice(s,d)),s=d+m.length,y==="%")return a+="%",m;let h=io[y];return h?.g?(i.push(h),a+=`(${h.g})`):a+=It(m),m}),a+=It(o.slice(s));let l=e.match(new RegExp(`^\\s*${a}\\s*$`));if(!l)return n?null:X(e);let c={year:1970,month:1,day:1,hour:0,minute:0,second:0,ms:0,offset:null},u=null,f=!1;for(let m=0,y=i.length;m<y;m++){let d=l[m+1],h=i[m],g=h.D?h.D(d):parseInt(d,10);h.u==="j"&&(f=!0),h.x==="ampm"?u=g:h.x==="offset"?c.offset=g:h.x&&(c[h.x]=g)}if(u==="PM"&&c.hour<12&&(c.hour+=12),u==="AM"&&c.hour===12&&(c.hour=0),f){if(c.day<1)return null;let m=et(c.year,0,c.day);if(m.getUTCFullYear()!==c.year)return null;c.month=m.getUTCMonth()+1,c.day=m.getUTCDate()}let p=et(c.year,c.month-1,c.day,c.hour,c.minute,c.second,c.ms);if(!L(p)||p.getUTCFullYear()!==c.year||p.getUTCMonth()+1!==c.month||p.getUTCDate()!==c.day||p.getUTCHours()!==c.hour||p.getUTCMinutes()!==c.minute||p.getUTCSeconds()!==c.second||p.getUTCMilliseconds()!==c.ms)return null;if(c.offset)p=new Date(p.getTime()-iu(c.offset)*Mt);else if(r.toUpperCase()!=="UTC"){let m=We(r);p=new Date(p.getTime()-ce(p,m)*Mt)}return L(p)?p:null}function ea(e,t=[]){let n=new Set;if(!e)return n;let r=t.length>0;for(let o of e){let i=X(o,{dateOnly:!0});!i||r&&t.includes(i.getUTCDay())||n.add(i.getTime())}return n}function Je(e,t,n){return t.length>0&&t.includes(e.getUTCDay())||n.has(e.getTime())}function ra(e,t,{excludeWeekdays:n=[],holidays:r=[],roll:o}={}){if(!At(t))throw new ot(`The offset parameter 'n' must be a whole integer. Received: ${t}`);let i=ea(r,n);if(n.length===0&&i.size===0&&!o)return t;if(7-n.length<=0)throw new ot("All weekdays are excluded; cannot offset.");let s=et(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),a=new Date(s.getTime());if(o&&Je(a,n,i)){if(o==="raise")throw new ot("Start date falls on an excluded day or holiday.");let l=o==="forward"?1:-1;for(;Je(a,n,i);)a.setUTCDate(a.getUTCDate()+l)}if(t!==0){let l=t>0?1:-1,c=Math.abs(t),u=0;for(;u<c;)a.setUTCDate(a.getUTCDate()+l),Je(a,n,i)||u++}return Math.round((a.getTime()-s.getTime())/Tt)}function oa(e,t={}){if(!L(e))return null;let n=t.excludeWeekdays??[0,6],r=ea(t.holidays,n),o=et(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return!Je(o,n,r)}function so(e,t,n){let r=We(t),o=n?.type??"total",i;if(o==="total")i=ce(e,r);else{let p=ze(e,r).year,m=ce(et(p,0,1),r),y=ce(et(p,6,1),r),d=Math.min(m,y);i=o==="daylightSavingTime"?ce(e,r)-d:d}let s=n?.format??"milliseconds";if(s==="minutes")return i;if(s==="hours")return i/60;if(s==="milliseconds")return i*Mt;let a=i>=0?"+":"-",l=Math.abs(i),c=String(Math.floor(l/60)).padStart(2,"0"),u=String(l%60).padStart(2,"0");return s==="iso"?`${a}${c}:${u}`:`${a}${c}${u}`}function Bn(e,t,n,r=!1){let o=e??t;return o<0?n+(r?1:0)+o:o}function ia(e,t={}){let n=ze(e,t?.timeZone??void 0),r=t?.year??n.year,o=Bn(t?.month,n.month,12,!0)-1,i=et(r,o+1,0).getUTCDate(),s=Bn(t?.day,n.day,i,!0),a=Bn(t?.hour,n.hour,24),l=Bn(t?.minute,n.minute,60),c=Bn(t?.second,n.second,60),u=Bn(t?.ms,n.ms,1e3);return et(r,o,s,a,l,c,u)}var Hl,Zl,Ws,zs,Xs,io,ru,Qs,ou,ie=j(()=>{"use strict";gn();nt();Rt();$t();Et();Hl=/^\d{2}:\d{2}/,Zl=/(?:Z|[+-]\d{2}(?::?\d{2})?)$/i,Ws=new Map;zs=new Map;Xs=new Map;io={Y:{u:"Y",c:(e,t,n,r)=>{let o=r.year;return o>=0?String(o).padStart(4,"0"):"-"+String(Math.abs(o)).padStart(4,"0")},g:"[+-]?\\d{4,}",x:"year"},y:{u:"y",c:(e,t,n,r)=>String(Math.abs(r.year)%100).padStart(2,"0"),g:"\\d{2}",x:"year",D:e=>{let t=parseInt(e,10);return t+(t>=69?1900:2e3)}},m:{u:"m",c:(e,t,n,r)=>String(r.month).padStart(2,"0"),g:"\\d{2}",x:"month"},d:{u:"d",c:(e,t,n,r)=>String(r.day).padStart(2,"0"),g:"\\d{2}",x:"day"},e:{u:"e",c:(e,t,n,r)=>String(r.day).padStart(2," "),g:"\\s?\\d{1,2}",x:"day"},H:{u:"H",c:(e,t,n,r)=>String(r.hour).padStart(2,"0"),g:"\\d{2}",x:"hour"},I:{u:"I",c:(e,t,n,r)=>String(r.hour%12||12).padStart(2,"0"),g:"\\d{2}",x:"hour"},p:{u:"p",c:(e,t,n,r)=>r.hour>=12?"PM":"AM",g:"AM|PM|am|pm",x:"ampm",D:e=>e.toUpperCase()},M:{u:"M",c:(e,t,n,r)=>String(r.minute).padStart(2,"0"),g:"\\d{2}",x:"minute"},S:{u:"S",c:(e,t,n,r)=>String(r.second).padStart(2,"0"),g:"\\d{2}",x:"second"},A:{u:"A",c:(e,t,n)=>e.toLocaleDateString(t,{weekday:"long",timeZone:n})},a:{u:"a",c:(e,t,n)=>e.toLocaleDateString(t,{weekday:"short",timeZone:n})},B:{u:"B",c:(e,t,n)=>e.toLocaleDateString(t,{month:"long",timeZone:n})},b:{u:"b",c:(e,t,n)=>e.toLocaleDateString(t,{month:"short",timeZone:n})},j:{u:"j",c:(e,t,n,r)=>String(Zs(et(r.year,r.month-1,r.day))??1).padStart(3,"0"),g:"\\d{3}",x:"day",D:e=>parseInt(e,10)},u:{u:"u",c:(e,t,n,r)=>String(r.dayOfWeek||7)},w:{u:"w",c:(e,t,n,r)=>String(r.dayOfWeek)},V:{u:"V",c:(e,t,n,r)=>String(Ys(r.year,r.month,r.day,"week")??1).padStart(2,"0"),g:"\\d{2}",D:e=>parseInt(e,10)},G:{u:"G",c:(e,t,n,r)=>String(Ys(r.year,r.month,r.day,"year")??r.year).padStart(4,"0"),g:"[+-]?\\d{4,}",D:e=>parseInt(e,10)},Z:{u:"Z",c:(e,t,n)=>{if(n.toUpperCase()==="UTC")return"UTC";let r=tu(t,n).formatToParts(e);for(let o=0,i=r.length;o<i;o++)if(r[o].type==="timeZoneName")return r[o].value;return"UTC"}},z:{u:"z",c:(e,t,n)=>so(e,n,{format:"basic"}),g:"[+-]\\d{2}(?::?\\d{2})?",x:"offset",D:e=>e.replace(":","")},ms:{u:"ms",c:(e,t,n,r)=>String(r.ms).padStart(3,"0"),g:"\\d{1,3}",x:"ms",D:e=>parseInt(e.padEnd(3,"0").slice(0,3),10)},f:{u:"f",c:(e,t,n,r)=>String(r.ms).padStart(3,"0").padEnd(6,"0"),g:"\\d{1,9}",x:"ms",D:e=>parseInt(e.padEnd(6,"0").slice(0,3),10)}},ru=Object.keys(io).concat("%").sort((e,t)=>t.length-e.length),Qs=new RegExp("%("+ru.join("|")+")","g"),ou={"%F":"%Y-%m-%d","%T":"%H:%M:%S","%R":"%H:%M","%D":"%m/%d/%y","%h":"%b"}});var Z,qt,xn,Ut,Ft,sn,jt,an,Ye=j(()=>{"use strict";Z=class e{matches(t){if(t==null)return!1;if(t instanceof e)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 e)return this instanceof t;if(t.name==="Struct"||t.name==="StructType")return this.name==="Struct";if(t.name==="ArrayDataType"||t.name==="ArrayType"||t===Array)return this.name==="Array";try{let n=t();if(n instanceof e)return this.constructor===n.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}},qt=class extends Z{get isNumeric(){return!0}},xn=class extends qt{get isInteger(){return!0}},Ut=class extends xn{get isSigned(){return!0}},Ft=class extends xn{get isUnsigned(){return!0}},sn=class extends qt{get isFloat(){return!0}},jt=class extends Z{get isTemporal(){return!0}},an=class extends Z{get isNested(){return!0}}});var He,ao,Ze,lo,Qe,ct,tr,me,nr,uo,er,co,rr,fo,or,mo,wn,po,An,pe,Gt,ir,On,sr,ye,ar,yo,lr,ho,ur,go,cr,bo,vt,de,fr,xo,St,wo,Sn,Ao,Pn,So,Vn=j(()=>{"use strict";Ye();st();He=class extends Ut{constructor(){super(...arguments);T(this,"name","Int8")}coerce(n){return bt(n,{range:"Int8"})}equals(n){return n.name==="Int8"}allocate(n){return new Int8Array(n)}},ao=new He,Ze=class extends Ut{constructor(){super(...arguments);T(this,"name","Int16")}coerce(n){return bt(n,{range:"Int16"})}equals(n){return n.name==="Int16"}allocate(n){return new Int16Array(n)}},lo=new Ze,Qe=class extends Ut{constructor(){super(...arguments);T(this,"name","Int32")}coerce(n){return bt(n,{range:"Int32"})}equals(n){return n.name==="Int32"}allocate(n){return new Int32Array(n)}},ct=new Qe,tr=class extends Ut{constructor(){super(...arguments);T(this,"name","Int64")}coerce(n){return en(n,{truncate:!0})}equals(n){return n.name==="Int64"}allocate(n){return new BigInt64Array(n)}},me=new tr,nr=class extends Ft{constructor(){super(...arguments);T(this,"name","UInt8")}coerce(n){return bt(n,{range:"UInt8"})}equals(n){return n.name==="UInt8"}allocate(n){return new Uint8Array(n)}},uo=new nr,er=class extends Ft{constructor(){super(...arguments);T(this,"name","UInt16")}coerce(n){return bt(n,{range:"UInt16"})}equals(n){return n.name==="UInt16"}allocate(n){return new Uint16Array(n)}},co=new er,rr=class extends Ft{constructor(){super(...arguments);T(this,"name","UInt32")}coerce(n){return bt(n,{range:"UInt32"})}equals(n){return n.name==="UInt32"}allocate(n){return new Uint32Array(n)}},fo=new rr,or=class extends Ft{constructor(){super(...arguments);T(this,"name","UInt64")}coerce(n){return en(n,{range:"UInt64"})}equals(n){return n.name==="UInt64"}allocate(n){return new BigUint64Array(n)}},mo=new or,wn=class extends sn{constructor(){super(...arguments);T(this,"name","Float32")}coerce(n){return zr(n,{floatPrecision:"Float32"})}equals(n){return n.name==="Float32"}allocate(n){return new Float32Array(n)}},po=new wn,An=class extends sn{constructor(){super(...arguments);T(this,"name","Float64")}coerce(n){return zr(n,{floatPrecision:"Float64"})}equals(n){return n.name==="Float64"}allocate(n){return new Float64Array(n)}},pe=new An,Gt=class e extends qt{constructor(n,r){super();T(this,"precision",n);T(this,"scale",r);T(this,"name");this.name=n!==void 0&&r!==void 0?`Decimal(${n}, ${r})`:"Decimal"}coerce(n){return Be(n,{precision:this.precision,scale:this.scale})}equals(n){return n instanceof e&&this.precision===n.precision&&this.scale===n.scale}allocate(n){return new Array(n).fill(null)}},ir=class extends Z{constructor(){super(...arguments);T(this,"name","Boolean")}get isBoolean(){return!0}coerce(n){return n==null?null:!!n}equals(n){return n.name==="Boolean"}allocate(n){return new Array(n).fill(null)}},On=new ir,sr=class extends Z{constructor(){super(...arguments);T(this,"name","Utf8")}get isString(){return!0}get isUtf8(){return!0}coerce(n){return n==null?null:String(n)}equals(n){return n.name==="Utf8"}allocate(n){return new Array(n).fill(null)}},ye=new sr,ar=class extends Z{constructor(){super(...arguments);T(this,"name","Binary")}get isBinary(){return!0}coerce(n){return Ke(n)}equals(n){return n.name==="Binary"}allocate(n){return new Array(n).fill(null)}},yo=new ar,lr=class extends Z{constructor(){super(...arguments);T(this,"name","Null")}get isNull(){return!0}coerce(n){return null}equals(n){return n.name==="Null"}allocate(n){return new Array(n).fill(null)}},ho=new lr,ur=class extends Z{constructor(){super(...arguments);T(this,"name","Object")}get isObject(){return!0}coerce(n){return n===void 0?null:n}equals(n){return n.name==="Object"}allocate(n){return new Array(n).fill(null)}},go=new ur,cr=class extends jt{constructor(){super(...arguments);T(this,"name","Date")}coerce(n){return X(n,{dateOnly:!0})}equals(n){return n.name==="Date"}allocate(n){return new Array(n).fill(null)}},bo=new cr,vt=class e extends jt{constructor(n="ms",r=null){super();T(this,"name","Datetime");T(this,"timeUnit");T(this,"timeZone");this.timeUnit=n,this.timeZone=r}coerce(n){return X(n)}equals(n){return n instanceof e&&n.timeUnit===this.timeUnit&&n.timeZone===this.timeZone}allocate(n){return new Array(n).fill(null)}},de=new vt,fr=class extends jt{constructor(){super(...arguments);T(this,"name","Time")}coerce(n){return Xe(n)}equals(n){return n.name==="Time"}allocate(n){return new Array(n).fill(null)}},xo=new fr,St=class e extends jt{constructor(n="ms"){super();T(this,"name","Duration");T(this,"timeUnit");this.timeUnit=n}coerce(n){return $(n)}equals(n){return n instanceof e&&n.timeUnit===this.timeUnit}allocate(n){return new Array(n).fill(null)}},wo=new St,Sn=class e extends an{constructor(n){super();T(this,"innerType",n);T(this,"name","Array")}coerce(n){if(n==null)return null;let r=V(n)?Array.from(n):[n],o=r.length,i=new Array(o);for(let s=0;s<o;s++)i[s]=this.innerType.coerce(r[s]);return i}equals(n){return n instanceof e&&this.innerType.equals(n.innerType)}allocate(n){return new Array(n).fill(null)}},Ao=e=>new Sn(e),Pn=class e extends an{constructor(n){super();T(this,"fields",n);T(this,"name","Struct")}coerce(n){if(!v(n))return null;let r={},o=Object.keys(this.fields),i=o.length;for(let s=0;s<i;s++){let a=o[s],l=this.fields[a];r[a]=l.coerce(n[a])}return r}equals(n){if(!(n instanceof e))return!1;let r=Object.keys(this.fields),o=Object.keys(n.fields);if(r.length!==o.length)return!1;for(let i=0;i<r.length;i++){let s=r[i];if(!this.fields[s].equals(n.fields[s]))return!1}return!0}allocate(n){return new Array(n).fill(null)}},So=e=>new Pn(e)});var D,Jt=j(()=>{"use strict";Ye();Vn();Vn();Ye();D={Int8:ao,Int16:lo,Int32:ct,Int64:me,UInt8:uo,UInt16:co,UInt32:fo,UInt64:mo,Float32:po,Float64:pe,Decimal:(e,t)=>new Gt(e,t),Boolean:On,Utf8:ye,Binary:yo,Date:bo,Datetime:de,Time:xo,Duration:wo,Object:go,Null:ho,Array:Ao,Struct:So,Numeric:qt,Integer:xn,SignedInteger:Ut,UnsignedInteger:Ft,Float:sn,Temporal:jt,Nested:an}});function su(e={}){let t=e.nullValue!==void 0?e.nullValue:"",n=Zi(e.numericFormatOptions),r=e.replacerOptions||{},o=e.datetimeFormat??e.dateFormat??e.timeFormat,s={formatDate:o?l=>L(l)?fe(l,{format:o}):t:l=>L(l)?l.toISOString():t,onBigInt:n,...r},a=on(s);return l=>{if(l==null||typeof l=="symbol"||typeof l=="function"||l instanceof Date&&!L(l))return{str:t,isNumeric:!1};let c=a.call(null,"",l),u=tt(c);return u==null||typeof u=="symbol"||typeof u=="function"?{str:t,isNumeric:!1}:typeof l=="bigint"||typeof l=="number"?{str:typeof u=="string"?u:n(u),isNumeric:!0}:typeof u=="number"||typeof u=="bigint"?{str:n(u),isNumeric:!0}:typeof u=="string"?{str:u,isNumeric:!1}:typeof u=="boolean"?{str:u?"true":"false",isNumeric:!1}:typeof u=="object"?{str:JSON.stringify(u,on(s)),isNumeric:!1}:{str:String(u),isNumeric:!1}}}function mr(e,t,n={}){let{separator:r=",",quoteChar:o='"',includeHeader:i=!0,lineTerminator:s=`
2
+ `,quoteStyle:a="necessary",includeBom:l=!1,onRow:c,...u}=n,f=Object.keys(e),p=f.length,m=[],y=!0,d=su(u),h=(b,O=!1)=>{let w=O?{str:String(b),isNumeric:!1}:d(b),S=w.str;if(a==="never"||!(a==="always"||a==="non_numeric"&&(O||!w.isNumeric&&b!=null)||S.includes(r)||S.includes(o)||Ti.test(S)))return S;let C=ue(S,o,o+o,{literal:!0,n:1/0});return o+C+o},g=b=>{let O=y?l?"\uFEFF":"":c?s:"";y=!1;let w=O+b;c?c(w):m.push(w)},x=(b,O)=>{let w=new Array(p);for(let S=0;S<p;S++)w[S]=h(b(S),O);g(w.join(r))};i&&x(b=>f[b],!0);for(let b=0;b<t;b++)x(O=>e[f[O]][b],!1);return c?l?"\uFEFF":"":m.join(s)}function aa(e,t={}){let n=t.separator||",",r=t.quoteChar||'"',o=dt(e,"\uFEFF",{mode:"start",returnStringOnNull:!0})??"",i=[],s=[],a="",l=!1,c=!1,u=()=>{s.push(a),a=""},f=()=>{!c&&s.length===0&&a===""||(u(),i.push(s),s=[],c=!1)},p=o.length;for(let m=0;m<p;m++){let y=o[m];if(l){if(c=!0,y!==r){a+=y;continue}if(m+1<p&&o[m+1]===r){a+=r,m++;continue}l=!1;continue}if(y===r){if(c=!0,a.length===0){l=!0;continue}a+=r;continue}if(y===n){c=!0,u();continue}if(y==="\r"||y===`
3
+ `){y==="\r"&&m+1<p&&o[m+1]===`
4
+ `&&m++,f();continue}c=!0,a+=y}return f(),i}function la(e,t={}){let n=new Set(t.nullValues??["","NA","null","NaN"]),r=e.length,o=[{type:On,parse:u=>{let f=u.toLowerCase();return f==="true"||f==="1"?!0:f==="false"||f==="0"?!1:null},active:!0},{type:me,parse:u=>en(u,{truncate:!1}),active:!0},{type:pe,parse:u=>$(u,{allowNonFiniteNumbers:!0}),active:!0},{type:de,parse:u=>X(u),active:!0}],i=!1;for(let u=0;u<r;u++){let f=dt(e[u],null,{returnStringOnNull:!0})??"";if(n.has(f))continue;i=!0;let p=!1;for(let m=0;m<o.length;m++){let y=o[m];y.active&&(y.parse(f)===null?y.active=!1:p=!0)}if(!p)break}let s=i?o.find(u=>u.active):void 0,a=s?.type??ye,l=s?.parse,c=new Array(r);for(let u=0;u<r;u++){let f=e[u],p=dt(f,null,{returnStringOnNull:!0})??"";c[u]=n.has(p)?null:l?l(p):f}return{type:a,values:c}}var ua=j(()=>{"use strict";ie();ae();$t();Et();Jt();Rt();gn()});function ge(e){let t=dt(e);if(!t)throw new Error(`Invalid duration string: "${e}"`);let n=t.startsWith("-")||t.startsWith("+"),r=t.startsWith("-")?-1:1,o=n?dt(t.slice(1))??"":t;if(!o||jn(o,au)!==null)throw new Error(`Cannot parse duration string: "${e}"`);To.lastIndex=0;let i,s=0,a=0,l=0,c=0,u=!1,f=!1,p=!1,m=0,y=!1,d=0;for(;(i=To.exec(o))!==null;){m++;let h=i[1],g=i[2];g||(y=!0);let x=parseFloat(h)*r,b=g!==void 0?g:"ms",O=b.toLowerCase();if(d=To.lastIndex,b==="i"){f=!0,c+=x;continue}let w=ca[b]??ca[O];if(w){u=!0,p=!0,w.kind==="month"?s+=x*w.factor:a+=x*w.factor;continue}let S=ln[b]??ln[O];if(S===void 0)throw new Error(`Unknown duration unit: "${g}" in "${e}"`);p=!0,l+=x*S}if(m===0||d!==o.length||y&&m>1)throw new Error(`Cannot parse duration string: "${e}"`);if(f&&p)throw new Error(`Cannot combine index unit 'i' with temporal duration units in "${e}"`);return{months:s,days:a,ms:l,indexUnits:c,isCalendar:u,isIndex:f}}function Eo(e,t,n=1){let r=X(e);if(!r)throw new Error(`Invalid date provided to addCalendarDuration: ${e}`);let o=typeof t=="string"?ge(t):t,i=new Date(r.getTime()),s=o.months*n;if(s!==0){let c=i.getUTCFullYear(),u=i.getUTCMonth(),f=i.getUTCDate(),p=c*12+u+s,m=Math.floor(p/12),y=(p%12+12)%12,d=et(m,y+1,0).getUTCDate();i.setUTCFullYear(m,y,Math.min(f,d))}let a=o.days*n;a!==0&&i.setUTCDate(i.getUTCDate()+a);let l=o.ms*n;return l!==0&&i.setTime(i.getTime()+l),i}function Io(e,t={}){let n=t.to??"ms",r=ln[n]??ln[n.toLowerCase()];if(r===void 0)throw new Error(`Unknown target duration unit: "${n}"`);let o=ge(e);if(o.isCalendar&&o.months!==0)throw new Error(`Cannot convert calendar duration containing months/years to a fixed duration without an anchor date: "${e}"`);if(o.isIndex){let a=o.indexUnits/r;return Object.is(a,-0)?0:a}let s=(o.ms+o.days*Tt)/r;return Object.is(s,-0)?0:s}function pr(e,t={}){let{to:n="ms",fallback:r}=t;if(e==null)return r!==void 0?r:NaN;let o=tt(e);if(typeof o=="boolean")return NaN;if(typeof o=="string")try{let l=Io(o,{to:n});return U(l)?l:NaN}catch{return NaN}let i=$(o);if(i===null)return NaN;let s=ln[n]??ln[n.toLowerCase()];if(s===void 0)throw new Error(`Unknown target duration unit: "${n}"`);let a=i/s;return Object.is(a,-0)?0:a}var ca,ln,To,au,fa=j(()=>{"use strict";$t();gn();Rt();ie();Et();ca=Object.freeze({M:{kind:"month",factor:1},mo:{kind:"month",factor:1},month:{kind:"month",factor:1},months:{kind:"month",factor:1},q:{kind:"month",factor:3},quarter:{kind:"month",factor:3},quarters:{kind:"month",factor:3},y:{kind:"month",factor:12},yr:{kind:"month",factor:12},year:{kind:"month",factor:12},years:{kind:"month",factor:12},d:{kind:"day",factor:1},day:{kind:"day",factor:1},days:{kind:"day",factor:1},w:{kind:"day",factor:7},week:{kind:"day",factor:7},weeks:{kind:"day",factor:7}}),ln=Object.freeze({ns:Fe,nanosecond:Fe,nanoseconds:Fe,us:kn,\u00B5s:kn,\u03BCs:kn,microsecond:kn,microseconds:kn,ms:Ue,millisecond:Ue,milliseconds:Ue,s:_t,sec:_t,second:_t,seconds:_t,m:Mt,min:Mt,minute:Mt,minutes:Mt,h:Zn,hr:Zn,hour:Zn,hours:Zn,d:Tt,day:Tt,days:Tt,w:Me,week:Me,weeks:Me,i:1}),To=/(?:^|\s*,\s*|\s+)((?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?)\s*([a-zA-Zµμ]+)?/gy,au=/^,|,[\s]*,|,$|(?<![eE])[+-]|[a-zA-Zµμ]\./});var st=j(()=>{"use strict";Rt();$t();ie();oe();gn();ae();ua();to();fa()});function Q(e,t,n,r=""){if(!(e in t))throw new Wt(e,`${n} "${e}" does not exist${r}`)}function yr(e,t){let n=Object.keys(e),r=n.length,o=t;for(let i=0;i<r;i++){let s=n[i],a=e[s],l=V(a)?a.length:0;if(o===void 0)o=l;else if(l!==o)throw new at(`Column height mismatch: Column "${s}" has length ${l}, but DataFrame height is ${o}`)}return o===void 0?0:o}function be(e,t="Value cannot be null or undefined"){if(e==null)throw new N(t);return e}function lu(e,t){if(!e)throw new N(t)}var ma=j(()=>{"use strict";nt();st()});var zt,Y,Wt,un,ot,at,N,Kt,nt=j(()=>{"use strict";ma();zt=class extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Y=class extends zt{},Wt=class extends Y{constructor(t,n){super(n||`Column "${t}" does not exist in the DataFrame.`)}},un=class extends zt{},ot=class extends zt{},at=class extends zt{},N=class extends zt{},Kt=class extends zt{}});function uu(e,t,n){let r=n.length,o={},i=new Array(r);for(let s=0;s<r;s++){let a=n[s];if(typeof a=="string")Q(a,e,"Partition key"," in the DataFrame."),o[a]=e[a],i[s]=a;else{let l=`__part_${s}`;o[l]=a.evaluate(e,t),i[s]=l}}return $n(o,i,t)}function Do(e,t,n){let r=new Array(n);if(n===0)return r;let o=e.I||[],i=uu(t,n,o),s=e.J(e.U,t,n);for(let a of i.values()){let l=a.length,c=new Array(l);for(let u=0;u<l;u++)c[u]=s[a[u]];if(e.R){for(let u=0;u<l;u++)r[a[u]]=e.R(c,a,u);continue}if(e.A){let u=e.A(c);for(let f=0;f<l;f++)r[a[f]]=u;continue}for(let u=0;u<l;u++)r[a[u]]=s[a[u]]}return e.Y(e.U,r,t)}function Co(e){if(!Array.isArray(e)||e.length===0)return{columns:{},height:0};let t=e.length,n=new Set;for(let s=0;s<t;s++){let a=e[s];if(!v(a))continue;let l=Object.keys(a),c=l.length;for(let u=0;u<c;u++)n.add(l[u])}let r=Array.from(n),o=r.length,i={};for(let s=0;s<o;s++){let a=r[s],l=new Array(t);for(let c=0;c<t;c++){let u=e[c],f=u!=null?u[a]:null;l[c]=f===void 0?null:f}i[a]=l}return{columns:i,height:t}}function dr(e,t,n){let r={};for(let o=0;o<n.length;o++){let i=n[o],s=e[i][t];r[i]=s===void 0?null:s}return r}function Ro(e,t){let n=Object.keys(e),r=new Array(t);for(let o=0;o<t;o++)r[o]=dr(e,o,n);return r}function Xt(e){if(e.length===0)return D.Utf8;let t=!0,n=!0,r=!0,o=!0,i=!0,s=!0,a=!0,l=!0,c=!1,u=!1,f=[];for(let p=0;p<e.length;p++){let m=e[p];if(m!=null){if(u=!0,m instanceof Uint8Array||(a=!1),!V(m)||m instanceof Uint8Array)s=!1;else{let y=m,d=y.length;for(let h=0;h<d;h++)f.push(y[h])}L(m)&&(c=!0),typeof m!="boolean"&&(t=!1),typeof m!="bigint"&&(o=!1),typeof m!="number"?(r=!1,n=!1):Number.isInteger(m)||(n=!1),!L(m)&&(typeof m!="string"||isNaN(Date.parse(m)))&&(i=!1),(!v(m)||m instanceof Uint8Array)&&(l=!1)}}if(!u)return D.Null;if(a)return D.Binary;if(s){let p=Xt(f);return D.Array(p)}if(t)return D.Boolean;if(o)return D.Int64;if(r&&!n)return D.Float64;if(r&&n){let p=!0;for(let m=0;m<e.length;m++){let y=e[m];if(y!=null&&!At(y,{range:"Int32"})){p=!1;break}}return p?D.Int32:D.Float64}return i&&c?D.Datetime:l?D.Object:D.Utf8}function Ln(e,t,n=yn){let r=t.length,o=new Array(r);for(let i=0;i<r;i++){let s=t[i];o[i]=s!==null&&s!==n?e[s]:null}return o}function hr(e,t,n=yn){let r=Object.keys(e),o=r.length,i={};for(let s=0;s<o;s++){let a=r[s];i[a]=Ln(e[a],t,n)}return i}function $n(e,t,n){let r=new Map;for(let o=0;o<n;o++){let i=Tn(e,t,o),s=r.get(i);s===void 0&&r.set(i,s=[]),s.push(o)}return r}function Tn(e,t,n){let r=t.length;if(r===1)return ut(e[t[0]][n]);let o=new Array(r);for(let i=0;i<r;i++)o[i]=ut(e[t[i]][n]);return o.join(ne)}function Bt(e,t,n){let r=t.allocate?t.allocate(n):new Array(n);if(!it(r)){for(let o=0;o<n;o++)r[o]=t.coerce(e[o]);return r}for(let o=0;o<n;o++){let i=t.coerce(e[o]);if(i!=null){r[o]=i;continue}let s=new Array(n);for(let a=0;a<o;a++)s[a]=r[a];s[o]=null;for(let a=o+1;a<n;a++)s[a]=t.coerce(e[a]);return s}return r}function _o(e,t){if(e)if(typeof e=="string"){if(typeof require!="function")throw new Kt("File writing is not supported in this environment (missing require('fs')).");require("fs").writeFileSync(e,t,"utf8")}else if(v(e)&&typeof e.write=="function")e.write(t);else throw new N("Invalid file argument. Expected a file path string or a writable stream/object with a write method.")}function No(e,t,n){if(t>0&&n>0)return null;let r=(e==="left"||e==="anti"||e==="outer")&&t>0,o=(e==="right"||e==="outer")&&n>0;if(!r&&!o)return{leftIndices:[],rightIndices:[]};let i=r?t:n,s=new Array(i),a=new Array(i);for(let l=0;l<i;l++)s[l]=r?l:yn,a[l]=r?null:l;return{leftIndices:s,rightIndices:a}}function pa(e,t,n,r){for(let o=0;o<r;o++)n[o]!==1&&(e.push(yn),t.push(o))}function ko(e,t,n,r,o,i,s={}){let{how:a="inner",joinNulls:l=!1,maintainOrder:c}=s;if(a==="cross")return ms(n,r);let u=No(a,n,r);if(u)return u;let f=o.length,p=i.length,m=(E,_,P,W)=>{if(!l){for(let B=0;B<P;B++)if(E[_[B]][W]==null)return null}return Tn(E,_,W)},y=new Map;for(let E=0;E<r;E++){let _=m(t,i,p,E);if(_===null)continue;let P=y.get(_);P===void 0&&(P=[],y.set(_,P)),P.push(E)}let d=[],h=[];if(a==="semi"||a==="anti"){let E=a==="semi";for(let _=0;_<n;_++){let P=m(e,o,f,_),W=P===null?void 0:y.get(P),B=W!==void 0&&W.length>0;E===B&&(d.push(_),h.push(null))}return{leftIndices:d,rightIndices:h}}let g=a==="outer"||a==="right",x=g?new Uint8Array(r):null,b=a==="left"||a==="outer";for(let E=0;E<n;E++){let _=m(e,o,f,E),P=_===null?void 0:y.get(_);if(P===void 0){b&&(d.push(E),h.push(null));continue}let W=P.length;for(let B=0;B<W;B++){let lt=P[B];g&&(x[lt]=1),d.push(E),h.push(lt)}}g&&pa(d,h,x,r);let O=c||"none";if(O==="none"||O==="left")return{leftIndices:d,rightIndices:h};let w=d.length,S=new Int32Array(w);for(let E=0;E<w;E++)S[E]=E;let I=E=>d[E]===yn?Number.K:d[E],C=E=>h[E]??Number.K;O==="right"?S.sort((E,_)=>C(E)-C(_)||E-_):O==="left_right"?S.sort((E,_)=>I(E)-I(_)||C(E)-C(_)||E-_):O==="right_left"&&S.sort((E,_)=>C(E)-C(_)||I(E)-I(_)||E-_);let R=new Array(w),F=new Array(w);for(let E=0;E<w;E++){let _=S[E];R[E]=d[_],F[E]=h[_]}return{leftIndices:R,rightIndices:F}}function Mo(e,t,n,r,o,i,s,a,l={}){let c=No("left",n,r);if(c)return c;Q(o,e,"Join on key"," in the left DataFrame."),Q(i,t,"Join on key"," in the right DataFrame.");let u=l.strategy??"backward",f=l.allowExactMatches??!0,p=l.checkSorted??!0,m=e[o],y=t[i];if(p){let S=(I,C,R,F)=>{for(let E=1;E<C;E++){let _=$(I[E-1]),P=$(I[E]);if(U(_)&&U(P)&&P<_)throw new N(`${F} DataFrame key column "${R}" is not sorted in ascending order at row ${E}.`)}};S(m,n,o,"left"),S(y,r,i,"right")}let d=s.length>0,h=d?$n(t,a,r):null,g=new Array(r);if(!d)for(let S=0;S<r;S++)g[S]=S;let x=new Array(n),b=new Array(n),O=(S,I)=>{let C=I.length;if(C===0)return null;let R=(B,lt)=>$(y[lt])??NaN;if(u==="backward"){let B=hn(I,S,{side:f?"right":"left",getValue:R})-1;return B>=0?I[B]:null}if(u==="forward"){let B=hn(I,S,{side:f?"left":"right",getValue:R});return B<C?I[B]:null}let F=hn(I,S,{side:"right",getValue:R}),E=F-1,_=F;if(f||(E>=0&&R(E,I[E])===S&&E--,_<C&&R(_,I[_])===S&&_++),E<0)return _<C?I[_]:null;if(_>=C)return E>=0?I[E]:null;let P=R(E,I[E]),W=R(_,I[_]);return Math.abs(S-P)<=Math.abs(S-W)?I[E]:I[_]},w=l.tolerance!==void 0?$(l.tolerance):null;for(let S=0;S<n;S++){x[S]=S;let I=$(m[S]);if(!U(I)){b[S]=null;continue}let C=d?h.get(Tn(e,s,S))||[]:g;if(C.length===0){b[S]=null;continue}let R=O(I,C);if(R!==null&&w!==null){let F=$(y[R]);(!U(w)||!U(F)||Math.abs(I-F)>w)&&(R=null)}b[S]=R}return{leftIndices:x,rightIndices:b}}function Uo(e,t,n,r,o,i={}){let s=i.how??"inner",a=No(s,n,r);if(a)return a;let[l="",c="_right"]=i.suffixes??["","_right"],u=[],f=[],p=o.length,m=s==="right",y=m?new Uint8Array(r):null,d={},h=(I,C,R)=>{let F=Object.keys(I),E=F.length,_=new Array(E);for(let P=0;P<E;P++){let W=F[P],B=W in C&&R!==""?`${W}${R}`:W;_[P]=B,d[B]=new Array(1)}return _},g=h(e,t,l),x=h(t,e,c),b=Object.keys(e),O=Object.keys(t),w=b.length,S=O.length;for(let I=0;I<n;I++){let C=!1;for(let R=0;R<w;R++)d[g[R]][0]=e[b[R]][I];t:for(let R=0;R<r;R++){for(let F=0;F<S;F++)d[x[F]][0]=t[O[F]][R];for(let F=0;F<p;F++)if(o[F].evaluate(d,1)[0]!==!0)continue t;C=!0,u.push(I),f.push(R),m&&(y[R]=1)}!C&&s==="left"&&(u.push(I),f.push(null))}return m&&pa(u,f,y,r),{leftIndices:u,rightIndices:f}}function xe(e,t,n,r,o,i,s,a,l={}){let[c="",u="_right"]=l.suffixes||[],f=l.coalesce??!0,p=l.how||"inner",m=o.length,y={},d={},h=new Set(s),g=new Set(a),x=new Set,b=Object.keys(e),O=Object.keys(t),w=new Map;for(let I=0;I<s.length;I++)w.has(s[I])||w.set(s[I],a[I]);let S=(I,C)=>{let R=C||"_left",F=`${I}${R}`,E=1;for(;x.has(F);)F=`${I}${R}_${E++}`;return x.add(F),F};for(let I=0;I<b.length;I++){let C=b[I];(!(C in t)||h.has(C)||g.has(C))&&x.add(C)}for(let I=0;I<b.length;I++){let C=b[I],R=h.has(C),F;C in t&&!R&&!g.has(C)?c!==""?(x.add(C),F=S(C,c)):x.has(C)?F=S(C,c):(F=C,x.add(C)):F=C;let E=e[C],_=R?w.get(C):null,P=_?t[_]:null;if(R&&f){let W=new Array(m);for(let B=0;B<m;B++){let lt=o[B],kt=i[B],ft=lt!==yn?E[lt]:null,mt=kt!==null&&P?P[kt]:null;W[B]=ft??mt}y[F]=W}else y[F]=Ln(E,o);n[C]?d[F]=n[C]:_&&r[_]&&(d[F]=r[_])}if(p!=="semi"&&p!=="anti")for(let I=0;I<O.length;I++){let C=O[I];if(f&&g.has(C))continue;let R=x.has(C)?S(C,u):C;x.add(R),y[R]=Ln(t[C],i),r[C]&&(d[R]=r[C])}return q.S(y,d,m)}var gr=j(()=>{"use strict";Kn();Jt();Et();st();nt()});function ya(e,t){if(e==null)return null;let n=L(e)?e.getTime():e;return t(n)}function Fo(e,t,n){if(e==null||t==null)return null;let r=L(e)?e.getTime():e,o=L(t)?t.getTime():t;return n(r,o)}function Ot(e,t,n){return e.Ot?Do(e,t,n):e.evaluate(t,n)}function En(e,t,n){return typeof e=="object"&&e!==null&&"_ops"in e?Ot(e,t||{},n):typeof e=="string"&&t!=null&&e in t?t[e]:e}function In(e,t,n,r){return!V(t)||t.length!==r?!1:typeof e=="object"&&e!==null&&"_ops"in e||typeof e=="string"&&n!=null&&e in n}function jo(e){let t=new Set,n=V(e)?e:[e];for(let r=0;r<n.length;r++)t.add(ut(n[r]));return t}function vo(e,t,n){let r=e.length,o=n&&typeof n=="object"&&"evaluate"in n,i=o?n.evaluate(t,r):null,s=o?null:jo(n),a=new Array(r);for(let l=0;l<r;l++){let c=e[l];if(c==null){a[l]=null;continue}let u=s??jo(i[l]);a[l]=u.has(ut(c))}return a}function Bo(e,t){let n=e.length,r=V(t),o=new Array(n);for(let i=0;i<n;i++){let s=e[i],a=r?t[i]:t;s==null||a==null?o[i]=s==null&&a==null:o[i]=s===a}return o}function br(e,t,n={}){if(t==null)return null;let r=n.dense?"_denseRankCache":"_rankCache",o=e[r];if(!o){let i=e;if(n.ignoreNulls){i=[];let l=e.length;for(let c=0;c<l;c++)e[c]!=null&&i.push(e[c])}n.dense&&(i=Array.from(new Set(i)));let s=re(i);o=new Map;let a=s.length;for(let l=0;l<a;l++){let c=s[l];o.has(c)||o.set(c,l+1)}e[r]=o}return o.get(t)??null}var k,G,Yt=j(()=>{"use strict";st();Rt();gr();k=e=>t=>{let n=t.length,r=new Array(n);for(let o=0;o<n;o++)r[o]=ya(t[o],e);return r},G=(e,t,n)=>{let r=(o,i)=>{let s=o.length,a=e.v(t,i,s),l=new Array(s);if(V(a))for(let c=0;c<s;c++)l[c]=Fo(o[c],a[c],n);else for(let c=0;c<s;c++)l[c]=Fo(o[c],a,n);return l};return r.C={left:e,right:t},r}});var A,ht,cn=j(()=>{"use strict";nt();Yt();A=(e,t)=>{let n=e.constructor,r=e.G||e.f||"",o=new n(r);return Object.assign(o,e),o.p=t?[...e.p,t]:[...e.p],t&&t.C&&(o.C=t.C),o},ht=class e{constructor(){T(this,"p",[]);T(this,"O","");T(this,"B");T(this,"P");T(this,"A",null);T(this,"_");T(this,"C");T(this,"N");T(this,"U");T(this,"I",null);T(this,"R");T(this,"F");T(this,"Z");T(this,"Q")}Y(t,n,r){let o=this.p,i=t!==void 0?t:o.length,s=n;for(let a=i;a<o.length;a++)s=o[a](s,r);return s}J(t,n,r){let o=this.Tt(n,r),i=this.p,s=t!==void 0?t:i.length;for(let a=0;a<s;a++)o=i[a](o,n);return o}Tt(t,n){let r=this.f;if(r&&r!=="*"&&!r.startsWith("*")&&!(r in t))throw new Wt(r);return(r&&r!=="*"?t[r]:null)||new Array(n).fill(null)}v(t,n,r){return t instanceof e?t.B&&t.p.length===1?t.P:Ot(t,n,r):t}alias(t){let n=A(this);return n.O=t,n}cast(t){let n=A(this,k(r=>t.coerce(r)));return n._=t,n}debug(t){return A(this,n=>n)}evaluate(t,n){return this.J(void 0,t,n)}}});var we,Po=j(()=>{"use strict";cn();Yt();nt();st();we=class extends ht{V(t,n,r,o){return this.j(function(i,s,a){let l=n,c=!1,u=t?a:0,f=t?i.length-1:a;for(let p=u;p<=f;p++){let m=i[p];m!=null&&(l=r(l,m),c=!0)}return o?o(l,c):l})}o(t){let n=A(this);return n.A=t,n.N=this.p.length,n.U=this.p.length,n}k(t,n){let r=A(this,G(this,t,(o,i)=>[o,i])).o(n);return r.C=void 0,r}get Ot(){return this.I!==null||this.R!==void 0||this.A!==null}j(t){let n=A(this);return n.U=this.p.length,n.N=this.p.length,n.R=t,n}abs(){return A(this,k(Math.abs))}add(t){return A(this,G(this,t,(n,r)=>n+r))}all(){return this.o(t=>H(t,n=>!!n,{mode:"every"}))}allNull(){return this.o(t=>H(t,"nullish",{mode:"every"}))}and(t){return A(this,(n,r)=>{let o=n.length,i=this.v(t,r,o),s=V(i),a=new Array(o);for(let l=0;l<o;l++){let c=n[l],u=s?i[l]:i;c===!1||u===!1?a[l]=!1:c==null||u==null?a[l]=null:a[l]=!0}return a})}any(){return this.o(t=>H(t,n=>!!n,{mode:"some"}))}anyNull(){return this.o(t=>H(t,"nullish",{mode:"some"}))}arccos(){return A(this,k(t=>t<-1||t>1?null:Math.acos(t)))}arccosh(){return A(this,k(t=>t<1?null:Math.acosh(t)))}arcsin(){return A(this,k(t=>t<-1||t>1?null:Math.asin(t)))}arcsinh(){return A(this,k(Math.asinh))}arctan(){return A(this,k(Math.atan))}arctan2(t){return A(this,G(this,t,Math.atan2))}arctanh(){return A(this,k(t=>t<=-1||t>=1?null:Math.atanh(t)))}argMax(){return this.o(t=>K(t).maxIdx)}argMin(){return this.o(t=>K(t).minIdx)}avg(){return this.o(t=>K(t).mean)}between(t,n,r="both"){let o=r==="both"||r==="left"?this.ge(t):this.gt(t),i=r==="both"||r==="right"?this.le(n):this.lt(n);return o.and(i)}bitwiseAnd(){return this.o(t=>$e(t,(n,r)=>n&r))}bitwiseOr(){return this.o(t=>$e(t,(n,r)=>n|r))}bitwiseXor(){return this.o(t=>$e(t,(n,r)=>n^r))}cbrt(){return A(this,k(Math.cbrt))}ceil(){return A(this,k(Math.ceil))}clip(t=null,n=null){return A(this,k(r=>z(r,{min:t,max:n})))}copysign(t){return A(this,G(this,t,(n,r)=>Math.abs(n)*(r>=0?1:-1)))}corr(t){return this.k(t,n=>Hr(n)?.correlation??null)}cos(){return A(this,k(Math.cos))}cosh(){return A(this,k(Math.cosh))}cot(){return A(this,k(t=>{if(Number.isNaN(t))return NaN;if(!U(t))return null;let n=Math.tan(t);return n===0?null:1/n}))}count(t={}){return t.includeNulls?this.o(n=>n.length):this.o(n=>K(n).count)}cov(t){return this.k(t,n=>Hr(n)?.covariance??null)}cumCount(t=!1){return this.V(t,0,n=>n+1)}cumMax(t=!1){return this.V(t,null,(n,r)=>n===null||r>n?r:n)}cumMin(t=!1){return this.V(t,null,(n,r)=>n===null||r<n?r:n)}cumProd(t=!1){return this.V(t,1,(n,r)=>n*r,(n,r)=>r?n:null)}cumSum(t=!1){return this.V(t,0,(n,r)=>n+r)}degrees(){return A(this,k(t=>t*(180/Math.PI)))}denseRank(){return this.rank({dense:!0})}div(t){return A(this,G(this,t,(n,r)=>r===0?null:n/r))}dot(t){return this.k(t,n=>cs(n))}entropy(t={base:Math.E,normalize:!0}){return this.o(n=>hs(n,t))}eq(t){return A(this,G(this,t,(n,r)=>n===r))}eqMissing(t){return A(this,(n,r)=>{let o=this.v(t,r,n.length);return Bo(n,o)})}exp(){return A(this,k(Math.exp))}expm1(){return A(this,k(Math.expm1))}fillNull({value:t=void 0,strategy:n=void 0,limit:r=void 0}={}){return n==="zero"?t=0:n==="one"&&(t=1),A(this,(o,i)=>{let s=o.length,a=Array.from(o);if(t!==void 0){let l=this.v(t,i,s),c=V(l);for(let u=0;u<s;u++)a[u]==null&&(a[u]=c?l[u]:l);return a}if(n==="min"||n==="max"||n==="mean"){let l=K(o)[n];for(let c=0;c<s;c++)a[c]==null&&(a[c]=l);return a}if(n==="forward"||n==="backward"){let l=n==="backward",c=null,u=0;for(let f=0;f<s;f++){let p=l?s-1-f:f,m=a[p];if(m!=null){c=m,u=0;continue}c!==null&&(r===void 0||u<r)&&(a[p]=c,u++)}return a}if(n!==void 0)throw new N(`Unsupported fillNull strategy: "${n}"`);return a})}filter(t){return A(this,(n,r)=>{let o=Ot(t,r,n.length);return Fn(n,o,{nullify:!0})})}first(){return this.o(t=>t[0]??null)}floor(){return A(this,k(Math.floor))}floordiv(t){return A(this,G(this,t,(n,r)=>r===0?null:Math.floor(n/r)))}ge(t){return A(this,G(this,t,(n,r)=>n>=r))}gt(t){return A(this,G(this,t,(n,r)=>n>r))}hasNulls(){return this.anyNull()}hypot(t){return A(this,G(this,t,Math.hypot))}implode(){return this.o(t=>t)}isClose(t,{absTol:n=1e-8,relTol:r=1e-8,nansEqual:o=!1}={}){return A(this,G(this,t,(i,s)=>{if(U(i)&&U(s)){let a=Math.abs(i-s),l=Math.max(r*Math.max(Math.abs(i),Math.abs(s)),n);return a<=l}return Number.isNaN(i)&&Number.isNaN(s)?o:i===s}))}isDuplicated(){return A(this,t=>{let{frequencies:n}=rn(t,{strict:!0}),r=t.length,o=new Array(r);for(let i=0;i<r;i++)o[i]=(n.get(t[i])||0)>1;return o})}isFinite(){return A(this,k(Number.isFinite))}isIn(t){return A(this,(n,r)=>vo(n,r,t))}isInfinite(){return A(this,k(t=>t===1/0||t===-1/0))}isNan(){return A(this,k(Number.isNaN))}isNDistinct(t,n=!0){return A(this,(r,o)=>{let{values:i}=rn(r,{strict:!0}),s=Un(i,t,n);return this.eq(s).evaluate(o,r.length)})}isNotNan(){return this.isNan().not()}isNotNull(){return this.isNull().not()}isNull(){return this.eqMissing(null)}isUnique(){return this.isDuplicated().not()}kurtosis(t={}){return this.o(n=>ds(n,t))}lag(t=1,n=null){return this.j(function(r,o,i){let s=n;return i-t>=0&&(s=r[i-t]),s})}last(){return this.o(t=>t[t.length-1]??null)}le(t){return A(this,G(this,t,(n,r)=>n<=r))}lead(t=1,n=null){return this.j(function(r,o,i){let s=n;return i+t<r.length&&(s=r[i+t]),s})}log(t=Math.E){return A(this,k(n=>n<=0?null:t===Math.E?Math.log(n):Math.log(n)/Math.log(t)))}log1p(){return A(this,k(t=>t<=-1?null:Math.log1p(t)))}lt(t){return A(this,G(this,t,(n,r)=>n<r))}max(){return this.o(t=>K(t).max)}maxBy(t){return this.k(t,n=>Zr(n,"maxIdx"))}mean(){return this.avg()}median(){return this.o(t=>dn(t,.5))}min(){return this.o(t=>K(t).min)}minBy(t){return this.k(t,n=>Zr(n,"minIdx"))}mod(t){return A(this,G(this,t,(n,r)=>r===0?null:n%r))}mode(){return this.o(t=>Le(t))}mul(t){return A(this,G(this,t,(n,r)=>n*r))}nanMax(){return this.o(t=>K(t).nanMax)}nanMin(){return this.o(t=>K(t).nanMin)}ne(t){return this.eq(t).not()}negate(){return A(this,k(t=>-t))}neMissing(t){return this.eqMissing(t).not()}not(){return A(this,k(t=>!t))}notIn(t){return this.isIn(t).not()}nullCount(){return this.o(t=>K(t).nullCount)}nUnique(t={}){return this.o(n=>rn(n,t).count)}or(t){return A(this,(n,r)=>{let o=n.length,i=this.v(t,r,o),s=V(i),a=new Array(o);for(let l=0;l<o;l++){let c=n[l],u=s?i[l]:i;c===!0||u===!0?a[l]=!0:c==null||u==null?a[l]=null:a[l]=!1}return a})}over(t){let n=A(this),r=Array.isArray(t)?t:[t];return n.I=r,n}pow(t){return A(this,G(this,t,Math.pow))}product(){return this.o(t=>K(t).product)}quantile(t){if(t<0||t>1)throw new ot("Quantile q must be between 0 and 1");return this.o(n=>dn(n,t))}radians(){return A(this,k(t=>t*(Math.PI/180)))}rand(t,{min:n=0,max:r=1,integer:o=!1}={}){return A(this,i=>{let s=i.length,a=new Float64Array(s),l=t!==void 0?ns(t):Math.random,c=r-n;for(let u=0;u<s;u++){let f=l();a[u]=o?Math.floor(f*(c+1))+n:f*c+n}return a})}rank(t={}){return this.j(function(n,r,o){return br(n,n[o],t)})}reverse(){return A(this,t=>t.slice().reverse())}rolling(t,n){let r=typeof t=="number"?t:t?.windowSize??NaN;if(!Number.isFinite(r)||r<1)throw new N("rolling: windowSize must be a positive number >= 1");if(!n||typeof n!="function"&&typeof n.evaluate!="function")throw new N("rolling: second argument must be a reducer function or ColumnExpression");let o=Math.floor(r),i=n.f||this.f||"val",s=typeof n=="function"?n:n.A??(a=>{let l=Ot(n,{[i]:a},a.length);return Array.isArray(l)?l[l.length-1]:l});return this.j(function(a,l,c){let u=Math.max(0,c-o+1),f=c+1;return s(a.slice(u,f))})}rollingMax(t){return this.rolling(t,n=>K(n).max)}rollingMean(t){return this.rolling(t,n=>K(n).mean)}rollingMedian(t){return this.rolling(t,n=>dn(n,.5))}rollingMin(t){return this.rolling(t,n=>K(n).min)}rollingQuantile(t,n){return this.rolling(n,r=>dn(r,t))}rollingRank(t){return this.rolling(t,n=>br(n,n[n.length-1],{ignoreNulls:!0}))}rollingStd(t){return this.rolling(t,n=>K(n).std)}rollingSum(t){return this.rolling(t,n=>K(n).sum)}round(t=0){return A(this,k(n=>Xr(n,t)))}roundSigFigs(t){return A(this,k(n=>U(n)?Number(n.toPrecision(t)):n))}rowNumber(){let t=this.j(function(n,r,o){return o+1});return t.O="row_number",t}sign(){return A(this,k(Math.sign))}sin(){return A(this,k(Math.sin))}sinh(){return A(this,k(Math.sinh))}skew(t={}){return this.o(n=>ys(n,t))}spearmanCorr(t){return this.k(t,n=>us(n))}sqrt(){return A(this,k(t=>t<0?null:Math.sqrt(t)))}std(){return this.o(t=>K(t).std)}sub(t){return A(this,G(this,t,(n,r)=>n-r))}sum(){return this.o(t=>K(t).sum)}tan(){return A(this,k(Math.tan))}tanh(){return A(this,k(Math.tanh))}trunc(){return A(this,k(Math.trunc))}variance(){return this.o(t=>K(t).variance)}wAvg(t){return this.k(t,n=>fs(n))}xor(t){return A(this,G(this,t,(n,r)=>!!n!=!!r))}}});var xr,Ae,Vo=j(()=>{"use strict";cn();Yt();st();Qt();nt();xr=class{constructor(t){T(this,"expr",t)}l(t){return A(this.expr,k(n=>V(n)?t(n):null))}ft(t,n){let r=A(this.expr,G(this.expr,t,(o,i)=>V(o)?n(o,i):null));return r.C=void 0,r}agg(t){return A(this.expr,(n,r)=>{let o=n.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=n[a];if(!V(l)){i[a]=null;continue}let c=l.length;s[pn]=l;let u=Ot(t,s,c);i[a]=V(u)?u[0]??null:u}return i})}all(){return this.l(t=>H(t,n=>!!n,{mode:"every"}))}any(){return this.l(t=>H(t,n=>!!n,{mode:"some"}))}argMax(){return this.l(t=>K(t).maxIdx)}argMin(){return this.l(t=>K(t).minIdx)}contains(t){return this.ft(t,(n,r)=>Array.prototype.includes.call(n,r))}containsAll(t){return this.l(n=>H(t,r=>Array.prototype.includes.call(n,r),{mode:"every"}))}containsAny(t){return this.l(n=>H(t,r=>Array.prototype.includes.call(n,r),{mode:"some"}))}countMatches(t,n={}){return this.ft(t,(r,o)=>rn(r,n).frequencies.get(o)??0)}filter(t){return A(this.expr,(n,r)=>{let o=n.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=n[a];if(!V(l)){i[a]=null;continue}let c=l.length;s[pn]=l;let u=Ot(t,s,c);i[a]=Fn(l,u)}return i})}explode({emptyAsNull:t=!0,keepNulls:n=!0}={}){return A(this.expr,r=>{let o=r.length,i=0;for(let c=0;c<o;c++){let u=r[c];if(V(u)){i+=u.length||(t?1:0);continue}if(u!=null){i+=1;continue}n&&(i+=1)}let s=new Array(i),a=new Int32Array(i),l=0;for(let c=0;c<o;c++){let u=r[c];if(V(u)){let f=u.length;if(f>0){for(let p=0;p<f;p++)a[l]=c,s[l++]=u[p];continue}t&&(a[l]=c,s[l++]=null);continue}if(u!=null){a[l]=c,s[l++]=u;continue}n&&(a[l]=c,s[l++]=null)}return s.rowMap=a,s})}first(t=!0){return this.get(0,t)}gather(t,n=!0){return this.l(r=>{let o=typeof t=="number"?[t]:t,i=o.length,s=new Array(i);for(let a=0;a<i;a++)s[a]=Un(r,o[a],n);return s})}gatherEvery(t={}){return this.l(n=>Pe(n,t))}get(t,n=!0){return this.l(r=>Un(r,t,n))}join(t=",",n={}){return this.l(r=>Ve(r,t,n))}last(t=!0){return this.get(-1,t)}len(){return this.lengths()}lengths(){return this.l(t=>t.length)}max(){return this.l(t=>K(t).max)}mean(){return this.l(t=>K(t).mean)}median(){return this.l(t=>dn(t,.5))}min(){return this.l(t=>K(t).min)}mode(){return this.l(t=>Le(t))}nUnique(t={}){return this.l(n=>rn(n,t).count)}reverse(){return this.l(t=>t.slice().reverse())}shift(t=1){return this.l(n=>ss(n,t))}slice(t,n){return this.l(r=>r.slice(t,n))}splice(t,n,...r){return this.l(o=>{let i=[...o];return i.splice(t,n??i.length,...r),i})}sort(t){return this.l(n=>re(n,t))}std(){return this.l(t=>K(t).std)}sum(){return this.l(t=>K(t).sum)}toStruct({upperBound:t,fields:n}={}){return A(this.expr,r=>{let o=r.length,i=new Array(o),s=0;if(Array.isArray(n))s=n.length;else if(typeof t=="number")s=t;else for(let l=0;l<o;l++){let c=r[l];V(c)&&c.length>s&&(s=c.length)}if(s===0)throw new ot("toStruct cannot be evaluated: struct width is 0. Provide an upperBound, non-empty fields names, or non-empty lists.");let a=new Array(s);for(let l=0;l<s;l++)typeof n=="function"?a[l]=n(l):a[l]=(Array.isArray(n)?n[l]:null)??`field_${l}`;for(let l=0;l<o;l++){let c=r[l];if(!V(c)){i[l]=null;continue}let u={};for(let f=0;f<s;f++)u[a[f]]=Un(c,f,!0);i[l]=u}return i})}unique(t={}){return this.l(n=>rn(n,t).values)}variance(){return this.l(t=>K(t).variance)}eval(t){return A(this.expr,(n,r)=>{let o=n.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=n[a];if(!V(l)){i[a]=null;continue}let c=l.length;if(s[pn]=l,t.A!=null&&(t.I==null||t.I.length===0)){let f=t.N!==void 0?t.N:t.p.length,p=t.J(f,s,c),m=t.A(Array.from(p));i[a]=t.Y(f,[m],s)}else i[a]=Ot(t,s,c)}return i})}},Ae=class extends ht{get arr(){return new xr(this)}}});var wr,Se,Lo=j(()=>{"use strict";cn();Yt();Et();st();wr=class{constructor(t){T(this,"expr",t)}e(t){return A(this.expr,k(n=>t(String(n))))}T(t,n){return t==null?A(this.expr,r=>new Array(r.length).fill(null)):n()}pt(t,n){return n==null?!1:yt(n)?(n.lastIndex=0,n.test(t)):t.includes(n)}concat(t){return A(this.expr,G(this.expr,t,(n,r)=>String(n)+String(r)))}contains(t){return this.T(t,()=>this.e(n=>this.pt(n,t)))}containsAny(t){return this.T(t,()=>{let n=xt(t),r=n.length;return this.e(o=>{for(let i=0;i<r;i++)if(this.pt(o,n[i]))return!0;return!1})})}countMatches(t,n={}){let r=typeof n=="boolean"?n:n?.literal??!1;return this.T(t,()=>this.e(o=>{let i=r?It(t):t,s=bn(o,i,{global:!0});if(!s)return 0;let a=s.input.match(s.reg);return a?a.length:0}))}escapeRegex(t={}){return this.e(n=>It(n,t))}decode(t){return this.e(n=>Fs(n,t.encoding,t))}encode(t){return this.e(n=>Us(n,t.encoding))}decodeUriComponent(){return this.e(t=>{try{return decodeURIComponent(t)}catch{return t}})}encodeUriComponent(){return this.e(t=>{try{return encodeURIComponent(t)}catch{return t}})}endsWith(t){return this.e(n=>n.endsWith(t))}explode(){return this.e(t=>t.split(""))}extract(t,n){return this.T(t,()=>this.e(r=>ro(r,t,n)))}extractAll(t,n){return this.T(t,()=>this.e(r=>Vs(r,t,n)??[]))}extractGroups(t,n={}){return this.T(t,()=>this.e(r=>Ls(r,t,n)))}extractMany(t,n={}){return this.T(t,()=>this.e(r=>$s(r,t,n)))}find(t,n={}){return this.T(t,()=>this.e(r=>jn(r,t,n)))}findMany(t,n={}){return this.T(t,()=>this.e(r=>Ks(r,t,n)))}head(t=1){return this.slice(0,t)}join(t="",n={}){return A(this.expr,k(r=>{let o=xt(r);return o==null?null:Ve(o,t,n)}))}jsonDecode(t={}){return this.e(n=>se(n,t))}jsonPathMatch(t){return this.e(n=>Os(n,t))}len(){return this.lenChars()}lenBytes(){return this.e(t=>nn.encode(t).length)}lenChars(){return this.e(t=>t.length)}lower(){return this.e(t=>t.toLowerCase())}lpad(t,n=" "){return this.e(r=>r.padStart(t,n))}normalize(t){return this.e(n=>n.normalize(t))}padEnd(t,n=" "){return this.rpad(t,n)}padStart(t,n=" "){return this.lpad(t,n)}replace(t,n,r){return this.T(t,()=>this.e(o=>ue(o,t,n,{n:1,...r})??o))}replaceAll(t,n,r){return this.T(t,()=>this.e(o=>ue(o,t,n,{...r,n:-1})??o))}replaceMany(t,n,r){return this.T(t,()=>this.e(o=>Js(o,t,n,r)??o))}reverse(){return this.e(t=>t.split("").reverse().join(""))}rpad(t,n=" "){return this.e(r=>r.padEnd(t,n))}slice(t,n){return this.e(r=>{let o=t<0?r.length+t:t,i=n!==void 0?o+n:void 0;return r.slice(o,i)})}split(t,n){return this.e(r=>qs(r,t,n))}startsWith(t){return this.e(n=>n.startsWith(t))}stripChars(t,n){return this.e(r=>dt(r,t,{mode:"both",...n}))}stripCharsEnd(t,n){return this.e(r=>dt(r,t,{mode:"end",...n}))}stripCharsStart(t,n){return this.e(r=>dt(r,t,{mode:"start",...n}))}stripPrefix(t){return this.e(n=>dt(n,t,{mode:"start",maxScanStart:1,maxMatchesStart:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}stripSuffix(t){return this.e(n=>dt(n,t,{mode:"end",maxScanEnd:1,maxMatchesEnd:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}tail(t=1){return this.slice(-t)}strptime(t){return this.e(n=>na(n,t))}toCamelCase(){return this.e(t=>vn(t,{format:"camel"}))}toDate(){return this.e(t=>X(t,{dateOnly:!0}))}toDatetime(){return this.e(X)}toDecimal(t,n){return this.e(r=>Be(r,{precision:t,scale:n}))}toInteger(){return this.e(t=>bt(t))}toKebabCase(){return this.e(t=>vn(t,{format:"kebab"}))}toLowerCase(){return this.lower()}toPascalCase(){return this.e(t=>vn(t,{format:"pascal"}))}toSnakeCase(){return this.e(t=>vn(t,{format:"snake"}))}toTime(){return this.e(Xe)}toTitleCase(){return this.e(t=>vn(t,{format:"title"}))}toUpperCase(){return this.upper()}trim(){return this.stripChars()}trimEnd(){return this.stripCharsEnd()}trimStart(){return this.stripCharsStart()}upper(){return this.e(t=>t.toUpperCase())}zfill(t){return this.e(n=>n.padStart(t,"0"))}},Se=class extends ht{get str(){return new wr(this)}}});function da(e){return be(e,"Column reference cannot be null or undefined."),Ar||(Ar=(Dt(),Mr(ha)).ColumnExpr),Ar.isColExpr(e)?e:new Ar(e)}var Ar,Sr,Oe,$o=j(()=>{"use strict";cn();nt();Ar=null;Sr=class{constructor(t){T(this,"expr",t);return new Proxy(this,{get(n,r,o){return r in n?Reflect.get(n,r,o):typeof r=="string"?n.field(r):Reflect.get(n,r,o)}})}field(t){let n=A(this.expr,r=>{let o=r.length,i=new Array(o);for(let s=0;s<o;s++){let a=r[s];i[s]=a!=null&&typeof a=="object"?a[t]:null}return i});return n.F=this.expr,n.Z=t,n.alias(t)}renameFields(t){return A(this.expr,n=>{let r=n.length,o=new Array(r),i=Object.keys(t),s=i.length;for(let a=0;a<r;a++){let l=n[a];if(l==null||typeof l!="object"){o[a]=null;continue}let c={},u=Object.keys(l),f=u.length;for(let p=0;p<f;p++){let m=u[p];c[m]=l[m]}for(let p=0;p<s;p++){let m=i[p];if(m in c){let y=t[m];c[y]=c[m],delete c[m]}}o[a]=c}return o})}withFields(t){return A(this.expr,(n,r)=>{let o=n.length,i=new Array(o),s=[];if(Array.isArray(t)){let c=t.length;for(let u=0;u<c;u++){let f=t[u],p=da(f),m=p.O||p.f;if(!m)throw new N("Expressions passed to struct.withFields must have a name/alias.");s.push({name:m,expr:p})}}else if(t&&typeof t=="object"){let c=Object.keys(t),u=c.length;for(let f=0;f<u;f++){let p=c[f],m=da(t[p]);s.push({name:p,expr:m})}}let a=s.length,l=new Array(a);for(let c=0;c<a;c++)l[c]=s[c].expr.evaluate(r,o);for(let c=0;c<o;c++){let u=n[c];if(u==null||typeof u!="object"){i[c]=null;continue}let f={},p=Object.keys(u),m=p.length;for(let y=0;y<m;y++){let d=p[y];f[d]=u[d]}for(let y=0;y<a;y++)f[s[y].name]=l[y][c];i[c]=f}return i})}unnest(){let t=A(this.expr);return t.Q=!0,t.F=this.expr,t}},Oe=class extends ht{get struct(){return new Sr(this)}}});var ha={};kr(ha,{ColumnExpr:()=>M,resolveColumnSelectors:()=>Ht});function cu(e,t){for(let n of t)for(let r of Object.getOwnPropertyNames(n.prototype))r!=="constructor"&&Object.defineProperty(e.prototype,r,Object.getOwnPropertyDescriptor(n.prototype,r)||Object.create(null))}function fu(e,t,n,r){if(e instanceof M&&e.G?.length)return e.G;if(!(e instanceof M)&&(!v(e)||!("evaluate"in e)||e.f))return null;let o;if(!(e instanceof M))o=()=>!0;else if(e.f==="*"){let a=new Set(e.mt);o=l=>!a.has(l)}else if(e.z?.length){let a=e.z,l=a.length;o=c=>{for(let u=0;u<l;u++)if(a[u].lastIndex=0,a[u].test(c))return!0;return!1}}else if(e.W?.length){if(!r)throw new un("Cannot resolve DataType column selector without DataFrame schema.");let a=e.W,l=a.length;o=c=>{let u=r[c];if(!u)return!1;for(let f=0;f<l;f++)if(u.matches(a[f]))return!0;return!1}}else return null;let i=[],s=t.length;for(let a=0;a<s;a++){let l=t[a];!n.has(l)&&o(l)&&i.push(l)}return i}function Ht(e,t,n,r,o){let i=[],s=n?new Set(n):new Set;for(let a=0;a<e.length;a++){let l=e[a];if(typeof l=="string"){i.push(new M(l));continue}if(v(l)&&l.Q&&l.F){let u=l.F,f=[],p=l.f;if(typeof p=="string"&&r&&r[p]&&r[p].name==="Struct"&&(f=Object.keys(r[p].fields)),f.length===0&&o){let d=Object.keys(o)[0],h=d?o[d].length:0,g=u.evaluate(o,h),x=g.length;for(let b=0;b<x;b++){let O=g[b];if(O!=null&&typeof O=="object"){f=Object.keys(O);break}}}let m=f.length;if(m>0){for(let y=0;y<m;y++){let d=f[y],h=u.struct.field(d);i.push(h)}continue}}let c=fu(l,t,s,r);if(c!==null)for(let u=0;u<c.length;u++){let f=new M(c[u]);f.p=[...l.p||[]],f.A=l.A,f.U=l.U,f.N=l.N,f.I=l.I,l.R&&(f.R=l.R),l.O&&l.O!=="*"&&(f.O=l.O),i.push(f)}else i.push(l)}return i}var M,Dt=j(()=>{"use strict";cn();Po();Lo();Ko();Vo();$o();st();Jt();nt();M=class e extends ht{constructor(n){super();T(this,"f","");T(this,"G");T(this,"mt",[]);T(this,"yt");T(this,"W");T(this,"Ct");T(this,"z");if(yt(n)){this.z=[n];return}if(n instanceof Z||typeof n=="function"){this.W=[n];return}if(!Array.isArray(n)){this.f=String(n),this.O=this.f;return}if(H(n,s=>s instanceof Z||typeof s=="function",{mode:"some"})){this.W=n;return}let r=n.length,o=[],i;for(let s=0;s<r;s++){let a=n[s];yt(a)?(i??(i=[])).push(a):o.push(String(a))}i&&(this.z=i),o.length>0&&(this.G=o)}static isColExpr(n){if(!v(n))return!1;try{return"evaluate"in n&&typeof n.evaluate=="function"}catch{return!1}}static toColExpr(n){return be(n,"Column reference cannot be null or undefined."),e.isColExpr(n)?n:new e(n)}};cu(M,[we,Se,Te,Ae,Oe])});function Dn(e,t={strict:!0}){let n=t,r=new M(Ur);return r.P=e,n.name&&(r.O=n.name),r.p.push(o=>{let i=o.length,s=n.strict!==!1,a=(g,x)=>g===void 0?x:z(g<0?i+g:g,{min:0,max:i}),l=a(n.startIndex,0),c=a(n.endIndex,i),u=Math.max(0,c-l),f=n.n!==void 0?n.n:u;if(s){if(f!==i)throw new at(`Column height mismatch: seqRange length ${f} does not match DataFrame height ${i}`)}else{let g=n.pad??!1,x=n.truncate??!1;if(g&&!x&&f>u)throw new at(`Cannot pad seqRange output: specified length ${f} starting at index ${l} exceeds slice width ${u} (requires truncation).`);if(x&&!g&&f<u)throw new at(`Cannot truncate seqRange output: specified length ${f} starting at index ${l} is less than slice width ${u} (requires padding).`)}let p=n.mode||"cumulative",m=n.step!==void 0?n.step:1,y=n.dtype?g=>n.dtype.coerce(g):g=>g,d=y(!s&&n.padValue!==void 0?n.padValue:null),h=s&&n.dtype?.allocate?n.dtype.allocate(i):new Array(i).fill(d);return is(h,e,{mode:p,step:m,coerce:y,startIndex:s?0:l,endIndex:s?i:Math.min(l+f,c)}),h}),r}var qo=j(()=>{"use strict";Dt();Qt();nt();st()});function Zt(e,t={}){let n=Dn(e,{...t,mode:"constant"});return n.B=!0,n}var Or=j(()=>{"use strict";qo()});var ga={};kr(ga,{duration:()=>Tr});function Tr(e={}){if(typeof e=="string"){let s=Io(e,{to:"ms"}),a=Zt(s).alias("duration");return a._=new St("ms"),a}let t=0,n=null,r=!1,o=e;for(let s in o){let a=ln[s];if(a===void 0)continue;let l=o[s];if(l==null)continue;if(r=!0,U(l)){t+=l*a;continue}let c=M.toColExpr(l).mul(a);n=n?n.add(c):c}if(!r)throw new N("At least one duration component must be specified for $df.duration().");let i=n?t!==0?n.add(Zt(t)):n:Zt(t);return i._=new St("ms"),i.alias("duration")}var Go=j(()=>{"use strict";Dt();Or();Vn();nt();st()});var Er,Te,Ko=j(()=>{"use strict";Vn();nt();cn();Yt();st();Et();Er=class{constructor(t){T(this,"expr",t)}tt(){let t=this.expr._;return t instanceof vt?t.timeZone:null}Et(){let t=this.expr._;return t instanceof vt?t.timeUnit:null}nt(t){return A(this.expr,k(n=>{let r=X(n);return r?t(r):null}))}castTimeUnit(t){return this.expr.cast(new vt(t,this.tt()))}century(t){return this.year(t).sub(1).floordiv(100).add(1)}convertTimeZone(t){let n=this.tt();if(this.expr._ instanceof vt&&n===null)throw new N('convertTimeZone() requires a timezone-aware Datetime column. Use .dt.replace({ timeZone: "..." }) to assign a timezone first.');return this.expr.cast(new vt(this.Et()??"ms",t))}date(){return this.replace({hour:0,minute:0,second:0,ms:0})}day(t){return this.strftime({format:"%d",timeZone:t}).cast(ct)}daysInMonth(t){return this.monthEnd().dt.day(t)}epoch(t="ms"){return this.nt(n=>Hs(n,t))}hour(t){return this.strftime({format:"%H",timeZone:t}).cast(ct)}isBusinessDay(t={}){return this.nt(n=>oa(n,t))}isLeapYear(t){let n=this.year(t);return n.mod(4).eq(0).and(n.mod(100).ne(0)).or(n.mod(400).eq(0)).cast(On)}isoWeek(t){return this.strftime({format:"%V",timeZone:t}).cast(ct)}isoYear(t){return this.strftime({format:"%G",timeZone:t}).cast(ct)}microsecond(t){return this.strftime({format:"%f",timeZone:t}).cast(ct)}millennium(t){return this.year(t).sub(1).floordiv(1e3).add(1)}millisecond(t){return this.strftime({format:"%ms",timeZone:t}).cast(ct)}minute(t){return this.strftime({format:"%M",timeZone:t}).cast(ct)}month(t){return this.strftime({format:"%m",timeZone:t}).cast(ct)}monthEnd(){return this.replace({day:-1,hour:0,minute:0,second:0,ms:0})}monthStart(){return this.replace({day:1,hour:0,minute:0,second:0,ms:0})}nanosecond(t){return this.microsecond(t).mul(1e3)}offsetDay(t,n={}){let o=n?.excludeWeekdays?.length||n?.holidays||n?.roll?A(this.expr,G(this.expr,t,(s,a)=>{let l=X(s);return l?ra(l,a,n):null})):t,{duration:i}=(Go(),Mr(ga));return this.expr.add(i({days:o}))}ordinalDay(t){return this.strftime({format:"%j",timeZone:t}).cast(ct)}quarter(t){return this.month(t).div(3).ceil()}replace(t){return A(this.expr,k(n=>{let r=X(n);return r?ia(r,t):null}))}second(){return this.strftime({format:"%S",timeZone:"UTC"}).cast(ct)}strftime(t){let n=this.tt(),r=n&&!t.timeZone?{...t,timeZone:n}:t;return this.nt(o=>fe(o,r))}time(){return this.strftime({format:"%H:%M:%S.%ms",timeZone:"UTC"})}timestamp(t="ms"){return this.epoch(t)}totalDays(){return this.totalHours().div(24)}totalHours(){return this.totalMinutes().div(60)}totalMicroseconds(){return this.totalMilliseconds().mul(Qn)}totalMilliseconds(){return this.expr}totalMinutes(){return this.totalSeconds().div(60)}totalNanoseconds(){return this.totalMilliseconds().mul(te)}totalSeconds(){return this.totalMilliseconds().div(_t)}utcOffset(t,n={}){return A(this.expr,k(r=>{let o=X(r);return o?so(o,t,n):null}))}week(t){return this.isoWeek(t)}weekday(t){return this.strftime({format:"%u",timeZone:t}).cast(ct)}year(t){return this.strftime({format:"%Y",timeZone:t}).cast(ct)}},Te=class extends ht{get dt(){return new Er(this)}}});function fn(){return new M("*")}var ba=j(()=>{"use strict";Dt()});function qn(e){let t=new M("*");return t.mt=Array.isArray(e)?e:[e],t}var xa=j(()=>{"use strict";Dt()});function Jo(...e){let t=e.length===1&&Array.isArray(e[0])?e[0]:e,n=new M(Fr);return n.p.push((r,o)=>{let i=r.length,s=t.length,a=new Array(s),l=new Array(s);for(let u=0;u<s;u++){let f=t[u],p=En(f,o,i);a[u]=p,l[u]=In(f,p,o,i)}let c=new Array(i);for(let u=0;u<i;u++){let f=null;for(let p=0;p<s;p++){let m=a[p],y=l[p]?m[u]:m;if(y!=null){f=y;break}}c[u]=f}return c}),n}var wa=j(()=>{"use strict";Dt();Yt();Qt()});function Wo(e){return new Ee([e])}var Ee,Ir,Aa=j(()=>{"use strict";Dt();Yt();Qt();Ee=class{constructor(t,n=[]){T(this,"_predicates",t);T(this,"_values",n)}then(t){return new Ir(this.et,[...this.L,t])}},Ir=class e extends M{constructor(n=[],r=[],o=null){super(vr);T(this,"_predicates",n);T(this,"_values",r);T(this,"_otherwise",o);this.p=[(i,s)=>{let a=i.length,l=this.et,c=this.L,u=l.length,f=new Array(u),p=new Array(u),m=new Array(u),y=new Array(u);for(let b=0;b<u;b++){let O=l[b],w=c[b],S=En(O,s,a),I=En(w,s,a);f[b]=S,p[b]=I,m[b]=In(O,S,s,a),y[b]=In(w,I,s,a)}let d=this.rt,h=En(d,s,a),g=In(d,h,s,a),x=new Array(a);for(let b=0;b<a;b++){let O=!1;for(let w=0;w<u;w++)if((m[w]?f[w][b]:f[w])===!0){x[b]=y[w]?p[w][b]:p[w],O=!0;break}O||(x[b]=g?h[b]:h)}return x}]}get Rt(){return this.rt}get ot(){return this.rt!=null?[...this.L,this.rt]:this.L}when(n){return new Ee([...this.et,n],this.L)}otherwise(n){return new e(this.et,this.L,n)}}});function zo(e){return M.toColExpr(e).implode()}var Sa=j(()=>{"use strict";Dt()});function Xo(){return new M(pn)}var Oa=j(()=>{"use strict";Dt();Qt()});function Yo(e,...t){let n;Array.isArray(e)||e&&typeof e=="object"&&!M.isColExpr(e)?n=e:n=[e,...t];let r=Zt({}).struct.withFields(n);return delete r.B,delete r.P,r.f=jr,r.alias("struct")}var Ta=j(()=>{"use strict";Dt();Or();Qt()});function Cn(e,t){if(e==null)return;if(e instanceof Z)return e;if(typeof e=="object"&&("_ops"in e||"_literalValue"in e||"_targetType"in e))return Gn(e,t);let n=tt(e);if(typeof n=="string")return t[n]??D.Utf8;if(typeof n=="boolean")return D.Boolean;if(typeof n=="bigint")return Mn(n,{range:"Int64"})?D.Int64:D.UInt64;if(U(n))return At(n,{range:"Int32"})?D.Int32:Number.isInteger(n)?D.Int64:D.Float64;if(L(n))return D.Datetime;if(Is(n,{strict:!0}))return D.Binary;if(Array.isArray(n)){let r,o=n.length;for(let i=0;i<o;i++){let s=n[i];if(s!=null&&(r=Cn(s,t)))break}return D.Array(r??D.Utf8)}if(it(n)){let r=tn?tn.call(n):n.constructor.name,o=mu[r];return o?D.Array(o):D.Binary}if(v(n))return D.Object}function Ho(e,t,n){if(!e||!t)return;if(n&&n.length>0){let a=!1;for(let l=0;l<n.length;l++){let c=n[l];if(c!=null){if(typeof c!="boolean"){a=!1;break}a=!0}}if(a)return D.Boolean}let r=e instanceof St,o=t instanceof St,i=e.isTemporal&&!r,s=t.isTemporal&&!o;if(i||s){if(i&&s){let a=e.timeUnit||t.timeUnit||"ms";return new St(a)}return i?e:t}if(r||o)return r?e:t;if(e.isUtf8||t.isUtf8)return D.Utf8;if(e.isNumeric&&t.isNumeric){let a=e instanceof An||t instanceof An,l=e instanceof wn||t instanceof wn,c=e instanceof Gt||t instanceof Gt;if(a||l&&c)return D.Float64;if(l)return D.Float32;if(c)return e instanceof Gt?e:t;if(n!==void 0){let p={range:{min:-1/0,max:1/0}},m=n.length;for(let y=0;y<m;y++){let d=n[y];if(U(d)&&!At(d,p))return D.Float64}}if(e===t)return e;let u=e.name,f=t.name;return u.endsWith("64")||f.endsWith("64")?D.Int64:u.endsWith("32")||f.endsWith("32")?u==="UInt32"&&f==="UInt32"?D.UInt32:D.Int32:u.endsWith("16")||f.endsWith("16")?u==="UInt16"&&f==="UInt16"?D.UInt16:D.Int16:u==="UInt8"&&f==="UInt8"?D.UInt8:D.Int8}}function Gn(e,t,n){if(!e)return;if(e._)return e._;if(e.yt instanceof Z)return e.yt;if(e.B&&e.P!==void 0)return Cn(e.P,t);if(e.C)return Ho(Cn(e.C.left,t),Cn(e.C.right,t),n);if(e.ot){let s,a=e.ot.length;for(let l=0;l<a;l++){let c=Cn(e.ot[l],t);c&&(s?s!==c&&s.isNumeric&&c.isNumeric&&(s=Ho(s,c,n)??s):s=c)}if(s)return s}if(e.F&&e.Z){let s=Cn(e.F,t);if(s instanceof Pn)return s.fields?.[e.Z]}let r=e.f?t[e.f]:void 0,o=n?.[0],i=(!e.p||e.p.length===0)&&!e.A&&!e.R;if(r){if(r instanceof Sn&&(e.Q||n?.rowMap))return r.innerType;if(!(r instanceof Sn)&&Array.isArray(o))return D.Array(r);if(i||r.isTemporal&&e.A&&(L(o)||typeof o=="string")||r instanceof St&&e.A&&U(o))return r}if(e.A&&U(o))return!Number.isInteger(o)||r?.isNumeric&&!(r instanceof St)?D.Float64:D.Int32}var mu,Ea=j(()=>{"use strict";Vn();Jt();st();mu={Int8Array:D.Int8,Uint8Array:D.UInt8,Uint8ClampedArray:D.UInt8,Int16Array:D.Int16,Uint16Array:D.UInt16,Int32Array:D.Int32,Uint32Array:D.UInt32,BigInt64Array:D.Int64,BigUint64Array:D.UInt64,Float32Array:D.Float32,Float64Array:D.Float64}});var Ie=j(()=>{"use strict";Qt();ai();cn();Po();Vo();Lo();Ko();$o();Dt();Or();ba();xa();wa();Aa();Sa();qo();Oa();Ta();Go();Ea();Yt()});var Jn,Ia=j(()=>{"use strict";Kn();gr();Ie();Jn=class{constructor(t,n,r,o,i,s,a){T(this,"$");T(this,"it");T(this,"ht");T(this,"X");T(this,"bt");T(this,"H");T(this,"st");this.$=t,this.it=n,this.ht=r,this.X=o,this.bt=i,this.H=s,this.st=a}xt(t){let n=this.$.size,r=t.length,o={},i={};for(let a=0;a<r;a++){let l=t[a];o[l]=new Array(n),i[l]=this.H[l]}let s=0;for(let a of this.$.values()){if(a.length===0)continue;let l=a[0];for(let c=0;c<r;c++){let u=t[c],f=this.st?.[u]?this.st[u][s]:this.X[u]?.[l];o[u][s]=f===void 0?null:f}s++}return{newColumns:o,outSchema:i,groupCount:s}}ut(t){let n=t.length,r=new Array(n);for(let o=0;o<n;o++)r[o]=String(t[o]);return r}toDataframe(){let t=this.ut(this.it),{newColumns:n,outSchema:r,groupCount:o}=this.xt(t);return q.S(n,r,o)}agg(...t){let n=this.ut(this.ht),r=this.ut(this.it),o=Ht(t.flat(),n,r,this.H,this.X),{newColumns:i,outSchema:s,groupCount:a}=this.xt(r),l=this.$.size;for(let c=0;c<o.length;c++){let u=o[c],f=u.O||u.f||"*";if(!u.A)i[f]=u.evaluate(i,l);else{let p=u.J(u.N,this.X,this.bt),m=new Array(l),y=0;for(let d of this.$.values()){if(d.length===0)continue;let h=new Array(d.length);for(let g=0;g<d.length;g++)h[g]=p[d[g]];m[y]=u.A(h),y++}i[f]=u.Y(u.N,m,i)}}for(let c of o){let u=c.O||c.f||"*",f=Gn(c,this.H,i[u])||Xt(i[u]);s[u]=f,i[u]=Bt(i[u],f,a)}return q.S(i,s,a)}}});function Ca(e,t,n,r){if(it(e)&&it(t)){t.set(e,n);return}let o=t;for(let i=0;i<r;i++)o[n+i]=e[i]}function pu(e,t,n){if(e==null)throw new Y(`Invalid input to ${t} at index ${n}: item cannot be null or undefined.`);if(e instanceof q)return[e];if(Vt(e))return[new q(e)];if(V(e)){if(H(e,q,{mode:"every"}))return e;if(H(e,"plainObject",{mode:"every"}))return[new q(e)];let r=H(e,q,{mode:"some"});for(let o=0;o<e.length;o++)if(r?!(e[o]instanceof q):!Vt(e[o]))throw new Y(r?`Invalid input to ${t} at index ${n}, sub-index ${o}: nested array must contain only DataFrame instances.`:`Invalid input to ${t} at index ${n}, row ${o}: rows must be plain objects.`)}throw new Y(`Invalid input to ${t} at index ${n}: expected DataFrame, row array, or column dictionary.`)}function Da(e,t,n,r,o=!1){let i={};for(let a=0;a<t.length;a++){let l=t[a],c=n[l],u=!!(o&&c);if(u){for(let f=0;f<e.length;f++)if(!it(e[f].t[l])){u=!1;break}}i[l]=u?c.allocate(r):new Array(r).fill(null)}let s=0;for(let a=0;a<e.length;a++){let l=e[a],c=l.height;if(c!==0){for(let u=0;u<t.length;u++){let f=t[u],p=l.t[f];p!==void 0&&Ca(p,i[f],s,c)}s+=c}}return q.S(i,n,r)}function Wn(e,{how:t="vertical",horizontal:n}={}){if(e==null)throw new Y("Invalid input to concat: rawItems cannot be null or undefined.");let r=Array.isArray(e)?e:[e],o=[];for(let i=0;i<r.length;i++)o.push(...pu(r[i],"concat",i));if(o.length===0)return q.S({},{},0);if(o.length===1&&t!=="horizontal")return o[0];switch(t){case"vertical":{let i=null,s=0;for(let l=0;l<o.length;l++)s+=o[l].height,!i&&o[l].height>0&&(i=o[l]);if(!i)return q.S({},{},0);let a=Object.keys(i.t);for(let l=0;l<o.length;l++){let c=o[l];if(c.height===0)continue;let u=Object.keys(c.t);if(a.length!==u.length)throw new Y(`[Strict Vertical] Column count mismatch at index ${l}.`);for(let f=0;f<a.length;f++){let p=a[f];if(p!==u[f])throw new Y(`[Strict Vertical] Schema mismatch at position ${f} in DF ${l}. Expected column "${p}", but found "${u[f]}".`);let m=i.schema[p],y=c.schema[p];if(m&&y&&!m.equals(y))throw new un(`[Strict Type Check] Schema type mismatch for column "${p}": expected ${m.name}, found ${y.name}.`)}}return Da(o,a,i.schema,s,!0)}case"horizontal":{let i=n?.strict??!0,s=0;for(let u=0;u<o.length;u++)o[u].height>s&&(s=o[u].height);let a=new Set,l={},c={};for(let u=0;u<o.length;u++){let f=o[u],p=f.height;if(i&&p!==s)throw new at(`[Horizontal] Row count mismatch at index ${u}. Expected ${s}, got ${p}. Set strict=false to allow padding.`);Object.assign(c,f.schema);let m=Object.keys(f.t);for(let y=0;y<m.length;y++){let d=m[y];if(a.has(d))throw new Y(`[Horizontal] Duplicate column name "${d}" detected. Horizontal concat requires unique names.`);a.add(d);let h=f.t[d];if(p===s)l[d]=it(h)?Array.from(h):h;else{let g=new Array(s).fill(null);Ca(h,g,0,p),l[d]=g}}}return q.S(l,c,s)}case"diagonal":{let i=new Set,s=0;for(let c=0;c<o.length;c++){s+=o[c].height;for(let u of Object.keys(o[c].t))i.add(u)}let a=Array.from(i),l={};for(let c=0;c<a.length;c++){let u=a[c],f=null;for(let p=0;p<o.length;p++){let m=o[p].schema[u];if(m){if(f===null)f=m;else if(!f.equals(m))throw new un(`[Strict Type Check] Schema type mismatch for column "${u}": expected ${f.name}, found ${m.name}.`)}}l[u]=f||D.Utf8}return Da(o,a,l,s,!1)}}}var Zo=j(()=>{"use strict";Kn();Jt();st();nt()});var q,Kn=j(()=>{"use strict";Ie();Ia();Et();ae();Jt();st();nt();Zo();gr();q=class e{constructor(t,n,r){T(this,"t");T(this,"r");T(this,"a",{});if(Array.isArray(t)){let{columns:o,height:i}=Co(t);this.t=o,this.r=i}else v(t)?(this.t=t,this.r=yr(t,r)):(this.t={},this.r=0);n?this.wt(n):this.r>0||Object.keys(this.t).length>0?this.Dt():this.a={}}static S(t,n,r){yr(t,r);let o=Object.create(e.prototype);return o.t=t,o.a=n,o.r=r,o}wt(t){this.a=t;let n=Object.keys(t),r={};for(let o of n){let i=t[o],s=this.t[o];r[o]=s?Bt(s,i,this.r):Bt(new Array(this.r).fill(null),i,this.r)}this.t=r}Dt(){let t={},n=Object.keys(this.t),r=n.length;for(let o=0;o<r;o++){let i=n[o];t[i]=Xt(this.t[i])}this.wt(t)}ct(t){let n=t.flat(1/0),r=[],o=n.length;for(let i=0;i<o;i++){let s=n[i];if(typeof s=="string")r.push(new M(s));else if(M.isColExpr(s))r.push(s);else if(s instanceof Z||typeof s=="function"||yt(s))r.push(new M(s));else if(v(s)){let a=Object.keys(s),l=a.length;for(let c=0;c<l;c++){let u=a[c],f=s[u];if(M.isColExpr(f))r.push(f.alias(u));else{let p=new M(u);p.evaluate=(m,y)=>new Array(y).fill(f),r.push(p)}}}}return r}clone(){return this.select(fn())}get columns(){return Object.keys(this.t)}concat(t,n={}){let r=H(t,e,{mode:"every",allowEmpty:!1})?t:[t];return Wn([this,...r],n)}drop(...t){return this.select(qn(t.flat()))}dropNulls(t){return this.filter(t?new M(t).isNotNull():fn().isNotNull())}get dtypes(){let t=Object.keys(this.t),n=t.length,r=new Array(n);for(let o=0;o<n;o++)r[o]=this.a[t[o]];return r}explode(t,n){let r=Array.isArray(t)?t:[t],o=this.ct(r),i=Ht(o,Object.keys(this.t),void 0,this.a,this.t),s=new Set,a=i.length;for(let f=0;f<a;f++){let p=i[f],m=p.f||p.O;if(!m||m==="*")throw new Y("Expression passed to explode must have a column name.");Q(m,this.t,"Explode column"),s.add(m)}let l=Object.keys(this.t),c=[],u=l.length;for(let f=0;f<u;f++){let p=l[f];c.push(s.has(p)?new M(p).arr.explode(n):new M(p))}return this.select(...c)}fillNull(t={}){return this.r===0?this:this.withColumns(fn().fillNull(t))}filter(...t){let n=this.r;if(n===0)return this;let r=Object.keys(this.t),o=[],i=[];for(let d=0;d<t.length;d++){let h=t[d];typeof h=="function"?i.push(h):o.push(h)}let s=Ht(o,r,void 0,this.a,this.t),a=s.length,l=i.length,c=new Array(a);for(let d=0;d<a;d++)c[d]=s[d].evaluate(this.t,n);let u=0,f=null;if(l>0){let d=this.t;f={};for(let h=0;h<r.length;h++){let g=r[h],x=d[g];Object.defineProperty(f,g,{get(){let b=x[u];return b===void 0?null:b},enumerable:!0,configurable:!0})}}let p=new Array(n),m=0;t:for(let d=0;d<n;d++){for(let h=0;h<a;h++)if(!c[h][d]){p[d]=!1;continue t}if(f){u=d;for(let h=0;h<l;h++)if(!i[h](f)){p[d]=!1;continue t}}p[d]=!0,m++}let y={};for(let d=0;d<r.length;d++){let h=r[d];y[h]=Fn(this.t[h],p)}return e.S(y,this.a,m)}groupBy(t){let n=xt(t),r=Nt(t,"string");for(let s=0;s<r.length;s++)Q(r[s],this.t,"Grouping key");let o=$n(this.t,r,this.r),i=Object.keys(this.t);return new Jn(o,n,i,this.t,this.r,this.a)}groupByDynamic(t,n){if(!n||n.every==null)throw new N('groupByDynamic requires "every" option');let{every:r,period:o,offset:i=0,truncate:s=!0,closed:a="left",label:l="left",startBy:c="window",includeBoundaries:u=!1,checkSorted:f=!0,by:p,groupBy:m}=n,y=typeof t=="string"?t:M.isColExpr(t)?t.f??String(t):String(t);if(Q(y,this.t,"Index column"),a!=="left"&&a!=="right"&&a!=="both"&&a!=="none")throw new N(`Invalid "closed" option: "${a}". Expected "left", "right", "both", or "none"`);if(l!=="left"&&l!=="right"&&l!=="datapoint")throw new N(`Invalid "label" option: "${l}". Expected "left", "right", or "datapoint"`);let d=typeof c=="string"?c.toLowerCase():"",h=d in qr;if(d!=="window"&&d!=="datapoint"&&!h)throw new N(`Invalid "startBy" option: "${c}". Expected "window", "datapoint", or a day of week`);let g=pr(i,{fallback:0});if(!U(g))throw new N(`Invalid "offset" option: ${i}`);let x=a==="left"||a==="both",b=a==="right"||a==="both",O=x?"left":"right",w=b?"right":"left",S="_lower_boundary",I="_upper_boundary",C=typeof r=="string"?ge(r):null,R=typeof o=="string"?ge(o):null,F=m??p,E=F?Nt(xt(F),"string"):[],_=Array.from(new Set(E));for(let rt=0;rt<_.length;rt++){if(_[rt]===y)throw new N(`Cannot group by index column "${y}" in secondary grouping keys`);Q(_[rt],this.t,"Secondary grouping key")}let P=this.r,W=this.t[y],B=new Float64Array(P),lt=this.a[y]?.name==="Datetime";for(let rt=0;rt<P;rt++){let gt=W[rt],_n=$(gt),Xn=_n===null?X(gt):null;Xn&&(lt=!0),B[rt]=_n??Xn?.getTime()??NaN}let kt=lt&&!!(C?.months||R?.months),ft=0,mt=0;if(!kt){if(ft=pr(r),mt=pr(o,{fallback:ft}),!U(ft)||ft<=Number.EPSILON)throw new N(`"every" must be positive, got ${r}`);if(!U(mt)||mt<=Number.EPSILON)throw new N(`"period" must be positive, got ${o}`)}let zn=_.length>0&&P>0?$n(this.t,_,P):new Map([["",Array.from({length:P},(rt,gt)=>gt)]]),mn=[..._,y,...u?[S,I]:[]],Qo=new Map,Rn={};for(let rt=0;rt<mn.length;rt++)Rn[mn[rt]]=[];let Ra=R??C,_a=0;for(let rt of zn.values()){let gt=[],_n=-1/0,Xn=!1;for(let J=0;J<rt.length;J++){let wt=rt[J],Pt=B[wt];if(U(Pt)){if(Pt<_n&&f)throw new Y(`Index column "${y}" is not sorted in ascending order`);Pt<_n&&(Xn=!0),gt.push(wt),_n=Pt}}let _r=gt.length;if(_r===0)continue;Xn&&gt.sort((J,wt)=>B[J]-B[wt]);let Nn=B[gt[0]],ti=B[gt[_r-1]],ni=null,Nr=0;if(kt){let J=new Date(Nn),wt=C.months%12===0?0:J.getUTCMonth();ni=d==="datapoint"?J:et(J.getUTCFullYear(),wt,1)}else{let J;if(d==="datapoint")J=Nn+g;else if(h&&lt){let wt=(new Date(Nn).getUTCDay()-qr[d]+7)%7;J=Math.floor(Nn/Tt)*Tt-wt*Tt+g}else J=Math.floor((Nn-g)/ft)*ft+g;Nr=!x&&Nn-J<=1e-9?J-ft:J}let Yn=0;for(;;){let J=kt?Eo(ni,C,Yn).getTime():Nr+Yn*ft;if(x?J>ti:J>=ti)break;let wt=kt?Eo(new Date(J),Ra).getTime():J+mt;Yn++;let Pt=hn(gt,J,{side:O,getValue:(Ct,Hn)=>B[Hn]}),ei=hn(gt,wt,{side:w,getValue:(Ct,Hn)=>B[Hn]});if(Pt>=ei){let Ct=!kt&&Pt<_r?B[gt[Pt]]:NaN,Hn=U(Ct)&&Ct>=wt,ka=b?Ct-mt:Ct-mt+1e-9;Hn&&(Yn=Math.max(Yn,Math.floor((ka-Nr)/ft)));continue}let ri=gt.slice(Pt,ei),oi=ri[0],ii=lt?new Date(J):J,si=lt?new Date(wt):wt;Rn[y].push(!s||l==="datapoint"?W[oi]:l==="right"?si:ii),u&&(Rn[S].push(ii),Rn[I].push(si));for(let Ct=0;Ct<_.length;Ct++)Rn[_[Ct]].push(this.t[_[Ct]][oi]);Qo.set(`__dyn_${_a++}__`,ri)}}let Rr=u?this.a[y]||(lt?D.Datetime:D.Float64):null,Na=Rr?{...this.a,[S]:Rr,[I]:Rr}:this.a;return new Jn(Qo,mn,Object.keys(this.t),this.t,this.r,Na,Rn)}head(t=10){return this.limit(t,{offset:0,from:"start"})}get height(){return this.r}hstack(t,n={}){return this.concat(t,{how:"horizontal",horizontal:n})}insertColumn(t,n,r){let o=M.toColExpr(r).alias(n),i=Object.keys(this.t),s=i.length,a=[];for(let c=0;c<s;c++){let u=i[c];u!==n&&a.push(u)}let l=z(t,{min:0,max:a.length});return a.splice(l,0,o),this.select(...a)}item(t,n){let r=this.r,o=Object.keys(this.t),i=o.length;if(t===void 0&&n===void 0){if(r!==1||i!==1)throw new Y("DataFrame.item() can only be called without arguments if the shape is (1, 1).");return this.t[o[0]][0]}if(t===void 0||n===void 0)throw new Y("DataFrame.item() requires both row and column to be specified if not empty.");if(t<0||t>=r)throw new at(`Row index ${t} is out of bounds for DataFrame height ${r}.`);let s=typeof n=="number"?o[n]:n;if(s===void 0||this.t[s]===void 0)throw typeof n=="number"?new at(`Column index ${n} is out of bounds for DataFrame width ${i}.`):new Wt(n);return this.t[s][t]}*iterColumns(){let t=Object.values(this.t),n=t.length;for(let r=0;r<n;r++)yield t[r]}*iterRows({named:t=!1}={}){let n=this.r;if(n===0)return;if(t){let i=this.t,s=Object.keys(i);for(let a=0;a<n;a++)yield dr(i,a,s);return}let r=Object.values(this.t),o=r.length;for(let i=0;i<n;i++){let s=new Array(o);for(let a=0;a<o;a++)s[a]=r[a][i];yield s}}join(t,n={}){if(!t||!(t instanceof e))throw new N('join() requires a valid DataFrame in "other"');let{on:r,leftOn:o,rightOn:i,how:s="inner",suffixes:a=["","_right"],joinNulls:l=!1,coalesce:c=!0,maintainOrder:u="none"}=n,f=r!==void 0,p=o!==void 0||i!==void 0;if(s==="cross"&&(f||p))throw new N('Cannot specify "on", "leftOn", or "rightOn" when how is "cross"');if(f&&p)throw new N('Cannot specify both "on" and "leftOn"/"rightOn"');if(o!==void 0!=(i!==void 0))throw new N('join() requires both "leftOn" and "rightOn"');if(s!=="cross"&&!f&&!p)throw new N('join() requires "on" or "leftOn"/"rightOn"');let m=[],y=[];if(o!==void 0&&i!==void 0){if(m=Nt(o,"string"),y=Nt(i,"string"),m.length===0||y.length===0)throw new N("join() requires non-empty key arrays");if(m.length!==y.length)throw new N(`join() "leftOn" length (${m.length}) must match "rightOn" length (${y.length})`)}else if(r!==void 0&&(m=Nt(r,"string"),y=m,m.length===0))throw new N('join() requires at least one key column in "on"');let d=m.length;for(let O=0;O<d;O++)Q(m[O],this.t,"Join key"," in the left DataFrame."),Q(y[O],t.t,"Join key"," in the right DataFrame.");let g={...n,how:s,suffixes:a,joinNulls:l,coalesce:c,maintainOrder:typeof u=="boolean"?u?"left":"none":u??"none"},{leftIndices:x,rightIndices:b}=ko(this.t,t.t,this.r,t.r,m,y,g);return xe(this.t,t.t,this.a,t.a,x,b,m,y,{suffixes:a,coalesce:c,how:s})}joinAsof(t,n){if(!t||!(t instanceof e))throw new N('joinAsof() requires a valid DataFrame in "other"');let{on:r,leftOn:o,rightOn:i,by:s,leftBy:a,rightBy:l,strategy:c="backward",tolerance:u,allowExactMatches:f=!0,suffixes:p=["","_right"],coalesce:m=!0,checkSorted:y=!0}=n??{},d=String(o??r??""),h=String(i??r??"");if(!d||!h)throw new N('joinAsof() requires "on" or "leftOn"/"rightOn"');let g=Nt(a??s,"string"),x=Nt(l??s,"string");if(g.length!==x.length)throw new N(`Partition key length mismatch: ${g.length} vs ${x.length}`);let b=g.length;for(let R=0;R<b;R++)Q(g[R],this.t,"Partition key"," in the left DataFrame."),Q(x[R],t.t,"Partition key"," in the right DataFrame.");let O={...n,strategy:c,tolerance:u,allowExactMatches:f,suffixes:p,coalesce:m,checkSorted:y},{leftIndices:w,rightIndices:S}=Mo(this.t,t.t,this.r,t.r,d,h,g,x,O),I=[d,...g],C=[h,...x];return xe(this.t,t.t,this.a,t.a,w,S,I,C,{suffixes:p,coalesce:m,how:"left"})}joinWhere(t,...n){if(!t||!(t instanceof e))throw new N('joinWhere() requires a valid DataFrame in "other"');let r={},o=[];for(let c=0;c<n.length;c++){let u=n[c];if(Array.isArray(u)){for(let f=0;f<u.length;f++)o.push(M.toColExpr(u[f]));continue}if(v(u)&&!M.isColExpr(u)&&!("_ops"in u)){r={...r,...u};continue}o.push(M.toColExpr(u))}let{how:i="inner",suffixes:s=["","_right"]}=r;if(i!=="inner"&&i!=="left"&&i!=="right")throw new N(`joinWhere() "how" must be one of "inner", "left", "right", got "${i}"`);let{leftIndices:a,rightIndices:l}=Uo(this.t,t.t,this.r,t.r,o,{how:i,suffixes:s});return xe(this.t,t.t,this.a,t.a,a,l,[],[],{suffixes:s,coalesce:!1,how:i})}limit(t,{offset:n=0,from:r="start"}={}){let o=this.r,i=z(Math.floor(t),{min:0,max:o}),s=z(Math.floor(n),{min:0,max:o}),a=s,l=z(s+i,{min:0,max:o});r==="end"&&(l=z(o-s,{min:0,max:o}),a=z(l-i,{min:0,max:o}));let c=z(l-a,{min:0}),u={},f=Object.keys(this.t),p=f.length;for(let m=0;m<p;m++){let y=f[m];u[y]=this.t[y].slice(a,l)}return e.S(u,this.a,c)}pivot(t){if(this.r===0)return e.S({},{},0);let{index:n,columns:r,values:o}=t,i=Nt(n,"string"),s=i.length;for(let w=0;w<s;w++)Q(i[w],this.t,"Pivot index key");let a=String(r),l=String(o);Q(a,this.t,"Pivot column key"),Q(l,this.t,"Pivot values key");let c=new Map,u=[],f=new Set,p=this.r,m=this.t[a],y=this.t[l];for(let w=0;w<p;w++){let S=Tn(this.t,i,w);f.add(String(m[w])),c.get(S)===void 0&&(c.set(S,c.size),u.push(w))}let d=c.size,h={},g={};for(let w=0;w<s;w++){let S=i[w];h[S]=this.t[S],this.a[S]&&(g[S]=this.a[S])}let x=hr(h,u),b=Array.from(f),O=this.a[l]||D.Utf8;for(let w=0;w<b.length;w++){let S=b[w];x[S]=new Array(d).fill(null),g[S]=O}for(let w=0;w<p;w++){let S=Tn(this.t,i,w),I=c.get(S),C=String(m[w]);x[C][I]=y[w]}return e.S(x,g,d)}rename(t={}){let n=Object.keys(this.t),r=n.length,o=new Array(r);for(let i=0;i<r;i++){let s=n[i],a=t[s];o[i]=a?new M(s).alias(a):s}return this.select(...o)}reverse(){return this.r===0?this:this.select(fn().reverse())}get schema(){return this.a}select(...t){let n=this.ct(t),r=Object.keys(this.t),o=Ht(n,r,void 0,this.a,this.t),i=o.length;if(i===0)return e.S({},{},this.r);let s={},a={},l=new Array(i),c=new Array(i),u=new Set,f=null;for(let y=0;y<i;y++){let d=o[y],h=d.O||d.f||"*";if(u.has(h))throw new Y(`Duplicate column selection: "${h}"`);u.add(h);let g=Ot(d,this.t,this.r);l[y]=g,c[y]=h;let x=g&&g.rowMap;if(!x)continue;if(!f){f=x;continue}let b=x.length;if(b!==f.length)throw new at(`Mismatched explode heights: Column "${h}" has length ${b}, but expected ${f.length}`);for(let O=0;O<b;O++)if(x[O]!==f[O])throw new at(`Mismatched explode heights: Column "${h}" has mismatched row lengths`)}let p=f?f.length:this.r,m=i>0;for(let y=0;y<i;y++){let d=o[y];if(!(d.A!=null&&(!d.I||d.I.length===0))&&!d.B){m=!1;break}}for(let y=0;y<i;y++){let d=c[y],h=l[y],g=h&&h.rowMap,x=V(h)?h.length:0,b=f&&!g?this.r:p;if(x!==b)throw new at(`Column height mismatch for "${d}": got ${x}, expected ${b}`);f&&!g&&(h=Ln(h,f)),l[y]=h}m&&(p=1);for(let y=0;y<i;y++){let d=o[y],h=c[y],g=l[y],x=Gn(d,this.a,g)||Xt(g);a[h]=x,s[h]=Bt(g,x,p)}return e.S(s,a,p)}get shape(){return[this.height,this.width]}slice(t,n){let r=this.r,o=z(t<0?r+t:t,{min:0,max:r}),i=z(n===void 0?r:n<0?r+n:n,{min:0,max:r}),s=z(i-o,{min:0});return this.limit(s,{offset:o})}sort(t){if(!t?.by||this.r===0)return this;let{by:n,descending:r=!1,nullsLast:o=!0,customComp:i}=t,s=xt(n),a=Object.values(this.select(...s).t),l=this.r;if(l===1)return this;let c=a.length,u=new Array(c),f=Array.isArray(r),p=typeof i=="function";for(let y=0;y<c;y++)u[y]={descending:f?!!r[y]:!!r,nullsLast:o,customComp:p?i:i?.[s[y]]};let m=new Array(l);for(let y=0;y<l;y++)m[y]=y;return m.sort((y,d)=>{for(let h=0;h<c;h++){let g=Yr(a[h][y],a[h][d],u[h]);if(g!==0)return g}return 0}),e.S(hr(this.t,m),this.a,l)}tail(t=10){return this.limit(t,{offset:0,from:"end"})}toArray(t){return xt(Object.values(this.select(t).t)?.[0]??[])}toDict(){return{...this.t}}toDicts(){return Ro(this.t,this.r)}transpose({includeHeader:t=!1,headerName:n="column",columnNames:r}={}){if(this.r===0){let c=t?{[n]:Bt([],D.Utf8,0)}:{},u=t?{[n]:D.Utf8}:{};return e.S(c,u,0)}let o=this.columns,i;if(typeof r=="string"){Q(r,this.t,"columnNames"),o=o.filter(u=>u!==r);let c=this.t[r];i=new Array(this.r);for(let u=0;u<this.r;u++){let f=c[u];if(f==null)throw new Y(`Transpose columnNames column "${r}" contains null/undefined at index ${u}`);i[u]=String(f)}}else if(r!=null){let c=Array.from(r);if(c.length!==this.r)throw new Y(`columnNames length (${c.length}) must match the height of the DataFrame (${this.r})`);i=c.map(String)}else{i=new Array(this.r);for(let c=0;c<this.r;c++)i[c]=`column_${c}`}let s=o.length,a={},l={};t&&(a[n]=Bt(o,D.Utf8,s),l[n]=D.Utf8);for(let c=0;c<this.r;c++){let u=i[c];if(a[u]!==void 0)throw new Y(`Duplicate column name in transposed DataFrame: "${u}"`);let f=new Array(s);for(let m=0;m<s;m++)f[m]=this.t[o[m]][c];let p=Xt(f);a[u]=Bt(f,p,s),l[u]=p}return e.S(a,l,s)}unique(t){let n=t!==void 0?xt(t):Object.keys(this.t);return this.groupBy(n).agg(qn(n).first())}unpivot(t){let{idVars:n,valueVars:r,varName:o="variable",valueName:i="value"}=t,s=Nt(n,"string"),a=Nt(r,"string"),l=s.length,c=a.length;for(let y of s)Q(y,this.t,"Unpivot id variable key");for(let y of a)Q(y,this.t,"Unpivot value variable key");let u=this.r*c,f={};for(let y=0;y<l;y++)f[s[y]]=new Array(u);f[o]=new Array(u),f[i]=new Array(u);let p=0;for(let y=0;y<this.r;y++)for(let d=0;d<c;d++){let h=a[d];for(let g=0;g<l;g++){let x=s[g];f[x][p]=this.t[x][y]}f[o][p]=h,f[i][p]=this.t[h][y],p++}let m={};for(let y of s)m[y]=this.a[y];return m[o]=D.Utf8,m[i]=Xt(f[i]),e.S(f,m,u)}vstack(t){return this.concat(t,{how:"vertical"})}get width(){return Object.keys(this.t).length}withColumns(...t){if(t.length===0)return this;let n=this.ct(t),r=Object.keys(this.t),o=Ht(n,r,void 0,this.a,this.t),i=o.length;if(i===0)return this;let s=new Map;for(let c=0;c<i;c++){let u=o[c],f=u.O||u.f||"*";s.set(f,u)}let a=[],l=r.length;for(let c=0;c<l;c++){let u=r[c];a.push(s.get(u)||new M(u)),s.delete(u)}for(let c of s.values())a.push(c);return this.select(...a)}withRowIndex(t="index",n=0){let r=Dn(n,{mode:"independent",dtype:D.UInt32,step:1}),o=this.insertColumn(0,t,r);return o.a[t]=D.UInt32,o}writeCsv(t,n={}){if(t){if(typeof t=="string"){if(typeof require!="function")throw new Kt("File writing is not supported in this environment (missing require('fs')).");let r=require("fs"),o=r.openSync(t,"w");try{mr(this.t,this.r,{...n,onRow:i=>{r.writeSync(o,i,null,"utf8")}})}finally{r.closeSync(o)}}else if(v(t)&&typeof t.write=="function")mr(this.t,this.r,{...n,onRow:r=>{t.write(r)}});else throw new N("Invalid file argument. Expected a file path string or a writable stream/object with a write method.");return""}return mr(this.t,this.r,n)}writeJson(t,{format:n="json",replacerOptions:r}={}){if(n!=="json"&&n!=="ndjson")throw new N(`Unsupported JSON format: "${n}". Expected "json" or "ndjson".`);let o=r?.replacer===null?void 0:on(r),i;if(n==="ndjson"){let s=this.toDicts(),a=s.length,l=new Array(a);for(let c=0;c<a;c++)l[c]=JSON.stringify(s[c],o);i=l.join(`
5
+ `)}else i=JSON.stringify(this.toDicts(),o);return _o(t,i),i}}});var hu={};kr(hu,{$df:()=>du,ALL_COLUMNS_MARKER:()=>pt,Array:()=>Ao,ArrayDataType:()=>Ao,ArrayExpr:()=>Ae,ArrayExprNamespace:()=>xr,ArrayType:()=>Sn,Binary:()=>yo,BinaryType:()=>ar,Boolean:()=>On,BooleanDataType:()=>On,BooleanType:()=>ir,COALESCE_MARKER:()=>Fr,ColumnExpr:()=>M,ColumnNotFoundError:()=>Wt,ComputeError:()=>ot,DFScriptError:()=>zt,DURATION_MARKER:()=>Ba,DataFrame:()=>q,DataFrameError:()=>Y,DataType:()=>Z,DataTypeRegistry:()=>D,Date:()=>bo,DateDataType:()=>bo,DateTimeExprNamespace:()=>Er,DateType:()=>cr,Datetime:()=>de,DatetimeType:()=>vt,DecimalType:()=>Gt,Duration:()=>wo,DurationType:()=>St,ELEMENT_MARKER:()=>pn,ExprBase:()=>ht,Float32:()=>po,Float32Type:()=>wn,Float64:()=>pe,Float64Type:()=>An,FloatDataType:()=>sn,GroupedData:()=>Jn,IOStreamError:()=>Kt,Int16:()=>lo,Int16Type:()=>Ze,Int32:()=>ct,Int32Type:()=>Qe,Int64:()=>me,Int64Type:()=>tr,Int8:()=>ao,Int8Type:()=>He,IntegerDataType:()=>xn,InvalidArgumentError:()=>N,LITERAL_MARKER:()=>Ur,NestedDataType:()=>an,Null:()=>ho,NullType:()=>lr,NumericDataType:()=>qt,Object:()=>go,ObjectDataType:()=>go,ObjectType:()=>ur,STRUCT_MARKER:()=>jr,SchemaError:()=>un,ShapeError:()=>at,SignedIntegerType:()=>Ut,StandardExpr:()=>we,StringExpr:()=>Se,StringExprNamespace:()=>wr,Struct:()=>So,StructExpr:()=>Oe,StructExprNamespace:()=>Sr,StructType:()=>Pn,TemporalDataType:()=>jt,TemporalExpr:()=>Te,Time:()=>xo,TimeType:()=>fr,UInt16:()=>co,UInt16Type:()=>er,UInt32:()=>fo,UInt32Type:()=>rr,UInt64:()=>mo,UInt64Type:()=>or,UInt8:()=>uo,UInt8Type:()=>nr,UnsignedIntegerType:()=>Ft,Utf8:()=>ye,Utf8Type:()=>sr,WHEN_MARKER:()=>vr,When:()=>Ee,WhenThen:()=>Ir,WhenThenChain:()=>Ee,alignAsofIndices:()=>Mo,alignKeyIndices:()=>ko,alignWhereIndices:()=>Uo,all:()=>fn,assertColumnExists:()=>Q,assertHeight:()=>yr,assertNotNull:()=>be,assertValidArgument:()=>lu,buildCanonicalSet:()=>jo,buildGroupMap:()=>$n,coalesce:()=>Jo,coerceColumn:()=>Bt,columnsToRows:()=>Ro,compareMissing:()=>Bo,computeIsIn:()=>vo,computeRank:()=>br,computeRowHash:()=>Tn,concat:()=>Wn,deduceBinaryType:()=>Ho,derive:()=>A,duration:()=>Tr,element:()=>Xo,evalBinaryOp:()=>Fo,evalUnaryOp:()=>ya,evaluateArg:()=>En,evaluateExpression:()=>Ot,exclude:()=>qn,gatherColumnByIndices:()=>Ln,gatherColumnsByIndices:()=>hr,getRowFromColumns:()=>dr,implode:()=>zo,inferColumnType:()=>Xt,isEvaluatedColumn:()=>In,kleeneBinary:()=>G,kleeneUnary:()=>k,lit:()=>Zt,materializeJoinedDataFrame:()=>xe,readCsv:()=>Cr,readJson:()=>Dr,resolveColumnSelectors:()=>Ht,resolveExprOutputType:()=>Gn,resolveOperandType:()=>Cn,resolveWindowExpr:()=>Do,rowsToColumns:()=>Co,seqRange:()=>Dn,struct:()=>Yo,when:()=>Wo,writeStringToFileOrStream:()=>_o});module.exports=Mr(hu);Ie();Ie();Jt();Zo();Kn();st();nt();function Dr(e,{format:t="json",trimBeforeParse:n=!0,schema:r,...o}={}){let i=se(e,{format:t,trimBeforeParse:n,...o});if(i===e)throw new Y(`Invalid JSON input: must be a valid, non-empty JSON ${t} string.`);let s=Array.isArray(i)?i:v(i)?[i]:[];return new q(s,r)}Kn();st();function Cr(e,t={}){let{hasHeader:n=!0,schema:r,inferSchema:o=!0}=t,i=aa(e,t);if(i.length===0)return new q({});let s,a;n?(s=i[0],a=i.slice(1)):(s=i[0].map((p,m)=>`column_${m}`),a=i);let l=s.length,c=a.length,u={};for(let p=0;p<l;p++){let m=s[p],y=new Array(c);for(let d=0;d<c;d++)y[d]=a[d][p]!==void 0?a[d][p]:"";u[m]=y}let f={};for(let p=0;p<l;p++){let m=s[p],y=u[m];if(r&&r[m])f[m]=y;else if(o){let{values:d}=la(y,t);f[m]=d}else f[m]=y}return new q(f,r)}function yu(e,t){return new q(e,t)}var du={all:fn,coalesce:Jo,col:e=>new M(e),concat:Wn,data:yu,duration:Tr,element:Xo,exclude:qn,implode:zo,lit:Zt,readCsv:Cr,readJson:Dr,seqRange:Dn,struct:Yo,when:Wo,...D};Jt();nt();0&&(module.exports={$df,ALL_COLUMNS_MARKER,Array,ArrayDataType,ArrayExpr,ArrayExprNamespace,ArrayType,Binary,BinaryType,Boolean,BooleanDataType,BooleanType,COALESCE_MARKER,ColumnExpr,ColumnNotFoundError,ComputeError,DFScriptError,DURATION_MARKER,DataFrame,DataFrameError,DataType,DataTypeRegistry,Date,DateDataType,DateTimeExprNamespace,DateType,Datetime,DatetimeType,DecimalType,Duration,DurationType,ELEMENT_MARKER,ExprBase,Float32,Float32Type,Float64,Float64Type,FloatDataType,GroupedData,IOStreamError,Int16,Int16Type,Int32,Int32Type,Int64,Int64Type,Int8,Int8Type,IntegerDataType,InvalidArgumentError,LITERAL_MARKER,NestedDataType,Null,NullType,NumericDataType,Object,ObjectDataType,ObjectType,STRUCT_MARKER,SchemaError,ShapeError,SignedIntegerType,StandardExpr,StringExpr,StringExprNamespace,Struct,StructExpr,StructExprNamespace,StructType,TemporalDataType,TemporalExpr,Time,TimeType,UInt16,UInt16Type,UInt32,UInt32Type,UInt64,UInt64Type,UInt8,UInt8Type,UnsignedIntegerType,Utf8,Utf8Type,WHEN_MARKER,When,WhenThen,WhenThenChain,alignAsofIndices,alignKeyIndices,alignWhereIndices,all,assertColumnExists,assertHeight,assertNotNull,assertValidArgument,buildCanonicalSet,buildGroupMap,coalesce,coerceColumn,columnsToRows,compareMissing,computeIsIn,computeRank,computeRowHash,concat,deduceBinaryType,derive,duration,element,evalBinaryOp,evalUnaryOp,evaluateArg,evaluateExpression,exclude,gatherColumnByIndices,gatherColumnsByIndices,getRowFromColumns,implode,inferColumnType,isEvaluatedColumn,kleeneBinary,kleeneUnary,lit,materializeJoinedDataFrame,readCsv,readJson,resolveColumnSelectors,resolveExprOutputType,resolveOperandType,resolveWindowExpr,rowsToColumns,seqRange,struct,when,writeStringToFileOrStream});