@bicharts/chart-mcp 0.6.110 → 0.6.111

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.
@@ -315,6 +315,6 @@ License: MIT
315
315
  .${Gn} .${Ef} text {
316
316
  font-weight: 700 !important;
317
317
  text-decoration: underline !important;
318
- }`,(e.head||e.documentElement)?.appendChild(H)}catch{}},vt=()=>{if(typeof t.marksSelect!="function")return!1;try{return t.marksSelect()===!1}catch{return!1}},ut=()=>{if(!b)try{r.classList?.[vt()?"add":"remove"](IS);let H=G,Q=!!H&&H.length>0,mt=Q&&!Y;r.classList?.[mt?"add":"remove"](xf);let Bt=d.dimOpacity;if(typeof Bt=="number"){let Mo=String(Bt),_o=j7.get(r),no=gj(r);_o?no&&_o.wrote&&!bj(no,_o.wrote)&&(_o.was=no.value?no:null):(_o={was:no?.value?no:null,holders:0,wrote:null},j7.set(r,_o)),C||(_o.holders++,C=!0),_o.wrote={value:Mo,priority:""},r.style?.setProperty(rd,Mo)}else O();let Jt=r.querySelectorAll(`.${Ef}`);for(let Mo of Array.from(Jt))Mo.classList?.remove(Ef);let de=!!X&&(typeof r.contains=="function"?r.contains(X):X.isConnected!==!1);Q&&de&&X.classList?.add(Ef);let Ce=new Set(H??[]),Ze=r.querySelectorAll(`.${vo}[${Hr}], .${zl}[${Hr}]`),Ho=dz(r);if(Ho!=="any-row"){let Mo=Array.from(Ze),_o=yz(Mo.map(no=>({key:Xk(no),rows:dP(no.getAttribute(Hr))})),Q?Ce:[],Ho,bt());if(Mo.forEach((no,So)=>no.classList?.[_o.on[So]?"add":"remove"](jl)),Nt(_o.keys.length?{keys:_o.keys,selection:Array.from(Ce)}:null),Q)try{t.onSelectionPaint?.({rule:Ho,mode:_o.mode,lit:_o.on.filter(Boolean).length,marks:Mo.length,selection:Ce.size})}catch{}return}for(let Mo of Array.from(Ze)){let _o=dP(Mo.getAttribute(Hr)),no=Q&&_o.some(So=>Ce.has(So));Mo.classList?.[no?"add":"remove"](jl)}}catch{}},ne="bic-selection-glyphs",Ot=null,Zt=null,Kt=null,rt="",Ut=!1,Dt=!1,Vt="",zt=()=>`${r.offsetWidth??0}x${r.offsetHeight??0}`,Me=`.${ne}, .${lP}`,He=H=>{let Q=H.target;return!Q||Q.closest?.(Me)?!1:!!(Q.classList?.contains(vo)||Q.querySelector?.(`.${vo}`))},ko=H=>{if(H&&(Dt=!0),Ut)return;Ut=!0;let Q=()=>{let mt=Dt;Ut=!1,Dt=!1,(Zt||Kt)&&le(mt?"if-changed":!1)};o?.requestAnimationFrame?o.requestAnimationFrame(Q):setTimeout(Q,16)},ir=H=>{if(!H){Zt&&(Zt.disconnect(),Zt=null),Kt&&(Kt.disconnect(),Kt=null);return}let Q=o?.MutationObserver;!Zt&&Q&&(Zt=new Q(Bt=>{!Ut&&Bt.some(He)&&ko(!1)}),Zt.observe(r,{subtree:!0,attributes:!0,attributeFilter:["transform","d","x","y","cx","cy","points","width","height","visibility","opacity","style","class"]}));let mt=o?.ResizeObserver;!Kt&&mt&&(Kt=new mt(()=>{zt()!==rt&&ko(!0)}),Kt.observe(r))},Tt=H=>{try{let Q=H.checkVisibility;if(typeof Q=="function")return Q.call(H,{visibilityProperty:!0,opacityProperty:!0})!==!1;let mt=o?.getComputedStyle;if(typeof mt!="function")return!0;let Bt=mt.call(o,H);if(Bt.visibility==="hidden"||Bt.visibility==="collapse")return!1;for(let Jt=H;Jt&&Jt!==r;Jt=Jt.parentElement){let de=Jt===H?Bt:mt.call(o,Jt);if(de.display==="none"||de.opacity!==""&&parseFloat(de.opacity)===0)return!1}}catch{}return!0},ee=()=>{let H=new Map,Q=Bt=>{if(!H.has(Bt)){let Jt=null;try{if((Bt.tagName||"").toLowerCase()==="svg"){let de=Bt.getBoundingClientRect();de.width>0&&de.height>0&&(Jt=de)}else Bt.hasAttribute?.("clip-path")&&(Jt=B7(Bt))}catch{Jt=null}H.set(Bt,Jt)}return H.get(Bt)??null},mt=.5;return(Bt,Jt,de)=>{for(let Ce=Bt;Ce&&Ce!==r;Ce=Ce.parentElement){let Ze=Q(Ce);if(Ze&&(Jt<Ze.left-mt||Jt>Ze.right+mt||de<Ze.top-mt||de>Ze.bottom+mt))return!1}return!0}},le=(H=!0)=>{if(b)return;let Q=!1;try{let mt=r.querySelector(`:scope > .${ne}`);wz(mt);let Bt=d.selectionGlyph;if(Bt!=="dot"&&Bt!=="check"){Vt="";return}if(!(!!G&&G.length>0&&!Y)){Vt="";return}if(d.suppressSelectionGlyph){if(H===!0)try{t.onSelectionGlyphs?.({mode:Bt,drawn:0,total:0,suppressed:!0})}catch{}Vt="";return}if(Q=!0,!mt){mt=e.createElement("div"),mt.className=ne,mt.setAttribute("aria-hidden","true"),Object.assign(mt.style,{position:"absolute",left:"0",top:"0",width:"0",height:"0",overflow:"hidden",pointerEvents:"none",zIndex:"1"});try{let no=o?.getComputedStyle?.(r)?.position||r.style.position;if(!no||no==="static"){let So=r.style.position;r.style.position="relative",Ot===null&&(Ot=So)}}catch{}r.appendChild(mt)}mt.style.width="0",mt.style.height="0";let de=r.scrollWidth||0,Ce=r.scrollHeight||0;mt.style.width=`${de}px`,mt.style.height=`${Ce}px`,rt=zt();let Ze=[];Az(r,mt.getBoundingClientRect(),Ze,{shown:Tt,at:ee()});let Ho=!!d.isHighContrast,Mo=Ze.length?Pz(mt,Ze,{symbol:Bt==="check"?"\u2713":"\u25CF",color:Ho&&d.themeFg||"#111",halo:Ho&&d.themeBg||"#fff"}):0,_o=`${Bt}:${Mo}:${Ze.length}`;if(H===!0||H==="if-changed"&&_o!==Vt){Vt=_o;try{t.onSelectionGlyphs?.({mode:Bt,drawn:Mo,total:Ze.length,suppressed:!1})}catch{}}}catch{}finally{try{ir(Q),Zt?.takeRecords()}catch{}}},be=(H,Q,mt,Bt=!1,Jt=!0,de)=>{if(!b){if(G=H,j=H.length>0&&Bt,K=Jt,Jt&&(ht=H,Z=j),X=H.length?mt??null:null,Y=H.length>0&&Ok(!!mt,Dk(r)),!H.length&&!de?.keepHidden&&(xt=0),at=!0,ut(),le(),W?.refresh(),Jt)for(let Ce of it)try{Ce(H,Q,de)}catch{}nt()}},je=H=>{be(ht,H,void 0,Z,!1),K=!0},mr=H=>{if(Wz(d.lasso)==="highlight"){be(H,"user",null,!0,!1);return}if(be(H,"user",null,!0),k||!H.length)return;let Q=!0;try{Q=t.selectionReachesPage?t.selectionReachesPage()!==!1:it.size>0}catch{}if(!Q){k=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] a lasso circled ${H.length} ${H.length===1?"row":"rows"}, but the page gave this chart no filter to set (no \`selects\` or bindFilter, no chart group), so the lasso only highlights inside the chart and the rest of the page does not follow. To filter the page, pass selects={useBicFilter("<key column>")} to this chart and filter the other charts by that filter; for a highlight on purpose, set lasso.effect to "highlight".`)}catch{}}},Qe=0,dr=150,pr=H=>{let Q=H?.detail||{};if(Qe=Date.now(),Q.clear)!K&&G&&G.length?je(Q.source||"chart"):be([],Q.source||"chart",void 0,!1,!0);else{if(vt())return;Q.mark?be(dP(Q.mark.getAttribute?.(Hr)),Q.source||"chart",Q.mark,!0):Array.isArray(Q.rows)&&be(mz(Q.rows),Q.source||"chart",null,!0,!0,Q.keepHidden===!0?{keepHidden:!0}:void 0)}},jr=Sz({root:r,doc:e,log:()=>{}}),co=()=>{if(G&&G.length){let H=!K,Q=r[iP];if(j&&typeof Q=="function")try{Q()}catch{}H?K||je("user"):G&&G.length&&be([],"user",void 0,!1,!0)}},Pn=null,vc=()=>{let H=Pn;Pn=null;try{H?.destroy()}catch{}},$l=`.${vo}[${Hr}], .${zl}[${Hr}], .${Sc}[${Hr}]`,Nc=H=>{let Q=bz(r,H);if(qk(r),Q)return;let mt=vt();if(r.classList?.[mt?"add":"remove"](IS),mt||Date.now()-Qe<dr||W7(H?.target,r))return;let Bt=jr.findMark(H?.target,$l,H);if(Bt||(Bt=jr.penetrateOverlayAt(H?.clientX,H?.clientY,$l)),Bt||(Bt=jr.resolveByGeometry(H?.clientX,H?.clientY,$l)),!Bt){co();return}let Jt=dP(Bt.getAttribute(Hr));if(!Jt.length)return;let de=Bt.classList?.contains?.(Sc)?Bt:null,Ce=!!(H?.ctrlKey||H?.metaKey||H?.shiftKey),Ze=K?G:ht,Ho=pz(Ze,Jt,{ctrl:!!(H?.ctrlKey||H?.metaKey),shift:!!H?.shiftKey}),Mo=!Ce&&Ho.length===0;Nt(fz(bt(),Ze,Xk(Bt),Ho,{ctrl:!!(H?.ctrlKey||H?.metaKey),shift:!!H?.shiftKey})),be(Ho,"user",Mo?null:de)};r.addEventListener(nP,pr);let xc=gz(r);if(r.addEventListener("click",Nc),F){let H=Q=>{let mt=dP(Q.getAttribute(Hr))[0];return vX(a.columns||[],mt==null?null:a.rows?.[mt],d.cultureCode)};W=NX({container:r,markSelector:$l,pressSelector:`.${em}`,skipSelector:`.${id}, .${ne}, .${lP}`,inert:vt,select:(Q,mt)=>{let Bt=o?.MouseEvent??MouseEvent;Q.dispatchEvent(new Bt("click",{bubbles:!0,cancelable:!0,ctrlKey:mt.ctrl,shiftKey:mt.shift}))},clear:co,isSelected:Q=>!!Q.classList?.contains(jl),labelOf:H,keyOf:Q=>Q.getAttribute(Hr)??""})}r.classList?.add(Gn),st();let Jl=t.fit??!0,el=t.labelContrast??!0,Da=()=>{let H=r[y7];if(typeof H=="function")try{H()}catch{}},li=t.zoomMemory??null,hs=null,Ql="",nm=()=>{if(li)try{li.flush()}catch{}},Ec=()=>{if(li)try{li.release?.(r)}catch{}},Cc=t.restoreScroll!==!1,rl,Zl=()=>{if(t.code)return t.code;if(rl===void 0&&typeof t.renderFn=="function")try{rl=Function.prototype.toString.call(t.renderFn)}catch{return t.renderFn}return rl},kc=!1,Mc=()=>{if(li&&hs)try{li.restore(r,hs,Ql,i)}catch{}try{let mt=pX(r,E);if(mt.collisions.length&&!w){w=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] ids shared with another chart, scoped: ${mt.collisions.slice(0,5).join(", ")}`)}catch{}}t.onIdScope?.(mt)}catch{}if(el!==!1)try{let mt=el===!0?{}:{...el};if(!mt.pageBg){let Jt=d.backgroundColor??d.themeBg;typeof Jt=="string"&&Jt&&(mt.pageBg=Jt)}let Bt=hX(r,mt);t.onLabelContrast?.(Bt)}catch{}if(t.layoutPass)try{t.layoutPass(r)}catch{}oM(r,e),ut();try{let mt=e8(r);if(r8({markCount:mt.markCount,rows:a.rows?a.rows.length:0,animated:t.animated,contractUntagged:t.contractUntagged,declaresNoRowMarks:mt.declaresNoRowMarks})){if(!P){P=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] this chart rendered without error but painted no data marks, against ${a.rows.length} row(s) \u2014 so the container is empty. The usual cause is that the generated code binds a column BY NAME that is no longer in the data, sending it down its own "no data" branch. Check that the columns in your table still match the ones the chart was generated for.`)}catch{}}t.onBlankRender?.({census:mt,rows:a.rows?a.rows.length:0})}}catch{}if(t.onHitBandCensus)try{t.onHitBandCensus(Fz(r,e))}catch{}if(t.onColourSpreadCensus)try{t.onColourSpreadCensus(_j(r,e))}catch{}if(t.onClippedTextCensus)try{t.onClippedTextCensus(aX(r))}catch{}if(t.onValuePlacementCensus)try{t.onValuePlacementCensus(lX(r,a))}catch{}let H=Kz(r);if(Jl!==!1)try{let mt=Jl===!0?{}:Jl,Bt=Yz(r,Cc?{...mt,restoreScroll:{memory:H,key:Zl()}}:mt);t.onFit?.(Bt)}catch{}try{v()}catch{}le(),im(),W?.refresh();let Q=Tc;Tc=null,wX(r,Q),Vn?.takeRecords(),D()};function im(){try{Pn=_z({container:r,options:()=>d,rows:a.rows?a.rows.length:0,select:mr,clearSelection:co})}catch{}}let Vn=null,Tc=null,Wc=(t.annotations??[]).length>0,N=H=>H.nodeType===1&&(!!H.classList?.contains(vo)||!!H.querySelector?.(`.${vo}`)),T=()=>!!Pn?.surface&&!Pn.surface.isConnected,R=()=>{if(!b){try{oM(r,e)}catch{}ut();try{v()}catch{}le(!1),T()&&im(),W?.refresh(),Vn?.takeRecords()}};function D(){let H=o?.MutationObserver;Vn||!H||b||(Vn=new H(Q=>{b||!Q.some(mt=>Array.from(mt.removedNodes).some(N))||!(G&&G.length)&&!Wc&&!T()||R()}),Vn.observe(r,{childList:!0,subtree:!0}))}let _=H=>{let Q=String(H?.message??H??"");return t.onInvalidSentinel&&dX(Q)?(Da(),r.innerHTML="",t.onInvalidSentinel({reason:yX(Q),message:Q}),null):EX(H,n)},V={render(){if(b)return;let H=++U;if(Da(),ir(!1),vc(),nm(),kc&&Cc&&iM(r,Zl()),Tc=AX(r),r.innerHTML="",Vn?.takeRecords(),kc=!0,!g){if(!t.code)throw new Error("createChartHost: provide code or renderFn");g=MX(t.code,o,e,i)}if(d.geo===void 0&&t.geoKind){let mt=t.geoProvider?.(t.geoKind)??Qz(t.geoKind);if(mt)d={...d,geo:mt};else if(!S){S=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] geoKind "${t.geoKind}" was set but no geometry is available, so this chart will draw without a basemap. Either \`await loadGeo("${t.geoKind}")\` before rendering, pass a geoProvider, or import { geoForKind } from "@bicharts/chart-host/geo" and set options.geo.`)}catch{}}}d.geoUnmatched===void 0&&a.geoUnmatched&&(d={...d,geoUnmatched:a.geoUnmatched}),d.geoPoint===void 0&&a.geoPoint&&(d={...d,geoPoint:a.geoPoint}),d.geoPointDest===void 0&&a.geoPointDest&&(d={...d,geoPointDest:a.geoPointDest}),d.geoPointRefused===void 0&&a.geoPointRefused?.length&&(d={...d,geoPointRefused:a.geoPointRefused}),d.dateCellsAreUtcDays===void 0&&a.dateCellsAreUtcDays&&(d={...d,dateCellsAreUtcDays:!0}),d.suppressSelectionGlyph===void 0&&a.meta?.suppressSelectionGlyph===!0&&(d={...d,suppressSelectionGlyph:!0}),F&&(d={...d,keyboardMarks:!0});let Q;if(hs=null,li&&t.code&&!t.renderFn)try{Ql=li.keyFor(t.code,d.width??r.clientWidth,d.height??r.clientHeight),hs=li.capture(i)}catch{hs=null}s.hostSelection==null&&(d.hostSelection=at?wt():void 0);try{try{Q=g(r,{columns:a.columns,rows:a.rows},d)}finally{try{hs?.release()}catch{}}}catch(mt){let Bt=_(mt);if(Bt)throw B(Promise.reject(Bt)),Bt;B(Promise.resolve());return}if(!Fut(Q)){Mc(),B(Promise.resolve());return}B(new Promise((mt,Bt)=>{let Jt=setTimeout(()=>{Bt(new Error(`[@bicharts/chart-host] the chart did not finish drawing within ${Math.round(fj/1e3)}s, so the host stopped waiting for it. Nothing past that point ran: no label-contrast pass, no hit-target heal, no census, no fit. A render() that returns a promise has to settle it.`))},fj),de=Ce=>{clearTimeout(Jt),Ce()};Promise.resolve(Q).then(()=>de(()=>{if(b||H!==U){mt();return}Mc(),mt()}),Ce=>de(()=>{if(b||H!==U){mt();return}let Ze=_(Ce);Ze?Bt(Ze):mt()}))}))},setOptions(H){b||(s={...s,...p(H??{})},d=f(s),V.render())},setData(H){b||(a=H,at=!1,V.render())},get options(){return d},setAnnotations(H){if(!b){Wc=(H??[]).length>0,L.set(H);try{v()}catch{}}},get annotationReport(){return L.report},get rendered(){return I},selection:{onChange(H){return it.add(H),()=>it.delete(H)},clear(){if(b)return;let H=r[iP];if(typeof H=="function")try{H()}catch{}Nt(null),Pn?.clear({publish:!1,source:"host"}),be([],"host")},highlight(H){if(b)return;let Q=Array.isArray(H)?H.slice():[];Pn&&Pn.rows().length&&!aP(Q,Pn.rows())&&Pn.clear({publish:!1,source:"host"}),be(Q,"host")},setHidden(H){if(b)return;let Q=Number(H),mt=Number.isFinite(Q)&&Q>0?Math.floor(Q):0;mt===xt&&at||(xt=mt,at=!0,nt())},get current(){return G}},animation:{stop(){b||Da()}},initialMark(){return b?null:r[_k]??null},destroy(){if(!b&&(b=!0,Da(),Vn&&(Vn.disconnect(),Vn=null),W?.destroy(),W=null,r.removeEventListener(nP,pr),r.removeEventListener("click",Nc),xc(),qk(r),vc(),it.clear(),O(),L.destroy(),kc&&Cc&&iM(r,Zl()),nd(r),nm(),Ec(),ir(!1),r.innerHTML="",Ot!==null)){try{r.style.position==="relative"&&(r.style.position=Ot)}catch{}Ot=null}}};return V}var Gut=Object.freeze({sourceId:null,rows:Object.freeze([])});function vP(r,t){return r?t.map(e=>r[e]).filter(e=>e!==void 0):t.slice()}function Vut(r,t){let e=new Map;return r.forEach((o,n)=>{e.has(o)||e.set(o,n)}),t.map(o=>e.get(o)).filter(o=>o!==void 0)}var Hut=(r,t)=>{if(r.length!==t.length)return!1;let e=r.slice().sort((n,i)=>n-i),o=t.slice().sort((n,i)=>n-i);return e.every((n,i)=>n===o[i])};function TX(r,t,e,o,n,i){if(t.sourceId===e&&t.rows.length>0){if(i){let s=Vut(i,t.rows);Hut(s,r.selection.current??[])||r.selection.highlight(s)}return}if(o&&n&&n.length){r.selection.highlight(n.slice());return}r.selection.current&&r.selection.current.length&&r.selection.clear()}function zM(r,t,e={}){let o=r,n=t,i=e.geo??null,a=e.point??null,s=e.destination??null,l=Gut,u=new Set,c=new Set,h=g=>{for(let b of Array.from(u))b(l,g)},m=(g,b)=>{let S=l,P=S.rows.length&&S.sourceId&&S.sourceId!==g?S.rows.slice():null;return b?S.sourceId===b?P:null:P},p=g=>{let b=g?g.slice():n.map((w,k)=>k),S=b.map(w=>n[w]);return{payload:nX(o,S,i??void 0,a??void 0,s??void 0),rowMap:b}},f=(g,b={})=>p(b.respondsWith==="highlight"?null:m(g,b.filteredBy)),d={get selection(){return l},get columns(){return o},get rows(){return n},incomingFor:m,payloadFor:p,memberPayload:f,publish(g,b){l=b.length?{sourceId:g,rows:b.slice()}:{sourceId:null,rows:[]},h(b.length?"select":"clear")},clear(){l={sourceId:null,rows:[]},h("clear")},setSource(g,b,S={}){o=g,n=b,i=S.geo??null,a=S.point??null,s=S.destination??null,h("source")},onChange(g){return u.add(g),()=>{u.delete(g)}},attach(g,b,S={}){let P=S.respondsWith==="highlight",w=f(g,S).rowMap,k=L=>P||!L?"*":L.join(","),E=k(m(g,S.filteredBy)),U=b.selection.onChange((L,v)=>{if(v==="host")return;let I=vP(w,L);g&&d.publish(g,I),S.onSelect?.(I)}),F=d.onChange((L,v)=>{let I=m(g,S.filteredBy),B=k(I);if(v==="source"||B!==E){let C=p(P?null:I);w=C.rowMap,E=B,b.setData(C.payload)}TX(b,L,g,P,I,w)}),W={get rowMap(){return w},detach(){U(),F(),c.delete(W)}};return c.add(W),W},destroy(){for(let g of Array.from(c))g.detach();u.clear()}};return d}/*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */var zut=10,jut=1e5,Xut=1e4,oo=r=>Object.freeze({...r,...r.values?{values:Object.freeze([...r.values])}:{}}),jM=Object.freeze({aggregation:oo({timing:"live-and-next-generate",default:"",values:["","sum","average","median","min","max","count","distinct"],wire:"request"}),colorScaleLow:oo({timing:"live-and-next-generate",default:"",wire:"request"}),colorScaleHigh:oo({timing:"live-and-next-generate",default:"",wire:"request"}),palette:oo({timing:"live-and-next-generate",default:"",wire:"request"}),maxMapPoints:oo({timing:"live-and-next-generate",default:T7,min:zut,max:jut,wire:"clientHints"}),pageSize:oo({timing:"live",default:0,min:0}),valueAxisBaseline:oo({timing:"live",default:k7,values:["fit","zero","auto"]}),seasonalMarkers:oo({timing:"live",default:M7,values:["auto","always","never"]}),animAutoPlay:oo({timing:"live",default:!1}),animPlaySpeedMs:oo({timing:"live",default:b7,min:S7,max:A7}),animLoopDelaySec:oo({timing:"live",default:w7,min:P7}),animStopAtEnd:oo({timing:"live",default:!1}),animMaxIdealFrames:oo({timing:"live",default:v7,min:N7,max:x7}),animTimelineStyle:oo({timing:"live",default:"",values:["","line","boxes"]}),filtersDuringPlay:oo({timing:"live",default:!1}),flipMode:oo({timing:"live",default:E7,values:["both","all","single"]}),flipIntervalMs:oo({timing:"live",default:"",min:0,max:hz}),flipDirection:oo({timing:"live",default:C7,values:["horizontal","vertical"]}),cardBackgroundColor:oo({timing:"live",default:""}),hoverDropLines:oo({timing:"live",default:"",values:["","on","off"]}),geoBorders:oo({timing:"live",default:!0}),deriveProvinces:oo({timing:"next-generate",default:!0}),levelOfDetail:oo({timing:"next-generate",default:"",values:["","High","Medium","Low"],wire:"clientHints"}),favorLimitTo:oo({timing:"next-generate",default:"",values:["","latest","top / greatest","bottom / smallest","most common","outliers"],wire:"clientHints"}),favorLimitCount:oo({timing:"next-generate",default:0,min:0,max:Xut,wire:"clientHints"}),favorTitle:oo({timing:"next-generate",default:"",values:["","1","0"],wire:"clientHints"}),favorDPValues:oo({timing:"next-generate",default:"",values:["","1","0"],wire:"clientHints"}),legendPlacement:oo({timing:"next-generate",default:"",values:["","outside","inside","none"],wire:"clientHints"}),industryContext:oo({timing:"next-generate",default:"",wire:"clientHints"}),suggestFontFamily:oo({timing:"next-generate",default:"",wire:"clientHints"}),visionReview:oo({timing:"after-render",default:!1}),saveThumbnails:oo({timing:"after-render",default:!1})}),h0e=Object.freeze(Object.keys(jM).filter(r=>jM[r].timing==="live"||jM[r].timing==="live-and-next-generate"));var m0e=Object.freeze(["TILE_TOO_NARROW","TILE_TOO_SHORT","TILE_NOT_SQUARE","TILE_NOT_TALL","TILE_TOO_SMALL","EMBED_NOTHING_FITS_TILE","EMBED_BEESWARM_TILE_TOO_SMALL"]);function us(r,t,e,o){var n,i=arguments.length,a=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,t,e,o);else for(var s=r.length-1;s>=0;s--)(n=r[s])&&(a=(i<3?n(a):i>3?n(t,e,a):n(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a}function Yl(r,t,e){if(e||arguments.length===2)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return r.concat(o||Array.prototype.slice.call(t))}var LX=function(r,t,e){return[r,t,e].map((function(o){return(o/=255)>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92}))},IX=function(r,t,e){return[r,t,e].map((function(o){return 255*(o<=.00304?12.92*o:1.055*Math.pow(o,1/2.4)-.055)}))},hn=function(r,t,e){return Math.min(Math.max(r,t),e)},RX=function(r,t){return Math.round((r+Number.EPSILON)*Math.pow(10,t))/Math.pow(10,t)},o8=function(r,t){return Math.floor(Math.random()*(t-r+1)-r)},_X=function(r,t,e,o){for(var n,i=[r,t,e],a="#",s=0;s<i.length;s++)a+=(n=i[s],Math.round(hn(n,0,255)).toString(16).padStart(2,"0"));return o!=null&&(a+=Math.round(hn(o,0,100)/100*255).toString(16).padStart(2,"0")),a},UX=function(r){var t=r.length,e=(r=(function(i){var a=(i=/^#/.test(i)?i.slice(1):i).length;if(![3,4,6,8].includes(a))return"000000";if(a===6||a===8)return i;if(a===3||a===4){for(var s="",l=0;l<a;l++){var u=i[l];s+=""+u+u}return s}return"000000"})(r).padEnd(8,"ff")).match(/.{2}/g);if(!e)return[0,0,0,1];var o=[0,0,0],n=!1;return e.forEach((function(i,a){a<3?o[a]=parseInt(i,16):n=100*parseInt(i,16)/255})),n===!1||t<8?o:Yl(Yl([],o,!0),[n],!1)},BX=function(r,t,e){var o;o=[r,t,e].map((function(a){return a/255})),r=o[0],t=o[1],e=o[2];var n=1-Math.max(r,t,e),i=n<1?1/(1-n):0;return[(1-r-n)*i*100,(1-t-n)*i*100,(1-e-n)*i*100,100*n]},DX=function(r,t,e,o){return o===100?[0,0,0]:(o/=100,[r,t,e].map((function(n){return(n/=100)>=1?0:255*(1-n)*(1-o)})))};function JM(r,t,e,o){var n;o===void 0&&(o="l"),n=[r,t,e].map((function(p){return p/255})),r=n[0],t=n[1],e=n[2];var i=Math.max(r,t,e),a=Math.min(r,t,e),s=(function(p,f,d,g){var b;g===void 0&&(g=!1),b=[p,f,d].map((function(E){return E/255})),p=b[0],f=b[1],d=b[2];var S=Math.max(p,f,d),P=Math.min(p,f,d),w=0;if(S!==P)if(g)w=(p-f+(p-d))/2,w/=Math.sqrt((p-f)*(p-f)+(p-d)*(f-d)),w=Math.acos(w),d>f&&(w=2*Math.PI-w),w/=2*Math.PI;else{var k=S-P;w=S===p?(f-d)/k+(f<d?6:0):S===f?(d-p)/k+2:(p-f)/k+4,w/=6}else w=NaN;return 360*w})(r,t,e,o==="i"),l=0,u=(i+a)/2,c=i-a,h=i,m=(r+t+e)/3;return o==="v"&&(l=i===0?0:c/i),i!==a&&o==="l"&&(l=u>.5?c/(2-i-a):c/(i+a)),o==="i"&&(l=m>0?1-a/m:0),l*=100,u*=100,m*=100,o==="l"?[s,l,u]:o==="v"?[s,l,h*=100]:[s,l,m]}var QM=function(r,t,e){return JM(r,t,e,"l")},cd=function(r,t,e){var o,n,i=function(a){return 6*(a=a<0?a+1:a>1?a-1:a)<1?o+(n-o)*a*6:2*a<1?n:3*a<2?o+(n-o)*(.6666666666666666-a)*6:o};return r=r%360/360,t=hn(t/100,0,1),e=hn(e/100,0,1),o=2*e-(n=e<=.5?e*(t+1):e+t-e*t),[255*i(r+1/3),255*i(r),255*i(r-1/3)]},OX=function(r,t,e){return JM(r,t,e,"v")},ZM=function(r,t,e){var o,n,i=[e/=100,e*(1-(t/=100)),e*(1-(n=(r=r%360/360*360)/60-(o=Math.floor(r/60%6)))*t),e*(1-(1-n)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return[255*i[a[o][0]],255*i[a[o][1]],255*i[a[o][2]]]},FX=function(r,t,e){return JM(r,t,e,"i")},tT=function(r,t,e){var o,n,i,a;t/=100,e/=100,isNaN(r)&&(r=0),isNaN(t)&&(t=0);var s=function(l){return(1+t*Math.cos(2*Math.PI*l)/Math.cos(Math.PI/3-2*Math.PI*l))/3};return(r=(360+r)%360/360)<1/3?i=1-((a=(1-t)/3)+(n=s(r))):r<2/3?a=1-((n=(1-t)/3)+(i=s(r-=1/3))):n=1-((i=(1-t)/3)+(a=s(r-=2/3))),o=[n,i,a].map((function(l){return 255*hn(e*l*3,0,1)})),[n=o[0],i=o[1],a=o[2]]},GX=function(r,t,e){return[QM(r,t,e)[0],100*(Math.min(r,t,e)/255),100*(1-Math.max(r,t,e)/255)]};function eT(r,t,e){return t/=100,e/=100,cd(r,100,50).map((function(o){return 255*(o/255*(1-t-e)+t)}))}var XM={x:[.4124564,.3575761,.1804375],y:[.2126729,.7151522,.072175],z:[.0193339,.119192,.9503041]},KM={r:[3.2404542,-1.5371385,-.4985314],g:[-.969266,1.8760108,.041556],b:[.0556434,-.2040259,1.0572252]},VX=.95047,HX=1,zX=1.08883,Kut=.206896552,Yut=.008856452,jX=24389/27,YM=function(r,t,e){var o=LX(r,t,e);return[100*XM.x.reduce((function(n,i,a){return n+i*o[a]}),0),100*XM.y.reduce((function(n,i,a){return n+i*o[a]}),0),100*XM.z.reduce((function(n,i,a){return n+i*o[a]}),0)]},xP=function(r,t,e){var o=[r,t,e],n=KM.r.reduce((function(s,l,u){return s+l*o[u]}),0)/100,i=KM.g.reduce((function(s,l,u){return s+l*o[u]}),0)/100,a=KM.b.reduce((function(s,l,u){return s+l*o[u]}),0)/100;return IX(n,i,a)},n8=function(r,t,e){var o;return o=[r=r/VX/100,t=t/HX/100,e=e/zX/100].map((function(n){return n>Yut?Math.pow(n,1/3):(jX*n+16)/116})),r=o[0],t=o[1],e=o[2],[Math.max(0,116*t-16),500*(r-t),200*(t-e)]},rT=function(r,t,e){var o,n=(r+16)/116,i=isNaN(t)?n:n+t/500,a=isNaN(e)?n:n-e/200;return o=[i,n,a].map((function(s){return s>Kut?Math.pow(s,3):(116*s-16)/jX})),i=o[0],n=o[1],a=o[2],[i*VX*100,n*HX*100,a*zX*100]},oT=function(r,t,e){return xP.apply(void 0,rT(r,t,e))},qM=function(r,t,e){t=hn(t,-100,100),e=hn(e,-100,100);var o=Math.sqrt(t*t+e*e),n=(180*Math.atan2(e,t)/Math.PI+360)%360;return Math.round(1e4*o)===0&&(n=Number.NaN),[r,o,n]},XX=function(r,t,e){return isNaN(e)&&(e=0),e*=Math.PI/180,[r,Math.cos(e)*t,Math.sin(e)*t]},nT=function(r,t,e){return rT.apply(void 0,XX(r,t,e))},KX=function(r,t,e){var o=r+t+e,n=0,i=0;return o>0&&(n=r/o,i=t/o),[n,i,t]},qut=Object.freeze({__proto__:null,linear2rgb:IX,rgb2linear:LX,rgb2hex:_X,hex2rgb:UX,rgb2cmyk:BX,cmyk2rgb:DX,rgb2hsl:QM,hsl2rgb:cd,rgb2hsv:OX,hsv2rgb:ZM,rgb2hsi:FX,hsi2rgb:tT,rgb2hwb:GX,hwb2rgb:eT,rgb2xyz:YM,xyz2rgb:xP,xyz2lab:n8,lab2xyz:rT,rgb2lab:function(r,t,e){return n8.apply(void 0,YM(r,t,e))},lab2rgb:oT,lch2lab:XX,lab2lch:qM,xyz2lch:function(r,t,e){return qM.apply(void 0,n8(r,t,e))},lch2xyz:nT,xyY2xyz:function(r,t,e){return t===0?[0,0,0]:[r*(e/t),e,e/t*(1-r-t)]},xyz2xyY:KX});function Kl(r,t){return t===void 0&&(t=!1),function(e,o,n){var i=n.value;n.value=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];if(a.length>0&&t){var l=JSON.stringify(a);r+=l}if(this.cache.has(r))return this.cache.get(r);var u=i.call.apply(i,Yl([this],a,!1));return this.cache.set(r,u),u}}}function Zs(r,t,e,o){return r===void 0&&(r=[0,2,2]),t===void 0&&(t=0),e===void 0&&(e=!0),o===void 0&&(o=0),function(n,i,a){var s=a.value;a.value=function(){for(var l=[],u=0;u<arguments.length;u++)l[u]=arguments[u];var c=l[o]===void 0?e:l[o],h=s.call.apply(s,Yl([this],l,!1));if(c===!1)return h;var m=typeof c=="number"?Math.round(c):0,p=typeof r=="number"?new Array(h.length).fill(r):r,f=p.map((function(d){return t===1?typeof c=="number"?m:d:d+m}));return h.map((function(d,g){return RX(d,f[g])}))}}}var YX=function(r,t,e){var o=r instanceof wn?r:new wn(r),n=t instanceof wn?t:new wn(t),i=hn(e,0,100)/100,a=2*i-1,s=o.alpha()-n.alpha(),l=((a*s==-1?a:(a+s)/(1+a*s))+1)/2,u=1-l,c=[Math.round(hn(o.red()*l+n.red()*u,0,255)),Math.round(hn(o.green()*l+n.green()*u,0,255)),Math.round(hn(o.blue()*l+n.blue()*u,0,255))],h=o.alpha()*i+n.alpha()*(1-i);return new wn(c,h)},Ba=Math.sqrt,zr=Math.pow,DS=Math.cos,NP=Math.abs,WX=Math.sin,$ut=Math.exp,Jut=Math.atan2,qX=Math.PI,ud=function(r){return qX*r/180},$M=function(r,t,e){e===void 0&&(e=!0);var o=Jut(t,r);return e&&(o=(o=(o=180*o/qX)>0?o:o+360)>360?o-360:o),o},OS=function(r,t){t===void 0&&(t=!0);var e=r.lab(!1),o=e[0],n=e[1],i=e[2];return[o,Ba(zr(n,2)+zr(i,2)),$M(n,i,t),n,i]},Qut=["CMC","CIE","CIE2000","CIE1994","CIE1976"],Zut="CMC",tct="CIE2000",ect="CIE1994",rct="CIE1976",$X=function(r,t,e,o){e===void 0&&(e="CIE");var n=(function(c){var h=c.toUpperCase();return Qut.includes(h)&&h!=="CIE"?h:tct})(e);if(o=o||{},n===Zut){var i=Object.assign({},{l:1,c:1},o);return(function(c,h,m,p){m===void 0&&(m=1),p===void 0&&(p=1);var f=OS(c,!0),d=f[0],g=f[1],b=f[2],S=f[3],P=f[4],w=OS(h),k=w[0],E=w[1],U=w[3],F=g-E,W=d-k,L=P-w[4],v=Ba(zr(S-U,2)+zr(L,2)-zr(F,2)),I=d<16?.511:.040975*d/(1+.01765*d),B=.0638*g/(1+.0131*g)+.638,C=164<=b&&b<=345?.56+NP(.2*DS(ud(b+168))):.36+NP(.4*DS(ud(b+35))),O=Ba(zr(g,4)/(zr(g,4)+1900)),G=B*(O*C+1-O);return Ba(zr(W/(m*I),2)+zr(F/(p*B),2)+zr(v/G,2))})(r,t,i.l,i.c)}if(n===ect){var a={kL:1,kC:1,kH:1,cate:"graphic"},s=Object.assign({},a,o);return(function(c,h,m,p,f,d){m===void 0&&(m=1),p===void 0&&(p=1),f===void 0&&(f=1),d===void 0&&(d="graphic");var g=d==="textiles"?.048:.045,b=d==="textiles"?.014:.015;m=d==="textiles"?2:m;var S=OS(c),P=S[0],w=S[1],k=S[3],E=S[4],U=OS(h),F=U[0],W=U[1],L=U[3],v=P-F,I=w-W,B=E-U[4],C=1+g*w,O=1+b*w,G=Ba(zr(k-L,2)+zr(B,2)-zr(I,2));return Ba(zr(v/(1*m),2)+zr(I/(p*C),2)+zr(G/(f*O),2))})(r,t,s.kL,s.kC,s.kH,s.cate)}if(n===rct)return(function(c,h){var m=c.lab(!1),p=m[0],f=m[1],d=m[2],g=h.lab(!1),b=g[0],S=g[1],P=g[2];return Ba(zr(p-b,2)+zr(f-S,2)+zr(d-P,2))})(r,t);var l={kL:1,kC:1,kH:1},u=Object.assign({},l,o);return(function(c,h,m,p,f){m===void 0&&(m=1),p===void 0&&(p=1),f===void 0&&(f=1);var d=OS(c),g=d[0],b=d[1],S=d[3],P=d[4],w=OS(h),k=w[0],E=w[1],U=w[3],F=w[4],W=(g+k)/2,L=(b+E)/2,v=(1-Ba(zr(L,7)/(zr(L,7)+zr(25,7))))/2,I=S*(1+v),B=U*(1+v),C=Ba(zr(I,2)+zr(P,2)),O=Ba(zr(B,2)+zr(F,2)),G=$M(I,P,!0),X=$M(B,F,!0),Y=(C+O)/2,j=NP(G-X)>180?(G+X+360)/2:(G+X)/2,K=1-.17*DS(ud(j-30))+.24*DS(ud(2*j))+.32*DS(ud(3*j+6))-.2*DS(ud(4*j-63)),ht=NP(X-G)<=180?X-G:NP(X-G)>180&&X<=G?X-G+360:X-G-360,Z=k-g,bt=E-b,Nt=2*Ba(C*O)*WX(ud(ht)/2),it=1+.015*zr(W-50,2)/Ba(20+zr(W-50,2)),xt=1+.045*Y,at=1+.015*Y*K,wt=30*$ut(-zr((j-275)/25,2)),nt=-2*Ba(zr(Y,7)/(zr(Y,7)+zr(25,7)))*WX(2*ud(wt));return Ba(zr(Z/(m*it),2)+zr(bt/(p*xt),2)+zr(Nt/(f*at),2)+nt*(bt/(p*xt))*(Nt/(f*at)))})(r,t,u.kL,u.kC,u.kH)},oct=function(r,t,e){var o=Math.abs,n=Math.max,i=Math.min,a=r instanceof wn?r:new wn(r),s=t instanceof wn?t:new wn(t),l=Object.assign({},{b:125,c:500},e);return!(o(255*a.brightness()/100-255*s.brightness()/100)<=l.b)&&!(n(a.red(),s.red())-i(a.red(),s.red())+(n(a.green(),s.green())-i(a.green(),s.green()))+(n(a.blue(),s.blue())-i(a.blue(),s.blue()))<=l.c)},FS=function(r,t,e){var o,n=function(u){return hn(u,0,100)},i=function(u){return hn(u,0,255)},a={h:[0,function(u){return u%360}],s:[1,n],l:[2,n],r:[0,i],g:[1,i],b:[2,i]},s=a[t][0];if(["h","s","l"].includes(t)){var l=r.hsl();if(e===void 0)return l[s];e=a[t][1](e),l[s]=e,o=cd.apply(void 0,l)}else{if(o=r.rgb(),e===void 0)return o[s];e=a[t][1](e),o[s]=e}return new wn(o,r.alpha())},a8={},nct=new Set(["rgb","rgba","cmyk","lab","hsl","hsla","hsv","hsva","hsi","hsia","xyz","lch","hwb","hwba"]),ict=/^([a-zA-Z]+)\(([\s\S]+)\)$/,i8=function(r){return typeof r=="string"?r.indexOf("%")===-1?i8(Number(r.trim())):(r=r.split("%")[0],(r=Number(r.trim()))||0):Math.abs(r)<1?100*r:r},JX=function(r,t){t===void 0&&(t=new Set);var e=typeof r=="string"?r:r.join(",");if(t.has(e))throw new Error("Invalid Color");t.add(e);var o="rgb",n=[0,0,0],i=100;if(Array.isArray(r)){if(r.length<3)throw new Error("Invalid Color");for(var a=0;a<r.length;a++)if(a<3)n[a]=r[a];else{if(a!==3||r[3]===void 0)break;i=r[3]}}else{var s=!1,l=r.trim().match(ict);if(l||(s=!0),l){var u=l[1].toLocaleLowerCase();if(o=u,nct.has(u)||(s=!0),l[2]&&!s){var c=l[2],h=c.indexOf(",")!==-1?",":" ",m=c.split(h);for(a=0;a<3;a++)m[a]!==void 0&&(["lch","lab"].includes(o)&&a===0||["hsl","hsla","hsv","hsva","hwb","hwba","hsi","hsia"].includes(o)&&a>0?n[a]=i8(m[a]):n[a]=Number(m[a].trim()));["rgba","hsla","hsva","hwba","hsia"].includes(o)?(o=o.slice(0,-1),m[3]!==void 0&&(i=i8(m[3]))):o==="cmyk"&&n.push(m[3]!==void 0?i8(m[3]):0)}}if(s){if(!/^#(([a-fA-F\d]{3}){1,2}|[a-fA-F\d]{8})$/.test(r))try{return r=(function(p,f){if(f===void 0&&(f=!1),p=p.toLowerCase(),a8[p]===void 0){if(f)throw new Error("Unknown color name: ".concat(p,")"));return p}return a8[p]})(r,!0),JX(r,t)}catch{throw new Error("Invalid Color")}n=UX(r)}}return[o,n,i]},QX={thowParseError:!1},wn=(function(){function r(t,e,o){this.cache=new Map,this._rgb=[0,0,0],this._alpha=100;var n={thowParseError:QX.thowParseError},i=Object.assign({},n,o??{});try{var a=(function(u){var c,h={lab2rgb:oT,hsl2rgb:cd,hsv2rgb:ZM,xyz2rgb:xP,hwb2rgb:eT,hsi2rgb:tT},m=JX(u),p=m[0],f=m[1],d=m[2];if(p==="rgb")return[f,d];p==="lch"&&(p=(c=["xyz",nT(f[0],f[1],f[2])])[0],f=c[1]);var g=f[0],b=f[1],S=f[2],P=f[3];if(p==="cmyk")return[DX(g,b,S,P).map((function(k){return hn(k,0,255)})),d];var w="".concat(p,"2rgb");if(typeof h[w]=="function")return[h[w](g,b,S).map((function(k){return hn(k,0,255)})),d];throw new Error("Invalid color")})(t),s=a[0],l=a[1];this._alpha=l,this._rgb=s}catch(u){if(i.thowParseError)throw u}e!==void 0&&(this._alpha=hn(e,0,100))}return r.prototype.red=function(t){return FS(this,"r",t)},r.prototype.green=function(t){return FS(this,"g",t)},r.prototype.blue=function(t){return FS(this,"b",t)},r.prototype.alpha=function(t){return t===void 0?this._alpha:(t=hn(t,0,100),new r(this.rgb(),t))},r.prototype.fadeIn=function(t,e){return t===void 0&&(t=10),t=e&&e==="relative"?this._alpha*t/100:t,new r(this.rgb(),hn(this._alpha+t,0,100))},r.prototype.fadeOut=function(t,e){return t===void 0&&(t=10),t=e&&e==="relative"?this._alpha*t/100:t,new r(this.rgb(),hn(this._alpha-t,0,100))},r.prototype.opacify=function(t,e){return t===void 0&&(t=10),this.fadeIn(t,e)},r.prototype.transparentize=function(t,e){return t===void 0&&(t=10),this.fadeOut(t,e)},r.prototype.hue=function(t){return FS(this,"h",t)},r.prototype.saturation=function(t){return FS(this,"s",t)},r.prototype.lightness=function(t){return FS(this,"l",t)},r.prototype.rgb=function(t){return Yl([],this._rgb,!0)},r.prototype.rgba=function(t){return Yl(Yl([],this.rgb(!1),!0),[this._alpha],!1)},r.prototype.cmyk=function(t){return BX.apply(void 0,this._rgb)},r.prototype.hsl=function(t){return QM.apply(void 0,this._rgb)},r.prototype.hsla=function(t){return Yl(Yl([],this.hsl(!1),!0),[this._alpha],!1)},r.prototype.hsv=function(t){return OX.apply(void 0,this._rgb)},r.prototype.hsi=function(t){return FX.apply(void 0,this._rgb)},r.prototype.hwb=function(t){return GX.apply(void 0,this._rgb)},r.prototype.xyz=function(t){return YM.apply(void 0,this._rgb)},r.prototype.lab=function(t){return n8.apply(void 0,this.xyz(!1))},r.prototype.lch=function(t){return qM.apply(void 0,this.lab(!1))},r.prototype.xyY=function(t){return KX.apply(void 0,this.xyz(!1))},r.prototype.hex=function(t){t===void 0&&(t=2);var e=t===0?void 0:t===1?this._alpha:this._alpha===100?void 0:this._alpha,o="color:hex:param_".concat(t);if(this.cache.has(o))return this.cache.get(o);var n=_X.apply(void 0,Yl(Yl([],this._rgb,!1),[e],!1));return this.cache.set(o,n),n},r.prototype.lighten=function(t,e){t===void 0&&(t=5);var o=this.hsl(!1),n=o[0],i=o[1],a=o[2];return a=hn(a+=e!==void 0&&e==="relative"?a*(t/100):t,0,100),new r(cd(n,i,a),this._alpha)},r.prototype.darken=function(t,e){return t===void 0&&(t=5),this.lighten(-t,e)},r.prototype.saturate=function(t,e){t===void 0&&(t=5);var o=this.hsl(!1),n=o[0],i=o[1],a=o[2];return i=hn(i+=e!==void 0&&e==="relative"?i*(t/100):t,0,100),new r(cd(n,i,a),this._alpha)},r.prototype.desaturate=function(t,e){return t===void 0&&(t=5),this.saturate(-t,e)},r.prototype.spin=function(t){var e=this.hsl(!1),o=e[0],n=e[1],i=e[2];return new r(cd(o=(o+t%360+360)%360,n,i),this._alpha)},r.prototype.adjustHue=function(t){return this.spin(t)},r.prototype.complement=function(){return this.spin(180)},r.prototype.invert=function(){var t=this._rgb.map((function(e){return 255-e}));return new r([t[0],t[1],t[2]],this._alpha)},r.prototype.mix=function(t,e){return e===void 0&&(e=50),YX(this,t,100-hn(e,0,100))},r.prototype.luma=function(){var t=this._rgb.map((function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}));return .2126*t[0]+.7152*t[1]+.0722*t[2]},r.prototype.brightness=function(){var t=this._rgb;return(function(e,o,n){return(299*e+587*o+114*n)/1e3/255*100})(t[0],t[1],t[2])},r.prototype.deltaE=function(t,e,o){return e===void 0&&(e="CMC"),$X(this,t,e,o)},r.prototype.visibility=function(t,e){return oct(this,t,e)},us([Zs(0,1,!0,0),Kl("color:rgb")],r.prototype,"rgb",null),us([Zs(0,1,!0,0)],r.prototype,"rgba",null),us([Zs(0,1,!0,0),Kl("color:cmyk")],r.prototype,"cmyk",null),us([Zs(0,1,!0,0),Kl("color:hsl")],r.prototype,"hsl",null),us([Zs(0,1,!0,0)],r.prototype,"hsla",null),us([Zs(0,1,!0,0),Kl("color:hsv")],r.prototype,"hsv",null),us([Zs(0,1,!0,0),Kl("color:hsi")],r.prototype,"hsi",null),us([Zs(0,1,!0,0),Kl("color: hwb")],r.prototype,"hwb",null),us([Zs(2,1,!0,0),Kl("color:xyz")],r.prototype,"xyz",null),us([Zs(2,1,!0,0),Kl("color:lab")],r.prototype,"lab",null),us([Zs(2,1,!0,0),Kl("color:lch")],r.prototype,"lch",null),us([Zs(2,1,!0,0),Kl("color:xyY")],r.prototype,"xyY",null),us([Kl("color:luma")],r.prototype,"luma",null),r})(),act=function(r,t,e,o){return new wn([r,t,e],o)},sct=function(r,t,e,o){return new wn(cd(r,t,e),o)},lct=function(r,t,e,o){return new wn(ZM(r,t,e),o)},uct=function(r,t,e,o){return new wn(tT(r,t,e),o)},cct=function(r,t,e,o){return new wn(eT(r,t,e),o)},hct=function(r,t,e,o){return new wn(xP(r,t,e),o)},mct=function(r,t,e,o){return new wn(oT(r,t,e),o)},pct=function(r,t,e,o){return new wn(xP.apply(void 0,nT(r,t,e)),o)};function Ei(r,t,e){return new wn(r,t,e)}Ei.config=function(r){Object.assign(QX,r)},Ei.random=function(){var r=o8(0,255),t=o8(0,255),e=o8(0,255);return new wn([r,t,e])},Ei.convertor=qut,Ei.Color=wn,Ei.rgb=act,Ei.hsl=sct,Ei.hsv=lct,Ei.hsi=uct,Ei.hwb=cct,Ei.xyz=hct,Ei.lab=mct,Ei.lch=pct,Ei.mix=YX,Ei.deltaE=$X,Ei.utils={roundDecimal:RX,randomRange:o8},Ei.useNames=function(r,t){return(function(e,o){if(o!==void 0&&typeof o=="function"){var n={};for(var i in e){var a=o(i,e[i]),s=a[0],l=a[1];n[s]=l}Object.assign(a8,n)}else Object.assign(a8,e)})(r,t),Ei};var l8=[1,0,0,1,0,0],GS=(r,t)=>[r[0]*t[0]+r[2]*t[1],r[1]*t[0]+r[3]*t[1],r[0]*t[2]+r[2]*t[3],r[1]*t[2]+r[3]*t[3],r[0]*t[4]+r[2]*t[5]+r[4],r[1]*t[4]+r[3]*t[5]+r[5]],s8=(r,t,e)=>[r[0]*t+r[2]*e+r[4],r[1]*t+r[3]*e+r[5]];function sT(r){if(!r||!r.trim())return l8;let t=l8,e=/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g,o="";for(let n of r.matchAll(e)){o+=n[0];let i=n[2].split(/[\s,]+/).filter(Boolean).map(Number);if(i.some(s=>!isFinite(s)))return null;let a;switch(n[1]){case"matrix":if(i.length!==6)return null;a=i;break;case"translate":a=[1,0,0,1,i[0]??0,i[1]??0];break;case"scale":a=[i[0]??1,0,0,i[1]??i[0]??1,0,0];break;case"rotate":{let s=(i[0]??0)*Math.PI/180,l=Math.cos(s),u=Math.sin(s),c=[l,u,-u,l,0,0];a=i.length>=3?GS(GS([1,0,0,1,i[1],i[2]],c),[1,0,0,1,-i[1],-i[2]]):c;break}case"skewX":a=[1,0,Math.tan((i[0]??0)*Math.PI/180),1,0,0];break;default:a=[1,Math.tan((i[0]??0)*Math.PI/180),0,1,0,0];break}t=GS(t,a)}return r.replace(e,"").replace(/[\s,]/g,"")!==""?null:o?t:l8}var wc=r=>String(r??"").toLowerCase(),EP=(r,t)=>{let e=wc(r.getAttribute("style")).replace(/\s+/g,"");for(let o of e.split(";")){let n=o.indexOf(":");if(n>0&&o.slice(0,n)===t)return o.slice(n+1)}return null},Lf=(r,t)=>EP(r,t)??(r.getAttribute(t)!==null?wc(r.getAttribute(t)):null);function dct(r){for(let t of String(r.getAttribute?.("style")??"").split(";")){let e=t.indexOf(":");if(e<0||t.slice(0,e).trim().toLowerCase()!=="font")continue;let o=/(?:^|\s)((?:\d*\.)?\d+(?:px|pt|em|%))(?:\s|\/|$)/i.exec(t.slice(e+1));return o?o[1].toLowerCase():"unreadable"}return null}var ZX=10;function VS(r){for(let t=r;t;t=t.parentElement){let e=EP(t,"font-size")??dct(t)??(t.getAttribute?.("font-size")!=null&&t.getAttribute("font-size").trim()!==""?wc(t.getAttribute("font-size")).trim():null);if(e===null)continue;let o=/^((?:\d*\.)?\d+(?:e[+-]?\d+)?)(px|pt|em|%)?$/.exec(e);if(!o)return{px:ZX,sure:!1};let n=parseFloat(o[1]),i=o[2]??"px";if(i==="px")return{px:n,sure:!0};if(i==="pt")return{px:n*4/3,sure:!0};let a=VS(t.parentElement);return{px:(i==="em"?n:n/100)*a.px,sure:a.sure}}return{px:ZX,sure:!1}}function u8(r,t,e,o){let n=String(r.getAttribute(t)??"").trim().toLowerCase();if(!n)return{v:0,sure:!0};let i=n.split(/[\s,]+/).filter(Boolean),a=/^([-+]?(?:\d*\.)?\d+(?:e[+-]?\d+)?)(px|em|%)?$/.exec(i[0]);if(!a)return null;let s=parseFloat(a[1]),l=a[2]==="em"?s*e:a[2]==="%"?s/100*o:s;return isFinite(l)?{v:l,sure:i.length===1}:null}function yct(r){return Array.from(r).length*.5}function fct(r){for(let t=r.parentElement;t;t=t.parentElement)if(wc(t.localName)==="svg")return t;return null}var lT=new Set(["defs","clippath","mask","pattern","marker","symbol","lineargradient","radialgradient","filter","title","desc","metadata","style","script"]);function tK(r){let t=String(r??"").trim();return/^\+?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(?:px)?$/i.test(t)?parseFloat(t):NaN}function gct(r){if(Lf(r,"overflow")==="visible")return null;let t=tK(EP(r,"width")??r.getAttribute("width")),e=tK(EP(r,"height")??r.getAttribute("height")),o=r.getAttribute("viewBox");if(o){let n=o.split(/[\s,]+/).filter(Boolean).map(Number);return n.length!==4||!n.every(isFinite)||n[2]<=0||n[3]<=0||!wc(r.getAttribute("preserveAspectRatio")).includes("none")&&isFinite(t)&&isFinite(e)&&t>0&&e>0&&Math.abs(n[2]/n[3]-t/e)>.01*(t/e)?null:{x0:n[0],y0:n[1],x1:n[0]+n[2],y1:n[1]+n[3]}}return!(t>0)||!(e>0)?null:{x0:0,y0:0,x1:t,y1:e}}function bct(r,t){for(let e=r;e&&e!==t;e=e.parentElement){if(Lf(e,"display")==="none")return!0;let o=Lf(e,"visibility");if(o==="hidden"||o==="collapse")return!0;let n=Lf(e,"opacity");if(n!==null&&n!==""&&parseFloat(n)===0)return!0}return!1}function Sct(r,t){for(let e=r;e&&e!==t;e=e.parentElement)if(e.getAttribute("clip-path")||EP(e,"clip-path")||lT.has(wc(e.localName)))return!0;return!1}function Act(r,t){let e=l8;for(let o=r;o&&o!==t;o=o.parentElement){let n=sT(o.getAttribute("transform"));if(!n)return null;e=GS(n,e)}return e}var cs=(r,t)=>{let e=parseFloat(r.getAttribute(t)??"");return isFinite(e)?e:0};function aT(r){let t="";for(let e=r.firstChild;e;e=e.nextSibling)e.nodeType===3||e.nodeType===4?t+=e.nodeValue??"":e.nodeType===1&&!lT.has(wc(e.localName))&&(t+=aT(e));return t}function ql(r,t,e){for(let o=r;o&&o!==t.parentElement;o=o.parentElement){let n=Lf(o,e);if(n!==null&&n!=="")return n}return null}var iT=["x","y","dx","dy"],Wf=(r,t)=>(r.getAttribute(t)??"").trim()!=="";function wct(r,t,e){let o=VS(r),[n,i,a,s]=iT.map(c=>u8(r,c,o.px,c==="x"||c==="dx"?t:e));if(!n||!i||!a||!s)return null;let l={text:"",x:n.v+a.v,y:i.v+s.v,fontPx:o.px,el:r,extra:0,sure:o.sure&&n.sure&&i.sure&&a.sure&&s.sure},u=[l];for(let c=r.firstChild;c;c=c.nextSibling){if(c.nodeType===3||c.nodeType===4){l.text+=c.nodeValue??"";continue}if(c.nodeType!==1)continue;let h=c,m=wc(h.localName);if(lT.has(m))continue;if(m==="textpath"||h.querySelector("textPath, textpath"))return null;if(Lf(h,"display")==="none")continue;let p=VS(h),f=Array.from(h.querySelectorAll("*")).some(d=>iT.some(g=>Wf(d,g)));if(Wf(h,"x")){let[d,g,b,S]=iT.map(P=>u8(h,P,p.px,P==="x"||P==="dx"?t:e));if(!d||!g||!b||!S)return null;l={text:aT(h),x:d.v+b.v,y:(Wf(h,"y")?g.v:l.y)+S.v,fontPx:p.px,el:h,extra:0,sure:p.sure&&d.sure&&g.sure&&b.sure&&S.sure&&!f},u.push(l)}else{l.text+=aT(h);let d=u8(h,"dx",p.px,t);if(!d)return null;l.extra+=d.v,(!d.sure||Wf(h,"y")||Wf(h,"dy")||f||p.px!==l.fontPx||!p.sure||Lf(h,"text-anchor")!==null)&&(l.sure=!1),l.fontPx=Math.max(l.fontPx,p.px)}}for(let c of u)c.text=c.text.replace(/\s+/g," ").trim();return u.filter(c=>c.text)}function uT(r){let t=[],e=r.match(/[a-zA-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/g)??[],o=0,n="",i=0,a=0,s=0,l=0,u=()=>parseFloat(e[o++]),c=()=>o<e.length&&!/^[a-zA-Z]$/.test(e[o]);for(;o<e.length;){if(/^[a-zA-Z]$/.test(e[o]))n=e[o++];else if(!n)return[];let h=n===n.toLowerCase(),m=n.toUpperCase();if(m==="Z"){if(i=s,a=l,c())return t;continue}let p={M:2,L:2,T:2,H:1,V:1,C:6,S:4,Q:4,A:7}[m];if(!p)return t;if(!c())continue;let f=[];for(let b=0;b<p;b++)f.push(u());if(f.some(b=>!isFinite(b)))return t;let d=h?i:0,g=h?a:0;if(m==="H")i=d+f[0],t.push([i,a]);else if(m==="V")a=g+f[0],t.push([i,a]);else if(m==="A")i=d+f[5],a=g+f[6],t.push([i,a]);else{for(let b=0;b<p;b+=2)t.push([d+f[b],g+f[b+1]]);i=d+f[p-2],a=g+f[p-1]}m==="M"&&(s=i,l=a,n=h?"l":"L")}return t}function eK(r){let t=1/0,e=-1/0,o=1/0,n=-1/0;for(let[i,a]of r)t=Math.min(t,i),e=Math.max(e,i),o=Math.min(o,a),n=Math.max(n,a);return{X0:t,X1:e,Y0:o,Y1:n}}var rK=/condensed|narrow|compressed|impact|agency/,Pct=/(?:^|[{;\s])(font-size|font|font-family|font-stretch|text-anchor|letter-spacing|word-spacing|direction|writing-mode|transform|text-transform)\s*:\s*([^;}]*)/gi;function vct(r){for(let t of r.replace(/\/\*[\s\S]*?\*\//g,"").matchAll(Pct)){let e=t[1].toLowerCase(),o=t[2].trim().toLowerCase().replace(/\s*!important$/,"");if(!(e!=="font-size"&&e!=="font"&&/^(normal|inherit|initial|unset|none|0|0px|ltr|horizontal-tb)$/.test(o))&&!(e==="font-family"&&!rK.test(o))&&!(e==="text-transform"&&o==="uppercase"))return!0}return!1}var Nct=new Set(["rect","image","foreignobject","circle","ellipse","line","text","path","polygon","polyline"]),tl=.5,xct=5;function oK(r){let t={frames:0,unmeasured:0,outside:0,crossing:0,textLikely:0,textEvenNarrow:0,samples:{outside:[],crossing:[],textLikely:[],textEvenNarrow:[]}},e=(a,s)=>{a.length<xct&&a.push(s)},o=Math.round,n=r.ownerDocument??r,i=Array.from(n.querySelectorAll("style")).concat(Array.from(r.querySelectorAll("style"))).some(a=>vct(a.textContent??""));for(let a of Array.from(r.querySelectorAll("svg"))){let s=gct(a),l=Array.from(a.querySelectorAll("*")).filter(m=>Nct.has(wc(m.localName))&&fct(m)===a);if(!s){l.length&&t.unmeasured++;continue}t.frames++;let u=(m,p)=>p==="left"||p==="right"?`x ${o(m.X0)}..${o(m.X1)}, frame ${o(s.x0)}..${o(s.x1)}`:`y ${o(m.Y0)}..${o(m.Y1)}, frame ${o(s.y0)}..${o(s.y1)}`,c=m=>m.X0>s.x1+tl?"right":m.X1<s.x0-tl?"left":m.Y0>s.y1+tl?"bottom":m.Y1<s.y0-tl?"top":"",h=m=>m.X1>s.x1+tl?"right":m.X0<s.x0-tl?"left":m.Y1>s.y1+tl?"bottom":m.Y0<s.y0-tl?"top":"";for(let m of l){if(bct(m,a)||Sct(m,a))continue;let p=Act(m,a);if(!p)continue;let f=wc(m.localName);if(f==="text"){if(Math.abs(p[1])>1e-9||Math.abs(p[2])>1e-9)continue;let P=ql(m,a,"writing-mode")??"";if(P.startsWith("tb")||P.startsWith("vertical")||P.startsWith("sideways"))continue;let w=ql(m,a,"fill"),k=ql(m,a,"stroke");if(w==="none"&&(k===null||k==="none"))continue;let E=wct(m,s.x1-s.x0,s.y1-s.y0);if(!E)continue;let U=u8(m,"textLength",VS(m).px,s.x1-s.x0),F=E.length===1&&Wf(m,"textLength")&&U?.sure&&U.v>0?U.v:null,W=null,L=null,v=null;for(let I of E){let B=I.fontPx,C=I.text;if(!(B>0))continue;let O=I.y,G=ql(I.el,a,"dominant-baseline")??ql(I.el,a,"alignment-baseline")??"";G==="middle"||G==="central"?O+=.35*B:(G==="hanging"||G==="text-before-edge")&&(O+=.8*B);let X=ql(I.el,a,"text-anchor")??"start",Y=ql(I.el,a,"direction")==="rtl",j=ql(I.el,a,"letter-spacing"),K=j===null||j==="normal"?0:/^(?:\d*\.)?\d+(?:px)?$/.test(j)?parseFloat(j):NaN,ht=Array.from(C).length,Z=isFinite(K)?K*ht:0,bt=`${ql(I.el,a,"font-family")??""} ${ql(I.el,a,"font-stretch")??""}`,Nt=I.sure&&!i&&!Y&&isFinite(K)&&ql(I.el,a,"word-spacing")===null&&!rK.test(bt)&&(F!==null||!Wf(m,"textLength")),it=(Ot,Zt,Kt)=>{let rt=X==="middle"?I.x-Ot/2:X==="end"?I.x-Ot:I.x;return eK([s8(p,rt,O-Zt*B),s8(p,rt+Ot,O+Kt*B)])},xt=it(F??ht*B*.6+I.extra+Z,.75,.2),at=`text "${C.length>30?C.slice(0,30)+"...":C}"`,wt=s8(p,I.x,O)[0],nt=xt.Y0>s.y1+tl?"bottom":xt.Y1<s.y0-tl?"top":Y?"":X==="start"&&wt>s.x1+tl?"right":X==="end"&&wt<s.x0-tl?"left":"";if(nt){W??={what:at,edge:nt,where:u(xt,nt)};continue}let st=h(xt);if(!st||(L??={what:at,edge:st,where:u(xt,st)},!Nt||v))continue;let vt=it(F??yct(C)*B+I.extra+Z,.5,0),ut=h(vt);if(!ut)continue;let ne=ut==="right"?vt.X1-s.x1:ut==="left"?s.x0-vt.X0:ut==="bottom"?vt.Y1-s.y1:s.y0-vt.Y0;v={what:at,edge:ut,where:u(vt,ut),pastPx:Math.round(ne)}}if(W){t.outside++,e(t.samples.outside,W);continue}L&&(t.textLikely++,e(t.samples.textLikely,L)),v&&(t.textEvenNarrow++,e(t.samples.textEvenNarrow,v));continue}let d;if(f==="circle"||f==="ellipse"){let P=f==="circle"?cs(m,"r"):cs(m,"rx"),w=f==="circle"?P:cs(m,"ry");if(!(P>0&&w>0))continue;let k=cs(m,"cx"),E=cs(m,"cy");d=[[k-P,E-w],[k+P,E+w],[k+P,E-w],[k-P,E+w]]}else if(f==="line")d=[[cs(m,"x1"),cs(m,"y1")],[cs(m,"x2"),cs(m,"y2")]];else if(f==="path"||f==="polygon"||f==="polyline"){if(f==="path")d=uT(m.getAttribute("d")??"");else{let P=(m.getAttribute("points")??"").split(/[\s,]+/).filter(Boolean).map(Number);d=[];for(let w=0;w+1<P.length;w+=2)d.push([P[w],P[w+1]])}if(!d.length||d.some(P=>!isFinite(P[0])||!isFinite(P[1])))continue}else{let P=cs(m,"width"),w=cs(m,"height");if(!(P>0&&w>0))continue;let k=cs(m,"x"),E=cs(m,"y");d=[[k,E],[k+P,E+w],[k+P,E],[k,E+w]]}let g=eK(d.map(P=>s8(p,P[0],P[1]))),b=c(g);if(b){t.outside++,e(t.samples.outside,{what:f,edge:b,where:u(g,b)});continue}if(f==="path")continue;let S=h(g);S&&(t.crossing++,e(t.samples.crossing,{what:f,edge:S,where:u(g,S)}))}}return t}var aK=/^(auto|scroll|overlay)$/,Tct=/[▲▼▴▾↑↓⇅↕]/g;function Pc(r,t){let e="";try{e=String(r.ownerDocument?.defaultView?.getComputedStyle?.(r)?.getPropertyValue(t)??"")}catch{}return e||(e=String(r.style?.getPropertyValue?.(t)??"")),e.trim().toLowerCase()}function c8(r,t){let e=Pc(r,`overflow-${t}`);if(e)return e;let o=Pc(r,"overflow").split(/\s+/).filter(Boolean);return(t==="x"?o[0]:o[1]??o[0])??"visible"}function sK(r){let t=e=>{for(let o=e?.firstChild;o;o=o.nextSibling){if(o.nodeType===3&&String(o.nodeValue).trim())return String(o.nodeValue);if(o.nodeType===1&&!cK.has(String(o.localName||"").toLowerCase())){let n=t(o);if(n)return n}}return""};return t(r).replace(Tct,"").replace(/\s+/g," ").trim()}var h8=r=>{let t=parseFloat(r);return/px$|^\d+(\.\d+)?$/.test(r.trim())&&Number.isFinite(t)?t:NaN};function Wct(r){let t=r.querySelector?.("svg");if(t){let o=Array.from(t.querySelectorAll("rect")).filter(i=>!(parseFloat(i.getAttribute("fill-opacity")??i.getAttribute("opacity")??"1")<1&&i.getAttribute("rx")));if(o.length)return{kind:"bar",barX:parseFloat(o[0].getAttribute("x")??"0")||0};if(t.querySelector("circle"))return{kind:"dot"};let n=t.querySelector("path, polyline, line");if(n&&n.localName!=="line")return{kind:"line"};if(t.hasAttribute("data-icon")||t.getAttribute("role")==="img")return{kind:"icon"}}for(let o of Array.from(r.querySelectorAll?.("div, span")??[])){let n=String(o.style?.background||o.style?.backgroundColor||"");if(!n||/transparent|none/.test(n))continue;let i=String(o.style?.width||""),a=String(o.textContent??"").trim();if(/%|px/.test(i)&&!a)return{kind:"bar",barX:h8(String(o.style?.marginLeft||o.style?.left||"0"))||0};if(a&&parseFloat(String(o.style?.borderRadius||"0"))>0)return{kind:"chip"}}let e=String(r.textContent??"").trim();return e&&!/^[-–—]$/.test(e)?{kind:"text"}:{kind:""}}function Lct(r){let t=Array.from(r.querySelectorAll(".d3-mark[data-row-idx], tr[data-row-idx]")).filter(S=>!S.closest(".d3-legend-mark")&&String(S.namespaceURI||"").includes("xhtml")).map(S=>({r:S,cells:(()=>{let P=Array.from(S.children),w=P.filter(k=>/^(gridcell|cell)$/.test(String(k.getAttribute?.("role")??""))||/^(td|th)$/i.test(String(k.localName)));return w.length>=2?w:P})()})).filter(S=>S.cells.length>=2);if(t.length<2)return null;let e=new Map;for(let S of t)e.set(S.cells.length,(e.get(S.cells.length)??0)+1);let o=[...e.entries()].sort((S,P)=>P[1]-S[1])[0][0],n=t.filter(S=>S.cells.length===o),i=n[0],a=i.r.parentElement,s=null;for(let S=a;S&&S!==r.parentElement;S=S.parentElement)if(c8(S,"y")!=="visible"||c8(S,"x")!=="visible"){s=S;break}let l=s?c8(s,"y"):"visible",u=s?c8(s,"x"):"visible",c=Array.from(r.querySelectorAll("[role=columnheader], th")).filter(S=>!S.closest("[data-row-idx]"));if(c.length!==o){c=[];let S=i.cells.map(P=>String(P.style?.width??""));for(let P of Array.from(r.querySelectorAll("div, tr"))){if(P.closest("[data-row-idx]"))continue;let w=Array.from(P.children);if(!(w.length!==o||!w.every((k,E)=>String(k.style?.width??"")===S[E]&&S[E]))&&!n.some(k=>k.r===P)){c=w;break}}}let h=c.length===o&&!!s&&aK.test(l)&&!c.some(S=>s.contains(S)),m=Array.from({length:o},(S,P)=>{let w=new Map,k=new Set,E=0,U=null;for(let I of n){let B=I.cells[P],C=Wct(B);C.kind&&w.set(C.kind,(w.get(C.kind)??0)+1),C.kind==="bar"&&C.barX!==void 0&&k.add(Math.round(C.barX)),Pc(B,"position")==="sticky"&&(E++,U=Pc(B,"left")&&Pc(B,"left")!=="auto"?"left":Pc(B,"right")&&Pc(B,"right")!=="auto"?"right":U)}let F=[...w.entries()].sort((I,B)=>B[1]-I[1]),W=F[0]?.[0]??"empty";W==="bar"&&k.size>1&&(W="diverging bar");let L=F.reduce((I,[,B])=>I+B,0);return F[1]&&F[1][1]/L>=.2&&(W=`${W} and ${F[1][0]}`),{name:c[P]?sK(c[P])||`column ${P+1}`:`column ${P+1}`,marks:W,stickTo:E>=Math.ceil(n.length/2)?U??"left":null}}),p=[];if(s&&aK.test(l)){let S=new Set;for(let P of Array.from(r.querySelectorAll("*"))){if(s.contains(P)||P.contains(s)||c.some(k=>k.contains(P)||P===k)||!(s.compareDocumentPosition(P)&2))continue;let w=Array.from(P.childNodes).filter(k=>k.nodeType===3&&String(k.nodeValue).trim()).map(k=>String(k.nodeValue).trim()).join(" ");!w||[...S].some(k=>k.contains(P))||(S.add(P),p.push(w.length>60?w.slice(0,57)+"...":w))}}let f=s?Array.from(s.querySelectorAll("*")).filter(S=>Pc(S,"position")==="sticky"&&Pc(S,"top")&&Pc(S,"top")!=="auto").map(S=>sK(S)).filter(Boolean).slice(0,4):[],d=h8(String(i.r.style?.width??""))||i.cells.reduce((S,P)=>S+(h8(String(P.style?.width??""))||NaN),0),g=NaN;for(let S=s;S&&Number.isNaN(g);S=S.parentElement)g=h8(String(S.style?.width??""));let b=Number.isFinite(d)&&Number.isFinite(g)?d>g+.5:null;return{rows:n.length,columns:m,overflowY:l,overflowX:u,heldAbove:p,headersHeld:h,stuckTop:f,widerThanBox:b}}var Ict=/^(none|transparent|currentcolor|inherit|initial|unset)$|^url\(/i;function Rct(r){for(let t of[r,...Array.from(r.querySelectorAll?.("*")??[])]){let e=String(t.getAttribute?.("fill")??t.style?.fill??"").trim();if(e&&!Ict.test(e))return e}return null}function _ct(r,t){let e=p=>{let f=t.lab(p);return f&&Number.isFinite(f.l)?f:null},o=(p,f)=>Math.hypot(p.l-f.l,p.a-f.a,p.b-f.b),n=p=>Math.hypot(p.a,p.b),i=null;for(let p of Array.from(r.querySelectorAll("linearGradient"))){let f=Array.from(p.querySelectorAll("stop")).map(P=>e(String(P.getAttribute("stop-color")??P.style?.stopColor??"").trim())).filter(Boolean);if(f.length<3)continue;let d=f.slice(1,-1),g=d.reduce((P,w)=>n(w)<n(P)?w:P,d[0]),b=f[0],S=f[f.length-1];if(n(g)+10<n(b)&&n(g)+10<n(S)&&o(b,S)>30){i={low:b,mid:g,high:S};break}}if(!i)return null;let{low:a,mid:s,high:l}=i,u=[];for(let p of Array.from(r.querySelectorAll(".d3-mark"))){if(p.closest(".d3-legend-mark"))continue;let f=Rct(p),d=f?e(f):null;if(!d)continue;let g=o(d,s),[b,S]=o(d,a)<=o(d,l)?[a,o(d,a)]:[l,o(d,l)],P=o(b,s);if(!(P>0)||g+S>P*1.35)continue;let w=String(p.getAttribute("data-row-idx")??p.querySelector?.("[data-row-idx]")?.getAttribute("data-row-idx")??"");u.push({t:Math.min(1,g/P),rowIdxs:w.split(",").filter(Boolean).map(Number),fill:f})}let c=u.length;if(c<8)return null;let h=u.filter(p=>p.t>=.6),m=u.filter(p=>p.t<=.25).length;return!h.length||h.length>Math.max(1,Math.floor(c*.05))||m<.75*c?null:{marks:c,nearCenter:m,atEnds:h.map(p=>({rowIdxs:p.rowIdxs,fill:p.fill}))}}var Uct=new Set(["d3-sankey","d3-hexbin","d3-voronoi-treemap"]);function Bct(r){}var cK=new Set(["title","desc","metadata","style","script"]);function hK(r){let t="";for(let e=r?.firstChild;e;e=e.nextSibling)e.nodeType===3||e.nodeType===4?t+=e.nodeValue||"":e.nodeType===1&&!cK.has(String(e.localName||"").toLowerCase())&&(t+=hK(e));return t}function cT(r){return VS(r).px}function Dct(r,t){let e=o=>{let n=String(r.getAttribute?.(o)??"").trim().split(/[\s,]+/)[0]??"",i=parseFloat(n);return isFinite(i)?/em$/i.test(n)?i*t:i:0};return{x:e("x")+e("dx"),y:e("y")+e("dy")}}function Oct(r){for(let t=r;t&&t.getAttribute;t=t.parentElement){let o=(/(?:^|;)\s*text-anchor\s*:\s*([a-z]+)/i.exec(String(t.getAttribute("style")||""))?.[1]??t.getAttribute("text-anchor")??"").trim().toLowerCase();if(o)return o}return"start"}function Fct(r){let t=new Set(["SVGElement","SVGGraphicsElement","SVGGeometryElement","SVGTextContentElement"].map(h=>r[h]?.prototype).filter(Boolean)),e=r.Element?.prototype;for(let h of["svg","g","text","tspan","textPath","path","rect","circle","ellipse","line","polyline","polygon","image","use"])try{for(let m=Object.getPrototypeOf(r.document.createElementNS("http://www.w3.org/2000/svg",h));m&&m!==e;m=Object.getPrototypeOf(m))t.add(m)}catch{}let o=h=>["text","tspan","textpath"].includes(String(h.tagName||"").toLowerCase()),n=h=>o(h)?hK(h).trim().length*cT(h)*.6:0,i=h=>{let m=String(h.tagName||"").toLowerCase();if(m==="path")return uT(h.getAttribute("d")||"");if(m==="line")return[[+h.getAttribute("x1")||0,+h.getAttribute("y1")||0],[+h.getAttribute("x2")||0,+h.getAttribute("y2")||0]];let p=String(h.getAttribute("points")||"").split(/[\s,]+/).filter(Boolean).map(Number),f=[];for(let d=0;d+1<p.length;d+=2)f.push([p[d],p[d+1]]);return f},a=h=>{let m=0;for(let p=1;p<h.length;p++)m+=Math.hypot(h[p][0]-h[p-1][0],h[p][1]-h[p-1][1]);return m},s=function(){if(o(this)){let f=cT(this),d=Math.max(1,n(this)),g=Dct(this,f),b=Oct(this);return{x:b==="middle"?g.x-d/2:b==="end"?g.x-d:g.x,y:g.y-f*.8,width:d,height:Math.max(1,f)}}let h=parseFloat(this.getAttribute?.("width")||"")||0,m=parseFloat(this.getAttribute?.("height")||"")||0;if(h>0||m>0)return{x:0,y:0,width:h||1,height:m||1};let p=parseFloat(this.getAttribute?.("r")||"")||0;return p>0?{x:-p,y:-p,width:2*p,height:2*p}:{x:0,y:0,width:1,height:1}},l=function(){let h=s.call(this);if(String(this.tagName||"").toLowerCase()!=="svg"){let m=[1,0,0,1,0,0];for(let p=this;p&&m&&String(p.tagName||"").toLowerCase()!=="svg";p=p.parentElement){let f=sT(p.getAttribute?.("transform"));m=f?GS(f,m):null}if(m){let p=[[h.x,h.y],[h.x+h.width,h.y],[h.x,h.y+h.height],[h.x+h.width,h.y+h.height]].map(([S,P])=>[m[0]*S+m[2]*P+m[4],m[1]*S+m[3]*P+m[5]]),f=p.map(S=>S[0]),d=p.map(S=>S[1]),g=Math.min(...f),b=Math.min(...d);h={x:g,y:b,width:Math.max(...f)-g,height:Math.max(...d)-b}}}return{...h,top:h.y,left:h.x,right:h.x+h.width,bottom:h.y+h.height,toJSON(){return h}}},u=(h,m,p)=>Object.defineProperty(h,m,{configurable:!0,writable:!0,value:p});for(let h of t)u(h,"getBBox",s),u(h,"getBoundingClientRect",l),u(h,"getComputedTextLength",function(){return n(this)}),u(h,"getSubStringLength",function(m,p){return o(this)?Math.max(0,(p||0)*cT(this)*.6):0}),u(h,"getTotalLength",function(){return a(i(this))}),u(h,"getPointAtLength",function(m){let p=i(this);if(!p.length)return{x:0,y:0};let f=Math.max(0,+m||0);for(let g=1;g<p.length;g++){let b=Math.hypot(p[g][0]-p[g-1][0],p[g][1]-p[g-1][1]);if(f<=b&&b>0){let S=f/b;return{x:p[g-1][0]+S*(p[g][0]-p[g-1][0]),y:p[g-1][1]+S*(p[g][1]-p[g-1][1])}}f-=b}let d=p[p.length-1];return{x:d[0],y:d[1]}});let c=r.HTMLCanvasElement?.prototype;if(c){let h=new WeakMap,m=f=>{let d=String(f||"").match(/([\d.]+)\s*(px|pt|em|rem)\b/i);if(!d)return 10;let g=parseFloat(d[1]);return d[2].toLowerCase()==="pt"?g*4/3:/r?em/i.test(d[2])?g*16:g},p=()=>{};Object.defineProperty(c,"getContext",{configurable:!0,writable:!0,value:function(f){if(String(f||"").toLowerCase()!=="2d")return null;let d=h.get(this);if(!d){let g=this;d=new Proxy({canvas:g,font:"10px sans-serif",measureText(b){let S=m(this.font),P=String(b??"").length*S*.6;return{width:P,actualBoundingBoxLeft:0,actualBoundingBoxRight:P,actualBoundingBoxAscent:S*.8,actualBoundingBoxDescent:S*.2,fontBoundingBoxAscent:S*.8,fontBoundingBoxDescent:S*.2}},getImageData:(b,S,P,w)=>({width:P,height:w,data:new Uint8ClampedArray(Math.max(1,P*w*4))}),createLinearGradient:()=>({addColorStop:p}),createRadialGradient:()=>({addColorStop:p}),getLineDash:()=>[],isPointInPath:()=>!1,isPointInStroke:()=>!1},{get:(b,S)=>S in b?b[S]:typeof S=="string"&&/^[a-z]/.test(S)?p:void 0}),h.set(this,d)}return d}})}}function Gct(r){let t=["window","document","navigator","Event","CustomEvent","MouseEvent","KeyboardEvent","PointerEvent","Element","HTMLElement","SVGElement","Node","getComputedStyle","requestAnimationFrame","cancelAnimationFrame","DOMParser","XMLSerializer","MutationObserver","Image","ResizeObserver"],e=t.map(n=>[n,Object.getOwnPropertyDescriptor(globalThis,n)]),o=n=>n==="window"?r:n==="ResizeObserver"?r.ResizeObserver??class{observe(){}unobserve(){}disconnect(){}}:typeof r[n]=="function"&&/^[a-z]/.test(n)?r[n].bind(r):r[n];for(let n of t){let i=o(n);if(i!==void 0)try{Object.defineProperty(globalThis,n,{configurable:!0,writable:!0,value:i})}catch{}}return()=>{for(let[n,i]of e)try{i?Object.defineProperty(globalThis,n,i):delete globalThis[n]}catch{}}}function lK(r,t){let e=t.split(/\r?\n/);for(let o of String(r?.stack??"").split(`
318
+ }`,(e.head||e.documentElement)?.appendChild(H)}catch{}},vt=()=>{if(typeof t.marksSelect!="function")return!1;try{return t.marksSelect()===!1}catch{return!1}},ut=()=>{if(!b)try{r.classList?.[vt()?"add":"remove"](IS);let H=G,Q=!!H&&H.length>0,mt=Q&&!Y;r.classList?.[mt?"add":"remove"](xf);let Bt=d.dimOpacity;if(typeof Bt=="number"){let Mo=String(Bt),_o=j7.get(r),no=gj(r);_o?no&&_o.wrote&&!bj(no,_o.wrote)&&(_o.was=no.value?no:null):(_o={was:no?.value?no:null,holders:0,wrote:null},j7.set(r,_o)),C||(_o.holders++,C=!0),_o.wrote={value:Mo,priority:""},r.style?.setProperty(rd,Mo)}else O();let Jt=r.querySelectorAll(`.${Ef}`);for(let Mo of Array.from(Jt))Mo.classList?.remove(Ef);let de=!!X&&(typeof r.contains=="function"?r.contains(X):X.isConnected!==!1);Q&&de&&X.classList?.add(Ef);let Ce=new Set(H??[]),Ze=r.querySelectorAll(`.${vo}[${Hr}], .${zl}[${Hr}]`),Ho=dz(r);if(Ho!=="any-row"){let Mo=Array.from(Ze),_o=yz(Mo.map(no=>({key:Xk(no),rows:dP(no.getAttribute(Hr))})),Q?Ce:[],Ho,bt());if(Mo.forEach((no,So)=>no.classList?.[_o.on[So]?"add":"remove"](jl)),Nt(_o.keys.length?{keys:_o.keys,selection:Array.from(Ce)}:null),Q)try{t.onSelectionPaint?.({rule:Ho,mode:_o.mode,lit:_o.on.filter(Boolean).length,marks:Mo.length,selection:Ce.size})}catch{}return}for(let Mo of Array.from(Ze)){let _o=dP(Mo.getAttribute(Hr)),no=Q&&_o.some(So=>Ce.has(So));Mo.classList?.[no?"add":"remove"](jl)}}catch{}},ne="bic-selection-glyphs",Ot=null,Zt=null,Kt=null,rt="",Ut=!1,Dt=!1,Vt="",zt=()=>`${r.offsetWidth??0}x${r.offsetHeight??0}`,Me=`.${ne}, .${lP}`,He=H=>{let Q=H.target;return!Q||Q.closest?.(Me)?!1:!!(Q.classList?.contains(vo)||Q.querySelector?.(`.${vo}`))},ko=H=>{if(H&&(Dt=!0),Ut)return;Ut=!0;let Q=()=>{let mt=Dt;Ut=!1,Dt=!1,(Zt||Kt)&&le(mt?"if-changed":!1)};o?.requestAnimationFrame?o.requestAnimationFrame(Q):setTimeout(Q,16)},ir=H=>{if(!H){Zt&&(Zt.disconnect(),Zt=null),Kt&&(Kt.disconnect(),Kt=null);return}let Q=o?.MutationObserver;!Zt&&Q&&(Zt=new Q(Bt=>{!Ut&&Bt.some(He)&&ko(!1)}),Zt.observe(r,{subtree:!0,attributes:!0,attributeFilter:["transform","d","x","y","cx","cy","points","width","height","visibility","opacity","style","class"]}));let mt=o?.ResizeObserver;!Kt&&mt&&(Kt=new mt(()=>{zt()!==rt&&ko(!0)}),Kt.observe(r))},Tt=H=>{try{let Q=H.checkVisibility;if(typeof Q=="function")return Q.call(H,{visibilityProperty:!0,opacityProperty:!0})!==!1;let mt=o?.getComputedStyle;if(typeof mt!="function")return!0;let Bt=mt.call(o,H);if(Bt.visibility==="hidden"||Bt.visibility==="collapse")return!1;for(let Jt=H;Jt&&Jt!==r;Jt=Jt.parentElement){let de=Jt===H?Bt:mt.call(o,Jt);if(de.display==="none"||de.opacity!==""&&parseFloat(de.opacity)===0)return!1}}catch{}return!0},ee=()=>{let H=new Map,Q=Bt=>{if(!H.has(Bt)){let Jt=null;try{if((Bt.tagName||"").toLowerCase()==="svg"){let de=Bt.getBoundingClientRect();de.width>0&&de.height>0&&(Jt=de)}else Bt.hasAttribute?.("clip-path")&&(Jt=B7(Bt))}catch{Jt=null}H.set(Bt,Jt)}return H.get(Bt)??null},mt=.5;return(Bt,Jt,de)=>{for(let Ce=Bt;Ce&&Ce!==r;Ce=Ce.parentElement){let Ze=Q(Ce);if(Ze&&(Jt<Ze.left-mt||Jt>Ze.right+mt||de<Ze.top-mt||de>Ze.bottom+mt))return!1}return!0}},le=(H=!0)=>{if(b)return;let Q=!1;try{let mt=r.querySelector(`:scope > .${ne}`);wz(mt);let Bt=d.selectionGlyph;if(Bt!=="dot"&&Bt!=="check"){Vt="";return}if(!(!!G&&G.length>0&&!Y)){Vt="";return}if(d.suppressSelectionGlyph){if(H===!0)try{t.onSelectionGlyphs?.({mode:Bt,drawn:0,total:0,suppressed:!0})}catch{}Vt="";return}if(Q=!0,!mt){mt=e.createElement("div"),mt.className=ne,mt.setAttribute("aria-hidden","true"),Object.assign(mt.style,{position:"absolute",left:"0",top:"0",width:"0",height:"0",overflow:"hidden",pointerEvents:"none",zIndex:"1"});try{let no=o?.getComputedStyle?.(r)?.position||r.style.position;if(!no||no==="static"){let So=r.style.position;r.style.position="relative",Ot===null&&(Ot=So)}}catch{}r.appendChild(mt)}mt.style.width="0",mt.style.height="0";let de=r.scrollWidth||0,Ce=r.scrollHeight||0;mt.style.width=`${de}px`,mt.style.height=`${Ce}px`,rt=zt();let Ze=[];Az(r,mt.getBoundingClientRect(),Ze,{shown:Tt,at:ee()});let Ho=!!d.isHighContrast,Mo=Ze.length?Pz(mt,Ze,{symbol:Bt==="check"?"\u2713":"\u25CF",color:Ho&&d.themeFg||"#111",halo:Ho&&d.themeBg||"#fff"}):0,_o=`${Bt}:${Mo}:${Ze.length}`;if(H===!0||H==="if-changed"&&_o!==Vt){Vt=_o;try{t.onSelectionGlyphs?.({mode:Bt,drawn:Mo,total:Ze.length,suppressed:!1})}catch{}}}catch{}finally{try{ir(Q),Zt?.takeRecords()}catch{}}},be=(H,Q,mt,Bt=!1,Jt=!0,de)=>{if(!b){if(G=H,j=H.length>0&&Bt,K=Jt,Jt&&(ht=H,Z=j),X=H.length?mt??null:null,Y=H.length>0&&Ok(!!mt,Dk(r)),!H.length&&!de?.keepHidden&&(xt=0),at=!0,ut(),le(),W?.refresh(),Jt)for(let Ce of it)try{Ce(H,Q,de)}catch{}nt()}},je=H=>{be(ht,H,void 0,Z,!1),K=!0},mr=H=>{if(Wz(d.lasso)==="highlight"){be(H,"user",null,!0,!1);return}if(be(H,"user",null,!0),k||!H.length)return;let Q=!0;try{Q=t.selectionReachesPage?t.selectionReachesPage()!==!1:it.size>0}catch{}if(!Q){k=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] a lasso circled ${H.length} ${H.length===1?"row":"rows"}, but the page gave this chart no filter to set (no \`selects\` or bindFilter, no chart group), so the lasso only highlights inside the chart and the rest of the page does not follow. To filter the page, pass selects={useBicFilter("<key column>")} to this chart and filter the other charts by that filter; for a highlight on purpose, set lasso.effect to "highlight".`)}catch{}}},Qe=0,dr=150,pr=H=>{let Q=H?.detail||{};if(Qe=Date.now(),Q.clear)!K&&G&&G.length?je(Q.source||"chart"):be([],Q.source||"chart",void 0,!1,!0);else{if(vt())return;Q.mark?be(dP(Q.mark.getAttribute?.(Hr)),Q.source||"chart",Q.mark,!0):Array.isArray(Q.rows)&&be(mz(Q.rows),Q.source||"chart",null,!0,!0,Q.keepHidden===!0?{keepHidden:!0}:void 0)}},jr=Sz({root:r,doc:e,log:()=>{}}),co=()=>{if(G&&G.length){let H=!K,Q=r[iP];if(j&&typeof Q=="function")try{Q()}catch{}H?K||je("user"):G&&G.length&&be([],"user",void 0,!1,!0)}},Pn=null,vc=()=>{let H=Pn;Pn=null;try{H?.destroy()}catch{}},$l=`.${vo}[${Hr}], .${zl}[${Hr}], .${Sc}[${Hr}]`,Nc=H=>{let Q=bz(r,H);if(qk(r),Q)return;let mt=vt();if(r.classList?.[mt?"add":"remove"](IS),mt||Date.now()-Qe<dr||W7(H?.target,r))return;let Bt=jr.findMark(H?.target,$l,H);if(Bt||(Bt=jr.penetrateOverlayAt(H?.clientX,H?.clientY,$l)),Bt||(Bt=jr.resolveByGeometry(H?.clientX,H?.clientY,$l)),!Bt){co();return}let Jt=dP(Bt.getAttribute(Hr));if(!Jt.length)return;let de=Bt.classList?.contains?.(Sc)?Bt:null,Ce=!!(H?.ctrlKey||H?.metaKey||H?.shiftKey),Ze=K?G:ht,Ho=pz(Ze,Jt,{ctrl:!!(H?.ctrlKey||H?.metaKey),shift:!!H?.shiftKey}),Mo=!Ce&&Ho.length===0;Nt(fz(bt(),Ze,Xk(Bt),Ho,{ctrl:!!(H?.ctrlKey||H?.metaKey),shift:!!H?.shiftKey})),be(Ho,"user",Mo?null:de)};r.addEventListener(nP,pr);let xc=gz(r);if(r.addEventListener("click",Nc),F){let H=Q=>{let mt=dP(Q.getAttribute(Hr))[0];return vX(a.columns||[],mt==null?null:a.rows?.[mt],d.cultureCode)};W=NX({container:r,markSelector:$l,pressSelector:`.${em}`,skipSelector:`.${id}, .${ne}, .${lP}`,inert:vt,select:(Q,mt)=>{let Bt=o?.MouseEvent??MouseEvent;Q.dispatchEvent(new Bt("click",{bubbles:!0,cancelable:!0,ctrlKey:mt.ctrl,shiftKey:mt.shift}))},clear:co,isSelected:Q=>!!Q.classList?.contains(jl),labelOf:H,keyOf:Q=>Q.getAttribute(Hr)??""})}r.classList?.add(Gn),st();let Jl=t.fit??!0,el=t.labelContrast??!0,Da=()=>{let H=r[y7];if(typeof H=="function")try{H()}catch{}},li=t.zoomMemory??null,hs=null,Ql="",nm=()=>{if(li)try{li.flush()}catch{}},Ec=()=>{if(li)try{li.release?.(r)}catch{}},Cc=t.restoreScroll!==!1,rl,Zl=()=>{if(t.code)return t.code;if(rl===void 0&&typeof t.renderFn=="function")try{rl=Function.prototype.toString.call(t.renderFn)}catch{return t.renderFn}return rl},kc=!1,Mc=()=>{if(li&&hs)try{li.restore(r,hs,Ql,i)}catch{}try{let mt=pX(r,E);if(mt.collisions.length&&!w){w=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] ids shared with another chart, scoped: ${mt.collisions.slice(0,5).join(", ")}`)}catch{}}t.onIdScope?.(mt)}catch{}if(el!==!1)try{let mt=el===!0?{}:{...el};if(!mt.pageBg){let Jt=d.backgroundColor??d.themeBg;typeof Jt=="string"&&Jt&&(mt.pageBg=Jt)}let Bt=hX(r,mt);t.onLabelContrast?.(Bt)}catch{}if(t.layoutPass)try{t.layoutPass(r)}catch{}oM(r,e),ut();try{let mt=e8(r);if(r8({markCount:mt.markCount,rows:a.rows?a.rows.length:0,animated:t.animated,contractUntagged:t.contractUntagged,declaresNoRowMarks:mt.declaresNoRowMarks})){if(!P){P=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] this chart rendered without error but painted no data marks, against ${a.rows.length} row(s) \u2014 so the container is empty. The usual cause is that the generated code binds a column BY NAME that is no longer in the data, sending it down its own "no data" branch. Check that the columns in your table still match the ones the chart was generated for.`)}catch{}}t.onBlankRender?.({census:mt,rows:a.rows?a.rows.length:0})}}catch{}if(t.onHitBandCensus)try{t.onHitBandCensus(Fz(r,e))}catch{}if(t.onColourSpreadCensus)try{t.onColourSpreadCensus(_j(r,e))}catch{}if(t.onClippedTextCensus)try{t.onClippedTextCensus(aX(r))}catch{}if(t.onValuePlacementCensus)try{t.onValuePlacementCensus(lX(r,a))}catch{}let H=Kz(r);if(Jl!==!1)try{let mt=Jl===!0?{}:Jl,Bt=Yz(r,Cc?{...mt,restoreScroll:{memory:H,key:Zl()}}:mt);t.onFit?.(Bt)}catch{}try{v()}catch{}le(),im(),W?.refresh();let Q=Tc;Tc=null,wX(r,Q),Vn?.takeRecords(),D()};function im(){try{Pn=_z({container:r,options:()=>d,rows:a.rows?a.rows.length:0,select:mr,clearSelection:co})}catch{}}let Vn=null,Tc=null,Wc=(t.annotations??[]).length>0,N=H=>H.nodeType===1&&(!!H.classList?.contains(vo)||!!H.querySelector?.(`.${vo}`)),T=()=>!!Pn?.surface&&!Pn.surface.isConnected,R=()=>{if(!b){try{oM(r,e)}catch{}ut();try{v()}catch{}le(!1),T()&&im(),W?.refresh(),Vn?.takeRecords()}};function D(){let H=o?.MutationObserver;Vn||!H||b||(Vn=new H(Q=>{b||!Q.some(mt=>Array.from(mt.removedNodes).some(N))||!(G&&G.length)&&!Wc&&!T()||R()}),Vn.observe(r,{childList:!0,subtree:!0}))}let _=H=>{let Q=String(H?.message??H??"");return t.onInvalidSentinel&&dX(Q)?(Da(),r.innerHTML="",t.onInvalidSentinel({reason:yX(Q),message:Q}),null):EX(H,n)},V={render(){if(b)return;let H=++U;if(Da(),ir(!1),Tc=AX(r),vc(),nm(),kc&&Cc&&iM(r,Zl()),r.innerHTML="",Vn?.takeRecords(),kc=!0,!g){if(!t.code)throw new Error("createChartHost: provide code or renderFn");g=MX(t.code,o,e,i)}if(d.geo===void 0&&t.geoKind){let mt=t.geoProvider?.(t.geoKind)??Qz(t.geoKind);if(mt)d={...d,geo:mt};else if(!S){S=!0;try{(o?.console??console)?.warn(`[@bicharts/chart-host] geoKind "${t.geoKind}" was set but no geometry is available, so this chart will draw without a basemap. Either \`await loadGeo("${t.geoKind}")\` before rendering, pass a geoProvider, or import { geoForKind } from "@bicharts/chart-host/geo" and set options.geo.`)}catch{}}}d.geoUnmatched===void 0&&a.geoUnmatched&&(d={...d,geoUnmatched:a.geoUnmatched}),d.geoPoint===void 0&&a.geoPoint&&(d={...d,geoPoint:a.geoPoint}),d.geoPointDest===void 0&&a.geoPointDest&&(d={...d,geoPointDest:a.geoPointDest}),d.geoPointRefused===void 0&&a.geoPointRefused?.length&&(d={...d,geoPointRefused:a.geoPointRefused}),d.dateCellsAreUtcDays===void 0&&a.dateCellsAreUtcDays&&(d={...d,dateCellsAreUtcDays:!0}),d.suppressSelectionGlyph===void 0&&a.meta?.suppressSelectionGlyph===!0&&(d={...d,suppressSelectionGlyph:!0}),F&&(d={...d,keyboardMarks:!0});let Q;if(hs=null,li&&t.code&&!t.renderFn)try{Ql=li.keyFor(t.code,d.width??r.clientWidth,d.height??r.clientHeight),hs=li.capture(i)}catch{hs=null}s.hostSelection==null&&(d.hostSelection=at?wt():void 0);try{try{Q=g(r,{columns:a.columns,rows:a.rows},d)}finally{try{hs?.release()}catch{}}}catch(mt){let Bt=_(mt);if(Bt)throw B(Promise.reject(Bt)),Bt;B(Promise.resolve());return}if(!Fut(Q)){Mc(),B(Promise.resolve());return}B(new Promise((mt,Bt)=>{let Jt=setTimeout(()=>{Bt(new Error(`[@bicharts/chart-host] the chart did not finish drawing within ${Math.round(fj/1e3)}s, so the host stopped waiting for it. Nothing past that point ran: no label-contrast pass, no hit-target heal, no census, no fit. A render() that returns a promise has to settle it.`))},fj),de=Ce=>{clearTimeout(Jt),Ce()};Promise.resolve(Q).then(()=>de(()=>{if(b||H!==U){mt();return}Mc(),mt()}),Ce=>de(()=>{if(b||H!==U){mt();return}let Ze=_(Ce);Ze?Bt(Ze):mt()}))}))},setOptions(H){b||(s={...s,...p(H??{})},d=f(s),V.render())},setData(H){b||(a=H,at=!1,V.render())},get options(){return d},setAnnotations(H){if(!b){Wc=(H??[]).length>0,L.set(H);try{v()}catch{}}},get annotationReport(){return L.report},get rendered(){return I},selection:{onChange(H){return it.add(H),()=>it.delete(H)},clear(){if(b)return;let H=r[iP];if(typeof H=="function")try{H()}catch{}Nt(null),Pn?.clear({publish:!1,source:"host"}),be([],"host")},highlight(H){if(b)return;let Q=Array.isArray(H)?H.slice():[];Pn&&Pn.rows().length&&!aP(Q,Pn.rows())&&Pn.clear({publish:!1,source:"host"}),be(Q,"host")},setHidden(H){if(b)return;let Q=Number(H),mt=Number.isFinite(Q)&&Q>0?Math.floor(Q):0;mt===xt&&at||(xt=mt,at=!0,nt())},get current(){return G}},animation:{stop(){b||Da()}},initialMark(){return b?null:r[_k]??null},destroy(){if(!b&&(b=!0,Da(),Vn&&(Vn.disconnect(),Vn=null),W?.destroy(),W=null,r.removeEventListener(nP,pr),r.removeEventListener("click",Nc),xc(),qk(r),vc(),it.clear(),O(),L.destroy(),kc&&Cc&&iM(r,Zl()),nd(r),nm(),Ec(),ir(!1),r.innerHTML="",Ot!==null)){try{r.style.position==="relative"&&(r.style.position=Ot)}catch{}Ot=null}}};return V}var Gut=Object.freeze({sourceId:null,rows:Object.freeze([])});function vP(r,t){return r?t.map(e=>r[e]).filter(e=>e!==void 0):t.slice()}function Vut(r,t){let e=new Map;return r.forEach((o,n)=>{e.has(o)||e.set(o,n)}),t.map(o=>e.get(o)).filter(o=>o!==void 0)}var Hut=(r,t)=>{if(r.length!==t.length)return!1;let e=r.slice().sort((n,i)=>n-i),o=t.slice().sort((n,i)=>n-i);return e.every((n,i)=>n===o[i])};function TX(r,t,e,o,n,i){if(t.sourceId===e&&t.rows.length>0){if(i){let s=Vut(i,t.rows);Hut(s,r.selection.current??[])||r.selection.highlight(s)}return}if(o&&n&&n.length){r.selection.highlight(n.slice());return}r.selection.current&&r.selection.current.length&&r.selection.clear()}function zM(r,t,e={}){let o=r,n=t,i=e.geo??null,a=e.point??null,s=e.destination??null,l=Gut,u=new Set,c=new Set,h=g=>{for(let b of Array.from(u))b(l,g)},m=(g,b)=>{let S=l,P=S.rows.length&&S.sourceId&&S.sourceId!==g?S.rows.slice():null;return b?S.sourceId===b?P:null:P},p=g=>{let b=g?g.slice():n.map((w,k)=>k),S=b.map(w=>n[w]);return{payload:nX(o,S,i??void 0,a??void 0,s??void 0),rowMap:b}},f=(g,b={})=>p(b.respondsWith==="highlight"?null:m(g,b.filteredBy)),d={get selection(){return l},get columns(){return o},get rows(){return n},incomingFor:m,payloadFor:p,memberPayload:f,publish(g,b){l=b.length?{sourceId:g,rows:b.slice()}:{sourceId:null,rows:[]},h(b.length?"select":"clear")},clear(){l={sourceId:null,rows:[]},h("clear")},setSource(g,b,S={}){o=g,n=b,i=S.geo??null,a=S.point??null,s=S.destination??null,h("source")},onChange(g){return u.add(g),()=>{u.delete(g)}},attach(g,b,S={}){let P=S.respondsWith==="highlight",w=f(g,S).rowMap,k=L=>P||!L?"*":L.join(","),E=k(m(g,S.filteredBy)),U=b.selection.onChange((L,v)=>{if(v==="host")return;let I=vP(w,L);g&&d.publish(g,I),S.onSelect?.(I)}),F=d.onChange((L,v)=>{let I=m(g,S.filteredBy),B=k(I);if(v==="source"||B!==E){let C=p(P?null:I);w=C.rowMap,E=B,b.setData(C.payload)}TX(b,L,g,P,I,w)}),W={get rowMap(){return w},detach(){U(),F(),c.delete(W)}};return c.add(W),W},destroy(){for(let g of Array.from(c))g.detach();u.clear()}};return d}/*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */var zut=10,jut=1e5,Xut=1e4,oo=r=>Object.freeze({...r,...r.values?{values:Object.freeze([...r.values])}:{}}),jM=Object.freeze({aggregation:oo({timing:"live-and-next-generate",default:"",values:["","sum","average","median","min","max","count","distinct"],wire:"request"}),colorScaleLow:oo({timing:"live-and-next-generate",default:"",wire:"request"}),colorScaleHigh:oo({timing:"live-and-next-generate",default:"",wire:"request"}),palette:oo({timing:"live-and-next-generate",default:"",wire:"request"}),maxMapPoints:oo({timing:"live-and-next-generate",default:T7,min:zut,max:jut,wire:"clientHints"}),pageSize:oo({timing:"live",default:0,min:0}),valueAxisBaseline:oo({timing:"live",default:k7,values:["fit","zero","auto"]}),seasonalMarkers:oo({timing:"live",default:M7,values:["auto","always","never"]}),animAutoPlay:oo({timing:"live",default:!1}),animPlaySpeedMs:oo({timing:"live",default:b7,min:S7,max:A7}),animLoopDelaySec:oo({timing:"live",default:w7,min:P7}),animStopAtEnd:oo({timing:"live",default:!1}),animMaxIdealFrames:oo({timing:"live",default:v7,min:N7,max:x7}),animTimelineStyle:oo({timing:"live",default:"",values:["","line","boxes"]}),filtersDuringPlay:oo({timing:"live",default:!1}),flipMode:oo({timing:"live",default:E7,values:["both","all","single"]}),flipIntervalMs:oo({timing:"live",default:"",min:0,max:hz}),flipDirection:oo({timing:"live",default:C7,values:["horizontal","vertical"]}),cardBackgroundColor:oo({timing:"live",default:""}),hoverDropLines:oo({timing:"live",default:"",values:["","on","off"]}),geoBorders:oo({timing:"live",default:!0}),deriveProvinces:oo({timing:"next-generate",default:!0}),levelOfDetail:oo({timing:"next-generate",default:"",values:["","High","Medium","Low"],wire:"clientHints"}),favorLimitTo:oo({timing:"next-generate",default:"",values:["","latest","top / greatest","bottom / smallest","most common","outliers"],wire:"clientHints"}),favorLimitCount:oo({timing:"next-generate",default:0,min:0,max:Xut,wire:"clientHints"}),favorTitle:oo({timing:"next-generate",default:"",values:["","1","0"],wire:"clientHints"}),favorDPValues:oo({timing:"next-generate",default:"",values:["","1","0"],wire:"clientHints"}),legendPlacement:oo({timing:"next-generate",default:"",values:["","outside","inside","none"],wire:"clientHints"}),industryContext:oo({timing:"next-generate",default:"",wire:"clientHints"}),suggestFontFamily:oo({timing:"next-generate",default:"",wire:"clientHints"}),visionReview:oo({timing:"after-render",default:!1}),saveThumbnails:oo({timing:"after-render",default:!1})}),h0e=Object.freeze(Object.keys(jM).filter(r=>jM[r].timing==="live"||jM[r].timing==="live-and-next-generate"));var m0e=Object.freeze(["TILE_TOO_NARROW","TILE_TOO_SHORT","TILE_NOT_SQUARE","TILE_NOT_TALL","TILE_TOO_SMALL","EMBED_NOTHING_FITS_TILE","EMBED_BEESWARM_TILE_TOO_SMALL"]);function us(r,t,e,o){var n,i=arguments.length,a=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,t,e,o);else for(var s=r.length-1;s>=0;s--)(n=r[s])&&(a=(i<3?n(a):i>3?n(t,e,a):n(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a}function Yl(r,t,e){if(e||arguments.length===2)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return r.concat(o||Array.prototype.slice.call(t))}var LX=function(r,t,e){return[r,t,e].map((function(o){return(o/=255)>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92}))},IX=function(r,t,e){return[r,t,e].map((function(o){return 255*(o<=.00304?12.92*o:1.055*Math.pow(o,1/2.4)-.055)}))},hn=function(r,t,e){return Math.min(Math.max(r,t),e)},RX=function(r,t){return Math.round((r+Number.EPSILON)*Math.pow(10,t))/Math.pow(10,t)},o8=function(r,t){return Math.floor(Math.random()*(t-r+1)-r)},_X=function(r,t,e,o){for(var n,i=[r,t,e],a="#",s=0;s<i.length;s++)a+=(n=i[s],Math.round(hn(n,0,255)).toString(16).padStart(2,"0"));return o!=null&&(a+=Math.round(hn(o,0,100)/100*255).toString(16).padStart(2,"0")),a},UX=function(r){var t=r.length,e=(r=(function(i){var a=(i=/^#/.test(i)?i.slice(1):i).length;if(![3,4,6,8].includes(a))return"000000";if(a===6||a===8)return i;if(a===3||a===4){for(var s="",l=0;l<a;l++){var u=i[l];s+=""+u+u}return s}return"000000"})(r).padEnd(8,"ff")).match(/.{2}/g);if(!e)return[0,0,0,1];var o=[0,0,0],n=!1;return e.forEach((function(i,a){a<3?o[a]=parseInt(i,16):n=100*parseInt(i,16)/255})),n===!1||t<8?o:Yl(Yl([],o,!0),[n],!1)},BX=function(r,t,e){var o;o=[r,t,e].map((function(a){return a/255})),r=o[0],t=o[1],e=o[2];var n=1-Math.max(r,t,e),i=n<1?1/(1-n):0;return[(1-r-n)*i*100,(1-t-n)*i*100,(1-e-n)*i*100,100*n]},DX=function(r,t,e,o){return o===100?[0,0,0]:(o/=100,[r,t,e].map((function(n){return(n/=100)>=1?0:255*(1-n)*(1-o)})))};function JM(r,t,e,o){var n;o===void 0&&(o="l"),n=[r,t,e].map((function(p){return p/255})),r=n[0],t=n[1],e=n[2];var i=Math.max(r,t,e),a=Math.min(r,t,e),s=(function(p,f,d,g){var b;g===void 0&&(g=!1),b=[p,f,d].map((function(E){return E/255})),p=b[0],f=b[1],d=b[2];var S=Math.max(p,f,d),P=Math.min(p,f,d),w=0;if(S!==P)if(g)w=(p-f+(p-d))/2,w/=Math.sqrt((p-f)*(p-f)+(p-d)*(f-d)),w=Math.acos(w),d>f&&(w=2*Math.PI-w),w/=2*Math.PI;else{var k=S-P;w=S===p?(f-d)/k+(f<d?6:0):S===f?(d-p)/k+2:(p-f)/k+4,w/=6}else w=NaN;return 360*w})(r,t,e,o==="i"),l=0,u=(i+a)/2,c=i-a,h=i,m=(r+t+e)/3;return o==="v"&&(l=i===0?0:c/i),i!==a&&o==="l"&&(l=u>.5?c/(2-i-a):c/(i+a)),o==="i"&&(l=m>0?1-a/m:0),l*=100,u*=100,m*=100,o==="l"?[s,l,u]:o==="v"?[s,l,h*=100]:[s,l,m]}var QM=function(r,t,e){return JM(r,t,e,"l")},cd=function(r,t,e){var o,n,i=function(a){return 6*(a=a<0?a+1:a>1?a-1:a)<1?o+(n-o)*a*6:2*a<1?n:3*a<2?o+(n-o)*(.6666666666666666-a)*6:o};return r=r%360/360,t=hn(t/100,0,1),e=hn(e/100,0,1),o=2*e-(n=e<=.5?e*(t+1):e+t-e*t),[255*i(r+1/3),255*i(r),255*i(r-1/3)]},OX=function(r,t,e){return JM(r,t,e,"v")},ZM=function(r,t,e){var o,n,i=[e/=100,e*(1-(t/=100)),e*(1-(n=(r=r%360/360*360)/60-(o=Math.floor(r/60%6)))*t),e*(1-(1-n)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return[255*i[a[o][0]],255*i[a[o][1]],255*i[a[o][2]]]},FX=function(r,t,e){return JM(r,t,e,"i")},tT=function(r,t,e){var o,n,i,a;t/=100,e/=100,isNaN(r)&&(r=0),isNaN(t)&&(t=0);var s=function(l){return(1+t*Math.cos(2*Math.PI*l)/Math.cos(Math.PI/3-2*Math.PI*l))/3};return(r=(360+r)%360/360)<1/3?i=1-((a=(1-t)/3)+(n=s(r))):r<2/3?a=1-((n=(1-t)/3)+(i=s(r-=1/3))):n=1-((i=(1-t)/3)+(a=s(r-=2/3))),o=[n,i,a].map((function(l){return 255*hn(e*l*3,0,1)})),[n=o[0],i=o[1],a=o[2]]},GX=function(r,t,e){return[QM(r,t,e)[0],100*(Math.min(r,t,e)/255),100*(1-Math.max(r,t,e)/255)]};function eT(r,t,e){return t/=100,e/=100,cd(r,100,50).map((function(o){return 255*(o/255*(1-t-e)+t)}))}var XM={x:[.4124564,.3575761,.1804375],y:[.2126729,.7151522,.072175],z:[.0193339,.119192,.9503041]},KM={r:[3.2404542,-1.5371385,-.4985314],g:[-.969266,1.8760108,.041556],b:[.0556434,-.2040259,1.0572252]},VX=.95047,HX=1,zX=1.08883,Kut=.206896552,Yut=.008856452,jX=24389/27,YM=function(r,t,e){var o=LX(r,t,e);return[100*XM.x.reduce((function(n,i,a){return n+i*o[a]}),0),100*XM.y.reduce((function(n,i,a){return n+i*o[a]}),0),100*XM.z.reduce((function(n,i,a){return n+i*o[a]}),0)]},xP=function(r,t,e){var o=[r,t,e],n=KM.r.reduce((function(s,l,u){return s+l*o[u]}),0)/100,i=KM.g.reduce((function(s,l,u){return s+l*o[u]}),0)/100,a=KM.b.reduce((function(s,l,u){return s+l*o[u]}),0)/100;return IX(n,i,a)},n8=function(r,t,e){var o;return o=[r=r/VX/100,t=t/HX/100,e=e/zX/100].map((function(n){return n>Yut?Math.pow(n,1/3):(jX*n+16)/116})),r=o[0],t=o[1],e=o[2],[Math.max(0,116*t-16),500*(r-t),200*(t-e)]},rT=function(r,t,e){var o,n=(r+16)/116,i=isNaN(t)?n:n+t/500,a=isNaN(e)?n:n-e/200;return o=[i,n,a].map((function(s){return s>Kut?Math.pow(s,3):(116*s-16)/jX})),i=o[0],n=o[1],a=o[2],[i*VX*100,n*HX*100,a*zX*100]},oT=function(r,t,e){return xP.apply(void 0,rT(r,t,e))},qM=function(r,t,e){t=hn(t,-100,100),e=hn(e,-100,100);var o=Math.sqrt(t*t+e*e),n=(180*Math.atan2(e,t)/Math.PI+360)%360;return Math.round(1e4*o)===0&&(n=Number.NaN),[r,o,n]},XX=function(r,t,e){return isNaN(e)&&(e=0),e*=Math.PI/180,[r,Math.cos(e)*t,Math.sin(e)*t]},nT=function(r,t,e){return rT.apply(void 0,XX(r,t,e))},KX=function(r,t,e){var o=r+t+e,n=0,i=0;return o>0&&(n=r/o,i=t/o),[n,i,t]},qut=Object.freeze({__proto__:null,linear2rgb:IX,rgb2linear:LX,rgb2hex:_X,hex2rgb:UX,rgb2cmyk:BX,cmyk2rgb:DX,rgb2hsl:QM,hsl2rgb:cd,rgb2hsv:OX,hsv2rgb:ZM,rgb2hsi:FX,hsi2rgb:tT,rgb2hwb:GX,hwb2rgb:eT,rgb2xyz:YM,xyz2rgb:xP,xyz2lab:n8,lab2xyz:rT,rgb2lab:function(r,t,e){return n8.apply(void 0,YM(r,t,e))},lab2rgb:oT,lch2lab:XX,lab2lch:qM,xyz2lch:function(r,t,e){return qM.apply(void 0,n8(r,t,e))},lch2xyz:nT,xyY2xyz:function(r,t,e){return t===0?[0,0,0]:[r*(e/t),e,e/t*(1-r-t)]},xyz2xyY:KX});function Kl(r,t){return t===void 0&&(t=!1),function(e,o,n){var i=n.value;n.value=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];if(a.length>0&&t){var l=JSON.stringify(a);r+=l}if(this.cache.has(r))return this.cache.get(r);var u=i.call.apply(i,Yl([this],a,!1));return this.cache.set(r,u),u}}}function Zs(r,t,e,o){return r===void 0&&(r=[0,2,2]),t===void 0&&(t=0),e===void 0&&(e=!0),o===void 0&&(o=0),function(n,i,a){var s=a.value;a.value=function(){for(var l=[],u=0;u<arguments.length;u++)l[u]=arguments[u];var c=l[o]===void 0?e:l[o],h=s.call.apply(s,Yl([this],l,!1));if(c===!1)return h;var m=typeof c=="number"?Math.round(c):0,p=typeof r=="number"?new Array(h.length).fill(r):r,f=p.map((function(d){return t===1?typeof c=="number"?m:d:d+m}));return h.map((function(d,g){return RX(d,f[g])}))}}}var YX=function(r,t,e){var o=r instanceof wn?r:new wn(r),n=t instanceof wn?t:new wn(t),i=hn(e,0,100)/100,a=2*i-1,s=o.alpha()-n.alpha(),l=((a*s==-1?a:(a+s)/(1+a*s))+1)/2,u=1-l,c=[Math.round(hn(o.red()*l+n.red()*u,0,255)),Math.round(hn(o.green()*l+n.green()*u,0,255)),Math.round(hn(o.blue()*l+n.blue()*u,0,255))],h=o.alpha()*i+n.alpha()*(1-i);return new wn(c,h)},Ba=Math.sqrt,zr=Math.pow,DS=Math.cos,NP=Math.abs,WX=Math.sin,$ut=Math.exp,Jut=Math.atan2,qX=Math.PI,ud=function(r){return qX*r/180},$M=function(r,t,e){e===void 0&&(e=!0);var o=Jut(t,r);return e&&(o=(o=(o=180*o/qX)>0?o:o+360)>360?o-360:o),o},OS=function(r,t){t===void 0&&(t=!0);var e=r.lab(!1),o=e[0],n=e[1],i=e[2];return[o,Ba(zr(n,2)+zr(i,2)),$M(n,i,t),n,i]},Qut=["CMC","CIE","CIE2000","CIE1994","CIE1976"],Zut="CMC",tct="CIE2000",ect="CIE1994",rct="CIE1976",$X=function(r,t,e,o){e===void 0&&(e="CIE");var n=(function(c){var h=c.toUpperCase();return Qut.includes(h)&&h!=="CIE"?h:tct})(e);if(o=o||{},n===Zut){var i=Object.assign({},{l:1,c:1},o);return(function(c,h,m,p){m===void 0&&(m=1),p===void 0&&(p=1);var f=OS(c,!0),d=f[0],g=f[1],b=f[2],S=f[3],P=f[4],w=OS(h),k=w[0],E=w[1],U=w[3],F=g-E,W=d-k,L=P-w[4],v=Ba(zr(S-U,2)+zr(L,2)-zr(F,2)),I=d<16?.511:.040975*d/(1+.01765*d),B=.0638*g/(1+.0131*g)+.638,C=164<=b&&b<=345?.56+NP(.2*DS(ud(b+168))):.36+NP(.4*DS(ud(b+35))),O=Ba(zr(g,4)/(zr(g,4)+1900)),G=B*(O*C+1-O);return Ba(zr(W/(m*I),2)+zr(F/(p*B),2)+zr(v/G,2))})(r,t,i.l,i.c)}if(n===ect){var a={kL:1,kC:1,kH:1,cate:"graphic"},s=Object.assign({},a,o);return(function(c,h,m,p,f,d){m===void 0&&(m=1),p===void 0&&(p=1),f===void 0&&(f=1),d===void 0&&(d="graphic");var g=d==="textiles"?.048:.045,b=d==="textiles"?.014:.015;m=d==="textiles"?2:m;var S=OS(c),P=S[0],w=S[1],k=S[3],E=S[4],U=OS(h),F=U[0],W=U[1],L=U[3],v=P-F,I=w-W,B=E-U[4],C=1+g*w,O=1+b*w,G=Ba(zr(k-L,2)+zr(B,2)-zr(I,2));return Ba(zr(v/(1*m),2)+zr(I/(p*C),2)+zr(G/(f*O),2))})(r,t,s.kL,s.kC,s.kH,s.cate)}if(n===rct)return(function(c,h){var m=c.lab(!1),p=m[0],f=m[1],d=m[2],g=h.lab(!1),b=g[0],S=g[1],P=g[2];return Ba(zr(p-b,2)+zr(f-S,2)+zr(d-P,2))})(r,t);var l={kL:1,kC:1,kH:1},u=Object.assign({},l,o);return(function(c,h,m,p,f){m===void 0&&(m=1),p===void 0&&(p=1),f===void 0&&(f=1);var d=OS(c),g=d[0],b=d[1],S=d[3],P=d[4],w=OS(h),k=w[0],E=w[1],U=w[3],F=w[4],W=(g+k)/2,L=(b+E)/2,v=(1-Ba(zr(L,7)/(zr(L,7)+zr(25,7))))/2,I=S*(1+v),B=U*(1+v),C=Ba(zr(I,2)+zr(P,2)),O=Ba(zr(B,2)+zr(F,2)),G=$M(I,P,!0),X=$M(B,F,!0),Y=(C+O)/2,j=NP(G-X)>180?(G+X+360)/2:(G+X)/2,K=1-.17*DS(ud(j-30))+.24*DS(ud(2*j))+.32*DS(ud(3*j+6))-.2*DS(ud(4*j-63)),ht=NP(X-G)<=180?X-G:NP(X-G)>180&&X<=G?X-G+360:X-G-360,Z=k-g,bt=E-b,Nt=2*Ba(C*O)*WX(ud(ht)/2),it=1+.015*zr(W-50,2)/Ba(20+zr(W-50,2)),xt=1+.045*Y,at=1+.015*Y*K,wt=30*$ut(-zr((j-275)/25,2)),nt=-2*Ba(zr(Y,7)/(zr(Y,7)+zr(25,7)))*WX(2*ud(wt));return Ba(zr(Z/(m*it),2)+zr(bt/(p*xt),2)+zr(Nt/(f*at),2)+nt*(bt/(p*xt))*(Nt/(f*at)))})(r,t,u.kL,u.kC,u.kH)},oct=function(r,t,e){var o=Math.abs,n=Math.max,i=Math.min,a=r instanceof wn?r:new wn(r),s=t instanceof wn?t:new wn(t),l=Object.assign({},{b:125,c:500},e);return!(o(255*a.brightness()/100-255*s.brightness()/100)<=l.b)&&!(n(a.red(),s.red())-i(a.red(),s.red())+(n(a.green(),s.green())-i(a.green(),s.green()))+(n(a.blue(),s.blue())-i(a.blue(),s.blue()))<=l.c)},FS=function(r,t,e){var o,n=function(u){return hn(u,0,100)},i=function(u){return hn(u,0,255)},a={h:[0,function(u){return u%360}],s:[1,n],l:[2,n],r:[0,i],g:[1,i],b:[2,i]},s=a[t][0];if(["h","s","l"].includes(t)){var l=r.hsl();if(e===void 0)return l[s];e=a[t][1](e),l[s]=e,o=cd.apply(void 0,l)}else{if(o=r.rgb(),e===void 0)return o[s];e=a[t][1](e),o[s]=e}return new wn(o,r.alpha())},a8={},nct=new Set(["rgb","rgba","cmyk","lab","hsl","hsla","hsv","hsva","hsi","hsia","xyz","lch","hwb","hwba"]),ict=/^([a-zA-Z]+)\(([\s\S]+)\)$/,i8=function(r){return typeof r=="string"?r.indexOf("%")===-1?i8(Number(r.trim())):(r=r.split("%")[0],(r=Number(r.trim()))||0):Math.abs(r)<1?100*r:r},JX=function(r,t){t===void 0&&(t=new Set);var e=typeof r=="string"?r:r.join(",");if(t.has(e))throw new Error("Invalid Color");t.add(e);var o="rgb",n=[0,0,0],i=100;if(Array.isArray(r)){if(r.length<3)throw new Error("Invalid Color");for(var a=0;a<r.length;a++)if(a<3)n[a]=r[a];else{if(a!==3||r[3]===void 0)break;i=r[3]}}else{var s=!1,l=r.trim().match(ict);if(l||(s=!0),l){var u=l[1].toLocaleLowerCase();if(o=u,nct.has(u)||(s=!0),l[2]&&!s){var c=l[2],h=c.indexOf(",")!==-1?",":" ",m=c.split(h);for(a=0;a<3;a++)m[a]!==void 0&&(["lch","lab"].includes(o)&&a===0||["hsl","hsla","hsv","hsva","hwb","hwba","hsi","hsia"].includes(o)&&a>0?n[a]=i8(m[a]):n[a]=Number(m[a].trim()));["rgba","hsla","hsva","hwba","hsia"].includes(o)?(o=o.slice(0,-1),m[3]!==void 0&&(i=i8(m[3]))):o==="cmyk"&&n.push(m[3]!==void 0?i8(m[3]):0)}}if(s){if(!/^#(([a-fA-F\d]{3}){1,2}|[a-fA-F\d]{8})$/.test(r))try{return r=(function(p,f){if(f===void 0&&(f=!1),p=p.toLowerCase(),a8[p]===void 0){if(f)throw new Error("Unknown color name: ".concat(p,")"));return p}return a8[p]})(r,!0),JX(r,t)}catch{throw new Error("Invalid Color")}n=UX(r)}}return[o,n,i]},QX={thowParseError:!1},wn=(function(){function r(t,e,o){this.cache=new Map,this._rgb=[0,0,0],this._alpha=100;var n={thowParseError:QX.thowParseError},i=Object.assign({},n,o??{});try{var a=(function(u){var c,h={lab2rgb:oT,hsl2rgb:cd,hsv2rgb:ZM,xyz2rgb:xP,hwb2rgb:eT,hsi2rgb:tT},m=JX(u),p=m[0],f=m[1],d=m[2];if(p==="rgb")return[f,d];p==="lch"&&(p=(c=["xyz",nT(f[0],f[1],f[2])])[0],f=c[1]);var g=f[0],b=f[1],S=f[2],P=f[3];if(p==="cmyk")return[DX(g,b,S,P).map((function(k){return hn(k,0,255)})),d];var w="".concat(p,"2rgb");if(typeof h[w]=="function")return[h[w](g,b,S).map((function(k){return hn(k,0,255)})),d];throw new Error("Invalid color")})(t),s=a[0],l=a[1];this._alpha=l,this._rgb=s}catch(u){if(i.thowParseError)throw u}e!==void 0&&(this._alpha=hn(e,0,100))}return r.prototype.red=function(t){return FS(this,"r",t)},r.prototype.green=function(t){return FS(this,"g",t)},r.prototype.blue=function(t){return FS(this,"b",t)},r.prototype.alpha=function(t){return t===void 0?this._alpha:(t=hn(t,0,100),new r(this.rgb(),t))},r.prototype.fadeIn=function(t,e){return t===void 0&&(t=10),t=e&&e==="relative"?this._alpha*t/100:t,new r(this.rgb(),hn(this._alpha+t,0,100))},r.prototype.fadeOut=function(t,e){return t===void 0&&(t=10),t=e&&e==="relative"?this._alpha*t/100:t,new r(this.rgb(),hn(this._alpha-t,0,100))},r.prototype.opacify=function(t,e){return t===void 0&&(t=10),this.fadeIn(t,e)},r.prototype.transparentize=function(t,e){return t===void 0&&(t=10),this.fadeOut(t,e)},r.prototype.hue=function(t){return FS(this,"h",t)},r.prototype.saturation=function(t){return FS(this,"s",t)},r.prototype.lightness=function(t){return FS(this,"l",t)},r.prototype.rgb=function(t){return Yl([],this._rgb,!0)},r.prototype.rgba=function(t){return Yl(Yl([],this.rgb(!1),!0),[this._alpha],!1)},r.prototype.cmyk=function(t){return BX.apply(void 0,this._rgb)},r.prototype.hsl=function(t){return QM.apply(void 0,this._rgb)},r.prototype.hsla=function(t){return Yl(Yl([],this.hsl(!1),!0),[this._alpha],!1)},r.prototype.hsv=function(t){return OX.apply(void 0,this._rgb)},r.prototype.hsi=function(t){return FX.apply(void 0,this._rgb)},r.prototype.hwb=function(t){return GX.apply(void 0,this._rgb)},r.prototype.xyz=function(t){return YM.apply(void 0,this._rgb)},r.prototype.lab=function(t){return n8.apply(void 0,this.xyz(!1))},r.prototype.lch=function(t){return qM.apply(void 0,this.lab(!1))},r.prototype.xyY=function(t){return KX.apply(void 0,this.xyz(!1))},r.prototype.hex=function(t){t===void 0&&(t=2);var e=t===0?void 0:t===1?this._alpha:this._alpha===100?void 0:this._alpha,o="color:hex:param_".concat(t);if(this.cache.has(o))return this.cache.get(o);var n=_X.apply(void 0,Yl(Yl([],this._rgb,!1),[e],!1));return this.cache.set(o,n),n},r.prototype.lighten=function(t,e){t===void 0&&(t=5);var o=this.hsl(!1),n=o[0],i=o[1],a=o[2];return a=hn(a+=e!==void 0&&e==="relative"?a*(t/100):t,0,100),new r(cd(n,i,a),this._alpha)},r.prototype.darken=function(t,e){return t===void 0&&(t=5),this.lighten(-t,e)},r.prototype.saturate=function(t,e){t===void 0&&(t=5);var o=this.hsl(!1),n=o[0],i=o[1],a=o[2];return i=hn(i+=e!==void 0&&e==="relative"?i*(t/100):t,0,100),new r(cd(n,i,a),this._alpha)},r.prototype.desaturate=function(t,e){return t===void 0&&(t=5),this.saturate(-t,e)},r.prototype.spin=function(t){var e=this.hsl(!1),o=e[0],n=e[1],i=e[2];return new r(cd(o=(o+t%360+360)%360,n,i),this._alpha)},r.prototype.adjustHue=function(t){return this.spin(t)},r.prototype.complement=function(){return this.spin(180)},r.prototype.invert=function(){var t=this._rgb.map((function(e){return 255-e}));return new r([t[0],t[1],t[2]],this._alpha)},r.prototype.mix=function(t,e){return e===void 0&&(e=50),YX(this,t,100-hn(e,0,100))},r.prototype.luma=function(){var t=this._rgb.map((function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}));return .2126*t[0]+.7152*t[1]+.0722*t[2]},r.prototype.brightness=function(){var t=this._rgb;return(function(e,o,n){return(299*e+587*o+114*n)/1e3/255*100})(t[0],t[1],t[2])},r.prototype.deltaE=function(t,e,o){return e===void 0&&(e="CMC"),$X(this,t,e,o)},r.prototype.visibility=function(t,e){return oct(this,t,e)},us([Zs(0,1,!0,0),Kl("color:rgb")],r.prototype,"rgb",null),us([Zs(0,1,!0,0)],r.prototype,"rgba",null),us([Zs(0,1,!0,0),Kl("color:cmyk")],r.prototype,"cmyk",null),us([Zs(0,1,!0,0),Kl("color:hsl")],r.prototype,"hsl",null),us([Zs(0,1,!0,0)],r.prototype,"hsla",null),us([Zs(0,1,!0,0),Kl("color:hsv")],r.prototype,"hsv",null),us([Zs(0,1,!0,0),Kl("color:hsi")],r.prototype,"hsi",null),us([Zs(0,1,!0,0),Kl("color: hwb")],r.prototype,"hwb",null),us([Zs(2,1,!0,0),Kl("color:xyz")],r.prototype,"xyz",null),us([Zs(2,1,!0,0),Kl("color:lab")],r.prototype,"lab",null),us([Zs(2,1,!0,0),Kl("color:lch")],r.prototype,"lch",null),us([Zs(2,1,!0,0),Kl("color:xyY")],r.prototype,"xyY",null),us([Kl("color:luma")],r.prototype,"luma",null),r})(),act=function(r,t,e,o){return new wn([r,t,e],o)},sct=function(r,t,e,o){return new wn(cd(r,t,e),o)},lct=function(r,t,e,o){return new wn(ZM(r,t,e),o)},uct=function(r,t,e,o){return new wn(tT(r,t,e),o)},cct=function(r,t,e,o){return new wn(eT(r,t,e),o)},hct=function(r,t,e,o){return new wn(xP(r,t,e),o)},mct=function(r,t,e,o){return new wn(oT(r,t,e),o)},pct=function(r,t,e,o){return new wn(xP.apply(void 0,nT(r,t,e)),o)};function Ei(r,t,e){return new wn(r,t,e)}Ei.config=function(r){Object.assign(QX,r)},Ei.random=function(){var r=o8(0,255),t=o8(0,255),e=o8(0,255);return new wn([r,t,e])},Ei.convertor=qut,Ei.Color=wn,Ei.rgb=act,Ei.hsl=sct,Ei.hsv=lct,Ei.hsi=uct,Ei.hwb=cct,Ei.xyz=hct,Ei.lab=mct,Ei.lch=pct,Ei.mix=YX,Ei.deltaE=$X,Ei.utils={roundDecimal:RX,randomRange:o8},Ei.useNames=function(r,t){return(function(e,o){if(o!==void 0&&typeof o=="function"){var n={};for(var i in e){var a=o(i,e[i]),s=a[0],l=a[1];n[s]=l}Object.assign(a8,n)}else Object.assign(a8,e)})(r,t),Ei};var l8=[1,0,0,1,0,0],GS=(r,t)=>[r[0]*t[0]+r[2]*t[1],r[1]*t[0]+r[3]*t[1],r[0]*t[2]+r[2]*t[3],r[1]*t[2]+r[3]*t[3],r[0]*t[4]+r[2]*t[5]+r[4],r[1]*t[4]+r[3]*t[5]+r[5]],s8=(r,t,e)=>[r[0]*t+r[2]*e+r[4],r[1]*t+r[3]*e+r[5]];function sT(r){if(!r||!r.trim())return l8;let t=l8,e=/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g,o="";for(let n of r.matchAll(e)){o+=n[0];let i=n[2].split(/[\s,]+/).filter(Boolean).map(Number);if(i.some(s=>!isFinite(s)))return null;let a;switch(n[1]){case"matrix":if(i.length!==6)return null;a=i;break;case"translate":a=[1,0,0,1,i[0]??0,i[1]??0];break;case"scale":a=[i[0]??1,0,0,i[1]??i[0]??1,0,0];break;case"rotate":{let s=(i[0]??0)*Math.PI/180,l=Math.cos(s),u=Math.sin(s),c=[l,u,-u,l,0,0];a=i.length>=3?GS(GS([1,0,0,1,i[1],i[2]],c),[1,0,0,1,-i[1],-i[2]]):c;break}case"skewX":a=[1,0,Math.tan((i[0]??0)*Math.PI/180),1,0,0];break;default:a=[1,Math.tan((i[0]??0)*Math.PI/180),0,1,0,0];break}t=GS(t,a)}return r.replace(e,"").replace(/[\s,]/g,"")!==""?null:o?t:l8}var wc=r=>String(r??"").toLowerCase(),EP=(r,t)=>{let e=wc(r.getAttribute("style")).replace(/\s+/g,"");for(let o of e.split(";")){let n=o.indexOf(":");if(n>0&&o.slice(0,n)===t)return o.slice(n+1)}return null},Lf=(r,t)=>EP(r,t)??(r.getAttribute(t)!==null?wc(r.getAttribute(t)):null);function dct(r){for(let t of String(r.getAttribute?.("style")??"").split(";")){let e=t.indexOf(":");if(e<0||t.slice(0,e).trim().toLowerCase()!=="font")continue;let o=/(?:^|\s)((?:\d*\.)?\d+(?:px|pt|em|%))(?:\s|\/|$)/i.exec(t.slice(e+1));return o?o[1].toLowerCase():"unreadable"}return null}var ZX=10;function VS(r){for(let t=r;t;t=t.parentElement){let e=EP(t,"font-size")??dct(t)??(t.getAttribute?.("font-size")!=null&&t.getAttribute("font-size").trim()!==""?wc(t.getAttribute("font-size")).trim():null);if(e===null)continue;let o=/^((?:\d*\.)?\d+(?:e[+-]?\d+)?)(px|pt|em|%)?$/.exec(e);if(!o)return{px:ZX,sure:!1};let n=parseFloat(o[1]),i=o[2]??"px";if(i==="px")return{px:n,sure:!0};if(i==="pt")return{px:n*4/3,sure:!0};let a=VS(t.parentElement);return{px:(i==="em"?n:n/100)*a.px,sure:a.sure}}return{px:ZX,sure:!1}}function u8(r,t,e,o){let n=String(r.getAttribute(t)??"").trim().toLowerCase();if(!n)return{v:0,sure:!0};let i=n.split(/[\s,]+/).filter(Boolean),a=/^([-+]?(?:\d*\.)?\d+(?:e[+-]?\d+)?)(px|em|%)?$/.exec(i[0]);if(!a)return null;let s=parseFloat(a[1]),l=a[2]==="em"?s*e:a[2]==="%"?s/100*o:s;return isFinite(l)?{v:l,sure:i.length===1}:null}function yct(r){return Array.from(r).length*.5}function fct(r){for(let t=r.parentElement;t;t=t.parentElement)if(wc(t.localName)==="svg")return t;return null}var lT=new Set(["defs","clippath","mask","pattern","marker","symbol","lineargradient","radialgradient","filter","title","desc","metadata","style","script"]);function tK(r){let t=String(r??"").trim();return/^\+?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(?:px)?$/i.test(t)?parseFloat(t):NaN}function gct(r){if(Lf(r,"overflow")==="visible")return null;let t=tK(EP(r,"width")??r.getAttribute("width")),e=tK(EP(r,"height")??r.getAttribute("height")),o=r.getAttribute("viewBox");if(o){let n=o.split(/[\s,]+/).filter(Boolean).map(Number);return n.length!==4||!n.every(isFinite)||n[2]<=0||n[3]<=0||!wc(r.getAttribute("preserveAspectRatio")).includes("none")&&isFinite(t)&&isFinite(e)&&t>0&&e>0&&Math.abs(n[2]/n[3]-t/e)>.01*(t/e)?null:{x0:n[0],y0:n[1],x1:n[0]+n[2],y1:n[1]+n[3]}}return!(t>0)||!(e>0)?null:{x0:0,y0:0,x1:t,y1:e}}function bct(r,t){for(let e=r;e&&e!==t;e=e.parentElement){if(Lf(e,"display")==="none")return!0;let o=Lf(e,"visibility");if(o==="hidden"||o==="collapse")return!0;let n=Lf(e,"opacity");if(n!==null&&n!==""&&parseFloat(n)===0)return!0}return!1}function Sct(r,t){for(let e=r;e&&e!==t;e=e.parentElement)if(e.getAttribute("clip-path")||EP(e,"clip-path")||lT.has(wc(e.localName)))return!0;return!1}function Act(r,t){let e=l8;for(let o=r;o&&o!==t;o=o.parentElement){let n=sT(o.getAttribute("transform"));if(!n)return null;e=GS(n,e)}return e}var cs=(r,t)=>{let e=parseFloat(r.getAttribute(t)??"");return isFinite(e)?e:0};function aT(r){let t="";for(let e=r.firstChild;e;e=e.nextSibling)e.nodeType===3||e.nodeType===4?t+=e.nodeValue??"":e.nodeType===1&&!lT.has(wc(e.localName))&&(t+=aT(e));return t}function ql(r,t,e){for(let o=r;o&&o!==t.parentElement;o=o.parentElement){let n=Lf(o,e);if(n!==null&&n!=="")return n}return null}var iT=["x","y","dx","dy"],Wf=(r,t)=>(r.getAttribute(t)??"").trim()!=="";function wct(r,t,e){let o=VS(r),[n,i,a,s]=iT.map(c=>u8(r,c,o.px,c==="x"||c==="dx"?t:e));if(!n||!i||!a||!s)return null;let l={text:"",x:n.v+a.v,y:i.v+s.v,fontPx:o.px,el:r,extra:0,sure:o.sure&&n.sure&&i.sure&&a.sure&&s.sure},u=[l];for(let c=r.firstChild;c;c=c.nextSibling){if(c.nodeType===3||c.nodeType===4){l.text+=c.nodeValue??"";continue}if(c.nodeType!==1)continue;let h=c,m=wc(h.localName);if(lT.has(m))continue;if(m==="textpath"||h.querySelector("textPath, textpath"))return null;if(Lf(h,"display")==="none")continue;let p=VS(h),f=Array.from(h.querySelectorAll("*")).some(d=>iT.some(g=>Wf(d,g)));if(Wf(h,"x")){let[d,g,b,S]=iT.map(P=>u8(h,P,p.px,P==="x"||P==="dx"?t:e));if(!d||!g||!b||!S)return null;l={text:aT(h),x:d.v+b.v,y:(Wf(h,"y")?g.v:l.y)+S.v,fontPx:p.px,el:h,extra:0,sure:p.sure&&d.sure&&g.sure&&b.sure&&S.sure&&!f},u.push(l)}else{l.text+=aT(h);let d=u8(h,"dx",p.px,t);if(!d)return null;l.extra+=d.v,(!d.sure||Wf(h,"y")||Wf(h,"dy")||f||p.px!==l.fontPx||!p.sure||Lf(h,"text-anchor")!==null)&&(l.sure=!1),l.fontPx=Math.max(l.fontPx,p.px)}}for(let c of u)c.text=c.text.replace(/\s+/g," ").trim();return u.filter(c=>c.text)}function uT(r){let t=[],e=r.match(/[a-zA-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/g)??[],o=0,n="",i=0,a=0,s=0,l=0,u=()=>parseFloat(e[o++]),c=()=>o<e.length&&!/^[a-zA-Z]$/.test(e[o]);for(;o<e.length;){if(/^[a-zA-Z]$/.test(e[o]))n=e[o++];else if(!n)return[];let h=n===n.toLowerCase(),m=n.toUpperCase();if(m==="Z"){if(i=s,a=l,c())return t;continue}let p={M:2,L:2,T:2,H:1,V:1,C:6,S:4,Q:4,A:7}[m];if(!p)return t;if(!c())continue;let f=[];for(let b=0;b<p;b++)f.push(u());if(f.some(b=>!isFinite(b)))return t;let d=h?i:0,g=h?a:0;if(m==="H")i=d+f[0],t.push([i,a]);else if(m==="V")a=g+f[0],t.push([i,a]);else if(m==="A")i=d+f[5],a=g+f[6],t.push([i,a]);else{for(let b=0;b<p;b+=2)t.push([d+f[b],g+f[b+1]]);i=d+f[p-2],a=g+f[p-1]}m==="M"&&(s=i,l=a,n=h?"l":"L")}return t}function eK(r){let t=1/0,e=-1/0,o=1/0,n=-1/0;for(let[i,a]of r)t=Math.min(t,i),e=Math.max(e,i),o=Math.min(o,a),n=Math.max(n,a);return{X0:t,X1:e,Y0:o,Y1:n}}var rK=/condensed|narrow|compressed|impact|agency/,Pct=/(?:^|[{;\s])(font-size|font|font-family|font-stretch|text-anchor|letter-spacing|word-spacing|direction|writing-mode|transform|text-transform)\s*:\s*([^;}]*)/gi;function vct(r){for(let t of r.replace(/\/\*[\s\S]*?\*\//g,"").matchAll(Pct)){let e=t[1].toLowerCase(),o=t[2].trim().toLowerCase().replace(/\s*!important$/,"");if(!(e!=="font-size"&&e!=="font"&&/^(normal|inherit|initial|unset|none|0|0px|ltr|horizontal-tb)$/.test(o))&&!(e==="font-family"&&!rK.test(o))&&!(e==="text-transform"&&o==="uppercase"))return!0}return!1}var Nct=new Set(["rect","image","foreignobject","circle","ellipse","line","text","path","polygon","polyline"]),tl=.5,xct=5;function oK(r){let t={frames:0,unmeasured:0,outside:0,crossing:0,textLikely:0,textEvenNarrow:0,samples:{outside:[],crossing:[],textLikely:[],textEvenNarrow:[]}},e=(a,s)=>{a.length<xct&&a.push(s)},o=Math.round,n=r.ownerDocument??r,i=Array.from(n.querySelectorAll("style")).concat(Array.from(r.querySelectorAll("style"))).some(a=>vct(a.textContent??""));for(let a of Array.from(r.querySelectorAll("svg"))){let s=gct(a),l=Array.from(a.querySelectorAll("*")).filter(m=>Nct.has(wc(m.localName))&&fct(m)===a);if(!s){l.length&&t.unmeasured++;continue}t.frames++;let u=(m,p)=>p==="left"||p==="right"?`x ${o(m.X0)}..${o(m.X1)}, frame ${o(s.x0)}..${o(s.x1)}`:`y ${o(m.Y0)}..${o(m.Y1)}, frame ${o(s.y0)}..${o(s.y1)}`,c=m=>m.X0>s.x1+tl?"right":m.X1<s.x0-tl?"left":m.Y0>s.y1+tl?"bottom":m.Y1<s.y0-tl?"top":"",h=m=>m.X1>s.x1+tl?"right":m.X0<s.x0-tl?"left":m.Y1>s.y1+tl?"bottom":m.Y0<s.y0-tl?"top":"";for(let m of l){if(bct(m,a)||Sct(m,a))continue;let p=Act(m,a);if(!p)continue;let f=wc(m.localName);if(f==="text"){if(Math.abs(p[1])>1e-9||Math.abs(p[2])>1e-9)continue;let P=ql(m,a,"writing-mode")??"";if(P.startsWith("tb")||P.startsWith("vertical")||P.startsWith("sideways"))continue;let w=ql(m,a,"fill"),k=ql(m,a,"stroke");if(w==="none"&&(k===null||k==="none"))continue;let E=wct(m,s.x1-s.x0,s.y1-s.y0);if(!E)continue;let U=u8(m,"textLength",VS(m).px,s.x1-s.x0),F=E.length===1&&Wf(m,"textLength")&&U?.sure&&U.v>0?U.v:null,W=null,L=null,v=null;for(let I of E){let B=I.fontPx,C=I.text;if(!(B>0))continue;let O=I.y,G=ql(I.el,a,"dominant-baseline")??ql(I.el,a,"alignment-baseline")??"";G==="middle"||G==="central"?O+=.35*B:(G==="hanging"||G==="text-before-edge")&&(O+=.8*B);let X=ql(I.el,a,"text-anchor")??"start",Y=ql(I.el,a,"direction")==="rtl",j=ql(I.el,a,"letter-spacing"),K=j===null||j==="normal"?0:/^(?:\d*\.)?\d+(?:px)?$/.test(j)?parseFloat(j):NaN,ht=Array.from(C).length,Z=isFinite(K)?K*ht:0,bt=`${ql(I.el,a,"font-family")??""} ${ql(I.el,a,"font-stretch")??""}`,Nt=I.sure&&!i&&!Y&&isFinite(K)&&ql(I.el,a,"word-spacing")===null&&!rK.test(bt)&&(F!==null||!Wf(m,"textLength")),it=(Ot,Zt,Kt)=>{let rt=X==="middle"?I.x-Ot/2:X==="end"?I.x-Ot:I.x;return eK([s8(p,rt,O-Zt*B),s8(p,rt+Ot,O+Kt*B)])},xt=it(F??ht*B*.6+I.extra+Z,.75,.2),at=`text "${C.length>30?C.slice(0,30)+"...":C}"`,wt=s8(p,I.x,O)[0],nt=xt.Y0>s.y1+tl?"bottom":xt.Y1<s.y0-tl?"top":Y?"":X==="start"&&wt>s.x1+tl?"right":X==="end"&&wt<s.x0-tl?"left":"";if(nt){W??={what:at,edge:nt,where:u(xt,nt)};continue}let st=h(xt);if(!st||(L??={what:at,edge:st,where:u(xt,st)},!Nt||v))continue;let vt=it(F??yct(C)*B+I.extra+Z,.5,0),ut=h(vt);if(!ut)continue;let ne=ut==="right"?vt.X1-s.x1:ut==="left"?s.x0-vt.X0:ut==="bottom"?vt.Y1-s.y1:s.y0-vt.Y0;v={what:at,edge:ut,where:u(vt,ut),pastPx:Math.round(ne)}}if(W){t.outside++,e(t.samples.outside,W);continue}L&&(t.textLikely++,e(t.samples.textLikely,L)),v&&(t.textEvenNarrow++,e(t.samples.textEvenNarrow,v));continue}let d;if(f==="circle"||f==="ellipse"){let P=f==="circle"?cs(m,"r"):cs(m,"rx"),w=f==="circle"?P:cs(m,"ry");if(!(P>0&&w>0))continue;let k=cs(m,"cx"),E=cs(m,"cy");d=[[k-P,E-w],[k+P,E+w],[k+P,E-w],[k-P,E+w]]}else if(f==="line")d=[[cs(m,"x1"),cs(m,"y1")],[cs(m,"x2"),cs(m,"y2")]];else if(f==="path"||f==="polygon"||f==="polyline"){if(f==="path")d=uT(m.getAttribute("d")??"");else{let P=(m.getAttribute("points")??"").split(/[\s,]+/).filter(Boolean).map(Number);d=[];for(let w=0;w+1<P.length;w+=2)d.push([P[w],P[w+1]])}if(!d.length||d.some(P=>!isFinite(P[0])||!isFinite(P[1])))continue}else{let P=cs(m,"width"),w=cs(m,"height");if(!(P>0&&w>0))continue;let k=cs(m,"x"),E=cs(m,"y");d=[[k,E],[k+P,E+w],[k+P,E],[k,E+w]]}let g=eK(d.map(P=>s8(p,P[0],P[1]))),b=c(g);if(b){t.outside++,e(t.samples.outside,{what:f,edge:b,where:u(g,b)});continue}if(f==="path")continue;let S=h(g);S&&(t.crossing++,e(t.samples.crossing,{what:f,edge:S,where:u(g,S)}))}}return t}var aK=/^(auto|scroll|overlay)$/,Tct=/[▲▼▴▾↑↓⇅↕]/g;function Pc(r,t){let e="";try{e=String(r.ownerDocument?.defaultView?.getComputedStyle?.(r)?.getPropertyValue(t)??"")}catch{}return e||(e=String(r.style?.getPropertyValue?.(t)??"")),e.trim().toLowerCase()}function c8(r,t){let e=Pc(r,`overflow-${t}`);if(e)return e;let o=Pc(r,"overflow").split(/\s+/).filter(Boolean);return(t==="x"?o[0]:o[1]??o[0])??"visible"}function sK(r){let t=e=>{for(let o=e?.firstChild;o;o=o.nextSibling){if(o.nodeType===3&&String(o.nodeValue).trim())return String(o.nodeValue);if(o.nodeType===1&&!cK.has(String(o.localName||"").toLowerCase())){let n=t(o);if(n)return n}}return""};return t(r).replace(Tct,"").replace(/\s+/g," ").trim()}var h8=r=>{let t=parseFloat(r);return/px$|^\d+(\.\d+)?$/.test(r.trim())&&Number.isFinite(t)?t:NaN};function Wct(r){let t=r.querySelector?.("svg");if(t){let o=Array.from(t.querySelectorAll("rect")).filter(i=>!(parseFloat(i.getAttribute("fill-opacity")??i.getAttribute("opacity")??"1")<1&&i.getAttribute("rx")));if(o.length)return{kind:"bar",barX:parseFloat(o[0].getAttribute("x")??"0")||0};if(t.querySelector("circle"))return{kind:"dot"};let n=t.querySelector("path, polyline, line");if(n&&n.localName!=="line")return{kind:"line"};if(t.hasAttribute("data-icon")||t.getAttribute("role")==="img")return{kind:"icon"}}for(let o of Array.from(r.querySelectorAll?.("div, span")??[])){let n=String(o.style?.background||o.style?.backgroundColor||"");if(!n||/transparent|none/.test(n))continue;let i=String(o.style?.width||""),a=String(o.textContent??"").trim();if(/%|px/.test(i)&&!a)return{kind:"bar",barX:h8(String(o.style?.marginLeft||o.style?.left||"0"))||0};if(a&&parseFloat(String(o.style?.borderRadius||"0"))>0)return{kind:"chip"}}let e=String(r.textContent??"").trim();return e&&!/^[-–—]$/.test(e)?{kind:"text"}:{kind:""}}function Lct(r){let t=Array.from(r.querySelectorAll(".d3-mark[data-row-idx], tr[data-row-idx]")).filter(S=>!S.closest(".d3-legend-mark")&&String(S.namespaceURI||"").includes("xhtml")).map(S=>({r:S,cells:(()=>{let P=Array.from(S.children),w=P.filter(k=>/^(gridcell|cell)$/.test(String(k.getAttribute?.("role")??""))||/^(td|th)$/i.test(String(k.localName)));return w.length>=2?w:P})()})).filter(S=>S.cells.length>=2);if(t.length<2)return null;let e=new Map;for(let S of t)e.set(S.cells.length,(e.get(S.cells.length)??0)+1);let o=[...e.entries()].sort((S,P)=>P[1]-S[1])[0][0],n=t.filter(S=>S.cells.length===o),i=n[0],a=i.r.parentElement,s=null;for(let S=a;S&&S!==r.parentElement;S=S.parentElement)if(c8(S,"y")!=="visible"||c8(S,"x")!=="visible"){s=S;break}let l=s?c8(s,"y"):"visible",u=s?c8(s,"x"):"visible",c=Array.from(r.querySelectorAll("[role=columnheader], th")).filter(S=>!S.closest("[data-row-idx]"));if(c.length!==o){c=[];let S=i.cells.map(P=>String(P.style?.width??""));for(let P of Array.from(r.querySelectorAll("div, tr"))){if(P.closest("[data-row-idx]"))continue;let w=Array.from(P.children);if(!(w.length!==o||!w.every((k,E)=>String(k.style?.width??"")===S[E]&&S[E]))&&!n.some(k=>k.r===P)){c=w;break}}}let h=c.length===o&&!!s&&aK.test(l)&&!c.some(S=>s.contains(S)),m=Array.from({length:o},(S,P)=>{let w=new Map,k=new Set,E=0,U=null;for(let I of n){let B=I.cells[P],C=Wct(B);C.kind&&w.set(C.kind,(w.get(C.kind)??0)+1),C.kind==="bar"&&C.barX!==void 0&&k.add(Math.round(C.barX)),Pc(B,"position")==="sticky"&&(E++,U=Pc(B,"left")&&Pc(B,"left")!=="auto"?"left":Pc(B,"right")&&Pc(B,"right")!=="auto"?"right":U)}let F=[...w.entries()].sort((I,B)=>B[1]-I[1]),W=F[0]?.[0]??"empty";W==="bar"&&k.size>1&&(W="diverging bar");let L=F.reduce((I,[,B])=>I+B,0);return F[1]&&F[1][1]/L>=.2&&(W=`${W} and ${F[1][0]}`),{name:c[P]?sK(c[P])||`column ${P+1}`:`column ${P+1}`,marks:W,stickTo:E>=Math.ceil(n.length/2)?U??"left":null}}),p=[];if(s&&aK.test(l)){let S=new Set;for(let P of Array.from(r.querySelectorAll("*"))){if(s.contains(P)||P.contains(s)||c.some(k=>k.contains(P)||P===k)||!(s.compareDocumentPosition(P)&2))continue;let w=Array.from(P.childNodes).filter(k=>k.nodeType===3&&String(k.nodeValue).trim()).map(k=>String(k.nodeValue).trim()).join(" ");!w||[...S].some(k=>k.contains(P))||(S.add(P),p.push(w.length>60?w.slice(0,57)+"...":w))}}let f=s?Array.from(s.querySelectorAll("*")).filter(S=>Pc(S,"position")==="sticky"&&Pc(S,"top")&&Pc(S,"top")!=="auto").map(S=>sK(S)).filter(Boolean).slice(0,4):[],d=h8(String(i.r.style?.width??""))||i.cells.reduce((S,P)=>S+(h8(String(P.style?.width??""))||NaN),0),g=NaN;for(let S=s;S&&Number.isNaN(g);S=S.parentElement)g=h8(String(S.style?.width??""));let b=Number.isFinite(d)&&Number.isFinite(g)?d>g+.5:null;return{rows:n.length,columns:m,overflowY:l,overflowX:u,heldAbove:p,headersHeld:h,stuckTop:f,widerThanBox:b}}var Ict=/^(none|transparent|currentcolor|inherit|initial|unset)$|^url\(/i;function Rct(r){for(let t of[r,...Array.from(r.querySelectorAll?.("*")??[])]){let e=String(t.getAttribute?.("fill")??t.style?.fill??"").trim();if(e&&!Ict.test(e))return e}return null}function _ct(r,t){let e=p=>{let f=t.lab(p);return f&&Number.isFinite(f.l)?f:null},o=(p,f)=>Math.hypot(p.l-f.l,p.a-f.a,p.b-f.b),n=p=>Math.hypot(p.a,p.b),i=null;for(let p of Array.from(r.querySelectorAll("linearGradient"))){let f=Array.from(p.querySelectorAll("stop")).map(P=>e(String(P.getAttribute("stop-color")??P.style?.stopColor??"").trim())).filter(Boolean);if(f.length<3)continue;let d=f.slice(1,-1),g=d.reduce((P,w)=>n(w)<n(P)?w:P,d[0]),b=f[0],S=f[f.length-1];if(n(g)+10<n(b)&&n(g)+10<n(S)&&o(b,S)>30){i={low:b,mid:g,high:S};break}}if(!i)return null;let{low:a,mid:s,high:l}=i,u=[];for(let p of Array.from(r.querySelectorAll(".d3-mark"))){if(p.closest(".d3-legend-mark"))continue;let f=Rct(p),d=f?e(f):null;if(!d)continue;let g=o(d,s),[b,S]=o(d,a)<=o(d,l)?[a,o(d,a)]:[l,o(d,l)],P=o(b,s);if(!(P>0)||g+S>P*1.35)continue;let w=String(p.getAttribute("data-row-idx")??p.querySelector?.("[data-row-idx]")?.getAttribute("data-row-idx")??"");u.push({t:Math.min(1,g/P),rowIdxs:w.split(",").filter(Boolean).map(Number),fill:f})}let c=u.length;if(c<8)return null;let h=u.filter(p=>p.t>=.6),m=u.filter(p=>p.t<=.25).length;return!h.length||h.length>Math.max(1,Math.floor(c*.05))||m<.75*c?null:{marks:c,nearCenter:m,atEnds:h.map(p=>({rowIdxs:p.rowIdxs,fill:p.fill}))}}var Uct=new Set(["d3-sankey","d3-hexbin","d3-voronoi-treemap"]);function Bct(r){}var cK=new Set(["title","desc","metadata","style","script"]);function hK(r){let t="";for(let e=r?.firstChild;e;e=e.nextSibling)e.nodeType===3||e.nodeType===4?t+=e.nodeValue||"":e.nodeType===1&&!cK.has(String(e.localName||"").toLowerCase())&&(t+=hK(e));return t}function cT(r){return VS(r).px}function Dct(r,t){let e=o=>{let n=String(r.getAttribute?.(o)??"").trim().split(/[\s,]+/)[0]??"",i=parseFloat(n);return isFinite(i)?/em$/i.test(n)?i*t:i:0};return{x:e("x")+e("dx"),y:e("y")+e("dy")}}function Oct(r){for(let t=r;t&&t.getAttribute;t=t.parentElement){let o=(/(?:^|;)\s*text-anchor\s*:\s*([a-z]+)/i.exec(String(t.getAttribute("style")||""))?.[1]??t.getAttribute("text-anchor")??"").trim().toLowerCase();if(o)return o}return"start"}function Fct(r){let t=new Set(["SVGElement","SVGGraphicsElement","SVGGeometryElement","SVGTextContentElement"].map(h=>r[h]?.prototype).filter(Boolean)),e=r.Element?.prototype;for(let h of["svg","g","text","tspan","textPath","path","rect","circle","ellipse","line","polyline","polygon","image","use"])try{for(let m=Object.getPrototypeOf(r.document.createElementNS("http://www.w3.org/2000/svg",h));m&&m!==e;m=Object.getPrototypeOf(m))t.add(m)}catch{}let o=h=>["text","tspan","textpath"].includes(String(h.tagName||"").toLowerCase()),n=h=>o(h)?hK(h).trim().length*cT(h)*.6:0,i=h=>{let m=String(h.tagName||"").toLowerCase();if(m==="path")return uT(h.getAttribute("d")||"");if(m==="line")return[[+h.getAttribute("x1")||0,+h.getAttribute("y1")||0],[+h.getAttribute("x2")||0,+h.getAttribute("y2")||0]];let p=String(h.getAttribute("points")||"").split(/[\s,]+/).filter(Boolean).map(Number),f=[];for(let d=0;d+1<p.length;d+=2)f.push([p[d],p[d+1]]);return f},a=h=>{let m=0;for(let p=1;p<h.length;p++)m+=Math.hypot(h[p][0]-h[p-1][0],h[p][1]-h[p-1][1]);return m},s=function(){if(o(this)){let f=cT(this),d=Math.max(1,n(this)),g=Dct(this,f),b=Oct(this);return{x:b==="middle"?g.x-d/2:b==="end"?g.x-d:g.x,y:g.y-f*.8,width:d,height:Math.max(1,f)}}let h=parseFloat(this.getAttribute?.("width")||"")||0,m=parseFloat(this.getAttribute?.("height")||"")||0;if(h>0||m>0)return{x:0,y:0,width:h||1,height:m||1};let p=parseFloat(this.getAttribute?.("r")||"")||0;return p>0?{x:-p,y:-p,width:2*p,height:2*p}:{x:0,y:0,width:1,height:1}},l=function(){let h=s.call(this);if(String(this.tagName||"").toLowerCase()!=="svg"){let m=[1,0,0,1,0,0];for(let p=this;p&&m&&String(p.tagName||"").toLowerCase()!=="svg";p=p.parentElement){let f=sT(p.getAttribute?.("transform"));m=f?GS(f,m):null}if(m){let p=[[h.x,h.y],[h.x+h.width,h.y],[h.x,h.y+h.height],[h.x+h.width,h.y+h.height]].map(([S,P])=>[m[0]*S+m[2]*P+m[4],m[1]*S+m[3]*P+m[5]]),f=p.map(S=>S[0]),d=p.map(S=>S[1]),g=Math.min(...f),b=Math.min(...d);h={x:g,y:b,width:Math.max(...f)-g,height:Math.max(...d)-b}}}return{...h,top:h.y,left:h.x,right:h.x+h.width,bottom:h.y+h.height,toJSON(){return h}}},u=(h,m,p)=>Object.defineProperty(h,m,{configurable:!0,writable:!0,value:p});for(let h of t)u(h,"getBBox",s),u(h,"getBoundingClientRect",l),u(h,"getComputedTextLength",function(){return n(this)}),u(h,"getSubStringLength",function(m,p){return o(this)?Math.max(0,(p||0)*cT(this)*.6):0}),u(h,"getTotalLength",function(){return a(i(this))}),u(h,"getPointAtLength",function(m){let p=i(this);if(!p.length)return{x:0,y:0};let f=Math.max(0,+m||0);for(let g=1;g<p.length;g++){let b=Math.hypot(p[g][0]-p[g-1][0],p[g][1]-p[g-1][1]);if(f<=b&&b>0){let S=f/b;return{x:p[g-1][0]+S*(p[g][0]-p[g-1][0]),y:p[g-1][1]+S*(p[g][1]-p[g-1][1])}}f-=b}let d=p[p.length-1];return{x:d[0],y:d[1]}});let c=r.HTMLCanvasElement?.prototype;if(c){let h=new WeakMap,m=f=>{let d=String(f||"").match(/([\d.]+)\s*(px|pt|em|rem)\b/i);if(!d)return 10;let g=parseFloat(d[1]);return d[2].toLowerCase()==="pt"?g*4/3:/r?em/i.test(d[2])?g*16:g},p=()=>{};Object.defineProperty(c,"getContext",{configurable:!0,writable:!0,value:function(f){if(String(f||"").toLowerCase()!=="2d")return null;let d=h.get(this);if(!d){let g=this;d=new Proxy({canvas:g,font:"10px sans-serif",measureText(b){let S=m(this.font),P=String(b??"").length*S*.6;return{width:P,actualBoundingBoxLeft:0,actualBoundingBoxRight:P,actualBoundingBoxAscent:S*.8,actualBoundingBoxDescent:S*.2,fontBoundingBoxAscent:S*.8,fontBoundingBoxDescent:S*.2}},getImageData:(b,S,P,w)=>({width:P,height:w,data:new Uint8ClampedArray(Math.max(1,P*w*4))}),createLinearGradient:()=>({addColorStop:p}),createRadialGradient:()=>({addColorStop:p}),getLineDash:()=>[],isPointInPath:()=>!1,isPointInStroke:()=>!1},{get:(b,S)=>S in b?b[S]:typeof S=="string"&&/^[a-z]/.test(S)?p:void 0}),h.set(this,d)}return d}})}}function Gct(r){let t=["window","document","navigator","Event","CustomEvent","MouseEvent","KeyboardEvent","PointerEvent","Element","HTMLElement","SVGElement","Node","getComputedStyle","requestAnimationFrame","cancelAnimationFrame","DOMParser","XMLSerializer","MutationObserver","Image","ResizeObserver"],e=t.map(n=>[n,Object.getOwnPropertyDescriptor(globalThis,n)]),o=n=>n==="window"?r:n==="ResizeObserver"?r.ResizeObserver??class{observe(){}unobserve(){}disconnect(){}}:typeof r[n]=="function"&&/^[a-z]/.test(n)?r[n].bind(r):r[n];for(let n of t){let i=o(n);if(i!==void 0)try{Object.defineProperty(globalThis,n,{configurable:!0,writable:!0,value:i})}catch{}}return()=>{for(let[n,i]of e)try{i?Object.defineProperty(globalThis,n,i):delete globalThis[n]}catch{}}}function lK(r,t){let e=t.split(/\r?\n/);for(let o of String(r?.stack??"").split(`
319
319
  `)){if(!/eval at|anonymous/.test(o))continue;let n=o.match(/<anonymous>:(\d+):(\d+)\)?\s*$/);if(!n)continue;let i=parseInt(n[1],10)-2;if(i<1||i>e.length||!e[i-1].trim())continue;let a=e[i-1].trim();return{line:i,lineText:a.length>200?a.slice(0,197)+"...":a}}return{}}var om=r=>String(r?.message??r??"unknown error").split(`
320
320
  `)[0].slice(0,400),mK=r=>new Promise(t=>setTimeout(t,r));async function uK(r,t){let e=Date.now()+t;for(;Date.now()<e;){let o=!1;for(let n of Array.from(r.querySelectorAll("*"))){let i=n.__transition;if(i&&Object.keys(i).length){o=!0;break}}if(!o)return;await mK(40)}}async function Vct(r){let t=Date.now(),e={rows:r.rows.length,payloadRows:0,missingPlugins:[],threw:null,invalid:null,timedOut:!1,marks:{byKind:{},total:0,legend:0,containerKind:"empty",declaresNoRowMarks:!1},blank:!1,frame:null,click:{tried:!1,target:"",reached:!1,sourceRowIdxs:[],sourceRows:[],error:null},consoleErrors:[],elapsedMs:0},o=e.consoleErrors,n=d=>{o.length<8&&!/painted no data marks/.test(d)&&o.push(d.slice(0,300))};if(e.missingPlugins=VM(r.code).filter(d=>!Uct.has(d)),e.missingPlugins.length)return e.elapsedMs=Date.now()-t,e;let i=new Proxy({},{get:(d,g)=>g==="error"||g==="warn"?(...b)=>n(b.map(S=>om(S)).join(" ")):()=>{}}),a=new xp({url:"http://localhost/",width:r.width,height:r.height,console:i,settings:{disableJavaScriptFileLoading:!0,disableCSSFileLoading:!0,handleDisabledFileLoadingAsSuccess:!0,suppressInsecureJavaScriptEnvironmentWarning:!0}});Fct(a);let s=Gct(a),l=console.error,u=console.warn,c=console.log;console.error=(...d)=>n(d.map(g=>om(g)).join(" ")),console.warn=(...d)=>n(d.map(g=>om(g)).join(" ")),console.log=()=>{};let h=d=>{n(`uncaught: ${om(d?.error??d?.message)}`)};a.addEventListener("error",h);let m=FM(ak,Cct,kct,Mct);a.d3=m;let p=a.document.createElement("div");p.style.width=`${r.width}px`,p.style.height=`${r.height}px`,a.document.body.appendChild(p);let f=null;try{let g=zM(r.columns,r.rows,r.binding).payloadFor(null);e.payloadRows=g.payload.rows.length,f=HM(p,{code:r.code,d3:m,data:g.payload,options:{...r.options??{},width:r.width,height:r.height,openUrl:Bct},geoKind:r.geoKind||void 0,geoProvider:()=>r.geo,fit:!1,onInvalidSentinel:S=>{e.invalid=S.reason||S.message}});let b={rows:[]};f.selection.onChange((S,P)=>{P!=="host"&&(b.rows=vP(g.rowMap,S))});try{f.render();let S=r.renderTimeoutMs??15e3;await Promise.race([f.rendered.then(()=>!1),mK(S).then(()=>!0)])&&(e.timedOut=!0)}catch(S){let P=/could not be COMPILED|did not define render/.test(om(S));e.threw={phase:P?"compile":"render",message:om(S),...lK(S,r.code)}}if(!e.threw&&!e.invalid&&!e.timedOut){await uK(p,2e3);let S=e8(p);e.marks.legend=S.legendMarkCount,e.marks.containerKind=S.containerKind,e.marks.declaresNoRowMarks=S.declaresNoRowMarks;for(let w of Array.from(p.querySelectorAll(".d3-mark"))){if(w.closest(".d3-legend-mark"))continue;let k=String(w.localName||"element").toLowerCase();e.marks.byKind[k]=(e.marks.byKind[k]??0)+1}e.marks.total=S.markCount,e.blank=r8({markCount:S.markCount,rows:e.payloadRows,declaresNoRowMarks:S.declaresNoRowMarks});try{e.frame=oK(p)}catch{e.frame=null}try{if(e.ramp=_ct(p,m),e.ramp)for(let w of e.ramp.atEnds)w.rowIdxs=vP(g.rowMap,w.rowIdxs),w.rows=w.rowIdxs.slice(0,3).map(k=>r.rows[k]).filter(Boolean)}catch{e.ramp=null}try{e.table=Lct(p)}catch{e.table=null}let P=Array.from(p.querySelectorAll(".d3-mark")).find(w=>!w.closest(".d3-legend-mark")&&(w.hasAttribute("data-row-idx")||w.querySelector("[data-row-idx]")));if(P){e.click.tried=!0;let w=P.hasAttribute("data-row-idx")?P:P.querySelector("[data-row-idx]"),k=String(w.getAttribute("data-row-idx")).split(",");e.click.target=`${String(P.localName).toLowerCase()} for ${k.length===1?`row ${k[0]}`:`${k.length} rows`}`;let E=o.length;try{P.dispatchEvent(new a.MouseEvent("click",{bubbles:!0,cancelable:!0,view:a})),await uK(p,1e3)}catch(U){e.click.error=om(U)}!e.click.error&&o.length>E&&(e.click.error=o[E]),b.rows.length&&(e.click.reached=!0,e.click.sourceRowIdxs=b.rows,e.click.sourceRows=b.rows.slice(0,3).map(U=>r.rows[U]).filter(Boolean))}}}catch(d){e.threw=e.threw??{phase:"render",message:om(d),...lK(d,r.code)}}finally{try{f?.animation.stop()}catch{}try{f?.destroy()}catch{}a.removeEventListener("error",h),console.error=l,console.warn=u,console.log=c,s();try{await a.happyDOM.abort(),await a.happyDOM.close()}catch{}}return e.elapsedMs=Date.now()-t,e}if(!Ect&&nK&&iK?.bicCheckChart){let r=nK;Vct(iK.job).then(t=>r.postMessage({ok:!0,facts:t}),t=>r.postMessage({ok:!1,error:om(t)}))}export{Fct as installLayoutEstimates,_ct as readRampOutlier,Lct as readTable,Vct as renderChartCheck};
package/dist/index.mjs CHANGED
@@ -332,7 +332,7 @@ data:
332
332
 
333
333
  `,t.enqueue(a.encode(i)),!0}catch(i){return this.onerror?.(i),!1}}handleUnsupportedRequest(){return this.onerror?.(new Error("Method not allowed.")),new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}),{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(t,a){try{let r=t.headers.get("accept");if(!r?.includes("application/json")||!r.includes("text/event-stream"))return this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");let n=t.headers.get("content-type");if(!vz(n))return this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let i={headers:Object.fromEntries(t.headers.entries()),url:new URL(t.url)},o;if(a?.parsedBody!==void 0)o=a.parsedBody;else try{let b=await kz(t,this._maxRequestBodySize);if(b.tooLarge){let N=Nz(this._maxRequestBodySize);return this.onerror?.(new Error(N)),this.createJsonErrorResponse(413,-32e3,N)}o=JSON.parse(b.text)}catch{return this.onerror?.(new Error("Parse error: Invalid JSON")),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}if(Array.isArray(o)&&o.length>100)return this.onerror?.(new Error(`Invalid Request: Batch must not exceed ${100} messages`)),this.createJsonErrorResponse(400,-32600,`Invalid Request: Batch must not exceed ${100} messages`);let s;try{Array.isArray(o)?s=o.map(b=>A2.parse(b)):s=[A2.parse(o)]}catch{return this.onerror?.(new Error("Parse error: Invalid JSON-RPC message")),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let l=s.some(Fh);if(l){if(this._initialized&&this.sessionId!==void 0)return this.onerror?.(new Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(s.length>1)return this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!l){let b=this.validateSession(t);if(b)return b;let N=this.validateProtocolVersion(t);if(N)return N}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!s.some(ua)){for(let b of s)this.onmessage?.(b,{authInfo:a?.authInfo,requestInfo:i});return new Response(null,{status:202})}let c=crypto.randomUUID(),d=s.find(b=>Fh(b)),h=d?d.params.protocolVersion:t.headers.get("mcp-protocol-version")??Rw;if(this._enableJsonResponse)return new Promise(b=>{this._streamMapping.set(c,{resolveJson:b,cleanup:()=>{this._streamMapping.delete(c)}});for(let N of s)ua(N)&&this._requestToStreamMapping.set(N.id,c);for(let N of s)this.onmessage?.(N,{authInfo:a?.authInfo,requestInfo:i})});let p=new TextEncoder,m,g,f=new ReadableStream({start:b=>{m=b},cancel:()=>{g!==void 0&&clearInterval(g),this._streamMapping.get(c)?.controller===m&&this._streamMapping.delete(c)}}),y={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};this.sessionId!==void 0&&(y["mcp-session-id"]=this.sessionId);for(let b of s)ua(b)&&(this._streamMapping.set(c,{controller:m,encoder:p,cleanup:()=>{g!==void 0&&clearInterval(g),this._streamMapping.delete(c);try{m.close()}catch{}}}),this._requestToStreamMapping.set(b.id,c));try{await this.writePrimingEvent(m,p,c,h);for(let b of s){let N,k;ua(b)&&this._eventStore&&h>="2025-11-25"&&(N=()=>{this.closeSSEStream(b.id)},k=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(b,{authInfo:a?.authInfo,requestInfo:i,closeSSEStream:N,closeStandaloneSSEStream:k})}}catch(b){this._streamMapping.get(c)?.cleanup(),this._resumableStreams.delete(c);for(let N of s)ua(N)&&this._requestToStreamMapping.delete(N.id);throw b}return this._streamMapping.get(c)?.controller===m&&(g=this.startKeepAlive(m,p)),new Response(f,{status:200,headers:y})}catch(r){return this.onerror?.(r),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(r)})}}async handleDeleteRequest(t){let a=this.validateSession(t);if(a)return a;let r=this.validateProtocolVersion(t);if(r)return r;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(t){if(this.sessionIdGenerator===void 0)return;if(!this._initialized)return this.onerror?.(new Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let a=t.headers.get("mcp-session-id");if(!a)return this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required");if(a!==this.sessionId)return this.onerror?.(new Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")}validateProtocolVersion(t){let a=t.headers.get("mcp-protocol-version");if(a!==null&&!L4.includes(a))return this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${a} (supported versions: ${L4.join(", ")})`)),this.createJsonErrorResponse(400,-32e3,`Bad Request: Unsupported protocol version: ${a} (supported versions: ${L4.join(", ")})`)}async close(){this._closed||(this._closed=!0,this._streamMapping.forEach(({cleanup:t})=>{t()}),this._streamMapping.clear(),this._requestResponseMap.clear(),this._resumableStreams.clear(),this.onclose?.())}closeSSEStream(t){let a=this._requestToStreamMapping.get(t);if(!a)return;let r=this._streamMapping.get(a);r&&r.cleanup()}closeStandaloneSSEStream(){let t=this._streamMapping.get(this._standaloneSseStreamId);t&&t.cleanup()}async send(t,a){let r=a?.relatedRequestId;if((ca(t)||F4(t))&&(r=t.id),r===void 0){if(ca(t)||F4(t))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let o;this._eventStore&&(o=await this._eventStore.storeEvent(this._standaloneSseStreamId,t));let s=this._streamMapping.get(this._standaloneSseStreamId);if(s===void 0)return;s.controller&&s.encoder&&(o===void 0||!s.replayedEventIds?.has(o))&&this.writeSSEEvent(s.controller,s.encoder,t,o);return}let n=this._requestToStreamMapping.get(r);if(!n)throw new Error(`No connection established for request ID: ${String(r)}`);let i=this._streamMapping.get(n);if(!this._enableJsonResponse){let o;this._eventStore&&(o=await this._eventStore.storeEvent(n,t),i=this._streamMapping.get(n)),i?.controller&&i?.encoder&&(o===void 0||!i.replayedEventIds?.has(o))&&this.writeSSEEvent(i.controller,i.encoder,t,o)&&o!==void 0&&this._resumableStreams.add(n)}if(ca(t)||F4(t)){this._requestResponseMap.set(r,t);let o=Array.from(this._requestToStreamMapping.entries()).filter(([l,u])=>u===n).map(([l])=>l);if(o.every(l=>this._requestResponseMap.has(l))){if(!i){if(this._closed){for(let l of o)this._requestResponseMap.delete(l),this._requestToStreamMapping.delete(l);return}if(!this._enableJsonResponse&&this._eventStore&&this._resumableStreams.has(n)){for(let l of o)this._requestResponseMap.delete(l),this._requestToStreamMapping.delete(l);this._resumableStreams.delete(n);return}for(let l of o)this._requestResponseMap.delete(l),this._requestToStreamMapping.delete(l);throw new Error(`No connection established for request ID: ${String(r)}`)}if(this._enableJsonResponse&&i.resolveJson){let l={"Content-Type":"application/json"};this.sessionId!==void 0&&(l["mcp-session-id"]=this.sessionId);let u=o.map(c=>this._requestResponseMap.get(c));u.length===1?i.resolveJson(new Response(JSON.stringify(u[0]),{status:200,headers:l})):i.resolveJson(new Response(JSON.stringify(u),{status:200,headers:l}))}else i.cleanup();for(let l of o)this._requestResponseMap.delete(l),this._requestToStreamMapping.delete(l);this._resumableStreams.delete(n)}}}};var Rl=class{constructor(t={}){this._requestContext=new WeakMap,this._webStandardTransport=new Tl(t),this._requestListener=sv(async a=>{let r=this._requestContext.get(a);return this._webStandardTransport.handleRequest(a,{authInfo:r?.authInfo,parsedBody:r?.parsedBody})},{overrideGlobalObjects:!1})}get sessionId(){return this._webStandardTransport.sessionId}set onclose(t){this._webStandardTransport.onclose=t}get onclose(){return this._webStandardTransport.onclose}set onerror(t){this._webStandardTransport.onerror=t}get onerror(){return this._webStandardTransport.onerror}set onmessage(t){this._webStandardTransport.onmessage=t}get onmessage(){return this._webStandardTransport.onmessage}async start(){return this._webStandardTransport.start()}async close(){return this._webStandardTransport.close()}async send(t,a){return this._webStandardTransport.send(t,a)}async handleRequest(t,a,r){let n=t.auth;await sv(async o=>this._webStandardTransport.handleRequest(o,{authInfo:n,parsedBody:r}),{overrideGlobalObjects:!1})(t,a)}closeSSEStream(t){this._webStandardTransport.closeSSEStream(t)}closeStandaloneSSEStream(){this._webStandardTransport.closeStandaloneSSEStream()}};var kie=16*1024*1024;function Wz(e,t){let a=o=>{let s=e.indexOf(o);return s>=0&&s+1<e.length?e[s+1]:void 0},r=e.includes("--http")||/^(1|true|yes|on)$/i.test((t.BIC_MCP_HOSTED??"").trim()),n=a("--port")??t.BIC_MCP_HTTP_PORT??"8799",i=Number(n);if(!Number.isInteger(i)||i<0||i>65535)throw new Error(`--port must be a whole number from 0 to 65535 (got "${n}").`);return{http:r,host:a("--host")??"127.0.0.1",port:i}}function El(e,t,a,r={}){if(e.headersSent){e.end();return}e.writeHead(t,{"Content-Type":"application/json","Cache-Control":"no-store",...r}),e.end(JSON.stringify(a))}function l7(e,t,a,r,n={}){El(e,t,{jsonrpc:"2.0",error:{code:a,message:r},id:null},n)}function wie(e,t,a){return new Promise((r,n)=>{let i=[],o=0,s=!1;e.on("data",l=>{if(!s){if(o+=l.length,o>a){s=!0,i.length=0,l7(t,413,-32600,`The request is larger than this server accepts (${Math.floor(a/1048576)} MB). Send the table at the chart's grain - aggregated - or with fewer columns.`,{Connection:"close"}),r(null);return}i.push(l)}}),e.on("end",()=>{s||r(Buffer.concat(i).toString("utf-8"))}),e.on("error",n)})}async function Wie(e,t,a){let r=zx(e.headers.authorization);if(!r){l7(t,401,-32001,"Sign in to use this chart server: connect to it from your app, which sends your account's access token with each request.",{"WWW-Authenticate":"Bearer"});return}let n=await wie(e,t,a.maxBodyBytes??kie);if(n===null)return;let i;try{i=JSON.parse(n)}catch{l7(t,400,-32700,"Parse error: the request body isn't JSON.");return}let o=a.newServer(),s=new Rl({sessionIdGenerator:void 0});t.on("close",()=>{s.close().catch(()=>{}),o.close().catch(()=>{})}),await o.connect(s);let l=$x(e.headers[Zy.toLowerCase()]);await Tx({accessToken:r,...l?{clientIp:l}:{}},()=>s.handleRequest(e,t,i))}function Cz(e){let t=e.log??(r=>{process.stderr.write(r+`
334
334
  `)}),a=Sie((r,n)=>{let i=new URL(r.url??"/","http://localhost").pathname;if(i==="/healthz"){if(r.method!=="GET"&&r.method!=="HEAD"){El(n,405,{error:"Use GET."},{Allow:"GET"});return}El(n,200,{ok:!0,server:"bic-chart",version:e.version});return}if(i!=="/mcp"){El(n,404,{error:"Not found. The MCP endpoint is /mcp."});return}if(r.method!=="POST"){l7(n,405,-32e3,"Method not allowed: this server is stateless, so it takes POST only.",{Allow:"POST"});return}Wie(r,n,e).catch(o=>{t(`[bic-chart http] request failed (${o?.name??"Error"})`),l7(n,500,-32603,"Internal error: the chart server couldn't handle this request. Try again.")})});return new Promise((r,n)=>{a.once("error",n),a.listen(e.port,e.host,()=>{a.off("error",n),r(a)})})}var Mz=["assess_data_shape","list_eligible_charts","generate_chart","get_guide","preview_request","check_request"],Xi="This hosted server receives your table, profiles it in memory and sends only the profile to generation; rows aren't stored or logged.",Pz={csv_path:"this hosted server can't read files on your machine, so pass the table as data or csv_text",project_dir:"this hosted server can't see your project folder, so pass language or renderer instead",out_dir:"this hosted server returns the chart inline; it can't write to your machine",preview_html:"this hosted server returns the chart inline; it can't write to your machine"},zl=e=>`Not accepted by this hosted server: ${Pz[e]}.`,u7={csv_path:C.string().optional().describe(zl("csv_path")),project_dir:C.string().optional().describe(zl("project_dir"))},_z={out_dir:C.string().optional().describe(zl("out_dir")),preview_html:C.boolean().optional().describe(zl("preview_html"))},cv=C.enum(["javascript","typescript","python",""]).optional(),Az=["csv_path","project_dir","out_dir","preview_html"],Iz={assess_data_shape:{description:`Profile a dataset: per-column types, cardinality, ranges, measure/dimension roles, temporal/ordinal detection, and cross-column signals (nesting, shared values, association) - the same measurement engine the BIC Power BI visual uses before generating a chart. Pass the table as data ({columns, rows}) or csv_text. ${Xi} This tool sends nothing on.`,inputs:{csv_path:u7.csv_path},refuse:["csv_path"]},list_eligible_charts:{description:"The AUTHORITATIVE list of chart types (maps, tables a reader works with and app widgets included) that can render this dataset - the server's own eligibility engine, NOT a guess. Pass the table as data ({columns, rows}) or csv_text. "+Xi+" Ranked for JavaScript (D3) unless you pass language ('python' ranks Plotly and matplotlib) or renderer ('D3'/'PLOTLY'/... for one renderer, '' for every renderer). No model runs, but the call is METERED: free within a generous hourly allowance, then usage credits per call.",inputs:{...u7,language:cv.describe("Project source language: javascript/typescript ranks D3, python ranks Plotly and matplotlib. Omit for JavaScript; `renderer`, when given, overrides it.")},refuse:["csv_path","project_dir"]},generate_chart:{description:`Generate ready-to-render chart code for a dataset: the backend picks a suitable chart type (or honors chart_type) and returns code that has passed its eligibility gates and quality checks. Pass the table as data ({columns, rows}) or csv_text. ${Xi} The code and the render-ready data come back inline in the reply; this server writes no files. JavaScript (D3) unless you pass language or renderer. The D3 code is a portable render(container, data, options) function meant to be MERGED into your own app; an integration contract describes exactly how to call it. A generation uses your account's credits. ${z0}`,inputs:{...u7,..._z,language:cv.describe("Project source language: javascript/typescript generates D3 (the renderer @bicharts/chart-host draws), python lets the backend pick within Plotly/matplotlib. Omit for JavaScript (D3); `renderer`, when given, overrides it.")},refuse:Az},preview_request:{description:`Shows exactly what a chart generation would send on for these arguments - the measured shape of your data (column names, types, counts, ranges), the settings, and whether any sample rows travel - with the credentials removed. It sends nothing on and costs nothing. ${Xi} Takes the same arguments as a generation.`,inputs:{...u7,..._z},refuse:Az},check_request:{description:`Checks a chart request against this data before anything is generated. Takes the same arguments as a generation - the chart type and every setting (date grain, limit, overlay, required columns, rows policy, data labels and the rest) - and answers, in the server's own words, each ask this data can't honor and why: a channel the data doesn't have, too little of one for the ask, or a name the catalog doesn't know. When the chart type itself is denied, it also lists up to five chart types that fit this data, best fit first. An OK names the asks it checked. Pass the table as data ({columns, rows}) or csv_text. ${Xi} No model runs and no generation credits are spent, but the call is METERED like the eligibility list: free within a generous hourly allowance, then usage credits per call. The reply carries a text block and a structured result: the verdict (OK or DENY), the asks checked, each finding with its kind and reason, and the alternatives.`,inputs:{...u7,language:cv.describe("Project source language: javascript/typescript checks the request as a D3 generation, python as a Plotly/matplotlib one. Omit for JavaScript (D3); `renderer`, when given, overrides it.")},refuse:["csv_path","project_dir"]},get_guide:{description:"How to build an app with these charts, from the guide this server ships. Free, and it sends nothing on. topic 'fabric-app' (the default) is what a Microsoft Fabric App on the Rayfin data app template needs; 'all' is the whole guide, including Blazor; 'chart-shapes' lists every chart type with the columns, limits and renderers it needs; 'settings' lists the choices a person can make about a chart, with their options and defaults. Some steps the guide describes, the ones that write into a project, need the local server (npx -y @bicharts/chart-mcp) rather than this one."}};function Uz(e,t){let a=(t??[]).filter(r=>{let n=e?.[r];return n!=null&&n!==!1&&n!==""});return a.length===0?null:a.map(r=>`${r} isn't accepted here: ${Pz[r]}.`).join(" ")}var xz=["This is RegiaBI's hosted chart server: it builds charts, maps, tables a reader works with and app widgets from a table you send. A request for RegiaBI means these tools.",Xi+" It can't reach your files: pass each table as data ({columns, rows}) or csv_text; the chart comes back inline.","Which visuals suit the data? Answer from list_eligible_charts, not general knowledge.","Six rules for charts that fit on the first try:","1. Pass the chart's WHOLE result at its grain, not a sample: counts decide what fits.","2. Name columns as your app renders them (rename Table[Column] first), unchanged at render time.","3. To pick a type, call list_eligible_charts on that data first and choose what answers the question as asked. Pass chart_type only for a type the person named; else leave it unset and the engine chooses. Named a type or ask? Run check_request first; say what it denies and why, don't generate around it. Build no input beside a visual's own controls.","4. Host the code with @bicharts/chart-host. generate_chart returns the code, the render-ready rows and the binding: pass them as is; never hand-build __rowIdx__ or __geo* columns.","5. Use `prompt` for what the chart shows; selection, cross-filtering, sizing and theming are the host's: filter with useBicFilter + selects (a lasso too), read a chart's sliders with useBicControls + controls (@bicharts/chart-host/react). Never write a select handler, toggle or clear.","6. The person chooses chart forms (familiar or unusual), language and region, and how much data shows (get_guide topic 'settings'). Unstated: ask once, one question listing the options, before the first generate_chart; pass only what they say, never a guess from the data. Can't ask: use defaults and report in your final message what `settings` shows the engine chose.","Building an app? get_guide has the setup; the local server (npx -y @bicharts/chart-mcp) writes files into your app."].join(`
335
- `);function d7(e,t){return yl(e,t).dir??Cr(e??process.cwd())}var hv="0.6.110",Ez=[],Zi=null,B1={registerTool(e,t,a){Ez.push({name:e,config:t,cb:a})},get server(){if(!Zi)throw new Error("The local server isn't running in this process.");return Zi.server}};function Rz(e){let t=e?new m8({name:"bic-chart",version:hv},{instructions:xz}):new m8({name:"bic-chart",version:hv},{instructions:zE});e||(t.server.registerCapabilities({logging:{}}),kx(a=>{t.server.sendLoggingMessage({level:"notice",logger:"sign-in",data:a}).catch(()=>{})}));for(let a of Ez){if(e&&!Mz.includes(a.name))continue;let r=e?Iz[a.name]:void 0,n={...a.config,...r?{description:r.description,inputSchema:{...a.config.inputSchema,...r.inputs??{}}}:{},annotations:{title:a.config.title,...a.config.annotations}},i=r?.refuse?(o,s)=>{let l=Uz(o,r.refuse);return l?{isError:!0,content:[{type:"text",text:l}]}:a.cb(o,s)}:a.cb;t.registerTool(a.name,n,i)}return t}var c7="2026-11-02T21:53:15Z src:bee98a3fdb90 (46 files)",pv="@bicharts/chart-host@0.6.110, @bicharts/shape-core@0.6.110",Cie=C.object({columns:C.array(C.object({name:C.string(),dataType:C.enum(["String","Integer","Decimal","DateTime"]).optional().describe("Known type (DAX/semantic-model callers have it); omit to infer from values."),isMeasure:C.boolean().optional().describe("Known measure/dimension role; omit to apply the numeric-non-identifier heuristic. A semantic-model caller should set this."),format:C.string().optional().describe('Format string from the model (e.g. "$#,##0") \u2192 modelFormat.'),description:C.string().optional().describe("Column description from the model \u2192 modelDesc.")})).min(1),rows:C.array(C.union([C.array(C.any()),C.record(C.string(),C.any())])).min(1).describe("Rows as positional arrays aligned to columns, OR objects keyed by column name.")}).describe("A pre-typed {columns, rows} table (DAX query results, dataframe, arrow). Use INSTEAD of csv_path/csv_text."),gv={csv_path:C.string().optional().describe("Path to a CSV file (header row required)."),csv_text:C.string().optional().describe("Inline CSV text (alternative to csv_path)."),data:Cie.optional().describe("A pre-typed {columns, rows} table \u2014 the shape a Fabric DAX query / dataframe already has. Alternative to csv_path/csv_text; when columns carry isMeasure/format/description the shape matches PBI fidelity with no guessing."),measures:C.array(C.string()).optional().describe("Columns to treat as MEASURES (the PBI 'Values' well \u2014 fields the chart aggregates). Numeric non-identifier columns are measures by default."),dimensions:C.array(C.string()).optional().describe("Columns to treat as DIMENSIONS (a PBI category/axis well \u2014 fields to group/break by). Use for numeric codes/years that should NOT be aggregated."),formats:C.record(C.string(),C.string()).optional().describe(`Per-column number/date FORMAT STRING (e.g. {"Revenue":"$#,##0","Margin":"0.0%"}). PBI supplies these from its model; a CSV can't, so provide them to steer number formatting.`),descriptions:C.record(C.string(),C.string()).optional().describe("Per-column human DESCRIPTION \u2014 gives the model semantic context the bare column name lacks."),group_by:C.array(C.string()).optional().describe("Columns that are the PRIMARY series/breakdown (the PBI 'Group by' well); the backend leads the visualization with these."),non_additive:C.array(C.string()).optional().describe("MEASURE columns that must NOT be summed (a ratio/average/rate \u2014 use mean, never stack). Usually auto-detected; this is an authoritative override."),privacy_level:C.enum(["0","10","20","30"]).optional().describe("How much detail to compute/share: 0 names only, 10 +counts, 20 +detailed stats (default), 30 +obfuscated sample rows."),culture:fr(C.string().regex(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/).max(35).refine(e=>fn(e)!==void 0,{error:e=>`'${String(e.input)}' is not a valid language tag; use a form such as 'de-DE', 'fr', 'ja-JP', 'es-419' or 'zh-Hant-TW'.`})).describe("The caller's language and region as a BCP 47 tag such as 'de-DE', 'fr' or 'ja-JP'. Default 'en-US'. It is the language the chart's own text is written in (titles, axis labels, legends, notes), and it breaks the tie when a CSV's numbers or dates are ambiguous: 12.500 as twelve thousand five hundred or twelve and a half, 05.03.2024 as 5 March or 3 May. Set it from the end user's locale when you know it; it does not translate the data.")};function Vi(e){return{measures:e.measures,dimensions:e.dimensions,formats:e.formats,descriptions:e.descriptions,groupBy:e.group_by,nonAdditive:e.non_additive,privacyLevel:e.privacy_level??"20",locale:e.culture||void 0}}function h7(e){if(e.data)return o0(e.data.columns,e.data.rows,Vi(e));if(e.csv_text)return sn(e.csv_text,Vi(e));if(e.csv_path)return sn(mv(Cr(e.csv_path),"utf-8"),Vi(e));throw new Error("Provide one of: data ({columns, rows}), csv_text, or csv_path.")}B1.registerTool("assess_data_shape",{title:"Assess data shape",description:"Profile a dataset locally (no data leaves the machine): per-column types, cardinality, ranges, measure/dimension roles, temporal/ordinal detection, and cross-column signals (nesting, shared values, association). This is the same measurement engine the BIC Power BI visual uses before generating a chart.",inputSchema:gv,annotations:{readOnlyHint:!0,openWorldHint:!1}},async e=>{let t=h7(e),a={totalRows:t.totalRows,leafCardinality:t.index.getLeafCardinality(),columns:t.shape},r=_1()?null:sT(process.env);return{content:[{type:"text",text:JSON.stringify(a,null,2)},...r?[{type:"text",text:r}]:[]]}});B1.registerTool("get_guide",{title:"Read the build guide",description:"How to build an app with these charts, from the guide this package ships. Local and free: no network, no credentials. topic 'fabric-app' (the default) is what a Microsoft Fabric App on the Rayfin data app template needs: what to pull, generating, wiring in React, the Fabric App section and the time-savers. 'all' is the whole guide, including Blazor. 'chart-shapes' lists every chart type with the columns, limits and renderers it needs. 'settings' lists the choices a person can make about a chart, with their options and defaults.",inputSchema:{topic:C.enum(FE).optional().describe("'fabric-app' (default), 'all', 'chart-shapes', or 'settings'.")},annotations:{readOnlyHint:!0,openWorldHint:!1}},async e=>{try{return{content:[{type:"text",text:BE(e.topic??"fabric-app")}]}}catch(t){return{isError:!0,content:[{type:"text",text:`The guide could not be read from this package (${t?.message??t}). It is also published as skills/bic-charts/SKILL.md inside @bicharts/chart-mcp on npm.`}]}}});B1.registerTool("list_eligible_charts",{title:"List eligible chart types",description:"The AUTHORITATIVE list of chart types (maps, tables a reader works with and app widgets included) that can render this dataset \u2014 the server's own eligibility engine, NOT a local guess. Profiles the data locally, then sends that profile to the backend. NO LLM in the loop, but this is a NETWORK call and it is METERED \u2014 see the licensing note below. By default the tool DETECTS the project's language (JS/TS vs Python from the working dir) and returns the charts for THAT language, SCOPED and ordered by how well each type fits this data (best first; `order: 'variety'` favors newer and less-common types instead), each tagged with its source language and renderer. Pass `language` ('javascript'|'python') to force it, or `renderer` ('D3'/'PLOTLY'/\u2026) to rank one specific renderer, or renderer '' for the full renderer-agnostic eligibility across ALL renderers (also ranked, by chart type alone, with no renderer/language tag). If the language can't be auto-detected and none is given, the tool asks you to specify one. Needs an account: eligibility IS the engine, so programmatic access to it is licensed. With nothing configured, the first call opens a browser sign-in, waits for it and then answers (a license key in the environment is the alternative for a machine with no browser). Free within a generous hourly allowance; beyond it each call draws usage credits. The reply carries a text block and a structured table: one row per chart type with its rank, name, preview flag, fit verdict, description, language and renderer. Rows flagged alsoWorthALook are a few picks from below the top fits, drawn so an offer can include something different; the fit order itself never changes.",inputSchema:{...gv,language:C.enum(["javascript","typescript","python",""]).optional().describe("Project source language \u2192 the server ranks across that language's renderers (javascript/typescript = D3, python = Plotly/matplotlib). Omit to AUTO-DETECT from the working dir; `renderer` (if given) overrides this."),project_dir:C.string().optional().describe("Directory to auto-detect the project language from (default: the folder setup_fabric_app used, else the working directory or the one project folder directly inside it)."),renderer:C.enum(["D3","PLOTLY","PYMATPLOT",""]).optional().describe("Force a specific renderer (overrides `language`): a concrete renderer ranks that renderer's charts; '' = the full renderer-agnostic eligibility (all renderers, ranked by chart type alone). Omit to use `language`/auto-detection."),level_of_detail:fr(C.enum(["High","Medium","Low",""])).describe("The user's own preference for how much of the data to see, as they've stated it. 'High' = every observation as its own mark, 'Medium' = every row shown as a distribution, 'Low' = one mark per category. Ranks this list the same way a generation would. Unset when they haven't stated one; unset changes nothing."),chart_style:fr(C.enum(["traditional","non_traditional",""])).describe("The user's own preference for which family of charts the list covers, as they've stated it. 'traditional' lists only the familiar forms (bar, stacked and grouped bar, line, area, pie, donut, card, gauge), 'non_traditional' lists only the other chart types; a type outside the chosen family is left out. Unset when they haven't stated one; unset changes nothing."),name_filter:C.string().optional().describe("Show only chart types matching this text (the same matcher the Power BI and Excel chart-type lists use). Three tiers, first non-empty one wins outright: the term starting a WORD in the name ('gan' -> Gantt chart, and NOT Organization chart), then mid-word in the name ('eth' -> Choropleth), then the description. A name match therefore SUPPRESSES description matches. Case- and accent-insensitive and, by default, space- and punctuation-insensitive too ('barchart' and 'bar-chart' find Bar chart; see name_filter_match). Minimum two characters, and it never reorders - the picker's ranking is preserved and the ranks stay as issued. Applied after ranking and before `top`."),name_filter_match:C.enum(["loose","exact"]).optional().describe("How name_filter matches a name. 'loose' (the default) ignores accents, case, spaces and punctuation, so 'barchart' finds Bar chart. 'exact' folds accents and case and collapses repeated spaces, and nothing else: a name typed without its space or hyphen matches nothing. The same setting the Power BI and Excel chart-type lists offer."),order:C.enum(["fit","variety"]).optional().describe("How the list is ordered. 'fit' (the default) = by how well each chart type fits THIS data, nothing else - use it to choose a chart for a question. 'variety' = the picker's selection order, which favors newer and less-common types on purpose - use it when the user wants to explore or be surprised. Both lists hold the same chart types; only the order differs."),top:C.number().optional().describe("Show only the top-N ranked results. Omit for all."),width:C.number().optional().describe("Viewport width px (default 800) \u2014 affects small-viewport / facet-budget gates."),height:C.number().optional().describe("Viewport height px (default 600).")},outputSchema:RE,annotations:{readOnlyHint:!0,openWorldHint:!0}},async e=>{let t=h7(e),a="",r="",n="",i="";if(e.renderer!==void 0)a=e.renderer;else if(e.language)r=e.language;else if(_1())r="javascript",n=" (language: javascript, this server's default - pass language or renderer for another)";else{let b=fl(d7(e.project_dir,Li));b.language?(r=b.language,n=` (auto-detected language: ${b.language} \u2014 ${b.reason})`):i=`Couldn't tell the project's language (${b.reason}), so this is the list across all renderers; pass language: "javascript" or "python", or project_dir, to narrow it.
335
+ `);function d7(e,t){return yl(e,t).dir??Cr(e??process.cwd())}var hv="0.6.111",Ez=[],Zi=null,B1={registerTool(e,t,a){Ez.push({name:e,config:t,cb:a})},get server(){if(!Zi)throw new Error("The local server isn't running in this process.");return Zi.server}};function Rz(e){let t=e?new m8({name:"bic-chart",version:hv},{instructions:xz}):new m8({name:"bic-chart",version:hv},{instructions:zE});e||(t.server.registerCapabilities({logging:{}}),kx(a=>{t.server.sendLoggingMessage({level:"notice",logger:"sign-in",data:a}).catch(()=>{})}));for(let a of Ez){if(e&&!Mz.includes(a.name))continue;let r=e?Iz[a.name]:void 0,n={...a.config,...r?{description:r.description,inputSchema:{...a.config.inputSchema,...r.inputs??{}}}:{},annotations:{title:a.config.title,...a.config.annotations}},i=r?.refuse?(o,s)=>{let l=Uz(o,r.refuse);return l?{isError:!0,content:[{type:"text",text:l}]}:a.cb(o,s)}:a.cb;t.registerTool(a.name,n,i)}return t}var c7="2026-11-02T22:12:05Z src:c06862ae3c05 (46 files)",pv="@bicharts/chart-host@0.6.111, @bicharts/shape-core@0.6.111",Cie=C.object({columns:C.array(C.object({name:C.string(),dataType:C.enum(["String","Integer","Decimal","DateTime"]).optional().describe("Known type (DAX/semantic-model callers have it); omit to infer from values."),isMeasure:C.boolean().optional().describe("Known measure/dimension role; omit to apply the numeric-non-identifier heuristic. A semantic-model caller should set this."),format:C.string().optional().describe('Format string from the model (e.g. "$#,##0") \u2192 modelFormat.'),description:C.string().optional().describe("Column description from the model \u2192 modelDesc.")})).min(1),rows:C.array(C.union([C.array(C.any()),C.record(C.string(),C.any())])).min(1).describe("Rows as positional arrays aligned to columns, OR objects keyed by column name.")}).describe("A pre-typed {columns, rows} table (DAX query results, dataframe, arrow). Use INSTEAD of csv_path/csv_text."),gv={csv_path:C.string().optional().describe("Path to a CSV file (header row required)."),csv_text:C.string().optional().describe("Inline CSV text (alternative to csv_path)."),data:Cie.optional().describe("A pre-typed {columns, rows} table \u2014 the shape a Fabric DAX query / dataframe already has. Alternative to csv_path/csv_text; when columns carry isMeasure/format/description the shape matches PBI fidelity with no guessing."),measures:C.array(C.string()).optional().describe("Columns to treat as MEASURES (the PBI 'Values' well \u2014 fields the chart aggregates). Numeric non-identifier columns are measures by default."),dimensions:C.array(C.string()).optional().describe("Columns to treat as DIMENSIONS (a PBI category/axis well \u2014 fields to group/break by). Use for numeric codes/years that should NOT be aggregated."),formats:C.record(C.string(),C.string()).optional().describe(`Per-column number/date FORMAT STRING (e.g. {"Revenue":"$#,##0","Margin":"0.0%"}). PBI supplies these from its model; a CSV can't, so provide them to steer number formatting.`),descriptions:C.record(C.string(),C.string()).optional().describe("Per-column human DESCRIPTION \u2014 gives the model semantic context the bare column name lacks."),group_by:C.array(C.string()).optional().describe("Columns that are the PRIMARY series/breakdown (the PBI 'Group by' well); the backend leads the visualization with these."),non_additive:C.array(C.string()).optional().describe("MEASURE columns that must NOT be summed (a ratio/average/rate \u2014 use mean, never stack). Usually auto-detected; this is an authoritative override."),privacy_level:C.enum(["0","10","20","30"]).optional().describe("How much detail to compute/share: 0 names only, 10 +counts, 20 +detailed stats (default), 30 +obfuscated sample rows."),culture:fr(C.string().regex(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/).max(35).refine(e=>fn(e)!==void 0,{error:e=>`'${String(e.input)}' is not a valid language tag; use a form such as 'de-DE', 'fr', 'ja-JP', 'es-419' or 'zh-Hant-TW'.`})).describe("The caller's language and region as a BCP 47 tag such as 'de-DE', 'fr' or 'ja-JP'. Default 'en-US'. It is the language the chart's own text is written in (titles, axis labels, legends, notes), and it breaks the tie when a CSV's numbers or dates are ambiguous: 12.500 as twelve thousand five hundred or twelve and a half, 05.03.2024 as 5 March or 3 May. Set it from the end user's locale when you know it; it does not translate the data.")};function Vi(e){return{measures:e.measures,dimensions:e.dimensions,formats:e.formats,descriptions:e.descriptions,groupBy:e.group_by,nonAdditive:e.non_additive,privacyLevel:e.privacy_level??"20",locale:e.culture||void 0}}function h7(e){if(e.data)return o0(e.data.columns,e.data.rows,Vi(e));if(e.csv_text)return sn(e.csv_text,Vi(e));if(e.csv_path)return sn(mv(Cr(e.csv_path),"utf-8"),Vi(e));throw new Error("Provide one of: data ({columns, rows}), csv_text, or csv_path.")}B1.registerTool("assess_data_shape",{title:"Assess data shape",description:"Profile a dataset locally (no data leaves the machine): per-column types, cardinality, ranges, measure/dimension roles, temporal/ordinal detection, and cross-column signals (nesting, shared values, association). This is the same measurement engine the BIC Power BI visual uses before generating a chart.",inputSchema:gv,annotations:{readOnlyHint:!0,openWorldHint:!1}},async e=>{let t=h7(e),a={totalRows:t.totalRows,leafCardinality:t.index.getLeafCardinality(),columns:t.shape},r=_1()?null:sT(process.env);return{content:[{type:"text",text:JSON.stringify(a,null,2)},...r?[{type:"text",text:r}]:[]]}});B1.registerTool("get_guide",{title:"Read the build guide",description:"How to build an app with these charts, from the guide this package ships. Local and free: no network, no credentials. topic 'fabric-app' (the default) is what a Microsoft Fabric App on the Rayfin data app template needs: what to pull, generating, wiring in React, the Fabric App section and the time-savers. 'all' is the whole guide, including Blazor. 'chart-shapes' lists every chart type with the columns, limits and renderers it needs. 'settings' lists the choices a person can make about a chart, with their options and defaults.",inputSchema:{topic:C.enum(FE).optional().describe("'fabric-app' (default), 'all', 'chart-shapes', or 'settings'.")},annotations:{readOnlyHint:!0,openWorldHint:!1}},async e=>{try{return{content:[{type:"text",text:BE(e.topic??"fabric-app")}]}}catch(t){return{isError:!0,content:[{type:"text",text:`The guide could not be read from this package (${t?.message??t}). It is also published as skills/bic-charts/SKILL.md inside @bicharts/chart-mcp on npm.`}]}}});B1.registerTool("list_eligible_charts",{title:"List eligible chart types",description:"The AUTHORITATIVE list of chart types (maps, tables a reader works with and app widgets included) that can render this dataset \u2014 the server's own eligibility engine, NOT a local guess. Profiles the data locally, then sends that profile to the backend. NO LLM in the loop, but this is a NETWORK call and it is METERED \u2014 see the licensing note below. By default the tool DETECTS the project's language (JS/TS vs Python from the working dir) and returns the charts for THAT language, SCOPED and ordered by how well each type fits this data (best first; `order: 'variety'` favors newer and less-common types instead), each tagged with its source language and renderer. Pass `language` ('javascript'|'python') to force it, or `renderer` ('D3'/'PLOTLY'/\u2026) to rank one specific renderer, or renderer '' for the full renderer-agnostic eligibility across ALL renderers (also ranked, by chart type alone, with no renderer/language tag). If the language can't be auto-detected and none is given, the tool asks you to specify one. Needs an account: eligibility IS the engine, so programmatic access to it is licensed. With nothing configured, the first call opens a browser sign-in, waits for it and then answers (a license key in the environment is the alternative for a machine with no browser). Free within a generous hourly allowance; beyond it each call draws usage credits. The reply carries a text block and a structured table: one row per chart type with its rank, name, preview flag, fit verdict, description, language and renderer. Rows flagged alsoWorthALook are a few picks from below the top fits, drawn so an offer can include something different; the fit order itself never changes.",inputSchema:{...gv,language:C.enum(["javascript","typescript","python",""]).optional().describe("Project source language \u2192 the server ranks across that language's renderers (javascript/typescript = D3, python = Plotly/matplotlib). Omit to AUTO-DETECT from the working dir; `renderer` (if given) overrides this."),project_dir:C.string().optional().describe("Directory to auto-detect the project language from (default: the folder setup_fabric_app used, else the working directory or the one project folder directly inside it)."),renderer:C.enum(["D3","PLOTLY","PYMATPLOT",""]).optional().describe("Force a specific renderer (overrides `language`): a concrete renderer ranks that renderer's charts; '' = the full renderer-agnostic eligibility (all renderers, ranked by chart type alone). Omit to use `language`/auto-detection."),level_of_detail:fr(C.enum(["High","Medium","Low",""])).describe("The user's own preference for how much of the data to see, as they've stated it. 'High' = every observation as its own mark, 'Medium' = every row shown as a distribution, 'Low' = one mark per category. Ranks this list the same way a generation would. Unset when they haven't stated one; unset changes nothing."),chart_style:fr(C.enum(["traditional","non_traditional",""])).describe("The user's own preference for which family of charts the list covers, as they've stated it. 'traditional' lists only the familiar forms (bar, stacked and grouped bar, line, area, pie, donut, card, gauge), 'non_traditional' lists only the other chart types; a type outside the chosen family is left out. Unset when they haven't stated one; unset changes nothing."),name_filter:C.string().optional().describe("Show only chart types matching this text (the same matcher the Power BI and Excel chart-type lists use). Three tiers, first non-empty one wins outright: the term starting a WORD in the name ('gan' -> Gantt chart, and NOT Organization chart), then mid-word in the name ('eth' -> Choropleth), then the description. A name match therefore SUPPRESSES description matches. Case- and accent-insensitive and, by default, space- and punctuation-insensitive too ('barchart' and 'bar-chart' find Bar chart; see name_filter_match). Minimum two characters, and it never reorders - the picker's ranking is preserved and the ranks stay as issued. Applied after ranking and before `top`."),name_filter_match:C.enum(["loose","exact"]).optional().describe("How name_filter matches a name. 'loose' (the default) ignores accents, case, spaces and punctuation, so 'barchart' finds Bar chart. 'exact' folds accents and case and collapses repeated spaces, and nothing else: a name typed without its space or hyphen matches nothing. The same setting the Power BI and Excel chart-type lists offer."),order:C.enum(["fit","variety"]).optional().describe("How the list is ordered. 'fit' (the default) = by how well each chart type fits THIS data, nothing else - use it to choose a chart for a question. 'variety' = the picker's selection order, which favors newer and less-common types on purpose - use it when the user wants to explore or be surprised. Both lists hold the same chart types; only the order differs."),top:C.number().optional().describe("Show only the top-N ranked results. Omit for all."),width:C.number().optional().describe("Viewport width px (default 800) \u2014 affects small-viewport / facet-budget gates."),height:C.number().optional().describe("Viewport height px (default 600).")},outputSchema:RE,annotations:{readOnlyHint:!0,openWorldHint:!0}},async e=>{let t=h7(e),a="",r="",n="",i="";if(e.renderer!==void 0)a=e.renderer;else if(e.language)r=e.language;else if(_1())r="javascript",n=" (language: javascript, this server's default - pass language or renderer for another)";else{let b=fl(d7(e.project_dir,Li));b.language?(r=b.language,n=` (auto-detected language: ${b.language} \u2014 ${b.reason})`):i=`Couldn't tell the project's language (${b.reason}), so this is the list across all renderers; pass language: "javascript" or "python", or project_dir, to narrow it.
336
336
  `}let o=await rb({shape:t.shape,totalRows:t.totalRows,leafCardinality:t.index.getLeafCardinality(),dataComplete:bb(e,_1()),geoExtent:t.index.getGeoExtent(),width:e.width,height:e.height,renderer:a,language:r,levelOfDetail:e.level_of_detail||void 0,order:e.order??"fit",chartStyle:e.chart_style||void 0,mcpClient:zz()});if(!o.ok)return{isError:!0,content:[{type:"text",text:pl(o)?o.errorMessage:`Could not list eligible charts: ${o.errorMessage}`}]};let s=o.charts.length>0&&o.charts[0].rank!==void 0,l=r?`${r}`:a||"all renderers",u=o.charts,c=u.length,d="all",h=b=>EE({rows:b,order:e.order??"fit",eligibleCount:c,filter:e.name_filter?{text:e.name_filter,tier:d}:null,metering:vr}),p=SU(e.name_filter_match),m=H8(u,e.name_filter,P0,p);u=m.rows,d=m.tier;let g;if(s){e.top&&e.top>0&&(u=u.slice(0,e.top));let b=(e.order??"fit")==="variety"?'ordered for variety (newer and less-common types first; order: "fit" ranks by fit to this data)':'ordered by fit to this data (order: "variety" favors newer and less-common types)';g=`Top ${u.length} chart type(s) for this data in ${l}, ${b} (authoritative \u2014 the server's eligibility engine; ${vr})${n}:`}else g=`${u.length} chart type(s) can render this data \u2014 renderer-agnostic eligibility (authoritative \u2014 the server's eligibility engine; ${vr}):`;if(g=i+g,m.tier!=="all"){let b=m.tier==="desc"?" (no NAME matched; these matched on description)":m.tier==="namePart"?" (matched mid-word in the name)":"";g=`Filtered to "${e.name_filter}"${b}: ${u.length} of ${c} eligible chart type(s). The other ${c-u.length} are eligible and simply do not match the filter.
337
337
  `+g}let f=TE(u);if(u.length===0&&m.tier!=="all"&&c>0){let b=H8(o.refused,e.name_filter,kU,p),N=b.tier==="name"||b.tier==="namePart"?b.rows.filter(W=>W.reason).slice(0,3):[],k=N.length>0?`
338
338
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-mcp",
3
- "version": "0.6.110",
3
+ "version": "0.6.111",
4
4
  "description": "AI Data Components for Power BI, Excel, Fabric Apps and the web, over MCP: bivariate maps, what-if projections and about 90 everyday chart types, with selection and cross-filtering already wired. It profiles your table locally; the code it writes is yours and runs with no license.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "// dependencies": "NONE, deliberately. dist/ bundles every module the server uses, so a runtime dependency installs nothing it needs - it only makes npx fetch that package (and its tree) before the first start. Everything the bundle carries is a devDependency; scripts/verify-package.mjs fails the release if a dependency appears or a shipped file imports anything but Node's built-ins.",
49
49
  "devDependencies": {
50
- "@bicharts/chart-host": "^0.6.110",
51
- "@bicharts/shape-core": "^0.6.110",
50
+ "@bicharts/chart-host": "^0.6.111",
51
+ "@bicharts/shape-core": "^0.6.111",
52
52
  "@modelcontextprotocol/sdk": "^1.32.1",
53
53
  "@types/node": "^26.6.5",
54
54
  "@types/papaparse": "^5.3.14",