@bicharts/shape-core 0.6.103 → 0.6.105

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.
@@ -185,6 +185,10 @@ export type LLMColumnWithValue = {
185
185
  dominantGeoRegion?: string;
186
186
  dominantGeoRegionPct?: number;
187
187
  geoRegionCount?: number;
188
+ middleEastPct?: number;
189
+ admin1RollupPct?: number;
190
+ admin1RegionCount?: number;
191
+ admin1CountryCount?: number;
188
192
  };
189
193
  export type LLMClientHints = {
190
194
  viewportWidth?: number;
@@ -279,6 +283,12 @@ export type LLMClientHints = {
279
283
  * host learned the gesture.
280
284
  */
281
285
  supportsLasso?: boolean;
286
+ /**
287
+ * Can this host draw a PROVINCE map: load the hosted admin-1 lookup before profiling, fetch a continent's province
288
+ * geometry and build the province join (chart-host's "@bicharts/chart-host/provinces" entry)? Absent or false
289
+ * means province maps are not offered, and an explicit pick of one is refused.
290
+ */
291
+ supportsProvinceMaps?: boolean;
282
292
  favorLimitTo?: string;
283
293
  favorLimitCount?: number;
284
294
  groupToOthersLabel?: string;
@@ -304,6 +314,9 @@ export type LLMClientHints = {
304
314
  lonP5: number;
305
315
  lonP95: number;
306
316
  n: number;
317
+ regionPct?: Record<string, number>;
318
+ dominantFrame?: string;
319
+ dominantFramePct?: number;
307
320
  };
308
321
  levelOfDetail?: string;
309
322
  clientIdSource?: "persisted" | "fingerprint" | "session";
@@ -443,6 +456,9 @@ export type LLMRequestCodeResult = {
443
456
  suppressSelectionGlyph?: boolean;
444
457
  geoColumn?: string;
445
458
  geoKind?: string;
459
+ geoRegion?: string;
460
+ geoGrain?: string;
461
+ geoSource?: string;
446
462
  pointCityColumn?: string;
447
463
  pointStateColumn?: string;
448
464
  pointZipColumn?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/shape-core",
3
- "version": "0.6.103",
3
+ "version": "0.6.105",
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{N as I,V as A,e as R}from"./chunk-CQS6BGRJ.mjs";import{a as h,c as x,d as E,e as L}from"./chunk-A4PQBWRA.mjs";import{u as C}from"./chunk-CZJ7M6A5.mjs";import M from"papaparse";var k=500,j=/^[+-]?\d{1,15}$/,N=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,O=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function _(e,o=".",t=!1){if(t)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++,j.test(h(m))){r++,s++;continue}if(L(m,o)){s++;continue}if((N.test(m)||O.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,t=".",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 j.test(i)?parseInt(i,10):null}case"Decimal":return E(s,t);case"DateTime":return r?r.read(s):C(s);default:return s}}function q(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*F(e,o){for(let t of e)yield t?.[o]}function g(e,o,t){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((n,a)=>o.slice(0,k).map(u=>u?.[a])),i=s.map(n=>x(n,t.locale)),l=e.map((n,a)=>n.dataType===void 0||n.dataType==="DateTime"?R(F(o,a),{locale:t.locale??"en"}):null),c=e.map((n,a)=>n.dataType??_(s[a],i[a],l[a]!==null)),m=new Set((t.measures??[]).map(n=>n.toLowerCase())),b=new Set((t.dimensions??[]).map(n=>n.toLowerCase())),P=new Set((t.nonAdditive??[]).map(n=>n.toLowerCase())),D=e.map((n,a)=>{let u=n.name.toLowerCase(),f=n.isMeasure??((c[a]==="Integer"||c[a]==="Decimal")&&!I(n.name));m.has(u)&&(f=!0),b.has(u)&&(f=!1);let T={name:n.name,dataType:c[a],isMeasure:f};return f&&P.has(u)&&(T.discourageAggregationAcrossGroups=!0),T}),d=new A;d.dedupRows=t.dedup!==!1,d.setColumns(D),d.declareDimensions(D.filter((n,a)=>b.has(e[a].name.toLowerCase())));for(let n=0;n<o.length;n++){let a=o[n];d.addRow(Array.from({length:r},(u,f)=>$(a?.[f],c[f],i[f],l[f])),n)}let p=d.getColumnsWithStats(t.privacyLevel??"20",t.locale??"en"),S=new Map(p.map(n=>[n.name,n]));e.forEach(n=>{let a=S.get(n.name);a&&(n.format&&(a.modelFormat=n.format),n.description&&(a.modelDesc=n.description))});let y=n=>{let a=S.get(n);if(a)return[a];let u=n.toLowerCase();return p.filter(f=>f.name.toLowerCase()===u)};for(let[n,a]of Object.entries(t.formats??{}))for(let u of y(n))u.modelFormat=a;for(let[n,a]of Object.entries(t.descriptions??{}))for(let u of y(n))u.modelDesc=a;for(let n of t.groupBy??[])for(let a of y(n))a.isGrouping=!0;return{columns:p,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function w(e,o){return e.map(t=>Array.isArray(t)?t:o.map(r=>t[r]))}function V(e,o){let t=[],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),t.push(c))}return t}function v(e){let o=String(e??"").replace(/^\uFEFF/,""),t=[],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,"")===""||t.push(m)}}),!t.length&&!r.length&&r.push(...M.parse(o,{skipEmptyLines:!0}).errors),{rows:t,errors:r}}function Y(e,o={}){switch(e.kind){case"csv":{let t=v(e.text);if(t.errors.length&&t.rows.length===0)throw new Error(`ingest: CSV parse failed - ${t.errors[0].message}`);let r=t.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(t=>({name:(t??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let t=e.columns.map(r=>r.name);return g(e.columns,w(e.rows??[],t),o)}case"objects":{let t=e.rows??[],r=e.columns?.length?e.columns:V(t,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(t,r.map(s=>s.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let t=e.schema.map(r=>{let s=q(r.dataType);return{name:r.name,dataType:s,isMeasure:r.isMeasure,format:r.format,description:r.description}});return g(t,w(e.rows??[],t.map(r=>r.name)),o)}default:{let t=e;throw new Error(`ingest: unknown source kind '${t?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{q as a,v as b,Y as c};
@@ -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 he}from"./chunk-U3H6UBOO.mjs";import{a as mt,f as te,g as ye,h as se,i as be,j as ie}from"./chunk-A4PQBWRA.mjs";import{c as ct}from"./chunk-IPPPCWAK.mjs";import{f as lt,k as ut}from"./chunk-INMDBTAR.mjs";import{e as rt,k as ge,m as ot,n as at,o as pe}from"./chunk-HJA26Z2E.mjs";import{A as fe,B as tt,E as nt,a as me,b as ee,c as Ke,d as de,g as He,h as Ye,j as je,l as Xe,m as Ze,o as Qe,p as Q,q as qe,r as Je,u as Ne,w as et}from"./chunk-CZJ7M6A5.mjs";import{c as Ve,f as Ie}from"./chunk-WC4JINEZ.mjs";import{b as it,d as st}from"./chunk-5HI6TVMM.mjs";var Jt=[[24.4,49.4,-125,-66.9],[51.2,71.5,-168,-129.9],[18.9,22.3,-160.3,-154.8]],en=[7,72,-172,-52];function dt(n,e,t){return n>=t[0]&&n<=t[1]&&e>=t[2]&&e<=t[3]}var ne=n=>Math.round(n*10)/10;function gt(n,e=3){let t=[],i=[],r=0,s=0;for(let l of n){let a=l?.lat,u=l?.lon;if(typeof a!="number"||typeof u!="number"||!isFinite(a)||!isFinite(u)||a<-90||a>90||u<-180||u>180)continue;t.push(a),i.push(u);let m=l?.country?String(l.country).trim().toUpperCase():"",f=m?Se(m):null;f?((m==="US"||m==="USA")&&r++,f==="north-america"&&s++):(Jt.some(c=>dt(a,u,c))&&r++,dt(a,u,en)&&s++)}let o=t.length;return o<e?null:(t.sort((l,a)=>l-a),i.sort((l,a)=>l-a),{pctUsa:ne(r/o*100),pctNa:ne(s/o*100),latP5:ne(Q(t,.05)),latP95:ne(Q(t,.95)),lonP5:ne(Q(i,.05)),lonP95:ne(Q(i,.95)),n:o})}var ft={"north-america":"AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI","south-america":"AR BO BR CL CO EC FK GF GY PE PY SR UY VE",europe:"AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA",africa:"AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW",asia:"AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE",oceania:"AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS",antarctica:"AQ BV GS HM TF"},oe=(()=>{let n=new Map;for(let e of Object.keys(ft))for(let t of ft[e].split(/\s+/))t&&n.set(t,e);return n})();function tn(n){for(let[e,t]of n){let i=oe.get(e);i&&!oe.has(t)&&oe.set(t,i)}}tn(lt);function Se(n){if(!n)return null;let e=String(n).trim().toUpperCase();if(!e)return null;let t=oe.get(e);if(t)return t;let i=ut(String(n));return i?oe.get(i)??null:null}function oi(n,e=2){return Ee(n.map(t=>[t,1]),e)}function Ee(n,e=2){let t=new Map,i=0;for(let[o,l]of n){let a=Se(o);if(!a)continue;let u=typeof l=="number"&&isFinite(l)&&l>0?l:1;t.set(a,(t.get(a)??0)+u),i+=u}if(i<e||!t.size)return null;let r="europe",s=-1;for(let o of Array.from(t.keys()).sort()){let l=t.get(o);l>s&&(r=o,s=l)}return{dominantGeoRegion:r,dominantGeoRegionPct:ne(s/i*100),regionCount:t.size,n:i}}function De(n){let e=(n||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var ve={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},nn=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,rn=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,sn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,on=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,an=new Set(["de","del","of"]),ln=new Set(["\u0433","\u0440","r"]),un=/^[\p{L}\p{M}\u0970\u05f3]+$/u,ke=/^\d+$/;function cn(n){let e=+n[1],t=+n[2],i=n[3]===void 0?0:+n[3],r=n[4]!==void 0;if(t>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(n[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:t,s:i,seconds:n[3]!==void 0,meridiem:r}}function pt(n){let e=n.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=mt(e);let t=null,i=nn.exec(e);if(i){if(t=cn(i),!t)return null;e=e.slice(0,i.index)}let r;if(r=sn.exec(e)){let c=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...ve,form:"cjk",key:c,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=rn.exec(e)){let c=r[2],S=r[4];if(c!==S)return null;let I=c.trim(),w=r[6];if(w&&I!==".")return null;let C=[r[1].length,r[3].length,r[5].length],g=C[0]===4,h=C[2]===4;return g===h||(g?C[1]>2||C[2]>2:C[0]>2||C[1]>2)?null:g&&I==="-"&&c==="-"&&C[1]===2&&C[2]===2?"iso":g&&I==="."&&c==="."&&!w&&!(C[1]===2&&C[2]===2)?null:{...ve,form:"numeric",key:`num|${g?"y":"x"}|${c}|${w}`,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:g,sep:c,trail:w}}let s=e.replace(on,"$1").split(/[\s.,/-]+/).filter(c=>c!==""&&!an.has(c.toLowerCase()));if(s.length===4&&ke.test(s[2])&&ln.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let o=s.map(c=>ke.test(c)?"N":un.test(c)?"W":"?").join(""),l=s.map(c=>ke.test(c)?c:""),a=0,u=0,m="",f;if(o==="NWN"&&l[0].length<=2&&l[2].length===4)a=+l[0],m=s[1],u=+l[2],f="dmy";else if(o==="WNN"&&l[1].length<=2&&l[2].length===4)m=s[0],a=+l[1],u=+l[2],f="mdy";else if(o==="NWN"&&l[0].length===4&&l[2].length<=2)u=+l[0],m=s[1],a=+l[2],f="ymd";else return null;return{...ve,form:"named",key:`named|${f}`,clock:t,day:a,year:u,word:m,namedOrder:f}}var mn=[31,28,31,30,31,30,31,31,30,31,30,31],dn=n=>n%4===0&&n%100!==0||n%400===0;function ht(n,e,t){return n>=1&&n<=9999&&e>=1&&e<=12&&t>=1?t<=(e===2&&dn(n)?29:mn[e-1]):!1}function fn(n,e,t,i){let r=new Date(Date.UTC(2e3,e-1,t,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(n),r}function yt(n,e={}){let t=(e.floor??1)>=1,i=new Map,r=new Map,s=0,o=null;for(let g of n){if(g==null)continue;if(typeof g!="string"){if(t)return null;s++;continue}let h=g.trim();if(h==="")continue;s++;let b=i.get(h);if(b===void 0&&(b=pt(h),i.set(h,b)),b===null||b==="iso"){if(t)return null;continue}if(t){if(o===null)o=b;else if(b.key!==o.key)return null}else r.set(b.key,(r.get(b.key)??0)+1)}if(!t){let g=0,h="";for(let[b,p]of r)p>g&&(g=p,h=b);if(g===0||g/s<e.floor)return null;o=[...i.values()].find(b=>b!==null&&b!=="iso"&&b.key===h)??null}if(o===null)return null;let l=o.key,a=[...i.values()].filter(g=>g!==null&&g!=="iso"&&g.key===l),u,m="shape",f=null;if(o.form==="named"){if(u=o.namedOrder,f=be(a.map(g=>g.word),e.locale),!f)return null}else if(o.form==="cjk"||o.yearFirst)u="ymd";else{let g=0,h=0;for(let b of a)b.a>12&&g++,b.b>12&&h++;if(g>0&&h>0)return null;g>0?(u="dmy",m="values"):h>0?(u="mdy",m="values"):o.sep.trim()==="."?(u="dmy",m="shape"):(u=De(e.locale)?"mdy":"dmy",m="locale")}let c=g=>{if(g.form==="named"){let h=f.get(te(g.word));return h===void 0?null:[g.year,h+1,g.day]}return g.yearFirst?[g.a,g.b,g.c]:u==="dmy"?[g.c,g.b,g.a]:[g.c,g.a,g.b]},S=1/0,I=-1/0,w=0;for(let g of a){let h=c(g);if(!h||!ht(h[0],h[1],h[2])){if(t)return null;w++;continue}S=Math.min(S,h[0]),I=Math.max(I,h[0])}if(!t&&(r.get(l)-w)/s<e.floor||S>=2400&&I<=2699||S>=1300&&I<=1500)return null;let C={form:o.form,order:u,orderFrom:m,hasTime:a.some(g=>g.clock!==null),read(g){if(typeof g!="string")return null;let h=g.trim();if(h==="")return null;let b=i.get(h);if(b===void 0&&(b=pt(h),i.set(h,b)),b===null||b==="iso"||b.key!==l)return null;let p=c(b);return!p||!ht(p[0],p[1],p[2])?null:fn(p[0],p[1],p[2],b.clock)}};if(o.form!=="named"&&!a.some(g=>g.clock?.meridiem)){let g;o.form==="cjk"?g=o.cjkPattern:o.yearFirst?g=`%Y${o.sep}%m${o.sep}%d${o.trail}`:g=(u==="dmy"?`%d${o.sep}%m${o.sep}%Y`:`%m${o.sep}%d${o.sep}%Y`)+o.trail;let h=a.filter(b=>b.clock!==null).length;h===0?C.pattern=g:h===a.length&&(C.pattern=g+(a.every(b=>b.clock.seconds)?" %H:%M:%S":" %H:%M"))}return C}import Yt from"papaparse";var gn=["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"],pn=["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"],hn=["latitude","longitude"],yn=["latitude","longitude"];function q(n){return me(n)}var _t=["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"],bn=["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"],Sn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],_n=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],_e=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 Oe(n){return[...n].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var At=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+Oe(_t)+")\\s+)","i");function bt(n){for(let e of n){let t=e.codePointAt(0)??0;if(t>=11904&&t<=40959||t>=44032&&t<=55215)return!0}return!1}var An="[\u2013\u2014-]";function Ct(n){let e=n.filter(r=>!bt(r)),t=n.filter(bt),i=[];return e.length&&i.push("(?:\\s+|\\s*"+An+"\\s*)("+Oe(e)+")"),t.length&&i.push("\\s*("+Oe(t)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var Pe=Ct(Sn),Cn=Ct(_n);function Ae(n,e){let t=e.exec(n);if(!t)return null;let i=n.slice(0,t.index);return i.trim()===""?null:{base:i,label:(t[1]??t[2]??"").toLowerCase()}}function xt(n){let e=q(String(n??"").trim().toLowerCase());if(!e)return null;for(let r of bn)if(e.startsWith(r+" "))return _e[r]??"avg";for(let r of _t)if(e.startsWith(r+" ")||e===r)return _e[r]??"sum";let t=Ae(e,Cn);if(t)return _e[t.label]??"avg";let i=Ae(e,Pe);return i?_e[i.label]??"sum":null}var xn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,Mn=new RegExp("\\b("+gn.join("|")+")\\b|("+pn.join("|")+")$","i"),Tn=new RegExp("\\b("+hn.join("|")+")\\b|("+yn.join("|")+")$","i");function xe(n){if(!n)return"";let e=String(n),t=q(e),i=At.exec(t);if(i)return e.slice(i[0].length).trim();let r=Ae(t,Pe);return(r?e.slice(0,r.base.length):e).trim()}function wn(n){if(!n)return!1;let e=q(String(n));return At.test(e)||Ae(e,Pe)!==null}var Rn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],St=new RegExp("^\\s*("+[...Rn].sort((n,e)=>e.length-n.length).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Mt(n){if(n==null)return"";let e=String(n),t=St.exec(e);if(!t)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(t[1]),s=e.slice(t[0].length),o=0;for(;o<8;){let l=St.exec(s);if(!l||i(l[1])!==r)break;let a=s.slice(l[0].length);if(a.trim()==="")break;s=a,o++}return o===0?e:e.slice(0,t[0].length)+s}function Le(n,e){if(!n||!e)return!1;let t=String(n);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&t.includes(r))return!0}return!1}var Ce={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 "]},Tt=new RegExp("^("+Object.keys(Ce).join("|")+")\\((.+)\\)$");function wt(n){if(!n)return[];let e=Tt.exec(String(n).trim());if(!e)return[];let t=Ce[e[1]],i=e[2],r=[];for(let s=i.indexOf(".");s>=0;s=i.indexOf(".",s+1)){if(s===0)continue;let o=i.slice(s+1);if(o.trim()!=="")for(let l of t){let a=l+o;r.includes(a)||r.push(a)}}return r}function Rt(n,e,t){let i=Tt.exec(String(n??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&t==="Decimal")return!0;let s=new Set(Ce[r]),o=String(e??""),l=i[2];for(let a=l.indexOf(".");a>=0;a=l.indexOf(".",a+1)){if(a===0)continue;let u=l.slice(a+1);if(u.trim()!==""){for(let m of Object.values(Ce))for(let f of m)if(!s.has(f)&&o===f+u)return!0}}return!1}function In(n){let e=xe(n);return e.length===0?"":e.replace(xn," ")}function It(n,e){if(!e)return!1;let t=xe(e);return n.test(q(In(e)))||n.test(q(t))||n.test(q(ee(t).join(" ")))}function Nt(n){return It(Tn,n)}function Nn(n){return It(Mn,n)||Nt(n)}var Et=/int|double|decimal|single|float|number|currency|money/i;function En(n){let e=String(n?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||n?.isMeasure===!0||Et.test(String(n?.dataType??""))?"Continuous":"Categorical"}function vn(n){return n?.isMeasure===!0||Et.test(String(n?.dataType??""))}function vt(n){let e=n??{},t=En(e);if(t!=="Continuous")return{nature:t,additivity:"unknown",basis:"role",suppressed:!1};if(Nt(e.name))return{nature:t,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&wn(e.name))){if(i==="additive")return{nature:t,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:t,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:t,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:t,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Nn(e.name)?{nature:t,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:t,additivity:"additive",basis:"default",suppressed:!1}}function kt(n){let e=vt(n),t=n??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return vn(t)?["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 fi(n){return kt(n)[0]}function gi(n,e){return kt(n).indexOf(e)>=0}function pi(n,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let t=vt(n);return t.additivity==="additive"||t.additivity==="part_of_whole"||t.additivity==="unknown"}var kn={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"]},Dn=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],On=["num\xE9ro"],Pn=n=>n.normalize("NFC").toLowerCase();function Ln(n,e,t,i){let r=Ie(t);return!r||!n?null:n===e?"word":r.wordBreaks===!1?Array.from(e).length<Ze?null:(i?n.startsWith(e):n.endsWith(e))&&n.length>e.length?"suffix":null:i?je(n,t).includes(e)?"word":null:r.script==="Hang"?Xe(n,e)?"suffix":null:r.compounds&&Ye(n,e,He)?"suffix":null}function Dt(n){let e=String(n??"").trim();if(!e)return null;let t=de(e),i=de(xe(e));for(let[r,s]of Object.entries(kn)){let o=Dn.includes(r),l=o?i:t;for(let a of s){let u=On.includes(a)||!!Ie(r)?.foldSensitive,m=u?l.words:l.folded;if(m.length===0)continue;let f=u?Pn(a):de(a).folded.join(" "),c=Ln(o?m[0]:m[m.length-1],f,r,o);if(c)return{lang:r,word:a,view:c}}}return null}var Fn=[["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 Me(n){for(let[e,t]of Fn)if(t.test(n))return e;return null}var Wn=[{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]]}],Te=new Map;function Ot(n,e,t,i){let r=Te.get(n);if(r)return r;let s=[];for(let[o,l]of e)for(let a=o;a<=l;a++){let u=String.fromCodePoint(a);Me(u)===t&&(i&&!i.test(u)||s.push(u))}return Te.set(n,s),s}function Bn(n){let t=n.codePointAt(0);for(let o=0;o<9&&Me(String.fromCodePoint(t-1))==="Nd";o++)t--;let i="nd:"+t.toString(16),r=Te.get(i);if(r)return r;let s=[];for(let o=t;o<t+10;o++){let l=String.fromCodePoint(o);Me(l)==="Nd"&&s.push(l)}return Te.set(i,s),s}function Gn(n,e){if(e==="Nd")return Bn(n);for(let r of Wn)if(r.test.test(n))return Ot(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=n.codePointAt(0)&-128;return Ot("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function zn(n,e,t,i){let r=n.filter(s=>!e.has(s));return r.length===0&&(r=n.filter(s=>s!==t)),r.length===0?t:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var $n=/^[\p{L}\p{M}\p{Nd}]$/u,Pt=/^[\p{L}\p{Nd}]$/u;function Lt(n,e){if(!n)return n??"";let t=new Set(Array.from(n)),i=m=>{let f=Me(m);return!f||!$n.test(m)?m:zn(Gn(m,f),t,m,e)},r=m=>{let f=[];for(let c of m)f.push(i(c)),Pt.test(c)&&e()<.2&&f.push(i(c));if(f.length>6){let c=Math.floor(e()*Math.min(3,f.length-6));for(let S=0;S<c;S++)for(let I=0;I<5;I++){let w=Math.floor(e()*f.length);if(Pt.test(f[w])){f.splice(w,1);break}}}return f.join("")};if(!(n.includes("@")&&n.includes(".")))return r(n);let[o,l=""]=n.split("@"),a=l.endsWith(".com"),u=a?l.slice(0,-4):l;return`${r(o)}@${r(u)}${a?".com":""}`}var Un=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Vn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Kn=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 ae(n,e){if(!n||!e)return!1;let t=Vn(e);return new RegExp("['\"`]"+t+"['\"`]").test(n)?!0:Un.test(e)&&new RegExp("\\."+t+"(?![A-Za-z0-9_$])").test(n)}function Hn(n){return!!n&&Kn.test(n)}function Ci(n,e,t){return n?Hn(n)?[...e]:[...t,...e].some(i=>ae(n,i))?e.filter(i=>ae(n,i)):[...e]:[]}var Yn=5,jn=6,Xn=3,re=864e5,Zn=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Qn=/^(\d{4})[-/](\d{1,2})$/,qn=/^(\d{4})[-\s]?Q([1-4])$/i,Jn=/^Q([1-4])[-\s](\d{4})$/i,er=/^(\d{4})$/,tr=/^(\d{4})(0[1-9]|1[0-2])$/,nr=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,rr=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,ir=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Fe(n,e,t){let i=te(n);if(!i)return 0;if(i==="sept")return 9;for(let o of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=ye(o)[i];if(l!==void 0)return l+1}let r=t?.get(i);if(r!==void 0)return r+1;let s=se(n);if(s.length>0){if(s.every(a=>a.month===s[0].month))return s[0].month+1;let o=Ve(String(e??"").split(/[-_]/)[0])?.code,l=s.find(a=>a.lang===o);if(l)return l.month+1}return 0}function sr(n){let e=ge(n).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let t=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==t.n||i.year!==t.year)?null:H(t.year,(t.n-1)*3+1,1)}function H(n,e,t,i=0,r=0,s=0){if(!(n>=1&&e>=1&&e<=12&&t>=1&&t<=31))return null;let o=Date.UTC(n,e-1,t,i,r,s);if(!Number.isFinite(o))return null;let l=a=>a<10?"0"+a:String(a);return{ms:o,y:n,m:e,d:t,iso:`${n}-${l(e)}-${l(t)}`}}function or(n,e){let t=[],i="";for(let a=0;a<e.length;a++){if(e[a]!=="%"){i+=e[a].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++a]){case"Y":t.push("Y"),i+="(\\d{4})";break;case"m":t.push("m"),i+="(\\d{1,2})";break;case"d":t.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(n);if(!r)return null;let s=0,o=1,l=1;return t.forEach((a,u)=>{let m=+r[u+1];a==="Y"?s=m:a==="m"?o=m:l=m}),s?H(s,o,l):null}function j(n,e,t,i){let r=(n??"").trim();if(r==="")return null;if(e){let a=or(r,e);return a||null}let s=Zn.exec(r);if(s)return H(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=qn.exec(r),s)return H(+s[1],(+s[2]-1)*3+1,1);if(s=Jn.exec(r),s)return H(+s[2],(+s[1]-1)*3+1,1);if(s=Qn.exec(r),s&&+s[2]>=1&&+s[2]<=12)return H(+s[1],+s[2],1);if(s=nr.exec(r),s)return H(+s[1],+s[2],+s[3]);if(s=tr.exec(r),s)return H(+s[1],+s[2],1);if(s=er.exec(r),s){let a=+s[1];return a>=1900&&a<=2100?H(a,1,1):null}let o=sr(r);if(o)return o;if(s=rr.exec(r),s){let a=Fe(s[1],t,i);if(a)return H(+s[2],a,1)}if(s=ir.exec(r),s){let a=Fe(s[2],t,i);if(a)return H(+s[1],a,1)}let l=ie(r);if(l){let a="month"in l?l.month:Fe(l.word,t,i);if(a)return H(l.year,a,1)}return null}function Ft(n){let e=new Date(n).getUTCDay();return e>=1&&e<=5}function Wt(n,e){if(e<=n)return 0;let t=Math.round((e-n)/re),i=Math.floor(t/7),r=i*5,s=n+i*7*re;for(;s<e;)Ft(s)&&r++,s+=re;return r}function ar(n){if(n.length===0)return 0;let e=[...n].sort((i,r)=>i-r),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function lr(n){return n>0?n<.95?"hour":n<=1.05?"day":n>=6.5&&n<=7.5?"week":n>=27&&n<=31.5?"month":n>=88&&n<=93?"quarter":n>=362&&n<=368?"year":"irregular":"irregular"}function le(n,e,t,i){switch(t){case"year":return e.y-n.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(n.y*4+Math.floor((n.m-1)/3));case"month":return e.y*12+e.m-(n.y*12+n.m);case"week":return Math.round((e.ms-n.ms)/(7*re));case"weekday":return Wt(n.ms,e.ms);case"day":return Math.round((e.ms-n.ms)/re);default:return i>0?Math.round((e.ms-n.ms)/i):0}}function Bt(n,e){return We(n,e)?.cadence??null}function We(n,e){let t=e?.gapFactor??Yn,i=0,r=0,s=new Map,o=Array.from(n),l;if(!e?.pattern){let p=[];for(let _ of o){if(_==null||_==="")continue;let y=ie(String(_));y&&"word"in y&&p.push(y.word)}p.length>0&&(l=be(p,e?.locale)??void 0)}for(let p of o){if(p==null||p==="")continue;i++;let _=j(String(p),e?.pattern,e?.locale,l);_&&(r++,s.set(_.ms,_))}let a=[...s.values()].sort((p,_)=>p.ms-_.ms);if(a.length<Xn||i>0&&r/i<.8)return null;let u=a[a.length-1].ms-a[0].ms;if(u<=0)return null;let m=[];for(let p=1;p<a.length;p++)m.push(a[p].ms-a[p-1].ms);let f=ar(m);if(!(f>0))return null;let c=lr(f/re);c==="day"&&u>=7*re&&a.every(p=>Ft(p.ms))&&Wt(a[0].ms,a[a.length-1].ms)+1>a.length*.5&&(c="weekday");let S=c==="irregular"?a.length:le(a[0],a[a.length-1],c,f)+1,I=1,w=1,C=[],g=a[0],h=1;for(let p=1;p<a.length;p++){let _=le(a[p-1],a[p],c,f);_>I&&(I=_),c!=="irregular"&&_>t?(w++,C.push({from:g.iso,to:a[p-1].iso,points:h}),g=a[p],h=1):h++}C.push({from:g.iso,to:a[a.length-1].iso,points:h});let b={grain:c,points:a.length,expectedPoints:Math.max(S,a.length),coveragePct:Math.round(a.length/Math.max(S,a.length)*1e3)/10,runs:w,largestGapUnits:I,gapFactor:t};return e?.includeBounds&&C.length<=jn&&(b.runBounds=C),{cadence:b,points:a,stepMs:f}}var ur=8,cr=.5,mr=200,dr=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"]),fr=["category","classification","segment","status","priority","severity","channel"],gr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function pr(n){let e=ee(n);if(e.length===0)return!1;let t=e[e.length-1];return dr.has(t)?!0:fr.some(i=>t.length>i.length&&t.endsWith(i))}function hr(n){if(n.isMeasure)return"measure";if(n.isTemporal||n.isDatePart||n.isReassembledDate)return"temporal";let e=Array.from(n.values).filter(t=>t!==""&&t!==null&&t!==void 0);return e.length<2||e.length>mr?"cardinality":n.rows>0&&e.length>=n.rows?"row-identity":n.isBinaryFlag?"flag":pe(e,n.locale)!==null?"ordinal":n.identifierNamed||n.dataType==="String"&&gr.has(he(e))?"identifier":!n.geoKind&&pr(n.name)?"attribute":"entity"}function $t(n){let e=-1,t=1/0,i=!1;return n.forEach((r,s)=>{if(hr(r)!=="entity")return;let o=new Set(Array.from(r.values).filter(a=>a!=="")).size,l=!!r.geoKind;(o<t||o===t&&l&&!i)&&(e=s,t=o,i=l)}),e}var Gt=n=>n<10?"0"+n:String(n);function zt(n,e){switch(e){case"year":return`${n.y}-01-01`;case"quarter":return`${n.y}-${Gt(Math.floor((n.m-1)/3)*3+1)}-01`;case"month":return`${n.y}-${Gt(n.m)}-01`;case"hour":return new Date(n.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return n.iso}}function Ut(n){let{periods:e,series:t}=n,i=Math.min(e.length,t.length),r=new Set;for(let _=0;_<i;_++)e[_]&&r.add(e[_]);let s=We(r,{pattern:n.pattern,locale:n.locale});if(!s)return null;let o=s.cadence.grain;if(o==="irregular")return null;let l=s.points[0],a=le(l,s.points[s.points.length-1],o,s.stepMs)+1;if(a!==s.cadence.expectedPoints)return null;let u=new Map;for(let _ of r){let y=j(_,n.pattern,n.locale);if(!y)continue;let x=le(l,y,o,s.stepMs);x>=0&&x<a&&u.set(_,{idx:x,stamp:y})}let m=new Map;for(let _=0;_<i;_++){let y=t[_];if(!y)continue;let x=u.get(e[_]);if(!x)continue;let T=m.get(y);T||(T={seen:new Set,lo:x.idx,hi:x.idx,loStamp:x.stamp,hiStamp:x.stamp,order:m.size},m.set(y,T)),T.seen.add(x.idx),x.idx<T.lo&&(T.lo=x.idx,T.loStamp=x.stamp),x.idx>T.hi&&(T.hi=x.idx,T.hiStamp=x.stamp)}if(m.size<2)return null;let f=0;for(let _ of m.values())f+=_.seen.size;if(f/(m.size*a)<(n.minFill??cr))return null;let c=[],S=new Set,I=0,w=0,C=0,g=0,h=0,b=1;for(let[_,y]of m){for(let $ of y.seen)S.add($);if(y.seen.size>=a)continue;let x=[...y.seen].sort(($,X)=>$-X),T=1;for(let $=1;$<x.length;$++)T=Math.max(T,x[$]-x[$-1]);let V={key:_,acc:y,coverage:y.seen.size/a,before:y.lo,after:a-1-y.hi,interior:y.hi-y.lo+1-y.seen.size,gap:T};c.push(V),V.before>0&&I++,V.after>0&&w++,V.interior>0&&C++,g=Math.max(g,V.before),h=Math.max(h,V.after),b=Math.max(b,T)}if(c.length===0)return null;c.sort((_,y)=>_.coverage-y.coverage||_.acc.order-y.acc.order);let p=c.slice(0,n.maxListed??ur);return{seriesColumn:n.seriesColumn,grain:o,periods:a,seriesCount:m.size,incompleteSeries:c.length,lateStarts:I,earlyEnds:w,withHoles:C,columnWideMissing:a-S.size,maxMissingBefore:g,maxMissingAfter:h,largestGap:b,series:p.map(_=>{let y={};return n.includeNames&&(y.name=_.key),n.includeDates&&(y.first=zt(_.acc.loStamp,o),y.last=zt(_.acc.hiStamp,o)),y.missingBefore=_.before,y.missingAfter=_.after,y.missingInterior=_.interior,y.largestGap=_.gap,y.coverage=Math.round(_.coverage*1e3)/1e3,y}),more:c.length-p.length}}var we=6;function ue(n){let e=n.slice().sort((i,r)=>i-r),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function yr(n){let e=n.length;if(e<we)return null;let t=n[0],i=n[0],r=0;for(let p of n)p<t&&(t=p),p>i&&(i=p),r+=p;if(t===i)return null;let s=ue(n.map(Math.abs));if(s===0)return null;let o=[];for(let p=1;p<e;p++)o.push(n[p]-n[p-1]);let l=ue(o.map(Math.abs))/s,a=(e-1)/2,u=r/e,m=0,f=0,c=0;for(let p=0;p<e;p++)m+=(p-a)*(n[p]-u),f+=(p-a)*(p-a),c+=(n[p]-u)*(n[p]-u);c/=e;let S=m/f,I=u-S*a,w=n.map((p,_)=>p-(I+S*_)),C=w.reduce((p,_)=>p+_,0)/e,g=0,h=0;for(let p=0;p<e;p++)g+=(w[p]-C)*(w[p]-C),p>0&&(h+=(w[p]-w[p-1])*(w[p]-w[p-1]));return g/=e,h/=e-1,{vnDetrended:g<=c*1e-12?2:h/g,relStep:l}}function Be(n){let{stamps:e,series:t,values:i}=n,r=Math.min(e.length,i.length),s=new Map;for(let u=0;u<r;u++){let m=e[u],f=i[u];if(m===null||f===null||!Number.isFinite(f))continue;let c="";if(t&&(c=t[u]??"",c===""))continue;let S=s.get(c);S||s.set(c,S=new Map),S.set(m,(S.get(m)??0)+f)}let o=[],l=[],a=[];for(let u of s.values()){let m=[...u.entries()].sort((c,S)=>c[0]-S[0]).map(c=>c[1]),f=yr(m);f&&(o.push(f.vnDetrended),l.push(f.relStep),a.push(m.length))}return o.length===0?null:{series:o.length,points:Math.round(ue(a)),vnDetrended:Math.round(ue(o)*1e3)/1e3,relStep:Math.round(ue(l)*1e4)/1e4}}function Oi(n){let e=n.times.map(t=>j(t,n.pattern,n.locale)?.ms??null);return Be({stamps:e,series:n.series,values:n.values})}var br=5e5,Sr=8,_r=4,Ar=5,Ge=1,ze=2,Cr=4,xr=8;function Mr(n,e,t){let[i,r]=[...n];if(e.isTemporal){let s=j(i,e.temporalTextPattern,t),o=j(r,e.temporalTextPattern,t);if(s&&o&&s.ms!==o.ms)return s.ms<o.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 Tr(n,e,t){let{rows:i,text:r,locale:s}=n,o=Mr(t.values,t,s),l=new Uint8Array(i.length),a=0;for(let u=0;u<i.length;u++){let m=r(i[u][e]);m===o.a?l[u]=1:m===o.b?l[u]=2:a++}return{code:l,blankRows:a,setOrder:o.setOrder}}function wr(n,e){let{rows:t,text:i}=n,r=new Int32Array(t.length),s=new Map;for(let o=0;o<t.length;o++){let l=i(t[o][e]);if(l===""){r[o]=-1;continue}let a=s.get(l);a===void 0&&(a=s.size,s.set(l,a)),r[o]=a}return{ids:r,dict:s}}function Rr(n,e,t){let i=new Uint8Array(t);for(let s=0;s<n.length;s++){let o=e[s];if(o===0)continue;let l=n[s];if(l<0)continue;let a=i[l];i[l]=a&o?a|o<<2:a|o}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let s=0;s<t;s++){let o=i[s];o&Ge&&r.keysA++,o&ze&&r.keysB++,(o&(Ge|ze))===(Ge|ze)&&r.keysBoth++,o&Cr&&r.dupA++,o&xr&&r.dupB++}return r}function Ir(n,e){let t=(n.dupA+n.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(n.keysA+n.keysB);return t<i||t===i&&n.keysBoth>e.keysBoth}var Vt=n=>n==null||typeof n=="string"&&n.trim()==="";function Nr(n,e,t){if(n===e)return!0;let i=Vt(n),r=Vt(e);return i||r?i&&r:typeof n=="number"&&typeof e=="number"?!1:n instanceof Date&&e instanceof Date?n.getTime()===e.getTime():t(n).trim()===t(e).trim()}function Kt(n){let{rows:e,columns:t}=n,i=e.length;if(i<2||i>br)return null;let r=t.map((y,x)=>({c:y,i:x})).filter(({c:y})=>!y.isMeasure&&!y.isTemporal&&!y.isDatePart&&y.distinct>=Ar).sort((y,x)=>(x.c.identifierNamed?1:0)-(y.c.identifierNamed?1:0)||x.c.distinct-y.c.distinct||y.i-x.i).slice(0,Sr),s=t.map((y,x)=>({c:y,i:x})).filter(({c:y})=>!y.isMeasure&&y.values!==null&&y.values.size===2).slice(0,_r);if(r.length===0||s.length===0)return null;let o=s.map(({c:y,i:x})=>Tr(n,x,y)),l=null;for(let{i:y}of r){let x=wr(n,y);for(let T=0;T<s.length;T++){if(s[T].i===y)continue;let V=Rr(x.ids,o[T].code,x.dict.size);V.keysBoth<1||(!l||Ir(V,l.tally))&&(l={tally:V,keyIdx:y,setNo:T,ids:x.ids,dict:x.dict})}}if(!l)return null;let{ids:a,dict:u,tally:m}=l,f=o[l.setNo],c=s[l.setNo].i,S=u.size,I=new Int32Array(S).fill(-1),w=new Int32Array(S).fill(-1);for(let y=0;y<i;y++){let x=f.code[y],T=a[y];x===0||T<0||(x===1?I[T]<0&&(I[T]=y):w[T]<0&&(w[T]=y))}let C=[];for(let y=0;y<t.length;y++)y!==l.keyIdx&&y!==c&&C.push(y);let g=0;for(let y=0;y<S;y++){let x=I[y],T=w[y];if(x<0||T<0)continue;let V=e[x],$=e[T],X=!0;for(let J of C)if(!Nr(V[J],$[J],n.text)){X=!1;break}X&&g++}let h=g===m.keysBoth?100:g===0?0:Math.min(99,Math.max(1,Math.round(g/m.keysBoth*100))),b=new Map,p=new Map;for(let[y,x]of u){let T=I[x]>=0,V=w[x]>=0;if(!T&&!V)continue;let $=it(y);st($)&&(T&&b.set($,(b.get($)??0)+1),V&&p.set($,(p.get($)??0)+1))}let _=y=>{let x=0;for(let T of y.values())T>=2&&(x+=T);return x};return{key:l.keyIdx,discriminator:c,pairing:{form:"long",key:t[l.keyIdx].name,discriminator:t[c].name,keysA:m.keysA,keysB:m.keysB,keysBoth:m.keysBoth,duplicateKeysA:m.dupA,duplicateKeysB:m.dupB,identicalPct:h,discriminatorBlankRows:f.blankRows,looseCollisionsA:_(b),looseCollisionsB:_(p),setOrder:f.setOrder}}}var Er=n=>n==="Integer"||n==="Decimal";function vr(n){let e=[],t=[];return n.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||t.push(r)}}),[...e,...t].slice(0,6)}function kr(n,e){let t=[];for(let i=0;i<n.length&&t.length<12;i++){let r=n[i];e.has(i)||!Er(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||t.push(i)}return t}function Ht(n){let e=new Map,{rows:t,columns:i,text:r}=n;if(t.length===0||t.length>(n.maxRows??5e5))return e;let s=vr(i);if(s.length===0)return e;let o=kr(i,new Set(s));if(o.length===0)return e;let l=s.map(a=>{let[u,m]=i[a].twoValues,f=new Uint8Array(t.length);for(let c=0;c<t.length;c++){let S=r(t[c][a]);f[c]=S===u?1:S===m?2:0}return f});for(let a of o){let u=new Float64Array(t.length),m=0;for(let h=0;h<t.length;h++){let b=t[h][a],p=b==null||b===""?NaN:typeof b=="number"?b:parseFloat(b);u[h]=p,p===p&&p!==1/0&&p!==-1/0&&m++}if(m<2)continue;let f=new Float64Array(m);for(let h=0,b=0;h<t.length;h++){let p=u[h];p===p&&p!==1/0&&p!==-1/0&&(f[b++]=p)}f.sort();let c=new Float64Array(m),S=0;for(let h=0;h<m;h++)(h===0||f[h]!==f[h-1])&&(c[S++]=f[h]);let I=new Int32Array(t.length).fill(-1);for(let h=0;h<t.length;h++){let b=u[h];if(!(b===b&&b!==1/0&&b!==-1/0))continue;let p=0,_=S-1;for(;p<_;){let y=p+_>>>1;c[y]<b?p=y+1:_=y}I[h]=p}let w=[],C=new Int32Array(S),g=new Int32Array(S);for(let h=0;h<s.length;h++){let b=l[h];C.fill(0),g.fill(0);let p=0,_=0;for(let d=0;d<t.length;d++){let A=I[d];A<0||(b[d]===1?(C[A]++,p++):b[d]===2&&(g[A]++,_++))}if(p===0||_===0)continue;let y=p<=_,x=y?p:_,T=y?_:p,V=y?C:g,$=y?g:C,X=0,J=0,Y=0;for(let d=0;d<S;d++){let A=V[d],F=$[d];X+=A*(J+.5*F),J+=F,A+F>=2&&(Y+=A+F)}w.push({outcome:i[s[h]].name,aucMinorityHigh:Math.round(X/(x*T)*1e4)/1e4,nMinority:x,nMajority:T,ties:Y})}w.length>0&&e.set(a,w)}return e}var Dr=12,Or=100,Pr=.3,Lr=.9,Fr=120,Wr=1900,Br=2100,Gr=0,zr=20,$r=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Re(n){if(!n)return!1;let e=ee(n);return e.length===0?!1:$r.has(e[e.length-1])?!0:Dt(n)!==null}var Ur=new Set(["year","yr","fy"]),Vr=n=>ee(n).some(e=>Ur.has(e))||rt(n)!==null,Kr=/^(?:(?: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 $e(n){if(!Number.isInteger(n)||n<190001||n>210012)return!1;let e=n%100;return e>=1&&e<=12}function Ue(n){if(!Number.isInteger(n)||n<19000101||n>21001231)return!1;let e=Math.floor(n/100)%100,t=n%100;return e>=1&&e<=12&&t>=1&&t<=31}var Hr=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Yr=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,jr=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Zt(n,e){let t=[],i=0,r=Xr(n,e,t,()=>{i++});if(r)return r;if(i>0||t.length<2)return null;let s=yt(t,{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 Xr(n,e,t,i){let r=0,s=0,o=0,l=0,a=0,u="",m=0,f="",c=0,S=0,I=0,w=0,C=!1;for(let y of n){if(y==null)continue;let x=String(y).trim();if(x==="")continue;r++,t.push(x);let T;if(T=Hr.exec(x)){i();let V=+T[2],$=+T[3];V>=1&&V<=12&&$>=1&&$<=31&&(s++,T[4]!==void 0&&o++,T[6]!==void 0&&l++)}else if(T=Yr.exec(x)){i();let V=+T[3],$=+T[4];V>=1&&V<=12&&$>=1&&$<=31&&(u&&u!==T[2]&&(C=!0),u=T[2],a++)}else if(T=jr.exec(x)){i();let V=+T[1],$=+T[3];V>=1&&V<=31&&$>=1&&$<=31&&(V<=12||$<=12)&&(f&&f!==T[2]&&(C=!0),f=T[2],m++,V>12&&I++,$>12&&w++,T[5]!==void 0&&c++,T[7]!==void 0&&S++)}if(r>=200)break}if(r<2||(s+a+m)/r<.8||(s>0?1:0)+(a>0?1:0)+(m>0?1:0)!==1||C)return null;if(s>0)return o===s?{pattern:l===s?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(a>0)return{pattern:`%Y${u}%m${u}%d`,orderFrom:"iso"};if(I>0&&w>0)return null;let b,p;I>0?(b=!0,p="values"):w>0?(b=!1,p="values"):f==="."?(b=!0,p="shape"):(b=!De(e),p="locale");let _=b?`%d${f}%m${f}%Y`:`%m${f}%d${f}%Y`;return c===m?{pattern:_+(S===m?" %H:%M:%S":" %H:%M"),orderFrom:p}:{pattern:_,orderFrom:p}}function Zr(n,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(n))return!1;let t=n.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!t)return!1;let i=te(t);return i.length>0&&e[i]!==void 0}function Qr(n,e){let t=new Map,i=new Map;for(let l of n){let a=ie(l);if(!a||"month"in a)continue;let u=se(a.word),m=u.some(c=>c.lang==="en"),f=te(a.word);for(let c of new Set(u.map(S=>S.lang)))c!=="en"&&(t.has(c)||(t.set(c,new Set),i.set(c,new Set)),t.get(c).add(f),m||i.get(c).add(f))}let r=[...t.keys()].filter(l=>t.get(l).size>=3&&i.get(l).size>=1),s=0,o=new Map(r.map(l=>[l,0]));for(let l of e){let a=ie(l);if(!a)continue;if("month"in a){s++;continue}let u=se(a.word);if(u.length===0)continue;let m=u.some(f=>f.lang==="en");for(let f of r)(m||u.some(c=>c.lang===f))&&o.set(f,o.get(f)+1)}return s+Math.max(0,...o.values())}var qr=/(?:19|20)[0-9]{2}/;function Jr(n){let e=new Map,t=0;for(let r of n){if(!qr.test(me(r)))continue;let s=new Set(ge(r).filter(o=>o.yearDigits===4&&(o.grain==="quarter"||o.grain==="week")).map(o=>o.lang));if(s.size!==0){if(s.has("en")){t++;continue}for(let o of s)e.set(o,(e.get(o)??0)+1)}}let i=0;for(let r of e.values())i=Math.max(i,r);return i>0?i+t:0}function ei(n){let{dataType:e,name:t,isMeasure:i,distinctCount:r}=n;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=n.minNum,o=n.maxNum;if(!(s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&Number.isInteger(s)&&Number.isInteger(o)&&o>=s))return!1;let a=s>=1900&&o<=2100;if(a&&r>=2&&Vr(t)||a&&r>=3&&r===o-s+1)return!0;let u=$e(s)&&$e(o),m=Ue(s)&&Ue(o);if(u||m){if(!n.sampleValues)return!0;let f=0,c=0;for(let S of n.sampleValues){if(S==null||S==="")continue;f++;let I=Number(String(S).trim());if(Number.isFinite(I)&&(u?$e(I):Ue(I))&&c++,f>=60)break}if(f>=2&&c===f)return!0}return!1}if(n.sampleValues){let s=n.locale?ye(n.locale):null,o=0,l=0,a=[],u=[];for(let m of n.sampleValues){if(m==null||m==="")continue;o++;let f=String(m).trim();if(a.push(f),Kr.test(f)||Zr(f,s)?l++:u.push(f),o>=60)break}if(o>=2&&l/o>=.8||o>=2&&(l+Jr(u)+Qr(a,u))/o>=.8||Zt(a,n.locale)!==null)return!0}return!1}function ti(n){let e=q((n||"").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":xt(n)}function ni(n){let{rows:e,measureColIdx:t,measureName:i,candidateDims:r,minNum:s,maxNum:o,discourageAgg:l}=n,a=100,u=.01,m="";for(let c of r){if(c.distinct<2||c.distinct>a)continue;let S=r.filter(h=>h.idx!==c.idx).map(h=>h.idx),I=new Map;for(let h of e){let b=h[t];if(typeof b!="number"||!Number.isFinite(b))continue;let p=S.length?S.map(y=>String(h[y])).join(m):"",_=I.get(p);_||(_={sum:0,cset:new Set},I.set(p,_)),_.sum+=b,_.cset.add(String(h[c.idx]))}let w=0,C=0,g=0;for(let h of I.values())h.cset.size<2||(g++,Math.abs(h.sum-100)<=100*u?w++:Math.abs(h.sum-1)<=1*u&&C++);if(g>=2&&(w/g>=.9||C/g>=.9))return{additivity:"part_of_whole",partOfWholeDim:c.name}}if(l)return{additivity:"intensive_rate"};let f=ti(i);return f==="avg"||f==="min"||f==="max"?{additivity:"intensive_rate"}:f==="count"?{additivity:"additive"}:f==="sum"?{additivity:"unknown"}:s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&s>=0&&o<=1.0001&&o>0?{additivity:"intensive_rate"}:{additivity:"unknown"}}function Qt(n){let{dataType:e,isMeasure:t,name:i,distinct:r,nonblank:s,prec:o,maxval:l,minval:a}=n,u=l-a+1,m=u>0?r/u:1,f=s>0?r/s:0,c=e==="Decimal"||o>0;return!t&&Re(i)?"Categorical":m>=Lr&&(ot(i)&&r<=Fr||a>=Wr&&l<=Br||a>=Gr&&l<=zr)?"Ordinal":t||r>Dr&&(c||r>=Or||f>=Pr)?"Continuous":"Categorical"}function jt(n,e,t){return!n||n.isMeasure||e||n.dataType!=="Integer"&&n.dataType!=="Decimal"?!1:Qt({dataType:n.dataType,isMeasure:!1,name:n.name,distinct:t.distinct,nonblank:t.nonblank,prec:t.prec,maxval:typeof t.maxval=="number"?t.maxval:0,minval:typeof t.minval=="number"?t.minval:0})==="Continuous"}function ri(n){let e=null;for(let t=0;t<n.length;t++){let i=n[t];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=n.slice()),e[t]=r)}return e||n}var Xt=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let t=0;t<this._cols.length;t++){let i=this._cols[t];!i||!/date|time/i.test(String(i.dataType??""))||tt(this._rows.map(r=>r[t]))&&e.add(t)}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(t=>!!(t&&t.isMeasure));return this._cols.forEach((t,i)=>{if(!t||t.isMeasure||this._declaredDimensions.has(t)||t.dataType!=="Integer"&&t.dataType!=="Decimal")return;let r=new Set,s=0,o=0,l=null,a=null;for(let u of this._rows){let m=u[i],f=this.STR(m);if(f!=""&&(r.add(f),s++,(l===null||m<l)&&(l=m),(a===null||m>a)&&(a=m),t.dataType=="Decimal")){let c=this.getPrecision(m);c>o&&(o=c)}}e[i]=jt(t,!1,{distinct:r.size,nonblank:s,prec:o,minval:l,maxval:a})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let t of e)t&&this._declaredDimensions.add(t)}wholeDayIso(e){return et(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,t){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),o=[],l=[],a=[];for(let d of this._cols){let A=new Map,F=[],D=0,M=0,k=0,L=null,O=null,v=null,G=!1,z=!0,N=!0,E=null,U=!1,P=s.has(i);for(let R of this._rows){let W=R[i],B=P&&W instanceof Date?fe(W):W,K=this.STR(B);if(K!=""){if(D+=K.length,A.set(K,(A.get(K)||0)+1),M++,d.dataType=="Integer"||d.dataType=="Decimal"||d.dataType=="DateTime")if((L===null||B<L)&&(L=B),(O===null||B>O)&&(O=B),d.dataType=="Integer"||d.dataType=="Decimal"){if(v===null?v=B:v+=B,d.dataType=="Decimal"){let Z=this.getPrecision(B);Z>k&&(k=Z)}F.push(B)}else G=G||this.hasTimeComponent(B);U&&(B<E?z=!1:B>E&&(N=!1)),E=B,U=!0}}if(M>=3&&(z&&!N?d.sortedDirection="asc":N&&!z?d.sortedDirection="desc":d.sortedDirection="none"),M>0&&A.size>0&&!d.isMeasure){let R=0,W=Number.MAX_SAFE_INTEGER;for(let B of A.values())B>R&&(R=B),B<W&&(W=B);if(d.modalShare=R/M,d.minGroupCount=W===Number.MAX_SAFE_INTEGER?null:W,A.size===2){let B=[...A.keys()].map(ce=>Qe(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]),qt=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(d.name);(Z||qt)&&(d.isBinaryFlag=!0)}}else d.isMeasure&&(d.dataType==="Integer"||d.dataType==="Decimal")&&A.size===2&&A.has("0")&&A.has("1")&&(d.isBinaryFlag=!0);if(d.dataType=="DateTime"&&(d.dateWithTime=G,G&&nt(P?this._rows.map(R=>R[i]instanceof Date?fe(R[i]):R[i]):this._rows.map(R=>R[i]))?d.timeOfDayOnly=!0:delete d.timeOfDayOnly),d.isTemporal=ei({dataType:d.dataType,name:d.name,isMeasure:d.isMeasure,distinctCount:A.size,minNum:typeof L=="number"?L:null,maxNum:typeof O=="number"?O:null,sampleValues:A.keys(),locale:t}),d.isTemporal&&d.dataType==="String"&&!d.isMeasure){let R=Zt(A.keys(),t);R&&(d.temporalTextPattern=R.pattern)}if(d.timeOfDayOnly)delete d.temporalCadence;else if(d.isTemporal&&!d.isMeasure){let R=Bt(A.keys(),{includeBounds:r>=20,pattern:d.temporalTextPattern,locale:t});R&&(d.temporalCadence=R)}this.updateColumnStats10(r,d,M,A,k,O,L),this.updateColumnStats20(r,F,M,v,d,D,G,L,O,k,A,t),jt(d,this._declaredDimensions.has(d),{distinct:A.size,nonblank:M,prec:k,minval:L,maxval:O})&&(d.isMeasure=!0,d.geoKind=void 0,d.geoMatchPct=void 0,d.geoAmbiguous=void 0,d.dominantGeoRegion=void 0,d.dominantGeoRegionPct=void 0,d.geoRegionCount=void 0),o[i]=d.isMeasure||A.size>2e3?null:new Set(A.keys()),l[i]=A.size,a[i]=A.size===2?[...A.keys()].sort():null,i++}let u=[];this._cols.forEach((d,A)=>{d.isMeasure||u.push({idx:A,distinct:d.distinctCount??0,name:d.name})}),this._cols.forEach((d,A)=>{if(!d.isMeasure)return;let F=typeof d.lowValue=="number"?d.lowValue:null,D=typeof d.highValue=="number"?d.highValue:null,M=ni({rows:this._rows,measureColIdx:A,measureName:d.name,candidateDims:u,minNum:F,maxNum:D,discourageAgg:!!d.discourageAggregationAcrossGroups});d.additivity=M.additivity,M.partOfWholeDim&&(d.partOfWholeDim=M.partOfWholeDim)});let m=50,f=4,c=u.filter(d=>d.distinct>=2&&d.distinct<=m);this._cols.forEach((d,A)=>{if(!d.isMeasure)return;let F=[];for(let N of this._rows){let E=N[A];if(E==null||E==="")continue;let U=typeof E=="number"?E:parseFloat(E);isNaN(U)||F.push(U)}if(F.length===0)return;let D=[...F].sort((N,E)=>N-E);if(D[0]===D[D.length-1])d.relativeDispersion=0;else if(D.length>=f){let N=Q(D,.5),E=Q(D,.1),U=Q(D,.9);d.relativeDispersion=Math.abs(N)>1e-9?Math.round((U-E)/Math.abs(N)*1e3)/1e3:void 0}else d.relativeDispersion=void 0;let M=[];for(let N of c){let E=new Set;for(let U of this._rows){let P=U[A];P==null||P===""||E.add(this.STR(U[N.idx])+"")}M.push({otherColumn:N.name,nonBlankGroupCount:E.size})}M.length>0&&(d.nonBlankGroups=M);let k=0;for(let N of F)k+=N;k/=F.length;let L=0;for(let N of F)L+=(N-k)*(N-k);if(L<=1e-12)return;let O=[],v=[],G=N=>{if(N.length<4)return NaN;let E=[...N].sort((P,R)=>P-R),U=P=>E[Math.min(E.length-1,Math.max(0,Math.floor(P*(E.length-1))))];return U(.75)-U(.25)},z=G(F);for(let N of c){let E=new Map;for(let R of this._rows){let W=R[A];if(W==null||W==="")continue;let B=typeof W=="number"?W:parseFloat(W);if(isNaN(B))continue;let K=this.STR(R[N.idx])+"",Z=E.get(K);Z?(Z.s+=B,Z.n++,Z.vals.push(B)):E.set(K,{s:B,n:1,vals:[B]})}let U=0;for(let R of E.values()){let W=R.s/R.n;U+=R.n*(W-k)*(W-k)}O.push({otherColumn:N.name,eta2:Math.round(U/L*1e4)/1e4});let P=[];for(let R of E.values()){let W=G(R.vals);isNaN(W)||P.push(W)}if(P.length>=2&&isFinite(z)&&z>1e-9){let R=(Math.max(...P)-Math.min(...P))/z;v.push({otherColumn:N.name,spreadRatio:Math.round(R*1e4)/1e4})}}O.length>0&&(d.groupDiscrimination=O),v.length>0&&(d.spreadDiscrimination=v)});let S=.97,I=.8,w=8,C=5,g=this._cols.map((d,A)=>({c:d,i:A})).filter(d=>d.c.isMeasure);for(let d=0;d<g.length;d++)for(let A=d+1;A<g.length;A++){let F=g[d].i,D=g[A].i,M=0,k=0,L=0,O=0,v=0,G=0;for(let P of this._rows){let R=P[F],W=P[D];if(R==null||R===""||W===null||W===void 0||W==="")continue;let B=typeof R=="number"?R:parseFloat(R),K=typeof W=="number"?W:parseFloat(W);isNaN(B)||isNaN(K)||(M++,k+=B,L+=K,O+=B*B,v+=K*K,G+=B*K)}if(M<C)continue;let z=M*O-k*k,N=M*v-L*L;if(z<=1e-12||N<=1e-12)continue;let E=(M*G-k*L)/Math.sqrt(z*N),U=Math.min(1,Math.round(Math.abs(E)*1e3)/1e3);for(let P of[g[d].c,g[A].c])(P.maxAbsMeasureCorrelation===void 0||U>P.maxAbsMeasureCorrelation)&&(P.maxAbsMeasureCorrelation=U);if(Math.abs(E)>=S){let P=g[d].c,R=g[A].c;P.collinearWithMeasures||(P.collinearWithMeasures=[]),R.collinearWithMeasures||(R.collinearWithMeasures=[]),P.collinearWithMeasures.push(R.name),R.collinearWithMeasures.push(P.name)}else if(Math.abs(E)>=I){let P=g[d].c,R=g[A].c,W=Math.round(E*1e3)/1e3;P.correlatedWithMeasures||(P.correlatedWithMeasures=[]),R.correlatedWithMeasures||(R.correlatedWithMeasures=[]),P.correlatedWithMeasures.push({otherColumn:R.name,r:W}),R.correlatedWithMeasures.push({otherColumn:P.name,r:W})}}for(let{c:d}of g)d.correlatedWithMeasures&&(d.correlatedWithMeasures.sort((A,F)=>Math.abs(F.r)-Math.abs(A.r)||(A.otherColumn<F.otherColumn?-1:1)),d.correlatedWithMeasures.length=Math.min(d.correlatedWithMeasures.length,w));for(let d=0;d<this._cols.length;d++){let A=o[d];if(!A||A.size===0)continue;let F=[];for(let D=0;D<this._cols.length;D++){if(D===d)continue;let M=o[D];if(!M||M.size===0)continue;let k=0;for(let O of A)M.has(O)&&k++;let L=Math.round(k/A.size*100);L>0&&F.push({otherColumn:this._cols[D].name,percentShared:L})}F.length>0&&(this._cols[d].sharedValueRatioWithOthers=F)}let h=50,b=[];for(let d=0;d<this._cols.length;d++){let A=o[d];A&&A.size>=2&&A.size<=h&&b.push(d)}if(b.length>=2){let d=new Map,A=(D,M)=>D+":"+M;for(let D=0;D<b.length;D++)for(let M=D+1;M<b.length;M++)d.set(A(b[D],b[M]),new Map);for(let D of this._rows)for(let M=0;M<b.length;M++){let k=this.STR(D[b[M]])+"";for(let L=M+1;L<b.length;L++){let O=""+this.STR(D[b[L]]),v=d.get(A(b[M],b[L])),G=k+""+O;v.set(G,(v.get(G)??0)+1)}}let F=new Map;for(let D=0;D<b.length;D++)for(let M=D+1;M<b.length;M++){let k=b[D],L=b[M],O=o[k].size,v=o[L].size,G=d.get(A(k,L)),z=G.size,N=0;for(let R of G.values())(N===0||R<N)&&(N=R);let E=Math.round(z/(O*v)*100),U=z===O,P=z===v;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[L].name,fillPct:E,determinesOther:U,minCellCount:N,distinctCombinations:z}),(this._cols[L].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:E,determinesOther:P,minCellCount:N,distinctCombinations:z}),U&&O>v){let R=F.get(k);(!R||v<R.card)&&F.set(k,{name:this._cols[L].name,card:v,ratio:v/O})}if(P&&v>O){let R=F.get(L);(!R||O<R.card)&&F.set(L,{name:this._cols[k].name,card:O,ratio:O/v})}}for(let[D,M]of F)this._cols[D].primaryParentColumn=M.name,this._cols[D].nestingRatio=Math.round(M.ratio*100)/100}let p=6,_=this._rows.length;for(let d=0;d<this._cols.length;d++){let A=this._cols[d];if(A.isMeasure||A.primaryParentColumn)continue;let F=A.distinctCount??0;if(F<=h||_>0&&F>=_)continue;let D=[];for(let M=0;M<this._cols.length;M++){if(M===d)continue;let k=this._cols[M];if(k.isMeasure)continue;let L=k.distinctCount??0;L<2||L>=F||D.push(M)}D.sort((M,k)=>(this._cols[M].distinctCount??0)-(this._cols[k].distinctCount??0));for(let M of D.slice(0,p)){let k=new Map,L=!0;for(let v of this._rows){let G=this.STR(v[d])+"",z=this.STR(v[M])+"",N=k.get(G);if(N===void 0)k.set(G,z);else if(N!==z){L=!1;break}}if(!L)continue;let O=this._cols[M].distinctCount??0;A.primaryParentColumn=this._cols[M].name,A.nestingRatio=Math.round(O/F*100)/100;break}}let y=.01,x=.05,T=.95,V=8,$=8,X=6,J=500,Y=[];for(let d=0;d<this._cols.length&&Y.length<$;d++){let A=this._cols[d].dataType;(A==="Double"||A==="Integer"||A==="Decimal")&&Y.push(d)}if(Y.length>=3&&this._rows.length>=V){let d=Math.min(this._rows.length,J),A=Y.map(O=>{let v=[];for(let N=0;N<d;N++){let E=this._rows[N][O],U=typeof E=="number"?E:parseFloat(String(E).replace(/,/g,""));if(E==null||E===""||!isFinite(U))return null;v.push(U)}let G=v[0],z=!1;for(let N of v)if(N!==G){z=!0;break}return z?v:null}),F=Y.map((O,v)=>v).filter(O=>A[O]!==null),D=O=>{let v=O.slice().sort((z,N)=>z-N),G=v.length>>1;return v.length%2?v[G]:(v[G-1]+v[G])/2},M=null,k=[],L=O=>{if(k.length>=3){let v=k.map(E=>A[E]),G=v[0].length,z=new Array(G);for(let E=0;E<G;E++){let U=0;for(let P of v)U+=P[E];z[E]=U}let N=D(z);if(N>0){let E=0;for(let P of z)Math.abs(P-N)<=N*y&&E++;let U=E/G;if(U>=T){let P=1;for(let R of v){let W=D(R)/N;W<P&&(P=W)}P>=x&&(!M||k.length>M.cols.length)&&(M={cols:k.slice(),total:N,matched:U})}}}if(!(k.length>=X))for(let v=O;v<F.length;v++)k.push(F[v]),L(v+1),k.pop()};if(L(0),M){let O=M,G={columns:O.cols.map(z=>this._cols[Y[z]].name),total:Math.round(O.total*1e3)/1e3,matchedPct:Math.round(O.matched*100)/100};for(let z of O.cols)this._cols[Y[z]].constantSumGroup=G}}return this.applyTwoSetPairing(t,o),this.applyScoreSeparation(l,a),this.applySeriesCompleteness(r,t,o),this.applyMeasurePersistence(t,o),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,t){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=Kt({rows:this._rows,columns:this._cols.map((r,s)=>{let o=t[s];return{name:r.name,values:o,distinct:o?o.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,t){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=Ht({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:t[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,t,i){for(let u of this._cols)u.seriesCompleteness!==void 0&&delete u.seriesCompleteness;let r=this._cols.map((u,m)=>({c:u,i:m})).filter(({c:u})=>u.isTemporal&&!u.isMeasure&&u.temporalCadence&&u.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=this.seriesKeyIndex(t,i);if(s<0)return;let o=this._cols[s],l=this._rows.map(u=>this.STR(u[s])),a=e>=20&&(o.dataType!=="String"||Array.isArray(o.safeDistinctValues));for(let{c:u,i:m}of r){let f=Ut({periods:this._rows.map(c=>this.STR(c[m])),series:l,seriesColumn:o.name,pattern:u.temporalTextPattern,locale:t,includeDates:e>=20,includeNames:a});f&&(u.seriesCompleteness=f)}}seriesKeyIndex(e,t){let i=[],r=[];this._cols.forEach((o,l)=>{let a=t[l];a&&(i.push(l),r.push({name:o.name,dataType:o.dataType,isMeasure:!!o.isMeasure,isTemporal:!!o.isTemporal,isDatePart:!!o.isDatePart,isReassembledDate:!!o.isReassembledDate,isBinaryFlag:!!o.isBinaryFlag,geoKind:o.geoKind,identifierNamed:Re(o.name),values:a,rows:this._rows.length,locale:e}))});let s=$t(r);return s<0?-1:i[s]}applyMeasurePersistence(e,t){for(let a of this._cols)a.persistence!==void 0&&delete a.persistence;let i=[];if(this._cols.forEach((a,u)=>{a.isMeasure&&(a.dataType==="Integer"||a.dataType==="Decimal"||a.dataType==="Double")&&i.push(u)}),i.length===0||this._rows.length<we)return;let r=-1,s=[];for(let a=0;a<this._cols.length&&r<0;a++){let u=this._cols[a];if(!u.isTemporal||u.isMeasure||u.isDatePart)continue;let m=this._rows.map(f=>j(this.STR(f[a]),u.temporalTextPattern,e)?.ms??null);new Set(m.filter(f=>f!==null)).size<we||(r=a,s=m)}if(r<0)return;let o=this.seriesKeyIndex(e,t),l=o>=0?this._rows.map(a=>this.STR(a[o])):void 0;for(let a of i){let u=this._rows.map(f=>{let c=f[a];if(c==null||c==="")return null;let S=typeof c=="number"?c:parseFloat(String(c).replace(/,/g,""));return Number.isFinite(S)?S:null}),m=Be({stamps:s,series:l,values:u});m&&(this._cols[a].persistence={timeColumn:this._cols[r].name,...o>=0?{seriesColumn:this._cols[o].name}:{},...m})}}updateColumnStats20(e,t,i,r,s,o,l,a,u,m,f,c){if(e>=20){let S=[...t].sort((C,g)=>C-g),I=Math.floor(S.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=o/i),this._rows.length>0){let C=g=>{let h=g instanceof Date?g:typeof g=="string"?Ne(g)??new Date(g):new Date(g),b=this.wholeDayIso(h);return b?b+"T00:00:00.000Z":isNaN(h.getTime())?g:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!a?s.lowValue=a:s.lowValue=C(a),s.dataType!="DateTime"||l||!u?s.highValue=u:s.highValue=C(u),s.medianValue=S.length===0?null:S.length%2===0?s.dataType=="Integer"?Math.round((S[I-1]+S[I])/2):(S[I-1]+S[I])/2:S[I],s.numericPrecision=m}if(S.length>0){let C=s.avgValue??0,g=S.length,h=0,b=0;for(let y of S){let x=y-C;h+=x*x,b+=x*x*x}let p=h/g,_=Math.sqrt(p);s.skewness=p===0?0:b/g/(_*_*_),s.stdDev=Math.sqrt(p)}r!==null&&(s.sum=r);let w=Array.from(f.entries()).sort((C,g)=>g[1]-C[1]);if(s.topCategories=w.slice(0,10).map(C=>C[1]),!s.isMeasure&&w.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=w.slice(0,5).map(C=>C[0])),e>=20)){let C=w.map(h=>h[0]),g=pe(C,c);if(g!==null)s.ordinalPattern=g.pattern,s.orderedDomain=g.orderedDomain;else if(s.dataType==="String"){let h=at(C);h!==null&&(s.safeDistinctValues=h)}}if(S.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let C=g=>S[Math.floor((S.length-1)*g)];s.quantiles={p05:C(.05),p25:C(.25),p75:C(.75),p95:C(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&f.size>0){let S=Array.from(f.entries()).sort((C,g)=>g[1]-C[1]).map(C=>C[0]);s.formatSignature=he(S);let I=i>0?o/i:void 0,w=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!w.test(s.formatSignature)&&(I===void 0||I>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&f.size>0){let S=Array.from(f.entries()).sort((w,C)=>C[1]-w[1]),I=ct(S.map(w=>w[0]),s.name,c);if(I!==null&&(s.geoKind=I.geoKind,s.geoMatchPct=I.geoMatchPct,I.geoAmbiguous&&(s.geoAmbiguous=!0),I.geoKind.indexOf("country")===0)){let w=Ee(S);w&&(s.dominantGeoRegion=w.dominantGeoRegion,s.dominantGeoRegionPct=w.dominantGeoRegionPct,s.geoRegionCount=w.regionCount)}}}updateColumnStats10(e,t,i,r,s,o,l){let a=this._rows.length-i;e>=10&&(t.blankCount=a),t.distinctCount=r.size+(a!=0?1:0),t.valueNature="Categorical",i>0&&(t.dataType==="Integer"||t.dataType==="Decimal"?t.valueNature=Qt({dataType:t.dataType,isMeasure:!!t.isMeasure,name:t.name,distinct:r.size,nonblank:i,prec:s,maxval:o,minval:l}):t.dataType==="DateTime"&&(t.valueNature=t.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 t=new Set;for(let i of this._rows)t.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=t.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>Ke(o,{camel:!0}),t=-1,i=-1,r=-1;if(this._cols.forEach((o,l)=>{let a=e(o.name),u=o.dataType==="Integer"||o.dataType==="Decimal";u&&t<0&&a.some(m=>m==="lat"||m==="latitude")?t=l:u&&i<0&&a.some(m=>m==="lon"||m==="lng"||m==="long"||m==="longitude")&&(i=l),r<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(r=l)}),t<0||i<0)return null;let s=[];for(let o of this._rows){let l=o[t],a=o[i],u=l==null||l===""?null:Number(l),m=a==null||a===""?null:Number(a);s.push({lat:u,lon:m,country:r>=0&&Se(this.STR(o[r]))?this.STR(o[r]):null})}return this._geoExtent=gt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;obfuscateString(e){return Lt(e,Je)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(t=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=t[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=t[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=t[r]);return i})}async getCSVAsync(e){let t=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,o=this.wallClockColumnIndexes();for(let a of this._rows){let u={};for(let m=0;m<this._cols.length;m++){let f=this._cols[m],c=a[m];if(this.STR(c)!=""){if(e&&f.dataType=="String")if(s.has(c))c=s.get(c);else{let S=this.obfuscateString(c);s.set(c,S),c=S}else if(f.dataType=="DateTime"&&!f.dateWithTime){let S=c instanceof Date?c:typeof c=="string"?Ne(c)??new Date(c):new Date(c);c=(this.wholeDayIso(S)??S.toISOString().slice(0,10))+"T00:00:00.000Z"}else o.has(m)&&c instanceof Date&&(c=fe(c));r-=this.STR(c).length}else c=null;u[m]=c,--r}if(t.push(u),--i,i<=0||r<=0)break}return await Yt.unparse(t,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return Yt.unparse([this._cols.map((t,i)=>{if(this.emitLegacyAggAliases&&t.hostName)return this.STR(t.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:t.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(t=>t==null?null:this.STR(t)),this._englishAliases=new Map}aliasesForCode(e){let t=Le(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())t.push({name:i.name,alias:i.alias,reason:"english-implicit-agg"});return t}armAliasesForCode(e){return this.emitLegacyAggAliases=Le(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let t of this.liveEnglishAliases().values())e.push({name:t.name,alias:t.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let t of this._cols)t&&t.hostName&&t.hostName!==t.name&&e.push({name:this.STR(t.name),alias:this.STR(t.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let t=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return t;let i=String(e),r=new Set;for(let o of this._cols)o&&(r.add(this.STR(o.name)),o.hostName&&r.add(this.STR(o.hostName)));let s=new Map;for(let o=0;o<this._cols.length;o++){if(!this._cols[o]||Rt(this._hostQueryNames[o],this._cols[o].name,this._cols[o].dataType))continue;let l=wt(this._hostQueryNames[o]).filter(a=>!r.has(a)&&ae(i,a));l.length===1&&s.set(l[0],[...s.get(l[0])??[],o])}for(let[o,l]of s){if(l.length!==1)continue;let a=this.STR(this._cols[l[0]].name);t.set(l[0],{name:a,alias:o,headerName:!ae(i,a)})}return t}liveEnglishAliases(){let e=new Map;for(let[t,i]of this._englishAliases){let r=this._cols?this._cols[t]:null;r&&this.STR(r.name)===i.name&&e.set(t,i)}return e}addRow(e,t){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=qe(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(ri(e)),this._inferredMeasureFlags=null,this._origIndices.push(t??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}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 t=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=Mt(r);!s||s===r||t.has(s)||(t.delete(r),t.add(s),i.hostName=r,i.name=s)}}};export{gt as a,tn as b,Se as c,oi as d,yt as e,gn as f,pn as g,hn as h,yn as i,xe as j,wn as k,Mt as l,Le as m,wt as n,Nt as o,Nn as p,vt as q,kt as r,fi as s,gi as t,pi as u,kn as v,Dn as w,On as x,Dt as y,ae as z,Hn as A,Ci as B,Yn as C,jn as D,j as E,Bt as F,ur as G,cr as H,mr as I,hr as J,$t as K,Ut as L,Oi as M,Re as N,Zt as O,ei as P,ti as Q,ni as R,Qt as S,jt as T,ri as U,Xt as V};
@@ -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 v}from"./chunk-5MRZID36.mjs";import{a as z,b as g,d as H,e as I}from"./chunk-5HI6TVMM.mjs";var J="AB|CA|Alberta|-113.75|52.18,AK|US|Alaska|-148.32|61.29,AL|US|Alabama|-86.73|33.08,AR|US|Arkansas|-92.85|35.29,AZ|US|Arizona|-111.99|33.32,BC|CA|British Columbia|-122.73|49.27,CA|US|California|-119.21|35.2,CO|US|Colorado|-105|39.63,CT|US|Connecticut|-73.01|41.42,DC|US|District of Columbia|-77.04|38.9,DE|US|Delaware|-75.59|39.57,FL|US|Florida|-81.29|27.53,GA|US|Georgia|-84.02|33.43,HI|US|Hawaii|-157.73|21.26,IA|US|Iowa|-92.79|41.88,ID|US|Idaho|-115.65|44.2,IL|US|Illinois|-88.05|41.67,IN|US|Indiana|-86.27|40.23,KS|US|Kansas|-96|38.59,KY|US|Kentucky|-84.91|38.13,LA|US|Louisiana|-91.28|30.57,MA|US|Massachusetts|-71.28|42.32,MB|CA|Manitoba|-97.3|49.88,MD|US|Maryland|-76.79|39.18,ME|US|Maine|-70.01|43.92,MI|US|Michigan|-83.69|42.56,MN|US|Minnesota|-93.26|44.98,MO|US|Missouri|-92.66|38.73,MS|US|Mississippi|-89.62|32.36,MT|US|Montana|-111.07|46.37,MX01|MX|Aguascalientes|-102.29|21.91,MX02|MX|Baja California|-116.5|32.46,MX03|MX|Baja California Sur|-110.12|23.52,MX04|MX|Campeche|-91.08|19.25,MX05|MX|Chiapas|-92.77|16.28,MX06|MX|Chihuahua|-106.27|30.1,MX07|MX|Coahuila|-101.88|26.32,MX08|MX|Colima|-103.94|19.15,MX09|MX|Mexico City|-99.13|19.41,MX10|MX|Durango|-104.24|24.64,MX11|MX|Guanajuato|-101.37|20.87,MX12|MX|Guerrero|-99.83|17.31,MX13|MX|Hidalgo|-98.81|20.13,MX14|MX|Jalisco|-103.39|20.64,MX15|MX|M\xE9xico|-99.14|19.51,MX16|MX|Michoac\xE1n|-101.68|19.49,MX17|MX|Morelos|-99.15|18.88,MX18|MX|Nayarit|-104.89|21.5,MX19|MX|Nuevo Le\xF3n|-100.26|25.69,MX20|MX|Oaxaca|-96.23|17.05,MX21|MX|Puebla|-98.12|19.07,MX22|MX|Quer\xE9taro|-100.35|20.57,MX23|MX|Quintana Roo|-87.09|20.7,MX24|MX|San Luis Potos\xED|-100.7|22.22,MX25|MX|Sinaloa|-107.49|24.63,MX26|MX|Sonora|-111.05|29.37,MX27|MX|Tabasco|-92.98|17.99,MX28|MX|Tamaulipas|-98.33|24.92,MX29|MX|Tlaxcala|-98.19|19.31,MX30|MX|Veracruz|-96.31|19.2,MX31|MX|Yucat\xE1n|-89.52|20.94,MX32|MX|Zacatecas|-102.7|22.93,NB|CA|New Brunswick|-65.73|45.83,NC|US|North Carolina|-79.61|35.57,ND|US|North Dakota|-98.8|47.31,NE|US|Nebraska|-96.42|41.07,NH|US|New Hampshire|-71.37|43,NJ|US|New Jersey|-74.34|40.51,NL|CA|Newfoundland and Labrador|-52.77|47.55,NM|US|New Mexico|-106.28|34.69,NS|CA|Nova Scotia|-63.11|44.86,NV|US|Nevada|-115.95|36.72,NY|US|New York|-74.13|40.89,OH|US|Ohio|-82.75|40.53,OK|US|Oklahoma|-97.01|35.66,ON|CA|Ontario|-79.27|43.94,OR|US|Oregon|-122.75|44.96,PA|US|Pennsylvania|-76.12|40.23,PE|CA|Prince Edward Island|-63.13|46.23,QC|CA|Quebec|-73.14|45.89,RI|US|Rhode Island|-71.45|41.79,SC|US|South Carolina|-80.69|33.6,SD|US|South Dakota|-98.66|43.89,SK|CA|Saskatchewan|-105.99|51.63,TN|US|Tennessee|-87.53|35.63,TX|US|Texas|-97.51|31.01,UT|US|Utah|-111.96|40.5,VA|US|Virginia|-77.08|37.61,VT|US|Vermont|-73.21|44.48,WA|US|Washington|-121.46|47.29,WI|US|Wisconsin|-88.6|43.36,WV|US|West Virginia|-81.42|38.99,WY|US|Wyoming|-105.54|42.26,YT|CA|Yukon|-135.05|60.72",Q="006|-66.84|18.26,007|-66.15|18.15,008|-64.74|17.74,009|-66.12|18.37,010|-72.6|42.26,011|-72.53|42.07,012|-73.21|42.37,013|-72.51|42.58,014|-71.81|42.59,015|-71.85|42.23,016|-71.84|42.28,017|-71.44|42.33,018|-71.21|42.64,019|-70.89|42.66,020|-71.28|42.12,021|-71.05|42.31,022|-71.04|42.35,023|-70.86|41.98,024|-71.22|42.37,025|-70.6|41.71,026|-70.2|41.73,027|-71.07|41.77,028|-71.62|41.69,029|-71.47|41.82,030|-71.51|42.9,031|-71.48|43,032|-71.65|43.57,033|-71.58|43.26,034|-72.19|42.91,035|-71.31|44.69,036|-72.32|43.17,037|-72.13|43.69,038|-71.1|43.56,039|-70.76|43.24,040|-70.6|43.78,041|-70.27|43.7,042|-70.49|44.38,043|-69.75|44.3,044|-68.83|45.45,045|-69.57|43.99,046|-67.8|44.79,047|-68.34|46.55,048|-69.17|44.2,049|-69.97|44.99,050|-72.43|43.85,051|-72.65|43.28,052|-73.14|43.03,053|-72.77|42.94,054|-72.98|44.58,056|-72.6|44.35,057|-73.04|43.69,058|-72.12|44.68,059|-71.7|44.79,060|-72.81|41.88,061|-72.69|41.74,062|-72.12|41.81,063|-72.03|41.5,064|-72.61|41.46,065|-72.94|41.36,066|-73.22|41.24,067|-73.24|41.68,068|-73.42|41.28,069|-73.57|41.14,070|-74.28|40.76,071|-74.2|40.74,072|-74.2|40.68,073|-74.08|40.71,074|-74.4|41.09,075|-74.17|40.92,076|-74.01|40.94,077|-74.17|40.28,078|-74.81|40.97,079|-74.55|40.74,080|-74.98|39.78,081|-75.07|39.94,082|-74.68|39.32,083|-75.04|39.45,084|-74.48|39.35,085|-74.62|40.25,086|-74.68|40.23,087|-74.22|39.96,088|-74.72|40.54,089|-74.48|40.45,100|-73.96|40.77,101|-73.95|40.78,102|-74.02|40.72,103|-74.15|40.58,104|-73.85|40.9,105|-73.75|41.27,106|-73.74|41.02,107|-73.84|40.96,108|-73.8|40.95,109|-74.27|41.3,110|-73.69|40.74,111|-73.93|40.76,112|-73.94|40.66,113|-73.84|40.73,114|-73.77|40.69,115|-73.62|40.71,116|-73.88|40.57,117|-73.23|40.82,118|-73.5|40.77,119|-72.53|40.95,120|-74.22|42.92,121|-74.4|43.46,122|-73.81|42.7,123|-73.96|42.82,124|-74.27|42.09,125|-73.7|41.89,126|-73.88|41.69,127|-74.75|41.74,128|-73.91|43.61,129|-74.03|44.53,130|-76.16|43.08,131|-76.46|43.27,132|-76.2|43.03,133|-75.07|43.45,134|-75.35|43.03,135|-75.15|43.14,136|-75.39|44.33,137|-75.2|42.21,138|-75.46|42.43,139|-75.88|42.12,140|-78.48|43.01,141|-78.7|42.49,142|-78.8|42.91,143|-78.96|43.12,144|-77.71|42.96,145|-77.17|43.14,146|-77.65|43.17,147|-78.84|42.21,148|-77.18|42.29,149|-76.78|42.09,150|-80.23|40.56,151|-80.18|40.53,152|-79.97|40.46,153|-80.24|40.01,154|-79.65|39.92,155|-78.8|39.95,156|-79.47|40.33,157|-79.02|40.71,158|-78.66|41.32,159|-78.84|40.35,160|-79.88|40.93,161|-80.3|41.19,162|-79.35|41.08,163|-79.58|41.59,164|-80|41.87,165|-80.04|42.1,166|-78.28|40.48,167|-78.47|41.76,168|-78|40.97,169|-77.37|41.8,170|-77.29|40.44,171|-76.78|40.33,172|-77.81|39.98,173|-76.93|39.89,174|-76.72|39.97,175|-76.24|40.05,176|-76.34|40.05,177|-77.22|41.34,178|-76.77|40.93,179|-76.27|40.69,180|-75.45|40.67,181|-75.47|40.6,182|-75.88|40.9,183|-75.19|41.12,184|-75.38|41.53,185|-75.68|41.37,186|-76.17|41.4,187|-75.86|41.22,188|-76.12|41.82,189|-75.14|40.36,190|-75.37|39.97,191|-75.15|40.01,193|-75.78|39.92,194|-75.46|40.19,195|-75.9|40.42,196|-75.95|40.34,197|-75.68|39.53,198|-75.58|39.77,199|-75.46|38.83,200|-77.02|38.9,201|-77.68|38.9,202|-77.03|38.89,203|-77.01|38.86,204|-77.05|38.89,205|-77.01|38.87,206|-76.76|38.45,207|-76.78|38.88,208|-77.23|39.15,209|-76.99|39.05,210|-76.32|39.53,211|-76.73|39.58,212|-76.58|39.31,214|-76.55|39,215|-79.08|39.56,216|-76.02|38.86,217|-77.5|39.52,218|-75.57|38.27,219|-75.94|39.57,220|-77.25|38.78,221|-77.25|38.92,222|-77.11|38.88,223|-77.13|38.79,224|-77.25|38.22,225|-77.51|38.09,226|-78.25|39.03,227|-78.05|38.49,228|-78.79|38.57,229|-78.55|38.02,230|-78.09|37.66,231|-76.96|37.55,232|-77.46|37.51,233|-76.3|36.68,234|-76.66|36.77,235|-76.26|36.87,236|-76.44|37.12,237|-76.38|36.85,238|-77.41|36.94,239|-78.39|37.03,240|-80.1|37.23,241|-79.89|36.9,242|-82.49|36.83,243|-81.13|36.86,244|-79.51|38.05,245|-79.11|37.15,246|-81.8|37.19,247|-81.14|37.39,248|-81.64|37.47,249|-80.32|37.95,250|-81.45|38.27,251|-81.89|38.64,252|-81.45|38.77,253|-81.64|38.42,254|-78.11|39.45,255|-82.19|38.25,256|-82.08|37.76,257|-82.41|38.4,258|-81.21|37.72,259|-80.89|37.83,260|-80.63|40.05,261|-81.27|39.2,262|-80.02|38.75,263|-80.23|39.27,264|-80.65|39.21,265|-80.05|39.59,266|-80.8|38.48,267|-78.98|39.33,268|-79.12|38.88,270|-80.45|36.24,271|-80.24|36.06,272|-79.82|35.86,273|-79.52|35.55,274|-79.81|36.09,275|-78.54|35.93,276|-78.65|35.81,277|-78.9|35.99,278|-77.32|35.88,279|-76.5|36.19,280|-81.2|35.4,281|-80.41|35.21,282|-80.83|35.22,283|-78.94|34.96,284|-78.23|34.39,285|-77.23|35.06,286|-81.36|36.06,287|-82.78|35.51,288|-82.55|35.6,289|-83.97|35.11,290|-80.88|34.19,291|-80.62|33.71,292|-80.96|34.04,293|-81.86|34.78,294|-80.08|33.05,295|-79.49|34.07,296|-82.57|34.61,297|-80.92|34.83,298|-81.74|33.51,299|-80.96|32.55,300|-84.08|33.85,301|-84.91|34.04,302|-84.55|33.25,303|-84.42|33.77,304|-82.11|32.48,305|-83.81|34.58,306|-83.14|33.86,307|-85.1|34.71,308|-82.34|33.35,309|-82.01|33.4,310|-83.42|32.64,312|-83.64|32.83,313|-81.49|31.68,314|-81.15|32.03,315|-82.21|31.4,316|-83.21|31.02,317|-83.87|31.48,318|-84.69|32.45,319|-84.95|32.47,320|-82.58|30.27,321|-81.48|29.39,322|-81.69|30.3,323|-84.25|30.29,324|-85.58|30.55,325|-87.03|30.76,326|-82.6|29.58,327|-81.28|28.79,328|-81.32|28.47,329|-80.67|27.96,330|-80.58|25.31,331|-80.38|25.74,333|-80.25|26.13,334|-81.01|26.64,335|-82.22|28.19,336|-82.47|28.01,337|-82.73|27.85,338|-81.64|27.72,339|-81.71|26.77,341|-81.32|26.11,342|-82.16|27.29,344|-82.35|29.01,346|-82.52|28.41,347|-81.4|28.29,349|-80.72|27.34,350|-86.8|34.05,351|-86.38|33.43,352|-86.77|33.5,354|-87.86|33.07,355|-87.71|33.96,356|-87.4|34.67,357|-86.26|34.75,358|-86.59|34.69,359|-85.94|34.27,360|-86.09|32.09,361|-86.27|32.31,362|-85.65|33.53,363|-85.56|31.34,364|-86.97|31.38,365|-88.14|31.32,366|-88.19|30.68,367|-87.34|32.33,368|-85.41|32.61,369|-88.25|32.12,370|-87.02|36.12,371|-86.23|35.75,372|-86.83|36.15,373|-85.36|35.32,374|-85.33|35.06,376|-82.3|36.36,377|-84.31|36.27,378|-83.35|36.3,379|-83.97|35.97,380|-89.43|35.55,381|-89.96|35.1,382|-88.68|36.29,383|-88.5|35.61,384|-87.36|35.34,385|-85.34|36.18,386|-89.76|34.57,387|-90.81|33.54,388|-88.63|34.36,389|-89.9|33.77,390|-90|32.53,391|-90.67|32.51,392|-90.22|32.32,393|-88.8|32.42,394|-89.26|31.23,395|-89|30.59,396|-90.67|31.32,397|-88.87|33.53,398|-84.67|31.32,400|-85.29|38.07,401|-86.2|37.85,402|-85.66|38.19,403|-84.2|38.06,404|-84.42|37.53,405|-84.45|38.04,406|-84.87|38.22,407|-84.12|36.95,408|-83.26|36.9,409|-83.74|36.95,410|-84.32|38.64,411|-83.06|38.38,412|-82.67|37.89,413|-83.48|37.58,414|-83.15|37.84,415|-82.39|37.46,416|-82.78|37.54,417|-83.25|37.23,418|-82.88|37.21,420|-88.57|36.9,421|-86.09|36.89,422|-87.11|36.95,423|-87.02|37.52,424|-87.7|37.47,425|-84.71|37.15,426|-84.82|36.81,427|-85.73|37.32,430|-82.9|40.21,431|-82.99|39.69,432|-82.97|39.98,433|-83.38|40.55,434|-83.3|41.42,435|-84.22|41.46,436|-83.54|41.67,437|-81.66|39.85,438|-81.88|40.27,439|-80.9|40.25,440|-80.97|41.64,441|-81.66|41.42,442|-81.6|41.13,443|-81.54|41.07,444|-80.77|41.09,445|-80.64|41.05,446|-81.53|40.65,447|-81.39|40.83,448|-82.77|41.02,449|-82.55|40.74,450|-84.48|39.43,451|-83.84|39.16,452|-84.48|39.18,453|-84.3|39.97,454|-84.18|39.74,455|-83.81|39.94,456|-82.86|38.99,457|-81.78|39.35,458|-84.23|40.83,460|-86.13|40.17,461|-86.18|39.62,462|-86.14|39.79,463|-87.05|41.41,464|-87.34|41.55,465|-86.08|41.44,466|-86.28|41.66,467|-85.21|41.17,468|-85.17|41.09,469|-86.14|40.76,470|-85.08|39.16,471|-86.02|38.43,472|-85.74|39.05,473|-85.15|40.09,474|-86.63|38.99,475|-87.03|38.46,476|-87.53|38.13,477|-87.58|38.03,478|-87.29|39.45,479|-87.11|40.5,480|-82.79|42.83,481|-83.62|42.2,482|-83.1|42.38,483|-83.35|42.66,484|-83.22|43.29,485|-83.69|43.03,486|-84.36|43.99,487|-83.67|44.45,488|-84.67|43.02,489|-84.59|42.74,490|-85.54|42.2,491|-86.36|41.87,492|-84.36|42.06,493|-85.57|43.33,494|-86.14|43.39,495|-85.66|42.96,496|-85.52|44.44,497|-84.37|45.17,498|-86.94|46.17,499|-88.93|46.6,500|-94.77|41.63,501|-92.79|41.84,502|-93.67|42.12,503|-93.63|41.59,504|-93.37|43.17,505|-94.45|42.77,506|-92.45|42.65,507|-92.31|42.49,508|-94.56|40.96,510|-95.91|42.6,511|-96.39|42.52,512|-96.06|43.28,513|-95.16|43.27,514|-95.08|42.11,515|-95.55|41.44,516|-95.37|40.74,520|-90.98|42.46,521|-91.73|43.2,522|-92.31|41.9,523|-91.66|41.87,524|-91.69|41.96,525|-92.46|40.95,526|-91.44|40.88,527|-90.88|41.64,528|-90.61|41.56,530|-88.24|43.51,531|-88.33|42.75,532|-87.98|43.06,534|-87.86|42.74,535|-89.66|42.95,537|-89.38|43.08,538|-90.73|42.88,539|-89.55|43.64,540|-92.46|45.08,541|-88.23|45.09,542|-87.6|44.52,543|-88.01|44.53,544|-89.85|44.93,545|-89.86|45.89,546|-90.87|43.93,547|-91.52|44.85,548|-91.63|46.04,549|-88.96|44.19,550|-92.98|45.17,551|-93.08|44.96,553|-94.06|44.99,554|-93.31|45.01,556|-91.03|47.67,557|-92.68|47.39,558|-92.08|46.96,559|-92.28|43.89,560|-94.04|44.02,561|-95.65|43.92,562|-95.75|45.08,563|-94.59|45.83,564|-94.5|46.63,565|-96.08|46.86,566|-94.31|47.88,567|-96.22|48.39,570|-97.07|43.48,571|-96.76|43.54,572|-97.18|45.04,573|-98.53|43.91,574|-98.93|45.36,575|-100.61|43.86,576|-101.59|45.43,577|-103.11|44.26,580|-97.39|46.66,581|-96.83|46.86,582|-97.72|48.25,583|-99.34|48.32,584|-99.12|46.88,585|-100.98|46.76,586|-102.99|46.75,587|-101.7|48.34,588|-103.48|48.2,590|-108.62|45.98,591|-108.45|45.69,592|-105.6|48.2,593|-105.58|46.4,594|-111.24|47.79,595|-109.12|48.38,596|-111.74|46.65,597|-112.31|45.48,598|-114.25|46.97,599|-114.57|48.37,600|-88.15|42.29,601|-88.47|42.01,602|-87.69|42.04,603|-87.79|41.89,604|-88.09|41.39,605|-88.55|41.69,606|-87.69|41.83,607|-87.82|42.03,608|-87.76|41.84,609|-87.92|40.8,610|-89.56|42.18,611|-89.08|42.28,612|-90.29|41.5,613|-89.16|41.34,614|-90.43|40.82,615|-89.68|40.71,616|-89.61|40.72,617|-88.89|40.52,618|-88.15|40.11,619|-88.19|39.66,620|-90.01|39.13,622|-89.72|38.41,623|-91.02|39.99,624|-88.19|39.04,625|-89.21|39.63,626|-90|39.86,627|-89.66|39.8,628|-88.65|38.35,629|-88.89|37.55,630|-90.83|38.35,631|-90.32|38.64,633|-91.11|39.02,634|-91.78|39.93,635|-92.61|40.2,636|-90.64|37.61,637|-89.81|37.37,638|-89.73|36.55,639|-90.62|36.84,640|-94.1|39.07,641|-94.58|39.14,644|-94.69|40.13,645|-94.83|39.75,646|-93.55|39.89,647|-94.15|38.06,648|-94.35|36.93,650|-92.23|38.45,651|-92.19|38.51,652|-92.38|39.21,653|-93.26|38.71,654|-92.03|37.93,655|-91.92|37.67,656|-93.08|36.76,657|-92.43|37.03,658|-93.3|37.22,660|-95.12|38.84,661|-94.73|39.11,662|-94.72|38.95,664|-96.15|39.64,665|-96.34|39.4,666|-95.76|39.06,667|-95.23|37.64,668|-96.39|38.36,669|-97.86|39.77,670|-98.49|37.33,671|-98.4|37.44,672|-97.33|37.7,673|-95.81|37.23,674|-97.79|38.98,675|-98.99|38.25,676|-99.47|39.34,677|-101.15|39.35,678|-100.82|37.91,679|-101.43|37.18,680|-96.46|41.55,681|-96.05|41.24,683|-96.93|40.39,684|-97.26|40.89,685|-96.69|40.82,686|-97.68|41.55,687|-98.16|42.43,688|-99.15|41.34,689|-98.9|40.34,690|-100.99|40.37,691|-101.59|41.42,692|-100.64|42.67,693|-102.84|42.29,700|-89.93|29.63,701|-89.93|30.02,703|-90.65|29.62,704|-90.27|30.66,705|-92.25|30.2,706|-93.21|30.34,707|-91.2|30.57,708|-91.1|30.45,710|-93.4|32.45,711|-93.75|32.47,712|-91.95|32.56,713|-91.86|31.43,714|-92.84|31.57,716|-91.75|33.61,717|-92.79|33.48,718|-93.84|33.66,719|-93.61|34.4,720|-91.9|34.92,721|-92.56|34.93,722|-92.37|34.7,723|-90.59|35.07,724|-90.76|36.04,725|-91.81|36.01,726|-92.93|36.15,727|-94.05|36.11,728|-93.33|35.3,729|-94.08|35.29,730|-97.83|35.31,731|-97.5|35.43,734|-97.14|34.21,735|-98.81|34.53,736|-99.33|35.52,737|-98.2|36.42,738|-99.54|36.5,739|-101.67|36.74,740|-96.19|36.34,741|-95.96|36.15,743|-95.02|36.55,744|-95.44|35.64,745|-95.65|34.66,746|-97.05|36.71,747|-95.41|34.02,748|-96.66|35.17,749|-94.69|35.23,750|-96.76|33.06,751|-96.32|32.48,752|-96.78|32.79,753|-96.84|32.81,754|-95.67|33.37,755|-94.45|33.3,756|-94.58|32.49,757|-95.37|32.24,758|-95.68|31.44,759|-94.29|31.29,760|-97.54|32.59,761|-97.38|32.77,762|-97.44|33.52,763|-98.87|33.73,764|-98.59|32.61,765|-97.62|31.11,766|-97.06|31.7,767|-97.15|31.57,768|-99.37|31.23,769|-100.88|31.03,770|-95.39|29.79,772|-95.37|29.77,773|-95.24|30.48,774|-96.02|29.38,775|-94.98|29.68,776|-94.16|30.27,777|-94.19|29.96,778|-96.32|30.67,779|-96.95|28.92,780|-99.01|28.67,781|-97.93|29.08,782|-98.53|29.47,783|-98.14|27.63,784|-97.44|27.73,785|-98.19|26.39,786|-98.1|30.27,787|-97.78|30.3,788|-100.26|29.44,789|-96.87|29.92,790|-101.63|35.48,791|-101.85|35.21,792|-100.57|34.25,793|-102.15|33.37,794|-101.88|33.58,795|-100.31|32.7,796|-99.72|32.46,797|-102.22|31.57,798|-104.17|30.53,799|-106.16|31.8,800|-105.11|39.91,801|-104.47|39.51,802|-104.93|39.78,803|-105.31|40.04,804|-106.16|39.98,805|-105.35|40.57,806|-104.49|40.38,807|-103.09|40.4,808|-103.16|39.12,809|-104.67|38.79,810|-103.58|37.77,811|-106.39|37.54,812|-106.39|38.46,813|-108.42|37.49,814|-108.02|38.43,815|-108.7|38.92,816|-107.86|39.99,820|-105.27|41.31,821|-110.51|44.57,822|-104.67|42.39,823|-107.03|41.75,824|-108.65|44.32,825|-108.91|43.14,826|-106.43|43.1,827|-105|44.2,828|-106.71|44.55,829|-109.71|42.82,830|-110.51|43.7,831|-110.53|42.6,832|-112.17|42.66,833|-114.23|42.81,834|-111.63|43.86,835|-115.77|46.07,836|-115.99|44,837|-116.04|43.58,838|-116.47|47.77,840|-110.86|40.53,841|-111.81|40.71,843|-112.18|41.67,844|-112.01|41.23,845|-109.72|38.09,846|-111.68|39.63,847|-112.82|37.61,850|-112.09|33.63,851|-111.41|33,852|-111.69|33.6,853|-113.44|33.49,855|-110.3|33.43,856|-110.59|32,857|-111.09|32.18,859|-109.81|34.23,860|-111.15|35.89,863|-112.57|34.85,864|-113.79|35.66,865|-109.55|36.03,870|-106.9|35.22,871|-106.72|35.12,873|-108.56|35.44,874|-108.23|36.59,875|-106.04|36.27,877|-104.68|36.06,878|-107.94|34,879|-107.48|33.2,880|-108.03|32.37,881|-103.81|34.26,882|-104.07|32.87,883|-105.48|33.62,884|-103.79|35.74,890|-114.84|37,891|-115.42|36.33,893|-116.96|39.5,894|-118.06|41.29,895|-119.72|39.9,897|-119.8|39.18,898|-115.71|40.95,900|-118.32|34.04,902|-118.76|34.07,903|-118.34|33.95,904|-118.48|34.02,905|-118.33|33.83,906|-118.03|33.93,907|-118.45|33.39,908|-118.18|33.8,910|-118.25|34.28,911|-118.13|34.15,912|-118.25|34.19,913|-118.55|34.36,914|-118.47|34.18,915|-118.33|34.19,916|-118.38|34.18,917|-117.78|34.14,918|-118.13|34.09,919|-116.62|32.73,920|-116.7|33.16,921|-117.14|32.85,922|-115.5|33.59,923|-117.14|34.66,924|-117.33|34.17,925|-117.06|33.68,926|-117.73|33.63,927|-117.85|33.74,928|-117.71|33.85,930|-119.12|34.39,931|-119.97|34.48,932|-119.07|35.98,933|-119.01|35.35,934|-120.5|35.38,935|-118.36|37.37,936|-119.72|36.95,937|-119.85|36.71,939|-121.42|36.34,940|-122.31|37.41,941|-122.44|37.77,943|-122.13|37.44,944|-122.32|37.53,945|-122.05|38.09,946|-122.19|37.78,947|-122.26|37.89,948|-122.3|37.97,949|-122.74|38.14,950|-121.42|36.85,951|-121.76|37.33,952|-120.79|38.14,953|-120.56|37.62,954|-123.15|39.08,955|-123.75|40.5,956|-121.34|38.62,957|-120.86|39.13,958|-121.44|38.58,959|-121.73|39.47,960|-122.42|41.06,961|-120.33|40.52,967|-155.53|19.6,968|-157.83|21.34,969|144.77|13.45,970|-121.45|45.3,971|-123.79|45.64,972|-122.74|45.57,973|-123.26|44.68,974|-123.46|43.61,975|-123.06|42.34,976|-120.4|42.67,977|-120.77|44.32,978|-118.59|45.21,979|-117.63|43.34,980|-121.78|47.42,981|-122.32|47.6,982|-121.79|48.39,983|-123.87|47.96,984|-122.46|47.18,985|-123.27|46.94,986|-122.15|45.99,988|-119.91|48,989|-120.57|46.71,990|-117.56|47.62,991|-118.13|47.91,992|-117.4|47.67,993|-118.82|46.4,994|-117.21|46.2,995|-156.93|60.89,996|-151.66|60.82,997|-146.69|65.19,998|-136.2|58.94,999|-131.24|55.86",j="ABW|-70.02|12.54,AFG|68|34.63,AGO|14.24|-9.84,AIA|-63.06|18.22,ALA|19.93|60.1,ALB|19.81|41.14,AND|1.53|42.51,ARE|55.24|24.99,ARG|-61.28|-32.95,ARM|44.52|40.23,ASM|-170.7|-14.28,ATA|21.28|-80.52,ATF|70.22|-49.35,ATG|-61.84|17.12,AUS|144.91|-33.49,AUT|15.51|47.93,AZE|49.02|40.37,BDI|29.49|-3.34,BEL|4.37|50.89,BEN|2.33|7.65,BES|-68.27|12.15,BFA|-2.08|12.15,BGD|90.42|23.65,BGR|24.92|42.71,BHR|50.57|26.18,BHS|-77.34|25.06,BIH|17.97|44.18,BLM|-62.85|17.9,BLR|27.81|53.57,BLZ|-88.41|17.54,BMU|-64.78|32.29,BOL|-65.79|-17.39,BRA|-45.89|-17.51,BRB|-59.62|13.11,BRN|114.74|4.82,BTN|89.69|27.32,BWA|25.99|-23.43,CAF|18.32|4.94,CAN|-79.4|43.71,CCK|96.82|-12.16,CHE|7.96|47.07,CHL|-71.21|-33.72,CHN|114.44|32,CIV|-4.89|6.16,CMR|11.19|5.41,COD|20.23|-4.72,COG|14.18|-4.04,COK|-159.78|-21.21,COL|-74.85|5.93,COM|43.58|-11.89,CPV|-23.87|15.66,CRI|-84.14|9.99,CUB|-80.25|22.21,CUW|-68.88|12.12,CXR|105.68|-10.42,CYM|-81.38|19.32,CYP|33.31|35,CZE|15.44|49.89,DEU|9.65|51.24,DJI|43.15|11.59,DMA|-61.39|15.3,DNK|11.42|55.79,DOM|-70.07|18.75,DZA|3.55|35.62,ECU|-79.29|-1.4,EGY|31.22|29.84,ERI|38.84|15.25,ESH|-13.19|27.14,ESP|-2.91|39.69,EST|25.17|59.29,ETH|39.02|9.26,FIN|24.87|61.26,FJI|178.2|-17.85,FLK|-57.86|-51.69,FRA|2.87|47.28,FRO|-6.77|62.01,FSM|158.16|6.92,GAB|10.22|-0.06,GBR|-1.37|52.49,GEO|43.92|41.84,GGY|-2.54|49.46,GHA|-0.98|6.4,GIB|-5.35|36.14,GIN|-12.8|9.75,GLP|-61.53|16.23,GMB|-16.59|13.41,GNB|-15.48|11.9,GNQ|9.77|1.86,GRC|23.73|37.98,GRD|-61.75|12.05,GRL|-51.72|64.18,GTM|-90.71|14.73,GUF|-52.64|5.04,GUM|144.82|13.5,GUY|-58.11|6.63,HKG|114.15|22.33,HMD|73.5|-53.1,HND|-87.41|14.94,HRV|16.21|45.31,HTI|-72.34|18.54,HUN|19.21|47.39,IDN|106.85|-6.21,IMN|-4.48|54.15,IND|78.36|21,IOT|71.35|-6.19,IRL|-6.87|53.12,IRN|51.6|34.4,IRQ|44.78|33.65,ISL|-21.7|64.22,ISR|34.97|32.07,ITA|12|42.73,JAM|-76.91|18.03,JEY|-2.1|49.19,JOR|35.96|32.03,JPN|137.27|35.53,KAZ|70.17|47.24,KEN|36.81|-0.97,KGZ|73.96|41.94,KHM|104.7|11.75,KIR|172.98|1.33,KNA|-62.72|17.3,KOR|127.51|36.58,KWT|48.06|29.2,Kosovo|20.9|42.58,LAO|102.6|17.97,LBN|35.53|33.87,LBR|-10.39|6.36,LBY|13.19|32.89,LCA|-60.97|14.04,LIE|9.52|47.14,LKA|80.25|7.25,LSO|27.67|-29.38,LTU|24.18|55.04,LUX|6.08|49.56,LVA|24.13|56.85,MAC|113.55|22.19,MAF|-63.08|18.07,MAR|-6.65|33.43,MCO|7.42|43.74,MDA|28.82|47.09,MDG|47.46|-18.89,MDV|73.51|4.18,MEX|-100.65|21.59,MHL|171.38|7.09,MKD|21.47|41.8,MLI|-7.15|12.95,MLT|14.46|35.91,MMR|96.18|18.74,MNE|19.17|42.53,MNG|105.33|47.94,MNP|145.75|15.21,MOZ|32.58|-25.97,MRT|-14.58|18.01,MSR|-62.21|16.79,MTQ|-61.01|14.64,MUS|57.51|-20.23,MWI|34.34|-14.24,MYS|103.35|3.45,MYT|45.23|-12.77,N. Cyprus|33.56|35.27,NAM|17.19|-21.34,NCL|166.47|-22.26,NER|5.05|14.04,NFK|167.97|-29.05,NGA|5.91|7.87,NIC|-86.17|12.33,NIU|-169.92|-19.05,NLD|5.21|52.09,NOR|9.62|60.46,NPL|84.7|27.64,NRU|166.93|-0.55,NZL|174.54|-38.9,OMN|57.69|23.27,PAK|71.47|30.24,PAN|-79.83|8.98,PCN|-130.1|-25.07,PER|-76.4|-11.18,PHL|121.05|14.65,PLW|134.58|7.52,PNG|147.4|-7.71,POL|19.26|51.79,PRI|-66.24|18.35,PRK|126.54|39.52,PRT|-9.08|39.42,PRY|-57.15|-25.27,PSE|35.23|31.78,PYF|-149.59|-17.57,QAT|51.49|25.32,REU|55.45|-21.08,ROU|25.47|45.38,RUS|51.84|54.52,RWA|29.78|-1.98,SAU|43.01|23.76,SDN|31.67|14.67,SEN|-16.73|14.66,SGP|103.85|1.33,SGS|-36.51|-54.28,SHN|-5.72|-15.92,SJM|15.65|78.22,SLB|159.97|-9.44,SLE|-12.4|8.36,SLV|-89.08|13.7,SMR|12.45|43.94,SOM|44.96|4.91,SPM|-56.18|46.78,SRB|20.62|44.5,SSD|29.91|6.61,STP|6.73|0.34,SUR|-55.18|5.84,SVK|18.69|48.55,SVN|14.83|46.16,SWE|16.03|58.86,SWZ|31.28|-26.43,SXM|-63.05|18.03,SYC|55.46|-4.62,SYR|37.18|35.12,Somaliland|46.23|9.76,TCA|-72.1|21.74,TCD|16.57|11.53,TGO|1.16|6.8,THA|100.71|13.71,TJK|69.39|39.08,TKM|59.4|38.74,TLS|125.65|-8.67,TON|-175.2|-21.14,TTO|-61.4|10.5,TUN|10.23|35.87,TUR|32.1|39.5,TUV|179.19|-8.52,TWN|121.06|24.37,TZA|36.11|-5.88,UGA|32.23|0.59,UKR|32.8|48.99,URY|-56.28|-34.1,USA|-93.51|37.4,UZB|69.22|41.26,VAT|12.45|41.9,VCT|-61.21|13.14,VEN|-67.82|9.83,VGB|-64.62|18.43,VIR|-64.8|17.9,VNM|106.63|10.82,VUT|168.31|-17.74,WLF|-176.17|-13.28,WSM|-171.77|-13.83,YEM|44.62|14.36,ZAF|26.96|-28.33,ZMB|28.41|-13.86,ZWE|30.49|-18.56";var O3=95,$=new Set(["n a","none","null","nil","unknown","not applicable","not available","not specified","unspecified","missing","blank","empty","tbd","to be determined"]),s3=new Set(Array.from($).filter(n=>n.includes(" ")&&n!=="n a").map(n=>n.replace(/ /g,"")));function m(n){return n?$.has(n)||s3.has(n.replace(/ /g,"")):!0}var D3=80;function u(n){return z(n.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase()).replace(/[^\p{L}\p{Nd}\s]/gu," ").replace(/\s+/g," ").trim()}function R(n){return g(n)}var l3="AD AND,AE ARE,AF AFG,AG ATG,AI AIA,AL ALB,AM ARM,AO AGO,AQ ATA,AR ARG,AS ASM,AT AUT,AU AUS,AW ABW,AX ALA,AZ AZE,BA BIH,BB BRB,BD BGD,BE BEL,BF BFA,BG BGR,BH BHR,BI BDI,BJ BEN,BL BLM,BM BMU,BN BRN,BO BOL,BQ BES,BR BRA,BS BHS,BT BTN,BV BVT,BW BWA,BY BLR,BZ BLZ,CA CAN,CC CCK,CD COD,CF CAF,CG COG,CH CHE,CI CIV,CK COK,CL CHL,CM CMR,CN CHN,CO COL,CR CRI,CU CUB,CV CPV,CW CUW,CX CXR,CY CYP,CZ CZE,DE DEU,DJ DJI,DK DNK,DM DMA,DO DOM,DZ DZA,EC ECU,EE EST,EG EGY,EH ESH,ER ERI,ES ESP,ET ETH,FI FIN,FJ FJI,FK FLK,FM FSM,FO FRO,FR FRA,GA GAB,GB GBR,GD GRD,GE GEO,GF GUF,GG GGY,GH GHA,GI GIB,GL GRL,GM GMB,GN GIN,GP GLP,GQ GNQ,GR GRC,GS SGS,GT GTM,GU GUM,GW GNB,GY GUY,HK HKG,HM HMD,HN HND,HR HRV,HT HTI,HU HUN,ID IDN,IE IRL,IL ISR,IM IMN,IN IND,IO IOT,IQ IRQ,IR IRN,IS ISL,IT ITA,JE JEY,JM JAM,JO JOR,JP JPN,KE KEN,KG KGZ,KH KHM,KI KIR,KM COM,KN KNA,KP PRK,KR KOR,KW KWT,KY CYM,KZ KAZ,LA LAO,LB LBN,LC LCA,LI LIE,LK LKA,LR LBR,LS LSO,LT LTU,LU LUX,LV LVA,LY LBY,MA MAR,MC MCO,MD MDA,ME MNE,MF MAF,MG MDG,MH MHL,MK MKD,ML MLI,MM MMR,MN MNG,MO MAC,MP MNP,MQ MTQ,MR MRT,MS MSR,MT MLT,MU MUS,MV MDV,MW MWI,MX MEX,MY MYS,MZ MOZ,NA NAM,NC NCL,NE NER,NF NFK,NG NGA,NI NIC,NL NLD,NO NOR,NP NPL,NR NRU,NU NIU,NZ NZL,OM OMN,PA PAN,PE PER,PF PYF,PG PNG,PH PHL,PK PAK,PL POL,PM SPM,PN PCN,PR PRI,PS PSE,PT PRT,PW PLW,PY PRY,QA QAT,RE REU,RO ROU,RS SRB,RU RUS,RW RWA,SA SAU,SB SLB,SC SYC,SD SDN,SE SWE,SG SGP,SH SHN,SI SVN,SJ SJM,SK SVK,SL SLE,SM SMR,SN SEN,SO SOM,SR SUR,SS SSD,ST STP,SV SLV,SX SXM,SY SYR,SZ SWZ,TC TCA,TD TCD,TF ATF,TG TGO,TH THA,TJ TJK,TK TKL,TL TLS,TM TKM,TN TUN,TO TON,TR TUR,TT TTO,TV TUV,TW TWN,TZ TZA,UA UKR,UG UGA,UM UMI,US USA,UY URY,UZ UZB,VA VAT,VC VCT,VE VEN,VG VGB,VI VIR,VN VNM,VU VUT,WF WLF,WS WSM,YE YEM,YT MYT,ZA ZAF,ZM ZMB,ZW ZWE",L=(()=>{let n=new Map;for(let e of l3.split(",")){let[t,o]=e.split(" ");t&&o&&n.set(t,o)}return n})(),u3=new Set(L.keys()),c3=new Set(L.values()),M3=["en","fr","es","de","it","pt","ru","ja","zh","ko","ar","hi","tr","pl","he","nl","sv","fi","nb","da","cs","el","uk","ro","id","vi","th","sk","hu","hr"],S3={usa:"USA","u.s.":"USA","u.s.a.":"USA",us:"USA",america:"USA","united states of america":"USA","the united states":"USA",uk:"GBR","u.k.":"GBR","great britain":"GBR",britain:"GBR",england:"GBR","south korea":"KOR","north korea":"PRK",korea:"KOR","ivory coast":"CIV","cote d ivoire":"CIV",vietnam:"VNM",laos:"LAO",syria:"SYR",iran:"IRN",russia:"RUS",moldova:"MDA",tanzania:"TZA",bolivia:"BOL",venezuela:"VEN",brunei:"BRN","czech republic":"CZE",czechia:"CZE",slovakia:"SVK",uae:"ARE","united arab emirates":"ARE",drc:"COD","dr congo":"COD","democratic republic of the congo":"COD","republic of the congo":"COG",congo:"COG",swaziland:"SWZ",eswatini:"SWZ","cape verde":"CPV","cabo verde":"CPV",burma:"MMR",myanmar:"MMR",holland:"NLD","the netherlands":"NLD",netherlands:"NLD",vatican:"VAT","vatican city":"VAT",palestine:"PSE",macau:"MAC",macao:"MAC","hong kong":"HKG",taiwan:"TWN",turkey:"TUR",turkiye:"TUR",macedonia:"MKD","north macedonia":"MKD",gambia:"GMB","the gambia":"GMB",bahamas:"BHS","the bahamas":"BHS","east timor":"TLS","timor leste":"TLS"},d3=Object.freeze({"Antigua and Barbuda":"ATG","Bosnia and Herzegovina":"BIH","Heard Island and McDonald Islands":"HMD","Saint Kitts and Nevis":"KNA","St Kitts and Nevis":"KNA","Saint Pierre and Miquelon":"SPM","St Pierre and Miquelon":"SPM","Saint Vincent and the Grenadines":"VCT","St Vincent and the Grenadines":"VCT","Sao Tome and Principe":"STP","South Georgia and the South Sandwich Islands":"SGS","Svalbard and Jan Mayen":"SJM","Trinidad and Tobago":"TTO","Turks and Caicos Islands":"TCA","Turks and Caicos":"TCA","Wallis and Futuna":"WLF","Saint Helena, Ascension and Tristan da Cunha":"SHN","Bonaire, Sint Eustatius and Saba":"BES","United Kingdom of Great Britain and Northern Ireland":"GBR","Bolivia, Plurinational State of":"BOL","Bolivia (Plurinational State of)":"BOL","Brunei Darussalam":"BRN","Congo, The Democratic Republic of the":"COD","Congo, Democratic Republic of the":"COD","Democratic Republic of Congo":"COD","Falkland Islands (Malvinas)":"FLK","Holy See (Vatican City State)":"VAT","Holy See":"VAT","Iran, Islamic Republic of":"IRN","Iran (Islamic Republic of)":"IRN","Islamic Republic of Iran":"IRN","Korea, Republic of":"KOR","Republic of Korea":"KOR","Korea (the Republic of)":"KOR","Korea, Democratic People's Republic of":"PRK","Democratic People's Republic of Korea":"PRK","Korea (the Democratic People's Republic of)":"PRK","Lao People's Democratic Republic":"LAO","Micronesia, Federated States of":"FSM","Micronesia (Federated States of)":"FSM","Moldova, Republic of":"MDA","Republic of Moldova":"MDA","Palestine, State of":"PSE","State of Palestine":"PSE","Russian Federation":"RUS","Syrian Arab Republic":"SYR","Taiwan, Province of China":"TWN","Tanzania, United Republic of":"TZA","United Republic of Tanzania":"TZA","Venezuela, Bolivarian Republic of":"VEN","Venezuela (Bolivarian Republic of)":"VEN","Viet Nam":"VNM","Virgin Islands, British":"VGB","Virgin Islands, U.S.":"VIR","Saint Martin (French part)":"MAF","Sint Maarten (Dutch part)":"SXM","Netherlands (Kingdom of the)":"NLD","Macedonia, the former Yugoslav Republic of":"MKD"}),X=null,x=null;function q(){if(X)return X;let n=new Map,e=[],t=["en",...M3.filter(i=>i!=="en")];for(let i of t){let a=null;try{a=new Intl.DisplayNames([i],{type:"region"})}catch{continue}for(let[r,s]of L){let c;try{c=a.of(r)}catch{c=void 0}if(!c||c===r)continue;let d=u(c);d&&!n.has(d)&&n.set(d,s),e.push([c,s])}}for(let[i,a]of Object.entries(d3)){let r=u(i);r&&!n.has(r)&&n.set(r,a),e.push([i,a])}for(let[i,a]of Object.entries(S3)){let r=u(i);r&&n.set(r,a),e.push([i,a])}let o=new I;for(let[i,a]of e){let r=u(i);n.get(r)===a&&(o.add(i,a),o.add(r,a))}return X=n,x=o,n}function f3(){return x||q(),x}function p3(n){if(n==null)return null;let e=String(n).trim();if(!e)return null;let t=u(e),o=q().get(t);return o||(m(t)?null:f3().get(R(e))??null)}function G(n){return L.get(String(n||"").trim().toUpperCase())??null}function k(n){if(n==null)return null;let e=String(n).trim();if(!e)return null;let t=e.toUpperCase();return t.length===3&&c3.has(t)?t:t.length===2&&u3.has(t)?L.get(t)??null:p3(e)}var A3={"north-america":"N",world:"W"};function _(n,e){let t=n.filter(o=>o.row.kinds.includes(A3[e||"north-america"]));return t.length?t:(e||"north-america")==="world"?n:t}var O=v;function _3(n){n!==O&&(O=n||"",P=null,h=null,B=null,E=null,K=null)}function C3(){return O.length>0}var g3={US:"washington",CA:"ottawa",MX:"mexico city",GB:"london",FR:"paris",DE:"berlin",IT:"rome",ES:"madrid",PT:"lisbon",NL:"amsterdam",BE:"brussels",CH:"bern",AT:"vienna",IE:"dublin",PL:"warsaw",SE:"stockholm",NO:"oslo",DK:"copenhagen",FI:"helsinki",IS:"reykjavik",CZ:"prague",SK:"bratislava",HU:"budapest",RO:"bucharest",BG:"sofia",GR:"athens",TR:"ankara",UA:"kyiv",RU:"moscow",RS:"belgrade",HR:"zagreb",SI:"ljubljana",EE:"tallinn",LV:"riga",LT:"vilnius",JP:"tokyo",CN:"beijing",KR:"seoul",KP:"pyongyang",IN:"new delhi",PK:"islamabad",BD:"dhaka",LK:"colombo",TH:"bangkok",VN:"hanoi",PH:"manila",ID:"jakarta",MY:"kuala lumpur",SG:"singapore",MM:"naypyidaw",KH:"phnom penh",LA:"vientiane",NP:"kathmandu",AF:"kabul",IR:"tehran",IQ:"baghdad",SA:"riyadh",AE:"abu dhabi",QA:"doha",KW:"kuwait city",BH:"manama",OM:"muscat",JO:"amman",LB:"beirut",SY:"damascus",IL:"jerusalem",YE:"sanaa",EG:"cairo",LY:"tripoli",TN:"tunis",DZ:"algiers",MA:"rabat",SD:"khartoum",ET:"addis ababa",KE:"nairobi",TZ:"dodoma",UG:"kampala",NG:"abuja",GH:"accra",CI:"yamoussoukro",SN:"dakar",ML:"bamako",CM:"yaounde",CD:"kinshasa",CG:"brazzaville",AO:"luanda",ZM:"lusaka",ZW:"harare",MZ:"maputo",BW:"gaborone",NA:"windhoek",ZA:"pretoria",AU:"canberra",NZ:"wellington",PG:"port moresby",FJ:"suva",BR:"brasilia",AR:"buenos aires",CL:"santiago",PE:"lima",CO:"bogota",VE:"caracas",EC:"quito",BO:"la paz",PY:"asuncion",UY:"montevideo",GY:"georgetown",SR:"paramaribo",CU:"havana",DO:"santo domingo",HT:"port au prince",JM:"kingston",TT:"port of spain",PA:"panama city",CR:"san jose",NI:"managua",HN:"tegucigalpa",SV:"san salvador",GT:"guatemala city",BZ:"belmopan",AZ:"baku",AM:"yerevan",GE:"tbilisi",KZ:"astana",UZ:"tashkent",TM:"ashgabat",KG:"bishkek",TJ:"dushanbe",MN:"ulaanbaatar",BY:"minsk",MD:"chisinau",AL:"tirana",MK:"skopje",BA:"sarajevo",ME:"podgorica",XK:"pristina",CY:"nicosia",MT:"valletta",LU:"luxembourg"},P=null;function U(){if(P)return P;let n=new Map,e=O,t=(o,i,a)=>{if(!o)return;let r=n.get(o);r?r.some(s=>s.row===i)||r.push({row:i,primary:a}):n.set(o,[{row:i,primary:a}])};for(let o of e.split(",")){let i=o.split("|");if(i.length<7)continue;let a={a1:i[1],cc:i[2],lon:+i[3],lat:+i[4],pop:+i[5],kinds:i[6]||"N"};i.length>8&&i[8]&&(a.tags=i[8].split(";").filter(Boolean));let r=g3[a.cc];if(r&&g(i[0])===g(r)&&(a.tags||(a.tags=[]),a.tags.includes("capital")||a.tags.push("capital")),t(u(i[0]),a,!0),i.length>7&&i[7])for(let s of i[7].split(";"))t(u(s),a,!1)}for(let o of n.values())o.sort((i,a)=>a.row.pop-i.row.pop);return P=n,n}var m3=200,h=null;function i3(){if(h)return h;let n=new Map;for(let[e,t]of U()){if(!e.endsWith(" city"))continue;let o=e.slice(0,-5);!o||U().get(o)?.some(i=>i.primary)||t[0].row.pop<m3||n.set(o,t)}return h=n,n}function D(n,e){if(!n)return;let t=n3(U(),i3(),n);if(t)return t;if(m(n))return;let o=e??g(n);if(H(o))return n3(R3(),N3(),o)}function n3(n,e,t){let o=n.get(t);if(o?.some(r=>r.primary))return o;let i=e.get(t);if(!i)return o;let a=i.map(r=>({row:r.row,primary:!0}));return o?[...a,...o]:a}var B=null;function R3(){return B||(B=o3(U())),B}var E=null;function N3(){return E||(E=o3(i3())),E}function o3(n){let e=new Map;for(let[t,o]of n){let i=g(t);if(!H(i))continue;let a=e.get(i);if(!a){e.set(i,o.slice());continue}for(let r of o){let s=a.findIndex(c=>c.row===r.row);s<0?a.push(r):r.primary&&!a[s].primary&&(a[s]=r)}}for(let t of e.values())t.sort((o,i)=>i.row.pop-o.row.pop);return e}var K=null;function T3(){if(K)return K;let n=new Map;for(let t of j.split(",")){let o=t.split("|");o.length<3||n.set(o[0],{lon:+o[1],lat:+o[2]})}let e=new Map;for(let t of U().values())for(let o of t){let i=G(o.row.cc);if(!i)continue;let a=e.get(i);(a===void 0||o.row.pop>a)&&(e.set(i,o.row.pop),n.set(i,{lon:o.row.lon,lat:o.row.lat}))}return K=n,n}var V=null;function w(){if(V)return V;let n=new Map;for(let e of J.split(",")){let t=e.split("|");if(t.length<5)continue;let o={key:t[0],cc:t[1],name:t[2],lon:+t[3],lat:+t[4]};n.set(u(o.key),o);let i=u(o.name);i==="mexico"&&o.cc==="MX"?(n.set("estado de mexico",o),n.set("edomex",o)):n.set(i,o)}return V=n,n}var F=null;function y3(){if(F)return F;let n=new I;for(let[e,t]of w())n.add(e,t);return F=n,n}var Y=null;function I3(){if(Y)return Y;let n=new Map;for(let e of Q.split(",")){let t=e.split("|");t.length<3||n.set(t[0],{lon:+t[1],lat:+t[2]})}return Y=n,n}var L3=new Set(["USA","PRI","VIR","GUM","ASM","MNP"]),G3=new Set(["USA","CAN","MEX"]);function t3(n){if(n==null)return null;let e=u(String(n));if(!e)return null;let t=w().get(e);return t?t.key:m(e)?null:y3().get(R(String(n)))?.key??null}var a3={us:"US",usa:"US","u s":"US","u s a":"US",america:"US","united states":"US","united states of america":"US",ca:"CA",can:"CA",canada:"CA",mx:"MX",mex:"MX",mexico:"MX","estados unidos mexicanos":"MX"};function z3(n){if(n==null)return null;let e=u(String(n));if(!e)return null;let t=a3[e];return t||(m(e)?null:U3().get(R(String(n)))??null)}var Z=null;function U3(){if(Z)return Z;let n=new I;for(let[e,t]of Object.entries(a3))n.add(e,t);return Z=n,n}function b3(n){return w().get(u(n))?.cc??null}function P3(n){let e=b3(n);return e?G(e):null}function v3(n){return r3(n)[0]??null}function h3(n){if(n==null)return null;let e=String(n).trim().replace(/\.0+$/,"");if(!e)return null;let t=/^(\d{5})(-\d{4})?$/.exec(e);return t?t[1]:/^\d{3,4}$/.test(e)?e.padStart(5,"0"):null}function r3(n){if(n==null)return[];let e=String(n).trim().replace(/\.0+$/,"");if(!e)return[];if(/^\d{3}$/.test(e)){let o=e.padStart(5,"0").slice(0,3);return o===e?[e]:[e,o]}let t=h3(e);return t?[t.slice(0,3)]:[]}function B3(n){return!!n&&n.ambiguous===!0&&!("precision"in n)}function E3(n){let e=null,t=typeof n.lat=="string"?n.lat.trim():n.lat,o=typeof n.lon=="string"?n.lon.trim():n.lon;if(t!=null&&t!==""&&o!==void 0&&o!==null&&o!==""){let r=+t,s=+o;if(isFinite(r)&&isFinite(s)&&r>=-90&&r<=90&&s>=-180&&s<=180)if(r===0&&s===0)e={lat:0,lon:0,precision:"latlon"};else return{lat:r,lon:s,precision:"latlon"}}let i=k(n.country),a=t3(n.state);if(a&&i&&P3(a)!==i&&(a=null),n.city!==void 0&&n.city!==null){let r=u(String(n.city)),s=D(r,R(String(n.city))),c=s?_(s,n.mapKind):null;if(c&&c.length){let d=n.state===void 0||n.state===null?"":String(n.state).trim(),T=d?u(d):"",y=d?t3(d):null,f=[],N=-1;for(let M of c){let l=M.row,p=0;if(d&&l.a1!=="")if(y&&l.a1===y||u(l.a1)===T)p++;else continue;if(i)if(G(l.cc)===i)p++;else continue;p>N?(N=p,f=[M]):p===N&&f.push(M)}f.some(M=>M.primary)&&(f=f.filter(M=>M.primary));let A=new Map;for(let M of f)A.set(M.row.lon.toFixed(2)+","+M.row.lat.toFixed(2),M.row);if(A.size===1){let M=f[0].row;return{lat:M.lat,lon:M.lon,precision:"city"}}if(A.size>1)return{ambiguous:!0,matches:A.size}}}if(!i||L3.has(i))for(let r of r3(n.zip)){let s=I3().get(r);if(s)return{lat:s.lat,lon:s.lon,precision:"zip3"}}if(a){let r=w().get(u(a));if(r)return{lat:r.lat,lon:r.lon,precision:"state"}}if(i&&(n.mapKind!=="north-america"||G3.has(i))){let r=T3().get(i);if(r)return{lat:r.lat,lon:r.lon,precision:"country"}}return e}var b={latlon:0,city:1,zip3:2,state:3,country:4},e3=8;function J3(n,e){let t=new Array(n.length),o=new Array(n.length),i=new Array(n.length),a=new Set,r=[],s=new Set,c=[],d=new Set,T=[],y={latlon:0,city:0,zip3:0,state:0,country:0},f=0,N=0,A=null;for(let l=0;l<n.length;++l){let p=n[l],C=E3({...p,mapKind:e});if(B3(C)){t[l]=null,o[l]=null,i[l]=null,N++;let S=W(p);S&&!d.has(S.toLowerCase())&&(d.add(S.toLowerCase()),T.length<e3&&T.push(S))}else if(C){if(t[l]=C.lat,o[l]=C.lon,i[l]=C.precision,f++,y[C.precision]++,(A===null||b[C.precision]>b[A])&&(A=C.precision),b[C.precision]>b.city){let S=W(p);S&&!s.has(S.toLowerCase())&&(s.add(S.toLowerCase()),c.length<e3&&c.push(S))}}else{t[l]=null,o[l]=null,i[l]=null;let S=W(p);S&&!a.has(S.toLowerCase())&&(a.add(S.toLowerCase()),r.push(S))}}let M=!C3()&&n.some(l=>l.city!==null&&l.city!==void 0&&String(l.city).trim()!=="");return{lat:t,lon:o,precisions:i,precision:A,precisionCounts:y,coarseExamples:c,unmatched:r,ambiguousRows:N,ambiguousExamples:T,matchedRows:f,totalRows:n.length,...M?{cityTableMissing:!0}:{}}}function W(n){let e=[n.city,n.state,n.zip,n.country].filter(t=>t!=null&&String(t).trim()!=="").map(t=>String(t).trim()).join(", ");return e||(n.label===null||n.label===void 0?"":String(n.label).trim())}function Q3(n,e){let t=u(String(n??""));if(!t)return[];let o=D(t,R(String(n??"")));if(!o)return[];let i=k(e??null),a=new Set;for(let r of o)if(!(i&&G(r.row.cc)!==i))for(let s of r.row.tags??[])a.add(s);return Array.from(a)}function j3(n,e){if(!n)return!1;let t=D(n);return t?_(t,e).length>0:!1}function $3(n,e){let t=new Set,o=0;for(let i of n){if(i==null)continue;let a=u(String(i));if(m(a)||t.has(a))continue;t.add(a);let r=D(a,R(String(i)));r&&_(r,e).length>0&&o++}return t.size===0?0:Math.round(o/t.size*1e3)/10}export{O3 as a,m as b,D3 as c,u as d,R as e,L as f,u3 as g,c3 as h,q as i,p3 as j,k,_3 as l,C3 as m,G3 as n,t3 as o,z3 as p,v3 as q,h3 as r,r3 as s,B3 as t,E3 as u,J3 as v,Q3 as w,j3 as x,$3 as y};
@@ -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 en,b as L,c as sn,d as on,e as rn,g as an,h as cn,i as un,j as ln,k as W,r as V,x}from"./chunk-INMDBTAR.mjs";import{b as nn}from"./chunk-CZJ7M6A5.mjs";import{e as tn}from"./chunk-5HI6TVMM.mjs";var An="006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191193194195196197198199200201202203204205206207208209210211212214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310312313314315316317318319320321322323324325326327328329330331333334335336337338339341342344346347349350351352354355356357358359360361362363364365366367368369370371372373374376377378379380381382383384385386387388389390391392393394395396397398400401402403404405406407408409410411412413414415416417418420421422423424425426427430431432433434435436437438439440441442443444445446447448449450451452453454455456457458460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508510511512513514515516520521522523524525526527528530531532534535537538539540541542543544545546547548549550551553554556557558559560561562563564565566567570571572573574575576577580581582583584585586587588590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620622623624625626627628629630631633634635636637638639640641644645646647648650651652653654655656657658660661662664665666667668669670671672673674675676677678679680681683684685686687688689690691692693700701703704705706707708710711712713714716717718719720721722723724725726727728729730731734735736737738739740741743744745746747748749750751752753754755756757758759760761762763764765766767768769770772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816820821822823824825826827828829830831832833834835836837838840841843844845846847850851852853855856857859860863864865870871873874875877878879880881882883884890891893894895897898900902903904905906907908910911912913914915916917918919920921922923924925926927928930931932933934935936937939940941943944945946947948949950951952953954955956957958959960961967968969970971972973974975976977978979980981982983984985986988989990991992993994995996997998999",w=new Set(An.match(/.{3}/g)??[]);var dn=[["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"],["DC","District of Columbia"],["PR","Puerto Rico"],["GU","Guam"],["VI","U.S. Virgin Islands"],["AS","American Samoa"],["MP","Northern Mariana Islands"]],pn=new Set(dn.map(n=>n[0])),Cn={"Ala.":"AL","Alab.":"AL","Ariz.":"AZ","Ark.":"AR","Calif.":"CA","Cal.":"CA","Colo.":"CO","Col.":"CO","Conn.":"CT","Del.":"DE","Fla.":"FL","Flor.":"FL","Ga.":"GA","Ill.":"IL","Ind.":"IN","Kan.":"KS","Kans.":"KS","Ky.":"KY","La.":"LA","Md.":"MD","Mass.":"MA","Mich.":"MI","Minn.":"MN","Miss.":"MS","Mo.":"MO","Mont.":"MT","Neb.":"NE","Nebr.":"NE","Nev.":"NV","N.H.":"NH","N.J.":"NJ","N.M.":"NM","N.Mex.":"NM","N. Mex.":"NM","N.Y.":"NY","N.C.":"NC","N.D.":"ND","N.Dak.":"ND","N. Dak.":"ND","Okla.":"OK","Ore.":"OR","Oreg.":"OR","Pa.":"PA","Penn.":"PA","Penna.":"PA","R.I.":"RI","S.C.":"SC","S.D.":"SD","S.Dak.":"SD","S. Dak.":"SD","Tenn.":"TN","Tex.":"TX","Vt.":"VT","Va.":"VA","Wash.":"WA","W.Va.":"WV","W. Va.":"WV","Wis.":"WI","Wisc.":"WI","Wyo.":"WY","D.C.":"DC","Wash. D.C.":"DC","Wash., D.C.":"DC","P.R.":"PR","V.I.":"VI"},Y=(()=>{let n=new Map;for(let[s,o]of dn)n.set(g(o),s);n.set(g("Washington DC"),"DC"),n.set(g("Washington D.C."),"DC"),n.set(g("US Virgin Islands"),"VI");for(let[s,o]of Object.entries(Cn)){let r=g(s);r&&!n.has(r)&&n.set(r,o)}return n})(),In=(()=>{let n=new tn;for(let[s,o]of Y)n.add(s,o);return n})();function mn(n){let s=g(n),o=Y.get(s);return o||(L(s)?null:In.get(rn(n))??null)}var Sn=new Set(["01","02","04","05","06","08","09","10","11","12","13","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","44","45","46","47","48","49","50","51","53","54","55","56","60","66","69","72","78"]);function yn(n){return n.trim().toUpperCase()}function g(n){return on(n)}var H=new Set(["country","countries","nation","nationality","iso","geo"]),U=new Set(["state","province","st"]),fn=new Set(["zip","zipcode","postal","postcode","plz"]),Mn=new Set(["county","fips","borough","parish"]),Tn=new Set(["city","cities","town","municipality","metro","location","place"]);function y(n,s){if(!n)return!1;for(let o of nn(n))if(s.has(o))return!0;return!1}var Dn=95,On=5,_n=6e4;function Un(n,s,o){if(!n||n.length===0)return null;let r=[],I=new Set;for(let t of n){if(t==null)continue;let e=String(t).trim();if(e.length===0||L(g(e)))continue;let i=e.toLowerCase();if(!I.has(i)&&(I.add(i),r.push(e),r.length>_n))return null}let N=r.length;if(N<2)return null;let h=r.map(yn),M=r.map(g),O=un(),d=0,p=0,m=0,T=0,D=0,l=0,_=0,F=0,Z=0,K=0,$=0,P=0,J=t=>(V(t)??"").slice(0,3),X=0,B=0,E=0,v=y(s,fn);for(let t=0;t<N;++t){let e=h[t],i=M[t],c=r[t],S=an.has(e),C=pn.has(e);cn.has(e)&&d++,S&&p++,C&&m++,S&&C&&X++;let G=O.has(i)||ln(c)!==null,R=Y.has(i)||mn(c)!==null;G&&T++,R&&D++,G&&R&&B++,W(c)&&K++,C&&R&&E++,/^\d{5}(-\d{4})?$/.test(c)||v&&/^\d{3,4}$/.test(c)?(l++,w.has(J(c))&&P++):/^\d{4}$/.test(c)&&$++,/^\d{5}$/.test(c)&&Sn.has(c.slice(0,2))&&_++,x(i)&&F++,x(i,"world")&&Z++}if(!v&&l>0){l+=$;for(let t of r)/^\d{4}$/.test(t)&&w.has(J(t))&&P++}let j=t=>t/N*100,A=[],u=(t,e,i,c=!1)=>{let S=j(e),C=t==="city-name"||t==="city-name-world";S<(C?sn:Dn)||e<2||c&&e<On&&!y(s,t==="country-name"?H:C?Tn:U)||A.push({kind:t,matched:e,spec:i,pct:S})};u("country-iso3",d,6),u("country-name",T,5,!0),u("us-state-name",D,5,!0),u("us-zip5",l,4),u("us-county-fips",_,4),u("country-iso2",p,3),u("us-state-code",m,3);let gn=A.length;u("city-name",F,2,!0),A.length===gn&&u("city-name-world",Z,2,!0);let Nn=m-E,hn=D-E;Nn>0&&hn>0&&u("us-state-name",m+D-E,5,!0);let b=Math.max(d,p,T);if(K>b){let t=d===b?"country-iso3":T===b?"country-name":"country-iso2";u(t,K,t==="country-iso3"?6:t==="country-name"?5:3,t==="country-name")}if(A.length===0)return null;A.sort((t,e)=>e.pct-t.pct||e.spec-t.spec);let a=A[0],k=!1,q={"country-iso2":"us-state-code","us-state-code":"country-iso2","us-zip5":"us-county-fips","us-county-fips":"us-zip5","country-name":"us-state-name","us-state-name":"country-name"}[a.kind],z=A[1],Q=q&&z&&z.kind===q&&Math.abs(a.pct-z.pct)<=15;if(a.kind==="country-iso2"||a.kind==="us-state-code"){let t=a.matched>0?X/a.matched:0,e=y(s,H),i=y(s,U);if(Q||t>=.5){if(e&&!i)return f("country-iso2",p,!1);if(i&&!e)return f("us-state-code",m,!1);k=!0}}else if(a.kind==="us-zip5"||a.kind==="us-county-fips"){let t=_===l&&l===N,e=y(s,fn),i=y(s,Mn);return i&&!e?f("us-county-fips",_,!1):e&&!i?f("us-zip5",l,!1):t?f("us-zip5",l,!0):f("us-zip5",l,!1)}else if(Q&&(a.kind==="country-name"||a.kind==="us-state-name")){let t=a.matched>0?B/a.matched:0,e=y(s,H),i=y(s,U);if(e&&!i)return f("country-name",T,!1);if(i&&!e)return f("us-state-name",D,!1);t>=.5&&(k=!0)}return f(a.kind,a.matched,k);function f(t,e,i){let S={geoKind:t,geoMatchPct:Math.round(j(t==="us-zip5"?P:e)*10)/10};return i&&(S.geoAmbiguous=!0),S}}function En(n,s){if(n==null)return null;let o=String(n).trim();if(o.length===0)return null;switch(s){case"country-iso3":case"country-iso2":case"country-name":return W(o);case"us-state-code":case"us-state-name":{let r=yn(o);return pn.has(r)?r:mn(o)}case"us-zip5":return V(o);case"us-county-fips":return/^\d{5}$/.test(o)&&Sn.has(o.slice(0,2))?o:null;default:return null}}function Yn(n){switch(n){case"country-iso3":case"country-iso2":case"country-name":case"us-state-code":case"us-state-name":case"us-zip5":case"us-county-fips":return!0;default:return!1}}function Rn(n,s){return s==="us-zip5"?w.has(n.slice(0,3)):!0}function Fn(n,s){let o=new Array(n.length),r=new Set,I=[],N=0;for(let h=0;h<n.length;++h){let M=En(n[h],s),O=M!==null&&Rn(M,s)?M:null;if(o[h]=O,O!==null)N++;else{let d=n[h];if(d!=null){let p=String(d).trim();if(p.length>0){let m=p.toLowerCase();r.has(m)||(r.add(m),I.push(p))}}}}return{iso:o,unmatched:I,matchedRows:N,totalRows:n.length}}export{fn as a,y as b,Un as c,En as d,Yn as e,Fn as f};