@juejin-opensource/jusage 0.1.8 → 0.1.9

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.
@@ -1,4 +1,4 @@
1
- var hw=Object.defineProperty;var pw=(e,t,r)=>t in e?hw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ea=(e,t,r)=>pw(e,typeof t!="symbol"?t+"":t,r);import{t as mw,be as qf,bf as vw,am as gw,j as g,aR as Nn,bg as yw,r as h,aT as Ei,bh as bw,bi as xw,bd as ww,bj as Pw,D as Ia,bk as Yf,bl as Vf,bm as kw,bn as Ow,B as Sr,bo as jw,a as Ie,d as Aw,bp as Sw,n as wv,bq as Ew,br as _w,T as Fe,P as xr,C as Tw,bs as Cw,aM as _i,h as oe,bt as Pn,i as at,bu as Mw,bv as Iw,bw as Nw,bx as Z,by as Dw,bz as $w,bA as Rw,bB as Lw,M as He,bC as wr,u as Uw,bD as zw,bE as Bw,bF as Fw,bG as Ww,S as Kw}from"./index-flWmwEjH.js";import{L as Hw,a as Gw,T as En,C as Na,S as ta,i as qw,u as Yw}from"./useLocalStorage-BdF6kE3i.js";import{G as Xf,P as ra,C as Vw}from"./downloads-dKq4xNjC.js";import{a as Dt,L as Pv,b as kn,S as xt}from"./index-BfeJy_UY.js";const Xw=mw({defaultVariants:{variant:"default"},slots:{base:"card",content:"card__content",description:"card__description",footer:"card__footer",header:"card__header",title:"card__title"},variants:{variant:{default:{base:"card--default"},secondary:{base:"card--secondary"},tertiary:{base:"card--tertiary"},transparent:{base:"card--transparent"}}}}),Zf=Object.assign(qf,{Root:qf,Separator:vw}),Dn=h.createContext({}),Jf=({children:e,className:t,variant:r="default",...n})=>{const i=gw.useMemo(()=>Xw({variant:r}),[r]),a=g.jsx(Nn.div,{className:i.base({className:t}),"data-slot":"card",...n,children:e});return g.jsx(Dn,{value:{slots:i},children:r==="transparent"?a:g.jsx(yw,{value:{variant:r},children:a})})},Zw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.header,e),"data-slot":"card-header",...t})},Jw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.h3,{className:Ei(n==null?void 0:n.title,t),"data-slot":"card-title",...r,children:e})},Qw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.p,{className:Ei(n==null?void 0:n.description,t),"data-slot":"card-description",...r,children:e})},e1=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.content,e),"data-slot":"card-content",...t})},t1=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.footer,e),"data-slot":"card-footer",...t})},q=Object.assign(Jf,{Root:Jf,Header:Zw,Title:Jw,Description:Qw,Content:e1,Footer:t1}),r1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 0 0-6.445 5.649.75.75 0 1 0 1.488.194A5.001 5.001 0 0 1 11.57 4.5h-1.32a.75.75 0 0 0 0 1.5h3a.75.75 0 0 0 .75-.75v-3a.75.75 0 0 0-1.5 0v1.06A6.48 6.48 0 0 0 8 1.5m-5.25 13a.75.75 0 0 1-.75-.75v-3a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 0 1.5H4.43a5.001 5.001 0 0 0 8.528-2.843.75.75 0 1 1 1.487.194A6.501 6.501 0 0 1 3.5 12.691v1.059a.75.75 0 0 1-.75.75",clipRule:"evenodd"})),n1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 13.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14M6.44 4.54c.43-.354.994-.565 1.56-.565 1.217 0 2.34.82 2.34 2.14 0 .377-.078.745-.298 1.1-.208.339-.513.614-.875.867-.217.153-.325.257-.379.328-.038.052-.038.07-.038.089a.75.75 0 0 1-1.5 0c0-.794.544-1.286 1.057-1.645.28-.196.4-.332.458-.426a.54.54 0 0 0 .075-.312c0-.3-.244-.641-.84-.641a1 1 0 0 0-.608.223c-.167.138-.231.287-.231.418a.75.75 0 0 1-1.5 0c0-.674.345-1.22.78-1.577M8 12a1 1 0 1 0 0-2 1 1 0 0 0 0 2",clipRule:"evenodd"})),i1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m6.44 4.06.439.44H12.5A1.5 1.5 0 0 1 14 6v5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11V4.5A1.5 1.5 0 0 1 3.5 3h1.257a1.5 1.5 0 0 1 1.061.44zM.5 4.5a3 3 0 0 1 3-3h1.257a3 3 0 0 1 2.122.879L7.5 3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3zm4.25 2a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z",clipRule:"evenodd"})),a1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 2.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M14 4a3 3 0 1 0-5.895.79L6.15 5.908a3 3 0 1 0 0 4.185l1.955 1.117A3.003 3.003 0 0 0 11 15a3 3 0 1 0-2.15-5.092L6.895 8.79a3 3 0 0 0 0-1.58L8.85 6.092A3 3 0 0 0 14 4m-3 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M2.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0",clipRule:"evenodd"})),kv=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06",clipRule:"evenodd"})),o1="inline-flex h-7 shrink-0 items-center gap-1 rounded-full bg-[#1e80ff] px-2.5 text-[12px] font-medium text-white outline-none transition-colors hover:bg-[#1171ee] focus-visible:ring-2 focus-visible:ring-[#1e80ff]/40 disabled:pointer-events-none disabled:opacity-40 dark:bg-[#4b9cff] dark:hover:bg-[#3a8ff0]",Qf="https://juejin.cn/aiusage/rank";function s1(){const e=window.open(Qf,"_blank");if(e){e.opener=null;return}window.location.assign(Qf)}function l1(){const e=window.open(Xf,"_blank");if(e){e.opener=null;return}window.location.assign(Xf)}function u1({className:e}){return g.jsx("svg",{"aria-hidden":"true",className:e,fill:"currentColor",role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"m12 14.316 7.454-5.88-2.022-1.625L12 11.1l-.004.003-5.432-4.288-2.02 1.624 7.452 5.88Zm0-7.247 2.89-2.298L12 2.453l-.004-.005-2.884 2.318 2.884 2.3Zm0 11.266-.005.002-9.975-7.87L0 12.088l.194.156 11.803 9.308 7.463-5.885L24 12.085l-2.023-1.624Z",transform:"translate(2.4 2.4) scale(.8)"})})}function c1(){bw();const e=xw(),t=wv(),r=ww(),[n,i]=h.useState(!1),[a,o]=h.useState(null),[s,l]=h.useState(!1),u="同步数据";r==null||r.hasUserData;const c=h.useCallback(()=>{(async()=>{try{const d=await Pw();o(!!d.juejin.userId)}catch{o(null)}})()},[t]);h.useEffect(()=>{c();const d=()=>c(),p=v=>{const m=v.detail;m!=null&&m.loginSuccess&&o(!0),c()};return window.addEventListener("focus",d),window.addEventListener(Ia,d),window.addEventListener(Yf,p),window.addEventListener(Vf,d),()=>{window.removeEventListener("focus",d),window.removeEventListener(Ia,d),window.removeEventListener(Yf,p),window.removeEventListener(Vf,d)}},[t,c]);const f=async()=>{var d;i(!0);try{if(t){if(!(await Ew()).ok){e.add({title:"同步失败,请稍后重试",variant:"danger"});return}e.add({title:"同步成功",variant:"success"}),typeof((d=window.tud)==null?void 0:d.onDataSynced)!="function"&&_w()}}catch{e.add({title:"同步失败,请稍后重试",variant:"danger"})}finally{i(!1)}};return g.jsxs("div",{className:"flex items-center gap-1",children:[a===!1?g.jsxs("button",{className:o1,onClick:()=>l(!0),type:"button",children:[g.jsx(u1,{className:"size-3.5"}),"关联掘金"]}):null,g.jsx(kw,{isOpen:s,onConfirm:()=>{Ow()},onOpenChange:l}),null,null,g.jsx(na,{icon:g.jsx(Hw,{className:"size-4"}),label:"GitHub 仓库",onPress:l1}),g.jsx(Sr,{className:"h-8 min-h-8 shrink-0 px-2.5 text-xs font-normal",onPress:s1,size:"sm",variant:"tertiary",children:"排行榜"}),g.jsx(na,{icon:g.jsx(a1,{className:"size-4"}),label:"分享",onPress:()=>{jw()}}),g.jsxs(g.Fragment,{children:[g.jsx(na,{disabled:n,icon:g.jsx(r1,{className:Ie("size-4",n&&"animate-spin")}),label:u,onPress:()=>{f()}}),g.jsx(na,{icon:g.jsx(Sw,{className:"size-4"}),label:"设置",onPress:()=>Aw()})]}),g.jsx(Gw,{})]})}function na({icon:e,label:t,onPress:r,disabled:n}){return g.jsxs(En,{closeDelay:80,delay:100,children:[g.jsx(Sr,{"aria-label":t,className:"size-8 min-h-8 min-w-8 shrink-0 p-0",isDisabled:n,isIconOnly:!0,onPress:r,size:"sm",variant:"tertiary",children:e}),g.jsx(En.Content,{placement:"bottom",children:g.jsx("p",{children:t})})]})}const f1={claude:"Claude",codex:"Codex",cursor:"Cursor",qoder:"Qoder",trae:"Trae",gemini:"Gemini",opencode:"OpenCode",copilot:"Copilot",antigravity:"Antigravity",openclaw:"OpenClaw",hermes:"Hermes",zcode:"ZCode",dsh:"DeepSeek Harness",pi:"pi",kimi:"Kimi",roocode:"Roo Code",droid:"Droid",kiro:"Kiro",cline:"Cline",amp:"Amp",qwen:"Qwen Code",codebuddy:"CodeBuddy",workbuddy:"WorkBuddy",grok:"Grok Build",mimo:"Mimo","every-code":"Every Code",omp:"OMP","kilo-cli":"Kilo CLI",kilocode:"Kilo Code",goose:"Goose",zed:"Zed",warp:"Warp"};function d1(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t==="gemini-cli"||t.startsWith("gemini")?"gemini":t==="open-code"||t.startsWith("opencode")?"opencode":t==="github-copilot"||t==="copilot-cli"||t.startsWith("copilot")?"copilot":t.startsWith("antigravity")?"antigravity":t.startsWith("openclaw")||t.startsWith("open-claw")?"openclaw":t.startsWith("hermes")?"hermes":t.startsWith("zcode")||t==="zai"?"zcode":t==="dsh"||t==="deepseek"||t==="harness"||t.startsWith("deepseek-harness")||t.startsWith("dsh-")?"dsh":t==="pi-coding-agent"||t.startsWith("pi")?"pi":t.startsWith("kimi")?"kimi":t==="roo-code"||t.startsWith("roocode")||t.startsWith("roo")?"roocode":t.startsWith("droid")||t.startsWith("factory")?"droid":t.startsWith("kiro")?"kiro":t.startsWith("cline")?"cline":t.startsWith("amp")?"amp":t==="qwen-code"||t.startsWith("qwen")?"qwen":t.startsWith("codebuddy")||t==="code-buddy"?"codebuddy":t.startsWith("workbuddy")?"workbuddy":t.startsWith("grok")?"grok":t.startsWith("mimo")||t==="mimocode"||t.startsWith("xiaomi")?"mimo":t==="everycode"||t.startsWith("every-code")?"every-code":t.startsWith("omp")||t==="oh-my-pi"?"omp":t.startsWith("kilo-cli")||t==="kilo"?"kilo-cli":t.startsWith("kilocode")||t==="kilo-code"?"kilocode":t.startsWith("goose")?"goose":t.startsWith("zed")?"zed":t.startsWith("warp")?"warp":t}function qe(e){const t=d1(e);return f1[t]??e}const kl=["var(--heatmap-0)","var(--heatmap-1)","var(--heatmap-2)","var(--heatmap-3)","var(--heatmap-4)"],Ls={today:1,"last-7-days":7,"last-30-days":30,"last-90-days":90},Ov=[{id:"today",label:"今天"},{id:"last-7-days",label:"7D"},{id:"last-30-days",label:"30D"},{id:"last-90-days",label:"90D"}],h1="!h-8 !min-h-8";function p1({value:e,onChange:t,tools:r,selectedTools:n,onToolsChange:i,disabled:a=!1}){const o=h.useMemo(()=>r.filter(s=>s.tokens>0),[r]);return g.jsxs("div",{className:"mb-5 flex min-w-0 items-center gap-2","aria-label":"筛选条件",children:[g.jsx("div",{className:"shrink-0 sm:hidden",children:g.jsx(m1,{disabled:a,value:e,onChange:t})}),g.jsx(Fe,{className:"hidden w-fit shrink-0 text-center sm:block",selectedKey:e,onSelectionChange:s=>{a||t(String(s))},children:g.jsx(Fe.ListContainer,{children:g.jsx(Fe.List,{"aria-label":"时间范围",className:"w-fit *:h-6 *:w-fit *:px-3 *:text-sm *:font-normal *:transition-none! *:data-[selected=true]:text-accent-foreground",children:Ov.map(s=>g.jsxs(Fe.Tab,{className:"transition-none!",id:s.id,children:[g.jsx("span",{className:"text-xs font-normal",children:s.label}),g.jsx(Fe.Indicator,{className:"bg-accent transition-none!"})]},s.id))})})}),g.jsx("div",{className:"flex min-h-8 min-w-0 shrink-0 items-center",children:o.length>0?g.jsx(v1,{selectedTools:n,tools:o,onChange:s=>{a||i(s)}}):null}),g.jsx("div",{className:"ml-auto shrink-0",children:g.jsx(c1,{})})]})}function m1({disabled:e,onChange:t,value:r}){return g.jsxs(Dt,{"aria-label":"时间范围",className:"min-w-0 max-w-[7.5rem] shrink text-xs",isDisabled:e,value:r,variant:"secondary",onChange:n=>{e||n==null||t(String(n))},children:[g.jsx(Pv,{className:"sr-only",children:"时间范围"}),g.jsxs(Dt.Trigger,{className:`${h1} !w-fit max-w-[7.5rem] items-center leading-none ps-2.5 pe-7 !text-xs font-normal`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-20 !text-xs"}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"时间范围",children:Ov.map(n=>g.jsxs(kn.Item,{id:n.id,textValue:n.label,children:[n.label,g.jsx(kn.ItemIndicator,{})]},n.id))})})]})}function v1({tools:e,selectedTools:t,onChange:r}){const n=h.useMemo(()=>new Set(e.map(o=>o.source)),[e]),i=t.filter(o=>n.has(o)),a=i.length>0;return g.jsxs(Zf,{className:"shrink-0",children:[g.jsxs(Dt,{"aria-label":"筛选渠道",className:"w-fit max-w-52 text-xs",selectionMode:"multiple",value:i,variant:"secondary",onChange:o=>{const s=Array.isArray(o)?o.map(String):o==null?[]:[String(o)];r(s.filter(l=>n.has(l)))},children:[g.jsx(Pv,{className:"sr-only",children:"渠道"}),g.jsxs(Dt.Trigger,{className:`!h-8 !min-h-8 !w-fit max-w-52 ps-3 pe-8 !text-xs font-normal ${a?"!rounded-r-none":"!rounded-full"}`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-40 !text-xs",children:({state:o})=>{const s=o.selectedItems.map(u=>e.find(c=>c.source===u.key)).filter(u=>!!u);if(s.length===0)return"全部渠道";if(s.length>1)return`已选 ${s.length} 个渠道`;const[l]=s;return l?g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g.jsx(xr,{provider:l.source,size:18}),g.jsx("span",{className:"truncate",children:qe(l.source)})]}):"全部渠道"}}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"渠道列表",selectionMode:"multiple",children:e.map(o=>g.jsxs(kn.Item,{className:"py-1 rounded-lg px-1.5 text-xs gap-2!",id:o.source,textValue:qe(o.source),children:[g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md ",children:g.jsx(xr,{provider:o.source,size:18})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:qe(o.source)}),g.jsx(kn.ItemIndicator,{})]},o.source))})})]}),a?g.jsxs(Sr,{"aria-label":"清空渠道筛选",className:"!h-8 !min-h-8 !w-8 !min-w-8 !rounded-l-none !rounded-r-full p-0",size:"sm",variant:"tertiary",onPress:()=>r([]),children:[g.jsx(Zf.Separator,{}),g.jsx(kv,{className:"size-3.5"})]}):null]})}function g1(){return g.jsxs(q,{"aria-hidden":"true",className:"min-w-0 overflow-hidden rounded-2xl",children:[g.jsxs(q.Header,{className:"flex-row items-start justify-between gap-3 pb-0",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx(xt,{className:"h-5 w-28 rounded-md"}),g.jsx(xt,{className:"h-3 w-44 rounded-md"})]}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(q.Content,{className:"pt-4",children:g.jsx(xt,{className:"h-52 w-full rounded-xl"})})]})}function y1(){return g.jsxs("div",{"aria-hidden":"true",className:"w-full",children:[g.jsx("section",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4},(e,t)=>g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid grid-rows-[auto_auto] gap-4 p-0",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx(xt,{className:"h-3 w-16 rounded-md"}),g.jsx(xt,{className:"h-5 w-14 rounded-full"})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(xt,{className:"h-7 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-16 justify-self-end rounded-md"})]})]})},t))}),g.jsxs("div",{className:"mt-4 rounded-2xl border border-border/60 bg-surface p-4 sm:p-5",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[g.jsx(xt,{className:"h-4 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(xt,{className:"h-36 w-full rounded-xl sm:h-44"})]})]})}function b1(){return g.jsxs("div",{"aria-label":"用量数据加载中",className:"w-full",role:"status",children:[g.jsx(y1,{}),g.jsx("section",{"aria-hidden":"true",className:"mt-4 grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-2",children:Array.from({length:5},(e,t)=>g.jsx(g1,{},t))})]})}function x1({allSources:e,value:t,onChange:r}){if(e.length===0)return null;const n=new Set(t),i=t.length===e.length,a=!i&&t.length>0;let o="全部平台";t.length===0?o="选择平台":!i&&t.length===1?o=qe(t[0]??""):i||(o=`已选 ${t.length} 个平台`);const s=l=>{const u=new Set(n);u.has(l)?u.delete(l):u.add(l),r([...u])};return g.jsxs(ra,{children:[g.jsxs(Sr,{"aria-label":`筛选平台:${o}`,className:Ie("h-auto min-h-0 max-w-36 gap-1 rounded-none border-0 bg-transparent p-0","text-xs font-medium text-muted shadow-none","hover:bg-transparent hover:text-foreground","data-[pressed=true]:bg-transparent data-[pressed=true]:text-foreground",a&&"text-foreground"),size:"sm",variant:"ghost",children:[!i&&t.length===1&&t[0]?g.jsx(xr,{provider:t[0],size:12}):null,g.jsx("span",{className:"min-w-0 max-w-28 truncate whitespace-nowrap",children:o}),g.jsx(Tw,{className:"size-3.5 shrink-0 opacity-70"})]}),g.jsx(ra.Content,{className:"min-w-56 overflow-hidden rounded-[10px] border-0 bg-overlay p-0 text-overlay-foreground shadow-surface",placement:"bottom end",children:g.jsxs(ra.Dialog,{className:"p-0 outline-none",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[g.jsx(ra.Heading,{className:"text-[10px] font-semibold tracking-wider text-muted",children:"选择平台"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([...e]),children:"全部"}),g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([]),children:"清空"})]})]}),g.jsx("ul",{"aria-multiselectable":"true",className:"max-h-64 overflow-y-auto p-1.5",role:"listbox",children:e.map(l=>{const u=n.has(l);return g.jsx("li",{"aria-selected":u,role:"option",children:g.jsxs("button",{className:Ie("flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left text-xs transition-colors","hover:bg-surface-secondary",u&&"bg-accent/10 hover:bg-accent/15"),type:"button",onClick:()=>s(l),children:[g.jsx("span",{"aria-hidden":"true",className:Ie("flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors",u?"border-accent bg-accent text-accent-foreground":"border-border bg-surface"),children:u?g.jsx(Vw,{className:"size-2.5"}):null}),g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-white",children:g.jsx(xr,{onLightBackground:!0,provider:l,size:14})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:qe(l)})]})},l)})})]})})]})}function w1(e,t,r){if(e.length===0){r([]);return}if(e.length===t.length&&t.every(n=>e.includes(n))){r(null);return}r(e)}const Uo="Asia/Shanghai",ed=new Map;function P1(e){let t=ed.get(e);return t||(t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",hourCycle:"h23",minute:"2-digit"}),ed.set(e,t)),t}function jv(e,t=Uo){const r=typeof e=="string"?new Date(e):e;if(Number.isNaN(r.getTime()))return{date:"1970-01-01",hour:0};const n=P1(t).formatToParts(r),i=a=>{var o;return((o=n.find(s=>s.type===a))==null?void 0:o.value)??""};return{date:`${i("year")}-${i("month")}-${i("day")}`,hour:Number(i("hour"))}}function an(e=Uo,t=new Date){return jv(t,e).date}function _u(e=Uo,t=new Date){return jv(t,e).hour}function k1(e,t){const[r,n,i]=e.split("-").map(Number);return new Date(Date.UTC(r??1970,(n??1)-1,(i??1)+t)).toISOString().slice(0,10)}function td(e,t=Uo,r=new Date){const n=an(t,r);return k1(n,-(Math.max(1,e)-1))}function Av(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));return Number.isFinite(r.getTime())?r:null}function ia(e){return e.toISOString().slice(0,10)}function yn(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Sv(e,t){return Math.floor((Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))/864e5)}function Us(e,t){if(!e.length)return 0;const r=(e.length-1)*t,n=Math.floor(r),i=r-n,a=e[n]??e[e.length-1],o=e[Math.min(e.length-1,n+1)]??e[e.length-1];return Math.round(a+(o-a)*i)}function O1(e){return e<=0?0:e>=4?4:e}function j1(e,t=26){var y;const r=Av(an())??new Date,n=yn(r,-(t*7-1)),i=n.getUTCDay(),a=yn(n,-i),o=new Map;for(const b of e)o.set(b.date,{value:Math.max(0,b.tokens),models:b.models??null});const s=Sv(a,r)+1,l=Math.ceil(s/7),u=[];for(let b=0;b<s;b++){const x=ia(yn(a,b)),w=((y=o.get(x))==null?void 0:y.value)??0;w>0&&u.push(w)}u.sort((b,x)=>b-x);const c=Us(u,.5),f=Us(u,.75),d=Us(u,.9);function p(b){return!b||b<=0?0:b<=c?1:b<=f?2:b<=d?3:4}const v=[];for(let b=0;b<l;b++){const x=[];for(let w=0;w<7;w++){const P=yn(a,b*7+w);if(P.getTime()>r.getTime()){x.push(null);continue}const O=ia(P),k=o.get(O),j=(k==null?void 0:k.value)??0;x.push({day:O,value:j,level:O1(p(j)),models:(k==null?void 0:k.models)??null})}v.push(x)}const m=v.length>t?v.slice(v.length-t):v;return{from:ia(n),to:ia(r),weeks:m,thresholds:{t1:c,t2:f,t3:d}}}function rd(){return"UTC+08:00"}function A1(e,t,r){if(!e)return[];const n=Av(t)??new Date,i=yn(n,-n.getUTCDay()),a=yn(i,-(e-1)*7),o=[];for(let u=11;u>=0;u-=1)o.push(new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()-u,1)));const s=[],l=new Set;for(const u of o){const c=Math.floor(Sv(a,u)/7);c<0||c>=e||l.has(c)||(l.add(c),s.push({label:r[u.getUTCMonth()],index:c}))}return s}const S1="";function Ti(e){const t=e.indexOf(S1);return t===-1?{source:null,model:e}:{source:e.slice(0,t),model:e.slice(t+1)}}const E1="var(--chart-",_1=8;function Da(e){const t=e%_1+1;return`${E1}${t})`}function T1(e){const t=new Map;for(const n of e){if(n.tokens<=0)continue;const i=t.get(n.model);(!i||n.tokens>i.tokens)&&t.set(n.model,{source:n.source,tokens:n.tokens})}const r=new Map;for(const[n,i]of t)r.set(n,i.source);return r}const wt="unattributed",$a="未归类";function C1(e){const t=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(u=>{const c=new Map;for(const p of u.models){if(!p.model||p.tokens<=0)continue;const v=c.get(p.model)??{tokens:0,costUsd:0,pct:0};v.tokens+=p.tokens,v.costUsd+=p.costUsd,v.pct+=p.pct,c.set(p.model,v),r.set(p.model,(r.get(p.model)??0)+p.tokens)}let f=0,d=0;for(const p of c.values())f+=p.tokens,d+=p.costUsd;return{row:u,models:c,unattributedTokens:Math.max(0,u.tokens-f),unattributedCostUsd:Math.max(0,u.costUsd-d)}}),i=[...r.entries()].sort((u,c)=>c[1]-u[1]).map(([u,c],f)=>({key:`model-${f}`,model:u,color:Da(f),tokens:c})),a=n.reduce((u,c)=>u+c.unattributedTokens,0);a>0&&i.push({key:wt,model:$a,color:"var(--muted)",tokens:a,isUnattributed:!0});const o=new Map(i.filter(u=>!u.isUnattributed).map(u=>[u.model,u])),s=Object.fromEntries(i.map(u=>[u.key,{label:u.model,color:u.color}])),l=n.map(({row:u,models:c,unattributedTokens:f,unattributedCostUsd:d})=>{const p={source:u.source,tokens:u.tokens,costUsd:u.costUsd,pct:u.pct,modelCount:u.models.length,segments:{}};for(const v of i)p[v.key]=0;for(const[v,m]of c){const y=o.get(v);y&&(p[y.key]=m.tokens,p.segments[y.key]={key:y.key,model:v,tokens:m.tokens,costUsd:m.costUsd,pct:m.pct})}return f>0&&(p[wt]=f,p.segments[wt]={key:wt,model:$a,tokens:f,costUsd:d,pct:u.tokens>0?f/u.tokens*100:0,isUnattributed:!0}),p});return{config:s,rows:l,series:i}}function M1(e){const t=e.filter(c=>c.tokens>0).sort((c,f)=>f.tokens-c.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(c=>{const f=new Map;for(const v of c.models){if(!v.model||!v.source||v.tokens<=0)continue;const m=`${v.source}\0${v.model}`,y=f.get(m)??{source:v.source,model:v.model,tokens:0,costUsd:0,pct:0};y.tokens+=v.tokens,y.costUsd+=v.costUsd,y.pct+=v.pct,f.set(m,y);const b=r.get(m)??{source:v.source,model:v.model,tokens:0};b.tokens+=v.tokens,r.set(m,b)}let d=0,p=0;for(const v of f.values())d+=v.tokens,p+=v.costUsd;return{row:c,models:f,unattributedTokens:Math.max(0,c.tokens-d),unattributedCostUsd:Math.max(0,c.costUsd-p)}}),i=[...r.entries()].sort((c,f)=>f[1].tokens-c[1].tokens).map(([c,f],d)=>({key:`seg-${d}`,pairKey:c,model:f.model,source:f.source,color:Da(d),tokens:f.tokens})),a=n.reduce((c,f)=>c+f.unattributedTokens,0);a>0&&i.push({key:wt,pairKey:wt,model:$a,source:"",color:"var(--muted)",tokens:a});const o=new Map(i.filter(c=>c.key!==wt).map(c=>[c.pairKey,c])),s=i.map(c=>({key:c.key,model:c.model,source:c.source,color:c.color,tokens:c.tokens,...c.key===wt?{isUnattributed:!0}:{}})),l=Object.fromEntries(s.map(c=>[c.key,{label:c.source?`${c.source}:${c.model}`:c.model,color:c.color}])),u=n.map(({row:c,models:f,unattributedTokens:d,unattributedCostUsd:p})=>{const v={project:c.project,label:c.label,tokens:c.tokens,costUsd:c.costUsd,pct:c.pct,modelCount:c.models.length,segments:{}};for(const m of s)v[m.key]=0;for(const[m,y]of f){const b=o.get(m);b&&(v[b.key]=y.tokens,v.segments[b.key]={key:b.key,model:y.model,source:y.source,tokens:y.tokens,costUsd:y.costUsd,pct:y.pct})}return d>0&&(v[wt]=d,v.segments[wt]={key:wt,model:$a,source:"",tokens:d,costUsd:p,pct:c.tokens>0?d/c.tokens*100:0,isUnattributed:!0}),v});return{config:l,rows:u,series:s}}const I1=/%[0-9A-Fa-f]{2}/;function N1(e){const t=e.replace(/\\/g,"/").replace(/\/+$/,""),r=t.lastIndexOf("/");return(r>=0?t.slice(r+1):t).trim()||"unknown"}function Ev(e){let t=e;for(let r=0;r<4;r++){if(!I1.test(t))return t;try{const n=decodeURIComponent(t);if(n===t)return t;t=n}catch{return t}}return t}function D1(e){if(!/^file:/i.test(e))return e;let t=e.replace(/^file:\/\//i,"");return/^localhost\//i.test(t)&&(t=t.slice(9)),t!==""&&!t.startsWith("/")&&!/^[A-Za-z]:/.test(t)&&(t=`/${t}`),Ev(t)}function $1(e){const t=Ev(e).trim();return D1(t).trim()}function Tu(e){const t=$1(e).replace(/[\\/]+$/,"");return!t||t==="unknown"?"unknown":N1(t)}const zo=["周一","周二","周三","周四","周五","周六","周日"],_v=Array.from({length:24},(e,t)=>String(t).padStart(2,"0"));function Tv(e){const t=new Date,r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return Array.from({length:e},(n,i)=>{const a=new Date(r);return a.setUTCDate(r.getUTCDate()-(e-1-i)),a.toISOString().slice(0,10)})}function Cv(e){const[,t="",r=""]=e.split("-");return`${Number(t)}/${Number(r)}`}const nd=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],zs=[{source:"claude-code",model:"claude-fable-5",terminal:"VS Code",project:"ai-usage",weight:26,scale:1.35},{source:"claude-code",model:"MiniMax-M3",terminal:"系统终端",project:"ai-usage",weight:18,scale:1.7},{source:"claude-code",model:"claude-sonnet-4-6",terminal:"VS Code",project:"dashboard",weight:12,scale:1},{source:"codex",model:"gpt-5",terminal:"系统终端",project:"api-service",weight:18,scale:1.2},{source:"codex",model:"gpt-5-mini",terminal:"VS Code",project:"docs-site",weight:10,scale:.72},{source:"cursor",model:"claude-sonnet-4-6",terminal:"Cursor",project:"design-system",weight:10,scale:.88},{source:"cursor",model:"gemini-2-5-pro",terminal:"Cursor",project:"marketing-site",weight:6,scale:1.08}],Cu=365,R1=L1(),oi=U1(R1),ln={hourlyUsage:[],rangeDailyUsage:[],heatmapDailyUsage:[],heatmapDays:[],modelRows:[],hourlyApiRows:[],todayHourlyUsage:[],dailyUsage:[],summary:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0},changes:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0},distributions:{terminals:[],tools:[],models:[],projects:[]},toolModelUsage:[],projectModelUsage:[]};function L1(){return zo.flatMap((e,t)=>_v.map((r,n)=>{const i=z1(t,n),a=t>=5,o=Math.max(0,1-Math.abs(n-10)/5),s=Math.max(0,1-Math.abs(n-20)/5),l=(Math.sin((t+1)*(n+3)*.77)+1)/2,c=Math.min(1,.03+(a?.62:1)*(o*.4+s*.57)+l*.14),f=Math.round((500+c*38e3)*i.scale),d=.72+l*.12,p=Math.round(f*d),v=f-p,m=i.model.includes("MiniMax")||i.model.includes("fable")?.42+l*.28:.08+l*.18,y=Math.min(p,Math.round(p*m)),b=Pr(p*4e-6+v*16e-6);return{day:e,hour:n,hourLabel:r,inputTokens:p,cachedInputTokens:y,outputTokens:v,totalTokens:f,costUsd:b,durationMinutes:Math.round(3+c*72),source:i.source,model:i.model,terminal:i.terminal,project:i.project}}))}function U1(e){var u;const t=Nu(e),r=B1(e),n=e.map(c=>({day:c.day,hour:c.hour,hourLabel:c.hourLabel,inputTokens:c.inputTokens,cachedInputTokens:c.cachedInputTokens,outputTokens:c.outputTokens,totalTokens:c.totalTokens,costUsd:c.costUsd,durationMinutes:c.durationMinutes})),i=(u=r.at(-1))==null?void 0:u.day,a=i?n.filter(c=>c.day===i):[],o=F1(r),s=W1(o),l=K1(e,t.totalTokens);return{hourlyUsage:n,rangeDailyUsage:r,heatmapDailyUsage:o,heatmapDays:s,modelRows:l,hourlyApiRows:[],todayHourlyUsage:a,dailyUsage:r,summary:t,changes:Du(r),distributions:{terminals:aa(e,c=>c.terminal),tools:aa(e,c=>c.source),models:aa(e,c=>c.model),projects:aa(e,c=>c.project)},toolModelUsage:Mu(e.map(c=>({source:c.source,tokens:c.totalTokens,costUsd:c.costUsd,models:[{model:c.model,tokens:c.totalTokens,costUsd:c.costUsd}]})),t.totalTokens),projectModelUsage:Iu(Object.values(e.reduce((c,f)=>{const d=c[f.project]??{project:f.project,tokens:0,costUsd:0,models:[]};return d.tokens+=f.totalTokens,d.costUsd+=f.costUsd,d.models.push({model:f.model,source:f.source,tokens:f.totalTokens,costUsd:f.costUsd}),c[f.project]=d,c},{})),t.totalTokens)}}function Mu(e,t){const r=new Map;for(const a of e){if(!a.source||a.tokens<=0)continue;const o=r.get(a.source)??{tokens:0,costUsd:0,models:new Map};o.tokens+=a.tokens,o.costUsd+=a.costUsd;for(const s of a.models){if(!s.model||s.tokens<=0)continue;const l=o.models.get(s.model)??{tokens:0,costUsd:0};l.tokens+=s.tokens,l.costUsd+=s.costUsd,o.models.set(s.model,l)}r.set(a.source,o)}const n=[...r.entries()].sort(([,a],[,o])=>o.tokens-a.tokens),i=t&&t>0?t:n.reduce((a,[,o])=>a+o.tokens,0);return n.map(([a,o])=>({source:a,tokens:o.tokens,costUsd:Pr(o.costUsd),pct:Ra(o.tokens,i),models:[...o.models.entries()].sort(([,s],[,l])=>l.tokens-s.tokens).map(([s,l])=>({model:s,tokens:l.tokens,costUsd:Pr(l.costUsd),pct:Ra(l.tokens,o.tokens)}))}))}function Iu(e,t=0){const r=new Map;for(const a of e){if(a.tokens<=0)continue;const o=Tu(a.project),s=r.get(o)??{project:o,tokens:0,costUsd:0,models:new Map};s.tokens+=a.tokens,s.costUsd+=a.costUsd;for(const l of a.models??[]){if(l.tokens<=0)continue;const u=`${l.source}\0${l.model}`,c=s.models.get(u)??{model:l.model,source:l.source,tokens:0,costUsd:0};c.tokens+=l.tokens,c.costUsd+=l.costUsd,s.models.set(u,c)}r.set(o,s)}const n=Array.from(r.values()),i=t>0?t:n.reduce((a,o)=>a+o.tokens,0);return n.map(a=>({project:a.project,label:a.project==="unknown"?"未知项目":a.project,tokens:a.tokens,costUsd:Pr(a.costUsd),pct:Ra(a.tokens,i),models:[...a.models.values()].map(o=>({model:o.model,source:o.source,tokens:o.tokens,costUsd:Pr(o.costUsd),pct:Ra(o.tokens,a.tokens)})).sort((o,s)=>s.tokens-o.tokens)})).sort((a,o)=>o.tokens-a.tokens)}function z1(e,t){const r=zs.reduce((i,a)=>i+a.weight,0);let n=(e*31+t*17)%r;for(const i of zs)if(n-=i.weight,n<0)return i;return zs[0]}function Nu(e){const t=e.reduce((r,n)=>({inputTokens:r.inputTokens+n.inputTokens,outputTokens:r.outputTokens+n.outputTokens,totalTokens:r.totalTokens+n.totalTokens,totalCostUsd:r.totalCostUsd+n.costUsd,totalDurationMinutes:r.totalDurationMinutes+n.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{...t,totalCostUsd:Pr(t.totalCostUsd)}}function B1(e){return Tv(zo.length).map(r=>{const n=Mv(r),i=e.filter(s=>s.day===n),a=Nu(i),o=i.reduce((s,l)=>s+l.cachedInputTokens,0);return{day:n,date:r,dateLabel:Cv(r),...a,cachedInputTokens:o,uncachedInputTokens:a.inputTokens-o,costUsd:a.totalCostUsd,durationMinutes:a.totalDurationMinutes}})}function F1(e){return e.length===0?[]:Tv(Cu).map((r,n)=>{const i=e[n%e.length],o=.35+(Math.sin(n*.37)+1)/2*.9,l=(n*17+11)%5!==0?o:0;return{...i,day:Mv(r),date:r,dateLabel:Cv(r),inputTokens:Math.round(i.inputTokens*l),cachedInputTokens:Math.round(i.cachedInputTokens*l),uncachedInputTokens:Math.round(i.uncachedInputTokens*l),outputTokens:Math.round(i.outputTokens*l),totalTokens:Math.round(i.totalTokens*l),costUsd:Pr(i.costUsd*l),durationMinutes:Math.round(i.durationMinutes*l)}})}function W1(e){return e.map(t=>({date:t.date,tokens:t.totalTokens,costUsd:t.costUsd,models:{}}))}function K1(e,t){const r=new Map;for(const i of e){const a=`${i.source}:${i.model}`,o=r.get(a)??{model:i.model,source:i.source,tokens:0,costUsd:0};o.tokens+=i.totalTokens,o.costUsd+=i.costUsd,r.set(a,o)}const n=Math.max(1,t);return[...r.values()].filter(i=>i.tokens>0).sort((i,a)=>a.tokens-i.tokens).map(i=>({...i,pct:i.tokens/n*100}))}function Mv(e){const r=(new Date(`${e}T00:00:00.000Z`).getUTCDay()+6)%7;return zo[r]}function Du(e){if(e.length<2)return{totalCostUsd:0,totalTokens:0,inputTokens:0,outputTokens:0};const t=Math.floor(e.length/2),r=id(e.slice(0,t)),n=id(e.slice(t));return{totalCostUsd:oa(n.totalCostUsd,r.totalCostUsd),totalTokens:oa(n.totalTokens,r.totalTokens),inputTokens:oa(n.inputTokens,r.inputTokens),outputTokens:oa(n.outputTokens,r.outputTokens)}}function id(e){const t=Math.max(1,e.length),r=e.reduce((n,i)=>({inputTokens:n.inputTokens+i.inputTokens,outputTokens:n.outputTokens+i.outputTokens,totalTokens:n.totalTokens+i.totalTokens,totalCostUsd:n.totalCostUsd+i.costUsd,totalDurationMinutes:n.totalDurationMinutes+i.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{inputTokens:r.inputTokens/t,outputTokens:r.outputTokens/t,totalTokens:r.totalTokens/t,totalCostUsd:r.totalCostUsd/t,totalDurationMinutes:r.totalDurationMinutes/t}}function aa(e,t){const r=new Map;for(const n of e){const i=t(n),a=r.get(i)??{tokens:0,costUsd:0,durationMinutes:0};a.tokens+=n.totalTokens,a.costUsd+=n.costUsd,a.durationMinutes+=n.durationMinutes,r.set(i,a)}return[...r.entries()].sort(([,n],[,i])=>i.tokens-n.tokens).map(([n,i],a)=>({id:H1(n),label:n,color:nd[a%nd.length],tokens:i.tokens,costUsd:Pr(i.costUsd),durationMinutes:i.durationMinutes}))}function oa(e,t){return t<=0?0:Math.round((e-t)/t*1e4)/100}function Ra(e,t){return t<=0?0:Math.round(e/t*1e3)/10}function H1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function Pr(e){return Math.round(e*100)/100}function Iv(e,t,r,n){const i=e.reduce((f,d)=>f+d.tokens,0),a=e.reduce((f,d)=>f+d.costUsd,0),o=an(),s=e.find(f=>f.date===o),l=(s==null?void 0:s.tokens)??(n==null?void 0:n.tokens)??0,u=(s==null?void 0:s.costUsd)??(n==null?void 0:n.costUsd)??0,c=G1(t,i);return{totalTokens:i,totalCostUsd:Math.round(a*1e8)/1e8,todayTokens:l,todayCostUsd:Math.round(u*1e8)/1e8,statsSince:r,bySource:c}}function G1(e,t){const r=new Map;for(const i of e){if(i.tokens<=0)continue;let a=r.get(i.source);a||(a={tokens:0,costUsd:0,models:new Map},r.set(i.source,a)),a.tokens+=i.tokens,a.costUsd+=i.costUsd;const o=a.models.get(i.model)??{tokens:0,costUsd:0};o.tokens+=i.tokens,o.costUsd+=i.costUsd,a.models.set(i.model,o)}const n=t>0?t:[...r.values()].reduce((i,a)=>i+a.tokens,0);return Array.from(r.entries()).map(([i,a])=>({source:i,tokens:a.tokens,costUsd:Math.round(a.costUsd*1e8)/1e8,pct:n>0?Math.round(a.tokens/n*1e3)/10:0,models:Array.from(a.models.entries()).map(([o,s])=>({model:o,tokens:s.tokens,costUsd:Math.round(s.costUsd*1e8)/1e8,pct:a.tokens>0?Math.round(s.tokens/a.tokens*1e3)/10:0})).sort((o,s)=>s.tokens-o.tokens)})).sort((i,a)=>a.tokens-i.tokens)}const ad=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],q1={claude:"claude-code",codex:"codex",cursor:"cursor",qoder:"qoder",trae:"trae",gemini:"gemini",opencode:"opencode",copilot:"copilot",antigravity:"antigravity",openclaw:"openclaw",hermes:"hermes",zcode:"zcode",dsh:"dsh",pi:"pi",kimi:"kimi",roocode:"roocode",droid:"droid",kiro:"kiro",cline:"cline",amp:"amp",qwen:"qwen-code",codebuddy:"codebuddy",workbuddy:"workbuddy",grok:"grok",mimo:"mimo","every-code":"every-code",omp:"omp","kilo-cli":"kilo-cli",kilocode:"kilocode",goose:"goose",zed:"zed",warp:"warp"};function Y1(e,t=new Date){const r=_u(void 0,t);return e.filter(n=>n.hour<=r)}function V1(e,t=new Date){return{...e,todayHourlyUsage:Y1(e.todayHourlyUsage,t)}}function X1(e,t){var y;if(e.dailyRows.length===0)return V1(oi);const r=an(),n=td(t),i=e.dailyRows.filter(b=>b.date>=n&&b.date<=r),a=td(Cu),o=e.dailyRows.filter(b=>b.date>=a&&b.date<=r),s=e.modelRows.filter(b=>b.tokens>0),l=Iv(i,s,((y=e.syncStatus)==null?void 0:y.statsSince)||e.summary.statsSince,{tokens:e.summary.todayTokens,costUsd:e.summary.todayCostUsd}),u=i.map(Ol),c=o.map(Ol),f=o.map(b=>({date:b.date,tokens:b.tokens,costUsd:b.costUsd,models:b.models??{},projects:b.projects})),d=tP(u),p=Nv(u),v=e.hourlyRows??[],m=$u(v,r,_u());return{summary:p,rangeDailyUsage:u,heatmapDailyUsage:c,heatmapDays:f,modelRows:s,hourlyApiRows:v,todayHourlyUsage:m,dailyUsage:d,hourlyUsage:[],changes:Du(u),distributions:Dv(l.bySource,s,e.projectRows,p),toolModelUsage:Mu(l.bySource,p.totalTokens),projectModelUsage:Iu(e.projectRows,p.totalTokens)}}function od(e){const t=/^(\d{4}-\d{2}-\d{2})/.exec(String(e).trim());return(t==null?void 0:t[1])??""}function $u(e,t,r){const n=r===void 0?23:Math.min(Math.max(r,0),23),i=od(t),a=new Map;for(const s of e){if(!i||od(s.date)!==i)continue;const l=Number(s.hour);if(!Number.isInteger(l)||l<0||l>23)continue;const u=a.get(l)??{tokens:0,costUsd:0,inputTokens:0,outputTokens:0,cachedInputTokens:0};u.tokens+=s.tokens,u.costUsd+=s.costUsd,u.inputTokens+=s.inputTokens,u.outputTokens+=s.outputTokens,u.cachedInputTokens+=s.cachedInputTokens,a.set(l,u)}const o=Ru(i||t);return Array.from({length:n+1},(s,l)=>{const u=a.get(l),c=_v[l]??String(l).padStart(2,"0");if(!u)return rP(o,l,c);const f=u.inputTokens,d=u.outputTokens,p=Math.min(f,u.cachedInputTokens);return{day:o,hour:l,hourLabel:c,inputTokens:f,cachedInputTokens:p,outputTokens:d,totalTokens:u.tokens>0?u.tokens:f+d,costUsd:u.costUsd,durationMinutes:0}})}function Z1(e,t){const r=e.heatmapDays.find(v=>v.date===t),n=e.heatmapDailyUsage.find(v=>v.date===t),i=r??{date:t,tokens:(n==null?void 0:n.totalTokens)??0,costUsd:(n==null?void 0:n.costUsd)??0,models:{}},a=n??Ol(i,e.heatmapDailyUsage.length),o=J1(e.modelRows),s=Q1(i,o),l=eP(i,o),u=Iv([i],s,""),c=Nv([a]),f=an(),d=t===f?_u():void 0,p=$u(e.hourlyApiRows,t,d);return{...e,summary:c,rangeDailyUsage:[a],modelRows:s,todayHourlyUsage:p,hourlyUsage:[],changes:Du([a]),distributions:Dv(u.bySource,s,l,c),toolModelUsage:Mu(u.bySource,c.totalTokens),projectModelUsage:Iu(l,c.totalTokens)}}function J1(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function Q1(e,t){const r=Object.entries(e.models??{}).filter(([,a])=>a>0);if(r.length===0)return[];const n=r.reduce((a,[,o])=>a+o,0),i=La(e.costUsd,r.map(([,a])=>a));return r.map(([a,o],s)=>{const l=Ti(a),u=l.source??t.get(l.model)??"unknown";return{model:l.model,source:u,tokens:o,costUsd:i[s]??0,pct:n>0?Math.round(o/n*1e3)/10:0}}).sort((a,o)=>o.tokens-a.tokens)}function eP(e,t){const r=new Map;for(const o of e.projects??[]){if(o.tokens<=0)continue;const s=Tu(o.project),l=r.get(s)??{project:s,tokens:0,models:{}};l.tokens+=o.tokens;for(const[u,c]of Object.entries(o.models??{}))c<=0||(l.models[u]=(l.models[u]??0)+c);r.set(s,l)}const n=Array.from(r.values());if(n.length===0)return[];const i=n.reduce((o,s)=>o+s.tokens,0),a=La(e.costUsd,n.map(o=>o.tokens));return n.map((o,s)=>{const l=Object.entries(o.models??{}).filter(([,f])=>f>0),u=La(a[s]??0,l.map(([,f])=>f)),c=l.map(([f,d],p)=>{const v=Ti(f),m=v.source??t.get(v.model)??"unknown";return{model:v.model,source:m,tokens:d,costUsd:u[p]??0,pct:o.tokens>0?Math.round(d/o.tokens*1e3)/10:0}}).sort((f,d)=>d.tokens-f.tokens);return{project:o.project,tokens:o.tokens,costUsd:a[s]??0,pct:i>0?Math.round(o.tokens/i*1e3)/10:0,models:c}}).sort((o,s)=>s.tokens-o.tokens)}function Ol(e,t){const r=oi.dailyUsage[t%oi.dailyUsage.length],n=Fs(r.inputTokens,r.totalTokens,.78),i=Fs(r.cachedInputTokens,r.inputTokens,.2),a=Math.round(e.tokens*n),o=Math.max(0,e.tokens-a),s=Math.min(a,Math.round(a*i)),l=Math.round(e.tokens*Fs(oi.summary.totalDurationMinutes,oi.summary.totalTokens,0));return{day:Ru(e.date),date:e.date,dateLabel:Rv(e.date),inputTokens:a,cachedInputTokens:s,uncachedInputTokens:a-s,outputTokens:o,totalTokens:e.tokens,costUsd:aP(e.costUsd),durationMinutes:l}}function tP(e){var n;const t=new Map(e.map(i=>[i.date,i])),r=$v(((n=e.at(-1))==null?void 0:n.date)??new Date().toISOString());return Array.from({length:7},(i,a)=>{const o=new Date(r);o.setUTCDate(r.getUTCDate()-(6-a));const s=o.toISOString().slice(0,10),l=t.get(s);return l||{day:Ru(s),date:s,dateLabel:Rv(s),inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}})}function Nv(e){return Nu(e.map(t=>({day:t.day,hour:0,hourLabel:"00",inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd,durationMinutes:t.durationMinutes})))}function rP(e,t,r){return{day:e,hour:t,hourLabel:r,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}}function nP(e){const t=new Map;for(const r of e){const n=Tu(r.project),i=n==="unknown"?"未知项目":n,a=t.get(n)??{label:i,tokens:0,costUsd:0};a.tokens+=r.tokens,a.costUsd+=r.costUsd,t.set(n,a)}return Array.from(t.values())}function Dv(e,t,r,n){const i=e.map(o=>({label:q1[o.source]??o.source,tokens:o.tokens,costUsd:o.costUsd})),a=new Map;for(const o of t){const s=a.get(o.model)??{label:o.model,tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,a.set(o.model,s)}return{tools:i.length>0?Bs(i,n,6):[],models:a.size>0?Bs([...a.values()],n,6):[],terminals:[],projects:r.length>0?Bs(nP(r),n,6):[]}}function Bs(e,t,r=8){const n=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens),i=n.slice(0,r),a=n.slice(r);a.length>0&&i.push({label:"其他",tokens:a.reduce((u,c)=>u+c.tokens,0),costUsd:a.reduce((u,c)=>u+c.costUsd,0)});const o=jl(t.totalTokens,i.map(u=>u.tokens)),s=La(t.totalCostUsd,i.map(u=>u.costUsd||u.tokens)),l=jl(t.totalDurationMinutes,i.map(u=>u.tokens));return i.map((u,c)=>({id:iP(u.label)||`item-${c}`,label:u.label,color:ad[c%ad.length],tokens:o[c]??0,costUsd:s[c]??0,durationMinutes:l[c]??0}))}function jl(e,t){if(t.length===0)return[];const r=Math.max(0,Math.round(e)),n=t.reduce((l,u)=>l+Math.max(0,u),0);if(n<=0)return t.map(()=>0);const i=t.map(l=>Math.max(0,l)/n*r),a=i.map(Math.floor);let o=r-a.reduce((l,u)=>l+u,0);const s=i.map((l,u)=>({index:u,fraction:l-Math.floor(l)})).sort((l,u)=>u.fraction-l.fraction);for(let l=0;l<o;l+=1){const u=s[l%s.length];a[u.index]+=1}return a}function La(e,t){return jl(Math.round(e*100),t).map(r=>r/100)}function Fs(e,t,r){return t>0?e/t:r}function Ru(e){const r=($v(e).getUTCDay()+6)%7;return zo[r]}function $v(e){return new Date(`${e.slice(0,10)}T00:00:00.000Z`)}function Rv(e){const[,t="",r=""]=e.slice(0,10).split("-");return`${Number(t)}/${Number(r)}`}function iP(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function aP(e){return Math.round(e*100)/100}function Lv(e=[],t=[]){if(e.length>0)return e.filter(i=>i.tokens>0).map(i=>i.source);const r=new Set,n=[];for(const i of t)i.tokens<=0||r.has(i.source)||(r.add(i.source),n.push(i.source));return n}function Uv(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function zv(e,t){if(t==null)return e;const r=new Set(e);return t.filter(n=>r.has(n))}function sd(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t}function $n(e,t){if(t.has(e))return!0;const r=sd(e);for(const n of t)if(sd(n)===r)return!0;return!1}function Bv(e,t,r,n){if(t==null&&r==null)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=Object.entries(e).filter(([,l])=>l>0);if(i.length===0)return n.fallbackShare;const a=t==null?null:new Set(n.activeSources);let o=0,s=0;for(const[l,u]of i){o+=u;const c=Ti(l),f=c.source??n.sourceFallback.get(c.model)??"unknown";c.model,!(a&&!$n(f,a))&&(s+=u)}return o>0?s/o:0}function Fv(e,t,r,n){if(t==null&&r==null||e.length===0)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=t==null?null:new Set(n.activeSources);let a=0,o=0;for(const s of e)s.tokens<=0||(a+=s.tokens,!(i&&!$n(s.source,i))&&(o+=s.tokens));return a>0?o/a:0}function oP(e,t,r){if(t==null)return e;if(r.activeSources.length===0)return{};const n=new Set(r.activeSources),i={};for(const[a,o]of Object.entries(e)){if(o<=0)continue;const s=Ti(a),l=s.source??r.sourceFallback.get(s.model)??"unknown";$n(l,n)&&(i[a]=o)}return i}function sP(e){if(e.selectedSources.length===0)return{dailyRows:e.dailyRows,hourlyRows:e.hourlyRows};const t=e.selectedSources,r=Lv(e.toolRows,e.modelRows),n=zv(r,t),i=Uv(e.modelRows),a=Fv(e.modelRows,t,null,{activeSources:n}),o=new Map(e.heatmapDays.map(f=>[f.date,f])),s=f=>{const d=o.get(f);return d?Bv(d.models??{},t,null,{activeSources:n,sourceFallback:i,fallbackShare:a}):a},l=e.dailyRows.map(f=>cP(f,s(f.date))),u=e.hourlyDate;let c=e.hourlyRows;if(u!=null)if(e.hourlyApiRows.length===0)c=e.hourlyRows.map(f=>fP(f,s(u)));else{const f=new Set(n),d=n.length===0?[]:e.hourlyApiRows.filter(v=>$n(v.source||"unknown",f)),p=e.hourlyRows.length>0?Math.max(...e.hourlyRows.map(v=>v.hour)):void 0;c=$u(d,u,p)}return{dailyRows:l,hourlyRows:c}}function lP(e,t){if(t.length===0)return e;const r=new Set(t),n=[];for(const i of e){const a=i.models.filter(l=>$n(l.source,r));if(a.length===0)continue;const o=a.reduce((l,u)=>l+u.tokens,0);if(o<=0)continue;const s=a.reduce((l,u)=>l+u.costUsd,0);n.push({...i,tokens:o,costUsd:s,models:a.map(l=>({...l,pct:o>0?Math.round(l.tokens/o*1e3)/10:0}))})}return n.sort((i,a)=>a.tokens-i.tokens)}function uP(e){const t=e.filter(a=>a.tokens>0).sort((a,o)=>o.tokens-a.tokens),r=t.map((a,o)=>({id:a.source,label:qe(a.source),color:Da(o),tokens:a.tokens,costUsd:a.costUsd,durationMinutes:0})),n=new Map;for(const a of t)for(const o of a.models){if(!o.model||o.tokens<=0)continue;const s=n.get(o.model)??{tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,n.set(o.model,s)}const i=[...n.entries()].sort(([,a],[,o])=>o.tokens-a.tokens).map(([a,o],s)=>({id:a,label:a,color:Da(s),tokens:o.tokens,costUsd:o.costUsd,durationMinutes:0}));return{tools:r,models:i}}function cP(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,uncachedInputTokens:Math.max(0,r-n),outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}function fP(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}const Ws=14,Hr=3,Lu=18,ld=52,dP=80,hP=340,Ks=156,pP=["日","一","二","三","四","五","六"],mP=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];function vP(e,t){const r=Math.max(0,t-1)*Hr,n=Math.max(0,e-Lu-r);return Math.max(1,Math.floor(n/t)||1)}function gP(e){const t=h.useRef(null),[r,n]=h.useState(Ws),[i,a]=h.useState(e);return h.useEffect(()=>{const o=t.current;if(!o||e<=0)return;const s=()=>{const u=o.clientWidth,c=Math.floor((u-Lu+Hr)/(Ws+Hr)),f=Math.max(1,Math.min(e,c||1));f>=e?(a(e),n(vP(u,e))):(a(f),n(Ws))};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),()=>{l.disconnect(),window.removeEventListener("resize",s)}},[e]),{containerRef:t,cellSize:r,visibleWeeks:i}}function yP({cell:e,heatmapColors:t,modelEntries:r,isLoading:n}){const i=r;return g.jsxs("div",{className:"grid min-w-0 gap-2 text-xs",children:[g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsx("span",{className:"font-medium text-foreground",children:e.day}),g.jsxs("span",{className:"text-[10px] text-muted",children:["等级 ",e.level]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-full",style:{background:t[e.level]}}),g.jsx("span",{className:"flex-1 text-muted",children:"总用量"}),g.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",title:Pn(e.value),children:oe(e.value)})]}),n?g.jsxs("div",{"aria-label":"正在加载模型明细",className:"grid gap-2 pt-0.5",children:[g.jsx("span",{className:"h-2.5 w-14 animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-3 w-full animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-1 w-full animate-pulse rounded bg-surface-secondary"})]}):i.length>0?g.jsxs("div",{className:"grid gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:"模型明细"}),i.map(({key:a,name:o,source:s,val:l})=>{const u=e.value||1,c=Math.round(l/u*100),f=s?`${qe(s)} · ${o}`:o;return g.jsxs("div",{className:"grid min-w-0 gap-1",children:[g.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3",children:[g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 overflow-hidden",children:[s&&g.jsx(xr,{className:"shrink-0",provider:s,size:12}),g.jsx("span",{className:"truncate",title:f,children:f})]}),g.jsxs("span",{className:"whitespace-nowrap font-mono text-muted tabular-nums",title:Pn(l),children:[oe(l)," · ",c,"%"]})]}),g.jsx("div",{className:"h-1 overflow-hidden rounded-full bg-surface-secondary",children:g.jsx("div",{className:"h-full rounded-full bg-accent",style:{width:`${c}%`}})})]},a)})]}):null]})}function bP(e,t,r){const n=Object.entries(e.models??{}).map(([o,s])=>{const l=Ti(o),u=l.source??t.get(l.model);return{key:o,name:l.model,source:u,val:s}}).filter(({val:o,source:s})=>o<=0?!1:r?s?$n(s,r):!1:!0).sort((o,s)=>s.val-o.val),i=n.slice(0,6),a=new Set(i.map(o=>o.source).filter(Boolean));for(const o of n.slice(6))o.source&&!a.has(o.source)&&(i.push(o),a.add(o.source));return i}const xP=h.memo(function({visible:t,cellSize:r,selectedDate:n,onSelectDate:i,onPointerOver:a,onPointerLeave:o,onFocus:s,onBlur:l}){return g.jsx("div",{style:{gridColumn:"2 / -1",display:"grid",gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${r}px)`,gridTemplateColumns:`repeat(${t.length}, ${r}px)`,gap:Hr},onBlur:l,onFocus:s,onPointerLeave:o,onPointerOver:a,children:t.map((u,c)=>u.map((f,d)=>{if(!f)return null;const p=kl[f.level]??kl[0],v=n===f.day;return g.jsx("button",{"aria-label":`${f.day},${Pn(f.value)} Token`,"aria-pressed":i?v:void 0,className:v?"block cursor-pointer rounded-[3px] ring-1 ring-accent transition-[transform,background-color] duration-100 hover:scale-110":"block cursor-pointer rounded-[3px] transition-[transform,background-color] duration-100 hover:scale-110","data-day-index":d,"data-day":f.day,"data-week-index":c,style:{width:r,height:r,background:p},type:"button",onClick:()=>i==null?void 0:i(f.day)},f.day||`e-${c}-${d}`)}))})});function wP({days:e,models:t=[],toolRows:r=[],embedded:n=!1,hidePlatformFilter:i=!1,selectedSources:a,onSelectedSourcesChange:o,selectedDate:s=null,onSelectDate:l}){const{theme:u}=Cw(),[c,f]=h.useState(null),d=a??c,p=o??f,v=h.useMemo(()=>T1(t),[t]),m=h.useMemo(()=>Lv(r,t),[t,r]),y=h.useMemo(()=>zv(m,d),[m,d]),b=h.useMemo(()=>Uv(t),[t]),x=h.useMemo(()=>Fv(t,d,null,{activeSources:y}),[y,t,d]),w=h.useMemo(()=>d==null?e:e.map(C=>{const W=C.models??{},I=Bv(W,d,null,{activeSources:y,sourceFallback:b,fallbackShare:x}),Te=oP(W,d,{activeSources:y,sourceFallback:b});return{...C,tokens:Math.round(C.tokens*I),costUsd:C.costUsd*I,models:Te}}),[y,e,x,d,b]),P=h.useMemo(()=>j1(w.map(C=>({date:C.date,tokens:C.tokens,models:C.models})),ld),[w]),O=P.weeks,{containerRef:k,cellSize:j,visibleWeeks:E}=gP(O.length||ld),_=h.useMemo(()=>O.slice(-E),[O,E]),M=kl,T=h.useMemo(()=>A1(_.length,P.to,mP),[_.length,P.to]),[S,N]=h.useState(null),D=h.useRef(null),z=h.useRef(0),K=h.useCallback(C=>{D.current=C,N(C)},[]);h.useEffect(()=>()=>{window.clearTimeout(z.current)},[]);const F=h.useCallback(C=>{var We,_t;const W=C.dataset.day,I=Number(C.dataset.weekIndex),Te=Number(C.dataset.dayIndex),te=(We=_[I])==null?void 0:We[Te];if(!W||!te||(window.clearTimeout(z.current),((_t=D.current)==null?void 0:_t.day)===W)||!C.isConnected)return;const Ce=C.getBoundingClientRect();K({day:W,cell:te,left:Ce.left+Ce.width/2,top:Ce.top,bottom:Ce.bottom})},[K,_]),H=h.useCallback(()=>{window.clearTimeout(z.current),z.current=window.setTimeout(()=>K(null),dP)},[K]),B=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),X=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),ye=S!=null;h.useEffect(()=>{if(!ye)return;const C=()=>K(null);return window.addEventListener("scroll",C,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",C,{capture:!0})},[ye,K]);const ne=`${Lu}px repeat(${_.length}, ${j}px)`,Ze=d==null?m:d.filter(C=>m.includes(C)),Le=h.useMemo(()=>d==null?null:new Set(y),[y,d]),_e=(S==null?void 0:S.cell)??null,[ot,Yt]=h.useState(null);if(h.useEffect(()=>{if(!_e){Yt(null);return}Yt(null);const C=window.requestAnimationFrame(()=>{Yt({day:_e.day,entries:bP(_e,v,Le)})});return()=>window.cancelAnimationFrame(C)},[v,Le,_e]),!O.length)return g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"暂无用量数据"});let Ue=null;if(S&&_e){const C=S.top<hP,W=Math.min(Math.max(S.left,Ks),Math.max(Ks,window.innerWidth-Ks));Ue=_i.createPortal(g.jsx("div",{className:"pointer-events-none fixed z-50 w-72 max-w-[calc(100vw-24px)] rounded-[10px] border-0 bg-overlay p-3 text-overlay-foreground shadow-surface",role:"tooltip",style:{left:W,top:C?S.bottom+8:S.top-8,transform:C?"translateX(-50%)":"translate(-50%, -100%)"},children:g.jsx(yP,{cell:_e,heatmapColors:M,isLoading:(ot==null?void 0:ot.day)!==_e.day,modelEntries:(ot==null?void 0:ot.day)===_e.day?ot.entries:[]})}),document.body)}const R=g.jsxs("div",{ref:k,className:"w-full min-w-0",children:[!i||!n?g.jsxs("div",{className:"mb-2 flex items-center justify-end gap-3",children:[n?null:g.jsx("span",{className:"mr-auto text-xs text-muted",children:rd()}),i?null:g.jsx(x1,{allSources:m,value:Ze,onChange:C=>w1(C,m,p)})]}):null,d!=null&&y.length===0?g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"请至少选择一个平台"}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-full overflow-hidden",children:g.jsxs("div",{className:"w-full min-w-0",children:[g.jsxs("div",{className:"mb-1.5 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("span",{}),T.map(C=>g.jsx("span",{style:{gridColumnStart:C.index+2,whiteSpace:"nowrap"},children:C.label},`${C.label}-${C.index}`))]}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("div",{className:"pr-1 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateRows:`repeat(7, ${j}px)`,rowGap:Hr},children:pP.map(C=>g.jsx("span",{className:"flex items-center",style:{lineHeight:1},children:C},C))}),g.jsx(xP,{cellSize:j,onBlur:H,onFocus:X,onPointerLeave:H,onPointerOver:B,onSelectDate:l,selectedDate:s,visible:_})]})]})}),g.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:rd()}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[10px] text-muted",children:"少"}),g.jsx("div",{className:"flex gap-1",children:M.map((C,W)=>g.jsx("span",{className:"size-3 rounded-[2px]",style:{background:C}},W))}),g.jsx("span",{className:"text-[10px] text-muted",children:"多"})]})]}),Ue]})]});return n?R:g.jsx(q,{children:g.jsx(q.Content,{children:R})})}function PP({dailyUsage:e,heatmapDays:t,modelRows:r=[],metricTrends:n,summary:i,selectedDate:a=null,onSelectDate:o}){const s=[{label:"预估费用",value:i.totalCostUsd,format:at,exactFormat:at,trend:{comparison:n.totalCostUsd,display:"percent",values:e.map(l=>l.costUsd)}},{label:"总 Token",value:i.totalTokens,format:oe,exactFormat:Pn,trend:{comparison:n.totalTokens,display:"percent",values:e.map(l=>l.totalTokens)}},{label:"输入 Token",value:i.inputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.inputTokens,display:"tokens",values:e.map(l=>l.inputTokens)}},{label:"输出 Token",value:i.outputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.outputTokens,display:"tokens",values:e.map(l=>l.outputTokens)}}];return g.jsxs("section",{"aria-label":"用量概览",className:"w-full",children:[g.jsx("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:s.map(l=>{var u;return g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid h-full grid-rows-[1.25rem_1fr] content-start gap-3 p-0",children:[g.jsxs("div",{className:"flex h-5 min-w-0 items-center justify-between gap-2",children:[g.jsx("p",{className:"min-w-0 truncate text-xs font-medium leading-5 text-muted",children:l.label}),g.jsx("div",{className:"flex h-5 shrink-0 items-center justify-end",children:l.trend.comparison?g.jsx(AP,{display:l.trend.display,trend:l.trend.comparison}):null})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(OP,{exactFormat:l.exactFormat,format:l.format,label:l.label,value:l.value}),g.jsx(jP,{isIncrease:(((u=l.trend.comparison)==null?void 0:u.changeValue)??0)>=0,label:`近 7 日${l.label}趋势`,values:l.trend.values})]})]})},l.label)})}),g.jsx(q,{className:"mt-4",children:g.jsx(q.Content,{children:g.jsx(kP,{days:t,modelRows:r,onSelectDate:o,selectedDate:a})})})]})}function kP({days:e,modelRows:t,selectedDate:r,onSelectDate:n}){return g.jsx(wP,{days:e,embedded:!0,models:t,onSelectDate:n,selectedDate:r})}function OP({exactFormat:e,format:t,label:r,value:n}){const i=SP(n);return g.jsx("div",{"aria-label":`${r} ${e(n)}`,className:"min-w-0 truncate text-lg font-semibold leading-7 tracking-tight text-foreground tabular-nums",title:e(n),children:t(i)})}function jP({label:e,values:t,isIncrease:r}){const n=h.useId().replace(/:/g,""),i=h.useMemo(()=>t.filter(p=>Number.isFinite(p)),[t]);if(i.length<2)return g.jsx("div",{"aria-hidden":"true",className:"h-6 w-16 justify-self-end"});const a=64,o=24,s=2,l=Math.min(...i),c=Math.max(...i)-l||1,f=r?"var(--chart-2)":"var(--chart-5)",d=i.map((p,v)=>{const m=s+v/Math.max(i.length-1,1)*(a-s*2),y=o-s-(p-l)/c*(o-s*2);return`${v===0?"M":"L"} ${m.toFixed(2)} ${y.toFixed(2)}`}).join(" ");return g.jsx("div",{"aria-label":e,className:"pointer-events-none h-6 w-16 justify-self-end",role:"img",children:g.jsxs("svg",{"aria-hidden":"true",className:"h-full w-full overflow-visible",viewBox:`0 0 ${a} ${o}`,children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:n,x1:"0",x2:"0",y1:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:f,stopOpacity:.24}),g.jsx("stop",{offset:"100%",stopColor:f,stopOpacity:0})]})}),g.jsx("path",{d:`${d} L ${a-s} ${o} L ${s} ${o} Z`,fill:`url(#${n})`}),g.jsx("path",{d,fill:"none",stroke:f,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})]})})}function AP({display:e,trend:t}){const r=t.changeValue>=0,n=r?"上涨":"下降",i=e==="tokens"?`${r?"+":"−"}${oe(Math.abs(t.changeValue))}`:`${Math.abs(t.changePct).toFixed(1)}%`;return g.jsxs(Na,{"aria-label":`${n} ${i}`,className:"shrink-0",color:r?"success":"danger",size:"sm",variant:"soft",children:[g.jsx("span",{"aria-hidden":"true",children:r?"↑":"↓"}),g.jsx(Na.Label,{className:"tabular-nums",children:i})]})}function SP(e,t=1200){const[r,n]=h.useState(e),i=h.useRef(e);return h.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){i.current=e,n(e);return}const a=i.current;if(Object.is(a,e)||Math.abs(a-e)<1e-9){i.current=e,n(e);return}let o=0;const s=performance.now(),l=u=>{const c=Math.min((u-s)/t,1),f=1-Math.pow(1-c,3),d=a+(e-a)*f;i.current=d,n(d),c<1&&(o=requestAnimationFrame(l))};return o=requestAnimationFrame(l),()=>cancelAnimationFrame(o)},[t,e]),r}const Ua=[{id:"hawking",image:Mw,glow:{primary:"#ff7a1a",accent:"#ffd21f"}},{id:"yoyo",image:Iw,glow:{primary:"#2f7df6",accent:"#ffd84a"}},{id:"click",image:Nw,glow:{primary:"#51d6a2",accent:"#ff7b8d"}}],un=72,EP=110,_P=2400,ud=80,cd=88;function fd(e){const t=Ua.filter(n=>n.id!==e),r=t.length>0?t:Ua;return r[Math.floor(Math.random()*r.length)].id}function TP(){const[e,t]=h.useState(()=>fd()),r=h.useRef(null);h.useEffect(()=>{const a=window.setInterval(()=>{t(o=>fd(o))},_P);return()=>window.clearInterval(a)},[]),h.useEffect(()=>{const a=r.current;if(!a)return;let o=0,s=null,l=-un,u=1;const c=f=>{if(o=requestAnimationFrame(c),s==null){s=f;return}const d=Math.min(.05,(f-s)/1e3);s=f,l+=u*EP*d,l>=un?(l=un,u=-1):l<=-un&&(l=-un,u=1),a.style.transform=`translateX(${l}px) scaleX(${u>0?1:-1})`};return o=requestAnimationFrame(c),()=>cancelAnimationFrame(o)},[e]);const n=Ua.find(a=>a.id===e)??Ua[0],i=ud+un*2;return g.jsx("div",{"aria-hidden":"true",className:"pet-running-loader",style:{width:i,height:cd,"--pet-glow-primary":n.glow.primary,"--pet-glow-accent":n.glow.accent},children:g.jsx("img",{alt:"",className:"pet-running-loader__sprite",height:cd,ref:r,src:n.image,width:ud})})}const dd=["小伙伴跑腿去了…","数据在前面,冲!","再跑两步就好…","正在追 Token…","加载加速中,呼呼~","马上就回来~","别急,它跑得很快","捡数据路上…"],CP=1800;function Hs(e){const t=dd.filter(n=>n!==e),r=t.length>0?t:dd;return r[Math.floor(Math.random()*r.length)]}function hd({visible:e}){const[t,r]=h.useState(()=>Hs());return h.useEffect(()=>{if(!e)return;r(Hs());const n=window.setInterval(()=>{r(i=>Hs(i))},CP);return()=>window.clearInterval(n)},[e]),e?g.jsx("div",{"aria-busy":"true","aria-live":"polite",className:"absolute inset-0 z-10 bg-background/40",role:"status",children:g.jsx("div",{className:"pointer-events-none fixed inset-0 z-10 flex items-center justify-center",children:g.jsxs("div",{className:"relative flex items-center justify-center",children:[g.jsx(TP,{}),g.jsx("p",{className:"absolute top-full mt-3 min-h-5 w-max text-center text-sm text-muted transition-opacity duration-200",children:t},t)]})})}):null}var MP=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Uu(e){if(typeof e!="string")return!1;var t=MP;return t.includes(e)}var IP=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],NP=new Set(IP);function Wv(e){return typeof e!="string"?!1:NP.has(e)}function Kv(e){return typeof e=="string"&&e.startsWith("data-")}function et(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Wv(r)||Kv(r))&&(t[r]=e[r]);return t}function Xr(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return et(t)}return typeof e=="object"&&!Array.isArray(e)?et(e):null}function Ve(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Wv(r)||Kv(r)||Uu(r))&&(t[r]=e[r]);return t}function DP(e){return e==null?null:h.isValidElement(e)?Ve(e.props):typeof e=="object"&&!Array.isArray(e)?Ve(e):null}var $P=["children","width","height","viewBox","className","style","title","desc"];function Al(){return Al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Al.apply(null,arguments)}function RP(e,t){if(e==null)return{};var r,n,i=LP(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function LP(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Hv=h.forwardRef((e,t)=>{var{children:r,width:n,height:i,viewBox:a,className:o,style:s,title:l,desc:u}=e,c=RP(e,$P),f=a||{width:n,height:i,x:0,y:0},d=Z("recharts-surface",o);return h.createElement("svg",Al({},Ve(c),{className:d,width:n,height:i,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,u),r)}),UP=["children","className"];function Sl(){return Sl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sl.apply(null,arguments)}function zP(e,t){if(e==null)return{};var r,n,i=BP(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function BP(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var he=h.forwardRef((e,t)=>{var{children:r,className:n}=e,i=zP(e,UP),a=Z("recharts-layer",n);return h.createElement("g",Sl({className:a},Ve(i),{ref:t}),r)}),FP=h.createContext(null);function ae(e){return function(){return e}}const Gv=Math.cos,za=Math.sin,St=Math.sqrt,Ba=Math.PI,Bo=2*Ba,El=Math.PI,_l=2*El,Rr=1e-6,WP=_l-Rr;function qv(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function KP(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return qv;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class HP{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?qv:KP(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,a,o){this._append`C${+t},${+r},${+n},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(t,r,n,i,a){if(t=+t,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=n-t,u=i-r,c=o-t,f=s-r,d=c*c+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Rr)if(!(Math.abs(f*l-u*c)>Rr)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-o,v=i-s,m=l*l+u*u,y=p*p+v*v,b=Math.sqrt(m),x=Math.sqrt(d),w=a*Math.tan((El-Math.acos((m+d-y)/(2*b*x)))/2),P=w/x,O=w/b;Math.abs(P-1)>Rr&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*p>c*v)},${this._x1=t+O*l},${this._y1=r+O*u}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(i),l=n*Math.sin(i),u=t+s,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${u},${c}`:(Math.abs(this._x1-u)>Rr||Math.abs(this._y1-c)>Rr)&&this._append`L${u},${c}`,n&&(d<0&&(d=d%_l+_l),d>WP?this._append`A${n},${n},0,1,${f},${t-s},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=c}`:d>Rr&&this._append`A${n},${n},0,${+(d>=El)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function zu(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new HP(t)}function Bu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Yv(e){this._context=e}Yv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Fo(e){return new Yv(e)}function Vv(e){return e[0]}function Xv(e){return e[1]}function Zv(e,t){var r=ae(!0),n=null,i=Fo,a=null,o=zu(s);e=typeof e=="function"?e:e===void 0?Vv:ae(e),t=typeof t=="function"?t:t===void 0?Xv:ae(t);function s(l){var u,c=(l=Bu(l)).length,f,d=!1,p;for(n==null&&(a=i(p=o())),u=0;u<=c;++u)!(u<c&&r(f=l[u],u,l))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(f,u,l),+t(f,u,l));if(p)return a=null,p+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:ae(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),s):t},s.defined=function(l){return arguments.length?(r=typeof l=="function"?l:ae(!!l),s):r},s.curve=function(l){return arguments.length?(i=l,n!=null&&(a=i(n)),s):i},s.context=function(l){return arguments.length?(l==null?n=a=null:a=i(n=l),s):n},s}function sa(e,t,r){var n=null,i=ae(!0),a=null,o=Fo,s=null,l=zu(u);e=typeof e=="function"?e:e===void 0?Vv:ae(+e),t=typeof t=="function"?t:ae(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?Xv:ae(+r);function u(f){var d,p,v,m=(f=Bu(f)).length,y,b=!1,x,w=new Array(m),P=new Array(m);for(a==null&&(s=o(x=l())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===b)if(b=!b)p=d,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),v=d-1;v>=p;--v)s.point(w[v],P[v]);s.lineEnd(),s.areaEnd()}b&&(w[d]=+e(y,d,f),P[d]=+t(y,d,f),s.point(n?+n(y,d,f):w[d],r?+r(y,d,f):P[d]))}if(x)return s=null,x+""||null}function c(){return Zv().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:ae(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:ae(+f),u):r},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(r)},u.lineX1=function(){return c().x(n).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:ae(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),u):a},u}class Jv{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function GP(e){return new Jv(e,!0)}function qP(e){return new Jv(e,!1)}const Fu={draw(e,t){const r=St(t/Ba);e.moveTo(r,0),e.arc(0,0,r,0,Bo)}},YP={draw(e,t){const r=St(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},Qv=St(1/3),VP=Qv*2,XP={draw(e,t){const r=St(t/VP),n=r*Qv;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},ZP={draw(e,t){const r=St(t),n=-r/2;e.rect(n,n,r,r)}},JP=.8908130915292852,eg=za(Ba/10)/za(7*Ba/10),QP=za(Bo/10)*eg,ek=-Gv(Bo/10)*eg,tk={draw(e,t){const r=St(t*JP),n=QP*r,i=ek*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=Bo*a/5,s=Gv(o),l=za(o);e.lineTo(l*r,-s*r),e.lineTo(s*n-l*i,l*n+s*i)}e.closePath()}},Gs=St(3),rk={draw(e,t){const r=-St(t/(Gs*3));e.moveTo(0,r*2),e.lineTo(-Gs*r,-r),e.lineTo(Gs*r,-r),e.closePath()}},dt=-.5,ht=St(3)/2,Tl=1/St(12),nk=(Tl/2+1)*3,ik={draw(e,t){const r=St(t/nk),n=r/2,i=r*Tl,a=n,o=r*Tl+r,s=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(s,l),e.lineTo(dt*n-ht*i,ht*n+dt*i),e.lineTo(dt*a-ht*o,ht*a+dt*o),e.lineTo(dt*s-ht*l,ht*s+dt*l),e.lineTo(dt*n+ht*i,dt*i-ht*n),e.lineTo(dt*a+ht*o,dt*o-ht*a),e.lineTo(dt*s+ht*l,dt*l-ht*s),e.closePath()}};function ak(e,t){let r=null,n=zu(i);e=typeof e=="function"?e:ae(e||Fu),t=typeof t=="function"?t:ae(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:ae(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Fa(){}function Wa(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function tg(e){this._context=e}tg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Wa(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Wa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ok(e){return new tg(e)}function rg(e){this._context=e}rg.prototype={areaStart:Fa,areaEnd:Fa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Wa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function sk(e){return new rg(e)}function ng(e){this._context=e}ng.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Wa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function lk(e){return new ng(e)}function ig(e){this._context=e}ig.prototype={areaStart:Fa,areaEnd:Fa,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function uk(e){return new ig(e)}function pd(e){return e<0?-1:1}function md(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(pd(a)+pd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function vd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function qs(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-n)/3;e._context.bezierCurveTo(n+s,i+s*t,a-s,o-s*r,a,o)}function Ka(e){this._context=e}Ka.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qs(this,this._t0,vd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,qs(this,vd(this,r=md(this,e,t)),r);break;default:qs(this,this._t0,r=md(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function ag(e){this._context=new og(e)}(ag.prototype=Object.create(Ka.prototype)).point=function(e,t){Ka.prototype.point.call(this,t,e)};function og(e){this._context=e}og.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function ck(e){return new Ka(e)}function fk(e){return new ag(e)}function sg(e){this._context=e}sg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=gd(e),i=gd(t),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function gd(e){var t,r=e.length-1,n,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function dk(e){return new sg(e)}function Wo(e,t){this._context=e,this._t=t}Wo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function hk(e){return new Wo(e,.5)}function pk(e){return new Wo(e,0)}function mk(e){return new Wo(e,1)}function Zr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,s=a.length;r<o;++r)for(i=a,a=e[t[r]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function Cl(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function vk(e,t){return e[t]}function gk(e){const t=[];return t.key=e,t}function yk(){var e=ae([]),t=Cl,r=Zr,n=vk;function i(a){var o=Array.from(e.apply(this,arguments),gk),s,l=o.length,u=-1,c;for(const f of a)for(s=0,++u;s<l;++s)(o[s][u]=[0,+n(f,o[s].key,u,a)]).data=f;for(s=0,c=Bu(t(o));s<l;++s)o[c[s]].index=s;return r(o,c),o}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:ae(Array.from(a)),i):e},i.value=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),i):n},i.order=function(a){return arguments.length?(t=a==null?Cl:typeof a=="function"?a:ae(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(r=a??Zr,i):r},i}function bk(e,t){if((n=e.length)>0){for(var r,n,i=0,a=e[0].length,o;i<a;++i){for(o=r=0;r<n;++r)o+=e[r][i][1]||0;if(o)for(r=0;r<n;++r)e[r][i][1]/=o}Zr(e,t)}}function xk(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,a=n.length;r<a;++r){for(var o=0,s=0;o<i;++o)s+=e[o][r][1]||0;n[r][1]+=n[r][0]=-s/2}Zr(e,t)}}function wk(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n<a;++n){for(var s=0,l=0,u=0;s<o;++s){for(var c=e[t[s]],f=c[n][1]||0,d=c[n-1][1]||0,p=(f-d)/2,v=0;v<s;++v){var m=e[t[v]],y=m[n][1]||0,b=m[n-1][1]||0;p+=y-b}l+=f,u+=p*f}i[n-1][1]+=i[n-1][0]=r,l&&(r-=u/l)}i[n-1][1]+=i[n-1][0]=r,Zr(e,t)}}function Ml(e){return e==="__proto__"}function lg(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function Wu(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function ug(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(ug).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function Ku(e){if(Array.isArray(e))return e.map(Wu);if(typeof e=="symbol")return[e];e=ug(e);const t=[],r=e.length;if(r===0)return t;let n=0,i="",a="",o=!1;for(e.charCodeAt(0)===46&&t.push("");n<r;){const s=e[n];if(a)s==="\\"&&n+1<r?(n++,i+=e[n]):s===a?a="":i+=s;else if(o)s==='"'||s==="'"?a=s:s==="]"?(o=!1,t.push(i),i=""):i+=s;else if(s==="[")o=!0,i&&(t.push(i),i="");else if(s==="."){i&&(t.push(i),i="");const l=e[n+1];(l===void 0||l===".")&&t.push("")}else i+=s;n++}return i&&t.push(i),t}function zt(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(Ml(t))return r;const n=e[t];return n===void 0?lg(t)&&!Object.hasOwn(e,t)?zt(e,Ku(t),r):r:n}case"number":case"symbol":{typeof t=="number"&&(t=Wu(t));const n=e[t];return n===void 0?r:n}default:{if(Array.isArray(t))return Pk(e,t,r);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),Ml(t))return r;const n=e[t];return n===void 0?r:n}}}function Pk(e,t,r){if(t.length===0)return r;let n=e;for(let i=0;i<t.length;i++){if(n==null||Ml(t[i]))return r;n=n[t[i]]}return n===void 0?r:n}var kk=4;function gr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kk,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function ve(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce((i,a,o)=>{var s=r[o-1];return typeof s=="string"?i+s+a:s!==void 0?i+gr(s)+a:i+a},"")}var Ne=e=>e===0?0:e>0?1:-1,jt=e=>typeof e=="number"&&e!=+e,Jr=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,$=e=>(typeof e=="number"||e instanceof Number)&&!jt(e),Bt=e=>$(e)||typeof e=="string",Ok=0,di=e=>{var t=++Ok;return"".concat(e||"").concat(t)},Ye=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!$(t)&&typeof t!="string")return n;var a;if(Jr(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return jt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},cg=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[String(e[n])])r[String(e[n])]=!0;else return!0;return!1};function Q(e,t,r){return $(e)&&$(t)?gr(e+r*(t-e)):t}function fg(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):zt(n,t))===r)}var ce=e=>e===null||typeof e>"u",Ci=e=>ce(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function nt(e){return e!=null}function ar(){}var jk=["type","size","sizeType"];function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Il.apply(null,arguments)}function yd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yd(Object(r),!0).forEach(function(n){Ak(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ak(e,t,r){return(t=Sk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sk(e){var t=Ek(e,"string");return typeof t=="symbol"?t:t+""}function Ek(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _k(e,t){if(e==null)return{};var r,n,i=Tk(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Tk(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var dg={symbolCircle:Fu,symbolCross:YP,symbolDiamond:XP,symbolSquare:ZP,symbolStar:tk,symbolTriangle:rk,symbolWye:ik},Ck=Math.PI/180,Mk=e=>{var t="symbol".concat(Ci(e));return dg[t]||Fu},Ik=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Ck;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Nk=(e,t)=>{dg["symbol".concat(Ci(e))]=t},hg=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=_k(e,jk),a=bd(bd({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var s=()=>{var d=Mk(o),p=ak().type(d).size(Ik(r,n,o)),v=p();if(v!==null)return v},{className:l,cx:u,cy:c}=a,f=Ve(a);return $(u)&&$(c)&&$(r)?h.createElement("path",Il({},f,{className:Z("recharts-symbols",l),transform:"translate(".concat(u,", ").concat(c,")"),d:s()})):null};hg.registerSymbol=Nk;var pg=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Hu=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{Uu(i)&&typeof r[i]=="function"&&(n[i]=(a=>r[i](r,a)))}),n},Dk=(e,t,r)=>n=>(e(t,r,n),null),Ko=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];Uu(i)&&typeof a=="function"&&(n||(n={}),n[i]=Dk(a,t,r))}),n};function xd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $k(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xd(Object(r),!0).forEach(function(n){Rk(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rk(e,t,r){return(t=Lk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lk(e){var t=Uk(e,"string");return typeof t=="symbol"?t:t+""}function Uk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function je(e,t){var r=$k({},e),n=t,i=Object.keys(t),a=i.reduce((o,s)=>(o[s]===void 0&&n[s]!==void 0&&(o[s]=n[s]),o),r);return a}function zk(e,t){const r=new Map;for(let n=0;n<e.length;n++){const i=e[n],a=t(i,n,e);r.has(a)||r.set(a,i)}return Array.from(r.values())}function Bk(e,t){return function(...r){return e.apply(this,r.slice(0,t))}}function mg(e){return e}function Fk(e){return function(t){return zt(t,e)}}function Nl(e){return e==null||typeof e!="object"&&typeof e!="function"}function Wk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Kk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Gu(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Hk="[object RegExp]",vg="[object String]",gg="[object Number]",yg="[object Boolean]",bg="[object Arguments]",Gk="[object Symbol]",qk="[object Date]",Yk="[object Map]",Vk="[object Set]",Xk="[object Array]",Zk="[object ArrayBuffer]",Jk="[object Object]",Qk="[object DataView]",eO="[object Uint8Array]",tO="[object Uint8ClampedArray]",rO="[object Uint16Array]",nO="[object Uint32Array]",iO="[object Int8Array]",aO="[object Int16Array]",oO="[object Int32Array]",sO="[object Float32Array]",lO="[object Float64Array]",wd=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function uO(e){return typeof wd.Buffer<"u"&&wd.Buffer.isBuffer(e)}function cO(e,t){return zr(e,void 0,e,new Map,t)}function zr(e,t,r,n=new Map,i=void 0){const a=i==null?void 0:i(e,t,r,n);if(a!==void 0)return a;if(Nl(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const o=new Array(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;n.set(e,o);for(const[s,l]of e)o.set(s,zr(l,s,r,n,i));return o}if(e instanceof Set){const o=new Set;n.set(e,o);for(const s of e)o.add(zr(s,void 0,r,n,i));return o}if(uO(e))return e.subarray();if(Wk(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,o),bt(o,e,r,n,i),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(typeof Blob<"u"&&e instanceof Blob){const o=new Blob([e],{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Error){const o=structuredClone(e);return n.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,o.constructor=e.constructor,bt(o,e,r,n,i),o}if(e instanceof Boolean){const o=new Boolean(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Number){const o=new Number(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof String){const o=new String(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(typeof e=="object"&&fO(e)){const o=Object.create(Object.getPrototypeOf(e));return n.set(e,o),bt(o,e,r,n,i),o}return e}function bt(e,t,r=e,n,i){const a=[...Object.keys(t),...Kk(t)];for(let o=0;o<a.length;o++){const s=a[o],l=Object.getOwnPropertyDescriptor(e,s);(l==null||l.writable)&&(e[s]=zr(t[s],s,r,n,i))}}function fO(e){switch(Gu(e)){case bg:case Xk:case Zk:case Qk:case yg:case qk:case sO:case lO:case iO:case aO:case oO:case Yk:case gg:case Jk:case Hk:case Vk:case vg:case Gk:case eO:case tO:case rO:case nO:return!0;default:return!1}}function dO(e){return zr(e,void 0,e,new Map,void 0)}function Aa(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function xg(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function wg(e,t,r){return typeof r!="function"?wg(e,t,()=>{}):Dl(e,t,function n(i,a,o,s,l,u){const c=r(i,a,o,s,l,u);return c!==void 0?!!c:Dl(i,a,n,u,!1)},new Map,!0)}function Dl(e,t,r,n,i=!1){if(t===e)return!0;switch(typeof t){case"object":return hO(e,t,r,n);case"function":return Object.keys(t).length>0?Dl(e,{...t},r,n,i):Aa(e,t);default:return xg(e)&&i?typeof t=="string"?t==="":!0:Aa(e,t)}}function hO(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return Pg(e,t,r,n);if(t instanceof Map)return pO(e,t,r,n);if(t instanceof Set)return mO(e,t,r,n);const i=Object.keys(t);if(e==null||Nl(e))return i.length===0;if(i.length===0)return!0;if(n!=null&&n.has(t))return n.get(t)===e;n==null||n.set(t,e);try{for(let a=0;a<i.length;a++){const o=i[a];if(!Nl(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,n))return!1}return!0}finally{n==null||n.delete(t)}}function pO(e,t,r,n){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(const[i,a]of t.entries())if(r(e.get(i),a,i,e,t,n)===!1)return!1;return!0}function Pg(e,t,r,n){if(t.length===0)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let a=0;a<t.length;a++){const o=t[a];let s=!1;for(let l=0;l<e.length;l++){if(i.has(l))continue;const u=e[l];let c=!1;if(r(u,o,a,e,t,n)&&(c=!0),c){i.add(l),s=!0;break}}if(!s)return!1}return!0}function mO(e,t,r,n){return t.size===0?!0:e instanceof Set?Pg([...e],[...t],r,n):!1}function kg(e,t){return wg(e,t,()=>{})}function vO(e){return e=dO(e),t=>kg(t,e)}function gO(e,t){return cO(e,(r,n,i,a)=>{if(typeof e=="object"){if(Gu(e)==="[object Object]"&&typeof e.constructor!="function"){const o={};return a.set(e,o),bt(o,e,i,a),o}switch(Object.prototype.toString.call(e)){case gg:case vg:case yg:{const o=new e.constructor(e==null?void 0:e.valueOf());return bt(o,e),o}case bg:{const o={};return bt(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}function yO(e){return gO(e)}const bO=/^(?:0|[1-9]\d*)$/;function Og(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return bO.test(e)}}function xO(e){return e!==null&&typeof e=="object"&&Gu(e)==="[object Arguments]"}function wO(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&lg(t)&&(e==null?void 0:e[t])==null?r=Ku(t):r=[t],r.length===0)return!1;let n=e;for(let i=0;i<r.length;i++){const a=r[i];if((n==null||!Object.hasOwn(n,a))&&!((Array.isArray(n)||xO(n))&&Og(a)&&a<n.length))return!1;n=n[a]}return!0}function PO(e,t){switch(typeof e){case"object":Object.is(e==null?void 0:e.valueOf(),-0)&&(e="-0");break;case"number":e=Wu(e);break}return t=yO(t),function(r){const n=zt(r,e);return n===void 0?wO(r,e):t===void 0?n===void 0:kg(n,t)}}function kO(e){if(e==null)return mg;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?PO(e[0],e[1]):vO(e);case"string":case"symbol":case"number":return Fk(e)}}function OO(e){return Number.isSafeInteger(e)&&e>=0}function jg(e){return e!=null&&typeof e!="function"&&OO(e.length)}function jO(e){return typeof e=="object"&&e!==null}function AO(e){return jO(e)&&jg(e)}function Pd(e,t=mg){return AO(e)?zk(Array.from(e),Bk(kO(t),1)):[]}function SO(e,t,r){return t===!0?Pd(e,r):typeof t=="function"?Pd(e,t):e}var qu=h.createContext(null),EO=e=>e,se=()=>{var e=h.useContext(qu);return e?e.store.dispatch:EO},Sa=()=>{},_O=()=>Sa,TO=(e,t)=>e===t;function U(e){var t=h.useContext(qu),r=h.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Sa,[t,e]);return Dw.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:_O,t?t.store.getState:Sa,t?t.store.getState:Sa,r,TO)}function CO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function MO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function IO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var kd=e=>Array.isArray(e)?e:[e];function NO(e){const t=Array.isArray(e[0])?e[0]:e;return IO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function DO(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var $O=class{constructor(e){this.value=e}deref(){return this.value}},RO=typeof WeakRef<"u"?WeakRef:$O,LO=0,Od=1;function la(){return{s:LO,v:void 0,o:null,p:null}}function Ag(e,t={}){let r=la();const{resultEqualityCheck:n}=t;let i,a=0;function o(){var f;let s=r;const{length:l}=arguments;for(let d=0,p=l;d<p;d++){const v=arguments[d];if(typeof v=="function"||typeof v=="object"&&v!==null){let m=s.o;m===null&&(s.o=m=new WeakMap);const y=m.get(v);y===void 0?(s=la(),m.set(v,s)):s=y}else{let m=s.p;m===null&&(s.p=m=new Map);const y=m.get(v);y===void 0?(s=la(),m.set(v,s)):s=y}}const u=s;let c;if(s.s===Od)c=s.v;else if(c=e.apply(null,arguments),a++,n){const d=((f=i==null?void 0:i.deref)==null?void 0:f.call(i))??i;d!=null&&n(d,c)&&(c=d,a!==0&&a--),i=typeof c=="object"&&c!==null||typeof c=="function"?new RO(c):c}return u.s=Od,u.v=c,c}return o.clearCache=()=>{r=la(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function UO(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,s,l={},u=i.pop();typeof u=="object"&&(l=u,u=i.pop()),CO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const c={...r,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:p=Ag,argsMemoizeOptions:v=[]}=c,m=kd(d),y=kd(v),b=NO(i),x=f(function(){return a++,u.apply(null,arguments)},...m),w=p(function(){o++;const O=DO(b,arguments);return s=x.apply(null,O),s},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:x,dependencies:b,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:p})};return Object.assign(n,{withTypes:()=>n}),n}var A=UO(Ag),zO=Object.assign((e,t=A)=>{MO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,s,l)=>(o[r[l]]=s,o),{}))},{withTypes:()=>zO});function BO(e,t=1){const r=[],n=Math.floor(t),i=(a,o)=>{for(let s=0;s<a.length;s++){const l=a[s];Array.isArray(l)&&o<n?i(l,o+1):r.push(l)}};return i(e,0),r}function $l(e,t,r){return xg(r)&&(typeof t=="number"&&jg(r)&&Og(t)&&t<r.length||typeof t=="string"&&t in r)?Aa(r[t],e):!1}function jd(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const FO=(e,t,r)=>{if(e!==t){const n=jd(e),i=jd(t);if(n===i&&n===0){if(e<t)return r==="desc"?1:-1;if(e>t)return r==="desc"?-1:1}return r==="desc"?i-n:n-i}return 0};function Sg(e){return typeof e=="symbol"||e instanceof Symbol}const WO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,KO=/^\w*$/;function HO(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||Sg(e)?!0:typeof e=="string"&&(KO.test(e)||!WO.test(e))||t!=null}function GO(e,t,r,n){if(e==null)return[];r=r,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(r)||(r=r==null?[]:[r]),r=r.map(s=>String(s));const i=(s,l)=>{let u=s;for(let c=0;c<l.length&&u!=null;++c)u=u[l[c]];return u},a=(s,l)=>l==null||s==null?l:typeof s=="object"&&"key"in s?Object.hasOwn(l,s.key)?l[s.key]:i(l,s.path):typeof s=="function"?s(l):Array.isArray(s)?i(l,s):typeof l=="object"?l[s]:l,o=t.map(s=>(Array.isArray(s)&&s.length===1&&(s=s[0]),s==null||typeof s=="function"||Array.isArray(s)||HO(s)?s:{key:s,path:Ku(s)}));return e.map(s=>({original:s,criteria:o.map(l=>a(l,s))})).slice().sort((s,l)=>{for(let u=0;u<o.length;u++){const c=FO(s.criteria[u],l.criteria[u],r[u]);if(c!==0)return c}return 0}).map(s=>s.original)}function Ho(e,...t){const r=t.length;return r>1&&$l(e,t[0],t[1])?t=[]:r>2&&$l(t[0],t[1],t[2])&&(t=[t[0]]),GO(e,BO(t),["asc"])}var Eg=e=>e.legend.settings,qO=e=>e.legend.size,YO=e=>e.legend.payload;A([YO,Eg],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Ho(n,r):n});var ua=1;function VO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>ua||Math.abs(o.left-t.left)>ua||Math.abs(o.top-t.top)>ua||Math.abs(o.width-t.width)>ua)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var XO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Ad=XO,Ys=()=>Math.random().toString(36).substring(7).split("").join("."),ZO={INIT:`@@redux/INIT${Ys()}`,REPLACE:`@@redux/REPLACE${Ys()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ys()}`},Ha=ZO;function Yu(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function _g(e,t,r){if(typeof e!="function")throw new Error(ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ze(1));return r(_g)(e,t)}let n=e,i=t,a=new Map,o=a,s=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((y,b)=>{o.set(b,y)}))}function c(){if(l)throw new Error(ze(3));return i}function f(y){if(typeof y!="function")throw new Error(ze(4));if(l)throw new Error(ze(5));let b=!0;u();const x=s++;return o.set(x,y),function(){if(b){if(l)throw new Error(ze(6));b=!1,u(),o.delete(x),a=null}}}function d(y){if(!Yu(y))throw new Error(ze(7));if(typeof y.type>"u")throw new Error(ze(8));if(typeof y.type!="string")throw new Error(ze(17));if(l)throw new Error(ze(9));try{l=!0,i=n(i,y)}finally{l=!1}return(a=o).forEach(x=>{x()}),y}function p(y){if(typeof y!="function")throw new Error(ze(10));n=y,d({type:Ha.REPLACE})}function v(){const y=f;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(ze(11));function x(){const P=b;P.next&&P.next(c())}return x(),{unsubscribe:y(x)}},[Ad](){return this}}}return d({type:Ha.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:p,[Ad]:v}}function JO(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Ha.INIT})>"u")throw new Error(ze(12));if(typeof r(void 0,{type:Ha.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ze(13))})}function Tg(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let i;try{JO(r)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const u={};for(let c=0;c<n.length;c++){const f=n[c],d=r[f],p=o[f],v=d(p,s);if(typeof v>"u")throw s&&s.type,new Error(ze(14));u[f]=v,l=l||v!==p}return l=l||n.length!==Object.keys(o).length,l?u:o}}function Ga(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function QO(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(ze(15))};const o={getState:i.getState,dispatch:(l,...u)=>a(l,...u)},s=e.map(l=>l(o));return a=Ga(...s)(i.dispatch),{...i,dispatch:a}}}function Cg(e){return Yu(e)&&"type"in e&&typeof e.type=="string"}var Mg=Symbol.for("immer-nothing"),Sd=Symbol.for("immer-draftable"),tt=Symbol.for("immer-state");function Pt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var lt=Object,_n=lt.getPrototypeOf,qa="constructor",Go="prototype",Rl="configurable",Ya="enumerable",Ea="writable",hi="value",er=e=>!!e&&!!e[tt];function At(e){var t;return e?Ig(e)||Yo(e)||!!e[Sd]||!!((t=e[qa])!=null&&t[Sd])||Vo(e)||Xo(e):!1}var ej=lt[Go][qa].toString(),Ed=new WeakMap;function Ig(e){if(!e||!Vu(e))return!1;const t=_n(e);if(t===null||t===lt[Go])return!0;const r=lt.hasOwnProperty.call(t,qa)&&t[qa];if(r===Object)return!0;if(!gn(r))return!1;let n=Ed.get(r);return n===void 0&&(n=Function.toString.call(r),Ed.set(r,n)),n===ej}function qo(e,t,r=!0){Mi(e)===0?(r?Reflect.ownKeys(e):lt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Mi(e){const t=e[tt];return t?t.type_:Yo(e)?1:Vo(e)?2:Xo(e)?3:0}var Vs=(e,t,r=Mi(e))=>r===2?e.has(t):lt[Go].hasOwnProperty.call(e,t),Ll=(e,t,r=Mi(e))=>r===2?e.get(t):e[t],Va=(e,t,r,n=Mi(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function tj(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Yo=Array.isArray,Vo=e=>e instanceof Map,Xo=e=>e instanceof Set,Vu=e=>typeof e=="object",gn=e=>typeof e=="function",Xs=e=>typeof e=="boolean";function rj(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var It=e=>e.copy_||e.base_,Xu=e=>e.modified_?e.copy_:e.base_;function Ul(e,t){if(Vo(e))return new Map(e);if(Xo(e))return new Set(e);if(Yo(e))return Array[Go].slice.call(e);const r=Ig(e);if(t===!0||t==="class_only"&&!r){const n=lt.getOwnPropertyDescriptors(e);delete n[tt];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s[Ea]===!1&&(s[Ea]=!0,s[Rl]=!0),(s.get||s.set)&&(n[o]={[Rl]:!0,[Ea]:!0,[Ya]:s[Ya],[hi]:e[o]})}return lt.create(_n(e),n)}else{const n=_n(e);if(n!==null&&r)return{...e};const i=lt.create(n);return lt.assign(i,e)}}function Zu(e,t=!1){return Zo(e)||er(e)||!At(e)||(Mi(e)>1&&lt.defineProperties(e,{set:ca,add:ca,clear:ca,delete:ca}),lt.freeze(e),t&&qo(e,(r,n)=>{Zu(n,!0)},!1)),e}function nj(){Pt(2)}var ca={[hi]:nj};function Zo(e){return e===null||!Vu(e)?!0:lt.isFrozen(e)}var Xa="MapSet",zl="Patches",_d="ArrayMethods",Ng={};function Qr(e){const t=Ng[e];return t||Pt(0,e),t}var Td=e=>!!Ng[e],pi,Dg=()=>pi,ij=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Td(Xa)?Qr(Xa):void 0,arrayMethodsPlugin_:Td(_d)?Qr(_d):void 0});function Cd(e,t){t&&(e.patchPlugin_=Qr(zl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Bl(e){Fl(e),e.drafts_.forEach(aj),e.drafts_=null}function Fl(e){e===pi&&(pi=e.parent_)}var Md=e=>pi=ij(pi,e);function aj(e){const t=e[tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Id(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[tt].modified_&&(Bl(t),Pt(4)),At(e)&&(e=Nd(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[tt].base_,e,t)}else e=Nd(t,r);return oj(t,e,!0),Bl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Mg?e:void 0}function Nd(e,t){if(Zo(t))return t;const r=t[tt];if(!r)return Za(t,e.handledSet_,e);if(!Jo(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Lg(r,e)}return r.copy_}function oj(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zu(t,r)}function $g(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Jo=(e,t)=>e.scope_===t,sj=[];function Rg(e,t,r,n){const i=It(e),a=e.type_;if(n!==void 0&&Ll(i,n,a)===t){Va(i,n,r,a);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;qo(i,(l,u)=>{if(er(u)){const c=s.get(u)||[];c.push(l),s.set(u,c)}})}const o=e.draftLocations_.get(t)??sj;for(const s of o)Va(i,s,r,a)}function lj(e,t,r){e.callbacks_.push(function(i){var s;const a=t;if(!a||!Jo(a,i))return;(s=i.mapSetPlugin_)==null||s.fixSetContents(a);const o=Xu(a);Rg(e,a.draft_??a,o,r),Lg(a,i)})}function Lg(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}$g(e)}}function uj(e,t,r){const{scope_:n}=e;if(er(r)){const i=r[tt];Jo(i,n)&&i.callbacks_.push(function(){_a(e);const o=Xu(i);Rg(e,r,o,t)})}else At(r)&&e.callbacks_.push(function(){const a=It(e);e.type_===3?a.has(r)&&Za(r,n.handledSet_,n):Ll(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Za(Ll(e.copy_,t,e.type_),n.handledSet_,n)})}function Za(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||er(e)||t.has(e)||!At(e)||Zo(e)||(t.add(e),qo(e,(n,i)=>{if(er(i)){const a=i[tt];if(Jo(a,r)){const o=Xu(a);Va(e,n,o,e.type_),$g(a)}}else At(i)&&Za(i,t,r)})),e}function cj(e,t){const r=Yo(e),n={type_:r?1:0,scope_:t?t.scope_:Dg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=Ja;r&&(i=[n],a=mi);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,[s,n]}var Ja={get(e,t){if(t===tt)return e;if(t==="constructor"||t==="__proto__"){const s=It(e)[t];return new Proxy(s||{},{get:(l,u)=>u==="__proto__"||u==="prototype"?Object.freeze(Object.create(null)):Reflect.get(l,u),set:()=>!0,apply:(l,u,c)=>Reflect.apply(l,u,c)})}let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=It(e);if(!Vs(i,t,e.type_))return fj(e,i,t);const a=i[t];if(e.finalized_||!At(a)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&rj(t))return a;if(a===Zs(e.base_,t)){_a(e);const o=e.type_===1?+t:t,s=Kl(e.scope_,a,e,o);return e.copy_[o]=s}return a},has(e,t){return t==="constructor"||t==="__proto__"||t==="prototype"?!1:t in It(e)},ownKeys(e){return Reflect.ownKeys(It(e))},set(e,t,r){if(t==="constructor"||t==="__proto__"||t==="prototype")return!0;const n=Ug(It(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Zs(It(e),t),a=i==null?void 0:i[tt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(tj(r,i)&&(r!==void 0||Vs(e.base_,t,e.type_)))return!0;_a(e),Wl(e)}return e.copy_[t]===r&&(r!==void 0||Vs(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),uj(e,t,r)),!0},deleteProperty(e,t){return _a(e),Zs(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Wl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=It(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Ea]:!0,[Rl]:e.type_!==1||t!=="length",[Ya]:n[Ya],[hi]:r[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return _n(e.base_)},setPrototypeOf(){Pt(12)}},mi={};for(let e in Ja){let t=Ja[e];mi[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}mi.deleteProperty=function(e,t){return mi.set.call(this,e,t,void 0)};mi.set=function(e,t,r){return Ja.set.call(this,e[0],t,r,e[0])};function Zs(e,t){const r=e[tt];return(r?It(r):e)[t]}function fj(e,t,r){var i;const n=Ug(t,r);return n?hi in n?n[hi]:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function Ug(e,t){if(!(t in e))return;let r=_n(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=_n(r)}}function Wl(e){e.modified_||(e.modified_=!0,e.parent_&&Wl(e.parent_))}function _a(e){e.copy_||(e.assigned_=new Map,e.copy_=Ul(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dj=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(gn(r)&&!gn(n)){const o=n;n=r;const s=this;return function(u=o,...c){return s.produce(u,f=>n.call(this,f,...c))}}gn(n)||Pt(6),i!==void 0&&!gn(i)&&Pt(7);let a;if(At(r)){const o=Md(this),s=Kl(o,r,void 0);let l=!0;try{a=n(s),l=!1}finally{l?Bl(o):Fl(o)}return Cd(o,i),Id(a,o)}else if(!r||!Vu(r)){if(a=n(r),a===void 0&&(a=r),a===Mg&&(a=void 0),this.autoFreeze_&&Zu(a,!0),i){const o=[],s=[];Qr(zl).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:s}),i(o,s)}return a}else Pt(1,r)},this.produceWithPatches=(r,n)=>{if(gn(r))return(s,...l)=>this.produceWithPatches(s,u=>r(u,...l));let i,a;return[this.produce(r,n,(s,l)=>{i=s,a=l}),i,a]},Xs(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Xs(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Xs(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){At(t)||Pt(8),er(t)&&(t=mt(t));const r=Md(this),n=Kl(r,t,void 0);return n[tt].isManual_=!0,Fl(r),n}finishDraft(t,r){const n=t&&t[tt];(!n||!n.isManual_)&&Pt(9);const{scope_:i}=n;return Cd(i,r),Id(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=Qr(zl).applyPatches_;return er(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Kl(e,t,r,n){const[i,a]=Vo(t)?Qr(Xa).proxyMap_(t,r):Xo(t)?Qr(Xa).proxySet_(t,r):cj(t,r);return((r==null?void 0:r.scope_)??Dg()).drafts_.push(i),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=n,r&&n!==void 0?lj(r,a,n):a.callbacks_.push(function(l){var c;(c=l.mapSetPlugin_)==null||c.fixSetContents(a);const{patchPlugin_:u}=l;a.modified_&&u&&u.generatePatches_(a,[],l)}),i}function mt(e){return er(e)||Pt(10,e),zg(e)}function zg(e){if(!At(e)||Zo(e))return e;const t=e[tt];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ul(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ul(e,!0);return qo(r,(i,a)=>{Va(r,i,zg(a))},n),t&&(t.finalized_=!1),r}var hj=new dj,Bg=hj.produce;function Fg(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var pj=Fg(),mj=Fg,vj=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ga:Ga.apply(null,arguments)};function ct(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(ut(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Cg(n)&&n.type===e,r}var Wg=class si extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,si.prototype)}static get[Symbol.species](){return si}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new si(...t[0].concat(this)):new si(...t.concat(this))}};function Dd(e){return At(e)?Bg(e,()=>{}):e}function fa(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function gj(e){return typeof e=="boolean"}var yj=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Wg;return r&&(gj(r)?o.push(pj):o.push(mj(r.extraArgument))),o},Kg="RTK_autoBatch",le=()=>e=>({payload:e,meta:{[Kg]:!0}}),$d=e=>t=>{setTimeout(t,e)},bj=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(o),r())},a=e(i),o=setTimeout(i,t)},Hg=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?bj(window.requestAnimationFrame,100):$d(10):e.type==="callback"?e.queueNotification:$d(e.timeout),u=()=>{o=!1,a&&(a=!1,s.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),d=n.subscribe(f);return s.add(c),()=>{d(),s.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[Kg]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},xj=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new Wg(e);return n&&i.push(Hg(typeof n=="object"?n:void 0)),i};function wj(e){const t=yj(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof r=="function")s=r;else if(Yu(r))s=Tg(r);else throw new Error(ut(1));let l;typeof n=="function"?l=n(t):l=t();let u=Ga;i&&(u=vj({trace:!1,...typeof i=="object"&&i}));const c=QO(...l),f=xj(c);let d=typeof o=="function"?o(f):f();const p=u(...d);return _g(s,a,p)}function Gg(e){const t={},r=[];let n;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(ut(28));if(s in t)throw new Error(ut(29));return t[s]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function Pj(e){return typeof e=="function"}function kj(e,t){let[r,n,i]=Gg(t),a;if(Pj(e))a=()=>Dd(e());else{const s=Dd(e);a=()=>s}function o(s=a(),l){let u=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return u.filter(c=>!!c).length===0&&(u=[i]),u.reduce((c,f)=>{if(f)if(er(c)){const p=f(c,l);return p===void 0?c:p}else{if(At(c))return Bg(c,d=>f(d,l));{const d=f(c,l);if(d===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return c},s)}return o.getInitialState=a,o}var Oj="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",jj=(e=21)=>{let t="",r=e;for(;r--;)t+=Oj[Math.random()*64|0];return t},Aj=Symbol.for("rtk-slice-createasyncthunk");function Sj(e,t){return`${e}/${t}`}function Ej({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Aj];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(ut(11));const s=(typeof i.reducers=="function"?i.reducers(Tj()):i.reducers)||{},l=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(P,O){const k=typeof P=="string"?P:P.type;if(!k)throw new Error(ut(12));if(k in u.sliceCaseReducersByType)throw new Error(ut(13));return u.sliceCaseReducersByType[k]=O,c},addMatcher(P,O){return u.sliceMatchers.push({matcher:P,reducer:O}),c},exposeAction(P,O){return u.actionCreators[P]=O,c},exposeCaseReducer(P,O){return u.sliceCaseReducersByName[P]=O,c}};l.forEach(P=>{const O=s[P],k={reducerName:P,type:Sj(a,P),createNotation:typeof i.reducers=="function"};Mj(O)?Nj(k,O,c,t):Cj(k,O,c)});function f(){const[P={},O=[],k=void 0]=typeof i.extraReducers=="function"?Gg(i.extraReducers):[i.extraReducers],j={...P,...u.sliceCaseReducersByType};return kj(i.initialState,E=>{for(let _ in j)E.addCase(_,j[_]);for(let _ of u.sliceMatchers)E.addMatcher(_.matcher,_.reducer);for(let _ of O)E.addMatcher(_.matcher,_.reducer);k&&E.addDefaultCase(k)})}const d=P=>P,p=new Map,v=new WeakMap;let m;function y(P,O){return m||(m=f()),m(P,O)}function b(){return m||(m=f()),m.getInitialState()}function x(P,O=!1){function k(E){let _=E[P];return typeof _>"u"&&O&&(_=fa(v,k,b)),_}function j(E=d){const _=fa(p,O,()=>new WeakMap);return fa(_,E,()=>{const M={};for(const[T,S]of Object.entries(i.selectors??{}))M[T]=_j(S,E,()=>fa(v,E,b),O);return M})}return{reducerPath:P,getSelectors:j,get selectors(){return j(k)},selectSlice:k}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:b,...x(o),injectInto(P,{reducerPath:O,...k}={}){const j=O??o;return P.inject({reducerPath:j,reducer:y},k),{...w,...x(j,!0)}}};return w}}function _j(e,t,r,n){function i(a,...o){let s=t(a);return typeof s>"u"&&n&&(s=r()),e(s,...o)}return i.unwrapped=e,i}var Xe=Ej();function Tj(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Cj({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!Ij(n))throw new Error(ut(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ct(e,o):ct(e))}function Mj(e){return e._reducerDefinitionType==="asyncThunk"}function Ij(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Nj({type:e,reducerName:t},r,n,i){if(!i)throw new Error(ut(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:u,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),s&&n.addCase(f.pending,s),l&&n.addCase(f.rejected,l),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:o||da,pending:s||da,rejected:l||da,settled:u||da})}function da(){}var Dj="task",qg="listener",Yg="completed",Ju="cancelled",$j=`task-${Ju}`,Rj=`task-${Yg}`,Hl=`${qg}-${Ju}`,Lj=`${qg}-${Yg}`,Qo=class{constructor(e){ea(this,"code");ea(this,"name","TaskAbortError");ea(this,"message");this.code=e,this.message=`${Dj} ${Ju} (reason: ${e})`}},Qu=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Qa=()=>{},Vg=(e,t=Qa)=>(e.catch(t),e),Xg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Gr=e=>{if(e.aborted)throw new Qo(e.reason)};function Zg(e,t){let r=Qa;return new Promise((n,i)=>{const a=()=>i(new Qo(e.reason));if(e.aborted){a();return}r=Xg(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Qa})}var Uj=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof Qo?"cancelled":"rejected",error:r}}finally{t==null||t()}},eo=e=>t=>Vg(Zg(e,t).then(r=>(Gr(e),r))),Jg=e=>{const t=eo(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:On}=Object,Rd={},es="listenerMiddleware",zj=(e,t)=>{const r=n=>Xg(e,()=>n.abort(e.reason));return(n,i)=>{Qu(n);const a=new AbortController;r(a);const o=Uj(async()=>{Gr(e),Gr(a.signal);const s=await n({pause:eo(a.signal),delay:Jg(a.signal),signal:a.signal});return Gr(a.signal),s},()=>a.abort(Rj));return i!=null&&i.autoJoin&&t.push(o.catch(Qa)),{result:eo(e)(o),cancel(){a.abort($j)}}}},Bj=(e,t)=>{const r=async(n,i)=>{Gr(t);let a=()=>{};const s=[new Promise((l,u)=>{let c=e({predicate:n,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});a=()=>{c(),u()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await Zg(t,Promise.race(s));return Gr(t),l}finally{a()}};return((n,i)=>Vg(r(n,i)))},Qg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=ct(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(ut(21));return Qu(a),{predicate:i,type:t,effect:a}},ey=On(e=>{const{type:t,predicate:r,effect:n}=Qg(e);return{id:jj(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>ey}),Ld=(e,t)=>{const{type:r,effect:n,predicate:i}=Qg(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Gl=e=>{e.pending.forEach(t=>{t.abort(Hl)})},Fj=(e,t)=>()=>{for(const r of t.keys())Gl(r);e.clear()},Ud=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},ty=On(ct(`${es}/add`),{withTypes:()=>ty}),Wj=ct(`${es}/removeAll`),ry=On(ct(`${es}/remove`),{withTypes:()=>ry}),Kj=(...e)=>{console.error(`${es}/error`,...e)},Ii=(e={})=>{const t=new Map,r=new Map,n=p=>{const v=r.get(p)??0;r.set(p,v+1)},i=p=>{const v=r.get(p)??1;v===1?r.delete(p):r.set(p,v-1)},{extra:a,onError:o=Kj}=e;Qu(o);const s=p=>(p.unsubscribe=()=>t.delete(p.id),t.set(p.id,p),v=>{p.unsubscribe(),v!=null&&v.cancelActive&&Gl(p)}),l=(p=>{const v=Ld(t,p)??ey(p);return s(v)});On(l,{withTypes:()=>l});const u=p=>{const v=Ld(t,p);return v&&(v.unsubscribe(),p.cancelActive&&Gl(v)),!!v};On(u,{withTypes:()=>u});const c=async(p,v,m,y)=>{const b=new AbortController,x=Bj(l,b.signal),w=[];try{p.pending.add(b),n(p),await Promise.resolve(p.effect(v,On({},m,{getOriginalState:y,condition:(P,O)=>x(P,O).then(Boolean),take:x,delay:Jg(b.signal),pause:eo(b.signal),extra:a,signal:b.signal,fork:zj(b.signal,w),unsubscribe:p.unsubscribe,subscribe:()=>{t.set(p.id,p)},cancelActiveListeners:()=>{p.pending.forEach((P,O,k)=>{P!==b&&(P.abort(Hl),k.delete(P))})},cancel:()=>{b.abort(Hl),p.pending.delete(b)},throwIfCancelled:()=>{Gr(b.signal)}})))}catch(P){P instanceof Qo||Ud(o,P,{raisedBy:"effect"})}finally{await Promise.all(w),b.abort(Lj),i(p),p.pending.delete(b)}},f=Fj(t,r);return{middleware:p=>v=>m=>{if(!Cg(m))return v(m);if(ty.match(m))return l(m.payload);if(Wj.match(m)){f();return}if(ry.match(m))return u(m.payload);let y=p.getState();const b=()=>{if(y===Rd)throw new Error(ut(23));return y};let x;try{if(x=v(m),t.size>0){const w=p.getState(),P=Array.from(t.values());for(const O of P){let k=!1;try{k=O.predicate(m,w,y)}catch(j){k=!1,Ud(o,j,{raisedBy:"predicate"})}k&&c(O,m,p,b)}}}finally{y=Rd}return x},startListening:l,stopListening:u,clearListeners:f}};function ut(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Hj={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},ny=Xe({name:"chartLayout",initialState:Hj,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Gj,setLayout:qj,setChartSize:Yj,setScale:Vj}=ny.actions,Xj=ny.reducer;function iy(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function G(e){return Number.isFinite(e)}function Ft(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function zd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zd(Object(r),!0).forEach(function(n){Zj(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zj(e,t,r){return(t=Jj(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jj(e){var t=Qj(e,"string");return typeof t=="symbol"?t:t+""}function Qj(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ee(e,t,r){return ce(e)||ce(t)?r:Bt(t)?zt(e,t,r):typeof t=="function"?t(e):r}var eA=(e,t,r)=>{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:s}=t;if((s==="vertical"||s==="horizontal"&&o==="middle")&&a!=="center"&&$(e[a]))return bn(bn({},e),{},{[a]:e[a]+(n||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&o!=="middle"&&$(e[o]))return bn(bn({},e),{},{[o]:e[o]+(i||0)})}return e},Et=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",ay=(e,t,r,n)=>{if(n)return e.map(s=>s.coordinate);var i,a,o=e.map(s=>(s.coordinate===t&&(i=!0),s.coordinate===r&&(a=!0),s.coordinate));return i||o.push(t),a||o.push(r),o},oy=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:u,tickCount:c,ticks:f,niceTicks:d,axisType:p}=e;if(!o)return null;var v=s==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,m=i==="category"&&o.bandwidth?o.bandwidth()/v:0;if(m=p==="angleAxis"&&a&&a.length>=2?Ne(a[0]-a[1])*2*m:m,f||d){var y=(f||d||[]).map((b,x)=>{var w=n?n.indexOf(b):b,P=o.map(w);return G(P)?{coordinate:P+m,value:b,offset:m,index:x}:null}).filter(nt);return y}return l&&u?u.map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+m,value:b,index:x,offset:m}:null}).filter(nt):o.ticks&&c!=null?o.ticks(c).map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+m,value:b,index:x,offset:m}:null}).filter(nt):o.domain().map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+m,value:n?n[b]:b,index:x,offset:m}:null}).filter(nt)},tA=(e,t)=>{if(!t||t.length!==2||!$(t[0])||!$(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!$(e[0])||e[0]<r)&&(i[0]=r),(!$(e[1])||e[1]>n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]<r&&(i[1]=r),i},rA=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0,s=0;s<r;++s){var l=e[s],u=l==null?void 0:l[i];if(u!=null){var c=u[1],f=u[0],d=jt(c)?f:c;d>=0?(u[0]=a,a+=d,u[1]=a):(u[0]=o,o+=d,u[1]=o)}}}},nA=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0;o<r;++o){var s=e[o],l=s==null?void 0:s[i];if(l!=null){var u=jt(l[1])?l[0]:l[1];u>=0?(l[0]=a,a+=u,l[1]=a):(l[0]=0,l[1]=0)}}}},iA={sign:rA,expand:bk,none:Zr,silhouette:xk,wiggle:wk,positive:nA},aA=(e,t,r)=>{var n,i=(n=iA[r])!==null&&n!==void 0?n:Zr,a=yk().keys(t).value((s,l)=>Number(ee(s,l,0))).order(Cl).offset(i),o=a(e);return o.forEach((s,l)=>{s.forEach((u,c)=>{var f=ee(e[c],t[l],0);Array.isArray(f)&&f.length===2&&$(f[0])&&$(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function sy(e){return e==null?void 0:String(e)}function to(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ce(i[t.dataKey])){var s=fg(r,"value",i[t.dataKey]);if(s)return s.coordinate+n/2}return r!=null&&r[a]?r[a].coordinate+n/2:null}var l=ee(i,ce(o)?t.dataKey:o),u=t.scale.map(l);return $(u)?u:null}var Bd=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var s=ee(a,t.dataKey,t.scale.domain()[o]);if(ce(s))return null;var l=t.scale.map(s);return $(l)?l-i/2+n:null},oA=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},sA=e=>{var t=e.flat(2).filter($);return[Math.min(...t),Math.max(...t)]},lA=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],uA=(e,t,r)=>{if(e!=null)return lA(Object.keys(e).reduce((n,i)=>{var a=e[i];if(!a)return n;var{stackedData:o}=a,s=o.reduce((l,u)=>{var c=iy(u,t,r),f=sA(c);return!G(f[0])||!G(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(s[0],n[0]),Math.max(s[1],n[1])]},[1/0,-1/0]))},Fd=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Wd=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,kr=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=Ho(t,c=>c.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],u=i[o-1];a=Math.min(((l==null?void 0:l.coordinate)||0)-((u==null?void 0:u.coordinate)||0),a)}return a===1/0?0:a}return r?void 0:0};function Kd(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:i,name:a}=e;return bn(bn({},t),{},{dataKey:r,payload:n,value:i,name:a})}function Er(e,t){if(e)return String(e);if(typeof t=="string")return t}var cA=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},fA=(e,t)=>t==="centric"?e.angle:e.radius,or=e=>e.layout.width,sr=e=>e.layout.height,dA=e=>e.layout.scale,ly=e=>e.layout.margin,ts=A(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),rs=A(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),uy="data-recharts-item-index",cy="data-recharts-item-id",Ni=60;function Hd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Hd(Object(r),!0).forEach(function(n){hA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hA(e,t,r){return(t=pA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pA(e){var t=mA(e,"string");return typeof t=="symbol"?t:t+""}function mA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vA=e=>e.brush.height;function gA(e){var t=rs(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function yA(e){var t=rs(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function bA(e){var t=ts(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function xA(e){var t=ts(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var Ae=A([or,sr,ly,vA,gA,yA,bA,xA,Eg,qO],(e,t,r,n,i,a,o,s,l,u)=>{var c={left:(r.left||0)+i,right:(r.right||0)+a},f={top:(r.top||0)+o,bottom:(r.bottom||0)+s},d=ha(ha({},f),c),p=d.bottom;d.bottom+=n,d=eA(d,l,u);var v=e-d.left-d.right,m=t-d.top-d.bottom;return ha(ha({brushBottom:p},d),{},{width:Math.max(v,0),height:Math.max(m,0)})}),wA=A(Ae,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),ec=A(or,sr,(e,t)=>({x:0,y:0,width:e,height:t})),PA=h.createContext(null),De=()=>h.useContext(PA)!=null,ns=e=>e.brush,is=A([ns,Ae,ly],(e,t,r)=>({height:e.height,x:$(e.x)?e.x:t.left,y:$(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:$(e.width)?e.width:t.width}));function kA(e,t,{signal:r,edges:n}={}){let i,a=null;const o=n!=null&&n.includes("leading"),s=n==null||n.includes("trailing"),l=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},u=()=>{s&&l(),p()};let c=null;const f=()=>{c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,u()},t)},d=()=>{c!==null&&(clearTimeout(c),c=null)},p=()=>{d(),i=void 0,a=null},v=()=>{l()},m=function(...y){if(r!=null&&r.aborted)return;i=this,a=y;const b=c==null;f(),o&&b&&l()};return m.schedule=f,m.cancel=p,m.flush=v,r==null||r.addEventListener("abort",p,{once:!0}),m}function OA(e,t=0,r={}){typeof r!="object"&&(r={});const{leading:n=!1,trailing:i=!0,maxWait:a}=r,o=Array(2);n&&(o[0]="leading"),i&&(o[1]="trailing");let s,l=null;const u=kA(function(...d){s=e.apply(this,d),l=null},t,{edges:o}),c=function(...d){return a!=null&&(l===null&&(l=Date.now()),Date.now()-l>=a)?(s=e.apply(this,d),l=Date.now(),u.cancel(),u.schedule(),s):(u.apply(this,d),s)},f=()=>(u.flush(),s);return c.cancel=u.cancel,c.flush=f,c}function jA(e,t=0,r={}){const{leading:n=!0,trailing:i=!0}=r;return OA(e,t,{leading:n,maxWait:t,trailing:i})}var ro=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(r.replace(/%s/g,()=>i[o++]))}},$t={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},fy=(e,t,r)=>{var{width:n=$t.width,height:i=$t.height,aspect:a,maxHeight:o}=r,s=Jr(n)?e:Number(n),l=Jr(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},AA={width:0,height:0,overflow:"visible"},SA={width:0,overflowX:"visible"},EA={height:0,overflowY:"visible"},_A={},TA=e=>{var{width:t,height:r}=e,n=Jr(t),i=Jr(r);return n&&i?AA:n?SA:i?EA:_A};function CA(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i=$t.width,a=$t.height):i===void 0?i=n&&n>0?void 0:$t.width:a===void 0&&(a=n&&n>0?void 0:$t.height),{width:i,height:a}}function ql(){return ql=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ql.apply(null,arguments)}function Gd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gd(Object(r),!0).forEach(function(n){MA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MA(e,t,r){return(t=IA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function IA(e){var t=NA(e,"string");return typeof t=="symbol"?t:t+""}function NA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var dy=h.createContext($t.initialDimension);function DA(e){return Ft(e.width)&&Ft(e.height)}function hy(e){var{children:t,width:r,height:n}=e,i=h.useMemo(()=>({width:r,height:n}),[r,n]);return DA(i)?h.createElement(dy.Provider,{value:i},t):null}var tc=()=>h.useContext(dy),$A=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n=$t.initialDimension,width:i,height:a,minWidth:o=$t.minWidth,minHeight:s,maxHeight:l,children:u,debounce:c=$t.debounce,id:f,className:d,onResize:p,style:v={}}=e,m=h.useRef(null),y=h.useRef();y.current=p,h.useImperativeHandle(t,()=>m.current);var[b,x]=h.useState({containerWidth:n.width,containerHeight:n.height}),w=h.useCallback((E,_)=>{x(M=>{var T=Math.round(E),S=Math.round(_);return M.containerWidth===T&&M.containerHeight===S?M:{containerWidth:T,containerHeight:S}})},[]);h.useEffect(()=>{if(m.current==null||typeof ResizeObserver>"u")return ar;var E=S=>{var N,D=S[0];if(D!=null){var{width:z,height:K}=D.contentRect;w(z,K),(N=y.current)===null||N===void 0||N.call(y,z,K)}};c>0&&(E=jA(E,c,{trailing:!0,leading:!1}));var _=new ResizeObserver(E),{width:M,height:T}=m.current.getBoundingClientRect();return w(M,T),_.observe(m.current),()=>{_.disconnect()}},[w,c]);var{containerWidth:P,containerHeight:O}=b;ro(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:k,calculatedHeight:j}=fy(P,O,{width:i,height:a,aspect:r,maxHeight:l});return ro(k!=null&&k>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0,
1
+ var hw=Object.defineProperty;var pw=(e,t,r)=>t in e?hw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ea=(e,t,r)=>pw(e,typeof t!="symbol"?t+"":t,r);import{t as mw,bf as qf,bg as vw,an as gw,j as g,aS as Nn,bh as yw,r as h,aU as Ei,bi as bw,bj as xw,be as ww,bk as Pw,D as Ia,bl as Yf,bm as Vf,bn as kw,bo as Ow,B as Sr,bp as jw,a as Ie,d as Aw,bq as Sw,n as wv,br as Ew,bs as _w,T as Fe,P as xr,C as Tw,bt as Cw,aN as _i,h as oe,bu as Pn,i as at,bv as Mw,bw as Iw,bx as Nw,by as Z,bz as Dw,bA as $w,bB as Rw,bC as Lw,M as He,bD as wr,u as Uw,bE as zw,bF as Bw,bG as Fw,bH as Ww,S as Kw}from"./index-DLtjtn6U.js";import{L as Hw,a as Gw,T as En,C as Na,S as ta,i as qw,u as Yw}from"./useLocalStorage-CqfyLuzE.js";import{G as Xf,P as ra,C as Vw}from"./downloads-BGBukFcp.js";import{a as Dt,L as Pv,b as kn,S as xt}from"./index-sxwOKh3b.js";const Xw=mw({defaultVariants:{variant:"default"},slots:{base:"card",content:"card__content",description:"card__description",footer:"card__footer",header:"card__header",title:"card__title"},variants:{variant:{default:{base:"card--default"},secondary:{base:"card--secondary"},tertiary:{base:"card--tertiary"},transparent:{base:"card--transparent"}}}}),Zf=Object.assign(qf,{Root:qf,Separator:vw}),Dn=h.createContext({}),Jf=({children:e,className:t,variant:r="default",...n})=>{const i=gw.useMemo(()=>Xw({variant:r}),[r]),a=g.jsx(Nn.div,{className:i.base({className:t}),"data-slot":"card",...n,children:e});return g.jsx(Dn,{value:{slots:i},children:r==="transparent"?a:g.jsx(yw,{value:{variant:r},children:a})})},Zw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.header,e),"data-slot":"card-header",...t})},Jw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.h3,{className:Ei(n==null?void 0:n.title,t),"data-slot":"card-title",...r,children:e})},Qw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.p,{className:Ei(n==null?void 0:n.description,t),"data-slot":"card-description",...r,children:e})},e1=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.content,e),"data-slot":"card-content",...t})},t1=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.footer,e),"data-slot":"card-footer",...t})},q=Object.assign(Jf,{Root:Jf,Header:Zw,Title:Jw,Description:Qw,Content:e1,Footer:t1}),r1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 0 0-6.445 5.649.75.75 0 1 0 1.488.194A5.001 5.001 0 0 1 11.57 4.5h-1.32a.75.75 0 0 0 0 1.5h3a.75.75 0 0 0 .75-.75v-3a.75.75 0 0 0-1.5 0v1.06A6.48 6.48 0 0 0 8 1.5m-5.25 13a.75.75 0 0 1-.75-.75v-3a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 0 1.5H4.43a5.001 5.001 0 0 0 8.528-2.843.75.75 0 1 1 1.487.194A6.501 6.501 0 0 1 3.5 12.691v1.059a.75.75 0 0 1-.75.75",clipRule:"evenodd"})),n1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 13.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14M6.44 4.54c.43-.354.994-.565 1.56-.565 1.217 0 2.34.82 2.34 2.14 0 .377-.078.745-.298 1.1-.208.339-.513.614-.875.867-.217.153-.325.257-.379.328-.038.052-.038.07-.038.089a.75.75 0 0 1-1.5 0c0-.794.544-1.286 1.057-1.645.28-.196.4-.332.458-.426a.54.54 0 0 0 .075-.312c0-.3-.244-.641-.84-.641a1 1 0 0 0-.608.223c-.167.138-.231.287-.231.418a.75.75 0 0 1-1.5 0c0-.674.345-1.22.78-1.577M8 12a1 1 0 1 0 0-2 1 1 0 0 0 0 2",clipRule:"evenodd"})),i1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m6.44 4.06.439.44H12.5A1.5 1.5 0 0 1 14 6v5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11V4.5A1.5 1.5 0 0 1 3.5 3h1.257a1.5 1.5 0 0 1 1.061.44zM.5 4.5a3 3 0 0 1 3-3h1.257a3 3 0 0 1 2.122.879L7.5 3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3zm4.25 2a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z",clipRule:"evenodd"})),a1=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 2.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M14 4a3 3 0 1 0-5.895.79L6.15 5.908a3 3 0 1 0 0 4.185l1.955 1.117A3.003 3.003 0 0 0 11 15a3 3 0 1 0-2.15-5.092L6.895 8.79a3 3 0 0 0 0-1.58L8.85 6.092A3 3 0 0 0 14 4m-3 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M2.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0",clipRule:"evenodd"})),kv=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06",clipRule:"evenodd"})),o1="inline-flex h-7 shrink-0 items-center gap-1 rounded-full bg-[#1e80ff] px-2.5 text-[12px] font-medium text-white outline-none transition-colors hover:bg-[#1171ee] focus-visible:ring-2 focus-visible:ring-[#1e80ff]/40 disabled:pointer-events-none disabled:opacity-40 dark:bg-[#4b9cff] dark:hover:bg-[#3a8ff0]",Qf="https://juejin.cn/aiusage/rank";function s1(){const e=window.open(Qf,"_blank");if(e){e.opener=null;return}window.location.assign(Qf)}function l1(){const e=window.open(Xf,"_blank");if(e){e.opener=null;return}window.location.assign(Xf)}function u1({className:e}){return g.jsx("svg",{"aria-hidden":"true",className:e,fill:"currentColor",role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"m12 14.316 7.454-5.88-2.022-1.625L12 11.1l-.004.003-5.432-4.288-2.02 1.624 7.452 5.88Zm0-7.247 2.89-2.298L12 2.453l-.004-.005-2.884 2.318 2.884 2.3Zm0 11.266-.005.002-9.975-7.87L0 12.088l.194.156 11.803 9.308 7.463-5.885L24 12.085l-2.023-1.624Z",transform:"translate(2.4 2.4) scale(.8)"})})}function c1(){bw();const e=xw(),t=wv(),r=ww(),[n,i]=h.useState(!1),[a,o]=h.useState(null),[s,l]=h.useState(!1),u="同步数据";r==null||r.hasUserData;const c=h.useCallback(()=>{(async()=>{try{const d=await Pw();o(!!d.juejin.userId)}catch{o(null)}})()},[t]);h.useEffect(()=>{c();const d=()=>c(),p=v=>{const m=v.detail;m!=null&&m.loginSuccess&&o(!0),c()};return window.addEventListener("focus",d),window.addEventListener(Ia,d),window.addEventListener(Yf,p),window.addEventListener(Vf,d),()=>{window.removeEventListener("focus",d),window.removeEventListener(Ia,d),window.removeEventListener(Yf,p),window.removeEventListener(Vf,d)}},[t,c]);const f=async()=>{var d;i(!0);try{if(t){if(!(await Ew()).ok){e.add({title:"同步失败,请稍后重试",variant:"danger"});return}e.add({title:"同步成功",variant:"success"}),typeof((d=window.tud)==null?void 0:d.onDataSynced)!="function"&&_w()}}catch{e.add({title:"同步失败,请稍后重试",variant:"danger"})}finally{i(!1)}};return g.jsxs("div",{className:"flex items-center gap-1",children:[a===!1?g.jsxs("button",{className:o1,onClick:()=>l(!0),type:"button",children:[g.jsx(u1,{className:"size-3.5"}),"关联掘金"]}):null,g.jsx(kw,{isOpen:s,onConfirm:()=>{Ow()},onOpenChange:l}),null,null,g.jsx(na,{icon:g.jsx(Hw,{className:"size-4"}),label:"GitHub 仓库",onPress:l1}),g.jsx(Sr,{className:"h-8 min-h-8 shrink-0 px-2.5 text-xs font-normal",onPress:s1,size:"sm",variant:"tertiary",children:"排行榜"}),g.jsx(na,{icon:g.jsx(a1,{className:"size-4"}),label:"分享",onPress:()=>{jw()}}),g.jsxs(g.Fragment,{children:[g.jsx(na,{disabled:n,icon:g.jsx(r1,{className:Ie("size-4",n&&"animate-spin")}),label:u,onPress:()=>{f()}}),g.jsx(na,{icon:g.jsx(Sw,{className:"size-4"}),label:"设置",onPress:()=>Aw()})]}),g.jsx(Gw,{})]})}function na({icon:e,label:t,onPress:r,disabled:n}){return g.jsxs(En,{closeDelay:80,delay:100,children:[g.jsx(Sr,{"aria-label":t,className:"size-8 min-h-8 min-w-8 shrink-0 p-0",isDisabled:n,isIconOnly:!0,onPress:r,size:"sm",variant:"tertiary",children:e}),g.jsx(En.Content,{placement:"bottom",children:g.jsx("p",{children:t})})]})}const f1={claude:"Claude",codex:"Codex",cursor:"Cursor",qoder:"Qoder",trae:"Trae",gemini:"Gemini",opencode:"OpenCode",copilot:"Copilot",antigravity:"Antigravity",openclaw:"OpenClaw",hermes:"Hermes",zcode:"ZCode",dsh:"DeepSeek Harness",pi:"pi",kimi:"Kimi",roocode:"Roo Code",droid:"Droid",kiro:"Kiro",cline:"Cline",amp:"Amp",qwen:"Qwen Code",codebuddy:"CodeBuddy",workbuddy:"WorkBuddy",grok:"Grok Build",mimo:"Mimo","every-code":"Every Code",omp:"OMP","kilo-cli":"Kilo CLI",kilocode:"Kilo Code",goose:"Goose",zed:"Zed",warp:"Warp"};function d1(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t==="gemini-cli"||t.startsWith("gemini")?"gemini":t==="open-code"||t.startsWith("opencode")?"opencode":t==="github-copilot"||t==="copilot-cli"||t.startsWith("copilot")?"copilot":t.startsWith("antigravity")?"antigravity":t.startsWith("openclaw")||t.startsWith("open-claw")?"openclaw":t.startsWith("hermes")?"hermes":t.startsWith("zcode")||t==="zai"?"zcode":t==="dsh"||t==="deepseek"||t==="harness"||t.startsWith("deepseek-harness")||t.startsWith("dsh-")?"dsh":t==="pi-coding-agent"||t.startsWith("pi")?"pi":t.startsWith("kimi")?"kimi":t==="roo-code"||t.startsWith("roocode")||t.startsWith("roo")?"roocode":t.startsWith("droid")||t.startsWith("factory")?"droid":t.startsWith("kiro")?"kiro":t.startsWith("cline")?"cline":t.startsWith("amp")?"amp":t==="qwen-code"||t.startsWith("qwen")?"qwen":t.startsWith("codebuddy")||t==="code-buddy"?"codebuddy":t.startsWith("workbuddy")?"workbuddy":t.startsWith("grok")?"grok":t.startsWith("mimo")||t==="mimocode"||t.startsWith("xiaomi")?"mimo":t==="everycode"||t.startsWith("every-code")?"every-code":t.startsWith("omp")||t==="oh-my-pi"?"omp":t.startsWith("kilo-cli")||t==="kilo"?"kilo-cli":t.startsWith("kilocode")||t==="kilo-code"?"kilocode":t.startsWith("goose")?"goose":t.startsWith("zed")?"zed":t.startsWith("warp")?"warp":t}function qe(e){const t=d1(e);return f1[t]??e}const kl=["var(--heatmap-0)","var(--heatmap-1)","var(--heatmap-2)","var(--heatmap-3)","var(--heatmap-4)"],Ls={today:1,"last-7-days":7,"last-30-days":30,"last-90-days":90},Ov=[{id:"today",label:"今天"},{id:"last-7-days",label:"7D"},{id:"last-30-days",label:"30D"},{id:"last-90-days",label:"90D"}],h1="!h-8 !min-h-8";function p1({value:e,onChange:t,tools:r,selectedTools:n,onToolsChange:i,disabled:a=!1}){const o=h.useMemo(()=>r.filter(s=>s.tokens>0),[r]);return g.jsxs("div",{className:"mb-5 flex min-w-0 items-center gap-2","aria-label":"筛选条件",children:[g.jsx("div",{className:"shrink-0 sm:hidden",children:g.jsx(m1,{disabled:a,value:e,onChange:t})}),g.jsx(Fe,{className:"hidden w-fit shrink-0 text-center sm:block",selectedKey:e,onSelectionChange:s=>{a||t(String(s))},children:g.jsx(Fe.ListContainer,{children:g.jsx(Fe.List,{"aria-label":"时间范围",className:"w-fit *:h-6 *:w-fit *:px-3 *:text-sm *:font-normal *:transition-none! *:data-[selected=true]:text-accent-foreground",children:Ov.map(s=>g.jsxs(Fe.Tab,{className:"transition-none!",id:s.id,children:[g.jsx("span",{className:"text-xs font-normal",children:s.label}),g.jsx(Fe.Indicator,{className:"bg-accent transition-none!"})]},s.id))})})}),g.jsx("div",{className:"flex min-h-8 min-w-0 shrink-0 items-center",children:o.length>0?g.jsx(v1,{selectedTools:n,tools:o,onChange:s=>{a||i(s)}}):null}),g.jsx("div",{className:"ml-auto shrink-0",children:g.jsx(c1,{})})]})}function m1({disabled:e,onChange:t,value:r}){return g.jsxs(Dt,{"aria-label":"时间范围",className:"min-w-0 max-w-[7.5rem] shrink text-xs",isDisabled:e,value:r,variant:"secondary",onChange:n=>{e||n==null||t(String(n))},children:[g.jsx(Pv,{className:"sr-only",children:"时间范围"}),g.jsxs(Dt.Trigger,{className:`${h1} !w-fit max-w-[7.5rem] items-center leading-none ps-2.5 pe-7 !text-xs font-normal`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-20 !text-xs"}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"时间范围",children:Ov.map(n=>g.jsxs(kn.Item,{id:n.id,textValue:n.label,children:[n.label,g.jsx(kn.ItemIndicator,{})]},n.id))})})]})}function v1({tools:e,selectedTools:t,onChange:r}){const n=h.useMemo(()=>new Set(e.map(o=>o.source)),[e]),i=t.filter(o=>n.has(o)),a=i.length>0;return g.jsxs(Zf,{className:"shrink-0",children:[g.jsxs(Dt,{"aria-label":"筛选渠道",className:"w-fit max-w-52 text-xs",selectionMode:"multiple",value:i,variant:"secondary",onChange:o=>{const s=Array.isArray(o)?o.map(String):o==null?[]:[String(o)];r(s.filter(l=>n.has(l)))},children:[g.jsx(Pv,{className:"sr-only",children:"渠道"}),g.jsxs(Dt.Trigger,{className:`!h-8 !min-h-8 !w-fit max-w-52 ps-3 pe-8 !text-xs font-normal ${a?"!rounded-r-none":"!rounded-full"}`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-40 !text-xs",children:({state:o})=>{const s=o.selectedItems.map(u=>e.find(c=>c.source===u.key)).filter(u=>!!u);if(s.length===0)return"全部渠道";if(s.length>1)return`已选 ${s.length} 个渠道`;const[l]=s;return l?g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g.jsx(xr,{provider:l.source,size:18}),g.jsx("span",{className:"truncate",children:qe(l.source)})]}):"全部渠道"}}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"渠道列表",selectionMode:"multiple",children:e.map(o=>g.jsxs(kn.Item,{className:"py-1 rounded-lg px-1.5 text-xs gap-2!",id:o.source,textValue:qe(o.source),children:[g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md ",children:g.jsx(xr,{provider:o.source,size:18})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:qe(o.source)}),g.jsx(kn.ItemIndicator,{})]},o.source))})})]}),a?g.jsxs(Sr,{"aria-label":"清空渠道筛选",className:"!h-8 !min-h-8 !w-8 !min-w-8 !rounded-l-none !rounded-r-full p-0",size:"sm",variant:"tertiary",onPress:()=>r([]),children:[g.jsx(Zf.Separator,{}),g.jsx(kv,{className:"size-3.5"})]}):null]})}function g1(){return g.jsxs(q,{"aria-hidden":"true",className:"min-w-0 overflow-hidden rounded-2xl",children:[g.jsxs(q.Header,{className:"flex-row items-start justify-between gap-3 pb-0",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx(xt,{className:"h-5 w-28 rounded-md"}),g.jsx(xt,{className:"h-3 w-44 rounded-md"})]}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(q.Content,{className:"pt-4",children:g.jsx(xt,{className:"h-52 w-full rounded-xl"})})]})}function y1(){return g.jsxs("div",{"aria-hidden":"true",className:"w-full",children:[g.jsx("section",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4},(e,t)=>g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid grid-rows-[auto_auto] gap-4 p-0",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx(xt,{className:"h-3 w-16 rounded-md"}),g.jsx(xt,{className:"h-5 w-14 rounded-full"})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(xt,{className:"h-7 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-16 justify-self-end rounded-md"})]})]})},t))}),g.jsxs("div",{className:"mt-4 rounded-2xl border border-border/60 bg-surface p-4 sm:p-5",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[g.jsx(xt,{className:"h-4 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(xt,{className:"h-36 w-full rounded-xl sm:h-44"})]})]})}function b1(){return g.jsxs("div",{"aria-label":"用量数据加载中",className:"w-full",role:"status",children:[g.jsx(y1,{}),g.jsx("section",{"aria-hidden":"true",className:"mt-4 grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-2",children:Array.from({length:5},(e,t)=>g.jsx(g1,{},t))})]})}function x1({allSources:e,value:t,onChange:r}){if(e.length===0)return null;const n=new Set(t),i=t.length===e.length,a=!i&&t.length>0;let o="全部平台";t.length===0?o="选择平台":!i&&t.length===1?o=qe(t[0]??""):i||(o=`已选 ${t.length} 个平台`);const s=l=>{const u=new Set(n);u.has(l)?u.delete(l):u.add(l),r([...u])};return g.jsxs(ra,{children:[g.jsxs(Sr,{"aria-label":`筛选平台:${o}`,className:Ie("h-auto min-h-0 max-w-36 gap-1 rounded-none border-0 bg-transparent p-0","text-xs font-medium text-muted shadow-none","hover:bg-transparent hover:text-foreground","data-[pressed=true]:bg-transparent data-[pressed=true]:text-foreground",a&&"text-foreground"),size:"sm",variant:"ghost",children:[!i&&t.length===1&&t[0]?g.jsx(xr,{provider:t[0],size:12}):null,g.jsx("span",{className:"min-w-0 max-w-28 truncate whitespace-nowrap",children:o}),g.jsx(Tw,{className:"size-3.5 shrink-0 opacity-70"})]}),g.jsx(ra.Content,{className:"min-w-56 overflow-hidden rounded-[10px] border-0 bg-overlay p-0 text-overlay-foreground shadow-surface",placement:"bottom end",children:g.jsxs(ra.Dialog,{className:"p-0 outline-none",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[g.jsx(ra.Heading,{className:"text-[10px] font-semibold tracking-wider text-muted",children:"选择平台"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([...e]),children:"全部"}),g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([]),children:"清空"})]})]}),g.jsx("ul",{"aria-multiselectable":"true",className:"max-h-64 overflow-y-auto p-1.5",role:"listbox",children:e.map(l=>{const u=n.has(l);return g.jsx("li",{"aria-selected":u,role:"option",children:g.jsxs("button",{className:Ie("flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left text-xs transition-colors","hover:bg-surface-secondary",u&&"bg-accent/10 hover:bg-accent/15"),type:"button",onClick:()=>s(l),children:[g.jsx("span",{"aria-hidden":"true",className:Ie("flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors",u?"border-accent bg-accent text-accent-foreground":"border-border bg-surface"),children:u?g.jsx(Vw,{className:"size-2.5"}):null}),g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-white",children:g.jsx(xr,{onLightBackground:!0,provider:l,size:14})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:qe(l)})]})},l)})})]})})]})}function w1(e,t,r){if(e.length===0){r([]);return}if(e.length===t.length&&t.every(n=>e.includes(n))){r(null);return}r(e)}const Uo="Asia/Shanghai",ed=new Map;function P1(e){let t=ed.get(e);return t||(t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",hourCycle:"h23",minute:"2-digit"}),ed.set(e,t)),t}function jv(e,t=Uo){const r=typeof e=="string"?new Date(e):e;if(Number.isNaN(r.getTime()))return{date:"1970-01-01",hour:0};const n=P1(t).formatToParts(r),i=a=>{var o;return((o=n.find(s=>s.type===a))==null?void 0:o.value)??""};return{date:`${i("year")}-${i("month")}-${i("day")}`,hour:Number(i("hour"))}}function an(e=Uo,t=new Date){return jv(t,e).date}function _u(e=Uo,t=new Date){return jv(t,e).hour}function k1(e,t){const[r,n,i]=e.split("-").map(Number);return new Date(Date.UTC(r??1970,(n??1)-1,(i??1)+t)).toISOString().slice(0,10)}function td(e,t=Uo,r=new Date){const n=an(t,r);return k1(n,-(Math.max(1,e)-1))}function Av(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));return Number.isFinite(r.getTime())?r:null}function ia(e){return e.toISOString().slice(0,10)}function yn(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Sv(e,t){return Math.floor((Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))/864e5)}function Us(e,t){if(!e.length)return 0;const r=(e.length-1)*t,n=Math.floor(r),i=r-n,a=e[n]??e[e.length-1],o=e[Math.min(e.length-1,n+1)]??e[e.length-1];return Math.round(a+(o-a)*i)}function O1(e){return e<=0?0:e>=4?4:e}function j1(e,t=26){var y;const r=Av(an())??new Date,n=yn(r,-(t*7-1)),i=n.getUTCDay(),a=yn(n,-i),o=new Map;for(const b of e)o.set(b.date,{value:Math.max(0,b.tokens),models:b.models??null});const s=Sv(a,r)+1,l=Math.ceil(s/7),u=[];for(let b=0;b<s;b++){const x=ia(yn(a,b)),w=((y=o.get(x))==null?void 0:y.value)??0;w>0&&u.push(w)}u.sort((b,x)=>b-x);const c=Us(u,.5),f=Us(u,.75),d=Us(u,.9);function p(b){return!b||b<=0?0:b<=c?1:b<=f?2:b<=d?3:4}const v=[];for(let b=0;b<l;b++){const x=[];for(let w=0;w<7;w++){const P=yn(a,b*7+w);if(P.getTime()>r.getTime()){x.push(null);continue}const O=ia(P),k=o.get(O),j=(k==null?void 0:k.value)??0;x.push({day:O,value:j,level:O1(p(j)),models:(k==null?void 0:k.models)??null})}v.push(x)}const m=v.length>t?v.slice(v.length-t):v;return{from:ia(n),to:ia(r),weeks:m,thresholds:{t1:c,t2:f,t3:d}}}function rd(){return"UTC+08:00"}function A1(e,t,r){if(!e)return[];const n=Av(t)??new Date,i=yn(n,-n.getUTCDay()),a=yn(i,-(e-1)*7),o=[];for(let u=11;u>=0;u-=1)o.push(new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()-u,1)));const s=[],l=new Set;for(const u of o){const c=Math.floor(Sv(a,u)/7);c<0||c>=e||l.has(c)||(l.add(c),s.push({label:r[u.getUTCMonth()],index:c}))}return s}const S1="";function Ti(e){const t=e.indexOf(S1);return t===-1?{source:null,model:e}:{source:e.slice(0,t),model:e.slice(t+1)}}const E1="var(--chart-",_1=8;function Da(e){const t=e%_1+1;return`${E1}${t})`}function T1(e){const t=new Map;for(const n of e){if(n.tokens<=0)continue;const i=t.get(n.model);(!i||n.tokens>i.tokens)&&t.set(n.model,{source:n.source,tokens:n.tokens})}const r=new Map;for(const[n,i]of t)r.set(n,i.source);return r}const wt="unattributed",$a="未归类";function C1(e){const t=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(u=>{const c=new Map;for(const p of u.models){if(!p.model||p.tokens<=0)continue;const v=c.get(p.model)??{tokens:0,costUsd:0,pct:0};v.tokens+=p.tokens,v.costUsd+=p.costUsd,v.pct+=p.pct,c.set(p.model,v),r.set(p.model,(r.get(p.model)??0)+p.tokens)}let f=0,d=0;for(const p of c.values())f+=p.tokens,d+=p.costUsd;return{row:u,models:c,unattributedTokens:Math.max(0,u.tokens-f),unattributedCostUsd:Math.max(0,u.costUsd-d)}}),i=[...r.entries()].sort((u,c)=>c[1]-u[1]).map(([u,c],f)=>({key:`model-${f}`,model:u,color:Da(f),tokens:c})),a=n.reduce((u,c)=>u+c.unattributedTokens,0);a>0&&i.push({key:wt,model:$a,color:"var(--muted)",tokens:a,isUnattributed:!0});const o=new Map(i.filter(u=>!u.isUnattributed).map(u=>[u.model,u])),s=Object.fromEntries(i.map(u=>[u.key,{label:u.model,color:u.color}])),l=n.map(({row:u,models:c,unattributedTokens:f,unattributedCostUsd:d})=>{const p={source:u.source,tokens:u.tokens,costUsd:u.costUsd,pct:u.pct,modelCount:u.models.length,segments:{}};for(const v of i)p[v.key]=0;for(const[v,m]of c){const y=o.get(v);y&&(p[y.key]=m.tokens,p.segments[y.key]={key:y.key,model:v,tokens:m.tokens,costUsd:m.costUsd,pct:m.pct})}return f>0&&(p[wt]=f,p.segments[wt]={key:wt,model:$a,tokens:f,costUsd:d,pct:u.tokens>0?f/u.tokens*100:0,isUnattributed:!0}),p});return{config:s,rows:l,series:i}}function M1(e){const t=e.filter(c=>c.tokens>0).sort((c,f)=>f.tokens-c.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(c=>{const f=new Map;for(const v of c.models){if(!v.model||!v.source||v.tokens<=0)continue;const m=`${v.source}\0${v.model}`,y=f.get(m)??{source:v.source,model:v.model,tokens:0,costUsd:0,pct:0};y.tokens+=v.tokens,y.costUsd+=v.costUsd,y.pct+=v.pct,f.set(m,y);const b=r.get(m)??{source:v.source,model:v.model,tokens:0};b.tokens+=v.tokens,r.set(m,b)}let d=0,p=0;for(const v of f.values())d+=v.tokens,p+=v.costUsd;return{row:c,models:f,unattributedTokens:Math.max(0,c.tokens-d),unattributedCostUsd:Math.max(0,c.costUsd-p)}}),i=[...r.entries()].sort((c,f)=>f[1].tokens-c[1].tokens).map(([c,f],d)=>({key:`seg-${d}`,pairKey:c,model:f.model,source:f.source,color:Da(d),tokens:f.tokens})),a=n.reduce((c,f)=>c+f.unattributedTokens,0);a>0&&i.push({key:wt,pairKey:wt,model:$a,source:"",color:"var(--muted)",tokens:a});const o=new Map(i.filter(c=>c.key!==wt).map(c=>[c.pairKey,c])),s=i.map(c=>({key:c.key,model:c.model,source:c.source,color:c.color,tokens:c.tokens,...c.key===wt?{isUnattributed:!0}:{}})),l=Object.fromEntries(s.map(c=>[c.key,{label:c.source?`${c.source}:${c.model}`:c.model,color:c.color}])),u=n.map(({row:c,models:f,unattributedTokens:d,unattributedCostUsd:p})=>{const v={project:c.project,label:c.label,tokens:c.tokens,costUsd:c.costUsd,pct:c.pct,modelCount:c.models.length,segments:{}};for(const m of s)v[m.key]=0;for(const[m,y]of f){const b=o.get(m);b&&(v[b.key]=y.tokens,v.segments[b.key]={key:b.key,model:y.model,source:y.source,tokens:y.tokens,costUsd:y.costUsd,pct:y.pct})}return d>0&&(v[wt]=d,v.segments[wt]={key:wt,model:$a,source:"",tokens:d,costUsd:p,pct:c.tokens>0?d/c.tokens*100:0,isUnattributed:!0}),v});return{config:l,rows:u,series:s}}const I1=/%[0-9A-Fa-f]{2}/;function N1(e){const t=e.replace(/\\/g,"/").replace(/\/+$/,""),r=t.lastIndexOf("/");return(r>=0?t.slice(r+1):t).trim()||"unknown"}function Ev(e){let t=e;for(let r=0;r<4;r++){if(!I1.test(t))return t;try{const n=decodeURIComponent(t);if(n===t)return t;t=n}catch{return t}}return t}function D1(e){if(!/^file:/i.test(e))return e;let t=e.replace(/^file:\/\//i,"");return/^localhost\//i.test(t)&&(t=t.slice(9)),t!==""&&!t.startsWith("/")&&!/^[A-Za-z]:/.test(t)&&(t=`/${t}`),Ev(t)}function $1(e){const t=Ev(e).trim();return D1(t).trim()}function Tu(e){const t=$1(e).replace(/[\\/]+$/,"");return!t||t==="unknown"?"unknown":N1(t)}const zo=["周一","周二","周三","周四","周五","周六","周日"],_v=Array.from({length:24},(e,t)=>String(t).padStart(2,"0"));function Tv(e){const t=new Date,r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return Array.from({length:e},(n,i)=>{const a=new Date(r);return a.setUTCDate(r.getUTCDate()-(e-1-i)),a.toISOString().slice(0,10)})}function Cv(e){const[,t="",r=""]=e.split("-");return`${Number(t)}/${Number(r)}`}const nd=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],zs=[{source:"claude-code",model:"claude-fable-5",terminal:"VS Code",project:"ai-usage",weight:26,scale:1.35},{source:"claude-code",model:"MiniMax-M3",terminal:"系统终端",project:"ai-usage",weight:18,scale:1.7},{source:"claude-code",model:"claude-sonnet-4-6",terminal:"VS Code",project:"dashboard",weight:12,scale:1},{source:"codex",model:"gpt-5",terminal:"系统终端",project:"api-service",weight:18,scale:1.2},{source:"codex",model:"gpt-5-mini",terminal:"VS Code",project:"docs-site",weight:10,scale:.72},{source:"cursor",model:"claude-sonnet-4-6",terminal:"Cursor",project:"design-system",weight:10,scale:.88},{source:"cursor",model:"gemini-2-5-pro",terminal:"Cursor",project:"marketing-site",weight:6,scale:1.08}],Cu=365,R1=L1(),oi=U1(R1),ln={hourlyUsage:[],rangeDailyUsage:[],heatmapDailyUsage:[],heatmapDays:[],modelRows:[],hourlyApiRows:[],todayHourlyUsage:[],dailyUsage:[],summary:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0},changes:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0},distributions:{terminals:[],tools:[],models:[],projects:[]},toolModelUsage:[],projectModelUsage:[]};function L1(){return zo.flatMap((e,t)=>_v.map((r,n)=>{const i=z1(t,n),a=t>=5,o=Math.max(0,1-Math.abs(n-10)/5),s=Math.max(0,1-Math.abs(n-20)/5),l=(Math.sin((t+1)*(n+3)*.77)+1)/2,c=Math.min(1,.03+(a?.62:1)*(o*.4+s*.57)+l*.14),f=Math.round((500+c*38e3)*i.scale),d=.72+l*.12,p=Math.round(f*d),v=f-p,m=i.model.includes("MiniMax")||i.model.includes("fable")?.42+l*.28:.08+l*.18,y=Math.min(p,Math.round(p*m)),b=Pr(p*4e-6+v*16e-6);return{day:e,hour:n,hourLabel:r,inputTokens:p,cachedInputTokens:y,outputTokens:v,totalTokens:f,costUsd:b,durationMinutes:Math.round(3+c*72),source:i.source,model:i.model,terminal:i.terminal,project:i.project}}))}function U1(e){var u;const t=Nu(e),r=B1(e),n=e.map(c=>({day:c.day,hour:c.hour,hourLabel:c.hourLabel,inputTokens:c.inputTokens,cachedInputTokens:c.cachedInputTokens,outputTokens:c.outputTokens,totalTokens:c.totalTokens,costUsd:c.costUsd,durationMinutes:c.durationMinutes})),i=(u=r.at(-1))==null?void 0:u.day,a=i?n.filter(c=>c.day===i):[],o=F1(r),s=W1(o),l=K1(e,t.totalTokens);return{hourlyUsage:n,rangeDailyUsage:r,heatmapDailyUsage:o,heatmapDays:s,modelRows:l,hourlyApiRows:[],todayHourlyUsage:a,dailyUsage:r,summary:t,changes:Du(r),distributions:{terminals:aa(e,c=>c.terminal),tools:aa(e,c=>c.source),models:aa(e,c=>c.model),projects:aa(e,c=>c.project)},toolModelUsage:Mu(e.map(c=>({source:c.source,tokens:c.totalTokens,costUsd:c.costUsd,models:[{model:c.model,tokens:c.totalTokens,costUsd:c.costUsd}]})),t.totalTokens),projectModelUsage:Iu(Object.values(e.reduce((c,f)=>{const d=c[f.project]??{project:f.project,tokens:0,costUsd:0,models:[]};return d.tokens+=f.totalTokens,d.costUsd+=f.costUsd,d.models.push({model:f.model,source:f.source,tokens:f.totalTokens,costUsd:f.costUsd}),c[f.project]=d,c},{})),t.totalTokens)}}function Mu(e,t){const r=new Map;for(const a of e){if(!a.source||a.tokens<=0)continue;const o=r.get(a.source)??{tokens:0,costUsd:0,models:new Map};o.tokens+=a.tokens,o.costUsd+=a.costUsd;for(const s of a.models){if(!s.model||s.tokens<=0)continue;const l=o.models.get(s.model)??{tokens:0,costUsd:0};l.tokens+=s.tokens,l.costUsd+=s.costUsd,o.models.set(s.model,l)}r.set(a.source,o)}const n=[...r.entries()].sort(([,a],[,o])=>o.tokens-a.tokens),i=t&&t>0?t:n.reduce((a,[,o])=>a+o.tokens,0);return n.map(([a,o])=>({source:a,tokens:o.tokens,costUsd:Pr(o.costUsd),pct:Ra(o.tokens,i),models:[...o.models.entries()].sort(([,s],[,l])=>l.tokens-s.tokens).map(([s,l])=>({model:s,tokens:l.tokens,costUsd:Pr(l.costUsd),pct:Ra(l.tokens,o.tokens)}))}))}function Iu(e,t=0){const r=new Map;for(const a of e){if(a.tokens<=0)continue;const o=Tu(a.project),s=r.get(o)??{project:o,tokens:0,costUsd:0,models:new Map};s.tokens+=a.tokens,s.costUsd+=a.costUsd;for(const l of a.models??[]){if(l.tokens<=0)continue;const u=`${l.source}\0${l.model}`,c=s.models.get(u)??{model:l.model,source:l.source,tokens:0,costUsd:0};c.tokens+=l.tokens,c.costUsd+=l.costUsd,s.models.set(u,c)}r.set(o,s)}const n=Array.from(r.values()),i=t>0?t:n.reduce((a,o)=>a+o.tokens,0);return n.map(a=>({project:a.project,label:a.project==="unknown"?"未知项目":a.project,tokens:a.tokens,costUsd:Pr(a.costUsd),pct:Ra(a.tokens,i),models:[...a.models.values()].map(o=>({model:o.model,source:o.source,tokens:o.tokens,costUsd:Pr(o.costUsd),pct:Ra(o.tokens,a.tokens)})).sort((o,s)=>s.tokens-o.tokens)})).sort((a,o)=>o.tokens-a.tokens)}function z1(e,t){const r=zs.reduce((i,a)=>i+a.weight,0);let n=(e*31+t*17)%r;for(const i of zs)if(n-=i.weight,n<0)return i;return zs[0]}function Nu(e){const t=e.reduce((r,n)=>({inputTokens:r.inputTokens+n.inputTokens,outputTokens:r.outputTokens+n.outputTokens,totalTokens:r.totalTokens+n.totalTokens,totalCostUsd:r.totalCostUsd+n.costUsd,totalDurationMinutes:r.totalDurationMinutes+n.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{...t,totalCostUsd:Pr(t.totalCostUsd)}}function B1(e){return Tv(zo.length).map(r=>{const n=Mv(r),i=e.filter(s=>s.day===n),a=Nu(i),o=i.reduce((s,l)=>s+l.cachedInputTokens,0);return{day:n,date:r,dateLabel:Cv(r),...a,cachedInputTokens:o,uncachedInputTokens:a.inputTokens-o,costUsd:a.totalCostUsd,durationMinutes:a.totalDurationMinutes}})}function F1(e){return e.length===0?[]:Tv(Cu).map((r,n)=>{const i=e[n%e.length],o=.35+(Math.sin(n*.37)+1)/2*.9,l=(n*17+11)%5!==0?o:0;return{...i,day:Mv(r),date:r,dateLabel:Cv(r),inputTokens:Math.round(i.inputTokens*l),cachedInputTokens:Math.round(i.cachedInputTokens*l),uncachedInputTokens:Math.round(i.uncachedInputTokens*l),outputTokens:Math.round(i.outputTokens*l),totalTokens:Math.round(i.totalTokens*l),costUsd:Pr(i.costUsd*l),durationMinutes:Math.round(i.durationMinutes*l)}})}function W1(e){return e.map(t=>({date:t.date,tokens:t.totalTokens,costUsd:t.costUsd,models:{}}))}function K1(e,t){const r=new Map;for(const i of e){const a=`${i.source}:${i.model}`,o=r.get(a)??{model:i.model,source:i.source,tokens:0,costUsd:0};o.tokens+=i.totalTokens,o.costUsd+=i.costUsd,r.set(a,o)}const n=Math.max(1,t);return[...r.values()].filter(i=>i.tokens>0).sort((i,a)=>a.tokens-i.tokens).map(i=>({...i,pct:i.tokens/n*100}))}function Mv(e){const r=(new Date(`${e}T00:00:00.000Z`).getUTCDay()+6)%7;return zo[r]}function Du(e){if(e.length<2)return{totalCostUsd:0,totalTokens:0,inputTokens:0,outputTokens:0};const t=Math.floor(e.length/2),r=id(e.slice(0,t)),n=id(e.slice(t));return{totalCostUsd:oa(n.totalCostUsd,r.totalCostUsd),totalTokens:oa(n.totalTokens,r.totalTokens),inputTokens:oa(n.inputTokens,r.inputTokens),outputTokens:oa(n.outputTokens,r.outputTokens)}}function id(e){const t=Math.max(1,e.length),r=e.reduce((n,i)=>({inputTokens:n.inputTokens+i.inputTokens,outputTokens:n.outputTokens+i.outputTokens,totalTokens:n.totalTokens+i.totalTokens,totalCostUsd:n.totalCostUsd+i.costUsd,totalDurationMinutes:n.totalDurationMinutes+i.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{inputTokens:r.inputTokens/t,outputTokens:r.outputTokens/t,totalTokens:r.totalTokens/t,totalCostUsd:r.totalCostUsd/t,totalDurationMinutes:r.totalDurationMinutes/t}}function aa(e,t){const r=new Map;for(const n of e){const i=t(n),a=r.get(i)??{tokens:0,costUsd:0,durationMinutes:0};a.tokens+=n.totalTokens,a.costUsd+=n.costUsd,a.durationMinutes+=n.durationMinutes,r.set(i,a)}return[...r.entries()].sort(([,n],[,i])=>i.tokens-n.tokens).map(([n,i],a)=>({id:H1(n),label:n,color:nd[a%nd.length],tokens:i.tokens,costUsd:Pr(i.costUsd),durationMinutes:i.durationMinutes}))}function oa(e,t){return t<=0?0:Math.round((e-t)/t*1e4)/100}function Ra(e,t){return t<=0?0:Math.round(e/t*1e3)/10}function H1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function Pr(e){return Math.round(e*100)/100}function Iv(e,t,r,n){const i=e.reduce((f,d)=>f+d.tokens,0),a=e.reduce((f,d)=>f+d.costUsd,0),o=an(),s=e.find(f=>f.date===o),l=(s==null?void 0:s.tokens)??(n==null?void 0:n.tokens)??0,u=(s==null?void 0:s.costUsd)??(n==null?void 0:n.costUsd)??0,c=G1(t,i);return{totalTokens:i,totalCostUsd:Math.round(a*1e8)/1e8,todayTokens:l,todayCostUsd:Math.round(u*1e8)/1e8,statsSince:r,bySource:c}}function G1(e,t){const r=new Map;for(const i of e){if(i.tokens<=0)continue;let a=r.get(i.source);a||(a={tokens:0,costUsd:0,models:new Map},r.set(i.source,a)),a.tokens+=i.tokens,a.costUsd+=i.costUsd;const o=a.models.get(i.model)??{tokens:0,costUsd:0};o.tokens+=i.tokens,o.costUsd+=i.costUsd,a.models.set(i.model,o)}const n=t>0?t:[...r.values()].reduce((i,a)=>i+a.tokens,0);return Array.from(r.entries()).map(([i,a])=>({source:i,tokens:a.tokens,costUsd:Math.round(a.costUsd*1e8)/1e8,pct:n>0?Math.round(a.tokens/n*1e3)/10:0,models:Array.from(a.models.entries()).map(([o,s])=>({model:o,tokens:s.tokens,costUsd:Math.round(s.costUsd*1e8)/1e8,pct:a.tokens>0?Math.round(s.tokens/a.tokens*1e3)/10:0})).sort((o,s)=>s.tokens-o.tokens)})).sort((i,a)=>a.tokens-i.tokens)}const ad=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],q1={claude:"claude-code",codex:"codex",cursor:"cursor",qoder:"qoder",trae:"trae",gemini:"gemini",opencode:"opencode",copilot:"copilot",antigravity:"antigravity",openclaw:"openclaw",hermes:"hermes",zcode:"zcode",dsh:"dsh",pi:"pi",kimi:"kimi",roocode:"roocode",droid:"droid",kiro:"kiro",cline:"cline",amp:"amp",qwen:"qwen-code",codebuddy:"codebuddy",workbuddy:"workbuddy",grok:"grok",mimo:"mimo","every-code":"every-code",omp:"omp","kilo-cli":"kilo-cli",kilocode:"kilocode",goose:"goose",zed:"zed",warp:"warp"};function Y1(e,t=new Date){const r=_u(void 0,t);return e.filter(n=>n.hour<=r)}function V1(e,t=new Date){return{...e,todayHourlyUsage:Y1(e.todayHourlyUsage,t)}}function X1(e,t){var y;if(e.dailyRows.length===0)return V1(oi);const r=an(),n=td(t),i=e.dailyRows.filter(b=>b.date>=n&&b.date<=r),a=td(Cu),o=e.dailyRows.filter(b=>b.date>=a&&b.date<=r),s=e.modelRows.filter(b=>b.tokens>0),l=Iv(i,s,((y=e.syncStatus)==null?void 0:y.statsSince)||e.summary.statsSince,{tokens:e.summary.todayTokens,costUsd:e.summary.todayCostUsd}),u=i.map(Ol),c=o.map(Ol),f=o.map(b=>({date:b.date,tokens:b.tokens,costUsd:b.costUsd,models:b.models??{},projects:b.projects})),d=tP(u),p=Nv(u),v=e.hourlyRows??[],m=$u(v,r,_u());return{summary:p,rangeDailyUsage:u,heatmapDailyUsage:c,heatmapDays:f,modelRows:s,hourlyApiRows:v,todayHourlyUsage:m,dailyUsage:d,hourlyUsage:[],changes:Du(u),distributions:Dv(l.bySource,s,e.projectRows,p),toolModelUsage:Mu(l.bySource,p.totalTokens),projectModelUsage:Iu(e.projectRows,p.totalTokens)}}function od(e){const t=/^(\d{4}-\d{2}-\d{2})/.exec(String(e).trim());return(t==null?void 0:t[1])??""}function $u(e,t,r){const n=r===void 0?23:Math.min(Math.max(r,0),23),i=od(t),a=new Map;for(const s of e){if(!i||od(s.date)!==i)continue;const l=Number(s.hour);if(!Number.isInteger(l)||l<0||l>23)continue;const u=a.get(l)??{tokens:0,costUsd:0,inputTokens:0,outputTokens:0,cachedInputTokens:0};u.tokens+=s.tokens,u.costUsd+=s.costUsd,u.inputTokens+=s.inputTokens,u.outputTokens+=s.outputTokens,u.cachedInputTokens+=s.cachedInputTokens,a.set(l,u)}const o=Ru(i||t);return Array.from({length:n+1},(s,l)=>{const u=a.get(l),c=_v[l]??String(l).padStart(2,"0");if(!u)return rP(o,l,c);const f=u.inputTokens,d=u.outputTokens,p=Math.min(f,u.cachedInputTokens);return{day:o,hour:l,hourLabel:c,inputTokens:f,cachedInputTokens:p,outputTokens:d,totalTokens:u.tokens>0?u.tokens:f+d,costUsd:u.costUsd,durationMinutes:0}})}function Z1(e,t){const r=e.heatmapDays.find(v=>v.date===t),n=e.heatmapDailyUsage.find(v=>v.date===t),i=r??{date:t,tokens:(n==null?void 0:n.totalTokens)??0,costUsd:(n==null?void 0:n.costUsd)??0,models:{}},a=n??Ol(i,e.heatmapDailyUsage.length),o=J1(e.modelRows),s=Q1(i,o),l=eP(i,o),u=Iv([i],s,""),c=Nv([a]),f=an(),d=t===f?_u():void 0,p=$u(e.hourlyApiRows,t,d);return{...e,summary:c,rangeDailyUsage:[a],modelRows:s,todayHourlyUsage:p,hourlyUsage:[],changes:Du([a]),distributions:Dv(u.bySource,s,l,c),toolModelUsage:Mu(u.bySource,c.totalTokens),projectModelUsage:Iu(l,c.totalTokens)}}function J1(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function Q1(e,t){const r=Object.entries(e.models??{}).filter(([,a])=>a>0);if(r.length===0)return[];const n=r.reduce((a,[,o])=>a+o,0),i=La(e.costUsd,r.map(([,a])=>a));return r.map(([a,o],s)=>{const l=Ti(a),u=l.source??t.get(l.model)??"unknown";return{model:l.model,source:u,tokens:o,costUsd:i[s]??0,pct:n>0?Math.round(o/n*1e3)/10:0}}).sort((a,o)=>o.tokens-a.tokens)}function eP(e,t){const r=new Map;for(const o of e.projects??[]){if(o.tokens<=0)continue;const s=Tu(o.project),l=r.get(s)??{project:s,tokens:0,models:{}};l.tokens+=o.tokens;for(const[u,c]of Object.entries(o.models??{}))c<=0||(l.models[u]=(l.models[u]??0)+c);r.set(s,l)}const n=Array.from(r.values());if(n.length===0)return[];const i=n.reduce((o,s)=>o+s.tokens,0),a=La(e.costUsd,n.map(o=>o.tokens));return n.map((o,s)=>{const l=Object.entries(o.models??{}).filter(([,f])=>f>0),u=La(a[s]??0,l.map(([,f])=>f)),c=l.map(([f,d],p)=>{const v=Ti(f),m=v.source??t.get(v.model)??"unknown";return{model:v.model,source:m,tokens:d,costUsd:u[p]??0,pct:o.tokens>0?Math.round(d/o.tokens*1e3)/10:0}}).sort((f,d)=>d.tokens-f.tokens);return{project:o.project,tokens:o.tokens,costUsd:a[s]??0,pct:i>0?Math.round(o.tokens/i*1e3)/10:0,models:c}}).sort((o,s)=>s.tokens-o.tokens)}function Ol(e,t){const r=oi.dailyUsage[t%oi.dailyUsage.length],n=Fs(r.inputTokens,r.totalTokens,.78),i=Fs(r.cachedInputTokens,r.inputTokens,.2),a=Math.round(e.tokens*n),o=Math.max(0,e.tokens-a),s=Math.min(a,Math.round(a*i)),l=Math.round(e.tokens*Fs(oi.summary.totalDurationMinutes,oi.summary.totalTokens,0));return{day:Ru(e.date),date:e.date,dateLabel:Rv(e.date),inputTokens:a,cachedInputTokens:s,uncachedInputTokens:a-s,outputTokens:o,totalTokens:e.tokens,costUsd:aP(e.costUsd),durationMinutes:l}}function tP(e){var n;const t=new Map(e.map(i=>[i.date,i])),r=$v(((n=e.at(-1))==null?void 0:n.date)??new Date().toISOString());return Array.from({length:7},(i,a)=>{const o=new Date(r);o.setUTCDate(r.getUTCDate()-(6-a));const s=o.toISOString().slice(0,10),l=t.get(s);return l||{day:Ru(s),date:s,dateLabel:Rv(s),inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}})}function Nv(e){return Nu(e.map(t=>({day:t.day,hour:0,hourLabel:"00",inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd,durationMinutes:t.durationMinutes})))}function rP(e,t,r){return{day:e,hour:t,hourLabel:r,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}}function nP(e){const t=new Map;for(const r of e){const n=Tu(r.project),i=n==="unknown"?"未知项目":n,a=t.get(n)??{label:i,tokens:0,costUsd:0};a.tokens+=r.tokens,a.costUsd+=r.costUsd,t.set(n,a)}return Array.from(t.values())}function Dv(e,t,r,n){const i=e.map(o=>({label:q1[o.source]??o.source,tokens:o.tokens,costUsd:o.costUsd})),a=new Map;for(const o of t){const s=a.get(o.model)??{label:o.model,tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,a.set(o.model,s)}return{tools:i.length>0?Bs(i,n,6):[],models:a.size>0?Bs([...a.values()],n,6):[],terminals:[],projects:r.length>0?Bs(nP(r),n,6):[]}}function Bs(e,t,r=8){const n=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens),i=n.slice(0,r),a=n.slice(r);a.length>0&&i.push({label:"其他",tokens:a.reduce((u,c)=>u+c.tokens,0),costUsd:a.reduce((u,c)=>u+c.costUsd,0)});const o=jl(t.totalTokens,i.map(u=>u.tokens)),s=La(t.totalCostUsd,i.map(u=>u.costUsd||u.tokens)),l=jl(t.totalDurationMinutes,i.map(u=>u.tokens));return i.map((u,c)=>({id:iP(u.label)||`item-${c}`,label:u.label,color:ad[c%ad.length],tokens:o[c]??0,costUsd:s[c]??0,durationMinutes:l[c]??0}))}function jl(e,t){if(t.length===0)return[];const r=Math.max(0,Math.round(e)),n=t.reduce((l,u)=>l+Math.max(0,u),0);if(n<=0)return t.map(()=>0);const i=t.map(l=>Math.max(0,l)/n*r),a=i.map(Math.floor);let o=r-a.reduce((l,u)=>l+u,0);const s=i.map((l,u)=>({index:u,fraction:l-Math.floor(l)})).sort((l,u)=>u.fraction-l.fraction);for(let l=0;l<o;l+=1){const u=s[l%s.length];a[u.index]+=1}return a}function La(e,t){return jl(Math.round(e*100),t).map(r=>r/100)}function Fs(e,t,r){return t>0?e/t:r}function Ru(e){const r=($v(e).getUTCDay()+6)%7;return zo[r]}function $v(e){return new Date(`${e.slice(0,10)}T00:00:00.000Z`)}function Rv(e){const[,t="",r=""]=e.slice(0,10).split("-");return`${Number(t)}/${Number(r)}`}function iP(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function aP(e){return Math.round(e*100)/100}function Lv(e=[],t=[]){if(e.length>0)return e.filter(i=>i.tokens>0).map(i=>i.source);const r=new Set,n=[];for(const i of t)i.tokens<=0||r.has(i.source)||(r.add(i.source),n.push(i.source));return n}function Uv(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function zv(e,t){if(t==null)return e;const r=new Set(e);return t.filter(n=>r.has(n))}function sd(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t}function $n(e,t){if(t.has(e))return!0;const r=sd(e);for(const n of t)if(sd(n)===r)return!0;return!1}function Bv(e,t,r,n){if(t==null&&r==null)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=Object.entries(e).filter(([,l])=>l>0);if(i.length===0)return n.fallbackShare;const a=t==null?null:new Set(n.activeSources);let o=0,s=0;for(const[l,u]of i){o+=u;const c=Ti(l),f=c.source??n.sourceFallback.get(c.model)??"unknown";c.model,!(a&&!$n(f,a))&&(s+=u)}return o>0?s/o:0}function Fv(e,t,r,n){if(t==null&&r==null||e.length===0)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=t==null?null:new Set(n.activeSources);let a=0,o=0;for(const s of e)s.tokens<=0||(a+=s.tokens,!(i&&!$n(s.source,i))&&(o+=s.tokens));return a>0?o/a:0}function oP(e,t,r){if(t==null)return e;if(r.activeSources.length===0)return{};const n=new Set(r.activeSources),i={};for(const[a,o]of Object.entries(e)){if(o<=0)continue;const s=Ti(a),l=s.source??r.sourceFallback.get(s.model)??"unknown";$n(l,n)&&(i[a]=o)}return i}function sP(e){if(e.selectedSources.length===0)return{dailyRows:e.dailyRows,hourlyRows:e.hourlyRows};const t=e.selectedSources,r=Lv(e.toolRows,e.modelRows),n=zv(r,t),i=Uv(e.modelRows),a=Fv(e.modelRows,t,null,{activeSources:n}),o=new Map(e.heatmapDays.map(f=>[f.date,f])),s=f=>{const d=o.get(f);return d?Bv(d.models??{},t,null,{activeSources:n,sourceFallback:i,fallbackShare:a}):a},l=e.dailyRows.map(f=>cP(f,s(f.date))),u=e.hourlyDate;let c=e.hourlyRows;if(u!=null)if(e.hourlyApiRows.length===0)c=e.hourlyRows.map(f=>fP(f,s(u)));else{const f=new Set(n),d=n.length===0?[]:e.hourlyApiRows.filter(v=>$n(v.source||"unknown",f)),p=e.hourlyRows.length>0?Math.max(...e.hourlyRows.map(v=>v.hour)):void 0;c=$u(d,u,p)}return{dailyRows:l,hourlyRows:c}}function lP(e,t){if(t.length===0)return e;const r=new Set(t),n=[];for(const i of e){const a=i.models.filter(l=>$n(l.source,r));if(a.length===0)continue;const o=a.reduce((l,u)=>l+u.tokens,0);if(o<=0)continue;const s=a.reduce((l,u)=>l+u.costUsd,0);n.push({...i,tokens:o,costUsd:s,models:a.map(l=>({...l,pct:o>0?Math.round(l.tokens/o*1e3)/10:0}))})}return n.sort((i,a)=>a.tokens-i.tokens)}function uP(e){const t=e.filter(a=>a.tokens>0).sort((a,o)=>o.tokens-a.tokens),r=t.map((a,o)=>({id:a.source,label:qe(a.source),color:Da(o),tokens:a.tokens,costUsd:a.costUsd,durationMinutes:0})),n=new Map;for(const a of t)for(const o of a.models){if(!o.model||o.tokens<=0)continue;const s=n.get(o.model)??{tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,n.set(o.model,s)}const i=[...n.entries()].sort(([,a],[,o])=>o.tokens-a.tokens).map(([a,o],s)=>({id:a,label:a,color:Da(s),tokens:o.tokens,costUsd:o.costUsd,durationMinutes:0}));return{tools:r,models:i}}function cP(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,uncachedInputTokens:Math.max(0,r-n),outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}function fP(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}const Ws=14,Hr=3,Lu=18,ld=52,dP=80,hP=340,Ks=156,pP=["日","一","二","三","四","五","六"],mP=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];function vP(e,t){const r=Math.max(0,t-1)*Hr,n=Math.max(0,e-Lu-r);return Math.max(1,Math.floor(n/t)||1)}function gP(e){const t=h.useRef(null),[r,n]=h.useState(Ws),[i,a]=h.useState(e);return h.useEffect(()=>{const o=t.current;if(!o||e<=0)return;const s=()=>{const u=o.clientWidth,c=Math.floor((u-Lu+Hr)/(Ws+Hr)),f=Math.max(1,Math.min(e,c||1));f>=e?(a(e),n(vP(u,e))):(a(f),n(Ws))};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),()=>{l.disconnect(),window.removeEventListener("resize",s)}},[e]),{containerRef:t,cellSize:r,visibleWeeks:i}}function yP({cell:e,heatmapColors:t,modelEntries:r,isLoading:n}){const i=r;return g.jsxs("div",{className:"grid min-w-0 gap-2 text-xs",children:[g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsx("span",{className:"font-medium text-foreground",children:e.day}),g.jsxs("span",{className:"text-[10px] text-muted",children:["等级 ",e.level]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-full",style:{background:t[e.level]}}),g.jsx("span",{className:"flex-1 text-muted",children:"总用量"}),g.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",title:Pn(e.value),children:oe(e.value)})]}),n?g.jsxs("div",{"aria-label":"正在加载模型明细",className:"grid gap-2 pt-0.5",children:[g.jsx("span",{className:"h-2.5 w-14 animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-3 w-full animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-1 w-full animate-pulse rounded bg-surface-secondary"})]}):i.length>0?g.jsxs("div",{className:"grid gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:"模型明细"}),i.map(({key:a,name:o,source:s,val:l})=>{const u=e.value||1,c=Math.round(l/u*100),f=s?`${qe(s)} · ${o}`:o;return g.jsxs("div",{className:"grid min-w-0 gap-1",children:[g.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3",children:[g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 overflow-hidden",children:[s&&g.jsx(xr,{className:"shrink-0",provider:s,size:12}),g.jsx("span",{className:"truncate",title:f,children:f})]}),g.jsxs("span",{className:"whitespace-nowrap font-mono text-muted tabular-nums",title:Pn(l),children:[oe(l)," · ",c,"%"]})]}),g.jsx("div",{className:"h-1 overflow-hidden rounded-full bg-surface-secondary",children:g.jsx("div",{className:"h-full rounded-full bg-accent",style:{width:`${c}%`}})})]},a)})]}):null]})}function bP(e,t,r){const n=Object.entries(e.models??{}).map(([o,s])=>{const l=Ti(o),u=l.source??t.get(l.model);return{key:o,name:l.model,source:u,val:s}}).filter(({val:o,source:s})=>o<=0?!1:r?s?$n(s,r):!1:!0).sort((o,s)=>s.val-o.val),i=n.slice(0,6),a=new Set(i.map(o=>o.source).filter(Boolean));for(const o of n.slice(6))o.source&&!a.has(o.source)&&(i.push(o),a.add(o.source));return i}const xP=h.memo(function({visible:t,cellSize:r,selectedDate:n,onSelectDate:i,onPointerOver:a,onPointerLeave:o,onFocus:s,onBlur:l}){return g.jsx("div",{style:{gridColumn:"2 / -1",display:"grid",gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${r}px)`,gridTemplateColumns:`repeat(${t.length}, ${r}px)`,gap:Hr},onBlur:l,onFocus:s,onPointerLeave:o,onPointerOver:a,children:t.map((u,c)=>u.map((f,d)=>{if(!f)return null;const p=kl[f.level]??kl[0],v=n===f.day;return g.jsx("button",{"aria-label":`${f.day},${Pn(f.value)} Token`,"aria-pressed":i?v:void 0,className:v?"block cursor-pointer rounded-[3px] ring-1 ring-accent transition-[transform,background-color] duration-100 hover:scale-110":"block cursor-pointer rounded-[3px] transition-[transform,background-color] duration-100 hover:scale-110","data-day-index":d,"data-day":f.day,"data-week-index":c,style:{width:r,height:r,background:p},type:"button",onClick:()=>i==null?void 0:i(f.day)},f.day||`e-${c}-${d}`)}))})});function wP({days:e,models:t=[],toolRows:r=[],embedded:n=!1,hidePlatformFilter:i=!1,selectedSources:a,onSelectedSourcesChange:o,selectedDate:s=null,onSelectDate:l}){const{theme:u}=Cw(),[c,f]=h.useState(null),d=a??c,p=o??f,v=h.useMemo(()=>T1(t),[t]),m=h.useMemo(()=>Lv(r,t),[t,r]),y=h.useMemo(()=>zv(m,d),[m,d]),b=h.useMemo(()=>Uv(t),[t]),x=h.useMemo(()=>Fv(t,d,null,{activeSources:y}),[y,t,d]),w=h.useMemo(()=>d==null?e:e.map(C=>{const W=C.models??{},I=Bv(W,d,null,{activeSources:y,sourceFallback:b,fallbackShare:x}),Te=oP(W,d,{activeSources:y,sourceFallback:b});return{...C,tokens:Math.round(C.tokens*I),costUsd:C.costUsd*I,models:Te}}),[y,e,x,d,b]),P=h.useMemo(()=>j1(w.map(C=>({date:C.date,tokens:C.tokens,models:C.models})),ld),[w]),O=P.weeks,{containerRef:k,cellSize:j,visibleWeeks:E}=gP(O.length||ld),_=h.useMemo(()=>O.slice(-E),[O,E]),M=kl,T=h.useMemo(()=>A1(_.length,P.to,mP),[_.length,P.to]),[S,N]=h.useState(null),D=h.useRef(null),z=h.useRef(0),K=h.useCallback(C=>{D.current=C,N(C)},[]);h.useEffect(()=>()=>{window.clearTimeout(z.current)},[]);const F=h.useCallback(C=>{var We,_t;const W=C.dataset.day,I=Number(C.dataset.weekIndex),Te=Number(C.dataset.dayIndex),te=(We=_[I])==null?void 0:We[Te];if(!W||!te||(window.clearTimeout(z.current),((_t=D.current)==null?void 0:_t.day)===W)||!C.isConnected)return;const Ce=C.getBoundingClientRect();K({day:W,cell:te,left:Ce.left+Ce.width/2,top:Ce.top,bottom:Ce.bottom})},[K,_]),H=h.useCallback(()=>{window.clearTimeout(z.current),z.current=window.setTimeout(()=>K(null),dP)},[K]),B=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),X=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),ye=S!=null;h.useEffect(()=>{if(!ye)return;const C=()=>K(null);return window.addEventListener("scroll",C,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",C,{capture:!0})},[ye,K]);const ne=`${Lu}px repeat(${_.length}, ${j}px)`,Ze=d==null?m:d.filter(C=>m.includes(C)),Le=h.useMemo(()=>d==null?null:new Set(y),[y,d]),_e=(S==null?void 0:S.cell)??null,[ot,Yt]=h.useState(null);if(h.useEffect(()=>{if(!_e){Yt(null);return}Yt(null);const C=window.requestAnimationFrame(()=>{Yt({day:_e.day,entries:bP(_e,v,Le)})});return()=>window.cancelAnimationFrame(C)},[v,Le,_e]),!O.length)return g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"暂无用量数据"});let Ue=null;if(S&&_e){const C=S.top<hP,W=Math.min(Math.max(S.left,Ks),Math.max(Ks,window.innerWidth-Ks));Ue=_i.createPortal(g.jsx("div",{className:"pointer-events-none fixed z-50 w-72 max-w-[calc(100vw-24px)] rounded-[10px] border-0 bg-overlay p-3 text-overlay-foreground shadow-surface",role:"tooltip",style:{left:W,top:C?S.bottom+8:S.top-8,transform:C?"translateX(-50%)":"translate(-50%, -100%)"},children:g.jsx(yP,{cell:_e,heatmapColors:M,isLoading:(ot==null?void 0:ot.day)!==_e.day,modelEntries:(ot==null?void 0:ot.day)===_e.day?ot.entries:[]})}),document.body)}const R=g.jsxs("div",{ref:k,className:"w-full min-w-0",children:[!i||!n?g.jsxs("div",{className:"mb-2 flex items-center justify-end gap-3",children:[n?null:g.jsx("span",{className:"mr-auto text-xs text-muted",children:rd()}),i?null:g.jsx(x1,{allSources:m,value:Ze,onChange:C=>w1(C,m,p)})]}):null,d!=null&&y.length===0?g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"请至少选择一个平台"}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-full overflow-hidden",children:g.jsxs("div",{className:"w-full min-w-0",children:[g.jsxs("div",{className:"mb-1.5 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("span",{}),T.map(C=>g.jsx("span",{style:{gridColumnStart:C.index+2,whiteSpace:"nowrap"},children:C.label},`${C.label}-${C.index}`))]}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("div",{className:"pr-1 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateRows:`repeat(7, ${j}px)`,rowGap:Hr},children:pP.map(C=>g.jsx("span",{className:"flex items-center",style:{lineHeight:1},children:C},C))}),g.jsx(xP,{cellSize:j,onBlur:H,onFocus:X,onPointerLeave:H,onPointerOver:B,onSelectDate:l,selectedDate:s,visible:_})]})]})}),g.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:rd()}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[10px] text-muted",children:"少"}),g.jsx("div",{className:"flex gap-1",children:M.map((C,W)=>g.jsx("span",{className:"size-3 rounded-[2px]",style:{background:C}},W))}),g.jsx("span",{className:"text-[10px] text-muted",children:"多"})]})]}),Ue]})]});return n?R:g.jsx(q,{children:g.jsx(q.Content,{children:R})})}function PP({dailyUsage:e,heatmapDays:t,modelRows:r=[],metricTrends:n,summary:i,selectedDate:a=null,onSelectDate:o}){const s=[{label:"预估费用",value:i.totalCostUsd,format:at,exactFormat:at,trend:{comparison:n.totalCostUsd,display:"percent",values:e.map(l=>l.costUsd)}},{label:"总 Token",value:i.totalTokens,format:oe,exactFormat:Pn,trend:{comparison:n.totalTokens,display:"percent",values:e.map(l=>l.totalTokens)}},{label:"输入 Token",value:i.inputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.inputTokens,display:"tokens",values:e.map(l=>l.inputTokens)}},{label:"输出 Token",value:i.outputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.outputTokens,display:"tokens",values:e.map(l=>l.outputTokens)}}];return g.jsxs("section",{"aria-label":"用量概览",className:"w-full",children:[g.jsx("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:s.map(l=>{var u;return g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid h-full grid-rows-[1.25rem_1fr] content-start gap-3 p-0",children:[g.jsxs("div",{className:"flex h-5 min-w-0 items-center justify-between gap-2",children:[g.jsx("p",{className:"min-w-0 truncate text-xs font-medium leading-5 text-muted",children:l.label}),g.jsx("div",{className:"flex h-5 shrink-0 items-center justify-end",children:l.trend.comparison?g.jsx(AP,{display:l.trend.display,trend:l.trend.comparison}):null})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(OP,{exactFormat:l.exactFormat,format:l.format,label:l.label,value:l.value}),g.jsx(jP,{isIncrease:(((u=l.trend.comparison)==null?void 0:u.changeValue)??0)>=0,label:`近 7 日${l.label}趋势`,values:l.trend.values})]})]})},l.label)})}),g.jsx(q,{className:"mt-4",children:g.jsx(q.Content,{children:g.jsx(kP,{days:t,modelRows:r,onSelectDate:o,selectedDate:a})})})]})}function kP({days:e,modelRows:t,selectedDate:r,onSelectDate:n}){return g.jsx(wP,{days:e,embedded:!0,models:t,onSelectDate:n,selectedDate:r})}function OP({exactFormat:e,format:t,label:r,value:n}){const i=SP(n);return g.jsx("div",{"aria-label":`${r} ${e(n)}`,className:"min-w-0 truncate text-lg font-semibold leading-7 tracking-tight text-foreground tabular-nums",title:e(n),children:t(i)})}function jP({label:e,values:t,isIncrease:r}){const n=h.useId().replace(/:/g,""),i=h.useMemo(()=>t.filter(p=>Number.isFinite(p)),[t]);if(i.length<2)return g.jsx("div",{"aria-hidden":"true",className:"h-6 w-16 justify-self-end"});const a=64,o=24,s=2,l=Math.min(...i),c=Math.max(...i)-l||1,f=r?"var(--chart-2)":"var(--chart-5)",d=i.map((p,v)=>{const m=s+v/Math.max(i.length-1,1)*(a-s*2),y=o-s-(p-l)/c*(o-s*2);return`${v===0?"M":"L"} ${m.toFixed(2)} ${y.toFixed(2)}`}).join(" ");return g.jsx("div",{"aria-label":e,className:"pointer-events-none h-6 w-16 justify-self-end",role:"img",children:g.jsxs("svg",{"aria-hidden":"true",className:"h-full w-full overflow-visible",viewBox:`0 0 ${a} ${o}`,children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:n,x1:"0",x2:"0",y1:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:f,stopOpacity:.24}),g.jsx("stop",{offset:"100%",stopColor:f,stopOpacity:0})]})}),g.jsx("path",{d:`${d} L ${a-s} ${o} L ${s} ${o} Z`,fill:`url(#${n})`}),g.jsx("path",{d,fill:"none",stroke:f,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})]})})}function AP({display:e,trend:t}){const r=t.changeValue>=0,n=r?"上涨":"下降",i=e==="tokens"?`${r?"+":"−"}${oe(Math.abs(t.changeValue))}`:`${Math.abs(t.changePct).toFixed(1)}%`;return g.jsxs(Na,{"aria-label":`${n} ${i}`,className:"shrink-0",color:r?"success":"danger",size:"sm",variant:"soft",children:[g.jsx("span",{"aria-hidden":"true",children:r?"↑":"↓"}),g.jsx(Na.Label,{className:"tabular-nums",children:i})]})}function SP(e,t=1200){const[r,n]=h.useState(e),i=h.useRef(e);return h.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){i.current=e,n(e);return}const a=i.current;if(Object.is(a,e)||Math.abs(a-e)<1e-9){i.current=e,n(e);return}let o=0;const s=performance.now(),l=u=>{const c=Math.min((u-s)/t,1),f=1-Math.pow(1-c,3),d=a+(e-a)*f;i.current=d,n(d),c<1&&(o=requestAnimationFrame(l))};return o=requestAnimationFrame(l),()=>cancelAnimationFrame(o)},[t,e]),r}const Ua=[{id:"hawking",image:Mw,glow:{primary:"#ff7a1a",accent:"#ffd21f"}},{id:"yoyo",image:Iw,glow:{primary:"#2f7df6",accent:"#ffd84a"}},{id:"click",image:Nw,glow:{primary:"#51d6a2",accent:"#ff7b8d"}}],un=72,EP=110,_P=2400,ud=80,cd=88;function fd(e){const t=Ua.filter(n=>n.id!==e),r=t.length>0?t:Ua;return r[Math.floor(Math.random()*r.length)].id}function TP(){const[e,t]=h.useState(()=>fd()),r=h.useRef(null);h.useEffect(()=>{const a=window.setInterval(()=>{t(o=>fd(o))},_P);return()=>window.clearInterval(a)},[]),h.useEffect(()=>{const a=r.current;if(!a)return;let o=0,s=null,l=-un,u=1;const c=f=>{if(o=requestAnimationFrame(c),s==null){s=f;return}const d=Math.min(.05,(f-s)/1e3);s=f,l+=u*EP*d,l>=un?(l=un,u=-1):l<=-un&&(l=-un,u=1),a.style.transform=`translateX(${l}px) scaleX(${u>0?1:-1})`};return o=requestAnimationFrame(c),()=>cancelAnimationFrame(o)},[e]);const n=Ua.find(a=>a.id===e)??Ua[0],i=ud+un*2;return g.jsx("div",{"aria-hidden":"true",className:"pet-running-loader",style:{width:i,height:cd,"--pet-glow-primary":n.glow.primary,"--pet-glow-accent":n.glow.accent},children:g.jsx("img",{alt:"",className:"pet-running-loader__sprite",height:cd,ref:r,src:n.image,width:ud})})}const dd=["小伙伴跑腿去了…","数据在前面,冲!","再跑两步就好…","正在追 Token…","加载加速中,呼呼~","马上就回来~","别急,它跑得很快","捡数据路上…"],CP=1800;function Hs(e){const t=dd.filter(n=>n!==e),r=t.length>0?t:dd;return r[Math.floor(Math.random()*r.length)]}function hd({visible:e}){const[t,r]=h.useState(()=>Hs());return h.useEffect(()=>{if(!e)return;r(Hs());const n=window.setInterval(()=>{r(i=>Hs(i))},CP);return()=>window.clearInterval(n)},[e]),e?g.jsx("div",{"aria-busy":"true","aria-live":"polite",className:"absolute inset-0 z-10 bg-background/40",role:"status",children:g.jsx("div",{className:"pointer-events-none fixed inset-0 z-10 flex items-center justify-center",children:g.jsxs("div",{className:"relative flex items-center justify-center",children:[g.jsx(TP,{}),g.jsx("p",{className:"absolute top-full mt-3 min-h-5 w-max text-center text-sm text-muted transition-opacity duration-200",children:t},t)]})})}):null}var MP=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Uu(e){if(typeof e!="string")return!1;var t=MP;return t.includes(e)}var IP=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],NP=new Set(IP);function Wv(e){return typeof e!="string"?!1:NP.has(e)}function Kv(e){return typeof e=="string"&&e.startsWith("data-")}function et(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Wv(r)||Kv(r))&&(t[r]=e[r]);return t}function Xr(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return et(t)}return typeof e=="object"&&!Array.isArray(e)?et(e):null}function Ve(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Wv(r)||Kv(r)||Uu(r))&&(t[r]=e[r]);return t}function DP(e){return e==null?null:h.isValidElement(e)?Ve(e.props):typeof e=="object"&&!Array.isArray(e)?Ve(e):null}var $P=["children","width","height","viewBox","className","style","title","desc"];function Al(){return Al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Al.apply(null,arguments)}function RP(e,t){if(e==null)return{};var r,n,i=LP(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function LP(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Hv=h.forwardRef((e,t)=>{var{children:r,width:n,height:i,viewBox:a,className:o,style:s,title:l,desc:u}=e,c=RP(e,$P),f=a||{width:n,height:i,x:0,y:0},d=Z("recharts-surface",o);return h.createElement("svg",Al({},Ve(c),{className:d,width:n,height:i,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,u),r)}),UP=["children","className"];function Sl(){return Sl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sl.apply(null,arguments)}function zP(e,t){if(e==null)return{};var r,n,i=BP(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function BP(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var he=h.forwardRef((e,t)=>{var{children:r,className:n}=e,i=zP(e,UP),a=Z("recharts-layer",n);return h.createElement("g",Sl({className:a},Ve(i),{ref:t}),r)}),FP=h.createContext(null);function ae(e){return function(){return e}}const Gv=Math.cos,za=Math.sin,St=Math.sqrt,Ba=Math.PI,Bo=2*Ba,El=Math.PI,_l=2*El,Rr=1e-6,WP=_l-Rr;function qv(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function KP(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return qv;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class HP{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?qv:KP(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,a,o){this._append`C${+t},${+r},${+n},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(t,r,n,i,a){if(t=+t,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=n-t,u=i-r,c=o-t,f=s-r,d=c*c+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Rr)if(!(Math.abs(f*l-u*c)>Rr)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-o,v=i-s,m=l*l+u*u,y=p*p+v*v,b=Math.sqrt(m),x=Math.sqrt(d),w=a*Math.tan((El-Math.acos((m+d-y)/(2*b*x)))/2),P=w/x,O=w/b;Math.abs(P-1)>Rr&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*p>c*v)},${this._x1=t+O*l},${this._y1=r+O*u}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(i),l=n*Math.sin(i),u=t+s,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${u},${c}`:(Math.abs(this._x1-u)>Rr||Math.abs(this._y1-c)>Rr)&&this._append`L${u},${c}`,n&&(d<0&&(d=d%_l+_l),d>WP?this._append`A${n},${n},0,1,${f},${t-s},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=c}`:d>Rr&&this._append`A${n},${n},0,${+(d>=El)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function zu(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new HP(t)}function Bu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Yv(e){this._context=e}Yv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Fo(e){return new Yv(e)}function Vv(e){return e[0]}function Xv(e){return e[1]}function Zv(e,t){var r=ae(!0),n=null,i=Fo,a=null,o=zu(s);e=typeof e=="function"?e:e===void 0?Vv:ae(e),t=typeof t=="function"?t:t===void 0?Xv:ae(t);function s(l){var u,c=(l=Bu(l)).length,f,d=!1,p;for(n==null&&(a=i(p=o())),u=0;u<=c;++u)!(u<c&&r(f=l[u],u,l))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(f,u,l),+t(f,u,l));if(p)return a=null,p+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:ae(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),s):t},s.defined=function(l){return arguments.length?(r=typeof l=="function"?l:ae(!!l),s):r},s.curve=function(l){return arguments.length?(i=l,n!=null&&(a=i(n)),s):i},s.context=function(l){return arguments.length?(l==null?n=a=null:a=i(n=l),s):n},s}function sa(e,t,r){var n=null,i=ae(!0),a=null,o=Fo,s=null,l=zu(u);e=typeof e=="function"?e:e===void 0?Vv:ae(+e),t=typeof t=="function"?t:ae(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?Xv:ae(+r);function u(f){var d,p,v,m=(f=Bu(f)).length,y,b=!1,x,w=new Array(m),P=new Array(m);for(a==null&&(s=o(x=l())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===b)if(b=!b)p=d,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),v=d-1;v>=p;--v)s.point(w[v],P[v]);s.lineEnd(),s.areaEnd()}b&&(w[d]=+e(y,d,f),P[d]=+t(y,d,f),s.point(n?+n(y,d,f):w[d],r?+r(y,d,f):P[d]))}if(x)return s=null,x+""||null}function c(){return Zv().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:ae(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:ae(+f),u):r},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(r)},u.lineX1=function(){return c().x(n).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:ae(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),u):a},u}class Jv{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function GP(e){return new Jv(e,!0)}function qP(e){return new Jv(e,!1)}const Fu={draw(e,t){const r=St(t/Ba);e.moveTo(r,0),e.arc(0,0,r,0,Bo)}},YP={draw(e,t){const r=St(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},Qv=St(1/3),VP=Qv*2,XP={draw(e,t){const r=St(t/VP),n=r*Qv;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},ZP={draw(e,t){const r=St(t),n=-r/2;e.rect(n,n,r,r)}},JP=.8908130915292852,eg=za(Ba/10)/za(7*Ba/10),QP=za(Bo/10)*eg,ek=-Gv(Bo/10)*eg,tk={draw(e,t){const r=St(t*JP),n=QP*r,i=ek*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=Bo*a/5,s=Gv(o),l=za(o);e.lineTo(l*r,-s*r),e.lineTo(s*n-l*i,l*n+s*i)}e.closePath()}},Gs=St(3),rk={draw(e,t){const r=-St(t/(Gs*3));e.moveTo(0,r*2),e.lineTo(-Gs*r,-r),e.lineTo(Gs*r,-r),e.closePath()}},dt=-.5,ht=St(3)/2,Tl=1/St(12),nk=(Tl/2+1)*3,ik={draw(e,t){const r=St(t/nk),n=r/2,i=r*Tl,a=n,o=r*Tl+r,s=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(s,l),e.lineTo(dt*n-ht*i,ht*n+dt*i),e.lineTo(dt*a-ht*o,ht*a+dt*o),e.lineTo(dt*s-ht*l,ht*s+dt*l),e.lineTo(dt*n+ht*i,dt*i-ht*n),e.lineTo(dt*a+ht*o,dt*o-ht*a),e.lineTo(dt*s+ht*l,dt*l-ht*s),e.closePath()}};function ak(e,t){let r=null,n=zu(i);e=typeof e=="function"?e:ae(e||Fu),t=typeof t=="function"?t:ae(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:ae(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Fa(){}function Wa(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function tg(e){this._context=e}tg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Wa(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Wa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ok(e){return new tg(e)}function rg(e){this._context=e}rg.prototype={areaStart:Fa,areaEnd:Fa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Wa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function sk(e){return new rg(e)}function ng(e){this._context=e}ng.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Wa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function lk(e){return new ng(e)}function ig(e){this._context=e}ig.prototype={areaStart:Fa,areaEnd:Fa,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function uk(e){return new ig(e)}function pd(e){return e<0?-1:1}function md(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(pd(a)+pd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function vd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function qs(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-n)/3;e._context.bezierCurveTo(n+s,i+s*t,a-s,o-s*r,a,o)}function Ka(e){this._context=e}Ka.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qs(this,this._t0,vd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,qs(this,vd(this,r=md(this,e,t)),r);break;default:qs(this,this._t0,r=md(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function ag(e){this._context=new og(e)}(ag.prototype=Object.create(Ka.prototype)).point=function(e,t){Ka.prototype.point.call(this,t,e)};function og(e){this._context=e}og.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function ck(e){return new Ka(e)}function fk(e){return new ag(e)}function sg(e){this._context=e}sg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=gd(e),i=gd(t),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function gd(e){var t,r=e.length-1,n,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function dk(e){return new sg(e)}function Wo(e,t){this._context=e,this._t=t}Wo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function hk(e){return new Wo(e,.5)}function pk(e){return new Wo(e,0)}function mk(e){return new Wo(e,1)}function Zr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,s=a.length;r<o;++r)for(i=a,a=e[t[r]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function Cl(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function vk(e,t){return e[t]}function gk(e){const t=[];return t.key=e,t}function yk(){var e=ae([]),t=Cl,r=Zr,n=vk;function i(a){var o=Array.from(e.apply(this,arguments),gk),s,l=o.length,u=-1,c;for(const f of a)for(s=0,++u;s<l;++s)(o[s][u]=[0,+n(f,o[s].key,u,a)]).data=f;for(s=0,c=Bu(t(o));s<l;++s)o[c[s]].index=s;return r(o,c),o}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:ae(Array.from(a)),i):e},i.value=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),i):n},i.order=function(a){return arguments.length?(t=a==null?Cl:typeof a=="function"?a:ae(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(r=a??Zr,i):r},i}function bk(e,t){if((n=e.length)>0){for(var r,n,i=0,a=e[0].length,o;i<a;++i){for(o=r=0;r<n;++r)o+=e[r][i][1]||0;if(o)for(r=0;r<n;++r)e[r][i][1]/=o}Zr(e,t)}}function xk(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,a=n.length;r<a;++r){for(var o=0,s=0;o<i;++o)s+=e[o][r][1]||0;n[r][1]+=n[r][0]=-s/2}Zr(e,t)}}function wk(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n<a;++n){for(var s=0,l=0,u=0;s<o;++s){for(var c=e[t[s]],f=c[n][1]||0,d=c[n-1][1]||0,p=(f-d)/2,v=0;v<s;++v){var m=e[t[v]],y=m[n][1]||0,b=m[n-1][1]||0;p+=y-b}l+=f,u+=p*f}i[n-1][1]+=i[n-1][0]=r,l&&(r-=u/l)}i[n-1][1]+=i[n-1][0]=r,Zr(e,t)}}function Ml(e){return e==="__proto__"}function lg(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function Wu(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function ug(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(ug).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function Ku(e){if(Array.isArray(e))return e.map(Wu);if(typeof e=="symbol")return[e];e=ug(e);const t=[],r=e.length;if(r===0)return t;let n=0,i="",a="",o=!1;for(e.charCodeAt(0)===46&&t.push("");n<r;){const s=e[n];if(a)s==="\\"&&n+1<r?(n++,i+=e[n]):s===a?a="":i+=s;else if(o)s==='"'||s==="'"?a=s:s==="]"?(o=!1,t.push(i),i=""):i+=s;else if(s==="[")o=!0,i&&(t.push(i),i="");else if(s==="."){i&&(t.push(i),i="");const l=e[n+1];(l===void 0||l===".")&&t.push("")}else i+=s;n++}return i&&t.push(i),t}function zt(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(Ml(t))return r;const n=e[t];return n===void 0?lg(t)&&!Object.hasOwn(e,t)?zt(e,Ku(t),r):r:n}case"number":case"symbol":{typeof t=="number"&&(t=Wu(t));const n=e[t];return n===void 0?r:n}default:{if(Array.isArray(t))return Pk(e,t,r);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),Ml(t))return r;const n=e[t];return n===void 0?r:n}}}function Pk(e,t,r){if(t.length===0)return r;let n=e;for(let i=0;i<t.length;i++){if(n==null||Ml(t[i]))return r;n=n[t[i]]}return n===void 0?r:n}var kk=4;function gr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kk,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function ve(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce((i,a,o)=>{var s=r[o-1];return typeof s=="string"?i+s+a:s!==void 0?i+gr(s)+a:i+a},"")}var Ne=e=>e===0?0:e>0?1:-1,jt=e=>typeof e=="number"&&e!=+e,Jr=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,$=e=>(typeof e=="number"||e instanceof Number)&&!jt(e),Bt=e=>$(e)||typeof e=="string",Ok=0,di=e=>{var t=++Ok;return"".concat(e||"").concat(t)},Ye=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!$(t)&&typeof t!="string")return n;var a;if(Jr(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return jt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},cg=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[String(e[n])])r[String(e[n])]=!0;else return!0;return!1};function Q(e,t,r){return $(e)&&$(t)?gr(e+r*(t-e)):t}function fg(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):zt(n,t))===r)}var ce=e=>e===null||typeof e>"u",Ci=e=>ce(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function nt(e){return e!=null}function ar(){}var jk=["type","size","sizeType"];function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Il.apply(null,arguments)}function yd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yd(Object(r),!0).forEach(function(n){Ak(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ak(e,t,r){return(t=Sk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sk(e){var t=Ek(e,"string");return typeof t=="symbol"?t:t+""}function Ek(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _k(e,t){if(e==null)return{};var r,n,i=Tk(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Tk(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var dg={symbolCircle:Fu,symbolCross:YP,symbolDiamond:XP,symbolSquare:ZP,symbolStar:tk,symbolTriangle:rk,symbolWye:ik},Ck=Math.PI/180,Mk=e=>{var t="symbol".concat(Ci(e));return dg[t]||Fu},Ik=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Ck;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Nk=(e,t)=>{dg["symbol".concat(Ci(e))]=t},hg=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=_k(e,jk),a=bd(bd({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var s=()=>{var d=Mk(o),p=ak().type(d).size(Ik(r,n,o)),v=p();if(v!==null)return v},{className:l,cx:u,cy:c}=a,f=Ve(a);return $(u)&&$(c)&&$(r)?h.createElement("path",Il({},f,{className:Z("recharts-symbols",l),transform:"translate(".concat(u,", ").concat(c,")"),d:s()})):null};hg.registerSymbol=Nk;var pg=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Hu=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{Uu(i)&&typeof r[i]=="function"&&(n[i]=(a=>r[i](r,a)))}),n},Dk=(e,t,r)=>n=>(e(t,r,n),null),Ko=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];Uu(i)&&typeof a=="function"&&(n||(n={}),n[i]=Dk(a,t,r))}),n};function xd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $k(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xd(Object(r),!0).forEach(function(n){Rk(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rk(e,t,r){return(t=Lk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lk(e){var t=Uk(e,"string");return typeof t=="symbol"?t:t+""}function Uk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function je(e,t){var r=$k({},e),n=t,i=Object.keys(t),a=i.reduce((o,s)=>(o[s]===void 0&&n[s]!==void 0&&(o[s]=n[s]),o),r);return a}function zk(e,t){const r=new Map;for(let n=0;n<e.length;n++){const i=e[n],a=t(i,n,e);r.has(a)||r.set(a,i)}return Array.from(r.values())}function Bk(e,t){return function(...r){return e.apply(this,r.slice(0,t))}}function mg(e){return e}function Fk(e){return function(t){return zt(t,e)}}function Nl(e){return e==null||typeof e!="object"&&typeof e!="function"}function Wk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Kk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Gu(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Hk="[object RegExp]",vg="[object String]",gg="[object Number]",yg="[object Boolean]",bg="[object Arguments]",Gk="[object Symbol]",qk="[object Date]",Yk="[object Map]",Vk="[object Set]",Xk="[object Array]",Zk="[object ArrayBuffer]",Jk="[object Object]",Qk="[object DataView]",eO="[object Uint8Array]",tO="[object Uint8ClampedArray]",rO="[object Uint16Array]",nO="[object Uint32Array]",iO="[object Int8Array]",aO="[object Int16Array]",oO="[object Int32Array]",sO="[object Float32Array]",lO="[object Float64Array]",wd=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function uO(e){return typeof wd.Buffer<"u"&&wd.Buffer.isBuffer(e)}function cO(e,t){return zr(e,void 0,e,new Map,t)}function zr(e,t,r,n=new Map,i=void 0){const a=i==null?void 0:i(e,t,r,n);if(a!==void 0)return a;if(Nl(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const o=new Array(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;n.set(e,o);for(const[s,l]of e)o.set(s,zr(l,s,r,n,i));return o}if(e instanceof Set){const o=new Set;n.set(e,o);for(const s of e)o.add(zr(s,void 0,r,n,i));return o}if(uO(e))return e.subarray();if(Wk(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,o),bt(o,e,r,n,i),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(typeof Blob<"u"&&e instanceof Blob){const o=new Blob([e],{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Error){const o=structuredClone(e);return n.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,o.constructor=e.constructor,bt(o,e,r,n,i),o}if(e instanceof Boolean){const o=new Boolean(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Number){const o=new Number(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof String){const o=new String(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(typeof e=="object"&&fO(e)){const o=Object.create(Object.getPrototypeOf(e));return n.set(e,o),bt(o,e,r,n,i),o}return e}function bt(e,t,r=e,n,i){const a=[...Object.keys(t),...Kk(t)];for(let o=0;o<a.length;o++){const s=a[o],l=Object.getOwnPropertyDescriptor(e,s);(l==null||l.writable)&&(e[s]=zr(t[s],s,r,n,i))}}function fO(e){switch(Gu(e)){case bg:case Xk:case Zk:case Qk:case yg:case qk:case sO:case lO:case iO:case aO:case oO:case Yk:case gg:case Jk:case Hk:case Vk:case vg:case Gk:case eO:case tO:case rO:case nO:return!0;default:return!1}}function dO(e){return zr(e,void 0,e,new Map,void 0)}function Aa(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function xg(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function wg(e,t,r){return typeof r!="function"?wg(e,t,()=>{}):Dl(e,t,function n(i,a,o,s,l,u){const c=r(i,a,o,s,l,u);return c!==void 0?!!c:Dl(i,a,n,u,!1)},new Map,!0)}function Dl(e,t,r,n,i=!1){if(t===e)return!0;switch(typeof t){case"object":return hO(e,t,r,n);case"function":return Object.keys(t).length>0?Dl(e,{...t},r,n,i):Aa(e,t);default:return xg(e)&&i?typeof t=="string"?t==="":!0:Aa(e,t)}}function hO(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return Pg(e,t,r,n);if(t instanceof Map)return pO(e,t,r,n);if(t instanceof Set)return mO(e,t,r,n);const i=Object.keys(t);if(e==null||Nl(e))return i.length===0;if(i.length===0)return!0;if(n!=null&&n.has(t))return n.get(t)===e;n==null||n.set(t,e);try{for(let a=0;a<i.length;a++){const o=i[a];if(!Nl(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,n))return!1}return!0}finally{n==null||n.delete(t)}}function pO(e,t,r,n){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(const[i,a]of t.entries())if(r(e.get(i),a,i,e,t,n)===!1)return!1;return!0}function Pg(e,t,r,n){if(t.length===0)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let a=0;a<t.length;a++){const o=t[a];let s=!1;for(let l=0;l<e.length;l++){if(i.has(l))continue;const u=e[l];let c=!1;if(r(u,o,a,e,t,n)&&(c=!0),c){i.add(l),s=!0;break}}if(!s)return!1}return!0}function mO(e,t,r,n){return t.size===0?!0:e instanceof Set?Pg([...e],[...t],r,n):!1}function kg(e,t){return wg(e,t,()=>{})}function vO(e){return e=dO(e),t=>kg(t,e)}function gO(e,t){return cO(e,(r,n,i,a)=>{if(typeof e=="object"){if(Gu(e)==="[object Object]"&&typeof e.constructor!="function"){const o={};return a.set(e,o),bt(o,e,i,a),o}switch(Object.prototype.toString.call(e)){case gg:case vg:case yg:{const o=new e.constructor(e==null?void 0:e.valueOf());return bt(o,e),o}case bg:{const o={};return bt(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}function yO(e){return gO(e)}const bO=/^(?:0|[1-9]\d*)$/;function Og(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return bO.test(e)}}function xO(e){return e!==null&&typeof e=="object"&&Gu(e)==="[object Arguments]"}function wO(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&lg(t)&&(e==null?void 0:e[t])==null?r=Ku(t):r=[t],r.length===0)return!1;let n=e;for(let i=0;i<r.length;i++){const a=r[i];if((n==null||!Object.hasOwn(n,a))&&!((Array.isArray(n)||xO(n))&&Og(a)&&a<n.length))return!1;n=n[a]}return!0}function PO(e,t){switch(typeof e){case"object":Object.is(e==null?void 0:e.valueOf(),-0)&&(e="-0");break;case"number":e=Wu(e);break}return t=yO(t),function(r){const n=zt(r,e);return n===void 0?wO(r,e):t===void 0?n===void 0:kg(n,t)}}function kO(e){if(e==null)return mg;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?PO(e[0],e[1]):vO(e);case"string":case"symbol":case"number":return Fk(e)}}function OO(e){return Number.isSafeInteger(e)&&e>=0}function jg(e){return e!=null&&typeof e!="function"&&OO(e.length)}function jO(e){return typeof e=="object"&&e!==null}function AO(e){return jO(e)&&jg(e)}function Pd(e,t=mg){return AO(e)?zk(Array.from(e),Bk(kO(t),1)):[]}function SO(e,t,r){return t===!0?Pd(e,r):typeof t=="function"?Pd(e,t):e}var qu=h.createContext(null),EO=e=>e,se=()=>{var e=h.useContext(qu);return e?e.store.dispatch:EO},Sa=()=>{},_O=()=>Sa,TO=(e,t)=>e===t;function U(e){var t=h.useContext(qu),r=h.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Sa,[t,e]);return Dw.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:_O,t?t.store.getState:Sa,t?t.store.getState:Sa,r,TO)}function CO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function MO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function IO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var kd=e=>Array.isArray(e)?e:[e];function NO(e){const t=Array.isArray(e[0])?e[0]:e;return IO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function DO(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var $O=class{constructor(e){this.value=e}deref(){return this.value}},RO=typeof WeakRef<"u"?WeakRef:$O,LO=0,Od=1;function la(){return{s:LO,v:void 0,o:null,p:null}}function Ag(e,t={}){let r=la();const{resultEqualityCheck:n}=t;let i,a=0;function o(){var f;let s=r;const{length:l}=arguments;for(let d=0,p=l;d<p;d++){const v=arguments[d];if(typeof v=="function"||typeof v=="object"&&v!==null){let m=s.o;m===null&&(s.o=m=new WeakMap);const y=m.get(v);y===void 0?(s=la(),m.set(v,s)):s=y}else{let m=s.p;m===null&&(s.p=m=new Map);const y=m.get(v);y===void 0?(s=la(),m.set(v,s)):s=y}}const u=s;let c;if(s.s===Od)c=s.v;else if(c=e.apply(null,arguments),a++,n){const d=((f=i==null?void 0:i.deref)==null?void 0:f.call(i))??i;d!=null&&n(d,c)&&(c=d,a!==0&&a--),i=typeof c=="object"&&c!==null||typeof c=="function"?new RO(c):c}return u.s=Od,u.v=c,c}return o.clearCache=()=>{r=la(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function UO(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,s,l={},u=i.pop();typeof u=="object"&&(l=u,u=i.pop()),CO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const c={...r,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:p=Ag,argsMemoizeOptions:v=[]}=c,m=kd(d),y=kd(v),b=NO(i),x=f(function(){return a++,u.apply(null,arguments)},...m),w=p(function(){o++;const O=DO(b,arguments);return s=x.apply(null,O),s},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:x,dependencies:b,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:p})};return Object.assign(n,{withTypes:()=>n}),n}var A=UO(Ag),zO=Object.assign((e,t=A)=>{MO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,s,l)=>(o[r[l]]=s,o),{}))},{withTypes:()=>zO});function BO(e,t=1){const r=[],n=Math.floor(t),i=(a,o)=>{for(let s=0;s<a.length;s++){const l=a[s];Array.isArray(l)&&o<n?i(l,o+1):r.push(l)}};return i(e,0),r}function $l(e,t,r){return xg(r)&&(typeof t=="number"&&jg(r)&&Og(t)&&t<r.length||typeof t=="string"&&t in r)?Aa(r[t],e):!1}function jd(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const FO=(e,t,r)=>{if(e!==t){const n=jd(e),i=jd(t);if(n===i&&n===0){if(e<t)return r==="desc"?1:-1;if(e>t)return r==="desc"?-1:1}return r==="desc"?i-n:n-i}return 0};function Sg(e){return typeof e=="symbol"||e instanceof Symbol}const WO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,KO=/^\w*$/;function HO(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||Sg(e)?!0:typeof e=="string"&&(KO.test(e)||!WO.test(e))||t!=null}function GO(e,t,r,n){if(e==null)return[];r=r,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(r)||(r=r==null?[]:[r]),r=r.map(s=>String(s));const i=(s,l)=>{let u=s;for(let c=0;c<l.length&&u!=null;++c)u=u[l[c]];return u},a=(s,l)=>l==null||s==null?l:typeof s=="object"&&"key"in s?Object.hasOwn(l,s.key)?l[s.key]:i(l,s.path):typeof s=="function"?s(l):Array.isArray(s)?i(l,s):typeof l=="object"?l[s]:l,o=t.map(s=>(Array.isArray(s)&&s.length===1&&(s=s[0]),s==null||typeof s=="function"||Array.isArray(s)||HO(s)?s:{key:s,path:Ku(s)}));return e.map(s=>({original:s,criteria:o.map(l=>a(l,s))})).slice().sort((s,l)=>{for(let u=0;u<o.length;u++){const c=FO(s.criteria[u],l.criteria[u],r[u]);if(c!==0)return c}return 0}).map(s=>s.original)}function Ho(e,...t){const r=t.length;return r>1&&$l(e,t[0],t[1])?t=[]:r>2&&$l(t[0],t[1],t[2])&&(t=[t[0]]),GO(e,BO(t),["asc"])}var Eg=e=>e.legend.settings,qO=e=>e.legend.size,YO=e=>e.legend.payload;A([YO,Eg],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Ho(n,r):n});var ua=1;function VO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>ua||Math.abs(o.left-t.left)>ua||Math.abs(o.top-t.top)>ua||Math.abs(o.width-t.width)>ua)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var XO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Ad=XO,Ys=()=>Math.random().toString(36).substring(7).split("").join("."),ZO={INIT:`@@redux/INIT${Ys()}`,REPLACE:`@@redux/REPLACE${Ys()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ys()}`},Ha=ZO;function Yu(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function _g(e,t,r){if(typeof e!="function")throw new Error(ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ze(1));return r(_g)(e,t)}let n=e,i=t,a=new Map,o=a,s=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((y,b)=>{o.set(b,y)}))}function c(){if(l)throw new Error(ze(3));return i}function f(y){if(typeof y!="function")throw new Error(ze(4));if(l)throw new Error(ze(5));let b=!0;u();const x=s++;return o.set(x,y),function(){if(b){if(l)throw new Error(ze(6));b=!1,u(),o.delete(x),a=null}}}function d(y){if(!Yu(y))throw new Error(ze(7));if(typeof y.type>"u")throw new Error(ze(8));if(typeof y.type!="string")throw new Error(ze(17));if(l)throw new Error(ze(9));try{l=!0,i=n(i,y)}finally{l=!1}return(a=o).forEach(x=>{x()}),y}function p(y){if(typeof y!="function")throw new Error(ze(10));n=y,d({type:Ha.REPLACE})}function v(){const y=f;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(ze(11));function x(){const P=b;P.next&&P.next(c())}return x(),{unsubscribe:y(x)}},[Ad](){return this}}}return d({type:Ha.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:p,[Ad]:v}}function JO(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Ha.INIT})>"u")throw new Error(ze(12));if(typeof r(void 0,{type:Ha.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ze(13))})}function Tg(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let i;try{JO(r)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const u={};for(let c=0;c<n.length;c++){const f=n[c],d=r[f],p=o[f],v=d(p,s);if(typeof v>"u")throw s&&s.type,new Error(ze(14));u[f]=v,l=l||v!==p}return l=l||n.length!==Object.keys(o).length,l?u:o}}function Ga(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function QO(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(ze(15))};const o={getState:i.getState,dispatch:(l,...u)=>a(l,...u)},s=e.map(l=>l(o));return a=Ga(...s)(i.dispatch),{...i,dispatch:a}}}function Cg(e){return Yu(e)&&"type"in e&&typeof e.type=="string"}var Mg=Symbol.for("immer-nothing"),Sd=Symbol.for("immer-draftable"),tt=Symbol.for("immer-state");function Pt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var lt=Object,_n=lt.getPrototypeOf,qa="constructor",Go="prototype",Rl="configurable",Ya="enumerable",Ea="writable",hi="value",er=e=>!!e&&!!e[tt];function At(e){var t;return e?Ig(e)||Yo(e)||!!e[Sd]||!!((t=e[qa])!=null&&t[Sd])||Vo(e)||Xo(e):!1}var ej=lt[Go][qa].toString(),Ed=new WeakMap;function Ig(e){if(!e||!Vu(e))return!1;const t=_n(e);if(t===null||t===lt[Go])return!0;const r=lt.hasOwnProperty.call(t,qa)&&t[qa];if(r===Object)return!0;if(!gn(r))return!1;let n=Ed.get(r);return n===void 0&&(n=Function.toString.call(r),Ed.set(r,n)),n===ej}function qo(e,t,r=!0){Mi(e)===0?(r?Reflect.ownKeys(e):lt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Mi(e){const t=e[tt];return t?t.type_:Yo(e)?1:Vo(e)?2:Xo(e)?3:0}var Vs=(e,t,r=Mi(e))=>r===2?e.has(t):lt[Go].hasOwnProperty.call(e,t),Ll=(e,t,r=Mi(e))=>r===2?e.get(t):e[t],Va=(e,t,r,n=Mi(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function tj(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Yo=Array.isArray,Vo=e=>e instanceof Map,Xo=e=>e instanceof Set,Vu=e=>typeof e=="object",gn=e=>typeof e=="function",Xs=e=>typeof e=="boolean";function rj(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var It=e=>e.copy_||e.base_,Xu=e=>e.modified_?e.copy_:e.base_;function Ul(e,t){if(Vo(e))return new Map(e);if(Xo(e))return new Set(e);if(Yo(e))return Array[Go].slice.call(e);const r=Ig(e);if(t===!0||t==="class_only"&&!r){const n=lt.getOwnPropertyDescriptors(e);delete n[tt];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s[Ea]===!1&&(s[Ea]=!0,s[Rl]=!0),(s.get||s.set)&&(n[o]={[Rl]:!0,[Ea]:!0,[Ya]:s[Ya],[hi]:e[o]})}return lt.create(_n(e),n)}else{const n=_n(e);if(n!==null&&r)return{...e};const i=lt.create(n);return lt.assign(i,e)}}function Zu(e,t=!1){return Zo(e)||er(e)||!At(e)||(Mi(e)>1&&lt.defineProperties(e,{set:ca,add:ca,clear:ca,delete:ca}),lt.freeze(e),t&&qo(e,(r,n)=>{Zu(n,!0)},!1)),e}function nj(){Pt(2)}var ca={[hi]:nj};function Zo(e){return e===null||!Vu(e)?!0:lt.isFrozen(e)}var Xa="MapSet",zl="Patches",_d="ArrayMethods",Ng={};function Qr(e){const t=Ng[e];return t||Pt(0,e),t}var Td=e=>!!Ng[e],pi,Dg=()=>pi,ij=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Td(Xa)?Qr(Xa):void 0,arrayMethodsPlugin_:Td(_d)?Qr(_d):void 0});function Cd(e,t){t&&(e.patchPlugin_=Qr(zl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Bl(e){Fl(e),e.drafts_.forEach(aj),e.drafts_=null}function Fl(e){e===pi&&(pi=e.parent_)}var Md=e=>pi=ij(pi,e);function aj(e){const t=e[tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Id(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[tt].modified_&&(Bl(t),Pt(4)),At(e)&&(e=Nd(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[tt].base_,e,t)}else e=Nd(t,r);return oj(t,e,!0),Bl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Mg?e:void 0}function Nd(e,t){if(Zo(t))return t;const r=t[tt];if(!r)return Za(t,e.handledSet_,e);if(!Jo(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Lg(r,e)}return r.copy_}function oj(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zu(t,r)}function $g(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Jo=(e,t)=>e.scope_===t,sj=[];function Rg(e,t,r,n){const i=It(e),a=e.type_;if(n!==void 0&&Ll(i,n,a)===t){Va(i,n,r,a);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;qo(i,(l,u)=>{if(er(u)){const c=s.get(u)||[];c.push(l),s.set(u,c)}})}const o=e.draftLocations_.get(t)??sj;for(const s of o)Va(i,s,r,a)}function lj(e,t,r){e.callbacks_.push(function(i){var s;const a=t;if(!a||!Jo(a,i))return;(s=i.mapSetPlugin_)==null||s.fixSetContents(a);const o=Xu(a);Rg(e,a.draft_??a,o,r),Lg(a,i)})}function Lg(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}$g(e)}}function uj(e,t,r){const{scope_:n}=e;if(er(r)){const i=r[tt];Jo(i,n)&&i.callbacks_.push(function(){_a(e);const o=Xu(i);Rg(e,r,o,t)})}else At(r)&&e.callbacks_.push(function(){const a=It(e);e.type_===3?a.has(r)&&Za(r,n.handledSet_,n):Ll(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Za(Ll(e.copy_,t,e.type_),n.handledSet_,n)})}function Za(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||er(e)||t.has(e)||!At(e)||Zo(e)||(t.add(e),qo(e,(n,i)=>{if(er(i)){const a=i[tt];if(Jo(a,r)){const o=Xu(a);Va(e,n,o,e.type_),$g(a)}}else At(i)&&Za(i,t,r)})),e}function cj(e,t){const r=Yo(e),n={type_:r?1:0,scope_:t?t.scope_:Dg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=Ja;r&&(i=[n],a=mi);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,[s,n]}var Ja={get(e,t){if(t===tt)return e;if(t==="constructor"||t==="__proto__"){const s=It(e)[t];return new Proxy(s||{},{get:(l,u)=>u==="__proto__"||u==="prototype"?Object.freeze(Object.create(null)):Reflect.get(l,u),set:()=>!0,apply:(l,u,c)=>Reflect.apply(l,u,c)})}let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=It(e);if(!Vs(i,t,e.type_))return fj(e,i,t);const a=i[t];if(e.finalized_||!At(a)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&rj(t))return a;if(a===Zs(e.base_,t)){_a(e);const o=e.type_===1?+t:t,s=Kl(e.scope_,a,e,o);return e.copy_[o]=s}return a},has(e,t){return t==="constructor"||t==="__proto__"||t==="prototype"?!1:t in It(e)},ownKeys(e){return Reflect.ownKeys(It(e))},set(e,t,r){if(t==="constructor"||t==="__proto__"||t==="prototype")return!0;const n=Ug(It(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Zs(It(e),t),a=i==null?void 0:i[tt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(tj(r,i)&&(r!==void 0||Vs(e.base_,t,e.type_)))return!0;_a(e),Wl(e)}return e.copy_[t]===r&&(r!==void 0||Vs(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),uj(e,t,r)),!0},deleteProperty(e,t){return _a(e),Zs(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Wl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=It(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Ea]:!0,[Rl]:e.type_!==1||t!=="length",[Ya]:n[Ya],[hi]:r[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return _n(e.base_)},setPrototypeOf(){Pt(12)}},mi={};for(let e in Ja){let t=Ja[e];mi[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}mi.deleteProperty=function(e,t){return mi.set.call(this,e,t,void 0)};mi.set=function(e,t,r){return Ja.set.call(this,e[0],t,r,e[0])};function Zs(e,t){const r=e[tt];return(r?It(r):e)[t]}function fj(e,t,r){var i;const n=Ug(t,r);return n?hi in n?n[hi]:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function Ug(e,t){if(!(t in e))return;let r=_n(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=_n(r)}}function Wl(e){e.modified_||(e.modified_=!0,e.parent_&&Wl(e.parent_))}function _a(e){e.copy_||(e.assigned_=new Map,e.copy_=Ul(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dj=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(gn(r)&&!gn(n)){const o=n;n=r;const s=this;return function(u=o,...c){return s.produce(u,f=>n.call(this,f,...c))}}gn(n)||Pt(6),i!==void 0&&!gn(i)&&Pt(7);let a;if(At(r)){const o=Md(this),s=Kl(o,r,void 0);let l=!0;try{a=n(s),l=!1}finally{l?Bl(o):Fl(o)}return Cd(o,i),Id(a,o)}else if(!r||!Vu(r)){if(a=n(r),a===void 0&&(a=r),a===Mg&&(a=void 0),this.autoFreeze_&&Zu(a,!0),i){const o=[],s=[];Qr(zl).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:s}),i(o,s)}return a}else Pt(1,r)},this.produceWithPatches=(r,n)=>{if(gn(r))return(s,...l)=>this.produceWithPatches(s,u=>r(u,...l));let i,a;return[this.produce(r,n,(s,l)=>{i=s,a=l}),i,a]},Xs(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Xs(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Xs(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){At(t)||Pt(8),er(t)&&(t=mt(t));const r=Md(this),n=Kl(r,t,void 0);return n[tt].isManual_=!0,Fl(r),n}finishDraft(t,r){const n=t&&t[tt];(!n||!n.isManual_)&&Pt(9);const{scope_:i}=n;return Cd(i,r),Id(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=Qr(zl).applyPatches_;return er(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Kl(e,t,r,n){const[i,a]=Vo(t)?Qr(Xa).proxyMap_(t,r):Xo(t)?Qr(Xa).proxySet_(t,r):cj(t,r);return((r==null?void 0:r.scope_)??Dg()).drafts_.push(i),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=n,r&&n!==void 0?lj(r,a,n):a.callbacks_.push(function(l){var c;(c=l.mapSetPlugin_)==null||c.fixSetContents(a);const{patchPlugin_:u}=l;a.modified_&&u&&u.generatePatches_(a,[],l)}),i}function mt(e){return er(e)||Pt(10,e),zg(e)}function zg(e){if(!At(e)||Zo(e))return e;const t=e[tt];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ul(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ul(e,!0);return qo(r,(i,a)=>{Va(r,i,zg(a))},n),t&&(t.finalized_=!1),r}var hj=new dj,Bg=hj.produce;function Fg(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var pj=Fg(),mj=Fg,vj=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ga:Ga.apply(null,arguments)};function ct(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(ut(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Cg(n)&&n.type===e,r}var Wg=class si extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,si.prototype)}static get[Symbol.species](){return si}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new si(...t[0].concat(this)):new si(...t.concat(this))}};function Dd(e){return At(e)?Bg(e,()=>{}):e}function fa(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function gj(e){return typeof e=="boolean"}var yj=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Wg;return r&&(gj(r)?o.push(pj):o.push(mj(r.extraArgument))),o},Kg="RTK_autoBatch",le=()=>e=>({payload:e,meta:{[Kg]:!0}}),$d=e=>t=>{setTimeout(t,e)},bj=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(o),r())},a=e(i),o=setTimeout(i,t)},Hg=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?bj(window.requestAnimationFrame,100):$d(10):e.type==="callback"?e.queueNotification:$d(e.timeout),u=()=>{o=!1,a&&(a=!1,s.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),d=n.subscribe(f);return s.add(c),()=>{d(),s.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[Kg]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},xj=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new Wg(e);return n&&i.push(Hg(typeof n=="object"?n:void 0)),i};function wj(e){const t=yj(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof r=="function")s=r;else if(Yu(r))s=Tg(r);else throw new Error(ut(1));let l;typeof n=="function"?l=n(t):l=t();let u=Ga;i&&(u=vj({trace:!1,...typeof i=="object"&&i}));const c=QO(...l),f=xj(c);let d=typeof o=="function"?o(f):f();const p=u(...d);return _g(s,a,p)}function Gg(e){const t={},r=[];let n;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(ut(28));if(s in t)throw new Error(ut(29));return t[s]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function Pj(e){return typeof e=="function"}function kj(e,t){let[r,n,i]=Gg(t),a;if(Pj(e))a=()=>Dd(e());else{const s=Dd(e);a=()=>s}function o(s=a(),l){let u=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return u.filter(c=>!!c).length===0&&(u=[i]),u.reduce((c,f)=>{if(f)if(er(c)){const p=f(c,l);return p===void 0?c:p}else{if(At(c))return Bg(c,d=>f(d,l));{const d=f(c,l);if(d===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return c},s)}return o.getInitialState=a,o}var Oj="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",jj=(e=21)=>{let t="",r=e;for(;r--;)t+=Oj[Math.random()*64|0];return t},Aj=Symbol.for("rtk-slice-createasyncthunk");function Sj(e,t){return`${e}/${t}`}function Ej({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Aj];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(ut(11));const s=(typeof i.reducers=="function"?i.reducers(Tj()):i.reducers)||{},l=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(P,O){const k=typeof P=="string"?P:P.type;if(!k)throw new Error(ut(12));if(k in u.sliceCaseReducersByType)throw new Error(ut(13));return u.sliceCaseReducersByType[k]=O,c},addMatcher(P,O){return u.sliceMatchers.push({matcher:P,reducer:O}),c},exposeAction(P,O){return u.actionCreators[P]=O,c},exposeCaseReducer(P,O){return u.sliceCaseReducersByName[P]=O,c}};l.forEach(P=>{const O=s[P],k={reducerName:P,type:Sj(a,P),createNotation:typeof i.reducers=="function"};Mj(O)?Nj(k,O,c,t):Cj(k,O,c)});function f(){const[P={},O=[],k=void 0]=typeof i.extraReducers=="function"?Gg(i.extraReducers):[i.extraReducers],j={...P,...u.sliceCaseReducersByType};return kj(i.initialState,E=>{for(let _ in j)E.addCase(_,j[_]);for(let _ of u.sliceMatchers)E.addMatcher(_.matcher,_.reducer);for(let _ of O)E.addMatcher(_.matcher,_.reducer);k&&E.addDefaultCase(k)})}const d=P=>P,p=new Map,v=new WeakMap;let m;function y(P,O){return m||(m=f()),m(P,O)}function b(){return m||(m=f()),m.getInitialState()}function x(P,O=!1){function k(E){let _=E[P];return typeof _>"u"&&O&&(_=fa(v,k,b)),_}function j(E=d){const _=fa(p,O,()=>new WeakMap);return fa(_,E,()=>{const M={};for(const[T,S]of Object.entries(i.selectors??{}))M[T]=_j(S,E,()=>fa(v,E,b),O);return M})}return{reducerPath:P,getSelectors:j,get selectors(){return j(k)},selectSlice:k}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:b,...x(o),injectInto(P,{reducerPath:O,...k}={}){const j=O??o;return P.inject({reducerPath:j,reducer:y},k),{...w,...x(j,!0)}}};return w}}function _j(e,t,r,n){function i(a,...o){let s=t(a);return typeof s>"u"&&n&&(s=r()),e(s,...o)}return i.unwrapped=e,i}var Xe=Ej();function Tj(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Cj({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!Ij(n))throw new Error(ut(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ct(e,o):ct(e))}function Mj(e){return e._reducerDefinitionType==="asyncThunk"}function Ij(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Nj({type:e,reducerName:t},r,n,i){if(!i)throw new Error(ut(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:u,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),s&&n.addCase(f.pending,s),l&&n.addCase(f.rejected,l),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:o||da,pending:s||da,rejected:l||da,settled:u||da})}function da(){}var Dj="task",qg="listener",Yg="completed",Ju="cancelled",$j=`task-${Ju}`,Rj=`task-${Yg}`,Hl=`${qg}-${Ju}`,Lj=`${qg}-${Yg}`,Qo=class{constructor(e){ea(this,"code");ea(this,"name","TaskAbortError");ea(this,"message");this.code=e,this.message=`${Dj} ${Ju} (reason: ${e})`}},Qu=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Qa=()=>{},Vg=(e,t=Qa)=>(e.catch(t),e),Xg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Gr=e=>{if(e.aborted)throw new Qo(e.reason)};function Zg(e,t){let r=Qa;return new Promise((n,i)=>{const a=()=>i(new Qo(e.reason));if(e.aborted){a();return}r=Xg(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Qa})}var Uj=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof Qo?"cancelled":"rejected",error:r}}finally{t==null||t()}},eo=e=>t=>Vg(Zg(e,t).then(r=>(Gr(e),r))),Jg=e=>{const t=eo(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:On}=Object,Rd={},es="listenerMiddleware",zj=(e,t)=>{const r=n=>Xg(e,()=>n.abort(e.reason));return(n,i)=>{Qu(n);const a=new AbortController;r(a);const o=Uj(async()=>{Gr(e),Gr(a.signal);const s=await n({pause:eo(a.signal),delay:Jg(a.signal),signal:a.signal});return Gr(a.signal),s},()=>a.abort(Rj));return i!=null&&i.autoJoin&&t.push(o.catch(Qa)),{result:eo(e)(o),cancel(){a.abort($j)}}}},Bj=(e,t)=>{const r=async(n,i)=>{Gr(t);let a=()=>{};const s=[new Promise((l,u)=>{let c=e({predicate:n,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});a=()=>{c(),u()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await Zg(t,Promise.race(s));return Gr(t),l}finally{a()}};return((n,i)=>Vg(r(n,i)))},Qg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=ct(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(ut(21));return Qu(a),{predicate:i,type:t,effect:a}},ey=On(e=>{const{type:t,predicate:r,effect:n}=Qg(e);return{id:jj(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>ey}),Ld=(e,t)=>{const{type:r,effect:n,predicate:i}=Qg(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Gl=e=>{e.pending.forEach(t=>{t.abort(Hl)})},Fj=(e,t)=>()=>{for(const r of t.keys())Gl(r);e.clear()},Ud=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},ty=On(ct(`${es}/add`),{withTypes:()=>ty}),Wj=ct(`${es}/removeAll`),ry=On(ct(`${es}/remove`),{withTypes:()=>ry}),Kj=(...e)=>{console.error(`${es}/error`,...e)},Ii=(e={})=>{const t=new Map,r=new Map,n=p=>{const v=r.get(p)??0;r.set(p,v+1)},i=p=>{const v=r.get(p)??1;v===1?r.delete(p):r.set(p,v-1)},{extra:a,onError:o=Kj}=e;Qu(o);const s=p=>(p.unsubscribe=()=>t.delete(p.id),t.set(p.id,p),v=>{p.unsubscribe(),v!=null&&v.cancelActive&&Gl(p)}),l=(p=>{const v=Ld(t,p)??ey(p);return s(v)});On(l,{withTypes:()=>l});const u=p=>{const v=Ld(t,p);return v&&(v.unsubscribe(),p.cancelActive&&Gl(v)),!!v};On(u,{withTypes:()=>u});const c=async(p,v,m,y)=>{const b=new AbortController,x=Bj(l,b.signal),w=[];try{p.pending.add(b),n(p),await Promise.resolve(p.effect(v,On({},m,{getOriginalState:y,condition:(P,O)=>x(P,O).then(Boolean),take:x,delay:Jg(b.signal),pause:eo(b.signal),extra:a,signal:b.signal,fork:zj(b.signal,w),unsubscribe:p.unsubscribe,subscribe:()=>{t.set(p.id,p)},cancelActiveListeners:()=>{p.pending.forEach((P,O,k)=>{P!==b&&(P.abort(Hl),k.delete(P))})},cancel:()=>{b.abort(Hl),p.pending.delete(b)},throwIfCancelled:()=>{Gr(b.signal)}})))}catch(P){P instanceof Qo||Ud(o,P,{raisedBy:"effect"})}finally{await Promise.all(w),b.abort(Lj),i(p),p.pending.delete(b)}},f=Fj(t,r);return{middleware:p=>v=>m=>{if(!Cg(m))return v(m);if(ty.match(m))return l(m.payload);if(Wj.match(m)){f();return}if(ry.match(m))return u(m.payload);let y=p.getState();const b=()=>{if(y===Rd)throw new Error(ut(23));return y};let x;try{if(x=v(m),t.size>0){const w=p.getState(),P=Array.from(t.values());for(const O of P){let k=!1;try{k=O.predicate(m,w,y)}catch(j){k=!1,Ud(o,j,{raisedBy:"predicate"})}k&&c(O,m,p,b)}}}finally{y=Rd}return x},startListening:l,stopListening:u,clearListeners:f}};function ut(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Hj={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},ny=Xe({name:"chartLayout",initialState:Hj,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Gj,setLayout:qj,setChartSize:Yj,setScale:Vj}=ny.actions,Xj=ny.reducer;function iy(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function G(e){return Number.isFinite(e)}function Ft(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function zd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zd(Object(r),!0).forEach(function(n){Zj(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zj(e,t,r){return(t=Jj(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jj(e){var t=Qj(e,"string");return typeof t=="symbol"?t:t+""}function Qj(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ee(e,t,r){return ce(e)||ce(t)?r:Bt(t)?zt(e,t,r):typeof t=="function"?t(e):r}var eA=(e,t,r)=>{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:s}=t;if((s==="vertical"||s==="horizontal"&&o==="middle")&&a!=="center"&&$(e[a]))return bn(bn({},e),{},{[a]:e[a]+(n||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&o!=="middle"&&$(e[o]))return bn(bn({},e),{},{[o]:e[o]+(i||0)})}return e},Et=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",ay=(e,t,r,n)=>{if(n)return e.map(s=>s.coordinate);var i,a,o=e.map(s=>(s.coordinate===t&&(i=!0),s.coordinate===r&&(a=!0),s.coordinate));return i||o.push(t),a||o.push(r),o},oy=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:u,tickCount:c,ticks:f,niceTicks:d,axisType:p}=e;if(!o)return null;var v=s==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,m=i==="category"&&o.bandwidth?o.bandwidth()/v:0;if(m=p==="angleAxis"&&a&&a.length>=2?Ne(a[0]-a[1])*2*m:m,f||d){var y=(f||d||[]).map((b,x)=>{var w=n?n.indexOf(b):b,P=o.map(w);return G(P)?{coordinate:P+m,value:b,offset:m,index:x}:null}).filter(nt);return y}return l&&u?u.map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+m,value:b,index:x,offset:m}:null}).filter(nt):o.ticks&&c!=null?o.ticks(c).map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+m,value:b,index:x,offset:m}:null}).filter(nt):o.domain().map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+m,value:n?n[b]:b,index:x,offset:m}:null}).filter(nt)},tA=(e,t)=>{if(!t||t.length!==2||!$(t[0])||!$(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!$(e[0])||e[0]<r)&&(i[0]=r),(!$(e[1])||e[1]>n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]<r&&(i[1]=r),i},rA=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0,s=0;s<r;++s){var l=e[s],u=l==null?void 0:l[i];if(u!=null){var c=u[1],f=u[0],d=jt(c)?f:c;d>=0?(u[0]=a,a+=d,u[1]=a):(u[0]=o,o+=d,u[1]=o)}}}},nA=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0;o<r;++o){var s=e[o],l=s==null?void 0:s[i];if(l!=null){var u=jt(l[1])?l[0]:l[1];u>=0?(l[0]=a,a+=u,l[1]=a):(l[0]=0,l[1]=0)}}}},iA={sign:rA,expand:bk,none:Zr,silhouette:xk,wiggle:wk,positive:nA},aA=(e,t,r)=>{var n,i=(n=iA[r])!==null&&n!==void 0?n:Zr,a=yk().keys(t).value((s,l)=>Number(ee(s,l,0))).order(Cl).offset(i),o=a(e);return o.forEach((s,l)=>{s.forEach((u,c)=>{var f=ee(e[c],t[l],0);Array.isArray(f)&&f.length===2&&$(f[0])&&$(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function sy(e){return e==null?void 0:String(e)}function to(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ce(i[t.dataKey])){var s=fg(r,"value",i[t.dataKey]);if(s)return s.coordinate+n/2}return r!=null&&r[a]?r[a].coordinate+n/2:null}var l=ee(i,ce(o)?t.dataKey:o),u=t.scale.map(l);return $(u)?u:null}var Bd=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var s=ee(a,t.dataKey,t.scale.domain()[o]);if(ce(s))return null;var l=t.scale.map(s);return $(l)?l-i/2+n:null},oA=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},sA=e=>{var t=e.flat(2).filter($);return[Math.min(...t),Math.max(...t)]},lA=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],uA=(e,t,r)=>{if(e!=null)return lA(Object.keys(e).reduce((n,i)=>{var a=e[i];if(!a)return n;var{stackedData:o}=a,s=o.reduce((l,u)=>{var c=iy(u,t,r),f=sA(c);return!G(f[0])||!G(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(s[0],n[0]),Math.max(s[1],n[1])]},[1/0,-1/0]))},Fd=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Wd=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,kr=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=Ho(t,c=>c.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],u=i[o-1];a=Math.min(((l==null?void 0:l.coordinate)||0)-((u==null?void 0:u.coordinate)||0),a)}return a===1/0?0:a}return r?void 0:0};function Kd(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:i,name:a}=e;return bn(bn({},t),{},{dataKey:r,payload:n,value:i,name:a})}function Er(e,t){if(e)return String(e);if(typeof t=="string")return t}var cA=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},fA=(e,t)=>t==="centric"?e.angle:e.radius,or=e=>e.layout.width,sr=e=>e.layout.height,dA=e=>e.layout.scale,ly=e=>e.layout.margin,ts=A(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),rs=A(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),uy="data-recharts-item-index",cy="data-recharts-item-id",Ni=60;function Hd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Hd(Object(r),!0).forEach(function(n){hA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hA(e,t,r){return(t=pA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pA(e){var t=mA(e,"string");return typeof t=="symbol"?t:t+""}function mA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vA=e=>e.brush.height;function gA(e){var t=rs(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function yA(e){var t=rs(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function bA(e){var t=ts(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function xA(e){var t=ts(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var Ae=A([or,sr,ly,vA,gA,yA,bA,xA,Eg,qO],(e,t,r,n,i,a,o,s,l,u)=>{var c={left:(r.left||0)+i,right:(r.right||0)+a},f={top:(r.top||0)+o,bottom:(r.bottom||0)+s},d=ha(ha({},f),c),p=d.bottom;d.bottom+=n,d=eA(d,l,u);var v=e-d.left-d.right,m=t-d.top-d.bottom;return ha(ha({brushBottom:p},d),{},{width:Math.max(v,0),height:Math.max(m,0)})}),wA=A(Ae,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),ec=A(or,sr,(e,t)=>({x:0,y:0,width:e,height:t})),PA=h.createContext(null),De=()=>h.useContext(PA)!=null,ns=e=>e.brush,is=A([ns,Ae,ly],(e,t,r)=>({height:e.height,x:$(e.x)?e.x:t.left,y:$(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:$(e.width)?e.width:t.width}));function kA(e,t,{signal:r,edges:n}={}){let i,a=null;const o=n!=null&&n.includes("leading"),s=n==null||n.includes("trailing"),l=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},u=()=>{s&&l(),p()};let c=null;const f=()=>{c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,u()},t)},d=()=>{c!==null&&(clearTimeout(c),c=null)},p=()=>{d(),i=void 0,a=null},v=()=>{l()},m=function(...y){if(r!=null&&r.aborted)return;i=this,a=y;const b=c==null;f(),o&&b&&l()};return m.schedule=f,m.cancel=p,m.flush=v,r==null||r.addEventListener("abort",p,{once:!0}),m}function OA(e,t=0,r={}){typeof r!="object"&&(r={});const{leading:n=!1,trailing:i=!0,maxWait:a}=r,o=Array(2);n&&(o[0]="leading"),i&&(o[1]="trailing");let s,l=null;const u=kA(function(...d){s=e.apply(this,d),l=null},t,{edges:o}),c=function(...d){return a!=null&&(l===null&&(l=Date.now()),Date.now()-l>=a)?(s=e.apply(this,d),l=Date.now(),u.cancel(),u.schedule(),s):(u.apply(this,d),s)},f=()=>(u.flush(),s);return c.cancel=u.cancel,c.flush=f,c}function jA(e,t=0,r={}){const{leading:n=!0,trailing:i=!0}=r;return OA(e,t,{leading:n,maxWait:t,trailing:i})}var ro=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(r.replace(/%s/g,()=>i[o++]))}},$t={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},fy=(e,t,r)=>{var{width:n=$t.width,height:i=$t.height,aspect:a,maxHeight:o}=r,s=Jr(n)?e:Number(n),l=Jr(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},AA={width:0,height:0,overflow:"visible"},SA={width:0,overflowX:"visible"},EA={height:0,overflowY:"visible"},_A={},TA=e=>{var{width:t,height:r}=e,n=Jr(t),i=Jr(r);return n&&i?AA:n?SA:i?EA:_A};function CA(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i=$t.width,a=$t.height):i===void 0?i=n&&n>0?void 0:$t.width:a===void 0&&(a=n&&n>0?void 0:$t.height),{width:i,height:a}}function ql(){return ql=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ql.apply(null,arguments)}function Gd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gd(Object(r),!0).forEach(function(n){MA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MA(e,t,r){return(t=IA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function IA(e){var t=NA(e,"string");return typeof t=="symbol"?t:t+""}function NA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var dy=h.createContext($t.initialDimension);function DA(e){return Ft(e.width)&&Ft(e.height)}function hy(e){var{children:t,width:r,height:n}=e,i=h.useMemo(()=>({width:r,height:n}),[r,n]);return DA(i)?h.createElement(dy.Provider,{value:i},t):null}var tc=()=>h.useContext(dy),$A=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n=$t.initialDimension,width:i,height:a,minWidth:o=$t.minWidth,minHeight:s,maxHeight:l,children:u,debounce:c=$t.debounce,id:f,className:d,onResize:p,style:v={}}=e,m=h.useRef(null),y=h.useRef();y.current=p,h.useImperativeHandle(t,()=>m.current);var[b,x]=h.useState({containerWidth:n.width,containerHeight:n.height}),w=h.useCallback((E,_)=>{x(M=>{var T=Math.round(E),S=Math.round(_);return M.containerWidth===T&&M.containerHeight===S?M:{containerWidth:T,containerHeight:S}})},[]);h.useEffect(()=>{if(m.current==null||typeof ResizeObserver>"u")return ar;var E=S=>{var N,D=S[0];if(D!=null){var{width:z,height:K}=D.contentRect;w(z,K),(N=y.current)===null||N===void 0||N.call(y,z,K)}};c>0&&(E=jA(E,c,{trailing:!0,leading:!1}));var _=new ResizeObserver(E),{width:M,height:T}=m.current.getBoundingClientRect();return w(M,T),_.observe(m.current),()=>{_.disconnect()}},[w,c]);var{containerWidth:P,containerHeight:O}=b;ro(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:k,calculatedHeight:j}=fy(P,O,{width:i,height:a,aspect:r,maxHeight:l});return ro(k!=null&&k>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0,
2
2
  please check the style of container, or the props width(%s) and height(%s),
3
3
  or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
4
4
  height and width.`,k,j,i,a,o,s,r),h.createElement("div",{id:f?"".concat(f):void 0,className:Z("recharts-responsive-container",d),style:qd(qd({},v),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:m},h.createElement("div",{style:TA({width:i,height:a})},h.createElement(hy,{width:k,height:j},u)))}),RA=h.forwardRef((e,t)=>{var r=tc();if(Ft(r.width)&&Ft(r.height))return e.children;var{width:n,height:i}=CA({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=fy(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return $(a)&&$(o)?h.createElement(hy,{width:a,height:o},e.children):h.createElement($A,ql({},e,{width:n,height:i,ref:t}))});function rc(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var as=()=>{var e,t=De(),r=U(wA),n=U(is),i=(e=U(ns))===null||e===void 0?void 0:e.padding;return!t||!n||!i?r:{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}},LA={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},py=()=>{var e;return(e=U(Ae))!==null&&e!==void 0?e:LA},my=()=>U(or),vy=()=>U(sr),V=e=>e.layout.layoutType,_r=()=>U(V),nc=()=>{var e=_r();if(e==="horizontal"||e==="vertical")return e},gy=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},UA=()=>{var e=_r();return e!==void 0},Di=e=>{var t=se(),r=De(),{width:n,height:i}=e,a=tc(),o=n,s=i;return a&&(o=a.width>0?a.width:n,s=a.height>0?a.height:i),h.useEffect(()=>{!r&&Ft(o)&&Ft(s)&&t(Yj({width:o,height:s}))},[t,r,o,s]),null},yy=Symbol.for("immer-nothing"),Yd=Symbol.for("immer-draftable"),ft=Symbol.for("immer-state");function kt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var vi=Object.getPrototypeOf;function Tn(e){return!!e&&!!e[ft]}function en(e){var t;return e?by(e)||Array.isArray(e)||!!e[Yd]||!!((t=e.constructor)!=null&&t[Yd])||$i(e)||ss(e):!1}var zA=Object.prototype.constructor.toString(),Vd=new WeakMap;function by(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=Vd.get(r);return n===void 0&&(n=Function.toString.call(r),Vd.set(r,n)),n===zA}function no(e,t,r=!0){os(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function os(e){const t=e[ft];return t?t.type_:Array.isArray(e)?1:$i(e)?2:ss(e)?3:0}function Yl(e,t){return os(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function xy(e,t,r){const n=os(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function BA(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function $i(e){return e instanceof Map}function ss(e){return e instanceof Set}function Lr(e){return e.copy_||e.base_}function Vl(e,t){if($i(e))return new Map(e);if(ss(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=by(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[ft];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(vi(e),n)}else{const n=vi(e);if(n!==null&&r)return{...e};const i=Object.create(n);return Object.assign(i,e)}}function ic(e,t=!1){return ls(e)||Tn(e)||!en(e)||(os(e)>1&&Object.defineProperties(e,{set:pa,add:pa,clear:pa,delete:pa}),Object.freeze(e),t&&Object.values(e).forEach(r=>ic(r,!0))),e}function FA(){kt(2)}var pa={value:FA};function ls(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var WA={};function tn(e){const t=WA[e];return t||kt(0,e),t}var gi;function wy(){return gi}function KA(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xd(e,t){t&&(tn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xl(e){Zl(e),e.drafts_.forEach(HA),e.drafts_=null}function Zl(e){e===gi&&(gi=e.parent_)}function Zd(e){return gi=KA(gi,e)}function HA(e){const t=e[ft];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ft].modified_&&(Xl(t),kt(4)),en(e)&&(e=io(t,e),t.parent_||ao(t,e)),t.patches_&&tn("Patches").generateReplacementPatches_(r[ft].base_,e,t.patches_,t.inversePatches_)):e=io(t,r,[]),Xl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==yy?e:void 0}function io(e,t,r){if(ls(t))return t;const n=e.immer_.shouldUseStrictIteration(),i=t[ft];if(!i)return no(t,(a,o)=>Qd(e,i,t,a,o,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return ao(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,s=!1;i.type_===3&&(o=new Set(a),a.clear(),s=!0),no(o,(l,u)=>Qd(e,i,a,l,u,r,s),n),ao(e,a,!1),r&&e.patches_&&tn("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function Qd(e,t,r,n,i,a,o){if(i==null||typeof i!="object"&&!o)return;const s=ls(i);if(!(s&&!o)){if(Tn(i)){const l=a&&t&&t.type_!==3&&!Yl(t.assigned_,n)?a.concat(n):void 0,u=io(e,i,l);if(xy(r,n,u),Tn(u))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(en(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&s)return;io(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&($i(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&ao(e,i)}}}function ao(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ic(t,r)}function GA(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:wy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=ac;r&&(i=[n],a=yi);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,s}var ac={get(e,t){if(t===ft)return e;const r=Lr(e);if(!Yl(r,t))return qA(e,r,t);const n=r[t];return e.finalized_||!en(n)?n:n===Js(e.base_,t)?(Qs(e),e.copy_[t]=Ql(n,e)):n},has(e,t){return t in Lr(e)},ownKeys(e){return Reflect.ownKeys(Lr(e))},set(e,t,r){const n=Py(Lr(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Js(Lr(e),t),a=i==null?void 0:i[ft];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(BA(r,i)&&(r!==void 0||Yl(e.base_,t)))return!0;Qs(e),Jl(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Js(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Qs(e),Jl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Lr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return vi(e.base_)},setPrototypeOf(){kt(12)}},yi={};no(ac,(e,t)=>{yi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});yi.deleteProperty=function(e,t){return yi.set.call(this,e,t,void 0)};yi.set=function(e,t,r){return ac.set.call(this,e[0],t,r,e[0])};function Js(e,t){const r=e[ft];return(r?Lr(r):e)[t]}function qA(e,t,r){var i;const n=Py(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function Py(e,t){if(!(t in e))return;let r=vi(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=vi(r)}}function Jl(e){e.modified_||(e.modified_=!0,e.parent_&&Jl(e.parent_))}function Qs(e){e.copy_||(e.copy_=Vl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var YA=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const o=this;return function(l=a,...u){return o.produce(l,c=>r.call(this,c,...u))}}typeof r!="function"&&kt(6),n!==void 0&&typeof n!="function"&&kt(7);let i;if(en(t)){const a=Zd(this),o=Ql(t,void 0);let s=!0;try{i=r(o),s=!1}finally{s?Xl(a):Zl(a)}return Xd(a,n),Jd(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===yy&&(i=void 0),this.autoFreeze_&&ic(i,!0),n){const a=[],o=[];tn("Patches").generateReplacementPatches_(t,i,a,o),n(a,o)}return i}else kt(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...s)=>this.produceWithPatches(o,l=>t(l,...s));let n,i;return[this.produce(t,r,(o,s)=>{n=o,i=s}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){en(e)||kt(8),Tn(e)&&(e=VA(e));const t=Zd(this),r=Ql(e,void 0);return r[ft].isManual_=!0,Zl(t),r}finishDraft(e,t){const r=e&&e[ft];(!r||!r.isManual_)&&kt(9);const{scope_:n}=r;return Xd(n,t),Jd(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=tn("Patches").applyPatches_;return Tn(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Ql(e,t){const r=$i(e)?tn("MapSet").proxyMap_(e,t):ss(e)?tn("MapSet").proxySet_(e,t):GA(e,t);return(t?t.scope_:wy()).drafts_.push(r),r}function VA(e){return Tn(e)||kt(10,e),ky(e)}function ky(e){if(!en(e)||ls(e))return e;const t=e[ft];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Vl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Vl(e,!0);return no(r,(i,a)=>{xy(r,i,ky(a))},n),t&&(t.finalized_=!1),r}var XA=new YA;XA.produce;var ZA={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Oy=Xe({name:"legend",initialState:ZA,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:le()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,i=mt(e).payload.indexOf(r);i>-1&&(e.payload[i]=n)},prepare:le()},removeLegendPayload:{reducer(e,t){var r=mt(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:le()}}}),{setLegendSize:SB,setLegendSettings:EB,addLegendPayload:jy,replaceLegendPayload:Ay,removeLegendPayload:Sy}=Oy.actions,JA=Oy.reducer,el={exports:{}},tl={};/**