@bicharts/shape-core 0.6.32 → 0.6.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-35Z7JCND.mjs → chunk-6Q3MQ2MK.mjs} +1 -1
- package/dist/{chunk-C5I73OM2.mjs → chunk-6TVBXT4G.mjs} +1 -1
- package/dist/{chunk-PK6KRKNE.mjs → chunk-FNEHWEWX.mjs} +1 -1
- package/dist/{chunk-BIC73LQV.mjs → chunk-JF3BJI7F.mjs} +1 -1
- package/dist/{chunk-ZVHCLXKO.mjs → chunk-KKSQBV76.mjs} +1 -1
- package/dist/chunk-NFSQ4O5R.mjs +2 -0
- package/dist/geoDetector.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/indexedText.mjs +1 -1
- package/dist/ingest.mjs +1 -1
- package/dist/ordinalDetector.mjs +1 -1
- package/dist/testing.mjs +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/languages.d.ts +21 -2
- package/dist/types/nameReader.d.ts +3 -3
- package/dist/types/vocab/dateLevels.d.ts +36 -0
- package/dist/util.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-ILHBRGIO.mjs +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{f as h}from"./chunk-ILHBRGIO.mjs";var b=[{name:"likert7_agreement",minMatches:5,canonical:["strongly disagree","disagree","slightly disagree","neutral","slightly agree","agree","strongly agree"]},{name:"likert5_agreement",minMatches:3,canonical:["strongly disagree","disagree","neutral","agree","strongly agree"]},{name:"likert3_agreement",minMatches:2,canonical:["disagree","neutral","agree"]},{name:"likert5_satisfaction",minMatches:3,canonical:["very dissatisfied","dissatisfied","neutral","satisfied","very satisfied"]},{name:"likert3_satisfaction",minMatches:2,canonical:["dissatisfied","neutral","satisfied"]},{name:"likert5_quality",minMatches:3,canonical:["poor","fair","good","very good","excellent"]},{name:"likert3_quality",minMatches:2,canonical:["poor","fair","good"]},{name:"frequency5",minMatches:3,canonical:["never","rarely","sometimes","often","always"]},{name:"intensity5",minMatches:3,canonical:["not at all","slightly","moderately","very","extremely"]},{name:"importance5",minMatches:3,canonical:["not important","slightly important","moderately important","very important","extremely important"]},{name:"severity_low_critical",minMatches:3,canonical:["low","medium","high","critical"]},{name:"severity_low_urgent",minMatches:3,canonical:["low","medium","high","urgent"]},{name:"severity_none_critical",minMatches:3,canonical:["none","mild","moderate","severe","critical"]},{name:"priority_p4_p1",minMatches:3,canonical:["p4","p3","p2","p1","p0"]},{name:"severity_trivial_blocker",minMatches:3,canonical:["trivial","minor","major","critical","blocker"]},{name:"severity_minor_severe",minMatches:3,canonical:["minor","moderate","major","severe"]},{name:"magnitude5_medium",minMatches:3,canonical:["very low","low","medium","high","very high"]},{name:"magnitude5_moderate",minMatches:3,canonical:["very low","low","moderate","high","very high"]},{name:"speed5",minMatches:3,canonical:["very slow","slow","moderate","fast","very fast"]},{name:"temperature6",minMatches:3,canonical:["freezing","cold","cool","mild","warm","hot"]},{name:"experience6",minMatches:3,canonical:["novice","beginner","intermediate","advanced","expert","master"]},{name:"tier_metal",minMatches:3,canonical:["bronze","silver","gold","platinum","diamond"]},{name:"tshirt_letter_sizes",minMatches:4,canonical:["xxs","xs","s","m","l","xl","xxl","xxxl"]},{name:"tshirt_word_sizes",minMatches:3,canonical:["extra small","small","medium","large","extra large"]},{name:"nps_bands",minMatches:2,canonical:["detractor","passive","promoter"]},{name:"likelihood5",minMatches:3,canonical:["very unlikely","unlikely","neutral","likely","very likely"]},{name:"education",minMatches:3,canonical:["none","primary","secondary","bachelors","masters","doctoral"]},{name:"grades_a_to_f",minMatches:3,canonical:["a","b","c","d","f"]},{name:"grades_a_to_f_plusminus",minMatches:4,canonical:["a+","a","a-","b+","b","b-","c+","c","c-","d+","d","d-","f"]}],v={seldom:"rarely",infrequently:"rarely","hardly ever":"rarely",occasionally:"sometimes",periodically:"sometimes","now and then":"sometimes",frequently:"often",frequent:"often",regularly:"often",commonly:"often",usually:"often",constantly:"always","every time":"always","all the time":"always",consistently:"always",continually:"always",bad:"poor",weak:"poor",subpar:"poor",mediocre:"fair",passable:"fair","so so":"fair",decent:"good",solid:"good",outstanding:"excellent",superb:"excellent",exceptional:"excellent",stellar:"excellent",unsatisfied:"dissatisfied",unhappy:"dissatisfied",displeased:"dissatisfied",happy:"satisfied",content:"satisfied",pleased:"satisfied",delighted:"very satisfied","highly satisfied":"very satisfied","extremely satisfied":"very satisfied","highly dissatisfied":"very dissatisfied","extremely dissatisfied":"very dissatisfied",neither:"neutral",undecided:"neutral","no opinion":"neutral","neither agree nor disagree":"neutral","completely agree":"strongly agree","totally agree":"strongly agree","completely disagree":"strongly disagree","totally disagree":"strongly disagree","highly unlikely":"very unlikely","extremely unlikely":"very unlikely","highly likely":"very likely","extremely likely":"very likely","almost certain":"very likely",bachelor:"bachelors","bachelor's":"bachelors",undergraduate:"bachelors","bachelor degree":"bachelors","master's":"masters",graduate:"masters","master degree":"masters",doctorate:"doctoral",phd:"doctoral"},x=(()=>{let n=new Set;for(let t of b)for(let r of t.canonical)n.add(d(r));return n})(),q=(()=>{let n=new Map;for(let[t,r]of Object.entries(v)){let e=d(t);x.has(e)||n.has(e)||n.set(e,d(r))}return n})();function y(n){return q.get(n)??n}var D=new Set(["hour","hr","day","dow","dom","weekday","week","wk","woy","month","mth","quarter","qtr","year","yr","semester","trimester","decade","period","fiscal","fy","rank","level","lvl","tier","grade","band","decile","percentile","quartile","quintile","score","rating","stars","step","stage","phase","round","wave","episode","chapter","age","cohort","generation","seniority","position","sequence","seq","priority"]);function K(n){if(!n)return!1;for(let t of h(n))if(D.has(t))return!0;return!1}function d(n){return n.toLowerCase().replace(/[-_]+/g," ").replace(/\s+/g," ").trim()}function g(n){let t=new Map;for(let[r,e]of n)for(let a of r)t.set(d(a),e);return t}var _=[{name:"weekday_mon_sun",minMatches:4,dict:g([[["monday","mon"],0],[["tuesday","tue","tues"],1],[["wednesday","wed","weds"],2],[["thursday","thu","thur","thurs","thr"],3],[["friday","fri"],4],[["saturday","sat"],5],[["sunday","sun"],6]])},{name:"month_jan_dec",minMatches:4,dict:g([[["january","jan"],0],[["february","feb"],1],[["march","mar"],2],[["april","apr"],3],[["may"],4],[["june","jun"],5],[["july","jul"],6],[["august","aug"],7],[["september","sep","sept"],8],[["october","oct"],9],[["november","nov"],10],[["december","dec"],11]])},{name:"quarter_q1_q4",minMatches:3,dict:g([[["q1","qtr 1","qtr1","quarter 1","q 1"],0],[["q2","qtr 2","qtr2","quarter 2","q 2"],1],[["q3","qtr 3","qtr3","quarter 3","q 3"],2],[["q4","qtr 4","qtr4","quarter 4","q 4"],3]])}],p={};function C(n){let t=n||"";if(!t)return{weekday:new Map,month:new Map};let r=p[t];if(r)return r;let e=new Map,a=new Map,i=(s,l,m)=>{let u=d(l);u&&s.set(u,m);let c=d(l.replace(/\./g,""));c&&c!==u&&s.set(c,m)};try{let s=new Intl.DateTimeFormat(t,{weekday:"long"}),l=new Intl.DateTimeFormat(t,{weekday:"short"});for(let c=0;c<7;++c){let f=new Date(Date.UTC(2024,0,1+c));i(e,s.format(f),c),i(e,l.format(f),c)}let m=new Intl.DateTimeFormat(t,{month:"long"}),u=new Intl.DateTimeFormat(t,{month:"short"});for(let c=0;c<12;++c){let f=new Date(Date.UTC(2020,c,15));i(a,m.format(f),c),i(a,u.format(f),c)}}catch{}let o={weekday:e,month:a};return p[t]=o,o}function M(n,t){if(t.size===0)return n;let r=new Map(n);for(let[e,a]of t)r.has(e)||r.set(e,a);return r}function N(n,t){let r=C(t);for(let e of _){let a=e.name==="weekday_mon_sun"?M(e.dict,r.weekday):e.name==="month_jan_dec"?M(e.dict,r.month):e.dict,i=!0,o=new Map;for(let[l,m]of n){let u=a.get(l);if(u===void 0){i=!1;break}o.has(u)||o.set(u,m)}if(!i||o.size<e.minMatches)continue;let s=[...o.entries()].sort((l,m)=>l[0]-m[0]).map(l=>l[1]);return{pattern:e.name,orderedDomain:s}}return null}function w(n){let t=new Map;for(let r of n){if(r==null)continue;let e=String(r);if(e.length===0)continue;let a=d(e);t.has(a)||t.set(a,e)}return t}var S=15,R=10,O=(()=>{let n=["xxs","xs","s","sm","small","m","med","medium","l","lg","large","xl","xlarge","xxl","xxxl","2xl","3xl","4xl","y","n","yes","no","t","f","true","false","na","n/a","n a","none","null","unknown","other","all","both","low","medium","med","high","very low","very high","minimal","critical","urgent"],t=new Set(n.map(d));for(let r of _)for(let e of r.dict.keys())t.add(e);return t})();function A(n){let t=n.trim();return t.length===0||t.length>R||(t.match(/\p{L}/gu)||[]).length>1?!1:/\p{Nd}/u.test(t)}function E(n){let t=n.trim();return t.length===1&&/[\p{L}\p{Nd}]/u.test(t)}function V(n){if(!n||n.length===0)return null;let t=new Set,r=[];for(let e of n){if(e==null)continue;let a=String(e);if(t.has(a))continue;let i=d(a);if(!(i===""||O.has(i)||A(a)||E(a))||(t.add(a),r.push(a),r.length>S))return null}return r.length>0?r:null}var I=/^(\p{L}{0,3}) ?([0-9]+)\s*[-–—:.)]\s*(.+)$/u;function T(n){let t=null,r=new Set,e=[];for(let a of n.values()){let i=I.exec(a.trim());if(!i)return null;let o=i[1].toLowerCase();if(t===null)t=o;else if(o!==t)return null;let s=Number(i[2]);if(r.has(s)||d(i[3])==="")return null;r.add(s),e.push({code:s,original:a,label:i[3]})}return e}function L(n,t){let r=k(w(n.map(s=>s.label)),t);if(r===null)return;if(r.orderedDomain.length!==n.length)return null;let e=new Map;for(let s of n)e.set(s.label,s);let a=r.orderedDomain.map(s=>e.get(s));if(a.some(s=>s===void 0))return null;let i=!0,o=!0;for(let s=1;s<a.length;++s)a[s].code<=a[s-1].code&&(i=!1),a[s].code>=a[s-1].code&&(o=!1);return!i&&!o?null:{pattern:r.pattern,orderedDomain:a.map(s=>s.original)}}function Y(n,t){if(!n||n.length<2)return null;let r=w(n);if(r.size<2)return null;let e=T(r);if(e!==null){let i=L(e,t);if(i!==void 0)return i}let a=k(r,t);return a!==null?a:e!==null?P(r):null}var F=/^([0-9]+)\s*(?:\.|\)|-)\s*([^\s\d].*)$/u,j=3,z=20;function P(n){if(n.size<j||n.size>z)return null;let t=new Set,r=[];for(let e of n.values()){let a=F.exec(e.trim());if(!a||d(a[2])==="")return null;let i=Number(a[1]);if(t.has(i))return null;t.add(i),r.push({n:i,original:e})}return r.sort((e,a)=>e.n-a.n),{pattern:"numeric_rank_prefix",orderedDomain:r.map(e=>e.original)}}function k(n,t){let r=new Map;for(let[a,i]of n){let o=y(a);r.has(o)||r.set(o,i)}let e=null;for(let a of b){let i=[];for(let m of a.canonical){let u=r.get(m);u!==void 0&&i.push(u)}if(i.length<a.minMatches)continue;let o=new Set(a.canonical),s=!0;for(let m of n.keys())if(!o.has(y(m))){s=!1;break}if(!s)continue;let l;e===null||i.length>e.matched||i.length===e.matched&&a.canonical.length<e.pattern.canonical.length?l=!0:l=!1,l&&(e={pattern:a,matched:i.length,orderedDomain:i})}return e?{pattern:e.pattern.name,orderedDomain:e.orderedDomain}:N(n,t)}export{K as a,V as b,Y as c};
|
|
2
|
+
import{i as h}from"./chunk-NFSQ4O5R.mjs";var b=[{name:"likert7_agreement",minMatches:5,canonical:["strongly disagree","disagree","slightly disagree","neutral","slightly agree","agree","strongly agree"]},{name:"likert5_agreement",minMatches:3,canonical:["strongly disagree","disagree","neutral","agree","strongly agree"]},{name:"likert3_agreement",minMatches:2,canonical:["disagree","neutral","agree"]},{name:"likert5_satisfaction",minMatches:3,canonical:["very dissatisfied","dissatisfied","neutral","satisfied","very satisfied"]},{name:"likert3_satisfaction",minMatches:2,canonical:["dissatisfied","neutral","satisfied"]},{name:"likert5_quality",minMatches:3,canonical:["poor","fair","good","very good","excellent"]},{name:"likert3_quality",minMatches:2,canonical:["poor","fair","good"]},{name:"frequency5",minMatches:3,canonical:["never","rarely","sometimes","often","always"]},{name:"intensity5",minMatches:3,canonical:["not at all","slightly","moderately","very","extremely"]},{name:"importance5",minMatches:3,canonical:["not important","slightly important","moderately important","very important","extremely important"]},{name:"severity_low_critical",minMatches:3,canonical:["low","medium","high","critical"]},{name:"severity_low_urgent",minMatches:3,canonical:["low","medium","high","urgent"]},{name:"severity_none_critical",minMatches:3,canonical:["none","mild","moderate","severe","critical"]},{name:"priority_p4_p1",minMatches:3,canonical:["p4","p3","p2","p1","p0"]},{name:"severity_trivial_blocker",minMatches:3,canonical:["trivial","minor","major","critical","blocker"]},{name:"severity_minor_severe",minMatches:3,canonical:["minor","moderate","major","severe"]},{name:"magnitude5_medium",minMatches:3,canonical:["very low","low","medium","high","very high"]},{name:"magnitude5_moderate",minMatches:3,canonical:["very low","low","moderate","high","very high"]},{name:"speed5",minMatches:3,canonical:["very slow","slow","moderate","fast","very fast"]},{name:"temperature6",minMatches:3,canonical:["freezing","cold","cool","mild","warm","hot"]},{name:"experience6",minMatches:3,canonical:["novice","beginner","intermediate","advanced","expert","master"]},{name:"tier_metal",minMatches:3,canonical:["bronze","silver","gold","platinum","diamond"]},{name:"tshirt_letter_sizes",minMatches:4,canonical:["xxs","xs","s","m","l","xl","xxl","xxxl"]},{name:"tshirt_word_sizes",minMatches:3,canonical:["extra small","small","medium","large","extra large"]},{name:"nps_bands",minMatches:2,canonical:["detractor","passive","promoter"]},{name:"likelihood5",minMatches:3,canonical:["very unlikely","unlikely","neutral","likely","very likely"]},{name:"education",minMatches:3,canonical:["none","primary","secondary","bachelors","masters","doctoral"]},{name:"grades_a_to_f",minMatches:3,canonical:["a","b","c","d","f"]},{name:"grades_a_to_f_plusminus",minMatches:4,canonical:["a+","a","a-","b+","b","b-","c+","c","c-","d+","d","d-","f"]}],v={seldom:"rarely",infrequently:"rarely","hardly ever":"rarely",occasionally:"sometimes",periodically:"sometimes","now and then":"sometimes",frequently:"often",frequent:"often",regularly:"often",commonly:"often",usually:"often",constantly:"always","every time":"always","all the time":"always",consistently:"always",continually:"always",bad:"poor",weak:"poor",subpar:"poor",mediocre:"fair",passable:"fair","so so":"fair",decent:"good",solid:"good",outstanding:"excellent",superb:"excellent",exceptional:"excellent",stellar:"excellent",unsatisfied:"dissatisfied",unhappy:"dissatisfied",displeased:"dissatisfied",happy:"satisfied",content:"satisfied",pleased:"satisfied",delighted:"very satisfied","highly satisfied":"very satisfied","extremely satisfied":"very satisfied","highly dissatisfied":"very dissatisfied","extremely dissatisfied":"very dissatisfied",neither:"neutral",undecided:"neutral","no opinion":"neutral","neither agree nor disagree":"neutral","completely agree":"strongly agree","totally agree":"strongly agree","completely disagree":"strongly disagree","totally disagree":"strongly disagree","highly unlikely":"very unlikely","extremely unlikely":"very unlikely","highly likely":"very likely","extremely likely":"very likely","almost certain":"very likely",bachelor:"bachelors","bachelor's":"bachelors",undergraduate:"bachelors","bachelor degree":"bachelors","master's":"masters",graduate:"masters","master degree":"masters",doctorate:"doctoral",phd:"doctoral"},x=(()=>{let n=new Set;for(let t of b)for(let r of t.canonical)n.add(d(r));return n})(),q=(()=>{let n=new Map;for(let[t,r]of Object.entries(v)){let e=d(t);x.has(e)||n.has(e)||n.set(e,d(r))}return n})();function y(n){return q.get(n)??n}var D=new Set(["hour","hr","day","dow","dom","weekday","week","wk","woy","month","mth","quarter","qtr","year","yr","semester","trimester","decade","period","fiscal","fy","rank","level","lvl","tier","grade","band","decile","percentile","quartile","quintile","score","rating","stars","step","stage","phase","round","wave","episode","chapter","age","cohort","generation","seniority","position","sequence","seq","priority"]);function K(n){if(!n)return!1;for(let t of h(n))if(D.has(t))return!0;return!1}function d(n){return n.toLowerCase().replace(/[-_]+/g," ").replace(/\s+/g," ").trim()}function g(n){let t=new Map;for(let[r,e]of n)for(let a of r)t.set(d(a),e);return t}var _=[{name:"weekday_mon_sun",minMatches:4,dict:g([[["monday","mon"],0],[["tuesday","tue","tues"],1],[["wednesday","wed","weds"],2],[["thursday","thu","thur","thurs","thr"],3],[["friday","fri"],4],[["saturday","sat"],5],[["sunday","sun"],6]])},{name:"month_jan_dec",minMatches:4,dict:g([[["january","jan"],0],[["february","feb"],1],[["march","mar"],2],[["april","apr"],3],[["may"],4],[["june","jun"],5],[["july","jul"],6],[["august","aug"],7],[["september","sep","sept"],8],[["october","oct"],9],[["november","nov"],10],[["december","dec"],11]])},{name:"quarter_q1_q4",minMatches:3,dict:g([[["q1","qtr 1","qtr1","quarter 1","q 1"],0],[["q2","qtr 2","qtr2","quarter 2","q 2"],1],[["q3","qtr 3","qtr3","quarter 3","q 3"],2],[["q4","qtr 4","qtr4","quarter 4","q 4"],3]])}],p={};function C(n){let t=n||"";if(!t)return{weekday:new Map,month:new Map};let r=p[t];if(r)return r;let e=new Map,a=new Map,i=(s,l,m)=>{let u=d(l);u&&s.set(u,m);let c=d(l.replace(/\./g,""));c&&c!==u&&s.set(c,m)};try{let s=new Intl.DateTimeFormat(t,{weekday:"long"}),l=new Intl.DateTimeFormat(t,{weekday:"short"});for(let c=0;c<7;++c){let f=new Date(Date.UTC(2024,0,1+c));i(e,s.format(f),c),i(e,l.format(f),c)}let m=new Intl.DateTimeFormat(t,{month:"long"}),u=new Intl.DateTimeFormat(t,{month:"short"});for(let c=0;c<12;++c){let f=new Date(Date.UTC(2020,c,15));i(a,m.format(f),c),i(a,u.format(f),c)}}catch{}let o={weekday:e,month:a};return p[t]=o,o}function M(n,t){if(t.size===0)return n;let r=new Map(n);for(let[e,a]of t)r.has(e)||r.set(e,a);return r}function N(n,t){let r=C(t);for(let e of _){let a=e.name==="weekday_mon_sun"?M(e.dict,r.weekday):e.name==="month_jan_dec"?M(e.dict,r.month):e.dict,i=!0,o=new Map;for(let[l,m]of n){let u=a.get(l);if(u===void 0){i=!1;break}o.has(u)||o.set(u,m)}if(!i||o.size<e.minMatches)continue;let s=[...o.entries()].sort((l,m)=>l[0]-m[0]).map(l=>l[1]);return{pattern:e.name,orderedDomain:s}}return null}function w(n){let t=new Map;for(let r of n){if(r==null)continue;let e=String(r);if(e.length===0)continue;let a=d(e);t.has(a)||t.set(a,e)}return t}var S=15,R=10,O=(()=>{let n=["xxs","xs","s","sm","small","m","med","medium","l","lg","large","xl","xlarge","xxl","xxxl","2xl","3xl","4xl","y","n","yes","no","t","f","true","false","na","n/a","n a","none","null","unknown","other","all","both","low","medium","med","high","very low","very high","minimal","critical","urgent"],t=new Set(n.map(d));for(let r of _)for(let e of r.dict.keys())t.add(e);return t})();function A(n){let t=n.trim();return t.length===0||t.length>R||(t.match(/\p{L}/gu)||[]).length>1?!1:/\p{Nd}/u.test(t)}function E(n){let t=n.trim();return t.length===1&&/[\p{L}\p{Nd}]/u.test(t)}function V(n){if(!n||n.length===0)return null;let t=new Set,r=[];for(let e of n){if(e==null)continue;let a=String(e);if(t.has(a))continue;let i=d(a);if(!(i===""||O.has(i)||A(a)||E(a))||(t.add(a),r.push(a),r.length>S))return null}return r.length>0?r:null}var I=/^(\p{L}{0,3}) ?([0-9]+)\s*[-–—:.)]\s*(.+)$/u;function T(n){let t=null,r=new Set,e=[];for(let a of n.values()){let i=I.exec(a.trim());if(!i)return null;let o=i[1].toLowerCase();if(t===null)t=o;else if(o!==t)return null;let s=Number(i[2]);if(r.has(s)||d(i[3])==="")return null;r.add(s),e.push({code:s,original:a,label:i[3]})}return e}function L(n,t){let r=k(w(n.map(s=>s.label)),t);if(r===null)return;if(r.orderedDomain.length!==n.length)return null;let e=new Map;for(let s of n)e.set(s.label,s);let a=r.orderedDomain.map(s=>e.get(s));if(a.some(s=>s===void 0))return null;let i=!0,o=!0;for(let s=1;s<a.length;++s)a[s].code<=a[s-1].code&&(i=!1),a[s].code>=a[s-1].code&&(o=!1);return!i&&!o?null:{pattern:r.pattern,orderedDomain:a.map(s=>s.original)}}function Y(n,t){if(!n||n.length<2)return null;let r=w(n);if(r.size<2)return null;let e=T(r);if(e!==null){let i=L(e,t);if(i!==void 0)return i}let a=k(r,t);return a!==null?a:e!==null?P(r):null}var F=/^([0-9]+)\s*(?:\.|\)|-)\s*([^\s\d].*)$/u,j=3,z=20;function P(n){if(n.size<j||n.size>z)return null;let t=new Set,r=[];for(let e of n.values()){let a=F.exec(e.trim());if(!a||d(a[2])==="")return null;let i=Number(a[1]);if(t.has(i))return null;t.add(i),r.push({n:i,original:e})}return r.sort((e,a)=>e.n-a.n),{pattern:"numeric_rank_prefix",orderedDomain:r.map(e=>e.original)}}function k(n,t){let r=new Map;for(let[a,i]of n){let o=y(a);r.has(o)||r.set(o,i)}let e=null;for(let a of b){let i=[];for(let m of a.canonical){let u=r.get(m);u!==void 0&&i.push(u)}if(i.length<a.minMatches)continue;let o=new Set(a.canonical),s=!0;for(let m of n.keys())if(!o.has(y(m))){s=!1;break}if(!s)continue;let l;e===null||i.length>e.matched||i.length===e.matched&&a.canonical.length<e.pattern.canonical.length?l=!0:l=!1,l&&(e={pattern:a,matched:i.length,orderedDomain:i})}return e?{pattern:e.pattern.name,orderedDomain:e.orderedDomain}:N(n,t)}export{K as a,V as b,Y as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a as Q,c as tt,d as nt,e as et,f as W,g as st,h as ot,i as it,p as L,v as V}from"./chunk-TPVDJHU6.mjs";import{
|
|
2
|
+
import{a as Q,c as tt,d as nt,e as et,f as W,g as st,h as ot,i as it,p as L,v as V}from"./chunk-TPVDJHU6.mjs";import{i as q}from"./chunk-NFSQ4O5R.mjs";var St="006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191193194195196197198199200201202203204205206207208209210211212214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310312313314315316317318319320321322323324325326327328329330331333334335336337338339341342344346347349350351352354355356357358359360361362363364365366367368369370371372373374376377378379380381382383384385386387388389390391392393394395396397398400401402403404405406407408409410411412413414415416417418420421422423424425426427430431432433434435436437438439440441442443444445446447448449450451452453454455456457458460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508510511512513514515516520521522523524525526527528530531532534535537538539540541542543544545546547548549550551553554556557558559560561562563564565566567570571572573574575576577580581582583584585586587588590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620622623624625626627628629630631633634635636637638639640641644645646647648650651652653654655656657658660661662664665666667668669670671672673674675676677678679680681683684685686687688689690691692693700701703704705706707708710711712713714716717718719720721722723724725726727728729730731734735736737738739740741743744745746747748749750751752753754755756757758759760761762763764765766767768769770772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816820821822823824825826827828829830831832833834835836837838840841843844845846847850851852853855856857859860863864865870871873874875877878879880881882883884890891893894895897898900902903904905906907908910911912913914915916917918919920921922923924925926927928930931932933934935936937939940941943944945946947948949950951952953954955956957958959960961967968969970971972973974975976977978979980981982983984985986988989990991992993994995996997998999",w=new Set(St.match(/.{3}/g)??[]);var at=[["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"]],ct=new Set(at.map(n=>n[0])),yt={"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"},ut=(()=>{let n=new Map;for(let[s,i]of at)n.set(g(i),s);n.set(g("Washington DC"),"DC"),n.set(g("Washington D.C."),"DC"),n.set(g("US Virgin Islands"),"VI");for(let[s,i]of Object.entries(yt)){let r=g(s);r&&!n.has(r)&&n.set(r,i)}return n})(),lt=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 ft(n){return n.trim().toUpperCase()}function g(n){return Q(n)}var H=new Set(["country","countries","nation","nationality","iso","geo"]),U=new Set(["state","province","st"]),rt=new Set(["zip","zipcode","postal","postcode","plz"]),gt=new Set(["county","fips","borough","parish"]),ht=new Set(["city","cities","town","municipality","metro","location","place"]);function y(n,s){if(!n)return!1;for(let i of q(n))if(s.has(i))return!0;return!1}var Nt=95,At=5,Ct=6e4;function kt(n,s,i){if(!n||n.length===0)return null;let r=[],M=new Set;for(let t of n){if(t==null)continue;let e=String(t).trim();if(e.length===0||ot(g(e)))continue;let o=e.toLowerCase();if(!M.has(o)&&(M.add(o),r.push(e),r.length>Ct))return null}let h=r.length;if(h<2)return null;let N=r.map(ft),I=r.map(g),O=et(),d=0,p=0,m=0,T=0,D=0,l=0,_=0,x=0,Y=0,K=0,F=0,P=0,Z=t=>(L(t)??"").slice(0,3),$=0,J=0,E=0,X=y(s,rt);for(let t=0;t<h;++t){let e=N[t],o=I[t],u=r[t],S=tt.has(e),C=ct.has(e);nt.has(e)&&d++,S&&p++,C&&m++,S&&C&&$++;let G=O.has(o),R=ut.has(o);G&&T++,R&&D++,G&&R&&J++,W(u)&&K++,C&&R&&E++,/^\d{5}(-\d{4})?$/.test(u)||X&&/^\d{3,4}$/.test(u)?(l++,w.has(Z(u))&&P++):/^\d{4}$/.test(u)&&F++,/^\d{5}$/.test(u)&<.has(u.slice(0,2))&&_++,V(o)&&x++,V(o,"world")&&Y++}if(!X&&l>0){l+=F;for(let t of r)/^\d{4}$/.test(t)&&w.has(Z(t))&&P++}let B=t=>t/h*100,A=[],c=(t,e,o,u=!1)=>{let S=B(e),C=t==="city-name"||t==="city-name-world";S<(C?it:Nt)||e<2||u&&e<At&&!y(s,t==="country-name"?H:C?ht:U)||A.push({kind:t,matched:e,spec:o,pct:S})};c("country-iso3",d,6),c("country-name",T,5,!0),c("us-state-name",D,5,!0),c("us-zip5",l,4),c("us-county-fips",_,4),c("country-iso2",p,3),c("us-state-code",m,3);let dt=A.length;c("city-name",x,2,!0),A.length===dt&&c("city-name-world",Y,2,!0);let pt=m-E,mt=D-E;pt>0&&mt>0&&c("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";c(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],z=!1,v={"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],k=A[1],j=v&&k&&k.kind===v&&Math.abs(a.pct-k.pct)<=15;if(a.kind==="country-iso2"||a.kind==="us-state-code"){let t=a.matched>0?$/a.matched:0,e=y(s,H),o=y(s,U);if(j||t>=.5){if(e&&!o)return f("country-iso2",p,!1);if(o&&!e)return f("us-state-code",m,!1);z=!0}}else if(a.kind==="us-zip5"||a.kind==="us-county-fips"){let t=_===l&&l===h,e=y(s,rt),o=y(s,gt);return o&&!e?f("us-county-fips",_,!1):e&&!o?f("us-zip5",l,!1):t?f("us-zip5",l,!0):f("us-zip5",l,!1)}else if(j&&(a.kind==="country-name"||a.kind==="us-state-name")){let t=a.matched>0?J/a.matched:0,e=y(s,H),o=y(s,U);if(e&&!o)return f("country-name",T,!1);if(o&&!e)return f("us-state-name",D,!1);t>=.5&&(z=!0)}return f(a.kind,a.matched,z);function f(t,e,o){let S={geoKind:t,geoMatchPct:Math.round(B(t==="us-zip5"?P:e)*10)/10};return o&&(S.geoAmbiguous=!0),S}}function Mt(n,s){if(n==null)return null;let i=String(n).trim();if(i.length===0)return null;switch(s){case"country-iso3":case"country-iso2":case"country-name":return W(i);case"us-state-code":case"us-state-name":{let r=ft(i);return ct.has(r)?r:ut.get(g(i))??null}case"us-zip5":return L(i);case"us-county-fips":return/^\d{5}$/.test(i)&<.has(i.slice(0,2))?i:null;default:return null}}function Gt(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 It(n,s){return s==="us-zip5"?w.has(n.slice(0,3)):!0}function Wt(n,s){let i=new Array(n.length),r=new Set,M=[],h=0;for(let N=0;N<n.length;++N){let I=Mt(n[N],s),O=I!==null&&It(I,s)?I:null;if(i[N]=O,O!==null)h++;else{let d=n[N];if(d!=null){let p=String(d).trim();if(p.length>0){let m=p.toLowerCase();r.has(m)||(r.add(m),M.push(p))}}}}return{iso:i,unmatched:M,matchedRows:h,totalRows:n.length}}export{rt as a,y as b,kt as c,Mt as d,Gt as e,Wt as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{H as D,O as E}from"./chunk-
|
|
2
|
+
import{H as D,O as E}from"./chunk-KKSQBV76.mjs";import{y as S}from"./chunk-NFSQ4O5R.mjs";import P from"papaparse";function L(e){if(!e)return".";try{return new Intl.NumberFormat(e).formatToParts(1.5).find(t=>t.type==="decimal")?.value===","?",":"."}catch{return"."}}var x="[ \\u00A0\\u202F]",p="(?:[eE][+-]?\\d+)?",O=new RegExp(`^[+-]?(?:\\d{1,3}(?:,\\d{3})+|\\d+)(?:\\.\\d+)?${p}$`),k=new RegExp(`^[+-]?(?:\\d{1,3}(?:\\.\\d{3})+|\\d{1,3}(?:${x}\\d{3})+|\\d+)(?:,\\d+)?${p}$`),N=/^[+-]?\d{1,3}[.,]\d{3}$/,_=[/^[+-]?\d{1,3}(?:,\d{3}){2,}$/,new RegExp(`^[+-]?(?:\\d{1,3}(?:,\\d{3})+|\\d+)\\.\\d+${p}$`)],j=[/^[+-]?\d{1,3}(?:\.\d{3}){2,}$/,new RegExp(`^[+-]?(?:\\d{1,3}(?:\\.\\d{3})+|\\d{1,3}(?:${x}\\d{3})+|\\d+),\\d+${p}$`)];function T(e,i){let t=0,n=0;for(let c of e){if(typeof c!="string")continue;let o=c.trim();o===""||N.test(o)||(_.some(s=>s.test(o))?t++:j.some(s=>s.test(o))&&n++)}return n>0&&t===0?",":t>0?".":L(i)}function y(e,i){let t=String(e??"").trim();return t===""?null:i===","?k.test(t)?parseFloat(t.replace(/[. ]/g,"").replace(",",".")):null:O.test(t)?parseFloat(t.replace(/,/g,"")):null}function R(e,i){return y(e,i)!==null}var C=500,M=/^[+-]?\d{1,15}$/,q=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,F=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function V(e,i="."){let t=0,n=0,c=0,o=0;for(let s of e){if(s==null)continue;if(typeof s=="number"){o++,n++,Number.isInteger(s)&&t++;continue}if(s instanceof Date){o++,c++;continue}if(typeof s=="boolean"){o++;continue}let l=String(s).trim();if(l!==""){if(o++,M.test(l)){t++,n++;continue}if(R(l,i)){n++;continue}if((q.test(l)||F.test(l))&&!isNaN(Date.parse(l))){c++;continue}}}return o===0?"String":c===o?"DateTime":t===o?"Integer":n===o?"Decimal":"String"}function v(e,i,t="."){if(e==null)return null;if(typeof e=="number")return i==="String"?String(e):e;if(e instanceof Date)return i==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let n=String(e).trim();if(n==="")return null;switch(i){case"Integer":return M.test(n)?parseInt(n,10):null;case"Decimal":return y(n,t);case"DateTime":return S(n);default:return n}}function B(e){let i=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(i)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(i)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(i)?"DateTime":(/^(bit|bool|boolean)$/.test(i),"String")}function f(e,i,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 n=e.length,c=e.map((r,a)=>i.slice(0,C).map(m=>m?.[a])),o=c.map(r=>T(r,t.locale)),s=e.map((r,a)=>r.dataType??V(c[a],o[a])),l=new Set((t.measures??[]).map(r=>r.toLowerCase())),A=new Set((t.dimensions??[]).map(r=>r.toLowerCase())),I=new Set((t.nonAdditive??[]).map(r=>r.toLowerCase())),$=e.map((r,a)=>{let m=r.name.toLowerCase(),u=r.isMeasure??((s[a]==="Integer"||s[a]==="Decimal")&&!D(r.name));l.has(m)&&(u=!0),A.has(m)&&(u=!1);let b={name:r.name,dataType:s[a],isMeasure:u};return u&&I.has(m)&&(b.discourageAggregationAcrossGroups=!0),b}),d=new E;d.dedupRows=t.dedup!==!1,d.setColumns($);for(let r=0;r<i.length;r++){let a=i[r];d.addRow(Array.from({length:n},(m,u)=>v(a?.[u],s[u],o[u])),r)}let w=d.getColumnsWithStats(t.privacyLevel??"20",t.locale??"en"),g=new Map(w.map(r=>[r.name,r]));e.forEach(r=>{let a=g.get(r.name);a&&(r.format&&(a.modelFormat=r.format),r.description&&(a.modelDesc=r.description))});for(let[r,a]of Object.entries(t.formats??{})){let m=g.get(r);m&&(m.modelFormat=a)}for(let[r,a]of Object.entries(t.descriptions??{})){let m=g.get(r);m&&(m.modelDesc=a)}for(let r of t.groupBy??[]){let a=g.get(r);a&&(a.isGrouping=!0)}return{columns:w,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function h(e,i){return e.map(t=>Array.isArray(t)?t:i.map(n=>t[n]))}function U(e,i){let t=[],n=new Set,c=Math.min(e.length,Math.max(1,i));for(let o=0;o<c;o++){let s=e[o];if(!(!s||typeof s!="object"))for(let l of Object.keys(s))n.has(l)||(n.add(l),t.push(l))}return t}function Y(e,i={}){switch(e.kind){case"csv":{let t=P.parse(e.text,{skipEmptyLines:!0});if(t.errors?.length&&t.data.length===0)throw new Error(`ingest: CSV parse failed - ${t.errors[0].message}`);let n=t.data;if(n.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let c=n[0].map(o=>(o??"").trim());return f(c.map(o=>({name:o})),n.slice(1),i)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return f(e.header.map(t=>({name:(t??"").trim()})),e.rows??[],i)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let t=e.columns.map(n=>n.name);return f(e.columns,h(e.rows??[],t),i)}case"objects":{let t=e.rows??[],n=e.columns?.length?e.columns:U(t,i.columnScanLimit??C).map(c=>({name:c}));if(!n.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return f(n,h(t,n.map(c=>c.name)),i)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let t=e.schema.map(n=>{let c=B(n.dataType);return{name:n.name,dataType:c,isMeasure:n.isMeasure,format:n.format,description:n.description}});return f(t,h(e.rows??[],t.map(n=>n.name)),i)}default:{let t=e;throw new Error(`ingest: unknown source kind '${t?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{L as a,T as b,y as c,B as d,Y as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{
|
|
2
|
+
import{u as c}from"./chunk-NFSQ4O5R.mjs";import{gzip as h}from"pako";var w=e=>h(e);function P(e){return x(w(JSON.stringify(e))).replace(/\//g,".")}function x(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}function T(e){if(typeof e!="string"||e==="")throw new TypeError("keyedSigner needs the host's signing key");return{sign:t=>String(c(t+e))}}function W(e,t){let n=t.sign(e);if(typeof n!="string"||n.trim()==="")throw new TypeError("the host's signer returned a blank signature");return n}function u(e,t){if(e==null||typeof e!="object")return;let n=e,r=n[t];return r??n[t.charAt(0).toUpperCase()+t.slice(1)]}function m(e){return String(e??"").toLowerCase().includes("ndjson")}function C(e){let t=null;try{t=e.headers?.get?.("content-type")??null}catch{t=null}return{status:typeof e.status=="number"?e.status:0,contentType:t,body:e.body??null,text:()=>e.text()}}function S(e,t,n){let r=e.trim();if(!r)return{result:null,typed:!1,parsed:!1};let i;try{i=JSON.parse(r)}catch{return{result:null,typed:!1,parsed:!1}}return f(i,t,n)}function f(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return{result:null,typed:!1,parsed:!0};let r=u(e,"type");if(r!=null){if(r==="progress"){let s=String(u(e,"stage")??"").trim();return s&&t?.(s),{result:null,typed:!0,parsed:!0}}if(r==="result"){let s=u(e,"result");return{result:s&&typeof s=="object"?s:null,typed:!0,parsed:!0}}return{result:null,typed:!0,parsed:!0}}return n?{result:u(e,"code")!==void 0||u(e,"errorMessage")!==void 0?e:null,typed:!1,parsed:!0}:{result:e,typed:!1,parsed:!0}}var a=class{constructor(t){this.onStage=t}onStage;result=null;anyParsed=!1;take(t){let n=S(t,this.onStage,!0);n.parsed&&(this.anyParsed=!0),n.result&&(n.typed||this.result===null)&&(this.result=n.result)}};function d(){return new Error("the generate response ended without a result")}async function R(e,t){let n=e.body;if(!n||typeof n.getReader!="function")return p(await e.text(),t,null);let r=n.getReader(),i=new TextDecoder,s=new a(t),o="";try{for(;;){let{done:y,value:g}=await r.read();if(y)break;o+=i.decode(g,{stream:!0});let l;for(;(l=o.indexOf(`
|
|
3
3
|
`))>=0;)s.take(o.slice(0,l)),o=o.slice(l+1)}}finally{try{r.releaseLock?.()}catch{}}if(o+=i.decode(),s.take(o),!s.result)throw d();return s.result}function p(e,t,n){let r=new a(t);for(let i of e.split(`
|
|
4
4
|
`))r.take(i);if(r.result)return r.result;throw!r.anyParsed&&n?n:d()}async function b(e,t){let n=await e.text(),r;try{r=JSON.parse(n)}catch(s){return p(n,t,s)}if(!r||typeof r!="object"||Array.isArray(r))throw new SyntaxError("the generate response was JSON but not a result object");let i=f(r,t,!1);if(i.result)return i.result;throw d()}async function N(e,t){return m(e.contentType)?R(e,t):b(e,t)}export{w as a,P as b,T as c,W as d,u as e,m as f,C as g,N as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a as re}from"./chunk-QEH7WTLB.mjs";import{a as se,b as oe}from"./chunk-2LR73DNS.mjs";import{c as Ne}from"./chunk-C5I73OM2.mjs";import{b as Re,f as Te}from"./chunk-TPVDJHU6.mjs";import{a as Me,b as xe,c as ie}from"./chunk-35Z7JCND.mjs";import{e as ye,f as Z,p as Se,q as Y,r as _e,s as Ae,v as ce,x as Ce}from"./chunk-ILHBRGIO.mjs";var st=[[24.4,49.4,-125,-66.9],[51.2,71.5,-168,-129.9],[18.9,22.3,-160.3,-154.8]],ot=[7,72,-172,-52];function Ee(t,e,n){return t>=n[0]&&t<=n[1]&&e>=n[2]&&e<=n[3]}var X=t=>Math.round(t*10)/10;function Ie(t,e=3){let n=[],r=[],i=0,s=0;for(let l of t){let u=l?.lat,c=l?.lon;if(typeof u!="number"||typeof c!="number"||!isFinite(u)||!isFinite(c)||u<-90||u>90||c<-180||c>180)continue;n.push(u),r.push(c);let d=l?.country?String(l.country).trim().toUpperCase():"",f=d?ae(d):null;f?((d==="US"||d==="USA")&&i++,f==="north-america"&&s++):(st.some(m=>Ee(u,c,m))&&i++,Ee(u,c,ot)&&s++)}let o=n.length;return o<e?null:(n.sort((l,u)=>l-u),r.sort((l,u)=>l-u),{pctUsa:X(i/o*100),pctNa:X(s/o*100),latP5:X(Y(n,.05)),latP95:X(Y(n,.95)),lonP5:X(Y(r,.05)),lonP95:X(Y(r,.95)),n:o})}var ve={"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"},J=(()=>{let t=new Map;for(let e of Object.keys(ve))for(let n of ve[e].split(/\s+/))n&&t.set(n,e);return t})();function at(t){for(let[e,n]of t){let r=J.get(e);r&&!J.has(n)&&J.set(n,r)}}at(Re);function ae(t){if(!t)return null;let e=String(t).trim().toUpperCase();if(!e)return null;let n=J.get(e);if(n)return n;let r=Te(String(t));return r?J.get(r)??null:null}function Nn(t,e=2){return me(t.map(n=>[n,1]),e)}function me(t,e=2){let n=new Map,r=0;for(let[o,l]of t){let u=ae(o);if(!u)continue;let c=typeof l=="number"&&isFinite(l)&&l>0?l:1;n.set(u,(n.get(u)??0)+c),r+=c}if(r<e||!n.size)return null;let i="europe",s=-1;for(let o of Array.from(n.keys()).sort()){let l=n.get(o);l>s&&(i=o,s=l)}return{dominantGeoRegion:i,dominantGeoRegionPct:X(s/r*100),regionCount:n.size,n:r}}import et from"papaparse";var ut=[["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 ue(t){for(let[e,n]of ut)if(n.test(t))return e;return null}var lt=[{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]]}],le=new Map;function we(t,e,n,r){let i=le.get(t);if(i)return i;let s=[];for(let[o,l]of e)for(let u=o;u<=l;u++){let c=String.fromCodePoint(u);ue(c)===n&&(r&&!r.test(c)||s.push(c))}return le.set(t,s),s}function ct(t){let n=t.codePointAt(0);for(let o=0;o<9&&ue(String.fromCodePoint(n-1))==="Nd";o++)n--;let r="nd:"+n.toString(16),i=le.get(r);if(i)return i;let s=[];for(let o=n;o<n+10;o++){let l=String.fromCodePoint(o);ue(l)==="Nd"&&s.push(l)}return le.set(r,s),s}function mt(t,e){if(e==="Nd")return ct(t);for(let i of lt)if(i.test.test(t))return we(i.id+":"+e,i.ranges,e,i.id==="ascii"?null:i.test);let r=t.codePointAt(0)&-128;return we("block:"+r.toString(16)+":"+e,[[r,r+127]],e,null)}function dt(t,e,n,r){let i=t.filter(s=>!e.has(s));return i.length===0&&(i=t.filter(s=>s!==n)),i.length===0?n:i[Math.min(i.length-1,Math.floor(r()*i.length))]}var ft=/^[\p{L}\p{M}\p{Nd}]$/u,Le=/^[\p{L}\p{Nd}]$/u;function De(t,e){if(!t)return t??"";let n=new Set(Array.from(t)),r=d=>{let f=ue(d);return!f||!ft.test(d)?d:dt(mt(d,f),n,d,e)},i=d=>{let f=[];for(let m of d)f.push(r(m)),Le.test(m)&&e()<.2&&f.push(r(m));if(f.length>6){let m=Math.floor(e()*Math.min(3,f.length-6));for(let R=0;R<m;R++)for(let A=0;A<5;A++){let O=Math.floor(e()*f.length);if(Le.test(f[O])){f.splice(O,1);break}}}return f.join("")};if(!(t.includes("@")&&t.includes(".")))return i(t);let[o,l=""]=t.split("@"),u=l.endsWith(".com"),c=u?l.slice(0,-4):l;return`${i(o)}@${i(c)}${u?".com":""}`}var gt=["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","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"],pt=["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"],ht=["latitude","longitude"],bt=["latitude","longitude"];function j(t){return ye(t)}var de=["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"],Pe=["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"];function yt(t){return[...t].sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var ke=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+yt(de)+")\\s+)","i"),St=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,_t=new RegExp("\\b("+gt.join("|")+")\\b|("+pt.join("|")+")$","i"),At=new RegExp("\\b("+ht.join("|")+")\\b|("+bt.join("|")+")$","i");function Fe(t){if(!t)return"";let e=String(t),n=ke.exec(j(e));return(n?e.slice(n[0].length):e).trim()}function Ct(t){return!!t&&ke.test(j(String(t)))}var Mt=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],Oe=new RegExp("^\\s*("+[...Mt].sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Ge(t){if(t==null)return"";let e=String(t),n=Oe.exec(e);if(!n)return e;let r=l=>l.toLowerCase().replace(/\s+/g," ").trim(),i=r(n[1]),s=e.slice(n[0].length),o=0;for(;o<8;){let l=Oe.exec(s);if(!l||r(l[1])!==i)break;let u=s.slice(l[0].length);if(u.trim()==="")break;s=u,o++}return o===0?e:e.slice(0,n[0].length)+s}function fe(t,e){if(!t||!e)return!1;let n=String(t);for(let r of e){let i=r?.hostName;if(i&&i!==r?.name&&n.includes(i))return!0}return!1}var We={Sum:["Sum of "],Avg:["Average of "],Average:["Average of "],Count:["Count of "],CountNonNull:["Count of "],Min:["Min of ","First ","Earliest "],Max:["Max of ","Last ","Latest "],Median:["Median of "],StandardDeviation:["Standard deviation of "],Variance:["Variance of "]},xt=new RegExp("^("+Object.keys(We).join("|")+")\\((.+)\\)$");function Be(t){if(!t)return[];let e=xt.exec(String(t).trim());if(!e)return[];let n=We[e[1]],r=e[2],i=[];for(let s=r.indexOf(".");s>=0;s=r.indexOf(".",s+1)){if(s===0)continue;let o=r.slice(s+1);if(o.trim()!=="")for(let l of n){let u=l+o;i.includes(u)||i.push(u)}}return i}function Rt(t){let e=Fe(t);return e.length===0?"":e.replace(St," ")}function ze(t,e){if(!e)return!1;let n=Fe(e);return t.test(j(Rt(e)))||t.test(j(n))||t.test(j(Z(n).join(" ")))}function $e(t){return ze(At,t)}function Tt(t){return ze(_t,t)||$e(t)}var Ue=/int|double|decimal|single|float|number|currency|money/i;function Nt(t){let e=String(t?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||t?.isMeasure===!0||Ue.test(String(t?.dataType??""))?"Continuous":"Categorical"}function Et(t){return t?.isMeasure===!0||Ue.test(String(t?.dataType??""))}function Ve(t){let e=t??{},n=Nt(e);if(n!=="Continuous")return{nature:n,additivity:"unknown",basis:"role",suppressed:!1};if($e(e.name))return{nature:n,additivity:"positional",basis:"name",suppressed:!0};let r=String(e.additivity??"").trim().toLowerCase();if(!(r==="additive"&&Ct(e.name))){if(r==="additive")return{nature:n,additivity:"additive",basis:"measured",suppressed:!1};if(r==="part_of_whole")return{nature:n,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(r==="intensive_rate")return{nature:n,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:n,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Tt(e.name)?{nature:n,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:n,additivity:"additive",basis:"default",suppressed:!1}}function Ke(t){let e=Ve(t),n=t??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return Et(n)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function Ln(t){return Ke(t)[0]}function Dn(t,e){return Ke(t).indexOf(e)>=0}function On(t,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let n=Ve(t);return n.additivity==="additive"||n.additivity==="part_of_whole"||n.additivity==="unknown"}var vt=/^[A-Za-z_$][A-Za-z0-9_$]*$/,It=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),wt=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 ee(t,e){if(!t||!e)return!1;let n=It(e);return new RegExp("['\"`]"+n+"['\"`]").test(t)?!0:vt.test(e)&&new RegExp("\\."+n+"(?![A-Za-z0-9_$])").test(t)}function Lt(t){return!!t&&wt.test(t)}function kn(t,e,n){return t?Lt(t)?[...e]:[...n,...e].some(r=>ee(t,r))?e.filter(r=>ee(t,r)):[...e]:[]}var Dt=5,Ot=6,Pt=3,Q=864e5,kt=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Ft=/^(\d{4})[-/](\d{1,2})$/,Gt=/^(\d{4})[-\s]?Q([1-4])$/i,Wt=/^Q([1-4])[-\s](\d{4})$/i,Bt=/^(\d{4})$/,zt=/^(\d{4})(0[1-9]|1[0-2])$/,$t=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,Ut=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,Vt=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Ye(t,e){let n=se(t);if(!n)return 0;if(n==="sept")return 9;for(let r of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let i=oe(r)[n];if(i!==void 0)return i+1}return 0}function K(t,e,n,r=0,i=0,s=0){if(!(t>=1&&e>=1&&e<=12&&n>=1&&n<=31))return null;let o=Date.UTC(t,e-1,n,r,i,s);if(!Number.isFinite(o))return null;let l=u=>u<10?"0"+u:String(u);return{ms:o,y:t,m:e,d:n,iso:`${t}-${l(e)}-${l(n)}`}}function Kt(t,e){let n=[],r="";for(let u=0;u<e.length;u++){if(e[u]!=="%"){r+=e[u].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++u]){case"Y":n.push("Y"),r+="(\\d{4})";break;case"m":n.push("m"),r+="(\\d{1,2})";break;case"d":n.push("d"),r+="(\\d{1,2})";break;case"H":case"M":case"S":r+="\\d{1,2}";break;case"%":r+="%";break;default:return null}}let i=new RegExp("^"+r+"$").exec(t);if(!i)return null;let s=0,o=1,l=1;return n.forEach((u,c)=>{let d=+i[c+1];u==="Y"?s=d:u==="m"?o=d:l=d}),s?K(s,o,l):null}function ge(t,e,n){let r=(t??"").trim();if(r==="")return null;if(e){let s=Kt(r,e);return s||null}let i=kt.exec(r);if(i)return K(+i[1],+i[2],+i[3],+(i[4]??0),+(i[5]??0),+(i[6]??0));if(i=Gt.exec(r),i)return K(+i[1],(+i[2]-1)*3+1,1);if(i=Wt.exec(r),i)return K(+i[2],(+i[1]-1)*3+1,1);if(i=Ft.exec(r),i&&+i[2]>=1&&+i[2]<=12)return K(+i[1],+i[2],1);if(i=$t.exec(r),i)return K(+i[1],+i[2],+i[3]);if(i=zt.exec(r),i)return K(+i[1],+i[2],1);if(i=Bt.exec(r),i){let s=+i[1];return s>=1900&&s<=2100?K(s,1,1):null}if(i=Ut.exec(r),i){let s=Ye(i[1],n);return s?K(+i[2],s,1):null}if(i=Vt.exec(r),i){let s=Ye(i[2],n);return s?K(+i[1],s,1):null}return null}function He(t){let e=new Date(t).getUTCDay();return e>=1&&e<=5}function Ze(t,e){if(e<=t)return 0;let n=Math.round((e-t)/Q),r=Math.floor(n/7),i=r*5,s=t+r*7*Q;for(;s<e;)He(s)&&i++,s+=Q;return i}function Yt(t){if(t.length===0)return 0;let e=[...t].sort((r,i)=>r-i),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function Ht(t){return t>0?t<.95?"hour":t<=1.05?"day":t>=6.5&&t<=7.5?"week":t>=27&&t<=31.5?"month":t>=88&&t<=93?"quarter":t>=362&&t<=368?"year":"irregular":"irregular"}function te(t,e,n,r){switch(n){case"year":return e.y-t.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(t.y*4+Math.floor((t.m-1)/3));case"month":return e.y*12+e.m-(t.y*12+t.m);case"week":return Math.round((e.ms-t.ms)/(7*Q));case"weekday":return Ze(t.ms,e.ms);case"day":return Math.round((e.ms-t.ms)/Q);default:return r>0?Math.round((e.ms-t.ms)/r):0}}function Xe(t,e){return pe(t,e)?.cadence??null}function pe(t,e){let n=e?.gapFactor??Dt,r=0,i=0,s=new Map;for(let h of t){if(h==null||h==="")continue;r++;let W=ge(String(h),e?.pattern,e?.locale);W&&(i++,s.set(W.ms,W))}let o=[...s.values()].sort((h,W)=>h.ms-W.ms);if(o.length<Pt||r>0&&i/r<.8)return null;let l=o[o.length-1].ms-o[0].ms;if(l<=0)return null;let u=[];for(let h=1;h<o.length;h++)u.push(o[h].ms-o[h-1].ms);let c=Yt(u);if(!(c>0))return null;let d=Ht(c/Q);d==="day"&&l>=7*Q&&o.every(h=>He(h.ms))&&Ze(o[0].ms,o[o.length-1].ms)+1>o.length*.5&&(d="weekday");let f=d==="irregular"?o.length:te(o[0],o[o.length-1],d,c)+1,m=1,R=1,A=[],O=o[0],S=1;for(let h=1;h<o.length;h++){let W=te(o[h-1],o[h],d,c);W>m&&(m=W),d!=="irregular"&&W>n?(R++,A.push({from:O.iso,to:o[h-1].iso,points:S}),O=o[h],S=1):S++}A.push({from:O.iso,to:o[o.length-1].iso,points:S});let w={grain:d,points:o.length,expectedPoints:Math.max(f,o.length),coveragePct:Math.round(o.length/Math.max(f,o.length)*1e3)/10,runs:R,largestGapUnits:m,gapFactor:n};return e?.includeBounds&&A.length<=Ot&&(w.runBounds=A),{cadence:w,points:o,stepMs:c}}var Zt=8,Xt=.5,jt=200,Qt=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"]),qt=["category","classification","segment","status","priority","severity","channel"],Jt=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function en(t){let e=Z(t);if(e.length===0)return!1;let n=e[e.length-1];return Qt.has(n)?!0:qt.some(r=>n.length>r.length&&n.endsWith(r))}function tn(t){if(t.isMeasure)return"measure";if(t.isTemporal||t.isDatePart||t.isReassembledDate)return"temporal";let e=Array.from(t.values).filter(n=>n!==""&&n!==null&&n!==void 0);return e.length<2||e.length>jt?"cardinality":t.rows>0&&e.length>=t.rows?"row-identity":t.isBinaryFlag?"flag":ie(e,t.locale)!==null?"ordinal":t.identifierNamed||t.dataType==="String"&&Jt.has(re(e))?"identifier":!t.geoKind&&en(t.name)?"attribute":"entity"}function qe(t){let e=-1,n=1/0,r=!1;return t.forEach((i,s)=>{if(tn(i)!=="entity")return;let o=new Set(Array.from(i.values).filter(u=>u!=="")).size,l=!!i.geoKind;(o<n||o===n&&l&&!r)&&(e=s,n=o,r=l)}),e}var je=t=>t<10?"0"+t:String(t);function Qe(t,e){switch(e){case"year":return`${t.y}-01-01`;case"quarter":return`${t.y}-${je(Math.floor((t.m-1)/3)*3+1)}-01`;case"month":return`${t.y}-${je(t.m)}-01`;case"hour":return new Date(t.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return t.iso}}function Je(t){let{periods:e,series:n}=t,r=Math.min(e.length,n.length),i=new Set;for(let v=0;v<r;v++)e[v]&&i.add(e[v]);let s=pe(i,{pattern:t.pattern,locale:t.locale});if(!s)return null;let o=s.cadence.grain;if(o==="irregular")return null;let l=s.points[0],u=te(l,s.points[s.points.length-1],o,s.stepMs)+1;if(u!==s.cadence.expectedPoints)return null;let c=new Map;for(let v of i){let b=ge(v,t.pattern,t.locale);if(!b)continue;let P=te(l,b,o,s.stepMs);P>=0&&P<u&&c.set(v,{idx:P,stamp:b})}let d=new Map;for(let v=0;v<r;v++){let b=n[v];if(!b)continue;let P=c.get(e[v]);if(!P)continue;let B=d.get(b);B||(B={seen:new Set,lo:P.idx,hi:P.idx,loStamp:P.stamp,hiStamp:P.stamp,order:d.size},d.set(b,B)),B.seen.add(P.idx),P.idx<B.lo&&(B.lo=P.idx,B.loStamp=P.stamp),P.idx>B.hi&&(B.hi=P.idx,B.hiStamp=P.stamp)}if(d.size<2)return null;let f=0;for(let v of d.values())f+=v.seen.size;if(f/(d.size*u)<(t.minFill??Xt))return null;let m=[],R=new Set,A=0,O=0,S=0,w=0,h=0,W=1;for(let[v,b]of d){for(let z of b.seen)R.add(z);if(b.seen.size>=u)continue;let P=[...b.seen].sort((z,a)=>z-a),B=1;for(let z=1;z<P.length;z++)B=Math.max(B,P[z]-P[z-1]);let H={key:v,acc:b,coverage:b.seen.size/u,before:b.lo,after:u-1-b.hi,interior:b.hi-b.lo+1-b.seen.size,gap:B};m.push(H),H.before>0&&A++,H.after>0&&O++,H.interior>0&&S++,w=Math.max(w,H.before),h=Math.max(h,H.after),W=Math.max(W,B)}if(m.length===0)return null;m.sort((v,b)=>v.coverage-b.coverage||v.acc.order-b.acc.order);let U=m.slice(0,t.maxListed??Zt);return{seriesColumn:t.seriesColumn,grain:o,periods:u,seriesCount:d.size,incompleteSeries:m.length,lateStarts:A,earlyEnds:O,withHoles:S,columnWideMissing:u-R.size,maxMissingBefore:w,maxMissingAfter:h,largestGap:W,series:U.map(v=>{let b={};return t.includeNames&&(b.name=v.key),t.includeDates&&(b.first=Qe(v.acc.loStamp,o),b.last=Qe(v.acc.hiStamp,o)),b.missingBefore=v.before,b.missingAfter=v.after,b.missingInterior=v.interior,b.largestGap=v.gap,b.coverage=Math.round(v.coverage*1e3)/1e3,b}),more:m.length-U.length}}var nn=12,rn=100,sn=.3,on=.9,an=120,un=1900,ln=2100,cn=0,mn=20,dn=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function it(t){if(!t)return!1;let e=Z(t);return e.length===0?!1:dn.has(e[e.length-1])}var fn=new Set(["year","yr","fy"]),gn=t=>Z(t).some(e=>fn.has(e)),pn=/^(?:(?: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 he(t){if(!Number.isInteger(t)||t<190001||t>210012)return!1;let e=t%100;return e>=1&&e<=12}function be(t){if(!Number.isInteger(t)||t<19000101||t>21001231)return!1;let e=Math.floor(t/100)%100,n=t%100;return e>=1&&e<=12&&n>=1&&n<=31}var hn=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,bn=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,yn=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Sn(t){let e=(t||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}function rt(t,e){let n=0,r=0,i=0,s=0,o=0,l="",u=0,c="",d=0,f=0,m=0,R=0,A=!1;for(let U of t){if(U==null)continue;let v=String(U).trim();if(v==="")continue;n++;let b;if(b=hn.exec(v)){let P=+b[2],B=+b[3];P>=1&&P<=12&&B>=1&&B<=31&&(r++,b[4]!==void 0&&i++,b[6]!==void 0&&s++)}else if(b=bn.exec(v)){let P=+b[3],B=+b[4];P>=1&&P<=12&&B>=1&&B<=31&&(l&&l!==b[2]&&(A=!0),l=b[2],o++)}else if(b=yn.exec(v)){let P=+b[1],B=+b[3];P>=1&&P<=31&&B>=1&&B<=31&&(P<=12||B<=12)&&(c&&c!==b[2]&&(A=!0),c=b[2],u++,P>12&&m++,B>12&&R++,b[5]!==void 0&&d++,b[7]!==void 0&&f++)}if(n>=200)break}if(n<2||(r+o+u)/n<.8||(r>0?1:0)+(o>0?1:0)+(u>0?1:0)!==1||A)return null;if(r>0)return i===r?{pattern:s===r?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(o>0)return{pattern:`%Y${l}%m${l}%d`,orderFrom:"iso"};if(m>0&&R>0)return null;let w,h;m>0?(w=!0,h="values"):R>0?(w=!1,h="values"):(w=!Sn(e),h="locale");let W=w?`%d${c}%m${c}%Y`:`%m${c}%d${c}%Y`;return d===u?{pattern:W+(f===u?" %H:%M:%S":" %H:%M"),orderFrom:h}:{pattern:W,orderFrom:h}}function _n(t,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(t))return!1;let n=t.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!n)return!1;let r=se(n);return r.length>0&&e[r]!==void 0}function An(t){let{dataType:e,name:n,isMeasure:r,distinctCount:i}=t;if(e==="DateTime")return!0;if(r)return!1;if(e==="Integer"||e==="Decimal"){let s=t.minNum,o=t.maxNum;if(!(s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&Number.isInteger(s)&&Number.isInteger(o)&&o>=s))return!1;let u=s>=1900&&o<=2100;if(u&&i>=2&&gn(n)||u&&i>=3&&i===o-s+1)return!0;let c=he(s)&&he(o),d=be(s)&&be(o);if(c||d){if(!t.sampleValues)return!0;let f=0,m=0;for(let R of t.sampleValues){if(R==null||R==="")continue;f++;let A=Number(String(R).trim());if(Number.isFinite(A)&&(c?he(A):be(A))&&m++,f>=60)break}if(f>=2&&m===f)return!0}return!1}if(t.sampleValues){let s=t.locale?oe(t.locale):null,o=0,l=0,u=[];for(let c of t.sampleValues){if(c==null||c==="")continue;o++;let d=String(c).trim();if(u.push(d),(pn.test(d)||_n(d,s))&&l++,o>=60)break}if(o>=2&&l/o>=.8||rt(u,t.locale)!==null)return!0}return!1}function Cn(t){let e=j((t||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":Pe.some(n=>e.startsWith(n+" "))?/^(minimum|minimo)\b/.test(e)?"min":/^(maximum|maximo|massimo)\b/.test(e)?"max":"avg":de.some(n=>e.startsWith(n+" ")||e===n)?/^(nombre|recuento|contagem|anzahl|aantal|conteggio|antal|lukumaara|pocet)\b/.test(e)?"count":"sum":null}function Mn(t){let{rows:e,measureColIdx:n,measureName:r,candidateDims:i,minNum:s,maxNum:o,discourageAgg:l}=t,u=100,c=.01,d="";for(let m of i){if(m.distinct<2||m.distinct>u)continue;let R=i.filter(h=>h.idx!==m.idx).map(h=>h.idx),A=new Map;for(let h of e){let W=h[n];if(typeof W!="number"||!Number.isFinite(W))continue;let U=R.length?R.map(b=>String(h[b])).join(d):"",v=A.get(U);v||(v={sum:0,cset:new Set},A.set(U,v)),v.sum+=W,v.cset.add(String(h[m.idx]))}let O=0,S=0,w=0;for(let h of A.values())h.cset.size<2||(w++,Math.abs(h.sum-100)<=100*c?O++:Math.abs(h.sum-1)<=1*c&&S++);if(w>=2&&(O/w>=.9||S/w>=.9))return{additivity:"part_of_whole",partOfWholeDim:m.name}}if(l)return{additivity:"intensive_rate"};let f=Cn(r);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 tt(t){let{dataType:e,isMeasure:n,name:r,distinct:i,nonblank:s,prec:o,maxval:l,minval:u}=t,c=l-u+1,d=c>0?i/c:1,f=s>0?i/s:0,m=e==="Decimal"||o>0;return it(r)?"Categorical":d>=on&&(Me(r)&&i<=an||u>=un&&l<=ln||u>=cn&&l<=mn)?"Ordinal":n||i>nn&&(m||i>=rn||f>=sn)?"Continuous":"Categorical"}function xn(t){let e=null;for(let n=0;n<t.length;n++){let r=t[n];if(typeof r!="string"||r.length===0)continue;let i=r.trim();i.length!==r.length&&(e||(e=t.slice()),e[n]=i)}return e||t}var nt=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;dedupRows=!0;emitLegacyAggAliases=!1;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 r=e.toString().split(".")[1];return r?r.length:0}getColumns(){return this._cols}wholeDayIso(e){return Ce(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,n){if(this._computedStatsForLevel==e)return this._cols;let r=0,i=parseInt(e),s=[];for(let a of this._cols){let p=new Map,D=[],N=0,g=0,T=0,I=null,E=null,x=null,F=!1,k=!0,C=!0,M=null,G=!1;for(let _ of this._rows){let y=_[r],L=this.STR(y);if(L!=""){if(N+=L.length,p.set(L,(p.get(L)||0)+1),g++,a.dataType=="Integer"||a.dataType=="Decimal"||a.dataType=="DateTime")if((I===null||y<I)&&(I=y),(E===null||y>E)&&(E=y),a.dataType=="Integer"||a.dataType=="Decimal"){if(x===null?x=y:x+=y,a.dataType=="Decimal"){let $=this.getPrecision(y);$>T&&(T=$)}D.push(y)}else F=F||this.hasTimeComponent(y);G&&(y<M?k=!1:y>M&&(C=!1)),M=y,G=!0}}if(g>=3&&(k&&!C?a.sortedDirection="asc":C&&!k?a.sortedDirection="desc":a.sortedDirection="none"),g>0&&p.size>0&&!a.isMeasure){let _=0,y=Number.MAX_SAFE_INTEGER;for(let L of p.values())L>_&&(_=L),L<y&&(y=L);if(a.modalShare=_/g,a.minGroupCount=y===Number.MAX_SAFE_INTEGER?null:y,p.size===2){let L=[...p.keys()].map(ne=>Se(ne).trim().toLowerCase()).sort(),V=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ne=>L[0]===ne[0]&&L[1]===ne[1]),q=/^(is|has)[_a-z0-9]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/i.test(a.name);(V||q)&&(a.isBinaryFlag=!0)}}if(a.dataType=="DateTime"&&(a.dateWithTime=F),a.isTemporal=An({dataType:a.dataType,name:a.name,isMeasure:a.isMeasure,distinctCount:p.size,minNum:typeof I=="number"?I:null,maxNum:typeof E=="number"?E:null,sampleValues:p.keys(),locale:n}),a.isTemporal&&a.dataType==="String"&&!a.isMeasure){let _=rt(p.keys(),n);_&&(a.temporalTextPattern=_.pattern)}if(a.isTemporal&&!a.isMeasure){let _=Xe(p.keys(),{includeBounds:i>=20,pattern:a.temporalTextPattern,locale:n});_&&(a.temporalCadence=_)}this.updateColumnStats10(i,a,g,p,T,E,I),this.updateColumnStats20(i,D,g,x,a,N,F,I,E,T,p,n),!a.isMeasure&&(a.dataType==="Integer"||a.dataType==="Decimal")&&tt({dataType:a.dataType,isMeasure:!1,name:a.name,distinct:p.size,nonblank:g,prec:T,maxval:typeof E=="number"?E:0,minval:typeof I=="number"?I:0})==="Continuous"&&(a.isMeasure=!0,a.geoKind=void 0,a.geoMatchPct=void 0,a.geoAmbiguous=void 0,a.dominantGeoRegion=void 0,a.dominantGeoRegionPct=void 0,a.geoRegionCount=void 0),s[r]=a.isMeasure||p.size>2e3?null:new Set(p.keys()),r++}let o=[];this._cols.forEach((a,p)=>{a.isMeasure||o.push({idx:p,distinct:a.distinctCount??0,name:a.name})}),this._cols.forEach((a,p)=>{if(!a.isMeasure)return;let D=typeof a.lowValue=="number"?a.lowValue:null,N=typeof a.highValue=="number"?a.highValue:null,g=Mn({rows:this._rows,measureColIdx:p,measureName:a.name,candidateDims:o,minNum:D,maxNum:N,discourageAgg:!!a.discourageAggregationAcrossGroups});a.additivity=g.additivity,g.partOfWholeDim&&(a.partOfWholeDim=g.partOfWholeDim)});let l=50,u=4,c=o.filter(a=>a.distinct>=2&&a.distinct<=l);this._cols.forEach((a,p)=>{if(!a.isMeasure)return;let D=[];for(let C of this._rows){let M=C[p];if(M==null||M==="")continue;let G=typeof M=="number"?M:parseFloat(M);isNaN(G)||D.push(G)}if(D.length===0)return;let N=[...D].sort((C,M)=>C-M);if(N[0]===N[N.length-1])a.relativeDispersion=0;else if(N.length>=u){let C=Y(N,.5),M=Y(N,.1),G=Y(N,.9);a.relativeDispersion=Math.abs(C)>1e-9?Math.round((G-M)/Math.abs(C)*1e3)/1e3:void 0}else a.relativeDispersion=void 0;let g=[];for(let C of c){let M=new Set;for(let G of this._rows){let _=G[p];_==null||_===""||M.add(this.STR(G[C.idx])+"")}g.push({otherColumn:C.name,nonBlankGroupCount:M.size})}g.length>0&&(a.nonBlankGroups=g);let T=0;for(let C of D)T+=C;T/=D.length;let I=0;for(let C of D)I+=(C-T)*(C-T);if(I<=1e-12)return;let E=[],x=[],F=C=>{if(C.length<4)return NaN;let M=[...C].sort((_,y)=>_-y),G=_=>M[Math.min(M.length-1,Math.max(0,Math.floor(_*(M.length-1))))];return G(.75)-G(.25)},k=F(D);for(let C of c){let M=new Map;for(let y of this._rows){let L=y[p];if(L==null||L==="")continue;let $=typeof L=="number"?L:parseFloat(L);if(isNaN($))continue;let V=this.STR(y[C.idx])+"",q=M.get(V);q?(q.s+=$,q.n++,q.vals.push($)):M.set(V,{s:$,n:1,vals:[$]})}let G=0;for(let y of M.values()){let L=y.s/y.n;G+=y.n*(L-T)*(L-T)}E.push({otherColumn:C.name,eta2:Math.round(G/I*1e4)/1e4});let _=[];for(let y of M.values()){let L=F(y.vals);isNaN(L)||_.push(L)}if(_.length>=2&&isFinite(k)&&k>1e-9){let y=(Math.max(..._)-Math.min(..._))/k;x.push({otherColumn:C.name,spreadRatio:Math.round(y*1e4)/1e4})}}E.length>0&&(a.groupDiscrimination=E),x.length>0&&(a.spreadDiscrimination=x)});let d=.97,f=.8,m=8,R=5,A=this._cols.map((a,p)=>({c:a,i:p})).filter(a=>a.c.isMeasure);for(let a=0;a<A.length;a++)for(let p=a+1;p<A.length;p++){let D=A[a].i,N=A[p].i,g=0,T=0,I=0,E=0,x=0,F=0;for(let _ of this._rows){let y=_[D],L=_[N];if(y==null||y===""||L===null||L===void 0||L==="")continue;let $=typeof y=="number"?y:parseFloat(y),V=typeof L=="number"?L:parseFloat(L);isNaN($)||isNaN(V)||(g++,T+=$,I+=V,E+=$*$,x+=V*V,F+=$*V)}if(g<R)continue;let k=g*E-T*T,C=g*x-I*I;if(k<=1e-12||C<=1e-12)continue;let M=(g*F-T*I)/Math.sqrt(k*C),G=Math.min(1,Math.round(Math.abs(M)*1e3)/1e3);for(let _ of[A[a].c,A[p].c])(_.maxAbsMeasureCorrelation===void 0||G>_.maxAbsMeasureCorrelation)&&(_.maxAbsMeasureCorrelation=G);if(Math.abs(M)>=d){let _=A[a].c,y=A[p].c;_.collinearWithMeasures||(_.collinearWithMeasures=[]),y.collinearWithMeasures||(y.collinearWithMeasures=[]),_.collinearWithMeasures.push(y.name),y.collinearWithMeasures.push(_.name)}else if(Math.abs(M)>=f){let _=A[a].c,y=A[p].c,L=Math.round(M*1e3)/1e3;_.correlatedWithMeasures||(_.correlatedWithMeasures=[]),y.correlatedWithMeasures||(y.correlatedWithMeasures=[]),_.correlatedWithMeasures.push({otherColumn:y.name,r:L}),y.correlatedWithMeasures.push({otherColumn:_.name,r:L})}}for(let{c:a}of A)a.correlatedWithMeasures&&(a.correlatedWithMeasures.sort((p,D)=>Math.abs(D.r)-Math.abs(p.r)||(p.otherColumn<D.otherColumn?-1:1)),a.correlatedWithMeasures.length=Math.min(a.correlatedWithMeasures.length,m));for(let a=0;a<this._cols.length;a++){let p=s[a];if(!p||p.size===0)continue;let D=[];for(let N=0;N<this._cols.length;N++){if(N===a)continue;let g=s[N];if(!g||g.size===0)continue;let T=0;for(let E of p)g.has(E)&&T++;let I=Math.round(T/p.size*100);I>0&&D.push({otherColumn:this._cols[N].name,percentShared:I})}D.length>0&&(this._cols[a].sharedValueRatioWithOthers=D)}let O=50,S=[];for(let a=0;a<this._cols.length;a++){let p=s[a];p&&p.size>=2&&p.size<=O&&S.push(a)}if(S.length>=2){let a=new Map,p=(N,g)=>N+":"+g;for(let N=0;N<S.length;N++)for(let g=N+1;g<S.length;g++)a.set(p(S[N],S[g]),new Map);for(let N of this._rows)for(let g=0;g<S.length;g++){let T=this.STR(N[S[g]])+"";for(let I=g+1;I<S.length;I++){let E=""+this.STR(N[S[I]]),x=a.get(p(S[g],S[I])),F=T+""+E;x.set(F,(x.get(F)??0)+1)}}let D=new Map;for(let N=0;N<S.length;N++)for(let g=N+1;g<S.length;g++){let T=S[N],I=S[g],E=s[T].size,x=s[I].size,F=a.get(p(T,I)),k=F.size,C=0;for(let y of F.values())(C===0||y<C)&&(C=y);let M=Math.round(k/(E*x)*100),G=k===E,_=k===x;if((this._cols[T].categoricalPairStats||=[]).push({otherColumn:this._cols[I].name,fillPct:M,determinesOther:G,minCellCount:C,distinctCombinations:k}),(this._cols[I].categoricalPairStats||=[]).push({otherColumn:this._cols[T].name,fillPct:M,determinesOther:_,minCellCount:C,distinctCombinations:k}),G&&E>x){let y=D.get(T);(!y||x<y.card)&&D.set(T,{name:this._cols[I].name,card:x,ratio:x/E})}if(_&&x>E){let y=D.get(I);(!y||E<y.card)&&D.set(I,{name:this._cols[T].name,card:E,ratio:E/x})}}for(let[N,g]of D)this._cols[N].primaryParentColumn=g.name,this._cols[N].nestingRatio=Math.round(g.ratio*100)/100}let w=6,h=this._rows.length;for(let a=0;a<this._cols.length;a++){let p=this._cols[a];if(p.isMeasure||p.primaryParentColumn)continue;let D=p.distinctCount??0;if(D<=O||h>0&&D>=h)continue;let N=[];for(let g=0;g<this._cols.length;g++){if(g===a)continue;let T=this._cols[g];if(T.isMeasure)continue;let I=T.distinctCount??0;I<2||I>=D||N.push(g)}N.sort((g,T)=>(this._cols[g].distinctCount??0)-(this._cols[T].distinctCount??0));for(let g of N.slice(0,w)){let T=new Map,I=!0;for(let x of this._rows){let F=this.STR(x[a])+"",k=this.STR(x[g])+"",C=T.get(F);if(C===void 0)T.set(F,k);else if(C!==k){I=!1;break}}if(!I)continue;let E=this._cols[g].distinctCount??0;p.primaryParentColumn=this._cols[g].name,p.nestingRatio=Math.round(E/D*100)/100;break}}let W=.01,U=.05,v=.95,b=8,P=8,B=6,H=500,z=[];for(let a=0;a<this._cols.length&&z.length<P;a++){let p=this._cols[a].dataType;(p==="Double"||p==="Integer"||p==="Decimal")&&z.push(a)}if(z.length>=3&&this._rows.length>=b){let a=Math.min(this._rows.length,H),p=z.map(E=>{let x=[];for(let C=0;C<a;C++){let M=this._rows[C][E],G=typeof M=="number"?M:parseFloat(String(M).replace(/,/g,""));if(M==null||M===""||!isFinite(G))return null;x.push(G)}let F=x[0],k=!1;for(let C of x)if(C!==F){k=!0;break}return k?x:null}),D=z.map((E,x)=>x).filter(E=>p[E]!==null),N=E=>{let x=E.slice().sort((k,C)=>k-C),F=x.length>>1;return x.length%2?x[F]:(x[F-1]+x[F])/2},g=null,T=[],I=E=>{if(T.length>=3){let x=T.map(M=>p[M]),F=x[0].length,k=new Array(F);for(let M=0;M<F;M++){let G=0;for(let _ of x)G+=_[M];k[M]=G}let C=N(k);if(C>0){let M=0;for(let _ of k)Math.abs(_-C)<=C*W&&M++;let G=M/F;if(G>=v){let _=1;for(let y of x){let L=N(y)/C;L<_&&(_=L)}_>=U&&(!g||T.length>g.cols.length)&&(g={cols:T.slice(),total:C,matched:G})}}}if(!(T.length>=B))for(let x=E;x<D.length;x++)T.push(D[x]),I(x+1),T.pop()};if(I(0),g){let E=g,F={columns:E.cols.map(k=>this._cols[z[k]].name),total:Math.round(E.total*1e3)/1e3,matchedPct:Math.round(E.matched*100)/100};for(let k of E.cols)this._cols[z[k]].constantSumGroup=F}}return this.applySeriesCompleteness(i,n,s),this._computedStatsForLevel=e,this._cols}applySeriesCompleteness(e,n,r){for(let m of this._cols)m.seriesCompleteness!==void 0&&delete m.seriesCompleteness;let i=this._cols.map((m,R)=>({c:m,i:R})).filter(({c:m})=>m.isTemporal&&!m.isMeasure&&m.temporalCadence&&m.temporalCadence.grain!=="irregular");if(i.length===0)return;let s=[],o=[];this._cols.forEach((m,R)=>{let A=r[R];A&&(s.push(R),o.push({name:m.name,dataType:m.dataType,isMeasure:!!m.isMeasure,isTemporal:!!m.isTemporal,isDatePart:!!m.isDatePart,isReassembledDate:!!m.isReassembledDate,isBinaryFlag:!!m.isBinaryFlag,geoKind:m.geoKind,identifierNamed:it(m.name),values:A,rows:this._rows.length,locale:n}))});let l=qe(o);if(l<0)return;let u=s[l],c=this._cols[u],d=this._rows.map(m=>this.STR(m[u])),f=e>=20&&(c.dataType!=="String"||Array.isArray(c.safeDistinctValues));for(let{c:m,i:R}of i){let A=Je({periods:this._rows.map(O=>this.STR(O[R])),series:d,seriesColumn:c.name,pattern:m.temporalTextPattern,locale:n,includeDates:e>=20,includeNames:f});A&&(m.seriesCompleteness=A)}}updateColumnStats20(e,n,r,i,s,o,l,u,c,d,f,m){if(e>=20){let R=[...n].sort((S,w)=>S-w),A=Math.floor(R.length/2);if(r>0&&i!=null?s.avgValue=s.dataType=="Integer"?Math.round(i/r):i/r:s.avgValue=null,r>0&&(s.avgLength=o/r),this._rows.length>0){let S=w=>{let h=w instanceof Date?w:typeof w=="string"?ce(w)??new Date(w):new Date(w),W=this.wholeDayIso(h);return W?W+"T00:00:00.000Z":isNaN(h.getTime())?w:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!u?s.lowValue=u:s.lowValue=S(u),s.dataType!="DateTime"||l||!c?s.highValue=c:s.highValue=S(c),s.medianValue=R.length===0?null:R.length%2===0?s.dataType=="Integer"?Math.round((R[A-1]+R[A])/2):(R[A-1]+R[A])/2:R[A],s.numericPrecision=d}if(R.length>0){let S=s.avgValue??0,w=R.length,h=0,W=0;for(let v of R){let b=v-S;h+=b*b,W+=b*b*b}let U=h/w;s.skewness=U===0?0:W/w/Math.pow(Math.sqrt(U),3),s.stdDev=Math.sqrt(U)}i!==null&&(s.sum=i);let O=Array.from(f.entries()).sort((S,w)=>w[1]-S[1]);if(s.topCategories=O.slice(0,10).map(S=>S[1]),!s.isMeasure&&O.length>0){if(s.dataType==="String"){let S=O.map(h=>h[0]);s.formatSignature=re(S);let w=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!w.test(s.formatSignature)&&(s.avgLength===void 0||s.avgLength>=3)&&(s.isFreeText=!0)}else s.topCategoryValues=O.slice(0,5).map(S=>S[0]);if(e>=20){let S=O.map(h=>h[0]),w=ie(S,m);if(w!==null)s.ordinalPattern=w.pattern,s.orderedDomain=w.orderedDomain;else if(s.dataType==="String"){let h=xe(S);h!==null&&(s.safeDistinctValues=h)}}}if(R.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let S=w=>R[Math.floor((R.length-1)*w)];s.quantiles={p05:S(.05),p25:S(.25),p75:S(.75),p95:S(.95)}}}if(!s.isMeasure&&f.size>0){let R=Array.from(f.entries()).sort((O,S)=>S[1]-O[1]),A=Ne(R.map(O=>O[0]),s.name,m);if(A!==null&&(s.geoKind=A.geoKind,s.geoMatchPct=A.geoMatchPct,A.geoAmbiguous&&(s.geoAmbiguous=!0),A.geoKind.indexOf("country")===0)){let O=me(R);O&&(s.dominantGeoRegion=O.dominantGeoRegion,s.dominantGeoRegionPct=O.dominantGeoRegionPct,s.geoRegionCount=O.regionCount)}}}updateColumnStats10(e,n,r,i,s,o,l){e>=10&&(n.blankCount=this._rows.length-r,n.distinctCount=i.size+(n.blankCount!=0?1:0),n.valueNature="Categorical",r>0&&(n.dataType==="Integer"||n.dataType==="Decimal"?n.valueNature=tt({dataType:n.dataType,isMeasure:!!n.isMeasure,name:n.name,distinct:i.size,nonblank:r,prec:s,maxval:o,minval:l}):n.dataType==="DateTime"&&(n.valueNature=n.dateWithTime?"Continuous":"Ordinal")))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((r,i)=>{r.isMeasure||e.push(i)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let n=new Set;for(let r of this._rows)n.add(JSON.stringify(e.map(i=>r[i])));return this._leafCardinality=n.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>String(o||"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z]+/),n=-1,r=-1,i=-1;if(this._cols.forEach((o,l)=>{let u=e(o.name),c=o.dataType==="Integer"||o.dataType==="Decimal";c&&n<0&&u.some(d=>d==="lat"||d==="latitude")?n=l:c&&r<0&&u.some(d=>d==="lon"||d==="lng"||d==="long"||d==="longitude")&&(r=l),i<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(i=l)}),n<0||r<0)return null;let s=[];for(let o of this._rows){let l=o[n],u=o[r],c=l==null||l===""?null:Number(l),d=u==null||u===""?null:Number(u);s.push({lat:c,lon:d,country:i>=0&&ae(this.STR(o[i]))?this.STR(o[i]):null})}return this._geoExtent=Ie(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;obfuscateString(e){return De(e,Ae)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(n=>{let r={};this._cols.forEach((i,s)=>{r[i.name]=n[s],this.emitLegacyAggAliases&&i.hostName&&i.hostName!==i.name&&!Object.prototype.hasOwnProperty.call(r,i.hostName)&&(r[i.hostName]=n[s])});for(let[i,s]of e)Object.prototype.hasOwnProperty.call(r,s.alias)||(r[s.alias]=n[i]);return r})}async getCSVAsync(e){let n=[],r=e?25:1e7,i=e?4e3:1e7,s=new Map;for(let l of this._rows){let u={};for(let c=0;c<this._cols.length;c++){let d=this._cols[c],f=l[c];if(this.STR(f)!=""){if(e&&d.dataType=="String")if(s.has(f))f=s.get(f);else{let m=this.obfuscateString(f);s.set(f,m),f=m}else if(d.dataType=="DateTime"&&!d.dateWithTime){let m=f instanceof Date?f:typeof f=="string"?ce(f)??new Date(f):new Date(f);f=(this.wholeDayIso(m)??m.toISOString().slice(0,10))+"T00:00:00.000Z"}i-=this.STR(f).length}else f=null;u[c]=f,--i}if(n.push(u),--r,r<=0||i<=0)break}return await et.unparse(n,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return et.unparse([this._cols.map((n,r)=>{if(this.emitLegacyAggAliases&&n.hostName)return this.STR(n.hostName);let i=e.get(r);return this.STR(i&&i.headerName?i.alias:n.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(n=>n==null?null:this.STR(n)),this._englishAliases=new Map}aliasesForCode(e){let n=fe(e,this._cols)?this.legacyAliases():[];for(let r of this.englishAliasesFor(e).values())n.push({name:r.name,alias:r.alias,reason:"english-implicit-agg"});return n}armAliasesForCode(e){return this.emitLegacyAggAliases=fe(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let n of this.liveEnglishAliases().values())e.push({name:n.name,alias:n.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let n of this._cols)n&&n.hostName&&n.hostName!==n.name&&e.push({name:this.STR(n.name),alias:this.STR(n.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let n=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return n;let r=String(e),i=new Set;for(let o of this._cols)o&&(i.add(this.STR(o.name)),o.hostName&&i.add(this.STR(o.hostName)));let s=new Map;for(let o=0;o<this._cols.length;o++){if(!this._cols[o])continue;let l=Be(this._hostQueryNames[o]).filter(u=>!i.has(u)&&ee(r,u));l.length===1&&s.set(l[0],[...s.get(l[0])??[],o])}for(let[o,l]of s){if(l.length!==1)continue;let u=this.STR(this._cols[l[0]].name);n.set(l[0],{name:u,alias:o,headerName:!ee(r,u)})}return n}liveEnglishAliases(){let e=new Map;for(let[n,r]of this._englishAliases){let i=this._cols?this._cols[n]:null;i&&this.STR(i.name)===r.name&&e.set(n,r)}return e}addRow(e,n){if(this.dedupRows){let r="";for(let s of e)r+=this.STR(s)+"~";let i=_e(r);if(this._rowHashes.has(i))return!1;this._rowHashes.add(i)}return this._rows.push(xn(e)),this._origIndices.push(n??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}reset(){this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map}setColumns(e){if(this._cols=e,!e||e.length===0)return;let n=new Set(e.map(r=>this.STR(r?.name)));for(let r of e){if(!r)continue;let i=this.STR(r.name),s=Ge(i);!s||s===i||n.has(s)||(n.delete(i),n.add(s),r.hostName=i,r.name=s)}}};export{Ie as a,at as b,ae as c,Nn as d,gt as e,pt as f,ht as g,bt as h,Fe as i,Ct as j,Ge as k,fe as l,Be as m,$e as n,Tt as o,Ve as p,Ke as q,Ln as r,Dn as s,On as t,ee as u,Lt as v,kn as w,Dt as x,Ot as y,ge as z,Xe as A,Zt as B,Xt as C,jt as D,tn as E,qe as F,Je as G,it as H,rt as I,An as J,Cn as K,Mn as L,tt as M,xn as N,nt as O};
|
|
2
|
+
import{a as re}from"./chunk-QEH7WTLB.mjs";import{a as se,b as oe}from"./chunk-2LR73DNS.mjs";import{c as Ne}from"./chunk-6TVBXT4G.mjs";import{b as Re,f as Te}from"./chunk-TPVDJHU6.mjs";import{a as Me,b as xe,c as ie}from"./chunk-6Q3MQ2MK.mjs";import{A as Ce,h as ye,i as Z,s as Se,t as Y,u as _e,v as Ae,y as ce}from"./chunk-NFSQ4O5R.mjs";var st=[[24.4,49.4,-125,-66.9],[51.2,71.5,-168,-129.9],[18.9,22.3,-160.3,-154.8]],ot=[7,72,-172,-52];function Ee(t,e,n){return t>=n[0]&&t<=n[1]&&e>=n[2]&&e<=n[3]}var X=t=>Math.round(t*10)/10;function Ie(t,e=3){let n=[],r=[],i=0,s=0;for(let l of t){let u=l?.lat,c=l?.lon;if(typeof u!="number"||typeof c!="number"||!isFinite(u)||!isFinite(c)||u<-90||u>90||c<-180||c>180)continue;n.push(u),r.push(c);let d=l?.country?String(l.country).trim().toUpperCase():"",f=d?ae(d):null;f?((d==="US"||d==="USA")&&i++,f==="north-america"&&s++):(st.some(m=>Ee(u,c,m))&&i++,Ee(u,c,ot)&&s++)}let o=n.length;return o<e?null:(n.sort((l,u)=>l-u),r.sort((l,u)=>l-u),{pctUsa:X(i/o*100),pctNa:X(s/o*100),latP5:X(Y(n,.05)),latP95:X(Y(n,.95)),lonP5:X(Y(r,.05)),lonP95:X(Y(r,.95)),n:o})}var ve={"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"},J=(()=>{let t=new Map;for(let e of Object.keys(ve))for(let n of ve[e].split(/\s+/))n&&t.set(n,e);return t})();function at(t){for(let[e,n]of t){let r=J.get(e);r&&!J.has(n)&&J.set(n,r)}}at(Re);function ae(t){if(!t)return null;let e=String(t).trim().toUpperCase();if(!e)return null;let n=J.get(e);if(n)return n;let r=Te(String(t));return r?J.get(r)??null:null}function Nn(t,e=2){return me(t.map(n=>[n,1]),e)}function me(t,e=2){let n=new Map,r=0;for(let[o,l]of t){let u=ae(o);if(!u)continue;let c=typeof l=="number"&&isFinite(l)&&l>0?l:1;n.set(u,(n.get(u)??0)+c),r+=c}if(r<e||!n.size)return null;let i="europe",s=-1;for(let o of Array.from(n.keys()).sort()){let l=n.get(o);l>s&&(i=o,s=l)}return{dominantGeoRegion:i,dominantGeoRegionPct:X(s/r*100),regionCount:n.size,n:r}}import et from"papaparse";var ut=[["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 ue(t){for(let[e,n]of ut)if(n.test(t))return e;return null}var lt=[{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]]}],le=new Map;function we(t,e,n,r){let i=le.get(t);if(i)return i;let s=[];for(let[o,l]of e)for(let u=o;u<=l;u++){let c=String.fromCodePoint(u);ue(c)===n&&(r&&!r.test(c)||s.push(c))}return le.set(t,s),s}function ct(t){let n=t.codePointAt(0);for(let o=0;o<9&&ue(String.fromCodePoint(n-1))==="Nd";o++)n--;let r="nd:"+n.toString(16),i=le.get(r);if(i)return i;let s=[];for(let o=n;o<n+10;o++){let l=String.fromCodePoint(o);ue(l)==="Nd"&&s.push(l)}return le.set(r,s),s}function mt(t,e){if(e==="Nd")return ct(t);for(let i of lt)if(i.test.test(t))return we(i.id+":"+e,i.ranges,e,i.id==="ascii"?null:i.test);let r=t.codePointAt(0)&-128;return we("block:"+r.toString(16)+":"+e,[[r,r+127]],e,null)}function dt(t,e,n,r){let i=t.filter(s=>!e.has(s));return i.length===0&&(i=t.filter(s=>s!==n)),i.length===0?n:i[Math.min(i.length-1,Math.floor(r()*i.length))]}var ft=/^[\p{L}\p{M}\p{Nd}]$/u,Le=/^[\p{L}\p{Nd}]$/u;function De(t,e){if(!t)return t??"";let n=new Set(Array.from(t)),r=d=>{let f=ue(d);return!f||!ft.test(d)?d:dt(mt(d,f),n,d,e)},i=d=>{let f=[];for(let m of d)f.push(r(m)),Le.test(m)&&e()<.2&&f.push(r(m));if(f.length>6){let m=Math.floor(e()*Math.min(3,f.length-6));for(let R=0;R<m;R++)for(let A=0;A<5;A++){let O=Math.floor(e()*f.length);if(Le.test(f[O])){f.splice(O,1);break}}}return f.join("")};if(!(t.includes("@")&&t.includes(".")))return i(t);let[o,l=""]=t.split("@"),u=l.endsWith(".com"),c=u?l.slice(0,-4):l;return`${i(o)}@${i(c)}${u?".com":""}`}var gt=["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","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"],pt=["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"],ht=["latitude","longitude"],bt=["latitude","longitude"];function j(t){return ye(t)}var de=["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"],Pe=["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"];function yt(t){return[...t].sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var ke=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+yt(de)+")\\s+)","i"),St=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,_t=new RegExp("\\b("+gt.join("|")+")\\b|("+pt.join("|")+")$","i"),At=new RegExp("\\b("+ht.join("|")+")\\b|("+bt.join("|")+")$","i");function Fe(t){if(!t)return"";let e=String(t),n=ke.exec(j(e));return(n?e.slice(n[0].length):e).trim()}function Ct(t){return!!t&&ke.test(j(String(t)))}var Mt=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],Oe=new RegExp("^\\s*("+[...Mt].sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Ge(t){if(t==null)return"";let e=String(t),n=Oe.exec(e);if(!n)return e;let r=l=>l.toLowerCase().replace(/\s+/g," ").trim(),i=r(n[1]),s=e.slice(n[0].length),o=0;for(;o<8;){let l=Oe.exec(s);if(!l||r(l[1])!==i)break;let u=s.slice(l[0].length);if(u.trim()==="")break;s=u,o++}return o===0?e:e.slice(0,n[0].length)+s}function fe(t,e){if(!t||!e)return!1;let n=String(t);for(let r of e){let i=r?.hostName;if(i&&i!==r?.name&&n.includes(i))return!0}return!1}var We={Sum:["Sum of "],Avg:["Average of "],Average:["Average of "],Count:["Count of "],CountNonNull:["Count of "],Min:["Min of ","First ","Earliest "],Max:["Max of ","Last ","Latest "],Median:["Median of "],StandardDeviation:["Standard deviation of "],Variance:["Variance of "]},xt=new RegExp("^("+Object.keys(We).join("|")+")\\((.+)\\)$");function Be(t){if(!t)return[];let e=xt.exec(String(t).trim());if(!e)return[];let n=We[e[1]],r=e[2],i=[];for(let s=r.indexOf(".");s>=0;s=r.indexOf(".",s+1)){if(s===0)continue;let o=r.slice(s+1);if(o.trim()!=="")for(let l of n){let u=l+o;i.includes(u)||i.push(u)}}return i}function Rt(t){let e=Fe(t);return e.length===0?"":e.replace(St," ")}function ze(t,e){if(!e)return!1;let n=Fe(e);return t.test(j(Rt(e)))||t.test(j(n))||t.test(j(Z(n).join(" ")))}function $e(t){return ze(At,t)}function Tt(t){return ze(_t,t)||$e(t)}var Ue=/int|double|decimal|single|float|number|currency|money/i;function Nt(t){let e=String(t?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||t?.isMeasure===!0||Ue.test(String(t?.dataType??""))?"Continuous":"Categorical"}function Et(t){return t?.isMeasure===!0||Ue.test(String(t?.dataType??""))}function Ve(t){let e=t??{},n=Nt(e);if(n!=="Continuous")return{nature:n,additivity:"unknown",basis:"role",suppressed:!1};if($e(e.name))return{nature:n,additivity:"positional",basis:"name",suppressed:!0};let r=String(e.additivity??"").trim().toLowerCase();if(!(r==="additive"&&Ct(e.name))){if(r==="additive")return{nature:n,additivity:"additive",basis:"measured",suppressed:!1};if(r==="part_of_whole")return{nature:n,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(r==="intensive_rate")return{nature:n,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:n,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Tt(e.name)?{nature:n,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:n,additivity:"additive",basis:"default",suppressed:!1}}function Ke(t){let e=Ve(t),n=t??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return Et(n)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function Ln(t){return Ke(t)[0]}function Dn(t,e){return Ke(t).indexOf(e)>=0}function On(t,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let n=Ve(t);return n.additivity==="additive"||n.additivity==="part_of_whole"||n.additivity==="unknown"}var vt=/^[A-Za-z_$][A-Za-z0-9_$]*$/,It=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),wt=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 ee(t,e){if(!t||!e)return!1;let n=It(e);return new RegExp("['\"`]"+n+"['\"`]").test(t)?!0:vt.test(e)&&new RegExp("\\."+n+"(?![A-Za-z0-9_$])").test(t)}function Lt(t){return!!t&&wt.test(t)}function kn(t,e,n){return t?Lt(t)?[...e]:[...n,...e].some(r=>ee(t,r))?e.filter(r=>ee(t,r)):[...e]:[]}var Dt=5,Ot=6,Pt=3,Q=864e5,kt=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Ft=/^(\d{4})[-/](\d{1,2})$/,Gt=/^(\d{4})[-\s]?Q([1-4])$/i,Wt=/^Q([1-4])[-\s](\d{4})$/i,Bt=/^(\d{4})$/,zt=/^(\d{4})(0[1-9]|1[0-2])$/,$t=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,Ut=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,Vt=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Ye(t,e){let n=se(t);if(!n)return 0;if(n==="sept")return 9;for(let r of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let i=oe(r)[n];if(i!==void 0)return i+1}return 0}function K(t,e,n,r=0,i=0,s=0){if(!(t>=1&&e>=1&&e<=12&&n>=1&&n<=31))return null;let o=Date.UTC(t,e-1,n,r,i,s);if(!Number.isFinite(o))return null;let l=u=>u<10?"0"+u:String(u);return{ms:o,y:t,m:e,d:n,iso:`${t}-${l(e)}-${l(n)}`}}function Kt(t,e){let n=[],r="";for(let u=0;u<e.length;u++){if(e[u]!=="%"){r+=e[u].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++u]){case"Y":n.push("Y"),r+="(\\d{4})";break;case"m":n.push("m"),r+="(\\d{1,2})";break;case"d":n.push("d"),r+="(\\d{1,2})";break;case"H":case"M":case"S":r+="\\d{1,2}";break;case"%":r+="%";break;default:return null}}let i=new RegExp("^"+r+"$").exec(t);if(!i)return null;let s=0,o=1,l=1;return n.forEach((u,c)=>{let d=+i[c+1];u==="Y"?s=d:u==="m"?o=d:l=d}),s?K(s,o,l):null}function ge(t,e,n){let r=(t??"").trim();if(r==="")return null;if(e){let s=Kt(r,e);return s||null}let i=kt.exec(r);if(i)return K(+i[1],+i[2],+i[3],+(i[4]??0),+(i[5]??0),+(i[6]??0));if(i=Gt.exec(r),i)return K(+i[1],(+i[2]-1)*3+1,1);if(i=Wt.exec(r),i)return K(+i[2],(+i[1]-1)*3+1,1);if(i=Ft.exec(r),i&&+i[2]>=1&&+i[2]<=12)return K(+i[1],+i[2],1);if(i=$t.exec(r),i)return K(+i[1],+i[2],+i[3]);if(i=zt.exec(r),i)return K(+i[1],+i[2],1);if(i=Bt.exec(r),i){let s=+i[1];return s>=1900&&s<=2100?K(s,1,1):null}if(i=Ut.exec(r),i){let s=Ye(i[1],n);return s?K(+i[2],s,1):null}if(i=Vt.exec(r),i){let s=Ye(i[2],n);return s?K(+i[1],s,1):null}return null}function He(t){let e=new Date(t).getUTCDay();return e>=1&&e<=5}function Ze(t,e){if(e<=t)return 0;let n=Math.round((e-t)/Q),r=Math.floor(n/7),i=r*5,s=t+r*7*Q;for(;s<e;)He(s)&&i++,s+=Q;return i}function Yt(t){if(t.length===0)return 0;let e=[...t].sort((r,i)=>r-i),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function Ht(t){return t>0?t<.95?"hour":t<=1.05?"day":t>=6.5&&t<=7.5?"week":t>=27&&t<=31.5?"month":t>=88&&t<=93?"quarter":t>=362&&t<=368?"year":"irregular":"irregular"}function te(t,e,n,r){switch(n){case"year":return e.y-t.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(t.y*4+Math.floor((t.m-1)/3));case"month":return e.y*12+e.m-(t.y*12+t.m);case"week":return Math.round((e.ms-t.ms)/(7*Q));case"weekday":return Ze(t.ms,e.ms);case"day":return Math.round((e.ms-t.ms)/Q);default:return r>0?Math.round((e.ms-t.ms)/r):0}}function Xe(t,e){return pe(t,e)?.cadence??null}function pe(t,e){let n=e?.gapFactor??Dt,r=0,i=0,s=new Map;for(let h of t){if(h==null||h==="")continue;r++;let W=ge(String(h),e?.pattern,e?.locale);W&&(i++,s.set(W.ms,W))}let o=[...s.values()].sort((h,W)=>h.ms-W.ms);if(o.length<Pt||r>0&&i/r<.8)return null;let l=o[o.length-1].ms-o[0].ms;if(l<=0)return null;let u=[];for(let h=1;h<o.length;h++)u.push(o[h].ms-o[h-1].ms);let c=Yt(u);if(!(c>0))return null;let d=Ht(c/Q);d==="day"&&l>=7*Q&&o.every(h=>He(h.ms))&&Ze(o[0].ms,o[o.length-1].ms)+1>o.length*.5&&(d="weekday");let f=d==="irregular"?o.length:te(o[0],o[o.length-1],d,c)+1,m=1,R=1,A=[],O=o[0],S=1;for(let h=1;h<o.length;h++){let W=te(o[h-1],o[h],d,c);W>m&&(m=W),d!=="irregular"&&W>n?(R++,A.push({from:O.iso,to:o[h-1].iso,points:S}),O=o[h],S=1):S++}A.push({from:O.iso,to:o[o.length-1].iso,points:S});let w={grain:d,points:o.length,expectedPoints:Math.max(f,o.length),coveragePct:Math.round(o.length/Math.max(f,o.length)*1e3)/10,runs:R,largestGapUnits:m,gapFactor:n};return e?.includeBounds&&A.length<=Ot&&(w.runBounds=A),{cadence:w,points:o,stepMs:c}}var Zt=8,Xt=.5,jt=200,Qt=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"]),qt=["category","classification","segment","status","priority","severity","channel"],Jt=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function en(t){let e=Z(t);if(e.length===0)return!1;let n=e[e.length-1];return Qt.has(n)?!0:qt.some(r=>n.length>r.length&&n.endsWith(r))}function tn(t){if(t.isMeasure)return"measure";if(t.isTemporal||t.isDatePart||t.isReassembledDate)return"temporal";let e=Array.from(t.values).filter(n=>n!==""&&n!==null&&n!==void 0);return e.length<2||e.length>jt?"cardinality":t.rows>0&&e.length>=t.rows?"row-identity":t.isBinaryFlag?"flag":ie(e,t.locale)!==null?"ordinal":t.identifierNamed||t.dataType==="String"&&Jt.has(re(e))?"identifier":!t.geoKind&&en(t.name)?"attribute":"entity"}function qe(t){let e=-1,n=1/0,r=!1;return t.forEach((i,s)=>{if(tn(i)!=="entity")return;let o=new Set(Array.from(i.values).filter(u=>u!=="")).size,l=!!i.geoKind;(o<n||o===n&&l&&!r)&&(e=s,n=o,r=l)}),e}var je=t=>t<10?"0"+t:String(t);function Qe(t,e){switch(e){case"year":return`${t.y}-01-01`;case"quarter":return`${t.y}-${je(Math.floor((t.m-1)/3)*3+1)}-01`;case"month":return`${t.y}-${je(t.m)}-01`;case"hour":return new Date(t.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return t.iso}}function Je(t){let{periods:e,series:n}=t,r=Math.min(e.length,n.length),i=new Set;for(let v=0;v<r;v++)e[v]&&i.add(e[v]);let s=pe(i,{pattern:t.pattern,locale:t.locale});if(!s)return null;let o=s.cadence.grain;if(o==="irregular")return null;let l=s.points[0],u=te(l,s.points[s.points.length-1],o,s.stepMs)+1;if(u!==s.cadence.expectedPoints)return null;let c=new Map;for(let v of i){let b=ge(v,t.pattern,t.locale);if(!b)continue;let P=te(l,b,o,s.stepMs);P>=0&&P<u&&c.set(v,{idx:P,stamp:b})}let d=new Map;for(let v=0;v<r;v++){let b=n[v];if(!b)continue;let P=c.get(e[v]);if(!P)continue;let B=d.get(b);B||(B={seen:new Set,lo:P.idx,hi:P.idx,loStamp:P.stamp,hiStamp:P.stamp,order:d.size},d.set(b,B)),B.seen.add(P.idx),P.idx<B.lo&&(B.lo=P.idx,B.loStamp=P.stamp),P.idx>B.hi&&(B.hi=P.idx,B.hiStamp=P.stamp)}if(d.size<2)return null;let f=0;for(let v of d.values())f+=v.seen.size;if(f/(d.size*u)<(t.minFill??Xt))return null;let m=[],R=new Set,A=0,O=0,S=0,w=0,h=0,W=1;for(let[v,b]of d){for(let z of b.seen)R.add(z);if(b.seen.size>=u)continue;let P=[...b.seen].sort((z,a)=>z-a),B=1;for(let z=1;z<P.length;z++)B=Math.max(B,P[z]-P[z-1]);let H={key:v,acc:b,coverage:b.seen.size/u,before:b.lo,after:u-1-b.hi,interior:b.hi-b.lo+1-b.seen.size,gap:B};m.push(H),H.before>0&&A++,H.after>0&&O++,H.interior>0&&S++,w=Math.max(w,H.before),h=Math.max(h,H.after),W=Math.max(W,B)}if(m.length===0)return null;m.sort((v,b)=>v.coverage-b.coverage||v.acc.order-b.acc.order);let U=m.slice(0,t.maxListed??Zt);return{seriesColumn:t.seriesColumn,grain:o,periods:u,seriesCount:d.size,incompleteSeries:m.length,lateStarts:A,earlyEnds:O,withHoles:S,columnWideMissing:u-R.size,maxMissingBefore:w,maxMissingAfter:h,largestGap:W,series:U.map(v=>{let b={};return t.includeNames&&(b.name=v.key),t.includeDates&&(b.first=Qe(v.acc.loStamp,o),b.last=Qe(v.acc.hiStamp,o)),b.missingBefore=v.before,b.missingAfter=v.after,b.missingInterior=v.interior,b.largestGap=v.gap,b.coverage=Math.round(v.coverage*1e3)/1e3,b}),more:m.length-U.length}}var nn=12,rn=100,sn=.3,on=.9,an=120,un=1900,ln=2100,cn=0,mn=20,dn=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function it(t){if(!t)return!1;let e=Z(t);return e.length===0?!1:dn.has(e[e.length-1])}var fn=new Set(["year","yr","fy"]),gn=t=>Z(t).some(e=>fn.has(e)),pn=/^(?:(?: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 he(t){if(!Number.isInteger(t)||t<190001||t>210012)return!1;let e=t%100;return e>=1&&e<=12}function be(t){if(!Number.isInteger(t)||t<19000101||t>21001231)return!1;let e=Math.floor(t/100)%100,n=t%100;return e>=1&&e<=12&&n>=1&&n<=31}var hn=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,bn=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,yn=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Sn(t){let e=(t||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}function rt(t,e){let n=0,r=0,i=0,s=0,o=0,l="",u=0,c="",d=0,f=0,m=0,R=0,A=!1;for(let U of t){if(U==null)continue;let v=String(U).trim();if(v==="")continue;n++;let b;if(b=hn.exec(v)){let P=+b[2],B=+b[3];P>=1&&P<=12&&B>=1&&B<=31&&(r++,b[4]!==void 0&&i++,b[6]!==void 0&&s++)}else if(b=bn.exec(v)){let P=+b[3],B=+b[4];P>=1&&P<=12&&B>=1&&B<=31&&(l&&l!==b[2]&&(A=!0),l=b[2],o++)}else if(b=yn.exec(v)){let P=+b[1],B=+b[3];P>=1&&P<=31&&B>=1&&B<=31&&(P<=12||B<=12)&&(c&&c!==b[2]&&(A=!0),c=b[2],u++,P>12&&m++,B>12&&R++,b[5]!==void 0&&d++,b[7]!==void 0&&f++)}if(n>=200)break}if(n<2||(r+o+u)/n<.8||(r>0?1:0)+(o>0?1:0)+(u>0?1:0)!==1||A)return null;if(r>0)return i===r?{pattern:s===r?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(o>0)return{pattern:`%Y${l}%m${l}%d`,orderFrom:"iso"};if(m>0&&R>0)return null;let w,h;m>0?(w=!0,h="values"):R>0?(w=!1,h="values"):(w=!Sn(e),h="locale");let W=w?`%d${c}%m${c}%Y`:`%m${c}%d${c}%Y`;return d===u?{pattern:W+(f===u?" %H:%M:%S":" %H:%M"),orderFrom:h}:{pattern:W,orderFrom:h}}function _n(t,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(t))return!1;let n=t.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!n)return!1;let r=se(n);return r.length>0&&e[r]!==void 0}function An(t){let{dataType:e,name:n,isMeasure:r,distinctCount:i}=t;if(e==="DateTime")return!0;if(r)return!1;if(e==="Integer"||e==="Decimal"){let s=t.minNum,o=t.maxNum;if(!(s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&Number.isInteger(s)&&Number.isInteger(o)&&o>=s))return!1;let u=s>=1900&&o<=2100;if(u&&i>=2&&gn(n)||u&&i>=3&&i===o-s+1)return!0;let c=he(s)&&he(o),d=be(s)&&be(o);if(c||d){if(!t.sampleValues)return!0;let f=0,m=0;for(let R of t.sampleValues){if(R==null||R==="")continue;f++;let A=Number(String(R).trim());if(Number.isFinite(A)&&(c?he(A):be(A))&&m++,f>=60)break}if(f>=2&&m===f)return!0}return!1}if(t.sampleValues){let s=t.locale?oe(t.locale):null,o=0,l=0,u=[];for(let c of t.sampleValues){if(c==null||c==="")continue;o++;let d=String(c).trim();if(u.push(d),(pn.test(d)||_n(d,s))&&l++,o>=60)break}if(o>=2&&l/o>=.8||rt(u,t.locale)!==null)return!0}return!1}function Cn(t){let e=j((t||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":Pe.some(n=>e.startsWith(n+" "))?/^(minimum|minimo)\b/.test(e)?"min":/^(maximum|maximo|massimo)\b/.test(e)?"max":"avg":de.some(n=>e.startsWith(n+" ")||e===n)?/^(nombre|recuento|contagem|anzahl|aantal|conteggio|antal|lukumaara|pocet)\b/.test(e)?"count":"sum":null}function Mn(t){let{rows:e,measureColIdx:n,measureName:r,candidateDims:i,minNum:s,maxNum:o,discourageAgg:l}=t,u=100,c=.01,d="";for(let m of i){if(m.distinct<2||m.distinct>u)continue;let R=i.filter(h=>h.idx!==m.idx).map(h=>h.idx),A=new Map;for(let h of e){let W=h[n];if(typeof W!="number"||!Number.isFinite(W))continue;let U=R.length?R.map(b=>String(h[b])).join(d):"",v=A.get(U);v||(v={sum:0,cset:new Set},A.set(U,v)),v.sum+=W,v.cset.add(String(h[m.idx]))}let O=0,S=0,w=0;for(let h of A.values())h.cset.size<2||(w++,Math.abs(h.sum-100)<=100*c?O++:Math.abs(h.sum-1)<=1*c&&S++);if(w>=2&&(O/w>=.9||S/w>=.9))return{additivity:"part_of_whole",partOfWholeDim:m.name}}if(l)return{additivity:"intensive_rate"};let f=Cn(r);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 tt(t){let{dataType:e,isMeasure:n,name:r,distinct:i,nonblank:s,prec:o,maxval:l,minval:u}=t,c=l-u+1,d=c>0?i/c:1,f=s>0?i/s:0,m=e==="Decimal"||o>0;return it(r)?"Categorical":d>=on&&(Me(r)&&i<=an||u>=un&&l<=ln||u>=cn&&l<=mn)?"Ordinal":n||i>nn&&(m||i>=rn||f>=sn)?"Continuous":"Categorical"}function xn(t){let e=null;for(let n=0;n<t.length;n++){let r=t[n];if(typeof r!="string"||r.length===0)continue;let i=r.trim();i.length!==r.length&&(e||(e=t.slice()),e[n]=i)}return e||t}var nt=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;dedupRows=!0;emitLegacyAggAliases=!1;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 r=e.toString().split(".")[1];return r?r.length:0}getColumns(){return this._cols}wholeDayIso(e){return Ce(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,n){if(this._computedStatsForLevel==e)return this._cols;let r=0,i=parseInt(e),s=[];for(let a of this._cols){let p=new Map,D=[],N=0,g=0,T=0,I=null,E=null,x=null,F=!1,k=!0,C=!0,M=null,G=!1;for(let _ of this._rows){let y=_[r],L=this.STR(y);if(L!=""){if(N+=L.length,p.set(L,(p.get(L)||0)+1),g++,a.dataType=="Integer"||a.dataType=="Decimal"||a.dataType=="DateTime")if((I===null||y<I)&&(I=y),(E===null||y>E)&&(E=y),a.dataType=="Integer"||a.dataType=="Decimal"){if(x===null?x=y:x+=y,a.dataType=="Decimal"){let $=this.getPrecision(y);$>T&&(T=$)}D.push(y)}else F=F||this.hasTimeComponent(y);G&&(y<M?k=!1:y>M&&(C=!1)),M=y,G=!0}}if(g>=3&&(k&&!C?a.sortedDirection="asc":C&&!k?a.sortedDirection="desc":a.sortedDirection="none"),g>0&&p.size>0&&!a.isMeasure){let _=0,y=Number.MAX_SAFE_INTEGER;for(let L of p.values())L>_&&(_=L),L<y&&(y=L);if(a.modalShare=_/g,a.minGroupCount=y===Number.MAX_SAFE_INTEGER?null:y,p.size===2){let L=[...p.keys()].map(ne=>Se(ne).trim().toLowerCase()).sort(),V=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ne=>L[0]===ne[0]&&L[1]===ne[1]),q=/^(is|has)[_a-z0-9]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/i.test(a.name);(V||q)&&(a.isBinaryFlag=!0)}}if(a.dataType=="DateTime"&&(a.dateWithTime=F),a.isTemporal=An({dataType:a.dataType,name:a.name,isMeasure:a.isMeasure,distinctCount:p.size,minNum:typeof I=="number"?I:null,maxNum:typeof E=="number"?E:null,sampleValues:p.keys(),locale:n}),a.isTemporal&&a.dataType==="String"&&!a.isMeasure){let _=rt(p.keys(),n);_&&(a.temporalTextPattern=_.pattern)}if(a.isTemporal&&!a.isMeasure){let _=Xe(p.keys(),{includeBounds:i>=20,pattern:a.temporalTextPattern,locale:n});_&&(a.temporalCadence=_)}this.updateColumnStats10(i,a,g,p,T,E,I),this.updateColumnStats20(i,D,g,x,a,N,F,I,E,T,p,n),!a.isMeasure&&(a.dataType==="Integer"||a.dataType==="Decimal")&&tt({dataType:a.dataType,isMeasure:!1,name:a.name,distinct:p.size,nonblank:g,prec:T,maxval:typeof E=="number"?E:0,minval:typeof I=="number"?I:0})==="Continuous"&&(a.isMeasure=!0,a.geoKind=void 0,a.geoMatchPct=void 0,a.geoAmbiguous=void 0,a.dominantGeoRegion=void 0,a.dominantGeoRegionPct=void 0,a.geoRegionCount=void 0),s[r]=a.isMeasure||p.size>2e3?null:new Set(p.keys()),r++}let o=[];this._cols.forEach((a,p)=>{a.isMeasure||o.push({idx:p,distinct:a.distinctCount??0,name:a.name})}),this._cols.forEach((a,p)=>{if(!a.isMeasure)return;let D=typeof a.lowValue=="number"?a.lowValue:null,N=typeof a.highValue=="number"?a.highValue:null,g=Mn({rows:this._rows,measureColIdx:p,measureName:a.name,candidateDims:o,minNum:D,maxNum:N,discourageAgg:!!a.discourageAggregationAcrossGroups});a.additivity=g.additivity,g.partOfWholeDim&&(a.partOfWholeDim=g.partOfWholeDim)});let l=50,u=4,c=o.filter(a=>a.distinct>=2&&a.distinct<=l);this._cols.forEach((a,p)=>{if(!a.isMeasure)return;let D=[];for(let C of this._rows){let M=C[p];if(M==null||M==="")continue;let G=typeof M=="number"?M:parseFloat(M);isNaN(G)||D.push(G)}if(D.length===0)return;let N=[...D].sort((C,M)=>C-M);if(N[0]===N[N.length-1])a.relativeDispersion=0;else if(N.length>=u){let C=Y(N,.5),M=Y(N,.1),G=Y(N,.9);a.relativeDispersion=Math.abs(C)>1e-9?Math.round((G-M)/Math.abs(C)*1e3)/1e3:void 0}else a.relativeDispersion=void 0;let g=[];for(let C of c){let M=new Set;for(let G of this._rows){let _=G[p];_==null||_===""||M.add(this.STR(G[C.idx])+"")}g.push({otherColumn:C.name,nonBlankGroupCount:M.size})}g.length>0&&(a.nonBlankGroups=g);let T=0;for(let C of D)T+=C;T/=D.length;let I=0;for(let C of D)I+=(C-T)*(C-T);if(I<=1e-12)return;let E=[],x=[],F=C=>{if(C.length<4)return NaN;let M=[...C].sort((_,y)=>_-y),G=_=>M[Math.min(M.length-1,Math.max(0,Math.floor(_*(M.length-1))))];return G(.75)-G(.25)},k=F(D);for(let C of c){let M=new Map;for(let y of this._rows){let L=y[p];if(L==null||L==="")continue;let $=typeof L=="number"?L:parseFloat(L);if(isNaN($))continue;let V=this.STR(y[C.idx])+"",q=M.get(V);q?(q.s+=$,q.n++,q.vals.push($)):M.set(V,{s:$,n:1,vals:[$]})}let G=0;for(let y of M.values()){let L=y.s/y.n;G+=y.n*(L-T)*(L-T)}E.push({otherColumn:C.name,eta2:Math.round(G/I*1e4)/1e4});let _=[];for(let y of M.values()){let L=F(y.vals);isNaN(L)||_.push(L)}if(_.length>=2&&isFinite(k)&&k>1e-9){let y=(Math.max(..._)-Math.min(..._))/k;x.push({otherColumn:C.name,spreadRatio:Math.round(y*1e4)/1e4})}}E.length>0&&(a.groupDiscrimination=E),x.length>0&&(a.spreadDiscrimination=x)});let d=.97,f=.8,m=8,R=5,A=this._cols.map((a,p)=>({c:a,i:p})).filter(a=>a.c.isMeasure);for(let a=0;a<A.length;a++)for(let p=a+1;p<A.length;p++){let D=A[a].i,N=A[p].i,g=0,T=0,I=0,E=0,x=0,F=0;for(let _ of this._rows){let y=_[D],L=_[N];if(y==null||y===""||L===null||L===void 0||L==="")continue;let $=typeof y=="number"?y:parseFloat(y),V=typeof L=="number"?L:parseFloat(L);isNaN($)||isNaN(V)||(g++,T+=$,I+=V,E+=$*$,x+=V*V,F+=$*V)}if(g<R)continue;let k=g*E-T*T,C=g*x-I*I;if(k<=1e-12||C<=1e-12)continue;let M=(g*F-T*I)/Math.sqrt(k*C),G=Math.min(1,Math.round(Math.abs(M)*1e3)/1e3);for(let _ of[A[a].c,A[p].c])(_.maxAbsMeasureCorrelation===void 0||G>_.maxAbsMeasureCorrelation)&&(_.maxAbsMeasureCorrelation=G);if(Math.abs(M)>=d){let _=A[a].c,y=A[p].c;_.collinearWithMeasures||(_.collinearWithMeasures=[]),y.collinearWithMeasures||(y.collinearWithMeasures=[]),_.collinearWithMeasures.push(y.name),y.collinearWithMeasures.push(_.name)}else if(Math.abs(M)>=f){let _=A[a].c,y=A[p].c,L=Math.round(M*1e3)/1e3;_.correlatedWithMeasures||(_.correlatedWithMeasures=[]),y.correlatedWithMeasures||(y.correlatedWithMeasures=[]),_.correlatedWithMeasures.push({otherColumn:y.name,r:L}),y.correlatedWithMeasures.push({otherColumn:_.name,r:L})}}for(let{c:a}of A)a.correlatedWithMeasures&&(a.correlatedWithMeasures.sort((p,D)=>Math.abs(D.r)-Math.abs(p.r)||(p.otherColumn<D.otherColumn?-1:1)),a.correlatedWithMeasures.length=Math.min(a.correlatedWithMeasures.length,m));for(let a=0;a<this._cols.length;a++){let p=s[a];if(!p||p.size===0)continue;let D=[];for(let N=0;N<this._cols.length;N++){if(N===a)continue;let g=s[N];if(!g||g.size===0)continue;let T=0;for(let E of p)g.has(E)&&T++;let I=Math.round(T/p.size*100);I>0&&D.push({otherColumn:this._cols[N].name,percentShared:I})}D.length>0&&(this._cols[a].sharedValueRatioWithOthers=D)}let O=50,S=[];for(let a=0;a<this._cols.length;a++){let p=s[a];p&&p.size>=2&&p.size<=O&&S.push(a)}if(S.length>=2){let a=new Map,p=(N,g)=>N+":"+g;for(let N=0;N<S.length;N++)for(let g=N+1;g<S.length;g++)a.set(p(S[N],S[g]),new Map);for(let N of this._rows)for(let g=0;g<S.length;g++){let T=this.STR(N[S[g]])+"";for(let I=g+1;I<S.length;I++){let E=""+this.STR(N[S[I]]),x=a.get(p(S[g],S[I])),F=T+""+E;x.set(F,(x.get(F)??0)+1)}}let D=new Map;for(let N=0;N<S.length;N++)for(let g=N+1;g<S.length;g++){let T=S[N],I=S[g],E=s[T].size,x=s[I].size,F=a.get(p(T,I)),k=F.size,C=0;for(let y of F.values())(C===0||y<C)&&(C=y);let M=Math.round(k/(E*x)*100),G=k===E,_=k===x;if((this._cols[T].categoricalPairStats||=[]).push({otherColumn:this._cols[I].name,fillPct:M,determinesOther:G,minCellCount:C,distinctCombinations:k}),(this._cols[I].categoricalPairStats||=[]).push({otherColumn:this._cols[T].name,fillPct:M,determinesOther:_,minCellCount:C,distinctCombinations:k}),G&&E>x){let y=D.get(T);(!y||x<y.card)&&D.set(T,{name:this._cols[I].name,card:x,ratio:x/E})}if(_&&x>E){let y=D.get(I);(!y||E<y.card)&&D.set(I,{name:this._cols[T].name,card:E,ratio:E/x})}}for(let[N,g]of D)this._cols[N].primaryParentColumn=g.name,this._cols[N].nestingRatio=Math.round(g.ratio*100)/100}let w=6,h=this._rows.length;for(let a=0;a<this._cols.length;a++){let p=this._cols[a];if(p.isMeasure||p.primaryParentColumn)continue;let D=p.distinctCount??0;if(D<=O||h>0&&D>=h)continue;let N=[];for(let g=0;g<this._cols.length;g++){if(g===a)continue;let T=this._cols[g];if(T.isMeasure)continue;let I=T.distinctCount??0;I<2||I>=D||N.push(g)}N.sort((g,T)=>(this._cols[g].distinctCount??0)-(this._cols[T].distinctCount??0));for(let g of N.slice(0,w)){let T=new Map,I=!0;for(let x of this._rows){let F=this.STR(x[a])+"",k=this.STR(x[g])+"",C=T.get(F);if(C===void 0)T.set(F,k);else if(C!==k){I=!1;break}}if(!I)continue;let E=this._cols[g].distinctCount??0;p.primaryParentColumn=this._cols[g].name,p.nestingRatio=Math.round(E/D*100)/100;break}}let W=.01,U=.05,v=.95,b=8,P=8,B=6,H=500,z=[];for(let a=0;a<this._cols.length&&z.length<P;a++){let p=this._cols[a].dataType;(p==="Double"||p==="Integer"||p==="Decimal")&&z.push(a)}if(z.length>=3&&this._rows.length>=b){let a=Math.min(this._rows.length,H),p=z.map(E=>{let x=[];for(let C=0;C<a;C++){let M=this._rows[C][E],G=typeof M=="number"?M:parseFloat(String(M).replace(/,/g,""));if(M==null||M===""||!isFinite(G))return null;x.push(G)}let F=x[0],k=!1;for(let C of x)if(C!==F){k=!0;break}return k?x:null}),D=z.map((E,x)=>x).filter(E=>p[E]!==null),N=E=>{let x=E.slice().sort((k,C)=>k-C),F=x.length>>1;return x.length%2?x[F]:(x[F-1]+x[F])/2},g=null,T=[],I=E=>{if(T.length>=3){let x=T.map(M=>p[M]),F=x[0].length,k=new Array(F);for(let M=0;M<F;M++){let G=0;for(let _ of x)G+=_[M];k[M]=G}let C=N(k);if(C>0){let M=0;for(let _ of k)Math.abs(_-C)<=C*W&&M++;let G=M/F;if(G>=v){let _=1;for(let y of x){let L=N(y)/C;L<_&&(_=L)}_>=U&&(!g||T.length>g.cols.length)&&(g={cols:T.slice(),total:C,matched:G})}}}if(!(T.length>=B))for(let x=E;x<D.length;x++)T.push(D[x]),I(x+1),T.pop()};if(I(0),g){let E=g,F={columns:E.cols.map(k=>this._cols[z[k]].name),total:Math.round(E.total*1e3)/1e3,matchedPct:Math.round(E.matched*100)/100};for(let k of E.cols)this._cols[z[k]].constantSumGroup=F}}return this.applySeriesCompleteness(i,n,s),this._computedStatsForLevel=e,this._cols}applySeriesCompleteness(e,n,r){for(let m of this._cols)m.seriesCompleteness!==void 0&&delete m.seriesCompleteness;let i=this._cols.map((m,R)=>({c:m,i:R})).filter(({c:m})=>m.isTemporal&&!m.isMeasure&&m.temporalCadence&&m.temporalCadence.grain!=="irregular");if(i.length===0)return;let s=[],o=[];this._cols.forEach((m,R)=>{let A=r[R];A&&(s.push(R),o.push({name:m.name,dataType:m.dataType,isMeasure:!!m.isMeasure,isTemporal:!!m.isTemporal,isDatePart:!!m.isDatePart,isReassembledDate:!!m.isReassembledDate,isBinaryFlag:!!m.isBinaryFlag,geoKind:m.geoKind,identifierNamed:it(m.name),values:A,rows:this._rows.length,locale:n}))});let l=qe(o);if(l<0)return;let u=s[l],c=this._cols[u],d=this._rows.map(m=>this.STR(m[u])),f=e>=20&&(c.dataType!=="String"||Array.isArray(c.safeDistinctValues));for(let{c:m,i:R}of i){let A=Je({periods:this._rows.map(O=>this.STR(O[R])),series:d,seriesColumn:c.name,pattern:m.temporalTextPattern,locale:n,includeDates:e>=20,includeNames:f});A&&(m.seriesCompleteness=A)}}updateColumnStats20(e,n,r,i,s,o,l,u,c,d,f,m){if(e>=20){let R=[...n].sort((S,w)=>S-w),A=Math.floor(R.length/2);if(r>0&&i!=null?s.avgValue=s.dataType=="Integer"?Math.round(i/r):i/r:s.avgValue=null,r>0&&(s.avgLength=o/r),this._rows.length>0){let S=w=>{let h=w instanceof Date?w:typeof w=="string"?ce(w)??new Date(w):new Date(w),W=this.wholeDayIso(h);return W?W+"T00:00:00.000Z":isNaN(h.getTime())?w:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!u?s.lowValue=u:s.lowValue=S(u),s.dataType!="DateTime"||l||!c?s.highValue=c:s.highValue=S(c),s.medianValue=R.length===0?null:R.length%2===0?s.dataType=="Integer"?Math.round((R[A-1]+R[A])/2):(R[A-1]+R[A])/2:R[A],s.numericPrecision=d}if(R.length>0){let S=s.avgValue??0,w=R.length,h=0,W=0;for(let v of R){let b=v-S;h+=b*b,W+=b*b*b}let U=h/w;s.skewness=U===0?0:W/w/Math.pow(Math.sqrt(U),3),s.stdDev=Math.sqrt(U)}i!==null&&(s.sum=i);let O=Array.from(f.entries()).sort((S,w)=>w[1]-S[1]);if(s.topCategories=O.slice(0,10).map(S=>S[1]),!s.isMeasure&&O.length>0){if(s.dataType==="String"){let S=O.map(h=>h[0]);s.formatSignature=re(S);let w=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!w.test(s.formatSignature)&&(s.avgLength===void 0||s.avgLength>=3)&&(s.isFreeText=!0)}else s.topCategoryValues=O.slice(0,5).map(S=>S[0]);if(e>=20){let S=O.map(h=>h[0]),w=ie(S,m);if(w!==null)s.ordinalPattern=w.pattern,s.orderedDomain=w.orderedDomain;else if(s.dataType==="String"){let h=xe(S);h!==null&&(s.safeDistinctValues=h)}}}if(R.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let S=w=>R[Math.floor((R.length-1)*w)];s.quantiles={p05:S(.05),p25:S(.25),p75:S(.75),p95:S(.95)}}}if(!s.isMeasure&&f.size>0){let R=Array.from(f.entries()).sort((O,S)=>S[1]-O[1]),A=Ne(R.map(O=>O[0]),s.name,m);if(A!==null&&(s.geoKind=A.geoKind,s.geoMatchPct=A.geoMatchPct,A.geoAmbiguous&&(s.geoAmbiguous=!0),A.geoKind.indexOf("country")===0)){let O=me(R);O&&(s.dominantGeoRegion=O.dominantGeoRegion,s.dominantGeoRegionPct=O.dominantGeoRegionPct,s.geoRegionCount=O.regionCount)}}}updateColumnStats10(e,n,r,i,s,o,l){e>=10&&(n.blankCount=this._rows.length-r,n.distinctCount=i.size+(n.blankCount!=0?1:0),n.valueNature="Categorical",r>0&&(n.dataType==="Integer"||n.dataType==="Decimal"?n.valueNature=tt({dataType:n.dataType,isMeasure:!!n.isMeasure,name:n.name,distinct:i.size,nonblank:r,prec:s,maxval:o,minval:l}):n.dataType==="DateTime"&&(n.valueNature=n.dateWithTime?"Continuous":"Ordinal")))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((r,i)=>{r.isMeasure||e.push(i)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let n=new Set;for(let r of this._rows)n.add(JSON.stringify(e.map(i=>r[i])));return this._leafCardinality=n.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>String(o||"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z]+/),n=-1,r=-1,i=-1;if(this._cols.forEach((o,l)=>{let u=e(o.name),c=o.dataType==="Integer"||o.dataType==="Decimal";c&&n<0&&u.some(d=>d==="lat"||d==="latitude")?n=l:c&&r<0&&u.some(d=>d==="lon"||d==="lng"||d==="long"||d==="longitude")&&(r=l),i<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(i=l)}),n<0||r<0)return null;let s=[];for(let o of this._rows){let l=o[n],u=o[r],c=l==null||l===""?null:Number(l),d=u==null||u===""?null:Number(u);s.push({lat:c,lon:d,country:i>=0&&ae(this.STR(o[i]))?this.STR(o[i]):null})}return this._geoExtent=Ie(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;obfuscateString(e){return De(e,Ae)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(n=>{let r={};this._cols.forEach((i,s)=>{r[i.name]=n[s],this.emitLegacyAggAliases&&i.hostName&&i.hostName!==i.name&&!Object.prototype.hasOwnProperty.call(r,i.hostName)&&(r[i.hostName]=n[s])});for(let[i,s]of e)Object.prototype.hasOwnProperty.call(r,s.alias)||(r[s.alias]=n[i]);return r})}async getCSVAsync(e){let n=[],r=e?25:1e7,i=e?4e3:1e7,s=new Map;for(let l of this._rows){let u={};for(let c=0;c<this._cols.length;c++){let d=this._cols[c],f=l[c];if(this.STR(f)!=""){if(e&&d.dataType=="String")if(s.has(f))f=s.get(f);else{let m=this.obfuscateString(f);s.set(f,m),f=m}else if(d.dataType=="DateTime"&&!d.dateWithTime){let m=f instanceof Date?f:typeof f=="string"?ce(f)??new Date(f):new Date(f);f=(this.wholeDayIso(m)??m.toISOString().slice(0,10))+"T00:00:00.000Z"}i-=this.STR(f).length}else f=null;u[c]=f,--i}if(n.push(u),--r,r<=0||i<=0)break}return await et.unparse(n,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return et.unparse([this._cols.map((n,r)=>{if(this.emitLegacyAggAliases&&n.hostName)return this.STR(n.hostName);let i=e.get(r);return this.STR(i&&i.headerName?i.alias:n.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(n=>n==null?null:this.STR(n)),this._englishAliases=new Map}aliasesForCode(e){let n=fe(e,this._cols)?this.legacyAliases():[];for(let r of this.englishAliasesFor(e).values())n.push({name:r.name,alias:r.alias,reason:"english-implicit-agg"});return n}armAliasesForCode(e){return this.emitLegacyAggAliases=fe(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let n of this.liveEnglishAliases().values())e.push({name:n.name,alias:n.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let n of this._cols)n&&n.hostName&&n.hostName!==n.name&&e.push({name:this.STR(n.name),alias:this.STR(n.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let n=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return n;let r=String(e),i=new Set;for(let o of this._cols)o&&(i.add(this.STR(o.name)),o.hostName&&i.add(this.STR(o.hostName)));let s=new Map;for(let o=0;o<this._cols.length;o++){if(!this._cols[o])continue;let l=Be(this._hostQueryNames[o]).filter(u=>!i.has(u)&&ee(r,u));l.length===1&&s.set(l[0],[...s.get(l[0])??[],o])}for(let[o,l]of s){if(l.length!==1)continue;let u=this.STR(this._cols[l[0]].name);n.set(l[0],{name:u,alias:o,headerName:!ee(r,u)})}return n}liveEnglishAliases(){let e=new Map;for(let[n,r]of this._englishAliases){let i=this._cols?this._cols[n]:null;i&&this.STR(i.name)===r.name&&e.set(n,r)}return e}addRow(e,n){if(this.dedupRows){let r="";for(let s of e)r+=this.STR(s)+"~";let i=_e(r);if(this._rowHashes.has(i))return!1;this._rowHashes.add(i)}return this._rows.push(xn(e)),this._origIndices.push(n??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}reset(){this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map}setColumns(e){if(this._cols=e,!e||e.length===0)return;let n=new Set(e.map(r=>this.STR(r?.name)));for(let r of e){if(!r)continue;let i=this.STR(r.name),s=Ge(i);!s||s===i||n.has(s)||(n.delete(i),n.add(s),r.hostName=i,r.name=s)}}};export{Ie as a,at as b,ae as c,Nn as d,gt as e,pt as f,ht as g,bt as h,Fe as i,Ct as j,Ge as k,fe as l,Be as m,$e as n,Tt as o,Ve as p,Ke as q,Ln as r,Dn as s,On as t,ee as u,Lt as v,kn as w,Dt as x,Ot as y,ge as z,Xe as A,Zt as B,Xt as C,jt as D,tn as E,qe as F,Je as G,it as H,rt as I,An as J,Cn as K,Mn as L,tt as M,xn as N,nt as O};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
+
var o=(e,n,t,r={})=>({code:e,name:n,script:t,dir:"ltr",intl:e,aliases:[],wordBreaks:!0,compounds:!1,gluedPrefixes:[],foldSensitive:!1,...r}),g=Object.freeze([o("en","English","Latn"),o("nl","Dutch","Latn",{compounds:!0}),o("de","German","Latn",{compounds:!0}),o("fr","French","Latn"),o("es","Spanish","Latn"),o("pt","Portuguese","Latn"),o("it","Italian","Latn"),o("pl","Polish","Latn"),o("cs","Czech","Latn"),o("sk","Slovak","Latn"),o("sv","Swedish","Latn",{compounds:!0}),o("da","Danish","Latn",{compounds:!0}),o("nb","Norwegian Bokmal","Latn",{compounds:!0,aliases:["no"]}),o("fi","Finnish","Latn",{compounds:!0}),o("hu","Hungarian","Latn",{compounds:!0}),o("tr","Turkish","Latn"),o("ro","Romanian","Latn"),o("hr","Croatian","Latn"),o("id","Indonesian","Latn",{aliases:["in"]}),o("vi","Vietnamese","Latn",{foldSensitive:!0}),o("ru","Russian","Cyrl"),o("uk","Ukrainian","Cyrl"),o("el","Greek","Grek"),o("zh","Chinese (Simplified)","Hani",{intl:"zh-Hans",wordBreaks:!1}),o("ja","Japanese","Jpan",{wordBreaks:!1}),o("ko","Korean","Hang"),o("ar","Arabic","Arab",{dir:"rtl",gluedPrefixes:["\u0627\u0644","\u0648\u0627\u0644","\u0628\u0627\u0644","\u0641\u0627\u0644","\u0643\u0627\u0644","\u0644\u0644","\u0648","\u0641","\u0628","\u0643","\u0644"]}),o("he","Hebrew","Hebr",{dir:"rtl",aliases:["iw"],gluedPrefixes:["\u05D4","\u05D5","\u05D1","\u05DC","\u05DE","\u05E9","\u05DB","\u05D5\u05D4","\u05E9\u05D4","\u05DE\u05D4","\u05D5\u05D1","\u05D5\u05DC","\u05D5\u05DE","\u05D1\u05D4","\u05DC\u05D4"]}),o("hi","Hindi","Deva"),o("th","Thai","Thai",{wordBreaks:!1})]),m=Object.freeze(g.map(e=>e.code)),c=new Map(g.map(e=>[e.code,e])),L=new Map(g.flatMap(e=>e.aliases.map(n=>[n,e]))),y={nn:"nb"};function x(e){let n=String(e??"").trim().toLowerCase();return c.get(n)??L.get(n)}var h=Object.freeze([o("fa","Persian","Arab",{dir:"rtl"})]),j=Object.freeze([...m,...h.map(e=>e.code)]),S=new Map(h.map(e=>[e.code,e]));function d(e){let n=String(e??"").trim().toLowerCase();return x(n)??S.get(n)}function C(e){try{let n=Intl.getCanonicalLocales(e);return n.length?n[0]:null}catch{return null}}function b(e){let n=e.split("-"),t=n.find((a,i)=>i>0&&a.length===4);if(t)return t.toLowerCase()==="hant";try{let a=Intl.Locale;if(typeof a=="function"){let i=new a(e).maximize();if(i&&typeof i.script=="string")return i.script==="Hant"}}catch{}let r=n.find((a,i)=>i>0&&a.length===2);return!!r&&["TW","HK","MO"].includes(r.toUpperCase())}function T(e){try{return Intl.NumberFormat.supportedLocalesOf([e]).length>0}catch{return!1}}function K(e){let n=c.get("en"),t=String(e??"").trim().replace(/_/g,"-"),r=t?C(t):null;if(!r)return{code:"en",language:n,tier:1,intl:"en"};let a=r.split("-")[0].toLowerCase(),i=c.get(a)??L.get(a);if(i){let l=i.code==="zh"&&b(r)?2:1;return{code:i.code,language:i,tier:l,intl:r}}let u=y[a],s=u?c.get(u):n;return{code:s.code,language:s,tier:2,intl:T(r)?r:s.intl}}var N={\u0142:"l",\u0141:"L",\u0131:"i",\u00F8:"o",\u00D8:"O",\u0111:"d",\u0110:"D",\u00F0:"d",\u00D0:"D"},D=[1632,1776,2406,3664,65296],R=/[\u0300-\u036F]/g;function E(e){let n=N[e];if(n)return n;let t=e.codePointAt(0);for(let a of D)if(t>=a&&t<=a+9)return String.fromCharCode(48+t-a);if(t>=65313&&t<=65338||t>=65345&&t<=65370)return String.fromCharCode(t-65248);let r=e.normalize("NFD").replace(R,"");return r.length===1?r:e}function f(e){if(!e)return e??"";let n="";for(let t of e)n+=E(t);return n}var A=/([\p{Ll}\p{Nd}])(\p{Lu})/gu,_=/[_\-./]+/g,M=/[^\p{L}\p{M}\p{N}\x00-\x7F]/gu;function p(e){return e?String(e).normalize("NFC").replace(A,"$1 $2").replace(_," ").replace(M," ").toLowerCase().split(/\s+/).filter(n=>n.length>0):[]}function O(e){let n=p(e),t=p(f(String(e??"").normalize("NFC")));return{words:n,folded:t.length===n.length?t:n.map(f)}}var I=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]/u,w=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]+/gu;function U(e){return!!e&&I.test(e)}function V(e){return e?String(e).normalize("NFC").match(w)??[]:[]}var k=3;function P(e,n,t=k){return!e||!n||e.length<=n.length||!e.endsWith(n)?!1:Array.from(e.slice(0,e.length-n.length)).length>=t}var G=2;function H(e,n){let t=d(n);if(!e||!t||t.gluedPrefixes.length===0)return[];let r=[];for(let a of[...t.gluedPrefixes].sort((i,u)=>u.length-i.length))if(e.length>a.length&&e.startsWith(a)){let i=e.slice(a.length);Array.from(i).length>=G&&!r.includes(i)&&r.push(i)}return r}var z=2;function X(e,n,t){if(!e||!n)return null;let r=d(t);if(!r)return null;let a=n.normalize("NFC").toLowerCase();if(U(a))return Array.from(a).length<z?null:V(e).some(l=>l.includes(a))?"substring":null;let i=O(e),u=r.foldSensitive?i.words:i.folded,s=r.foldSensitive?a:f(n.normalize("NFC")).toLowerCase();return u.includes(s)?"word":r.compounds&&u.some(l=>P(l,s))?"suffix":r.gluedPrefixes.length&&u.some(l=>H(l,r.code).includes(s))?"prefix":null}function Q(e){return e!=null?e.toString():""}function ee(e,n){if(!e.length)return NaN;if(e.length===1)return e[0];let t=(e.length-1)*n,r=Math.floor(t),a=Math.ceil(t);return r===a?e[r]:e[r]+(e[a]-e[r])*(t-r)}function ne(e){if(!e)return 0;let n=0xcbf29ce484222325n,t=0x100000001b3n,r=n;for(let a=0;a<e.length;a++)r^=BigInt(e.charCodeAt(a)),r=r*t&0xFFFFFFFFFFFFFFFFn;return Number(r&0x1FFFFFFFFFFFFFn)}function te(){let e=typeof globalThis<"u"?globalThis:{};if(e.crypto&&typeof e.crypto.getRandomValues=="function"){let n=new Uint32Array(1);return e.crypto.getRandomValues(n),n[0]/4294967296}return Math.floor(Date.now()%4294967295)/4294967296}function re(e){return!!e&&e.isRefusal===!0}var ae=30;function oe(e){let n=Date.parse(e);if(isNaN(n))return null;let t=new Date(n);if(Y.test(e)||W.test(e.trim())||$.test(e))return t;let r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())),a=t.getFullYear();return a>=0&&a<100&&r.setUTCFullYear(a),r}function F(e){return!(e instanceof Date)||isNaN(e.getTime())?null:e.getUTCHours()===0&&e.getUTCMinutes()===0&&e.getUTCSeconds()===0&&e.getUTCMilliseconds()===0?"utc":e.getHours()===0&&e.getMinutes()===0&&e.getSeconds()===0&&e.getMilliseconds()===0?"local":null}function ie(e){let n=F(e);if(!n)return null;let t=e;if(n==="utc")return t.toISOString().slice(0,10);let r=a=>(a<10?"0":"")+a;return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}function v(e){let n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),t=e.getFullYear();return t>=0&&t<100&&n.setUTCFullYear(t),n}function B(e,n){let t=[];for(let r of e){if(!r||!/date|time/i.test(String(r.dataType??"")))continue;let a=0,i=!0;for(let u of n){let s=u?u[r.name]:void 0;if(s==null||s==="")continue;if(!(s instanceof Date)){i=!1;break}let l=F(s);if(l===null){i=!1;break}l==="local"&&a++}i&&a>0&&t.push(r.name)}return t}function se(e,n){let t=B(e,n);return t.length===0?{rows:n,columns:t}:{rows:n.map(a=>{if(!a)return a;let i={...a};for(let u of t){let s=i[u];s instanceof Date&&F(s)==="local"&&(i[u]=v(s))}return i}),columns:t}}var Y=/^\s*\d{4}(-\d{2}(-\d{2})?)?\s*$/,W=/(?:Z|[+-]\d{2}:?\d{2})$/i,$=/\b(?:GMT|UTC)\b/i;export{g as a,m as b,x as c,h as d,j as e,d as f,K as g,f as h,p as i,O as j,U as k,V as l,k as m,P as n,G as o,H as p,z as q,X as r,Q as s,ee as t,ne as u,te as v,re as w,ae as x,oe as y,F as z,ie as A,v as B,B as C,se as D};
|
package/dist/geoDetector.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a,b,c,d,e,f}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f}from"./chunk-6TVBXT4G.mjs";import"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-NFSQ4O5R.mjs";export{a as ZIP_NAME_TOKENS,f as buildGeoIsoColumn,c as detectGeo,b as hasAnyToken,e as isJoinGeoKind,d as toGeoIso};
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a as qn,b as Xn}from"./chunk-UQU75XXR.mjs";import{a as Yn,b as Zn,c as Jn,d as et,e as m,f as nt,g as tt,h as rt}from"./chunk-BIC73LQV.mjs";import{a as $n,b as Un,c as Hn,d as jn,e as Qn}from"./chunk-PK6KRKNE.mjs";import{A as En,B as wn,C as An,D as Ln,E as _n,F as On,G as kn,H as Dn,I as Vn,J as Gn,K as Kn,L as Wn,M as zn,O as Bn,a as en,b as nn,c as tn,d as rn,e as ln,f as un,g as cn,h as dn,i as mn,j as fn,k as pn,l as gn,m as yn,n as hn,o as Cn,p as bn,q as Sn,r as Rn,s as xn,t as Pn,u as vn,v as Tn,w as Nn,x as Fn,y as In,z as Mn}from"./chunk-ZVHCLXKO.mjs";import{a as on}from"./chunk-QEH7WTLB.mjs";import{a as sn,b as an}from"./chunk-2LR73DNS.mjs";import{a as q,b as X,c as Xe,d as Ye,e as Ze,f as Je}from"./chunk-C5I73OM2.mjs";import{a as M,f as E,g as S,h as w,i as V,j as Ke,k as We,l as Q,m as y,n as ze,o as Be,p as $e,q as A,r as Ue,s as He,t as je,u as Qe,v as G,w as qe}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as De,b as Ve,c as Ge}from"./chunk-35Z7JCND.mjs";import{A as ke,a as me,b as fe,c as pe,d as ge,e as ye,f as he,g as Ce,h as be,i as Se,j as Re,k as xe,l as Pe,m as ve,n as Te,o as Ne,p as Fe,r as D,s as Ie,t as Me,u as Ee,v as we,w as Ae,x as Le,y as _e,z as Oe}from"./chunk-ILHBRGIO.mjs";var K=2,J=400;function z(e){return!!E(e)}function T(e){let n=new Set;for(let t of e){if(t==null)continue;let o=M(String(t));if(!w(o)&&!n.has(o)&&(n.add(o),n.size>=J))break}return Array.from(n)}function v(e){let n=T(e);if(n.length===0||B(e)<95)return!1;let t=n.filter(u=>z(u)&&!y(u)).length,o=n.filter(u=>!z(u)&&!!y(u)).length;return t>=1&&t>=o}function Y(e,n){if(!y(e))return!1;let t=E(e);return t?n==="world"?!0:Q.has(t):!1}function B(e){let n=T(e);if(n.length===0)return 0;let t=0;for(let o of n)z(o)&&t++;return Math.round(t/n.length*1e3)/10}function L(e){let n=T(e);if(n.length===0)return 0;let t=0;for(let o of n)y(o)&&t++;return Math.round(t/n.length*1e3)/10}function U(e){let n=new Set;for(let t of e){if(t==null)continue;let o=String(t).trim();if(!w(M(o))&&!n.has(o)&&(n.add(o),n.size>=J))break}return Array.from(n)}function $(e){let n=U(e);if(n.length===0)return 0;let t=0;for(let o of n)A(o).length>0&&t++;return Math.round(t/n.length*1e3)/10}function Z(e,n){return X(n,q)?!0:U(e).some(t=>/^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/,"")))}function ot(e,n){let t=T(e);if(t.length===0)return 0;let o=0;for(let u of t)G(u,n)&&o++;return Math.round(o/t.length*1e3)/10}function W(e,n){let t=0;for(let o of T(e))n(o)&&t++;return t}function it(e,n){let t=0;for(let o of U(e))n(o)&&t++;return t}function st(e,n,t,o,u){let a=[],s=[],i={},h={},x=new Set(e),f=r=>n.map(l=>l[r]);for(let r of["city","country"]){let l=t?.[r];l&&x.has(l)&&(i[r]=l)}let ue=new Set(u??e);for(let r of["lat","lon"]){let l=t?.[r];l&&ue.has(l)&&(i[r]=l)}let C=t?.zip;if(C&&x.has(C)){let r=f(C),l=$(r);l<95?s.push(`zip=${C} (only ${l}% of values read as ZIPs)`):Z(r,C)?i.zip=C:s.push(`zip=${C} (all values are 3-4 digits with nothing to say they are postal)`)}let g=t?.state;if(g&&x.has(g)){let r=f(g),l=T(r);l.length>0&&l.every(d=>Y(d,o))?s.push(`state=${g} (every value is "CA", which is both Canada and California)`):v(r)?(s.push(`state=${g} (every value is a country, not a state)`),i.country||(i.country=g)):L(r)<95?s.push(`state=${g} (only ${L(r)}% of values are states/provinces)`):i.state=g}let b=new Set(Object.values(i).filter(Boolean)),F=e.filter(r=>!b.has(r)&&!r.startsWith("__"));if(!i.state){let r=null;for(let l of F){let d=f(l);if(v(d))continue;let p=L(d);if(p<95)continue;let k=W(d,I=>!!y(I)),de=W(d,I=>!!y(I)&&!Y(I,o));k<K&&de<1||(!r||p>r.pct)&&(r={name:l,pct:p})}r&&(i.state=r.name,b.add(r.name),a.push(`state=${r.name} (${r.pct}% states/provinces)`))}if(!i.zip)for(let r of F){if(b.has(r))continue;let l=f(r),d=$(l);if(!(d<95)&&Z(l,r)&&!(it(l,p=>A(p).length>0)<K)){i.zip=r,b.add(r),a.push(`zip=${r} (${d}% ZIP codes)`);break}}let P=i.country;if(!P||!v(f(P))){let r=null;for(let l of F){if(b.has(l)||!v(f(l)))continue;let d=B(f(l));(!r||d>r.pct)&&(r={name:l,pct:d})}r&&(P&&(s.push(`country=${P} (only ${B(f(P))}% of values are country identifiers; using ${r.name} instead)`),h.country=P),i.country=r.name,b.add(r.name),a.push(`country=${r.name}`))}if(!i.city){let r=null;for(let l of F){if(b.has(l))continue;let d=f(l),p=ot(d,o);p<V||W(d,k=>G(k,o))<K||(!r||p>r.pct)&&(r={name:l,pct:p})}r&&(i.city=r.name,a.push(`city=${r.name} (${r.pct}% known cities)`))}let H=i.country?f(i.country):[],_=!!i.country&&v(H),ce=_?new Set(H.map(r=>E(r==null?null:String(r))).filter(Boolean)).size:0,j=_&&ce>=2,O=!!(i.lat&&i.lon)&&n.some(r=>{let l=+String(r[i.lat]??"").trim(),d=+String(r[i.lon]??"").trim();return isFinite(l)&&isFinite(d)&&l>=-90&&l<=90&&d>=-180&&d<=180&&String(r[i.lat]??"").trim()!==""&&String(r[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!O&&s.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!j&&!(i.city||i.state||i.zip||O)&&s.push(_?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||j||O)?i:null,backfilled:a,refused:s,...Object.keys(h).length?{labelFallback:h}:{}}}function ee(e,n){let t=n?.freemiumMaxShapeColumns;return typeof t!="number"||!isFinite(t)||t<1?null:!isFinite(e)||e<=t?0:Math.round(e-t)}function at(e,n,t){let o=ee(e,n);if(o===null||o<=0)return null;let u=typeof n?.freemiumColumnCapPivot=="number"?n.freemiumColumnCapPivot:4,a=o>u?n?.freemiumColumnCapMessageMany:n?.freemiumColumnCapMessageFew;if(typeof a!="string"||a.trim().length===0)return null;let s=a.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=ne(t);return i.length===0?s:s+" "+i.join(" ")}function ne(e){if(!e||e.length===0)return[];let n=[],t=new Map,o=new Map;for(let a of e){let s=typeof a?.dateGroupId=="string"?a.dateGroupId.trim():"";if(s!==""&&(t.has(s)||(n.push(s),t.set(s,0)),a.isDatePart===!0&&t.set(s,t.get(s)+1),a.isReassembledDate===!0&&!o.has(s))){let i=typeof a.sourceField=="string"?a.sourceField.trim():"",h=typeof a.name=="string"?a.name.trim():"",x=i!==""?i:h;x!==""&&o.set(s,x)}}let u=[];for(let a of n){let s=o.get(a),i=t.get(a)??0;!s||i===0||u.push(`'${s}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return u}var c=e=>e==null?"":String(e),R=e=>e===!0,te=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let n=Number(e);return Number.isFinite(n)?n:null}return null},lt=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function re(e,n){let t={};for(let[o,u]of lt){let a=c(m(e,n+u));a&&(t[o]=a)}return t}function ut(e){let n=i=>m(e,i),t=n("retryAfterSeconds"),o=n("overrideThumbnailUpload"),u=n("forceThumbnailUpload"),a=re(e,"point"),s=re(e,"destPoint");return Object.keys(s).length&&(a.dest=s),{errorMessage:c(n("errorMessage")),code:c(n("code")),language:c(n("language")),version:Number(n("version")??0),codeSummary:c(n("codeSummary")),chartName:c(n("chartName")??n("chartType")),finalChartName:c(n("finalChartName")),warningMessage:c(n("warningMessage")),outputHash:c(n("outputHash")),validatorToken:c(n("validatorToken")),editCodeKey:c(n("editCodeKey")),signedLLMRequestID:c(n("signedLLMRequestID")),userReply:c(n("userReply")),userReplyOutcome:c(n("userReplyOutcome")),improvementSuggestion:c(n("improvementSuggestion")),geoColumn:c(n("geoColumn")),geoKind:c(n("geoKind")),geoPointCols:Object.keys(a).length?a:null,creditBalanceBefore:te(n("creditBalanceBefore")),creditCost:te(n("creditCost")),isServiceError:R(n("isServiceError")),isRateLimited:R(n("isRateLimited")),isRefusal:R(n("isRefusal")),isVersionNotFound:R(n("isVersionNotFound")),isGenerationCancelled:R(n("isGenerationCancelled")),retryAfterSeconds:typeof t=="number"&&Number.isFinite(t)?t:null,servedCorrelationId:c(n("servedCorrelationId")),...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof u=="boolean"?{forceThumbnailUpload:u}:{}}}var oe=e=>e==null?void 0:Number(e),N=e=>c(e)||void 0;function ct(e){let n=m(e,"charts"),t=m(e,"refused"),o=Array.isArray(n)?n.map(a=>{let s=h=>m(a,h),i=s("recommended");return{name:c(s("chartTypeName")??s("name")),description:c(s("description")??s("chartDesc")),rank:oe(s("rank")),score:oe(s("score")),renderer:N(s("renderer")),language:N(s("language")),isPreview:R(s("isPreview")),recommended:typeof i=="boolean"?i:void 0,viaProjection:N(s("viaProjection")),viaProjectionKey:N(s("viaProjectionKey")),detailNote:N(s("detailNote"))}}).filter(a=>a.name):null,u=Array.isArray(t)?t.map(a=>({name:c(m(a,"chartTypeName")??m(a,"name")),reason:c(m(a,"reason")),isVeto:R(m(a,"isVeto"))})).filter(a=>a.name):[];return{errorMessage:c(m(e,"errorMessage")),charts:o,refused:u,noFitSummary:c(m(e,"noFitSummary"))}}function dt(e){return!e||typeof e!="object"?null:{status:String(m(e,"status")??""),verdictReason:m(e,"verdictReason")??null,instruction:m(e,"instruction")??null,fix:m(e,"fix")??null,errorMessage:m(e,"errorMessage")??null}}function mt(e){let n=e.linkNonce?(e.linkNonce()??"").trim():null,t=n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:t.licenseKey,licensee:t.licensee,secretKey:t.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:n}}function ft(e){let{width:n,height:t}=e.measure();return{request:{height:t,width:n},hints:{viewportWidth:n,viewportHeight:t}}}function pt(e){let n=0;for(let t of e){if(t.isMeasure)continue;let o=t.distinctCount;typeof o=="number"&&o>n&&(n=o)}return n}function ie(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let n=e.settingVersion??null;if(e.genNew)return{version:n,fetchOnly:void 0};let t=(n??0)>0?n:null,o=(e.codeVersion??0)>0?e.codeVersion:null,u=t??o??n;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function gt(e){let n=e.fetchCorrelationId!=null,o=n||e.recoveryFetchVersion!=null?!1:e.genNew,u=ie({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:n,settingVersion:e.settingVersion,codeVersion:e.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0}}function yt(e){let n=t=>e.renderers.has(t);return{supportsD3:n("D3"),supportsPlotly:n("PLOTLY"),supportsVega:n("VEGA")}}function ht(e){let n=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??n,maxTries:n}}function Ct(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function se(e,n){return e!=null&&n!=null&&e!==n}function bt(e,n){return e?se(n.capturedFor,n.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:n.atMs>0?Math.max(0,Math.round(n.nowMs-n.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var St=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function ae(e){let n=String(e??"").trim().toLowerCase();return St[n]??n}function le(e){let n="";for(let t of e)n+=JSON.stringify([String(t.name??""),t.isMeasure?"M":"D",ae(t.dataType)]);return n}function Rt(e){return D(le(e))}var xt=2,Pt=3,vt=4,Tt=64,Nt=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict"});function Ft(e){return!!e&&!e.includes("|")&&!e.includes(",")}function It(e,n,t,o){let u=`${e},${n}|${t}`;return o?`${u}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:u}export{V as CITY_ROLE_MATCH_PCT,Nt as CLIENT_EVENT_KINDS,Re as COMPOUND_MIN_STEM,Fn as DEFAULT_GAP_FACTOR,Ee as DEFAULT_TEMPERATURE,Ie as GET_RANDOM,Pe as GLUED_STEM_MIN,un as INTENSIVE_SUFFIX_TOKENS,ln as INTENSIVE_WORD_TOKENS,Bn as IndexedText,In as MAX_RUN_BOUNDS,dn as POSITIONAL_SUFFIX_TOKENS,cn as POSITIONAL_WORD_TOKENS,qn as PREVIEW_OMITTED_FIELDS,S as ROLE_MATCH_PCT,wn as SERIES_COMPLETENESS_MAX_LISTED,An as SERIES_COMPLETENESS_MIN_FILL,Ln as SERIES_KEY_MAX_DISTINCT,vt as SEV_ERROR,xt as SEV_INFO,Tt as SEV_USER_PRESENTED,Pt as SEV_WARNING,D as SIMPLE_STRING_HASH,Fe as STR,Te as SUBSTRING_MIN,me as SUPPORTED_LANGUAGES,fe as SUPPORTED_LANGUAGE_CODES,L as admin1MatchPct,Sn as allowedAggregations,Je as buildGeoIsoColumn,je as buildGeoPointColumns,yt as capabilityFields,qe as cityMatchPct,Qe as cityTagsFor,Wn as classifyAdditivity,bn as classifyForAggregation,zn as classifyNumericValueNature,Gn as classifyTemporal,gn as codeNeedsLegacyAggNames,vn as codeReadsColumn,Tn as codeReadsColumnsByRoleOrPosition,pn as collapseRepeatedAggPrefix,Nn as columnsTheCodeReads,tn as countryRegion,mt as credentialFields,$n as decimalSeparatorOf,Rn as defaultAggregation,Un as detectDecimalSeparator,on as detectFormatSignature,Xe as detectGeo,Ge as detectOrdinalDomain,Vn as detectTextDatePattern,Zn as encodePayload,jn as engineTypeForSqlType,yn as englishImplicitAggNames,It as eventLogLine,gt as fetchFields,ye as foldName,at as freemiumColumnCapRefusal,ee as freemiumColumnsOverCap,ne as freemiumDateHierarchyClauses,ve as gluedPrefixStems,Yn as gzipWireText,fn as hasDefaultAggPrefix,be as hasUnsegmentedScript,Kn as hostAggHint,Qn as ingest,xn as isAggregationAllowed,w as isBlankLike,We as isCityTableLoaded,Me as isDeterministicRefusal,Ft as isEventLogCode,Ue as isGeoPointAmbiguity,Dn as isIdentifierName,Ze as isJoinGeoKind,nt as isNdjsonContentType,De as isOrdinalFriendlyName,Jn as keyedSigner,Ct as leafCardinalityField,Oe as localMidnightDateColumns,_e as localMidnightToUtcDay,v as looksLikeCountryColumn,Ne as matchNameToken,pt as maxNonMeasureCardinality,En as measureCadence,kn as measureSeriesCompleteness,et as messageSignature,an as monthLookupFor,Cn as nameLooksIntensiveRate,hn as nameLooksPositional,he as nameWords,ze as normalizeCountry,ke as normalizeLocalMidnightDates,sn as normalizeMonthKey,M as normalizePlaceName,$e as normalizeZip5,bt as offeredShortlistFor,we as parseDateStable,ut as parseGenerateResponse,Hn as parseNumberText,ct as parseQualifyResponse,dt as parseReviewVerdict,Mn as parseTemporalPoint,Xn as payloadPreview,On as pickSeriesColumn,rt as readGenerateStream,Ce as readName,m as readWireField,Ke as registerCityTable,nn as registerIso3Regions,y as resolveAdmin1,ie as resolveFetchVersion,He as resolveGeoPoint,ge as resolveLanguage,st as resolvePointRoles,ht as retryFields,Ve as safeDistinctValuesToShip,le as schemaIdentity,Rt as schemaIdentityKey,ae as schemaTypeFamily,_n as seriesKeyVerdict,Pn as shareOfTotalIsHonest,se as shortlistIsStale,mn as stripHostAggPrefix,rn as summarizeCountryRegions,en as summarizeGeoExtent,pe as supportedLanguage,Ye as toGeoIso,Se as unsegmentedRuns,ft as viewportFields,Ae as wholeDayFrame,Le as wholeDayIso,tt as wireResponseFromFetch,xe as wordEndsWith,$ as zipMatchPct,A as zipPrefixCandidates,Be as zipToPrefix3};
|
|
2
|
+
import{a as rt,b as ot}from"./chunk-UQU75XXR.mjs";import{a as it,b as at,c as st,d as lt,e as f,f as ut,g as ct,h as dt}from"./chunk-JF3BJI7F.mjs";import{a as Zn,b as Jn,c as et,d as nt,e as tt}from"./chunk-FNEHWEWX.mjs";import{A as Dn,B as Gn,C as qn,D as zn,E as Kn,F as Un,G as Bn,H as jn,I as Wn,J as $n,K as Hn,L as Qn,M as Yn,O as Xn,a as un,b as cn,c as dn,d as mn,e as yn,f as hn,g as Cn,h as bn,i as Rn,j as Sn,k as vn,l as xn,m as En,n as Ln,o as Pn,p as Nn,q as An,r as Tn,s as _n,t as In,u as Mn,v as Fn,w as wn,x as kn,y as Vn,z as On}from"./chunk-KKSQBV76.mjs";import{a as fn}from"./chunk-QEH7WTLB.mjs";import{a as pn,b as gn}from"./chunk-2LR73DNS.mjs";import{a as Z,b as J,c as on,d as an,e as sn,f as ln}from"./chunk-6TVBXT4G.mjs";import{a as _,f as I,g as S,h as M,i as q,j as He,k as Qe,l as X,m as h,n as Ye,o as Xe,p as Ze,q as F,r as Je,s as en,t as nn,u as tn,v as z,w as rn}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as je,b as We,c as $e}from"./chunk-6Q3MQ2MK.mjs";import{A as ze,B as Ke,C as Ue,D as Be,a as Ce,b as be,c as Re,d as Se,e as ve,f as D,g as xe,h as Ee,i as Le,j as Pe,k as Ne,l as Ae,m as Te,n as _e,o as Ie,p as Me,q as Fe,r as we,s as ke,u as G,v as Ve,w as Oe,x as De,y as Ge,z as qe}from"./chunk-NFSQ4O5R.mjs";var K=2,te=400;function B(e){return!!I(e)}function P(e){let n=new Set;for(let r of e){if(r==null)continue;let o=_(String(r));if(!M(o)&&!n.has(o)&&(n.add(o),n.size>=te))break}return Array.from(n)}function L(e){let n=P(e);if(n.length===0||j(e)<95)return!1;let r=n.filter(u=>B(u)&&!h(u)).length,o=n.filter(u=>!B(u)&&!!h(u)).length;return r>=1&&r>=o}function ee(e,n){if(!h(e))return!1;let r=I(e);return r?n==="world"?!0:X.has(r):!1}function j(e){let n=P(e);if(n.length===0)return 0;let r=0;for(let o of n)B(o)&&r++;return Math.round(r/n.length*1e3)/10}function w(e){let n=P(e);if(n.length===0)return 0;let r=0;for(let o of n)h(o)&&r++;return Math.round(r/n.length*1e3)/10}function $(e){let n=new Set;for(let r of e){if(r==null)continue;let o=String(r).trim();if(!M(_(o))&&!n.has(o)&&(n.add(o),n.size>=te))break}return Array.from(n)}function W(e){let n=$(e);if(n.length===0)return 0;let r=0;for(let o of n)F(o).length>0&&r++;return Math.round(r/n.length*1e3)/10}function ne(e,n){return J(n,Z)?!0:$(e).some(r=>/^\d{5}(-\d{4})?$/.test(r.replace(/\.0+$/,"")))}function mt(e,n){let r=P(e);if(r.length===0)return 0;let o=0;for(let u of r)z(u,n)&&o++;return Math.round(o/r.length*1e3)/10}function U(e,n){let r=0;for(let o of P(e))n(o)&&r++;return r}function ft(e,n){let r=0;for(let o of $(e))n(o)&&r++;return r}function pt(e,n,r,o,u){let l=[],s=[],a={},C={},x=new Set(e),p=i=>n.map(c=>c[i]);for(let i of["city","country"]){let c=r?.[i];c&&x.has(c)&&(a[i]=c)}let ge=new Set(u??e);for(let i of["lat","lon"]){let c=r?.[i];c&&ge.has(c)&&(a[i]=c)}let b=r?.zip;if(b&&x.has(b)){let i=p(b),c=W(i);c<95?s.push(`zip=${b} (only ${c}% of values read as ZIPs)`):ne(i,b)?a.zip=b:s.push(`zip=${b} (all values are 3-4 digits with nothing to say they are postal)`)}let y=r?.state;if(y&&x.has(y)){let i=p(y),c=P(i);c.length>0&&c.every(m=>ee(m,o))?s.push(`state=${y} (every value is "CA", which is both Canada and California)`):L(i)?(s.push(`state=${y} (every value is a country, not a state)`),a.country||(a.country=y)):w(i)<95?s.push(`state=${y} (only ${w(i)}% of values are states/provinces)`):a.state=y}let R=new Set(Object.values(a).filter(Boolean)),A=e.filter(i=>!R.has(i)&&!i.startsWith("__"));if(!a.state){let i=null;for(let c of A){let m=p(c);if(L(m))continue;let g=w(m);if(g<95)continue;let O=U(m,T=>!!h(T)),he=U(m,T=>!!h(T)&&!ee(T,o));O<K&&he<1||(!i||g>i.pct)&&(i={name:c,pct:g})}i&&(a.state=i.name,R.add(i.name),l.push(`state=${i.name} (${i.pct}% states/provinces)`))}if(!a.zip)for(let i of A){if(R.has(i))continue;let c=p(i),m=W(c);if(!(m<95)&&ne(c,i)&&!(ft(c,g=>F(g).length>0)<K)){a.zip=i,R.add(i),l.push(`zip=${i} (${m}% ZIP codes)`);break}}let E=a.country;if(!E||!L(p(E))){let i=null;for(let c of A){if(R.has(c)||!L(p(c)))continue;let m=j(p(c));(!i||m>i.pct)&&(i={name:c,pct:m})}i&&(E&&(s.push(`country=${E} (only ${j(p(E))}% of values are country identifiers; using ${i.name} instead)`),C.country=E),a.country=i.name,R.add(i.name),l.push(`country=${i.name}`))}if(!a.city){let i=null;for(let c of A){if(R.has(c))continue;let m=p(c),g=mt(m,o);g<q||U(m,O=>z(O,o))<K||(!i||g>i.pct)&&(i={name:c,pct:g})}i&&(a.city=i.name,l.push(`city=${i.name} (${i.pct}% known cities)`))}let Q=a.country?p(a.country):[],k=!!a.country&&L(Q),ye=k?new Set(Q.map(i=>I(i==null?null:String(i))).filter(Boolean)).size:0,Y=k&&ye>=2,V=!!(a.lat&&a.lon)&&n.some(i=>{let c=+String(i[a.lat]??"").trim(),m=+String(i[a.lon]??"").trim();return isFinite(c)&&isFinite(m)&&c>=-90&&c<=90&&m>=-180&&m<=180&&String(i[a.lat]??"").trim()!==""&&String(i[a.lon]??"").trim()!==""});return a.lat&&a.lon&&!V&&s.push(`lat/lon=${a.lat}/${a.lon} (no row holds a usable coordinate pair)`),a.country&&!Y&&!(a.city||a.state||a.zip||V)&&s.push(k?`country=${a.country} (every row resolves to the same country - nothing to place apart)`:`country=${a.country} (values are not country identifiers)`),{bind:!!(a.city||a.state||a.zip||Y||V)?a:null,backfilled:l,refused:s,...Object.keys(C).length?{labelFallback:C}:{}}}var t=(e,...n)=>({part:e,langs:Object.freeze(n)}),H=Object.freeze({jaar:t("year","nl"),kwartaal:t("quarter","nl"),maand:t("month","nl"),dag:t("day","nl","sv","da","nb"),jahr:t("year","de"),quartal:t("quarter","de"),monat:t("month","de"),tag:t("day","de"),ann\u00E9e:t("year","fr"),mois:t("month","fr"),jour:t("day","fr"),trimestre:t("quarter","fr","es","pt","it"),a\u00F1o:t("year","es"),mes:t("month","es"),d\u00EDa:t("day","es"),ano:t("year","pt"),m\u00EAs:t("month","pt"),dia:t("day","pt"),anno:t("year","it"),mese:t("month","it"),giorno:t("day","it"),\u0433\u043E\u0434:t("year","ru"),\u043C\u0435\u0441\u044F\u0446:t("month","ru"),\u0440\u0456\u043A:t("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:t("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:t("quarter","ru","uk"),\u0434\u0435\u043D\u044C:t("day","ru","uk"),rok:t("year","pl","cs","sk"),kwarta\u0142:t("quarter","pl"),miesi\u0105c:t("month","pl"),dzie\u0144:t("day","pl"),\u010Dtvrtlet\u00ED:t("quarter","cs"),m\u011Bs\u00EDc:t("month","cs"),den:t("day","cs"),\u0161tvr\u0165rok:t("quarter","sk"),mesiac:t("month","sk"),de\u0148:t("day","sk"),\u00E5r:t("year","sv","da","nb"),kvartal:t("quarter","sv","da","nb"),m\u00E5nad:t("month","sv"),m\u00E5ned:t("month","da","nb"),vuosi:t("year","fi"),vuosinelj\u00E4nnes:t("quarter","fi"),kuukausi:t("month","fi"),p\u00E4iv\u00E4:t("day","fi"),\u00E9v:t("year","hu"),negyed\u00E9v:t("quarter","hu"),h\u00F3nap:t("month","hu"),nap:t("day","hu"),y\u0131l:t("year","tr"),\u00E7eyrek:t("quarter","tr"),ay:t("month","tr"),g\u00FCn:t("day","tr"),\u03AD\u03C4\u03BF\u03C2:t("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:t("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:t("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:t("day","el"),an:t("year","ro"),trimestru:t("quarter","ro"),lun\u0103:t("month","ro"),zi:t("day","ro"),godina:t("year","hr"),tromjese\u010Dje:t("quarter","hr"),mjesec:t("month","hr"),dan:t("day","hr"),\u5E74:t("year","ja","zh"),\u56DB\u534A\u671F:t("quarter","ja"),\u5B63\u5EA6:t("quarter","zh"),\u6708:t("month","ja","zh"),\u65E5:t("day","ja","zh"),\uC5F0\uB3C4:t("year","ko"),\uBD84\uAE30:t("quarter","ko"),\uC6D4:t("month","ko"),\uC77C:t("day","ko"),tahun:t("year","id"),kuartal:t("quarter","id"),triwulan:t("quarter","id"),bulan:t("month","id"),hari:t("day","id"),n\u0103m:t("year","vi"),qu\u00FD:t("quarter","vi"),th\u00E1ng:t("month","vi"),ng\u00E0y:t("day","vi"),\u0E1B\u0E35:t("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:t("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:t("month","th"),\u0E27\u0E31\u0E19:t("day","th"),\u0627\u0644\u0633\u0646\u0629:t("year","ar"),\u0633\u0646\u0629:t("year","ar"),\u0627\u0644\u0639\u0627\u0645:t("year","ar"),\u0639\u0627\u0645:t("year","ar"),\u0627\u0644\u0631\u0628\u0639:t("quarter","ar"),\u0631\u0628\u0639:t("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":t("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:t("month","ar"),\u0634\u0647\u0631:t("month","ar"),\u0627\u0644\u064A\u0648\u0645:t("day","ar"),\u064A\u0648\u0645:t("day","ar"),\u05E9\u05E0\u05D4:t("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:t("quarter","he"),\u05D7\u05D5\u05D3\u05E9:t("month","he"),\u05D9\u05D5\u05DD:t("day","he"),\u0935\u0930\u094D\u0937:t("year","hi"),\u0938\u093E\u0932:t("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:t("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:t("month","hi"),\u092E\u093E\u0939:t("month","hi"),\u0926\u093F\u0928:t("day","hi"),\u0633\u0627\u0644:t("year","fa"),\u0645\u0627\u0647:t("month","fa"),\u0631\u0648\u0632:t("day","fa")}),gt=Object.freeze(Array.from(new Set(Object.values(H).flatMap(e=>e.langs)))),re=Object.freeze(["fa","ar","he","th"]),oe=1900,ie=2100;function yt(e,n){let r=[],o=D(n);try{o&&r.push(e.toLocaleLowerCase(o.intl))}catch{}let u=e.toLowerCase();return r.includes(u)||r.push(u),r}function ht(e,n){let r=String(e??"").trim().normalize("NFC");if(!r)return null;for(let o of yt(r,n)){let u=H[o];if(u&&u.langs.includes(n))return u.part}return null}function Ct(e,n){return re.includes(e)?typeof n=="number"&&Number.isFinite(n)&&n>=oe&&n<=ie:!0}function ae(e,n){let r=n?.freemiumMaxShapeColumns;return typeof r!="number"||!isFinite(r)||r<1?null:!isFinite(e)||e<=r?0:Math.round(e-r)}function bt(e,n,r){let o=ae(e,n);if(o===null||o<=0)return null;let u=typeof n?.freemiumColumnCapPivot=="number"?n.freemiumColumnCapPivot:4,l=o>u?n?.freemiumColumnCapMessageMany:n?.freemiumColumnCapMessageFew;if(typeof l!="string"||l.trim().length===0)return null;let s=l.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),a=se(r);return a.length===0?s:s+" "+a.join(" ")}function se(e){if(!e||e.length===0)return[];let n=[],r=new Map,o=new Map;for(let l of e){let s=typeof l?.dateGroupId=="string"?l.dateGroupId.trim():"";if(s!==""&&(r.has(s)||(n.push(s),r.set(s,0)),l.isDatePart===!0&&r.set(s,r.get(s)+1),l.isReassembledDate===!0&&!o.has(s))){let a=typeof l.sourceField=="string"?l.sourceField.trim():"",C=typeof l.name=="string"?l.name.trim():"",x=a!==""?a:C;x!==""&&o.set(s,x)}}let u=[];for(let l of n){let s=o.get(l),a=r.get(l)??0;!s||a===0||u.push(`'${s}' is a date hierarchy and counts as ${a+1} fields - bind the date itself instead of its hierarchy.`)}return u}var d=e=>e==null?"":String(e),v=e=>e===!0,le=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let n=Number(e);return Number.isFinite(n)?n:null}return null},Rt=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function ue(e,n){let r={};for(let[o,u]of Rt){let l=d(f(e,n+u));l&&(r[o]=l)}return r}function St(e){let n=a=>f(e,a),r=n("retryAfterSeconds"),o=n("overrideThumbnailUpload"),u=n("forceThumbnailUpload"),l=ue(e,"point"),s=ue(e,"destPoint");return Object.keys(s).length&&(l.dest=s),{errorMessage:d(n("errorMessage")),code:d(n("code")),language:d(n("language")),version:Number(n("version")??0),codeSummary:d(n("codeSummary")),chartName:d(n("chartName")??n("chartType")),finalChartName:d(n("finalChartName")),warningMessage:d(n("warningMessage")),outputHash:d(n("outputHash")),validatorToken:d(n("validatorToken")),editCodeKey:d(n("editCodeKey")),signedLLMRequestID:d(n("signedLLMRequestID")),userReply:d(n("userReply")),userReplyOutcome:d(n("userReplyOutcome")),improvementSuggestion:d(n("improvementSuggestion")),geoColumn:d(n("geoColumn")),geoKind:d(n("geoKind")),geoPointCols:Object.keys(l).length?l:null,creditBalanceBefore:le(n("creditBalanceBefore")),creditCost:le(n("creditCost")),isServiceError:v(n("isServiceError")),isRateLimited:v(n("isRateLimited")),isRefusal:v(n("isRefusal")),isVersionNotFound:v(n("isVersionNotFound")),isGenerationCancelled:v(n("isGenerationCancelled")),retryAfterSeconds:typeof r=="number"&&Number.isFinite(r)?r:null,servedCorrelationId:d(n("servedCorrelationId")),...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof u=="boolean"?{forceThumbnailUpload:u}:{}}}var ce=e=>e==null?void 0:Number(e),N=e=>d(e)||void 0;function vt(e){let n=f(e,"charts"),r=f(e,"refused"),o=Array.isArray(n)?n.map(l=>{let s=C=>f(l,C),a=s("recommended");return{name:d(s("chartTypeName")??s("name")),description:d(s("description")??s("chartDesc")),rank:ce(s("rank")),score:ce(s("score")),renderer:N(s("renderer")),language:N(s("language")),isPreview:v(s("isPreview")),recommended:typeof a=="boolean"?a:void 0,viaProjection:N(s("viaProjection")),viaProjectionKey:N(s("viaProjectionKey")),detailNote:N(s("detailNote"))}}).filter(l=>l.name):null,u=Array.isArray(r)?r.map(l=>({name:d(f(l,"chartTypeName")??f(l,"name")),reason:d(f(l,"reason")),isVeto:v(f(l,"isVeto"))})).filter(l=>l.name):[];return{errorMessage:d(f(e,"errorMessage")),charts:o,refused:u,noFitSummary:d(f(e,"noFitSummary"))}}function xt(e){return!e||typeof e!="object"?null:{status:String(f(e,"status")??""),verdictReason:f(e,"verdictReason")??null,instruction:f(e,"instruction")??null,fix:f(e,"fix")??null,errorMessage:f(e,"errorMessage")??null}}function Et(e){let n=e.linkNonce?(e.linkNonce()??"").trim():null,r=n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:r.licenseKey,licensee:r.licensee,secretKey:r.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:n}}function Lt(e){let{width:n,height:r}=e.measure();return{request:{height:r,width:n},hints:{viewportWidth:n,viewportHeight:r}}}function Pt(e){let n=0;for(let r of e){if(r.isMeasure)continue;let o=r.distinctCount;typeof o=="number"&&o>n&&(n=o)}return n}function de(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let n=e.settingVersion??null;if(e.genNew)return{version:n,fetchOnly:void 0};let r=(n??0)>0?n:null,o=(e.codeVersion??0)>0?e.codeVersion:null,u=r??o??n;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function Nt(e){let n=e.fetchCorrelationId!=null,o=n||e.recoveryFetchVersion!=null?!1:e.genNew,u=de({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:n,settingVersion:e.settingVersion,codeVersion:e.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0}}function At(e){let n=r=>e.renderers.has(r);return{supportsD3:n("D3"),supportsPlotly:n("PLOTLY"),supportsVega:n("VEGA")}}function Tt(e){let n=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??n,maxTries:n}}function _t(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function me(e,n){return e!=null&&n!=null&&e!==n}function It(e,n){return e?me(n.capturedFor,n.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:n.atMs>0?Math.max(0,Math.round(n.nowMs-n.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var Mt=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function fe(e){let n=String(e??"").trim().toLowerCase();return Mt[n]??n}function pe(e){let n="";for(let r of e)n+=JSON.stringify([String(r.name??""),r.isMeasure?"M":"D",fe(r.dataType)]);return n}function Ft(e){return G(pe(e))}var wt=2,kt=3,Vt=4,Ot=64,Dt=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict"});function Gt(e){return!!e&&!e.includes("|")&&!e.includes(",")}function qt(e,n,r,o){let u=`${e},${n}|${r}`;return o?`${u}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:u}export{q as CITY_ROLE_MATCH_PCT,Dt as CLIENT_EVENT_KINDS,Te as COMPOUND_MIN_STEM,ie as DATE_LEVEL_GREGORIAN_YEAR_MAX,oe as DATE_LEVEL_GREGORIAN_YEAR_MIN,gt as DATE_LEVEL_LANGUAGES,H as DATE_LEVEL_NAMES,re as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,kn as DEFAULT_GAP_FACTOR,De as DEFAULT_TEMPERATURE,Ve as GET_RANDOM,Ie as GLUED_STEM_MIN,hn as INTENSIVE_SUFFIX_TOKENS,yn as INTENSIVE_WORD_TOKENS,Xn as IndexedText,Vn as MAX_RUN_BOUNDS,bn as POSITIONAL_SUFFIX_TOKENS,Cn as POSITIONAL_WORD_TOKENS,rt as PREVIEW_OMITTED_FIELDS,S as ROLE_MATCH_PCT,Gn as SERIES_COMPLETENESS_MAX_LISTED,qn as SERIES_COMPLETENESS_MIN_FILL,zn as SERIES_KEY_MAX_DISTINCT,Vt as SEV_ERROR,wt as SEV_INFO,Ot as SEV_USER_PRESENTED,kt as SEV_WARNING,G as SIMPLE_STRING_HASH,ke as STR,Fe as SUBSTRING_MIN,Ce as SUPPORTED_LANGUAGES,be as SUPPORTED_LANGUAGE_CODES,ve as VOCABULARY_LANGUAGE_CODES,Se as VOCABULARY_ONLY_LANGUAGES,w as admin1MatchPct,An as allowedAggregations,ln as buildGeoIsoColumn,nn as buildGeoPointColumns,At as capabilityFields,rn as cityMatchPct,tn as cityTagsFor,Qn as classifyAdditivity,Nn as classifyForAggregation,Yn as classifyNumericValueNature,$n as classifyTemporal,xn as codeNeedsLegacyAggNames,Mn as codeReadsColumn,Fn as codeReadsColumnsByRoleOrPosition,vn as collapseRepeatedAggPrefix,wn as columnsTheCodeReads,dn as countryRegion,Et as credentialFields,ht as dateLevelPart,Ct as dateLevelYearAdmits,Zn as decimalSeparatorOf,Tn as defaultAggregation,Jn as detectDecimalSeparator,fn as detectFormatSignature,on as detectGeo,$e as detectOrdinalDomain,Wn as detectTextDatePattern,at as encodePayload,nt as engineTypeForSqlType,En as englishImplicitAggNames,qt as eventLogLine,Nt as fetchFields,Ee as foldName,bt as freemiumColumnCapRefusal,ae as freemiumColumnsOverCap,se as freemiumDateHierarchyClauses,Me as gluedPrefixStems,it as gzipWireText,Sn as hasDefaultAggPrefix,Ne as hasUnsegmentedScript,Hn as hostAggHint,tt as ingest,_n as isAggregationAllowed,M as isBlankLike,Qe as isCityTableLoaded,Oe as isDeterministicRefusal,Gt as isEventLogCode,Je as isGeoPointAmbiguity,jn as isIdentifierName,sn as isJoinGeoKind,ut as isNdjsonContentType,je as isOrdinalFriendlyName,st as keyedSigner,_t as leafCardinalityField,Ue as localMidnightDateColumns,Ke as localMidnightToUtcDay,L as looksLikeCountryColumn,we as matchNameToken,Pt as maxNonMeasureCardinality,Dn as measureCadence,Bn as measureSeriesCompleteness,lt as messageSignature,gn as monthLookupFor,Pn as nameLooksIntensiveRate,Ln as nameLooksPositional,Le as nameWords,Ye as normalizeCountry,Be as normalizeLocalMidnightDates,pn as normalizeMonthKey,_ as normalizePlaceName,Ze as normalizeZip5,It as offeredShortlistFor,Ge as parseDateStable,St as parseGenerateResponse,et as parseNumberText,vt as parseQualifyResponse,xt as parseReviewVerdict,On as parseTemporalPoint,ot as payloadPreview,Un as pickSeriesColumn,dt as readGenerateStream,Pe as readName,f as readWireField,He as registerCityTable,cn as registerIso3Regions,h as resolveAdmin1,de as resolveFetchVersion,en as resolveGeoPoint,xe as resolveLanguage,pt as resolvePointRoles,Tt as retryFields,We as safeDistinctValuesToShip,pe as schemaIdentity,Ft as schemaIdentityKey,fe as schemaTypeFamily,Kn as seriesKeyVerdict,In as shareOfTotalIsHonest,me as shortlistIsStale,Rn as stripHostAggPrefix,mn as summarizeCountryRegions,un as summarizeGeoExtent,Re as supportedLanguage,an as toGeoIso,Ae as unsegmentedRuns,Lt as viewportFields,D as vocabularyLanguage,qe as wholeDayFrame,ze as wholeDayIso,ct as wireResponseFromFetch,_e as wordEndsWith,W as zipMatchPct,F as zipPrefixCandidates,Xe as zipToPrefix3};
|
package/dist/indexedText.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{H as a,I as b,J as c,K as d,L as e,M as f,N as g,O as h}from"./chunk-
|
|
2
|
+
import{H as a,I as b,J as c,K as d,L as e,M as f,N as g,O as h}from"./chunk-KKSQBV76.mjs";import"./chunk-QEH7WTLB.mjs";import"./chunk-2LR73DNS.mjs";import"./chunk-6TVBXT4G.mjs";import"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-6Q3MQ2MK.mjs";import"./chunk-NFSQ4O5R.mjs";export{h as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,g as trimmedCells};
|
package/dist/ingest.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{d as a,e as b}from"./chunk-
|
|
2
|
+
import{d as a,e as b}from"./chunk-FNEHWEWX.mjs";import"./chunk-KKSQBV76.mjs";import"./chunk-QEH7WTLB.mjs";import"./chunk-2LR73DNS.mjs";import"./chunk-6TVBXT4G.mjs";import"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-6Q3MQ2MK.mjs";import"./chunk-NFSQ4O5R.mjs";export{a as engineTypeForSqlType,b as ingest};
|
package/dist/ordinalDetector.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-6Q3MQ2MK.mjs";import"./chunk-NFSQ4O5R.mjs";export{c as detectOrdinalDomain,a as isOrdinalFriendlyName,b as safeDistinctValuesToShip};
|
package/dist/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{f as y,h}from"./chunk-
|
|
2
|
+
import{f as y,h}from"./chunk-JF3BJI7F.mjs";import"./chunk-NFSQ4O5R.mjs";var p=class extends Error{contract;failures;constructor(e,r){super(`${e} conformance failed:
|
|
3
3
|
- ${r.join(`
|
|
4
4
|
- `)}`),this.name="ConformanceError",this.contract=e,this.failures=r}},u=class{constructor(e){this.contract=e}contract;failures=[];check(e,r){e||this.failures.push(r)}fail(e){this.failures.push(e)}throwIfFailed(){if(this.failures.length)throw new p(this.contract,this.failures.slice())}},f="H4sIAAAAAAAAA6tWyk0tSs5ITUxRslIqS8wpTVWqBQBL0RbkEwAAAA==",l="H4sIAAAAAAAAA6tWSkksSVSyUsrMyyrKz1OqBQBVrD9YEAAAAA==";function d(s){return s instanceof Error?`${s.name}: ${s.message}`:String(s)}function w(s){let e=new u("WireSigner");(!s||typeof s.sign!="function")&&(e.fail("the signer has no sign() method"),e.throwIfFailed());let r,a,i;try{r=s.sign(f),a=s.sign(f),i=s.sign(l)}catch(t){e.fail(`sign() threw on an ordinary encoded body: ${d(t)}`),e.throwIfFailed()}e.check(typeof r=="string",`sign() returned ${typeof r}, not a string`),e.check(typeof r!="string"||r.trim()!=="","sign() returned a blank signature"),e.check(r===a,"sign() is not deterministic: the same body signed twice gave two signatures"),e.check(r!==i,"sign() gave two different bodies the same signature"),e.throwIfFailed()}async function A(s){let e=new u("WireResponse"),r=new TextEncoder,a=[`{"type":"progress","stage":"Reading your data"}
|
|
5
5
|
`,`{"type":"result","result":{"code":"x","version":2}}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -25,8 +25,10 @@ export { resolvePointRoles, looksLikeCountryColumn, admin1MatchPct, zipMatchPct,
|
|
|
25
25
|
export type { PointBind, PointRoleResolution } from "./geoPointRoles";
|
|
26
26
|
export { monthLookupFor, normalizeMonthKey } from "./monthNames";
|
|
27
27
|
export { STR, SIMPLE_STRING_HASH, GET_RANDOM, isDeterministicRefusal, nameWords, DEFAULT_TEMPERATURE } from "./util";
|
|
28
|
-
export { SUPPORTED_LANGUAGES, SUPPORTED_LANGUAGE_CODES, supportedLanguage, resolveLanguage, } from "./languages";
|
|
29
|
-
export type { SupportedLanguage, SupportedLanguageCode, LanguageScript, ResolvedLanguage, } from "./languages";
|
|
28
|
+
export { SUPPORTED_LANGUAGES, SUPPORTED_LANGUAGE_CODES, supportedLanguage, resolveLanguage, VOCABULARY_ONLY_LANGUAGES, VOCABULARY_LANGUAGE_CODES, vocabularyLanguage, } from "./languages";
|
|
29
|
+
export type { SupportedLanguage, SupportedLanguageCode, LanguageScript, ResolvedLanguage, VocabularyLanguage, VocabularyLanguageCode, VocabularyOnlyLanguageCode, } from "./languages";
|
|
30
|
+
export { DATE_LEVEL_NAMES, DATE_LEVEL_LANGUAGES, DATE_LEVEL_NON_GREGORIAN_LANGUAGES, DATE_LEVEL_GREGORIAN_YEAR_MIN, DATE_LEVEL_GREGORIAN_YEAR_MAX, dateLevelPart, dateLevelYearAdmits, } from "./vocab/dateLevels";
|
|
31
|
+
export type { DateLevelPart, DateLevelEntry } from "./vocab/dateLevels";
|
|
30
32
|
export { foldName, readName, matchNameToken, wordEndsWith, gluedPrefixStems, unsegmentedRuns, hasUnsegmentedScript, COMPOUND_MIN_STEM, GLUED_STEM_MIN, SUBSTRING_MIN, } from "./nameReader";
|
|
31
33
|
export type { NameReading, NameTokenView } from "./nameReader";
|
|
32
34
|
export { detectDecimalSeparator, decimalSeparatorOf, parseNumberText } from "./numberText";
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/** ISO 15924 script of a language's everyday writing. `Jpan` is Han + Hiragana + Katakana. */
|
|
2
2
|
export type LanguageScript = "Latn" | "Cyrl" | "Grek" | "Hani" | "Jpan" | "Hang" | "Arab" | "Hebr" | "Deva" | "Thai";
|
|
3
3
|
export type SupportedLanguageCode = "en" | "nl" | "de" | "fr" | "es" | "pt" | "it" | "pl" | "cs" | "sk" | "sv" | "da" | "nb" | "fi" | "hu" | "tr" | "ro" | "hr" | "id" | "vi" | "ru" | "uk" | "el" | "zh" | "ja" | "ko" | "ar" | "he" | "hi" | "th";
|
|
4
|
-
|
|
4
|
+
/** A language whose words are matched in a reader's DATA but which has no reader-facing text of
|
|
5
|
+
* its own (see `VOCABULARY_ONLY_LANGUAGES`). */
|
|
6
|
+
export type VocabularyOnlyLanguageCode = "fa";
|
|
7
|
+
/** Every language a vocabulary may carry words for: the thirty, plus the vocabulary-only ones. */
|
|
8
|
+
export type VocabularyLanguageCode = SupportedLanguageCode | VocabularyOnlyLanguageCode;
|
|
9
|
+
/** The word-matching properties of a language, shared by the Tier 1 list and the vocabulary-only
|
|
10
|
+
* list. A Tier 1 entry is a `SupportedLanguage`. */
|
|
11
|
+
export interface VocabularyLanguage {
|
|
5
12
|
/** The one code this language is known by everywhere in the product. */
|
|
6
|
-
code:
|
|
13
|
+
code: VocabularyLanguageCode;
|
|
7
14
|
/** English name, for diagnostics and tests - never shown to a reader as a label. */
|
|
8
15
|
name: string;
|
|
9
16
|
script: LanguageScript;
|
|
@@ -26,6 +33,10 @@ export interface SupportedLanguage {
|
|
|
26
33
|
* `tháng` month / `thang` ladder). Vocabulary in such a language is matched unfolded. */
|
|
27
34
|
foldSensitive: boolean;
|
|
28
35
|
}
|
|
36
|
+
/** A Tier 1 language: its words are vetted for data AND its text is written for readers. */
|
|
37
|
+
export interface SupportedLanguage extends VocabularyLanguage {
|
|
38
|
+
code: SupportedLanguageCode;
|
|
39
|
+
}
|
|
29
40
|
/**
|
|
30
41
|
* The thirty Tier 1 languages, English first. The union of the two broadest lists the product
|
|
31
42
|
* already carried (the UI phrase list and the date-level list), so nothing a host already handled
|
|
@@ -37,6 +48,14 @@ export declare const SUPPORTED_LANGUAGES: readonly SupportedLanguage[];
|
|
|
37
48
|
export declare const SUPPORTED_LANGUAGE_CODES: readonly SupportedLanguageCode[];
|
|
38
49
|
/** The Tier 1 entry for a code or alias, or undefined. */
|
|
39
50
|
export declare function supportedLanguage(code: string | null | undefined): SupportedLanguage | undefined;
|
|
51
|
+
/** The vocabulary-only languages. Kept apart from `SUPPORTED_LANGUAGES` so every list that means
|
|
52
|
+
* "the thirty" - the UI catalogs, the country names, `resolveLanguage` - stays the thirty. */
|
|
53
|
+
export declare const VOCABULARY_ONLY_LANGUAGES: readonly VocabularyLanguage[];
|
|
54
|
+
/** Every language a vocabulary may carry, Tier 1 first, in list order. */
|
|
55
|
+
export declare const VOCABULARY_LANGUAGE_CODES: readonly VocabularyLanguageCode[];
|
|
56
|
+
/** The entry a VOCABULARY reads a language by: a Tier 1 language (code or alias), or a
|
|
57
|
+
* vocabulary-only one. Never use this to pick reader-facing text - that is `resolveLanguage`. */
|
|
58
|
+
export declare function vocabularyLanguage(code: string | null | undefined): VocabularyLanguage | undefined;
|
|
40
59
|
export interface ResolvedLanguage {
|
|
41
60
|
/** The Tier 1 language whose vetted text this reader gets - always one of the thirty. */
|
|
42
61
|
code: SupportedLanguageCode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type VocabularyLanguageCode } from "./languages";
|
|
2
2
|
/**
|
|
3
3
|
* THE FOLD - see the header. `Température` -> `Temperature`, `Udział` -> `Udzial`,
|
|
4
4
|
* `Sıcaklık` -> `Sicaklik`, `٢٠٢٤` -> `2024`. Length-preserving in UTF-16 units: a character is
|
|
@@ -54,7 +54,7 @@ export declare const GLUED_STEM_MIN = 2;
|
|
|
54
54
|
* points. Empty for a language that glues nothing. `الإيرادات` (ar) -> ["إيرادات"];
|
|
55
55
|
* `והכנסות` (he) -> ["כנסות", "הכנסות"] - every candidate, because which letters are a prefix is
|
|
56
56
|
* the vocabulary's question, not the reader's. */
|
|
57
|
-
export declare function gluedPrefixStems(word: string, lang:
|
|
57
|
+
export declare function gluedPrefixStems(word: string, lang: VocabularyLanguageCode | string): string[];
|
|
58
58
|
/** Which view found a token in a name. */
|
|
59
59
|
export type NameTokenView = "word" | "suffix" | "prefix" | "substring";
|
|
60
60
|
/** The shortest token a substring match will look for, in code points. One Han character is a
|
|
@@ -73,4 +73,4 @@ export declare const SUBSTRING_MIN = 2;
|
|
|
73
73
|
* Returns null when no view finds it. This is the reader only: a vocabulary still owns the
|
|
74
74
|
* one-language rule for short tokens and the English-wins rule for collisions.
|
|
75
75
|
*/
|
|
76
|
-
export declare function matchNameToken(name: string, token: string, lang:
|
|
76
|
+
export declare function matchNameToken(name: string, token: string, lang: VocabularyLanguageCode | string): NameTokenView | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type VocabularyLanguageCode } from "../languages";
|
|
2
|
+
export type DateLevelPart = "year" | "quarter" | "month" | "day";
|
|
3
|
+
export interface DateLevelEntry {
|
|
4
|
+
part: DateLevelPart;
|
|
5
|
+
langs: readonly VocabularyLanguageCode[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Level name (lower-cased, NFC) -> the part it names and the languages that spell it so. The first
|
|
9
|
+
* block is the table as it shipped for 23 languages; the second block adds the rest of the Tier 1
|
|
10
|
+
* list and the vocabulary-only Persian. Order matters only through `DATE_LEVEL_LANGUAGES`, which
|
|
11
|
+
* keeps the first block's languages first so a hierarchy those already read is decided exactly as
|
|
12
|
+
* before.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DATE_LEVEL_NAMES: Readonly<Record<string, DateLevelEntry>>;
|
|
15
|
+
/** Every language the lexicon knows, in the order a host tries a hierarchy's candidates. */
|
|
16
|
+
export declare const DATE_LEVEL_LANGUAGES: readonly VocabularyLanguageCode[];
|
|
17
|
+
/** Languages whose data often counts years in a non-Gregorian calendar: Solar Hijri (fa), Hijri
|
|
18
|
+
* (ar), Hebrew (he), Buddhist Era (th). */
|
|
19
|
+
export declare const DATE_LEVEL_NON_GREGORIAN_LANGUAGES: readonly VocabularyLanguageCode[];
|
|
20
|
+
/** The Gregorian years a guarded language's hierarchy may carry. Every one of the four calendars
|
|
21
|
+
* above is outside this range today (Solar Hijri ~1404, Hijri ~1447, Hebrew ~5786, Buddhist ~2568). */
|
|
22
|
+
export declare const DATE_LEVEL_GREGORIAN_YEAR_MIN = 1900;
|
|
23
|
+
export declare const DATE_LEVEL_GREGORIAN_YEAR_MAX = 2100;
|
|
24
|
+
/**
|
|
25
|
+
* The part a level NAME spells in `lang`, or null. The name is trimmed, NFC-normalised and
|
|
26
|
+
* lower-cased by the language's own rules (`YIL` is Turkish `yıl`), then looked up whole: a level
|
|
27
|
+
* name is the whole name, never a word inside one.
|
|
28
|
+
*/
|
|
29
|
+
export declare function dateLevelPart(name: string | null | undefined, lang: VocabularyLanguageCode): DateLevelPart | null;
|
|
30
|
+
/**
|
|
31
|
+
* May a hierarchy recognised in `lang` carry this year? True for every language except the four whose
|
|
32
|
+
* data often counts years in another calendar; for those, only a plausible Gregorian year. A host
|
|
33
|
+
* applies this to the year of the row it tests for viability, so a Solar Hijri 1405 leaves the
|
|
34
|
+
* hierarchy shredded instead of building a date in 1405 CE.
|
|
35
|
+
*/
|
|
36
|
+
export declare function dateLevelYearAdmits(lang: VocabularyLanguageCode | string, year: number | null | undefined): boolean;
|
package/dist/util.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{A as
|
|
2
|
+
import{A as j,B as k,C as l,D as m,i as a,s as b,t as c,u as d,v as e,w as f,x as g,y as h,z as i}from"./chunk-NFSQ4O5R.mjs";export{g as DEFAULT_TEMPERATURE,e as GET_RANDOM,d as SIMPLE_STRING_HASH,b as STR,f as isDeterministicRefusal,l as localMidnightDateColumns,k as localMidnightToUtcDay,a as nameWords,m as normalizeLocalMidnightDates,h as parseDateStable,c as quantileSorted,i as wholeDayFrame,j as wholeDayIso};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/shape-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.34",
|
|
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",
|
package/dist/chunk-ILHBRGIO.mjs
DELETED
|
@@ -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
|
-
var a=(n,t,e,r={})=>({code:n,name:t,script:e,dir:"ltr",intl:n,aliases:[],wordBreaks:!0,compounds:!1,gluedPrefixes:[],foldSensitive:!1,...r}),g=Object.freeze([a("en","English","Latn"),a("nl","Dutch","Latn",{compounds:!0}),a("de","German","Latn",{compounds:!0}),a("fr","French","Latn"),a("es","Spanish","Latn"),a("pt","Portuguese","Latn"),a("it","Italian","Latn"),a("pl","Polish","Latn"),a("cs","Czech","Latn"),a("sk","Slovak","Latn"),a("sv","Swedish","Latn",{compounds:!0}),a("da","Danish","Latn",{compounds:!0}),a("nb","Norwegian Bokmal","Latn",{compounds:!0,aliases:["no"]}),a("fi","Finnish","Latn",{compounds:!0}),a("hu","Hungarian","Latn",{compounds:!0}),a("tr","Turkish","Latn"),a("ro","Romanian","Latn"),a("hr","Croatian","Latn"),a("id","Indonesian","Latn",{aliases:["in"]}),a("vi","Vietnamese","Latn",{foldSensitive:!0}),a("ru","Russian","Cyrl"),a("uk","Ukrainian","Cyrl"),a("el","Greek","Grek"),a("zh","Chinese (Simplified)","Hani",{intl:"zh-Hans",wordBreaks:!1}),a("ja","Japanese","Jpan",{wordBreaks:!1}),a("ko","Korean","Hang"),a("ar","Arabic","Arab",{dir:"rtl",gluedPrefixes:["\u0627\u0644","\u0648\u0627\u0644","\u0628\u0627\u0644","\u0641\u0627\u0644","\u0643\u0627\u0644","\u0644\u0644","\u0648","\u0641","\u0628","\u0643","\u0644"]}),a("he","Hebrew","Hebr",{dir:"rtl",aliases:["iw"],gluedPrefixes:["\u05D4","\u05D5","\u05D1","\u05DC","\u05DE","\u05E9","\u05DB","\u05D5\u05D4","\u05E9\u05D4","\u05DE\u05D4","\u05D5\u05D1","\u05D5\u05DC","\u05D5\u05DE","\u05D1\u05D4","\u05DC\u05D4"]}),a("hi","Hindi","Deva"),a("th","Thai","Thai",{wordBreaks:!1})]),Y=Object.freeze(g.map(n=>n.code)),c=new Map(g.map(n=>[n.code,n])),h=new Map(g.flatMap(n=>n.aliases.map(t=>[t,n]))),m={nn:"nb"};function p(n){let t=String(n??"").trim().toLowerCase();return c.get(t)??h.get(t)}function S(n){try{let t=Intl.getCanonicalLocales(n);return t.length?t[0]:null}catch{return null}}function L(n){let t=n.split("-"),e=t.find((o,i)=>i>0&&o.length===4);if(e)return e.toLowerCase()==="hant";try{let o=Intl.Locale;if(typeof o=="function"){let i=new o(n).maximize();if(i&&typeof i.script=="string")return i.script==="Hant"}}catch{}let r=t.find((o,i)=>i>0&&o.length===2);return!!r&&["TW","HK","MO"].includes(r.toUpperCase())}function x(n){try{return Intl.NumberFormat.supportedLocalesOf([n]).length>0}catch{return!1}}function V(n){let t=c.get("en"),e=String(n??"").trim().replace(/_/g,"-"),r=e?S(e):null;if(!r)return{code:"en",language:t,tier:1,intl:"en"};let o=r.split("-")[0].toLowerCase(),i=c.get(o)??h.get(o);if(i){let l=i.code==="zh"&&L(r)?2:1;return{code:i.code,language:i,tier:l,intl:r}}let u=m[o],s=u?c.get(u):t;return{code:s.code,language:s,tier:2,intl:x(r)?r:s.intl}}var C={\u0142:"l",\u0141:"L",\u0131:"i",\u00F8:"o",\u00D8:"O",\u0111:"d",\u0110:"D",\u00F0:"d",\u00D0:"D"},T=[1632,1776,2406,3664,65296],y=/[\u0300-\u036F]/g;function N(n){let t=C[n];if(t)return t;let e=n.codePointAt(0);for(let o of T)if(e>=o&&e<=o+9)return String.fromCharCode(48+e-o);if(e>=65313&&e<=65338||e>=65345&&e<=65370)return String.fromCharCode(e-65248);let r=n.normalize("NFD").replace(y,"");return r.length===1?r:n}function f(n){if(!n)return n??"";let t="";for(let e of n)t+=N(e);return t}var D=/([\p{Ll}\p{Nd}])(\p{Lu})/gu,R=/[_\-./]+/g,E=/[^\p{L}\p{M}\p{N}\x00-\x7F]/gu;function d(n){return n?String(n).normalize("NFC").replace(D,"$1 $2").replace(R," ").replace(E," ").toLowerCase().split(/\s+/).filter(t=>t.length>0):[]}function b(n){let t=d(n),e=d(f(String(n??"").normalize("NFC")));return{words:t,folded:e.length===t.length?e:t.map(f)}}var M=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]/u,_=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]+/gu;function A(n){return!!n&&M.test(n)}function I(n){return n?String(n).normalize("NFC").match(_)??[]:[]}var w=3;function O(n,t,e=w){return!n||!t||n.length<=t.length||!n.endsWith(t)?!1:Array.from(n.slice(0,n.length-t.length)).length>=e}var U=2;function k(n,t){let e=p(t);if(!n||!e||e.gluedPrefixes.length===0)return[];let r=[];for(let o of[...e.gluedPrefixes].sort((i,u)=>u.length-i.length))if(n.length>o.length&&n.startsWith(o)){let i=n.slice(o.length);Array.from(i).length>=U&&!r.includes(i)&&r.push(i)}return r}var H=2;function K(n,t,e){if(!n||!t)return null;let r=p(e);if(!r)return null;let o=t.normalize("NFC").toLowerCase();if(A(o))return Array.from(o).length<H?null:I(n).some(l=>l.includes(o))?"substring":null;let i=b(n),u=r.foldSensitive?i.words:i.folded,s=r.foldSensitive?o:f(t.normalize("NFC")).toLowerCase();return u.includes(s)?"word":r.compounds&&u.some(l=>O(l,s))?"suffix":r.gluedPrefixes.length&&u.some(l=>k(l,r.code).includes(s))?"prefix":null}function J(n){return n!=null?n.toString():""}function Z(n,t){if(!n.length)return NaN;if(n.length===1)return n[0];let e=(n.length-1)*t,r=Math.floor(e),o=Math.ceil(e);return r===o?n[r]:n[r]+(n[o]-n[r])*(e-r)}function X(n){if(!n)return 0;let t=0xcbf29ce484222325n,e=0x100000001b3n,r=t;for(let o=0;o<n.length;o++)r^=BigInt(n.charCodeAt(o)),r=r*e&0xFFFFFFFFFFFFFFFFn;return Number(r&0x1FFFFFFFFFFFFFn)}function q(){let n=typeof globalThis<"u"?globalThis:{};if(n.crypto&&typeof n.crypto.getRandomValues=="function"){let t=new Uint32Array(1);return n.crypto.getRandomValues(t),t[0]/4294967296}return Math.floor(Date.now()%4294967295)/4294967296}function Q(n){return!!n&&n.isRefusal===!0}var nn=30;function en(n){let t=Date.parse(n);if(isNaN(t))return null;let e=new Date(t);if(z.test(n)||v.test(n.trim())||B.test(n))return e;let r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),o=e.getFullYear();return o>=0&&o<100&&r.setUTCFullYear(o),r}function F(n){return!(n instanceof Date)||isNaN(n.getTime())?null:n.getUTCHours()===0&&n.getUTCMinutes()===0&&n.getUTCSeconds()===0&&n.getUTCMilliseconds()===0?"utc":n.getHours()===0&&n.getMinutes()===0&&n.getSeconds()===0&&n.getMilliseconds()===0?"local":null}function tn(n){let t=F(n);if(!t)return null;let e=n;if(t==="utc")return e.toISOString().slice(0,10);let r=o=>(o<10?"0":"")+o;return`${e.getFullYear()}-${r(e.getMonth()+1)}-${r(e.getDate())}`}function P(n){let t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())),e=n.getFullYear();return e>=0&&e<100&&t.setUTCFullYear(e),t}function G(n,t){let e=[];for(let r of n){if(!r||!/date|time/i.test(String(r.dataType??"")))continue;let o=0,i=!0;for(let u of t){let s=u?u[r.name]:void 0;if(s==null||s==="")continue;if(!(s instanceof Date)){i=!1;break}let l=F(s);if(l===null){i=!1;break}l==="local"&&o++}i&&o>0&&e.push(r.name)}return e}function rn(n,t){let e=G(n,t);return e.length===0?{rows:t,columns:e}:{rows:t.map(o=>{if(!o)return o;let i={...o};for(let u of e){let s=i[u];s instanceof Date&&F(s)==="local"&&(i[u]=P(s))}return i}),columns:e}}var z=/^\s*\d{4}(-\d{2}(-\d{2})?)?\s*$/,v=/(?:Z|[+-]\d{2}:?\d{2})$/i,B=/\b(?:GMT|UTC)\b/i;export{g as a,Y as b,p as c,V as d,f as e,d as f,b as g,A as h,I as i,w as j,O as k,U as l,k as m,H as n,K as o,J as p,Z as q,X as r,q as s,Q as t,nn as u,en as v,F as w,tn as x,P as y,G as z,rn as A};
|