@graphysdk/react-renderer 0.0.1-plugins.2 → 0.0.1-plugins.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
pnpm build --filter=@graphysdk/viz-engine --filter=@graphysdk/react-renderer
|
|
2
2
|
pnpm --filter @graphysdk/viz-engine publish --tag plugins --access restricted --no-git-checks
|
|
3
|
-
pnpm --filter @graphysdk/react-renderer publish --tag plugins --access restricted --no-git-checks
|
|
3
|
+
pnpm --filter @graphysdk/react-renderer publish --tag plugins --access restricted --no-git-checks
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
require('./index.css');
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),E=require("clsx"),g=require("react"),ee=require("zustand"),b=require("@graphysdk/viz-engine"),a=require("./tooltip-body-B4Mj-oru.cjs"),dr=require("motion/react"),_=require("zustand/react/shallow"),w=require("@floating-ui/react-dom"),hr=require("@tiptap/core"),Ke=require("@tiptap/extension-bold"),he=require("@tiptap/extension-document"),Ze=require("@tiptap/extension-hard-break"),Je=require("@tiptap/extension-heading"),Qe=require("@tiptap/extension-italic"),et=require("@tiptap/extension-link"),tt=require("@tiptap/extension-text"),rt=require("@tiptap/extension-text-align"),R=require("@tiptap/extension-text-style"),nt=require("@tiptap/extension-underline"),te=require("@tiptap/extensions"),gr=require("@tiptap/extension-paragraph"),ve=require("@tiptap/react"),S=require("@base-ui/react/toolbar"),B=require("@base-ui/react/tooltip"),xr=require("react-dom"),fr=require("@vanilla-extract/dynamic"),k=require("@base-ui/react/popover"),we=require("react-colorful"),A=require("@base-ui/react/menu"),pr=require("@base-ui/react/toggle"),mr=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-plugins.2");var vr="drqe3u0",yr="drqe3u1",br="drqe3u2",jr="drqe3u3",K="drqe3u4",Tr="drqe3u5",Cr="drqe3u6",Sr="drqe3u7",ie="drqe3u8",kr="drqe3u9",wr="drqe3ua",Ar="drqe3ub",Er="drqe3uc",_r="drqe3ud",Lr="drqe3ue",Fr="drqe3uf",Nr="drqe3ug",Pr="drqe3uh",Mr="drqe3ui",Ae={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},Ee={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},st={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const Or=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=a.useGraphContext(),[o]=g.useState(()=>a.createDevToolsStore()),[i,c]=g.useState(!1),[l,u]=g.useState(b.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:m}=o.getState(),p=s.getLastTrigger(),y=s.getLastCompile();return p&&y&&m(p,y),s.subscribe(m)},[o,s]);const d=ee.useStore(o,m=>m.lastCompile),h=ee.useStore(o,m=>m.history),f=s.getCacheStats(),x=d===null&&h.length===0,v=()=>{u(m=>{const p=!m;return b.setCompilerCachingEnabled(p),p})};return n.jsxs("div",{className:E(wr,r),style:{width:e,...t},children:[n.jsxs("div",{className:vr,children:[n.jsxs("div",{children:[n.jsx("div",{className:yr,children:"compile cache"}),n.jsx("div",{className:Lr,children:x?"production: stats disabled":d?`last: ${d.label} · ${ot(d.durationMs)}`:"awaiting first compile…"})]}),n.jsx("button",{type:"button",onClick:()=>c(m=>!m),className:Fr,children:i?"▾":"▴"})]}),!i&&n.jsxs("div",{className:Ar,children:[n.jsxs("button",{type:"button",onClick:v,className:l?Ae.enabled:Ae.disabled,"aria-pressed":l,children:["cache ",l?"enabled":"disabled"]}),n.jsx("span",{className:Nr,children:"next compile reflects this toggle"})]}),!i&&!x&&n.jsxs(n.Fragment,{children:[n.jsx(Dr,{delta:d?.stages,cumulative:f}),n.jsx(Ir,{entries:h})]})]})},Dr=({delta:e,cumulative:t})=>n.jsxs("table",{className:br,children:[n.jsx("thead",{children:n.jsxs("tr",{className:Pr,children:[n.jsx("th",{className:jr,children:"stage"}),n.jsx("th",{className:K,children:"Δ miss"}),n.jsx("th",{className:K,children:"Δ hit"}),n.jsx("th",{className:K,children:"total miss"}),n.jsx("th",{className:K,children:"total hit"})]})}),n.jsx("tbody",{children:b.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Br(s);return n.jsxs("tr",{className:Er,children:[n.jsxs("td",{className:Tr,children:[n.jsx("span",{className:st[o],"aria-hidden":!0})," ",r]}),n.jsx("td",{className:o==="ran"?Ee.ran:Ee.dim,children:s?.misses??0}),n.jsx("td",{className:ie,children:s?.hits??0}),n.jsx("td",{className:ie,children:t[r].misses}),n.jsx("td",{className:ie,children:t[r].hits})]},r)})})]}),Ir=({entries:e})=>e.length===0?null:n.jsxs("div",{className:_r,children:[n.jsx("div",{className:Mr,children:"recent compiles"}),e.map(t=>{const r=Rr(t.stages,i=>i.misses>0),s=b.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return n.jsxs("div",{className:Cr,children:[n.jsx("span",{className:st[o],"aria-hidden":!0}),n.jsx("span",{className:Sr,title:t.label,children:t.label}),n.jsxs("span",{className:kr,children:[r,"/",s," ran · ",ot(t.durationMs)]})]},t.id)})]}),Br=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Rr=(e,t)=>{let r=0;for(const s of b.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},ot=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Hr={small:1.9,medium:2.3,large:2.6},Gr={small:1,medium:1,large:1.2},$r=a.DEFAULT_FONT_FAMILY,at=a.FONT_LINE_HEIGHT.sm,zr=12,qr=4,Vr=4,Wr=12,Yr=4,Ur=2,it=24;function W(e){const{store:t}=a.useHoverContext();return ee.useStore(t,e)}const Xr=e=>{const{cursorRef:t,subscribeCursorMove:r}=a.useHoverContext(),s=W(i=>i.isPointerInside),o=g.useRef(e);return o.current=e,g.useEffect(()=>r(()=>o.current?.()),[r]),{cursorRef:t,isInside:s}},Kr=16,Zr=8,Jr={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},Qr=()=>{const e=a.useCompiledSelector(_.useShallow(j=>({layers:j.layers,coordSystem:j.coordSystem,scales:j.scales,guides:j.guides,numberFormat:j.config.numberFormat,parsingLocale:j.config.parsingLocale}))),{formattingLocale:t}=a.useGraphContext(),r=W(j=>j.hover),s=a.useResolveGeomPlugin(),o=g.useRef(()=>{}),{cursorRef:i,isInside:c}=Xr(()=>o.current()),l=g.useMemo(()=>b.buildTooltipContent({...e,hover:r,formattingLocale:t}),[e,r,t]),u=l!==null&&c,d=g.useMemo(()=>({getBoundingClientRect:()=>{const j=i.current;return j===null?Jr:en(j)}}),[i]),{refs:h,floatingStyles:f,update:x}=w.useFloating({open:u,placement:"right",middleware:[w.offset(Kr),w.flip(),w.shift({padding:Zr})],elements:{reference:d}});if(o.current=x,!u)return null;const v=r.primary,m=v===null?null:e.layers.find(j=>j.id===v.layerId)??null,p=m===null?null:s(m,e.coordSystem),y=v!==null&&m!==null&&p?.renderTooltip?p.renderTooltip({content:l,layer:m,coordSystem:e.coordSystem,primary:v,group:r.group,related:r.related}):null;return n.jsx("div",{ref:h.setFloating,role:"tooltip",className:a.root,style:f,"data-testid":"chart-tooltip",children:y??n.jsx(a.TooltipBody,{content:l})})},en=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),ye=a.FONT_SIZE_EM.sm,lt=a.DEFAULT_FONT_FAMILY,ct=!1,Z=6,P=10,tn=(e,t)=>r=>{if(!r.isVisible||r.ticks.length===0)return 0;const s=r.position==="top"||r.position==="bottom",o=r.ticks.map(l=>e.measureText(l.formattedLabel,{family:lt,size:a.emToPx(ye,t)})),i=r.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(s){if(r.labelRotation!==0){const l=o.map(d=>d.width);return _e(l,i)+2*P}return Math.max(...o.map(l=>l.height))+P}return _e(o.map(l=>l.width),i)+P},_e=(e,t)=>Math.min(Math.max(...e),t),rn=e=>()=>a.emToPx(ye,e),nn=(e,t)=>(r,s)=>{const{labelLineHeight:o,labelFontWeight:i}=b.getDifferenceArrowDimensions(s,t);return e.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:o,weight:i})},ut=e=>{const{value:t,observationLabel:r,comparison:s,swatch:o,label:i}=e;return[{role:"valueRow",gap:Vr,segments:le([J("value","value",t??"–"),J("observation","label",r)])},{role:"trendRow",gap:Yr,ariaLabel:s===null?void 0:ln(s),segments:le([on(s),an(s),J("trendReference","label",s?.reference??null)])},{role:"groupRow",gap:qr,segments:le([sn(o),J("label","label",i)])}].filter(l=>l.segments.length>0)},J=(e,t,r)=>r===null?null:{kind:"text",textRole:e,fontRole:t,text:r},sn=e=>e===null?null:{kind:"swatch",swatch:e,size:zr},on=e=>e===null?null:{kind:"trendArrow",direction:e.direction,size:Wr},an=e=>e===null?null:{kind:"text",textRole:"trendPercentage",fontRole:"label",text:e.percentage,trendDirection:e.direction},ln=e=>{switch(e.direction){case"up":return`Increased ${e.percentage} ${e.reference}`;case"down":return`Decreased ${e.percentage} ${e.reference}`;case"flat":return`No change ${e.reference}`}},le=e=>e.filter(t=>t!==null),cn=(e,t)=>(r,s)=>{const o=dt(r,s,e,t),i=ht(o.map(l=>l.width)),c=Math.max(0,o.length-1)*it;return{width:i+c,height:Math.max(0,...o.map(l=>l.height))}},un=(e,t)=>(r,s)=>dt(r,s,e,t).map(o=>o.width),dn=(e,t)=>(r,s)=>{const o=ge("value",s,t);return{width:e.measureText(r,o).width,height:o.size*at}},hn=(e,t)=>{const r=cn(e,t),s=dn(e,t);return(o,i)=>o.kind==="perGroup"?r(o,i):s(o.value,i)},dt=(e,t,r,s)=>{const o={value:ge("value",t,s),label:ge("label",t,s)},i=c=>gn(c,o,r);return e.items.map(c=>{const l=ut(c).map(i),u=Math.max(0,l.length-1)*Ur;return{width:Math.max(0,...l.map(d=>d.width)),height:ht(l.map(d=>d.height))+u}})},gn=(e,t,r)=>{let s=0,o=0;for(const i of e.segments)if(i.kind==="text"){const c=t[i.fontRole];s+=r.measureText(i.text,c).width,o=Math.max(o,c.size*at)}else s+=i.size,o=Math.max(o,i.size);return{width:s+Math.max(0,e.segments.length-1)*e.gap,height:o}},ge=(e,t,r)=>{const s=e==="value"?Hr[t]:Gr[t];return{family:$r,size:a.emToPx(s,r)}},ht=e=>e.reduce((t,r)=>t+r,0),be=12,gt=10,xt=8,xn=8,fn=8,pn=2,ft=1,pt=2,mt=4,vt=a.FONT_SIZE_EM.sm,yt=a.FONT_LINE_HEIGHT.sm,bt=a.DEFAULT_FONT_FAMILY,jt=2*(fn+ft),je=2*(pn+ft),mn=pt*mt,Tt=e=>{const t=a.emToPx(vt,e);return{fontSizePx:t,lineBoxHeight:t*yt}},Ct=e=>e?gt:0,vn=(e,t)=>r=>{if(r.items.length===0)return 0;const{fontSizePx:s,lineBoxHeight:o}=Tt(t),i={family:bt,size:s};if(r.position==="top"||r.position==="bottom")return Math.max(o,be)+je;const l=r.items.map(u=>{const d=e.measureText(u.formattedLabel,i).width,h=Ct(u.visual.color);return h+(h>0?xt:0)+d});return Math.max(...l)+jt},yn=(e,t)=>r=>e.measureText(r,{family:lt,size:a.emToPx(ye,t)}),bn=(e,t)=>g.useMemo(()=>e?{measureAxis:tn(e,t),measureAxisLabel:rn(t),measureLegend:vn(e,t),measureHeadline:hn(e,t),measureHeadlineItemWidths:un(e,t),measureTickLabel:yn(e,t),measureDifferenceArrowLabel:nn(e,t)}:null,[e,t]),jn=({measurer:e,axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f})=>g.useMemo(()=>e?new b.LayoutCompiler(e).compile({axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f}):null,[t,r,s,o,i,c,l,u,d,h,f,e]),Le="data-variant",St=gr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(Le)??null,renderHTML:e=>e.variant?{[Le]:e.variant}:{}}}}}),Tn=hr.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:r}=t;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),Cn=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:r,isSubtitleVisible:s})=>[kn({isTitleVisible:r,isSubtitleVisible:s}),St,tt.Text,te.UndoRedo,Je.Heading.configure({levels:[1,2,3]}),Ke.Bold,Qe.Italic,nt.Underline,rt.TextAlign.configure({types:["heading","paragraph"]}),et.Link.configure({openOnClick:!1,autolink:!0}),R.TextStyle,R.Color,R.FontFamily,Ze.HardBreak,Tn.configure({isTitleVisible:r}),te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const c=r?i.state.doc.firstChild?.nodeSize??-1:0;return s&&o===c?t:""}})],Sn=({placeholder:e})=>[he.Document,St,tt.Text,te.UndoRedo,Je.Heading.configure({levels:[1,2,3]}),Ke.Bold,Qe.Italic,nt.Underline,rt.TextAlign.configure({types:["heading","paragraph"]}),et.Link.configure({openOnClick:!1,autolink:!0}),R.TextStyle,R.Color,R.FontFamily,Ze.HardBreak,te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],kn=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?he.Document.extend({content:"block{2,}"}):he.Document,T=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,se=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,kt=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,xe=(e,t,r)=>`color-mix(in srgb, ${e}, ${t} ${r*100}%)`,wn=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),An=e=>e.length===0?!1:typeof CSS<"u"&&typeof CSS.supports=="function"?CSS.supports("color",e):/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),wt={elevationXs:"0 0 2px rgba(15, 15, 24, 0.12), 0 2px 2px rgba(14, 14, 52, 0.08)",elevationSm:"0 0 4px rgba(15, 15, 24, 0.12), 0 4px 4px rgba(14, 14, 52, 0.08)",elevationMd:"0 0 8px rgba(15, 15, 24, 0.12), 0 8px 8px rgba(14, 14, 52, 0.08)",elevationLg:"0 0 16px rgba(15, 15, 24, 0.12), 0 16px 16px rgba(14, 14, 52, 0.08)"},At={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},Et={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},En=8,I=e=>`${En*e}px`,_t={spaceXxs:I(.25),spaceXs:I(.5),spaceSm:I(.75),spaceMd:I(1),spaceLg:I(1.5),spaceXl:I(2)},_n={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#000000",grey95:"#0D0D0D",grey90:"#1A1A1A",grey85:"#1F1F1F",grey80:"#2A2A2A",grey75:"#2e2e2e",grey70:"#353535",grey60:"#494949",grey50:"#6F6F6F",grey0:"#FFFFFF",red60:"#CB3333",red50:"#F93939",amber70:"#F48135",amber50:"#FEAE47",amber40:"#FFC849",amber30:"#ffd061",green60:"#0AC600",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #222429, #31353f)"},Ln={textPrimary:a.vars.grey0,textSecondary:T(a.vars.textPrimary,.8),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey70,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,sunkenBackground:a.vars.grey100,defaultBackground:a.vars.grey90,raisedBackground:a.vars.grey80,overlayBackground:a.vars.grey90,overlayBorderGradient:a.vars.greyGradient80},Fn={graphBackground:a.vars.grey90,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:a.vars.border100,targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.grey70,tooltipBorderColor:a.vars.grey60,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey60,hoverGuideLineColor:T(a.vars.white,.08),hoverGuideFillColor:T(a.vars.white,.06),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.white,defaultAnnotationShapeStroke:a.vars.white,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:a.vars.white},Nn={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},Pn={..._n,...Ln,...wt,...At,..._t,...Et,...Fn,...Nn,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},Mn={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#FFFFFF",grey95:"#FCFCFC",grey90:"#FAFAFA",grey85:"#F5F5F5",grey80:"#F0F0F0",grey75:"#E8E8E8",grey70:"#E5E5E5",grey60:"#CCCCCC",grey50:"#C4C4C4",grey0:"#1D2129",red60:"#E14B49",red50:"#F93939",amber70:"#FFBA8C",amber50:"#FFC849",amber40:"#FEAE47",amber30:"#E7A816",green60:"#06B299",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #F0F0F1, #F9F9FF)"},On={textPrimary:a.vars.black,textSecondary:T(a.vars.textPrimary,.6),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey100,brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),sunkenBackground:a.vars.grey90,defaultBackground:a.vars.grey100,raisedBackground:a.vars.grey85,overlayBackground:a.vars.grey100,overlayBorderGradient:a.vars.border10},Dn={graphBackground:a.vars.grey100,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.white,tooltipBorderColor:a.vars.border10,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey80,hoverGuideLineColor:T(a.vars.black,.08),hoverGuideFillColor:T(a.vars.black,.04),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.black,defaultAnnotationShapeStroke:a.vars.black,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:"#3d414c"},In={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},Bn={...Mn,...On,...wt,...At,..._t,...Et,...Dn,...In,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},re=.1,Rn={light:.05,dark:.1},Hn=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return zn(e.color,t);case"gradient":return qn(e.color,t);case"preset":return b.BORDER_PRESET_GRADIENTS[e.preset]}},Gn=e=>e.type==="none"?0:e.width,$n=(e,t,r)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return xe(r,e.color,Rn[t])},zn=(e,t)=>t==="dark"?se(e,re):kt(e,re),qn=(e,t,r=90)=>{const s=e,o=t==="dark"?se(e,re):kt(e,re);return`linear-gradient(${r}deg, ${s} 0%, ${o} 100%)`};var Vn="bow4tg0",Wn="bow4tg1",Yn="bow4tg2",Un="bow4tg3",Lt="_1ii3bsb0",Ft="_1ii3bsb1";const Te=g.createContext(null),Ce=()=>{const e=g.useContext(Te);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},Nt=({theme:e,themeOverrides:t={},appearance:r,children:s})=>{const o=g.useMemo(()=>({...e==="dark"?Pn:Bn,...t}),[e,t]),i=g.useMemo(()=>{const l={[a.vars.textScale]:String(r.textScale)};for(const[d,h]of Object.entries(t))l[a.vars[d]]=h;const u=$n(r.background,e,o.graphBackground);return u!==void 0&&(l[a.vars.graphBackground]=u),fr.assignInlineVars(l)},[r.textScale,r.background,e,o.graphBackground,t]),c=g.useMemo(()=>({theme:e,themeClass:e==="dark"?Ft:Lt,inlineVarsStyle:i,themeValues:o}),[e,i,o]);return n.jsx(Te.Provider,{value:c,children:s})},O=({children:e,className:t,style:r})=>{const s=g.useContext(Te),o=s?E(s.themeClass,Wn):void 0,i=s?{...s.inlineVarsStyle,...r}:r;return n.jsx("div",{className:E(o,t),style:i,children:e})},Xn="graphy_root",D=()=>typeof document>"u"?null:document.getElementById(Xn)??document.body;var Kn="yp3g0k0",Zn="yp3g0k1",Pt="yp3g0k3",Jn="yp3g0k4",Mt="yp3g0k5",fe="yp3g0k6",Qn="yp3g0k7",es="yp3g0k8",Ot="yp3g0k9",ts="yp3g0ka",rs="yp3g0kb",ns="yp3g0kc",ss="yp3g0kd",os="yp3g0ke";const as=a.CANVAS_COLOR_KEYS.map(e=>a.vars[e]),is=Object.fromEntries(a.CANVAS_COLOR_KEYS.map(e=>[a.vars[e],e])),ls=({editor:e,currentColor:t,isOpen:r,onOpenChange:s})=>{const o=us(),i=g.useCallback(l=>{e.chain().setColor(l).run()},[e]),c=l=>{e.chain().focus().setColor(l).run(),s(!1)};return n.jsxs(k.Popover.Root,{open:r,onOpenChange:s,children:[n.jsx(k.Popover.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Text color",className:Kn,onMouseDown:l=>l.preventDefault(),children:n.jsx("span",{className:Zn,style:{background:t??"transparent"}})}),n.jsx(k.Popover.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(k.Popover.Positioner,{sideOffset:6,align:"start",className:Pt,children:n.jsxs(k.Popover.Popup,{className:Jn,onMouseDown:l=>l.preventDefault(),children:[n.jsx(Fe,{title:"Colors",colors:as,currentColor:t,onPick:c}),o.length>0&&n.jsx(Fe,{title:"Chart colors",colors:o,currentColor:t,onPick:c}),n.jsx(cs,{value:t??"#000000",onChange:i})]})})})})]})},Fe=({title:e,colors:t,currentColor:r,onPick:s})=>n.jsxs("div",{className:Mt,children:[n.jsx("div",{className:fe,children:e}),n.jsx("div",{className:Qn,children:t.map(o=>n.jsx("button",{type:"button","aria-label":o,className:es,"data-active":hs(o,r),onMouseDown:i=>i.preventDefault(),onClick:()=>s(o),children:n.jsx("span",{className:Ot,style:Dt(o)})},o))})]}),cs=({value:e,onChange:t})=>{const[r,s]=g.useState(!1),o=An(e)?e:"#000000",i=ds(o);return n.jsxs(k.Popover.Root,{open:r,onOpenChange:s,children:[n.jsxs("div",{className:Mt,children:[n.jsx("div",{className:fe,children:"Custom"}),n.jsxs(k.Popover.Trigger,{className:ts,onMouseDown:c=>c.preventDefault(),"aria-label":"Pick custom color",children:[n.jsx("span",{className:Ot,style:Dt(o)}),n.jsx("span",{className:rs,children:i})]})]}),n.jsx(k.Popover.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(k.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:Pt,children:n.jsxs(k.Popover.Popup,{className:ns,onMouseDown:c=>c.preventDefault(),children:[n.jsx("div",{className:fe,children:"Pick color"}),n.jsx(we.HexColorPicker,{color:i,onChange:t,className:ss}),n.jsx(we.HexColorInput,{color:i,onChange:t,prefixed:!0,className:os,onMouseDown:c=>c.stopPropagation()})]})})})})]})},us=()=>{const e=a.useCompiledSelector(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const r of e.domain){const s=e.map(r);typeof s=="string"&&t.add(s)}return[...t]},[e])},Dt=e=>({background:e,border:`1px solid ${se(e,.1)}`}),ds=e=>{const{themeValues:t}=Ce();if(wn(e))return e.toUpperCase();const r=is[e];return r?t[r].toUpperCase():"#000000"},hs=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),gs={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var xs={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const N=({children:e,title:t,variant:r="primary",size:s="sm",...o})=>{const i=g.useId(),c=gs[s];return n.jsxs("svg",{className:xs[r],"aria-labelledby":t?i:void 0,height:c,width:c,fill:"none",viewBox:"0 0 24 24",role:"img",...o,children:[t&&n.jsx("title",{id:i,children:t}),e]})},It=e=>n.jsx(N,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"m6 9 6 6 6-6"})})}),fs="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Bt=`'Aeonik', 'Aeonik Fallback', ${a.DEFAULT_FONT_FAMILY}`,ps="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",ms="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",vs=`var(--brand-font-family), ${Bt}`,pe=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:a.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Bt},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:fs},{id:"technical",label:"Technical",preview:"00",fontFamily:ps},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:ms},{id:"brand",label:"Brand",preview:"Aa",fontFamily:vs}],ys=e=>e?pe.find(t=>t.fontFamily===e)??null:null;var Rt="_1qkyw7q0",Ht="_1qkyw7q1",Gt="_1qkyw7q3",$t="_1qkyw7q4",zt="_1qkyw7q5";const bs=({editor:e,currentFontFamily:t,isOpen:r,onOpenChange:s})=>{const o=ys(t)??pe[0],i=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return n.jsxs(A.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(A.Menu.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Font family",className:Rt,onMouseDown:c=>c.preventDefault(),children:[n.jsx("span",{className:Ht,style:{fontFamily:o?.fontFamily},children:o?.preview}),n.jsx(It,{size:"sm"})]}),n.jsx(A.Menu.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(A.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Gt,children:n.jsx(A.Menu.Popup,{className:$t,onMouseDown:c=>c.preventDefault(),children:pe.map(c=>n.jsx(A.Menu.Item,{className:zt,"data-selected":c.id===o?.id,onClick:()=>i(c),children:n.jsx("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},qt={id:"text",label:"Text",previewFont:a.vars.fontTextEditorBody},Ne=[{id:"caption",label:"Caption",previewFont:a.vars.fontTextEditorH6},qt,{id:"h3",label:"Heading 3",previewFont:a.vars.fontTextEditorH3},{id:"h2",label:"Heading 2",previewFont:a.vars.fontTextEditorH2},{id:"h1",label:"Heading 1",previewFont:a.vars.fontTextEditorH1}],js=({editor:e,activeStyle:t,isOpen:r,onOpenChange:s})=>{const o=Ne.find(i=>i.id===t)??qt;return n.jsxs(A.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(A.Menu.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Text style",className:Rt,onMouseDown:i=>i.preventDefault(),children:[n.jsx("span",{className:Ht,children:o.label}),n.jsx(It,{size:"sm"})]}),n.jsx(A.Menu.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(A.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Gt,children:n.jsx(A.Menu.Popup,{className:$t,onMouseDown:i=>i.preventDefault(),children:Ne.map(i=>n.jsx(A.Menu.Item,{className:zt,"data-selected":i.id===o.id,onClick:()=>Ts(e,i.id),children:n.jsx(Cs,{font:i.previewFont,children:i.label})},i.id))})})})})]})},Ts=(e,t)=>{switch(t){case"caption":{e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return}case"text":{e.chain().focus().setNode("paragraph",{variant:null}).run();return}case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},Cs=({font:e,children:t})=>n.jsx("span",{style:{font:e,margin:0},children:t}),Ss=e=>n.jsx(N,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M20 6 9 17l-5-5"})})}),ks=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),ws=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 6 6 18"}),n.jsx("path",{d:"m6 6 12 12"})]})}),As=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),Es=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,s=t.parentOffset,o=t.start();let i=s;for(;i>0&&Pe(r[i-1]);)i-=1;let c=s;for(;c<r.length&&Pe(r[c]);)c+=1;return{from:o+i,to:o+c}},Pe=e=>e!==void 0&&/\S/.test(e);var _s="b5kquu0",Ls="b5kquu1",Fs="b5kquu2",Ns="b5kquu3",Me="b5kquu4";const Ps=({editor:e,currentUrl:t,isActive:r,isOpen:s,onOpenChange:o})=>{const[i,c]=g.useState(""),l=g.useRef(null);g.useEffect(()=>{s&&c(t??"")},[s,t]);const u=()=>{Ms(e,i),o(!1)},d=()=>{c(""),o(!1)},h=x=>{c(x.target.value)},f=x=>{x.key==="Enter"&&(x.preventDefault(),u())};return n.jsxs(k.Popover.Root,{open:s,onOpenChange:o,children:[n.jsx(k.Popover.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Link","data-active":r,className:_s,onMouseDown:x=>x.preventDefault(),children:n.jsx(ks,{})}),n.jsx(k.Popover.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(k.Popover.Positioner,{sideOffset:6,align:"end",className:Ls,children:n.jsxs(k.Popover.Popup,{className:Fs,initialFocus:l,onMouseDown:x=>x.preventDefault(),children:[n.jsx("input",{ref:l,type:"url",value:i,placeholder:"Type or paste a link...","aria-label":"Link URL",className:Ns,onMouseDown:x=>x.stopPropagation(),onChange:h,onKeyDown:f}),n.jsx("button",{type:"button","aria-label":"Cancel",className:Me,onClick:d,children:n.jsx(ws,{})}),n.jsx("button",{type:"button","aria-label":"Apply link",className:Me,onClick:u,children:n.jsx(Ss,{})})]})})})})]})},Ms=(e,t)=>{const r=t.trim(),{selection:s}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!s.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=Es(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Os=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M17 12H7"}),n.jsx("path",{d:"M19 19H5"})]})}),Ds=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M21 12H9"}),n.jsx("path",{d:"M21 19H7"})]})}),Is=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M15 12H3"}),n.jsx("path",{d:"M17 19H3"})]})});var Bs="k91gos0",Rs="k91gos1";const Hs=6,H=({label:e,isActive:t,onToggle:r,children:s})=>{const o=i=>i.preventDefault();return n.jsxs(B.Tooltip.Root,{children:[n.jsx(B.Tooltip.Trigger,{render:n.jsx(pr.Toggle,{render:n.jsx(S.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:Bs,onMouseDown:o,children:s}),n.jsx(B.Tooltip.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(B.Tooltip.Positioner,{sideOffset:Hs,children:n.jsx(B.Tooltip.Popup,{className:Rs,children:e})})})})]})},Gs=({editor:e,activeAlignment:t="left"})=>n.jsxs(n.Fragment,{children:[n.jsx(H,{label:"Align left",isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:n.jsx(Is,{})}),n.jsx(H,{label:"Align center",isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:n.jsx(Os,{})}),n.jsx(H,{label:"Align right",isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:n.jsx(Ds,{})})]});var $s="_1bp10ig0",V="_1bp10ig1",Q="_1bp10ig2";const zs=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:qs(e),textAlign:Vs(e)}),qs=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",Vs=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",Ws=8,Ys=8,Us=({editor:e})=>{const[t,r]=g.useState(!1),[s,o]=g.useState(null),i=s!==null,c=v=>m=>{o(m?v:null)},{refs:l,floatingStyles:u}=w.useFloating({placement:"top-start",strategy:"fixed",middleware:[w.offset(Ws),w.flip(),w.shift({padding:Ys})],whileElementsMounted:w.autoUpdate}),d=g.useRef(null),h=ve.useEditorState({editor:e,selector:zs}),f=g.useCallback(v=>{d.current=v,l.setFloating(v)},[l]);if(g.useEffect(()=>{e&&l.setReference(e.view.dom)},[e,l]),g.useEffect(()=>{if(!e)return;const v=()=>r(!0),m=({event:p})=>{const{relatedTarget:y,currentTarget:j}=p,C=y instanceof Node&&d.current?.contains(y),L=y instanceof Node&&j instanceof Node&&j.contains(y);!C&&!L&&r(!1)};return e.on("focus",v),e.on("blur",m),()=>{e.off("focus",v),e.off("blur",m)}},[e]),!e||!t&&!i)return null;const x=D();return x?xr.createPortal(n.jsx(O,{children:n.jsx(B.Tooltip.Provider,{children:n.jsxs(S.Toolbar.Root,{ref:f,className:$s,style:u,children:[n.jsxs(S.Toolbar.Group,{className:V,children:[n.jsx(ls,{editor:e,currentColor:h?.color??null,isOpen:s==="color",onOpenChange:c("color")}),n.jsx(bs,{editor:e,currentFontFamily:h?.fontFamily??null,isOpen:s==="fontFamily",onOpenChange:c("fontFamily")})]}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsx(S.Toolbar.Group,{className:V,children:n.jsx(js,{editor:e,activeStyle:h?.fontSize??"text",isOpen:s==="fontSize",onOpenChange:c("fontSize")})}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsxs(S.Toolbar.Group,{className:V,children:[n.jsx(H,{label:"Bold",isActive:h?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:n.jsx("strong",{children:"B"})}),n.jsx(H,{label:"Italic",isActive:h?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:n.jsx("em",{children:"I"})}),n.jsx(H,{label:"Underline",isActive:h?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:n.jsx("u",{children:"U"})})]}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsx(S.Toolbar.Group,{className:V,children:n.jsx(Gs,{editor:e,activeAlignment:h?.textAlign})}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsx(S.Toolbar.Group,{className:V,children:n.jsx(Ps,{editor:e,currentUrl:h?.linkUrl??null,isActive:h?.isLink??!1,isOpen:s==="link",onOpenChange:c("link")})})]})})}),x):null};var Xs="_2ngohc0";const Vt=({editor:e,ariaLabel:t})=>n.jsxs("div",{className:Xs,children:[n.jsx(Us,{editor:e}),n.jsx(ve.EditorContent,{editor:e,"aria-label":t})]}),Ks=(e,t)=>{const r=g.useRef(e);r.current=e;const s=g.useRef(t);s.current=t;const o=g.useRef(null),i=g.useRef(null),c=g.useMemo(()=>{const l=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null),o.current=null},u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null);const h=o.current;h!==null&&(o.current=null,r.current(...h))};return{run:(...h)=>{if(s.current<=0){r.current(...h);return}o.current=h,i.current!==null&&clearTimeout(i.current),i.current=setTimeout(u,s.current)},flush:u,cancel:l}},[]);return g.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]),c},Zs=200,Wt=({content:e,extensions:t,isEditable:r,onUpdate:s,updateDebounceMs:o=Zs})=>{const i=g.useRef(Oe(e)),c=g.useRef(!1),l=Ks(d=>{c.current=!0,s?.(d)},o),u=ve.useEditor({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:d})=>l.run(d.getJSON())});return g.useEffect(()=>{u?.setEditable(r)},[u,r]),g.useEffect(()=>{if(!u)return;if(c.current){c.current=!1;return}const d=Oe(e),h=u.getJSON();Js(h,d)||(l.cancel(),u.commands.setContent(d,{emitUpdate:!1}))},[u,e,l]),g.useEffect(()=>()=>l.flush(),[l]),u},Oe=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Js=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Qs=/^(?:https?:|mailto:)/i,Yt=e=>{if(typeof e!="string")return!1;const t=e.replace(/^[\x00-\x20]+/,"");return t.length===0?!1:Qs.test(t)};var eo="_1cocly40";const to={modern:"'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",timeless:"'Noto Serif', Georgia, 'Times New Roman', serif",fresh:"'Aeonik', 'Aeonik Fallback', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif",technical:"'PT Mono', 'Courier New', monospace",handwritten:"'Permanent Marker', cursive",fineliner:"'Intruding Cat', cursive",brand:"var(--brand-font-family), 'Aeonik', 'Inter', sans-serif"},ne=({content:e})=>n.jsx(n.Fragment,{children:Ut(e.content??[e])}),Ut=e=>e.map((t,r)=>ro(t,r)),ro=(e,t)=>{if(e.type==="text")return no(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return n.jsx("br",{},t);const r=e.content?Ut(e.content):null;switch(e.type){case"doc":return n.jsx(g.Fragment,{children:r},t);case"heading":{const s=io(e.attrs?.level);return lo(s,t,r,Ie(e.attrs))}case"paragraph":{const s=G(e.attrs?.variant);return n.jsx("p",{"data-variant":s??void 0,style:Xt(Ie(e.attrs)),children:r},t)}case"blockquote":return n.jsx("blockquote",{children:r},t);case"bulletList":case"bullet_list":return n.jsx("ul",{children:r},t);case"orderedList":case"ordered_list":return n.jsx("ol",{children:r},t);case"listItem":case"list_item":return n.jsx("li",{children:r},t);default:return n.jsx("span",{children:r},t)}},no=(e,t)=>{const r=e.text??"";return!e.marks||e.marks.length===0?n.jsx("span",{children:r},t):e.marks.reduceRight((s,o,i)=>so(o,s,`${t}-${i}`),r)},so=(e,t,r)=>{switch(e.type){case"bold":case"strong":return n.jsx("strong",{children:t},r);case"italic":case"em":return n.jsx("em",{children:t},r);case"underline":return n.jsx("u",{children:t},r);case"strike":case"strikethrough":case"s":return n.jsx("s",{children:t},r);case"code":return n.jsx("code",{children:t},r);case"link":{const s=G(e.attrs?.href);return Yt(s)?n.jsx("a",{className:eo,href:s,rel:"noopener noreferrer",target:"_blank",children:t},r):n.jsx("span",{children:t},r)}case"textStyle":{const s=oo(e.attrs);return s?n.jsx("span",{style:s,children:t},r):n.jsx("span",{children:t},r)}default:return n.jsx("span",{children:t},r)}},De=e=>{const t=G(e&&typeof e=="object"?e.fontFamily:e);if(t)return to[t]??t},oo=e=>{if(!e)return null;const t={},r=G(e.color);r&&(t.color=r);const s=De(e.font)??De(e.fontFamily);s&&(t.fontFamily=s);const o=ao(e.fontSize);return o&&(t.fontSize=o),Object.keys(t).length>0?t:null},ao=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:G(e),G=e=>typeof e=="string"&&e.length>0?e:void 0,io=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),lo=(e,t,r,s)=>{const o=Xt(s);switch(e){case 1:return n.jsx("h1",{style:o,children:r},t);case 2:return n.jsx("h2",{style:o,children:r},t);case 3:return n.jsx("h3",{style:o,children:r},t)}},Ie=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},Xt=e=>e?{textAlign:e}:void 0;var co="_4dlrid0",Kt="_4dlrid1",uo="xfz7dq0",ho="xfz7dq1",go="xfz7dq2",xo="xfz7dq3",fo="xfz7dq4";const po=({ref:e,footerRect:t,mode:r="readonly"})=>{const{caption:s,isCaptionVisible:o,source:i,isSourceVisible:c}=a.useCompiledSelector(_.useShallow(h=>({caption:h.config.content.caption,isCaptionVisible:h.config.content.isCaptionVisible,source:h.config.content.source,isSourceVisible:h.config.content.isSourceVisible}))),l=r==="editable",u=o&&(l||s!==null),d=c&&i!==null&&bo(i);return!u&&!d?null:n.jsxs("div",{ref:e,className:uo,style:{left:t.x,top:t.y,width:t.width},children:[u?l?n.jsx(jo,{caption:s}):n.jsx(mo,{caption:s}):null,d&&n.jsx(vo,{source:i})]})},mo=({caption:e})=>e===null?null:typeof e=="string"?n.jsx("p",{className:Kt,children:e}):n.jsx(ne,{content:e}),vo=({source:e})=>{const t=Yt(e.url)?e.url:void 0,r=e.label??(t!==void 0?yo(t):"");return r===""&&t===void 0?null:n.jsxs("div",{className:ho,children:[n.jsx("span",{className:xo,children:"Source:"}),t!==void 0?n.jsx("a",{className:go,href:t,target:"_blank",rel:"noopener noreferrer",children:r}):n.jsx("span",{className:fo,children:r})]})},yo=e=>{try{return new URL(e).hostname}catch{return e}},bo=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",jo=({caption:e})=>{const t=a.useGraphCommandDispatcher(),r=g.useMemo(()=>Sn({placeholder:"Add caption"}),[]),s=Wt({content:e,extensions:r,isEditable:!0,onUpdate:o=>{const i=As(o)?null:o;t(new b.SetContentCaptionCommand({caption:i}))}});return n.jsx(Vt,{editor:s,ariaLabel:"Chart caption"})};var To="_1k4qtbg0";const Co=3,So=({title:e,isTitleVisible:t,subtitle:r,isSubtitleVisible:s})=>{const o=[];return t&&o.push({type:"heading",attrs:{level:Co},content:wo(e)}),s&&o.push(...Ao(r)),{type:"doc",content:o}},ko=e=>{const t=e.content??[],[r,...s]=t;return{title:Eo(r?.content??[]),subtitle:_o(s)}},Se=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(Se)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),wo=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],Ao=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(Be):[Be(e)],Be=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Eo=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(Se)}},_o=e=>{const t=e.filter(s=>(s.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const s=r.content??[],[o]=s;if(o&&s.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:t.map(Se)}},Lo=({ref:e,headerRect:t,mode:r="readonly"})=>{const{title:s,isTitleVisible:o,subtitle:i,isSubtitleVisible:c}=a.useCompiledSelector(_.useShallow(h=>({isTitleVisible:h.config.content.isTitleVisible,isSubtitleVisible:h.config.content.isSubtitleVisible,title:h.config.content.title,subtitle:h.config.content.subtitle}))),l=r==="editable";return!(o&&(l||s!==null))&&!(c&&(l||i!==null))?null:n.jsx("div",{ref:e,className:To,style:{left:t.x,top:t.y,width:t.width},children:l?n.jsx(No,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i},[o?"title":"",c?"subtitle":""].join("-")):n.jsx(Fo,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i})})},Fo=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=t&&e!==null,i=r&&s!==null;return n.jsxs(n.Fragment,{children:[o&&(typeof e=="string"?n.jsx("h1",{className:co,children:e}):n.jsx(ne,{content:e})),i&&(typeof s=="string"?n.jsx("p",{className:Kt,children:s}):n.jsx(ne,{content:s}))]})},No=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=a.useGraphCommandDispatcher(),i=g.useMemo(()=>Cn({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:r}),[t,r]),c=g.useMemo(()=>So({title:e,isTitleVisible:t,subtitle:s,isSubtitleVisible:r}),[e,t,s,r]),l=Wt({content:c,extensions:i,isEditable:!0,onUpdate:u=>{const d=ko(u);t&&o(new b.SetContentTitleCommand({title:d.title})),r&&o(new b.SetContentSubtitleCommand({subtitle:d.subtitle}))}});return n.jsx(Vt,{editor:l,ariaLabel:"Chart title and subtitle"})};var Po="_1u9qprb0",Mo="_1u9qprb1",Oo="_9aen060",Do="_9aen061",Io="_9aen062",Zt="_9aen063";const Bo=Object.freeze(Object.defineProperty({__proto__:null,groupRow:Io,item:Zt,trendRow:Do,valueRow:Oo},Symbol.toStringTag,{value:"Module"})),Ro=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"m5 12 7-7 7 7"}),n.jsx("path",{d:"M12 19V5"})]})}),Ho=e=>n.jsx(N,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M5 12h14"})})});var Jt="n7clvo0",Go="n7clvo1",$o="n7clvo2",zo="n7clvo3",Qt={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},qo={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},Vo={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},Wo={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const Yo=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return n.jsx(a.Swatch,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return n.jsx("div",{className:Wo[e.direction],children:e.direction==="flat"?n.jsx(Ho,{size:"xs",title:""}):n.jsx(Ro,{size:"xs",title:""})});const r=e.fontRole==="value"?Qt[t]:qo[t];return n.jsx("span",{className:E.clsx(Uo(e),r),children:e.text})},Uo=e=>{switch(e.textRole){case"value":return Jt;case"observation":return Go;case"trendPercentage":return Vo[e.trendDirection??"up"];case"trendReference":return $o;case"label":return zo}},Xo=({item:e,resolvedSize:t})=>n.jsx("div",{className:Zt,children:ut(e).map(r=>n.jsx(Ko,{row:r,resolvedSize:t},r.role))}),Ko=({row:e,resolvedSize:t})=>{const r=e.role==="trendRow";return n.jsx("div",{className:Bo[e.role],"data-testid":r?"headline-trend":void 0,"data-direction":r?Zo(e):void 0,role:r?"img":void 0,"aria-label":r?e.ariaLabel:void 0,children:e.segments.map((s,o)=>n.jsx(Yo,{segment:s,resolvedSize:t},o))})},Zo=e=>{const t=e.segments.find(r=>r.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},Jo=({headline:e,rect:t,resolvedSize:r,visibleItemCount:s})=>{const o={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?n.jsx("div",{className:Mo,style:o,children:n.jsx("span",{className:E.clsx(Jt,Qt[r]),children:e.value})}):n.jsx("div",{className:Po,style:o,children:e.items.slice(0,s).map((i,c)=>n.jsx(Xo,{item:i,resolvedSize:r},`${i.label}-${c}`))})};var Qo="_1oj6yix0",ea="_1oj6yix1",ta="_1oj6yix2";const ra=8,na=16,sa=2,oa=({legends:e,containerRect:t,textScale:r})=>{const{lineBoxHeight:s}=Tt(r),{placements:o,hasOverlap:i}=aa(e,t,s);if(o.length===0)return null;const c=i?na:ra,l=c-sa;return n.jsxs("div",{className:Qo,children:[i&&n.jsx("svg",{className:ea,width:t.width,height:t.height,children:o.map(u=>n.jsx(ia,{anchorY:u.anchorY,labelY:u.y,endX:l,color:u.payload.color},u.payload.key))}),o.map(u=>n.jsx("span",{className:ta,style:{left:c,top:u.y,color:u.payload.color},children:u.payload.label},u.payload.key))]})},aa=(e,t,r)=>g.useMemo(()=>{const s=[];for(const o of e)for(const i of o.items){if(i.normalizedY===null)continue;const c=typeof i.visual.color=="string"?i.visual.color:void 0;s.push({normalizedY:i.normalizedY,payload:{key:String(s.length),label:i.formattedLabel,color:c}})}return s.length===0||t.height<=0?{placements:[],hasOverlap:!1}:b.computeDirectLabelsLayout({items:s,containerHeight:t.height,labelHeight:r})},[e,t.height,r]),ia=({anchorY:e,labelY:t,endX:r,color:s})=>{const o=r/2;return n.jsx("path",{d:`M0,${e} C${o},${e} ${o},${t} ${r},${t}`,fill:"none",stroke:s??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var la="_6a636s0",ca="_1kjk02r0",ua="_1kjk02r1",da="_1kjk02r2",ha="_1kjk02r3",ga="_1kjk02r4",xa="_1kjk02r5",fa="_1kjk02r6",pa="_1kjk02r7",ma="_1kjk02r8",va="_1kjk02r9",ya="_1kjk02ra",ba="_1kjk02rb",ja="_1dw9dgx0";const Ta="#9ca3af",ce="\0",Ca=e=>{const t=[];return e.forEach((r,s)=>{const o=r.aesthetics.includes("size");for(const i of r.items){if(o){const d=Number(i.visual.size);if(!Number.isFinite(d)||d<=0)continue}const c=i.visual.color??"",l=o?`${ce}${Number(i.visual.size)}`:"",u=i.visual.lineType;t.push({key:`${s}${ce}${String(i.value)}${ce}${c}${l}`,formattedLabel:i.formattedLabel,visual:i.visual,swatchShape:i.swatchShape,isBubble:o,primaryLineType:u})}}),t},er=({pill:e})=>e.isBubble?n.jsx(wa,{pill:e}):n.jsx(ka,{pill:e}),Sa=({color:e,lineType:t,shape:r})=>e?n.jsx(a.Swatch,{shape:r,color:e,lineType:t,width:gt,height:be}):null,ka=({pill:e})=>n.jsxs(n.Fragment,{children:[n.jsx(Sa,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),n.jsx("span",{children:e.formattedLabel})]}),wa=({pill:e})=>{const t=Number(e.visual.size);return n.jsxs(n.Fragment,{children:[n.jsx("span",{className:ja,style:{width:t,height:t,backgroundColor:e.visual.color??Ta}}),n.jsx("span",{children:e.formattedLabel})]})},Aa=({hiddenPills:e,placement:t})=>{const[r,s]=g.useState(!1),{refs:o,floatingStyles:i}=w.useFloating({open:r,placement:t,middleware:[w.offset(4),w.flip(),w.shift({padding:8})]});g.useEffect(()=>{if(!r)return;const d=f=>{const x=f.target;if(!x)return;const v=o.reference.current,m=o.floating.current;v instanceof Element&&v.contains(x)||m instanceof Element&&m.contains(x)||s(!1)},h=f=>{f.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",d),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("keydown",h)}},[r,o.floating,o.reference]);const c=t==="left"||t==="right",l=Math.min(e.length-1,pt),u=Array.from({length:l},(d,h)=>l-h);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{ref:o.setReference,className:E.clsx(ca,{[da]:c,[ua]:!c}),children:[u.map(d=>n.jsx("span",{className:E.clsx(ha,{[xa]:c,[ga]:!c}),style:Ea(d,c),"aria-hidden":!0},d)),n.jsx("button",{type:"button",className:E.clsx(fa,{[pa]:r}),onClick:()=>s(d=>!d),"aria-haspopup":"dialog","aria-expanded":r,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:n.jsxs("span",{className:ma,children:["+",e.length]})})]}),r&&n.jsx("div",{ref:o.setFloating,role:"dialog","aria-label":"Hidden legend items",className:va,style:i,children:n.jsx("ul",{className:ya,children:e.map(d=>n.jsx("li",{className:ba,children:n.jsx(er,{pill:d})},d.key))})})]})},Ea=(e,t)=>{const r=-e*mt;return{transform:t?`translateY(${r}px)`:`translateX(${r}px)`}};var _a="_1cecisi0",La="_1cecisi1",Fa="_1cecisi2",Na="_1cecisi3";const Pa=({edge:e,formattedLegends:t,containerWidth:r,containerHeight:s,textScale:o})=>{const i=a.useTextMeasurer(),c=g.useMemo(()=>Ca(t),[t]),l=e==="left"||e==="right",u=l?s:r,d=g.useMemo(()=>{if(c.length===0)return{visibleCount:0,hasOverflow:!1};if(u<=0)return{visibleCount:c.length,hasOverflow:!1};const v=a.emToPx(vt,o),m={family:bt,size:v},p=v*yt,y=$=>l?Ma($,p):Re({label:$.formattedLabel,swatchInlineSize:Oa($),textMeasurer:i,font:m}),j=c.map(y),L=(l?p+je:Re({label:`+${c.length}`,swatchInlineSize:0,textMeasurer:i,font:m}))+mn;return Ia({pillSizes:j,overflowPillSize:L,containerSize:u,gap:xn})},[c,u,l,i,o]);if(c.length===0)return null;const h=c.slice(0,d.visibleCount),f=c.slice(d.visibleCount),x=d.hasOverflow&&f.length>0;return n.jsxs("div",{className:E.clsx(_a,{[Fa]:l,[La]:!l}),children:[h.map(v=>n.jsx("div",{className:Na,children:n.jsx(er,{pill:v})},v.key)),x&&n.jsx(Aa,{hiddenPills:f,placement:Ba(e)})]})},Re=({label:e,swatchInlineSize:t,textMeasurer:r,font:s})=>{const o=r.measureText(e,s).width,i=t>0?xt:0;return t+i+o+jt},Ma=(e,t)=>{const r=Da(e);return Math.max(t,r)+je},Oa=e=>e.isBubble?Number(e.visual.size):Ct(e.visual.color),Da=e=>e.isBubble?Number(e.visual.size):be,Ia=({pillSizes:e,overflowPillSize:t,containerSize:r,gap:s})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let o=0;for(let l=0;l<e.length;l+=1)l>0&&(o+=s),o+=e[l]??0;if(o<=r)return{visibleCount:e.length,hasOverflow:!1};let i=0,c=0;for(const l of e){const u=i+(c>0?s:0)+l;if(u+s+t>r)break;i=u,c+=1}return{visibleCount:c,hasOverflow:!0}},Ba=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Ra=g.memo(function({formattedLegends:t,rects:r,textScale:s}){const o=g.useMemo(()=>{const i=new Map;for(const c of t){let l=i.get(c.position);l||(l={pill:[],direct:[]},i.set(c.position,l)),c.display==="pill"?l.pill.push(c):l.direct.push(c)}return i},[t]);return n.jsx(n.Fragment,{children:Array.from(o,([i,c])=>{const l=r[i];return l===void 0?null:n.jsxs("div",{className:la,style:{left:l.x,top:l.y,width:l.width,height:l.height},children:[n.jsx(Pa,{edge:i,formattedLegends:c.pill,containerWidth:l.width,containerHeight:l.height,textScale:s}),n.jsx(oa,{legends:c.direct,containerRect:l,textScale:s})]},i)})})}),Ha=(e,t,r)=>{const s=e.filter(i=>i.interactive);if(s.length===0)return null;const o=s.map(i=>r(i,t)).filter(i=>i!==null).map(i=>i.guideMode);return o.length===0?null:o.some(i=>i==="bar")?"bar":o.every(i=>i==="continuous")?"continuous":null};function Ga(e,t){const r=b.getMainAxisCoordinate(e.mainAxis,t);if(e.mainAxis==="y"){const o=a.toPercent(a.toViewBoxY(r));return{x1:0,x2:"100%",y1:o,y2:o}}const s=a.toPercent(a.toViewBoxX(r));return{x1:s,x2:s,y1:0,y2:"100%"}}function $a(e,t,r){const s=e.mainAxis==="y"?b.getY(r.observation):b.getX(r.observation);if(s===null)return null;const o=e.mainAxis==="y"?qa(r):za(r),c=(t.x?.kind==="position"?t.x:null)?.bandwidth??o;if(c===null||c<=0)return null;const l=c/2;if(e.mainAxis==="y"){const h=a.toPercent(a.toViewBoxY(s+l)),f=a.toPercent(c);return{x:0,y:h,width:"100%",height:f}}const u=a.toPercent(a.toViewBoxX(s-l)),d=a.toPercent(c);return{x:u,y:0,width:d,height:"100%"}}function za(e){const t=b.getXMin(e.observation),r=b.getXMax(e.observation);return t===null||r===null?null:r-t}function qa(e){const t=b.getYMin(e.observation),r=b.getYMax(e.observation);return t===null||r===null?null:r-t}const Va=1,Wa="4 3",Ya=({panelRect:e})=>{const{coordSystem:t,layers:r,scales:s}=a.useCompiledSelector(_.useShallow(l=>({coordSystem:l.coordSystem,layers:l.layers,scales:l.scales}))),o=W(l=>l.hover.primary),i=a.useResolveGeomPlugin();if(t.type!=="cartesian"||r.length===0||o===null)return null;const c=Ha(r,t,i);return c===null?null:c==="bar"?n.jsx(Xa,{coordSystem:t,scales:s,primary:o,panelRect:e}):n.jsx(Ua,{coordSystem:t,primary:o,panelRect:e})},Ua=({coordSystem:e,primary:t,panelRect:r})=>{const s=Ga(e,t);return n.jsx(tr,{panelRect:r,children:n.jsx("line",{...s,stroke:a.vars.hoverGuideLineColor,strokeWidth:Va,strokeDasharray:Wa,strokeLinecap:"round","data-testid":"hover-guide-line"})})},Xa=({coordSystem:e,scales:t,primary:r,panelRect:s})=>{const o=$a(e,t,r);return o===null?null:n.jsx(tr,{panelRect:s,children:n.jsx("rect",{...o,fill:a.vars.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},tr=({panelRect:e,children:t})=>n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,style:{overflow:"visible",pointerEvents:"none"},"data-testid":"hover-guide",children:t}),Ka=200,Za=({engine:e,store:t,overlayRef:r,setCursor:s=Ja})=>{g.useEffect(()=>{const o=r.current;if(!o)return;const i=Qa(o,e),c=ei(o,e,t,s);return()=>{c(),i()}},[e,t,r,s])},Ja=()=>{},Qa=(e,t)=>{const r=()=>{const c=e.getBoundingClientRect();c.width===0||c.height===0||t.setViewport({width:c.width,height:c.height})};let s=null;const o=()=>{s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,r()},Ka)},i=new ResizeObserver(o);return i.observe(e),r(),()=>{i.disconnect(),s!==null&&clearTimeout(s)}},ei=(e,t,r,s)=>{let o=null,i=null;const c=()=>{i=null;const d=o;if(o=null,!d)return;s({clientX:d.clientX,clientY:d.clientY});const h=e.getBoundingClientRect();if(h.width===0||h.height===0)return;const f={x:(d.clientX-h.left)/h.width,y:1-(d.clientY-h.top)/h.height};r.getState().setHoverState(t.query(f))},l=d=>{o=d,i===null&&(i=requestAnimationFrame(c))},u=()=>{o=null,i!==null&&(cancelAnimationFrame(i),i=null),s(null);const d=r.getState();d.hover.primary!==null&&d.setHoverState(b.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",l),e.addEventListener("pointerleave",u),()=>{e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",u),i!==null&&cancelAnimationFrame(i),o=null}},ti=({panelRect:e})=>{const{engine:t,store:r,overlayRef:s,setCursor:o}=a.useHoverContext();return Za({engine:t,store:r,overlayRef:s,setCursor:o}),n.jsx("rect",{ref:s,x:e.x,y:e.y,width:e.width,height:e.height,fill:"transparent",pointerEvents:"all","data-testid":"pointer-capture-layer"})},ue="data-hover-active",ri=e=>{const{store:t}=a.useHoverContext(),r=ee.useStore(t,s=>s.hover.primary!==null);g.useEffect(()=>{const s=e.current;if(s)return r?s.setAttribute(ue,"true"):s.removeAttribute(ue),()=>{s.removeAttribute(ue)}},[e,r])},He=({panelRect:e,zOrder:t})=>{const r=a.useCompiledSelector(c=>c.annotations.custom),s=a.useResolveAnnotationPlugin(),o=r.filter(c=>{const l=s(c.type);return l!==null&&(c.zOrder??l.zOrder)===t});if(o.length===0)return null;const i={width:e.width,height:e.height};return n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`custom-annotations-${t}`,children:o.map(c=>{const l=s(c.type);return l===null?null:n.jsx("g",{"data-annotation-type":c.type,children:l.draw({targets:c.targets,area:i,params:c.params})},c.id)})})},rr=a.FONT_SIZE_EM.xs,me=a.DEFAULT_FONT_FAMILY,nr=a.FONT_WEIGHT.medium,ni=a.FONT_WEIGHT.semibold,sr=6,or=2,si=4,oi=2,Ge=4;var ai="_1agclyl0",ii="_1agclyl1",li="_1agclyl2",ci={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},ui="_1agclyl6 _1agclyl3";const ar=({x:e,y:t,width:r,height:s,text:o,isRotated:i,target:c,position:l,coordType:u})=>{const d=i?`rotate(-90 ${e} ${t})`:void 0,h=c==="aggregate"?ui:ci[l],f=di(c,l,u);return n.jsxs("g",{transform:d,children:[f&&n.jsx("rect",{className:f,x:e-r/2,y:t-s/2,width:r,height:s,rx:Ge,ry:Ge}),n.jsx("text",{className:h,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:o})]})},di=(e,t,r)=>{if(e==="aggregate")return li;if(t==="outside"&&r==="cartesian")return ii},hi={dataLabel:{x:sr,y:or},stackTotal:{x:si,y:oi}},gi=({panelRect:e,formattingLocale:t})=>{const r=a.useTextMeasurer(),s=a.useCompiledSelector(_.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem,axes:l.guides.axes,numberFormat:l.config.numberFormat,parsingLocale:l.config.parsingLocale,textScale:l.config.appearance.textScale}))),o=g.useMemo(()=>{const l=a.emToPx(rr,s.textScale);return{dataLabel:{family:me,size:l,weight:nr},stackTotal:{family:me,size:l,weight:ni}}},[s.textScale]),i=g.useMemo(()=>(l,u)=>{const d=r.measureText(u,o[l]),h=hi[l];return{...d,width:d.width+h.x*2,height:d.height+h.y*2}},[r,o]),c=g.useMemo(()=>b.buildDataLabelsContent({...s,panelRect:e,measureDataLabel:i,formattingLocale:t}),[s,e,i,t]);return n.jsx("g",{className:ai,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(l=>n.jsx(ar,{x:l.x,y:l.y,width:l.width,height:l.height,text:l.text,isRotated:l.isRotated,target:l.target,position:l.position,coordType:s.coordSystem.type},l.key))})},xi=({linePath:e,arrowheadPath:t,stroke:r,strokeWidth:s})=>{const o={stroke:r,strokeWidth:s,strokeLinecap:"round",fill:"none"};return n.jsxs("g",{children:[n.jsx("path",{d:e,...o}),n.jsx("path",{d:t,...o,strokeLinejoin:"round"})]})},fi=({x:e,y:t,text:r,lineHeight:s,paddingX:o,paddingY:i,strokeWidth:c,strokeColor:l,fontWeight:u})=>{const d=a.useTextMeasurer(),f=g.useMemo(()=>d.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:s,weight:u}),[d,r,s,u]).width+o*2,x=s+i*2;return n.jsxs("g",{style:{pointerEvents:"none"},children:[n.jsx("rect",{x:e-f/2,y:t-x/2,width:f,height:x,rx:4,fill:a.vars.graphBackground,stroke:l,strokeWidth:c}),n.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:a.vars.textPrimary,style:{fontFamily:a.DEFAULT_FONT_FAMILY,fontSize:s,fontWeight:u},children:r})]})},pi=({panelRect:e,formattingLocale:t})=>{const r=a.useCompiledSelector(_.useShallow(o=>({differenceArrows:o.annotations.differenceArrows,mainAxis:o.coordSystem.type==="cartesian"?o.coordSystem.mainAxis:"x",textScale:o.config.appearance.textScale}))),s=g.useMemo(()=>r.differenceArrows.map(o=>b.computeDifferenceArrow({arrow:o,mainAxis:r.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:r.textScale,locale:t})),[r,e.width,e.height,t]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:s.map(({color:o,id:i,linePath:c,arrowheadPath:l,strokeWidth:u,labelPosition:d,labelText:h,labelLineHeight:f,labelPaddingX:x,labelPaddingY:v,labelStrokeWidth:m,labelFontWeight:p})=>{const y=o??a.vars.defaultAnnotationArrowStroke;return n.jsxs(g.Fragment,{children:[n.jsx(xi,{linePath:c,arrowheadPath:l,stroke:y,strokeWidth:u}),n.jsx(fi,{x:d.x,y:d.y,text:h,lineHeight:f,paddingX:x,paddingY:v,strokeWidth:m,strokeColor:y,fontWeight:p})]},i)})})},mi=0,vi=1.15,$e=1.15,yi="rgba(0, 0, 0, 0.16)",ze=2,bi=1.4,ji=({arrow:e,fallbackColor:t,stickerOutlineColor:r,stickerOutlineColorInverse:s})=>{const o=g.useId(),i=e.color??t,c=Ti(e.color,r,s),l=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},u=e.arrowheadExtent+e.strokeWidth+ze+$e,d={x:Math.min(e.startX,e.endX)-u,y:Math.min(e.startY,e.endY)-u,width:Math.abs(e.endX-e.startX)+2*u,height:Math.abs(e.endY-e.startY)+2*u},h=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(f=>f.length>0).join(" ");return n.jsxs("g",{children:[e.hasStickerStyle&&n.jsx("defs",{children:n.jsx("filter",{id:o,filterUnits:"userSpaceOnUse",...d,children:n.jsx("feDropShadow",{dx:mi,dy:vi,stdDeviation:$e,floodColor:yi})})}),n.jsxs("g",{filter:e.hasStickerStyle?`url(#${o})`:void 0,children:[e.hasStickerStyle&&n.jsx("path",{d:h,stroke:c,strokeWidth:e.strokeWidth+2*ze,strokeLinecap:"round",fill:"none"}),n.jsx("path",{d:e.linePath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...l}),e.startArrowheadPath.length>0&&n.jsx("path",{d:e.startArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&n.jsx("path",{d:e.endArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},Ti=(e,t,r)=>{if(e===null)return r;try{return mr.getContrast(e,t)<bi?r:t}catch{return r}},Ci=({panelRect:e})=>{const{themeValues:t}=Ce(),r=a.useCompiledSelector(o=>o.annotations.freeformArrows),s=g.useMemo(()=>r.map(o=>b.computeFreeformArrow({arrow:o,panelWidth:e.width,panelHeight:e.height})).filter(o=>o!==null),[r,e.width,e.height]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:s.map(o=>n.jsx(ji,{arrow:o,fallbackColor:a.vars.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},o.id))})},Si=({edge:e,areTicksVisible:t,position:r,labelRotation:s,label:o})=>{const i=a.toPercent(r),c=t?1:0,l={style:{font:a.vars.fontTickLabel},fill:a.vars.textSecondary},u=s!==0&&(e==="top"||e==="bottom"),d=e==="top";return u?n.jsx("svg",{x:i,y:d?"100%":0,style:{overflow:"visible"},children:n.jsx("text",{...wi(d,c,s),...l,children:o})}):n.jsx("text",{...ki(e,i,c),...l,children:o})},ki=(e,t,r)=>{switch(e){case"bottom":return{x:t,y:P*r,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-P*r,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-P*r,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:P*r,y:t,textAnchor:"start",dominantBaseline:"central"}}},wi=(e,t,r)=>{const s=P*t,o=e?-s:s;return{x:0,y:o,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${r}, 0, ${o})`}},Ai=({formattedAxis:e,rect:t})=>{const r=e.position==="bottom"||e.position==="top";return n.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[ct,e.ticks.map((s,o)=>{const i=s.formattedLabel,c=r?s.position:1-s.position,l=Ei(e.position,c,t);return n.jsxs("g",{children:[e.ticksVisible&&n.jsx("line",{...l,stroke:a.vars.gridLineColor,strokeWidth:1}),n.jsx(Si,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:i})]},o)})]})},Ei=(e,t,r)=>{const s=a.toPercent(t);switch(e){case"bottom":return{x1:s,y1:0,x2:s,y2:Z};case"top":return{x1:s,y1:r.height,x2:s,y2:r.height-Z};case"left":return{x1:r.width,y1:s,x2:r.width-Z,y2:s};case"right":return{x1:0,y1:s,x2:Z,y2:s}}},_i=({formattedAxes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];return!s||!r.isVisible?null:n.jsx(Ai,{formattedAxis:r,rect:s},r.scaleAestheticKey)})}),Li=({axes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];if(!s||!r.isVisible)return null;const o=Fi(r.position,s);return n.jsxs("g",{transform:`translate(${s.x}, ${s.y})`,children:[ct,n.jsx("text",{style:{font:a.vars.fontAxisLabel},fill:a.vars.textPrimary,...o,children:r.label})]},`axis-label-${r.position}`)})}),Fi=(e,t)=>{const r={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(r.x=0,r.textAnchor="start"):e==="right"&&(r.x=t.width,r.textAnchor="end"),r},qe={strokeWidth:1,strokeDashoffset:"0",strokeDasharray:"2 3",strokeLinecap:"round"},Ni=({axes:e,panel:t,panelRect:r})=>n.jsxs("svg",{x:r.x,y:r.y,width:r.width,height:r.height,style:{overflow:"visible"},children:[t.border.isVisible&&n.jsx("rect",{x:0,y:0,width:r.width,height:r.height,fill:"none",stroke:a.vars.gridLineColor,rx:8,ry:8,...qe}),e.map(s=>{if(!s.gridVisible)return null;const o=s.position==="bottom"||s.position==="top";return n.jsx("g",{children:s.ticks.map((i,c)=>{if(i.position<=0||i.position>=1)return null;const l=o?i.position:1-i.position,u=a.toPercent(l),d=o?{x1:u,y1:0,x2:u,y2:"100%"}:{x1:0,y1:u,x2:"100%",y2:u};return n.jsx("line",{...d,...qe,stroke:a.vars.gridLineColor},c)})},s.scaleAestheticKey)})]}),Ve=8,We=.5,Ye={strokeWidth:1,strokeLinecap:"round"},Pi=({axes:e,panelRect:t,coordSystem:r})=>{const s=e.find(p=>p.geometry==="circular"),o=e.find(p=>p.geometry==="radial");if(!s||s.ticks.length===0)return null;const i=t.x+t.width/2,c=t.y+t.height/2,l=Math.min(t.width,t.height)/2,{startAngle:u,innerRadius:d}=r,h=p=>p*2*Math.PI+u,f=(p,y)=>{const j=i+y*Math.sin(p),C=c-y*Math.cos(p);return`${j.toFixed(2)},${C.toFixed(2)}`},x=s.ticks.map(p=>h(p.position)),v=p=>`${x.map((y,j)=>`${j===0?"M":"L"} ${f(y,p)}`).join(" ")} Z`,m=(o?.ticks??[]).map(p=>(d+p.position*(1-d))*l).filter(p=>p>We);return m.some(p=>Math.abs(p-l)<We)||m.push(l),n.jsxs("g",{"data-guide":"polar",style:{overflow:"visible"},children:[m.map((p,y)=>n.jsx("path",{d:v(p),fill:"none",stroke:a.vars.gridLineColor,...Ye},`ring-${y}`)),x.map((p,y)=>n.jsx("line",{x1:i,y1:c,x2:i+l*Math.sin(p),y2:c-l*Math.cos(p),stroke:a.vars.gridLineColor,...Ye},`spoke-${y}`)),s.ticks.map((p,y)=>{const j=h(p.position),C=Math.sin(j),L=-Math.cos(j);return n.jsx("text",{x:i+C*(l+Ve),y:c+L*(l+Ve),textAnchor:C>.1?"start":C<-.1?"end":"middle",dominantBaseline:L>.1?"hanging":L<-.1?"auto":"central",style:{font:a.vars.fontTickLabel},fill:a.vars.textSecondary,children:p.formattedLabel},`label-${y}`)})]})},Ue=({panelRect:e,zOrder:t})=>{const s=a.useCompiledSelector(o=>o.annotations.shapes).filter(o=>o.zOrder===t);return s.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:s.map(({id:o,x:i,y:c,width:l,height:u,fillColor:d,fillOpacity:h,strokeWidth:f,strokeColor:x})=>n.jsx("rect",{x:a.toPercent(i),y:a.toPercent(c),width:a.toPercent(l),height:a.toPercent(u),fill:d,fillOpacity:h,stroke:f>0?x??a.vars.defaultAnnotationShapeStroke:"none",strokeWidth:f},o))})};var Mi="_120wioc0";const Oi=({panelRect:e})=>{const t=a.useCompiledSelector(r=>r.annotations.textAnnotations);return t.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(r=>n.jsx("foreignObject",{x:a.toPercent(r.x),y:a.toPercent(r.y),width:a.toPercent(r.width),height:a.toPercent(1-r.y),overflow:"visible",children:n.jsx("div",{className:Mi,style:Di(r.backgroundColor,r.backgroundColorStyle),children:n.jsx(ne,{content:r.content})})},r.id))})},Di=(e,t)=>e===null||e==="transparent"?{color:a.vars.textPrimary}:t==="fade"?{color:a.vars.textPrimary,backgroundColor:xe(e,a.vars.grey100,.5),boxShadow:`0 0 0 1.5px ${xe(e,a.vars.grey0,.2)}`}:{color:a.vars.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${se(e,.1)}`};var Ii="usd3ea0",Bi="usd3ea1";const Ri=({layer:e,coordSystem:t,isAnimated:r,isDimmed:s,highlightStyle:o,formattingLocale:i})=>{const l=a.useResolveGeomPlugin()(e,t);return l===null?n.jsxs("text",{children:[e.geom," not implemented"]}):n.jsx("g",{className:E({[Bi]:s&&o==="desaturate",[Ii]:s&&o==="dim"}),children:l.render({layer:e,coordSystem:t,isAnimated:r,formattingLocale:i})})};function Hi({plugin:e,layer:t,coordSystem:r,candidates:s}){if(e?.getOverlayAnchor===void 0||s.length===0)return[];const o=[];for(const{observation:i,observationIndex:c}of s){const l=e.getOverlayAnchor({layer:t,coordSystem:r,observation:i});l!==null&&o.push({observation:i,observationIndex:c,anchor:l})}return o}const Gi=4,$i=({plugin:e,layer:t,matchedLayer:r,overlayCandidates:s,coordSystem:o,isAnimated:i,panelRect:c,formattingLocale:l})=>{const{numberFormat:u,textScale:d}=a.useCompiledSelector(_.useShallow(m=>({numberFormat:m.config.numberFormat,textScale:m.config.appearance.textScale}))),h=g.useMemo(()=>Hi({plugin:e,layer:t,coordSystem:o,candidates:s}),[e,t,o,s]),f=g.useMemo(()=>b.createSegmentYReader(t),[t]),x=g.useMemo(()=>b.buildLayerYValueFormatter({layer:t,numberFormat:u,locale:l}),[u,t,l]),v=rr*a.ROOT_FONT_SIZE_PX*d;return e===null||r===null&&h.length===0?null:n.jsxs(n.Fragment,{children:[r?e.render({layer:r,coordSystem:o,isAnimated:i,formattingLocale:l}):null,h.map(({observation:m,observationIndex:p,anchor:y})=>n.jsx(zi,{observation:m,anchor:y,panelRect:c,readSegmentY:f,formatYValue:x,labelFontSizePx:v},qi(m,p)))]})},zi=({observation:e,anchor:t,panelRect:r,readSegmentY:s,formatYValue:o,labelFontSizePx:i})=>{const c=a.useTextMeasurer(),l=a.toViewBoxX(t.x),u=a.toViewBoxY(t.y),d=(b.getSize(e)??a.DEFAULT_POINT_SIZE)/2,h=s(e),f=b.isDefined(h)?o(h,e):null,x=g.useMemo(()=>{if(f===null)return null;const v=c.measureText(f,{family:me,size:i,weight:nr});return{width:v.width+sr*2,height:v.height+or*2}},[f,c,i]);return n.jsxs(n.Fragment,{children:[n.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:a.toPercent(l),cy:a.toPercent(u),r:d,fill:b.getColor(e)}),f!==null&&x!==null&&n.jsx(ar,{x:l*r.width,y:u*r.height-d-Gi-x.height/2,width:x.width,height:x.height,text:f,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},qi=(e,t)=>{const r=e[b.GROUP_VARIABLES.group];return`${String(r??"")}\0${t}`},Vi=({layer:e,coordSystem:t,panelRect:r})=>{const s=a.useResolveGeomPlugin(),{primary:o,group:i,related:c}=W(_.useShallow(d=>({primary:d.hover.primary,group:d.hover.group,related:d.hover.related})));if(o===null)return null;const l=s(e,t);if(l===null)return null;const u=c.get(e.id)??[];return o.layerId===e.id?l.renderHover({layer:e,coordSystem:t,primary:o,group:i,related:u,panelRect:r}):u.length===0?null:l.renderHoverCompanions({layer:e,primary:o,related:u})};var Wi="to1jkx0",Yi="to1jkx1";const Ui=({shouldAnimate:e,panelRect:t,formattingLocale:r})=>{const{layers:s,coordSystem:o,highlightStyle:i}=a.useCompiledSelector(_.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,highlightStyle:c.config.appearance.highlightStyle})));return n.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:Wi,"data-testid":"geom-layers",children:s.map(c=>n.jsxs(g.Fragment,{children:[n.jsx(Zi,{layer:c,coordSystem:o,highlightStyle:i,shouldAnimate:e,panelRect:t,formattingLocale:r}),n.jsx(Vi,{layer:c,coordSystem:o,panelRect:t})]},`${c.id}-${Xi(o)}`))})},Xi=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,Ki=e=>{if(e.highlight!==null)return Yi},Zi=({layer:e,coordSystem:t,highlightStyle:r,shouldAnimate:s,panelRect:o,formattingLocale:i})=>{const c=a.useResolveGeomPlugin(),l=g.useMemo(()=>c(e,t),[c,e,t]),u=e.highlight;return n.jsxs("g",{className:Ki(e),children:[n.jsx(Ri,{layer:e,coordSystem:t,isAnimated:s,isDimmed:u?.composition.isDimmed??!1,highlightStyle:r,formattingLocale:i}),u!==null&&n.jsx($i,{plugin:l,layer:e,matchedLayer:u.composition.matchedLayer,overlayCandidates:u.composition.overlayCandidates,coordSystem:t,isAnimated:s,panelRect:o,formattingLocale:i})]})};var Ji="_17uhij30";const Qi=({formattedAxes:e,formattedPolarAxes:t,plotRect:r,panelRect:s,axisRects:o,axisLabelRects:i,shouldAnimate:c,formattingLocale:l})=>{const u=g.useRef(null);ri(u);const{axes:d,panelGuide:h,coordSystem:f}=a.useCompiledSelector(_.useShallow(y=>({axes:y.guides.axes,panelGuide:y.guides.panel,coordSystem:y.coordSystem}))),x=g.useMemo(()=>ir(s,r),[s,r]),v=g.useMemo(()=>Xe(o,r),[o,r]),m=g.useMemo(()=>Xe(i,r),[i,r]),p=g.useMemo(()=>d.filter(y=>y.geometry==="linear"),[d]);return n.jsxs("svg",{ref:u,className:Ji,width:r.width,height:r.height,style:{transform:`translate(${r.x}px, ${r.y}px)`},"data-testid":"plot",children:[n.jsx(Ni,{axes:e,panel:h,panelRect:x}),f.type==="polar"&&n.jsx(Pi,{axes:t,panelRect:x,coordSystem:f}),n.jsx(Ya,{panelRect:x}),n.jsx(_i,{formattedAxes:e,rects:v}),n.jsx(Li,{axes:p,rects:m}),n.jsx(Ue,{panelRect:x,zOrder:"background"}),n.jsx(He,{panelRect:x,zOrder:"background"}),n.jsx(Ui,{shouldAnimate:c,panelRect:x,formattingLocale:l}),n.jsx(gi,{panelRect:x,formattingLocale:l}),n.jsx(pi,{panelRect:x,formattingLocale:l}),n.jsx(Ue,{panelRect:x,zOrder:"foreground"}),n.jsx(He,{panelRect:x,zOrder:"foreground"}),n.jsx(Ci,{panelRect:x}),n.jsx(Oi,{panelRect:x}),n.jsx(ti,{panelRect:x})]})},ir=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),Xe=(e,t)=>{const r={};for(const[s,o]of Object.entries(e))r[s]=ir(o,t);return r},de={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},el=()=>{const[e,t]=g.useState(null),[r,s]=g.useState(null),[o,i]=g.useState(de);return g.useEffect(()=>{const c=()=>{const u=e?{width:e.offsetWidth,height:e.offsetHeight}:de.headerSize,d=r?{width:r.offsetWidth,height:r.offsetHeight}:de.footerSize;i(h=>tl(h,{headerSize:u,footerSize:d})?{headerSize:u,footerSize:d}:h)};c();const l=new ResizeObserver(c);return e&&l.observe(e),r&&l.observe(r),()=>l.disconnect()},[e,r]),{headerRef:t,footerRef:s,measurements:o}},tl=(e,t)=>e.headerSize.width!==t.headerSize.width||e.headerSize.height!==t.headerSize.height||e.footerSize.width!==t.footerSize.width||e.footerSize.height!==t.footerSize.height,rl=({appearance:e,isEditable:t,style:r,children:s})=>{const{theme:o,themeClass:i,inlineVarsStyle:c}=Ce(),l=Gn(e.border),u=Math.max(0,e.cornerRadius),d=u===0?0:u+l,h=g.useMemo(()=>{const v={...r,borderRadius:`${d}px`,...c},m=Hn(e.border,o);return m!==null&&(v.background=m),v},[r,d,c,e.border,o]),f=g.useMemo(()=>({inset:`${l}px`,borderRadius:`${u}px`}),[l,u]),x=t&&e.background.type==="solid"&&e.background.color==="transparent";return n.jsx("div",{"data-testid":"graph-wrapper",className:E(Vn,i),style:h,children:n.jsx("div",{"data-testid":"graph-inner",className:E(Yn,{[Un]:x}),style:f,children:s})})},nl=e=>n.jsx(a.HoverProvider,{children:n.jsx(a.TextMeasurerProvider,{children:n.jsx(sl,{...e})})}),sl=({width:e,height:t,isAnimated:r,showTooltips:s=!0,mode:o="readonly"})=>{const{axes:i,legends:c,numberFormat:l,parsingLocale:u,appearance:d,annotations:h,coordSystem:f,headline:x,headlineConfig:v}=a.useCompiledSelector(_.useShallow(F=>({axes:F.guides.axes,legends:F.guides.legends,numberFormat:F.config.numberFormat,parsingLocale:F.config.parsingLocale,appearance:F.config.appearance,annotations:F.annotations,coordSystem:F.coordSystem,headline:F.guides.headline,headlineConfig:F.config.headline}))),m=dr.useReducedMotion(),{headerRef:p,footerRef:y,measurements:j}=el(),{formattingLocale:C,theme:L,themeOverrides:$}=a.useGraphContext(),ke=g.useMemo(()=>b.formatLegends({legends:c,numberFormat:l,parsingLocale:u,formattingLocale:C}),[c,l,u,C]),z=g.useMemo(()=>b.formatHeadline({headline:x,show:v.show,numberFormat:l,parsingLocale:u,formattingLocale:C}),[x,v.show,l,u,C]),lr=a.useTextMeasurer(),oe=d.border.type==="none"?0:d.border.width,ae=g.useMemo(()=>({width:Math.max(0,e-2*oe),height:Math.max(0,t-2*oe)}),[e,t,oe]),Y=g.useMemo(()=>z?{formatted:z,size:v.size,position:v.position,innerRadius:f.type==="polar"?f.innerRadius:0}:void 0,[z,v.size,v.position,f]),U=bn(lr,d.textScale),q=jn({measurer:U,axes:i,numberFormat:l,parsingLocale:u,formattedLegends:ke,containerSize:ae,externalMeasurements:j,headline:Y,formattingLocale:C,annotations:h,coordSystem:f,textScale:d.textScale}),X=g.useMemo(()=>!q||!Y||!U?null:b.resolveHeadlinePlacement({headline:Y,layout:q.layout,containerSize:ae,measurer:U,itemGap:it}),[q,Y,ae,U]);if(!q)return null;const{layout:M,formattedAxes:cr,formattedPolarAxes:ur}=q;return n.jsx(Nt,{theme:L,themeOverrides:$,appearance:d,children:n.jsxs(rl,{appearance:d,isEditable:o==="editable",style:{width:e,height:t},children:[n.jsx(Lo,{ref:p,headerRect:M.header,mode:o}),n.jsx(Qi,{formattedAxes:cr,formattedPolarAxes:ur,plotRect:M.plot,panelRect:M.panel,axisRects:M.axes,axisLabelRects:M.axisLabels,shouldAnimate:r??!m,formattingLocale:C??u}),n.jsx(po,{ref:y,footerRect:M.footer,mode:o}),n.jsx(Ra,{formattedLegends:ke,rects:M.legends,textScale:d.textScale}),z&&X&&n.jsx(Jo,{headline:z,rect:X.rect,resolvedSize:X.resolvedSize,visibleItemCount:X.visibleItemCount}),s&&n.jsx(Qr,{})]})})};exports.CanvasTextMeasurer=a.CanvasTextMeasurer;exports.GraphProvider=a.GraphProvider;exports.HoverProvider=a.HoverProvider;exports.TextMeasurerProvider=a.TextMeasurerProvider;exports.useCompiledSelector=a.useCompiledSelector;exports.useGraphCommandDispatcher=a.useGraphCommandDispatcher;exports.useTextMeasurer=a.useTextMeasurer;exports.vars=a.vars;exports.DevToolsPanel=Or;exports.GraphRenderer=nl;exports.ThemeProvider=Nt;exports.darkTheme=Ft;exports.lightTheme=Lt;exports.useHoverState=W;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),E=require("clsx"),g=require("react"),ee=require("zustand"),b=require("@graphysdk/viz-engine"),a=require("./tooltip-body-B4Mj-oru.cjs"),dr=require("motion/react"),_=require("zustand/react/shallow"),w=require("@floating-ui/react-dom"),hr=require("@tiptap/core"),Ke=require("@tiptap/extension-bold"),he=require("@tiptap/extension-document"),Ze=require("@tiptap/extension-hard-break"),Je=require("@tiptap/extension-heading"),Qe=require("@tiptap/extension-italic"),et=require("@tiptap/extension-link"),tt=require("@tiptap/extension-text"),rt=require("@tiptap/extension-text-align"),R=require("@tiptap/extension-text-style"),nt=require("@tiptap/extension-underline"),te=require("@tiptap/extensions"),gr=require("@tiptap/extension-paragraph"),ve=require("@tiptap/react"),S=require("@base-ui/react/toolbar"),B=require("@base-ui/react/tooltip"),xr=require("react-dom"),fr=require("@vanilla-extract/dynamic"),k=require("@base-ui/react/popover"),we=require("react-colorful"),A=require("@base-ui/react/menu"),pr=require("@base-ui/react/toggle"),mr=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-plugins.3");var vr="drqe3u0",yr="drqe3u1",br="drqe3u2",jr="drqe3u3",K="drqe3u4",Tr="drqe3u5",Cr="drqe3u6",Sr="drqe3u7",ie="drqe3u8",kr="drqe3u9",wr="drqe3ua",Ar="drqe3ub",Er="drqe3uc",_r="drqe3ud",Lr="drqe3ue",Fr="drqe3uf",Nr="drqe3ug",Pr="drqe3uh",Mr="drqe3ui",Ae={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},Ee={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},st={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const Or=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=a.useGraphContext(),[o]=g.useState(()=>a.createDevToolsStore()),[i,c]=g.useState(!1),[l,u]=g.useState(b.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:m}=o.getState(),p=s.getLastTrigger(),y=s.getLastCompile();return p&&y&&m(p,y),s.subscribe(m)},[o,s]);const d=ee.useStore(o,m=>m.lastCompile),h=ee.useStore(o,m=>m.history),f=s.getCacheStats(),x=d===null&&h.length===0,v=()=>{u(m=>{const p=!m;return b.setCompilerCachingEnabled(p),p})};return n.jsxs("div",{className:E(wr,r),style:{width:e,...t},children:[n.jsxs("div",{className:vr,children:[n.jsxs("div",{children:[n.jsx("div",{className:yr,children:"compile cache"}),n.jsx("div",{className:Lr,children:x?"production: stats disabled":d?`last: ${d.label} · ${ot(d.durationMs)}`:"awaiting first compile…"})]}),n.jsx("button",{type:"button",onClick:()=>c(m=>!m),className:Fr,children:i?"▾":"▴"})]}),!i&&n.jsxs("div",{className:Ar,children:[n.jsxs("button",{type:"button",onClick:v,className:l?Ae.enabled:Ae.disabled,"aria-pressed":l,children:["cache ",l?"enabled":"disabled"]}),n.jsx("span",{className:Nr,children:"next compile reflects this toggle"})]}),!i&&!x&&n.jsxs(n.Fragment,{children:[n.jsx(Dr,{delta:d?.stages,cumulative:f}),n.jsx(Ir,{entries:h})]})]})},Dr=({delta:e,cumulative:t})=>n.jsxs("table",{className:br,children:[n.jsx("thead",{children:n.jsxs("tr",{className:Pr,children:[n.jsx("th",{className:jr,children:"stage"}),n.jsx("th",{className:K,children:"Δ miss"}),n.jsx("th",{className:K,children:"Δ hit"}),n.jsx("th",{className:K,children:"total miss"}),n.jsx("th",{className:K,children:"total hit"})]})}),n.jsx("tbody",{children:b.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Br(s);return n.jsxs("tr",{className:Er,children:[n.jsxs("td",{className:Tr,children:[n.jsx("span",{className:st[o],"aria-hidden":!0})," ",r]}),n.jsx("td",{className:o==="ran"?Ee.ran:Ee.dim,children:s?.misses??0}),n.jsx("td",{className:ie,children:s?.hits??0}),n.jsx("td",{className:ie,children:t[r].misses}),n.jsx("td",{className:ie,children:t[r].hits})]},r)})})]}),Ir=({entries:e})=>e.length===0?null:n.jsxs("div",{className:_r,children:[n.jsx("div",{className:Mr,children:"recent compiles"}),e.map(t=>{const r=Rr(t.stages,i=>i.misses>0),s=b.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return n.jsxs("div",{className:Cr,children:[n.jsx("span",{className:st[o],"aria-hidden":!0}),n.jsx("span",{className:Sr,title:t.label,children:t.label}),n.jsxs("span",{className:kr,children:[r,"/",s," ran · ",ot(t.durationMs)]})]},t.id)})]}),Br=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Rr=(e,t)=>{let r=0;for(const s of b.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},ot=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Hr={small:1.9,medium:2.3,large:2.6},Gr={small:1,medium:1,large:1.2},$r=a.DEFAULT_FONT_FAMILY,at=a.FONT_LINE_HEIGHT.sm,zr=12,qr=4,Vr=4,Wr=12,Yr=4,Ur=2,it=24;function W(e){const{store:t}=a.useHoverContext();return ee.useStore(t,e)}const Xr=e=>{const{cursorRef:t,subscribeCursorMove:r}=a.useHoverContext(),s=W(i=>i.isPointerInside),o=g.useRef(e);return o.current=e,g.useEffect(()=>r(()=>o.current?.()),[r]),{cursorRef:t,isInside:s}},Kr=16,Zr=8,Jr={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},Qr=()=>{const e=a.useCompiledSelector(_.useShallow(j=>({layers:j.layers,coordSystem:j.coordSystem,scales:j.scales,guides:j.guides,numberFormat:j.config.numberFormat,parsingLocale:j.config.parsingLocale}))),{formattingLocale:t}=a.useGraphContext(),r=W(j=>j.hover),s=a.useResolveGeomPlugin(),o=g.useRef(()=>{}),{cursorRef:i,isInside:c}=Xr(()=>o.current()),l=g.useMemo(()=>b.buildTooltipContent({...e,hover:r,formattingLocale:t}),[e,r,t]),u=l!==null&&c,d=g.useMemo(()=>({getBoundingClientRect:()=>{const j=i.current;return j===null?Jr:en(j)}}),[i]),{refs:h,floatingStyles:f,update:x}=w.useFloating({open:u,placement:"right",middleware:[w.offset(Kr),w.flip(),w.shift({padding:Zr})],elements:{reference:d}});if(o.current=x,!u)return null;const v=r.primary,m=v===null?null:e.layers.find(j=>j.id===v.layerId)??null,p=m===null?null:s(m,e.coordSystem),y=v!==null&&m!==null&&p?.renderTooltip?p.renderTooltip({content:l,layer:m,coordSystem:e.coordSystem,primary:v,group:r.group,related:r.related}):null;return n.jsx("div",{ref:h.setFloating,role:"tooltip",className:a.root,style:f,"data-testid":"chart-tooltip",children:y??n.jsx(a.TooltipBody,{content:l})})},en=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),ye=a.FONT_SIZE_EM.sm,lt=a.DEFAULT_FONT_FAMILY,ct=!1,Z=6,P=10,tn=(e,t)=>r=>{if(!r.isVisible||r.ticks.length===0)return 0;const s=r.position==="top"||r.position==="bottom",o=r.ticks.map(l=>e.measureText(l.formattedLabel,{family:lt,size:a.emToPx(ye,t)})),i=r.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(s){if(r.labelRotation!==0){const l=o.map(d=>d.width);return _e(l,i)+2*P}return Math.max(...o.map(l=>l.height))+P}return _e(o.map(l=>l.width),i)+P},_e=(e,t)=>Math.min(Math.max(...e),t),rn=e=>()=>a.emToPx(ye,e),nn=(e,t)=>(r,s)=>{const{labelLineHeight:o,labelFontWeight:i}=b.getDifferenceArrowDimensions(s,t);return e.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:o,weight:i})},ut=e=>{const{value:t,observationLabel:r,comparison:s,swatch:o,label:i}=e;return[{role:"valueRow",gap:Vr,segments:le([J("value","value",t??"–"),J("observation","label",r)])},{role:"trendRow",gap:Yr,ariaLabel:s===null?void 0:ln(s),segments:le([on(s),an(s),J("trendReference","label",s?.reference??null)])},{role:"groupRow",gap:qr,segments:le([sn(o),J("label","label",i)])}].filter(l=>l.segments.length>0)},J=(e,t,r)=>r===null?null:{kind:"text",textRole:e,fontRole:t,text:r},sn=e=>e===null?null:{kind:"swatch",swatch:e,size:zr},on=e=>e===null?null:{kind:"trendArrow",direction:e.direction,size:Wr},an=e=>e===null?null:{kind:"text",textRole:"trendPercentage",fontRole:"label",text:e.percentage,trendDirection:e.direction},ln=e=>{switch(e.direction){case"up":return`Increased ${e.percentage} ${e.reference}`;case"down":return`Decreased ${e.percentage} ${e.reference}`;case"flat":return`No change ${e.reference}`}},le=e=>e.filter(t=>t!==null),cn=(e,t)=>(r,s)=>{const o=dt(r,s,e,t),i=ht(o.map(l=>l.width)),c=Math.max(0,o.length-1)*it;return{width:i+c,height:Math.max(0,...o.map(l=>l.height))}},un=(e,t)=>(r,s)=>dt(r,s,e,t).map(o=>o.width),dn=(e,t)=>(r,s)=>{const o=ge("value",s,t);return{width:e.measureText(r,o).width,height:o.size*at}},hn=(e,t)=>{const r=cn(e,t),s=dn(e,t);return(o,i)=>o.kind==="perGroup"?r(o,i):s(o.value,i)},dt=(e,t,r,s)=>{const o={value:ge("value",t,s),label:ge("label",t,s)},i=c=>gn(c,o,r);return e.items.map(c=>{const l=ut(c).map(i),u=Math.max(0,l.length-1)*Ur;return{width:Math.max(0,...l.map(d=>d.width)),height:ht(l.map(d=>d.height))+u}})},gn=(e,t,r)=>{let s=0,o=0;for(const i of e.segments)if(i.kind==="text"){const c=t[i.fontRole];s+=r.measureText(i.text,c).width,o=Math.max(o,c.size*at)}else s+=i.size,o=Math.max(o,i.size);return{width:s+Math.max(0,e.segments.length-1)*e.gap,height:o}},ge=(e,t,r)=>{const s=e==="value"?Hr[t]:Gr[t];return{family:$r,size:a.emToPx(s,r)}},ht=e=>e.reduce((t,r)=>t+r,0),be=12,gt=10,xt=8,xn=8,fn=8,pn=2,ft=1,pt=2,mt=4,vt=a.FONT_SIZE_EM.sm,yt=a.FONT_LINE_HEIGHT.sm,bt=a.DEFAULT_FONT_FAMILY,jt=2*(fn+ft),je=2*(pn+ft),mn=pt*mt,Tt=e=>{const t=a.emToPx(vt,e);return{fontSizePx:t,lineBoxHeight:t*yt}},Ct=e=>e?gt:0,vn=(e,t)=>r=>{if(r.items.length===0)return 0;const{fontSizePx:s,lineBoxHeight:o}=Tt(t),i={family:bt,size:s};if(r.position==="top"||r.position==="bottom")return Math.max(o,be)+je;const l=r.items.map(u=>{const d=e.measureText(u.formattedLabel,i).width,h=Ct(u.visual.color);return h+(h>0?xt:0)+d});return Math.max(...l)+jt},yn=(e,t)=>r=>e.measureText(r,{family:lt,size:a.emToPx(ye,t)}),bn=(e,t)=>g.useMemo(()=>e?{measureAxis:tn(e,t),measureAxisLabel:rn(t),measureLegend:vn(e,t),measureHeadline:hn(e,t),measureHeadlineItemWidths:un(e,t),measureTickLabel:yn(e,t),measureDifferenceArrowLabel:nn(e,t)}:null,[e,t]),jn=({measurer:e,axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f})=>g.useMemo(()=>e?new b.LayoutCompiler(e).compile({axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f}):null,[t,r,s,o,i,c,l,u,d,h,f,e]),Le="data-variant",St=gr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(Le)??null,renderHTML:e=>e.variant?{[Le]:e.variant}:{}}}}}),Tn=hr.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:r}=t;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),Cn=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:r,isSubtitleVisible:s})=>[kn({isTitleVisible:r,isSubtitleVisible:s}),St,tt.Text,te.UndoRedo,Je.Heading.configure({levels:[1,2,3]}),Ke.Bold,Qe.Italic,nt.Underline,rt.TextAlign.configure({types:["heading","paragraph"]}),et.Link.configure({openOnClick:!1,autolink:!0}),R.TextStyle,R.Color,R.FontFamily,Ze.HardBreak,Tn.configure({isTitleVisible:r}),te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const c=r?i.state.doc.firstChild?.nodeSize??-1:0;return s&&o===c?t:""}})],Sn=({placeholder:e})=>[he.Document,St,tt.Text,te.UndoRedo,Je.Heading.configure({levels:[1,2,3]}),Ke.Bold,Qe.Italic,nt.Underline,rt.TextAlign.configure({types:["heading","paragraph"]}),et.Link.configure({openOnClick:!1,autolink:!0}),R.TextStyle,R.Color,R.FontFamily,Ze.HardBreak,te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],kn=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?he.Document.extend({content:"block{2,}"}):he.Document,T=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,se=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,kt=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,xe=(e,t,r)=>`color-mix(in srgb, ${e}, ${t} ${r*100}%)`,wn=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),An=e=>e.length===0?!1:typeof CSS<"u"&&typeof CSS.supports=="function"?CSS.supports("color",e):/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),wt={elevationXs:"0 0 2px rgba(15, 15, 24, 0.12), 0 2px 2px rgba(14, 14, 52, 0.08)",elevationSm:"0 0 4px rgba(15, 15, 24, 0.12), 0 4px 4px rgba(14, 14, 52, 0.08)",elevationMd:"0 0 8px rgba(15, 15, 24, 0.12), 0 8px 8px rgba(14, 14, 52, 0.08)",elevationLg:"0 0 16px rgba(15, 15, 24, 0.12), 0 16px 16px rgba(14, 14, 52, 0.08)"},At={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},Et={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},En=8,I=e=>`${En*e}px`,_t={spaceXxs:I(.25),spaceXs:I(.5),spaceSm:I(.75),spaceMd:I(1),spaceLg:I(1.5),spaceXl:I(2)},_n={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#000000",grey95:"#0D0D0D",grey90:"#1A1A1A",grey85:"#1F1F1F",grey80:"#2A2A2A",grey75:"#2e2e2e",grey70:"#353535",grey60:"#494949",grey50:"#6F6F6F",grey0:"#FFFFFF",red60:"#CB3333",red50:"#F93939",amber70:"#F48135",amber50:"#FEAE47",amber40:"#FFC849",amber30:"#ffd061",green60:"#0AC600",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #222429, #31353f)"},Ln={textPrimary:a.vars.grey0,textSecondary:T(a.vars.textPrimary,.8),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey70,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,sunkenBackground:a.vars.grey100,defaultBackground:a.vars.grey90,raisedBackground:a.vars.grey80,overlayBackground:a.vars.grey90,overlayBorderGradient:a.vars.greyGradient80},Fn={graphBackground:a.vars.grey90,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:a.vars.border100,targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.grey70,tooltipBorderColor:a.vars.grey60,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey60,hoverGuideLineColor:T(a.vars.white,.08),hoverGuideFillColor:T(a.vars.white,.06),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.white,defaultAnnotationShapeStroke:a.vars.white,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:a.vars.white},Nn={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},Pn={..._n,...Ln,...wt,...At,..._t,...Et,...Fn,...Nn,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},Mn={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#FFFFFF",grey95:"#FCFCFC",grey90:"#FAFAFA",grey85:"#F5F5F5",grey80:"#F0F0F0",grey75:"#E8E8E8",grey70:"#E5E5E5",grey60:"#CCCCCC",grey50:"#C4C4C4",grey0:"#1D2129",red60:"#E14B49",red50:"#F93939",amber70:"#FFBA8C",amber50:"#FFC849",amber40:"#FEAE47",amber30:"#E7A816",green60:"#06B299",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #F0F0F1, #F9F9FF)"},On={textPrimary:a.vars.black,textSecondary:T(a.vars.textPrimary,.6),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey100,brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),sunkenBackground:a.vars.grey90,defaultBackground:a.vars.grey100,raisedBackground:a.vars.grey85,overlayBackground:a.vars.grey100,overlayBorderGradient:a.vars.border10},Dn={graphBackground:a.vars.grey100,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.white,tooltipBorderColor:a.vars.border10,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey80,hoverGuideLineColor:T(a.vars.black,.08),hoverGuideFillColor:T(a.vars.black,.04),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.black,defaultAnnotationShapeStroke:a.vars.black,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:"#3d414c"},In={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},Bn={...Mn,...On,...wt,...At,..._t,...Et,...Dn,...In,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},re=.1,Rn={light:.05,dark:.1},Hn=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return zn(e.color,t);case"gradient":return qn(e.color,t);case"preset":return b.BORDER_PRESET_GRADIENTS[e.preset]}},Gn=e=>e.type==="none"?0:e.width,$n=(e,t,r)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return xe(r,e.color,Rn[t])},zn=(e,t)=>t==="dark"?se(e,re):kt(e,re),qn=(e,t,r=90)=>{const s=e,o=t==="dark"?se(e,re):kt(e,re);return`linear-gradient(${r}deg, ${s} 0%, ${o} 100%)`};var Vn="bow4tg0",Wn="bow4tg1",Yn="bow4tg2",Un="bow4tg3",Lt="_1ii3bsb0",Ft="_1ii3bsb1";const Te=g.createContext(null),Ce=()=>{const e=g.useContext(Te);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},Nt=({theme:e,themeOverrides:t={},appearance:r,children:s})=>{const o=g.useMemo(()=>({...e==="dark"?Pn:Bn,...t}),[e,t]),i=g.useMemo(()=>{const l={[a.vars.textScale]:String(r.textScale)};for(const[d,h]of Object.entries(t))l[a.vars[d]]=h;const u=$n(r.background,e,o.graphBackground);return u!==void 0&&(l[a.vars.graphBackground]=u),fr.assignInlineVars(l)},[r.textScale,r.background,e,o.graphBackground,t]),c=g.useMemo(()=>({theme:e,themeClass:e==="dark"?Ft:Lt,inlineVarsStyle:i,themeValues:o}),[e,i,o]);return n.jsx(Te.Provider,{value:c,children:s})},O=({children:e,className:t,style:r})=>{const s=g.useContext(Te),o=s?E(s.themeClass,Wn):void 0,i=s?{...s.inlineVarsStyle,...r}:r;return n.jsx("div",{className:E(o,t),style:i,children:e})},Xn="graphy_root",D=()=>typeof document>"u"?null:document.getElementById(Xn)??document.body;var Kn="yp3g0k0",Zn="yp3g0k1",Pt="yp3g0k3",Jn="yp3g0k4",Mt="yp3g0k5",fe="yp3g0k6",Qn="yp3g0k7",es="yp3g0k8",Ot="yp3g0k9",ts="yp3g0ka",rs="yp3g0kb",ns="yp3g0kc",ss="yp3g0kd",os="yp3g0ke";const as=a.CANVAS_COLOR_KEYS.map(e=>a.vars[e]),is=Object.fromEntries(a.CANVAS_COLOR_KEYS.map(e=>[a.vars[e],e])),ls=({editor:e,currentColor:t,isOpen:r,onOpenChange:s})=>{const o=us(),i=g.useCallback(l=>{e.chain().setColor(l).run()},[e]),c=l=>{e.chain().focus().setColor(l).run(),s(!1)};return n.jsxs(k.Popover.Root,{open:r,onOpenChange:s,children:[n.jsx(k.Popover.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Text color",className:Kn,onMouseDown:l=>l.preventDefault(),children:n.jsx("span",{className:Zn,style:{background:t??"transparent"}})}),n.jsx(k.Popover.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(k.Popover.Positioner,{sideOffset:6,align:"start",className:Pt,children:n.jsxs(k.Popover.Popup,{className:Jn,onMouseDown:l=>l.preventDefault(),children:[n.jsx(Fe,{title:"Colors",colors:as,currentColor:t,onPick:c}),o.length>0&&n.jsx(Fe,{title:"Chart colors",colors:o,currentColor:t,onPick:c}),n.jsx(cs,{value:t??"#000000",onChange:i})]})})})})]})},Fe=({title:e,colors:t,currentColor:r,onPick:s})=>n.jsxs("div",{className:Mt,children:[n.jsx("div",{className:fe,children:e}),n.jsx("div",{className:Qn,children:t.map(o=>n.jsx("button",{type:"button","aria-label":o,className:es,"data-active":hs(o,r),onMouseDown:i=>i.preventDefault(),onClick:()=>s(o),children:n.jsx("span",{className:Ot,style:Dt(o)})},o))})]}),cs=({value:e,onChange:t})=>{const[r,s]=g.useState(!1),o=An(e)?e:"#000000",i=ds(o);return n.jsxs(k.Popover.Root,{open:r,onOpenChange:s,children:[n.jsxs("div",{className:Mt,children:[n.jsx("div",{className:fe,children:"Custom"}),n.jsxs(k.Popover.Trigger,{className:ts,onMouseDown:c=>c.preventDefault(),"aria-label":"Pick custom color",children:[n.jsx("span",{className:Ot,style:Dt(o)}),n.jsx("span",{className:rs,children:i})]})]}),n.jsx(k.Popover.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(k.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:Pt,children:n.jsxs(k.Popover.Popup,{className:ns,onMouseDown:c=>c.preventDefault(),children:[n.jsx("div",{className:fe,children:"Pick color"}),n.jsx(we.HexColorPicker,{color:i,onChange:t,className:ss}),n.jsx(we.HexColorInput,{color:i,onChange:t,prefixed:!0,className:os,onMouseDown:c=>c.stopPropagation()})]})})})})]})},us=()=>{const e=a.useCompiledSelector(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const r of e.domain){const s=e.map(r);typeof s=="string"&&t.add(s)}return[...t]},[e])},Dt=e=>({background:e,border:`1px solid ${se(e,.1)}`}),ds=e=>{const{themeValues:t}=Ce();if(wn(e))return e.toUpperCase();const r=is[e];return r?t[r].toUpperCase():"#000000"},hs=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),gs={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var xs={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const N=({children:e,title:t,variant:r="primary",size:s="sm",...o})=>{const i=g.useId(),c=gs[s];return n.jsxs("svg",{className:xs[r],"aria-labelledby":t?i:void 0,height:c,width:c,fill:"none",viewBox:"0 0 24 24",role:"img",...o,children:[t&&n.jsx("title",{id:i,children:t}),e]})},It=e=>n.jsx(N,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"m6 9 6 6 6-6"})})}),fs="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Bt=`'Aeonik', 'Aeonik Fallback', ${a.DEFAULT_FONT_FAMILY}`,ps="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",ms="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",vs=`var(--brand-font-family), ${Bt}`,pe=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:a.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Bt},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:fs},{id:"technical",label:"Technical",preview:"00",fontFamily:ps},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:ms},{id:"brand",label:"Brand",preview:"Aa",fontFamily:vs}],ys=e=>e?pe.find(t=>t.fontFamily===e)??null:null;var Rt="_1qkyw7q0",Ht="_1qkyw7q1",Gt="_1qkyw7q3",$t="_1qkyw7q4",zt="_1qkyw7q5";const bs=({editor:e,currentFontFamily:t,isOpen:r,onOpenChange:s})=>{const o=ys(t)??pe[0],i=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return n.jsxs(A.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(A.Menu.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Font family",className:Rt,onMouseDown:c=>c.preventDefault(),children:[n.jsx("span",{className:Ht,style:{fontFamily:o?.fontFamily},children:o?.preview}),n.jsx(It,{size:"sm"})]}),n.jsx(A.Menu.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(A.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Gt,children:n.jsx(A.Menu.Popup,{className:$t,onMouseDown:c=>c.preventDefault(),children:pe.map(c=>n.jsx(A.Menu.Item,{className:zt,"data-selected":c.id===o?.id,onClick:()=>i(c),children:n.jsx("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},qt={id:"text",label:"Text",previewFont:a.vars.fontTextEditorBody},Ne=[{id:"caption",label:"Caption",previewFont:a.vars.fontTextEditorH6},qt,{id:"h3",label:"Heading 3",previewFont:a.vars.fontTextEditorH3},{id:"h2",label:"Heading 2",previewFont:a.vars.fontTextEditorH2},{id:"h1",label:"Heading 1",previewFont:a.vars.fontTextEditorH1}],js=({editor:e,activeStyle:t,isOpen:r,onOpenChange:s})=>{const o=Ne.find(i=>i.id===t)??qt;return n.jsxs(A.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(A.Menu.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Text style",className:Rt,onMouseDown:i=>i.preventDefault(),children:[n.jsx("span",{className:Ht,children:o.label}),n.jsx(It,{size:"sm"})]}),n.jsx(A.Menu.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(A.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Gt,children:n.jsx(A.Menu.Popup,{className:$t,onMouseDown:i=>i.preventDefault(),children:Ne.map(i=>n.jsx(A.Menu.Item,{className:zt,"data-selected":i.id===o.id,onClick:()=>Ts(e,i.id),children:n.jsx(Cs,{font:i.previewFont,children:i.label})},i.id))})})})})]})},Ts=(e,t)=>{switch(t){case"caption":{e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return}case"text":{e.chain().focus().setNode("paragraph",{variant:null}).run();return}case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},Cs=({font:e,children:t})=>n.jsx("span",{style:{font:e,margin:0},children:t}),Ss=e=>n.jsx(N,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M20 6 9 17l-5-5"})})}),ks=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),ws=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 6 6 18"}),n.jsx("path",{d:"m6 6 12 12"})]})}),As=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),Es=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,s=t.parentOffset,o=t.start();let i=s;for(;i>0&&Pe(r[i-1]);)i-=1;let c=s;for(;c<r.length&&Pe(r[c]);)c+=1;return{from:o+i,to:o+c}},Pe=e=>e!==void 0&&/\S/.test(e);var _s="b5kquu0",Ls="b5kquu1",Fs="b5kquu2",Ns="b5kquu3",Me="b5kquu4";const Ps=({editor:e,currentUrl:t,isActive:r,isOpen:s,onOpenChange:o})=>{const[i,c]=g.useState(""),l=g.useRef(null);g.useEffect(()=>{s&&c(t??"")},[s,t]);const u=()=>{Ms(e,i),o(!1)},d=()=>{c(""),o(!1)},h=x=>{c(x.target.value)},f=x=>{x.key==="Enter"&&(x.preventDefault(),u())};return n.jsxs(k.Popover.Root,{open:s,onOpenChange:o,children:[n.jsx(k.Popover.Trigger,{render:n.jsx(S.Toolbar.Button,{}),"aria-label":"Link","data-active":r,className:_s,onMouseDown:x=>x.preventDefault(),children:n.jsx(ks,{})}),n.jsx(k.Popover.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(k.Popover.Positioner,{sideOffset:6,align:"end",className:Ls,children:n.jsxs(k.Popover.Popup,{className:Fs,initialFocus:l,onMouseDown:x=>x.preventDefault(),children:[n.jsx("input",{ref:l,type:"url",value:i,placeholder:"Type or paste a link...","aria-label":"Link URL",className:Ns,onMouseDown:x=>x.stopPropagation(),onChange:h,onKeyDown:f}),n.jsx("button",{type:"button","aria-label":"Cancel",className:Me,onClick:d,children:n.jsx(ws,{})}),n.jsx("button",{type:"button","aria-label":"Apply link",className:Me,onClick:u,children:n.jsx(Ss,{})})]})})})})]})},Ms=(e,t)=>{const r=t.trim(),{selection:s}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!s.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=Es(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Os=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M17 12H7"}),n.jsx("path",{d:"M19 19H5"})]})}),Ds=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M21 12H9"}),n.jsx("path",{d:"M21 19H7"})]})}),Is=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M15 12H3"}),n.jsx("path",{d:"M17 19H3"})]})});var Bs="k91gos0",Rs="k91gos1";const Hs=6,H=({label:e,isActive:t,onToggle:r,children:s})=>{const o=i=>i.preventDefault();return n.jsxs(B.Tooltip.Root,{children:[n.jsx(B.Tooltip.Trigger,{render:n.jsx(pr.Toggle,{render:n.jsx(S.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:Bs,onMouseDown:o,children:s}),n.jsx(B.Tooltip.Portal,{container:D(),children:n.jsx(O,{children:n.jsx(B.Tooltip.Positioner,{sideOffset:Hs,children:n.jsx(B.Tooltip.Popup,{className:Rs,children:e})})})})]})},Gs=({editor:e,activeAlignment:t="left"})=>n.jsxs(n.Fragment,{children:[n.jsx(H,{label:"Align left",isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:n.jsx(Is,{})}),n.jsx(H,{label:"Align center",isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:n.jsx(Os,{})}),n.jsx(H,{label:"Align right",isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:n.jsx(Ds,{})})]});var $s="_1bp10ig0",V="_1bp10ig1",Q="_1bp10ig2";const zs=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:qs(e),textAlign:Vs(e)}),qs=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",Vs=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",Ws=8,Ys=8,Us=({editor:e})=>{const[t,r]=g.useState(!1),[s,o]=g.useState(null),i=s!==null,c=v=>m=>{o(m?v:null)},{refs:l,floatingStyles:u}=w.useFloating({placement:"top-start",strategy:"fixed",middleware:[w.offset(Ws),w.flip(),w.shift({padding:Ys})],whileElementsMounted:w.autoUpdate}),d=g.useRef(null),h=ve.useEditorState({editor:e,selector:zs}),f=g.useCallback(v=>{d.current=v,l.setFloating(v)},[l]);if(g.useEffect(()=>{e&&l.setReference(e.view.dom)},[e,l]),g.useEffect(()=>{if(!e)return;const v=()=>r(!0),m=({event:p})=>{const{relatedTarget:y,currentTarget:j}=p,C=y instanceof Node&&d.current?.contains(y),L=y instanceof Node&&j instanceof Node&&j.contains(y);!C&&!L&&r(!1)};return e.on("focus",v),e.on("blur",m),()=>{e.off("focus",v),e.off("blur",m)}},[e]),!e||!t&&!i)return null;const x=D();return x?xr.createPortal(n.jsx(O,{children:n.jsx(B.Tooltip.Provider,{children:n.jsxs(S.Toolbar.Root,{ref:f,className:$s,style:u,children:[n.jsxs(S.Toolbar.Group,{className:V,children:[n.jsx(ls,{editor:e,currentColor:h?.color??null,isOpen:s==="color",onOpenChange:c("color")}),n.jsx(bs,{editor:e,currentFontFamily:h?.fontFamily??null,isOpen:s==="fontFamily",onOpenChange:c("fontFamily")})]}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsx(S.Toolbar.Group,{className:V,children:n.jsx(js,{editor:e,activeStyle:h?.fontSize??"text",isOpen:s==="fontSize",onOpenChange:c("fontSize")})}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsxs(S.Toolbar.Group,{className:V,children:[n.jsx(H,{label:"Bold",isActive:h?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:n.jsx("strong",{children:"B"})}),n.jsx(H,{label:"Italic",isActive:h?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:n.jsx("em",{children:"I"})}),n.jsx(H,{label:"Underline",isActive:h?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:n.jsx("u",{children:"U"})})]}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsx(S.Toolbar.Group,{className:V,children:n.jsx(Gs,{editor:e,activeAlignment:h?.textAlign})}),n.jsx(S.Toolbar.Separator,{className:Q}),n.jsx(S.Toolbar.Group,{className:V,children:n.jsx(Ps,{editor:e,currentUrl:h?.linkUrl??null,isActive:h?.isLink??!1,isOpen:s==="link",onOpenChange:c("link")})})]})})}),x):null};var Xs="_2ngohc0";const Vt=({editor:e,ariaLabel:t})=>n.jsxs("div",{className:Xs,children:[n.jsx(Us,{editor:e}),n.jsx(ve.EditorContent,{editor:e,"aria-label":t})]}),Ks=(e,t)=>{const r=g.useRef(e);r.current=e;const s=g.useRef(t);s.current=t;const o=g.useRef(null),i=g.useRef(null),c=g.useMemo(()=>{const l=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null),o.current=null},u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null);const h=o.current;h!==null&&(o.current=null,r.current(...h))};return{run:(...h)=>{if(s.current<=0){r.current(...h);return}o.current=h,i.current!==null&&clearTimeout(i.current),i.current=setTimeout(u,s.current)},flush:u,cancel:l}},[]);return g.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]),c},Zs=200,Wt=({content:e,extensions:t,isEditable:r,onUpdate:s,updateDebounceMs:o=Zs})=>{const i=g.useRef(Oe(e)),c=g.useRef(!1),l=Ks(d=>{c.current=!0,s?.(d)},o),u=ve.useEditor({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:d})=>l.run(d.getJSON())});return g.useEffect(()=>{u?.setEditable(r)},[u,r]),g.useEffect(()=>{if(!u)return;if(c.current){c.current=!1;return}const d=Oe(e),h=u.getJSON();Js(h,d)||(l.cancel(),u.commands.setContent(d,{emitUpdate:!1}))},[u,e,l]),g.useEffect(()=>()=>l.flush(),[l]),u},Oe=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Js=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Qs=/^(?:https?:|mailto:)/i,Yt=e=>{if(typeof e!="string")return!1;const t=e.replace(/^[\x00-\x20]+/,"");return t.length===0?!1:Qs.test(t)};var eo="_1cocly40";const to={modern:"'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",timeless:"'Noto Serif', Georgia, 'Times New Roman', serif",fresh:"'Aeonik', 'Aeonik Fallback', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif",technical:"'PT Mono', 'Courier New', monospace",handwritten:"'Permanent Marker', cursive",fineliner:"'Intruding Cat', cursive",brand:"var(--brand-font-family), 'Aeonik', 'Inter', sans-serif"},ne=({content:e})=>n.jsx(n.Fragment,{children:Ut(e.content??[e])}),Ut=e=>e.map((t,r)=>ro(t,r)),ro=(e,t)=>{if(e.type==="text")return no(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return n.jsx("br",{},t);const r=e.content?Ut(e.content):null;switch(e.type){case"doc":return n.jsx(g.Fragment,{children:r},t);case"heading":{const s=io(e.attrs?.level);return lo(s,t,r,Ie(e.attrs))}case"paragraph":{const s=G(e.attrs?.variant);return n.jsx("p",{"data-variant":s??void 0,style:Xt(Ie(e.attrs)),children:r},t)}case"blockquote":return n.jsx("blockquote",{children:r},t);case"bulletList":case"bullet_list":return n.jsx("ul",{children:r},t);case"orderedList":case"ordered_list":return n.jsx("ol",{children:r},t);case"listItem":case"list_item":return n.jsx("li",{children:r},t);default:return n.jsx("span",{children:r},t)}},no=(e,t)=>{const r=e.text??"";return!e.marks||e.marks.length===0?n.jsx("span",{children:r},t):e.marks.reduceRight((s,o,i)=>so(o,s,`${t}-${i}`),r)},so=(e,t,r)=>{switch(e.type){case"bold":case"strong":return n.jsx("strong",{children:t},r);case"italic":case"em":return n.jsx("em",{children:t},r);case"underline":return n.jsx("u",{children:t},r);case"strike":case"strikethrough":case"s":return n.jsx("s",{children:t},r);case"code":return n.jsx("code",{children:t},r);case"link":{const s=G(e.attrs?.href);return Yt(s)?n.jsx("a",{className:eo,href:s,rel:"noopener noreferrer",target:"_blank",children:t},r):n.jsx("span",{children:t},r)}case"textStyle":{const s=oo(e.attrs);return s?n.jsx("span",{style:s,children:t},r):n.jsx("span",{children:t},r)}default:return n.jsx("span",{children:t},r)}},De=e=>{const t=G(e&&typeof e=="object"?e.fontFamily:e);if(t)return to[t]??t},oo=e=>{if(!e)return null;const t={},r=G(e.color);r&&(t.color=r);const s=De(e.font)??De(e.fontFamily);s&&(t.fontFamily=s);const o=ao(e.fontSize);return o&&(t.fontSize=o),Object.keys(t).length>0?t:null},ao=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:G(e),G=e=>typeof e=="string"&&e.length>0?e:void 0,io=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),lo=(e,t,r,s)=>{const o=Xt(s);switch(e){case 1:return n.jsx("h1",{style:o,children:r},t);case 2:return n.jsx("h2",{style:o,children:r},t);case 3:return n.jsx("h3",{style:o,children:r},t)}},Ie=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},Xt=e=>e?{textAlign:e}:void 0;var co="_4dlrid0",Kt="_4dlrid1",uo="xfz7dq0",ho="xfz7dq1",go="xfz7dq2",xo="xfz7dq3",fo="xfz7dq4";const po=({ref:e,footerRect:t,mode:r="readonly"})=>{const{caption:s,isCaptionVisible:o,source:i,isSourceVisible:c}=a.useCompiledSelector(_.useShallow(h=>({caption:h.config.content.caption,isCaptionVisible:h.config.content.isCaptionVisible,source:h.config.content.source,isSourceVisible:h.config.content.isSourceVisible}))),l=r==="editable",u=o&&(l||s!==null),d=c&&i!==null&&bo(i);return!u&&!d?null:n.jsxs("div",{ref:e,className:uo,style:{left:t.x,top:t.y,width:t.width},children:[u?l?n.jsx(jo,{caption:s}):n.jsx(mo,{caption:s}):null,d&&n.jsx(vo,{source:i})]})},mo=({caption:e})=>e===null?null:typeof e=="string"?n.jsx("p",{className:Kt,children:e}):n.jsx(ne,{content:e}),vo=({source:e})=>{const t=Yt(e.url)?e.url:void 0,r=e.label??(t!==void 0?yo(t):"");return r===""&&t===void 0?null:n.jsxs("div",{className:ho,children:[n.jsx("span",{className:xo,children:"Source:"}),t!==void 0?n.jsx("a",{className:go,href:t,target:"_blank",rel:"noopener noreferrer",children:r}):n.jsx("span",{className:fo,children:r})]})},yo=e=>{try{return new URL(e).hostname}catch{return e}},bo=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",jo=({caption:e})=>{const t=a.useGraphCommandDispatcher(),r=g.useMemo(()=>Sn({placeholder:"Add caption"}),[]),s=Wt({content:e,extensions:r,isEditable:!0,onUpdate:o=>{const i=As(o)?null:o;t(new b.SetContentCaptionCommand({caption:i}))}});return n.jsx(Vt,{editor:s,ariaLabel:"Chart caption"})};var To="_1k4qtbg0";const Co=3,So=({title:e,isTitleVisible:t,subtitle:r,isSubtitleVisible:s})=>{const o=[];return t&&o.push({type:"heading",attrs:{level:Co},content:wo(e)}),s&&o.push(...Ao(r)),{type:"doc",content:o}},ko=e=>{const t=e.content??[],[r,...s]=t;return{title:Eo(r?.content??[]),subtitle:_o(s)}},Se=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(Se)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),wo=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],Ao=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(Be):[Be(e)],Be=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Eo=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(Se)}},_o=e=>{const t=e.filter(s=>(s.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const s=r.content??[],[o]=s;if(o&&s.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:t.map(Se)}},Lo=({ref:e,headerRect:t,mode:r="readonly"})=>{const{title:s,isTitleVisible:o,subtitle:i,isSubtitleVisible:c}=a.useCompiledSelector(_.useShallow(h=>({isTitleVisible:h.config.content.isTitleVisible,isSubtitleVisible:h.config.content.isSubtitleVisible,title:h.config.content.title,subtitle:h.config.content.subtitle}))),l=r==="editable";return!(o&&(l||s!==null))&&!(c&&(l||i!==null))?null:n.jsx("div",{ref:e,className:To,style:{left:t.x,top:t.y,width:t.width},children:l?n.jsx(No,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i},[o?"title":"",c?"subtitle":""].join("-")):n.jsx(Fo,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i})})},Fo=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=t&&e!==null,i=r&&s!==null;return n.jsxs(n.Fragment,{children:[o&&(typeof e=="string"?n.jsx("h1",{className:co,children:e}):n.jsx(ne,{content:e})),i&&(typeof s=="string"?n.jsx("p",{className:Kt,children:s}):n.jsx(ne,{content:s}))]})},No=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=a.useGraphCommandDispatcher(),i=g.useMemo(()=>Cn({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:r}),[t,r]),c=g.useMemo(()=>So({title:e,isTitleVisible:t,subtitle:s,isSubtitleVisible:r}),[e,t,s,r]),l=Wt({content:c,extensions:i,isEditable:!0,onUpdate:u=>{const d=ko(u);t&&o(new b.SetContentTitleCommand({title:d.title})),r&&o(new b.SetContentSubtitleCommand({subtitle:d.subtitle}))}});return n.jsx(Vt,{editor:l,ariaLabel:"Chart title and subtitle"})};var Po="_1u9qprb0",Mo="_1u9qprb1",Oo="_9aen060",Do="_9aen061",Io="_9aen062",Zt="_9aen063";const Bo=Object.freeze(Object.defineProperty({__proto__:null,groupRow:Io,item:Zt,trendRow:Do,valueRow:Oo},Symbol.toStringTag,{value:"Module"})),Ro=e=>n.jsx(N,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"m5 12 7-7 7 7"}),n.jsx("path",{d:"M12 19V5"})]})}),Ho=e=>n.jsx(N,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M5 12h14"})})});var Jt="n7clvo0",Go="n7clvo1",$o="n7clvo2",zo="n7clvo3",Qt={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},qo={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},Vo={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},Wo={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const Yo=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return n.jsx(a.Swatch,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return n.jsx("div",{className:Wo[e.direction],children:e.direction==="flat"?n.jsx(Ho,{size:"xs",title:""}):n.jsx(Ro,{size:"xs",title:""})});const r=e.fontRole==="value"?Qt[t]:qo[t];return n.jsx("span",{className:E.clsx(Uo(e),r),children:e.text})},Uo=e=>{switch(e.textRole){case"value":return Jt;case"observation":return Go;case"trendPercentage":return Vo[e.trendDirection??"up"];case"trendReference":return $o;case"label":return zo}},Xo=({item:e,resolvedSize:t})=>n.jsx("div",{className:Zt,children:ut(e).map(r=>n.jsx(Ko,{row:r,resolvedSize:t},r.role))}),Ko=({row:e,resolvedSize:t})=>{const r=e.role==="trendRow";return n.jsx("div",{className:Bo[e.role],"data-testid":r?"headline-trend":void 0,"data-direction":r?Zo(e):void 0,role:r?"img":void 0,"aria-label":r?e.ariaLabel:void 0,children:e.segments.map((s,o)=>n.jsx(Yo,{segment:s,resolvedSize:t},o))})},Zo=e=>{const t=e.segments.find(r=>r.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},Jo=({headline:e,rect:t,resolvedSize:r,visibleItemCount:s})=>{const o={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?n.jsx("div",{className:Mo,style:o,children:n.jsx("span",{className:E.clsx(Jt,Qt[r]),children:e.value})}):n.jsx("div",{className:Po,style:o,children:e.items.slice(0,s).map((i,c)=>n.jsx(Xo,{item:i,resolvedSize:r},`${i.label}-${c}`))})};var Qo="_1oj6yix0",ea="_1oj6yix1",ta="_1oj6yix2";const ra=8,na=16,sa=2,oa=({legends:e,containerRect:t,textScale:r})=>{const{lineBoxHeight:s}=Tt(r),{placements:o,hasOverlap:i}=aa(e,t,s);if(o.length===0)return null;const c=i?na:ra,l=c-sa;return n.jsxs("div",{className:Qo,children:[i&&n.jsx("svg",{className:ea,width:t.width,height:t.height,children:o.map(u=>n.jsx(ia,{anchorY:u.anchorY,labelY:u.y,endX:l,color:u.payload.color},u.payload.key))}),o.map(u=>n.jsx("span",{className:ta,style:{left:c,top:u.y,color:u.payload.color},children:u.payload.label},u.payload.key))]})},aa=(e,t,r)=>g.useMemo(()=>{const s=[];for(const o of e)for(const i of o.items){if(i.normalizedY===null)continue;const c=typeof i.visual.color=="string"?i.visual.color:void 0;s.push({normalizedY:i.normalizedY,payload:{key:String(s.length),label:i.formattedLabel,color:c}})}return s.length===0||t.height<=0?{placements:[],hasOverlap:!1}:b.computeDirectLabelsLayout({items:s,containerHeight:t.height,labelHeight:r})},[e,t.height,r]),ia=({anchorY:e,labelY:t,endX:r,color:s})=>{const o=r/2;return n.jsx("path",{d:`M0,${e} C${o},${e} ${o},${t} ${r},${t}`,fill:"none",stroke:s??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var la="_6a636s0",ca="_1kjk02r0",ua="_1kjk02r1",da="_1kjk02r2",ha="_1kjk02r3",ga="_1kjk02r4",xa="_1kjk02r5",fa="_1kjk02r6",pa="_1kjk02r7",ma="_1kjk02r8",va="_1kjk02r9",ya="_1kjk02ra",ba="_1kjk02rb",ja="_1dw9dgx0";const Ta="#9ca3af",ce="\0",Ca=e=>{const t=[];return e.forEach((r,s)=>{const o=r.aesthetics.includes("size");for(const i of r.items){if(o){const d=Number(i.visual.size);if(!Number.isFinite(d)||d<=0)continue}const c=i.visual.color??"",l=o?`${ce}${Number(i.visual.size)}`:"",u=i.visual.lineType;t.push({key:`${s}${ce}${String(i.value)}${ce}${c}${l}`,formattedLabel:i.formattedLabel,visual:i.visual,swatchShape:i.swatchShape,isBubble:o,primaryLineType:u})}}),t},er=({pill:e})=>e.isBubble?n.jsx(wa,{pill:e}):n.jsx(ka,{pill:e}),Sa=({color:e,lineType:t,shape:r})=>e?n.jsx(a.Swatch,{shape:r,color:e,lineType:t,width:gt,height:be}):null,ka=({pill:e})=>n.jsxs(n.Fragment,{children:[n.jsx(Sa,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),n.jsx("span",{children:e.formattedLabel})]}),wa=({pill:e})=>{const t=Number(e.visual.size);return n.jsxs(n.Fragment,{children:[n.jsx("span",{className:ja,style:{width:t,height:t,backgroundColor:e.visual.color??Ta}}),n.jsx("span",{children:e.formattedLabel})]})},Aa=({hiddenPills:e,placement:t})=>{const[r,s]=g.useState(!1),{refs:o,floatingStyles:i}=w.useFloating({open:r,placement:t,middleware:[w.offset(4),w.flip(),w.shift({padding:8})]});g.useEffect(()=>{if(!r)return;const d=f=>{const x=f.target;if(!x)return;const v=o.reference.current,m=o.floating.current;v instanceof Element&&v.contains(x)||m instanceof Element&&m.contains(x)||s(!1)},h=f=>{f.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",d),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("keydown",h)}},[r,o.floating,o.reference]);const c=t==="left"||t==="right",l=Math.min(e.length-1,pt),u=Array.from({length:l},(d,h)=>l-h);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{ref:o.setReference,className:E.clsx(ca,{[da]:c,[ua]:!c}),children:[u.map(d=>n.jsx("span",{className:E.clsx(ha,{[xa]:c,[ga]:!c}),style:Ea(d,c),"aria-hidden":!0},d)),n.jsx("button",{type:"button",className:E.clsx(fa,{[pa]:r}),onClick:()=>s(d=>!d),"aria-haspopup":"dialog","aria-expanded":r,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:n.jsxs("span",{className:ma,children:["+",e.length]})})]}),r&&n.jsx("div",{ref:o.setFloating,role:"dialog","aria-label":"Hidden legend items",className:va,style:i,children:n.jsx("ul",{className:ya,children:e.map(d=>n.jsx("li",{className:ba,children:n.jsx(er,{pill:d})},d.key))})})]})},Ea=(e,t)=>{const r=-e*mt;return{transform:t?`translateY(${r}px)`:`translateX(${r}px)`}};var _a="_1cecisi0",La="_1cecisi1",Fa="_1cecisi2",Na="_1cecisi3";const Pa=({edge:e,formattedLegends:t,containerWidth:r,containerHeight:s,textScale:o})=>{const i=a.useTextMeasurer(),c=g.useMemo(()=>Ca(t),[t]),l=e==="left"||e==="right",u=l?s:r,d=g.useMemo(()=>{if(c.length===0)return{visibleCount:0,hasOverflow:!1};if(u<=0)return{visibleCount:c.length,hasOverflow:!1};const v=a.emToPx(vt,o),m={family:bt,size:v},p=v*yt,y=$=>l?Ma($,p):Re({label:$.formattedLabel,swatchInlineSize:Oa($),textMeasurer:i,font:m}),j=c.map(y),L=(l?p+je:Re({label:`+${c.length}`,swatchInlineSize:0,textMeasurer:i,font:m}))+mn;return Ia({pillSizes:j,overflowPillSize:L,containerSize:u,gap:xn})},[c,u,l,i,o]);if(c.length===0)return null;const h=c.slice(0,d.visibleCount),f=c.slice(d.visibleCount),x=d.hasOverflow&&f.length>0;return n.jsxs("div",{className:E.clsx(_a,{[Fa]:l,[La]:!l}),children:[h.map(v=>n.jsx("div",{className:Na,children:n.jsx(er,{pill:v})},v.key)),x&&n.jsx(Aa,{hiddenPills:f,placement:Ba(e)})]})},Re=({label:e,swatchInlineSize:t,textMeasurer:r,font:s})=>{const o=r.measureText(e,s).width,i=t>0?xt:0;return t+i+o+jt},Ma=(e,t)=>{const r=Da(e);return Math.max(t,r)+je},Oa=e=>e.isBubble?Number(e.visual.size):Ct(e.visual.color),Da=e=>e.isBubble?Number(e.visual.size):be,Ia=({pillSizes:e,overflowPillSize:t,containerSize:r,gap:s})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let o=0;for(let l=0;l<e.length;l+=1)l>0&&(o+=s),o+=e[l]??0;if(o<=r)return{visibleCount:e.length,hasOverflow:!1};let i=0,c=0;for(const l of e){const u=i+(c>0?s:0)+l;if(u+s+t>r)break;i=u,c+=1}return{visibleCount:c,hasOverflow:!0}},Ba=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Ra=g.memo(function({formattedLegends:t,rects:r,textScale:s}){const o=g.useMemo(()=>{const i=new Map;for(const c of t){let l=i.get(c.position);l||(l={pill:[],direct:[]},i.set(c.position,l)),c.display==="pill"?l.pill.push(c):l.direct.push(c)}return i},[t]);return n.jsx(n.Fragment,{children:Array.from(o,([i,c])=>{const l=r[i];return l===void 0?null:n.jsxs("div",{className:la,style:{left:l.x,top:l.y,width:l.width,height:l.height},children:[n.jsx(Pa,{edge:i,formattedLegends:c.pill,containerWidth:l.width,containerHeight:l.height,textScale:s}),n.jsx(oa,{legends:c.direct,containerRect:l,textScale:s})]},i)})})}),Ha=(e,t,r)=>{const s=e.filter(i=>i.interactive);if(s.length===0)return null;const o=s.map(i=>r(i,t)).filter(i=>i!==null).map(i=>i.guideMode);return o.length===0?null:o.some(i=>i==="bar")?"bar":o.every(i=>i==="continuous")?"continuous":null};function Ga(e,t){const r=b.getMainAxisCoordinate(e.mainAxis,t);if(e.mainAxis==="y"){const o=a.toPercent(a.toViewBoxY(r));return{x1:0,x2:"100%",y1:o,y2:o}}const s=a.toPercent(a.toViewBoxX(r));return{x1:s,x2:s,y1:0,y2:"100%"}}function $a(e,t,r){const s=e.mainAxis==="y"?b.getY(r.observation):b.getX(r.observation);if(s===null)return null;const o=e.mainAxis==="y"?qa(r):za(r),c=(t.x?.kind==="position"?t.x:null)?.bandwidth??o;if(c===null||c<=0)return null;const l=c/2;if(e.mainAxis==="y"){const h=a.toPercent(a.toViewBoxY(s+l)),f=a.toPercent(c);return{x:0,y:h,width:"100%",height:f}}const u=a.toPercent(a.toViewBoxX(s-l)),d=a.toPercent(c);return{x:u,y:0,width:d,height:"100%"}}function za(e){const t=b.getXMin(e.observation),r=b.getXMax(e.observation);return t===null||r===null?null:r-t}function qa(e){const t=b.getYMin(e.observation),r=b.getYMax(e.observation);return t===null||r===null?null:r-t}const Va=1,Wa="4 3",Ya=({panelRect:e})=>{const{coordSystem:t,layers:r,scales:s}=a.useCompiledSelector(_.useShallow(l=>({coordSystem:l.coordSystem,layers:l.layers,scales:l.scales}))),o=W(l=>l.hover.primary),i=a.useResolveGeomPlugin();if(t.type!=="cartesian"||r.length===0||o===null)return null;const c=Ha(r,t,i);return c===null?null:c==="bar"?n.jsx(Xa,{coordSystem:t,scales:s,primary:o,panelRect:e}):n.jsx(Ua,{coordSystem:t,primary:o,panelRect:e})},Ua=({coordSystem:e,primary:t,panelRect:r})=>{const s=Ga(e,t);return n.jsx(tr,{panelRect:r,children:n.jsx("line",{...s,stroke:a.vars.hoverGuideLineColor,strokeWidth:Va,strokeDasharray:Wa,strokeLinecap:"round","data-testid":"hover-guide-line"})})},Xa=({coordSystem:e,scales:t,primary:r,panelRect:s})=>{const o=$a(e,t,r);return o===null?null:n.jsx(tr,{panelRect:s,children:n.jsx("rect",{...o,fill:a.vars.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},tr=({panelRect:e,children:t})=>n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,style:{overflow:"visible",pointerEvents:"none"},"data-testid":"hover-guide",children:t}),Ka=200,Za=({engine:e,store:t,overlayRef:r,setCursor:s=Ja})=>{g.useEffect(()=>{const o=r.current;if(!o)return;const i=Qa(o,e),c=ei(o,e,t,s);return()=>{c(),i()}},[e,t,r,s])},Ja=()=>{},Qa=(e,t)=>{const r=()=>{const c=e.getBoundingClientRect();c.width===0||c.height===0||t.setViewport({width:c.width,height:c.height})};let s=null;const o=()=>{s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,r()},Ka)},i=new ResizeObserver(o);return i.observe(e),r(),()=>{i.disconnect(),s!==null&&clearTimeout(s)}},ei=(e,t,r,s)=>{let o=null,i=null;const c=()=>{i=null;const d=o;if(o=null,!d)return;s({clientX:d.clientX,clientY:d.clientY});const h=e.getBoundingClientRect();if(h.width===0||h.height===0)return;const f={x:(d.clientX-h.left)/h.width,y:1-(d.clientY-h.top)/h.height};r.getState().setHoverState(t.query(f))},l=d=>{o=d,i===null&&(i=requestAnimationFrame(c))},u=()=>{o=null,i!==null&&(cancelAnimationFrame(i),i=null),s(null);const d=r.getState();d.hover.primary!==null&&d.setHoverState(b.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",l),e.addEventListener("pointerleave",u),()=>{e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",u),i!==null&&cancelAnimationFrame(i),o=null}},ti=({panelRect:e})=>{const{engine:t,store:r,overlayRef:s,setCursor:o}=a.useHoverContext();return Za({engine:t,store:r,overlayRef:s,setCursor:o}),n.jsx("rect",{ref:s,x:e.x,y:e.y,width:e.width,height:e.height,fill:"transparent",pointerEvents:"all","data-testid":"pointer-capture-layer"})},ue="data-hover-active",ri=e=>{const{store:t}=a.useHoverContext(),r=ee.useStore(t,s=>s.hover.primary!==null);g.useEffect(()=>{const s=e.current;if(s)return r?s.setAttribute(ue,"true"):s.removeAttribute(ue),()=>{s.removeAttribute(ue)}},[e,r])},He=({panelRect:e,zOrder:t})=>{const r=a.useCompiledSelector(c=>c.annotations.custom),s=a.useResolveAnnotationPlugin(),o=r.filter(c=>{const l=s(c.type);return l!==null&&(c.zOrder??l.zOrder)===t});if(o.length===0)return null;const i={width:e.width,height:e.height};return n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`custom-annotations-${t}`,children:o.map(c=>{const l=s(c.type);return l===null?null:n.jsx("g",{"data-annotation-type":c.type,children:l.draw({targets:c.targets,area:i,params:c.params})},c.id)})})},rr=a.FONT_SIZE_EM.xs,me=a.DEFAULT_FONT_FAMILY,nr=a.FONT_WEIGHT.medium,ni=a.FONT_WEIGHT.semibold,sr=6,or=2,si=4,oi=2,Ge=4;var ai="_1agclyl0",ii="_1agclyl1",li="_1agclyl2",ci={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},ui="_1agclyl6 _1agclyl3";const ar=({x:e,y:t,width:r,height:s,text:o,isRotated:i,target:c,position:l,coordType:u})=>{const d=i?`rotate(-90 ${e} ${t})`:void 0,h=c==="aggregate"?ui:ci[l],f=di(c,l,u);return n.jsxs("g",{transform:d,children:[f&&n.jsx("rect",{className:f,x:e-r/2,y:t-s/2,width:r,height:s,rx:Ge,ry:Ge}),n.jsx("text",{className:h,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:o})]})},di=(e,t,r)=>{if(e==="aggregate")return li;if(t==="outside"&&r==="cartesian")return ii},hi={dataLabel:{x:sr,y:or},stackTotal:{x:si,y:oi}},gi=({panelRect:e,formattingLocale:t})=>{const r=a.useTextMeasurer(),s=a.useCompiledSelector(_.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem,axes:l.guides.axes,numberFormat:l.config.numberFormat,parsingLocale:l.config.parsingLocale,textScale:l.config.appearance.textScale}))),o=g.useMemo(()=>{const l=a.emToPx(rr,s.textScale);return{dataLabel:{family:me,size:l,weight:nr},stackTotal:{family:me,size:l,weight:ni}}},[s.textScale]),i=g.useMemo(()=>(l,u)=>{const d=r.measureText(u,o[l]),h=hi[l];return{...d,width:d.width+h.x*2,height:d.height+h.y*2}},[r,o]),c=g.useMemo(()=>b.buildDataLabelsContent({...s,panelRect:e,measureDataLabel:i,formattingLocale:t}),[s,e,i,t]);return n.jsx("g",{className:ai,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(l=>n.jsx(ar,{x:l.x,y:l.y,width:l.width,height:l.height,text:l.text,isRotated:l.isRotated,target:l.target,position:l.position,coordType:s.coordSystem.type},l.key))})},xi=({linePath:e,arrowheadPath:t,stroke:r,strokeWidth:s})=>{const o={stroke:r,strokeWidth:s,strokeLinecap:"round",fill:"none"};return n.jsxs("g",{children:[n.jsx("path",{d:e,...o}),n.jsx("path",{d:t,...o,strokeLinejoin:"round"})]})},fi=({x:e,y:t,text:r,lineHeight:s,paddingX:o,paddingY:i,strokeWidth:c,strokeColor:l,fontWeight:u})=>{const d=a.useTextMeasurer(),f=g.useMemo(()=>d.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:s,weight:u}),[d,r,s,u]).width+o*2,x=s+i*2;return n.jsxs("g",{style:{pointerEvents:"none"},children:[n.jsx("rect",{x:e-f/2,y:t-x/2,width:f,height:x,rx:4,fill:a.vars.graphBackground,stroke:l,strokeWidth:c}),n.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:a.vars.textPrimary,style:{fontFamily:a.DEFAULT_FONT_FAMILY,fontSize:s,fontWeight:u},children:r})]})},pi=({panelRect:e,formattingLocale:t})=>{const r=a.useCompiledSelector(_.useShallow(o=>({differenceArrows:o.annotations.differenceArrows,mainAxis:o.coordSystem.type==="cartesian"?o.coordSystem.mainAxis:"x",textScale:o.config.appearance.textScale}))),s=g.useMemo(()=>r.differenceArrows.map(o=>b.computeDifferenceArrow({arrow:o,mainAxis:r.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:r.textScale,locale:t})),[r,e.width,e.height,t]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:s.map(({color:o,id:i,linePath:c,arrowheadPath:l,strokeWidth:u,labelPosition:d,labelText:h,labelLineHeight:f,labelPaddingX:x,labelPaddingY:v,labelStrokeWidth:m,labelFontWeight:p})=>{const y=o??a.vars.defaultAnnotationArrowStroke;return n.jsxs(g.Fragment,{children:[n.jsx(xi,{linePath:c,arrowheadPath:l,stroke:y,strokeWidth:u}),n.jsx(fi,{x:d.x,y:d.y,text:h,lineHeight:f,paddingX:x,paddingY:v,strokeWidth:m,strokeColor:y,fontWeight:p})]},i)})})},mi=0,vi=1.15,$e=1.15,yi="rgba(0, 0, 0, 0.16)",ze=2,bi=1.4,ji=({arrow:e,fallbackColor:t,stickerOutlineColor:r,stickerOutlineColorInverse:s})=>{const o=g.useId(),i=e.color??t,c=Ti(e.color,r,s),l=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},u=e.arrowheadExtent+e.strokeWidth+ze+$e,d={x:Math.min(e.startX,e.endX)-u,y:Math.min(e.startY,e.endY)-u,width:Math.abs(e.endX-e.startX)+2*u,height:Math.abs(e.endY-e.startY)+2*u},h=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(f=>f.length>0).join(" ");return n.jsxs("g",{children:[e.hasStickerStyle&&n.jsx("defs",{children:n.jsx("filter",{id:o,filterUnits:"userSpaceOnUse",...d,children:n.jsx("feDropShadow",{dx:mi,dy:vi,stdDeviation:$e,floodColor:yi})})}),n.jsxs("g",{filter:e.hasStickerStyle?`url(#${o})`:void 0,children:[e.hasStickerStyle&&n.jsx("path",{d:h,stroke:c,strokeWidth:e.strokeWidth+2*ze,strokeLinecap:"round",fill:"none"}),n.jsx("path",{d:e.linePath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...l}),e.startArrowheadPath.length>0&&n.jsx("path",{d:e.startArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&n.jsx("path",{d:e.endArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},Ti=(e,t,r)=>{if(e===null)return r;try{return mr.getContrast(e,t)<bi?r:t}catch{return r}},Ci=({panelRect:e})=>{const{themeValues:t}=Ce(),r=a.useCompiledSelector(o=>o.annotations.freeformArrows),s=g.useMemo(()=>r.map(o=>b.computeFreeformArrow({arrow:o,panelWidth:e.width,panelHeight:e.height})).filter(o=>o!==null),[r,e.width,e.height]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:s.map(o=>n.jsx(ji,{arrow:o,fallbackColor:a.vars.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},o.id))})},Si=({edge:e,areTicksVisible:t,position:r,labelRotation:s,label:o})=>{const i=a.toPercent(r),c=t?1:0,l={style:{font:a.vars.fontTickLabel},fill:a.vars.textSecondary},u=s!==0&&(e==="top"||e==="bottom"),d=e==="top";return u?n.jsx("svg",{x:i,y:d?"100%":0,style:{overflow:"visible"},children:n.jsx("text",{...wi(d,c,s),...l,children:o})}):n.jsx("text",{...ki(e,i,c),...l,children:o})},ki=(e,t,r)=>{switch(e){case"bottom":return{x:t,y:P*r,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-P*r,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-P*r,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:P*r,y:t,textAnchor:"start",dominantBaseline:"central"}}},wi=(e,t,r)=>{const s=P*t,o=e?-s:s;return{x:0,y:o,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${r}, 0, ${o})`}},Ai=({formattedAxis:e,rect:t})=>{const r=e.position==="bottom"||e.position==="top";return n.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[ct,e.ticks.map((s,o)=>{const i=s.formattedLabel,c=r?s.position:1-s.position,l=Ei(e.position,c,t);return n.jsxs("g",{children:[e.ticksVisible&&n.jsx("line",{...l,stroke:a.vars.gridLineColor,strokeWidth:1}),n.jsx(Si,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:i})]},o)})]})},Ei=(e,t,r)=>{const s=a.toPercent(t);switch(e){case"bottom":return{x1:s,y1:0,x2:s,y2:Z};case"top":return{x1:s,y1:r.height,x2:s,y2:r.height-Z};case"left":return{x1:r.width,y1:s,x2:r.width-Z,y2:s};case"right":return{x1:0,y1:s,x2:Z,y2:s}}},_i=({formattedAxes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];return!s||!r.isVisible?null:n.jsx(Ai,{formattedAxis:r,rect:s},r.scaleAestheticKey)})}),Li=({axes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];if(!s||!r.isVisible)return null;const o=Fi(r.position,s);return n.jsxs("g",{transform:`translate(${s.x}, ${s.y})`,children:[ct,n.jsx("text",{style:{font:a.vars.fontAxisLabel},fill:a.vars.textPrimary,...o,children:r.label})]},`axis-label-${r.position}`)})}),Fi=(e,t)=>{const r={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(r.x=0,r.textAnchor="start"):e==="right"&&(r.x=t.width,r.textAnchor="end"),r},qe={strokeWidth:1,strokeDashoffset:"0",strokeDasharray:"2 3",strokeLinecap:"round"},Ni=({axes:e,panel:t,panelRect:r})=>n.jsxs("svg",{x:r.x,y:r.y,width:r.width,height:r.height,style:{overflow:"visible"},children:[t.border.isVisible&&n.jsx("rect",{x:0,y:0,width:r.width,height:r.height,fill:"none",stroke:a.vars.gridLineColor,rx:8,ry:8,...qe}),e.map(s=>{if(!s.gridVisible)return null;const o=s.position==="bottom"||s.position==="top";return n.jsx("g",{children:s.ticks.map((i,c)=>{if(i.position<=0||i.position>=1)return null;const l=o?i.position:1-i.position,u=a.toPercent(l),d=o?{x1:u,y1:0,x2:u,y2:"100%"}:{x1:0,y1:u,x2:"100%",y2:u};return n.jsx("line",{...d,...qe,stroke:a.vars.gridLineColor},c)})},s.scaleAestheticKey)})]}),Ve=8,We=.5,Ye={strokeWidth:1,strokeLinecap:"round"},Pi=({axes:e,panelRect:t,coordSystem:r})=>{const s=e.find(p=>p.geometry==="circular"),o=e.find(p=>p.geometry==="radial");if(!s||s.ticks.length===0)return null;const i=t.x+t.width/2,c=t.y+t.height/2,l=Math.min(t.width,t.height)/2,{startAngle:u,innerRadius:d}=r,h=p=>p*2*Math.PI+u,f=(p,y)=>{const j=i+y*Math.sin(p),C=c-y*Math.cos(p);return`${j.toFixed(2)},${C.toFixed(2)}`},x=s.ticks.map(p=>h(p.position)),v=p=>`${x.map((y,j)=>`${j===0?"M":"L"} ${f(y,p)}`).join(" ")} Z`,m=(o?.ticks??[]).map(p=>(d+p.position*(1-d))*l).filter(p=>p>We);return m.some(p=>Math.abs(p-l)<We)||m.push(l),n.jsxs("g",{"data-guide":"polar",style:{overflow:"visible"},children:[m.map((p,y)=>n.jsx("path",{d:v(p),fill:"none",stroke:a.vars.gridLineColor,...Ye},`ring-${y}`)),x.map((p,y)=>n.jsx("line",{x1:i,y1:c,x2:i+l*Math.sin(p),y2:c-l*Math.cos(p),stroke:a.vars.gridLineColor,...Ye},`spoke-${y}`)),s.ticks.map((p,y)=>{const j=h(p.position),C=Math.sin(j),L=-Math.cos(j);return n.jsx("text",{x:i+C*(l+Ve),y:c+L*(l+Ve),textAnchor:C>.1?"start":C<-.1?"end":"middle",dominantBaseline:L>.1?"hanging":L<-.1?"auto":"central",style:{font:a.vars.fontTickLabel},fill:a.vars.textSecondary,children:p.formattedLabel},`label-${y}`)})]})},Ue=({panelRect:e,zOrder:t})=>{const s=a.useCompiledSelector(o=>o.annotations.shapes).filter(o=>o.zOrder===t);return s.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:s.map(({id:o,x:i,y:c,width:l,height:u,fillColor:d,fillOpacity:h,strokeWidth:f,strokeColor:x})=>n.jsx("rect",{x:a.toPercent(i),y:a.toPercent(c),width:a.toPercent(l),height:a.toPercent(u),fill:d,fillOpacity:h,stroke:f>0?x??a.vars.defaultAnnotationShapeStroke:"none",strokeWidth:f},o))})};var Mi="_120wioc0";const Oi=({panelRect:e})=>{const t=a.useCompiledSelector(r=>r.annotations.textAnnotations);return t.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(r=>n.jsx("foreignObject",{x:a.toPercent(r.x),y:a.toPercent(r.y),width:a.toPercent(r.width),height:a.toPercent(1-r.y),overflow:"visible",children:n.jsx("div",{className:Mi,style:Di(r.backgroundColor,r.backgroundColorStyle),children:n.jsx(ne,{content:r.content})})},r.id))})},Di=(e,t)=>e===null||e==="transparent"?{color:a.vars.textPrimary}:t==="fade"?{color:a.vars.textPrimary,backgroundColor:xe(e,a.vars.grey100,.5),boxShadow:`0 0 0 1.5px ${xe(e,a.vars.grey0,.2)}`}:{color:a.vars.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${se(e,.1)}`};var Ii="usd3ea0",Bi="usd3ea1";const Ri=({layer:e,coordSystem:t,isAnimated:r,isDimmed:s,highlightStyle:o,formattingLocale:i})=>{const l=a.useResolveGeomPlugin()(e,t);return l===null?n.jsxs("text",{children:[e.geom," not implemented"]}):n.jsx("g",{className:E({[Bi]:s&&o==="desaturate",[Ii]:s&&o==="dim"}),children:l.render({layer:e,coordSystem:t,isAnimated:r,formattingLocale:i})})};function Hi({plugin:e,layer:t,coordSystem:r,candidates:s}){if(e?.getOverlayAnchor===void 0||s.length===0)return[];const o=[];for(const{observation:i,observationIndex:c}of s){const l=e.getOverlayAnchor({layer:t,coordSystem:r,observation:i});l!==null&&o.push({observation:i,observationIndex:c,anchor:l})}return o}const Gi=4,$i=({plugin:e,layer:t,matchedLayer:r,overlayCandidates:s,coordSystem:o,isAnimated:i,panelRect:c,formattingLocale:l})=>{const{numberFormat:u,textScale:d}=a.useCompiledSelector(_.useShallow(m=>({numberFormat:m.config.numberFormat,textScale:m.config.appearance.textScale}))),h=g.useMemo(()=>Hi({plugin:e,layer:t,coordSystem:o,candidates:s}),[e,t,o,s]),f=g.useMemo(()=>b.createSegmentYReader(t),[t]),x=g.useMemo(()=>b.buildLayerYValueFormatter({layer:t,numberFormat:u,locale:l}),[u,t,l]),v=rr*a.ROOT_FONT_SIZE_PX*d;return e===null||r===null&&h.length===0?null:n.jsxs(n.Fragment,{children:[r?e.render({layer:r,coordSystem:o,isAnimated:i,formattingLocale:l}):null,h.map(({observation:m,observationIndex:p,anchor:y})=>n.jsx(zi,{observation:m,anchor:y,panelRect:c,readSegmentY:f,formatYValue:x,labelFontSizePx:v},qi(m,p)))]})},zi=({observation:e,anchor:t,panelRect:r,readSegmentY:s,formatYValue:o,labelFontSizePx:i})=>{const c=a.useTextMeasurer(),l=a.toViewBoxX(t.x),u=a.toViewBoxY(t.y),d=(b.getSize(e)??a.DEFAULT_POINT_SIZE)/2,h=s(e),f=b.isDefined(h)?o(h,e):null,x=g.useMemo(()=>{if(f===null)return null;const v=c.measureText(f,{family:me,size:i,weight:nr});return{width:v.width+sr*2,height:v.height+or*2}},[f,c,i]);return n.jsxs(n.Fragment,{children:[n.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:a.toPercent(l),cy:a.toPercent(u),r:d,fill:b.getColor(e)}),f!==null&&x!==null&&n.jsx(ar,{x:l*r.width,y:u*r.height-d-Gi-x.height/2,width:x.width,height:x.height,text:f,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},qi=(e,t)=>{const r=e[b.GROUP_VARIABLES.group];return`${String(r??"")}\0${t}`},Vi=({layer:e,coordSystem:t,panelRect:r})=>{const s=a.useResolveGeomPlugin(),{primary:o,group:i,related:c}=W(_.useShallow(d=>({primary:d.hover.primary,group:d.hover.group,related:d.hover.related})));if(o===null)return null;const l=s(e,t);if(l===null)return null;const u=c.get(e.id)??[];return o.layerId===e.id?l.renderHover({layer:e,coordSystem:t,primary:o,group:i,related:u,panelRect:r}):u.length===0?null:l.renderHoverCompanions({layer:e,primary:o,related:u})};var Wi="to1jkx0",Yi="to1jkx1";const Ui=({shouldAnimate:e,panelRect:t,formattingLocale:r})=>{const{layers:s,coordSystem:o,highlightStyle:i}=a.useCompiledSelector(_.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,highlightStyle:c.config.appearance.highlightStyle})));return n.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:Wi,"data-testid":"geom-layers",children:s.map(c=>n.jsxs(g.Fragment,{children:[n.jsx(Zi,{layer:c,coordSystem:o,highlightStyle:i,shouldAnimate:e,panelRect:t,formattingLocale:r}),n.jsx(Vi,{layer:c,coordSystem:o,panelRect:t})]},`${c.id}-${Xi(o)}`))})},Xi=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,Ki=e=>{if(e.highlight!==null)return Yi},Zi=({layer:e,coordSystem:t,highlightStyle:r,shouldAnimate:s,panelRect:o,formattingLocale:i})=>{const c=a.useResolveGeomPlugin(),l=g.useMemo(()=>c(e,t),[c,e,t]),u=e.highlight;return n.jsxs("g",{className:Ki(e),children:[n.jsx(Ri,{layer:e,coordSystem:t,isAnimated:s,isDimmed:u?.composition.isDimmed??!1,highlightStyle:r,formattingLocale:i}),u!==null&&n.jsx($i,{plugin:l,layer:e,matchedLayer:u.composition.matchedLayer,overlayCandidates:u.composition.overlayCandidates,coordSystem:t,isAnimated:s,panelRect:o,formattingLocale:i})]})};var Ji="_17uhij30";const Qi=({formattedAxes:e,formattedPolarAxes:t,plotRect:r,panelRect:s,axisRects:o,axisLabelRects:i,shouldAnimate:c,formattingLocale:l})=>{const u=g.useRef(null);ri(u);const{axes:d,panelGuide:h,coordSystem:f}=a.useCompiledSelector(_.useShallow(y=>({axes:y.guides.axes,panelGuide:y.guides.panel,coordSystem:y.coordSystem}))),x=g.useMemo(()=>ir(s,r),[s,r]),v=g.useMemo(()=>Xe(o,r),[o,r]),m=g.useMemo(()=>Xe(i,r),[i,r]),p=g.useMemo(()=>d.filter(y=>y.geometry==="linear"),[d]);return n.jsxs("svg",{ref:u,className:Ji,width:r.width,height:r.height,style:{transform:`translate(${r.x}px, ${r.y}px)`},"data-testid":"plot",children:[n.jsx(Ni,{axes:e,panel:h,panelRect:x}),f.type==="polar"&&n.jsx(Pi,{axes:t,panelRect:x,coordSystem:f}),n.jsx(Ya,{panelRect:x}),n.jsx(_i,{formattedAxes:e,rects:v}),n.jsx(Li,{axes:p,rects:m}),n.jsx(Ue,{panelRect:x,zOrder:"background"}),n.jsx(He,{panelRect:x,zOrder:"background"}),n.jsx(Ui,{shouldAnimate:c,panelRect:x,formattingLocale:l}),n.jsx(gi,{panelRect:x,formattingLocale:l}),n.jsx(pi,{panelRect:x,formattingLocale:l}),n.jsx(Ue,{panelRect:x,zOrder:"foreground"}),n.jsx(He,{panelRect:x,zOrder:"foreground"}),n.jsx(Ci,{panelRect:x}),n.jsx(Oi,{panelRect:x}),n.jsx(ti,{panelRect:x})]})},ir=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),Xe=(e,t)=>{const r={};for(const[s,o]of Object.entries(e))r[s]=ir(o,t);return r},de={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},el=()=>{const[e,t]=g.useState(null),[r,s]=g.useState(null),[o,i]=g.useState(de);return g.useEffect(()=>{const c=()=>{const u=e?{width:e.offsetWidth,height:e.offsetHeight}:de.headerSize,d=r?{width:r.offsetWidth,height:r.offsetHeight}:de.footerSize;i(h=>tl(h,{headerSize:u,footerSize:d})?{headerSize:u,footerSize:d}:h)};c();const l=new ResizeObserver(c);return e&&l.observe(e),r&&l.observe(r),()=>l.disconnect()},[e,r]),{headerRef:t,footerRef:s,measurements:o}},tl=(e,t)=>e.headerSize.width!==t.headerSize.width||e.headerSize.height!==t.headerSize.height||e.footerSize.width!==t.footerSize.width||e.footerSize.height!==t.footerSize.height,rl=({appearance:e,isEditable:t,style:r,children:s})=>{const{theme:o,themeClass:i,inlineVarsStyle:c}=Ce(),l=Gn(e.border),u=Math.max(0,e.cornerRadius),d=u===0?0:u+l,h=g.useMemo(()=>{const v={...r,borderRadius:`${d}px`,...c},m=Hn(e.border,o);return m!==null&&(v.background=m),v},[r,d,c,e.border,o]),f=g.useMemo(()=>({inset:`${l}px`,borderRadius:`${u}px`}),[l,u]),x=t&&e.background.type==="solid"&&e.background.color==="transparent";return n.jsx("div",{"data-testid":"graph-wrapper",className:E(Vn,i),style:h,children:n.jsx("div",{"data-testid":"graph-inner",className:E(Yn,{[Un]:x}),style:f,children:s})})},nl=e=>n.jsx(a.HoverProvider,{children:n.jsx(a.TextMeasurerProvider,{children:n.jsx(sl,{...e})})}),sl=({width:e,height:t,isAnimated:r,showTooltips:s=!0,mode:o="readonly"})=>{const{axes:i,legends:c,numberFormat:l,parsingLocale:u,appearance:d,annotations:h,coordSystem:f,headline:x,headlineConfig:v}=a.useCompiledSelector(_.useShallow(F=>({axes:F.guides.axes,legends:F.guides.legends,numberFormat:F.config.numberFormat,parsingLocale:F.config.parsingLocale,appearance:F.config.appearance,annotations:F.annotations,coordSystem:F.coordSystem,headline:F.guides.headline,headlineConfig:F.config.headline}))),m=dr.useReducedMotion(),{headerRef:p,footerRef:y,measurements:j}=el(),{formattingLocale:C,theme:L,themeOverrides:$}=a.useGraphContext(),ke=g.useMemo(()=>b.formatLegends({legends:c,numberFormat:l,parsingLocale:u,formattingLocale:C}),[c,l,u,C]),z=g.useMemo(()=>b.formatHeadline({headline:x,show:v.show,numberFormat:l,parsingLocale:u,formattingLocale:C}),[x,v.show,l,u,C]),lr=a.useTextMeasurer(),oe=d.border.type==="none"?0:d.border.width,ae=g.useMemo(()=>({width:Math.max(0,e-2*oe),height:Math.max(0,t-2*oe)}),[e,t,oe]),Y=g.useMemo(()=>z?{formatted:z,size:v.size,position:v.position,innerRadius:f.type==="polar"?f.innerRadius:0}:void 0,[z,v.size,v.position,f]),U=bn(lr,d.textScale),q=jn({measurer:U,axes:i,numberFormat:l,parsingLocale:u,formattedLegends:ke,containerSize:ae,externalMeasurements:j,headline:Y,formattingLocale:C,annotations:h,coordSystem:f,textScale:d.textScale}),X=g.useMemo(()=>!q||!Y||!U?null:b.resolveHeadlinePlacement({headline:Y,layout:q.layout,containerSize:ae,measurer:U,itemGap:it}),[q,Y,ae,U]);if(!q)return null;const{layout:M,formattedAxes:cr,formattedPolarAxes:ur}=q;return n.jsx(Nt,{theme:L,themeOverrides:$,appearance:d,children:n.jsxs(rl,{appearance:d,isEditable:o==="editable",style:{width:e,height:t},children:[n.jsx(Lo,{ref:p,headerRect:M.header,mode:o}),n.jsx(Qi,{formattedAxes:cr,formattedPolarAxes:ur,plotRect:M.plot,panelRect:M.panel,axisRects:M.axes,axisLabelRects:M.axisLabels,shouldAnimate:r??!m,formattingLocale:C??u}),n.jsx(po,{ref:y,footerRect:M.footer,mode:o}),n.jsx(Ra,{formattedLegends:ke,rects:M.legends,textScale:d.textScale}),z&&X&&n.jsx(Jo,{headline:z,rect:X.rect,resolvedSize:X.resolvedSize,visibleItemCount:X.visibleItemCount}),s&&n.jsx(Qr,{})]})})};exports.CanvasTextMeasurer=a.CanvasTextMeasurer;exports.GraphProvider=a.GraphProvider;exports.HoverProvider=a.HoverProvider;exports.TextMeasurerProvider=a.TextMeasurerProvider;exports.useCompiledSelector=a.useCompiledSelector;exports.useGraphCommandDispatcher=a.useGraphCommandDispatcher;exports.useTextMeasurer=a.useTextMeasurer;exports.vars=a.vars;exports.DevToolsPanel=Or;exports.GraphRenderer=nl;exports.ThemeProvider=Nt;exports.darkTheme=Ft;exports.lightTheme=Lt;exports.useHoverState=W;
|
package/dist/index.mjs
CHANGED
|
@@ -32,7 +32,7 @@ import { HexColorPicker as Hn, HexColorInput as Mn } from "react-colorful";
|
|
|
32
32
|
import { Menu as E } from "@base-ui/react/menu";
|
|
33
33
|
import { Toggle as Gn } from "@base-ui/react/toggle";
|
|
34
34
|
import { getContrast as $n } from "color2k";
|
|
35
|
-
typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.reactRenderer = "0.0.1-plugins.
|
|
35
|
+
typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.reactRenderer = "0.0.1-plugins.3");
|
|
36
36
|
var zn = "drqe3u0", Vn = "drqe3u1", Wn = "drqe3u2", qn = "drqe3u3", oe = "drqe3u4", Xn = "drqe3u5", jn = "drqe3u6", Yn = "drqe3u7", me = "drqe3u8", Un = "drqe3u9", Kn = "drqe3ua", Zn = "drqe3ub", Jn = "drqe3uc", Qn = "drqe3ud", eo = "drqe3ue", to = "drqe3uf", ro = "drqe3ug", no = "drqe3uh", oo = "drqe3ui", Ve = { enabled: "drqe3uk drqe3uj", disabled: "drqe3ul drqe3uj" }, We = { ran: "drqe3un drqe3um", dim: "drqe3uo drqe3um" }, Rt = { ran: "drqe3uq drqe3up", cached: "drqe3ur drqe3up", untouched: "drqe3us drqe3up" };
|
|
37
37
|
const ad = ({ width: e = 380, style: t, className: r } = {}) => {
|
|
38
38
|
const { compileBus: n } = _e(), [s] = P(() => kn()), [i, l] = P(!1), [a, d] = P(Wr);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphysdk/react-renderer",
|
|
3
3
|
"author": "Graphy",
|
|
4
|
-
"version": "0.0.1-plugins.
|
|
4
|
+
"version": "0.0.1-plugins.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"motion": "^12.23.12",
|
|
55
55
|
"react-colorful": "^5.6.1",
|
|
56
56
|
"zustand": "^5.0.12",
|
|
57
|
-
"@graphysdk/viz-engine": "0.0.1-plugins.
|
|
57
|
+
"@graphysdk/viz-engine": "0.0.1-plugins.3"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^19.0.0"
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"vite-plugin-dts": "^4.5.4",
|
|
78
78
|
"vitest": "^4.1.0",
|
|
79
79
|
"@graphytools/eslint-config": "0.0.1",
|
|
80
|
+
"@graphytools/eslint-plugin-graphy": "1.0.0",
|
|
81
|
+
"@graphysdk/viz-engine": "0.0.1-plugins.3",
|
|
80
82
|
"@graphytools/typescript-config": "0.0.1",
|
|
81
|
-
"@graphytools/vitest-config": "1.0.0"
|
|
82
|
-
"@graphysdk/viz-engine": "0.0.1-plugins.2",
|
|
83
|
-
"@graphytools/eslint-plugin-graphy": "1.0.0"
|
|
83
|
+
"@graphytools/vitest-config": "1.0.0"
|
|
84
84
|
},
|
|
85
85
|
"lint-staged": {
|
|
86
86
|
"*.{ts,tsx,js,jsx,json,css,md}": [
|