@bicharts/shape-core 0.6.39 → 0.6.40
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/index.mjs +1 -1
- package/dist/types/fetchTransport.d.ts +2 -1
- package/package.json +1 -1
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 Sn,b as Rn}from"./chunk-UQU75XXR.mjs";import{a as xn,b as O,c as wn,d as k,e as h,f as vn,g as Y,h as Q}from"./chunk-HMLAY26J.mjs";import{a as hn,b as Cn,c as bn,d as Tn,e as En}from"./chunk-GHO5PJBZ.mjs";import{A as nn,B as rn,C as on,D as sn,E as an,F as ln,G as un,H as cn,I as dn,J as mn,K as fn,L as pn,M as yn,O as gn,a as Pt,b as Lt,c as Mt,d as _t,e as It,f as Ft,g as kt,h as Gt,i as Vt,j as Dt,k as Ut,l as Wt,m as qt,n as zt,o as Kt,p as $t,q as Bt,r as jt,s as Ht,t as Yt,u as Qt,v as Xt,w as Jt,x as Zt,y as en,z as tn}from"./chunk-M7OKMBJS.mjs";import{a as At}from"./chunk-U3H6UBOO.mjs";import{a as Ot,b as Nt}from"./chunk-2LR73DNS.mjs";import{a as ae,b as le,c as Rt,d as xt,e as wt,f as vt}from"./chunk-VIWJJUDA.mjs";import{a as D,f as U,g as A,h as W,i as j,j as ft,k as pt,l as se,m as M,n as yt,o as gt,p as ht,q,r as Ct,s as bt,t as Tt,u as Et,v as H,w as St}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as ot,b as it,c as st,d as at,e as lt,f as ut,g as ct,h as dt,i as mt}from"./chunk-WGT2OLMZ.mjs";import{A as Xe,B as Je,C as Ze,D as et,E as tt,F as nt,G as rt,a as Le,b as Me,c as _e,d as Ae,e as Oe,f as $,g as Ne,h as Ie,i as Fe,j as ke,k as Ge,l as Ve,m as De,n as Ue,o as We,p as qe,q as ze,r as Ke,s as $e,t as Be,u as je,v as He,x as B,y as Ye,z as Qe}from"./chunk-4VN252CK.mjs";var X=2,de=400;function Z(t){return!!U(t)}function F(t){let e=new Set;for(let n of t){if(n==null)continue;let o=D(String(n));if(!W(o)&&!e.has(o)&&(e.add(o),e.size>=de))break}return Array.from(e)}function I(t){let e=F(t);if(e.length===0||ee(t)<95)return!1;let n=e.filter(u=>Z(u)&&!M(u)).length,o=e.filter(u=>!Z(u)&&!!M(u)).length;return n>=1&&n>=o}function ue(t,e){if(!M(t))return!1;let n=U(t);return n?e==="world"?!0:se.has(n):!1}function ee(t){let e=F(t);if(e.length===0)return 0;let n=0;for(let o of e)Z(o)&&n++;return Math.round(n/e.length*1e3)/10}function z(t){let e=F(t);if(e.length===0)return 0;let n=0;for(let o of e)M(o)&&n++;return Math.round(n/e.length*1e3)/10}function ne(t){let e=new Set;for(let n of t){if(n==null)continue;let o=String(n).trim();if(!W(D(o))&&!e.has(o)&&(e.add(o),e.size>=de))break}return Array.from(e)}function te(t){let e=ne(t);if(e.length===0)return 0;let n=0;for(let o of e)q(o).length>0&&n++;return Math.round(n/e.length*1e3)/10}function ce(t,e){return le(e,ae)?!0:ne(t).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function Pn(t,e){let n=F(t);if(n.length===0)return 0;let o=0;for(let u of n)H(u,e)&&o++;return Math.round(o/n.length*1e3)/10}function J(t,e){let n=0;for(let o of F(t))e(o)&&n++;return n}function Ln(t,e){let n=0;for(let o of ne(t))e(o)&&n++;return n}function Mn(t,e,n,o,u){let l=[],a=[],i={},S={},T=new Set(t),b=s=>e.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&T.has(d)&&(i[s]=d)}let y=new Set(u??t);for(let s of["lat","lon"]){let d=n?.[s];d&&y.has(d)&&(i[s]=d)}let m=n?.zip;if(m&&T.has(m)){let s=b(m),d=te(s);d<95?a.push(`zip=${m} (only ${d}% of values read as ZIPs)`):ce(s,m)?i.zip=m:a.push(`zip=${m} (all values are 3-4 digits with nothing to say they are postal)`)}let p=n?.state;if(p&&T.has(p)){let s=b(p),d=F(s);d.length>0&&d.every(E=>ue(E,o))?a.push(`state=${p} (every value is "CA", which is both Canada and California)`):I(s)?(a.push(`state=${p} (every value is a country, not a state)`),i.country||(i.country=p)):z(s)<95?a.push(`state=${p} (only ${z(s)}% of values are states/provinces)`):i.state=p}let c=new Set(Object.values(i).filter(Boolean)),C=t.filter(s=>!c.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of C){let E=b(d);if(I(E))continue;let P=z(E);if(P<95)continue;let K=J(E,V=>!!M(V)),Pe=J(E,V=>!!M(V)&&!ue(V,o));K<X&&Pe<1||(!s||P>s.pct)&&(s={name:d,pct:P})}s&&(i.state=s.name,c.add(s.name),l.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of C){if(c.has(s))continue;let d=b(s),E=te(d);if(!(E<95)&&ce(d,s)&&!(Ln(d,P=>q(P).length>0)<X)){i.zip=s,c.add(s),l.push(`zip=${s} (${E}% ZIP codes)`);break}}let R=i.country;if(!R||!I(b(R))){let s=null;for(let d of C){if(c.has(d)||!I(b(d)))continue;let E=ee(b(d));(!s||E>s.pct)&&(s={name:d,pct:E})}s&&(R&&(a.push(`country=${R} (only ${ee(b(R))}% of values are country identifiers; using ${s.name} instead)`),S.country=R),i.country=s.name,c.add(s.name),l.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of C){if(c.has(d))continue;let E=b(d),P=Pn(E,o);P<j||J(E,K=>H(K,o))<X||(!s||P>s.pct)&&(s={name:d,pct:P})}s&&(i.city=s.name,l.push(`city=${s.name} (${s.pct}% known cities)`))}let w=i.country?b(i.country):[],v=!!i.country&&I(w),_=v?new Set(w.map(s=>U(s==null?null:String(s))).filter(Boolean)).size:0,x=v&&_>=2,g=!!(i.lat&&i.lon)&&e.some(s=>{let d=+String(s[i.lat]??"").trim(),E=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(E)&&d>=-90&&d<=90&&E>=-180&&E<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!g&&a.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||g)&&a.push(v?`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||g)?i:null,backfilled:l,refused:a,...Object.keys(S).length?{labelFallback:S}:{}}}var r=(t,...e)=>({part:t,langs:Object.freeze(e)}),re=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")}),_n=Object.freeze(Array.from(new Set(Object.values(re).flatMap(t=>t.langs)))),me=Object.freeze(["fa","ar","he","th"]),fe=1900,pe=2100;function An(t,e){let n=[],o=$(e);try{o&&n.push(t.toLocaleLowerCase(o.intl))}catch{}let u=t.toLowerCase();return n.includes(u)||n.push(u),n}function On(t,e){let n=String(t??"").trim().normalize("NFC");if(!n)return null;for(let o of An(n,e)){let u=re[o];if(u&&u.langs.includes(e))return u.part}return null}function Nn(t,e){return me.includes(t)?typeof e=="number"&&Number.isFinite(e)&&e>=fe&&e<=pe:!0}function ye(t,e){let n=e?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(t)||t<=n?0:Math.round(t-n)}function In(t,e,n){let o=ye(t,e);if(o===null||o<=0)return null;let u=typeof e?.freemiumColumnCapPivot=="number"?e.freemiumColumnCapPivot:4,l=o>u?e?.freemiumColumnCapMessageMany:e?.freemiumColumnCapMessageFew;if(typeof l!="string"||l.trim().length===0)return null;let a=l.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=ge(n);return i.length===0?a:a+" "+i.join(" ")}function ge(t){if(!t||t.length===0)return[];let e=[],n=new Map,o=new Map;for(let l of t){let a=typeof l?.dateGroupId=="string"?l.dateGroupId.trim():"";if(a!==""&&(n.has(a)||(e.push(a),n.set(a,0)),l.isDatePart===!0&&n.set(a,n.get(a)+1),l.isReassembledDate===!0&&!o.has(a))){let i=typeof l.sourceField=="string"?l.sourceField.trim():"",S=typeof l.name=="string"?l.name.trim():"",T=i!==""?i:S;T!==""&&o.set(a,T)}}let u=[];for(let l of e){let a=o.get(l),i=n.get(l)??0;!a||i===0||u.push(`'${a}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return u}var f=t=>t==null?"":String(t),N=t=>t===!0,he=t=>{if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"&&t.trim()!==""){let e=Number(t);return Number.isFinite(e)?e:null}return null},Fn=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Ce(t,e){let n={};for(let[o,u]of Fn){let l=f(h(t,e+u));l&&(n[o]=l)}return n}function kn(t){return Array.isArray(t)?t.map(e=>({code:f(h(e,"code")),severity:f(h(e,"severity")),text:f(h(e,"text"))})).filter(e=>e.text!==""):[]}function Gn(t){let e=S=>h(t,S),n=e("retryAfterSeconds"),o=e("overrideThumbnailUpload"),u=e("forceThumbnailUpload"),l=Ce(t,"point"),a=Ce(t,"destPoint");Object.keys(a).length&&(l.dest=a);let i=e("retryable");return{errorMessage:f(e("errorMessage")),errorCode:f(e("errorCode")),refusalCode:f(e("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:kn(e("notices")),freemiumStatusCode:f(e("freemiumStatusCode")),code:f(e("code")),language:f(e("language")),version:Number(e("version")??0),codeSummary:f(e("codeSummary")),chartName:f(e("chartName")??e("chartType")),finalChartName:f(e("finalChartName")),warningMessage:f(e("warningMessage")),outputHash:f(e("outputHash")),validatorToken:f(e("validatorToken")),editCodeKey:f(e("editCodeKey")),signedLLMRequestID:f(e("signedLLMRequestID")),userReply:f(e("userReply")),userReplyOutcome:f(e("userReplyOutcome")),improvementSuggestion:f(e("improvementSuggestion")),geoColumn:f(e("geoColumn")),geoKind:f(e("geoKind")),geoPointCols:Object.keys(l).length?l:null,creditBalanceBefore:he(e("creditBalanceBefore")),creditCost:he(e("creditCost")),isServiceError:N(e("isServiceError")),isRateLimited:N(e("isRateLimited")),isRefusal:N(e("isRefusal")),isVersionNotFound:N(e("isVersionNotFound")),isGenerationCancelled:N(e("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:f(e("servedCorrelationId")),...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof u=="boolean"?{forceThumbnailUpload:u}:{}}}var be=t=>t==null?void 0:Number(t),G=t=>f(t)||void 0;function Vn(t){let e=h(t,"charts"),n=h(t,"refused"),o=Array.isArray(e)?e.map(l=>{let a=S=>h(l,S),i=a("recommended");return{name:f(a("chartTypeName")??a("name")),description:f(a("description")??a("chartDesc")),rank:be(a("rank")),score:be(a("score")),renderer:G(a("renderer")),language:G(a("language")),isPreview:N(a("isPreview")),recommended:typeof i=="boolean"?i:void 0,viaProjection:G(a("viaProjection")),viaProjectionKey:G(a("viaProjectionKey")),detailNote:G(a("detailNote"))}}).filter(l=>l.name):null,u=Array.isArray(n)?n.map(l=>({name:f(h(l,"chartTypeName")??h(l,"name")),reason:f(h(l,"reason")),reasonCode:f(h(l,"reasonCode")),isVeto:N(h(l,"isVeto"))})).filter(l=>l.name):[];return{errorMessage:f(h(t,"errorMessage")),errorCode:f(h(t,"errorCode")),charts:o,refused:u,noFitSummary:f(h(t,"noFitSummary"))}}function Dn(t){return!t||typeof t!="object"?null:{status:String(h(t,"status")??""),verdictReason:h(t,"verdictReason")??null,instruction:h(t,"instruction")??null,fix:h(t,"fix")??null,errorMessage:h(t,"errorMessage")??null,errorCode:h(t,"errorCode")??null}}var Te=["working","analyze","generate","refine","review"];function Un(t,e){let n=String(t??"").trim().toLowerCase();if(Te.includes(n))return n;let o=String(e??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var Wn="FREEMIUM_ATTEMPT_SPENT",qn="CLIENT_SECRET_MISMATCH",zn="FREEMIUM_COLUMN_CAP";function Kn(t){let e=t?.retryable;return typeof e=="boolean"?e:null}function $n(t){let e=t.linkNonce?(t.linkNonce()??"").trim():null,n=e?{licensee:"",licenseKey:"",secretKey:""}:t.triple();return{request:{licenseKey:n.licenseKey,licensee:n.licensee,secretKey:n.secretKey,freemiumKey:t.freemiumKey?.()??""},linkNonce:e}}function Bn(t){let{width:e,height:n}=t.measure();return{request:{height:n,width:e},hints:{viewportWidth:e,viewportHeight:n}}}function jn(t){let e=0;for(let n of t){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>e&&(e=o)}return e}function Ee(t){if(t.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(t.recoveryFetchVersion!=null)return{version:t.recoveryFetchVersion,fetchOnly:!0};let e=t.settingVersion??null;if(t.genNew)return{version:e,fetchOnly:void 0};let n=(e??0)>0?e:null,o=(t.codeVersion??0)>0?t.codeVersion:null,u=n??o??e;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function Hn(t){let e=t.fetchCorrelationId!=null,o=e||t.recoveryFetchVersion!=null?!1:t.genNew,u=Ee({genNew:o,recoveryFetchVersion:t.recoveryFetchVersion,recoveryFetchByCorrelation:e,settingVersion:t.settingVersion,codeVersion:t.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:t.fetchCorrelationId??void 0}}function Yn(t){let e=n=>t.renderers.has(n);return{supportsD3:e("D3"),supportsPlotly:e("PLOTLY"),supportsVega:e("VEGA")}}function Qn(t){let e=t.cap!=null&&t.budget>t.cap?t.cap:t.budget;return{triesLeft:t.triesLeft??e,maxTries:e}}function Xn(t){return t&&t>0?{leafCardinality:Math.round(t)}:{}}function Se(t,e){return t!=null&&e!=null&&t!==e}function Jn(t,e){return t?Se(e.capturedFor,e.now)?{shortlist:void 0,stale:!0}:{shortlist:{...t,ageMs:e.atMs>0?Math.max(0,Math.round(e.nowMs-e.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var Zn=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Re(t){let e=String(t??"").trim().toLowerCase();return Zn[e]??e}function xe(t){let e="";for(let n of t)e+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Re(n.dataType)]);return e}function er(t){return B(xe(t))}var tr=2,nr=3,rr=4,or=64,ir=8e3,sr=6e4,ar=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict"});function lr(t){return!!t&&!t.includes("|")&&!t.includes(",")}function oe(t,e,n,o){let u=`${t},${e}|${n}`;return o?`${u}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:u}function ur(t,e){let n=t;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(!e||typeof e.baseUrl!="string"&&typeof e.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.baseUrl=="string"&&e.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.clientVersion!="string"||e.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof e.timeoutMs!="number"||!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:u,clock:l}=n,a=e.apiPath??"/api",i=e.timeoutMs,S=()=>typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl,T=y=>{try{e.onFailure?.(y)}catch{}},b=async(y,m,p,c)=>{let C;try{let R=await u.post(m,p,c,{timeoutMs:i});C=R.status;try{R.body?.cancel().catch(()=>{})}catch{}}catch(R){T({channel:y,stage:"post",status:null,error:R});return}(C<200||C>299)&&T({channel:y,stage:"status",status:C,error:null})};return{async sendClientMessage(y){let m,p,c;try{m=`${S()}${a}/LogClientMsg/?nocache=${l.now()}`,p=O(y),c=k(p,o)}catch(C){T({channel:"client-message",stage:"build",status:null,error:C});return}await b("client-message",m,p,{"Content-Type":"text/plain","X-Signature":c})},async countEvent(y,m,p){let c,C;try{c=`${S()}${a}/eventlog`,C=oe(y,e.clientVersion,m,p)}catch(R){T({channel:"event-count",stage:"build",status:null,error:R});return}await b("event-count",c,C,{"Content-Type":"text/plain"})}}}function we(t){return Object.assign(new Error(`The request did not finish within ${t} ms.`),{name:"TimeoutError"})}function cr(t,e={}){if(typeof t!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=t,o=e.credentials??"omit";return{async post(u,l,a,i){let S=i.timeoutMs,T=new AbortController,b=!1,y=setTimeout(()=>{b=!0,T.abort(we(S))},S),m=()=>T.abort(i.signal?.reason);i.signal&&(i.signal.aborted?m():i.signal.addEventListener("abort",m,{once:!0}));let p=!1,c=()=>{p||(p=!0,clearTimeout(y),i.signal?.removeEventListener("abort",m))},C=g=>b?we(S):g,R;try{R=await n(u,{method:"POST",body:l,headers:a,credentials:o,signal:T.signal})}catch(g){throw c(),C(g)}let w=Y(R),v=w.statusText!==void 0?{statusText:w.statusText}:{};if(!w.body)return{status:w.status,...v,contentType:w.contentType,body:null,text:async()=>{try{return await w.text()}catch(g){throw C(g)}finally{c()}}};let _=w.body.getReader(),x=new ReadableStream({async pull(g){try{let L=await _.read();if(L.done){c(),g.close();return}g.enqueue(L.value)}catch(L){c(),g.error(C(L))}},cancel(g){return c(),_.cancel(g)}});return{status:w.status,...v,contentType:w.contentType,body:x,text:()=>new Response(x).text()}}}}var ve=300,dr="/LLMChart/",mr="/LLMChart/qualify",fr="/VisionReview/",pr="/LLMChart/sample",yr=t=>!!t&&typeof t=="object"&&t.name==="TimeoutError",ie=async t=>JSON.parse(await t.text());function gr(t){try{t.body?t.body.cancel().catch(()=>{}):t.text().catch(()=>{})}catch{}}function hr(t,e){let n=t;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(!e||typeof e.baseUrl!="string"&&typeof e.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof e.baseUrl=="string"&&e.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(e.apiPath!==void 0&&typeof e.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(e.nocache!==void 0&&e.nocache!==null&&typeof e.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:u,clock:l}=n,a=e.apiPath??"/api",i=()=>typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl,S=y=>e.nocache?e.nocache(y):String(l.now());async function T(y,m,p,c,C){let R=`${i()}${a}${m}?nocache=${S(y)}`,w={"Content-Type":"text/plain","X-Signature":k(p,o)},v=c.signal??void 0,_=(g,L)=>{let s=!!v?.aborted;return{kind:"transport",headersReceived:g,timedOut:!s&&yr(L),cancelled:s,error:L}},x;try{x=await u.post(R,p,w,v?{timeoutMs:c.timeoutMs,signal:v}:{timeoutMs:c.timeoutMs})}catch(g){return _(!1,g)}if(x.status<200||x.status>299){let g="";if(c.readErrorBody===!1)gr(x);else try{g=(await x.text()).slice(0,ve)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:g}}try{return{kind:"answer",status:x.status,value:await C(x)}}catch(g){return _(!0,g)}}function b(y,m){if(!m||typeof m.timeoutMs!="number"||!Number.isFinite(m.timeoutMs)||m.timeoutMs<=0)throw new TypeError(`The ${y} call needs a positive deadline in milliseconds`);return m}return{async generate(y,m){let p=b("generate",m),c=p.onStage??void 0;return T("generate",dr,O(y),p,C=>Q(C,c))},async qualify(y,m){let p=b("qualify",m),c=p.route??mr;if(typeof c!="string"||!c.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return T("qualify",c,O(y),p,ie)},async review(y,m){let p=b("review",m),c=JSON.stringify(y);if(typeof c!="string")throw new TypeError("The review wire did not serialize to JSON");return T("review",fr,c,p,ie)},async sample(y,m){let p=b("sample",m);return T("sample",pr,O(y),p,ie)}}}export{j as CITY_ROLE_MATCH_PCT,ar as CLIENT_EVENT_KINDS,qn as CLIENT_SECRET_MISMATCH,Ue as COMPOUND_MIN_STEM,ot as CYCLE_MEMBERS,st as CYCLE_WORDS,pe as DATE_LEVEL_GREGORIAN_YEAR_MAX,fe as DATE_LEVEL_GREGORIAN_YEAR_MIN,_n as DATE_LEVEL_LANGUAGES,re as DATE_LEVEL_NAMES,me as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Zt as DEFAULT_GAP_FACTOR,Xe as DEFAULT_TEMPERATURE,Wn as FREEMIUM_ATTEMPT_SPENT,zn as FREEMIUM_COLUMN_CAP,Ye as GET_RANDOM,qe as GLUED_STEM_MIN,Ke as HANGUL_MIN_STEM,ve as HTTP_BODY_START_CHARS,Ft as INTENSIVE_SUFFIX_TOKENS,It as INTENSIVE_WORD_TOKENS,gn as IndexedText,en as MAX_RUN_BOUNDS,Gt as POSITIONAL_SUFFIX_TOKENS,kt as POSITIONAL_WORD_TOKENS,Sn as PREVIEW_OMITTED_FIELDS,Te as PROGRESS_STAGE_IDS,A as ROLE_MATCH_PCT,rn as SERIES_COMPLETENESS_MAX_LISTED,on as SERIES_COMPLETENESS_MIN_FILL,sn as SERIES_KEY_MAX_DISTINCT,rr as SEV_ERROR,tr as SEV_INFO,or as SEV_USER_PRESENTED,nr as SEV_WARNING,B as SIMPLE_STRING_HASH,He as STR,Be as SUBSTRING_MIN,Le as SUPPORTED_LANGUAGES,Me as SUPPORTED_LANGUAGE_CODES,sr as TELEMETRY_TIMEOUT_DEV_MS,ir as TELEMETRY_TIMEOUT_MS,Oe as VOCABULARY_LANGUAGE_CODES,Ae as VOCABULARY_ONLY_LANGUAGES,it as YEAR_WORDS,z as admin1MatchPct,Bt as allowedAggregations,Kn as answerIsRetryable,vt as buildGeoIsoColumn,Tt as buildGeoPointColumns,at as calendarWordIn,Yn as capabilityFields,St as cityMatchPct,Et as cityTagsFor,pn as classifyAdditivity,$t as classifyForAggregation,yn as classifyNumericValueNature,mn as classifyTemporal,Wt as codeNeedsLegacyAggNames,Qt as codeReadsColumn,Xt as codeReadsColumnsByRoleOrPosition,Ut as collapseRepeatedAggPrefix,Jt as columnsTheCodeReads,Mt as countryRegion,hr as createGenerateClient,ur as createTelemetryClient,$n as credentialFields,On as dateLevelPart,Nn as dateLevelYearAdmits,hn as decimalSeparatorOf,jt as defaultAggregation,Cn as detectDecimalSeparator,At as detectFormatSignature,Rt as detectGeo,mt as detectOrdinalDomain,dn as detectTextDatePattern,O as encodePayload,Tn as engineTypeForSqlType,qt as englishImplicitAggNames,oe as eventLogLine,Hn as fetchFields,cr as fetchTransport,Ie as foldName,In as freemiumColumnCapRefusal,ye as freemiumColumnsOverCap,ge as freemiumDateHierarchyClauses,ze as gluedPrefixStems,xn as gzipWireText,$e as hangulWordEndsWith,Dt as hasDefaultAggPrefix,Ve as hasUnsegmentedScript,fn as hostAggHint,En as ingest,Ht as isAggregationAllowed,W as isBlankLike,pt as isCityTableLoaded,Qe as isDeterministicRefusal,lr as isEventLogCode,Ct as isGeoPointAmbiguity,cn as isIdentifierName,wt as isJoinGeoKind,vn as isNdjsonContentType,ct as isOrdinalFriendlyName,wn as keyedSigner,Xn as leafCardinalityField,nt as localMidnightDateColumns,tt as localMidnightToUtcDay,ut as localizedCycleIn,lt as localizedYearWordIn,I as looksLikeCountryColumn,je as matchNameToken,jn as maxNonMeasureCardinality,nn as measureCadence,un as measureSeriesCompleteness,k as messageSignature,Nt as monthLookupFor,ke as nameLetterRuns,Kt as nameLooksIntensiveRate,zt as nameLooksPositional,Fe as nameWords,yt as normalizeCountry,rt as normalizeLocalMidnightDates,Ot as normalizeMonthKey,D as normalizePlaceName,ht as normalizeZip5,Jn as offeredShortlistFor,Je as parseDateStable,Gn as parseGenerateResponse,bn as parseNumberText,Vn as parseQualifyResponse,Dn as parseReviewVerdict,tn as parseTemporalPoint,Rn as payloadPreview,ln as pickSeriesColumn,Un as progressStageOf,Q as readGenerateStream,Ge as readName,h as readWireField,ft as registerCityTable,Lt as registerIso3Regions,M as resolveAdmin1,Ee as resolveFetchVersion,bt as resolveGeoPoint,Ne as resolveLanguage,Mn as resolvePointRoles,Qn as retryFields,dt as safeDistinctValuesToShip,xe as schemaIdentity,er as schemaIdentityKey,Re as schemaTypeFamily,an as seriesKeyVerdict,Yt as shareOfTotalIsHonest,Se as shortlistIsStale,Vt as stripHostAggPrefix,_t as summarizeCountryRegions,Pt as summarizeGeoExtent,_e as supportedLanguage,xt as toGeoIso,De as unsegmentedRuns,Bn as viewportFields,$ as vocabularyLanguage,Ze as wholeDayFrame,et as wholeDayIso,Y as wireResponseFromFetch,We as wordEndsWith,te as zipMatchPct,q as zipPrefixCandidates,gt as zipToPrefix3};
|
|
2
|
+
import{a as Rn,b as xn}from"./chunk-UQU75XXR.mjs";import{a as wn,b as O,c as vn,d as k,e as h,f as Pn,g as Y,h as Q}from"./chunk-HMLAY26J.mjs";import{a as Cn,b as bn,c as Tn,d as En,e as Sn}from"./chunk-GHO5PJBZ.mjs";import{A as rn,B as on,C as sn,D as an,E as ln,F as un,G as cn,H as dn,I as mn,J as fn,K as pn,L as yn,M as gn,O as hn,a as Mt,b as Lt,c as _t,d as At,e as Ft,f as kt,g as Gt,h as Vt,i as Dt,j as Ut,k as Wt,l as qt,m as zt,n as $t,o as Kt,p as Bt,q as jt,r as Ht,s as Yt,t as Qt,u as Xt,v as Jt,w as Zt,x as en,y as tn,z as nn}from"./chunk-M7OKMBJS.mjs";import{a as Ot}from"./chunk-U3H6UBOO.mjs";import{a as Nt,b as It}from"./chunk-2LR73DNS.mjs";import{a as ae,b as le,c as xt,d as wt,e as vt,f as Pt}from"./chunk-VIWJJUDA.mjs";import{a as D,f as U,g as A,h as W,i as j,j as pt,k as yt,l as se,m as M,n as gt,o as ht,p as Ct,q,r as bt,s as Tt,t as Et,u as St,v as H,w as Rt}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as it,b as st,c as at,d as lt,e as ut,f as ct,g as dt,h as mt,i as ft}from"./chunk-WGT2OLMZ.mjs";import{A as Je,B as Ze,C as et,D as tt,E as nt,F as rt,G as ot,a as Le,b as _e,c as Ae,d as Oe,e as Ne,f as K,g as Ie,h as Fe,i as ke,j as Ge,k as Ve,l as De,m as Ue,n as We,o as qe,p as ze,q as $e,r as Ke,s as Be,t as je,u as He,v as Ye,x as B,y as Qe,z as Xe}from"./chunk-4VN252CK.mjs";var X=2,de=400;function Z(t){return!!U(t)}function F(t){let e=new Set;for(let n of t){if(n==null)continue;let o=D(String(n));if(!W(o)&&!e.has(o)&&(e.add(o),e.size>=de))break}return Array.from(e)}function I(t){let e=F(t);if(e.length===0||ee(t)<95)return!1;let n=e.filter(u=>Z(u)&&!M(u)).length,o=e.filter(u=>!Z(u)&&!!M(u)).length;return n>=1&&n>=o}function ue(t,e){if(!M(t))return!1;let n=U(t);return n?e==="world"?!0:se.has(n):!1}function ee(t){let e=F(t);if(e.length===0)return 0;let n=0;for(let o of e)Z(o)&&n++;return Math.round(n/e.length*1e3)/10}function z(t){let e=F(t);if(e.length===0)return 0;let n=0;for(let o of e)M(o)&&n++;return Math.round(n/e.length*1e3)/10}function ne(t){let e=new Set;for(let n of t){if(n==null)continue;let o=String(n).trim();if(!W(D(o))&&!e.has(o)&&(e.add(o),e.size>=de))break}return Array.from(e)}function te(t){let e=ne(t);if(e.length===0)return 0;let n=0;for(let o of e)q(o).length>0&&n++;return Math.round(n/e.length*1e3)/10}function ce(t,e){return le(e,ae)?!0:ne(t).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function Mn(t,e){let n=F(t);if(n.length===0)return 0;let o=0;for(let u of n)H(u,e)&&o++;return Math.round(o/n.length*1e3)/10}function J(t,e){let n=0;for(let o of F(t))e(o)&&n++;return n}function Ln(t,e){let n=0;for(let o of ne(t))e(o)&&n++;return n}function _n(t,e,n,o,u){let l=[],a=[],s={},b={},T=new Set(t),C=i=>e.map(c=>c[i]);for(let i of["city","country"]){let c=n?.[i];c&&T.has(c)&&(s[i]=c)}let y=new Set(u??t);for(let i of["lat","lon"]){let c=n?.[i];c&&y.has(c)&&(s[i]=c)}let f=n?.zip;if(f&&T.has(f)){let i=C(f),c=te(i);c<95?a.push(`zip=${f} (only ${c}% of values read as ZIPs)`):ce(i,f)?s.zip=f:a.push(`zip=${f} (all values are 3-4 digits with nothing to say they are postal)`)}let d=n?.state;if(d&&T.has(d)){let i=C(d),c=F(i);c.length>0&&c.every(S=>ue(S,o))?a.push(`state=${d} (every value is "CA", which is both Canada and California)`):I(i)?(a.push(`state=${d} (every value is a country, not a state)`),s.country||(s.country=d)):z(i)<95?a.push(`state=${d} (only ${z(i)}% of values are states/provinces)`):s.state=d}let p=new Set(Object.values(s).filter(Boolean)),g=t.filter(i=>!p.has(i)&&!i.startsWith("__"));if(!s.state){let i=null;for(let c of g){let S=C(c);if(I(S))continue;let P=z(S);if(P<95)continue;let $=J(S,V=>!!M(V)),Me=J(S,V=>!!M(V)&&!ue(V,o));$<X&&Me<1||(!i||P>i.pct)&&(i={name:c,pct:P})}i&&(s.state=i.name,p.add(i.name),l.push(`state=${i.name} (${i.pct}% states/provinces)`))}if(!s.zip)for(let i of g){if(p.has(i))continue;let c=C(i),S=te(c);if(!(S<95)&&ce(c,i)&&!(Ln(c,P=>q(P).length>0)<X)){s.zip=i,p.add(i),l.push(`zip=${i} (${S}% ZIP codes)`);break}}let E=s.country;if(!E||!I(C(E))){let i=null;for(let c of g){if(p.has(c)||!I(C(c)))continue;let S=ee(C(c));(!i||S>i.pct)&&(i={name:c,pct:S})}i&&(E&&(a.push(`country=${E} (only ${ee(C(E))}% of values are country identifiers; using ${i.name} instead)`),b.country=E),s.country=i.name,p.add(i.name),l.push(`country=${i.name}`))}if(!s.city){let i=null;for(let c of g){if(p.has(c))continue;let S=C(c),P=Mn(S,o);P<j||J(S,$=>H($,o))<X||(!i||P>i.pct)&&(i={name:c,pct:P})}i&&(s.city=i.name,l.push(`city=${i.name} (${i.pct}% known cities)`))}let L=s.country?C(s.country):[],R=!!s.country&&I(L),_=R?new Set(L.map(i=>U(i==null?null:String(i))).filter(Boolean)).size:0,x=R&&_>=2,w=!!(s.lat&&s.lon)&&e.some(i=>{let c=+String(i[s.lat]??"").trim(),S=+String(i[s.lon]??"").trim();return isFinite(c)&&isFinite(S)&&c>=-90&&c<=90&&S>=-180&&S<=180&&String(i[s.lat]??"").trim()!==""&&String(i[s.lon]??"").trim()!==""});return s.lat&&s.lon&&!w&&a.push(`lat/lon=${s.lat}/${s.lon} (no row holds a usable coordinate pair)`),s.country&&!x&&!(s.city||s.state||s.zip||w)&&a.push(R?`country=${s.country} (every row resolves to the same country - nothing to place apart)`:`country=${s.country} (values are not country identifiers)`),{bind:!!(s.city||s.state||s.zip||x||w)?s:null,backfilled:l,refused:a,...Object.keys(b).length?{labelFallback:b}:{}}}var r=(t,...e)=>({part:t,langs:Object.freeze(e)}),re=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")}),An=Object.freeze(Array.from(new Set(Object.values(re).flatMap(t=>t.langs)))),me=Object.freeze(["fa","ar","he","th"]),fe=1900,pe=2100;function On(t,e){let n=[],o=K(e);try{o&&n.push(t.toLocaleLowerCase(o.intl))}catch{}let u=t.toLowerCase();return n.includes(u)||n.push(u),n}function Nn(t,e){let n=String(t??"").trim().normalize("NFC");if(!n)return null;for(let o of On(n,e)){let u=re[o];if(u&&u.langs.includes(e))return u.part}return null}function In(t,e){return me.includes(t)?typeof e=="number"&&Number.isFinite(e)&&e>=fe&&e<=pe:!0}function ye(t,e){let n=e?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(t)||t<=n?0:Math.round(t-n)}function Fn(t,e,n){let o=ye(t,e);if(o===null||o<=0)return null;let u=typeof e?.freemiumColumnCapPivot=="number"?e.freemiumColumnCapPivot:4,l=o>u?e?.freemiumColumnCapMessageMany:e?.freemiumColumnCapMessageFew;if(typeof l!="string"||l.trim().length===0)return null;let a=l.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),s=ge(n);return s.length===0?a:a+" "+s.join(" ")}function ge(t){if(!t||t.length===0)return[];let e=[],n=new Map,o=new Map;for(let l of t){let a=typeof l?.dateGroupId=="string"?l.dateGroupId.trim():"";if(a!==""&&(n.has(a)||(e.push(a),n.set(a,0)),l.isDatePart===!0&&n.set(a,n.get(a)+1),l.isReassembledDate===!0&&!o.has(a))){let s=typeof l.sourceField=="string"?l.sourceField.trim():"",b=typeof l.name=="string"?l.name.trim():"",T=s!==""?s:b;T!==""&&o.set(a,T)}}let u=[];for(let l of e){let a=o.get(l),s=n.get(l)??0;!a||s===0||u.push(`'${a}' is a date hierarchy and counts as ${s+1} fields - bind the date itself instead of its hierarchy.`)}return u}var m=t=>t==null?"":String(t),N=t=>t===!0,he=t=>{if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"&&t.trim()!==""){let e=Number(t);return Number.isFinite(e)?e:null}return null},kn=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Ce(t,e){let n={};for(let[o,u]of kn){let l=m(h(t,e+u));l&&(n[o]=l)}return n}function Gn(t){return Array.isArray(t)?t.map(e=>({code:m(h(e,"code")),severity:m(h(e,"severity")),text:m(h(e,"text"))})).filter(e=>e.text!==""):[]}function Vn(t){let e=b=>h(t,b),n=e("retryAfterSeconds"),o=e("overrideThumbnailUpload"),u=e("forceThumbnailUpload"),l=Ce(t,"point"),a=Ce(t,"destPoint");Object.keys(a).length&&(l.dest=a);let s=e("retryable");return{errorMessage:m(e("errorMessage")),errorCode:m(e("errorCode")),refusalCode:m(e("refusalCode")),retryable:typeof s=="boolean"?s:null,notices:Gn(e("notices")),freemiumStatusCode:m(e("freemiumStatusCode")),code:m(e("code")),language:m(e("language")),version:Number(e("version")??0),codeSummary:m(e("codeSummary")),chartName:m(e("chartName")??e("chartType")),finalChartName:m(e("finalChartName")),warningMessage:m(e("warningMessage")),outputHash:m(e("outputHash")),validatorToken:m(e("validatorToken")),editCodeKey:m(e("editCodeKey")),signedLLMRequestID:m(e("signedLLMRequestID")),userReply:m(e("userReply")),userReplyOutcome:m(e("userReplyOutcome")),improvementSuggestion:m(e("improvementSuggestion")),geoColumn:m(e("geoColumn")),geoKind:m(e("geoKind")),geoPointCols:Object.keys(l).length?l:null,creditBalanceBefore:he(e("creditBalanceBefore")),creditCost:he(e("creditCost")),isServiceError:N(e("isServiceError")),isRateLimited:N(e("isRateLimited")),isRefusal:N(e("isRefusal")),isVersionNotFound:N(e("isVersionNotFound")),isGenerationCancelled:N(e("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(e("servedCorrelationId")),...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof u=="boolean"?{forceThumbnailUpload:u}:{}}}var be=t=>t==null?void 0:Number(t),G=t=>m(t)||void 0;function Dn(t){let e=h(t,"charts"),n=h(t,"refused"),o=Array.isArray(e)?e.map(l=>{let a=b=>h(l,b),s=a("recommended");return{name:m(a("chartTypeName")??a("name")),description:m(a("description")??a("chartDesc")),rank:be(a("rank")),score:be(a("score")),renderer:G(a("renderer")),language:G(a("language")),isPreview:N(a("isPreview")),recommended:typeof s=="boolean"?s:void 0,viaProjection:G(a("viaProjection")),viaProjectionKey:G(a("viaProjectionKey")),detailNote:G(a("detailNote"))}}).filter(l=>l.name):null,u=Array.isArray(n)?n.map(l=>({name:m(h(l,"chartTypeName")??h(l,"name")),reason:m(h(l,"reason")),reasonCode:m(h(l,"reasonCode")),isVeto:N(h(l,"isVeto"))})).filter(l=>l.name):[];return{errorMessage:m(h(t,"errorMessage")),errorCode:m(h(t,"errorCode")),charts:o,refused:u,noFitSummary:m(h(t,"noFitSummary"))}}function Un(t){return!t||typeof t!="object"?null:{status:String(h(t,"status")??""),verdictReason:h(t,"verdictReason")??null,instruction:h(t,"instruction")??null,fix:h(t,"fix")??null,errorMessage:h(t,"errorMessage")??null,errorCode:h(t,"errorCode")??null}}var Te=["working","analyze","generate","refine","review"];function Wn(t,e){let n=String(t??"").trim().toLowerCase();if(Te.includes(n))return n;let o=String(e??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var qn="FREEMIUM_ATTEMPT_SPENT",zn="CLIENT_SECRET_MISMATCH",$n="FREEMIUM_COLUMN_CAP";function Kn(t){let e=t?.retryable;return typeof e=="boolean"?e:null}function Bn(t){let e=t.linkNonce?(t.linkNonce()??"").trim():null,n=e?{licensee:"",licenseKey:"",secretKey:""}:t.triple();return{request:{licenseKey:n.licenseKey,licensee:n.licensee,secretKey:n.secretKey,freemiumKey:t.freemiumKey?.()??""},linkNonce:e}}function jn(t){let{width:e,height:n}=t.measure();return{request:{height:n,width:e},hints:{viewportWidth:e,viewportHeight:n}}}function Hn(t){let e=0;for(let n of t){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>e&&(e=o)}return e}function Ee(t){if(t.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(t.recoveryFetchVersion!=null)return{version:t.recoveryFetchVersion,fetchOnly:!0};let e=t.settingVersion??null;if(t.genNew)return{version:e,fetchOnly:void 0};let n=(e??0)>0?e:null,o=(t.codeVersion??0)>0?t.codeVersion:null,u=n??o??e;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function Yn(t){let e=t.fetchCorrelationId!=null,o=e||t.recoveryFetchVersion!=null?!1:t.genNew,u=Ee({genNew:o,recoveryFetchVersion:t.recoveryFetchVersion,recoveryFetchByCorrelation:e,settingVersion:t.settingVersion,codeVersion:t.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:t.fetchCorrelationId??void 0}}function Qn(t){let e=n=>t.renderers.has(n);return{supportsD3:e("D3"),supportsPlotly:e("PLOTLY"),supportsVega:e("VEGA")}}function Xn(t){let e=t.cap!=null&&t.budget>t.cap?t.cap:t.budget;return{triesLeft:t.triesLeft??e,maxTries:e}}function Jn(t){return t&&t>0?{leafCardinality:Math.round(t)}:{}}function Se(t,e){return t!=null&&e!=null&&t!==e}function Zn(t,e){return t?Se(e.capturedFor,e.now)?{shortlist:void 0,stale:!0}:{shortlist:{...t,ageMs:e.atMs>0?Math.max(0,Math.round(e.nowMs-e.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var er=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Re(t){let e=String(t??"").trim().toLowerCase();return er[e]??e}function xe(t){let e="";for(let n of t)e+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Re(n.dataType)]);return e}function tr(t){return B(xe(t))}var nr=2,rr=3,or=4,ir=64,sr=8e3,ar=6e4,lr=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict"});function ur(t){return!!t&&!t.includes("|")&&!t.includes(",")}function oe(t,e,n,o){let u=`${t},${e}|${n}`;return o?`${u}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:u}function cr(t,e){let n=t;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(!e||typeof e.baseUrl!="string"&&typeof e.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.baseUrl=="string"&&e.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.clientVersion!="string"||e.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof e.timeoutMs!="number"||!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:u,clock:l}=n,a=e.apiPath??"/api",s=e.timeoutMs,b=()=>typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl,T=y=>{try{e.onFailure?.(y)}catch{}},C=async(y,f,d,p)=>{let g;try{let E=await u.post(f,d,p,{timeoutMs:s});g=E.status;try{E.body?.cancel().catch(()=>{})}catch{}}catch(E){T({channel:y,stage:"post",status:null,error:E});return}(g<200||g>299)&&T({channel:y,stage:"status",status:g,error:null})};return{async sendClientMessage(y){let f,d,p;try{f=`${b()}${a}/LogClientMsg/?nocache=${l.now()}`,d=O(y),p=k(d,o)}catch(g){T({channel:"client-message",stage:"build",status:null,error:g});return}await C("client-message",f,d,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(y,f,d){let p,g;try{p=`${b()}${a}/eventlog`,g=oe(y,e.clientVersion,f,d)}catch(E){T({channel:"event-count",stage:"build",status:null,error:E});return}await C("event-count",p,g,{"Content-Type":"text/plain"})}}}var we=2**31-1;function ve(t){return Object.assign(new Error(`The request did not finish within ${t} ms.`),{name:"TimeoutError"})}function dr(t){return typeof t=="number"&&t>0&&t<=we?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(t)} ms: it must be a number of milliseconds above 0 and at most ${we} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function mr(t,e={}){if(typeof t!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=t,o=e.credentials??"omit";return{async post(u,l,a,s){let b=s.timeoutMs,T=dr(b);if(T)throw T;let C=new AbortController,y=!1,f=setTimeout(()=>{y=!0,C.abort(ve(b))},b),d=()=>C.abort(s.signal?.reason);s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d,{once:!0}));let p=!1,g=()=>{p||(p=!0,clearTimeout(f),s.signal?.removeEventListener("abort",d))},E=v=>y?ve(b):v,L;try{L=await n(u,{method:"POST",body:l,headers:a,credentials:o,signal:C.signal})}catch(v){throw g(),E(v)}let R=Y(L),_=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,..._,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(v){throw E(v)}finally{g()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(v){try{let i=await x.read();if(i.done){g(),v.close();return}v.enqueue(i.value)}catch(i){g(),v.error(E(i))}},cancel(v){return g(),x.cancel(v)}});return{status:R.status,..._,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var Pe=300,fr="/LLMChart/",pr="/LLMChart/qualify",yr="/VisionReview/",gr="/LLMChart/sample",hr=t=>!!t&&typeof t=="object"&&t.name==="TimeoutError",ie=async t=>JSON.parse(await t.text());function Cr(t){try{t.body?t.body.cancel().catch(()=>{}):t.text().catch(()=>{})}catch{}}function br(t,e){let n=t;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(!e||typeof e.baseUrl!="string"&&typeof e.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof e.baseUrl=="string"&&e.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(e.apiPath!==void 0&&typeof e.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(e.nocache!==void 0&&e.nocache!==null&&typeof e.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:u,clock:l}=n,a=e.apiPath??"/api",s=()=>typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl,b=y=>e.nocache?e.nocache(y):String(l.now());async function T(y,f,d,p,g){let E=`${s()}${a}${f}?nocache=${b(y)}`,L={"Content-Type":"text/plain","X-Signature":k(d,o)},R=p.signal??void 0,_=(w,v)=>{let i=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!i&&hr(v),cancelled:i,error:v}},x;try{x=await u.post(E,d,L,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return _(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)Cr(x);else try{w=(await x.text()).slice(0,Pe)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await g(x)}}catch(w){return _(!0,w)}}function C(y,f){if(!f||typeof f.timeoutMs!="number"||!Number.isFinite(f.timeoutMs)||f.timeoutMs<=0)throw new TypeError(`The ${y} call needs a positive deadline in milliseconds`);return f}return{async generate(y,f){let d=C("generate",f),p=d.onStage??void 0;return T("generate",fr,O(y),d,g=>Q(g,p))},async qualify(y,f){let d=C("qualify",f),p=d.route??pr;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return T("qualify",p,O(y),d,ie)},async review(y,f){let d=C("review",f),p=JSON.stringify(y);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return T("review",yr,p,d,ie)},async sample(y,f){let d=C("sample",f);return T("sample",gr,O(y),d,ie)}}}export{j as CITY_ROLE_MATCH_PCT,lr as CLIENT_EVENT_KINDS,zn as CLIENT_SECRET_MISMATCH,We as COMPOUND_MIN_STEM,it as CYCLE_MEMBERS,at as CYCLE_WORDS,pe as DATE_LEVEL_GREGORIAN_YEAR_MAX,fe as DATE_LEVEL_GREGORIAN_YEAR_MIN,An as DATE_LEVEL_LANGUAGES,re as DATE_LEVEL_NAMES,me as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,en as DEFAULT_GAP_FACTOR,Je as DEFAULT_TEMPERATURE,qn as FREEMIUM_ATTEMPT_SPENT,$n as FREEMIUM_COLUMN_CAP,Qe as GET_RANDOM,ze as GLUED_STEM_MIN,Ke as HANGUL_MIN_STEM,Pe as HTTP_BODY_START_CHARS,kt as INTENSIVE_SUFFIX_TOKENS,Ft as INTENSIVE_WORD_TOKENS,hn as IndexedText,tn as MAX_RUN_BOUNDS,Vt as POSITIONAL_SUFFIX_TOKENS,Gt as POSITIONAL_WORD_TOKENS,Rn as PREVIEW_OMITTED_FIELDS,Te as PROGRESS_STAGE_IDS,A as ROLE_MATCH_PCT,on as SERIES_COMPLETENESS_MAX_LISTED,sn as SERIES_COMPLETENESS_MIN_FILL,an as SERIES_KEY_MAX_DISTINCT,or as SEV_ERROR,nr as SEV_INFO,ir as SEV_USER_PRESENTED,rr as SEV_WARNING,B as SIMPLE_STRING_HASH,Ye as STR,je as SUBSTRING_MIN,Le as SUPPORTED_LANGUAGES,_e as SUPPORTED_LANGUAGE_CODES,ar as TELEMETRY_TIMEOUT_DEV_MS,sr as TELEMETRY_TIMEOUT_MS,Ne as VOCABULARY_LANGUAGE_CODES,Oe as VOCABULARY_ONLY_LANGUAGES,st as YEAR_WORDS,z as admin1MatchPct,jt as allowedAggregations,Kn as answerIsRetryable,Pt as buildGeoIsoColumn,Et as buildGeoPointColumns,lt as calendarWordIn,Qn as capabilityFields,Rt as cityMatchPct,St as cityTagsFor,yn as classifyAdditivity,Bt as classifyForAggregation,gn as classifyNumericValueNature,fn as classifyTemporal,qt as codeNeedsLegacyAggNames,Xt as codeReadsColumn,Jt as codeReadsColumnsByRoleOrPosition,Wt as collapseRepeatedAggPrefix,Zt as columnsTheCodeReads,_t as countryRegion,br as createGenerateClient,cr as createTelemetryClient,Bn as credentialFields,Nn as dateLevelPart,In as dateLevelYearAdmits,Cn as decimalSeparatorOf,Ht as defaultAggregation,bn as detectDecimalSeparator,Ot as detectFormatSignature,xt as detectGeo,ft as detectOrdinalDomain,mn as detectTextDatePattern,O as encodePayload,En as engineTypeForSqlType,zt as englishImplicitAggNames,oe as eventLogLine,Yn as fetchFields,mr as fetchTransport,Fe as foldName,Fn as freemiumColumnCapRefusal,ye as freemiumColumnsOverCap,ge as freemiumDateHierarchyClauses,$e as gluedPrefixStems,wn as gzipWireText,Be as hangulWordEndsWith,Ut as hasDefaultAggPrefix,De as hasUnsegmentedScript,pn as hostAggHint,Sn as ingest,Yt as isAggregationAllowed,W as isBlankLike,yt as isCityTableLoaded,Xe as isDeterministicRefusal,ur as isEventLogCode,bt as isGeoPointAmbiguity,dn as isIdentifierName,vt as isJoinGeoKind,Pn as isNdjsonContentType,dt as isOrdinalFriendlyName,vn as keyedSigner,Jn as leafCardinalityField,rt as localMidnightDateColumns,nt as localMidnightToUtcDay,ct as localizedCycleIn,ut as localizedYearWordIn,I as looksLikeCountryColumn,He as matchNameToken,Hn as maxNonMeasureCardinality,rn as measureCadence,cn as measureSeriesCompleteness,k as messageSignature,It as monthLookupFor,Ge as nameLetterRuns,Kt as nameLooksIntensiveRate,$t as nameLooksPositional,ke as nameWords,gt as normalizeCountry,ot as normalizeLocalMidnightDates,Nt as normalizeMonthKey,D as normalizePlaceName,Ct as normalizeZip5,Zn as offeredShortlistFor,Ze as parseDateStable,Vn as parseGenerateResponse,Tn as parseNumberText,Dn as parseQualifyResponse,Un as parseReviewVerdict,nn as parseTemporalPoint,xn as payloadPreview,un as pickSeriesColumn,Wn as progressStageOf,Q as readGenerateStream,Ve as readName,h as readWireField,pt as registerCityTable,Lt as registerIso3Regions,M as resolveAdmin1,Ee as resolveFetchVersion,Tt as resolveGeoPoint,Ie as resolveLanguage,_n as resolvePointRoles,Xn as retryFields,mt as safeDistinctValuesToShip,xe as schemaIdentity,tr as schemaIdentityKey,Re as schemaTypeFamily,ln as seriesKeyVerdict,Qt as shareOfTotalIsHonest,Se as shortlistIsStale,Dt as stripHostAggPrefix,At as summarizeCountryRegions,Mt as summarizeGeoExtent,Ae as supportedLanguage,wt as toGeoIso,Ue as unsegmentedRuns,jn as viewportFields,K as vocabularyLanguage,et as wholeDayFrame,tt as wholeDayIso,Y as wireResponseFromFetch,qe as wordEndsWith,te as zipMatchPct,q as zipPrefixCandidates,ht as zipToPrefix3};
|
|
@@ -15,6 +15,7 @@ export interface FetchTransportOptions {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* A WireTransport over `fetchFn`. Every request is a POST; each call's `timeoutMs` covers the headers
|
|
18
|
-
* and the body; the caller's `signal`, when given, cancels as well.
|
|
18
|
+
* and the body; the caller's `signal`, when given, cancels as well. A `timeoutMs` that is not above 0
|
|
19
|
+
* and at most 2^31-1 rejects with a RangeError, and the fetch is never called.
|
|
19
20
|
*/
|
|
20
21
|
export declare function fetchTransport(fetchFn: FetchFunction, options?: FetchTransportOptions): WireTransport;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/shape-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.40",
|
|
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",
|