@bicharts/shape-core 0.6.95 → 0.6.97

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/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @bicharts/shape-core
2
2
 
3
- > **Make Generative AI for Charts *Better*.**
3
+ > **Make Generative AI for Charts and Maps *Better*.**
4
4
 
5
5
  That is what **RegiaBI** is for; this package is the part that measures your data so the
6
6
  rest of it can be honest about what your data will actually support.
7
7
 
8
- RegiaBI hands you a chart that fits your data on the first try, as source you own, and it runs in your React app or any web page on a free, open-source runtime with no call back to us.
8
+ RegiaBI builds **AI Data Components** for Power BI, Excel, Fabric Apps and the web: a bivariate map with its two-way key, a what-if projection with its controls inside the chart, and about 90 everyday chart types. This package measures your whole result, so its real counts decide which of them fit. The code comes as source you own and runs in your React app or any web page on a free, open-source runtime with no call back to us.
9
9
  [RegiaBI for developers](https://bizintelligencechampions.com/regiabi/developers?loc=npmshape)
10
10
 
11
11
  A **host-agnostic data-shape profiler**. Feed it a dataset's rows through the
@@ -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{q as c}from"./chunk-NT6CDI3K.mjs";import{gzip as h}from"pako";var x=e=>h(e);function O(e){return w(x(JSON.stringify(e))).replace(/\//g,".")}function w(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function P(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 r=t.sign(e);if(typeof r!="string"||r.trim()==="")throw new TypeError("the host's signer returned a blank signature");return r}function u(e,t){if(e==null||typeof e!="object")return;let r=e,n=r[t];return n??r[t.charAt(0).toUpperCase()+t.slice(1)]}function S(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,...typeof e.statusText=="string"?{statusText:e.statusText}:{},contentType:t,body:e.body??null,text:()=>e.text()}}function m(e,t,r){let n=e.trim();if(!n)return{result:null,typed:!1,parsed:!1};let i;try{i=JSON.parse(n)}catch{return{result:null,typed:!1,parsed:!1}}return f(i,t,r)}function f(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return{result:null,typed:!1,parsed:!0};let n=u(e,"type");if(n!=null){if(n==="progress"){let s=String(u(e,"stage")??"").trim(),o=String(u(e,"stageId")??"").trim();return s&&t?.(s,o||void 0),{result:null,typed:!0,parsed:!0}}if(n==="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 r?{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 r=m(t,this.onStage,!0);r.parsed&&(this.anyParsed=!0),r.result&&(r.typed||this.result===null)&&(this.result=r.result)}};function d(){return new Error("the generate response ended without a result")}async function R(e,t){let r=e.body;if(!r||typeof r.getReader!="function")return p(await e.text(),t,null);let n=r.getReader(),i=new TextDecoder,s=new a(t),o="";try{for(;;){let{done:y,value:g}=await n.read();if(y)break;o+=i.decode(g,{stream:!0});let l;for(;(l=o.indexOf(`
2
+ import{q as c}from"./chunk-CZJ7M6A5.mjs";import{gzip as h}from"pako";var x=e=>h(e);function O(e){return w(x(JSON.stringify(e))).replace(/\//g,".")}function w(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function P(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 r=t.sign(e);if(typeof r!="string"||r.trim()==="")throw new TypeError("the host's signer returned a blank signature");return r}function u(e,t){if(e==null||typeof e!="object")return;let r=e,n=r[t];return n??r[t.charAt(0).toUpperCase()+t.slice(1)]}function S(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,...typeof e.statusText=="string"?{statusText:e.statusText}:{},contentType:t,body:e.body??null,text:()=>e.text()}}function m(e,t,r){let n=e.trim();if(!n)return{result:null,typed:!1,parsed:!1};let i;try{i=JSON.parse(n)}catch{return{result:null,typed:!1,parsed:!1}}return f(i,t,r)}function f(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return{result:null,typed:!1,parsed:!0};let n=u(e,"type");if(n!=null){if(n==="progress"){let s=String(u(e,"stage")??"").trim(),o=String(u(e,"stageId")??"").trim();return s&&t?.(s,o||void 0),{result:null,typed:!0,parsed:!0}}if(n==="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 r?{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 r=m(t,this.onStage,!0);r.parsed&&(this.anyParsed=!0),r.result&&(r.typed||this.result===null)&&(this.result=r.result)}};function d(){return new Error("the generate response ended without a result")}async function R(e,t){let r=e.body;if(!r||typeof r.getReader!="function")return p(await e.text(),t,null);let n=r.getReader(),i=new TextDecoder,s=new a(t),o="";try{for(;;){let{done:y,value:g}=await n.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{n.releaseLock?.()}catch{}}if(o+=i.decode(),s.take(o),!s.result)throw d();return s.result}function p(e,t,r){let n=new a(t);for(let i of e.split(`
4
4
  `))n.take(i);if(n.result)return n.result;throw!n.anyParsed&&r?r:d()}async function k(e,t){let r=await e.text(),n;try{n=JSON.parse(r)}catch(s){return p(r,t,s)}if(!n||typeof n!="object"||Array.isArray(n))throw new SyntaxError("the generate response was JSON but not a result object");let i=f(n,t,!1);if(i.result)return i.result;throw d()}async function v(e,t){return S(e.contentType)?R(e,t):k(e,t)}export{x as a,O as b,P as c,W as d,u as e,S as f,C as g,v as h};
@@ -0,0 +1,2 @@
1
+ /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
+ import{f as c}from"./chunk-WC4JINEZ.mjs";var d={\u0142:"l",\u0141:"L",\u0131:"i",\u00F8:"o",\u00D8:"O",\u0111:"d",\u0110:"D",\u00F0:"d",\u00D0:"D"},m=[1632,1776,2406,3664,65296],x=/[\u0300-\u036F]/g;function T(t){let e=d[t];if(e)return e;let n=t.codePointAt(0);for(let o of m)if(n>=o&&n<=o+9)return String.fromCharCode(48+n-o);if(n>=65313&&n<=65338||n>=65345&&n<=65370)return String.fromCharCode(n-65248);let r=t.normalize("NFD").replace(x,"");return r.length===1?r:t}function f(t){if(!t)return t??"";let e="";for(let n of t)e+=T(n);return e}var p=/([\p{Ll}\p{Nd}])(\p{Lu})/gu,y=/[_\-./]+/g,h=/[^\p{L}\p{M}\p{N}\x00-\x7F]/gu;function g(t){return t?String(t).normalize("NFC").replace(p,"$1 $2").replace(y," ").replace(h," ").toLowerCase().split(/\s+/).filter(e=>e.length>0):[]}function V(t,e={}){if(!t)return[];let n=String(t).normalize("NFC");return e.camel&&(n=n.replace(p,"$1 $2")),n.toLowerCase().split(/[^\p{L}\p{M}]+/u).filter(r=>r.length>0)}function C(t){let e=g(t),n=g(f(String(t??"").normalize("NFC")));return{words:e,folded:n.length===e.length?n:e.map(f)}}var N=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]/u,S=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]+/gu;function D(t){return!!t&&N.test(t)}function M(t){return t?String(t).normalize("NFC").match(S)??[]:[]}var R=3;function F(t,e,n=R){return!t||!e||t.length<=e.length||!t.endsWith(e)?!1:Array.from(t.slice(0,t.length-e.length)).length>=n}var E=2;function b(t,e){let n=c(e);if(!t||!n||n.gluedPrefixes.length===0)return[];let r=[];for(let o of[...n.gluedPrefixes].sort((i,l)=>l.length-i.length))if(t.length>o.length&&t.startsWith(o)){let i=t.slice(o.length);Array.from(i).length>=E&&!r.includes(i)&&r.push(i)}return r}var A=2,U=/\p{Script=Hangul}/u;function _(t,e){return!t||!e||!U.test(e)?!1:F(t,e,A)}var I=2;function $(t,e,n){if(!t||!e)return null;let r=c(n);if(!r)return null;let o=e.normalize("NFC").toLowerCase();if(D(o))return Array.from(o).length<I?null:M(t).some(a=>a.includes(o))?"substring":null;let i=C(t),l=r.foldSensitive?i.words:i.folded,s=r.foldSensitive?o:f(e.normalize("NFC")).toLowerCase();return l.includes(s)?"word":r.compounds&&l.some(a=>F(a,s))||l.some(a=>_(a,s))?"suffix":r.gluedPrefixes.length&&l.some(a=>b(a,r.code).includes(s))?"prefix":null}function v(t){return t!=null?t.toString():""}function B(t,e){if(!t.length)return NaN;if(t.length===1)return t[0];let n=(t.length-1)*e,r=Math.floor(n),o=Math.ceil(n);return r===o?t[r]:t[r]+(t[o]-t[r])*(n-r)}function K(t){if(!t)return 0;let e=0xcbf29ce484222325n,n=0x100000001b3n,r=e;for(let o=0;o<t.length;o++)r^=BigInt(t.charCodeAt(o)),r=r*n&0xFFFFFFFFFFFFFFFFn;return Number(r&0x1FFFFFFFFFFFFFn)}function Z(){let t=typeof globalThis<"u"?globalThis:{};if(t.crypto&&typeof t.crypto.getRandomValues=="function"){let e=new Uint32Array(1);return t.crypto.getRandomValues(e),e[0]/4294967296}return Math.floor(Date.now()%4294967295)/4294967296}function q(t){return!!t&&t.isRefusal===!0}var X=30;function j(t){let e=Date.parse(t);if(isNaN(e))return null;let n=new Date(e);if(G.test(t)||P.test(t.trim())||W.test(t))return n;let r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())),o=n.getFullYear();return o>=0&&o<100&&r.setUTCFullYear(o),r}function u(t){return!(t instanceof Date)||isNaN(t.getTime())?null:t.getUTCHours()===0&&t.getUTCMinutes()===0&&t.getUTCSeconds()===0&&t.getUTCMilliseconds()===0?"utc":t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0&&t.getMilliseconds()===0?"local":null}function J(t){let e=u(t);if(!e)return null;let n=t;if(e==="utc")return n.toISOString().slice(0,10);let r=o=>(o<10?"0":"")+o;return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}`}function L(t){let e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),n=t.getFullYear();return n>=0&&n<100&&e.setUTCFullYear(n),e}function O(t,e){let n=[];for(let r of t){if(!r||!/date|time/i.test(String(r.dataType??"")))continue;let o=0,i=!0;for(let l of e){let s=l?l[r.name]:void 0;if(s==null||s==="")continue;if(!(s instanceof Date)){i=!1;break}let a=u(s);if(a===null){i=!1;break}a==="local"&&o++}i&&o>0&&n.push(r.name)}return n}function Q(t,e){let n=O(t,e);return n.length===0?{rows:e,columns:n}:{rows:e.map(o=>{if(!o)return o;let i={...o};for(let l of n){let s=i[l];s instanceof Date&&u(s)==="local"&&(i[l]=L(s))}return i}),columns:n}}function H(t){let e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())),n=t.getFullYear();return n>=0&&n<100&&e.setUTCFullYear(n),e}function w(t){let e=!1;for(let n of t)if(!(n==null||n==="")){if(!(n instanceof Date)||isNaN(n.getTime()))return!1;u(n)===null&&(e=!0)}return e}function Y(t,e){let n=[];for(let r of t)!r||!/date|time/i.test(String(r.dataType??""))||w(e.map(o=>o?o[r.name]:void 0))&&n.push(r.name);return n}function tt(t,e){let n=Y(t,e);return n.length===0?{rows:e,columns:n}:{rows:e.map(o=>{if(!o)return o;let i={...o};for(let l of n){let s=i[l];s instanceof Date&&(i[l]=H(s))}return i}),columns:n}}function nt(t){let e=!1,n=!1;for(let r of t)if(!(r==null||r==="")){if(!(r instanceof Date)||isNaN(r.getTime())||(n=!0,!(r.getUTCFullYear()===1899&&r.getUTCMonth()===11&&r.getUTCDate()===30)))return!1;!e&&(r.getUTCHours()||r.getUTCMinutes()||r.getUTCSeconds()||r.getUTCMilliseconds())&&(e=!0)}return n&&e}var G=/^\s*\d{4}(-\d{2}(-\d{2})?)?\s*$/,P=/(?:Z|[+-]\d{2}:?\d{2})$/i,W=/\b(?:GMT|UTC)\b/i;export{f as a,g as b,V as c,C as d,D as e,M as f,R as g,F as h,E as i,b as j,A as k,_ as l,I as m,$ as n,v as o,B as p,K as q,Z as r,q as s,X as t,j as u,u as v,J as w,L as x,O as y,Q as z,H as A,w as B,Y as C,tt as D,nt as E};
@@ -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 _,b as M,d as x,g as R,h as D,n as j}from"./chunk-NT6CDI3K.mjs";import{f as p}from"./chunk-WC4JINEZ.mjs";import{a as S}from"./chunk-5HI6TVMM.mjs";var Pe=Object.freeze({hour:24,weekday:7,month:12,quarter:4,week:53,season:4}),J={nl:["jaar"],de:["jahr"],fr:["ann\xE9e"],es:["a\xF1o"],pt:["ano"],it:["anno"],pl:["rok"],cs:["rok"],sk:["rok"],sv:["\xE5r"],da:["\xE5r"],nb:["\xE5r"],fi:["vuosi"],hu:["\xE9v"],tr:["y\u0131l"],ro:["anul"],hr:["godina"],id:["tahun"],vi:["n\u0103m"],ru:["\u0433\u043E\u0434"],uk:["\u0440\u0456\u043A"],el:["\u03AD\u03C4\u03BF\u03C2"],zh:["\u5E74\u4EFD","\u5E74\u5EA6"],ja:["\u5E74\u5EA6"],ko:["\uC5F0\uB3C4","\uB144\uB3C4"],ar:["\u0633\u0646\u0629"],he:["\u05E9\u05E0\u05D4"],hi:["\u0935\u0930\u094D\u0937","\u0938\u093E\u0932"],th:["\u0E1B\u0E35\u0E07\u0E1A\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13"],fa:["\u0633\u0627\u0644"]},q={hour:{de:["stunde"],fr:["heure"],es:["hora"],pt:["hora"],it:["ora"],pl:["godzina"],cs:["hodina"],sk:["hodina"],sv:["timme"],fi:["tunti"],hu:["\xF3ra"],ro:["ora"],vi:["gi\u1EDD"],ru:["\u0447\u0430\u0441"],uk:["\u0433\u043E\u0434\u0438\u043D\u0430"],el:["\u03CE\u03C1\u03B1"],zh:["\u5C0F\u65F6"],ar:["\u0633\u0627\u0639\u0629"],he:["\u05E9\u05E2\u05D4"],hi:["\u0918\u0902\u091F\u093E"],th:["\u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07"],fa:["\u0633\u0627\u0639\u062A"]},weekday:{nl:["weekdag"],de:["wochentag"],sv:["veckodag"],da:["ugedag"],nb:["ukedag"],fi:["viikonp\xE4iv\xE4"],zh:["\u661F\u671F"],ja:["\u66DC\u65E5"],ko:["\uC694\uC77C"]},month:{nl:["maand"],de:["monat"],fr:["mois"],es:["mes"],pt:["m\xEAs"],it:["mese"],pl:["miesi\u0105c"],cs:["m\u011Bs\xEDc"],sk:["mesiac"],sv:["m\xE5nad"],da:["m\xE5ned"],nb:["m\xE5ned"],fi:["kuukausi"],hu:["h\xF3nap"],hr:["mjesec"],id:["bulan"],vi:["th\xE1ng"],ru:["\u043C\u0435\u0441\u044F\u0446"],uk:["\u043C\u0456\u0441\u044F\u0446\u044C"],el:["\u03BC\u03AE\u03BD\u03B1\u03C2"],zh:["\u6708\u4EFD"],ar:["\u0634\u0647\u0631"],he:["\u05D7\u05D5\u05D3\u05E9"],hi:["\u092E\u0939\u0940\u0928\u093E","\u092E\u093E\u0939"],th:["\u0E40\u0E14\u0E37\u0E2D\u0E19"],fa:["\u0645\u0627\u0647"]},quarter:{nl:["kwartaal"],de:["quartal"],fr:["trimestre"],es:["trimestre"],pt:["trimestre"],it:["trimestre"],pl:["kwarta\u0142"],cs:["\u010Dtvrtlet\xED"],sk:["\u0161tvr\u0165rok"],sv:["kvartal"],da:["kvartal"],nb:["kvartal"],fi:["vuosinelj\xE4nnes"],hu:["negyed\xE9v"],tr:["\xE7eyrek"],ro:["trimestru"],hr:["tromjese\u010Dje"],id:["kuartal","triwulan"],vi:["qu\xFD"],ru:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B"],uk:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B"],el:["\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF"],zh:["\u5B63\u5EA6"],ja:["\u56DB\u534A\u671F"],ko:["\uBD84\uAE30"],ar:["\u0631\u0628\u0639"],he:["\u05E8\u05D1\u05E2\u05D5\u05DF"],hi:["\u0924\u093F\u092E\u093E\u0939\u0940"],th:["\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A"]},week:{de:["woche"],fr:["semaine"],es:["semana"],pt:["semana"],it:["settimana"],pl:["tydzie\u0144"],cs:["t\xFDden"],sk:["t\xFD\u017Ede\u0148"],sv:["vecka"],da:["uge"],nb:["uke"],fi:["viikko"],hu:["h\xE9t"],tr:["hafta"],ro:["s\u0103pt\u0103m\xE2n\u0103"],hr:["tjedan"],id:["minggu"],vi:["tu\u1EA7n"],ru:["\u043D\u0435\u0434\u0435\u043B\u044F"],uk:["\u0442\u0438\u0436\u0434\u0435\u043D\u044C"],el:["\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1"],ar:["\u0623\u0633\u0628\u0648\u0639"],he:["\u05E9\u05D1\u05D5\u05E2"],hi:["\u0938\u092A\u094D\u0924\u093E\u0939"],th:["\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C"],fa:["\u0647\u0641\u062A\u0647"]},season:{nl:["seizoen"],de:["jahreszeit"],fr:["saison"],es:["temporada"],it:["stagione"],pl:["sezon"],cs:["sez\xF3na"],sk:["sez\xF3na"],sv:["s\xE4song","\xE5rstid"],da:["s\xE6son","\xE5rstid"],nb:["sesong","\xE5rstid"],fi:["vuodenaika"],hu:["\xE9vszak"],tr:["mevsim"],ro:["anotimp"],vi:["m\xF9a"],ru:["\u0441\u0435\u0437\u043E\u043D"],uk:["\u0441\u0435\u0437\u043E\u043D"],el:["\u03B5\u03C0\u03BF\u03C7\u03AE"],zh:["\u5B63\u8282"],ja:["\u5B63\u7BC0"],ko:["\uACC4\uC808"],ar:["\u0645\u0648\u0633\u0645"],he:["\u05E2\u05D5\u05E0\u05D4"],hi:["\u092E\u094C\u0938\u092E"],th:["\u0E24\u0E14\u0E39"],fa:["\u0641\u0635\u0644"]}},ee=["\xE5r","\xE9v","h\xE9t","\xF3ra"];function re(e,r,t){let n=p(t);if(!n)return null;let o=r.normalize("NFC").toLowerCase(),s=x(e).words;return s.includes(o)?"word":n.compounds&&s.some(i=>D(i,o,R))?"suffix":null}function O(e,r){let t=String(e??"");if(!t.trim())return null;for(let[n,o]of Object.entries(r))for(let s of o){let i=ee.includes(s)?re(t,s,n):j(t,s,n);if(i)return{lang:n,word:s,view:i}}return null}function z(e){return O(e,J)}function N(e){let r=null;for(let t of Object.keys(q)){let n=O(e,q[t]);if(n){if(r&&r.concept!==t)return null;r={concept:t,hit:n}}}return r}var ne=Object.freeze({quarter:4,half:2,week:53}),h={quarter:{en:{words:["quarter #","qtr #"],codes:["q #"]},nl:{words:["kwartaal #","# kwartaal","#e kwartaal","@ kwartaal"],codes:["k #"]},de:{words:["quartal #","# quartal","@ quartal"]},fr:{words:["trimestre #","# trimestre","#er trimestre","#e trimestre","#eme trimestre","@ trimestre"],codes:["t #","# t","trim. #"]},es:{words:["trimestre #","# trimestre","#er trimestre","#o trimestre","#\xBA trimestre","#\xB0 trimestre","@ trimestre"],codes:["t #","# t","trim. #"]},pt:{words:["trimestre #","# trimestre","#o trimestre","#\xBA trimestre","#\xB0 trimestre","@ trimestre"],codes:["t #","# t","#\xBA t","trim. #"]},it:{words:["trimestre #","# trimestre","#\xBA trimestre","#\xB0 trimestre","% trimestre","@ trimestre"],codes:["t #","trim. #"]},pl:{words:["kwarta\u0142 #","# kwarta\u0142","% kwarta\u0142","@ kwarta\u0142","# kw.","% kw."]},cs:{words:["\u010Dtvrtlet\xED #","# \u010Dtvrtlet\xED","% \u010Dtvrtlet\xED","@ \u010Dtvrtlet\xED"]},sk:{words:["\u0161tvr\u0165rok #","# \u0161tvr\u0165rok","% \u0161tvr\u0165rok","@ \u0161tvr\u0165rok"]},sv:{words:["kvartal #","# kvartalet","#:a kvartalet","#:e kvartalet","@ kvartalet"],codes:["k #"]},da:{words:["kvartal #","# kvartal","@ kvartal"],codes:["k #"]},nb:{words:["kvartal #","# kvartal","@ kvartal"],codes:["k #"]},fi:{words:["nelj\xE4nnes #","# nelj\xE4nnes","# vuosinelj\xE4nnes","vuosinelj\xE4nnes #"]},hu:{words:["negyed\xE9v #","# negyed\xE9v","% negyed\xE9v"]},tr:{words:["\xE7eyrek #","# \xE7eyrek","@ \xE7eyrek"],codes:["\xE7 #"]},ro:{words:["trimestrul #","trimestrul %","trimestru #"],codes:["t #"]},hr:{words:["tromjese\u010Dje #","# tromjese\u010Dje","% tromjese\u010Dje","kvartal #","# kvartal"]},id:{words:["kuartal #","kuartal %","kuartal ke #","triwulan #","triwulan %","triwulan ke #"],codes:["tw #","tw %"]},vi:{words:["qu\xFD #","qu\xFD %"]},ru:{words:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B #","# \u043A\u0432\u0430\u0440\u0442\u0430\u043B","% \u043A\u0432\u0430\u0440\u0442\u0430\u043B","@ \u043A\u0432\u0430\u0440\u0442\u0430\u043B","# \u043A\u0432.","% \u043A\u0432."]},uk:{words:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B #","# \u043A\u0432\u0430\u0440\u0442\u0430\u043B","% \u043A\u0432\u0430\u0440\u0442\u0430\u043B","@ \u043A\u0432\u0430\u0440\u0442\u0430\u043B","# \u043A\u0432.","% \u043A\u0432."]},el:{words:["\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF #","# \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF","#\u03BF \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF","@ \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF"]},zh:{words:["\u7B2C#\u5B63\u5EA6","\u7B2C@\u5B63\u5EA6","@\u5B63\u5EA6","#\u5B63\u5EA6"]},ja:{words:["\u7B2C#\u56DB\u534A\u671F","\u7B2C@\u56DB\u534A\u671F","#\u56DB\u534A\u671F"],codes:["# q"]},ko:{words:["#\uBD84\uAE30","#/4\uBD84\uAE30"]},ar:{words:["\u0627\u0644\u0631\u0628\u0639 #","\u0627\u0644\u0631\u0628\u0639 @","\u0631\u0628\u0639 #"]},he:{words:["\u05E8\u05D1\u05E2\u05D5\u05DF #","\u05E8\u05D1\u05E2\u05D5\u05DF @"]},hi:{words:["\u0924\u093F\u092E\u093E\u0939\u0940 #","# \u0924\u093F\u092E\u093E\u0939\u0940","@ \u0924\u093F\u092E\u093E\u0939\u0940"]},th:{words:["\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A #","\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A\u0E17\u0E35\u0E48 #"]}},half:{en:{words:["half #"],codes:["h #"]},nl:{words:["halfjaar #","# halfjaar","@ halfjaar"]},de:{words:["halbjahr #","# halbjahr","@ halbjahr"],codes:["hj #"]},fr:{words:["semestre #","# semestre","#er semestre","#e semestre","#eme semestre","@ semestre"],codes:["s #"]},es:{words:["semestre #","# semestre","#er semestre","#o semestre","#\xBA semestre","#\xB0 semestre","@ semestre"],codes:["s #","# s"]},pt:{words:["semestre #","# semestre","#o semestre","#\xBA semestre","#\xB0 semestre","@ semestre"],codes:["s #","# s"]},it:{words:["semestre #","# semestre","#\xBA semestre","#\xB0 semestre","% semestre","@ semestre"],codes:["s #"]},pl:{words:["p\xF3\u0142rocze #","# p\xF3\u0142rocze","% p\xF3\u0142rocze","@ p\xF3\u0142rocze"]},cs:{words:["pololet\xED #","# pololet\xED","% pololet\xED","@ pololet\xED"]},sk:{words:["polrok #","# polrok","% polrok"]},sv:{words:["halv\xE5r #","# halv\xE5ret","@ halv\xE5ret"]},da:{words:["halv\xE5r #","# halv\xE5r","@ halv\xE5r"]},nb:{words:["halv\xE5r #","# halv\xE5r","@ halv\xE5r"]},fi:{words:["vuosipuolisko #","# vuosipuolisko"]},hu:{words:["f\xE9l\xE9v #","# f\xE9l\xE9v","% f\xE9l\xE9v"]},tr:{words:["yar\u0131y\u0131l #","# yar\u0131y\u0131l","@ yar\u0131y\u0131l"]},ro:{words:["semestrul #","semestrul %"],codes:["s #"]},hr:{words:["polugodi\u0161te #","# polugodi\u0161te","% polugodi\u0161te"]},id:{words:["semester #","semester %"]},ru:{words:["\u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435 #","# \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435","% \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435","@ \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435"]},uk:{words:["\u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F #","# \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F","% \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F","@ \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F"]},el:{words:["\u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF #","# \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF","#\u03BF \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF","@ \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF"]},zh:{words:["\u4E0A\u534A\u5E74=1","\u4E0B\u534A\u5E74=2"]},ja:{words:["\u4E0A\u671F=1","\u4E0B\u671F=2","\u4E0A\u534A\u671F=1","\u4E0B\u534A\u671F=2"]},ko:{words:["\uC0C1\uBC18\uAE30=1","\uD558\uBC18\uAE30=2"]},ar:{words:["\u0627\u0644\u0646\u0635\u0641 @"]},he:{words:["\u05D7\u05E6\u05D9\u05D5\u05DF #"]},hi:{words:["\u091B\u092E\u093E\u0939\u0940 #","@ \u091B\u092E\u093E\u0939\u0940"]},th:{words:["\u0E04\u0E23\u0E36\u0E48\u0E07\u0E1B\u0E35\u0E41\u0E23\u0E01=1","\u0E04\u0E23\u0E36\u0E48\u0E07\u0E1B\u0E35\u0E2B\u0E25\u0E31\u0E07=2"]}},week:{en:{words:["week #","wk #"],codes:["w #"]},de:{words:["woche #","# woche","kw #"]},fr:{words:["semaine #","sem. #"],codes:["s #"]},es:{words:["semana #","sem. #"],codes:["s #"]},pt:{words:["semana #","sem. #"],codes:["s #"]},it:{words:["settimana #","sett. #"]},pl:{words:["tydzie\u0144 #","# tydzie\u0144","tydz. #"]},cs:{words:["t\xFDden #","# t\xFDden"]},sk:{words:["t\xFD\u017Ede\u0148 #","# t\xFD\u017Ede\u0148"]},sv:{words:["vecka #"],codes:["v #"]},da:{words:["uge #"]},nb:{words:["uke #"]},fi:{words:["viikko #","vko #","vk #"]},hu:{words:["h\xE9t #","# h\xE9t"]},tr:{words:["hafta #","# hafta"]},ro:{words:["s\u0103pt\u0103m\xE2na #"]},hr:{words:["tjedan #","# tjedan"]},id:{words:["minggu #","minggu ke #"]},vi:{words:["tu\u1EA7n #"]},ru:{words:["\u043D\u0435\u0434\u0435\u043B\u044F #","# \u043D\u0435\u0434\u0435\u043B\u044F","\u043D\u0435\u0434. #"]},uk:{words:["\u0442\u0438\u0436\u0434\u0435\u043D\u044C #","# \u0442\u0438\u0436\u0434\u0435\u043D\u044C","\u0442\u0438\u0436. #"]},el:{words:["\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1 #","# \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1"]},zh:{words:["\u7B2C#\u5468"]},ja:{words:["\u7B2C#\u9031"]},ko:{words:["#\uC8FC","#\uC8FC\uCC28"]},ar:{words:["\u0627\u0644\u0623\u0633\u0628\u0648\u0639 #","\u0623\u0633\u0628\u0648\u0639 #"]},he:{words:["\u05E9\u05D1\u05D5\u05E2 #"]},hi:{words:["\u0938\u092A\u094D\u0924\u093E\u0939 #"]},th:{words:["\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C #","\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C\u0E17\u0E35\u0E48 #"]}}},G={nl:[["eerste"],["tweede"],["derde"],["vierde"]],de:[["erstes","erste"],["zweites","zweite"],["drittes","dritte"],["viertes","vierte"]],fr:[["premier"],["deuxi\xE8me","second"],["troisi\xE8me"],["quatri\xE8me"]],es:[["primer","primero"],["segundo"],["tercer","tercero"],["cuarto"]],pt:[["primeiro"],["segundo"],["terceiro"],["quarto"]],it:[["primo"],["secondo"],["terzo"],["quarto"]],pl:[["pierwszy","pierwsze"],["drugi","drugie"],["trzeci","trzecie"],["czwarty","czwarte"]],cs:[["prvn\xED"],["druh\xE9","druh\xFD"],["t\u0159et\xED"],["\u010Dtvrt\xE9","\u010Dtvrt\xFD"]],sk:[["prv\xFD"],["druh\xFD"],["tret\xED"],["\u0161tvrt\xFD"]],sv:[["f\xF6rsta"],["andra"],["tredje"],["fj\xE4rde"]],da:[["f\xF8rste"],["andet","anden"],["tredje"],["fjerde"]],nb:[["f\xF8rste"],["andre"],["tredje"],["fjerde"]],tr:[["birinci","ilk"],["ikinci"],["\xFC\xE7\xFCnc\xFC"],["d\xF6rd\xFCnc\xFC"]],ru:[["\u043F\u0435\u0440\u0432\u044B\u0439","\u043F\u0435\u0440\u0432\u043E\u0435"],["\u0432\u0442\u043E\u0440\u043E\u0439","\u0432\u0442\u043E\u0440\u043E\u0435"],["\u0442\u0440\u0435\u0442\u0438\u0439","\u0442\u0440\u0435\u0442\u044C\u0435"],["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044B\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435"]],uk:[["\u043F\u0435\u0440\u0448\u0438\u0439","\u043F\u0435\u0440\u0448\u0435"],["\u0434\u0440\u0443\u0433\u0438\u0439","\u0434\u0440\u0443\u0433\u0435"],["\u0442\u0440\u0435\u0442\u0456\u0439","\u0442\u0440\u0435\u0442\u0454"],["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0438\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435"]],el:[["\u03C0\u03C1\u03CE\u03C4\u03BF"],["\u03B4\u03B5\u03CD\u03C4\u03B5\u03C1\u03BF"],["\u03C4\u03C1\u03AF\u03C4\u03BF"],["\u03C4\u03AD\u03C4\u03B1\u03C1\u03C4\u03BF"]],zh:[["\u4E00"],["\u4E8C"],["\u4E09"],["\u56DB"]],ja:[["\u4E00"],["\u4E8C"],["\u4E09"],["\u56DB"]],ar:[["\u0627\u0644\u0623\u0648\u0644"],["\u0627\u0644\u062B\u0627\u0646\u064A"],["\u0627\u0644\u062B\u0627\u0644\u062B"],["\u0627\u0644\u0631\u0627\u0628\u0639"]],he:[["\u05E8\u05D0\u05E9\u05D5\u05DF"],["\u05E9\u05E0\u05D9"],["\u05E9\u05DC\u05D9\u05E9\u05D9"],["\u05E8\u05D1\u05D9\u05E2\u05D9"]],hi:[["\u092A\u0939\u0932\u0940","\u092A\u0939\u0932\u093E"],["\u0926\u0942\u0938\u0930\u0940","\u0926\u0942\u0938\u0930\u093E"],["\u0924\u0940\u0938\u0930\u0940","\u0924\u0940\u0938\u0930\u093E"],["\u091A\u094C\u0925\u0940","\u091A\u094C\u0925\u093E"]]},te=["\xE7 #"],oe=String.raw`[\s\-_./]*`,se={i:1,ii:2,iii:3,iv:4};function g(e,r){let t=String(e??"").normalize("NFC").toLowerCase();return r||(t=_(t)),t.replace(/[\s_]+/g," ").trim().replace(/\.+$/,"").trim()}function L(e){return/[.*+?^${}()|[\]\\]/.test(e)?"\\"+e:e}function E(e,r,t,n){let s=!!p(r)?.foldSensitive||te.includes(e),i=e,a=null,d=/=(\d+)$/.exec(i);d&&(a=Number(d[1]),i=i.slice(0,d.index));let u=(G[r]??[]).map(m=>m.map(w=>g(w,s))),c=a!==null?{kind:"fixed",n:a}:{kind:"digits"},l="";for(let m of g(i,s))if(m==="#")l+="([0-9]{1,2})",c={kind:"digits"};else if(m==="%")l+="(iv|iii|ii|i)",c={kind:"roman"};else if(m==="@"){let w=u.flat().sort((k,Z)=>Z.length-k.length).map(k=>[...k].map(L).join(""));l+="("+w.join("|")+")",c={kind:"ordinal",words:u}}else m===" "?l+=oe:m==="."?l+="\\.?":l+=L(m);return{lang:r,grain:t,form:n,unfold:s,re:new RegExp("^"+l+"$","u"),number:c}}var b=null;function ae(){if(b)return b;let e=[];for(let r of Object.keys(h))for(let[t,n]of Object.entries(h[r])){for(let o of n.words??[])e.push(E(o,t,r,"word"));for(let o of n.codes??[])e.push(E(o,t,r,"code"))}return b=e,e}var I=/^[0-9]+$/,P=/^[0-9]/,A=/[0-9]$/,ie=/^[\s\-_./,']*/,le=/[\s\-_./,']*$/,de=/^(年|년)/u;function T(e){if(e.length===4){let r=Number(e);return r>=1900&&r<=2099?r:null}return 2e3+Number(e)}function F(e){let r=[{body:e,year:null,yearDigits:0}];for(let t of[4,2]){if(e.length<=t)continue;let n=e.slice(0,t);if(I.test(n)&&!P.test(e.slice(t))){let i=e.slice(t),a=de.exec(i),d=a?i.slice(a[0].length):i,u=ie.exec(d)[0],c=d.slice(u.length),l=T(n);c&&l!==null&&(a||u||!P.test(c))&&r.push({body:c,year:l,yearDigits:t})}let o=e.slice(e.length-t),s=e.slice(0,e.length-t);if(I.test(o)&&!A.test(s)){let i=le.exec(s)[0],a=s.slice(0,s.length-i.length),d=T(o);a&&d!==null&&(i||!A.test(a))&&r.push({body:a,year:d,yearDigits:t})}}return r}var y=null;function ce(){if(y)return y;let e=new Set;for(let[r,t]of Object.entries(G)){let n=!!p(r)?.foldSensitive;for(let o of t)for(let s of o)e.add(g(s,!1)),n&&e.add(g(s,!0))}for(let r of Object.keys(h))for(let t of Object.values(h[r]))for(let n of t?.words??[]){let o=/=[0-9]+$/.exec(n);o&&e.add(g(n.slice(0,o.index),!1))}return y=[...e],y}var ue=/[0-9]/,me=/(^|[^\p{L}])(iv|iii|ii|i)([^\p{L}]|$)/u;function V(e){return ue.test(e)||me.test(e)?!0:ce().some(r=>e.includes(r))}function fe(e,r){switch(e.number.kind){case"fixed":return e.number.n;case"digits":return r[1]===void 0?null:Number(r[1]);case"roman":return r[1]===void 0?null:se[r[1]]??null;case"ordinal":{let t=r[1],n=e.number.words.findIndex(o=>o.includes(t));return n<0?null:n+1}}}function ge(e){let r=String(e??"");if(!r.trim()||r.length>40)return[];let t=g(r,!1),n=g(r,!0);if(!V(t)&&!V(n))return[];let o=F(t),s=F(n),i=[],a=new Set;for(let d of ae()){let u=d.lang+"|"+d.grain;if(!a.has(u))for(let c of d.unfold?s:o){let l=d.re.exec(c.body);if(!l)continue;let m=fe(d,l);if(!(m===null||m<1||m>ne[d.grain])){i.push({lang:d.lang,grain:d.grain,n:m,year:c.year,yearDigits:c.yearDigits,form:d.form}),a.add(u);break}}}return i}function W(e,r=()=>!0){if(e.length===0)return null;let t=e.map(n=>ge(n).filter(r));if(t.some(n=>n.length===0))return null;for(let n of Object.keys(h))for(let o of Object.keys(h[n])){let s=[],i=0;for(let a of t){let d=a.find(l=>l.grain===n&&l.lang===o),c=a.find(l=>l.grain===n&&l.lang==="en")??d;if(!c)break;c.lang===o&&i++,s.push(c)}if(s.length===e.length&&(o==="en"||i>0))return{lang:o,grain:n,readings:s}}return null}var K=[{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"]}],he={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"},pe=(()=>{let e=new Set;for(let r of K)for(let t of r.canonical)e.add(f(t));return e})(),ye=(()=>{let e=new Map;for(let[r,t]of Object.entries(he)){let n=f(r);pe.has(n)||e.has(n)||e.set(n,f(t))}return e})();function U(e){return ye.get(e)??e}var we=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 $e(e){if(!e)return!1;for(let r of M(e))if(we.has(r))return!0;return N(e)!==null||z(e)!==null}function f(e){return e.toLowerCase().replace(/[-_]+/g," ").replace(/\s+/g," ").trim()}function X(e){return S(e.normalize("NFD").replace(/\p{Diacritic}/gu,""))}function ke(e){let r=new Map;for(let[t,n]of e){let o=X(t);if(!o)continue;let s=r.get(o);r.set(o,s===void 0||s===n?n:-1)}return r}function v(e){let r=new Map;for(let[t,n]of e)for(let o of t)r.set(f(o),n);return r}var C=[{name:"weekday_mon_sun",minMatches:4,dict:v([[["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:v([[["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:v([[["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]])}],Y={};function be(e){let r=e||"";if(!r)return{weekday:new Map,month:new Map};let t=Y[r];if(t)return t;let n=new Map,o=new Map,s=(a,d,u)=>{let c=f(d);c&&a.set(c,u);let l=f(d.replace(/\./g,""));l&&l!==c&&a.set(l,u)};try{let a=new Intl.DateTimeFormat(r,{weekday:"long",timeZone:"UTC"}),d=new Intl.DateTimeFormat(r,{weekday:"short",timeZone:"UTC"});for(let l=0;l<7;++l){let m=new Date(Date.UTC(2024,0,1+l));s(n,a.format(m),l),s(n,d.format(m),l)}let u=new Intl.DateTimeFormat(r,{month:"long"}),c=new Intl.DateTimeFormat(r,{month:"short"});for(let l=0;l<12;++l){let m=new Date(Date.UTC(2020,l,15));s(o,u.format(m),l),s(o,c.format(m),l)}}catch{}let i={weekday:n,month:o};return Y[r]=i,i}function $(e,r){if(r.size===0)return e;let t=new Map(e);for(let[n,o]of r)t.has(n)||t.set(n,o);return t}function ve(e,r){let t=be(r);for(let n of C){let o=n.name==="weekday_mon_sun"?$(n.dict,t.weekday):n.name==="month_jan_dec"?$(n.dict,t.month):n.dict,s=!0,i=null,a=new Map;for(let[u,c]of e){let l=o.get(u);if(l===void 0){i=i??ke(o);let m=i.get(X(u));l=m===void 0||m<0?void 0:m}if(l===void 0){s=!1;break}a.has(l)||a.set(l,c)}if(!s||a.size<n.minMatches)continue;let d=[...a.entries()].sort((u,c)=>u[0]-c[0]).map(u=>u[1]);return{pattern:n.name,orderedDomain:d}}return Ce(e)}var H=C.find(e=>e.name==="quarter_q1_q4");function Ce(e){let r=[...e.values()],t=W(r,s=>s.grain==="quarter"&&s.year===null&&(s.lang==="en"||s.form==="word"));if(!t||t.lang==="en")return null;let n=new Map;if(t.readings.forEach((s,i)=>{n.has(s.n)||n.set(s.n,r[i])}),n.size<H.minMatches)return null;let o=[...n.entries()].sort((s,i)=>s[0]-i[0]).map(s=>s[1]);return{pattern:H.name,orderedDomain:o}}function B(e){let r=new Map;for(let t of e){if(t==null)continue;let n=String(t);if(n.length===0)continue;let o=f(n);r.has(o)||r.set(o,n)}return r}var _e=15,Me=10,xe=(()=>{let e=["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"],r=new Set(e.map(f));for(let t of C)for(let n of t.dict.keys())r.add(n);return r})();function Re(e){let r=e.trim();return r.length===0||r.length>Me||(r.match(/\p{L}/gu)||[]).length>1?!1:/\p{Nd}/u.test(r)}function De(e){let r=e.trim();return r.length===1&&/[\p{L}\p{Nd}]/u.test(r)}function He(e){if(!e||e.length===0)return null;let r=new Set,t=[];for(let n of e){if(n==null)continue;let o=String(n);if(r.has(o))continue;let s=f(o);if(!(s===""||xe.has(s)||Re(o)||De(o))||(r.add(o),t.push(o),t.length>_e))return null}return t.length>0?t:null}var je=/^(\p{L}{0,3}) ?([0-9]+)\s*[-–—:.)]\s*(.+)$/u;function Se(e){let r=null,t=new Set,n=[];for(let o of e.values()){let s=je.exec(o.trim());if(!s)return null;let i=s[1].toLowerCase();if(r===null)r=i;else if(i!==r)return null;let a=Number(s[2]);if(t.has(a)||f(s[3])==="")return null;t.add(a),n.push({code:a,original:o,label:s[3]})}return n}function qe(e,r){let t=Q(B(e.map(a=>a.label)),r);if(t===null)return;if(t.orderedDomain.length!==e.length)return null;let n=new Map;for(let a of e)n.set(a.label,a);let o=t.orderedDomain.map(a=>n.get(a));if(o.some(a=>a===void 0))return null;let s=!0,i=!0;for(let a=1;a<o.length;++a)o[a].code<=o[a-1].code&&(s=!1),o[a].code>=o[a-1].code&&(i=!1);return!s&&!i?null:{pattern:t.pattern,orderedDomain:o.map(a=>a.original)}}function Ke(e,r){if(!e||e.length<2)return null;let t=B(e);if(t.size<2)return null;let n=Se(t);if(n!==null){let s=qe(n,r);if(s!==void 0)return s}let o=Q(t,r);return o!==null?o:n!==null?Le(t):null}var Oe=/^([0-9]+)\s*(?:\.|\)|-)\s*([^\s\d].*)$/u,ze=3,Ne=20;function Le(e){if(e.size<ze||e.size>Ne)return null;let r=new Set,t=[];for(let n of e.values()){let o=Oe.exec(n.trim());if(!o||f(o[2])==="")return null;let s=Number(o[1]);if(r.has(s))return null;r.add(s),t.push({n:s,original:n})}return t.sort((n,o)=>n.n-o.n),{pattern:"numeric_rank_prefix",orderedDomain:t.map(n=>n.original)}}function Q(e,r){let t=new Map;for(let[o,s]of e){let i=U(o);t.has(i)||t.set(i,s)}let n=null;for(let o of K){let s=[];for(let u of o.canonical){let c=t.get(u);c!==void 0&&s.push(c)}if(s.length<o.minMatches)continue;let i=new Set(o.canonical),a=!0;for(let u of e.keys())if(!i.has(U(u))){a=!1;break}if(!a)continue;let d;n===null||s.length>n.matched||s.length===n.matched&&o.canonical.length<n.pattern.canonical.length?d=!0:d=!1,d&&(n={pattern:o,matched:s.length,orderedDomain:s})}return n?{pattern:n.pattern.name,orderedDomain:n.orderedDomain}:ve(e,r)}export{Pe as a,J as b,q as c,O as d,z as e,N as f,ne as g,h,G as i,te as j,ge as k,W as l,$e as m,He as n,Ke as o};
2
+ import{a as _,b as M,d as x,g as R,h as D,n as j}from"./chunk-CZJ7M6A5.mjs";import{f as p}from"./chunk-WC4JINEZ.mjs";import{a as S}from"./chunk-5HI6TVMM.mjs";var Pe=Object.freeze({hour:24,weekday:7,month:12,quarter:4,week:53,season:4}),J={nl:["jaar"],de:["jahr"],fr:["ann\xE9e"],es:["a\xF1o"],pt:["ano"],it:["anno"],pl:["rok"],cs:["rok"],sk:["rok"],sv:["\xE5r"],da:["\xE5r"],nb:["\xE5r"],fi:["vuosi"],hu:["\xE9v"],tr:["y\u0131l"],ro:["anul"],hr:["godina"],id:["tahun"],vi:["n\u0103m"],ru:["\u0433\u043E\u0434"],uk:["\u0440\u0456\u043A"],el:["\u03AD\u03C4\u03BF\u03C2"],zh:["\u5E74\u4EFD","\u5E74\u5EA6"],ja:["\u5E74\u5EA6"],ko:["\uC5F0\uB3C4","\uB144\uB3C4"],ar:["\u0633\u0646\u0629"],he:["\u05E9\u05E0\u05D4"],hi:["\u0935\u0930\u094D\u0937","\u0938\u093E\u0932"],th:["\u0E1B\u0E35\u0E07\u0E1A\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13"],fa:["\u0633\u0627\u0644"]},q={hour:{de:["stunde"],fr:["heure"],es:["hora"],pt:["hora"],it:["ora"],pl:["godzina"],cs:["hodina"],sk:["hodina"],sv:["timme"],fi:["tunti"],hu:["\xF3ra"],ro:["ora"],vi:["gi\u1EDD"],ru:["\u0447\u0430\u0441"],uk:["\u0433\u043E\u0434\u0438\u043D\u0430"],el:["\u03CE\u03C1\u03B1"],zh:["\u5C0F\u65F6"],ar:["\u0633\u0627\u0639\u0629"],he:["\u05E9\u05E2\u05D4"],hi:["\u0918\u0902\u091F\u093E"],th:["\u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07"],fa:["\u0633\u0627\u0639\u062A"]},weekday:{nl:["weekdag"],de:["wochentag"],sv:["veckodag"],da:["ugedag"],nb:["ukedag"],fi:["viikonp\xE4iv\xE4"],zh:["\u661F\u671F"],ja:["\u66DC\u65E5"],ko:["\uC694\uC77C"]},month:{nl:["maand"],de:["monat"],fr:["mois"],es:["mes"],pt:["m\xEAs"],it:["mese"],pl:["miesi\u0105c"],cs:["m\u011Bs\xEDc"],sk:["mesiac"],sv:["m\xE5nad"],da:["m\xE5ned"],nb:["m\xE5ned"],fi:["kuukausi"],hu:["h\xF3nap"],hr:["mjesec"],id:["bulan"],vi:["th\xE1ng"],ru:["\u043C\u0435\u0441\u044F\u0446"],uk:["\u043C\u0456\u0441\u044F\u0446\u044C"],el:["\u03BC\u03AE\u03BD\u03B1\u03C2"],zh:["\u6708\u4EFD"],ar:["\u0634\u0647\u0631"],he:["\u05D7\u05D5\u05D3\u05E9"],hi:["\u092E\u0939\u0940\u0928\u093E","\u092E\u093E\u0939"],th:["\u0E40\u0E14\u0E37\u0E2D\u0E19"],fa:["\u0645\u0627\u0647"]},quarter:{nl:["kwartaal"],de:["quartal"],fr:["trimestre"],es:["trimestre"],pt:["trimestre"],it:["trimestre"],pl:["kwarta\u0142"],cs:["\u010Dtvrtlet\xED"],sk:["\u0161tvr\u0165rok"],sv:["kvartal"],da:["kvartal"],nb:["kvartal"],fi:["vuosinelj\xE4nnes"],hu:["negyed\xE9v"],tr:["\xE7eyrek"],ro:["trimestru"],hr:["tromjese\u010Dje"],id:["kuartal","triwulan"],vi:["qu\xFD"],ru:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B"],uk:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B"],el:["\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF"],zh:["\u5B63\u5EA6"],ja:["\u56DB\u534A\u671F"],ko:["\uBD84\uAE30"],ar:["\u0631\u0628\u0639"],he:["\u05E8\u05D1\u05E2\u05D5\u05DF"],hi:["\u0924\u093F\u092E\u093E\u0939\u0940"],th:["\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A"]},week:{de:["woche"],fr:["semaine"],es:["semana"],pt:["semana"],it:["settimana"],pl:["tydzie\u0144"],cs:["t\xFDden"],sk:["t\xFD\u017Ede\u0148"],sv:["vecka"],da:["uge"],nb:["uke"],fi:["viikko"],hu:["h\xE9t"],tr:["hafta"],ro:["s\u0103pt\u0103m\xE2n\u0103"],hr:["tjedan"],id:["minggu"],vi:["tu\u1EA7n"],ru:["\u043D\u0435\u0434\u0435\u043B\u044F"],uk:["\u0442\u0438\u0436\u0434\u0435\u043D\u044C"],el:["\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1"],ar:["\u0623\u0633\u0628\u0648\u0639"],he:["\u05E9\u05D1\u05D5\u05E2"],hi:["\u0938\u092A\u094D\u0924\u093E\u0939"],th:["\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C"],fa:["\u0647\u0641\u062A\u0647"]},season:{nl:["seizoen"],de:["jahreszeit"],fr:["saison"],es:["temporada"],it:["stagione"],pl:["sezon"],cs:["sez\xF3na"],sk:["sez\xF3na"],sv:["s\xE4song","\xE5rstid"],da:["s\xE6son","\xE5rstid"],nb:["sesong","\xE5rstid"],fi:["vuodenaika"],hu:["\xE9vszak"],tr:["mevsim"],ro:["anotimp"],vi:["m\xF9a"],ru:["\u0441\u0435\u0437\u043E\u043D"],uk:["\u0441\u0435\u0437\u043E\u043D"],el:["\u03B5\u03C0\u03BF\u03C7\u03AE"],zh:["\u5B63\u8282"],ja:["\u5B63\u7BC0"],ko:["\uACC4\uC808"],ar:["\u0645\u0648\u0633\u0645"],he:["\u05E2\u05D5\u05E0\u05D4"],hi:["\u092E\u094C\u0938\u092E"],th:["\u0E24\u0E14\u0E39"],fa:["\u0641\u0635\u0644"]}},ee=["\xE5r","\xE9v","h\xE9t","\xF3ra"];function re(e,r,t){let n=p(t);if(!n)return null;let o=r.normalize("NFC").toLowerCase(),s=x(e).words;return s.includes(o)?"word":n.compounds&&s.some(i=>D(i,o,R))?"suffix":null}function O(e,r){let t=String(e??"");if(!t.trim())return null;for(let[n,o]of Object.entries(r))for(let s of o){let i=ee.includes(s)?re(t,s,n):j(t,s,n);if(i)return{lang:n,word:s,view:i}}return null}function z(e){return O(e,J)}function N(e){let r=null;for(let t of Object.keys(q)){let n=O(e,q[t]);if(n){if(r&&r.concept!==t)return null;r={concept:t,hit:n}}}return r}var ne=Object.freeze({quarter:4,half:2,week:53}),h={quarter:{en:{words:["quarter #","qtr #"],codes:["q #"]},nl:{words:["kwartaal #","# kwartaal","#e kwartaal","@ kwartaal"],codes:["k #"]},de:{words:["quartal #","# quartal","@ quartal"]},fr:{words:["trimestre #","# trimestre","#er trimestre","#e trimestre","#eme trimestre","@ trimestre"],codes:["t #","# t","trim. #"]},es:{words:["trimestre #","# trimestre","#er trimestre","#o trimestre","#\xBA trimestre","#\xB0 trimestre","@ trimestre"],codes:["t #","# t","trim. #"]},pt:{words:["trimestre #","# trimestre","#o trimestre","#\xBA trimestre","#\xB0 trimestre","@ trimestre"],codes:["t #","# t","#\xBA t","trim. #"]},it:{words:["trimestre #","# trimestre","#\xBA trimestre","#\xB0 trimestre","% trimestre","@ trimestre"],codes:["t #","trim. #"]},pl:{words:["kwarta\u0142 #","# kwarta\u0142","% kwarta\u0142","@ kwarta\u0142","# kw.","% kw."]},cs:{words:["\u010Dtvrtlet\xED #","# \u010Dtvrtlet\xED","% \u010Dtvrtlet\xED","@ \u010Dtvrtlet\xED"]},sk:{words:["\u0161tvr\u0165rok #","# \u0161tvr\u0165rok","% \u0161tvr\u0165rok","@ \u0161tvr\u0165rok"]},sv:{words:["kvartal #","# kvartalet","#:a kvartalet","#:e kvartalet","@ kvartalet"],codes:["k #"]},da:{words:["kvartal #","# kvartal","@ kvartal"],codes:["k #"]},nb:{words:["kvartal #","# kvartal","@ kvartal"],codes:["k #"]},fi:{words:["nelj\xE4nnes #","# nelj\xE4nnes","# vuosinelj\xE4nnes","vuosinelj\xE4nnes #"]},hu:{words:["negyed\xE9v #","# negyed\xE9v","% negyed\xE9v"]},tr:{words:["\xE7eyrek #","# \xE7eyrek","@ \xE7eyrek"],codes:["\xE7 #"]},ro:{words:["trimestrul #","trimestrul %","trimestru #"],codes:["t #"]},hr:{words:["tromjese\u010Dje #","# tromjese\u010Dje","% tromjese\u010Dje","kvartal #","# kvartal"]},id:{words:["kuartal #","kuartal %","kuartal ke #","triwulan #","triwulan %","triwulan ke #"],codes:["tw #","tw %"]},vi:{words:["qu\xFD #","qu\xFD %"]},ru:{words:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B #","# \u043A\u0432\u0430\u0440\u0442\u0430\u043B","% \u043A\u0432\u0430\u0440\u0442\u0430\u043B","@ \u043A\u0432\u0430\u0440\u0442\u0430\u043B","# \u043A\u0432.","% \u043A\u0432."]},uk:{words:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B #","# \u043A\u0432\u0430\u0440\u0442\u0430\u043B","% \u043A\u0432\u0430\u0440\u0442\u0430\u043B","@ \u043A\u0432\u0430\u0440\u0442\u0430\u043B","# \u043A\u0432.","% \u043A\u0432."]},el:{words:["\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF #","# \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF","#\u03BF \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF","@ \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF"]},zh:{words:["\u7B2C#\u5B63\u5EA6","\u7B2C@\u5B63\u5EA6","@\u5B63\u5EA6","#\u5B63\u5EA6"]},ja:{words:["\u7B2C#\u56DB\u534A\u671F","\u7B2C@\u56DB\u534A\u671F","#\u56DB\u534A\u671F"],codes:["# q"]},ko:{words:["#\uBD84\uAE30","#/4\uBD84\uAE30"]},ar:{words:["\u0627\u0644\u0631\u0628\u0639 #","\u0627\u0644\u0631\u0628\u0639 @","\u0631\u0628\u0639 #"]},he:{words:["\u05E8\u05D1\u05E2\u05D5\u05DF #","\u05E8\u05D1\u05E2\u05D5\u05DF @"]},hi:{words:["\u0924\u093F\u092E\u093E\u0939\u0940 #","# \u0924\u093F\u092E\u093E\u0939\u0940","@ \u0924\u093F\u092E\u093E\u0939\u0940"]},th:{words:["\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A #","\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A\u0E17\u0E35\u0E48 #"]}},half:{en:{words:["half #"],codes:["h #"]},nl:{words:["halfjaar #","# halfjaar","@ halfjaar"]},de:{words:["halbjahr #","# halbjahr","@ halbjahr"],codes:["hj #"]},fr:{words:["semestre #","# semestre","#er semestre","#e semestre","#eme semestre","@ semestre"],codes:["s #"]},es:{words:["semestre #","# semestre","#er semestre","#o semestre","#\xBA semestre","#\xB0 semestre","@ semestre"],codes:["s #","# s"]},pt:{words:["semestre #","# semestre","#o semestre","#\xBA semestre","#\xB0 semestre","@ semestre"],codes:["s #","# s"]},it:{words:["semestre #","# semestre","#\xBA semestre","#\xB0 semestre","% semestre","@ semestre"],codes:["s #"]},pl:{words:["p\xF3\u0142rocze #","# p\xF3\u0142rocze","% p\xF3\u0142rocze","@ p\xF3\u0142rocze"]},cs:{words:["pololet\xED #","# pololet\xED","% pololet\xED","@ pololet\xED"]},sk:{words:["polrok #","# polrok","% polrok"]},sv:{words:["halv\xE5r #","# halv\xE5ret","@ halv\xE5ret"]},da:{words:["halv\xE5r #","# halv\xE5r","@ halv\xE5r"]},nb:{words:["halv\xE5r #","# halv\xE5r","@ halv\xE5r"]},fi:{words:["vuosipuolisko #","# vuosipuolisko"]},hu:{words:["f\xE9l\xE9v #","# f\xE9l\xE9v","% f\xE9l\xE9v"]},tr:{words:["yar\u0131y\u0131l #","# yar\u0131y\u0131l","@ yar\u0131y\u0131l"]},ro:{words:["semestrul #","semestrul %"],codes:["s #"]},hr:{words:["polugodi\u0161te #","# polugodi\u0161te","% polugodi\u0161te"]},id:{words:["semester #","semester %"]},ru:{words:["\u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435 #","# \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435","% \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435","@ \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435"]},uk:{words:["\u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F #","# \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F","% \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F","@ \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F"]},el:{words:["\u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF #","# \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF","#\u03BF \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF","@ \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF"]},zh:{words:["\u4E0A\u534A\u5E74=1","\u4E0B\u534A\u5E74=2"]},ja:{words:["\u4E0A\u671F=1","\u4E0B\u671F=2","\u4E0A\u534A\u671F=1","\u4E0B\u534A\u671F=2"]},ko:{words:["\uC0C1\uBC18\uAE30=1","\uD558\uBC18\uAE30=2"]},ar:{words:["\u0627\u0644\u0646\u0635\u0641 @"]},he:{words:["\u05D7\u05E6\u05D9\u05D5\u05DF #"]},hi:{words:["\u091B\u092E\u093E\u0939\u0940 #","@ \u091B\u092E\u093E\u0939\u0940"]},th:{words:["\u0E04\u0E23\u0E36\u0E48\u0E07\u0E1B\u0E35\u0E41\u0E23\u0E01=1","\u0E04\u0E23\u0E36\u0E48\u0E07\u0E1B\u0E35\u0E2B\u0E25\u0E31\u0E07=2"]}},week:{en:{words:["week #","wk #"],codes:["w #"]},de:{words:["woche #","# woche","kw #"]},fr:{words:["semaine #","sem. #"],codes:["s #"]},es:{words:["semana #","sem. #"],codes:["s #"]},pt:{words:["semana #","sem. #"],codes:["s #"]},it:{words:["settimana #","sett. #"]},pl:{words:["tydzie\u0144 #","# tydzie\u0144","tydz. #"]},cs:{words:["t\xFDden #","# t\xFDden"]},sk:{words:["t\xFD\u017Ede\u0148 #","# t\xFD\u017Ede\u0148"]},sv:{words:["vecka #"],codes:["v #"]},da:{words:["uge #"]},nb:{words:["uke #"]},fi:{words:["viikko #","vko #","vk #"]},hu:{words:["h\xE9t #","# h\xE9t"]},tr:{words:["hafta #","# hafta"]},ro:{words:["s\u0103pt\u0103m\xE2na #"]},hr:{words:["tjedan #","# tjedan"]},id:{words:["minggu #","minggu ke #"]},vi:{words:["tu\u1EA7n #"]},ru:{words:["\u043D\u0435\u0434\u0435\u043B\u044F #","# \u043D\u0435\u0434\u0435\u043B\u044F","\u043D\u0435\u0434. #"]},uk:{words:["\u0442\u0438\u0436\u0434\u0435\u043D\u044C #","# \u0442\u0438\u0436\u0434\u0435\u043D\u044C","\u0442\u0438\u0436. #"]},el:{words:["\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1 #","# \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1"]},zh:{words:["\u7B2C#\u5468"]},ja:{words:["\u7B2C#\u9031"]},ko:{words:["#\uC8FC","#\uC8FC\uCC28"]},ar:{words:["\u0627\u0644\u0623\u0633\u0628\u0648\u0639 #","\u0623\u0633\u0628\u0648\u0639 #"]},he:{words:["\u05E9\u05D1\u05D5\u05E2 #"]},hi:{words:["\u0938\u092A\u094D\u0924\u093E\u0939 #"]},th:{words:["\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C #","\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C\u0E17\u0E35\u0E48 #"]}}},G={nl:[["eerste"],["tweede"],["derde"],["vierde"]],de:[["erstes","erste"],["zweites","zweite"],["drittes","dritte"],["viertes","vierte"]],fr:[["premier"],["deuxi\xE8me","second"],["troisi\xE8me"],["quatri\xE8me"]],es:[["primer","primero"],["segundo"],["tercer","tercero"],["cuarto"]],pt:[["primeiro"],["segundo"],["terceiro"],["quarto"]],it:[["primo"],["secondo"],["terzo"],["quarto"]],pl:[["pierwszy","pierwsze"],["drugi","drugie"],["trzeci","trzecie"],["czwarty","czwarte"]],cs:[["prvn\xED"],["druh\xE9","druh\xFD"],["t\u0159et\xED"],["\u010Dtvrt\xE9","\u010Dtvrt\xFD"]],sk:[["prv\xFD"],["druh\xFD"],["tret\xED"],["\u0161tvrt\xFD"]],sv:[["f\xF6rsta"],["andra"],["tredje"],["fj\xE4rde"]],da:[["f\xF8rste"],["andet","anden"],["tredje"],["fjerde"]],nb:[["f\xF8rste"],["andre"],["tredje"],["fjerde"]],tr:[["birinci","ilk"],["ikinci"],["\xFC\xE7\xFCnc\xFC"],["d\xF6rd\xFCnc\xFC"]],ru:[["\u043F\u0435\u0440\u0432\u044B\u0439","\u043F\u0435\u0440\u0432\u043E\u0435"],["\u0432\u0442\u043E\u0440\u043E\u0439","\u0432\u0442\u043E\u0440\u043E\u0435"],["\u0442\u0440\u0435\u0442\u0438\u0439","\u0442\u0440\u0435\u0442\u044C\u0435"],["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044B\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435"]],uk:[["\u043F\u0435\u0440\u0448\u0438\u0439","\u043F\u0435\u0440\u0448\u0435"],["\u0434\u0440\u0443\u0433\u0438\u0439","\u0434\u0440\u0443\u0433\u0435"],["\u0442\u0440\u0435\u0442\u0456\u0439","\u0442\u0440\u0435\u0442\u0454"],["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0438\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435"]],el:[["\u03C0\u03C1\u03CE\u03C4\u03BF"],["\u03B4\u03B5\u03CD\u03C4\u03B5\u03C1\u03BF"],["\u03C4\u03C1\u03AF\u03C4\u03BF"],["\u03C4\u03AD\u03C4\u03B1\u03C1\u03C4\u03BF"]],zh:[["\u4E00"],["\u4E8C"],["\u4E09"],["\u56DB"]],ja:[["\u4E00"],["\u4E8C"],["\u4E09"],["\u56DB"]],ar:[["\u0627\u0644\u0623\u0648\u0644"],["\u0627\u0644\u062B\u0627\u0646\u064A"],["\u0627\u0644\u062B\u0627\u0644\u062B"],["\u0627\u0644\u0631\u0627\u0628\u0639"]],he:[["\u05E8\u05D0\u05E9\u05D5\u05DF"],["\u05E9\u05E0\u05D9"],["\u05E9\u05DC\u05D9\u05E9\u05D9"],["\u05E8\u05D1\u05D9\u05E2\u05D9"]],hi:[["\u092A\u0939\u0932\u0940","\u092A\u0939\u0932\u093E"],["\u0926\u0942\u0938\u0930\u0940","\u0926\u0942\u0938\u0930\u093E"],["\u0924\u0940\u0938\u0930\u0940","\u0924\u0940\u0938\u0930\u093E"],["\u091A\u094C\u0925\u0940","\u091A\u094C\u0925\u093E"]]},te=["\xE7 #"],oe=String.raw`[\s\-_./]*`,se={i:1,ii:2,iii:3,iv:4};function g(e,r){let t=String(e??"").normalize("NFC").toLowerCase();return r||(t=_(t)),t.replace(/[\s_]+/g," ").trim().replace(/\.+$/,"").trim()}function L(e){return/[.*+?^${}()|[\]\\]/.test(e)?"\\"+e:e}function E(e,r,t,n){let s=!!p(r)?.foldSensitive||te.includes(e),i=e,a=null,d=/=(\d+)$/.exec(i);d&&(a=Number(d[1]),i=i.slice(0,d.index));let u=(G[r]??[]).map(m=>m.map(w=>g(w,s))),c=a!==null?{kind:"fixed",n:a}:{kind:"digits"},l="";for(let m of g(i,s))if(m==="#")l+="([0-9]{1,2})",c={kind:"digits"};else if(m==="%")l+="(iv|iii|ii|i)",c={kind:"roman"};else if(m==="@"){let w=u.flat().sort((k,Z)=>Z.length-k.length).map(k=>[...k].map(L).join(""));l+="("+w.join("|")+")",c={kind:"ordinal",words:u}}else m===" "?l+=oe:m==="."?l+="\\.?":l+=L(m);return{lang:r,grain:t,form:n,unfold:s,re:new RegExp("^"+l+"$","u"),number:c}}var b=null;function ae(){if(b)return b;let e=[];for(let r of Object.keys(h))for(let[t,n]of Object.entries(h[r])){for(let o of n.words??[])e.push(E(o,t,r,"word"));for(let o of n.codes??[])e.push(E(o,t,r,"code"))}return b=e,e}var I=/^[0-9]+$/,P=/^[0-9]/,A=/[0-9]$/,ie=/^[\s\-_./,']*/,le=/[\s\-_./,']*$/,de=/^(年|년)/u;function T(e){if(e.length===4){let r=Number(e);return r>=1900&&r<=2099?r:null}return 2e3+Number(e)}function F(e){let r=[{body:e,year:null,yearDigits:0}];for(let t of[4,2]){if(e.length<=t)continue;let n=e.slice(0,t);if(I.test(n)&&!P.test(e.slice(t))){let i=e.slice(t),a=de.exec(i),d=a?i.slice(a[0].length):i,u=ie.exec(d)[0],c=d.slice(u.length),l=T(n);c&&l!==null&&(a||u||!P.test(c))&&r.push({body:c,year:l,yearDigits:t})}let o=e.slice(e.length-t),s=e.slice(0,e.length-t);if(I.test(o)&&!A.test(s)){let i=le.exec(s)[0],a=s.slice(0,s.length-i.length),d=T(o);a&&d!==null&&(i||!A.test(a))&&r.push({body:a,year:d,yearDigits:t})}}return r}var y=null;function ce(){if(y)return y;let e=new Set;for(let[r,t]of Object.entries(G)){let n=!!p(r)?.foldSensitive;for(let o of t)for(let s of o)e.add(g(s,!1)),n&&e.add(g(s,!0))}for(let r of Object.keys(h))for(let t of Object.values(h[r]))for(let n of t?.words??[]){let o=/=[0-9]+$/.exec(n);o&&e.add(g(n.slice(0,o.index),!1))}return y=[...e],y}var ue=/[0-9]/,me=/(^|[^\p{L}])(iv|iii|ii|i)([^\p{L}]|$)/u;function V(e){return ue.test(e)||me.test(e)?!0:ce().some(r=>e.includes(r))}function fe(e,r){switch(e.number.kind){case"fixed":return e.number.n;case"digits":return r[1]===void 0?null:Number(r[1]);case"roman":return r[1]===void 0?null:se[r[1]]??null;case"ordinal":{let t=r[1],n=e.number.words.findIndex(o=>o.includes(t));return n<0?null:n+1}}}function ge(e){let r=String(e??"");if(!r.trim()||r.length>40)return[];let t=g(r,!1),n=g(r,!0);if(!V(t)&&!V(n))return[];let o=F(t),s=F(n),i=[],a=new Set;for(let d of ae()){let u=d.lang+"|"+d.grain;if(!a.has(u))for(let c of d.unfold?s:o){let l=d.re.exec(c.body);if(!l)continue;let m=fe(d,l);if(!(m===null||m<1||m>ne[d.grain])){i.push({lang:d.lang,grain:d.grain,n:m,year:c.year,yearDigits:c.yearDigits,form:d.form}),a.add(u);break}}}return i}function W(e,r=()=>!0){if(e.length===0)return null;let t=e.map(n=>ge(n).filter(r));if(t.some(n=>n.length===0))return null;for(let n of Object.keys(h))for(let o of Object.keys(h[n])){let s=[],i=0;for(let a of t){let d=a.find(l=>l.grain===n&&l.lang===o),c=a.find(l=>l.grain===n&&l.lang==="en")??d;if(!c)break;c.lang===o&&i++,s.push(c)}if(s.length===e.length&&(o==="en"||i>0))return{lang:o,grain:n,readings:s}}return null}var K=[{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"]}],he={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"},pe=(()=>{let e=new Set;for(let r of K)for(let t of r.canonical)e.add(f(t));return e})(),ye=(()=>{let e=new Map;for(let[r,t]of Object.entries(he)){let n=f(r);pe.has(n)||e.has(n)||e.set(n,f(t))}return e})();function U(e){return ye.get(e)??e}var we=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 $e(e){if(!e)return!1;for(let r of M(e))if(we.has(r))return!0;return N(e)!==null||z(e)!==null}function f(e){return e.toLowerCase().replace(/[-_]+/g," ").replace(/\s+/g," ").trim()}function X(e){return S(e.normalize("NFD").replace(/\p{Diacritic}/gu,""))}function ke(e){let r=new Map;for(let[t,n]of e){let o=X(t);if(!o)continue;let s=r.get(o);r.set(o,s===void 0||s===n?n:-1)}return r}function v(e){let r=new Map;for(let[t,n]of e)for(let o of t)r.set(f(o),n);return r}var C=[{name:"weekday_mon_sun",minMatches:4,dict:v([[["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:v([[["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:v([[["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]])}],Y={};function be(e){let r=e||"";if(!r)return{weekday:new Map,month:new Map};let t=Y[r];if(t)return t;let n=new Map,o=new Map,s=(a,d,u)=>{let c=f(d);c&&a.set(c,u);let l=f(d.replace(/\./g,""));l&&l!==c&&a.set(l,u)};try{let a=new Intl.DateTimeFormat(r,{weekday:"long",timeZone:"UTC"}),d=new Intl.DateTimeFormat(r,{weekday:"short",timeZone:"UTC"});for(let l=0;l<7;++l){let m=new Date(Date.UTC(2024,0,1+l));s(n,a.format(m),l),s(n,d.format(m),l)}let u=new Intl.DateTimeFormat(r,{month:"long"}),c=new Intl.DateTimeFormat(r,{month:"short"});for(let l=0;l<12;++l){let m=new Date(Date.UTC(2020,l,15));s(o,u.format(m),l),s(o,c.format(m),l)}}catch{}let i={weekday:n,month:o};return Y[r]=i,i}function $(e,r){if(r.size===0)return e;let t=new Map(e);for(let[n,o]of r)t.has(n)||t.set(n,o);return t}function ve(e,r){let t=be(r);for(let n of C){let o=n.name==="weekday_mon_sun"?$(n.dict,t.weekday):n.name==="month_jan_dec"?$(n.dict,t.month):n.dict,s=!0,i=null,a=new Map;for(let[u,c]of e){let l=o.get(u);if(l===void 0){i=i??ke(o);let m=i.get(X(u));l=m===void 0||m<0?void 0:m}if(l===void 0){s=!1;break}a.has(l)||a.set(l,c)}if(!s||a.size<n.minMatches)continue;let d=[...a.entries()].sort((u,c)=>u[0]-c[0]).map(u=>u[1]);return{pattern:n.name,orderedDomain:d}}return Ce(e)}var H=C.find(e=>e.name==="quarter_q1_q4");function Ce(e){let r=[...e.values()],t=W(r,s=>s.grain==="quarter"&&s.year===null&&(s.lang==="en"||s.form==="word"));if(!t||t.lang==="en")return null;let n=new Map;if(t.readings.forEach((s,i)=>{n.has(s.n)||n.set(s.n,r[i])}),n.size<H.minMatches)return null;let o=[...n.entries()].sort((s,i)=>s[0]-i[0]).map(s=>s[1]);return{pattern:H.name,orderedDomain:o}}function B(e){let r=new Map;for(let t of e){if(t==null)continue;let n=String(t);if(n.length===0)continue;let o=f(n);r.has(o)||r.set(o,n)}return r}var _e=15,Me=10,xe=(()=>{let e=["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"],r=new Set(e.map(f));for(let t of C)for(let n of t.dict.keys())r.add(n);return r})();function Re(e){let r=e.trim();return r.length===0||r.length>Me||(r.match(/\p{L}/gu)||[]).length>1?!1:/\p{Nd}/u.test(r)}function De(e){let r=e.trim();return r.length===1&&/[\p{L}\p{Nd}]/u.test(r)}function He(e){if(!e||e.length===0)return null;let r=new Set,t=[];for(let n of e){if(n==null)continue;let o=String(n);if(r.has(o))continue;let s=f(o);if(!(s===""||xe.has(s)||Re(o)||De(o))||(r.add(o),t.push(o),t.length>_e))return null}return t.length>0?t:null}var je=/^(\p{L}{0,3}) ?([0-9]+)\s*[-–—:.)]\s*(.+)$/u;function Se(e){let r=null,t=new Set,n=[];for(let o of e.values()){let s=je.exec(o.trim());if(!s)return null;let i=s[1].toLowerCase();if(r===null)r=i;else if(i!==r)return null;let a=Number(s[2]);if(t.has(a)||f(s[3])==="")return null;t.add(a),n.push({code:a,original:o,label:s[3]})}return n}function qe(e,r){let t=Q(B(e.map(a=>a.label)),r);if(t===null)return;if(t.orderedDomain.length!==e.length)return null;let n=new Map;for(let a of e)n.set(a.label,a);let o=t.orderedDomain.map(a=>n.get(a));if(o.some(a=>a===void 0))return null;let s=!0,i=!0;for(let a=1;a<o.length;++a)o[a].code<=o[a-1].code&&(s=!1),o[a].code>=o[a-1].code&&(i=!1);return!s&&!i?null:{pattern:t.pattern,orderedDomain:o.map(a=>a.original)}}function Ke(e,r){if(!e||e.length<2)return null;let t=B(e);if(t.size<2)return null;let n=Se(t);if(n!==null){let s=qe(n,r);if(s!==void 0)return s}let o=Q(t,r);return o!==null?o:n!==null?Le(t):null}var Oe=/^([0-9]+)\s*(?:\.|\)|-)\s*([^\s\d].*)$/u,ze=3,Ne=20;function Le(e){if(e.size<ze||e.size>Ne)return null;let r=new Set,t=[];for(let n of e.values()){let o=Oe.exec(n.trim());if(!o||f(o[2])==="")return null;let s=Number(o[1]);if(r.has(s))return null;r.add(s),t.push({n:s,original:n})}return t.sort((n,o)=>n.n-o.n),{pattern:"numeric_rank_prefix",orderedDomain:t.map(n=>n.original)}}function Q(e,r){let t=new Map;for(let[o,s]of e){let i=U(o);t.has(i)||t.set(i,s)}let n=null;for(let o of K){let s=[];for(let u of o.canonical){let c=t.get(u);c!==void 0&&s.push(c)}if(s.length<o.minMatches)continue;let i=new Set(o.canonical),a=!0;for(let u of e.keys())if(!i.has(U(u))){a=!1;break}if(!a)continue;let d;n===null||s.length>n.matched||s.length===n.matched&&o.canonical.length<n.pattern.canonical.length?d=!0:d=!1,d&&(n={pattern:o,matched:s.length,orderedDomain:s})}return n?{pattern:n.pattern.name,orderedDomain:n.orderedDomain}:ve(e,r)}export{Pe as a,J as b,q as c,O as d,z as e,N as f,ne as g,h,G as i,te as j,ge as k,W as l,$e as m,He as n,Ke as o};
@@ -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 en,b as L,c as sn,d as on,e as rn,g as an,h as cn,i as un,j as ln,k as W,r as V,x}from"./chunk-INMDBTAR.mjs";import{b as nn}from"./chunk-NT6CDI3K.mjs";import{e as tn}from"./chunk-5HI6TVMM.mjs";var An="006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191193194195196197198199200201202203204205206207208209210211212214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310312313314315316317318319320321322323324325326327328329330331333334335336337338339341342344346347349350351352354355356357358359360361362363364365366367368369370371372373374376377378379380381382383384385386387388389390391392393394395396397398400401402403404405406407408409410411412413414415416417418420421422423424425426427430431432433434435436437438439440441442443444445446447448449450451452453454455456457458460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508510511512513514515516520521522523524525526527528530531532534535537538539540541542543544545546547548549550551553554556557558559560561562563564565566567570571572573574575576577580581582583584585586587588590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620622623624625626627628629630631633634635636637638639640641644645646647648650651652653654655656657658660661662664665666667668669670671672673674675676677678679680681683684685686687688689690691692693700701703704705706707708710711712713714716717718719720721722723724725726727728729730731734735736737738739740741743744745746747748749750751752753754755756757758759760761762763764765766767768769770772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816820821822823824825826827828829830831832833834835836837838840841843844845846847850851852853855856857859860863864865870871873874875877878879880881882883884890891893894895897898900902903904905906907908910911912913914915916917918919920921922923924925926927928930931932933934935936937939940941943944945946947948949950951952953954955956957958959960961967968969970971972973974975976977978979980981982983984985986988989990991992993994995996997998999",w=new Set(An.match(/.{3}/g)??[]);var dn=[["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"],["DC","District of Columbia"],["PR","Puerto Rico"],["GU","Guam"],["VI","U.S. Virgin Islands"],["AS","American Samoa"],["MP","Northern Mariana Islands"]],pn=new Set(dn.map(n=>n[0])),Cn={"Ala.":"AL","Alab.":"AL","Ariz.":"AZ","Ark.":"AR","Calif.":"CA","Cal.":"CA","Colo.":"CO","Col.":"CO","Conn.":"CT","Del.":"DE","Fla.":"FL","Flor.":"FL","Ga.":"GA","Ill.":"IL","Ind.":"IN","Kan.":"KS","Kans.":"KS","Ky.":"KY","La.":"LA","Md.":"MD","Mass.":"MA","Mich.":"MI","Minn.":"MN","Miss.":"MS","Mo.":"MO","Mont.":"MT","Neb.":"NE","Nebr.":"NE","Nev.":"NV","N.H.":"NH","N.J.":"NJ","N.M.":"NM","N.Mex.":"NM","N. Mex.":"NM","N.Y.":"NY","N.C.":"NC","N.D.":"ND","N.Dak.":"ND","N. Dak.":"ND","Okla.":"OK","Ore.":"OR","Oreg.":"OR","Pa.":"PA","Penn.":"PA","Penna.":"PA","R.I.":"RI","S.C.":"SC","S.D.":"SD","S.Dak.":"SD","S. Dak.":"SD","Tenn.":"TN","Tex.":"TX","Vt.":"VT","Va.":"VA","Wash.":"WA","W.Va.":"WV","W. Va.":"WV","Wis.":"WI","Wisc.":"WI","Wyo.":"WY","D.C.":"DC","Wash. D.C.":"DC","Wash., D.C.":"DC","P.R.":"PR","V.I.":"VI"},Y=(()=>{let n=new Map;for(let[s,o]of dn)n.set(g(o),s);n.set(g("Washington DC"),"DC"),n.set(g("Washington D.C."),"DC"),n.set(g("US Virgin Islands"),"VI");for(let[s,o]of Object.entries(Cn)){let r=g(s);r&&!n.has(r)&&n.set(r,o)}return n})(),In=(()=>{let n=new tn;for(let[s,o]of Y)n.add(s,o);return n})();function mn(n){let s=g(n),o=Y.get(s);return o||(L(s)?null:In.get(rn(n))??null)}var Sn=new Set(["01","02","04","05","06","08","09","10","11","12","13","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","44","45","46","47","48","49","50","51","53","54","55","56","60","66","69","72","78"]);function yn(n){return n.trim().toUpperCase()}function g(n){return on(n)}var H=new Set(["country","countries","nation","nationality","iso","geo"]),U=new Set(["state","province","st"]),fn=new Set(["zip","zipcode","postal","postcode","plz"]),Mn=new Set(["county","fips","borough","parish"]),Tn=new Set(["city","cities","town","municipality","metro","location","place"]);function y(n,s){if(!n)return!1;for(let o of nn(n))if(s.has(o))return!0;return!1}var Dn=95,On=5,_n=6e4;function Un(n,s,o){if(!n||n.length===0)return null;let r=[],I=new Set;for(let t of n){if(t==null)continue;let e=String(t).trim();if(e.length===0||L(g(e)))continue;let i=e.toLowerCase();if(!I.has(i)&&(I.add(i),r.push(e),r.length>_n))return null}let N=r.length;if(N<2)return null;let h=r.map(yn),M=r.map(g),O=un(),d=0,p=0,m=0,T=0,D=0,l=0,_=0,F=0,Z=0,K=0,$=0,P=0,J=t=>(V(t)??"").slice(0,3),X=0,B=0,E=0,v=y(s,fn);for(let t=0;t<N;++t){let e=h[t],i=M[t],c=r[t],S=an.has(e),C=pn.has(e);cn.has(e)&&d++,S&&p++,C&&m++,S&&C&&X++;let G=O.has(i)||ln(c)!==null,R=Y.has(i)||mn(c)!==null;G&&T++,R&&D++,G&&R&&B++,W(c)&&K++,C&&R&&E++,/^\d{5}(-\d{4})?$/.test(c)||v&&/^\d{3,4}$/.test(c)?(l++,w.has(J(c))&&P++):/^\d{4}$/.test(c)&&$++,/^\d{5}$/.test(c)&&Sn.has(c.slice(0,2))&&_++,x(i)&&F++,x(i,"world")&&Z++}if(!v&&l>0){l+=$;for(let t of r)/^\d{4}$/.test(t)&&w.has(J(t))&&P++}let j=t=>t/N*100,A=[],u=(t,e,i,c=!1)=>{let S=j(e),C=t==="city-name"||t==="city-name-world";S<(C?sn:Dn)||e<2||c&&e<On&&!y(s,t==="country-name"?H:C?Tn:U)||A.push({kind:t,matched:e,spec:i,pct:S})};u("country-iso3",d,6),u("country-name",T,5,!0),u("us-state-name",D,5,!0),u("us-zip5",l,4),u("us-county-fips",_,4),u("country-iso2",p,3),u("us-state-code",m,3);let gn=A.length;u("city-name",F,2,!0),A.length===gn&&u("city-name-world",Z,2,!0);let Nn=m-E,hn=D-E;Nn>0&&hn>0&&u("us-state-name",m+D-E,5,!0);let b=Math.max(d,p,T);if(K>b){let t=d===b?"country-iso3":T===b?"country-name":"country-iso2";u(t,K,t==="country-iso3"?6:t==="country-name"?5:3,t==="country-name")}if(A.length===0)return null;A.sort((t,e)=>e.pct-t.pct||e.spec-t.spec);let a=A[0],k=!1,q={"country-iso2":"us-state-code","us-state-code":"country-iso2","us-zip5":"us-county-fips","us-county-fips":"us-zip5","country-name":"us-state-name","us-state-name":"country-name"}[a.kind],z=A[1],Q=q&&z&&z.kind===q&&Math.abs(a.pct-z.pct)<=15;if(a.kind==="country-iso2"||a.kind==="us-state-code"){let t=a.matched>0?X/a.matched:0,e=y(s,H),i=y(s,U);if(Q||t>=.5){if(e&&!i)return f("country-iso2",p,!1);if(i&&!e)return f("us-state-code",m,!1);k=!0}}else if(a.kind==="us-zip5"||a.kind==="us-county-fips"){let t=_===l&&l===N,e=y(s,fn),i=y(s,Mn);return i&&!e?f("us-county-fips",_,!1):e&&!i?f("us-zip5",l,!1):t?f("us-zip5",l,!0):f("us-zip5",l,!1)}else if(Q&&(a.kind==="country-name"||a.kind==="us-state-name")){let t=a.matched>0?B/a.matched:0,e=y(s,H),i=y(s,U);if(e&&!i)return f("country-name",T,!1);if(i&&!e)return f("us-state-name",D,!1);t>=.5&&(k=!0)}return f(a.kind,a.matched,k);function f(t,e,i){let S={geoKind:t,geoMatchPct:Math.round(j(t==="us-zip5"?P:e)*10)/10};return i&&(S.geoAmbiguous=!0),S}}function En(n,s){if(n==null)return null;let o=String(n).trim();if(o.length===0)return null;switch(s){case"country-iso3":case"country-iso2":case"country-name":return W(o);case"us-state-code":case"us-state-name":{let r=yn(o);return pn.has(r)?r:mn(o)}case"us-zip5":return V(o);case"us-county-fips":return/^\d{5}$/.test(o)&&Sn.has(o.slice(0,2))?o:null;default:return null}}function Yn(n){switch(n){case"country-iso3":case"country-iso2":case"country-name":case"us-state-code":case"us-state-name":case"us-zip5":case"us-county-fips":return!0;default:return!1}}function Rn(n,s){return s==="us-zip5"?w.has(n.slice(0,3)):!0}function Fn(n,s){let o=new Array(n.length),r=new Set,I=[],N=0;for(let h=0;h<n.length;++h){let M=En(n[h],s),O=M!==null&&Rn(M,s)?M:null;if(o[h]=O,O!==null)N++;else{let d=n[h];if(d!=null){let p=String(d).trim();if(p.length>0){let m=p.toLowerCase();r.has(m)||(r.add(m),I.push(p))}}}}return{iso:o,unmatched:I,matchedRows:N,totalRows:n.length}}export{fn as a,y as b,Un as c,En as d,Yn as e,Fn as f};
2
+ import{a as en,b as L,c as sn,d as on,e as rn,g as an,h as cn,i as un,j as ln,k as W,r as V,x}from"./chunk-INMDBTAR.mjs";import{b as nn}from"./chunk-CZJ7M6A5.mjs";import{e as tn}from"./chunk-5HI6TVMM.mjs";var An="006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191193194195196197198199200201202203204205206207208209210211212214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310312313314315316317318319320321322323324325326327328329330331333334335336337338339341342344346347349350351352354355356357358359360361362363364365366367368369370371372373374376377378379380381382383384385386387388389390391392393394395396397398400401402403404405406407408409410411412413414415416417418420421422423424425426427430431432433434435436437438439440441442443444445446447448449450451452453454455456457458460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508510511512513514515516520521522523524525526527528530531532534535537538539540541542543544545546547548549550551553554556557558559560561562563564565566567570571572573574575576577580581582583584585586587588590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620622623624625626627628629630631633634635636637638639640641644645646647648650651652653654655656657658660661662664665666667668669670671672673674675676677678679680681683684685686687688689690691692693700701703704705706707708710711712713714716717718719720721722723724725726727728729730731734735736737738739740741743744745746747748749750751752753754755756757758759760761762763764765766767768769770772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816820821822823824825826827828829830831832833834835836837838840841843844845846847850851852853855856857859860863864865870871873874875877878879880881882883884890891893894895897898900902903904905906907908910911912913914915916917918919920921922923924925926927928930931932933934935936937939940941943944945946947948949950951952953954955956957958959960961967968969970971972973974975976977978979980981982983984985986988989990991992993994995996997998999",w=new Set(An.match(/.{3}/g)??[]);var dn=[["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"],["DC","District of Columbia"],["PR","Puerto Rico"],["GU","Guam"],["VI","U.S. Virgin Islands"],["AS","American Samoa"],["MP","Northern Mariana Islands"]],pn=new Set(dn.map(n=>n[0])),Cn={"Ala.":"AL","Alab.":"AL","Ariz.":"AZ","Ark.":"AR","Calif.":"CA","Cal.":"CA","Colo.":"CO","Col.":"CO","Conn.":"CT","Del.":"DE","Fla.":"FL","Flor.":"FL","Ga.":"GA","Ill.":"IL","Ind.":"IN","Kan.":"KS","Kans.":"KS","Ky.":"KY","La.":"LA","Md.":"MD","Mass.":"MA","Mich.":"MI","Minn.":"MN","Miss.":"MS","Mo.":"MO","Mont.":"MT","Neb.":"NE","Nebr.":"NE","Nev.":"NV","N.H.":"NH","N.J.":"NJ","N.M.":"NM","N.Mex.":"NM","N. Mex.":"NM","N.Y.":"NY","N.C.":"NC","N.D.":"ND","N.Dak.":"ND","N. Dak.":"ND","Okla.":"OK","Ore.":"OR","Oreg.":"OR","Pa.":"PA","Penn.":"PA","Penna.":"PA","R.I.":"RI","S.C.":"SC","S.D.":"SD","S.Dak.":"SD","S. Dak.":"SD","Tenn.":"TN","Tex.":"TX","Vt.":"VT","Va.":"VA","Wash.":"WA","W.Va.":"WV","W. Va.":"WV","Wis.":"WI","Wisc.":"WI","Wyo.":"WY","D.C.":"DC","Wash. D.C.":"DC","Wash., D.C.":"DC","P.R.":"PR","V.I.":"VI"},Y=(()=>{let n=new Map;for(let[s,o]of dn)n.set(g(o),s);n.set(g("Washington DC"),"DC"),n.set(g("Washington D.C."),"DC"),n.set(g("US Virgin Islands"),"VI");for(let[s,o]of Object.entries(Cn)){let r=g(s);r&&!n.has(r)&&n.set(r,o)}return n})(),In=(()=>{let n=new tn;for(let[s,o]of Y)n.add(s,o);return n})();function mn(n){let s=g(n),o=Y.get(s);return o||(L(s)?null:In.get(rn(n))??null)}var Sn=new Set(["01","02","04","05","06","08","09","10","11","12","13","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","44","45","46","47","48","49","50","51","53","54","55","56","60","66","69","72","78"]);function yn(n){return n.trim().toUpperCase()}function g(n){return on(n)}var H=new Set(["country","countries","nation","nationality","iso","geo"]),U=new Set(["state","province","st"]),fn=new Set(["zip","zipcode","postal","postcode","plz"]),Mn=new Set(["county","fips","borough","parish"]),Tn=new Set(["city","cities","town","municipality","metro","location","place"]);function y(n,s){if(!n)return!1;for(let o of nn(n))if(s.has(o))return!0;return!1}var Dn=95,On=5,_n=6e4;function Un(n,s,o){if(!n||n.length===0)return null;let r=[],I=new Set;for(let t of n){if(t==null)continue;let e=String(t).trim();if(e.length===0||L(g(e)))continue;let i=e.toLowerCase();if(!I.has(i)&&(I.add(i),r.push(e),r.length>_n))return null}let N=r.length;if(N<2)return null;let h=r.map(yn),M=r.map(g),O=un(),d=0,p=0,m=0,T=0,D=0,l=0,_=0,F=0,Z=0,K=0,$=0,P=0,J=t=>(V(t)??"").slice(0,3),X=0,B=0,E=0,v=y(s,fn);for(let t=0;t<N;++t){let e=h[t],i=M[t],c=r[t],S=an.has(e),C=pn.has(e);cn.has(e)&&d++,S&&p++,C&&m++,S&&C&&X++;let G=O.has(i)||ln(c)!==null,R=Y.has(i)||mn(c)!==null;G&&T++,R&&D++,G&&R&&B++,W(c)&&K++,C&&R&&E++,/^\d{5}(-\d{4})?$/.test(c)||v&&/^\d{3,4}$/.test(c)?(l++,w.has(J(c))&&P++):/^\d{4}$/.test(c)&&$++,/^\d{5}$/.test(c)&&Sn.has(c.slice(0,2))&&_++,x(i)&&F++,x(i,"world")&&Z++}if(!v&&l>0){l+=$;for(let t of r)/^\d{4}$/.test(t)&&w.has(J(t))&&P++}let j=t=>t/N*100,A=[],u=(t,e,i,c=!1)=>{let S=j(e),C=t==="city-name"||t==="city-name-world";S<(C?sn:Dn)||e<2||c&&e<On&&!y(s,t==="country-name"?H:C?Tn:U)||A.push({kind:t,matched:e,spec:i,pct:S})};u("country-iso3",d,6),u("country-name",T,5,!0),u("us-state-name",D,5,!0),u("us-zip5",l,4),u("us-county-fips",_,4),u("country-iso2",p,3),u("us-state-code",m,3);let gn=A.length;u("city-name",F,2,!0),A.length===gn&&u("city-name-world",Z,2,!0);let Nn=m-E,hn=D-E;Nn>0&&hn>0&&u("us-state-name",m+D-E,5,!0);let b=Math.max(d,p,T);if(K>b){let t=d===b?"country-iso3":T===b?"country-name":"country-iso2";u(t,K,t==="country-iso3"?6:t==="country-name"?5:3,t==="country-name")}if(A.length===0)return null;A.sort((t,e)=>e.pct-t.pct||e.spec-t.spec);let a=A[0],k=!1,q={"country-iso2":"us-state-code","us-state-code":"country-iso2","us-zip5":"us-county-fips","us-county-fips":"us-zip5","country-name":"us-state-name","us-state-name":"country-name"}[a.kind],z=A[1],Q=q&&z&&z.kind===q&&Math.abs(a.pct-z.pct)<=15;if(a.kind==="country-iso2"||a.kind==="us-state-code"){let t=a.matched>0?X/a.matched:0,e=y(s,H),i=y(s,U);if(Q||t>=.5){if(e&&!i)return f("country-iso2",p,!1);if(i&&!e)return f("us-state-code",m,!1);k=!0}}else if(a.kind==="us-zip5"||a.kind==="us-county-fips"){let t=_===l&&l===N,e=y(s,fn),i=y(s,Mn);return i&&!e?f("us-county-fips",_,!1):e&&!i?f("us-zip5",l,!1):t?f("us-zip5",l,!0):f("us-zip5",l,!1)}else if(Q&&(a.kind==="country-name"||a.kind==="us-state-name")){let t=a.matched>0?B/a.matched:0,e=y(s,H),i=y(s,U);if(e&&!i)return f("country-name",T,!1);if(i&&!e)return f("us-state-name",D,!1);t>=.5&&(k=!0)}return f(a.kind,a.matched,k);function f(t,e,i){let S={geoKind:t,geoMatchPct:Math.round(j(t==="us-zip5"?P:e)*10)/10};return i&&(S.geoAmbiguous=!0),S}}function En(n,s){if(n==null)return null;let o=String(n).trim();if(o.length===0)return null;switch(s){case"country-iso3":case"country-iso2":case"country-name":return W(o);case"us-state-code":case"us-state-name":{let r=yn(o);return pn.has(r)?r:mn(o)}case"us-zip5":return V(o);case"us-county-fips":return/^\d{5}$/.test(o)&&Sn.has(o.slice(0,2))?o:null;default:return null}}function Yn(n){switch(n){case"country-iso3":case"country-iso2":case"country-name":case"us-state-code":case"us-state-name":case"us-zip5":case"us-county-fips":return!0;default:return!1}}function Rn(n,s){return s==="us-zip5"?w.has(n.slice(0,3)):!0}function Fn(n,s){let o=new Array(n.length),r=new Set,I=[],N=0;for(let h=0;h<n.length;++h){let M=En(n[h],s),O=M!==null&&Rn(M,s)?M:null;if(o[h]=O,O!==null)N++;else{let d=n[h];if(d!=null){let p=String(d).trim();if(p.length>0){let m=p.toLowerCase();r.has(m)||(r.add(m),I.push(p))}}}}return{iso:o,unmatched:I,matchedRows:N,totalRows:n.length}}export{fn as a,y as b,Un as c,En as d,Yn as e,Fn as f};
@@ -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{M as R,U as I,e as L}from"./chunk-TBH5LFYH.mjs";import{a as y,c as C,d as E,e as x}from"./chunk-A4PQBWRA.mjs";import{u as T}from"./chunk-NT6CDI3K.mjs";import A from"papaparse";var M=500,k=/^[+-]?\d{1,15}$/,P=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,N=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function O(e,o=".",n=!1){if(n)return"DateTime";let r=0,a=0,i=0,l=0;for(let m of e){if(m==null)continue;if(typeof m=="number"){l++,a++,Number.isInteger(m)&&r++;continue}if(m instanceof Date){l++,i++;continue}if(typeof m=="boolean"){l++;continue}let c=String(m).trim();if(c!==""){if(l++,k.test(y(c))){r++,a++;continue}if(x(c,o)){a++;continue}if((P.test(c)||N.test(c))&&!isNaN(Date.parse(c))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":a===l?"Decimal":"String"}function _(e,o,n=".",r=null){if(e==null)return null;if(typeof e=="number")return o==="String"?String(e):e;if(e instanceof Date)return o==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let a=String(e).trim();if(a==="")return null;switch(o){case"Integer":{let i=y(a);return k.test(i)?parseInt(i,10):null}case"Decimal":return E(a,n);case"DateTime":return r?r.read(a):T(a);default:return a}}function $(e){let o=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(o)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(o)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(o)?"DateTime":(/^(bit|bool|boolean)$/.test(o),"String")}function*q(e,o){for(let n of e)yield n?.[o]}function f(e,o,n){if(e.length===0)throw new Error("ingest: no columns were resolved from the source. Supply column descriptors, or use a source shape that carries them (grid/table/objects/sql).");let r=e.length,a=e.map((t,s)=>o.slice(0,M).map(u=>u?.[s])),i=a.map(t=>C(t,n.locale)),l=e.map((t,s)=>t.dataType===void 0||t.dataType==="DateTime"?L(q(o,s),{locale:n.locale??"en"}):null),m=e.map((t,s)=>t.dataType??O(a[s],i[s],l[s]!==null)),c=new Set((n.measures??[]).map(t=>t.toLowerCase())),w=new Set((n.dimensions??[]).map(t=>t.toLowerCase())),j=new Set((n.nonAdditive??[]).map(t=>t.toLowerCase())),b=e.map((t,s)=>{let u=t.name.toLowerCase(),g=t.isMeasure??((m[s]==="Integer"||m[s]==="Decimal")&&!R(t.name));c.has(u)&&(g=!0),w.has(u)&&(g=!1);let S={name:t.name,dataType:m[s],isMeasure:g};return g&&j.has(u)&&(S.discourageAggregationAcrossGroups=!0),S}),d=new I;d.dedupRows=n.dedup!==!1,d.setColumns(b),d.declareDimensions(b.filter((t,s)=>w.has(e[s].name.toLowerCase())));for(let t=0;t<o.length;t++){let s=o[t];d.addRow(Array.from({length:r},(u,g)=>_(s?.[g],m[g],i[g],l[g])),t)}let D=d.getColumnsWithStats(n.privacyLevel??"20",n.locale??"en"),p=new Map(D.map(t=>[t.name,t]));e.forEach(t=>{let s=p.get(t.name);s&&(t.format&&(s.modelFormat=t.format),t.description&&(s.modelDesc=t.description))});for(let[t,s]of Object.entries(n.formats??{})){let u=p.get(t);u&&(u.modelFormat=s)}for(let[t,s]of Object.entries(n.descriptions??{})){let u=p.get(t);u&&(u.modelDesc=s)}for(let t of n.groupBy??[]){let s=p.get(t);s&&(s.isGrouping=!0)}return{columns:D,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function h(e,o){return e.map(n=>Array.isArray(n)?n:o.map(r=>n[r]))}function F(e,o){let n=[],r=new Set,a=Math.min(e.length,Math.max(1,o));for(let i=0;i<a;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let m of Object.keys(l))r.has(m)||(r.add(m),n.push(m))}return n}function V(e){let o=String(e??"").replace(/^\uFEFF/,""),n=[],r=[],a=0;return A.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,m=o.slice(a,l);a=l,i.errors?.length&&r.push(...i.errors);let c=i.data;c.length===1&&c[0]===""&&m.replace(/[\r\n]/g,"")===""||n.push(c)}}),!n.length&&!r.length&&r.push(...A.parse(o,{skipEmptyLines:!0}).errors),{rows:n,errors:r}}function H(e,o={}){switch(e.kind){case"csv":{let n=V(e.text);if(n.errors.length&&n.rows.length===0)throw new Error(`ingest: CSV parse failed - ${n.errors[0].message}`);let r=n.rows;if(r.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let a=r[0].map(i=>(i??"").trim());return f(a.map(i=>({name:i})),r.slice(1),o)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return f(e.header.map(n=>({name:(n??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let n=e.columns.map(r=>r.name);return f(e.columns,h(e.rows??[],n),o)}case"objects":{let n=e.rows??[],r=e.columns?.length?e.columns:F(n,o.columnScanLimit??M).map(a=>({name:a}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return f(r,h(n,r.map(a=>a.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let n=e.schema.map(r=>{let a=$(r.dataType);return{name:r.name,dataType:a,isMeasure:r.isMeasure,format:r.format,description:r.description}});return f(n,h(e.rows??[],n.map(r=>r.name)),o)}default:{let n=e;throw new Error(`ingest: unknown source kind '${n?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{$ as a,V as b,H as c};
2
+ import{M as R,U as I,e as L}from"./chunk-TXKQGWEI.mjs";import{a as y,c as C,d as E,e as x}from"./chunk-A4PQBWRA.mjs";import{u as T}from"./chunk-CZJ7M6A5.mjs";import A from"papaparse";var M=500,k=/^[+-]?\d{1,15}$/,P=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,N=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function O(e,o=".",n=!1){if(n)return"DateTime";let r=0,a=0,i=0,l=0;for(let m of e){if(m==null)continue;if(typeof m=="number"){l++,a++,Number.isInteger(m)&&r++;continue}if(m instanceof Date){l++,i++;continue}if(typeof m=="boolean"){l++;continue}let c=String(m).trim();if(c!==""){if(l++,k.test(y(c))){r++,a++;continue}if(x(c,o)){a++;continue}if((P.test(c)||N.test(c))&&!isNaN(Date.parse(c))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":a===l?"Decimal":"String"}function _(e,o,n=".",r=null){if(e==null)return null;if(typeof e=="number")return o==="String"?String(e):e;if(e instanceof Date)return o==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let a=String(e).trim();if(a==="")return null;switch(o){case"Integer":{let i=y(a);return k.test(i)?parseInt(i,10):null}case"Decimal":return E(a,n);case"DateTime":return r?r.read(a):T(a);default:return a}}function $(e){let o=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(o)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(o)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(o)?"DateTime":(/^(bit|bool|boolean)$/.test(o),"String")}function*q(e,o){for(let n of e)yield n?.[o]}function f(e,o,n){if(e.length===0)throw new Error("ingest: no columns were resolved from the source. Supply column descriptors, or use a source shape that carries them (grid/table/objects/sql).");let r=e.length,a=e.map((t,s)=>o.slice(0,M).map(u=>u?.[s])),i=a.map(t=>C(t,n.locale)),l=e.map((t,s)=>t.dataType===void 0||t.dataType==="DateTime"?L(q(o,s),{locale:n.locale??"en"}):null),m=e.map((t,s)=>t.dataType??O(a[s],i[s],l[s]!==null)),c=new Set((n.measures??[]).map(t=>t.toLowerCase())),w=new Set((n.dimensions??[]).map(t=>t.toLowerCase())),j=new Set((n.nonAdditive??[]).map(t=>t.toLowerCase())),b=e.map((t,s)=>{let u=t.name.toLowerCase(),g=t.isMeasure??((m[s]==="Integer"||m[s]==="Decimal")&&!R(t.name));c.has(u)&&(g=!0),w.has(u)&&(g=!1);let S={name:t.name,dataType:m[s],isMeasure:g};return g&&j.has(u)&&(S.discourageAggregationAcrossGroups=!0),S}),d=new I;d.dedupRows=n.dedup!==!1,d.setColumns(b),d.declareDimensions(b.filter((t,s)=>w.has(e[s].name.toLowerCase())));for(let t=0;t<o.length;t++){let s=o[t];d.addRow(Array.from({length:r},(u,g)=>_(s?.[g],m[g],i[g],l[g])),t)}let D=d.getColumnsWithStats(n.privacyLevel??"20",n.locale??"en"),p=new Map(D.map(t=>[t.name,t]));e.forEach(t=>{let s=p.get(t.name);s&&(t.format&&(s.modelFormat=t.format),t.description&&(s.modelDesc=t.description))});for(let[t,s]of Object.entries(n.formats??{})){let u=p.get(t);u&&(u.modelFormat=s)}for(let[t,s]of Object.entries(n.descriptions??{})){let u=p.get(t);u&&(u.modelDesc=s)}for(let t of n.groupBy??[]){let s=p.get(t);s&&(s.isGrouping=!0)}return{columns:D,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function h(e,o){return e.map(n=>Array.isArray(n)?n:o.map(r=>n[r]))}function F(e,o){let n=[],r=new Set,a=Math.min(e.length,Math.max(1,o));for(let i=0;i<a;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let m of Object.keys(l))r.has(m)||(r.add(m),n.push(m))}return n}function V(e){let o=String(e??"").replace(/^\uFEFF/,""),n=[],r=[],a=0;return A.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,m=o.slice(a,l);a=l,i.errors?.length&&r.push(...i.errors);let c=i.data;c.length===1&&c[0]===""&&m.replace(/[\r\n]/g,"")===""||n.push(c)}}),!n.length&&!r.length&&r.push(...A.parse(o,{skipEmptyLines:!0}).errors),{rows:n,errors:r}}function H(e,o={}){switch(e.kind){case"csv":{let n=V(e.text);if(n.errors.length&&n.rows.length===0)throw new Error(`ingest: CSV parse failed - ${n.errors[0].message}`);let r=n.rows;if(r.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let a=r[0].map(i=>(i??"").trim());return f(a.map(i=>({name:i})),r.slice(1),o)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return f(e.header.map(n=>({name:(n??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let n=e.columns.map(r=>r.name);return f(e.columns,h(e.rows??[],n),o)}case"objects":{let n=e.rows??[],r=e.columns?.length?e.columns:F(n,o.columnScanLimit??M).map(a=>({name:a}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return f(r,h(n,r.map(a=>a.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let n=e.schema.map(r=>{let a=$(r.dataType);return{name:r.name,dataType:a,isMeasure:r.isMeasure,format:r.format,description:r.description}});return f(n,h(e.rows??[],n.map(r=>r.name)),o)}default:{let n=e;throw new Error(`ingest: unknown source kind '${n?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{$ as a,V as b,H as c};
@@ -0,0 +1,2 @@
1
+ /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
+ import{a as pe}from"./chunk-U3H6UBOO.mjs";import{a as lt,f as ee,g as he,h as se,i as ye,j as re}from"./chunk-A4PQBWRA.mjs";import{c as at}from"./chunk-IPPPCWAK.mjs";import{f as st,k as ot}from"./chunk-INMDBTAR.mjs";import{e as et,k as fe,m as rt,n as it,o as ge}from"./chunk-HJA26Z2E.mjs";import{A as de,B as qe,E as Je,a as ce,b as J,c as $e,d as me,g as Ue,h as Ve,j as Ke,l as He,m as Ye,o as je,p as Z,q as Xe,r as Ze,u as Re,w as Qe}from"./chunk-CZJ7M6A5.mjs";import{c as ze,f as we}from"./chunk-WC4JINEZ.mjs";import{b as tt,d as nt}from"./chunk-5HI6TVMM.mjs";var Zt=[[24.4,49.4,-125,-66.9],[51.2,71.5,-168,-129.9],[18.9,22.3,-160.3,-154.8]],Qt=[7,72,-172,-52];function ut(n,e,t){return n>=t[0]&&n<=t[1]&&e>=t[2]&&e<=t[3]}var te=n=>Math.round(n*10)/10;function mt(n,e=3){let t=[],i=[],r=0,s=0;for(let l of n){let a=l?.lat,f=l?.lon;if(typeof a!="number"||typeof f!="number"||!isFinite(a)||!isFinite(f)||a<-90||a>90||f<-180||f>180)continue;t.push(a),i.push(f);let m=l?.country?String(l.country).trim().toUpperCase():"",g=m?be(m):null;g?((m==="US"||m==="USA")&&r++,g==="north-america"&&s++):(Zt.some(u=>ut(a,f,u))&&r++,ut(a,f,Qt)&&s++)}let o=t.length;return o<e?null:(t.sort((l,a)=>l-a),i.sort((l,a)=>l-a),{pctUsa:te(r/o*100),pctNa:te(s/o*100),latP5:te(Z(t,.05)),latP95:te(Z(t,.95)),lonP5:te(Z(i,.05)),lonP95:te(Z(i,.95)),n:o})}var ct={"north-america":"AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI","south-america":"AR BO BR CL CO EC FK GF GY PE PY SR UY VE",europe:"AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA",africa:"AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW",asia:"AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE",oceania:"AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS",antarctica:"AQ BV GS HM TF"},oe=(()=>{let n=new Map;for(let e of Object.keys(ct))for(let t of ct[e].split(/\s+/))t&&n.set(t,e);return n})();function qt(n){for(let[e,t]of n){let i=oe.get(e);i&&!oe.has(t)&&oe.set(t,i)}}qt(st);function be(n){if(!n)return null;let e=String(n).trim().toUpperCase();if(!e)return null;let t=oe.get(e);if(t)return t;let i=ot(String(n));return i?oe.get(i)??null:null}function ni(n,e=2){return Ie(n.map(t=>[t,1]),e)}function Ie(n,e=2){let t=new Map,i=0;for(let[o,l]of n){let a=be(o);if(!a)continue;let f=typeof l=="number"&&isFinite(l)&&l>0?l:1;t.set(a,(t.get(a)??0)+f),i+=f}if(i<e||!t.size)return null;let r="europe",s=-1;for(let o of Array.from(t.keys()).sort()){let l=t.get(o);l>s&&(r=o,s=l)}return{dominantGeoRegion:r,dominantGeoRegionPct:te(s/i*100),regionCount:t.size,n:i}}function ve(n){let e=(n||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var Ne={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},Jt=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,en=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,tn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,nn=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,rn=new Set(["de","del","of"]),sn=new Set(["\u0433","\u0440","r"]),on=/^[\p{L}\p{M}\u0970\u05f3]+$/u,Ee=/^\d+$/;function an(n){let e=+n[1],t=+n[2],i=n[3]===void 0?0:+n[3],r=n[4]!==void 0;if(t>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(n[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:t,s:i,seconds:n[3]!==void 0,meridiem:r}}function dt(n){let e=n.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=lt(e);let t=null,i=Jt.exec(e);if(i){if(t=an(i),!t)return null;e=e.slice(0,i.index)}let r;if(r=tn.exec(e)){let u=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...Ne,form:"cjk",key:u,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=en.exec(e)){let u=r[2],S=r[4];if(u!==S)return null;let M=u.trim(),I=r[6];if(I&&M!==".")return null;let x=[r[1].length,r[3].length,r[5].length],d=x[0]===4,h=x[2]===4;return d===h||(d?x[1]>2||x[2]>2:x[0]>2||x[1]>2)?null:d&&M==="-"&&u==="-"&&x[1]===2&&x[2]===2?"iso":d&&M==="."&&u==="."&&!I&&!(x[1]===2&&x[2]===2)?null:{...Ne,form:"numeric",key:`num|${d?"y":"x"}|${u}|${I}`,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:d,sep:u,trail:I}}let s=e.replace(nn,"$1").split(/[\s.,/-]+/).filter(u=>u!==""&&!rn.has(u.toLowerCase()));if(s.length===4&&Ee.test(s[2])&&sn.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let o=s.map(u=>Ee.test(u)?"N":on.test(u)?"W":"?").join(""),l=s.map(u=>Ee.test(u)?u:""),a=0,f=0,m="",g;if(o==="NWN"&&l[0].length<=2&&l[2].length===4)a=+l[0],m=s[1],f=+l[2],g="dmy";else if(o==="WNN"&&l[1].length<=2&&l[2].length===4)m=s[0],a=+l[1],f=+l[2],g="mdy";else if(o==="NWN"&&l[0].length===4&&l[2].length<=2)f=+l[0],m=s[1],a=+l[2],g="ymd";else return null;return{...Ne,form:"named",key:`named|${g}`,clock:t,day:a,year:f,word:m,namedOrder:g}}var ln=[31,28,31,30,31,30,31,31,30,31,30,31],un=n=>n%4===0&&n%100!==0||n%400===0;function ft(n,e,t){return n>=1&&n<=9999&&e>=1&&e<=12&&t>=1?t<=(e===2&&un(n)?29:ln[e-1]):!1}function cn(n,e,t,i){let r=new Date(Date.UTC(2e3,e-1,t,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(n),r}function gt(n,e={}){let t=(e.floor??1)>=1,i=new Map,r=new Map,s=0,o=null;for(let d of n){if(d==null)continue;if(typeof d!="string"){if(t)return null;s++;continue}let h=d.trim();if(h==="")continue;s++;let y=i.get(h);if(y===void 0&&(y=dt(h),i.set(h,y)),y===null||y==="iso"){if(t)return null;continue}if(t){if(o===null)o=y;else if(y.key!==o.key)return null}else r.set(y.key,(r.get(y.key)??0)+1)}if(!t){let d=0,h="";for(let[y,b]of r)b>d&&(d=b,h=y);if(d===0||d/s<e.floor)return null;o=[...i.values()].find(y=>y!==null&&y!=="iso"&&y.key===h)??null}if(o===null)return null;let l=o.key,a=[...i.values()].filter(d=>d!==null&&d!=="iso"&&d.key===l),f,m="shape",g=null;if(o.form==="named"){if(f=o.namedOrder,g=ye(a.map(d=>d.word),e.locale),!g)return null}else if(o.form==="cjk"||o.yearFirst)f="ymd";else{let d=0,h=0;for(let y of a)y.a>12&&d++,y.b>12&&h++;if(d>0&&h>0)return null;d>0?(f="dmy",m="values"):h>0?(f="mdy",m="values"):o.sep.trim()==="."?(f="dmy",m="shape"):(f=ve(e.locale)?"mdy":"dmy",m="locale")}let u=d=>{if(d.form==="named"){let h=g.get(ee(d.word));return h===void 0?null:[d.year,h+1,d.day]}return d.yearFirst?[d.a,d.b,d.c]:f==="dmy"?[d.c,d.b,d.a]:[d.c,d.a,d.b]},S=1/0,M=-1/0,I=0;for(let d of a){let h=u(d);if(!h||!ft(h[0],h[1],h[2])){if(t)return null;I++;continue}S=Math.min(S,h[0]),M=Math.max(M,h[0])}if(!t&&(r.get(l)-I)/s<e.floor||S>=2400&&M<=2699||S>=1300&&M<=1500)return null;let x={form:o.form,order:f,orderFrom:m,hasTime:a.some(d=>d.clock!==null),read(d){if(typeof d!="string")return null;let h=d.trim();if(h==="")return null;let y=i.get(h);if(y===void 0&&(y=dt(h),i.set(h,y)),y===null||y==="iso"||y.key!==l)return null;let b=u(y);return!b||!ft(b[0],b[1],b[2])?null:cn(b[0],b[1],b[2],y.clock)}};if(o.form!=="named"&&!a.some(d=>d.clock?.meridiem)){let d;o.form==="cjk"?d=o.cjkPattern:o.yearFirst?d=`%Y${o.sep}%m${o.sep}%d${o.trail}`:d=(f==="dmy"?`%d${o.sep}%m${o.sep}%Y`:`%m${o.sep}%d${o.sep}%Y`)+o.trail;let h=a.filter(y=>y.clock!==null).length;h===0?x.pattern=d:h===a.length&&(x.pattern=d+(a.every(y=>y.clock.seconds)?" %H:%M:%S":" %H:%M"))}return x}import Vt from"papaparse";var mn=["rate","ratio","pct","percent","percentage","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","z[_-]?score","average","avg","mean","median","stddev","variance","gpa","percentile","quantile","efficiency","accuracy","probability","multiplier","coefficient","correlation","occupancy","age","bmi","temperature","density","pressure","humidity","ph","velocity","speed","elevation","altitude","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps","capita","temperatuur","temperatur","temperatura","teplota","lampotila","homerseklet","sicaklik","pression","presion","pressao","pressione","druck","tryck","tlak","paine","nyomas","presiune","humidite","humedad","umidade","umidita","feuchtigkeit","vochtigheid","kosteus","vlhkost","vitesse","velocidad","velocidade","velocita","geschwindigkeit","snelheid","hastighet","hastighed","rychlost","nopeus","sebesseg","brzina","predkosc","densite","densidad","densidade","densita","dichte","dichtheid","hustota","tiheys","gustoca","moyenne","mediane","promedio","mediana","gemiddelde","durchschnitt","mittelwert","genomsnitt","gennemsnit","gjennomsnitt","keskiarvo","atlag","ortalama","prosjek","srednia","prumer","priemer","medie","taux","tasa","taxa","tasso","verhaltnis","verhouding","aandeel","anteil","andel","osuus","podil","udzial","udio","pourcentage","porcentaje","percentual","prozent","procent","prosentti","szazalek","yuzde","participacion","participacao","pondere","omjer","arany","oran","rata","leeftijd","edad","idade","wiek","eletkor","varsta","puntuacion","pontuacao","punteggio","betyg","ocena","indice","indeks","wskaznik","puan","ocupacion","ocupacao","occupazione","auslastung","bezetting","belaggning","belaegning","belegg","kayttoaste","oblozenie","obsazenost","obsadenost","kihasznaltsag","doluluk","ocupare","popunjenost","efficacite","eficiencia","efficienza","effizienz","effectiviteit","verimlilik"],dn=["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"],fn=["latitude","longitude"],gn=["latitude","longitude"];function Q(n){return ce(n)}var yt=["somme de","suma de","soma de","summe von","som van","somma di","summa av","sum av","sum af","soucet z","suma z","totaal van","total de","toplam","osszeg","nombre de","recuento de","contagem de","anzahl von","aantal van","conteggio di","antal av","lukumaara","pocet z","sum pa","\u0441\u0443\u043C\u043C\u0430","\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E","\u0441\u0443\u043C\u0430","\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C","\u03B1\u03B8\u03C1\u03BF\u03B9\u03C3\u03BC\u03B1","\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2"],pn=["moyenne de","promedio de","media de","media di","durchschnitt von","gemiddelde van","medelvarde av","genomsnitt av","gennemsnit af","keskiarvo","atlag","ortalama","prumer z","srednia z","medie de","minimum de","minimo de","minimo di","minimum von","maximum de","maximo de","massimo di","maximum von","prom.","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435","\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0435\u0440\u0435\u0434\u043D\u0454","\u03BC\u03B5\u03C3\u03BF\u03C2 \u03BF\u03C1\u03BF\u03C2","\u0645\u06CC\u0627\u0646\u06AF\u06CC\u0646"],hn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],yn=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],Se=Object.freeze({"nombre de":"count","recuento de":"count","contagem de":"count","anzahl von":"count","aantal van":"count","conteggio di":"count","antal av":"count",lukumaara:"count","pocet z":"count",\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E:"count",\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C:"count",\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2:"count",\u7684\u8BA1\u6570:"count","minimum de":"min","minimo de":"min","minimo di":"min","minimum von":"min","maximum de":"max","maximo de":"max","massimo di":"max","maximum von":"max"});function ke(n){return[...n].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var bt=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+ke(yt)+")\\s+)","i");function pt(n){for(let e of n){let t=e.codePointAt(0)??0;if(t>=11904&&t<=40959||t>=44032&&t<=55215)return!0}return!1}var bn="[\u2013\u2014-]";function St(n){let e=n.filter(r=>!pt(r)),t=n.filter(pt),i=[];return e.length&&i.push("(?:\\s+|\\s*"+bn+"\\s*)("+ke(e)+")"),t.length&&i.push("\\s*("+ke(t)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var De=St(hn),Sn=St(yn);function _e(n,e){let t=e.exec(n);if(!t)return null;let i=n.slice(0,t.index);return i.trim()===""?null:{base:i,label:(t[1]??t[2]??"").toLowerCase()}}function _t(n){let e=Q(String(n??"").trim().toLowerCase());if(!e)return null;for(let r of pn)if(e.startsWith(r+" "))return Se[r]??"avg";for(let r of yt)if(e.startsWith(r+" ")||e===r)return Se[r]??"sum";let t=_e(e,Sn);if(t)return Se[t.label]??"avg";let i=_e(e,De);return i?Se[i.label]??"sum":null}var _n=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,An=new RegExp("\\b("+mn.join("|")+")\\b|("+dn.join("|")+")$","i"),xn=new RegExp("\\b("+fn.join("|")+")\\b|("+gn.join("|")+")$","i");function xe(n){if(!n)return"";let e=String(n),t=Q(e),i=bt.exec(t);if(i)return e.slice(i[0].length).trim();let r=_e(t,De);return(r?e.slice(0,r.base.length):e).trim()}function Cn(n){if(!n)return!1;let e=Q(String(n));return bt.test(e)||_e(e,De)!==null}var Mn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],ht=new RegExp("^\\s*("+[...Mn].sort((n,e)=>e.length-n.length).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function At(n){if(n==null)return"";let e=String(n),t=ht.exec(e);if(!t)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(t[1]),s=e.slice(t[0].length),o=0;for(;o<8;){let l=ht.exec(s);if(!l||i(l[1])!==r)break;let a=s.slice(l[0].length);if(a.trim()==="")break;s=a,o++}return o===0?e:e.slice(0,t[0].length)+s}function Oe(n,e){if(!n||!e)return!1;let t=String(n);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&t.includes(r))return!0}return!1}var Ae={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(Ae).join("|")+")\\((.+)\\)$");function Ct(n){if(!n)return[];let e=xt.exec(String(n).trim());if(!e)return[];let t=Ae[e[1]],i=e[2],r=[];for(let s=i.indexOf(".");s>=0;s=i.indexOf(".",s+1)){if(s===0)continue;let o=i.slice(s+1);if(o.trim()!=="")for(let l of t){let a=l+o;r.includes(a)||r.push(a)}}return r}function Mt(n,e,t){let i=xt.exec(String(n??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&t==="Decimal")return!0;let s=new Set(Ae[r]),o=String(e??""),l=i[2];for(let a=l.indexOf(".");a>=0;a=l.indexOf(".",a+1)){if(a===0)continue;let f=l.slice(a+1);if(f.trim()!==""){for(let m of Object.values(Ae))for(let g of m)if(!s.has(g)&&o===g+f)return!0}}return!1}function Tn(n){let e=xe(n);return e.length===0?"":e.replace(_n," ")}function Tt(n,e){if(!e)return!1;let t=xe(e);return n.test(Q(Tn(e)))||n.test(Q(t))||n.test(Q(J(t).join(" ")))}function wt(n){return Tt(xn,n)}function wn(n){return Tt(An,n)||wt(n)}var Rt=/int|double|decimal|single|float|number|currency|money/i;function Rn(n){let e=String(n?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||n?.isMeasure===!0||Rt.test(String(n?.dataType??""))?"Continuous":"Categorical"}function In(n){return n?.isMeasure===!0||Rt.test(String(n?.dataType??""))}function It(n){let e=n??{},t=Rn(e);if(t!=="Continuous")return{nature:t,additivity:"unknown",basis:"role",suppressed:!1};if(wt(e.name))return{nature:t,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&Cn(e.name))){if(i==="additive")return{nature:t,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:t,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:t,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:t,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:wn(e.name)?{nature:t,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:t,additivity:"additive",basis:"default",suppressed:!1}}function Nt(n){let e=It(n),t=n??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return In(t)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function ui(n){return Nt(n)[0]}function ci(n,e){return Nt(n).indexOf(e)>=0}function mi(n,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let t=It(n);return t.additivity==="additive"||t.additivity==="part_of_whole"||t.additivity==="unknown"}var Nn={de:["nr","nummer","kennung","kennziffer","plz","postleitzahl"],nl:["nr","nummer"],sv:["nr","nummer"],da:["nr","nummer"],nb:["nr","nummer"],fi:["tunnus","koodi","nro"],hu:["azonos\xEDt\xF3","k\xF3d"],tr:["kod","kodu","numaras\u0131","numarasi"],zh:["\u7F16\u53F7","\u4EE3\u7801","\u7F16\u7801","\u53F7\u7801","\u90AE\u7F16"],ja:["\u756A\u53F7","\u30B3\u30FC\u30C9"],ko:["\uBC88\uD638","\uCF54\uB4DC"],hi:["\u0915\u094B\u0921","\u0915\u094D\u0930\u092E\u093E\u0902\u0915"],fr:["num\xE9ro"],es:["c\xF3digo"],pt:["c\xF3digo","cep"],it:["codice"],pl:["kod","numer"],cs:["k\xF3d","\u010D\xEDslo"],sk:["k\xF3d","\u010D\xEDslo"],hr:["\u0161ifra","oznaka"],ru:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],uk:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],el:["\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2"],ar:["\u0631\u0645\u0632","\u0643\u0648\u062F","\u0631\u0642\u0645"],he:["\u05E7\u05D5\u05D3"],id:["kode","nomor"],vi:["m\xE3"],th:["\u0E23\u0E2B\u0E31\u0E2A"]},En=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],vn=["num\xE9ro"],kn=n=>n.normalize("NFC").toLowerCase();function Dn(n,e,t,i){let r=we(t);return!r||!n?null:n===e?"word":r.wordBreaks===!1?Array.from(e).length<Ye?null:(i?n.startsWith(e):n.endsWith(e))&&n.length>e.length?"suffix":null:i?Ke(n,t).includes(e)?"word":null:r.script==="Hang"?He(n,e)?"suffix":null:r.compounds&&Ve(n,e,Ue)?"suffix":null}function Et(n){let e=String(n??"").trim();if(!e)return null;let t=me(e),i=me(xe(e));for(let[r,s]of Object.entries(Nn)){let o=En.includes(r),l=o?i:t;for(let a of s){let f=vn.includes(a)||!!we(r)?.foldSensitive,m=f?l.words:l.folded;if(m.length===0)continue;let g=f?kn(a):me(a).folded.join(" "),u=Dn(o?m[0]:m[m.length-1],g,r,o);if(u)return{lang:r,word:a,view:u}}}return null}var On=[["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 Ce(n){for(let[e,t]of On)if(t.test(n))return e;return null}var Ln=[{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]]}],Me=new Map;function vt(n,e,t,i){let r=Me.get(n);if(r)return r;let s=[];for(let[o,l]of e)for(let a=o;a<=l;a++){let f=String.fromCodePoint(a);Ce(f)===t&&(i&&!i.test(f)||s.push(f))}return Me.set(n,s),s}function Pn(n){let t=n.codePointAt(0);for(let o=0;o<9&&Ce(String.fromCodePoint(t-1))==="Nd";o++)t--;let i="nd:"+t.toString(16),r=Me.get(i);if(r)return r;let s=[];for(let o=t;o<t+10;o++){let l=String.fromCodePoint(o);Ce(l)==="Nd"&&s.push(l)}return Me.set(i,s),s}function Fn(n,e){if(e==="Nd")return Pn(n);for(let r of Ln)if(r.test.test(n))return vt(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=n.codePointAt(0)&-128;return vt("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function Wn(n,e,t,i){let r=n.filter(s=>!e.has(s));return r.length===0&&(r=n.filter(s=>s!==t)),r.length===0?t:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var Bn=/^[\p{L}\p{M}\p{Nd}]$/u,kt=/^[\p{L}\p{Nd}]$/u;function Dt(n,e){if(!n)return n??"";let t=new Set(Array.from(n)),i=m=>{let g=Ce(m);return!g||!Bn.test(m)?m:Wn(Fn(m,g),t,m,e)},r=m=>{let g=[];for(let u of m)g.push(i(u)),kt.test(u)&&e()<.2&&g.push(i(u));if(g.length>6){let u=Math.floor(e()*Math.min(3,g.length-6));for(let S=0;S<u;S++)for(let M=0;M<5;M++){let I=Math.floor(e()*g.length);if(kt.test(g[I])){g.splice(I,1);break}}}return g.join("")};if(!(n.includes("@")&&n.includes(".")))return r(n);let[o,l=""]=n.split("@"),a=l.endsWith(".com"),f=a?l.slice(0,-4):l;return`${r(o)}@${r(f)}${a?".com":""}`}var Gn=/^[A-Za-z_$][A-Za-z0-9_$]*$/,zn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),$n=new RegExp([String.raw`\bisMeasure\b`,String.raw`\bdataType\b`,String.raw`\bcolumns\s*\[\s*-?\d`,String.raw`\.iloc\s*\[[^\]]*,`,String.raw`\.iat\s*\[`,String.raw`\bselect_dtypes\b`,String.raw`\b_get_numeric_data\b`,String.raw`\bis_numeric_dtype\b`,String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`,String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`,String.raw`\bdf\.dtypes\b`,String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`,String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));function ae(n,e){if(!n||!e)return!1;let t=zn(e);return new RegExp("['\"`]"+t+"['\"`]").test(n)?!0:Gn.test(e)&&new RegExp("\\."+t+"(?![A-Za-z0-9_$])").test(n)}function Un(n){return!!n&&$n.test(n)}function bi(n,e,t){return n?Un(n)?[...e]:[...t,...e].some(i=>ae(n,i))?e.filter(i=>ae(n,i)):[...e]:[]}var Vn=5,Kn=6,Hn=3,ne=864e5,Yn=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,jn=/^(\d{4})[-/](\d{1,2})$/,Xn=/^(\d{4})[-\s]?Q([1-4])$/i,Zn=/^Q([1-4])[-\s](\d{4})$/i,Qn=/^(\d{4})$/,qn=/^(\d{4})(0[1-9]|1[0-2])$/,Jn=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,er=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,tr=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Le(n,e,t){let i=ee(n);if(!i)return 0;if(i==="sept")return 9;for(let o of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=he(o)[i];if(l!==void 0)return l+1}let r=t?.get(i);if(r!==void 0)return r+1;let s=se(n);if(s.length>0){if(s.every(a=>a.month===s[0].month))return s[0].month+1;let o=ze(String(e??"").split(/[-_]/)[0])?.code,l=s.find(a=>a.lang===o);if(l)return l.month+1}return 0}function nr(n){let e=fe(n).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let t=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==t.n||i.year!==t.year)?null:H(t.year,(t.n-1)*3+1,1)}function H(n,e,t,i=0,r=0,s=0){if(!(n>=1&&e>=1&&e<=12&&t>=1&&t<=31))return null;let o=Date.UTC(n,e-1,t,i,r,s);if(!Number.isFinite(o))return null;let l=a=>a<10?"0"+a:String(a);return{ms:o,y:n,m:e,d:t,iso:`${n}-${l(e)}-${l(t)}`}}function rr(n,e){let t=[],i="";for(let a=0;a<e.length;a++){if(e[a]!=="%"){i+=e[a].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++a]){case"Y":t.push("Y"),i+="(\\d{4})";break;case"m":t.push("m"),i+="(\\d{1,2})";break;case"d":t.push("d"),i+="(\\d{1,2})";break;case"H":case"M":case"S":i+="\\d{1,2}";break;case"%":i+="%";break;default:return null}}let r=new RegExp("^"+i+"$").exec(n);if(!r)return null;let s=0,o=1,l=1;return t.forEach((a,f)=>{let m=+r[f+1];a==="Y"?s=m:a==="m"?o=m:l=m}),s?H(s,o,l):null}function ie(n,e,t,i){let r=(n??"").trim();if(r==="")return null;if(e){let a=rr(r,e);return a||null}let s=Yn.exec(r);if(s)return H(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=Xn.exec(r),s)return H(+s[1],(+s[2]-1)*3+1,1);if(s=Zn.exec(r),s)return H(+s[2],(+s[1]-1)*3+1,1);if(s=jn.exec(r),s&&+s[2]>=1&&+s[2]<=12)return H(+s[1],+s[2],1);if(s=Jn.exec(r),s)return H(+s[1],+s[2],+s[3]);if(s=qn.exec(r),s)return H(+s[1],+s[2],1);if(s=Qn.exec(r),s){let a=+s[1];return a>=1900&&a<=2100?H(a,1,1):null}let o=nr(r);if(o)return o;if(s=er.exec(r),s){let a=Le(s[1],t,i);if(a)return H(+s[2],a,1)}if(s=tr.exec(r),s){let a=Le(s[2],t,i);if(a)return H(+s[1],a,1)}let l=re(r);if(l){let a="month"in l?l.month:Le(l.word,t,i);if(a)return H(l.year,a,1)}return null}function Ot(n){let e=new Date(n).getUTCDay();return e>=1&&e<=5}function Lt(n,e){if(e<=n)return 0;let t=Math.round((e-n)/ne),i=Math.floor(t/7),r=i*5,s=n+i*7*ne;for(;s<e;)Ot(s)&&r++,s+=ne;return r}function ir(n){if(n.length===0)return 0;let e=[...n].sort((i,r)=>i-r),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function sr(n){return n>0?n<.95?"hour":n<=1.05?"day":n>=6.5&&n<=7.5?"week":n>=27&&n<=31.5?"month":n>=88&&n<=93?"quarter":n>=362&&n<=368?"year":"irregular":"irregular"}function le(n,e,t,i){switch(t){case"year":return e.y-n.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(n.y*4+Math.floor((n.m-1)/3));case"month":return e.y*12+e.m-(n.y*12+n.m);case"week":return Math.round((e.ms-n.ms)/(7*ne));case"weekday":return Lt(n.ms,e.ms);case"day":return Math.round((e.ms-n.ms)/ne);default:return i>0?Math.round((e.ms-n.ms)/i):0}}function Pt(n,e){return Pe(n,e)?.cadence??null}function Pe(n,e){let t=e?.gapFactor??Vn,i=0,r=0,s=new Map,o=Array.from(n),l;if(!e?.pattern){let b=[];for(let A of o){if(A==null||A==="")continue;let p=re(String(A));p&&"word"in p&&b.push(p.word)}b.length>0&&(l=ye(b,e?.locale)??void 0)}for(let b of o){if(b==null||b==="")continue;i++;let A=ie(String(b),e?.pattern,e?.locale,l);A&&(r++,s.set(A.ms,A))}let a=[...s.values()].sort((b,A)=>b.ms-A.ms);if(a.length<Hn||i>0&&r/i<.8)return null;let f=a[a.length-1].ms-a[0].ms;if(f<=0)return null;let m=[];for(let b=1;b<a.length;b++)m.push(a[b].ms-a[b-1].ms);let g=ir(m);if(!(g>0))return null;let u=sr(g/ne);u==="day"&&f>=7*ne&&a.every(b=>Ot(b.ms))&&Lt(a[0].ms,a[a.length-1].ms)+1>a.length*.5&&(u="weekday");let S=u==="irregular"?a.length:le(a[0],a[a.length-1],u,g)+1,M=1,I=1,x=[],d=a[0],h=1;for(let b=1;b<a.length;b++){let A=le(a[b-1],a[b],u,g);A>M&&(M=A),u!=="irregular"&&A>t?(I++,x.push({from:d.iso,to:a[b-1].iso,points:h}),d=a[b],h=1):h++}x.push({from:d.iso,to:a[a.length-1].iso,points:h});let y={grain:u,points:a.length,expectedPoints:Math.max(S,a.length),coveragePct:Math.round(a.length/Math.max(S,a.length)*1e3)/10,runs:I,largestGapUnits:M,gapFactor:t};return e?.includeBounds&&x.length<=Kn&&(y.runBounds=x),{cadence:y,points:a,stepMs:g}}var or=8,ar=.5,lr=200,ur=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"]),cr=["category","classification","segment","status","priority","severity","channel"],mr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function dr(n){let e=J(n);if(e.length===0)return!1;let t=e[e.length-1];return ur.has(t)?!0:cr.some(i=>t.length>i.length&&t.endsWith(i))}function fr(n){if(n.isMeasure)return"measure";if(n.isTemporal||n.isDatePart||n.isReassembledDate)return"temporal";let e=Array.from(n.values).filter(t=>t!==""&&t!==null&&t!==void 0);return e.length<2||e.length>lr?"cardinality":n.rows>0&&e.length>=n.rows?"row-identity":n.isBinaryFlag?"flag":ge(e,n.locale)!==null?"ordinal":n.identifierNamed||n.dataType==="String"&&mr.has(pe(e))?"identifier":!n.geoKind&&dr(n.name)?"attribute":"entity"}function Bt(n){let e=-1,t=1/0,i=!1;return n.forEach((r,s)=>{if(fr(r)!=="entity")return;let o=new Set(Array.from(r.values).filter(a=>a!=="")).size,l=!!r.geoKind;(o<t||o===t&&l&&!i)&&(e=s,t=o,i=l)}),e}var Ft=n=>n<10?"0"+n:String(n);function Wt(n,e){switch(e){case"year":return`${n.y}-01-01`;case"quarter":return`${n.y}-${Ft(Math.floor((n.m-1)/3)*3+1)}-01`;case"month":return`${n.y}-${Ft(n.m)}-01`;case"hour":return new Date(n.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return n.iso}}function Gt(n){let{periods:e,series:t}=n,i=Math.min(e.length,t.length),r=new Set;for(let A=0;A<i;A++)e[A]&&r.add(e[A]);let s=Pe(r,{pattern:n.pattern,locale:n.locale});if(!s)return null;let o=s.cadence.grain;if(o==="irregular")return null;let l=s.points[0],a=le(l,s.points[s.points.length-1],o,s.stepMs)+1;if(a!==s.cadence.expectedPoints)return null;let f=new Map;for(let A of r){let p=ie(A,n.pattern,n.locale);if(!p)continue;let w=le(l,p,o,s.stepMs);w>=0&&w<a&&f.set(A,{idx:w,stamp:p})}let m=new Map;for(let A=0;A<i;A++){let p=t[A];if(!p)continue;let w=f.get(e[A]);if(!w)continue;let T=m.get(p);T||(T={seen:new Set,lo:w.idx,hi:w.idx,loStamp:w.stamp,hiStamp:w.stamp,order:m.size},m.set(p,T)),T.seen.add(w.idx),w.idx<T.lo&&(T.lo=w.idx,T.loStamp=w.stamp),w.idx>T.hi&&(T.hi=w.idx,T.hiStamp=w.stamp)}if(m.size<2)return null;let g=0;for(let A of m.values())g+=A.seen.size;if(g/(m.size*a)<(n.minFill??ar))return null;let u=[],S=new Set,M=0,I=0,x=0,d=0,h=0,y=1;for(let[A,p]of m){for(let $ of p.seen)S.add($);if(p.seen.size>=a)continue;let w=[...p.seen].sort(($,j)=>$-j),T=1;for(let $=1;$<w.length;$++)T=Math.max(T,w[$]-w[$-1]);let V={key:A,acc:p,coverage:p.seen.size/a,before:p.lo,after:a-1-p.hi,interior:p.hi-p.lo+1-p.seen.size,gap:T};u.push(V),V.before>0&&M++,V.after>0&&I++,V.interior>0&&x++,d=Math.max(d,V.before),h=Math.max(h,V.after),y=Math.max(y,T)}if(u.length===0)return null;u.sort((A,p)=>A.coverage-p.coverage||A.acc.order-p.acc.order);let b=u.slice(0,n.maxListed??or);return{seriesColumn:n.seriesColumn,grain:o,periods:a,seriesCount:m.size,incompleteSeries:u.length,lateStarts:M,earlyEnds:I,withHoles:x,columnWideMissing:a-S.size,maxMissingBefore:d,maxMissingAfter:h,largestGap:y,series:b.map(A=>{let p={};return n.includeNames&&(p.name=A.key),n.includeDates&&(p.first=Wt(A.acc.loStamp,o),p.last=Wt(A.acc.hiStamp,o)),p.missingBefore=A.before,p.missingAfter=A.after,p.missingInterior=A.interior,p.largestGap=A.gap,p.coverage=Math.round(A.coverage*1e3)/1e3,p}),more:u.length-b.length}}var gr=5e5,pr=8,hr=4,yr=5,Fe=1,We=2,br=4,Sr=8;function _r(n,e,t){let[i,r]=[...n];if(e.isTemporal){let s=ie(i,e.temporalTextPattern,t),o=ie(r,e.temporalTextPattern,t);if(s&&o&&s.ms!==o.ms)return s.ms<o.ms?{a:i,b:r,setOrder:"temporal"}:{a:r,b:i,setOrder:"temporal"}}return i<r?{a:i,b:r,setOrder:"none"}:{a:r,b:i,setOrder:"none"}}function Ar(n,e,t){let{rows:i,text:r,locale:s}=n,o=_r(t.values,t,s),l=new Uint8Array(i.length),a=0;for(let f=0;f<i.length;f++){let m=r(i[f][e]);m===o.a?l[f]=1:m===o.b?l[f]=2:a++}return{code:l,blankRows:a,setOrder:o.setOrder}}function xr(n,e){let{rows:t,text:i}=n,r=new Int32Array(t.length),s=new Map;for(let o=0;o<t.length;o++){let l=i(t[o][e]);if(l===""){r[o]=-1;continue}let a=s.get(l);a===void 0&&(a=s.size,s.set(l,a)),r[o]=a}return{ids:r,dict:s}}function Cr(n,e,t){let i=new Uint8Array(t);for(let s=0;s<n.length;s++){let o=e[s];if(o===0)continue;let l=n[s];if(l<0)continue;let a=i[l];i[l]=a&o?a|o<<2:a|o}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let s=0;s<t;s++){let o=i[s];o&Fe&&r.keysA++,o&We&&r.keysB++,(o&(Fe|We))===(Fe|We)&&r.keysBoth++,o&br&&r.dupA++,o&Sr&&r.dupB++}return r}function Mr(n,e){let t=(n.dupA+n.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(n.keysA+n.keysB);return t<i||t===i&&n.keysBoth>e.keysBoth}var zt=n=>n==null||typeof n=="string"&&n.trim()==="";function Tr(n,e,t){if(n===e)return!0;let i=zt(n),r=zt(e);return i||r?i&&r:typeof n=="number"&&typeof e=="number"?!1:n instanceof Date&&e instanceof Date?n.getTime()===e.getTime():t(n).trim()===t(e).trim()}function $t(n){let{rows:e,columns:t}=n,i=e.length;if(i<2||i>gr)return null;let r=t.map((p,w)=>({c:p,i:w})).filter(({c:p})=>!p.isMeasure&&!p.isTemporal&&!p.isDatePart&&p.distinct>=yr).sort((p,w)=>(w.c.identifierNamed?1:0)-(p.c.identifierNamed?1:0)||w.c.distinct-p.c.distinct||p.i-w.i).slice(0,pr),s=t.map((p,w)=>({c:p,i:w})).filter(({c:p})=>!p.isMeasure&&p.values!==null&&p.values.size===2).slice(0,hr);if(r.length===0||s.length===0)return null;let o=s.map(({c:p,i:w})=>Ar(n,w,p)),l=null;for(let{i:p}of r){let w=xr(n,p);for(let T=0;T<s.length;T++){if(s[T].i===p)continue;let V=Cr(w.ids,o[T].code,w.dict.size);V.keysBoth<1||(!l||Mr(V,l.tally))&&(l={tally:V,keyIdx:p,setNo:T,ids:w.ids,dict:w.dict})}}if(!l)return null;let{ids:a,dict:f,tally:m}=l,g=o[l.setNo],u=s[l.setNo].i,S=f.size,M=new Int32Array(S).fill(-1),I=new Int32Array(S).fill(-1);for(let p=0;p<i;p++){let w=g.code[p],T=a[p];w===0||T<0||(w===1?M[T]<0&&(M[T]=p):I[T]<0&&(I[T]=p))}let x=[];for(let p=0;p<t.length;p++)p!==l.keyIdx&&p!==u&&x.push(p);let d=0;for(let p=0;p<S;p++){let w=M[p],T=I[p];if(w<0||T<0)continue;let V=e[w],$=e[T],j=!0;for(let q of x)if(!Tr(V[q],$[q],n.text)){j=!1;break}j&&d++}let h=d===m.keysBoth?100:d===0?0:Math.min(99,Math.max(1,Math.round(d/m.keysBoth*100))),y=new Map,b=new Map;for(let[p,w]of f){let T=M[w]>=0,V=I[w]>=0;if(!T&&!V)continue;let $=tt(p);nt($)&&(T&&y.set($,(y.get($)??0)+1),V&&b.set($,(b.get($)??0)+1))}let A=p=>{let w=0;for(let T of p.values())T>=2&&(w+=T);return w};return{key:l.keyIdx,discriminator:u,pairing:{form:"long",key:t[l.keyIdx].name,discriminator:t[u].name,keysA:m.keysA,keysB:m.keysB,keysBoth:m.keysBoth,duplicateKeysA:m.dupA,duplicateKeysB:m.dupB,identicalPct:h,discriminatorBlankRows:g.blankRows,looseCollisionsA:A(y),looseCollisionsB:A(b),setOrder:g.setOrder}}}var wr=n=>n==="Integer"||n==="Decimal";function Rr(n){let e=[],t=[];return n.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||t.push(r)}}),[...e,...t].slice(0,6)}function Ir(n,e){let t=[];for(let i=0;i<n.length&&t.length<12;i++){let r=n[i];e.has(i)||!wr(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||t.push(i)}return t}function Ut(n){let e=new Map,{rows:t,columns:i,text:r}=n;if(t.length===0||t.length>(n.maxRows??5e5))return e;let s=Rr(i);if(s.length===0)return e;let o=Ir(i,new Set(s));if(o.length===0)return e;let l=s.map(a=>{let[f,m]=i[a].twoValues,g=new Uint8Array(t.length);for(let u=0;u<t.length;u++){let S=r(t[u][a]);g[u]=S===f?1:S===m?2:0}return g});for(let a of o){let f=new Float64Array(t.length),m=0;for(let h=0;h<t.length;h++){let y=t[h][a],b=y==null||y===""?NaN:typeof y=="number"?y:parseFloat(y);f[h]=b,b===b&&b!==1/0&&b!==-1/0&&m++}if(m<2)continue;let g=new Float64Array(m);for(let h=0,y=0;h<t.length;h++){let b=f[h];b===b&&b!==1/0&&b!==-1/0&&(g[y++]=b)}g.sort();let u=new Float64Array(m),S=0;for(let h=0;h<m;h++)(h===0||g[h]!==g[h-1])&&(u[S++]=g[h]);let M=new Int32Array(t.length).fill(-1);for(let h=0;h<t.length;h++){let y=f[h];if(!(y===y&&y!==1/0&&y!==-1/0))continue;let b=0,A=S-1;for(;b<A;){let p=b+A>>>1;u[p]<y?b=p+1:A=p}M[h]=b}let I=[],x=new Int32Array(S),d=new Int32Array(S);for(let h=0;h<s.length;h++){let y=l[h];x.fill(0),d.fill(0);let b=0,A=0;for(let c=0;c<t.length;c++){let _=M[c];_<0||(y[c]===1?(x[_]++,b++):y[c]===2&&(d[_]++,A++))}if(b===0||A===0)continue;let p=b<=A,w=p?b:A,T=p?A:b,V=p?x:d,$=p?d:x,j=0,q=0,Y=0;for(let c=0;c<S;c++){let _=V[c],F=$[c];j+=_*(q+.5*F),q+=F,_+F>=2&&(Y+=_+F)}I.push({outcome:i[s[h]].name,aucMinorityHigh:Math.round(j/(w*T)*1e4)/1e4,nMinority:w,nMajority:T,ties:Y})}I.length>0&&e.set(a,I)}return e}var Nr=12,Er=100,vr=.3,kr=.9,Dr=120,Or=1900,Lr=2100,Pr=0,Fr=20,Wr=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Te(n){if(!n)return!1;let e=J(n);return e.length===0?!1:Wr.has(e[e.length-1])?!0:Et(n)!==null}var Br=new Set(["year","yr","fy"]),Gr=n=>J(n).some(e=>Br.has(e))||et(n)!==null,zr=/^(?:(?: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 Be(n){if(!Number.isInteger(n)||n<190001||n>210012)return!1;let e=n%100;return e>=1&&e<=12}function Ge(n){if(!Number.isInteger(n)||n<19000101||n>21001231)return!1;let e=Math.floor(n/100)%100,t=n%100;return e>=1&&e<=12&&t>=1&&t<=31}var $r=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Ur=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,Vr=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Yt(n,e){let t=[],i=0,r=Kr(n,e,t,()=>{i++});if(r)return r;if(i>0||t.length<2)return null;let s=gt(t,{locale:e,floor:.8});return!s||!s.pattern||s.form==="named"?null:{pattern:s.pattern,orderFrom:s.orderFrom==="shape"?s.order==="ymd"?"iso":"shape":s.orderFrom}}function Kr(n,e,t,i){let r=0,s=0,o=0,l=0,a=0,f="",m=0,g="",u=0,S=0,M=0,I=0,x=!1;for(let p of n){if(p==null)continue;let w=String(p).trim();if(w==="")continue;r++,t.push(w);let T;if(T=$r.exec(w)){i();let V=+T[2],$=+T[3];V>=1&&V<=12&&$>=1&&$<=31&&(s++,T[4]!==void 0&&o++,T[6]!==void 0&&l++)}else if(T=Ur.exec(w)){i();let V=+T[3],$=+T[4];V>=1&&V<=12&&$>=1&&$<=31&&(f&&f!==T[2]&&(x=!0),f=T[2],a++)}else if(T=Vr.exec(w)){i();let V=+T[1],$=+T[3];V>=1&&V<=31&&$>=1&&$<=31&&(V<=12||$<=12)&&(g&&g!==T[2]&&(x=!0),g=T[2],m++,V>12&&M++,$>12&&I++,T[5]!==void 0&&u++,T[7]!==void 0&&S++)}if(r>=200)break}if(r<2||(s+a+m)/r<.8||(s>0?1:0)+(a>0?1:0)+(m>0?1:0)!==1||x)return null;if(s>0)return o===s?{pattern:l===s?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(a>0)return{pattern:`%Y${f}%m${f}%d`,orderFrom:"iso"};if(M>0&&I>0)return null;let y,b;M>0?(y=!0,b="values"):I>0?(y=!1,b="values"):g==="."?(y=!0,b="shape"):(y=!ve(e),b="locale");let A=y?`%d${g}%m${g}%Y`:`%m${g}%d${g}%Y`;return u===m?{pattern:A+(S===m?" %H:%M:%S":" %H:%M"),orderFrom:b}:{pattern:A,orderFrom:b}}function Hr(n,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(n))return!1;let t=n.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!t)return!1;let i=ee(t);return i.length>0&&e[i]!==void 0}function Yr(n,e){let t=new Map,i=new Map;for(let l of n){let a=re(l);if(!a||"month"in a)continue;let f=se(a.word),m=f.some(u=>u.lang==="en"),g=ee(a.word);for(let u of new Set(f.map(S=>S.lang)))u!=="en"&&(t.has(u)||(t.set(u,new Set),i.set(u,new Set)),t.get(u).add(g),m||i.get(u).add(g))}let r=[...t.keys()].filter(l=>t.get(l).size>=3&&i.get(l).size>=1),s=0,o=new Map(r.map(l=>[l,0]));for(let l of e){let a=re(l);if(!a)continue;if("month"in a){s++;continue}let f=se(a.word);if(f.length===0)continue;let m=f.some(g=>g.lang==="en");for(let g of r)(m||f.some(u=>u.lang===g))&&o.set(g,o.get(g)+1)}return s+Math.max(0,...o.values())}var jr=/(?:19|20)[0-9]{2}/;function Xr(n){let e=new Map,t=0;for(let r of n){if(!jr.test(ce(r)))continue;let s=new Set(fe(r).filter(o=>o.yearDigits===4&&(o.grain==="quarter"||o.grain==="week")).map(o=>o.lang));if(s.size!==0){if(s.has("en")){t++;continue}for(let o of s)e.set(o,(e.get(o)??0)+1)}}let i=0;for(let r of e.values())i=Math.max(i,r);return i>0?i+t:0}function Zr(n){let{dataType:e,name:t,isMeasure:i,distinctCount:r}=n;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=n.minNum,o=n.maxNum;if(!(s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&Number.isInteger(s)&&Number.isInteger(o)&&o>=s))return!1;let a=s>=1900&&o<=2100;if(a&&r>=2&&Gr(t)||a&&r>=3&&r===o-s+1)return!0;let f=Be(s)&&Be(o),m=Ge(s)&&Ge(o);if(f||m){if(!n.sampleValues)return!0;let g=0,u=0;for(let S of n.sampleValues){if(S==null||S==="")continue;g++;let M=Number(String(S).trim());if(Number.isFinite(M)&&(f?Be(M):Ge(M))&&u++,g>=60)break}if(g>=2&&u===g)return!0}return!1}if(n.sampleValues){let s=n.locale?he(n.locale):null,o=0,l=0,a=[],f=[];for(let m of n.sampleValues){if(m==null||m==="")continue;o++;let g=String(m).trim();if(a.push(g),zr.test(g)||Hr(g,s)?l++:f.push(g),o>=60)break}if(o>=2&&l/o>=.8||o>=2&&(l+Xr(f)+Yr(a,f))/o>=.8||Yt(a,n.locale)!==null)return!0}return!1}function Qr(n){let e=Q((n||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":_t(n)}function qr(n){let{rows:e,measureColIdx:t,measureName:i,candidateDims:r,minNum:s,maxNum:o,discourageAgg:l}=n,a=100,f=.01,m="";for(let u of r){if(u.distinct<2||u.distinct>a)continue;let S=r.filter(h=>h.idx!==u.idx).map(h=>h.idx),M=new Map;for(let h of e){let y=h[t];if(typeof y!="number"||!Number.isFinite(y))continue;let b=S.length?S.map(p=>String(h[p])).join(m):"",A=M.get(b);A||(A={sum:0,cset:new Set},M.set(b,A)),A.sum+=y,A.cset.add(String(h[u.idx]))}let I=0,x=0,d=0;for(let h of M.values())h.cset.size<2||(d++,Math.abs(h.sum-100)<=100*f?I++:Math.abs(h.sum-1)<=1*f&&x++);if(d>=2&&(I/d>=.9||x/d>=.9))return{additivity:"part_of_whole",partOfWholeDim:u.name}}if(l)return{additivity:"intensive_rate"};let g=Qr(i);return g==="avg"||g==="min"||g==="max"?{additivity:"intensive_rate"}:g==="count"?{additivity:"additive"}:g==="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 jt(n){let{dataType:e,isMeasure:t,name:i,distinct:r,nonblank:s,prec:o,maxval:l,minval:a}=n,f=l-a+1,m=f>0?r/f:1,g=s>0?r/s:0,u=e==="Decimal"||o>0;return!t&&Te(i)?"Categorical":m>=kr&&(rt(i)&&r<=Dr||a>=Or&&l<=Lr||a>=Pr&&l<=Fr)?"Ordinal":t||r>Nr&&(u||r>=Er||g>=vr)?"Continuous":"Categorical"}function Kt(n,e,t){return!n||n.isMeasure||e||n.dataType!=="Integer"&&n.dataType!=="Decimal"?!1:jt({dataType:n.dataType,isMeasure:!1,name:n.name,distinct:t.distinct,nonblank:t.nonblank,prec:t.prec,maxval:typeof t.maxval=="number"?t.maxval:0,minval:typeof t.minval=="number"?t.minval:0})==="Continuous"}function Jr(n){let e=null;for(let t=0;t<n.length;t++){let i=n[t];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=n.slice()),e[t]=r)}return e||n}var Ht=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let t=0;t<this._cols.length;t++){let i=this._cols[t];!i||!/date|time/i.test(String(i.dataType??""))||qe(this._rows.map(r=>r[t]))&&e.add(t)}return e}STR(e){return e==null?"":e instanceof Date?this.wholeDayIso(e)??(isNaN(e.getTime())?"":e.toISOString()):e.toString()}getPrecision(e){if(!isFinite(e))return 0;let i=e.toString().split(".")[1];return i?i.length:0}getColumns(){return this._cols}inferredMeasureFlags(){if(this._inferredMeasureFlags)return this._inferredMeasureFlags;let e=this._cols.map(t=>!!(t&&t.isMeasure));return this._cols.forEach((t,i)=>{if(!t||t.isMeasure||this._declaredDimensions.has(t)||t.dataType!=="Integer"&&t.dataType!=="Decimal")return;let r=new Set,s=0,o=0,l=null,a=null;for(let f of this._rows){let m=f[i],g=this.STR(m);if(g!=""&&(r.add(g),s++,(l===null||m<l)&&(l=m),(a===null||m>a)&&(a=m),t.dataType=="Decimal")){let u=this.getPrecision(m);u>o&&(o=u)}}e[i]=Kt(t,!1,{distinct:r.size,nonblank:s,prec:o,minval:l,maxval:a})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let t of e)t&&this._declaredDimensions.add(t)}wholeDayIso(e){return Qe(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,t){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),o=[],l=[],a=[];for(let c of this._cols){let _=new Map,F=[],D=0,C=0,k=0,P=null,O=null,v=null,G=!1,z=!0,N=!0,E=null,U=!1,L=s.has(i);for(let R of this._rows){let W=R[i],B=L&&W instanceof Date?de(W):W,K=this.STR(B);if(K!=""){if(D+=K.length,_.set(K,(_.get(K)||0)+1),C++,c.dataType=="Integer"||c.dataType=="Decimal"||c.dataType=="DateTime")if((P===null||B<P)&&(P=B),(O===null||B>O)&&(O=B),c.dataType=="Integer"||c.dataType=="Decimal"){if(v===null?v=B:v+=B,c.dataType=="Decimal"){let X=this.getPrecision(B);X>k&&(k=X)}F.push(B)}else G=G||this.hasTimeComponent(B);U&&(B<E?z=!1:B>E&&(N=!1)),E=B,U=!0}}if(C>=3&&(z&&!N?c.sortedDirection="asc":N&&!z?c.sortedDirection="desc":c.sortedDirection="none"),C>0&&_.size>0&&!c.isMeasure){let R=0,W=Number.MAX_SAFE_INTEGER;for(let B of _.values())B>R&&(R=B),B<W&&(W=B);if(c.modalShare=R/C,c.minGroupCount=W===Number.MAX_SAFE_INTEGER?null:W,_.size===2){let B=[..._.keys()].map(ue=>je(ue).trim().toLowerCase()).sort(),X=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ue=>B[0]===ue[0]&&B[1]===ue[1]),Xt=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(c.name);(X||Xt)&&(c.isBinaryFlag=!0)}}else c.isMeasure&&(c.dataType==="Integer"||c.dataType==="Decimal")&&_.size===2&&_.has("0")&&_.has("1")&&(c.isBinaryFlag=!0);if(c.dataType=="DateTime"&&(c.dateWithTime=G,G&&Je(L?this._rows.map(R=>R[i]instanceof Date?de(R[i]):R[i]):this._rows.map(R=>R[i]))?c.timeOfDayOnly=!0:delete c.timeOfDayOnly),c.isTemporal=Zr({dataType:c.dataType,name:c.name,isMeasure:c.isMeasure,distinctCount:_.size,minNum:typeof P=="number"?P:null,maxNum:typeof O=="number"?O:null,sampleValues:_.keys(),locale:t}),c.isTemporal&&c.dataType==="String"&&!c.isMeasure){let R=Yt(_.keys(),t);R&&(c.temporalTextPattern=R.pattern)}if(c.isTemporal&&!c.isMeasure){let R=Pt(_.keys(),{includeBounds:r>=20,pattern:c.temporalTextPattern,locale:t});R&&(c.temporalCadence=R)}this.updateColumnStats10(r,c,C,_,k,O,P),this.updateColumnStats20(r,F,C,v,c,D,G,P,O,k,_,t),Kt(c,this._declaredDimensions.has(c),{distinct:_.size,nonblank:C,prec:k,minval:P,maxval:O})&&(c.isMeasure=!0,c.geoKind=void 0,c.geoMatchPct=void 0,c.geoAmbiguous=void 0,c.dominantGeoRegion=void 0,c.dominantGeoRegionPct=void 0,c.geoRegionCount=void 0),o[i]=c.isMeasure||_.size>2e3?null:new Set(_.keys()),l[i]=_.size,a[i]=_.size===2?[..._.keys()].sort():null,i++}let f=[];this._cols.forEach((c,_)=>{c.isMeasure||f.push({idx:_,distinct:c.distinctCount??0,name:c.name})}),this._cols.forEach((c,_)=>{if(!c.isMeasure)return;let F=typeof c.lowValue=="number"?c.lowValue:null,D=typeof c.highValue=="number"?c.highValue:null,C=qr({rows:this._rows,measureColIdx:_,measureName:c.name,candidateDims:f,minNum:F,maxNum:D,discourageAgg:!!c.discourageAggregationAcrossGroups});c.additivity=C.additivity,C.partOfWholeDim&&(c.partOfWholeDim=C.partOfWholeDim)});let m=50,g=4,u=f.filter(c=>c.distinct>=2&&c.distinct<=m);this._cols.forEach((c,_)=>{if(!c.isMeasure)return;let F=[];for(let N of this._rows){let E=N[_];if(E==null||E==="")continue;let U=typeof E=="number"?E:parseFloat(E);isNaN(U)||F.push(U)}if(F.length===0)return;let D=[...F].sort((N,E)=>N-E);if(D[0]===D[D.length-1])c.relativeDispersion=0;else if(D.length>=g){let N=Z(D,.5),E=Z(D,.1),U=Z(D,.9);c.relativeDispersion=Math.abs(N)>1e-9?Math.round((U-E)/Math.abs(N)*1e3)/1e3:void 0}else c.relativeDispersion=void 0;let C=[];for(let N of u){let E=new Set;for(let U of this._rows){let L=U[_];L==null||L===""||E.add(this.STR(U[N.idx])+"")}C.push({otherColumn:N.name,nonBlankGroupCount:E.size})}C.length>0&&(c.nonBlankGroups=C);let k=0;for(let N of F)k+=N;k/=F.length;let P=0;for(let N of F)P+=(N-k)*(N-k);if(P<=1e-12)return;let O=[],v=[],G=N=>{if(N.length<4)return NaN;let E=[...N].sort((L,R)=>L-R),U=L=>E[Math.min(E.length-1,Math.max(0,Math.floor(L*(E.length-1))))];return U(.75)-U(.25)},z=G(F);for(let N of u){let E=new Map;for(let R of this._rows){let W=R[_];if(W==null||W==="")continue;let B=typeof W=="number"?W:parseFloat(W);if(isNaN(B))continue;let K=this.STR(R[N.idx])+"",X=E.get(K);X?(X.s+=B,X.n++,X.vals.push(B)):E.set(K,{s:B,n:1,vals:[B]})}let U=0;for(let R of E.values()){let W=R.s/R.n;U+=R.n*(W-k)*(W-k)}O.push({otherColumn:N.name,eta2:Math.round(U/P*1e4)/1e4});let L=[];for(let R of E.values()){let W=G(R.vals);isNaN(W)||L.push(W)}if(L.length>=2&&isFinite(z)&&z>1e-9){let R=(Math.max(...L)-Math.min(...L))/z;v.push({otherColumn:N.name,spreadRatio:Math.round(R*1e4)/1e4})}}O.length>0&&(c.groupDiscrimination=O),v.length>0&&(c.spreadDiscrimination=v)});let S=.97,M=.8,I=8,x=5,d=this._cols.map((c,_)=>({c,i:_})).filter(c=>c.c.isMeasure);for(let c=0;c<d.length;c++)for(let _=c+1;_<d.length;_++){let F=d[c].i,D=d[_].i,C=0,k=0,P=0,O=0,v=0,G=0;for(let L of this._rows){let R=L[F],W=L[D];if(R==null||R===""||W===null||W===void 0||W==="")continue;let B=typeof R=="number"?R:parseFloat(R),K=typeof W=="number"?W:parseFloat(W);isNaN(B)||isNaN(K)||(C++,k+=B,P+=K,O+=B*B,v+=K*K,G+=B*K)}if(C<x)continue;let z=C*O-k*k,N=C*v-P*P;if(z<=1e-12||N<=1e-12)continue;let E=(C*G-k*P)/Math.sqrt(z*N),U=Math.min(1,Math.round(Math.abs(E)*1e3)/1e3);for(let L of[d[c].c,d[_].c])(L.maxAbsMeasureCorrelation===void 0||U>L.maxAbsMeasureCorrelation)&&(L.maxAbsMeasureCorrelation=U);if(Math.abs(E)>=S){let L=d[c].c,R=d[_].c;L.collinearWithMeasures||(L.collinearWithMeasures=[]),R.collinearWithMeasures||(R.collinearWithMeasures=[]),L.collinearWithMeasures.push(R.name),R.collinearWithMeasures.push(L.name)}else if(Math.abs(E)>=M){let L=d[c].c,R=d[_].c,W=Math.round(E*1e3)/1e3;L.correlatedWithMeasures||(L.correlatedWithMeasures=[]),R.correlatedWithMeasures||(R.correlatedWithMeasures=[]),L.correlatedWithMeasures.push({otherColumn:R.name,r:W}),R.correlatedWithMeasures.push({otherColumn:L.name,r:W})}}for(let{c}of d)c.correlatedWithMeasures&&(c.correlatedWithMeasures.sort((_,F)=>Math.abs(F.r)-Math.abs(_.r)||(_.otherColumn<F.otherColumn?-1:1)),c.correlatedWithMeasures.length=Math.min(c.correlatedWithMeasures.length,I));for(let c=0;c<this._cols.length;c++){let _=o[c];if(!_||_.size===0)continue;let F=[];for(let D=0;D<this._cols.length;D++){if(D===c)continue;let C=o[D];if(!C||C.size===0)continue;let k=0;for(let O of _)C.has(O)&&k++;let P=Math.round(k/_.size*100);P>0&&F.push({otherColumn:this._cols[D].name,percentShared:P})}F.length>0&&(this._cols[c].sharedValueRatioWithOthers=F)}let h=50,y=[];for(let c=0;c<this._cols.length;c++){let _=o[c];_&&_.size>=2&&_.size<=h&&y.push(c)}if(y.length>=2){let c=new Map,_=(D,C)=>D+":"+C;for(let D=0;D<y.length;D++)for(let C=D+1;C<y.length;C++)c.set(_(y[D],y[C]),new Map);for(let D of this._rows)for(let C=0;C<y.length;C++){let k=this.STR(D[y[C]])+"";for(let P=C+1;P<y.length;P++){let O=""+this.STR(D[y[P]]),v=c.get(_(y[C],y[P])),G=k+""+O;v.set(G,(v.get(G)??0)+1)}}let F=new Map;for(let D=0;D<y.length;D++)for(let C=D+1;C<y.length;C++){let k=y[D],P=y[C],O=o[k].size,v=o[P].size,G=c.get(_(k,P)),z=G.size,N=0;for(let R of G.values())(N===0||R<N)&&(N=R);let E=Math.round(z/(O*v)*100),U=z===O,L=z===v;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[P].name,fillPct:E,determinesOther:U,minCellCount:N,distinctCombinations:z}),(this._cols[P].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:E,determinesOther:L,minCellCount:N,distinctCombinations:z}),U&&O>v){let R=F.get(k);(!R||v<R.card)&&F.set(k,{name:this._cols[P].name,card:v,ratio:v/O})}if(L&&v>O){let R=F.get(P);(!R||O<R.card)&&F.set(P,{name:this._cols[k].name,card:O,ratio:O/v})}}for(let[D,C]of F)this._cols[D].primaryParentColumn=C.name,this._cols[D].nestingRatio=Math.round(C.ratio*100)/100}let b=6,A=this._rows.length;for(let c=0;c<this._cols.length;c++){let _=this._cols[c];if(_.isMeasure||_.primaryParentColumn)continue;let F=_.distinctCount??0;if(F<=h||A>0&&F>=A)continue;let D=[];for(let C=0;C<this._cols.length;C++){if(C===c)continue;let k=this._cols[C];if(k.isMeasure)continue;let P=k.distinctCount??0;P<2||P>=F||D.push(C)}D.sort((C,k)=>(this._cols[C].distinctCount??0)-(this._cols[k].distinctCount??0));for(let C of D.slice(0,b)){let k=new Map,P=!0;for(let v of this._rows){let G=this.STR(v[c])+"",z=this.STR(v[C])+"",N=k.get(G);if(N===void 0)k.set(G,z);else if(N!==z){P=!1;break}}if(!P)continue;let O=this._cols[C].distinctCount??0;_.primaryParentColumn=this._cols[C].name,_.nestingRatio=Math.round(O/F*100)/100;break}}let p=.01,w=.05,T=.95,V=8,$=8,j=6,q=500,Y=[];for(let c=0;c<this._cols.length&&Y.length<$;c++){let _=this._cols[c].dataType;(_==="Double"||_==="Integer"||_==="Decimal")&&Y.push(c)}if(Y.length>=3&&this._rows.length>=V){let c=Math.min(this._rows.length,q),_=Y.map(O=>{let v=[];for(let N=0;N<c;N++){let E=this._rows[N][O],U=typeof E=="number"?E:parseFloat(String(E).replace(/,/g,""));if(E==null||E===""||!isFinite(U))return null;v.push(U)}let G=v[0],z=!1;for(let N of v)if(N!==G){z=!0;break}return z?v:null}),F=Y.map((O,v)=>v).filter(O=>_[O]!==null),D=O=>{let v=O.slice().sort((z,N)=>z-N),G=v.length>>1;return v.length%2?v[G]:(v[G-1]+v[G])/2},C=null,k=[],P=O=>{if(k.length>=3){let v=k.map(E=>_[E]),G=v[0].length,z=new Array(G);for(let E=0;E<G;E++){let U=0;for(let L of v)U+=L[E];z[E]=U}let N=D(z);if(N>0){let E=0;for(let L of z)Math.abs(L-N)<=N*p&&E++;let U=E/G;if(U>=T){let L=1;for(let R of v){let W=D(R)/N;W<L&&(L=W)}L>=w&&(!C||k.length>C.cols.length)&&(C={cols:k.slice(),total:N,matched:U})}}}if(!(k.length>=j))for(let v=O;v<F.length;v++)k.push(F[v]),P(v+1),k.pop()};if(P(0),C){let O=C,G={columns:O.cols.map(z=>this._cols[Y[z]].name),total:Math.round(O.total*1e3)/1e3,matchedPct:Math.round(O.matched*100)/100};for(let z of O.cols)this._cols[Y[z]].constantSumGroup=G}}return this.applyTwoSetPairing(t,o),this.applyScoreSeparation(l,a),this.applySeriesCompleteness(r,t,o),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,t){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=$t({rows:this._rows,columns:this._cols.map((r,s)=>{let o=t[s];return{name:r.name,values:o,distinct:o?o.size:r.distinctCount??0,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Te(r.name),temporalTextPattern:r.temporalTextPattern}}),text:r=>this.STR(r),locale:e});i&&(this._cols[i.key].twoSetPairing=i.pairing,this._cols[i.discriminator].twoSetPairing=i.pairing)}applyScoreSeparation(e,t){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=Ut({rows:this._rows,columns:this._cols.map((r,s)=>({name:r.name,dataType:r.dataType,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Te(r.name),isBinaryFlag:!!r.isBinaryFlag,distinct:e[s]??0,twoValues:t[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,t,i){for(let u of this._cols)u.seriesCompleteness!==void 0&&delete u.seriesCompleteness;let r=this._cols.map((u,S)=>({c:u,i:S})).filter(({c:u})=>u.isTemporal&&!u.isMeasure&&u.temporalCadence&&u.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=[],o=[];this._cols.forEach((u,S)=>{let M=i[S];M&&(s.push(S),o.push({name:u.name,dataType:u.dataType,isMeasure:!!u.isMeasure,isTemporal:!!u.isTemporal,isDatePart:!!u.isDatePart,isReassembledDate:!!u.isReassembledDate,isBinaryFlag:!!u.isBinaryFlag,geoKind:u.geoKind,identifierNamed:Te(u.name),values:M,rows:this._rows.length,locale:t}))});let l=Bt(o);if(l<0)return;let a=s[l],f=this._cols[a],m=this._rows.map(u=>this.STR(u[a])),g=e>=20&&(f.dataType!=="String"||Array.isArray(f.safeDistinctValues));for(let{c:u,i:S}of r){let M=Gt({periods:this._rows.map(I=>this.STR(I[S])),series:m,seriesColumn:f.name,pattern:u.temporalTextPattern,locale:t,includeDates:e>=20,includeNames:g});M&&(u.seriesCompleteness=M)}}updateColumnStats20(e,t,i,r,s,o,l,a,f,m,g,u){if(e>=20){let S=[...t].sort((x,d)=>x-d),M=Math.floor(S.length/2);if(i>0&&r!=null?s.avgValue=s.dataType=="Integer"?Math.round(r/i):r/i:s.avgValue=null,i>0&&(s.avgLength=o/i),this._rows.length>0){let x=d=>{let h=d instanceof Date?d:typeof d=="string"?Re(d)??new Date(d):new Date(d),y=this.wholeDayIso(h);return y?y+"T00:00:00.000Z":isNaN(h.getTime())?d:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!a?s.lowValue=a:s.lowValue=x(a),s.dataType!="DateTime"||l||!f?s.highValue=f:s.highValue=x(f),s.medianValue=S.length===0?null:S.length%2===0?s.dataType=="Integer"?Math.round((S[M-1]+S[M])/2):(S[M-1]+S[M])/2:S[M],s.numericPrecision=m}if(S.length>0){let x=s.avgValue??0,d=S.length,h=0,y=0;for(let A of S){let p=A-x;h+=p*p,y+=p*p*p}let b=h/d;s.skewness=b===0?0:y/d/Math.pow(Math.sqrt(b),3),s.stdDev=Math.sqrt(b)}r!==null&&(s.sum=r);let I=Array.from(g.entries()).sort((x,d)=>d[1]-x[1]);if(s.topCategories=I.slice(0,10).map(x=>x[1]),!s.isMeasure&&I.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=I.slice(0,5).map(x=>x[0])),e>=20)){let x=I.map(h=>h[0]),d=ge(x,u);if(d!==null)s.ordinalPattern=d.pattern,s.orderedDomain=d.orderedDomain;else if(s.dataType==="String"){let h=it(x);h!==null&&(s.safeDistinctValues=h)}}if(S.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let x=d=>S[Math.floor((S.length-1)*d)];s.quantiles={p05:x(.05),p25:x(.25),p75:x(.75),p95:x(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&g.size>0){let S=Array.from(g.entries()).sort((x,d)=>d[1]-x[1]).map(x=>x[0]);s.formatSignature=pe(S);let M=i>0?o/i:void 0,I=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!I.test(s.formatSignature)&&(M===void 0||M>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&g.size>0){let S=Array.from(g.entries()).sort((I,x)=>x[1]-I[1]),M=at(S.map(I=>I[0]),s.name,u);if(M!==null&&(s.geoKind=M.geoKind,s.geoMatchPct=M.geoMatchPct,M.geoAmbiguous&&(s.geoAmbiguous=!0),M.geoKind.indexOf("country")===0)){let I=Ie(S);I&&(s.dominantGeoRegion=I.dominantGeoRegion,s.dominantGeoRegionPct=I.dominantGeoRegionPct,s.geoRegionCount=I.regionCount)}}}updateColumnStats10(e,t,i,r,s,o,l){let a=this._rows.length-i;e>=10&&(t.blankCount=a),t.distinctCount=r.size+(a!=0?1:0),t.valueNature="Categorical",i>0&&(t.dataType==="Integer"||t.dataType==="Decimal"?t.valueNature=jt({dataType:t.dataType,isMeasure:!!t.isMeasure,name:t.name,distinct:r.size,nonblank:i,prec:s,maxval:o,minval:l}):t.dataType==="DateTime"&&(t.valueNature=t.dateWithTime?"Continuous":"Ordinal"))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((i,r)=>{i.isMeasure||e.push(r)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let t=new Set;for(let i of this._rows)t.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=t.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>$e(o,{camel:!0}),t=-1,i=-1,r=-1;if(this._cols.forEach((o,l)=>{let a=e(o.name),f=o.dataType==="Integer"||o.dataType==="Decimal";f&&t<0&&a.some(m=>m==="lat"||m==="latitude")?t=l:f&&i<0&&a.some(m=>m==="lon"||m==="lng"||m==="long"||m==="longitude")&&(i=l),r<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(r=l)}),t<0||i<0)return null;let s=[];for(let o of this._rows){let l=o[t],a=o[i],f=l==null||l===""?null:Number(l),m=a==null||a===""?null:Number(a);s.push({lat:f,lon:m,country:r>=0&&be(this.STR(o[r]))?this.STR(o[r]):null})}return this._geoExtent=mt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;obfuscateString(e){return Dt(e,Ze)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(t=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=t[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=t[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=t[r]);return i})}async getCSVAsync(e){let t=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,o=this.wallClockColumnIndexes();for(let a of this._rows){let f={};for(let m=0;m<this._cols.length;m++){let g=this._cols[m],u=a[m];if(this.STR(u)!=""){if(e&&g.dataType=="String")if(s.has(u))u=s.get(u);else{let S=this.obfuscateString(u);s.set(u,S),u=S}else if(g.dataType=="DateTime"&&!g.dateWithTime){let S=u instanceof Date?u:typeof u=="string"?Re(u)??new Date(u):new Date(u);u=(this.wholeDayIso(S)??S.toISOString().slice(0,10))+"T00:00:00.000Z"}else o.has(m)&&u instanceof Date&&(u=de(u));r-=this.STR(u).length}else u=null;f[m]=u,--r}if(t.push(f),--i,i<=0||r<=0)break}return await Vt.unparse(t,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return Vt.unparse([this._cols.map((t,i)=>{if(this.emitLegacyAggAliases&&t.hostName)return this.STR(t.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:t.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(t=>t==null?null:this.STR(t)),this._englishAliases=new Map}aliasesForCode(e){let t=Oe(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())t.push({name:i.name,alias:i.alias,reason:"english-implicit-agg"});return t}armAliasesForCode(e){return this.emitLegacyAggAliases=Oe(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let t of this.liveEnglishAliases().values())e.push({name:t.name,alias:t.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let t of this._cols)t&&t.hostName&&t.hostName!==t.name&&e.push({name:this.STR(t.name),alias:this.STR(t.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let t=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return t;let i=String(e),r=new Set;for(let o of this._cols)o&&(r.add(this.STR(o.name)),o.hostName&&r.add(this.STR(o.hostName)));let s=new Map;for(let o=0;o<this._cols.length;o++){if(!this._cols[o]||Mt(this._hostQueryNames[o],this._cols[o].name,this._cols[o].dataType))continue;let l=Ct(this._hostQueryNames[o]).filter(a=>!r.has(a)&&ae(i,a));l.length===1&&s.set(l[0],[...s.get(l[0])??[],o])}for(let[o,l]of s){if(l.length!==1)continue;let a=this.STR(this._cols[l[0]].name);t.set(l[0],{name:a,alias:o,headerName:!ae(i,a)})}return t}liveEnglishAliases(){let e=new Map;for(let[t,i]of this._englishAliases){let r=this._cols?this._cols[t]:null;r&&this.STR(r.name)===i.name&&e.set(t,i)}return e}addRow(e,t){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=Xe(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(Jr(e)),this._inferredMeasureFlags=null,this._origIndices.push(t??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}reset(){this._inferredMeasureFlags=null,this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map}setColumns(e){if(this._inferredMeasureFlags=null,this._cols=e,!e||e.length===0)return;let t=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=At(r);!s||s===r||t.has(s)||(t.delete(r),t.add(s),i.hostName=r,i.name=s)}}};export{mt as a,qt as b,be as c,ni as d,gt as e,mn as f,dn as g,fn as h,gn as i,xe as j,Cn as k,At as l,Oe as m,Ct as n,wt as o,wn as p,It as q,Nt as r,ui as s,ci as t,mi as u,Nn as v,En as w,vn as x,Et as y,ae as z,Un as A,bi as B,Vn as C,Kn as D,ie as E,Pt as F,or as G,ar as H,lr as I,fr as J,Bt as K,Gt as L,Te as M,Yt as N,Zr as O,Qr as P,qr as Q,jt as R,Kt as S,Jr as T,Ht as U};
@@ -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-QPIKC2O6.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-NT6CDI3K.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{a as ZIP_NAME_TOKENS,f as buildGeoIsoColumn,c as detectGeo,b as hasAnyToken,e as isJoinGeoKind,d as toGeoIso};
2
+ import{a,b,c,d,e,f}from"./chunk-IPPPCWAK.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.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 Hn,b as Kn}from"./chunk-HIVICMC5.mjs";import{a as Bn,b as I,c as jn,d as D,e as E,f as Yn,g as X,h as J}from"./chunk-QMVECPSM.mjs";import{a as qn,b as $n,c as zn}from"./chunk-ZKRTZ3TY.mjs";import{A as Sn,B as Rn,C as xn,D as wn,E as _n,F as On,G as vn,H as Pn,I as Ln,J as An,K as Mn,L as In,M as Nn,N as Fn,O as Dn,P as kn,Q as Gn,R as Vn,S as Un,U as Wn,a as zt,b as Ht,c as Kt,d as Bt,f as en,g as tn,h as nn,i as rn,j as on,k as sn,l as an,m as ln,n as un,o as cn,p as dn,q as mn,r as fn,s as pn,t as gn,u as yn,v as hn,w as Cn,x as bn,y as En,z as Tn}from"./chunk-TBH5LFYH.mjs";import{a as jt}from"./chunk-U3H6UBOO.mjs";import{b as Yt,c as Qt,d as Xt,f as Jt,g as Zt}from"./chunk-A4PQBWRA.mjs";import{a as le,b as ue,c as Ut,d as Wt,e as qt,f as $t}from"./chunk-QPIKC2O6.mjs";import{a as M,b as V,c as Y,d as U,k as W,l as Lt,m as At,n as ae,o as P,p as Mt,q as It,r as Nt,s as q,t as Ft,u as Dt,v as kt,w as Gt,x as Q,y as Vt}from"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import{a as dt,b as mt,c as ft,d as pt,e as gt,f as yt,g as ht,h as Ct,i as bt,j as Et,k as Tt,l as St,m as Ot,n as vt,o as Pt}from"./chunk-IIGGO4ES.mjs";import{a as We,b as qe,c as $e,d as ze,e as He,f as Ke,g as Be,h as je,i as Ye,j as Qe,k as Xe,l as Je,m as Ze,n as et,o as tt,q as j,r as nt,s as rt,t as ot,u as it,v as st,w as at,x as lt,y as ut,z as ct}from"./chunk-NT6CDI3K.mjs";import{a as Fe,b as De,c as ke,d as Ge,e as Ve,f as B,g as Ue}from"./chunk-WC4JINEZ.mjs";import{b as Rt,c as xt,d as wt,e as _t}from"./chunk-5HI6TVMM.mjs";var Z=2,me=400;function te(e){return!!W(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=U(String(n));if(!V(o)&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||ne(e)<95)return!1;let n=t.filter(a=>te(a)&&!P(a)).length,o=t.filter(a=>!te(a)&&!!P(a)).length;return n>=1&&n>=o}function ce(e,t){if(!P(e))return!1;let n=W(e);return n?t==="world"?!0:ae.has(n):!1}function ne(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)te(o)&&n++;return Math.round(n/t.length*1e3)/10}function $(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)P(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!V(U(o))&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function re(e){let t=oe(e);if(t.length===0)return 0;let n=0;for(let o of t)q(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function de(e,t){return ue(t,le)?!0:oe(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function Qn(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)Q(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function ee(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function Xn(e,t){let n=0;for(let o of oe(e))t(o)&&n++;return n}function Jn(e,t,n,o,a){let u=[],l=[],i={},h={},C=new Set(e),y=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&C.has(d)&&(i[s]=d)}let g=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&g.has(d)&&(i[s]=d)}let f=n?.zip;if(f&&C.has(f)){let s=y(f),d=re(s);d<95?l.push(`zip=${f} (only ${d}% of values read as ZIPs)`):de(s,f)?i.zip=f:l.push(`zip=${f} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&C.has(c)){let s=y(c),d=F(s);d.length>0&&d.every(S=>ce(S,o))?l.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(l.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):$(s)<95?l.push(`state=${c} (only ${$(s)}% of values are states/provinces)`):i.state=c}let p=new Set(Object.values(i).filter(Boolean)),b=e.filter(s=>!p.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of b){let S=y(d);if(N(S))continue;let O=$(S);if(O<95)continue;let K=ee(S,G=>!!P(G)),Ne=ee(S,G=>!!P(G)&&!ce(G,o));K<Z&&Ne<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,p.add(s.name),u.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of b){if(p.has(s))continue;let d=y(s),S=re(d);if(!(S<95)&&de(d,s)&&!(Xn(d,O=>q(O).length>0)<Z)){i.zip=s,p.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(y(T))){let s=null;for(let d of b){if(p.has(d)||!N(y(d)))continue;let S=ne(y(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${ne(y(T))}% of values are country identifiers; using ${s.name} instead)`),h.country=T),i.country=s.name,p.add(s.name),u.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of b){if(p.has(d))continue;let S=y(d),O=Qn(S,o);O<Y||ee(S,K=>Q(K,o))<Z||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let L=i.country?y(i.country):[],R=!!i.country&&N(L),A=R?new Set(L.map(s=>W(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&A>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&l.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&l.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:u,refused:l,...Object.keys(h).length?{labelFallback:h}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ie=Object.freeze({jaar:r("year","nl"),kwartaal:r("quarter","nl"),maand:r("month","nl"),dag:r("day","nl","sv","da","nb"),jahr:r("year","de"),quartal:r("quarter","de"),monat:r("month","de"),tag:r("day","de"),ann\u00E9e:r("year","fr"),mois:r("month","fr"),jour:r("day","fr"),trimestre:r("quarter","fr","es","pt","it"),a\u00F1o:r("year","es"),mes:r("month","es"),d\u00EDa:r("day","es"),ano:r("year","pt"),m\u00EAs:r("month","pt"),dia:r("day","pt"),anno:r("year","it"),mese:r("month","it"),giorno:r("day","it"),\u0433\u043E\u0434:r("year","ru"),\u043C\u0435\u0441\u044F\u0446:r("month","ru"),\u0440\u0456\u043A:r("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:r("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:r("quarter","ru","uk"),\u0434\u0435\u043D\u044C:r("day","ru","uk"),rok:r("year","pl","cs","sk"),kwarta\u0142:r("quarter","pl"),miesi\u0105c:r("month","pl"),dzie\u0144:r("day","pl"),\u010Dtvrtlet\u00ED:r("quarter","cs"),m\u011Bs\u00EDc:r("month","cs"),den:r("day","cs"),\u0161tvr\u0165rok:r("quarter","sk"),mesiac:r("month","sk"),de\u0148:r("day","sk"),\u00E5r:r("year","sv","da","nb"),kvartal:r("quarter","sv","da","nb"),m\u00E5nad:r("month","sv"),m\u00E5ned:r("month","da","nb"),vuosi:r("year","fi"),vuosinelj\u00E4nnes:r("quarter","fi"),kuukausi:r("month","fi"),p\u00E4iv\u00E4:r("day","fi"),\u00E9v:r("year","hu"),negyed\u00E9v:r("quarter","hu"),h\u00F3nap:r("month","hu"),nap:r("day","hu"),y\u0131l:r("year","tr"),\u00E7eyrek:r("quarter","tr"),ay:r("month","tr"),g\u00FCn:r("day","tr"),\u03AD\u03C4\u03BF\u03C2:r("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:r("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:r("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:r("day","el"),an:r("year","ro"),trimestru:r("quarter","ro"),lun\u0103:r("month","ro"),zi:r("day","ro"),godina:r("year","hr"),tromjese\u010Dje:r("quarter","hr"),mjesec:r("month","hr"),dan:r("day","hr"),\u5E74:r("year","ja","zh"),\u56DB\u534A\u671F:r("quarter","ja"),\u5B63\u5EA6:r("quarter","zh"),\u6708:r("month","ja","zh"),\u65E5:r("day","ja","zh"),\uC5F0\uB3C4:r("year","ko"),\uBD84\uAE30:r("quarter","ko"),\uC6D4:r("month","ko"),\uC77C:r("day","ko"),tahun:r("year","id"),kuartal:r("quarter","id"),triwulan:r("quarter","id"),bulan:r("month","id"),hari:r("day","id"),n\u0103m:r("year","vi"),qu\u00FD:r("quarter","vi"),th\u00E1ng:r("month","vi"),ng\u00E0y:r("day","vi"),\u0E1B\u0E35:r("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:r("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:r("month","th"),\u0E27\u0E31\u0E19:r("day","th"),\u0627\u0644\u0633\u0646\u0629:r("year","ar"),\u0633\u0646\u0629:r("year","ar"),\u0627\u0644\u0639\u0627\u0645:r("year","ar"),\u0639\u0627\u0645:r("year","ar"),\u0627\u0644\u0631\u0628\u0639:r("quarter","ar"),\u0631\u0628\u0639:r("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":r("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:r("month","ar"),\u0634\u0647\u0631:r("month","ar"),\u0627\u0644\u064A\u0648\u0645:r("day","ar"),\u064A\u0648\u0645:r("day","ar"),\u05E9\u05E0\u05D4:r("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:r("quarter","he"),\u05D7\u05D5\u05D3\u05E9:r("month","he"),\u05D9\u05D5\u05DD:r("day","he"),\u0935\u0930\u094D\u0937:r("year","hi"),\u0938\u093E\u0932:r("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:r("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:r("month","hi"),\u092E\u093E\u0939:r("month","hi"),\u0926\u093F\u0928:r("day","hi"),\u0633\u0627\u0644:r("year","fa"),\u0645\u0627\u0647:r("month","fa"),\u0631\u0648\u0632:r("day","fa")}),Zn=Object.freeze(Array.from(new Set(Object.values(ie).flatMap(e=>e.langs)))),fe=Object.freeze(["fa","ar","he","th"]),pe=1900,ge=2100;function er(e,t){let n=[],o=B(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function tr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of er(n,t)){let a=ie[o];if(a&&a.langs.includes(t))return a.part}return null}function nr(e,t){return fe.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=pe&&t<=ge:!0}function ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var rr=/\b(?:columns|cols|column)\b/i;function z(e,t){let n=Math.max(0,t-240),o=e.slice(n,t),a=o.lastIndexOf(";");return a>=0&&(o=o.slice(a+1)),rr.test(o)}function he(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Ce(e,t,n){let o=ye(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${o}\2`,"g"),u=new RegExp(String.raw`\.name\s*===?\s*(['"])${o}\1`,"g"),l=0,i;for(;(i=u.exec(e))!==null;)z(e,i.index)&&l++;let h=0;for(;(i=a.exec(e))!==null;){let C=i.index+i[0].lastIndexOf(".name");if(!z(e,C))continue;h++;let y=ye(i[1]);if(!n(y))return!1}return h>0&&h===l}function or(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var be=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function ir(e,t){if(!e)return[];let n=new Set(t);for(let i of be)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)z(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||he(e,i)||l.push(i)}),l}function sr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function Ee(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function ar(e,t,n){let o=Ee(e,t);if(o===null||o<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,u=o>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let l=u.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=Te(n);return i.length===0?l:l+" "+i.join(" ")}function Te(e){if(!e||e.length===0)return[];let t=[],n=new Map,o=new Map;for(let u of e){let l=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(l!==""&&(n.has(l)||(t.push(l),n.set(l,0)),u.isDatePart===!0&&n.set(l,n.get(l)+1),u.isReassembledDate===!0&&!o.has(l))){let i=typeof u.sourceField=="string"?u.sourceField.trim():"",h=typeof u.name=="string"?u.name.trim():"",C=i!==""?i:h;C!==""&&o.set(l,C)}}let a=[];for(let u of t){let l=o.get(u),i=n.get(u)??0;!l||i===0||a.push(`'${l}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var m=e=>e==null?"":String(e),v=e=>e===!0,Se=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},lr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Re(e,t){let n={};for(let[o,a]of lr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function ur(e){return Array.isArray(e)?e.map(t=>({code:m(E(t,"code")),severity:m(E(t,"severity")),text:m(E(t,"text"))})).filter(t=>t.text!==""):[]}function cr(e){let t=C=>E(e,C),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=Re(e,"point"),l=Re(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),h=t("isPollFinal");return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:ur(t("notices")),freemiumStatusCode:m(t("freemiumStatusCode")),code:m(t("code")),language:m(t("language")),version:Number(t("version")??0),codeSummary:m(t("codeSummary")),chartName:m(t("chartName")??t("chartType")),finalChartName:m(t("finalChartName")),warningMessage:m(t("warningMessage")),outputHash:m(t("outputHash")),validatorToken:m(t("validatorToken")),editCodeKey:m(t("editCodeKey")),signedLLMRequestID:m(t("signedLLMRequestID")),userReply:m(t("userReply")),userReplyOutcome:m(t("userReplyOutcome")),improvementSuggestion:m(t("improvementSuggestion")),geoColumn:m(t("geoColumn")),geoKind:m(t("geoKind")),geoPointCols:Object.keys(u).length?u:null,creditBalanceBefore:Se(t("creditBalanceBefore")),creditCost:Se(t("creditCost")),isServiceError:v(t("isServiceError")),isRateLimited:v(t("isRateLimited")),suppressSelectionGlyph:v(t("suppressSelectionGlyph")),isRefusal:v(t("isRefusal")),isVersionNotFound:v(t("isVersionNotFound")),isGenerationCancelled:v(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof h=="boolean"?{isPollFinal:h}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var xe=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function dr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=h=>E(u,h),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:xe(l("rank")),score:xe(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:v(l("isPreview")),alsoWorthALook:v(l("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:k(l("viaProjection")),viaProjectionKey:k(l("viaProjectionKey")),detailNote:k(l("detailNote"))}}).filter(u=>u.name):null,a=Array.isArray(n)?n.map(u=>({name:m(E(u,"chartTypeName")??E(u,"name")),reason:m(E(u,"reason")),reasonCode:m(E(u,"reasonCode")),isVeto:v(E(u,"isVeto"))})).filter(u=>u.name):[];return{errorMessage:m(E(e,"errorMessage")),errorCode:m(E(e,"errorCode")),charts:o,refused:a,noFitSummary:m(E(e,"noFitSummary"))}}function mr(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var we=["working","analyze","generate","refine","review"];function fr(e,t){let n=String(e??"").trim().toLowerCase();if(we.includes(n))return n;let o=String(t??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var pr="FREEMIUM_ATTEMPT_SPENT",gr="CLIENT_SECRET_MISMATCH",yr="FREEMIUM_COLUMN_CAP",hr="OAUTH_TOKEN_EXPIRED",Cr="OAUTH_SIGNED_OUT";function br(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function Er(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,o=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:o.licenseKey,licensee:o.licensee,secretKey:o.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function Tr(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function Sr(e){let t=0;for(let n of e){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>t&&(t=o)}return t}function _e(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,o=(e.codeVersion??0)>0?e.codeVersion:null,a=n??o??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function Rr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=_e({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),u=e.fetchArmedAtMs,l=t&&typeof u=="number"&&Number.isSafeInteger(u)&&u>0?u:void 0;return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{}}}function xr(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function wr(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function _r(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function Or(e,t,n){let o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...o(t)?{rowsWithheld:t}:{},...o(n)?{rowsFilteredOut:n}:{}}}var vr={fit:"Best fit",variety:"Something different"};function Oe(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function Pr(e){let t=Oe(e);return t?{qualifyOrder:t}:{}}function ve(e,t){return e!=null&&t!=null&&e!==t}function Lr(e,t){return e?ve(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var Ar=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Pe(e){let t=String(e??"").trim().toLowerCase();return Ar[t]??t}function Le(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Pe(n.dataType)]);return t}function Mr(e){return j(Le(e))}var Ir=2,Nr=3,Fr=4,Dr=64,kr=8e3,Gr=6e4,Vr=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),Ur=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function Wr(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function qr(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function $r(){let e=new Set,t=new Set;return{firstDraw(n,o){if(!n)return!1;let a=`${n}|${o}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function zr(e){return!!e&&!e.includes("|")&&!e.includes(",")}function se(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function Hr(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=t.timeoutMs,h=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,C=g=>{try{t.onFailure?.(g)}catch{}},y=async(g,f,c,p)=>{let b;try{let T=await a.post(f,c,p,{timeoutMs:i});b=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){C({channel:g,stage:"post",status:null,error:T});return}(b<200||b>299)&&C({channel:g,stage:"status",status:b,error:null})};return{async sendClientMessage(g){let f,c,p;try{f=`${h()}${l}/LogClientMsg/?nocache=${u.now()}`,c=I(g),p=D(c,o)}catch(b){C({channel:"client-message",stage:"build",status:null,error:b});return}await y("client-message",f,c,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(g,f,c){let p,b;try{p=`${h()}${l}/eventlog`,b=se(g,t.clientVersion,f,c)}catch(T){C({channel:"event-count",stage:"build",status:null,error:T});return}await y("event-count",p,b,{"Content-Type":"text/plain"})}}}var Ae=2**31-1;function Me(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function Kr(e){return typeof e=="number"&&e>0&&e<=Ae?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Ae} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function Br(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,o=t.credentials??"omit";return{async post(a,u,l,i){let h=i.timeoutMs,C=Kr(h);if(C)throw C;let y=new AbortController,g=!1,f=setTimeout(()=>{g=!0,y.abort(Me(h))},h),c=()=>y.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let p=!1,b=()=>{p||(p=!0,clearTimeout(f),i.signal?.removeEventListener("abort",c))},T=_=>g?Me(h):_,L;try{L=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:y.signal})}catch(_){throw b(),T(_)}let R=X(L),A=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...A,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{b()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){b(),_.close();return}_.enqueue(s.value)}catch(s){b(),_.error(T(s))}},cancel(_){return b(),x.cancel(_)}});return{status:R.status,...A,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var Ie=300,jr="/LLMChart/",Yr="/LLMChart/qualify",Qr="/VisionReview/",Xr="/LLMChart/sample",Jr="/RefundGenerate/",Zr=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",H=async e=>JSON.parse(await e.text());function eo(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function to(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,h=g=>t.nocache?t.nocache(g):String(u.now());async function C(g,f,c,p,b){let T=`${i()}${l}${f}?nocache=${h(g)}`,L={"Content-Type":"text/plain","X-Signature":D(c,o)},R=p.signal??void 0,A=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&Zr(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,L,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return A(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)eo(x);else try{w=(await x.text()).slice(0,Ie)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await b(x)}}catch(w){return A(!0,w)}}function y(g,f){if(!f||typeof f.timeoutMs!="number"||!Number.isFinite(f.timeoutMs)||f.timeoutMs<=0)throw new TypeError(`The ${g} call needs a positive deadline in milliseconds`);return f}return{async generate(g,f){let c=y("generate",f),p=c.onStage??void 0;return C("generate",jr,I(g),c,b=>J(b,p))},async qualify(g,f){let c=y("qualify",f),p=c.route??Yr;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return C("qualify",p,I(g),c,H)},async review(g,f){let c=y("review",f),p=JSON.stringify(g);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return C("review",Qr,p,c,H)},async sample(g,f){let c=y("sample",f);return C("sample",Xr,I(g),c,H)},async refund(g,f){let c=y("refund",f);if(typeof g!="string"||g.trim()==="")throw new TypeError("A refund needs the generation's correlation id");return C("refund",Jr,JSON.stringify({CorrelationID:g.trim()}),c,H)}}}export{Y as CITY_ROLE_MATCH_PCT,Vr as CLIENT_EVENT_KINDS,gr as CLIENT_SECRET_MISMATCH,Be as COMPOUND_MIN_STEM,dt as CYCLE_MEMBERS,ft as CYCLE_WORDS,ge as DATE_LEVEL_GREGORIAN_YEAR_MAX,pe as DATE_LEVEL_GREGORIAN_YEAR_MIN,Zn as DATE_LEVEL_LANGUAGES,ie as DATE_LEVEL_NAMES,fe as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,xn as DEFAULT_GAP_FACTOR,ot as DEFAULT_TEMPERATURE,Ur as DRAW_REASONS,pr as FREEMIUM_ATTEMPT_SPENT,yr as FREEMIUM_COLUMN_CAP,nt as GET_RANDOM,Ye as GLUED_STEM_MIN,Xe as HANGUL_MIN_STEM,be as HOST_SYNTHETIC_COLUMNS,Ie as HTTP_BODY_START_CHARS,Cn as IDENTIFIER_HEAD_INITIAL,bn as IDENTIFIER_UNFOLDED,hn as IDENTIFIER_WORDS,tn as INTENSIVE_SUFFIX_TOKENS,en as INTENSIVE_WORD_TOKENS,Wn as IndexedText,xt as LOOSE_KEY_MIN_LENGTH,_t as LooseIndex,wn as MAX_RUN_BOUNDS,Cr as OAUTH_SIGNED_OUT,hr as OAUTH_TOKEN_EXPIRED,Ct as PERIOD_CODE_FORMS,ht as PERIOD_CODE_MEMBERS,bt as PERIOD_ORDINALS,Et as PERIOD_UNFOLDED,rn as POSITIONAL_SUFFIX_TOKENS,nn as POSITIONAL_WORD_TOKENS,Hn as PREVIEW_OMITTED_FIELDS,we as PROGRESS_STAGE_IDS,vr as QUALIFY_ORDER_LABELS,M as ROLE_MATCH_PCT,vn as SERIES_COMPLETENESS_MAX_LISTED,Pn as SERIES_COMPLETENESS_MIN_FILL,Ln as SERIES_KEY_MAX_DISTINCT,Fr as SEV_ERROR,Ir as SEV_INFO,Dr as SEV_USER_PRESENTED,Nr as SEV_WARNING,j as SIMPLE_STRING_HASH,tt as STR,Ze as SUBSTRING_MIN,Fe as SUPPORTED_LANGUAGES,De as SUPPORTED_LANGUAGE_CODES,Gr as TELEMETRY_TIMEOUT_DEV_MS,kr as TELEMETRY_TIMEOUT_MS,Ve as VOCABULARY_LANGUAGE_CODES,Ge as VOCABULARY_ONLY_LANGUAGES,mt as YEAR_WORDS,$ as admin1MatchPct,fn as allowedAggregations,br as answerIsRetryable,$t as buildGeoIsoColumn,kt as buildGeoPointColumns,pt as calendarWordIn,xr as capabilityFields,Vt as cityMatchPct,Gt as cityTagsFor,Gn as classifyAdditivity,qr as classifyDraw,mn as classifyForAggregation,Vn as classifyNumericValueNature,Dn as classifyTemporal,ln as codeNeedsLegacyAggNames,Tn as codeReadsColumn,Sn as codeReadsColumnsByRoleOrPosition,an as collapseRepeatedAggPrefix,Rn as columnsTheCodeReads,Kt as countryRegion,$r as createDrawLedger,to as createGenerateClient,Hr as createTelemetryClient,Er as credentialFields,Or as dataCompletenessFields,tr as dateLevelPart,nr as dateLevelYearAdmits,Yt as decimalSeparatorOf,pn as defaultAggregation,Qt as detectDecimalSeparator,jt as detectFormatSignature,Ut as detectGeo,Pt as detectOrdinalDomain,Fn as detectTextDatePattern,Wr as drawLocation,I as encodePayload,qn as engineTypeForSqlType,un as englishImplicitAggNames,se as eventLogLine,Rr as fetchFields,Br as fetchTransport,We as foldName,ar as freemiumColumnCapRefusal,Ee as freemiumColumnsOverCap,Te as freemiumDateHierarchyClauses,Qe as gluedPrefixStems,sr as guardColumnNames,Bn as gzipWireText,Je as hangulWordEndsWith,sn as hasDefaultAggPrefix,He as hasUnsegmentedScript,kn as hostAggHint,zn as ingest,gn as isAggregationAllowed,V as isBlankLike,At as isCityTableLoaded,z as isColumnContextRef,rt as isDeterministicRefusal,zr as isEventLogCode,Ft as isGeoPointAmbiguity,Nn as isIdentifierName,qt as isJoinGeoKind,Yn as isNdjsonContentType,Ot as isOrdinalFriendlyName,wt as isUsableLooseKey,jn as keyedSigner,_r as leafCardinalityField,ut as localMidnightDateColumns,lt as localMidnightToUtcDay,yt as localizedCycleIn,En as localizedIdentifierWordIn,gt as localizedYearWordIn,N as looksLikeCountryColumn,Rt as looseNameKey,et as matchNameToken,Sr as maxNonMeasureCardinality,On as measureCadence,In as measureSeriesCompleteness,D as messageSignature,ir as missingHardColumnRefs,Zt as monthLookupFor,$e as nameLetterRuns,dn as nameLooksIntensiveRate,cn as nameLooksPositional,he as nameProbeIsGuarded,or as nameProbeKeepsDrawing,qe as nameWords,Mt as normalizeCountry,ct as normalizeLocalMidnightDates,Jt as normalizeMonthKey,U as normalizePlaceName,Nt as normalizeZip5,Lr as offeredShortlistFor,$n as parseCsvRows,it as parseDateStable,cr as parseGenerateResponse,Xt as parseNumberText,dr as parseQualifyResponse,mr as parseReviewVerdict,_n as parseTemporalPoint,Kn as payloadPreview,St as periodCodeSeries,Mn as pickSeriesColumn,fr as progressStageOf,Un as promotesToMeasure,Pr as qualifyOrderField,Oe as qualifyOrderOf,J as readGenerateStream,ze as readName,Tt as readPeriodCode,E as readWireField,Lt as registerCityTable,Ht as registerIso3Regions,P as resolveAdmin1,_e as resolveFetchVersion,Dt as resolveGeoPoint,Ue as resolveLanguage,Jn as resolvePointRoles,wr as retryFields,vt as safeDistinctValuesToShip,Le as schemaIdentity,Mr as schemaIdentityKey,Pe as schemaTypeFamily,An as seriesKeyVerdict,yn as shareOfTotalIsHonest,ve as shortlistIsStale,on as stripHostAggPrefix,Bt as summarizeCountryRegions,zt as summarizeGeoExtent,ke as supportedLanguage,Wt as toGeoIso,Ke as unsegmentedRuns,Tr as viewportFields,B as vocabularyLanguage,st as wholeDayFrame,at as wholeDayIso,X as wireResponseFromFetch,je as wordEndsWith,re as zipMatchPct,q as zipPrefixCandidates,It as zipToPrefix3};
2
+ import{a as Xn,b as Jn}from"./chunk-HIVICMC5.mjs";import{a as Zn,b as I,c as er,d as D,e as E,f as tr,g as X,h as J}from"./chunk-4J7WPYLM.mjs";import{a as jn,b as Yn,c as Qn}from"./chunk-RI5BOXDB.mjs";import{A as vn,B as Pn,C as Ln,D as An,E as Mn,F as In,G as Nn,H as Fn,I as Dn,J as kn,K as Gn,L as Vn,M as Un,N as Wn,O as qn,P as $n,Q as zn,R as Hn,S as Kn,U as Bn,a as Qt,b as Xt,c as Jt,d as Zt,f as an,g as ln,h as un,i as cn,j as dn,k as mn,l as fn,m as pn,n as gn,o as yn,p as hn,q as Cn,r as bn,s as En,t as Tn,u as Sn,v as Rn,w as xn,x as wn,y as _n,z as On}from"./chunk-TXKQGWEI.mjs";import{a as en}from"./chunk-U3H6UBOO.mjs";import{b as tn,c as nn,d as rn,f as on,g as sn}from"./chunk-A4PQBWRA.mjs";import{a as le,b as ue,c as Kt,d as Bt,e as jt,f as Yt}from"./chunk-IPPPCWAK.mjs";import{a as M,b as V,c as Y,d as U,k as W,l as Dt,m as kt,n as ae,o as P,p as Gt,q as Vt,r as Ut,s as q,t as Wt,u as qt,v as $t,w as zt,x as Q,y as Ht}from"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import{a as ht,b as Ct,c as bt,d as Et,e as Tt,f as St,g as Rt,h as xt,i as wt,j as _t,k as Ot,l as vt,m as It,n as Nt,o as Ft}from"./chunk-HJA26Z2E.mjs";import{A as mt,B as ft,C as pt,D as gt,E as yt,a as qe,b as $e,c as ze,d as He,e as Ke,f as Be,g as je,h as Ye,i as Qe,j as Xe,k as Je,l as Ze,m as et,n as tt,o as nt,q as j,r as rt,s as ot,t as it,u as st,v as at,w as lt,x as ut,y as ct,z as dt}from"./chunk-CZJ7M6A5.mjs";import{a as De,b as ke,c as Ge,d as Ve,e as Ue,f as B,g as We}from"./chunk-WC4JINEZ.mjs";import{b as Pt,c as Lt,d as At,e as Mt}from"./chunk-5HI6TVMM.mjs";var Z=2,me=400;function te(e){return!!W(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=U(String(n));if(!V(o)&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||ne(e)<95)return!1;let n=t.filter(a=>te(a)&&!P(a)).length,o=t.filter(a=>!te(a)&&!!P(a)).length;return n>=1&&n>=o}function ce(e,t){if(!P(e))return!1;let n=W(e);return n?t==="world"?!0:ae.has(n):!1}function ne(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)te(o)&&n++;return Math.round(n/t.length*1e3)/10}function $(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)P(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!V(U(o))&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function re(e){let t=oe(e);if(t.length===0)return 0;let n=0;for(let o of t)q(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function de(e,t){return ue(t,le)?!0:oe(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function nr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)Q(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function ee(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function rr(e,t){let n=0;for(let o of oe(e))t(o)&&n++;return n}function or(e,t,n,o,a){let u=[],l=[],i={},C={},b=new Set(e),h=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&b.has(d)&&(i[s]=d)}let g=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&g.has(d)&&(i[s]=d)}let f=n?.zip;if(f&&b.has(f)){let s=h(f),d=re(s);d<95?l.push(`zip=${f} (only ${d}% of values read as ZIPs)`):de(s,f)?i.zip=f:l.push(`zip=${f} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&b.has(c)){let s=h(c),d=F(s);d.length>0&&d.every(S=>ce(S,o))?l.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(l.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):$(s)<95?l.push(`state=${c} (only ${$(s)}% of values are states/provinces)`):i.state=c}let p=new Set(Object.values(i).filter(Boolean)),y=e.filter(s=>!p.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of y){let S=h(d);if(N(S))continue;let O=$(S);if(O<95)continue;let K=ee(S,G=>!!P(G)),Fe=ee(S,G=>!!P(G)&&!ce(G,o));K<Z&&Fe<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,p.add(s.name),u.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of y){if(p.has(s))continue;let d=h(s),S=re(d);if(!(S<95)&&de(d,s)&&!(rr(d,O=>q(O).length>0)<Z)){i.zip=s,p.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(h(T))){let s=null;for(let d of y){if(p.has(d)||!N(h(d)))continue;let S=ne(h(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${ne(h(T))}% of values are country identifiers; using ${s.name} instead)`),C.country=T),i.country=s.name,p.add(s.name),u.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of y){if(p.has(d))continue;let S=h(d),O=nr(S,o);O<Y||ee(S,K=>Q(K,o))<Z||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let L=i.country?h(i.country):[],R=!!i.country&&N(L),A=R?new Set(L.map(s=>W(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&A>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&l.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&l.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:u,refused:l,...Object.keys(C).length?{labelFallback:C}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ie=Object.freeze({jaar:r("year","nl"),kwartaal:r("quarter","nl"),maand:r("month","nl"),dag:r("day","nl","sv","da","nb"),jahr:r("year","de"),quartal:r("quarter","de"),monat:r("month","de"),tag:r("day","de"),ann\u00E9e:r("year","fr"),mois:r("month","fr"),jour:r("day","fr"),trimestre:r("quarter","fr","es","pt","it"),a\u00F1o:r("year","es"),mes:r("month","es"),d\u00EDa:r("day","es"),ano:r("year","pt"),m\u00EAs:r("month","pt"),dia:r("day","pt"),anno:r("year","it"),mese:r("month","it"),giorno:r("day","it"),\u0433\u043E\u0434:r("year","ru"),\u043C\u0435\u0441\u044F\u0446:r("month","ru"),\u0440\u0456\u043A:r("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:r("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:r("quarter","ru","uk"),\u0434\u0435\u043D\u044C:r("day","ru","uk"),rok:r("year","pl","cs","sk"),kwarta\u0142:r("quarter","pl"),miesi\u0105c:r("month","pl"),dzie\u0144:r("day","pl"),\u010Dtvrtlet\u00ED:r("quarter","cs"),m\u011Bs\u00EDc:r("month","cs"),den:r("day","cs"),\u0161tvr\u0165rok:r("quarter","sk"),mesiac:r("month","sk"),de\u0148:r("day","sk"),\u00E5r:r("year","sv","da","nb"),kvartal:r("quarter","sv","da","nb"),m\u00E5nad:r("month","sv"),m\u00E5ned:r("month","da","nb"),vuosi:r("year","fi"),vuosinelj\u00E4nnes:r("quarter","fi"),kuukausi:r("month","fi"),p\u00E4iv\u00E4:r("day","fi"),\u00E9v:r("year","hu"),negyed\u00E9v:r("quarter","hu"),h\u00F3nap:r("month","hu"),nap:r("day","hu"),y\u0131l:r("year","tr"),\u00E7eyrek:r("quarter","tr"),ay:r("month","tr"),g\u00FCn:r("day","tr"),\u03AD\u03C4\u03BF\u03C2:r("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:r("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:r("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:r("day","el"),an:r("year","ro"),trimestru:r("quarter","ro"),lun\u0103:r("month","ro"),zi:r("day","ro"),godina:r("year","hr"),tromjese\u010Dje:r("quarter","hr"),mjesec:r("month","hr"),dan:r("day","hr"),\u5E74:r("year","ja","zh"),\u56DB\u534A\u671F:r("quarter","ja"),\u5B63\u5EA6:r("quarter","zh"),\u6708:r("month","ja","zh"),\u65E5:r("day","ja","zh"),\uC5F0\uB3C4:r("year","ko"),\uBD84\uAE30:r("quarter","ko"),\uC6D4:r("month","ko"),\uC77C:r("day","ko"),tahun:r("year","id"),kuartal:r("quarter","id"),triwulan:r("quarter","id"),bulan:r("month","id"),hari:r("day","id"),n\u0103m:r("year","vi"),qu\u00FD:r("quarter","vi"),th\u00E1ng:r("month","vi"),ng\u00E0y:r("day","vi"),\u0E1B\u0E35:r("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:r("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:r("month","th"),\u0E27\u0E31\u0E19:r("day","th"),\u0627\u0644\u0633\u0646\u0629:r("year","ar"),\u0633\u0646\u0629:r("year","ar"),\u0627\u0644\u0639\u0627\u0645:r("year","ar"),\u0639\u0627\u0645:r("year","ar"),\u0627\u0644\u0631\u0628\u0639:r("quarter","ar"),\u0631\u0628\u0639:r("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":r("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:r("month","ar"),\u0634\u0647\u0631:r("month","ar"),\u0627\u0644\u064A\u0648\u0645:r("day","ar"),\u064A\u0648\u0645:r("day","ar"),\u05E9\u05E0\u05D4:r("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:r("quarter","he"),\u05D7\u05D5\u05D3\u05E9:r("month","he"),\u05D9\u05D5\u05DD:r("day","he"),\u0935\u0930\u094D\u0937:r("year","hi"),\u0938\u093E\u0932:r("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:r("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:r("month","hi"),\u092E\u093E\u0939:r("month","hi"),\u0926\u093F\u0928:r("day","hi"),\u0633\u0627\u0644:r("year","fa"),\u0645\u0627\u0647:r("month","fa"),\u0631\u0648\u0632:r("day","fa")}),ir=Object.freeze(Array.from(new Set(Object.values(ie).flatMap(e=>e.langs)))),fe=Object.freeze(["fa","ar","he","th"]),pe=1900,ge=2100;function sr(e,t){let n=[],o=B(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function ar(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of sr(n,t)){let a=ie[o];if(a&&a.langs.includes(t))return a.part}return null}function lr(e,t){return fe.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=pe&&t<=ge:!0}function ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var ur=/\b(?:columns|cols|column)\b/i;function z(e,t){let n=Math.max(0,t-240),o=e.slice(n,t),a=o.lastIndexOf(";");return a>=0&&(o=o.slice(a+1)),ur.test(o)}function he(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Ce(e,t,n){let o=ye(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${o}\2`,"g"),u=new RegExp(String.raw`\.name\s*===?\s*(['"])${o}\1`,"g"),l=0,i;for(;(i=u.exec(e))!==null;)z(e,i.index)&&l++;let C=0;for(;(i=a.exec(e))!==null;){let b=i.index+i[0].lastIndexOf(".name");if(!z(e,b))continue;C++;let h=ye(i[1]);if(!n(h))return!1}return C>0&&C===l}function cr(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var be=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function dr(e,t){if(!e)return[];let n=new Set(t);for(let i of be)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)z(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||he(e,i)||l.push(i)}),l}function mr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function Ee(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function fr(e,t,n){let o=Ee(e,t);if(o===null||o<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,u=o>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let l=u.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=Te(n);return i.length===0?l:l+" "+i.join(" ")}function Te(e){if(!e||e.length===0)return[];let t=[],n=new Map,o=new Map;for(let u of e){let l=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(l!==""&&(n.has(l)||(t.push(l),n.set(l,0)),u.isDatePart===!0&&n.set(l,n.get(l)+1),u.isReassembledDate===!0&&!o.has(l))){let i=typeof u.sourceField=="string"?u.sourceField.trim():"",C=typeof u.name=="string"?u.name.trim():"",b=i!==""?i:C;b!==""&&o.set(l,b)}}let a=[];for(let u of t){let l=o.get(u),i=n.get(u)??0;!l||i===0||a.push(`'${l}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var m=e=>e==null?"":String(e),v=e=>e===!0,Se=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},pr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Re(e,t){let n={};for(let[o,a]of pr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function gr(e){return Array.isArray(e)?e.map(t=>({code:m(E(t,"code")),severity:m(E(t,"severity")),text:m(E(t,"text"))})).filter(t=>t.text!==""):[]}function yr(e){let t=b=>E(e,b),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=Re(e,"point"),l=Re(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),C=t("isPollFinal");return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:gr(t("notices")),freemiumStatusCode:m(t("freemiumStatusCode")),code:m(t("code")),language:m(t("language")),version:Number(t("version")??0),codeSummary:m(t("codeSummary")),chartName:m(t("chartName")??t("chartType")),finalChartName:m(t("finalChartName")),warningMessage:m(t("warningMessage")),outputHash:m(t("outputHash")),validatorToken:m(t("validatorToken")),editCodeKey:m(t("editCodeKey")),signedLLMRequestID:m(t("signedLLMRequestID")),userReply:m(t("userReply")),userReplyOutcome:m(t("userReplyOutcome")),improvementSuggestion:m(t("improvementSuggestion")),geoColumn:m(t("geoColumn")),geoKind:m(t("geoKind")),geoPointCols:Object.keys(u).length?u:null,creditBalanceBefore:Se(t("creditBalanceBefore")),creditCost:Se(t("creditCost")),isServiceError:v(t("isServiceError")),isRateLimited:v(t("isRateLimited")),suppressSelectionGlyph:v(t("suppressSelectionGlyph")),isRefusal:v(t("isRefusal")),isVersionNotFound:v(t("isVersionNotFound")),isGenerationCancelled:v(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof C=="boolean"?{isPollFinal:C}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var xe=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function hr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=C=>E(u,C),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:xe(l("rank")),score:xe(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:v(l("isPreview")),alsoWorthALook:v(l("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:k(l("viaProjection")),viaProjectionKey:k(l("viaProjectionKey")),detailNote:k(l("detailNote"))}}).filter(u=>u.name):null,a=Array.isArray(n)?n.map(u=>({name:m(E(u,"chartTypeName")??E(u,"name")),reason:m(E(u,"reason")),reasonCode:m(E(u,"reasonCode")),isVeto:v(E(u,"isVeto"))})).filter(u=>u.name):[];return{errorMessage:m(E(e,"errorMessage")),errorCode:m(E(e,"errorCode")),charts:o,refused:a,noFitSummary:m(E(e,"noFitSummary"))}}function Cr(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var we=["working","analyze","generate","refine","review"];function br(e,t){let n=String(e??"").trim().toLowerCase();if(we.includes(n))return n;let o=String(t??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var Er="FREEMIUM_ATTEMPT_SPENT",Tr="CLIENT_SECRET_MISMATCH",Sr="FREEMIUM_COLUMN_CAP",Rr="OAUTH_TOKEN_EXPIRED",xr="OAUTH_SIGNED_OUT";function wr(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function _r(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,o=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:o.licenseKey,licensee:o.licensee,secretKey:o.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function Or(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function vr(e){let t=0;for(let n of e){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>t&&(t=o)}return t}function _e(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,o=(e.codeVersion??0)>0?e.codeVersion:null,a=n??o??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function Pr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=_e({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),u=e.fetchArmedAtMs,l=t&&typeof u=="number"&&Number.isSafeInteger(u)&&u>0?u:void 0;return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{}}}function Lr(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function Ar(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function Mr(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function Ir(e,t,n){let o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...o(t)?{rowsWithheld:t}:{},...o(n)?{rowsFilteredOut:n}:{}}}var Nr={fit:"Best fit",variety:"Something different"};function Oe(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function Fr(e){let t=Oe(e);return t?{qualifyOrder:t}:{}}function ve(e,t){return e!=null&&t!=null&&e!==t}function Dr(e,t){return e?ve(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var kr=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Pe(e){let t=String(e??"").trim().toLowerCase();return kr[t]??t}function Le(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Pe(n.dataType)]);return t}function Gr(e){return j(Le(e))}var Vr=2,Ur=3,Wr=4,qr=64,$r=8e3,zr=6e4,Hr=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),Kr=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function Br(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function jr(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function Yr(){let e=new Set,t=new Set;return{firstDraw(n,o){if(!n)return!1;let a=`${n}|${o}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function Qr(e){return!!e&&!e.includes("|")&&!e.includes(",")}function se(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function Xr(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=t.timeoutMs,C=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,b=g=>{try{t.onFailure?.(g)}catch{}},h=async(g,f,c,p)=>{let y;try{let T=await a.post(f,c,p,{timeoutMs:i});y=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){b({channel:g,stage:"post",status:null,error:T});return}(y<200||y>299)&&b({channel:g,stage:"status",status:y,error:null})};return{async sendClientMessage(g){let f,c,p;try{f=`${C()}${l}/LogClientMsg/?nocache=${u.now()}`,c=I(g),p=D(c,o)}catch(y){b({channel:"client-message",stage:"build",status:null,error:y});return}await h("client-message",f,c,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(g,f,c){let p,y;try{p=`${C()}${l}/eventlog`,y=se(g,t.clientVersion,f,c)}catch(T){b({channel:"event-count",stage:"build",status:null,error:T});return}await h("event-count",p,y,{"Content-Type":"text/plain"})}}}var Ae=2**31-1;function Me(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function Jr(e){return typeof e=="number"&&e>0&&e<=Ae?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Ae} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function Zr(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,o=t.credentials??"omit";return{async post(a,u,l,i){let C=i.timeoutMs,b=Jr(C);if(b)throw b;let h=new AbortController,g=!1,f=setTimeout(()=>{g=!0,h.abort(Me(C))},C),c=()=>h.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let p=!1,y=()=>{p||(p=!0,clearTimeout(f),i.signal?.removeEventListener("abort",c))},T=_=>g?Me(C):_,L;try{L=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:h.signal})}catch(_){throw y(),T(_)}let R=X(L),A=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...A,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{y()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){y(),_.close();return}_.enqueue(s.value)}catch(s){y(),_.error(T(s))}},cancel(_){return y(),x.cancel(_)}});return{status:R.status,...A,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var Ie=300;function Ne(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var eo="/LLMChart/",to="/LLMChart/qualify",no="/VisionReview/",ro="/LLMChart/sample",oo="/RefundGenerate/",io=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",H=async e=>JSON.parse(await e.text());function so(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function ao(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,C=g=>t.nocache?t.nocache(g):String(u.now());async function b(g,f,c,p,y){let T=`${i()}${l}${f}?nocache=${C(g)}`,L={"Content-Type":"text/plain","X-Signature":D(c,o)},R=p.signal??void 0,A=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&io(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,L,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return A(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)so(x);else try{w=(await x.text()).slice(0,Ie)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await y(x)}}catch(w){return A(!0,w)}}function h(g,f){if(!f||typeof f.timeoutMs!="number"||!Number.isFinite(f.timeoutMs)||f.timeoutMs<=0)throw new TypeError(`The ${g} call needs a positive deadline in milliseconds`);return f}return{async generate(g,f){let c=h("generate",f),p=c.onStage??void 0;return b("generate",eo,I(g),c,y=>J(y,p))},async qualify(g,f){let c=h("qualify",f),p=c.route??to;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return b("qualify",p,I(g),c,H)},async review(g,f){let c=h("review",f),p=JSON.stringify(g);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return b("review",no,p,c,H)},async sample(g,f){let c=h("sample",f);return b("sample",ro,I(g),c,H)},async refund(g,f,c){let p=h("refund",f);if(typeof g!="string"||g.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let y=Ne(c),T=y?{CorrelationID:g.trim(),Reason:y}:{CorrelationID:g.trim()};return b("refund",oo,JSON.stringify(T),p,H)}}}export{Y as CITY_ROLE_MATCH_PCT,Hr as CLIENT_EVENT_KINDS,Tr as CLIENT_SECRET_MISMATCH,je as COMPOUND_MIN_STEM,ht as CYCLE_MEMBERS,bt as CYCLE_WORDS,ge as DATE_LEVEL_GREGORIAN_YEAR_MAX,pe as DATE_LEVEL_GREGORIAN_YEAR_MIN,ir as DATE_LEVEL_LANGUAGES,ie as DATE_LEVEL_NAMES,fe as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Ln as DEFAULT_GAP_FACTOR,it as DEFAULT_TEMPERATURE,Kr as DRAW_REASONS,Er as FREEMIUM_ATTEMPT_SPENT,Sr as FREEMIUM_COLUMN_CAP,rt as GET_RANDOM,Qe as GLUED_STEM_MIN,Je as HANGUL_MIN_STEM,be as HOST_SYNTHETIC_COLUMNS,Ie as HTTP_BODY_START_CHARS,xn as IDENTIFIER_HEAD_INITIAL,wn as IDENTIFIER_UNFOLDED,Rn as IDENTIFIER_WORDS,ln as INTENSIVE_SUFFIX_TOKENS,an as INTENSIVE_WORD_TOKENS,Bn as IndexedText,Lt as LOOSE_KEY_MIN_LENGTH,Mt as LooseIndex,An as MAX_RUN_BOUNDS,xr as OAUTH_SIGNED_OUT,Rr as OAUTH_TOKEN_EXPIRED,xt as PERIOD_CODE_FORMS,Rt as PERIOD_CODE_MEMBERS,wt as PERIOD_ORDINALS,_t as PERIOD_UNFOLDED,cn as POSITIONAL_SUFFIX_TOKENS,un as POSITIONAL_WORD_TOKENS,Xn as PREVIEW_OMITTED_FIELDS,we as PROGRESS_STAGE_IDS,Nr as QUALIFY_ORDER_LABELS,M as ROLE_MATCH_PCT,Nn as SERIES_COMPLETENESS_MAX_LISTED,Fn as SERIES_COMPLETENESS_MIN_FILL,Dn as SERIES_KEY_MAX_DISTINCT,Wr as SEV_ERROR,Vr as SEV_INFO,qr as SEV_USER_PRESENTED,Ur as SEV_WARNING,j as SIMPLE_STRING_HASH,nt as STR,et as SUBSTRING_MIN,De as SUPPORTED_LANGUAGES,ke as SUPPORTED_LANGUAGE_CODES,zr as TELEMETRY_TIMEOUT_DEV_MS,$r as TELEMETRY_TIMEOUT_MS,Ue as VOCABULARY_LANGUAGE_CODES,Ve as VOCABULARY_ONLY_LANGUAGES,Ct as YEAR_WORDS,$ as admin1MatchPct,bn as allowedAggregations,gt as anchorLocalWallClockDates,wr as answerIsRetryable,Yt as buildGeoIsoColumn,$t as buildGeoPointColumns,Et as calendarWordIn,Lr as capabilityFields,Ht as cityMatchPct,zt as cityTagsFor,zn as classifyAdditivity,jr as classifyDraw,Cn as classifyForAggregation,Hn as classifyNumericValueNature,qn as classifyTemporal,pn as codeNeedsLegacyAggNames,On as codeReadsColumn,vn as codeReadsColumnsByRoleOrPosition,fn as collapseRepeatedAggPrefix,Pn as columnsTheCodeReads,Jt as countryRegion,Yr as createDrawLedger,ao as createGenerateClient,Xr as createTelemetryClient,_r as credentialFields,Ir as dataCompletenessFields,ar as dateLevelPart,lr as dateLevelYearAdmits,yt as datesAreTimeOfDayOnly,ft as datesCarryTimeOfDay,tn as decimalSeparatorOf,En as defaultAggregation,nn as detectDecimalSeparator,en as detectFormatSignature,Kt as detectGeo,Ft as detectOrdinalDomain,Wn as detectTextDatePattern,Br as drawLocation,I as encodePayload,jn as engineTypeForSqlType,gn as englishImplicitAggNames,se as eventLogLine,Pr as fetchFields,Zr as fetchTransport,qe as foldName,fr as freemiumColumnCapRefusal,Ee as freemiumColumnsOverCap,Te as freemiumDateHierarchyClauses,Xe as gluedPrefixStems,mr as guardColumnNames,Zn as gzipWireText,Ze as hangulWordEndsWith,mn as hasDefaultAggPrefix,Ke as hasUnsegmentedScript,$n as hostAggHint,Qn as ingest,Tn as isAggregationAllowed,V as isBlankLike,kt as isCityTableLoaded,z as isColumnContextRef,ot as isDeterministicRefusal,Qr as isEventLogCode,Wt as isGeoPointAmbiguity,Un as isIdentifierName,jt as isJoinGeoKind,tr as isNdjsonContentType,It as isOrdinalFriendlyName,At as isUsableLooseKey,er as keyedSigner,Mr as leafCardinalityField,ct as localMidnightDateColumns,ut as localMidnightToUtcDay,pt as localWallClockDateColumns,St as localizedCycleIn,_n as localizedIdentifierWordIn,Tt as localizedYearWordIn,N as looksLikeCountryColumn,Pt as looseNameKey,tt as matchNameToken,vr as maxNonMeasureCardinality,In as measureCadence,Vn as measureSeriesCompleteness,D as messageSignature,dr as missingHardColumnRefs,sn as monthLookupFor,ze as nameLetterRuns,hn as nameLooksIntensiveRate,yn as nameLooksPositional,he as nameProbeIsGuarded,cr as nameProbeKeepsDrawing,$e as nameWords,Gt as normalizeCountry,dt as normalizeLocalMidnightDates,on as normalizeMonthKey,U as normalizePlaceName,Ut as normalizeZip5,Dr as offeredShortlistFor,Yn as parseCsvRows,st as parseDateStable,yr as parseGenerateResponse,rn as parseNumberText,hr as parseQualifyResponse,Cr as parseReviewVerdict,Mn as parseTemporalPoint,Jn as payloadPreview,vt as periodCodeSeries,Gn as pickSeriesColumn,br as progressStageOf,Kn as promotesToMeasure,Fr as qualifyOrderField,Oe as qualifyOrderOf,J as readGenerateStream,He as readName,Ot as readPeriodCode,E as readWireField,Ne as refundReasonCode,Dt as registerCityTable,Xt as registerIso3Regions,P as resolveAdmin1,_e as resolveFetchVersion,qt as resolveGeoPoint,We as resolveLanguage,or as resolvePointRoles,Ar as retryFields,Nt as safeDistinctValuesToShip,Le as schemaIdentity,Gr as schemaIdentityKey,Pe as schemaTypeFamily,kn as seriesKeyVerdict,Sn as shareOfTotalIsHonest,ve as shortlistIsStale,dn as stripHostAggPrefix,Zt as summarizeCountryRegions,Qt as summarizeGeoExtent,Ge as supportedLanguage,Bt as toGeoIso,Be as unsegmentedRuns,mt as utcWallClock,Or as viewportFields,B as vocabularyLanguage,at as wholeDayFrame,lt as wholeDayIso,X as wireResponseFromFetch,Ye as wordEndsWith,re as zipMatchPct,q as zipPrefixCandidates,Vt as zipToPrefix3};
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{M as a,N as b,O as c,P as d,Q as e,R as f,S as g,T as h,U as i}from"./chunk-TBH5LFYH.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-QPIKC2O6.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-IIGGO4ES.mjs";import"./chunk-NT6CDI3K.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,g as promotesToMeasure,h as trimmedCells};
2
+ import{M as a,N as b,O as c,P as d,Q as e,R as f,S as g,T as h,U as i}from"./chunk-TXKQGWEI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-IPPPCWAK.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-HJA26Z2E.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,g as promotesToMeasure,h as trimmedCells};
package/dist/ingest.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a,b,c}from"./chunk-ZKRTZ3TY.mjs";import"./chunk-TBH5LFYH.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-QPIKC2O6.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-IIGGO4ES.mjs";import"./chunk-NT6CDI3K.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
2
+ import{a,b,c}from"./chunk-RI5BOXDB.mjs";import"./chunk-TXKQGWEI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-IPPPCWAK.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-HJA26Z2E.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
@@ -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{m as a,n as b,o as c}from"./chunk-IIGGO4ES.mjs";import"./chunk-NT6CDI3K.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{c as detectOrdinalDomain,a as isOrdinalFriendlyName,b as safeDistinctValuesToShip};
2
+ import{m as a,n as b,o as c}from"./chunk-HJA26Z2E.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.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 A,h as g}from"./chunk-QMVECPSM.mjs";import"./chunk-NT6CDI3K.mjs";import"./chunk-WC4JINEZ.mjs";var $=class extends Error{contract;failures;constructor(e,s){super(`${e} conformance failed:
2
+ import{f as A,h as g}from"./chunk-4J7WPYLM.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";var $=class extends Error{contract;failures;constructor(e,s){super(`${e} conformance failed:
3
3
  - ${s.join(`
4
4
  - `)}`),this.name="ConformanceError",this.contract=e,this.failures=s}},k=class{constructor(e){this.contract=e}contract;failures=[];check(e,s){e||this.failures.push(s)}fail(e){this.failures.push(e)}throwIfFailed(){if(this.failures.length)throw new $(this.contract,this.failures.slice())}},v="H4sIAAAAAAAAA6tWyk0tSs5ITUxRslIqS8wpTVWqBQBL0RbkEwAAAA==",E="H4sIAAAAAAAAA6tWSkksSVSyUsrMyyrKz1OqBQBVrD9YEAAAAA==";function h(n){return n instanceof Error?`${n.name}: ${n.message}`:String(n)}function T(n){return n&&typeof n=="object"&&typeof n.name=="string"?n.name:""}function j(n){let e=new k("WireSigner");(!n||typeof n.sign!="function")&&(e.fail("the signer has no sign() method"),e.throwIfFailed());let s,d,l;try{s=n.sign(v),d=n.sign(v),l=n.sign(E)}catch(r){e.fail(`sign() threw on an ordinary encoded body: ${h(r)}`),e.throwIfFailed()}e.check(typeof s=="string",`sign() returned ${typeof s}, not a string`),e.check(typeof s!="string"||s.trim()!=="","sign() returned a blank signature"),e.check(s===d,"sign() is not deterministic: the same body signed twice gave two signatures"),e.check(s!==l,"sign() gave two different bodies the same signature"),e.throwIfFailed()}async function q(n){let e=new k("WireResponse"),s=new TextEncoder,d=[`{"type":"progress","stage":"Reading your data"}
5
5
  `,`{"type":"result","result":{"code":"x","version":2}}
@@ -165,6 +165,19 @@ export declare function codeNeedsLegacyAggNames(code: string | null | undefined,
165
165
  * that reads it (IndexedText.aliasesForCode), which is what keeps a wrong split harmless.
166
166
  */
167
167
  export declare function englishImplicitAggNames(queryName: string | null | undefined): string[];
168
+ /**
169
+ * True when an English name recomposed from `queryName` must NOT be armed on a column whose live
170
+ * display name is `liveName` and whose type is `liveDataType`. An aggregation switch keeps the
171
+ * query name, so the query name can spell a function the column no longer holds; two signs say so
172
+ * without any history:
173
+ * - the live name is itself the English label of ANOTHER function over the same column
174
+ * (`Average of X` against `Count(T.X)`);
175
+ * - the type contradicts the function: a count is a whole number, so a Decimal column never holds one.
176
+ * A live name in another language says nothing here - that is the case the English alias exists
177
+ * for. A switch made under a localized name is the host's to catch from its own session history
178
+ * (by withholding that column's query name from setHostQueryNames).
179
+ */
180
+ export declare function englishAggAliasContradicted(queryName: string | null | undefined, liveName: string | null | undefined, liveDataType: string | null | undefined): boolean;
168
181
  /** Does this column NAME read as a coordinate? */
169
182
  export declare function nameLooksPositional(name: string | null | undefined): boolean;
170
183
  /** Does this column NAME read as an intensive rate — a quantity a SUM would corrupt?
@@ -92,9 +92,21 @@ export interface GenerateClient {
92
92
  * host gives up on a generation that never reached its reader; the service decides what, if anything,
93
93
  * is refunded (it may hold the refund until the generation is recorded, and declines a delivered chart).
94
94
  * The answer is the parsed JSON body.
95
+ *
96
+ * `reason` is the host's own code for why it gave up (refundReasonCode), sent as `Reason` so the service
97
+ * can record why the row was refunded. The service maps a code to its own reason; an unknown code, or
98
+ * none, reads as a plain client request. Omitted (or blank after cleaning), the body is the old one.
95
99
  */
96
- refund(correlationId: string, opts: WireCallOptions): Promise<WireOutcome<unknown>>;
100
+ refund(correlationId: string, opts: WireCallOptions, reason?: string | null): Promise<WireOutcome<unknown>>;
97
101
  }
102
+ /**
103
+ * A host's refund reason as it goes on the wire: lower case, letters, digits and hyphens only, at most 40
104
+ * characters (`"" ` when nothing is left). The codes the hosts send today: `client-retries-exhausted`,
105
+ * `schema-change-blocked-incompatible`, `modify-failed-keep-chart`, and `recovery-<step>`. The mapping from
106
+ * a code to a recorded reason lives in the service only, so an old client and a new code stay classifiable
107
+ * by a service change alone.
108
+ */
109
+ export declare function refundReasonCode(reason: unknown): string;
98
110
  /**
99
111
  * Build a generate client over the host's services. A missing service or an unusable setting is a
100
112
  * TypeError here, at construction, never a fallback at the first call.
@@ -14,7 +14,7 @@ export { ROLE_MATCH_PCT, CITY_ROLE_MATCH_PCT, isBlankLike } from "./matchQuality
14
14
  export { detectOrdinalDomain, safeDistinctValuesToShip, isOrdinalFriendlyName } from "./ordinalDetector";
15
15
  export { detectFormatSignature } from "./formatDetector";
16
16
  export { parseDateStable, wholeDayFrame, wholeDayIso } from "./util";
17
- export { localMidnightToUtcDay, localMidnightDateColumns, normalizeLocalMidnightDates } from "./util";
17
+ export { localMidnightToUtcDay, localMidnightDateColumns, normalizeLocalMidnightDates, utcWallClock, datesCarryTimeOfDay, localWallClockDateColumns, anchorLocalWallClockDates, datesAreTimeOfDayOnly } from "./util";
18
18
  export { detectGeo, toGeoIso, buildGeoIsoColumn, isJoinGeoKind } from "./geoDetector";
19
19
  export type { GeoKind, GeoDetectionResult, GeoIsoColumn } from "./geoDetector";
20
20
  export { summarizeGeoExtent, summarizeCountryRegions, countryRegion, registerIso3Regions } from "./geoExtent";
@@ -67,5 +67,5 @@ export { createTelemetryClient } from "./telemetryClient";
67
67
  export type { TelemetryClient, TelemetryServices, TelemetryEnv, TelemetryFailure, TelemetryChannel } from "./telemetryClient";
68
68
  export { fetchTransport } from "./fetchTransport";
69
69
  export type { FetchFunction, FetchTransportOptions } from "./fetchTransport";
70
- export { createGenerateClient, HTTP_BODY_START_CHARS } from "./generateClient";
70
+ export { createGenerateClient, HTTP_BODY_START_CHARS, refundReasonCode } from "./generateClient";
71
71
  export type { GenerateClient, GenerateClientServices, GenerateClientEnv, GenerateCall, WireOutcome, AnswerOutcome, HttpOutcome, TransportOutcome, WireCallOptions, GenerateCallOptions, QualifyCallOptions, } from "./generateClient";
@@ -82,6 +82,7 @@ export interface IValueCollection {
82
82
  toObjectArray(): Record<string, any>[];
83
83
  getOriginalRowIndex(i: number): number;
84
84
  emitLegacyAggAliases?: boolean;
85
+ dateCellsAreLocalWallClock?: boolean;
85
86
  setHostQueryNames?(names: ReadonlyArray<string | null | undefined> | null | undefined): void;
86
87
  aliasesForCode?(code: string | null | undefined): ColumnNameAlias[];
87
88
  armAliasesForCode?(code: string | null | undefined): ColumnNameAlias[];
@@ -150,6 +151,16 @@ export declare class IndexedText implements IValueCollection {
150
151
  * regenerating any one of them stops the flag ever being set for it again.
151
152
  */
152
153
  emitLegacyAggAliases: boolean;
154
+ /**
155
+ * SET BY A HOST WHOSE DATE CELLS ARE THE READER'S LOCAL WALL CLOCK (a Power BI date-time field). When on, every date
156
+ * column that carries a time of day (datesCarryTimeOfDay over the whole column) is profiled - bounds, distinct keys,
157
+ * cadence - and written to CSV at its UTC wall clock (utcWallClock), so what the server reads names the reader's own
158
+ * times. The rows themselves are untouched: toObjectArray still hands out the host's Dates, and each renderer decides
159
+ * (chart-host's payload option localWallClock, gated on whether the chart reads local time). Whole-day columns are never
160
+ * affected. Off by default: a host that builds Dates in UTC (Excel serials) must leave it off.
161
+ */
162
+ dateCellsAreLocalWallClock: boolean;
163
+ private wallClockColumnIndexes;
153
164
  private STR;
154
165
  private getPrecision;
155
166
  getColumns(): LLMColumnWithValue[];
@@ -101,6 +101,7 @@ export type LLMColumnWithValue = {
101
101
  avgLength?: number;
102
102
  modelFormat?: string;
103
103
  dateWithTime?: boolean;
104
+ timeOfDayOnly?: boolean;
104
105
  isMeasure: boolean;
105
106
  numericPrecision?: number;
106
107
  topCategories?: number[];
@@ -152,3 +152,44 @@ export declare function normalizeLocalMidnightDates<T extends Record<string, any
152
152
  rows: T[];
153
153
  columns: string[];
154
154
  };
155
+ /**
156
+ * The instant whose UTC fields read what `d`'s LOCAL fields read: the reader's wall-clock time re-anchored to UTC. A host
157
+ * whose Dates are the reader's local wall clock (a Power BI date-time field) otherwise serializes the UTC instant of that wall
158
+ * clock, and a chart that reads in UTC - the render contract - prints every time shifted by the reader's offset (for a
159
+ * time-only value on its 1899-12-30 base, by that zone's local mean time offset). Years 0-99 are kept as written, as
160
+ * localMidnightToUtcDay does.
161
+ */
162
+ export declare function utcWallClock(d: Date): Date;
163
+ /** True when every non-empty value is a valid Date and at least one carries a time of day in BOTH frames (wholeDayFrame
164
+ * null). Decided over the whole column, so a timed column's midnight values move with the rest of it. */
165
+ export declare function datesCarryTimeOfDay(values: Iterable<any>): boolean;
166
+ /**
167
+ * WHICH DATE COLUMNS CARRY A TIME OF DAY ON THE READER'S LOCAL CLOCK. Only for a host whose Dates ARE local wall clock; a
168
+ * host that builds Dates in UTC (an Excel serial) must never call it. A date- or time-typed column qualifies when
169
+ * datesCarryTimeOfDay holds. Disjoint from localMidnightDateColumns, which takes whole-day columns only. In a UTC+0 browser
170
+ * the anchoring is the identity.
171
+ */
172
+ export declare function localWallClockDateColumns(columns: ReadonlyArray<{
173
+ name: string;
174
+ dataType?: string | null;
175
+ }>, rows: ReadonlyArray<Record<string, any> | null | undefined>): string[];
176
+ /** The rows with every Date in localWallClockDateColumns replaced by utcWallClock of it. Rows are shallow-copied only when
177
+ * a column changes; the input is never mutated; when nothing qualifies the SAME array comes back. */
178
+ export declare function anchorLocalWallClockDates<T extends Record<string, any>>(columns: ReadonlyArray<{
179
+ name: string;
180
+ dataType?: string | null;
181
+ }>, rows: T[]): {
182
+ rows: T[];
183
+ columns: string[];
184
+ };
185
+ /**
186
+ * A TIME OF DAY WITH NO DATE. Power BI's Time type and an Excel cell formatted as a time both hold a clock reading on the
187
+ * spreadsheet epoch's day zero, 1899-12-30; the date part is a storage artifact, never a day anyone observed. A chart that
188
+ * draws such a column on a dated axis invents the date, and a span read off it (a "gap" between days) is not in the data.
189
+ *
190
+ * True when every non-empty value is a valid Date on 1899-12-30 and at least one carries a time of day. The day is read
191
+ * at the UTC wall clock: an Excel serial is built there, and a Power BI Date is re-anchored there first (utcWallClock,
192
+ * IndexedText.dateCellsAreLocalWallClock). Reading the local clock as well would let a column that spans two days pass
193
+ * in a zone that folds them into one, so a host's Dates must be on the UTC wall clock before this is asked.
194
+ */
195
+ export declare function datesAreTimeOfDayOnly(values: Iterable<any>): 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{b as a,o as b,p as c,q as d,r as e,s as f,t as g,u as h,v as i,w as j,x as k,y as l,z as m}from"./chunk-NT6CDI3K.mjs";import"./chunk-WC4JINEZ.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};
2
+ import{A as n,B as o,C as p,D as q,E as r,b as a,o as b,p as c,q as d,r as e,s as f,t as g,u as h,v as i,w as j,x as k,y as l,z as m}from"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";export{g as DEFAULT_TEMPERATURE,e as GET_RANDOM,d as SIMPLE_STRING_HASH,b as STR,q as anchorLocalWallClockDates,r as datesAreTimeOfDayOnly,o as datesCarryTimeOfDay,f as isDeterministicRefusal,l as localMidnightDateColumns,k as localMidnightToUtcDay,p as localWallClockDateColumns,a as nameWords,m as normalizeLocalMidnightDates,h as parseDateStable,c as quantileSorted,n as utcWallClock,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.95",
3
+ "version": "0.6.97",
4
4
  "description": "Host-agnostic data-shape profiler: ingest a dataset's rows through IValueCollection.addRow and read back the measured shape as an LLMColumnWithValue[] payload — types, cardinality, temporal/ordinal detection, geographic region and point resolution, cross-column signals. MEASUREMENT only: the policy that decides what a measured shape means for chart selection lives server-side.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{f as a}from"./chunk-WC4JINEZ.mjs";var d={\u0142:"l",\u0141:"L",\u0131:"i",\u00F8:"o",\u00D8:"O",\u0111:"d",\u0110:"D",\u00F0:"d",\u00D0:"D"},m=[1632,1776,2406,3664,65296],x=/[\u0300-\u036F]/g;function h(n){let e=d[n];if(e)return e;let t=n.codePointAt(0);for(let o of m)if(t>=o&&t<=o+9)return String.fromCharCode(48+t-o);if(t>=65313&&t<=65338||t>=65345&&t<=65370)return String.fromCharCode(t-65248);let r=n.normalize("NFD").replace(x,"");return r.length===1?r:n}function c(n){if(!n)return n??"";let e="";for(let t of n)e+=h(t);return e}var F=/([\p{Ll}\p{Nd}])(\p{Lu})/gu,S=/[_\-./]+/g,N=/[^\p{L}\p{M}\p{N}\x00-\x7F]/gu;function f(n){return n?String(n).normalize("NFC").replace(F,"$1 $2").replace(S," ").replace(N," ").toLowerCase().split(/\s+/).filter(e=>e.length>0):[]}function z(n,e={}){if(!n)return[];let t=String(n).normalize("NFC");return e.camel&&(t=t.replace(F,"$1 $2")),t.toLowerCase().split(/[^\p{L}\p{M}]+/u).filter(r=>r.length>0)}function T(n){let e=f(n),t=f(c(String(n??"").normalize("NFC")));return{words:e,folded:t.length===e.length?t:e.map(c)}}var y=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]/u,C=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\u30FC]+/gu;function D(n){return!!n&&y.test(n)}function E(n){return n?String(n).normalize("NFC").match(C)??[]:[]}var M=3;function p(n,e,t=M){return!n||!e||n.length<=e.length||!n.endsWith(e)?!1:Array.from(n.slice(0,n.length-e.length)).length>=t}var R=2;function b(n,e){let t=a(e);if(!n||!t||t.gluedPrefixes.length===0)return[];let r=[];for(let o of[...t.gluedPrefixes].sort((i,l)=>l.length-i.length))if(n.length>o.length&&n.startsWith(o)){let i=n.slice(o.length);Array.from(i).length>=R&&!r.includes(i)&&r.push(i)}return r}var _=2,A=/\p{Script=Hangul}/u;function I(n,e){return!n||!e||!A.test(e)?!1:p(n,e,_)}var L=2;function V(n,e,t){if(!n||!e)return null;let r=a(t);if(!r)return null;let o=e.normalize("NFC").toLowerCase();if(D(o))return Array.from(o).length<L?null:E(n).some(u=>u.includes(o))?"substring":null;let i=T(n),l=r.foldSensitive?i.words:i.folded,s=r.foldSensitive?o:c(e.normalize("NFC")).toLowerCase();return l.includes(s)?"word":r.compounds&&l.some(u=>p(u,s))||l.some(u=>I(u,s))?"suffix":r.gluedPrefixes.length&&l.some(u=>b(u,r.code).includes(s))?"prefix":null}function W(n){return n!=null?n.toString():""}function Y(n,e){if(!n.length)return NaN;if(n.length===1)return n[0];let t=(n.length-1)*e,r=Math.floor(t),o=Math.ceil(t);return r===o?n[r]:n[r]+(n[o]-n[r])*(t-r)}function B(n){if(!n)return 0;let e=0xcbf29ce484222325n,t=0x100000001b3n,r=e;for(let o=0;o<n.length;o++)r^=BigInt(n.charCodeAt(o)),r=r*t&0xFFFFFFFFFFFFFFFFn;return Number(r&0x1FFFFFFFFFFFFFn)}function k(){let n=typeof globalThis<"u"?globalThis:{};if(n.crypto&&typeof n.crypto.getRandomValues=="function"){let e=new Uint32Array(1);return n.crypto.getRandomValues(e),e[0]/4294967296}return Math.floor(Date.now()%4294967295)/4294967296}function v(n){return!!n&&n.isRefusal===!0}var K=30;function Z(n){let e=Date.parse(n);if(isNaN(e))return null;let t=new Date(e);if(w.test(n)||H.test(n.trim())||G.test(n))return t;let r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())),o=t.getFullYear();return o>=0&&o<100&&r.setUTCFullYear(o),r}function g(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 q(n){let e=g(n);if(!e)return null;let t=n;if(e==="utc")return t.toISOString().slice(0,10);let r=o=>(o<10?"0":"")+o;return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}function U(n){let e=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())),t=n.getFullYear();return t>=0&&t<100&&e.setUTCFullYear(t),e}function O(n,e){let t=[];for(let r of n){if(!r||!/date|time/i.test(String(r.dataType??"")))continue;let o=0,i=!0;for(let l of e){let s=l?l[r.name]:void 0;if(s==null||s==="")continue;if(!(s instanceof Date)){i=!1;break}let u=g(s);if(u===null){i=!1;break}u==="local"&&o++}i&&o>0&&t.push(r.name)}return t}function X(n,e){let t=O(n,e);return t.length===0?{rows:e,columns:t}:{rows:e.map(o=>{if(!o)return o;let i={...o};for(let l of t){let s=i[l];s instanceof Date&&g(s)==="local"&&(i[l]=U(s))}return i}),columns:t}}var w=/^\s*\d{4}(-\d{2}(-\d{2})?)?\s*$/,H=/(?:Z|[+-]\d{2}:?\d{2})$/i,G=/\b(?:GMT|UTC)\b/i;export{c as a,f as b,z as c,T as d,D as e,E as f,M as g,p as h,R as i,b as j,_ as k,I as l,L as m,V as n,W as o,Y as p,B as q,k as r,v as s,K as t,Z as u,g as v,q as w,U as x,O as y,X as z};
@@ -1,2 +0,0 @@
1
- /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a as fe}from"./chunk-U3H6UBOO.mjs";import{a as rt,f as q,g as ge,h as ie,i as pe,j as ne}from"./chunk-A4PQBWRA.mjs";import{c as nt}from"./chunk-QPIKC2O6.mjs";import{f as et,k as tt}from"./chunk-INMDBTAR.mjs";import{e as Xe,k as me,m as qe,n as Je,o as de}from"./chunk-IIGGO4ES.mjs";import{a as ue,b as Q,c as We,d as ce,g as Ge,h as ze,j as $e,l as Ue,m as Ve,o as Ke,p as X,q as He,r as Ye,u as Me,w as je}from"./chunk-NT6CDI3K.mjs";import{c as Be,f as Ce}from"./chunk-WC4JINEZ.mjs";import{b as Ze,d as Qe}from"./chunk-5HI6TVMM.mjs";var Ut=[[24.4,49.4,-125,-66.9],[51.2,71.5,-168,-129.9],[18.9,22.3,-160.3,-154.8]],Vt=[7,72,-172,-52];function it(n,e,t){return n>=t[0]&&n<=t[1]&&e>=t[2]&&e<=t[3]}var J=n=>Math.round(n*10)/10;function ot(n,e=3){let t=[],s=[],r=0,i=0;for(let l of n){let a=l?.lat,g=l?.lon;if(typeof a!="number"||typeof g!="number"||!isFinite(a)||!isFinite(g)||a<-90||a>90||g<-180||g>180)continue;t.push(a),s.push(g);let d=l?.country?String(l.country).trim().toUpperCase():"",m=d?he(d):null;m?((d==="US"||d==="USA")&&r++,m==="north-america"&&i++):(Ut.some(u=>it(a,g,u))&&r++,it(a,g,Vt)&&i++)}let o=t.length;return o<e?null:(t.sort((l,a)=>l-a),s.sort((l,a)=>l-a),{pctUsa:J(r/o*100),pctNa:J(i/o*100),latP5:J(X(t,.05)),latP95:J(X(t,.95)),lonP5:J(X(s,.05)),lonP95:J(X(s,.95)),n:o})}var st={"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"},se=(()=>{let n=new Map;for(let e of Object.keys(st))for(let t of st[e].split(/\s+/))t&&n.set(t,e);return n})();function Kt(n){for(let[e,t]of n){let s=se.get(e);s&&!se.has(t)&&se.set(t,s)}}Kt(et);function he(n){if(!n)return null;let e=String(n).trim().toUpperCase();if(!e)return null;let t=se.get(e);if(t)return t;let s=tt(String(n));return s?se.get(s)??null:null}function Zr(n,e=2){return Te(n.map(t=>[t,1]),e)}function Te(n,e=2){let t=new Map,s=0;for(let[o,l]of n){let a=he(o);if(!a)continue;let g=typeof l=="number"&&isFinite(l)&&l>0?l:1;t.set(a,(t.get(a)??0)+g),s+=g}if(s<e||!t.size)return null;let r="europe",i=-1;for(let o of Array.from(t.keys()).sort()){let l=t.get(o);l>i&&(r=o,i=l)}return{dominantGeoRegion:r,dominantGeoRegionPct:J(i/s*100),regionCount:t.size,n:s}}function Ie(n){let e=(n||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var we={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},Ht=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,Yt=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,jt=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,Xt=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,Zt=new Set(["de","del","of"]),Qt=new Set(["\u0433","\u0440","r"]),qt=/^[\p{L}\p{M}\u0970\u05f3]+$/u,Re=/^\d+$/;function Jt(n){let e=+n[1],t=+n[2],s=n[3]===void 0?0:+n[3],r=n[4]!==void 0;if(t>59||s>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(n[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:t,s,seconds:n[3]!==void 0,meridiem:r}}function at(n){let e=n.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=rt(e);let t=null,s=Ht.exec(e);if(s){if(t=Jt(s),!t)return null;e=e.slice(0,s.index)}let r;if(r=jt.exec(e)){let u=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...we,form:"cjk",key:u,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=Yt.exec(e)){let u=r[2],_=r[4];if(u!==_)return null;let M=u.trim(),I=r[6];if(I&&M!==".")return null;let A=[r[1].length,r[3].length,r[5].length],p=A[0]===4,f=A[2]===4;return p===f||(p?A[1]>2||A[2]>2:A[0]>2||A[1]>2)?null:p&&M==="-"&&u==="-"&&A[1]===2&&A[2]===2?"iso":p&&M==="."&&u==="."&&!I&&!(A[1]===2&&A[2]===2)?null:{...we,form:"numeric",key:`num|${p?"y":"x"}|${u}|${I}`,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:p,sep:u,trail:I}}let i=e.replace(Xt,"$1").split(/[\s.,/-]+/).filter(u=>u!==""&&!Zt.has(u.toLowerCase()));if(i.length===4&&Re.test(i[2])&&Qt.has(i[3].toLowerCase())&&i.pop(),i.length!==3)return null;let o=i.map(u=>Re.test(u)?"N":qt.test(u)?"W":"?").join(""),l=i.map(u=>Re.test(u)?u:""),a=0,g=0,d="",m;if(o==="NWN"&&l[0].length<=2&&l[2].length===4)a=+l[0],d=i[1],g=+l[2],m="dmy";else if(o==="WNN"&&l[1].length<=2&&l[2].length===4)d=i[0],a=+l[1],g=+l[2],m="mdy";else if(o==="NWN"&&l[0].length===4&&l[2].length<=2)g=+l[0],d=i[1],a=+l[2],m="ymd";else return null;return{...we,form:"named",key:`named|${m}`,clock:t,day:a,year:g,word:d,namedOrder:m}}var en=[31,28,31,30,31,30,31,31,30,31,30,31],tn=n=>n%4===0&&n%100!==0||n%400===0;function lt(n,e,t){return n>=1&&n<=9999&&e>=1&&e<=12&&t>=1?t<=(e===2&&tn(n)?29:en[e-1]):!1}function nn(n,e,t,s){let r=new Date(Date.UTC(2e3,e-1,t,s?.h??0,s?.mi??0,s?.s??0));return r.setUTCFullYear(n),r}function ut(n,e={}){let t=(e.floor??1)>=1,s=new Map,r=new Map,i=0,o=null;for(let p of n){if(p==null)continue;if(typeof p!="string"){if(t)return null;i++;continue}let f=p.trim();if(f==="")continue;i++;let b=s.get(f);if(b===void 0&&(b=at(f),s.set(f,b)),b===null||b==="iso"){if(t)return null;continue}if(t){if(o===null)o=b;else if(b.key!==o.key)return null}else r.set(b.key,(r.get(b.key)??0)+1)}if(!t){let p=0,f="";for(let[b,y]of r)y>p&&(p=y,f=b);if(p===0||p/i<e.floor)return null;o=[...s.values()].find(b=>b!==null&&b!=="iso"&&b.key===f)??null}if(o===null)return null;let l=o.key,a=[...s.values()].filter(p=>p!==null&&p!=="iso"&&p.key===l),g,d="shape",m=null;if(o.form==="named"){if(g=o.namedOrder,m=pe(a.map(p=>p.word),e.locale),!m)return null}else if(o.form==="cjk"||o.yearFirst)g="ymd";else{let p=0,f=0;for(let b of a)b.a>12&&p++,b.b>12&&f++;if(p>0&&f>0)return null;p>0?(g="dmy",d="values"):f>0?(g="mdy",d="values"):o.sep.trim()==="."?(g="dmy",d="shape"):(g=Ie(e.locale)?"mdy":"dmy",d="locale")}let u=p=>{if(p.form==="named"){let f=m.get(q(p.word));return f===void 0?null:[p.year,f+1,p.day]}return p.yearFirst?[p.a,p.b,p.c]:g==="dmy"?[p.c,p.b,p.a]:[p.c,p.a,p.b]},_=1/0,M=-1/0,I=0;for(let p of a){let f=u(p);if(!f||!lt(f[0],f[1],f[2])){if(t)return null;I++;continue}_=Math.min(_,f[0]),M=Math.max(M,f[0])}if(!t&&(r.get(l)-I)/i<e.floor||_>=2400&&M<=2699||_>=1300&&M<=1500)return null;let A={form:o.form,order:g,orderFrom:d,hasTime:a.some(p=>p.clock!==null),read(p){if(typeof p!="string")return null;let f=p.trim();if(f==="")return null;let b=s.get(f);if(b===void 0&&(b=at(f),s.set(f,b)),b===null||b==="iso"||b.key!==l)return null;let y=u(b);return!y||!lt(y[0],y[1],y[2])?null:nn(y[0],y[1],y[2],b.clock)}};if(o.form!=="named"&&!a.some(p=>p.clock?.meridiem)){let p;o.form==="cjk"?p=o.cjkPattern:o.yearFirst?p=`%Y${o.sep}%m${o.sep}%d${o.trail}`:p=(g==="dmy"?`%d${o.sep}%m${o.sep}%Y`:`%m${o.sep}%d${o.sep}%Y`)+o.trail;let f=a.filter(b=>b.clock!==null).length;f===0?A.pattern=p:f===a.length&&(A.pattern=p+(a.every(b=>b.clock.seconds)?" %H:%M:%S":" %H:%M"))}return A}import Bt from"papaparse";var rn=["rate","ratio","pct","percent","percentage","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","z[_-]?score","average","avg","mean","median","stddev","variance","gpa","percentile","quantile","efficiency","accuracy","probability","multiplier","coefficient","correlation","occupancy","age","bmi","temperature","density","pressure","humidity","ph","velocity","speed","elevation","altitude","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps","capita","temperatuur","temperatur","temperatura","teplota","lampotila","homerseklet","sicaklik","pression","presion","pressao","pressione","druck","tryck","tlak","paine","nyomas","presiune","humidite","humedad","umidade","umidita","feuchtigkeit","vochtigheid","kosteus","vlhkost","vitesse","velocidad","velocidade","velocita","geschwindigkeit","snelheid","hastighet","hastighed","rychlost","nopeus","sebesseg","brzina","predkosc","densite","densidad","densidade","densita","dichte","dichtheid","hustota","tiheys","gustoca","moyenne","mediane","promedio","mediana","gemiddelde","durchschnitt","mittelwert","genomsnitt","gennemsnit","gjennomsnitt","keskiarvo","atlag","ortalama","prosjek","srednia","prumer","priemer","medie","taux","tasa","taxa","tasso","verhaltnis","verhouding","aandeel","anteil","andel","osuus","podil","udzial","udio","pourcentage","porcentaje","percentual","prozent","procent","prosentti","szazalek","yuzde","participacion","participacao","pondere","omjer","arany","oran","rata","leeftijd","edad","idade","wiek","eletkor","varsta","puntuacion","pontuacao","punteggio","betyg","ocena","indice","indeks","wskaznik","puan","ocupacion","ocupacao","occupazione","auslastung","bezetting","belaggning","belaegning","belegg","kayttoaste","oblozenie","obsazenost","obsadenost","kihasznaltsag","doluluk","ocupare","popunjenost","efficacite","eficiencia","efficienza","effizienz","effectiviteit","verimlilik"],sn=["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"],on=["latitude","longitude"],an=["latitude","longitude"];function Z(n){return ue(n)}var dt=["somme de","suma de","soma de","summe von","som van","somma di","summa av","sum av","sum af","soucet z","suma z","totaal van","total de","toplam","osszeg","nombre de","recuento de","contagem de","anzahl von","aantal van","conteggio di","antal av","lukumaara","pocet z","sum pa","\u0441\u0443\u043C\u043C\u0430","\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E","\u0441\u0443\u043C\u0430","\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C","\u03B1\u03B8\u03C1\u03BF\u03B9\u03C3\u03BC\u03B1","\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2"],ln=["moyenne de","promedio de","media de","media di","durchschnitt von","gemiddelde van","medelvarde av","genomsnitt av","gennemsnit af","keskiarvo","atlag","ortalama","prumer z","srednia z","medie de","minimum de","minimo de","minimo di","minimum von","maximum de","maximo de","massimo di","maximum von","prom.","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435","\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0435\u0440\u0435\u0434\u043D\u0454","\u03BC\u03B5\u03C3\u03BF\u03C2 \u03BF\u03C1\u03BF\u03C2","\u0645\u06CC\u0627\u0646\u06AF\u06CC\u0646"],un=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],cn=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],ye=Object.freeze({"nombre de":"count","recuento de":"count","contagem de":"count","anzahl von":"count","aantal van":"count","conteggio di":"count","antal av":"count",lukumaara:"count","pocet z":"count",\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E:"count",\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C:"count",\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2:"count",\u7684\u8BA1\u6570:"count","minimum de":"min","minimo de":"min","minimo di":"min","minimum von":"min","maximum de":"max","maximo de":"max","massimo di":"max","maximum von":"max"});function Ne(n){return[...n].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var ft=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+Ne(dt)+")\\s+)","i");function ct(n){for(let e of n){let t=e.codePointAt(0)??0;if(t>=11904&&t<=40959||t>=44032&&t<=55215)return!0}return!1}var mn="[\u2013\u2014-]";function gt(n){let e=n.filter(r=>!ct(r)),t=n.filter(ct),s=[];return e.length&&s.push("(?:\\s+|\\s*"+mn+"\\s*)("+Ne(e)+")"),t.length&&s.push("\\s*("+Ne(t)+")"),new RegExp("(?:"+s.join("|")+")\\s*$","i")}var Ee=gt(un),dn=gt(cn);function be(n,e){let t=e.exec(n);if(!t)return null;let s=n.slice(0,t.index);return s.trim()===""?null:{base:s,label:(t[1]??t[2]??"").toLowerCase()}}function pt(n){let e=Z(String(n??"").trim().toLowerCase());if(!e)return null;for(let r of ln)if(e.startsWith(r+" "))return ye[r]??"avg";for(let r of dt)if(e.startsWith(r+" ")||e===r)return ye[r]??"sum";let t=be(e,dn);if(t)return ye[t.label]??"avg";let s=be(e,Ee);return s?ye[s.label]??"sum":null}var fn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,gn=new RegExp("\\b("+rn.join("|")+")\\b|("+sn.join("|")+")$","i"),pn=new RegExp("\\b("+on.join("|")+")\\b|("+an.join("|")+")$","i");function Se(n){if(!n)return"";let e=String(n),t=Z(e),s=ft.exec(t);if(s)return e.slice(s[0].length).trim();let r=be(t,Ee);return(r?e.slice(0,r.base.length):e).trim()}function hn(n){if(!n)return!1;let e=Z(String(n));return ft.test(e)||be(e,Ee)!==null}var yn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],mt=new RegExp("^\\s*("+[...yn].sort((n,e)=>e.length-n.length).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function ht(n){if(n==null)return"";let e=String(n),t=mt.exec(e);if(!t)return e;let s=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=s(t[1]),i=e.slice(t[0].length),o=0;for(;o<8;){let l=mt.exec(i);if(!l||s(l[1])!==r)break;let a=i.slice(l[0].length);if(a.trim()==="")break;i=a,o++}return o===0?e:e.slice(0,t[0].length)+i}function ve(n,e){if(!n||!e)return!1;let t=String(n);for(let s of e){let r=s?.hostName;if(r&&r!==s?.name&&t.includes(r))return!0}return!1}var yt={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 "]},bn=new RegExp("^("+Object.keys(yt).join("|")+")\\((.+)\\)$");function bt(n){if(!n)return[];let e=bn.exec(String(n).trim());if(!e)return[];let t=yt[e[1]],s=e[2],r=[];for(let i=s.indexOf(".");i>=0;i=s.indexOf(".",i+1)){if(i===0)continue;let o=s.slice(i+1);if(o.trim()!=="")for(let l of t){let a=l+o;r.includes(a)||r.push(a)}}return r}function Sn(n){let e=Se(n);return e.length===0?"":e.replace(fn," ")}function St(n,e){if(!e)return!1;let t=Se(e);return n.test(Z(Sn(e)))||n.test(Z(t))||n.test(Z(Q(t).join(" ")))}function At(n){return St(pn,n)}function An(n){return St(gn,n)||At(n)}var _t=/int|double|decimal|single|float|number|currency|money/i;function _n(n){let e=String(n?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||n?.isMeasure===!0||_t.test(String(n?.dataType??""))?"Continuous":"Categorical"}function xn(n){return n?.isMeasure===!0||_t.test(String(n?.dataType??""))}function xt(n){let e=n??{},t=_n(e);if(t!=="Continuous")return{nature:t,additivity:"unknown",basis:"role",suppressed:!1};if(At(e.name))return{nature:t,additivity:"positional",basis:"name",suppressed:!0};let s=String(e.additivity??"").trim().toLowerCase();if(!(s==="additive"&&hn(e.name))){if(s==="additive")return{nature:t,additivity:"additive",basis:"measured",suppressed:!1};if(s==="part_of_whole")return{nature:t,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(s==="intensive_rate")return{nature:t,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:t,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:An(e.name)?{nature:t,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:t,additivity:"additive",basis:"default",suppressed:!1}}function Ct(n){let e=xt(n),t=n??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return xn(t)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function ri(n){return Ct(n)[0]}function ii(n,e){return Ct(n).indexOf(e)>=0}function si(n,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let t=xt(n);return t.additivity==="additive"||t.additivity==="part_of_whole"||t.additivity==="unknown"}var Cn={de:["nr","nummer","kennung","kennziffer","plz","postleitzahl"],nl:["nr","nummer"],sv:["nr","nummer"],da:["nr","nummer"],nb:["nr","nummer"],fi:["tunnus","koodi","nro"],hu:["azonos\xEDt\xF3","k\xF3d"],tr:["kod","kodu","numaras\u0131","numarasi"],zh:["\u7F16\u53F7","\u4EE3\u7801","\u7F16\u7801","\u53F7\u7801","\u90AE\u7F16"],ja:["\u756A\u53F7","\u30B3\u30FC\u30C9"],ko:["\uBC88\uD638","\uCF54\uB4DC"],hi:["\u0915\u094B\u0921","\u0915\u094D\u0930\u092E\u093E\u0902\u0915"],fr:["num\xE9ro"],es:["c\xF3digo"],pt:["c\xF3digo","cep"],it:["codice"],pl:["kod","numer"],cs:["k\xF3d","\u010D\xEDslo"],sk:["k\xF3d","\u010D\xEDslo"],hr:["\u0161ifra","oznaka"],ru:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],uk:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],el:["\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2"],ar:["\u0631\u0645\u0632","\u0643\u0648\u062F","\u0631\u0642\u0645"],he:["\u05E7\u05D5\u05D3"],id:["kode","nomor"],vi:["m\xE3"],th:["\u0E23\u0E2B\u0E31\u0E2A"]},Mn=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],Tn=["num\xE9ro"],wn=n=>n.normalize("NFC").toLowerCase();function Rn(n,e,t,s){let r=Ce(t);return!r||!n?null:n===e?"word":r.wordBreaks===!1?Array.from(e).length<Ve?null:(s?n.startsWith(e):n.endsWith(e))&&n.length>e.length?"suffix":null:s?$e(n,t).includes(e)?"word":null:r.script==="Hang"?Ue(n,e)?"suffix":null:r.compounds&&ze(n,e,Ge)?"suffix":null}function Mt(n){let e=String(n??"").trim();if(!e)return null;let t=ce(e),s=ce(Se(e));for(let[r,i]of Object.entries(Cn)){let o=Mn.includes(r),l=o?s:t;for(let a of i){let g=Tn.includes(a)||!!Ce(r)?.foldSensitive,d=g?l.words:l.folded;if(d.length===0)continue;let m=g?wn(a):ce(a).folded.join(" "),u=Rn(o?d[0]:d[d.length-1],m,r,o);if(u)return{lang:r,word:a,view:u}}}return null}var In=[["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 Ae(n){for(let[e,t]of In)if(t.test(n))return e;return null}var Nn=[{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]]}],_e=new Map;function Tt(n,e,t,s){let r=_e.get(n);if(r)return r;let i=[];for(let[o,l]of e)for(let a=o;a<=l;a++){let g=String.fromCodePoint(a);Ae(g)===t&&(s&&!s.test(g)||i.push(g))}return _e.set(n,i),i}function En(n){let t=n.codePointAt(0);for(let o=0;o<9&&Ae(String.fromCodePoint(t-1))==="Nd";o++)t--;let s="nd:"+t.toString(16),r=_e.get(s);if(r)return r;let i=[];for(let o=t;o<t+10;o++){let l=String.fromCodePoint(o);Ae(l)==="Nd"&&i.push(l)}return _e.set(s,i),i}function vn(n,e){if(e==="Nd")return En(n);for(let r of Nn)if(r.test.test(n))return Tt(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let s=n.codePointAt(0)&-128;return Tt("block:"+s.toString(16)+":"+e,[[s,s+127]],e,null)}function kn(n,e,t,s){let r=n.filter(i=>!e.has(i));return r.length===0&&(r=n.filter(i=>i!==t)),r.length===0?t:r[Math.min(r.length-1,Math.floor(s()*r.length))]}var Dn=/^[\p{L}\p{M}\p{Nd}]$/u,wt=/^[\p{L}\p{Nd}]$/u;function Rt(n,e){if(!n)return n??"";let t=new Set(Array.from(n)),s=d=>{let m=Ae(d);return!m||!Dn.test(d)?d:kn(vn(d,m),t,d,e)},r=d=>{let m=[];for(let u of d)m.push(s(u)),wt.test(u)&&e()<.2&&m.push(s(u));if(m.length>6){let u=Math.floor(e()*Math.min(3,m.length-6));for(let _=0;_<u;_++)for(let M=0;M<5;M++){let I=Math.floor(e()*m.length);if(wt.test(m[I])){m.splice(I,1);break}}}return m.join("")};if(!(n.includes("@")&&n.includes(".")))return r(n);let[o,l=""]=n.split("@"),a=l.endsWith(".com"),g=a?l.slice(0,-4):l;return`${r(o)}@${r(g)}${a?".com":""}`}var On=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Ln=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Pn=new RegExp([String.raw`\bisMeasure\b`,String.raw`\bdataType\b`,String.raw`\bcolumns\s*\[\s*-?\d`,String.raw`\.iloc\s*\[[^\]]*,`,String.raw`\.iat\s*\[`,String.raw`\bselect_dtypes\b`,String.raw`\b_get_numeric_data\b`,String.raw`\bis_numeric_dtype\b`,String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`,String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`,String.raw`\bdf\.dtypes\b`,String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`,String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));function oe(n,e){if(!n||!e)return!1;let t=Ln(e);return new RegExp("['\"`]"+t+"['\"`]").test(n)?!0:On.test(e)&&new RegExp("\\."+t+"(?![A-Za-z0-9_$])").test(n)}function Fn(n){return!!n&&Pn.test(n)}function di(n,e,t){return n?Fn(n)?[...e]:[...t,...e].some(s=>oe(n,s))?e.filter(s=>oe(n,s)):[...e]:[]}var Bn=5,Wn=6,Gn=3,ee=864e5,zn=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,$n=/^(\d{4})[-/](\d{1,2})$/,Un=/^(\d{4})[-\s]?Q([1-4])$/i,Vn=/^Q([1-4])[-\s](\d{4})$/i,Kn=/^(\d{4})$/,Hn=/^(\d{4})(0[1-9]|1[0-2])$/,Yn=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,jn=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,Xn=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function ke(n,e,t){let s=q(n);if(!s)return 0;if(s==="sept")return 9;for(let o of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=ge(o)[s];if(l!==void 0)return l+1}let r=t?.get(s);if(r!==void 0)return r+1;let i=ie(n);if(i.length>0){if(i.every(a=>a.month===i[0].month))return i[0].month+1;let o=Be(String(e??"").split(/[-_]/)[0])?.code,l=i.find(a=>a.lang===o);if(l)return l.month+1}return 0}function Zn(n){let e=me(n).filter(s=>s.yearDigits===4);if(e.length===0||e.some(s=>s.lang==="en"))return null;let t=e[0];return e.some(s=>s.grain!=="quarter"||s.n!==t.n||s.year!==t.year)?null:H(t.year,(t.n-1)*3+1,1)}function H(n,e,t,s=0,r=0,i=0){if(!(n>=1&&e>=1&&e<=12&&t>=1&&t<=31))return null;let o=Date.UTC(n,e-1,t,s,r,i);if(!Number.isFinite(o))return null;let l=a=>a<10?"0"+a:String(a);return{ms:o,y:n,m:e,d:t,iso:`${n}-${l(e)}-${l(t)}`}}function Qn(n,e){let t=[],s="";for(let a=0;a<e.length;a++){if(e[a]!=="%"){s+=e[a].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++a]){case"Y":t.push("Y"),s+="(\\d{4})";break;case"m":t.push("m"),s+="(\\d{1,2})";break;case"d":t.push("d"),s+="(\\d{1,2})";break;case"H":case"M":case"S":s+="\\d{1,2}";break;case"%":s+="%";break;default:return null}}let r=new RegExp("^"+s+"$").exec(n);if(!r)return null;let i=0,o=1,l=1;return t.forEach((a,g)=>{let d=+r[g+1];a==="Y"?i=d:a==="m"?o=d:l=d}),i?H(i,o,l):null}function re(n,e,t,s){let r=(n??"").trim();if(r==="")return null;if(e){let a=Qn(r,e);return a||null}let i=zn.exec(r);if(i)return H(+i[1],+i[2],+i[3],+(i[4]??0),+(i[5]??0),+(i[6]??0));if(i=Un.exec(r),i)return H(+i[1],(+i[2]-1)*3+1,1);if(i=Vn.exec(r),i)return H(+i[2],(+i[1]-1)*3+1,1);if(i=$n.exec(r),i&&+i[2]>=1&&+i[2]<=12)return H(+i[1],+i[2],1);if(i=Yn.exec(r),i)return H(+i[1],+i[2],+i[3]);if(i=Hn.exec(r),i)return H(+i[1],+i[2],1);if(i=Kn.exec(r),i){let a=+i[1];return a>=1900&&a<=2100?H(a,1,1):null}let o=Zn(r);if(o)return o;if(i=jn.exec(r),i){let a=ke(i[1],t,s);if(a)return H(+i[2],a,1)}if(i=Xn.exec(r),i){let a=ke(i[2],t,s);if(a)return H(+i[1],a,1)}let l=ne(r);if(l){let a="month"in l?l.month:ke(l.word,t,s);if(a)return H(l.year,a,1)}return null}function It(n){let e=new Date(n).getUTCDay();return e>=1&&e<=5}function Nt(n,e){if(e<=n)return 0;let t=Math.round((e-n)/ee),s=Math.floor(t/7),r=s*5,i=n+s*7*ee;for(;i<e;)It(i)&&r++,i+=ee;return r}function qn(n){if(n.length===0)return 0;let e=[...n].sort((s,r)=>s-r),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function Jn(n){return n>0?n<.95?"hour":n<=1.05?"day":n>=6.5&&n<=7.5?"week":n>=27&&n<=31.5?"month":n>=88&&n<=93?"quarter":n>=362&&n<=368?"year":"irregular":"irregular"}function ae(n,e,t,s){switch(t){case"year":return e.y-n.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(n.y*4+Math.floor((n.m-1)/3));case"month":return e.y*12+e.m-(n.y*12+n.m);case"week":return Math.round((e.ms-n.ms)/(7*ee));case"weekday":return Nt(n.ms,e.ms);case"day":return Math.round((e.ms-n.ms)/ee);default:return s>0?Math.round((e.ms-n.ms)/s):0}}function Et(n,e){return De(n,e)?.cadence??null}function De(n,e){let t=e?.gapFactor??Bn,s=0,r=0,i=new Map,o=Array.from(n),l;if(!e?.pattern){let y=[];for(let x of o){if(x==null||x==="")continue;let h=ne(String(x));h&&"word"in h&&y.push(h.word)}y.length>0&&(l=pe(y,e?.locale)??void 0)}for(let y of o){if(y==null||y==="")continue;s++;let x=re(String(y),e?.pattern,e?.locale,l);x&&(r++,i.set(x.ms,x))}let a=[...i.values()].sort((y,x)=>y.ms-x.ms);if(a.length<Gn||s>0&&r/s<.8)return null;let g=a[a.length-1].ms-a[0].ms;if(g<=0)return null;let d=[];for(let y=1;y<a.length;y++)d.push(a[y].ms-a[y-1].ms);let m=qn(d);if(!(m>0))return null;let u=Jn(m/ee);u==="day"&&g>=7*ee&&a.every(y=>It(y.ms))&&Nt(a[0].ms,a[a.length-1].ms)+1>a.length*.5&&(u="weekday");let _=u==="irregular"?a.length:ae(a[0],a[a.length-1],u,m)+1,M=1,I=1,A=[],p=a[0],f=1;for(let y=1;y<a.length;y++){let x=ae(a[y-1],a[y],u,m);x>M&&(M=x),u!=="irregular"&&x>t?(I++,A.push({from:p.iso,to:a[y-1].iso,points:f}),p=a[y],f=1):f++}A.push({from:p.iso,to:a[a.length-1].iso,points:f});let b={grain:u,points:a.length,expectedPoints:Math.max(_,a.length),coveragePct:Math.round(a.length/Math.max(_,a.length)*1e3)/10,runs:I,largestGapUnits:M,gapFactor:t};return e?.includeBounds&&A.length<=Wn&&(b.runBounds=A),{cadence:b,points:a,stepMs:m}}var er=8,tr=.5,nr=200,rr=new Set(["category","categories","subcategory","type","types","kind","class","classes","classification","segment","segments","tier","status","priority","severity","grade","level","band","bucket","group","channel","method","mode","stage","phase","period","shift","gender","sex","result","outcome","reason","flag","genre","sector","source"]),ir=["category","classification","segment","status","priority","severity","channel"],sr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function or(n){let e=Q(n);if(e.length===0)return!1;let t=e[e.length-1];return rr.has(t)?!0:ir.some(s=>t.length>s.length&&t.endsWith(s))}function ar(n){if(n.isMeasure)return"measure";if(n.isTemporal||n.isDatePart||n.isReassembledDate)return"temporal";let e=Array.from(n.values).filter(t=>t!==""&&t!==null&&t!==void 0);return e.length<2||e.length>nr?"cardinality":n.rows>0&&e.length>=n.rows?"row-identity":n.isBinaryFlag?"flag":de(e,n.locale)!==null?"ordinal":n.identifierNamed||n.dataType==="String"&&sr.has(fe(e))?"identifier":!n.geoKind&&or(n.name)?"attribute":"entity"}function Dt(n){let e=-1,t=1/0,s=!1;return n.forEach((r,i)=>{if(ar(r)!=="entity")return;let o=new Set(Array.from(r.values).filter(a=>a!=="")).size,l=!!r.geoKind;(o<t||o===t&&l&&!s)&&(e=i,t=o,s=l)}),e}var vt=n=>n<10?"0"+n:String(n);function kt(n,e){switch(e){case"year":return`${n.y}-01-01`;case"quarter":return`${n.y}-${vt(Math.floor((n.m-1)/3)*3+1)}-01`;case"month":return`${n.y}-${vt(n.m)}-01`;case"hour":return new Date(n.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return n.iso}}function Ot(n){let{periods:e,series:t}=n,s=Math.min(e.length,t.length),r=new Set;for(let x=0;x<s;x++)e[x]&&r.add(e[x]);let i=De(r,{pattern:n.pattern,locale:n.locale});if(!i)return null;let o=i.cadence.grain;if(o==="irregular")return null;let l=i.points[0],a=ae(l,i.points[i.points.length-1],o,i.stepMs)+1;if(a!==i.cadence.expectedPoints)return null;let g=new Map;for(let x of r){let h=re(x,n.pattern,n.locale);if(!h)continue;let R=ae(l,h,o,i.stepMs);R>=0&&R<a&&g.set(x,{idx:R,stamp:h})}let d=new Map;for(let x=0;x<s;x++){let h=t[x];if(!h)continue;let R=g.get(e[x]);if(!R)continue;let T=d.get(h);T||(T={seen:new Set,lo:R.idx,hi:R.idx,loStamp:R.stamp,hiStamp:R.stamp,order:d.size},d.set(h,T)),T.seen.add(R.idx),R.idx<T.lo&&(T.lo=R.idx,T.loStamp=R.stamp),R.idx>T.hi&&(T.hi=R.idx,T.hiStamp=R.stamp)}if(d.size<2)return null;let m=0;for(let x of d.values())m+=x.seen.size;if(m/(d.size*a)<(n.minFill??tr))return null;let u=[],_=new Set,M=0,I=0,A=0,p=0,f=0,b=1;for(let[x,h]of d){for(let G of h.seen)_.add(G);if(h.seen.size>=a)continue;let R=[...h.seen].sort((G,j)=>G-j),T=1;for(let G=1;G<R.length;G++)T=Math.max(T,R[G]-R[G-1]);let U={key:x,acc:h,coverage:h.seen.size/a,before:h.lo,after:a-1-h.hi,interior:h.hi-h.lo+1-h.seen.size,gap:T};u.push(U),U.before>0&&M++,U.after>0&&I++,U.interior>0&&A++,p=Math.max(p,U.before),f=Math.max(f,U.after),b=Math.max(b,T)}if(u.length===0)return null;u.sort((x,h)=>x.coverage-h.coverage||x.acc.order-h.acc.order);let y=u.slice(0,n.maxListed??er);return{seriesColumn:n.seriesColumn,grain:o,periods:a,seriesCount:d.size,incompleteSeries:u.length,lateStarts:M,earlyEnds:I,withHoles:A,columnWideMissing:a-_.size,maxMissingBefore:p,maxMissingAfter:f,largestGap:b,series:y.map(x=>{let h={};return n.includeNames&&(h.name=x.key),n.includeDates&&(h.first=kt(x.acc.loStamp,o),h.last=kt(x.acc.hiStamp,o)),h.missingBefore=x.before,h.missingAfter=x.after,h.missingInterior=x.interior,h.largestGap=x.gap,h.coverage=Math.round(x.coverage*1e3)/1e3,h}),more:u.length-y.length}}var lr=5e5,ur=8,cr=4,mr=5,Oe=1,Le=2,dr=4,fr=8;function gr(n,e,t){let[s,r]=[...n];if(e.isTemporal){let i=re(s,e.temporalTextPattern,t),o=re(r,e.temporalTextPattern,t);if(i&&o&&i.ms!==o.ms)return i.ms<o.ms?{a:s,b:r,setOrder:"temporal"}:{a:r,b:s,setOrder:"temporal"}}return s<r?{a:s,b:r,setOrder:"none"}:{a:r,b:s,setOrder:"none"}}function pr(n,e,t){let{rows:s,text:r,locale:i}=n,o=gr(t.values,t,i),l=new Uint8Array(s.length),a=0;for(let g=0;g<s.length;g++){let d=r(s[g][e]);d===o.a?l[g]=1:d===o.b?l[g]=2:a++}return{code:l,blankRows:a,setOrder:o.setOrder}}function hr(n,e){let{rows:t,text:s}=n,r=new Int32Array(t.length),i=new Map;for(let o=0;o<t.length;o++){let l=s(t[o][e]);if(l===""){r[o]=-1;continue}let a=i.get(l);a===void 0&&(a=i.size,i.set(l,a)),r[o]=a}return{ids:r,dict:i}}function yr(n,e,t){let s=new Uint8Array(t);for(let i=0;i<n.length;i++){let o=e[i];if(o===0)continue;let l=n[i];if(l<0)continue;let a=s[l];s[l]=a&o?a|o<<2:a|o}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let i=0;i<t;i++){let o=s[i];o&Oe&&r.keysA++,o&Le&&r.keysB++,(o&(Oe|Le))===(Oe|Le)&&r.keysBoth++,o&dr&&r.dupA++,o&fr&&r.dupB++}return r}function br(n,e){let t=(n.dupA+n.dupB)*(e.keysA+e.keysB),s=(e.dupA+e.dupB)*(n.keysA+n.keysB);return t<s||t===s&&n.keysBoth>e.keysBoth}var Lt=n=>n==null||typeof n=="string"&&n.trim()==="";function Sr(n,e,t){if(n===e)return!0;let s=Lt(n),r=Lt(e);return s||r?s&&r:typeof n=="number"&&typeof e=="number"?!1:n instanceof Date&&e instanceof Date?n.getTime()===e.getTime():t(n).trim()===t(e).trim()}function Pt(n){let{rows:e,columns:t}=n,s=e.length;if(s<2||s>lr)return null;let r=t.map((h,R)=>({c:h,i:R})).filter(({c:h})=>!h.isMeasure&&!h.isTemporal&&!h.isDatePart&&h.distinct>=mr).sort((h,R)=>(R.c.identifierNamed?1:0)-(h.c.identifierNamed?1:0)||R.c.distinct-h.c.distinct||h.i-R.i).slice(0,ur),i=t.map((h,R)=>({c:h,i:R})).filter(({c:h})=>!h.isMeasure&&h.values!==null&&h.values.size===2).slice(0,cr);if(r.length===0||i.length===0)return null;let o=i.map(({c:h,i:R})=>pr(n,R,h)),l=null;for(let{i:h}of r){let R=hr(n,h);for(let T=0;T<i.length;T++){if(i[T].i===h)continue;let U=yr(R.ids,o[T].code,R.dict.size);U.keysBoth<1||(!l||br(U,l.tally))&&(l={tally:U,keyIdx:h,setNo:T,ids:R.ids,dict:R.dict})}}if(!l)return null;let{ids:a,dict:g,tally:d}=l,m=o[l.setNo],u=i[l.setNo].i,_=g.size,M=new Int32Array(_).fill(-1),I=new Int32Array(_).fill(-1);for(let h=0;h<s;h++){let R=m.code[h],T=a[h];R===0||T<0||(R===1?M[T]<0&&(M[T]=h):I[T]<0&&(I[T]=h))}let A=[];for(let h=0;h<t.length;h++)h!==l.keyIdx&&h!==u&&A.push(h);let p=0;for(let h=0;h<_;h++){let R=M[h],T=I[h];if(R<0||T<0)continue;let U=e[R],G=e[T],j=!0;for(let K of A)if(!Sr(U[K],G[K],n.text)){j=!1;break}j&&p++}let f=p===d.keysBoth?100:p===0?0:Math.min(99,Math.max(1,Math.round(p/d.keysBoth*100))),b=new Map,y=new Map;for(let[h,R]of g){let T=M[R]>=0,U=I[R]>=0;if(!T&&!U)continue;let G=Ze(h);Qe(G)&&(T&&b.set(G,(b.get(G)??0)+1),U&&y.set(G,(y.get(G)??0)+1))}let x=h=>{let R=0;for(let T of h.values())T>=2&&(R+=T);return R};return{key:l.keyIdx,discriminator:u,pairing:{form:"long",key:t[l.keyIdx].name,discriminator:t[u].name,keysA:d.keysA,keysB:d.keysB,keysBoth:d.keysBoth,duplicateKeysA:d.dupA,duplicateKeysB:d.dupB,identicalPct:f,discriminatorBlankRows:m.blankRows,looseCollisionsA:x(b),looseCollisionsB:x(y),setOrder:m.setOrder}}}var Ar=n=>n==="Integer"||n==="Decimal";function _r(n){let e=[],t=[];return n.forEach((s,r)=>{if(s.twoValues){if(s.isBinaryFlag){e.push(r);return}s.isMeasure||s.isTemporal||s.isDatePart||s.identifierNamed||t.push(r)}}),[...e,...t].slice(0,6)}function xr(n,e){let t=[];for(let s=0;s<n.length&&t.length<12;s++){let r=n[s];e.has(s)||!Ar(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||t.push(s)}return t}function Ft(n){let e=new Map,{rows:t,columns:s,text:r}=n;if(t.length===0||t.length>(n.maxRows??5e5))return e;let i=_r(s);if(i.length===0)return e;let o=xr(s,new Set(i));if(o.length===0)return e;let l=i.map(a=>{let[g,d]=s[a].twoValues,m=new Uint8Array(t.length);for(let u=0;u<t.length;u++){let _=r(t[u][a]);m[u]=_===g?1:_===d?2:0}return m});for(let a of o){let g=new Float64Array(t.length),d=0;for(let f=0;f<t.length;f++){let b=t[f][a],y=b==null||b===""?NaN:typeof b=="number"?b:parseFloat(b);g[f]=y,y===y&&y!==1/0&&y!==-1/0&&d++}if(d<2)continue;let m=new Float64Array(d);for(let f=0,b=0;f<t.length;f++){let y=g[f];y===y&&y!==1/0&&y!==-1/0&&(m[b++]=y)}m.sort();let u=new Float64Array(d),_=0;for(let f=0;f<d;f++)(f===0||m[f]!==m[f-1])&&(u[_++]=m[f]);let M=new Int32Array(t.length).fill(-1);for(let f=0;f<t.length;f++){let b=g[f];if(!(b===b&&b!==1/0&&b!==-1/0))continue;let y=0,x=_-1;for(;y<x;){let h=y+x>>>1;u[h]<b?y=h+1:x=h}M[f]=y}let I=[],A=new Int32Array(_),p=new Int32Array(_);for(let f=0;f<i.length;f++){let b=l[f];A.fill(0),p.fill(0);let y=0,x=0;for(let S=0;S<t.length;S++){let P=M[S];P<0||(b[S]===1?(A[P]++,y++):b[S]===2&&(p[P]++,x++))}if(y===0||x===0)continue;let h=y<=x,R=h?y:x,T=h?x:y,U=h?A:p,G=h?p:A,j=0,K=0,c=0;for(let S=0;S<_;S++){let P=U[S],k=G[S];j+=P*(K+.5*k),K+=k,P+k>=2&&(c+=P+k)}I.push({outcome:s[i[f]].name,aucMinorityHigh:Math.round(j/(R*T)*1e4)/1e4,nMinority:R,nMajority:T,ties:c})}I.length>0&&e.set(a,I)}return e}var Cr=12,Mr=100,Tr=.3,wr=.9,Rr=120,Ir=1900,Nr=2100,Er=0,vr=20,kr=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function xe(n){if(!n)return!1;let e=Q(n);return e.length===0?!1:kr.has(e[e.length-1])?!0:Mt(n)!==null}var Dr=new Set(["year","yr","fy"]),Or=n=>Q(n).some(e=>Dr.has(e))||Xe(n)!==null,Lr=/^(?:(?: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 Pe(n){if(!Number.isInteger(n)||n<190001||n>210012)return!1;let e=n%100;return e>=1&&e<=12}function Fe(n){if(!Number.isInteger(n)||n<19000101||n>21001231)return!1;let e=Math.floor(n/100)%100,t=n%100;return e>=1&&e<=12&&t>=1&&t<=31}var Pr=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Fr=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,Br=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function zt(n,e){let t=[],s=0,r=Wr(n,e,t,()=>{s++});if(r)return r;if(s>0||t.length<2)return null;let i=ut(t,{locale:e,floor:.8});return!i||!i.pattern||i.form==="named"?null:{pattern:i.pattern,orderFrom:i.orderFrom==="shape"?i.order==="ymd"?"iso":"shape":i.orderFrom}}function Wr(n,e,t,s){let r=0,i=0,o=0,l=0,a=0,g="",d=0,m="",u=0,_=0,M=0,I=0,A=!1;for(let h of n){if(h==null)continue;let R=String(h).trim();if(R==="")continue;r++,t.push(R);let T;if(T=Pr.exec(R)){s();let U=+T[2],G=+T[3];U>=1&&U<=12&&G>=1&&G<=31&&(i++,T[4]!==void 0&&o++,T[6]!==void 0&&l++)}else if(T=Fr.exec(R)){s();let U=+T[3],G=+T[4];U>=1&&U<=12&&G>=1&&G<=31&&(g&&g!==T[2]&&(A=!0),g=T[2],a++)}else if(T=Br.exec(R)){s();let U=+T[1],G=+T[3];U>=1&&U<=31&&G>=1&&G<=31&&(U<=12||G<=12)&&(m&&m!==T[2]&&(A=!0),m=T[2],d++,U>12&&M++,G>12&&I++,T[5]!==void 0&&u++,T[7]!==void 0&&_++)}if(r>=200)break}if(r<2||(i+a+d)/r<.8||(i>0?1:0)+(a>0?1:0)+(d>0?1:0)!==1||A)return null;if(i>0)return o===i?{pattern:l===i?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(a>0)return{pattern:`%Y${g}%m${g}%d`,orderFrom:"iso"};if(M>0&&I>0)return null;let b,y;M>0?(b=!0,y="values"):I>0?(b=!1,y="values"):m==="."?(b=!0,y="shape"):(b=!Ie(e),y="locale");let x=b?`%d${m}%m${m}%Y`:`%m${m}%d${m}%Y`;return u===d?{pattern:x+(_===d?" %H:%M:%S":" %H:%M"),orderFrom:y}:{pattern:x,orderFrom:y}}function Gr(n,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(n))return!1;let t=n.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!t)return!1;let s=q(t);return s.length>0&&e[s]!==void 0}function zr(n,e){let t=new Map,s=new Map;for(let l of n){let a=ne(l);if(!a||"month"in a)continue;let g=ie(a.word),d=g.some(u=>u.lang==="en"),m=q(a.word);for(let u of new Set(g.map(_=>_.lang)))u!=="en"&&(t.has(u)||(t.set(u,new Set),s.set(u,new Set)),t.get(u).add(m),d||s.get(u).add(m))}let r=[...t.keys()].filter(l=>t.get(l).size>=3&&s.get(l).size>=1),i=0,o=new Map(r.map(l=>[l,0]));for(let l of e){let a=ne(l);if(!a)continue;if("month"in a){i++;continue}let g=ie(a.word);if(g.length===0)continue;let d=g.some(m=>m.lang==="en");for(let m of r)(d||g.some(u=>u.lang===m))&&o.set(m,o.get(m)+1)}return i+Math.max(0,...o.values())}var $r=/(?:19|20)[0-9]{2}/;function Ur(n){let e=new Map,t=0;for(let r of n){if(!$r.test(ue(r)))continue;let i=new Set(me(r).filter(o=>o.yearDigits===4&&(o.grain==="quarter"||o.grain==="week")).map(o=>o.lang));if(i.size!==0){if(i.has("en")){t++;continue}for(let o of i)e.set(o,(e.get(o)??0)+1)}}let s=0;for(let r of e.values())s=Math.max(s,r);return s>0?s+t:0}function Vr(n){let{dataType:e,name:t,isMeasure:s,distinctCount:r}=n;if(e==="DateTime")return!0;if(s)return!1;if(e==="Integer"||e==="Decimal"){let i=n.minNum,o=n.maxNum;if(!(i!=null&&o!=null&&Number.isFinite(i)&&Number.isFinite(o)&&Number.isInteger(i)&&Number.isInteger(o)&&o>=i))return!1;let a=i>=1900&&o<=2100;if(a&&r>=2&&Or(t)||a&&r>=3&&r===o-i+1)return!0;let g=Pe(i)&&Pe(o),d=Fe(i)&&Fe(o);if(g||d){if(!n.sampleValues)return!0;let m=0,u=0;for(let _ of n.sampleValues){if(_==null||_==="")continue;m++;let M=Number(String(_).trim());if(Number.isFinite(M)&&(g?Pe(M):Fe(M))&&u++,m>=60)break}if(m>=2&&u===m)return!0}return!1}if(n.sampleValues){let i=n.locale?ge(n.locale):null,o=0,l=0,a=[],g=[];for(let d of n.sampleValues){if(d==null||d==="")continue;o++;let m=String(d).trim();if(a.push(m),Lr.test(m)||Gr(m,i)?l++:g.push(m),o>=60)break}if(o>=2&&l/o>=.8||o>=2&&(l+Ur(g)+zr(a,g))/o>=.8||zt(a,n.locale)!==null)return!0}return!1}function Kr(n){let e=Z((n||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":pt(n)}function Hr(n){let{rows:e,measureColIdx:t,measureName:s,candidateDims:r,minNum:i,maxNum:o,discourageAgg:l}=n,a=100,g=.01,d="";for(let u of r){if(u.distinct<2||u.distinct>a)continue;let _=r.filter(f=>f.idx!==u.idx).map(f=>f.idx),M=new Map;for(let f of e){let b=f[t];if(typeof b!="number"||!Number.isFinite(b))continue;let y=_.length?_.map(h=>String(f[h])).join(d):"",x=M.get(y);x||(x={sum:0,cset:new Set},M.set(y,x)),x.sum+=b,x.cset.add(String(f[u.idx]))}let I=0,A=0,p=0;for(let f of M.values())f.cset.size<2||(p++,Math.abs(f.sum-100)<=100*g?I++:Math.abs(f.sum-1)<=1*g&&A++);if(p>=2&&(I/p>=.9||A/p>=.9))return{additivity:"part_of_whole",partOfWholeDim:u.name}}if(l)return{additivity:"intensive_rate"};let m=Kr(s);return m==="avg"||m==="min"||m==="max"?{additivity:"intensive_rate"}:m==="count"?{additivity:"additive"}:m==="sum"?{additivity:"unknown"}:i!=null&&o!=null&&Number.isFinite(i)&&Number.isFinite(o)&&i>=0&&o<=1.0001&&o>0?{additivity:"intensive_rate"}:{additivity:"unknown"}}function $t(n){let{dataType:e,isMeasure:t,name:s,distinct:r,nonblank:i,prec:o,maxval:l,minval:a}=n,g=l-a+1,d=g>0?r/g:1,m=i>0?r/i:0,u=e==="Decimal"||o>0;return!t&&xe(s)?"Categorical":d>=wr&&(qe(s)&&r<=Rr||a>=Ir&&l<=Nr||a>=Er&&l<=vr)?"Ordinal":t||r>Cr&&(u||r>=Mr||m>=Tr)?"Continuous":"Categorical"}function Wt(n,e,t){return!n||n.isMeasure||e||n.dataType!=="Integer"&&n.dataType!=="Decimal"?!1:$t({dataType:n.dataType,isMeasure:!1,name:n.name,distinct:t.distinct,nonblank:t.nonblank,prec:t.prec,maxval:typeof t.maxval=="number"?t.maxval:0,minval:typeof t.minval=="number"?t.minval:0})==="Continuous"}function Yr(n){let e=null;for(let t=0;t<n.length;t++){let s=n[t];if(typeof s!="string"||s.length===0)continue;let r=s.trim();r.length!==s.length&&(e||(e=n.slice()),e[t]=r)}return e||n}var Gt=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;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 s=e.toString().split(".")[1];return s?s.length:0}getColumns(){return this._cols}inferredMeasureFlags(){if(this._inferredMeasureFlags)return this._inferredMeasureFlags;let e=this._cols.map(t=>!!(t&&t.isMeasure));return this._cols.forEach((t,s)=>{if(!t||t.isMeasure||this._declaredDimensions.has(t)||t.dataType!=="Integer"&&t.dataType!=="Decimal")return;let r=new Set,i=0,o=0,l=null,a=null;for(let g of this._rows){let d=g[s],m=this.STR(d);if(m!=""&&(r.add(m),i++,(l===null||d<l)&&(l=d),(a===null||d>a)&&(a=d),t.dataType=="Decimal")){let u=this.getPrecision(d);u>o&&(o=u)}}e[s]=Wt(t,!1,{distinct:r.size,nonblank:i,prec:o,minval:l,maxval:a})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let t of e)t&&this._declaredDimensions.add(t)}wholeDayIso(e){return je(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,t){if(this._computedStatsForLevel==e)return this._cols;let s=0,r=parseInt(e),i=[],o=[],l=[];for(let c of this._cols){let S=new Map,P=[],k=0,C=0,O=0,F=null,L=null,D=null,z=!1,W=!0,E=!0,v=null,$=!1;for(let N of this._rows){let w=N[s],B=this.STR(w);if(B!=""){if(k+=B.length,S.set(B,(S.get(B)||0)+1),C++,c.dataType=="Integer"||c.dataType=="Decimal"||c.dataType=="DateTime")if((F===null||w<F)&&(F=w),(L===null||w>L)&&(L=w),c.dataType=="Integer"||c.dataType=="Decimal"){if(D===null?D=w:D+=w,c.dataType=="Decimal"){let V=this.getPrecision(w);V>O&&(O=V)}P.push(w)}else z=z||this.hasTimeComponent(w);$&&(w<v?W=!1:w>v&&(E=!1)),v=w,$=!0}}if(C>=3&&(W&&!E?c.sortedDirection="asc":E&&!W?c.sortedDirection="desc":c.sortedDirection="none"),C>0&&S.size>0&&!c.isMeasure){let N=0,w=Number.MAX_SAFE_INTEGER;for(let B of S.values())B>N&&(N=B),B<w&&(w=B);if(c.modalShare=N/C,c.minGroupCount=w===Number.MAX_SAFE_INTEGER?null:w,S.size===2){let B=[...S.keys()].map(le=>Ke(le).trim().toLowerCase()).sort(),Y=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(le=>B[0]===le[0]&&B[1]===le[1]),te=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(c.name);(Y||te)&&(c.isBinaryFlag=!0)}}else c.isMeasure&&(c.dataType==="Integer"||c.dataType==="Decimal")&&S.size===2&&S.has("0")&&S.has("1")&&(c.isBinaryFlag=!0);if(c.dataType=="DateTime"&&(c.dateWithTime=z),c.isTemporal=Vr({dataType:c.dataType,name:c.name,isMeasure:c.isMeasure,distinctCount:S.size,minNum:typeof F=="number"?F:null,maxNum:typeof L=="number"?L:null,sampleValues:S.keys(),locale:t}),c.isTemporal&&c.dataType==="String"&&!c.isMeasure){let N=zt(S.keys(),t);N&&(c.temporalTextPattern=N.pattern)}if(c.isTemporal&&!c.isMeasure){let N=Et(S.keys(),{includeBounds:r>=20,pattern:c.temporalTextPattern,locale:t});N&&(c.temporalCadence=N)}this.updateColumnStats10(r,c,C,S,O,L,F),this.updateColumnStats20(r,P,C,D,c,k,z,F,L,O,S,t),Wt(c,this._declaredDimensions.has(c),{distinct:S.size,nonblank:C,prec:O,minval:F,maxval:L})&&(c.isMeasure=!0,c.geoKind=void 0,c.geoMatchPct=void 0,c.geoAmbiguous=void 0,c.dominantGeoRegion=void 0,c.dominantGeoRegionPct=void 0,c.geoRegionCount=void 0),i[s]=c.isMeasure||S.size>2e3?null:new Set(S.keys()),o[s]=S.size,l[s]=S.size===2?[...S.keys()].sort():null,s++}let a=[];this._cols.forEach((c,S)=>{c.isMeasure||a.push({idx:S,distinct:c.distinctCount??0,name:c.name})}),this._cols.forEach((c,S)=>{if(!c.isMeasure)return;let P=typeof c.lowValue=="number"?c.lowValue:null,k=typeof c.highValue=="number"?c.highValue:null,C=Hr({rows:this._rows,measureColIdx:S,measureName:c.name,candidateDims:a,minNum:P,maxNum:k,discourageAgg:!!c.discourageAggregationAcrossGroups});c.additivity=C.additivity,C.partOfWholeDim&&(c.partOfWholeDim=C.partOfWholeDim)});let g=50,d=4,m=a.filter(c=>c.distinct>=2&&c.distinct<=g);this._cols.forEach((c,S)=>{if(!c.isMeasure)return;let P=[];for(let E of this._rows){let v=E[S];if(v==null||v==="")continue;let $=typeof v=="number"?v:parseFloat(v);isNaN($)||P.push($)}if(P.length===0)return;let k=[...P].sort((E,v)=>E-v);if(k[0]===k[k.length-1])c.relativeDispersion=0;else if(k.length>=d){let E=X(k,.5),v=X(k,.1),$=X(k,.9);c.relativeDispersion=Math.abs(E)>1e-9?Math.round(($-v)/Math.abs(E)*1e3)/1e3:void 0}else c.relativeDispersion=void 0;let C=[];for(let E of m){let v=new Set;for(let $ of this._rows){let N=$[S];N==null||N===""||v.add(this.STR($[E.idx])+"")}C.push({otherColumn:E.name,nonBlankGroupCount:v.size})}C.length>0&&(c.nonBlankGroups=C);let O=0;for(let E of P)O+=E;O/=P.length;let F=0;for(let E of P)F+=(E-O)*(E-O);if(F<=1e-12)return;let L=[],D=[],z=E=>{if(E.length<4)return NaN;let v=[...E].sort((N,w)=>N-w),$=N=>v[Math.min(v.length-1,Math.max(0,Math.floor(N*(v.length-1))))];return $(.75)-$(.25)},W=z(P);for(let E of m){let v=new Map;for(let w of this._rows){let B=w[S];if(B==null||B==="")continue;let V=typeof B=="number"?B:parseFloat(B);if(isNaN(V))continue;let Y=this.STR(w[E.idx])+"",te=v.get(Y);te?(te.s+=V,te.n++,te.vals.push(V)):v.set(Y,{s:V,n:1,vals:[V]})}let $=0;for(let w of v.values()){let B=w.s/w.n;$+=w.n*(B-O)*(B-O)}L.push({otherColumn:E.name,eta2:Math.round($/F*1e4)/1e4});let N=[];for(let w of v.values()){let B=z(w.vals);isNaN(B)||N.push(B)}if(N.length>=2&&isFinite(W)&&W>1e-9){let w=(Math.max(...N)-Math.min(...N))/W;D.push({otherColumn:E.name,spreadRatio:Math.round(w*1e4)/1e4})}}L.length>0&&(c.groupDiscrimination=L),D.length>0&&(c.spreadDiscrimination=D)});let u=.97,_=.8,M=8,I=5,A=this._cols.map((c,S)=>({c,i:S})).filter(c=>c.c.isMeasure);for(let c=0;c<A.length;c++)for(let S=c+1;S<A.length;S++){let P=A[c].i,k=A[S].i,C=0,O=0,F=0,L=0,D=0,z=0;for(let N of this._rows){let w=N[P],B=N[k];if(w==null||w===""||B===null||B===void 0||B==="")continue;let V=typeof w=="number"?w:parseFloat(w),Y=typeof B=="number"?B:parseFloat(B);isNaN(V)||isNaN(Y)||(C++,O+=V,F+=Y,L+=V*V,D+=Y*Y,z+=V*Y)}if(C<I)continue;let W=C*L-O*O,E=C*D-F*F;if(W<=1e-12||E<=1e-12)continue;let v=(C*z-O*F)/Math.sqrt(W*E),$=Math.min(1,Math.round(Math.abs(v)*1e3)/1e3);for(let N of[A[c].c,A[S].c])(N.maxAbsMeasureCorrelation===void 0||$>N.maxAbsMeasureCorrelation)&&(N.maxAbsMeasureCorrelation=$);if(Math.abs(v)>=u){let N=A[c].c,w=A[S].c;N.collinearWithMeasures||(N.collinearWithMeasures=[]),w.collinearWithMeasures||(w.collinearWithMeasures=[]),N.collinearWithMeasures.push(w.name),w.collinearWithMeasures.push(N.name)}else if(Math.abs(v)>=_){let N=A[c].c,w=A[S].c,B=Math.round(v*1e3)/1e3;N.correlatedWithMeasures||(N.correlatedWithMeasures=[]),w.correlatedWithMeasures||(w.correlatedWithMeasures=[]),N.correlatedWithMeasures.push({otherColumn:w.name,r:B}),w.correlatedWithMeasures.push({otherColumn:N.name,r:B})}}for(let{c}of A)c.correlatedWithMeasures&&(c.correlatedWithMeasures.sort((S,P)=>Math.abs(P.r)-Math.abs(S.r)||(S.otherColumn<P.otherColumn?-1:1)),c.correlatedWithMeasures.length=Math.min(c.correlatedWithMeasures.length,M));for(let c=0;c<this._cols.length;c++){let S=i[c];if(!S||S.size===0)continue;let P=[];for(let k=0;k<this._cols.length;k++){if(k===c)continue;let C=i[k];if(!C||C.size===0)continue;let O=0;for(let L of S)C.has(L)&&O++;let F=Math.round(O/S.size*100);F>0&&P.push({otherColumn:this._cols[k].name,percentShared:F})}P.length>0&&(this._cols[c].sharedValueRatioWithOthers=P)}let p=50,f=[];for(let c=0;c<this._cols.length;c++){let S=i[c];S&&S.size>=2&&S.size<=p&&f.push(c)}if(f.length>=2){let c=new Map,S=(k,C)=>k+":"+C;for(let k=0;k<f.length;k++)for(let C=k+1;C<f.length;C++)c.set(S(f[k],f[C]),new Map);for(let k of this._rows)for(let C=0;C<f.length;C++){let O=this.STR(k[f[C]])+"";for(let F=C+1;F<f.length;F++){let L=""+this.STR(k[f[F]]),D=c.get(S(f[C],f[F])),z=O+""+L;D.set(z,(D.get(z)??0)+1)}}let P=new Map;for(let k=0;k<f.length;k++)for(let C=k+1;C<f.length;C++){let O=f[k],F=f[C],L=i[O].size,D=i[F].size,z=c.get(S(O,F)),W=z.size,E=0;for(let w of z.values())(E===0||w<E)&&(E=w);let v=Math.round(W/(L*D)*100),$=W===L,N=W===D;if((this._cols[O].categoricalPairStats||=[]).push({otherColumn:this._cols[F].name,fillPct:v,determinesOther:$,minCellCount:E,distinctCombinations:W}),(this._cols[F].categoricalPairStats||=[]).push({otherColumn:this._cols[O].name,fillPct:v,determinesOther:N,minCellCount:E,distinctCombinations:W}),$&&L>D){let w=P.get(O);(!w||D<w.card)&&P.set(O,{name:this._cols[F].name,card:D,ratio:D/L})}if(N&&D>L){let w=P.get(F);(!w||L<w.card)&&P.set(F,{name:this._cols[O].name,card:L,ratio:L/D})}}for(let[k,C]of P)this._cols[k].primaryParentColumn=C.name,this._cols[k].nestingRatio=Math.round(C.ratio*100)/100}let b=6,y=this._rows.length;for(let c=0;c<this._cols.length;c++){let S=this._cols[c];if(S.isMeasure||S.primaryParentColumn)continue;let P=S.distinctCount??0;if(P<=p||y>0&&P>=y)continue;let k=[];for(let C=0;C<this._cols.length;C++){if(C===c)continue;let O=this._cols[C];if(O.isMeasure)continue;let F=O.distinctCount??0;F<2||F>=P||k.push(C)}k.sort((C,O)=>(this._cols[C].distinctCount??0)-(this._cols[O].distinctCount??0));for(let C of k.slice(0,b)){let O=new Map,F=!0;for(let D of this._rows){let z=this.STR(D[c])+"",W=this.STR(D[C])+"",E=O.get(z);if(E===void 0)O.set(z,W);else if(E!==W){F=!1;break}}if(!F)continue;let L=this._cols[C].distinctCount??0;S.primaryParentColumn=this._cols[C].name,S.nestingRatio=Math.round(L/P*100)/100;break}}let x=.01,h=.05,R=.95,T=8,U=8,G=6,j=500,K=[];for(let c=0;c<this._cols.length&&K.length<U;c++){let S=this._cols[c].dataType;(S==="Double"||S==="Integer"||S==="Decimal")&&K.push(c)}if(K.length>=3&&this._rows.length>=T){let c=Math.min(this._rows.length,j),S=K.map(L=>{let D=[];for(let E=0;E<c;E++){let v=this._rows[E][L],$=typeof v=="number"?v:parseFloat(String(v).replace(/,/g,""));if(v==null||v===""||!isFinite($))return null;D.push($)}let z=D[0],W=!1;for(let E of D)if(E!==z){W=!0;break}return W?D:null}),P=K.map((L,D)=>D).filter(L=>S[L]!==null),k=L=>{let D=L.slice().sort((W,E)=>W-E),z=D.length>>1;return D.length%2?D[z]:(D[z-1]+D[z])/2},C=null,O=[],F=L=>{if(O.length>=3){let D=O.map(v=>S[v]),z=D[0].length,W=new Array(z);for(let v=0;v<z;v++){let $=0;for(let N of D)$+=N[v];W[v]=$}let E=k(W);if(E>0){let v=0;for(let N of W)Math.abs(N-E)<=E*x&&v++;let $=v/z;if($>=R){let N=1;for(let w of D){let B=k(w)/E;B<N&&(N=B)}N>=h&&(!C||O.length>C.cols.length)&&(C={cols:O.slice(),total:E,matched:$})}}}if(!(O.length>=G))for(let D=L;D<P.length;D++)O.push(P[D]),F(D+1),O.pop()};if(F(0),C){let L=C,z={columns:L.cols.map(W=>this._cols[K[W]].name),total:Math.round(L.total*1e3)/1e3,matchedPct:Math.round(L.matched*100)/100};for(let W of L.cols)this._cols[K[W]].constantSumGroup=z}}return this.applyTwoSetPairing(t,i),this.applyScoreSeparation(o,l),this.applySeriesCompleteness(r,t,i),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,t){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let s=Pt({rows:this._rows,columns:this._cols.map((r,i)=>{let o=t[i];return{name:r.name,values:o,distinct:o?o.size:r.distinctCount??0,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:xe(r.name),temporalTextPattern:r.temporalTextPattern}}),text:r=>this.STR(r),locale:e});s&&(this._cols[s.key].twoSetPairing=s.pairing,this._cols[s.discriminator].twoSetPairing=s.pairing)}applyScoreSeparation(e,t){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let s=Ft({rows:this._rows,columns:this._cols.map((r,i)=>({name:r.name,dataType:r.dataType,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:xe(r.name),isBinaryFlag:!!r.isBinaryFlag,distinct:e[i]??0,twoValues:t[i]??null})),text:r=>this.STR(r)});for(let[r,i]of s)this._cols[r].scoreSeparation=i}applySeriesCompleteness(e,t,s){for(let u of this._cols)u.seriesCompleteness!==void 0&&delete u.seriesCompleteness;let r=this._cols.map((u,_)=>({c:u,i:_})).filter(({c:u})=>u.isTemporal&&!u.isMeasure&&u.temporalCadence&&u.temporalCadence.grain!=="irregular");if(r.length===0)return;let i=[],o=[];this._cols.forEach((u,_)=>{let M=s[_];M&&(i.push(_),o.push({name:u.name,dataType:u.dataType,isMeasure:!!u.isMeasure,isTemporal:!!u.isTemporal,isDatePart:!!u.isDatePart,isReassembledDate:!!u.isReassembledDate,isBinaryFlag:!!u.isBinaryFlag,geoKind:u.geoKind,identifierNamed:xe(u.name),values:M,rows:this._rows.length,locale:t}))});let l=Dt(o);if(l<0)return;let a=i[l],g=this._cols[a],d=this._rows.map(u=>this.STR(u[a])),m=e>=20&&(g.dataType!=="String"||Array.isArray(g.safeDistinctValues));for(let{c:u,i:_}of r){let M=Ot({periods:this._rows.map(I=>this.STR(I[_])),series:d,seriesColumn:g.name,pattern:u.temporalTextPattern,locale:t,includeDates:e>=20,includeNames:m});M&&(u.seriesCompleteness=M)}}updateColumnStats20(e,t,s,r,i,o,l,a,g,d,m,u){if(e>=20){let _=[...t].sort((A,p)=>A-p),M=Math.floor(_.length/2);if(s>0&&r!=null?i.avgValue=i.dataType=="Integer"?Math.round(r/s):r/s:i.avgValue=null,s>0&&(i.avgLength=o/s),this._rows.length>0){let A=p=>{let f=p instanceof Date?p:typeof p=="string"?Me(p)??new Date(p):new Date(p),b=this.wholeDayIso(f);return b?b+"T00:00:00.000Z":isNaN(f.getTime())?p:f.toISOString().slice(0,10)+"T00:00:00.000Z"};i.dataType!="DateTime"||l||!a?i.lowValue=a:i.lowValue=A(a),i.dataType!="DateTime"||l||!g?i.highValue=g:i.highValue=A(g),i.medianValue=_.length===0?null:_.length%2===0?i.dataType=="Integer"?Math.round((_[M-1]+_[M])/2):(_[M-1]+_[M])/2:_[M],i.numericPrecision=d}if(_.length>0){let A=i.avgValue??0,p=_.length,f=0,b=0;for(let x of _){let h=x-A;f+=h*h,b+=h*h*h}let y=f/p;i.skewness=y===0?0:b/p/Math.pow(Math.sqrt(y),3),i.stdDev=Math.sqrt(y)}r!==null&&(i.sum=r);let I=Array.from(m.entries()).sort((A,p)=>p[1]-A[1]);if(i.topCategories=I.slice(0,10).map(A=>A[1]),!i.isMeasure&&I.length>0&&(i.dataType!=="String"&&(i.topCategoryValues=I.slice(0,5).map(A=>A[0])),e>=20)){let A=I.map(f=>f[0]),p=de(A,u);if(p!==null)i.ordinalPattern=p.pattern,i.orderedDomain=p.orderedDomain;else if(i.dataType==="String"){let f=Je(A);f!==null&&(i.safeDistinctValues=f)}}if(_.length>=8&&(i.dataType==="Integer"||i.dataType==="Decimal")){let A=p=>_[Math.floor((_.length-1)*p)];i.quantiles={p05:A(.05),p25:A(.25),p75:A(.75),p95:A(.95)}}}if(!i.isMeasure&&i.dataType==="String"&&m.size>0){let _=Array.from(m.entries()).sort((A,p)=>p[1]-A[1]).map(A=>A[0]);i.formatSignature=fe(_);let M=s>0?o/s:void 0,I=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;i.formatSignature&&!I.test(i.formatSignature)&&(M===void 0||M>=3)&&(i.isFreeText=!0)}if(!i.isMeasure&&m.size>0){let _=Array.from(m.entries()).sort((I,A)=>A[1]-I[1]),M=nt(_.map(I=>I[0]),i.name,u);if(M!==null&&(i.geoKind=M.geoKind,i.geoMatchPct=M.geoMatchPct,M.geoAmbiguous&&(i.geoAmbiguous=!0),M.geoKind.indexOf("country")===0)){let I=Te(_);I&&(i.dominantGeoRegion=I.dominantGeoRegion,i.dominantGeoRegionPct=I.dominantGeoRegionPct,i.geoRegionCount=I.regionCount)}}}updateColumnStats10(e,t,s,r,i,o,l){let a=this._rows.length-s;e>=10&&(t.blankCount=a),t.distinctCount=r.size+(a!=0?1:0),t.valueNature="Categorical",s>0&&(t.dataType==="Integer"||t.dataType==="Decimal"?t.valueNature=$t({dataType:t.dataType,isMeasure:!!t.isMeasure,name:t.name,distinct:r.size,nonblank:s,prec:i,maxval:o,minval:l}):t.dataType==="DateTime"&&(t.valueNature=t.dateWithTime?"Continuous":"Ordinal"))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((s,r)=>{s.isMeasure||e.push(r)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let t=new Set;for(let s of this._rows)t.add(JSON.stringify(e.map(r=>s[r])));return this._leafCardinality=t.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>We(o,{camel:!0}),t=-1,s=-1,r=-1;if(this._cols.forEach((o,l)=>{let a=e(o.name),g=o.dataType==="Integer"||o.dataType==="Decimal";g&&t<0&&a.some(d=>d==="lat"||d==="latitude")?t=l:g&&s<0&&a.some(d=>d==="lon"||d==="lng"||d==="long"||d==="longitude")&&(s=l),r<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(r=l)}),t<0||s<0)return null;let i=[];for(let o of this._rows){let l=o[t],a=o[s],g=l==null||l===""?null:Number(l),d=a==null||a===""?null:Number(a);i.push({lat:g,lon:d,country:r>=0&&he(this.STR(o[r]))?this.STR(o[r]):null})}return this._geoExtent=ot(i),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;obfuscateString(e){return Rt(e,Ye)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(t=>{let s={};this._cols.forEach((r,i)=>{s[r.name]=t[i],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(s,r.hostName)&&(s[r.hostName]=t[i])});for(let[r,i]of e)Object.prototype.hasOwnProperty.call(s,i.alias)||(s[i.alias]=t[r]);return s})}async getCSVAsync(e){let t=[],s=e?25:1e7,r=e?4e3:1e7,i=new Map;for(let l of this._rows){let a={};for(let g=0;g<this._cols.length;g++){let d=this._cols[g],m=l[g];if(this.STR(m)!=""){if(e&&d.dataType=="String")if(i.has(m))m=i.get(m);else{let u=this.obfuscateString(m);i.set(m,u),m=u}else if(d.dataType=="DateTime"&&!d.dateWithTime){let u=m instanceof Date?m:typeof m=="string"?Me(m)??new Date(m):new Date(m);m=(this.wholeDayIso(u)??u.toISOString().slice(0,10))+"T00:00:00.000Z"}r-=this.STR(m).length}else m=null;a[g]=m,--r}if(t.push(a),--s,s<=0||r<=0)break}return await Bt.unparse(t,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return Bt.unparse([this._cols.map((t,s)=>{if(this.emitLegacyAggAliases&&t.hostName)return this.STR(t.hostName);let r=e.get(s);return this.STR(r&&r.headerName?r.alias:t.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(t=>t==null?null:this.STR(t)),this._englishAliases=new Map}aliasesForCode(e){let t=ve(e,this._cols)?this.legacyAliases():[];for(let s of this.englishAliasesFor(e).values())t.push({name:s.name,alias:s.alias,reason:"english-implicit-agg"});return t}armAliasesForCode(e){return this.emitLegacyAggAliases=ve(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let t of this.liveEnglishAliases().values())e.push({name:t.name,alias:t.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let t of this._cols)t&&t.hostName&&t.hostName!==t.name&&e.push({name:this.STR(t.name),alias:this.STR(t.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let t=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return t;let s=String(e),r=new Set;for(let o of this._cols)o&&(r.add(this.STR(o.name)),o.hostName&&r.add(this.STR(o.hostName)));let i=new Map;for(let o=0;o<this._cols.length;o++){if(!this._cols[o])continue;let l=bt(this._hostQueryNames[o]).filter(a=>!r.has(a)&&oe(s,a));l.length===1&&i.set(l[0],[...i.get(l[0])??[],o])}for(let[o,l]of i){if(l.length!==1)continue;let a=this.STR(this._cols[l[0]].name);t.set(l[0],{name:a,alias:o,headerName:!oe(s,a)})}return t}liveEnglishAliases(){let e=new Map;for(let[t,s]of this._englishAliases){let r=this._cols?this._cols[t]:null;r&&this.STR(r.name)===s.name&&e.set(t,s)}return e}addRow(e,t){if(this.dedupRows){let s="";for(let i of e)s+=this.STR(i)+"~";let r=He(s);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(Yr(e)),this._inferredMeasureFlags=null,this._origIndices.push(t??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}reset(){this._inferredMeasureFlags=null,this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map}setColumns(e){if(this._inferredMeasureFlags=null,this._cols=e,!e||e.length===0)return;let t=new Set(e.map(s=>this.STR(s?.name)));for(let s of e){if(!s)continue;let r=this.STR(s.name),i=ht(r);!i||i===r||t.has(i)||(t.delete(r),t.add(i),s.hostName=r,s.name=i)}}};export{ot as a,Kt as b,he as c,Zr as d,ut as e,rn as f,sn as g,on as h,an as i,Se as j,hn as k,ht as l,ve as m,bt as n,At as o,An as p,xt as q,Ct as r,ri as s,ii as t,si as u,Cn as v,Mn as w,Tn as x,Mt as y,oe as z,Fn as A,di as B,Bn as C,Wn as D,re as E,Et as F,er as G,tr as H,nr as I,ar as J,Dt as K,Ot as L,xe as M,zt as N,Vr as O,Kr as P,Hr as Q,$t as R,Wt as S,Yr as T,Gt as U};