@graphysdk/viz-engine 1.9.0-beta.1790336418293 → 1.9.0-beta.1790338050341
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{annotations-Dy-Gx6J6.cjs → annotations-ByWZSWnX.cjs} +1 -1
- package/dist/{annotations-DLGjUMss.js → annotations-Cma4ky3X.js} +498 -486
- package/dist/{compiler-jGyzPM0J.cjs → compiler-EbDX4mMw.cjs} +1 -1
- package/dist/{compiler-BxqWj0Zd.js → compiler-SBhe51uM.js} +1 -1
- package/dist/graph-config.cjs +1 -1
- package/dist/graph-config.mjs +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{spec-builder-CQ5p2Jzs.cjs → spec-builder-BWmAd8YW.cjs} +1 -1
- package/dist/{spec-builder-WJV9Uw6K.js → spec-builder-FnvyLsrK.js} +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.mjs +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var Sn=Object.create,Kt=Object.defineProperty,_n=Object.getOwnPropertyDescriptor,Mn=Object.getOwnPropertyNames,xn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty,Rn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Mn(t),i=0,o=a.length,s;i<o;i++)s=a[i],!Ln.call(e,s)&&s!==r&&Kt(e,s,{get:(l=>t[l]).bind(null,s),enumerable:!(n=_n(t,s))||n.enumerable});return e},wn=(e,t,r)=>(r=e!=null?Sn(xn(e)):{},Rn(t||!e||!e.__esModule?Kt(r,"default",{value:e,enumerable:!0}):r,e));let v=require("date-fns"),Je=require("lodash-es");var Le=e=>e instanceof Date&&(0,v.isValid)(e),kn=e=>Le(e)||e===null,Dn=e=>typeof e=="string",M=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),In=e=>M(e)||e===null,W=Math.PI*2,Cn=8,Fn=1e-9,Nn=[0,Math.PI/2,Math.PI,W*3/4],Xt=(e,t)=>Math.abs(t-e)>=W-Fn,te=e=>(e%W+W)%W,$t=(e,t,r)=>{if(Xt(t,r))return!0;const n=te(r-t);return te(e-t)<=n},jn=(e,t)=>{const r=Math.abs(te(e)-te(t));return Math.min(r,W-r)},Vn=(e,t)=>{const r=te(t-e);return r>Math.PI?r-W:r},Bn=(e,t,r)=>e*W+t+r,qt=(e,t)=>({x:t*Math.sin(e),y:t*Math.cos(e)}),J=(e,t)=>{const r=qt(e,t);return{x:.5+r.x/2,y:.5+r.y/2}},Jt=(e,t,r,n)=>{const a=[J(e,r),J(e,n),J(t,r),J(t,n)],i=Math.max(r,n),o=Nn.filter(l=>$t(l,e,t)).map(l=>J(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))}},Zt=(e,t)=>({angle:te(Math.atan2(e,t)),radius:Math.hypot(e,t)}),Qt=(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}},Wn=(e,t)=>{const{x:r,y:n}=Qt(e,t);return Zt(r,n)},er="\0graphy\0_",m=e=>`${er}${e}`,Ze={x:m("constantX")},Un={bar:m("barSeriesLabel"),line:m("lineSeriesLabel")},Qe={count:m("count"),mean:m("mean"),sum:m("sum")},Re={group:m("group")},b={x:m("x"),y:m("y"),xMin:m("xMin"),xMax:m("xMax"),yMin:m("yMin"),yMax:m("yMax"),yRaw:m("yRaw")},et={role:m("stackRole")},ne={color:m("color"),size:m("size"),alpha:m("alpha"),strokeWidth:m("strokeWidth"),lineType:m("lineType")},ye={y:m("ruleY"),x:m("ruleX")},Ds={...Ze,...Qe,...Re,...b,...et,...ne,...ye},Yn=new Set(Object.values(Qe)),tr=e=>m(`scaled_${e}`),Gn=e=>e.startsWith(er),zn=e=>Yn.has(e);function H(e){return e[b.x]}function U(e){return e[b.y]}function K(e){return e[b.xMin]}function X(e){return e[b.xMax]}function Y(e){return e[b.yMin]}function G(e){return e[b.yMax]}function rr(e){return e[b.yRaw]}function Hn(e,t){return e[tr(t)]}var Kn={xMin:0,xMax:1,yMin:0,yMax:1},nr=(e,t)=>{const r=K(e)??H(e),n=X(e)??H(e),a=Y(e)??U(e),i=G(e)??U(e);return!M(r)||!M(n)||!M(a)||!M(i)?null:t.type!=="polar"?{xMin:r,xMax:n,yMin:a,yMax:i}:{...Jt(r,n,a,i),space:"disk"}},tt=(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}}},Xn=e=>tt(Kn,e),$n=e=>e.length>0;function le(e){return e!=null}function qn(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Jn(e){const{numeric:t,categorical:r,temporal:n}=e.groupVariableNamesByType();return n[0]??r[0]??t[0]??""}function Zn(e,t){const{categorical:r,temporal:n}=e.groupVariableNamesByType(),a=[...r,...n];return t===""||a.includes(t)?a:[t,...a]}function Qn(e){const t=k(e.x);return t===null||t===Ze.x?"":t}function k(e){return le(e)?typeof e=="string"?e:"variable"in e?e.variable:null:null}function be(e){if(!(!le(e)||typeof e=="string")&&"value"in e)return e.value}function ea(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].every(r=>bt(e[r])===bt(t[r]))}function bt(e){const t=k(e);if(t!==null)return`variable:${t}`;const r=be(e);return r===void 0?"":r===null?"value:null":r instanceof Date?`value:date:${r.getTime()}`:`value:${typeof r}:${r}`}var ar=["stack","dodge","identity","fill"],ir=["solid","dashed","dotted"],N={line:{solid:[],dashed:[4,2],dotted:[1,1]},rule:{solid:[],dashed:[2,3],dotted:[0,2]},gridLine:{solid:[],dashed:[2,3],dotted:[1,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]}},ta=e=>ir.includes(e);function ue(e){return e==="stack"||e==="fill"}var ke="en-GB",rt=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}},ce=class extends rt{constructor(e){super(e),this.kind="user-input"}},R=class extends rt{constructor(e){super({...e,code:e.code??"INTERNAL_INVARIANT"}),this.kind="internal"}},nt=e=>e.type==="lookup",or=e=>e.type==="text",fe=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",sr=e=>e.type==="decimal"||e.type==="integer"||e.type==="percentage"||e.type==="duration"||e.type==="currency",ra=e=>e.type==="currency",na=e=>e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range",lr=e=>{if(nt(e))return lr(e.fallback);if(fe(e))return"temporal";if(sr(e))return"numeric";if(or(e))return"categorical";throw new R({message:`No data type found for value format: ${e.type}`})},aa=e=>nt(e)?e.fallback:e,ur=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}},cr={k:1e3,m:1e6,b:1e9,t:1e12},at=["k","m","b","t"],ia=new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${at.join("|")})?$`,"i"),oa=/^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/,re=e=>e===null||e instanceof Date||Array.isArray(e)||typeof e=="boolean"?!1:typeof e=="string"?ia.test(e)&&!Number.isNaN(Number(e.replace(new RegExp(`[,${at.join("")}]`,"gi"),""))):Number.isFinite(Number(e)),dr=e=>re(e)?!0:typeof e=="string"?oa.test(e):!1,sa=/^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/,la=/^\s*(1[89]\d{2}|2[01]\d{2})\s*$/,ua=[[/\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"]],ca={"en-US":"MDY","en-GB":"DMY","pt-PT":"DMY",ar:"DMY"},fr=["/","-","."," "],vt=[["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"]],At=[["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"]],Et=[["yyyy","M","d"],["yyyy","M","dd"],["yyyy","MM","d"],["yyyy","MM","dd"],["yyyy","MMMM","d"],["yyyy","MMMM","dd"],["yyyy","MMMM","do"]],pr=[["d","MMMM"],["dd","MMMM"],["do","MMMM"],["MMMM","d"],["MMMM","dd"],["MMMM","do"]],da=[{dateFormat:"MMMM d, yyyy",type:"date"},{dateFormat:"MMMM dd, yyyy",type:"date"},{dateFormat:"MMMM do, yyyy",type:"date"},{dateFormat:"yyyy-MM",type:"month_year"}],hr=1800,gr=2199,fa=3,pa=6,ha=5,ga=1,ya=28,ma=/\s*[–—]\s*|\s-\s/,ba=e=>typeof e=="number"?Number.isInteger(e)&&e>=hr&&e<=gr:typeof e=="string"?la.test(e):!1,yr=(e,t)=>{const r=ve(e);return!t&&re(r)?Ea(r):typeof r=="string"?t?(0,v.isValid)((0,v.parse)(r,t,new Date)):!!mr(r)||De(r)&&(0,v.isValid)(new Date(r)):(0,v.isValid)(r)},ve=e=>{if(typeof e!="string")return e;let t=e;for(const[r,n]of ua)t=t.replace(r,n);return t},mr=(e,t=ke)=>{const r=ve(e);return De(r)?{type:"datetime"}:vr(t).find(n=>!fe(n)||n.type==="month"&&r.length<fa?!1:n.dateFormat&&(0,v.isValid)((0,v.parse)(r,n.dateFormat,new Date)))},De=e=>sa.test(e.trim()),br=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},va=(e,t=ke)=>{const[r,n]=e.split(ma);if(!r||!n)return;const a=ve(r).trim(),i=ve(n).trim();return Aa(t).find(o=>{if(!fe(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 ur,c=u.incrementYearIfNeeded(s),p=u.incrementYearIfNeeded(l),d=(0,v.differenceInDays)(p,c);return(0,v.isWithinInterval)(new Date(c.getFullYear(),ga,ya),{start:c,end:p})&&d===ha?!0:d===pa})},vr=e=>{const t={date:Ar(e),year:[["yyyy"]],day_month:pr,month_year:[["MMMM","yyyy"],["yyyy","MMMM"]],month:[["MMMM"]],quarter:[["QQQ","yyyy"],["yyyy","QQQ"]]};return[...da,...Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>fr.map(i=>({dateFormat:a.join(i),type:r}))))]},Ar=e=>ca[e]==="MDY"?[...At,...vt,...Et]:[...vt,...At,...Et],Aa=e=>{const t={weekly_date_range:pr,weekly_date_range_with_year:Ar(e)};return Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>fr.map(i=>({dateFormat:a.join(i),type:r}))))},Ea=e=>{const t=Number(e);if(!(0,Je.isInteger)(t))return!1;const r=new Date(t),n=new Date(t*1e3),a=i=>(0,v.isValid)(i)&&i.getFullYear()>=hr&&i.getFullYear()<=gr;return a(r)||a(n)},Er={$:"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"},Tr=e=>{if(typeof e=="string"){const t=Or(e);return t.length?re(t):!1}return re(e)},Ta=e=>{const t=Pr(e),r=t?Er[t]:void 0;if(!r)throw new R({message:"Could not get currency ISO"});return r},Or=e=>{const t=Pr(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 re(r)?r.split(",").join(""):""},Pr=e=>Object.keys(Er).sort((t,r)=>r.length-t.length).find(t=>e.includes(t)),Sr=e=>{const t=Object.entries(e);return!t.length||!t.some(([,r])=>!de(r))},de=e=>typeof e=="string"&&e.trim()===""||e===void 0||e===null||e==="-",Oa=/\s*[–—]\s*|\s-\s/,_r=(e,t,r)=>{if(de(e))return null;switch(t.type){case"decimal":case"integer":case"duration":return xr(e);case"percentage":return Pa(e);case"currency":return Sa(e);case"datetime":case"date":case"year":case"month_year":case"month":case"day_month":case"quarter":case"time":return Mr(e,t.dateFormat,r);case"weekly_date_range":case"weekly_date_range_with_year":return _a(e,t.dateFormat,r);case"text":return Ma(e);case"lookup":throw new R({message:"Cannot parse: lookup value formats are produced by transforms, not raw input"});default:throw new R({message:`Unhandled value format: ${t.type}`})}},Mr=(e,t,r)=>{if(e instanceof Date)return(0,v.isValid)(e)?e:null;const n=ve(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)?je(o):null}for(const o of vr(r)){if(!fe(o)||!o.dateFormat)continue;const s=(0,v.parse)(n,o.dateFormat,a);if((0,v.isValid)(s))return je(s)}const i=new Date(n);return yr(i)?De(n)?i:je(i):null},xr=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;let t=e.trim();if(!re(t))return null;let r=1;for(const n of at)if(new RegExp(`${n}$`,"i").test(t)){r=cr[n],t=t.slice(0,-1);break}return Number(t.split(",").join(""))*r},Pa=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;const t=e.trim();if(!dr(t))return null;const r=Number(t.replace(/%/g,"").replace(/,/g,""))/100;return Number.isNaN(r)?null:r},Sa=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;const t=e.trim();return Tr(t)?xr(Or(t)):null},_a=(e,t,r)=>{const n=String(e).trim().split(Oa),[a,i]=[n[0]?.trim(),n[1]?.trim()];return!a||!i?null:Mr(a,t,r)},Ma=e=>String(e).trim(),je=e=>new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),Lr=(e,t,r)=>{if(t.type==="text"&&typeof e=="string")return e;const n=_r(e,t,r);return n!==null||!fe(t)?n:br(e)},Q=process.env.NODE_ENV!=="production";var Ie=!0,xa=e=>{Ie=e},La=()=>Ie,Ra=()=>{let e=null;const t={hits:0,misses:0};return Object.assign((n,a)=>{if(!Ie)return Q&&(t.misses+=1),a();if(e&&wr(e.args,n))return Q&&(t.hits+=1),e.out;Q&&(t.misses+=1);const i=a();return e={args:n,out:i},i},{stats:t,reset:()=>{e=null}})},Rr=()=>{const e=new WeakMap,t={hits:0,misses:0};return Object.assign((n,a,i)=>{if(!Ie)return Q&&(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&&wr(u.args,a))return Q&&(t.hits+=1),l>0&&(o.splice(l,1),o.unshift(u)),u.out}Q&&(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})},wa=(...e)=>e.reduce((t,r)=>({hits:t.hits+r.hits,misses:t.misses+r.misses}),{hits:0,misses:0}),wr=(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},kr=class{constructor(){this.memo=Rr(),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}},we=e=>(Array.isArray(e)?e:[e]).map(t=>t instanceof Date?t.toISOString():String(t??"<null>")).join("\0"),ka=(e,t)=>e===t?!0:Le(e)&&Le(t)?e.getTime()===t.getTime():!1,Ce=(e,t)=>e>=0&&e<=1&&t>=0&&t<=1,Da=new Set(["count","sum","mean","median"]);function Dr(e,t){return Da.has(e)?"numeric":t}function Ir(e,t,r,n){if(n!==void 0&&n.type!=="numeric"&&(e==="sum"||e==="mean"||e==="median"))throw new ce({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=Ve(t,r,l);Be(u)&&s.push(u)}return s.length===0?null:e==="median"?Fa(s):Na(s)}if(e==="sum"||e==="mean"){let s=0,l=0;for(let u=0;u<a;u++){const c=Ve(t,r,u);Be(c)&&(s++,l+=Number(c))}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=Ve(t,r,s);Be(l)&&(o===null||Ia(l,o)===i)&&(o=l)}return o}var Ve=(e,t,r)=>e[t?.[r]??r]??null,Be=e=>e!==null&&!(typeof e=="number"&&Number.isNaN(e)),Ia=(e,t)=>e===null||t===null?0:e<t?-1:e>t?1:0,Ca=e=>e instanceof Date?e.getTime():e??null;function Fa(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 Na(e){const t=new Map;for(const a of e){const i=Ca(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 ja=e=>e==null||typeof e=="number"&&Number.isNaN(e),Va=e=>e instanceof Date?e.getTime():e??null,He=class z{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 z(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 z(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 z(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 z(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 z(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++)(ja(n[s])?a:i).push(s);const o=r==="asc"?1:-1;return i.sort((s,l)=>{const u=n[s],c=n[l];return u<c?-o:u>c?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=Va(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(d=>!t.includes(d)),i=this.rowCount*t.length,o=a.map(d=>({name:d,source:this.values(d)??[],repeated:new Array(i)})),s=t.map(d=>this.values(d)??[]),l=new Array(i),u=new Array(i);let c=0;for(let d=0;d<this.rowCount;d++)for(let h=0;h<t.length;h++,c++){for(const y of o)y.repeated[c]=y.source[d]??null;l[c]=t[h]??"",u[c]=s[h]?.[d]??null}const p=new Map;for(const{name:d,repeated:h}of o)p.set(d,h);return p.set(r,l),p.set(n,u),new z([...a,r,n],p,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 z(this.names,new Map(this.columns),this.rowCount)}};var Cr="value",me={numeric:{type:"decimal"},categorical:{type:"text"},temporal:{type:"datetime"}},Tt={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},Ot=e=>e===null?null:e instanceof Date?e.getTime():new Date(e).getTime(),Fr=(e,t)=>e==="count"?{type:"integer"}:t,Nr=(e,t,r)=>{const n=e.values(t);if(n!==void 0)return n;if(r==="count")return new Array(e.rowCount);throw new R({message:`Variable '${t}' not defined`})},ee=class L{constructor(t={}){const{table:r,variableMetadata:n}=this.parseVariableMap(t);this.table=r,this.variableMetadata=n}static fromTrusted(t,r){const n=Object.create(L.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 R({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 L.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 L.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 R({message:`Variable ${t} not defined`});const a=this.table.rename(t,r),{[t]:i,...o}=this.variableMetadata,s={...o,[r]:n};return L.fromTrusted(a,s)}selectVariables(...t){const r=this.table.select(t),n=Object.fromEntries(Object.entries(this.variableMetadata).filter(([a])=>t.includes(a)));return L.fromTrusted(r,n)}getType(t){const r=this.variableMetadata[t];if(!r)throw new R({message:`Variable ${t} not defined`});return r.type}getValueFormat(t){const r=this.variableMetadata[t];if(!r)throw new R({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 R({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 R({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=Tt[r],i=this.table.values(t)??[],o=[];for(let s=0;s<i.length;s++)a(i[s]??null,n)&&o.push(s);return L.fromTrusted(this.table.take(o),this.variableMetadata)}filterByMask(t){if(t.length!==this.size())throw new R({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 L.fromTrusted(this.table.take(r),this.variableMetadata)}take(t){return L.fromTrusted(this.table.take(t),this.variableMetadata)}orderBy(t,r="asc"){const n=this.table.take(this.table.sortedIndices(t,r));return L.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 Ba(t,this.table,this.variableMetadata)}rollup(t){const r=He.from(Object.fromEntries(Object.entries(t).map(([a,{variableName:i,aggregation:o}])=>[a,[Ir(o,Nr(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??me[l];n[a]={type:Dr(o,l),valueFormat:Fr(o,u)}}return L.fromTrusted(r,n)}reshapeFromWideToLong({keep:t,reshape:r,keyName:n="key",valueName:a=Cr}={}){const{numeric:i,categorical:o,temporal:s}=this.groupVariableNamesByType(),l=t??[...o,...s],u=r??i.filter(d=>!l.includes(d));if(l.includes(n)||l.includes(a))throw new ce({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 d={};for(const h of l){const y=this.variableMetadata[h];y&&(d[h]={type:y.type,values:[],valueFormat:y.valueFormat})}return d[n]={type:"categorical",values:[],valueFormat:{type:"text"}},d[a]={type:"numeric",values:[],valueFormat:{type:"decimal"}},new L(d)}if(u.filter(d=>this.variableMetadata[d]?.type!=="numeric").length>0)throw new ce({code:"INVALID_DATA_SHAPE",message:"Only numeric variables can be reshaped"});const c=this.table.select([...l,...u]).fold(u,n,a),p={};for(const d of l){const h=this.variableMetadata[d];h&&(p[d]=h)}return p[n]={type:"categorical",valueFormat:{type:"text"}},p[a]={type:"numeric",valueFormat:Wa(this.variableMetadata,u,n)},L.fromTrusted(c,p)}print(){console.table(this.variableMetadata),console.table([...this.table])}[Symbol.iterator](){return this.table[Symbol.iterator]()}filterByTimestamp(t,r,n){const a=Tt[r],i=Lr(n,this.getValueFormat(t),ke),o=Ot(i??n),s=this.getValues(t,{type:"temporal"}),l=[];for(let u=0;u<s.length;u++)a(Ot(s[u]??null),o)&&l.push(u);return L.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:me[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??me[i]};return{table:He.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 R({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}},Ba=class{constructor(e,t,r){this.groupedBy=e,this.table=t,this.variableMetadata=r}forEach(e){this.table.partition(this.groupedBy).forEach(({key:t,indices:r},n)=>{e(ee.fromTrusted(this.table.take(r),this.variableMetadata),t,n)})}rollup(e){const t=this.table.partition(this.groupedBy),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??me[o]}]}));for(const[a,{variableName:i,aggregation:o}]of Object.entries(e)){const s=Nr(this.table,i,o),l=this.variableMetadata[i],u=l?.type??"numeric";r[a]=t.map(({indices:p})=>Ir(o,s,p,{type:u,variableName:i}));const c=l?.valueFormat??me[u];n[a]={type:Dr(o,u),valueFormat:Fr(o,c)}}return ee.fromTrusted(He.from(r),n)}};function Wa(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 ce({code:"INVALID_DATA_SHAPE",message:"Cannot reshape: a source column has a lookup format and lookups cannot nest"});if(i.every(s=>(0,Je.isEqual)(s,a))||a.type==="lookup")return a;const o={};for(const[s,l]of t.entries()){const u=we([l]),c=n[s];c&&c.type!=="lookup"&&(o[u]=c)}return{type:"lookup",byVariable:r,cases:o,fallback:a}}var it=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 ce({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)}},Ua=(e,t)=>{const r=typeof e=="string"?e.trim():e;if(re(r))return{type:"decimal"};const n=typeof r=="string"&&mr(r,t);if(n)return n;const a=typeof r=="string"&&va(r,t);return a||(yr(e)?{type:"date"}:dr(e)?{type:"percentage"}:Tr(e)&&typeof e=="string"?{type:"currency",iso:Ta(e)}:{type:"text"})},Ya={type:"year",dateFormat:"yyyy"},Ga={type:"text"},jr=e=>{const t=e._metadata?.parsingLocale??"en-GB",r={},n=Xa(e),a=Ha(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(de(l)&&i)continue;const u=s.valueFormat??(de(l)?Ga:o===a?Ya:Ua(l,t)),c=lr(u);r[s.key]=Ka(s.key,e.rows,u,c,t)}return new ee(r)},za=class extends kr{dependencies(e){return[e]}run(e){return jr(e)}},Ha=e=>{if(e.columns.some(r=>r.valueFormat?.type==="year"))return-1;const t=$a(e.rows,5);return e.columns.findIndex(r=>{if(r.valueFormat)return!1;const n=t.map(a=>a[r.key]).filter(a=>!de(a));return n.length>=2&&n.every(ba)})},Ka=(e,t,r,n,a)=>({type:n,values:t.reduce((i,o)=>(Sr(o)||i.push(_r(o[e],r,a)),i),[]),valueFormat:r}),Xa=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];de(i)||(t.set(a,i),r.delete(a))}if(r.size===0)break}return t},$a=(e,t)=>{const r=[];for(const n of e)if(Sr(n)||r.push(n),r.length===t)return r;return r},qa=["x","y"],Vr=new Set(["x","y","ySecondary"]),ot=new Set(["color","size","alpha","strokeWidth","lineType"]),Br=e=>Vr.has(e),Wr=e=>ot.has(e),Ja=e=>Br(e)||Wr(e);function Ur(e){return e==="secondary"?"ySecondary":"y"}function Za(e,t){return e==="y"?Ur(t):"x"}function Qa(e){return e==="ySecondary"?"y":e}var Yr=(e,t)=>{if(le(t.group)){const a=k(t.group);if(a!==null)return[a]}const r=new Set([k(t.x),k(t.y)].filter(le)),n=new Set;for(const a of ot){const i=k(t[a]);le(i)&&(r.has(i)||e.hasVariable(i)&&e.getType(i)==="categorical"&&n.add(i))}return[...n]},st=(e,t)=>e.hasVariable(Re.group)?e.getValues(Re.group,{distinct:!0,skipNulls:!0}).length>1:Yr(e,t).some(r=>e.getValues(r,{distinct:!0,skipNulls:!0}).length>1),lt=["none","xs","sm","md","lg","xl","full"],ei={point:ti,line:ri,area:ni,bar:ai,rule:ii,tile:oi},Gr=e=>typeof e=="string"&<.includes(e);function ae(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,dataLabels:t.dataLabels}}function ti(e={}){return ae("point",e)}function ri(e={}){return ae("line",e)}function ni(e={}){return ae("area",e)}function ai(e={}){return ae("bar",e)}function ii(e={}){return ae("rule",e)}function oi(e={}){return ae("tile",e)}var zr=["diagonal","dots","crosshatch"],Hr=["tile","stretch"],ut=e=>typeof e=="object"&&e!==null&&"gradient"in e,ct=e=>typeof e=="object"&&e!==null&&"pattern"in e,Kr=e=>typeof e=="object"&&e!==null&&"image"in e,Fe=e=>typeof e!="object"?e:ut(e)?e.stops[0]?.color??"transparent":ct(e)?e.color:e.fallback,si=e=>typeof e=="string"?e:JSON.stringify(e),li=["topLeft","topRight","bottomRight","bottomLeft"],ui=["dimmed","hovered"],ci=["normal","italic","oblique"],di=["none","uppercase","lowercase","capitalize"],fi=["none","underline","line-through"],pi=["butt","round","square"],hi=["miter","round","bevel"],gi=["normal","multiply","screen","overlay","darken","lighten"],yi=["circle","square","diamond","triangle","cross","star","wye"],mi=["fill","stroke","alpha","saturation","blur","brightness","contrast","cornerRadius","strokeWidth","dashArray","lineCap","lineJoin","strokeAlpha","fillAlpha","size","symbol","fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","textDecoration","textOutlineColor","textOutlineWidth","lineHeight","textScale","textColor","offset","gap","length","paddingInline","paddingBlock","padding","margin","shadow","blendMode"],Pt=1,St=1e3,_t="'none' or a shadow object { offsetX, offsetY, blur, color }",Mt="a non-negative number of pixels, or an object of those per edge",bi="a non-empty color string, a { light, dark } pair, or a token(...) reference",vi=["top","right","bottom","left"],Se="a color, a { gradient, stops } object, a { pattern, color } object, or an { image, fallback } object",xt="a number of pixels, or { topLeft, topRight, bottomRight, bottomLeft } in pixels",Te=e=>typeof e=="object"&&e!==null&&typeof e.light=="string"&&typeof e.dark=="string",dt=e=>typeof e=="object"&&e!==null&&typeof e.token=="string",Xr=e=>typeof e=="string"?e.trim().length>0:Te(e)&&e.light.trim().length>0&&e.dark.trim().length>0;function f(e){return{token:e}}var Ke=(e,t)=>{if(typeof e!="object"||e===null)return e;if(Te(e))return e[t];if(Array.isArray(e)){if(e.every(a=>typeof a=="number"))return e;const n=e.map(a=>Ke(a,t));return n.every((a,i)=>a===e[i])?e:n}const r=Object.entries(e).map(([n,a])=>[n,Ke(a,t)]);return r.every(([n,a])=>a===e[n])?e:Object.fromEntries(r)},O=e=>typeof e=="number"&&Number.isFinite(e),g=(e,t)=>({status:"rejected",expected:e,actual:t}),q=e=>{const t=`one of ${e.map(r=>`'${String(r)}'`).join(", ")}`;return r=>e.includes(r)?{status:"accepted",value:r}:g(t,r)},Z=(e,t)=>{if(typeof e=="string")return e.trim().length>0?{status:"accepted",value:e}:g("a non-empty color string",e);if(dt(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 Te(e)&&e.light.trim().length>0&&e.dark.trim().length>0?{status:"accepted",value:{light:e.light,dark:e.dark}}:g(bi,e)},Ai=(e,t)=>{if(typeof e!="object"||e===null||Te(e)||dt(e))return Z(e,t);const r=e;if(ut(r)){const n=r.gradient;if(n!=="linear"&&n!=="radial")return g(Se,e);if(!Array.isArray(r.stops)||r.stops.length<2)return g("a gradient with at least two stops",e);const a=[];for(const i of r.stops){if(!O(i.offset)||i.offset<0||i.offset>1)return g("a gradient stop offset in [0, 1]",e);const o=Z(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&&!O(r.angle)?g("a gradient angle in degrees",e):{status:"accepted",value:{gradient:"linear",...r.angle===void 0?{}:{angle:r.angle},stops:a}}}if(ct(r)){if(!zr.includes(r.pattern))return g(Se,e);const n=Z(r.color,t);if(n.status!=="accepted")return n;const a={pattern:r.pattern,color:n.value};if(r.background!==void 0){const i=Z(r.background,t);if(i.status!=="accepted")return i;a.background=i.value}if(r.size!==void 0){if(!O(r.size)||r.size<=0)return g("a pattern size in pixels",e);a.size=r.size}return{status:"accepted",value:a}}if(Kr(r)){if(typeof r.image!="string"||!r.image.startsWith("data:image/"))return g("an image as a data:image URI",e);if(r.fit!==void 0&&!Hr.includes(r.fit))return g(Se,e);if(r.alpha!==void 0&&(!O(r.alpha)||r.alpha<0||r.alpha>1))return g("an image alpha in [0, 1]",e);if(r.size!==void 0&&(!O(r.size)||r.size<=0))return g("an image size in pixels",e);const n=Z(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 g(Se,e)},Lt=e=>{if(O(e)&&e>=0)return{status:"accepted",value:{top:e,right:e,bottom:e,left:e}};if(typeof e!="object"||e===null)return g(Mt,e);const t=e,r={};for(const n of vi){const a=t[n];if(a!==void 0){if(!O(a)||a<0)return g(Mt,e);r[n]=a}}return{status:"accepted",value:r}},Ei=e=>{if(O(e)&&e>=0)return{status:"accepted",value:e};if(typeof e!="object"||e===null)return g(xt,e);const t=e,r={};for(const n of li){const a=t[n];if(!O(a)||a<0)return g(xt,e);r[n]=a}return{status:"accepted",value:r}},Ti={color:Z,paint:Ai,unitInterval:e=>O(e)&&e>=0&&e<=1?{status:"accepted",value:e}:g("a number in [0, 1]",e),pixels:e=>O(e)&&e>=0?{status:"accepted",value:e}:g("a non-negative number of pixels",e),barRadius:e=>Gr(e)||O(e)&&e>=0?{status:"accepted",value:e}:g(`a number of pixels or one of ${lt.map(t=>`'${t}'`).join(", ")}`,e),dashArray:e=>Array.isArray(e)&&e.every(t=>O(t)&&t>=0)?{status:"accepted",value:[...e]}:g("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}:g("a non-empty CSS font-family list",e),fontWeight:e=>O(e)&&e>=Pt&&e<=St?{status:"accepted",value:e}:g(`a number in [${Pt}, ${St}]`,e),multiplier:e=>O(e)&&e>=0?{status:"accepted",value:e}:g("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 g(_t,e);const r=e;if(!O(r.offsetX)||!O(r.offsetY)||!O(r.blur)||r.blur<0)return g(_t,e);const n=Z(r.color,t);return n.status!=="accepted"?n:{status:"accepted",value:{offsetX:r.offsetX,offsetY:r.offsetY,blur:r.blur,color:n.value}}},padding:Lt,margin:Lt,blendMode:q(gi),signedPixels:e=>O(e)?{status:"accepted",value:e}:g("a number of pixels, negative allowed",e),fontStyle:q(ci),textTransform:q(di),textDecoration:q(fi),lineCap:q(pi),lineJoin:q(hi),pointSymbol:q(yi),boxRadius:Ei},$r=["kind","edge","axis","role","position","part"],Oi="#B84737",qr=.4,Pi="sm",Si=2,_i=8,Mi=12,xi=Object.freeze({light:"#F5F1E9",dark:"#1F1E1C"}),Li="#ffffff",Ri=1,wi=24,ki={top:24,right:24,bottom:24,left:24},V={stroke:"color",strokeWidth:"pixels",dashArray:"dashArray"},E={fontFamily:"fontFamily",fontSize:"pixels",fontWeight:"fontWeight",fontStyle:"fontStyle",letterSpacing:"signedPixels",textTransform:"textTransform",textDecoration:"textDecoration",textOutlineColor:"color",textOutlineWidth:"pixels",lineHeight:"multiplier",textColor:"color"},B={...E,paddingInline:"pixels",paddingBlock:"pixels",fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius"},Di={offsetX:0,offsetY:2,blur:4,color:"rgba(14, 14, 52, 0.12)"},Ii={offsetX:0,offsetY:4,blur:6,color:"rgba(14, 14, 52, 0.16)"},Xe=["where","state","layer"],Jr={fill:"paint",stroke:"color",alpha:"unitInterval",fillAlpha:"unitInterval",strokeAlpha:"unitInterval",saturation:"multiplier",blur:"pixels",brightness:"multiplier",contrast:"multiplier",shadow:"shadow",blendMode:"blendMode"},Ci=.3,Fi=10,Ni=1.5,ji=24,Vi=8,_={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}},We={stroke:f("gridLine"),strokeWidth:1},Rt={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)"}},wt={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)"}},kt={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)"}},Ue={...V,length:"pixels"},ie={...E,margin:"margin"},oe={...E,offset:"pixels",margin:"margin"},se={gap:"pixels",margin:"margin"},Ye={stroke:"color",strokeWidth:"pixels",offset:"pixels",cornerRadius:"pixels"},Dt={fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius",paddingInline:"pixels",paddingBlock:"pixels",shadow:"shadow"},Zr=new Map;var Bi=(e=Object.values(Ne))=>{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]},Wi=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},Ui=e=>Zr.get(Qr(e)),It=(e,t)=>({x:{select:{target:e,axis:"x"},vocabulary:t},y:{select:{target:e,axis:"y"},vocabulary:t}}),Ct=e=>({select:{target:"dataLabel",role:e},vocabulary:B,children:{inside:{select:{target:"dataLabel",role:e,position:"inside"},vocabulary:B,rest:{textColor:"#FFFFFF"}},outside:{select:{target:"dataLabel",role:e,position:"outside"},vocabulary:B,rest:{..._.dataLabelOutside}}}}),Ne={geom:{select:{target:"geom"},vocabulary:Jr,options:Xe,aesthetics:{fill:"color",stroke:"color",alpha:"alpha"},rest:{alpha:1,strokeAlpha:1,shadow:"none",blendMode:"normal"},dimmed:{alpha:qr},hovered:{shadow:Di},acceptsUnknownKinds:!0},panelBorder:{select:{target:"panelBorder"},vocabulary:{...V,cornerRadius:"pixels"},rest:{...We,dashArray:N.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:{...We,dashArray:N.gridLine.dashed,strokeWidth:0}},y:{select:{target:"gridLine",axis:"y"},vocabulary:V,rest:{...We,dashArray:N.gridLine.dashed}}}},tickLine:{select:{target:"tickLine"},vocabulary:Ue,rest:{strokeWidth:0,length:0},children:{x:{select:{target:"tickLine",axis:"x"},vocabulary:Ue},y:{select:{target:"tickLine",axis:"y"},vocabulary:Ue}}},axisLabel:{select:{target:"axisLabel"},vocabulary:ie,rest:{..._.label,textColor:f("textPrimary")},children:{...It("axisLabel",ie),top:{select:{target:"axisLabel",edge:"top"},vocabulary:ie,rest:{margin:{bottom:8}}},bottom:{select:{target:"axisLabel",edge:"bottom"},vocabulary:ie,rest:{margin:{top:4,bottom:16}}},left:{select:{target:"axisLabel",edge:"left"},vocabulary:ie},right:{select:{target:"axisLabel",edge:"right"},vocabulary:ie}}},tickLabel:{select:{target:"tickLabel"},vocabulary:oe,rest:{..._.label,textColor:f("textSecondary"),offset:Fi,textOutlineColor:f("graphBackground"),textOutlineWidth:Ni},children:{...It("tickLabel",oe),top:{select:{target:"tickLabel",edge:"top"},vocabulary:oe},bottom:{select:{target:"tickLabel",edge:"bottom"},vocabulary:oe},left:{select:{target:"tickLabel",edge:"left"},vocabulary:oe,rest:{offset:14}},right:{select:{target:"tickLabel",edge:"right"},vocabulary:oe,rest:{offset:14}}}},dataLabel:{select:{target:"dataLabel"},vocabulary:B,rest:{..._.label,textColor:f("textPrimary"),paddingInline:6,paddingBlock:2,cornerRadius:4},children:{aggregate:{select:{target:"dataLabel",role:"aggregate"},vocabulary:B,rest:{..._.dataLabelOutside}},observation:Ct("observation"),category:Ct("category")}},graph:{select:{target:"graph"},vocabulary:{fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"pixels",fontFamily:"fontFamily",fontSize:"pixels",fontWeight:"fontWeight",lineHeight:"multiplier",textColor:"color",textScale:"multiplier",padding:"padding",blendMode:"blendMode"},rest:{fill:f("graphBackground"),strokeWidth:1,stroke:f("graphBorder"),cornerRadius:8,textScale:1,padding:24,blendMode:"normal"}},heading:{select:{target:"heading"},vocabulary:E,rest:{textColor:f("textPrimary")},partWildcard:!0,children:{h1:{select:{target:"heading",part:"h1"},vocabulary:E,rest:{..._.heading}},h2:{select:{target:"heading",part:"h2"},vocabulary:E,rest:{..._.subtitle}}}},caption:{select:{target:"caption"},vocabulary:E,rest:{..._.caption,textColor:f("textPrimary")}},source:{select:{target:"source"},vocabulary:E,rest:{..._.source,textColor:f("textSecondary")},children:{link:{select:{target:"source",part:"link"},vocabulary:E,rest:{..._.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:Ye,rest:{strokeWidth:2,offset:2,cornerRadius:3},partWildcard:!0,children:{hover:{select:{target:"editOutline",part:"hover"},vocabulary:Ye,rest:{stroke:f("editOutlineHover")}},selected:{select:{target:"editOutline",part:"selected"},vocabulary:Ye,rest:{stroke:f("editOutlineSelected")}}}},tooltip:{select:{target:"tooltip"},vocabulary:Dt,rest:Rt,children:{heading:{select:{target:"tooltip",part:"heading"},vocabulary:E,rest:{..._.tooltipHeading,textColor:f("textPrimary")}},label:{select:{target:"tooltip",part:"label"},vocabulary:E,rest:{..._.tooltipRow,textColor:f("textPrimary")}},value:{select:{target:"tooltip",part:"value"},vocabulary:E,rest:{..._.tooltipRow,textColor:f("textSecondary")}},primaryRow:{select:{target:"tooltip",part:"primaryRow"},vocabulary:{fill:"paint"},rest:{fill:f("tooltipPrimaryRow")}}}},headline:{select:{target:"headline"},vocabulary:se,rest:{gap:ji,margin:{bottom:4}}},headlineItem:{select:{target:"headlineItem"},vocabulary:{},children:{number:{select:{target:"headlineItem",part:"number"},vocabulary:E,rest:{fontSize:26,fontWeight:700,lineHeight:1.3,textColor:f("textPrimary")},children:{center:{select:{target:"headlineItem",part:"numberCenter"},vocabulary:E}}},caption:{select:{target:"headlineItem",part:"caption"},vocabulary:E,rest:{fontSize:12,textColor:f("textSecondary")}},label:{select:{target:"headlineItem",part:"label"},vocabulary:E,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:E,rest:{fontSize:12},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:se,rest:{gap:Vi},children:{popover:{select:{target:"legend",part:"popover"},vocabulary:Dt,rest:Rt},top:{select:{target:"legend",edge:"top"},vocabulary:se,rest:{margin:{bottom:8}}},bottom:{select:{target:"legend",edge:"bottom"},vocabulary:se,rest:{margin:{top:16,bottom:10}}},left:{select:{target:"legend",edge:"left"},vocabulary:se,rest:{margin:{right:10}}},right:{select:{target:"legend",edge:"right"},vocabulary:se,rest:{margin:{left:10}}}}},legendItem:{select:{target:"legendItem"},vocabulary:{...E,paddingInline:"pixels",paddingBlock:"pixels",fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius"},rest:{..._.label,textColor:f("textSecondary"),strokeWidth:0,paddingInline:2,paddingBlock:4},children:{swatch:{select:{target:"legendItem",part:"swatch"},vocabulary:{size:"pixels",strokeWidth:"pixels"},rest:{size:12,strokeWidth:2}}}},directLabel:{select:{target:"directLabel"},vocabulary:{...E,stroke:"color",strokeWidth:"pixels",dashArray:"dashArray"},rest:{fontSize:12,fontWeight:500,lineHeight:1.3,textColor:f("textPrimary"),strokeWidth:1,dashArray:N.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:N.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:B,options:["annotation"],rest:{..._.label,textColor:f("textPrimary"),fill:f("differenceLabelBackground"),strokeWidth:1,cornerRadius:4,paddingInline:6,paddingBlock:3}}}},text:{select:{target:"annotation",kind:"text"},vocabulary:{...B,alpha:"unitInterval",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"},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:wt,children:{label:{select:{target:"annotation",kind:"pinnedNumber",part:"label"},vocabulary:{...B,shadow:"shadow"},options:["annotation"],rest:kt}}},comment:{select:{target:"annotation",kind:"comment"},vocabulary:{fill:"paint",size:"pixels",stroke:"color",strokeWidth:"pixels",shadow:"shadow"},options:["annotation"],rest:wt,children:{label:{select:{target:"annotation",kind:"comment",part:"label"},vocabulary:{...B,shadow:"shadow"},options:["annotation"],rest:kt}}}}}},Qr=e=>{let t=e.target;for(const r of $r){const n=e[r];n!==void 0&&(t+=`\0${r}:${n}`)}return t},en=e=>{if(Zr.set(Qr(e.select),e),e.children!==void 0)for(const t of Object.values(e.children))en(t)};for(const e of Object.values(Ne))en(e);function Yi(e){return e}var Gi=e=>e.observation?.aesthetics??Ne.geom.aesthetics,tn=e=>e.observation?.sharedPaint===!1?{...e.observation.vocabulary}:{...Jr,...e.observation?.vocabulary},zi=(e,t)=>({select:{target:"geom",kind:e},vocabulary:tn(t),aesthetics:Gi(t),options:t.observation?.options??Xe,...Ft(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??Xe,...Ft(n)}]))}),Ft=e=>({...e?.rest===void 0?{}:{rest:e.rest},...e?.dimmed===void 0?{}:{dimmed:e.dimmed},...e?.hovered===void 0?{}:{hovered:e.hovered}}),$=class{constructor(){this.positionRoles=[],this.identityKey="x-group",this.defaultPosition="identity",this.supportedPositions=ar,this.defaultInteractive=!0,this.aesthetics=[],this.derivedVariables=[],this.highlightStrategy=null,this.supportedCoordTypes=["cartesian","flip"],this.spatialKind="points",this.grid={},this.legend={},this.dataLabelCoordTypes=[],this.isComposite=!1,this.tooltip=[],this.summaries={}}resolveParams(e){return(0,Je.merge)({},this.defaultParams,e.params)}},ft=(e,t)=>{const r=k(t.x);return!r||!["numeric","temporal"].includes(e.getType(r))?e:e.orderBy(r,"asc")},pt=(e,{coordSystem:t})=>{const r=H(e),n=U(e);return!M(r)||!M(n)?null:t.type==="polar"?J(r,n):{x:r,y:n}},Nt=.5,pe=e=>({x:0,y:0,width:e.width,height:e.height}),ht=e=>e==="panel-end"?"end":e==="panel-start"?"start":e,he=({box:e,panel:t,orientation:r,placement:n,justify:a,align:i,offset:o,alignOffset:s,labelWidth:l,labelHeight:u})=>{const c=a==="panel-start"||a==="panel-end",p=(r.valueAxis==="x"?e.height:e.width)===0,d={anchor:Ki(a,r.valueDirectionSign),placement:c?"inside":n,offset:o},h={anchor:Xi(i),placement:p?n:"inside",offset:p?s??o:0},y=c?t:e,A=r.valueAxis==="x"?y:e,x=r.valueAxis==="y"?y:e,D=r.valueAxis==="x"?d:h,j=r.valueAxis==="x"?h:d,S=Vt(D,{min:A.x,max:A.x+A.width,halfExtent:l/2}),I=Vt(j,{min:x.y,max:x.y+x.height,halfExtent:u/2});return{x:S,y:I,position:Hi(e,S,I,l,u)}},jt=(e,t,r,n)=>r-n>=e-Nt&&r+n<=t+Nt,Hi=(e,t,r,n,a)=>{if(e.width===0&&e.height===0)return"outside";const i=e.width===0||jt(e.x,e.x+e.width,t,n/2),o=e.height===0||jt(e.y,e.y+e.height,r,a/2);return i&&o?"inside":"outside"},Ki=(e,t)=>e==="center"?"center":(e==="end"||e==="panel-end")==(t===1)?"max":"min",Xi=e=>e==="center"?"center":e==="start"?"min":"max",Vt=({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},$i=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=Zi(e.layer);for(const a of e.layer.data){const i=H(a),o=G(a)??U(a);if(i===null||o===null||!Ce(i,o))continue;const s=e.formatLabel(a);if(s==="")continue;const{width:l,height:u}=e.measureDataLabel("observation","outside",s),{box:c,orientation:p}=Ji(o,Y(a),i,e.panelRect.width,e.panelRect.height),d=he({box:c,panel:pe(e.panelRect),orientation:p,...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:"outside"})}return{labels:t,droppedCount:0}},qi=e=>e.position==="fill"?"fill":ue(e.position)?"stack":"none",Ji=(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}}},Zi=e=>{const{position:t,justify:r,align:n}=e.dataLabels;return t==="auto"?{placement:"outside",justify:"end",align:"center"}:{placement:t,justify:st(e.data,e.mapping)?ht(r):r,align:n}},Qi=class extends ${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:Ci,strokeWidth:2,dashArray:N.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=qi,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=pt,this.getDataLabelPlacements=t=>$i(t)}resolveParams(e){const t=super.resolveParams(e);return t.missingValues==="gap"?{...t,missingValues:"zero"}:t}compile({data:e,mapping:t}){return e=ft(e,t),e.hasVariable(b.yMin)||(e=e.addConstantVariable(b.yMin,"numeric",0)),{data:e,mapping:{}}}},rn=.7,eo=.1,to=.03,ro=.05,nn=e=>{const t=e[et.role];return t??"solo"},gt=(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")}}},_e=6,no=.5,ao=e=>{const t=[];let r=0;const n=ue(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,styleReaders:e.styleReaders,formatLabel:e.formatLabel,isFlipped:a});for(const s of i){const l=e.layer.dataLabels.position==="auto"?uo({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}):fo(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:s.backdropColor}:{}})}}if(e.layer.dataLabels.showCategoryLabels)for(const i of po(e,n))t.push(i);if(e.layer.dataLabels.showStackTotals){const i=mo({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}},io=e=>e.position==="fill"?"fill":ue(e.position)?"stack":"absoluteGrandTotal",oo=({layer:e,mainAxis:t,panelRect:r,measureDataLabel:n,styleReaders:a,formatLabel:i,isFlipped:o})=>{const s=[];let l=!1;const u=e.dataLabels.position==="auto",c=k(e.mapping.y);for(const p of e.data){const d=on(t,p);if(d===null)continue;const h=i(p);if(h==="")continue;const y=gt(n,"observation",h),A=yt(d,r);u&&y.inside.width>A.width&&(l=!0);const x=c===null?null:p[c],D=M(x)&&x<0;s.push({isNegative:D,text:h,boxes:y,bounds:A,backdropColor:Fe(a.get("fill",p))})}return{entries:s,shouldRotate:!o&&l}},yt=(e,t)=>({x:e.x*t.width,y:e.y*t.height,width:e.width*t.width,height:e.height*t.height}),an=(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}},on=(e,t)=>{const r=K(t),n=X(t),a=Y(t),i=G(t)??U(t);return r===null||n===null||a===null||i===null?null:an(e,r,n,a,i)},so=(e,t)=>{const{xMin:r,xMax:n,yMin:a,yMax:i}=t.anchor;return an(e,r,n,a,i)},lo=(e,t)=>e==="x"?t?"bottom":"top":t?"left":"right",$e=(e,t,r)=>r?{width:t,height:e}:{width:e,height:t},uo=e=>e.isStacked?ho({bounds:e.bounds,box:e.boxes.inside,isRotated:e.shouldRotate}):yo({edge:lo(e.mainAxis,e.isNegativeBar),bounds:e.bounds,boxes:e.boxes,isRotated:e.shouldRotate,panelWidth:e.panelWidth,panelHeight:e.panelHeight,offset:e.offset}),sn=(e,t)=>e==="x"?{valueAxis:"y",valueDirectionSign:t?1:-1}:{valueAxis:"x",valueDirectionSign:t?-1:1},co=e=>e==="panel-start"||e==="panel-end",fo=(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=he({box:n.bounds,panel:a,orientation:sn(t,n.isNegative),placement:i,justify:e.justify,align:e.align,offset:e.offset,labelWidth:o.width,labelHeight:o.height});if(i==="inside"&&!co(e.justify)){const l=t==="y",u=l?n.bounds.width:n.bounds.height;return(l?o.width:o.height)>u+no?null:{x:s.x,y:s.y,isRotated:!1,position:"inside"}}return{x:s.x,y:s.y,isRotated:!1,position:s.position}},po=(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),c=k(e.layer.mapping.y);for(const p of e.layer.data){const d=on(l,p);if(d===null)continue;const h=e.formatCategory(p);if(h===null||h==="")continue;const y=gt(e.measureDataLabel,"category",h),A=y[s],x=yt(d,e.panelRect),D=c===null?null:p[c],j=M(D)&&D<0,S=he({box:x,panel:u,orientation:sn(l,j),placement:s,justify:a,align:i,offset:o,labelWidth:A.width,labelHeight:A.height}),I=y[S.position];r.push({layerId:e.layer.id,x:S.x,y:S.y,text:h,width:I.width,height:I.height,isRotated:!1,role:"category",position:S.position})}return r},ho=({bounds:e,box:t,isRotated:r})=>{const n=$e(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"}},go=(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}}},yo=({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,c=s?t.height:t.width,p=s?t.width:t.height,{edgeCoord:d,outwardSign:h,panelExtent:y}=go(e,t,a,i),A=$e(r.inside.width,r.inside.height,n),x=s?A.height:A.width,D=s?A.width:A.height,j=x+o<c,S=D<=p;if(s?j:j&&S){if(s&&!S)return null;if(n)return{x:l,y:u,isRotated:!0,position:"inside"};const Oe=d-h*(x/2+o);return{...s?{x:l,y:Oe}:{x:Oe,y:u},isRotated:!1,position:"inside"}}const I=$e(r.outside.width,r.outside.height,n),T=(s?I.height:I.width)/2,P=d+h*(T+o);return P-T<0||P+T>y?null:{...s?{x:l,y:P}:{x:P,y:u},isRotated:n,position:"outside"}},mo=({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=yt(so(t,l),r),c=a(l.total),{width:p,height:d}=n("aggregate","outside",c),h=l.anchor.direction==="positive";let y,A;s?(y=h?u.x+u.width+_e+p/2:u.x-_e-p/2,A=u.y+u.height/2):(y=u.x+u.width/2,A=h?u.y-_e-d/2:u.y+u.height+_e+d/2),i.push({layerId:e.id,x:y,y:A,text:c,width:p,height:d,isRotated:!1,role:"aggregate",position:"outside"})}return i};function ln(e){return{startAngle:e[b.xMin],endAngle:e[b.xMax]}}function un(e){return{innerRadius:e[b.yMin],outerRadius:e[b.yMax]??e[b.y]}}var bo=" · ",Ge=2,vo=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"?"inside":"outside",l=e.panelRect.width/2,u=e.panelRect.height/2,c=Math.min(e.panelRect.width,e.panelRect.height)/2,p=e.styleReaders;for(const d of e.layer.data){const{startAngle:h,endAngle:y}=ln(d),{innerRadius:A,outerRadius:x}=un(d);if(h===null||y===null||x===null)continue;const D=e.formatLabel(d);if(D==="")continue;const j=o?e.formatCategory(d):null,S=j===null?D:`${j}${bo}${D}`,I={startAngle:h,endAngle:y,midAngle:(h+y)/2,innerRadiusPx:(A??0)*c,outerRadiusPx:x*c};let T,P;if(r==="auto"){const ge=e.measureDataLabel("observation",s,S);P={width:ge.width,height:ge.height},T=Bt({wedge:I,position:s,offset:i,labelWidth:P.width,labelHeight:P.height});const Pe=l+Math.sin(T.labelAngle)*T.labelRadius,Pn=u-Math.cos(T.labelAngle)*T.labelRadius;if(T.position==="outside"&&!To({x:Pe,y:Pn,labelWidth:P.width,labelHeight:P.height,panelRect:e.panelRect})){const mt=e.measureDataLabel("observation","inside",S);P={width:mt.width,height:mt.height},T=Bt({wedge:I,position:"inside",offset:i,labelWidth:P.width,labelHeight:P.height})}}else{const ge=gt(e.measureDataLabel,"observation",S),Pe=ge[r];T=Oo({wedge:I,placement:r,justify:ht(n),align:a,offset:i,labelWidth:Pe.width,labelHeight:Pe.height}),P=ge[T.position]}const Oe=l+Math.sin(T.labelAngle)*T.labelRadius,On=u-Math.cos(T.labelAngle)*T.labelRadius;t.push({layerId:e.layer.id,x:Oe,y:On,text:S,width:P.width,height:P.height,isRotated:!1,role:"observation",position:T.position,...T.position==="inside"?{backdropColor:Fe(p.get("fill",d))}:{}})}return{labels:t,droppedCount:0}},Ao=()=>"absoluteGrandTotal",Ae=(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)},Eo=({wedge:e,labelRadius:t,labelAngle:r,labelWidth:n,labelHeight:a})=>{const i=Ae("radial",r,n,a);if(!(t-i>=e.innerRadiusPx-Ge&&t+i<=e.outerRadiusPx+Ge)||t<=0)return!1;const o=Math.abs(e.endAngle-e.startAngle)/2,s=Ae("tangential",r,n,a)/t,l=Ge/t;return Math.abs(r-e.midAngle)+s<=o+l},To=({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,Bt=({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+Ae("radial",e.midAngle,n,a),labelAngle:e.midAngle,position:"outside"},Oo=({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+Ae("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 p=e.innerRadiusPx-l;u=p>=0?p:e.innerRadiusPx+l}let c=s;if(n!=="center"&&u>0){const p=Ae("tangential",s,i,o)/u;c=s+(n==="start"?1:-1)*p}return{labelRadius:u,labelAngle:c,position:Eo({wedge:e,labelRadius:u,labelAngle:c,labelWidth:i,labelHeight:o})?"inside":"outside"}},Po=class extends ${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:Ii}}},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=>ue(t)?{justify:"center"}:{},this.resolveBandFraction=(t,r)=>qe(t,r.type),this.resolveAnchorPosition=(t,{coordSystem:r,position:n,purpose:a,align:i})=>{if(i!==void 0){const p=nr(t,r);return p===null?null:tt(p,i)}if(r.type==="polar")return So(t);const o=ue(n),s={isSolo:!o||nn(t)==="solo",isNegative:o&&_o(t),purpose:a};if(r.mainAxis==="x"){const p=K(t),d=X(t),h=Wt({lowerBound:Y(t),upperBound:G(t)??U(t),options:s});return p===null||d===null||h===null?null:{x:(p+d)/2,y:h}}const l=Y(t),u=G(t),c=Wt({lowerBound:K(t),upperBound:X(t)??H(t),options:s});return l===null||u===null||c===null?null:{x:c,y:(l+u)/2}},this.getDataLabelPlacements=t=>t.coordSystem.type==="polar"?vo(t):ao(t),this.resolvePercentageValueStrategy=(t,r)=>r==="polar"?Ao():io(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=qe(r,n);e=ft(e,t),e.hasVariable(b.yMin)||(e=e.addConstantVariable(b.yMin,"numeric",0));const i=a/2;return e=e.addConstantVariable(b.xMin,"numeric",-i).addConstantVariable(b.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}},qe=({width:e},t)=>e!==void 0?e:t==="polar"?1:rn,So=e=>{const t=K(e),r=X(e),n=Y(e),a=G(e);return t===null||r===null||n===null||a===null?null:J((t+r)/2,(n+a)/2)},_o=e=>{const t=rr(e);return M(t)&&t<0},Wt=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},Mo=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=xo(e.layer);for(const a of e.layer.data){const i=H(a),o=U(a);if(i===null||o===null||!Ce(i,o))continue;const s=e.formatLabel(a);if(s==="")continue;const{width:l,height:u}=e.measureDataLabel("observation","outside",s),c=he({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:c.x,y:c.y,text:s,width:l,height:u,isRotated:!1,role:"observation",position:c.position})}return{labels:t,droppedCount:0}},xo=e=>{const{position:t,justify:r,align:n}=e.dataLabels;return t==="auto"?{placement:"outside",justify:"end",align:"center"}:{placement:t,justify:st(e.data,e.mapping)?ht(r):r,align:n}},Lo=class extends ${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:N.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=pt,this.getDataLabelPlacements=t=>Mo(t)}compile(e){return{data:ft(e.data,e.mapping),mapping:{}}}},Ro=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=wo(e.layer),a=n.justify==="panel-start"||n.justify==="panel-end",i=e.styleReaders;for(const o of e.layer.data){const s=H(o),l=U(o);if(s===null||l===null||!Ce(s,l))continue;const u=e.formatLabel(o);if(u==="")continue;const{width:c,height:p}=e.measureDataLabel("observation","outside",u),d=i.get("size",o)/2,h=he({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+d,alignOffset:r+d,labelWidth:c,labelHeight:p});t.push({layerId:e.layer.id,x:h.x,y:h.y,text:u,width:c,height:p,isRotated:!1,role:"observation",position:h.position})}return{labels:t,droppedCount:0}},wo=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}},ko=class extends ${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=pt,this.resolveValueSource=(t,r)=>{if(r!=="label")return null;const n=k(t.size);return n!==null?{variable:n}:null},this.getDataLabelPlacements=t=>Ro(t)}compile({data:e}){return{data:e,mapping:{}}}},Do=class extends ${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:N.rule,aesthetics:{stroke:"color",strokeWidth:"strokeWidth",dashArray:"lineType"},rest:{stroke:f("ruleLine"),strokeWidth:1,dashArray:N.rule.dashed}},parts:{label:{vocabulary:E,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")||M(be(t.x)),a=r.has("y")||M(be(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=Ut(t.y,e);if(r!==null)return{data:new ee({[ye.y]:{type:"numeric",values:[r.value],valueFormat:r.sourceFormat}}),mapping:{y:ye.y,x:void 0}};const n=Ut(t.x,e);return n!==null?{data:new ee({[ye.x]:{type:"numeric",values:[n.value],valueFormat:n.sourceFormat}}),mapping:{x:ye.x,y:void 0}}:{data:new ee,mapping:{x:void 0,y:void 0}}}},Ut=(e,t)=>{const r=be(e);if(M(r))return{value:r,sourceFormat:void 0};const n=k(e);if(n===null||!zn(n)||!t.hasVariable(n))return null;const[a]=t.getValues(n);return M(a)?{value:a,sourceFormat:t.getValueFormat(n)}:null};function cn(e){return e[ne.color]}function Io(e){return e[ne.alpha]}function Co(e){return e[ne.size]}function Fo(e){return e[ne.strokeWidth]}function No(e){return e[ne.lineType]}var dn=e=>{const t=K(e),r=X(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}},fn=e=>{const t=dn(e);if(!t)return null;const r=t.width*to,n=t.height*ro;return{x:t.x+r,y:t.y+n,width:t.width-r*2,height:t.height-n*2}},pn=e=>!!cn(e),hn=e=>pn(e)?fn(e):null,Yt=4,jo=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=hn(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+Yt>l||s+Yt>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:Fe(r.get("fill",n))})}return{labels:t,droppedCount:0}},Vo=e=>{const t=k(e.color);return t!==null?{variable:t}:null},Bo=class extends ${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=Vo,this.resolveAnchorPosition=t=>{const r=K(t),n=X(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=>jo(t)}compile({data:e}){return{data:e.addConstantVariable(b.xMin,"numeric",-.5).addConstantVariable(b.xMax,"numeric",.5).addConstantVariable(b.yMin,"numeric",-.5).addConstantVariable(b.yMax,"numeric",.5),mapping:{}}}},gn=[new Po,new ko,new Lo,new Qi,new Do,new Bo],Wo=class extends it{constructor(){super("geom");for(const e of gn)this.register(e.type,e)}},yn=class{compute(e){return e.data.size()===0?{data:e.data,mapping:{}}:this.computeStat(e)}},Uo=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)}},Yo=class{constructor(){this.transformType="constant"}apply(e,t){const{options:r}=t;return e.addConstantVariable(r.variableName,r.type,r.value)}getIntroducedVariables(e){const{options:t}=e;return[t.variableName]}},Go=class{constructor(){this.transformType="filter"}apply(e,t){const{options:r}=t;return e.filter(r.variableName,r.operator,r.value)}},zo=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"]}},Ho=class{constructor(){this.transformType="sort"}apply(e,t){const{options:r}=t;return e.orderBy(r.variableName,r.direction??"asc")}},Ko=[new Uo,new Yo,new Go,new zo,new Ho],Xo=class extends it{constructor(){super("transform");for(const e of Ko)this.register(e.transformType,e)}};function mn(e){if("definition"in e)return e.definition;if(bn(e)||vn(e)||An(e))return e}function $o(e){const t=[],r=[],n=[];for(const a of e){const i=mn(a);i&&(bn(i)?t.push(i):vn(i)?r.push(i):An(i)&&n.push(i))}return{geoms:t,stats:r,transforms:n,warnings:[...ze("geom",t,a=>a.type),...ze("stat",r,a=>a.type),...ze("transform",n,a=>a.transformType),...qo(t),...Jo(t)]}}function qo(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 Jo(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 ze(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 bn=e=>e instanceof $,vn=e=>e instanceof yn,An=e=>"transformType"in e&&typeof e.apply=="function",Zo=["brick","gray","red","orange","yellow","green","cyan","blue","purple","pink"],Qo=["cyan","pink","purple","red","orange","yellow","green","blue"],En=["#B84737","#BA7420","#0B8666","#3D63A8","#DD9583","#E2BF6B","#95CBA6","#AABCE5"],Tn="brick",F={red:"#E83562",orange:"#F38650",yellow:"#FBBC30",green:"#31FCB4",cyan:"#40F8FF",blue:"#279EFF",purple:"#B399FD",dark_purple:"#6D48D2",plum:"#C82184",pink:"#FC8497"},es=[F.purple,F.pink,F.yellow,F.blue,F.red,F.cyan,F.orange,F.plum,F.green,F.dark_purple],C={green:"#B2DDC9",cyan:"#A2D5E2",blue:"#AAC4FF",purple:"#B2A4FF",plum:"#DCA8C7",pink:"#FFCCD3",red:"#FFADAD",orange:"#FFDEB4",yellow:"#FDF7C3"},ts=[C.green,C.purple,C.red,C.cyan,C.pink,C.blue,C.orange,C.plum,C.yellow],Ee={brick900:"#6E0500",brick800:"#881D11",brick700:"#A03522",brick600:"#B0523B",brick500:"#C06D56",brick400:"#CE8772",brick300:"#DBA28E",brick200:"#E7BDAC",brick100:"#F2D8CB",brick50:"#FCF4EA",gray900:"#1c1917",gray800:"#292524",gray700:"#44403c",gray600:"#57534e",gray500:"#78716c",gray400:"#a8a29e",gray300:"#d6d3d1",gray200:"#e7e5e4",gray100:"#f5f5f4",gray50:"#fafaf9",red900:"#7f1d1d",red800:"#991b1b",red700:"#b91c1c",red600:"#dc2626",red500:"#ef4444",red400:"#f87171",red300:"#fca5a5",red200:"#fecaca",red100:"#fee2e2",red50:"#fef2f2",orange900:"#7c2d12",orange800:"#9a3412",orange700:"#c2410c",orange600:"#ea580c",orange500:"#f97316",orange400:"#fb923c",orange300:"#fdba74",orange200:"#fed7aa",orange100:"#ffedd5",orange50:"#fff7ed",yellow900:"#553B0C",yellow800:"#6F4B08",yellow700:"#8D6300",yellow600:"#BD8A00",yellow500:"#E5B400",yellow400:"#FFC800",yellow300:"#FBDA2B",yellow200:"#FEED72",yellow100:"#FEF8B4",yellow50:"#FEFCE2",green900:"#064e3b",green800:"#065f46",green700:"#047857",green600:"#059669",green500:"#10b981",green400:"#34d399",green300:"#6ee7b7",green200:"#a7f3d0",green100:"#d1fae5",green50:"#ecfdf5",cyan900:"#164e63",cyan800:"#155e75",cyan700:"#0e7490",cyan600:"#0891B2",cyan500:"#06b6d4",cyan400:"#22d3ee",cyan300:"#67e8f9",cyan200:"#a5f3fc",cyan100:"#cffafe",cyan50:"#ecfeff",blue900:"#1e3a8a",blue800:"#1e40af",blue700:"#1d4ed8",blue600:"#2563eb",blue500:"#3b82f6",blue400:"#60a5fa",blue300:"#93c5fd",blue200:"#bfdbfe",blue100:"#dbeafe",blue50:"#eff6ff",purple900:"#4c1d95",purple800:"#5b21b6",purple700:"#6d28d9",purple600:"#7c3aed",purple500:"#8b5cf6",purple400:"#a78bfa",purple300:"#c4b5fd",purple200:"#ddd6fe",purple100:"#ede9fe",purple50:"#f5f3ff",pink900:"#751A5E",pink800:"#8F1972",pink700:"#AF1C8A",pink600:"#D326A8",pink500:"#E845BF",pink400:"#F979D9",pink300:"#FCABE8",pink200:"#FED0F3",pink100:"#FFE8F9",pink50:"#FFF4FC"},rs=[Ee.brick100,Ee.brick900],ns=[Ee.gray200,C.green,C.red,Ee.gray200],Gt={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]}},w={cyan:"#22D3EE",pink:"#F377EF",purple:"#6528F7",red:"#FB2576",orange:"#FF9300",yellow:"#FBFF00",green:"#06FF00",blue:"#0079FF"},Me=[w.cyan,w.pink,w.purple,w.red,w.orange,w.yellow,w.green,w.blue],as=[w.cyan,w.green,w.red,w.cyan],xe={start:"#84D1FC",positive:"#84FC89",negative:"#FC8497",total:"#84D1FC"},is=[xe.start,xe.positive,xe.negative,xe.total],os={transform:"linear",reverse:!1,nice:!0,domainMin:null,domainMax:null,range:null,scheme:null,interpolate:"lab",domainMid:null,symmetric:!1},ss={size:[4,20],alpha:[.1,1],strokeWidth:[1,4]},ls={domainMin:null,domainMax:null,nice:!1,reverse:!1},us={range:null,domain:null,padding:.1,reverse:!1},zt={palette:{type:"default"}};function Ht(e,t="light",r){return((r!==void 0?Gt[t][r]:void 0)??Gt[t].default).map(n=>Ee[`${e}${n}`])}function cs(e){const t=Me.indexOf(w[e]);return t<=0?Me:[...Me.slice(t),...Me.slice(0,t)]}function ds(e,t={}){switch(e.type){case"default":return t.hasTouchingGeoms?Ht(Tn,t.colorScheme??"light",t.groupCount):En;case"graphy":return e.variant==="waterfall"?is:es;case"pastel":return e.variant==="waterfall"?ns:ts;case"neon":return e.variant==="waterfall"?as:cs(e.base);case"mono":return Ht(e.base,e.variant??"light",t.groupCount);case"custom":return e.colors}}function fs(e,t){if(!t)return e;const r=[...e];for(const[n,a]of Object.entries(t)){const i=Number(n);if(!Number.isInteger(i)||i<1)continue;const o=i-1;o<r.length&&(r[o]=a)}return r}function ps(e,t,r,n){if(!t)return;const a=r?.type==="custom"?n[r.id]:void 0,i={};for(const[o,s]of Object.entries(t)){const l=Number(o);if(!(!Number.isInteger(l)||l<1)){if(s.hex!==void 0){i[l]=s.hex;continue}if(s.id!==void 0){const u=a?.find(c=>c.id===s.id)?.hex;u!==void 0?i[l]=u:e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Palette override at slot ${l} with id '${s.id}' did not resolve against the active palette — falling back to palette color.`,context:{requested:s.id,available:a?.map(c=>c.id)??[]},suggestion:"Define the override id in the active custom palette, or use a hex value instead."})}}}return Object.keys(i).length>0?i:void 0}function hs(e,t,r){if(!t)return zt.palette;if(t.type==="custom"){const n=r[t.id];if(!n)return e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Custom palette with id "${t.id}" not found — falling back to the default palette.`,context:{requested:t.id,available:Object.keys(r)},suggestion:"Register the palette in customPalettes, or reference an existing palette id."}),zt.palette;const a=n.map(i=>i.hex);return{type:"custom",id:t.id,colors:a}}return t}function gs(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,scheme:r.scheme??null,interpolate:r.interpolate,domainMid:r.domainMid??null,symmetric:r.symmetric}}function ys(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 ms(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"discrete",range:t.range,domain:t.domain??null,padding:t.padding,reverse:t.reverse}}function bs(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"identity"}}function vs(e,t){return{type:"scale",scaledAesthetic:e,scaleType:"inferred",options:t}}function As(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"palette",palette:t.palette,overrides:t.overrides}}var Es={labelCrossPosition:.5},Ts={kind:"rectangle",zOrder:"foreground"},Os={zOrder:"foreground",fit:"contain"},Ps={x:8,y:8,unit:"px"},Ss={align:"center"},_s={startArrowheadStyle:"none",endArrowheadStyle:"line-arrow"},Ms={thin:2,medium:4,thick:8},xs=.5,Ls={strokeWidth:2,shadow:{offsetX:0,offsetY:1.15,blur:1.15,color:"rgba(0, 0, 0, 0.16)"}},Rs={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}}},ws={differenceArrow:"differenceArrows",shape:"shapes",arrow:"arrows",text:"textAnnotations",image:"images",sticker:"stickers",pinnedNumber:"pinnedNumbers",comment:"comments"},ks={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 ws}});Object.defineProperty(exports,"ARROW_DEFAULTS",{enumerable:!0,get:function(){return _s}});Object.defineProperty(exports,"ARROW_STICKER_DECLARATIONS",{enumerable:!0,get:function(){return Ls}});Object.defineProperty(exports,"ARROW_STROKE_WIDTHS_PX",{enumerable:!0,get:function(){return Ms}});Object.defineProperty(exports,"AXIS_KEYS",{enumerable:!0,get:function(){return qa}});Object.defineProperty(exports,"BAR_GROUP_SCALE_PADDING_FRACTION",{enumerable:!0,get:function(){return eo}});Object.defineProperty(exports,"BAR_WIDTH_FRACTION",{enumerable:!0,get:function(){return rn}});Object.defineProperty(exports,"BORDER_RADIUS_TOKENS",{enumerable:!0,get:function(){return lt}});Object.defineProperty(exports,"BUILT_IN_GEOMS",{enumerable:!0,get:function(){return gn}});Object.defineProperty(exports,"CONSTANT_VARIABLES",{enumerable:!0,get:function(){return Ze}});Object.defineProperty(exports,"CONTINUOUS_SCALE_DEFAULTS",{enumerable:!0,get:function(){return os}});Object.defineProperty(exports,"ChronologicalDateManager",{enumerable:!0,get:function(){return ur}});Object.defineProperty(exports,"DASH_PRESETS",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"DATETIME_SCALE_DEFAULTS",{enumerable:!0,get:function(){return ls}});Object.defineProperty(exports,"DEFAULT_BAR_CORNER_RADIUS",{enumerable:!0,get:function(){return Pi}});Object.defineProperty(exports,"DEFAULT_COLOR_PALETTE",{enumerable:!0,get:function(){return En}});Object.defineProperty(exports,"DEFAULT_DIMMED_ALPHA",{enumerable:!0,get:function(){return qr}});Object.defineProperty(exports,"DEFAULT_GEOM_COLOR",{enumerable:!0,get:function(){return Oi}});Object.defineProperty(exports,"DEFAULT_GRAPH_BACKGROUND",{enumerable:!0,get:function(){return xi}});Object.defineProperty(exports,"DEFAULT_GRAPH_BORDER_WIDTH_PX",{enumerable:!0,get:function(){return Ri}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_EDGES_PX",{enumerable:!0,get:function(){return ki}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_PX",{enumerable:!0,get:function(){return wi}});Object.defineProperty(exports,"DEFAULT_HEADLINE_SWATCH_SIZE_PX",{enumerable:!0,get:function(){return Mi}});Object.defineProperty(exports,"DEFAULT_HOVER_AFFORDANCE_COLOR",{enumerable:!0,get:function(){return Li}});Object.defineProperty(exports,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"DEFAULT_MONO_BASE",{enumerable:!0,get:function(){return Tn}});Object.defineProperty(exports,"DEFAULT_POINT_SIZE_PX",{enumerable:!0,get:function(){return _i}});Object.defineProperty(exports,"DEFAULT_RESHAPE_VALUE_NAME",{enumerable:!0,get:function(){return Cr}});Object.defineProperty(exports,"DEFAULT_SEQUENTIAL_RAMP",{enumerable:!0,get:function(){return rs}});Object.defineProperty(exports,"DEFAULT_STROKE_WIDTH_PX",{enumerable:!0,get:function(){return Si}});Object.defineProperty(exports,"DIFFERENCE_ARROW_DEFAULTS",{enumerable:!0,get:function(){return Es}});Object.defineProperty(exports,"DIFFERENCE_ARROW_SIZE_DECLARATIONS",{enumerable:!0,get:function(){return Rs}});Object.defineProperty(exports,"DISCRETE_SCALE_DEFAULTS",{enumerable:!0,get:function(){return us}});Object.defineProperty(exports,"DataCompiler",{enumerable:!0,get:function(){return za}});Object.defineProperty(exports,"Dataset",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"GROUP_VARIABLES",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"Geom",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"GeomRegistry",{enumerable:!0,get:function(){return Wo}});Object.defineProperty(exports,"IMAGE_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return Os}});Object.defineProperty(exports,"IS_DEV",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"InternalError",{enumerable:!0,get:function(){return R}});Object.defineProperty(exports,"LAYER_LABEL_VARIABLES",{enumerable:!0,get:function(){return Un}});Object.defineProperty(exports,"LINE_TYPES",{enumerable:!0,get:function(){return ir}});Object.defineProperty(exports,"MONO_BASES",{enumerable:!0,get:function(){return Zo}});Object.defineProperty(exports,"NEON_BASES",{enumerable:!0,get:function(){return Qo}});Object.defineProperty(exports,"NON_POSITION_RANGE_DEFAULTS",{enumerable:!0,get:function(){return ss}});Object.defineProperty(exports,"POLAR_RIM_LABEL_GAP_PX",{enumerable:!0,get:function(){return Cn}});Object.defineProperty(exports,"POSITION_ADJUSTMENTS",{enumerable:!0,get:function(){return ar}});Object.defineProperty(exports,"POSITION_VARIABLES",{enumerable:!0,get:function(){return b}});Object.defineProperty(exports,"Registry",{enumerable:!0,get:function(){return it}});Object.defineProperty(exports,"SCALED_POSITION_AESTHETIC_KEYS",{enumerable:!0,get:function(){return Vr}});Object.defineProperty(exports,"SCALED_VISUAL_AESTHETIC_KEYS",{enumerable:!0,get:function(){return ot}});Object.defineProperty(exports,"SELECTION_PADDING_DEFAULT",{enumerable:!0,get:function(){return Ps}});Object.defineProperty(exports,"SHAPE_DEFAULTS",{enumerable:!0,get:function(){return Ts}});Object.defineProperty(exports,"STACK_VARIABLES",{enumerable:!0,get:function(){return et}});Object.defineProperty(exports,"STAT_VARIABLES",{enumerable:!0,get:function(){return Qe}});Object.defineProperty(exports,"STYLE_DOMAINS",{enumerable:!0,get:function(){return Ti}});Object.defineProperty(exports,"STYLE_IMAGE_FITS",{enumerable:!0,get:function(){return Hr}});Object.defineProperty(exports,"STYLE_PATTERN_PRESETS",{enumerable:!0,get:function(){return zr}});Object.defineProperty(exports,"STYLE_PROPERTY_NAMES",{enumerable:!0,get:function(){return mi}});Object.defineProperty(exports,"STYLE_SELECT_KEYS",{enumerable:!0,get:function(){return $r}});Object.defineProperty(exports,"STYLE_STATES",{enumerable:!0,get:function(){return ui}});Object.defineProperty(exports,"STYLE_TARGETS",{enumerable:!0,get:function(){return Ne}});Object.defineProperty(exports,"SUFFIX_MULTIPLIERS",{enumerable:!0,get:function(){return cr}});Object.defineProperty(exports,"Stage",{enumerable:!0,get:function(){return kr}});Object.defineProperty(exports,"Stat",{enumerable:!0,get:function(){return yn}});Object.defineProperty(exports,"TAU",{enumerable:!0,get:function(){return W}});Object.defineProperty(exports,"TEXT_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return Ss}});Object.defineProperty(exports,"TEXT_ANNOTATION_FADE_ALPHA",{enumerable:!0,get:function(){return xs}});Object.defineProperty(exports,"TransformRegistry",{enumerable:!0,get:function(){return Xo}});Object.defineProperty(exports,"UserInputError",{enumerable:!0,get:function(){return ce}});Object.defineProperty(exports,"VISUAL_VARIABLES",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"VizError",{enumerable:!0,get:function(){return rt}});Object.defineProperty(exports,"__toESM",{enumerable:!0,get:function(){return wn}});Object.defineProperty(exports,"alignToBoxPoint",{enumerable:!0,get:function(){return tt}});Object.defineProperty(exports,"alignUnitFractions",{enumerable:!0,get:function(){return Xn}});Object.defineProperty(exports,"annotation",{enumerable:!0,get:function(){return ks}});Object.defineProperty(exports,"applyOverrides",{enumerable:!0,get:function(){return fs}});Object.defineProperty(exports,"areDataValuesEqual",{enumerable:!0,get:function(){return ka}});Object.defineProperty(exports,"areMappingsEquivalent",{enumerable:!0,get:function(){return ea}});Object.defineProperty(exports,"buildLayerSpec",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"buildPanelAnchorBox",{enumerable:!0,get:function(){return pe}});Object.defineProperty(exports,"continuous",{enumerable:!0,get:function(){return gs}});Object.defineProperty(exports,"createGeomStyleNode",{enumerable:!0,get:function(){return zi}});Object.defineProperty(exports,"createPerKeyMemo",{enumerable:!0,get:function(){return Rr}});Object.defineProperty(exports,"createSingleSlotMemo",{enumerable:!0,get:function(){return Ra}});Object.defineProperty(exports,"cursorToPiePlane",{enumerable:!0,get:function(){return Qt}});Object.defineProperty(exports,"cursorToPolar",{enumerable:!0,get:function(){return Wn}});Object.defineProperty(exports,"datetime",{enumerable:!0,get:function(){return ys}});Object.defineProperty(exports,"defineGeomStyleTarget",{enumerable:!0,get:function(){return Yi}});Object.defineProperty(exports,"discrete",{enumerable:!0,get:function(){return ms}});Object.defineProperty(exports,"findStyleTarget",{enumerable:!0,get:function(){return Ui}});Object.defineProperty(exports,"freezeWalkedEntries",{enumerable:!0,get:function(){return Wi}});Object.defineProperty(exports,"geom",{enumerable:!0,get:function(){return ei}});Object.defineProperty(exports,"getAestheticFromScaleAestheticKey",{enumerable:!0,get:function(){return Qa}});Object.defineProperty(exports,"getAlpha",{enumerable:!0,get:function(){return Io}});Object.defineProperty(exports,"getAngleExtent",{enumerable:!0,get:function(){return ln}});Object.defineProperty(exports,"getColor",{enumerable:!0,get:function(){return cn}});Object.defineProperty(exports,"getGroupVariables",{enumerable:!0,get:function(){return Yr}});Object.defineProperty(exports,"getInsetTileRect",{enumerable:!0,get:function(){return fn}});Object.defineProperty(exports,"getLineType",{enumerable:!0,get:function(){return No}});Object.defineProperty(exports,"getPaintedTileRect",{enumerable:!0,get:function(){return hn}});Object.defineProperty(exports,"getRadiusExtent",{enumerable:!0,get:function(){return un}});Object.defineProperty(exports,"getScaledAesthetic",{enumerable:!0,get:function(){return Hn}});Object.defineProperty(exports,"getSize",{enumerable:!0,get:function(){return Co}});Object.defineProperty(exports,"getStableKey",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"getStackRole",{enumerable:!0,get:function(){return nn}});Object.defineProperty(exports,"getStrokeWidth",{enumerable:!0,get:function(){return Fo}});Object.defineProperty(exports,"getTileRectBounds",{enumerable:!0,get:function(){return dn}});Object.defineProperty(exports,"getX",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"getXMax",{enumerable:!0,get:function(){return X}});Object.defineProperty(exports,"getXMin",{enumerable:!0,get:function(){return K}});Object.defineProperty(exports,"getY",{enumerable:!0,get:function(){return U}});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 rr}});Object.defineProperty(exports,"hasMultipleGroups",{enumerable:!0,get:function(){return st}});Object.defineProperty(exports,"identity",{enumerable:!0,get:function(){return bs}});Object.defineProperty(exports,"inferXVariable",{enumerable:!0,get:function(){return Jn}});Object.defineProperty(exports,"inferred",{enumerable:!0,get:function(){return vs}});Object.defineProperty(exports,"isAngleWithinArc",{enumerable:!0,get:function(){return $t}});Object.defineProperty(exports,"isBorderRadiusToken",{enumerable:!0,get:function(){return Gr}});Object.defineProperty(exports,"isCategoricalValueFormat",{enumerable:!0,get:function(){return or}});Object.defineProperty(exports,"isCompilerCachingEnabled",{enumerable:!0,get:function(){return La}});Object.defineProperty(exports,"isCurrencyValueFormat",{enumerable:!0,get:function(){return ra}});Object.defineProperty(exports,"isDateWithoutYearValueFormat",{enumerable:!0,get:function(){return na}});Object.defineProperty(exports,"isDefined",{enumerable:!0,get:function(){return le}});Object.defineProperty(exports,"isFullTurnSweep",{enumerable:!0,get:function(){return Xt}});Object.defineProperty(exports,"isGradientPaint",{enumerable:!0,get:function(){return ut}});Object.defineProperty(exports,"isImagePaint",{enumerable:!0,get:function(){return Kr}});Object.defineProperty(exports,"isInternalVariable",{enumerable:!0,get:function(){return Gn}});Object.defineProperty(exports,"isLightDarkColor",{enumerable:!0,get:function(){return Te}});Object.defineProperty(exports,"isLineType",{enumerable:!0,get:function(){return ta}});Object.defineProperty(exports,"isLookupValueFormat",{enumerable:!0,get:function(){return nt}});Object.defineProperty(exports,"isNonEmptyArray",{enumerable:!0,get:function(){return $n}});Object.defineProperty(exports,"isNumericDataValue",{enumerable:!0,get:function(){return In}});Object.defineProperty(exports,"isNumericValueFormat",{enumerable:!0,get:function(){return sr}});Object.defineProperty(exports,"isPatternPaint",{enumerable:!0,get:function(){return ct}});Object.defineProperty(exports,"isPlainObject",{enumerable:!0,get:function(){return qn}});Object.defineProperty(exports,"isPointWithinPanel",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"isPositionScale",{enumerable:!0,get:function(){return Br}});Object.defineProperty(exports,"isScaledAestheticKey",{enumerable:!0,get:function(){return Ja}});Object.defineProperty(exports,"isStackedPosition",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"isStrictCategoricalDataValue",{enumerable:!0,get:function(){return Dn}});Object.defineProperty(exports,"isStrictNumericDataValue",{enumerable:!0,get:function(){return M}});Object.defineProperty(exports,"isStrictTemporalDataValue",{enumerable:!0,get:function(){return Le}});Object.defineProperty(exports,"isStyleTokenRef",{enumerable:!0,get:function(){return dt}});Object.defineProperty(exports,"isTemporalDataValue",{enumerable:!0,get:function(){return kn}});Object.defineProperty(exports,"isTemporalValueFormat",{enumerable:!0,get:function(){return fe}});Object.defineProperty(exports,"isTilePainted",{enumerable:!0,get:function(){return pn}});Object.defineProperty(exports,"isUsableTokenValue",{enumerable:!0,get:function(){return Xr}});Object.defineProperty(exports,"isVisualScale",{enumerable:!0,get:function(){return Wr}});Object.defineProperty(exports,"measureSignedAngularDelta",{enumerable:!0,get:function(){return Vn}});Object.defineProperty(exports,"normalizeAngle",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"paintKey",{enumerable:!0,get:function(){return si}});Object.defineProperty(exports,"palette",{enumerable:!0,get:function(){return As}});Object.defineProperty(exports,"parseAddressingValue",{enumerable:!0,get:function(){return Lr}});Object.defineProperty(exports,"parseDataset",{enumerable:!0,get:function(){return jr}});Object.defineProperty(exports,"polarSectorToInscribedSquare",{enumerable:!0,get:function(){return Jt}});Object.defineProperty(exports,"polarToUnit",{enumerable:!0,get:function(){return qt}});Object.defineProperty(exports,"positionToAngle",{enumerable:!0,get:function(){return Bn}});Object.defineProperty(exports,"prefixInternalVariable",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"readConstantValue",{enumerable:!0,get:function(){return be}});Object.defineProperty(exports,"readFoldKeepVariables",{enumerable:!0,get:function(){return Zn}});Object.defineProperty(exports,"readISOInstant",{enumerable:!0,get:function(){return br}});Object.defineProperty(exports,"readMainAxisVariable",{enumerable:!0,get:function(){return Qn}});Object.defineProperty(exports,"readObservationBox",{enumerable:!0,get:function(){return nr}});Object.defineProperty(exports,"readObservationVocabulary",{enumerable:!0,get:function(){return tn}});Object.defineProperty(exports,"readPlugins",{enumerable:!0,get:function(){return $o}});Object.defineProperty(exports,"readVariableName",{enumerable:!0,get:function(){return k}});Object.defineProperty(exports,"resolveAnchoredLabelCenter",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"resolveBarBandFraction",{enumerable:!0,get:function(){return qe}});Object.defineProperty(exports,"resolveColorScheme",{enumerable:!0,get:function(){return Ke}});Object.defineProperty(exports,"resolveDefinition",{enumerable:!0,get:function(){return mn}});Object.defineProperty(exports,"resolvePaletteConfig",{enumerable:!0,get:function(){return hs}});Object.defineProperty(exports,"resolvePaletteOverrides",{enumerable:!0,get:function(){return ps}});Object.defineProperty(exports,"resolvePaletteRange",{enumerable:!0,get:function(){return ds}});Object.defineProperty(exports,"resolvePositionScaleAesthetic",{enumerable:!0,get:function(){return Za}});Object.defineProperty(exports,"resolveScaledAestheticVariable",{enumerable:!0,get:function(){return tr}});Object.defineProperty(exports,"resolveYScaleAesthetic",{enumerable:!0,get:function(){return Ur}});Object.defineProperty(exports,"setCompilerCachingEnabled",{enumerable:!0,get:function(){return xa}});Object.defineProperty(exports,"sumMemoStats",{enumerable:!0,get:function(){return wa}});Object.defineProperty(exports,"toExplicitValueFormat",{enumerable:!0,get:function(){return aa}});Object.defineProperty(exports,"toPaintColor",{enumerable:!0,get:function(){return Fe}});Object.defineProperty(exports,"token",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"unitToPolar",{enumerable:!0,get:function(){return Zt}});Object.defineProperty(exports,"walkStyleTargets",{enumerable:!0,get:function(){return Bi}});Object.defineProperty(exports,"wrappedAngularDistance",{enumerable:!0,get:function(){return jn}});
|
|
1
|
+
var Sn=Object.create,Xt=Object.defineProperty,_n=Object.getOwnPropertyDescriptor,Mn=Object.getOwnPropertyNames,xn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty,Rn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Mn(t),i=0,o=a.length,s;i<o;i++)s=a[i],!Ln.call(e,s)&&s!==r&&Xt(e,s,{get:(l=>t[l]).bind(null,s),enumerable:!(n=_n(t,s))||n.enumerable});return e},wn=(e,t,r)=>(r=e!=null?Sn(xn(e)):{},Rn(t||!e||!e.__esModule?Xt(r,"default",{value:e,enumerable:!0}):r,e));let v=require("date-fns"),Je=require("lodash-es");var Re=e=>e instanceof Date&&(0,v.isValid)(e),kn=e=>Re(e)||e===null,Dn=e=>typeof e=="string",M=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),In=e=>M(e)||e===null,W=Math.PI*2,Cn=8,Fn=1e-9,Nn=[0,Math.PI/2,Math.PI,W*3/4],$t=(e,t)=>Math.abs(t-e)>=W-Fn,te=e=>(e%W+W)%W,qt=(e,t,r)=>{if($t(t,r))return!0;const n=te(r-t);return te(e-t)<=n},jn=(e,t)=>{const r=Math.abs(te(e)-te(t));return Math.min(r,W-r)},Vn=(e,t)=>{const r=te(t-e);return r>Math.PI?r-W:r},Bn=(e,t,r)=>e*W+t+r,Jt=(e,t)=>({x:t*Math.sin(e),y:t*Math.cos(e)}),J=(e,t)=>{const r=Jt(e,t);return{x:.5+r.x/2,y:.5+r.y/2}},Zt=(e,t,r,n)=>{const a=[J(e,r),J(e,n),J(t,r),J(t,n)],i=Math.max(r,n),o=Nn.filter(l=>qt(l,e,t)).map(l=>J(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))}},Qt=(e,t)=>({angle:te(Math.atan2(e,t)),radius:Math.hypot(e,t)}),er=(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}},Wn=(e,t)=>{const{x:r,y:n}=er(e,t);return Qt(r,n)},tr="\0graphy\0_",m=e=>`${tr}${e}`,Ze={x:m("constantX")},Un={bar:m("barSeriesLabel"),line:m("lineSeriesLabel")},Qe={count:m("count"),mean:m("mean"),sum:m("sum")},we={group:m("group")},b={x:m("x"),y:m("y"),xMin:m("xMin"),xMax:m("xMax"),yMin:m("yMin"),yMax:m("yMax"),yRaw:m("yRaw")},et={role:m("stackRole")},ae={color:m("color"),size:m("size"),alpha:m("alpha"),strokeWidth:m("strokeWidth"),lineType:m("lineType")},ye={y:m("ruleY"),x:m("ruleX")},Is={...Ze,...Qe,...we,...b,...et,...ae,...ye},Yn=new Set(Object.values(Qe)),rr=e=>m(`scaled_${e}`),Gn=e=>e.startsWith(tr),zn=e=>Yn.has(e);function H(e){return e[b.x]}function U(e){return e[b.y]}function K(e){return e[b.xMin]}function X(e){return e[b.xMax]}function Y(e){return e[b.yMin]}function G(e){return e[b.yMax]}function nr(e){return e[b.yRaw]}function Hn(e,t){return e[rr(t)]}var Kn={xMin:0,xMax:1,yMin:0,yMax:1},ar=(e,t)=>{const r=K(e)??H(e),n=X(e)??H(e),a=Y(e)??U(e),i=G(e)??U(e);return!M(r)||!M(n)||!M(a)||!M(i)?null:t.type!=="polar"?{xMin:r,xMax:n,yMin:a,yMax:i}:{...Zt(r,n,a,i),space:"disk"}},tt=(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}}},Xn=e=>tt(Kn,e),$n=e=>e.length>0;function ue(e){return e!=null}function qn(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Jn(e){const{numeric:t,categorical:r,temporal:n}=e.groupVariableNamesByType();return n[0]??r[0]??t[0]??""}function Zn(e,t){const{categorical:r,temporal:n}=e.groupVariableNamesByType(),a=[...r,...n];return t===""||a.includes(t)?a:[t,...a]}function Qn(e){const t=k(e.x);return t===null||t===Ze.x?"":t}function k(e){return ue(e)?typeof e=="string"?e:"variable"in e?e.variable:null:null}function be(e){if(!(!ue(e)||typeof e=="string")&&"value"in e)return e.value}function ea(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].every(r=>vt(e[r])===vt(t[r]))}function vt(e){const t=k(e);if(t!==null)return`variable:${t}`;const r=be(e);return r===void 0?"":r===null?"value:null":r instanceof Date?`value:date:${r.getTime()}`:`value:${typeof r}:${r}`}var ir=["stack","dodge","identity","fill"],or=["solid","dashed","dotted"],N={line:{solid:[],dashed:[4,2],dotted:[1,1]},rule:{solid:[],dashed:[2,3],dotted:[0,2]},gridLine:{solid:[],dashed:[2,3],dotted:[1,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]}},ta=e=>or.includes(e);function ce(e){return e==="stack"||e==="fill"}var Te="en-GB",rt=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}},re=class extends rt{constructor(e){super(e),this.kind="user-input"}},R=class extends rt{constructor(e){super({...e,code:e.code??"INTERNAL_INVARIANT"}),this.kind="internal"}},nt=e=>e.type==="lookup",sr=e=>e.type==="text",fe=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",lr=e=>e.type==="decimal"||e.type==="integer"||e.type==="percentage"||e.type==="duration"||e.type==="currency",ra=e=>e.type==="currency",na=e=>e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range",ur=e=>{if(nt(e))return ur(e.fallback);if(fe(e))return"temporal";if(lr(e))return"numeric";if(sr(e))return"categorical";throw new R({message:`No data type found for value format: ${e.type}`})},aa=e=>nt(e)?e.fallback:e,cr=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}},dr={k:1e3,m:1e6,b:1e9,t:1e12},at=["k","m","b","t"],ia=new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${at.join("|")})?$`,"i"),oa=/^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/,ne=e=>e===null||e instanceof Date||Array.isArray(e)||typeof e=="boolean"?!1:typeof e=="string"?ia.test(e)&&!Number.isNaN(Number(e.replace(new RegExp(`[,${at.join("")}]`,"gi"),""))):Number.isFinite(Number(e)),fr=e=>ne(e)?!0:typeof e=="string"?oa.test(e):!1,sa=/^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/,la=/^\s*(1[89]\d{2}|2[01]\d{2})\s*$/,ua=[[/\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"]],ca={"en-US":"MDY","en-GB":"DMY","pt-PT":"DMY",ar:"DMY"},pr=["/","-","."," "],At=[["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"]],Et=[["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"]],Tt=[["yyyy","M","d"],["yyyy","M","dd"],["yyyy","MM","d"],["yyyy","MM","dd"],["yyyy","MMMM","d"],["yyyy","MMMM","dd"],["yyyy","MMMM","do"]],hr=[["d","MMMM"],["dd","MMMM"],["do","MMMM"],["MMMM","d"],["MMMM","dd"],["MMMM","do"]],da=[{dateFormat:"MMMM d, yyyy",type:"date"},{dateFormat:"MMMM dd, yyyy",type:"date"},{dateFormat:"MMMM do, yyyy",type:"date"},{dateFormat:"yyyy-MM",type:"month_year"}],gr=1800,yr=2199,fa=3,pa=6,ha=5,ga=1,ya=28,ma=/\s*[–—]\s*|\s-\s/,ba=e=>typeof e=="number"?Number.isInteger(e)&&e>=gr&&e<=yr:typeof e=="string"?la.test(e):!1,mr=(e,t)=>{const r=ve(e);return!t&&ne(r)?Ea(r):typeof r=="string"?t?(0,v.isValid)((0,v.parse)(r,t,new Date)):!!br(r)||De(r)&&(0,v.isValid)(new Date(r)):(0,v.isValid)(r)},ve=e=>{if(typeof e!="string")return e;let t=e;for(const[r,n]of ua)t=t.replace(r,n);return t},br=(e,t=Te)=>{const r=ve(e);return De(r)?{type:"datetime"}:Ar(t).find(n=>!fe(n)||n.type==="month"&&r.length<fa?!1:n.dateFormat&&(0,v.isValid)((0,v.parse)(r,n.dateFormat,new Date)))},De=e=>sa.test(e.trim()),vr=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},va=(e,t=Te)=>{const[r,n]=e.split(ma);if(!r||!n)return;const a=ve(r).trim(),i=ve(n).trim();return Aa(t).find(o=>{if(!fe(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 cr,c=u.incrementYearIfNeeded(s),p=u.incrementYearIfNeeded(l),d=(0,v.differenceInDays)(p,c);return(0,v.isWithinInterval)(new Date(c.getFullYear(),ga,ya),{start:c,end:p})&&d===ha?!0:d===pa})},Ar=e=>{const t={date:Er(e),year:[["yyyy"]],day_month:hr,month_year:[["MMMM","yyyy"],["yyyy","MMMM"]],month:[["MMMM"]],quarter:[["QQQ","yyyy"],["yyyy","QQQ"]]};return[...da,...Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>pr.map(i=>({dateFormat:a.join(i),type:r}))))]},Er=e=>ca[e]==="MDY"?[...Et,...At,...Tt]:[...At,...Et,...Tt],Aa=e=>{const t={weekly_date_range:hr,weekly_date_range_with_year:Er(e)};return Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>pr.map(i=>({dateFormat:a.join(i),type:r}))))},Ea=e=>{const t=Number(e);if(!(0,Je.isInteger)(t))return!1;const r=new Date(t),n=new Date(t*1e3),a=i=>(0,v.isValid)(i)&&i.getFullYear()>=gr&&i.getFullYear()<=yr;return a(r)||a(n)},Tr={$:"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"},Or=e=>{if(typeof e=="string"){const t=Pr(e);return t.length?ne(t):!1}return ne(e)},Ta=e=>{const t=Sr(e),r=t?Tr[t]:void 0;if(!r)throw new R({message:"Could not get currency ISO"});return r},Pr=e=>{const t=Sr(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 ne(r)?r.split(",").join(""):""},Sr=e=>Object.keys(Tr).sort((t,r)=>r.length-t.length).find(t=>e.includes(t)),_r=e=>{const t=Object.entries(e);return!t.length||!t.some(([,r])=>!de(r))},de=e=>typeof e=="string"&&e.trim()===""||e===void 0||e===null||e==="-",Oa=/\s*[–—]\s*|\s-\s/,Mr=(e,t,r)=>{if(de(e))return null;switch(t.type){case"decimal":case"integer":case"duration":return Lr(e);case"percentage":return Pa(e);case"currency":return Sa(e);case"datetime":case"date":case"year":case"month_year":case"month":case"day_month":case"quarter":case"time":return xr(e,t.dateFormat,r);case"weekly_date_range":case"weekly_date_range_with_year":return _a(e,t.dateFormat,r);case"text":return Ma(e);case"lookup":throw new R({message:"Cannot parse: lookup value formats are produced by transforms, not raw input"});default:throw new R({message:`Unhandled value format: ${t.type}`})}},xr=(e,t,r)=>{if(e instanceof Date)return(0,v.isValid)(e)?e:null;const n=ve(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)?je(o):null}for(const o of Ar(r)){if(!fe(o)||!o.dateFormat)continue;const s=(0,v.parse)(n,o.dateFormat,a);if((0,v.isValid)(s))return je(s)}const i=new Date(n);return mr(i)?De(n)?i:je(i):null},Lr=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;let t=e.trim();if(!ne(t))return null;let r=1;for(const n of at)if(new RegExp(`${n}$`,"i").test(t)){r=dr[n],t=t.slice(0,-1);break}return Number(t.split(",").join(""))*r},Pa=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;const t=e.trim();if(!fr(t))return null;const r=Number(t.replace(/%/g,"").replace(/,/g,""))/100;return Number.isNaN(r)?null:r},Sa=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;const t=e.trim();return Or(t)?Lr(Pr(t)):null},_a=(e,t,r)=>{const n=String(e).trim().split(Oa),[a,i]=[n[0]?.trim(),n[1]?.trim()];return!a||!i?null:xr(a,t,r)},Ma=e=>String(e).trim(),je=e=>new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),it=(e,t,r)=>{if(t.type==="text"&&typeof e=="string")return e;const n=Mr(e,t,r);return n!==null||!fe(t)?n:vr(e)},Q=process.env.NODE_ENV!=="production";var Ie=!0,xa=e=>{Ie=e},La=()=>Ie,Ra=()=>{let e=null;const t={hits:0,misses:0};return Object.assign((n,a)=>{if(!Ie)return Q&&(t.misses+=1),a();if(e&&wr(e.args,n))return Q&&(t.hits+=1),e.out;Q&&(t.misses+=1);const i=a();return e={args:n,out:i},i},{stats:t,reset:()=>{e=null}})},Rr=()=>{const e=new WeakMap,t={hits:0,misses:0};return Object.assign((n,a,i)=>{if(!Ie)return Q&&(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&&wr(u.args,a))return Q&&(t.hits+=1),l>0&&(o.splice(l,1),o.unshift(u)),u.out}Q&&(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})},wa=(...e)=>e.reduce((t,r)=>({hits:t.hits+r.hits,misses:t.misses+r.misses}),{hits:0,misses:0}),wr=(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},kr=class{constructor(){this.memo=Rr(),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}},ke=e=>(Array.isArray(e)?e:[e]).map(t=>t instanceof Date?t.toISOString():String(t??"<null>")).join("\0"),ka=(e,t)=>e===t?!0:Re(e)&&Re(t)?e.getTime()===t.getTime():!1,Ce=(e,t)=>e>=0&&e<=1&&t>=0&&t<=1,Da=new Set(["count","sum","mean","median"]);function Dr(e,t){return Da.has(e)?"numeric":t}function Ir(e,t,r,n){if(n!==void 0&&n.type!=="numeric"&&(e==="sum"||e==="mean"||e==="median"))throw new re({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=Ve(t,r,l);Be(u)&&s.push(u)}return s.length===0?null:e==="median"?Fa(s):Na(s)}if(e==="sum"||e==="mean"){let s=0,l=0;for(let u=0;u<a;u++){const c=Ve(t,r,u);Be(c)&&(s++,l+=Number(c))}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=Ve(t,r,s);Be(l)&&(o===null||Ia(l,o)===i)&&(o=l)}return o}var Ve=(e,t,r)=>e[t?.[r]??r]??null,Be=e=>e!==null&&!(typeof e=="number"&&Number.isNaN(e)),Ia=(e,t)=>e===null||t===null?0:e<t?-1:e>t?1:0,Ca=e=>e instanceof Date?e.getTime():e??null;function Fa(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 Na(e){const t=new Map;for(const a of e){const i=Ca(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 ja=e=>e==null||typeof e=="number"&&Number.isNaN(e),Va=e=>e instanceof Date?e.getTime():e??null,He=class z{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 z(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 z(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 z(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 z(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 z(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++)(ja(n[s])?a:i).push(s);const o=r==="asc"?1:-1;return i.sort((s,l)=>{const u=n[s],c=n[l];return u<c?-o:u>c?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=Va(n[i]),s=a.get(o);s===void 0?a.set(o,{key:ke(n[i]??null),indices:[i]}):s.indices.push(i)}return[...a.values()]}for(let i=0;i<this.rowCount;i++){const o=ke(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(d=>!t.includes(d)),i=this.rowCount*t.length,o=a.map(d=>({name:d,source:this.values(d)??[],repeated:new Array(i)})),s=t.map(d=>this.values(d)??[]),l=new Array(i),u=new Array(i);let c=0;for(let d=0;d<this.rowCount;d++)for(let h=0;h<t.length;h++,c++){for(const y of o)y.repeated[c]=y.source[d]??null;l[c]=t[h]??"",u[c]=s[h]?.[d]??null}const p=new Map;for(const{name:d,repeated:h}of o)p.set(d,h);return p.set(r,l),p.set(n,u),new z([...a,r,n],p,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 z(this.names,new Map(this.columns),this.rowCount)}};var Cr="value",me={numeric:{type:"decimal"},categorical:{type:"text"},temporal:{type:"datetime"}},Ot={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},Pt=e=>e===null?null:e instanceof Date?e.getTime():new Date(e).getTime(),Fr=(e,t)=>e==="count"?{type:"integer"}:t,Nr=(e,t,r)=>{const n=e.values(t);if(n!==void 0)return n;if(r==="count")return new Array(e.rowCount);throw new R({message:`Variable '${t}' not defined`})},ee=class L{constructor(t={}){const{table:r,variableMetadata:n}=this.parseVariableMap(t);this.table=r,this.variableMetadata=n}static fromTrusted(t,r){const n=Object.create(L.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 R({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 L.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 L.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 R({message:`Variable ${t} not defined`});const a=this.table.rename(t,r),{[t]:i,...o}=this.variableMetadata,s={...o,[r]:n};return L.fromTrusted(a,s)}selectVariables(...t){const r=this.table.select(t),n=Object.fromEntries(Object.entries(this.variableMetadata).filter(([a])=>t.includes(a)));return L.fromTrusted(r,n)}getType(t){const r=this.variableMetadata[t];if(!r)throw new R({message:`Variable ${t} not defined`});return r.type}getValueFormat(t){const r=this.variableMetadata[t];if(!r)throw new R({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 R({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 R({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=Ot[r],i=this.table.values(t)??[],o=[];for(let s=0;s<i.length;s++)a(i[s]??null,n)&&o.push(s);return L.fromTrusted(this.table.take(o),this.variableMetadata)}filterByMask(t){if(t.length!==this.size())throw new R({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 L.fromTrusted(this.table.take(r),this.variableMetadata)}take(t){return L.fromTrusted(this.table.take(t),this.variableMetadata)}orderBy(t,r="asc"){const n=this.table.take(this.table.sortedIndices(t,r));return L.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 Ba(t,this.table,this.variableMetadata)}rollup(t){const r=He.from(Object.fromEntries(Object.entries(t).map(([a,{variableName:i,aggregation:o}])=>[a,[Ir(o,Nr(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??me[l];n[a]={type:Dr(o,l),valueFormat:Fr(o,u)}}return L.fromTrusted(r,n)}reshapeFromWideToLong({keep:t,reshape:r,keyName:n="key",valueName:a=Cr}={}){const{numeric:i,categorical:o,temporal:s}=this.groupVariableNamesByType(),l=t??[...o,...s],u=r??i.filter(d=>!l.includes(d));if(l.includes(n)||l.includes(a))throw new re({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 d={};for(const h of l){const y=this.variableMetadata[h];y&&(d[h]={type:y.type,values:[],valueFormat:y.valueFormat})}return d[n]={type:"categorical",values:[],valueFormat:{type:"text"}},d[a]={type:"numeric",values:[],valueFormat:{type:"decimal"}},new L(d)}if(u.filter(d=>this.variableMetadata[d]?.type!=="numeric").length>0)throw new re({code:"INVALID_DATA_SHAPE",message:"Only numeric variables can be reshaped"});const c=this.table.select([...l,...u]).fold(u,n,a),p={};for(const d of l){const h=this.variableMetadata[d];h&&(p[d]=h)}return p[n]={type:"categorical",valueFormat:{type:"text"}},p[a]={type:"numeric",valueFormat:Wa(this.variableMetadata,u,n)},L.fromTrusted(c,p)}print(){console.table(this.variableMetadata),console.table([...this.table])}[Symbol.iterator](){return this.table[Symbol.iterator]()}filterByTimestamp(t,r,n){const a=Ot[r],i=it(n,this.getValueFormat(t),Te),o=Pt(i??n),s=this.getValues(t,{type:"temporal"}),l=[];for(let u=0;u<s.length;u++)a(Pt(s[u]??null),o)&&l.push(u);return L.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:me[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??me[i]};return{table:He.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 R({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}},Ba=class{constructor(e,t,r){this.groupedBy=e,this.table=t,this.variableMetadata=r}forEach(e){this.table.partition(this.groupedBy).forEach(({key:t,indices:r},n)=>{e(ee.fromTrusted(this.table.take(r),this.variableMetadata),t,n)})}rollup(e){const t=this.table.partition(this.groupedBy),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??me[o]}]}));for(const[a,{variableName:i,aggregation:o}]of Object.entries(e)){const s=Nr(this.table,i,o),l=this.variableMetadata[i],u=l?.type??"numeric";r[a]=t.map(({indices:p})=>Ir(o,s,p,{type:u,variableName:i}));const c=l?.valueFormat??me[u];n[a]={type:Dr(o,u),valueFormat:Fr(o,c)}}return ee.fromTrusted(He.from(r),n)}};function Wa(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 re({code:"INVALID_DATA_SHAPE",message:"Cannot reshape: a source column has a lookup format and lookups cannot nest"});if(i.every(s=>(0,Je.isEqual)(s,a))||a.type==="lookup")return a;const o={};for(const[s,l]of t.entries()){const u=ke([l]),c=n[s];c&&c.type!=="lookup"&&(o[u]=c)}return{type:"lookup",byVariable:r,cases:o,fallback:a}}var ot=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 re({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)}},Ua=(e,t)=>{const r=typeof e=="string"?e.trim():e;if(ne(r))return{type:"decimal"};const n=typeof r=="string"&&br(r,t);if(n)return n;const a=typeof r=="string"&&va(r,t);return a||(mr(e)?{type:"date"}:fr(e)?{type:"percentage"}:Or(e)&&typeof e=="string"?{type:"currency",iso:Ta(e)}:{type:"text"})},Ya={type:"year",dateFormat:"yyyy"},Ga={type:"text"},jr=e=>{const t=e._metadata?.parsingLocale??"en-GB",r={},n=Xa(e),a=Ha(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(de(l)&&i)continue;const u=s.valueFormat??(de(l)?Ga:o===a?Ya:Ua(l,t)),c=ur(u);r[s.key]=Ka(s.key,e.rows,u,c,t)}return new ee(r)},za=class extends kr{dependencies(e){return[e]}run(e){return jr(e)}},Ha=e=>{if(e.columns.some(r=>r.valueFormat?.type==="year"))return-1;const t=$a(e.rows,5);return e.columns.findIndex(r=>{if(r.valueFormat)return!1;const n=t.map(a=>a[r.key]).filter(a=>!de(a));return n.length>=2&&n.every(ba)})},Ka=(e,t,r,n,a)=>({type:n,values:t.reduce((i,o)=>(_r(o)||i.push(Mr(o[e],r,a)),i),[]),valueFormat:r}),Xa=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];de(i)||(t.set(a,i),r.delete(a))}if(r.size===0)break}return t},$a=(e,t)=>{const r=[];for(const n of e)if(_r(n)||r.push(n),r.length===t)return r;return r},qa=["x","y"],Vr=new Set(["x","y","ySecondary"]),st=new Set(["color","size","alpha","strokeWidth","lineType"]),Br=e=>Vr.has(e),Wr=e=>st.has(e),Ja=e=>Br(e)||Wr(e);function Ur(e){return e==="secondary"?"ySecondary":"y"}function Za(e,t){return e==="y"?Ur(t):"x"}function Qa(e){return e==="ySecondary"?"y":e}var Yr=(e,t)=>{if(ue(t.group)){const a=k(t.group);if(a!==null)return[a]}const r=new Set([k(t.x),k(t.y)].filter(ue)),n=new Set;for(const a of st){const i=k(t[a]);ue(i)&&(r.has(i)||e.hasVariable(i)&&e.getType(i)==="categorical"&&n.add(i))}return[...n]},lt=(e,t)=>e.hasVariable(we.group)?e.getValues(we.group,{distinct:!0,skipNulls:!0}).length>1:Yr(e,t).some(r=>e.getValues(r,{distinct:!0,skipNulls:!0}).length>1),ut=["none","xs","sm","md","lg","xl","full"],ei={point:ti,line:ri,area:ni,bar:ai,rule:ii,tile:oi},Gr=e=>typeof e=="string"&&ut.includes(e);function ie(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,dataLabels:t.dataLabels}}function ti(e={}){return ie("point",e)}function ri(e={}){return ie("line",e)}function ni(e={}){return ie("area",e)}function ai(e={}){return ie("bar",e)}function ii(e={}){return ie("rule",e)}function oi(e={}){return ie("tile",e)}var zr=["diagonal","dots","crosshatch"],Hr=["tile","stretch"],ct=e=>typeof e=="object"&&e!==null&&"gradient"in e,dt=e=>typeof e=="object"&&e!==null&&"pattern"in e,Kr=e=>typeof e=="object"&&e!==null&&"image"in e,Fe=e=>typeof e!="object"?e:ct(e)?e.stops[0]?.color??"transparent":dt(e)?e.color:e.fallback,si=e=>typeof e=="string"?e:JSON.stringify(e),li=["topLeft","topRight","bottomRight","bottomLeft"],ui=["dimmed","hovered"],ci=["normal","italic","oblique"],di=["none","uppercase","lowercase","capitalize"],fi=["none","underline","line-through"],pi=["butt","round","square"],hi=["miter","round","bevel"],gi=["normal","multiply","screen","overlay","darken","lighten"],yi=["circle","square","diamond","triangle","cross","star","wye"],mi=["fill","stroke","alpha","saturation","blur","brightness","contrast","cornerRadius","strokeWidth","dashArray","lineCap","lineJoin","strokeAlpha","fillAlpha","size","symbol","fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","textDecoration","textOutlineColor","textOutlineWidth","lineHeight","textScale","textColor","offset","gap","length","paddingInline","paddingBlock","padding","margin","shadow","blendMode"],St=1,_t=1e3,Mt="'none' or a shadow object { offsetX, offsetY, blur, color }",xt="a non-negative number of pixels, or an object of those per edge",bi="a non-empty color string, a { light, dark } pair, or a token(...) reference",vi=["top","right","bottom","left"],_e="a color, a { gradient, stops } object, a { pattern, color } object, or an { image, fallback } object",Lt="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",ft=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 Ke=(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=>Ke(a,t));return n.every((a,i)=>a===e[i])?e:n}const r=Object.entries(e).map(([n,a])=>[n,Ke(a,t)]);return r.every(([n,a])=>a===e[n])?e:Object.fromEntries(r)},O=e=>typeof e=="number"&&Number.isFinite(e),g=(e,t)=>({status:"rejected",expected:e,actual:t}),q=e=>{const t=`one of ${e.map(r=>`'${String(r)}'`).join(", ")}`;return r=>e.includes(r)?{status:"accepted",value:r}:g(t,r)},Z=(e,t)=>{if(typeof e=="string")return e.trim().length>0?{status:"accepted",value:e}:g("a non-empty color string",e);if(ft(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}}:g(bi,e)},Ai=(e,t)=>{if(typeof e!="object"||e===null||Oe(e)||ft(e))return Z(e,t);const r=e;if(ct(r)){const n=r.gradient;if(n!=="linear"&&n!=="radial")return g(_e,e);if(!Array.isArray(r.stops)||r.stops.length<2)return g("a gradient with at least two stops",e);const a=[];for(const i of r.stops){if(!O(i.offset)||i.offset<0||i.offset>1)return g("a gradient stop offset in [0, 1]",e);const o=Z(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&&!O(r.angle)?g("a gradient angle in degrees",e):{status:"accepted",value:{gradient:"linear",...r.angle===void 0?{}:{angle:r.angle},stops:a}}}if(dt(r)){if(!zr.includes(r.pattern))return g(_e,e);const n=Z(r.color,t);if(n.status!=="accepted")return n;const a={pattern:r.pattern,color:n.value};if(r.background!==void 0){const i=Z(r.background,t);if(i.status!=="accepted")return i;a.background=i.value}if(r.size!==void 0){if(!O(r.size)||r.size<=0)return g("a pattern size in pixels",e);a.size=r.size}return{status:"accepted",value:a}}if(Kr(r)){if(typeof r.image!="string"||!r.image.startsWith("data:image/"))return g("an image as a data:image URI",e);if(r.fit!==void 0&&!Hr.includes(r.fit))return g(_e,e);if(r.alpha!==void 0&&(!O(r.alpha)||r.alpha<0||r.alpha>1))return g("an image alpha in [0, 1]",e);if(r.size!==void 0&&(!O(r.size)||r.size<=0))return g("an image size in pixels",e);const n=Z(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 g(_e,e)},Rt=e=>{if(O(e)&&e>=0)return{status:"accepted",value:{top:e,right:e,bottom:e,left:e}};if(typeof e!="object"||e===null)return g(xt,e);const t=e,r={};for(const n of vi){const a=t[n];if(a!==void 0){if(!O(a)||a<0)return g(xt,e);r[n]=a}}return{status:"accepted",value:r}},Ei=e=>{if(O(e)&&e>=0)return{status:"accepted",value:e};if(typeof e!="object"||e===null)return g(Lt,e);const t=e,r={};for(const n of li){const a=t[n];if(!O(a)||a<0)return g(Lt,e);r[n]=a}return{status:"accepted",value:r}},Ti={color:Z,paint:Ai,unitInterval:e=>O(e)&&e>=0&&e<=1?{status:"accepted",value:e}:g("a number in [0, 1]",e),pixels:e=>O(e)&&e>=0?{status:"accepted",value:e}:g("a non-negative number of pixels",e),barRadius:e=>Gr(e)||O(e)&&e>=0?{status:"accepted",value:e}:g(`a number of pixels or one of ${ut.map(t=>`'${t}'`).join(", ")}`,e),dashArray:e=>Array.isArray(e)&&e.every(t=>O(t)&&t>=0)?{status:"accepted",value:[...e]}:g("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}:g("a non-empty CSS font-family list",e),fontWeight:e=>O(e)&&e>=St&&e<=_t?{status:"accepted",value:e}:g(`a number in [${St}, ${_t}]`,e),multiplier:e=>O(e)&&e>=0?{status:"accepted",value:e}:g("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 g(Mt,e);const r=e;if(!O(r.offsetX)||!O(r.offsetY)||!O(r.blur)||r.blur<0)return g(Mt,e);const n=Z(r.color,t);return n.status!=="accepted"?n:{status:"accepted",value:{offsetX:r.offsetX,offsetY:r.offsetY,blur:r.blur,color:n.value}}},padding:Rt,margin:Rt,blendMode:q(gi),signedPixels:e=>O(e)?{status:"accepted",value:e}:g("a number of pixels, negative allowed",e),fontStyle:q(ci),textTransform:q(di),textDecoration:q(fi),lineCap:q(pi),lineJoin:q(hi),pointSymbol:q(yi),boxRadius:Ei},$r=["kind","edge","axis","role","position","part"],Oi="#B84737",qr=.4,Pi="sm",Si=2,_i=8,Mi=12,xi=Object.freeze({light:"#F5F1E9",dark:"#1F1E1C"}),Li="#ffffff",Ri=1,wi=24,ki={top:24,right:24,bottom:24,left:24},V={stroke:"color",strokeWidth:"pixels",dashArray:"dashArray"},E={fontFamily:"fontFamily",fontSize:"pixels",fontWeight:"fontWeight",fontStyle:"fontStyle",letterSpacing:"signedPixels",textTransform:"textTransform",textDecoration:"textDecoration",textOutlineColor:"color",textOutlineWidth:"pixels",lineHeight:"multiplier",textColor:"color"},B={...E,paddingInline:"pixels",paddingBlock:"pixels",fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius"},Di={offsetX:0,offsetY:2,blur:4,color:"rgba(14, 14, 52, 0.12)"},Ii={offsetX:0,offsetY:4,blur:6,color:"rgba(14, 14, 52, 0.16)"},Xe=["where","state","layer"],Jr={fill:"paint",stroke:"color",alpha:"unitInterval",fillAlpha:"unitInterval",strokeAlpha:"unitInterval",saturation:"multiplier",blur:"pixels",brightness:"multiplier",contrast:"multiplier",shadow:"shadow",blendMode:"blendMode"},Ci=.3,Fi=10,Ni=1.5,ji=24,Vi=8,_={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}},We={stroke:f("gridLine"),strokeWidth:1},wt={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)"}},kt={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)"}},Dt={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)"}},Ue={...V,length:"pixels"},oe={...E,margin:"margin"},se={...E,offset:"pixels",margin:"margin"},le={gap:"pixels",margin:"margin"},Ye={stroke:"color",strokeWidth:"pixels",offset:"pixels",cornerRadius:"pixels"},It={fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius",paddingInline:"pixels",paddingBlock:"pixels",shadow:"shadow"},Zr=new Map;var Bi=(e=Object.values(Ne))=>{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]},Wi=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},Ui=e=>Zr.get(Qr(e)),Ct=(e,t)=>({x:{select:{target:e,axis:"x"},vocabulary:t},y:{select:{target:e,axis:"y"},vocabulary:t}}),Ft=e=>({select:{target:"dataLabel",role:e},vocabulary:B,children:{inside:{select:{target:"dataLabel",role:e,position:"inside"},vocabulary:B,rest:{textColor:"#FFFFFF"}},outside:{select:{target:"dataLabel",role:e,position:"outside"},vocabulary:B,rest:{..._.dataLabelOutside}}}}),Ne={geom:{select:{target:"geom"},vocabulary:Jr,options:Xe,aesthetics:{fill:"color",stroke:"color",alpha:"alpha"},rest:{alpha:1,strokeAlpha:1,shadow:"none",blendMode:"normal"},dimmed:{alpha:qr},hovered:{shadow:Di},acceptsUnknownKinds:!0},panelBorder:{select:{target:"panelBorder"},vocabulary:{...V,cornerRadius:"pixels"},rest:{...We,dashArray:N.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:{...We,dashArray:N.gridLine.dashed,strokeWidth:0}},y:{select:{target:"gridLine",axis:"y"},vocabulary:V,rest:{...We,dashArray:N.gridLine.dashed}}}},tickLine:{select:{target:"tickLine"},vocabulary:Ue,rest:{strokeWidth:0,length:0},children:{x:{select:{target:"tickLine",axis:"x"},vocabulary:Ue},y:{select:{target:"tickLine",axis:"y"},vocabulary:Ue}}},axisLabel:{select:{target:"axisLabel"},vocabulary:oe,rest:{..._.label,textColor:f("textPrimary")},children:{...Ct("axisLabel",oe),top:{select:{target:"axisLabel",edge:"top"},vocabulary:oe,rest:{margin:{bottom:8}}},bottom:{select:{target:"axisLabel",edge:"bottom"},vocabulary:oe,rest:{margin:{top:4,bottom:16}}},left:{select:{target:"axisLabel",edge:"left"},vocabulary:oe},right:{select:{target:"axisLabel",edge:"right"},vocabulary:oe}}},tickLabel:{select:{target:"tickLabel"},vocabulary:se,rest:{..._.label,textColor:f("textSecondary"),offset:Fi,textOutlineColor:f("graphBackground"),textOutlineWidth:Ni},children:{...Ct("tickLabel",se),top:{select:{target:"tickLabel",edge:"top"},vocabulary:se},bottom:{select:{target:"tickLabel",edge:"bottom"},vocabulary:se},left:{select:{target:"tickLabel",edge:"left"},vocabulary:se,rest:{offset:14}},right:{select:{target:"tickLabel",edge:"right"},vocabulary:se,rest:{offset:14}}}},dataLabel:{select:{target:"dataLabel"},vocabulary:B,rest:{..._.label,textColor:f("textPrimary"),paddingInline:6,paddingBlock:2,cornerRadius:4},children:{aggregate:{select:{target:"dataLabel",role:"aggregate"},vocabulary:B,rest:{..._.dataLabelOutside}},observation:Ft("observation"),category:Ft("category")}},graph:{select:{target:"graph"},vocabulary:{fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"pixels",fontFamily:"fontFamily",fontSize:"pixels",fontWeight:"fontWeight",lineHeight:"multiplier",textColor:"color",textScale:"multiplier",padding:"padding",blendMode:"blendMode"},rest:{fill:f("graphBackground"),strokeWidth:1,stroke:f("graphBorder"),cornerRadius:8,textScale:1,padding:24,blendMode:"normal"}},heading:{select:{target:"heading"},vocabulary:E,rest:{textColor:f("textPrimary")},partWildcard:!0,children:{h1:{select:{target:"heading",part:"h1"},vocabulary:E,rest:{..._.heading}},h2:{select:{target:"heading",part:"h2"},vocabulary:E,rest:{..._.subtitle}}}},caption:{select:{target:"caption"},vocabulary:E,rest:{..._.caption,textColor:f("textPrimary")}},source:{select:{target:"source"},vocabulary:E,rest:{..._.source,textColor:f("textSecondary")},children:{link:{select:{target:"source",part:"link"},vocabulary:E,rest:{..._.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:Ye,rest:{strokeWidth:2,offset:2,cornerRadius:3},partWildcard:!0,children:{hover:{select:{target:"editOutline",part:"hover"},vocabulary:Ye,rest:{stroke:f("editOutlineHover")}},selected:{select:{target:"editOutline",part:"selected"},vocabulary:Ye,rest:{stroke:f("editOutlineSelected")}}}},tooltip:{select:{target:"tooltip"},vocabulary:It,rest:wt,children:{heading:{select:{target:"tooltip",part:"heading"},vocabulary:E,rest:{..._.tooltipHeading,textColor:f("textPrimary")}},label:{select:{target:"tooltip",part:"label"},vocabulary:E,rest:{..._.tooltipRow,textColor:f("textPrimary")}},value:{select:{target:"tooltip",part:"value"},vocabulary:E,rest:{..._.tooltipRow,textColor:f("textSecondary")}},primaryRow:{select:{target:"tooltip",part:"primaryRow"},vocabulary:{fill:"paint"},rest:{fill:f("tooltipPrimaryRow")}}}},headline:{select:{target:"headline"},vocabulary:le,rest:{gap:ji,margin:{bottom:4}}},headlineItem:{select:{target:"headlineItem"},vocabulary:{},children:{number:{select:{target:"headlineItem",part:"number"},vocabulary:E,rest:{fontSize:26,fontWeight:700,lineHeight:1.3,textColor:f("textPrimary")},children:{center:{select:{target:"headlineItem",part:"numberCenter"},vocabulary:E}}},caption:{select:{target:"headlineItem",part:"caption"},vocabulary:E,rest:{fontSize:12,textColor:f("textSecondary")}},label:{select:{target:"headlineItem",part:"label"},vocabulary:E,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:E,rest:{fontSize:12},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:le,rest:{gap:Vi},children:{popover:{select:{target:"legend",part:"popover"},vocabulary:It,rest:wt},top:{select:{target:"legend",edge:"top"},vocabulary:le,rest:{margin:{bottom:8}}},bottom:{select:{target:"legend",edge:"bottom"},vocabulary:le,rest:{margin:{top:16,bottom:10}}},left:{select:{target:"legend",edge:"left"},vocabulary:le,rest:{margin:{right:10}}},right:{select:{target:"legend",edge:"right"},vocabulary:le,rest:{margin:{left:10}}}}},legendItem:{select:{target:"legendItem"},vocabulary:{...E,paddingInline:"pixels",paddingBlock:"pixels",fill:"paint",stroke:"color",strokeWidth:"pixels",cornerRadius:"boxRadius"},rest:{..._.label,textColor:f("textSecondary"),strokeWidth:0,paddingInline:2,paddingBlock:4},children:{swatch:{select:{target:"legendItem",part:"swatch"},vocabulary:{size:"pixels",strokeWidth:"pixels"},rest:{size:12,strokeWidth:2}}}},directLabel:{select:{target:"directLabel"},vocabulary:{...E,stroke:"color",strokeWidth:"pixels",dashArray:"dashArray"},rest:{fontSize:12,fontWeight:500,lineHeight:1.3,textColor:f("textPrimary"),strokeWidth:1,dashArray:N.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:N.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:B,options:["annotation"],rest:{..._.label,textColor:f("textPrimary"),fill:f("differenceLabelBackground"),strokeWidth:1,cornerRadius:4,paddingInline:6,paddingBlock:3}}}},text:{select:{target:"annotation",kind:"text"},vocabulary:{...B,alpha:"unitInterval",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"},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:kt,children:{label:{select:{target:"annotation",kind:"pinnedNumber",part:"label"},vocabulary:{...B,shadow:"shadow"},options:["annotation"],rest:Dt}}},comment:{select:{target:"annotation",kind:"comment"},vocabulary:{fill:"paint",size:"pixels",stroke:"color",strokeWidth:"pixels",shadow:"shadow"},options:["annotation"],rest:kt,children:{label:{select:{target:"annotation",kind:"comment",part:"label"},vocabulary:{...B,shadow:"shadow"},options:["annotation"],rest:Dt}}}}}},Qr=e=>{let t=e.target;for(const r of $r){const n=e[r];n!==void 0&&(t+=`\0${r}:${n}`)}return t},en=e=>{if(Zr.set(Qr(e.select),e),e.children!==void 0)for(const t of Object.values(e.children))en(t)};for(const e of Object.values(Ne))en(e);function Yi(e){return e}var Gi=e=>e.observation?.aesthetics??Ne.geom.aesthetics,tn=e=>e.observation?.sharedPaint===!1?{...e.observation.vocabulary}:{...Jr,...e.observation?.vocabulary},zi=(e,t)=>({select:{target:"geom",kind:e},vocabulary:tn(t),aesthetics:Gi(t),options:t.observation?.options??Xe,...Nt(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??Xe,...Nt(n)}]))}),Nt=e=>({...e?.rest===void 0?{}:{rest:e.rest},...e?.dimmed===void 0?{}:{dimmed:e.dimmed},...e?.hovered===void 0?{}:{hovered:e.hovered}}),$=class{constructor(){this.positionRoles=[],this.identityKey="x-group",this.defaultPosition="identity",this.supportedPositions=ir,this.defaultInteractive=!0,this.aesthetics=[],this.derivedVariables=[],this.highlightStrategy=null,this.supportedCoordTypes=["cartesian","flip"],this.spatialKind="points",this.grid={},this.legend={},this.dataLabelCoordTypes=[],this.isComposite=!1,this.tooltip=[],this.summaries={}}resolveParams(e){return(0,Je.merge)({},this.defaultParams,e.params)}},pt=(e,t)=>{const r=k(t.x);return!r||!["numeric","temporal"].includes(e.getType(r))?e:e.orderBy(r,"asc")},ht=(e,{coordSystem:t})=>{const r=H(e),n=U(e);return!M(r)||!M(n)?null:t.type==="polar"?J(r,n):{x:r,y:n}},jt=.5,pe=e=>({x:0,y:0,width:e.width,height:e.height}),gt=e=>e==="panel-end"?"end":e==="panel-start"?"start":e,he=({box:e,panel:t,orientation:r,placement:n,justify:a,align:i,offset:o,alignOffset:s,labelWidth:l,labelHeight:u})=>{const c=a==="panel-start"||a==="panel-end",p=(r.valueAxis==="x"?e.height:e.width)===0,d={anchor:Ki(a,r.valueDirectionSign),placement:c?"inside":n,offset:o},h={anchor:Xi(i),placement:p?n:"inside",offset:p?s??o:0},y=c?t:e,A=r.valueAxis==="x"?y:e,x=r.valueAxis==="y"?y:e,D=r.valueAxis==="x"?d:h,j=r.valueAxis==="x"?h:d,S=Bt(D,{min:A.x,max:A.x+A.width,halfExtent:l/2}),I=Bt(j,{min:x.y,max:x.y+x.height,halfExtent:u/2});return{x:S,y:I,position:Hi(e,S,I,l,u)}},Vt=(e,t,r,n)=>r-n>=e-jt&&r+n<=t+jt,Hi=(e,t,r,n,a)=>{if(e.width===0&&e.height===0)return"outside";const i=e.width===0||Vt(e.x,e.x+e.width,t,n/2),o=e.height===0||Vt(e.y,e.y+e.height,r,a/2);return i&&o?"inside":"outside"},Ki=(e,t)=>e==="center"?"center":(e==="end"||e==="panel-end")==(t===1)?"max":"min",Xi=e=>e==="center"?"center":e==="start"?"min":"max",Bt=({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},$i=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=Zi(e.layer);for(const a of e.layer.data){const i=H(a),o=G(a)??U(a);if(i===null||o===null||!Ce(i,o))continue;const s=e.formatLabel(a);if(s==="")continue;const{width:l,height:u}=e.measureDataLabel("observation","outside",s),{box:c,orientation:p}=Ji(o,Y(a),i,e.panelRect.width,e.panelRect.height),d=he({box:c,panel:pe(e.panelRect),orientation:p,...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:"outside"})}return{labels:t,droppedCount:0}},qi=e=>e.position==="fill"?"fill":ce(e.position)?"stack":"none",Ji=(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}}},Zi=e=>{const{position:t,justify:r,align:n}=e.dataLabels;return t==="auto"?{placement:"outside",justify:"end",align:"center"}:{placement:t,justify:lt(e.data,e.mapping)?gt(r):r,align:n}},Qi=class extends ${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:Ci,strokeWidth:2,dashArray:N.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=qi,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=ht,this.getDataLabelPlacements=t=>$i(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(b.yMin)||(e=e.addConstantVariable(b.yMin,"numeric",0)),{data:e,mapping:{}}}},rn=.7,eo=.1,to=.03,ro=.05,nn=e=>{const t=e[et.role];return t??"solo"},yt=(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")}}},Me=6,no=.5,ao=e=>{const t=[];let r=0;const n=ce(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,styleReaders:e.styleReaders,formatLabel:e.formatLabel,isFlipped:a});for(const s of i){const l=e.layer.dataLabels.position==="auto"?uo({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}):fo(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:s.backdropColor}:{}})}}if(e.layer.dataLabels.showCategoryLabels)for(const i of po(e,n))t.push(i);if(e.layer.dataLabels.showStackTotals){const i=mo({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}},io=e=>e.position==="fill"?"fill":ce(e.position)?"stack":"absoluteGrandTotal",oo=({layer:e,mainAxis:t,panelRect:r,measureDataLabel:n,styleReaders:a,formatLabel:i,isFlipped:o})=>{const s=[];let l=!1;const u=e.dataLabels.position==="auto",c=k(e.mapping.y);for(const p of e.data){const d=on(t,p);if(d===null)continue;const h=i(p);if(h==="")continue;const y=yt(n,"observation",h),A=mt(d,r);u&&y.inside.width>A.width&&(l=!0);const x=c===null?null:p[c],D=M(x)&&x<0;s.push({isNegative:D,text:h,boxes:y,bounds:A,backdropColor:Fe(a.get("fill",p))})}return{entries:s,shouldRotate:!o&&l}},mt=(e,t)=>({x:e.x*t.width,y:e.y*t.height,width:e.width*t.width,height:e.height*t.height}),an=(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}},on=(e,t)=>{const r=K(t),n=X(t),a=Y(t),i=G(t)??U(t);return r===null||n===null||a===null||i===null?null:an(e,r,n,a,i)},so=(e,t)=>{const{xMin:r,xMax:n,yMin:a,yMax:i}=t.anchor;return an(e,r,n,a,i)},lo=(e,t)=>e==="x"?t?"bottom":"top":t?"left":"right",$e=(e,t,r)=>r?{width:t,height:e}:{width:e,height:t},uo=e=>e.isStacked?ho({bounds:e.bounds,box:e.boxes.inside,isRotated:e.shouldRotate}):yo({edge:lo(e.mainAxis,e.isNegativeBar),bounds:e.bounds,boxes:e.boxes,isRotated:e.shouldRotate,panelWidth:e.panelWidth,panelHeight:e.panelHeight,offset:e.offset}),sn=(e,t)=>e==="x"?{valueAxis:"y",valueDirectionSign:t?1:-1}:{valueAxis:"x",valueDirectionSign:t?-1:1},co=e=>e==="panel-start"||e==="panel-end",fo=(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=he({box:n.bounds,panel:a,orientation:sn(t,n.isNegative),placement:i,justify:e.justify,align:e.align,offset:e.offset,labelWidth:o.width,labelHeight:o.height});if(i==="inside"&&!co(e.justify)){const l=t==="y",u=l?n.bounds.width:n.bounds.height;return(l?o.width:o.height)>u+no?null:{x:s.x,y:s.y,isRotated:!1,position:"inside"}}return{x:s.x,y:s.y,isRotated:!1,position:s.position}},po=(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),c=k(e.layer.mapping.y);for(const p of e.layer.data){const d=on(l,p);if(d===null)continue;const h=e.formatCategory(p);if(h===null||h==="")continue;const y=yt(e.measureDataLabel,"category",h),A=y[s],x=mt(d,e.panelRect),D=c===null?null:p[c],j=M(D)&&D<0,S=he({box:x,panel:u,orientation:sn(l,j),placement:s,justify:a,align:i,offset:o,labelWidth:A.width,labelHeight:A.height}),I=y[S.position];r.push({layerId:e.layer.id,x:S.x,y:S.y,text:h,width:I.width,height:I.height,isRotated:!1,role:"category",position:S.position})}return r},ho=({bounds:e,box:t,isRotated:r})=>{const n=$e(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"}},go=(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}}},yo=({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,c=s?t.height:t.width,p=s?t.width:t.height,{edgeCoord:d,outwardSign:h,panelExtent:y}=go(e,t,a,i),A=$e(r.inside.width,r.inside.height,n),x=s?A.height:A.width,D=s?A.width:A.height,j=x+o<c,S=D<=p;if(s?j:j&&S){if(s&&!S)return null;if(n)return{x:l,y:u,isRotated:!0,position:"inside"};const Pe=d-h*(x/2+o);return{...s?{x:l,y:Pe}:{x:Pe,y:u},isRotated:!1,position:"inside"}}const I=$e(r.outside.width,r.outside.height,n),T=(s?I.height:I.width)/2,P=d+h*(T+o);return P-T<0||P+T>y?null:{...s?{x:l,y:P}:{x:P,y:u},isRotated:n,position:"outside"}},mo=({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=mt(so(t,l),r),c=a(l.total),{width:p,height:d}=n("aggregate","outside",c),h=l.anchor.direction==="positive";let y,A;s?(y=h?u.x+u.width+Me+p/2:u.x-Me-p/2,A=u.y+u.height/2):(y=u.x+u.width/2,A=h?u.y-Me-d/2:u.y+u.height+Me+d/2),i.push({layerId:e.id,x:y,y:A,text:c,width:p,height:d,isRotated:!1,role:"aggregate",position:"outside"})}return i};function ln(e){return{startAngle:e[b.xMin],endAngle:e[b.xMax]}}function un(e){return{innerRadius:e[b.yMin],outerRadius:e[b.yMax]??e[b.y]}}var bo=" · ",Ge=2,vo=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"?"inside":"outside",l=e.panelRect.width/2,u=e.panelRect.height/2,c=Math.min(e.panelRect.width,e.panelRect.height)/2,p=e.styleReaders;for(const d of e.layer.data){const{startAngle:h,endAngle:y}=ln(d),{innerRadius:A,outerRadius:x}=un(d);if(h===null||y===null||x===null)continue;const D=e.formatLabel(d);if(D==="")continue;const j=o?e.formatCategory(d):null,S=j===null?D:`${j}${bo}${D}`,I={startAngle:h,endAngle:y,midAngle:(h+y)/2,innerRadiusPx:(A??0)*c,outerRadiusPx:x*c};let T,P;if(r==="auto"){const ge=e.measureDataLabel("observation",s,S);P={width:ge.width,height:ge.height},T=Wt({wedge:I,position:s,offset:i,labelWidth:P.width,labelHeight:P.height});const Se=l+Math.sin(T.labelAngle)*T.labelRadius,Pn=u-Math.cos(T.labelAngle)*T.labelRadius;if(T.position==="outside"&&!To({x:Se,y:Pn,labelWidth:P.width,labelHeight:P.height,panelRect:e.panelRect})){const bt=e.measureDataLabel("observation","inside",S);P={width:bt.width,height:bt.height},T=Wt({wedge:I,position:"inside",offset:i,labelWidth:P.width,labelHeight:P.height})}}else{const ge=yt(e.measureDataLabel,"observation",S),Se=ge[r];T=Oo({wedge:I,placement:r,justify:gt(n),align:a,offset:i,labelWidth:Se.width,labelHeight:Se.height}),P=ge[T.position]}const Pe=l+Math.sin(T.labelAngle)*T.labelRadius,On=u-Math.cos(T.labelAngle)*T.labelRadius;t.push({layerId:e.layer.id,x:Pe,y:On,text:S,width:P.width,height:P.height,isRotated:!1,role:"observation",position:T.position,...T.position==="inside"?{backdropColor:Fe(p.get("fill",d))}:{}})}return{labels:t,droppedCount:0}},Ao=()=>"absoluteGrandTotal",Ae=(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)},Eo=({wedge:e,labelRadius:t,labelAngle:r,labelWidth:n,labelHeight:a})=>{const i=Ae("radial",r,n,a);if(!(t-i>=e.innerRadiusPx-Ge&&t+i<=e.outerRadiusPx+Ge)||t<=0)return!1;const o=Math.abs(e.endAngle-e.startAngle)/2,s=Ae("tangential",r,n,a)/t,l=Ge/t;return Math.abs(r-e.midAngle)+s<=o+l},To=({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,Wt=({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+Ae("radial",e.midAngle,n,a),labelAngle:e.midAngle,position:"outside"},Oo=({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+Ae("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 p=e.innerRadiusPx-l;u=p>=0?p:e.innerRadiusPx+l}let c=s;if(n!=="center"&&u>0){const p=Ae("tangential",s,i,o)/u;c=s+(n==="start"?1:-1)*p}return{labelRadius:u,labelAngle:c,position:Eo({wedge:e,labelRadius:u,labelAngle:c,labelWidth:i,labelHeight:o})?"inside":"outside"}},Po=class extends ${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:Ii}}},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=>ce(t)?{justify:"center"}:{},this.resolveBandFraction=(t,r)=>qe(t,r.type),this.resolveAnchorPosition=(t,{coordSystem:r,position:n,purpose:a,align:i})=>{if(i!==void 0){const p=ar(t,r);return p===null?null:tt(p,i)}if(r.type==="polar")return So(t);const o=ce(n),s={isSolo:!o||nn(t)==="solo",isNegative:o&&_o(t),purpose:a};if(r.mainAxis==="x"){const p=K(t),d=X(t),h=Ut({lowerBound:Y(t),upperBound:G(t)??U(t),options:s});return p===null||d===null||h===null?null:{x:(p+d)/2,y:h}}const l=Y(t),u=G(t),c=Ut({lowerBound:K(t),upperBound:X(t)??H(t),options:s});return l===null||u===null||c===null?null:{x:c,y:(l+u)/2}},this.getDataLabelPlacements=t=>t.coordSystem.type==="polar"?vo(t):ao(t),this.resolvePercentageValueStrategy=(t,r)=>r==="polar"?Ao():io(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=qe(r,n);e=pt(e,t),e.hasVariable(b.yMin)||(e=e.addConstantVariable(b.yMin,"numeric",0));const i=a/2;return e=e.addConstantVariable(b.xMin,"numeric",-i).addConstantVariable(b.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}},qe=({width:e},t)=>e!==void 0?e:t==="polar"?1:rn,So=e=>{const t=K(e),r=X(e),n=Y(e),a=G(e);return t===null||r===null||n===null||a===null?null:J((t+r)/2,(n+a)/2)},_o=e=>{const t=nr(e);return M(t)&&t<0},Ut=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},Mo=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=xo(e.layer);for(const a of e.layer.data){const i=H(a),o=U(a);if(i===null||o===null||!Ce(i,o))continue;const s=e.formatLabel(a);if(s==="")continue;const{width:l,height:u}=e.measureDataLabel("observation","outside",s),c=he({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:c.x,y:c.y,text:s,width:l,height:u,isRotated:!1,role:"observation",position:c.position})}return{labels:t,droppedCount:0}},xo=e=>{const{position:t,justify:r,align:n}=e.dataLabels;return t==="auto"?{placement:"outside",justify:"end",align:"center"}:{placement:t,justify:lt(e.data,e.mapping)?gt(r):r,align:n}},Lo=class extends ${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:N.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=ht,this.getDataLabelPlacements=t=>Mo(t)}compile(e){return{data:pt(e.data,e.mapping),mapping:{}}}},Ro=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{offset:r}=e.layer.dataLabels,n=wo(e.layer),a=n.justify==="panel-start"||n.justify==="panel-end",i=e.styleReaders;for(const o of e.layer.data){const s=H(o),l=U(o);if(s===null||l===null||!Ce(s,l))continue;const u=e.formatLabel(o);if(u==="")continue;const{width:c,height:p}=e.measureDataLabel("observation","outside",u),d=i.get("size",o)/2,h=he({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+d,alignOffset:r+d,labelWidth:c,labelHeight:p});t.push({layerId:e.layer.id,x:h.x,y:h.y,text:u,width:c,height:p,isRotated:!1,role:"observation",position:h.position})}return{labels:t,droppedCount:0}},wo=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}},ko=class extends ${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=ht,this.resolveValueSource=(t,r)=>{if(r!=="label")return null;const n=k(t.size);return n!==null?{variable:n}:null},this.getDataLabelPlacements=t=>Ro(t)}compile({data:e}){return{data:e,mapping:{}}}},Do=class extends ${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:N.rule,aesthetics:{stroke:"color",strokeWidth:"strokeWidth",dashArray:"lineType"},rest:{stroke:f("ruleLine"),strokeWidth:1,dashArray:N.rule.dashed}},parts:{label:{vocabulary:E,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")||M(be(t.x)),a=r.has("y")||M(be(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=Yt(t.y,e);if(r!==null)return{data:new ee({[ye.y]:{type:"numeric",values:[r.value],valueFormat:r.sourceFormat}}),mapping:{y:ye.y,x:void 0}};const n=Yt(t.x,e);return n!==null?{data:new ee({[ye.x]:{type:"numeric",values:[n.value],valueFormat:n.sourceFormat}}),mapping:{x:ye.x,y:void 0}}:{data:new ee,mapping:{x:void 0,y:void 0}}}},Yt=(e,t)=>{const r=be(e);if(M(r))return{value:r,sourceFormat:void 0};const n=k(e);if(n===null||!zn(n)||!t.hasVariable(n))return null;const[a]=t.getValues(n);return M(a)?{value:a,sourceFormat:t.getValueFormat(n)}:null};function cn(e){return e[ae.color]}function Io(e){return e[ae.alpha]}function Co(e){return e[ae.size]}function Fo(e){return e[ae.strokeWidth]}function No(e){return e[ae.lineType]}var dn=e=>{const t=K(e),r=X(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}},fn=e=>{const t=dn(e);if(!t)return null;const r=t.width*to,n=t.height*ro;return{x:t.x+r,y:t.y+n,width:t.width-r*2,height:t.height-n*2}},pn=e=>!!cn(e),hn=e=>pn(e)?fn(e):null,Gt=4,jo=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=hn(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+Gt>l||s+Gt>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:Fe(r.get("fill",n))})}return{labels:t,droppedCount:0}},Vo=e=>{const t=k(e.color);return t!==null?{variable:t}:null},Bo=class extends ${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=Vo,this.resolveAnchorPosition=t=>{const r=K(t),n=X(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=>jo(t)}compile({data:e}){return{data:e.addConstantVariable(b.xMin,"numeric",-.5).addConstantVariable(b.xMax,"numeric",.5).addConstantVariable(b.yMin,"numeric",-.5).addConstantVariable(b.yMax,"numeric",.5),mapping:{}}}},gn=[new Po,new ko,new Lo,new Qi,new Do,new Bo],Wo=class extends ot{constructor(){super("geom");for(const e of gn)this.register(e.type,e)}},yn=class{compute(e){return e.data.size()===0?{data:e.data,mapping:{}}:this.computeStat(e)}},Uo=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)}},Yo={numeric:{type:"decimal"},categorical:{type:"text"},temporal:{type:"datetime"}},Go=class{constructor(){this.transformType="constant"}apply(e,t){const{options:r}=t,n=it(r.value,Yo[r.type],Te);if(r.value!==null&&n===null)throw new re({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]}},zo=class{constructor(){this.transformType="filter"}apply(e,t){const{options:r}=t;return e.filter(r.variableName,r.operator,r.value)}},Ho=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"]}},Ko=class{constructor(){this.transformType="sort"}apply(e,t){const{options:r}=t;return e.orderBy(r.variableName,r.direction??"asc")}},Xo=[new Uo,new Go,new zo,new Ho,new Ko],$o=class extends ot{constructor(){super("transform");for(const e of Xo)this.register(e.transformType,e)}};function mn(e){if("definition"in e)return e.definition;if(bn(e)||vn(e)||An(e))return e}function qo(e){const t=[],r=[],n=[];for(const a of e){const i=mn(a);i&&(bn(i)?t.push(i):vn(i)?r.push(i):An(i)&&n.push(i))}return{geoms:t,stats:r,transforms:n,warnings:[...ze("geom",t,a=>a.type),...ze("stat",r,a=>a.type),...ze("transform",n,a=>a.transformType),...Jo(t),...Zo(t)]}}function Jo(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 Zo(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 ze(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 bn=e=>e instanceof $,vn=e=>e instanceof yn,An=e=>"transformType"in e&&typeof e.apply=="function",Qo=["brick","gray","red","orange","yellow","green","cyan","blue","purple","pink"],es=["cyan","pink","purple","red","orange","yellow","green","blue"],En=["#B84737","#BA7420","#0B8666","#3D63A8","#DD9583","#E2BF6B","#95CBA6","#AABCE5"],Tn="brick",F={red:"#E83562",orange:"#F38650",yellow:"#FBBC30",green:"#31FCB4",cyan:"#40F8FF",blue:"#279EFF",purple:"#B399FD",dark_purple:"#6D48D2",plum:"#C82184",pink:"#FC8497"},ts=[F.purple,F.pink,F.yellow,F.blue,F.red,F.cyan,F.orange,F.plum,F.green,F.dark_purple],C={green:"#B2DDC9",cyan:"#A2D5E2",blue:"#AAC4FF",purple:"#B2A4FF",plum:"#DCA8C7",pink:"#FFCCD3",red:"#FFADAD",orange:"#FFDEB4",yellow:"#FDF7C3"},rs=[C.green,C.purple,C.red,C.cyan,C.pink,C.blue,C.orange,C.plum,C.yellow],Ee={brick900:"#6E0500",brick800:"#881D11",brick700:"#A03522",brick600:"#B0523B",brick500:"#C06D56",brick400:"#CE8772",brick300:"#DBA28E",brick200:"#E7BDAC",brick100:"#F2D8CB",brick50:"#FCF4EA",gray900:"#1c1917",gray800:"#292524",gray700:"#44403c",gray600:"#57534e",gray500:"#78716c",gray400:"#a8a29e",gray300:"#d6d3d1",gray200:"#e7e5e4",gray100:"#f5f5f4",gray50:"#fafaf9",red900:"#7f1d1d",red800:"#991b1b",red700:"#b91c1c",red600:"#dc2626",red500:"#ef4444",red400:"#f87171",red300:"#fca5a5",red200:"#fecaca",red100:"#fee2e2",red50:"#fef2f2",orange900:"#7c2d12",orange800:"#9a3412",orange700:"#c2410c",orange600:"#ea580c",orange500:"#f97316",orange400:"#fb923c",orange300:"#fdba74",orange200:"#fed7aa",orange100:"#ffedd5",orange50:"#fff7ed",yellow900:"#553B0C",yellow800:"#6F4B08",yellow700:"#8D6300",yellow600:"#BD8A00",yellow500:"#E5B400",yellow400:"#FFC800",yellow300:"#FBDA2B",yellow200:"#FEED72",yellow100:"#FEF8B4",yellow50:"#FEFCE2",green900:"#064e3b",green800:"#065f46",green700:"#047857",green600:"#059669",green500:"#10b981",green400:"#34d399",green300:"#6ee7b7",green200:"#a7f3d0",green100:"#d1fae5",green50:"#ecfdf5",cyan900:"#164e63",cyan800:"#155e75",cyan700:"#0e7490",cyan600:"#0891B2",cyan500:"#06b6d4",cyan400:"#22d3ee",cyan300:"#67e8f9",cyan200:"#a5f3fc",cyan100:"#cffafe",cyan50:"#ecfeff",blue900:"#1e3a8a",blue800:"#1e40af",blue700:"#1d4ed8",blue600:"#2563eb",blue500:"#3b82f6",blue400:"#60a5fa",blue300:"#93c5fd",blue200:"#bfdbfe",blue100:"#dbeafe",blue50:"#eff6ff",purple900:"#4c1d95",purple800:"#5b21b6",purple700:"#6d28d9",purple600:"#7c3aed",purple500:"#8b5cf6",purple400:"#a78bfa",purple300:"#c4b5fd",purple200:"#ddd6fe",purple100:"#ede9fe",purple50:"#f5f3ff",pink900:"#751A5E",pink800:"#8F1972",pink700:"#AF1C8A",pink600:"#D326A8",pink500:"#E845BF",pink400:"#F979D9",pink300:"#FCABE8",pink200:"#FED0F3",pink100:"#FFE8F9",pink50:"#FFF4FC"},ns=[Ee.brick100,Ee.brick900],as=[Ee.gray200,C.green,C.red,Ee.gray200],zt={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]}},w={cyan:"#22D3EE",pink:"#F377EF",purple:"#6528F7",red:"#FB2576",orange:"#FF9300",yellow:"#FBFF00",green:"#06FF00",blue:"#0079FF"},xe=[w.cyan,w.pink,w.purple,w.red,w.orange,w.yellow,w.green,w.blue],is=[w.cyan,w.green,w.red,w.cyan],Le={start:"#84D1FC",positive:"#84FC89",negative:"#FC8497",total:"#84D1FC"},os=[Le.start,Le.positive,Le.negative,Le.total],ss={transform:"linear",reverse:!1,nice:!0,domainMin:null,domainMax:null,range:null,scheme:null,interpolate:"lab",domainMid:null,symmetric:!1},ls={size:[4,20],alpha:[.1,1],strokeWidth:[1,4]},us={domainMin:null,domainMax:null,nice:!1,reverse:!1},cs={range:null,domain:null,padding:.1,reverse:!1},Ht={palette:{type:"default"}};function Kt(e,t="light",r){return((r!==void 0?zt[t][r]:void 0)??zt[t].default).map(n=>Ee[`${e}${n}`])}function ds(e){const t=xe.indexOf(w[e]);return t<=0?xe:[...xe.slice(t),...xe.slice(0,t)]}function fs(e,t={}){switch(e.type){case"default":return t.hasTouchingGeoms?Kt(Tn,t.colorScheme??"light",t.groupCount):En;case"graphy":return e.variant==="waterfall"?os:ts;case"pastel":return e.variant==="waterfall"?as:rs;case"neon":return e.variant==="waterfall"?is:ds(e.base);case"mono":return Kt(e.base,e.variant??"light",t.groupCount);case"custom":return e.colors}}function ps(e,t){if(!t)return e;const r=[...e];for(const[n,a]of Object.entries(t)){const i=Number(n);if(!Number.isInteger(i)||i<1)continue;const o=i-1;o<r.length&&(r[o]=a)}return r}function hs(e,t,r,n){if(!t)return;const a=r?.type==="custom"?n[r.id]:void 0,i={};for(const[o,s]of Object.entries(t)){const l=Number(o);if(!(!Number.isInteger(l)||l<1)){if(s.hex!==void 0){i[l]=s.hex;continue}if(s.id!==void 0){const u=a?.find(c=>c.id===s.id)?.hex;u!==void 0?i[l]=u:e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Palette override at slot ${l} with id '${s.id}' did not resolve against the active palette — falling back to palette color.`,context:{requested:s.id,available:a?.map(c=>c.id)??[]},suggestion:"Define the override id in the active custom palette, or use a hex value instead."})}}}return Object.keys(i).length>0?i:void 0}function gs(e,t,r){if(!t)return Ht.palette;if(t.type==="custom"){const n=r[t.id];if(!n)return e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Custom palette with id "${t.id}" not found — falling back to the default palette.`,context:{requested:t.id,available:Object.keys(r)},suggestion:"Register the palette in customPalettes, or reference an existing palette id."}),Ht.palette;const a=n.map(i=>i.hex);return{type:"custom",id:t.id,colors:a}}return t}function ys(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,scheme:r.scheme??null,interpolate:r.interpolate,domainMid:r.domainMid??null,symmetric:r.symmetric}}function ms(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 bs(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"discrete",range:t.range,domain:t.domain??null,padding:t.padding,reverse:t.reverse}}function vs(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"identity"}}function As(e,t){return{type:"scale",scaledAesthetic:e,scaleType:"inferred",options:t}}function Es(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"palette",palette:t.palette,overrides:t.overrides}}var Ts={labelCrossPosition:.5},Os={kind:"rectangle",zOrder:"foreground"},Ps={zOrder:"foreground",fit:"contain"},Ss={x:8,y:8,unit:"px"},_s={align:"center"},Ms={startArrowheadStyle:"none",endArrowheadStyle:"line-arrow"},xs={thin:2,medium:4,thick:8},Ls=.5,Rs={strokeWidth:2,shadow:{offsetX:0,offsetY:1.15,blur:1.15,color:"rgba(0, 0, 0, 0.16)"}},ws={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}}},ks={differenceArrow:"differenceArrows",shape:"shapes",arrow:"arrows",text:"textAnnotations",image:"images",sticker:"stickers",pinnedNumber:"pinnedNumbers",comment:"comments"},Ds={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 ks}});Object.defineProperty(exports,"ARROW_DEFAULTS",{enumerable:!0,get:function(){return Ms}});Object.defineProperty(exports,"ARROW_STICKER_DECLARATIONS",{enumerable:!0,get:function(){return Rs}});Object.defineProperty(exports,"ARROW_STROKE_WIDTHS_PX",{enumerable:!0,get:function(){return xs}});Object.defineProperty(exports,"AXIS_KEYS",{enumerable:!0,get:function(){return qa}});Object.defineProperty(exports,"BAR_GROUP_SCALE_PADDING_FRACTION",{enumerable:!0,get:function(){return eo}});Object.defineProperty(exports,"BAR_WIDTH_FRACTION",{enumerable:!0,get:function(){return rn}});Object.defineProperty(exports,"BORDER_RADIUS_TOKENS",{enumerable:!0,get:function(){return ut}});Object.defineProperty(exports,"BUILT_IN_GEOMS",{enumerable:!0,get:function(){return gn}});Object.defineProperty(exports,"CONSTANT_VARIABLES",{enumerable:!0,get:function(){return Ze}});Object.defineProperty(exports,"CONTINUOUS_SCALE_DEFAULTS",{enumerable:!0,get:function(){return ss}});Object.defineProperty(exports,"ChronologicalDateManager",{enumerable:!0,get:function(){return cr}});Object.defineProperty(exports,"DASH_PRESETS",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"DATETIME_SCALE_DEFAULTS",{enumerable:!0,get:function(){return us}});Object.defineProperty(exports,"DEFAULT_BAR_CORNER_RADIUS",{enumerable:!0,get:function(){return Pi}});Object.defineProperty(exports,"DEFAULT_COLOR_PALETTE",{enumerable:!0,get:function(){return En}});Object.defineProperty(exports,"DEFAULT_DIMMED_ALPHA",{enumerable:!0,get:function(){return qr}});Object.defineProperty(exports,"DEFAULT_GEOM_COLOR",{enumerable:!0,get:function(){return Oi}});Object.defineProperty(exports,"DEFAULT_GRAPH_BACKGROUND",{enumerable:!0,get:function(){return xi}});Object.defineProperty(exports,"DEFAULT_GRAPH_BORDER_WIDTH_PX",{enumerable:!0,get:function(){return Ri}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_EDGES_PX",{enumerable:!0,get:function(){return ki}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_PX",{enumerable:!0,get:function(){return wi}});Object.defineProperty(exports,"DEFAULT_HEADLINE_SWATCH_SIZE_PX",{enumerable:!0,get:function(){return Mi}});Object.defineProperty(exports,"DEFAULT_HOVER_AFFORDANCE_COLOR",{enumerable:!0,get:function(){return Li}});Object.defineProperty(exports,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return Te}});Object.defineProperty(exports,"DEFAULT_MONO_BASE",{enumerable:!0,get:function(){return Tn}});Object.defineProperty(exports,"DEFAULT_POINT_SIZE_PX",{enumerable:!0,get:function(){return _i}});Object.defineProperty(exports,"DEFAULT_RESHAPE_VALUE_NAME",{enumerable:!0,get:function(){return Cr}});Object.defineProperty(exports,"DEFAULT_SEQUENTIAL_RAMP",{enumerable:!0,get:function(){return ns}});Object.defineProperty(exports,"DEFAULT_STROKE_WIDTH_PX",{enumerable:!0,get:function(){return Si}});Object.defineProperty(exports,"DIFFERENCE_ARROW_DEFAULTS",{enumerable:!0,get:function(){return Ts}});Object.defineProperty(exports,"DIFFERENCE_ARROW_SIZE_DECLARATIONS",{enumerable:!0,get:function(){return ws}});Object.defineProperty(exports,"DISCRETE_SCALE_DEFAULTS",{enumerable:!0,get:function(){return cs}});Object.defineProperty(exports,"DataCompiler",{enumerable:!0,get:function(){return za}});Object.defineProperty(exports,"Dataset",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"GROUP_VARIABLES",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"Geom",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"GeomRegistry",{enumerable:!0,get:function(){return Wo}});Object.defineProperty(exports,"IMAGE_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return Ps}});Object.defineProperty(exports,"IS_DEV",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"InternalError",{enumerable:!0,get:function(){return R}});Object.defineProperty(exports,"LAYER_LABEL_VARIABLES",{enumerable:!0,get:function(){return Un}});Object.defineProperty(exports,"LINE_TYPES",{enumerable:!0,get:function(){return or}});Object.defineProperty(exports,"MONO_BASES",{enumerable:!0,get:function(){return Qo}});Object.defineProperty(exports,"NEON_BASES",{enumerable:!0,get:function(){return es}});Object.defineProperty(exports,"NON_POSITION_RANGE_DEFAULTS",{enumerable:!0,get:function(){return ls}});Object.defineProperty(exports,"POLAR_RIM_LABEL_GAP_PX",{enumerable:!0,get:function(){return Cn}});Object.defineProperty(exports,"POSITION_ADJUSTMENTS",{enumerable:!0,get:function(){return ir}});Object.defineProperty(exports,"POSITION_VARIABLES",{enumerable:!0,get:function(){return b}});Object.defineProperty(exports,"Registry",{enumerable:!0,get:function(){return ot}});Object.defineProperty(exports,"SCALED_POSITION_AESTHETIC_KEYS",{enumerable:!0,get:function(){return Vr}});Object.defineProperty(exports,"SCALED_VISUAL_AESTHETIC_KEYS",{enumerable:!0,get:function(){return st}});Object.defineProperty(exports,"SELECTION_PADDING_DEFAULT",{enumerable:!0,get:function(){return Ss}});Object.defineProperty(exports,"SHAPE_DEFAULTS",{enumerable:!0,get:function(){return Os}});Object.defineProperty(exports,"STACK_VARIABLES",{enumerable:!0,get:function(){return et}});Object.defineProperty(exports,"STAT_VARIABLES",{enumerable:!0,get:function(){return Qe}});Object.defineProperty(exports,"STYLE_DOMAINS",{enumerable:!0,get:function(){return Ti}});Object.defineProperty(exports,"STYLE_IMAGE_FITS",{enumerable:!0,get:function(){return Hr}});Object.defineProperty(exports,"STYLE_PATTERN_PRESETS",{enumerable:!0,get:function(){return zr}});Object.defineProperty(exports,"STYLE_PROPERTY_NAMES",{enumerable:!0,get:function(){return mi}});Object.defineProperty(exports,"STYLE_SELECT_KEYS",{enumerable:!0,get:function(){return $r}});Object.defineProperty(exports,"STYLE_STATES",{enumerable:!0,get:function(){return ui}});Object.defineProperty(exports,"STYLE_TARGETS",{enumerable:!0,get:function(){return Ne}});Object.defineProperty(exports,"SUFFIX_MULTIPLIERS",{enumerable:!0,get:function(){return dr}});Object.defineProperty(exports,"Stage",{enumerable:!0,get:function(){return kr}});Object.defineProperty(exports,"Stat",{enumerable:!0,get:function(){return yn}});Object.defineProperty(exports,"TAU",{enumerable:!0,get:function(){return W}});Object.defineProperty(exports,"TEXT_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return _s}});Object.defineProperty(exports,"TEXT_ANNOTATION_FADE_ALPHA",{enumerable:!0,get:function(){return Ls}});Object.defineProperty(exports,"TransformRegistry",{enumerable:!0,get:function(){return $o}});Object.defineProperty(exports,"UserInputError",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"VISUAL_VARIABLES",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"VizError",{enumerable:!0,get:function(){return rt}});Object.defineProperty(exports,"__toESM",{enumerable:!0,get:function(){return wn}});Object.defineProperty(exports,"alignToBoxPoint",{enumerable:!0,get:function(){return tt}});Object.defineProperty(exports,"alignUnitFractions",{enumerable:!0,get:function(){return Xn}});Object.defineProperty(exports,"annotation",{enumerable:!0,get:function(){return Ds}});Object.defineProperty(exports,"applyOverrides",{enumerable:!0,get:function(){return ps}});Object.defineProperty(exports,"areDataValuesEqual",{enumerable:!0,get:function(){return ka}});Object.defineProperty(exports,"areMappingsEquivalent",{enumerable:!0,get:function(){return ea}});Object.defineProperty(exports,"buildLayerSpec",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"buildPanelAnchorBox",{enumerable:!0,get:function(){return pe}});Object.defineProperty(exports,"continuous",{enumerable:!0,get:function(){return ys}});Object.defineProperty(exports,"createGeomStyleNode",{enumerable:!0,get:function(){return zi}});Object.defineProperty(exports,"createPerKeyMemo",{enumerable:!0,get:function(){return Rr}});Object.defineProperty(exports,"createSingleSlotMemo",{enumerable:!0,get:function(){return Ra}});Object.defineProperty(exports,"cursorToPiePlane",{enumerable:!0,get:function(){return er}});Object.defineProperty(exports,"cursorToPolar",{enumerable:!0,get:function(){return Wn}});Object.defineProperty(exports,"datetime",{enumerable:!0,get:function(){return ms}});Object.defineProperty(exports,"defineGeomStyleTarget",{enumerable:!0,get:function(){return Yi}});Object.defineProperty(exports,"discrete",{enumerable:!0,get:function(){return bs}});Object.defineProperty(exports,"findStyleTarget",{enumerable:!0,get:function(){return Ui}});Object.defineProperty(exports,"freezeWalkedEntries",{enumerable:!0,get:function(){return Wi}});Object.defineProperty(exports,"geom",{enumerable:!0,get:function(){return ei}});Object.defineProperty(exports,"getAestheticFromScaleAestheticKey",{enumerable:!0,get:function(){return Qa}});Object.defineProperty(exports,"getAlpha",{enumerable:!0,get:function(){return Io}});Object.defineProperty(exports,"getAngleExtent",{enumerable:!0,get:function(){return ln}});Object.defineProperty(exports,"getColor",{enumerable:!0,get:function(){return cn}});Object.defineProperty(exports,"getGroupVariables",{enumerable:!0,get:function(){return Yr}});Object.defineProperty(exports,"getInsetTileRect",{enumerable:!0,get:function(){return fn}});Object.defineProperty(exports,"getLineType",{enumerable:!0,get:function(){return No}});Object.defineProperty(exports,"getPaintedTileRect",{enumerable:!0,get:function(){return hn}});Object.defineProperty(exports,"getRadiusExtent",{enumerable:!0,get:function(){return un}});Object.defineProperty(exports,"getScaledAesthetic",{enumerable:!0,get:function(){return Hn}});Object.defineProperty(exports,"getSize",{enumerable:!0,get:function(){return Co}});Object.defineProperty(exports,"getStableKey",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"getStackRole",{enumerable:!0,get:function(){return nn}});Object.defineProperty(exports,"getStrokeWidth",{enumerable:!0,get:function(){return Fo}});Object.defineProperty(exports,"getTileRectBounds",{enumerable:!0,get:function(){return dn}});Object.defineProperty(exports,"getX",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"getXMax",{enumerable:!0,get:function(){return X}});Object.defineProperty(exports,"getXMin",{enumerable:!0,get:function(){return K}});Object.defineProperty(exports,"getY",{enumerable:!0,get:function(){return U}});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 nr}});Object.defineProperty(exports,"hasMultipleGroups",{enumerable:!0,get:function(){return lt}});Object.defineProperty(exports,"identity",{enumerable:!0,get:function(){return vs}});Object.defineProperty(exports,"inferXVariable",{enumerable:!0,get:function(){return Jn}});Object.defineProperty(exports,"inferred",{enumerable:!0,get:function(){return As}});Object.defineProperty(exports,"isAngleWithinArc",{enumerable:!0,get:function(){return qt}});Object.defineProperty(exports,"isBorderRadiusToken",{enumerable:!0,get:function(){return Gr}});Object.defineProperty(exports,"isCategoricalValueFormat",{enumerable:!0,get:function(){return sr}});Object.defineProperty(exports,"isCompilerCachingEnabled",{enumerable:!0,get:function(){return La}});Object.defineProperty(exports,"isCurrencyValueFormat",{enumerable:!0,get:function(){return ra}});Object.defineProperty(exports,"isDateWithoutYearValueFormat",{enumerable:!0,get:function(){return na}});Object.defineProperty(exports,"isDefined",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"isFullTurnSweep",{enumerable:!0,get:function(){return $t}});Object.defineProperty(exports,"isGradientPaint",{enumerable:!0,get:function(){return ct}});Object.defineProperty(exports,"isImagePaint",{enumerable:!0,get:function(){return Kr}});Object.defineProperty(exports,"isInternalVariable",{enumerable:!0,get:function(){return Gn}});Object.defineProperty(exports,"isLightDarkColor",{enumerable:!0,get:function(){return Oe}});Object.defineProperty(exports,"isLineType",{enumerable:!0,get:function(){return ta}});Object.defineProperty(exports,"isLookupValueFormat",{enumerable:!0,get:function(){return nt}});Object.defineProperty(exports,"isNonEmptyArray",{enumerable:!0,get:function(){return $n}});Object.defineProperty(exports,"isNumericDataValue",{enumerable:!0,get:function(){return In}});Object.defineProperty(exports,"isNumericValueFormat",{enumerable:!0,get:function(){return lr}});Object.defineProperty(exports,"isPatternPaint",{enumerable:!0,get:function(){return dt}});Object.defineProperty(exports,"isPlainObject",{enumerable:!0,get:function(){return qn}});Object.defineProperty(exports,"isPointWithinPanel",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"isPositionScale",{enumerable:!0,get:function(){return Br}});Object.defineProperty(exports,"isScaledAestheticKey",{enumerable:!0,get:function(){return Ja}});Object.defineProperty(exports,"isStackedPosition",{enumerable:!0,get:function(){return ce}});Object.defineProperty(exports,"isStrictCategoricalDataValue",{enumerable:!0,get:function(){return Dn}});Object.defineProperty(exports,"isStrictNumericDataValue",{enumerable:!0,get:function(){return M}});Object.defineProperty(exports,"isStrictTemporalDataValue",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"isStyleTokenRef",{enumerable:!0,get:function(){return ft}});Object.defineProperty(exports,"isTemporalDataValue",{enumerable:!0,get:function(){return kn}});Object.defineProperty(exports,"isTemporalValueFormat",{enumerable:!0,get:function(){return fe}});Object.defineProperty(exports,"isTilePainted",{enumerable:!0,get:function(){return pn}});Object.defineProperty(exports,"isUsableTokenValue",{enumerable:!0,get:function(){return Xr}});Object.defineProperty(exports,"isVisualScale",{enumerable:!0,get:function(){return Wr}});Object.defineProperty(exports,"measureSignedAngularDelta",{enumerable:!0,get:function(){return Vn}});Object.defineProperty(exports,"normalizeAngle",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"paintKey",{enumerable:!0,get:function(){return si}});Object.defineProperty(exports,"palette",{enumerable:!0,get:function(){return Es}});Object.defineProperty(exports,"parseAddressingValue",{enumerable:!0,get:function(){return it}});Object.defineProperty(exports,"parseDataset",{enumerable:!0,get:function(){return jr}});Object.defineProperty(exports,"polarSectorToInscribedSquare",{enumerable:!0,get:function(){return Zt}});Object.defineProperty(exports,"polarToUnit",{enumerable:!0,get:function(){return Jt}});Object.defineProperty(exports,"positionToAngle",{enumerable:!0,get:function(){return Bn}});Object.defineProperty(exports,"prefixInternalVariable",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"readConstantValue",{enumerable:!0,get:function(){return be}});Object.defineProperty(exports,"readFoldKeepVariables",{enumerable:!0,get:function(){return Zn}});Object.defineProperty(exports,"readISOInstant",{enumerable:!0,get:function(){return vr}});Object.defineProperty(exports,"readMainAxisVariable",{enumerable:!0,get:function(){return Qn}});Object.defineProperty(exports,"readObservationBox",{enumerable:!0,get:function(){return ar}});Object.defineProperty(exports,"readObservationVocabulary",{enumerable:!0,get:function(){return tn}});Object.defineProperty(exports,"readPlugins",{enumerable:!0,get:function(){return qo}});Object.defineProperty(exports,"readVariableName",{enumerable:!0,get:function(){return k}});Object.defineProperty(exports,"resolveAnchoredLabelCenter",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"resolveBarBandFraction",{enumerable:!0,get:function(){return qe}});Object.defineProperty(exports,"resolveColorScheme",{enumerable:!0,get:function(){return Ke}});Object.defineProperty(exports,"resolveDefinition",{enumerable:!0,get:function(){return mn}});Object.defineProperty(exports,"resolvePaletteConfig",{enumerable:!0,get:function(){return gs}});Object.defineProperty(exports,"resolvePaletteOverrides",{enumerable:!0,get:function(){return hs}});Object.defineProperty(exports,"resolvePaletteRange",{enumerable:!0,get:function(){return fs}});Object.defineProperty(exports,"resolvePositionScaleAesthetic",{enumerable:!0,get:function(){return Za}});Object.defineProperty(exports,"resolveScaledAestheticVariable",{enumerable:!0,get:function(){return rr}});Object.defineProperty(exports,"resolveYScaleAesthetic",{enumerable:!0,get:function(){return Ur}});Object.defineProperty(exports,"setCompilerCachingEnabled",{enumerable:!0,get:function(){return xa}});Object.defineProperty(exports,"sumMemoStats",{enumerable:!0,get:function(){return wa}});Object.defineProperty(exports,"toExplicitValueFormat",{enumerable:!0,get:function(){return aa}});Object.defineProperty(exports,"toPaintColor",{enumerable:!0,get:function(){return Fe}});Object.defineProperty(exports,"token",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"unitToPolar",{enumerable:!0,get:function(){return Qt}});Object.defineProperty(exports,"walkStyleTargets",{enumerable:!0,get:function(){return Bi}});Object.defineProperty(exports,"wrappedAngularDistance",{enumerable:!0,get:function(){return jn}});
|