@bicharts/shape-core 0.6.115 → 0.6.116

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.
@@ -0,0 +1,2 @@
1
+ /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
+ import{a as be}from"./chunk-U3H6UBOO.mjs";import{a as xt,f as ee,g as Se,h as se,i as _e,j as re}from"./chunk-TZ74QIKA.mjs";import{b as bt,c as St,d as _t,e as At,f as Ct}from"./chunk-YDYFP2T4.mjs";import{c as pt,l as ht,n as he,p as yt,s as ie,w as ye,x as ke,y as De,z as Oe}from"./chunk-DTBXJVUG.mjs";import{e as ct,k as ge,m as ft,n as gt,o as pe}from"./chunk-3ZAS32F5.mjs";import{b as dt,d as mt}from"./chunk-5HI6TVMM.mjs";import{A as fe,B as lt,E as ut,a as ne,b as J,c as Qe,d as de,g as Je,h as et,j as tt,l as nt,m as rt,o as it,p as me,q as st,r as ot,u as Ee,w as at}from"./chunk-CZJ7M6A5.mjs";import{c as Ze,f as Ne}from"./chunk-WC4JINEZ.mjs";var mn=85,fn=60,gn=/(^|[^a-z])(state|province|provincia|provinz|region|regione|regiao|county|department|departement|departamento|prefecture|oblast|canton|kanton|bundesland|land|territory)([^a-z]|$)/i,Pe=t=>Math.round(t*10)/10,Ae=t=>t.split("-")[0];function wt(t){let e=new Map,n=0;if(t.forEach((s,a)=>{let l=he(a);l&&(e.set(l,(e.get(l)||0)+s),n+=s)}),n===0)return{};let[i,r]=[...e].sort((s,a)=>a[1]-s[1])[0];return{dominantRegion:i,dominantRegionPct:Pe(100*r/n)}}function wi(t){let e=t.province===null||t.province===void 0?"":String(t.province).trim();if(e)return Mt(e,t.provinceKind,t.country);if(!ie())return null;let n=t.city===null||t.city===void 0?"":String(t.city).trim();if(!n)return null;let i=ye(n,{country:t.country===null||t.country===void 0?null:String(t.country)});return i.status==="resolved"?i.provinceId:null}function Mt(t,e,n){if(e==="us-state-code"||e==="us-state-name"){let s=Ct(t,e);return s?"US-"+s:null}if(!ie())return null;if(e==="admin1-code")return Oe(t)?t.toUpperCase():null;let i=n==null?null:String(n),r=new Set(ke(t,i).map(De).filter(s=>!!s));return r.size===1?[...r][0]:null}function Mi(t,e={}){let n=e.deriveProvinces!==!1,i=new Array(t.length),r=new Array(t.length),s=new Set,a=[],l=new Set,o=[],u=0,c=0,f=0,d=A=>{let S=A.toLowerCase();s.has(S)||(s.add(S),a.push(A))},h=A=>A==null||A===""?null:Number(A),x=new Map;return t.forEach((A,S)=>{i[S]=null,r[S]=null;let p=A.country===null||A.country===void 0||String(A.country).trim()===""?null:String(A.country).trim(),y=A.province===null||A.province===void 0?"":String(A.province).trim();if(y){let _=Mt(y,e.provinceKind,p);_?(i[S]=_,r[S]="province",u++):d(y);return}if(!n)return;let C=h(A.lat),g=h(A.lon),w=!1;if(e.locate&&C!==null&&g!==null&&isFinite(C)&&isFinite(g)){w=!0;let _=e.locate(C,g);if(_){i[S]=_,r[S]="coordinates",u++;return}}let b=A.city===null||A.city===void 0?"":String(A.city).trim();if(b&&ie()){let _=b.toLowerCase()+""+(p??""),M=x.get(_);if(M||(M=ye(b,{country:p}),x.set(_,M)),M.status==="resolved"&&M.provinceId){i[S]=M.provinceId,r[S]="city",u++;return}if(M.status==="ambiguous"){c++,l.has(_)||(l.add(_),o.length<8&&o.push(b));return}d(b);return}w&&f++}),{iso:i,source:r,unmatched:a,matchedRows:u,totalRows:t.length,ambiguousRows:c,ambiguousExamples:o,unplacedPoints:f}}function Tt(t,e,n={}){let i=new Map;if(!ie()||e.length===0)return i;let r=t.findIndex(l=>!l.isMeasure&&(l.geoKind||"").startsWith("country")),s=l=>l==null?"":String(l).trim(),a=l=>{let o=new Map;for(let h of e){let x=s(h[l]);if(!x)continue;let A=r>=0&&s(h[r])||null,S=x+""+(A??""),p=o.get(S);p?p.rows++:o.set(S,{city:x,country:A,rows:1})}if(o.size===0)return null;let u=0,c=0,f=new Set,d=new Map;return o.forEach(h=>{let x=ye(h.city,{country:h.country});x.status!=="unmatched"&&c++,!(x.status!=="resolved"||!x.provinceId)&&(u++,f.add(x.provinceId),d.set(x.cc,(d.get(x.cc)||0)+h.rows))}),{signals:{rollupPct:Pe(100*u/o.size),regionCount:f.size,countryCount:d.size,...wt(d)},cityPct:100*c/o.size,distinct:o.size}};return t.forEach((l,o)=>{if(l.isMeasure||o===r)return;let u=l.geoKind||"";if(u.startsWith("city")){if(n.cities===!1)return;let _=a(o);_&&i.set(o,_.signals);return}if(u)return;let c=new Map,f=new Map;for(let _ of e){let M=s(_[o]);M&&(c.set(M,(c.get(M)||0)+1),f.has(M)||f.set(M,r>=0&&s(_[r])||null))}if(c.size<3)return;let d=0,h=0,x=0,A=new Set,S=new Map;c.forEach((_,M)=>{if(Oe(M)){d++;let z=M.toUpperCase();A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_);return}let W=new Set(ke(M,f.get(M)).map(De).filter(z=>!!z));if(W.size===1){h++;let z=[...W][0];A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_)}else W.size>1&&x++});let y=gn.test(l.name.replace(/[_-]+/g," "))?fn:mn,C=100*d/c.size,g=100*h/c.size,w=C>=g,b=w?C:g;if(b<y){if(n.cities===!1)return;let _=a(o);if(!_||_.cityPct<pt||_.distinct<_t&&!St(l.name,bt))return;i.set(o,_.signals);return}i.set(o,{kind:w?"admin1-code":"admin1-name",matchPct:Pe(b),ambiguous:!w&&x/c.size>.15?!0:void 0,regionCount:A.size,countryCount:S.size,...wt(S)})}),i}function ze(t){let e=(t||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var Le={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},pn=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,hn=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,yn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,bn=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,Sn=new Set(["de","del","of"]),_n=new Set(["\u0433","\u0440","r"]),An=/^[\p{L}\p{M}\u0970\u05f3]+$/u,Fe=/^\d+$/;function Cn(t){let e=+t[1],n=+t[2],i=t[3]===void 0?0:+t[3],r=t[4]!==void 0;if(n>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(t[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:n,s:i,seconds:t[3]!==void 0,meridiem:r}}function vt(t){let e=t.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=xt(e);let n=null,i=pn.exec(e);if(i){if(n=Cn(i),!n)return null;e=e.slice(0,i.index)}let r;if(r=yn.exec(e)){let d=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...Le,form:"cjk",key:d,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=hn.exec(e)){let d=r[2],h=r[4];if(d!==h)return null;let x=d.trim(),A=r[6];if(A&&x!==".")return null;let S=[r[1].length,r[3].length,r[5].length],p=S[0]===4,y=S[2]===4;return p===y||(p?S[1]>2||S[2]>2:S[0]>2||S[1]>2)?null:p&&x==="-"&&d==="-"&&S[1]===2&&S[2]===2?"iso":p&&x==="."&&d==="."&&!A&&!(S[1]===2&&S[2]===2)?null:{...Le,form:"numeric",key:`num|${p?"y":"x"}|${d}|${A}`,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:p,sep:d,trail:A}}let s=e.replace(bn,"$1").split(/[\s.,/-]+/).filter(d=>d!==""&&!Sn.has(d.toLowerCase()));if(s.length===4&&Fe.test(s[2])&&_n.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let a=s.map(d=>Fe.test(d)?"N":An.test(d)?"W":"?").join(""),l=s.map(d=>Fe.test(d)?d:""),o=0,u=0,c="",f;if(a==="NWN"&&l[0].length<=2&&l[2].length===4)o=+l[0],c=s[1],u=+l[2],f="dmy";else if(a==="WNN"&&l[1].length<=2&&l[2].length===4)c=s[0],o=+l[1],u=+l[2],f="mdy";else if(a==="NWN"&&l[0].length===4&&l[2].length<=2)u=+l[0],c=s[1],o=+l[2],f="ymd";else return null;return{...Le,form:"named",key:`named|${f}`,clock:n,day:o,year:u,word:c,namedOrder:f}}var xn=[31,28,31,30,31,30,31,31,30,31,30,31],wn=t=>t%4===0&&t%100!==0||t%400===0;function Rt(t,e,n){return t>=1&&t<=9999&&e>=1&&e<=12&&n>=1?n<=(e===2&&wn(t)?29:xn[e-1]):!1}function Mn(t,e,n,i){let r=new Date(Date.UTC(2e3,e-1,n,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(t),r}function It(t,e={}){let n=(e.floor??1)>=1,i=new Map,r=new Map,s=0,a=null;for(let p of t){if(p==null)continue;if(typeof p!="string"){if(n)return null;s++;continue}let y=p.trim();if(y==="")continue;s++;let C=i.get(y);if(C===void 0&&(C=vt(y),i.set(y,C)),C===null||C==="iso"){if(n)return null;continue}if(n){if(a===null)a=C;else if(C.key!==a.key)return null}else r.set(C.key,(r.get(C.key)??0)+1)}if(!n){let p=0,y="";for(let[C,g]of r)g>p&&(p=g,y=C);if(p===0||p/s<e.floor)return null;a=[...i.values()].find(C=>C!==null&&C!=="iso"&&C.key===y)??null}if(a===null)return null;let l=a.key,o=[...i.values()].filter(p=>p!==null&&p!=="iso"&&p.key===l),u,c="shape",f=null;if(a.form==="named"){if(u=a.namedOrder,f=_e(o.map(p=>p.word),e.locale),!f)return null}else if(a.form==="cjk"||a.yearFirst)u="ymd";else{let p=0,y=0;for(let C of o)C.a>12&&p++,C.b>12&&y++;if(p>0&&y>0)return null;p>0?(u="dmy",c="values"):y>0?(u="mdy",c="values"):a.sep.trim()==="."?(u="dmy",c="shape"):(u=ze(e.locale)?"mdy":"dmy",c="locale")}let d=p=>{if(p.form==="named"){let y=f.get(ee(p.word));return y===void 0?null:[p.year,y+1,p.day]}return p.yearFirst?[p.a,p.b,p.c]:u==="dmy"?[p.c,p.b,p.a]:[p.c,p.a,p.b]},h=1/0,x=-1/0,A=0;for(let p of o){let y=d(p);if(!y||!Rt(y[0],y[1],y[2])){if(n)return null;A++;continue}h=Math.min(h,y[0]),x=Math.max(x,y[0])}if(!n&&(r.get(l)-A)/s<e.floor||h>=2400&&x<=2699||h>=1300&&x<=1500)return null;let S={form:a.form,order:u,orderFrom:c,hasTime:o.some(p=>p.clock!==null),read(p){if(typeof p!="string")return null;let y=p.trim();if(y==="")return null;let C=i.get(y);if(C===void 0&&(C=vt(y),i.set(y,C)),C===null||C==="iso"||C.key!==l)return null;let g=d(C);return!g||!Rt(g[0],g[1],g[2])?null:Mn(g[0],g[1],g[2],C.clock)}};if(a.form!=="named"&&!o.some(p=>p.clock?.meridiem)){let p;a.form==="cjk"?p=a.cjkPattern:a.yearFirst?p=`%Y${a.sep}%m${a.sep}%d${a.trail}`:p=(u==="dmy"?`%d${a.sep}%m${a.sep}%Y`:`%m${a.sep}%d${a.sep}%Y`)+a.trail;let y=o.filter(C=>C.clock!==null).length;y===0?S.pattern=p:y===o.length&&(S.pattern=p+(o.every(C=>C.clock.seconds)?" %H:%M:%S":" %H:%M"))}return S}import on from"papaparse";var Tn={es:["latitud"],pt:["latitude"],fr:["latitude"],it:["latitudine"],nl:["breedtegraad"],de:["breitengrad"]},vn={es:["longitud"],pt:["longitude"],fr:["longitude"],it:["longitudine"],nl:["lengtegraad"],de:["l\xE4ngengrad"]},We=t=>ne(t.normalize("NFC")).toLowerCase(),Rn=new Set(Object.values(Tn).flatMap(t=>(t??[]).map(We))),In=new Set(Object.values(vn).flatMap(t=>(t??[]).map(We)));function Nt(t){let e=!1,n=!1;for(let i of t){let r=We(i);Rn.has(r)?e=!0:In.has(r)&&(n=!0)}return e===n?null:e?"lat":"lon"}var Nn=["rate","ratio","pct","percent","percentage","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","z[_-]?score","average","avg","mean","median","stddev","variance","gpa","percentile","quantile","efficiency","accuracy","probability","multiplier","coefficient","correlation","occupancy","age","bmi","temperature","density","pressure","humidity","ph","velocity","speed","elevation","altitude","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps","capita","temperatuur","temperatur","temperatura","teplota","lampotila","homerseklet","sicaklik","pression","presion","pressao","pressione","druck","tryck","tlak","paine","nyomas","presiune","humidite","humedad","umidade","umidita","feuchtigkeit","vochtigheid","kosteus","vlhkost","vitesse","velocidad","velocidade","velocita","geschwindigkeit","snelheid","hastighet","hastighed","rychlost","nopeus","sebesseg","brzina","predkosc","densite","densidad","densidade","densita","dichte","dichtheid","hustota","tiheys","gustoca","moyenne","mediane","promedio","mediana","gemiddelde","durchschnitt","mittelwert","genomsnitt","gennemsnit","gjennomsnitt","keskiarvo","atlag","ortalama","prosjek","srednia","prumer","priemer","medie","taux","tasa","taxa","tasso","verhaltnis","verhouding","aandeel","anteil","andel","osuus","podil","udzial","udio","pourcentage","porcentaje","percentual","prozent","procent","prosentti","szazalek","yuzde","participacion","participacao","pondere","omjer","arany","oran","rata","leeftijd","edad","idade","wiek","eletkor","varsta","puntuacion","pontuacao","punteggio","betyg","ocena","indice","indeks","wskaznik","puan","ocupacion","ocupacao","occupazione","auslastung","bezetting","belaggning","belaegning","belegg","kayttoaste","oblozenie","obsazenost","obsadenost","kihasznaltsag","doluluk","ocupare","popunjenost","efficacite","eficiencia","efficienza","effizienz","effectiviteit","verimlilik"],En=["pct","percent","percentage","rate","ratio","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","gpa","percentile","quantile","bmi","density","pressure","humidity","velocity","efficiency","occupancy","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps"],kn=["latitude","longitude"],Dn=["latitude","longitude"];function Z(t){return ne(t)}var Dt=["somme de","suma de","soma de","summe von","som van","somma di","summa av","sum av","sum af","soucet z","suma z","totaal van","total de","toplam","osszeg","nombre de","recuento de","contagem de","anzahl von","aantal van","conteggio di","antal av","lukumaara","pocet z","sum pa","\u0441\u0443\u043C\u043C\u0430","\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E","\u0441\u0443\u043C\u0430","\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C","\u03B1\u03B8\u03C1\u03BF\u03B9\u03C3\u03BC\u03B1","\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2"],On=["moyenne de","promedio de","media de","media di","durchschnitt von","gemiddelde van","medelvarde av","genomsnitt av","gennemsnit af","keskiarvo","atlag","ortalama","prumer z","srednia z","medie de","minimum de","minimo de","minimo di","minimum von","maximum de","maximo de","massimo di","maximum von","prom.","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435","\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0435\u0440\u0435\u0434\u043D\u0454","\u03BC\u03B5\u03C3\u03BF\u03C2 \u03BF\u03C1\u03BF\u03C2","\u0645\u06CC\u0627\u0646\u06AF\u06CC\u0646"],Pn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],Ln=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],Ce=Object.freeze({"nombre de":"count","recuento de":"count","contagem de":"count","anzahl von":"count","aantal van":"count","conteggio di":"count","antal av":"count",lukumaara:"count","pocet z":"count",\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E:"count",\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C:"count",\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2:"count",\u7684\u8BA1\u6570:"count","minimum de":"min","minimo de":"min","minimo di":"min","minimum von":"min","maximum de":"max","maximo de":"max","massimo di":"max","maximum von":"max"});function $e(t){return[...t].sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var Ot=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+$e(Dt)+")\\s+)","i");function Et(t){for(let e of t){let n=e.codePointAt(0)??0;if(n>=11904&&n<=40959||n>=44032&&n<=55215)return!0}return!1}var Fn="[\u2013\u2014-]";function Pt(t){let e=t.filter(r=>!Et(r)),n=t.filter(Et),i=[];return e.length&&i.push("(?:\\s+|\\s*"+Fn+"\\s*)("+$e(e)+")"),n.length&&i.push("\\s*("+$e(n)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var Be=Pt(Pn),zn=Pt(Ln);function xe(t,e){let n=e.exec(t);if(!n)return null;let i=t.slice(0,n.index);return i.trim()===""?null:{base:i,label:(n[1]??n[2]??"").toLowerCase()}}function Lt(t){let e=Z(String(t??"").trim().toLowerCase());if(!e)return null;for(let r of On)if(e.startsWith(r+" "))return Ce[r]??"avg";for(let r of Dt)if(e.startsWith(r+" ")||e===r)return Ce[r]??"sum";let n=xe(e,zn);if(n)return Ce[n.label]??"avg";let i=xe(e,Be);return i?Ce[i.label]??"sum":null}var Wn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,$n=new RegExp("\\b("+Nn.join("|")+")\\b|("+En.join("|")+")$","i"),Bn=new RegExp("\\b("+kn.join("|")+")\\b|("+Dn.join("|")+")$","i");function Me(t){if(!t)return"";let e=String(t),n=Z(e),i=Ot.exec(n);if(i)return e.slice(i[0].length).trim();let r=xe(n,Be);return(r?e.slice(0,r.base.length):e).trim()}function Gn(t){if(!t)return!1;let e=Z(String(t));return Ot.test(e)||xe(e,Be)!==null}var Vn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],kt=new RegExp("^\\s*("+[...Vn].sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Ge(t){if(t==null)return"";let e=String(t),n=kt.exec(e);if(!n)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(n[1]),s=e.slice(n[0].length),a=0;for(;a<8;){let l=kt.exec(s);if(!l||i(l[1])!==r)break;let o=s.slice(l[0].length);if(o.trim()==="")break;s=o,a++}return a===0?e:e.slice(0,n[0].length)+s}function Ve(t,e){if(!t||!e)return!1;let n=String(t);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&n.includes(r))return!0}return!1}var we={Sum:["Sum of "],Avg:["Average of "],Average:["Average of "],Count:["Count of "],CountNonNull:["Count of "],Min:["Min of ","First ","Earliest "],Max:["Max of ","Last ","Latest "],Median:["Median of "],StandardDeviation:["Standard deviation of "],Variance:["Variance of "]},Ft=new RegExp("^("+Object.keys(we).join("|")+")\\((.+)\\)$");function zt(t){if(!t)return[];let e=Ft.exec(String(t).trim());if(!e)return[];let n=we[e[1]],i=e[2],r=[];for(let s=i.indexOf(".");s>=0;s=i.indexOf(".",s+1)){if(s===0)continue;let a=i.slice(s+1);if(a.trim()!=="")for(let l of n){let o=l+a;r.includes(o)||r.push(o)}}return r}function Wt(t,e,n){let i=Ft.exec(String(t??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&n==="Decimal")return!0;let s=new Set(we[r]),a=String(e??""),l=i[2];for(let o=l.indexOf(".");o>=0;o=l.indexOf(".",o+1)){if(o===0)continue;let u=l.slice(o+1);if(u.trim()!==""){for(let c of Object.values(we))for(let f of c)if(!s.has(f)&&a===f+u)return!0}}return!1}function Kn(t){let e=Me(t);return e.length===0?"":e.replace(Wn," ")}function $t(t,e){if(!e)return!1;let n=Me(e);return t.test(Z(Kn(e)))||t.test(Z(n))||t.test(Z(J(n).join(" ")))}function Bt(t){return $t(Bn,t)}function Un(t){return $t($n,t)||Bt(t)}var Gt=/int|double|decimal|single|float|number|currency|money/i;function Hn(t){let e=String(t?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||t?.isMeasure===!0||Gt.test(String(t?.dataType??""))?"Continuous":"Categorical"}function Yn(t){return t?.isMeasure===!0||Gt.test(String(t?.dataType??""))}function Vt(t){let e=t??{},n=Hn(e);if(n!=="Continuous")return{nature:n,additivity:"unknown",basis:"role",suppressed:!1};if(Bt(e.name))return{nature:n,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&Gn(e.name))){if(i==="additive")return{nature:n,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:n,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:n,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:n,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Un(e.name)?{nature:n,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:n,additivity:"additive",basis:"default",suppressed:!1}}function Kt(t){let e=Vt(t),n=t??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return Yn(n)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function Oi(t){return Kt(t)[0]}function Pi(t,e){return Kt(t).indexOf(e)>=0}function Li(t,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let n=Vt(t);return n.additivity==="additive"||n.additivity==="part_of_whole"||n.additivity==="unknown"}var jn={de:["nr","nummer","kennung","kennziffer","plz","postleitzahl"],nl:["nr","nummer"],sv:["nr","nummer"],da:["nr","nummer"],nb:["nr","nummer"],fi:["tunnus","koodi","nro"],hu:["azonos\xEDt\xF3","k\xF3d"],tr:["kod","kodu","numaras\u0131","numarasi"],zh:["\u7F16\u53F7","\u4EE3\u7801","\u7F16\u7801","\u53F7\u7801","\u90AE\u7F16"],ja:["\u756A\u53F7","\u30B3\u30FC\u30C9"],ko:["\uBC88\uD638","\uCF54\uB4DC"],hi:["\u0915\u094B\u0921","\u0915\u094D\u0930\u092E\u093E\u0902\u0915"],fr:["num\xE9ro"],es:["c\xF3digo"],pt:["c\xF3digo","cep"],it:["codice"],pl:["kod","numer"],cs:["k\xF3d","\u010D\xEDslo"],sk:["k\xF3d","\u010D\xEDslo"],hr:["\u0161ifra","oznaka"],ru:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],uk:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],el:["\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2"],ar:["\u0631\u0645\u0632","\u0643\u0648\u062F","\u0631\u0642\u0645"],he:["\u05E7\u05D5\u05D3"],id:["kode","nomor"],vi:["m\xE3"],th:["\u0E23\u0E2B\u0E31\u0E2A"]},Xn=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],qn=["num\xE9ro"],Zn=t=>t.normalize("NFC").toLowerCase();function Qn(t,e,n,i){let r=Ne(n);return!r||!t?null:t===e?"word":r.wordBreaks===!1?Array.from(e).length<rt?null:(i?t.startsWith(e):t.endsWith(e))&&t.length>e.length?"suffix":null:i?tt(t,n).includes(e)?"word":null:r.script==="Hang"?nt(t,e)?"suffix":null:r.compounds&&et(t,e,Je)?"suffix":null}function Ut(t){let e=String(t??"").trim();if(!e)return null;let n=de(e),i=de(Me(e));for(let[r,s]of Object.entries(jn)){let a=Xn.includes(r),l=a?i:n;for(let o of s){let u=qn.includes(o)||!!Ne(r)?.foldSensitive,c=u?l.words:l.folded;if(c.length===0)continue;let f=u?Zn(o):de(o).folded.join(" "),d=Qn(a?c[0]:c[c.length-1],f,r,a);if(d)return{lang:r,word:o,view:d}}}return null}var Jn=[["Lu",/^\p{Lu}$/u],["Ll",/^\p{Ll}$/u],["Lt",/^\p{Lt}$/u],["Lm",/^\p{Lm}$/u],["Lo",/^\p{Lo}$/u],["Mn",/^\p{Mn}$/u],["Mc",/^\p{Mc}$/u],["Nd",/^\p{Nd}$/u]];function Te(t){for(let[e,n]of Jn)if(n.test(t))return e;return null}var er=[{id:"ascii",test:/^[A-Za-z]$/,ranges:[[65,90],[97,122]]},{id:"latin",test:/^[\u00C0-\u017F]$/u,ranges:[[192,383]]},{id:"cyrillic",test:/^[\u0400-\u045F\u0490-\u0491]$/u,ranges:[[1024,1119],[1168,1169]]},{id:"greek",test:/^[\u0386-\u03CE]$/u,ranges:[[902,974]]},{id:"han",test:/^[\u4E00-\u9FFF]$/u,ranges:[[19968,40959]]},{id:"hiragana",test:/^\p{Script=Hiragana}$/u,ranges:[[12353,12447]]},{id:"katakana",test:/^\p{Script=Katakana}$/u,ranges:[[12448,12543]]},{id:"hangul",test:/^[\uAC00-\uD7A3]$/u,ranges:[[44032,55203]]},{id:"arabic",test:/^[\u0620-\u0652\u0671-\u06D3]$/u,ranges:[[1568,1618],[1649,1747]]},{id:"hebrew",test:/^[\u05B0-\u05EA]$/u,ranges:[[1456,1514]]},{id:"devanagari",test:/^\p{Script=Devanagari}$/u,ranges:[[2304,2431]]},{id:"thai",test:/^\p{Script=Thai}$/u,ranges:[[3585,3662]]}],ve=new Map;function Ht(t,e,n,i){let r=ve.get(t);if(r)return r;let s=[];for(let[a,l]of e)for(let o=a;o<=l;o++){let u=String.fromCodePoint(o);Te(u)===n&&(i&&!i.test(u)||s.push(u))}return ve.set(t,s),s}function tr(t){let n=t.codePointAt(0);for(let a=0;a<9&&Te(String.fromCodePoint(n-1))==="Nd";a++)n--;let i="nd:"+n.toString(16),r=ve.get(i);if(r)return r;let s=[];for(let a=n;a<n+10;a++){let l=String.fromCodePoint(a);Te(l)==="Nd"&&s.push(l)}return ve.set(i,s),s}function nr(t,e){if(e==="Nd")return tr(t);for(let r of er)if(r.test.test(t))return Ht(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=t.codePointAt(0)&-128;return Ht("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function rr(t,e,n,i){let r=t.filter(s=>!e.has(s));return r.length===0&&(r=t.filter(s=>s!==n)),r.length===0?n:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var ir=/^[\p{L}\p{M}\p{Nd}]$/u,Yt=/^[\p{L}\p{Nd}]$/u;function jt(t,e){if(!t)return t??"";let n=new Set(Array.from(t)),i=c=>{let f=Te(c);return!f||!ir.test(c)?c:rr(nr(c,f),n,c,e)},r=c=>{let f=[];for(let d of c)f.push(i(d)),Yt.test(d)&&e()<.2&&f.push(i(d));if(f.length>6){let d=Math.floor(e()*Math.min(3,f.length-6));for(let h=0;h<d;h++)for(let x=0;x<5;x++){let A=Math.floor(e()*f.length);if(Yt.test(f[A])){f.splice(A,1);break}}}return f.join("")};if(!(t.includes("@")&&t.includes(".")))return r(t);let[a,l=""]=t.split("@"),o=l.endsWith(".com"),u=o?l.slice(0,-4):l;return`${r(a)}@${r(u)}${o?".com":""}`}var sr=/^[A-Za-z_$][A-Za-z0-9_$]*$/,or=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ar=new RegExp([String.raw`\bisMeasure\b`,String.raw`\bdataType\b`,String.raw`\bcolumns\s*\[\s*-?\d`,String.raw`\.iloc\s*\[[^\]]*,`,String.raw`\.iat\s*\[`,String.raw`\bselect_dtypes\b`,String.raw`\b_get_numeric_data\b`,String.raw`\bis_numeric_dtype\b`,String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`,String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`,String.raw`\bdf\.dtypes\b`,String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`,String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));function oe(t,e){if(!t||!e)return!1;let n=or(e);return new RegExp("['\"`]"+n+"['\"`]").test(t)?!0:sr.test(e)&&new RegExp("\\."+n+"(?![A-Za-z0-9_$])").test(t)}function lr(t){return!!t&&ar.test(t)}function Vi(t,e,n){return t?lr(t)?[...e]:[...n,...e].some(i=>oe(t,i))?e.filter(i=>oe(t,i)):[...e]:[]}var ur=5,cr=6,dr=3,te=864e5,mr=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,fr=/^(\d{4})[-/](\d{1,2})$/,gr=/^(\d{4})[-\s]?Q([1-4])$/i,pr=/^Q([1-4])[-\s](\d{4})$/i,hr=/^(\d{4})$/,yr=/^(\d{4})(0[1-9]|1[0-2])$/,br=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,Sr=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,_r=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Ke(t,e,n){let i=ee(t);if(!i)return 0;if(i==="sept")return 9;for(let a of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=Se(a)[i];if(l!==void 0)return l+1}let r=n?.get(i);if(r!==void 0)return r+1;let s=se(t);if(s.length>0){if(s.every(o=>o.month===s[0].month))return s[0].month+1;let a=Ze(String(e??"").split(/[-_]/)[0])?.code,l=s.find(o=>o.lang===a);if(l)return l.month+1}return 0}function Ar(t){let e=ge(t).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let n=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==n.n||i.year!==n.year)?null:Y(n.year,(n.n-1)*3+1,1)}function Y(t,e,n,i=0,r=0,s=0){if(!(t>=1&&e>=1&&e<=12&&n>=1&&n<=31))return null;let a=Date.UTC(t,e-1,n,i,r,s);if(!Number.isFinite(a))return null;let l=o=>o<10?"0"+o:String(o);return{ms:a,y:t,m:e,d:n,iso:`${t}-${l(e)}-${l(n)}`}}function Cr(t,e){let n=[],i="";for(let o=0;o<e.length;o++){if(e[o]!=="%"){i+=e[o].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++o]){case"Y":n.push("Y"),i+="(\\d{4})";break;case"m":n.push("m"),i+="(\\d{1,2})";break;case"d":n.push("d"),i+="(\\d{1,2})";break;case"H":case"M":case"S":i+="\\d{1,2}";break;case"%":i+="%";break;default:return null}}let r=new RegExp("^"+i+"$").exec(t);if(!r)return null;let s=0,a=1,l=1;return n.forEach((o,u)=>{let c=+r[u+1];o==="Y"?s=c:o==="m"?a=c:l=c}),s?Y(s,a,l):null}function j(t,e,n,i){let r=(t??"").trim();if(r==="")return null;if(e){let o=Cr(r,e);return o||null}let s=mr.exec(r);if(s)return Y(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=gr.exec(r),s)return Y(+s[1],(+s[2]-1)*3+1,1);if(s=pr.exec(r),s)return Y(+s[2],(+s[1]-1)*3+1,1);if(s=fr.exec(r),s&&+s[2]>=1&&+s[2]<=12)return Y(+s[1],+s[2],1);if(s=br.exec(r),s)return Y(+s[1],+s[2],+s[3]);if(s=yr.exec(r),s)return Y(+s[1],+s[2],1);if(s=hr.exec(r),s){let o=+s[1];return o>=1900&&o<=2100?Y(o,1,1):null}let a=Ar(r);if(a)return a;if(s=Sr.exec(r),s){let o=Ke(s[1],n,i);if(o)return Y(+s[2],o,1)}if(s=_r.exec(r),s){let o=Ke(s[2],n,i);if(o)return Y(+s[1],o,1)}let l=re(r);if(l){let o="month"in l?l.month:Ke(l.word,n,i);if(o)return Y(l.year,o,1)}return null}function Xt(t){let e=new Date(t).getUTCDay();return e>=1&&e<=5}function qt(t,e){if(e<=t)return 0;let n=Math.round((e-t)/te),i=Math.floor(n/7),r=i*5,s=t+i*7*te;for(;s<e;)Xt(s)&&r++,s+=te;return r}function xr(t){if(t.length===0)return 0;let e=[...t].sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function wr(t){return t>0?t<.95?"hour":t<=1.05?"day":t>=6.5&&t<=7.5?"week":t>=27&&t<=31.5?"month":t>=88&&t<=93?"quarter":t>=362&&t<=368?"year":"irregular":"irregular"}function ae(t,e,n,i){switch(n){case"year":return e.y-t.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(t.y*4+Math.floor((t.m-1)/3));case"month":return e.y*12+e.m-(t.y*12+t.m);case"week":return Math.round((e.ms-t.ms)/(7*te));case"weekday":return qt(t.ms,e.ms);case"day":return Math.round((e.ms-t.ms)/te);default:return i>0?Math.round((e.ms-t.ms)/i):0}}function Zt(t,e){return Ue(t,e)?.cadence??null}function Ue(t,e){let n=e?.gapFactor??ur,i=0,r=0,s=new Map,a=Array.from(t),l;if(!e?.pattern){let g=[];for(let w of a){if(w==null||w==="")continue;let b=re(String(w));b&&"word"in b&&g.push(b.word)}g.length>0&&(l=_e(g,e?.locale)??void 0)}for(let g of a){if(g==null||g==="")continue;i++;let w=j(String(g),e?.pattern,e?.locale,l);w&&(r++,s.set(w.ms,w))}let o=[...s.values()].sort((g,w)=>g.ms-w.ms);if(o.length<dr||i>0&&r/i<.8)return null;let u=o[o.length-1].ms-o[0].ms;if(u<=0)return null;let c=[];for(let g=1;g<o.length;g++)c.push(o[g].ms-o[g-1].ms);let f=xr(c);if(!(f>0))return null;let d=wr(f/te);d==="day"&&u>=7*te&&o.every(g=>Xt(g.ms))&&qt(o[0].ms,o[o.length-1].ms)+1>o.length*.5&&(d="weekday");let h=d==="irregular"?o.length:ae(o[0],o[o.length-1],d,f)+1,x=1,A=1,S=[],p=o[0],y=1;for(let g=1;g<o.length;g++){let w=ae(o[g-1],o[g],d,f);w>x&&(x=w),d!=="irregular"&&w>n?(A++,S.push({from:p.iso,to:o[g-1].iso,points:y}),p=o[g],y=1):y++}S.push({from:p.iso,to:o[o.length-1].iso,points:y});let C={grain:d,points:o.length,expectedPoints:Math.max(h,o.length),coveragePct:Math.round(o.length/Math.max(h,o.length)*1e3)/10,runs:A,largestGapUnits:x,gapFactor:n};return e?.includeBounds&&S.length<=cr&&(C.runBounds=S),{cadence:C,points:o,stepMs:f}}var Mr=8,Tr=.5,vr=200,Rr=new Set(["category","categories","subcategory","type","types","kind","class","classes","classification","segment","segments","tier","status","priority","severity","grade","level","band","bucket","group","channel","method","mode","stage","phase","period","shift","gender","sex","result","outcome","reason","flag","genre","sector","source"]),Ir=["category","classification","segment","status","priority","severity","channel"],Nr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function Er(t){let e=J(t);if(e.length===0)return!1;let n=e[e.length-1];return Rr.has(n)?!0:Ir.some(i=>n.length>i.length&&n.endsWith(i))}function kr(t){if(t.isMeasure)return"measure";if(t.isTemporal||t.isDatePart||t.isReassembledDate)return"temporal";let e=Array.from(t.values).filter(n=>n!==""&&n!==null&&n!==void 0);return e.length<2||e.length>vr?"cardinality":t.rows>0&&e.length>=t.rows?"row-identity":t.isBinaryFlag?"flag":pe(e,t.locale)!==null?"ordinal":t.identifierNamed||t.dataType==="String"&&Nr.has(be(e))?"identifier":!t.geoKind&&Er(t.name)?"attribute":"entity"}function en(t){let e=-1,n=1/0,i=!1;return t.forEach((r,s)=>{if(kr(r)!=="entity")return;let a=new Set(Array.from(r.values).filter(o=>o!=="")).size,l=!!r.geoKind;(a<n||a===n&&l&&!i)&&(e=s,n=a,i=l)}),e}var Qt=t=>t<10?"0"+t:String(t);function Jt(t,e){switch(e){case"year":return`${t.y}-01-01`;case"quarter":return`${t.y}-${Qt(Math.floor((t.m-1)/3)*3+1)}-01`;case"month":return`${t.y}-${Qt(t.m)}-01`;case"hour":return new Date(t.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return t.iso}}function tn(t){let{periods:e,series:n}=t,i=Math.min(e.length,n.length),r=new Set;for(let w=0;w<i;w++)e[w]&&r.add(e[w]);let s=Ue(r,{pattern:t.pattern,locale:t.locale});if(!s)return null;let a=s.cadence.grain;if(a==="irregular")return null;let l=s.points[0],o=ae(l,s.points[s.points.length-1],a,s.stepMs)+1;if(o!==s.cadence.expectedPoints)return null;let u=new Map;for(let w of r){let b=j(w,t.pattern,t.locale);if(!b)continue;let _=ae(l,b,a,s.stepMs);_>=0&&_<o&&u.set(w,{idx:_,stamp:b})}let c=new Map;for(let w=0;w<i;w++){let b=n[w];if(!b)continue;let _=u.get(e[w]);if(!_)continue;let M=c.get(b);M||(M={seen:new Set,lo:_.idx,hi:_.idx,loStamp:_.stamp,hiStamp:_.stamp,order:c.size},c.set(b,M)),M.seen.add(_.idx),_.idx<M.lo&&(M.lo=_.idx,M.loStamp=_.stamp),_.idx>M.hi&&(M.hi=_.idx,M.hiStamp=_.stamp)}if(c.size<2)return null;let f=0;for(let w of c.values())f+=w.seen.size;if(f/(c.size*o)<(t.minFill??Tr))return null;let d=[],h=new Set,x=0,A=0,S=0,p=0,y=0,C=1;for(let[w,b]of c){for(let z of b.seen)h.add(z);if(b.seen.size>=o)continue;let _=[...b.seen].sort((z,X)=>z-X),M=1;for(let z=1;z<_.length;z++)M=Math.max(M,_[z]-_[z-1]);let W={key:w,acc:b,coverage:b.seen.size/o,before:b.lo,after:o-1-b.hi,interior:b.hi-b.lo+1-b.seen.size,gap:M};d.push(W),W.before>0&&x++,W.after>0&&A++,W.interior>0&&S++,p=Math.max(p,W.before),y=Math.max(y,W.after),C=Math.max(C,M)}if(d.length===0)return null;d.sort((w,b)=>w.coverage-b.coverage||w.acc.order-b.acc.order);let g=d.slice(0,t.maxListed??Mr);return{seriesColumn:t.seriesColumn,grain:a,periods:o,seriesCount:c.size,incompleteSeries:d.length,lateStarts:x,earlyEnds:A,withHoles:S,columnWideMissing:o-h.size,maxMissingBefore:p,maxMissingAfter:y,largestGap:C,series:g.map(w=>{let b={};return t.includeNames&&(b.name=w.key),t.includeDates&&(b.first=Jt(w.acc.loStamp,a),b.last=Jt(w.acc.hiStamp,a)),b.missingBefore=w.before,b.missingAfter=w.after,b.missingInterior=w.interior,b.largestGap=w.gap,b.coverage=Math.round(w.coverage*1e3)/1e3,b}),more:d.length-g.length}}var Re=6;function le(t){let e=t.slice().sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function Dr(t){let e=t.length;if(e<Re)return null;let n=t[0],i=t[0],r=0;for(let g of t)g<n&&(n=g),g>i&&(i=g),r+=g;if(n===i)return null;let s=le(t.map(Math.abs));if(s===0)return null;let a=[];for(let g=1;g<e;g++)a.push(t[g]-t[g-1]);let l=le(a.map(Math.abs))/s,o=(e-1)/2,u=r/e,c=0,f=0,d=0;for(let g=0;g<e;g++)c+=(g-o)*(t[g]-u),f+=(g-o)*(g-o),d+=(t[g]-u)*(t[g]-u);d/=e;let h=c/f,x=u-h*o,A=t.map((g,w)=>g-(x+h*w)),S=A.reduce((g,w)=>g+w,0)/e,p=0,y=0;for(let g=0;g<e;g++)p+=(A[g]-S)*(A[g]-S),g>0&&(y+=(A[g]-A[g-1])*(A[g]-A[g-1]));return p/=e,y/=e-1,{vnDetrended:p<=d*1e-12?2:y/p,relStep:l}}function He(t){let{stamps:e,series:n,values:i}=t,r=Math.min(e.length,i.length),s=new Map;for(let u=0;u<r;u++){let c=e[u],f=i[u];if(c===null||f===null||!Number.isFinite(f))continue;let d="";if(n&&(d=n[u]??"",d===""))continue;let h=s.get(d);h||s.set(d,h=new Map),h.set(c,(h.get(c)??0)+f)}let a=[],l=[],o=[];for(let u of s.values()){let c=[...u.entries()].sort((d,h)=>d[0]-h[0]).map(d=>d[1]),f=Dr(c);f&&(a.push(f.vnDetrended),l.push(f.relStep),o.push(c.length))}return a.length===0?null:{series:a.length,points:Math.round(le(o)),vnDetrended:Math.round(le(a)*1e3)/1e3,relStep:Math.round(le(l)*1e4)/1e4}}function ts(t){let e=t.times.map(n=>j(n,t.pattern,t.locale)?.ms??null);return He({stamps:e,series:t.series,values:t.values})}var Or=5e5,Pr=8,Lr=4,Fr=5,Ye=1,je=2,zr=4,Wr=8;function $r(t,e,n){let[i,r]=[...t];if(e.isTemporal){let s=j(i,e.temporalTextPattern,n),a=j(r,e.temporalTextPattern,n);if(s&&a&&s.ms!==a.ms)return s.ms<a.ms?{a:i,b:r,setOrder:"temporal"}:{a:r,b:i,setOrder:"temporal"}}return i<r?{a:i,b:r,setOrder:"none"}:{a:r,b:i,setOrder:"none"}}function Br(t,e,n){let{rows:i,text:r,locale:s}=t,a=$r(n.values,n,s),l=new Uint8Array(i.length),o=0;for(let u=0;u<i.length;u++){let c=r(i[u][e]);c===a.a?l[u]=1:c===a.b?l[u]=2:o++}return{code:l,blankRows:o,setOrder:a.setOrder}}function Gr(t,e){let{rows:n,text:i}=t,r=new Int32Array(n.length),s=new Map;for(let a=0;a<n.length;a++){let l=i(n[a][e]);if(l===""){r[a]=-1;continue}let o=s.get(l);o===void 0&&(o=s.size,s.set(l,o)),r[a]=o}return{ids:r,dict:s}}function Vr(t,e,n){let i=new Uint8Array(n);for(let s=0;s<t.length;s++){let a=e[s];if(a===0)continue;let l=t[s];if(l<0)continue;let o=i[l];i[l]=o&a?o|a<<2:o|a}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let s=0;s<n;s++){let a=i[s];a&Ye&&r.keysA++,a&je&&r.keysB++,(a&(Ye|je))===(Ye|je)&&r.keysBoth++,a&zr&&r.dupA++,a&Wr&&r.dupB++}return r}function Kr(t,e){let n=(t.dupA+t.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(t.keysA+t.keysB);return n<i||n===i&&t.keysBoth>e.keysBoth}var nn=t=>t==null||typeof t=="string"&&t.trim()==="";function Ur(t,e,n){if(t===e)return!0;let i=nn(t),r=nn(e);return i||r?i&&r:typeof t=="number"&&typeof e=="number"?!1:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():n(t).trim()===n(e).trim()}function rn(t){let{rows:e,columns:n}=t,i=e.length;if(i<2||i>Or)return null;let r=n.map((b,_)=>({c:b,i:_})).filter(({c:b})=>!b.isMeasure&&!b.isTemporal&&!b.isDatePart&&b.distinct>=Fr).sort((b,_)=>(_.c.identifierNamed?1:0)-(b.c.identifierNamed?1:0)||_.c.distinct-b.c.distinct||b.i-_.i).slice(0,Pr),s=n.map((b,_)=>({c:b,i:_})).filter(({c:b})=>!b.isMeasure&&b.values!==null&&b.values.size===2).slice(0,Lr);if(r.length===0||s.length===0)return null;let a=s.map(({c:b,i:_})=>Br(t,_,b)),l=null;for(let{i:b}of r){let _=Gr(t,b);for(let M=0;M<s.length;M++){if(s[M].i===b)continue;let W=Vr(_.ids,a[M].code,_.dict.size);W.keysBoth<1||(!l||Kr(W,l.tally))&&(l={tally:W,keyIdx:b,setNo:M,ids:_.ids,dict:_.dict})}}if(!l)return null;let{ids:o,dict:u,tally:c}=l,f=a[l.setNo],d=s[l.setNo].i,h=u.size,x=new Int32Array(h).fill(-1),A=new Int32Array(h).fill(-1);for(let b=0;b<i;b++){let _=f.code[b],M=o[b];_===0||M<0||(_===1?x[M]<0&&(x[M]=b):A[M]<0&&(A[M]=b))}let S=[];for(let b=0;b<n.length;b++)b!==l.keyIdx&&b!==d&&S.push(b);let p=0;for(let b=0;b<h;b++){let _=x[b],M=A[b];if(_<0||M<0)continue;let W=e[_],z=e[M],X=!0;for(let Q of S)if(!Ur(W[Q],z[Q],t.text)){X=!1;break}X&&p++}let y=p===c.keysBoth?100:p===0?0:Math.min(99,Math.max(1,Math.round(p/c.keysBoth*100))),C=new Map,g=new Map;for(let[b,_]of u){let M=x[_]>=0,W=A[_]>=0;if(!M&&!W)continue;let z=dt(b);mt(z)&&(M&&C.set(z,(C.get(z)??0)+1),W&&g.set(z,(g.get(z)??0)+1))}let w=b=>{let _=0;for(let M of b.values())M>=2&&(_+=M);return _};return{key:l.keyIdx,discriminator:d,pairing:{form:"long",key:n[l.keyIdx].name,discriminator:n[d].name,keysA:c.keysA,keysB:c.keysB,keysBoth:c.keysBoth,duplicateKeysA:c.dupA,duplicateKeysB:c.dupB,identicalPct:y,discriminatorBlankRows:f.blankRows,looseCollisionsA:w(C),looseCollisionsB:w(g),setOrder:f.setOrder}}}var Hr=t=>t==="Integer"||t==="Decimal";function Yr(t){let e=[],n=[];return t.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||n.push(r)}}),[...e,...n].slice(0,6)}function jr(t,e){let n=[];for(let i=0;i<t.length&&n.length<12;i++){let r=t[i];e.has(i)||!Hr(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||n.push(i)}return n}function sn(t){let e=new Map,{rows:n,columns:i,text:r}=t;if(n.length===0||n.length>(t.maxRows??5e5))return e;let s=Yr(i);if(s.length===0)return e;let a=jr(i,new Set(s));if(a.length===0)return e;let l=s.map(o=>{let[u,c]=i[o].twoValues,f=new Uint8Array(n.length);for(let d=0;d<n.length;d++){let h=r(n[d][o]);f[d]=h===u?1:h===c?2:0}return f});for(let o of a){let u=new Float64Array(n.length),c=0;for(let y=0;y<n.length;y++){let C=n[y][o],g=C==null||C===""?NaN:typeof C=="number"?C:parseFloat(C);u[y]=g,g===g&&g!==1/0&&g!==-1/0&&c++}if(c<2)continue;let f=new Float64Array(c);for(let y=0,C=0;y<n.length;y++){let g=u[y];g===g&&g!==1/0&&g!==-1/0&&(f[C++]=g)}f.sort();let d=new Float64Array(c),h=0;for(let y=0;y<c;y++)(y===0||f[y]!==f[y-1])&&(d[h++]=f[y]);let x=new Int32Array(n.length).fill(-1);for(let y=0;y<n.length;y++){let C=u[y];if(!(C===C&&C!==1/0&&C!==-1/0))continue;let g=0,w=h-1;for(;g<w;){let b=g+w>>>1;d[b]<C?g=b+1:w=b}x[y]=g}let A=[],S=new Int32Array(h),p=new Int32Array(h);for(let y=0;y<s.length;y++){let C=l[y];S.fill(0),p.fill(0);let g=0,w=0;for(let U=0;U<n.length;U++){let m=x[U];m<0||(C[U]===1?(S[m]++,g++):C[U]===2&&(p[m]++,w++))}if(g===0||w===0)continue;let b=g<=w,_=b?g:w,M=b?w:g,W=b?S:p,z=b?p:S,X=0,Q=0,ue=0;for(let U=0;U<h;U++){let m=W[U],T=z[U];X+=m*(Q+.5*T),Q+=T,m+T>=2&&(ue+=m+T)}A.push({outcome:i[s[y]].name,aucMinorityHigh:Math.round(X/(_*M)*1e4)/1e4,nMinority:_,nMajority:M,ties:ue})}A.length>0&&e.set(o,A)}return e}var Xr=12,qr=100,Zr=.3,Qr=.9,Jr=120,ei=1900,ti=2100,ni=0,ri=20,ii=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Ie(t){if(!t)return!1;let e=J(t);return e.length===0?!1:ii.has(e[e.length-1])?!0:Ut(t)!==null}var si=new Set(["year","yr","fy"]),oi=t=>J(t).some(e=>si.has(e))||ct(t)!==null,ai=/^(?:(?:19|20)\d{2}(?:[-/ ]?(?:q[1-4]|w(?:0?[1-9]|[1-4]\d|5[0-3])|(?:0?[1-9]|1[0-2])))?|q[1-4][-/ ](?:19|20)\d{2}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*[-/ ]?(?:19|20)?\d{2})$/i;function Xe(t){if(!Number.isInteger(t)||t<190001||t>210012)return!1;let e=t%100;return e>=1&&e<=12}function qe(t){if(!Number.isInteger(t)||t<19000101||t>21001231)return!1;let e=Math.floor(t/100)%100,n=t%100;return e>=1&&e<=12&&n>=1&&n<=31}var li=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,ui=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,ci=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function un(t,e){let n=[],i=0,r=di(t,e,n,()=>{i++});if(r)return r;if(i>0||n.length<2)return null;let s=It(n,{locale:e,floor:.8});return!s||!s.pattern||s.form==="named"?null:{pattern:s.pattern,orderFrom:s.orderFrom==="shape"?s.order==="ymd"?"iso":"shape":s.orderFrom}}function di(t,e,n,i){let r=0,s=0,a=0,l=0,o=0,u="",c=0,f="",d=0,h=0,x=0,A=0,S=!1;for(let b of t){if(b==null)continue;let _=String(b).trim();if(_==="")continue;r++,n.push(_);let M;if(M=li.exec(_)){i();let W=+M[2],z=+M[3];W>=1&&W<=12&&z>=1&&z<=31&&(s++,M[4]!==void 0&&a++,M[6]!==void 0&&l++)}else if(M=ui.exec(_)){i();let W=+M[3],z=+M[4];W>=1&&W<=12&&z>=1&&z<=31&&(u&&u!==M[2]&&(S=!0),u=M[2],o++)}else if(M=ci.exec(_)){i();let W=+M[1],z=+M[3];W>=1&&W<=31&&z>=1&&z<=31&&(W<=12||z<=12)&&(f&&f!==M[2]&&(S=!0),f=M[2],c++,W>12&&x++,z>12&&A++,M[5]!==void 0&&d++,M[7]!==void 0&&h++)}if(r>=200)break}if(r<2||(s+o+c)/r<.8||(s>0?1:0)+(o>0?1:0)+(c>0?1:0)!==1||S)return null;if(s>0)return a===s?{pattern:l===s?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(o>0)return{pattern:`%Y${u}%m${u}%d`,orderFrom:"iso"};if(x>0&&A>0)return null;let C,g;x>0?(C=!0,g="values"):A>0?(C=!1,g="values"):f==="."?(C=!0,g="shape"):(C=!ze(e),g="locale");let w=C?`%d${f}%m${f}%Y`:`%m${f}%d${f}%Y`;return d===c?{pattern:w+(h===c?" %H:%M:%S":" %H:%M"),orderFrom:g}:{pattern:w,orderFrom:g}}function mi(t,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(t))return!1;let n=t.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!n)return!1;let i=ee(n);return i.length>0&&e[i]!==void 0}function fi(t,e){let n=new Map,i=new Map;for(let l of t){let o=re(l);if(!o||"month"in o)continue;let u=se(o.word),c=u.some(d=>d.lang==="en"),f=ee(o.word);for(let d of new Set(u.map(h=>h.lang)))d!=="en"&&(n.has(d)||(n.set(d,new Set),i.set(d,new Set)),n.get(d).add(f),c||i.get(d).add(f))}let r=[...n.keys()].filter(l=>n.get(l).size>=3&&i.get(l).size>=1),s=0,a=new Map(r.map(l=>[l,0]));for(let l of e){let o=re(l);if(!o)continue;if("month"in o){s++;continue}let u=se(o.word);if(u.length===0)continue;let c=u.some(f=>f.lang==="en");for(let f of r)(c||u.some(d=>d.lang===f))&&a.set(f,a.get(f)+1)}return s+Math.max(0,...a.values())}var gi=/(?:19|20)[0-9]{2}/;function pi(t){let e=new Map,n=0;for(let r of t){if(!gi.test(ne(r)))continue;let s=new Set(ge(r).filter(a=>a.yearDigits===4&&(a.grain==="quarter"||a.grain==="week")).map(a=>a.lang));if(s.size!==0){if(s.has("en")){n++;continue}for(let a of s)e.set(a,(e.get(a)??0)+1)}}let i=0;for(let r of e.values())i=Math.max(i,r);return i>0?i+n:0}function hi(t){let{dataType:e,name:n,isMeasure:i,distinctCount:r}=t;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=t.minNum,a=t.maxNum;if(!(s!=null&&a!=null&&Number.isFinite(s)&&Number.isFinite(a)&&Number.isInteger(s)&&Number.isInteger(a)&&a>=s))return!1;let o=s>=1900&&a<=2100;if(o&&r>=2&&oi(n)||o&&r>=3&&r===a-s+1)return!0;let u=Xe(s)&&Xe(a),c=qe(s)&&qe(a);if(u||c){if(!t.sampleValues)return!0;let f=0,d=0;for(let h of t.sampleValues){if(h==null||h==="")continue;f++;let x=Number(String(h).trim());if(Number.isFinite(x)&&(u?Xe(x):qe(x))&&d++,f>=60)break}if(f>=2&&d===f)return!0}return!1}if(t.sampleValues){let s=t.locale?Se(t.locale):null,a=0,l=0,o=[],u=[];for(let c of t.sampleValues){if(c==null||c==="")continue;a++;let f=String(c).trim();if(o.push(f),ai.test(f)||mi(f,s)?l++:u.push(f),a>=60)break}if(a>=2&&l/a>=.8||a>=2&&(l+pi(u)+fi(o,u))/a>=.8||un(o,t.locale)!==null)return!0}return!1}function yi(t){let e=Z((t||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":Lt(t)}function bi(t){let{rows:e,measureColIdx:n,measureName:i,candidateDims:r,minNum:s,maxNum:a,discourageAgg:l}=t,o=100,u=.01,c="";for(let d of r){if(d.distinct<2||d.distinct>o)continue;let h=r.filter(y=>y.idx!==d.idx).map(y=>y.idx),x=new Map;for(let y of e){let C=y[n];if(typeof C!="number"||!Number.isFinite(C))continue;let g=h.length?h.map(b=>String(y[b])).join(c):"",w=x.get(g);w||(w={sum:0,cset:new Set},x.set(g,w)),w.sum+=C,w.cset.add(String(y[d.idx]))}let A=0,S=0,p=0;for(let y of x.values())y.cset.size<2||(p++,Math.abs(y.sum-100)<=100*u?A++:Math.abs(y.sum-1)<=1*u&&S++);if(p>=2&&(A/p>=.9||S/p>=.9))return{additivity:"part_of_whole",partOfWholeDim:d.name}}if(l)return{additivity:"intensive_rate"};let f=yi(i);return f==="avg"||f==="min"||f==="max"?{additivity:"intensive_rate"}:f==="count"?{additivity:"additive"}:f==="sum"?{additivity:"unknown"}:s!=null&&a!=null&&Number.isFinite(s)&&Number.isFinite(a)&&s>=0&&a<=1.0001&&a>0?{additivity:"intensive_rate"}:{additivity:"unknown"}}function cn(t){let{dataType:e,isMeasure:n,name:i,distinct:r,nonblank:s,prec:a,maxval:l,minval:o}=t,u=l-o+1,c=u>0?r/u:1,f=s>0?r/s:0,d=e==="Decimal"||a>0;return!n&&Ie(i)?"Categorical":c>=Qr&&!(t.ordinalNeedsWholeNumbers&&a>0)&&(ft(i)&&r<=Jr||o>=ei&&l<=ti||o>=ni&&l<=ri)?"Ordinal":n||r>Xr&&(d||r>=qr||f>=Zr)?"Continuous":"Categorical"}function an(t,e,n){return!t||t.isMeasure||e||t.dataType!=="Integer"&&t.dataType!=="Decimal"?!1:cn({dataType:t.dataType,isMeasure:!1,name:t.name,distinct:n.distinct,nonblank:n.nonblank,prec:n.prec,maxval:typeof n.maxval=="number"?n.maxval:0,minval:typeof n.minval=="number"?n.minval:0,ordinalNeedsWholeNumbers:!0})==="Continuous"}function Si(t){let e=null;for(let n=0;n<t.length;n++){let i=t[n];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=t.slice()),e[n]=r)}return e||t}var ln=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_generationColumns=[];_generationColumnsSig="[]";_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;deriveProvinces=!0;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let n=0;n<this._cols.length;n++){let i=this._cols[n];!i||!/date|time/i.test(String(i.dataType??""))||lt(this._rows.map(r=>r[n]))&&e.add(n)}return e}STR(e){return e==null?"":e instanceof Date?this.wholeDayIso(e)??(isNaN(e.getTime())?"":e.toISOString()):e.toString()}getPrecision(e){if(!isFinite(e))return 0;let i=e.toString().split(".")[1];return i?i.length:0}getColumns(){return this._cols}inferredMeasureFlags(){if(this._inferredMeasureFlags)return this._inferredMeasureFlags;let e=this._cols.map(n=>!!(n&&n.isMeasure));return this._cols.forEach((n,i)=>{if(!n||n.isMeasure||this._declaredDimensions.has(n)||n.dataType!=="Integer"&&n.dataType!=="Decimal")return;let r=new Set,s=0,a=0,l=null,o=null;for(let u of this._rows){let c=u[i],f=this.STR(c);if(f!=""&&(r.add(f),s++,(l===null||c<l)&&(l=c),(o===null||c>o)&&(o=c),n.dataType=="Decimal")){let d=this.getPrecision(c);d>a&&(a=d)}}e[i]=an(n,!1,{distinct:r.size,nonblank:s,prec:a,minval:l,maxval:o})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let n of e)n&&this._declaredDimensions.add(n)}wholeDayIso(e){return at(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,n){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),a=[],l=[],o=[];for(let m of this._cols){let T=new Map,O=[],D=0,v=0,k=0,F=null,P=null,E=null,G=!1,V=!0,I=!0,N=null,K=!1,L=s.has(i);for(let R of this._rows){let $=R[i],B=L&&$ instanceof Date?fe($):$,H=this.STR(B);if(H!=""){if(D+=H.length,T.set(H,(T.get(H)||0)+1),v++,m.dataType=="Integer"||m.dataType=="Decimal"||m.dataType=="DateTime")if((F===null||B<F)&&(F=B),(P===null||B>P)&&(P=B),m.dataType=="Integer"||m.dataType=="Decimal"){if(E===null?E=B:E+=B,m.dataType=="Decimal"){let q=this.getPrecision(B);q>k&&(k=q)}O.push(B)}else G=G||this.hasTimeComponent(B);K&&(B<N?V=!1:B>N&&(I=!1)),N=B,K=!0}}if(v>=3&&(V&&!I?m.sortedDirection="asc":I&&!V?m.sortedDirection="desc":m.sortedDirection="none"),v>0&&T.size>0&&!m.isMeasure){let R=0,$=Number.MAX_SAFE_INTEGER;for(let B of T.values())B>R&&(R=B),B<$&&($=B);if(m.modalShare=R/v,m.minGroupCount=$===Number.MAX_SAFE_INTEGER?null:$,T.size===2){let B=[...T.keys()].map(ce=>it(ce).trim().toLowerCase()).sort(),q=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ce=>B[0]===ce[0]&&B[1]===ce[1]),dn=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(m.name);(q||dn)&&(m.isBinaryFlag=!0)}}else m.isMeasure&&(m.dataType==="Integer"||m.dataType==="Decimal")&&T.size===2&&T.has("0")&&T.has("1")&&(m.isBinaryFlag=!0);if(m.dataType=="DateTime"&&(m.dateWithTime=G,G&&ut(L?this._rows.map(R=>R[i]instanceof Date?fe(R[i]):R[i]):this._rows.map(R=>R[i]))?m.timeOfDayOnly=!0:delete m.timeOfDayOnly),m.isTemporal=hi({dataType:m.dataType,name:m.name,isMeasure:m.isMeasure,distinctCount:T.size,minNum:typeof F=="number"?F:null,maxNum:typeof P=="number"?P:null,sampleValues:T.keys(),locale:n}),m.isTemporal&&m.dataType==="String"&&!m.isMeasure){let R=un(T.keys(),n);R&&(m.temporalTextPattern=R.pattern)}if(m.timeOfDayOnly)delete m.temporalCadence;else if(m.isTemporal&&!m.isMeasure){let R=Zt(T.keys(),{includeBounds:r>=20,pattern:m.temporalTextPattern,locale:n});R&&(m.temporalCadence=R)}this.updateColumnStats10(r,m,v,T,k,P,F),this.updateColumnStats20(r,O,v,E,m,D,G,F,P,k,T,n),an(m,this._declaredDimensions.has(m),{distinct:T.size,nonblank:v,prec:k,minval:F,maxval:P})&&(m.isMeasure=!0,m.valueNature="Continuous",m.geoKind=void 0,m.geoMatchPct=void 0,m.geoAmbiguous=void 0,m.dominantGeoRegion=void 0,m.dominantGeoRegionPct=void 0,m.geoRegionCount=void 0),a[i]=m.isMeasure||T.size>2e3?null:new Set(T.keys()),l[i]=T.size,o[i]=T.size===2?[...T.keys()].sort():null,i++}Tt(this._cols,this._rows,{cities:this.deriveProvinces}).forEach((m,T)=>{let O=this._cols[T];m.kind&&(O.geoKind=m.kind,O.geoMatchPct=m.matchPct,m.ambiguous&&(O.geoAmbiguous=!0)),m.rollupPct!==void 0&&(O.admin1RollupPct=m.rollupPct),m.regionCount!==void 0&&(O.admin1RegionCount=m.regionCount),m.countryCount!==void 0&&(O.admin1CountryCount=m.countryCount),m.dominantRegion&&(O.dominantGeoRegion=m.dominantRegion,O.dominantGeoRegionPct=m.dominantRegionPct)});let u=this.getGeoExtent();if(u&&u.dominantFrame&&this._geoExtentLatIdx>=0){let m=this._cols[this._geoExtentLatIdx];m.geoKind||(m.dominantGeoRegion=u.dominantFrame,m.dominantGeoRegionPct=u.dominantFramePct,this.deriveProvinces&&(m.admin1RollupPct=u.dominantFramePct))}let c=[];this._cols.forEach((m,T)=>{m.isMeasure||c.push({idx:T,distinct:m.distinctCount??0,name:m.name})}),this._cols.forEach((m,T)=>{if(!m.isMeasure)return;let O=typeof m.lowValue=="number"?m.lowValue:null,D=typeof m.highValue=="number"?m.highValue:null,v=bi({rows:this._rows,measureColIdx:T,measureName:m.name,candidateDims:c,minNum:O,maxNum:D,discourageAgg:!!m.discourageAggregationAcrossGroups});m.additivity=v.additivity,v.partOfWholeDim&&(m.partOfWholeDim=v.partOfWholeDim)});let f=50,d=4,h=c.filter(m=>m.distinct>=2&&m.distinct<=f);this._cols.forEach((m,T)=>{if(!m.isMeasure)return;let O=[];for(let I of this._rows){let N=I[T];if(N==null||N==="")continue;let K=typeof N=="number"?N:parseFloat(N);isNaN(K)||O.push(K)}if(O.length===0)return;let D=[...O].sort((I,N)=>I-N);if(D[0]===D[D.length-1])m.relativeDispersion=0;else if(D.length>=d){let I=me(D,.5),N=me(D,.1),K=me(D,.9);m.relativeDispersion=Math.abs(I)>1e-9?Math.round((K-N)/Math.abs(I)*1e3)/1e3:void 0}else m.relativeDispersion=void 0;let v=[];for(let I of h){let N=new Set;for(let K of this._rows){let L=K[T];L==null||L===""||N.add(this.STR(K[I.idx])+"")}v.push({otherColumn:I.name,nonBlankGroupCount:N.size})}v.length>0&&(m.nonBlankGroups=v);let k=0;for(let I of O)k+=I;k/=O.length;let F=0;for(let I of O)F+=(I-k)*(I-k);if(F<=1e-12)return;let P=[],E=[],G=I=>{if(I.length<4)return NaN;let N=[...I].sort((L,R)=>L-R),K=L=>N[Math.min(N.length-1,Math.max(0,Math.floor(L*(N.length-1))))];return K(.75)-K(.25)},V=G(O);for(let I of h){let N=new Map;for(let R of this._rows){let $=R[T];if($==null||$==="")continue;let B=typeof $=="number"?$:parseFloat($);if(isNaN(B))continue;let H=this.STR(R[I.idx])+"",q=N.get(H);q?(q.s+=B,q.n++,q.vals.push(B)):N.set(H,{s:B,n:1,vals:[B]})}let K=0;for(let R of N.values()){let $=R.s/R.n;K+=R.n*($-k)*($-k)}P.push({otherColumn:I.name,eta2:Math.round(K/F*1e4)/1e4});let L=[];for(let R of N.values()){let $=G(R.vals);isNaN($)||L.push($)}if(L.length>=2&&isFinite(V)&&V>1e-9){let R=(Math.max(...L)-Math.min(...L))/V;E.push({otherColumn:I.name,spreadRatio:Math.round(R*1e4)/1e4})}}P.length>0&&(m.groupDiscrimination=P),E.length>0&&(m.spreadDiscrimination=E)});let x=.97,A=.8,S=8,p=5,y=this._cols.map((m,T)=>({c:m,i:T})).filter(m=>m.c.isMeasure);for(let m=0;m<y.length;m++)for(let T=m+1;T<y.length;T++){let O=y[m].i,D=y[T].i,v=0,k=0,F=0,P=0,E=0,G=0;for(let L of this._rows){let R=L[O],$=L[D];if(R==null||R===""||$===null||$===void 0||$==="")continue;let B=typeof R=="number"?R:parseFloat(R),H=typeof $=="number"?$:parseFloat($);isNaN(B)||isNaN(H)||(v++,k+=B,F+=H,P+=B*B,E+=H*H,G+=B*H)}if(v<p)continue;let V=v*P-k*k,I=v*E-F*F;if(V<=1e-12||I<=1e-12)continue;let N=(v*G-k*F)/Math.sqrt(V*I),K=Math.min(1,Math.round(Math.abs(N)*1e3)/1e3);for(let L of[y[m].c,y[T].c])(L.maxAbsMeasureCorrelation===void 0||K>L.maxAbsMeasureCorrelation)&&(L.maxAbsMeasureCorrelation=K);if(Math.abs(N)>=x){let L=y[m].c,R=y[T].c;L.collinearWithMeasures||(L.collinearWithMeasures=[]),R.collinearWithMeasures||(R.collinearWithMeasures=[]),L.collinearWithMeasures.push(R.name),R.collinearWithMeasures.push(L.name)}else if(Math.abs(N)>=A){let L=y[m].c,R=y[T].c,$=Math.round(N*1e3)/1e3;L.correlatedWithMeasures||(L.correlatedWithMeasures=[]),R.correlatedWithMeasures||(R.correlatedWithMeasures=[]),L.correlatedWithMeasures.push({otherColumn:R.name,r:$}),R.correlatedWithMeasures.push({otherColumn:L.name,r:$})}}for(let{c:m}of y)m.correlatedWithMeasures&&(m.correlatedWithMeasures.sort((T,O)=>Math.abs(O.r)-Math.abs(T.r)||(T.otherColumn<O.otherColumn?-1:1)),m.correlatedWithMeasures.length=Math.min(m.correlatedWithMeasures.length,S));for(let m=0;m<this._cols.length;m++){let T=a[m];if(!T||T.size===0)continue;let O=[];for(let D=0;D<this._cols.length;D++){if(D===m)continue;let v=a[D];if(!v||v.size===0)continue;let k=0;for(let P of T)v.has(P)&&k++;let F=Math.round(k/T.size*100);F>0&&O.push({otherColumn:this._cols[D].name,percentShared:F})}O.length>0&&(this._cols[m].sharedValueRatioWithOthers=O)}let C=50,g=[];for(let m=0;m<this._cols.length;m++){let T=a[m];T&&T.size>=2&&T.size<=C&&g.push(m)}if(g.length>=2){let m=new Map,T=(D,v)=>D+":"+v;for(let D=0;D<g.length;D++)for(let v=D+1;v<g.length;v++)m.set(T(g[D],g[v]),new Map);for(let D of this._rows)for(let v=0;v<g.length;v++){let k=this.STR(D[g[v]])+"";for(let F=v+1;F<g.length;F++){let P=""+this.STR(D[g[F]]),E=m.get(T(g[v],g[F])),G=k+""+P;E.set(G,(E.get(G)??0)+1)}}let O=new Map;for(let D=0;D<g.length;D++)for(let v=D+1;v<g.length;v++){let k=g[D],F=g[v],P=a[k].size,E=a[F].size,G=m.get(T(k,F)),V=G.size,I=0;for(let R of G.values())(I===0||R<I)&&(I=R);let N=Math.round(V/(P*E)*100),K=V===P,L=V===E;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[F].name,fillPct:N,determinesOther:K,minCellCount:I,distinctCombinations:V}),(this._cols[F].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:N,determinesOther:L,minCellCount:I,distinctCombinations:V}),K&&P>E){let R=O.get(k);(!R||E<R.card)&&O.set(k,{name:this._cols[F].name,card:E,ratio:E/P})}if(L&&E>P){let R=O.get(F);(!R||P<R.card)&&O.set(F,{name:this._cols[k].name,card:P,ratio:P/E})}}for(let[D,v]of O)this._cols[D].primaryParentColumn=v.name,this._cols[D].nestingRatio=Math.round(v.ratio*100)/100}let w=6,b=this._rows.length;for(let m=0;m<this._cols.length;m++){let T=this._cols[m];if(T.isMeasure||T.primaryParentColumn)continue;let O=T.distinctCount??0;if(O<=C||b>0&&O>=b)continue;let D=[];for(let v=0;v<this._cols.length;v++){if(v===m)continue;let k=this._cols[v];if(k.isMeasure)continue;let F=k.distinctCount??0;F<2||F>=O||D.push(v)}D.sort((v,k)=>(this._cols[v].distinctCount??0)-(this._cols[k].distinctCount??0));for(let v of D.slice(0,w)){let k=new Map,F=!0;for(let E of this._rows){let G=this.STR(E[m])+"",V=this.STR(E[v])+"",I=k.get(G);if(I===void 0)k.set(G,V);else if(I!==V){F=!1;break}}if(!F)continue;let P=this._cols[v].distinctCount??0;T.primaryParentColumn=this._cols[v].name,T.nestingRatio=Math.round(P/O*100)/100;break}}let _=.01,M=.05,W=.95,z=8,X=8,Q=6,ue=500,U=[];for(let m=0;m<this._cols.length&&U.length<X;m++){let T=this._cols[m].dataType;(T==="Double"||T==="Integer"||T==="Decimal")&&U.push(m)}if(U.length>=3&&this._rows.length>=z){let m=Math.min(this._rows.length,ue),T=U.map(P=>{let E=[];for(let I=0;I<m;I++){let N=this._rows[I][P],K=typeof N=="number"?N:parseFloat(String(N).replace(/,/g,""));if(N==null||N===""||!isFinite(K))return null;E.push(K)}let G=E[0],V=!1;for(let I of E)if(I!==G){V=!0;break}return V?E:null}),O=U.map((P,E)=>E).filter(P=>T[P]!==null),D=P=>{let E=P.slice().sort((V,I)=>V-I),G=E.length>>1;return E.length%2?E[G]:(E[G-1]+E[G])/2},v=null,k=[],F=P=>{if(k.length>=3){let E=k.map(N=>T[N]),G=E[0].length,V=new Array(G);for(let N=0;N<G;N++){let K=0;for(let L of E)K+=L[N];V[N]=K}let I=D(V);if(I>0){let N=0;for(let L of V)Math.abs(L-I)<=I*_&&N++;let K=N/G;if(K>=W){let L=1;for(let R of E){let $=D(R)/I;$<L&&(L=$)}L>=M&&(!v||k.length>v.cols.length)&&(v={cols:k.slice(),total:I,matched:K})}}}if(!(k.length>=Q))for(let E=P;E<O.length;E++)k.push(O[E]),F(E+1),k.pop()};if(F(0),v){let P=v,G={columns:P.cols.map(V=>this._cols[U[V]].name),total:Math.round(P.total*1e3)/1e3,matchedPct:Math.round(P.matched*100)/100};for(let V of P.cols)this._cols[U[V]].constantSumGroup=G}}return this.applyTwoSetPairing(n,a),this.applyScoreSeparation(l,o),this.applySeriesCompleteness(r,n,a),this.applyMeasurePersistence(n,a),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,n){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=rn({rows:this._rows,columns:this._cols.map((r,s)=>{let a=n[s];return{name:r.name,values:a,distinct:a?a.size:r.distinctCount??0,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Ie(r.name),temporalTextPattern:r.temporalTextPattern}}),text:r=>this.STR(r),locale:e});i&&(this._cols[i.key].twoSetPairing=i.pairing,this._cols[i.discriminator].twoSetPairing=i.pairing)}applyScoreSeparation(e,n){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=sn({rows:this._rows,columns:this._cols.map((r,s)=>({name:r.name,dataType:r.dataType,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Ie(r.name),isBinaryFlag:!!r.isBinaryFlag,distinct:e[s]??0,twoValues:n[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,n,i){for(let u of this._cols)u.seriesCompleteness!==void 0&&delete u.seriesCompleteness;let r=this._cols.map((u,c)=>({c:u,i:c})).filter(({c:u})=>u.isTemporal&&!u.isMeasure&&u.temporalCadence&&u.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=this.seriesKeyIndex(n,i);if(s<0)return;let a=this._cols[s],l=this._rows.map(u=>this.STR(u[s])),o=e>=20&&(a.dataType!=="String"||Array.isArray(a.safeDistinctValues));for(let{c:u,i:c}of r){let f=tn({periods:this._rows.map(d=>this.STR(d[c])),series:l,seriesColumn:a.name,pattern:u.temporalTextPattern,locale:n,includeDates:e>=20,includeNames:o});f&&(u.seriesCompleteness=f)}}seriesKeyIndex(e,n){let i=[],r=[];this._cols.forEach((a,l)=>{let o=n[l];o&&(i.push(l),r.push({name:a.name,dataType:a.dataType,isMeasure:!!a.isMeasure,isTemporal:!!a.isTemporal,isDatePart:!!a.isDatePart,isReassembledDate:!!a.isReassembledDate,isBinaryFlag:!!a.isBinaryFlag,geoKind:a.geoKind,identifierNamed:Ie(a.name),values:o,rows:this._rows.length,locale:e}))});let s=en(r);return s<0?-1:i[s]}applyMeasurePersistence(e,n){for(let o of this._cols)o.persistence!==void 0&&delete o.persistence;let i=[];if(this._cols.forEach((o,u)=>{o.isMeasure&&(o.dataType==="Integer"||o.dataType==="Decimal"||o.dataType==="Double")&&i.push(u)}),i.length===0||this._rows.length<Re)return;let r=-1,s=[];for(let o=0;o<this._cols.length&&r<0;o++){let u=this._cols[o];if(!u.isTemporal||u.isMeasure||u.isDatePart)continue;let c=this._rows.map(f=>j(this.STR(f[o]),u.temporalTextPattern,e)?.ms??null);new Set(c.filter(f=>f!==null)).size<Re||(r=o,s=c)}if(r<0)return;let a=this.seriesKeyIndex(e,n),l=a>=0?this._rows.map(o=>this.STR(o[a])):void 0;for(let o of i){let u=this._rows.map(f=>{let d=f[o];if(d==null||d==="")return null;let h=typeof d=="number"?d:parseFloat(String(d).replace(/,/g,""));return Number.isFinite(h)?h:null}),c=He({stamps:s,series:l,values:u});c&&(this._cols[o].persistence={timeColumn:this._cols[r].name,...a>=0?{seriesColumn:this._cols[a].name}:{},...c})}}updateColumnStats20(e,n,i,r,s,a,l,o,u,c,f,d){if(e>=20){let h=[...n].sort((S,p)=>S-p),x=Math.floor(h.length/2);if(i>0&&r!=null?s.avgValue=s.dataType=="Integer"?Math.round(r/i):r/i:s.avgValue=null,i>0&&(s.avgLength=a/i),this._rows.length>0){let S=p=>{let y=p instanceof Date?p:typeof p=="string"?Ee(p)??new Date(p):new Date(p),C=this.wholeDayIso(y);return C?C+"T00:00:00.000Z":isNaN(y.getTime())?p:y.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!o?s.lowValue=o:s.lowValue=S(o),s.dataType!="DateTime"||l||!u?s.highValue=u:s.highValue=S(u),s.medianValue=h.length===0?null:h.length%2===0?s.dataType=="Integer"?Math.round((h[x-1]+h[x])/2):(h[x-1]+h[x])/2:h[x],s.numericPrecision=c}if(h.length>0){let S=s.avgValue??0,p=h.length,y=0,C=0;for(let b of h){let _=b-S;y+=_*_,C+=_*_*_}let g=y/p,w=Math.sqrt(g);s.skewness=g===0?0:C/p/(w*w*w),s.stdDev=Math.sqrt(g)}r!==null&&(s.sum=r);let A=Array.from(f.entries()).sort((S,p)=>p[1]-S[1]);if(s.topCategories=A.slice(0,10).map(S=>S[1]),!s.isMeasure&&A.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=A.slice(0,5).map(S=>S[0])),e>=20)){let S=A.map(y=>y[0]),p=pe(S,d);if(p!==null)s.ordinalPattern=p.pattern,s.orderedDomain=p.orderedDomain;else if(s.dataType==="String"){let y=gt(S);y!==null&&(s.safeDistinctValues=y)}}if(h.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let S=p=>h[Math.floor((h.length-1)*p)];s.quantiles={p05:S(.05),p25:S(.25),p75:S(.75),p95:S(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&f.size>0){let h=Array.from(f.entries()).sort((S,p)=>p[1]-S[1]).map(S=>S[0]);s.formatSignature=be(h);let x=i>0?a/i:void 0,A=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!A.test(s.formatSignature)&&(x===void 0||x>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&f.size>0){let h=Array.from(f.entries()).sort((A,S)=>S[1]-A[1]),x=At(h.map(A=>A[0]),s.name,d);if(x!==null&&(s.geoKind=x.geoKind,s.geoMatchPct=x.geoMatchPct,x.geoAmbiguous&&(s.geoAmbiguous=!0),x.geoKind.indexOf("country")===0)){let A=yt(h);A&&(s.dominantGeoRegion=A.dominantGeoRegion,s.dominantGeoRegionPct=A.dominantGeoRegionPct,s.geoRegionCount=A.regionCount,A.middleEastPct>0&&(s.middleEastPct=A.middleEastPct))}}}updateColumnStats10(e,n,i,r,s,a,l){let o=this._rows.length-i;e>=10&&(n.blankCount=o),n.distinctCount=r.size+(o!=0?1:0),n.valueNature="Categorical",i>0&&(n.dataType==="Integer"||n.dataType==="Decimal"?n.valueNature=cn({dataType:n.dataType,isMeasure:!!n.isMeasure,name:n.name,distinct:r.size,nonblank:i,prec:s,maxval:a,minval:l}):n.dataType==="DateTime"&&(n.valueNature=n.dateWithTime?"Continuous":"Ordinal"))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((i,r)=>{i.isMeasure||e.push(r)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let n=new Set;for(let i of this._rows)n.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=n.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=a=>Qe(a,{camel:!0}),n=-1,i=-1,r=-1;if(this._cols.forEach((a,l)=>{let o=e(a.name),u=a.dataType==="Integer"||a.dataType==="Decimal";u&&n<0&&o.some(c=>c==="lat"||c==="latitude")?n=l:u&&i<0&&o.some(c=>c==="lon"||c==="lng"||c==="long"||c==="longitude")&&(i=l),r<0&&!a.isMeasure&&typeof a.geoKind=="string"&&a.geoKind.indexOf("country")===0&&(r=l)}),n<0||i<0){let a=(u,c)=>{let f=0;for(let d of this._rows){let h=d[u];if(h==null||h==="")continue;let x=Number(h);if(!Number.isFinite(x)||x<-c||x>c)return!1;f++}return f>0},l=-1,o=-1;if(this._cols.forEach((u,c)=>{if(!(u.dataType==="Integer"||u.dataType==="Decimal"))return;let f=e(u.name),d=f.some(h=>h==="lat"||h==="latitude")?"lat":f.some(h=>h==="lon"||h==="lng"||h==="long"||h==="longitude")?"lon":Nt(f);d==="lat"&&l<0&&a(c,90)?l=c:d==="lon"&&o<0&&a(c,180)&&(o=c)}),l<0||o<0)return null;n=l,i=o}this._geoExtentLatIdx=n;let s=[];for(let a of this._rows){let l=a[n],o=a[i],u=l==null||l===""?null:Number(l),c=o==null||o===""?null:Number(o);s.push({lat:u,lon:c,country:r>=0&&he(this.STR(a[r]))?this.STR(a[r]):null})}return this._geoExtent=ht(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;_geoExtentLatIdx=-1;obfuscateString(e){return jt(e,ot)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(n=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=n[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=n[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=n[r]);return i})}async getCSVAsync(e){let n=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,a=this.wallClockColumnIndexes();for(let o of this._rows){let u={};for(let c=0;c<this._cols.length;c++){let f=this._cols[c],d=o[c];if(this.STR(d)!=""){if(e&&f.dataType=="String")if(s.has(d))d=s.get(d);else{let h=this.obfuscateString(d);s.set(d,h),d=h}else if(f.dataType=="DateTime"&&!f.dateWithTime){let h=d instanceof Date?d:typeof d=="string"?Ee(d)??new Date(d):new Date(d);d=(this.wholeDayIso(h)??h.toISOString().slice(0,10))+"T00:00:00.000Z"}else a.has(c)&&d instanceof Date&&(d=fe(d));r-=this.STR(d).length}else d=null;u[c]=d,--r}if(n.push(u),--i,i<=0||r<=0)break}return await on.unparse(n,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return on.unparse([this._cols.map((n,i)=>{if(this.emitLegacyAggAliases&&n.hostName)return this.STR(n.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:n.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(n=>n==null?null:this.STR(n)),this._englishAliases=new Map}setGenerationColumns(e){let n=(e??[]).filter(r=>!!r&&typeof r.n=="string"&&r.n!==""&&typeof r.q=="string"&&r.q!=="").map(r=>({n:r.n,q:r.q})),i=JSON.stringify(n);i!==this._generationColumnsSig&&(this._generationColumns=n,this._generationColumnsSig=i,this._englishAliases=new Map)}aliasesForCode(e){let n=Ve(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())n.push({name:i.name,alias:i.alias,reason:i.reason});return n}armAliasesForCode(e){return this.emitLegacyAggAliases=Ve(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let n of this.liveEnglishAliases().values())e.push({name:n.name,alias:n.alias,reason:n.reason});return e}legacyAliases(){let e=[];for(let n of this._cols)n&&n.hostName&&n.hostName!==n.name&&e.push({name:this.STR(n.name),alias:this.STR(n.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let n=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return n;let i=String(e),r=new Set;for(let l of this._cols)l&&(r.add(this.STR(l.name)),l.hostName&&r.add(this.STR(l.hostName)));let s=new Map,a=new Set;for(let l=0;l<this._cols.length;l++){if(!this._cols[l])continue;let o=this._hostQueryNames[l],u=Wt(o,this._cols[l].name,this._cols[l].dataType)?[]:zt(o),c=this.STR(this._cols[l].name),f=[];if(o){for(let h of this._generationColumns)if(h.q===o)for(let x of[h.n,Ge(h.n)])x&&x!==c&&!u.includes(x)&&!f.includes(x)&&f.push(x)}let d=[...u,...f].filter(h=>!r.has(h)&&oe(i,h));d.length===1&&(s.set(d[0],[...s.get(d[0])??[],l]),f.includes(d[0])&&a.add(d[0]))}for(let[l,o]of s){if(o.length!==1)continue;let u=this.STR(this._cols[o[0]].name);n.set(o[0],{name:u,alias:l,headerName:!oe(i,u),reason:a.has(l)?"stored-query-name":"english-implicit-agg"})}return n}liveEnglishAliases(){let e=new Map;for(let[n,i]of this._englishAliases){let r=this._cols?this._cols[n]:null;r&&this.STR(r.name)===i.name&&e.set(n,i)}return e}addRow(e,n){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=st(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(Si(e)),this._inferredMeasureFlags=null,this._origIndices.push(n??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}invalidateStats(){this._computedStatsForLevel=null,this._geoExtentComputed=!1,this._geoExtent=null,this._geoExtentLatIdx=-1}reset(){this._inferredMeasureFlags=null,this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map,this._generationColumns=[],this._generationColumnsSig="[]"}setColumns(e){if(this._inferredMeasureFlags=null,this._cols=e,!e||e.length===0)return;let n=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=Ge(r);!s||s===r||n.has(s)||(n.delete(r),n.add(s),i.hostName=r,i.name=s)}}};export{mn as a,fn as b,wi as c,Mi as d,Tt as e,It as f,Tn as g,vn as h,Nt as i,Nn as j,En as k,kn as l,Dn as m,Me as n,Gn as o,Ge as p,Ve as q,zt as r,Bt as s,Un as t,Vt as u,Kt as v,Oi as w,Pi as x,Li as y,jn as z,Xn as A,qn as B,Ut as C,oe as D,lr as E,Vi as F,ur as G,cr as H,j as I,Zt as J,Mr as K,Tr as L,vr as M,kr as N,en as O,tn as P,ts as Q,Ie as R,un as S,hi as T,yi as U,bi as V,cn as W,an as X,Si as Y,ln as Z};
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{R as I,Z as A,f as R}from"./chunk-QAGRGHJI.mjs";import{a as h,c as x,d as E,e as L}from"./chunk-TZ74QIKA.mjs";import{u as C}from"./chunk-CZJ7M6A5.mjs";import M from"papaparse";var k=500,P=/^[+-]?\d{1,15}$/,v=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,N=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function O(e,o=".",n=!1){if(n)return"DateTime";let r=0,s=0,i=0,l=0;for(let c of e){if(c==null)continue;if(typeof c=="number"){l++,s++,Number.isInteger(c)&&r++;continue}if(c instanceof Date){l++,i++;continue}if(typeof c=="boolean"){l++;continue}let m=String(c).trim();if(m!==""){if(l++,P.test(h(m))){r++,s++;continue}if(L(m,o)){s++;continue}if((v.test(m)||N.test(m))&&!isNaN(Date.parse(m))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":s===l?"Decimal":"String"}function _(e,o,n=".",r=null){if(e==null)return null;if(typeof e=="number")return o==="String"?String(e):e;if(e instanceof Date)return o==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let s=String(e).trim();if(s==="")return null;switch(o){case"Integer":{let i=h(s);return P.test(i)?parseInt(i,10):null}case"Decimal":return E(s,n);case"DateTime":return r?r.read(s):C(s);default:return s}}function $(e){let o=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(o)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(o)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(o)?"DateTime":(/^(bit|bool|boolean)$/.test(o),"String")}function*q(e,o){for(let n of e)yield n?.[o]}function g(e,o,n){if(e.length===0)throw new Error("ingest: no columns were resolved from the source. Supply column descriptors, or use a source shape that carries them (grid/table/objects/sql).");let r=e.length,s=e.map((t,a)=>o.slice(0,k).map(u=>u?.[a])),i=s.map(t=>x(t,n.locale)),l=e.map((t,a)=>t.dataType===void 0||t.dataType==="DateTime"?R(q(o,a),{locale:n.locale??"en"}):null),c=e.map((t,a)=>t.dataType??O(s[a],i[a],l[a]!==null)),m=new Set((n.measures??[]).map(t=>t.toLowerCase())),b=new Set((n.dimensions??[]).map(t=>t.toLowerCase())),j=new Set((n.nonAdditive??[]).map(t=>t.toLowerCase())),D=e.map((t,a)=>{let u=t.name.toLowerCase(),f=t.isMeasure??((c[a]==="Integer"||c[a]==="Decimal")&&!I(t.name));m.has(u)&&(f=!0),b.has(u)&&(f=!1);let T={name:t.name,dataType:c[a],isMeasure:f};return f&&j.has(u)&&(T.discourageAggregationAcrossGroups=!0),T}),d=new A;d.dedupRows=n.dedup!==!1,d.deriveProvinces=n.deriveProvinces!==!1,d.setColumns(D),d.declareDimensions(D.filter((t,a)=>b.has(e[a].name.toLowerCase())));for(let t=0;t<o.length;t++){let a=o[t];d.addRow(Array.from({length:r},(u,f)=>_(a?.[f],c[f],i[f],l[f])),t)}let p=d.getColumnsWithStats(n.privacyLevel??"20",n.locale??"en"),S=new Map(p.map(t=>[t.name,t]));e.forEach(t=>{let a=S.get(t.name);a&&(t.format&&(a.modelFormat=t.format),t.description&&(a.modelDesc=t.description))});let y=t=>{let a=S.get(t);if(a)return[a];let u=t.toLowerCase();return p.filter(f=>f.name.toLowerCase()===u)};for(let[t,a]of Object.entries(n.formats??{}))for(let u of y(t))u.modelFormat=a;for(let[t,a]of Object.entries(n.descriptions??{}))for(let u of y(t))u.modelDesc=a;for(let t of n.groupBy??[])for(let a of y(t))a.isGrouping=!0;return{columns:p,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function w(e,o){return e.map(n=>Array.isArray(n)?n:o.map(r=>n[r]))}function F(e,o){let n=[],r=new Set,s=Math.min(e.length,Math.max(1,o));for(let i=0;i<s;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))r.has(c)||(r.add(c),n.push(c))}return n}function V(e){let o=String(e??"").replace(/^\uFEFF/,""),n=[],r=[],s=0;return M.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,c=o.slice(s,l);s=l,i.errors?.length&&r.push(...i.errors);let m=i.data;m.length===1&&m[0]===""&&c.replace(/[\r\n]/g,"")===""||n.push(m)}}),!n.length&&!r.length&&r.push(...M.parse(o,{skipEmptyLines:!0}).errors),{rows:n,errors:r}}function Y(e,o={}){switch(e.kind){case"csv":{let n=V(e.text);if(n.errors.length&&n.rows.length===0)throw new Error(`ingest: CSV parse failed - ${n.errors[0].message}`);let r=n.rows;if(r.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let s=r[0].map(i=>(i??"").trim());return g(s.map(i=>({name:i})),r.slice(1),o)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return g(e.header.map(n=>({name:(n??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let n=e.columns.map(r=>r.name);return g(e.columns,w(e.rows??[],n),o)}case"objects":{let n=e.rows??[],r=e.columns?.length?e.columns:F(n,o.columnScanLimit??k).map(s=>({name:s}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return g(r,w(n,r.map(s=>s.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let n=e.schema.map(r=>{let s=$(r.dataType);return{name:r.name,dataType:s,isMeasure:r.isMeasure,format:r.format,description:r.description}});return g(n,w(e.rows??[],n.map(r=>r.name)),o)}default:{let n=e;throw new Error(`ingest: unknown source kind '${n?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{$ as a,V as b,Y as c};
2
+ import{R as I,Z as A,f as R}from"./chunk-HD3RC2FT.mjs";import{a as h,c as x,d as E,e as L}from"./chunk-TZ74QIKA.mjs";import{u as C}from"./chunk-CZJ7M6A5.mjs";import M from"papaparse";var k=500,P=/^[+-]?\d{1,15}$/,v=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,N=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function O(e,o=".",n=!1){if(n)return"DateTime";let r=0,s=0,i=0,l=0;for(let c of e){if(c==null)continue;if(typeof c=="number"){l++,s++,Number.isInteger(c)&&r++;continue}if(c instanceof Date){l++,i++;continue}if(typeof c=="boolean"){l++;continue}let m=String(c).trim();if(m!==""){if(l++,P.test(h(m))){r++,s++;continue}if(L(m,o)){s++;continue}if((v.test(m)||N.test(m))&&!isNaN(Date.parse(m))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":s===l?"Decimal":"String"}function _(e,o,n=".",r=null){if(e==null)return null;if(typeof e=="number")return o==="String"?String(e):e;if(e instanceof Date)return o==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let s=String(e).trim();if(s==="")return null;switch(o){case"Integer":{let i=h(s);return P.test(i)?parseInt(i,10):null}case"Decimal":return E(s,n);case"DateTime":return r?r.read(s):C(s);default:return s}}function $(e){let o=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(o)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(o)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(o)?"DateTime":(/^(bit|bool|boolean)$/.test(o),"String")}function*q(e,o){for(let n of e)yield n?.[o]}function g(e,o,n){if(e.length===0)throw new Error("ingest: no columns were resolved from the source. Supply column descriptors, or use a source shape that carries them (grid/table/objects/sql).");let r=e.length,s=e.map((t,a)=>o.slice(0,k).map(u=>u?.[a])),i=s.map(t=>x(t,n.locale)),l=e.map((t,a)=>t.dataType===void 0||t.dataType==="DateTime"?R(q(o,a),{locale:n.locale??"en"}):null),c=e.map((t,a)=>t.dataType??O(s[a],i[a],l[a]!==null)),m=new Set((n.measures??[]).map(t=>t.toLowerCase())),b=new Set((n.dimensions??[]).map(t=>t.toLowerCase())),j=new Set((n.nonAdditive??[]).map(t=>t.toLowerCase())),D=e.map((t,a)=>{let u=t.name.toLowerCase(),f=t.isMeasure??((c[a]==="Integer"||c[a]==="Decimal")&&!I(t.name));m.has(u)&&(f=!0),b.has(u)&&(f=!1);let T={name:t.name,dataType:c[a],isMeasure:f};return f&&j.has(u)&&(T.discourageAggregationAcrossGroups=!0),T}),d=new A;d.dedupRows=n.dedup!==!1,d.deriveProvinces=n.deriveProvinces!==!1,d.setColumns(D),d.declareDimensions(D.filter((t,a)=>b.has(e[a].name.toLowerCase())));for(let t=0;t<o.length;t++){let a=o[t];d.addRow(Array.from({length:r},(u,f)=>_(a?.[f],c[f],i[f],l[f])),t)}let p=d.getColumnsWithStats(n.privacyLevel??"20",n.locale??"en"),S=new Map(p.map(t=>[t.name,t]));e.forEach(t=>{let a=S.get(t.name);a&&(t.format&&(a.modelFormat=t.format),t.description&&(a.modelDesc=t.description))});let y=t=>{let a=S.get(t);if(a)return[a];let u=t.toLowerCase();return p.filter(f=>f.name.toLowerCase()===u)};for(let[t,a]of Object.entries(n.formats??{}))for(let u of y(t))u.modelFormat=a;for(let[t,a]of Object.entries(n.descriptions??{}))for(let u of y(t))u.modelDesc=a;for(let t of n.groupBy??[])for(let a of y(t))a.isGrouping=!0;return{columns:p,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function w(e,o){return e.map(n=>Array.isArray(n)?n:o.map(r=>n[r]))}function F(e,o){let n=[],r=new Set,s=Math.min(e.length,Math.max(1,o));for(let i=0;i<s;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))r.has(c)||(r.add(c),n.push(c))}return n}function V(e){let o=String(e??"").replace(/^\uFEFF/,""),n=[],r=[],s=0;return M.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,c=o.slice(s,l);s=l,i.errors?.length&&r.push(...i.errors);let m=i.data;m.length===1&&m[0]===""&&c.replace(/[\r\n]/g,"")===""||n.push(m)}}),!n.length&&!r.length&&r.push(...M.parse(o,{skipEmptyLines:!0}).errors),{rows:n,errors:r}}function Y(e,o={}){switch(e.kind){case"csv":{let n=V(e.text);if(n.errors.length&&n.rows.length===0)throw new Error(`ingest: CSV parse failed - ${n.errors[0].message}`);let r=n.rows;if(r.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let s=r[0].map(i=>(i??"").trim());return g(s.map(i=>({name:i})),r.slice(1),o)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return g(e.header.map(n=>({name:(n??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let n=e.columns.map(r=>r.name);return g(e.columns,w(e.rows??[],n),o)}case"objects":{let n=e.rows??[],r=e.columns?.length?e.columns:F(n,o.columnScanLimit??k).map(s=>({name:s}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return g(r,w(n,r.map(s=>s.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let n=e.schema.map(r=>{let s=$(r.dataType);return{name:r.name,dataType:s,isMeasure:r.isMeasure,format:r.format,description:r.description}});return g(n,w(e.rows??[],n.map(r=>r.name)),o)}default:{let n=e;throw new Error(`ingest: unknown source kind '${n?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{$ as a,V as b,Y as c};
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a as Er,b as Tr}from"./chunk-HIVICMC5.mjs";import{a as Sr,b as M,c as Rr,d as D,e as E,f as xr,g as J,h as Z}from"./chunk-4J7WPYLM.mjs";import{a as hr,b as Cr,c as br}from"./chunk-755USHC4.mjs";import{A as Kn,B as Bn,C as jn,D as Yn,E as Qn,F as Xn,G as Jn,H as Zn,I as er,J as tr,K as nr,L as rr,M as or,N as ir,O as sr,P as ar,Q as lr,R as ur,S as cr,T as dr,U as mr,V as fr,W as pr,X as gr,Z as yr,a as gn,b as yn,c as hn,d as Cn,e as bn,g as _n,h as On,i as An,j as Pn,k as Ln,l as vn,m as Mn,n as In,o as Nn,p as Fn,q as Dn,r as kn,s as Gn,t as Wn,u as Vn,v as Un,w as Hn,x as qn,y as $n,z as zn}from"./chunk-QAGRGHJI.mjs";import{a as En}from"./chunk-U3H6UBOO.mjs";import{b as Tn,c as Sn,d as Rn,f as xn,g as wn}from"./chunk-TZ74QIKA.mjs";import{a as me,c as fe,e as dn,f as mn,g as fn,h as pn}from"./chunk-YDYFP2T4.mjs";import{A as Q,B as en,C as tn,D as de,E as I,F as nn,G as rn,H as on,I as U,J as sn,K as an,L as ln,M as un,N as X,O as cn,a as v,b as G,c as j,d as W,j as V,k as Vt,l as Ut,m as Ht,n as qt,o as $t,q as zt,r as Kt,s as Y,t as Bt,u as jt,v as Yt,w as Qt,x as Xt,y as Jt,z as Zt}from"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import{a as Tt,b as St,c as Rt,d as xt,e as wt,f as _t,g as Ot,h as At,i as Pt,j as Lt,k as vt,l as Mt,m as kt,n as Gt,o as Wt}from"./chunk-3ZAS32F5.mjs";import{b as It,c as Nt,d as Ft,e as Dt}from"./chunk-5HI6TVMM.mjs";import{A as yt,B as ht,C as Ct,D as bt,E as Et,a as Ke,b as Be,c as je,d as Ye,e as Qe,f as Xe,g as Je,h as Ze,i as et,j as tt,k as nt,l as rt,m as ot,n as it,o as st,q as B,r as at,s as lt,t as ut,u as ct,v as dt,w as mt,x as ft,y as pt,z as gt}from"./chunk-CZJ7M6A5.mjs";import{a as Ve,b as Ue,c as He,d as qe,e as $e,f as K,g as ze}from"./chunk-WC4JINEZ.mjs";var ee=2,ye=400;function ne(e){return!!V(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=W(String(n));if(!G(o)&&!t.has(o)&&(t.add(o),t.size>=ye))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||re(e)<95)return!1;let n=t.filter(a=>ne(a)&&!I(a)).length,o=t.filter(a=>!ne(a)&&!!I(a)).length;return n>=1&&n>=o}function pe(e,t){if(!I(e))return!1;let n=V(e);return n?t==="world"?!0:de.has(n):!1}function re(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)ne(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){return I(e)?!0:Y()?Q(e).status!=="unmatched"||Q(e.trim().replace(/\s+/g,"-")).status!=="unmatched":!1}function H(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)oe(o)&&n++;return Math.round(n/t.length*1e3)/10}function se(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!G(W(o))&&!t.has(o)&&(t.add(o),t.size>=ye))break}return Array.from(t)}function ie(e){let t=se(e);if(t.length===0)return 0;let n=0;for(let o of t)U(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function ge(e,t){return fe(t,me)?!0:se(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function wr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)X(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function te(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function _r(e,t){let n=0;for(let o of se(e))t(o)&&n++;return n}function Or(e,t,n,o,a){let u=[],l=[],i={},C={},y=new Set(e),h=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&y.has(d)&&(i[s]=d)}let f=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&f.has(d)&&(i[s]=d)}let p=n?.zip;if(p&&y.has(p)){let s=h(p),d=ie(s);d<95?l.push(`zip=${p} (only ${d}% of values read as ZIPs)`):ge(s,p)?i.zip=p:l.push(`zip=${p} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&y.has(c)){let s=h(c),d=F(s);d.length>0&&d.every(S=>pe(S,o))?l.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(l.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):H(s)<95?l.push(`state=${c} (only ${H(s)}% of values are states/provinces)`):i.state=c}let g=new Set(Object.values(i).filter(Boolean)),b=e.filter(s=>!g.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of b){let S=h(d);if(N(S))continue;let O=H(S);if(O<95)continue;let z=te(S,oe),We=te(S,ce=>oe(ce)&&!pe(ce,o));z<ee&&We<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,g.add(s.name),u.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of b){if(g.has(s))continue;let d=h(s),S=ie(d);if(!(S<95)&&ge(d,s)&&!(_r(d,O=>U(O).length>0)<ee)){i.zip=s,g.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(h(T))){let s=null;for(let d of b){if(g.has(d)||!N(h(d)))continue;let S=re(h(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${re(h(T))}% of values are country identifiers; using ${s.name} instead)`),C.country=T),i.country=s.name,g.add(s.name),u.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of b){if(g.has(d))continue;let S=h(d),O=wr(S,o);O<j||te(S,z=>X(z,o))<ee||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let P=i.country?h(i.country):[],R=!!i.country&&N(P),L=R?new Set(P.map(s=>V(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&L>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&l.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&l.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:u,refused:l,...Object.keys(C).length?{labelFallback:C}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ae=Object.freeze({jaar:r("year","nl"),kwartaal:r("quarter","nl"),maand:r("month","nl"),dag:r("day","nl","sv","da","nb"),jahr:r("year","de"),quartal:r("quarter","de"),monat:r("month","de"),tag:r("day","de"),ann\u00E9e:r("year","fr"),mois:r("month","fr"),jour:r("day","fr"),trimestre:r("quarter","fr","es","pt","it"),a\u00F1o:r("year","es"),mes:r("month","es"),d\u00EDa:r("day","es"),ano:r("year","pt"),m\u00EAs:r("month","pt"),dia:r("day","pt"),anno:r("year","it"),mese:r("month","it"),giorno:r("day","it"),\u0433\u043E\u0434:r("year","ru"),\u043C\u0435\u0441\u044F\u0446:r("month","ru"),\u0440\u0456\u043A:r("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:r("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:r("quarter","ru","uk"),\u0434\u0435\u043D\u044C:r("day","ru","uk"),rok:r("year","pl","cs","sk"),kwarta\u0142:r("quarter","pl"),miesi\u0105c:r("month","pl"),dzie\u0144:r("day","pl"),\u010Dtvrtlet\u00ED:r("quarter","cs"),m\u011Bs\u00EDc:r("month","cs"),den:r("day","cs"),\u0161tvr\u0165rok:r("quarter","sk"),mesiac:r("month","sk"),de\u0148:r("day","sk"),\u00E5r:r("year","sv","da","nb"),kvartal:r("quarter","sv","da","nb"),m\u00E5nad:r("month","sv"),m\u00E5ned:r("month","da","nb"),vuosi:r("year","fi"),vuosinelj\u00E4nnes:r("quarter","fi"),kuukausi:r("month","fi"),p\u00E4iv\u00E4:r("day","fi"),\u00E9v:r("year","hu"),negyed\u00E9v:r("quarter","hu"),h\u00F3nap:r("month","hu"),nap:r("day","hu"),y\u0131l:r("year","tr"),\u00E7eyrek:r("quarter","tr"),ay:r("month","tr"),g\u00FCn:r("day","tr"),\u03AD\u03C4\u03BF\u03C2:r("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:r("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:r("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:r("day","el"),an:r("year","ro"),trimestru:r("quarter","ro"),lun\u0103:r("month","ro"),zi:r("day","ro"),godina:r("year","hr"),tromjese\u010Dje:r("quarter","hr"),mjesec:r("month","hr"),dan:r("day","hr"),\u5E74:r("year","ja","zh"),\u56DB\u534A\u671F:r("quarter","ja"),\u5B63\u5EA6:r("quarter","zh"),\u6708:r("month","ja","zh"),\u65E5:r("day","ja","zh"),\uC5F0\uB3C4:r("year","ko"),\uBD84\uAE30:r("quarter","ko"),\uC6D4:r("month","ko"),\uC77C:r("day","ko"),tahun:r("year","id"),kuartal:r("quarter","id"),triwulan:r("quarter","id"),bulan:r("month","id"),hari:r("day","id"),n\u0103m:r("year","vi"),qu\u00FD:r("quarter","vi"),th\u00E1ng:r("month","vi"),ng\u00E0y:r("day","vi"),\u0E1B\u0E35:r("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:r("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:r("month","th"),\u0E27\u0E31\u0E19:r("day","th"),\u0627\u0644\u0633\u0646\u0629:r("year","ar"),\u0633\u0646\u0629:r("year","ar"),\u0627\u0644\u0639\u0627\u0645:r("year","ar"),\u0639\u0627\u0645:r("year","ar"),\u0627\u0644\u0631\u0628\u0639:r("quarter","ar"),\u0631\u0628\u0639:r("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":r("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:r("month","ar"),\u0634\u0647\u0631:r("month","ar"),\u0627\u0644\u064A\u0648\u0645:r("day","ar"),\u064A\u0648\u0645:r("day","ar"),\u05E9\u05E0\u05D4:r("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:r("quarter","he"),\u05D7\u05D5\u05D3\u05E9:r("month","he"),\u05D9\u05D5\u05DD:r("day","he"),\u0935\u0930\u094D\u0937:r("year","hi"),\u0938\u093E\u0932:r("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:r("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:r("month","hi"),\u092E\u093E\u0939:r("month","hi"),\u0926\u093F\u0928:r("day","hi"),\u0633\u0627\u0644:r("year","fa"),\u0645\u0627\u0647:r("month","fa"),\u0631\u0648\u0632:r("day","fa")}),Ar=Object.freeze(Array.from(new Set(Object.values(ae).flatMap(e=>e.langs)))),he=Object.freeze(["fa","ar","he","th"]),Ce=1900,be=2100;function Pr(e,t){let n=[],o=K(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function Lr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of Pr(n,t)){let a=ae[o];if(a&&a.langs.includes(t))return a.part}return null}function vr(e,t){return he.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=Ce&&t<=be:!0}function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Mr=/\b(?:columns|cols|column)\b/i;function q(e,t){let n=Math.max(0,t-240),o=e.slice(n,t),a=o.lastIndexOf(";");return a>=0&&(o=o.slice(a+1)),Mr.test(o)}function Te(e,t){return Se(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Se(e,t,n){let o=Ee(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${o}\2`,"g"),u=new RegExp(String.raw`\.name\s*===?\s*(['"])${o}\1`,"g"),l=0,i;for(;(i=u.exec(e))!==null;)q(e,i.index)&&l++;let C=0;for(;(i=a.exec(e))!==null;){let y=i.index+i[0].lastIndexOf(".name");if(!q(e,y))continue;C++;let h=Ee(i[1]);if(!n(h))return!1}return C>0&&C===l}function Ir(e,t){return Se(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var Re=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function Nr(e,t){if(!e)return[];let n=new Set(t);for(let i of Re)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)q(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||Te(e,i)||l.push(i)}),l}function Fr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function xe(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function Dr(e,t,n){let o=xe(e,t);if(o===null||o<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,u=o>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let l=u.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=we(n);return i.length===0?l:l+" "+i.join(" ")}function we(e){if(!e||e.length===0)return[];let t=[],n=new Map,o=new Map;for(let u of e){let l=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(l!==""&&(n.has(l)||(t.push(l),n.set(l,0)),u.isDatePart===!0&&n.set(l,n.get(l)+1),u.isReassembledDate===!0&&!o.has(l))){let i=typeof u.sourceField=="string"?u.sourceField.trim():"",C=typeof u.name=="string"?u.name.trim():"",y=i!==""?i:C;y!==""&&o.set(l,y)}}let a=[];for(let u of t){let l=o.get(u),i=n.get(u)??0;!l||i===0||a.push(`'${l}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var m=e=>e==null?"":String(e),A=e=>e===!0,le=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},_e=e=>{let t=le(e);return t!==null&&t>0?t:null},kr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Oe(e,t){let n={};for(let[o,a]of kr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function Gr(e){return Array.isArray(e)?e.map(t=>({code:m(E(t,"code")),severity:m(E(t,"severity")),text:m(E(t,"text"))})).filter(t=>t.text!==""):[]}function Wr(e){let t=f=>E(e,f),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=Oe(e,"point"),l=Oe(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),C=t("isPollFinal"),y=_e(t("chartMinWidth")),h=_e(t("chartMinHeight"));return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:Gr(t("notices")),freemiumStatusCode:m(t("freemiumStatusCode")),code:m(t("code")),language:m(t("language")),version:Number(t("version")??0),codeSummary:m(t("codeSummary")),chartName:m(t("chartName")??t("chartType")),finalChartName:m(t("finalChartName")),warningMessage:m(t("warningMessage")),outputHash:m(t("outputHash")),validatorToken:m(t("validatorToken")),editCodeKey:m(t("editCodeKey")),signedLLMRequestID:m(t("signedLLMRequestID")),userReply:m(t("userReply")),userReplyOutcome:m(t("userReplyOutcome")),improvementSuggestion:m(t("improvementSuggestion")),geoColumn:m(t("geoColumn")),geoKind:m(t("geoKind")),geoPointCols:Object.keys(u).length?u:null,creditBalanceBefore:le(t("creditBalanceBefore")),creditCost:le(t("creditCost")),isServiceError:A(t("isServiceError")),isRateLimited:A(t("isRateLimited")),suppressSelectionGlyph:A(t("suppressSelectionGlyph")),isRefusal:A(t("isRefusal")),isVersionNotFound:A(t("isVersionNotFound")),isGenerationCancelled:A(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof C=="boolean"?{isPollFinal:C}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...y!==null?{chartMinWidth:y}:{},...h!==null?{chartMinHeight:h}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var Ae=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function Vr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=C=>E(u,C),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:Ae(l("rank")),score:Ae(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:A(l("isPreview")),alsoWorthALook:A(l("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:k(l("viaProjection")),viaProjectionKey:k(l("viaProjectionKey")),detailNote:k(l("detailNote"))}}).filter(u=>u.name):null,a=Array.isArray(n)?n.map(u=>({name:m(E(u,"chartTypeName")??E(u,"name")),reason:m(E(u,"reason")),reasonCode:m(E(u,"reasonCode")),isVeto:A(E(u,"isVeto"))})).filter(u=>u.name):[];return{errorMessage:m(E(e,"errorMessage")),errorCode:m(E(e,"errorCode")),charts:o,refused:a,noFitSummary:m(E(e,"noFitSummary"))}}function Ur(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var Pe=["working","analyze","generate","refine","review"];function Hr(e,t){let n=String(e??"").trim().toLowerCase();if(Pe.includes(n))return n;let o=String(t??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var qr="FREEMIUM_ATTEMPT_SPENT",$r="CLIENT_SECRET_MISMATCH",zr="FREEMIUM_COLUMN_CAP",Kr="OAUTH_TOKEN_EXPIRED",Br="OAUTH_SIGNED_OUT";function jr(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function Yr(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,o=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:o.licenseKey,licensee:o.licensee,secretKey:o.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function Qr(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function Xr(e){let t=0;for(let n of e){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>t&&(t=o)}return t}function Le(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,o=(e.codeVersion??0)>0?e.codeVersion:null,a=n??o??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function Jr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=Le({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),u=e.fetchArmedAtMs,l=t&&typeof u=="number"&&Number.isSafeInteger(u)&&u>0?u:void 0,i=e.fetchCutAtMs,C=t&&typeof i=="number"&&Number.isSafeInteger(i)&&i>0?i:void 0,y=t?Zr(e.fetchCause):"";return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{},...C!==void 0?{fetchCutAtMs:C}:{},...y?{fetchCause:y}:{}}}function Zr(e){if(typeof e!="string")return"";let t=e.replace(/[\u0000-\u001f\u007f]+/g," ").trim().slice(0,120);return/[\ud800-\udbff]$/.test(t)&&(t=t.slice(0,-1)),t.trimEnd()}function eo(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function to(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function no(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function ro(e,t,n){let o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...o(t)?{rowsWithheld:t}:{},...o(n)?{rowsFilteredOut:n}:{}}}var oo={fit:"Best fit",variety:"Something different"};function ve(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function io(e){let t=ve(e);return t?{qualifyOrder:t}:{}}function Me(e,t){return e!=null&&t!=null&&e!==t}function so(e,t){return e?Me(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var ao=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Ie(e){let t=String(e??"").trim().toLowerCase();return ao[t]??t}function Ne(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Ie(n.dataType)]);return t}function lo(e){return B(Ne(e))}var uo=2,co=3,mo=4,fo=64,po=8e3,go=6e4,yo=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),ho=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function Co(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function bo(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function Eo(){let e=new Set,t=new Set;return{firstDraw(n,o){if(!n)return!1;let a=`${n}|${o}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function To(e){return!!e&&!e.includes("|")&&!e.includes(",")}function ue(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function So(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=t.timeoutMs,C=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,y=f=>{try{t.onFailure?.(f)}catch{}},h=async(f,p,c,g)=>{let b;try{let T=await a.post(p,c,g,{timeoutMs:i});b=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){y({channel:f,stage:"post",status:null,error:T});return}(b<200||b>299)&&y({channel:f,stage:"status",status:b,error:null})};return{async sendClientMessage(f){let p,c,g;try{p=`${C()}${l}/LogClientMsg/?nocache=${u.now()}`,c=M(f),g=D(c,o)}catch(b){y({channel:"client-message",stage:"build",status:null,error:b});return}await h("client-message",p,c,{"Content-Type":"text/plain","X-Signature":g})},async countEvent(f,p,c){let g,b;try{g=`${C()}${l}/eventlog`,b=ue(f,t.clientVersion,p,c)}catch(T){y({channel:"event-count",stage:"build",status:null,error:T});return}await h("event-count",g,b,{"Content-Type":"text/plain"})}}}var Fe=2**31-1;function De(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function Ro(e){return typeof e=="number"&&e>0&&e<=Fe?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Fe} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function xo(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,o=t.credentials??"omit";return{async post(a,u,l,i){let C=i.timeoutMs,y=Ro(C);if(y)throw y;let h=new AbortController,f=!1,p=setTimeout(()=>{f=!0,h.abort(De(C))},C),c=()=>h.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let g=!1,b=()=>{g||(g=!0,clearTimeout(p),i.signal?.removeEventListener("abort",c))},T=_=>f?De(C):_,P;try{P=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:h.signal})}catch(_){throw b(),T(_)}let R=J(P),L=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...L,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{b()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){b(),_.close();return}_.enqueue(s.value)}catch(s){b(),_.error(T(s))}},cancel(_){return b(),x.cancel(_)}});return{status:R.status,...L,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var ke=300;function Ge(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var wo="/LLMChart/",_o="/LLMChart/qualify",Oo="/VisionReview/",Ao="/LLMChart/sample",Po="/RefundGenerate/",Lo=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",$=async e=>JSON.parse(await e.text());function vo(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function Mo(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,C=f=>t.nocache?t.nocache(f):String(u.now());async function y(f,p,c,g,b){let T=`${i()}${l}${p}?nocache=${C(f)}`,P={"Content-Type":"text/plain","X-Signature":D(c,o)},R=g.signal??void 0,L=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&Lo(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,P,R?{timeoutMs:g.timeoutMs,signal:R}:{timeoutMs:g.timeoutMs})}catch(w){return L(!1,w)}if(x.status<200||x.status>299){let w="";if(g.readErrorBody===!1)vo(x);else try{w=(await x.text()).slice(0,ke)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await b(x)}}catch(w){return L(!0,w)}}function h(f,p){if(!p||typeof p.timeoutMs!="number"||!Number.isFinite(p.timeoutMs)||p.timeoutMs<=0)throw new TypeError(`The ${f} call needs a positive deadline in milliseconds`);return p}return{async generate(f,p){let c=h("generate",p),g=c.onStage??void 0;return y("generate",wo,M(f),c,b=>Z(b,g))},async qualify(f,p){let c=h("qualify",p),g=c.route??_o;if(typeof g!="string"||!g.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return y("qualify",g,M(f),c,$)},async review(f,p){let c=h("review",p),g=JSON.stringify(f);if(typeof g!="string")throw new TypeError("The review wire did not serialize to JSON");return y("review",Oo,g,c,$)},async sample(f,p){let c=h("sample",p);return y("sample",Ao,M(f),c,$)},async refund(f,p,c){let g=h("refund",p);if(typeof f!="string"||f.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let b=Ge(c),T=b?{CorrelationID:f.trim(),Reason:b}:{CorrelationID:f.trim()};return y("refund",Po,JSON.stringify(T),g,$)}}}export{gn as ADMIN1_MATCH_PCT,yn as ADMIN1_MATCH_PCT_NAMED,j as CITY_ROLE_MATCH_PCT,Yt as CITY_TIE_RATIO,yo as CLIENT_EVENT_KINDS,$r as CLIENT_SECRET_MISMATCH,Je as COMPOUND_MIN_STEM,Tt as CYCLE_MEMBERS,Rt as CYCLE_WORDS,be as DATE_LEVEL_GREGORIAN_YEAR_MAX,Ce as DATE_LEVEL_GREGORIAN_YEAR_MIN,Ar as DATE_LEVEL_LANGUAGES,ae as DATE_LEVEL_NAMES,he as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Jn as DEFAULT_GAP_FACTOR,ut as DEFAULT_TEMPERATURE,ho as DRAW_REASONS,qr as FREEMIUM_ATTEMPT_SPENT,zr as FREEMIUM_COLUMN_CAP,at as GET_RANDOM,et as GLUED_STEM_MIN,nt as HANGUL_MIN_STEM,Re as HOST_SYNTHETIC_COLUMNS,ke as HTTP_BODY_START_CHARS,Kn as IDENTIFIER_HEAD_INITIAL,Bn as IDENTIFIER_UNFOLDED,zn as IDENTIFIER_WORDS,Ln as INTENSIVE_SUFFIX_TOKENS,Pn as INTENSIVE_WORD_TOKENS,yr as IndexedText,_n as LATITUDE_WORDS,On as LONGITUDE_WORDS,Nt as LOOSE_KEY_MIN_LENGTH,Dt as LooseIndex,Zn as MAX_RUN_BOUNDS,Br as OAUTH_SIGNED_OUT,Kr as OAUTH_TOKEN_EXPIRED,At as PERIOD_CODE_FORMS,Ot as PERIOD_CODE_MEMBERS,Pt as PERIOD_ORDINALS,Lt as PERIOD_UNFOLDED,Mn as POSITIONAL_SUFFIX_TOKENS,vn as POSITIONAL_WORD_TOKENS,Er as PREVIEW_OMITTED_FIELDS,Pe as PROGRESS_STAGE_IDS,oo as QUALIFY_ORDER_LABELS,Vt as REGION_FRAME_WINDOWS,v as ROLE_MATCH_PCT,nr as SERIES_COMPLETENESS_MAX_LISTED,rr as SERIES_COMPLETENESS_MIN_FILL,or as SERIES_KEY_MAX_DISTINCT,mo as SEV_ERROR,uo as SEV_INFO,fo as SEV_USER_PRESENTED,co as SEV_WARNING,B as SIMPLE_STRING_HASH,st as STR,ot as SUBSTRING_MIN,Ve as SUPPORTED_LANGUAGES,Ue as SUPPORTED_LANGUAGE_CODES,go as TELEMETRY_TIMEOUT_DEV_MS,po as TELEMETRY_TIMEOUT_MS,$e as VOCABULARY_LANGUAGE_CODES,qe as VOCABULARY_ONLY_LANGUAGES,St as YEAR_WORDS,Xt as admin1CodesForName,Y as admin1LookupRegistered,H as admin1MatchPct,Un as allowedAggregations,bt as anchorLocalWallClockDates,jr as answerIsRetryable,pn as buildGeoIsoColumn,ln as buildGeoPointColumns,Cn as buildProvinceIsoColumn,xt as calendarWordIn,eo as capabilityFields,cn as cityMatchPct,un as cityTagsFor,fr as classifyAdditivity,bo as classifyDraw,Vn as classifyForAggregation,pr as classifyNumericValueNature,dr as classifyTemporal,Bt as clearAdmin1LookupForTests,Dn as codeNeedsLegacyAggNames,Yn as codeReadsColumn,Qn as codeReadsColumnsByRoleOrPosition,Fn as collapseRepeatedAggPrefix,Xn as columnsTheCodeReads,An as coordinateAxisOfWords,jt as countryIso2,qt as countryRegion,Eo as createDrawLedger,Mo as createGenerateClient,So as createTelemetryClient,Yr as credentialFields,ro as dataCompletenessFields,Lr as dateLevelPart,vr as dateLevelYearAdmits,Et as datesAreTimeOfDayOnly,ht as datesCarryTimeOfDay,Tn as decimalSeparatorOf,Hn as defaultAggregation,Sn as detectDecimalSeparator,En as detectFormatSignature,dn as detectGeo,Wt as detectOrdinalDomain,cr as detectTextDatePattern,Co as drawLocation,M as encodePayload,hr as engineTypeForSqlType,kn as englishImplicitAggNames,ue as eventLogLine,Jr as fetchFields,xo as fetchTransport,Ke as foldName,Dr as freemiumColumnCapRefusal,xe as freemiumColumnsOverCap,we as freemiumDateHierarchyClauses,tt as gluedPrefixStems,Fr as guardColumnNames,Sr as gzipWireText,rt as hangulWordEndsWith,Nn as hasDefaultAggPrefix,Qe as hasUnsegmentedScript,mr as hostAggHint,zt as inMiddleEast,br as ingest,qn as isAggregationAllowed,G as isBlankLike,tn as isCityTableLoaded,q as isColumnContextRef,lt as isDeterministicRefusal,To as isEventLogCode,sn as isGeoPointAmbiguity,ur as isIdentifierName,fn as isJoinGeoKind,Zt as isKnownProvinceId,xr as isNdjsonContentType,kt as isOrdinalFriendlyName,Ft as isUsableLooseKey,Rr as keyedSigner,no as leafCardinalityField,pt as localMidnightDateColumns,ft as localMidnightToUtcDay,Ct as localWallClockDateColumns,_t as localizedCycleIn,jn as localizedIdentifierWordIn,wt as localizedYearWordIn,N as looksLikeCountryColumn,It as looseNameKey,it as matchNameToken,Xr as maxNonMeasureCardinality,bn as measureAdmin1Columns,tr as measureCadence,lr as measurePersistence,ar as measureSeriesCompleteness,D as messageSignature,Nr as missingHardColumnRefs,wn as monthLookupFor,je as nameLetterRuns,Wn as nameLooksIntensiveRate,Gn as nameLooksPositional,Te as nameProbeIsGuarded,Ir as nameProbeKeepsDrawing,Be as nameWords,nn as normalizeCountry,gt as normalizeLocalMidnightDates,xn as normalizeMonthKey,W as normalizePlaceName,on as normalizeZip5,so as offeredShortlistFor,Cr as parseCsvRows,ct as parseDateStable,Wr as parseGenerateResponse,Rn as parseNumberText,Vr as parseQualifyResponse,Ur as parseReviewVerdict,er as parseTemporalPoint,Tr as payloadPreview,Mt as periodCodeSeries,sr as pickSeriesColumn,Hr as progressStageOf,gr as promotesToMeasure,Jt as provinceIdForAdmin1Code,hn as provinceIdForRow,io as qualifyOrderField,ve as qualifyOrderOf,Z as readGenerateStream,Ye as readName,vt as readPeriodCode,E as readWireField,Ge as refundReasonCode,Kt as registerAdmin1Lookup,en as registerCityTable,Ht as registerIso3Regions,I as resolveAdmin1,Qt as resolveCityAdmin1,Le as resolveFetchVersion,an as resolveGeoPoint,ze as resolveLanguage,Or as resolvePointRoles,to as retryFields,Gt as safeDistinctValuesToShip,Ne as schemaIdentity,lo as schemaIdentityKey,Ie as schemaTypeFamily,ir as seriesKeyVerdict,$n as shareOfTotalIsHonest,Me as shortlistIsStale,In as stripHostAggPrefix,$t as summarizeCountryRegions,Ut as summarizeGeoExtent,He as supportedLanguage,mn as toGeoIso,Xe as unsegmentedRuns,yt as utcWallClock,Qr as viewportFields,K as vocabularyLanguage,dt as wholeDayFrame,mt as wholeDayIso,J as wireResponseFromFetch,Ze as wordEndsWith,ie as zipMatchPct,U as zipPrefixCandidates,rn as zipToPrefix3};
2
+ import{a as Sr,b as Rr}from"./chunk-HIVICMC5.mjs";import{a as xr,b as M,c as wr,d as k,e as E,f as _r,g as J,h as Z}from"./chunk-4J7WPYLM.mjs";import{a as br,b as Er,c as Tr}from"./chunk-UYV7NPZ3.mjs";import{A as jn,B as Qn,C as Yn,D as Xn,E as Jn,F as Zn,G as er,H as tr,I as nr,J as rr,K as or,L as ir,M as sr,N as ar,O as lr,P as ur,Q as cr,R as dr,S as fr,T as mr,U as pr,V as gr,W as yr,X as hr,Z as Cr,a as hn,b as Cn,c as bn,d as En,e as Tn,g as An,h as Ln,i as vn,j as Pn,k as Mn,l as In,m as Nn,n as Fn,o as kn,p as Dn,q as Gn,r as Un,s as Wn,t as Vn,u as qn,v as Hn,w as Kn,x as zn,y as $n,z as Bn}from"./chunk-HD3RC2FT.mjs";import{a as Sn}from"./chunk-U3H6UBOO.mjs";import{b as Rn,c as xn,d as wn,f as _n,g as On}from"./chunk-TZ74QIKA.mjs";import{a as fe,c as me,e as mn,f as pn,g as gn,h as yn}from"./chunk-YDYFP2T4.mjs";import{A as Y,B as nn,C as rn,D as de,E as I,F as on,G as sn,H as an,I as V,J as ln,K as un,L as cn,M as dn,N as X,O as fn,a as P,b as G,c as j,d as U,j as W,k as qt,l as Ht,m as Kt,n as zt,o as $t,q as Bt,r as jt,s as Q,t as Qt,u as Yt,v as Xt,w as Jt,x as Zt,y as en,z as tn}from"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import{a as Rt,b as xt,c as wt,d as _t,e as Ot,f as At,g as Lt,h as vt,i as Pt,j as Mt,k as It,l as Nt,m as Ut,n as Wt,o as Vt}from"./chunk-3ZAS32F5.mjs";import{b as Ft,c as kt,d as Dt,e as Gt}from"./chunk-5HI6TVMM.mjs";import{A as Ct,B as bt,C as Et,D as Tt,E as St,a as je,b as Qe,c as Ye,d as Xe,e as Je,f as Ze,g as et,h as tt,i as nt,j as rt,k as ot,l as it,m as st,n as at,o as lt,q as B,r as ut,s as ct,t as dt,u as ft,v as mt,w as pt,x as gt,y as yt,z as ht}from"./chunk-CZJ7M6A5.mjs";import{a as qe,b as He,c as Ke,d as ze,e as $e,f as $,g as Be}from"./chunk-WC4JINEZ.mjs";var ee=2,ye=400;function ne(e){return!!W(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let r=U(String(n));if(!G(r)&&!t.has(r)&&(t.add(r),t.size>=ye))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||re(e)<95)return!1;let n=t.filter(a=>ne(a)&&!I(a)).length,r=t.filter(a=>!ne(a)&&!!I(a)).length;return n>=1&&n>=r}function pe(e,t){if(!I(e))return!1;let n=W(e);return n?t==="world"?!0:de.has(n):!1}function re(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let r of t)ne(r)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){return I(e)?!0:Q()?Y(e).status!=="unmatched"||Y(e.trim().replace(/\s+/g,"-")).status!=="unmatched":!1}function q(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let r of t)oe(r)&&n++;return Math.round(n/t.length*1e3)/10}function se(e){let t=new Set;for(let n of e){if(n==null)continue;let r=String(n).trim();if(!G(U(r))&&!t.has(r)&&(t.add(r),t.size>=ye))break}return Array.from(t)}function ie(e){let t=se(e);if(t.length===0)return 0;let n=0;for(let r of t)V(r).length>0&&n++;return Math.round(n/t.length*1e3)/10}function ge(e,t){return me(t,fe)?!0:se(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function Or(e,t){let n=F(e);if(n.length===0)return 0;let r=0;for(let a of n)X(a,t)&&r++;return Math.round(r/n.length*1e3)/10}function te(e,t){let n=0;for(let r of F(e))t(r)&&n++;return n}function Ar(e,t){let n=0;for(let r of se(e))t(r)&&n++;return n}function Lr(e,t,n,r,a){let l=[],u=[],i={},C={},y=new Set(e),h=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&y.has(d)&&(i[s]=d)}let m=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&m.has(d)&&(i[s]=d)}let p=n?.zip;if(p&&y.has(p)){let s=h(p),d=ie(s);d<95?u.push(`zip=${p} (only ${d}% of values read as ZIPs)`):ge(s,p)?i.zip=p:u.push(`zip=${p} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&y.has(c)){let s=h(c),d=F(s);d.length>0&&d.every(S=>pe(S,r))?u.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(u.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):q(s)<95?u.push(`state=${c} (only ${q(s)}% of values are states/provinces)`):i.state=c}let g=new Set(Object.values(i).filter(Boolean)),b=e.filter(s=>!g.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of b){let S=h(d);if(N(S))continue;let O=q(S);if(O<95)continue;let z=te(S,oe),Ve=te(S,ce=>oe(ce)&&!pe(ce,r));z<ee&&Ve<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,g.add(s.name),l.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of b){if(g.has(s))continue;let d=h(s),S=ie(d);if(!(S<95)&&ge(d,s)&&!(Ar(d,O=>V(O).length>0)<ee)){i.zip=s,g.add(s),l.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(h(T))){let s=null;for(let d of b){if(g.has(d)||!N(h(d)))continue;let S=re(h(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(u.push(`country=${T} (only ${re(h(T))}% of values are country identifiers; using ${s.name} instead)`),C.country=T),i.country=s.name,g.add(s.name),l.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of b){if(g.has(d))continue;let S=h(d),O=Or(S,r);O<j||te(S,z=>X(z,r))<ee||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,l.push(`city=${s.name} (${s.pct}% known cities)`))}let L=i.country?h(i.country):[],R=!!i.country&&N(L),v=R?new Set(L.map(s=>W(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&v>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&u.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&u.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:l,refused:u,...Object.keys(C).length?{labelFallback:C}:{}}}var o=(e,...t)=>({part:e,langs:Object.freeze(t)}),ae=Object.freeze({jaar:o("year","nl"),kwartaal:o("quarter","nl"),maand:o("month","nl"),dag:o("day","nl","sv","da","nb"),jahr:o("year","de"),quartal:o("quarter","de"),monat:o("month","de"),tag:o("day","de"),ann\u00E9e:o("year","fr"),mois:o("month","fr"),jour:o("day","fr"),trimestre:o("quarter","fr","es","pt","it"),a\u00F1o:o("year","es"),mes:o("month","es"),d\u00EDa:o("day","es"),ano:o("year","pt"),m\u00EAs:o("month","pt"),dia:o("day","pt"),anno:o("year","it"),mese:o("month","it"),giorno:o("day","it"),\u0433\u043E\u0434:o("year","ru"),\u043C\u0435\u0441\u044F\u0446:o("month","ru"),\u0440\u0456\u043A:o("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:o("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:o("quarter","ru","uk"),\u0434\u0435\u043D\u044C:o("day","ru","uk"),rok:o("year","pl","cs","sk"),kwarta\u0142:o("quarter","pl"),miesi\u0105c:o("month","pl"),dzie\u0144:o("day","pl"),\u010Dtvrtlet\u00ED:o("quarter","cs"),m\u011Bs\u00EDc:o("month","cs"),den:o("day","cs"),\u0161tvr\u0165rok:o("quarter","sk"),mesiac:o("month","sk"),de\u0148:o("day","sk"),\u00E5r:o("year","sv","da","nb"),kvartal:o("quarter","sv","da","nb"),m\u00E5nad:o("month","sv"),m\u00E5ned:o("month","da","nb"),vuosi:o("year","fi"),vuosinelj\u00E4nnes:o("quarter","fi"),kuukausi:o("month","fi"),p\u00E4iv\u00E4:o("day","fi"),\u00E9v:o("year","hu"),negyed\u00E9v:o("quarter","hu"),h\u00F3nap:o("month","hu"),nap:o("day","hu"),y\u0131l:o("year","tr"),\u00E7eyrek:o("quarter","tr"),ay:o("month","tr"),g\u00FCn:o("day","tr"),\u03AD\u03C4\u03BF\u03C2:o("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:o("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:o("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:o("day","el"),an:o("year","ro"),trimestru:o("quarter","ro"),lun\u0103:o("month","ro"),zi:o("day","ro"),godina:o("year","hr"),tromjese\u010Dje:o("quarter","hr"),mjesec:o("month","hr"),dan:o("day","hr"),\u5E74:o("year","ja","zh"),\u56DB\u534A\u671F:o("quarter","ja"),\u5B63\u5EA6:o("quarter","zh"),\u6708:o("month","ja","zh"),\u65E5:o("day","ja","zh"),\uC5F0\uB3C4:o("year","ko"),\uBD84\uAE30:o("quarter","ko"),\uC6D4:o("month","ko"),\uC77C:o("day","ko"),tahun:o("year","id"),kuartal:o("quarter","id"),triwulan:o("quarter","id"),bulan:o("month","id"),hari:o("day","id"),n\u0103m:o("year","vi"),qu\u00FD:o("quarter","vi"),th\u00E1ng:o("month","vi"),ng\u00E0y:o("day","vi"),\u0E1B\u0E35:o("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:o("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:o("month","th"),\u0E27\u0E31\u0E19:o("day","th"),\u0627\u0644\u0633\u0646\u0629:o("year","ar"),\u0633\u0646\u0629:o("year","ar"),\u0627\u0644\u0639\u0627\u0645:o("year","ar"),\u0639\u0627\u0645:o("year","ar"),\u0627\u0644\u0631\u0628\u0639:o("quarter","ar"),\u0631\u0628\u0639:o("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":o("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:o("month","ar"),\u0634\u0647\u0631:o("month","ar"),\u0627\u0644\u064A\u0648\u0645:o("day","ar"),\u064A\u0648\u0645:o("day","ar"),\u05E9\u05E0\u05D4:o("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:o("quarter","he"),\u05D7\u05D5\u05D3\u05E9:o("month","he"),\u05D9\u05D5\u05DD:o("day","he"),\u0935\u0930\u094D\u0937:o("year","hi"),\u0938\u093E\u0932:o("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:o("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:o("month","hi"),\u092E\u093E\u0939:o("month","hi"),\u0926\u093F\u0928:o("day","hi"),\u0633\u0627\u0644:o("year","fa"),\u0645\u0627\u0647:o("month","fa"),\u0631\u0648\u0632:o("day","fa")}),vr=Object.freeze(Array.from(new Set(Object.values(ae).flatMap(e=>e.langs)))),he=Object.freeze(["fa","ar","he","th"]),Ce=1900,be=2100;function Pr(e,t){let n=[],r=$(t);try{r&&n.push(e.toLocaleLowerCase(r.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function Mr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let r of Pr(n,t)){let a=ae[r];if(a&&a.langs.includes(t))return a.part}return null}function Ir(e,t){return he.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=Ce&&t<=be:!0}var Nr=16e3;function Fr(e,t){if(!Array.isArray(e))return"";let n=[];for(let a of e){let l=typeof a?.n=="string"?a.n:"";l!==""&&n.push({n:l,q:typeof a?.q=="string"?a.q:""})}if(n.length===0)return"";let r=JSON.stringify({v:1,l:typeof t=="string"?t:"",c:n});return r.length>16e3?"":r}function kr(e){if(typeof e!="string"||e===""||e.length>16e3)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||t.v!==1||!Array.isArray(t.c))return null;let n=[];for(let r of t.c){if(!r||typeof r.n!="string"||r.n==="")return null;n.push({n:r.n,q:typeof r.q=="string"?r.q:""})}return n.length===0?null:{v:1,l:typeof t.l=="string"?t.l:"",c:n}}function Dr(e,t){if(!e)return!1;let n=e.l.trim().toLowerCase(),r=String(t??"").trim().toLowerCase();return n===""||r===""||n!==r}function Gr(e,t){if(!t||t.c.length===0)return[];let n=new Set(t.c.map(r=>r.n));return e.filter(r=>!n.has(r))}function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ur=/\b(?:columns|cols|column)\b/i;function H(e,t){let n=Math.max(0,t-240),r=e.slice(n,t),a=r.lastIndexOf(";");return a>=0&&(r=r.slice(a+1)),Ur.test(r)}function Te(e,t){return Se(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Se(e,t,n){let r=Ee(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${r}\2`,"g"),l=new RegExp(String.raw`\.name\s*===?\s*(['"])${r}\1`,"g"),u=0,i;for(;(i=l.exec(e))!==null;)H(e,i.index)&&u++;let C=0;for(;(i=a.exec(e))!==null;){let y=i.index+i[0].lastIndexOf(".name");if(!H(e,y))continue;C++;let h=Ee(i[1]);if(!n(h))return!1}return C>0&&C===u}function Wr(e,t){return Se(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var Re=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function Vr(e,t){if(!e)return[];let n=new Set(t);for(let i of Re)n.add(i);let r=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,l;for(;(l=a.exec(e))!==null;)H(e,l.index)&&r.add(l[2]);if(r.size===0)return[];let u=[];return r.forEach(i=>{n.has(i)||Te(e,i)||u.push(i)}),u}function qr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(r=>r.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let r of e.aliasesForCode(t))n.push(r.alias);return n}function xe(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function Hr(e,t,n){let r=xe(e,t);if(r===null||r<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,l=r>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof l!="string"||l.trim().length===0)return null;let u=l.split("{n}").join(String(r)).split("{fields}").join(r===1?"field":"fields"),i=we(n);return i.length===0?u:u+" "+i.join(" ")}function we(e){if(!e||e.length===0)return[];let t=[],n=new Map,r=new Map;for(let l of e){let u=typeof l?.dateGroupId=="string"?l.dateGroupId.trim():"";if(u!==""&&(n.has(u)||(t.push(u),n.set(u,0)),l.isDatePart===!0&&n.set(u,n.get(u)+1),l.isReassembledDate===!0&&!r.has(u))){let i=typeof l.sourceField=="string"?l.sourceField.trim():"",C=typeof l.name=="string"?l.name.trim():"",y=i!==""?i:C;y!==""&&r.set(u,y)}}let a=[];for(let l of t){let u=r.get(l),i=n.get(l)??0;!u||i===0||a.push(`'${u}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var f=e=>e==null?"":String(e),A=e=>e===!0,le=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},_e=e=>{let t=le(e);return t!==null&&t>0?t:null},Kr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Oe(e,t){let n={};for(let[r,a]of Kr){let l=f(E(e,t+a));l&&(n[r]=l)}return n}function zr(e){return Array.isArray(e)?e.map(t=>({code:f(E(t,"code")),severity:f(E(t,"severity")),text:f(E(t,"text"))})).filter(t=>t.text!==""):[]}function $r(e){let t=m=>E(e,m),n=t("retryAfterSeconds"),r=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),l=Oe(e,"point"),u=Oe(e,"destPoint");Object.keys(u).length&&(l.dest=u);let i=t("retryable"),C=t("isPollFinal"),y=_e(t("chartMinWidth")),h=_e(t("chartMinHeight"));return{errorMessage:f(t("errorMessage")),errorCode:f(t("errorCode")),refusalCode:f(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:zr(t("notices")),freemiumStatusCode:f(t("freemiumStatusCode")),code:f(t("code")),language:f(t("language")),version:Number(t("version")??0),codeSummary:f(t("codeSummary")),chartName:f(t("chartName")??t("chartType")),finalChartName:f(t("finalChartName")),warningMessage:f(t("warningMessage")),outputHash:f(t("outputHash")),validatorToken:f(t("validatorToken")),editCodeKey:f(t("editCodeKey")),signedLLMRequestID:f(t("signedLLMRequestID")),userReply:f(t("userReply")),userReplyOutcome:f(t("userReplyOutcome")),improvementSuggestion:f(t("improvementSuggestion")),geoColumn:f(t("geoColumn")),geoKind:f(t("geoKind")),geoPointCols:Object.keys(l).length?l:null,creditBalanceBefore:le(t("creditBalanceBefore")),creditCost:le(t("creditCost")),isServiceError:A(t("isServiceError")),isRateLimited:A(t("isRateLimited")),suppressSelectionGlyph:A(t("suppressSelectionGlyph")),isRefusal:A(t("isRefusal")),isVersionNotFound:A(t("isVersionNotFound")),isGenerationCancelled:A(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:f(t("servedCorrelationId")),...typeof C=="boolean"?{isPollFinal:C}:{},...f(t("pollOutcome"))!==""?{pollOutcome:f(t("pollOutcome"))}:{},...y!==null?{chartMinWidth:y}:{},...h!==null?{chartMinHeight:h}:{},...typeof r=="boolean"?{overrideThumbnailUpload:r}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var Le=["app","table","map","kpi"];function ve(e){return typeof e=="string"&&Le.includes(e)?e:void 0}var Ae=e=>e==null?void 0:Number(e),D=e=>f(e)||void 0;function Br(e){let t=E(e,"charts"),n=E(e,"refused"),r=Array.isArray(t)?t.map(l=>{let u=C=>E(l,C),i=u("recommended");return{name:f(u("chartTypeName")??u("name")),description:f(u("description")??u("chartDesc")),rank:Ae(u("rank")),score:Ae(u("score")),renderer:D(u("renderer")),language:D(u("language")),isPreview:A(u("isPreview")),kind:ve(u("kind")),alsoWorthALook:A(u("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:D(u("viaProjection")),viaProjectionKey:D(u("viaProjectionKey")),detailNote:D(u("detailNote"))}}).filter(l=>l.name):null,a=Array.isArray(n)?n.map(l=>({name:f(E(l,"chartTypeName")??E(l,"name")),reason:f(E(l,"reason")),reasonCode:f(E(l,"reasonCode")),isVeto:A(E(l,"isVeto"))})).filter(l=>l.name):[];return{errorMessage:f(E(e,"errorMessage")),errorCode:f(E(e,"errorCode")),charts:r,refused:a,noFitSummary:f(E(e,"noFitSummary"))}}function jr(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var Pe=["working","analyze","generate","refine","review"];function Qr(e,t){let n=String(e??"").trim().toLowerCase();if(Pe.includes(n))return n;let r=String(t??"").toLowerCase();return r.includes("analyz")?"analyze":r.includes("generat")?"generate":r.includes("refin")?"refine":r.includes("review")?"review":null}var Yr="FREEMIUM_ATTEMPT_SPENT",Xr="CLIENT_SECRET_MISMATCH",Jr="FREEMIUM_COLUMN_CAP",Zr="OAUTH_TOKEN_EXPIRED",eo="OAUTH_SIGNED_OUT";function to(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function no(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,r=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:r.licenseKey,licensee:r.licensee,secretKey:r.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function ro(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function oo(e){let t=0;for(let n of e){if(n.isMeasure)continue;let r=n.distinctCount;typeof r=="number"&&r>t&&(t=r)}return t}function Me(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,r=(e.codeVersion??0)>0?e.codeVersion:null,a=n??r??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function io(e){let t=e.fetchCorrelationId!=null,r=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=Me({genNew:r,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),l=e.fetchArmedAtMs,u=t&&typeof l=="number"&&Number.isSafeInteger(l)&&l>0?l:void 0,i=e.fetchCutAtMs,C=t&&typeof i=="number"&&Number.isSafeInteger(i)&&i>0?i:void 0,y=t?so(e.fetchCause):"";return{genNew:r,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...u!==void 0?{fetchArmedAtMs:u}:{},...C!==void 0?{fetchCutAtMs:C}:{},...y?{fetchCause:y}:{}}}function so(e){if(typeof e!="string")return"";let t=e.replace(/[\u0000-\u001f\u007f]+/g," ").trim().slice(0,120);return/[\ud800-\udbff]$/.test(t)&&(t=t.slice(0,-1)),t.trimEnd()}function ao(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function lo(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function uo(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function co(e,t,n){let r=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...r(t)?{rowsWithheld:t}:{},...r(n)?{rowsFilteredOut:n}:{}}}var fo={fit:"Best fit",variety:"Something different"};function Ie(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function mo(e){let t=Ie(e);return t?{qualifyOrder:t}:{}}function Ne(e,t){return e!=null&&t!=null&&e!==t}function po(e,t){return e?Ne(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var go=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Fe(e){let t=String(e??"").trim().toLowerCase();return go[t]??t}function ke(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Fe(n.dataType)]);return t}function yo(e){return B(ke(e))}var ho=2,Co=3,bo=4,Eo=64,To=8e3,So=6e4,Ro=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),xo=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function wo(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function _o(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function Oo(){let e=new Set,t=new Set;return{firstDraw(n,r){if(!n)return!1;let a=`${n}|${r}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function Ao(e){return!!e&&!e.includes("|")&&!e.includes(",")}function ue(e,t,n,r){let a=`${e},${t}|${n}`;return r?`${a}|${Math.max(0,Math.round(r.count))}|${r.nonce}`:a}function Lo(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:r,transport:a,clock:l}=n,u=t.apiPath??"/api",i=t.timeoutMs,C=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,y=m=>{try{t.onFailure?.(m)}catch{}},h=async(m,p,c,g)=>{let b;try{let T=await a.post(p,c,g,{timeoutMs:i});b=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){y({channel:m,stage:"post",status:null,error:T});return}(b<200||b>299)&&y({channel:m,stage:"status",status:b,error:null})};return{async sendClientMessage(m){let p,c,g;try{p=`${C()}${u}/LogClientMsg/?nocache=${l.now()}`,c=M(m),g=k(c,r)}catch(b){y({channel:"client-message",stage:"build",status:null,error:b});return}await h("client-message",p,c,{"Content-Type":"text/plain","X-Signature":g})},async countEvent(m,p,c){let g,b;try{g=`${C()}${u}/eventlog`,b=ue(m,t.clientVersion,p,c)}catch(T){y({channel:"event-count",stage:"build",status:null,error:T});return}await h("event-count",g,b,{"Content-Type":"text/plain"})}}}var De=2**31-1;function Ge(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function vo(e){return typeof e=="number"&&e>0&&e<=De?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${De} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function Po(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,r=t.credentials??"omit";return{async post(a,l,u,i){let C=i.timeoutMs,y=vo(C);if(y)throw y;let h=new AbortController,m=!1,p=setTimeout(()=>{m=!0,h.abort(Ge(C))},C),c=()=>h.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let g=!1,b=()=>{g||(g=!0,clearTimeout(p),i.signal?.removeEventListener("abort",c))},T=_=>m?Ge(C):_,L;try{L=await n(a,{method:"POST",body:l,headers:u,credentials:r,signal:h.signal})}catch(_){throw b(),T(_)}let R=J(L),v=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...v,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{b()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){b(),_.close();return}_.enqueue(s.value)}catch(s){b(),_.error(T(s))}},cancel(_){return b(),x.cancel(_)}});return{status:R.status,...v,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var Ue=300;function We(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var Mo="/LLMChart/",Io="/LLMChart/qualify",No="/VisionReview/",Fo="/LLMChart/sample",ko="/RefundGenerate/",Do=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",K=async e=>JSON.parse(await e.text());function Go(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function Uo(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:r,transport:a,clock:l}=n,u=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,C=m=>t.nocache?t.nocache(m):String(l.now());async function y(m,p,c,g,b){let T=`${i()}${u}${p}?nocache=${C(m)}`,L={"Content-Type":"text/plain","X-Signature":k(c,r)},R=g.signal??void 0,v=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&Do(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,L,R?{timeoutMs:g.timeoutMs,signal:R}:{timeoutMs:g.timeoutMs})}catch(w){return v(!1,w)}if(x.status<200||x.status>299){let w="";if(g.readErrorBody===!1)Go(x);else try{w=(await x.text()).slice(0,Ue)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await b(x)}}catch(w){return v(!0,w)}}function h(m,p){if(!p||typeof p.timeoutMs!="number"||!Number.isFinite(p.timeoutMs)||p.timeoutMs<=0)throw new TypeError(`The ${m} call needs a positive deadline in milliseconds`);return p}return{async generate(m,p){let c=h("generate",p),g=c.onStage??void 0;return y("generate",Mo,M(m),c,b=>Z(b,g))},async qualify(m,p){let c=h("qualify",p),g=c.route??Io;if(typeof g!="string"||!g.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return y("qualify",g,M(m),c,K)},async review(m,p){let c=h("review",p),g=JSON.stringify(m);if(typeof g!="string")throw new TypeError("The review wire did not serialize to JSON");return y("review",No,g,c,K)},async sample(m,p){let c=h("sample",p);return y("sample",Fo,M(m),c,K)},async refund(m,p,c){let g=h("refund",p);if(typeof m!="string"||m.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let b=We(c),T=b?{CorrelationID:m.trim(),Reason:b}:{CorrelationID:m.trim()};return y("refund",ko,JSON.stringify(T),g,K)}}}export{hn as ADMIN1_MATCH_PCT,Cn as ADMIN1_MATCH_PCT_NAMED,j as CITY_ROLE_MATCH_PCT,Xt as CITY_TIE_RATIO,Ro as CLIENT_EVENT_KINDS,Xr as CLIENT_SECRET_MISMATCH,et as COMPOUND_MIN_STEM,Rt as CYCLE_MEMBERS,wt as CYCLE_WORDS,be as DATE_LEVEL_GREGORIAN_YEAR_MAX,Ce as DATE_LEVEL_GREGORIAN_YEAR_MIN,vr as DATE_LEVEL_LANGUAGES,ae as DATE_LEVEL_NAMES,he as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,er as DEFAULT_GAP_FACTOR,dt as DEFAULT_TEMPERATURE,xo as DRAW_REASONS,Yr as FREEMIUM_ATTEMPT_SPENT,Jr as FREEMIUM_COLUMN_CAP,Nr as GENERATION_COLUMNS_MAX_CHARS,ut as GET_RANDOM,nt as GLUED_STEM_MIN,ot as HANGUL_MIN_STEM,Re as HOST_SYNTHETIC_COLUMNS,Ue as HTTP_BODY_START_CHARS,jn as IDENTIFIER_HEAD_INITIAL,Qn as IDENTIFIER_UNFOLDED,Bn as IDENTIFIER_WORDS,Mn as INTENSIVE_SUFFIX_TOKENS,Pn as INTENSIVE_WORD_TOKENS,Cr as IndexedText,An as LATITUDE_WORDS,Ln as LONGITUDE_WORDS,kt as LOOSE_KEY_MIN_LENGTH,Gt as LooseIndex,tr as MAX_RUN_BOUNDS,eo as OAUTH_SIGNED_OUT,Zr as OAUTH_TOKEN_EXPIRED,vt as PERIOD_CODE_FORMS,Lt as PERIOD_CODE_MEMBERS,Pt as PERIOD_ORDINALS,Mt as PERIOD_UNFOLDED,Nn as POSITIONAL_SUFFIX_TOKENS,In as POSITIONAL_WORD_TOKENS,Sr as PREVIEW_OMITTED_FIELDS,Pe as PROGRESS_STAGE_IDS,Le as QUALIFY_KINDS,fo as QUALIFY_ORDER_LABELS,qt as REGION_FRAME_WINDOWS,P as ROLE_MATCH_PCT,or as SERIES_COMPLETENESS_MAX_LISTED,ir as SERIES_COMPLETENESS_MIN_FILL,sr as SERIES_KEY_MAX_DISTINCT,bo as SEV_ERROR,ho as SEV_INFO,Eo as SEV_USER_PRESENTED,Co as SEV_WARNING,B as SIMPLE_STRING_HASH,lt as STR,st as SUBSTRING_MIN,qe as SUPPORTED_LANGUAGES,He as SUPPORTED_LANGUAGE_CODES,So as TELEMETRY_TIMEOUT_DEV_MS,To as TELEMETRY_TIMEOUT_MS,$e as VOCABULARY_LANGUAGE_CODES,ze as VOCABULARY_ONLY_LANGUAGES,xt as YEAR_WORDS,Zt as admin1CodesForName,Q as admin1LookupRegistered,q as admin1MatchPct,Hn as allowedAggregations,Tt as anchorLocalWallClockDates,to as answerIsRetryable,yn as buildGeoIsoColumn,cn as buildGeoPointColumns,En as buildProvinceIsoColumn,_t as calendarWordIn,ao as capabilityFields,fn as cityMatchPct,dn as cityTagsFor,gr as classifyAdditivity,_o as classifyDraw,qn as classifyForAggregation,yr as classifyNumericValueNature,mr as classifyTemporal,Qt as clearAdmin1LookupForTests,Gn as codeNeedsLegacyAggNames,Xn as codeReadsColumn,Jn as codeReadsColumnsByRoleOrPosition,Dn as collapseRepeatedAggPrefix,Gr as columnsNeverGeneratedOn,Zn as columnsTheCodeReads,vn as coordinateAxisOfWords,Yt as countryIso2,zt as countryRegion,Oo as createDrawLedger,Uo as createGenerateClient,Lo as createTelemetryClient,no as credentialFields,co as dataCompletenessFields,Mr as dateLevelPart,Ir as dateLevelYearAdmits,St as datesAreTimeOfDayOnly,bt as datesCarryTimeOfDay,Rn as decimalSeparatorOf,Kn as defaultAggregation,xn as detectDecimalSeparator,Sn as detectFormatSignature,mn as detectGeo,Vt as detectOrdinalDomain,fr as detectTextDatePattern,wo as drawLocation,M as encodePayload,br as engineTypeForSqlType,Un as englishImplicitAggNames,ue as eventLogLine,io as fetchFields,Po as fetchTransport,je as foldName,Hr as freemiumColumnCapRefusal,xe as freemiumColumnsOverCap,we as freemiumDateHierarchyClauses,Dr as generationColumnsAnswerInLocale,rt as gluedPrefixStems,qr as guardColumnNames,xr as gzipWireText,it as hangulWordEndsWith,kn as hasDefaultAggPrefix,Je as hasUnsegmentedScript,pr as hostAggHint,Bt as inMiddleEast,Tr as ingest,zn as isAggregationAllowed,G as isBlankLike,rn as isCityTableLoaded,H as isColumnContextRef,ct as isDeterministicRefusal,Ao as isEventLogCode,ln as isGeoPointAmbiguity,dr as isIdentifierName,gn as isJoinGeoKind,tn as isKnownProvinceId,_r as isNdjsonContentType,Ut as isOrdinalFriendlyName,Dt as isUsableLooseKey,wr as keyedSigner,uo as leafCardinalityField,yt as localMidnightDateColumns,gt as localMidnightToUtcDay,Et as localWallClockDateColumns,At as localizedCycleIn,Yn as localizedIdentifierWordIn,Ot as localizedYearWordIn,N as looksLikeCountryColumn,Ft as looseNameKey,at as matchNameToken,oo as maxNonMeasureCardinality,Tn as measureAdmin1Columns,rr as measureCadence,cr as measurePersistence,ur as measureSeriesCompleteness,k as messageSignature,Vr as missingHardColumnRefs,On as monthLookupFor,Ye as nameLetterRuns,Vn as nameLooksIntensiveRate,Wn as nameLooksPositional,Te as nameProbeIsGuarded,Wr as nameProbeKeepsDrawing,Qe as nameWords,on as normalizeCountry,ht as normalizeLocalMidnightDates,_n as normalizeMonthKey,U as normalizePlaceName,an as normalizeZip5,po as offeredShortlistFor,Er as parseCsvRows,ft as parseDateStable,$r as parseGenerateResponse,kr as parseGenerationColumns,wn as parseNumberText,Br as parseQualifyResponse,jr as parseReviewVerdict,nr as parseTemporalPoint,Rr as payloadPreview,Nt as periodCodeSeries,lr as pickSeriesColumn,Qr as progressStageOf,hr as promotesToMeasure,en as provinceIdForAdmin1Code,bn as provinceIdForRow,ve as qualifyKindOf,mo as qualifyOrderField,Ie as qualifyOrderOf,Z as readGenerateStream,Xe as readName,It as readPeriodCode,E as readWireField,We as refundReasonCode,jt as registerAdmin1Lookup,nn as registerCityTable,Kt as registerIso3Regions,I as resolveAdmin1,Jt as resolveCityAdmin1,Me as resolveFetchVersion,un as resolveGeoPoint,Be as resolveLanguage,Lr as resolvePointRoles,lo as retryFields,Wt as safeDistinctValuesToShip,ke as schemaIdentity,yo as schemaIdentityKey,Fe as schemaTypeFamily,Fr as serializeGenerationColumns,ar as seriesKeyVerdict,$n as shareOfTotalIsHonest,Ne as shortlistIsStale,Fn as stripHostAggPrefix,$t as summarizeCountryRegions,Ht as summarizeGeoExtent,Ke as supportedLanguage,pn as toGeoIso,Ze as unsegmentedRuns,Ct as utcWallClock,ro as viewportFields,$ as vocabularyLanguage,mt as wholeDayFrame,pt as wholeDayIso,J as wireResponseFromFetch,tt as wordEndsWith,ie as zipMatchPct,V as zipPrefixCandidates,sn as zipToPrefix3};
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{R as a,S as b,T as c,U as d,V as e,W as f,X as g,Y as h,Z as i}from"./chunk-QAGRGHJI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-TZ74QIKA.mjs";import"./chunk-YDYFP2T4.mjs";import"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-3ZAS32F5.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,g as promotesToMeasure,h as trimmedCells};
2
+ import{R as a,S as b,T as c,U as d,V as e,W as f,X as g,Y as h,Z as i}from"./chunk-HD3RC2FT.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-TZ74QIKA.mjs";import"./chunk-YDYFP2T4.mjs";import"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-3ZAS32F5.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,g as promotesToMeasure,h as trimmedCells};
package/dist/ingest.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a,b,c}from"./chunk-755USHC4.mjs";import"./chunk-QAGRGHJI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-TZ74QIKA.mjs";import"./chunk-YDYFP2T4.mjs";import"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-3ZAS32F5.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
2
+ import{a,b,c}from"./chunk-UYV7NPZ3.mjs";import"./chunk-HD3RC2FT.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-TZ74QIKA.mjs";import"./chunk-YDYFP2T4.mjs";import"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-3ZAS32F5.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
@@ -0,0 +1,33 @@
1
+ /** One bound column as the host delivered it when the generate was asked. */
2
+ export interface GenerationColumn {
3
+ /** The host's display name. */
4
+ n: string;
5
+ /** The host's query name, "" when the host has none. */
6
+ q: string;
7
+ }
8
+ export interface GenerationColumns {
9
+ v: 1;
10
+ /** The host's locale tag when the generate was asked, "" when unknown. */
11
+ l: string;
12
+ c: GenerationColumn[];
13
+ }
14
+ /** A stored value longer than this is not written: the chart then behaves as one saved without the structure. */
15
+ export declare const GENERATION_COLUMNS_MAX_CHARS = 16000;
16
+ /** The text a host stores. "" when there is nothing to store or the text would pass the cap. */
17
+ export declare function serializeGenerationColumns(cols: ReadonlyArray<{
18
+ n: unknown;
19
+ q?: unknown;
20
+ }> | null | undefined, locale: string | null | undefined): string;
21
+ /** Read a stored value back. Anything unusable reads as null (unknown), never as an empty list. */
22
+ export declare function parseGenerationColumns(raw: unknown): GenerationColumns | null;
23
+ /**
24
+ * May the stored names stand in for live ones in this session? Only when the session's locale differs from the generation's.
25
+ * In the same locale the host composes the same names, so a stored name that is missing now was renamed or re-aggregated by
26
+ * the reader - a real field change. An unknown locale on either side allows it.
27
+ */
28
+ export declare function generationColumnsAnswerInLocale(gen: GenerationColumns | null | undefined, liveLocale: string | null | undefined): boolean;
29
+ /**
30
+ * Of the names that went away, the ones the chart was never generated on. Empty when the generation's columns are unknown:
31
+ * the host then says what it said before.
32
+ */
33
+ export declare function columnsNeverGeneratedOn(goneNames: readonly string[], gen: GenerationColumns | null | undefined): string[];
@@ -53,6 +53,7 @@ export type { DataSource, IngestOptions, IngestResult, ColumnDescriptor, SqlColu
53
53
  export { payloadPreview, PREVIEW_OMITTED_FIELDS } from "./payloadPreview";
54
54
  export type { PayloadPreviewOptions } from "./payloadPreview";
55
55
  export { codeReadsColumn, codeReadsColumnsByRoleOrPosition, columnsTheCodeReads } from "./codeColumnReads";
56
+ export { serializeGenerationColumns, parseGenerationColumns, generationColumnsAnswerInLocale, columnsNeverGeneratedOn, GENERATION_COLUMNS_MAX_CHARS, type GenerationColumn, type GenerationColumns, } from "./generationColumns";
56
57
  export { isColumnContextRef, nameProbeIsGuarded, nameProbeKeepsDrawing, missingHardColumnRefs, HOST_SYNTHETIC_COLUMNS, guardColumnNames, } from "./columnRefScan";
57
58
  export { freemiumColumnsOverCap, freemiumColumnCapRefusal, freemiumDateHierarchyClauses } from "./freemiumCaps";
58
59
  export type { FreemiumColumnCapStatus, FreemiumDateGroupColumn } from "./freemiumCaps";
@@ -61,8 +62,8 @@ export { encodePayload, gzipWireText, keyedSigner, messageSignature, readWireFie
61
62
  export type { GzipText } from "./wire";
62
63
  export { readGenerateStream, isNdjsonContentType, wireResponseFromFetch } from "./wireStream";
63
64
  export type { OnStage } from "./wireStream";
64
- export { parseGenerateResponse, parseQualifyResponse, parseReviewVerdict } from "./wireParse";
65
- export type { ParsedGenerateResponse, ParsedQualifyResponse, ParsedQualifyChart, ParsedQualifyRefusal, ParsedReviewVerdict, ParsedNotice, WirePointBinding, WirePointColumns, } from "./wireParse";
65
+ export { parseGenerateResponse, parseQualifyResponse, parseReviewVerdict, QUALIFY_KINDS, qualifyKindOf } from "./wireParse";
66
+ export type { QualifyKind, ParsedGenerateResponse, ParsedQualifyResponse, ParsedQualifyChart, ParsedQualifyRefusal, ParsedReviewVerdict, ParsedNotice, WirePointBinding, WirePointColumns, } from "./wireParse";
66
67
  export { PROGRESS_STAGE_IDS, progressStageOf, FREEMIUM_ATTEMPT_SPENT, CLIENT_SECRET_MISMATCH, FREEMIUM_COLUMN_CAP, OAUTH_TOKEN_EXPIRED, OAUTH_SIGNED_OUT, answerIsRetryable, } from "./messageCodes";
67
68
  export type { ProgressStageId } from "./messageCodes";
68
69
  export { viewportFields, maxNonMeasureCardinality, credentialFields, resolveFetchVersion, fetchFields, capabilityFields, retryFields, leafCardinalityField, dataCompletenessFields, qualifyOrderOf, qualifyOrderField, QUALIFY_ORDER_LABELS, shortlistIsStale, offeredShortlistFor, } from "./wireBuild";
@@ -47,6 +47,12 @@ export declare function classifyNumericValueNature(i: {
47
47
  prec: number;
48
48
  maxval: number;
49
49
  minval: number;
50
+ /** The measure-inference (promotion) path sets this. Rule (b) reads a DENSE RUN OF WHOLE NUMBERS as an ordered
51
+ * axis; its density test (distinct / (max - min + 1)) means nothing for fractional values, so on this path a
52
+ * column holding any fractional value (prec > 0) is not an axis by rule (b) and falls through to rule (d).
53
+ * Every other caller leaves it unset, so the nature stamped on every column - and on every bound measure - is
54
+ * exactly as before. */
55
+ ordinalNeedsWholeNumbers?: boolean;
50
56
  }): ValueNature;
51
57
  /**
52
58
  * THE MEASURE-INFERENCE VERDICT for one column - the one rule both the stats pass and inferredMeasureFlags use, so a
@@ -88,6 +94,10 @@ export interface IValueCollection {
88
94
  aliasesForCode?(code: string | null | undefined): ColumnNameAlias[];
89
95
  armAliasesForCode?(code: string | null | undefined): ColumnNameAlias[];
90
96
  getArmedAliases?(): ColumnNameAlias[];
97
+ setGenerationColumns?(cols: ReadonlyArray<{
98
+ n: string;
99
+ q: string;
100
+ }> | null | undefined): void;
91
101
  }
92
102
  /**
93
103
  * A second name a column answers to, for chart code that was generated against it.
@@ -99,13 +109,17 @@ export interface IValueCollection {
99
109
  * - `english-implicit-agg`: the host named an automatic aggregation in the viewer's language
100
110
  * (`Suma de Volume`) and the code, generated in an English session, reads `Sum of Volume`. The
101
111
  * English name is recomposed from the column's query name (englishImplicitAggNames).
112
+ * - `stored-query-name`: the host named the column differently for the session that generated the code (any language), and
113
+ * the host kept, with the saved chart, the name and query name each column had then (setGenerationColumns). A stored name
114
+ * whose query name is a live column's query name answers for that column. Excel and MCP hosts never rename a column per
115
+ * viewer and send no query names, so they never arm one.
102
116
  */
103
117
  export interface ColumnNameAlias {
104
118
  /** The column's name as the dataset carries it now. */
105
119
  name: string;
106
120
  /** The other name the code reads it by. */
107
121
  alias: string;
108
- reason: "doubled-agg-prefix" | "english-implicit-agg";
122
+ reason: "doubled-agg-prefix" | "english-implicit-agg" | "stored-query-name";
109
123
  }
110
124
  /**
111
125
  * A CATEGORY DOES NOT END IN A SPACE (2026-09-24). `'Student Rush '` and `'Student Rush'` are two grouping keys to
@@ -128,6 +142,8 @@ export declare class IndexedText implements IValueCollection {
128
142
  private _rowHashes;
129
143
  private _hostQueryNames;
130
144
  private _englishAliases;
145
+ private _generationColumns;
146
+ private _generationColumnsSig;
131
147
  private _declaredDimensions;
132
148
  private _inferredMeasureFlags;
133
149
  /**
@@ -235,6 +251,18 @@ export declare class IndexedText implements IValueCollection {
235
251
  * Replacing the names drops any English alias armed against the old ones.
236
252
  */
237
253
  setHostQueryNames(names: ReadonlyArray<string | null | undefined> | null | undefined): void;
254
+ /**
255
+ * The name and query name each column had when the saved code was generated, as the host stored them with the chart. A
256
+ * stored name whose query name equals a live column's query name becomes a candidate second name for that column, under
257
+ * the same rules as the English one (aliasesForCode). Entries without a query name are ignored. A host passes null when it
258
+ * has none, or when the stored names must not answer (generationColumnsAnswerInLocale).
259
+ *
260
+ * The same list again changes nothing, so a host may call this before every render; a different list drops what was armed.
261
+ */
262
+ setGenerationColumns(cols: ReadonlyArray<{
263
+ n: string;
264
+ q: string;
265
+ }> | null | undefined): void;
238
266
  /**
239
267
  * Every second name a column would answer to for THIS code, without arming anything - the
240
268
  * question a host's pre-render guard asks before it decides whether cached code can find its
@@ -113,6 +113,7 @@ export type LLMColumnWithValue = {
113
113
  additivity?: "additive" | "part_of_whole" | "intensive_rate" | "unknown";
114
114
  partOfWholeDim?: string;
115
115
  discourageAggregationAcrossGroups?: boolean;
116
+ hostAggregation?: string;
116
117
  skewness?: number;
117
118
  stdDev?: number;
118
119
  sum?: number;
@@ -108,6 +108,16 @@ export interface ParsedGenerateResponse {
108
108
  * vision review returns, which are the same shape. A null or non-object body reads as empty.
109
109
  */
110
110
  export declare function parseGenerateResponse(data: unknown): ParsedGenerateResponse;
111
+ /**
112
+ * What kind of thing a chart type is, beyond a plain chart, in the gallery's own families: an app
113
+ * (a type with its own controls or logic), a table, a map or a KPI card. A plain chart has no kind.
114
+ */
115
+ export type QualifyKind = "app" | "table" | "map" | "kpi";
116
+ /** Every kind a qualify row may carry, in the gallery's family order. */
117
+ export declare const QUALIFY_KINDS: readonly QualifyKind[];
118
+ /** A wire value as a known kind; anything else (a plain chart, an older server, a kind this
119
+ * version does not know) is undefined, so a host never draws a badge it cannot name. */
120
+ export declare function qualifyKindOf(v: unknown): QualifyKind | undefined;
111
121
  /** One chart type that qualifies, as the server describes it. */
112
122
  export interface ParsedQualifyChart {
113
123
  /** The wire's `name` (an older server's `chartTypeName`). Never empty: a nameless row is dropped. */
@@ -122,6 +132,9 @@ export interface ParsedQualifyChart {
122
132
  language: string | undefined;
123
133
  /** True only when the server said so: a newer, less proven type. */
124
134
  isPreview: boolean;
135
+ /** The type's kind when it is an app, a table, a map or a KPI card; undefined for a plain chart,
136
+ * from an older server, and for a kind this version does not know. A label, never a gate. */
137
+ kind?: QualifyKind;
125
138
  /** True only when the server said so: one of the "also worth a look" picks below the top fits, drawn for variety. A hint, never a gate. */
126
139
  alsoWorthALook: boolean;
127
140
  /** False = a required channel is poorly served; undefined = unassessed, never a demotion. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/shape-core",
3
- "version": "0.6.115",
3
+ "version": "0.6.116",
4
4
  "description": "Host-agnostic data-shape profiler: ingest a dataset's rows through IValueCollection.addRow and read back the measured shape as an LLMColumnWithValue[] payload — types, cardinality, temporal/ordinal detection, geographic region and point resolution, cross-column signals. MEASUREMENT only: the policy that decides what a measured shape means for chart selection lives server-side.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a as be}from"./chunk-U3H6UBOO.mjs";import{a as xt,f as ee,g as Se,h as se,i as _e,j as re}from"./chunk-TZ74QIKA.mjs";import{b as yt,c as bt,d as St,e as _t,f as At}from"./chunk-YDYFP2T4.mjs";import{c as gt,l as pt,n as he,p as ht,s as ie,w as ye,x as ke,y as De,z as Oe}from"./chunk-DTBXJVUG.mjs";import{e as ut,k as ge,m as mt,n as ft,o as pe}from"./chunk-3ZAS32F5.mjs";import{b as ct,d as dt}from"./chunk-5HI6TVMM.mjs";import{A as fe,B as at,E as lt,a as ne,b as J,c as qe,d as de,g as Qe,h as Je,j as et,l as tt,m as nt,o as rt,p as me,q as it,r as st,u as Ne,w as ot}from"./chunk-CZJ7M6A5.mjs";import{c as Ze,f as Ee}from"./chunk-WC4JINEZ.mjs";var mn=85,fn=60,gn=/(^|[^a-z])(state|province|provincia|provinz|region|regione|regiao|county|department|departement|departamento|prefecture|oblast|canton|kanton|bundesland|land|territory)([^a-z]|$)/i,Pe=t=>Math.round(t*10)/10,Ae=t=>t.split("-")[0];function Ct(t){let e=new Map,n=0;if(t.forEach((s,a)=>{let l=he(a);l&&(e.set(l,(e.get(l)||0)+s),n+=s)}),n===0)return{};let[i,r]=[...e].sort((s,a)=>a[1]-s[1])[0];return{dominantRegion:i,dominantRegionPct:Pe(100*r/n)}}function wi(t){let e=t.province===null||t.province===void 0?"":String(t.province).trim();if(e)return wt(e,t.provinceKind,t.country);if(!ie())return null;let n=t.city===null||t.city===void 0?"":String(t.city).trim();if(!n)return null;let i=ye(n,{country:t.country===null||t.country===void 0?null:String(t.country)});return i.status==="resolved"?i.provinceId:null}function wt(t,e,n){if(e==="us-state-code"||e==="us-state-name"){let s=At(t,e);return s?"US-"+s:null}if(!ie())return null;if(e==="admin1-code")return Oe(t)?t.toUpperCase():null;let i=n==null?null:String(n),r=new Set(ke(t,i).map(De).filter(s=>!!s));return r.size===1?[...r][0]:null}function Mi(t,e={}){let n=e.deriveProvinces!==!1,i=new Array(t.length),r=new Array(t.length),s=new Set,a=[],l=new Set,o=[],c=0,u=0,g=0,d=A=>{let S=A.toLowerCase();s.has(S)||(s.add(S),a.push(A))},y=A=>A==null||A===""?null:Number(A),w=new Map;return t.forEach((A,S)=>{i[S]=null,r[S]=null;let p=A.country===null||A.country===void 0||String(A.country).trim()===""?null:String(A.country).trim(),h=A.province===null||A.province===void 0?"":String(A.province).trim();if(h){let _=wt(h,e.provinceKind,p);_?(i[S]=_,r[S]="province",c++):d(h);return}if(!n)return;let x=y(A.lat),f=y(A.lon),C=!1;if(e.locate&&x!==null&&f!==null&&isFinite(x)&&isFinite(f)){C=!0;let _=e.locate(x,f);if(_){i[S]=_,r[S]="coordinates",c++;return}}let b=A.city===null||A.city===void 0?"":String(A.city).trim();if(b&&ie()){let _=b.toLowerCase()+""+(p??""),M=w.get(_);if(M||(M=ye(b,{country:p}),w.set(_,M)),M.status==="resolved"&&M.provinceId){i[S]=M.provinceId,r[S]="city",c++;return}if(M.status==="ambiguous"){u++,l.has(_)||(l.add(_),o.length<8&&o.push(b));return}d(b);return}C&&g++}),{iso:i,source:r,unmatched:a,matchedRows:c,totalRows:t.length,ambiguousRows:u,ambiguousExamples:o,unplacedPoints:g}}function Mt(t,e,n={}){let i=new Map;if(!ie()||e.length===0)return i;let r=t.findIndex(l=>!l.isMeasure&&(l.geoKind||"").startsWith("country")),s=l=>l==null?"":String(l).trim(),a=l=>{let o=new Map;for(let y of e){let w=s(y[l]);if(!w)continue;let A=r>=0&&s(y[r])||null,S=w+""+(A??""),p=o.get(S);p?p.rows++:o.set(S,{city:w,country:A,rows:1})}if(o.size===0)return null;let c=0,u=0,g=new Set,d=new Map;return o.forEach(y=>{let w=ye(y.city,{country:y.country});w.status!=="unmatched"&&u++,!(w.status!=="resolved"||!w.provinceId)&&(c++,g.add(w.provinceId),d.set(w.cc,(d.get(w.cc)||0)+y.rows))}),{signals:{rollupPct:Pe(100*c/o.size),regionCount:g.size,countryCount:d.size,...Ct(d)},cityPct:100*u/o.size,distinct:o.size}};return t.forEach((l,o)=>{if(l.isMeasure||o===r)return;let c=l.geoKind||"";if(c.startsWith("city")){if(n.cities===!1)return;let _=a(o);_&&i.set(o,_.signals);return}if(c)return;let u=new Map,g=new Map;for(let _ of e){let M=s(_[o]);M&&(u.set(M,(u.get(M)||0)+1),g.has(M)||g.set(M,r>=0&&s(_[r])||null))}if(u.size<3)return;let d=0,y=0,w=0,A=new Set,S=new Map;u.forEach((_,M)=>{if(Oe(M)){d++;let z=M.toUpperCase();A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_);return}let W=new Set(ke(M,g.get(M)).map(De).filter(z=>!!z));if(W.size===1){y++;let z=[...W][0];A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_)}else W.size>1&&w++});let h=gn.test(l.name.replace(/[_-]+/g," "))?fn:mn,x=100*d/u.size,f=100*y/u.size,C=x>=f,b=C?x:f;if(b<h){if(n.cities===!1)return;let _=a(o);if(!_||_.cityPct<gt||_.distinct<St&&!bt(l.name,yt))return;i.set(o,_.signals);return}i.set(o,{kind:C?"admin1-code":"admin1-name",matchPct:Pe(b),ambiguous:!C&&w/u.size>.15?!0:void 0,regionCount:A.size,countryCount:S.size,...Ct(S)})}),i}function ze(t){let e=(t||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var Le={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},pn=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,hn=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,yn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,bn=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,Sn=new Set(["de","del","of"]),_n=new Set(["\u0433","\u0440","r"]),An=/^[\p{L}\p{M}\u0970\u05f3]+$/u,Fe=/^\d+$/;function xn(t){let e=+t[1],n=+t[2],i=t[3]===void 0?0:+t[3],r=t[4]!==void 0;if(n>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(t[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:n,s:i,seconds:t[3]!==void 0,meridiem:r}}function Tt(t){let e=t.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=xt(e);let n=null,i=pn.exec(e);if(i){if(n=xn(i),!n)return null;e=e.slice(0,i.index)}let r;if(r=yn.exec(e)){let d=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...Le,form:"cjk",key:d,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=hn.exec(e)){let d=r[2],y=r[4];if(d!==y)return null;let w=d.trim(),A=r[6];if(A&&w!==".")return null;let S=[r[1].length,r[3].length,r[5].length],p=S[0]===4,h=S[2]===4;return p===h||(p?S[1]>2||S[2]>2:S[0]>2||S[1]>2)?null:p&&w==="-"&&d==="-"&&S[1]===2&&S[2]===2?"iso":p&&w==="."&&d==="."&&!A&&!(S[1]===2&&S[2]===2)?null:{...Le,form:"numeric",key:`num|${p?"y":"x"}|${d}|${A}`,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:p,sep:d,trail:A}}let s=e.replace(bn,"$1").split(/[\s.,/-]+/).filter(d=>d!==""&&!Sn.has(d.toLowerCase()));if(s.length===4&&Fe.test(s[2])&&_n.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let a=s.map(d=>Fe.test(d)?"N":An.test(d)?"W":"?").join(""),l=s.map(d=>Fe.test(d)?d:""),o=0,c=0,u="",g;if(a==="NWN"&&l[0].length<=2&&l[2].length===4)o=+l[0],u=s[1],c=+l[2],g="dmy";else if(a==="WNN"&&l[1].length<=2&&l[2].length===4)u=s[0],o=+l[1],c=+l[2],g="mdy";else if(a==="NWN"&&l[0].length===4&&l[2].length<=2)c=+l[0],u=s[1],o=+l[2],g="ymd";else return null;return{...Le,form:"named",key:`named|${g}`,clock:n,day:o,year:c,word:u,namedOrder:g}}var Cn=[31,28,31,30,31,30,31,31,30,31,30,31],wn=t=>t%4===0&&t%100!==0||t%400===0;function vt(t,e,n){return t>=1&&t<=9999&&e>=1&&e<=12&&n>=1?n<=(e===2&&wn(t)?29:Cn[e-1]):!1}function Mn(t,e,n,i){let r=new Date(Date.UTC(2e3,e-1,n,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(t),r}function It(t,e={}){let n=(e.floor??1)>=1,i=new Map,r=new Map,s=0,a=null;for(let p of t){if(p==null)continue;if(typeof p!="string"){if(n)return null;s++;continue}let h=p.trim();if(h==="")continue;s++;let x=i.get(h);if(x===void 0&&(x=Tt(h),i.set(h,x)),x===null||x==="iso"){if(n)return null;continue}if(n){if(a===null)a=x;else if(x.key!==a.key)return null}else r.set(x.key,(r.get(x.key)??0)+1)}if(!n){let p=0,h="";for(let[x,f]of r)f>p&&(p=f,h=x);if(p===0||p/s<e.floor)return null;a=[...i.values()].find(x=>x!==null&&x!=="iso"&&x.key===h)??null}if(a===null)return null;let l=a.key,o=[...i.values()].filter(p=>p!==null&&p!=="iso"&&p.key===l),c,u="shape",g=null;if(a.form==="named"){if(c=a.namedOrder,g=_e(o.map(p=>p.word),e.locale),!g)return null}else if(a.form==="cjk"||a.yearFirst)c="ymd";else{let p=0,h=0;for(let x of o)x.a>12&&p++,x.b>12&&h++;if(p>0&&h>0)return null;p>0?(c="dmy",u="values"):h>0?(c="mdy",u="values"):a.sep.trim()==="."?(c="dmy",u="shape"):(c=ze(e.locale)?"mdy":"dmy",u="locale")}let d=p=>{if(p.form==="named"){let h=g.get(ee(p.word));return h===void 0?null:[p.year,h+1,p.day]}return p.yearFirst?[p.a,p.b,p.c]:c==="dmy"?[p.c,p.b,p.a]:[p.c,p.a,p.b]},y=1/0,w=-1/0,A=0;for(let p of o){let h=d(p);if(!h||!vt(h[0],h[1],h[2])){if(n)return null;A++;continue}y=Math.min(y,h[0]),w=Math.max(w,h[0])}if(!n&&(r.get(l)-A)/s<e.floor||y>=2400&&w<=2699||y>=1300&&w<=1500)return null;let S={form:a.form,order:c,orderFrom:u,hasTime:o.some(p=>p.clock!==null),read(p){if(typeof p!="string")return null;let h=p.trim();if(h==="")return null;let x=i.get(h);if(x===void 0&&(x=Tt(h),i.set(h,x)),x===null||x==="iso"||x.key!==l)return null;let f=d(x);return!f||!vt(f[0],f[1],f[2])?null:Mn(f[0],f[1],f[2],x.clock)}};if(a.form!=="named"&&!o.some(p=>p.clock?.meridiem)){let p;a.form==="cjk"?p=a.cjkPattern:a.yearFirst?p=`%Y${a.sep}%m${a.sep}%d${a.trail}`:p=(c==="dmy"?`%d${a.sep}%m${a.sep}%Y`:`%m${a.sep}%d${a.sep}%Y`)+a.trail;let h=o.filter(x=>x.clock!==null).length;h===0?S.pattern=p:h===o.length&&(S.pattern=p+(o.every(x=>x.clock.seconds)?" %H:%M:%S":" %H:%M"))}return S}import on from"papaparse";var Tn={es:["latitud"],pt:["latitude"],fr:["latitude"],it:["latitudine"],nl:["breedtegraad"],de:["breitengrad"]},vn={es:["longitud"],pt:["longitude"],fr:["longitude"],it:["longitudine"],nl:["lengtegraad"],de:["l\xE4ngengrad"]},We=t=>ne(t.normalize("NFC")).toLowerCase(),In=new Set(Object.values(Tn).flatMap(t=>(t??[]).map(We))),Rn=new Set(Object.values(vn).flatMap(t=>(t??[]).map(We)));function Rt(t){let e=!1,n=!1;for(let i of t){let r=We(i);In.has(r)?e=!0:Rn.has(r)&&(n=!0)}return e===n?null:e?"lat":"lon"}var En=["rate","ratio","pct","percent","percentage","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","z[_-]?score","average","avg","mean","median","stddev","variance","gpa","percentile","quantile","efficiency","accuracy","probability","multiplier","coefficient","correlation","occupancy","age","bmi","temperature","density","pressure","humidity","ph","velocity","speed","elevation","altitude","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps","capita","temperatuur","temperatur","temperatura","teplota","lampotila","homerseklet","sicaklik","pression","presion","pressao","pressione","druck","tryck","tlak","paine","nyomas","presiune","humidite","humedad","umidade","umidita","feuchtigkeit","vochtigheid","kosteus","vlhkost","vitesse","velocidad","velocidade","velocita","geschwindigkeit","snelheid","hastighet","hastighed","rychlost","nopeus","sebesseg","brzina","predkosc","densite","densidad","densidade","densita","dichte","dichtheid","hustota","tiheys","gustoca","moyenne","mediane","promedio","mediana","gemiddelde","durchschnitt","mittelwert","genomsnitt","gennemsnit","gjennomsnitt","keskiarvo","atlag","ortalama","prosjek","srednia","prumer","priemer","medie","taux","tasa","taxa","tasso","verhaltnis","verhouding","aandeel","anteil","andel","osuus","podil","udzial","udio","pourcentage","porcentaje","percentual","prozent","procent","prosentti","szazalek","yuzde","participacion","participacao","pondere","omjer","arany","oran","rata","leeftijd","edad","idade","wiek","eletkor","varsta","puntuacion","pontuacao","punteggio","betyg","ocena","indice","indeks","wskaznik","puan","ocupacion","ocupacao","occupazione","auslastung","bezetting","belaggning","belaegning","belegg","kayttoaste","oblozenie","obsazenost","obsadenost","kihasznaltsag","doluluk","ocupare","popunjenost","efficacite","eficiencia","efficienza","effizienz","effectiviteit","verimlilik"],Nn=["pct","percent","percentage","rate","ratio","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","gpa","percentile","quantile","bmi","density","pressure","humidity","velocity","efficiency","occupancy","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps"],kn=["latitude","longitude"],Dn=["latitude","longitude"];function q(t){return ne(t)}var kt=["somme de","suma de","soma de","summe von","som van","somma di","summa av","sum av","sum af","soucet z","suma z","totaal van","total de","toplam","osszeg","nombre de","recuento de","contagem de","anzahl von","aantal van","conteggio di","antal av","lukumaara","pocet z","sum pa","\u0441\u0443\u043C\u043C\u0430","\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E","\u0441\u0443\u043C\u0430","\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C","\u03B1\u03B8\u03C1\u03BF\u03B9\u03C3\u03BC\u03B1","\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2"],On=["moyenne de","promedio de","media de","media di","durchschnitt von","gemiddelde van","medelvarde av","genomsnitt av","gennemsnit af","keskiarvo","atlag","ortalama","prumer z","srednia z","medie de","minimum de","minimo de","minimo di","minimum von","maximum de","maximo de","massimo di","maximum von","prom.","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435","\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0435\u0440\u0435\u0434\u043D\u0454","\u03BC\u03B5\u03C3\u03BF\u03C2 \u03BF\u03C1\u03BF\u03C2","\u0645\u06CC\u0627\u0646\u06AF\u06CC\u0646"],Pn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],Ln=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],xe=Object.freeze({"nombre de":"count","recuento de":"count","contagem de":"count","anzahl von":"count","aantal van":"count","conteggio di":"count","antal av":"count",lukumaara:"count","pocet z":"count",\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E:"count",\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C:"count",\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2:"count",\u7684\u8BA1\u6570:"count","minimum de":"min","minimo de":"min","minimo di":"min","minimum von":"min","maximum de":"max","maximo de":"max","massimo di":"max","maximum von":"max"});function $e(t){return[...t].sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var Dt=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+$e(kt)+")\\s+)","i");function Et(t){for(let e of t){let n=e.codePointAt(0)??0;if(n>=11904&&n<=40959||n>=44032&&n<=55215)return!0}return!1}var Fn="[\u2013\u2014-]";function Ot(t){let e=t.filter(r=>!Et(r)),n=t.filter(Et),i=[];return e.length&&i.push("(?:\\s+|\\s*"+Fn+"\\s*)("+$e(e)+")"),n.length&&i.push("\\s*("+$e(n)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var Be=Ot(Pn),zn=Ot(Ln);function Ce(t,e){let n=e.exec(t);if(!n)return null;let i=t.slice(0,n.index);return i.trim()===""?null:{base:i,label:(n[1]??n[2]??"").toLowerCase()}}function Pt(t){let e=q(String(t??"").trim().toLowerCase());if(!e)return null;for(let r of On)if(e.startsWith(r+" "))return xe[r]??"avg";for(let r of kt)if(e.startsWith(r+" ")||e===r)return xe[r]??"sum";let n=Ce(e,zn);if(n)return xe[n.label]??"avg";let i=Ce(e,Be);return i?xe[i.label]??"sum":null}var Wn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,$n=new RegExp("\\b("+En.join("|")+")\\b|("+Nn.join("|")+")$","i"),Bn=new RegExp("\\b("+kn.join("|")+")\\b|("+Dn.join("|")+")$","i");function Me(t){if(!t)return"";let e=String(t),n=q(e),i=Dt.exec(n);if(i)return e.slice(i[0].length).trim();let r=Ce(n,Be);return(r?e.slice(0,r.base.length):e).trim()}function Gn(t){if(!t)return!1;let e=q(String(t));return Dt.test(e)||Ce(e,Be)!==null}var Vn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],Nt=new RegExp("^\\s*("+[...Vn].sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Lt(t){if(t==null)return"";let e=String(t),n=Nt.exec(e);if(!n)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(n[1]),s=e.slice(n[0].length),a=0;for(;a<8;){let l=Nt.exec(s);if(!l||i(l[1])!==r)break;let o=s.slice(l[0].length);if(o.trim()==="")break;s=o,a++}return a===0?e:e.slice(0,n[0].length)+s}function Ge(t,e){if(!t||!e)return!1;let n=String(t);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&n.includes(r))return!0}return!1}var we={Sum:["Sum of "],Avg:["Average of "],Average:["Average of "],Count:["Count of "],CountNonNull:["Count of "],Min:["Min of ","First ","Earliest "],Max:["Max of ","Last ","Latest "],Median:["Median of "],StandardDeviation:["Standard deviation of "],Variance:["Variance of "]},Ft=new RegExp("^("+Object.keys(we).join("|")+")\\((.+)\\)$");function zt(t){if(!t)return[];let e=Ft.exec(String(t).trim());if(!e)return[];let n=we[e[1]],i=e[2],r=[];for(let s=i.indexOf(".");s>=0;s=i.indexOf(".",s+1)){if(s===0)continue;let a=i.slice(s+1);if(a.trim()!=="")for(let l of n){let o=l+a;r.includes(o)||r.push(o)}}return r}function Wt(t,e,n){let i=Ft.exec(String(t??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&n==="Decimal")return!0;let s=new Set(we[r]),a=String(e??""),l=i[2];for(let o=l.indexOf(".");o>=0;o=l.indexOf(".",o+1)){if(o===0)continue;let c=l.slice(o+1);if(c.trim()!==""){for(let u of Object.values(we))for(let g of u)if(!s.has(g)&&a===g+c)return!0}}return!1}function Kn(t){let e=Me(t);return e.length===0?"":e.replace(Wn," ")}function $t(t,e){if(!e)return!1;let n=Me(e);return t.test(q(Kn(e)))||t.test(q(n))||t.test(q(J(n).join(" ")))}function Bt(t){return $t(Bn,t)}function Un(t){return $t($n,t)||Bt(t)}var Gt=/int|double|decimal|single|float|number|currency|money/i;function Hn(t){let e=String(t?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||t?.isMeasure===!0||Gt.test(String(t?.dataType??""))?"Continuous":"Categorical"}function Yn(t){return t?.isMeasure===!0||Gt.test(String(t?.dataType??""))}function Vt(t){let e=t??{},n=Hn(e);if(n!=="Continuous")return{nature:n,additivity:"unknown",basis:"role",suppressed:!1};if(Bt(e.name))return{nature:n,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&Gn(e.name))){if(i==="additive")return{nature:n,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:n,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:n,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:n,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Un(e.name)?{nature:n,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:n,additivity:"additive",basis:"default",suppressed:!1}}function Kt(t){let e=Vt(t),n=t??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return Yn(n)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function Oi(t){return Kt(t)[0]}function Pi(t,e){return Kt(t).indexOf(e)>=0}function Li(t,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let n=Vt(t);return n.additivity==="additive"||n.additivity==="part_of_whole"||n.additivity==="unknown"}var jn={de:["nr","nummer","kennung","kennziffer","plz","postleitzahl"],nl:["nr","nummer"],sv:["nr","nummer"],da:["nr","nummer"],nb:["nr","nummer"],fi:["tunnus","koodi","nro"],hu:["azonos\xEDt\xF3","k\xF3d"],tr:["kod","kodu","numaras\u0131","numarasi"],zh:["\u7F16\u53F7","\u4EE3\u7801","\u7F16\u7801","\u53F7\u7801","\u90AE\u7F16"],ja:["\u756A\u53F7","\u30B3\u30FC\u30C9"],ko:["\uBC88\uD638","\uCF54\uB4DC"],hi:["\u0915\u094B\u0921","\u0915\u094D\u0930\u092E\u093E\u0902\u0915"],fr:["num\xE9ro"],es:["c\xF3digo"],pt:["c\xF3digo","cep"],it:["codice"],pl:["kod","numer"],cs:["k\xF3d","\u010D\xEDslo"],sk:["k\xF3d","\u010D\xEDslo"],hr:["\u0161ifra","oznaka"],ru:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],uk:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],el:["\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2"],ar:["\u0631\u0645\u0632","\u0643\u0648\u062F","\u0631\u0642\u0645"],he:["\u05E7\u05D5\u05D3"],id:["kode","nomor"],vi:["m\xE3"],th:["\u0E23\u0E2B\u0E31\u0E2A"]},Xn=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],Zn=["num\xE9ro"],qn=t=>t.normalize("NFC").toLowerCase();function Qn(t,e,n,i){let r=Ee(n);return!r||!t?null:t===e?"word":r.wordBreaks===!1?Array.from(e).length<nt?null:(i?t.startsWith(e):t.endsWith(e))&&t.length>e.length?"suffix":null:i?et(t,n).includes(e)?"word":null:r.script==="Hang"?tt(t,e)?"suffix":null:r.compounds&&Je(t,e,Qe)?"suffix":null}function Ut(t){let e=String(t??"").trim();if(!e)return null;let n=de(e),i=de(Me(e));for(let[r,s]of Object.entries(jn)){let a=Xn.includes(r),l=a?i:n;for(let o of s){let c=Zn.includes(o)||!!Ee(r)?.foldSensitive,u=c?l.words:l.folded;if(u.length===0)continue;let g=c?qn(o):de(o).folded.join(" "),d=Qn(a?u[0]:u[u.length-1],g,r,a);if(d)return{lang:r,word:o,view:d}}}return null}var Jn=[["Lu",/^\p{Lu}$/u],["Ll",/^\p{Ll}$/u],["Lt",/^\p{Lt}$/u],["Lm",/^\p{Lm}$/u],["Lo",/^\p{Lo}$/u],["Mn",/^\p{Mn}$/u],["Mc",/^\p{Mc}$/u],["Nd",/^\p{Nd}$/u]];function Te(t){for(let[e,n]of Jn)if(n.test(t))return e;return null}var er=[{id:"ascii",test:/^[A-Za-z]$/,ranges:[[65,90],[97,122]]},{id:"latin",test:/^[\u00C0-\u017F]$/u,ranges:[[192,383]]},{id:"cyrillic",test:/^[\u0400-\u045F\u0490-\u0491]$/u,ranges:[[1024,1119],[1168,1169]]},{id:"greek",test:/^[\u0386-\u03CE]$/u,ranges:[[902,974]]},{id:"han",test:/^[\u4E00-\u9FFF]$/u,ranges:[[19968,40959]]},{id:"hiragana",test:/^\p{Script=Hiragana}$/u,ranges:[[12353,12447]]},{id:"katakana",test:/^\p{Script=Katakana}$/u,ranges:[[12448,12543]]},{id:"hangul",test:/^[\uAC00-\uD7A3]$/u,ranges:[[44032,55203]]},{id:"arabic",test:/^[\u0620-\u0652\u0671-\u06D3]$/u,ranges:[[1568,1618],[1649,1747]]},{id:"hebrew",test:/^[\u05B0-\u05EA]$/u,ranges:[[1456,1514]]},{id:"devanagari",test:/^\p{Script=Devanagari}$/u,ranges:[[2304,2431]]},{id:"thai",test:/^\p{Script=Thai}$/u,ranges:[[3585,3662]]}],ve=new Map;function Ht(t,e,n,i){let r=ve.get(t);if(r)return r;let s=[];for(let[a,l]of e)for(let o=a;o<=l;o++){let c=String.fromCodePoint(o);Te(c)===n&&(i&&!i.test(c)||s.push(c))}return ve.set(t,s),s}function tr(t){let n=t.codePointAt(0);for(let a=0;a<9&&Te(String.fromCodePoint(n-1))==="Nd";a++)n--;let i="nd:"+n.toString(16),r=ve.get(i);if(r)return r;let s=[];for(let a=n;a<n+10;a++){let l=String.fromCodePoint(a);Te(l)==="Nd"&&s.push(l)}return ve.set(i,s),s}function nr(t,e){if(e==="Nd")return tr(t);for(let r of er)if(r.test.test(t))return Ht(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=t.codePointAt(0)&-128;return Ht("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function rr(t,e,n,i){let r=t.filter(s=>!e.has(s));return r.length===0&&(r=t.filter(s=>s!==n)),r.length===0?n:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var ir=/^[\p{L}\p{M}\p{Nd}]$/u,Yt=/^[\p{L}\p{Nd}]$/u;function jt(t,e){if(!t)return t??"";let n=new Set(Array.from(t)),i=u=>{let g=Te(u);return!g||!ir.test(u)?u:rr(nr(u,g),n,u,e)},r=u=>{let g=[];for(let d of u)g.push(i(d)),Yt.test(d)&&e()<.2&&g.push(i(d));if(g.length>6){let d=Math.floor(e()*Math.min(3,g.length-6));for(let y=0;y<d;y++)for(let w=0;w<5;w++){let A=Math.floor(e()*g.length);if(Yt.test(g[A])){g.splice(A,1);break}}}return g.join("")};if(!(t.includes("@")&&t.includes(".")))return r(t);let[a,l=""]=t.split("@"),o=l.endsWith(".com"),c=o?l.slice(0,-4):l;return`${r(a)}@${r(c)}${o?".com":""}`}var sr=/^[A-Za-z_$][A-Za-z0-9_$]*$/,or=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ar=new RegExp([String.raw`\bisMeasure\b`,String.raw`\bdataType\b`,String.raw`\bcolumns\s*\[\s*-?\d`,String.raw`\.iloc\s*\[[^\]]*,`,String.raw`\.iat\s*\[`,String.raw`\bselect_dtypes\b`,String.raw`\b_get_numeric_data\b`,String.raw`\bis_numeric_dtype\b`,String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`,String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`,String.raw`\bdf\.dtypes\b`,String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`,String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));function oe(t,e){if(!t||!e)return!1;let n=or(e);return new RegExp("['\"`]"+n+"['\"`]").test(t)?!0:sr.test(e)&&new RegExp("\\."+n+"(?![A-Za-z0-9_$])").test(t)}function lr(t){return!!t&&ar.test(t)}function Vi(t,e,n){return t?lr(t)?[...e]:[...n,...e].some(i=>oe(t,i))?e.filter(i=>oe(t,i)):[...e]:[]}var ur=5,cr=6,dr=3,te=864e5,mr=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,fr=/^(\d{4})[-/](\d{1,2})$/,gr=/^(\d{4})[-\s]?Q([1-4])$/i,pr=/^Q([1-4])[-\s](\d{4})$/i,hr=/^(\d{4})$/,yr=/^(\d{4})(0[1-9]|1[0-2])$/,br=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,Sr=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,_r=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Ve(t,e,n){let i=ee(t);if(!i)return 0;if(i==="sept")return 9;for(let a of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=Se(a)[i];if(l!==void 0)return l+1}let r=n?.get(i);if(r!==void 0)return r+1;let s=se(t);if(s.length>0){if(s.every(o=>o.month===s[0].month))return s[0].month+1;let a=Ze(String(e??"").split(/[-_]/)[0])?.code,l=s.find(o=>o.lang===a);if(l)return l.month+1}return 0}function Ar(t){let e=ge(t).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let n=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==n.n||i.year!==n.year)?null:Y(n.year,(n.n-1)*3+1,1)}function Y(t,e,n,i=0,r=0,s=0){if(!(t>=1&&e>=1&&e<=12&&n>=1&&n<=31))return null;let a=Date.UTC(t,e-1,n,i,r,s);if(!Number.isFinite(a))return null;let l=o=>o<10?"0"+o:String(o);return{ms:a,y:t,m:e,d:n,iso:`${t}-${l(e)}-${l(n)}`}}function xr(t,e){let n=[],i="";for(let o=0;o<e.length;o++){if(e[o]!=="%"){i+=e[o].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++o]){case"Y":n.push("Y"),i+="(\\d{4})";break;case"m":n.push("m"),i+="(\\d{1,2})";break;case"d":n.push("d"),i+="(\\d{1,2})";break;case"H":case"M":case"S":i+="\\d{1,2}";break;case"%":i+="%";break;default:return null}}let r=new RegExp("^"+i+"$").exec(t);if(!r)return null;let s=0,a=1,l=1;return n.forEach((o,c)=>{let u=+r[c+1];o==="Y"?s=u:o==="m"?a=u:l=u}),s?Y(s,a,l):null}function j(t,e,n,i){let r=(t??"").trim();if(r==="")return null;if(e){let o=xr(r,e);return o||null}let s=mr.exec(r);if(s)return Y(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=gr.exec(r),s)return Y(+s[1],(+s[2]-1)*3+1,1);if(s=pr.exec(r),s)return Y(+s[2],(+s[1]-1)*3+1,1);if(s=fr.exec(r),s&&+s[2]>=1&&+s[2]<=12)return Y(+s[1],+s[2],1);if(s=br.exec(r),s)return Y(+s[1],+s[2],+s[3]);if(s=yr.exec(r),s)return Y(+s[1],+s[2],1);if(s=hr.exec(r),s){let o=+s[1];return o>=1900&&o<=2100?Y(o,1,1):null}let a=Ar(r);if(a)return a;if(s=Sr.exec(r),s){let o=Ve(s[1],n,i);if(o)return Y(+s[2],o,1)}if(s=_r.exec(r),s){let o=Ve(s[2],n,i);if(o)return Y(+s[1],o,1)}let l=re(r);if(l){let o="month"in l?l.month:Ve(l.word,n,i);if(o)return Y(l.year,o,1)}return null}function Xt(t){let e=new Date(t).getUTCDay();return e>=1&&e<=5}function Zt(t,e){if(e<=t)return 0;let n=Math.round((e-t)/te),i=Math.floor(n/7),r=i*5,s=t+i*7*te;for(;s<e;)Xt(s)&&r++,s+=te;return r}function Cr(t){if(t.length===0)return 0;let e=[...t].sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function wr(t){return t>0?t<.95?"hour":t<=1.05?"day":t>=6.5&&t<=7.5?"week":t>=27&&t<=31.5?"month":t>=88&&t<=93?"quarter":t>=362&&t<=368?"year":"irregular":"irregular"}function ae(t,e,n,i){switch(n){case"year":return e.y-t.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(t.y*4+Math.floor((t.m-1)/3));case"month":return e.y*12+e.m-(t.y*12+t.m);case"week":return Math.round((e.ms-t.ms)/(7*te));case"weekday":return Zt(t.ms,e.ms);case"day":return Math.round((e.ms-t.ms)/te);default:return i>0?Math.round((e.ms-t.ms)/i):0}}function qt(t,e){return Ke(t,e)?.cadence??null}function Ke(t,e){let n=e?.gapFactor??ur,i=0,r=0,s=new Map,a=Array.from(t),l;if(!e?.pattern){let f=[];for(let C of a){if(C==null||C==="")continue;let b=re(String(C));b&&"word"in b&&f.push(b.word)}f.length>0&&(l=_e(f,e?.locale)??void 0)}for(let f of a){if(f==null||f==="")continue;i++;let C=j(String(f),e?.pattern,e?.locale,l);C&&(r++,s.set(C.ms,C))}let o=[...s.values()].sort((f,C)=>f.ms-C.ms);if(o.length<dr||i>0&&r/i<.8)return null;let c=o[o.length-1].ms-o[0].ms;if(c<=0)return null;let u=[];for(let f=1;f<o.length;f++)u.push(o[f].ms-o[f-1].ms);let g=Cr(u);if(!(g>0))return null;let d=wr(g/te);d==="day"&&c>=7*te&&o.every(f=>Xt(f.ms))&&Zt(o[0].ms,o[o.length-1].ms)+1>o.length*.5&&(d="weekday");let y=d==="irregular"?o.length:ae(o[0],o[o.length-1],d,g)+1,w=1,A=1,S=[],p=o[0],h=1;for(let f=1;f<o.length;f++){let C=ae(o[f-1],o[f],d,g);C>w&&(w=C),d!=="irregular"&&C>n?(A++,S.push({from:p.iso,to:o[f-1].iso,points:h}),p=o[f],h=1):h++}S.push({from:p.iso,to:o[o.length-1].iso,points:h});let x={grain:d,points:o.length,expectedPoints:Math.max(y,o.length),coveragePct:Math.round(o.length/Math.max(y,o.length)*1e3)/10,runs:A,largestGapUnits:w,gapFactor:n};return e?.includeBounds&&S.length<=cr&&(x.runBounds=S),{cadence:x,points:o,stepMs:g}}var Mr=8,Tr=.5,vr=200,Ir=new Set(["category","categories","subcategory","type","types","kind","class","classes","classification","segment","segments","tier","status","priority","severity","grade","level","band","bucket","group","channel","method","mode","stage","phase","period","shift","gender","sex","result","outcome","reason","flag","genre","sector","source"]),Rr=["category","classification","segment","status","priority","severity","channel"],Er=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function Nr(t){let e=J(t);if(e.length===0)return!1;let n=e[e.length-1];return Ir.has(n)?!0:Rr.some(i=>n.length>i.length&&n.endsWith(i))}function kr(t){if(t.isMeasure)return"measure";if(t.isTemporal||t.isDatePart||t.isReassembledDate)return"temporal";let e=Array.from(t.values).filter(n=>n!==""&&n!==null&&n!==void 0);return e.length<2||e.length>vr?"cardinality":t.rows>0&&e.length>=t.rows?"row-identity":t.isBinaryFlag?"flag":pe(e,t.locale)!==null?"ordinal":t.identifierNamed||t.dataType==="String"&&Er.has(be(e))?"identifier":!t.geoKind&&Nr(t.name)?"attribute":"entity"}function en(t){let e=-1,n=1/0,i=!1;return t.forEach((r,s)=>{if(kr(r)!=="entity")return;let a=new Set(Array.from(r.values).filter(o=>o!=="")).size,l=!!r.geoKind;(a<n||a===n&&l&&!i)&&(e=s,n=a,i=l)}),e}var Qt=t=>t<10?"0"+t:String(t);function Jt(t,e){switch(e){case"year":return`${t.y}-01-01`;case"quarter":return`${t.y}-${Qt(Math.floor((t.m-1)/3)*3+1)}-01`;case"month":return`${t.y}-${Qt(t.m)}-01`;case"hour":return new Date(t.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return t.iso}}function tn(t){let{periods:e,series:n}=t,i=Math.min(e.length,n.length),r=new Set;for(let C=0;C<i;C++)e[C]&&r.add(e[C]);let s=Ke(r,{pattern:t.pattern,locale:t.locale});if(!s)return null;let a=s.cadence.grain;if(a==="irregular")return null;let l=s.points[0],o=ae(l,s.points[s.points.length-1],a,s.stepMs)+1;if(o!==s.cadence.expectedPoints)return null;let c=new Map;for(let C of r){let b=j(C,t.pattern,t.locale);if(!b)continue;let _=ae(l,b,a,s.stepMs);_>=0&&_<o&&c.set(C,{idx:_,stamp:b})}let u=new Map;for(let C=0;C<i;C++){let b=n[C];if(!b)continue;let _=c.get(e[C]);if(!_)continue;let M=u.get(b);M||(M={seen:new Set,lo:_.idx,hi:_.idx,loStamp:_.stamp,hiStamp:_.stamp,order:u.size},u.set(b,M)),M.seen.add(_.idx),_.idx<M.lo&&(M.lo=_.idx,M.loStamp=_.stamp),_.idx>M.hi&&(M.hi=_.idx,M.hiStamp=_.stamp)}if(u.size<2)return null;let g=0;for(let C of u.values())g+=C.seen.size;if(g/(u.size*o)<(t.minFill??Tr))return null;let d=[],y=new Set,w=0,A=0,S=0,p=0,h=0,x=1;for(let[C,b]of u){for(let z of b.seen)y.add(z);if(b.seen.size>=o)continue;let _=[...b.seen].sort((z,X)=>z-X),M=1;for(let z=1;z<_.length;z++)M=Math.max(M,_[z]-_[z-1]);let W={key:C,acc:b,coverage:b.seen.size/o,before:b.lo,after:o-1-b.hi,interior:b.hi-b.lo+1-b.seen.size,gap:M};d.push(W),W.before>0&&w++,W.after>0&&A++,W.interior>0&&S++,p=Math.max(p,W.before),h=Math.max(h,W.after),x=Math.max(x,M)}if(d.length===0)return null;d.sort((C,b)=>C.coverage-b.coverage||C.acc.order-b.acc.order);let f=d.slice(0,t.maxListed??Mr);return{seriesColumn:t.seriesColumn,grain:a,periods:o,seriesCount:u.size,incompleteSeries:d.length,lateStarts:w,earlyEnds:A,withHoles:S,columnWideMissing:o-y.size,maxMissingBefore:p,maxMissingAfter:h,largestGap:x,series:f.map(C=>{let b={};return t.includeNames&&(b.name=C.key),t.includeDates&&(b.first=Jt(C.acc.loStamp,a),b.last=Jt(C.acc.hiStamp,a)),b.missingBefore=C.before,b.missingAfter=C.after,b.missingInterior=C.interior,b.largestGap=C.gap,b.coverage=Math.round(C.coverage*1e3)/1e3,b}),more:d.length-f.length}}var Ie=6;function le(t){let e=t.slice().sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function Dr(t){let e=t.length;if(e<Ie)return null;let n=t[0],i=t[0],r=0;for(let f of t)f<n&&(n=f),f>i&&(i=f),r+=f;if(n===i)return null;let s=le(t.map(Math.abs));if(s===0)return null;let a=[];for(let f=1;f<e;f++)a.push(t[f]-t[f-1]);let l=le(a.map(Math.abs))/s,o=(e-1)/2,c=r/e,u=0,g=0,d=0;for(let f=0;f<e;f++)u+=(f-o)*(t[f]-c),g+=(f-o)*(f-o),d+=(t[f]-c)*(t[f]-c);d/=e;let y=u/g,w=c-y*o,A=t.map((f,C)=>f-(w+y*C)),S=A.reduce((f,C)=>f+C,0)/e,p=0,h=0;for(let f=0;f<e;f++)p+=(A[f]-S)*(A[f]-S),f>0&&(h+=(A[f]-A[f-1])*(A[f]-A[f-1]));return p/=e,h/=e-1,{vnDetrended:p<=d*1e-12?2:h/p,relStep:l}}function Ue(t){let{stamps:e,series:n,values:i}=t,r=Math.min(e.length,i.length),s=new Map;for(let c=0;c<r;c++){let u=e[c],g=i[c];if(u===null||g===null||!Number.isFinite(g))continue;let d="";if(n&&(d=n[c]??"",d===""))continue;let y=s.get(d);y||s.set(d,y=new Map),y.set(u,(y.get(u)??0)+g)}let a=[],l=[],o=[];for(let c of s.values()){let u=[...c.entries()].sort((d,y)=>d[0]-y[0]).map(d=>d[1]),g=Dr(u);g&&(a.push(g.vnDetrended),l.push(g.relStep),o.push(u.length))}return a.length===0?null:{series:a.length,points:Math.round(le(o)),vnDetrended:Math.round(le(a)*1e3)/1e3,relStep:Math.round(le(l)*1e4)/1e4}}function ts(t){let e=t.times.map(n=>j(n,t.pattern,t.locale)?.ms??null);return Ue({stamps:e,series:t.series,values:t.values})}var Or=5e5,Pr=8,Lr=4,Fr=5,He=1,Ye=2,zr=4,Wr=8;function $r(t,e,n){let[i,r]=[...t];if(e.isTemporal){let s=j(i,e.temporalTextPattern,n),a=j(r,e.temporalTextPattern,n);if(s&&a&&s.ms!==a.ms)return s.ms<a.ms?{a:i,b:r,setOrder:"temporal"}:{a:r,b:i,setOrder:"temporal"}}return i<r?{a:i,b:r,setOrder:"none"}:{a:r,b:i,setOrder:"none"}}function Br(t,e,n){let{rows:i,text:r,locale:s}=t,a=$r(n.values,n,s),l=new Uint8Array(i.length),o=0;for(let c=0;c<i.length;c++){let u=r(i[c][e]);u===a.a?l[c]=1:u===a.b?l[c]=2:o++}return{code:l,blankRows:o,setOrder:a.setOrder}}function Gr(t,e){let{rows:n,text:i}=t,r=new Int32Array(n.length),s=new Map;for(let a=0;a<n.length;a++){let l=i(n[a][e]);if(l===""){r[a]=-1;continue}let o=s.get(l);o===void 0&&(o=s.size,s.set(l,o)),r[a]=o}return{ids:r,dict:s}}function Vr(t,e,n){let i=new Uint8Array(n);for(let s=0;s<t.length;s++){let a=e[s];if(a===0)continue;let l=t[s];if(l<0)continue;let o=i[l];i[l]=o&a?o|a<<2:o|a}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let s=0;s<n;s++){let a=i[s];a&He&&r.keysA++,a&Ye&&r.keysB++,(a&(He|Ye))===(He|Ye)&&r.keysBoth++,a&zr&&r.dupA++,a&Wr&&r.dupB++}return r}function Kr(t,e){let n=(t.dupA+t.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(t.keysA+t.keysB);return n<i||n===i&&t.keysBoth>e.keysBoth}var nn=t=>t==null||typeof t=="string"&&t.trim()==="";function Ur(t,e,n){if(t===e)return!0;let i=nn(t),r=nn(e);return i||r?i&&r:typeof t=="number"&&typeof e=="number"?!1:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():n(t).trim()===n(e).trim()}function rn(t){let{rows:e,columns:n}=t,i=e.length;if(i<2||i>Or)return null;let r=n.map((b,_)=>({c:b,i:_})).filter(({c:b})=>!b.isMeasure&&!b.isTemporal&&!b.isDatePart&&b.distinct>=Fr).sort((b,_)=>(_.c.identifierNamed?1:0)-(b.c.identifierNamed?1:0)||_.c.distinct-b.c.distinct||b.i-_.i).slice(0,Pr),s=n.map((b,_)=>({c:b,i:_})).filter(({c:b})=>!b.isMeasure&&b.values!==null&&b.values.size===2).slice(0,Lr);if(r.length===0||s.length===0)return null;let a=s.map(({c:b,i:_})=>Br(t,_,b)),l=null;for(let{i:b}of r){let _=Gr(t,b);for(let M=0;M<s.length;M++){if(s[M].i===b)continue;let W=Vr(_.ids,a[M].code,_.dict.size);W.keysBoth<1||(!l||Kr(W,l.tally))&&(l={tally:W,keyIdx:b,setNo:M,ids:_.ids,dict:_.dict})}}if(!l)return null;let{ids:o,dict:c,tally:u}=l,g=a[l.setNo],d=s[l.setNo].i,y=c.size,w=new Int32Array(y).fill(-1),A=new Int32Array(y).fill(-1);for(let b=0;b<i;b++){let _=g.code[b],M=o[b];_===0||M<0||(_===1?w[M]<0&&(w[M]=b):A[M]<0&&(A[M]=b))}let S=[];for(let b=0;b<n.length;b++)b!==l.keyIdx&&b!==d&&S.push(b);let p=0;for(let b=0;b<y;b++){let _=w[b],M=A[b];if(_<0||M<0)continue;let W=e[_],z=e[M],X=!0;for(let Q of S)if(!Ur(W[Q],z[Q],t.text)){X=!1;break}X&&p++}let h=p===u.keysBoth?100:p===0?0:Math.min(99,Math.max(1,Math.round(p/u.keysBoth*100))),x=new Map,f=new Map;for(let[b,_]of c){let M=w[_]>=0,W=A[_]>=0;if(!M&&!W)continue;let z=ct(b);dt(z)&&(M&&x.set(z,(x.get(z)??0)+1),W&&f.set(z,(f.get(z)??0)+1))}let C=b=>{let _=0;for(let M of b.values())M>=2&&(_+=M);return _};return{key:l.keyIdx,discriminator:d,pairing:{form:"long",key:n[l.keyIdx].name,discriminator:n[d].name,keysA:u.keysA,keysB:u.keysB,keysBoth:u.keysBoth,duplicateKeysA:u.dupA,duplicateKeysB:u.dupB,identicalPct:h,discriminatorBlankRows:g.blankRows,looseCollisionsA:C(x),looseCollisionsB:C(f),setOrder:g.setOrder}}}var Hr=t=>t==="Integer"||t==="Decimal";function Yr(t){let e=[],n=[];return t.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||n.push(r)}}),[...e,...n].slice(0,6)}function jr(t,e){let n=[];for(let i=0;i<t.length&&n.length<12;i++){let r=t[i];e.has(i)||!Hr(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||n.push(i)}return n}function sn(t){let e=new Map,{rows:n,columns:i,text:r}=t;if(n.length===0||n.length>(t.maxRows??5e5))return e;let s=Yr(i);if(s.length===0)return e;let a=jr(i,new Set(s));if(a.length===0)return e;let l=s.map(o=>{let[c,u]=i[o].twoValues,g=new Uint8Array(n.length);for(let d=0;d<n.length;d++){let y=r(n[d][o]);g[d]=y===c?1:y===u?2:0}return g});for(let o of a){let c=new Float64Array(n.length),u=0;for(let h=0;h<n.length;h++){let x=n[h][o],f=x==null||x===""?NaN:typeof x=="number"?x:parseFloat(x);c[h]=f,f===f&&f!==1/0&&f!==-1/0&&u++}if(u<2)continue;let g=new Float64Array(u);for(let h=0,x=0;h<n.length;h++){let f=c[h];f===f&&f!==1/0&&f!==-1/0&&(g[x++]=f)}g.sort();let d=new Float64Array(u),y=0;for(let h=0;h<u;h++)(h===0||g[h]!==g[h-1])&&(d[y++]=g[h]);let w=new Int32Array(n.length).fill(-1);for(let h=0;h<n.length;h++){let x=c[h];if(!(x===x&&x!==1/0&&x!==-1/0))continue;let f=0,C=y-1;for(;f<C;){let b=f+C>>>1;d[b]<x?f=b+1:C=b}w[h]=f}let A=[],S=new Int32Array(y),p=new Int32Array(y);for(let h=0;h<s.length;h++){let x=l[h];S.fill(0),p.fill(0);let f=0,C=0;for(let U=0;U<n.length;U++){let m=w[U];m<0||(x[U]===1?(S[m]++,f++):x[U]===2&&(p[m]++,C++))}if(f===0||C===0)continue;let b=f<=C,_=b?f:C,M=b?C:f,W=b?S:p,z=b?p:S,X=0,Q=0,ue=0;for(let U=0;U<y;U++){let m=W[U],T=z[U];X+=m*(Q+.5*T),Q+=T,m+T>=2&&(ue+=m+T)}A.push({outcome:i[s[h]].name,aucMinorityHigh:Math.round(X/(_*M)*1e4)/1e4,nMinority:_,nMajority:M,ties:ue})}A.length>0&&e.set(o,A)}return e}var Xr=12,Zr=100,qr=.3,Qr=.9,Jr=120,ei=1900,ti=2100,ni=0,ri=20,ii=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Re(t){if(!t)return!1;let e=J(t);return e.length===0?!1:ii.has(e[e.length-1])?!0:Ut(t)!==null}var si=new Set(["year","yr","fy"]),oi=t=>J(t).some(e=>si.has(e))||ut(t)!==null,ai=/^(?:(?:19|20)\d{2}(?:[-/ ]?(?:q[1-4]|w(?:0?[1-9]|[1-4]\d|5[0-3])|(?:0?[1-9]|1[0-2])))?|q[1-4][-/ ](?:19|20)\d{2}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*[-/ ]?(?:19|20)?\d{2})$/i;function je(t){if(!Number.isInteger(t)||t<190001||t>210012)return!1;let e=t%100;return e>=1&&e<=12}function Xe(t){if(!Number.isInteger(t)||t<19000101||t>21001231)return!1;let e=Math.floor(t/100)%100,n=t%100;return e>=1&&e<=12&&n>=1&&n<=31}var li=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,ui=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,ci=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function un(t,e){let n=[],i=0,r=di(t,e,n,()=>{i++});if(r)return r;if(i>0||n.length<2)return null;let s=It(n,{locale:e,floor:.8});return!s||!s.pattern||s.form==="named"?null:{pattern:s.pattern,orderFrom:s.orderFrom==="shape"?s.order==="ymd"?"iso":"shape":s.orderFrom}}function di(t,e,n,i){let r=0,s=0,a=0,l=0,o=0,c="",u=0,g="",d=0,y=0,w=0,A=0,S=!1;for(let b of t){if(b==null)continue;let _=String(b).trim();if(_==="")continue;r++,n.push(_);let M;if(M=li.exec(_)){i();let W=+M[2],z=+M[3];W>=1&&W<=12&&z>=1&&z<=31&&(s++,M[4]!==void 0&&a++,M[6]!==void 0&&l++)}else if(M=ui.exec(_)){i();let W=+M[3],z=+M[4];W>=1&&W<=12&&z>=1&&z<=31&&(c&&c!==M[2]&&(S=!0),c=M[2],o++)}else if(M=ci.exec(_)){i();let W=+M[1],z=+M[3];W>=1&&W<=31&&z>=1&&z<=31&&(W<=12||z<=12)&&(g&&g!==M[2]&&(S=!0),g=M[2],u++,W>12&&w++,z>12&&A++,M[5]!==void 0&&d++,M[7]!==void 0&&y++)}if(r>=200)break}if(r<2||(s+o+u)/r<.8||(s>0?1:0)+(o>0?1:0)+(u>0?1:0)!==1||S)return null;if(s>0)return a===s?{pattern:l===s?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(o>0)return{pattern:`%Y${c}%m${c}%d`,orderFrom:"iso"};if(w>0&&A>0)return null;let x,f;w>0?(x=!0,f="values"):A>0?(x=!1,f="values"):g==="."?(x=!0,f="shape"):(x=!ze(e),f="locale");let C=x?`%d${g}%m${g}%Y`:`%m${g}%d${g}%Y`;return d===u?{pattern:C+(y===u?" %H:%M:%S":" %H:%M"),orderFrom:f}:{pattern:C,orderFrom:f}}function mi(t,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(t))return!1;let n=t.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!n)return!1;let i=ee(n);return i.length>0&&e[i]!==void 0}function fi(t,e){let n=new Map,i=new Map;for(let l of t){let o=re(l);if(!o||"month"in o)continue;let c=se(o.word),u=c.some(d=>d.lang==="en"),g=ee(o.word);for(let d of new Set(c.map(y=>y.lang)))d!=="en"&&(n.has(d)||(n.set(d,new Set),i.set(d,new Set)),n.get(d).add(g),u||i.get(d).add(g))}let r=[...n.keys()].filter(l=>n.get(l).size>=3&&i.get(l).size>=1),s=0,a=new Map(r.map(l=>[l,0]));for(let l of e){let o=re(l);if(!o)continue;if("month"in o){s++;continue}let c=se(o.word);if(c.length===0)continue;let u=c.some(g=>g.lang==="en");for(let g of r)(u||c.some(d=>d.lang===g))&&a.set(g,a.get(g)+1)}return s+Math.max(0,...a.values())}var gi=/(?:19|20)[0-9]{2}/;function pi(t){let e=new Map,n=0;for(let r of t){if(!gi.test(ne(r)))continue;let s=new Set(ge(r).filter(a=>a.yearDigits===4&&(a.grain==="quarter"||a.grain==="week")).map(a=>a.lang));if(s.size!==0){if(s.has("en")){n++;continue}for(let a of s)e.set(a,(e.get(a)??0)+1)}}let i=0;for(let r of e.values())i=Math.max(i,r);return i>0?i+n:0}function hi(t){let{dataType:e,name:n,isMeasure:i,distinctCount:r}=t;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=t.minNum,a=t.maxNum;if(!(s!=null&&a!=null&&Number.isFinite(s)&&Number.isFinite(a)&&Number.isInteger(s)&&Number.isInteger(a)&&a>=s))return!1;let o=s>=1900&&a<=2100;if(o&&r>=2&&oi(n)||o&&r>=3&&r===a-s+1)return!0;let c=je(s)&&je(a),u=Xe(s)&&Xe(a);if(c||u){if(!t.sampleValues)return!0;let g=0,d=0;for(let y of t.sampleValues){if(y==null||y==="")continue;g++;let w=Number(String(y).trim());if(Number.isFinite(w)&&(c?je(w):Xe(w))&&d++,g>=60)break}if(g>=2&&d===g)return!0}return!1}if(t.sampleValues){let s=t.locale?Se(t.locale):null,a=0,l=0,o=[],c=[];for(let u of t.sampleValues){if(u==null||u==="")continue;a++;let g=String(u).trim();if(o.push(g),ai.test(g)||mi(g,s)?l++:c.push(g),a>=60)break}if(a>=2&&l/a>=.8||a>=2&&(l+pi(c)+fi(o,c))/a>=.8||un(o,t.locale)!==null)return!0}return!1}function yi(t){let e=q((t||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":Pt(t)}function bi(t){let{rows:e,measureColIdx:n,measureName:i,candidateDims:r,minNum:s,maxNum:a,discourageAgg:l}=t,o=100,c=.01,u="";for(let d of r){if(d.distinct<2||d.distinct>o)continue;let y=r.filter(h=>h.idx!==d.idx).map(h=>h.idx),w=new Map;for(let h of e){let x=h[n];if(typeof x!="number"||!Number.isFinite(x))continue;let f=y.length?y.map(b=>String(h[b])).join(u):"",C=w.get(f);C||(C={sum:0,cset:new Set},w.set(f,C)),C.sum+=x,C.cset.add(String(h[d.idx]))}let A=0,S=0,p=0;for(let h of w.values())h.cset.size<2||(p++,Math.abs(h.sum-100)<=100*c?A++:Math.abs(h.sum-1)<=1*c&&S++);if(p>=2&&(A/p>=.9||S/p>=.9))return{additivity:"part_of_whole",partOfWholeDim:d.name}}if(l)return{additivity:"intensive_rate"};let g=yi(i);return g==="avg"||g==="min"||g==="max"?{additivity:"intensive_rate"}:g==="count"?{additivity:"additive"}:g==="sum"?{additivity:"unknown"}:s!=null&&a!=null&&Number.isFinite(s)&&Number.isFinite(a)&&s>=0&&a<=1.0001&&a>0?{additivity:"intensive_rate"}:{additivity:"unknown"}}function cn(t){let{dataType:e,isMeasure:n,name:i,distinct:r,nonblank:s,prec:a,maxval:l,minval:o}=t,c=l-o+1,u=c>0?r/c:1,g=s>0?r/s:0,d=e==="Decimal"||a>0;return!n&&Re(i)?"Categorical":u>=Qr&&(mt(i)&&r<=Jr||o>=ei&&l<=ti||o>=ni&&l<=ri)?"Ordinal":n||r>Xr&&(d||r>=Zr||g>=qr)?"Continuous":"Categorical"}function an(t,e,n){return!t||t.isMeasure||e||t.dataType!=="Integer"&&t.dataType!=="Decimal"?!1:cn({dataType:t.dataType,isMeasure:!1,name:t.name,distinct:n.distinct,nonblank:n.nonblank,prec:n.prec,maxval:typeof n.maxval=="number"?n.maxval:0,minval:typeof n.minval=="number"?n.minval:0})==="Continuous"}function Si(t){let e=null;for(let n=0;n<t.length;n++){let i=t[n];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=t.slice()),e[n]=r)}return e||t}var ln=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;deriveProvinces=!0;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let n=0;n<this._cols.length;n++){let i=this._cols[n];!i||!/date|time/i.test(String(i.dataType??""))||at(this._rows.map(r=>r[n]))&&e.add(n)}return e}STR(e){return e==null?"":e instanceof Date?this.wholeDayIso(e)??(isNaN(e.getTime())?"":e.toISOString()):e.toString()}getPrecision(e){if(!isFinite(e))return 0;let i=e.toString().split(".")[1];return i?i.length:0}getColumns(){return this._cols}inferredMeasureFlags(){if(this._inferredMeasureFlags)return this._inferredMeasureFlags;let e=this._cols.map(n=>!!(n&&n.isMeasure));return this._cols.forEach((n,i)=>{if(!n||n.isMeasure||this._declaredDimensions.has(n)||n.dataType!=="Integer"&&n.dataType!=="Decimal")return;let r=new Set,s=0,a=0,l=null,o=null;for(let c of this._rows){let u=c[i],g=this.STR(u);if(g!=""&&(r.add(g),s++,(l===null||u<l)&&(l=u),(o===null||u>o)&&(o=u),n.dataType=="Decimal")){let d=this.getPrecision(u);d>a&&(a=d)}}e[i]=an(n,!1,{distinct:r.size,nonblank:s,prec:a,minval:l,maxval:o})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let n of e)n&&this._declaredDimensions.add(n)}wholeDayIso(e){return ot(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,n){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),a=[],l=[],o=[];for(let m of this._cols){let T=new Map,O=[],D=0,v=0,k=0,F=null,P=null,N=null,G=!1,V=!0,R=!0,E=null,K=!1,L=s.has(i);for(let I of this._rows){let $=I[i],B=L&&$ instanceof Date?fe($):$,H=this.STR(B);if(H!=""){if(D+=H.length,T.set(H,(T.get(H)||0)+1),v++,m.dataType=="Integer"||m.dataType=="Decimal"||m.dataType=="DateTime")if((F===null||B<F)&&(F=B),(P===null||B>P)&&(P=B),m.dataType=="Integer"||m.dataType=="Decimal"){if(N===null?N=B:N+=B,m.dataType=="Decimal"){let Z=this.getPrecision(B);Z>k&&(k=Z)}O.push(B)}else G=G||this.hasTimeComponent(B);K&&(B<E?V=!1:B>E&&(R=!1)),E=B,K=!0}}if(v>=3&&(V&&!R?m.sortedDirection="asc":R&&!V?m.sortedDirection="desc":m.sortedDirection="none"),v>0&&T.size>0&&!m.isMeasure){let I=0,$=Number.MAX_SAFE_INTEGER;for(let B of T.values())B>I&&(I=B),B<$&&($=B);if(m.modalShare=I/v,m.minGroupCount=$===Number.MAX_SAFE_INTEGER?null:$,T.size===2){let B=[...T.keys()].map(ce=>rt(ce).trim().toLowerCase()).sort(),Z=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ce=>B[0]===ce[0]&&B[1]===ce[1]),dn=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(m.name);(Z||dn)&&(m.isBinaryFlag=!0)}}else m.isMeasure&&(m.dataType==="Integer"||m.dataType==="Decimal")&&T.size===2&&T.has("0")&&T.has("1")&&(m.isBinaryFlag=!0);if(m.dataType=="DateTime"&&(m.dateWithTime=G,G&&lt(L?this._rows.map(I=>I[i]instanceof Date?fe(I[i]):I[i]):this._rows.map(I=>I[i]))?m.timeOfDayOnly=!0:delete m.timeOfDayOnly),m.isTemporal=hi({dataType:m.dataType,name:m.name,isMeasure:m.isMeasure,distinctCount:T.size,minNum:typeof F=="number"?F:null,maxNum:typeof P=="number"?P:null,sampleValues:T.keys(),locale:n}),m.isTemporal&&m.dataType==="String"&&!m.isMeasure){let I=un(T.keys(),n);I&&(m.temporalTextPattern=I.pattern)}if(m.timeOfDayOnly)delete m.temporalCadence;else if(m.isTemporal&&!m.isMeasure){let I=qt(T.keys(),{includeBounds:r>=20,pattern:m.temporalTextPattern,locale:n});I&&(m.temporalCadence=I)}this.updateColumnStats10(r,m,v,T,k,P,F),this.updateColumnStats20(r,O,v,N,m,D,G,F,P,k,T,n),an(m,this._declaredDimensions.has(m),{distinct:T.size,nonblank:v,prec:k,minval:F,maxval:P})&&(m.isMeasure=!0,m.geoKind=void 0,m.geoMatchPct=void 0,m.geoAmbiguous=void 0,m.dominantGeoRegion=void 0,m.dominantGeoRegionPct=void 0,m.geoRegionCount=void 0),a[i]=m.isMeasure||T.size>2e3?null:new Set(T.keys()),l[i]=T.size,o[i]=T.size===2?[...T.keys()].sort():null,i++}Mt(this._cols,this._rows,{cities:this.deriveProvinces}).forEach((m,T)=>{let O=this._cols[T];m.kind&&(O.geoKind=m.kind,O.geoMatchPct=m.matchPct,m.ambiguous&&(O.geoAmbiguous=!0)),m.rollupPct!==void 0&&(O.admin1RollupPct=m.rollupPct),m.regionCount!==void 0&&(O.admin1RegionCount=m.regionCount),m.countryCount!==void 0&&(O.admin1CountryCount=m.countryCount),m.dominantRegion&&(O.dominantGeoRegion=m.dominantRegion,O.dominantGeoRegionPct=m.dominantRegionPct)});let c=this.getGeoExtent();if(c&&c.dominantFrame&&this._geoExtentLatIdx>=0){let m=this._cols[this._geoExtentLatIdx];m.geoKind||(m.dominantGeoRegion=c.dominantFrame,m.dominantGeoRegionPct=c.dominantFramePct,this.deriveProvinces&&(m.admin1RollupPct=c.dominantFramePct))}let u=[];this._cols.forEach((m,T)=>{m.isMeasure||u.push({idx:T,distinct:m.distinctCount??0,name:m.name})}),this._cols.forEach((m,T)=>{if(!m.isMeasure)return;let O=typeof m.lowValue=="number"?m.lowValue:null,D=typeof m.highValue=="number"?m.highValue:null,v=bi({rows:this._rows,measureColIdx:T,measureName:m.name,candidateDims:u,minNum:O,maxNum:D,discourageAgg:!!m.discourageAggregationAcrossGroups});m.additivity=v.additivity,v.partOfWholeDim&&(m.partOfWholeDim=v.partOfWholeDim)});let g=50,d=4,y=u.filter(m=>m.distinct>=2&&m.distinct<=g);this._cols.forEach((m,T)=>{if(!m.isMeasure)return;let O=[];for(let R of this._rows){let E=R[T];if(E==null||E==="")continue;let K=typeof E=="number"?E:parseFloat(E);isNaN(K)||O.push(K)}if(O.length===0)return;let D=[...O].sort((R,E)=>R-E);if(D[0]===D[D.length-1])m.relativeDispersion=0;else if(D.length>=d){let R=me(D,.5),E=me(D,.1),K=me(D,.9);m.relativeDispersion=Math.abs(R)>1e-9?Math.round((K-E)/Math.abs(R)*1e3)/1e3:void 0}else m.relativeDispersion=void 0;let v=[];for(let R of y){let E=new Set;for(let K of this._rows){let L=K[T];L==null||L===""||E.add(this.STR(K[R.idx])+"")}v.push({otherColumn:R.name,nonBlankGroupCount:E.size})}v.length>0&&(m.nonBlankGroups=v);let k=0;for(let R of O)k+=R;k/=O.length;let F=0;for(let R of O)F+=(R-k)*(R-k);if(F<=1e-12)return;let P=[],N=[],G=R=>{if(R.length<4)return NaN;let E=[...R].sort((L,I)=>L-I),K=L=>E[Math.min(E.length-1,Math.max(0,Math.floor(L*(E.length-1))))];return K(.75)-K(.25)},V=G(O);for(let R of y){let E=new Map;for(let I of this._rows){let $=I[T];if($==null||$==="")continue;let B=typeof $=="number"?$:parseFloat($);if(isNaN(B))continue;let H=this.STR(I[R.idx])+"",Z=E.get(H);Z?(Z.s+=B,Z.n++,Z.vals.push(B)):E.set(H,{s:B,n:1,vals:[B]})}let K=0;for(let I of E.values()){let $=I.s/I.n;K+=I.n*($-k)*($-k)}P.push({otherColumn:R.name,eta2:Math.round(K/F*1e4)/1e4});let L=[];for(let I of E.values()){let $=G(I.vals);isNaN($)||L.push($)}if(L.length>=2&&isFinite(V)&&V>1e-9){let I=(Math.max(...L)-Math.min(...L))/V;N.push({otherColumn:R.name,spreadRatio:Math.round(I*1e4)/1e4})}}P.length>0&&(m.groupDiscrimination=P),N.length>0&&(m.spreadDiscrimination=N)});let w=.97,A=.8,S=8,p=5,h=this._cols.map((m,T)=>({c:m,i:T})).filter(m=>m.c.isMeasure);for(let m=0;m<h.length;m++)for(let T=m+1;T<h.length;T++){let O=h[m].i,D=h[T].i,v=0,k=0,F=0,P=0,N=0,G=0;for(let L of this._rows){let I=L[O],$=L[D];if(I==null||I===""||$===null||$===void 0||$==="")continue;let B=typeof I=="number"?I:parseFloat(I),H=typeof $=="number"?$:parseFloat($);isNaN(B)||isNaN(H)||(v++,k+=B,F+=H,P+=B*B,N+=H*H,G+=B*H)}if(v<p)continue;let V=v*P-k*k,R=v*N-F*F;if(V<=1e-12||R<=1e-12)continue;let E=(v*G-k*F)/Math.sqrt(V*R),K=Math.min(1,Math.round(Math.abs(E)*1e3)/1e3);for(let L of[h[m].c,h[T].c])(L.maxAbsMeasureCorrelation===void 0||K>L.maxAbsMeasureCorrelation)&&(L.maxAbsMeasureCorrelation=K);if(Math.abs(E)>=w){let L=h[m].c,I=h[T].c;L.collinearWithMeasures||(L.collinearWithMeasures=[]),I.collinearWithMeasures||(I.collinearWithMeasures=[]),L.collinearWithMeasures.push(I.name),I.collinearWithMeasures.push(L.name)}else if(Math.abs(E)>=A){let L=h[m].c,I=h[T].c,$=Math.round(E*1e3)/1e3;L.correlatedWithMeasures||(L.correlatedWithMeasures=[]),I.correlatedWithMeasures||(I.correlatedWithMeasures=[]),L.correlatedWithMeasures.push({otherColumn:I.name,r:$}),I.correlatedWithMeasures.push({otherColumn:L.name,r:$})}}for(let{c:m}of h)m.correlatedWithMeasures&&(m.correlatedWithMeasures.sort((T,O)=>Math.abs(O.r)-Math.abs(T.r)||(T.otherColumn<O.otherColumn?-1:1)),m.correlatedWithMeasures.length=Math.min(m.correlatedWithMeasures.length,S));for(let m=0;m<this._cols.length;m++){let T=a[m];if(!T||T.size===0)continue;let O=[];for(let D=0;D<this._cols.length;D++){if(D===m)continue;let v=a[D];if(!v||v.size===0)continue;let k=0;for(let P of T)v.has(P)&&k++;let F=Math.round(k/T.size*100);F>0&&O.push({otherColumn:this._cols[D].name,percentShared:F})}O.length>0&&(this._cols[m].sharedValueRatioWithOthers=O)}let x=50,f=[];for(let m=0;m<this._cols.length;m++){let T=a[m];T&&T.size>=2&&T.size<=x&&f.push(m)}if(f.length>=2){let m=new Map,T=(D,v)=>D+":"+v;for(let D=0;D<f.length;D++)for(let v=D+1;v<f.length;v++)m.set(T(f[D],f[v]),new Map);for(let D of this._rows)for(let v=0;v<f.length;v++){let k=this.STR(D[f[v]])+"";for(let F=v+1;F<f.length;F++){let P=""+this.STR(D[f[F]]),N=m.get(T(f[v],f[F])),G=k+""+P;N.set(G,(N.get(G)??0)+1)}}let O=new Map;for(let D=0;D<f.length;D++)for(let v=D+1;v<f.length;v++){let k=f[D],F=f[v],P=a[k].size,N=a[F].size,G=m.get(T(k,F)),V=G.size,R=0;for(let I of G.values())(R===0||I<R)&&(R=I);let E=Math.round(V/(P*N)*100),K=V===P,L=V===N;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[F].name,fillPct:E,determinesOther:K,minCellCount:R,distinctCombinations:V}),(this._cols[F].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:E,determinesOther:L,minCellCount:R,distinctCombinations:V}),K&&P>N){let I=O.get(k);(!I||N<I.card)&&O.set(k,{name:this._cols[F].name,card:N,ratio:N/P})}if(L&&N>P){let I=O.get(F);(!I||P<I.card)&&O.set(F,{name:this._cols[k].name,card:P,ratio:P/N})}}for(let[D,v]of O)this._cols[D].primaryParentColumn=v.name,this._cols[D].nestingRatio=Math.round(v.ratio*100)/100}let C=6,b=this._rows.length;for(let m=0;m<this._cols.length;m++){let T=this._cols[m];if(T.isMeasure||T.primaryParentColumn)continue;let O=T.distinctCount??0;if(O<=x||b>0&&O>=b)continue;let D=[];for(let v=0;v<this._cols.length;v++){if(v===m)continue;let k=this._cols[v];if(k.isMeasure)continue;let F=k.distinctCount??0;F<2||F>=O||D.push(v)}D.sort((v,k)=>(this._cols[v].distinctCount??0)-(this._cols[k].distinctCount??0));for(let v of D.slice(0,C)){let k=new Map,F=!0;for(let N of this._rows){let G=this.STR(N[m])+"",V=this.STR(N[v])+"",R=k.get(G);if(R===void 0)k.set(G,V);else if(R!==V){F=!1;break}}if(!F)continue;let P=this._cols[v].distinctCount??0;T.primaryParentColumn=this._cols[v].name,T.nestingRatio=Math.round(P/O*100)/100;break}}let _=.01,M=.05,W=.95,z=8,X=8,Q=6,ue=500,U=[];for(let m=0;m<this._cols.length&&U.length<X;m++){let T=this._cols[m].dataType;(T==="Double"||T==="Integer"||T==="Decimal")&&U.push(m)}if(U.length>=3&&this._rows.length>=z){let m=Math.min(this._rows.length,ue),T=U.map(P=>{let N=[];for(let R=0;R<m;R++){let E=this._rows[R][P],K=typeof E=="number"?E:parseFloat(String(E).replace(/,/g,""));if(E==null||E===""||!isFinite(K))return null;N.push(K)}let G=N[0],V=!1;for(let R of N)if(R!==G){V=!0;break}return V?N:null}),O=U.map((P,N)=>N).filter(P=>T[P]!==null),D=P=>{let N=P.slice().sort((V,R)=>V-R),G=N.length>>1;return N.length%2?N[G]:(N[G-1]+N[G])/2},v=null,k=[],F=P=>{if(k.length>=3){let N=k.map(E=>T[E]),G=N[0].length,V=new Array(G);for(let E=0;E<G;E++){let K=0;for(let L of N)K+=L[E];V[E]=K}let R=D(V);if(R>0){let E=0;for(let L of V)Math.abs(L-R)<=R*_&&E++;let K=E/G;if(K>=W){let L=1;for(let I of N){let $=D(I)/R;$<L&&(L=$)}L>=M&&(!v||k.length>v.cols.length)&&(v={cols:k.slice(),total:R,matched:K})}}}if(!(k.length>=Q))for(let N=P;N<O.length;N++)k.push(O[N]),F(N+1),k.pop()};if(F(0),v){let P=v,G={columns:P.cols.map(V=>this._cols[U[V]].name),total:Math.round(P.total*1e3)/1e3,matchedPct:Math.round(P.matched*100)/100};for(let V of P.cols)this._cols[U[V]].constantSumGroup=G}}return this.applyTwoSetPairing(n,a),this.applyScoreSeparation(l,o),this.applySeriesCompleteness(r,n,a),this.applyMeasurePersistence(n,a),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,n){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=rn({rows:this._rows,columns:this._cols.map((r,s)=>{let a=n[s];return{name:r.name,values:a,distinct:a?a.size:r.distinctCount??0,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Re(r.name),temporalTextPattern:r.temporalTextPattern}}),text:r=>this.STR(r),locale:e});i&&(this._cols[i.key].twoSetPairing=i.pairing,this._cols[i.discriminator].twoSetPairing=i.pairing)}applyScoreSeparation(e,n){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=sn({rows:this._rows,columns:this._cols.map((r,s)=>({name:r.name,dataType:r.dataType,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Re(r.name),isBinaryFlag:!!r.isBinaryFlag,distinct:e[s]??0,twoValues:n[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,n,i){for(let c of this._cols)c.seriesCompleteness!==void 0&&delete c.seriesCompleteness;let r=this._cols.map((c,u)=>({c,i:u})).filter(({c})=>c.isTemporal&&!c.isMeasure&&c.temporalCadence&&c.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=this.seriesKeyIndex(n,i);if(s<0)return;let a=this._cols[s],l=this._rows.map(c=>this.STR(c[s])),o=e>=20&&(a.dataType!=="String"||Array.isArray(a.safeDistinctValues));for(let{c,i:u}of r){let g=tn({periods:this._rows.map(d=>this.STR(d[u])),series:l,seriesColumn:a.name,pattern:c.temporalTextPattern,locale:n,includeDates:e>=20,includeNames:o});g&&(c.seriesCompleteness=g)}}seriesKeyIndex(e,n){let i=[],r=[];this._cols.forEach((a,l)=>{let o=n[l];o&&(i.push(l),r.push({name:a.name,dataType:a.dataType,isMeasure:!!a.isMeasure,isTemporal:!!a.isTemporal,isDatePart:!!a.isDatePart,isReassembledDate:!!a.isReassembledDate,isBinaryFlag:!!a.isBinaryFlag,geoKind:a.geoKind,identifierNamed:Re(a.name),values:o,rows:this._rows.length,locale:e}))});let s=en(r);return s<0?-1:i[s]}applyMeasurePersistence(e,n){for(let o of this._cols)o.persistence!==void 0&&delete o.persistence;let i=[];if(this._cols.forEach((o,c)=>{o.isMeasure&&(o.dataType==="Integer"||o.dataType==="Decimal"||o.dataType==="Double")&&i.push(c)}),i.length===0||this._rows.length<Ie)return;let r=-1,s=[];for(let o=0;o<this._cols.length&&r<0;o++){let c=this._cols[o];if(!c.isTemporal||c.isMeasure||c.isDatePart)continue;let u=this._rows.map(g=>j(this.STR(g[o]),c.temporalTextPattern,e)?.ms??null);new Set(u.filter(g=>g!==null)).size<Ie||(r=o,s=u)}if(r<0)return;let a=this.seriesKeyIndex(e,n),l=a>=0?this._rows.map(o=>this.STR(o[a])):void 0;for(let o of i){let c=this._rows.map(g=>{let d=g[o];if(d==null||d==="")return null;let y=typeof d=="number"?d:parseFloat(String(d).replace(/,/g,""));return Number.isFinite(y)?y:null}),u=Ue({stamps:s,series:l,values:c});u&&(this._cols[o].persistence={timeColumn:this._cols[r].name,...a>=0?{seriesColumn:this._cols[a].name}:{},...u})}}updateColumnStats20(e,n,i,r,s,a,l,o,c,u,g,d){if(e>=20){let y=[...n].sort((S,p)=>S-p),w=Math.floor(y.length/2);if(i>0&&r!=null?s.avgValue=s.dataType=="Integer"?Math.round(r/i):r/i:s.avgValue=null,i>0&&(s.avgLength=a/i),this._rows.length>0){let S=p=>{let h=p instanceof Date?p:typeof p=="string"?Ne(p)??new Date(p):new Date(p),x=this.wholeDayIso(h);return x?x+"T00:00:00.000Z":isNaN(h.getTime())?p:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!o?s.lowValue=o:s.lowValue=S(o),s.dataType!="DateTime"||l||!c?s.highValue=c:s.highValue=S(c),s.medianValue=y.length===0?null:y.length%2===0?s.dataType=="Integer"?Math.round((y[w-1]+y[w])/2):(y[w-1]+y[w])/2:y[w],s.numericPrecision=u}if(y.length>0){let S=s.avgValue??0,p=y.length,h=0,x=0;for(let b of y){let _=b-S;h+=_*_,x+=_*_*_}let f=h/p,C=Math.sqrt(f);s.skewness=f===0?0:x/p/(C*C*C),s.stdDev=Math.sqrt(f)}r!==null&&(s.sum=r);let A=Array.from(g.entries()).sort((S,p)=>p[1]-S[1]);if(s.topCategories=A.slice(0,10).map(S=>S[1]),!s.isMeasure&&A.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=A.slice(0,5).map(S=>S[0])),e>=20)){let S=A.map(h=>h[0]),p=pe(S,d);if(p!==null)s.ordinalPattern=p.pattern,s.orderedDomain=p.orderedDomain;else if(s.dataType==="String"){let h=ft(S);h!==null&&(s.safeDistinctValues=h)}}if(y.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let S=p=>y[Math.floor((y.length-1)*p)];s.quantiles={p05:S(.05),p25:S(.25),p75:S(.75),p95:S(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&g.size>0){let y=Array.from(g.entries()).sort((S,p)=>p[1]-S[1]).map(S=>S[0]);s.formatSignature=be(y);let w=i>0?a/i:void 0,A=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!A.test(s.formatSignature)&&(w===void 0||w>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&g.size>0){let y=Array.from(g.entries()).sort((A,S)=>S[1]-A[1]),w=_t(y.map(A=>A[0]),s.name,d);if(w!==null&&(s.geoKind=w.geoKind,s.geoMatchPct=w.geoMatchPct,w.geoAmbiguous&&(s.geoAmbiguous=!0),w.geoKind.indexOf("country")===0)){let A=ht(y);A&&(s.dominantGeoRegion=A.dominantGeoRegion,s.dominantGeoRegionPct=A.dominantGeoRegionPct,s.geoRegionCount=A.regionCount,A.middleEastPct>0&&(s.middleEastPct=A.middleEastPct))}}}updateColumnStats10(e,n,i,r,s,a,l){let o=this._rows.length-i;e>=10&&(n.blankCount=o),n.distinctCount=r.size+(o!=0?1:0),n.valueNature="Categorical",i>0&&(n.dataType==="Integer"||n.dataType==="Decimal"?n.valueNature=cn({dataType:n.dataType,isMeasure:!!n.isMeasure,name:n.name,distinct:r.size,nonblank:i,prec:s,maxval:a,minval:l}):n.dataType==="DateTime"&&(n.valueNature=n.dateWithTime?"Continuous":"Ordinal"))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((i,r)=>{i.isMeasure||e.push(r)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let n=new Set;for(let i of this._rows)n.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=n.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=a=>qe(a,{camel:!0}),n=-1,i=-1,r=-1;if(this._cols.forEach((a,l)=>{let o=e(a.name),c=a.dataType==="Integer"||a.dataType==="Decimal";c&&n<0&&o.some(u=>u==="lat"||u==="latitude")?n=l:c&&i<0&&o.some(u=>u==="lon"||u==="lng"||u==="long"||u==="longitude")&&(i=l),r<0&&!a.isMeasure&&typeof a.geoKind=="string"&&a.geoKind.indexOf("country")===0&&(r=l)}),n<0||i<0){let a=(c,u)=>{let g=0;for(let d of this._rows){let y=d[c];if(y==null||y==="")continue;let w=Number(y);if(!Number.isFinite(w)||w<-u||w>u)return!1;g++}return g>0},l=-1,o=-1;if(this._cols.forEach((c,u)=>{if(!(c.dataType==="Integer"||c.dataType==="Decimal"))return;let g=e(c.name),d=g.some(y=>y==="lat"||y==="latitude")?"lat":g.some(y=>y==="lon"||y==="lng"||y==="long"||y==="longitude")?"lon":Rt(g);d==="lat"&&l<0&&a(u,90)?l=u:d==="lon"&&o<0&&a(u,180)&&(o=u)}),l<0||o<0)return null;n=l,i=o}this._geoExtentLatIdx=n;let s=[];for(let a of this._rows){let l=a[n],o=a[i],c=l==null||l===""?null:Number(l),u=o==null||o===""?null:Number(o);s.push({lat:c,lon:u,country:r>=0&&he(this.STR(a[r]))?this.STR(a[r]):null})}return this._geoExtent=pt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;_geoExtentLatIdx=-1;obfuscateString(e){return jt(e,st)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(n=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=n[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=n[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=n[r]);return i})}async getCSVAsync(e){let n=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,a=this.wallClockColumnIndexes();for(let o of this._rows){let c={};for(let u=0;u<this._cols.length;u++){let g=this._cols[u],d=o[u];if(this.STR(d)!=""){if(e&&g.dataType=="String")if(s.has(d))d=s.get(d);else{let y=this.obfuscateString(d);s.set(d,y),d=y}else if(g.dataType=="DateTime"&&!g.dateWithTime){let y=d instanceof Date?d:typeof d=="string"?Ne(d)??new Date(d):new Date(d);d=(this.wholeDayIso(y)??y.toISOString().slice(0,10))+"T00:00:00.000Z"}else a.has(u)&&d instanceof Date&&(d=fe(d));r-=this.STR(d).length}else d=null;c[u]=d,--r}if(n.push(c),--i,i<=0||r<=0)break}return await on.unparse(n,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return on.unparse([this._cols.map((n,i)=>{if(this.emitLegacyAggAliases&&n.hostName)return this.STR(n.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:n.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(n=>n==null?null:this.STR(n)),this._englishAliases=new Map}aliasesForCode(e){let n=Ge(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())n.push({name:i.name,alias:i.alias,reason:"english-implicit-agg"});return n}armAliasesForCode(e){return this.emitLegacyAggAliases=Ge(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let n of this.liveEnglishAliases().values())e.push({name:n.name,alias:n.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let n of this._cols)n&&n.hostName&&n.hostName!==n.name&&e.push({name:this.STR(n.name),alias:this.STR(n.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let n=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return n;let i=String(e),r=new Set;for(let a of this._cols)a&&(r.add(this.STR(a.name)),a.hostName&&r.add(this.STR(a.hostName)));let s=new Map;for(let a=0;a<this._cols.length;a++){if(!this._cols[a]||Wt(this._hostQueryNames[a],this._cols[a].name,this._cols[a].dataType))continue;let l=zt(this._hostQueryNames[a]).filter(o=>!r.has(o)&&oe(i,o));l.length===1&&s.set(l[0],[...s.get(l[0])??[],a])}for(let[a,l]of s){if(l.length!==1)continue;let o=this.STR(this._cols[l[0]].name);n.set(l[0],{name:o,alias:a,headerName:!oe(i,o)})}return n}liveEnglishAliases(){let e=new Map;for(let[n,i]of this._englishAliases){let r=this._cols?this._cols[n]:null;r&&this.STR(r.name)===i.name&&e.set(n,i)}return e}addRow(e,n){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=it(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(Si(e)),this._inferredMeasureFlags=null,this._origIndices.push(n??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}invalidateStats(){this._computedStatsForLevel=null,this._geoExtentComputed=!1,this._geoExtent=null,this._geoExtentLatIdx=-1}reset(){this._inferredMeasureFlags=null,this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map}setColumns(e){if(this._inferredMeasureFlags=null,this._cols=e,!e||e.length===0)return;let n=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=Lt(r);!s||s===r||n.has(s)||(n.delete(r),n.add(s),i.hostName=r,i.name=s)}}};export{mn as a,fn as b,wi as c,Mi as d,Mt as e,It as f,Tn as g,vn as h,Rt as i,En as j,Nn as k,kn as l,Dn as m,Me as n,Gn as o,Lt as p,Ge as q,zt as r,Bt as s,Un as t,Vt as u,Kt as v,Oi as w,Pi as x,Li as y,jn as z,Xn as A,Zn as B,Ut as C,oe as D,lr as E,Vi as F,ur as G,cr as H,j as I,qt as J,Mr as K,Tr as L,vr as M,kr as N,en as O,tn as P,ts as Q,Re as R,un as S,hi as T,yi as U,bi as V,cn as W,an as X,Si as Y,ln as Z};