@graphysdk/viz-engine 1.9.0-beta.1792149244850 → 1.9.0-beta.1792399585685

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.
@@ -0,0 +1 @@
1
+ let I=require("color2k"),v=require("date-fns"),tt=require("lodash-es");var Zt=["diagonal","dots","crosshatch","lines"],Qt=["tile","stretch"],Ie=e=>typeof e=="object"&&e!==null&&"gradient"in e,ke=e=>typeof e=="object"&&e!==null&&"pattern"in e,rt=e=>typeof e=="object"&&e!==null&&"image"in e,er=e=>typeof e!="object"?e:Ie(e)?e.stops[0]?.color??"transparent":ke(e)?e.color:e.fallback,Wn=e=>typeof e=="string"?e:JSON.stringify(e),Pt="#FFFFFF",Be="#1A1A1A",Un=4.5,tr=e=>{try{const t=re(e);return(0,I.getContrast)(t,Pt)>(0,I.getContrast)(t,Be)?Pt:Be}catch{return Be}},Yn=(e,t)=>{try{const r=rr(void 0,t);return r===void 0||(0,I.getContrast)(r,re(e))>=Un?e:tr(r)}catch{return e}},rr=(e,t)=>{try{const r=re(t);if(e===void 0){const[,,,i]=(0,I.parseToRgba)(r);return i>=1?r:void 0}const n=re(e),[,,,a]=(0,I.parseToRgba)(n);return a>=1?n:(0,I.parseToRgba)(r)[3]<1?void 0:(0,I.mix)(r,(0,I.opacify)(n,1),a)}catch{return}},Gn=e=>{try{return(0,I.opacify)(re(e),1)}catch{return}},nr=(e,t)=>{if(t>=1)return e;try{const[r,n,a,i]=(0,I.parseToRgba)(re(e));return`rgba(${r}, ${n}, ${a}, ${Math.max(0,i*t)})`}catch{return e}},zn=e=>Ie(e)?e.stops.every(t=>ve(t.color)):ke(e)?e.background!==void 0&&ve(e.color)&&ve(e.background):rt(e)?ve(e.fallback):ve(e),ve=e=>{try{return(0,I.parseToRgba)(re(e))[3]>=1}catch{return!1}},re=e=>{const t=/^(rgb|hsl)a?\((.*)\)$/iu.exec(e.trim());if(t===null||t[1]===void 0||t[2]===void 0)return e;const r=t[2].split(/[\s,/]+/u).filter(u=>u!=="");if(r.length!==3&&r.length!==4)return e;const[n="",a,i,o]=r,s=[n.replace(/deg$/iu,""),a,i];if(o===void 0)return`${t[1]}(${s.join(", ")})`;const l=o.endsWith("%")?Number.parseFloat(o)/100:o;return`${t[1]}a(${[...s,l].join(", ")})`},Re=e=>e instanceof Date&&(0,v.isValid)(e),Hn=e=>Re(e)||e===null,Kn=e=>typeof e=="string",O=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),Xn=e=>O(e)||e===null,W=Math.PI*2,$n=8,qn=1e-9,Jn=[0,Math.PI/2,Math.PI,W*3/4],ar=(e,t)=>Math.abs(t-e)>=W-qn,ne=e=>(e%W+W)%W,ir=(e,t,r)=>{if(ar(t,r))return!0;const n=ne(r-t);return ne(e-t)<=n},nt=(e,t)=>{const r=Math.abs(ne(e)-ne(t));return Math.min(r,W-r)},Zn=(e,t)=>{const r=ne(t-e);return r>Math.PI?r-W:r},Qn=(e,t,r)=>e*W+t+r,or=(e,t)=>({x:t*Math.sin(e),y:t*Math.cos(e)}),Z=(e,t)=>{const r=or(e,t);return{x:.5+r.x/2,y:.5+r.y/2}},sr=(e,t,r,n)=>{const a=[Z(e,r),Z(e,n),Z(t,r),Z(t,n)],i=Math.max(r,n),o=Jn.filter(l=>ir(l,e,t)).map(l=>Z(l,i)),s=[...a,...o];return{xMin:Math.min(...s.map(l=>l.x)),xMax:Math.max(...s.map(l=>l.x)),yMin:Math.min(...s.map(l=>l.y)),yMax:Math.max(...s.map(l=>l.y))}},lr=(e,t)=>({angle:ne(Math.atan2(e,t)),radius:Math.hypot(e,t)}),ur=(e,t)=>{const r=e.x-.5,n=e.y-.5;return{x:t>=1?r*2*t:r*2,y:t>=1?n*2:n*2/t}},ea=(e,t)=>{const{x:r,y:n}=ur(e,t);return lr(r,n)},cr="\0graphy\0_",g=e=>`${cr}${e}`,at={x:g("constantX")},ta={bar:g("barSeriesLabel"),line:g("lineSeriesLabel")},it={count:g("count"),mean:g("mean"),sum:g("sum"),summaryEstimate:g("summaryEstimate"),summaryLower:g("summaryLower"),summaryUpper:g("summaryUpper")},Le={group:g("group")},y={x:g("x"),y:g("y"),xBand:g("xBand"),yBand:g("yBand"),xMin:g("xMin"),xMax:g("xMax"),yMin:g("yMin"),yMax:g("yMax"),yRaw:g("yRaw")},ot={role:g("stackRole")},oe={color:g("color"),size:g("size"),alpha:g("alpha"),strokeWidth:g("strokeWidth"),lineType:g("lineType")},Ae={y:g("ruleY"),x:g("ruleX")},js={...at,...it,...Le,...y,...ot,...oe,...Ae},ra=new Set(Object.values(it)),dr=e=>g(`scaled_${e}`),na=e=>e.startsWith(cr),aa=e=>ra.has(e);function K(e){return e[y.x]}function U(e){return e[y.y]}function ia(e){return e[y.xBand]??e[y.x]}function oa(e){return e[y.yBand]??e[y.y]}function X(e){return e[y.xMin]}function $(e){return e[y.xMax]}function Y(e){return e[y.yMin]}function G(e){return e[y.yMax]}function fr(e){return e[y.yRaw]}function sa(e,t){return e[dr(t)]}var la={xMin:0,xMax:1,yMin:0,yMax:1},hr=(e,t)=>{const r=X(e)??K(e),n=$(e)??K(e),a=Y(e)??U(e),i=G(e)??U(e);return!O(r)||!O(n)||!O(a)||!O(i)?null:t.type!=="polar"?{xMin:r,xMax:n,yMin:a,yMax:i}:{...sr(r,n,a,i),space:"disk"}},st=(e,t)=>{const r=(e.xMin+e.xMax)/2,n=(e.yMin+e.yMax)/2;switch(t){case"top":return{x:r,y:e.yMax};case"bottom":return{x:r,y:e.yMin};case"left":return{x:e.xMin,y:n};case"right":return{x:e.xMax,y:n};case"top-left":return{x:e.xMin,y:e.yMax};case"top-right":return{x:e.xMax,y:e.yMax};case"bottom-left":return{x:e.xMin,y:e.yMin};case"bottom-right":return{x:e.xMax,y:e.yMin};default:return{x:r,y:n}}},ua=e=>st(la,e),we=e=>(Array.isArray(e)?e:[e]).map(t=>t instanceof Date?t.toISOString():String(t??"<null>")).join("\0"),ca=(e,t)=>e===t?!0:Re(e)&&Re(t)?e.getTime()===t.getTime():!1,pr=e=>e===null?"null":e instanceof Date?`date:${e.getTime()}`:`${typeof e}:${e}`,da=e=>e.length>0;function N(e){return e!=null}function fa(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ha(e,t){const{numeric:r,categorical:n,temporal:a}=e.groupVariableNamesByType(),i=[...a,...n];return i.find(o=>o!==t)??i[0]??r[0]??""}function pa(e,t){const{categorical:r,temporal:n}=e.groupVariableNamesByType(),a=[...r,...n];return t===""||a.includes(t)?a:[t,...a]}function ya(e){const t=R(e.x);return t===null||t===at.x?"":t}function R(e){return N(e)?typeof e=="string"?e:"variable"in e?e.variable:null:null}function Ee(e){if(!(!N(e)||typeof e=="string")&&"value"in e)return e.value}function ga(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].every(r=>St(e[r])===St(t[r]))}function St(e){const t=R(e);if(t!==null)return`variable:${t}`;const r=Ee(e);return r===void 0?"":`value:${pr(r)}`}var yr=["stack","dodge","identity","fill"],gr=["solid","dashed","dotted"],C={line:{solid:[],dashed:[4,2],dotted:[0,3]},rule:{solid:[],dashed:[2,3],dotted:[0,2]},gridLine:{solid:[],dashed:[2,3],dotted:[0,3]},panelBorder:{solid:[],dashed:[2,3],dotted:[1,3]},directLabel:{solid:[],dashed:[2,3],dotted:[1,3]},arrow:{solid:[],dashed:[1.5,3],dotted:[0,2]}},ma=e=>gr.includes(e);function de(e){return e==="stack"||e==="fill"}var Se="en-GB",lt=class extends Error{constructor(e){super(e.message,e.cause!==void 0?{cause:e.cause}:void 0),this.name=new.target.name,this.code=e.code,this.context=e.context,this.suggestion=e.suggestion}},ae=class extends lt{constructor(e){super(e),this.kind="user-input"}},_=class extends lt{constructor(e){super({...e,code:e.code??"INTERNAL_INVARIANT"}),this.kind="internal"}},ut=e=>e.type==="lookup",mr=e=>e.type==="text",he=e=>e.type==="date"||e.type==="datetime"||e.type==="year"||e.type==="month_year"||e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range"||e.type==="weekly_date_range_with_year"||e.type==="quarter"||e.type==="time",br=e=>e.type==="decimal"||e.type==="integer"||e.type==="percentage"||e.type==="duration"||e.type==="currency",ba=e=>e.type==="currency",va=e=>e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range",vr=e=>{if(ut(e))return vr(e.fallback);if(he(e))return"temporal";if(br(e))return"numeric";if(mr(e))return"categorical";throw new _({message:`No data type found for value format: ${e.type}`})},Aa=e=>ut(e)?e.fallback:e,Ar=class{constructor(){this.currentYear=new Date().getUTCFullYear(),this.previousDate=null,this.previousYear=null}incrementYearIfNeeded(e){this.previousYear===null?this.previousYear=e.getUTCFullYear():this.previousDate!==null&&(0,v.isBefore)(new Date(this.currentYear,e.getUTCMonth(),e.getUTCDate()),new Date(this.currentYear,this.previousDate.getUTCMonth(),this.previousDate.getUTCDate()))&&this.previousYear++;const t=new Date(e.getTime());return t.setUTCFullYear(this.previousYear),this.previousDate=t,t}},Tr={k:1e3,m:1e6,b:1e9,t:1e12},ct=["k","m","b","t"],Ta=new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${ct.join("|")})?$`,"i"),Ea=/^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/,ie=e=>e===null||e instanceof Date||Array.isArray(e)||typeof e=="boolean"?!1:typeof e=="string"?Ta.test(e)&&!Number.isNaN(Number(e.replace(new RegExp(`[,${ct.join("")}]`,"gi"),""))):Number.isFinite(Number(e)),Er=e=>ie(e)?!0:typeof e=="string"?Ea.test(e):!1,Pa=/^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/,Sa=/^\s*(1[89]\d{2}|2[01]\d{2})\s*$/,Oa=[[/\bJan\b/i,"January"],[/\bFeb\b/i,"February"],[/\bMar\b/i,"March"],[/\bApr\b/i,"April"],[/\bJun\b/i,"June"],[/\bJul\b/i,"July"],[/\bAug\b/i,"August"],[/\bSept?\b/i,"September"],[/\bOct\b/i,"October"],[/\bNov\b/i,"November"],[/\bDec\b/i,"December"]],xa={"en-US":"MDY","en-GB":"DMY","pt-PT":"DMY",ar:"DMY"},Pr=["/","-","."," "],Ot=[["d","M","yy"],["d","MM","yy"],["d","MMMM","yy"],["dd","M","yy"],["dd","MM","yy"],["dd","MMMM","yy"],["do","MMMM","yy"],["d","M","yyyy"],["d","MM","yyyy"],["d","MMMM","yyyy"],["dd","M","yyyy"],["dd","MM","yyyy"],["dd","MMMM","yyyy"],["do","MMMM","yyyy"]],xt=[["M","d","yy"],["M","dd","yy"],["MM","d","yy"],["MM","dd","yy"],["MMMM","d","yy"],["MMMM","dd","yy"],["MMMM","do","yy"],["M","d","yyyy"],["M","dd","yyyy"],["MM","d","yyyy"],["MM","dd","yyyy"],["MMMM","d","yyyy"],["MMMM","dd","yyyy"],["MMMM","do","yyyy"]],Mt=[["yyyy","M","d"],["yyyy","M","dd"],["yyyy","MM","d"],["yyyy","MM","dd"],["yyyy","MMMM","d"],["yyyy","MMMM","dd"],["yyyy","MMMM","do"]],Sr=[["d","MMMM"],["dd","MMMM"],["do","MMMM"],["MMMM","d"],["MMMM","dd"],["MMMM","do"]],Ma=[{dateFormat:"MMMM d, yyyy",type:"date"},{dateFormat:"MMMM dd, yyyy",type:"date"},{dateFormat:"MMMM do, yyyy",type:"date"},{dateFormat:"yyyy-MM",type:"month_year"}],Or=1800,xr=2199,_a=3,Ra=6,La=5,wa=1,Ia=28,ka=/\s*[–—]\s*|\s-\s/,Da=e=>typeof e=="number"?Number.isInteger(e)&&e>=Or&&e<=xr:typeof e=="string"?Sa.test(e):!1,Mr=(e,t)=>{const r=Pe(e);return!t&&ie(r)?ja(r):typeof r=="string"?t?(0,v.isValid)((0,v.parse)(r,t,new Date)):!!_r(r)||De(r)&&(0,v.isValid)(new Date(r)):(0,v.isValid)(r)},Pe=e=>{if(typeof e!="string")return e;let t=e;for(const[r,n]of Oa)t=t.replace(r,n);return t},_r=(e,t=Se)=>{const r=Pe(e);return De(r)?{type:"datetime"}:Lr(t).find(n=>!he(n)||n.type==="month"&&r.length<_a?!1:n.dateFormat&&(0,v.isValid)((0,v.parse)(r,n.dateFormat,new Date)))},De=e=>Pa.test(e.trim()),Rr=e=>{if(e instanceof Date)return(0,v.isValid)(e)?e:null;if(typeof e!="string"||!De(e))return null;const t=new Date(e.trim());return(0,v.isValid)(t)?t:null},Ca=(e,t=Se)=>{const[r,n]=e.split(ka);if(!r||!n)return;const a=Pe(r).trim(),i=Pe(n).trim();return Na(t).find(o=>{if(!he(o)||!o.dateFormat)return!1;const s=(0,v.parse)(a,o.dateFormat,new Date),l=(0,v.parse)(i,o.dateFormat,new Date);if(!(0,v.isValid)(s)||!(0,v.isValid)(l))return!1;const u=new Ar,d=u.incrementYearIfNeeded(s),h=u.incrementYearIfNeeded(l),c=(0,v.differenceInDays)(h,d);return(0,v.isWithinInterval)(new Date(d.getFullYear(),wa,Ia),{start:d,end:h})&&c===La?!0:c===Ra})},Lr=e=>{const t={date:wr(e),year:[["yyyy"]],day_month:Sr,month_year:[["MMMM","yyyy"],["yyyy","MMMM"]],month:[["MMMM"]],quarter:[["QQQ","yyyy"],["yyyy","QQQ"]]};return[...Ma,...Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>Pr.map(i=>({dateFormat:a.join(i),type:r}))))]},wr=e=>xa[e]==="MDY"?[...xt,...Ot,...Mt]:[...Ot,...xt,...Mt],Na=e=>{const t={weekly_date_range:Sr,weekly_date_range_with_year:wr(e)};return Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>Pr.map(i=>({dateFormat:a.join(i),type:r}))))},ja=e=>{const t=Number(e);if(!(0,tt.isInteger)(t))return!1;const r=new Date(t),n=new Date(t*1e3),a=i=>(0,v.isValid)(i)&&i.getFullYear()>=Or&&i.getFullYear()<=xr;return a(r)||a(n)},Ir={$:"usd","£":"gbp","€":"eur","¥":"jpy","₹":"inr","₱":"php",P:"php","₩":"krw","₪":"ils","₫":"vnd","₽":"rub","฿":"thb",R$:"brl",Rp:"idr",RM:"myr","₦":"ngn",zł:"pln","₺":"try",kr:"dkk",Fr:"chf",R:"zar","د.إ":"aed","﷼":"sar",Ch$:"clp",NT$:"twd",HK$:"hkd",S$:"sgd",A$:"aud",C$:"cad",NZ$:"nzd",MX$:"mxn"},kr=e=>{if(typeof e=="string"){const t=Dr(e);return t.length?ie(t):!1}return ie(e)},Va=e=>{const t=Cr(e),r=t?Ir[t]:void 0;if(!r)throw new _({message:"Could not get currency ISO"});return r},Dr=e=>{const t=Cr(e);let r=e;if(t){const n=e.indexOf(t);n===0?r=e.slice(t.length):n===e.length-t.length?r=e.slice(0,e.length-t.length):e[0]==="-"&&n===1&&(r=`-${e.slice(t.length+1)}`)}return ie(r)?r.split(",").join(""):""},Cr=e=>Object.keys(Ir).sort((t,r)=>r.length-t.length).find(t=>e.includes(t)),Nr=e=>{const t=Object.entries(e);return!t.length||!t.some(([,r])=>!fe(r))},fe=e=>typeof e=="string"&&e.trim()===""||e===void 0||e===null||e==="-",Fa=/\s*[–—]\s*|\s-\s/,jr=(e,t,r)=>{if(fe(e))return null;switch(t.type){case"decimal":case"integer":case"duration":return Fr(e);case"percentage":return Ba(e);case"currency":return Wa(e);case"datetime":case"date":case"year":case"month_year":case"month":case"day_month":case"quarter":case"time":return Vr(e,t.dateFormat,r);case"weekly_date_range":case"weekly_date_range_with_year":return Ua(e,t.dateFormat,r);case"text":return Ya(e);case"lookup":throw new _({message:"Cannot parse: lookup value formats are produced by transforms, not raw input"});default:throw new _({message:`Unhandled value format: ${t.type}`})}},Vr=(e,t,r)=>{if(e instanceof Date)return(0,v.isValid)(e)?e:null;const n=Pe(String(e).trim());if(n.length===0)return null;const a=new Date;if(t){const o=(0,v.parse)(n,t,a);return(0,v.isValid)(o)?We(o):null}for(const o of Lr(r)){if(!he(o)||!o.dateFormat)continue;const s=(0,v.parse)(n,o.dateFormat,a);if((0,v.isValid)(s))return We(s)}const i=new Date(n);return Mr(i)?De(n)?i:We(i):null},Fr=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;let t=e.trim();if(!ie(t))return null;let r=1;for(const n of ct)if(new RegExp(`${n}$`,"i").test(t)){r=Tr[n],t=t.slice(0,-1);break}return Number(t.split(",").join(""))*r},Ba=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;const t=e.trim();if(!Er(t))return null;const r=Number(t.replace(/%/g,"").replace(/,/g,""))/100;return Number.isNaN(r)?null:r},Wa=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;const t=e.trim();return kr(t)?Fr(Dr(t)):null},Ua=(e,t,r)=>{const n=String(e).trim().split(Fa),[a,i]=[n[0]?.trim(),n[1]?.trim()];return!a||!i?null:Vr(a,t,r)},Ya=e=>String(e).trim(),We=e=>new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),dt=(e,t,r)=>{if(t.type==="text"&&typeof e=="string")return e;const n=jr(e,t,r);return n!==null||!he(t)?n:Rr(e)},ee=process.env.NODE_ENV!=="production",ft=["none","xs","sm","md","lg","xl","full"],Ga={point:za,line:Ha,area:Ka,bar:Xa,rule:$a,tile:qa},Br=e=>typeof e=="string"&&ft.includes(e);function se(e,t){return{type:"layer",id:t.id,geom:e,mapping:t.aes,stat:t.stat,params:t.params,position:t.position,yScaleType:t.yScaleType,transforms:t.transforms,interactive:t.interactive,attachTo:t.attachTo,tooltip:t.tooltip,dataLabels:t.dataLabels}}function za(e={}){return se("point",e)}function Ha(e={}){return se("line",e)}function Ka(e={}){return se("area",e)}function Xa(e={}){return se("bar",e)}function $a(e={}){return se("rule",e)}function qa(e={}){return se("tile",e)}var Ja=["topLeft","topRight","bottomRight","bottomLeft"],Za=["dimmed","hovered"],Wr=["normal","italic","oblique"],Ur=["none","uppercase","lowercase","capitalize"],Yr=["none","underline","line-through"],Gr=["butt","round","square"],zr=["miter","round","bevel"],Hr=["normal","multiply","screen","overlay","darken","lighten"],Kr=["circle","square","diamond","triangle","cross","star","wye"],Qa=["fill","overlay","stroke","alpha","saturation","blur","brightness","contrast","cornerRadius","strokeWidth","dashArray","lineCap","lineJoin","strokeAlpha","fillAlpha","haloColor","haloAlpha","size","symbol","fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","textDecoration","textOutlineColor","textOutlineWidth","textShadow","lineHeight","textScale","textColor","offset","gap","length","paddingInline","paddingBlock","padding","margin","shadow","blendMode"],_t=1,Rt=1e3,Lt="'none' or a shadow object { offsetX, offsetY, blur, color }",wt="a non-negative number of pixels, or an object of those per edge",ei="a non-empty color string, a { light, dark } pair, or a token(...) reference",ti=["top","right","bottom","left"],Me="a color, a { gradient, stops } object, a { pattern, color } object, or an { image, fallback } object",It="a number of pixels, or { topLeft, topRight, bottomRight, bottomLeft } in pixels",Oe=e=>typeof e=="object"&&e!==null&&typeof e.light=="string"&&typeof e.dark=="string",ht=e=>typeof e=="object"&&e!==null&&typeof e.token=="string",Xr=e=>typeof e=="string"?e.trim().length>0:Oe(e)&&e.light.trim().length>0&&e.dark.trim().length>0;function f(e){return{token:e}}var Xe=(e,t)=>{if(typeof e!="object"||e===null)return e;if(Oe(e))return e[t];if(Array.isArray(e)){if(e.every(a=>typeof a=="number"))return e;const n=e.map(a=>Xe(a,t));return n.every((a,i)=>a===e[i])?e:n}const r=Object.entries(e).map(([n,a])=>[n,Xe(a,t)]);return r.every(([n,a])=>a===e[n])?e:Object.fromEntries(r)},E=e=>typeof e=="number"&&Number.isFinite(e),b=(e,t)=>({status:"rejected",expected:e,actual:t}),J=e=>{const t=`one of ${e.map(r=>`'${String(r)}'`).join(", ")}`;return r=>e.includes(r)?{status:"accepted",value:r}:b(t,r)},Q=(e,t)=>{if(typeof e=="string")return e.trim().length>0?{status:"accepted",value:e}:b("a non-empty color string",e);if(ht(e)){const r=t[e.token];return r===void 0?{status:"unknownToken",token:e.token}:Xr(r)?{status:"accepted",value:typeof r=="string"?r:{light:r.light,dark:r.dark}}:{status:"dropped"}}return Oe(e)&&e.light.trim().length>0&&e.dark.trim().length>0?{status:"accepted",value:{light:e.light,dark:e.dark}}:b(ei,e)},$r=(e,t)=>{if(typeof e!="object"||e===null||Oe(e)||ht(e))return Q(e,t);const r=e;if(Ie(r)){const n=r.gradient;if(n!=="linear"&&n!=="radial")return b(Me,e);if(!Array.isArray(r.stops)||r.stops.length<2)return b("a gradient with at least two stops",e);const a=[];for(const i of r.stops){if(!E(i.offset)||i.offset<0||i.offset>1)return b("a gradient stop offset in [0, 1]",e);const o=Q(i.color,t);if(o.status!=="accepted")return o;a.push({offset:i.offset,color:o.value})}return r.gradient==="radial"?{status:"accepted",value:{gradient:"radial",stops:a}}:r.angle!==void 0&&!E(r.angle)?b("a gradient angle in degrees",e):{status:"accepted",value:{gradient:"linear",...r.angle===void 0?{}:{angle:r.angle},stops:a}}}if(ke(r)){if(!Zt.includes(r.pattern))return b(Me,e);const n=Q(r.color,t);if(n.status!=="accepted")return n;const a={pattern:r.pattern,color:n.value};if(r.background!==void 0){const i=Q(r.background,t);if(i.status!=="accepted")return i;a.background=i.value}if(r.size!==void 0){if(!E(r.size)||r.size<=0)return b("a pattern size in pixels",e);a.size=r.size}return{status:"accepted",value:a}}if(rt(r)){if(typeof r.image!="string"||!r.image.startsWith("data:image/"))return b("an image as a data:image URI",e);if(r.fit!==void 0&&!Qt.includes(r.fit))return b(Me,e);if(r.alpha!==void 0&&(!E(r.alpha)||r.alpha<0||r.alpha>1))return b("an image alpha in [0, 1]",e);if(r.size!==void 0&&(!E(r.size)||r.size<=0))return b("an image size in pixels",e);const n=Q(r.fallback,t);return n.status!=="accepted"?n:{status:"accepted",value:{image:r.image,...r.fit===void 0?{}:{fit:r.fit},...r.alpha===void 0?{}:{alpha:r.alpha},...r.size===void 0?{}:{size:r.size},fallback:n.value}}}return b(Me,e)},ri=(e,t)=>{if(e==="none")return{status:"accepted",value:[]};const r=[];for(const n of Array.isArray(e)?e:[e]){const a=$r(n,t);if(a.status!=="accepted")return a;r.push(a.value)}return{status:"accepted",value:r}},kt=e=>{if(E(e)&&e>=0)return{status:"accepted",value:{top:e,right:e,bottom:e,left:e}};if(typeof e!="object"||e===null)return b(wt,e);const t=e,r={};for(const n of ti){const a=t[n];if(a!==void 0){if(!E(a)||a<0)return b(wt,e);r[n]=a}}return{status:"accepted",value:r}},ni=e=>{if(E(e)&&e>=0)return{status:"accepted",value:e};if(typeof e!="object"||e===null)return b(It,e);const t=e,r={};for(const n of Ja){const a=t[n];if(!E(a)||a<0)return b(It,e);r[n]=a}return{status:"accepted",value:r}},ai={color:Q,paint:$r,overlay:ri,unitInterval:e=>E(e)&&e>=0&&e<=1?{status:"accepted",value:e}:b("a number in [0, 1]",e),pixels:e=>E(e)&&e>=0?{status:"accepted",value:e}:b("a non-negative number of pixels",e),barRadius:e=>Br(e)||E(e)&&e>=0?{status:"accepted",value:e}:b(`a number of pixels or one of ${ft.map(t=>`'${t}'`).join(", ")}`,e),dashArray:e=>Array.isArray(e)&&e.every(t=>E(t)&&t>=0)?{status:"accepted",value:[...e]}:b("an array of non-negative dash and gap lengths, in stroke widths",e),fontFamily:e=>typeof e=="string"&&e.trim().length>0?{status:"accepted",value:e}:b("a non-empty CSS font-family list",e),fontWeight:e=>E(e)&&e>=_t&&e<=Rt?{status:"accepted",value:e}:b(`a number in [${_t}, ${Rt}]`,e),multiplier:e=>E(e)&&e>=0?{status:"accepted",value:e}:b("a non-negative multiple, 1 being unchanged",e),shadow:(e,t)=>{if(e==="none")return{status:"accepted",value:e};if(typeof e!="object"||e===null)return b(Lt,e);const r=e;if(!E(r.offsetX)||!E(r.offsetY)||!E(r.blur)||r.blur<0)return b(Lt,e);const n=Q(r.color,t);return n.status!=="accepted"?n:{status:"accepted",value:{offsetX:r.offsetX,offsetY:r.offsetY,blur:r.blur,color:n.value}}},padding:kt,margin:kt,blendMode:J(Hr),signedPixels:e=>E(e)?{status:"accepted",value:e}:b("a number of pixels, negative allowed",e),fontStyle:J(Wr),textTransform:J(Ur),textDecoration:J(Yr),lineCap:J(Gr),lineJoin:J(zr),pointSymbol:J(Kr),boxRadius:ni};var Ce=!0,ii=e=>{Ce=e},oi=()=>Ce,si=()=>{let e=null;const t={hits:0,misses:0};return Object.assign((n,a)=>{if(!Ce)return ee&&(t.misses+=1),a();if(e&&Jr(e.args,n))return ee&&(t.hits+=1),e.out;ee&&(t.misses+=1);const i=a();return e={args:n,out:i},i},{stats:t,reset:()=>{e=null}})},qr=()=>{const e=new WeakMap,t={hits:0,misses:0};return Object.assign((n,a,i)=>{if(!Ce)return ee&&(t.misses+=1),i();const o=e.get(n);if(o)for(let l=0;l<o.length;l+=1){const u=o[l];if(u&&Jr(u.args,a))return ee&&(t.hits+=1),l>0&&(o.splice(l,1),o.unshift(u)),u.out}ee&&(t.misses+=1);const s=i();return o?(o.unshift({args:a,out:s}),o.length>16&&(o.length=16)):e.set(n,[{args:a,out:s}]),s},{stats:t})},li=(...e)=>e.reduce((t,r)=>({hits:t.hits+r.hits,misses:t.misses+r.misses}),{hits:0,misses:0}),Jr=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return!1;return!0},Zr=class{constructor(){this.memo=qr(),this.singletonKey={}}get stats(){return this.memo.stats}compile(e){return this.memo(this.key(e),this.dependencies(e),()=>this.run(e))}key(e){return this.singletonKey}},Ne=(e,t)=>e>=0&&e<=1&&t>=0&&t<=1,ui=new Set(["min","max","scalar"]),ci={x:{min:y.xMin,max:y.xMax},y:{min:y.yMin,max:y.yMax}};function di(e){const t=new Set;for(const r of e)r.role==="point"?t.add(r.axis):(r.role==="min"||r.role==="max")&&N(r.aes)&&t.add(r.aes);return[...t]}function fi(e){const t=new Set;for(const r of e)r.role==="point"&&t.add(r.axis),N(r.aes)&&t.add(r.aes);return[...t]}function hi(e,t,r){let n=e;for(const a of t){if(a.role!=="min"&&a.role!=="max"||!N(a.aes))continue;const i=ci[a.axis][a.role];if(n.hasVariable(i))continue;const o=R(r[a.aes]);!N(o)||!n.hasVariable(o)||(n=n.addVariable(i,"numeric",n.getValues(o,{type:"numeric"})))}return n}var pt=(e,t)=>{const r=R(t.x);return!r||!["numeric","temporal"].includes(e.getType(r))?e:e.orderBy(r,"asc")},yt=(e,{coordSystem:t})=>{const r=K(e),n=U(e);return!O(r)||!O(n)?null:t.type==="polar"?Z(r,n):{x:r,y:n}},pi=({positionRoles:e,categorySpanAxes:t,aesthetics:r})=>[...di(e),...t,...r.filter(n=>n.required).map(n=>n.name)],yi=({categorySpanAxes:e=[]})=>e.includes("x"),gi=["x","y"],Qr=new Set(["x","y","ySecondary"]),gt=new Set(["color","size","alpha","strokeWidth","lineType"]),en=e=>Qr.has(e),tn=e=>gt.has(e),mi=e=>en(e)||tn(e);function rn(e){return e==="secondary"?"ySecondary":"y"}function bi(e,t){return e==="y"?rn(t):"x"}function vi(e){return e==="ySecondary"?"y":e}var nn=(e,t)=>{if(N(t.group)){const a=R(t.group);if(a!==null)return[a]}const r=new Set([R(t.x),R(t.y)].filter(N)),n=new Set;for(const a of gt){const i=R(t[a]);N(i)&&(r.has(i)||e.hasVariable(i)&&e.getType(i)==="categorical"&&n.add(i))}return[...n]},mt=(e,t)=>e.hasVariable(Le.group)?e.getValues(Le.group,{distinct:!0,skipNulls:!0}).length>1:nn(e,t).some(r=>e.getValues(r,{distinct:!0,skipNulls:!0}).length>1),Ai=new Set(["count","sum","mean","median"]);function an(e,t){return Ai.has(e)?"numeric":t}function on(e,t,r,n){if(n!==void 0&&n.type!=="numeric"&&(e==="sum"||e==="mean"||e==="median"))throw new ae({code:"INCOMPATIBLE_TYPE",message:`'${e}' requires a numeric variable (got '${n.type}' for '${n.variableName}')`,context:{variableName:n.variableName,variableType:n.type}});const a=r?.length??t.length;if(e==="count")return a;if(e==="median"||e==="mode"){const s=[];for(let l=0;l<a;l++){const u=Ue(t,r,l);Ye(u)&&s.push(u)}return s.length===0?null:e==="median"?Pi(s):Si(s)}if(e==="sum"||e==="mean"){let s=0,l=0;for(let u=0;u<a;u++){const d=Ue(t,r,u);Ye(d)&&(s++,l+=Number(d))}return s===0?null:e==="sum"?l:l/s}const i=e==="min"?-1:1;let o=null;for(let s=0;s<a;s++){const l=Ue(t,r,s);Ye(l)&&(o===null||Ti(l,o)===i)&&(o=l)}return o}var Ue=(e,t,r)=>e[t?.[r]??r]??null,Ye=e=>e!==null&&!(typeof e=="number"&&Number.isNaN(e)),Ti=(e,t)=>e===null||t===null?0:e<t?-1:e>t?1:0,Ei=e=>e instanceof Date?e.getTime():e??null;function Pi(e){const t=e.map(Number).sort((i,o)=>i-o);if(t.length===1)return t[0]??0;const r=(t.length-1)/2,n=Math.floor(r),a=t[n]??0;return a+((t[n+1]??a)-a)*(r-n)}function Si(e){const t=new Map;for(const a of e){const i=Ei(a),o=t.get(i);o===void 0?t.set(i,{value:a,count:1}):o.count++}let r=null,n=0;for(const{value:a,count:i}of t.values())i>n&&(n=i,r=a);return r}var Oi=e=>e==null||typeof e=="number"&&Number.isNaN(e),xi=e=>e instanceof Date?e.getTime():e??null,$e=class H{constructor(t,r,n,a=null){this.rowShape=null,this.names=t,this.columns=r,this.rowCount=n,this.source=a}get columnCount(){return this.names.length}static from(t){const r=Object.entries(t);return new H(r.map(([n])=>n),new Map(r),r[0]?.[1].length??0)}columnNames(){return[...this.names]}hasColumn(t){return this.names.includes(t)}values(t){const r=this.columns.get(t);if(r!==void 0)return r;if(this.source===null||!this.names.includes(t))return;const n=this.source.table.values(t);if(n===void 0)return;const{indices:a}=this.source,i=new Array(a.length);for(let o=0;o<a.length;o++)i[o]=n[a[o]??0]??null;return this.columns.set(t,i),this.columns.size===this.names.length&&(this.source=null),i}assign(t,r){const n=this.gathered(),a=new Map(n.columns);a.set(t,r);const i=n.names.includes(t)?[...n.names]:[...n.names,t];return new H(i,a,n.names.length===0?r.length:n.rowCount)}select(t){const r=t.filter(a=>this.names.includes(a)),n=new Map;for(const a of r){const i=this.columns.get(a);i!==void 0&&n.set(a,i)}return new H(r,n,this.rowCount,this.source)}rename(t,r){const n=this.gathered(),a=new Map;for(const i of n.names){const o=n.columns.get(i);o!==void 0&&a.set(i===t?r:i,o)}return new H(n.names.map(i=>i===t?r:i),a,n.rowCount)}take(t){const r=this.source===null?{table:this,indices:t}:{table:this.source.table,indices:t.map(n=>this.source?.indices[n]??0)};return new H(this.names,new Map,t.length,r)}sortedIndices(t,r){const n=this.values(t);if(n===void 0)return Array.from({length:this.rowCount},(s,l)=>l);const a=[],i=[];for(let s=0;s<this.rowCount;s++)(Oi(n[s])?a:i).push(s);const o=r==="asc"?1:-1;return i.sort((s,l)=>{const u=n[s],d=n[l];return u<d?-o:u>d?o:0}),a.length===0?i:r==="asc"?[...a,...i]:[...i,...a]}partition(t){const r=t.map(i=>this.values(i)).filter(i=>i!==void 0),n=r.length===1?r[0]:void 0,a=new Map;if(n!==void 0){for(let i=0;i<this.rowCount;i++){const o=xi(n[i]),s=a.get(o);s===void 0?a.set(o,{key:we(n[i]??null),indices:[i]}):s.indices.push(i)}return[...a.values()]}for(let i=0;i<this.rowCount;i++){const o=we(r.map(l=>l[i])),s=a.get(o);s===void 0?a.set(o,{key:o,indices:[i]}):s.indices.push(i)}return[...a.values()]}fold(t,r,n){const a=this.names.filter(c=>!t.includes(c)),i=this.rowCount*t.length,o=a.map(c=>({name:c,source:this.values(c)??[],repeated:new Array(i)})),s=t.map(c=>this.values(c)??[]),l=new Array(i),u=new Array(i);let d=0;for(let c=0;c<this.rowCount;c++)for(let p=0;p<t.length;p++,d++){for(const m of o)m.repeated[d]=m.source[c]??null;l[d]=t[p]??"",u[d]=s[p]?.[c]??null}const h=new Map;for(const{name:c,repeated:p}of o)h.set(c,p);return h.set(r,l),h.set(n,u),new H([...a,r,n],h,i)}objectAt(t){const{names:r,arrays:n,template:a}=this.rowShape??this.resolveRowShape(),i={...a};for(let o=0;o<r.length;o++)i[r[o]??""]=n[o]?.[t]??null;return i}*[Symbol.iterator](){for(let t=0;t<this.rowCount;t++)yield this.objectAt(t)}resolveRowShape(){const t={};for(const r of this.names)t[r]=null;return this.rowShape={names:this.names,arrays:this.names.map(r=>this.values(r)??[]),template:t},this.rowShape}gathered(){if(this.source===null)return this;for(const t of this.names)this.values(t);return new H(this.names,new Map(this.columns),this.rowCount)}};var sn="value",Te={numeric:{type:"decimal"},categorical:{type:"text"},temporal:{type:"datetime"}},Dt={eq:(e,t)=>e===t,neq:(e,t)=>e!==t,gt:(e,t)=>e!==null&&t!==null&&e>t,gte:(e,t)=>e!==null&&t!==null&&e>=t,lt:(e,t)=>e!==null&&t!==null&&e<t,lte:(e,t)=>e!==null&&t!==null&&e<=t},Ct=e=>e===null?null:e instanceof Date?e.getTime():new Date(e).getTime(),ln=(e,t)=>e==="count"?{type:"integer"}:t,un=(e,t,r)=>{const n=e.values(t);if(n!==void 0)return n;if(r==="count")return new Array(e.rowCount);throw new _({message:`Variable '${t}' not defined`})},te=class M{constructor(t={}){const{table:r,variableMetadata:n}=this.parseVariableMap(t);this.table=r,this.variableMetadata=n}static fromTrusted(t,r){const n=Object.create(M.prototype);return n.table=t,n.variableMetadata=r,n}size(){return this.table.rowCount}getVariableNames(){return this.table.columnNames()}hasVariable(t){return this.table.hasColumn(t)}addVariable(t,r,n,a){if(this.table.columnCount>0&&n.length!==this.size())throw new _({message:`Variable '${t}' has ${n.length} values, expected ${this.size()}`});const i={...this.variableMetadata,[t]:{type:r,valueFormat:this.resolveAddedVariableFormat(t,r,a)}},o=this.normalizeRawValues(r,n),s=this.table.assign(t,o);return M.fromTrusted(s,i)}addConstantVariable(t,r,n,a){const i={...this.variableMetadata,[t]:{type:r,valueFormat:this.resolveAddedVariableFormat(t,r,a),constant:{value:n}}},[o=null]=this.normalizeRawValues(r,[n]),s=this.table.assign(t,new Array(this.size()).fill(o));return M.fromTrusted(s,i)}getConstant(t){return this.variableMetadata[t]?.constant}deriveVariable(t,r,n,a){const i=Array.from({length:this.size()},(o,s)=>n(this.table.objectAt(s)));return this.addVariable(t,r,i,a)}deriveVariableFrom(t,r,n,a,i){const o=this.hasVariable(t)?this.getValues(t).map(a):Array.from({length:this.size()},()=>a(null));return this.addVariable(r,n,o,i)}renameVariable(t,r){const n=this.variableMetadata[t];if(!n)throw new _({message:`Variable ${t} not defined`});const a=this.table.rename(t,r),{[t]:i,...o}=this.variableMetadata,s={...o,[r]:n};return M.fromTrusted(a,s)}selectVariables(...t){const r=this.table.select(t),n=Object.fromEntries(Object.entries(this.variableMetadata).filter(([a])=>t.includes(a)));return M.fromTrusted(r,n)}getType(t){const r=this.variableMetadata[t];if(!r)throw new _({message:`Variable ${t} not defined`});return r.type}getValueFormat(t){const r=this.variableMetadata[t];if(!r)throw new _({message:`Variable ${t} not defined`});return r.valueFormat}groupVariableNamesByType(){const t={numeric:[],categorical:[],temporal:[]};for(const[r,{type:n}]of Object.entries(this.variableMetadata))t[n].push(r);return t}getValues(t,r){if(!this.hasVariable(t))throw new _({message:`Variable '${t}' not defined`});const n=this.getType(t);if(r?.type!==void 0&&n!==r.type){if(this.size()===0)return[];throw new _({message:`Variable '${t}' has type '${n}', expected '${r.type}'`})}let a=this.table.values(t)??[];return r?.distinct&&(a=this.getDistinctValues(n,a)),r?.skipNulls&&(a=this.skipNulls(a)),a}filter(t,r,n){if(this.hasVariable(t)&&this.getType(t)==="temporal")return this.filterByTimestamp(t,r,n);const a=Dt[r],i=this.table.values(t)??[],o=[];for(let s=0;s<i.length;s++)a(i[s]??null,n)&&o.push(s);return M.fromTrusted(this.table.take(o),this.variableMetadata)}filterByMask(t){if(t.length!==this.size())throw new _({message:`Row mask length ${t.length} does not match dataset size ${this.size()}`});const r=[];for(let n=0;n<t.length;n++)t[n]===1&&r.push(n);return M.fromTrusted(this.table.take(r),this.variableMetadata)}take(t){return M.fromTrusted(this.table.take(t),this.variableMetadata)}orderBy(t,r="asc"){const n=this.table.take(this.table.sortedIndices(t,r));return M.fromTrusted(n,this.variableMetadata)}getAt(t){return t<0||t>=this.size()?null:this.table.objectAt(t)}getFirst(){return this.getAt(0)}getLast(){return this.getAt(this.size()-1)}findFirst(t){const r=this.size();for(let n=0;n<r;n++){const a=this.table.objectAt(n);if(t(a))return a}return null}findLast(t){for(let r=this.size()-1;r>=0;r--){const n=this.table.objectAt(r);if(t(n))return n}return null}groupBy(...t){return new Mi(t,this.table,this.variableMetadata)}rollup(t){const r=$e.from(Object.fromEntries(Object.entries(t).map(([a,{variableName:i,aggregation:o}])=>[a,[on(o,un(this.table,i,o),void 0,{type:this.variableMetadata[i]?.type??"numeric",variableName:i})]]))),n={};for(const[a,{variableName:i,aggregation:o}]of Object.entries(t)){const s=this.variableMetadata[i],l=s?.type??"numeric",u=s?.valueFormat??Te[l];n[a]={type:an(o,l),valueFormat:ln(o,u)}}return M.fromTrusted(r,n)}reshapeFromWideToLong({keep:t,reshape:r,keyName:n="key",valueName:a=sn}={}){const{numeric:i,categorical:o,temporal:s}=this.groupVariableNamesByType(),l=t??[...o,...s],u=r??i.filter(c=>!l.includes(c));if(l.includes(n)||l.includes(a))throw new ae({code:"INVALID_DATA_SHAPE",message:`The variables to keep includes the variables '${n}' or '${a}' to create the key and value variables`});if(u.length===0){const c={};for(const p of l){const m=this.variableMetadata[p];m&&(c[p]={type:m.type,values:[],valueFormat:m.valueFormat})}return c[n]={type:"categorical",values:[],valueFormat:{type:"text"}},c[a]={type:"numeric",values:[],valueFormat:{type:"decimal"}},new M(c)}if(u.filter(c=>this.variableMetadata[c]?.type!=="numeric").length>0)throw new ae({code:"INVALID_DATA_SHAPE",message:"Only numeric variables can be reshaped"});const d=this.table.select([...l,...u]).fold(u,n,a),h={};for(const c of l){const p=this.variableMetadata[c];p&&(h[c]=p)}return h[n]={type:"categorical",valueFormat:{type:"text"}},h[a]={type:"numeric",valueFormat:_i(this.variableMetadata,u,n)},M.fromTrusted(d,h)}print(){console.table(this.variableMetadata),console.table([...this.table])}[Symbol.iterator](){return this.table[Symbol.iterator]()}filterByTimestamp(t,r,n){const a=Dt[r],i=dt(n,this.getValueFormat(t),Se),o=Ct(i??n),s=this.getValues(t,{type:"temporal"}),l=[];for(let u=0;u<s.length;u++)a(Ct(s[u]??null),o)&&l.push(u);return M.fromTrusted(this.table.take(l),this.variableMetadata)}resolveAddedVariableFormat(t,r,n){if(n!==void 0)return n;const a=this.variableMetadata[t];return a?a.valueFormat:Te[r]}parseVariableMap(t){const r={},n={};for(const[a,{type:i,values:o,valueFormat:s}]of Object.entries(t))r[a]=o,n[a]={type:i,valueFormat:s??Te[i]};return{table:$e.from(r),variableMetadata:n}}normalizeRawValues(t,r){switch(t){case"numeric":return r.map(n=>typeof n!="number"||!Number.isFinite(n)?null:n);case"categorical":return r.map(n=>typeof n!="string"?null:n);case"temporal":return r.map(n=>!(n instanceof Date)||!(0,v.isValid)(n)?null:n);default:throw new _({message:`Cannot normalize raw value of unknown type: ${t}`})}}skipNulls(t){return t.filter(r=>r!==null)}getDistinctValues(t,r){const n=t==="temporal",a=new Set,i=[];for(const o of r){const s=n&&o instanceof Date?o.getTime():o;a.has(s)||(a.add(s),i.push(o))}return i}},Mi=class{constructor(e,t,r){this.groupedBy=e,this.table=t,this.variableMetadata=r}forEach(e){this.readPartitions().forEach(({key:t,indices:r},n)=>{e(te.fromTrusted(this.table.take(r),this.variableMetadata),t,n)})}rollup(e){const t=this.readPartitions(),r={};for(const a of this.groupedBy){const i=this.table.values(a)??[];r[a]=t.map(({indices:o})=>i[o[0]??0]??null)}const n=Object.fromEntries(this.groupedBy.map(a=>{const i=this.variableMetadata[a],o=i?.type??"categorical";return[a,{type:o,valueFormat:i?.valueFormat??Te[o]}]}));for(const[a,{variableName:i,aggregation:o}]of Object.entries(e)){const s=un(this.table,i,o),l=this.variableMetadata[i],u=l?.type??"numeric";r[a]=t.map(({indices:h})=>on(o,s,h,{type:u,variableName:i}));const d=l?.valueFormat??Te[u];n[a]={type:an(o,u),valueFormat:ln(o,d)}}return te.fromTrusted($e.from(r),n)}readPartitions(){return this.partitions??=this.table.partition(this.groupedBy),this.partitions}};function _i(e,t,r){const n=t.map(s=>e[s]?.valueFormat??{type:"decimal"}),[a,...i]=n;if(!a)return{type:"decimal"};for(const s of n)if(s.type==="lookup")throw new ae({code:"INVALID_DATA_SHAPE",message:"Cannot reshape: a source column has a lookup format and lookups cannot nest"});if(i.every(s=>(0,tt.isEqual)(s,a))||a.type==="lookup")return a;const o={};for(const[s,l]of t.entries()){const u=we([l]),d=n[s];d&&d.type!=="lookup"&&(o[u]=d)}return{type:"lookup",byVariable:r,cases:o,fallback:a}}var bt=class{constructor(e){this.label=e,this.items=new Map}register(e,t){return this.items.set(e,t),this}get(e){if(!this.items.has(e)){const t=[...this.items.keys()].map(r=>`'${r}'`).join(", ");throw new ae({code:"UNKNOWN_REGISTERED_TYPE",message:`Unknown ${this.label}: '${e}' (available: ${t})`,context:{kind:this.label,requested:e,available:[...this.items.keys()]},suggestion:`Register a custom ${this.label} named '${e}' in the \`plugins\` array, or use one of: ${t}.`})}return this.items.get(e)}getAll(){return[...this.items.values()]}has(e){return this.items.has(e)}},Ri=(e,t)=>{const r=typeof e=="string"?e.trim():e;if(ie(r))return{type:"decimal"};const n=typeof r=="string"&&_r(r,t);if(n)return n;const a=typeof r=="string"&&Ca(r,t);return a||(Mr(e)?{type:"date"}:Er(e)?{type:"percentage"}:kr(e)&&typeof e=="string"?{type:"currency",iso:Va(e)}:{type:"text"})},Li={type:"year",dateFormat:"yyyy"},wi={type:"text"},cn=e=>{const t=e._metadata?.parsingLocale??"en-GB",r={},n=Ci(e),a=ki(e),i=n.size>0;for(const[o,s]of e.columns.entries()){if(s._metadata?.isHidden)continue;const l=n.get(s.key);if(fe(l)&&i)continue;const u=s.valueFormat??(fe(l)?wi:o===a?Li:Ri(l,t)),d=vr(u);r[s.key]=Di(s.key,e.rows,u,d,t)}return new te(r)},Ii=class extends Zr{dependencies(e){return[e]}run(e){return cn(e)}},ki=e=>{if(e.columns.some(r=>r.valueFormat?.type==="year"))return-1;const t=Ni(e.rows,5);return e.columns.findIndex(r=>{if(r.valueFormat)return!1;const n=t.map(a=>a[r.key]).filter(a=>!fe(a));return n.length>=2&&n.every(Da)})},Di=(e,t,r,n,a)=>({type:n,values:t.reduce((i,o)=>(Nr(o)||i.push(jr(o[e],r,a)),i),[]),valueFormat:r}),Ci=e=>{const t=new Map,r=new Set(e.columns.map(n=>n.key));for(const n of e.rows){for(const a of r){const i=n[a];fe(i)||(t.set(a,i),r.delete(a))}if(r.size===0)break}return t},Ni=(e,t)=>{const r=[];for(const n of e)if(Nr(n)||r.push(n),r.length===t)return r;return r},dn=["#B84737","#BA7420","#0B8666","#3D63A8","#DD9583","#E2BF6B","#95CBA6","#AABCE5"],qe={900:"#6E0500",800:"#881D11",700:"#A03522",600:"#B0523B",500:"#C06D56",400:"#CE8772",300:"#DBA28E",200:"#E7BDAC",100:"#F2D8CB",50:"#FCF4EA"},ji=[qe[100],qe[900]],Vi=["#3D63A8","#e7e5e4","#B84737"],Fi={dark:{1:[500],2:[600,400],3:[600,400,200],4:[600,500,300,100],5:[700,600,400,200,50],6:[600,500,400,300,200,100],7:[600,500,400,300,200,100,50],default:[700,600,500,400,300,200,100,50]},light:{1:[600],2:[700,500],3:[800,600,400],4:[800,600,400,300],5:[800,700,600,500,400],6:[800,700,600,500,400,300],7:[900,800,700,600,500,400,300],default:[900,800,700,600,500,400,300,200]}},Bi=["cartesian","polar"],fn=["kind","edge","axis","role","position","part"],Wi=dn[0],hn=.4,Ui="sm",Yi=2,Gi=8,zi=12,Hi=Object.freeze({light:"#F5F1E9",dark:"#1F1E1C"}),Ki="#ffffff",Xi=1,$i=24,qi={top:24,right:24,bottom:24,left:24},V={stroke:"color",strokeWidth:"pixels",dashArray:"dashArray"},T={fontFamily:"fontFamily",fontSize:"pixels",fontWeight:"fontWeight",fontStyle:"fontStyle",letterSpacing:"signedPixels",textTransform:"textTransform",textDecoration:"textDecoration",textOutlineColor:"color",textOutlineWidth:"pixels",textShadow:"shadow",lineHeight:"multiplier",textColor:"color"},F={...T,paddingInline:"pixels",paddingBlock:"pixels",fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius",shadow:"shadow",alpha:"unitInterval"},Ji={offsetX:0,offsetY:2,blur:4,color:"rgba(14, 14, 52, 0.12)"},Zi={offsetX:0,offsetY:4,blur:6,color:"rgba(14, 14, 52, 0.16)"},Je=["where","state","layer"],pn={fill:"paint",overlay:"overlay",stroke:"color",alpha:"unitInterval",fillAlpha:"unitInterval",strokeAlpha:"unitInterval",saturation:"multiplier",blur:"pixels",brightness:"multiplier",contrast:"multiplier",shadow:"shadow",blendMode:"blendMode"},Qi=.3,eo=10,to=1,ro=24,no=8,S={label:{fontSize:11.5,fontWeight:500,lineHeight:1},dataLabelOutside:{fontSize:12.5,fontWeight:600,lineHeight:1},tooltipHeading:{fontSize:12.5,fontWeight:700,lineHeight:1.3},tooltipRow:{fontSize:12.5,fontWeight:500,lineHeight:1.43},heading:{fontSize:18,fontWeight:600,lineHeight:1.25},subtitle:{fontSize:15,fontWeight:500,lineHeight:1.47},caption:{fontSize:12,fontWeight:500,lineHeight:1.3},source:{fontSize:12,fontWeight:500,lineHeight:1.3},sourceLink:{fontSize:12,fontWeight:400,lineHeight:1.3}},Ge={stroke:f("gridLine"),strokeWidth:1},Nt={fill:f("tooltipBackground"),stroke:f("tooltipBorder"),strokeWidth:1,cornerRadius:6,paddingBlock:8,paddingInline:10,shadow:{offsetX:0,offsetY:4,blur:12,color:"rgba(0, 0, 0, 0.18)"}},jt={fill:f("textPrimary"),size:8,stroke:f("tooltipBackground"),strokeWidth:2,shadow:{offsetX:0,offsetY:1,blur:1.5,color:"rgba(14, 14, 52, 0.18)"}},Vt={fontSize:12,fontWeight:500,lineHeight:1.3,textColor:f("textPrimary"),fill:f("tooltipBackground"),stroke:f("tooltipBorder"),strokeWidth:1,cornerRadius:6,paddingInline:7,paddingBlock:4,shadow:{offsetX:0,offsetY:2,blur:6,color:"rgba(0, 0, 0, 0.12)"}},ze={...V,length:"pixels"},le={...T,margin:"margin"},ue={...T,offset:"pixels",margin:"margin"},ce={gap:"pixels",margin:"margin"},He={stroke:"color",strokeAlpha:"unitInterval",strokeWidth:"pixels",dashArray:"dashArray",haloColor:"color",haloAlpha:"unitInterval",offset:"pixels",cornerRadius:"pixels"},Ft={fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius",paddingInline:"pixels",paddingBlock:"pixels",shadow:"shadow",alpha:"unitInterval"},yn=new Map;var ao=(e=Object.values(je))=>{const t=[],r=[],n=[],a=i=>{if(i.rest!==void 0&&t.push({select:i.select,declarations:i.rest}),i.dimmed!==void 0&&r.push({select:i.select,declarations:i.dimmed,when:{state:"dimmed"}}),i.hovered!==void 0&&n.push({select:i.select,declarations:i.hovered,when:{state:"hovered"}}),i.children!==void 0)for(const o of Object.values(i.children))a(o)};for(const i of e)a(i);return[...t,...r,...n]},io=e=>{for(const t of e){Object.freeze(t.select);for(const r of Object.values(t.declarations))typeof r=="object"&&Object.freeze(r);Object.freeze(t.declarations),t.when!==void 0&&Object.freeze(t.when),Object.freeze(t)}return e},oo=e=>yn.get(gn(e)),Bt=(e,t)=>({x:{select:{target:e,axis:"x"},vocabulary:t},y:{select:{target:e,axis:"y"},vocabulary:t}}),Wt=e=>({select:{target:"dataLabel",role:e},vocabulary:F,children:{inside:{select:{target:"dataLabel",role:e,position:"inside"},vocabulary:F,rest:{textColor:"#FFFFFF"}},outside:{select:{target:"dataLabel",role:e,position:"outside"},vocabulary:F,rest:{...S.dataLabelOutside}}}}),je={geom:{select:{target:"geom"},vocabulary:pn,options:Je,aesthetics:{fill:"color",stroke:"color",alpha:"alpha"},rest:{alpha:1,strokeAlpha:1,shadow:"none",blendMode:"normal"},dimmed:{alpha:hn},hovered:{shadow:Ji},acceptsUnknownKinds:!0},panelBorder:{select:{target:"panelBorder"},vocabulary:{...V,cornerRadius:"pixels"},rest:{...Ge,dashArray:C.panelBorder.dashed,cornerRadius:6},children:{top:{select:{target:"panelBorder",edge:"top"},vocabulary:V},right:{select:{target:"panelBorder",edge:"right"},vocabulary:V},bottom:{select:{target:"panelBorder",edge:"bottom"},vocabulary:V},left:{select:{target:"panelBorder",edge:"left"},vocabulary:V}}},gridLine:{select:{target:"gridLine"},vocabulary:V,children:{x:{select:{target:"gridLine",axis:"x"},vocabulary:V,rest:{...Ge,dashArray:C.gridLine.dashed,strokeWidth:0}},y:{select:{target:"gridLine",axis:"y"},vocabulary:V,rest:{...Ge,dashArray:C.gridLine.dashed}}}},tickLine:{select:{target:"tickLine"},vocabulary:ze,rest:{strokeWidth:0,length:0},children:{x:{select:{target:"tickLine",axis:"x"},vocabulary:ze},y:{select:{target:"tickLine",axis:"y"},vocabulary:ze}}},axisLabel:{select:{target:"axisLabel"},vocabulary:le,rest:{...S.label,textColor:f("textPrimary")},children:{...Bt("axisLabel",le),top:{select:{target:"axisLabel",edge:"top"},vocabulary:le,rest:{margin:{bottom:8}}},bottom:{select:{target:"axisLabel",edge:"bottom"},vocabulary:le,rest:{margin:{top:4,bottom:16}}},left:{select:{target:"axisLabel",edge:"left"},vocabulary:le},right:{select:{target:"axisLabel",edge:"right"},vocabulary:le}}},tickLabel:{select:{target:"tickLabel"},vocabulary:ue,rest:{...S.label,textColor:f("textSecondary"),offset:eo,textOutlineColor:f("graphBackground"),textOutlineWidth:to},children:{...Bt("tickLabel",ue),top:{select:{target:"tickLabel",edge:"top"},vocabulary:ue},bottom:{select:{target:"tickLabel",edge:"bottom"},vocabulary:ue},left:{select:{target:"tickLabel",edge:"left"},vocabulary:ue,rest:{offset:14}},right:{select:{target:"tickLabel",edge:"right"},vocabulary:ue,rest:{offset:14}}}},dataLabel:{select:{target:"dataLabel"},vocabulary:F,rest:{...S.label,textColor:f("textPrimary"),paddingInline:6,paddingBlock:2,cornerRadius:4},children:{aggregate:{select:{target:"dataLabel",role:"aggregate"},vocabulary:F,rest:{...S.dataLabelOutside}},observation:Wt("observation"),category:Wt("category")}},graph:{select:{target:"graph"},vocabulary:{fill:"paint",overlay:"overlay",stroke:"color",strokeWidth:"pixels",cornerRadius:"pixels",fontFamily:"fontFamily",fontSize:"pixels",fontWeight:"fontWeight",lineHeight:"multiplier",textColor:"color",textScale:"multiplier",padding:"padding",blendMode:"blendMode",shadow:"shadow",alpha:"unitInterval"},rest:{fill:f("graphBackground"),strokeWidth:1,stroke:f("graphBorder"),cornerRadius:8,textScale:1,padding:24,blendMode:"normal"}},heading:{select:{target:"heading"},vocabulary:T,rest:{textColor:f("textPrimary")},partWildcard:!0,children:{h1:{select:{target:"heading",part:"h1"},vocabulary:T,rest:{...S.heading}},h2:{select:{target:"heading",part:"h2"},vocabulary:T,rest:{...S.subtitle}}}},caption:{select:{target:"caption"},vocabulary:T,rest:{...S.caption,textColor:f("textPrimary")}},source:{select:{target:"source"},vocabulary:T,rest:{...S.source,textColor:f("textSecondary")},children:{link:{select:{target:"source",part:"link"},vocabulary:T,rest:{...S.sourceLink,textColor:f("textSecondary")}}}},header:{select:{target:"header"},vocabulary:{margin:"margin"},rest:{margin:{bottom:10}}},footer:{select:{target:"footer"},vocabulary:{margin:"margin"},rest:{margin:{top:16}}},hoverGuide:{select:{target:"hoverGuide"},vocabulary:{stroke:"color",fill:"paint"},rest:{stroke:f("hoverGuideLine"),fill:f("hoverGuideFill")}},editOutline:{select:{target:"editOutline"},vocabulary:He,rest:{stroke:f("textPrimary"),strokeWidth:1.5,dashArray:[3.5,2.5],offset:3,cornerRadius:3},partWildcard:!0,children:{hover:{select:{target:"editOutline",part:"hover"},vocabulary:He,rest:{strokeAlpha:.4,haloAlpha:.5}},selected:{select:{target:"editOutline",part:"selected"},vocabulary:He,rest:{strokeAlpha:.85,haloAlpha:.9}}}},tooltip:{select:{target:"tooltip"},vocabulary:{...Ft,gap:"pixels"},rest:{...Nt,gap:4},children:{heading:{select:{target:"tooltip",part:"heading"},vocabulary:T,rest:{...S.tooltipHeading,textColor:f("textPrimary")}},label:{select:{target:"tooltip",part:"label"},vocabulary:T,rest:{...S.tooltipRow,textColor:f("textPrimary")}},value:{select:{target:"tooltip",part:"value"},vocabulary:T,rest:{...S.tooltipRow,textColor:f("textSecondary")}},primaryRow:{select:{target:"tooltip",part:"primaryRow"},vocabulary:{fill:"paint"},rest:{fill:f("tooltipPrimaryRow")}}}},headline:{select:{target:"headline"},vocabulary:ce,rest:{gap:ro,margin:{bottom:4}}},headlineItem:{select:{target:"headlineItem"},vocabulary:{gap:"pixels"},rest:{gap:2},children:{number:{select:{target:"headlineItem",part:"number"},vocabulary:T,rest:{fontSize:26,fontWeight:700,lineHeight:1.3,textColor:f("textPrimary")},children:{center:{select:{target:"headlineItem",part:"numberCenter"},vocabulary:T}}},caption:{select:{target:"headlineItem",part:"caption"},vocabulary:T,rest:{fontSize:12,textColor:f("textSecondary")}},label:{select:{target:"headlineItem",part:"label"},vocabulary:T,rest:{fontSize:12,textColor:f("textSecondary")}},swatch:{select:{target:"headlineItem",part:"swatch"},vocabulary:{size:"pixels"},rest:{size:12}},trend:{select:{target:"headlineItem",part:"trend"},vocabulary:T,rest:{fontSize:12,textColor:f("textSecondary")},children:{up:{select:{target:"headlineItem",part:"trendUp"},vocabulary:{textColor:"color"},rest:{textColor:f("trendPositive")}},down:{select:{target:"headlineItem",part:"trendDown"},vocabulary:{textColor:"color"},rest:{textColor:f("trendNegative")}},flat:{select:{target:"headlineItem",part:"trendFlat"},vocabulary:{textColor:"color"},rest:{textColor:f("trendNeutral")}}}}}},legend:{select:{target:"legend"},vocabulary:{...ce,focusStroke:"color"},rest:{gap:no,focusStroke:f("legendFocus")},children:{popover:{select:{target:"legend",part:"popover"},vocabulary:Ft,rest:Nt},top:{select:{target:"legend",edge:"top"},vocabulary:ce,rest:{margin:{bottom:8}}},bottom:{select:{target:"legend",edge:"bottom"},vocabulary:ce,rest:{margin:{top:16,bottom:10}}},left:{select:{target:"legend",edge:"left"},vocabulary:ce,rest:{margin:{right:10}}},right:{select:{target:"legend",edge:"right"},vocabulary:ce,rest:{margin:{left:10}}}}},legendItem:{select:{target:"legendItem"},vocabulary:{...T,paddingInline:"pixels",paddingBlock:"pixels",fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius",shadow:"shadow",alpha:"unitInterval",gap:"pixels"},rest:{...S.label,textColor:f("textSecondary"),strokeWidth:0,paddingInline:2,paddingBlock:4,gap:8},children:{swatch:{select:{target:"legendItem",part:"swatch"},vocabulary:{size:"pixels",strokeWidth:"pixels"},rest:{size:12,strokeWidth:2}}}},directLabel:{select:{target:"directLabel"},vocabulary:{...T,stroke:"color",strokeWidth:"pixels",dashArray:"dashArray"},rest:{fontSize:12,fontWeight:500,lineHeight:1.3,textColor:f("textPrimary"),strokeWidth:1,dashArray:C.directLabel.dashed}},annotation:{select:{target:"annotation"},vocabulary:{fill:"paint",stroke:"color",alpha:"unitInterval",fillAlpha:"unitInterval"},options:["annotation"],children:{shape:{select:{target:"annotation",kind:"shape"},vocabulary:{fill:"paint",alpha:"unitInterval",fillAlpha:"unitInterval",stroke:"color",strokeWidth:"pixels"},options:["annotation"],rest:{fill:f("annotationShape"),alpha:1,fillAlpha:.25,strokeWidth:1}},arrow:{select:{target:"annotation",kind:"arrow"},vocabulary:{stroke:"color",strokeWidth:"pixels",dashArray:"dashArray"},options:["annotation"],rest:{stroke:f("annotationArrow"),strokeWidth:4,dashArray:C.arrow.solid},children:{outline:{select:{target:"annotation",kind:"arrow",part:"outline"},vocabulary:{stroke:"color",strokeWidth:"pixels",shadow:"shadow"},options:["annotation"],rest:{strokeWidth:0,shadow:"none"}}}},differenceArrow:{select:{target:"annotation",kind:"differenceArrow"},vocabulary:{stroke:"color",strokeWidth:"pixels"},options:["annotation"],rest:{stroke:f("annotationArrow"),strokeWidth:2},children:{label:{select:{target:"annotation",kind:"differenceArrow",part:"label"},vocabulary:F,options:["annotation"],rest:{...S.label,textColor:f("textPrimary"),fill:f("differenceLabelBackground"),strokeWidth:1,cornerRadius:4,paddingInline:6,paddingBlock:3}}}},text:{select:{target:"annotation",kind:"text"},vocabulary:{...F,fillAlpha:"unitInterval"},options:["annotation"],rest:{fill:"transparent",alpha:1,fillAlpha:1,strokeWidth:1.5,cornerRadius:9,paddingInline:6,paddingBlock:3,fontSize:15,fontWeight:500,lineHeight:1.25,textColor:f("textPrimary")}},image:{select:{target:"annotation",kind:"image"},vocabulary:{alpha:"unitInterval",cornerRadius:"boxRadius",shadow:"shadow"},options:["annotation"],rest:{alpha:1,cornerRadius:0}},pinnedNumber:{select:{target:"annotation",kind:"pinnedNumber"},vocabulary:{fill:"paint",size:"pixels",stroke:"color",strokeWidth:"pixels",shadow:"shadow"},options:["annotation"],rest:jt,children:{label:{select:{target:"annotation",kind:"pinnedNumber",part:"label"},vocabulary:F,options:["annotation"],rest:Vt}}},comment:{select:{target:"annotation",kind:"comment"},vocabulary:{fill:"paint",size:"pixels",stroke:"color",strokeWidth:"pixels",shadow:"shadow"},options:["annotation"],rest:jt,children:{label:{select:{target:"annotation",kind:"comment",part:"label"},vocabulary:F,options:["annotation"],rest:Vt}}}}}},gn=e=>{let t=e.target;for(const r of fn){const n=e[r];n!==void 0&&(t+=`\0${r}:${n}`)}return t},mn=e=>{if(yn.set(gn(e.select),e),e.children!==void 0)for(const t of Object.values(e.children))mn(t)};for(const e of Object.values(je))mn(e);function so(e){return e}var lo=e=>e.observation?.aesthetics??je.geom.aesthetics,bn=e=>e.observation?.sharedPaint===!1?{...e.observation.vocabulary}:{...pn,...e.observation?.vocabulary},uo=(e,t)=>({select:{target:"geom",kind:e},vocabulary:bn(t),aesthetics:lo(t),options:t.observation?.options??Je,...Ut(t.observation),children:Object.fromEntries(Object.entries(t.parts??{}).map(([r,n])=>[r,{select:{target:"geom",kind:e,part:r},vocabulary:n.vocabulary,options:n.options??Je,...n.aesthetics===void 0?{}:{aesthetics:n.aesthetics},...Ut(n)}]))}),Ut=e=>({...e?.rest===void 0?{}:{rest:e.rest},...e?.dimmed===void 0?{}:{dimmed:e.dimmed},...e?.hovered===void 0?{}:{hovered:e.hovered}}),q=class{constructor(){this.positionRoles=[],this.identityKey="x-group",this.defaultPosition="identity",this.defaultStat=null,this.supportedPositions=yr,this.defaultInteractive=!0,this.defaultAttachTo="none",this.aesthetics=[],this.derivedVariables=[],this.highlightStrategy=null,this.categorySpanAxes=[],this.supportedCoordTypes=["cartesian","flip"],this.spatialKind="points",this.grid={},this.legend={},this.dataLabelCoordTypes=[],this.isComposite=!1,this.tooltip=[],this.summaries={}}resolveParams(e){return(0,tt.merge)({},this.defaultParams,e.params)}},Yt=.5,pe=e=>({x:0,y:0,width:e.width,height:e.height}),vt=e=>e==="panel-end"?"end":e==="panel-start"?"start":e,ye=({box:e,panel:t,orientation:r,placement:n,justify:a,align:i,offset:o,alignOffset:s,labelWidth:l,labelHeight:u})=>{const d=a==="panel-start"||a==="panel-end",h=(r.valueAxis==="x"?e.height:e.width)===0,c={anchor:fo(a,r.valueDirectionSign),placement:d?"inside":n,offset:o},p={anchor:ho(i),placement:h?n:"inside",offset:h?s??o:0},m=d?t:e,A=r.valueAxis==="x"?m:e,L=r.valueAxis==="y"?m:e,k=r.valueAxis==="x"?c:p,j=r.valueAxis==="x"?p:c,P=zt(k,{min:A.x,max:A.x+A.width,halfExtent:l/2}),w=zt(j,{min:L.y,max:L.y+L.height,halfExtent:u/2});return{x:P,y:w,position:co(e,P,w,l,u)}},Gt=(e,t,r,n)=>r-n>=e-Yt&&r+n<=t+Yt,co=(e,t,r,n,a)=>{if(e.width===0&&e.height===0)return"outside";const i=e.width===0||Gt(e.x,e.x+e.width,t,n/2),o=e.height===0||Gt(e.y,e.y+e.height,r,a/2);return i&&o?"inside":"outside"},fo=(e,t)=>e==="center"?"center":(e==="end"||e==="panel-end")==(t===1)?"max":"min",ho=e=>e==="center"?"center":e==="start"?"min":"max",zt=({anchor:e,placement:t,offset:r},{min:n,max:a,halfExtent:i})=>{if(e==="center")return(n+a)/2;if(t==="inside"&&n===a)return n;const o=r+i;return e==="min"?t==="inside"?n+o:n-o:t==="inside"?a-o:a+o},po=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=mo(e.layer);for(const a of e.layer.data){const i=K(a),o=G(a)??U(a);if(i===null||o===null||!Ne(i,o))continue;const s=e.formatLabel(a);if(s==="")continue;const{width:l,height:u}=e.measureDataLabel("observation","outside",s),{box:d,orientation:h}=go(o,Y(a),i,e.panelRect.width,e.panelRect.height),c=ye({box:d,panel:pe(e.panelRect),orientation:h,...n,offset:r,labelWidth:l,labelHeight:u});t.push({layerId:e.layer.id,x:c.x,y:c.y,text:s,width:l,height:u,isRotated:!1,role:"observation",position:"outside"})}return{labels:t,droppedCount:0}},yo=e=>e.position==="fill"?"fill":de(e.position)?"stack":"none",go=(e,t,r,n,a)=>{const i=t??e,o=1-Math.max(e,i);return{box:{x:r*n,y:o*a,width:0,height:Math.abs(e-i)*a},orientation:{valueAxis:"y",valueDirectionSign:e>=i?-1:1}}},mo=e=>{const{position:t,justify:r,align:n}=e.dataLabels;return t==="auto"?{placement:"outside",justify:"end",align:"center"}:{placement:t,justify:mt(e.data,e.mapping)?vt(r):r,align:n}},bo=class extends q{constructor(...e){super(...e),this.type="area",this.styleTarget={observation:{vocabulary:{strokeWidth:"pixels",dashArray:"dashArray",lineCap:"lineCap",lineJoin:"lineJoin"},aesthetics:{fill:"color",fillAlpha:"alpha",strokeWidth:"strokeWidth",dashArray:"lineType"},rest:{fill:f("geom"),fillAlpha:Qi,strokeWidth:2,dashArray:C.line.solid}}},this.supportedCoordTypes=["cartesian","polar","flip"],this.defaultParams={curve:"linear",missingValues:"zero"},this.defaultPosition="stack",this.scaleConstraints={zeroBaseline:!0},this.positionRoles=[{axis:"x",role:"point",valueKind:"value"},{axis:"y",role:"min",valueKind:"value"},{axis:"y",role:"max",valueKind:"value",aes:"y"}],this.aesthetics=[{kind:"visual",name:"color"},{kind:"visual",name:"strokeWidth"},{kind:"visual",name:"lineType"},{kind:"visual",name:"alpha"}],this.summaries={perGroupHeadline:!0},this.dataLabels={cartesian:{offset:8},flip:{offset:8}},this.dataLabelCoordTypes=["cartesian","flip"],this.resolvePercentageValueStrategy=yo,this.isComposite=!0,this.legend={suppressWhenSingleItem:!0,sidePlacement:"whenCrowded",directLabelSupport:{stack:!0,dodge:!0,identity:!0,fill:!0}},this.highlightStrategy="overlay-anchor",this.spatialKind="filled-buckets",this.resolveAnchorPosition=yt,this.getDataLabelPlacements=t=>po(t)}resolveParams(e){const t=super.resolveParams(e);return t.missingValues==="gap"?{...t,missingValues:"zero"}:t}compile({data:e,mapping:t}){return e=pt(e,t),e.hasVariable(y.yMin)||(e=e.addConstantVariable(y.yMin,"numeric",0)),{data:e,mapping:{}}}},vn=.7,vo=.1,Ao=.03,To=.05,An=e=>{const t=e[ot.role];return t??"solo"},At=(e,t,r)=>{const n={},a=i=>{const o=n[i];if(o!==void 0)return o;const{width:s,height:l}=e(t,i,r),u={width:s,height:l};return n[i]=u,u};return{get inside(){return a("inside")},get outside(){return a("outside")}}},Ve=(e,t,r=e.get("fill",t))=>{if(r===void 0)return;const n=e.get("alpha",t)*(e.get("fillAlpha",t)??1);return nr(er(r),n)},_e=6,Eo=.5,Po=e=>{const t=[];let r=0;const n=de(e.layer.position),a=e.coordSystem.mainAxis==="y";if(e.layer.dataLabels.showDataLabels){const{entries:i,shouldRotate:o}=Oo({layer:e.layer,mainAxis:e.coordSystem.mainAxis,panelRect:e.panelRect,measureDataLabel:e.measureDataLabel,formatLabel:e.formatLabel,isFlipped:a});for(const s of i){const l=e.layer.dataLabels.position==="auto"?_o({mainAxis:e.coordSystem.mainAxis,isStacked:n,isNegativeBar:s.isNegative,shouldRotate:o,bounds:s.bounds,boxes:s.boxes,panelWidth:e.panelRect.width,panelHeight:e.panelRect.height,offset:e.layer.dataLabels.offset}):Lo(e.layer.dataLabels,e.coordSystem.mainAxis,n,s,pe(e.panelRect));if(l===null){r+=1;continue}const u=s.boxes[l.position];t.push({layerId:e.layer.id,x:l.x,y:l.y,text:s.text,width:u.width,height:u.height,isRotated:l.isRotated,role:"observation",position:l.position,...l.position==="inside"?{backdropColor:Ve(e.styleReaders,s.observation)}:{}})}}if(e.layer.dataLabels.showCategoryLabels)for(const i of wo(e,n))t.push(i);if(e.layer.dataLabels.showStackTotals){const i=Co({layer:e.layer,mainAxis:e.coordSystem.mainAxis,panelRect:e.panelRect,measureDataLabel:e.measureDataLabel,formatAbsolute:e.formatAbsolute});for(const o of i)t.push(o)}return{labels:t,droppedCount:r}},So=e=>e.position==="fill"?"fill":de(e.position)?"stack":"absoluteGrandTotal",Oo=({layer:e,mainAxis:t,panelRect:r,measureDataLabel:n,formatLabel:a,isFlipped:i})=>{const o=[];let s=!1;const l=e.dataLabels.position==="auto",u=R(e.mapping.y);for(const d of e.data){const h=En(t,d);if(h===null)continue;const c=a(d);if(c==="")continue;const p=At(n,"observation",c),m=Tt(h,r);l&&p.inside.width>m.width&&(s=!0);const A=u===null?null:d[u],L=O(A)&&A<0;o.push({isNegative:L,text:c,boxes:p,bounds:m,observation:d})}return{entries:o,shouldRotate:!i&&s}},Tt=(e,t)=>({x:e.x*t.width,y:e.y*t.height,width:e.width*t.width,height:e.height*t.height}),Tn=(e,t,r,n,a)=>{if(e==="x"){let s=1-a,l=a-n;return l<0&&(s+=l,l=-l),{x:t,y:s,width:r-t,height:l}}let i=t,o=r-t;return o<0&&(i+=o,o=-o),{x:i,y:1-a,width:o,height:a-n}},En=(e,t)=>{const r=X(t),n=$(t),a=Y(t),i=G(t)??U(t);return r===null||n===null||a===null||i===null?null:Tn(e,r,n,a,i)},xo=(e,t)=>{const{xMin:r,xMax:n,yMin:a,yMax:i}=t.anchor;return Tn(e,r,n,a,i)},Mo=(e,t)=>e==="x"?t?"bottom":"top":t?"left":"right",Ze=(e,t,r)=>r?{width:t,height:e}:{width:e,height:t},_o=e=>e.isStacked?Io({bounds:e.bounds,box:e.boxes.inside,isRotated:e.shouldRotate}):Do({edge:Mo(e.mainAxis,e.isNegativeBar),bounds:e.bounds,boxes:e.boxes,isRotated:e.shouldRotate,panelWidth:e.panelWidth,panelHeight:e.panelHeight,offset:e.offset}),Pn=(e,t)=>e==="x"?{valueAxis:"y",valueDirectionSign:t?1:-1}:{valueAxis:"x",valueDirectionSign:t?-1:1},Ro=e=>e==="panel-start"||e==="panel-end",Lo=(e,t,r,n,a)=>{if(e.position==="auto")return null;const i=r&&e.position==="outside"?"inside":e.position,o=n.boxes[i],s=ye({box:n.bounds,panel:a,orientation:Pn(t,n.isNegative),placement:i,justify:e.justify,align:e.align,offset:e.offset,labelWidth:o.width,labelHeight:o.height});if(i==="inside"&&!Ro(e.justify)){const l=t==="y",u=l?n.bounds.width:n.bounds.height;return(l?o.width:o.height)>u+Eo?null:{x:s.x,y:s.y,isRotated:!1,position:"inside"}}return{x:s.x,y:s.y,isRotated:!1,position:s.position}},wo=(e,t)=>{const r=[],{categoryPosition:n,categoryJustify:a,categoryAlign:i,categoryOffset:o}=e.layer.dataLabels,s=t&&n==="outside"?"inside":n,l=e.coordSystem.mainAxis,u=pe(e.panelRect),d=R(e.layer.mapping.y);for(const h of e.layer.data){const c=En(l,h);if(c===null)continue;const p=e.formatCategory(h);if(p===null||p==="")continue;const m=At(e.measureDataLabel,"category",p),A=m[s],L=Tt(c,e.panelRect),k=d===null?null:h[d],j=O(k)&&k<0,P=ye({box:L,panel:u,orientation:Pn(l,j),placement:s,justify:a,align:i,offset:o,labelWidth:A.width,labelHeight:A.height}),w=m[P.position];r.push({layerId:e.layer.id,x:P.x,y:P.y,text:p,width:w.width,height:w.height,isRotated:!1,role:"category",position:P.position})}return r},Io=({bounds:e,box:t,isRotated:r})=>{const n=Ze(t.width,t.height,r);return n.width>e.width||n.height>e.height?null:{x:e.x+e.width/2,y:e.y+e.height/2,isRotated:r,position:"inside"}},ko=(e,t,r,n)=>{switch(e){case"top":return{edgeCoord:t.y,outwardSign:-1,panelExtent:n};case"bottom":return{edgeCoord:t.y+t.height,outwardSign:1,panelExtent:n};case"left":return{edgeCoord:t.x,outwardSign:-1,panelExtent:r};case"right":return{edgeCoord:t.x+t.width,outwardSign:1,panelExtent:r}}},Do=({edge:e,bounds:t,boxes:r,isRotated:n,panelWidth:a,panelHeight:i,offset:o})=>{const s=e==="top"||e==="bottom",l=t.x+t.width/2,u=t.y+t.height/2,d=s?t.height:t.width,h=s?t.width:t.height,{edgeCoord:c,outwardSign:p,panelExtent:m}=ko(e,t,a,i),A=Ze(r.inside.width,r.inside.height,n),L=s?A.height:A.width,k=s?A.width:A.height,j=L+o<d,P=k<=h;if(s?j:j&&P){if(s&&!P)return null;if(n)return{x:l,y:u,isRotated:!0,position:"inside"};const xe=c-p*(L/2+o);return{...s?{x:l,y:xe}:{x:xe,y:u},isRotated:!1,position:"inside"}}const w=Ze(r.outside.width,r.outside.height,n),x=(s?w.height:w.width)/2,D=c+p*(x+o);return D-x<0||D+x>m?null:{...s?{x:l,y:D}:{x:D,y:u},isRotated:n,position:"outside"}},Co=({layer:e,mainAxis:t,panelRect:r,measureDataLabel:n,formatAbsolute:a})=>{const i=[],o=e.summary.stackTotals;if(o===void 0||o.length===0)return i;const s=t==="y";for(const l of o){const u=Tt(xo(t,l),r),d=a(l.total),{width:h,height:c}=n("aggregate","outside",d),p=l.anchor.direction==="positive";let m,A;s?(m=p?u.x+u.width+_e+h/2:u.x-_e-h/2,A=u.y+u.height/2):(m=u.x+u.width/2,A=p?u.y-_e-c/2:u.y+u.height+_e+c/2),i.push({layerId:e.id,x:m,y:A,text:d,width:h,height:c,isRotated:!1,role:"aggregate",position:"outside"})}return i};function Sn(e){return{startAngle:e[y.xMin],endAngle:e[y.xMax]}}function On(e){return{innerRadius:e[y.yMin],outerRadius:e[y.yMax]??e[y.y]}}var No=" · ",B=2,jo=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{position:r,justify:n,align:a,offset:i,showCategoryLabels:o}=e.layer.dataLabels,s=e.coordSystem.bandAxis==="y",l=e.panelRect.width/2,u=e.panelRect.height/2,d=Math.min(e.panelRect.width,e.panelRect.height)/2,h=e.styleReaders;for(const c of e.layer.data){const{startAngle:p,endAngle:m}=Sn(c),{innerRadius:A,outerRadius:L}=On(c);if(p===null||m===null||L===null)continue;const k=e.formatLabel(c);if(k==="")continue;const j=o?e.formatCategory(c):null,P=j===null?k:`${j}${No}${k}`,w={startAngle:p,endAngle:m,midAngle:(p+m)/2,innerRadiusPx:(A??0)*d,outerRadiusPx:L*d};let x,D;if(r==="auto"){const ge=e.measureDataLabel("observation","inside",P),z={width:ge.width,height:ge.height},Fe=Xt({wedge:w,position:"inside",offset:i,labelWidth:z.width,labelHeight:z.height}),Vn=s||Fo({wedge:w,labelRadius:Fe.labelRadius,labelAngle:Fe.labelAngle,labelWidth:z.width,labelHeight:z.height});if(x=Fe,D=z,!Vn){const Et=e.measureDataLabel("observation","outside",P),me={width:Et.width,height:Et.height},be=Xt({wedge:w,position:"outside",offset:i,labelWidth:me.width,labelHeight:me.height}),Fn=l+Math.sin(be.labelAngle)*be.labelRadius,Bn=u-Math.cos(be.labelAngle)*be.labelRadius;Wo({x:Fn,y:Bn,labelWidth:me.width,labelHeight:me.height,panelRect:e.panelRect})&&(x=be,D=me)}}else{const ge=At(e.measureDataLabel,"observation",P),z=ge[r];x=Uo({wedge:w,placement:r,justify:vt(n),align:a,offset:i,labelWidth:z.width,labelHeight:z.height}),D=ge[x.position]}const xe=l+Math.sin(x.labelAngle)*x.labelRadius,jn=u-Math.cos(x.labelAngle)*x.labelRadius;t.push({layerId:e.layer.id,x:xe,y:jn,text:P,width:D.width,height:D.height,isRotated:!1,role:"observation",position:x.position,...x.position==="inside"?{backdropColor:Ve(h,c)}:{}})}return{labels:t,droppedCount:0}},Vo=()=>"absoluteGrandTotal",Qe=(e,t,r,n)=>{const a=Math.abs(e==="radial"?Math.sin(t):Math.cos(t)),i=Math.abs(e==="radial"?Math.cos(t):Math.sin(t));return a*(r/2)+i*(n/2)},Fo=({wedge:e,labelRadius:t,labelAngle:r,labelWidth:n,labelHeight:a})=>{if(t<=0)return!1;const i=Math.sin(r)*t,o=-Math.cos(r)*t,s={left:i-n/2,right:i+n/2,top:o-a/2,bottom:o+a/2},l=[[s.left,s.top],[s.right,s.top],[s.right,s.bottom],[s.left,s.bottom]],u=Math.hypot(Ht(0,s.left,s.right),Ht(0,s.top,s.bottom)),d=Math.max(...l.map(([c,p])=>Math.hypot(c,p)));if(u<e.innerRadiusPx-B||d>e.outerRadiusPx+B)return!1;const h=Math.abs(e.endAngle-e.startAngle)/2;return h>=Math.PI?!0:l.every(([c,p])=>{const m=Math.hypot(c,p);return m<=B?!0:nt(Math.atan2(c,-p),e.midAngle)<=h+B/m})?h<=Math.PI/2?!0:u<=B?!1:!Kt(e.startAngle,s)&&!Kt(e.endAngle,s):!1},Bo=(e,t,r)=>{if(t<=0||t<e.innerRadiusPx-B||t>e.outerRadiusPx+B)return!1;const n=Math.abs(e.endAngle-e.startAngle)/2;return nt(r,e.midAngle)<=n+B/t},Ht=(e,t,r)=>Math.min(r,Math.max(t,e)),Kt=(e,t)=>{const r=B,n=[[Math.sin(e),t.left+r,t.right-r],[-Math.cos(e),t.top+r,t.bottom-r]];let a=0,i=Number.POSITIVE_INFINITY;for(const[o,s,l]of n){if(s>l)return!1;if(Math.abs(o)<1e-9){if(s>0||l<0)return!1;continue}const u=s/o,d=l/o;a=Math.max(a,Math.min(u,d)),i=Math.min(i,Math.max(u,d))}return a<=i},Wo=({x:e,y:t,labelWidth:r,labelHeight:n,panelRect:a})=>e-r/2>=0&&e+r/2<=a.width&&t-n/2>=0&&t+n/2<=a.height,Xt=({wedge:e,position:t,offset:r,labelWidth:n,labelHeight:a})=>t==="inside"?{labelRadius:(e.innerRadiusPx+e.outerRadiusPx)/2,labelAngle:e.midAngle,position:"inside"}:{labelRadius:e.outerRadiusPx+r+Qe("radial",e.midAngle,n,a),labelAngle:e.midAngle,position:"outside"},Uo=({wedge:e,placement:t,justify:r,align:n,offset:a,labelWidth:i,labelHeight:o})=>{const s=n==="start"?e.startAngle:n==="end"?e.endAngle:e.midAngle,l=a+Qe("radial",s,i,o);let u;if(r==="center")u=(e.innerRadiusPx+e.outerRadiusPx)/2;else if(r==="end")u=t==="inside"?e.outerRadiusPx-l:e.outerRadiusPx+l;else if(t==="inside")u=e.innerRadiusPx+l;else{const h=e.innerRadiusPx-l;u=h>=0?h:e.innerRadiusPx+l}let d=s;if(n!=="center"&&u>0){const h=Qe("tangential",s,i,o),c=Math.asin(Math.min(1,h/u));d=s+(n==="start"?1:-1)*c}return{labelRadius:u,labelAngle:d,position:Bo(e,u,d)?"inside":"outside"}},Yo=class extends q{constructor(...e){super(...e),this.type="bar",this.styleTarget={observation:{vocabulary:{cornerRadius:"barRadius",strokeWidth:"pixels"},aesthetics:{fill:"color",alpha:"alpha",strokeWidth:"strokeWidth"},rest:{fill:f("geom"),fillAlpha:1,cornerRadius:"sm",strokeWidth:1,stroke:f("geomBorder")},hovered:{stroke:f("hoverAffordance"),shadow:Zi}}},this.defaultParams={},this.defaultPosition="dodge",this.positionRoles=[{axis:"x",role:"point",valueKind:"value"},{axis:"y",role:"min",valueKind:"value"},{axis:"y",role:"max",valueKind:"value",aes:"y"}],this.aesthetics=[{kind:"visual",name:"color"},{kind:"visual",name:"alpha"}],this.summaries={grandTotal:!0,stackTotals:!0,perGroupHeadline:!0},this.grid={cartesian:{hideGridX:!0},flip:{hideGridX:!0}},this.legend={suppressWhenSingleItem:!0,sidePlacement:"whenStackedVertical",directLabelSupport:{stack:!0,fill:!0}},this.scaleConstraints={discreteMainAxis:!0,zeroBaseline:!0},this.dataLabels={polar:{format:"percentage"}},this.dataLabelCoordTypes=["cartesian","flip","polar"],this.highlightStrategy="observation-rerender",this.supportedCoordTypes=["cartesian","polar","flip"],this.spatialKind="rects",this.resolveDataLabelDefaults=t=>de(t)?{justify:"center"}:{},this.resolveBandFraction=(t,r)=>et(t,r.type),this.resolveAnchorPosition=(t,{coordSystem:r,position:n,purpose:a,align:i})=>{if(i!==void 0){const h=hr(t,r);return h===null?null:st(h,i)}if(r.type==="polar")return Go(t);const o=de(n),s={isSolo:!o||An(t)==="solo",isNegative:o&&zo(t),purpose:a};if(r.mainAxis==="x"){const h=X(t),c=$(t),p=$t({lowerBound:Y(t),upperBound:G(t)??U(t),options:s});return h===null||c===null||p===null?null:{x:(h+c)/2,y:p}}const l=Y(t),u=G(t),d=$t({lowerBound:X(t),upperBound:$(t)??K(t),options:s});return l===null||u===null||d===null?null:{x:d,y:(l+u)/2}},this.getDataLabelPlacements=t=>t.coordSystem.type==="polar"?jo(t):Po(t),this.resolvePercentageValueStrategy=(t,r)=>r==="polar"?Vo():So(t)}resolveParams(e){const{width:t,...r}=super.resolveParams(e),n=this.resolveWidthParam(t,e.diagnostics);return{...r,...n!==void 0&&{width:n}}}compile({data:e,mapping:t,params:r,coordType:n}){const a=et(r,n);e=pt(e,t),e.hasVariable(y.yMin)||(e=e.addConstantVariable(y.yMin,"numeric",0));const i=a/2;return e=e.addConstantVariable(y.xMin,"numeric",-i).addConstantVariable(y.xMax,"numeric",i),{data:e,mapping:{}}}resolveWidthParam(e,t){if(e===void 0)return;const r=typeof e=="number"&&Number.isFinite(e)?e:null;if(r!==null&&r>0&&r<=1)return r;const n=r!==null&&r>1?1:void 0;return t?.addWarning({code:"INVALID_GEOM_PARAM",message:`Bar width must be a fraction in (0, 1], got ${String(e)}; falling back to ${n??"the default band"}.`,context:{geom:this.type,param:"width",expected:"0 < width <= 1",actual:r??String(e)},suggestion:"Set params.width to a fraction of the category band in (0, 1]."}),n}},et=({width:e},t)=>e!==void 0?e:t==="polar"?1:vn,Go=e=>{const t=X(e),r=$(e),n=Y(e),a=G(e);return t===null||r===null||n===null||a===null?null:Z((t+r)/2,(n+a)/2)},zo=e=>{const t=fr(e);return O(t)&&t<0},$t=e=>{const{lowerBound:t,upperBound:r,options:n}=e,a=n.isNegative?t:r;if(a===null)return null;if(n.purpose==="value"||n.isSolo)return a;const i=n.isNegative?r:t;return i===null?null:(i+a)/2},Ho=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=Ko(e.layer);for(const a of e.layer.data){const i=K(a),o=U(a);if(i===null||o===null||!Ne(i,o))continue;const s=e.formatLabel(a);if(s==="")continue;const{width:l,height:u}=e.measureDataLabel("observation","outside",s),d=ye({box:{x:i*e.panelRect.width,y:(1-o)*e.panelRect.height,width:0,height:0},panel:pe(e.panelRect),orientation:{valueAxis:"y",valueDirectionSign:-1},...n,offset:r,labelWidth:l,labelHeight:u});t.push({layerId:e.layer.id,x:d.x,y:d.y,text:s,width:l,height:u,isRotated:!1,role:"observation",position:d.position})}return{labels:t,droppedCount:0}},Ko=e=>{const{position:t,justify:r,align:n}=e.dataLabels;return t==="auto"?{placement:"outside",justify:"end",align:"center"}:{placement:t,justify:mt(e.data,e.mapping)?vt(r):r,align:n}},Xo=class extends q{constructor(...e){super(...e),this.type="line",this.styleTarget={observation:{vocabulary:{strokeWidth:"pixels",dashArray:"dashArray",lineCap:"lineCap",lineJoin:"lineJoin"},aesthetics:{stroke:"color",strokeAlpha:"alpha",strokeWidth:"strokeWidth",dashArray:"lineType"},rest:{stroke:f("geom"),strokeWidth:2,dashArray:C.line.solid}}},this.supportedCoordTypes=["cartesian","polar","flip"],this.defaultParams={curve:"linear",missingValues:"gap"},this.positionRoles=[{axis:"x",role:"point",valueKind:"value"},{axis:"y",role:"point",valueKind:"value"}],this.aesthetics=[{kind:"visual",name:"color"},{kind:"visual",name:"strokeWidth"},{kind:"visual",name:"lineType"},{kind:"visual",name:"alpha"}],this.summaries={perGroupHeadline:!0},this.dataLabels={cartesian:{offset:8},flip:{offset:8}},this.dataLabelCoordTypes=["cartesian","flip"],this.isComposite=!0,this.legend={suppressWhenSingleItem:!0,sidePlacement:"whenCrowded",directLabelSupport:{stack:!0,dodge:!0,identity:!0,fill:!0}},this.highlightStrategy="overlay-anchor",this.spatialKind="buckets",this.resolveAnchorPosition=yt,this.getDataLabelPlacements=t=>Ho(t)}compile(e){return{data:pt(e.data,e.mapping),mapping:{}}}},$o=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=qo(e.layer),a=n.justify==="panel-start"||n.justify==="panel-end",i=e.styleReaders;for(const o of e.layer.data){const s=K(o),l=U(o);if(s===null||l===null||!Ne(s,l))continue;const u=e.formatLabel(o);if(u==="")continue;const{width:d,height:h}=e.measureDataLabel("observation","outside",u),c=i.get("size",o)/2,p=ye({box:{x:s*e.panelRect.width,y:(1-l)*e.panelRect.height,width:0,height:0},panel:pe(e.panelRect),orientation:{valueAxis:"y",valueDirectionSign:-1},...n,offset:a?r:r+c,alignOffset:r+c,labelWidth:d,labelHeight:h});t.push({layerId:e.layer.id,x:p.x,y:p.y,text:u,width:d,height:h,isRotated:!1,role:"observation",position:p.position})}return{labels:t,droppedCount:0}},qo=e=>{const{position:t,justify:r,align:n}=e.dataLabels;return t==="auto"?{placement:"outside",justify:"end",align:"center"}:{placement:t,justify:r,align:n}},Jo=class extends q{constructor(...e){super(...e),this.type="point",this.styleTarget={observation:{vocabulary:{size:"pixels",symbol:"pointSymbol",strokeWidth:"pixels"},aesthetics:{fill:"color",alpha:"alpha",size:"size",strokeWidth:"strokeWidth"},rest:{fill:f("geom"),fillAlpha:1,size:8,symbol:"circle",stroke:f("hoverAffordance"),strokeWidth:1},hovered:{stroke:f("hoverAffordance")}}},this.supportedCoordTypes=["cartesian","polar","flip"],this.defaultParams={},this.positionRoles=[{axis:"x",role:"point",valueKind:"value"},{axis:"y",role:"point",valueKind:"value"}],this.aesthetics=[{kind:"visual",name:"color"},{kind:"visual",name:"size"},{kind:"visual",name:"alpha"}],this.summaries={perGroupHeadline:!0},this.highlightStrategy="overlay-anchor",this.dataLabelCoordTypes=["cartesian","flip"],this.resolveAnchorPosition=yt,this.resolveValueSource=(t,r)=>{if(r!=="label")return null;const n=R(t.size);return n!==null?{variable:n}:null},this.getDataLabelPlacements=t=>$o(t)}compile({data:e}){return{data:e,mapping:{}}}},Zo=class extends q{constructor(...e){super(...e),this.type="rule",this.styleTarget={observation:{vocabulary:{stroke:"color",strokeAlpha:"unitInterval",strokeWidth:"pixels",dashArray:"dashArray",lineCap:"lineCap",lineJoin:"lineJoin",shadow:"shadow",blendMode:"blendMode"},sharedPaint:!1,dashPresets:C.rule,aesthetics:{stroke:"color",strokeWidth:"strokeWidth",dashArray:"lineType"},rest:{stroke:f("ruleLine"),strokeWidth:1,dashArray:C.rule.dashed}},parts:{label:{vocabulary:T,options:["layer"],rest:{fontSize:11.5,fontWeight:500,lineHeight:1}}}},this.defaultParams={labelPosition:"start"},this.defaultInteractive=!1,this.positionRoles=[{axis:"y",role:"scalar",valueKind:"value",aes:"y"},{axis:"x",role:"scalar",valueKind:"value",aes:"x"}],this.highlightStrategy=null,this.spatialKind="noop",this.validateMapping=({mapping:t,computedVariables:r})=>{const n=r.has("x")||O(Ee(t.x)),a=r.has("y")||O(Ee(t.y));return n&&a?[{code:"INVALID_RULE_MAPPING",message:"rule geom requires exactly one of 'x' or 'y', both were provided"}]:!n&&!a?[{code:"INVALID_RULE_MAPPING",message:"rule geom requires a numeric value on 'x' or 'y'"}]:[]}}compile({data:e,mapping:t}){const r=qt(t.y,e);if(r!==null)return{data:new te({[Ae.y]:{type:"numeric",values:[r.value],valueFormat:r.sourceFormat}}),mapping:{y:Ae.y,x:void 0}};const n=qt(t.x,e);return n!==null?{data:new te({[Ae.x]:{type:"numeric",values:[n.value],valueFormat:n.sourceFormat}}),mapping:{x:Ae.x,y:void 0}}:{data:new te,mapping:{x:void 0,y:void 0}}}},qt=(e,t)=>{const r=Ee(e);if(O(r))return{value:r,sourceFormat:void 0};const n=R(e);if(n===null||!aa(n)||!t.hasVariable(n))return null;const[a]=t.getValues(n);return O(a)?{value:a,sourceFormat:t.getValueFormat(n)}:null};function xn(e){return e[oe.color]}function Qo(e){return e[oe.alpha]}function es(e){return e[oe.size]}function ts(e){return e[oe.strokeWidth]}function rs(e){return e[oe.lineType]}var Mn=e=>{const t=X(e),r=$(e),n=Y(e),a=G(e);if(t===null||r===null||n===null||a===null)return null;const i=Math.min(t,r),o=Math.abs(r-t),s=Math.max(n,a),l=Math.abs(a-n);return{x:i,y:1-s,width:o,height:l}},_n=e=>{const t=Mn(e);if(!t)return null;const r=t.width*Ao,n=t.height*To;return{x:t.x+r,y:t.y+n,width:t.width-r*2,height:t.height-n*2}},Rn=e=>!!xn(e),Ln=e=>Rn(e)?_n(e):null,Jt=4,ns=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const r=e.styleReaders;for(const n of e.layer.data){const a=Ln(n);if(a===null)continue;const i=e.formatLabel(n);if(i==="")continue;const{width:o,height:s}=e.measureDataLabel("observation","inside",i),l=a.width*e.panelRect.width,u=a.height*e.panelRect.height;o+Jt>l||s+Jt>u||t.push({layerId:e.layer.id,x:(a.x+a.width/2)*e.panelRect.width,y:(a.y+a.height/2)*e.panelRect.height,text:i,width:o,height:s,isRotated:!1,role:"observation",position:"inside",backdropColor:Ve(r,n)})}return{labels:t,droppedCount:0}},as=e=>{const t=R(e.color);return t!==null?{variable:t}:null},is=class extends q{constructor(...e){super(...e),this.type="tile",this.styleTarget={observation:{vocabulary:{cornerRadius:"pixels",strokeWidth:"pixels"},aesthetics:{fill:"color",alpha:"alpha",strokeWidth:"strokeWidth"},rest:{fill:f("geom"),fillAlpha:1,cornerRadius:8,strokeWidth:0},hovered:{stroke:f("hoverAffordance"),strokeWidth:2}}},this.defaultParams={},this.positionRoles=[{axis:"x",role:"point",valueKind:"value"},{axis:"x",role:"min",valueKind:"value"},{axis:"x",role:"max",valueKind:"value"},{axis:"y",role:"point",valueKind:"value"},{axis:"y",role:"min",valueKind:"value"},{axis:"y",role:"max",valueKind:"value"}],this.supportedPositions=["identity"],this.supportedCoordTypes=["cartesian"],this.aesthetics=[{kind:"visual",name:"color",required:!0}],this.scaleConstraints={discreteMainAxis:!0,discreteCrossAxis:!0,bandPadding:0,inferredColor:!0},this.grid={cartesian:{hideGridX:!0,hideGridY:!0}},this.legend={suppressWhenSingleItem:!1},this.dataLabels={cartesian:{showDataLabels:!0}},this.dataLabelCoordTypes=["cartesian"],this.highlightStrategy="observation-rerender",this.spatialKind="cells",this.identityKey="x-y",this.tooltip=[{aes:"color"}],this.resolveValueSource=as,this.resolveAnchorPosition=t=>{const r=X(t),n=$(t),a=Y(t),i=G(t);return r===null||n===null||a===null||i===null?null:{x:(r+n)/2,y:(a+i)/2}},this.getDataLabelPlacements=t=>ns(t)}compile({data:e}){return{data:e.addConstantVariable(y.xMin,"numeric",-.5).addConstantVariable(y.xMax,"numeric",.5).addConstantVariable(y.yMin,"numeric",-.5).addConstantVariable(y.yMax,"numeric",.5),mapping:{}}}},wn=[new Yo,new Jo,new Xo,new bo,new Zo,new is],os=class extends bt{constructor(){super("geom");for(const e of wn)this.register(e.type,e)}},In=class{resolveComputedVariables(e,t){return this.computedVariables}compute(e){return this.computeStat(e)}},ss=class{constructor(){this.transformType="aggregate"}apply(e,t){const{options:r}=t,n={};for(const a of r.operations)n[a.as]={variableName:a.variableName,aggregation:a.op};return e.groupBy(...r.groupby).rollup(n)}},ls={numeric:{type:"decimal"},categorical:{type:"text"},temporal:{type:"datetime"}},us=class{constructor(){this.transformType="constant"}apply(e,t){const{options:r}=t,n=dt(r.value,ls[r.type],Se);if(r.value!==null&&n===null)throw new ae({code:"INCOMPATIBLE_TYPE",message:`Constant '${r.variableName}' cannot be read as ${r.type}`,context:{variableName:r.variableName,variableType:r.type}});return e.addConstantVariable(r.variableName,r.type,n)}getIntroducedVariables(e){const{options:t}=e;return[t.variableName]}},cs=class{constructor(){this.transformType="filter"}apply(e,t){const{options:r}=t;return e.filter(r.variableName,r.operator,r.value)}},ds=class{constructor(){this.transformType="reshape"}apply(e,t){const{options:r}=t;return e.reshapeFromWideToLong({keep:r.keep,reshape:r.reshape,keyName:r.keyName,valueName:r.valueName})}getIntroducedVariables(e){const{options:t}=e;return[t.keyName??"key"]}},fs=class{constructor(){this.transformType="sort"}apply(e,t){const{options:r}=t;return e.orderBy(r.variableName,r.direction??"asc")}},hs=[new ss,new us,new cs,new ds,new fs],ps=class extends bt{constructor(){super("transform");for(const e of hs)this.register(e.transformType,e)}};function kn(e){if("definition"in e)return e.definition;if(Dn(e)||Cn(e)||Nn(e))return e}function ys(e){const t=[],r=[],n=[];for(const a of e){const i=kn(a);i&&(Dn(i)?(t.push(i),i.defaultStat!==null&&r.push(i.defaultStat)):Cn(i)?r.push(i):Nn(i)&&n.push(i))}return{geoms:t,stats:r,transforms:n,warnings:[...Ke("geom",t,a=>a.type),...Ke("stat",r,a=>a.type),...Ke("transform",n,a=>a.transformType),...gs(t),...ms(t),...bs(t)]}}function gs(e){const t=[];for(const r of e)r.spatialKind==="render-hit-test"&&(r.identityKey!=="x-group"&&r.identityKey!=="x-y"||t.push({code:"RENDER_HIT_TEST_IDENTITY",message:`The render-hit-test geom '${r.type}' uses the position-derived '${r.identityKey}' identity, which has no meaning for render-owned geometry; its hover lookup will be empty.`,context:{kind:"geom",requested:r.type},suggestion:"Declare 'identityKey' as a column the geom owns (`{ variable: '<column>' }`) or 'index', so a hit-test result resolves to an observation."}));return t}function ms(e){const t=[];for(const r of e)r.spatialKind!=="cells"||!r.supportedCoordTypes.includes("polar")||t.push({code:"SPATIAL_KIND_COORD_UNSUPPORTED",message:`The geom '${r.type}' declares polar support, but its 'cells' hit-test shape has no polar projection; its observations will not respond to hover under polar coords.`,context:{kind:"geom",requested:r.type},suggestion:"Drop 'polar' from 'supportedCoordTypes', or declare 'rects' as the spatial kind so a bandless polar layer hit-tests as an enclosure."});return t}function bs(e){return e.filter(t=>t.categorySpanAxes.some(r=>r!=="x")).map(t=>({code:"UNSUPPORTED_CATEGORY_SPAN_AXIS",message:`The geom '${t.type}' spans categories on 'y', which is not supported yet; 'y' is read as a position.`,context:{kind:"geom",requested:t.type},suggestion:"Declare 'categorySpanAxes' as ['x'], and use coord.flip() to run the categories vertically."}))}function Ke(e,t,r){const n=new Map;for(const i of t){const o=r(i),s=n.get(o);s?s.add(i):n.set(o,new Set([i]))}const a=[];for(const[i,o]of n)o.size<2||a.push({code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple plugins register the ${e} '${i}' (${o.size} definitions); the last in the array wins.`,context:{kind:e,requested:i},suggestion:`Remove the duplicate ${e} plugin(s) named '${i}', or rename them so each registers a distinct ${e}.`});return a}var Dn=e=>e instanceof q,Cn=e=>e instanceof In,Nn=e=>"transformType"in e&&typeof e.apply=="function",vs=["rgb","lab","hcl","hsl"];function As(e,t={}){const r=t;return{type:"scale",scaledAesthetic:e,scaleType:"continuous",transform:t.transform,reverse:t.reverse,nice:t.nice,clamp:t.clamp,domainMin:t.domainMin??null,domainMax:t.domainMax??null,range:t.range,interpolate:r.interpolate,domainMid:r.domainMid??null,symmetric:r.symmetric}}function Ts(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"datetime",domainMin:t.domainMin??null,domainMax:t.domainMax??null,nice:t.nice,reverse:t.reverse,clamp:t.clamp}}function Es(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"discrete",range:t.range,domain:t.domain??null,padding:t.padding,reverse:t.reverse}}function Ps(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"identity"}}function Ss(e,t){return{type:"scale",scaledAesthetic:e,scaleType:"inferred",options:t}}var Os={labelCrossPosition:.5},xs={kind:"rectangle",zOrder:"foreground"},Ms={zOrder:"foreground",fit:"contain"},_s={x:8,y:8,unit:"px"},Rs={align:"center"},Ls={startArrowheadStyle:"none",endArrowheadStyle:"line-arrow"},ws={thin:2,medium:4,thick:8},Is=.5,ks={strokeWidth:2,shadow:{offsetX:0,offsetY:1.15,blur:1.15,color:"rgba(0, 0, 0, 0.16)"}},Ds={small:{arrow:{strokeWidth:2},label:{fontSize:12,fontWeight:500,paddingInline:6,paddingBlock:3,strokeWidth:1}},medium:{arrow:{strokeWidth:3},label:{fontSize:16,fontWeight:500,paddingInline:8,paddingBlock:4,strokeWidth:1.5}},large:{arrow:{strokeWidth:5},label:{fontSize:20,fontWeight:600,paddingInline:10,paddingBlock:5,strokeWidth:2}}},Cs={differenceArrow:"differenceArrows",shape:"shapes",arrow:"arrows",text:"textAnnotations",image:"images",sticker:"stickers",pinnedNumber:"pinnedNumbers",comment:"comments"},Ns={differenceArrow(e){return{type:"annotation",kind:"differenceArrow",annotation:e}},shape(e){return{type:"annotation",kind:"shape",annotation:e}},arrow(e){return{type:"annotation",kind:"arrow",annotation:e}},text(e){return{type:"annotation",kind:"text",annotation:e}},image(e){return{type:"annotation",kind:"image",annotation:e}},sticker(e){return{type:"annotation",kind:"sticker",annotation:e}},pinnedNumber(e){return{type:"annotation",kind:"pinnedNumber",annotation:e}},comment(e){return{type:"annotation",kind:"comment",annotation:e}}};Object.defineProperty(exports,"ANNOTATION_BUCKETS",{enumerable:!0,get:function(){return Cs}});Object.defineProperty(exports,"ARROW_DEFAULTS",{enumerable:!0,get:function(){return Ls}});Object.defineProperty(exports,"ARROW_STICKER_DECLARATIONS",{enumerable:!0,get:function(){return ks}});Object.defineProperty(exports,"ARROW_STROKE_WIDTHS_PX",{enumerable:!0,get:function(){return ws}});Object.defineProperty(exports,"AXIS_KEYS",{enumerable:!0,get:function(){return gi}});Object.defineProperty(exports,"BAR_GROUP_SCALE_PADDING_FRACTION",{enumerable:!0,get:function(){return vo}});Object.defineProperty(exports,"BAR_WIDTH_FRACTION",{enumerable:!0,get:function(){return vn}});Object.defineProperty(exports,"BORDER_RADIUS_TOKENS",{enumerable:!0,get:function(){return ft}});Object.defineProperty(exports,"BRICK_TONES",{enumerable:!0,get:function(){return qe}});Object.defineProperty(exports,"BRICK_TONES_BY_COUNT",{enumerable:!0,get:function(){return Fi}});Object.defineProperty(exports,"BUILT_IN_GEOMS",{enumerable:!0,get:function(){return wn}});Object.defineProperty(exports,"COLOR_INTERPOLATION_SPACES",{enumerable:!0,get:function(){return vs}});Object.defineProperty(exports,"CONSTANT_VARIABLES",{enumerable:!0,get:function(){return at}});Object.defineProperty(exports,"ChronologicalDateManager",{enumerable:!0,get:function(){return Ar}});Object.defineProperty(exports,"DASH_PRESETS",{enumerable:!0,get:function(){return C}});Object.defineProperty(exports,"DEFAULT_BAR_CORNER_RADIUS",{enumerable:!0,get:function(){return Ui}});Object.defineProperty(exports,"DEFAULT_COLOR_PALETTE",{enumerable:!0,get:function(){return dn}});Object.defineProperty(exports,"DEFAULT_DIMMED_ALPHA",{enumerable:!0,get:function(){return hn}});Object.defineProperty(exports,"DEFAULT_DIVERGING_RAMP",{enumerable:!0,get:function(){return Vi}});Object.defineProperty(exports,"DEFAULT_GEOM_COLOR",{enumerable:!0,get:function(){return Wi}});Object.defineProperty(exports,"DEFAULT_GRAPH_BACKGROUND",{enumerable:!0,get:function(){return Hi}});Object.defineProperty(exports,"DEFAULT_GRAPH_BORDER_WIDTH_PX",{enumerable:!0,get:function(){return Xi}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_EDGES_PX",{enumerable:!0,get:function(){return qi}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_PX",{enumerable:!0,get:function(){return $i}});Object.defineProperty(exports,"DEFAULT_HEADLINE_SWATCH_SIZE_PX",{enumerable:!0,get:function(){return zi}});Object.defineProperty(exports,"DEFAULT_HOVER_AFFORDANCE_COLOR",{enumerable:!0,get:function(){return Ki}});Object.defineProperty(exports,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"DEFAULT_POINT_SIZE_PX",{enumerable:!0,get:function(){return Gi}});Object.defineProperty(exports,"DEFAULT_RESHAPE_VALUE_NAME",{enumerable:!0,get:function(){return sn}});Object.defineProperty(exports,"DEFAULT_SEQUENTIAL_RAMP",{enumerable:!0,get:function(){return ji}});Object.defineProperty(exports,"DEFAULT_STROKE_WIDTH_PX",{enumerable:!0,get:function(){return Yi}});Object.defineProperty(exports,"DIFFERENCE_ARROW_DEFAULTS",{enumerable:!0,get:function(){return Os}});Object.defineProperty(exports,"DIFFERENCE_ARROW_SIZE_DECLARATIONS",{enumerable:!0,get:function(){return Ds}});Object.defineProperty(exports,"DataCompiler",{enumerable:!0,get:function(){return Ii}});Object.defineProperty(exports,"Dataset",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"GROUP_VARIABLES",{enumerable:!0,get:function(){return Le}});Object.defineProperty(exports,"Geom",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"GeomRegistry",{enumerable:!0,get:function(){return os}});Object.defineProperty(exports,"IMAGE_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return Ms}});Object.defineProperty(exports,"IS_DEV",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"InternalError",{enumerable:!0,get:function(){return _}});Object.defineProperty(exports,"LAYER_LABEL_VARIABLES",{enumerable:!0,get:function(){return ta}});Object.defineProperty(exports,"LINE_TYPES",{enumerable:!0,get:function(){return gr}});Object.defineProperty(exports,"POLAR_RIM_LABEL_GAP_PX",{enumerable:!0,get:function(){return $n}});Object.defineProperty(exports,"POSITION_ADJUSTMENTS",{enumerable:!0,get:function(){return yr}});Object.defineProperty(exports,"POSITION_NUMERIC_ROLES",{enumerable:!0,get:function(){return ui}});Object.defineProperty(exports,"POSITION_VARIABLES",{enumerable:!0,get:function(){return y}});Object.defineProperty(exports,"Registry",{enumerable:!0,get:function(){return bt}});Object.defineProperty(exports,"SCALED_POSITION_AESTHETIC_KEYS",{enumerable:!0,get:function(){return Qr}});Object.defineProperty(exports,"SCALED_VISUAL_AESTHETIC_KEYS",{enumerable:!0,get:function(){return gt}});Object.defineProperty(exports,"SELECTION_PADDING_DEFAULT",{enumerable:!0,get:function(){return _s}});Object.defineProperty(exports,"SHAPE_DEFAULTS",{enumerable:!0,get:function(){return xs}});Object.defineProperty(exports,"STACK_VARIABLES",{enumerable:!0,get:function(){return ot}});Object.defineProperty(exports,"STAT_VARIABLES",{enumerable:!0,get:function(){return it}});Object.defineProperty(exports,"STYLE_BLEND_MODES",{enumerable:!0,get:function(){return Hr}});Object.defineProperty(exports,"STYLE_COORDS",{enumerable:!0,get:function(){return Bi}});Object.defineProperty(exports,"STYLE_DOMAINS",{enumerable:!0,get:function(){return ai}});Object.defineProperty(exports,"STYLE_FONT_STYLES",{enumerable:!0,get:function(){return Wr}});Object.defineProperty(exports,"STYLE_IMAGE_FITS",{enumerable:!0,get:function(){return Qt}});Object.defineProperty(exports,"STYLE_LINE_CAPS",{enumerable:!0,get:function(){return Gr}});Object.defineProperty(exports,"STYLE_LINE_JOINS",{enumerable:!0,get:function(){return zr}});Object.defineProperty(exports,"STYLE_PATTERN_PRESETS",{enumerable:!0,get:function(){return Zt}});Object.defineProperty(exports,"STYLE_POINT_SYMBOLS",{enumerable:!0,get:function(){return Kr}});Object.defineProperty(exports,"STYLE_PROPERTY_NAMES",{enumerable:!0,get:function(){return Qa}});Object.defineProperty(exports,"STYLE_SELECT_KEYS",{enumerable:!0,get:function(){return fn}});Object.defineProperty(exports,"STYLE_STATES",{enumerable:!0,get:function(){return Za}});Object.defineProperty(exports,"STYLE_TARGETS",{enumerable:!0,get:function(){return je}});Object.defineProperty(exports,"STYLE_TEXT_DECORATIONS",{enumerable:!0,get:function(){return Yr}});Object.defineProperty(exports,"STYLE_TEXT_TRANSFORMS",{enumerable:!0,get:function(){return Ur}});Object.defineProperty(exports,"SUFFIX_MULTIPLIERS",{enumerable:!0,get:function(){return Tr}});Object.defineProperty(exports,"Stage",{enumerable:!0,get:function(){return Zr}});Object.defineProperty(exports,"Stat",{enumerable:!0,get:function(){return In}});Object.defineProperty(exports,"TAU",{enumerable:!0,get:function(){return W}});Object.defineProperty(exports,"TEXT_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return Rs}});Object.defineProperty(exports,"TEXT_ANNOTATION_FADE_ALPHA",{enumerable:!0,get:function(){return Is}});Object.defineProperty(exports,"TransformRegistry",{enumerable:!0,get:function(){return ps}});Object.defineProperty(exports,"UserInputError",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"VISUAL_VARIABLES",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"VizError",{enumerable:!0,get:function(){return lt}});Object.defineProperty(exports,"alignToBoxPoint",{enumerable:!0,get:function(){return st}});Object.defineProperty(exports,"alignUnitFractions",{enumerable:!0,get:function(){return ua}});Object.defineProperty(exports,"annotation",{enumerable:!0,get:function(){return Ns}});Object.defineProperty(exports,"areDataValuesEqual",{enumerable:!0,get:function(){return ca}});Object.defineProperty(exports,"areMappingsEquivalent",{enumerable:!0,get:function(){return ga}});Object.defineProperty(exports,"buildLayerSpec",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"buildPanelAnchorBox",{enumerable:!0,get:function(){return pe}});Object.defineProperty(exports,"compositeColor",{enumerable:!0,get:function(){return rr}});Object.defineProperty(exports,"continuous",{enumerable:!0,get:function(){return As}});Object.defineProperty(exports,"createGeomStyleNode",{enumerable:!0,get:function(){return uo}});Object.defineProperty(exports,"createPerKeyMemo",{enumerable:!0,get:function(){return qr}});Object.defineProperty(exports,"createSingleSlotMemo",{enumerable:!0,get:function(){return si}});Object.defineProperty(exports,"cursorToPiePlane",{enumerable:!0,get:function(){return ur}});Object.defineProperty(exports,"cursorToPolar",{enumerable:!0,get:function(){return ea}});Object.defineProperty(exports,"datetime",{enumerable:!0,get:function(){return Ts}});Object.defineProperty(exports,"defineGeomStyleTarget",{enumerable:!0,get:function(){return so}});Object.defineProperty(exports,"deriveDeclaredAesthetics",{enumerable:!0,get:function(){return fi}});Object.defineProperty(exports,"deriveGeomRequiredAesthetics",{enumerable:!0,get:function(){return pi}});Object.defineProperty(exports,"discrete",{enumerable:!0,get:function(){return Es}});Object.defineProperty(exports,"ensureReadableTextColor",{enumerable:!0,get:function(){return Yn}});Object.defineProperty(exports,"fillIntervalAesthetics",{enumerable:!0,get:function(){return hi}});Object.defineProperty(exports,"findStyleTarget",{enumerable:!0,get:function(){return oo}});Object.defineProperty(exports,"freezeWalkedEntries",{enumerable:!0,get:function(){return io}});Object.defineProperty(exports,"geom",{enumerable:!0,get:function(){return Ga}});Object.defineProperty(exports,"getAestheticFromScaleAestheticKey",{enumerable:!0,get:function(){return vi}});Object.defineProperty(exports,"getAlpha",{enumerable:!0,get:function(){return Qo}});Object.defineProperty(exports,"getAngleExtent",{enumerable:!0,get:function(){return Sn}});Object.defineProperty(exports,"getColor",{enumerable:!0,get:function(){return xn}});Object.defineProperty(exports,"getGroupVariables",{enumerable:!0,get:function(){return nn}});Object.defineProperty(exports,"getInsetTileRect",{enumerable:!0,get:function(){return _n}});Object.defineProperty(exports,"getLineType",{enumerable:!0,get:function(){return rs}});Object.defineProperty(exports,"getPaintedTileRect",{enumerable:!0,get:function(){return Ln}});Object.defineProperty(exports,"getRadiusExtent",{enumerable:!0,get:function(){return On}});Object.defineProperty(exports,"getScaledAesthetic",{enumerable:!0,get:function(){return sa}});Object.defineProperty(exports,"getSize",{enumerable:!0,get:function(){return es}});Object.defineProperty(exports,"getStableKey",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"getStackRole",{enumerable:!0,get:function(){return An}});Object.defineProperty(exports,"getStrokeWidth",{enumerable:!0,get:function(){return ts}});Object.defineProperty(exports,"getTileRectBounds",{enumerable:!0,get:function(){return Mn}});Object.defineProperty(exports,"getX",{enumerable:!0,get:function(){return K}});Object.defineProperty(exports,"getXBand",{enumerable:!0,get:function(){return ia}});Object.defineProperty(exports,"getXMax",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"getXMin",{enumerable:!0,get:function(){return X}});Object.defineProperty(exports,"getY",{enumerable:!0,get:function(){return U}});Object.defineProperty(exports,"getYBand",{enumerable:!0,get:function(){return oa}});Object.defineProperty(exports,"getYMax",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"getYMin",{enumerable:!0,get:function(){return Y}});Object.defineProperty(exports,"getYRaw",{enumerable:!0,get:function(){return fr}});Object.defineProperty(exports,"hasMultipleGroups",{enumerable:!0,get:function(){return mt}});Object.defineProperty(exports,"identity",{enumerable:!0,get:function(){return Ps}});Object.defineProperty(exports,"inferXVariable",{enumerable:!0,get:function(){return ha}});Object.defineProperty(exports,"inferred",{enumerable:!0,get:function(){return Ss}});Object.defineProperty(exports,"isAngleWithinArc",{enumerable:!0,get:function(){return ir}});Object.defineProperty(exports,"isBorderRadiusToken",{enumerable:!0,get:function(){return Br}});Object.defineProperty(exports,"isCategoricalValueFormat",{enumerable:!0,get:function(){return mr}});Object.defineProperty(exports,"isCompilerCachingEnabled",{enumerable:!0,get:function(){return oi}});Object.defineProperty(exports,"isCurrencyValueFormat",{enumerable:!0,get:function(){return ba}});Object.defineProperty(exports,"isDateWithoutYearValueFormat",{enumerable:!0,get:function(){return va}});Object.defineProperty(exports,"isDefined",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"isFullTurnSweep",{enumerable:!0,get:function(){return ar}});Object.defineProperty(exports,"isGradientPaint",{enumerable:!0,get:function(){return Ie}});Object.defineProperty(exports,"isImagePaint",{enumerable:!0,get:function(){return rt}});Object.defineProperty(exports,"isInternalVariable",{enumerable:!0,get:function(){return na}});Object.defineProperty(exports,"isLightDarkColor",{enumerable:!0,get:function(){return Oe}});Object.defineProperty(exports,"isLineType",{enumerable:!0,get:function(){return ma}});Object.defineProperty(exports,"isLookupValueFormat",{enumerable:!0,get:function(){return ut}});Object.defineProperty(exports,"isNonEmptyArray",{enumerable:!0,get:function(){return da}});Object.defineProperty(exports,"isNumericDataValue",{enumerable:!0,get:function(){return Xn}});Object.defineProperty(exports,"isNumericValueFormat",{enumerable:!0,get:function(){return br}});Object.defineProperty(exports,"isOpaquePaint",{enumerable:!0,get:function(){return zn}});Object.defineProperty(exports,"isPatternPaint",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"isPlainObject",{enumerable:!0,get:function(){return fa}});Object.defineProperty(exports,"isPointWithinPanel",{enumerable:!0,get:function(){return Ne}});Object.defineProperty(exports,"isPositionScale",{enumerable:!0,get:function(){return en}});Object.defineProperty(exports,"isScaledAestheticKey",{enumerable:!0,get:function(){return mi}});Object.defineProperty(exports,"isStackedPosition",{enumerable:!0,get:function(){return de}});Object.defineProperty(exports,"isStrictCategoricalDataValue",{enumerable:!0,get:function(){return Kn}});Object.defineProperty(exports,"isStrictNumericDataValue",{enumerable:!0,get:function(){return O}});Object.defineProperty(exports,"isStrictTemporalDataValue",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"isStyleTokenRef",{enumerable:!0,get:function(){return ht}});Object.defineProperty(exports,"isTemporalDataValue",{enumerable:!0,get:function(){return Hn}});Object.defineProperty(exports,"isTemporalValueFormat",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"isTilePainted",{enumerable:!0,get:function(){return Rn}});Object.defineProperty(exports,"isUsableTokenValue",{enumerable:!0,get:function(){return Xr}});Object.defineProperty(exports,"isVisualScale",{enumerable:!0,get:function(){return tn}});Object.defineProperty(exports,"measureSignedAngularDelta",{enumerable:!0,get:function(){return Zn}});Object.defineProperty(exports,"normalizeAngle",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"paintKey",{enumerable:!0,get:function(){return Wn}});Object.defineProperty(exports,"parseAddressingValue",{enumerable:!0,get:function(){return dt}});Object.defineProperty(exports,"parseDataset",{enumerable:!0,get:function(){return cn}});Object.defineProperty(exports,"pickReadableTextColor",{enumerable:!0,get:function(){return tr}});Object.defineProperty(exports,"polarSectorToInscribedSquare",{enumerable:!0,get:function(){return sr}});Object.defineProperty(exports,"polarToUnit",{enumerable:!0,get:function(){return or}});Object.defineProperty(exports,"positionToAngle",{enumerable:!0,get:function(){return Qn}});Object.defineProperty(exports,"prefixInternalVariable",{enumerable:!0,get:function(){return g}});Object.defineProperty(exports,"readBackdropColor",{enumerable:!0,get:function(){return Ve}});Object.defineProperty(exports,"readConstantValue",{enumerable:!0,get:function(){return Ee}});Object.defineProperty(exports,"readDataValueKey",{enumerable:!0,get:function(){return pr}});Object.defineProperty(exports,"readFoldKeepVariables",{enumerable:!0,get:function(){return pa}});Object.defineProperty(exports,"readISOInstant",{enumerable:!0,get:function(){return Rr}});Object.defineProperty(exports,"readMainAxisVariable",{enumerable:!0,get:function(){return ya}});Object.defineProperty(exports,"readObservationBox",{enumerable:!0,get:function(){return hr}});Object.defineProperty(exports,"readObservationVocabulary",{enumerable:!0,get:function(){return bn}});Object.defineProperty(exports,"readPlugins",{enumerable:!0,get:function(){return ys}});Object.defineProperty(exports,"readVariableName",{enumerable:!0,get:function(){return R}});Object.defineProperty(exports,"removeAlpha",{enumerable:!0,get:function(){return Gn}});Object.defineProperty(exports,"resolveAnchoredLabelCenter",{enumerable:!0,get:function(){return ye}});Object.defineProperty(exports,"resolveBarBandFraction",{enumerable:!0,get:function(){return et}});Object.defineProperty(exports,"resolveColorScheme",{enumerable:!0,get:function(){return Xe}});Object.defineProperty(exports,"resolveDefinition",{enumerable:!0,get:function(){return kn}});Object.defineProperty(exports,"resolvePositionScaleAesthetic",{enumerable:!0,get:function(){return bi}});Object.defineProperty(exports,"resolveScaledAestheticVariable",{enumerable:!0,get:function(){return dr}});Object.defineProperty(exports,"resolveYScaleAesthetic",{enumerable:!0,get:function(){return rn}});Object.defineProperty(exports,"setCompilerCachingEnabled",{enumerable:!0,get:function(){return ii}});Object.defineProperty(exports,"spansCategoriesOnX",{enumerable:!0,get:function(){return yi}});Object.defineProperty(exports,"sumMemoStats",{enumerable:!0,get:function(){return li}});Object.defineProperty(exports,"toExplicitValueFormat",{enumerable:!0,get:function(){return Aa}});Object.defineProperty(exports,"toPaintColor",{enumerable:!0,get:function(){return er}});Object.defineProperty(exports,"token",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"unitToPolar",{enumerable:!0,get:function(){return lr}});Object.defineProperty(exports,"walkStyleTargets",{enumerable:!0,get:function(){return ao}});Object.defineProperty(exports,"withAlpha",{enumerable:!0,get:function(){return nr}});Object.defineProperty(exports,"wrappedAngularDistance",{enumerable:!0,get:function(){return nt}});
@@ -256,9 +256,9 @@ function Ii(e) {
256
256
  const t = Object.getPrototypeOf(e);
257
257
  return t === Object.prototype || t === null;
258
258
  }
259
- function Ci(e) {
260
- const { numeric: t, categorical: r, temporal: a } = e.groupVariableNamesByType();
261
- return a[0] ?? r[0] ?? t[0] ?? "";
259
+ function Ci(e, t) {
260
+ const { numeric: r, categorical: a, temporal: n } = e.groupVariableNamesByType(), s = [...n, ...a];
261
+ return s.find((i) => i !== t) ?? s[0] ?? r[0] ?? "";
262
262
  }
263
263
  function Di(e, t) {
264
264
  const { categorical: r, temporal: a } = e.groupVariableNamesByType(), n = [...r, ...a];