@graphysdk/react-renderer 0.0.1-experimental.3 → 0.0.1-experimental.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
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"),f=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"),Ir=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"),Nr=require("@tiptap/extension-paragraph"),et=require("@tiptap/react"),w=require("@base-ui/react/toolbar"),te=require("@base-ui/react/tooltip"),Rr=require("react-dom"),Dr=require("@vanilla-extract/dynamic"),A=require("@base-ui/react/popover"),ut=require("react-colorful"),H=require("@base-ui/react/menu"),Or=require("@base-ui/react/toggle"),Gr=require("d3-interpolate-path"),qe=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-experimental.3");const zr=5,Wr=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>Xr,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()}},$r=()=>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:qr(t),stages:n.stages,durationMs:n.durationMs};return{lastCompile:a,history:Vr(o.history,a,zr),nextId:o.nextId+1,lastSnapshot:n}})})),Xr=()=>{},qr=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}},Vr=(e,t,n)=>{const o=e.length>=n?e.length-(n-1):0;return[...e.slice(o),t]},Yr=e=>Qe.createStore(t=>({compiled:e,setCompiled:n=>t(o=>o.compiled===n?o:{compiled:n})}));function Ur(e,t){const n=u.isGraphConfig(e)?e.themeOverrides:void 0;return f.useMemo(()=>({...t,...n}),[t,n])}const Yt=f.createContext(null),Kr=({data:e,input:t,formattingLocale:n,onChange:o,customPalettes:a,theme:s="light",themeOverrides:c,children:l})=>{const[d]=f.useState(()=>u.createCompiler()),[h]=f.useState(()=>Wr(d)),g=Ur(t,c),p=f.useMemo(()=>({customPalettes:a,theme:s}),[a,s]),[m]=f.useState(()=>{const S=d.compile({input:t,data:e,ctx:p});return h.emit({kind:"init"}),Yr(S)}),x=f.useRef({input:t,data:e,ctx:p});f.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=f.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=f.useMemo(()=>({store:m,dispatch:v,formattingLocale:n,compileBus:h,theme:s,themeOverrides:g}),[m,v,n,h,s,g]);return r.jsx(Yt.Provider,{value:b,children:l})},se=()=>{const e=f.useContext(Yt);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 Jr="drqe3u0",Zr="drqe3u1",Qr="drqe3u2",eo="drqe3u3",ye="drqe3u4",to="drqe3u5",no="drqe3u6",ro="drqe3u7",Ne="drqe3u8",oo="drqe3u9",ao="drqe3ua",so="drqe3ub",io="drqe3uc",lo="drqe3ud",co="drqe3ue",uo="drqe3uf",ho="drqe3ug",go="drqe3uh",fo="drqe3ui",ht={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},gt={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},Ut={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const po=({width:e=380,style:t,className:n}={})=>{const{compileBus:o}=se(),[a]=f.useState(()=>$r()),[s,c]=f.useState(!1),[l,d]=f.useState(u.isCompilerCachingEnabled);f.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),g=fe.useStore(a,v=>v.history),p=o.getCacheStats(),m=h===null&&g.length===0,x=()=>{d(v=>{const b=!v;return u.setCompilerCachingEnabled(b),b})};return r.jsxs("div",{className:F(ao,n),style:{width:e,...t},children:[r.jsxs("div",{className:Jr,children:[r.jsxs("div",{children:[r.jsx("div",{className:Zr,children:"compile cache"}),r.jsx("div",{className:co,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:uo,children:s?"▾":"▴"})]}),!s&&r.jsxs("div",{className:so,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:ho,children:"next compile reflects this toggle"})]}),!s&&!m&&r.jsxs(r.Fragment,{children:[r.jsx(mo,{delta:h?.stages,cumulative:p}),r.jsx(xo,{entries:g})]})]})},mo=({delta:e,cumulative:t})=>r.jsxs("table",{className:Qr,children:[r.jsx("thead",{children:r.jsxs("tr",{className:go,children:[r.jsx("th",{className:eo,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=vo(o);return r.jsxs("tr",{className:io,children:[r.jsxs("td",{className:to,children:[r.jsx("span",{className:Ut[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)})})]}),xo=({entries:e})=>e.length===0?null:r.jsxs("div",{className:lo,children:[r.jsx("div",{className:fo,children:"recent compiles"}),e.map(t=>{const n=yo(t.stages,s=>s.misses>0),o=u.COMPILER_STAGE_KEYS.length,a=n===0?"cached":"ran";return r.jsxs("div",{className:no,children:[r.jsx("span",{className:Ut[a],"aria-hidden":!0}),r.jsx("span",{className:ro,title:t.label,children:t.label}),r.jsxs("span",{className:oo,children:[n,"/",o," ran · ",Kt(t.durationMs)]})]},t.id)})]}),vo=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",yo=(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`,bo=()=>Qe.createStore(e=>({hover:u.RESTING_HOVER_STATE,setHoverState:t=>e(n=>n.hover===t?n:{hover:t})})),So=(e,t)=>{const n=f.useMemo(()=>({layers:e,coordSystem:t}),[e,t]),o=f.useRef(null);o.current===null&&(o.current=new u.HoverEngine(n));const a=o.current,s=f.useRef(!1);return f.useEffect(()=>{if(!s.current){s.current=!0;return}a.update(n)},[a,n]),a},Jt=f.createContext(null),Zt=({children:e})=>{const{layers:t,coordSystem:n}=P(W.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem}))),o=So(t,n),[a]=f.useState(()=>bo()),s=f.useRef(null),c=f.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=f.useContext(Jt);if(e===null)throw new Error("useHoverContext must be used inside a <HoverProvider>.");return e};var jo="_2qyyu60";const ft=2,ko=12,Lo=12,pt=1,mt=2,Co=4,Ae=({shape:e,color:t,lineType:n="solid",width:o=ko,height:a=Lo})=>r.jsx("svg",{className:jo,width:o,height:a,viewBox:`0 0 ${o} ${a}`,"aria-hidden":!0,"data-testid":"chart-swatch","data-shape":e,children:To({shape:e,color:t,lineType:n,width:o,height:a})}),To=({shape:e,color:t,lineType:n,width:o,height:a})=>{const s=wo(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})}},wo=(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/(Co-1);return{x1:0,x2:t,dashArray:`1 ${n}`,linecap:"round"}},Qt=Object.freeze({}),nt=f.createContext(Qt),Ao=({slots:e,children:t})=>r.jsx(nt.Provider,{value:e??Qt,children:t});function Y(e,t){const n=f.useContext(nt)[e];return n===void 0?t:typeof n=="object"&&Eo(n)?n.render:n}function Po(){const e=f.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 Eo(e){return"render"in e&&typeof e.render=="function"}function Pe(e){const{store:t}=we();return fe.useStore(t,e)}var _o="_19519k80",Mo="_19519k81",Fo="_19519k82",Ho="_19519k83",Bo="_19519k85",Io="_19519k86",No="_19519k87",Ro="_19519k88",Do="_19519k89";const Oo=e=>{const{overlayRef:t}=we(),n=f.useRef(null),[o,a]=f.useState(!1),s=f.useRef(e);return s.current=e,f.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}},Go=16,zo=8,Wo={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},$o=()=>{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=Y("Tooltip",en),a=f.useRef(()=>{}),{cursorRef:s,isInside:c}=Oo(()=>a.current()),l=f.useMemo(()=>u.buildTooltipContent({...e,hover:n,formattingLocale:t}),[e,n,t]),d=l!==null&&c,h=f.useMemo(()=>({getBoundingClientRect:()=>{const x=s.current;return x===null?Wo:Xo(x)}}),[s]),{refs:g,floatingStyles:p,update:m}=M.useFloating({open:d,placement:"right",middleware:[M.offset(Go),M.flip(),M.shift({padding:zo})],elements:{reference:h}});return a.current=m,d?r.jsx("div",{ref:g.setFloating,role:"tooltip",className:Ro,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:Do,children:[e.header!==null&&r.jsx("div",{className:_o,children:e.header}),r.jsx("div",{className:Mo,children:e.rows.map(n=>r.jsx(qo,{row:n,shouldHighlight:n.isPrimary&&e.rows.length>1},n.key))})]}):null,Xo=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),qo=({row:e,shouldHighlight:t})=>r.jsxs("div",{className:F(Fo,{[Ho]:t}),"data-testid":"chart-tooltip-row",children:[e.swatchColor===null?r.jsx("span",{className:Bo,"aria-hidden":!0}):r.jsx(Ae,{shape:e.swatchShape,color:e.swatchColor,lineType:e.swatchLineType}),r.jsx("span",{className:Io,children:e.label}),r.jsx("span",{className:No,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',
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),F=require("clsx"),f=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"),Ir=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"),Nr=require("@tiptap/extension-paragraph"),et=require("@tiptap/react"),w=require("@base-ui/react/toolbar"),te=require("@base-ui/react/tooltip"),Rr=require("react-dom"),Dr=require("@vanilla-extract/dynamic"),A=require("@base-ui/react/popover"),ut=require("react-colorful"),H=require("@base-ui/react/menu"),Or=require("@base-ui/react/toggle"),Gr=require("d3-interpolate-path"),qe=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-experimental.4");const zr=5,Wr=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>Xr,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()}},$r=()=>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:qr(t),stages:n.stages,durationMs:n.durationMs};return{lastCompile:a,history:Vr(o.history,a,zr),nextId:o.nextId+1,lastSnapshot:n}})})),Xr=()=>{},qr=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}},Vr=(e,t,n)=>{const o=e.length>=n?e.length-(n-1):0;return[...e.slice(o),t]},Yr=e=>Qe.createStore(t=>({compiled:e,setCompiled:n=>t(o=>o.compiled===n?o:{compiled:n})}));function Ur(e,t){const n=u.isGraphConfig(e)?e.themeOverrides:void 0;return f.useMemo(()=>({...t,...n}),[t,n])}const Yt=f.createContext(null),Kr=({data:e,input:t,formattingLocale:n,onChange:o,customPalettes:a,theme:s="light",themeOverrides:c,children:l})=>{const[d]=f.useState(()=>u.createCompiler()),[h]=f.useState(()=>Wr(d)),g=Ur(t,c),p=f.useMemo(()=>({customPalettes:a,theme:s}),[a,s]),[m]=f.useState(()=>{const S=d.compile({input:t,data:e,ctx:p});return h.emit({kind:"init"}),Yr(S)}),x=f.useRef({input:t,data:e,ctx:p});f.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=f.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=f.useMemo(()=>({store:m,dispatch:v,formattingLocale:n,compileBus:h,theme:s,themeOverrides:g}),[m,v,n,h,s,g]);return r.jsx(Yt.Provider,{value:b,children:l})},se=()=>{const e=f.useContext(Yt);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 Jr="drqe3u0",Zr="drqe3u1",Qr="drqe3u2",eo="drqe3u3",ye="drqe3u4",to="drqe3u5",no="drqe3u6",ro="drqe3u7",Ne="drqe3u8",oo="drqe3u9",ao="drqe3ua",so="drqe3ub",io="drqe3uc",lo="drqe3ud",co="drqe3ue",uo="drqe3uf",ho="drqe3ug",go="drqe3uh",fo="drqe3ui",ht={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},gt={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},Ut={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const po=({width:e=380,style:t,className:n}={})=>{const{compileBus:o}=se(),[a]=f.useState(()=>$r()),[s,c]=f.useState(!1),[l,d]=f.useState(u.isCompilerCachingEnabled);f.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),g=fe.useStore(a,v=>v.history),p=o.getCacheStats(),m=h===null&&g.length===0,x=()=>{d(v=>{const b=!v;return u.setCompilerCachingEnabled(b),b})};return r.jsxs("div",{className:F(ao,n),style:{width:e,...t},children:[r.jsxs("div",{className:Jr,children:[r.jsxs("div",{children:[r.jsx("div",{className:Zr,children:"compile cache"}),r.jsx("div",{className:co,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:uo,children:s?"▾":"▴"})]}),!s&&r.jsxs("div",{className:so,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:ho,children:"next compile reflects this toggle"})]}),!s&&!m&&r.jsxs(r.Fragment,{children:[r.jsx(mo,{delta:h?.stages,cumulative:p}),r.jsx(xo,{entries:g})]})]})},mo=({delta:e,cumulative:t})=>r.jsxs("table",{className:Qr,children:[r.jsx("thead",{children:r.jsxs("tr",{className:go,children:[r.jsx("th",{className:eo,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=vo(o);return r.jsxs("tr",{className:io,children:[r.jsxs("td",{className:to,children:[r.jsx("span",{className:Ut[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)})})]}),xo=({entries:e})=>e.length===0?null:r.jsxs("div",{className:lo,children:[r.jsx("div",{className:fo,children:"recent compiles"}),e.map(t=>{const n=yo(t.stages,s=>s.misses>0),o=u.COMPILER_STAGE_KEYS.length,a=n===0?"cached":"ran";return r.jsxs("div",{className:no,children:[r.jsx("span",{className:Ut[a],"aria-hidden":!0}),r.jsx("span",{className:ro,title:t.label,children:t.label}),r.jsxs("span",{className:oo,children:[n,"/",o," ran · ",Kt(t.durationMs)]})]},t.id)})]}),vo=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",yo=(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`,bo=()=>Qe.createStore(e=>({hover:u.RESTING_HOVER_STATE,setHoverState:t=>e(n=>n.hover===t?n:{hover:t})})),So=(e,t)=>{const n=f.useMemo(()=>({layers:e,coordSystem:t}),[e,t]),o=f.useRef(null);o.current===null&&(o.current=new u.HoverEngine(n));const a=o.current,s=f.useRef(!1);return f.useEffect(()=>{if(!s.current){s.current=!0;return}a.update(n)},[a,n]),a},Jt=f.createContext(null),Zt=({children:e})=>{const{layers:t,coordSystem:n}=P(W.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem}))),o=So(t,n),[a]=f.useState(()=>bo()),s=f.useRef(null),c=f.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=f.useContext(Jt);if(e===null)throw new Error("useHoverContext must be used inside a <HoverProvider>.");return e};var jo="_2qyyu60";const ft=2,ko=12,Lo=12,pt=1,mt=2,Co=4,Ae=({shape:e,color:t,lineType:n="solid",width:o=ko,height:a=Lo})=>r.jsx("svg",{className:jo,width:o,height:a,viewBox:`0 0 ${o} ${a}`,"aria-hidden":!0,"data-testid":"chart-swatch","data-shape":e,children:To({shape:e,color:t,lineType:n,width:o,height:a})}),To=({shape:e,color:t,lineType:n,width:o,height:a})=>{const s=wo(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})}},wo=(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/(Co-1);return{x1:0,x2:t,dashArray:`1 ${n}`,linecap:"round"}},Qt=Object.freeze({}),nt=f.createContext(Qt),Ao=({slots:e,children:t})=>r.jsx(nt.Provider,{value:e??Qt,children:t});function Y(e,t){const n=f.useContext(nt)[e];return n===void 0?t:typeof n=="object"&&Eo(n)?n.render:n}function Po(){const e=f.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 Eo(e){return"render"in e&&typeof e.render=="function"}function Pe(e){const{store:t}=we();return fe.useStore(t,e)}var _o="_19519k80",Mo="_19519k81",Fo="_19519k82",Ho="_19519k83",Bo="_19519k85",Io="_19519k86",No="_19519k87",Ro="_19519k88",Do="_19519k89";const Oo=e=>{const{overlayRef:t}=we(),n=f.useRef(null),[o,a]=f.useState(!1),s=f.useRef(e);return s.current=e,f.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}},Go=16,zo=8,Wo={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},$o=()=>{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=Y("Tooltip",en),a=f.useRef(()=>{}),{cursorRef:s,isInside:c}=Oo(()=>a.current()),l=f.useMemo(()=>u.buildTooltipContent({...e,hover:n,formattingLocale:t}),[e,n,t]),d=l!==null&&c,h=f.useMemo(()=>({getBoundingClientRect:()=>{const x=s.current;return x===null?Wo:Xo(x)}}),[s]),{refs:g,floatingStyles:p,update:m}=M.useFloating({open:d,placement:"right",middleware:[M.offset(Go),M.flip(),M.shift({padding:zo})],elements:{reference:h}});return a.current=m,d?r.jsx("div",{ref:g.setFloating,role:"tooltip",className:Ro,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:Do,children:[e.header!==null&&r.jsx("div",{className:_o,children:e.header}),r.jsx("div",{className:Mo,children:e.rows.map(n=>r.jsx(qo,{row:n,shouldHighlight:n.isPrimary&&e.rows.length>1},n.key))})]}):null,Xo=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),qo=({row:e,shouldHighlight:t})=>r.jsxs("div",{className:F(Fo,{[Ho]:t}),"data-testid":"chart-tooltip-row",children:[e.swatchColor===null?r.jsx("span",{className:Bo,"aria-hidden":!0}):r.jsx(Ae,{shape:e.swatchShape,color:e.swatchColor,lineType:e.swatchLineType}),r.jsx("span",{className:Io,children:e.label}),r.jsx("span",{className:No,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
3
|
'Cantarell', 'Helvetica Neue', 'NotoSansArabic', 'NotoSansJP', 'NotoSansSC', 'NotoSansKR', 'NotoSerifKR', sans-serif, 'Apple Color Emoji', 'NotoColorEmoji'`,Vo=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},Yo=`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:Vo,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=Yo)=>`${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)},Uo={small:1.9,medium:2.3,large:2.6},Ko={small:1,medium:1,large:1.2},Jo=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,Zo=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}%)`,Qo=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),ea=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"},ta=8,ee=e=>`${ta*e}px`,An={spaceXxs:ee(.25),spaceXs:ee(.5),spaceSm:ee(.75),spaceMd:ee(1),spaceLg:ee(1.5),spaceXl:ee(2)},na={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)"},ra={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},oa={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},aa={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},sa={...na,...ra,...Cn,...Tn,...An,...wn,...oa,...aa,...Ln,...nn,...rn,...on},ia={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)"},la={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},ca={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"},da={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},ua={...ia,...la,...Cn,...Tn,...An,...wn,...ca,...da,...Ln,...nn,...rn,...on},Pn=(e,t={})=>({...e==="dark"?sa:ua,...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)}},ha=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=f.createContext(ha),ga=({metrics:e,children:t})=>r.jsx(_n.Provider,{value:e,children:t}),rt=()=>f.useContext(_n),ot=E.sm,Mn=N,Fn=10,U=(e,t)=>e*Fn*t,fa=(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:U(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),pa=e=>()=>U(ot,e),ma=(e,t)=>(n,o)=>{const{labelLineHeight:a,labelFontWeight:s}=u.getDifferenceArrowDimensions(o,t);return e.measureText(n,{family:N,size:a,weight:s})},xa=(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))}},va=(e,t,n)=>(o,a)=>Hn(o,a,e,t,n.headlineRowGap).map(s=>s.width),ya=(e,t)=>(n,o)=>{const a=Ye("value",o,t);return{width:e.measureText(n,a).width,height:a.size*an}},ba=(e,t,n)=>{const o=xa(e,t,n),a=ya(e,t);return(s,c)=>s.kind==="perGroup"?o(s,c):a(s.value,c)},Hn=(e,t,n,o,a)=>{const s={value:Ye("value",t,o),label:Ye("label",t,o)},c=l=>Sa(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(g=>g.width)),height:Bn(d.map(g=>g.height))+h}})},Sa=(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}},Ye=(e,t,n)=>{const o=e==="value"?Uo[t]:Ko[t];return{family:Jo,size:U(o,n)}},Bn=e=>e.reduce((t,n)=>t+n,0),In=e=>{const t=U(vn,e);return{fontSizePx:t,lineBoxHeight:t*yn}},Nn=(e,t)=>e?t:0,ja=(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 g=e.measureText(h.formattedLabel,c).width,p=Nn(h.visual.color,n.legendSwatchWidth);return p+(p>0?n.legendSwatchGap:0)+g});return Math.max(...d)+n.legendPillHorizontalChrome},ka=(e,t)=>n=>e.measureText(n,{family:Mn,size:U(ot,t)}),La=Object.freeze({}),Ca=(e,t,n,o=La)=>{const a=f.useRef(o);return a.current=o,f.useMemo(()=>{if(!e)return null;const s=fa(e,t,n),c=pa(t),l=ja(e,t,n),d=ba(e,t,n),h=va(e,t,n),g={measureText:(p,m)=>e.measureText(p,m),textScale:t};return{measureAxis:p=>{if(wa(p))return 0;const m=a.current.measureAxis;return m?m(p,g):s(p)},measureAxisLabel:p=>{const m=a.current.measureAxisLabel;return m?m(p,g):c()},measureLegend:p=>{if(Aa(p))return 0;const m=a.current.measureLegend;return m?m(p,g):l(p)},measureHeadline:(p,m)=>(a.current.measureHeadline??d)(p,m),measureHeadlineItemWidths:(p,m)=>(a.current.measureHeadlineItemWidths??h)(p,m),measureTickLabel:ka(e,t),measureDifferenceArrowLabel:ma(e,t)}},[e,t,n])},Ta=({measurer:e,axes:t,numberFormat:n,parsingLocale:o,formattedLegends:a,containerSize:s,externalMeasurements:c,headline:l,formattingLocale:d,annotations:h,coordSystem:g,textScale:p,graphPadding:m})=>f.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:g,textScale:p,padding:m}):null,[t,n,o,a,s,c,l,d,h,g,p,m,e]),wa=e=>!e.isVisible||e.ticks.length===0,Aa=e=>e.items.length===0,vt="data-variant",Rn=Nr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(vt)??null,renderHTML:e=>e.variant?{[vt]:e.variant}:{}}}}}),Pa=Ir.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}}}}),Ea=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:n,isSubtitleVisible:o})=>[Ma({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,Pa.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:""}})],_a=({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:""})],Ma=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?Xe.Document.extend({content:"block{2,}"}):Xe.Document,Le=.1,Fa={light:.05,dark:.1},Ha=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return Na(e.color,t);case"gradient":return Ra(e.color,t);case"preset":return u.BORDER_PRESET_GRADIENTS[e.preset]}},Ba=e=>e.type==="none"?0:e.width,Ia=(e,t,n)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return Ve(n,e.color,Fa[t])},Na=(e,t)=>t==="dark"?Ee(e,Le):kn(e,Le),Ra=(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 Da="bow4tg0",Oa="bow4tg1",Ga="bow4tg2",za="bow4tg3",Dn="_1ii3bsb0",On="_1ii3bsb1";const at=f.createContext(null),st=()=>{const e=f.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=f.useMemo(()=>Pn(e,t),[e,t]),s=f.useMemo(()=>{const l={[i.textScale]:String(n.textScale)};for(const[h,g]of Object.entries(t))l[i[h]]=g;const d=Ia(n.background,e,a.graphBackground);return d!==void 0&&(l[i.graphBackground]=d),Dr.assignInlineVars(l)},[n.textScale,n.background,e,a.graphBackground,t]),c=f.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=f.useContext(at),a=o?F(o.themeClass,Oa):void 0,s=o?{...o.inlineVarsStyle,...n}:n;return r.jsx("div",{className:F(a,t),style:s,children:e})},Wa="graphy_root",Z=()=>typeof document>"u"?null:document.getElementById(Wa)??document.body;var $a="yp3g0k0",Xa="yp3g0k1",zn="yp3g0k3",qa="yp3g0k4",Wn="yp3g0k5",Ue="yp3g0k6",Va="yp3g0k7",Ya="yp3g0k8",$n="yp3g0k9",Ua="yp3g0ka",Ka="yp3g0kb",Ja="yp3g0kc",Za="yp3g0kd",Qa="yp3g0ke";const es=tn.map(e=>i[e]),ts=Object.fromEntries(tn.map(e=>[i[e],e])),ns=({editor:e,currentColor:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=os(),c=f.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:$a,onMouseDown:d=>d.preventDefault(),children:r.jsx("span",{className:Xa,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:qa,onMouseDown:d=>d.preventDefault(),children:[r.jsx(yt,{title:a("graph.colorDropdown.colors"),colors:es,currentColor:t,onPick:l}),s.length>0&&r.jsx(yt,{title:a("graph.colorDropdown.chartColors"),colors:s,currentColor:t,onPick:l}),r.jsx(rs,{value:t??"#000000",onChange:c})]})})})})]})},yt=({title:e,colors:t,currentColor:n,onPick:o})=>r.jsxs("div",{className:Wn,children:[r.jsx("div",{className:Ue,children:e}),r.jsx("div",{className:Va,children:t.map(a=>r.jsx("button",{type:"button","aria-label":a,className:Ya,"data-active":ss(a,n),onMouseDown:s=>s.preventDefault(),onClick:()=>o(a),children:r.jsx("span",{className:$n,style:Xn(a)})},a))})]}),rs=({value:e,onChange:t})=>{const n=$.useI18n(),[o,a]=f.useState(!1),s=ea(e)?e:"#000000",c=as(s);return r.jsxs(A.Popover.Root,{open:o,onOpenChange:a,children:[r.jsxs("div",{className:Wn,children:[r.jsx("div",{className:Ue,children:n("graph.colorDropdown.custom")}),r.jsxs(A.Popover.Trigger,{className:Ua,onMouseDown:l=>l.preventDefault(),"aria-label":n("graph.colorDropdown.pickCustom"),children:[r.jsx("span",{className:$n,style:Xn(s)}),r.jsx("span",{className:Ka,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:Ja,onMouseDown:l=>l.preventDefault(),children:[r.jsx("div",{className:Ue,children:n("graph.colorDropdown.pickColor")}),r.jsx(ut.HexColorPicker,{color:c,onChange:t,className:Za}),r.jsx(ut.HexColorInput,{color:c,onChange:t,prefixed:!0,className:Qa,onMouseDown:l=>l.stopPropagation()})]})})})})]})},os=()=>{const e=P(t=>t.scales.color);return f.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)}`}),as=e=>{const{themeValues:t}=st();if(Qo(e))return e.toUpperCase();const n=ts[e];return n?t[n].toUpperCase():"#000000"},ss=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),is={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var ls={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const V=({children:e,title:t,variant:n="primary",size:o="sm",...a})=>{const s=f.useId(),c=is[o];return r.jsxs("svg",{className:ls[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"})})}),cs="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Vn=`'Aeonik', 'Aeonik Fallback', ${N}`,ds="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",us="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",hs=`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:cs},{id:"technical",label:"Technical",preview:"00",fontFamily:ds},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:us},{id:"brand",label:"Brand",preview:"Aa",fontFamily:hs}],gs=e=>e?Ke.find(t=>t.fontFamily===e)??null:null;var Yn="_1qkyw7q0",Un="_1qkyw7q1",Kn="_1qkyw7q3",Jn="_1qkyw7q4",Zn="_1qkyw7q5";const fs=({editor:e,currentFontFamily:t,isOpen:n,onOpenChange:o})=>{const a=$.useI18n(),s=gs(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:Yn,onMouseDown:l=>l.preventDefault(),children:[r.jsx("span",{className:Un,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}],ps=({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:Yn,onMouseDown:c=>c.preventDefault(),children:[r.jsx("span",{className:Un,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:()=>ms(e,c.id),children:r.jsx(xs,{font:c.previewFont,children:a(c.translationKey)})},c.id))})})})})]})},ms=(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()}},xs=({font:e,children:t})=>r.jsx("span",{style:{font:e,margin:0},children:t}),vs=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"})})}),ys=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"})]})}),bs=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"})]})}),Ss=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),js=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 ks="b5kquu0",Ls="b5kquu1",Cs="b5kquu2",Ts="b5kquu3",jt="b5kquu4";const ws=({editor:e,currentUrl:t,isActive:n,isOpen:o,onOpenChange:a})=>{const s=$.useI18n(),[c,l]=f.useState(""),d=f.useRef(null);f.useEffect(()=>{o&&l(t??"")},[o,t]);const h=()=>{As(e,c),a(!1)},g=()=>{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:ks,onMouseDown:x=>x.preventDefault(),children:r.jsx(ys,{})}),r.jsx(A.Popover.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(A.Popover.Positioner,{sideOffset:6,align:"end",className:Ls,children:r.jsxs(A.Popover.Popup,{className:Cs,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:Ts,onMouseDown:x=>x.stopPropagation(),onChange:p,onKeyDown:m}),r.jsx("button",{type:"button","aria-label":s("common.cancel"),className:jt,onClick:g,children:r.jsx(bs,{})}),r.jsx("button",{type:"button","aria-label":s("graph.toolbar.link.apply"),className:jt,onClick:h,children:r.jsx(vs,{})})]})})})})]})},As=(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=js(e);e.chain().focus().setTextSelection(a).setLink({href:n}).run()},Ps=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"})]})}),Es=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"})]})}),_s=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 Ms="k91gos0",Fs="k91gos1";const Hs=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(Or.Toggle,{render:r.jsx(w.Toolbar.Button,{}),pressed:t,onPressedChange:()=>n()}),"aria-label":e,className:Ms,onMouseDown:a,children:o}),r.jsx(te.Tooltip.Portal,{container:Z(),children:r.jsx(J,{children:r.jsx(te.Tooltip.Positioner,{sideOffset:Hs,children:r.jsx(te.Tooltip.Popup,{className:Fs,children:e})})})})]})},Bs=({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(_s,{})}),r.jsx(re,{label:n("graph.toolbar.textAlign.center"),isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:r.jsx(Ps,{})}),r.jsx(re,{label:n("graph.toolbar.textAlign.right"),isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:r.jsx(Es,{})})]})};var Is="_1bp10ig0",ue="_1bp10ig1",Se="_1bp10ig2";const Ns=({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:Rs(e),textAlign:Ds(e)}),Rs=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",Ds=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",Os=8,Gs=8,zs=({editor:e})=>{const t=$.useI18n(),[n,o]=f.useState(!1),[a,s]=f.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(Os),M.flip(),M.shift({padding:Gs})],whileElementsMounted:M.autoUpdate}),g=f.useRef(null),p=et.useEditorState({editor:e,selector:Ns}),m=f.useCallback(v=>{g.current=v,d.setFloating(v)},[d]);if(f.useEffect(()=>{e&&d.setReference(e.view.dom)},[e,d]),f.useEffect(()=>{if(!e)return;const v=()=>o(!0),b=({event:S})=>{const{relatedTarget:j,currentTarget:k}=S,_=j instanceof Node&&g.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?Rr.createPortal(r.jsx(J,{children:r.jsx(te.Tooltip.Provider,{children:r.jsxs(w.Toolbar.Root,{ref:m,className:Is,style:h,children:[r.jsxs(w.Toolbar.Group,{className:ue,children:[r.jsx(ns,{editor:e,currentColor:p?.color??null,isOpen:a==="color",onOpenChange:l("color")}),r.jsx(fs,{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(ps,{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(Bs,{editor:e,activeAlignment:p?.textAlign})}),r.jsx(w.Toolbar.Separator,{className:Se}),r.jsx(w.Toolbar.Group,{className:ue,children:r.jsx(ws,{editor:e,currentUrl:p?.linkUrl??null,isActive:p?.isLink??!1,isOpen:a==="link",onOpenChange:l("link")})})]})})}),x):null};var Ws="_2ngohc0";const er=({editor:e,ariaLabel:t})=>r.jsxs("div",{className:Ws,children:[r.jsx(zs,{editor:e}),r.jsx(et.EditorContent,{editor:e,"aria-label":t})]}),$s=(e,t)=>{const n=f.useRef(e);n.current=e;const o=f.useRef(t);o.current=t;const a=f.useRef(null),s=f.useRef(null),c=f.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 g=a.current;g!==null&&(a.current=null,n.current(...g))};return{run:(...g)=>{if(o.current<=0){n.current(...g);return}a.current=g,s.current!==null&&clearTimeout(s.current),s.current=setTimeout(d,o.current)},flush:d,cancel:l}},[]);return f.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),c},Xs=200,tr=({content:e,extensions:t,isEditable:n,onUpdate:o,updateDebounceMs:a=Xs})=>{const s=f.useRef(kt(e)),c=f.useRef(!1),l=$s(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 f.useEffect(()=>{d?.setEditable(n)},[d,n]),f.useEffect(()=>{if(!d)return;if(c.current){c.current=!1;return}const h=kt(e),g=d.getJSON();qs(g,h)||(l.cancel(),d.commands.setContent(h,{emitUpdate:!1}))},[d,e,l]),f.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,qs=(e,t)=>JSON.stringify(e)===JSON.stringify(t);var Vs="_1cocly40";const Ys={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:nr(e.content??[e])}),nr=e=>e.map((t,n)=>Us(t,n)),Us=(e,t)=>{if(e.type==="text")return Ks(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return r.jsx("br",{},t);const n=e.content?nr(e.content):null;switch(e.type){case"doc":return r.jsx(f.Fragment,{children:n},t);case"heading":{const o=ei(e.attrs?.level);return ti(o,t,n,Ct(e.attrs))}case"paragraph":{const o=oe(e.attrs?.variant);return r.jsx("p",{"data-variant":o??void 0,style:rr(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)}},Ks=(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)=>Js(a,o,`${t}-${s}`),n)},Js=(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:Vs,href:o,rel:"noopener noreferrer",target:"_blank",children:t},n):r.jsx("span",{children:t},n)}case"textStyle":{const o=Zs(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 Ys[t]??t},Zs=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=Qs(e.fontSize);return a&&(t.fontSize=a),Object.keys(t).length>0?t:null},Qs=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:oe(e),oe=e=>typeof e=="string"&&e.length>0?e:void 0,ei=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),ti=(e,t,n,o)=>{const a=rr(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},rr=e=>e?{textAlign:e}:void 0;var ni="_4dlrid0",or="_4dlrid1",ri="xfz7dq0",oi="xfz7dq1",ai="xfz7dq2",si="xfz7dq3",ii="xfz7dq4";const ar=({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&&ui(s);return!d&&!h?null:r.jsxs("div",{ref:e,className:ri,style:{left:t.x,top:t.y,width:t.width},children:[d?l?r.jsx(hi,{caption:o}):r.jsx(li,{caption:o}):null,h&&r.jsx(ci,{source:s})]})},li=({caption:e})=>e===null?null:typeof e=="string"?r.jsx("p",{className:or,children:e}):r.jsx(Ce,{content:e}),ci=({source:e})=>{const t=u.isSafeUrl(e.url)?e.url:void 0,n=e.label??(t!==void 0?di(t):"");return n===""&&t===void 0?null:r.jsxs("div",{className:oi,children:[r.jsx("span",{className:si,children:"Source:"}),t!==void 0?r.jsx("a",{className:ai,href:t,target:"_blank",rel:"noopener noreferrer",children:n}):r.jsx("span",{className:ii,children:n})]})},di=e=>{try{return new URL(e).hostname}catch{return e}},ui=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",hi=({caption:e})=>{const t=tt(),n=f.useMemo(()=>_a({placeholder:"Add caption"}),[]),o=tr({content:e,extensions:n,isEditable:!0,onUpdate:a=>{const s=Ss(a)?null:a;t(new u.SetContentCaptionCommand({caption:s}))}});return r.jsx(er,{editor:o,ariaLabel:"Chart caption"})};var gi="_1k4qtbg0";const fi=3,pi=({title:e,isTitleVisible:t,subtitle:n,isSubtitleVisible:o})=>{const a=[];return t&&a.push({type:"heading",attrs:{level:fi},content:xi(e)}),o&&a.push(...vi(n)),{type:"doc",content:a}},mi=e=>{const t=e.content??[],[n,...o]=t;return{title:yi(n?.content??[]),subtitle:bi(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}:{}}),xi=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??[],vi=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]},yi=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)}},bi=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)}},sr=({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:gi,style:{left:t.x,top:t.y,width:t.width},children:l?r.jsx(ji,{title:o,isTitleVisible:a,isSubtitleVisible:c,subtitle:s},[a?"title":"",c?"subtitle":""].join("-")):r.jsx(Si,{title:o,isTitleVisible:a,isSubtitleVisible:c,subtitle:s})})},Si=({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:ni,children:e}):r.jsx(Ce,{content:e})),s&&(typeof o=="string"?r.jsx("p",{className:or,children:o}):r.jsx(Ce,{content:o}))]})},ji=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const a=tt(),s=f.useMemo(()=>Ea({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:n}),[t,n]),c=f.useMemo(()=>pi({title:e,isTitleVisible:t,subtitle:o,isSubtitleVisible:n}),[e,t,o,n]),l=tr({content:c,extensions:s,isEditable:!0,onUpdate:d=>{const h=mi(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 ki="_1u9qprb0",Li="_1u9qprb1",Ci="_9aen060",Ti="_9aen061",wi="_9aen062",ir="_9aen063";const Ai=Object.freeze(Object.defineProperty({__proto__:null,groupRow:wi,item:ir,trendRow:Ti,valueRow:Ci},Symbol.toStringTag,{value:"Module"})),Pi=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"})]})}),Ei=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 lr="n7clvo0",_i="n7clvo1",Mi="n7clvo2",Fi="n7clvo3",cr={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},Hi={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},Bi={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},Ii={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const Ni=({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:Ii[e.direction],children:e.direction==="flat"?r.jsx(Ei,{size:"xs",title:""}):r.jsx(Pi,{size:"xs",title:""})});const n=e.fontRole==="value"?cr[t]:Hi[t];return r.jsx("span",{className:F.clsx(Ri(e),n),children:e.text})},Ri=e=>{switch(e.textRole){case"value":return lr;case"observation":return _i;case"trendPercentage":return Bi[e.trendDirection??"up"];case"trendReference":return Mi;case"label":return Fi}},Di=({item:e,resolvedSize:t})=>r.jsx("div",{className:ir,children:u.createHeadlineItemRows(e).map(n=>r.jsx(Oi,{row:n,resolvedSize:t},n.role))}),Oi=({row:e,resolvedSize:t})=>{const n=e.role==="trendRow";return r.jsx("div",{className:Ai[e.role],"data-testid":n?"headline-trend":void 0,"data-direction":n?Gi(e):void 0,role:n?"img":void 0,"aria-label":n?e.ariaLabel:void 0,children:e.segments.map((o,a)=>r.jsx(Ni,{segment:o,resolvedSize:t},a))})},Gi=e=>{const t=e.segments.find(n=>n.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},zi=({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:Li,style:a,children:r.jsx("span",{className:F.clsx(lr,cr[n]),children:e.value})}):r.jsx("div",{className:ki,style:a,children:e.items.slice(0,o).map((s,c)=>r.jsx(Di,{item:s,resolvedSize:n},`${s.label}-${c}`))})};var Wi="_1oj6yix0",$i="_1oj6yix1",Xi="_1oj6yix2";const qi=8,Vi=16,Yi=2,Ui=({legends:e,containerRect:t,textScale:n})=>{const{lineBoxHeight:o}=In(n),{placements:a,hasOverlap:s}=Ki(e,t,o);if(a.length===0)return null;const c=s?Vi:qi,l=c-Yi;return r.jsxs("div",{className:Wi,children:[s&&r.jsx("svg",{className:$i,width:t.width,height:t.height,children:a.map(d=>r.jsx(Ji,{anchorY:d.anchorY,labelY:d.y,endX:l,color:d.payload.color},d.payload.key))}),a.map(d=>r.jsx("span",{className:Xi,style:{left:c,top:d.y,color:d.payload.color},children:d.payload.label},d.payload.key))]})},Ki=(e,t,n)=>f.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]),Ji=({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 Zi="_6a636s0";const Qi=/\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu,dr="😀";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=el(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(dr).width,a=tl(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 el=e=>{const t=e.match(Qi);return t?t.length:0},tl=e=>{const t=nl();return t?(t.style.font=e,t.getBoundingClientRect().width):null},nl=()=>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=dr,document.body.appendChild(X)),X),ur=f.createContext(null),hr=({children:e,measurer:t})=>{const[n,o]=f.useState(null);f.useEffect(()=>{if(t!==void 0)return;let s=!1;const c=()=>{s||o(rl())};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(ur.Provider,{value:a,children:e})},Q=()=>{const e=f.useContext(ur);if(e===null)throw new Error("useTextMeasurer must be used inside a <TextMeasurerProvider>.");return e},rl=()=>{try{return new u.CachedTextMeasurer(new _e)}catch{return new u.CachedTextMeasurer(new u.HeuristicTextMeasurer)}};var ol="_1kjk02r0",al="_1kjk02r1",sl="_1kjk02r2",il="_1kjk02r3",ll="_1kjk02r4",cl="_1kjk02r5",dl="_1kjk02r6",ul="_1kjk02r7",hl="_1kjk02r8",gl="_1kjk02r9",fl="_1kjk02ra",pl="_1kjk02rb",ml="_1dw9dgx0";const xl="#9ca3af",De="\0",vl=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},gr=({pill:e})=>e.isBubble?r.jsx(Sl,{pill:e}):r.jsx(bl,{pill:e}),yl=({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},bl=({pill:e})=>r.jsxs(r.Fragment,{children:[r.jsx(yl,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),r.jsx("span",{children:e.formattedLabel})]}),Sl=({pill:e})=>{const t=Number(e.visual.size);return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:ml,style:{width:t,height:t,backgroundColor:e.visual.color??xl}}),r.jsx("span",{children:e.formattedLabel})]})},jl=({hiddenPills:e,placement:t})=>{const n=$.useI18n(),[o,a]=f.useState(!1),{refs:s,floatingStyles:c}=M.useFloating({open:o,placement:t,middleware:[M.offset(4),M.flip(),M.shift({padding:8})]});f.useEffect(()=>{if(!o)return;const g=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",g),document.addEventListener("keydown",p),()=>{document.removeEventListener("pointerdown",g),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},(g,p)=>d-p);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:s.setReference,className:F.clsx(ol,{[sl]:l,[al]:!l}),children:[h.map(g=>r.jsx("span",{className:F.clsx(il,{[cl]:l,[ll]:!l}),style:kl(g,l),"aria-hidden":!0},g)),r.jsx("button",{type:"button",className:F.clsx(dl,{[ul]:o}),onClick:()=>a(g=>!g),"aria-haspopup":"dialog","aria-expanded":o,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:r.jsxs("span",{className:hl,children:["+",e.length]})})]}),o&&r.jsx("div",{ref:s.setFloating,role:"dialog","aria-label":n("graph.legend.hiddenItems"),className:gl,style:c,children:r.jsx("ul",{className:fl,children:e.map(g=>r.jsx("li",{className:pl,children:r.jsx(gr,{pill:g})},g.key))})})]})},kl=(e,t)=>{const n=-e*xn;return{transform:t?`translateY(${n}px)`:`translateX(${n}px)`}};var Ll="_1cecisi0",Cl="_1cecisi1",Tl="_1cecisi2",wl="_1cecisi3";const Al=({edge:e,formattedLegends:t,containerWidth:n,containerHeight:o,textScale:a})=>{const s=Q(),c=rt(),l=f.useMemo(()=>vl(t),[t]),d=e==="left"||e==="right",h=d?o:n,g=f.useMemo(()=>{if(l.length===0)return{visibleCount:0,hasOverflow:!1};if(h<=0)return{visibleCount:l.length,hasOverflow:!1};const v=U(vn,a),b={family:bn,size:v},S=v*yn,j=G=>d?Pl(G,S,c):wt({label:G.formattedLabel,swatchInlineSize:El(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}))+Zo;return Ml({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,g.visibleCount),m=l.slice(g.visibleCount),x=g.hasOverflow&&m.length>0;return r.jsxs("div",{className:F.clsx(Ll,{[Tl]:d,[Cl]:!d}),children:[p.map(v=>r.jsx("div",{className:wl,children:r.jsx(gr,{pill:v})},v.key)),x&&r.jsx(jl,{hiddenPills:m,placement:Fl(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},Pl=(e,t,n)=>{const o=_l(e,n.legendSwatchHeight);return Math.max(t,o)+n.legendPillVerticalChrome},El=(e,t)=>e.isBubble?Number(e.visual.size):Nn(e.visual.color,t),_l=(e,t)=>e.isBubble?Number(e.visual.size):t,Ml=({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}},Fl=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Hl=f.memo(function({formattedLegends:t,rects:n,textScale:o}){const a=f.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:Zi,style:{left:l.x,top:l.y,width:l.width,height:l.height},children:[r.jsx(Al,{edge:s,formattedLegends:c.pill,containerWidth:l.width,containerHeight:l.height,textScale:o}),r.jsx(Ui,{legends:c.direct,containerRect:l,textScale:o})]},s)})})});const lt=1,fr=8,Bl=12;i.pointStrokeColor;const Il=1,Nl=2,Rl=.7,ae=({hit:e})=>{const t=u.getColor(e.observation),n=(u.getAlpha(e.observation)??lt)*Rl,o=(u.getSize(e.observation)??fr)/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:Nl,"data-testid":"companion-point"})},pr=.3,mr=1,I={type:"spring",stiffness:500,damping:60,mass:1},Je=(e,t)=>{const n=T.useMotionValue(e);return f.useEffect(()=>{const o=Gr.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 Dl=f.memo(function({layer:t,coordSystem:n,isAnimated:o}){const{lineGenerator:a,areaGenerator:s}=f.useMemo(()=>u.createAreaPathGenerators(n,t.params),[t.params,n]),c=f.useMemo(()=>{const l=u.createStableKeyGenerator(t.data,t.mapping,t.id),d=[];return t.data.groupBy(u.GROUP_VARIABLES.group).forEach(h=>{const g=u.prepareAreaObservations([...h],t.params.missingValues),p=s(g),m=a(g);if(!p||!m)return;const x=g[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??pr,strokeWidth:S,strokeOpacity:mr,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(Ol,{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))})}),Ol=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:a,strokeOpacity:s,strokeDasharray:c,isAnimated:l})=>l?r.jsx(Gl,{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"})]}),Gl=({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 zl="_46ebsf0";const Oe=1,Wl=2,$l=1,Xl=Bl/2,ql=2.25,ct=({hit:e,...t})=>{const n=Vl(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+$l+Oe/2;return r.jsxs("g",{...t,className:zl,children:[r.jsx("circle",{cx:s,cy:c,r:d,fill:"none",stroke:i.hoveredPointRingColor,strokeWidth:Wl}),r.jsx("circle",{cx:s,cy:c,r:n,fill:o,opacity:a,stroke:i.hoveredPointRingColor,strokeWidth:Oe})]})},Vl=e=>{const t=u.getSize(e);return u.isDefined(t)?t/ql:Xl},Yl=({layer:e,coordSystem:t,primary:n,companions:o})=>{const a=u.getGroup(n.observation),s=f.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}=f.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)??pr,g=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:g,strokeOpacity:mr,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"})]})},Ul={geom:"area",coord:"cartesian",guideMode:"continuous",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(Dl,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({layer:e,coordSystem:t,primary:n,group:o,related:a})=>r.jsx(Yl,{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}}},xr=1,pe=4,Kl=f.memo(function({layer:t,coordSystem:n,isAnimated:o}){const a=f.useId(),s=f.useMemo(()=>{const l=u.createStableKeyGenerator(t.data,t.mapping,t.id),d=new Map;for(const h of t.data){const g=u.getBarRectBounds(n.mainAxis,h);if(!g)continue;const p=Zl(n.mainAxis,g),m=d.get(p),x={key:l(h),...g,fill:u.getColor(h),opacity:u.getAlpha(h)??xr};m?m.push(x):d.set(p,[x])}return[...d.entries()].map(([h,g])=>({id:`${a}${h}`,bars:g,...Ql(g)}))},[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(Jl,{column:l,isAnimated:o})},l.id))}),s.map(l=>{const[d]=l.bars;if(l.bars.length===1&&d!==void 0){const{key:h,...g}=d;return r.jsx(At,{...g,rx:pe,isAnimated:o},h)}return r.jsx("g",{clipPath:`url(#${l.id})`,children:l.bars.map(h=>{const{key:g,...p}=h;return r.jsx(At,{...p,isAnimated:o},g)})},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}),Jl=({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}),Zl=(e,t)=>e==="x"?`${t.x}-${t.width}`:`${t.y}-${t.height}`,Ql=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 ec="_1suo8ub0";const he=3,tc=({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,g=c+he*2,p=l+he*2,m=pe+he,x=u.getColor(t.observation),v=u.getAlpha(t.observation)??xr;return r.jsxs("g",{"data-testid":"hovered-bar",children:[r.jsx("rect",{x:d,y:h,width:g,height:p,rx:m,fill:i.hoveredBarBorderColor,className:ec,"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"})]})},nc={geom:"bar",coord:"cartesian",guideMode:"bar",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(Kl,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({coordSystem:e,primary:t,panelRect:n})=>r.jsx(tc,{coordSystem:e,primary:t,panelRect:n}),renderHoverCompanions:()=>null},vr=1,rc=f.memo(function({layer:t,isAnimated:n}){const o=f.useMemo(()=>u.createLinePathGenerator(t.params),[t.params]),a=f.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 g=d[0];if(!g)return;const p=u.getColor(g),m=u.getAlpha(g),x=u.resolveStrokeWidth(g,t.params),v=u.getDashArray(u.getLineType(g));c.push({key:s(g),pathData:h,color:p,opacity:m??vr,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(oc,{pathData:s.pathData,color:s.color,strokeWidth:s.strokeWidth,opacity:s.opacity,strokeDasharray:s.strokeDasharray,isAnimated:n},s.key))})}),oc=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:a,isAnimated:s})=>s?r.jsx(ac,{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"}),ac=({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"})},sc=({layer:e,primary:t,companions:n})=>{const o=u.getGroup(t.observation),a=f.useMemo(()=>{const g=e.data.filter(u.GROUP_VARIABLES.group,"eq",o);return u.prepareLineObservations([...g],e.params.missingValues)},[e.data,e.params.missingValues,o]),s=f.useMemo(()=>u.createLinePathGenerator(e.params)(a),[e.params,a]);if(!s)return null;const c=u.getColor(t.observation),l=u.getAlpha(t.observation)??vr,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(g=>r.jsx(ae,{hit:g},`companion-${g.layerId}-${g.pointIndex}`)),r.jsx(ct,{hit:t,"data-testid":"hovered-line-point"})]})},ic={geom:"line",coord:"cartesian",guideMode:"continuous",render:({layer:e,isAnimated:t})=>r.jsx(rc,{layer:e,isAnimated:t}),renderHover:({layer:e,primary:t,group:n,related:o})=>r.jsx(sc,{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}}},lc=f.memo(function({layer:t,isAnimated:n}){const o=f.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 g=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:g,stroke:i.pointStrokeColor,opacity:p??lt,strokeWidth:x??Il})}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))})}),cc={geom:"point",coord:"cartesian",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(lc,{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}}},dc=11.7,uc=E.xs,hc=N,gc=q.medium,ge=5,fc=5,Pt=10,Et=10,pc=4,Te=13,yr=6,Ge=12,_t=21.6,mc="0 0 10 18",xc="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 vc="_16vokpr0";const yc=(e,t)=>{const n=e.mapping.y!==void 0,o=t.mainAxis==="y";return n!==o},bc=(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%"}},Sc=(e,t)=>e==="solid"?{}:e==="dotted"?{strokeDasharray:`0 ${t*2}`,strokeLinecap:"round"}:{strokeDasharray:`${t*2} ${t*3}`,strokeLinecap:"round",strokeMiterlimit:16},jc=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}},kc=(e,t)=>je(e)&&je(t)?`${e}: ${t}`:je(e)?e:je(t)?t:null,je=e=>e!=null&&e.trim()!=="",Lc=({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,g=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:yr,fill:n}),r.jsx("g",{transform:g,children:r.jsx("svg",{x:h,y:(a-_t)/2,width:Ge,height:_t,viewBox:mc,overflow:"visible",children:r.jsx("path",{d:xc,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})},Cc=({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),g=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:yr,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:g,animate:{x:h},overflow:"visible",children:p}):r.jsx("svg",{x:h,y:g,overflow:"visible",children:p})},Tc=({label:e,textWidth:t,labelPosition:n,isHorizontalLine:o,position:a,color:s,textColor:c,symbolShape:l,symbolColor:d,isAnimated:h})=>{const g=l===null?0:Pt+pc,p=t+g+ge*2,m=dc+fc*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:g,textAnchor:"start",dominantBaseline:"central",fill:c,style:{font:i.fontGoalLineLabel},children:e})]});return o?r.jsx(Lc,{labelPosition:n,linePosition:a,color:s,pillWidth:p,pillHeight:m,text:x,isAnimated:h}):r.jsx(Cc,{labelPosition:n,linePosition:a,color:s,pillWidth:p,pillHeight:m,text:x,isAnimated:h})},wc=({layer:e,isHorizontalLine:t,position:n,lineColor:o,isAnimated:a})=>{const s=bc(t,n),c=Sc(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"})},Ac=f.memo(function({layer:t,coordSystem:n,formattingLocale:o,isAnimated:a}){const s=Q(),{guides:c,numberFormat:l,textScale:d,layers:h,colorScale:g}=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=f.useMemo(()=>u.buildAverageLineSymbols(h,g,n).get(t.id)??null,[h,g,n,t.id]),m=f.useMemo(()=>kc(t.params.label,u.formatRuleValue({guides:c,numberFormat:l,layer:t,locale:o})),[c,l,o,t]),x=f.useMemo(()=>({family:hc,size:U(uc,d),weight:gc}),[d]),v=f.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}=jc(t),k=yc(t,n),_=k?u.getY(b):u.getX(b);return _===null?null:r.jsxs("g",{"data-geom":"rule",className:vc,children:[r.jsx(wc,{layer:t,isHorizontalLine:k,position:_,lineColor:S,isAnimated:a}),m!==null&&r.jsx(Tc,{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})]})}),Pc={geom:"rule",coord:"cartesian",guideMode:null,render:({layer:e,coordSystem:t,formattingLocale:n,isAnimated:o})=>r.jsx(Ac,{layer:e,coordSystem:t,formattingLocale:n,isAnimated:o}),renderHover:()=>null,renderHoverCompanions:()=>null},br=1,Ft=Math.PI*2,Ec=f.memo(function({layer:t,isAnimated:n}){const o=f.useRef(!1);f.useEffect(()=>{o.current=!0},[]);const a=f.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:g}=u.getAngleExtent(l),{innerRadius:p,outerRadius:m}=u.getRadiusExtent(l);h===null||g===null||p===null||m===null||c.push({key:d,startAngle:h,endAngle:g,innerRadius:p,outerRadius:m,fill:u.getColor(l),opacity:u.getAlpha(l)??br})}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(_c,{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)})})}),_c=({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),g=T.useSpring(d,I),p=T.useMotionValue(u.buildPolarBarArcPath({startAngle:l,endAngle:d,innerRadius:n,outerRadius:o})??"");return f.useEffect(()=>{h.set(e),g.set(t)},[h,g,e,t]),f.useEffect(()=>{const m=()=>{const b=h.get(),S=g.get();p.set(u.buildPolarBarArcPath({startAngle:b,endAngle:S,innerRadius:n,outerRadius:o})??"")},x=h.on("change",m),v=g.on("change",m);return()=>{x(),v()}},[h,g,n,o,p]),r.jsx(T.motion.path,{d:p,fill:a,opacity:s,transition:I})},Mc=({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)??br;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})})},Fc={geom:"bar",coord:"polar",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(Ec,{layer:e,isAnimated:t}),renderHover:({primary:e})=>r.jsx(Mc,{primary:e}),renderHoverCompanions:()=>null},Hc={bar:{cartesian:nc,polar:Fc},line:{cartesian:ic},area:{cartesian:Ul},point:{cartesian:cc},rule:{cartesian:Pc}},Me=(e,t)=>Hc[e.geom]?.[t.type]??null,Bc=(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},Ic=1,Nc="4 3",Rc=({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=Bc(n,t);return s===null?null:s==="bar"?r.jsx(Oc,{coordSystem:t,scales:o,primary:a,panelRect:e}):r.jsx(Dc,{coordSystem:t,primary:a,panelRect:e})},Dc=({coordSystem:e,primary:t,panelRect:n})=>{const o=u.getHoverGuideLineProps(e,t);return r.jsx(Sr,{panelRect:n,children:r.jsx("line",{...o,stroke:i.hoverGuideLineColor,strokeWidth:Ic,strokeDasharray:Nc,strokeLinecap:"round","data-testid":"hover-guide-line"})})},Oc=({coordSystem:e,scales:t,primary:n,panelRect:o})=>{const a=u.getHoverGuideRectProps(e,t,n);return a===null?null:r.jsx(Sr,{panelRect:o,children:r.jsx("rect",{...a,fill:i.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},Sr=({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}),Gc=200,zc=({engine:e,store:t,overlayRef:n})=>{f.useEffect(()=>{const o=n.current;if(!o)return;const a=Wc(o,e),s=$c(o,e,t);return()=>{s(),a()}},[e,t,n])},Wc=(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()},Gc)},s=new ResizeObserver(a);return s.observe(e),n(),()=>{s.disconnect(),o!==null&&clearTimeout(o)}},$c=(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 g={x:(d.clientX-h.left)/h.width,y:1-(d.clientY-h.top)/h.height};n.getState().setHoverState(t.query(g))},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}},Xc=({panelRect:e})=>{const{engine:t,store:n,overlayRef:o}=we();return zc({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);f.useEffect(()=>{const o=e.current;if(o)return n?o.setAttribute(We,"true"):o.removeAttribute(We),()=>{o.removeAttribute(We)}},[e,n])},jr=E.xs,Ze=N,kr=q.medium,Vc=q.semibold,Lr=6,Cr=2,Yc=4,Uc=2,Ht=4;var Kc="_1agclyl0",Jc="_1agclyl1",Zc="_1agclyl2",Qc={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},ed="_1agclyl6 _1agclyl3";const Tr=({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,g=c==="aggregate"?ed:Qc[l],p=td(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:g,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:a})]})},td=(e,t,n)=>{if(e==="aggregate")return Zc;if(t==="outside"&&n==="cartesian")return Jc},nd={dataLabel:{x:Lr,y:Cr},stackTotal:{x:Yc,y:Uc}},rd=({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=f.useMemo(()=>{const l=U(jr,o.textScale);return{dataLabel:{family:Ze,size:l,weight:kr},stackTotal:{family:Ze,size:l,weight:Vc}}},[o.textScale]),s=f.useMemo(()=>(l,d)=>{const h=n.measureText(d,a[l]),g=nd[l];return{...h,width:h.width+g.x*2,height:h.height+g.y*2}},[n,a]),c=f.useMemo(()=>u.buildDataLabelsContent({...o,panelRect:e,measureDataLabel:s,formattingLocale:t}),[o,e,s,t]);return r.jsx("g",{className:Kc,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(l=>r.jsx(Tr,{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))})},od=({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"})]})},ad=({x:e,y:t,text:n,lineHeight:o,paddingX:a,paddingY:s,strokeWidth:c,strokeColor:l,fontWeight:d})=>{const h=Q(),p=f.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})]})},sd=({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=f.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:g,labelLineHeight:p,labelPaddingX:m,labelPaddingY:x,labelStrokeWidth:v,labelFontWeight:b})=>{const S=a??i.defaultAnnotationArrowStroke;return r.jsxs(f.Fragment,{children:[r.jsx(od,{linePath:c,arrowheadPath:l,stroke:S,strokeWidth:d}),r.jsx(ad,{x:h.x,y:h.y,text:g,lineHeight:p,paddingX:m,paddingY:x,strokeWidth:v,strokeColor:S,fontWeight:b})]},s)})})},id=0,ld=1.15,Bt=1.15,cd="rgba(0, 0, 0, 0.16)",It=2,dd=1.4,ud=({arrow:e,fallbackColor:t,stickerOutlineColor:n,stickerOutlineColorInverse:o})=>{const a=f.useId(),s=e.color??t,c=hd(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},g=[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:id,dy:ld,stdDeviation:Bt,floodColor:cd})})}),r.jsxs("g",{filter:e.hasStickerStyle?`url(#${a})`:void 0,children:[e.hasStickerStyle&&r.jsx("path",{d:g,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"})]})]})},hd=(e,t,n)=>{if(e===null)return n;try{return qe.getContrast(e,t)<dd?n:t}catch{return n}},gd=({panelRect:e})=>{const{themeValues:t}=st(),n=P(a=>a.annotations.freeformArrows),o=f.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(ud,{arrow:a,fallbackColor:i.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},a.id))})},fd=({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"),g=e==="top";return h?r.jsx("svg",{x:c,y:g?"100%":0,style:{overflow:"visible"},children:r.jsx("text",{...md(g,l,o),...d,children:a})}):r.jsx("text",{...pd(e,c,l),...d,children:a})},pd=(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"}}},md=(e,t,n)=>{const o=e?-t:t;return{x:0,y:o,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${n}, 0, ${o})`}},xd=({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=vd(e.position,c,t);return r.jsxs("g",{children:[e.ticksVisible&&r.jsx("line",{...l,stroke:i.gridLineColor,strokeWidth:1}),r.jsx(fd,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:s})]},a)})]})},vd=(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}}},yd=({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=bd(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}`)})}),bd=(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},Sd=({formattedAxes:e,tickRects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];return!o||!n.isVisible?null:r.jsx(xd,{formattedAxis:n,rect:o},n.scaleAestheticKey)})}),jd=({formattedAxes:e,labelRects:t})=>r.jsx(yd,{axes:e,rects:t}),Nt={strokeWidth:i.gridLineWidth,strokeDashoffset:"0",strokeDasharray:i.gridLineDash,strokeLinecap:"round"},wr=({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:g,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:g,stroke:p>0?m??i.defaultAnnotationShapeStroke:"none",strokeWidth:p},a))})};var kd="_120wioc0";const Ld=({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:kd,style:Cd(n.backgroundColor,n.backgroundColorStyle),children:r.jsx(Ce,{content:n.content})})},n.id))})},Cd=(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 Td="usd3ea0",wd="usd3ea1";const Ad=({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({[wd]:o&&a==="desaturate",[Td]:o&&a==="dim"}),children:c.render({layer:e,coordSystem:t,isAnimated:n,formattingLocale:s})})};function Pd({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 Ed=4,_d=({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}))),g=f.useMemo(()=>Pd({plugin:e,layer:t,coordSystem:a,candidates:o}),[e,t,a,o]),p=f.useMemo(()=>u.createSegmentYReader(t),[t]),m=f.useMemo(()=>u.buildLayerYValueFormatter({layer:t,numberFormat:d,locale:l}),[d,t,l]),x=jr*Fn*h;return e===null||n===null&&g.length===0?null:r.jsxs(r.Fragment,{children:[n?e.render({layer:n,coordSystem:a,isAnimated:s,formattingLocale:l}):null,g.map(({observation:v,observationIndex:b,anchor:S})=>r.jsx(Md,{observation:v,anchor:S,panelRect:c,readSegmentY:p,formatYValue:m,labelFontSizePx:x},Fd(v,b)))]})},Md=({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)??fr)/2,g=o(e),p=u.isDefined(g)?a(g,e):null,m=f.useMemo(()=>{if(p===null)return null;const x=c.measureText(p,{family:Ze,size:s,weight:kr});return{width:x.width+Lr*2,height:x.height+Cr*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(Tr,{x:l*n.width,y:d*n.height-h-Ed-m.height/2,width:m.width,height:m.height,text:p,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},Fd=(e,t)=>{const n=e[u.GROUP_VARIABLES.group];return`${String(n??"")}\0${t}`},Hd=({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 Bd="to1jkx0",Id="to1jkx1";const Nd=({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:Bd,"data-testid":"geom-layers",children:o.map(c=>r.jsxs(f.Fragment,{children:[r.jsx(Od,{layer:c,coordSystem:a,highlightStyle:s,shouldAnimate:e,panelRect:t,formattingLocale:n}),r.jsx(Hd,{layer:c,coordSystem:a,panelRect:t})]},`${c.id}-${Rd(a)}`))})},Rd=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,Dd=e=>{if(e.geom!=="rule")return Id},Od=({layer:e,coordSystem:t,highlightStyle:n,shouldAnimate:o,panelRect:a,formattingLocale:s})=>{const c=f.useMemo(()=>Me(e,t),[e,t]),l=e.highlight;return r.jsxs("g",{className:Dd(e),children:[r.jsx(Ad,{layer:e,coordSystem:t,isAnimated:o,isDimmed:l?.composition.isDimmed??!1,highlightStyle:n,formattingLocale:s}),l!==null&&r.jsx(_d,{plugin:c,layer:e,matchedLayer:l.composition.matchedLayer,overlayCandidates:l.composition.overlayCandidates,coordSystem:t,isAnimated:o,panelRect:a,formattingLocale:s})]})};var Gd="_17uhij30";const zd=({formattedAxes:e,panelGuide:t,plotRect:n,panelRect:o,axisRects:a,axisLabelRects:s,shouldAnimate:c,formattingLocale:l})=>{const d=f.useRef(null);qc(d);const h=Y("Grid",wr),g=Y("AxisTicks",Sd),p=Y("AxisLabel",jd),m=f.useMemo(()=>Ar(o,n),[o,n]),x=f.useMemo(()=>Dt(a,n),[a,n]),v=f.useMemo(()=>Dt(s,n),[s,n]);return r.jsxs("svg",{ref:d,className:Gd,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(Rc,{panelRect:m}),r.jsx(g,{formattedAxes:e,tickRects:x}),r.jsx(p,{formattedAxes:e,labelRects:v}),r.jsx(Rt,{panelRect:m,zOrder:"background"}),r.jsx(Nd,{shouldAnimate:c,panelRect:m,formattingLocale:l}),r.jsx(rd,{panelRect:m,formattingLocale:l}),r.jsx(sd,{panelRect:m,formattingLocale:l}),r.jsx(Rt,{panelRect:m,zOrder:"foreground"}),r.jsx(gd,{panelRect:m}),r.jsx(Ld,{panelRect:m}),r.jsx(Xc,{panelRect:m})]})},Ar=(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]=Ar(a,t);return n},$e={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},Wd=()=>{const[e,t]=f.useState(null),[n,o]=f.useState(null),[a,s]=f.useState($e);return f.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(g=>$d(g,{headerSize:d,footerSize:h})?{headerSize:d,footerSize:h}:g)};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}},$d=(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,Xd=({appearance:e,isEditable:t,style:n,children:o})=>{const{theme:a,themeClass:s,inlineVarsStyle:c}=st(),l=Ba(e.border),d=Math.max(0,e.cornerRadius),h=d===0?0:d+l,g=f.useMemo(()=>{const x={...n,borderRadius:`${h}px`,...c},v=Ha(e.border,a);return v!==null&&(x.background=v),x},[n,h,c,e.border,a]),p=f.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(Da,s),style:g,children:r.jsx("div",{"data-testid":"graph-inner",className:F(Ga,{[za]:m}),style:p,children:o})})},qd=({slots:e,...t})=>{const{formattingLocale:n}=se(),o=P(a=>a.config.parsingLocale);return r.jsx(Zt,{children:r.jsx(hr,{children:r.jsx($.IntlProvider,{locale:n??o,children:r.jsx(Ao,{slots:e,children:r.jsx(Vd,{...t})})})})})},Vd=({width:e,height:t,isAnimated:n,showTooltips:o=!0,mode:a="readonly"})=>{const s=$.useI18n(),{axes:c,panel:l,legends:d,numberFormat:h,parsingLocale:g,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}=Wd(),{formattingLocale:G,theme:Fe,themeOverrides:He}=se(),le=f.useMemo(()=>En(Fe,He),[Fe,He]),Pr=Y("Header",sr),Er=Y("Footer",ar),_r=Y("Legend",Hl),Mr=Y("Headline",zi),dt=f.useMemo(()=>u.formatLegends({legends:d,numberFormat:h,parsingLocale:g,formattingLocale:G}),[d,h,g,G]),ce=f.useMemo(()=>u.formatHeadline({headline:v,show:b.show,numberFormat:h,parsingLocale:g,formattingLocale:G,t:s}),[v,b.show,h,g,G,s]),Fr=Q(),Be=p.border.type==="none"?0:p.border.width,Ie=f.useMemo(()=>({width:Math.max(0,e-2*Be),height:Math.max(0,t-2*Be)}),[e,t,Be]),me=f.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]),Hr=Po(),xe=Ca(Fr,p.textScale,le,Hr),de=Ta({measurer:xe,axes:c,numberFormat:h,parsingLocale:g,formattedLegends:dt,containerSize:Ie,externalMeasurements:L,headline:me,formattingLocale:G,annotations:m,coordSystem:x,textScale:p.textScale,graphPadding:le.graphPadding}),ve=f.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:Br}=de;return r.jsx(Gn,{theme:Fe,themeOverrides:He,appearance:p,children:r.jsx(ga,{metrics:le,children:r.jsxs(Xd,{appearance:p,isEditable:a==="editable",style:{width:e,height:t},children:[r.jsx(Pr,{ref:k,headerRect:K.header,mode:a,title:S.title,isTitleVisible:S.isTitleVisible,subtitle:S.subtitle,isSubtitleVisible:S.isSubtitleVisible}),r.jsx(zd,{formattedAxes:Br,panelGuide:l,plotRect:K.plot,panelRect:K.panel,axisRects:K.axes,axisLabelRects:K.axisLabels,shouldAnimate:n??!j,formattingLocale:G??g}),r.jsx(Er,{ref:_,footerRect:K.footer,mode:a,caption:S.caption,isCaptionVisible:S.isCaptionVisible,source:S.source,isSourceVisible:S.isSourceVisible}),r.jsx(_r,{formattedLegends:dt,rects:K.legends,textScale:p.textScale}),ce&&ve&&r.jsx(Mr,{headline:ce,rect:ve.rect,resolvedSize:ve.resolvedSize,visibleItemCount:ve.visibleItemCount}),o&&r.jsx($o,{})]})})})};exports.CanvasTextMeasurer=_e;exports.DefaultFooter=ar;exports.DefaultGrid=wr;exports.DefaultHeader=sr;exports.DefaultTooltip=en;exports.DevToolsPanel=po;exports.GraphProvider=Kr;exports.GraphRenderer=qd;exports.HoverProvider=Zt;exports.TextMeasurerProvider=hr;exports.ThemeProvider=Gn;exports.darkTheme=On;exports.lightTheme=Dn;exports.useCompiledSelector=P;exports.useGraphCommandDispatcher=tt;exports.useHoverState=Pe;exports.useTextMeasurer=Q;exports.vars=i;
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import { Menu as M } from "@base-ui/react/menu";
|
|
|
33
33
|
import { Toggle as ua } from "@base-ui/react/toggle";
|
|
34
34
|
import { interpolatePath as ha } from "d3-interpolate-path";
|
|
35
35
|
import { getContrast as ct } from "color2k";
|
|
36
|
-
typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.reactRenderer = "0.0.1-experimental.
|
|
36
|
+
typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.reactRenderer = "0.0.1-experimental.4");
|
|
37
37
|
const ga = 5, pa = (e) => {
|
|
38
38
|
if (process.env.NODE_ENV === "production")
|
|
39
39
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphysdk/react-renderer",
|
|
3
3
|
"author": "Graphy",
|
|
4
|
-
"version": "0.0.1-experimental.
|
|
4
|
+
"version": "0.0.1-experimental.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react-intl": "^8.1.3",
|
|
51
51
|
"zustand": "^5.0.12",
|
|
52
52
|
"@graphysdk/i18n": "1.6.0",
|
|
53
|
-
"@graphysdk/viz-engine": "0.0.1-experimental.
|
|
53
|
+
"@graphysdk/viz-engine": "0.0.1-experimental.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "^19.0.0"
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"vite": "^6.4.2",
|
|
72
72
|
"vite-plugin-dts": "^4.5.4",
|
|
73
73
|
"vitest": "^4.1.0",
|
|
74
|
+
"@graphytools/typescript-config": "0.0.1",
|
|
74
75
|
"@graphytools/eslint-config": "0.0.1",
|
|
75
76
|
"@graphytools/eslint-plugin-graphy": "1.0.0",
|
|
76
|
-
"@graphytools/typescript-config": "0.0.1",
|
|
77
77
|
"@graphytools/vitest-config": "1.0.0"
|
|
78
78
|
},
|
|
79
79
|
"lint-staged": {
|