@graphysdk/react-renderer 0.0.1-experimental.6 → 0.0.1-experimental.7

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.
Files changed (3) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.mjs +1477 -1443
  3. package/package.json +5 -5
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  require('./index.css');
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),F=require("clsx"),g=require("react"),fe=require("zustand"),u=require("@graphysdk/viz-engine"),Qe=require("zustand/vanilla"),T=require("motion/react"),W=require("zustand/react/shallow"),$=require("@graphysdk/i18n/react"),M=require("@floating-ui/react-dom"),Dr=require("@tiptap/core"),Ot=require("@tiptap/extension-bold"),Xe=require("@tiptap/extension-document"),Gt=require("@tiptap/extension-hard-break"),zt=require("@tiptap/extension-heading"),Wt=require("@tiptap/extension-italic"),$t=require("@tiptap/extension-link"),Xt=require("@tiptap/extension-text"),qt=require("@tiptap/extension-text-align"),ne=require("@tiptap/extension-text-style"),Vt=require("@tiptap/extension-underline"),ke=require("@tiptap/extensions"),Or=require("@tiptap/extension-paragraph"),et=require("@tiptap/react"),w=require("@base-ui/react/toolbar"),te=require("@base-ui/react/tooltip"),Gr=require("react-dom"),zr=require("@vanilla-extract/dynamic"),A=require("@base-ui/react/popover"),ut=require("react-colorful"),H=require("@base-ui/react/menu"),Wr=require("@base-ui/react/toggle"),$r=require("d3-interpolate-path"),qe=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-experimental.6");const Xr=5,qr=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>Ur,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let n=null;return{emit:o=>{const a=e.getLastCompile();if(a){n=o;for(const s of t)s(o,a)}},subscribe:o=>(t.add(o),()=>{t.delete(o)}),getLastTrigger:()=>n,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Vr=()=>Qe.createStore(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,n)=>e(o=>{if(o.lastSnapshot===n)return o;const a={id:o.nextId,label:Yr(t),stages:n.stages,durationMs:n.durationMs};return{lastCompile:a,history:Kr(o.history,a,Xr),nextId:o.nextId+1,lastSnapshot:n}})})),Ur=()=>{},Yr=e=>{switch(e.kind){case"init":return"init";case"input":return"input change";case"data":return"data change";case"command":return e.command.metadata.description}},Kr=(e,t,n)=>{const o=e.length>=n?e.length-(n-1):0;return[...e.slice(o),t]},Jr=e=>Qe.createStore(t=>({compiled:e,setCompiled:n=>t(o=>o.compiled===n?o:{compiled:n})}));function Zr(e,t){const n=u.isGraphConfig(e)?e.themeOverrides:void 0;return g.useMemo(()=>({...t,...n}),[t,n])}const Ut=g.createContext(null),Qr=({data:e,input:t,formattingLocale:n,onChange:o,customPalettes:a,theme:s="light",themeOverrides:c,children:l})=>{const[d]=g.useState(()=>u.createCompiler()),[h]=g.useState(()=>qr(d)),f=Zr(t,c),p=g.useMemo(()=>({customPalettes:a,theme:s}),[a,s]),[m]=g.useState(()=>{const S=d.compile({input:t,data:e,ctx:p});return h.emit({kind:"init"}),Jr(S)}),x=g.useRef({input:t,data:e,ctx:p});g.useEffect(()=>{const S=t!==x.current.input,j=e!==x.current.data,k=p!==x.current.ctx;if(!S&&!j&&!k)return;const _=m.getState(),L=S||k?d.compile({input:t,data:e,ctx:p}):d.recompile({spec:_.compiled.spec,data:e});x.current={input:t,data:e,ctx:p},_.setCompiled(L),h.emit({kind:S?"input":"data"})},[t,e,p,d,m,h]);const v=g.useCallback(S=>{const j=m.getState(),k=S.apply(j.compiled.spec);if(!k)return;const _=d.recompile({spec:k.spec});if(j.setCompiled(_),h.emit({kind:"command",command:S}),!o)return;const L=u.convertSpecToInput(k.spec);x.current={input:L,data:x.current.data,ctx:x.current.ctx},o(L)},[o,d,h,m]),b=g.useMemo(()=>({store:m,dispatch:v,formattingLocale:n,compileBus:h,theme:s,themeOverrides:f}),[m,v,n,h,s,f]);return r.jsx(Ut.Provider,{value:b,children:l})},se=()=>{const e=g.useContext(Ut);if(!e)throw new Error("useGraph* hooks must be used inside a <GraphProvider>");return e},P=e=>{const{store:t}=se();return fe.useStore(t,n=>e(n.compiled))},tt=()=>{const{dispatch:e}=se();return e};var eo="drqe3u0",to="drqe3u1",no="drqe3u2",ro="drqe3u3",ye="drqe3u4",oo="drqe3u5",ao="drqe3u6",so="drqe3u7",Ne="drqe3u8",io="drqe3u9",lo="drqe3ua",co="drqe3ub",uo="drqe3uc",ho="drqe3ud",go="drqe3ue",fo="drqe3uf",po="drqe3ug",mo="drqe3uh",xo="drqe3ui",ht={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},gt={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},Yt={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const vo=({width:e=380,style:t,className:n}={})=>{const{compileBus:o}=se(),[a]=g.useState(()=>Vr()),[s,c]=g.useState(!1),[l,d]=g.useState(u.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:v}=a.getState(),b=o.getLastTrigger(),S=o.getLastCompile();return b&&S&&v(b,S),o.subscribe(v)},[a,o]);const h=fe.useStore(a,v=>v.lastCompile),f=fe.useStore(a,v=>v.history),p=o.getCacheStats(),m=h===null&&f.length===0,x=()=>{d(v=>{const b=!v;return u.setCompilerCachingEnabled(b),b})};return r.jsxs("div",{className:F(lo,n),style:{width:e,...t},children:[r.jsxs("div",{className:eo,children:[r.jsxs("div",{children:[r.jsx("div",{className:to,children:"compile cache"}),r.jsx("div",{className:go,children:m?"production: stats disabled":h?`last: ${h.label} · ${Kt(h.durationMs)}`:"awaiting first compile…"})]}),r.jsx("button",{type:"button",onClick:()=>c(v=>!v),className:fo,children:s?"▾":"▴"})]}),!s&&r.jsxs("div",{className:co,children:[r.jsxs("button",{type:"button",onClick:x,className:l?ht.enabled:ht.disabled,"aria-pressed":l,children:["cache ",l?"enabled":"disabled"]}),r.jsx("span",{className:po,children:"next compile reflects this toggle"})]}),!s&&!m&&r.jsxs(r.Fragment,{children:[r.jsx(yo,{delta:h?.stages,cumulative:p}),r.jsx(bo,{entries:f})]})]})},yo=({delta:e,cumulative:t})=>r.jsxs("table",{className:no,children:[r.jsx("thead",{children:r.jsxs("tr",{className:mo,children:[r.jsx("th",{className:ro,children:"stage"}),r.jsx("th",{className:ye,children:"Δ miss"}),r.jsx("th",{className:ye,children:"Δ hit"}),r.jsx("th",{className:ye,children:"total miss"}),r.jsx("th",{className:ye,children:"total hit"})]})}),r.jsx("tbody",{children:u.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],a=So(o);return r.jsxs("tr",{className:uo,children:[r.jsxs("td",{className:oo,children:[r.jsx("span",{className:Yt[a],"aria-hidden":!0})," ",n]}),r.jsx("td",{className:a==="ran"?gt.ran:gt.dim,children:o?.misses??0}),r.jsx("td",{className:Ne,children:o?.hits??0}),r.jsx("td",{className:Ne,children:t[n].misses}),r.jsx("td",{className:Ne,children:t[n].hits})]},n)})})]}),bo=({entries:e})=>e.length===0?null:r.jsxs("div",{className:ho,children:[r.jsx("div",{className:xo,children:"recent compiles"}),e.map(t=>{const n=jo(t.stages,s=>s.misses>0),o=u.COMPILER_STAGE_KEYS.length,a=n===0?"cached":"ran";return r.jsxs("div",{className:ao,children:[r.jsx("span",{className:Yt[a],"aria-hidden":!0}),r.jsx("span",{className:so,title:t.label,children:t.label}),r.jsxs("span",{className:io,children:[n,"/",o," ran · ",Kt(t.durationMs)]})]},t.id)})]}),So=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",jo=(e,t)=>{let n=0;for(const o of u.COMPILER_STAGE_KEYS)t(e[o])&&(n+=1);return n},Kt=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,ko=()=>Qe.createStore(e=>({hover:u.RESTING_HOVER_STATE,setHoverState:t=>e(n=>n.hover===t?n:{hover:t})})),Lo=(e,t)=>{const n=g.useMemo(()=>({layers:e,coordSystem:t}),[e,t]),o=g.useRef(null);o.current===null&&(o.current=new u.HoverEngine(n));const a=o.current,s=g.useRef(!1);return g.useEffect(()=>{if(!s.current){s.current=!0;return}a.update(n)},[a,n]),a},Jt=g.createContext(null),Zt=({children:e})=>{const{layers:t,coordSystem:n}=P(W.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem}))),o=Lo(t,n),[a]=g.useState(()=>ko()),s=g.useRef(null),c=g.useRef(null);return c.current===null&&(c.current={engine:o,store:a,overlayRef:s}),r.jsx(Jt.Provider,{value:c.current,children:e})},we=()=>{const e=g.useContext(Jt);if(e===null)throw new Error("useHoverContext must be used inside a <HoverProvider>.");return e};var Co="_2qyyu60";const ft=2,To=12,wo=12,pt=1,mt=2,Ao=4,Ae=({shape:e,color:t,lineType:n="solid",width:o=To,height:a=wo})=>r.jsx("svg",{className:Co,width:o,height:a,viewBox:`0 0 ${o} ${a}`,"aria-hidden":!0,"data-testid":"chart-swatch","data-shape":e,children:Po({shape:e,color:t,lineType:n,width:o,height:a})}),Po=({shape:e,color:t,lineType:n,width:o,height:a})=>{const s=Eo(n,o);switch(e){case"square":return r.jsx("rect",{x:1,y:1,width:o-2,height:a-2,rx:2,fill:t});case"line":return r.jsx("line",{x1:s.x1,y1:a/2,x2:s.x2,y2:a/2,stroke:t,strokeWidth:ft,strokeLinecap:s.linecap,strokeDasharray:s.dashArray});case"circle":{const c=(Math.min(o,a)-2)/2;return r.jsx("circle",{cx:o/2,cy:a/2,r:c,fill:t})}case"area":{const c=a/2-1;return r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:1,y:c,width:o-2,height:a-c-1,fill:t,opacity:.45}),r.jsx("line",{x1:s.x1,y1:c,x2:s.x2,y2:c,stroke:t,strokeWidth:ft,strokeLinecap:s.linecap,strokeDasharray:s.dashArray})]})}case"slice":return r.jsx("path",{d:`M 0 ${a} L ${o} ${a} A ${o} ${a} 0 0 0 0 0 Z`,fill:t})}},Eo=(e,t)=>{if(e==="solid")return{x1:0,x2:t,dashArray:void 0,linecap:"round"};if(e==="dashed"){const o=(t-pt*(mt-1))/mt;return{x1:0,x2:t,dashArray:`${o} ${pt}`,linecap:"butt"}}const n=t/(Ao-1);return{x1:0,x2:t,dashArray:`1 ${n}`,linecap:"round"}},Qt=Object.freeze({}),nt=g.createContext(Qt),_o=({slots:e,children:t})=>r.jsx(nt.Provider,{value:e??Qt,children:t});function U(e,t){const n=g.useContext(nt)[e];return n===void 0?t:typeof n=="object"&&Fo(n)?n.render:n}function Mo(){const e=g.useContext(nt);return{measureAxis:e.AxisTicks?.measure,measureAxisLabel:e.AxisLabel?.measure,measureLegend:e.Legend?.measure,measureHeadline:e.Headline?.measure.measureHeadline,measureHeadlineItemWidths:e.Headline?.measure.measureHeadlineItemWidths}}function Fo(e){return"render"in e&&typeof e.render=="function"}function Pe(e){const{store:t}=we();return fe.useStore(t,e)}var Ho="_19519k80",Bo="_19519k81",Io="_19519k82",No="_19519k83",Ro="_19519k85",Do="_19519k86",Oo="_19519k87",Go="_19519k88",zo="_19519k89";const Wo=e=>{const{overlayRef:t}=we(),n=g.useRef(null),[o,a]=g.useState(!1),s=g.useRef(e);return s.current=e,g.useEffect(()=>{const c=t.current;if(!c)return;const l=h=>{n.current={clientX:h.clientX,clientY:h.clientY},a(!0),s.current?.()},d=()=>{n.current=null,a(!1)};return c.addEventListener("pointermove",l),c.addEventListener("pointerleave",d),()=>{c.removeEventListener("pointermove",l),c.removeEventListener("pointerleave",d)}},[t]),{cursorRef:n,isInside:o}},$o=16,Xo=8,qo={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},Vo=()=>{const e=P(W.useShallow(x=>({layers:x.layers,coordSystem:x.coordSystem,scales:x.scales,guides:x.guides,numberFormat:x.config.numberFormat,parsingLocale:x.config.parsingLocale}))),{formattingLocale:t}=se(),n=Pe(x=>x.hover),o=U("Tooltip",en),a=g.useRef(()=>{}),{cursorRef:s,isInside:c}=Wo(()=>a.current()),l=g.useMemo(()=>u.buildTooltipContent({...e,hover:n,formattingLocale:t}),[e,n,t]),d=l!==null&&c,h=g.useMemo(()=>({getBoundingClientRect:()=>{const x=s.current;return x===null?qo:Uo(x)}}),[s]),{refs:f,floatingStyles:p,update:m}=M.useFloating({open:d,placement:"right",middleware:[M.offset($o),M.flip(),M.shift({padding:Xo})],elements:{reference:h}});return a.current=m,d?r.jsx("div",{ref:f.setFloating,role:"tooltip",className:Go,style:p,"data-testid":"chart-tooltip",children:r.jsx(o,{content:l,isVisible:d})}):null},en=({content:e,isVisible:t})=>t?r.jsxs("div",{className:zo,children:[e.header!==null&&r.jsx("div",{className:Ho,children:e.header}),r.jsx("div",{className:Bo,children:e.rows.map(n=>r.jsx(Yo,{row:n,shouldHighlight:n.isPrimary&&e.rows.length>1},n.key))})]}):null,Uo=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),Yo=({row:e,shouldHighlight:t})=>r.jsxs("div",{className:F(Io,{[No]:t}),"data-testid":"chart-tooltip-row",children:[e.swatchColor===null?r.jsx("span",{className:Ro,"aria-hidden":!0}):r.jsx(Ae,{shape:e.swatchShape,color:e.swatchColor,lineType:e.swatchLineType}),r.jsx("span",{className:Do,children:e.label}),r.jsx("span",{className:Oo,children:e.value})]});var tn=["canvasDefault","canvasBlue","canvasCyan","canvasGreen","canvasYellow","canvasOrange","canvasRed","canvasPink","canvasPurple","canvasGray","canvasInverse"],i={white:"var(--graphy-white)",black:"var(--graphy-black)",transparent:"var(--graphy-transparent)",grey100:"var(--graphy-grey-100)",grey95:"var(--graphy-grey-95)",grey90:"var(--graphy-grey-90)",grey85:"var(--graphy-grey-85)",grey80:"var(--graphy-grey-80)",grey75:"var(--graphy-grey-75)",grey70:"var(--graphy-grey-70)",grey60:"var(--graphy-grey-60)",grey50:"var(--graphy-grey-50)",grey0:"var(--graphy-grey-0)",greyGradient80:"var(--graphy-grey-gradient-80)",green60:"var(--graphy-green-60)",green50:"var(--graphy-green-50)",red60:"var(--graphy-red-60)",red50:"var(--graphy-red-50)",amber70:"var(--graphy-amber-70)",amber50:"var(--graphy-amber-50)",amber40:"var(--graphy-amber-40)",amber30:"var(--graphy-amber-30)",blue80:"var(--graphy-blue-80)",blue60:"var(--graphy-blue-60)",purple50:"var(--graphy-purple-50)",purple30:"var(--graphy-purple-30)",brand:"var(--graphy-brand)",success:"var(--graphy-success)",warning:"var(--graphy-warning)",alert:"var(--graphy-alert)",textPrimary:"var(--graphy-text-primary)",textSecondary:"var(--graphy-text-secondary)",textDisabled:"var(--graphy-text-disabled)",iconPrimary:"var(--graphy-icon-primary)",iconSecondary:"var(--graphy-icon-secondary)",iconStickerBackground:"var(--graphy-icon-sticker-background)",border100:"var(--graphy-border-100)",border50:"var(--graphy-border-50)",border10:"var(--graphy-border-10)",sunkenBackground:"var(--graphy-sunken-background)",defaultBackground:"var(--graphy-default-background)",raisedBackground:"var(--graphy-raised-background)",overlayBackground:"var(--graphy-overlay-background)",overlayBorderGradient:"var(--graphy-overlay-border-gradient)",graphBackground:"var(--graphy-graph-background)",gridLineColor:"var(--graphy-grid-line-color)",originLineColor:"var(--graphy-origin-line-color)",targetLineColor:"var(--graphy-target-line-color)",targetLineMarkerColor:"var(--graphy-target-line-marker-color)",targetLineLabelTextColor:"var(--graphy-target-line-label-text-color)",legendBackground:"var(--graphy-legend-background)",legendBorderColor:"var(--graphy-legend-border-color)",legendFocusOutlineColor:"var(--graphy-legend-focus-outline-color)",legendTextColor:"var(--graphy-legend-text-color)",dimmedSeriesLabelTextColor:"var(--graphy-dimmed-series-label-text-color)",dimmedSeriesLabelLineColor:"var(--graphy-dimmed-series-label-line-color)",trendNegativeColor:"var(--graphy-trend-negative-color)",trendPositiveColor:"var(--graphy-trend-positive-color)",trendNeutralColor:"var(--graphy-trend-neutral-color)",defaultAnnotationArrowStroke:"var(--graphy-default-annotation-arrow-stroke)",defaultAnnotationShapeStroke:"var(--graphy-default-annotation-shape-stroke)",defaultAnnotationShapeFill:"var(--graphy-default-annotation-shape-fill)",arrowAnnotationStickerOutlineColor:"var(--graphy-arrow-annotation-sticker-outline-color)",arrowAnnotationStickerOutlineColorInverse:"var(--graphy-arrow-annotation-sticker-outline-color-inverse)",annotationFrameBorderColor:"var(--graphy-annotation-frame-border-color)",annotationMenuTriggerIconColor:"var(--graphy-annotation-menu-trigger-icon-color)",heatmapEmptyTileBackground:"var(--graphy-heatmap-empty-tile-background)",dataLabelOutsideBackground:"var(--graphy-data-label-outside-background)",graphPadding:"var(--graphy-graph-padding)",gridLineWidth:"var(--graphy-grid-line-width)",gridLineDash:"var(--graphy-grid-line-dash)",tooltipBorderRadius:"var(--graphy-tooltip-border-radius)",tooltipBorderWidth:"var(--graphy-tooltip-border-width)",tooltipPaddingBlock:"var(--graphy-tooltip-padding-block)",tooltipPaddingInline:"var(--graphy-tooltip-padding-inline)",tooltipRowGap:"var(--graphy-tooltip-row-gap)",tooltipShadow:"var(--graphy-tooltip-shadow)",tickLabelOffset:"var(--graphy-tick-label-offset)",legendItemGap:"var(--graphy-legend-item-gap)",legendSwatchGap:"var(--graphy-legend-swatch-gap)",legendSwatchWidth:"var(--graphy-legend-swatch-width)",legendSwatchHeight:"var(--graphy-legend-swatch-height)",legendPillPaddingInline:"var(--graphy-legend-pill-padding-inline)",legendPillPaddingBlock:"var(--graphy-legend-pill-padding-block)",legendPillBorderWidth:"var(--graphy-legend-pill-border-width)",headlineRowGap:"var(--graphy-headline-row-gap)",headlineItemGap:"var(--graphy-headline-item-gap)",canvasDefault:"var(--graphy-canvas-default)",canvasBlue:"var(--graphy-canvas-blue)",canvasCyan:"var(--graphy-canvas-cyan)",canvasGreen:"var(--graphy-canvas-green)",canvasYellow:"var(--graphy-canvas-yellow)",canvasOrange:"var(--graphy-canvas-orange)",canvasRed:"var(--graphy-canvas-red)",canvasPink:"var(--graphy-canvas-pink)",canvasPurple:"var(--graphy-canvas-purple)",canvasGray:"var(--graphy-canvas-gray)",canvasInverse:"var(--graphy-canvas-inverse)",elevationXs:"var(--graphy-elevation-xs)",elevationSm:"var(--graphy-elevation-sm)",elevationMd:"var(--graphy-elevation-md)",elevationLg:"var(--graphy-elevation-lg)",radiiXs:"var(--graphy-radii-xs)",radiiSm:"var(--graphy-radii-sm)",radiiMd:"var(--graphy-radii-md)",radiiLg:"var(--graphy-radii-lg)",spaceXxs:"var(--graphy-space-xxs)",spaceXs:"var(--graphy-space-xs)",spaceSm:"var(--graphy-space-sm)",spaceMd:"var(--graphy-space-md)",spaceLg:"var(--graphy-space-lg)",spaceXl:"var(--graphy-space-xl)",zIndexToolbar:"var(--graphy-z-index-toolbar)",zIndexToolbarTooltip:"var(--graphy-z-index-toolbar-tooltip)",zIndexToolbarPopover:"var(--graphy-z-index-toolbar-popover)",toolbarBackgroundColor:"var(--graphy-toolbar-background-color)",toolbarButtonBackgroundColor:"var(--graphy-toolbar-button-background-color)",toolbarButtonBackgroundColorHovered:"var(--graphy-toolbar-button-background-color-hovered)",toolbarButtonBackgroundColorSelected:"var(--graphy-toolbar-button-background-color-selected)",toolbarSeparatorColor:"var(--graphy-toolbar-separator-color)",tooltipBackground:"var(--graphy-tooltip-background)",tooltipBorderColor:"var(--graphy-tooltip-border-color)",tooltipHeadingTextColor:"var(--graphy-tooltip-heading-text-color)",tooltipLabelTextColor:"var(--graphy-tooltip-label-text-color)",tooltipValueTextColor:"var(--graphy-tooltip-value-text-color)",tooltipPrimaryRowColor:"var(--graphy-tooltip-primary-row-color)",hoverGuideLineColor:"var(--graphy-hover-guide-line-color)",hoverGuideFillColor:"var(--graphy-hover-guide-fill-color)",hoveredBarBorderColor:"var(--graphy-hovered-bar-border-color)",hoveredPointRingColor:"var(--graphy-hovered-point-ring-color)",pointStrokeColor:"var(--graphy-point-stroke-color)",stackedBarHoverBorderColor:"var(--graphy-stacked-bar-hover-border-color)",fontFamilyDefault:"var(--graphy-font-family-default)",fontFamilyHeading:"var(--graphy-font-family-heading)",fontWeightRegular:"var(--graphy-font-weight-regular)",fontWeightMedium:"var(--graphy-font-weight-medium)",fontWeightSemibold:"var(--graphy-font-weight-semibold)",fontWeightBold:"var(--graphy-font-weight-bold)",fontWeightExtraBold:"var(--graphy-font-weight-extra-bold)",fontWeightBlack:"var(--graphy-font-weight-black)",textScale:"var(--graphy-text-scale)",fontSizeXxs:"var(--graphy-font-size-xxs)",fontSizeXs:"var(--graphy-font-size-xs)",fontSizeSm:"var(--graphy-font-size-sm)",fontSizeMd:"var(--graphy-font-size-md)",fontSizeLg:"var(--graphy-font-size-lg)",fontSizeXl:"var(--graphy-font-size-xl)",fontLineHeightXxs:"var(--graphy-font-line-height-xxs)",fontLineHeightXs:"var(--graphy-font-line-height-xs)",fontLineHeightSm:"var(--graphy-font-line-height-sm)",fontLineHeightMd:"var(--graphy-font-line-height-md)",fontLineHeightLg:"var(--graphy-font-line-height-lg)",fontLineHeightXl:"var(--graphy-font-line-height-xl)",fontSizeEditorBody:"var(--graphy-font-size-editor-body)",fontSizeHeadingSm:"var(--graphy-font-size-heading-sm)",fontSizeHeadingMd:"var(--graphy-font-size-heading-md)",fontSizeHeadingLg:"var(--graphy-font-size-heading-lg)",fontLineHeightEditorBody:"var(--graphy-font-line-height-editor-body)",fontLineHeightHeadingSm:"var(--graphy-font-line-height-heading-sm)",fontLineHeightHeadingMd:"var(--graphy-font-line-height-heading-md)",fontLineHeightHeadingLg:"var(--graphy-font-line-height-heading-lg)",fontTickLabel:"var(--graphy-font-tick-label)",fontAxisLabel:"var(--graphy-font-axis-label)",fontDataLabel:"var(--graphy-font-data-label)",fontStackTotal:"var(--graphy-font-stack-total)",fontLegendLabel:"var(--graphy-font-legend-label)",fontSeriesLabel:"var(--graphy-font-series-label)",fontTooltipLabel:"var(--graphy-font-tooltip-label)",fontTooltipHeading:"var(--graphy-font-tooltip-heading)",fontTooltipFooter:"var(--graphy-font-tooltip-footer)",fontJumboTooltipLabel:"var(--graphy-font-jumbo-tooltip-label)",fontJumboTooltip:"var(--graphy-font-jumbo-tooltip)",fontMiniTooltipLabel:"var(--graphy-font-mini-tooltip-label)",fontMiniTooltipFooter:"var(--graphy-font-mini-tooltip-footer)",fontTooltipCaption:"var(--graphy-font-tooltip-caption)",fontTooltipCaptionSmall:"var(--graphy-font-tooltip-caption-small)",fontTrendTag:"var(--graphy-font-trend-tag)",fontTrendTagSmall:"var(--graphy-font-trend-tag-small)",fontGoalLineLabel:"var(--graphy-font-goal-line-label)",fontPieLabel:"var(--graphy-font-pie-label)",fontPieChartTotal:"var(--graphy-font-pie-chart-total)",fontDifferenceArrowSmall:"var(--graphy-font-difference-arrow-small)",fontDifferenceArrowMedium:"var(--graphy-font-difference-arrow-medium)",fontDifferenceArrowLarge:"var(--graphy-font-difference-arrow-large)",fontButton:"var(--graphy-font-button)",fontInput:"var(--graphy-font-input)",fontInputLabel:"var(--graphy-font-input-label)",fontSelectLabel:"var(--graphy-font-select-label)",fontSelectDescription:"var(--graphy-font-select-description)",fontColorSelectLabel:"var(--graphy-font-color-select-label)",fontMenuTitle:"var(--graphy-font-menu-title)",fontMenuGroupTitle:"var(--graphy-font-menu-group-title)",fontMenuItemLabel:"var(--graphy-font-menu-item-label)",fontMenuItemLabelSecondary:"var(--graphy-font-menu-item-label-secondary)",fontUITooltip:"var(--graphy-font-uitooltip)",fontUITooltipSecondary:"var(--graphy-font-uitooltip-secondary)",fontErrorBoundaryTitle:"var(--graphy-font-error-boundary-title)",fontErrorBoundaryMessage:"var(--graphy-font-error-boundary-message)",fontTableCell:"var(--graphy-font-table-cell)",fontTableHeaderCell:"var(--graphy-font-table-header-cell)",fontSourceLabel:"var(--graphy-font-source-label)",fontSourceLink:"var(--graphy-font-source-link)",fontTextEditorH1:"var(--graphy-font-text-editor-h1)",fontTextEditorH2:"var(--graphy-font-text-editor-h2)",fontTextEditorH3:"var(--graphy-font-text-editor-h3)",fontTextEditorH6:"var(--graphy-font-text-editor-h6)",fontTextEditorBody:"var(--graphy-font-text-editor-body)",fontTextEditorLink:"var(--graphy-font-text-editor-link)",fontHighlightModeTitle:"var(--graphy-font-highlight-mode-title)",fontHighlightModeSubtitle:"var(--graphy-font-highlight-mode-subtitle)"};const N=`'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu',
3
- 'Cantarell', 'Helvetica Neue', 'NotoSansArabic', 'NotoSansJP', 'NotoSansSC', 'NotoSansKR', 'NotoSerifKR', sans-serif, 'Apple Color Emoji', 'NotoColorEmoji'`,Ko=N,q={regular:400,medium:500,semibold:600,bold:700,extraBold:800,black:900},E={xxs:1,xs:1.1,sm:1.2,md:1.4,lg:1.6,xl:2,editorBody:1.5,headingSm:1.8,headingMd:2.2,headingLg:2.8},B={xxs:1,xs:1,sm:1.3,md:1.43,lg:1,xl:1,editorBody:1.47,headingSm:1.25,headingMd:1.41,headingLg:1.29},Jo=`var(--typography-chart-font-family, ${i.fontFamilyDefault})`,Re=`var(--typography-chart-heading-font-family, ${i.fontFamilyHeading})`,z=e=>`${e}em`,nn={textScale:"1",fontFamilyDefault:N,fontFamilyHeading:Ko,fontWeightRegular:q.regular.toString(),fontWeightMedium:q.medium.toString(),fontWeightSemibold:q.semibold.toString(),fontWeightBold:q.bold.toString(),fontWeightExtraBold:q.extraBold.toString(),fontWeightBlack:q.black.toString(),fontSizeXxs:z(E.xxs),fontSizeXs:z(E.xs),fontSizeSm:z(E.sm),fontSizeMd:z(E.md),fontSizeLg:z(E.lg),fontSizeXl:z(E.xl),fontLineHeightXxs:B.xxs.toString(),fontLineHeightXs:B.xs.toString(),fontLineHeightSm:B.sm.toString(),fontLineHeightMd:B.md.toString(),fontLineHeightLg:B.lg.toString(),fontLineHeightXl:B.xl.toString()},rn={fontSizeEditorBody:z(E.editorBody),fontSizeHeadingSm:z(E.headingSm),fontSizeHeadingMd:z(E.headingMd),fontSizeHeadingLg:z(E.headingLg),fontLineHeightEditorBody:B.editorBody.toString(),fontLineHeightHeadingSm:B.headingSm.toString(),fontLineHeightHeadingMd:B.headingMd.toString(),fontLineHeightHeadingLg:B.headingLg.toString()},y=(e,t,n,o=Jo)=>`${e} ${t}/${n} ${o}`,on={fontTickLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontAxisLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontDataLabel:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontStackTotal:y(i.fontWeightSemibold,i.fontSizeXs,i.fontLineHeightXs),fontLegendLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontSeriesLabel:y(i.fontWeightSemibold,i.fontSizeSm,i.fontLineHeightSm),fontTooltipLabel:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTooltipHeading:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTooltipFooter:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontJumboTooltipLabel:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontJumboTooltip:y(i.fontWeightMedium,i.fontSizeHeadingMd,i.fontLineHeightHeadingMd),fontMiniTooltipLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontMiniTooltipFooter:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontTooltipCaption:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTooltipCaptionSmall:y(i.fontWeightMedium,i.fontSizeXxs,i.fontLineHeightXxs),fontUITooltip:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontUITooltipSecondary:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTrendTag:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTrendTagSmall:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontGoalLineLabel:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontPieLabel:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontPieChartTotal:y(i.fontWeightBold,i.fontSizeHeadingLg,i.fontLineHeightHeadingLg),fontDifferenceArrowSmall:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontDifferenceArrowMedium:y(i.fontWeightMedium,i.fontSizeLg,i.fontLineHeightLg),fontDifferenceArrowLarge:y(i.fontWeightSemibold,i.fontSizeXl,i.fontLineHeightXl),fontButton:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontInput:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontInputLabel:y(i.fontWeightMedium,i.fontSizeXxs,i.fontLineHeightXxs),fontSelectLabel:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontSelectDescription:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontColorSelectLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontMenuTitle:y(i.fontWeightSemibold,i.fontSizeMd,i.fontLineHeightMd),fontMenuGroupTitle:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontMenuItemLabel:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontMenuItemLabelSecondary:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontErrorBoundaryTitle:y(i.fontWeightSemibold,i.fontSizeHeadingSm,i.fontLineHeightHeadingSm),fontErrorBoundaryMessage:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTableCell:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTableHeaderCell:y(i.fontWeightSemibold,i.fontSizeSm,i.fontLineHeightSm),fontSourceLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontSourceLink:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontTextEditorH1:y(i.fontWeightBold,i.fontSizeHeadingLg,i.fontLineHeightHeadingLg,Re),fontTextEditorH2:y(i.fontWeightBold,i.fontSizeHeadingMd,i.fontLineHeightHeadingMd,Re),fontTextEditorH3:y(i.fontWeightSemibold,i.fontSizeHeadingSm,i.fontLineHeightHeadingSm,Re),fontTextEditorH6:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTextEditorBody:y(i.fontWeightMedium,i.fontSizeEditorBody,i.fontLineHeightEditorBody),fontTextEditorLink:y(i.fontWeightRegular,i.fontSizeMd,i.fontLineHeightMd),fontHighlightModeTitle:y(i.fontWeightBold,i.fontSizeMd,i.fontLineHeightMd),fontHighlightModeSubtitle:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm)},Zo={small:1.9,medium:2.3,large:2.6},Qo={small:1,medium:1,large:1.2},ea=N,an=B.sm,sn=2,ln=24,cn=12,dn=10,un=8,hn=8,gn=8,fn=2,pn=1,mn=2,xn=4,vn=E.sm,yn=B.sm,bn=N,ta=mn*xn,Sn=!1,be=6,jn=10,C=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,Ee=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,kn=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,Ve=(e,t,n)=>`color-mix(in srgb, ${e}, ${t} ${n*100}%)`,na=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),ra=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),D=e=>`${e}px`,Ln={graphPadding:D(u.LAYOUT_PADDING),gridLineWidth:"1px",gridLineDash:"2 3",tooltipBorderRadius:"6px",tooltipBorderWidth:"1px",tooltipPaddingBlock:"8px",tooltipPaddingInline:"10px",tooltipRowGap:"4px",tooltipShadow:"0 4px 12px rgba(0, 0, 0, 0.18)",tickLabelOffset:D(jn),legendItemGap:D(hn),legendSwatchGap:D(un),legendSwatchWidth:D(dn),legendSwatchHeight:D(cn),legendPillPaddingInline:D(gn),legendPillPaddingBlock:D(fn),legendPillBorderWidth:D(pn),headlineRowGap:D(sn),headlineItemGap:D(ln)},Cn={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)"},Tn={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},wn={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},oa=8,ee=e=>`${oa*e}px`,An={spaceXxs:ee(.25),spaceXs:ee(.5),spaceSm:ee(.75),spaceMd:ee(1),spaceLg:ee(1.5),spaceXl:ee(2)},aa={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)"},sa={textPrimary:i.grey0,textSecondary:C(i.textPrimary,.8),textDisabled:C(i.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:C(i.textPrimary,.6),iconStickerBackground:i.grey70,border100:i.grey0,border50:C(i.grey0,.5),border10:C(i.grey0,.1),brand:i.purple50,success:i.green50,warning:i.amber50,alert:i.red50,sunkenBackground:i.grey100,defaultBackground:i.grey90,raisedBackground:i.grey80,overlayBackground:i.grey90,overlayBorderGradient:i.greyGradient80},ia={graphBackground:i.grey90,gridLineColor:i.border10,originLineColor:i.grey0,targetLineColor:i.border100,targetLineMarkerColor:i.border100,targetLineLabelTextColor:i.grey100,legendBackground:i.defaultBackground,legendBorderColor:i.border10,legendFocusOutlineColor:i.border50,legendTextColor:i.textPrimary,dimmedSeriesLabelTextColor:i.textDisabled,dimmedSeriesLabelLineColor:i.grey60,trendNegativeColor:i.red60,trendPositiveColor:i.green60,trendNeutralColor:i.textSecondary,toolbarBackgroundColor:i.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:i.grey80,toolbarButtonBackgroundColorSelected:i.grey60,toolbarSeparatorColor:i.grey60,tooltipBackground:i.grey70,tooltipBorderColor:i.grey60,tooltipHeadingTextColor:i.textPrimary,tooltipLabelTextColor:i.textSecondary,tooltipValueTextColor:i.textPrimary,tooltipPrimaryRowColor:i.grey60,hoverGuideLineColor:C(i.white,.08),hoverGuideFillColor:C(i.white,.06),hoveredBarBorderColor:i.white,hoveredPointRingColor:i.white,pointStrokeColor:i.white,stackedBarHoverBorderColor:i.grey0,heatmapEmptyTileBackground:i.grey80,dataLabelOutsideBackground:C(i.textPrimary,.1),defaultAnnotationArrowStroke:i.white,defaultAnnotationShapeStroke:i.white,defaultAnnotationShapeFill:i.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:i.blue60,annotationMenuTriggerIconColor:i.white},la={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},ca={...aa,...sa,...Cn,...Tn,...An,...wn,...ia,...la,...Ln,...nn,...rn,...on},da={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)"},ua={textPrimary:i.black,textSecondary:C(i.textPrimary,.6),textDisabled:C(i.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:C(i.textPrimary,.6),iconStickerBackground:i.grey100,brand:i.purple50,success:i.green50,warning:i.amber50,alert:i.red50,border100:i.grey0,border50:C(i.grey0,.5),border10:C(i.grey0,.1),sunkenBackground:i.grey90,defaultBackground:i.grey100,raisedBackground:i.grey85,overlayBackground:i.grey100,overlayBorderGradient:i.border10},ha={graphBackground:i.grey100,gridLineColor:i.border10,originLineColor:i.grey0,targetLineColor:i.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:i.grey100,legendBackground:i.defaultBackground,legendBorderColor:i.border10,legendFocusOutlineColor:i.border50,legendTextColor:i.textPrimary,dimmedSeriesLabelTextColor:i.textDisabled,dimmedSeriesLabelLineColor:i.grey60,trendNegativeColor:i.red60,trendPositiveColor:i.green60,trendNeutralColor:i.textSecondary,toolbarBackgroundColor:i.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:i.grey80,toolbarButtonBackgroundColorSelected:i.grey60,toolbarSeparatorColor:i.grey60,tooltipBackground:i.white,tooltipBorderColor:i.border10,tooltipHeadingTextColor:i.textPrimary,tooltipLabelTextColor:i.textSecondary,tooltipValueTextColor:i.textPrimary,tooltipPrimaryRowColor:i.grey80,hoverGuideLineColor:C(i.black,.08),hoverGuideFillColor:C(i.black,.04),hoveredBarBorderColor:i.white,hoveredPointRingColor:i.white,pointStrokeColor:i.white,stackedBarHoverBorderColor:i.grey0,heatmapEmptyTileBackground:i.grey80,dataLabelOutsideBackground:C(i.textPrimary,.1),defaultAnnotationArrowStroke:i.black,defaultAnnotationShapeStroke:i.black,defaultAnnotationShapeFill:i.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:i.blue60,annotationMenuTriggerIconColor:"#3d414c"},ga={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},fa={...da,...ua,...Cn,...Tn,...An,...wn,...ha,...ga,...Ln,...nn,...rn,...on},Pn=(e,t={})=>({...e==="dark"?ca:fa,...t}),En=(e,t)=>{const n=Pn(e,t),o=O(n.legendPillPaddingInline,gn),a=O(n.legendPillPaddingBlock,fn),s=O(n.legendPillBorderWidth,pn);return{graphPadding:O(n.graphPadding,u.LAYOUT_PADDING),tickLabelOffset:O(n.tickLabelOffset,jn),legendSwatchWidth:O(n.legendSwatchWidth,dn),legendSwatchHeight:O(n.legendSwatchHeight,cn),legendSwatchGap:O(n.legendSwatchGap,un),legendItemGap:O(n.legendItemGap,hn),legendPillPaddingInline:o,legendPillPaddingBlock:a,legendPillBorderWidth:s,legendPillHorizontalChrome:2*(o+s),legendPillVerticalChrome:2*(a+s),headlineRowGap:O(n.headlineRowGap,sn),headlineItemGap:O(n.headlineItemGap,ln)}},pa=Object.freeze(En("light"));function O(e,t){const n=e.trim();if(!/^-?\d*\.?\d+(px)?$/.test(n))return t;const o=Number.parseFloat(n);return Number.isFinite(o)?o:t}const _n=g.createContext(pa),ma=({metrics:e,children:t})=>r.jsx(_n.Provider,{value:e,children:t}),rt=()=>g.useContext(_n),ot=E.sm,Mn=N,Fn=10,Y=(e,t)=>e*Fn*t,xa=(e,t,n)=>{const{tickLabelOffset:o}=n;return a=>{const s=a.position==="top"||a.position==="bottom",c=a.ticks.map(h=>e.measureText(h.formattedLabel,{family:Mn,size:Y(ot,t)})),l=a.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(s){if(a.labelRotation!==0){const h=c.map(p=>p.width);return xt(h,l)+2*o}return Math.max(...c.map(h=>h.height))+o}return xt(c.map(h=>h.width),l)+o}},xt=(e,t)=>Math.min(Math.max(...e),t),va=e=>()=>Y(ot,e),ya=(e,t)=>(n,o)=>{const{labelLineHeight:a,labelFontWeight:s}=u.getDifferenceArrowDimensions(o,t);return e.measureText(n,{family:N,size:a,weight:s})},ba=(e,t,n)=>(o,a)=>{const s=Hn(o,a,e,t,n.headlineRowGap),c=Bn(s.map(d=>d.width)),l=Math.max(0,s.length-1)*n.headlineItemGap;return{width:c+l,height:Math.max(0,...s.map(d=>d.height))}},Sa=(e,t,n)=>(o,a)=>Hn(o,a,e,t,n.headlineRowGap).map(s=>s.width),ja=(e,t)=>(n,o)=>{const a=Ue("value",o,t);return{width:e.measureText(n,a).width,height:a.size*an}},ka=(e,t,n)=>{const o=ba(e,t,n),a=ja(e,t);return(s,c)=>s.kind==="perGroup"?o(s,c):a(s.value,c)},Hn=(e,t,n,o,a)=>{const s={value:Ue("value",t,o),label:Ue("label",t,o)},c=l=>La(l,s,n);return e.items.map(l=>{const d=u.createHeadlineItemRows(l).map(c),h=Math.max(0,d.length-1)*a;return{width:Math.max(0,...d.map(f=>f.width)),height:Bn(d.map(f=>f.height))+h}})},La=(e,t,n)=>{let o=0,a=0;for(const s of e.segments)if(s.kind==="text"){const c=t[s.fontRole];o+=n.measureText(s.text,c).width,a=Math.max(a,c.size*an)}else o+=s.size,a=Math.max(a,s.size);return{width:o+Math.max(0,e.segments.length-1)*e.gap,height:a}},Ue=(e,t,n)=>{const o=e==="value"?Zo[t]:Qo[t];return{family:ea,size:Y(o,n)}},Bn=e=>e.reduce((t,n)=>t+n,0),In=e=>{const t=Y(vn,e);return{fontSizePx:t,lineBoxHeight:t*yn}},Nn=(e,t)=>e?t:0,Ca=(e,t,n)=>o=>{const{fontSizePx:a,lineBoxHeight:s}=In(t),c={family:bn,size:a};if(o.position==="top"||o.position==="bottom")return Math.max(s,n.legendSwatchHeight)+n.legendPillVerticalChrome;const d=o.items.map(h=>{const f=e.measureText(h.formattedLabel,c).width,p=Nn(h.visual.color,n.legendSwatchWidth);return p+(p>0?n.legendSwatchGap:0)+f});return Math.max(...d)+n.legendPillHorizontalChrome},Ta=(e,t)=>n=>e.measureText(n,{family:Mn,size:Y(ot,t)}),wa=Object.freeze({}),Aa=(e,t,n,o=wa)=>{const a=g.useRef(o);return a.current=o,g.useMemo(()=>{if(!e)return null;const s=xa(e,t,n),c=va(t),l=Ca(e,t,n),d=ka(e,t,n),h=Sa(e,t,n),f={measureText:(p,m)=>e.measureText(p,m),textScale:t};return{measureAxis:p=>{if(Ea(p))return 0;const m=a.current.measureAxis;return m?m(p,f):s(p)},measureAxisLabel:p=>{const m=a.current.measureAxisLabel;return m?m(p,f):c()},measureLegend:p=>{if(_a(p))return 0;const m=a.current.measureLegend;return m?m(p,f):l(p)},measureHeadline:(p,m)=>(a.current.measureHeadline??d)(p,m),measureHeadlineItemWidths:(p,m)=>(a.current.measureHeadlineItemWidths??h)(p,m),measureTickLabel:Ta(e,t),measureDifferenceArrowLabel:ya(e,t)}},[e,t,n])},Pa=({measurer:e,axes:t,numberFormat:n,parsingLocale:o,formattedLegends:a,containerSize:s,externalMeasurements:c,headline:l,formattingLocale:d,annotations:h,coordSystem:f,textScale:p,graphPadding:m})=>g.useMemo(()=>e?new u.LayoutCompiler(e).compile({axes:t,numberFormat:n,parsingLocale:o,formattedLegends:a,containerSize:s,externalMeasurements:c,headline:l,formattingLocale:d,annotations:h,coordSystem:f,textScale:p,padding:m}):null,[t,n,o,a,s,c,l,d,h,f,p,m,e]),Ea=e=>!e.isVisible||e.ticks.length===0,_a=e=>e.items.length===0,vt="data-variant",Rn=Or.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(vt)??null,renderHTML:e=>e.variant?{[vt]:e.variant}:{}}}}}),Ma=Dr.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:n}=t;return n.depth!==1||n.parentOffset!==0?!1:n.index(0)===1}}}}),Fa=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:n,isSubtitleVisible:o})=>[Ba({isTitleVisible:n,isSubtitleVisible:o}),Rn,Xt.Text,ke.UndoRedo,zt.Heading.configure({levels:[1,2,3]}),Ot.Bold,Wt.Italic,Vt.Underline,qt.TextAlign.configure({types:["heading","paragraph"]}),$t.Link.configure({openOnClick:!1,autolink:!0}),ne.TextStyle,ne.Color,ne.FontFamily,Gt.HardBreak,Ma.configure({isTitleVisible:n}),ke.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:a,editor:s})=>{if(n&&a===0)return e;const c=n?s.state.doc.firstChild?.nodeSize??-1:0;return o&&a===c?t:""}})],Ha=({placeholder:e})=>[Xe.Document,Rn,Xt.Text,ke.UndoRedo,zt.Heading.configure({levels:[1,2,3]}),Ot.Bold,Wt.Italic,Vt.Underline,qt.TextAlign.configure({types:["heading","paragraph"]}),$t.Link.configure({openOnClick:!1,autolink:!0}),ne.TextStyle,ne.Color,ne.FontFamily,Gt.HardBreak,ke.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Ba=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?Xe.Document.extend({content:"block{2,}"}):Xe.Document,Le=.1,Ia={light:.05,dark:.1},Na=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return Oa(e.color,t);case"gradient":return Ga(e.color,t);case"preset":return u.BORDER_PRESET_GRADIENTS[e.preset]}},Ra=e=>e.type==="none"?0:e.width,Da=(e,t,n)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return Ve(n,e.color,Ia[t])},Oa=(e,t)=>t==="dark"?Ee(e,Le):kn(e,Le),Ga=(e,t,n=90)=>{const o=e,a=t==="dark"?Ee(e,Le):kn(e,Le);return`linear-gradient(${n}deg, ${o} 0%, ${a} 100%)`};var za="bow4tg0",Wa="bow4tg1",$a="bow4tg2",Xa="bow4tg3",Dn="_1ii3bsb0",On="_1ii3bsb1";const at=g.createContext(null),st=()=>{const e=g.useContext(at);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},Gn=({theme:e,themeOverrides:t={},appearance:n,children:o})=>{const a=g.useMemo(()=>Pn(e,t),[e,t]),s=g.useMemo(()=>{const l={[i.textScale]:String(n.textScale)};for(const[h,f]of Object.entries(t))l[i[h]]=f;const d=Da(n.background,e,a.graphBackground);return d!==void 0&&(l[i.graphBackground]=d),zr.assignInlineVars(l)},[n.textScale,n.background,e,a.graphBackground,t]),c=g.useMemo(()=>({theme:e,themeClass:e==="dark"?On:Dn,inlineVarsStyle:s,themeValues:a}),[e,s,a]);return r.jsx(at.Provider,{value:c,children:o})},J=({children:e,className:t,style:n})=>{const o=g.useContext(at),a=o?F(o.themeClass,Wa):void 0,s=o?{...o.inlineVarsStyle,...n}:n;return r.jsx("div",{className:F(a,t),style:s,children:e})},qa="graphy_root",Z=()=>typeof document>"u"?null:document.getElementById(qa)??document.body;var Va="yp3g0k0",Ua="yp3g0k1",zn="yp3g0k3",Ya="yp3g0k4",Wn="yp3g0k5",Ye="yp3g0k6",Ka="yp3g0k7",Ja="yp3g0k8",$n="yp3g0k9",Za="yp3g0ka",Qa="yp3g0kb",es="yp3g0kc",ts="yp3g0kd",ns="yp3g0ke";const rs=tn.map(e=>i[e]),os=Object.fromEntries(tn.map(e=>[i[e],e])),as=({editor:e,currentColor:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=is(),c=g.useCallback(d=>{e.chain().setColor(d).run()},[e]),l=d=>{e.chain().focus().setColor(d).run(),o(!1)};return r.jsxs(A.Popover.Root,{open:n,onOpenChange:o,children:[r.jsx(A.Popover.Trigger,{render:r.jsx(w.Toolbar.Button,{}),"aria-label":a("graph.toolbar.color.label"),className:Va,onMouseDown:d=>d.preventDefault(),children:r.jsx("span",{className:Ua,style:{background:t??"transparent"}})}),r.jsx(A.Popover.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(A.Popover.Positioner,{sideOffset:6,align:"start",className:zn,children:r.jsxs(A.Popover.Popup,{className:Ya,onMouseDown:d=>d.preventDefault(),children:[r.jsx(yt,{title:a("graph.colorDropdown.colors"),colors:rs,currentColor:t,onPick:l}),s.length>0&&r.jsx(yt,{title:a("graph.colorDropdown.chartColors"),colors:s,currentColor:t,onPick:l}),r.jsx(ss,{value:t??"#000000",onChange:c})]})})})})]})},yt=({title:e,colors:t,currentColor:n,onPick:o})=>r.jsxs("div",{className:Wn,children:[r.jsx("div",{className:Ye,children:e}),r.jsx("div",{className:Ka,children:t.map(a=>r.jsx("button",{type:"button","aria-label":a,className:Ja,"data-active":cs(a,n),onMouseDown:s=>s.preventDefault(),onClick:()=>o(a),children:r.jsx("span",{className:$n,style:Xn(a)})},a))})]}),ss=({value:e,onChange:t})=>{const n=$.useI18n(),[o,a]=g.useState(!1),s=ra(e)?e:"#000000",c=ls(s);return r.jsxs(A.Popover.Root,{open:o,onOpenChange:a,children:[r.jsxs("div",{className:Wn,children:[r.jsx("div",{className:Ye,children:n("graph.colorDropdown.custom")}),r.jsxs(A.Popover.Trigger,{className:Za,onMouseDown:l=>l.preventDefault(),"aria-label":n("graph.colorDropdown.pickCustom"),children:[r.jsx("span",{className:$n,style:Xn(s)}),r.jsx("span",{className:Qa,children:c})]})]}),r.jsx(A.Popover.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(A.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:zn,children:r.jsxs(A.Popover.Popup,{className:es,onMouseDown:l=>l.preventDefault(),children:[r.jsx("div",{className:Ye,children:n("graph.colorDropdown.pickColor")}),r.jsx(ut.HexColorPicker,{color:c,onChange:t,className:ts}),r.jsx(ut.HexColorInput,{color:c,onChange:t,prefixed:!0,className:ns,onMouseDown:l=>l.stopPropagation()})]})})})})]})},is=()=>{const e=P(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const n of e.domain){const o=e.map(n);typeof o=="string"&&t.add(o)}return[...t]},[e])},Xn=e=>({background:e,border:`1px solid ${Ee(e,.1)}`}),ls=e=>{const{themeValues:t}=st();if(na(e))return e.toUpperCase();const n=os[e];return n?t[n].toUpperCase():"#000000"},cs=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),ds={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var us={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const V=({children:e,title:t,variant:n="primary",size:o="sm",...a})=>{const s=g.useId(),c=ds[o];return r.jsxs("svg",{className:us[n],"aria-labelledby":t?s:void 0,height:c,width:c,fill:"none",viewBox:"0 0 24 24",role:"img",...a,children:[t&&r.jsx("title",{id:s,children:t}),e]})},qn=e=>r.jsx(V,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})}),hs="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Vn=`'Aeonik', 'Aeonik Fallback', ${N}`,gs="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",fs="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",ps=`var(--brand-font-family), ${Vn}`,Ke=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:N},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Vn},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:hs},{id:"technical",label:"Technical",preview:"00",fontFamily:gs},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:fs},{id:"brand",label:"Brand",preview:"Aa",fontFamily:ps}],ms=e=>e?Ke.find(t=>t.fontFamily===e)??null:null;var Un="_1qkyw7q0",Yn="_1qkyw7q1",Kn="_1qkyw7q3",Jn="_1qkyw7q4",Zn="_1qkyw7q5";const xs=({editor:e,currentFontFamily:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=ms(t)??Ke[0],c=l=>{e.chain().focus().setFontFamily(l.fontFamily).run()};return r.jsxs(H.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(H.Menu.Trigger,{render:r.jsx(w.Toolbar.Button,{}),"aria-label":a("graph.toolbar.font.ariaLabel"),className:Un,onMouseDown:l=>l.preventDefault(),children:[r.jsx("span",{className:Yn,style:{fontFamily:s?.fontFamily},children:s?.preview}),r.jsx(qn,{size:"sm"})]}),r.jsx(H.Menu.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(H.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Kn,children:r.jsx(H.Menu.Popup,{className:Jn,onMouseDown:l=>l.preventDefault(),children:Ke.map(l=>r.jsx(H.Menu.Item,{className:Zn,"data-selected":l.id===s?.id,onClick:()=>c(l),children:r.jsx("span",{style:{fontFamily:l.fontFamily},children:l.label})},l.id))})})})})]})},Qn={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:i.fontTextEditorBody},bt=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:i.fontTextEditorH6},Qn,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:i.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:i.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:i.fontTextEditorH1}],vs=({editor:e,activeStyle:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=bt.find(c=>c.id===t)??Qn;return r.jsxs(H.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(H.Menu.Trigger,{render:r.jsx(w.Toolbar.Button,{}),"aria-label":a("graph.toolbar.heading.ariaLabel"),className:Un,onMouseDown:c=>c.preventDefault(),children:[r.jsx("span",{className:Yn,children:a(s.translationKey)}),r.jsx(qn,{size:"sm"})]}),r.jsx(H.Menu.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(H.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Kn,children:r.jsx(H.Menu.Popup,{className:Jn,onMouseDown:c=>c.preventDefault(),children:bt.map(c=>r.jsx(H.Menu.Item,{className:Zn,"data-selected":c.id===s.id,onClick:()=>ys(e,c.id),children:r.jsx(bs,{font:c.previewFont,children:a(c.translationKey)})},c.id))})})})})]})},ys=(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()}},bs=({font:e,children:t})=>r.jsx("span",{style:{font:e,margin:0},children:t}),Ss=e=>r.jsx(V,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})})}),js=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.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"})]})}),ks=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 6 6 18"}),r.jsx("path",{d:"m6 6 12 12"})]})}),Ls=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),Cs=e=>{const{$from:t}=e.state.selection,n=t.parent.textContent,o=t.parentOffset,a=t.start();let s=o;for(;s>0&&St(n[s-1]);)s-=1;let c=o;for(;c<n.length&&St(n[c]);)c+=1;return{from:a+s,to:a+c}},St=e=>e!==void 0&&/\S/.test(e);var Ts="b5kquu0",ws="b5kquu1",As="b5kquu2",Ps="b5kquu3",jt="b5kquu4";const Es=({editor:e,currentUrl:t,isActive:n,isOpen:o,onOpenChange:a})=>{const s=$.useI18n(),[c,l]=g.useState(""),d=g.useRef(null);g.useEffect(()=>{o&&l(t??"")},[o,t]);const h=()=>{_s(e,c),a(!1)},f=()=>{l(""),a(!1)},p=x=>{l(x.target.value)},m=x=>{x.key==="Enter"&&(x.preventDefault(),h())};return r.jsxs(A.Popover.Root,{open:o,onOpenChange:a,children:[r.jsx(A.Popover.Trigger,{render:r.jsx(w.Toolbar.Button,{}),"aria-label":s("graph.toolbar.formatting.link"),"data-active":n,className:Ts,onMouseDown:x=>x.preventDefault(),children:r.jsx(js,{})}),r.jsx(A.Popover.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(A.Popover.Positioner,{sideOffset:6,align:"end",className:ws,children:r.jsxs(A.Popover.Popup,{className:As,initialFocus:d,onMouseDown:x=>x.preventDefault(),children:[r.jsx("input",{ref:d,type:"url",value:c,placeholder:s("graph.toolbar.link.placeholder"),"aria-label":s("graph.toolbar.link.urlLabel"),className:Ps,onMouseDown:x=>x.stopPropagation(),onChange:p,onKeyDown:m}),r.jsx("button",{type:"button","aria-label":s("common.cancel"),className:jt,onClick:f,children:r.jsx(ks,{})}),r.jsx("button",{type:"button","aria-label":s("graph.toolbar.link.apply"),className:jt,onClick:h,children:r.jsx(Ss,{})})]})})})})]})},_s=(e,t)=>{const n=t.trim(),{selection:o}=e.state;if(!n){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:n}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:n}).run();return}const a=Cs(e);e.chain().focus().setTextSelection(a).setLink({href:n}).run()},Ms=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M17 12H7"}),r.jsx("path",{d:"M19 19H5"})]})}),Fs=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M21 12H9"}),r.jsx("path",{d:"M21 19H7"})]})}),Hs=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M15 12H3"}),r.jsx("path",{d:"M17 19H3"})]})});var Bs="k91gos0",Is="k91gos1";const Ns=6,re=({label:e,isActive:t,onToggle:n,children:o})=>{const a=s=>s.preventDefault();return r.jsxs(te.Tooltip.Root,{children:[r.jsx(te.Tooltip.Trigger,{render:r.jsx(Wr.Toggle,{render:r.jsx(w.Toolbar.Button,{}),pressed:t,onPressedChange:()=>n()}),"aria-label":e,className:Bs,onMouseDown:a,children:o}),r.jsx(te.Tooltip.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(te.Tooltip.Positioner,{sideOffset:Ns,children:r.jsx(te.Tooltip.Popup,{className:Is,children:e})})})})]})},Rs=({editor:e,activeAlignment:t="left"})=>{const n=$.useI18n();return r.jsxs(r.Fragment,{children:[r.jsx(re,{label:n("graph.toolbar.textAlign.left"),isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:r.jsx(Hs,{})}),r.jsx(re,{label:n("graph.toolbar.textAlign.center"),isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:r.jsx(Ms,{})}),r.jsx(re,{label:n("graph.toolbar.textAlign.right"),isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:r.jsx(Fs,{})})]})};var Ds="_1bp10ig0",ue="_1bp10ig1",Se="_1bp10ig2";const Os=({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:Gs(e),textAlign:zs(e)}),Gs=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",zs=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",Ws=8,$s=8,Xs=({editor:e})=>{const t=$.useI18n(),[n,o]=g.useState(!1),[a,s]=g.useState(null),c=a!==null,l=v=>b=>{s(b?v:null)},{refs:d,floatingStyles:h}=M.useFloating({placement:"top-start",strategy:"fixed",middleware:[M.offset(Ws),M.flip(),M.shift({padding:$s})],whileElementsMounted:M.autoUpdate}),f=g.useRef(null),p=et.useEditorState({editor:e,selector:Os}),m=g.useCallback(v=>{f.current=v,d.setFloating(v)},[d]);if(g.useEffect(()=>{e&&d.setReference(e.view.dom)},[e,d]),g.useEffect(()=>{if(!e)return;const v=()=>o(!0),b=({event:S})=>{const{relatedTarget:j,currentTarget:k}=S,_=j instanceof Node&&f.current?.contains(j),L=j instanceof Node&&k instanceof Node&&k.contains(j);!_&&!L&&o(!1)};return e.on("focus",v),e.on("blur",b),()=>{e.off("focus",v),e.off("blur",b)}},[e]),!e||!n&&!c)return null;const x=Z();return x?Gr.createPortal(r.jsx(J,{children:r.jsx(te.Tooltip.Provider,{children:r.jsxs(w.Toolbar.Root,{ref:m,className:Ds,style:h,children:[r.jsxs(w.Toolbar.Group,{className:ue,children:[r.jsx(as,{editor:e,currentColor:p?.color??null,isOpen:a==="color",onOpenChange:l("color")}),r.jsx(xs,{editor:e,currentFontFamily:p?.fontFamily??null,isOpen:a==="fontFamily",onOpenChange:l("fontFamily")})]}),r.jsx(w.Toolbar.Separator,{className:Se}),r.jsx(w.Toolbar.Group,{className:ue,children:r.jsx(vs,{editor:e,activeStyle:p?.fontSize??"text",isOpen:a==="fontSize",onOpenChange:l("fontSize")})}),r.jsx(w.Toolbar.Separator,{className:Se}),r.jsxs(w.Toolbar.Group,{className:ue,children:[r.jsx(re,{label:t("graph.toolbar.formatting.bold"),isActive:p?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:r.jsx("strong",{children:"B"})}),r.jsx(re,{label:t("graph.toolbar.formatting.italic"),isActive:p?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:r.jsx("em",{children:"I"})}),r.jsx(re,{label:t("graph.toolbar.formatting.underline"),isActive:p?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:r.jsx("u",{children:"U"})})]}),r.jsx(w.Toolbar.Separator,{className:Se}),r.jsx(w.Toolbar.Group,{className:ue,children:r.jsx(Rs,{editor:e,activeAlignment:p?.textAlign})}),r.jsx(w.Toolbar.Separator,{className:Se}),r.jsx(w.Toolbar.Group,{className:ue,children:r.jsx(Es,{editor:e,currentUrl:p?.linkUrl??null,isActive:p?.isLink??!1,isOpen:a==="link",onOpenChange:l("link")})})]})})}),x):null};var qs="_2ngohc0";const er=({editor:e,ariaLabel:t})=>r.jsxs("div",{className:qs,children:[r.jsx(Xs,{editor:e}),r.jsx(et.EditorContent,{editor:e,"aria-label":t})]}),tr=(e,t)=>{const n=g.useRef(e);n.current=e;const o=g.useRef(t);o.current=t;const a=g.useRef(null),s=g.useRef(null),c=g.useMemo(()=>{const l=()=>{s.current!==null&&(clearTimeout(s.current),s.current=null),a.current=null},d=()=>{s.current!==null&&(clearTimeout(s.current),s.current=null);const f=a.current;f!==null&&(a.current=null,n.current(...f))};return{run:(...f)=>{if(o.current<=0){n.current(...f);return}a.current=f,s.current!==null&&clearTimeout(s.current),s.current=setTimeout(d,o.current)},flush:d,cancel:l}},[]);return g.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),c},Vs=200,nr=({content:e,extensions:t,isEditable:n,onUpdate:o,updateDebounceMs:a=Vs})=>{const s=g.useRef(kt(e)),c=g.useRef(!1),l=tr(h=>{c.current=!0,o?.(h)},a),d=et.useEditor({extensions:t,content:s.current,editable:n,immediatelyRender:!1,onUpdate:({editor:h})=>l.run(h.getJSON())});return g.useEffect(()=>{d?.setEditable(n)},[d,n]),g.useEffect(()=>{if(!d)return;if(c.current){c.current=!1;return}const h=kt(e),f=d.getJSON();Us(f,h)||(l.cancel(),d.commands.setContent(h,{emitUpdate:!1}))},[d,e,l]),g.useEffect(()=>()=>l.flush(),[l]),d},kt=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Us=(e,t)=>JSON.stringify(e)===JSON.stringify(t);var Ys="_1cocly40";const Ks={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"},Ce=({content:e})=>r.jsx(r.Fragment,{children:rr(e.content??[e])}),rr=e=>e.map((t,n)=>Js(t,n)),Js=(e,t)=>{if(e.type==="text")return Zs(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return r.jsx("br",{},t);const n=e.content?rr(e.content):null;switch(e.type){case"doc":return r.jsx(g.Fragment,{children:n},t);case"heading":{const o=ni(e.attrs?.level);return ri(o,t,n,Ct(e.attrs))}case"paragraph":{const o=oe(e.attrs?.variant);return r.jsx("p",{"data-variant":o??void 0,style:or(Ct(e.attrs)),children:n},t)}case"blockquote":return r.jsx("blockquote",{children:n},t);case"bulletList":case"bullet_list":return r.jsx("ul",{children:n},t);case"orderedList":case"ordered_list":return r.jsx("ol",{children:n},t);case"listItem":case"list_item":return r.jsx("li",{children:n},t);default:return r.jsx("span",{children:n},t)}},Zs=(e,t)=>{const n=e.text??"";return!e.marks||e.marks.length===0?r.jsx("span",{children:n},t):e.marks.reduceRight((o,a,s)=>Qs(a,o,`${t}-${s}`),n)},Qs=(e,t,n)=>{switch(e.type){case"bold":case"strong":return r.jsx("strong",{children:t},n);case"italic":case"em":return r.jsx("em",{children:t},n);case"underline":return r.jsx("u",{children:t},n);case"strike":case"strikethrough":case"s":return r.jsx("s",{children:t},n);case"code":return r.jsx("code",{children:t},n);case"link":{const o=oe(e.attrs?.href);return u.isSafeUrl(o)?r.jsx("a",{className:Ys,href:o,rel:"noopener noreferrer",target:"_blank",children:t},n):r.jsx("span",{children:t},n)}case"textStyle":{const o=ei(e.attrs);return o?r.jsx("span",{style:o,children:t},n):r.jsx("span",{children:t},n)}default:return r.jsx("span",{children:t},n)}},Lt=e=>{const t=oe(e&&typeof e=="object"?e.fontFamily:e);if(t)return Ks[t]??t},ei=e=>{if(!e)return null;const t={},n=oe(e.color);n&&(t.color=n);const o=Lt(e.font)??Lt(e.fontFamily);o&&(t.fontFamily=o);const a=ti(e.fontSize);return a&&(t.fontSize=a),Object.keys(t).length>0?t:null},ti=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:oe(e),oe=e=>typeof e=="string"&&e.length>0?e:void 0,ni=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),ri=(e,t,n,o)=>{const a=or(o);switch(e){case 1:return r.jsx("h1",{style:a,children:n},t);case 2:return r.jsx("h2",{style:a,children:n},t);case 3:return r.jsx("h3",{style:a,children:n},t)}},Ct=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},or=e=>e?{textAlign:e}:void 0;var oi="_4dlrid0",ar="_4dlrid1",ai="xfz7dq0",si="xfz7dq1",ii="xfz7dq2",li="xfz7dq3",ci="xfz7dq4";const sr=({ref:e,footerRect:t,mode:n="readonly",caption:o,isCaptionVisible:a,source:s,isSourceVisible:c})=>{const l=n==="editable",d=a&&(l||o!==null),h=c&&s!==null&&gi(s);return!d&&!h?null:r.jsxs("div",{ref:e,className:ai,style:{left:t.x,top:t.y,width:t.width},children:[d?l?r.jsx(fi,{caption:o}):r.jsx(di,{caption:o}):null,h&&r.jsx(ui,{source:s})]})},di=({caption:e})=>e===null?null:typeof e=="string"?r.jsx("p",{className:ar,children:e}):r.jsx(Ce,{content:e}),ui=({source:e})=>{const t=u.isSafeUrl(e.url)?e.url:void 0,n=e.label??(t!==void 0?hi(t):"");return n===""&&t===void 0?null:r.jsxs("div",{className:si,children:[r.jsx("span",{className:li,children:"Source:"}),t!==void 0?r.jsx("a",{className:ii,href:t,target:"_blank",rel:"noopener noreferrer",children:n}):r.jsx("span",{className:ci,children:n})]})},hi=e=>{try{return new URL(e).hostname}catch{return e}},gi=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",fi=({caption:e})=>{const t=tt(),n=g.useMemo(()=>Ha({placeholder:"Add caption"}),[]),o=nr({content:e,extensions:n,isEditable:!0,onUpdate:a=>{const s=Ls(a)?null:a;t(new u.SetContentCaptionCommand({caption:s}))}});return r.jsx(er,{editor:o,ariaLabel:"Chart caption"})};var pi="_1k4qtbg0";const mi=3,xi=({title:e,isTitleVisible:t,subtitle:n,isSubtitleVisible:o})=>{const a=[];return t&&a.push({type:"heading",attrs:{level:mi},content:yi(e)}),o&&a.push(...bi(n)),{type:"doc",content:a}},vi=e=>{const t=e.content??[],[n,...o]=t;return{title:Si(n?.content??[]),subtitle:ji(o)}},it=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(it)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),yi=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??[],bi=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(Tt):[Tt(e)],Tt=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Si=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(it)}},ji=e=>{const t=e.filter(o=>(o.content??[]).length>0);if(t.length===0)return null;const[n]=t;if(n&&t.length===1&&n.type==="paragraph"){const o=n.content??[],[a]=o;if(a&&o.length===1&&a.type==="text"&&(!a.marks||a.marks.length===0))return a.text??null}return{type:"doc",content:t.map(it)}},ir=({ref:e,headerRect:t,mode:n="readonly",title:o,isTitleVisible:a,subtitle:s,isSubtitleVisible:c})=>{const l=n==="editable";return!(a&&(l||o!==null))&&!(c&&(l||s!==null))?null:r.jsx("div",{ref:e,className:pi,style:{left:t.x,top:t.y,width:t.width},children:l?r.jsx(Li,{title:o,isTitleVisible:a,isSubtitleVisible:c,subtitle:s},[a?"title":"",c?"subtitle":""].join("-")):r.jsx(ki,{title:o,isTitleVisible:a,isSubtitleVisible:c,subtitle:s})})},ki=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const a=t&&e!==null,s=n&&o!==null;return r.jsxs(r.Fragment,{children:[a&&(typeof e=="string"?r.jsx("h1",{className:oi,children:e}):r.jsx(Ce,{content:e})),s&&(typeof o=="string"?r.jsx("p",{className:ar,children:o}):r.jsx(Ce,{content:o}))]})},Li=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const a=tt(),s=g.useMemo(()=>Fa({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:n}),[t,n]),c=g.useMemo(()=>xi({title:e,isTitleVisible:t,subtitle:o,isSubtitleVisible:n}),[e,t,o,n]),l=nr({content:c,extensions:s,isEditable:!0,onUpdate:d=>{const h=vi(d);t&&a(new u.SetContentTitleCommand({title:h.title})),n&&a(new u.SetContentSubtitleCommand({subtitle:h.subtitle}))}});return r.jsx(er,{editor:l,ariaLabel:"Chart title and subtitle"})};var Ci="_1u9qprb0",Ti="_1u9qprb1",wi="_9aen060",Ai="_9aen061",Pi="_9aen062",lr="_9aen063";const Ei=Object.freeze(Object.defineProperty({__proto__:null,groupRow:Pi,item:lr,trendRow:Ai,valueRow:wi},Symbol.toStringTag,{value:"Module"})),_i=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7-7 7 7"}),r.jsx("path",{d:"M12 19V5"})]})}),Mi=e=>r.jsx(V,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M5 12h14"})})});var cr="n7clvo0",Fi="n7clvo1",Hi="n7clvo2",Bi="n7clvo3",dr={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},Ii={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},Ni={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},Ri={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const Di=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return r.jsx(Ae,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return r.jsx("div",{className:Ri[e.direction],children:e.direction==="flat"?r.jsx(Mi,{size:"xs",title:""}):r.jsx(_i,{size:"xs",title:""})});const n=e.fontRole==="value"?dr[t]:Ii[t];return r.jsx("span",{className:F.clsx(Oi(e),n),children:e.text})},Oi=e=>{switch(e.textRole){case"value":return cr;case"observation":return Fi;case"trendPercentage":return Ni[e.trendDirection??"up"];case"trendReference":return Hi;case"label":return Bi}},Gi=({item:e,resolvedSize:t})=>r.jsx("div",{className:lr,children:u.createHeadlineItemRows(e).map(n=>r.jsx(zi,{row:n,resolvedSize:t},n.role))}),zi=({row:e,resolvedSize:t})=>{const n=e.role==="trendRow";return r.jsx("div",{className:Ei[e.role],"data-testid":n?"headline-trend":void 0,"data-direction":n?Wi(e):void 0,role:n?"img":void 0,"aria-label":n?e.ariaLabel:void 0,children:e.segments.map((o,a)=>r.jsx(Di,{segment:o,resolvedSize:t},a))})},Wi=e=>{const t=e.segments.find(n=>n.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},$i=({headline:e,rect:t,resolvedSize:n,visibleItemCount:o})=>{const a={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?r.jsx("div",{className:Ti,style:a,children:r.jsx("span",{className:F.clsx(cr,dr[n]),children:e.value})}):r.jsx("div",{className:Ci,style:a,children:e.items.slice(0,o).map((s,c)=>r.jsx(Gi,{item:s,resolvedSize:n},`${s.label}-${c}`))})};var Xi="_1oj6yix0",qi="_1oj6yix1",Vi="_1oj6yix2";const Ui=8,Yi=16,Ki=2,Ji=({legends:e,containerRect:t,textScale:n})=>{const{lineBoxHeight:o}=In(n),{placements:a,hasOverlap:s}=Zi(e,t,o);if(a.length===0)return null;const c=s?Yi:Ui,l=c-Ki;return r.jsxs("div",{className:Xi,children:[s&&r.jsx("svg",{className:qi,width:t.width,height:t.height,children:a.map(d=>r.jsx(Qi,{anchorY:d.anchorY,labelY:d.y,endX:l,color:d.payload.color},d.payload.key))}),a.map(d=>r.jsx("span",{className:Vi,style:{left:c,top:d.y,color:d.payload.color},children:d.payload.label},d.payload.key))]})},Zi=(e,t,n)=>g.useMemo(()=>{const o=[];for(const a of e)for(const s of a.items){if(s.normalizedY===null)continue;const c=typeof s.visual.color=="string"?s.visual.color:void 0;o.push({normalizedY:s.normalizedY,payload:{key:String(o.length),label:s.formattedLabel,color:c}})}return o.length===0||t.height<=0?{placements:[],hasOverlap:!1}:u.computeDirectLabelsLayout({items:o,containerHeight:t.height,labelHeight:n})},[e,t.height,n]),Qi=({anchorY:e,labelY:t,endX:n,color:o})=>{const a=n/2;return r.jsx("path",{d:`M0,${e} C${a},${e} ${a},${t} ${n},${t}`,fill:"none",stroke:o??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var el="_6a636s0";const tl=/\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu,ur="😀";class _e{constructor(){this.emojiCorrections=new Map,this.currentFont="";const n=new OffscreenCanvas(1,1).getContext("2d");if(!n)throw new Error("Failed to create OffscreenCanvas 2D context");this.ctx=n}static async create(){return typeof document<"u"&&"fonts"in document&&await document.fonts.ready,new _e}measureText(t,n){const o=u.buildFontString(n);this.setFont(o);const{width:a,fontBoundingBoxAscent:s,fontBoundingBoxDescent:c}=this.ctx.measureText(t);let l=a;const d=nl(t);if(d>0){const h=this.getEmojiCorrection(o);l-=h*d}return{width:l,height:s+c,ascent:s,descent:c}}setFont(t){this.currentFont!==t&&(this.ctx.font=t,this.currentFont=t)}getEmojiCorrection(t){const n=this.emojiCorrections.get(t);if(n!==void 0)return n;this.setFont(t);const o=this.ctx.measureText(ur).width,a=rl(t);let s=0;if(a!==null){const c=o-a;s=c>.5?c:0}return this.emojiCorrections.set(t,s),s}}let X=null;const nl=e=>{const t=e.match(tl);return t?t.length:0},rl=e=>{const t=ol();return t?(t.style.font=e,t.getBoundingClientRect().width):null},ol=()=>typeof document>"u"?null:(X||(X=document.createElement("span"),X.style.position="absolute",X.style.visibility="hidden",X.style.whiteSpace="nowrap",X.style.left="-9999px",X.textContent=ur,document.body.appendChild(X)),X),hr=g.createContext(null),gr=({children:e,measurer:t})=>{const[n,o]=g.useState(null);g.useEffect(()=>{if(t!==void 0)return;let s=!1;const c=()=>{s||o(al())};return(async()=>{typeof document<"u"&&"fonts"in document&&await document.fonts.ready,c()})(),typeof document<"u"&&"fonts"in document&&document.fonts.addEventListener("loadingdone",c),()=>{s=!0,typeof document<"u"&&"fonts"in document&&document.fonts.removeEventListener("loadingdone",c)}},[t]);const a=t??n;return a===null?null:r.jsx(hr.Provider,{value:a,children:e})},Q=()=>{const e=g.useContext(hr);if(e===null)throw new Error("useTextMeasurer must be used inside a <TextMeasurerProvider>.");return e},al=()=>{try{return new u.CachedTextMeasurer(new _e)}catch{return new u.CachedTextMeasurer(new u.HeuristicTextMeasurer)}};var sl="_1kjk02r0",il="_1kjk02r1",ll="_1kjk02r2",cl="_1kjk02r3",dl="_1kjk02r4",ul="_1kjk02r5",hl="_1kjk02r6",gl="_1kjk02r7",fl="_1kjk02r8",pl="_1kjk02r9",ml="_1kjk02ra",xl="_1kjk02rb",vl="_1dw9dgx0";const yl="#9ca3af",De="\0",bl=e=>{const t=[];return e.forEach((n,o)=>{const a=n.aesthetics.includes("size");for(const s of n.items){if(a){const h=Number(s.visual.size);if(!Number.isFinite(h)||h<=0)continue}const c=s.visual.color??"",l=a?`${De}${Number(s.visual.size)}`:"",d=s.visual.lineType;t.push({key:`${o}${De}${String(s.value)}${De}${c}${l}`,formattedLabel:s.formattedLabel,visual:s.visual,swatchShape:s.swatchShape,isBubble:a,primaryLineType:d})}}),t},fr=({pill:e})=>e.isBubble?r.jsx(kl,{pill:e}):r.jsx(jl,{pill:e}),Sl=({color:e,lineType:t,shape:n})=>{const{legendSwatchWidth:o,legendSwatchHeight:a}=rt();return e?r.jsx(Ae,{shape:n,color:e,lineType:t,width:o,height:a}):null},jl=({pill:e})=>r.jsxs(r.Fragment,{children:[r.jsx(Sl,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),r.jsx("span",{children:e.formattedLabel})]}),kl=({pill:e})=>{const t=Number(e.visual.size);return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:vl,style:{width:t,height:t,backgroundColor:e.visual.color??yl}}),r.jsx("span",{children:e.formattedLabel})]})},Ll=({hiddenPills:e,placement:t})=>{const n=$.useI18n(),[o,a]=g.useState(!1),{refs:s,floatingStyles:c}=M.useFloating({open:o,placement:t,middleware:[M.offset(4),M.flip(),M.shift({padding:8})]});g.useEffect(()=>{if(!o)return;const f=m=>{const x=m.target;if(!x)return;const v=s.reference.current,b=s.floating.current;v instanceof Element&&v.contains(x)||b instanceof Element&&b.contains(x)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)};return document.addEventListener("pointerdown",f),document.addEventListener("keydown",p),()=>{document.removeEventListener("pointerdown",f),document.removeEventListener("keydown",p)}},[o,s.floating,s.reference]);const l=t==="left"||t==="right",d=Math.min(e.length-1,mn),h=Array.from({length:d},(f,p)=>d-p);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:s.setReference,className:F.clsx(sl,{[ll]:l,[il]:!l}),children:[h.map(f=>r.jsx("span",{className:F.clsx(cl,{[ul]:l,[dl]:!l}),style:Cl(f,l),"aria-hidden":!0},f)),r.jsx("button",{type:"button",className:F.clsx(hl,{[gl]:o}),onClick:()=>a(f=>!f),"aria-haspopup":"dialog","aria-expanded":o,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:r.jsxs("span",{className:fl,children:["+",e.length]})})]}),o&&r.jsx("div",{ref:s.setFloating,role:"dialog","aria-label":n("graph.legend.hiddenItems"),className:pl,style:c,children:r.jsx("ul",{className:ml,children:e.map(f=>r.jsx("li",{className:xl,children:r.jsx(fr,{pill:f})},f.key))})})]})},Cl=(e,t)=>{const n=-e*xn;return{transform:t?`translateY(${n}px)`:`translateX(${n}px)`}};var Tl="_1cecisi0",wl="_1cecisi1",Al="_1cecisi2",Pl="_1cecisi3";const El=({edge:e,formattedLegends:t,containerWidth:n,containerHeight:o,textScale:a})=>{const s=Q(),c=rt(),l=g.useMemo(()=>bl(t),[t]),d=e==="left"||e==="right",h=d?o:n,f=g.useMemo(()=>{if(l.length===0)return{visibleCount:0,hasOverflow:!1};if(h<=0)return{visibleCount:l.length,hasOverflow:!1};const v=Y(vn,a),b={family:bn,size:v},S=v*yn,j=G=>d?_l(G,S,c):wt({label:G.formattedLabel,swatchInlineSize:Ml(G,c.legendSwatchWidth),textMeasurer:s,font:b,swatchGap:c.legendSwatchGap,horizontalChrome:c.legendPillHorizontalChrome}),k=l.map(j),L=(d?S+c.legendPillVerticalChrome:wt({label:`+${l.length}`,swatchInlineSize:0,textMeasurer:s,font:b,swatchGap:c.legendSwatchGap,horizontalChrome:c.legendPillHorizontalChrome}))+ta;return Hl({pillSizes:k,overflowPillSize:L,containerSize:h,gap:c.legendItemGap})},[l,h,d,s,a,c]);if(l.length===0)return null;const p=l.slice(0,f.visibleCount),m=l.slice(f.visibleCount),x=f.hasOverflow&&m.length>0;return r.jsxs("div",{className:F.clsx(Tl,{[Al]:d,[wl]:!d}),children:[p.map(v=>r.jsx("div",{className:Pl,children:r.jsx(fr,{pill:v})},v.key)),x&&r.jsx(Ll,{hiddenPills:m,placement:Bl(e)})]})},wt=({label:e,swatchInlineSize:t,textMeasurer:n,font:o,swatchGap:a,horizontalChrome:s})=>{const c=n.measureText(e,o).width,l=t>0?a:0;return t+l+c+s},_l=(e,t,n)=>{const o=Fl(e,n.legendSwatchHeight);return Math.max(t,o)+n.legendPillVerticalChrome},Ml=(e,t)=>e.isBubble?Number(e.visual.size):Nn(e.visual.color,t),Fl=(e,t)=>e.isBubble?Number(e.visual.size):t,Hl=({pillSizes:e,overflowPillSize:t,containerSize:n,gap:o})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let a=0;for(let l=0;l<e.length;l+=1)l>0&&(a+=o),a+=e[l]??0;if(a<=n)return{visibleCount:e.length,hasOverflow:!1};let s=0,c=0;for(const l of e){const d=s+(c>0?o:0)+l;if(d+o+t>n)break;s=d,c+=1}return{visibleCount:c,hasOverflow:!0}},Bl=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Il=g.memo(function({formattedLegends:t,rects:n,textScale:o}){const a=g.useMemo(()=>{const s=new Map;for(const c of t){let l=s.get(c.position);l||(l={pill:[],direct:[]},s.set(c.position,l)),c.display==="pill"?l.pill.push(c):l.direct.push(c)}return s},[t]);return r.jsx(r.Fragment,{children:Array.from(a,([s,c])=>{const l=n[s];return l===void 0?null:r.jsxs("div",{className:el,style:{left:l.x,top:l.y,width:l.width,height:l.height},children:[r.jsx(El,{edge:s,formattedLegends:c.pill,containerWidth:l.width,containerHeight:l.height,textScale:o}),r.jsx(Ji,{legends:c.direct,containerRect:l,textScale:o})]},s)})})});const lt=1,pr=8,Nl=12;i.pointStrokeColor;const Rl=1,Dl=2,Ol=.7,ae=({hit:e})=>{const t=u.getColor(e.observation),n=(u.getAlpha(e.observation)??lt)*Ol,o=(u.getSize(e.observation)??pr)/2;return r.jsx("circle",{cx:u.toPercent(u.toViewBoxX(e.x)),cy:u.toPercent(u.toViewBoxY(e.y)),r:o,fill:t,opacity:n,stroke:i.hoveredPointRingColor,strokeWidth:Dl,"data-testid":"companion-point"})},mr=.3,xr=1,I={type:"spring",stiffness:500,damping:60,mass:1},Je=(e,t)=>{const n=T.useMotionValue(e);return g.useEffect(()=>{const o=$r.interpolatePath(n.get(),e);T.animate(0,1,{...t,onUpdate:a=>{const s=o(a);return n.set(s)}})},[t,e,n]),n};var ie="_1d8mpa10";const Gl=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const{lineGenerator:a,areaGenerator:s}=g.useMemo(()=>u.createAreaPathGenerators(n,t.params),[t.params,n]),c=g.useMemo(()=>{const l=u.createStableKeyGenerator(t.data,t.mapping,t.id),d=[];return t.data.groupBy(u.GROUP_VARIABLES.group).forEach(h=>{const f=u.prepareAreaObservations([...h],t.params.missingValues),p=s(f),m=a(f);if(!p||!m)return;const x=f[0];if(!x)return;const v=u.getColor(x),b=u.getAlpha(x),S=u.resolveStrokeWidth(x,t.params),j=u.getDashArray(u.getLineType(x));d.push({key:l(x),areaPath:p,linePath:m,color:v,fillOpacity:b??mr,strokeWidth:S,strokeOpacity:xr,strokeDasharray:j})}),d},[s,a,t.data,t.id,t.mapping,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:ie,children:c.map(l=>r.jsx(zl,{areaPath:l.areaPath,linePath:l.linePath,color:l.color,fillOpacity:l.fillOpacity,strokeWidth:l.strokeWidth,strokeOpacity:l.strokeOpacity,strokeDasharray:l.strokeDasharray,isAnimated:o},l.key))})}),zl=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:a,strokeOpacity:s,strokeDasharray:c,isAnimated:l})=>l?r.jsx(Wl,{areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:a,strokeOpacity:s,strokeDasharray:c}):r.jsxs("g",{children:[r.jsx("path",{d:e,fill:n,fillOpacity:o,stroke:"none"}),r.jsx("path",{d:t,fill:"none",stroke:n,strokeWidth:a,strokeOpacity:s,strokeDasharray:c,vectorEffect:"non-scaling-stroke"})]}),Wl=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:a,strokeOpacity:s,strokeDasharray:c})=>{const l=Je(e,I),d=Je(t,I);return r.jsxs("g",{children:[r.jsx(T.motion.path,{d:l,fill:n,fillOpacity:o,stroke:"none"}),r.jsx(T.motion.path,{d,fill:"none",stroke:n,strokeWidth:a,strokeOpacity:s,strokeDasharray:c,vectorEffect:"non-scaling-stroke"})]})};var $l="_46ebsf0";const Oe=1,Xl=2,ql=1,Vl=Nl/2,Ul=2.25,ct=({hit:e,...t})=>{const n=Yl(e.observation),o=u.getColor(e.observation),a=u.getAlpha(e.observation)??lt,s=u.toPercent(u.toViewBoxX(e.x)),c=u.toPercent(u.toViewBoxY(e.y)),d=n+Oe/2+ql+Oe/2;return r.jsxs("g",{...t,className:$l,children:[r.jsx("circle",{cx:s,cy:c,r:d,fill:"none",stroke:i.hoveredPointRingColor,strokeWidth:Xl}),r.jsx("circle",{cx:s,cy:c,r:n,fill:o,opacity:a,stroke:i.hoveredPointRingColor,strokeWidth:Oe})]})},Yl=e=>{const t=u.getSize(e);return u.isDefined(t)?t/Ul:Vl},Kl=({layer:e,coordSystem:t,primary:n,companions:o})=>{const a=u.getGroup(n.observation),s=g.useMemo(()=>{const m=e.data.filter(u.GROUP_VARIABLES.group,"eq",a);return u.prepareAreaObservations([...m],e.params.missingValues)},[e.data,e.params.missingValues,a]),{areaPath:c,linePath:l}=g.useMemo(()=>{const{lineGenerator:m,areaGenerator:x}=u.createAreaPathGenerators(t,e.params);return{areaPath:x(s)??"",linePath:m(s)??""}},[t,e.params,s]);if(!c||!l)return null;const d=u.getColor(n.observation),h=u.getAlpha(n.observation)??mr,f=u.resolveStrokeWidth(n.observation,e.params),p=u.getDashArray(u.getLineType(n.observation));return r.jsxs("g",{"data-testid":"hovered-area",children:[r.jsxs("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:ie,children:[r.jsx("path",{d:c,fill:d,fillOpacity:h,stroke:"none","data-testid":"hovered-area-fill"}),r.jsx("path",{d:l,fill:"none",stroke:d,strokeWidth:f,strokeOpacity:xr,strokeDasharray:p,vectorEffect:"non-scaling-stroke","data-testid":"hovered-area-edge"})]}),o.map(m=>r.jsx(ae,{hit:m},`companion-${m.layerId}-${m.pointIndex}`)),r.jsx(ct,{hit:n,"data-testid":"hovered-area-point"})]})},Jl={geom:"area",coord:"cartesian",guideMode:"continuous",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(Gl,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({layer:e,coordSystem:t,primary:n,group:o,related:a})=>r.jsx(Kl,{layer:e,coordSystem:t,primary:n,companions:[...o,...a]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ae,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e,coordSystem:t})=>{if(t.mainAxis==="x"){const a=u.getX(e),s=u.getYMax(e)??u.getY(e);return a===null||s===null?null:{x:a,y:s}}const n=u.getY(e),o=u.getXMax(e)??u.getX(e);return n===null||o===null?null:{x:o,y:n}}},vr=1,pe=4,Zl=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const a=g.useId(),s=g.useMemo(()=>{const l=u.createStableKeyGenerator(t.data,t.mapping,t.id),d=new Map;for(const h of t.data){const f=u.getBarRectBounds(n.mainAxis,h);if(!f)continue;const p=ec(n.mainAxis,f),m=d.get(p),x={key:l(h),...f,fill:u.getColor(h),opacity:u.getAlpha(h)??vr};m?m.push(x):d.set(p,[x])}return[...d.entries()].map(([h,f])=>({id:`${a}${h}`,bars:f,...tc(f)}))},[a,n.mainAxis,t]),c=s.filter(l=>l.bars.length>1);return r.jsxs(r.Fragment,{children:[c.length>0&&r.jsx("defs",{children:c.map(l=>r.jsx("clipPath",{id:l.id,children:r.jsx(Ql,{column:l,isAnimated:o})},l.id))}),s.map(l=>{const[d]=l.bars;if(l.bars.length===1&&d!==void 0){const{key:h,...f}=d;return r.jsx(At,{...f,rx:pe,isAnimated:o},h)}return r.jsx("g",{clipPath:`url(#${l.id})`,children:l.bars.map(h=>{const{key:f,...p}=h;return r.jsx(At,{...p,isAnimated:o},f)})},l.id)})]})}),At=({isAnimated:e,rx:t,...n})=>e?r.jsx(T.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:I,fill:n.fill,opacity:n.opacity,rx:t,animate:{x:u.toPercent(n.x),y:u.toPercent(n.y),width:u.toPercent(n.width),height:u.toPercent(n.height),opacity:n.opacity}}):r.jsx("rect",{style:{transformBox:"view-box"},x:u.toPercent(n.x),y:u.toPercent(n.y),width:u.toPercent(n.width),height:u.toPercent(n.height),fill:n.fill,opacity:n.opacity,rx:t}),Ql=({column:e,isAnimated:t})=>t?r.jsx(T.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:I,rx:pe,animate:{x:u.toPercent(e.x),y:u.toPercent(e.y),width:u.toPercent(e.width),height:u.toPercent(e.height)}}):r.jsx("rect",{x:u.toPercent(e.x),y:u.toPercent(e.y),width:u.toPercent(e.width),height:u.toPercent(e.height),rx:pe}),ec=(e,t)=>e==="x"?`${t.x}-${t.width}`:`${t.y}-${t.height}`,tc=e=>{let t=1/0,n=1/0,o=-1/0,a=-1/0;for(const s of e)s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x+s.width>o&&(o=s.x+s.width),s.y+s.height>a&&(a=s.y+s.height);return{x:t,y:n,width:o-t,height:a-n}};var nc="_1suo8ub0";const he=3,rc=({coordSystem:e,primary:t,panelRect:n})=>{const o=u.getBarRectBounds(e.mainAxis,t.observation);if(!o)return null;const a=o.x*n.width,s=o.y*n.height,c=o.width*n.width,l=o.height*n.height,d=a-he,h=s-he,f=c+he*2,p=l+he*2,m=pe+he,x=u.getColor(t.observation),v=u.getAlpha(t.observation)??vr;return r.jsxs("g",{"data-testid":"hovered-bar",children:[r.jsx("rect",{x:d,y:h,width:f,height:p,rx:m,fill:i.hoveredBarBorderColor,className:nc,"data-testid":"hovered-bar-border"}),r.jsx("rect",{x:u.toPercent(o.x),y:u.toPercent(o.y),width:u.toPercent(o.width),height:u.toPercent(o.height),fill:x,opacity:v,rx:pe,"data-testid":"hovered-bar-fill"})]})},oc={geom:"bar",coord:"cartesian",guideMode:"bar",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(Zl,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({coordSystem:e,primary:t,panelRect:n})=>r.jsx(rc,{coordSystem:e,primary:t,panelRect:n}),renderHoverCompanions:()=>null},yr=1,ac=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>u.createLinePathGenerator(t.params),[t.params]),a=g.useMemo(()=>{const s=u.createStableKeyGenerator(t.data,t.mapping,t.id),c=[];return t.data.groupBy(u.GROUP_VARIABLES.group).forEach(l=>{const d=u.prepareLineObservations([...l],t.params.missingValues),h=o(d);if(!h)return;const f=d[0];if(!f)return;const p=u.getColor(f),m=u.getAlpha(f),x=u.resolveStrokeWidth(f,t.params),v=u.getDashArray(u.getLineType(f));c.push({key:s(f),pathData:h,color:p,opacity:m??yr,strokeWidth:x,strokeDasharray:v})}),c},[o,t.data,t.id,t.mapping,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:ie,children:a.map(s=>r.jsx(sc,{pathData:s.pathData,color:s.color,strokeWidth:s.strokeWidth,opacity:s.opacity,strokeDasharray:s.strokeDasharray,isAnimated:n},s.key))})}),sc=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:a,isAnimated:s})=>s?r.jsx(ic,{pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:a}):r.jsx("path",{d:e,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:a,vectorEffect:"non-scaling-stroke"}),ic=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:a})=>{const s=Je(e,I);return r.jsx(T.motion.path,{d:s,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:a,vectorEffect:"non-scaling-stroke"})},lc=({layer:e,primary:t,companions:n})=>{const o=u.getGroup(t.observation),a=g.useMemo(()=>{const f=e.data.filter(u.GROUP_VARIABLES.group,"eq",o);return u.prepareLineObservations([...f],e.params.missingValues)},[e.data,e.params.missingValues,o]),s=g.useMemo(()=>u.createLinePathGenerator(e.params)(a),[e.params,a]);if(!s)return null;const c=u.getColor(t.observation),l=u.getAlpha(t.observation)??yr,d=u.resolveStrokeWidth(t.observation,e.params),h=u.getDashArray(u.getLineType(t.observation));return r.jsxs("g",{"data-testid":"hovered-line",children:[r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:ie,children:r.jsx("path",{d:s,fill:"none",stroke:c,strokeWidth:d,opacity:l,strokeDasharray:h,vectorEffect:"non-scaling-stroke","data-testid":"hovered-line-path"})}),n.map(f=>r.jsx(ae,{hit:f},`companion-${f.layerId}-${f.pointIndex}`)),r.jsx(ct,{hit:t,"data-testid":"hovered-line-point"})]})},cc={geom:"line",coord:"cartesian",guideMode:"continuous",render:({layer:e,isAnimated:t})=>r.jsx(ac,{layer:e,isAnimated:t}),renderHover:({layer:e,primary:t,group:n,related:o})=>r.jsx(lc,{layer:e,primary:t,companions:[...n,...o]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ae,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=u.getX(e),n=u.getY(e);return t===null||n===null?null:{x:t,y:n}}},dc=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>{const a=[];let s=0;for(const c of t.data){const l=s++,d=u.getX(c),h=u.getY(c);if(d===null||h===null)continue;const f=u.getColor(c),p=u.getAlpha(c),m=u.getSize(c),x=u.getStrokeWidth(c);a.push({key:String(l),cx:u.toViewBoxX(d),cy:u.toViewBoxY(h),radius:(m??t.params.size)/2,fill:f,stroke:i.pointStrokeColor,opacity:p??lt,strokeWidth:x??Rl})}return a},[t.data,t.params.size]);return r.jsx(r.Fragment,{children:o.map(a=>n?r.jsx(T.motion.circle,{initial:!1,transition:I,fill:a.fill,stroke:a.stroke,strokeWidth:a.strokeWidth,animate:{cx:u.toPercent(a.cx),cy:u.toPercent(a.cy),r:a.radius,opacity:a.opacity}},a.key):r.jsx("circle",{cx:u.toPercent(a.cx),cy:u.toPercent(a.cy),r:a.radius,fill:a.fill,opacity:a.opacity,stroke:a.stroke,strokeWidth:a.strokeWidth},a.key))})}),uc={geom:"point",coord:"cartesian",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(dc,{layer:e,isAnimated:t}),renderHover:({primary:e,group:t,related:n})=>r.jsxs("g",{"data-testid":"hovered-point",children:[[...t,...n].map(o=>r.jsx(ae,{hit:o},`companion-${o.layerId}-${o.pointIndex}`)),r.jsx(ct,{hit:e})]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ae,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=u.getX(e),n=u.getY(e);return t===null||n===null?null:{x:t,y:n}}},hc=11.7,gc=E.xs,fc=N,pc=q.medium,ge=5,mc=5,Pt=10,Et=10,xc=4,Te=13,br=6,Ge=12,_t=21.6,vc="0 0 10 18",yc="M2.48935 16.9323L9.07098 9.82964C9.51595 9.34944 9.51504 8.60728 9.0689 8.12818L2.48866 1.06172C1.85811 0.384586 0.974477 0 0.049217 0H0V18H0.0443689C0.972463 18 1.85854 17.6131 2.48935 16.9323Z",Mt="#FFFFFF",ze="#1A1A1A";var bc="_16vokpr0";const Sc=(e,t)=>{const n=e.mapping.y!==void 0,o=t.mainAxis==="y";return n!==o},jc=(e,t)=>{const n=u.toPercent(e?1-t:t);return e?{x1:"0%",y1:n,x2:"100%",y2:n}:{x1:n,y1:"0%",x2:n,y2:"100%"}},kc=(e,t)=>e==="solid"?{}:e==="dotted"?{strokeDasharray:`0 ${t*2}`,strokeLinecap:"round"}:{strokeDasharray:`${t*2} ${t*3}`,strokeLinecap:"round",strokeMiterlimit:16},Lc=e=>{const t=e.params.color,n=t??i.targetLineColor;let o=i.targetLineLabelTextColor;if(t!==void 0)try{o=qe.getContrast(t,Mt)>qe.getContrast(t,ze)?Mt:ze}catch{o=ze}return{lineColor:n,labelTextColor:o}},Cc=(e,t)=>je(e)&&je(t)?`${e}: ${t}`:je(e)?e:je(t)?t:null,je=e=>e!=null&&e.trim()!=="",Tc=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:a,text:s,isAnimated:c})=>{const l=e==="start",d=l?-Te:-(o-Te),h=l?d+o-ge:d+ge-Ge,f=l?void 0:`rotate(180 ${h+Ge/2} ${a/2})`,p=l?"0%":"100%",m=u.toPercent(1-t),x=r.jsxs("g",{transform:`translate(0, ${-a/2})`,pointerEvents:"none",children:[r.jsx("rect",{x:d,y:0,width:o,height:a,rx:br,fill:n}),r.jsx("g",{transform:f,children:r.jsx("svg",{x:h,y:(a-_t)/2,width:Ge,height:_t,viewBox:vc,overflow:"visible",children:r.jsx("path",{d:yc,fill:n})})}),r.jsx("g",{transform:`translate(${d+ge}, ${a/2})`,children:s})]});return c?r.jsx(T.motion.svg,{initial:!1,transition:I,x:p,animate:{y:m},overflow:"visible",children:x}):r.jsx("svg",{x:p,y:m,overflow:"visible",children:x})},wc=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:a,text:s,isAnimated:c})=>{const l=e==="start",d=l?-Te:-(a-Te),h=u.toPercent(t),f=l?"100%":"0%",p=r.jsxs("g",{transform:`translate(${-o/2}, 0)`,pointerEvents:"none",children:[r.jsx("rect",{x:0,y:d,width:o,height:a,rx:br,fill:n}),r.jsx("g",{transform:`translate(${ge}, ${d+a/2})`,children:s})]});return c?r.jsx(T.motion.svg,{initial:!1,transition:I,y:f,animate:{x:h},overflow:"visible",children:p}):r.jsx("svg",{x:h,y:f,overflow:"visible",children:p})},Ac=({label:e,textWidth:t,labelPosition:n,isHorizontalLine:o,position:a,color:s,textColor:c,symbolShape:l,symbolColor:d,isAnimated:h})=>{const f=l===null?0:Pt+xc,p=t+f+ge*2,m=hc+mc*2,x=r.jsxs(r.Fragment,{children:[l!==null&&d!==null&&r.jsx("g",{transform:`translate(0, ${-Et/2})`,children:r.jsx(Ae,{shape:l,color:d,width:Pt,height:Et})}),r.jsx("text",{x:f,textAnchor:"start",dominantBaseline:"central",fill:c,style:{font:i.fontGoalLineLabel},children:e})]});return o?r.jsx(Tc,{labelPosition:n,linePosition:a,color:s,pillWidth:p,pillHeight:m,text:x,isAnimated:h}):r.jsx(wc,{labelPosition:n,linePosition:a,color:s,pillWidth:p,pillHeight:m,text:x,isAnimated:h})},Pc=({layer:e,isHorizontalLine:t,position:n,lineColor:o,isAnimated:a})=>{const s=jc(t,n),c=kc(e.params.lineType,e.params.strokeWidth);return a?r.jsx(T.motion.line,{initial:!1,transition:I,animate:{x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},...c,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"}):r.jsx("line",{...s,...c,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"})},Ec=g.memo(function({layer:t,coordSystem:n,formattingLocale:o,isAnimated:a}){const s=Q(),{guides:c,numberFormat:l,textScale:d,layers:h,colorScale:f}=P(W.useShallow(L=>({guides:L.guides,numberFormat:L.config.numberFormat,textScale:L.config.appearance.textScale,layers:L.spec.layers,colorScale:L.scales.color}))),p=g.useMemo(()=>u.buildAverageLineSymbols(h,f,n).get(t.id)??null,[h,f,n,t.id]),m=g.useMemo(()=>Cc(t.params.label,u.formatRuleValue({guides:c,numberFormat:l,layer:t,locale:o})),[c,l,o,t]),x=g.useMemo(()=>({family:fc,size:Y(gc,d),weight:pc}),[d]),v=g.useMemo(()=>m===null?0:s.measureText(m,x).width,[m,x,s]),b=t.data.getFirst();if(!b)return null;const{lineColor:S,labelTextColor:j}=Lc(t),k=Sc(t,n),_=k?u.getY(b):u.getX(b);return _===null?null:r.jsxs("g",{"data-geom":"rule",className:bc,children:[r.jsx(Pc,{layer:t,isHorizontalLine:k,position:_,lineColor:S,isAnimated:a}),m!==null&&r.jsx(Ac,{label:m,textWidth:v,labelPosition:t.params.labelPosition,isHorizontalLine:k,position:_,color:S,textColor:j,symbolShape:p?.shape??null,symbolColor:p?.color??null,isAnimated:a})]})}),_c={geom:"rule",coord:"cartesian",guideMode:null,render:({layer:e,coordSystem:t,formattingLocale:n,isAnimated:o})=>r.jsx(Ec,{layer:e,coordSystem:t,formattingLocale:n,isAnimated:o}),renderHover:()=>null,renderHoverCompanions:()=>null},Sr=1,Ft=Math.PI*2,Mc=g.memo(function({layer:t,isAnimated:n}){const o=g.useRef(!1);g.useEffect(()=>{o.current=!0},[]);const a=g.useMemo(()=>{const s=u.createStableKeyGenerator(t.data,t.mapping,t.id),c=[];for(const l of t.data){const d=s(l),{startAngle:h,endAngle:f}=u.getAngleExtent(l),{innerRadius:p,outerRadius:m}=u.getRadiusExtent(l);h===null||f===null||p===null||m===null||c.push({key:d,startAngle:h,endAngle:f,innerRadius:p,outerRadius:m,fill:u.getColor(l),opacity:u.getAlpha(l)??Sr})}return c},[t]);return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"bar",className:ie,children:a.map(s=>{if(n){const{key:c,...l}=s;return r.jsx(Fc,{isInitialRender:!o.current,...l},c)}return r.jsx("path",{d:u.buildPolarBarArcPath({startAngle:s.startAngle,endAngle:s.endAngle,innerRadius:s.innerRadius,outerRadius:s.outerRadius})??void 0,fill:s.fill,opacity:s.opacity},s.key)})})}),Fc=({startAngle:e,endAngle:t,innerRadius:n,outerRadius:o,fill:a,opacity:s,isInitialRender:c})=>{const l=c?e:Ft,d=c?t:Ft,h=T.useSpring(l,I),f=T.useSpring(d,I),p=T.useMotionValue(u.buildPolarBarArcPath({startAngle:l,endAngle:d,innerRadius:n,outerRadius:o})??"");return g.useEffect(()=>{h.set(e),f.set(t)},[h,f,e,t]),g.useEffect(()=>{const m=()=>{const b=h.get(),S=f.get();p.set(u.buildPolarBarArcPath({startAngle:b,endAngle:S,innerRadius:n,outerRadius:o})??"")},x=h.on("change",m),v=f.on("change",m);return()=>{x(),v()}},[h,f,n,o,p]),r.jsx(T.motion.path,{d:p,fill:a,opacity:s,transition:I})},Hc=({primary:e})=>{const{startAngle:t,endAngle:n}=u.getAngleExtent(e.observation),{innerRadius:o,outerRadius:a}=u.getRadiusExtent(e.observation);if(t===null||n===null||o===null||a===null)return null;const s=u.buildPolarBarArcPath({startAngle:t,endAngle:n,innerRadius:o,outerRadius:a});if(!s)return null;const c=u.getColor(e.observation),l=u.getAlpha(e.observation)??Sr;return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"arc","data-testid":"hovered-arc",className:ie,children:r.jsx("path",{d:s,fill:c,opacity:l})})},Bc={geom:"bar",coord:"polar",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(Mc,{layer:e,isAnimated:t}),renderHover:({primary:e})=>r.jsx(Hc,{primary:e}),renderHoverCompanions:()=>null},Ic={bar:{cartesian:oc,polar:Bc},line:{cartesian:cc},area:{cartesian:Jl},point:{cartesian:uc},rule:{cartesian:_c}},Me=(e,t)=>Ic[e.geom]?.[t.type]??null,Nc=(e,t)=>{const n=e.filter(a=>a.interactive);if(n.length===0)return null;const o=n.map(a=>Me(a,t)).filter(a=>a!==null).map(a=>a.guideMode);return o.length===0?null:o.some(a=>a==="bar")?"bar":o.every(a=>a==="continuous")?"continuous":null},Rc=1,Dc="4 3",Oc=({panelRect:e})=>{const{coordSystem:t,layers:n,scales:o}=P(W.useShallow(c=>({coordSystem:c.coordSystem,layers:c.layers,scales:c.scales}))),a=Pe(c=>c.hover.primary);if(t.type!=="cartesian"||n.length===0||a===null)return null;const s=Nc(n,t);return s===null?null:s==="bar"?r.jsx(zc,{coordSystem:t,scales:o,primary:a,panelRect:e}):r.jsx(Gc,{coordSystem:t,primary:a,panelRect:e})},Gc=({coordSystem:e,primary:t,panelRect:n})=>{const o=u.getHoverGuideLineProps(e,t);return r.jsx(jr,{panelRect:n,children:r.jsx("line",{...o,stroke:i.hoverGuideLineColor,strokeWidth:Rc,strokeDasharray:Dc,strokeLinecap:"round","data-testid":"hover-guide-line"})})},zc=({coordSystem:e,scales:t,primary:n,panelRect:o})=>{const a=u.getHoverGuideRectProps(e,t,n);return a===null?null:r.jsx(jr,{panelRect:o,children:r.jsx("rect",{...a,fill:i.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},jr=({panelRect:e,children:t})=>r.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}),Wc=200,$c=({engine:e,store:t,overlayRef:n})=>{g.useEffect(()=>{const o=n.current;if(!o)return;const a=Xc(o,e),s=qc(o,e,t);return()=>{s(),a()}},[e,t,n])},Xc=(e,t)=>{const n=()=>{const c=e.getBoundingClientRect();c.width===0||c.height===0||t.setViewport({width:c.width,height:c.height})};let o=null;const a=()=>{o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,n()},Wc)},s=new ResizeObserver(a);return s.observe(e),n(),()=>{s.disconnect(),o!==null&&clearTimeout(o)}},qc=(e,t,n)=>{let o=null,a=null;const s=()=>{a=null;const d=o;if(o=null,!d)return;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};n.getState().setHoverState(t.query(f))},c=d=>{o=d,a===null&&(a=requestAnimationFrame(s))},l=()=>{o=null,a!==null&&(cancelAnimationFrame(a),a=null);const d=n.getState();d.hover.primary!==null&&d.setHoverState(u.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",c),e.addEventListener("pointerleave",l),()=>{e.removeEventListener("pointermove",c),e.removeEventListener("pointerleave",l),a!==null&&cancelAnimationFrame(a),o=null}},Vc=({panelRect:e})=>{const{engine:t,store:n,overlayRef:o}=we();return $c({engine:t,store:n,overlayRef:o}),r.jsx("rect",{ref:o,x:e.x,y:e.y,width:e.width,height:e.height,fill:"transparent",pointerEvents:"all","data-testid":"pointer-capture-layer"})},We="data-hover-active",Uc=e=>{const{store:t}=we(),n=fe.useStore(t,o=>o.hover.primary!==null);g.useEffect(()=>{const o=e.current;if(o)return n?o.setAttribute(We,"true"):o.removeAttribute(We),()=>{o.removeAttribute(We)}},[e,n])},kr=E.xs,Ze=N,Lr=q.medium,Yc=q.semibold,Cr=6,Tr=2,Kc=4,Jc=2,Ht=4;var Zc="_1agclyl0",Qc="_1agclyl1",ed="_1agclyl2",td={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},nd="_1agclyl6 _1agclyl3";const wr=({x:e,y:t,width:n,height:o,text:a,isRotated:s,target:c,position:l,coordType:d})=>{const h=s?`rotate(-90 ${e} ${t})`:void 0,f=c==="aggregate"?nd:td[l],p=rd(c,l,d);return r.jsxs("g",{transform:h,children:[p&&r.jsx("rect",{className:p,x:e-n/2,y:t-o/2,width:n,height:o,rx:Ht,ry:Ht}),r.jsx("text",{className:f,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:a})]})},rd=(e,t,n)=>{if(e==="aggregate")return ed;if(t==="outside"&&n==="cartesian")return Qc},od={dataLabel:{x:Cr,y:Tr},stackTotal:{x:Kc,y:Jc}},ad=({panelRect:e,formattingLocale:t})=>{const n=Q(),o=P(W.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}))),a=g.useMemo(()=>{const l=Y(kr,o.textScale);return{dataLabel:{family:Ze,size:l,weight:Lr},stackTotal:{family:Ze,size:l,weight:Yc}}},[o.textScale]),s=g.useMemo(()=>(l,d)=>{const h=n.measureText(d,a[l]),f=od[l];return{...h,width:h.width+f.x*2,height:h.height+f.y*2}},[n,a]),c=g.useMemo(()=>u.buildDataLabelsContent({...o,panelRect:e,measureDataLabel:s,formattingLocale:t}),[o,e,s,t]);return r.jsx("g",{className:Zc,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(l=>r.jsx(wr,{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:o.coordSystem.type},l.key))})},sd=({linePath:e,arrowheadPath:t,stroke:n,strokeWidth:o})=>{const a={stroke:n,strokeWidth:o,strokeLinecap:"round",fill:"none"};return r.jsxs("g",{children:[r.jsx("path",{d:e,...a}),r.jsx("path",{d:t,...a,strokeLinejoin:"round"})]})},id=({x:e,y:t,text:n,lineHeight:o,paddingX:a,paddingY:s,strokeWidth:c,strokeColor:l,fontWeight:d})=>{const h=Q(),p=g.useMemo(()=>h.measureText(n,{family:N,size:o,weight:d}),[h,n,o,d]).width+a*2,m=o+s*2;return r.jsxs("g",{style:{pointerEvents:"none"},children:[r.jsx("rect",{x:e-p/2,y:t-m/2,width:p,height:m,rx:4,fill:i.graphBackground,stroke:l,strokeWidth:c}),r.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:i.textPrimary,style:{fontFamily:N,fontSize:o,fontWeight:d},children:n})]})},ld=({panelRect:e,formattingLocale:t})=>{const n=P(W.useShallow(a=>({differenceArrows:a.annotations.differenceArrows,mainAxis:a.coordSystem.type==="cartesian"?a.coordSystem.mainAxis:"x",textScale:a.config.appearance.textScale}))),o=g.useMemo(()=>n.differenceArrows.map(a=>u.computeDifferenceArrow({arrow:a,mainAxis:n.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:n.textScale,locale:t})),[n,e.width,e.height,t]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:o.map(({color:a,id:s,linePath:c,arrowheadPath:l,strokeWidth:d,labelPosition:h,labelText:f,labelLineHeight:p,labelPaddingX:m,labelPaddingY:x,labelStrokeWidth:v,labelFontWeight:b})=>{const S=a??i.defaultAnnotationArrowStroke;return r.jsxs(g.Fragment,{children:[r.jsx(sd,{linePath:c,arrowheadPath:l,stroke:S,strokeWidth:d}),r.jsx(id,{x:h.x,y:h.y,text:f,lineHeight:p,paddingX:m,paddingY:x,strokeWidth:v,strokeColor:S,fontWeight:b})]},s)})})},cd=0,dd=1.15,Bt=1.15,ud="rgba(0, 0, 0, 0.16)",It=2,hd=1.4,gd=({arrow:e,fallbackColor:t,stickerOutlineColor:n,stickerOutlineColorInverse:o})=>{const a=g.useId(),s=e.color??t,c=fd(e.color,n,o),l=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},d=e.arrowheadExtent+e.strokeWidth+It+Bt,h={x:Math.min(e.startX,e.endX)-d,y:Math.min(e.startY,e.endY)-d,width:Math.abs(e.endX-e.startX)+2*d,height:Math.abs(e.endY-e.startY)+2*d},f=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(p=>p.length>0).join(" ");return r.jsxs("g",{children:[e.hasStickerStyle&&r.jsx("defs",{children:r.jsx("filter",{id:a,filterUnits:"userSpaceOnUse",...h,children:r.jsx("feDropShadow",{dx:cd,dy:dd,stdDeviation:Bt,floodColor:ud})})}),r.jsxs("g",{filter:e.hasStickerStyle?`url(#${a})`:void 0,children:[e.hasStickerStyle&&r.jsx("path",{d:f,stroke:c,strokeWidth:e.strokeWidth+2*It,strokeLinecap:"round",fill:"none"}),r.jsx("path",{d:e.linePath,stroke:s,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...l}),e.startArrowheadPath.length>0&&r.jsx("path",{d:e.startArrowheadPath,stroke:s,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&r.jsx("path",{d:e.endArrowheadPath,stroke:s,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},fd=(e,t,n)=>{if(e===null)return n;try{return qe.getContrast(e,t)<hd?n:t}catch{return n}},pd=({panelRect:e})=>{const{themeValues:t}=st(),n=P(a=>a.annotations.freeformArrows),o=g.useMemo(()=>n.map(a=>u.computeFreeformArrow({arrow:a,panelWidth:e.width,panelHeight:e.height})).filter(a=>a!==null),[n,e.width,e.height]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:o.map(a=>r.jsx(gd,{arrow:a,fallbackColor:i.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},a.id))})},md=({edge:e,areTicksVisible:t,position:n,labelRotation:o,label:a})=>{const{tickLabelOffset:s}=rt(),c=u.toPercent(n),l=(t?1:0)*s,d={style:{font:i.fontTickLabel},fill:i.textSecondary},h=o!==0&&(e==="top"||e==="bottom"),f=e==="top";return h?r.jsx("svg",{x:c,y:f?"100%":0,style:{overflow:"visible"},children:r.jsx("text",{...vd(f,l,o),...d,children:a})}):r.jsx("text",{...xd(e,c,l),...d,children:a})},xd=(e,t,n)=>{switch(e){case"bottom":return{x:t,y:n,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-n,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-n,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:n,y:t,textAnchor:"start",dominantBaseline:"central"}}},vd=(e,t,n)=>{const o=e?-t:t;return{x:0,y:o,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${n}, 0, ${o})`}},yd=({formattedAxis:e,rect:t})=>{const n=e.position==="bottom"||e.position==="top";return r.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[Sn,e.ticks.map((o,a)=>{const s=o.formattedLabel,c=n?o.position:1-o.position,l=bd(e.position,c,t);return r.jsxs("g",{children:[e.ticksVisible&&r.jsx("line",{...l,stroke:i.gridLineColor,strokeWidth:1}),r.jsx(md,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:s})]},a)})]})},bd=(e,t,n)=>{const o=u.toPercent(t);switch(e){case"bottom":return{x1:o,y1:0,x2:o,y2:be};case"top":return{x1:o,y1:n.height,x2:o,y2:n.height-be};case"left":return{x1:n.width,y1:o,x2:n.width-be,y2:o};case"right":return{x1:0,y1:o,x2:be,y2:o}}},Sd=({axes:e,rects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];if(!o||!n.isVisible)return null;const a=jd(n.position,o);return r.jsxs("g",{transform:`translate(${o.x}, ${o.y})`,children:[Sn,r.jsx("text",{style:{font:i.fontAxisLabel},fill:i.textPrimary,...a,children:n.label})]},`axis-label-${n.position}`)})}),jd=(e,t)=>{const n={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(n.x=0,n.textAnchor="start"):e==="right"&&(n.x=t.width,n.textAnchor="end"),n},kd=({formattedAxes:e,tickRects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];return!o||!n.isVisible?null:r.jsx(yd,{formattedAxis:n,rect:o},n.scaleAestheticKey)})}),Ld=({formattedAxes:e,labelRects:t})=>r.jsx(Sd,{axes:e,rects:t}),Nt={strokeWidth:i.gridLineWidth,strokeDashoffset:"0",strokeDasharray:i.gridLineDash,strokeLinecap:"round"},Ar=({axes:e,panel:t,panelRect:n})=>r.jsxs("svg",{x:n.x,y:n.y,width:n.width,height:n.height,style:{overflow:"visible"},children:[t.border.isVisible&&r.jsx("rect",{x:0,y:0,width:n.width,height:n.height,fill:"none",stroke:i.gridLineColor,rx:8,ry:8,...Nt}),e.map(o=>{if(!o.gridVisible)return null;const a=o.position==="bottom"||o.position==="top";return r.jsx("g",{children:o.ticks.map((s,c)=>{if(s.position<=0||s.position>=1)return null;const l=a?s.position:1-s.position,d=u.toPercent(l),h=a?{x1:d,y1:0,x2:d,y2:"100%"}:{x1:0,y1:d,x2:"100%",y2:d};return r.jsx("line",{...h,...Nt,stroke:i.gridLineColor},c)})},o.scaleAestheticKey)})]}),Rt=({panelRect:e,zOrder:t})=>{const o=P(a=>a.annotations.shapes).filter(a=>a.zOrder===t);return o.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:o.map(({id:a,x:s,y:c,width:l,height:d,fillColor:h,fillOpacity:f,strokeWidth:p,strokeColor:m})=>r.jsx("rect",{x:u.toPercent(s),y:u.toPercent(c),width:u.toPercent(l),height:u.toPercent(d),fill:h,fillOpacity:f,stroke:p>0?m??i.defaultAnnotationShapeStroke:"none",strokeWidth:p},a))})};var Cd="_120wioc0";const Td=({panelRect:e})=>{const t=P(n=>n.annotations.textAnnotations);return t.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(n=>r.jsx("foreignObject",{x:u.toPercent(n.x),y:u.toPercent(n.y),width:u.toPercent(n.width),height:u.toPercent(1-n.y),overflow:"visible",children:r.jsx("div",{className:Cd,style:wd(n.backgroundColor,n.backgroundColorStyle),children:r.jsx(Ce,{content:n.content})})},n.id))})},wd=(e,t)=>e===null||e==="transparent"?{color:i.textPrimary}:t==="fade"?{color:i.textPrimary,backgroundColor:Ve(e,i.grey100,.5),boxShadow:`0 0 0 1.5px ${Ve(e,i.grey0,.2)}`}:{color:i.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${Ee(e,.1)}`};var Ad="usd3ea0",Pd="usd3ea1";const Ed=({layer:e,coordSystem:t,isAnimated:n,isDimmed:o,highlightStyle:a,formattingLocale:s})=>{const c=Me(e,t);return c===null?r.jsxs("text",{children:[e.geom," not implemented"]}):r.jsx("g",{className:F({[Pd]:o&&a==="desaturate",[Ad]:o&&a==="dim"}),children:c.render({layer:e,coordSystem:t,isAnimated:n,formattingLocale:s})})};function _d({plugin:e,layer:t,coordSystem:n,candidates:o}){if(e?.getOverlayAnchor===void 0||o.length===0)return[];const a=[];for(const{observation:s,observationIndex:c}of o){const l=e.getOverlayAnchor({layer:t,coordSystem:n,observation:s});l!==null&&a.push({observation:s,observationIndex:c,anchor:l})}return a}const Md=4,Fd=({plugin:e,layer:t,matchedLayer:n,overlayCandidates:o,coordSystem:a,isAnimated:s,panelRect:c,formattingLocale:l})=>{const{numberFormat:d,textScale:h}=P(W.useShallow(v=>({numberFormat:v.config.numberFormat,textScale:v.config.appearance.textScale}))),f=g.useMemo(()=>_d({plugin:e,layer:t,coordSystem:a,candidates:o}),[e,t,a,o]),p=g.useMemo(()=>u.createSegmentYReader(t),[t]),m=g.useMemo(()=>u.buildLayerYValueFormatter({layer:t,numberFormat:d,locale:l}),[d,t,l]),x=kr*Fn*h;return e===null||n===null&&f.length===0?null:r.jsxs(r.Fragment,{children:[n?e.render({layer:n,coordSystem:a,isAnimated:s,formattingLocale:l}):null,f.map(({observation:v,observationIndex:b,anchor:S})=>r.jsx(Hd,{observation:v,anchor:S,panelRect:c,readSegmentY:p,formatYValue:m,labelFontSizePx:x},Bd(v,b)))]})},Hd=({observation:e,anchor:t,panelRect:n,readSegmentY:o,formatYValue:a,labelFontSizePx:s})=>{const c=Q(),l=u.toViewBoxX(t.x),d=u.toViewBoxY(t.y),h=(u.getSize(e)??pr)/2,f=o(e),p=u.isDefined(f)?a(f,e):null,m=g.useMemo(()=>{if(p===null)return null;const x=c.measureText(p,{family:Ze,size:s,weight:Lr});return{width:x.width+Cr*2,height:x.height+Tr*2}},[p,c,s]);return r.jsxs(r.Fragment,{children:[r.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:u.toPercent(l),cy:u.toPercent(d),r:h,fill:u.getColor(e)}),p!==null&&m!==null&&r.jsx(wr,{x:l*n.width,y:d*n.height-h-Md-m.height/2,width:m.width,height:m.height,text:p,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},Bd=(e,t)=>{const n=e[u.GROUP_VARIABLES.group];return`${String(n??"")}\0${t}`},Id=({layer:e,coordSystem:t,panelRect:n})=>{const{primary:o,group:a,related:s}=Pe(W.useShallow(d=>({primary:d.hover.primary,group:d.hover.group,related:d.hover.related})));if(o===null)return null;const c=Me(e,t);if(c===null)return null;const l=s.get(e.id)??[];return o.layerId===e.id?c.renderHover({layer:e,coordSystem:t,primary:o,group:a,related:l,panelRect:n}):l.length===0?null:c.renderHoverCompanions({layer:e,primary:o,related:l})};var Nd="to1jkx0",Rd="to1jkx1";const Dd=({shouldAnimate:e,panelRect:t,formattingLocale:n})=>{const{layers:o,coordSystem:a,highlightStyle:s}=P(W.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,highlightStyle:c.config.appearance.highlightStyle})));return r.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:Nd,"data-testid":"geom-layers",children:o.map(c=>r.jsxs(g.Fragment,{children:[r.jsx(zd,{layer:c,coordSystem:a,highlightStyle:s,shouldAnimate:e,panelRect:t,formattingLocale:n}),r.jsx(Id,{layer:c,coordSystem:a,panelRect:t})]},`${c.id}-${Od(a)}`))})},Od=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,Gd=e=>{if(e.geom!=="rule")return Rd},zd=({layer:e,coordSystem:t,highlightStyle:n,shouldAnimate:o,panelRect:a,formattingLocale:s})=>{const c=g.useMemo(()=>Me(e,t),[e,t]),l=e.highlight;return r.jsxs("g",{className:Gd(e),children:[r.jsx(Ed,{layer:e,coordSystem:t,isAnimated:o,isDimmed:l?.composition.isDimmed??!1,highlightStyle:n,formattingLocale:s}),l!==null&&r.jsx(Fd,{plugin:c,layer:e,matchedLayer:l.composition.matchedLayer,overlayCandidates:l.composition.overlayCandidates,coordSystem:t,isAnimated:o,panelRect:a,formattingLocale:s})]})};var Wd="_17uhij30";const $d=({formattedAxes:e,panelGuide:t,plotRect:n,panelRect:o,axisRects:a,axisLabelRects:s,shouldAnimate:c,formattingLocale:l})=>{const d=g.useRef(null);Uc(d);const h=U("Grid",Ar),f=U("AxisTicks",kd),p=U("AxisLabel",Ld),m=g.useMemo(()=>Pr(o,n),[o,n]),x=g.useMemo(()=>Dt(a,n),[a,n]),v=g.useMemo(()=>Dt(s,n),[s,n]);return r.jsxs("svg",{ref:d,className:Wd,width:n.width,height:n.height,style:{transform:`translate(${n.x}px, ${n.y}px)`},"data-testid":"plot",children:[r.jsx(h,{axes:e,panel:t,panelRect:m}),r.jsx(Oc,{panelRect:m}),r.jsx(f,{formattedAxes:e,tickRects:x}),r.jsx(p,{formattedAxes:e,labelRects:v}),r.jsx(Rt,{panelRect:m,zOrder:"background"}),r.jsx(Dd,{shouldAnimate:c,panelRect:m,formattingLocale:l}),r.jsx(ad,{panelRect:m,formattingLocale:l}),r.jsx(ld,{panelRect:m,formattingLocale:l}),r.jsx(Rt,{panelRect:m,zOrder:"foreground"}),r.jsx(pd,{panelRect:m}),r.jsx(Td,{panelRect:m}),r.jsx(Vc,{panelRect:m})]})},Pr=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),Dt=(e,t)=>{const n={};for(const[o,a]of Object.entries(e))n[o]=Pr(a,t);return n},Xd={width:0,height:0,isDefault:!0},Er=({debounce:e=0,onResize:t}={})=>{const[n,o]=g.useReducer((d,h)=>d.width===h.width&&d.height===h.height?d:h,Xd),a=tr(d=>{t?.(d),o(d)},e),s=g.useRef(null),c=g.useRef(null),l=g.useCallback(d=>{!d||s.current===d||(c.current??=new ResizeObserver(([h])=>{if(!h)return;const f=Math.round(h.contentBoxSize[0]?.inlineSize??h.contentRect.width),p=Math.round(h.contentBoxSize[0]?.blockSize??h.contentRect.height);a.run({width:f,height:p,isDefault:!1})}),s.current&&c.current.unobserve(s.current),s.current=d,c.current.observe(d))},[a]);return{...n,setElement:l}},_r=e=>{let t,n;return"aspectRatio"in e?"intrinsicWidth"in e?(t=e.intrinsicWidth,n=t/e.aspectRatio):(n=e.intrinsicHeight,t=n*e.aspectRatio):(t=e.intrinsicWidth,n=e.intrinsicHeight),{width:t,height:n}},qd=(e,t)=>{const n=Er({onResize:t});return g.useMemo(()=>{if(e.mode!=="keepAspectRatio")return{setContainer:n.setElement,canRender:!1,outerStyles:{},innerStyles:{}};const o=_r(e),a=n.width>0&&o.width>0?n.width/o.width:1;return{setContainer:n.setElement,canRender:!n.isDefault,outerStyles:{width:"100%",...n.isDefault?{aspectRatio:`${o.width} / ${o.height}`}:{height:o.height*a}},innerStyles:{transformOrigin:"top left",transform:`scale(${a})`,width:o.width,height:o.height}}},[e,n.width,n.setElement,n.isDefault])},Vd=({sizing:e,onResize:t,children:n})=>{const o=Er({onResize:t}),a=qd(e,t);if(e.mode==="keepAspectRatio")return r.jsx("div",{ref:a.setContainer,style:a.outerStyles,"data-testid":"graph-sizer",children:a.canRender&&r.jsx("div",{style:a.innerStyles,children:n(_r(e))})});if(e.mode==="fixed")return r.jsx("div",{ref:o.setElement,style:{width:e.width,height:e.height},"data-testid":"graph-sizer",children:n({width:e.width,height:e.height})});const s=!o.isDefault&&o.width>0&&o.height>0;return r.jsx("div",{ref:o.setElement,style:{width:"100%",height:"100%"},"data-testid":"graph-sizer",children:s&&n({width:o.width,height:o.height})})},Ud={mode:"responsive"},$e={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},Yd=()=>{const[e,t]=g.useState(null),[n,o]=g.useState(null),[a,s]=g.useState($e);return g.useEffect(()=>{const c=()=>{const d=e?{width:e.offsetWidth,height:e.offsetHeight}:$e.headerSize,h=n?{width:n.offsetWidth,height:n.offsetHeight}:$e.footerSize;s(f=>Kd(f,{headerSize:d,footerSize:h})?{headerSize:d,footerSize:h}:f)};c();const l=new ResizeObserver(c);return e&&l.observe(e),n&&l.observe(n),()=>l.disconnect()},[e,n]),{headerRef:t,footerRef:o,measurements:a}},Kd=(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,Jd=({appearance:e,isEditable:t,style:n,children:o})=>{const{theme:a,themeClass:s,inlineVarsStyle:c}=st(),l=Ra(e.border),d=Math.max(0,e.cornerRadius),h=d===0?0:d+l,f=g.useMemo(()=>{const x={...n,borderRadius:`${h}px`,...c},v=Na(e.border,a);return v!==null&&(x.background=v),x},[n,h,c,e.border,a]),p=g.useMemo(()=>({inset:`${l}px`,borderRadius:`${d}px`}),[l,d]),m=t&&e.background.type==="solid"&&e.background.color==="transparent";return r.jsx("div",{"data-testid":"graph-wrapper",className:F(za,s),style:f,children:r.jsx("div",{"data-testid":"graph-inner",className:F($a,{[Xa]:m}),style:p,children:o})})},Zd=({slots:e,sizing:t=Ud,onResize:n,...o})=>{const{formattingLocale:a}=se(),s=P(c=>c.config.parsingLocale);return r.jsx(Zt,{children:r.jsx(gr,{children:r.jsx($.IntlProvider,{locale:a??s,children:r.jsx(_o,{slots:e,children:r.jsx(Vd,{sizing:t,onResize:n,children:({width:c,height:l})=>r.jsx(Qd,{width:c,height:l,...o})})})})})})},Qd=({width:e,height:t,isAnimated:n,showTooltips:o=!0,mode:a="readonly"})=>{const s=$.useI18n(),{axes:c,panel:l,legends:d,numberFormat:h,parsingLocale:f,appearance:p,annotations:m,coordSystem:x,headline:v,headlineConfig:b,content:S}=P(W.useShallow(R=>({axes:R.guides.axes,panel:R.guides.panel,legends:R.guides.legends,numberFormat:R.config.numberFormat,parsingLocale:R.config.parsingLocale,appearance:R.config.appearance,annotations:R.annotations,coordSystem:R.coordSystem,headline:R.guides.headline,headlineConfig:R.config.headline,content:R.config.content}))),j=T.useReducedMotion(),{headerRef:k,footerRef:_,measurements:L}=Yd(),{formattingLocale:G,theme:Fe,themeOverrides:He}=se(),le=g.useMemo(()=>En(Fe,He),[Fe,He]),Mr=U("Header",ir),Fr=U("Footer",sr),Hr=U("Legend",Il),Br=U("Headline",$i),dt=g.useMemo(()=>u.formatLegends({legends:d,numberFormat:h,parsingLocale:f,formattingLocale:G}),[d,h,f,G]),ce=g.useMemo(()=>u.formatHeadline({headline:v,show:b.show,numberFormat:h,parsingLocale:f,formattingLocale:G,t:s}),[v,b.show,h,f,G,s]),Ir=Q(),Be=p.border.type==="none"?0:p.border.width,Ie=g.useMemo(()=>({width:Math.max(0,e-2*Be),height:Math.max(0,t-2*Be)}),[e,t,Be]),me=g.useMemo(()=>ce?{formatted:ce,size:b.size,position:b.position,innerRadius:x.type==="polar"?x.innerRadius:0}:void 0,[ce,b.size,b.position,x]),Nr=Mo(),xe=Aa(Ir,p.textScale,le,Nr),de=Pa({measurer:xe,axes:c,numberFormat:h,parsingLocale:f,formattedLegends:dt,containerSize:Ie,externalMeasurements:L,headline:me,formattingLocale:G,annotations:m,coordSystem:x,textScale:p.textScale,graphPadding:le.graphPadding}),ve=g.useMemo(()=>!de||!me||!xe?null:u.resolveHeadlinePlacement({headline:me,layout:de.layout,containerSize:Ie,measurer:xe,itemGap:le.headlineItemGap}),[de,me,Ie,xe,le.headlineItemGap]);if(!de)return null;const{layout:K,formattedAxes:Rr}=de;return r.jsx(Gn,{theme:Fe,themeOverrides:He,appearance:p,children:r.jsx(ma,{metrics:le,children:r.jsxs(Jd,{appearance:p,isEditable:a==="editable",style:{width:"100%",height:"100%"},children:[r.jsx(Mr,{ref:k,headerRect:K.header,mode:a,title:S.title,isTitleVisible:S.isTitleVisible,subtitle:S.subtitle,isSubtitleVisible:S.isSubtitleVisible}),r.jsx($d,{formattedAxes:Rr,panelGuide:l,plotRect:K.plot,panelRect:K.panel,axisRects:K.axes,axisLabelRects:K.axisLabels,shouldAnimate:n??!j,formattingLocale:G??f}),r.jsx(Fr,{ref:_,footerRect:K.footer,mode:a,caption:S.caption,isCaptionVisible:S.isCaptionVisible,source:S.source,isSourceVisible:S.isSourceVisible}),r.jsx(Hr,{formattedLegends:dt,rects:K.legends,textScale:p.textScale}),ce&&ve&&r.jsx(Br,{headline:ce,rect:ve.rect,resolvedSize:ve.resolvedSize,visibleItemCount:ve.visibleItemCount}),o&&r.jsx(Vo,{})]})})})};exports.CanvasTextMeasurer=_e;exports.DefaultFooter=sr;exports.DefaultGrid=Ar;exports.DefaultHeader=ir;exports.DefaultTooltip=en;exports.DevToolsPanel=vo;exports.GraphProvider=Qr;exports.GraphRenderer=Zd;exports.HoverProvider=Zt;exports.TextMeasurerProvider=gr;exports.ThemeProvider=Gn;exports.darkTheme=On;exports.lightTheme=Dn;exports.useCompiledSelector=P;exports.useGraphCommandDispatcher=tt;exports.useHoverState=Pe;exports.useTextMeasurer=Q;exports.vars=i;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),F=require("clsx"),g=require("react"),fe=require("zustand"),u=require("@graphysdk/viz-engine"),Qe=require("zustand/vanilla"),T=require("motion/react"),G=require("zustand/react/shallow"),$=require("@graphysdk/i18n/react"),M=require("@floating-ui/react-dom"),zr=require("@tiptap/core"),Gt=require("@tiptap/extension-bold"),Xe=require("@tiptap/extension-document"),zt=require("@tiptap/extension-hard-break"),Wt=require("@tiptap/extension-heading"),$t=require("@tiptap/extension-italic"),Xt=require("@tiptap/extension-link"),qt=require("@tiptap/extension-text"),Vt=require("@tiptap/extension-text-align"),ne=require("@tiptap/extension-text-style"),Ut=require("@tiptap/extension-underline"),ke=require("@tiptap/extensions"),Wr=require("@tiptap/extension-paragraph"),et=require("@tiptap/react"),A=require("@base-ui/react/toolbar"),te=require("@base-ui/react/tooltip"),$r=require("react-dom"),Xr=require("@vanilla-extract/dynamic"),P=require("@base-ui/react/popover"),ut=require("react-colorful"),H=require("@base-ui/react/menu"),qr=require("@base-ui/react/toggle"),Vr=require("d3-interpolate-path"),qe=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-experimental.7");const Ur=5,Yr=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>Jr,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let n=null;return{emit:o=>{const a=e.getLastCompile();if(a){n=o;for(const s of t)s(o,a)}},subscribe:o=>(t.add(o),()=>{t.delete(o)}),getLastTrigger:()=>n,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Kr=()=>Qe.createStore(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,n)=>e(o=>{if(o.lastSnapshot===n)return o;const a={id:o.nextId,label:Zr(t),stages:n.stages,durationMs:n.durationMs};return{lastCompile:a,history:Qr(o.history,a,Ur),nextId:o.nextId+1,lastSnapshot:n}})})),Jr=()=>{},Zr=e=>{switch(e.kind){case"init":return"init";case"input":return"input change";case"data":return"data change";case"command":return e.command.metadata.description}},Qr=(e,t,n)=>{const o=e.length>=n?e.length-(n-1):0;return[...e.slice(o),t]},eo=e=>Qe.createStore(t=>({compiled:e,setCompiled:n=>t(o=>o.compiled===n?o:{compiled:n})}));function to(e,t){const n=u.isGraphConfig(e)?e.themeOverrides:void 0;return g.useMemo(()=>({...t,...n}),[t,n])}const Yt=g.createContext(null),no=({data:e,input:t,formattingLocale:n,onChange:o,customPalettes:a,theme:s="light",themeOverrides:l,children:c})=>{const[d]=g.useState(()=>u.createCompiler()),[h]=g.useState(()=>Yr(d)),f=to(t,l),p=g.useMemo(()=>({customPalettes:a,theme:s}),[a,s]),[m]=g.useState(()=>{const S=d.compile({input:t,data:e,ctx:p});return h.emit({kind:"init"}),eo(S)}),x=g.useRef({input:t,data:e,ctx:p});g.useEffect(()=>{const S=t!==x.current.input,j=e!==x.current.data,k=p!==x.current.ctx;if(!S&&!j&&!k)return;const _=m.getState(),L=S||k?d.compile({input:t,data:e,ctx:p}):d.recompile({spec:_.compiled.spec,data:e});x.current={input:t,data:e,ctx:p},_.setCompiled(L),h.emit({kind:S?"input":"data"})},[t,e,p,d,m,h]);const v=g.useCallback(S=>{const j=m.getState(),k=S.apply(j.compiled.spec);if(!k)return;const _=d.recompile({spec:k.spec});if(j.setCompiled(_),h.emit({kind:"command",command:S}),!o)return;const L=u.convertSpecToInput(k.spec);x.current={input:L,data:x.current.data,ctx:x.current.ctx},o(L)},[o,d,h,m]),b=g.useMemo(()=>({store:m,dispatch:v,formattingLocale:n,compileBus:h,theme:s,themeOverrides:f}),[m,v,n,h,s,f]);return r.jsx(Yt.Provider,{value:b,children:c})},se=()=>{const e=g.useContext(Yt);if(!e)throw new Error("useGraph* hooks must be used inside a <GraphProvider>");return e},w=e=>{const{store:t}=se();return fe.useStore(t,n=>e(n.compiled))},tt=()=>{const{dispatch:e}=se();return e};var ro="drqe3u0",oo="drqe3u1",ao="drqe3u2",so="drqe3u3",ye="drqe3u4",io="drqe3u5",lo="drqe3u6",co="drqe3u7",Ne="drqe3u8",uo="drqe3u9",ho="drqe3ua",go="drqe3ub",fo="drqe3uc",po="drqe3ud",mo="drqe3ue",xo="drqe3uf",vo="drqe3ug",yo="drqe3uh",bo="drqe3ui",ht={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},gt={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},Kt={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const So=({width:e=380,style:t,className:n}={})=>{const{compileBus:o}=se(),[a]=g.useState(()=>Kr()),[s,l]=g.useState(!1),[c,d]=g.useState(u.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:v}=a.getState(),b=o.getLastTrigger(),S=o.getLastCompile();return b&&S&&v(b,S),o.subscribe(v)},[a,o]);const h=fe.useStore(a,v=>v.lastCompile),f=fe.useStore(a,v=>v.history),p=o.getCacheStats(),m=h===null&&f.length===0,x=()=>{d(v=>{const b=!v;return u.setCompilerCachingEnabled(b),b})};return r.jsxs("div",{className:F(ho,n),style:{width:e,...t},children:[r.jsxs("div",{className:ro,children:[r.jsxs("div",{children:[r.jsx("div",{className:oo,children:"compile cache"}),r.jsx("div",{className:mo,children:m?"production: stats disabled":h?`last: ${h.label} · ${Jt(h.durationMs)}`:"awaiting first compile…"})]}),r.jsx("button",{type:"button",onClick:()=>l(v=>!v),className:xo,children:s?"▾":"▴"})]}),!s&&r.jsxs("div",{className:go,children:[r.jsxs("button",{type:"button",onClick:x,className:c?ht.enabled:ht.disabled,"aria-pressed":c,children:["cache ",c?"enabled":"disabled"]}),r.jsx("span",{className:vo,children:"next compile reflects this toggle"})]}),!s&&!m&&r.jsxs(r.Fragment,{children:[r.jsx(jo,{delta:h?.stages,cumulative:p}),r.jsx(ko,{entries:f})]})]})},jo=({delta:e,cumulative:t})=>r.jsxs("table",{className:ao,children:[r.jsx("thead",{children:r.jsxs("tr",{className:yo,children:[r.jsx("th",{className:so,children:"stage"}),r.jsx("th",{className:ye,children:"Δ miss"}),r.jsx("th",{className:ye,children:"Δ hit"}),r.jsx("th",{className:ye,children:"total miss"}),r.jsx("th",{className:ye,children:"total hit"})]})}),r.jsx("tbody",{children:u.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],a=Lo(o);return r.jsxs("tr",{className:fo,children:[r.jsxs("td",{className:io,children:[r.jsx("span",{className:Kt[a],"aria-hidden":!0})," ",n]}),r.jsx("td",{className:a==="ran"?gt.ran:gt.dim,children:o?.misses??0}),r.jsx("td",{className:Ne,children:o?.hits??0}),r.jsx("td",{className:Ne,children:t[n].misses}),r.jsx("td",{className:Ne,children:t[n].hits})]},n)})})]}),ko=({entries:e})=>e.length===0?null:r.jsxs("div",{className:po,children:[r.jsx("div",{className:bo,children:"recent compiles"}),e.map(t=>{const n=Co(t.stages,s=>s.misses>0),o=u.COMPILER_STAGE_KEYS.length,a=n===0?"cached":"ran";return r.jsxs("div",{className:lo,children:[r.jsx("span",{className:Kt[a],"aria-hidden":!0}),r.jsx("span",{className:co,title:t.label,children:t.label}),r.jsxs("span",{className:uo,children:[n,"/",o," ran · ",Jt(t.durationMs)]})]},t.id)})]}),Lo=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Co=(e,t)=>{let n=0;for(const o of u.COMPILER_STAGE_KEYS)t(e[o])&&(n+=1);return n},Jt=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,To=()=>Qe.createStore(e=>({hover:u.RESTING_HOVER_STATE,setHoverState:t=>e(n=>n.hover===t?n:{hover:t})})),wo=(e,t)=>{const n=g.useMemo(()=>({layers:e,coordSystem:t}),[e,t]),o=g.useRef(null);o.current===null&&(o.current=new u.HoverEngine(n));const a=o.current,s=g.useRef(!1);return g.useEffect(()=>{if(!s.current){s.current=!0;return}a.update(n)},[a,n]),a},Zt=g.createContext(null),Qt=({children:e})=>{const{layers:t,coordSystem:n}=w(G.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem}))),o=wo(t,n),[a]=g.useState(()=>To()),s=g.useRef(null),l=g.useRef(null);return l.current===null&&(l.current={engine:o,store:a,overlayRef:s}),r.jsx(Zt.Provider,{value:l.current,children:e})},we=()=>{const e=g.useContext(Zt);if(e===null)throw new Error("useHoverContext must be used inside a <HoverProvider>.");return e};var Ao="_2qyyu60";const ft=2,Po=12,Eo=12,pt=1,mt=2,_o=4,Ae=({shape:e,color:t,lineType:n="solid",width:o=Po,height:a=Eo})=>r.jsx("svg",{className:Ao,width:o,height:a,viewBox:`0 0 ${o} ${a}`,"aria-hidden":!0,"data-testid":"chart-swatch","data-shape":e,children:Mo({shape:e,color:t,lineType:n,width:o,height:a})}),Mo=({shape:e,color:t,lineType:n,width:o,height:a})=>{const s=Fo(n,o);switch(e){case"square":return r.jsx("rect",{x:1,y:1,width:o-2,height:a-2,rx:2,fill:t});case"line":return r.jsx("line",{x1:s.x1,y1:a/2,x2:s.x2,y2:a/2,stroke:t,strokeWidth:ft,strokeLinecap:s.linecap,strokeDasharray:s.dashArray});case"circle":{const l=(Math.min(o,a)-2)/2;return r.jsx("circle",{cx:o/2,cy:a/2,r:l,fill:t})}case"area":{const l=a/2-1;return r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:1,y:l,width:o-2,height:a-l-1,fill:t,opacity:.45}),r.jsx("line",{x1:s.x1,y1:l,x2:s.x2,y2:l,stroke:t,strokeWidth:ft,strokeLinecap:s.linecap,strokeDasharray:s.dashArray})]})}case"slice":return r.jsx("path",{d:`M 0 ${a} L ${o} ${a} A ${o} ${a} 0 0 0 0 0 Z`,fill:t})}},Fo=(e,t)=>{if(e==="solid")return{x1:0,x2:t,dashArray:void 0,linecap:"round"};if(e==="dashed"){const o=(t-pt*(mt-1))/mt;return{x1:0,x2:t,dashArray:`${o} ${pt}`,linecap:"butt"}}const n=t/(_o-1);return{x1:0,x2:t,dashArray:`1 ${n}`,linecap:"round"}},en=Object.freeze({}),nt=g.createContext(en),Ho=({slots:e,children:t})=>r.jsx(nt.Provider,{value:e??en,children:t});function U(e,t){const n=g.useContext(nt)[e];return n===void 0?t:typeof n=="object"&&Io(n)?n.render:n}function Bo(){const e=g.useContext(nt);return{measureAxis:e.AxisTicks?.measure,measureAxisLabel:e.AxisLabel?.measure,measureLegend:e.Legend?.measure,measureHeadline:e.Headline?.measure.measureHeadline,measureHeadlineItemWidths:e.Headline?.measure.measureHeadlineItemWidths}}function Io(e){return"render"in e&&typeof e.render=="function"}function Pe(e){const{store:t}=we();return fe.useStore(t,e)}var No="_19519k80",Ro="_19519k81",Do="_19519k82",Oo="_19519k83",Go="_19519k85",zo="_19519k86",Wo="_19519k87",$o="_19519k88",Xo="_19519k89";const qo=e=>{const{overlayRef:t}=we(),n=g.useRef(null),[o,a]=g.useState(!1),s=g.useRef(e);return s.current=e,g.useEffect(()=>{const l=t.current;if(!l)return;const c=h=>{n.current={clientX:h.clientX,clientY:h.clientY},a(!0),s.current?.()},d=()=>{n.current=null,a(!1)};return l.addEventListener("pointermove",c),l.addEventListener("pointerleave",d),()=>{l.removeEventListener("pointermove",c),l.removeEventListener("pointerleave",d)}},[t]),{cursorRef:n,isInside:o}},Vo=16,Uo=8,Yo={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},Ko=()=>{const e=w(G.useShallow(x=>({layers:x.layers,coordSystem:x.coordSystem,scales:x.scales,guides:x.guides,numberFormat:x.config.numberFormat,parsingLocale:x.config.parsingLocale}))),{formattingLocale:t}=se(),n=Pe(x=>x.hover),o=U("Tooltip",tn),a=g.useRef(()=>{}),{cursorRef:s,isInside:l}=qo(()=>a.current()),c=g.useMemo(()=>u.buildTooltipContent({...e,hover:n,formattingLocale:t}),[e,n,t]),d=c!==null&&l,h=g.useMemo(()=>({getBoundingClientRect:()=>{const x=s.current;return x===null?Yo:Jo(x)}}),[s]),{refs:f,floatingStyles:p,update:m}=M.useFloating({open:d,placement:"right",middleware:[M.offset(Vo),M.flip(),M.shift({padding:Uo})],elements:{reference:h}});return a.current=m,d?r.jsx("div",{ref:f.setFloating,role:"tooltip",className:$o,style:p,"data-testid":"chart-tooltip",children:r.jsx(o,{content:c,isVisible:d})}):null},tn=({content:e,isVisible:t})=>t?r.jsxs("div",{className:Xo,children:[e.header!==null&&r.jsx("div",{className:No,children:e.header}),r.jsx("div",{className:Ro,children:e.rows.map(n=>r.jsx(Zo,{row:n,shouldHighlight:n.isPrimary&&e.rows.length>1},n.key))})]}):null,Jo=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),Zo=({row:e,shouldHighlight:t})=>r.jsxs("div",{className:F(Do,{[Oo]:t}),"data-testid":"chart-tooltip-row",children:[e.swatchColor===null?r.jsx("span",{className:Go,"aria-hidden":!0}):r.jsx(Ae,{shape:e.swatchShape,color:e.swatchColor,lineType:e.swatchLineType}),r.jsx("span",{className:zo,children:e.label}),r.jsx("span",{className:Wo,children:e.value})]});var nn=["canvasDefault","canvasBlue","canvasCyan","canvasGreen","canvasYellow","canvasOrange","canvasRed","canvasPink","canvasPurple","canvasGray","canvasInverse"],i={white:"var(--graphy-white)",black:"var(--graphy-black)",transparent:"var(--graphy-transparent)",grey100:"var(--graphy-grey-100)",grey95:"var(--graphy-grey-95)",grey90:"var(--graphy-grey-90)",grey85:"var(--graphy-grey-85)",grey80:"var(--graphy-grey-80)",grey75:"var(--graphy-grey-75)",grey70:"var(--graphy-grey-70)",grey60:"var(--graphy-grey-60)",grey50:"var(--graphy-grey-50)",grey0:"var(--graphy-grey-0)",greyGradient80:"var(--graphy-grey-gradient-80)",green60:"var(--graphy-green-60)",green50:"var(--graphy-green-50)",red60:"var(--graphy-red-60)",red50:"var(--graphy-red-50)",amber70:"var(--graphy-amber-70)",amber50:"var(--graphy-amber-50)",amber40:"var(--graphy-amber-40)",amber30:"var(--graphy-amber-30)",blue80:"var(--graphy-blue-80)",blue60:"var(--graphy-blue-60)",purple50:"var(--graphy-purple-50)",purple30:"var(--graphy-purple-30)",brand:"var(--graphy-brand)",success:"var(--graphy-success)",warning:"var(--graphy-warning)",alert:"var(--graphy-alert)",textPrimary:"var(--graphy-text-primary)",textSecondary:"var(--graphy-text-secondary)",textDisabled:"var(--graphy-text-disabled)",iconPrimary:"var(--graphy-icon-primary)",iconSecondary:"var(--graphy-icon-secondary)",iconStickerBackground:"var(--graphy-icon-sticker-background)",border100:"var(--graphy-border-100)",border50:"var(--graphy-border-50)",border10:"var(--graphy-border-10)",sunkenBackground:"var(--graphy-sunken-background)",defaultBackground:"var(--graphy-default-background)",raisedBackground:"var(--graphy-raised-background)",overlayBackground:"var(--graphy-overlay-background)",overlayBorderGradient:"var(--graphy-overlay-border-gradient)",graphBackground:"var(--graphy-graph-background)",gridLineColor:"var(--graphy-grid-line-color)",originLineColor:"var(--graphy-origin-line-color)",targetLineColor:"var(--graphy-target-line-color)",targetLineMarkerColor:"var(--graphy-target-line-marker-color)",targetLineLabelTextColor:"var(--graphy-target-line-label-text-color)",legendBackground:"var(--graphy-legend-background)",legendBorderColor:"var(--graphy-legend-border-color)",legendFocusOutlineColor:"var(--graphy-legend-focus-outline-color)",legendTextColor:"var(--graphy-legend-text-color)",dimmedSeriesLabelTextColor:"var(--graphy-dimmed-series-label-text-color)",dimmedSeriesLabelLineColor:"var(--graphy-dimmed-series-label-line-color)",trendNegativeColor:"var(--graphy-trend-negative-color)",trendPositiveColor:"var(--graphy-trend-positive-color)",trendNeutralColor:"var(--graphy-trend-neutral-color)",defaultAnnotationArrowStroke:"var(--graphy-default-annotation-arrow-stroke)",defaultAnnotationShapeStroke:"var(--graphy-default-annotation-shape-stroke)",defaultAnnotationShapeFill:"var(--graphy-default-annotation-shape-fill)",arrowAnnotationStickerOutlineColor:"var(--graphy-arrow-annotation-sticker-outline-color)",arrowAnnotationStickerOutlineColorInverse:"var(--graphy-arrow-annotation-sticker-outline-color-inverse)",annotationFrameBorderColor:"var(--graphy-annotation-frame-border-color)",annotationMenuTriggerIconColor:"var(--graphy-annotation-menu-trigger-icon-color)",heatmapEmptyTileBackground:"var(--graphy-heatmap-empty-tile-background)",dataLabelOutsideBackground:"var(--graphy-data-label-outside-background)",graphPadding:"var(--graphy-graph-padding)",gridLineWidth:"var(--graphy-grid-line-width)",gridLineDash:"var(--graphy-grid-line-dash)",tooltipBorderRadius:"var(--graphy-tooltip-border-radius)",tooltipBorderWidth:"var(--graphy-tooltip-border-width)",tooltipPaddingBlock:"var(--graphy-tooltip-padding-block)",tooltipPaddingInline:"var(--graphy-tooltip-padding-inline)",tooltipRowGap:"var(--graphy-tooltip-row-gap)",tooltipShadow:"var(--graphy-tooltip-shadow)",tickLabelOffset:"var(--graphy-tick-label-offset)",legendItemGap:"var(--graphy-legend-item-gap)",legendSwatchGap:"var(--graphy-legend-swatch-gap)",legendSwatchWidth:"var(--graphy-legend-swatch-width)",legendSwatchHeight:"var(--graphy-legend-swatch-height)",legendPillPaddingInline:"var(--graphy-legend-pill-padding-inline)",legendPillPaddingBlock:"var(--graphy-legend-pill-padding-block)",legendPillBorderWidth:"var(--graphy-legend-pill-border-width)",headlineRowGap:"var(--graphy-headline-row-gap)",headlineItemGap:"var(--graphy-headline-item-gap)",canvasDefault:"var(--graphy-canvas-default)",canvasBlue:"var(--graphy-canvas-blue)",canvasCyan:"var(--graphy-canvas-cyan)",canvasGreen:"var(--graphy-canvas-green)",canvasYellow:"var(--graphy-canvas-yellow)",canvasOrange:"var(--graphy-canvas-orange)",canvasRed:"var(--graphy-canvas-red)",canvasPink:"var(--graphy-canvas-pink)",canvasPurple:"var(--graphy-canvas-purple)",canvasGray:"var(--graphy-canvas-gray)",canvasInverse:"var(--graphy-canvas-inverse)",elevationXs:"var(--graphy-elevation-xs)",elevationSm:"var(--graphy-elevation-sm)",elevationMd:"var(--graphy-elevation-md)",elevationLg:"var(--graphy-elevation-lg)",radiiXs:"var(--graphy-radii-xs)",radiiSm:"var(--graphy-radii-sm)",radiiMd:"var(--graphy-radii-md)",radiiLg:"var(--graphy-radii-lg)",spaceXxs:"var(--graphy-space-xxs)",spaceXs:"var(--graphy-space-xs)",spaceSm:"var(--graphy-space-sm)",spaceMd:"var(--graphy-space-md)",spaceLg:"var(--graphy-space-lg)",spaceXl:"var(--graphy-space-xl)",zIndexToolbar:"var(--graphy-z-index-toolbar)",zIndexToolbarTooltip:"var(--graphy-z-index-toolbar-tooltip)",zIndexToolbarPopover:"var(--graphy-z-index-toolbar-popover)",toolbarBackgroundColor:"var(--graphy-toolbar-background-color)",toolbarButtonBackgroundColor:"var(--graphy-toolbar-button-background-color)",toolbarButtonBackgroundColorHovered:"var(--graphy-toolbar-button-background-color-hovered)",toolbarButtonBackgroundColorSelected:"var(--graphy-toolbar-button-background-color-selected)",toolbarSeparatorColor:"var(--graphy-toolbar-separator-color)",tooltipBackground:"var(--graphy-tooltip-background)",tooltipBorderColor:"var(--graphy-tooltip-border-color)",tooltipHeadingTextColor:"var(--graphy-tooltip-heading-text-color)",tooltipLabelTextColor:"var(--graphy-tooltip-label-text-color)",tooltipValueTextColor:"var(--graphy-tooltip-value-text-color)",tooltipPrimaryRowColor:"var(--graphy-tooltip-primary-row-color)",hoverGuideLineColor:"var(--graphy-hover-guide-line-color)",hoverGuideFillColor:"var(--graphy-hover-guide-fill-color)",hoveredBarBorderColor:"var(--graphy-hovered-bar-border-color)",hoveredPointRingColor:"var(--graphy-hovered-point-ring-color)",pointStrokeColor:"var(--graphy-point-stroke-color)",stackedBarHoverBorderColor:"var(--graphy-stacked-bar-hover-border-color)",fontFamilyDefault:"var(--graphy-font-family-default)",fontFamilyHeading:"var(--graphy-font-family-heading)",fontWeightRegular:"var(--graphy-font-weight-regular)",fontWeightMedium:"var(--graphy-font-weight-medium)",fontWeightSemibold:"var(--graphy-font-weight-semibold)",fontWeightBold:"var(--graphy-font-weight-bold)",fontWeightExtraBold:"var(--graphy-font-weight-extra-bold)",fontWeightBlack:"var(--graphy-font-weight-black)",textScale:"var(--graphy-text-scale)",fontSizeXxs:"var(--graphy-font-size-xxs)",fontSizeXs:"var(--graphy-font-size-xs)",fontSizeSm:"var(--graphy-font-size-sm)",fontSizeMd:"var(--graphy-font-size-md)",fontSizeLg:"var(--graphy-font-size-lg)",fontSizeXl:"var(--graphy-font-size-xl)",fontLineHeightXxs:"var(--graphy-font-line-height-xxs)",fontLineHeightXs:"var(--graphy-font-line-height-xs)",fontLineHeightSm:"var(--graphy-font-line-height-sm)",fontLineHeightMd:"var(--graphy-font-line-height-md)",fontLineHeightLg:"var(--graphy-font-line-height-lg)",fontLineHeightXl:"var(--graphy-font-line-height-xl)",fontSizeEditorBody:"var(--graphy-font-size-editor-body)",fontSizeHeadingSm:"var(--graphy-font-size-heading-sm)",fontSizeHeadingMd:"var(--graphy-font-size-heading-md)",fontSizeHeadingLg:"var(--graphy-font-size-heading-lg)",fontLineHeightEditorBody:"var(--graphy-font-line-height-editor-body)",fontLineHeightHeadingSm:"var(--graphy-font-line-height-heading-sm)",fontLineHeightHeadingMd:"var(--graphy-font-line-height-heading-md)",fontLineHeightHeadingLg:"var(--graphy-font-line-height-heading-lg)",fontTickLabel:"var(--graphy-font-tick-label)",fontAxisLabel:"var(--graphy-font-axis-label)",fontDataLabel:"var(--graphy-font-data-label)",fontStackTotal:"var(--graphy-font-stack-total)",fontLegendLabel:"var(--graphy-font-legend-label)",fontSeriesLabel:"var(--graphy-font-series-label)",fontTooltipLabel:"var(--graphy-font-tooltip-label)",fontTooltipHeading:"var(--graphy-font-tooltip-heading)",fontTooltipFooter:"var(--graphy-font-tooltip-footer)",fontJumboTooltipLabel:"var(--graphy-font-jumbo-tooltip-label)",fontJumboTooltip:"var(--graphy-font-jumbo-tooltip)",fontMiniTooltipLabel:"var(--graphy-font-mini-tooltip-label)",fontMiniTooltipFooter:"var(--graphy-font-mini-tooltip-footer)",fontTooltipCaption:"var(--graphy-font-tooltip-caption)",fontTooltipCaptionSmall:"var(--graphy-font-tooltip-caption-small)",fontTrendTag:"var(--graphy-font-trend-tag)",fontTrendTagSmall:"var(--graphy-font-trend-tag-small)",fontGoalLineLabel:"var(--graphy-font-goal-line-label)",fontPieLabel:"var(--graphy-font-pie-label)",fontPieChartTotal:"var(--graphy-font-pie-chart-total)",fontDifferenceArrowSmall:"var(--graphy-font-difference-arrow-small)",fontDifferenceArrowMedium:"var(--graphy-font-difference-arrow-medium)",fontDifferenceArrowLarge:"var(--graphy-font-difference-arrow-large)",fontButton:"var(--graphy-font-button)",fontInput:"var(--graphy-font-input)",fontInputLabel:"var(--graphy-font-input-label)",fontSelectLabel:"var(--graphy-font-select-label)",fontSelectDescription:"var(--graphy-font-select-description)",fontColorSelectLabel:"var(--graphy-font-color-select-label)",fontMenuTitle:"var(--graphy-font-menu-title)",fontMenuGroupTitle:"var(--graphy-font-menu-group-title)",fontMenuItemLabel:"var(--graphy-font-menu-item-label)",fontMenuItemLabelSecondary:"var(--graphy-font-menu-item-label-secondary)",fontUITooltip:"var(--graphy-font-uitooltip)",fontUITooltipSecondary:"var(--graphy-font-uitooltip-secondary)",fontErrorBoundaryTitle:"var(--graphy-font-error-boundary-title)",fontErrorBoundaryMessage:"var(--graphy-font-error-boundary-message)",fontTableCell:"var(--graphy-font-table-cell)",fontTableHeaderCell:"var(--graphy-font-table-header-cell)",fontSourceLabel:"var(--graphy-font-source-label)",fontSourceLink:"var(--graphy-font-source-link)",fontTextEditorH1:"var(--graphy-font-text-editor-h1)",fontTextEditorH2:"var(--graphy-font-text-editor-h2)",fontTextEditorH3:"var(--graphy-font-text-editor-h3)",fontTextEditorH6:"var(--graphy-font-text-editor-h6)",fontTextEditorBody:"var(--graphy-font-text-editor-body)",fontTextEditorLink:"var(--graphy-font-text-editor-link)",fontHighlightModeTitle:"var(--graphy-font-highlight-mode-title)",fontHighlightModeSubtitle:"var(--graphy-font-highlight-mode-subtitle)"};const N=`'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu',
3
+ 'Cantarell', 'Helvetica Neue', 'NotoSansArabic', 'NotoSansJP', 'NotoSansSC', 'NotoSansKR', 'NotoSerifKR', sans-serif, 'Apple Color Emoji', 'NotoColorEmoji'`,Qo=N,q={regular:400,medium:500,semibold:600,bold:700,extraBold:800,black:900},E={xxs:1,xs:1.1,sm:1.2,md:1.4,lg:1.6,xl:2,editorBody:1.5,headingSm:1.8,headingMd:2.2,headingLg:2.8},B={xxs:1,xs:1,sm:1.3,md:1.43,lg:1,xl:1,editorBody:1.47,headingSm:1.25,headingMd:1.41,headingLg:1.29},ea=`var(--typography-chart-font-family, ${i.fontFamilyDefault})`,Re=`var(--typography-chart-heading-font-family, ${i.fontFamilyHeading})`,W=e=>`${e}em`,rn={textScale:"1",fontFamilyDefault:N,fontFamilyHeading:Qo,fontWeightRegular:q.regular.toString(),fontWeightMedium:q.medium.toString(),fontWeightSemibold:q.semibold.toString(),fontWeightBold:q.bold.toString(),fontWeightExtraBold:q.extraBold.toString(),fontWeightBlack:q.black.toString(),fontSizeXxs:W(E.xxs),fontSizeXs:W(E.xs),fontSizeSm:W(E.sm),fontSizeMd:W(E.md),fontSizeLg:W(E.lg),fontSizeXl:W(E.xl),fontLineHeightXxs:B.xxs.toString(),fontLineHeightXs:B.xs.toString(),fontLineHeightSm:B.sm.toString(),fontLineHeightMd:B.md.toString(),fontLineHeightLg:B.lg.toString(),fontLineHeightXl:B.xl.toString()},on={fontSizeEditorBody:W(E.editorBody),fontSizeHeadingSm:W(E.headingSm),fontSizeHeadingMd:W(E.headingMd),fontSizeHeadingLg:W(E.headingLg),fontLineHeightEditorBody:B.editorBody.toString(),fontLineHeightHeadingSm:B.headingSm.toString(),fontLineHeightHeadingMd:B.headingMd.toString(),fontLineHeightHeadingLg:B.headingLg.toString()},y=(e,t,n,o=ea)=>`${e} ${t}/${n} ${o}`,an={fontTickLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontAxisLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontDataLabel:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontStackTotal:y(i.fontWeightSemibold,i.fontSizeXs,i.fontLineHeightXs),fontLegendLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontSeriesLabel:y(i.fontWeightSemibold,i.fontSizeSm,i.fontLineHeightSm),fontTooltipLabel:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTooltipHeading:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTooltipFooter:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontJumboTooltipLabel:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontJumboTooltip:y(i.fontWeightMedium,i.fontSizeHeadingMd,i.fontLineHeightHeadingMd),fontMiniTooltipLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontMiniTooltipFooter:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontTooltipCaption:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTooltipCaptionSmall:y(i.fontWeightMedium,i.fontSizeXxs,i.fontLineHeightXxs),fontUITooltip:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontUITooltipSecondary:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTrendTag:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTrendTagSmall:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontGoalLineLabel:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontPieLabel:y(i.fontWeightMedium,i.fontSizeXs,i.fontLineHeightXs),fontPieChartTotal:y(i.fontWeightBold,i.fontSizeHeadingLg,i.fontLineHeightHeadingLg),fontDifferenceArrowSmall:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontDifferenceArrowMedium:y(i.fontWeightMedium,i.fontSizeLg,i.fontLineHeightLg),fontDifferenceArrowLarge:y(i.fontWeightSemibold,i.fontSizeXl,i.fontLineHeightXl),fontButton:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontInput:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontInputLabel:y(i.fontWeightMedium,i.fontSizeXxs,i.fontLineHeightXxs),fontSelectLabel:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontSelectDescription:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontColorSelectLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontMenuTitle:y(i.fontWeightSemibold,i.fontSizeMd,i.fontLineHeightMd),fontMenuGroupTitle:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontMenuItemLabel:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontMenuItemLabelSecondary:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontErrorBoundaryTitle:y(i.fontWeightSemibold,i.fontSizeHeadingSm,i.fontLineHeightHeadingSm),fontErrorBoundaryMessage:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTableCell:y(i.fontWeightMedium,i.fontSizeMd,i.fontLineHeightMd),fontTableHeaderCell:y(i.fontWeightSemibold,i.fontSizeSm,i.fontLineHeightSm),fontSourceLabel:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontSourceLink:y(i.fontWeightRegular,i.fontSizeSm,i.fontLineHeightSm),fontTextEditorH1:y(i.fontWeightBold,i.fontSizeHeadingLg,i.fontLineHeightHeadingLg,Re),fontTextEditorH2:y(i.fontWeightBold,i.fontSizeHeadingMd,i.fontLineHeightHeadingMd,Re),fontTextEditorH3:y(i.fontWeightSemibold,i.fontSizeHeadingSm,i.fontLineHeightHeadingSm,Re),fontTextEditorH6:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm),fontTextEditorBody:y(i.fontWeightMedium,i.fontSizeEditorBody,i.fontLineHeightEditorBody),fontTextEditorLink:y(i.fontWeightRegular,i.fontSizeMd,i.fontLineHeightMd),fontHighlightModeTitle:y(i.fontWeightBold,i.fontSizeMd,i.fontLineHeightMd),fontHighlightModeSubtitle:y(i.fontWeightMedium,i.fontSizeSm,i.fontLineHeightSm)},ta={small:1.9,medium:2.3,large:2.6},na={small:1,medium:1,large:1.2},ra=N,sn=B.sm,ln=2,cn=24,dn=12,un=10,hn=8,gn=8,fn=8,pn=2,mn=1,xn=2,vn=4,yn=E.sm,bn=B.sm,Sn=N,oa=xn*vn,jn=!1,be=6,kn=10,C=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,Ee=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,Ln=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,Ve=(e,t,n)=>`color-mix(in srgb, ${e}, ${t} ${n*100}%)`,aa=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),sa=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),D=e=>`${e}px`,Cn={graphPadding:D(u.LAYOUT_PADDING),gridLineWidth:"1px",gridLineDash:"2 3",tooltipBorderRadius:"6px",tooltipBorderWidth:"1px",tooltipPaddingBlock:"8px",tooltipPaddingInline:"10px",tooltipRowGap:"4px",tooltipShadow:"0 4px 12px rgba(0, 0, 0, 0.18)",tickLabelOffset:D(kn),legendItemGap:D(gn),legendSwatchGap:D(hn),legendSwatchWidth:D(un),legendSwatchHeight:D(dn),legendPillPaddingInline:D(fn),legendPillPaddingBlock:D(pn),legendPillBorderWidth:D(mn),headlineRowGap:D(ln),headlineItemGap:D(cn)},Tn={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)"},wn={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},An={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},ia=8,ee=e=>`${ia*e}px`,Pn={spaceXxs:ee(.25),spaceXs:ee(.5),spaceSm:ee(.75),spaceMd:ee(1),spaceLg:ee(1.5),spaceXl:ee(2)},la={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)"},ca={textPrimary:i.grey0,textSecondary:C(i.textPrimary,.8),textDisabled:C(i.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:C(i.textPrimary,.6),iconStickerBackground:i.grey70,border100:i.grey0,border50:C(i.grey0,.5),border10:C(i.grey0,.1),brand:i.purple50,success:i.green50,warning:i.amber50,alert:i.red50,sunkenBackground:i.grey100,defaultBackground:i.grey90,raisedBackground:i.grey80,overlayBackground:i.grey90,overlayBorderGradient:i.greyGradient80},da={graphBackground:i.grey90,gridLineColor:i.border10,originLineColor:i.grey0,targetLineColor:i.border100,targetLineMarkerColor:i.border100,targetLineLabelTextColor:i.grey100,legendBackground:i.defaultBackground,legendBorderColor:i.border10,legendFocusOutlineColor:i.border50,legendTextColor:i.textPrimary,dimmedSeriesLabelTextColor:i.textDisabled,dimmedSeriesLabelLineColor:i.grey60,trendNegativeColor:i.red60,trendPositiveColor:i.green60,trendNeutralColor:i.textSecondary,toolbarBackgroundColor:i.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:i.grey80,toolbarButtonBackgroundColorSelected:i.grey60,toolbarSeparatorColor:i.grey60,tooltipBackground:i.grey70,tooltipBorderColor:i.grey60,tooltipHeadingTextColor:i.textPrimary,tooltipLabelTextColor:i.textSecondary,tooltipValueTextColor:i.textPrimary,tooltipPrimaryRowColor:i.grey60,hoverGuideLineColor:C(i.white,.08),hoverGuideFillColor:C(i.white,.06),hoveredBarBorderColor:i.white,hoveredPointRingColor:i.white,pointStrokeColor:i.white,stackedBarHoverBorderColor:i.grey0,heatmapEmptyTileBackground:i.grey80,dataLabelOutsideBackground:C(i.textPrimary,.1),defaultAnnotationArrowStroke:i.white,defaultAnnotationShapeStroke:i.white,defaultAnnotationShapeFill:i.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:i.blue60,annotationMenuTriggerIconColor:i.white},ua={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},ha={...la,...ca,...Tn,...wn,...Pn,...An,...da,...ua,...Cn,...rn,...on,...an},ga={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)"},fa={textPrimary:i.black,textSecondary:C(i.textPrimary,.6),textDisabled:C(i.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:C(i.textPrimary,.6),iconStickerBackground:i.grey100,brand:i.purple50,success:i.green50,warning:i.amber50,alert:i.red50,border100:i.grey0,border50:C(i.grey0,.5),border10:C(i.grey0,.1),sunkenBackground:i.grey90,defaultBackground:i.grey100,raisedBackground:i.grey85,overlayBackground:i.grey100,overlayBorderGradient:i.border10},pa={graphBackground:i.grey100,gridLineColor:i.border10,originLineColor:i.grey0,targetLineColor:i.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:i.grey100,legendBackground:i.defaultBackground,legendBorderColor:i.border10,legendFocusOutlineColor:i.border50,legendTextColor:i.textPrimary,dimmedSeriesLabelTextColor:i.textDisabled,dimmedSeriesLabelLineColor:i.grey60,trendNegativeColor:i.red60,trendPositiveColor:i.green60,trendNeutralColor:i.textSecondary,toolbarBackgroundColor:i.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:i.grey80,toolbarButtonBackgroundColorSelected:i.grey60,toolbarSeparatorColor:i.grey60,tooltipBackground:i.white,tooltipBorderColor:i.border10,tooltipHeadingTextColor:i.textPrimary,tooltipLabelTextColor:i.textSecondary,tooltipValueTextColor:i.textPrimary,tooltipPrimaryRowColor:i.grey80,hoverGuideLineColor:C(i.black,.08),hoverGuideFillColor:C(i.black,.04),hoveredBarBorderColor:i.white,hoveredPointRingColor:i.white,pointStrokeColor:i.white,stackedBarHoverBorderColor:i.grey0,heatmapEmptyTileBackground:i.grey80,dataLabelOutsideBackground:C(i.textPrimary,.1),defaultAnnotationArrowStroke:i.black,defaultAnnotationShapeStroke:i.black,defaultAnnotationShapeFill:i.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:i.blue60,annotationMenuTriggerIconColor:"#3d414c"},ma={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},xa={...ga,...fa,...Tn,...wn,...Pn,...An,...pa,...ma,...Cn,...rn,...on,...an},En=(e,t={})=>({...e==="dark"?ha:xa,...t}),_n=(e,t)=>{const n=En(e,t),o=O(n.legendPillPaddingInline,fn),a=O(n.legendPillPaddingBlock,pn),s=O(n.legendPillBorderWidth,mn);return{graphPadding:O(n.graphPadding,u.LAYOUT_PADDING),tickLabelOffset:O(n.tickLabelOffset,kn),legendSwatchWidth:O(n.legendSwatchWidth,un),legendSwatchHeight:O(n.legendSwatchHeight,dn),legendSwatchGap:O(n.legendSwatchGap,hn),legendItemGap:O(n.legendItemGap,gn),legendPillPaddingInline:o,legendPillPaddingBlock:a,legendPillBorderWidth:s,legendPillHorizontalChrome:2*(o+s),legendPillVerticalChrome:2*(a+s),headlineRowGap:O(n.headlineRowGap,ln),headlineItemGap:O(n.headlineItemGap,cn)}},va=Object.freeze(_n("light"));function O(e,t){const n=e.trim();if(!/^-?\d*\.?\d+(px)?$/.test(n))return t;const o=Number.parseFloat(n);return Number.isFinite(o)?o:t}const Mn=g.createContext(va),ya=({metrics:e,children:t})=>r.jsx(Mn.Provider,{value:e,children:t}),rt=()=>g.useContext(Mn),ot=E.sm,Fn=N,Hn=10,Y=(e,t)=>e*Hn*t,ba=(e,t,n)=>{const{tickLabelOffset:o}=n;return a=>{const s=a.position==="top"||a.position==="bottom",l=a.ticks.map(h=>e.measureText(h.formattedLabel,{family:Fn,size:Y(ot,t)})),c=a.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(s){if(a.labelRotation!==0){const h=l.map(p=>p.width);return xt(h,c)+2*o}return Math.max(...l.map(h=>h.height))+o}return xt(l.map(h=>h.width),c)+o}},xt=(e,t)=>Math.min(Math.max(...e),t),Sa=e=>()=>Y(ot,e),ja=(e,t)=>(n,o)=>{const{labelLineHeight:a,labelFontWeight:s}=u.getDifferenceArrowDimensions(o,t);return e.measureText(n,{family:N,size:a,weight:s})},ka=(e,t,n)=>(o,a)=>{const s=Bn(o,a,e,t,n.headlineRowGap),l=In(s.map(d=>d.width)),c=Math.max(0,s.length-1)*n.headlineItemGap;return{width:l+c,height:Math.max(0,...s.map(d=>d.height))}},La=(e,t,n)=>(o,a)=>Bn(o,a,e,t,n.headlineRowGap).map(s=>s.width),Ca=(e,t)=>(n,o)=>{const a=Ue("value",o,t);return{width:e.measureText(n,a).width,height:a.size*sn}},Ta=(e,t,n)=>{const o=ka(e,t,n),a=Ca(e,t);return(s,l)=>s.kind==="perGroup"?o(s,l):a(s.value,l)},Bn=(e,t,n,o,a)=>{const s={value:Ue("value",t,o),label:Ue("label",t,o)},l=c=>wa(c,s,n);return e.items.map(c=>{const d=u.createHeadlineItemRows(c).map(l),h=Math.max(0,d.length-1)*a;return{width:Math.max(0,...d.map(f=>f.width)),height:In(d.map(f=>f.height))+h}})},wa=(e,t,n)=>{let o=0,a=0;for(const s of e.segments)if(s.kind==="text"){const l=t[s.fontRole];o+=n.measureText(s.text,l).width,a=Math.max(a,l.size*sn)}else o+=s.size,a=Math.max(a,s.size);return{width:o+Math.max(0,e.segments.length-1)*e.gap,height:a}},Ue=(e,t,n)=>{const o=e==="value"?ta[t]:na[t];return{family:ra,size:Y(o,n)}},In=e=>e.reduce((t,n)=>t+n,0),Nn=e=>{const t=Y(yn,e);return{fontSizePx:t,lineBoxHeight:t*bn}},Rn=(e,t)=>e?t:0,Aa=(e,t,n)=>o=>{const{fontSizePx:a,lineBoxHeight:s}=Nn(t),l={family:Sn,size:a};if(o.position==="top"||o.position==="bottom")return Math.max(s,n.legendSwatchHeight)+n.legendPillVerticalChrome;const d=o.items.map(h=>{const f=e.measureText(h.formattedLabel,l).width,p=Rn(h.visual.color,n.legendSwatchWidth);return p+(p>0?n.legendSwatchGap:0)+f});return Math.max(...d)+n.legendPillHorizontalChrome},Pa=(e,t)=>n=>e.measureText(n,{family:Fn,size:Y(ot,t)}),Ea=Object.freeze({}),_a=(e,t,n,o=Ea)=>{const a=g.useRef(o);return a.current=o,g.useMemo(()=>{if(!e)return null;const s=ba(e,t,n),l=Sa(t),c=Aa(e,t,n),d=Ta(e,t,n),h=La(e,t,n),f={measureText:(p,m)=>e.measureText(p,m),textScale:t};return{measureAxis:p=>{if(Fa(p))return 0;const m=a.current.measureAxis;return m?m(p,f):s(p)},measureAxisLabel:p=>{const m=a.current.measureAxisLabel;return m?m(p,f):l()},measureLegend:p=>{if(Ha(p))return 0;const m=a.current.measureLegend;return m?m(p,f):c(p)},measureHeadline:(p,m)=>(a.current.measureHeadline??d)(p,m),measureHeadlineItemWidths:(p,m)=>(a.current.measureHeadlineItemWidths??h)(p,m),measureTickLabel:Pa(e,t),measureDifferenceArrowLabel:ja(e,t)}},[e,t,n])},Ma=({measurer:e,axes:t,numberFormat:n,parsingLocale:o,formattedLegends:a,containerSize:s,externalMeasurements:l,headline:c,formattingLocale:d,annotations:h,coordSystem:f,textScale:p,graphPadding:m})=>g.useMemo(()=>e?new u.LayoutCompiler(e).compile({axes:t,numberFormat:n,parsingLocale:o,formattedLegends:a,containerSize:s,externalMeasurements:l,headline:c,formattingLocale:d,annotations:h,coordSystem:f,textScale:p,padding:m}):null,[t,n,o,a,s,l,c,d,h,f,p,m,e]),Fa=e=>!e.isVisible||e.ticks.length===0,Ha=e=>e.items.length===0,vt="data-variant",Dn=Wr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(vt)??null,renderHTML:e=>e.variant?{[vt]:e.variant}:{}}}}}),Ba=zr.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:n}=t;return n.depth!==1||n.parentOffset!==0?!1:n.index(0)===1}}}}),Ia=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:n,isSubtitleVisible:o})=>[Ra({isTitleVisible:n,isSubtitleVisible:o}),Dn,qt.Text,ke.UndoRedo,Wt.Heading.configure({levels:[1,2,3]}),Gt.Bold,$t.Italic,Ut.Underline,Vt.TextAlign.configure({types:["heading","paragraph"]}),Xt.Link.configure({openOnClick:!1,autolink:!0}),ne.TextStyle,ne.Color,ne.FontFamily,zt.HardBreak,Ba.configure({isTitleVisible:n}),ke.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:a,editor:s})=>{if(n&&a===0)return e;const l=n?s.state.doc.firstChild?.nodeSize??-1:0;return o&&a===l?t:""}})],Na=({placeholder:e})=>[Xe.Document,Dn,qt.Text,ke.UndoRedo,Wt.Heading.configure({levels:[1,2,3]}),Gt.Bold,$t.Italic,Ut.Underline,Vt.TextAlign.configure({types:["heading","paragraph"]}),Xt.Link.configure({openOnClick:!1,autolink:!0}),ne.TextStyle,ne.Color,ne.FontFamily,zt.HardBreak,ke.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Ra=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?Xe.Document.extend({content:"block{2,}"}):Xe.Document,Le=.1,Da={light:.05,dark:.1},Oa=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return Wa(e.color,t);case"gradient":return $a(e.color,t);case"preset":return u.BORDER_PRESET_GRADIENTS[e.preset]}},Ga=e=>e.type==="none"?0:e.width,za=(e,t,n)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return Ve(n,e.color,Da[t])},Wa=(e,t)=>t==="dark"?Ee(e,Le):Ln(e,Le),$a=(e,t,n=90)=>{const o=e,a=t==="dark"?Ee(e,Le):Ln(e,Le);return`linear-gradient(${n}deg, ${o} 0%, ${a} 100%)`};var Xa="bow4tg0",qa="bow4tg1",Va="bow4tg2",Ua="bow4tg3",On="_1ii3bsb0",Gn="_1ii3bsb1";const at=g.createContext(null),st=()=>{const e=g.useContext(at);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},zn=({theme:e,themeOverrides:t={},appearance:n,children:o})=>{const a=g.useMemo(()=>En(e,t),[e,t]),s=g.useMemo(()=>{const c={[i.textScale]:String(n.textScale)};for(const[h,f]of Object.entries(t))c[i[h]]=f;const d=za(n.background,e,a.graphBackground);return d!==void 0&&(c[i.graphBackground]=d),Xr.assignInlineVars(c)},[n.textScale,n.background,e,a.graphBackground,t]),l=g.useMemo(()=>({theme:e,themeClass:e==="dark"?Gn:On,inlineVarsStyle:s,themeValues:a}),[e,s,a]);return r.jsx(at.Provider,{value:l,children:o})},J=({children:e,className:t,style:n})=>{const o=g.useContext(at),a=o?F(o.themeClass,qa):void 0,s=o?{...o.inlineVarsStyle,...n}:n;return r.jsx("div",{className:F(a,t),style:s,children:e})},Ya="graphy_root",Z=()=>typeof document>"u"?null:document.getElementById(Ya)??document.body;var Ka="yp3g0k0",Ja="yp3g0k1",Wn="yp3g0k3",Za="yp3g0k4",$n="yp3g0k5",Ye="yp3g0k6",Qa="yp3g0k7",es="yp3g0k8",Xn="yp3g0k9",ts="yp3g0ka",ns="yp3g0kb",rs="yp3g0kc",os="yp3g0kd",as="yp3g0ke";const ss=nn.map(e=>i[e]),is=Object.fromEntries(nn.map(e=>[i[e],e])),ls=({editor:e,currentColor:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=ds(),l=g.useCallback(d=>{e.chain().setColor(d).run()},[e]),c=d=>{e.chain().focus().setColor(d).run(),o(!1)};return r.jsxs(P.Popover.Root,{open:n,onOpenChange:o,children:[r.jsx(P.Popover.Trigger,{render:r.jsx(A.Toolbar.Button,{}),"aria-label":a("graph.toolbar.color.label"),className:Ka,onMouseDown:d=>d.preventDefault(),children:r.jsx("span",{className:Ja,style:{background:t??"transparent"}})}),r.jsx(P.Popover.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(P.Popover.Positioner,{sideOffset:6,align:"start",className:Wn,children:r.jsxs(P.Popover.Popup,{className:Za,onMouseDown:d=>d.preventDefault(),children:[r.jsx(yt,{title:a("graph.colorDropdown.colors"),colors:ss,currentColor:t,onPick:c}),s.length>0&&r.jsx(yt,{title:a("graph.colorDropdown.chartColors"),colors:s,currentColor:t,onPick:c}),r.jsx(cs,{value:t??"#000000",onChange:l})]})})})})]})},yt=({title:e,colors:t,currentColor:n,onPick:o})=>r.jsxs("div",{className:$n,children:[r.jsx("div",{className:Ye,children:e}),r.jsx("div",{className:Qa,children:t.map(a=>r.jsx("button",{type:"button","aria-label":a,className:es,"data-active":hs(a,n),onMouseDown:s=>s.preventDefault(),onClick:()=>o(a),children:r.jsx("span",{className:Xn,style:qn(a)})},a))})]}),cs=({value:e,onChange:t})=>{const n=$.useI18n(),[o,a]=g.useState(!1),s=sa(e)?e:"#000000",l=us(s);return r.jsxs(P.Popover.Root,{open:o,onOpenChange:a,children:[r.jsxs("div",{className:$n,children:[r.jsx("div",{className:Ye,children:n("graph.colorDropdown.custom")}),r.jsxs(P.Popover.Trigger,{className:ts,onMouseDown:c=>c.preventDefault(),"aria-label":n("graph.colorDropdown.pickCustom"),children:[r.jsx("span",{className:Xn,style:qn(s)}),r.jsx("span",{className:ns,children:l})]})]}),r.jsx(P.Popover.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(P.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:Wn,children:r.jsxs(P.Popover.Popup,{className:rs,onMouseDown:c=>c.preventDefault(),children:[r.jsx("div",{className:Ye,children:n("graph.colorDropdown.pickColor")}),r.jsx(ut.HexColorPicker,{color:l,onChange:t,className:os}),r.jsx(ut.HexColorInput,{color:l,onChange:t,prefixed:!0,className:as,onMouseDown:c=>c.stopPropagation()})]})})})})]})},ds=()=>{const e=w(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const n of e.domain){const o=e.map(n);typeof o=="string"&&t.add(o)}return[...t]},[e])},qn=e=>({background:e,border:`1px solid ${Ee(e,.1)}`}),us=e=>{const{themeValues:t}=st();if(aa(e))return e.toUpperCase();const n=is[e];return n?t[n].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 fs={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const V=({children:e,title:t,variant:n="primary",size:o="sm",...a})=>{const s=g.useId(),l=gs[o];return r.jsxs("svg",{className:fs[n],"aria-labelledby":t?s:void 0,height:l,width:l,fill:"none",viewBox:"0 0 24 24",role:"img",...a,children:[t&&r.jsx("title",{id:s,children:t}),e]})},Vn=e=>r.jsx(V,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})}),ps="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Un=`'Aeonik', 'Aeonik Fallback', ${N}`,ms="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",xs="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",vs=`var(--brand-font-family), ${Un}`,Ke=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:N},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Un},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:ps},{id:"technical",label:"Technical",preview:"00",fontFamily:ms},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:xs},{id:"brand",label:"Brand",preview:"Aa",fontFamily:vs}],ys=e=>e?Ke.find(t=>t.fontFamily===e)??null:null;var Yn="_1qkyw7q0",Kn="_1qkyw7q1",Jn="_1qkyw7q3",Zn="_1qkyw7q4",Qn="_1qkyw7q5";const bs=({editor:e,currentFontFamily:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=ys(t)??Ke[0],l=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return r.jsxs(H.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(H.Menu.Trigger,{render:r.jsx(A.Toolbar.Button,{}),"aria-label":a("graph.toolbar.font.ariaLabel"),className:Yn,onMouseDown:c=>c.preventDefault(),children:[r.jsx("span",{className:Kn,style:{fontFamily:s?.fontFamily},children:s?.preview}),r.jsx(Vn,{size:"sm"})]}),r.jsx(H.Menu.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(H.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Jn,children:r.jsx(H.Menu.Popup,{className:Zn,onMouseDown:c=>c.preventDefault(),children:Ke.map(c=>r.jsx(H.Menu.Item,{className:Qn,"data-selected":c.id===s?.id,onClick:()=>l(c),children:r.jsx("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},er={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:i.fontTextEditorBody},bt=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:i.fontTextEditorH6},er,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:i.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:i.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:i.fontTextEditorH1}],Ss=({editor:e,activeStyle:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=bt.find(l=>l.id===t)??er;return r.jsxs(H.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(H.Menu.Trigger,{render:r.jsx(A.Toolbar.Button,{}),"aria-label":a("graph.toolbar.heading.ariaLabel"),className:Yn,onMouseDown:l=>l.preventDefault(),children:[r.jsx("span",{className:Kn,children:a(s.translationKey)}),r.jsx(Vn,{size:"sm"})]}),r.jsx(H.Menu.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(H.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Jn,children:r.jsx(H.Menu.Popup,{className:Zn,onMouseDown:l=>l.preventDefault(),children:bt.map(l=>r.jsx(H.Menu.Item,{className:Qn,"data-selected":l.id===s.id,onClick:()=>js(e,l.id),children:r.jsx(ks,{font:l.previewFont,children:a(l.translationKey)})},l.id))})})})})]})},js=(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()}},ks=({font:e,children:t})=>r.jsx("span",{style:{font:e,margin:0},children:t}),Ls=e=>r.jsx(V,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})})}),Cs=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.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"})]})}),Ts=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 6 6 18"}),r.jsx("path",{d:"m6 6 12 12"})]})}),ws=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),As=e=>{const{$from:t}=e.state.selection,n=t.parent.textContent,o=t.parentOffset,a=t.start();let s=o;for(;s>0&&St(n[s-1]);)s-=1;let l=o;for(;l<n.length&&St(n[l]);)l+=1;return{from:a+s,to:a+l}},St=e=>e!==void 0&&/\S/.test(e);var Ps="b5kquu0",Es="b5kquu1",_s="b5kquu2",Ms="b5kquu3",jt="b5kquu4";const Fs=({editor:e,currentUrl:t,isActive:n,isOpen:o,onOpenChange:a})=>{const s=$.useI18n(),[l,c]=g.useState(""),d=g.useRef(null);g.useEffect(()=>{o&&c(t??"")},[o,t]);const h=()=>{Hs(e,l),a(!1)},f=()=>{c(""),a(!1)},p=x=>{c(x.target.value)},m=x=>{x.key==="Enter"&&(x.preventDefault(),h())};return r.jsxs(P.Popover.Root,{open:o,onOpenChange:a,children:[r.jsx(P.Popover.Trigger,{render:r.jsx(A.Toolbar.Button,{}),"aria-label":s("graph.toolbar.formatting.link"),"data-active":n,className:Ps,onMouseDown:x=>x.preventDefault(),children:r.jsx(Cs,{})}),r.jsx(P.Popover.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(P.Popover.Positioner,{sideOffset:6,align:"end",className:Es,children:r.jsxs(P.Popover.Popup,{className:_s,initialFocus:d,onMouseDown:x=>x.preventDefault(),children:[r.jsx("input",{ref:d,type:"url",value:l,placeholder:s("graph.toolbar.link.placeholder"),"aria-label":s("graph.toolbar.link.urlLabel"),className:Ms,onMouseDown:x=>x.stopPropagation(),onChange:p,onKeyDown:m}),r.jsx("button",{type:"button","aria-label":s("common.cancel"),className:jt,onClick:f,children:r.jsx(Ts,{})}),r.jsx("button",{type:"button","aria-label":s("graph.toolbar.link.apply"),className:jt,onClick:h,children:r.jsx(Ls,{})})]})})})})]})},Hs=(e,t)=>{const n=t.trim(),{selection:o}=e.state;if(!n){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:n}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:n}).run();return}const a=As(e);e.chain().focus().setTextSelection(a).setLink({href:n}).run()},Bs=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M17 12H7"}),r.jsx("path",{d:"M19 19H5"})]})}),Is=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M21 12H9"}),r.jsx("path",{d:"M21 19H7"})]})}),Ns=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M15 12H3"}),r.jsx("path",{d:"M17 19H3"})]})});var Rs="k91gos0",Ds="k91gos1";const Os=6,re=({label:e,isActive:t,onToggle:n,children:o})=>{const a=s=>s.preventDefault();return r.jsxs(te.Tooltip.Root,{children:[r.jsx(te.Tooltip.Trigger,{render:r.jsx(qr.Toggle,{render:r.jsx(A.Toolbar.Button,{}),pressed:t,onPressedChange:()=>n()}),"aria-label":e,className:Rs,onMouseDown:a,children:o}),r.jsx(te.Tooltip.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(te.Tooltip.Positioner,{sideOffset:Os,children:r.jsx(te.Tooltip.Popup,{className:Ds,children:e})})})})]})},Gs=({editor:e,activeAlignment:t="left"})=>{const n=$.useI18n();return r.jsxs(r.Fragment,{children:[r.jsx(re,{label:n("graph.toolbar.textAlign.left"),isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:r.jsx(Ns,{})}),r.jsx(re,{label:n("graph.toolbar.textAlign.center"),isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:r.jsx(Bs,{})}),r.jsx(re,{label:n("graph.toolbar.textAlign.right"),isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:r.jsx(Is,{})})]})};var zs="_1bp10ig0",ue="_1bp10ig1",Se="_1bp10ig2";const Ws=({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:$s(e),textAlign:Xs(e)}),$s=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",Xs=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",qs=8,Vs=8,Us=({editor:e})=>{const t=$.useI18n(),[n,o]=g.useState(!1),[a,s]=g.useState(null),l=a!==null,c=v=>b=>{s(b?v:null)},{refs:d,floatingStyles:h}=M.useFloating({placement:"top-start",strategy:"fixed",middleware:[M.offset(qs),M.flip(),M.shift({padding:Vs})],whileElementsMounted:M.autoUpdate}),f=g.useRef(null),p=et.useEditorState({editor:e,selector:Ws}),m=g.useCallback(v=>{f.current=v,d.setFloating(v)},[d]);if(g.useEffect(()=>{e&&d.setReference(e.view.dom)},[e,d]),g.useEffect(()=>{if(!e)return;const v=()=>o(!0),b=({event:S})=>{const{relatedTarget:j,currentTarget:k}=S,_=j instanceof Node&&f.current?.contains(j),L=j instanceof Node&&k instanceof Node&&k.contains(j);!_&&!L&&o(!1)};return e.on("focus",v),e.on("blur",b),()=>{e.off("focus",v),e.off("blur",b)}},[e]),!e||!n&&!l)return null;const x=Z();return x?$r.createPortal(r.jsx(J,{children:r.jsx(te.Tooltip.Provider,{children:r.jsxs(A.Toolbar.Root,{ref:m,className:zs,style:h,children:[r.jsxs(A.Toolbar.Group,{className:ue,children:[r.jsx(ls,{editor:e,currentColor:p?.color??null,isOpen:a==="color",onOpenChange:c("color")}),r.jsx(bs,{editor:e,currentFontFamily:p?.fontFamily??null,isOpen:a==="fontFamily",onOpenChange:c("fontFamily")})]}),r.jsx(A.Toolbar.Separator,{className:Se}),r.jsx(A.Toolbar.Group,{className:ue,children:r.jsx(Ss,{editor:e,activeStyle:p?.fontSize??"text",isOpen:a==="fontSize",onOpenChange:c("fontSize")})}),r.jsx(A.Toolbar.Separator,{className:Se}),r.jsxs(A.Toolbar.Group,{className:ue,children:[r.jsx(re,{label:t("graph.toolbar.formatting.bold"),isActive:p?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:r.jsx("strong",{children:"B"})}),r.jsx(re,{label:t("graph.toolbar.formatting.italic"),isActive:p?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:r.jsx("em",{children:"I"})}),r.jsx(re,{label:t("graph.toolbar.formatting.underline"),isActive:p?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:r.jsx("u",{children:"U"})})]}),r.jsx(A.Toolbar.Separator,{className:Se}),r.jsx(A.Toolbar.Group,{className:ue,children:r.jsx(Gs,{editor:e,activeAlignment:p?.textAlign})}),r.jsx(A.Toolbar.Separator,{className:Se}),r.jsx(A.Toolbar.Group,{className:ue,children:r.jsx(Fs,{editor:e,currentUrl:p?.linkUrl??null,isActive:p?.isLink??!1,isOpen:a==="link",onOpenChange:c("link")})})]})})}),x):null};var Ys="_2ngohc0";const tr=({editor:e,ariaLabel:t})=>r.jsxs("div",{className:Ys,children:[r.jsx(Us,{editor:e}),r.jsx(et.EditorContent,{editor:e,"aria-label":t})]}),nr=(e,t)=>{const n=g.useRef(e);n.current=e;const o=g.useRef(t);o.current=t;const a=g.useRef(null),s=g.useRef(null),l=g.useMemo(()=>{const c=()=>{s.current!==null&&(clearTimeout(s.current),s.current=null),a.current=null},d=()=>{s.current!==null&&(clearTimeout(s.current),s.current=null);const f=a.current;f!==null&&(a.current=null,n.current(...f))};return{run:(...f)=>{if(o.current<=0){n.current(...f);return}a.current=f,s.current!==null&&clearTimeout(s.current),s.current=setTimeout(d,o.current)},flush:d,cancel:c}},[]);return g.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),l},Ks=200,rr=({content:e,extensions:t,isEditable:n,onUpdate:o,updateDebounceMs:a=Ks})=>{const s=g.useRef(kt(e)),l=g.useRef(!1),c=nr(h=>{l.current=!0,o?.(h)},a),d=et.useEditor({extensions:t,content:s.current,editable:n,immediatelyRender:!1,onUpdate:({editor:h})=>c.run(h.getJSON())});return g.useEffect(()=>{d?.setEditable(n)},[d,n]),g.useEffect(()=>{if(!d)return;if(l.current){l.current=!1;return}const h=kt(e),f=d.getJSON();Js(f,h)||(c.cancel(),d.commands.setContent(h,{emitUpdate:!1}))},[d,e,c]),g.useEffect(()=>()=>c.flush(),[c]),d},kt=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);var Zs="_1cocly40";const Qs={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"},Ce=({content:e})=>r.jsx(r.Fragment,{children:or(e.content??[e])}),or=e=>e.map((t,n)=>ei(t,n)),ei=(e,t)=>{if(e.type==="text")return ti(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return r.jsx("br",{},t);const n=e.content?or(e.content):null;switch(e.type){case"doc":return r.jsx(g.Fragment,{children:n},t);case"heading":{const o=ai(e.attrs?.level);return si(o,t,n,Ct(e.attrs))}case"paragraph":{const o=oe(e.attrs?.variant);return r.jsx("p",{"data-variant":o??void 0,style:ar(Ct(e.attrs)),children:n},t)}case"blockquote":return r.jsx("blockquote",{children:n},t);case"bulletList":case"bullet_list":return r.jsx("ul",{children:n},t);case"orderedList":case"ordered_list":return r.jsx("ol",{children:n},t);case"listItem":case"list_item":return r.jsx("li",{children:n},t);default:return r.jsx("span",{children:n},t)}},ti=(e,t)=>{const n=e.text??"";return!e.marks||e.marks.length===0?r.jsx("span",{children:n},t):e.marks.reduceRight((o,a,s)=>ni(a,o,`${t}-${s}`),n)},ni=(e,t,n)=>{switch(e.type){case"bold":case"strong":return r.jsx("strong",{children:t},n);case"italic":case"em":return r.jsx("em",{children:t},n);case"underline":return r.jsx("u",{children:t},n);case"strike":case"strikethrough":case"s":return r.jsx("s",{children:t},n);case"code":return r.jsx("code",{children:t},n);case"link":{const o=oe(e.attrs?.href);return u.isSafeUrl(o)?r.jsx("a",{className:Zs,href:o,rel:"noopener noreferrer",target:"_blank",children:t},n):r.jsx("span",{children:t},n)}case"textStyle":{const o=ri(e.attrs);return o?r.jsx("span",{style:o,children:t},n):r.jsx("span",{children:t},n)}default:return r.jsx("span",{children:t},n)}},Lt=e=>{const t=oe(e&&typeof e=="object"?e.fontFamily:e);if(t)return Qs[t]??t},ri=e=>{if(!e)return null;const t={},n=oe(e.color);n&&(t.color=n);const o=Lt(e.font)??Lt(e.fontFamily);o&&(t.fontFamily=o);const a=oi(e.fontSize);return a&&(t.fontSize=a),Object.keys(t).length>0?t:null},oi=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:oe(e),oe=e=>typeof e=="string"&&e.length>0?e:void 0,ai=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),si=(e,t,n,o)=>{const a=ar(o);switch(e){case 1:return r.jsx("h1",{style:a,children:n},t);case 2:return r.jsx("h2",{style:a,children:n},t);case 3:return r.jsx("h3",{style:a,children:n},t)}},Ct=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},ar=e=>e?{textAlign:e}:void 0;var ii="_4dlrid0",sr="_4dlrid1",li="xfz7dq0",ci="xfz7dq1",di="xfz7dq2",ui="xfz7dq3",hi="xfz7dq4";const ir=({ref:e,footerRect:t,mode:n="readonly",caption:o,isCaptionVisible:a,source:s,isSourceVisible:l})=>{const c=n==="editable",d=a&&(c||o!==null),h=l&&s!==null&&mi(s);return!d&&!h?null:r.jsxs("div",{ref:e,className:li,style:{left:t.x,top:t.y,width:t.width},children:[d?c?r.jsx(xi,{caption:o}):r.jsx(gi,{caption:o}):null,h&&r.jsx(fi,{source:s})]})},gi=({caption:e})=>e===null?null:typeof e=="string"?r.jsx("p",{className:sr,children:e}):r.jsx(Ce,{content:e}),fi=({source:e})=>{const t=u.isSafeUrl(e.url)?e.url:void 0,n=e.label??(t!==void 0?pi(t):"");return n===""&&t===void 0?null:r.jsxs("div",{className:ci,children:[r.jsx("span",{className:ui,children:"Source:"}),t!==void 0?r.jsx("a",{className:di,href:t,target:"_blank",rel:"noopener noreferrer",children:n}):r.jsx("span",{className:hi,children:n})]})},pi=e=>{try{return new URL(e).hostname}catch{return e}},mi=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",xi=({caption:e})=>{const t=tt(),n=g.useMemo(()=>Na({placeholder:"Add caption"}),[]),o=rr({content:e,extensions:n,isEditable:!0,onUpdate:a=>{const s=ws(a)?null:a;t(new u.SetContentCaptionCommand({caption:s}))}});return r.jsx(tr,{editor:o,ariaLabel:"Chart caption"})};var vi="_1k4qtbg0";const yi=3,bi=({title:e,isTitleVisible:t,subtitle:n,isSubtitleVisible:o})=>{const a=[];return t&&a.push({type:"heading",attrs:{level:yi},content:ji(e)}),o&&a.push(...ki(n)),{type:"doc",content:a}},Si=e=>{const t=e.content??[],[n,...o]=t;return{title:Li(n?.content??[]),subtitle:Ci(o)}},it=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(it)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),ji=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??[],ki=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(Tt):[Tt(e)],Tt=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Li=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(it)}},Ci=e=>{const t=e.filter(o=>(o.content??[]).length>0);if(t.length===0)return null;const[n]=t;if(n&&t.length===1&&n.type==="paragraph"){const o=n.content??[],[a]=o;if(a&&o.length===1&&a.type==="text"&&(!a.marks||a.marks.length===0))return a.text??null}return{type:"doc",content:t.map(it)}},lr=({ref:e,headerRect:t,mode:n="readonly",title:o,isTitleVisible:a,subtitle:s,isSubtitleVisible:l})=>{const c=n==="editable";return!(a&&(c||o!==null))&&!(l&&(c||s!==null))?null:r.jsx("div",{ref:e,className:vi,style:{left:t.x,top:t.y,width:t.width},children:c?r.jsx(wi,{title:o,isTitleVisible:a,isSubtitleVisible:l,subtitle:s},[a?"title":"",l?"subtitle":""].join("-")):r.jsx(Ti,{title:o,isTitleVisible:a,isSubtitleVisible:l,subtitle:s})})},Ti=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const a=t&&e!==null,s=n&&o!==null;return r.jsxs(r.Fragment,{children:[a&&(typeof e=="string"?r.jsx("h1",{className:ii,children:e}):r.jsx(Ce,{content:e})),s&&(typeof o=="string"?r.jsx("p",{className:sr,children:o}):r.jsx(Ce,{content:o}))]})},wi=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const a=tt(),s=g.useMemo(()=>Ia({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:n}),[t,n]),l=g.useMemo(()=>bi({title:e,isTitleVisible:t,subtitle:o,isSubtitleVisible:n}),[e,t,o,n]),c=rr({content:l,extensions:s,isEditable:!0,onUpdate:d=>{const h=Si(d);t&&a(new u.SetContentTitleCommand({title:h.title})),n&&a(new u.SetContentSubtitleCommand({subtitle:h.subtitle}))}});return r.jsx(tr,{editor:c,ariaLabel:"Chart title and subtitle"})};var Ai="_1u9qprb0",Pi="_1u9qprb1",Ei="_9aen060",_i="_9aen061",Mi="_9aen062",cr="_9aen063";const Fi=Object.freeze(Object.defineProperty({__proto__:null,groupRow:Mi,item:cr,trendRow:_i,valueRow:Ei},Symbol.toStringTag,{value:"Module"})),Hi=e=>r.jsx(V,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7-7 7 7"}),r.jsx("path",{d:"M12 19V5"})]})}),Bi=e=>r.jsx(V,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M5 12h14"})})});var dr="n7clvo0",Ii="n7clvo1",Ni="n7clvo2",Ri="n7clvo3",ur={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},Di={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},Oi={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},Gi={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const zi=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return r.jsx(Ae,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return r.jsx("div",{className:Gi[e.direction],children:e.direction==="flat"?r.jsx(Bi,{size:"xs",title:""}):r.jsx(Hi,{size:"xs",title:""})});const n=e.fontRole==="value"?ur[t]:Di[t];return r.jsx("span",{className:F.clsx(Wi(e),n),children:e.text})},Wi=e=>{switch(e.textRole){case"value":return dr;case"observation":return Ii;case"trendPercentage":return Oi[e.trendDirection??"up"];case"trendReference":return Ni;case"label":return Ri}},$i=({item:e,resolvedSize:t})=>r.jsx("div",{className:cr,children:u.createHeadlineItemRows(e).map(n=>r.jsx(Xi,{row:n,resolvedSize:t},n.role))}),Xi=({row:e,resolvedSize:t})=>{const n=e.role==="trendRow";return r.jsx("div",{className:Fi[e.role],"data-testid":n?"headline-trend":void 0,"data-direction":n?qi(e):void 0,role:n?"img":void 0,"aria-label":n?e.ariaLabel:void 0,children:e.segments.map((o,a)=>r.jsx(zi,{segment:o,resolvedSize:t},a))})},qi=e=>{const t=e.segments.find(n=>n.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},Vi=({headline:e,rect:t,resolvedSize:n,visibleItemCount:o})=>{const a={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?r.jsx("div",{className:Pi,style:a,children:r.jsx("span",{className:F.clsx(dr,ur[n]),children:e.value})}):r.jsx("div",{className:Ai,style:a,children:e.items.slice(0,o).map((s,l)=>r.jsx($i,{item:s,resolvedSize:n},`${s.label}-${l}`))})};var Ui="_1oj6yix0",Yi="_1oj6yix1",Ki="_1oj6yix2";const Ji=8,Zi=16,Qi=2,el=({legends:e,containerRect:t,textScale:n})=>{const{lineBoxHeight:o}=Nn(n),{placements:a,hasOverlap:s}=tl(e,t,o);if(a.length===0)return null;const l=s?Zi:Ji,c=l-Qi;return r.jsxs("div",{className:Ui,children:[s&&r.jsx("svg",{className:Yi,width:t.width,height:t.height,children:a.map(d=>r.jsx(nl,{anchorY:d.anchorY,labelY:d.y,endX:c,color:d.payload.color},d.payload.key))}),a.map(d=>r.jsx("span",{className:Ki,style:{left:l,top:d.y,color:d.payload.color},children:d.payload.label},d.payload.key))]})},tl=(e,t,n)=>g.useMemo(()=>{const o=[];for(const a of e)for(const s of a.items){if(s.normalizedY===null)continue;const l=typeof s.visual.color=="string"?s.visual.color:void 0;o.push({normalizedY:s.normalizedY,payload:{key:String(o.length),label:s.formattedLabel,color:l}})}return o.length===0||t.height<=0?{placements:[],hasOverlap:!1}:u.computeDirectLabelsLayout({items:o,containerHeight:t.height,labelHeight:n})},[e,t.height,n]),nl=({anchorY:e,labelY:t,endX:n,color:o})=>{const a=n/2;return r.jsx("path",{d:`M0,${e} C${a},${e} ${a},${t} ${n},${t}`,fill:"none",stroke:o??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var rl="_6a636s0";const ol=/\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu,hr="😀";class _e{constructor(){this.emojiCorrections=new Map,this.currentFont="";const n=new OffscreenCanvas(1,1).getContext("2d");if(!n)throw new Error("Failed to create OffscreenCanvas 2D context");this.ctx=n}static async create(){return typeof document<"u"&&"fonts"in document&&await document.fonts.ready,new _e}measureText(t,n){const o=u.buildFontString(n);this.setFont(o);const{width:a,fontBoundingBoxAscent:s,fontBoundingBoxDescent:l}=this.ctx.measureText(t);let c=a;const d=al(t);if(d>0){const h=this.getEmojiCorrection(o);c-=h*d}return{width:c,height:s+l,ascent:s,descent:l}}setFont(t){this.currentFont!==t&&(this.ctx.font=t,this.currentFont=t)}getEmojiCorrection(t){const n=this.emojiCorrections.get(t);if(n!==void 0)return n;this.setFont(t);const o=this.ctx.measureText(hr).width,a=sl(t);let s=0;if(a!==null){const l=o-a;s=l>.5?l:0}return this.emojiCorrections.set(t,s),s}}let X=null;const al=e=>{const t=e.match(ol);return t?t.length:0},sl=e=>{const t=il();return t?(t.style.font=e,t.getBoundingClientRect().width):null},il=()=>typeof document>"u"?null:(X||(X=document.createElement("span"),X.style.position="absolute",X.style.visibility="hidden",X.style.whiteSpace="nowrap",X.style.left="-9999px",X.textContent=hr,document.body.appendChild(X)),X),gr=g.createContext(null),fr=({children:e,measurer:t})=>{const[n,o]=g.useState(null);g.useEffect(()=>{if(t!==void 0)return;let s=!1;const l=()=>{s||o(ll())};return(async()=>{typeof document<"u"&&"fonts"in document&&await document.fonts.ready,l()})(),typeof document<"u"&&"fonts"in document&&document.fonts.addEventListener("loadingdone",l),()=>{s=!0,typeof document<"u"&&"fonts"in document&&document.fonts.removeEventListener("loadingdone",l)}},[t]);const a=t??n;return a===null?null:r.jsx(gr.Provider,{value:a,children:e})},Q=()=>{const e=g.useContext(gr);if(e===null)throw new Error("useTextMeasurer must be used inside a <TextMeasurerProvider>.");return e},ll=()=>{try{return new u.CachedTextMeasurer(new _e)}catch{return new u.CachedTextMeasurer(new u.HeuristicTextMeasurer)}};var cl="_1kjk02r0",dl="_1kjk02r1",ul="_1kjk02r2",hl="_1kjk02r3",gl="_1kjk02r4",fl="_1kjk02r5",pl="_1kjk02r6",ml="_1kjk02r7",xl="_1kjk02r8",vl="_1kjk02r9",yl="_1kjk02ra",bl="_1kjk02rb",Sl="_1dw9dgx0";const jl="#9ca3af",De="\0",kl=e=>{const t=[];return e.forEach((n,o)=>{const a=n.aesthetics.includes("size");for(const s of n.items){if(a){const h=Number(s.visual.size);if(!Number.isFinite(h)||h<=0)continue}const l=s.visual.color??"",c=a?`${De}${Number(s.visual.size)}`:"",d=s.visual.lineType;t.push({key:`${o}${De}${String(s.value)}${De}${l}${c}`,formattedLabel:s.formattedLabel,visual:s.visual,swatchShape:s.swatchShape,isBubble:a,primaryLineType:d})}}),t},pr=({pill:e})=>e.isBubble?r.jsx(Tl,{pill:e}):r.jsx(Cl,{pill:e}),Ll=({color:e,lineType:t,shape:n})=>{const{legendSwatchWidth:o,legendSwatchHeight:a}=rt();return e?r.jsx(Ae,{shape:n,color:e,lineType:t,width:o,height:a}):null},Cl=({pill:e})=>r.jsxs(r.Fragment,{children:[r.jsx(Ll,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),r.jsx("span",{children:e.formattedLabel})]}),Tl=({pill:e})=>{const t=Number(e.visual.size);return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:Sl,style:{width:t,height:t,backgroundColor:e.visual.color??jl}}),r.jsx("span",{children:e.formattedLabel})]})},wl=({hiddenPills:e,placement:t})=>{const n=$.useI18n(),[o,a]=g.useState(!1),{refs:s,floatingStyles:l}=M.useFloating({open:o,placement:t,middleware:[M.offset(4),M.flip(),M.shift({padding:8})]});g.useEffect(()=>{if(!o)return;const f=m=>{const x=m.target;if(!x)return;const v=s.reference.current,b=s.floating.current;v instanceof Element&&v.contains(x)||b instanceof Element&&b.contains(x)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)};return document.addEventListener("pointerdown",f),document.addEventListener("keydown",p),()=>{document.removeEventListener("pointerdown",f),document.removeEventListener("keydown",p)}},[o,s.floating,s.reference]);const c=t==="left"||t==="right",d=Math.min(e.length-1,xn),h=Array.from({length:d},(f,p)=>d-p);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:s.setReference,className:F.clsx(cl,{[ul]:c,[dl]:!c}),children:[h.map(f=>r.jsx("span",{className:F.clsx(hl,{[fl]:c,[gl]:!c}),style:Al(f,c),"aria-hidden":!0},f)),r.jsx("button",{type:"button",className:F.clsx(pl,{[ml]:o}),onClick:()=>a(f=>!f),"aria-haspopup":"dialog","aria-expanded":o,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:r.jsxs("span",{className:xl,children:["+",e.length]})})]}),o&&r.jsx("div",{ref:s.setFloating,role:"dialog","aria-label":n("graph.legend.hiddenItems"),className:vl,style:l,children:r.jsx("ul",{className:yl,children:e.map(f=>r.jsx("li",{className:bl,children:r.jsx(pr,{pill:f})},f.key))})})]})},Al=(e,t)=>{const n=-e*vn;return{transform:t?`translateY(${n}px)`:`translateX(${n}px)`}};var Pl="_1cecisi0",El="_1cecisi1",_l="_1cecisi2",Ml="_1cecisi3";const Fl=({edge:e,formattedLegends:t,containerWidth:n,containerHeight:o,textScale:a})=>{const s=Q(),l=rt(),c=g.useMemo(()=>kl(t),[t]),d=e==="left"||e==="right",h=d?o:n,f=g.useMemo(()=>{if(c.length===0)return{visibleCount:0,hasOverflow:!1};if(h<=0)return{visibleCount:c.length,hasOverflow:!1};const v=Y(yn,a),b={family:Sn,size:v},S=v*bn,j=z=>d?Hl(z,S,l):wt({label:z.formattedLabel,swatchInlineSize:Bl(z,l.legendSwatchWidth),textMeasurer:s,font:b,swatchGap:l.legendSwatchGap,horizontalChrome:l.legendPillHorizontalChrome}),k=c.map(j),L=(d?S+l.legendPillVerticalChrome:wt({label:`+${c.length}`,swatchInlineSize:0,textMeasurer:s,font:b,swatchGap:l.legendSwatchGap,horizontalChrome:l.legendPillHorizontalChrome}))+oa;return Nl({pillSizes:k,overflowPillSize:L,containerSize:h,gap:l.legendItemGap})},[c,h,d,s,a,l]);if(c.length===0)return null;const p=c.slice(0,f.visibleCount),m=c.slice(f.visibleCount),x=f.hasOverflow&&m.length>0;return r.jsxs("div",{className:F.clsx(Pl,{[_l]:d,[El]:!d}),children:[p.map(v=>r.jsx("div",{className:Ml,children:r.jsx(pr,{pill:v})},v.key)),x&&r.jsx(wl,{hiddenPills:m,placement:Rl(e)})]})},wt=({label:e,swatchInlineSize:t,textMeasurer:n,font:o,swatchGap:a,horizontalChrome:s})=>{const l=n.measureText(e,o).width,c=t>0?a:0;return t+c+l+s},Hl=(e,t,n)=>{const o=Il(e,n.legendSwatchHeight);return Math.max(t,o)+n.legendPillVerticalChrome},Bl=(e,t)=>e.isBubble?Number(e.visual.size):Rn(e.visual.color,t),Il=(e,t)=>e.isBubble?Number(e.visual.size):t,Nl=({pillSizes:e,overflowPillSize:t,containerSize:n,gap:o})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let a=0;for(let c=0;c<e.length;c+=1)c>0&&(a+=o),a+=e[c]??0;if(a<=n)return{visibleCount:e.length,hasOverflow:!1};let s=0,l=0;for(const c of e){const d=s+(l>0?o:0)+c;if(d+o+t>n)break;s=d,l+=1}return{visibleCount:l,hasOverflow:!0}},Rl=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Dl=g.memo(function({formattedLegends:t,rects:n,textScale:o}){const a=g.useMemo(()=>{const s=new Map;for(const l of t){let c=s.get(l.position);c||(c={pill:[],direct:[]},s.set(l.position,c)),l.display==="pill"?c.pill.push(l):c.direct.push(l)}return s},[t]);return r.jsx(r.Fragment,{children:Array.from(a,([s,l])=>{const c=n[s];return c===void 0?null:r.jsxs("div",{className:rl,style:{left:c.x,top:c.y,width:c.width,height:c.height},children:[r.jsx(Fl,{edge:s,formattedLegends:l.pill,containerWidth:c.width,containerHeight:c.height,textScale:o}),r.jsx(el,{legends:l.direct,containerRect:c,textScale:o})]},s)})})});const lt=1,mr=8,Ol=12;i.pointStrokeColor;const Gl=1,zl=2,Wl=.7,ae=({hit:e})=>{const t=u.getColor(e.observation),n=(u.getAlpha(e.observation)??lt)*Wl,o=(u.getSize(e.observation)??mr)/2;return r.jsx("circle",{cx:u.toPercent(u.toViewBoxX(e.x)),cy:u.toPercent(u.toViewBoxY(e.y)),r:o,fill:t,opacity:n,stroke:i.hoveredPointRingColor,strokeWidth:zl,"data-testid":"companion-point"})},xr=.3,vr=1,I={type:"spring",stiffness:500,damping:60,mass:1},Je=(e,t)=>{const n=T.useMotionValue(e);return g.useEffect(()=>{const o=Vr.interpolatePath(n.get(),e);T.animate(0,1,{...t,onUpdate:a=>{const s=o(a);return n.set(s)}})},[t,e,n]),n};var ie="_1d8mpa10";const $l=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const{lineGenerator:a,areaGenerator:s}=g.useMemo(()=>u.createAreaPathGenerators(n,t.params),[t.params,n]),l=g.useMemo(()=>{const c=u.createStableKeyGenerator(t.data,t.mapping,t.id),d=[];return t.data.groupBy(u.GROUP_VARIABLES.group).forEach(h=>{const f=u.prepareAreaObservations([...h],t.params.missingValues),p=s(f),m=a(f);if(!p||!m)return;const x=f[0];if(!x)return;const v=u.getColor(x),b=u.getAlpha(x),S=u.resolveStrokeWidth(x,t.params),j=u.getDashArray(u.getLineType(x));d.push({key:c(x),areaPath:p,linePath:m,color:v,fillOpacity:b??xr,strokeWidth:S,strokeOpacity:vr,strokeDasharray:j})}),d},[s,a,t.data,t.id,t.mapping,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:ie,children:l.map(c=>r.jsx(Xl,{areaPath:c.areaPath,linePath:c.linePath,color:c.color,fillOpacity:c.fillOpacity,strokeWidth:c.strokeWidth,strokeOpacity:c.strokeOpacity,strokeDasharray:c.strokeDasharray,isAnimated:o},c.key))})}),Xl=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:a,strokeOpacity:s,strokeDasharray:l,isAnimated:c})=>c?r.jsx(ql,{areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:a,strokeOpacity:s,strokeDasharray:l}):r.jsxs("g",{children:[r.jsx("path",{d:e,fill:n,fillOpacity:o,stroke:"none"}),r.jsx("path",{d:t,fill:"none",stroke:n,strokeWidth:a,strokeOpacity:s,strokeDasharray:l,vectorEffect:"non-scaling-stroke"})]}),ql=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:a,strokeOpacity:s,strokeDasharray:l})=>{const c=Je(e,I),d=Je(t,I);return r.jsxs("g",{children:[r.jsx(T.motion.path,{d:c,fill:n,fillOpacity:o,stroke:"none"}),r.jsx(T.motion.path,{d,fill:"none",stroke:n,strokeWidth:a,strokeOpacity:s,strokeDasharray:l,vectorEffect:"non-scaling-stroke"})]})};var Vl="_46ebsf0";const Oe=1,Ul=2,Yl=1,Kl=Ol/2,Jl=2.25,ct=({hit:e,...t})=>{const n=Zl(e.observation),o=u.getColor(e.observation),a=u.getAlpha(e.observation)??lt,s=u.toPercent(u.toViewBoxX(e.x)),l=u.toPercent(u.toViewBoxY(e.y)),d=n+Oe/2+Yl+Oe/2;return r.jsxs("g",{...t,className:Vl,children:[r.jsx("circle",{cx:s,cy:l,r:d,fill:"none",stroke:i.hoveredPointRingColor,strokeWidth:Ul}),r.jsx("circle",{cx:s,cy:l,r:n,fill:o,opacity:a,stroke:i.hoveredPointRingColor,strokeWidth:Oe})]})},Zl=e=>{const t=u.getSize(e);return u.isDefined(t)?t/Jl:Kl},Ql=({layer:e,coordSystem:t,primary:n,companions:o})=>{const a=u.getGroup(n.observation),s=g.useMemo(()=>{const m=e.data.filter(u.GROUP_VARIABLES.group,"eq",a);return u.prepareAreaObservations([...m],e.params.missingValues)},[e.data,e.params.missingValues,a]),{areaPath:l,linePath:c}=g.useMemo(()=>{const{lineGenerator:m,areaGenerator:x}=u.createAreaPathGenerators(t,e.params);return{areaPath:x(s)??"",linePath:m(s)??""}},[t,e.params,s]);if(!l||!c)return null;const d=u.getColor(n.observation),h=u.getAlpha(n.observation)??xr,f=u.resolveStrokeWidth(n.observation,e.params),p=u.getDashArray(u.getLineType(n.observation));return r.jsxs("g",{"data-testid":"hovered-area",children:[r.jsxs("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:ie,children:[r.jsx("path",{d:l,fill:d,fillOpacity:h,stroke:"none","data-testid":"hovered-area-fill"}),r.jsx("path",{d:c,fill:"none",stroke:d,strokeWidth:f,strokeOpacity:vr,strokeDasharray:p,vectorEffect:"non-scaling-stroke","data-testid":"hovered-area-edge"})]}),o.map(m=>r.jsx(ae,{hit:m},`companion-${m.layerId}-${m.pointIndex}`)),r.jsx(ct,{hit:n,"data-testid":"hovered-area-point"})]})},ec={geom:"area",coord:"cartesian",guideMode:"continuous",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx($l,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({layer:e,coordSystem:t,primary:n,group:o,related:a})=>r.jsx(Ql,{layer:e,coordSystem:t,primary:n,companions:[...o,...a]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ae,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e,coordSystem:t})=>{if(t.mainAxis==="x"){const a=u.getX(e),s=u.getYMax(e)??u.getY(e);return a===null||s===null?null:{x:a,y:s}}const n=u.getY(e),o=u.getXMax(e)??u.getX(e);return n===null||o===null?null:{x:o,y:n}}},yr=1,pe=4,At=.025,br=e=>{const{scaleX:t,scaleY:n}=w(G.useShallow(o=>({scaleX:o.scales.x,scaleY:o.scales.y})));return g.useMemo(()=>{const o=u.getBarBaselineClip(tc(t,n));return nc(e,o)},[t,n,e])},Sr=({maskId:e,gradientId:t,direction:n})=>{const o=n==="left"||n==="right",a=n==="left"||n==="top";return r.jsxs(r.Fragment,{children:[r.jsx("linearGradient",{id:t,x1:"0",y1:"0",x2:o?1:0,y2:o?0:1,children:a?r.jsxs(r.Fragment,{children:[r.jsx("stop",{offset:0,stopColor:"black"}),r.jsx("stop",{offset:At,stopColor:"white"})]}):r.jsxs(r.Fragment,{children:[r.jsx("stop",{offset:1-At,stopColor:"white"}),r.jsx("stop",{offset:1,stopColor:"black"})]})}),r.jsx("mask",{id:e,maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100%",height:"100%",children:r.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${t})`})})]})},tc=(e,t)=>{const n=o=>o?.kind==="position"&&o.spec.scaleType==="continuous";if(n(e)&&!n(t))return e;if(n(t)&&!n(e))return t},nc=(e,t)=>t===null?null:e==="y"?t==="min"?"left":"right":t==="min"?"bottom":"top",rc=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const a=g.useId(),s=g.useId(),l=br(n.mainAxis),c=g.useMemo(()=>{const p=u.createStableKeyGenerator(t.data,t.mapping,t.id),m=new Map;for(const x of t.data){const v=u.getBarRectBounds(n.mainAxis,x);if(!v)continue;const b=ac(n.mainAxis,v),S=m.get(b),j={key:p(x),...v,fill:u.getColor(x),opacity:u.getAlpha(x)??yr};S?S.push(j):m.set(b,[j])}return[...m.entries()].map(([x,v])=>({id:`${a}${x}`,bars:v,...sc(v)}))},[a,n.mainAxis,t]),d=c.filter(p=>p.bars.length>1),h=l?`${s}mask`:void 0,f=`${s}grad`;return r.jsxs(r.Fragment,{children:[(d.length>0||h!==void 0)&&r.jsxs("defs",{children:[d.map(p=>r.jsx("clipPath",{id:p.id,children:r.jsx(oc,{column:p,isAnimated:o})},p.id)),h!==void 0&&l&&r.jsx(Sr,{maskId:h,gradientId:f,direction:l})]}),r.jsx("g",{mask:h!==void 0?`url(#${h})`:void 0,children:c.map(p=>{const[m]=p.bars;if(p.bars.length===1&&m!==void 0){const{key:x,...v}=m;return r.jsx(Pt,{...v,rx:pe,isAnimated:o},x)}return r.jsx("g",{clipPath:`url(#${p.id})`,children:p.bars.map(x=>{const{key:v,...b}=x;return r.jsx(Pt,{...b,isAnimated:o},v)})},p.id)})})]})}),Pt=({isAnimated:e,rx:t,...n})=>e?r.jsx(T.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:I,fill:n.fill,opacity:n.opacity,rx:t,animate:{x:u.toPercent(n.x),y:u.toPercent(n.y),width:u.toPercent(n.width),height:u.toPercent(n.height),opacity:n.opacity}}):r.jsx("rect",{style:{transformBox:"view-box"},x:u.toPercent(n.x),y:u.toPercent(n.y),width:u.toPercent(n.width),height:u.toPercent(n.height),fill:n.fill,opacity:n.opacity,rx:t}),oc=({column:e,isAnimated:t})=>t?r.jsx(T.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:I,rx:pe,animate:{x:u.toPercent(e.x),y:u.toPercent(e.y),width:u.toPercent(e.width),height:u.toPercent(e.height)}}):r.jsx("rect",{x:u.toPercent(e.x),y:u.toPercent(e.y),width:u.toPercent(e.width),height:u.toPercent(e.height),rx:pe}),ac=(e,t)=>e==="x"?`${t.x}-${t.width}`:`${t.y}-${t.height}`,sc=e=>{let t=1/0,n=1/0,o=-1/0,a=-1/0;for(const s of e)s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x+s.width>o&&(o=s.x+s.width),s.y+s.height>a&&(a=s.y+s.height);return{x:t,y:n,width:o-t,height:a-n}};var ic="_1suo8ub0";const he=3,lc=({coordSystem:e,primary:t,panelRect:n})=>{const o=g.useId(),a=br(e.mainAxis),s=u.getBarRectBounds(e.mainAxis,t.observation);if(!s)return null;const l=s.x*n.width,c=s.y*n.height,d=s.width*n.width,h=s.height*n.height,f=l-he,p=c-he,m=d+he*2,x=h+he*2,v=pe+he,b=u.getColor(t.observation),S=u.getAlpha(t.observation)??yr,j=a?`${o}mask`:void 0;return r.jsxs("g",{"data-testid":"hovered-bar",children:[j!==void 0&&a&&r.jsx("defs",{children:r.jsx(Sr,{maskId:j,gradientId:`${o}grad`,direction:a})}),r.jsxs("g",{mask:j!==void 0?`url(#${j})`:void 0,children:[r.jsx("rect",{x:f,y:p,width:m,height:x,rx:v,fill:i.hoveredBarBorderColor,className:ic,"data-testid":"hovered-bar-border"}),r.jsx("rect",{x:u.toPercent(s.x),y:u.toPercent(s.y),width:u.toPercent(s.width),height:u.toPercent(s.height),fill:b,opacity:S,rx:pe,"data-testid":"hovered-bar-fill"})]})]})},cc={geom:"bar",coord:"cartesian",guideMode:"bar",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(rc,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({coordSystem:e,primary:t,panelRect:n})=>r.jsx(lc,{coordSystem:e,primary:t,panelRect:n}),renderHoverCompanions:()=>null},jr=1,dc=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>u.createLinePathGenerator(t.params),[t.params]),a=g.useMemo(()=>{const s=u.createStableKeyGenerator(t.data,t.mapping,t.id),l=[];return t.data.groupBy(u.GROUP_VARIABLES.group).forEach(c=>{const d=u.prepareLineObservations([...c],t.params.missingValues),h=o(d);if(!h)return;const f=d[0];if(!f)return;const p=u.getColor(f),m=u.getAlpha(f),x=u.resolveStrokeWidth(f,t.params),v=u.getDashArray(u.getLineType(f));l.push({key:s(f),pathData:h,color:p,opacity:m??jr,strokeWidth:x,strokeDasharray:v})}),l},[o,t.data,t.id,t.mapping,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:ie,children:a.map(s=>r.jsx(uc,{pathData:s.pathData,color:s.color,strokeWidth:s.strokeWidth,opacity:s.opacity,strokeDasharray:s.strokeDasharray,isAnimated:n},s.key))})}),uc=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:a,isAnimated:s})=>s?r.jsx(hc,{pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:a}):r.jsx("path",{d:e,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:a,vectorEffect:"non-scaling-stroke"}),hc=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:a})=>{const s=Je(e,I);return r.jsx(T.motion.path,{d:s,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:a,vectorEffect:"non-scaling-stroke"})},gc=({layer:e,primary:t,companions:n})=>{const o=u.getGroup(t.observation),a=g.useMemo(()=>{const f=e.data.filter(u.GROUP_VARIABLES.group,"eq",o);return u.prepareLineObservations([...f],e.params.missingValues)},[e.data,e.params.missingValues,o]),s=g.useMemo(()=>u.createLinePathGenerator(e.params)(a),[e.params,a]);if(!s)return null;const l=u.getColor(t.observation),c=u.getAlpha(t.observation)??jr,d=u.resolveStrokeWidth(t.observation,e.params),h=u.getDashArray(u.getLineType(t.observation));return r.jsxs("g",{"data-testid":"hovered-line",children:[r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:ie,children:r.jsx("path",{d:s,fill:"none",stroke:l,strokeWidth:d,opacity:c,strokeDasharray:h,vectorEffect:"non-scaling-stroke","data-testid":"hovered-line-path"})}),n.map(f=>r.jsx(ae,{hit:f},`companion-${f.layerId}-${f.pointIndex}`)),r.jsx(ct,{hit:t,"data-testid":"hovered-line-point"})]})},fc={geom:"line",coord:"cartesian",guideMode:"continuous",render:({layer:e,isAnimated:t})=>r.jsx(dc,{layer:e,isAnimated:t}),renderHover:({layer:e,primary:t,group:n,related:o})=>r.jsx(gc,{layer:e,primary:t,companions:[...n,...o]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ae,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=u.getX(e),n=u.getY(e);return t===null||n===null?null:{x:t,y:n}}},pc=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>{const a=[];let s=0;for(const l of t.data){const c=s++,d=u.getX(l),h=u.getY(l);if(d===null||h===null)continue;const f=u.getColor(l),p=u.getAlpha(l),m=u.getSize(l),x=u.getStrokeWidth(l);a.push({key:String(c),cx:u.toViewBoxX(d),cy:u.toViewBoxY(h),radius:(m??t.params.size)/2,fill:f,stroke:i.pointStrokeColor,opacity:p??lt,strokeWidth:x??Gl})}return a},[t.data,t.params.size]);return r.jsx(r.Fragment,{children:o.map(a=>n?r.jsx(T.motion.circle,{initial:!1,transition:I,fill:a.fill,stroke:a.stroke,strokeWidth:a.strokeWidth,animate:{cx:u.toPercent(a.cx),cy:u.toPercent(a.cy),r:a.radius,opacity:a.opacity}},a.key):r.jsx("circle",{cx:u.toPercent(a.cx),cy:u.toPercent(a.cy),r:a.radius,fill:a.fill,opacity:a.opacity,stroke:a.stroke,strokeWidth:a.strokeWidth},a.key))})}),mc={geom:"point",coord:"cartesian",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(pc,{layer:e,isAnimated:t}),renderHover:({primary:e,group:t,related:n})=>r.jsxs("g",{"data-testid":"hovered-point",children:[[...t,...n].map(o=>r.jsx(ae,{hit:o},`companion-${o.layerId}-${o.pointIndex}`)),r.jsx(ct,{hit:e})]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ae,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=u.getX(e),n=u.getY(e);return t===null||n===null?null:{x:t,y:n}}},xc=11.7,vc=E.xs,yc=N,bc=q.medium,ge=5,Sc=5,Et=10,_t=10,jc=4,Te=13,kr=6,Ge=12,Mt=21.6,kc="0 0 10 18",Lc="M2.48935 16.9323L9.07098 9.82964C9.51595 9.34944 9.51504 8.60728 9.0689 8.12818L2.48866 1.06172C1.85811 0.384586 0.974477 0 0.049217 0H0V18H0.0443689C0.972463 18 1.85854 17.6131 2.48935 16.9323Z",Ft="#FFFFFF",ze="#1A1A1A";var Cc="_16vokpr0";const Tc=(e,t)=>{const n=e.mapping.y!==void 0,o=t.mainAxis==="y";return n!==o},wc=(e,t)=>{const n=u.toPercent(e?1-t:t);return e?{x1:"0%",y1:n,x2:"100%",y2:n}:{x1:n,y1:"0%",x2:n,y2:"100%"}},Ac=(e,t)=>e==="solid"?{}:e==="dotted"?{strokeDasharray:`0 ${t*2}`,strokeLinecap:"round"}:{strokeDasharray:`${t*2} ${t*3}`,strokeLinecap:"round",strokeMiterlimit:16},Pc=e=>{const t=e.params.color,n=t??i.targetLineColor;let o=i.targetLineLabelTextColor;if(t!==void 0)try{o=qe.getContrast(t,Ft)>qe.getContrast(t,ze)?Ft:ze}catch{o=ze}return{lineColor:n,labelTextColor:o}},Ec=(e,t)=>je(e)&&je(t)?`${e}: ${t}`:je(e)?e:je(t)?t:null,je=e=>e!=null&&e.trim()!=="",_c=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:a,text:s,isAnimated:l})=>{const c=e==="start",d=c?-Te:-(o-Te),h=c?d+o-ge:d+ge-Ge,f=c?void 0:`rotate(180 ${h+Ge/2} ${a/2})`,p=c?"0%":"100%",m=u.toPercent(1-t),x=r.jsxs("g",{transform:`translate(0, ${-a/2})`,pointerEvents:"none",children:[r.jsx("rect",{x:d,y:0,width:o,height:a,rx:kr,fill:n}),r.jsx("g",{transform:f,children:r.jsx("svg",{x:h,y:(a-Mt)/2,width:Ge,height:Mt,viewBox:kc,overflow:"visible",children:r.jsx("path",{d:Lc,fill:n})})}),r.jsx("g",{transform:`translate(${d+ge}, ${a/2})`,children:s})]});return l?r.jsx(T.motion.svg,{initial:!1,transition:I,x:p,animate:{y:m},overflow:"visible",children:x}):r.jsx("svg",{x:p,y:m,overflow:"visible",children:x})},Mc=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:a,text:s,isAnimated:l})=>{const c=e==="start",d=c?-Te:-(a-Te),h=u.toPercent(t),f=c?"100%":"0%",p=r.jsxs("g",{transform:`translate(${-o/2}, 0)`,pointerEvents:"none",children:[r.jsx("rect",{x:0,y:d,width:o,height:a,rx:kr,fill:n}),r.jsx("g",{transform:`translate(${ge}, ${d+a/2})`,children:s})]});return l?r.jsx(T.motion.svg,{initial:!1,transition:I,y:f,animate:{x:h},overflow:"visible",children:p}):r.jsx("svg",{x:h,y:f,overflow:"visible",children:p})},Fc=({label:e,textWidth:t,labelPosition:n,isHorizontalLine:o,position:a,color:s,textColor:l,symbolShape:c,symbolColor:d,isAnimated:h})=>{const f=c===null?0:Et+jc,p=t+f+ge*2,m=xc+Sc*2,x=r.jsxs(r.Fragment,{children:[c!==null&&d!==null&&r.jsx("g",{transform:`translate(0, ${-_t/2})`,children:r.jsx(Ae,{shape:c,color:d,width:Et,height:_t})}),r.jsx("text",{x:f,textAnchor:"start",dominantBaseline:"central",fill:l,style:{font:i.fontGoalLineLabel},children:e})]});return o?r.jsx(_c,{labelPosition:n,linePosition:a,color:s,pillWidth:p,pillHeight:m,text:x,isAnimated:h}):r.jsx(Mc,{labelPosition:n,linePosition:a,color:s,pillWidth:p,pillHeight:m,text:x,isAnimated:h})},Hc=({layer:e,isHorizontalLine:t,position:n,lineColor:o,isAnimated:a})=>{const s=wc(t,n),l=Ac(e.params.lineType,e.params.strokeWidth);return a?r.jsx(T.motion.line,{initial:!1,transition:I,animate:{x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},...l,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"}):r.jsx("line",{...s,...l,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"})},Bc=g.memo(function({layer:t,coordSystem:n,formattingLocale:o,isAnimated:a}){const s=Q(),{guides:l,numberFormat:c,textScale:d,layers:h,colorScale:f}=w(G.useShallow(L=>({guides:L.guides,numberFormat:L.config.numberFormat,textScale:L.config.appearance.textScale,layers:L.spec.layers,colorScale:L.scales.color}))),p=g.useMemo(()=>u.buildAverageLineSymbols(h,f,n).get(t.id)??null,[h,f,n,t.id]),m=g.useMemo(()=>Ec(t.params.label,u.formatRuleValue({guides:l,numberFormat:c,layer:t,locale:o})),[l,c,o,t]),x=g.useMemo(()=>({family:yc,size:Y(vc,d),weight:bc}),[d]),v=g.useMemo(()=>m===null?0:s.measureText(m,x).width,[m,x,s]),b=t.data.getFirst();if(!b)return null;const{lineColor:S,labelTextColor:j}=Pc(t),k=Tc(t,n),_=k?u.getY(b):u.getX(b);return _===null?null:r.jsxs("g",{"data-geom":"rule",className:Cc,children:[r.jsx(Hc,{layer:t,isHorizontalLine:k,position:_,lineColor:S,isAnimated:a}),m!==null&&r.jsx(Fc,{label:m,textWidth:v,labelPosition:t.params.labelPosition,isHorizontalLine:k,position:_,color:S,textColor:j,symbolShape:p?.shape??null,symbolColor:p?.color??null,isAnimated:a})]})}),Ic={geom:"rule",coord:"cartesian",guideMode:null,render:({layer:e,coordSystem:t,formattingLocale:n,isAnimated:o})=>r.jsx(Bc,{layer:e,coordSystem:t,formattingLocale:n,isAnimated:o}),renderHover:()=>null,renderHoverCompanions:()=>null},Lr=1,Ht=Math.PI*2,Nc=g.memo(function({layer:t,isAnimated:n}){const o=g.useRef(!1);g.useEffect(()=>{o.current=!0},[]);const a=g.useMemo(()=>{const s=u.createStableKeyGenerator(t.data,t.mapping,t.id),l=[];for(const c of t.data){const d=s(c),{startAngle:h,endAngle:f}=u.getAngleExtent(c),{innerRadius:p,outerRadius:m}=u.getRadiusExtent(c);h===null||f===null||p===null||m===null||l.push({key:d,startAngle:h,endAngle:f,innerRadius:p,outerRadius:m,fill:u.getColor(c),opacity:u.getAlpha(c)??Lr})}return l},[t]);return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"bar",className:ie,children:a.map(s=>{if(n){const{key:l,...c}=s;return r.jsx(Rc,{isInitialRender:!o.current,...c},l)}return r.jsx("path",{d:u.buildPolarBarArcPath({startAngle:s.startAngle,endAngle:s.endAngle,innerRadius:s.innerRadius,outerRadius:s.outerRadius})??void 0,fill:s.fill,opacity:s.opacity},s.key)})})}),Rc=({startAngle:e,endAngle:t,innerRadius:n,outerRadius:o,fill:a,opacity:s,isInitialRender:l})=>{const c=l?e:Ht,d=l?t:Ht,h=T.useSpring(c,I),f=T.useSpring(d,I),p=T.useMotionValue(u.buildPolarBarArcPath({startAngle:c,endAngle:d,innerRadius:n,outerRadius:o})??"");return g.useEffect(()=>{h.set(e),f.set(t)},[h,f,e,t]),g.useEffect(()=>{const m=()=>{const b=h.get(),S=f.get();p.set(u.buildPolarBarArcPath({startAngle:b,endAngle:S,innerRadius:n,outerRadius:o})??"")},x=h.on("change",m),v=f.on("change",m);return()=>{x(),v()}},[h,f,n,o,p]),r.jsx(T.motion.path,{d:p,fill:a,opacity:s,transition:I})},Dc=({primary:e})=>{const{startAngle:t,endAngle:n}=u.getAngleExtent(e.observation),{innerRadius:o,outerRadius:a}=u.getRadiusExtent(e.observation);if(t===null||n===null||o===null||a===null)return null;const s=u.buildPolarBarArcPath({startAngle:t,endAngle:n,innerRadius:o,outerRadius:a});if(!s)return null;const l=u.getColor(e.observation),c=u.getAlpha(e.observation)??Lr;return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"arc","data-testid":"hovered-arc",className:ie,children:r.jsx("path",{d:s,fill:l,opacity:c})})},Oc={geom:"bar",coord:"polar",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(Nc,{layer:e,isAnimated:t}),renderHover:({primary:e})=>r.jsx(Dc,{primary:e}),renderHoverCompanions:()=>null},Gc={bar:{cartesian:cc,polar:Oc},line:{cartesian:fc},area:{cartesian:ec},point:{cartesian:mc},rule:{cartesian:Ic}},Me=(e,t)=>Gc[e.geom]?.[t.type]??null,zc=(e,t)=>{const n=e.filter(a=>a.interactive);if(n.length===0)return null;const o=n.map(a=>Me(a,t)).filter(a=>a!==null).map(a=>a.guideMode);return o.length===0?null:o.some(a=>a==="bar")?"bar":o.every(a=>a==="continuous")?"continuous":null},Wc=1,$c="4 3",Xc=({panelRect:e})=>{const{coordSystem:t,layers:n,scales:o}=w(G.useShallow(l=>({coordSystem:l.coordSystem,layers:l.layers,scales:l.scales}))),a=Pe(l=>l.hover.primary);if(t.type!=="cartesian"||n.length===0||a===null)return null;const s=zc(n,t);return s===null?null:s==="bar"?r.jsx(Vc,{coordSystem:t,scales:o,primary:a,panelRect:e}):r.jsx(qc,{coordSystem:t,primary:a,panelRect:e})},qc=({coordSystem:e,primary:t,panelRect:n})=>{const o=u.getHoverGuideLineProps(e,t);return r.jsx(Cr,{panelRect:n,children:r.jsx("line",{...o,stroke:i.hoverGuideLineColor,strokeWidth:Wc,strokeDasharray:$c,strokeLinecap:"round","data-testid":"hover-guide-line"})})},Vc=({coordSystem:e,scales:t,primary:n,panelRect:o})=>{const a=u.getHoverGuideRectProps(e,t,n);return a===null?null:r.jsx(Cr,{panelRect:o,children:r.jsx("rect",{...a,fill:i.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},Cr=({panelRect:e,children:t})=>r.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}),Uc=200,Yc=({engine:e,store:t,overlayRef:n})=>{g.useEffect(()=>{const o=n.current;if(!o)return;const a=Kc(o,e),s=Jc(o,e,t);return()=>{s(),a()}},[e,t,n])},Kc=(e,t)=>{const n=()=>{const l=e.getBoundingClientRect();l.width===0||l.height===0||t.setViewport({width:l.width,height:l.height})};let o=null;const a=()=>{o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,n()},Uc)},s=new ResizeObserver(a);return s.observe(e),n(),()=>{s.disconnect(),o!==null&&clearTimeout(o)}},Jc=(e,t,n)=>{let o=null,a=null;const s=()=>{a=null;const d=o;if(o=null,!d)return;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};n.getState().setHoverState(t.query(f))},l=d=>{o=d,a===null&&(a=requestAnimationFrame(s))},c=()=>{o=null,a!==null&&(cancelAnimationFrame(a),a=null);const d=n.getState();d.hover.primary!==null&&d.setHoverState(u.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",l),e.addEventListener("pointerleave",c),()=>{e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",c),a!==null&&cancelAnimationFrame(a),o=null}},Zc=({panelRect:e})=>{const{engine:t,store:n,overlayRef:o}=we();return Yc({engine:t,store:n,overlayRef:o}),r.jsx("rect",{ref:o,x:e.x,y:e.y,width:e.width,height:e.height,fill:"transparent",pointerEvents:"all","data-testid":"pointer-capture-layer"})},We="data-hover-active",Qc=e=>{const{store:t}=we(),n=fe.useStore(t,o=>o.hover.primary!==null);g.useEffect(()=>{const o=e.current;if(o)return n?o.setAttribute(We,"true"):o.removeAttribute(We),()=>{o.removeAttribute(We)}},[e,n])},Tr=E.xs,Ze=N,wr=q.medium,ed=q.semibold,Ar=6,Pr=2,td=4,nd=2,Bt=4;var rd="_1agclyl0",od="_1agclyl1",ad="_1agclyl2",sd={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},id="_1agclyl6 _1agclyl3";const Er=({x:e,y:t,width:n,height:o,text:a,isRotated:s,target:l,position:c,coordType:d})=>{const h=s?`rotate(-90 ${e} ${t})`:void 0,f=l==="aggregate"?id:sd[c],p=ld(l,c,d);return r.jsxs("g",{transform:h,children:[p&&r.jsx("rect",{className:p,x:e-n/2,y:t-o/2,width:n,height:o,rx:Bt,ry:Bt}),r.jsx("text",{className:f,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:a})]})},ld=(e,t,n)=>{if(e==="aggregate")return ad;if(t==="outside"&&n==="cartesian")return od},cd={dataLabel:{x:Ar,y:Pr},stackTotal:{x:td,y:nd}},dd=({panelRect:e,formattingLocale:t})=>{const n=Q(),o=w(G.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,axes:c.guides.axes,numberFormat:c.config.numberFormat,parsingLocale:c.config.parsingLocale,textScale:c.config.appearance.textScale}))),a=g.useMemo(()=>{const c=Y(Tr,o.textScale);return{dataLabel:{family:Ze,size:c,weight:wr},stackTotal:{family:Ze,size:c,weight:ed}}},[o.textScale]),s=g.useMemo(()=>(c,d)=>{const h=n.measureText(d,a[c]),f=cd[c];return{...h,width:h.width+f.x*2,height:h.height+f.y*2}},[n,a]),l=g.useMemo(()=>u.buildDataLabelsContent({...o,panelRect:e,measureDataLabel:s,formattingLocale:t}),[o,e,s,t]);return r.jsx("g",{className:rd,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:l.labels.map(c=>r.jsx(Er,{x:c.x,y:c.y,width:c.width,height:c.height,text:c.text,isRotated:c.isRotated,target:c.target,position:c.position,coordType:o.coordSystem.type},c.key))})},ud=({linePath:e,arrowheadPath:t,stroke:n,strokeWidth:o})=>{const a={stroke:n,strokeWidth:o,strokeLinecap:"round",fill:"none"};return r.jsxs("g",{children:[r.jsx("path",{d:e,...a}),r.jsx("path",{d:t,...a,strokeLinejoin:"round"})]})},hd=({x:e,y:t,text:n,lineHeight:o,paddingX:a,paddingY:s,strokeWidth:l,strokeColor:c,fontWeight:d})=>{const h=Q(),p=g.useMemo(()=>h.measureText(n,{family:N,size:o,weight:d}),[h,n,o,d]).width+a*2,m=o+s*2;return r.jsxs("g",{style:{pointerEvents:"none"},children:[r.jsx("rect",{x:e-p/2,y:t-m/2,width:p,height:m,rx:4,fill:i.graphBackground,stroke:c,strokeWidth:l}),r.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:i.textPrimary,style:{fontFamily:N,fontSize:o,fontWeight:d},children:n})]})},gd=({panelRect:e,formattingLocale:t})=>{const n=w(G.useShallow(a=>({differenceArrows:a.annotations.differenceArrows,mainAxis:a.coordSystem.type==="cartesian"?a.coordSystem.mainAxis:"x",textScale:a.config.appearance.textScale}))),o=g.useMemo(()=>n.differenceArrows.map(a=>u.computeDifferenceArrow({arrow:a,mainAxis:n.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:n.textScale,locale:t})),[n,e.width,e.height,t]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:o.map(({color:a,id:s,linePath:l,arrowheadPath:c,strokeWidth:d,labelPosition:h,labelText:f,labelLineHeight:p,labelPaddingX:m,labelPaddingY:x,labelStrokeWidth:v,labelFontWeight:b})=>{const S=a??i.defaultAnnotationArrowStroke;return r.jsxs(g.Fragment,{children:[r.jsx(ud,{linePath:l,arrowheadPath:c,stroke:S,strokeWidth:d}),r.jsx(hd,{x:h.x,y:h.y,text:f,lineHeight:p,paddingX:m,paddingY:x,strokeWidth:v,strokeColor:S,fontWeight:b})]},s)})})},fd=0,pd=1.15,It=1.15,md="rgba(0, 0, 0, 0.16)",Nt=2,xd=1.4,vd=({arrow:e,fallbackColor:t,stickerOutlineColor:n,stickerOutlineColorInverse:o})=>{const a=g.useId(),s=e.color??t,l=yd(e.color,n,o),c=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},d=e.arrowheadExtent+e.strokeWidth+Nt+It,h={x:Math.min(e.startX,e.endX)-d,y:Math.min(e.startY,e.endY)-d,width:Math.abs(e.endX-e.startX)+2*d,height:Math.abs(e.endY-e.startY)+2*d},f=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(p=>p.length>0).join(" ");return r.jsxs("g",{children:[e.hasStickerStyle&&r.jsx("defs",{children:r.jsx("filter",{id:a,filterUnits:"userSpaceOnUse",...h,children:r.jsx("feDropShadow",{dx:fd,dy:pd,stdDeviation:It,floodColor:md})})}),r.jsxs("g",{filter:e.hasStickerStyle?`url(#${a})`:void 0,children:[e.hasStickerStyle&&r.jsx("path",{d:f,stroke:l,strokeWidth:e.strokeWidth+2*Nt,strokeLinecap:"round",fill:"none"}),r.jsx("path",{d:e.linePath,stroke:s,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...c}),e.startArrowheadPath.length>0&&r.jsx("path",{d:e.startArrowheadPath,stroke:s,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&r.jsx("path",{d:e.endArrowheadPath,stroke:s,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},yd=(e,t,n)=>{if(e===null)return n;try{return qe.getContrast(e,t)<xd?n:t}catch{return n}},bd=({panelRect:e})=>{const{themeValues:t}=st(),n=w(a=>a.annotations.freeformArrows),o=g.useMemo(()=>n.map(a=>u.computeFreeformArrow({arrow:a,panelWidth:e.width,panelHeight:e.height})).filter(a=>a!==null),[n,e.width,e.height]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:o.map(a=>r.jsx(vd,{arrow:a,fallbackColor:i.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},a.id))})},Sd=({edge:e,areTicksVisible:t,position:n,labelRotation:o,label:a})=>{const{tickLabelOffset:s}=rt(),l=u.toPercent(n),c=(t?1:0)*s,d={style:{font:i.fontTickLabel},fill:i.textSecondary},h=o!==0&&(e==="top"||e==="bottom"),f=e==="top";return h?r.jsx("svg",{x:l,y:f?"100%":0,style:{overflow:"visible"},children:r.jsx("text",{...kd(f,c,o),...d,children:a})}):r.jsx("text",{...jd(e,l,c),...d,children:a})},jd=(e,t,n)=>{switch(e){case"bottom":return{x:t,y:n,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-n,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-n,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:n,y:t,textAnchor:"start",dominantBaseline:"central"}}},kd=(e,t,n)=>{const o=e?-t:t;return{x:0,y:o,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${n}, 0, ${o})`}},Ld=({formattedAxis:e,rect:t})=>{const n=e.position==="bottom"||e.position==="top";return r.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[jn,e.ticks.map((o,a)=>{const s=o.formattedLabel,l=n?o.position:1-o.position,c=Cd(e.position,l,t);return r.jsxs("g",{children:[e.ticksVisible&&r.jsx("line",{...c,stroke:i.gridLineColor,strokeWidth:1}),r.jsx(Sd,{edge:e.position,areTicksVisible:e.ticksVisible,position:l,labelRotation:e.labelRotation,label:s})]},a)})]})},Cd=(e,t,n)=>{const o=u.toPercent(t);switch(e){case"bottom":return{x1:o,y1:0,x2:o,y2:be};case"top":return{x1:o,y1:n.height,x2:o,y2:n.height-be};case"left":return{x1:n.width,y1:o,x2:n.width-be,y2:o};case"right":return{x1:0,y1:o,x2:be,y2:o}}},Td=({axes:e,rects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];if(!o||!n.isVisible)return null;const a=wd(n.position,o);return r.jsxs("g",{transform:`translate(${o.x}, ${o.y})`,children:[jn,r.jsx("text",{style:{font:i.fontAxisLabel},fill:i.textPrimary,...a,children:n.label})]},`axis-label-${n.position}`)})}),wd=(e,t)=>{const n={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(n.x=0,n.textAnchor="start"):e==="right"&&(n.x=t.width,n.textAnchor="end"),n},Ad=({formattedAxes:e,tickRects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];return!o||!n.isVisible?null:r.jsx(Ld,{formattedAxis:n,rect:o},n.scaleAestheticKey)})}),Pd=({formattedAxes:e,labelRects:t})=>r.jsx(Td,{axes:e,rects:t}),Rt={strokeWidth:i.gridLineWidth,strokeDashoffset:"0",strokeDasharray:i.gridLineDash,strokeLinecap:"round"},_r=({axes:e,panel:t,panelRect:n})=>r.jsxs("svg",{x:n.x,y:n.y,width:n.width,height:n.height,style:{overflow:"visible"},children:[t.border.isVisible&&r.jsx("rect",{x:0,y:0,width:n.width,height:n.height,fill:"none",stroke:i.gridLineColor,rx:8,ry:8,...Rt}),e.map(o=>{if(!o.gridVisible)return null;const a=o.position==="bottom"||o.position==="top";return r.jsx("g",{children:o.ticks.map((s,l)=>{if(s.position<=0||s.position>=1)return null;const c=a?s.position:1-s.position,d=u.toPercent(c),h=a?{x1:d,y1:0,x2:d,y2:"100%"}:{x1:0,y1:d,x2:"100%",y2:d};return r.jsx("line",{...h,...Rt,stroke:i.gridLineColor},l)})},o.scaleAestheticKey)})]}),Dt=({panelRect:e,zOrder:t})=>{const o=w(a=>a.annotations.shapes).filter(a=>a.zOrder===t);return o.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:o.map(({id:a,x:s,y:l,width:c,height:d,fillColor:h,fillOpacity:f,strokeWidth:p,strokeColor:m})=>r.jsx("rect",{x:u.toPercent(s),y:u.toPercent(l),width:u.toPercent(c),height:u.toPercent(d),fill:h,fillOpacity:f,stroke:p>0?m??i.defaultAnnotationShapeStroke:"none",strokeWidth:p},a))})};var Ed="_120wioc0";const _d=({panelRect:e})=>{const t=w(n=>n.annotations.textAnnotations);return t.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(n=>r.jsx("foreignObject",{x:u.toPercent(n.x),y:u.toPercent(n.y),width:u.toPercent(n.width),height:u.toPercent(1-n.y),overflow:"visible",children:r.jsx("div",{className:Ed,style:Md(n.backgroundColor,n.backgroundColorStyle),children:r.jsx(Ce,{content:n.content})})},n.id))})},Md=(e,t)=>e===null||e==="transparent"?{color:i.textPrimary}:t==="fade"?{color:i.textPrimary,backgroundColor:Ve(e,i.grey100,.5),boxShadow:`0 0 0 1.5px ${Ve(e,i.grey0,.2)}`}:{color:i.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${Ee(e,.1)}`};var Fd="usd3ea0",Hd="usd3ea1";const Bd=({layer:e,coordSystem:t,isAnimated:n,isDimmed:o,highlightStyle:a,formattingLocale:s})=>{const l=Me(e,t);return l===null?r.jsxs("text",{children:[e.geom," not implemented"]}):r.jsx("g",{className:F({[Hd]:o&&a==="desaturate",[Fd]:o&&a==="dim"}),children:l.render({layer:e,coordSystem:t,isAnimated:n,formattingLocale:s})})};function Id({plugin:e,layer:t,coordSystem:n,candidates:o}){if(e?.getOverlayAnchor===void 0||o.length===0)return[];const a=[];for(const{observation:s,observationIndex:l}of o){const c=e.getOverlayAnchor({layer:t,coordSystem:n,observation:s});c!==null&&a.push({observation:s,observationIndex:l,anchor:c})}return a}const Nd=4,Rd=({plugin:e,layer:t,matchedLayer:n,overlayCandidates:o,coordSystem:a,isAnimated:s,panelRect:l,formattingLocale:c})=>{const{numberFormat:d,textScale:h}=w(G.useShallow(v=>({numberFormat:v.config.numberFormat,textScale:v.config.appearance.textScale}))),f=g.useMemo(()=>Id({plugin:e,layer:t,coordSystem:a,candidates:o}),[e,t,a,o]),p=g.useMemo(()=>u.createSegmentYReader(t),[t]),m=g.useMemo(()=>u.buildLayerYValueFormatter({layer:t,numberFormat:d,locale:c}),[d,t,c]),x=Tr*Hn*h;return e===null||n===null&&f.length===0?null:r.jsxs(r.Fragment,{children:[n?e.render({layer:n,coordSystem:a,isAnimated:s,formattingLocale:c}):null,f.map(({observation:v,observationIndex:b,anchor:S})=>r.jsx(Dd,{observation:v,anchor:S,panelRect:l,readSegmentY:p,formatYValue:m,labelFontSizePx:x},Od(v,b)))]})},Dd=({observation:e,anchor:t,panelRect:n,readSegmentY:o,formatYValue:a,labelFontSizePx:s})=>{const l=Q(),c=u.toViewBoxX(t.x),d=u.toViewBoxY(t.y),h=(u.getSize(e)??mr)/2,f=o(e),p=u.isDefined(f)?a(f,e):null,m=g.useMemo(()=>{if(p===null)return null;const x=l.measureText(p,{family:Ze,size:s,weight:wr});return{width:x.width+Ar*2,height:x.height+Pr*2}},[p,l,s]);return r.jsxs(r.Fragment,{children:[r.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:u.toPercent(c),cy:u.toPercent(d),r:h,fill:u.getColor(e)}),p!==null&&m!==null&&r.jsx(Er,{x:c*n.width,y:d*n.height-h-Nd-m.height/2,width:m.width,height:m.height,text:p,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},Od=(e,t)=>{const n=e[u.GROUP_VARIABLES.group];return`${String(n??"")}\0${t}`},Gd=({layer:e,coordSystem:t,panelRect:n})=>{const{primary:o,group:a,related:s}=Pe(G.useShallow(d=>({primary:d.hover.primary,group:d.hover.group,related:d.hover.related})));if(o===null)return null;const l=Me(e,t);if(l===null)return null;const c=s.get(e.id)??[];return o.layerId===e.id?l.renderHover({layer:e,coordSystem:t,primary:o,group:a,related:c,panelRect:n}):c.length===0?null:l.renderHoverCompanions({layer:e,primary:o,related:c})};var zd="to1jkx0",Wd="to1jkx1";const $d=({shouldAnimate:e,panelRect:t,formattingLocale:n})=>{const{layers:o,coordSystem:a,highlightStyle:s}=w(G.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem,highlightStyle:l.config.appearance.highlightStyle})));return r.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:zd,"data-testid":"geom-layers",children:o.map(l=>r.jsxs(g.Fragment,{children:[r.jsx(Vd,{layer:l,coordSystem:a,highlightStyle:s,shouldAnimate:e,panelRect:t,formattingLocale:n}),r.jsx(Gd,{layer:l,coordSystem:a,panelRect:t})]},`${l.id}-${Xd(a)}`))})},Xd=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,qd=e=>{if(e.geom!=="rule")return Wd},Vd=({layer:e,coordSystem:t,highlightStyle:n,shouldAnimate:o,panelRect:a,formattingLocale:s})=>{const l=g.useMemo(()=>Me(e,t),[e,t]),c=e.highlight;return r.jsxs("g",{className:qd(e),children:[r.jsx(Bd,{layer:e,coordSystem:t,isAnimated:o,isDimmed:c?.composition.isDimmed??!1,highlightStyle:n,formattingLocale:s}),c!==null&&r.jsx(Rd,{plugin:l,layer:e,matchedLayer:c.composition.matchedLayer,overlayCandidates:c.composition.overlayCandidates,coordSystem:t,isAnimated:o,panelRect:a,formattingLocale:s})]})};var Ud="_17uhij30";const Yd=({formattedAxes:e,panelGuide:t,plotRect:n,panelRect:o,axisRects:a,axisLabelRects:s,shouldAnimate:l,formattingLocale:c})=>{const d=g.useRef(null);Qc(d);const h=U("Grid",_r),f=U("AxisTicks",Ad),p=U("AxisLabel",Pd),m=g.useMemo(()=>Mr(o,n),[o,n]),x=g.useMemo(()=>Ot(a,n),[a,n]),v=g.useMemo(()=>Ot(s,n),[s,n]);return r.jsxs("svg",{ref:d,className:Ud,width:n.width,height:n.height,style:{transform:`translate(${n.x}px, ${n.y}px)`},"data-testid":"plot",children:[r.jsx(h,{axes:e,panel:t,panelRect:m}),r.jsx(Xc,{panelRect:m}),r.jsx(f,{formattedAxes:e,tickRects:x}),r.jsx(p,{formattedAxes:e,labelRects:v}),r.jsx(Dt,{panelRect:m,zOrder:"background"}),r.jsx($d,{shouldAnimate:l,panelRect:m,formattingLocale:c}),r.jsx(dd,{panelRect:m,formattingLocale:c}),r.jsx(gd,{panelRect:m,formattingLocale:c}),r.jsx(Dt,{panelRect:m,zOrder:"foreground"}),r.jsx(bd,{panelRect:m}),r.jsx(_d,{panelRect:m}),r.jsx(Zc,{panelRect:m})]})},Mr=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),Ot=(e,t)=>{const n={};for(const[o,a]of Object.entries(e))n[o]=Mr(a,t);return n},Kd={width:0,height:0,isDefault:!0},Fr=({debounce:e=0,onResize:t}={})=>{const[n,o]=g.useReducer((d,h)=>d.width===h.width&&d.height===h.height?d:h,Kd),a=nr(d=>{t?.(d),o(d)},e),s=g.useRef(null),l=g.useRef(null),c=g.useCallback(d=>{!d||s.current===d||(l.current??=new ResizeObserver(([h])=>{if(!h)return;const f=Math.round(h.contentBoxSize[0]?.inlineSize??h.contentRect.width),p=Math.round(h.contentBoxSize[0]?.blockSize??h.contentRect.height);a.run({width:f,height:p,isDefault:!1})}),s.current&&l.current.unobserve(s.current),s.current=d,l.current.observe(d))},[a]);return{...n,setElement:c}},Hr=e=>{let t,n;return"aspectRatio"in e?"intrinsicWidth"in e?(t=e.intrinsicWidth,n=t/e.aspectRatio):(n=e.intrinsicHeight,t=n*e.aspectRatio):(t=e.intrinsicWidth,n=e.intrinsicHeight),{width:t,height:n}},Jd=(e,t)=>{const n=Fr({onResize:t});return g.useMemo(()=>{if(e.mode!=="keepAspectRatio")return{setContainer:n.setElement,canRender:!1,outerStyles:{},innerStyles:{}};const o=Hr(e),a=n.width>0&&o.width>0?n.width/o.width:1;return{setContainer:n.setElement,canRender:!n.isDefault,outerStyles:{width:"100%",...n.isDefault?{aspectRatio:`${o.width} / ${o.height}`}:{height:o.height*a}},innerStyles:{transformOrigin:"top left",transform:`scale(${a})`,width:o.width,height:o.height}}},[e,n.width,n.setElement,n.isDefault])},Zd=({sizing:e,onResize:t,children:n})=>{const o=Fr({onResize:t}),a=Jd(e,t);if(e.mode==="keepAspectRatio")return r.jsx("div",{ref:a.setContainer,style:a.outerStyles,"data-testid":"graph-sizer",children:a.canRender&&r.jsx("div",{style:a.innerStyles,children:n(Hr(e))})});if(e.mode==="fixed")return r.jsx("div",{ref:o.setElement,style:{width:e.width,height:e.height},"data-testid":"graph-sizer",children:n({width:e.width,height:e.height})});const s=!o.isDefault&&o.width>0&&o.height>0;return r.jsx("div",{ref:o.setElement,style:{width:"100%",height:"100%"},"data-testid":"graph-sizer",children:s&&n({width:o.width,height:o.height})})},Qd={mode:"responsive"},$e={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},eu=()=>{const[e,t]=g.useState(null),[n,o]=g.useState(null),[a,s]=g.useState($e);return g.useEffect(()=>{const l=()=>{const d=e?{width:e.offsetWidth,height:e.offsetHeight}:$e.headerSize,h=n?{width:n.offsetWidth,height:n.offsetHeight}:$e.footerSize;s(f=>tu(f,{headerSize:d,footerSize:h})?{headerSize:d,footerSize:h}:f)};l();const c=new ResizeObserver(l);return e&&c.observe(e),n&&c.observe(n),()=>c.disconnect()},[e,n]),{headerRef:t,footerRef:o,measurements:a}},tu=(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,nu=({appearance:e,isEditable:t,style:n,children:o})=>{const{theme:a,themeClass:s,inlineVarsStyle:l}=st(),c=Ga(e.border),d=Math.max(0,e.cornerRadius),h=d===0?0:d+c,f=g.useMemo(()=>{const x={...n,borderRadius:`${h}px`,...l},v=Oa(e.border,a);return v!==null&&(x.background=v),x},[n,h,l,e.border,a]),p=g.useMemo(()=>({inset:`${c}px`,borderRadius:`${d}px`}),[c,d]),m=t&&e.background.type==="solid"&&e.background.color==="transparent";return r.jsx("div",{"data-testid":"graph-wrapper",className:F(Xa,s),style:f,children:r.jsx("div",{"data-testid":"graph-inner",className:F(Va,{[Ua]:m}),style:p,children:o})})},ru=({slots:e,sizing:t=Qd,onResize:n,...o})=>{const{formattingLocale:a}=se(),s=w(l=>l.config.parsingLocale);return r.jsx(Qt,{children:r.jsx(fr,{children:r.jsx($.IntlProvider,{locale:a??s,children:r.jsx(Ho,{slots:e,children:r.jsx(Zd,{sizing:t,onResize:n,children:({width:l,height:c})=>r.jsx(ou,{width:l,height:c,...o})})})})})})},ou=({width:e,height:t,isAnimated:n,showTooltips:o=!0,mode:a="readonly"})=>{const s=$.useI18n(),{axes:l,panel:c,legends:d,numberFormat:h,parsingLocale:f,appearance:p,annotations:m,coordSystem:x,headline:v,headlineConfig:b,content:S}=w(G.useShallow(R=>({axes:R.guides.axes,panel:R.guides.panel,legends:R.guides.legends,numberFormat:R.config.numberFormat,parsingLocale:R.config.parsingLocale,appearance:R.config.appearance,annotations:R.annotations,coordSystem:R.coordSystem,headline:R.guides.headline,headlineConfig:R.config.headline,content:R.config.content}))),j=T.useReducedMotion(),{headerRef:k,footerRef:_,measurements:L}=eu(),{formattingLocale:z,theme:Fe,themeOverrides:He}=se(),le=g.useMemo(()=>_n(Fe,He),[Fe,He]),Br=U("Header",lr),Ir=U("Footer",ir),Nr=U("Legend",Dl),Rr=U("Headline",Vi),dt=g.useMemo(()=>u.formatLegends({legends:d,numberFormat:h,parsingLocale:f,formattingLocale:z}),[d,h,f,z]),ce=g.useMemo(()=>u.formatHeadline({headline:v,show:b.show,numberFormat:h,parsingLocale:f,formattingLocale:z,t:s}),[v,b.show,h,f,z,s]),Dr=Q(),Be=p.border.type==="none"?0:p.border.width,Ie=g.useMemo(()=>({width:Math.max(0,e-2*Be),height:Math.max(0,t-2*Be)}),[e,t,Be]),me=g.useMemo(()=>ce?{formatted:ce,size:b.size,position:b.position,innerRadius:x.type==="polar"?x.innerRadius:0}:void 0,[ce,b.size,b.position,x]),Or=Bo(),xe=_a(Dr,p.textScale,le,Or),de=Ma({measurer:xe,axes:l,numberFormat:h,parsingLocale:f,formattedLegends:dt,containerSize:Ie,externalMeasurements:L,headline:me,formattingLocale:z,annotations:m,coordSystem:x,textScale:p.textScale,graphPadding:le.graphPadding}),ve=g.useMemo(()=>!de||!me||!xe?null:u.resolveHeadlinePlacement({headline:me,layout:de.layout,containerSize:Ie,measurer:xe,itemGap:le.headlineItemGap}),[de,me,Ie,xe,le.headlineItemGap]);if(!de)return null;const{layout:K,formattedAxes:Gr}=de;return r.jsx(zn,{theme:Fe,themeOverrides:He,appearance:p,children:r.jsx(ya,{metrics:le,children:r.jsxs(nu,{appearance:p,isEditable:a==="editable",style:{width:"100%",height:"100%"},children:[r.jsx(Br,{ref:k,headerRect:K.header,mode:a,title:S.title,isTitleVisible:S.isTitleVisible,subtitle:S.subtitle,isSubtitleVisible:S.isSubtitleVisible}),r.jsx(Yd,{formattedAxes:Gr,panelGuide:c,plotRect:K.plot,panelRect:K.panel,axisRects:K.axes,axisLabelRects:K.axisLabels,shouldAnimate:n??!j,formattingLocale:z??f}),r.jsx(Ir,{ref:_,footerRect:K.footer,mode:a,caption:S.caption,isCaptionVisible:S.isCaptionVisible,source:S.source,isSourceVisible:S.isSourceVisible}),r.jsx(Nr,{formattedLegends:dt,rects:K.legends,textScale:p.textScale}),ce&&ve&&r.jsx(Rr,{headline:ce,rect:ve.rect,resolvedSize:ve.resolvedSize,visibleItemCount:ve.visibleItemCount}),o&&r.jsx(Ko,{})]})})})};exports.CanvasTextMeasurer=_e;exports.DefaultFooter=ir;exports.DefaultGrid=_r;exports.DefaultHeader=lr;exports.DefaultTooltip=tn;exports.DevToolsPanel=So;exports.GraphProvider=no;exports.GraphRenderer=ru;exports.HoverProvider=Qt;exports.TextMeasurerProvider=fr;exports.ThemeProvider=zn;exports.darkTheme=Gn;exports.lightTheme=On;exports.useCompiledSelector=w;exports.useGraphCommandDispatcher=tt;exports.useHoverState=Pe;exports.useTextMeasurer=Q;exports.vars=i;