@bicharts/shape-core 0.6.102 → 0.6.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-AMMJRSAC.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/ingest.mjs +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ingest.d.ts +3 -3
- package/dist/types/models.d.ts +20 -0
- package/package.json +1 -1
- package/dist/chunk-YVP6AMZB.mjs +0 -2
|
@@ -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{N as I,V as A,e as R}from"./chunk-CQS6BGRJ.mjs";import{a as h,c as x,d as E,e as L}from"./chunk-A4PQBWRA.mjs";import{u as C}from"./chunk-CZJ7M6A5.mjs";import M from"papaparse";var k=500,j=/^[+-]?\d{1,15}$/,N=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,O=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function _(e,o=".",t=!1){if(t)return"DateTime";let r=0,s=0,i=0,l=0;for(let c of e){if(c==null)continue;if(typeof c=="number"){l++,s++,Number.isInteger(c)&&r++;continue}if(c instanceof Date){l++,i++;continue}if(typeof c=="boolean"){l++;continue}let m=String(c).trim();if(m!==""){if(l++,j.test(h(m))){r++,s++;continue}if(L(m,o)){s++;continue}if((N.test(m)||O.test(m))&&!isNaN(Date.parse(m))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":s===l?"Decimal":"String"}function $(e,o,t=".",r=null){if(e==null)return null;if(typeof e=="number")return o==="String"?String(e):e;if(e instanceof Date)return o==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let s=String(e).trim();if(s==="")return null;switch(o){case"Integer":{let i=h(s);return j.test(i)?parseInt(i,10):null}case"Decimal":return E(s,t);case"DateTime":return r?r.read(s):C(s);default:return s}}function q(e){let o=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(o)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(o)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(o)?"DateTime":(/^(bit|bool|boolean)$/.test(o),"String")}function*F(e,o){for(let t of e)yield t?.[o]}function g(e,o,t){if(e.length===0)throw new Error("ingest: no columns were resolved from the source. Supply column descriptors, or use a source shape that carries them (grid/table/objects/sql).");let r=e.length,s=e.map((n,a)=>o.slice(0,k).map(u=>u?.[a])),i=s.map(n=>x(n,t.locale)),l=e.map((n,a)=>n.dataType===void 0||n.dataType==="DateTime"?R(F(o,a),{locale:t.locale??"en"}):null),c=e.map((n,a)=>n.dataType??_(s[a],i[a],l[a]!==null)),m=new Set((t.measures??[]).map(n=>n.toLowerCase())),b=new Set((t.dimensions??[]).map(n=>n.toLowerCase())),P=new Set((t.nonAdditive??[]).map(n=>n.toLowerCase())),D=e.map((n,a)=>{let u=n.name.toLowerCase(),f=n.isMeasure??((c[a]==="Integer"||c[a]==="Decimal")&&!I(n.name));m.has(u)&&(f=!0),b.has(u)&&(f=!1);let T={name:n.name,dataType:c[a],isMeasure:f};return f&&P.has(u)&&(T.discourageAggregationAcrossGroups=!0),T}),d=new A;d.dedupRows=t.dedup!==!1,d.setColumns(D),d.declareDimensions(D.filter((n,a)=>b.has(e[a].name.toLowerCase())));for(let n=0;n<o.length;n++){let a=o[n];d.addRow(Array.from({length:r},(u,f)=>$(a?.[f],c[f],i[f],l[f])),n)}let p=d.getColumnsWithStats(t.privacyLevel??"20",t.locale??"en"),S=new Map(p.map(n=>[n.name,n]));e.forEach(n=>{let a=S.get(n.name);a&&(n.format&&(a.modelFormat=n.format),n.description&&(a.modelDesc=n.description))});let y=n=>{let a=S.get(n);if(a)return[a];let u=n.toLowerCase();return p.filter(f=>f.name.toLowerCase()===u)};for(let[n,a]of Object.entries(t.formats??{}))for(let u of y(n))u.modelFormat=a;for(let[n,a]of Object.entries(t.descriptions??{}))for(let u of y(n))u.modelDesc=a;for(let n of t.groupBy??[])for(let a of y(n))a.isGrouping=!0;return{columns:p,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function w(e,o){return e.map(t=>Array.isArray(t)?t:o.map(r=>t[r]))}function V(e,o){let t=[],r=new Set,s=Math.min(e.length,Math.max(1,o));for(let i=0;i<s;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))r.has(c)||(r.add(c),t.push(c))}return t}function v(e){let o=String(e??"").replace(/^\uFEFF/,""),t=[],r=[],s=0;return M.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,c=o.slice(s,l);s=l,i.errors?.length&&r.push(...i.errors);let m=i.data;m.length===1&&m[0]===""&&c.replace(/[\r\n]/g,"")===""||t.push(m)}}),!t.length&&!r.length&&r.push(...M.parse(o,{skipEmptyLines:!0}).errors),{rows:t,errors:r}}function Y(e,o={}){switch(e.kind){case"csv":{let t=v(e.text);if(t.errors.length&&t.rows.length===0)throw new Error(`ingest: CSV parse failed - ${t.errors[0].message}`);let r=t.rows;if(r.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let s=r[0].map(i=>(i??"").trim());return g(s.map(i=>({name:i})),r.slice(1),o)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return g(e.header.map(t=>({name:(t??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let t=e.columns.map(r=>r.name);return g(e.columns,w(e.rows??[],t),o)}case"objects":{let t=e.rows??[],r=e.columns?.length?e.columns:V(t,o.columnScanLimit??k).map(s=>({name:s}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return g(r,w(t,r.map(s=>s.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let t=e.schema.map(r=>{let s=q(r.dataType);return{name:r.name,dataType:s,isMeasure:r.isMeasure,format:r.format,description:r.description}});return g(t,w(e.rows??[],t.map(r=>r.name)),o)}default:{let t=e;throw new Error(`ingest: unknown source kind '${t?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{q as a,v as b,Y as c};
|
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 Jn,b as Zn}from"./chunk-HIVICMC5.mjs";import{a as er,b as I,c as tr,d as D,e as E,f as nr,g as X,h as J}from"./chunk-4J7WPYLM.mjs";import{a as Yn,b as Qn,c as Xn}from"./chunk-YVP6AMZB.mjs";import{A as Pn,B as vn,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,T as Bn,V as jn,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-CQS6BGRJ.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 v,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 Pt,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 vt,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)&&!v(a)).length,o=t.filter(a=>!te(a)&&!!v(a)).length;return n>=1&&n>=o}function ce(e,t){if(!v(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)v(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 rr(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 or(e,t){let n=0;for(let o of oe(e))t(o)&&n++;return n}function ir(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=>!!v(G)),Fe=ee(S,G=>!!v(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)&&!(or(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=rr(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")}),sr=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 ar(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 lr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of ar(n,t)){let a=ie[o];if(a&&a.langs.includes(t))return a.part}return null}function ur(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 cr=/\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)),cr.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 dr(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 mr(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 fr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function 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 pr(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),P=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},gr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Re(e,t){let n={};for(let[o,a]of gr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function yr(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 hr(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:yr(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:P(t("isServiceError")),isRateLimited:P(t("isRateLimited")),suppressSelectionGlyph:P(t("suppressSelectionGlyph")),isRefusal:P(t("isRefusal")),isVersionNotFound:P(t("isVersionNotFound")),isGenerationCancelled:P(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 Cr(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:P(l("isPreview")),alsoWorthALook:P(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:P(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 br(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 Er(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 Tr="FREEMIUM_ATTEMPT_SPENT",Sr="CLIENT_SECRET_MISMATCH",Rr="FREEMIUM_COLUMN_CAP",xr="OAUTH_TOKEN_EXPIRED",wr="OAUTH_SIGNED_OUT";function _r(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function Or(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 Pr(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 Lr(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 Ar(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function Mr(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function Ir(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function Nr(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 Fr={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 Dr(e){let t=Oe(e);return t?{qualifyOrder:t}:{}}function Pe(e,t){return e!=null&&t!=null&&e!==t}function kr(e,t){return e?Pe(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 Gr=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function ve(e){let t=String(e??"").trim().toLowerCase();return Gr[t]??t}function Le(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",ve(n.dataType)]);return t}function Vr(e){return j(Le(e))}var Ur=2,Wr=3,qr=4,$r=64,zr=8e3,Hr=6e4,Kr=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),Br=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function jr(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function Yr(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 Qr(){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 Xr(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 Jr(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 Zr(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 eo(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=Zr(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 to="/LLMChart/",no="/LLMChart/qualify",ro="/VisionReview/",oo="/LLMChart/sample",io="/RefundGenerate/",so=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",H=async e=>JSON.parse(await e.text());function ao(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function lo(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&&so(_),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)ao(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",to,I(g),c,y=>J(y,p))},async qualify(g,f){let c=h("qualify",f),p=c.route??no;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",ro,p,c,H)},async sample(g,f){let c=h("sample",f);return b("sample",oo,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",io,JSON.stringify(T),p,H)}}}export{Y as CITY_ROLE_MATCH_PCT,Kr as CLIENT_EVENT_KINDS,Sr 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,sr 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,Br as DRAW_REASONS,Tr as FREEMIUM_ATTEMPT_SPENT,Rr 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,jn as IndexedText,Lt as LOOSE_KEY_MIN_LENGTH,Mt as LooseIndex,An as MAX_RUN_BOUNDS,wr as OAUTH_SIGNED_OUT,xr 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,Jn as PREVIEW_OMITTED_FIELDS,we as PROGRESS_STAGE_IDS,Fr 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,qr as SEV_ERROR,Ur as SEV_INFO,$r as SEV_USER_PRESENTED,Wr as SEV_WARNING,j as SIMPLE_STRING_HASH,nt as STR,et as SUBSTRING_MIN,De as SUPPORTED_LANGUAGES,ke as SUPPORTED_LANGUAGE_CODES,Hr as TELEMETRY_TIMEOUT_DEV_MS,zr 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,_r as answerIsRetryable,Yt as buildGeoIsoColumn,$t as buildGeoPointColumns,Et as calendarWordIn,Ar as capabilityFields,Ht as cityMatchPct,zt as cityTagsFor,Hn as classifyAdditivity,Yr as classifyDraw,Cn as classifyForAggregation,Kn as classifyNumericValueNature,$n as classifyTemporal,pn as codeNeedsLegacyAggNames,On as codeReadsColumn,Pn as codeReadsColumnsByRoleOrPosition,fn as collapseRepeatedAggPrefix,vn as columnsTheCodeReads,Jt as countryRegion,Qr as createDrawLedger,lo as createGenerateClient,Jr as createTelemetryClient,Or as credentialFields,Nr as dataCompletenessFields,lr as dateLevelPart,ur 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,qn as detectTextDatePattern,jr as drawLocation,I as encodePayload,Yn as engineTypeForSqlType,gn as englishImplicitAggNames,se as eventLogLine,Lr as fetchFields,eo as fetchTransport,qe as foldName,pr as freemiumColumnCapRefusal,Ee as freemiumColumnsOverCap,Te as freemiumDateHierarchyClauses,Xe as gluedPrefixStems,fr as guardColumnNames,er as gzipWireText,Ze as hangulWordEndsWith,mn as hasDefaultAggPrefix,Ke as hasUnsegmentedScript,zn as hostAggHint,Xn as ingest,Tn as isAggregationAllowed,V as isBlankLike,kt as isCityTableLoaded,z as isColumnContextRef,ot as isDeterministicRefusal,Xr as isEventLogCode,Wt as isGeoPointAmbiguity,Wn as isIdentifierName,jt as isJoinGeoKind,nr as isNdjsonContentType,It as isOrdinalFriendlyName,At as isUsableLooseKey,tr as keyedSigner,Ir as leafCardinalityField,ct as localMidnightDateColumns,ut as localMidnightToUtcDay,pt as localWallClockDateColumns,St as localizedCycleIn,_n as localizedIdentifierWordIn,Tt as localizedYearWordIn,N as looksLikeCountryColumn,vt as looseNameKey,tt as matchNameToken,vr as maxNonMeasureCardinality,In as measureCadence,Un as measurePersistence,Vn as measureSeriesCompleteness,D as messageSignature,mr as missingHardColumnRefs,sn as monthLookupFor,ze as nameLetterRuns,hn as nameLooksIntensiveRate,yn as nameLooksPositional,he as nameProbeIsGuarded,dr as nameProbeKeepsDrawing,$e as nameWords,Gt as normalizeCountry,dt as normalizeLocalMidnightDates,on as normalizeMonthKey,U as normalizePlaceName,Ut as normalizeZip5,kr as offeredShortlistFor,Qn as parseCsvRows,st as parseDateStable,hr as parseGenerateResponse,rn as parseNumberText,Cr as parseQualifyResponse,br as parseReviewVerdict,Mn as parseTemporalPoint,Zn as payloadPreview,Pt as periodCodeSeries,Gn as pickSeriesColumn,Er as progressStageOf,Bn as promotesToMeasure,Dr 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,v as resolveAdmin1,_e as resolveFetchVersion,qt as resolveGeoPoint,We as resolveLanguage,ir as resolvePointRoles,Mr as retryFields,Nt as safeDistinctValuesToShip,Le as schemaIdentity,Vr as schemaIdentityKey,ve as schemaTypeFamily,kn as seriesKeyVerdict,Sn as shareOfTotalIsHonest,Pe as shortlistIsStale,dn as stripHostAggPrefix,Zt as summarizeCountryRegions,Qt as summarizeGeoExtent,Ge as supportedLanguage,Bt as toGeoIso,Be as unsegmentedRuns,mt as utcWallClock,Pr 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};
|
|
2
|
+
import{a as Jn,b as Zn}from"./chunk-HIVICMC5.mjs";import{a as er,b as I,c as tr,d as D,e as E,f as nr,g as X,h as J}from"./chunk-4J7WPYLM.mjs";import{a as Yn,b as Qn,c as Xn}from"./chunk-AMMJRSAC.mjs";import{A as Pn,B as vn,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,T as Bn,V as jn,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-CQS6BGRJ.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 v,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 Pt,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 vt,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)&&!v(a)).length,o=t.filter(a=>!te(a)&&!!v(a)).length;return n>=1&&n>=o}function ce(e,t){if(!v(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)v(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 rr(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 or(e,t){let n=0;for(let o of oe(e))t(o)&&n++;return n}function ir(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=>!!v(G)),Fe=ee(S,G=>!!v(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)&&!(or(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=rr(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")}),sr=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 ar(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 lr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of ar(n,t)){let a=ie[o];if(a&&a.langs.includes(t))return a.part}return null}function ur(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 cr=/\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)),cr.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 dr(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 mr(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 fr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function 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 pr(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),P=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},gr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Re(e,t){let n={};for(let[o,a]of gr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function yr(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 hr(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:yr(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:P(t("isServiceError")),isRateLimited:P(t("isRateLimited")),suppressSelectionGlyph:P(t("suppressSelectionGlyph")),isRefusal:P(t("isRefusal")),isVersionNotFound:P(t("isVersionNotFound")),isGenerationCancelled:P(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 Cr(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:P(l("isPreview")),alsoWorthALook:P(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:P(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 br(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 Er(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 Tr="FREEMIUM_ATTEMPT_SPENT",Sr="CLIENT_SECRET_MISMATCH",Rr="FREEMIUM_COLUMN_CAP",xr="OAUTH_TOKEN_EXPIRED",wr="OAUTH_SIGNED_OUT";function _r(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function Or(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 Pr(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 Lr(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 Ar(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function Mr(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function Ir(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function Nr(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 Fr={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 Dr(e){let t=Oe(e);return t?{qualifyOrder:t}:{}}function Pe(e,t){return e!=null&&t!=null&&e!==t}function kr(e,t){return e?Pe(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 Gr=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function ve(e){let t=String(e??"").trim().toLowerCase();return Gr[t]??t}function Le(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",ve(n.dataType)]);return t}function Vr(e){return j(Le(e))}var Ur=2,Wr=3,qr=4,$r=64,zr=8e3,Hr=6e4,Kr=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),Br=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function jr(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function Yr(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 Qr(){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 Xr(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 Jr(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 Zr(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 eo(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=Zr(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 to="/LLMChart/",no="/LLMChart/qualify",ro="/VisionReview/",oo="/LLMChart/sample",io="/RefundGenerate/",so=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",H=async e=>JSON.parse(await e.text());function ao(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function lo(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&&so(_),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)ao(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",to,I(g),c,y=>J(y,p))},async qualify(g,f){let c=h("qualify",f),p=c.route??no;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",ro,p,c,H)},async sample(g,f){let c=h("sample",f);return b("sample",oo,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",io,JSON.stringify(T),p,H)}}}export{Y as CITY_ROLE_MATCH_PCT,Kr as CLIENT_EVENT_KINDS,Sr 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,sr 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,Br as DRAW_REASONS,Tr as FREEMIUM_ATTEMPT_SPENT,Rr 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,jn as IndexedText,Lt as LOOSE_KEY_MIN_LENGTH,Mt as LooseIndex,An as MAX_RUN_BOUNDS,wr as OAUTH_SIGNED_OUT,xr 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,Jn as PREVIEW_OMITTED_FIELDS,we as PROGRESS_STAGE_IDS,Fr 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,qr as SEV_ERROR,Ur as SEV_INFO,$r as SEV_USER_PRESENTED,Wr as SEV_WARNING,j as SIMPLE_STRING_HASH,nt as STR,et as SUBSTRING_MIN,De as SUPPORTED_LANGUAGES,ke as SUPPORTED_LANGUAGE_CODES,Hr as TELEMETRY_TIMEOUT_DEV_MS,zr 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,_r as answerIsRetryable,Yt as buildGeoIsoColumn,$t as buildGeoPointColumns,Et as calendarWordIn,Ar as capabilityFields,Ht as cityMatchPct,zt as cityTagsFor,Hn as classifyAdditivity,Yr as classifyDraw,Cn as classifyForAggregation,Kn as classifyNumericValueNature,$n as classifyTemporal,pn as codeNeedsLegacyAggNames,On as codeReadsColumn,Pn as codeReadsColumnsByRoleOrPosition,fn as collapseRepeatedAggPrefix,vn as columnsTheCodeReads,Jt as countryRegion,Qr as createDrawLedger,lo as createGenerateClient,Jr as createTelemetryClient,Or as credentialFields,Nr as dataCompletenessFields,lr as dateLevelPart,ur 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,qn as detectTextDatePattern,jr as drawLocation,I as encodePayload,Yn as engineTypeForSqlType,gn as englishImplicitAggNames,se as eventLogLine,Lr as fetchFields,eo as fetchTransport,qe as foldName,pr as freemiumColumnCapRefusal,Ee as freemiumColumnsOverCap,Te as freemiumDateHierarchyClauses,Xe as gluedPrefixStems,fr as guardColumnNames,er as gzipWireText,Ze as hangulWordEndsWith,mn as hasDefaultAggPrefix,Ke as hasUnsegmentedScript,zn as hostAggHint,Xn as ingest,Tn as isAggregationAllowed,V as isBlankLike,kt as isCityTableLoaded,z as isColumnContextRef,ot as isDeterministicRefusal,Xr as isEventLogCode,Wt as isGeoPointAmbiguity,Wn as isIdentifierName,jt as isJoinGeoKind,nr as isNdjsonContentType,It as isOrdinalFriendlyName,At as isUsableLooseKey,tr as keyedSigner,Ir as leafCardinalityField,ct as localMidnightDateColumns,ut as localMidnightToUtcDay,pt as localWallClockDateColumns,St as localizedCycleIn,_n as localizedIdentifierWordIn,Tt as localizedYearWordIn,N as looksLikeCountryColumn,vt as looseNameKey,tt as matchNameToken,vr as maxNonMeasureCardinality,In as measureCadence,Un as measurePersistence,Vn as measureSeriesCompleteness,D as messageSignature,mr as missingHardColumnRefs,sn as monthLookupFor,ze as nameLetterRuns,hn as nameLooksIntensiveRate,yn as nameLooksPositional,he as nameProbeIsGuarded,dr as nameProbeKeepsDrawing,$e as nameWords,Gt as normalizeCountry,dt as normalizeLocalMidnightDates,on as normalizeMonthKey,U as normalizePlaceName,Ut as normalizeZip5,kr as offeredShortlistFor,Qn as parseCsvRows,st as parseDateStable,hr as parseGenerateResponse,rn as parseNumberText,Cr as parseQualifyResponse,br as parseReviewVerdict,Mn as parseTemporalPoint,Zn as payloadPreview,Pt as periodCodeSeries,Gn as pickSeriesColumn,Er as progressStageOf,Bn as promotesToMeasure,Dr 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,v as resolveAdmin1,_e as resolveFetchVersion,qt as resolveGeoPoint,We as resolveLanguage,ir as resolvePointRoles,Mr as retryFields,Nt as safeDistinctValuesToShip,Le as schemaIdentity,Vr as schemaIdentityKey,ve as schemaTypeFamily,kn as seriesKeyVerdict,Sn as shareOfTotalIsHonest,Pe as shortlistIsStale,dn as stripHostAggPrefix,Zt as summarizeCountryRegions,Qt as summarizeGeoExtent,Ge as supportedLanguage,Bt as toGeoIso,Be as unsegmentedRuns,mt as utcWallClock,Pr 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};
|
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-
|
|
2
|
+
import{a,b,c}from"./chunk-AMMJRSAC.mjs";import"./chunk-CQS6BGRJ.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};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { MeasurePersistence } from "./measurePersistence";
|
|
|
11
11
|
export { classifyForAggregation, allowedAggregations, defaultAggregation, isAggregationAllowed, shareOfTotalIsHonest, nameLooksIntensiveRate, nameLooksPositional, stripHostAggPrefix, hasDefaultAggPrefix, collapseRepeatedAggPrefix, codeNeedsLegacyAggNames, englishImplicitAggNames, INTENSIVE_WORD_TOKENS, INTENSIVE_SUFFIX_TOKENS, POSITIONAL_WORD_TOKENS, POSITIONAL_SUFFIX_TOKENS, } from "./aggregation";
|
|
12
12
|
export type { AggKind, AggAdditivity, AggBasis, AggNature, AggregationClass, AggregationColumn, } from "./aggregation";
|
|
13
13
|
export type { LLMColumnWithValue, TwoSetPairing, ScoreSeparationEntry } from "./models";
|
|
14
|
-
export type { LLMRequestModifier, SimpleColumn, VegaRendererPayload, LLMClientHints, LLMRequestCode, LLMQualifyResult, LLMRequestCodeResult, LLMResultNotice, GetLicenseStatusResult, } from "./models";
|
|
14
|
+
export type { LLMRequestModifier, SimpleColumn, VegaRendererPayload, LLMClientHints, LLMRequestCode, LLMQualifyResult, LLMRequestCodeResult, LLMResultNotice, GetLicenseStatusResult, ShareAskWire, ShareTargetWire, } from "./models";
|
|
15
15
|
export { ROLE_MATCH_PCT, CITY_ROLE_MATCH_PCT, isBlankLike } from "./matchQuality";
|
|
16
16
|
export { detectOrdinalDomain, safeDistinctValuesToShip, isOrdinalFriendlyName } from "./ordinalDetector";
|
|
17
17
|
export { detectFormatSignature } from "./formatDetector";
|
package/dist/types/ingest.d.ts
CHANGED
|
@@ -38,11 +38,11 @@ export interface IngestOptions {
|
|
|
38
38
|
measures?: string[];
|
|
39
39
|
/** Force these columns to DIMENSION, by name (case-insensitive). */
|
|
40
40
|
dimensions?: string[];
|
|
41
|
-
/** column -> format string. Overrides a descriptor's own `format`. */
|
|
41
|
+
/** column -> format string, by name (case-insensitive; an exact name wins). Overrides a descriptor's own `format`. */
|
|
42
42
|
formats?: Record<string, string>;
|
|
43
|
-
/** column -> description. Overrides a descriptor's own `description`. */
|
|
43
|
+
/** column -> description, by name (case-insensitive; an exact name wins). Overrides a descriptor's own `description`. */
|
|
44
44
|
descriptions?: Record<string, string>;
|
|
45
|
-
/** Columns that are the primary series/breakdown. Surfaces as isGrouping. */
|
|
45
|
+
/** Columns that are the primary series/breakdown, by name (case-insensitive; an exact name wins). Surfaces as isGrouping. */
|
|
46
46
|
groupBy?: string[];
|
|
47
47
|
/** MEASURE columns that must not be summed across groups (a ratio, average or rate). */
|
|
48
48
|
nonAdditive?: string[];
|
package/dist/types/models.d.ts
CHANGED
|
@@ -461,6 +461,25 @@ export type LLMResultNotice = {
|
|
|
461
461
|
severity?: string;
|
|
462
462
|
text?: string;
|
|
463
463
|
};
|
|
464
|
+
/** The share-and-rate block a landing status answer may carry (GetLicenseStatusResult.shareAsk, and the Excel
|
|
465
|
+
* view-status answer's). Either casing is accepted, because the hosts' status calls serialise differently. */
|
|
466
|
+
export interface ShareAskWire {
|
|
467
|
+
productUrl?: string;
|
|
468
|
+
ProductUrl?: string;
|
|
469
|
+
rateUrl?: string;
|
|
470
|
+
RateUrl?: string;
|
|
471
|
+
targets?: ShareTargetWire[];
|
|
472
|
+
Targets?: ShareTargetWire[];
|
|
473
|
+
}
|
|
474
|
+
/** One network in a ShareAskWire: its short id ("li", "fb", "x"), its name as drawn, and its compose window. */
|
|
475
|
+
export interface ShareTargetWire {
|
|
476
|
+
id?: string;
|
|
477
|
+
Id?: string;
|
|
478
|
+
label?: string;
|
|
479
|
+
Label?: string;
|
|
480
|
+
url?: string;
|
|
481
|
+
Url?: string;
|
|
482
|
+
}
|
|
464
483
|
export type GetLicenseStatusResult = {
|
|
465
484
|
errorMessage: string;
|
|
466
485
|
errorCode?: string;
|
|
@@ -493,6 +512,7 @@ export type GetLicenseStatusResult = {
|
|
|
493
512
|
latestVersion?: string;
|
|
494
513
|
latestVersionIsPreview?: boolean;
|
|
495
514
|
serverMs?: number;
|
|
515
|
+
shareAsk?: ShareAskWire | null;
|
|
496
516
|
defaultModelCode?: string;
|
|
497
517
|
isTrial?: boolean;
|
|
498
518
|
everPaid?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/shape-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.103",
|
|
4
4
|
"description": "Host-agnostic data-shape profiler: ingest a dataset's rows through IValueCollection.addRow and read back the measured shape as an LLMColumnWithValue[] payload — types, cardinality, temporal/ordinal detection, geographic region and point resolution, cross-column signals. MEASUREMENT only: the policy that decides what a measured shape means for chart selection lives server-side.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
package/dist/chunk-YVP6AMZB.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{N as R,V as I,e as L}from"./chunk-CQS6BGRJ.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};
|