om-memory-system 4.32.0 → 4.33.1

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.
@@ -54,16 +54,16 @@ Error generating stack: `+e.message+`
54
54
  `;)t++;return!0}return!1}function c(n){if(l(n)){if(uu(e[t]))for(;t<e.length&&du(e[t]);)t++;return a(),!0}return!1}function l(n){o(!0);for(let r of n){let n=t+r.length;if(e.slice(t,n)===r)return t=n,!0}return!1}function u(r){return e[t]===r&&(n+=e[t],t++,!0)}function d(n){return e[t]===n&&(t++,!0)}function f(){return d(`\\`)}function p(){return a(),e[t]===`.`&&e[t+1]===`.`&&e[t+2]===`.`&&(t+=3,a(),d(`,`),!0)}function m(){if(e[t]===`{`){n+=`{`,t++,a(),d(`,`)&&a();let r=!0;for(;t<e.length&&e[t]!==`}`;){let o;if(r?o=!0:(o=u(`,`),o||(n=Du(n,`,`)),a()),p(),!(_()||S(!0))){e[t]===`}`||e[t]===`{`||e[t]===`]`||e[t]===`[`||e[t]===void 0?r||(n=Eu(n,`,`)):A();break}a();let s=u(`:`),c=t>=e.length;s||(hu(e[t])||c?n=Du(n,`:`):j()),i()||(s||c?n+=`null`:j()),r=!1}return e[t]===`}`?(n+=`}`,t++):n=Du(n,`}`),!0}return!1}function h(){if(e[t]===`[`){n+=`[`,t++,a(),d(`,`)&&a();let r=!0;for(;t<e.length&&e[t]!==`]`;){if(r||u(`,`)||(n=Du(n,`,`)),p(),!i()){r||(n=Eu(n,`,`));break}r=!1}return e[t]===`]`?(n+=`]`,t++):n=Du(n,`]`),!0}return!1}function g(){let e=!0,t=!0;for(;t;)e?e=!1:u(`,`)||(n=Du(n,`,`)),t=i();t||(n=Eu(n,`,`)),n=`[\n${n}\n]`}function _(){let r=arguments.length>0&&arguments[0]!==void 0&&arguments[0],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,o=e[t]===`\\`;o&&(t++,xu(e[t])||O());let s=e[t]===`&`?ju(e.slice(t,t+12)):null,c=Mu(s)||Nu(s);if(xu(e[t])||c){let l=Cu(e[t])?Cu:Tu(e[t])?Tu:wu(e[t])?wu:Su,u=t,d=n.length,p=`"`;for(t+=c&&s?s.length:1;;){if(t>=e.length){let i=w(t-1);return!r&&lu(e.charAt(i))?(t=u,n=n.substring(0,d),_(!0)):(p=Du(p,`"`),n+=p,!0)}if(t===i)return p=Du(p,`"`),n+=p,!0;let m=c&&e[t]===`&`?ju(e.slice(t,t+12)):null;if(m&&s?m.char===s.char:l(e[t])){let i=t,o=p.length;if(p+=`"`,t+=m?m.length:1,n+=p,a(!1),r||t>=e.length||lu(e[t])&&!Fu(p,e[t])||xu(e[t])&&!T(t)||su(e[t]))return v(),!0;e[t]===`\\`&&O();let s=w(i-1),c=e.charAt(s);if(c===`,`)return t=u,n=n.substring(0,d),_(!1,s);if(lu(c))return t=u,n=n.substring(0,d),_(!0);n=n.substring(0,d),t=i+(m?m.length:1),p=`${p.substring(0,o)}\\${p.substring(o)}`}else if(r&&mu(e[t])){if(e[t-1]===`:`&&fu.test(e.substring(u+1,t+2)))for(;t<e.length&&pu.test(e[t]);)p+=e[t],t++;return p=Du(p,`"`),n+=p,v(),!0}else if(m){let e=m.char;e===`"`?p+=`\\"`:_u(e)?p+=Iu[e]:p+=e,t+=m.length}else if(e[t]===`\\`){let n=e.charAt(t+1);if(Lu[n]!==void 0)p+=e.slice(t,t+2),t+=2;else if(n===`u`){let n=2;for(;n<6&&ou(e[t+n]);)n++;n===6?(p+=e.slice(t,t+6),t+=6):t+n>=e.length?t=e.length:M()}else n===`
55
55
  `?(p+=`\\n`,t+=2):(p+=n,t+=2)}else{let n=e.charAt(t);n===`"`&&e[t-1]!==`\\`?(p+=`\\${n}`,t++):_u(n)?(p+=Iu[n],t++):(cu(n)||D(n),p+=n,t++)}o&&f()}}return!1}function v(){let r=!1;for(a();e[t]===`+`;){r=!0,t++,a(),n=Eu(n,`"`,!0);let e=n.length;n=_()?Ou(n,e,1):Du(n,`"`)}return r}function y(){let r=t,i=``,a=!1;for(e[t]===`-`&&(i+=e[t],t++,!su(e[t])&&E()&&(i+=`0`)),e[t]===`0`&&su(e[t+1])&&(a=!0);su(e[t]);)i+=e[t],t++;if(e[t]===`.`)for((i===``||i===`-`)&&(i+=`0`),i+=e[t],t++,su(e[t])||(i+=`0`);su(e[t]);)i+=e[t],t++;if(t>r){if(e[t]===`e`||e[t]===`E`)for(i===`-`&&(a=!0),i+=e[t],t++,(e[t]===`-`||e[t]===`+`)&&(i+=e[t],t++),su(e[t])||(i+=`0`);su(e[t]);)i+=e[t],t++;return E()?(n+=a?`"${e.substring(r,t)}"`:i,!0):(t=r,!1)}return!1}function b(){return x(`true`,`true`)||x(`false`,`false`)||x(`null`,`null`)||x(`True`,`true`)||x(`False`,`false`)||x(`None`,`null`)}function x(r,i){return e.slice(t,t+r.length)===r&&!du(e[t+r.length])&&(n+=i,t+=r.length,!0)}function S(r){let a=t;if(uu(e[t])){for(;t<e.length&&du(e[t]);)t++;let n=t;for(;vu(e,n);)n++;if(e[n]===`(`)return t=n+1,i(),e[t]===`)`&&(t++,e[t]===`;`&&t++),!0}for(;t<e.length&&!mu(e[t])&&!xu(e[t])&&(!r||e[t]!==`:`);)t++;if(e[t-1]===`:`&&fu.test(e.substring(a,t+2)))for(;t<e.length&&pu.test(e[t]);)t++;if(t>a){for(;vu(e,t-1)&&t>0;)t--;let r=e.slice(a,t);return n+=r===`undefined`?`null`:JSON.stringify(r),e[t]===`"`&&t++,!0}}function C(){if(e[t]===`/`){let r=t;for(t++;t<e.length&&(e[t]!==`/`||e[t-1]===`\\`);)t++;return t++,n+=JSON.stringify(e.substring(r,t)),!0}}function w(t){let n=t;for(;n>0&&vu(e,n);)n--;return n}function T(t){let n=t+1;for(;n<e.length&&vu(e,n);)n++;return n>=e.length||lu(e[n])}function E(){return t>=e.length||lu(e[t])||vu(e,t)}function D(e){throw new ql(`Invalid character ${JSON.stringify(e)}`,t)}function O(){throw new ql(`Unexpected character ${JSON.stringify(e[t])}`,t)}function k(){throw new ql(`Unexpected end of json string`,e.length)}function A(){throw new ql(`Object key expected`,t)}function j(){throw new ql(`Colon expected`,t)}function M(){throw new ql(`Invalid unicode character "${e.slice(t,t+6)}"`,t)}}function zu(e,t){return e[t]===`*`&&e[t+1]===`/`}function Bu(e){if(!e)return[];let t=e,n=null;for(;typeof t==`string`&&t!==n;){n=t;try{t=JSON.parse(Ru(t))}catch{break}}if(!Array.isArray(t))return[];let r=[],i=e=>{Array.isArray(e)?e.forEach(i):e&&typeof e==`object`&&r.push(e)};return i(t),r}function Vu(e,t){if(!t||!e.includes(`_`))return null;let[n,r]=e.split(`_`),i=parseInt(r,10);return Number.isNaN(i)?null:n===`pref`?t.preferences?.[i]?.description??null:n===`pat`?t.patterns?.[i]?.description??null:n===`wf`?t.workflows?.[i]?.description??null:null}function Hu(e,t){if(!t||!e.includes(`_`))return null;let[n,r]=e.split(`_`),i=parseInt(r,10);return Number.isNaN(i)||n!==`wf`?null:t.workflows?.[i]?.steps||null}var Uu=`manual-write`;function Wu(e){let t=e.evidence;return(Array.isArray(t)?t:t?[t]:[]).filter(e=>e.trim().length>0).map(e=>({kind:e.trim()===Uu?`manual-write`:`text`,text:e}))}function Gu(e){return e>=80?`high`:e>=60?`medium`:e>=40?`low`:`poor`}var Ku={high:`border-green-600/40 bg-green-500/15 text-green-700 dark:text-green-400`,medium:`border-blue-600/40 bg-blue-500/15 text-blue-700 dark:text-blue-400`,low:`border-orange-600/40 bg-orange-500/15 text-orange-700 dark:text-orange-400`,poor:`border-red-600/40 bg-red-500/15 text-red-700 dark:text-red-400`};function qu(e,t){return e.length>t?e.substring(0,t)+`...`:e}function Ju(e){let{open:t=!1,profile:n=null,onOpenChange:r,onApplied:i,onMinimise:a}=e,{t:o}=oa(),s=ga(t),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(new Set),[m,h]=(0,v.useState)(new Set),[g,_]=(0,v.useState)(new Set),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),C=(0,v.useRef)(!1),w=s.job,T=la(w,s.startError),E=c||!!w&&!s.checked,D=E?{phase:`running`,done:0,total:0}:T,O=D.phase===`review`?D.result:null,k=(0,v.useMemo)(()=>{let e={};for(let t of u){let n=t.category||`(none)`;e[n]||(e[n]={pref:[],pat:[],wf:[]}),e[n][t._type].push(t)}return e},[u]),A=(0,v.useMemo)(()=>Object.keys(k).sort(),[k]),j=f.size,M=m.size+g.size,N=(O?.changes.merged?.length||0)+(O?.changes.removed?.length||0);function P(){let e=n?.profileData;if(!e){U.error(`No profile data loaded`),F(!1);return}let t=(e.preferences||[]).map((e,t)=>({...e,_id:`pref_${t}`,_type:`pref`})),r=(e.patterns||[]).map((e,t)=>({...e,_id:`pat_${t}`,_type:`pat`})),i=(e.workflows||[]).map((e,t)=>({...e,_id:`wf_${t}`,_type:`wf`})),a=[...t,...r,...i];d(a),p(new Set(a.filter(e=>(e.frequency||0)<=3).map(e=>e._id))),b(!1)}(0,v.useEffect)(()=>{t&&!C.current?P():!t&&C.current&&S(!1),C.current=t},[t]);let ee=w?.status.state===`done`?w.id:null;(0,v.useEffect)(()=>{if(w?.status.state!==`done`)return;let{changes:e}=w.status.result;h(new Set((e.merged||[]).map((e,t)=>t))),_(new Set((e.removed||[]).map((e,t)=>t)))},[ee]);function F(e){r?.(e)}function I(e,t){p(n=>Kl(n,e,t))}function te(){p(new Set(u.map(e=>e._id)))}function L(){p(new Set)}function ne(){p(new Set(u.filter(e=>(e.frequency||0)<=3).map(e=>e._id)))}function re(){p(Gl(u))}async function R(e){if(e.length===0){U.warning(`No items selected`);return}l(!0),await s.start(e,n?.version,o(`toast-ai-cleanup-failed`)),l(!1)}function ie(){p(pa(w,f)),s.discard()}function ae(e){if(!e.includes(`_`))return`?`;let t=e.split(`_`)[0];return t===`pref`?o(`profile-type-pref`)||`Pref`:t===`pat`?o(`profile-type-pat`)||`Pat`:t===`wf`?o(`profile-type-wf`)||`Wf`:`?`}function se(e,t){h(n=>Kl(n,e,t))}function ue(e,t){_(n=>Kl(n,e,t))}function de(){h(new Set((O?.changes.merged||[]).map((e,t)=>t))),_(new Set((O?.changes.removed||[]).map((e,t)=>t)))}function fe(){h(new Set),_(new Set)}async function pe(){if(!O||M===0)return;S(!0);let e=[...m].map(e=>O.changes.merged?.[e]?.ids).filter(e=>!!e),t=[...g].map(e=>O.changes.removed?.[e]?.id).filter(e=>!!e),n=await si.apply(e,t);if(S(!1),n.success){let{applied:e=0,skipped:t=0}=n.data??{};U.success(t>0?o(`toast-ai-cleanup-skipped`,{applied:e,skipped:t}):o(`toast-ai-cleanup-success`)),s.clear(),F(!1),i?.()}else U.error(n.error||o(`toast-cleanup-apply-failed`))}return(0,H.jsx)(K,{open:t,onOpenChange:F,children:(0,H.jsxs)(q,{className:`grid! sm:max-w-2xl max-h-[90vh] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden gap-4`,onMinimise:D.phase===`running`&&!E?a:void 0,children:[(0,H.jsx)(Vl,{className:`pe-20`,children:(0,H.jsx)(Ul,{children:o(`label-ai-cleanup-title`)})}),D.phase===`running`?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-6 animate-spin`}),(0,H.jsx)(`span`,{className:`text-sm`,children:o(`label-ai-cleanup-loading`)}),D.total>0?(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground`,"aria-live":`polite`,children:o(`label-ai-cleanup-progress`,{done:D.done,total:D.total})}):null,(0,H.jsx)(`span`,{className:`text-xs`,children:o(`label-ai-cleanup-running-hint`)})]}):D.phase===`failed`?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-10 text-center`,role:`alert`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-destructive`,children:o(`toast-ai-cleanup-failed`)}),(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground break-words`,children:D.error})]}):D.phase===`select`?(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3 overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:o(`label-ai-cleanup-select`)}),(0,H.jsx)(Ha,{onSelectAll:te,onSelectNone:L,onSelectLow:ne,onSelectSameCat:re})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto pr-1`,children:A.map(e=>{let t=[...k[e].pref,...k[e].pat,...k[e].wf];return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs rounded-full bg-muted px-2 py-0.5`,children:e}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[t.length,` items`]})]}),t.map(e=>{let t=f.has(e._id);return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 px-2 py-1.5 text-sm cursor-pointer hover:bg-muted/40`,role:`checkbox`,"aria-checked":t,tabIndex:0,onClick:()=>I(e._id,!t),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),I(e._id,!t))},children:[(0,H.jsx)(`span`,{className:`pointer-events-none inline-flex`,children:(0,H.jsx)(Qo,{checked:t,tabIndex:-1})}),(0,H.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground w-4`,children:e._type===`pref`?`P`:e._type===`pat`?`T`:`W`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:(e.description||``).substring(0,80)}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground shrink-0`,children:[(0,H.jsx)(Ft,{className:`size-3`}),e.frequency||0,e.confidence==null?``:` | ${Math.round(e.confidence*100)}%`]})]},e._id)})]},e)})}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[(0,H.jsx)(`span`,{className:`rounded-md border border-status-success/30 bg-status-success/10 px-2 py-0.5 text-xs font-medium text-status-success`,children:o(`label-ai-cleanup-selected`,{count:j})}),(0,H.jsx)(G,{onClick:()=>R([...f]),children:o(`label-ai-cleanup-analyze`)})]})]}):D.phase===`review`&&O?(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3 overflow-hidden`,children:[D.notice?(0,H.jsx)(`div`,{className:`rounded-lg border border-status-warning/30 bg-status-warning/10 px-3 py-2 text-xs text-status-warning`,children:o(`label-ai-cleanup-failed-batches`,D.notice)}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(`label-ai-cleanup-changes-selected`,{selected:M,total:N})}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(G,{variant:`link`,size:`xs`,onClick:de,children:o(`label-ai-cleanup-select-all`)}),(0,H.jsx)(G,{variant:`link`,size:`xs`,onClick:fe,children:o(`label-ai-cleanup-deselect-all`)})]})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto pr-1`,children:[(O.changes.merged||[]).length>0?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-subsection-title font-semibold`,children:[(0,H.jsx)(Pe,{className:`size-3.5`}),o(`label-ai-cleanup-merged-header`,{count:O.changes.merged?.length||0})]}),(O.changes.merged||[]).map((e,t)=>{let n=e.ids.slice(1),r=e.result||``,i=m.has(t);return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border p-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm cursor-pointer`,role:`checkbox`,"aria-checked":i,tabIndex:0,onClick:()=>se(t,!i),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),se(t,!i))},children:[(0,H.jsx)(`span`,{className:`pointer-events-none inline-flex`,children:(0,H.jsx)(Qo,{checked:i,tabIndex:-1})}),(0,H.jsx)(`span`,{children:o(`label-ai-cleanup-merge-check`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_auto_1fr] items-start text-sm`,children:[(0,H.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=Vu(e,O.old);return t?(0,H.jsxs)(`div`,{className:`rounded-lg bg-muted/50 p-2 space-y-1`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[10px] rounded bg-muted px-1.5 py-0.5`,children:ae(e)}),` `,qu(t,80)]}),(0,H.jsx)(Ua,{steps:Hu(e,O.old)})]},e):null})}),(0,H.jsx)(`div`,{className:`text-muted-foreground self-center grid place-items-center`,children:(0,H.jsx)(ce,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`rounded-lg bg-primary/10 p-2 space-y-1`,children:[(0,H.jsx)(`div`,{children:qu(r,120)}),(0,H.jsx)(Ua,{steps:Hu(e.ids[0],O.old)})]})]})]},t)})]}):null,(O.changes.removed||[]).length>0?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-subsection-title font-semibold`,children:[(0,H.jsx)(Lt,{className:`size-3.5`}),o(`label-ai-cleanup-removed-header`,{count:O.changes.removed?.length||0})]}),(O.changes.removed||[]).map((e,t)=>{let n=Vu(e.id,O.old),r=g.has(t);return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border p-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm cursor-pointer`,role:`checkbox`,"aria-checked":r,tabIndex:0,onClick:()=>ue(t,!r),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ue(t,!r))},children:[(0,H.jsx)(`span`,{className:`pointer-events-none inline-flex`,children:(0,H.jsx)(Qo,{checked:r,tabIndex:-1})}),(0,H.jsx)(`span`,{children:o(`label-ai-cleanup-remove-check`)})]}),(0,H.jsx)(`div`,{className:`text-sm`,children:n||e.id}),(0,H.jsx)(Ua,{steps:Hu(e.id,O.old)}),(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.reason})]},t)})]}):null,(O.changes.kept||[]).length>0?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 text-sm font-medium`,onClick:()=>b(e=>!e),children:[o(`label-ai-cleanup-kept`),(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,O.changes.kept?.length||0,`)`]}),y?(0,H.jsx)(le,{className:`size-3.5`}):(0,H.jsx)(oe,{className:`size-3.5`})]}),y?(0,H.jsx)(`div`,{className:`space-y-1`,children:(O.changes.kept||[]).map((e,t)=>(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground rounded bg-muted/40 px-2 py-1`,children:e},t))}):null]}):null]})]}):null,(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{variant:`secondary`,onClick:()=>F(!1),children:o(`btn-cancel`)}),D.phase===`running`&&!E?(0,H.jsx)(G,{variant:`outline`,onClick:ie,children:o(`btn-ai-cleanup-stop`)}):null,D.phase===`failed`||D.phase===`review`?(0,H.jsx)(G,{variant:`outline`,onClick:ie,children:o(`btn-ai-cleanup-back`)}):null,D.phase===`failed`?(0,H.jsx)(G,{onClick:()=>R(ma(w,f)),children:o(`btn-ai-cleanup-retry`)}):null,D.phase===`review`?(0,H.jsx)(G,{disabled:M===0||x,onClick:pe,children:M>0?`${o(`label-ai-cleanup-apply`)} (${M})`:o(`label-ai-cleanup-apply`)||`Apply`}):null]})]})})}function Yu({onOpen:e,onGone:t}){let{t:n}=oa(),r=ga(!0,!0),i=ua(r.job,r.checked),a=i===null;if((0,v.useEffect)(()=>{a&&t()},[a,t]),!i)return null;let o=i.kind===`failed`,s=i.kind===`running`?i.total>0?n(`label-ai-cleanup-pill-progress`,{done:i.done,total:i.total}):n(`label-ai-cleanup-pill-running`):i.kind===`ready`?n(`label-ai-cleanup-pill-ready`):n(o?`label-ai-cleanup-pill-failed`:`label-ai-cleanup-pill`);return(0,H.jsx)(`div`,{className:`fixed top-3 end-3 z-40 max-w-[calc(100%-1.5rem)]`,role:`status`,children:(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:e,className:V(`max-w-full bg-popover shadow-md`,o&&`border-destructive text-destructive hover:text-destructive`),children:[i.kind===`ready`?(0,H.jsx)(fe,{"aria-hidden":`true`}):o?(0,H.jsx)(ue,{"aria-hidden":`true`}):(0,H.jsx)(Je,{"aria-hidden":`true`,className:`animate-spin`}),(0,H.jsx)(`span`,{className:`truncate`,children:s})]})})}function Xu(e){let t=new Set;return e.forEach((e,n)=>{e.checked&&t.add(n)}),t}function Zu(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Qu(e,t,n){return t.reduce((e,t,r)=>e-(n.has(r)?t.labels.length-1:0),e)}function $u(e,t,n){return[...t].map(t=>({labels:e[t].labels.map(e=>e.label),name:n[t].trim()}))}function ed(e){let t=0;for(let n of e.trim().toLowerCase())t=t*31+n.codePointAt(0)|0;return Math.abs(t)%360}function td({keyword:e,active:t=!1,title:n,onClick:r,"aria-describedby":i,"aria-label":a}){let o=ed(e);return(0,H.jsx)(`button`,{type:`button`,title:n,"aria-describedby":i,"aria-label":a,"aria-pressed":t,onClick:()=>r?.(e),className:V(`inline-flex min-h-6 max-w-full cursor-pointer items-center rounded-[7px] border px-2 text-xs break-words transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,`[color:oklch(0.42_0.13_var(--keyword-hue))] dark:[color:oklch(0.8_0.13_var(--keyword-hue))]`,t&&`ring-2 ring-offset-1 ring-offset-background`),style:{backgroundColor:`oklch(0.72 0.14 ${o} / 0.18)`,borderColor:`oklch(0.72 0.14 ${o} / 0.45)`,"--keyword-hue":String(o),"--tw-ring-color":`oklch(0.72 0.14 ${o} / 0.7)`},children:e})}var nd=Ba(`h-5 gap-1 rounded-2xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-colors focus-visible:ring-[3px] [&>svg]:pointer-events-none`,{variants:{variant:{default:`bg-primary/10 border-primary/25 text-primary-label [a]:hover:bg-primary/16`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 border-destructive/25 [a]:hover:bg-destructive/16 text-destructive-label`,info:`bg-status-info/10 border-status-info/25 text-status-info [a]:hover:bg-status-info/16`,warning:`bg-status-warning/10 border-status-warning/25 text-status-warning [a]:hover:bg-status-warning/16`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function rd({className:e,variant:t,asChild:n=!1,...r}){return(0,H.jsx)(n?Ta:`span`,{"data-slot":`badge`,className:V(nd({variant:t}),e),...r})}function id({className:e,type:t,...n}){return(0,H.jsx)(`input`,{type:t,"data-slot":`input`,className:V(`border-input file:text-foreground placeholder:text-muted-foreground selection:bg-selection selection:text-foreground flex h-9 w-full min-w-0 rounded-[10px] border bg-card px-2.5 py-1 text-ui transition-colors duration-150 outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-ui file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`aria-invalid:ring-destructive aria-invalid:ring-1 aria-invalid:border-destructive`,e),...n})}var ad=3e3;function od({label:e,count:t}){return(0,H.jsxs)(rd,{variant:`outline`,className:`bg-transparent border-current [color:oklch(0.42_0.13_var(--category-hue))] dark:[color:oklch(0.8_0.13_var(--category-hue))]`,style:{"--category-hue":String(ed(e))},children:[(0,H.jsx)(`bdi`,{children:e}),(0,H.jsx)(`span`,{className:`ms-1 font-mono opacity-70`,children:t})]})}function sd({open:e=!1,onOpenChange:t,onApplied:n}){let{t:r}=oa(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(new Set),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(null),g=(0,v.useRef)(!1),_=(0,v.useRef)(0);(0,v.useEffect)(()=>{e&&!g.current&&b(!1),e||_.current++,g.current=e},[e]);function y(e){a(e),s(Xu(e.groups)),l(e.groups.map(e=>e.name))}async function b(e){let t=++_.current;a(null),p(null),h(null);let n=null;if(!e){let e=await W(`/api/user-profile/category-cleanup`);n=e.success?e.data??null:null}if(!n||n.status.state===`failed`){let e=await W(`/api/user-profile/category-cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(!e.success||!e.data){h(e.error||r(`toast-category-cleanup-failed`));return}n=e.data}for(;t===_.current;){let e=n.status;if(e.state===`done`)return y(e.preview);if(e.state===`failed`)return h(e.error);p(e.state===`checking`&&e.total>0?{done:e.done,total:e.total}:null),await new Promise(e=>setTimeout(e,ad));let t=await W(`/api/user-profile/category-cleanup`);if(!t.success||!t.data)return h(t.error||r(`toast-category-cleanup-failed`));n=t.data}}function x(e){s(t=>Zu(t,e))}let S=i?Qu(i.before,i.groups,o):0,C=[...o].every(e=>(c[e]??``).trim().length>0);async function w(){if(!i||o.size===0||!C)return;d(!0);let e=$u(i.groups,o,c),a=await W(`/api/user-profile/category-cleanup/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e})});if(d(!1),!a.success||!a.data){U.error(a.error||r(`toast-category-cleanup-failed`));return}U.success(r(`toast-category-cleanup-applied`,{count:a.data.renamed})),t?.(!1),n?.()}async function T(){d(!0);let e=await W(`/api/user-profile/category-cleanup/undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(d(!1),!e.success||!e.data){U.info(e.error||r(`toast-category-cleanup-failed`));return}U.success(r(`toast-category-cleanup-undone`,e.data)),t?.(!1),n?.()}return(0,H.jsx)(K,{open:e,onOpenChange:t,children:(0,H.jsxs)(q,{className:`grid! sm:max-w-2xl max-h-[90vh] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden gap-4`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:r(`label-category-cleanup-title`)})}),m?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm`,children:[(0,H.jsx)(`span`,{className:`text-destructive`,children:m}),(0,H.jsx)(G,{variant:`secondary`,size:`sm`,onClick:()=>void b(!0),children:r(`btn-category-cleanup-rebuild`)})]}):i?(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3 overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:r(`label-category-cleanup-counts`,{before:i.before,after:S})}),(0,H.jsx)(G,{variant:`link`,size:`xs`,onClick:()=>void b(!0),children:r(`btn-category-cleanup-rebuild`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`label-category-cleanup-note`)}),i.groups.length===0?(0,H.jsx)(`p`,{className:`py-6 text-center text-sm text-muted-foreground`,children:r(`label-category-cleanup-empty`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`label-category-cleanup-selected`,{selected:o.size,total:i.groups.length})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pe-1`,children:i.groups.map((e,t)=>(0,H.jsxs)(`div`,{className:`rounded-xl border border-border p-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(Qo,{checked:o.has(t),onCheckedChange:()=>x(t),"aria-label":r(`label-category-cleanup-accept`)}),(0,H.jsx)(id,{dir:`auto`,className:`h-8 min-w-0 flex-1 sm:max-w-64`,value:c[t]??``,"aria-label":r(`label-category-cleanup-name`),disabled:!o.has(t),onChange:e=>l(n=>n.map((n,r)=>r===t?e.target.value:n))}),e.checked?null:(0,H.jsx)(`span`,{className:`basis-full text-xs text-muted-foreground sm:basis-auto`,children:r(`label-category-cleanup-unchecked`)})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.labels.map(e=>(0,H.jsx)(od,{label:e.label,count:e.count},e.label))})]},e.id))})]})]}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-center text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-6 animate-spin`}),(0,H.jsx)(`span`,{className:`text-sm`,children:f?r(`label-category-cleanup-progress`,f):r(`label-category-cleanup-loading`)}),(0,H.jsx)(`span`,{className:`text-xs`,children:r(`label-category-cleanup-background`)})]}),(0,H.jsxs)(Hl,{className:`gap-2 sm:justify-between`,children:[(0,H.jsxs)(G,{variant:`secondary`,size:`sm`,disabled:u,onClick:()=>void T(),children:[(0,H.jsx)(Bt,{className:`size-3.5`}),r(`btn-category-cleanup-undo`)]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(G,{variant:`secondary`,size:`sm`,onClick:()=>t?.(!1),children:r(`btn-cancel`)}),(0,H.jsx)(G,{size:`sm`,disabled:u||!i||o.size===0||!C,onClick:()=>void w(),children:r(`btn-category-cleanup-apply`)})]})]})]})})}var J={home:`/`,project:`/project-memories`,profile:`/user-profile`,settings:`/settings`,memory:`/memory`,chat:`/chat`,skills:`/skills`},cd=[`pi`,`opencode`,`claude-code`,`shared`];function ld(e){return`${J.memory}/${e}`}var ud=e=>e===J.memory||e.startsWith(`${J.memory}/`);function dd(e){let t=/^\/memory\/([^/]+)$/.exec(fd(e))?.[1];return cd.includes(t??``)?t:null}function fd(e){let t=e.replace(/\/+$/,``)||`/`;return t.startsWith(`/`)?t:`/${t}`}function pd(e){let t=fd(e);return ud(t)?`memory`:t===J.settings?`settings`:t===J.chat?`chat`:t===J.skills?`skills`:t===J.profile?`profile`:`project`}function md(e){let t=fd(e);return t===J.home||t===J.project||t===J.profile||t===J.settings||ud(t)||t===J.chat||t===J.skills}function hd(e){let t=fd(e);return t===J.home?J.project:ud(t)?dd(t)?t:J.memory:md(t)?t:J.project}function gd(e,t){let[n,r]=(0,v.useState)(()=>{try{let t=localStorage.getItem(e);return t===null?null:t===`1`}catch{return null}}),i=n??t;return[i,()=>{let t=!i;r(t);try{localStorage.setItem(e,t?`1`:`0`)}catch{}}]}function _d({link:e,sections:t,open:n,onToggle:r,label:i,hideWhenCollapsed:a,onSectionClick:o,id:s=`sidebar-profile-tree`,base:c=J.profile}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[e,t.length>0&&(0,H.jsx)(`button`,{type:`button`,className:V(`inline-flex min-h-11 min-w-11 md:min-h-7 md:min-w-7 shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,a),onClick:r,"aria-expanded":n,"aria-controls":s,"aria-label":i,title:i,children:(0,H.jsx)(ce,{className:V(`size-4 transition-transform rtl:-scale-x-100`,n&&`rotate-90 rtl:rotate-90`)})})]}),n&&t.length>0&&(0,H.jsx)(`ul`,{id:s,className:V(`ms-5 space-y-0.5 border-s border-sidebar-border ps-2`,a),children:t.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`a`,{href:`${c}#${e.id}`,className:`flex min-h-11 md:min-h-7 items-center break-words rounded-lg px-2.5 py-1 text-xs text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,onClick:t=>o(t,e.id),children:e.label})},e.id))})]})}function vd({sections:e,currentView:t,memoryViewId:n,warningLabel:r,className:i,onSectionClick:a}){return(0,H.jsx)(`ul`,{id:`sidebar-memory-tree`,className:i,children:e.map(e=>(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`a`,{href:`${J.memory}/${e.id}`,"aria-current":t===`memory`&&n===e.id?`page`:void 0,className:`flex min-h-11 md:min-h-7 items-center gap-2 break-words rounded-lg px-2.5 py-1 text-xs text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring aria-[current=page]:bg-sidebar-accent aria-[current=page]:text-sidebar-accent-foreground`,onClick:t=>a(t,e.id,`memory`),children:[e.avatar,e.label,e.warning&&(0,H.jsx)(`span`,{role:`img`,"aria-label":r,title:r,className:`ms-auto size-2 shrink-0 rounded-full bg-[var(--status-warning)]`})]}),e.items&&e.items.length>0&&(0,H.jsx)(`ul`,{"aria-label":e.label,className:`ms-4 mt-0.5 space-y-0.5 border-s border-sidebar-border ps-2`,children:e.items.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`a`,{href:`${J.memory}/${e.id}#${t.id}`,className:`flex min-h-11 md:min-h-7 items-center break-words rounded-lg px-2.5 py-1 text-xs text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,onClick:n=>a(n,`${e.id}#${t.id}`,`memory`),children:t.label})},t.id))})]},e.id))})}function yd({className:e,...t}){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,className:V(`size-4 shrink-0`,e),...t,children:(0,H.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}var bd=15e3,xd=5e3,Sd=500,Cd=3e4,wd=2e3,Td=42e4,Ed=new Set([`idle`,`installing`,`restarting`,`failed`]);function Dd(e){if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.state!=`string`||!Ed.has(t.state)))return{available:typeof t.available==`string`?t.available:null,state:t.state,code:typeof t.code==`string`?t.code:null,canInstall:t.canInstall===!0}}var Od=()=>({"x-omms-token":window.__OMMS_TOKEN__??``});async function kd(){try{let e=await fetch(`/api/web/status`,{headers:Od(),signal:AbortSignal.timeout(xd)});if(!e.ok)return null;let t=await e.json();if(typeof t.version!=`string`||typeof t.canControl!=`boolean`)return null;let n=Dd(t.update);return{version:t.version,canControl:t.canControl,...typeof t.instance==`string`?{instance:t.instance}:{},...n?{update:n}:{}}}catch{return null}}async function Ad(e){try{return(await fetch(`/api/web/${e}`,{method:`POST`,headers:{...Od(),"Content-Type":`application/json`},body:`{}`,signal:AbortSignal.timeout(xd)})).status===202}catch{return!1}}async function jd(e,t={}){let n=t.sleep??(e=>new Promise(t=>setTimeout(t,e))),r;for(let t=0;;t+=Sd){if(r=await kd(),r&&r.instance!==e)return`restarted`;if(t>=Cd)break;await n(Sd)}return r?`unchanged`:`down`}async function Md(){try{return(await fetch(`/api/web/update`,{method:`POST`,headers:{...Od(),"Content-Type":`application/json`},body:`{}`,signal:AbortSignal.timeout(xd)})).status===202}catch{return!1}}async function Nd(e,t={}){let n=t.sleep??(e=>new Promise(t=>setTimeout(t,e)));for(let t=0;t<=Td;t+=wd){let t=await kd();if(t&&t.instance!==e)return{kind:`restarted`};if(t?.update?.state===`failed`)return{kind:`failed`,code:t.update.code??`unknown`};await n(wd)}return{kind:`timeout`}}var Pd={ok:!0,status:null},Fd=new Set,Id=null,Ld=0,Rd=0;async function zd(){let e=++Ld,t=await kd();if(!(e<Rd)){Rd=e,Pd=t?{ok:!0,status:t}:{...Pd,ok:!1};for(let e of Fd)e(Pd)}}function Bd(e){return Fd.add(e),e(Pd),zd(),Id??=setInterval(()=>void zd(),bd),()=>{Fd.delete(e),Fd.size===0&&Id!==null&&(clearInterval(Id),Id=null)}}var Vd=()=>Pd;function Hd(){return(0,v.useSyncExternalStore)(Bd,Vd,Vd)}var Ud=`om-memory-system web`;function Wd(){let{t:e}=oa(),{ok:t,status:n}=Hd(),r=n?.canControl??!1,i=n?.instance??null,[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(`idle`),[l,u]=(0,v.useState)(``);async function d(e){if(s!==`idle`)return;if(c(`working`),u(``),!await Ad(e)){c(`idle`),u(`power-request-failed`);return}if(o(!1),e===`stop`){c(`stopped`);return}c(`restarting`);let t=await jd(i);if(t===`restarted`){window.location.reload();return}if(t===`unchanged`){u(`power-restart-failed`),c(`idle`),o(!0);return}u(`power-restart-timeout`),c(`stopped`)}return!r&&s===`idle`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,"data-power":t?`on`:`off`,className:`inline-flex min-h-11 min-w-11 md:min-h-8 md:min-w-7 items-center justify-center self-stretch border-s border-sidebar-border px-1.5 text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>{u(``),o(!0)},"aria-label":e(`power-button`),title:e(`power-button`),children:(0,H.jsx)(vt,{className:V(`size-4`,t&&`text-emerald-500`)})}),(0,H.jsx)(K,{open:a,onOpenChange:e=>s===`idle`&&o(e),children:(0,H.jsxs)(q,{showCloseButton:!1,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:e(`power-dialog-title`)})}),(0,H.jsx)(`p`,{children:e(`power-dialog-body`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`power-note`)}),l?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:e(l)}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,H.jsx)(G,{variant:`ghost`,disabled:s!==`idle`,onClick:()=>o(!1),children:e(`power-cancel`)}),(0,H.jsx)(G,{variant:`destructive`,disabled:s!==`idle`,onClick:()=>void d(`stop`),children:e(`power-stop`)}),(0,H.jsx)(G,{autoFocus:!0,disabled:s!==`idle`,onClick:()=>void d(`restart`),children:e(`power-restart`)})]})]})}),s===`restarting`||s===`stopped`?(0,H.jsx)(`div`,{role:`alert`,className:`fixed inset-0 z-[60] flex flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:s===`restarting`?(0,H.jsx)(`p`,{children:e(`power-restarting`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`power-stopped-title`)}),l?(0,H.jsx)(`p`,{children:e(l)}):null,(0,H.jsx)(`p`,{children:e(`power-stopped-command`)}),(0,H.jsx)(`code`,{className:`rounded-md bg-muted px-2 py-1`,children:Ud}),(0,H.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:e(`power-note`)})]})}):null]})}function Gd({brand:e,className:t}){let{status:n}=Hd();return(0,H.jsxs)(`span`,{className:V(`flex min-w-0 items-baseline gap-1.5`,t),children:[(0,H.jsx)(`span`,{className:`truncate text-ui font-medium tracking-wide text-brand-label`,children:e}),n?(0,H.jsxs)(`span`,{className:`shrink-0 text-xs text-foreground`,"data-testid":`sidebar-version`,children:[`v`,n.version]}):null]})}function Kd({href:e,label:t,icon:n,active:r,collapsed:i,className:a,onNavigate:o}){return(0,H.jsxs)(`a`,{href:e,className:a,"aria-current":r?`page`:void 0,title:i?t:void 0,onClick:t=>o(t,e),children:[(0,H.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:V(`min-w-0 break-words text-start`,i&&`md:sr-only`),children:t})]})}var qd={opencode:`OpenCode`,pi:`Pi`,"claude-code":`Claude Code`};function Jd(e){return qd[e]}function Yd(e){return Object.hasOwn(qd,e)?qd[e]:e}var Xd=cd.map(e=>({id:e,title:e===`shared`?`Shared`:Jd(e)})),Zd=[{id:`shared-profile`,title:`Profile learning`},{id:`shared-limits`,title:`Memory limits`},{id:`shared-keywords`,title:`Keyword matching`},{id:`shared-reranker`,title:`Reranker`},{id:`shared-directory-maps`,title:`Directory maps`}];Zd.map(e=>e.id);var Qd=e=>`${ld(`shared`)}#${e}`,$d=`/memory`,ef={"settings-section-import":$d,"settings-section-auto-import":$d,"settings-section-profile":Qd(`shared-profile`),"settings-section-memory":Qd(`shared-limits`),"settings-section-directory-maps":Qd(`shared-directory-maps`)},tf={"memory-section-import":$d,"memory-section-auto-import":$d,"memory-section-profile":Qd(`shared-profile`),"memory-section-limits":Qd(`shared-limits`),"memory-section-keywords":Qd(`shared-keywords`),"memory-section-reranker":Qd(`shared-reranker`),"memory-section-project-folders":Qd(`shared-directory-maps`)};function nf(e,t){if(e!==`/settings`&&e!==$d)return null;let n=t.replace(/^#/,``),r=/^directory-maps-(pi|opencode|claude-code)$/.exec(n)?.[1];return r?`${ld(r)}#host-unresolved`:(e===`/settings`?ef:tf)[n]??null}var rf={block:`start`};function af(e){let t=e.classList;t&&(t.remove(`anchor-flash`),e.offsetWidth,t.add(`anchor-flash`),setTimeout(()=>t.remove(`anchor-flash`),1600))}function of(e,t){let n=e.startsWith(`#`)?e.slice(1):``;if(!/^(settings|memory)-section-[a-z0-9-]+$/.test(n))return!1;let r=t.getElementById(n);return r?(r.scrollIntoView(rf),af(r),!0):!1}function sf(e){if(typeof document>`u`||typeof requestAnimationFrame>`u`)return;let t=e.replace(/^#/,``);if(!/^(?:(?:settings|memory|skills)-section-[a-z0-9-]+|directory-maps-(?:pi|opencode|claude-code)|shared-(?:profile|limits|keywords|reranker|directory-maps)|host-unresolved|profile-(?:preferences|patterns|workflows))$/.test(t))return;let n=0,r=()=>{let e=document.getElementById(t);if(!e){n++<50&&requestAnimationFrame(r);return}if(t.startsWith(`shared-`)){let t=e.closest(`details`);t&&(t.open=!0)}if(t.startsWith(`directory-maps-`)){let t=e.parentElement;t&&(t.open=!0),e.focus({preventScroll:!0})}e.scrollIntoView(rf),af(e)};requestAnimationFrame(r)}function cf(e,t=``){return nf(fd(e),t)??`${hd(e)}${t}`}var lf=typeof window<`u`?cf(window.location.pathname,window.location.hash):J.project,uf=new Set;function df(){for(let e of uf)e()}function ff(e){lf!==e&&(lf=e,df())}function pf(e){return uf.add(e),()=>{uf.delete(e)}}function mf(){return lf}function hf(){return J.project}function gf(e,t=!1){let[n,r=``]=e.split(/(?=#)/),i=cf(n,r),a=nf(fd(n),r);`${fd(window.location.pathname)}${window.location.hash}`!==i&&(t||a?window.history.replaceState({},``,i):window.history.pushState({},``,i)),ff(i);let o=i.indexOf(`#`);o>=0&&sf(i.slice(o))}function _f(){let e=()=>{let e=`${fd(window.location.pathname)}${window.location.hash}`,t=cf(window.location.pathname,window.location.hash);e!==t&&window.history.replaceState({},``,t),ff(t),window.location.hash&&sf(window.location.hash)};return e(),window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function vf(){return(0,v.useSyncExternalStore)(pf,mf,hf)}function yf(){return pd(vf().split(`#`)[0])}var bf=[{view:`project`,href:J.project,icon:Ae},{view:`chat`,href:J.chat,icon:Ze},{view:`profile`,href:J.profile,icon:Ht},{view:`skills`,href:J.skills,icon:kt}];function xf({currentView:e,labels:t,collapsed:n,navClass:r,onNavigate:i,profileTree:a,skillsTree:o}){return bf.map(({view:s,href:c,icon:l})=>{let u=t[s],d=(0,H.jsx)(Kd,{href:c,label:u,icon:l,collapsed:n,onNavigate:i,active:e===s,className:r(e===s)},s);return s===`profile`?(0,H.jsx)(_d,{link:d,label:u,...a},s):s===`skills`?(0,H.jsx)(_d,{link:d,label:u,id:`sidebar-skills-tree`,base:J.skills,...o},s):d})}var Sf=[{label:`update-host-claude`,command:`claude plugin update omms@omms`},{label:`update-host-opencode`,command:`opencode plugin update om-memory-system`},{label:`update-host-pi`,command:`pi update npm:om-memory-system`},{label:`update-host-global`,command:`npm i -g om-memory-system@latest && om-memory-system web install`}],Cf={row:`mb-2 flex min-h-11 w-full rounded-lg border border-sidebar-border/80 bg-card/70 px-2`,inline:`inline-flex min-h-8 self-stretch border-s border-sidebar-border px-2`,icon:`inline-flex min-h-8 min-w-7 self-stretch px-1.5 py-1.5`};function wf(){let{ok:e,status:t}=Hd(),n=t?.update;return!t?.canControl||!n?.available?null:{ok:e,status:t,update:n,available:n.available}}function Tf({variant:e=`row`,className:t,onOpen:n}){let{t:r}=oa(),i=wf();return i?.ok?(0,H.jsx)(`button`,{type:`button`,"data-update":i.available,"data-variant":e,className:V(`items-center justify-center text-xs font-medium text-brand-label transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,Cf[e],t),onClick:n,"aria-label":r(`update-button`,{version:i.available}),title:r(`update-button`,{version:i.available}),children:e===`icon`?(0,H.jsx)(de,{className:`size-4`}):r(`update-label`)}):null}function Ef({open:e,onOpenChange:t}){let{t:n}=oa(),r=wf(),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(null);if(!r)return null;let{status:u,update:d,available:f}=r,p=d.state===`failed`?d.code:null,m=i||d.state===`installing`||d.state===`restarting`;async function h(){if(m)return;if(a(!0),s(``),!await Md()){a(!1),s(n(`update-request-failed`));return}let e=await Nd(u?.instance??null);if(e.kind===`restarted`){window.location.reload();return}a(!1),s(e.kind===`failed`?n(`update-failed`,{code:e.code}):n(`update-timeout`))}function g(e){navigator.clipboard?.writeText(e),l(e)}let _=o||(p?n(`update-failed`,{code:p}):``);return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(K,{open:e,onOpenChange:e=>!m&&t(e),children:(0,H.jsxs)(q,{showCloseButton:!1,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:n(`update-dialog-title`)})}),(0,H.jsx)(`p`,{children:n(`update-versions`,{running:u.version,available:f})}),(0,H.jsx)(`p`,{className:`text-sm`,children:n(`update-hosts-intro`)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-2`,children:Sf.map(({label:e,command:t})=>(0,H.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(e)}),(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`code`,{className:`min-w-0 flex-1 break-all rounded-md bg-muted px-2 py-1 text-xs`,children:t}),(0,H.jsxs)(G,{variant:`ghost`,size:`sm`,onClick:()=>g(t),"aria-label":`${n(`update-copy`)}: ${t}`,children:[(0,H.jsx)(_e,{className:`size-3.5`}),n(c===t?`update-copied`:`update-copy`)]})]})]},t))}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`update-hosts-note`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d.canInstall?n(`update-install-note`):n(`update-cannot-install`)}),m?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:n(`update-installing`)}):null,_&&!m?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:_}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,H.jsx)(G,{variant:`ghost`,disabled:m,onClick:()=>t(!1),children:n(`update-close`)}),(0,H.jsx)(G,{autoFocus:!0,disabled:m||!d.canInstall,onClick:()=>void h(),children:n(`update-install`)})]})]})})})}var Df=Object.defineProperty,Of=(e,t)=>Df(e,`name`,{value:t,configurable:!0}),kf=`horizontal`,Af=[`horizontal`,`vertical`],jf=v.forwardRef(Of(function(e,t){let{decorative:n,orientation:r=kf,...i}=e,a=Mf(r)?r:kf,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,H.jsx)(Mo.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function Mf(e){return Af.includes(e)}Of(Mf,`isValidOrientation`);var Nf=jf;function Pf({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,H.jsx)(Nf,{"data-slot":`separator`,decorative:n,orientation:t,className:V(`bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function Ff(e){return e===`light`||e===`dark`?e:null}function If(e,t){return e??(t?`dark`:`light`)}var Lf=[{id:`aura-light`,name:`Aura`,variant:`light`,colours:{canvas:`#f6f3fe`,elevated:`#ede9f5`,muted:`#f1eef9`,text:`#474056`,textSecondary:`#605a71`,border:`#00000013`,borderHover:`#0000002e`,accent:`#7557b7`,accentHover:`#6c50a8`,accentActive:`#62499a`,selection:`#dfdce9`,hover:`#0000000a`,active:`#00000014`,focus:`#cdbefe`,error:`#ad0620`,warning:`#8b6113`,success:`#087846`,info:`#356ba6`}},{id:`aura-dark`,name:`Aura`,variant:`dark`,colours:{canvas:`#121117`,elevated:`#1c1b21`,muted:`#0c0b11`,text:`#dbdbdc`,textSecondary:`#88878b`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#a277ff`,accentHover:`#a982ff`,accentActive:`#b18dff`,selection:`#47454bb6`,hover:`#ffffff0f`,active:`#ffffff13`,focus:`#cdbefb`,error:`#ff6767`,warning:`#ffca85`,success:`#61ffca`,info:`#82e2ff`}},{id:`ayu-light`,name:`Ayu`,variant:`light`,colours:{canvas:`#fdfbf5`,elevated:`#f5f4ed`,muted:`#f8f6f1`,text:`#3f4851`,textSecondary:`#5c6570`,border:`#00000013`,borderHover:`#0000002e`,accent:`#1b7793`,accentHover:`#196d87`,accentActive:`#17647b`,selection:`#e8eae3`,hover:`#0000000a`,active:`#00000014`,focus:`#73d8fc`,error:`#c21f38`,warning:`#996219`,success:`#157f3f`,info:`#147794`}},{id:`ayu-dark`,name:`Ayu`,variant:`dark`,colours:{canvas:`#0b1015`,elevated:`#151a1f`,muted:`#06090d`,text:`#d9d9db`,textSecondary:`#81868b`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#3fb7e3`,accentHover:`#4ebde5`,accentActive:`#5ec3e7`,selection:`#3c4147c9`,hover:`#ffffff0f`,active:`#ffffff14`,focus:`#7dd6fc`,error:`#f58572`,warning:`#e4a75c`,success:`#78d05c`,info:`#66c6f1`}},{id:`carbonfox-light`,name:`Carbonfox`,variant:`light`,colours:{canvas:`#eeeeee`,elevated:`#e4e4e4`,muted:`#e9e9e9`,text:`#404040`,textSecondary:`#5a5a5a`,border:`#00000013`,borderHover:`#0000002f`,accent:`#1159e3`,accentHover:`#1052d1`,accentActive:`#0e4bbf`,selection:`#d5d5d5`,hover:`#0000000a`,active:`#00000014`,focus:`#accaff`,error:`#980313`,warning:`#7a6211`,success:`#105223`,info:`#0c42a8`}},{id:`carbonfox-dark`,name:`Carbonfox`,variant:`dark`,colours:{canvas:`#292929`,elevated:`#2f2f2f`,muted:`#252525`,text:`#f7f7f7`,textSecondary:`#999a9c`,border:`#ffffff0b`,borderHover:`#ffffff33`,accent:`#33b1ff`,accentHover:`#43b7ff`,accentActive:`#54bdff`,selection:`#5b5c5b97`,hover:`#ffffff0d`,active:`#ffffff12`,focus:`#adcafa`,error:`#ff8389`,warning:`#f1c21b`,success:`#42be65`,info:`#78a9ff`}},{id:`catppuccin-light`,name:`Catppuccin`,variant:`light`,colours:{canvas:`#eff1f5`,elevated:`#e5e7eb`,muted:`#e9ebef`,text:`#4c4f69`,textSecondary:`#616274`,border:`#66677023`,borderHover:`#66677026`,accent:`#7130c7`,accentHover:`#6e32bf`,accentActive:`#6b35b8`,selection:`#ccd0da`,hover:`#0000000a`,active:`#00000014`,focus:`#8839ef`,error:`#cb0f37`,warning:`#af4508`,success:`#2f7520`,info:`#1850c1`}},{id:`catppuccin-dark`,name:`Catppuccin`,variant:`dark`,colours:{canvas:`#1e1e2e`,elevated:`#181825`,muted:`#181825`,text:`#cdd6f4`,textSecondary:`#a6adc8`,border:`#7f849c19`,borderHover:`#7f849c1d`,accent:`#cba6f7`,accentHover:`#dec7fa`,accentActive:`#dec7fa`,selection:`#313244`,hover:`#cdd6f412`,active:`#cdd6f41f`,focus:`#cba6f7`,error:`#f38ba8`,warning:`#fab387`,success:`#a6e3a1`,info:`#89b4fa`}},{id:`cursor-light`,name:`Cursor`,variant:`light`,author:`cedricverlinden`,colours:{canvas:`#fcfcfc`,elevated:`#f2f2f2`,muted:`#f6f6f6`,text:`#454a50`,textSecondary:`#66696f`,border:`#5058601e`,borderHover:`#50586040`,accent:`#2567a8`,accentHover:`#1d568e`,accentActive:`#194b7c`,selection:`#e1e1e1`,hover:`#0000000a`,active:`#00000014`,focus:`#2567a8b3`,error:`#a3424b`,warning:`#806015`,success:`#467037`,info:`#315d9b`}},{id:`cursor-dark`,name:`Cursor`,variant:`dark`,author:`cedricverlinden`,colours:{canvas:`#1a1a1a`,elevated:`#232323`,muted:`#151515`,text:`#e1e1e2`,textSecondary:`#8e8e8e`,border:`#8484841a`,borderHover:`#8484841f`,accent:`#4c9df3`,accentHover:`#66aefa`,accentActive:`#66aefa`,selection:`#ffffff1d`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#4c9df399`,error:`#c6747b`,warning:`#ebcb8b`,success:`#a3be8c`,info:`#81a1c1`}},{id:`dracula-light`,name:`Dracula`,variant:`light`,colours:{canvas:`#f9f9f4`,elevated:`#eeefe9`,muted:`#f3f4ee`,text:`#45454f`,textSecondary:`#5f5f6a`,border:`#00000013`,borderHover:`#0000002e`,accent:`#6957d7`,accentHover:`#6150c6`,accentActive:`#5849b5`,selection:`#dee1db`,hover:`#0000000a`,active:`#00000014`,focus:`#c2c2fd`,error:`#ad1446`,warning:`#9e5a04`,success:`#167a46`,info:`#366da9`}},{id:`dracula-dark`,name:`Dracula`,variant:`dark`,colours:{canvas:`#151720`,elevated:`#1c2029`,muted:`#12121b`,text:`#e0e0e2`,textSecondary:`#8a8b8a`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#bd93f9`,accentHover:`#c29cf9`,accentActive:`#c8a4fa`,selection:`#4650559f`,hover:`#ffffff0e`,active:`#ffffff13`,focus:`#d3bcfa`,error:`#ff5555`,warning:`#ffb86c`,success:`#50fa7b`,info:`#8be9fd`}},{id:`everforest-light`,name:`Everforest`,variant:`light`,colours:{canvas:`#fdf8e8`,elevated:`#f5f2e2`,muted:`#f7f3e4`,text:`#3b474e`,textSecondary:`#656b62`,border:`#00000013`,borderHover:`#0000002e`,accent:`#65740b`,accentHover:`#5d6b0a`,accentActive:`#556109`,selection:`#e9e8d5`,hover:`#0000000a`,active:`#00000014`,focus:`#bfd747`,error:`#c4222a`,warning:`#ad5410`,success:`#66731b`,info:`#366eaa`}},{id:`everforest-dark`,name:`Everforest`,variant:`dark`,colours:{canvas:`#1c252b`,elevated:`#222c32`,muted:`#1a2127`,text:`#f0efed`,textSecondary:`#8f978e`,border:`#ffffff0b`,borderHover:`#ffffff33`,accent:`#a7c080`,accentHover:`#aec58a`,accentActive:`#b5ca94`,selection:`#3e5151c5`,hover:`#ffffff0d`,active:`#ffffff12`,focus:`#bad492`,error:`#e67e80`,warning:`#e69875`,success:`#a7c080`,info:`#83afe0`}},{id:`fields-of-the-shire-light`,name:`Fields of the Shire`,variant:`light`,author:`OpenChamber`,colours:{canvas:`#f9f5eb`,elevated:`#efebe2`,muted:`#f3efe5`,text:`#514a40`,textSecondary:`#6c6459`,border:`#1a161215`,borderHover:`#1a161230`,accent:`#4a6030`,accentHover:`#5e773f`,accentActive:`#708a50`,selection:`#1a16121a`,hover:`#0000000a`,active:`#00000014`,focus:`#4a603040`,error:`#a24d3f`,warning:`#8c5520`,success:`#4a6030`,info:`#3d4f5a`}},{id:`fields-of-the-shire-dark`,name:`Fields of the Shire`,variant:`dark`,author:`OpenChamber`,colours:{canvas:`#1b1815`,elevated:`#24211e`,muted:`#161311`,text:`#e9decf`,textSecondary:`#948b7c`,border:`#2e2b28d4`,borderHover:`#f0e6d830`,accent:`#809062`,accentHover:`#8a996f`,accentActive:`#94a27b`,selection:`#f0e6d81f`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#8090624d`,error:`#c47466`,warning:`#c47a3a`,success:`#7f905e`,info:`#798d99`}},{id:`flexoki-light`,name:`Flexoki`,variant:`light`,colours:{canvas:`#fffdf4`,elevated:`#f5f3ea`,muted:`#f9f7ee`,text:`#494741`,textSecondary:`#6a6962`,border:`#e6e4db`,borderHover:`#cecdc3`,accent:`#b54f14`,accentHover:`#a74912`,accentActive:`#984211`,selection:`#76736f30`,hover:`#0000000a`,active:`#00000014`,focus:`#b54f1440`,error:`#af3029`,warning:`#b54f14`,success:`#5e760a`,info:`#205ea6`}},{id:`flexoki-dark`,name:`Flexoki`,variant:`dark`,colours:{canvas:`#171515`,elevated:`#201e1e`,muted:`#121111`,text:`#dedcd3`,textSecondary:`#8b8a83`,border:`#2b2a28d4`,borderHover:`#403e3c`,accent:`#da702c`,accentHover:`#da702c`,accentActive:`#f9ae77`,selection:`#f4f4f41f`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#da702c50`,error:`#d76459`,warning:`#da702c`,success:`#a0af54`,info:`#4d8cc1`}},{id:`github-light`,name:`GitHub`,variant:`light`,colours:{canvas:`#ffffff`,elevated:`#f5f5f4`,muted:`#fafaf9`,text:`#464a4e`,textSecondary:`#5c646e`,border:`#00000013`,borderHover:`#0000002e`,accent:`#0f69d8`,accentHover:`#0e61c7`,accentActive:`#0d58b5`,selection:`#e7e7e6`,hover:`#0000000a`,active:`#00000014`,focus:`#a9cbfd`,error:`#8f0617`,warning:`#664407`,success:`#105122`,info:`#09448f`}},{id:`github-dark`,name:`GitHub`,variant:`dark`,colours:{canvas:`#0a0e14`,elevated:`#13171e`,muted:`#05070c`,text:`#d7d8da`,textSecondary:`#7d848e`,border:`#ffffff0d`,borderHover:`#ffffff33`,accent:`#58a6ff`,accentHover:`#65adff`,accentActive:`#73b4ff`,selection:`#373d44d8`,hover:`#ffffff0f`,active:`#ffffff15`,focus:`#a3cdfe`,error:`#f85149`,warning:`#e3b341`,success:`#3fb950`,info:`#83afe0`}},{id:`gruvbox-light`,name:`Gruvbox`,variant:`light`,colours:{canvas:`#fcf5d7`,elevated:`#f4eccf`,muted:`#f8f0d3`,text:`#47433c`,textSecondary:`#615d58`,border:`#00000013`,borderHover:`#0000002e`,accent:`#12697a`,accentHover:`#116170`,accentActive:`#0f5866`,selection:`#e8dfc5`,hover:`#0000000a`,active:`#00000014`,focus:`#83d8ed`,error:`#650304`,warning:`#805104`,success:`#4f4c0c`,info:`#013d48`}},{id:`gruvbox-dark`,name:`Gruvbox`,variant:`dark`,colours:{canvas:`#1f1e1d`,elevated:`#272623`,muted:`#1a1a1a`,text:`#e9e8e4`,textSecondary:`#9b9074`,border:`#ffffff0b`,borderHover:`#ffffff33`,accent:`#83a598`,accentHover:`#8daca0`,accentActive:`#97b3a8`,selection:`#514d43b4`,hover:`#ffffff0e`,active:`#ffffff12`,focus:`#aed2c4`,error:`#fb533f`,warning:`#fabd2f`,success:`#b8bb26`,info:`#83afe0`}},{id:`jetbrains-light`,name:`JetBrains`,variant:`light`,author:`Artem Evsevev, adapted for OpenChamber`,colours:{canvas:`#fff`,elevated:`#f5f5f5`,muted:`#f9f9f9`,text:`#45474b`,textSecondary:`#696a6f`,border:`#dde0eadc`,borderHover:`#aeb3c2ad`,accent:`#195ce3`,accentHover:`#2d61f0`,accentActive:`#0055ff`,selection:`#dfe1e5`,hover:`#0000000a`,active:`#00000014`,focus:`#0055ff40`,error:`#ce0606`,warning:`#9d620a`,success:`#077d18`,info:`#29769f`}},{id:`jetbrains-dark`,name:`JetBrains`,variant:`dark`,author:`Artem Evsevev, adapted for OpenChamber`,colours:{canvas:`#1e1f22`,elevated:`#27282b`,muted:`#18191b`,text:`#e5e7eb`,textSecondary:`#90939a`,border:`#303238b8`,borderHover:`#4b5059`,accent:`#6796f5`,accentHover:`#70aeff`,accentActive:`#5594fa`,selection:`#43454a`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#6796f550`,error:`#fa6675`,warning:`#f2c55c`,success:`#639d69`,info:`#4199c8`}},{id:`kanagawa-light`,name:`Kanagawa`,variant:`light`,colours:{canvas:`#f4ede3`,elevated:`#ede5db`,muted:`#efe8df`,text:`#4c3d33`,textSecondary:`#64635e`,border:`#00000013`,borderHover:`#0000002f`,accent:`#326384`,accentHover:`#2e5b79`,accentActive:`#2a536f`,selection:`#e2dad0`,hover:`#0000000a`,active:`#00000014`,focus:`#a6cfed`,error:`#a40d11`,warning:`#8e4e14`,success:`#456114`,info:`#073652`}},{id:`kanagawa-dark`,name:`Kanagawa`,variant:`dark`,colours:{canvas:`#17161e`,elevated:`#221e28`,muted:`#111119`,text:`#e0dfde`,textSecondary:`#8a8a83`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#7e9cd8`,accentHover:`#88a4db`,accentActive:`#93acde`,selection:`#4f414ac7`,hover:`#ffffff0e`,active:`#ffffff13`,focus:`#afc9fd`,error:`#ed5252`,warning:`#d7a657`,success:`#98bb6c`,info:`#83afe0`}},{id:`material-light`,name:`Material`,variant:`light`,colours:{canvas:`#fafafa`,elevated:`#f1f1f0`,muted:`#f5f5f5`,text:`#3e484c`,textSecondary:`#5f6c72`,border:`#00000013`,borderHover:`#0000002e`,accent:`#19787f`,accentHover:`#176e75`,accentActive:`#15656b`,selection:`#e3e3e2`,hover:`#0000000a`,active:`#00000014`,focus:`#65dee7`,error:`#aa0d15`,warning:`#8f6510`,success:`#537702`,info:`#12787f`}},{id:`material-dark`,name:`Material`,variant:`dark`,colours:{canvas:`#1a252a`,elevated:`#212c31`,muted:`#162126`,text:`#edeff0`,textSecondary:`#85989f`,border:`#ffffff0b`,borderHover:`#ffffff33`,accent:`#82aaff`,accentHover:`#8cb1ff`,accentActive:`#96b8ff`,selection:`#4e5b6094`,hover:`#ffffff0d`,active:`#ffffff12`,focus:`#80d6f9`,error:`#f07178`,warning:`#ffcb6b`,success:`#c3e88d`,info:`#83afe0`}},{id:`mono-light`,name:`Mono`,variant:`light`,colours:{canvas:`#ffffff`,elevated:`#f5f5f5`,muted:`#f9f9f9`,text:`#454545`,textSecondary:`#656565`,border:`#e3e3e3f2`,borderHover:`#b3b3b3ac`,accent:`#000000`,accentHover:`#1a1a1a`,accentActive:`#333333`,selection:`#00000015`,hover:`#0000000a`,active:`#00000014`,focus:`#00000040`,error:`#999999`,warning:`#666666`,success:`#1a1a1a`,info:`#595959`}},{id:`mono-dark`,name:`Mono`,variant:`dark`,colours:{canvas:`#000000`,elevated:`#141414`,muted:`#0a0a0a`,text:`#d0d0d0`,textSecondary:`#828282`,border:`#232323c6`,borderHover:`#333333`,accent:`#ffffff`,accentHover:`#e5e5e5`,accentActive:`#cccccc`,selection:`#ffffff1f`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#ffffff50`,error:`#666666`,warning:`#999999`,success:`#e5e5e5`,info:`#a6a6a6`}},{id:`mono-plus-light`,name:`Mono Plus`,variant:`light`,colours:{canvas:`#ffffff`,elevated:`#f5f5f5`,muted:`#f9f9f9`,text:`#454545`,textSecondary:`#6a6a6a`,border:`#e3e3e3f2`,borderHover:`#b3b3b3ac`,accent:`#4a6a9e`,accentHover:`#1a1a1a`,accentActive:`#333333`,selection:`#00000015`,hover:`#0000000a`,active:`#00000014`,focus:`#00000040`,error:`#8a5a5a`,warning:`#7c6d51`,success:`#577757`,info:`#5a6a8a`}},{id:`mono-plus-dark`,name:`Mono Plus`,variant:`dark`,colours:{canvas:`#000000`,elevated:`#141414`,muted:`#0a0a0a`,text:`#cecece`,textSecondary:`#828282`,border:`#232323c6`,borderHover:`#333333`,accent:`#a2bee8`,accentHover:`#e5e5e5`,accentActive:`#cccccc`,selection:`#ffffff1f`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#ffffff50`,error:`#a47373`,warning:`#9e8a6a`,success:`#6a8e6a`,info:`#6d80a0`}},{id:`monokai-light`,name:`Monokai`,variant:`light`,colours:{canvas:`#fdf9ef`,elevated:`#f3efe5`,muted:`#f8f4ea`,text:`#4b463c`,textSecondary:`#656056`,border:`#00000013`,borderHover:`#0000002e`,accent:`#8556b0`,accentHover:`#7a4fa2`,accentActive:`#704894`,selection:`#e5e0d6`,hover:`#0000000a`,active:`#00000014`,focus:`#d9b9fd`,error:`#b21523`,warning:`#936115`,success:`#1b7c1b`,info:`#366eaa`}},{id:`monokai-dark`,name:`Monokai`,variant:`dark`,colours:{canvas:`#1d1e19`,elevated:`#252620`,muted:`#191a15`,text:`#e7e7e7`,textSecondary:`#90918b`,border:`#ffffff0b`,borderHover:`#ffffff33`,accent:`#ae81ff`,accentHover:`#b48bff`,accentActive:`#bb95ff`,selection:`#53544e9a`,hover:`#ffffff0e`,active:`#ffffff12`,focus:`#d0bdfc`,error:`#fa4888`,warning:`#fd971f`,success:`#a6e22e`,info:`#66d9ef`}},{id:`nightowl-light`,name:`Night Owl`,variant:`light`,colours:{canvas:`#f1f1f1`,elevated:`#e9e9e8`,muted:`#ececeb`,text:`#41404f`,textSecondary:`#5a5a6b`,border:`#00000013`,borderHover:`#0000002f`,accent:`#2c60d4`,accentHover:`#2858c3`,accentActive:`#2551b2`,selection:`#dfdddb`,hover:`#0000000a`,active:`#00000014`,focus:`#aec9fe`,error:`#a4151c`,warning:`#856215`,success:`#327443`,info:`#0941c4`}},{id:`nightowl-dark`,name:`Night Owl`,variant:`dark`,colours:{canvas:`#04101c`,elevated:`#0d1a26`,muted:`#010a12`,text:`#d7d9dc`,textSecondary:`#7e8692`,border:`#ffffff0d`,borderHover:`#ffffff33`,accent:`#82aaff`,accentHover:`#8cb1ff`,accentActive:`#96b8ff`,selection:`#36424fc6`,hover:`#ffffff0f`,active:`#ffffff14`,focus:`#afc9fd`,error:`#ef5350`,warning:`#ecc48d`,success:`#c5e478`,info:`#82aaff`}},{id:`nord-light`,name:`Nord`,variant:`light`,colours:{canvas:`#eef1f5`,elevated:`#e5e8ed`,muted:`#e9ecf1`,text:`#3c424c`,textSecondary:`#565c67`,border:`#00000013`,borderHover:`#0000002f`,accent:`#426999`,accentHover:`#3d618d`,accentActive:`#375881`,selection:`#d8dce1`,hover:`#0000000a`,active:`#00000014`,focus:`#a4ccfe`,error:`#a0203b`,warning:`#a54d31`,success:`#327443`,info:`#29588f`}},{id:`nord-dark`,name:`Nord`,variant:`dark`,colours:{canvas:`#1f2530`,elevated:`#262c37`,muted:`#1c212c`,text:`#f0f1f2`,textSecondary:`#93979f`,border:`#ffffff0b`,borderHover:`#ffffff33`,accent:`#88c0d0`,accentHover:`#92c5d4`,accentActive:`#9bcad8`,selection:`#505661a3`,hover:`#ffffff0d`,active:`#ffffff12`,focus:`#9ad4e4`,error:`#cb7f86`,warning:`#d08770`,success:`#a3be8c`,info:`#81a1c1`}},{id:`onedarkpro-light`,name:`One Dark Pro`,variant:`light`,colours:{canvas:`#f5f6f8`,elevated:`#ebecee`,muted:`#eff0f2`,text:`#454c58`,textSecondary:`#616770`,border:`#d5d8dedb`,borderHover:`#d4d9e3`,accent:`#3c67bc`,accentHover:`#375fad`,accentActive:`#32579e`,selection:`#d8dde6`,hover:`#0000000a`,active:`#00000014`,focus:`#3c67bc40`,error:`#a54f56`,warning:`#866241`,success:`#38754d`,info:`#336da3`}},{id:`onedarkpro-dark`,name:`One Dark Pro`,variant:`dark`,colours:{canvas:`#1e222a`,elevated:`#272b33`,muted:`#181b22`,text:`#e4ebf8`,textSecondary:`#8d97a2`,border:`#3138489b`,borderHover:`#363d52`,accent:`#61afef`,accentHover:`#579ad1`,accentActive:`#77baf1`,selection:`#a8aec533`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#61afef40`,error:`#e17179`,warning:`#e5c07b`,success:`#98c379`,info:`#61afef`}},{id:`openchamber-light`,name:`OpenChamber`,variant:`light`,author:`OpenChamber`,colours:{canvas:`#fdfcfa`,elevated:`#f3f2f0`,muted:`#f7f6f4`,text:`#44443d`,textSecondary:`#696960`,border:`#e5e1debf`,borderHover:`#cbc7c2`,accent:`#b35017`,accentHover:`#9a4310`,accentActive:`#85390c`,selection:`#a9998f2b`,hover:`#0000000a`,active:`#00000014`,focus:`#b3501755`,error:`#b7493f`,warning:`#886914`,success:`#517734`,info:`#2c6ebd`}},{id:`openchamber-dark`,name:`OpenChamber`,variant:`dark`,author:`OpenChamber`,colours:{canvas:`#120f0e`,elevated:`#1b1918`,muted:`#0e0c0b`,text:`#dbd7cc`,textSecondary:`#89867c`,border:`#242323bf`,borderHover:`#504e4c`,accent:`#da7c47`,accentHover:`#eb8c57`,accentActive:`#fd9b66`,selection:`#c8c6c52b`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#da7c4755`,error:`#da5b4a`,warning:`#c67f13`,success:`#76ad4f`,info:`#479fe6`}},{id:`opencode-light`,name:`OpenCode`,variant:`light`,author:`OpenCode`,colours:{canvas:`#ffffff`,elevated:`#fafafa`,muted:`#fafafa`,text:`#4a4a4a`,textSecondary:`#646464`,border:`#00000013`,borderHover:`#0000002e`,accent:`#3b5cf6ff`,accentHover:`#3655e2`,accentActive:`#324dcf`,selection:`#eeeeeeff`,hover:`#0000000a`,active:`#00000014`,focus:`#7698fdff`,error:`#b82d35ff`,warning:`#8c6e24`,success:`#18833f`,info:`#3250dfff`}},{id:`opencode-dark`,name:`OpenCode`,variant:`dark`,author:`OpenCode`,colours:{canvas:`#161616`,elevated:`#1f1f1f`,muted:`#0a0a0a`,text:`#dfdfdf`,textSecondary:`#8a8a8a`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#637ef8`,accentHover:`#6f88f9`,accentActive:`#7c93f9`,selection:`#3a3a3af6`,hover:`#ffffff0e`,active:`#ffffff13`,focus:`#7698fdff`,error:`#f17471ff`,warning:`#f2cf76ff`,success:`#6bd586ff`,info:`#7698fdff`}},{id:`osaka-jade-refined-light`,name:`Osaka Jade`,variant:`light`,author:`tbcode-org`,colours:{canvas:`#f1eee8`,elevated:`#e7e4de`,muted:`#ebe9e3`,text:`#40463e`,textSecondary:`#53685b`,border:`#00000013`,borderHover:`#0000002e`,accent:`#197160`,accentHover:`#176858`,accentActive:`#155f51`,selection:`#d8d5d0`,hover:`#0000000a`,active:`#00000014`,focus:`#5ce4c6`,error:`#8f110b`,warning:`#73650e`,success:`#02532a`,info:`#33679f`}},{id:`osaka-jade-refined`,name:`Osaka Jade`,variant:`dark`,author:`tbcode-org`,colours:{canvas:`#0a1611`,elevated:`#121f18`,muted:`#07100c`,text:`#d9dbd6`,textSecondary:`#7b8c81`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#2dd5b7`,accentHover:`#3ed8bd`,accentActive:`#4fdcc3`,selection:`#324235e1`,hover:`#ffffff0f`,active:`#ffffff14`,focus:`#90d9d1`,error:`#ff5345`,warning:`#e7c831`,success:`#63b07a`,info:`#82aecb`}},{id:`rosepine-light`,name:`Rose Pine`,variant:`light`,colours:{canvas:`#fbf5ef`,elevated:`#f5ede7`,muted:`#f7f0eb`,text:`#464061`,textSecondary:`#6a6673`,border:`#00000013`,borderHover:`#0000002e`,accent:`#177394`,accentHover:`#156a88`,accentActive:`#13617c`,selection:`#ece2db`,hover:`#0000000a`,active:`#00000014`,focus:`#8cd4f4`,error:`#942a50`,warning:`#965f0b`,success:`#347846`,info:`#0c4b62`}},{id:`rosepine-dark`,name:`Rose Pine`,variant:`dark`,colours:{canvas:`#12101d`,elevated:`#1c1a28`,muted:`#0c0b15`,text:`#dbdade`,textSecondary:`#87849b`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#9ccfd8`,accentHover:`#a4d3db`,accentActive:`#acd7de`,selection:`#444252c0`,hover:`#ffffff0f`,active:`#ffffff14`,focus:`#9fd3dd`,error:`#eb6f92`,warning:`#f6c177`,success:`#80b888`,info:`#9ccfd8`}},{id:`solarized-light`,name:`Solarized`,variant:`light`,colours:{canvas:`#fdf8e8`,elevated:`#f5f2e2`,muted:`#f7f3e4`,text:`#33494f`,textSecondary:`#596c73`,border:`#00000013`,borderHover:`#0000002e`,accent:`#0a72b1`,accentHover:`#0969a3`,accentActive:`#086095`,selection:`#e6e8da`,hover:`#0000000a`,active:`#00000014`,focus:`#98d0ff`,error:`#9b1a1a`,warning:`#806318`,success:`#5f6c17`,info:`#136196`}},{id:`solarized-dark`,name:`Solarized`,variant:`dark`,colours:{canvas:`#041d24`,elevated:`#0c242b`,muted:`#021820`,text:`#e0e4e5`,textSecondary:`#818e8f`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#7e83cb`,accentHover:`#888dcf`,accentActive:`#9397d3`,selection:`#293f44`,hover:`#ffffff0e`,active:`#ffffff13`,focus:`#bec4fa`,error:`#e35e5b`,warning:`#b58900`,success:`#859900`,info:`#2aa198`}},{id:`tokyonight-light`,name:`Tokyonight`,variant:`light`,colours:{canvas:`#e5e6ea`,elevated:`#dcdee3`,muted:`#e0e2e6`,text:`#343a56`,textSecondary:`#4b5472`,border:`#00000013`,borderHover:`#0000002f`,accent:`#195fba`,accentHover:`#1757ab`,accentActive:`#15509c`,selection:`#d0d2da`,hover:`#0000000a`,active:`#00000014`,focus:`#abcbfa`,error:`#97073a`,warning:`#65440a`,success:`#314e04`,info:`#0a54ae`}},{id:`tokyonight-dark`,name:`Tokyonight`,variant:`dark`,colours:{canvas:`#13141e`,elevated:`#1b1d28`,muted:`#0f0f18`,text:`#dcdde3`,textSecondary:`#8187a8`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#7aa2f7`,accentHover:`#85a9f8`,accentActive:`#8fb1f8`,selection:`#3d4053d5`,hover:`#ffffff0f`,active:`#ffffff13`,focus:`#afc9fe`,error:`#f7768e`,warning:`#e0af68`,success:`#9ece6a`,info:`#7dcfff`}},{id:`vercel-light`,name:`Vercel`,variant:`light`,colours:{canvas:`#ffffff`,elevated:`#f4f4f4`,muted:`#f9f9f9`,text:`#4a4a4a`,textSecondary:`#666666`,border:`#00000013`,borderHover:`#0000002e`,accent:`#0769e1`,accentHover:`#0661cf`,accentActive:`#0658bd`,selection:`#e4e4e4`,hover:`#0000000a`,active:`#00000014`,focus:`#a9cbfd`,error:`#a10725`,warning:`#a35d02`,success:`#14621b`,info:`#0a4ca2`}},{id:`vercel-dark`,name:`Vercel`,variant:`dark`,colours:{canvas:`#000000`,elevated:`#070707`,muted:`#000000`,text:`#cfcfcf`,textSecondary:`#7b7b7b`,border:`#ffffff12`,borderHover:`#ffffff33`,accent:`#0674f3`,accentHover:`#1a7ff4`,accentActive:`#2e8af5`,selection:`#2c2c2c`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#a1cdfe`,error:`#e5484d`,warning:`#ffb224`,success:`#46a758`,info:`#52a8ff`}},{id:`vesper-light`,name:`Vesper`,variant:`light`,colours:{canvas:`#f1f1f1`,elevated:`#e7e7e7`,muted:`#ebebeb`,text:`#424242`,textSecondary:`#5c5c5c`,border:`#00000013`,borderHover:`#0000002f`,accent:`#8a5c35`,accentHover:`#7f5531`,accentActive:`#744d2d`,selection:`#d7d7d7`,hover:`#0000000a`,active:`#00000014`,focus:`#f6bb8a`,error:`#c91b35`,warning:`#955817`,success:`#327343`,info:`#3469a2`}},{id:`vesper-dark`,name:`Vesper`,variant:`dark`,colours:{canvas:`#0f0f0f`,elevated:`#191919`,muted:`#080808`,text:`#d9d9d9`,textSecondary:`#858585`,border:`#ffffff0c`,borderHover:`#ffffff33`,accent:`#ffc799`,accentHover:`#ffcba1`,accentActive:`#ffd0a9`,selection:`#484848a8`,hover:`#ffffff0f`,active:`#ffffff14`,focus:`#f4bc8d`,error:`#ff8080`,warning:`#ffc799`,success:`#80b888`,info:`#83afe0`}},{id:`vitesse-light-light`,name:`Vitesse`,variant:`light`,colours:{canvas:`#ffffff`,elevated:`#f5f5f5`,muted:`#f9f9f9`,text:`#484843`,textSecondary:`#6b6b64`,border:`#e6e2e2f1`,borderHover:`#cbc7c7f5`,accent:`#1c6b48`,accentHover:`#1c6b48`,accentActive:`#228056`,selection:`#22222218`,hover:`#0000000a`,active:`#00000014`,focus:`#00000050`,error:`#a85757`,warning:`#a45d2b`,success:`#1e754f`,info:`#296aa3`}},{id:`vitesse-dark-dark`,name:`Vitesse`,variant:`dark`,colours:{canvas:`#121212`,elevated:`#1b1b1b`,muted:`#0e0e0e`,text:`#ddd9cd`,textSecondary:`#878781`,border:`#292929cd`,borderHover:`#3c3c3c`,accent:`#4d9375`,accentHover:`#4d9375`,accentActive:`#5cb08c`,selection:`#eeeeee18`,hover:`#ffffff0f`,active:`#ffffff1a`,focus:`#00000050`,error:`#cb7676`,warning:`#d4976c`,success:`#4d9375`,info:`#6394bf`}}],Rf=`omms-light`,zf=`omms-dark`,Bf=[{id:Rf,name:`OMMS`,variant:`light`,colours:{canvas:`#fdfcfa`,elevated:`#f8f7f5`,muted:`#f7f6f4`,text:`#393a34`,textSecondary:`#5c5c54`,border:`#e5e1de`,borderHover:`#cbc7c2`,accent:`#b35017`,accentHover:`#9a4310`,accentActive:`#85390c`,selection:`#a9998f2b`,hover:`#0000000d`,active:`#00000014`,focus:`#b35017`,error:`#b7493f`,warning:`#8d6c15`,success:`#5f8d3d`,info:`#2d72c4`}},{id:zf,name:`OMMS`,variant:`dark`,colours:{canvas:`#120f0e`,elevated:`#181715`,muted:`#171615`,text:`#c9c5ba`,textSecondary:`#8f8b81`,border:`#242323`,borderHover:`#504e4c`,accent:`#da7c47`,accentHover:`#eb8c57`,accentActive:`#fd9b66`,selection:`#c8c6c52b`,hover:`#ffffff12`,active:`#ffffff1f`,focus:`#da7c47`,error:`#da5b4a`,warning:`#c67f13`,success:`#76ad4f`,info:`#479fe6`}},...Lf];function Vf(e){return Bf.filter(t=>t.variant===e)}function Hf(e,t){let n=t===`light`?Rf:zf;return Bf.find(n=>n.id===e&&n.variant===t)??Bf.find(e=>e.id===n)}function Uf(e){return e.id===`omms-light`||e.id===`omms-dark`}var Wf=e=>`color-mix(in srgb, var(${e}) 75%, var(--foreground))`;function Gf(e,t){let n=t===`light`?`#ffffff`:e.canvas;return{"--background":e.canvas,"--foreground":e.text,"--card":e.elevated,"--card-foreground":e.text,"--popover":e.elevated,"--popover-foreground":e.text,"--primary":e.accent,"--primary-foreground":n,"--primary-hover":e.accentHover,"--primary-active":e.accentActive,"--primary-label":`color-mix(in srgb, var(--primary) 70%, var(--foreground))`,"--secondary":e.muted,"--secondary-foreground":e.text,"--muted":e.muted,"--muted-foreground":e.textSecondary,"--accent":e.selection,"--accent-foreground":e.text,"--selection":e.selection,"--interactive-hover":e.hover,"--interactive-active":e.active,"--destructive":e.error,"--destructive-label":Wf(`--destructive`),"--border":e.border,"--border-hover":e.borderHover,"--input":`color-mix(in srgb, var(--muted-foreground) 75%, var(--background))`,"--ring":e.accent,"--status-warning":e.warning,"--status-warning-label":Wf(`--status-warning`),"--status-success":e.success,"--status-success-label":Wf(`--status-success`),"--status-info":e.info,"--status-info-label":Wf(`--status-info`),"--chart-1":e.accent,"--chart-2":e.success,"--chart-3":e.info,"--chart-4":e.warning,"--chart-5":e.error,"--sidebar":e.muted,"--sidebar-foreground":e.text,"--sidebar-primary":e.accent,"--sidebar-primary-foreground":n,"--sidebar-accent":e.selection,"--sidebar-accent-foreground":e.text,"--sidebar-border":e.border,"--sidebar-ring":e.accent}}function Kf(e,t){return`${e} {\n${Object.entries(t).map(([e,t])=>` ${e}: ${t};`).join(`
56
56
  `)}\n}`}function qf(e,t){let n=Hf(e,`light`),r=Hf(t,`dark`),i=[];return Uf(n)||i.push(Kf(`:root:not(.dark)`,Gf(n.colours,`light`))),Uf(r)||i.push(Kf(`:root.dark`,Gf(r.colours,`dark`))),i.join(`
57
- `)}var Jf=`omms-theme`,Yf=`opencode-mem-theme`,Xf=`omms-theme-light`,Zf=`omms-theme-dark`,Qf=`omms-theme`,$f=`(prefers-color-scheme: dark)`;function ep(){return typeof window>`u`?null:Ff(ui(Jf,Yf))}function tp(){return typeof window>`u`||!window.matchMedia||window.matchMedia($f).matches}function np(){return If(ep(),tp())}function rp(){let e=(e,t)=>typeof window>`u`?t:ui(e,e)??t;return{mode:ep()??`system`,light:Hf(e(Xf,Rf),`light`).id,dark:Hf(e(Zf,zf),`dark`).id}}var ip=np(),ap=rp(),op=!1,sp=new Set;function cp(){for(let e of sp)e()}function lp(e,t=!1){ip=e,typeof document<`u`&&(document.documentElement.classList.toggle(`dark`,e===`dark`),up(document,e),t&&(op=!0,fi(Jf,e),ap={...ap,mode:e})),cp()}function up(e,t){let n=qf(ap.light,ap.dark),r=e.getElementById(Qf);n===``?r?.remove():(r||(r=e.createElement(`style`),r.id=Qf,e.head.append(r)),r.textContent=n),Vi(e,t,(t===`dark`?Hf(ap.dark,`dark`):Hf(ap.light,`light`)).colours.canvas)}function dp(e){return sp.add(e),()=>{sp.delete(e)}}function fp(){return ip}function pp(){return`dark`}function mp(e){lp(e,!0)}function hp(){let e=ip===`dark`?`light`:`dark`;return mp(e),e}function gp(){lp(np())}function _p(){return(0,v.useSyncExternalStore)(dp,fp,pp)}var vp=()=>ap;function yp(){return(0,v.useSyncExternalStore)(dp,vp,vp)}function bp(e){if(e!==`system`)return mp(e);op=!1,di(Jf),di(Yf),ap={...ap,mode:`system`},lp(np())}function xp(e,t){let n=Hf(t,e).id;fi(e===`light`?Xf:Zf,n),ap={...ap,[e]:n},lp(ip)}typeof document<`u`&&(lp(ip),window.matchMedia?.($f).addEventListener?.(`change`,()=>{!op&&ep()===null&&lp(np())}));var Sp=[{code:`en`,label:`English (EN)`},{code:`zh`,label:`中文 (ZH)`},{code:`ar`,label:`العربية (AR)`}],Cp=`omms-sidebar-collapsed`,wp=`omms-sidebar-settings-open`,Tp=`omms-sidebar-memory-open`,Ep=`omms-sidebar-profile-open`,Dp=`omms-sidebar-skills-open`,Op=`inline-flex min-h-11 min-w-11 md:min-h-8 md:min-w-7 items-center justify-center text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`;function kp(){try{let e=localStorage.getItem(wp);return e===null?null:e===`1`}catch{return null}}function Ap(){try{return localStorage.getItem(Cp)===`1`}catch{return!1}}function jp({open:e=!1,currentView:t,brand:n,projectLabel:r,profileLabel:i,chatLabel:a,skillsLabel:o=`Skills`,profileSections:s,skillsSections:c=[],settingsSections:l=[],memoryLabel:u=`Memory`,memorySections:d=[],memoryWarningLabel:f=``,memoryViewId:p=null,langLabel:m,languageLabel:h,themeLabel:g,settingsLabel:_,closeLabel:y,collapseLabel:b,expandLabel:x,onOpenChange:S,onLanguageSelect:C}){let w=_p()===`dark`,[T,E]=(0,v.useState)(!1),[D,O]=(0,v.useState)(!1),k=(0,v.useRef)(null),A=(0,v.useRef)(null),[j,M]=(0,v.useState)(Ap),N=e=>j?e:``,[P,ee]=(0,v.useState)(()=>kp()??t===`settings`),[F,I]=(0,v.useState)(()=>{try{let e=localStorage.getItem(Tp);return e===null?t===`memory`:e===`1`}catch{return t===`memory`}}),[te,L]=gd(Ep,t===`profile`),[ne,R]=gd(Dp,t===`skills`);function ie(){let e=!F;I(e);try{localStorage.setItem(Tp,e?`1`:`0`)}catch{}}function ae(){let e=!P;ee(e);try{localStorage.setItem(wp,e?`1`:`0`)}catch{}}function oe(){let e=!j;M(e);try{localStorage.setItem(Cp,e?`1`:`0`)}catch{}}(0,v.useEffect)(()=>{if(!T)return;k.current?.querySelector(`[aria-checked=true]`)?.focus();function e(e){k.current?.contains(e.target)||E(!1)}return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[T]);function se(e){if(e.key===`Escape`&&(e.preventDefault(),E(!1),A.current?.focus()),![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Array.from(k.current?.querySelectorAll(`[role=menuitemradio]`)??[]),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()}function le(e){S?.(e)}function ue(e,t){e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),gf(t),le(!1))}function de(e,t,n=`profile`){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),gf(n===`memory`?`${J.memory}/${t}`:`${J[n]}#${t}`),le(!1))}function fe(e){return V(`flex w-full min-w-0 min-h-11 md:min-h-9 items-center gap-2 rounded-[10px] px-3 py-2 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,N(`md:justify-center md:px-0`),e?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-sidebar-foreground hover:bg-interactive-hover active:bg-interactive-active`)}return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 bg-black/50 md:hidden`,"aria-label":y,onClick:()=>le(!1)}):null,(0,H.jsxs)(`aside`,{className:V(`inset-y-0 start-0 z-50 flex h-svh w-64 shrink-0 flex-col border-e border-sidebar-border bg-sidebar text-sidebar-foreground transition-[transform,width] duration-200`,N(`md:w-14`),`fixed md:sticky md:top-0 md:translate-x-0!`,e?`translate-x-0`:`max-md:-translate-x-full max-md:rtl:translate-x-full`),children:[(0,H.jsxs)(`div`,{className:V(`flex items-center gap-2 px-4 py-4`,N(`md:flex-col md:px-2`)),children:[(0,H.jsxs)(`a`,{href:J.home,className:`flex min-w-0 flex-1 items-center gap-2 rounded-lg transition-colors hover:opacity-90`,onClick:e=>ue(e,J.home),children:[(0,H.jsx)(`img`,{src:`/omms-icon.svg`,alt:``,width:20,height:20,className:`size-5 shrink-0 rounded-sm`}),(0,H.jsx)(Gd,{brand:n,className:N(`md:hidden`)})]}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-sm`,className:`hidden shrink-0 text-muted-foreground hover:text-primary md:inline-flex`,onClick:oe,"aria-label":j?x:b,"aria-expanded":!j,title:j?x:b,children:j?(0,H.jsx)(lt,{className:`size-4 rtl:-scale-x-100`}):(0,H.jsx)(ct,{className:`size-4 rtl:-scale-x-100`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-sm`,className:`md:hidden min-h-11 min-w-11 shrink-0`,onClick:()=>le(!1),"aria-label":y,children:(0,H.jsx)(Kt,{className:`size-4`})})]}),(0,H.jsx)(Pf,{className:`bg-sidebar-border`}),(0,H.jsxs)(`nav`,{className:V(`flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-3`,N(`md:px-2`)),"aria-label":`Main`,children:[xf({currentView:t,labels:{project:r,chat:a,profile:i,skills:o},collapsed:j,navClass:fe,onNavigate:ue,profileTree:{sections:s,open:te,onToggle:L,hideWhenCollapsed:N(`md:hidden`),onSectionClick:de},skillsTree:{sections:c,open:ne,onToggle:R,hideWhenCollapsed:N(`md:hidden`),onSectionClick:(e,t)=>de(e,t,`skills`)}}),(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,H.jsxs)(`a`,{href:J.memory,className:fe(t===`memory`),"aria-current":t===`memory`?`page`:void 0,title:j?u:void 0,onClick:e=>ue(e,J.memory),children:[(0,H.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:V(`min-w-0 break-words text-start`,N(`md:sr-only`)),children:u})]}),d.length>0?(0,H.jsx)(`button`,{type:`button`,className:V(`inline-flex min-h-11 min-w-11 md:min-h-7 md:min-w-7 shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,N(`md:hidden`)),onClick:ie,"aria-expanded":F,"aria-controls":`sidebar-memory-tree`,"aria-label":u,title:u,children:(0,H.jsx)(ce,{className:V(`size-4 transition-transform rtl:-scale-x-100`,F&&`rotate-90 rtl:rotate-90`)})}):null]}),F&&d.length>0?(0,H.jsx)(vd,{sections:d,currentView:t,memoryViewId:p,warningLabel:f,className:V(`ms-5 space-y-0.5 border-s border-sidebar-border ps-2`,N(`md:hidden`)),onSectionClick:de}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,H.jsxs)(`a`,{href:J.settings,className:fe(t===`settings`),"aria-current":t===`settings`?`page`:void 0,title:j?_:void 0,onClick:e=>ue(e,J.settings),children:[(0,H.jsx)(Dt,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:V(`min-w-0 break-words text-start`,N(`md:sr-only`)),children:_})]}),l.length>0?(0,H.jsx)(`button`,{type:`button`,className:V(`inline-flex min-h-11 min-w-11 md:min-h-7 md:min-w-7 shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,N(`md:hidden`)),onClick:ae,"aria-expanded":P,"aria-controls":`sidebar-settings-tree`,"aria-label":_,title:_,children:(0,H.jsx)(ce,{className:V(`size-4 transition-transform rtl:-scale-x-100`,P&&`rotate-90 rtl:rotate-90`)})}):null]}),P&&l.length>0?(0,H.jsx)(`ul`,{id:`sidebar-settings-tree`,className:V(`ms-5 space-y-0.5 border-s border-sidebar-border ps-2`,N(`md:hidden`)),children:l.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`a`,{href:`${J.settings}#${e.id}`,className:`flex min-h-11 md:min-h-7 items-center break-words rounded-lg px-2.5 py-1 text-xs text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,onClick:t=>de(t,e.id,`settings`),children:e.label})},e.id))}):null]}),(0,H.jsxs)(`div`,{className:V(`mt-auto p-3`,N(`md:px-2`)),children:[(0,H.jsx)(Tf,{variant:`row`,className:`md:hidden`,onOpen:()=>O(!0)}),(0,H.jsxs)(`div`,{className:V(`flex w-fit items-center rounded-lg border border-sidebar-border/80 bg-card/70`,N(`md:mx-auto md:flex-col md:[&>*]:justify-center md:[&>*]:py-1.5 md:[&>*+*]:border-s-0 md:[&>*+*]:border-t md:[&>*]:rounded-none`)),children:[(0,H.jsxs)(`div`,{ref:k,className:`relative flex self-stretch`,onBlur:e=>{k.current?.contains(e.relatedTarget)||E(!1)},children:[(0,H.jsx)(`button`,{ref:A,type:`button`,className:`${Op} rounded-s-lg px-1.5 py-1.5 text-ui`,onClick:()=>E(e=>!e),"aria-label":`${h}: ${m}`,"aria-haspopup":`menu`,"aria-expanded":T,"aria-controls":`sidebar-language-menu`,title:h,children:(0,H.jsx)(`span`,{className:`text-xs tabular-nums`,children:m})}),T?(0,H.jsx)(`div`,{id:`sidebar-language-menu`,role:`menu`,"aria-label":h,onKeyDown:se,className:`absolute bottom-full start-0 z-10 mb-2 w-44 max-h-[60vh] overflow-y-auto rounded-lg border border-sidebar-border bg-card p-1 shadow-lg`,children:Sp.map(({code:e,label:t})=>(0,H.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":m.toLowerCase()===e,className:`flex min-h-11 md:min-h-9 w-full items-center rounded-md px-2.5 py-2 text-start text-ui text-card-foreground aria-checked:bg-selection hover:bg-interactive-hover focus-visible:bg-selection focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>{C?.(e),E(!1),A.current?.focus()},children:t},e))}):null]}),(0,H.jsx)(`button`,{type:`button`,className:`${Op} self-stretch border-s border-sidebar-border px-1.5`,onClick:()=>hp(),"aria-label":g,title:g,children:w?(0,H.jsx)(tt,{className:`size-4 rounded-md p-0.5`}):(0,H.jsx)(Nt,{className:`size-4 rounded-md p-0.5`})}),(0,H.jsx)(`a`,{href:J.settings,className:`${Op} self-stretch border-s border-sidebar-border px-1.5`,onClick:e=>ue(e,J.settings),"aria-label":_,title:_,"aria-current":t===`settings`?`page`:void 0,children:(0,H.jsx)(Dt,{className:`size-4`})}),(0,H.jsx)(Wd,{}),(0,H.jsx)(`a`,{href:`https://github.com/cmdaltctr/omms`,target:`_blank`,rel:`noopener noreferrer`,className:`${Op} self-stretch rounded-e-lg border-s border-sidebar-border px-1.5`,title:`GitHub`,"aria-label":`GitHub`,children:(0,H.jsx)(yd,{className:`size-4`})}),(0,H.jsx)(Tf,{onOpen:()=>O(!0),variant:j?`icon`:`inline`,className:V(`max-md:hidden`,j?`md:border-t md:border-sidebar-border`:`rounded-e-lg`)})]}),(0,H.jsx)(Ef,{open:D,onOpenChange:O})]})]})]})}var Mp=Object.defineProperty,Np=v.forwardRef(((e,t)=>Mp(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,H.jsx)(Mo.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`));function Pp({className:e,...t}){return(0,H.jsx)(Np,{"data-slot":`label`,className:V(`flex items-center gap-2 text-ui leading-normal select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Fp({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,dir:`auto`,className:V(`border-input placeholder:text-muted-foreground selection:bg-selection selection:text-foreground flex field-sizing-content min-h-16 w-full min-w-0 rounded-[10px] border bg-card px-2.5 py-2 text-ui [unicode-bidi:plaintext] transition-colors duration-150 outline-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`aria-invalid:ring-destructive aria-invalid:ring-1 aria-invalid:border-destructive`,e),...t})}function Ip({open:e=!1,content:t=``,onOpenChange:n,onSave:r}){let{t:i}=oa(),[a,o]=(0,v.useState)(``);(0,v.useEffect)(()=>{e&&o(t)},[e,t]);function s(e){n?.(e)}function c(e){e.preventDefault();let t=a.trim();t&&r?.(t)}return(0,H.jsx)(K,{open:e,onOpenChange:s,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:i(`modal-edit-title`)})}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:c,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`edit-content`,children:i(`label-content`)}),(0,H.jsx)(Fp,{id:`edit-content`,rows:6,value:a,onChange:e=>o(e.target.value),required:!0})]}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>s(!1),children:i(`btn-cancel`)}),(0,H.jsx)(G,{type:`submit`,children:i(`btn-save`)})]})]})]})})}function Lp({children:e,maxHeight:t,fade:n=`var(--card)`}){let{t:r}=oa(),i=(0,v.useId)(),a=(0,v.useRef)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=a.current;if(!e)return;let n=()=>l(e.offsetHeight>t);if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t]);let u=c&&!o;return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{id:i,className:`relative overflow-hidden`,style:u?{maxHeight:t}:void 0,"data-collapsed":u?`true`:void 0,children:[(0,H.jsx)(`div`,{ref:a,children:e}),u?(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-x-0 bottom-0 h-12`,style:{background:`linear-gradient(to top, ${n}, transparent)`}}):null]}),c?(0,H.jsxs)(G,{variant:`ghost`,size:`xs`,"aria-expanded":o,"aria-controls":i,onClick:()=>s(e=>!e),children:[o?(0,H.jsx)(le,{}):(0,H.jsx)(oe,{}),r(o?`btn-see-less`:`btn-see-more`)]}):null]})}var Rp=8;function zp({content:e,children:t,className:n}){let r=v.useId(),i=v.useRef(null),[a,o]=v.useState(0),s=v.isValidElement(t)?v.cloneElement(t,{"aria-describedby":r}):t,c=()=>{let e=i.current;if(!e)return;let t=e.parentElement.getBoundingClientRect(),n=e.offsetWidth/2,r=t.left+t.width/2,a=document.documentElement.clientWidth,s=Rp+n,c=a-Rp-n;o(Math.min(Math.max(r,s),c)-r)};return(0,H.jsxs)(`span`,{className:V(`group/tooltip relative inline-flex`,n),onPointerEnter:c,onFocus:c,children:[s,(0,H.jsxs)(`span`,{ref:i,id:r,role:`tooltip`,style:{transform:`translateX(calc(-50% + ${a}px))`},className:`pointer-events-none absolute bottom-full left-1/2 z-30 mb-2 w-max max-w-[min(24rem,calc(100vw-1rem))] rounded-md border border-border bg-card px-2 py-1 text-xs whitespace-normal text-card-foreground opacity-0 shadow-sm transition-opacity duration-150 ease-in group-focus-within/tooltip:opacity-100 group-hover/tooltip:opacity-100`,children:[e,(0,H.jsx)(`span`,{"aria-hidden":`true`,style:{left:`calc(50% - ${a}px)`},className:`absolute top-full -mt-1 size-2 -translate-x-1/2 rotate-45 border-e border-b border-border bg-card`})]})]})}function Bp({type:e}){let{t}=oa();return(0,H.jsx)(zp,{content:t(`tooltip-memory-type`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(rd,{variant:`outline`,"data-memory-type":e,tabIndex:0,className:`h-auto min-h-5 max-w-full shrink break-all whitespace-normal bg-transparent border-current [color:oklch(0.42_0.13_var(--memory-type-hue))] dark:[color:oklch(0.8_0.13_var(--memory-type-hue))]`,style:{"--memory-type-hue":String(ed(e))},children:e})})}var Vp=/<pasted_content\b[^>]*>([\s\S]*?)<\/pasted_content[^>]*>|```[^\n]*\n([\s\S]*?)```/g;function Hp(e){return e.replace(/^\n+|\n+$/g,``)}function Up(e){let t=[],n=e=>{let n=Hp(e);n.trim()&&t.push({kind:`text`,text:n})},r=0;for(let i of e.matchAll(Vp)){n(e.slice(r,i.index));let a=i[1]!==void 0;t.push({kind:a?`pasted`:`code`,text:Hp(a?i[1]:i[2])}),r=i.index+i[0].length}return n(e.slice(r)),t}function Wp(e){let t=[],n=0;for(let r of e.matchAll(/`([^`\n]+)`/g))r.index>n&&t.push({code:!1,text:e.slice(n,r.index)}),t.push({code:!0,text:r[1]}),n=r.index+r[0].length;return n<e.length&&t.push({code:!1,text:e.slice(n)}),t}function Gp({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background/60`,children:[e?(0,H.jsx)(`div`,{className:`border-b border-border px-3 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}):null,(0,H.jsx)(`pre`,{dir:`ltr`,className:`overflow-x-auto p-3 font-mono text-code leading-relaxed whitespace-pre-wrap break-words`,children:t})]})}function Kp({content:e}){let{t}=oa();return(0,H.jsx)(`div`,{className:`space-y-3`,children:Up(e).map((e,n)=>e.kind===`pasted`?(0,H.jsx)(Gp,{label:t(`label-pasted-content`),children:e.text},n):e.kind===`code`?(0,H.jsx)(Gp,{children:e.text},n):(0,H.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:Wp(e.text).map((e,t)=>e.code?(0,H.jsx)(`code`,{className:`inline-code`,children:e.text},t):(0,H.jsx)(v.Fragment,{children:e.text},t))},n))})}var qp=e=>e instanceof Date?e:new Date(e),Jp=()=>Ci($i(),typeof navigator>`u`?void 0:navigator.language);function Yp(e){return ki(qp(e),Pi(),Jp())}function Xp(e){return Oi(qp(e),Pi(),Jp())}function Zp(e){return Di(qp(e),Pi(),Jp())}function Qp(e,t=Pi()){return Ei(qp(e),t,Jp())}function $p(){return{locale:Jp(),choice:Pi()}}function em(e,t){return Oi(qp(e),t,Jp())}function tm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nm(e){if(Array.isArray(e))return e}function rm(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function im(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
58
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function am(e,t){return nm(e)||rm(e,t)||om(e,t)||im()}function om(e,t){if(e){if(typeof e==`string`)return tm(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tm(e,t):void 0}}var sm=Object.entries,cm=Object.setPrototypeOf,lm=Object.isFrozen,um=Object.getPrototypeOf,dm=Object.getOwnPropertyDescriptor,fm=Object.freeze,pm=Object.seal,mm=Object.create,hm=typeof Reflect<`u`&&Reflect,gm=hm.apply,_m=hm.construct;fm||=function(e){return e},pm||=function(e){return e},gm||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},_m||=function(e){return new e(...[...arguments].slice(1))};var vm=Rm(Array.prototype.forEach),ym=Rm(Array.prototype.lastIndexOf),bm=Rm(Array.prototype.pop),xm=Rm(Array.prototype.push),Sm=Rm(Array.prototype.splice),Cm=Array.isArray,wm=Rm(String.prototype.toLowerCase),Tm=Rm(String.prototype.toString),Em=Rm(String.prototype.match),Dm=Rm(String.prototype.replace),Om=Rm(String.prototype.indexOf),km=Rm(String.prototype.trim),Am=Rm(Number.prototype.toString),jm=Rm(Boolean.prototype.toString),Mm=typeof BigInt>`u`?null:Rm(BigInt.prototype.toString),Nm=typeof Symbol>`u`?null:Rm(Symbol.prototype.toString),Pm=Rm(Object.prototype.hasOwnProperty),Fm=Rm(Object.prototype.toString),Im=Rm(RegExp.prototype.test),Lm=zm(TypeError);function Rm(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return gm(e,t,n)}}function zm(e){return function(){return _m(e,[...arguments])}}function Bm(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wm;if(cm&&cm(e,null),!Cm(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(lm(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Vm(e){for(let t=0;t<e.length;t++)Pm(e,t)||(e[t]=null);return e}function Hm(e){let t=mm(null);for(let r of sm(e)){var n=am(r,2);let i=n[0],a=n[1];Pm(e,i)&&(t[i]=Cm(a)?Vm(a):a&&typeof a==`object`&&a.constructor===Object?Hm(a):a)}return t}function Um(e){switch(typeof e){case`string`:return e;case`number`:return Am(e);case`boolean`:return jm(e);case`bigint`:return Mm?Mm(e):`0`;case`symbol`:return Nm?Nm(e):`Symbol()`;case`undefined`:return Fm(e);case`function`:case`object`:{if(e===null)return Fm(e);let t=e,n=Wm(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Fm(e)}return Fm(e)}default:return Fm(e)}}function Wm(e,t){for(;e!==null;){let n=dm(e,t);if(n){if(n.get)return Rm(n.get);if(typeof n.value==`function`)return Rm(n.value)}e=um(e)}function n(){return null}return n}function Gm(e){try{return Im(e,``),!0}catch{return!1}}var Km=fm(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),qm=fm(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Jm=fm([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ym=fm([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Xm=fm(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Zm=fm([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Qm=fm([`#text`]),$m=fm(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),eh=fm(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),th=fm(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),nh=fm([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),rh=pm(/{{[\w\W]*|^[\w\W]*}}/g),ih=pm(/<%[\w\W]*|^[\w\W]*%>/g),ah=pm(/\${[\w\W]*/g),oh=pm(/^data-[\-\w.\u00B7-\uFFFF]+$/),sh=pm(/^aria-[\-\w]+$/),ch=pm(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lh=pm(/^(?:\w+script|data):/i),uh=pm(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dh=pm(/^html$/i),fh=pm(/^[a-z][.\w]*(-[.\w]+)+$/i),ph=pm(/<[/\w!]/g),mh=pm(/<[/\w]/g),hh=pm(/<\/no(script|embed|frames)/i),gh=pm(/\/>/i),_h={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},vh=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],yh=fm(Bm({},vh)),bh=function(){let e={};return vm(vh,t=>{e[t]=pm(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),fm(e)}(),xh=function(){return typeof window>`u`?null:window},Sh=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ch=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},wh=function(e,t,n,r){return Pm(e,t)&&Cm(e[t])?Bm(r.base?Hm(r.base):{},e[t],r.transform):n},Th=function(e,t,n){let r=Pm(e,t)?e[t]:void 0;return r&&typeof r==`object`?Hm(r):n()};function Eh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xh(),t=e=>Eh(e);if(t.version=`3.4.14`,t.removed=[],!e||!e.document||e.document.nodeType!==_h.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Wm(d,`cloneNode`),p=Wm(d,`remove`),m=Wm(d,`nextSibling`),h=Wm(d,`childNodes`),g=Wm(d,`parentNode`),_=Wm(d,`shadowRoot`),v=Wm(d,`attributes`),y=o&&o.prototype?Wm(o.prototype,`nodeType`):null,b=o&&o.prototype?Wm(o.prototype,`nodeName`):null,x=o&&o.prototype?Wm(o.prototype,`ownerDocument`):null,S=function(e){return y?y(e):e.nodeType},C=function(e){return b?b(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,T=``,E,D=!1,O=0,k=function(){if(O>0)throw Lm(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},A=function(e){k(),O++;try{return w.createHTML(e)}finally{O--}},j=function(e){k(),O++;try{return w.createScriptURL(e)}finally{O--}},M=function(){return D||=(E=Sh(u,i),!0),E},N=n,P=N.implementation,ee=N.createNodeIterator,F=N.createDocumentFragment,I=N.getElementsByTagName,te=r.importNode,L=Ch();t.isSupported=typeof sm==`function`&&typeof g==`function`&&P&&P.createHTMLDocument!==void 0;let ne=rh,re=ih,R=ah,ie=oh,ae=sh,oe=lh,se=uh,ce=fh,le=ch,ue=null,de=Bm({},[...Km,...qm,...Jm,...Xm,...Qm]),fe=null,pe=Bm({},[...$m,...eh,...th,...nh]),me=Object.seal(mm(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ge=null,_e=Object.seal(mm(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ve=!0,ye=!0,be=!1,xe=!0,Se=!1,Ce=!0,we=!1,Te=!1,Ee=null,De=null,Oe=!1,ke=!1,Ae=!1,je=!1,Me=!0,Ne=!1,Pe=`user-content-`,Fe=!0,Ie=!1,Le={},Re=null,ze=Bm({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Be=null,Ve=Bm({},[`audio`,`video`,`img`,`source`,`image`,`track`]),He=null,Ue=Bm({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),We=`http://www.w3.org/1998/Math/MathML`,Ge=`http://www.w3.org/2000/svg`,Ke=`http://www.w3.org/1999/xhtml`,qe=Ke,Je=!1,Ye=null,Xe=Bm({},[We,Ge,Ke],Tm),Ze=fm([`mi`,`mo`,`mn`,`ms`,`mtext`]),Qe=Bm({},Ze),$e=fm([`annotation-xml`]),et=Bm({},$e),tt=Bm({},[`title`,`style`,`font`,`a`,`script`]),nt=null,rt=[`application/xhtml+xml`,`text/html`],it=null,at=null,ot=n.createElement(`form`),st=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(at&&at===e)return;(!e||typeof e!=`object`)&&(e={}),e=Hm(e),nt=rt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,it=nt===`application/xhtml+xml`?Tm:wm,ue=wh(e,`ALLOWED_TAGS`,de,{transform:it}),fe=wh(e,`ALLOWED_ATTR`,pe,{transform:it}),Ye=wh(e,`ALLOWED_NAMESPACES`,Xe,{transform:Tm}),He=wh(e,`ADD_URI_SAFE_ATTR`,Ue,{transform:it,base:Ue}),Be=wh(e,`ADD_DATA_URI_TAGS`,Ve,{transform:it,base:Ve}),Re=wh(e,`FORBID_CONTENTS`,ze,{transform:it}),he=wh(e,`FORBID_TAGS`,Hm({}),{transform:it}),ge=wh(e,`FORBID_ATTR`,Hm({}),{transform:it}),Le=Pm(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Hm(e.USE_PROFILES):e.USE_PROFILES:!1,ve=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=e.SAFE_FOR_TEMPLATES||!1,Ce=e.SAFE_FOR_XML!==!1,we=e.WHOLE_DOCUMENT||!1,ke=e.RETURN_DOM||!1,Ae=e.RETURN_DOM_FRAGMENT||!1,je=e.RETURN_TRUSTED_TYPE||!1,Oe=e.FORCE_BODY||!1,Me=e.SANITIZE_DOM!==!1,Ne=e.SANITIZE_NAMED_PROPS||!1,Fe=e.KEEP_CONTENT!==!1,Ie=e.IN_PLACE||!1,le=Gm(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ch,qe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ke,Qe=Th(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Bm({},Ze)),et=Th(e,`HTML_INTEGRATION_POINTS`,()=>Bm({},$e));let t=Th(e,`CUSTOM_ELEMENT_HANDLING`,()=>mm(null));if(me=mm(null),Pm(t,`tagNameCheck`)&&st(t.tagNameCheck)&&(me.tagNameCheck=t.tagNameCheck),Pm(t,`attributeNameCheck`)&&st(t.attributeNameCheck)&&(me.attributeNameCheck=t.attributeNameCheck),Pm(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(me.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),pm(me),Se&&(ye=!1),Ae&&(ke=!0),Le&&(ue=Bm({},Qm),fe=mm(null),Le.html===!0&&(Bm(ue,Km),Bm(fe,$m)),Le.svg===!0&&(Bm(ue,qm),Bm(fe,eh),Bm(fe,nh)),Le.svgFilters===!0&&(Bm(ue,Jm),Bm(fe,eh),Bm(fe,nh)),Le.mathMl===!0&&(Bm(ue,Xm),Bm(fe,th),Bm(fe,nh))),_e.tagCheck=null,_e.attributeCheck=null,Pm(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?_e.tagCheck=e.ADD_TAGS:Cm(e.ADD_TAGS)&&(ue===de&&(ue=Hm(ue)),Bm(ue,e.ADD_TAGS,it))),Pm(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?_e.attributeCheck=e.ADD_ATTR:Cm(e.ADD_ATTR)&&(fe===pe&&(fe=Hm(fe)),Bm(fe,e.ADD_ATTR,it))),Pm(e,`ADD_FORBID_CONTENTS`)&&Cm(e.ADD_FORBID_CONTENTS)&&(Re===ze&&(Re=Hm(Re)),Bm(Re,e.ADD_FORBID_CONTENTS,it)),Fe&&(ue[`#text`]=!0),we&&Bm(ue,[`html`,`head`,`body`]),ue.table&&(Bm(ue,[`tbody`]),delete he.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Lm(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Lm(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=w;w=e.TRUSTED_TYPES_POLICY;try{T=A(``)}catch(e){throw w=t,e}}else e.TRUSTED_TYPES_POLICY===null?(w=void 0,T=``):(w===void 0&&(w=M()),w&&typeof T==`string`&&(T=A(``)));fm&&fm(e),at=e},lt=Bm({},[...qm,...Jm,...Ym]),ut=Bm({},[...Xm,...Zm]),dt=function(e,t,n){return t.namespaceURI===Ke?e===`svg`:t.namespaceURI===We?e===`svg`&&(n===`annotation-xml`||Qe[n]):!!lt[e]},ft=function(e,t,n){return t.namespaceURI===Ke?e===`math`:t.namespaceURI===Ge?e===`math`&&et[n]:!!ut[e]},pt=function(e,t,n){return t.namespaceURI===Ge&&!et[n]||t.namespaceURI===We&&!Qe[n]?!1:!ut[e]&&(tt[e]||!lt[e])},mt=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:qe,tagName:`template`});let n=wm(e.tagName),r=wm(t.tagName);return Ye[e.namespaceURI]?e.namespaceURI===Ge?dt(n,t,r):e.namespaceURI===We?ft(n,t,r):e.namespaceURI===Ke?pt(n,t,r):!!(nt===`application/xhtml+xml`&&Ye[e.namespaceURI]):!1},ht=function(e){xm(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Lm(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gt=function(e,t,n){try{e.removeAttributeNode(t)}catch{try{e.removeAttribute(n)}catch{}}},_t=function(e){bt(e);let t=h(e);if(t){let e=[];vm(t,t=>{xm(e,t)}),vm(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&gt(e,r,i)}},vt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}xm(t.removed,{attribute:r||null,from:n});try{r?n.removeAttributeNode(r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(ke||Ae)try{ht(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},yt=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||fe[it(i)]||gt(e,r,i)}},bt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();S(e)===_h.element&&yt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},xt=function(e,t){return Ce?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},St=function(e){if(!Ce)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=S(e);if(n===_h.processingInstruction||n===_h.comment&&Im(mh,e.data)){try{p(e)}catch{}continue}if(n===_h.element){let t=e,n=it(C(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&xt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Ct=function(e){let t=null,r=null;if(Oe)e=`<remove></remove>`+e;else{let t=Em(e,/^[\r\n\t ]+/);r=t&&t[0]}nt===`application/xhtml+xml`&&qe===Ke&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=w?A(e):e;if(qe===Ke)try{t=new l().parseFromString(i,nt)}catch{}if(!t||!t.documentElement){t=P.createDocument(qe,`template`,null);try{t.documentElement.innerHTML=Je?T:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),qe===Ke?I.call(t,we?`html`:`body`)[0]:we?t.documentElement:a},wt=function(e){let t=x?x(e):e.ownerDocument;return ee.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Tt=function(e){return e=Dm(e,ne,` `),e=Dm(e,re,` `),e=Dm(e,R,` `),e},Et=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=ee.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Tt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&vm(i,e=>{Ot(e.content)&&Et(e.content)})},Dt=function(e){let t=b?b(e):null;return typeof t!=`string`||it(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},Ot=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===_h.documentFragment}catch{return!1}},kt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function At(e,n,r){e.length!==0&&vm(e,e=>{e.call(t,n,r,at)})}let jt=function(e,t){return!!(Ce&&e.hasChildNodes()&&!kt(e.firstElementChild)&&Im(ph,e.textContent)&&Im(ph,e.innerHTML)||Ce&&e.namespaceURI===Ke&&yh[t]&&(kt(e.firstElementChild)||typeof e.textContent==`string`&&Im(bh[t],e.textContent))||e.nodeType===_h.processingInstruction||Ce&&e.nodeType===_h.comment&&Im(mh,e.data))},Mt=function(e,t){return e instanceof RegExp?Im(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Nt=function(e,t,n){if(!he[t]&&zt(t)&&Mt(me.tagNameCheck,t))return!1;if(Fe&&!Re[t]){let t=g(e),r=h(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,m(e))}}}return ht(e),!0},Pt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Hm(t):t},Ft=function(e,t){return e===t||g(e)!==null?!1:(Ie&&bt(e),!0)},It=function(e,n){if(At(L.beforeSanitizeElements,e,null),Ft(e,n))return!0;if(Dt(e))return ht(e),!0;let r=it(C(e));if(ue=Pt(L.uponSanitizeElement,ue,de,Ee),At(L.uponSanitizeElement,e,{tagName:r,allowedTags:ue}),Ft(e,n))return!0;if(jt(e,r))return ht(e),!0;if(he[r]||!(_e.tagCheck instanceof Function&&_e.tagCheck(r))&&!ue[r]){let t=Nt(e,r,n);return t===!1&&At(L.afterSanitizeElements,e,null),t}if(S(e)===_h.element&&!mt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Im(hh,e.innerHTML))return ht(e),!0;if(Se&&e.nodeType===_h.text){let n=Tt(e.textContent);e.textContent!==n&&(xm(t.removed,{element:e.cloneNode()}),e.textContent=n)}return At(L.afterSanitizeElements,e,null),!1},Lt=function(e,t,r){if(ge[t]||xt(t,e)||Me&&(t===`id`||t===`name`)&&(r in n||r in ot))return!1;let i=fe[t]||_e.attributeCheck instanceof Function&&_e.attributeCheck(t,e);return ye&&Im(ie,t)||ve&&Im(ae,t)?!0:i?He[t]||Im(le,Dm(r,se,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Om(r,`data:`)===0&&Be[e]||be&&!Im(oe,Dm(r,se,``))?!0:!r:zt(e)&&Mt(me.tagNameCheck,e)&&Mt(me.attributeNameCheck,t,e)||t===`is`&&me.allowCustomizedBuiltInElements&&Mt(me.tagNameCheck,r)},Rt=Bm({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),zt=function(e){return!Rt[wm(e)]&&Im(ce,e)},Bt=function(e,t,n,r){if(w&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return A(r);case`TrustedScriptURL`:return j(r)}return r},Vt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Dt(e)?ht(e):bm(t.removed)}catch{vt(n,e)}},Ht=function(e){At(L.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Dt(e))return;fe=Pt(L.uponSanitizeAttribute,fe,pe,De);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:fe,forceKeepAttr:void 0},r=t.length,i=it(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=it(o),u=c,d=o===`value`?u:km(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,At(L.uponSanitizeAttribute,e,n),d=n.attrValue,Ne&&(l===`id`||l===`name`)&&Om(d,Pe)!==0&&(vt(o,e,a),d=Pe+d),Ce&&Im(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){vt(o,e,a);continue}if(l===`attributename`&&Em(d,`href`)){vt(o,e,a);continue}if(!n.forceKeepAttr){if(!n.keepAttr){vt(o,e,a);continue}if(!xe&&Im(gh,d)){vt(o,e,a);continue}if(Se&&(d=Tt(d)),!Lt(i,l,d)){vt(o,e,a);continue}d=Bt(i,l,s,d),d!==u&&Vt(e,o,s,d)}}At(L.afterSanitizeAttributes,e,null)},Ut=function(e){let t=null,n=wt(e);for(At(L.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(At(L.uponSanitizeShadowNode,t,null),It(t,e),Ht(t),Ot(t.content)&&Ut(t.content),S(t)===_h.element){let e=_(t);Ot(e)&&(Wt(e),Ut(e))}At(L.afterSanitizeShadowDOM,e,null)},Wt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ut(e.shadow);continue}let n=e.node,r=S(n)===_h.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&it(e)===`template`){let e=n.content;Ot(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);Ot(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Je=!e,Je&&(e=`<!-->`),typeof e!=`string`&&!kt(e)&&(e=Um(e),typeof e!=`string`))throw Lm(`dirty is not a string, aborting`);if(!t.isSupported)return e;Te?(ue=Ee,fe=De):ct(n),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(ue=Hm(ue)),L.uponSanitizeAttribute.length>0&&(fe=Hm(fe)),t.removed=[];let c=Ie&&typeof e!=`string`&&kt(e);if(c){St(e);let t=C(e);if(typeof t==`string`){let n=it(t);if(!ue[n]||he[n])throw _t(e),Lm(`root node is forbidden and cannot be sanitized in-place`)}if(Dt(e))throw _t(e),Lm(`root node is clobbered and cannot be sanitized in-place`);try{Wt(e)}catch(t){throw _t(e),t}}else if(kt(e))i=Ct(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===_h.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Wt(a);else{if(!ke&&!Se&&!we&&e.indexOf(`<`)===-1)return w&&je?A(e):e;if(i=Ct(e),!i)return ke?null:je?T:``}i&&Oe&&ht(i.firstChild);let l=c?e:i;try{let e=wt(l);for(;o=e.nextNode();)It(o,l),Ht(o),Ot(o.content)&&Ut(o.content)}catch(n){throw c&&(_t(e),vm(t.removed,e=>{e.element&&bt(e.element)})),n}if(c)return vm(t.removed,e=>{e.element&&bt(e.element)}),Se&&Et(e),e;if(ke){if(Se&&Et(i),Ae)for(s=F.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(fe.shadowroot||fe.shadowrootmode)&&(s=te.call(r,s,!0)),s}let u=we?i.outerHTML:i.innerHTML;return we&&ue[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Im(dh,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
59
- `+u),Se&&(u=Tt(u)),w&&je?A(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(e),Te=!0,Ee=ue,De=fe},t.clearConfig=function(){at=null,Te=!1,Ee=null,De=null,w=E,T=``},t.isValidAttribute=function(e,t,n){at||ct({});let r=it(e),i=it(t);return Lt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Pm(L,e)&&xm(L[e],t)},t.removeHook=function(e,t){if(Pm(L,e)){if(t!==void 0){let n=ym(L[e],t);return n===-1?void 0:Sm(L[e],n,1)[0]}return bm(L[e])}},t.removeHooks=function(e){Pm(L,e)&&(L[e]=[])},t.removeAllHooks=function(){L=Ch()},t}var Dh=Eh();function Oh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var kh=Oh();function Ah(e){kh=e}var jh={exec:()=>null};function Mh(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Nh(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Fh.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ph=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Fh={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Mh(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Mh(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Mh(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Mh(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Mh(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Mh(e=>RegExp(`^ {0,${e}}>`))},Ih=/^(?:[ \t]*(?:\n|$))+/,Lh=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Rh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,zh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Hh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uh=Nh(Hh).replace(/bull/g,Vh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Wh=Nh(Hh).replace(/bull/g,Vh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Gh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Kh=/^[^\n]+/,qh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Jh=Nh(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,qh).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Yh=Nh(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Vh).getRegex(),Xh=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Zh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qh=Nh(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Zh).replace(`tag`,Xh).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$h=e=>Nh(Gh).replace(`hr`,zh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Xh).getRegex(),eg=$h(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),tg=$h(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ng={blockquote:Nh(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,tg).getRegex(),code:Lh,def:Jh,fences:Rh,heading:Bh,hr:zh,html:Qh,lheading:Uh,list:Yh,newline:Ih,paragraph:eg,table:jh,text:Kh},rg=Nh(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,zh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Xh).getRegex(),ig={...ng,lheading:Wh,table:rg,paragraph:Nh(Gh).replace(`hr`,zh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,rg).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Xh).getRegex()},ag={...ng,html:Nh(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Zh).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:jh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Nh(Gh).replace(`hr`,zh).replace(`heading`,` *#{1,6} *[^
60
- ]`).replace(`lheading`,Uh).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},og=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,sg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cg=/^( {2,}|\\)\n(?!\s*$)/,lg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ug=/[\p{P}\p{S}]/u,dg=/[\s\p{P}\p{S}]/u,fg=/[^\s\p{P}\p{S}]/u,pg=Nh(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,dg).getRegex(),mg=/[\p{Pi}\p{Ps}"']/u,hg=/(?!~)[\p{P}\p{S}]/u,gg=/(?!~)[\s\p{P}\p{S}]/u,_g=/(?:[^\s\p{P}\p{S}]|~)/u,vg=Nh(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Ph?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),yg=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,bg=Nh(yg,`u`).replace(/punct/g,ug).getRegex(),xg=Nh(yg,`u`).replace(/punct/g,hg).getRegex(),Sg=Nh(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,mg).replace(/punct/g,ug).getRegex(),Cg=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,wg=Nh(Cg,`gu`).replace(/notPunctSpace/g,fg).replace(/punctSpace/g,dg).replace(/punct/g,ug).getRegex(),Tg=Nh(Cg,`gu`).replace(/notPunctSpace/g,_g).replace(/punctSpace/g,gg).replace(/punct/g,hg).getRegex(),Eg=Nh(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,fg).replace(/punctSpace/g,dg).replace(/punct/g,ug).getRegex(),Dg=Nh(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,fg).replace(/punctSpace/g,dg).replace(/punct/g,ug).getRegex(),Og=Nh(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,fg).replace(/punctSpace/g,dg).replace(/punct/g,ug).getRegex(),kg=Nh(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,ug).getRegex(),Ag=Nh(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,fg).replace(/punctSpace/g,dg).replace(/punct/g,ug).getRegex(),jg=Nh(/\\(punct)/,`gu`).replace(/punct/g,ug).getRegex(),Mg=Nh(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ng=Nh(Zh).replace(`(?:-->|$)`,`-->`).getRegex(),Pg=Nh(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Ng).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fg=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ig=Nh(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Fg).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Lg=Nh(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Fg).replace(`ref`,qh).getRegex(),Rg=Nh(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,qh).getRegex(),zg=Nh(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Lg).replace(`nolink`,Rg).getRegex(),Bg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Vg={_backpedal:jh,anyPunctuation:jg,autolink:Mg,blockSkip:vg,br:cg,code:sg,del:jh,delLDelim:jh,delRDelim:jh,emStrongLDelim:bg,emStrongRDelimAst:wg,emStrongRDelimUnd:Dg,escape:og,link:Ig,nolink:Rg,punctuation:pg,reflink:Lg,reflinkSearch:zg,tag:Pg,text:lg,url:jh},Hg={...Vg,emStrongLDelim:Sg,emStrongRDelimAst:Eg,emStrongRDelimUnd:Og,link:Nh(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Fg).getRegex(),reflink:Nh(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Fg).getRegex()},Ug={...Vg,emStrongRDelimAst:Tg,emStrongLDelim:xg,delLDelim:kg,delRDelim:Ag,url:Nh(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Bg).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Nh(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Bg).getRegex()},Wg={...Ug,br:Nh(cg).replace(`{2,}`,`*`).getRegex(),text:Nh(Ug.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Gg={normal:ng,gfm:ig,pedantic:ag},Kg={normal:Vg,gfm:Ug,breaks:Wg,pedantic:Hg},qg={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Jg=e=>qg[e];function Yg(e,t){if(t){if(Fh.escapeTest.test(e))return e.replace(Fh.escapeReplace,Jg)}else if(Fh.escapeTestNoEncode.test(e))return e.replace(Fh.escapeReplaceNoEncode,Jg);return e}function Xg(e){try{e=encodeURI(e).replace(Fh.percentDecode,`%`)}catch{return null}return e}function Zg(e,t){let n=e.replace(Fh.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Fh.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Fh.slashPipe,`|`);return n}function Qg(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function $g(e){let t=e.split(`
61
- `),n=t.length-1;for(;n>=0&&Fh.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
62
- `)}function e_(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function t_(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function n_(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function r_(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
57
+ `)}var Jf=`omms-theme`,Yf=`opencode-mem-theme`,Xf=`omms-theme-light`,Zf=`omms-theme-dark`,Qf=`omms-theme`,$f=`(prefers-color-scheme: dark)`;function ep(){return typeof window>`u`?null:Ff(ui(Jf,Yf))}function tp(){return typeof window>`u`||!window.matchMedia||window.matchMedia($f).matches}function np(){return If(ep(),tp())}function rp(){let e=(e,t)=>typeof window>`u`?t:ui(e,e)??t;return{mode:ep()??`system`,light:Hf(e(Xf,Rf),`light`).id,dark:Hf(e(Zf,zf),`dark`).id}}var ip=np(),ap=rp(),op=!1,sp=new Set;function cp(){for(let e of sp)e()}function lp(e,t=!1){ip=e,typeof document<`u`&&(document.documentElement.classList.toggle(`dark`,e===`dark`),up(document,e),t&&(op=!0,fi(Jf,e),ap={...ap,mode:e})),cp()}function up(e,t){let n=qf(ap.light,ap.dark),r=e.getElementById(Qf);n===``?r?.remove():(r||(r=e.createElement(`style`),r.id=Qf,e.head.append(r)),r.textContent=n),Vi(e,t,(t===`dark`?Hf(ap.dark,`dark`):Hf(ap.light,`light`)).colours.canvas)}function dp(e){return sp.add(e),()=>{sp.delete(e)}}function fp(){return ip}function pp(){return`dark`}function mp(e){lp(e,!0)}function hp(){let e=ip===`dark`?`light`:`dark`;return mp(e),e}function gp(){lp(np())}function _p(){return(0,v.useSyncExternalStore)(dp,fp,pp)}var vp=()=>ap;function yp(){return(0,v.useSyncExternalStore)(dp,vp,vp)}function bp(e){if(e!==`system`)return mp(e);op=!1,di(Jf),di(Yf),ap={...ap,mode:`system`},lp(np())}function xp(e,t){let n=Hf(t,e).id;fi(e===`light`?Xf:Zf,n),ap={...ap,[e]:n},lp(ip)}typeof document<`u`&&(lp(ip),window.matchMedia?.($f).addEventListener?.(`change`,()=>{!op&&ep()===null&&lp(np())}));var Sp=[{code:`en`,label:`English (EN)`},{code:`zh`,label:`中文 (ZH)`},{code:`ar`,label:`العربية (AR)`}],Cp=`omms-sidebar-collapsed`,wp=`omms-sidebar-settings-open`,Tp=`omms-sidebar-memory-open`,Ep=`omms-sidebar-profile-open`,Dp=`omms-sidebar-skills-open`,Op=`inline-flex min-h-11 min-w-11 md:min-h-8 md:min-w-7 items-center justify-center text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`;function kp(){try{let e=localStorage.getItem(wp);return e===null?null:e===`1`}catch{return null}}function Ap(){try{return localStorage.getItem(Cp)===`1`}catch{return!1}}function jp({open:e=!1,currentView:t,brand:n,projectLabel:r,profileLabel:i,chatLabel:a,skillsLabel:o=`Skills`,profileSections:s,skillsSections:c=[],settingsSections:l=[],memoryLabel:u=`Memory`,memorySections:d=[],memoryWarningLabel:f=``,memoryViewId:p=null,langLabel:m,languageLabel:h,themeLabel:g,settingsLabel:_,closeLabel:y,collapseLabel:b,expandLabel:x,onOpenChange:S,onLanguageSelect:C}){let w=_p()===`dark`,[T,E]=(0,v.useState)(!1),[D,O]=(0,v.useState)(!1),k=(0,v.useRef)(null),A=(0,v.useRef)(null),[j,M]=(0,v.useState)(Ap),N=e=>j?e:``,[P,ee]=(0,v.useState)(()=>kp()??t===`settings`),[F,I]=(0,v.useState)(()=>{try{let e=localStorage.getItem(Tp);return e===null?t===`memory`:e===`1`}catch{return t===`memory`}}),[te,L]=gd(Ep,t===`profile`),[ne,R]=gd(Dp,t===`skills`);function ie(){let e=!F;I(e);try{localStorage.setItem(Tp,e?`1`:`0`)}catch{}}function ae(){let e=!P;ee(e);try{localStorage.setItem(wp,e?`1`:`0`)}catch{}}function oe(){let e=!j;M(e);try{localStorage.setItem(Cp,e?`1`:`0`)}catch{}}(0,v.useEffect)(()=>{if(!T)return;k.current?.querySelector(`[aria-checked=true]`)?.focus();function e(e){k.current?.contains(e.target)||E(!1)}return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[T]);function se(e){if(e.key===`Escape`&&(e.preventDefault(),E(!1),A.current?.focus()),![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Array.from(k.current?.querySelectorAll(`[role=menuitemradio]`)??[]),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()}function le(e){S?.(e)}function ue(e,t){e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),gf(t),le(!1))}function de(e,t,n=`profile`){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),gf(n===`memory`?`${J.memory}/${t}`:`${J[n]}#${t}`),le(!1))}function fe(e){return V(`flex w-full min-w-0 min-h-11 md:min-h-9 items-center gap-2 rounded-[10px] px-3 py-2 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,N(`md:justify-center md:px-0`),e?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-sidebar-foreground hover:bg-interactive-hover active:bg-interactive-active`)}return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 bg-black/50 md:hidden`,"aria-label":y,onClick:()=>le(!1)}):null,(0,H.jsxs)(`aside`,{className:V(`inset-y-0 start-0 z-50 flex h-svh w-64 shrink-0 flex-col border-e border-sidebar-border bg-sidebar text-sidebar-foreground transition-[transform,width] duration-200`,N(`md:w-14`),`fixed md:sticky md:top-0 md:translate-x-0!`,e?`translate-x-0`:`max-md:-translate-x-full max-md:rtl:translate-x-full`),children:[(0,H.jsxs)(`div`,{className:V(`flex items-center gap-2 px-4 py-4`,N(`md:flex-col md:px-2`)),children:[(0,H.jsxs)(`a`,{href:J.home,className:`flex min-w-0 flex-1 items-center gap-2 rounded-lg transition-colors hover:opacity-90`,onClick:e=>ue(e,J.home),children:[(0,H.jsx)(`img`,{src:`/omms-icon.svg`,alt:``,width:20,height:20,className:`size-5 shrink-0 rounded-sm`}),(0,H.jsx)(Gd,{brand:n,className:N(`md:hidden`)})]}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-sm`,className:`hidden shrink-0 text-muted-foreground hover:text-primary md:inline-flex`,onClick:oe,"aria-label":j?x:b,"aria-expanded":!j,title:j?x:b,children:j?(0,H.jsx)(lt,{className:`size-4 rtl:-scale-x-100`}):(0,H.jsx)(ct,{className:`size-4 rtl:-scale-x-100`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-sm`,className:`md:hidden min-h-11 min-w-11 shrink-0`,onClick:()=>le(!1),"aria-label":y,children:(0,H.jsx)(Kt,{className:`size-4`})})]}),(0,H.jsx)(Pf,{className:`bg-sidebar-border`}),(0,H.jsxs)(`nav`,{className:V(`flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-3`,N(`md:px-2`)),"aria-label":`Main`,children:[xf({currentView:t,labels:{project:r,chat:a,profile:i,skills:o},collapsed:j,navClass:fe,onNavigate:ue,profileTree:{sections:s,open:te,onToggle:L,hideWhenCollapsed:N(`md:hidden`),onSectionClick:de},skillsTree:{sections:c,open:ne,onToggle:R,hideWhenCollapsed:N(`md:hidden`),onSectionClick:(e,t)=>de(e,t,`skills`)}}),(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,H.jsxs)(`a`,{href:J.memory,className:fe(t===`memory`),"aria-current":t===`memory`?`page`:void 0,title:j?u:void 0,onClick:e=>ue(e,J.memory),children:[(0,H.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:V(`min-w-0 break-words text-start`,N(`md:sr-only`)),children:u})]}),d.length>0?(0,H.jsx)(`button`,{type:`button`,className:V(`inline-flex min-h-11 min-w-11 md:min-h-7 md:min-w-7 shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,N(`md:hidden`)),onClick:ie,"aria-expanded":F,"aria-controls":`sidebar-memory-tree`,"aria-label":u,title:u,children:(0,H.jsx)(ce,{className:V(`size-4 transition-transform rtl:-scale-x-100`,F&&`rotate-90 rtl:rotate-90`)})}):null]}),F&&d.length>0?(0,H.jsx)(vd,{sections:d,currentView:t,memoryViewId:p,warningLabel:f,className:V(`ms-5 space-y-0.5 border-s border-sidebar-border ps-2`,N(`md:hidden`)),onSectionClick:de}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,H.jsxs)(`a`,{href:J.settings,className:fe(t===`settings`),"aria-current":t===`settings`?`page`:void 0,title:j?_:void 0,onClick:e=>ue(e,J.settings),children:[(0,H.jsx)(Dt,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:V(`min-w-0 break-words text-start`,N(`md:sr-only`)),children:_})]}),l.length>0?(0,H.jsx)(`button`,{type:`button`,className:V(`inline-flex min-h-11 min-w-11 md:min-h-7 md:min-w-7 shrink-0 items-center justify-center rounded-lg p-1.5 text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,N(`md:hidden`)),onClick:ae,"aria-expanded":P,"aria-controls":`sidebar-settings-tree`,"aria-label":_,title:_,children:(0,H.jsx)(ce,{className:V(`size-4 transition-transform rtl:-scale-x-100`,P&&`rotate-90 rtl:rotate-90`)})}):null]}),P&&l.length>0?(0,H.jsx)(`ul`,{id:`sidebar-settings-tree`,className:V(`ms-5 space-y-0.5 border-s border-sidebar-border ps-2`,N(`md:hidden`)),children:l.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`a`,{href:`${J.settings}#${e.id}`,className:`flex min-h-11 md:min-h-7 items-center break-words rounded-lg px-2.5 py-1 text-xs text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,onClick:t=>de(t,e.id,`settings`),children:e.label})},e.id))}):null]}),(0,H.jsxs)(`div`,{className:V(`mt-auto p-3`,N(`md:px-2`)),children:[(0,H.jsx)(Tf,{variant:`row`,className:`md:hidden`,onOpen:()=>O(!0)}),(0,H.jsxs)(`div`,{className:V(`flex w-fit items-center rounded-lg border border-sidebar-border/80 bg-card/70`,N(`md:mx-auto md:flex-col md:[&>*]:justify-center md:[&>*]:py-1.5 md:[&>*+*]:border-s-0 md:[&>*+*]:border-t md:[&>*]:rounded-none`)),children:[(0,H.jsxs)(`div`,{ref:k,className:`relative flex self-stretch`,onBlur:e=>{k.current?.contains(e.relatedTarget)||E(!1)},children:[(0,H.jsx)(`button`,{ref:A,type:`button`,className:`${Op} rounded-s-lg px-1.5 py-1.5 text-ui`,onClick:()=>E(e=>!e),"aria-label":`${h}: ${m}`,"aria-haspopup":`menu`,"aria-expanded":T,"aria-controls":`sidebar-language-menu`,title:h,children:(0,H.jsx)(`span`,{className:`text-xs tabular-nums`,children:m})}),T?(0,H.jsx)(`div`,{id:`sidebar-language-menu`,role:`menu`,"aria-label":h,onKeyDown:se,className:`absolute bottom-full start-0 z-10 mb-2 w-44 max-h-[60vh] overflow-y-auto rounded-lg border border-sidebar-border bg-card p-1 shadow-lg`,children:Sp.map(({code:e,label:t})=>(0,H.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":m.toLowerCase()===e,className:`flex min-h-11 md:min-h-9 w-full items-center rounded-md px-2.5 py-2 text-start text-ui text-card-foreground aria-checked:bg-selection hover:bg-interactive-hover focus-visible:bg-selection focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>{C?.(e),E(!1),A.current?.focus()},children:t},e))}):null]}),(0,H.jsx)(`button`,{type:`button`,className:`${Op} self-stretch border-s border-sidebar-border px-1.5`,onClick:()=>hp(),"aria-label":g,title:g,children:w?(0,H.jsx)(tt,{className:`size-4 rounded-md p-0.5`}):(0,H.jsx)(Nt,{className:`size-4 rounded-md p-0.5`})}),(0,H.jsx)(`a`,{href:J.settings,className:`${Op} self-stretch border-s border-sidebar-border px-1.5`,onClick:e=>ue(e,J.settings),"aria-label":_,title:_,"aria-current":t===`settings`?`page`:void 0,children:(0,H.jsx)(Dt,{className:`size-4`})}),(0,H.jsx)(Wd,{}),(0,H.jsx)(`a`,{href:`https://github.com/cmdaltctr/omms`,target:`_blank`,rel:`noopener noreferrer`,className:`${Op} self-stretch rounded-e-lg border-s border-sidebar-border px-1.5`,title:`GitHub`,"aria-label":`GitHub`,children:(0,H.jsx)(yd,{className:`size-4`})}),(0,H.jsx)(Tf,{onOpen:()=>O(!0),variant:j?`icon`:`inline`,className:V(`max-md:hidden`,j?`md:border-t md:border-sidebar-border`:`rounded-e-lg`)})]}),(0,H.jsx)(Ef,{open:D,onOpenChange:O})]})]})]})}var Mp=Object.defineProperty,Np=v.forwardRef(((e,t)=>Mp(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,H.jsx)(Mo.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`));function Pp({className:e,...t}){return(0,H.jsx)(Np,{"data-slot":`label`,className:V(`flex items-center gap-2 text-ui leading-normal select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Fp({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,dir:`auto`,className:V(`border-input placeholder:text-muted-foreground selection:bg-selection selection:text-foreground flex field-sizing-content min-h-16 w-full min-w-0 rounded-[10px] border bg-card px-2.5 py-2 text-ui [unicode-bidi:plaintext] transition-colors duration-150 outline-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`aria-invalid:ring-destructive aria-invalid:ring-1 aria-invalid:border-destructive`,e),...t})}function Ip({open:e=!1,content:t=``,onOpenChange:n,onSave:r}){let{t:i}=oa(),[a,o]=(0,v.useState)(``);(0,v.useEffect)(()=>{e&&o(t)},[e,t]);function s(e){n?.(e)}function c(e){e.preventDefault();let t=a.trim();t&&r?.(t)}return(0,H.jsx)(K,{open:e,onOpenChange:s,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:i(`modal-edit-title`)})}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:c,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`edit-content`,children:i(`label-content`)}),(0,H.jsx)(Fp,{id:`edit-content`,rows:6,value:a,onChange:e=>o(e.target.value),required:!0})]}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>s(!1),children:i(`btn-cancel`)}),(0,H.jsx)(G,{type:`submit`,children:i(`btn-save`)})]})]})]})})}function Lp({children:e,maxHeight:t,fade:n=`var(--card)`}){let{t:r}=oa(),i=(0,v.useId)(),a=(0,v.useRef)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=a.current;if(!e)return;let n=()=>l(e.offsetHeight>t);if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t]);let u=c&&!o;return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{id:i,className:`relative overflow-hidden`,style:u?{maxHeight:t}:void 0,"data-collapsed":u?`true`:void 0,children:[(0,H.jsx)(`div`,{ref:a,children:e}),u?(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-x-0 bottom-0 h-12`,style:{background:`linear-gradient(to top, ${n}, transparent)`}}):null]}),c?(0,H.jsxs)(G,{variant:`ghost`,size:`xs`,"aria-expanded":o,"aria-controls":i,onClick:()=>s(e=>!e),children:[o?(0,H.jsx)(le,{}):(0,H.jsx)(oe,{}),r(o?`btn-see-less`:`btn-see-more`)]}):null]})}var Rp=8;function zp({centre:e,half:t,left:n,right:r,gap:i}){let a=n+i+t,o=r-i-t;return a>o?(n+r)/2-e:Math.min(Math.max(e,a),o)-e}function Bp(e){return e.closest(`[data-tooltip-bounds]`)?.getBoundingClientRect()??null}function Vp({content:e,children:t,className:n}){let r=v.useId(),i=v.useRef(null),[a,o]=v.useState(0),s=v.isValidElement(t)?v.cloneElement(t,{"aria-describedby":r}):t,c=()=>{let e=i.current;if(!e)return;let t=e.parentElement.getBoundingClientRect(),n=e.offsetWidth/2,r=t.left+t.width/2,a=Bp(e),s=a?a.left:0,c=a?a.right:document.documentElement.clientWidth;o(zp({centre:r,half:n,left:s,right:c,gap:Rp}))};return(0,H.jsxs)(`span`,{className:V(`group/tooltip relative inline-flex`,n),onPointerEnter:c,onFocus:c,children:[s,(0,H.jsxs)(`span`,{ref:i,id:r,role:`tooltip`,style:{transform:`translateX(calc(-50% + ${a}px))`},className:`pointer-events-none absolute bottom-full left-1/2 z-30 mb-2 w-max max-w-[min(24rem,calc(100vw-1rem))] rounded-md border border-border bg-card px-2 py-1 text-xs whitespace-normal text-card-foreground opacity-0 shadow-sm transition-opacity duration-150 ease-in group-focus-within/tooltip:opacity-100 group-hover/tooltip:opacity-100`,children:[e,(0,H.jsx)(`span`,{"aria-hidden":`true`,style:{left:`calc(50% - ${a}px)`},className:`absolute top-full -mt-1 size-2 -translate-x-1/2 rotate-45 border-e border-b border-border bg-card`})]})]})}function Hp({type:e}){let{t}=oa();return(0,H.jsx)(Vp,{content:t(`tooltip-memory-type`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(rd,{variant:`outline`,"data-memory-type":e,tabIndex:0,className:`h-auto min-h-5 max-w-full shrink break-all whitespace-normal bg-transparent border-current [color:oklch(0.42_0.13_var(--memory-type-hue))] dark:[color:oklch(0.8_0.13_var(--memory-type-hue))]`,style:{"--memory-type-hue":String(ed(e))},children:e})})}var Up=/<pasted_content\b[^>]*>([\s\S]*?)<\/pasted_content[^>]*>|```[^\n]*\n([\s\S]*?)```/g;function Wp(e){return e.replace(/^\n+|\n+$/g,``)}function Gp(e){let t=[],n=e=>{let n=Wp(e);n.trim()&&t.push({kind:`text`,text:n})},r=0;for(let i of e.matchAll(Up)){n(e.slice(r,i.index));let a=i[1]!==void 0;t.push({kind:a?`pasted`:`code`,text:Wp(a?i[1]:i[2])}),r=i.index+i[0].length}return n(e.slice(r)),t}function Kp(e){let t=[],n=0;for(let r of e.matchAll(/`([^`\n]+)`/g))r.index>n&&t.push({code:!1,text:e.slice(n,r.index)}),t.push({code:!0,text:r[1]}),n=r.index+r[0].length;return n<e.length&&t.push({code:!1,text:e.slice(n)}),t}function qp({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background/60`,children:[e?(0,H.jsx)(`div`,{className:`border-b border-border px-3 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}):null,(0,H.jsx)(`pre`,{dir:`ltr`,className:`overflow-x-auto p-3 font-mono text-code leading-relaxed whitespace-pre-wrap break-words`,children:t})]})}function Jp({content:e}){let{t}=oa();return(0,H.jsx)(`div`,{className:`space-y-3`,children:Gp(e).map((e,n)=>e.kind===`pasted`?(0,H.jsx)(qp,{label:t(`label-pasted-content`),children:e.text},n):e.kind===`code`?(0,H.jsx)(qp,{children:e.text},n):(0,H.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:Kp(e.text).map((e,t)=>e.code?(0,H.jsx)(`code`,{className:`inline-code`,children:e.text},t):(0,H.jsx)(v.Fragment,{children:e.text},t))},n))})}var Yp=e=>e instanceof Date?e:new Date(e),Xp=()=>Ci($i(),typeof navigator>`u`?void 0:navigator.language);function Zp(e){return ki(Yp(e),Pi(),Xp())}function Qp(e){return Oi(Yp(e),Pi(),Xp())}function $p(e){return Di(Yp(e),Pi(),Xp())}function em(e,t=Pi()){return Ei(Yp(e),t,Xp())}function tm(){return{locale:Xp(),choice:Pi()}}function nm(e,t){return Oi(Yp(e),t,Xp())}function rm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function im(e){if(Array.isArray(e))return e}function am(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function om(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
58
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sm(e,t){return im(e)||am(e,t)||cm(e,t)||om()}function cm(e,t){if(e){if(typeof e==`string`)return rm(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rm(e,t):void 0}}var lm=Object.entries,um=Object.setPrototypeOf,dm=Object.isFrozen,fm=Object.getPrototypeOf,pm=Object.getOwnPropertyDescriptor,mm=Object.freeze,hm=Object.seal,gm=Object.create,_m=typeof Reflect<`u`&&Reflect,vm=_m.apply,ym=_m.construct;mm||=function(e){return e},hm||=function(e){return e},vm||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ym||=function(e){return new e(...[...arguments].slice(1))};var bm=Bm(Array.prototype.forEach),xm=Bm(Array.prototype.lastIndexOf),Sm=Bm(Array.prototype.pop),Cm=Bm(Array.prototype.push),wm=Bm(Array.prototype.splice),Tm=Array.isArray,Em=Bm(String.prototype.toLowerCase),Dm=Bm(String.prototype.toString),Om=Bm(String.prototype.match),km=Bm(String.prototype.replace),Am=Bm(String.prototype.indexOf),jm=Bm(String.prototype.trim),Mm=Bm(Number.prototype.toString),Nm=Bm(Boolean.prototype.toString),Pm=typeof BigInt>`u`?null:Bm(BigInt.prototype.toString),Fm=typeof Symbol>`u`?null:Bm(Symbol.prototype.toString),Im=Bm(Object.prototype.hasOwnProperty),Lm=Bm(Object.prototype.toString),Rm=Bm(RegExp.prototype.test),zm=Vm(TypeError);function Bm(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return vm(e,t,n)}}function Vm(e){return function(){return ym(e,[...arguments])}}function Hm(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Em;if(um&&um(e,null),!Tm(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(dm(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Um(e){for(let t=0;t<e.length;t++)Im(e,t)||(e[t]=null);return e}function Wm(e){let t=gm(null);for(let r of lm(e)){var n=sm(r,2);let i=n[0],a=n[1];Im(e,i)&&(t[i]=Tm(a)?Um(a):a&&typeof a==`object`&&a.constructor===Object?Wm(a):a)}return t}function Gm(e){switch(typeof e){case`string`:return e;case`number`:return Mm(e);case`boolean`:return Nm(e);case`bigint`:return Pm?Pm(e):`0`;case`symbol`:return Fm?Fm(e):`Symbol()`;case`undefined`:return Lm(e);case`function`:case`object`:{if(e===null)return Lm(e);let t=e,n=Km(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Lm(e)}return Lm(e)}default:return Lm(e)}}function Km(e,t){for(;e!==null;){let n=pm(e,t);if(n){if(n.get)return Bm(n.get);if(typeof n.value==`function`)return Bm(n.value)}e=fm(e)}function n(){return null}return n}function qm(e){try{return Rm(e,``),!0}catch{return!1}}var Jm=mm(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ym=mm(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Xm=mm([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Zm=mm([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Qm=mm(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),$m=mm([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),eh=mm([`#text`]),th=mm(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),nh=mm(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),rh=mm(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ih=mm([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ah=hm(/{{[\w\W]*|^[\w\W]*}}/g),oh=hm(/<%[\w\W]*|^[\w\W]*%>/g),sh=hm(/\${[\w\W]*/g),ch=hm(/^data-[\-\w.\u00B7-\uFFFF]+$/),lh=hm(/^aria-[\-\w]+$/),uh=hm(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dh=hm(/^(?:\w+script|data):/i),fh=hm(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ph=hm(/^html$/i),mh=hm(/^[a-z][.\w]*(-[.\w]+)+$/i),hh=hm(/<[/\w!]/g),gh=hm(/<[/\w]/g),_h=hm(/<\/no(script|embed|frames)/i),vh=hm(/\/>/i),yh={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},bh=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],xh=mm(Hm({},bh)),Sh=function(){let e={};return bm(bh,t=>{e[t]=hm(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),mm(e)}(),Ch=function(){return typeof window>`u`?null:window},wh=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Th=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Eh=function(e,t,n,r){return Im(e,t)&&Tm(e[t])?Hm(r.base?Wm(r.base):{},e[t],r.transform):n},Dh=function(e,t,n){let r=Im(e,t)?e[t]:void 0;return r&&typeof r==`object`?Wm(r):n()};function Oh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ch(),t=e=>Oh(e);if(t.version=`3.4.14`,t.removed=[],!e||!e.document||e.document.nodeType!==yh.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Km(d,`cloneNode`),p=Km(d,`remove`),m=Km(d,`nextSibling`),h=Km(d,`childNodes`),g=Km(d,`parentNode`),_=Km(d,`shadowRoot`),v=Km(d,`attributes`),y=o&&o.prototype?Km(o.prototype,`nodeType`):null,b=o&&o.prototype?Km(o.prototype,`nodeName`):null,x=o&&o.prototype?Km(o.prototype,`ownerDocument`):null,S=function(e){return y?y(e):e.nodeType},C=function(e){return b?b(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,T=``,E,D=!1,O=0,k=function(){if(O>0)throw zm(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},A=function(e){k(),O++;try{return w.createHTML(e)}finally{O--}},j=function(e){k(),O++;try{return w.createScriptURL(e)}finally{O--}},M=function(){return D||=(E=wh(u,i),!0),E},N=n,P=N.implementation,ee=N.createNodeIterator,F=N.createDocumentFragment,I=N.getElementsByTagName,te=r.importNode,L=Th();t.isSupported=typeof lm==`function`&&typeof g==`function`&&P&&P.createHTMLDocument!==void 0;let ne=ah,re=oh,R=sh,ie=ch,ae=lh,oe=dh,se=fh,ce=mh,le=uh,ue=null,de=Hm({},[...Jm,...Ym,...Xm,...Qm,...eh]),fe=null,pe=Hm({},[...th,...nh,...rh,...ih]),me=Object.seal(gm(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ge=null,_e=Object.seal(gm(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ve=!0,ye=!0,be=!1,xe=!0,Se=!1,Ce=!0,we=!1,Te=!1,Ee=null,De=null,Oe=!1,ke=!1,Ae=!1,je=!1,Me=!0,Ne=!1,Pe=`user-content-`,Fe=!0,Ie=!1,Le={},Re=null,ze=Hm({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Be=null,Ve=Hm({},[`audio`,`video`,`img`,`source`,`image`,`track`]),He=null,Ue=Hm({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),We=`http://www.w3.org/1998/Math/MathML`,Ge=`http://www.w3.org/2000/svg`,Ke=`http://www.w3.org/1999/xhtml`,qe=Ke,Je=!1,Ye=null,Xe=Hm({},[We,Ge,Ke],Dm),Ze=mm([`mi`,`mo`,`mn`,`ms`,`mtext`]),Qe=Hm({},Ze),$e=mm([`annotation-xml`]),et=Hm({},$e),tt=Hm({},[`title`,`style`,`font`,`a`,`script`]),nt=null,rt=[`application/xhtml+xml`,`text/html`],it=null,at=null,ot=n.createElement(`form`),st=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(at&&at===e)return;(!e||typeof e!=`object`)&&(e={}),e=Wm(e),nt=rt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,it=nt===`application/xhtml+xml`?Dm:Em,ue=Eh(e,`ALLOWED_TAGS`,de,{transform:it}),fe=Eh(e,`ALLOWED_ATTR`,pe,{transform:it}),Ye=Eh(e,`ALLOWED_NAMESPACES`,Xe,{transform:Dm}),He=Eh(e,`ADD_URI_SAFE_ATTR`,Ue,{transform:it,base:Ue}),Be=Eh(e,`ADD_DATA_URI_TAGS`,Ve,{transform:it,base:Ve}),Re=Eh(e,`FORBID_CONTENTS`,ze,{transform:it}),he=Eh(e,`FORBID_TAGS`,Wm({}),{transform:it}),ge=Eh(e,`FORBID_ATTR`,Wm({}),{transform:it}),Le=Im(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Wm(e.USE_PROFILES):e.USE_PROFILES:!1,ve=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=e.SAFE_FOR_TEMPLATES||!1,Ce=e.SAFE_FOR_XML!==!1,we=e.WHOLE_DOCUMENT||!1,ke=e.RETURN_DOM||!1,Ae=e.RETURN_DOM_FRAGMENT||!1,je=e.RETURN_TRUSTED_TYPE||!1,Oe=e.FORCE_BODY||!1,Me=e.SANITIZE_DOM!==!1,Ne=e.SANITIZE_NAMED_PROPS||!1,Fe=e.KEEP_CONTENT!==!1,Ie=e.IN_PLACE||!1,le=qm(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:uh,qe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ke,Qe=Dh(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Hm({},Ze)),et=Dh(e,`HTML_INTEGRATION_POINTS`,()=>Hm({},$e));let t=Dh(e,`CUSTOM_ELEMENT_HANDLING`,()=>gm(null));if(me=gm(null),Im(t,`tagNameCheck`)&&st(t.tagNameCheck)&&(me.tagNameCheck=t.tagNameCheck),Im(t,`attributeNameCheck`)&&st(t.attributeNameCheck)&&(me.attributeNameCheck=t.attributeNameCheck),Im(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(me.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),hm(me),Se&&(ye=!1),Ae&&(ke=!0),Le&&(ue=Hm({},eh),fe=gm(null),Le.html===!0&&(Hm(ue,Jm),Hm(fe,th)),Le.svg===!0&&(Hm(ue,Ym),Hm(fe,nh),Hm(fe,ih)),Le.svgFilters===!0&&(Hm(ue,Xm),Hm(fe,nh),Hm(fe,ih)),Le.mathMl===!0&&(Hm(ue,Qm),Hm(fe,rh),Hm(fe,ih))),_e.tagCheck=null,_e.attributeCheck=null,Im(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?_e.tagCheck=e.ADD_TAGS:Tm(e.ADD_TAGS)&&(ue===de&&(ue=Wm(ue)),Hm(ue,e.ADD_TAGS,it))),Im(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?_e.attributeCheck=e.ADD_ATTR:Tm(e.ADD_ATTR)&&(fe===pe&&(fe=Wm(fe)),Hm(fe,e.ADD_ATTR,it))),Im(e,`ADD_FORBID_CONTENTS`)&&Tm(e.ADD_FORBID_CONTENTS)&&(Re===ze&&(Re=Wm(Re)),Hm(Re,e.ADD_FORBID_CONTENTS,it)),Fe&&(ue[`#text`]=!0),we&&Hm(ue,[`html`,`head`,`body`]),ue.table&&(Hm(ue,[`tbody`]),delete he.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw zm(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw zm(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=w;w=e.TRUSTED_TYPES_POLICY;try{T=A(``)}catch(e){throw w=t,e}}else e.TRUSTED_TYPES_POLICY===null?(w=void 0,T=``):(w===void 0&&(w=M()),w&&typeof T==`string`&&(T=A(``)));mm&&mm(e),at=e},lt=Hm({},[...Ym,...Xm,...Zm]),ut=Hm({},[...Qm,...$m]),dt=function(e,t,n){return t.namespaceURI===Ke?e===`svg`:t.namespaceURI===We?e===`svg`&&(n===`annotation-xml`||Qe[n]):!!lt[e]},ft=function(e,t,n){return t.namespaceURI===Ke?e===`math`:t.namespaceURI===Ge?e===`math`&&et[n]:!!ut[e]},pt=function(e,t,n){return t.namespaceURI===Ge&&!et[n]||t.namespaceURI===We&&!Qe[n]?!1:!ut[e]&&(tt[e]||!lt[e])},mt=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:qe,tagName:`template`});let n=Em(e.tagName),r=Em(t.tagName);return Ye[e.namespaceURI]?e.namespaceURI===Ge?dt(n,t,r):e.namespaceURI===We?ft(n,t,r):e.namespaceURI===Ke?pt(n,t,r):!!(nt===`application/xhtml+xml`&&Ye[e.namespaceURI]):!1},ht=function(e){Cm(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw zm(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gt=function(e,t,n){try{e.removeAttributeNode(t)}catch{try{e.removeAttribute(n)}catch{}}},_t=function(e){bt(e);let t=h(e);if(t){let e=[];bm(t,t=>{Cm(e,t)}),bm(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&gt(e,r,i)}},vt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Cm(t.removed,{attribute:r||null,from:n});try{r?n.removeAttributeNode(r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(ke||Ae)try{ht(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},yt=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||fe[it(i)]||gt(e,r,i)}},bt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();S(e)===yh.element&&yt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},xt=function(e,t){return Ce?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},St=function(e){if(!Ce)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=S(e);if(n===yh.processingInstruction||n===yh.comment&&Rm(gh,e.data)){try{p(e)}catch{}continue}if(n===yh.element){let t=e,n=it(C(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&xt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Ct=function(e){let t=null,r=null;if(Oe)e=`<remove></remove>`+e;else{let t=Om(e,/^[\r\n\t ]+/);r=t&&t[0]}nt===`application/xhtml+xml`&&qe===Ke&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=w?A(e):e;if(qe===Ke)try{t=new l().parseFromString(i,nt)}catch{}if(!t||!t.documentElement){t=P.createDocument(qe,`template`,null);try{t.documentElement.innerHTML=Je?T:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),qe===Ke?I.call(t,we?`html`:`body`)[0]:we?t.documentElement:a},wt=function(e){let t=x?x(e):e.ownerDocument;return ee.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Tt=function(e){return e=km(e,ne,` `),e=km(e,re,` `),e=km(e,R,` `),e},Et=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=ee.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Tt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&bm(i,e=>{Ot(e.content)&&Et(e.content)})},Dt=function(e){let t=b?b(e):null;return typeof t!=`string`||it(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},Ot=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===yh.documentFragment}catch{return!1}},kt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function At(e,n,r){e.length!==0&&bm(e,e=>{e.call(t,n,r,at)})}let jt=function(e,t){return!!(Ce&&e.hasChildNodes()&&!kt(e.firstElementChild)&&Rm(hh,e.textContent)&&Rm(hh,e.innerHTML)||Ce&&e.namespaceURI===Ke&&xh[t]&&(kt(e.firstElementChild)||typeof e.textContent==`string`&&Rm(Sh[t],e.textContent))||e.nodeType===yh.processingInstruction||Ce&&e.nodeType===yh.comment&&Rm(gh,e.data))},Mt=function(e,t){return e instanceof RegExp?Rm(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Nt=function(e,t,n){if(!he[t]&&zt(t)&&Mt(me.tagNameCheck,t))return!1;if(Fe&&!Re[t]){let t=g(e),r=h(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,m(e))}}}return ht(e),!0},Pt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Wm(t):t},Ft=function(e,t){return e===t||g(e)!==null?!1:(Ie&&bt(e),!0)},It=function(e,n){if(At(L.beforeSanitizeElements,e,null),Ft(e,n))return!0;if(Dt(e))return ht(e),!0;let r=it(C(e));if(ue=Pt(L.uponSanitizeElement,ue,de,Ee),At(L.uponSanitizeElement,e,{tagName:r,allowedTags:ue}),Ft(e,n))return!0;if(jt(e,r))return ht(e),!0;if(he[r]||!(_e.tagCheck instanceof Function&&_e.tagCheck(r))&&!ue[r]){let t=Nt(e,r,n);return t===!1&&At(L.afterSanitizeElements,e,null),t}if(S(e)===yh.element&&!mt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Rm(_h,e.innerHTML))return ht(e),!0;if(Se&&e.nodeType===yh.text){let n=Tt(e.textContent);e.textContent!==n&&(Cm(t.removed,{element:e.cloneNode()}),e.textContent=n)}return At(L.afterSanitizeElements,e,null),!1},Lt=function(e,t,r){if(ge[t]||xt(t,e)||Me&&(t===`id`||t===`name`)&&(r in n||r in ot))return!1;let i=fe[t]||_e.attributeCheck instanceof Function&&_e.attributeCheck(t,e);return ye&&Rm(ie,t)||ve&&Rm(ae,t)?!0:i?He[t]||Rm(le,km(r,se,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Am(r,`data:`)===0&&Be[e]||be&&!Rm(oe,km(r,se,``))?!0:!r:zt(e)&&Mt(me.tagNameCheck,e)&&Mt(me.attributeNameCheck,t,e)||t===`is`&&me.allowCustomizedBuiltInElements&&Mt(me.tagNameCheck,r)},Rt=Hm({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),zt=function(e){return!Rt[Em(e)]&&Rm(ce,e)},Bt=function(e,t,n,r){if(w&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return A(r);case`TrustedScriptURL`:return j(r)}return r},Vt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Dt(e)?ht(e):Sm(t.removed)}catch{vt(n,e)}},Ht=function(e){At(L.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Dt(e))return;fe=Pt(L.uponSanitizeAttribute,fe,pe,De);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:fe,forceKeepAttr:void 0},r=t.length,i=it(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=it(o),u=c,d=o===`value`?u:jm(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,At(L.uponSanitizeAttribute,e,n),d=n.attrValue,Ne&&(l===`id`||l===`name`)&&Am(d,Pe)!==0&&(vt(o,e,a),d=Pe+d),Ce&&Rm(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){vt(o,e,a);continue}if(l===`attributename`&&Om(d,`href`)){vt(o,e,a);continue}if(!n.forceKeepAttr){if(!n.keepAttr){vt(o,e,a);continue}if(!xe&&Rm(vh,d)){vt(o,e,a);continue}if(Se&&(d=Tt(d)),!Lt(i,l,d)){vt(o,e,a);continue}d=Bt(i,l,s,d),d!==u&&Vt(e,o,s,d)}}At(L.afterSanitizeAttributes,e,null)},Ut=function(e){let t=null,n=wt(e);for(At(L.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(At(L.uponSanitizeShadowNode,t,null),It(t,e),Ht(t),Ot(t.content)&&Ut(t.content),S(t)===yh.element){let e=_(t);Ot(e)&&(Wt(e),Ut(e))}At(L.afterSanitizeShadowDOM,e,null)},Wt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ut(e.shadow);continue}let n=e.node,r=S(n)===yh.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&it(e)===`template`){let e=n.content;Ot(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);Ot(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Je=!e,Je&&(e=`<!-->`),typeof e!=`string`&&!kt(e)&&(e=Gm(e),typeof e!=`string`))throw zm(`dirty is not a string, aborting`);if(!t.isSupported)return e;Te?(ue=Ee,fe=De):ct(n),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(ue=Wm(ue)),L.uponSanitizeAttribute.length>0&&(fe=Wm(fe)),t.removed=[];let c=Ie&&typeof e!=`string`&&kt(e);if(c){St(e);let t=C(e);if(typeof t==`string`){let n=it(t);if(!ue[n]||he[n])throw _t(e),zm(`root node is forbidden and cannot be sanitized in-place`)}if(Dt(e))throw _t(e),zm(`root node is clobbered and cannot be sanitized in-place`);try{Wt(e)}catch(t){throw _t(e),t}}else if(kt(e))i=Ct(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===yh.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Wt(a);else{if(!ke&&!Se&&!we&&e.indexOf(`<`)===-1)return w&&je?A(e):e;if(i=Ct(e),!i)return ke?null:je?T:``}i&&Oe&&ht(i.firstChild);let l=c?e:i;try{let e=wt(l);for(;o=e.nextNode();)It(o,l),Ht(o),Ot(o.content)&&Ut(o.content)}catch(n){throw c&&(_t(e),bm(t.removed,e=>{e.element&&bt(e.element)})),n}if(c)return bm(t.removed,e=>{e.element&&bt(e.element)}),Se&&Et(e),e;if(ke){if(Se&&Et(i),Ae)for(s=F.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(fe.shadowroot||fe.shadowrootmode)&&(s=te.call(r,s,!0)),s}let u=we?i.outerHTML:i.innerHTML;return we&&ue[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Rm(ph,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
59
+ `+u),Se&&(u=Tt(u)),w&&je?A(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(e),Te=!0,Ee=ue,De=fe},t.clearConfig=function(){at=null,Te=!1,Ee=null,De=null,w=E,T=``},t.isValidAttribute=function(e,t,n){at||ct({});let r=it(e),i=it(t);return Lt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Im(L,e)&&Cm(L[e],t)},t.removeHook=function(e,t){if(Im(L,e)){if(t!==void 0){let n=xm(L[e],t);return n===-1?void 0:wm(L[e],n,1)[0]}return Sm(L[e])}},t.removeHooks=function(e){Im(L,e)&&(L[e]=[])},t.removeAllHooks=function(){L=Th()},t}var kh=Oh();function Ah(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var jh=Ah();function Mh(e){jh=e}var Nh={exec:()=>null};function Ph(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Fh(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Lh.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ih=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Lh={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Ph(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Ph(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Ph(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Ph(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Ph(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Ph(e=>RegExp(`^ {0,${e}}>`))},Rh=/^(?:[ \t]*(?:\n|$))+/,zh=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Hh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Uh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Wh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Gh=Fh(Wh).replace(/bull/g,Uh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Kh=Fh(Wh).replace(/bull/g,Uh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),qh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Jh=/^[^\n]+/,Yh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Xh=Fh(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Yh).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Zh=Fh(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Uh).getRegex(),Qh=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,$h=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,eg=Fh(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,$h).replace(`tag`,Qh).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tg=e=>Fh(qh).replace(`hr`,Vh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Qh).getRegex(),ng=tg(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),rg=tg(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ig={blockquote:Fh(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,rg).getRegex(),code:zh,def:Xh,fences:Bh,heading:Hh,hr:Vh,html:eg,lheading:Gh,list:Zh,newline:Rh,paragraph:ng,table:Nh,text:Jh},ag=Fh(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Vh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Qh).getRegex(),og={...ig,lheading:Kh,table:ag,paragraph:Fh(qh).replace(`hr`,Vh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ag).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Qh).getRegex()},sg={...ig,html:Fh(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,$h).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Nh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Fh(qh).replace(`hr`,Vh).replace(`heading`,` *#{1,6} *[^
60
+ ]`).replace(`lheading`,Gh).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},cg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ug=/^( {2,}|\\)\n(?!\s*$)/,dg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,fg=/[\p{P}\p{S}]/u,pg=/[\s\p{P}\p{S}]/u,mg=/[^\s\p{P}\p{S}]/u,hg=Fh(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,pg).getRegex(),gg=/[\p{Pi}\p{Ps}"']/u,_g=/(?!~)[\p{P}\p{S}]/u,vg=/(?!~)[\s\p{P}\p{S}]/u,yg=/(?:[^\s\p{P}\p{S}]|~)/u,bg=Fh(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Ih?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),xg=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Sg=Fh(xg,`u`).replace(/punct/g,fg).getRegex(),Cg=Fh(xg,`u`).replace(/punct/g,_g).getRegex(),wg=Fh(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,gg).replace(/punct/g,fg).getRegex(),Tg=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Eg=Fh(Tg,`gu`).replace(/notPunctSpace/g,mg).replace(/punctSpace/g,pg).replace(/punct/g,fg).getRegex(),Dg=Fh(Tg,`gu`).replace(/notPunctSpace/g,yg).replace(/punctSpace/g,vg).replace(/punct/g,_g).getRegex(),Og=Fh(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,mg).replace(/punctSpace/g,pg).replace(/punct/g,fg).getRegex(),kg=Fh(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,mg).replace(/punctSpace/g,pg).replace(/punct/g,fg).getRegex(),Ag=Fh(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,mg).replace(/punctSpace/g,pg).replace(/punct/g,fg).getRegex(),jg=Fh(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,fg).getRegex(),Mg=Fh(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,mg).replace(/punctSpace/g,pg).replace(/punct/g,fg).getRegex(),Ng=Fh(/\\(punct)/,`gu`).replace(/punct/g,fg).getRegex(),Pg=Fh(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Fg=Fh($h).replace(`(?:-->|$)`,`-->`).getRegex(),Ig=Fh(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Fg).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Lg=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Rg=Fh(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Lg).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zg=Fh(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Lg).replace(`ref`,Yh).getRegex(),Bg=Fh(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Yh).getRegex(),Vg=Fh(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,zg).replace(`nolink`,Bg).getRegex(),Hg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ug={_backpedal:Nh,anyPunctuation:Ng,autolink:Pg,blockSkip:bg,br:ug,code:lg,del:Nh,delLDelim:Nh,delRDelim:Nh,emStrongLDelim:Sg,emStrongRDelimAst:Eg,emStrongRDelimUnd:kg,escape:cg,link:Rg,nolink:Bg,punctuation:hg,reflink:zg,reflinkSearch:Vg,tag:Ig,text:dg,url:Nh},Wg={...Ug,emStrongLDelim:wg,emStrongRDelimAst:Og,emStrongRDelimUnd:Ag,link:Fh(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Lg).getRegex(),reflink:Fh(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Lg).getRegex()},Gg={...Ug,emStrongRDelimAst:Dg,emStrongLDelim:Cg,delLDelim:jg,delRDelim:Mg,url:Fh(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Hg).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Fh(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Hg).getRegex()},Kg={...Gg,br:Fh(ug).replace(`{2,}`,`*`).getRegex(),text:Fh(Gg.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},qg={normal:ig,gfm:og,pedantic:sg},Jg={normal:Ug,gfm:Gg,breaks:Kg,pedantic:Wg},Yg={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Xg=e=>Yg[e];function Zg(e,t){if(t){if(Lh.escapeTest.test(e))return e.replace(Lh.escapeReplace,Xg)}else if(Lh.escapeTestNoEncode.test(e))return e.replace(Lh.escapeReplaceNoEncode,Xg);return e}function Qg(e){try{e=encodeURI(e).replace(Lh.percentDecode,`%`)}catch{return null}return e}function $g(e,t){let n=e.replace(Lh.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Lh.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Lh.slashPipe,`|`);return n}function e_(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function t_(e){let t=e.split(`
61
+ `),n=t.length-1;for(;n>=0&&Lh.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
62
+ `)}function n_(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function r_(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function i_(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function a_(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
63
63
  `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
64
- `)}var i_=class{options;rules;lexer;constructor(e){this.options=e||kh}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:$g(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=r_(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Qg(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Qg(t[0],`
65
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Qg(t[0],`
66
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Qg(t[0],`
64
+ `)}var o_=class{options;rules;lexer;constructor(e){this.options=e||jh}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:t_(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=a_(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=e_(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:e_(t[0],`
65
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:e_(t[0],`
66
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=e_(t[0],`
67
67
  `).split(`
68
68
  `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
69
69
  `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
@@ -75,20 +75,20 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
75
75
  ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
76
76
  `+e.join(`
77
77
  `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
78
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t_(t[2].split(`
78
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=r_(t[2].split(`
79
79
  `,1)[0],t[1].length),l=e.split(`
80
80
  `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
81
81
  `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
82
82
  `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
83
83
  `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
84
84
  `+l}u=!l.trim(),r+=p+`
85
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=$g(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Qg(t[0],`
86
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Zg(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
87
- `):[],a={type:`table`,raw:Qg(t[0],`
88
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Zg(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Qg(t[0],`
85
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=t_(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:e_(t[0],`
86
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=$g(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
87
+ `):[],a={type:`table`,raw:e_(t[0],`
88
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push($g(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:e_(t[0],`
89
89
  `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
90
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Qg(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=e_(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),n_(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return n_(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},a_=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||kh,this.options.tokenizer=this.options.tokenizer||new i_,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:Fh,block:Gg.normal,inline:Kg.normal};this.options.pedantic?(t.block=Gg.pedantic,t.inline=Kg.pedantic):this.options.gfm&&(t.block=Gg.gfm,t.inline=this.options.breaks?Kg.breaks:Kg.gfm),this.tokenizer.rules=t}static get rules(){return{block:Gg,inline:Kg}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Fh.carriageReturn,`
91
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Fh.tabCharGlobal,` `).replace(Fh.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
90
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=e_(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=n_(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),i_(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return i_(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},s_=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||jh,this.options.tokenizer=this.options.tokenizer||new o_,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:Lh,block:qg.normal,inline:Jg.normal};this.options.pedantic?(t.block=qg.pedantic,t.inline=Jg.pedantic):this.options.gfm&&(t.block=qg.gfm,t.inline=this.options.breaks?Jg.breaks:Jg.gfm),this.tokenizer.rules=t}static get rules(){return{block:qg,inline:Jg}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Lh.carriageReturn,`
91
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Lh.tabCharGlobal,` `).replace(Lh.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
92
92
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
93
93
  `)?``:`
94
94
  `)+i.raw,n.text+=`
@@ -101,9 +101,9 @@ ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){
101
101
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
102
102
  `)?``:`
103
103
  `)+i.raw,n.text+=`
104
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,n.slice(r+1,-1)))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},o_=class{options;parser;constructor(e){this.options=e||kh}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Fh.notSpaceStart)?.[0],i=e.replace(Fh.endingNewline,``)+`
105
- `;return r?`<pre><code class="language-`+Yg(r)+`">`+(n?i:Yg(i,!0))+`</code></pre>
106
- `:`<pre><code>`+(n?i:Yg(i,!0))+`</code></pre>
104
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,n.slice(r+1,-1)))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},c_=class{options;parser;constructor(e){this.options=e||jh}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Lh.notSpaceStart)?.[0],i=e.replace(Lh.endingNewline,``)+`
105
+ `;return r?`<pre><code class="language-`+Zg(r)+`">`+(n?i:Zg(i,!0))+`</code></pre>
106
+ `:`<pre><code>`+(n?i:Zg(i,!0))+`</code></pre>
107
107
  `}blockquote({tokens:e}){return`<blockquote>
108
108
  ${this.parser.parse(e)}</blockquote>
109
109
  `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -119,49 +119,51 @@ ${this.parser.parse(e)}</blockquote>
119
119
  `}tablerow({text:e}){return`<tr>
120
120
  ${e}</tr>
121
121
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
122
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Yg(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Xg(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Yg(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Xg(e);if(i===null)return Yg(n);e=i;let a=`<img src="${e}" alt="${Yg(n)}"`;return t&&(a+=` title="${Yg(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Yg(e.text)}},s_=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},c_=class e{options;renderer;textRenderer;constructor(e){this.options=e||kh,this.options.renderer=this.options.renderer||new o_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new s_}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},l_=class{options;block;constructor(e){this.options=e||kh}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?a_.lex:a_.lexInline}provideParser(e=this.block){return e?c_.parse:c_.parseInline}},u_=new class{defaults=Oh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=c_;Renderer=o_;TextRenderer=s_;Lexer=a_;Tokenizer=i_;Hooks=l_;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new o_(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new i_(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new l_;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=l_.passThroughHooks.has(n)?e=>{if(this.defaults.async&&l_.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return a_.lex(e,t??this.defaults)}parser(e,t){return c_.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?a_.lex:a_.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?c_.parse:c_.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?a_.lex:a_.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?c_.parse:c_.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
123
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Yg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function d_(e,t){return u_.parse(e,t)}d_.options=d_.setOptions=function(e){return u_.setOptions(e),d_.defaults=u_.defaults,Ah(d_.defaults),d_},d_.getDefaults=Oh,d_.defaults=kh;function f_(...e){return u_.use(...e),d_.defaults=u_.defaults,Ah(d_.defaults),d_}d_.use=f_,d_.walkTokens=function(e,t){return u_.walkTokens(e,t)},d_.parseInline=u_.parseInline,d_.Parser=c_,d_.parser=c_.parse,d_.Renderer=o_,d_.TextRenderer=s_,d_.Lexer=a_,d_.lexer=a_.lex,d_.Tokenizer=i_,d_.Hooks=l_,d_.parse=d_,d_.options,d_.setOptions,d_.walkTokens,d_.parseInline,c_.parse,a_.lex,d_.setOptions({gfm:!0,breaks:!0});function p_(e){let t=d_.parse(e,{async:!1});return Dh.sanitize(t)}var m_=320,h_=240;function g_(e){if(e.projectPath){let t=e.projectPath.replace(/\\/g,`/`).split(`/`).filter(e=>e);return t[t.length-1]||e.projectPath}return e.displayName||e.id}function __(e){return{createdDate:Yp(e.createdAt),updatedDate:e.updatedAt&&e.updatedAt!==e.createdAt?Yp(e.updatedAt):null}}function v_(e,t){return e.similarity===void 0?null:t?`${Math.round(e.similarity*100)}%`:`${e.similarity}%`}function y_({variant:e,item:t,memory:n,prompt:r,selected:i=!1,onSelect:a,onPin:o,onUnpin:s,onEdit:c,onDeleteMemory:l,onDeletePrompt:u,activeKeyword:d,onKeywordClick:f}){let{t:p}=oa();if(e===`pair`&&n&&r){let e=n.isPinned||!1,t=__(n),u=v_(n,!0);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-3 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":n.id,children:[(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-muted p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:p(`badge-prompt`)}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Yp(r.createdAt)})]}),(0,H.jsx)(Lp,{maxHeight:h_,fade:`var(--muted)`,children:(0,H.jsx)(Kp,{content:r.content})})]}),(0,H.jsx)(`div`,{className:`flex justify-center text-muted-foreground`,children:(0,H.jsx)(M,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(n.id,e===!0)}),(0,H.jsx)(rd,{children:p(`badge-memory`)}),n.memoryType?(0,H.jsx)(Bp,{type:n.memoryType}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(rd,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:n.displayName||n.id})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(n.id),children:(0,H.jsx)(mt,{className:`size-3.5 fill-current`})}):(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(n.id),children:(0,H.jsx)(mt,{className:`size-3.5`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(n.id),children:(0,H.jsx)(ft,{className:`size-3.5`})}),(0,H.jsx)(zp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(`btn-delete-pair`),onClick:()=>l?.(n.id,!0),children:(0,H.jsx)(Lt,{className:`size-3.5`})})})]})]}),n.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.tags.map(e=>(0,H.jsx)(zp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(td,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Lp,{maxHeight:m_,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:p_(n.content)}})})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,t.createdDate]}),t.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,t.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,n.id]})]})]})]})}if(e===`prompt`&&t){let e=!!t.linkedMemoryId;return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),(0,H.jsx)(Xe,{className:`size-3.5 text-muted-foreground`}),(0,H.jsx)(rd,{variant:`secondary`,children:p(`badge-prompt`)}),e?(0,H.jsxs)(rd,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Yp(t.createdAt)})]}),e?(0,H.jsx)(zp,{content:p(`tooltip-delete-prompt-pair`),children:(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Lt,{className:`size-3.5`})})}):(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Lt,{className:`size-3.5`})})]}),(0,H.jsx)(Lp,{maxHeight:h_,children:(0,H.jsx)(Kp,{content:t.content})}),e?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(M,{className:`size-3`}),p(`text-generated-above`),(0,H.jsx)(ee,{className:`size-3`})]}):null]})}if(e===`memory`&&t){let e=t.isPinned||!1,n=!!t.linkedPromptId,r=__(t),u=v_(t,!1);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),t.memoryType?(0,H.jsx)(Bp,{type:t.memoryType}):null,n?(0,H.jsxs)(rd,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(rd,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:g_(t)}),t.projectPath?(0,H.jsx)(`span`,{dir:`ltr`,className:`text-code text-muted-foreground font-mono break-all w-full`,children:t.projectPath}):null]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(t.id),children:(0,H.jsx)(mt,{className:`size-3.5 fill-current`})}):(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(t.id),children:(0,H.jsx)(mt,{className:`size-3.5`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(t.id),children:(0,H.jsx)(ft,{className:`size-3.5`})}),n?(0,H.jsx)(zp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Lt,{className:`size-3.5`})})}):(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Lt,{className:`size-3.5`})})]})]}),t.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.tags.map(e=>(0,H.jsx)(zp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(td,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Lp,{maxHeight:m_,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:p_(t.content)}})})}),n?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(ee,{className:`size-3`}),p(`text-from-below`),(0,H.jsx)(M,{className:`size-3`})]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,r.createdDate]}),r.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,r.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,t.id]})]})]})}return null}function b_(e){let t=new Map(e.map(e=>[e.id,e])),n=[],r=new Set;for(let i of e)if(!r.has(i.id)){if(i.type===`memory`&&i.linkedPromptId&&t.has(i.linkedPromptId)){let e=t.get(i.linkedPromptId);n.push({isPair:!0,memory:i,prompt:e}),r.add(i.id),r.add(e.id)}else if(i.type===`prompt`&&i.linkedMemoryId&&t.has(i.linkedMemoryId)){let e=t.get(i.linkedMemoryId);n.push({isPair:!0,memory:e,prompt:i}),r.add(i.id),r.add(e.id)}else n.push({isPair:!1,type:i.type,item:i}),r.add(i.id)}return n.sort((e,t)=>{let n=e.isPair?e.memory.createdAt:e.item.createdAt,r=t.isPair?t.memory.createdAt:t.item.createdAt;return new Date(r).getTime()-new Date(n).getTime()})}function x_({memories:e,selectedIds:t,currentPage:n,totalPages:r,loading:i=!1,error:a=null,onSelect:o,onPageChange:s,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m}){let{t:h}=oa(),g=(0,v.useMemo)(()=>b_(e),[e]),_=h(`text-page`,{current:n,total:r}),y=(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(G,{variant:`outline`,size:`icon-xs`,disabled:!(n>1),onClick:()=>s(-1),children:(0,H.jsx)(se,{className:`size-3.5`})}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:_}),(0,H.jsx)(G,{variant:`outline`,size:`icon-xs`,disabled:!(n<r),onClick:()=>s(1),children:(0,H.jsx)(ce,{className:`size-3.5`})})]});return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{className:`grid min-h-32 items-start gap-3 lg:grid-cols-2`,children:i&&e.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`loading-init`)}):a?(0,H.jsxs)(`div`,{className:`text-sm text-destructive py-8 text-center`,children:[`Error: `,a]}):g.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`empty-memories`)}):g.map(e=>e.isPair?(0,H.jsx)(y_,{variant:`pair`,memory:e.memory,prompt:e.prompt,selected:t.has(e.memory.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.memory.id):e.type===`prompt`?(0,H.jsx)(y_,{variant:`prompt`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id):(0,H.jsx)(y_,{variant:`memory`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id))}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:y})]})}function S_(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=!1;return li.status().then(t=>{e||n(t.success?t.data??null:null)}),()=>{e=!0}},[e,r]),{record:t,reload:(0,v.useCallback)(()=>i(e=>e+1),[])}}function C_(e){return e!==null}function w_(e){return{createdAt:e.createdAt,merged:e.merged,removed:e.removed}}function T_(e,t){return e===`idle`&&t===`open`?`confirming`:e===`confirming`&&t===`cancel`?`idle`:e===`confirming`&&t===`confirm`?`working`:e===`working`&&t===`done`?`idle`:e}function E_(e,t){return e===`confirming`&&t===`confirm`}function D_(e){return{key:e.notFound>0?`toast-auto-cleanup-undone-partial`:`toast-auto-cleanup-undone`,params:{restored:e.restored,notFound:e.notFound}}}function O_({version:e,onUndone:t}){let{t:n}=oa(),{record:r,reload:i}=S_(e),[a,o]=(0,v.useState)(`idle`);if(!C_(r)||!r)return null;async function s(){if(!E_(a,`confirm`))return;o(T_(a,`confirm`));let e=await li.undo();if(o(`idle`),i(),!e.success||!e.data){U.info(e.error||n(`toast-auto-cleanup-undo-failed`));return}let r=D_(e.data);U.success(n(r.key,r.params)),t?.()}let c=w_(r);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:()=>o(T_(a,`open`)),children:[(0,H.jsx)(Bt,{className:`size-3.5`}),n(`btn-auto-cleanup-undo`)]}),(0,H.jsx)(K,{open:a!==`idle`,onOpenChange:e=>{e||o(T_(a,`cancel`))},children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:n(`title-auto-cleanup-undo`)}),(0,H.jsx)(Wl,{children:n(`label-auto-cleanup-undo-body`,{when:Yp(new Date(c.createdAt).toISOString()),merged:c.merged,removed:c.removed})})]}),(0,H.jsxs)(Hl,{className:`gap-2`,children:[(0,H.jsx)(G,{variant:`secondary`,size:`sm`,disabled:a===`working`,onClick:()=>o(T_(a,`cancel`)),children:n(`btn-cancel`)}),(0,H.jsx)(G,{size:`sm`,disabled:a===`working`,onClick:()=>void s(),children:n(`btn-auto-cleanup-undo-confirm`)})]})]})})]})}var k_=Ba(`grid min-w-0 gap-0.5 rounded-xl border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_minmax(0,1fr)] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive-label bg-card *:data-[slot=alert-description]:text-destructive-label *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function A_({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:V(k_({variant:t}),e),...n})}function j_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-description`,className:V(`text-muted-foreground text-sm [&_p]:leading-relaxed col-start-2`,e),...t})}function M_(e){if(!e)return null;let t=e.status;switch(t.state){case`grouping`:return{kind:`grouping`};case`checking`:return t.total>0?{kind:`checking`,done:t.done,total:t.total}:{kind:`grouping`};case`done`:return{kind:`ready`,groups:t.preview.groups.length};case`failed`:return{kind:`failed`,error:t.error}}}function N_(e){return e?.status.state===`grouping`||e?.status.state===`checking`}var P_=3e3;function F_(e){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e)return;let t=!1,r,i=async()=>{let e=await W(`/api/user-profile/category-cleanup`);if(t)return;let a=e.success?e.data??null:null;n(a),N_(a)&&(r=setTimeout(()=>void i(),P_))};return i(),()=>{t=!0,clearTimeout(r)}},[e]),t}function I_({paused:e,onOpen:t}){let{t:n}=oa(),r=M_(F_(e));if(e||!r)return null;let i=r.kind===`failed`;return(0,H.jsx)(A_,{variant:i?`destructive`:`default`,role:i?`alert`:`status`,children:(0,H.jsxs)(`div`,{className:`col-start-1 flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 break-words`,children:[r.kind===`grouping`&&n(`label-category-cleanup-loading`),r.kind===`checking`&&n(`label-category-cleanup-progress`,{done:r.done,total:r.total}),r.kind===`ready`&&n(`label-category-cleanup-banner-ready`,{groups:r.groups}),r.kind===`failed`&&(0,H.jsxs)(H.Fragment,{children:[n(`label-category-cleanup-banner-failed`),` `,(0,H.jsx)(`bdi`,{children:r.error})]})]}),(0,H.jsx)(G,{variant:`outline`,size:`xs`,onClick:t,children:n(`btn-category-cleanup-banner-open`)})]})})}var L_=Object.defineProperty,R_=(e,t)=>L_(e,`name`,{value:t,configurable:!0}),z_=v.createContext(void 0);function B_(e){let t=v.useContext(z_);return e||t||`ltr`}R_(B_,`useDirection`);var V_=Object.defineProperty,H_=(e,t)=>V_(e,`name`,{value:t,configurable:!0});function U_(e,[t,n]){return Math.min(n,Math.max(t,e))}H_(U_,`clamp`);var W_=Object.defineProperty,G_=(e,t)=>W_(e,`name`,{value:t,configurable:!0});function K_(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}G_(K_,`useStateMachine`);var q_=`ScrollArea`,[J_,Y_]=qa(q_),[X_,Z_]=J_(q_),Q_=v.forwardRef(G_(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[h,g]=v.useState(null),[_,y]=v.useState(0),[b,x]=v.useState(0),[S,C]=v.useState(!1),[w,T]=v.useState(!1),E=xa(t,c),D=B_(i);return(0,H.jsx)(X_,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,H.jsx)(Mo.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),$_=`ScrollAreaViewport`,ev=v.forwardRef(G_(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=Z_($_,n),s=xa(t,v.useRef(null),o.onViewportChange);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(tv,{nonce:i}),(0,H.jsx)(Mo.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,H.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),tv=v.memo(G_(function({nonce:e}){return(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),nv=`ScrollAreaScrollbar`,rv=v.forwardRef(G_(function(e,t){let{forceMount:n,...r}=e,i=Z_(nv,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return v.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,H.jsx)(iv,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,H.jsx)(av,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,H.jsx)(ov,{...r,ref:t,forceMount:n}):i.type===`always`?(0,H.jsx)(sv,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),iv=v.forwardRef(G_(function(e,t){let{forceMount:n,...r}=e,i=Z_(nv,e.__scopeScrollArea),[a,o]=v.useState(!1);return v.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=G_(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=G_(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,H.jsx)(wo,{present:n||a,children:(0,H.jsx)(ov,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),av=v.forwardRef(G_(function(e,t){let{forceMount:n,...r}=e,i=Z_(nv,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Dv(()=>c(`SCROLL_END`),100),[s,c]=K_(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return v.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),v.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=G_(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,H.jsx)(wo,{present:n||s!==`hidden`,children:(0,H.jsx)(sv,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:Qa(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:Qa(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),ov=v.forwardRef(G_(function(e,t){let n=Z_(nv,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=v.useState(!1),s=e.orientation===`horizontal`,c=Dv(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Ov(n.viewport,c),Ov(n.content,c),(0,H.jsx)(wo,{present:r||a,children:(0,H.jsx)(sv,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),sv=v.forwardRef(G_(function(e,t){let{orientation:n=`vertical`,...r}=e,i=Z_(nv,e.__scopeScrollArea),a=v.useRef(null),o=v.useRef(0),[s,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=bv(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:G_(e=>a.current=e,`onThumbChange`),onThumbPointerUp:G_(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:G_(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return Sv(e,o.current,s,t)}return G_(d,`getScrollPosition`),n===`horizontal`?(0,H.jsx)(cv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Cv(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,H.jsx)(lv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Cv(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),cv=v.forwardRef(G_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=Z_(nv,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarXChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(fv,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":xv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Tv(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:yv(o.paddingLeft),paddingEnd:yv(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),lv=v.forwardRef(G_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=Z_(nv,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarYChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(fv,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":xv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Tv(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:yv(o.paddingTop),paddingEnd:yv(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[uv,dv]=J_(nv),fv=v.forwardRef(G_(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=Z_(nv,n),[m,h]=v.useState(null),g=xa(t,h),_=v.useRef(null),y=v.useRef(``),b=p.viewport,x=r.content-r.viewport,S=os(u),C=os(c),w=Dv(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return G_(T,`handleDragScroll`),v.useEffect(()=>{let e=G_(e=>{let t=e.target;m?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,m,x,S]),v.useEffect(C,[r,C]),Ov(m,w),Ov(p.content,w),(0,H.jsx)(uv,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:os(a),onThumbPointerUp:os(o),onThumbPositionChange:C,onThumbPointerDown:os(s),children:(0,H.jsx)(Mo.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:Qa(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:Qa(e.onPointerMove,T),onPointerUp:Qa(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),pv=`ScrollAreaThumb`,mv=v.forwardRef(G_(function(e,t){let{forceMount:n,...r}=e,i=dv(pv,e.__scopeScrollArea);return(0,H.jsx)(wo,{present:n||i.hasThumb,children:(0,H.jsx)(hv,{ref:t,...r})})},`ScrollAreaThumb`)),hv=v.forwardRef(G_(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=Z_(pv,n),o=dv(pv,n),{onThumbPositionChange:s}=o,c=xa(t,o.onThumbChange),l=v.useRef(void 0),u=Dv(()=>{l.current&&=(l.current(),void 0)},100);return v.useEffect(()=>{let e=a.viewport;if(e){let t=G_(()=>{if(u(),!l.current){let t=Ev(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,H.jsx)(Mo.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:Qa(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:Qa(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),gv=`ScrollAreaCorner`,_v=v.forwardRef(G_(function(e,t){let n=Z_(gv,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,H.jsx)(vv,{...e,ref:t}):null},`ScrollAreaCorner`)),vv=v.forwardRef(G_(function(e,t){let{__scopeScrollArea:n,...r}=e,i=Z_(gv,n),[a,o]=v.useState(0),[s,c]=v.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Ov(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Ov(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),v.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,H.jsx)(Mo.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function yv(e){return e?parseInt(e,10):0}G_(yv,`toInt`);function bv(e,t){let n=e/t;return isNaN(n)?0:n}G_(bv,`getThumbRatio`);function xv(e){let t=bv(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}G_(xv,`getThumbSize`);function Sv(e,t,n,r=`ltr`){let i=xv(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return wv([c,l],d)(e)}G_(Sv,`getScrollPositionFromPointer`);function Cv(e,t,n=`ltr`){let r=xv(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=U_(e,n===`ltr`?[0,o]:[o*-1,0]);return wv([0,o],[0,s])(c)}G_(Cv,`getThumbOffsetFromScroll`);function wv(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}G_(wv,`linearScale`);function Tv(e,t){return e>0&&e<t}G_(Tv,`isScrollingWithinScrollbarBounds`);var Ev=G_((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return G_((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function Dv(e,t){let n=os(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}G_(Dv,`useDebounceCallback`);function Ov(e,t){let n=os(t);ro(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}G_(Ov,`useResizeObserver`);var kv=Q_,Av=ev,jv=_v;function Mv({className:e,children:t,...n}){return(0,H.jsxs)(kv,{"data-slot":`scroll-area`,className:V(`relative`,e),...n,children:[(0,H.jsx)(Av,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:t}),(0,H.jsx)(Nv,{}),(0,H.jsx)(jv,{})]})}function Nv({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(rv,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:V(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,H.jsx)(mv,{"data-slot":`scroll-area-thumb`,className:`bg-border relative flex-1 rounded-full`})})}function Pv({open:e=!1,profileId:t=``,onOpenChange:n}){let{t:r}=oa(),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)([]);(0,v.useEffect)(()=>{e&&t&&c(t)},[e,t]);async function c(e){a(!0),s([]);let t=await W(`/api/user-profile/changelog?profileId=${encodeURIComponent(e)}&limit=10`);a(!1),t.success&&t.data?s(t.data):s([])}return(0,H.jsx)(K,{open:e,onOpenChange:n,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:r(`modal-changelog-title`)})}),(0,H.jsx)(Mv,{className:`max-h-80`,children:i?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`loading-changelog`)}):o.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`empty-changelog`)}):(0,H.jsx)(`div`,{className:`space-y-3 pr-3`,children:o.map((e,t)=>(0,H.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`font-medium`,children:[`v`,e.version]}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeType}),(0,H.jsx)(`span`,{className:`text-muted-foreground ml-auto`,children:Yp(e.createdAt)})]}),(0,H.jsx)(`p`,{className:`text-sm`,children:e.changeSummary})]},`${e.version}-${t}`))})})]})})}function Fv({item:e,onOpen:t,focusKey:n}){let{t:r}=oa(),i=Wu(e).length;return i===0?null:(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`xs`,className:`-mx-1.5 h-5 cursor-pointer px-1.5 text-xs font-normal text-muted-foreground transition-colors duration-200 ease-in hover:bg-transparent hover:text-primary-label focus-visible:text-primary-label`,"aria-haspopup":`dialog`,"data-evidence-key":n,"aria-label":r(`evidence-open-label`,{count:i}),onClick:t,children:[(0,H.jsx)(Be,{className:`size-3`,"aria-hidden":`true`}),r(`evidence-count`,{count:i})]})}var Iv={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function Lv({item:e,section:t}){let{t:n,language:r}=oa(),i=Wu(e);return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,children:[n(Iv[t]),e.category?` · ${e.category}`:null]}),(0,H.jsx)(`p`,{dir:`auto`,className:`text-sm leading-6 break-words`,children:e.description}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-hit-count`,{count:e.frequency||1})})]}),(0,H.jsx)(Mv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[50vh] rounded-lg border`,children:(0,H.jsx)(`ol`,{className:`flex flex-col divide-y`,children:i.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex gap-3 px-3 py-2.5 text-sm leading-6`,children:[(0,H.jsx)(`span`,{className:`w-5 shrink-0 text-end text-xs leading-6 text-muted-foreground tabular-nums`,children:t+1}),e.kind===`manual-write`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted-foreground italic`,children:[(0,H.jsx)(ft,{className:`size-3.5`,"aria-hidden":`true`}),n(`evidence-manual-write`)]}):(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 whitespace-pre-wrap break-words`,children:e.text})]},t))})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-note`)})]})}function Rv({item:e,section:t,focusKey:n,onOpenChange:r}){let{t:i}=oa(),a=(0,v.useRef)(null);return n&&(a.current=n),(0,H.jsx)(K,{open:e!==null,onOpenChange:r,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,onCloseAutoFocus:e=>{let t=a.current,n=t?document.querySelector(`[data-evidence-key="${CSS.escape(t)}"]`):null;n&&(e.preventDefault(),n.focus())},children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:i(`evidence-dialog-title`)}),(0,H.jsx)(Wl,{className:`sr-only`,children:e?.description})]}),e?(0,H.jsx)(Lv,{item:e,section:t}):null]})})}function zv({open:e=!1,type:t=null,index:n=0,action:r=`edit`,item:i=null,onOpenChange:a,onSaved:o}){let{t:s}=oa(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)([``]),[m,h]=(0,v.useState)(`1`),[g,_]=(0,v.useState)(!1),y=r===`edit`,b=t===`workflows`;(0,v.useEffect)(()=>{e&&i&&(l(i.category||``),d(i.description||``),p(i.steps?.length?[...i.steps]:[``]),h(`1`))},[e,i]);let x=y?s(`btn-edit`)||`Edit Item`:m===`2`?s(`confirm-delete-title`)||`Confirm Delete`:s(`confirm-delete`)||`Delete Item?`;function S(e){a?.(e)}function C(){p(e=>[...e,``])}function w(e){p(t=>{let n=t.filter((t,n)=>n!==e);return n.length===0?[``]:n})}function T(e,t){p(n=>n.map((n,r)=>r===e?t:n))}async function E(e){if(e.preventDefault(),!t)return;if(r===`delete`){if(m===`1`){h(`2`);return}_(!0);let e=await W(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:t,index:n,action:`delete`})});_(!1),e.success?(U.success(s(`toast-delete-success`)||`Item deleted`),S(!1),o?.()):U.error(e.error||s(`toast-delete-failed`)||`Delete failed`);return}_(!0);let i={type:t,index:n,action:`edit`,category:b?void 0:c,description:u};t===`workflows`&&(i.steps=f.map(e=>e.trim()).filter(Boolean));let a=await W(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});_(!1),a.success?(U.success(s(`toast-update-success`)||`Item updated`),S(!1),o?.()):U.error(a.error||s(`toast-update-failed`)||`Update failed`)}return(0,H.jsx)(K,{open:e,onOpenChange:S,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:x})}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:E,children:[y||m===`1`?(0,H.jsxs)(H.Fragment,{children:[b?null:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`profile-item-category`,children:s(`label-category`)}),(0,H.jsx)(id,{id:`profile-item-category`,value:c,onChange:e=>l(e.target.value),disabled:!y})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`profile-item-description`,children:s(`label-description`)}),(0,H.jsx)(Fp,{id:`profile-item-description`,rows:4,value:u,onChange:e=>d(e.target.value),disabled:!y})]}),b&&y?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{children:s(`label-steps`)}),(0,H.jsx)(`div`,{className:`space-y-2`,children:f.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground w-5 tabular-nums`,children:t+1}),(0,H.jsx)(id,{value:e,placeholder:`Step ${t+1}...`,onChange:e=>T(t,e.target.value)}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:()=>w(t),children:`×`})]},t))}),(0,H.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,onClick:C,children:s(`btn-add-step`)})]}):null]}):null,(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>S(!1),children:s(`btn-cancel`)}),(0,H.jsx)(G,{type:`submit`,variant:y?`default`:`destructive`,disabled:g,children:y?s(`btn-save`)||`Save`:s(`btn-delete`)||`Delete`})]})]})]})})}var Bv=8;function Vv({label:e,children:t,className:n}){let r=v.useId(),i=v.useRef(null),a=v.useRef(null),[o,s]=v.useState(!1),[c,l]=v.useState(0);return v.useEffect(()=>{if(!o)return;let e=e=>{i.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[o]),v.useLayoutEffect(()=>{let e=a.current,t=i.current;if(!o||!e||!t)return;let n=t.getBoundingClientRect(),r=e.offsetWidth/2,s=n.left+n.width/2,c=document.documentElement.clientWidth,u=Math.min(Math.max(s,Bv+r),c-Bv-r);l(u-s)},[o]),(0,H.jsxs)(`span`,{ref:i,className:V(`relative inline-flex`,n),children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":e,"aria-expanded":o,"aria-controls":r,onClick:()=>s(e=>!e),className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors duration-150 outline-none hover:bg-interactive-hover hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-selection aria-expanded:text-foreground`,children:(0,H.jsx)(Be,{className:`size-3.5`,"aria-hidden":`true`})}),o?(0,H.jsx)(`div`,{ref:a,id:r,style:{transform:`translateX(calc(-50% + ${c}px))`},className:`absolute top-full left-1/2 z-30 mt-2 w-72 max-w-[calc(100vw-1rem)] rounded-lg border border-border bg-card p-3 text-start text-xs whitespace-normal text-card-foreground shadow-sm`,children:t}):null]})}var Hv=20;function Uv(e,t){let n=e.length,r=Math.max(1,Math.ceil(n/Hv)),i=Math.min(t,r),a=(i-1)*Hv;return{items:e.slice(a,a+Hv),total:n,totalPages:r,page:i,start:a}}function Wv(e){return Math.round((e.confidence||0)*100)}function Gv({profile:e,loading:t=!1,onRefresh:n,onCleanup:r,onCategoryCleanup:i,categoryCleanupOpen:a=!1}){let{t:o}=oa(),[s,c]=(0,v.useState)({pref:1,pat:1,wf:1}),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(0),[_,y]=(0,v.useState)(`edit`),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),w=(0,v.useMemo)(()=>{if(!e?.exists||!e.profileData)return null;let t=e.profileData;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}return t},[e]),T=(0,v.useMemo)(()=>{let e=[...w?.preferences??[],...w?.patterns??[]];return new Set(e.map(e=>e.category||`General`)).size},[w]),E=(0,v.useMemo)(()=>Bu(w?.preferences),[w]),D=(0,v.useMemo)(()=>Bu(w?.patterns),[w]),O=(0,v.useMemo)(()=>Bu(w?.workflows),[w]),k=(0,v.useMemo)(()=>O.map((e,t)=>({item:e,index:t})).sort((e,t)=>(t.item.frequency||0)-(e.item.frequency||0)),[O]),j=Uv(E,s.pref),M=Uv(D,s.pat),N=Uv(k,s.wf),P=O.length;function ee(e,t,n){let r=(e===`preferences`?E:e===`patterns`?D:O)[t];r&&(m(e),g(t),y(n),x(r),f(!0))}function F(e,t){return e.indexOf(t)}function I({page:e,pageKey:t}){return e.total<=Hv?null:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-2`,children:[(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground me-2`,children:[e.start+1,`-`,Math.min(e.start+Hv,e.total),` / `,e.total]}),Array.from({length:e.totalPages},(e,t)=>t+1).map(n=>(0,H.jsx)(G,{size:`xs`,variant:n===e.page?`default`:`outline`,onClick:()=>c(e=>({...e,[t]:n})),children:n},n))]})}function te({item:e,type:t,fullList:n}){let r=F(n,e),i=Wv(e);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-4 space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[t!==`workflows`||e.category?(0,H.jsx)(rd,{variant:`outline`,className:`bg-transparent border-current [color:oklch(0.42_0.13_var(--category-hue))] dark:[color:oklch(0.8_0.13_var(--category-hue))]`,style:{"--category-hue":String(ed(e.category||`General`))},children:e.category||`General`}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5 ms-auto`,children:[(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:o(`btn-edit`)||`Edit`,onClick:()=>ee(t,r,`edit`),children:(0,H.jsx)(pt,{className:`size-3`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:o(`btn-delete`)||`Delete`,onClick:()=>ee(t,r,`delete`),children:(0,H.jsx)(Lt,{className:`size-3`})})]}),(0,H.jsxs)(`div`,{className:V(`shrink-0 rounded-md border px-1.5 py-0.5 text-xs font-medium tabular-nums`,Ku[Gu(i)]),title:`${o(`label-confidence`)}: ${i}%`,children:[i,`%`]})]}),(0,H.jsx)(`p`,{className:`text-sm break-words`,children:e.description||``}),e.steps?.length?(0,H.jsx)(`ol`,{className:`flex flex-col items-start gap-1.5`,children:e.steps.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex min-w-0 max-w-full items-start gap-2 rounded-2xl border border-blue-600/40 bg-blue-500/15 py-1 ps-1 pe-3 text-xs leading-5 text-blue-700 dark:text-blue-400`,children:[(0,H.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-blue-500/30 text-[11px] font-medium tabular-nums dark:bg-blue-400/30`,children:t+1}),(0,H.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))}):null,e.evidence||e.frequency?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:o(`label-evidence-tooltip`,{count:e.frequency||1}),children:[(0,H.jsx)(Ft,{className:`size-3`}),e.frequency||1]}),Wu(e).length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`·`}),(0,H.jsx)(Fv,{item:e,focusKey:`${t}-${r}`,onOpen:()=>C({item:e,section:t,focusKey:`${t}-${r}`})})]}):null]}):null]})}return t&&!e?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:o(`loading-profile`)}):e?.exists?w?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{dir:`auto`,className:`text-section-title font-semibold break-words`,children:e.displayName||e.userId}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-version`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.version})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-prompts`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.totalPromptsAnalyzed})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-updated`)}),(0,H.jsx)(`span`,{className:`ms-1`,children:e.lastAnalyzedAt?Yp(e.lastAnalyzedAt):`—`})]}),(0,H.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>r?.(),children:[(0,H.jsx)(kt,{className:`size-3.5`}),o(`btn-ai-cleanup`)]}),(0,H.jsx)(Vv,{label:o(`label-more-info`),children:o(`help-ai-cleanup`)})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>i?.(),children:[(0,H.jsx)(Pt,{className:`size-3.5`}),o(`btn-category-cleanup`),(0,H.jsx)(`span`,{className:`font-mono opacity-70`,title:o(`label-category-count-title`),children:T})]}),(0,H.jsx)(Vv,{label:o(`label-more-info`),children:o(`help-category-cleanup`)})]}),(0,H.jsx)(O_,{version:e.version,onUndone:n}),(0,H.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:()=>n?.(),children:[(0,H.jsx)(bt,{className:`size-3.5`}),o(`btn-refresh`)]}),(0,H.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:()=>u(!0),children:[(0,H.jsx)(St,{className:`size-3.5`}),`History`]})]})]}),(0,H.jsx)(I_,{paused:a,onOpen:()=>i?.()})]}),(0,H.jsxs)(`div`,{className:`grid gap-8`,children:[(0,H.jsxs)(`section`,{id:`profile-preferences`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Le,{className:`size-4`}),o(`profile-preferences`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:E.length})]}),E.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-preferences`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:j.items.map(e=>(0,H.jsx)(te,{item:e,type:`preferences`,fullList:E},F(E,e)))}),(0,H.jsx)(I,{page:j,pageKey:`pref`})]})]}),(0,H.jsxs)(`section`,{id:`profile-patterns`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(A,{className:`size-4`}),o(`profile-patterns`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:D.length})]}),D.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-patterns`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:M.items.map(e=>(0,H.jsx)(te,{item:e,type:`patterns`,fullList:D},F(D,e)))}),(0,H.jsx)(I,{page:M,pageKey:`pat`})]})]}),(0,H.jsxs)(`section`,{id:`profile-workflows`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Wt,{className:`size-4`}),o(`profile-workflows`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:P})]}),P===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-workflows`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid items-start gap-3 lg:grid-cols-2`,children:N.items.map(e=>(0,H.jsx)(te,{item:e.item,type:`workflows`,fullList:O},e.index))}),(0,H.jsx)(I,{page:N,pageKey:`wf`})]})]})]})]}),(0,H.jsx)(Pv,{open:l,onOpenChange:u,profileId:e?.id||``}),(0,H.jsx)(zv,{open:d,onOpenChange:f,type:p,index:h,action:_,item:b,onSaved:n}),(0,H.jsx)(Rv,{item:S?.item??null,section:S?.section??`preferences`,focusKey:S?.focusKey??null,onOpenChange:e=>{e||C(null)}})]}):null:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-10 text-muted-foreground`,children:[(0,H.jsx)(Vt,{className:`size-8`}),(0,H.jsx)(`p`,{className:`text-sm`,children:e?.message||o(`empty-preferences`)})]})}function Kv({open:e=!1,count:t=0,onOpenChange:n,onComplete:r}){let{t:i}=oa(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(0);(0,v.useEffect)(()=>{e&&!a&&(c(i(`migration-found-tags`,{count:t})),u(0))},[e,a,t,i]);function d(e){a&&!e||n?.(e)}async function f(){o(!0),c(i(`status-migration-init`)),u(0);let e=!0,t=0,n=1e3;for(;e&&t<n;){t++;let n=await W(`/api/migration/tags/run-batch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({batchSize:3})});if(!n.success||!n.data){c(i(`toast-migration-failed`)+`: `+(n.error||``)),o(!1);return}let r=n.data.processed;e=n.data.hasMore;let a=n.data.total;u(a>0?Math.round(r/a*100):0),c(i(`status-migration-progress`,{current:r,total:a})),e&&await new Promise(e=>setTimeout(e,100))}if(t>=n){c(i(`migration-stopped`)),o(!1);return}u(100),c(i(`toast-migration-success`)),U.success(i(`toast-migration-success`)),setTimeout(()=>{o(!1),d(!1),r?.()},2e3)}return(0,H.jsx)(K,{open:e,onOpenChange:d,children:(0,H.jsxs)(q,{className:`sm:max-w-md`,showCloseButton:!a,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:i(`modal-migration-title`)})}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s}),(0,H.jsx)(`div`,{className:`h-2 rounded-full bg-muted overflow-hidden`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary transition-all duration-200`,style:{width:`${l}%`}})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`migration-note`)})]}),a?null:(0,H.jsx)(Hl,{children:(0,H.jsxs)(G,{onClick:f,children:[(0,H.jsx)(ht,{className:`size-3.5`}),i(`btn-start-migration`)]})})]})})}var qv=[{id:`settings-section-external-api`,title:`External API`},{id:`settings-section-models`,title:`Models`},{id:`settings-section-embedding`,title:`Embedding`},{id:`settings-section-keys`,title:`Keys and access`},{id:`settings-section-diagnostics`,title:`Capture diagnostics`},{id:`settings-section-health`,title:`Health`},{id:`settings-section-claude-folder`,title:`Claude Code folder`},{id:`settings-section-capture-language`,title:`Memory language`},{id:`settings-section-appearance`,title:`Appearance`},{id:`settings-section-profiles`,title:`Profiles`},{id:`settings-section-web-app`,title:`Web app`},{id:`settings-section-skill-learning`,title:`Skill learning`},{id:`settings-section-log`,title:`Log`}],Jv=class extends Error{status;constructor(e,t){super(e),this.name=`SettingsRequestError`,this.status=t}};async function Y(e,t={}){let n=(t.method??`GET`).toUpperCase(),r=n!==`GET`&&n!==`HEAD`,i=await fetch(e,{...t,headers:{"x-omms-token":window.__OMMS_TOKEN__??``,...r||t.body?{"Content-Type":`application/json`}:{},...t.headers}}),a=await i.json();if(!i.ok)throw new Jv(a.error??`Request failed (${i.status})`,i.status);return a}var Yv=new Set,Xv=0;function Zv(e){Xv++;for(let t of Yv)t(e)}function Qv(){let e=Xv;return{isCurrent:()=>Xv===e}}async function $v(){try{let e=await Y(`/api/settings`);return Zv(e),e}catch{return null}}function ey(e){return Yv.add(e),()=>{Yv.delete(e)}}function ty(e,t){return`${e.replace(/\.+$/,``)}. ${t}`}function ny(){let e=0;return{begin(){let t=++e;return()=>t===e}}}async function ry(e,t){e(!0);try{return await t()}finally{e(!1)}}var iy={"(empty prompt)":[`(空提示)`,`(مطالبة فارغة)`],"<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.":[`<private> 文本、API 密钥和密码将按原文存储,并在起草时发送到外部 API。`,`سيُخزَّن نص <private> ومفاتيح API وكلمات المرور كما كُتبت، وتُرسَل إلى واجهة API الخارجية عند الصياغة.`],"A project config turns recording off for this project.":[`项目配置已为此项目关闭记录。`,`يوقف إعداد المشروع التسجيل في هذا المشروع.`],Attention:[`关注度`,`الاهتمام`],"Add folder":[`添加文件夹`,`إضافة مجلد`],"All skills":[`所有技能`,`كل المهارات`],"Changes to SKILL.md":[`对 SKILL.md 的更改`,`التغييرات على SKILL.md`],"Delete recorded turns":[`删除已记录的回合`,`حذف الأدوار المسجلة`],"Delete {count} recorded turns? This cannot be undone.":[`删除 {count} 个已记录的回合?此操作无法撤销。`,`حذف {count} من الأدوار المسجلة؟ لا يمكن التراجع عن ذلك.`],"Deleted {count} recorded turns.":[`已删除 {count} 个已记录的回合。`,`تم حذف {count} من الأدوار المسجلة.`],"Draft improvement":[`起草改进`,`صياغة تحسين`],"Draft skill":[`起草技能`,`صياغة مهارة`],"Drafting needs the external API. Set it up first.":[`起草需要外部 API。请先设置。`,`تحتاج الصياغة إلى واجهة API الخارجية. أعدّها أولاً.`],"Drafting… This can take a few minutes.":[`正在起草…这可能需要几分钟。`,`جارٍ الصياغة… قد يستغرق ذلك بضع دقائق.`],"Evidence turns":[`证据回合`,`الأدوار الداعمة`],"Failed turns":[`失败的回合`,`الأدوار الفاشلة`],"File size":[`文件大小`,`حجم الملف`],"Finding past sessions…":[`正在查找过去的会话…`,`جارٍ البحث عن الجلسات السابقة…`],"Filter skills by name":[`按名称筛选技能`,`تصفية المهارات بالاسم`],"Find new skill ideas":[`查找新技能想法`,`البحث عن أفكار مهارات جديدة`],"Folder for the new skill":[`新技能的文件夹`,`مجلد المهارة الجديدة`],"Folder not found":[`未找到文件夹`,`المجلد غير موجود`],"Folder path":[`文件夹路径`,`مسار المجلد`],"Hide changes":[`隐藏更改`,`إخفاء التغييرات`],Improvement:[`改进`,`تحسين`],"Last use":[`上次使用`,`آخر استخدام`],"Loading…":[`加载中…`,`جارٍ التحميل…`],"Looking…":[`正在查找…`,`جارٍ البحث…`],Manual:[`手动`,`يدوي`],"Most used":[`最常用`,`الأكثر استخدامًا`],"Needs attention":[`需要关注`,`يحتاج إلى اهتمام`],"Sort skills":[`技能排序`,`ترتيب المهارات`],"New skill":[`新技能`,`مهارة جديدة`],"New skill ideas":[`新技能想法`,`أفكار مهارات جديدة`],"New turns will be stored as written.":[`新回合将按原文存储。`,`ستُخزَّن الأدوار الجديدة كما كُتبت.`],"No change proposed":[`没有建议更改`,`لم يُقترح أي تغيير`],"No content was saved.":[`没有保存内容。`,`لم يُحفظ أي محتوى.`],"No folders are watched.":[`没有监视的文件夹。`,`لا توجد مجلدات مراقبة.`],"No new skill ideas in the recorded turns.":[`已记录的回合中没有新的技能想法。`,`لا توجد أفكار مهارات جديدة في الأدوار المسجلة.`],"No proposals yet.":[`还没有提案。`,`لا توجد مقترحات بعد.`],"No recorded turns.":[`没有已记录的回合。`,`لا توجد أدوار مسجلة.`],"No skill matches this name.":[`没有技能匹配此名称。`,`لا توجد مهارة تطابق هذا الاسم.`],"No skills found in the watched folders.":[`在监视的文件夹中未找到技能。`,`لم يُعثر على مهارات في المجلدات المراقبة.`],"No turns are recorded yet.":[`还没有记录任何回合。`,`لم تُسجَّل أي أدوار بعد.`],"Not in a watched folder":[`不在监视的文件夹中`,`ليست في مجلد مراقب`],"Nothing is recorded yet. Agent turns are recorded only after you turn it on.":[`尚未记录任何内容。只有在你开启后才会记录智能体回合。`,`لم يُسجَّل شيء بعد. لا تُسجَّل أدوار الوكيل إلا بعد تشغيل ذلك.`],"OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.":[`OMMS 会把完整的提示、回复和工具调用存储在这台电脑上的 skills.db 中。起草时会把已记录的回合发送到外部 API。该文件包含回合中的所有内容。`,`يخزّن OMMS المطالبات والردود واستدعاءات الأدوات كاملةً في skills.db على هذا الجهاز. ترسل الصياغة الأدوار المسجلة إلى واجهة API الخارجية. يحتوي الملف على كل ما تحتويه الأدوار.`],"OMMS will change this SKILL.md file without asking. It drafts an improvement after 10 new uses and at least 24 hours, then applies it. Each change can be undone.":[`OMMS 会在不询问的情况下修改此 SKILL.md 文件。它在 10 次新使用且至少 24 小时后起草改进,然后直接应用。每次更改都可以撤销。`,`سيعدّل OMMS ملف SKILL.md هذا دون أن يسأل. يصوغ تحسيناً بعد 10 استخدامات جديدة و24 ساعة على الأقل، ثم يطبّقه. يمكن التراجع عن كل تغيير.`],"Skill learning watches how your agents use your skills on Pi, OpenCode and Claude Code. It ranks each skill by use and failed tool calls, and drafts better versions from real turns.":[`技能学习会观察你的智能体在 Pi、OpenCode 和 Claude Code 中如何使用你的技能。它按使用次数和失败的工具调用为每个技能排名,并根据真实回合起草更好的版本。`,`يراقب تعلّم المهارات كيف يستخدم وكلاؤك مهاراتك في Pi وOpenCode وClaude Code. يرتّب كل مهارة حسب الاستخدام واستدعاءات الأدوات الفاشلة، ويصوغ نسخاً أفضل من أدوار حقيقية.`],"Every draft is a proposal with a diff. Nothing changes a SKILL.md file until you apply it, unless you set that skill to Automatic. Undo restores the previous version.":[`每份草稿都是带差异对比的提案。在你应用之前,SKILL.md 文件不会改变,除非你把该技能设为“自动”。撤销会恢复之前的版本。`,`كل مسودة مقترح مع عرض للفروق. لا يتغيّر ملف SKILL.md حتى تطبّقه، إلا إذا ضبطت تلك المهارة على تلقائي. التراجع يعيد النسخة السابقة.`],"Open the Skill learning card":[`打开“技能学习”卡片`,`افتح بطاقة تعلّم المهارات`],"No proposals are waiting.":[`没有等待处理的提案。`,`لا توجد مقترحات قيد الانتظار.`],"No proposals have been decided yet.":[`尚未处理任何提案。`,`لم يتم البتّ في أي مقترح بعد.`],"Pending proposals":[`待处理的提案`,`المقترحات المعلّقة`],Proposals:[`提案`,`المقترحات`],"Ranked skills":[`技能排名`,`المهارات مرتبةً`],"Recent turns":[`最近的回合`,`الأدوار الأخيرة`],"Recent proposals":[`最近的提案`,`المقترحات الأخيرة`],"Record agent turns":[`记录智能体回合`,`تسجيل أدوار الوكيل`],"Record agent turns so OMMS can rank your skills and draft improvements.":[`记录智能体回合,让 OMMS 为你的技能排名并起草改进。`,`سجّل أدوار الوكيل ليتمكن OMMS من ترتيب مهاراتك وصياغة التحسينات.`],"Record past turns":[`记录过去的回合`,`تسجيل الأدوار السابقة`],"Record past turns did not finish.":[`记录过去的回合未完成。`,`لم يكتمل تسجيل الأدوار السابقة.`],"Recorded turns":[`已记录的回合`,`الأدوار المسجلة`],"Recorded {count} past turns.":[`已记录 {count} 个过去的回合。`,`تم تسجيل {count} من الأدوار السابقة.`],Reject:[`拒绝`,`رفض`],"Remove folder":[`移除文件夹`,`إزالة المجلد`],"Remove folder {path}":[`移除文件夹 {path}`,`إزالة المجلد {path}`],"Remove private text and secrets":[`移除私密文本和机密`,`إزالة النص الخاص والأسرار`],"Reset default":[`恢复默认`,`استعادة الافتراضي`],"Saved.":[`已保存。`,`تم الحفظ.`],"Show changes":[`显示更改`,`عرض التغييرات`],"Skill learning":[`技能学习`,`تعلّم المهارات`],"Skill turns":[`技能回合`,`أدوار المهارات`],"Skill turns are recorded only while Record agent turns is on.":[`只有开启“记录智能体回合”时才会记录技能回合。`,`لا تُسجَّل أدوار المهارات إلا عند تشغيل تسجيل أدوار الوكيل.`],"Skill turns to record":[`待记录的技能回合`,`أدوار المهارات المراد تسجيلها`],"Skill turns already recorded":[`已记录的技能回合`,`أدوار المهارات المسجلة سابقاً`],"Skill turns recorded":[`本次记录的技能回合`,`أدوار المهارات المسجلة`],"Skill turns already present":[`已存在的技能回合`,`أدوار المهارات الموجودة مسبقاً`],Skills:[`技能`,`المهارات`],"Stale: the file changed since this draft":[`已过期:自起草以来文件已更改`,`قديم: تغيّر الملف منذ هذه المسودة`],"Stop removing private text and secrets?":[`停止移除私密文本和机密?`,`إيقاف إزالة النص الخاص والأسرار؟`],Suggested:[`建议`,`مقترحة`],"Turn off":[`关闭`,`إيقاف`],"Turn on Automatic":[`开启自动`,`تشغيل التلقائي`],"Turn on Automatic mode for this skill?":[`为此技能开启自动模式?`,`تشغيل الوضع التلقائي لهذه المهارة؟`],Undo:[`撤销`,`تراجع`],"Undo stopped because the file changed. This is the content OMMS saved:":[`撤销已停止,因为文件已更改。这是 OMMS 保存的内容:`,`توقف التراجع لأن الملف تغيّر. هذا هو المحتوى الذي حفظه OMMS:`],Uses:[`使用`,`الاستخدامات`],"Uses in 30 days":[`30 天内使用`,`الاستخدامات في 30 يوماً`],"Watched folders":[`监视的文件夹`,`المجلدات المراقبة`],applied:[`已应用`,`طُبّق`],"applied automatically":[`已自动应用`,`طُبّق تلقائياً`],rejected:[`已拒绝`,`مرفوض`],stale:[`已过期`,`قديم`],undone:[`已撤销`,`تم التراجع`],"{count} failed tool call":[`{count} 次工具调用失败`,`فشل استدعاء أداة واحد`],"{count} failed tool calls":[`{count} 次工具调用失败`,`فشل {count} من استدعاءات الأدوات`],"{count} skill":[`{count} 个技能`,`مهارة واحدة`],"{count} skills":[`{count} 个技能`,`المهارات: {count}`],Show:[`显示`,`عرض`],results:[`条结果`,`نتائج`],"Custom:":[`自定义:`,`مخصص:`],"Results per page":[`每页结果数`,`النتائج في كل صفحة`],"Custom results per page":[`自定义每页结果数`,`عدد مخصص للنتائج في كل صفحة`],"Sort by":[`排序方式`,`الترتيب حسب`],"Sort ascending":[`升序排列`,`ترتيب تصاعدي`],"Sort descending":[`降序排列`,`ترتيب تنازلي`],"Showing {from} to {to} of {total} results":[`显示第 {from} 到 {to} 条,共 {total} 条结果`,`عرض {from} إلى {to} من {total} نتيجة`],pagination:[`分页`,`ترقيم الصفحات`],"Go to previous page":[`转到上一页`,`الانتقال إلى الصفحة السابقة`],"Go to next page":[`转到下一页`,`الانتقال إلى الصفحة التالية`],"Go to page {page}":[`转到第 {page} 页`,`الانتقال إلى الصفحة {page}`],"More pages":[`更多页面`,`صفحات أخرى`],"Name (A–Z)":[`名称(A–Z)`,`الاسم (A–Z)`],Newest:[`最新`,`الأحدث`],Oldest:[`最早`,`الأقدم`],Skill:[`技能`,`المهارة`],Mode:[`模式`,`الوضع`],"{count} proposal":[`{count} 个提案`,`مقترح واحد ({count})`],"{count} proposals":[`{count} 个提案`,`المقترحات: {count}`],"{count} turn":[`{count} 个回合`,`دور واحد ({count})`],"{count} turns":[`{count} 个回合`,`الأدوار: {count}`],"{count} entry":[`{count} 条记录`,`إدخال واحد ({count})`],"{count} entries":[`{count} 条记录`,`الإدخالات: {count}`],"Created {date}":[`创建于 {date}`,`أُنشئ في {date}`],"Applied {date}":[`应用于 {date}`,`طُبّق في {date}`],"Rejected {date}":[`拒绝于 {date}`,`رُفض في {date}`],"Undone {date}":[`撤销于 {date}`,`تم التراجع في {date}`],"Stale since {date}":[`自 {date} 起已过期`,`قديم منذ {date}`],"Each card shows when the proposal was created and when it was last applied, rejected or undone.":[`每张卡片显示提案的创建时间,以及最近一次应用、拒绝或撤销的时间。`,`تعرض كل بطاقة وقت إنشاء المقترح ووقت آخر تطبيق أو رفض أو تراجع.`],History:[`历史记录`,`السجل`],created:[`已创建`,`أُنشئ`],"Each proposal, apply, reject and undo of this skill. Revert an applied change to restore SKILL.md as it was before it.":[`此技能的每个提案、应用、拒绝和撤销。还原已应用的更改可将 SKILL.md 恢复到该更改之前的状态。`,`كل مقترح وتطبيق ورفض وتراجع لهذه المهارة. أعِد تغييراً مطبّقاً لتستعيد SKILL.md كما كان قبله.`],"No history yet.":[`暂无历史记录。`,`لا يوجد سجل بعد.`],"{added} lines added, {removed} lines removed":[`新增 {added} 行,删除 {removed} 行`,`أُضيف {added} سطر، وحُذف {removed} سطر`],"Revert to before this change":[`还原到此更改之前`,`الرجوع إلى ما قبل هذا التغيير`],"Revert the newer change first.":[`请先还原较新的更改。`,`أعِد التغيير الأحدث أولاً.`],"Revert this change?":[`还原此更改?`,`هل تريد إعادة هذا التغيير؟`],"OMMS restores SKILL.md as it was before this change.":[`OMMS 会将 SKILL.md 恢复到此更改之前的状态。`,`يستعيد OMMS ملف SKILL.md كما كان قبل هذا التغيير.`],"Reverting this also removes {count} later change.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة تغيير لاحق واحد ({count}).`],"Reverting this also removes {count} later changes.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة {count} من التغييرات اللاحقة.`],Revert:[`还原`,`إعادة`],"Reverting…":[`正在还原…`,`جارٍ الإعادة…`],"Reverted. SKILL.md is back to the version before that change.":[`已还原。SKILL.md 已恢复到该更改之前的版本。`,`تمت الإعادة. عاد SKILL.md إلى النسخة السابقة لذلك التغيير.`],Activity:[`活动`,`النشاط`],"Activity could not load.":[`无法加载活动。`,`تعذّر تحميل النشاط.`],"Active skills":[`活跃技能`,`المهارات النشطة`],"Uses per day":[`每日使用`,`الاستخدامات يومياً`],"Uses in the last 30 days":[`最近 30 天的使用`,`الاستخدامات في آخر 30 يوماً`],"Most used skills":[`最常用的技能`,`المهارات الأكثر استخداماً`],"Proposal pipeline":[`提案进度`,`مسار المقترحات`],Successful:[`成功`,`ناجح`],Day:[`日期`,`اليوم`],"{uses} uses, {failed} with a failed tool call":[`使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"{name} leads with {uses} uses. Click a bar to open the skill.":[`{name} 以 {uses} 次使用领先。点击条形可打开该技能。`,`تتصدر {name} بعدد {uses} استخدام. انقر على شريط لفتح المهارة.`],"{total} proposals, {pending} waiting for a decision":[`共 {total} 个提案,{pending} 个等待决定`,`{total} مقترح، منها {pending} بانتظار قرار`],"No uses in the last 30 days. Bars appear after OMMS records turns.":[`最近 30 天没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في آخر 30 يوماً. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"No skill was used in the last 30 days.":[`最近 30 天没有使用任何技能。`,`لم تُستخدم أي مهارة في آخر 30 يوماً.`],"No skill uses are recorded in the last 30 days. The use charts appear after OMMS records agent turns that use a skill.":[`最近 30 天没有记录到技能使用。OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`لا توجد استخدامات مسجلة للمهارات في آخر 30 يوماً. تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"Show uses by":[`使用次数显示方式`,`عرض الاستخدامات حسب`],Days:[`按天`,`الأيام`],Months:[`按月`,`الأشهر`],Years:[`按年`,`السنوات`],"Days to show":[`要显示的日期范围`,`الأيام المعروضة`],"Year to show":[`要显示的年份`,`السنة المعروضة`],"Last 30 days":[`最近 30 天`,`آخر 30 يوماً`],"Uses per month":[`每月使用`,`الاستخدامات شهرياً`],"Uses per year":[`每年使用`,`الاستخدامات سنوياً`],Month:[`月份`,`الشهر`],Year:[`年份`,`السنة`],"{from} to {to}":[`{from} 至 {to}`,`من {from} إلى {to}`],"Uses in {period}":[`{period} 的使用`,`الاستخدامات في {period}`],"{period}: {uses} uses, {failed} with a failed tool call":[`{period}:使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{period}: {uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"No skill uses are recorded in {period}.":[`{period} 没有记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات في {period}.`],"No skill uses are recorded yet.":[`尚未记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات بعد.`],"The use charts appear after OMMS records agent turns that use a skill.":[`OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"No uses in this period. Bars appear after OMMS records turns.":[`此期间没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في هذه الفترة. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"Showing {shown} of {total}":[`显示 {shown} / {total}`,`عرض {shown} من {total}`],"Show more":[`显示更多`,`عرض المزيد`],"Show less":[`显示更少`,`عرض أقل`],"Import chat history":[`导入聊天记录`,`استيراد سجل المحادثات`],"Memory limits":[`记忆限制`,`حدود الذاكرة`],"Resolve missing project folders":[`解析缺失的项目文件夹`,`حل مجلدات المشاريع المفقودة`],"Project memories":[`项目记忆`,`ذاكرة المشروع`],"User profile":[`用户画像`,`الملف الشخصي للمستخدم`],"(preferences, patterns, and workflows)":[`(偏好、模式和工作流程)`,`(التفضيلات والأنماط وسير العمل)`],"All hosts":[`所有宿主`,`جميع المضيفين`],"Selected hosts":[`已选宿主`,`المضيفون المحددون`],"Choose at least one output.":[`请至少选择一项输出。`,`اختر مخرجاً واحداً على الأقل.`],"Choose at least one host.":[`请至少选择一个宿主。`,`اختر مضيفاً واحداً على الأقل.`],"Re-analyse handled history":[`重新分析已处理的记录`,`إعادة تحليل السجل المعالج`],"Re-analysis applies to the selected outputs. Each profile prompt can be forcibly re-analysed once. Findings merge into the existing profile.":[`重新分析适用于所选输出。每条画像提示只能强制重新分析一次。结果合并到现有画像中。`,`تنطبق إعادة التحليل على المخرجات المحددة. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة. تُدمج النتائج في الملف الحالي.`],"Preview the current selection before starting an import.":[`开始导入前,请预览当前选择。`,`عاين الاختيار الحالي قبل بدء الاستيراد.`],"This import makes model calls. Continue?":[`此次导入会调用模型。是否继续?`,`سيجري هذا الاستيراد اتصالات بالنموذج. هل تريد المتابعة؟`],"Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.":[`对话生成项目事实。用户提示生成个人偏好、重复模式和工作流程步骤。`,`تضيف المحادثات حقائق المشروع. وتضيف مطالبات المستخدم التفضيلات الشخصية والأنماط المتكررة وخطوات سير العمل.`],"Profile identity in Settings":[`设置中的画像身份`,`هوية الملف الشخصي في الإعدادات`],"Hosts keep their existing user identities. All hosts does not merge profiles with different identities.":[`各宿主保留现有用户身份。选择所有宿主不会合并不同身份的画像。`,`يحتفظ المضيفون بهويات المستخدم الحالية. اختيار جميع المضيفين لا يدمج ملفات الهويات المختلفة.`],"Pi session reader is unavailable. Fix the reader or deselect Pi.":[`Pi 会话读取器不可用。请修复读取器或取消选择 Pi。`,`قارئ جلسات Pi غير متاح. أصلح القارئ أو ألغِ تحديد Pi.`],"Import results":[`导入结果`,`نتائج الاستيراد`],"Import successful 🎉":[`导入成功`,`تم الاستيراد بنجاح`],"Import failed":[`导入失败`,`فشل الاستيراد`],"Import cancelled":[`导入已取消`,`تم إلغاء الاستيراد`],"The import finished while you were away.":[`导入在你离开时已结束。`,`انتهى الاستيراد أثناء غيابك.`],"Could not reload the settings. Reload the page.":[`无法重新加载设置。请刷新页面。`,`تعذر إعادة تحميل الإعدادات. أعد تحميل الصفحة.`],OK:[`确定`,`حسناً`],Dismiss:[`关闭`,`إغلاق`],"Show handled sessions":[`显示已处理的会话`,`إظهار الجلسات المعالجة`],Handled:[`已处理`,`تمت معالجتها`],"Handled sessions hidden":[`已隐藏的已处理会话`,`الجلسات المعالجة المخفية`],"Some memory units failed. Completed work is saved. A new preview and import retries only the failed units.":[`部分记忆单元失败。已完成的工作已保存。重新预览并导入只会重试失败的单元。`,`فشلت بعض وحدات الذاكرة. العمل المكتمل محفوظ. المعاينة والاستيراد الجديدان يعيدان محاولة الوحدات الفاشلة فقط.`],"Profile learning failed. Completed memory work is saved.":[`画像学习失败。已完成的记忆处理已保存。`,`فشل تعلّم الملف الشخصي. عمل الذاكرة المكتمل محفوظ.`],"Import preparation failed.":[`导入准备失败。`,`فشل تحضير الاستيراد.`],"Refresh the preview and retry.":[`请刷新预览后重试。`,`حدّث المعاينة ثم أعد المحاولة.`],"The session list is out of date. Refresh the list and try again.":[`会话列表已过期。请刷新列表后重试。`,`قائمة الجلسات قديمة. حدّث القائمة ثم أعد المحاولة.`],"The history source changed. Choose it again.":[`历史记录来源已更改。请重新选择。`,`تغيّر مصدر السجل. اختره مجدداً.`],"The history source is no longer valid. Choose it again.":[`历史记录来源已失效。请重新选择。`,`لم يعد مصدر السجل صالحاً. اختره مجدداً.`],"A Pi import is already running":[`已有 Pi 导入正在运行`,`استيراد Pi قيد التشغيل بالفعل`],"An OpenCode import is already running":[`已有 OpenCode 导入正在运行`,`استيراد OpenCode قيد التشغيل بالفعل`],"A Claude Code import is already running":[`已有 Claude Code 导入正在运行`,`استيراد Claude Code قيد التشغيل بالفعل`],"Combined counts":[`合计数量`,`الأعداد المجمعة`],"Current host":[`当前宿主`,`المضيف الحالي`],"Memory extraction":[`提取记忆`,`استخراج الذاكرة`],"Memory units":[`记忆单元`,`وحدات الذاكرة`],"Pending memory units":[`待处理记忆单元`,`وحدات الذاكرة المعلقة`],"Imported memory units":[`已导入记忆单元`,`وحدات الذاكرة المستوردة`],"Already handled memory units":[`已处理记忆单元`,`وحدات الذاكرة المعالجة سابقاً`],"Skipped memory units":[`已跳过记忆单元`,`وحدات الذاكرة المتخطاة`],"Failed memory units":[`失败的记忆单元`,`وحدات الذاكرة التي فشلت`],"Held-back turns":[`暂缓处理的轮次`,`الرسائل المؤجلة`],"Untimed turns":[`无时间戳的轮次`,`الرسائل بلا طابع زمني`],"Load errors":[`加载错误`,`أخطاء التحميل`],"Already handled profile prompts":[`已处理画像提示`,`مطالبات الملف الشخصي المعالجة سابقاً`],"Profile prompts":[`画像提示`,`مطالبات الملف الشخصي`],"Profile batches":[`画像批次`,`دفعات الملف الشخصي`],"Estimated profile analysis calls":[`预计画像分析调用次数`,`اتصالات تحليل الملف الشخصي المقدّرة`],"Waiting prompts inside OMMS":[`OMMS 内等待处理的提示`,`المطالبات المنتظرة داخل OMMS`],"No work to process":[`没有待处理工作`,`لا يوجد عمل للمعالجة`],queued:[`排队中`,`في الانتظار`],preparing:[`准备中`,`جارٍ التحضير`],"not-run":[`未运行`,`لم يُشغّل`],"Automatic profile cleanup":[`自动整理画像`,`التنظيف التلقائي للملف الشخصي`],"After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.":[`学习完成后,OMMS 会在后台自动合并重复的画像条目,并删除含糊的条目。每次运行大约每 100 个条目调用一次模型,在大型画像上需要几分钟。在“用户画像”页面选择“撤销上次自动整理”可恢复这些更改。`,`بعد كل جولة تعلّم، يدمج OMMS عناصر الملف الشخصي المكررة ويحذف العناصر الغامضة تلقائياً في الخلفية. تجري كل عملية نحو اتصال واحد بالنموذج لكل 100 عنصر وتستغرق عدة دقائق على الملف الكبير. يعيد خيار «تراجع عن آخر تنظيف تلقائي» في صفحة الملف الشخصي التغييرات.`],"Clean up the profile automatically":[`自动整理画像`,`تنظيف الملف الشخصي تلقائياً`],"Run every this many analysed prompts":[`每隔多少条已分析的提示运行一次`,`التشغيل كل عدد من المطالبات المحللة`],"Save interval":[`保存间隔`,`حفظ الفاصل`],"Enter a whole number from 50 to 100000.":[`请输入 50 到 100000 之间的整数。`,`أدخل عدداً صحيحاً من 50 إلى 100000.`],"Saved. Changes apply at the next learning pass.":[`已保存。更改将在下一次学习时生效。`,`تم الحفظ. تنطبق التغييرات في جولة التعلّم التالية.`],"Analyse waiting prompts":[`分析等待处理的提示`,`تحليل المطالبات المنتظرة`],"Re-analyse chat history":[`重新分析聊天记录`,`إعادة تحليل سجل المحادثات`],"Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.":[`分析等待处理的提示使用已保存的外部 API,读取 OMMS 内已有的提示,每次分析调用处理 50 条符合条件的提示。不会重新分析已完成的历史记录。输出包括偏好、模式和工作流程。`,`يقرأ تحليل المطالبات المنتظرة المطالبات الموجودة داخل OMMS عبر واجهة API الخارجية المحفوظة، بمعدل 50 مطالبة مؤهلة لكل اتصال تحليل. لا يُعاد تحليل السجل المكتمل. المخرجات هي التفضيلات والأنماط وسير العمل.`],"Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.":[`分析调用次数为估计值。匹配、去重、重试和新增的等待提示可能增加调用次数。`,`اتصالات التحليل تقديرية. قد تضيف المطابقة وإزالة التكرار وإعادة المحاولة والمطالبات المنتظرة الجديدة اتصالات أخرى.`],"Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.":[`重新分析聊天记录会打开强制仅导入画像的流程。现有画像和项目记忆将保留。必须先预览并确认。每条画像提示只能强制重新分析一次。`,`تفتح إعادة تحليل سجل المحادثات استيراداً قسرياً للملف الشخصي فقط. تُحفظ ذاكرة المشروع وملفك الشخصي. تلزم المعاينة والتأكيد. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة.`],"Automatic import reads older conversations when a host starts. It populates project memories and user profile input. The first backfill fixes a cutoff; later turns use live capture.":[`自动导入在宿主启动时读取较早的对话,填充项目记忆和用户画像输入。首次回填固定截止时间,之后的轮次使用实时捕获。`,`يقرأ الاستيراد التلقائي المحادثات الأقدم عند بدء المضيف. ويضيف ذاكرة المشروع ومدخلات الملف الشخصي. يثبت أول استيراد تاريخاً فاصلاً؛ وتستخدم الرسائل اللاحقة الالتقاط المباشر.`],"A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.":[`目录映射将记录的项目文件夹链接到当前文件夹。保存的映射在下次导入或回填时全局应用于所有宿主。保存前请检查更改。`,`تربط خريطة المجلدات مجلد المشروع المسجل بمجلده الحالي. تنطبق الخرائط المحفوظة على جميع المضيفين في الاستيراد التالي. راجع التغييرات قبل الحفظ.`],"Prompt date from must not be after Prompt date to.":[`提示开始日期不能晚于结束日期。`,`يجب ألا يأتي تاريخ بدء المطالبات بعد تاريخ انتهائها.`],"Profile batch size must be a positive integer.":[`画像批次大小必须为正整数。`,`يجب أن يكون حجم دفعة الملف الشخصي عدداً صحيحاً موجباً.`],Models:[`模型`,`النماذج`],"External API fallback":[`外部 API 备用模型`,`النموذج الاحتياطي عبر واجهة API الخارجية`],none:[`无`,`لا يوجد`],ready:[`就绪`,`جاهز`],"not ready":[`未就绪`,`غير جاهز`],"Credentials (values hidden)":[`凭据(不显示内容)`,`بيانات الاعتماد (القيم مخفية)`],set:[`已设置`,`مضبوط`],"not set":[`未设置`,`غير مضبوط`],"Effective model":[`当前使用模型`,`النموذج المستخدم`],session:[`会话`,`الجلسة`],"external API":[`外部 API`,`واجهة API الخارجية`],unavailable:[`不可用`,`غير متاح`],"Project override is active. Changes to the global file may not take effect here.":[`项目设置优先。全局文件的更改可能不会在此生效。`,`إعدادات المشروع لها الأولوية. قد لا تسري تغييرات الملف العام هنا.`],"Model choice":[`模型选择`,`اختيار النموذج`],"Session model":[`会话模型`,`نموذج الجلسة`],"Manual model":[`手动选择模型`,`اختيار النموذج يدوياً`],"Manual provider/model":[`手动输入提供商/模型`,`إدخال المزوّد/النموذج يدوياً`],"Model list unavailable. Enter provider/model manually.":[`模型列表不可用。请手动输入提供商/模型。`,`قائمة النماذج غير متاحة. أدخل المزوّد/النموذج يدوياً.`],"OpenCode model list unavailable":[`OpenCode 模型列表不可用`,`قائمة نماذج OpenCode غير متاحة`],"OMMS could not find OpenCode on this computer, so it cannot list OpenCode's models here. Type the model as provider/model, for example zai-coding-plan/glm-5.3. If OpenCode is installed, open an OpenCode session and reload this page.":[`OMMS 在这台电脑上找不到 OpenCode,因此无法在此列出 OpenCode 的模型。请按 提供商/模型 格式输入模型,例如 zai-coding-plan/glm-5.3。如果已安装 OpenCode,请打开一个 OpenCode 会话,然后重新加载此页面。`,`لم يعثر OMMS على OpenCode في هذا الحاسوب، لذا لا يمكنه عرض نماذج OpenCode هنا. أدخل النموذج بصيغة المزوّد/النموذج، مثل zai-coding-plan/glm-5.3. إذا كان OpenCode مثبتاً، فافتح جلسة OpenCode ثم أعد تحميل هذه الصفحة.`],"OpenCode took too long to send its model list. Reload this page to try again, or type the model as provider/model.":[`OpenCode 发送模型列表的时间过长。请重新加载此页面重试,或按 提供商/模型 格式输入模型。`,`استغرق OpenCode وقتاً طويلاً لإرسال قائمة نماذجه. أعد تحميل هذه الصفحة للمحاولة مرة أخرى، أو أدخل النموذج بصيغة المزوّد/النموذج.`],"OpenCode has no signed-in models. Run `opencode auth login`, then reload this page.":["OpenCode 没有已登录的模型。请运行 `opencode auth login`,然后重新加载此页面。","لا توجد في OpenCode نماذج مسجَّل الدخول إليها. شغّل `opencode auth login` ثم أعد تحميل هذه الصفحة."],"This OpenCode version sent a model list OMMS cannot read. Type the model as provider/model. Update OMMS if this continues.":[`此版本的 OpenCode 发送的模型列表 OMMS 无法读取。请按 提供商/模型 格式输入模型。如果问题持续,请更新 OMMS。`,`أرسل هذا الإصدار من OpenCode قائمة نماذج لا يستطيع OMMS قراءتها. أدخل النموذج بصيغة المزوّد/النموذج. حدّث OMMS إذا استمرت المشكلة.`],"OMMS could not read Pi's model list. Type the model as provider/model.":[`OMMS 无法读取 Pi 的模型列表。请按 提供商/模型 格式输入模型。`,`تعذّر على OMMS قراءة قائمة نماذج Pi. أدخل النموذج بصيغة المزوّد/النموذج.`],"Pi has no signed-in models. Sign in to a provider in Pi, then reload this page.":[`Pi 没有已登录的模型。请在 Pi 中登录一个提供商,然后重新加载此页面。`,`لا توجد في Pi نماذج مسجَّل الدخول إليها. سجّل الدخول إلى مزوّد في Pi ثم أعد تحميل هذه الصفحة.`],"Save model":[`保存模型`,`حفظ النموذج`],"Enter a model as provider/model.":[`按 提供商/模型 格式输入。`,`أدخل النموذج بصيغة المزوّد/النموذج.`],"Saved. New capture and profile work uses these settings.":[`已保存。下一次捕获和用户画像将使用这些设置。`,`تم الحفظ. ستستخدم عمليات الالتقاط والملف الشخصي الجديدة هذه الإعدادات.`],"Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.":[`已保存。OMMS 现在读取 ~/.config/omms/omms.jsonc,旧配置保留。`,`تم الحفظ. يقرأ OMMS الآن الملف ~/.config/omms/omms.jsonc مع الاحتفاظ بالإعدادات القديمة.`],"Current settings were reloaded; check the values and save again.":[`已重新加载当前设置;检查数值后再次保存。`,`أُعيد تحميل الإعدادات الحالية. راجع القيم ثم احفظ مجدداً.`],"Capture diagnostics":[`捕获诊断`,`تشخيص الالتقاط`],"Time range":[`时间范围`,`الفترة الزمنية`],"24 hours":[`24 小时`,`24 ساعة`],"7 days":[`7 天`,`7 أيام`],"30 days":[`30 天`,`30 يوماً`],"90 days":[`90 天`,`90 يوماً`],"Host / model":[`主机 / 模型`,`المضيف / النموذج`],Saved:[`已保存`,`محفوظ`],Skipped:[`已跳过`,`متجاوز`],Failed:[`失败`,`فشل`],Total:[`总数`,`المجموع`],"Failure reasons":[`失败原因`,`أسباب الفشل`],"Recent attempts":[`最近尝试`,`المحاولات الأخيرة`],Time:[`时间`,`الوقت`],Host:[`主机`,`المضيف`],Source:[`来源`,`المصدر`],Session:[`会话`,`الجلسة`],Path:[`路径`,`المسار`],Model:[`模型`,`النموذج`],Stop:[`结束原因`,`سبب التوقف`],Blocks:[`区块`,`الكتل`],Prompt:[`提示词长度`,`طول الطلب`],Reply:[`回复长度`,`طول الرد`],Duration:[`耗时`,`المدة`],Outcome:[`结果`,`النتيجة`],Reason:[`原因`,`السبب`],"Save capture traces":[`保存捕获追踪`,`حفظ تتبعات الالتقاط`],"Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.":[`追踪文件在脱敏后仍可能包含对话内容。仅在调试时开启。`,`قد تحتوي التتبعات على محتوى المحادثة بعد التنقيح. فعّلها عند التصحيح فقط.`],"This project turns tracing off. The global switch cannot turn it on here.":[`此项目已关闭追踪。全局开关无法在此开启。`,`أوقف هذا المشروع التتبع. لا يمكن للمفتاح العام تفعيله هنا.`],"Trace retention (days)":[`追踪保留天数`,`مدة حفظ التتبعات (بالأيام)`],"Attempt retention (days)":[`尝试记录保留天数`,`مدة حفظ المحاولات (بالأيام)`],"Retry retention (hours)":[`重试保留小时数`,`مدة حفظ إعادة المحاولة (بالساعات)`],"When the capture model cannot be reached, OMMS keeps the turn and tries again later. Queued turns can hold conversation content after redaction. 0 turns the queue off and deletes waiting turns.":[`捕获模型无法访问时,OMMS 会保留该轮对话并稍后重试。排队的对话在脱敏后仍可能包含对话内容。设为 0 会关闭队列并删除等待中的对话。`,`عندما يتعذر الوصول إلى نموذج الالتقاط، يحتفظ OMMS بالجولة ويعيد المحاولة لاحقاً. قد تحتوي الجولات المنتظرة على محتوى المحادثة بعد التنقيح. القيمة 0 توقف قائمة الانتظار وتحذف الجولات المنتظرة.`],"Turns waiting for retry":[`等待重试的对话`,`الجولات المنتظرة لإعادة المحاولة`],"Retry now":[`立即重试`,`أعد المحاولة الآن`],"Retrying now.":[`正在重试。`,`تجري إعادة المحاولة الآن.`],"A retry is already running.":[`重试已在运行。`,`إعادة المحاولة قيد التشغيل بالفعل.`],"These turns retry at the next Pi session start.":[`这些对话将在下次启动 Pi 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Pi التالية.`],"These turns retry at the next OpenCode session start.":[`这些对话将在下次启动 OpenCode 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة OpenCode التالية.`],"These turns retry at the next Claude Code session start.":[`这些对话将在下次启动 Claude Code 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Claude Code التالية.`],"Claude Code capture uses the external API.":[`Claude Code 捕获使用外部 API。`,`يستخدم التقاط Claude Code واجهة API الخارجية.`],"Claude Code capture is off. Complete the external API settings.":[`Claude Code 捕获已关闭。请完成外部 API 设置。`,`التقاط Claude Code متوقف. أكمل إعدادات واجهة API الخارجية.`],"Missing settings":[`缺少的设置`,`الإعدادات الناقصة`],"memoryModel is not configured":[`未配置 memoryModel`,`لم يُضبط memoryModel`],"memoryApiUrl is not configured":[`未配置 memoryApiUrl`,`لم يُضبط memoryApiUrl`],"memoryApiKey is not configured":[`未配置 memoryApiKey`,`لم يُضبط memoryApiKey`],"memoryApiKey contains a placeholder value":[`memoryApiKey 包含占位值`,`يحتوي memoryApiKey على قيمة نائبة`],"Claude Code backfill always uses the external API. It has no backfill model setting.":[`Claude Code 回填始终使用外部 API,没有回填模型设置。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية، ولا يوجد له إعداد لنموذج الاستيراد.`],"Claude Code transcripts folder":[`Claude Code 对话记录文件夹`,`مجلد سجلات محادثات Claude Code`],"Claude Code transcripts":[`Claude Code 对话记录`,`سجلات محادثات Claude Code`],found:[`已找到`,`موجود`],"not found":[`未找到`,`غير موجود`],"Claude Code imports always use the external API.":[`Claude Code 导入始终使用外部 API。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية.`],"Claude Code imports use the external API. Complete the external API settings.":[`Claude Code 导入使用外部 API。请完成外部 API 设置。`,`يستخدم استيراد Claude Code واجهة API الخارجية. أكمل إعدادات واجهة API الخارجية.`],"Trace files":[`追踪文件`,`ملفات التتبع`],View:[`查看`,`عرض`],Delete:[`删除`,`حذف`],Health:[`健康检查`,`فحص الحالة`],"Config files":[`配置文件`,`ملفات الإعدادات`],"Memory store":[`记忆存储`,`مخزن الذاكرة`],Embedding:[`嵌入模型`,`نموذج التضمين`],"Web binding":[`网页服务绑定`,`ربط خادم الويب`],"OpenCode model":[`OpenCode 模型`,`نموذج OpenCode`],"Pi model":[`Pi 模型`,`نموذج Pi`],"Capture failures (24 hours)":[`捕获失败(24 小时)`,`فشل الالتقاط (24 ساعة)`],"OpenCode model test":[`OpenCode 模型测试`,`اختبار نموذج OpenCode`],"Pi model test":[`Pi 模型测试`,`اختبار نموذج Pi`],"Run checks":[`运行检查`,`تشغيل الفحوصات`],"Run checks and test models":[`运行检查并测试模型`,`تشغيل الفحوصات واختبار النماذج`],"Checking…":[`正在检查…`,`جارٍ الفحص…`],pass:[`通过`,`نجاح`],warn:[`警告`,`تحذير`],fail:[`失败`,`فشل`],"Import and backfill":[`导入和回填`,`الاستيراد والاستكمال`],"Automatic import":[`自动导入`,`الاستيراد التلقائي`],"Automatic import makes model calls. Changes apply at the next host start. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。更改在下次启动主机时生效。关闭后,正在运行的导入将在当前轮次结束后停止。`,`يستدعي الاستيراد التلقائي النموذج. تسري التغييرات عند بدء المضيف التالي. يوقف التعطيل الاستيراد بعد التبادل الحالي.`],"Import past chats automatically":[`自动导入过去的对话`,`استيراد المحادثات السابقة تلقائياً`],"Backfill model":[`历史导入模型`,`نموذج استيراد السجل`],"Same as live capture":[`与实时捕获相同`,`مثل الالتقاط المباشر`],"Saved. Changes apply at the next host start.":[`已保存。更改在下次启动主机时生效。`,`تم الحفظ. تسري التغييرات عند بدء المضيف التالي.`],State:[`状态`,`الحالة`],"not started":[`尚未开始`,`لم يبدأ`],"not-started":[`尚未开始`,`لم يبدأ`],Imported:[`已导入`,`مستورَد`],Pending:[`待处理`,`معلّق`],"Unresolved sessions":[`目录未解析的会话`,`جلسات بمجلدات غير محددة`],Cutoff:[`截止时间`,`وقت القطع`],stopped:[`已停止`,`توقف`],"Web app":[`网页应用`,`تطبيق الويب`],"Start web app at login":[`登录时启动网页应用`,`بدء تطبيق الويب عند تسجيل الدخول`],"Login item":[`登录启动项`,`عنصر بدء تسجيل الدخول`],"not installed":[`未安装`,`غير مثبّت`],"not-installed":[`未安装`,`غير مثبّت`],installed:[`已安装`,`مثبّت`],unsupported:[`不受支持`,`غير مدعوم`],"no-runtime":[`缺少运行环境`,`بيئة التشغيل غير متاحة`],"no-package":[`缺少软件包`,`الحزمة غير متاحة`],"no-launcher":[`缺少启动器`,`المشغّل غير متاح`],"Login items are unsupported on this platform.":[`此平台不支持登录启动项。`,`عناصر بدء تسجيل الدخول غير مدعومة على هذا النظام.`],"Install Node or Bun to start the web app at login.":[`安装 Node 或 Bun 后,网页应用才能在登录时启动。`,`ثبّت Node أو Bun لبدء تطبيق الويب عند تسجيل الدخول.`],"Use these commands to apply the change now:":[`使用以下命令立即应用更改:`,`استخدم هذه الأوامر لتطبيق التغيير الآن:`],"Saved. The login item changes at the next Pi or OpenCode start.":[`已保存。登录启动项将在下次启动 Pi 或 OpenCode 时更新。`,`تم الحفظ. يتغير عنصر بدء التشغيل عند بدء Pi أو OpenCode التالي.`],"History host":[`历史记录主机`,`مضيف السجل`],Scope:[`范围`,`النطاق`],"Current project":[`当前项目`,`المشروع الحالي`],"All projects":[`所有项目`,`كل المشاريع`],"Project directory":[`项目目录`,`مجلد المشروع`],"Current directory":[`当前目录`,`المجلد الحالي`],"Profile batch size":[`用户画像批量大小`,`حجم دفعة الملف الشخصي`],"Directory maps (old=new, one per line)":[`目录映射(旧=新,每行一条)`,`تعيين المجلدات (قديم=جديد، واحد في كل سطر)`],"Force reimport":[`强制重新导入`,`فرض إعادة الاستيراد`],"Skip memories":[`跳过记忆`,`تجاوز الذكريات`],"Skip profile":[`跳过用户画像`,`تجاوز الملف الشخصي`],"Import model":[`导入模型`,`نموذج الاستيراد`],"Saved external API":[`已保存的外部 API`,`واجهة API الخارجية المحفوظة`],"Preview (dry run)":[`预览(不写入)`,`معاينة (تشغيل تجريبي)`],"Start import":[`开始导入`,`بدء الاستيراد`],"Cancel after current unit":[`完成当前单元后取消`,`الإلغاء بعد الوحدة الحالية`],"Directory maps must be old=new, one per line":[`目录映射须为 旧=新,每行一条`,`يجب أن يكون تعيين المجلدات بصيغة قديم=جديد، واحد في كل سطر`],running:[`运行中`,`جارٍ التشغيل`],cancelling:[`正在取消`,`جارٍ الإلغاء`],cancelled:[`已取消`,`أُلغي`],done:[`已完成`,`اكتمل`],failed:[`失败`,`فشل`],units:[`单元`,`وحدات`],"List sessions":[`列出会话`,`عرض الجلسات`],"Refresh list":[`刷新列表`,`تحديث القائمة`],"Advanced options":[`高级选项`,`خيارات متقدمة`],"Hide advanced options":[`隐藏高级选项`,`إخفاء الخيارات المتقدمة`],"default location":[`默认位置`,`الموقع الافتراضي`],"Prompt date from":[`提示日期起`,`تاريخ الطلب من`],"Prompt date to":[`提示日期止`,`تاريخ الطلب إلى`],"Prompt dates are inclusive, use your time zone, and filter the turns inside each session, not the list. Empty dates include every turn.":[`提示日期包含首尾两天,按你所在时区计算,只筛选每个会话中的对话轮次,不筛选列表。留空则包含所有轮次。`,`تواريخ الطلب شاملة لليومين، وتُحسب بمنطقتك الزمنية، وتُصفّي الأدوار داخل كل جلسة لا القائمة. تركها فارغة يشمل كل الأدوار.`],"Sessions with directories that no longer exist":[`目录已不存在的会话`,`جلسات لم تعد مجلداتها موجودة`],"Show them and add a directory map":[`显示它们并添加目录映射`,`اعرضها وأضف تعيين مجلد`],Selected:[`已选择`,`المحدد`],"Select all matching":[`选择所有匹配项`,`تحديد كل المطابق`],"Clear selection":[`清除选择`,`مسح التحديد`],Select:[`选择`,`تحديد`],Created:[`创建时间`,`تاريخ الإنشاء`],"Resolved by":[`解析方式`,`طريقة التحديد`],recorded:[`记录的目录`,`المجلد المسجّل`],mapped:[`目录映射`,`تعيين مجلد`],"project root":[`项目根目录`,`جذر المشروع`],missing:[`缺失`,`مفقود`],"No sessions match.":[`没有匹配的会话。`,`لا توجد جلسات مطابقة.`],Previous:[`上一页`,`السابق`],Next:[`下一页`,`التالي`],None:[`无`,`لا شيء`],"Configured, not tested.":[`已配置,未测试。`,`مُعدّ، لم يُختبر.`],"An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode.":[`使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。`,`يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode.`],"The chosen OpenCode model is not connected here. An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode. Choose the external API for a web import.":[`所选 OpenCode 模型在此处未连接。使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。网页导入请选择外部 API。`,`نموذج OpenCode المختار غير متصل هنا. يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode. اختر واجهة API الخارجية للاستيراد من الصفحة.`],"Test models in Health":[`在健康检查中测试模型`,`اختبر النماذج في قسم السلامة`],Import:[`导入`,`استيراد`],sessions:[`个会话`,`جلسات`],"1 session":[`1 个会话`,`جلسة واحدة`],"List sessions first.":[`请先列出会话。`,`اعرض الجلسات أولاً.`],"Options changed. Refresh the session list first.":[`选项已更改。请先刷新会话列表。`,`تغيّرت الخيارات. حدّث قائمة الجلسات أولاً.`],"Select at least one session.":[`请至少选择一个会话。`,`حدّد جلسة واحدة على الأقل.`],"Select at most 1000 sessions one by one, or use Select all matching.":[`逐个选择最多 1000 个会话,或使用“选择所有匹配项”。`,`حدّد 1000 جلسة كحد أقصى واحدة تلو الأخرى، أو استخدم «تحديد كل المطابق».`],"Model readiness is unknown. Reload the page.":[`无法确定模型是否就绪。请重新加载页面。`,`حالة جاهزية النموذج غير معروفة. أعد تحميل الصفحة.`],"No import model is ready. Connect a model in OpenCode or complete the external API settings.":[`没有可用的导入模型。请在 OpenCode 中连接模型,或补全外部 API 设置。`,`لا يوجد نموذج استيراد جاهز. اربط نموذجاً في OpenCode أو أكمل إعدادات واجهة API الخارجية.`],"The external API is not ready":[`外部 API 未就绪`,`واجهة API الخارجية غير جاهزة`],"The external API has no memoryModel in the global config":[`全局配置中缺少外部 API 的 memoryModel`,`لا يحتوي الإعداد العام على memoryModel لواجهة API الخارجية`],"The external API has no memoryApiUrl in the global config":[`全局配置中缺少外部 API 的 memoryApiUrl`,`لا يحتوي الإعداد العام على memoryApiUrl لواجهة API الخارجية`],"The external API key is missing in the OpenCode process; check memoryApiKey and its env:// or file:// source":[`OpenCode 进程中缺少外部 API 密钥;请检查 memoryApiKey 及其 env:// 或 file:// 来源`,`مفتاح واجهة API الخارجية غير موجود في عملية OpenCode؛ تحقّق من memoryApiKey ومصدره env:// أو file://`],"The memoryProvider in the global config is not supported for imports":[`全局配置中的 memoryProvider 不支持导入`,`مزوّد memoryProvider في الإعداد العام غير مدعوم للاستيراد`],"Pi sessions folder or one .jsonl session file":[`Pi 会话文件夹或单个 .jsonl 会话文件`,`مجلد جلسات Pi أو ملف جلسة ‎.jsonl واحد`],"OpenCode database file":[`OpenCode 数据库文件`,`ملف قاعدة بيانات OpenCode`],"Absolute path, for example on a mounted volume":[`绝对路径,例如已挂载卷上的路径`,`مسار مطلق، مثلاً على وحدة تخزين مركّبة`],"Use this source":[`使用此来源`,`استخدم هذا المصدر`],Browse:[`浏览`,`استعراض`],"Use the default location":[`使用默认位置`,`استخدم الموقع الافتراضي`],"Chosen source":[`已选来源`,`المصدر المختار`],Choose:[`选择`,`اختيار`],"Only the first 500 entries are shown.":[`仅显示前 500 项。`,`تُعرض أول 500 عنصر فقط.`],"Reload the page before saving again.":[`再次保存前请重新加载页面。`,`أعد تحميل الصفحة قبل الحفظ مرة أخرى.`],"The current settings could not be reloaded. Reload the page.":[`无法重新加载当前设置。请重新加载页面。`,`تعذّر إعادة تحميل الإعدادات الحالية. أعد تحميل الصفحة.`],Log:[`日志`,`السجل`],"Capture attempts only":[`仅显示捕获尝试`,`محاولات الالتقاط فقط`],Refresh:[`刷新`,`تحديث`],"Copy log path":[`复制日志路径`,`نسخ مسار السجل`],"Log lines":[`日志行`,`أسطر السجل`],"No log has been written yet.":[`尚未写入日志。`,`لم يُكتب سجل بعد.`],"Loading log…":[`正在加载日志…`,`جارٍ تحميل السجل…`],Level:[`级别`,`المستوى`],Warning:[`警告`,`تحذير`],Error:[`错误`,`خطأ`],info:[`信息`,`معلومات`],error:[`错误`,`خطأ`],"Level guessed from the message":[`级别由消息内容推测`,`المستوى مُخمَّن من نص الرسالة`],"Copy visible records":[`复制可见记录`,`نسخ السجلات المعروضة`],Copied:[`已复制`,`تم النسخ`],"No matching log records.":[`没有匹配的日志记录。`,`لا توجد سجلات مطابقة.`],"External API":[`外部 API`,`واجهة API الخارجية`],"An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.":[`兼容 OpenAI 或 Anthropic 的端点,两个宿主都可用于捕获和回填。`,`نقطة نهاية متوافقة مع OpenAI أو Anthropic يمكن لأي مضيف استخدامها للالتقاط والاستيراد.`],Provider:[`提供商`,`المزوّد`],"API URL":[`API 地址`,`عنوان API`],"API key":[`API 密钥`,`مفتاح API`],"Save endpoint":[`保存端点`,`حفظ نقطة النهاية`],"Nothing to save.":[`没有需要保存的内容。`,`لا يوجد ما يُحفظ.`],"Key source":[`密钥来源`,`مصدر المفتاح`],"environment variable":[`环境变量`,`متغير البيئة`],"key file":[`密钥文件`,`ملف المفتاح`],"set in the config file":[`在配置文件中设置`,`مضبوط في ملف الإعدادات`],"resolves in the web app":[`可在网页应用中解析`,`يُقرأ في تطبيق الويب`],"does not resolve in the web app":[`无法在网页应用中解析`,`لا يُقرأ في تطبيق الويب`],"A login web app does not see variables set only in a shell profile; a key file works everywhere.":[`登录时启动的网页应用看不到仅在 shell 配置文件中设置的变量;密钥文件在任何地方都可用。`,`تطبيق الويب الذي يبدأ عند تسجيل الدخول لا يرى المتغيرات المضبوطة في ملف الصدفة فقط؛ ملف المفتاح يعمل في كل مكان.`],"The key does not resolve in this web app. Save it to a key file instead.":[`此网页应用无法解析该密钥。请改为保存到密钥文件。`,`لا يُقرأ المفتاح في تطبيق الويب هذا. احفظه في ملف مفتاح بدلاً من ذلك.`],"Environment variable":[`环境变量`,`متغير البيئة`],"Key file":[`密钥文件`,`ملف المفتاح`],"Save key to a private file":[`将密钥保存到私有文件`,`حفظ المفتاح في ملف خاص`],"Variable name":[`变量名`,`اسم المتغير`],"Key file path":[`密钥文件路径`,`مسار ملف المفتاح`],"Key file name":[`密钥文件名`,`اسم ملف المفتاح`],"The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.":[`密钥写入 ~/.config/omms/secrets/,仅你可读,之后不再显示。`,`يُكتب المفتاح في ~/.config/omms/secrets/ ولا يقرؤه غيرك، ولن يُعرض مرة أخرى.`],"Save key source":[`保存密钥来源`,`حفظ مصدر المفتاح`],"Key source saved.":[`密钥来源已保存。`,`تم حفظ مصدر المفتاح.`],"A key file with this name exists. Replace it?":[`已存在同名密钥文件。要替换吗?`,`يوجد ملف مفتاح بهذا الاسم. هل تريد استبداله؟`],"Enter a variable name such as ZAI_API_KEY":[`请输入变量名,例如 ZAI_API_KEY`,`أدخل اسم متغير مثل ZAI_API_KEY`],"Enter the path of a key file":[`请输入密钥文件路径`,`أدخل مسار ملف المفتاح`],"Name the key file with letters, digits, dashes, or underscores":[`密钥文件名只能包含字母、数字、短横线或下划线`,`سمِّ ملف المفتاح بحروف أو أرقام أو شرطات أو شرطات سفلية`],"Paste the key":[`请粘贴密钥`,`الصق المفتاح`],Test:[`测试`,`اختبار`],"Test call succeeded":[`测试调用成功`,`نجح استدعاء الاختبار`],"Test call failed":[`测试调用失败`,`فشل استدعاء الاختبار`],"External API needs":[`外部 API 缺少`,`تحتاج واجهة API الخارجية إلى`],"Automatic import makes model calls. A model change applies at the next run. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。模型更改在下次运行时生效。关闭后,正在进行的导入会在当前对话完成后停止。`,`يستدعي الاستيراد التلقائي النماذج. يسري تغيير النموذج في التشغيل التالي. إيقافه يوقف الاستيراد الجاري بعد المحادثة الحالية.`],"Saved. Changes apply at the next run.":[`已保存。更改在下次运行时生效。`,`تم الحفظ. تسري التغييرات في التشغيل التالي.`],paused:[`已暂停`,`متوقف مؤقتاً`],"started from auto":[`自动启动`,`بدأ تلقائياً`],"started from web":[`从网页启动`,`بدأ من الويب`],"started from cli":[`从终端启动`,`بدأ من الطرفية`],"started from slash":[`从斜杠命令启动`,`بدأ من أمر الشرطة المائلة`],"Minutes left":[`剩余分钟`,`الدقائق المتبقية`],unknown:[`未知`,`غير معروف`],about:[`约`,`حوالي`],Pause:[`暂停`,`إيقاف مؤقت`],Resume:[`继续`,`استئناف`],"Pausing after the current exchange.":[`将在当前对话完成后暂停。`,`سيتوقف مؤقتاً بعد المحادثة الحالية.`],"Backfill started.":[`回填已开始。`,`بدأ الاستيراد.`],"The list is still loading. Try again in a moment.":[`列表仍在加载。请稍后再试。`,`لا تزال القائمة قيد التحميل. حاول مرة أخرى بعد لحظة.`],"Paused. No import starts until you resume.":[`已暂停。恢复前不会开始导入。`,`تم الإيقاف مؤقتاً. لن يبدأ أي استيراد حتى تستأنفه.`],"Directory maps":[`目录映射`,`خرائط المجلدات`],"Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.":[`将已移动或删除的目录映射到其所属项目。更改在下次导入或回填时生效。`,`اربط مجلداً نُقل أو حُذف بالمشروع الذي ينتمي إليه. يسري التغيير في الاستيراد التالي.`],"Saved maps":[`已保存的映射`,`الخرائط المحفوظة`],Keep:[`保留`,`إبقاء`],Remove:[`移除`,`إزالة`],"Unresolved directories":[`无法解析的目录`,`مجلدات غير محلولة`],"No unresolved directories in the latest run.":[`最近一次运行没有无法解析的目录。`,`لا توجد مجلدات غير محلولة في آخر تشغيل.`],"No suggestion found.":[`未找到建议。`,`لم يُعثر على اقتراح.`],"Target directory":[`目标目录`,`المجلد الهدف`],"Saved. Maps apply to the next import or backfill run.":[`已保存。映射在下次导入或回填时生效。`,`تم الحفظ. تسري الخرائط في الاستيراد التالي.`],"Memory language":[`记忆语言`,`لغة الذاكرة`],"The language that new memory summaries are written in. Automatic detects it from your prompt, but a Latin-script prompt under 100 characters counts as English.":[`新记忆摘要使用的语言。“自动”会根据你的提示检测语言,但少于 100 个字符的拉丁字母提示按英语处理。`,`اللغة التي تُكتب بها ملخصات الذاكرة الجديدة. يكتشفها الوضع التلقائي من موجّهك، لكن الموجّه بالأحرف اللاتينية الأقصر من 100 حرف يُعدّ إنجليزياً.`],"Summary language":[`摘要语言`,`لغة الملخص`],Appearance:[`外观`,`المظهر`],Theme:[`主题`,`السمة`],"Theme mode":[`主题模式`,`وضع السمة`],System:[`系统`,`النظام`],Light:[`浅色`,`فاتح`],Dark:[`深色`,`داكن`],"Light theme":[`浅色主题`,`السمة الفاتحة`],"Dark theme":[`深色主题`,`السمة الداكنة`],"On screen now":[`当前显示`,`معروضة الآن`],"No theme matches.":[`没有匹配的主题。`,`لا توجد سمة مطابقة.`],"Filter themes":[`筛选主题`,`تصفية السمات`],"System follows your operating system and switches between the light and the dark theme. The choice stays in this browser.":[`“系统”跟随操作系统,在浅色和深色主题之间切换。此选择只保存在此浏览器中。`,`يتبع «النظام» نظام التشغيل ويبدّل بين السمة الفاتحة والداكنة. يبقى الاختيار في هذا المتصفح.`],"Date and time":[`日期和时间`,`التاريخ والوقت`],"How dates and times show in this web app. The choice stays in this browser.":[`此网页应用中日期和时间的显示方式。此选择只保存在此浏览器中。`,`طريقة عرض التواريخ والأوقات في تطبيق الويب هذا. يبقى الاختيار في هذا المتصفح.`],"Date format":[`日期格式`,`تنسيق التاريخ`],"Time format":[`时间格式`,`تنسيق الوقت`],"Day month year":[`日 月 年`,`يوم شهر سنة`],"Month day year":[`月 日 年`,`شهر يوم سنة`],"Year-month-day":[`年-月-日`,`سنة-شهر-يوم`],"24-hour":[`24 小时制`,`24 ساعة`],"12-hour":[`12 小时制`,`12 ساعة`],Automatic:[`自动`,`تلقائي`],"Saved. New memories use this language.":[`已保存。新记忆将使用此语言。`,`تم الحفظ. ستستخدم الذكريات الجديدة هذه اللغة.`],"Claude Code folder":[`Claude Code 文件夹`,`مجلد Claude Code`],"Set this when Claude Code does not use ~/.claude, for example when you start it with CLAUDE_CONFIG_DIR. Leave it empty to use the default.":[`当 Claude Code 不使用 ~/.claude 时(例如用 CLAUDE_CONFIG_DIR 启动它),请设置此项。留空则使用默认文件夹。`,`اضبط هذا عندما لا يستخدم Claude Code المجلد ‎~/.claude، مثلاً عند تشغيله مع CLAUDE_CONFIG_DIR. اتركه فارغاً لاستخدام المجلد الافتراضي.`],"Save folder":[`保存文件夹`,`حفظ المجلد`],"Transcripts folder in use":[`正在使用的会话记录文件夹`,`مجلد سجلات الجلسات المستخدم`],From:[`来源`,`المصدر`],"this setting":[`此设置`,`هذا الإعداد`],"the CLAUDE_CONFIG_DIR variable of the web app":[`网页应用的 CLAUDE_CONFIG_DIR 变量`,`متغير CLAUDE_CONFIG_DIR لتطبيق الويب`],"the default folder":[`默认文件夹`,`المجلد الافتراضي`],"This folder does not exist. Claude Code capture and import will not work:":[`此文件夹不存在。Claude Code 的捕获和导入将无法工作:`,`هذا المجلد غير موجود. لن يعمل الالتقاط والاستيراد في Claude Code:`],"Enter a full path, or a path that starts with ~/.":[`请输入完整路径,或以 ~/ 开头的路径。`,`أدخل مساراً كاملاً، أو مساراً يبدأ بـ ‎~/.`],"Saved. Capture and import use this folder now.":[`已保存。捕获和导入现在使用此文件夹。`,`تم الحفظ. يستخدم الالتقاط والاستيراد هذا المجلد الآن.`],"Running version":[`运行版本`,`الإصدار الجاري`],"Global command":[`全局命令`,`الأمر العام`],"not installed globally":[`未全局安装`,`غير مثبت عمومياً`],"A newer OMMS copy runs in place of the global install. The global install is optional. To update it:":[`正在运行的是更新的 OMMS 副本,而不是全局安装。全局安装是可选的。更新方法:`,`تعمل نسخة OMMS أحدث بدلاً من التثبيت العام. التثبيت العام اختياري. لتحديثه:`],"The global install is newer than the running OMMS. The next Pi or OpenCode start replaces the web app.":[`全局安装比正在运行的 OMMS 更新。下次启动 Pi 或 OpenCode 时将替换网页应用。`,`التثبيت العام أحدث من OMMS الجاري. سيستبدل التشغيل التالي لـ Pi أو OpenCode تطبيق الويب.`],"OMMS is not installed globally. A global install is optional.":[`OMMS 未全局安装。全局安装是可选的。`,`OMMS غير مثبت عمومياً. التثبيت العام اختياري.`],"Keys and access":[`密钥与访问`,`المفاتيح والوصول`],"not needed":[`不需要`,`غير مطلوب`],"External API key":[`外部 API 密钥`,`مفتاح واجهة API الخارجية`],"Embedding server key":[`嵌入服务器密钥`,`مفتاح خادم التضمين`],"Capture and profile learning through the external API. Claude Code always uses it.":[`通过外部 API 进行捕获和用户画像学习。Claude Code 始终使用它。`,`الالتقاط وتعلّم الملف الشخصي عبر واجهة API الخارجية. يستخدمه Claude Code دائماً.`],"Sent to an embedding server on another machine.":[`发送给另一台机器上的嵌入服务器。`,`يُرسَل إلى خادم تضمين على جهاز آخر.`],"Let scripts and other computers call the web app's API.":[`允许脚本和其他电脑调用网页应用的 API。`,`تتيح للبرامج النصية والحواسيب الأخرى استدعاء واجهة API لتطبيق الويب.`],"Asks for a user name and password before the page opens.":[`打开页面前要求输入用户名和密码。`,`يطلب اسم مستخدم وكلمة مرور قبل فتح الصفحة.`],"External API card":[`外部 API 卡片`,`بطاقة واجهة API الخارجية`],"Embedding card":[`嵌入卡片`,`بطاقة التضمين`],"Table below":[`下方表格`,`الجدول أدناه`],"Form below":[`下方表单`,`النموذج أدناه`],"API tokens":[`API 令牌`,`رموز API`],"Browser password":[`浏览器密码`,`كلمة مرور المتصفح`],"The config file still sets webServerApiToken. OMMS imported it once as the token “from config file” and no longer reads the key. Use the token table instead.":[`配置文件仍设置了 webServerApiToken。OMMS 已将其导入一次,作为令牌“from config file”,之后不再读取该键。请改用令牌表。`,`لا يزال ملف الإعدادات يضبط webServerApiToken. استورده OMMS مرة واحدة كرمز باسم “from config file” ولم يعد يقرأ هذا المفتاح. استخدم جدول الرموز بدلاً منه.`],"Open this page on the computer that runs OMMS to manage tokens and the password.":[`请在运行 OMMS 的电脑上打开此页面,以管理令牌和密码。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لإدارة الرموز وكلمة المرور.`],"Revoke this token? Scripts that use it stop working.":[`撤销此令牌?使用它的脚本将停止工作。`,`إلغاء هذا الرمز؟ ستتوقف البرامج النصية التي تستخدمه عن العمل.`],"No browser password is set.":[`未设置浏览器密码。`,`لم تُضبط كلمة مرور للمتصفح.`],"A browser password is set for user":[`已为以下用户设置浏览器密码:`,`ضُبطت كلمة مرور المتصفح للمستخدم`],"A browser password is set for your computer user name.":[`已为你的电脑用户名设置浏览器密码。`,`ضُبطت كلمة مرور المتصفح لاسم مستخدم حاسوبك.`],"User name":[`用户名`,`اسم المستخدم`],Password:[`密码`,`كلمة المرور`],"Save password":[`保存密码`,`حفظ كلمة المرور`],"Clear password":[`清除密码`,`مسح كلمة المرور`],"Saved. Restart the web app to use the new browser password.":[`已保存。重启网页应用以使用新的浏览器密码。`,`تم الحفظ. أعد تشغيل تطبيق الويب لاستخدام كلمة مرور المتصفح الجديدة.`],Name:[`名称`,`الاسم`],Expires:[`过期时间`,`تاريخ الانتهاء`],"Last used":[`上次使用`,`آخر استخدام`],Never:[`永不`,`أبداً`],Revoke:[`撤销`,`إلغاء`],Copy:[`复制`,`نسخ`],"Copy this token now. It will not be shown again.":[`请立即复制此令牌。它不会再次显示。`,`انسخ هذا الرمز الآن. لن يُعرض مرة أخرى.`],"Token name":[`令牌名称`,`اسم الرمز`],"Expires after":[`有效期`,`ينتهي بعد`],"Generate token":[`生成令牌`,`إنشاء رمز`],All:[`全部`,`الكل`],Kind:[`类型`,`النوع`],"Built-in model":[`内置模型`,`النموذج المدمج`],"OpenAI-compatible server":[`OpenAI 兼容服务器`,`خادم متوافق مع OpenAI`],"Server URL":[`服务器 URL`,`عنوان URL للخادم`],"Vector size":[`向量维度`,`حجم المتجه`],"Stored memories":[`已存储的记忆`,`الذكريات المخزنة`],"Re-embedding":[`正在重新嵌入`,`جارٍ إعادة التضمين`],"Re-embed finished.":[`重新嵌入已完成。`,`اكتملت إعادة التضمين.`],"Re-embed failed":[`重新嵌入失败`,`فشلت إعادة التضمين`],Retry:[`重试`,`إعادة المحاولة`],Lock:[`锁定`,`قفل`],"Unlock to change":[`解锁以更改`,`افتح القفل للتغيير`],"The model that turns memory text into search vectors. A change re-embeds every memory.":[`将记忆文本转换为搜索向量的模型。更改后会重新嵌入所有记忆。`,`النموذج الذي يحوّل نص الذكريات إلى متجهات بحث. يؤدي تغييره إلى إعادة تضمين كل الذكريات.`],Preset:[`预设`,`إعداد مسبق`],Custom:[`自定义`,`مخصص`],"No key":[`无密钥`,`بلا مفتاح`],"Keep the saved key":[`保留已保存的密钥`,`الاحتفاظ بالمفتاح المحفوظ`],Apply:[`应用`,`تطبيق`],Cancel:[`取消`,`إلغاء الأمر`],"Test passed. Vector size":[`测试通过。向量维度`,`نجح الاختبار. حجم المتجه`],"Test failed":[`测试失败`,`فشل الاختبار`],"Every stored memory will be re-embedded":[`所有已存储的记忆都将重新嵌入`,`ستُعاد عملية تضمين كل الذكريات المخزنة`],"The hosted server is called once for each memory, which may cost money.":[`托管服务器会为每条记忆调用一次,可能产生费用。`,`يُستدعى الخادم المستضاف مرة لكل ذكرى، وقد يكلّف ذلك مالاً.`],"Search results are poor until the re-embed ends.":[`在重新嵌入结束前,搜索结果质量较差。`,`تكون نتائج البحث ضعيفة حتى تنتهي إعادة التضمين.`],"Restart open OpenCode and Pi sessions after the change.":[`更改后请重启已打开的 OpenCode 和 Pi 会话。`,`أعد تشغيل جلسات OpenCode وPi المفتوحة بعد التغيير.`],"Profile learning":[`用户画像学习`,`تعلّم الملف الشخصي`],"Catch up analyses every waiting prompt with the saved external API, 50 prompts for each model call.":[`补齐会使用已保存的外部 API 分析所有等待中的提示词,每次模型调用处理 50 条。`,`يحلّل اللحاق كل الطلبات المنتظرة عبر واجهة API الخارجية المحفوظة، 50 طلباً لكل استدعاء للنموذج.`],"Open this page on the computer that runs OMMS to start a catch-up run.":[`请在运行 OMMS 的电脑上打开此页面以开始补齐。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لبدء اللحاق.`],"Prompts waiting for profile learning":[`等待用户画像学习的提示词`,`الطلبات المنتظرة لتعلّم الملف الشخصي`],"Model calls":[`模型调用次数`,`استدعاءات النموذج`],"Batches done":[`已完成批次`,`الدفعات المكتملة`],"Prompts waiting":[`等待中的提示词`,`الطلبات المنتظرة`],Paused:[`已暂停`,`متوقف مؤقتاً`],Finished:[`已完成`,`اكتمل`],Stopped:[`已停止`,`توقّف`],"Catch up profile":[`补齐用户画像`,`اللحاق بالملف الشخصي`],"Start profile learning for the waiting prompts? Model calls":[`为等待中的提示词开始用户画像学习?模型调用次数`,`بدء تعلّم الملف الشخصي للطلبات المنتظرة؟ عدد استدعاءات النموذج`],"never used before":[`从未使用`,`لم يُستخدم من قبل`],"A newer catch-up run took over.":[`较新的补齐任务已接管。`,`تولّت عملية لحاق أحدث المهمة.`],"Browser password cleared. Restart the web app to turn it off.":[`浏览器密码已清除。重启网页应用以关闭它。`,`تم مسح كلمة مرور المتصفح. أعد تشغيل تطبيق الويب لإيقافها.`],Actions:[`操作`,`الإجراءات`],"All exchanges are done. Learning the profile from the imported prompts":[`所有对话已完成。正在从导入的提示中学习画像`,`اكتملت كل المحادثات. يجري تعلّم الملف الشخصي من المطالبات المستوردة`],batches:[`批`,`دفعات`],"Change it in":[`修改位置`,`مكان التغيير`],"Check them, then press Save maps.":[`请检查后点击保存映射。`,`راجعها ثم اضغط حفظ الخرائط.`],Credential:[`凭据`,`بيانات الاعتماد`],Email:[`邮箱`,`البريد الإلكتروني`],Filled:[`已填写`,`تم الملء`],"Finds the project each missing directory belongs to, mostly the main repository of a deleted worktree, and fills it in for you to check. Nothing is saved until you press Save maps.":[`为每个缺失的目录找到所属项目(多为已删除工作树的主仓库),并填入供你检查。点击保存映射之前不会保存任何内容。`,`يعثر على المشروع الذي ينتمي إليه كل مجلد مفقود، وغالباً المستودع الرئيسي لشجرة عمل محذوفة، ويملؤه لتراجعه. لا يُحفظ شيء حتى تضغط حفظ الخرائط.`],Hosts:[`主机`,`المضيفات`],"Import status":[`导入状态`,`حالة الاستيراد`],"in use":[`使用中`,`قيد الاستخدام`],"Last run":[`上次运行`,`آخر تشغيل`],"Last update":[`最后更新`,`آخر تحديث`],"Learning profile":[`正在学习画像`,`يجري تعلّم الملف الشخصي`],"Merge into":[`合并到`,`دمج في`],"Merge this profile into the other one? The source profile is turned off, not deleted.":[`将此画像合并到另一个画像?源画像会被停用,不会被删除。`,`دمج هذا الملف الشخصي في الآخر؟ يُوقَف الملف المصدر ولا يُحذف.`],"Merged.":[`已合并。`,`تم الدمج.`],"model not recorded":[`未记录模型`,`لم يُسجَّل نموذج`],model:[`个模型`,`نموذج`],models:[`个模型`,`نماذج`],"No directory recorded":[`未记录目录`,`لم يُسجَّل مجلد`],"No suggestion":[`无建议`,`لا اقتراح`],"Not started":[`未开始`,`لم يبدأ`],"OMMS keeps one profile for each git email. A folder whose repository has its own email starts a second profile. Choose the profile that is yours, or merge the extra one into it.":[`OMMS 为每个 git 邮箱保留一个画像。若某文件夹的仓库设置了自己的邮箱,就会产生第二个画像。请选择属于你的画像,或把多余的画像合并进去。`,`يحتفظ OMMS بملف شخصي لكل بريد git. المجلد الذي يملك مستودعه بريداً خاصاً يبدأ ملفاً شخصياً ثانياً. اختر ملفك الشخصي، أو ادمج الملف الزائد فيه.`],"Outcomes by host":[`各主机结果`,`النتائج حسب المضيف`],"Partly imported":[`部分已导入`,`مستورد جزئياً`],Patterns:[`模式`,`الأنماط`],pending:[`待处理`,`معلّق`],Preferences:[`偏好`,`التفضيلات`],Profiles:[`画像`,`الملفات الشخصية`],"Prompts analysed":[`已分析提示`,`المطالبات المحلَّلة`],Running:[`运行中`,`قيد التشغيل`],"Saved maps apply to every host.":[`已保存的映射适用于所有主机。`,`تنطبق الخرائط المحفوظة على كل المضيفات.`],"Saved: a memory was stored. Skipped: the model or a rule found nothing worth keeping, or the turn was private or trivial. Failed: the attempt hit an error. Total: the three added up. Each percentage is a share of its row's total.":[`已保存:存储了一条记忆。已跳过:模型或规则认为没有值得保留的内容,或该轮为私密或琐碎内容。失败:尝试出错。总计:三者之和。每个百分比是该行总计中的占比。`,`محفوظ: خُزّنت ذاكرة. متجاوز: لم يجد النموذج أو قاعدة ما يستحق الحفظ، أو كانت الجولة خاصة أو تافهة. فشل: واجهت المحاولة خطأ. الإجمالي: مجموع الثلاثة. كل نسبة هي حصة من إجمالي صفها.`],"Saved. OMMS now uses this profile in every folder.":[`已保存。OMMS 现在在所有文件夹中使用此画像。`,`تم الحفظ. يستخدم OMMS هذا الملف الشخصي الآن في كل المجلدات.`],Directories:[`目录数`,`عدد المجلدات`],"No target chosen":[`尚未选择目标`,`لم يُختر مجلد مستهدف`],"Smart resolve directories":[`智能解析目录`,`حلّ المجلدات تلقائياً`],Exact:[`精确`,`مطابقة تامة`],"Name match":[`名称匹配`,`مطابقة بالاسم`],Guess:[`猜测`,`تخمين`],Confidence:[`可信度`,`درجة الثقة`],"Temporary folder":[`临时文件夹`,`مجلد مؤقت`],"node_modules folder":[`node_modules 文件夹`,`مجلد node_modules`],"App data folder":[`应用数据文件夹`,`مجلد بيانات التطبيقات`],"Skills folder":[`技能文件夹`,`مجلد المهارات`],"Rows with a target":[`已有目标的行数`,`عدد الصفوف ذات المجلد المستهدف`],"Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.":[`智能解析会在对话框中列出每个建议的映射和忽略项。勾选要保留的项,然后点击确认。在此之前不会保存任何内容。`,`يعرض الحلّ التلقائي كل خريطة مقترحة وكل تجاهل مقترح في مربع حوار. حدّد ما تريد الاحتفاظ به، ثم اضغط تأكيد. لا يُحفظ شيء قبل ذلك.`],"Suggested to ignore":[`建议忽略`,`مقترح للتجاهل`],Ignore:[`忽略`,`تجاهل`],Restore:[`恢复`,`استعادة`],"No target":[`无目标`,`بلا مجلد مستهدف`],"Save this map":[`保存此映射`,`حفظ هذه الخريطة`],"Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.":[`勾选要保留的映射和忽略项,然后点击确认保存。保存的映射将在所有主机的下一次导入或回填时生效。`,`حدّد الخرائط وعناصر التجاهل التي تريد الاحتفاظ بها، ثم اضغط تأكيد لحفظها. تسري الخرائط المحفوظة على كل المضيفات في عملية الاستيراد أو الاستكمال التالية.`],"Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.":[`没有可保存的内容。请在行中输入目标,或对不是项目的文件夹点击忽略。`,`لا يوجد ما يُحفظ. اكتب مجلداً مستهدفاً في صف، أو اضغط تجاهل للمجلدات التي ليست مشاريع.`],"Ignored directories":[`已忽略的目录`,`المجلدات المتجاهَلة`],"Ignored directories stay unimported and leave the unresolved counts.":[`已忽略的目录保持未导入,并且不计入未解析数量。`,`تبقى المجلدات المتجاهَلة دون استيراد، ولا تُحسب ضمن الأعداد غير المحلولة.`],"They apply to the next import or backfill run. No sessions were imported.":[`它们将在下一次导入或回填时生效。未导入任何会话。`,`تسري في عملية الاستيراد أو الاستكمال التالية. لم تُستورد أي جلسات.`],"Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.":[`会话导入后请保留映射。每次导入在跳过会话之前都会先检查映射,因此删除映射会使其会话在下次运行时重新变为未解析。`,`احتفظ بالخريطة بعد استيراد جلساتها. يفحص كل استيراد الخريطة قبل أن يتجاوز جلسة، لذا فإن حذف الخريطة يجعل جلساتها غير محلولة مجدداً في التشغيل التالي.`],"Save removals":[`保存删除`,`حفظ عمليات الحذف`],"Settings changed elsewhere. Check the list and try again.":[`设置已在其他位置更改。请检查列表后再试。`,`تغيّرت الإعدادات في مكان آخر. راجع القائمة، ثم حاول مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再试。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة، ثم حاول مجدداً.`],"Saved. Removed maps stop applying at the next import or backfill run.":[`已保存。删除的映射将从下一次导入或回填起不再生效。`,`تم الحفظ. تتوقف الخرائط المحذوفة عن السريان في عملية الاستيراد أو الاستكمال التالية.`],"Removals could not be saved. Try again.":[`无法保存删除。请重试。`,`تعذّر حفظ عمليات الحذف. حاول مجدداً.`],"Ignored. The directory stays unimported.":[`已忽略。该目录保持未导入。`,`تم التجاهل. يبقى المجلد دون استيراد.`],"The directory could not be ignored. Try again.":[`无法忽略该目录。请重试。`,`تعذّر تجاهل المجلد. حاول مجدداً.`],"Restored. The directory shows again in each host list that reported it.":[`已恢复。该目录会重新出现在报告它的每个主机列表中。`,`تمت الاستعادة. يظهر المجلد مجدداً في قائمة كل مضيف أبلغ عنه.`],"The directory could not be restored. Try again.":[`无法恢复该目录。请重试。`,`تعذّرت استعادة المجلد. حاول مجدداً.`],"Saved, but the list could not be refreshed. Refresh the list without saving again.":[`已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`تم الحفظ، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"Review directory maps":[`检查目录映射`,`مراجعة خرائط المجلدات`],"Proposed maps":[`建议映射数`,`عدد الخرائط المقترحة`],Sessions:[`会话数`,`عدد الجلسات`],Confirm:[`确认`,`تأكيد`],"Saving…":[`正在保存…`,`جارٍ الحفظ…`],"Settings refreshed. No maps were saved.":[`设置已刷新。未保存任何映射。`,`حُدّثت الإعدادات. لم تُحفظ أي خرائط.`],"Settings could not be refreshed. Try Refresh list again.":[`无法刷新设置。请再次点击刷新列表。`,`تعذّر تحديث الإعدادات. حاول تحديث القائمة مجدداً.`],"Maps could not be saved. Review the targets and confirm again.":[`无法保存映射。请检查目标后再次确认。`,`تعذّر حفظ الخرائط. راجع المجلدات المستهدفة، ثم أكّد مجدداً.`],"Settings changed elsewhere. Review these maps and confirm again.":[`设置已在其他位置更改。请检查这些映射后再次确认。`,`تغيّرت الإعدادات في مكان آخر. راجع هذه الخرائط، ثم أكّد مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再次确认。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة قبل التأكيد مجدداً.`],"Maps were saved, but the list could not be refreshed. Refresh the list without saving again.":[`映射已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`حُفظت الخرائط، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"No model was recorded for these attempts. This happens with records written by older OMMS versions, and when an attempt stops before a model is chosen.":[`这些尝试没有记录模型。旧版 OMMS 写入的记录,以及在选定模型之前就停止的尝试,会出现这种情况。`,`لم يُسجَّل نموذج لهذه المحاولات. يحدث ذلك في السجلات التي كتبتها إصدارات أقدم من OMMS، وعندما تتوقف المحاولة قبل اختيار نموذج.`],"These sessions cannot be mapped.":[`这些会话无法映射。`,`لا يمكن ربط هذه الجلسات.`],unresolved:[`未解析`,`غير محلول`],"Use this profile":[`使用此画像`,`استخدام هذا الملف الشخصي`],"Use this profile for every folder?":[`在所有文件夹中使用此画像?`,`استخدام هذا الملف الشخصي في كل المجلدات؟`],"Used for":[`用途`,`الاستخدام`],Workflows:[`工作流`,`سير العمل`],Memory:[`记忆`,`الذاكرة`],Setting:[`设置`,`الإعداد`],Value:[`数值`,`القيمة`],Default:[`默认值`,`القيمة الافتراضية`],Unit:[`单位`,`الوحدة`],Affects:[`影响`,`التأثير`],Results:[`条结果`,`نتائج`],Memories:[`条记忆`,`ذكريات`],Bytes:[`字节`,`بايت`],"Approximate tokens":[`约计令牌`,`رموز تقريبية`],"Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.":[`记忆搜索结果的最大数量。手动搜索可以请求更少;提示词检索使用此上限。`,`الحد الأقصى لنتائج بحث الذاكرة. يمكن للبحث اليدوي طلب عدد أقل؛ ويستخدم استرجاع الطلب هذا السقف.`],"Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.":[`会话开始时在 OpenCode V1 和 Claude Code 中加入的近期记忆。Pi 和 OpenCode V2 改用基于提示词的搜索。`,`الذكريات الحديثة التي تُضاف عند بدء الجلسة في OpenCode V1 و Claude Code. أما Pi و OpenCode V2 فيستخدمان البحث عبر الطلب بدلاً منها.`],"Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.":[`通过共享捕获管道发送给记忆摘要模型的对话输入。数值较小时可能省略部分对话文本。`,`مدخلات المحادثة التي تُرسل إلى نموذج تلخيص الذاكرة عبر مسار الالتقاط المشترك. القيم الأصغر قد تحذف نصاً من المحادثة.`],"OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.":[`OpenCode 画像学习的输入。数值较小时可能从该输入中省略部分提示词。此设置不限制其他主机的画像输入。`,`مدخلات تعلّم الملف الشخصي في OpenCode. القيم الأصغر قد تحذف مطالبات من هذه المدخلات. لا يقيّد هذا الإعداد مدخلات الملف الشخصي في المضيفات الأخرى.`],"Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.":[`自动加入各主机代理请求的记忆上下文,包括画像文本和格式化内容。数值较小时会显示更少或更短的记忆。`,`سياق الذاكرة المُضاف تلقائياً إلى طلبات الوكيل في كل المضيفات، بما في ذلك نص الملف الشخصي والتنسيق. القيم الأصغر قد تعرض ذكريات أقل أو أقصر.`],"Enter a positive whole number.":[`请输入正整数。`,`أدخل رقماً صحيحاً موجباً.`],"Enter a whole number from 16,384 to 16,777,216.":[`请输入 16,384 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 16,384 إلى 16,777,216.`],"Enter a whole number from 1,024 to 16,777,216.":[`请输入 1,024 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 1,024 إلى 16,777,216.`],"Enter a whole number from 256 to 65,536.":[`请输入 256 到 65,536 之间的整数。`,`أدخل رقماً صحيحاً من 256 إلى 65,536.`],"Byte limits count UTF-8 bytes.":[`字节限制按 UTF-8 字节计数。`,`تُحتسب حدود البايت بوحدات بايت UTF-8.`],"Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.":[`约计令牌按 ceil(UTF-8 字节数 / 4) 估算。同一文本,提供商统计的令牌数可能更多或更少。`,`تُقدَّر الرموز التقريبية بالصيغة ceil(بايتات UTF-8 / 4). قد يحسب المزوّد للنص نفسه رموزاً أكثر أو أقل.`],"These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.":[`这些设置不会删除已存储的数据、设定消费限额、限制模型回复,也不会控制 Graphify 输出。`,`لا تحذف هذه الإعدادات البيانات المخزنة، ولا تضع حد إنفاق، ولا تحدّ من ردود النموذج، ولا تتحكم في خرج Graphify.`],"Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.":[`也可以直接编辑 ~/.config/omms/omms.jsonc 来设置这些限制,无需网页界面。`,`عدّل الملف ~/.config/omms/omms.jsonc مباشرة لضبط هذه الحدود دون واجهة الويب.`],"Save memory limits":[`保存记忆限制`,`حفظ حدود الذاكرة`],"Saved. New memory operations use these limits.":[`已保存。新的记忆操作将使用这些限制。`,`تم الحفظ. ستستخدم عمليات الذاكرة الجديدة هذه الحدود.`],"Invalid setting":[`无效的设置`,`إعداد غير صالح`],"Config changed. Reload settings and save again.":[`设置文件已更改。请重新加载设置后再次保存。`,`تغيّر ملف الإعدادات. أعد تحميل الإعدادات ثم احفظ مجدداً.`],"The memory settings could not be loaded. Reload the page to try again.":[`无法加载记忆设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات الذاكرة. أعد تحميل الصفحة للمحاولة مجدداً.`],"The memory settings could not be saved.":[`无法保存记忆设置。`,`تعذّر حفظ إعدادات الذاكرة.`],"Effective value":[`生效值`,`القيمة السارية`],project:[`项目`,`المشروع`],"The project value stays in force. Saving edits the global file only.":[`项目值仍然生效。保存只修改全局文件。`,`تبقى قيمة المشروع سارية، والحفظ يعدّل الملف العام فقط.`],"Similarity score":[`相似度分数`,`درجة التشابه`],"Enter a number from 0 to 1.":[`请输入 0 到 1 之间的数字。`,`أدخل رقماً من 0 إلى 1.`],"Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.":[`记忆被搜索返回所需的最低分数。较低的值会返回更多记忆,包括相关性较低的;较高的值可能一条也不返回。默认值取决于嵌入模型。`,`أدنى درجة تحتاجها الذاكرة لتُعاد في نتائج البحث. القيم الأدنى تعيد ذكريات أكثر بمن فيها الأقل صلة، والقيم الأعلى قد لا تعيد شيئاً. تعتمد القيمة الافتراضية على نموذج التضمين.`],"Reset to default":[`恢复默认`,`إعادة إلى الافتراضي`],"Differs from default":[`与默认值不同`,`يختلف عن الافتراضي`],"Keyword matching":[`关键词匹配`,`مطابقة الكلمات`],"Search finds memories by meaning and by exact words from your prompt.":[`搜索按含义和提示中的确切词语查找记忆。`,`يجد البحث الذكريات بالمعنى وبالكلمات الدقيقة من مطالبتك.`],"Word matching mode":[`词语匹配模式`,`وضع مطابقة الكلمات`],"Boost (default)":[`加分(默认)`,`تعزيز (افتراضي)`],"Rank fusion (experimental)":[`排名融合(实验性)`,`دمج الترتيب (تجريبي)`],"Boost adds a small score bonus to memories that contain a word of your prompt.":[`加分会给包含提示中某个词的记忆增加少量分数。`,`يضيف التعزيز مكافأة صغيرة في الدرجة للذكريات التي تحتوي على كلمة من مطالبتك.`],"Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.":[`排名融合会合并按含义排序的列表和按词语排序的列表。即使含义得分低于相似度阈值,包含提示中某个词的记忆也可能被返回。实验性:尚未证明能找到更多相关记忆。`,`يدمج دمج الترتيب قائمة بالمعنى وقائمة بالكلمات. قد تُعاد ذاكرة تحتوي على كلمة من مطالبتك حتى لو كانت درجة المعنى أقل من حد التشابه. تجريبي: لم يثبت أنه يجد ذكريات أكثر صلة.`],"Rank fusion is not used while the reranker is on. Search uses the boost.":[`重排序器开启时不使用排名融合,搜索使用加分模式。`,`لا يُستخدم دمج الترتيب أثناء تشغيل معيد الترتيب. يستخدم البحث التعزيز.`],"A project file can override this setting. This page edits the global value.":[`项目文件可以覆盖此设置。此页面编辑全局值。`,`يمكن لملف المشروع تجاوز هذا الإعداد. تعدّل هذه الصفحة القيمة العامة.`],"Saved. New searches use this mode.":[`已保存。新的搜索将使用此模式。`,`تم الحفظ. تستخدم عمليات البحث الجديدة هذا الوضع.`],"The keyword matching setting could not be saved. Reload the page to try again.":[`无法保存关键词匹配设置。请重新加载页面后重试。`,`تعذّر حفظ إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],"The keyword matching setting could not be loaded. Reload the page to try again.":[`无法加载关键词匹配设置。请重新加载页面后重试。`,`تعذّر تحميل إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],Reranker:[`重排序器`,`إعادة الترتيب`],"Use a reranker":[`使用重排序器`,`استخدم معيد الترتيب`],Key:[`密钥`,`المفتاح`],Timeout:[`超时`,`مهلة الانتهاء`],"Search is unchanged while the switch is off.":[`开关关闭时,搜索行为保持不变。`,`يظل البحث دون تغيير أثناء إيقاف المفتاح.`],"The reranker reorders the best memory search results with your reranker server and keeps the top results.":[`重排序器使用您的重排序服务器对最佳记忆搜索结果重新排序,并保留最靠前的结果。`,`يعيد معيد الترتيب ترتيب أفضل نتائج بحث الذاكرة عبر خادم إعادة الترتيب لديك ويحتفظ بالنتائج العليا.`],"The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.":[`重排序器会将提示和候选记忆的文本发送到该服务器 URL。建议使用同一台机器上的服务器。`,`يرسل معيد الترتيب المطالبة ونص الذكريات المرشحة إلى عنوان URL للخادم. يُنصح بخادم على الجهاز نفسه.`],"This URL is not on this machine: memory text leaves this machine.":[`此 URL 不在本机上:记忆文本将离开本机。`,`هذا العنوان ليس على هذا الجهاز: نص الذاكرة يغادر جهازك.`],"A project file cannot change these settings. The reranker settings are global only.":[`项目文件无法更改这些设置。重排序器设置仅限全局。`,`لا يمكن لملف المشروع تغيير هذه الإعدادات. إعدادات معيد الترتيب عامة فقط.`],"The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.":[`默认值 4000 使搜索保持在 OpenCode V2 的 5 秒等待之内。超过 5000 的值可能导致 OpenCode V2 在不注入记忆的情况下发送请求。`,`تحافظ القيمة الافتراضية 4000 على بقاء البحث داخل مهلة انتظار OpenCode V2 البالغة 5 ثوانٍ. القيمة الأعلى من 5000 قد تجعل OpenCode V2 يرسل الطلب دون ذاكرة.`],"Enter the server URL and model before turning the reranker on.":[`打开重排序器前,请先填写服务器 URL 和模型。`,`أدخل عنوان URL للخادم والنموذج قبل تشغيل معيد الترتيب.`],"The key must be an env:// or file:// reference, or left empty.":[`密钥必须是 env:// 或 file:// 引用,或留空。`,`يجب أن يكون المفتاح مرجع env:// أو file://، أو يُترك فارغاً.`],"Enter a whole number from 500 to 30,000.":[`请输入 500 到 30,000 之间的整数。`,`أدخل رقماً صحيحاً من 500 إلى 30,000.`],"Optional env:// or file:// key reference.":[`可选的 env:// 或 file:// 密钥引用。`,`مرجع مفتاح env:// أو file:// اختياري.`],milliseconds:[`毫秒`,`ميلي ثانية`],Save:[`保存`,`حفظ`],"Saved. New searches use these settings.":[`已保存。新的搜索将使用这些设置。`,`تم الحفظ. ستستخدم عمليات البحث الجديدة هذه الإعدادات.`],"The reranker settings could not be saved. Reload the page to try again.":[`无法保存重排序器设置。请重新加载页面重试。`,`تعذّر حفظ إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"The reranker settings could not be loaded. Reload the page to try again.":[`无法加载重排序器设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"Test passed.":[`测试通过。`,`نجح الاختبار.`],"Test failed:":[`测试失败:`,`فشل الاختبار:`],"Change icon":[`更换图标`,`تغيير الأيقونة`],"Check again":[`再次检查`,`تحقق مرة أخرى`],"Choose a host to see its history import, sessions and settings.":[`选择一个宿主,查看其历史导入、会话和设置。`,`اختر مضيفاً لعرض استيراد سجله وجلساته وإعداداته.`],"Choose icon":[`选择图标`,`اختر أيقونة`],"Every avatar is shown at the same size. Images are cropped to a square.":[`所有头像大小一致。图片会被裁剪为正方形。`,`تظهر كل الصور الرمزية بالحجم نفسه. تُقصّ الصور إلى مربع.`],"Every host":[`所有宿主`,`كل المضيفين`],"Fix the service named here, then press Check again.":[`请修复此处所列的服务,然后点击“再次检查”。`,`أصلح الخدمة المذكورة هنا، ثم اضغط «تحقق مرة أخرى».`],"How many memories a search returns":[`一次搜索返回多少条记忆`,`عدد الذكريات التي يعيدها البحث`],"How to set up":[`如何设置`,`كيفية الإعداد`],"Ignore all":[`全部忽略`,`تجاهل الكل`],"Import all hosts":[`导入所有宿主`,`استيراد كل المضيفين`],"Import progress":[`导入进度`,`تقدم الاستيراد`],"Running · history imported {date}":[`运行中 · 历史已导入 {date}`,`قيد التشغيل · استُورد السجل {date}`],"Running · history imported {date} · last saved {when}":[`运行中 · 历史已导入 {date} · 上次保存 {when}`,`قيد التشغيل · استُورد السجل {date} · آخر حفظ {when}`],"Running · last saved {when}":[`运行中 · 上次保存 {when}`,`قيد التشغيل · آخر حفظ {when}`],"today {time}":[`今天 {time}`,`اليوم {time}`],"yesterday {time}":[`昨天 {time}`,`أمس {time}`],"Importing makes model calls and can cost money.":[`导入会调用模型,可能产生费用。`,`يجري الاستيراد اتصالات بالنموذج وقد يكلّف مالاً.`],"Importing · {percent}%":[`正在导入 · {percent}%`,`جارٍ الاستيراد · {percent}%`],"Memories are not being saved.":[`记忆当前无法保存。`,`لا يتم حفظ الذكريات حالياً.`],"Memories not saved":[`记忆未保存`,`الذكريات غير محفوظة`],"Memory views":[`记忆视图`,`عروض الذاكرة`],"Mode: {mode}":[`模式:{mode}`,`الوضع: {mode}`],"No icon matches.":[`没有匹配的图标。`,`لا توجد أيقونة مطابقة.`],"Not set up":[`未设置`,`غير مُعد`],"Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.":[`自动导入已开启。在 {date} 之前没有待导入的内容。更新的聊天请使用下方的“会话”。`,`الاستيراد التلقائي قيد التشغيل. لم يكن هناك ما ينتظر قبل {date}. استخدم «الجلسات» أدناه للمحادثات الأحدث.`],"Automatic import is on. Nothing is waiting.":[`自动导入已开启。没有待导入的内容。`,`الاستيراد التلقائي قيد التشغيل. لا يوجد ما ينتظر.`],"OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.":[`OMMS 在这台电脑上没有找到该宿主的聊天记录。请安装该宿主并使用一次,然后重新加载此页面。`,`لم يعثر OMMS على سجل محادثات هذا المضيف على هذا الحاسوب. ثبّت المضيف واستخدمه مرة واحدة، ثم أعد تحميل هذه الصفحة.`],Off:[`关`,`متوقف`],On:[`开`,`قيد التشغيل`],"On · {model}":[`开 · {model}`,`قيد التشغيل · {model}`],"PNG, JPEG, WebP or GIF, up to 20 MB.":[`PNG、JPEG、WebP 或 GIF,最大 20 MB。`,`PNG أو JPEG أو WebP أو GIF، حتى 20 ميغابايت.`],"Paused · {pending} pending":[`已暂停 · 待处理 {pending}`,`متوقف مؤقتاً · {pending} قيد الانتظار`],"Paused. Resume to continue.":[`已暂停。点击“恢复”继续。`,`متوقف مؤقتاً. اضغط «استئناف» للمتابعة.`],"Prompts waiting for profile learning, and re-analysis of old chats":[`等待画像学习的提示,以及旧聊天的重新分析`,`مطالبات تنتظر تعلم الملف الشخصي، وإعادة تحليل المحادثات القديمة`],"Results {results} · Similarity {similarity}":[`结果数 {results} · 相似度 {similarity}`,`النتائج {results} · التشابه {similarity}`],"Runs one import for every host you tick. It makes model calls and can cost money.":[`对勾选的每个宿主运行一次导入。它会调用模型,可能产生费用。`,`يشغّل استيراداً واحداً لكل مضيف تحدده. يجري اتصالات بالنموذج وقد يكلّف مالاً.`],"Saved maps and ignored directories":[`已保存的映射和已忽略的目录`,`الخرائط المحفوظة والمجلدات المتجاهلة`],"Search icons":[`搜索图标`,`ابحث عن أيقونة`],"Settings for every host":[`适用于所有宿主的设置`,`إعدادات لكل المضيفين`],Shared:[`共享`,`مشترك`],"Stopped · {pending} pending":[`已停止 · 待处理 {pending}`,`متوقف · {pending} قيد الانتظار`],"Stopped: {error}":[`已停止:{error}`,`توقف: {error}`],"These directories stay unimported and leave the unresolved counts.":[`这些目录保持未导入状态,并从未解析计数中移除。`,`تبقى هذه المجلدات غير مستوردة وتخرج من أعداد غير المحلولة.`],"These settings apply to every host. Open a row to change it.":[`这些设置适用于所有宿主。展开一行即可修改。`,`تنطبق هذه الإعدادات على كل المضيفين. افتح صفاً لتغييره.`],"This browser could not read the image.":[`此浏览器无法读取该图片。`,`تعذّر على هذا المتصفح قراءة الصورة.`],"This host is not set up on this machine.":[`此宿主尚未在这台机器上设置。`,`لم يتم إعداد هذا المضيف على هذا الجهاز.`],"This switch applies to every host. Automatic import makes model calls.":[`此开关适用于所有宿主。自动导入会调用模型。`,`ينطبق هذا المفتاح على كل المضيفين. يجري الاستيراد التلقائي اتصالات بالنموذج.`],"Upload image":[`上传图片`,`رفع صورة`],"Use external API":[`使用外部 API`,`استخدام واجهة API الخارجية`],settings:[`设置`,`الإعدادات`],"{saved} saved · {ignored} ignored":[`已保存 {saved} · 已忽略 {ignored}`,`{saved} محفوظة · {ignored} متجاهلة`],"The image is larger than 20 MB.":[`图片超过 20 MB。`,`الصورة أكبر من 20 ميغابايت.`],"Only PNG, JPEG, WebP and GIF images are accepted.":[`仅接受 PNG、JPEG、WebP 和 GIF 图片。`,`تُقبل صور PNG وJPEG وWebP وGIF فقط.`],"Importing {done} / {total}.":[`正在导入 {done} / {total}。`,`جارٍ الاستيراد {done} / {total}.`],"Importing {done} / {total}. About {minutes} min left.":[`正在导入 {done} / {total}。约剩 {minutes} 分钟。`,`جارٍ الاستيراد {done} / {total}. يتبقى نحو {minutes} دقيقة.`],"Nothing is waiting to import.":[`没有待导入的内容。`,`لا يوجد ما ينتظر الاستيراد.`],"{pending} still waiting to import.":[`仍有 {pending} 条待导入。`,`لا يزال {pending} بانتظار الاستيراد.`]};function ay(e,t){return t===`en`?e:iy[e]?.[t===`zh`?0:1]??e}function X(){let{language:e}=oa();return t=>ay(t,e)}function oy(e,t){if(e===`env`){let n=(t.name??``).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n))throw Error(`Enter a variable name such as ZAI_API_KEY`);return{source:e,name:n}}if(e===`file`){let n=(t.path??``).trim();if(!n)throw Error(`Enter the path of a key file`);return{source:e,path:n}}let n=(t.name??``).trim()||`memory-api`;if(!/^[A-Za-z0-9_-]{1,64}$/.test(n))throw Error(`Name the key file with letters, digits, dashes, or underscores`);if(!(t.value??``).trim())throw Error(`Paste the key`);return{source:e,name:n,value:t.value??``,replace:t.replace===!0}}function sy(e){let t=[],n=e.memoryProvider===`orcarouter`;return!n&&!e.memoryModel&&t.push(`memoryModel`),!n&&!e.memoryApiUrl&&t.push(`memoryApiUrl`),e.keySet||t.push(`memoryApiKey`),t}function cy(e,t){if(t===`inherit`||t===`external`)return{[`${e}Model`]:t};let n=t.indexOf(`/`);if(n<1||n===t.length-1)throw Error(`Enter a model as provider/model.`);return{[`${e}Provider`]:t.slice(0,n),[`${e}Model`]:t.slice(n+1)}}function ly(e){return{kind:e.relation,command:e.relation===`older`?`npm i -g om-memory-system@latest`:null}}function uy(e,t){return e.filter(e=>!t.has(e.from))}function dy({status:e}){let t=X();return(0,H.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Jd(`claude-code`)}),e?.ready===!0&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`Claude Code capture uses the external API.`)}),e?.ready===!1&&(0,H.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-xs`,children:[(0,H.jsx)(`p`,{className:`text-amber-600`,children:t(`Claude Code capture is off. Complete the external API settings.`)}),(e.issues??[]).length>0&&(0,H.jsxs)(`p`,{children:[t(`Missing settings`),`: `,(e.issues??[]).map(e=>t(e)).join(`; `)]})]})]})}function fy(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=Qv();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&o(t.message)});for(let t of[`opencode`,`pi`])Y(`/api/settings/models?host=${t}`).then(n=>{e&&i(e=>({...e,[t]:n}))}).catch(()=>{e&&i(e=>({...e,[t]:{available:!1}}))});let r=ey(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function l(n,r){if(!t)return;let i;try{i=cy(n,r)}catch(t){o(e(t.message));return}c(!0);let a,s;try{a=await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:i,revision:t.revision})})}catch(e){s=e}let l=await $v()!==null;if(c(!1),a){let t=e(a.migratedLegacy?`Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.`:`Saved. New capture and profile work uses these settings.`);o(l?t:`${t} ${e(`Reload the page before saving again.`)}`)}else o(ty(s?.message??``,e(l?`Current settings were reloaded; check the values and save again.`:`The current settings could not be reloaded. Reload the page.`)))}let u=sy({memoryProvider:t?.settings.memoryProvider?.globalValue,memoryModel:t?.settings.memoryModel?.globalValue,memoryApiUrl:t?.settings.memoryApiUrl?.globalValue,keySet:!!t?.secrets.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Models`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Models`)}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e(`External API fallback`),`: `,t?.fallback.model??e(`none`),` (`,e(t?.fallback.configured?`ready`:`not ready`),`).`]}),[`opencode`,`pi`].map(e=>(0,H.jsx)(py,{host:e,model:t?.settings[`${e}Model`],provider:t?.settings[`${e}Provider`],effective:e===`pi`?t?.effective.pi.kind:t?.effective.opencode.mode??`unready`,list:r[e],externalMissing:u,busy:s||!t,onSave:t=>l(e,t)},e)),(0,H.jsx)(dy,{status:t?.effective[`claude-code`]}),a&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:a})]})}function py({host:e,model:t,provider:n,effective:r,list:i,externalMissing:a,busy:o,onSave:s}){let c=X(),l=t?.globalValue===`inherit`||!t?.globalValue?`inherit`:t.globalValue===`external`?`external`:`${n?.globalValue??``}/${t.globalValue}`,[u,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),g=u??(l===`inherit`||l===`external`?l:`manual`),_=i?.models??[],y=l===`inherit`||l===`external`?``:l,b=m||y||(_[0]?`${_[0].provider}/${_[0].model}`:`typed`),x=!_.some(e=>`${e.provider}/${e.model}`===b),S=f??y;return(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Jd(e)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Effective model`),`:`,` `,t?.value===`external`&&r===`manual`?c(`external API`):t?.value===`inherit`||r===`session`?c(`session`):r===`manual`?c(`external API`):r===`unready`?c(`unavailable`):`${n?.value??``}/${t?.value??``}`]}),(t?.source===`project`||n?.source===`project`)&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:c(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`label`,{className:`block text-sm`,htmlFor:`${e}-model`,children:c(`Model choice`)}),(0,H.jsxs)(Er,{id:`${e}-model`,className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,value:g,onChange:e=>d(e.target.value),children:[(0,H.jsx)(`option`,{value:`inherit`,children:c(`Session model`)}),(0,H.jsx)(`option`,{value:`manual`,children:c(`Manual model`)}),(0,H.jsx)(`option`,{value:`external`,disabled:a.length>0,children:c(`External API`)})]}),a.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`External API needs`),`: `,a.join(`, `)]}),g===`manual`&&i?.available&&_.length>0&&(0,H.jsxs)(Er,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${Jd(e)} ${c(`Model`)}`,value:x?`typed`:b,onChange:e=>h(e.target.value),children:[_.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:c(`Manual provider/model`)})]}),g===`manual`&&x&&(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${e} ${c(`Manual provider/model`)}`,placeholder:`provider/model`,value:S,onChange:e=>{p(e.target.value),h(`typed`)}}),g===`manual`&&i&&!i.available&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason?c(i.reason):c(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:o,onClick:()=>s(g===`manual`?x?S.trim():b:g),children:c(`Save model`)})]})}var my=[`openai-chat`,`openai-responses`,`anthropic`,`minimax`,`orcarouter`,`google-gemini`];function hy(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(`file`),[s,c]=(0,v.useState)({name:``,path:``,value:``}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=Qv();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&u(t.message)});let r=ey(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let p=e=>String(t?.settings[e]?.globalValue??``),m=e=>r[e]??p(e);async function h(){if(!t)return;let n={};for(let e of[`memoryProvider`,`memoryApiUrl`,`memoryModel`]){let t=m(e).trim();t&&t!==p(e)&&(n[e]=t)}if(!Object.keys(n).length){u(e(`Nothing to save.`));return}f(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),i({}),u(e(`Saved. New capture and profile work uses these settings.`))}catch(e){u(e.message)}await $v(),f(!1)}async function g(n=!1){if(!t)return;let r;try{r=oy(a,{...s,replace:n})}catch(t){u(e(t.message));return}f(!0);try{await Y(`/api/settings/external-api/key`,{method:`POST`,body:JSON.stringify({...r,revision:t.revision})}),c(e=>({...e,value:``})),u(e(`Key source saved.`))}catch(t){let r=t.message;if(a===`paste`&&!n&&r.includes(`Confirm to replace`)){f(!1),window.confirm(e(`A key file with this name exists. Replace it?`))&&await g(!0);return}u(r)}await $v(),f(!1)}async function _(){f(!0);try{let t=await Y(`/api/settings/external-api/test`,{method:`POST`,body:`{}`});u(t.ok?`${e(`Test call succeeded`)}: ${t.model??``}`:`${e(`Test call failed`)}: ${t.error??``}`)}catch(e){u(e.message)}f(!1)}let y=t?.externalKey;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`External API`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`External API`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.`)}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Provider`),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsx)(Er,{"aria-label":e(`Provider`),className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:m(`memoryProvider`)||`openai-chat`,onChange:e=>i({...r,memoryProvider:e.target.value}),children:my.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`API URL`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`https://api.example.com/v1`,value:m(`memoryApiUrl`),onChange:e=>i({...r,memoryApiUrl:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Model`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`glm-5-turbo`,value:m(`memoryModel`),onChange:e=>i({...r,memoryModel:e.target.value})})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d||!t,onClick:()=>void h(),children:e(`Save endpoint`)}),(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API key`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e(`Key source`),`:`,` `,y?.source===`env`?`${e(`environment variable`)} ${y.reference}`:y?.source===`file`?`${e(`key file`)} ${y.reference}`:y?.source===`literal`?e(`set in the config file`):e(`not set`),y?.source&&` · ${e(y.resolvesInWebApp?`resolves in the web app`:`does not resolve in the web app`)}`]}),y?.source===`env`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`A login web app does not see variables set only in a shell profile; a key file works everywhere.`)}),y?.source&&!y.resolvesInWebApp&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`The key does not resolve in this web app. Save it to a key file instead.`)}),[[`env`,`Environment variable`],[`file`,`Key file`],[`paste`,`Save key to a private file`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-key-source`,checked:a===t,onChange:()=>o(t)}),e(n)]},t)),a===`env`&&(0,H.jsx)(`input`,{"aria-label":e(`Variable name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`ZAI_API_KEY`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),a===`file`&&(0,H.jsx)(`input`,{"aria-label":e(`Key file path`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`~/.config/omms/secrets/zai.key`,value:s.path,onChange:e=>c({...s,path:e.target.value})}),a===`paste`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{"aria-label":e(`Key file name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`memory-api`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),(0,H.jsx)(`input`,{"aria-label":e(`API key`),type:`password`,autoComplete:`off`,className:`w-full rounded border border-border bg-background p-2`,value:s.value,onChange:e=>c({...s,value:e.target.value})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:d||!t,onClick:()=>void g(),children:e(`Save key source`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d,onClick:()=>void _(),children:e(`Test`)}),l&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:l})]})}var gy=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`,`0:0:0:0:0:0:0:1`]);function _y(e){let t=e.trim().toLowerCase();return gy.has(t)||/^127(?:\.\d{1,3}){3}$/.test(t)}function vy(e){try{return _y(new URL(e).hostname)}catch{return!1}}function yy(e,t){return e?`set`:t?`missing`:`not-needed`}function by(e){let{access:t,secrets:n}=e,r=t.embeddingApiUrl;return{memoryApiKey:(e=>e===`not-needed`?`never-used`:e)(yy(!!n.memoryApiKey?.set,e.externalUsed||e.claudeCodeInUse)),embeddingApiKey:yy(!!n.embeddingApiKey?.set,!!r&&!vy(r)),apiTokens:yy(t.tokenAvailable,!_y(t.host)&&!t.authEnabled),webPassword:yy(!!n.webServerAuthPassword?.set,!1)}}function xy(e){return e?`Browser password cleared. Restart the web app to turn it off.`:`Saved. Restart the web app to use the new browser password.`}var Sy=[{id:`ollama`,label:`Ollama`,url:`http://localhost:11434/v1`},{id:`llamacpp`,label:`llama.cpp`,url:`http://localhost:8080/v1`},{id:`openrouter`,label:`OpenRouter`,url:`https://openrouter.ai/api/v1`},{id:`openai`,label:`OpenAI`,url:`https://api.openai.com/v1`},{id:`custom`,label:`Custom`,url:``}];function Cy(e,t){let n=Sy.find(t=>t.id===e);return n&&n.url?n.url:t}function wy(e){if(e.kind===`builtin`)return{kind:`builtin`,model:e.model.trim()};let t=e.key===`none`||e.key===`saved`?{source:e.key}:oy(e.key,{...e.keyInput,name:e.keyInput.name||`embedding-api`});return{kind:`server`,url:e.url.trim(),model:e.model.trim(),key:t}}function Ty(e){return JSON.stringify([e.kind,e.kind===`server`?e.url.trim():``,e.model.trim(),e.kind===`server`?e.key:`none`,e.kind===`server`?e.keyInput:null])}function Ey(e,t){return e!==void 0&&e===Ty(t)}function Dy(e,t){let n=t.kind===`server`&&!vy(t.url);return{count:e.toLocaleString(`en-US`),risks:[...n?[`The hosted server is called once for each memory, which may cost money.`]:[],`Search results are poor until the re-embed ends.`,`Restart open OpenCode and Pi sessions after the change.`]}}var Oy=`Xenova/nomic-embed-text-v1`;function ky(e,t=Oy){return e===`builtin`?{kind:e,model:t}:{kind:e}}function Ay(e,t){return e===`server`&&t?`saved`:`none`}function jy({current:e,keySet:t}){let n=X();return(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-sm`,children:[(0,H.jsx)(`dt`,{children:n(`Kind`)}),(0,H.jsx)(`dd`,{children:n(e.kind===`server`?`OpenAI-compatible server`:`Built-in model`)}),e.url&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`Server URL`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.url})]}),(0,H.jsx)(`dt`,{children:n(`Model`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.model}),(0,H.jsx)(`dt`,{children:n(`Vector size`)}),(0,H.jsx)(`dd`,{children:e.dimensions}),(0,H.jsx)(`dt`,{children:n(`API key`)}),(0,H.jsx)(`dd`,{children:n(t?`set`:`not set`)}),(0,H.jsx)(`dt`,{children:n(`Stored memories`)}),(0,H.jsx)(`dd`,{children:e.memoryCount.toLocaleString(`en-US`)})]})}function My({run:e,onRetry:t}){let n=X();return e.state===`idle`?null:(0,H.jsxs)(`div`,{role:`status`,className:`space-y-1 text-sm`,children:[e.state===`running`&&(0,H.jsxs)(`p`,{children:[n(`Re-embedding`),`: `,e.progress.processed,`/`,e.progress.total]}),e.state===`done`&&(0,H.jsx)(`p`,{children:n(`Re-embed finished.`)}),e.state===`failed`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`text-red-600`,children:[n(`Re-embed failed`),`: `,e.error??``]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:t,children:n(`Retry`)})]})]})}function Ny(e,t){return{kind:e.kind,url:e.url??``,model:e.model,key:Ay(e.kind,t),keyInput:{name:``,path:``,value:``}}}function Py(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)({state:`idle`,progress:{processed:0,total:0}}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1);async function b(){let e=await Y(`/api/settings/embedding`);return n(e),m(e.run),e}(0,v.useEffect)(()=>{let e=!0,t=Qv();b().catch(t=>e&&g(t.message)),Y(`/api/settings`).then(n=>e&&t.isCurrent()&&i(n)).catch(()=>{}),Y(`/api/web/status`).then(t=>e&&o(!!t.isLocal)).catch(()=>{});let n=ey(t=>e&&i(t));return()=>{e=!1,n()}},[]),(0,v.useEffect)(()=>{if(p.state!==`running`)return;let e=setInterval(()=>{Y(`/api/settings/embedding/run`).then(e=>{m(e),e.state!==`running`&&b()}).catch(()=>{})},1e3);return()=>clearInterval(e)},[p.state]);function x(){if(s||!t){c(!1),u(void 0),f(void 0);return}u(Ny(t,!!r?.secrets.embeddingApiKey?.set)),c(!0)}let S=e=>u(t=>t&&{...t,...e});async function C(){l&&await ry(y,async()=>{try{let t=await Y(`/api/settings/embedding/test`,{method:`POST`,body:JSON.stringify(wy(l))});t.ok&&t.dimensions?(f({key:Ty(l),dimensions:t.dimensions}),g(`${e(`Test passed. Vector size`)}: ${t.dimensions}`)):(f(void 0),g(`${e(`Test failed`)}: ${t.reason??``}`))}catch(t){g(e(t.message))}})}async function w(){if(!l||!t||!r)return;let{count:n,risks:i}=Dy(t.memoryCount,l),a=[`${e(`Every stored memory will be re-embedded`)}: ${n}`,...i.map(t=>e(t))].join(`
124
- `);window.confirm(a)&&await ry(y,async()=>{try{let e=await Y(`/api/settings/embedding/apply`,{method:`POST`,body:JSON.stringify({candidate:wy(l),revision:r.revision})});m(e),c(!1),u(void 0),f(void 0),g(``)}catch(e){g(e.message)}await $v()})}async function T(){try{m(await Y(`/api/settings/embedding/run`,{method:`POST`,body:`{}`}))}catch(e){g(e.message)}}let E=!!r?.secrets.embeddingApiKey?.set;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Embedding`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Embedding`)}),a&&(0,H.jsx)(`button`,{type:`button`,"aria-label":e(s?`Lock`:`Unlock to change`),title:e(s?`Lock`:`Unlock to change`),className:`rounded border border-border px-2 py-1`,disabled:!t||p.state===`running`,onClick:x,children:s?`🔓`:`🔒`})]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`The model that turns memory text into search vectors. A change re-embeds every memory.`)}),t&&!s&&(0,H.jsx)(jy,{current:t,keySet:E}),s&&l&&(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[[`builtin`,`server`].map(n=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-embedding-kind`,checked:l.kind===n,onChange:()=>S(ky(n,t?.kind===`builtin`?t.model:`Xenova/nomic-embed-text-v1`))}),e(n===`server`?`OpenAI-compatible server`:`Built-in model`)]},n)),l.kind===`server`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`block`,children:[e(`Preset`),(0,H.jsx)(`div`,{className:`w-72 max-w-full`,children:(0,H.jsx)(Er,{"aria-label":e(`Preset`),className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:Sy.find(e=>e.url===l.url)?.id??`custom`,onChange:e=>S({url:Cy(e.target.value,l.url)}),children:Sy.map(t=>(0,H.jsx)(`option`,{value:t.id,children:t.id===`custom`?e(`Custom`):t.label},t.id))})})]}),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Server URL`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:l.url,onChange:e=>S({url:e.target.value})})]})]}),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Model`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,placeholder:l.kind===`server`?`nomic-embed-text`:`Xenova/nomic-embed-text-v1`,value:l.model,onChange:e=>S({model:e.target.value})})]}),l.kind===`server`&&(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API key`)}),[[`none`,`No key`],...E?[[`saved`,`Keep the saved key`]]:[],[`env`,`Environment variable`],[`file`,`Key file`],[`paste`,`Save key to a private file`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-embedding-key`,checked:l.key===t,onChange:()=>S({key:t})}),e(n)]},t)),l.key===`env`&&(0,H.jsx)(`input`,{"aria-label":e(`Variable name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`OPENROUTER_API_KEY`,value:l.keyInput.name,onChange:e=>S({keyInput:{...l.keyInput,name:e.target.value}})}),l.key===`file`&&(0,H.jsx)(`input`,{"aria-label":e(`Key file path`),className:`w-full rounded border border-border bg-background p-2`,value:l.keyInput.path,onChange:e=>S({keyInput:{...l.keyInput,path:e.target.value}})}),l.key===`paste`&&(0,H.jsx)(`input`,{"aria-label":e(`API key`),type:`password`,autoComplete:`off`,className:`w-full rounded border border-border bg-background p-2`,value:l.keyInput.value,onChange:e=>S({keyInput:{...l.keyInput,value:e.target.value}})})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:_||!l.model.trim(),onClick:()=>void C(),children:e(`Test`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:_||!Ey(d?.key,l),onClick:()=>void w(),children:e(`Apply`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:x,children:e(`Cancel`)})]})]}),(0,H.jsx)(My,{run:p,onRetry:()=>void T()}),h&&(0,H.jsx)(`p`,{className:`text-sm`,children:h})]})}async function Fy(e,t){return e()?(await t(),!0):!1}var Iy=[[`7`,`7 days`],[`30`,`30 days`],[`90`,`90 days`],[`never`,`Never`]];function Ly({tokens:e,newValue:t,busy:n,onGenerate:r,onRevoke:i}){let a=X(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(`30`),u=e=>e===null?a(`Never`):Xp(e);return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:a(`Name`)}),(0,H.jsx)(`th`,{children:a(`Created`)}),(0,H.jsx)(`th`,{children:a(`Expires`)}),(0,H.jsx)(`th`,{children:a(`Last used`)}),(0,H.jsx)(`th`,{})]})}),(0,H.jsx)(`tbody`,{children:e.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:e.name}),(0,H.jsx)(`td`,{children:u(e.createdAt)}),(0,H.jsx)(`td`,{children:u(e.expiresAt)}),(0,H.jsx)(`td`,{children:e.lastUsedAt===null?`-`:u(e.lastUsedAt)}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-0.5`,disabled:n,onClick:()=>i(e),children:a(`Revoke`)})})]},e.id))})]}),t&&(0,H.jsxs)(`div`,{role:`status`,className:`space-y-1 rounded border border-border p-2 text-xs`,children:[(0,H.jsx)(`code`,{className:`block break-all`,children:t}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-0.5`,onClick:()=>void navigator.clipboard?.writeText(t),children:a(`Copy`)}),(0,H.jsx)(`p`,{className:`text-amber-600`,children:a(`Copy this token now. It will not be shown again.`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[a(`Token name`),(0,H.jsx)(`input`,{className:`mt-1 block rounded border border-border bg-background p-1.5`,placeholder:`ci`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`block`,children:[a(`Expires after`),(0,H.jsx)(Er,{"aria-label":a(`Expires after`),className:`mt-1 block rounded border border-border bg-background p-1.5`,value:c,onChange:e=>l(e.target.value),children:Iy.map(([e,t])=>(0,H.jsx)(`option`,{value:e,children:a(t)},e))})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:n||!o.trim(),onClick:()=>r(o.trim(),c===`never`?null:Number(c)),children:a(`Generate token`)})]})]})}var Ry=`relative overflow-x-auto rounded-lg border border-border`,zy=`px-3 py-2 text-start font-medium`,By=`bg-muted/50 text-xs text-muted-foreground`,Vy=`px-3 py-2 text-start font-medium`,Hy=`border-t border-border transition-colors hover:bg-muted/30`,Uy=`px-3 py-1.5`;function Wy(e){return{secrets:e.secrets??{},externalUsed:e.effective?.opencode?.mode===`manual`||e.effective?.pi?.kind===`manual`,claudeCodeInUse:!!(e.claudeCodeEvidence?.attempts||e.claudeCodeEvidence?.folderSet),access:e.access??{host:`127.0.0.1`,authEnabled:!1,tokenAvailable:!1,embeddingApiUrl:null}}}var Gy=[{id:`memoryApiKey`,label:`External API key`,purpose:`Capture and profile learning through the external API. Claude Code always uses it.`,hosts:`OpenCode, Pi, Claude Code`,where:`External API card`},{id:`embeddingApiKey`,label:`Embedding server key`,purpose:`Sent to an embedding server on another machine.`,hosts:`OpenCode, Pi, Claude Code`,where:`Embedding card`},{id:`apiTokens`,label:`API tokens`,purpose:`Let scripts and other computers call the web app's API.`,hosts:`Web app`,where:`Table below`},{id:`webPassword`,label:`Browser password`,purpose:`Asks for a user name and password before the page opens.`,hosts:`Web app`,where:`Form below`}];function Ky({state:e}){let t=X();return e===`set`?(0,H.jsxs)(`span`,{children:[`✅ `,t(`set`)]}):e===`missing`?(0,H.jsxs)(`span`,{className:`text-red-600`,children:[`⛔️ `,t(`missing`)]}):e===`never-used`?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t(`never used before`)}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t(`not needed`)})}function qy({states:e}){let t=X();return(0,H.jsx)(`div`,{className:Ry,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:V(zy,`sr-only`),children:t(`Keys and access`)}),(0,H.jsx)(`thead`,{className:By,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:Vy,children:t(`Credential`)}),(0,H.jsx)(`th`,{className:Vy,children:t(`State`)}),(0,H.jsx)(`th`,{className:Vy,children:t(`Used for`)}),(0,H.jsx)(`th`,{className:Vy,children:t(`Hosts`)}),(0,H.jsx)(`th`,{className:Vy,children:t(`Change it in`)})]})}),(0,H.jsx)(`tbody`,{children:Gy.map(n=>(0,H.jsxs)(`tr`,{className:V(Hy,`align-top`),children:[(0,H.jsx)(`td`,{className:V(Uy,`font-medium`),children:t(n.label)}),(0,H.jsx)(`td`,{className:V(Uy,`whitespace-nowrap`),children:(0,H.jsx)(Ky,{state:e[n.id]})}),(0,H.jsx)(`td`,{className:Uy,children:t(n.purpose)}),(0,H.jsx)(`td`,{className:Uy,children:n.hosts===`Web app`?t(`Web app`):n.hosts}),(0,H.jsx)(`td`,{className:Uy,children:t(n.where)})]},n.id))})]})})}function Jy({value:e,onChange:t}){let n=X();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`block w-full max-w-72`,children:[(0,H.jsx)(`span`,{children:n(`User name`)}),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,autoComplete:`username`,value:e.username,onChange:n=>t({...e,username:n.target.value})})]}),(0,H.jsxs)(`label`,{className:`block w-full max-w-72`,children:[(0,H.jsx)(`span`,{children:n(`Password`)}),(0,H.jsx)(`input`,{type:`password`,autoComplete:`new-password`,className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:e.value,onChange:n=>t({...e,value:n.target.value})})]})]})}function Yy(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)({username:``,value:``}),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1);async function h(){let e=await Y(`/api/settings/tokens`);o(e.tokens)}(0,v.useEffect)(()=>{let e=!0,t=Qv();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&f(t.message)}),Y(`/api/web/status`).then(async t=>{!e||!t.isLocal||(i(!0),await h())}).catch(()=>{});let r=ey(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function g(e){await ry(m,async()=>{try{await e()}catch(e){f(e.message)}await $v()}).catch(()=>{})}let _=(e,t)=>g(async()=>{let n=await Y(`/api/settings/tokens`,{method:`POST`,body:JSON.stringify({name:e,expiresInDays:t})});c(n.value),f(``),await h()}),y=t=>g(async()=>{c(void 0),await Fy(()=>window.confirm(e(`Revoke this token? Scripts that use it stop working.`)),async()=>{await Y(`/api/settings/tokens/${t.id}`,{method:`DELETE`}),await h()})}),b=n=>g(async()=>{t&&(await Y(`/api/settings/web-password`,{method:`POST`,body:JSON.stringify(n?{clear:!0,revision:t.revision}:{password:l.value,username:l.username,revision:t.revision})}),u({username:``,value:``}),f(e(xy(n))))}),x=t?.access;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Keys and access`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Keys and access`)}),t&&(0,H.jsx)(qy,{states:by(Wy(t))}),x?.configTokenIgnored&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`The config file still sets webServerApiToken. OMMS imported it once as the token “from config file” and no longer reads the key. Use the token table instead.`)}),r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API tokens`)}),(0,H.jsx)(Ly,{tokens:a,newValue:s,busy:p,onGenerate:(e,t)=>void _(e,t),onRevoke:e=>void y(e)})]}),(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`Browser password`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:x?.authEnabled?x.authUsername?`${e(`A browser password is set for user`)} ${x.authUsername}.`:e(`A browser password is set for your computer user name.`):e(`No browser password is set.`)}),(0,H.jsx)(Jy,{value:l,onChange:u}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:p||!t||!l.value,onClick:()=>void b(!1),children:e(`Save password`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:p||!t||!x?.authEnabled,onClick:()=>void b(!0),children:e(`Clear password`)})]})]})]}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`Open this page on the computer that runs OMMS to manage tokens and the password.`)}),d&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:d})]})}function Xy(){let e=X(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``);async function l(){let e=await Y(`/api/settings/profiles`);n(e.profiles)}if((0,v.useEffect)(()=>{l().catch(e=>c(e.message))},[]),t.length<2)return null;let u=t=>ry(o,async()=>{if(window.confirm(`${e(`Use this profile for every folder?`)} ${t.userId}`))try{let n=await $v();await Y(`/api/settings/profiles/use`,{method:`POST`,body:JSON.stringify({userId:t.userId,revision:n?.revision})}),await $v(),await l(),c(e(`Saved. OMMS now uses this profile in every folder.`))}catch(e){c(e.message)}}),d=n=>ry(o,async()=>{let i=t.find(e=>e.id===(r[n.id]??t.find(e=>e.id!==n.id)?.id));if(i&&window.confirm(`${e(`Merge this profile into the other one? The source profile is turned off, not deleted.`)}\n${n.userId} → ${i.userId}`))try{await Y(`/api/settings/profiles/merge`,{method:`POST`,body:JSON.stringify({sourceId:n.id,targetId:i.id})}),await l(),c(e(`Merged.`))}catch(e){c(e.message)}});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Profiles`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Profiles`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`OMMS keeps one profile for each git email. A folder whose repository has its own email starts a second profile. Choose the profile that is yours, or merge the extra one into it.`)}),(0,H.jsx)(`div`,{className:Ry,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:V(zy,`sr-only`),children:e(`Profiles`)}),(0,H.jsx)(`thead`,{className:By,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:Vy,children:e(`Email`)}),(0,H.jsx)(`th`,{className:Vy,children:e(`Preferences`)}),(0,H.jsx)(`th`,{className:Vy,children:e(`Patterns`)}),(0,H.jsx)(`th`,{className:Vy,children:e(`Workflows`)}),(0,H.jsx)(`th`,{className:Vy,children:e(`Prompts analysed`)}),(0,H.jsx)(`th`,{className:Vy,children:e(`Last update`)}),(0,H.jsx)(`th`,{className:Vy,children:e(`Actions`)})]})}),(0,H.jsx)(`tbody`,{children:t.map(n=>(0,H.jsxs)(`tr`,{className:Hy,children:[(0,H.jsxs)(`td`,{className:V(Uy,`font-medium`),children:[n.userId,n.inUse&&(0,H.jsxs)(`span`,{className:`ms-2 text-xs text-green-700`,children:[`✅ `,e(`in use`)]})]}),(0,H.jsx)(`td`,{className:Uy,children:n.preferences}),(0,H.jsx)(`td`,{className:Uy,children:n.patterns}),(0,H.jsx)(`td`,{className:Uy,children:n.workflows}),(0,H.jsx)(`td`,{className:Uy,children:n.totalPromptsAnalyzed}),(0,H.jsx)(`td`,{className:Uy,children:Yp(n.lastAnalyzedAt)}),(0,H.jsxs)(`td`,{className:V(Uy,`space-y-1`),children:[!n.inUse&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-1`,disabled:a,onClick:()=>void u(n),children:e(`Use this profile`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`label`,{className:`sr-only`,htmlFor:`merge-${n.id}`,children:e(`Merge into`)}),(0,H.jsx)(`select`,{id:`merge-${n.id}`,className:`rounded border border-border bg-background px-1 py-1 text-xs`,value:r[n.id]??``,onChange:e=>i(t=>({...t,[n.id]:e.target.value})),children:t.filter(e=>e.id!==n.id).map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.userId},e.id))}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-1`,disabled:a,onClick:()=>void d(n),children:e(`Merge into`)})]})]})]},n.id))})]})}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:s})]})}var Zy=[`opencode`,`pi`,`claude-code`];function Qy(e){return!e.provider&&!e.model?null:`${e.provider??``}/${e.model??``}`}function $y(e){let t=new Map;for(let n of e){let e=t.get(n.host)??{host:n.host,total:0,saved:0,skipped:0,failed:0,models:[]};e.total+=n.total,e.saved+=n.saved,e.skipped+=n.skipped,e.failed+=n.failed;let r=Qy(n),i=e.models.find(e=>e.label===r);i?(i.total+=n.total,i.saved+=n.saved,i.skipped+=n.skipped,i.failed+=n.failed):e.models.push({label:r,provider:n.provider,model:n.model,total:n.total,saved:n.saved,skipped:n.skipped,failed:n.failed}),t.set(n.host,e)}let n=e=>{let t=Zy.indexOf(e);return t<0?Zy.length:t};return[...t.values()].map(e=>({...e,models:e.models.sort((e,t)=>t.total-e.total)})).sort((e,t)=>n(e.host)-n(t.host))}function eb(e,t){return t>0?Math.round(100*e/t):0}function tb(e){let t=new Map;for(let n of e){let e=`${n.host}\u0000${n.reason}`,r=t.get(e)??{host:n.host,reason:n.reason,count:0};r.count+=n.count,t.set(e,r)}return[...t.values()].sort((e,t)=>t.count-e.count)}function nb({row:e}){return(0,H.jsxs)(H.Fragment,{children:[[e.saved,e.skipped,e.failed].map((t,n)=>(0,H.jsxs)(`td`,{className:V(Uy,`text-end tabular-nums`),children:[t,` `,(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[eb(t,e.total),`%`]})]},n)),(0,H.jsx)(`td`,{className:V(Uy,`text-end font-medium tabular-nums`),children:e.total})]})}function rb(e,t){return`/api/settings/diagnostics?days=${e}${t===`all`?``:`&host=${t}`}`}function ib(){let e=X(),[t,n]=(0,v.useState)(7),[r,i]=(0,v.useState)(`all`),[a,o]=(0,v.useState)(()=>new Set),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b]=(0,v.useState)(ny),x=(0,v.useCallback)(async(e,t)=>{let n=Qv(),r=b.begin();try{let[i,a,o]=await Promise.all([Y(rb(e,t)),Y(`/api/settings/traces`),Y(`/api/settings`)]);if(!r())return;c(i),u(a.traces),n.isCurrent()&&f(o),g(``)}catch(e){if(!r())return;g(e.message)}},[b]);(0,v.useEffect)(()=>{x(t,r)},[t,r,x]),(0,v.useEffect)(()=>ey(e=>f(e)),[]);async function S(n){if(!d)return;let i;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({revision:d.revision,edits:n})})}catch(e){i=e}let a=await $v()!==null;if(!i){y(``),await x(t,r),a||g(e(`Reload the page before saving again.`));return}g(ty(i.message,e(a?`Current settings were reloaded; check the values and save again.`:`The current settings could not be reloaded. Reload the page.`)))}async function C(e){try{let t=await Y(`/api/settings/traces/${encodeURIComponent(e)}`);m(t.content)}catch(e){g(e.message)}}async function w(n){if(window.confirm(`${e(`Delete`)} ${n}?`))try{await Y(`/api/settings/traces/${encodeURIComponent(n)}`,{method:`DELETE`}),m(``),await x(t,r)}catch(e){g(e.message)}}async function T(n){try{let{result:i}=await Y(`/api/settings/capture-retry/${n}/run`,{method:`POST`,body:`{}`});y(e(i===`scheduled`?n===`pi`?`These turns retry at the next Pi session start.`:n===`claude-code`?`These turns retry at the next Claude Code session start.`:`These turns retry at the next OpenCode session start.`:i===`running`?`A retry is already running.`:`Retrying now.`)),await x(t,r)}catch(e){g(e.message)}}let E=d?.settings.captureTrace,D=Number(d?.settings.captureRetryRetentionHours?.value??72);return(0,H.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Capture diagnostics`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Capture diagnostics`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 pb-2 text-sm`,children:[e(`Time range`),(0,H.jsxs)(Er,{"aria-label":e(`Time range`),className:`rounded-lg border border-border bg-background px-2 py-1`,value:t,onChange:e=>n(Number(e.target.value)),children:[(0,H.jsx)(`option`,{value:1,children:e(`24 hours`)}),(0,H.jsx)(`option`,{value:7,children:e(`7 days`)}),(0,H.jsx)(`option`,{value:30,children:e(`30 days`)}),(0,H.jsx)(`option`,{value:90,children:e(`90 days`)})]}),e(`Host`),(0,H.jsxs)(Er,{"aria-label":e(`Host`),className:`rounded-lg border border-border bg-background px-2 py-1`,value:r,onChange:e=>i(e.target.value),children:[(0,H.jsx)(`option`,{value:`all`,children:e(`All`)}),[`opencode`,`pi`,`claude-code`].map(e=>(0,H.jsx)(`option`,{value:e,children:Jd(e)},e))]})]}),h&&(0,H.jsx)(`p`,{role:`alert`,children:h}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Saved: a memory was stored. Skipped: the model or a rule found nothing worth keeping, or the turn was private or trivial. Failed: the attempt hit an error. Total: the three added up. Each percentage is a share of its row's total.`)}),(0,H.jsx)(`div`,{className:Ry,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:zy,children:e(`Outcomes by host`)}),(0,H.jsx)(`thead`,{className:By,children:(0,H.jsx)(`tr`,{children:[`Host / model`,`Saved`,`Skipped`,`Failed`,`Total`].map((t,n)=>(0,H.jsx)(`th`,{scope:`col`,className:V(Vy,n>0&&`text-end`),children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:$y(s?.byModel??[]).map(t=>{let n=a.has(t.host);return(0,H.jsxs)(v.Fragment,{children:[(0,H.jsxs)(`tr`,{className:V(Hy,`font-medium`),children:[(0,H.jsx)(`td`,{className:Uy,children:(0,H.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1`,"aria-expanded":n,onClick:()=>o(e=>{let r=new Set(e);return n?r.delete(t.host):r.add(t.host),r}),children:[(0,H.jsx)(`span`,{"aria-hidden":!0,children:n?`▾`:`▸`}),Yd(t.host),(0,H.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,t.models.length,` `,e(t.models.length===1?`model`:`models`),`)`]})]})}),(0,H.jsx)(nb,{row:t})]}),n&&t.models.map(n=>(0,H.jsxs)(`tr`,{className:`border-t border-border transition-colors hover:bg-muted/30`,children:[(0,H.jsx)(`td`,{className:V(`px-3 py-1.5`,`ps-8`),children:n.label?(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:n.label}):(0,H.jsx)(`span`,{className:`text-xs italic text-muted-foreground`,title:e(`No model was recorded for these attempts. This happens with records written by older OMMS versions, and when an attempt stops before a model is chosen.`),children:e(`model not recorded`)})}),(0,H.jsx)(nb,{row:n})]},`${t.host}-${n.label??`none`}`))]},t.host)})})]})}),(0,H.jsx)(`div`,{className:Ry,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:zy,children:e(`Failure reasons`)}),(0,H.jsx)(`thead`,{className:By,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,className:Vy,children:e(`Host`)}),(0,H.jsx)(`th`,{scope:`col`,className:Vy,children:e(`Reason`)}),(0,H.jsx)(`th`,{scope:`col`,className:V(Vy,`text-end`),children:e(`Total`)})]})}),(0,H.jsx)(`tbody`,{children:tb(s?.byReason??[]).map((e,t)=>(0,H.jsxs)(`tr`,{className:Hy,children:[(0,H.jsx)(`td`,{className:V(Uy,`text-muted-foreground`),children:Yd(e.host)}),(0,H.jsx)(`td`,{className:V(Uy,`font-mono text-xs`),children:e.reason}),(0,H.jsx)(`td`,{className:V(Uy,`text-end tabular-nums`),children:e.count})]},`${e.host}-${e.reason}-${t}`))})]})}),(0,H.jsx)(`div`,{className:V(Ry,`max-h-72 overflow-y-auto`),children:(0,H.jsxs)(`table`,{className:`w-full min-w-max text-sm`,children:[(0,H.jsx)(`caption`,{className:zy,children:e(`Recent attempts`)}),(0,H.jsx)(`thead`,{className:V(By,`sticky top-0`),children:(0,H.jsx)(`tr`,{children:[`Time`,`Host`,`Source`,`Session`,`Path`,`Model`,`Stop`,`Blocks`,`Prompt`,`Reply`,`Duration`,`Outcome`,`Reason`].map(t=>(0,H.jsx)(`th`,{scope:`col`,className:Vy,children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:s?.recent.map((e,t)=>(0,H.jsx)(`tr`,{className:Hy,children:[Yp(e.timestamp),Yd(e.host),e.sourceType,e.sessionId,e.path,`${e.provider??``}/${e.model??``}`,e.stopReason,e.blockTypes?.join(`, `),e.promptChars,e.replyChars,e.durationMs,e.outcome,e.reason].map((e,t)=>(0,H.jsx)(`td`,{className:V(Uy,`whitespace-nowrap`),children:e??``},t))},`${e.timestamp}-${t}`))})]})}),(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3 text-sm`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:E?.value===!0,disabled:!d,onChange:t=>{t.target.checked&&!window.confirm(e(`Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.`))||S({captureTrace:t.target.checked})}}),` `,e(`Save capture traces`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.`)}),E?.source===`project`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`This project turns tracing off. The global switch cannot turn it on here.`)}),[`captureTraceRetentionDays`,`captureAttemptRetentionDays`].map(t=>(0,H.jsxs)(`label`,{className:`block`,children:[e(t===`captureTraceRetentionDays`?`Trace retention (days)`:`Attempt retention (days)`),` `,(0,H.jsx)(`input`,{type:`number`,min:1,className:`ms-2 w-20 rounded border border-border bg-background p-1`,defaultValue:Number(d?.settings[t]?.value??30),onBlur:e=>{let n=Number(e.target.value);Number.isSafeInteger(n)&&n>0&&n!==d?.settings[t]?.value&&S({[t]:n})}},`${t}-${d?.settings[t]?.value}`)]},t)),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Retry retention (hours)`),` `,(0,H.jsx)(`input`,{type:`number`,min:0,max:720,className:`ms-2 w-20 rounded border border-border bg-background p-1`,defaultValue:D,onBlur:e=>{let t=Number(e.target.value);Number.isSafeInteger(t)&&t>=0&&t<=720&&t!==D&&S({captureRetryRetentionHours:t})}},`captureRetryRetentionHours-${D}`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`When the capture model cannot be reached, OMMS keeps the turn and tries again later. Queued turns can hold conversation content after redaction. 0 turns the queue off and deletes waiting turns.`)}),(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Turns waiting for retry`)}),[`pi`,`opencode`,`claude-code`].map(t=>{let n=s?.retryQueue?.[t]??0;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`w-24`,children:Jd(t)}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:n}),(0,H.jsx)(`button`,{type:`button`,disabled:n===0||D===0,className:`disabled:opacity-50`,onClick:()=>void T(t),children:e(`Retry now`)})]},t)}),_&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_}),(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Trace files`)}),l.map(t=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`span`,{children:[t.file,` (`,t.size,` bytes)`]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void C(t.file),children:e(`View`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void w(t.file),children:e(`Delete`)})]},t.file)),p&&(0,H.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:p})]})]})}function ab(){let e=X(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``);async function s(e){i(!0);try{let t=await Y(`/api/settings/health`,{method:`POST`,body:JSON.stringify({testModels:e})});n(t.checks),o(``)}catch(e){o(e.message)}finally{i(!1)}}return(0,H.jsxs)(`section`,{id:`settings-health`,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Health`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Health`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:r,onClick:()=>void s(!1),children:e(`Run checks`)}),(0,H.jsx)(`button`,{className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:r,onClick:()=>void s(!0),children:e(`Run checks and test models`)})]}),r&&(0,H.jsx)(`p`,{role:`status`,children:e(`Checking…`)}),a&&(0,H.jsx)(`p`,{role:`alert`,children:a}),(0,H.jsx)(`ul`,{className:`space-y-2 text-sm`,children:t.map(t=>(0,H.jsxs)(`li`,{className:`rounded-lg border border-border p-2`,children:[(0,H.jsx)(`strong`,{className:t.status===`fail`?`text-red-600`:t.status===`warn`?`text-amber-600`:`text-green-600`,children:e(t.status).toUpperCase()}),` `,`· `,e(t.check),`: `,t.reason]},t.check))})]})}function ob(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>{e&&n(t)}).catch(t=>{e&&c(t.message)}),Y(`/api/settings/web-autostart`).then(t=>{e&&i(t)}).catch(t=>{e&&c(t.message)}),Y(`/api/settings/version`).then(t=>{e&&o(t)}).catch(()=>{});let t=ey(t=>{e&&n(t)});return()=>{e=!1,t()}},[]);async function d(n){if(t){u(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{webServerAutoStart:n},revision:t.revision})}),c(e(`Saved. The login item changes at the next Pi or OpenCode start.`))}catch(e){c(e.message)}await $v(),u(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Web app`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Web app`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!t?.settings.webServerAutoStart?.globalValue,disabled:l||!t,onChange:e=>void d(e.target.checked)}),e(`Start web app at login`)]}),(0,H.jsxs)(`p`,{className:`text-sm`,children:[e(`Login item`),`: `,e(r?.state??`not installed`)]}),r?.state===`unsupported`&&(0,H.jsx)(`p`,{role:`status`,children:e(`Login items are unsupported on this platform.`)}),r?.state===`no-runtime`&&(0,H.jsx)(`p`,{role:`status`,children:e(`Install Node or Bun to start the web app at login.`)}),a&&(0,H.jsx)(sb,{info:a}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Use these commands to apply the change now:`)}),(0,H.jsxs)(`div`,{className:`space-y-1 font-mono text-xs`,children:[(0,H.jsx)(`p`,{children:`om-memory-system web`}),(0,H.jsx)(`p`,{children:`om-memory-system web install`}),(0,H.jsx)(`p`,{children:`om-memory-system web uninstall`}),(0,H.jsx)(`p`,{children:`om-memory-system web status`})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:s})]})}function sb({info:e}){let t=X(),n=ly(e);return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsxs)(`p`,{children:[t(`Running version`),`: `,e.running,` · `,t(`Global command`),`:`,` `,e.global??t(`not installed globally`)]}),n.kind===`older`&&(0,H.jsx)(`p`,{role:`status`,children:t(`A newer OMMS copy runs in place of the global install. The global install is optional. To update it:`)}),n.kind===`newer`&&(0,H.jsx)(`p`,{role:`status`,className:`text-amber-600`,children:t(`The global install is newer than the running OMMS. The next Pi or OpenCode start replaces the web app.`)}),n.kind===`missing`&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`OMMS is not installed globally. A global install is optional.`)}),n.command&&(0,H.jsx)(`p`,{className:`font-mono text-xs`,children:n.command})]})}function cb(e){let t=e.trim();return t===``||t.startsWith(`~/`)||t.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(t)||t.startsWith(`\\\\`)}function lb(e,t,n){return n?t:typeof e==`string`?e:``}function ub(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=t=>{e&&(n(t),i(e=>lb(t.settings.claudeConfigDir?.globalValue,e,l.current)))},r=Qv();Y(`/api/settings`).then(e=>{r.isCurrent()&&t(e)}).catch(t=>{e&&o(t.message)});let a=ey(e=>t(e));return()=>{e=!1,a()}},[]);async function u(){if(t){if(!cb(r)){o(e(`Enter a full path, or a path that starts with ~/.`));return}c(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{claudeConfigDir:r.trim()},revision:t.revision})}),l.current=!1,o(e(`Saved. Capture and import use this folder now.`))}catch(e){o(e.message)}await $v(),c(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Claude Code folder`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Claude Code folder`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`Set this when Claude Code does not use ~/.claude, for example when you start it with CLAUDE_CONFIG_DIR. Leave it empty to use the default.`)}),(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Claude Code folder`)}),(0,H.jsx)(`input`,{className:`w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`~/.claude`,value:r,disabled:s||!t,onChange:e=>{l.current=!0,i(e.target.value)}})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:s||!t,onClick:()=>void u(),children:e(`Save folder`)}),(0,H.jsx)(db,{folder:t?.claudeFolder}),a&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:a})]})}function db({folder:e}){let t=X();if(!e)return null;let n={setting:t(`this setting`),env:t(`the CLAUDE_CONFIG_DIR variable of the web app`),default:t(`the default folder`)};return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsxs)(`p`,{children:[t(`Transcripts folder in use`),`: `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.root})]}),(0,H.jsxs)(`p`,{children:[t(`From`),`: `,n[e.source]]}),!e.exists&&(0,H.jsxs)(`p`,{role:`status`,className:`text-amber-600`,children:[t(`This folder does not exist. Claude Code capture and import will not work:`),` `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.root})]})]})}function fb(e,t){return`/api/settings/log?lines=200${e===`all`?``:`&level=${e}`}${t?`&filter=capture`:``}`}function pb(e){let t=/^\d{4}-(\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(e);return t?`${t[1]} ${t[2]}`:e}function mb(e){return e.map(e=>{let t=e.message.replace(/\s*\n\s*/g,` `);return`${e.time} ${e.level.toUpperCase()} ${t}${e.data?`: ${e.data}`:``}`}).join(`
125
- `)}function hb(e){return e.scrollHeight-e.scrollTop-e.clientHeight<24}var gb={info:`info`,warn:`warning`,error:`destructive`};function _b({level:e,guessed:t}){let n=X(),r=(0,H.jsxs)(rd,{variant:gb[e],tabIndex:t?0:void 0,className:`w-14 justify-center`,children:[n(e),t&&(0,H.jsxs)(`span`,{className:`sr-only`,children:[`, `,n(`Level guessed from the message`)]})]});return t?(0,H.jsx)(zp,{content:n(`Level guessed from the message`),children:r}):r}function vb({records:e,emptyText:t,label:n}){let r=(0,v.useRef)(null),i=(0,v.useRef)(!0);return(0,v.useLayoutEffect)(()=>{let e=r.current;e&&i.current&&(e.scrollTop=e.scrollHeight)},[e]),(0,H.jsx)(`div`,{ref:r,role:`log`,"aria-live":`off`,"aria-label":n,tabIndex:0,onScroll:()=>{r.current&&(i.current=hb(r.current))},className:`max-h-80 overflow-auto rounded-lg bg-background p-3 text-xs`,children:e.length===0?(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:t}):(0,H.jsx)(`ol`,{dir:`ltr`,className:`space-y-1.5 text-start`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-2 gap-y-1`,children:[(0,H.jsx)(`time`,{dateTime:e.time,title:e.time,className:`shrink-0 font-mono text-muted-foreground`,children:pb(e.time)}),(0,H.jsx)(_b,{level:e.level,guessed:e.guessed}),(0,H.jsxs)(`span`,{className:`min-w-0 basis-full break-words whitespace-pre-wrap sm:basis-0 sm:flex-1`,children:[e.message,e.data&&(0,H.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[` `,e.data]})]})]},e.seq))})})}var yb=5e3,bb=[{level:`all`,label:`All`},{level:`warn`,label:`Warning`},{level:`error`,label:`Error`}];function xb(e){let[t,n]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let t=e.current;if(!t)return;let r=!0,i=document.visibilityState===`visible`,a=()=>n(r&&i),o=typeof IntersectionObserver>`u`?void 0:new IntersectionObserver(([e])=>{r=e?.isIntersecting??!0,a()});o?.observe(t);let s=()=>{i=document.visibilityState===`visible`,a()};return document.addEventListener(`visibilitychange`,s),a(),()=>{o?.disconnect(),document.removeEventListener(`visibilitychange`,s)}},[e]),t}function Sb(){let e=X(),t=(0,v.useRef)(null),n=(0,v.useRef)(0),[r,i]=(0,v.useState)(`all`),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),h=xb(t),g=(0,v.useCallback)(async()=>{let e=++n.current;try{let t=await Y(fb(r,a));if(e!==n.current)return;u(t),f(``)}catch(t){e===n.current&&f(t.message)}},[r,a]);(0,v.useEffect)(()=>{if(s){n.current++;return}g()},[g,s]),(0,v.useEffect)(()=>{if(s||!h)return;let e=setInterval(()=>void g(),yb);return()=>clearInterval(e)},[s,h,g]);async function _(e){try{await navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3)}catch{m(!1)}}let y=l?.records??[],b=e(r===`all`&&!a?`No log has been written yet.`:`No matching log records.`);return(0,H.jsxs)(`section`,{ref:t,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Log`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Log`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[(0,H.jsx)(`div`,{role:`group`,"aria-label":e(`Level`),className:`flex gap-1.5`,children:bb.map(t=>(0,H.jsx)(G,{type:`button`,size:`sm`,variant:r===t.level?`default`:`outline`,"aria-pressed":r===t.level,onClick:()=>i(t.level),children:e(t.label)},t.level))}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),` `,e(`Capture attempts only`)]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,"aria-pressed":s,onClick:()=>c(!s),children:e(s?`Resume`:`Pause`)}),(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void g(),children:e(`Refresh`)}),(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:y.length===0,onClick:()=>void _(mb(y)),children:e(`Copy visible records`)}),l&&(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void _(l.path),children:e(`Copy log path`)}),(0,H.jsx)(`span`,{role:`status`,className:`text-xs text-muted-foreground`,children:p?e(`Copied`):s?e(`Paused`):``})]}),(0,H.jsx)(`p`,{dir:`ltr`,className:`break-all text-start font-mono text-xs text-muted-foreground`,children:l?.path}),d&&(0,H.jsx)(`p`,{role:`alert`,children:d}),(0,H.jsx)(vb,{records:y,label:e(`Log lines`),emptyText:l?b:e(`Loading log…`)})]})}var Cb=[{code:`en`,name:`English`},{code:`id`,name:`Bahasa Indonesia`},{code:`zh`,name:`中文`},{code:`ja`,name:`日本語`},{code:`es`,name:`Español`},{code:`fr`,name:`Français`},{code:`de`,name:`Deutsch`},{code:`ru`,name:`Русский`},{code:`pt`,name:`Português`},{code:`ar`,name:`العربية`},{code:`ko`,name:`한국어`}];function wb(e){return typeof e==`string`&&e?e:`auto`}function Tb(e){let t=[...Cb];return e!==`auto`&&!t.some(t=>t.code===e)&&t.push({code:e}),t}function Eb({value:e,onChange:t,disabled:n}){let r=X();return(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsxs)(Er,{id:`capture-language`,className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,value:e,disabled:n,onChange:e=>t(e.target.value),children:[(0,H.jsx)(`option`,{value:`auto`,children:r(`Automatic`)}),Tb(e).map(e=>(0,H.jsx)(`option`,{value:e.code,children:e.name??e.code},e.code))]})})}function Db(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=Qv();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&i(t.message)});let r=ey(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function s(n){if(t){o(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{autoCaptureLanguage:n},revision:t.revision})}),i(e(`Saved. New memories use this language.`))}catch(e){i(e.message)}await $v(),o(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory language`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory language`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`The language that new memory summaries are written in. Automatic detects it from your prompt, but a Latin-script prompt under 100 characters counts as English.`)}),(0,H.jsx)(`label`,{className:`block space-y-1 text-sm`,htmlFor:`capture-language`,children:e(`Summary language`)}),(0,H.jsx)(Eb,{value:wb(t?.settings.autoCaptureLanguage?.value),disabled:a||!t,onChange:e=>void s(e)}),r&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:r})]})}function Ob({theme:e}){let{canvas:t,elevated:n,text:r,textSecondary:i,accent:a,border:o}=e.colours;return(0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`flex h-9 w-14 shrink-0 flex-col justify-center gap-1 rounded-md border px-1.5`,style:{background:t,borderColor:o},children:[(0,H.jsx)(`span`,{className:`h-1.5 w-8 rounded-full`,style:{background:r}}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{background:i}}),(0,H.jsx)(`span`,{className:`size-2.5 rounded-full`,style:{background:a,boxShadow:`0 0 0 2px ${n}`}})]})]})}function kb({variant:e,selected:t,filter:n,inUse:r,onSelect:i}){let a=X(),o=a(e===`light`?`Light theme`:`Dark theme`),s=Vf(e).filter(e=>e.name.toLowerCase().includes(n));return(0,H.jsxs)(`fieldset`,{"aria-label":o,className:`flex min-w-0 flex-col gap-2`,children:[(0,H.jsxs)(`legend`,{className:`flex w-full items-center gap-2 pb-2`,children:[(0,H.jsx)(`span`,{className:`text-ui font-semibold`,children:o}),r?(0,H.jsx)(rd,{children:a(`On screen now`)}):null]}),s.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`No theme matches.`)}):(0,H.jsx)(`div`,{className:`relative flex max-h-80 min-w-0 flex-col overflow-y-auto rounded-[10px] border border-border p-1`,children:s.map(n=>{let r=n.id===t;return(0,H.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 transition-colors duration-150 hover:bg-interactive-hover has-[:checked]:bg-selection has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-[-2px] has-[:focus-visible]:outline-ring`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`theme-${e}`,value:n.id,checked:r,onChange:()=>i(n.id),className:`sr-only`}),(0,H.jsx)(Ob,{theme:n}),(0,H.jsx)(`bdi`,{className:`min-w-0 flex-1 truncate text-ui`,children:n.name}),Uf(n)?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(`Default`)}):null,r?(0,H.jsx)(ae,{"aria-hidden":`true`,className:`size-4 shrink-0 text-primary-label`}):null]},n.id)})})]})}var Ab=[{value:`system`,label:`System`,Icon:et},{value:`light`,label:`Light`,Icon:Nt},{value:`dark`,label:`Dark`,Icon:tt}],jb={auto:`Automatic`,dmy:`Day month year`,mdy:`Month day year`,iso:`Year-month-day`},Mb={auto:`Automatic`,h23:`24-hour`,h12:`12-hour`};function Nb(){let e=X(),t=yp(),n=_p(),[r,i]=(0,v.useState)(``),a=r.trim().toLowerCase();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Theme`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`System follows your operating system and switches between the light and the dark theme. The choice stays in this browser.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`fieldset`,{"aria-label":e(`Theme mode`),className:`inline-flex rounded-[10px] border border-border p-0.5`,children:Ab.map(({value:n,label:r,Icon:i})=>(0,H.jsxs)(`label`,{className:`flex h-8 cursor-pointer items-center gap-1.5 rounded-md px-3 text-ui text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover has-[:checked]:bg-selection has-[:checked]:text-foreground has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`theme-mode`,value:n,checked:t.mode===n,onChange:()=>bp(n),className:`sr-only`}),(0,H.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),e(r)]},n))}),(0,H.jsx)(id,{type:`search`,"aria-label":e(`Filter themes`),placeholder:e(`Filter themes`),value:r,onChange:e=>i(e.target.value),className:`w-full sm:w-60`})]}),(0,H.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-x-6 gap-y-4 md:grid-cols-2`,children:[(0,H.jsx)(kb,{variant:`light`,selected:t.light,filter:a,inUse:n===`light`,onSelect:e=>xp(`light`,e)}),(0,H.jsx)(kb,{variant:`dark`,selected:t.dark,filter:a,inUse:n===`dark`,onSelect:e=>xp(`dark`,e)})]})]})}function Pb(){let e=X(),{dateFormat:t}=oa(),n=new Date;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Date and time`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`How dates and times show in this web app. The choice stays in this browser.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Date format`)}),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsx)(Er,{"aria-label":e(`Date format`),className:`w-full`,value:t.date,onChange:e=>Fi({date:e.target.value}),children:_i.map(r=>(0,H.jsx)(`option`,{value:r,children:`${e(jb[r])} · ${em(n,{...t,date:r})}`},r))})})]}),(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Time format`)}),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsx)(Er,{"aria-label":e(`Time format`),className:`w-full`,value:t.time,onChange:e=>Fi({time:e.target.value}),children:vi.map(r=>(0,H.jsx)(`option`,{value:r,children:`${e(Mb[r])} · ${Qp(n,{...t,time:r})}`},r))})})]})]})]})}function Fb(){let e=X();return(0,H.jsxs)(`section`,{className:`space-y-6 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Appearance`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Appearance`)}),(0,H.jsx)(Nb,{}),(0,H.jsx)(Pb,{})]})}async function Ib(e,t){try{let n=await fetch(e,{method:t?`POST`:`GET`,headers:{"x-omms-token":window.__OMMS_TOKEN__??``,...t?{"Content-Type":`application/json`}:{}},...t?{body:JSON.stringify(t)}:{}}),r=await n.json();return r.success?{ok:!0,code:r.code??`ok`,data:r.data,message:r.message}:{ok:!1,code:r.code??`error`,error:r.error??`Request failed (${n.status})`,...r.savedContent===void 0?{}:{savedContent:r.savedContent}}}catch(e){return{ok:!1,code:`network`,error:e instanceof Error?e.message:String(e)}}}var Lb=(e,t)=>e?`path=${encodeURIComponent(e)}`:`name=${encodeURIComponent(t)}`,Rb={overview:()=>Ib(`/api/skills`),skill:(e,t,n)=>Ib(`/api/skills/skill?${Lb(e,t)}${n?`&turnLimit=${n.limit}&turnOffset=${n.offset}`:``}`),activity:(e={days:30})=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));return Ib(`/api/skills/activity?${t}`)},history:(e,t,n)=>Ib(`/api/skills/history?${Lb(e,t)}&limit=${n.limit}&offset=${n.offset}`),proposals:e=>Ib(e?`/api/skills/proposals?state=${e}`:`/api/skills/proposals`),proposal:e=>Ib(`/api/skills/proposals/${encodeURIComponent(e)}`),stats:()=>Ib(`/api/skills/stats`),draftImprovement:e=>Ib(`/api/skills/draft`,{skill:e}),draftNew:(e,t)=>Ib(`/api/skills/draft`,{idea:e,folder:t}),ideas:()=>Ib(`/api/skills/ideas`,{}),apply:e=>Ib(`/api/skills/apply`,{id:e}),reject:e=>Ib(`/api/skills/reject`,{id:e}),undo:e=>Ib(`/api/skills/undo`,{id:e}),setMode:(e,t)=>Ib(`/api/skills/mode`,{skillPath:e,mode:t}),deleteTurns:()=>Ib(`/api/skills/delete-turns`,{confirm:!0}),recordPast:()=>Ib(`/api/skills/record-past`,{})};function zb(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function Bb(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.name.toLowerCase().includes(n)):e}function Vb(e){return e.state===`applied`&&e.appliedBy===`automatic`?`applied automatically`:e.state}function Hb(e){return e.filter(e=>e.state!==`pending`).sort((e,t)=>t.updatedAt-e.updatedAt)}function Ub(e){return e.split(`
126
- `).map(e=>e.startsWith(`@@`)?{kind:`hunk`,text:e}:e.startsWith(`+`)?{kind:`add`,text:e}:e.startsWith(`-`)?{kind:`del`,text:e}:{kind:`ctx`,text:e})}var Wb=e=>e.toLocaleString(`en-US`);function Gb(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Kb(e,t){let n=t.trim();return n&&!e.includes(n)?[...e,n]:e}function qb(e,t){return e.filter(e=>e!==t)}var Jb=[`done`,`failed`,`cancelled`],Yb=e=>Jb.includes(e.state);function Xb(e){return e.summary?.skillTurnsRecorded===void 0?(e.hosts??[]).reduce((e,t)=>e+(t.summary?.skillTurnsRecorded??0),0):e.summary.skillTurnsRecorded}function Zb(e){let t=e.total??0;return t>0?Math.min(100,Math.floor((e.processed??0)*100/t)):0}var Qb={info:{box:`border-status-info/25 bg-status-info/10`,icon:`text-status-info`,Icon:Be},warning:{box:`border-status-warning/25 bg-status-warning/10`,icon:`text-status-warning`,Icon:zt},danger:{box:`border-destructive/25 bg-destructive/10`,icon:`text-destructive-label`,Icon:it}};function $b({tone:e,children:t,className:n}){let{box:r,icon:i,Icon:a}=Qb[e];return(0,H.jsxs)(`div`,{role:e===`danger`?`alert`:`note`,"data-tone":e,className:V(`flex min-w-0 items-start gap-2.5 rounded-xl border px-3 py-2.5 text-start text-sm`,r,n),children:[(0,H.jsx)(a,{className:V(`mt-0.5 size-4 shrink-0`,i),"aria-hidden":`true`}),(0,H.jsx)(`div`,{className:`min-w-0 space-y-1.5 text-foreground`,children:t})]})}function ex(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),s=(0,v.useRef)(!0),c=(0,v.useRef)(!1),l=(0,v.useRef)(e);l.current=e;let u=t?.id,d=!!t&&!Yb(t);(0,v.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,v.useEffect)(()=>{if(!d)return;c.current=!0;let e=setInterval(()=>{Y(`/api/settings/imports/current`).then(e=>{!s.current||!e.job||e.job.id!==u||n(e.job)}).catch(e=>{s.current&&o(e.message)})},1e3);return()=>clearInterval(e)},[d,u]),(0,v.useEffect)(()=>{t&&Yb(t)&&c.current&&(c.current=!1,l.current())},[t]);async function f(){if(r||d)return;i(!0),o(``);let e=await Rb.recordPast();if(s.current){if(i(!1),!e.ok){o(e.error);return}n(e.data.job)}}return{job:t,running:d,starting:r,error:a,start:f}}function tx({onEnd:e}){let{job:t,running:n,starting:r,error:i,start:a}=ex(e);return(0,H.jsx)(nx,{job:t,running:n,starting:r,error:i,onStart:()=>void a()})}function nx({job:e,running:t,starting:n,error:r,onStart:i}){let a=X(),o=e?Zb(e):0;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:t||n,onClick:i,children:[(0,H.jsx)(St,{"aria-hidden":`true`}),a(`Record past turns`)]}),n?(0,H.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),a(`Finding past sessions…`)]}):null,t&&e?(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-label":a(`Record past turns`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${o}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[a(`Skill turns`),`: `,Wb(e.processed??0),` / `,Wb(e.total??0),` ·`,` `,o,`%`]})]}):null,e&&Yb(e)?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.state===`done`?zb(a(`Recorded {count} past turns.`),{count:Wb(Xb(e))}):a(`Record past turns did not finish.`)}):null,r?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:r}):null]})}function rx(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(!0);(0,v.useEffect)(()=>{o.current=!0,Y(`/api/settings`).then(e=>{o.current&&t(e)}).catch(e=>{o.current&&r(e.message)});let e=ey(e=>{o.current&&t(e)});return()=>{o.current=!1,e()}},[]);async function s(t){if(!e)return n||`Settings are not loaded`;let r=null;return await ry(a,async()=>{try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:e.revision})})}catch(e){r=e.message}await $v()}),r}return{snapshot:e,loadError:n,busy:i,save:s}}function ix({label:e,checked:t,disabled:n,onChange:r}){return(0,H.jsxs)(`label`,{className:`flex min-w-0 items-start gap-2.5 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`mt-1 size-4 shrink-0`,checked:t,disabled:n,onChange:e=>r(e.target.checked)}),(0,H.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:e})]})}function ax(e){let t=X(),{recording:n,redact:r,stats:i,busy:a,confirm:o}=e;return(0,H.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Skill learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Skill learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Record agent turns so OMMS can rank your skills and draft improvements.`)}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(ix,{label:t(`Record agent turns`),checked:n,disabled:a,onChange:e.onRecording}),e.projectOff?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`A project config turns recording off for this project.`)}):null,n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($b,{tone:`warning`,children:(0,H.jsx)(`p`,{children:t(`OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.`)})}),(0,H.jsx)(tx,{onEnd:e.onRecordPastEnd})]}):null]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(ix,{label:t(`Remove private text and secrets`),checked:r,disabled:a,onChange:e.onRedact}),o===`redact`?(0,H.jsxs)($b,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:t(`Stop removing private text and secrets?`)}),(0,H.jsx)(`p`,{children:t(`New turns will be stored as written.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,variant:`destructive`,size:`sm`,disabled:a,onClick:()=>e.onRedact(!1),children:t(`Turn off`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null,r?null:(0,H.jsx)($b,{tone:`danger`,children:(0,H.jsx)(`p`,{children:t(`<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.`)})})]}),(0,H.jsxs)(`dl`,{className:`grid max-w-md grid-cols-2 gap-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`Recorded turns`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?Wb(i.turns):`…`})]}),(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`File size`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?Gb(i.fileSize):`…`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`sm`,disabled:a||!i||i.turns===0,onClick:()=>e.onConfirm(`delete`),children:[(0,H.jsx)(Lt,{"aria-hidden":`true`}),t(`Delete recorded turns`)]}),o===`delete`&&i?(0,H.jsxs)($b,{tone:`danger`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:zb(t(`Delete {count} recorded turns? This cannot be undone.`),{count:Wb(i.turns)})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,variant:`destructive`,size:`sm`,onClick:e.onDeleteTurns,children:t(`Delete`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null]}),e.message?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.message}):null,e.failure?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:e.failure}):null]})}function ox(){let e=X(),{snapshot:t,loadError:n,busy:r,save:i}=rx(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(null),p=(0,v.useCallback)(async()=>{let e=await Rb.stats();e.ok&&o(e.data)},[]);(0,v.useEffect)(()=>{p()},[p]);let m=t?.settings.skillLearning;async function h(t){c(``),u(``),f(null);let n=await i(t);n?u(n):c(e(`Saved.`)),await p()}async function g(){f(null),u(``);let t=await Rb.deleteTurns();t.ok?c(zb(e(`Deleted {count} recorded turns.`),{count:Wb(t.data.deleted)})):u(t.error),await p()}return(0,H.jsx)(ax,{recording:m?.globalValue===!0,redact:t?.settings.skillLearningRedact?.globalValue!==!1,projectOff:m?.source===`project`&&m.value===!1,stats:a,busy:r||!t,confirm:d,message:s,failure:l||n,onRecording:e=>void h({skillLearning:e}),onRedact:e=>{e||d===`redact`?h({skillLearningRedact:e}):f(`redact`)},onConfirm:f,onDeleteTurns:()=>void g(),onRecordPastEnd:()=>void p()})}var sx={"settings-section-external-api":hy,"settings-section-models":fy,"settings-section-embedding":Py,"settings-section-keys":Yy,"settings-section-diagnostics":ib,"settings-section-health":ab,"settings-section-claude-folder":ub,"settings-section-capture-language":Db,"settings-section-appearance":Fb,"settings-section-profiles":Xy,"settings-section-web-app":ob,"settings-section-skill-learning":ox,"settings-section-log":Sb};function cx(){return(0,v.useEffect)(()=>{of(window.location.hash,document)},[]),(0,H.jsx)(`div`,{className:`settings-view space-y-6`,children:qv.map(({id:e})=>{let t=sx[e];return(0,H.jsx)(`div`,{id:e,className:`scroll-mt-20 md:scroll-mt-4`,children:(0,H.jsx)(t,{})},e)})})}function lx(e,t){return t?t.target:e.suggestion?.kind===`map`?e.suggestion.target:``}function ux(e,t){let n=new Map,r=new Map,i=[];for(let a of e){let e=t[a.directory],o=lx(a,e).trim();if(a.directory!==``&&o){let t=e||a.suggestion?.kind!==`map`?`exact`:a.suggestion.confidence,r=(n.get(a.directory)?.sessions??0)+a.sessions;n.set(a.directory,{from:a.directory,to:o,sessions:r,confidence:t})}else if(a.directory!==``&&!e&&a.suggestion?.kind===`ignore`){let e=(r.get(a.directory)?.sessions??0)+a.sessions;r.set(a.directory,{directory:a.directory,sessions:e,reason:a.suggestion.reason})}else i.push({...a})}return{maps:[...n.values()],ignores:[...r.values()],unmapped:i}}function dx(e){return new Set([...e.maps.filter(e=>e.confidence!==`guess`).map(e=>e.from),...e.ignores.map(e=>e.directory)])}function fx(e,t,n,r){let i={},a=n.maps.filter(e=>r.has(e.from));if(a.length){let t=new Map(e.map(e=>[e.from,{...e}]));for(let e of a)t.set(e.from,{from:e.from,to:e.to});i.importPathMaps=[...t.values()]}let o=n.ignores.filter(e=>r.has(e.directory));return o.length&&(i.importIgnoredDirectories=[...new Set([...t,...o.map(e=>e.directory)])]),i}function px(e){let t=new Map;for(let n of e)t.set(n.to,[...t.get(n.to)??[],n]);return[...t].map(([e,t])=>({target:e,maps:t.sort((e,t)=>e.from.localeCompare(t.from))})).sort((e,t)=>t.maps.length-e.maps.length||e.target.localeCompare(t.target))}function mx(e){return e.filter(e=>e.directory!==``)}function hx(e,t){return[...new Set([...e,...mx(t).map(e=>e.directory)])]}function gx(e,t){return e(t===`exact`?`Exact`:t===`name`?`Name match`:`Guess`)}function _x(e,t){return e(t===`temporary`?`Temporary folder`:t===`node_modules`?`node_modules folder`:t===`app-data`?`App data folder`:`Skills folder`)}function vx({host:e,rows:t,decisions:n,busy:r,onDecide:i,onResolve:a,onIgnore:o,onIgnoreAll:s,open:c}){let l=X(),u=t.filter(e=>e.directory!==``),d=u.filter(e=>lx(e,n[e.directory]).trim()).length;return(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{id:`directory-maps-${e}`,className:`scroll-mt-20 cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsxs)(`h3`,{className:`inline text-subsection-title font-semibold`,children:[Jd(e),`: `,l(`Unresolved directories`)]}),(0,H.jsxs)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:[l(`Directories`),`: `,u.length,` · `,l(`Unresolved sessions`),`:`,` `,t.reduce((e,t)=>e+t.sessions,0),` · `,l(`Rows with a target`),`:`,` `,d]})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[t.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`No unresolved directories in the latest run.`)}):(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`[&_button]:h-auto [&_button]:min-h-8 [&_button]:whitespace-normal [&_button]:py-1.5`,children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:r||u.length===0,onClick:a,children:l(`Smart resolve directories`)}),s&&u.length>0&&(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,className:`ms-2`,disabled:r,onClick:s,children:l(`Ignore all`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.`)})]}),t.map(e=>{if(e.directory===``)return(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[l(`No directory recorded`),` ·`,` `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,` ·`,` `,l(`These sessions cannot be mapped.`)]},`no-directory`);let t=n[e.directory],a=lx(e,t),s=!t&&e.suggestion?.kind===`ignore`?e.suggestion:null;return(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsxs)(`details`,{className:`min-w-0 flex-1`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.directory}),` `,`· `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,(0,H.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:s?(0,H.jsxs)(H.Fragment,{children:[l(`Suggested to ignore`),`: `,_x(l,s.reason)]}):(0,H.jsxs)(H.Fragment,{children:[l(`Target directory`),`:`,` `,a?(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:a}):l(`No target chosen`)]})})]}),(0,H.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[!e.suggestion&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`No suggestion found.`)}),(0,H.jsx)(id,{"aria-label":`${e.directory} ${l(`Target directory`)}`,dir:`ltr`,placeholder:l(`Target directory`),value:a,disabled:r,onChange:t=>i(e,t.target.value)})]})]}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,"aria-label":`${l(`Ignore`)} ${e.directory}`,disabled:r,onClick:()=>o(e),children:l(`Ignore`)})]},e.directory)})]})]})}function yx({host:e,review:t,busy:n,canConfirm:r,onRefresh:i,error:a,onClose:o,onConfirm:s}){let c=X(),[l,u]=(0,v.useState)(()=>({review:t,ticked:dx(t)})),d=l.review===t?l.ticked:dx(t),f=(e,n)=>u(r=>{let i=new Set(r.review===t?r.ticked:dx(t));return n?i.add(e):i.delete(e),{review:t,ticked:i}}),p=[...t.maps.map(e=>e.from),...t.ignores.map(e=>e.directory)],m=p.filter(e=>d.has(e)).length,h=e=>(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[c(`Sessions`),`: `,e]});return(0,H.jsx)(K,{open:!0,onOpenChange:e=>{!e&&!n&&o()},children:(0,H.jsxs)(q,{className:`sm:max-w-2xl flex flex-col overflow-hidden`,showCloseButton:!n,onEscapeKeyDown:e=>{n&&e.preventDefault()},onInteractOutside:e=>{n&&e.preventDefault()},children:[(0,H.jsxs)(Vl,{children:[(0,H.jsxs)(Ul,{children:[c(`Review directory maps`),`: `,Jd(e)]}),(0,H.jsx)(Wl,{children:c(`Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.`)})]}),(0,H.jsxs)(`div`,{className:`min-h-0 overflow-y-auto space-y-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm`,children:[c(`Proposed maps`),`: `,t.maps.length,` · `,c(`Suggested to ignore`),`:`,` `,t.ignores.length,` · `,c(`No target`),`: `,t.unmapped.length]}),!p.length&&(0,H.jsx)(`p`,{className:`text-sm`,children:c(`Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.`)}),t.maps.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Proposed maps`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Save this map`)} ${e.from}`,checked:d.has(e.from),disabled:n,onChange:t=>f(e.from,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.from}),(0,H.jsxs)(`div`,{className:`mt-1`,children:[c(`Target directory`),`:`,` `,(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.to})]}),(0,H.jsxs)(`div`,{className:`text-xs`,children:[c(`Confidence`),`: `,gx(c,e.confidence)]}),h(e.sessions)]})]},e.from))})]}),t.ignores.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Suggested to ignore`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.ignores.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Ignore`)} ${e.directory}`,checked:d.has(e.directory),disabled:n,onChange:t=>f(e.directory,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{className:`mt-1`,children:_x(c,e.reason)}),h(e.sessions)]})]},e.directory))})]}),t.unmapped.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`No target`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.unmapped.map((e,t)=>(0,H.jsxs)(`li`,{className:`min-w-0 border-t border-border pt-2 text-sm`,children:[e.directory===``?c(`No directory recorded`):(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{children:e.directory===``?c(`These sessions cannot be mapped.`):c(`No target chosen`)}),h(e.sessions)]},`${e.directory}-${t}`))})]})]}),a&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:n,onClick:o,children:c(`Cancel`)}),!r&&(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:c(`Refresh list`)}),(0,H.jsx)(G,{type:`button`,disabled:n||!r||m===0,onClick:()=>s(new Set(p.filter(e=>d.has(e)))),children:c(n?`Saving…`:`Confirm`)})]})]})})}function bx({host:e,rows:t,busy:n,onConfirm:r,onCancel:i}){let a=X(),o=t.reduce((e,t)=>e+t.sessions,0);return(0,H.jsx)(K,{open:!0,onOpenChange:e=>!e&&!n&&i(),children:(0,H.jsxs)(q,{className:`sm:max-w-xl`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:`${a(`Ignore all`)}: ${Jd(e)}`}),(0,H.jsx)(Wl,{children:`${a(`These directories stay unimported and leave the unresolved counts.`)} ${a(`Directories`)}: ${t.length} · ${a(`Sessions`)}: ${o}`})]}),(0,H.jsx)(`ul`,{className:`max-h-64 space-y-1 overflow-y-auto text-sm`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e.directory}),(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sessions})]},e.directory))}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:a(`Cancel`)}),(0,H.jsx)(G,{type:`button`,disabled:n,onClick:r,children:a(`Ignore all`)})]})]})})}var xx=[`pi`,`opencode`,`claude-code`];function Sx({hosts:e=xx,saved:t=!0,title:n,anchorId:r}={}){let i=X(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(new Set),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(),E=(0,v.useRef)(!1),D=(0,v.useRef)(void 0),O=()=>Y(`/api/settings/import-maps`).then(e=>{u(e),f(new Set),m({})}).catch(e=>g(e.message));(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>{e&&(D.current=t.revision,c(t))}).catch(t=>{e&&g(t.message)}),O();let t=ey(t=>{if(!e)return;let n=t;c(n),n.revision!==D.current&&(D.current=n.revision,Y(`/api/settings/import-maps`).then(t=>{e&&D.current===n.revision&&u(t)}).catch(()=>{}))});return()=>{e=!1,t()}},[]);function k(e,t){E.current||w||(C(``),x({host:e,review:ux(t,p)}))}function A(e,t){m(n=>({...n,[e.directory]:{directory:e.directory,target:t}}))}let j=()=>s?.settings?.importPathMaps?.globalValue??l?.saved??[],M=()=>l?.ignored??[];async function N(e,t,n){if(!s||!l||E.current||w)return!E.current&&!w&&g(`The list is still loading. Try again in a moment.`),!1;E.current=!0,y(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:s.revision})})}catch(e){let t=e instanceof Jv&&e.status===409;try{if(!t)return g(n),await $v(),!1;g(`Settings changed elsewhere. Check the list and try again.`);try{await te()}catch{T(`conflict`),g(`Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.`)}return!1}finally{E.current=!1,y(!1)}}g(t);try{await te()}catch{T(`saved`),g(`Saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}return!0}function P(){N({importPathMaps:uy(l?.saved??[],d)},`Saved. Removed maps stop applying at the next import or backfill run.`,`Removals could not be saved. Try again.`).then(e=>{e&&f(new Set)})}function ee(e){N({importIgnoredDirectories:[...new Set([...M(),e.directory])]},`Ignored. The directory stays unimported.`,`The directory could not be ignored. Try again.`)}function F(){if(!a)return;let{rows:e}=a;N({importIgnoredDirectories:hx(M(),e)},`Ignored. The directories stay unimported.`,`The directories could not be ignored. Try again.`).then(e=>{e&&o(void 0)})}function I(e){N({importIgnoredDirectories:M().filter(t=>t!==e)},`Restored. The directory shows again in each host list that reported it.`,`The directory could not be restored. Try again.`)}async function te(){let[e,t]=await Promise.all([Y(`/api/settings`),Y(`/api/settings/import-maps`)]);D.current=e.revision,Zv(e),u(t),T(void 0)}async function L(){if(E.current)return;E.current=!0,y(!0);let e=w===`saved`;try{await te(),e?g(`Saved. Maps apply to the next import or backfill run.`):b?C(`Settings changed elsewhere. Review these maps and confirm again.`):g(`Settings refreshed. No maps were saved.`)}catch{e?g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`):b?C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`):g(`Settings could not be refreshed. Try Refresh list again.`)}finally{E.current=!1,y(!1)}}async function ne(e){if(!s||!l||!b||E.current||w)return;let t=fx(j(),M(),b.review,e);if(!t.importPathMaps&&!t.importIgnoredDirectories)return;E.current=!0,y(!0),C(``);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:s.revision})})}catch(e){let t=e instanceof Jv&&e.status===409;if(C(t?`Settings changed elsewhere. Review these maps and confirm again.`:`Maps could not be saved. Review the targets and confirm again.`),t)try{await te()}catch{T(`conflict`),C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`)}E.current=!1,y(!1);return}let n=new Set(e);m(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))),f(e=>new Set([...e].filter(e=>!n.has(e)))),u(e=>e&&{...e,saved:t.importPathMaps??e.saved,ignored:t.importIgnoredDirectories??e.ignored}),x(void 0);let r=b.review.maps.filter(t=>e.has(t.from)).length,a=b.review.ignores.filter(t=>e.has(t.directory)).length;g(`${i(`Saved maps`)}: ${r} · ${i(`Ignored directories`)}: ${a}. ${i(`They apply to the next import or backfill run. No sessions were imported.`)}`);try{await te()}catch{T(`saved`),g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}}return(0,H.jsxs)(`section`,{id:r??`directory-maps`,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":i(n??`Resolve missing project folders`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:i(n??`Resolve missing project folders`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.`)}),t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Saved maps`)}),` ·`,` `,l?.saved.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Saved maps apply to every host.`)})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:_||!!w||!s||!l||d.size===0,onClick:P,children:i(`Save removals`)}),!l?.saved.length&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`none`)}),px(l?.saved??[]).map(e=>(0,H.jsxs)(`details`,{className:`min-w-0 border-t border-border pt-2`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded text-sm focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.target}),` `,`· `,e.maps.length]}),(0,H.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:e.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all ${d.has(e.from)?`line-through`:``}`,children:e.from}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${d.has(e.from)?i(`Keep`):i(`Remove`)} ${e.from}`,disabled:_,onClick:()=>f(t=>{let n=new Set(t);return n.has(e.from)?n.delete(e.from):n.add(e.from),n}),children:d.has(e.from)?i(`Keep`):i(`Remove`)})]},e.from))})]},e.target))]})]}),(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Ignored directories`)}),` `,`· `,l?.ignored?.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Ignored directories stay unimported and leave the unresolved counts.`)})]}),(0,H.jsxs)(`ul`,{className:`mt-3 space-y-1 text-sm`,children:[!l?.ignored?.length&&(0,H.jsx)(`li`,{className:`text-muted-foreground`,children:i(`none`)}),l?.ignored?.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${i(`Restore`)} ${e}`,disabled:_||!!w||!s,onClick:()=>I(e),children:i(`Restore`)})]},e))]})]})]}),e.map(t=>{let n=l?.[t]??[];return(0,H.jsx)(vx,{host:t,rows:n,decisions:p,busy:_||!!w||!s||!l,onDecide:A,onResolve:()=>k(t,n),onIgnore:ee,onIgnoreAll:()=>o({host:t,rows:mx(n)}),open:e.length===1},t)}),a&&(0,H.jsx)(bx,{host:a.host,rows:a.rows,busy:_,onConfirm:F,onCancel:()=>o(void 0)}),b&&(0,H.jsx)(yx,{host:b.host,review:b.review,busy:_,canConfirm:!w,error:i(S),onRefresh:()=>void L(),onClose:()=>{E.current||x(void 0)},onConfirm:e=>void ne(e)}),w&&!b&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:_,onClick:()=>void L(),children:i(`Refresh list`)}),h&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i(h)})]})}function Cx(e){return!e||e.total<=0?null:{percent:e.percent,done:`${e.done.toLocaleString(`en-US`)} / ${e.total.toLocaleString(`en-US`)}`,minutesLeft:e.minutesLeft===null?`unknown`:`about ${e.minutesLeft}`}}function wx(e,t){return e??!t}function Tx(e,t){let n=t.indexOf(`/`);if(t!==`inherit`&&t!==`external`&&(n<1||n===t.length-1))throw Error(`Enter a model as provider/model.`);return{[`${e}BackfillModel`]:t}}function Ex(e,t){if(t?.state===`running`)return t.phase===`profile`?{kind:`learning-profile`,done:t.profileDone??0,total:t.profileTotal??0}:{kind:`running`};if(t?.paused)return{kind:`paused`};if(t?.state===`failed`&&(t.updatedAt??t.startedAt??0)>=(e?.updatedAt??0))return{kind:`failed`,error:t.error??e?.error??null};if(!e||e.state===`not-started`)return t?.state===`done`?{kind:`imported`}:{kind:`not-started`};let n=t?.state===`done`&&(e.counts.failed??0)>0;return e.state===`failed`&&!n?{kind:`failed`,error:e.error}:e.state===`running`?{kind:`running`}:e.counts.pending>0?{kind:`stopped`,pending:e.counts.pending}:e.counts.unresolved>0?{kind:`partly`,unresolved:e.counts.unresolved}:{kind:`imported`}}function Dx(e){return e?.state===`running`&&e.phase!==`profile`}function Ox(e){return!e||e.state===`running`||!e.state||!e.updatedAt||!e.surface?null:{finishedAt:e.updatedAt,surface:e.surface,imported:e.imported??0,skipped:e.skipped??0,failed:e.failed??0,state:e.state}}function kx({host:e,backfill:t}){let n=X(),{snapshot:r,lists:i,busy:a}=t,[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(),u=r?.settings??{},d=String(u[`${e}BackfillModel`]?.globalValue??`inherit`),f=o??d,p=i[e]?.models??[],m=wx(c,f===`inherit`||f===`external`||p.some(e=>`${e.provider}/${e.model}`===f)),h=sy({memoryProvider:u.memoryProvider?.globalValue,memoryModel:u.memoryModel?.globalValue,memoryApiUrl:u.memoryApiUrl?.globalValue,keySet:!!r?.secrets?.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":`${Jd(e)} ${n(`settings`)}`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:`${Jd(e)} ${n(`settings`)}`}),e===`claude-code`?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Claude Code backfill always uses the external API. It has no backfill model setting.`)}):(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[n(`Backfill model`),(0,H.jsx)(`div`,{dir:`ltr`,children:(0,H.jsxs)(Er,{"aria-label":`${Jd(e)} ${n(`Backfill model`)}`,className:`mt-1 block w-full`,value:m?`typed`:f,onChange:e=>{l(e.target.value===`typed`),s(e.target.value)},children:[(0,H.jsx)(`option`,{value:`inherit`,children:n(`Same as live capture`)}),(0,H.jsx)(`option`,{value:`external`,disabled:h.length>0,children:n(`External API`)}),p.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:n(`Manual provider/model`)})]})})]}),m&&(0,H.jsx)(`input`,{"aria-label":`${Jd(e)} ${n(`Manual provider/model`)}`,className:`w-full rounded-[10px] border border-border bg-card p-2`,dir:`ltr`,placeholder:`provider/model`,value:f===`typed`?``:f,onChange:e=>s(e.target.value)}),h.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n(`External API needs`),`: `,h.join(`, `)]}),i[e]?.available===!1&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i[e].reason?n(i[e].reason):n(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:a||!r,onClick:()=>t.saveModel(e,f),children:n(`Save model`)})]}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!u.autoBackfill?.globalValue,disabled:a||!r,onChange:e=>void t.save({autoBackfill:e.target.checked})}),n(`Import past chats automatically`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`This switch applies to every host. Automatic import makes model calls.`)})]})}var Ax={pi:{kind:`default`},opencode:{kind:`default`},"claude-code":{kind:`default`}},jx=Ax,Mx=!1,Nx=new Set,Px=e=>{jx=e;for(let e of Nx)e()},Fx=e=>(Nx.add(e),()=>Nx.delete(e));async function Ix(e,t){let n=await Y(e,t);Px({...Ax,...n.hosts})}function Lx(){let e=(0,v.useSyncExternalStore)(Fx,()=>jx,()=>Ax);return(0,v.useEffect)(()=>{Mx||(Mx=!0,Ix(`/api/host-appearance`).catch(()=>{Mx=!1}))},[]),{looks:e,setIcon:(e,t)=>Ix(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`icon`,icon:t})}),setImage:(e,t)=>Ix(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`image`,png:t})}),reset:e=>Ix(`/api/host-appearance/${e}`,{method:`DELETE`})}}var Rx={anchor:j,atom:F,bird:I,"book-open":te,bot:L,braces:ne,brain:re,bug:R,cat:ie,cloud:pe,code:me,command:he,compass:ge,cpu:ve,database:ye,dog:be,feather:Ce,"file-code":we,fish:Te,flame:Ee,flower:De,folder:Ae,gem:je,ghost:Me,"git-branch":Ne,globe:Fe,hash:Ie,heart:Le,infinity:ze,key:Ve,layers:He,leaf:Ue,library:We,lightbulb:Ge,link:Ke,"message-square":Ze,moon:tt,mountain:nt,network:rt,orbit:ot,package:st,"pen-tool":dt,plug:gt,puzzle:yt,rocket:xt,server:Et,settings:Dt,shield:Ot,sparkles:kt,"square-terminal":jt,star:Mt,sun:Nt,target:Ft,terminal:It,"wand-sparkles":Ut,wrench:Gt,zap:qt},zx=Object.keys(Rx),Bx={pi:`Pi`,opencode:`OC`,"claude-code":`CC`};function Vx({host:e,look:t,className:n}){let r=V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border`,n);if(t.kind===`image`)return(0,H.jsx)(`span`,{className:V(r,`border-border bg-muted`),"aria-hidden":`true`,children:(0,H.jsx)(`img`,{src:t.image,alt:``,className:`size-full object-cover`})});let i=t.kind===`icon`?Rx[t.icon]:void 0,a=ed(e);return(0,H.jsx)(`span`,{className:V(r,`text-ui font-semibold [color:oklch(0.42_0.13_var(--host-hue))] dark:[color:oklch(0.8_0.13_var(--host-hue))]`),style:{backgroundColor:`oklch(0.72 0.14 ${a} / 0.18)`,borderColor:`oklch(0.72 0.14 ${a} / 0.45)`,"--host-hue":String(a)},"aria-hidden":`true`,children:i?(0,H.jsx)(i,{className:`size-5`}):Bx[e]})}function Hx({className:e,iconClassName:t=`size-5`}){return(0,H.jsx)(`span`,{"aria-hidden":`true`,className:V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border border-border bg-muted text-muted-foreground`,e),children:(0,H.jsx)(He,{className:t})})}function Ux({host:e,run:t,row:n}){let r=X(),i=Dx(t)?Cx(t):null,a=Ox(t),o=Ex(n,t),s=`${ld(e)}#host-unresolved`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[o.kind===`learning-profile`&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`All exchanges are done. Learning the profile from the imported prompts`),`:`,` `,o.done,` / `,o.total,` `,r(`batches`)]}),i&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i.percent,"aria-label":r(`Import progress`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${i.percent}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[i.percent,`% · `,i.done,` · `,r(`Minutes left`),`:`,` `,i.minutesLeft===`unknown`?r(`unknown`):i.minutesLeft.replace(`about`,r(`about`))]})]}),t?.state===`running`&&t.surface&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:r(`started from ${t.surface}`)}),a&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`Last run`),`: `,Yp(a.finishedAt),` · `,r(`started from ${a.surface}`),` `,`· `,r(a.state),` · `,r(`Imported`),`: `,a.imported,` · `,r(`Skipped`),`:`,` `,a.skipped,` · `,r(`Failed`),`: `,a.failed]}),n&&(0,H.jsxs)(`div`,{className:`space-y-1 text-muted-foreground`,children:[!a&&(0,H.jsxs)(`p`,{children:[r(`Imported`),`: `,n.counts.imported,` · `,r(`Skipped`),`: `,n.counts.skipped,` ·`,` `,r(`Failed`),`: `,n.counts.failed]}),(0,H.jsxs)(`p`,{children:[r(`Pending`),`: `,n.counts.pending,` · `,r(`Unresolved sessions`),`:`,` `,n.counts.unresolved,n.counts.unresolved>0&&(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`a`,{className:`underline focus-visible:outline-2 focus-visible:outline-ring`,href:s,"aria-label":`${Jd(e)}: ${r(`Resolve missing project folders`)}`,onClick:e=>{e.preventDefault(),gf(s)},children:r(`Resolve missing project folders`)})]})]}),(0,H.jsxs)(`p`,{children:[r(`Model`),`: `,(0,H.jsx)(`bdi`,{dir:`ltr`,children:n.model??r(`none`)})]}),(0,H.jsxs)(`p`,{children:[r(`Cutoff`),`: `,Yp(n.cutoff)]}),n.error&&(0,H.jsx)(`p`,{role:`alert`,children:n.error})]})]})}function Wx(e){let{run:t,runNowUnavailable:n}=e,r=n===null,i=n!==null&&e.host!==`claude-code`,a={text:`{reason}`,params:{reason:n??``}},o=(e,t,n,r=!0)=>({state:e,action:{kind:t,enabled:r},sentence:n,offerExternal:!1});if(!e.setUp)return o(`not-set-up`,`setup`,{text:`This host is not set up on this machine.`});if(t?.state===`running`){if(t.paused)return o(`running`,`pause`,{text:`Pausing after the current exchange.`},!1);let e=t.minutesLeft;return o(`running`,`pause`,{text:e===null?`Importing {done} / {total}.`:`Importing {done} / {total}. About {minutes} min left.`,params:{done:t.done,total:t.total,...e===null?{}:{minutes:e}}})}if(t?.paused)return{...o(`paused`,`resume`,r?{text:`Paused. Resume to continue.`}:a,r),offerExternal:i};if(t?.state===`failed`)return{...o(`failed`,`retry`,r?{text:`Stopped: {error}`,params:{error:t.error??`unknown error`}}:a,r),offerExternal:i};if(!r||t?.state===`stopped`&&e.pending>0)return{...o(`stopped`,`resume`,r?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:a,r),offerExternal:i};let s=t?.state===`done`&&t.total===0,c;return c=s&&e.cutoff!==null?{text:`Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.`,params:{date:e.formatDate(e.cutoff)}}:e.pending>0?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:{text:`Automatic import is on. Nothing is waiting.`},o(`running`,`pause`,c)}function Gx(e){let{run:t}=e;if(!e.setUp)return{text:`Not set up`};if(t?.state===`running`)return{text:`Importing · {percent}%`,params:{percent:t.percent}};if(t?.paused)return{text:`Paused · {pending} pending`,params:{pending:e.pending}};if(t?.state===`failed`)return{text:`Failed`};if(e.runNowUnavailable!==null||t?.state===`stopped`&&e.pending>0)return{text:`Stopped · {pending} pending`,params:{pending:e.pending}};let n=t?.updatedAt&&t.state===`done`?e.formatDate(t.updatedAt):null,r=e.lastSaved===null?null:e.formatSaved(e.lastSaved);return n&&r?{text:`Running · history imported {date} · last saved {when}`,params:{date:n,when:r}}:n?{text:`Running · history imported {date}`,params:{date:n}}:r?{text:`Running · last saved {when}`,params:{when:r}}:{text:`Running`}}function Kx(e,t){let n=e(t.text);return Object.entries(t.params??{}).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),n)}var qx={pi:`https://github.com/cmdaltctr/omms/blob/main/docs/pi-adapter.md`,opencode:`https://github.com/cmdaltctr/omms/blob/main/docs/opencode-adapter.md`,"claude-code":`https://github.com/cmdaltctr/omms/blob/main/docs/claude-code-adapter.md`},Jx={"not-set-up":`Not set up`,running:`Running`,paused:`Paused`,failed:`Failed`,stopped:`Stopped`};function Yx({host:e,statuses:t}){let n=X(),{looks:r}=Lx(),{backfill:i}=t,a=t.status(e),o=i.rows[e],s=i.runs?.[e]?.run??null,c=()=>{let t=a.action.kind;t===`pause`?i.control(e,`pause`):t===`resume`?i.control(e,`resume`):t===`retry`&&i.control(e,`run`)},l={setup:n(`How to set up`),pause:n(`Pause`),resume:n(`Resume`),retry:n(`Retry`)},u={pause:ut,resume:ht,retry:wt,setup:Se}[a.action.kind];return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":Jd(e),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Vx,{host:e,look:r[e]}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:Jd(e)}),(0,H.jsxs)(`p`,{className:V(`text-sm`,a.state===`failed`?`text-destructive-label`:`text-muted-foreground`),children:[n(`State`),`: `,n(Jx[a.state])]})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[a.action.kind===`setup`?(0,H.jsx)(G,{asChild:!0,variant:`outline`,children:(0,H.jsxs)(`a`,{href:qx[e],target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(Se,{"aria-hidden":`true`}),l.setup]})}):(0,H.jsxs)(G,{type:`button`,disabled:i.busy||!a.action.enabled,onClick:c,children:[(0,H.jsx)(u,{"aria-hidden":`true`}),l[a.action.kind]]}),a.offerExternal&&(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:i.busy,onClick:()=>i.saveModel(e,`external`),children:n(`Use external API`)})]}),(0,H.jsx)(`p`,{className:`break-words text-sm text-muted-foreground`,role:`status`,children:Kx(n,a.sentence)}),a.state!==`not-set-up`&&(0,H.jsx)(Ux,{host:e,run:s,row:o}),i.message&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i.message}),a.action.kind!==`setup`&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Importing makes model calls and can cost money.`)})]})}function Xx(e,t,n){let r=!n&&e!==null&&e.revision===t.revision;return{page:r?{...t,listedAt:e.listedAt}:t,sameListing:r}}function Zx(e,t){let n=0;return async r=>{let i=++n;try{let t=await r;i===n&&e(t)}catch(e){i===n&&t?.(e)}}}function Qx(e){let t=document.getElementById(`directory-maps-${e}`),n=t?.parentElement;if(!t||!n){typeof window<`u`&&window.location&&gf(`${J.memory}#directory-maps-${e}`);return}n.open=!0,t.focus({preventScroll:!0}),t.scrollIntoView?.(rf)}function $x({badge:e,host:t}){let n=X(),[r,i]=(()=>{switch(e.kind){case`imported`:return[`${n(`Imported`)} ✅`,`border-green-600/40 text-green-700`];case`partly`:return[`${n(`Partly imported`)} (${e.unresolved} ${n(`unresolved`)})`,`border-amber-500/50 text-amber-700`];case`running`:return[n(`Running`),`border-primary/50 text-primary`];case`learning-profile`:return[`${n(`Learning profile`)} ${e.done} / ${e.total}`,`border-primary/50 text-primary`];case`paused`:return[n(`Paused`),`border-border text-muted-foreground`];case`stopped`:return[`${n(`Stopped`)} (${e.pending} ${n(`pending`)})`,`border-amber-500/50 text-amber-700`];case`failed`:return[`${n(`Failed`)} ⛔️`,`border-red-600/40 text-red-700`];case`not-started`:return[n(`Not started`),`border-border text-muted-foreground`]}})(),a=V(`inline-block rounded-full border px-2 py-0.5 text-xs font-medium`,i);return e.kind===`partly`?(0,H.jsx)(`a`,{href:`/memory#directory-maps-${t}`,onClick:e=>{e.preventDefault(),Qx(t)},"aria-label":`${Jd(t)}: ${n(`Resolve missing project folders`)}. ${r}`,className:V(a,`underline focus-visible:outline-2 focus-visible:outline-ring`),children:r}):(0,H.jsx)(`span`,{className:a,title:e.kind===`failed`&&e.error?e.error:void 0,children:r})}var eS=[`pi`,`opencode`,`claude-code`];function tS(){let e=X(),[t,n]=(0,v.useState)({}),[r,i]=(0,v.useState)({});return(0,v.useEffect)(()=>{let e=Zx(n),t=Zx(i),r=()=>{e(Y(`/api/settings/backfill`)),t(Y(`/api/settings/backfill/runs`))};r();let a=setInterval(r,1e4),o=ey(r);return()=>{clearInterval(a),o()}},[]),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,"aria-label":e(`Import status`),children:eS.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:Jd(e)}),(0,H.jsx)($x,{host:e,badge:Ex(t[e]??null,r[e]?.run??null)})]},e))})}function nS(e){let t=X(),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),f=`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`;async function p(t){try{let n=await Y(`/api/settings/imports/sources/validate`,{method:`POST`,body:JSON.stringify({host:e.host,path:t})});a(n),r(n.displayPath),e.onChoose(n),d(``)}catch(e){d(e.message)}}async function m(t){try{let n=await Y(`/api/settings/imports/sources/browse`,{method:`POST`,body:JSON.stringify({host:e.host,...t?{path:t}:{}})});s(n),d(``)}catch(e){let t=e.message;/loopback/i.test(t)&&l(!0),d(t)}}function h(){a(null),r(``),s(null),e.onChoose(null)}return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[e.host===`pi`?t(`Pi sessions folder or one .jsonl session file`):e.host===`claude-code`?t(`Claude Code transcripts folder`):t(`OpenCode database file`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,dir:`ltr`,value:n,placeholder:t(`Absolute path, for example on a mounted volume`),onChange:e=>r(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:f,disabled:!n.trim(),onClick:()=>void p(n.trim()),children:t(`Use this source`)}),!c&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:()=>void m(o?.path),children:t(`Browse`)}),i&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:h,children:t(`Use the default location`)})]}),i&&(0,H.jsxs)(`p`,{role:`status`,children:[t(`Chosen source`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono break-all`,children:i.displayPath})]}),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),o&&(0,H.jsxs)(`div`,{className:`rounded border border-border p-2`,children:[(0,H.jsx)(`p`,{dir:`ltr`,className:`font-mono text-xs break-all`,children:o.path}),(0,H.jsxs)(`ul`,{className:`max-h-60 overflow-auto`,children:[o.parent&&(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(o.parent),children:`..`})}),o.entries.map(n=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2`,children:[n.kind===`folder`?(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(n.path),children:(0,H.jsxs)(`bdi`,{dir:`ltr`,children:[n.name,`/`]})}):(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono text-xs`,children:n.name}),(n.kind!==`folder`||e.host!==`opencode`)&&(0,H.jsx)(`button`,{type:`button`,className:`text-xs underline`,onClick:()=>void p(n.path),children:t(`Choose`)})]},n.path))]}),o.truncated&&(0,H.jsx)(`p`,{className:`text-xs`,children:t(`Only the first 500 entries are shown.`)})]})]})}function rS(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return t?[Number(t[1]),Number(t[2])-1,Number(t[3])]:null}function iS(e){let t=rS(e);return t?new Date(t[0],t[1],t[2],0,0,0,0).getTime():void 0}function aS(e){let t=rS(e);return t?new Date(t[0],t[1],t[2],23,59,59,999).getTime():void 0}var oS=[`pi`,`opencode`,`claude-code`],sS=()=>({mode:`ids`,picked:new Map});function cS(){let e=e=>({enabled:e,source:null,page:null,listedWith:``,selection:sS(),modelChoice:`external`});return{hosts:{pi:e(!0),opencode:e(!1),"claude-code":e(!1)},scope:`current-project`,project:``,maps:``,since:``,until:``,profileBatch:``,force:!1,memories:!0,profile:!0,skills:!0,showHandled:!1}}var lS=[`scope`,`project`,`memories`,`profile`,`skills`,`force`,`showHandled`];function uS(e,t){let n={...e,...t};if(lS.every(t=>n[t]===e[t]))return n;let r={...n.hosts};for(let e of oS)r[e]={...r[e],page:null,listedWith:``,selection:sS()};return{...n,hosts:r}}function dS(e,t){return JSON.stringify([e.hosts[t].source?.sourceToken,e.scope,e.project,e.maps,e.memories,e.profile,e.skills,e.force,e.showHandled])}function fS(e){return{skipMemories:e.skills||!e.memories,skipProfile:e.skills||!e.profile,force:e.force,includeHandled:e.showHandled||e.force,...e.skills&&!e.memories&&!e.profile?{skillTurnsOnly:!0}:{}}}function pS(e,t){let n=e.hosts[t].page;return n?n.total-(e.scope===`all-projects`?n.unresolvedCount:0):0}function mS(e,t){let n=e.hosts[t].selection;return n.mode===`all`?pS(e,t)-n.excluded.size:n.picked.size}function hS(e,t){if(!t.selectable||!t.directory)return e;if(e.mode===`all`){let n=new Set(e.excluded);return n.has(t.key)?n.delete(t.key):n.add(t.key),{mode:`all`,excluded:n}}let n=new Map(e.picked);return n.has(t.key)?n.delete(t.key):n.set(t.key,t.directory),{mode:`ids`,picked:n}}function gS(e){return e.split(`
127
- `).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.indexOf(`=`);if(t<1||t===e.length-1)throw Error(`Directory maps must be old=new, one per line`);return{from:e.slice(0,t),to:e.slice(t+1)}})}function _S(e){if(!e.memories&&!e.profile&&!e.skills)return`Choose at least one output.`;if(!oS.some(t=>e.hosts[t].enabled))return`Choose at least one host.`;try{gS(e.maps);let t=e.since?iS(e.since):void 0,n=e.until?aS(e.until):void 0;if(t!==void 0&&n!==void 0&&t>n)return`Prompt date from must not be after Prompt date to.`}catch(e){return e.message}return e.profileBatch&&(!Number.isInteger(Number(e.profileBatch))||Number(e.profileBatch)<1)?`Profile batch size must be a positive integer.`:null}function vS(e,t){let n=_S(e);if(n)throw Error(n);return{hosts:oS.filter(t=>e.hosts[t].enabled).map(t=>{let n=e.hosts[t];if(!n.page||n.listedWith!==dS(e,t))throw Error(`Options changed. Refresh the session list first.`);let r=n.selection;return{host:t,source:n.page.source.sourceToken,modelChoice:n.modelChoice||void 0,selection:r.mode===`all`||pS(e,t)===0?{mode:`all`,excludedKeys:r.mode===`all`?[...r.excluded]:[],revision:n.page.revision,listedAt:n.page.listedAt,...e.showHandled||e.force?{includeHandled:!0}:{}}:{mode:`ids`,sessions:[...r.picked].map(([e,t])=>({key:e,directory:t})),listedAt:n.page.listedAt}}}),options:{dryRun:t,force:e.force,skipMemories:!e.memories,skipProfile:!e.profile,skipSkills:!e.skills,scope:e.scope,...e.scope===`current-project`&&e.project?{project:e.project}:{},...e.since?{since:iS(e.since)}:{},...e.until?{until:aS(e.until)}:{},...e.profileBatch?{profileBatch:Number(e.profileBatch)}:{},pathMaps:gS(e.maps)}}}function yS(e){return JSON.stringify({...e,hosts:oS.filter(t=>e.hosts[t].enabled).map(t=>{let n=e.hosts[t];return{host:t,...n,selection:n.selection.mode===`all`?{mode:`all`,excluded:[...n.selection.excluded].sort()}:{mode:`ids`,picked:[...n.selection.picked].sort()}}})})}var bS=`${J.settings}#settings-section-skill-learning`,xS=`mt-1 block w-full min-w-0 rounded border border-border bg-background p-2`,SS=`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`;function CS({draft:e,skillRecording:t,advanced:n,onChange:r,onAdvanced:i}){let a=X();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-sm`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Project memories`),checked:e.memories,onChange:e=>r({memories:e.target.checked})}),` `,a(`Project memories`)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`User profile`),checked:e.profile,onChange:e=>r({profile:e.target.checked})}),` `,a(`User profile`),` `,a(`(preferences, patterns, and workflows)`)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Skill turns`),checked:t&&e.skills,disabled:!t,onChange:e=>r({skills:e.target.checked})}),` `,a(`Skill turns`)]})]}),!t&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a(`Skill turns are recorded only while Record agent turns is on.`),` `,(0,H.jsx)(`a`,{className:`underline`,href:bS,onClick:e=>{e.preventDefault(),gf(bS)},children:a(`Open the Skill learning card`)})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[a(`Scope`),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsxs)(Er,{"aria-label":a(`Scope`),className:xS,value:e.scope,onChange:e=>r({scope:e.target.value}),children:[(0,H.jsx)(`option`,{value:`current-project`,children:a(`Current project`)}),(0,H.jsx)(`option`,{value:`all-projects`,children:a(`All projects`)})]})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Show handled sessions`),checked:e.showHandled,onChange:e=>r({showHandled:e.target.checked})}),` `,a(`Show handled sessions`)]}),(0,H.jsx)(`button`,{type:`button`,className:SS,onClick:i,"aria-expanded":n,children:a(n?`Hide advanced options`:`Advanced options`)}),(0,H.jsxs)(`div`,{hidden:!n,className:`space-y-3 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e.scope===`current-project`&&(0,H.jsxs)(`label`,{className:`text-sm`,children:[a(`Project directory`),(0,H.jsx)(`input`,{"aria-label":a(`Project directory`),className:`mt-1 block w-full min-w-0 rounded border border-border bg-background p-2`,dir:`ltr`,value:e.project,placeholder:a(`Current directory`),onChange:e=>r({project:e.target.value})})]}),[[`Prompt date from`,`since`],[`Prompt date to`,`until`],[`Profile batch size`,`profileBatch`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`text-sm`,children:[a(t),(0,H.jsx)(`input`,{"aria-label":a(t),type:n===`profileBatch`?`text`:`date`,inputMode:n===`profileBatch`?`numeric`:void 0,className:xS,value:e[n],onChange:e=>r({[n]:e.target.value})})]},n))]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`Prompt dates are inclusive, use your time zone, and filter the turns inside each session, not the list. Empty dates include every turn.`)}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[a(`Directory maps (old=new, one per line)`),(0,H.jsx)(`textarea`,{"aria-label":a(`Directory maps (old=new, one per line)`),dir:`ltr`,className:xS,rows:2,value:e.maps,onChange:e=>r({maps:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Re-analyse handled history`),checked:e.force,onChange:e=>r({force:e.target.checked})}),` `,a(`Re-analyse handled history`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`Re-analysis applies to the selected outputs. Each profile prompt can be forcibly re-analysed once. Findings merge into the existing profile.`)})]})]})}function wS({host:e,draft:t,readiness:n,advanced:r,listing:i,onChange:a,onList:o,onUnresolved:s}){let c=X(),l=t.hosts[e],u=l.page,d=u&&l.listedWith!==dS(t,e),f=pS(t,e),p=e=>l.selection.mode===`all`?!l.selection.excluded.has(e.key):l.selection.picked.has(e.key),m={recorded:c(`recorded`),mapped:c(`mapped`),worktree:c(`project root`),unresolved:c(`missing`)},h=e===`pi`&&n?.piReader.available===!1;return(0,H.jsxs)(`section`,{hidden:!l.enabled,"aria-label":Jd(e),className:`space-y-3 rounded-lg border border-border p-3 min-w-0`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Jd(e)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Source`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`break-all`,children:l.source?.displayPath??u?.source.displayPath??c(`default location`)})]}),h&&(0,H.jsx)(`p`,{role:`alert`,children:c(n?.piReader.reason??`Pi session reader is unavailable. Fix the reader or deselect Pi.`)}),e===`claude-code`&&n?.claudeCode&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Claude Code transcripts`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono break-all`,children:n.claudeCode.defaultRoot}),` `,`(`,c(n.claudeCode.defaultRootFound?`found`:`not found`),`).`,` `,c(`Claude Code imports always use the external API.`)]}),(0,H.jsx)(`div`,{hidden:!r,children:(0,H.jsx)(nS,{host:e,onChoose:e=>a({source:e})})}),(0,H.jsx)(`button`,{type:`button`,className:SS,disabled:i||h,onClick:()=>o(0,!0),children:c(u?`Refresh list`:`List sessions`)}),d&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:c(`Options changed. Refresh the session list first.`)}),u&&t.scope===`current-project`&&u.unresolvedCount>0&&(0,H.jsxs)(`p`,{className:`text-sm`,children:[c(`Sessions with directories that no longer exist`),`: `,u.unresolvedCount,`.`,` `,(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:s,children:c(`Show them and add a directory map`)})]}),u&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsxs)(`span`,{role:`status`,children:[c(`Selected`),`: `,mS(t,e),` / `,f]}),(0,H.jsxs)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:f===0,onClick:()=>a({selection:{mode:`all`,excluded:new Set}}),children:[c(`Select all matching`),` (`,f,`)`]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,onClick:()=>a({selection:sS()}),children:c(`Clear selection`)})]}),(0,H.jsxs)(`div`,{className:`max-w-full overflow-x-auto`,children:[(0,H.jsxs)(`table`,{className:`w-full text-start text-sm`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{className:`text-muted-foreground`,children:[`Select`,`Created`,`Session`,`Project directory`,`Resolved by`].map(e=>(0,H.jsx)(`th`,{className:`p-1`,children:c(e)},e))})}),(0,H.jsx)(`tbody`,{children:u.rows.map(t=>(0,H.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,H.jsx)(`td`,{className:`p-1`,children:(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":`${Jd(e)}: ${c(`Select`)} ${t.sessionId??t.key}`,checked:t.selectable&&p(t),disabled:!t.selectable,onChange:()=>a({selection:hS(l.selection,t)})})}),(0,H.jsx)(`td`,{className:`p-1 whitespace-nowrap`,children:t.createdAt?Yp(t.createdAt):`—`}),(0,H.jsxs)(`td`,{className:`p-1 font-mono text-xs`,children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:t.sessionId??t.key}),t.handled&&(0,H.jsx)(`span`,{className:`ms-2 rounded border border-border px-1 font-sans text-muted-foreground`,children:c(`Handled`)})]}),(0,H.jsx)(`td`,{className:`p-1 font-mono text-xs break-all`,children:(0,H.jsx)(`bdi`,{dir:`ltr`,children:t.directory??t.recordedDirectory??`—`})}),(0,H.jsx)(`td`,{className:`p-1`,children:m[t.via]})]},t.key))})]}),u.total===0&&(0,H.jsx)(`p`,{className:`text-sm`,children:c(`No sessions match.`)}),(u.hiddenHandled??0)>0&&(0,H.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[c(`Handled sessions hidden`),`: `,u.hiddenHandled]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:i||u.offset===0,onClick:()=>o(Math.max(0,u.offset-50),!1),children:c(`Previous`)}),(0,H.jsxs)(`span`,{children:[u.total?u.offset+1:0,`–`,Math.min(u.offset+50,u.total),` /`,` `,u.total]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:i||u.offset+50>=u.total,onClick:()=>o(u.offset+50,!1),children:c(`Next`)})]})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[c(`Import model`),(0,H.jsx)(`div`,{dir:`ltr`,children:(0,H.jsxs)(Er,{"aria-label":c(`Import model`),className:xS,value:l.modelChoice,onChange:e=>a({modelChoice:e.target.value}),children:[(0,H.jsx)(`option`,{value:``,children:c(`None`)}),e!==`claude-code`&&n?.opencode.models.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsxs)(`option`,{value:`external`,children:[c(`Saved external API`),n&&n.external.state!==`ready`?` (${c(`not ready`)})`:``]})]})})]}),e!==`claude-code`&&n&&!n.opencode.available&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`Configured, not tested.`)})]})}var TS=`omms-memory-import-hosts`;function ES(e,t){try{let n=t??localStorage,r=oS.filter(t=>e.hosts[t].enabled);n.setItem(TS,JSON.stringify({hosts:r,scope:e.scope,skills:e.skills}))}catch{}}function DS(e,t){try{let n=t??localStorage,r=JSON.parse(n.getItem(`omms-memory-import-hosts`)??`null`);if(!r||typeof r!=`object`)return e;let{hosts:i,scope:a,skills:o}=r;return Array.isArray(i)&&i.length>0&&i.every(e=>oS.includes(e))&&(a===`current-project`||a===`all-projects`)?{...e,scope:a,skills:typeof o==`boolean`?o:e.skills,hosts:Object.fromEntries(oS.map(t=>[t,{...e.hosts[t],enabled:i.includes(t)}]))}:e}catch{return e}}var OS={"missing-model":`The external API has no memoryModel in the global config`,"missing-url":`The external API has no memoryApiUrl in the global config`,"missing-key":`The external API key is missing in the OpenCode process; check memoryApiKey and its env:// or file:// source`,"unsupported-provider":`The memoryProvider in the global config is not supported for imports`};function kS(e,t,n,r){return!t.memories&&!t.profile?null:e.map(e=>{let i=t.hosts[e].modelChoice,a=null;return n?i?i===`external`&&n.external.state!==`ready`?a=OS[n.external.state]??`The external API is not ready`:e===`claude-code`&&i!==`external`?a=`Claude Code imports use the external API. Complete the external API settings.`:i!==`external`&&!n.opencode.models.some(e=>`${e.provider}/${e.model}`===i)&&(a=`No import model is ready. Connect a model in OpenCode or complete the external API settings.`):a=`No import model is ready. Connect a model in OpenCode or complete the external API settings.`:a=`Model readiness is unknown. Reload the page.`,a?`${Jd(e)}: ${r(a)}`:null}).find(Boolean)??null}var AS=[`running`,`cancelling`],jS=[`done`,`failed`,`cancelled`];function MS(e){if(!e||e.dryRun||!AS.includes(e.state))return null;let t=e.hosts?.find(e=>e.state===`running`);if(!t)return null;let n=t.phase===`profile`,r=(n?t.profileProcessed:t.processed)??0,i=(n?t.profileTotal:t.total)??0;return{host:t.host,phase:n?`profile`:t.phase===`skill-turns`?`skill-turns`:`memory`,done:r,total:i,percent:i>0?Math.min(100,Math.floor(r*100/i)):0}}function NS(e,t,n){return!t||t.dryRun||!jS.includes(t.state)||t.state===`cancelled`||t.id===n?`none`:e?e.id===t.id&&jS.includes(e.state)?`none`:`dialog`:`banner`}function PS(e){return e?e.hosts?.length?e.hosts.reduce((e,t)=>e+(t.summary?.unitsFailed??0),0):e.summary?.unitsFailed??0:0}function FS(e){return e.hosts?.find(e=>e.error)?.error??e.error}var IS=`Could not reload the settings. Reload the page.`;async function LS(e,t){let[n]=await Promise.all([e(),t().catch(()=>{})]);return n===null?IS:null}var RS=`omms.import.dismissedEnd`;function zS(){try{return window.localStorage.getItem(RS)}catch{return null}}function BS(e){try{window.localStorage.setItem(RS,e)}catch{}}function VS(e,t){let n=e.summary,r=n?.profile;return[[`sessions`,e.sessions],[`Memory units`,n?.unitsTotal??e.total],[`Pending memory units`,n?.unitsWouldImport],[`Imported memory units`,n?.unitsImported],[`Already handled memory units`,n?.unitsAlreadyHandled],[`Skipped memory units`,n?.unitsSkipped],[`Failed memory units`,n?.unitsFailed],[`Held-back turns`,n?.unitsHeldBack],[`Untimed turns`,n?.unitsUntimed],[`Skill turns to record`,n?.skillTurnsWouldRecord],[`Skill turns already recorded`,n?.skillTurnsAlreadyRecorded],[`Skill turns recorded`,n?.skillTurnsRecorded],[`Skill turns already present`,n?.skillTurnsAlreadyPresent],[`Load errors`,n?.loadErrors],[`Profile prompts`,r?r.promptsRecorded+r.promptsWouldRecord:void 0],[`Already handled profile prompts`,r?.promptsAlreadyHandled],[`Profile batches`,r?.batchesBuilt],[`Estimated profile analysis calls`,e.profileEstimate?.analysisCalls],[`Waiting prompts inside OMMS`,e.profileEstimate?.waitingPrompts],[`Unresolved sessions`,n?.unresolved]].filter(([,e])=>e!==void 0).map(([e,n])=>`${t(String(e))}: ${n}`).join(` · `)}function HS(e,t){let n=e.match(/^(Pi|OpenCode|Claude Code): /),r=n?e.slice(n[0].length):e,i=`Refresh the preview and retry.`,a=r.endsWith(` ${i}`),o=a?r.slice(0,-31):r,s=a&&/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*\.$/.test(o),c=t(o);return(0,H.jsxs)(H.Fragment,{children:[n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:n[1]}),`: `]}),s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:o.slice(0,-1)}),`.`]}):c===o?(0,H.jsx)(`bdi`,{dir:`ltr`,children:o}):c.split(/(Pi|OpenCode|Claude Code)/).map((e,t)=>/^(Pi|OpenCode|Claude Code)$/.test(e)?(0,H.jsx)(`bdi`,{dir:`ltr`,children:e},t):e),a&&(0,H.jsxs)(H.Fragment,{children:[` `,t(i)]})]})}function US({job:e}){let t=X();if(!e)return null;let n=e.hosts??(e.host?[{...e,host:e.host}]:[]);return(0,H.jsxs)(`div`,{role:`status`,className:`space-y-3 text-sm`,"aria-label":t(`Import results`),children:[(0,H.jsxs)(`p`,{children:[t(e.dryRun?`Preview (dry run)`:`Import`),` · `,t(e.state),e.activeHost&&(0,H.jsxs)(H.Fragment,{children:[` `,`· `,t(`Current host`),`: `,Jd(e.activeHost)]})]}),(0,H.jsxs)(`p`,{children:[t(`Combined counts`),`: `,VS(e,t)]}),(0,H.jsx)(`ul`,{className:`space-y-2`,children:n.map(e=>(0,H.jsxs)(`li`,{className:`rounded border border-border p-2`,children:[(0,H.jsxs)(`p`,{children:[Jd(e.host),` ·`,` `,t(e.state===`no-work`?`No work to process`:e.state),e.phase&&(0,H.jsxs)(H.Fragment,{children:[` `,`·`,` `,t(e.phase===`profile`?`Learning profile`:e.phase===`preparing`?`preparing`:e.phase===`skill-turns`?`Skill turns`:`Memory extraction`)]})]}),e.phase===`profile`?(0,H.jsxs)(`p`,{children:[t(`Profile batches`),`: `,e.profileProcessed??0,`/`,e.profileTotal??0]}):(e.phase===`memory`||e.phase===`skill-turns`)&&e.total!==void 0&&(0,H.jsxs)(`p`,{children:[t(e.phase===`skill-turns`?`Skill turns`:`Memory units`),`:`,` `,e.processed??0,`/`,e.total]}),(0,H.jsx)(`p`,{children:VS(e,t)}),(e.error||e.blocker)&&(0,H.jsx)(`p`,{role:`alert`,children:HS(e.error??e.blocker,t)}),e.report&&(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:e.report})]},e.host))}),e.error&&(0,H.jsx)(`p`,{role:`alert`,children:HS(e.error,t)}),e.report&&(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:e.report}),e.dryRun&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.`)})]})}function WS({job:e}){let t=X(),n=e.state===`failed`,r=FS(e),i=PS(e);return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[n&&r&&(0,H.jsx)(`p`,{role:`alert`,children:HS(r,t)}),i>0&&(0,H.jsxs)(`p`,{children:[t(`Failed memory units`),`: `,i]}),!n&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:VS({summary:{unitsImported:e.summary?.unitsImported,unitsFailed:e.summary?.unitsFailed??0}},t)})]})}function GS({job:e,onReload:t}){let n=X(),r=(0,v.useRef)(null),[i,a]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!e)return;let t=NS(r.current,e,zS());r.current=e,t!==`none`&&a({job:e,view:t})},[e]);let o=()=>{i&&BS(i.job.id),a(null)},s=i?n(i.job.state===`failed`?`Import failed`:`Import successful 🎉`):``;return(0,H.jsxs)(H.Fragment,{children:[e?.state===`cancelled`&&!e.dryRun&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:n(`Import cancelled`)}),i?.view===`banner`&&(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-start justify-between gap-2 rounded-lg border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-semibold`,children:s}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`The import finished while you were away.`)}),(0,H.jsx)(WS,{job:i.job})]}),(0,H.jsx)(G,{variant:`outline`,size:`sm`,onClick:o,children:n(`Dismiss`)})]}),(0,H.jsx)(K,{open:i?.view===`dialog`,onOpenChange:e=>{e||(o(),t())},children:(0,H.jsxs)(q,{showCloseButton:!1,className:i?.job.state===`failed`?`border-destructive/40`:void 0,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:s}),(0,H.jsx)(Wl,{className:`sr-only`,children:s})]}),i&&(0,H.jsx)(WS,{job:i.job}),(0,H.jsx)(Hl,{children:(0,H.jsx)(G,{autoFocus:!0,onClick:()=>{o(),t()},children:n(`OK`)})})]})})]})}var KS={memory:`Memory units`,"skill-turns":`Skill turns`,profile:`Profile batches`};function qS({job:e}){let t=X(),n=MS(e);return n?(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n.percent,"aria-label":t(`Import progress`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-green-600`,style:{width:`${n.percent}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:Jd(n.host)}),` · `,t(KS[n.phase]),`: `,n.done,` /`,` `,n.total,` · `,n.percent,`%`]})]}):null}var JS=[`queued`,`preparing`,`running`,`cancelling`];function YS(e){return e&&JS.includes(e.state)?e:null}function XS(e,t){if(!e||!t)return e;if(!e.hosts)return e.host===t?e:null;let n=e.hosts.find(e=>e.host===t);if(!n)return null;if(e.hosts.length===1)return e;let r=e.hosts.some(e=>e.state===`failed`||e.error);return{...e,state:n.state,activeHost:e.activeHost===t?t:null,error:n.error??(r?void 0:e.error),sessions:n.sessions,processed:n.processed,total:n.total,summary:n.summary,profileEstimate:n.profileEstimate,hosts:[n]}}function ZS(e){return ey(()=>e())}function QS({profilePreset:e=0,host:t}={}){let n=X(),[r,i]=(0,v.useState)(()=>{let e=cS();if(!t)return DS(e);for(let n of oS)e.hosts[n].enabled=n===t;return e}),{snapshot:a}=rx(),o=a?.settings?.skillLearning?.value===!0,s=e=>o?e:{...e,skills:!1},c=s(r),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)({}),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(``),w=(0,v.useRef)(!1),T=(0,v.useRef)({pi:0,opencode:0,"claude-code":0}),E=(0,v.useRef)(!0),D=(0,v.useRef)(ny()),O=yS(c),k=(0,v.useRef)(O);k.current=O;let A=XS(p,t),j=oS.filter(e=>c.hosts[e].enabled),M=t?[t]:oS,N=(0,v.useRef)(r.skills);(0,v.useEffect)(()=>{t||ES({...r,skills:N.current})},[r,t]);let P=p?.state===`running`||p?.state===`cancelling`||p?.state===`preparing`||p?.state===`queued`;function ee(e=!1){let t=D.current.begin();return Y(`/api/settings/imports/current`).then(n=>{E.current&&t()&&m(e?YS(n.job):n.job)})}(0,v.useEffect)(()=>{E.current=!0;let e=()=>{g(null),Y(`/api/settings/imports/readiness`).then(e=>{E.current&&f(e)}).catch(()=>{E.current&&f(null)})};e(),ee(!0).catch(()=>{});let t=ZS(e);return()=>{E.current=!1,t()}},[]);function F(){LS($v,ee).then(e=>{E.current&&e&&C(e)})}(0,v.useEffect)(()=>{if(!P)return;let e=setInterval(()=>{w.current||ee().catch(e=>{E.current&&C(e.message)})},1e3);return()=>clearInterval(e)},[P]),(0,v.useEffect)(()=>{e&&(i(e=>uS(e,{memories:!1,profile:!0,skills:!1,force:!0})),g(null))},[e]);function I(e){e.skills!==void 0&&(N.current=e.skills),g(null),i(t=>uS(t,e))}function te(e,t){g(null),i(n=>({...n,hosts:{...n.hosts,[e]:{...n.hosts[e],...t}}}))}async function L(e,t,n){let r=++T.current[e],a=dS(c,e);g(null),y(t=>({...t,[e]:!0}));try{let o=await Y(`/api/settings/imports/sessions`,{method:`POST`,body:JSON.stringify({host:e,...c.hosts[e].source?{source:c.hosts[e].source.sourceToken}:{},scope:c.scope,...c.scope===`current-project`&&c.project?{project:c.project}:{},pathMaps:gS(c.maps),offset:t,limit:50,refresh:n,...fS(c)})});if(!E.current||T.current[e]!==r)return;i(t=>{if(dS(s(t),e)!==a)return t;let r=t.hosts[e],i=Xx(r.page,o,n);return{...t,hosts:{...t.hosts,[e]:{...r,page:i.page,listedWith:a,selection:i.sameListing?r.selection:sS()}}}}),C(``)}catch(t){E.current&&T.current[e]===r&&C(t.message)}finally{E.current&&T.current[e]===r&&y(t=>({...t,[e]:!1}))}}let ne=_S(c),re=j.some(e=>e===`pi`&&d?.piReader.available===!1),R=j.map(e=>{let t=c.hosts[e];return t.page?t.listedWith===dS(c,e)?pS(c,e)>0&&mS(c,e)===0?`${Jd(e)}: ${n(`Select at least one session.`)}`:t.selection.mode===`ids`&&t.selection.picked.size>1e3?`${Jd(e)}: ${n(`Select at most 1000 sessions one by one, or use Select all matching.`)}`:null:`${Jd(e)}: ${n(`Options changed. Refresh the session list first.`)}`:`${Jd(e)}: ${n(`List sessions first.`)}`}).find(Boolean),ie=kS(j,c,d,n),ae=!!(h&&h.fingerprint===O&&h.id===p?.id&&p.dryRun&&p.state===`done`&&!p.error&&!p.hosts?.some(e=>e.error||e.blocker||[`failed`,`cancelled`,`not-run`].includes(e.state))),oe=b||P||j.some(e=>_[e])||re||!!(ne||R);async function se(e){if(w.current||oe||!e&&(!ae||ie))return;if(!e){let e=[c.memories&&n(`Project memories`),c.profile&&n(`User profile`),c.skills&&n(`Skill turns`)].filter(Boolean).join(` · `),t=j.map(e=>`${Jd(e)}: ${c.hosts[e].modelChoice===`external`?`${n(`Saved external API`)} (${d?.external.provider}/${d?.external.model})`:c.hosts[e].modelChoice}`).join(`
128
- `);if((c.memories||c.profile)&&!window.confirm([n(`This import makes model calls. Continue?`),j.map(Jd).join(` · `),n(c.scope===`current-project`?`Current project`:`All projects`),c.project,e,t,VS(p??{},n),...(p?.hosts??[]).map(e=>`${Jd(e.host)}: ${VS(e,n)}`)].filter(Boolean).join(`
129
- `)))return}w.current=!0,D.current.begin(),x(!0);let t=O;g(null);try{let n=await Y(`/api/settings/imports`,{method:`POST`,body:JSON.stringify(vS(c,e))});if(!E.current)return;m(n),e&&t===k.current&&g({id:n.id,fingerprint:t}),C(``)}catch(e){E.current&&C(e.message),ee().catch(()=>{})}finally{w.current=!1,E.current&&x(!1)}}async function ce(){if(!w.current){w.current=!0,D.current.begin();try{let e=await Y(`/api/settings/imports/current/cancel`,{method:`POST`,body:`{}`});E.current&&m(e.job)}catch(e){E.current&&C(e.message)}finally{w.current=!1}}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4 min-w-0`,"aria-label":n(t?`Sessions`:`Import chat history`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:n(t?`Sessions`:`Import chat history`)}),!t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.`)}),(0,H.jsxs)(`p`,{className:`flex flex-wrap gap-3 text-sm`,children:[(0,H.jsx)(`a`,{className:`underline`,href:J.project,onClick:e=>{e.preventDefault(),gf(J.project)},children:n(`Project memories`)}),(0,H.jsx)(`a`,{className:`underline`,href:J.profile,onClick:e=>{e.preventDefault(),gf(J.profile)},children:n(`User profile`)}),(0,H.jsx)(`a`,{className:`underline`,href:`${J.settings}#settings-section-profiles`,onClick:e=>{e.preventDefault(),gf(`${J.settings}#settings-section-profiles`)},children:n(`Profile identity in Settings`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Hosts keep their existing user identities. All hosts does not merge profiles with different identities.`)}),(0,H.jsx)(tS,{}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[oS.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":Jd(e),checked:c.hosts[e].enabled,onChange:t=>te(e,{enabled:t.target.checked})}),` `,Jd(e)]},e)),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,onClick:()=>I({hosts:{pi:{...c.hosts.pi,enabled:!0},opencode:{...c.hosts.opencode,enabled:!0},"claude-code":{...c.hosts[`claude-code`],enabled:!0}}}),children:n(`All hosts`)}),(0,H.jsxs)(`span`,{role:`status`,children:[n(`Selected hosts`),`: `,j.length]})]})]}),(0,H.jsx)(CS,{draft:c,skillRecording:o,advanced:l,onChange:I,onAdvanced:()=>u(e=>!e)}),M.map(e=>(0,H.jsx)(wS,{host:e,draft:c,readiness:d,advanced:l,listing:!!_[e],onChange:t=>te(e,t),onList:(t,n)=>L(e,t,n),onUnresolved:()=>{I({scope:`all-projects`}),u(!0)}},e)),ne&&(0,H.jsx)(`p`,{role:`alert`,children:n(ne)}),!P&&(R||ie)&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:R??ie}),!ae&&!P&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Preview the current selection before starting an import.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:SS,disabled:oe,onClick:()=>se(!0),children:n(`Preview (dry run)`)}),(0,H.jsx)(`button`,{type:`button`,className:SS,disabled:oe||!ae||!!ie,onClick:()=>se(!1),children:n(`Start import`)}),P&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:p?.state===`cancelling`,onClick:()=>ce(),children:n(`Cancel after current unit`)})]}),S&&(0,H.jsx)(`p`,{role:`alert`,children:HS(S,n)}),(0,H.jsx)(qS,{job:A}),(0,H.jsx)(GS,{job:A,onReload:F}),(0,H.jsx)(US,{job:A})]})}var $S=3e5,eC=null,tC,nC=new Set,rC=new Set;async function iC(e){try{eC=await Y(`/api/memory/write-health${e?`?fresh=1`:``}`)}catch{}for(let e of[...nC,...rC])e()}function aC(e){return nC.add(e),nC.size===1&&(iC(!1),tC=setInterval(()=>{document.hidden||iC(!1)},$S)),()=>{nC.delete(e),nC.size===0&&clearInterval(tC)}}function oC(){return{health:(0,v.useSyncExternalStore)(aC,()=>eC,()=>null),recheck:()=>iC(!0)}}function sC(e){return rC.add(e),()=>rC.delete(e)}function cC(){return(0,v.useSyncExternalStore)(sC,()=>eC,()=>null)}function lC(e){let t=(t,...n)=>n.every((n,r)=>e[t+r]===n);return t(0,137,80,78,71,13,10,26,10)?`png`:t(0,255,216,255)?`jpeg`:t(0,71,73,70,56)?`gif`:t(0,82,73,70,70)&&t(8,87,69,66,80)?`webp`:null}async function uC(e){return e.size>20971520?`size`:lC(new Uint8Array(await e.slice(0,16).arrayBuffer()))?null:`type`}function dC(e,t){let n=Math.min(e,t);return{x:Math.floor((e-n)/2),y:Math.floor((t-n)/2),side:n}}async function fC(e){let t=await createImageBitmap(e);try{let{x:e,y:n,side:r}=dC(t.width,t.height),i=document.createElement(`canvas`);i.width=128,i.height=128;let a=i.getContext(`2d`);if(!a)throw Error(`This browser cannot draw the image`);a.imageSmoothingQuality=`high`,a.drawImage(t,e,n,r,r,0,0,128,128);let o=await new Promise(e=>i.toBlob(e,`image/png`));if(!o)throw Error(`This browser cannot save the image`);let s=new Uint8Array(await o.arrayBuffer()),c=``;for(let e of s)c+=String.fromCharCode(e);return btoa(c)}finally{t.close()}}function pC({host:e,onClose:t}){let n=X(),{looks:r,setIcon:i,setImage:a,reset:o}=Lx(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),h=s===null?r[e]:`reset`in s?{kind:`default`}:s.look,g=zx.filter(e=>e.includes(l.trim().toLowerCase()));async function _(e){if(!e)return;f(``);let t=await uC(e);if(t){f(n(t===`size`?`The image is larger than 20 MB.`:`Only PNG, JPEG, WebP and GIF images are accepted.`));return}try{let t=await fC(e);c({look:{kind:`image`,image:`data:image/png;base64,${t}`},png:t})}catch{f(n(`This browser could not read the image.`))}}async function y(){if(s===null)return t();m(!0);try{`reset`in s?await o(e):s.look.kind===`icon`?await i(e,s.look.icon):s.png&&await a(e,s.png),t()}catch(e){f(e.message),m(!1)}}return(0,H.jsx)(K,{open:!0,onOpenChange:e=>!e&&!p&&t(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:`${n(`Change icon`)}: ${Jd(e)}`}),(0,H.jsx)(Wl,{children:n(`Every avatar is shown at the same size. Images are cropped to a square.`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Vx,{host:e,look:h}),(0,H.jsxs)(`label`,{className:`inline-flex`,children:[(0,H.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,className:`sr-only peer`,onChange:e=>void _(e.target.files?.[0])}),(0,H.jsxs)(`span`,{className:`inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-[9px] border border-border px-3 text-ui font-medium hover:bg-interactive-hover peer-focus-visible:outline-2 peer-focus-visible:outline-ring`,children:[(0,H.jsx)(Re,{className:`size-4`,"aria-hidden":`true`}),n(`Upload image`)]})]}),(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c({reset:!0}),children:[(0,H.jsx)(Ct,{"aria-hidden":`true`}),n(`Reset to default`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`PNG, JPEG, WebP or GIF, up to 20 MB.`)}),(0,H.jsx)(id,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":n(`Search icons`),placeholder:n(`Search icons`)}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":n(`Choose icon`),className:`grid max-h-48 grid-cols-6 gap-1 overflow-y-auto sm:grid-cols-8`,children:[g.map(e=>{let t=Rx[e],n=h.kind===`icon`&&h.icon===e;return(0,H.jsx)(`button`,{type:`button`,title:e,"aria-label":e,"aria-pressed":n,onClick:()=>c({look:{kind:`icon`,icon:e}}),className:V(`grid size-10 place-items-center rounded-[9px] border border-transparent text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,n&&`border-primary bg-primary/10 text-primary-label`),children:(0,H.jsx)(t,{className:`size-5`,"aria-hidden":`true`})},e)}),g.length===0&&(0,H.jsx)(`p`,{className:`col-span-full text-sm text-muted-foreground`,children:n(`No icon matches.`)})]}),d&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:d}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,onClick:t,disabled:p,children:n(`Cancel`)}),(0,H.jsx)(G,{type:`button`,onClick:()=>void y(),disabled:p||s===null,children:n(`Save`)})]})]})})}function mC({view:e,line:t,warning:n,notSetUp:r,current:i,compact:a}){let o=X(),{looks:s}=Lx(),[c,l]=(0,v.useState)(!1),u=e===`shared`?null:e,d=u?Jd(u):o(`Shared`),f=ld(e),p=u?(0,H.jsx)(Vx,{host:u,look:s[u],className:a?`size-8`:void 0}):(0,H.jsx)(Hx,{className:a?`size-8`:void 0});return(0,H.jsxs)(`div`,{className:`relative h-full min-w-0`,children:[(0,H.jsxs)(`a`,{href:f,"aria-current":i?`page`:void 0,onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||(e.preventDefault(),gf(f))},className:V(`flex h-full min-w-0 flex-col gap-3 rounded-xl border bg-card p-4 text-start transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,a&&`flex-row items-center gap-2 p-2 pe-10`,n?`border-[var(--status-warning)]`:`border-border`,i&&`bg-sidebar-accent`,r&&`opacity-70`),children:[p,(0,H.jsxs)(`span`,{className:`min-w-0 space-y-1`,children:[(0,H.jsx)(`span`,{className:`block break-words text-subsection-title font-semibold`,children:d}),(0,H.jsx)(`span`,{className:`block break-words text-xs text-muted-foreground`,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium text-status-warning`,children:o(`Memories not saved`)}),!a&&(0,H.jsx)(`span`,{className:`block`,children:n})]}):t})]})]}),u&&(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:a?`icon-xs`:`icon-sm`,className:`absolute end-2 top-2`,"aria-label":`${o(`Change icon`)}: ${d}`,title:o(`Change icon`),onClick:()=>l(!0),children:(0,H.jsx)(pt,{"aria-hidden":`true`})}),c&&u&&(0,H.jsx)(pC,{host:u,onClose:()=>l(!1)})]})}function hC({current:e,statuses:t}){let n=X(),{health:r}=oC(),i=r&&!r.ok?r.reason??``:null;return(0,H.jsx)(`nav`,{"aria-label":n(`Memory views`),children:(0,H.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 lg:grid-cols-4`,children:cd.map(r=>{let a=r===`shared`?null:r,o=a?t.line(a):{text:`Every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(mC,{compact:!0,view:r,current:r===e,line:Kx(n,o),warning:a&&t.input(a).setUp?i:null,notSetUp:a?!t.input(a).setUp:!1})},r)})})})}function gC({reason:e,checking:t,onCheck:n}){let r=X();return(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-[var(--status-warning)] bg-card p-3 text-sm`,children:[(0,H.jsx)(zt,{className:`size-4 shrink-0 text-status-warning`,"aria-hidden":`true`}),(0,H.jsxs)(`p`,{className:`min-w-0 flex-1 break-words`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:r(`Memories are not being saved.`)}),` `,e?/[.!?]$/.test(e)?e:`${e}.`:``,` `,r(`Fix the service named here, then press Check again.`)]}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:t,onClick:n,children:r(`Check again`)})]})}function _C(){let{health:e,recheck:t}=oC(),[n,r]=(0,v.useState)(!1);return!e||e.ok?null:(0,H.jsx)(gC,{reason:e.reason,checking:n,onCheck:()=>{r(!0),t().finally(()=>r(!1))}})}function vC({host:e,statuses:t,profilePreset:n}){let r=X(),i=!t.input(e).setUp;return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(hC,{current:e,statuses:t}),(0,H.jsx)(_C,{}),(0,H.jsx)(Yx,{host:e,statuses:t}),i?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`${Jd(e)}: ${r(`OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.`)}`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(QS,{host:e,profilePreset:n}),(0,H.jsx)(Sx,{hosts:[e],saved:!1,title:`Sessions that need a folder`,anchorId:`host-unresolved`}),(0,H.jsx)(kx,{host:e,backfill:t.backfill})]})]})}function yC({statuses:e,profilePreset:t}){let n=X(),{health:r}=oC(),[i,a]=(0,v.useState)(!1),o=r&&!r.ok?r.reason??``:null;return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Choose a host to see its history import, sessions and settings.`)}),(0,H.jsx)(`ul`,{className:`grid grid-cols-2 items-stretch gap-3 lg:grid-cols-4`,children:cd.map(t=>{let r=t===`shared`?null:t,i=r?e.line(r):{text:`Settings for every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(mC,{view:t,line:Kx(n,i),warning:r&&e.input(r).setUp?o:null,notSetUp:r?!e.input(r).setUp:!1})},t)})}),(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`Import all hosts`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,"aria-expanded":i,"aria-controls":`memory-import-all`,onClick:()=>a(e=>!e),children:n(`Import all hosts`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Runs one import for every host you tick. It makes model calls and can cost money.`)})]}),(0,H.jsx)(`div`,{id:`memory-import-all`,hidden:!i,children:i&&(0,H.jsx)(QS,{profilePreset:t})})]})]})}var bC=[{value:`boost`,label:`Boost (default)`},{value:`rrf`,label:`Rank fusion (experimental)`}];function xC(e){return e===`boost`||e===`rrf`}function SC(e){return xC(e)?e:`boost`}function CC(e){return{keywordMode:e}}function wC(e){let t=t=>{let n=e[t]?.value;return typeof n==`string`&&n.trim().length>0};return e.rerankerEnabled?.value===!0&&t(`rerankerApiUrl`)&&t(`rerankerModel`)}function TC(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(`boost`),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=Qv();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(SC(r.settings.keywordMode?.globalValue)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=ey(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||e===SC(r.settings.keywordMode?.globalValue)?SC(a.settings.keywordMode?.globalValue):e)});return()=>{e=!1,r()}},[]);let d=SC(t?.settings.keywordMode?.globalValue),f=t?.settings.keywordMode?.source===`project`,p=t?wC(t.settings):!1;async function m(){if(!t||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:CC(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await $v()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function h(t){if(t.kind===`load-failed`)return e(`The keyword matching setting could not be loaded. Reload the page to try again.`);let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ty(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use this mode.`):ty(e(`The keyword matching setting could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Keyword matching`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Keyword matching`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search finds memories by meaning and by exact words from your prompt.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`keyword-mode`,children:e(`Word matching mode`)}),(0,H.jsx)(`div`,{className:`w-72 max-w-full`,children:(0,H.jsx)(Er,{id:`keyword-mode`,className:`w-full`,value:r,disabled:a,onChange:e=>{xC(e.target.value)&&i(e.target.value)},children:bC.map(t=>(0,H.jsx)(`option`,{value:t.value,children:e(t.label)},t.value))})}),(0,H.jsx)(`span`,{id:`keyword-mode-help`,className:`block text-xs text-muted-foreground`,children:`keywordMode`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(r===`rrf`?`Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.`:`Boost adds a small score bonus to memories that contain a word of your prompt.`)}),p&&r===`rrf`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`Rank fusion is not used while the reranker is on. Search uses the boost.`)}),f&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file can override this setting. This page edits the global value.`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(G,{type:`submit`,disabled:a||!t||r===d,children:e(`Save`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:a||r===d,onClick:()=>i(d),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:h(s)})]})}var EC=`Enter a positive whole number.`,DC=[{key:`maxMemories`,id:`memory-maxMemories`,default:10,unit:`Results`,affects:`Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.`,min:1,max:2**53-1,accepted:EC,kind:`integer`},{key:`chatMessage.maxMemories`,id:`memory-chatMessage-maxMemories`,default:3,unit:`Memories`,affects:`Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.`,min:1,max:2**53-1,accepted:EC,kind:`integer`},{key:`autoCaptureMaxContextBytes`,id:`memory-autoCaptureMaxContextBytes`,default:131072,unit:`Bytes`,affects:`Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.`,min:16384,max:16777216,accepted:`Enter a whole number from 16,384 to 16,777,216.`,kind:`integer`},{key:`userProfileMaxContextBytes`,id:`memory-userProfileMaxContextBytes`,default:32768,unit:`Bytes`,affects:`OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.`,min:1024,max:16777216,accepted:`Enter a whole number from 1,024 to 16,777,216.`,kind:`integer`},{key:`retrievalMaxTokens`,id:`memory-retrievalMaxTokens`,default:2e3,unit:`Approximate tokens`,affects:`Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.`,min:256,max:65536,accepted:`Enter a whole number from 256 to 65,536.`,kind:`integer`},{key:`similarityThreshold`,id:`memory-similarityThreshold`,default:.6,unit:`Similarity score`,affects:`Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.`,min:0,max:1,accepted:`Enter a number from 0 to 1.`,kind:`decimal`}];[...DC.flatMap(e=>[e.unit,e.affects,e.accepted])];function OC(e,t){let n=typeof t==`string`?t.trim():``;if(!n||!/^-?\d+(\.\d+)?$/.test(n))return;let r=Number(n);if(!(e.kind===`integer`&&!Number.isInteger(r)))return r>=e.min&&r<=e.max?r:void 0}function kC(e){return e.toLocaleString(`en-US`)}function AC(e,t,n){let r=t[e.key];return typeof r==`string`?r:String(n[e.key]??e.default)}function jC(e,t){let n=!1;for(let r of DC){let i=e[r.key];if(typeof i!=`string`)continue;let a=OC(r,i);if(a===void 0)return!1;a!==(t[r.key]??r.default)&&(n=!0)}return n}function MC(e,t){let n={};if(!jC(e,t))return n;for(let r of DC){let i=e[r.key];if(typeof i!=`string`)continue;let a=OC(r,i);a!==(t[r.key]??r.default)&&(n[r.key]=a)}return n}var NC=`Config changed. Reload settings and save again.`;function PC(e){if(e===`Config changed. Reload settings and save again.`)return{kind:`stale`};let t=DC.map(e=>e.key.replace(/\./g,`\\.`)).join(`|`),n=RegExp(`^Invalid (${t}) setting\\b`).exec(e);return n?{kind:`invalid`,key:n[1]}:{kind:`unknown`}}function FC(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=Qv();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(()=>{e&&c({kind:`load-failed`})});let r=ey(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let u={},d={};for(let e of DC){let n=t?.settings[e.key];u[e.key]=typeof n?.globalValue==`number`?n.globalValue:void 0,d[e.key]=typeof n?.default==`number`?n.default:e.default}let f=jC(r,u),p=`~/.config/omms/omms.jsonc`,m=e(`Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.`).split(p);async function h(){if(!t||!f||l.current)return;let e=MC(r,u);Object.keys(e).length&&await _(e)}async function g(e){!t||a||l.current||t.settings[e]?.hasGlobal&&await _({[e]:null})}async function _(e){if(!t||l.current)return;l.current=!0,o(!0);let n=!1,r;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:t.revision})}),n=!0}catch(e){r=e}let a=await $v()!==null;o(!1),l.current=!1,n?(i(t=>{let n={...t};for(let t of Object.keys(e))delete n[t];return n}),c({kind:`saved`,reloaded:a})):c({kind:`save-failed`,failure:PC(r?.message??``),reloaded:a})}function y(t){if(t.kind===`load-failed`)return e(`The memory settings could not be loaded. Reload the page to try again.`);if(t.kind===`saved`)return t.reloaded?e(`Saved. New memory operations use these limits.`):`${e(`Saved. New memory operations use these limits.`)} ${e(`Reload the page before saving again.`)}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);if(t.failure.kind===`stale`)return ty(e(NC),n);if(t.failure.kind===`invalid`){let r=t.failure,i=DC.find(e=>e.key===r.key);return ty(`${e(`Invalid setting`)} ${i.key}: ${e(i.accepted)}`,n)}return ty(e(`The memory settings could not be saved.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory limits`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory limits`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Byte limits count UTF-8 bytes.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[m[0],(0,H.jsx)(`code`,{dir:`ltr`,children:p}),m[1]]}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,H.jsx)(`div`,{className:Ry,children:(0,H.jsxs)(`table`,{className:`w-full min-w-[56rem] text-sm`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:e(`Memory limits`)}),(0,H.jsx)(`thead`,{className:By,children:(0,H.jsx)(`tr`,{children:[`Setting`,`Value`,`Default`,`Unit`,`Affects`].map(t=>(0,H.jsx)(`th`,{className:Vy,children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:DC.map(n=>{let o=r[n.key],s=AC(n,r,u),c=typeof o==`string`&&OC(n,o)===void 0,l=t?.settings[n.key],f=l?.source===`project`,p=l?.hasGlobal===!0,m=p&&typeof l?.globalValue==`number`&&l.globalValue!==d[n.key];return(0,H.jsxs)(`tr`,{className:Hy,children:[(0,H.jsxs)(`td`,{className:Uy,children:[(0,H.jsx)(`code`,{dir:`ltr`,children:n.key}),f&&(0,H.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-xs text-amber-600`,children:[(0,H.jsxs)(`p`,{children:[e(`Effective value`),`: `,String(l?.value??``),` (`,e(`project`),`)`]}),(0,H.jsx)(`p`,{children:e(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`p`,{children:e(`The project value stays in force. Saving edits the global file only.`)})]})]}),(0,H.jsxs)(`td`,{className:Uy,children:[(0,H.jsx)(`input`,{type:`number`,id:`${n.id}-input`,className:`w-36 tabular-nums`,inputMode:n.kind===`decimal`?`decimal`:`numeric`,step:n.kind===`decimal`?.01:1,min:n.min,max:n.max,"aria-label":`${n.key} ${e(`Value`)}`,"aria-describedby":`${n.id}-help`,"aria-invalid":c||void 0,disabled:a,value:s,onChange:e=>i(t=>({...t,[n.key]:e.target.value}))}),(0,H.jsx)(`span`,{id:`${n.id}-help`,className:`block text-xs ${c?`text-red-600`:`text-muted-foreground`}`,children:e(n.accepted)}),(0,H.jsx)(`button`,{type:`button`,"data-reset":n.key,className:`mt-1 block text-xs underline`,disabled:a||!p,"aria-label":`${n.key} ${e(`Reset to default`)}`,onClick:()=>void g(n.key),children:e(`Reset to default`)})]}),(0,H.jsxs)(`td`,{className:`${Uy} tabular-nums`,children:[kC(d[n.key]),m&&(0,H.jsx)(`span`,{className:`block text-xs text-amber-600`,children:e(`Differs from default`)})]}),(0,H.jsx)(`td`,{className:Uy,children:e(n.unit)}),(0,H.jsx)(`td`,{className:Uy,children:e(n.affects)})]},n.key)})})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`submit`,disabled:a||!t||!f,onClick:()=>void h(),children:e(`Save memory limits`)}),(0,H.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i({}),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:y(s)})]})}var IC=`Enter a whole number from 50 to 100000.`;function LC(e){let t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,message:IC};let n=Number(t);return n<50||n>1e5?{ok:!1,message:IC}:{ok:!0,value:n}}function RC(e,t){let n=LC(t);return n.ok?n.value===e?{kind:`none`}:{kind:`edit`,edits:{userProfileAutoCleanupInterval:n.value}}:{kind:`error`,message:n.message}}function zC(e,t){return e===t?null:{userProfileAutoCleanupEnabled:t}}var BC=500;function VC(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),d=t?.settings.userProfileAutoCleanupEnabled?.globalValue!==!1,f=Number(t?.settings.userProfileAutoCleanupInterval?.globalValue??BC);(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>{e&&n(t)}).catch(t=>{e&&c(t.message)});let t=ey(t=>{e&&n(t)});return()=>{e=!1,t()}},[]),(0,v.useEffect)(()=>{t&&i(String(f))},[t,f]);async function p(n){if(t){u(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),c(e(`Saved. Changes apply at the next learning pass.`))}catch(e){c(e.message)}await $v(),u(!1)}}function m(){let t=RC(f,r);if(t.kind===`error`){o(e(t.message));return}o(``),t.kind===`edit`&&p(t.edits)}return(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e(`Automatic profile cleanup`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,disabled:l||!t,onChange:e=>{let t=zC(d,e.target.checked);t&&p(t)}}),e(`Clean up the profile automatically`)]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-cleanup-interval`,children:e(`Run every this many analysed prompts`)}),(0,H.jsx)(`input`,{id:`auto-cleanup-interval`,className:`w-28 rounded border border-border bg-background px-2 py-1`,inputMode:`numeric`,value:r,disabled:l||!t,"aria-invalid":a?!0:void 0,"aria-describedby":a?`auto-cleanup-interval-error`:void 0,onChange:e=>{i(e.target.value),o(``)}}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:l||!t||r.trim()===String(f),onClick:m,children:e(`Save interval`)})]}),a&&(0,H.jsx)(`p`,{id:`auto-cleanup-interval-error`,role:`alert`,className:`text-sm text-destructive`,children:a}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:s})]})}function HC({preview:e,job:t,busy:n,onStart:r,onPause:i}){let a=X(),o=t.state===`running`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`p`,{children:[a(`Prompts waiting for profile learning`),`: `,e.waiting,` ·`,` `,a(`Estimated profile analysis calls`),`: `,e.calls]}),t.state!==`idle`&&(0,H.jsxs)(`p`,{role:`status`,children:[a(`Batches done`),`: `,t.batchesBuilt,` · `,a(`Prompts waiting`),`: `,t.remaining,t.state===`paused`&&` · ${a(`Paused`)}`,t.state===`done`&&` · ${a(`Finished`)}`]}),t.state===`superseded`&&(0,H.jsx)(`p`,{children:a(`A newer catch-up run took over.`)}),t.state===`failed`&&(0,H.jsxs)(`p`,{className:`text-red-600`,children:[a(`Stopped`),`: `,t.reason??`error`]}),o?(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:i,children:a(`Pause`)}):(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:n||e.waiting===0,onClick:r,children:a(t.state===`idle`||t.state===`done`?`Analyse waiting prompts`:`Resume`)})]})}function UC({onReanalyse:e}={}){let t=X(),[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)({state:`idle`,batchesBuilt:0,remaining:0}),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);async function f(){let e=await Y(`/api/settings/profile/catch-up`);r(e.preview),a(e.job)}(0,v.useEffect)(()=>{f().catch(e=>d(e.message)),Y(`/api/web/status`).then(e=>s(!!e.isLocal)).catch(()=>{})},[]),(0,v.useEffect)(()=>{if(i.state!==`running`)return;let e=setInterval(()=>void f().catch(()=>{}),2e3);return()=>clearInterval(e)},[i.state]);async function p(){if(!n)return;let e=i.state!==`idle`&&i.state!==`done`;if(window.confirm(`${t(`Start profile learning for the waiting prompts? Model calls`)}: ${n.calls}`)){l(!0);try{a(await Y(`/api/settings/profile/catch-up/${e?`resume`:`start`}`,{method:`POST`,body:`{}`})),d(``)}catch(e){d(e.message)}l(!1)}}async function m(){try{a(await Y(`/api/settings/profile/catch-up/pause`,{method:`POST`,body:`{}`}))}catch(e){d(e.message)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Profile learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Profile learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.`)}),e&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,onClick:e,children:t(`Re-analyse chat history`)}),n&&(o?(0,H.jsx)(HC,{preview:n,job:i,busy:c,onStart:()=>void p(),onPause:()=>void m()}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Open this page on the computer that runs OMMS to start a catch-up run.`)})),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),(0,H.jsx)(VC,{})]})}function WC(e){let t=typeof e==`string`?e.trim():``;if(!t||!/^\d+$/.test(t))return;let n=Number(t);return n>=500&&n<=3e4?n:void 0}function GC(e){return/^(env:\/\/[A-Za-z_][A-Za-z0-9_]*|file:\/\/.+)$/.test(e.trim())}function KC(e){try{let t=new URL(e.trim()).hostname.toLowerCase();return!(t===`localhost`||t===`::1`||t===`[::1]`||/^127\.\d+\.\d+\.\d+$/.test(t))}catch{return!1}}function qC(e){if(e.enabled&&(e.url.trim().length===0||e.model.trim().length===0))return{field:`url-model`};if(e.key.trim().length>0&&!GC(e.key))return{field:`key`};if(WC(e.timeout)===void 0)return{field:`timeout`}}function JC(e){return qC(e)===void 0}function YC(e){return{rerankerEnabled:e.enabled,rerankerApiUrl:e.url.trim()||null,rerankerModel:e.model.trim()||null,rerankerApiKey:e.key.trim()||null,rerankerTimeoutMs:WC(e.timeout)??4e3}}function XC(e){let t=e?.settings,n=e?.secrets.rerankerApiKey?.reference;return{enabled:t?.rerankerEnabled?.value===!0,url:typeof t?.rerankerApiUrl?.value==`string`?t.rerankerApiUrl.value:``,model:typeof t?.rerankerModel?.value==`string`?t.rerankerModel.value:``,key:e?.secrets.rerankerApiKey?.set?`${e.secrets.rerankerApiKey.source}://${n??``}`:``,timeout:typeof t?.rerankerTimeoutMs?.value==`number`?String(t.rerankerTimeoutMs.value):`4000`}}function ZC(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({enabled:!1,url:``,model:``,key:``,timeout:`4000`}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=Qv();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(XC(r)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=ey(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||JSON.stringify(e)===JSON.stringify(XC(r))?XC(a):e)});return()=>{e=!1,r()}},[]);let d=qC(r),f=JC(r),p=r.url.trim().length>0&&KC(r.url);function m(e){i(t=>({...t,...e}))}async function h(){if(a||l.current||!f)return;l.current=!0,o(!0);let e=!1,t;try{let n=await Y(`/api/settings/reranker/test`,{method:`POST`,body:JSON.stringify({rerankerApiUrl:r.url.trim()||void 0,rerankerModel:r.model.trim()||void 0,rerankerApiKey:r.key.trim()||void 0,rerankerTimeoutMs:WC(r.timeout)??4e3})});e=n.success===!0,t=n.code}catch{t=`reranker_unreachable`}o(!1),l.current=!1,c({kind:`test`,ok:e,code:t})}async function g(){if(!t||!f||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:YC(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await $v()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function _(t){if(t.kind===`load-failed`)return e(`The reranker settings could not be loaded. Reload the page to try again.`);if(t.kind===`test`)return t.ok?e(`Test passed.`):`${e(`Test failed:`)} ${t.code??`reranker_unreachable`}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ty(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use these settings.`):ty(e(`The reranker settings could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Reranker`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Reranker`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker reorders the best memory search results with your reranker server and keeps the top results.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file cannot change these settings. The reranker settings are global only.`)}),!r.enabled&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search is unchanged while the switch is off.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`reranker-enabled`,role:`switch`,checked:r.enabled,disabled:a,"aria-label":e(`Use a reranker`),onChange:e=>m({enabled:e.target.checked})}),(0,H.jsx)(Pp,{htmlFor:`reranker-enabled`,children:e(`Use a reranker`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-url`,children:e(`Server URL`)}),(0,H.jsx)(id,{type:`url`,id:`reranker-url`,dir:`ltr`,placeholder:`http://127.0.0.1:3008/v1`,disabled:a,value:r.url,"aria-invalid":d?.field===`url-model`||void 0,"aria-describedby":`reranker-url-help`,onChange:e=>m({url:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-url-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`url-model`?e(`Enter the server URL and model before turning the reranker on.`):`rerankerApiUrl`}),p&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`This URL is not on this machine: memory text leaves this machine.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-model`,children:e(`Model`)}),(0,H.jsx)(id,{type:`text`,id:`reranker-model`,dir:`ltr`,disabled:a,value:r.model,"aria-invalid":d?.field===`url-model`||void 0,onChange:e=>m({model:e.target.value})}),(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`rerankerModel`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-key`,children:e(`Key`)}),(0,H.jsx)(id,{type:`text`,id:`reranker-key`,dir:`ltr`,disabled:a,value:r.key,"aria-invalid":d?.field===`key`||void 0,"aria-describedby":`reranker-key-help`,onChange:e=>m({key:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-key-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`key`?e(`The key must be an env:// or file:// reference, or left empty.`):e(`Optional env:// or file:// key reference.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-timeout`,children:e(`Timeout`)}),(0,H.jsx)(id,{type:`number`,id:`reranker-timeout`,className:`tabular-nums`,inputMode:`numeric`,step:1,min:500,max:3e4,disabled:a,value:r.timeout,"aria-invalid":d?.field===`timeout`||void 0,"aria-describedby":`reranker-timeout-help`,onChange:e=>m({timeout:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-timeout-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`timeout`?e(`Enter a whole number from 500 to 30,000.`):e(`milliseconds`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.`)})]})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(G,{type:`submit`,disabled:a||!t||!f,onClick:()=>void g(),children:e(`Save`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:a||!f,onClick:()=>void h(),children:e(`Test`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:a,onClick:()=>i(XC(t)),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:_(s)})]})}var QC=e=>{let t=e?.value??e?.globalValue;return t==null||t===``?null:String(t)};function $C(e,t){let n=QC(e?.maxMemories),r=QC(e?.similarityThreshold),i=QC(e?.keywordMode),a=QC(e?.rerankerModel);return{profile:{text:`Prompts waiting for profile learning, and re-analysis of old chats`},limits:n&&r?{text:`Results {results} · Similarity {similarity}`,params:{results:n,similarity:r}}:{text:`How many memories a search returns`},keywords:i?{text:`Mode: {mode}`,params:{mode:i}}:{text:`Keyword matching`},reranker:QC(e?.rerankerApiUrl)?a?{text:`On · {model}`,params:{model:a}}:{text:`On`}:{text:`Off`},maps:t?{text:`{saved} saved · {ignored} ignored`,params:t}:{text:`Saved maps and ignored directories`}}}function ew({id:e,title:t,summary:n,children:r}){return(0,H.jsxs)(`details`,{id:e,"data-shared-row":!0,className:`scroll-mt-20 rounded-xl border border-border bg-card`,children:[(0,H.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer flex-wrap items-baseline gap-x-3 gap-y-1 rounded-xl p-4 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h2`,{className:`text-subsection-title font-semibold`,children:t}),(0,H.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:n})]}),(0,H.jsx)(`div`,{className:`border-t border-border p-4`,children:r})]})}function tw({statuses:e,onReanalyse:t}){let n=X(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let e=!0,t=()=>{Y(`/api/settings`).then(t=>e&&i(t.settings)).catch(()=>{}),Y(`/api/settings/import-maps`).then(t=>e&&o({saved:t.saved.length,ignored:t.ignored?.length??0})).catch(()=>{})};t();let n=ey(t);return()=>{e=!1,n()}},[]);let s=$C(r,a),c=e=>Kx(n,s[e]);return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(hC,{current:`shared`,statuses:e}),(0,H.jsxs)(`header`,{className:`space-y-1`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:n(`Shared`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`These settings apply to every host. Open a row to change it.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(ew,{id:`shared-profile`,title:n(`Profile learning`),summary:c(`profile`),children:(0,H.jsx)(UC,{onReanalyse:t})}),(0,H.jsx)(ew,{id:`shared-limits`,title:n(`Memory limits`),summary:c(`limits`),children:(0,H.jsx)(FC,{})}),(0,H.jsx)(ew,{id:`shared-keywords`,title:n(`Keyword matching`),summary:c(`keywords`),children:(0,H.jsx)(TC,{})}),(0,H.jsx)(ew,{id:`shared-reranker`,title:n(`Reranker`),summary:c(`reranker`),children:(0,H.jsx)(ZC,{})}),(0,H.jsx)(ew,{id:`shared-directory-maps`,title:n(`Directory maps`),summary:c(`maps`),children:(0,H.jsx)(Sx,{hosts:[]})})]})]})}var nw=3e3;function rw(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({pi:null,opencode:null,"claude-code":null}),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)({}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(Zx(i,e=>u(e.message))),m=(0,v.useRef)(Zx(o,e=>u(e.message))),h=()=>p.current(Y(`/api/settings/backfill`)),g=()=>m.current(Y(`/api/settings/backfill/runs`));(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>e&&n(t)).catch(t=>e&&u(t.message)),h(),g();for(let t of[`pi`,`opencode`])Y(`/api/settings/models?host=${t}`).then(n=>e&&c(e=>({...e,[t]:n}))).catch(()=>e&&c(e=>({...e,[t]:{available:!1}})));let t=ey(t=>{e&&(n(t),h())}),r=setInterval(()=>{e&&(h(),g())},nw);return()=>{e=!1,clearInterval(r),t()}},[]);async function _(n){if(t){f(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),u(e(`Saved. Changes apply at the next run.`))}catch(e){u(e.message)}await $v(),f(!1)}}async function y(t,n){f(!0);let r=a?.[t]?.run?.state===`running`;try{await Y(`/api/settings/backfill/${t}/${n}`,{method:`POST`,body:`{}`}),u(e(n===`pause`?r?`Pausing after the current exchange.`:`Paused. No import starts until you resume.`:`Backfill started.`))}catch(e){u(e.message)}await Promise.all([g(),h()]),f(!1)}function b(t,n){try{_(Tx(t,n.trim()))}catch(t){u(e(t.message))}}return{snapshot:t,rows:r,runs:a,lists:s,message:l,busy:d,save:_,control:y,saveModel:b,setMessage:u}}var iw=6e4;function aw(){let e=rw(),[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(null),a=X();(0,v.useEffect)(()=>{let e=!0,t=()=>void Y(`/api/settings/imports/readiness`).then(t=>e&&n(t)).catch(()=>e&&n(null));t();let r=ey(t);return()=>{e=!1,r()}},[]),(0,v.useEffect)(()=>{let e=!0,t=()=>void Y(`/api/settings/last-saved`).then(t=>e&&i(t.hosts)).catch(()=>void 0);t();let n=ey(t),r=setInterval(t,iw);return()=>{e=!1,n(),clearInterval(r)}},[]);let o=e=>{let t=Ai(new Date(e),new Date),n=Qp(e);return t===`earlier`?`${Zp(e)} ${n}`:a(t===`today`?`today {time}`:`yesterday {time}`).replaceAll(`{time}`,n)},s=n=>({host:n,run:e.runs?.[n]?.run??null,pending:e.rows[n]?.counts.pending??0,cutoff:e.rows[n]?.cutoff??null,runNowUnavailable:e.runs?.[n]?.runNowUnavailable??null,setUp:t?.defaultSourceFound?.[n]!==!1,formatDate:Zp,lastSaved:r?.[n]??null,formatSaved:o});return{backfill:e,readiness:t,input:s,status:e=>Wx(s(e)),line:e=>Gx(s(e))}}function ow(){let e=dd(vf().split(`#`)[0]),t=aw(),[n,r]=(0,v.useState)(0);(0,v.useEffect)(()=>{sf(window.location.hash)},[e]);function i(){r(e=>e+1),gf(J.memory)}return(0,H.jsxs)(`div`,{className:`settings-view`,children:[e===null&&(0,H.jsx)(yC,{statuses:t,profilePreset:n}),e===`shared`&&(0,H.jsx)(tw,{statuses:t,onReanalyse:i}),e!==null&&e!==`shared`&&(0,H.jsx)(vC,{host:e,statuses:t,profilePreset:n})]})}function sw(e){return e.startsWith(`P`)?`border-blue-600/40 bg-blue-500/10 text-blue-700 hover:bg-blue-500/20 dark:text-blue-400`:`border-primary/30 bg-primary/10 text-primary-label hover:bg-primary/20`}function cw({label:e,deleted:t,onOpen:n}){let{t:r}=oa();return(0,H.jsx)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-label":r(`chat-cite-label`,{label:e}),onClick:n,className:V(`mx-0.5 inline-flex h-5 cursor-pointer items-center rounded-md border px-1.5 align-baseline text-[11px] font-medium tabular-nums transition-colors duration-200 ease-in focus-visible:outline-2 focus-visible:outline-ring`,sw(e),t&&`line-through opacity-70`),children:e})}function lw({label:e,text:t}){return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:V(`inline-flex h-5 items-center rounded-md border px-1.5 text-[11px] font-medium`,sw(e)),children:e}),(0,H.jsx)(`span`,{dir:`auto`,children:t})]})}function uw(){let{t:e}=oa();return(0,H.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(lw,{label:`S`,text:e(`chat-legend-memory`)}),(0,H.jsx)(lw,{label:`P`,text:e(`chat-legend-profile`)})]})}var dw=`/api/chat`,fw={"Content-Type":`application/json`},pw=15e4,mw=(e,t,n,r)=>W(`${dw}${e}`,{method:t,headers:fw,body:n===void 0?void 0:JSON.stringify(n),timeout:r}),hw={status:()=>W(`${dw}/status`),list:()=>W(`${dw}/conversations`),get:e=>W(`${dw}/conversations/${encodeURIComponent(e)}`),create:(e,t)=>mw(`/conversations`,`POST`,{folderId:e,scopeTag:t}),rename:(e,t)=>mw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{title:t}),move:(e,t)=>mw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{folderId:t}),remove:e=>mw(`/conversations/${encodeURIComponent(e)}`,`DELETE`),removeMany:e=>mw(`/conversations/bulk-delete`,`POST`,{ids:e}),ask:(e,t,n,r=!1)=>mw(`/conversations/${encodeURIComponent(e)}/messages`,`POST`,{question:t,scopeTag:n,retry:r},pw),createFolder:e=>mw(`/folders`,`POST`,{name:e}),renameFolder:(e,t)=>mw(`/folders/${encodeURIComponent(e)}`,`PATCH`,{name:t}),removeFolder:e=>mw(`/folders/${encodeURIComponent(e)}`,`DELETE`)},gw={conversations:[],folders:[],readOnly:!1};function _w(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(gw),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),m=(0,v.useCallback)(async()=>{let e=await hw.list();e.success&&e.data&&r(e.data)},[]);(0,v.useEffect)(()=>{hw.status().then(e=>e.success&&e.data&&t(e.data)),W(`/api/tags`).then(e=>e.success&&e.data&&a(e.data.project)),m()},[m]);let h=(0,v.useCallback)(e=>e===null||i.some(t=>t.tag===e),[i]),g=(0,v.useCallback)(async e=>{let t=await hw.get(e);if(!t.success||!t.data)return void U.error(t.error??``);s(e),l(t.data);let n=t.data.conversation.scopeTag;d(h(n)?n:void 0)},[h]),_=(0,v.useCallback)(async(e=null)=>{let t=await hw.create(e,null);if(!t.success||!t.data)return void U.error(t.error??``);await m(),s(t.data.id),l({conversation:t.data,messages:[]}),d(null)},[m]),y=(0,v.useCallback)(async(e,t=!1)=>{if(u===void 0)return;let n=o;if(!n){let e=await hw.create(null,u);if(!e.success||!e.data)return void U.error(e.error??``);n=e.data.id,s(n),l({conversation:e.data,messages:[]})}p(e);let r=await hw.ask(n,e,u,t);if(p(null),!r.success||!r.data)return void U.error(r.error??``);await g(n),await m()},[o,u,g,m]),b=(0,v.useCallback)(e=>{let t=c?.messages??[],n=t[t.findIndex(t=>t.id===e.id)-1];n?.role===`user`&&y(n.content,!0)},[c,y]),x=(0,v.useCallback)(async e=>{o&&e.includes(o)&&(s(null),l(null),d(null)),await m()},[o,m]),S=(0,v.useCallback)(async e=>{let t=e.length===1?await hw.remove(e[0]):await hw.removeMany(e);if(!t.success)return void U.error(t.error??``);await x(e)},[x]),C=(0,v.useCallback)(async e=>{let t=n.conversations.filter(t=>t.folderId===e).map(e=>e.id),r=await hw.removeFolder(e);if(!r.success)return void U.error(r.error??``);await x(t)},[n,x]),w=(0,v.useCallback)(async e=>{let t=await e();return t.success?(await m(),o&&await g(o),null):t.code===`conflict`?`conflict`:t.error??`error`},[m,o,g]);return{status:e,list:n,projects:i,activeId:o,detail:c,scope:u,setScope:d,pending:f,scopeMissing:!!c&&u===void 0,open:g,newChat:_,ask:y,retry:b,deleteChats:S,deleteFolder:C,change:w}}var vw=`__all__`,yw=`__choose__`;function bw({projects:e,scope:t,scopeMissing:n,disabled:r,onScope:i,onAsk:a}){let{t:o}=oa(),[s,c]=(0,v.useState)(``),l=r||t===void 0;function u(e){e?.preventDefault(),!(l||!s.trim())&&(a(s.trim()),c(``))}function d(e){e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),u())}return(0,H.jsxs)(`form`,{onSubmit:u,className:`grid gap-2 rounded-2xl border border-border bg-card p-2.5 shadow-sm`,children:[(0,H.jsx)(Fp,{value:s,disabled:r,rows:2,maxLength:4e3,placeholder:o(`chat-input-placeholder`),"aria-label":o(`chat-input-placeholder`),className:`min-h-14 resize-none border-0 bg-transparent shadow-none focus-visible:ring-0`,onChange:e=>c(e.target.value),onKeyDown:d}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`shrink-0`,children:o(`chat-scope-label`)}),(0,H.jsxs)(Er,{className:`h-8 min-w-0 max-w-64 flex-1 text-xs`,"aria-label":o(`chat-scope-label`),disabled:r,value:t===void 0?yw:t??vw,onChange:e=>{let t=e.target.value;t!==yw&&i(t===vw?null:t)},children:[t===void 0?(0,H.jsx)(`option`,{value:yw,children:o(`chat-scope-missing`)}):null,(0,H.jsx)(`option`,{value:vw,children:o(`chat-scope-all`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.projectName||e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(G,{type:`submit`,size:`sm`,disabled:l||!s.trim(),"aria-label":o(`chat-send`),children:[(0,H.jsx)(ee,{}),o(`chat-send`)]})]}),n?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`chat-scope-choose`)}):null]})}function xw({status:e}){let{t}=oa();return(0,H.jsxs)(`div`,{role:`alert`,className:`grid gap-2 rounded-xl border border-border bg-card p-4`,children:[(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,H.jsx)(zt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t(`chat-setup-title`)]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`chat-setup-body`,{names:e.missing.join(`, `)})}),(0,H.jsxs)(`a`,{href:`/settings#settings-section-external-api`,className:`inline-flex w-fit items-center gap-1.5 text-sm text-primary-label underline-offset-4 hover:underline`,children:[(0,H.jsx)(Dt,{className:`size-3.5`,"aria-hidden":`true`}),t(`chat-setup-link`)]})]})}var Sw=`__none__`;function Cw({folders:e,folderId:t,onMove:n}){let{t:r}=oa();return(0,H.jsxs)(Er,{className:`h-8 w-full text-xs`,"aria-label":r(`chat-move`),value:t??Sw,onChange:e=>n(e.target.value===Sw?null:e.target.value),children:[(0,H.jsx)(`option`,{value:Sw,children:r(`chat-no-folder`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}function ww(e){let{t}=oa(),{conversation:n,active:r,selectMode:i}=e,a=n.title||t(`chat-new`);return i?(0,H.jsx)(`li`,{children:(0,H.jsxs)(`label`,{className:`flex min-h-11 md:min-h-9 cursor-pointer items-center gap-2 rounded-lg px-2 text-sm hover:bg-interactive-hover`,children:[(0,H.jsx)(Qo,{checked:e.selected,onCheckedChange:e.onToggleSelect,"aria-label":t(`chat-select-chat`,{title:a})}),(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate`,title:a,children:a})]})}):(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`div`,{className:V(`group flex items-center gap-1 rounded-lg`,r?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-interactive-hover`),children:[(0,H.jsx)(`button`,{type:`button`,className:`min-h-11 md:min-h-9 min-w-0 flex-1 cursor-pointer overflow-hidden rounded-lg px-2 text-start text-sm focus-visible:outline-2 focus-visible:outline-ring`,"aria-current":r?`true`:void 0,title:a,onClick:e.onOpen,children:(0,H.jsx)(`span`,{dir:`auto`,className:`block truncate`,children:a})}),e.readOnly?null:(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`me-1 shrink-0 text-muted-foreground`,"aria-label":t(`chat-chat-actions`),"aria-expanded":e.actionsOpen,onClick:e.onToggleActions,children:(0,H.jsx)(xe,{})})]}),e.actionsOpen?(0,H.jsxs)(`div`,{className:`ms-2 mt-1 mb-2 grid gap-1.5 rounded-lg border border-border bg-card p-2`,children:[(0,H.jsx)(Cw,{folders:e.folders,folderId:n.folderId,onMove:e.onMove}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`xs`,onClick:e.onRename,children:[(0,H.jsx)(pt,{}),t(`chat-rename`)]}),(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`xs`,onClick:e.onDelete,children:[(0,H.jsx)(Lt,{}),t(`chat-delete`)]})]})]}):null]})}function Tw({name:e,count:t,actions:n,onSelectAll:r,children:i}){let{t:a}=oa(),[o,s]=(0,v.useState)(!0),c=o?Oe:Ae;return(0,H.jsxs)(`section`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex min-h-11 md:min-h-8 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-lg px-1.5 text-xs font-medium text-muted-foreground transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,"aria-expanded":o,onClick:()=>s(!o),children:[(0,H.jsx)(ce,{className:V(`size-3.5 shrink-0 transition-transform rtl:-scale-x-100`,o&&`rotate-90`),"aria-hidden":`true`}),(0,H.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate uppercase tracking-wide`,children:e}),(0,H.jsx)(`span`,{className:`tabular-nums`,"aria-label":a(t===1?`chat-folder-count-one`:`chat-folder-count`,{count:t}),children:t})]}),r&&t>0?(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`xs`,onClick:r,children:a(`chat-select-all-folder`)}):null,n&&!r?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center`,role:`group`,"aria-label":a(`chat-folder-actions`),children:[(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-new`),title:a(`chat-new`),onClick:n.onNewChat,children:(0,H.jsx)(_t,{})}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-rename`),title:a(`chat-rename`),onClick:n.onRename,children:(0,H.jsx)(pt,{})}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-delete`),title:a(`chat-delete`),onClick:n.onDelete,children:(0,H.jsx)(Lt,{})})]}):null]}),o?(0,H.jsx)(`ul`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5 ps-3`,children:i}):null]})}function Ew(e){let{t}=oa(),{chat:n,selectMode:r,selected:i}=e,[a,o]=(0,v.useState)(null),{conversations:s,folders:c,readOnly:l}=n.list,u=s.filter(e=>!e.folderId),d=e=>e===`conflict`?t(`chat-folder-exists`):e,f=t=>{let n=new Set(i);n.has(t)?n.delete(t):n.add(t),e.onSelected(n)},p=t=>e.onSelected(new Set([...i,...t])),m=r=>e.onName({title:t(`chat-chat-rename-title`),label:t(`chat-chat-title`),initial:r.title,submitLabel:t(`chat-save`),submit:e=>n.change(()=>hw.rename(r.id,e))}),h=t=>t.map(t=>(0,H.jsx)(ww,{conversation:t,folders:c,active:t.id===n.activeId,selectMode:r,selected:i.has(t.id),actionsOpen:a===t.id,readOnly:l,onOpen:()=>{n.open(t.id),e.onOpened?.()},onToggleSelect:()=>f(t.id),onToggleActions:()=>o(a===t.id?null:t.id),onRename:()=>m(t),onMove:e=>void n.change(()=>hw.move(t.id,e)),onDelete:()=>e.onDelete({kind:`chats`,ids:[t.id]})},t.id));return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:t(`chat-selected-count`,{count:i.size})}),(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`xs`,disabled:i.size===0,onClick:()=>e.onDelete({kind:`chats`,ids:[...i]}),children:[(0,H.jsx)(Lt,{}),t(`chat-delete-selected`)]}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>e.onSelectMode(!1),children:t(`chat-select-done`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{type:`button`,size:`xs`,disabled:l,onClick:()=>void n.newChat(),children:[(0,H.jsx)(_t,{}),t(`chat-new`)]}),(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`xs`,disabled:l,onClick:()=>e.onName({title:t(`chat-folder-create-title`),label:t(`chat-folder-name`),initial:``,submitLabel:t(`chat-create`),submit:async e=>d(await n.change(()=>hw.createFolder(e)))}),children:[(0,H.jsx)(ke,{}),t(`chat-new-folder`)]}),(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`xs`,disabled:l||s.length===0,onClick:()=>e.onSelectMode(!0),children:[(0,H.jsx)(At,{}),t(`chat-select`)]})]})}),s.length===0&&c.length===0?(0,H.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:t(`chat-empty-list`)}):null,c.map(i=>{let a=s.filter(e=>e.folderId===i.id);return(0,H.jsx)(Tw,{name:i.name,count:a.length,onSelectAll:r?()=>p(a.map(e=>e.id)):void 0,actions:l?void 0:{onNewChat:()=>void n.newChat(i.id),onRename:()=>e.onName({title:t(`chat-folder-rename-title`),label:t(`chat-folder-name`),initial:i.name,submitLabel:t(`chat-save`),submit:async e=>d(await n.change(()=>hw.renameFolder(i.id,e)))}),onDelete:()=>e.onDelete({kind:`folder`,id:i.id,name:i.name,count:a.length})},children:h(a)},i.id)}),u.length>0?(0,H.jsx)(Tw,{name:t(`chat-no-folder`),count:u.length,onSelectAll:r?()=>p(u.map(e=>e.id)):void 0,children:h(u)}):null]})}function Dw({request:e,onConfirm:t,onCancel:n}){let{t:r}=oa(),[i,a]=(0,v.useState)(!1);return(0,H.jsx)(K,{open:e!==null,onOpenChange:e=>!e&&!i&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:e?.kind===`folder`?r(`chat-delete-folder-title`):r(`chat-delete-chats-title`)}),(0,H.jsx)(Wl,{children:e?Ow(e,r):null})]}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:n,disabled:i,children:r(`chat-cancel`)}),(0,H.jsx)(G,{type:`button`,variant:`destructive`,disabled:i,onClick:async()=>{e&&(a(!0),await t(e),a(!1))},children:r(`chat-delete-confirm`)})]})]})})}function Ow(e,t){if(e.kind===`folder`)return t(e.count===1?`chat-delete-folder-body-one`:`chat-delete-folder-body`,{name:e.name,count:e.count});let n=e.ids.length;return t(n===1?`chat-delete-chats-body-one`:`chat-delete-chats-body`,{count:n})}function kw({request:e,onClose:t}){let{t:n}=oa(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{i(e?.initial??``),o(null)},[e]);async function l(n){if(n.preventDefault(),!e||!r.trim())return;c(!0);let i=await e.submit(r.trim());c(!1),i?o(i):t()}return(0,H.jsx)(K,{open:e!==null,onOpenChange:e=>!e&&t(),children:(0,H.jsx)(q,{className:`sm:max-w-sm`,children:(0,H.jsxs)(`form`,{onSubmit:l,className:`grid gap-4`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:e?.title})}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(Pp,{htmlFor:`chat-name-input`,children:e?.label}),(0,H.jsx)(id,{id:`chat-name-input`,value:r,maxLength:80,autoFocus:!0,"aria-invalid":a?!0:void 0,onChange:e=>i(e.target.value)}),a?(0,H.jsx)(`p`,{className:`text-xs text-destructive-label`,children:a}):null]}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:t,children:n(`chat-cancel`)}),(0,H.jsx)(G,{type:`submit`,disabled:s||!r.trim(),children:e?.submitLabel})]})]})})})}var Aw=/\[([SP]\d+)\]/g,jw=/<(?:[^>"']|"[^"]*"|'[^']*')*>/g,Mw=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,Nw=new Set([`a`,`code`,`pre`,`button`]);function Pw(e,t,n,r){let i=new Set(t),a=(e,t)=>{if(!i.has(t))return e;let a=[`cite-chip`];t.startsWith(`P`)&&a.push(`cite-profile`),n(t)&&a.push(`cite-deleted`);let o=r(t).replace(/["&<>]/g,e=>`&#${e.charCodeAt(0)};`);return`<button type="button" class="${a.join(` `)}" data-cite="${t}" aria-haspopup="dialog" aria-label="${o}">${t}</button>`},o=``,s=0,c=0,l=(t,n)=>{let r=e.slice(t,n);o+=c>0?r:r.replace(Aw,a)};for(let t of e.matchAll(jw)){l(s,t.index),o+=t[0],s=t.index+t[0].length;let e=Mw.exec(t[0]);!e||!Nw.has(e[2].toLowerCase())||(e[1]?c=Math.max(0,c-1):c+=1)}return l(s,e.length),o}var Fw=/\[([SP]\d+)\]/g;function Iw(e,t){let n=new Set(t),r=[],i=``,a=0;for(let t of e.matchAll(Fw)){let o=t[1];n.has(o)&&(i+=e.slice(a,t.index),i&&r.push({kind:`text`,text:i}),i=``,r.push({kind:`cite`,label:o}),a=t.index+t[0].length)}return i+=e.slice(a),i&&r.push({kind:`text`,text:i}),r}function Lw(e,t){let n=[];for(let r of Iw(e,t))r.kind===`cite`&&!n.includes(r.label)&&n.push(r.label);return n}function Rw({plan:e}){let{t}=oa(),n=[[t(`chat-search-phrases`),e.queries],[t(`chat-search-tags`),e.tags],[t(`chat-search-categories`),e.profileCategories]];return(0,H.jsxs)(`details`,{className:`group text-xs text-muted-foreground`,children:[(0,H.jsxs)(`summary`,{className:`inline-flex cursor-pointer list-none items-center gap-1.5 rounded-md py-0.5 transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(Tt,{className:`size-3`,"aria-hidden":`true`}),t(`chat-how-searched`)]}),(0,H.jsxs)(`div`,{className:`mt-2 grid gap-1.5 rounded-lg border border-border p-2.5`,children:[e.skipped?(0,H.jsx)(`p`,{children:t(`chat-plan-skipped`)}):null,(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:n.map(([e,n])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{children:e}),(0,H.jsx)(`dd`,{dir:`auto`,className:`min-w-0 break-words text-foreground`,children:n.length?n.join(` · `):t(`chat-none`)})]},e))})]})]})}var zw={no_sources:`chat-no-sources`,insufficient:`chat-insufficient`,uncited:`chat-uncited`};function Bw({message:e,missingMemoryIds:t,readOnly:n,onOpenSource:r,onRetry:i}){let{t:a}=oa(),o=e.sources.map(e=>e.label),s=new Map(e.sources.map(e=>[e.label,e])),c=e=>!!e&&e.kind===`memory`&&t.has(e.id),l=(0,v.useMemo)(()=>Pw(p_(e.content),o,e=>c(s.get(e)),e=>a(`chat-cite-label`,{label:e})),[e.content,e.sources,t,a]),u=e=>{let t=e.target.closest(`[data-cite]`),n=t?s.get(t.dataset.cite??``):void 0;n&&r(n)},d=Lw(e.content,o).map(e=>s.get(e)).filter(e=>!!e);return(0,H.jsxs)(`article`,{className:`grid min-w-0 gap-2.5`,children:[e.errorCode?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-2.5 text-sm text-destructive-label`,children:[(0,H.jsx)(zt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:a(`chat-error`,{code:e.errorCode})}),n?null:(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>i(e),children:[(0,H.jsx)(wt,{}),a(`chat-retry`)]})]}):null,e.content?(0,H.jsx)(`div`,{dir:`auto`,className:`markdown-content chat-answer break-words text-sm leading-7`,onClick:u,dangerouslySetInnerHTML:{__html:l}}):null,e.notice?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),a(zw[e.notice])]}):null,d.length?(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:a(`chat-sources`)}),(0,H.jsx)(`ul`,{className:`grid gap-1`,children:d.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 text-xs`,children:[(0,H.jsx)(cw,{label:e.label,deleted:c(e),onOpen:()=>r(e)}),(0,H.jsxs)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate leading-5 text-muted-foreground`,children:[e.projectName?`${e.projectName} · `:``,e.text]})]},e.label))})]}):null,e.plan?(0,H.jsx)(Rw,{plan:e.plan}):null]})}function Vw({text:e}){let{t}=oa();return(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsxs)(`div`,{className:`max-w-[85%] rounded-2xl rounded-ee-md bg-secondary px-3.5 py-2.5`,children:[(0,H.jsxs)(`span`,{className:`sr-only`,children:[t(`chat-you`),`: `]}),(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e})]})})}function Hw({messages:e,pending:t,missingMemoryIds:n,readOnly:r,onOpenSource:i,onRetry:a}){let{t:o}=oa();return e.length===0&&!t?(0,H.jsx)(`p`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:o(`chat-empty-thread`)}):(0,H.jsxs)(`ol`,{className:`grid gap-6`,"aria-live":`polite`,children:[e.map(e=>(0,H.jsx)(`li`,{children:e.role===`user`?(0,H.jsx)(Vw,{text:e.content}):(0,H.jsx)(Bw,{message:e,missingMemoryIds:n,readOnly:r,onOpenSource:i,onRetry:a})},e.id)),t?(0,H.jsxs)(`li`,{className:`grid gap-4`,children:[e.at(-1)?.role===`user`&&e.at(-1)?.content===t?null:(0,H.jsx)(Vw,{text:t}),(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),o(`chat-thinking`)]})]}):null]})}var Uw={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function Ww({source:e,deleted:t}){let{t:n,language:r}=oa(),i=e.kind===`memory`;return(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[t?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-border bg-muted/40 p-2.5 text-xs`,children:[(0,H.jsx)(zt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),n(`chat-source-deleted`)]}):null,(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[i&&e.projectName?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-project`)}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words text-foreground`,children:e.projectName})]}):null,i&&e.createdAt?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-date`)}),(0,H.jsx)(`dd`,{className:`text-foreground`,children:Yp(new Date(e.createdAt).toISOString())})]}):null,!i&&e.section?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-profile`)}),(0,H.jsxs)(`dd`,{className:`text-foreground`,children:[n(Uw[e.section]),e.category?` · ${e.category}`:``]})]}):null]}),e.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n(`chat-source-tags`),children:e.tags.map(e=>(0,H.jsx)(rd,{variant:`outline`,children:e},e))}):null,(0,H.jsx)(Mv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[45vh] rounded-lg border`,children:(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words p-3 text-sm leading-6`,children:e.text})}),!i&&e.evidence?.length?(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:n(`chat-source-evidence`)}),(0,H.jsx)(`ul`,{className:`grid gap-1 text-xs`,children:e.evidence.map((e,t)=>(0,H.jsx)(`li`,{dir:`auto`,className:`break-words`,children:e},t))})]}):null,(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`chat-source-note`)}),i?(0,H.jsx)(`a`,{href:J.project,className:`text-xs text-primary-label underline-offset-4 hover:underline`,children:n(`chat-source-open-project`)}):null]})}function Gw({source:e,deleted:t,onClose:n}){let{t:r}=oa();return(0,H.jsx)(K,{open:e!==null,onOpenChange:e=>!e&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:e?`${e.label} · ${e.kind===`memory`?r(`chat-source-memory`):r(`chat-source-profile`)}`:``}),(0,H.jsx)(Wl,{className:`sr-only`,children:e?.text.slice(0,120)})]}),e?(0,H.jsx)(Ww,{source:e,deleted:t}):null]})})}function Kw(){let{t:e}=oa(),t=_w(),[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null),a=(0,v.useRef)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(new Set),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!n)return;let e=i.current;return a.current?.focus(),()=>e?.focus()},[n]);let g=new Set(t.detail?.missingMemoryIds??[]),_=t.list.readOnly,y=t.status?.ready??!1;function b(e){s(e),l(new Set)}async function x(e){e.kind===`folder`?await t.deleteFolder(e.id):await t.deleteChats(e.ids),d(null),b(!1)}let S=(0,H.jsx)(Ew,{chat:t,selectMode:o,selected:c,onSelectMode:b,onSelected:l,onDelete:d,onName:p,onOpened:()=>r(!1)});return(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100svh-9rem)] gap-4 md:grid-cols-[17rem_minmax(0,1fr)]`,children:[(0,H.jsx)(`aside`,{className:`hidden min-h-0 overflow-y-auto border-e border-border pe-4 md:sticky md:top-6 md:block md:max-h-[calc(100svh-3rem)] md:self-start`,children:S}),n?(0,H.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`chat-show-list`),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:[(0,H.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/50`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1)}),(0,H.jsxs)(`div`,{className:`absolute inset-y-0 start-0 flex w-[min(20rem,85vw)] flex-col gap-3 overflow-y-auto bg-background p-4 shadow-xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:e(`chat-conversations`)}),(0,H.jsx)(G,{ref:a,type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1),children:(0,H.jsx)(Kt,{})})]}),S]})]}):null,(0,H.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,children:[(0,H.jsxs)(G,{ref:i,type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(!0),children:[(0,H.jsx)(Qe,{}),e(`chat-show-list`)]}),t.detail?(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-sm text-muted-foreground`,children:t.detail.conversation.title}):null]}),(0,H.jsx)(uw,{}),t.status&&!y?(0,H.jsx)(xw,{status:t.status}):null,_?(0,H.jsx)(`p`,{role:`alert`,className:`rounded-xl border border-border bg-card p-3 text-sm`,children:e(`chat-read-only`)}):null,(0,H.jsx)(`div`,{className:V(`flex min-h-48 flex-1 flex-col overflow-y-auto`),children:(0,H.jsx)(Hw,{messages:t.detail?.messages??[],pending:t.pending,missingMemoryIds:g,readOnly:_||!y,onOpenSource:h,onRetry:t.retry})}),(0,H.jsxs)(`div`,{className:`sticky bottom-0 grid gap-1.5 bg-background pb-1`,children:[(0,H.jsx)(bw,{projects:t.projects,scope:t.scope,scopeMissing:t.scopeMissing,disabled:!y||_||t.pending!==null,onScope:t.setScope,onAsk:e=>void t.ask(e)}),y&&t.status?.apiHost?(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":`true`}),e(`chat-provider-note`,{host:t.status.apiHost})]}):null]})]}),(0,H.jsx)(Dw,{request:u,onConfirm:x,onCancel:()=>d(null)}),(0,H.jsx)(kw,{request:f,onClose:()=>p(null)}),(0,H.jsx)(Gw,{source:m,deleted:!!m&&m.kind===`memory`&&g.has(m.id),onClose:()=>h(null)})]})}var qw=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0,Jw=e=>Array.isArray(e)?e:[],Yw=e=>e&&typeof e==`object`?e:{};function Xw(e){return Jw(e).map(Yw).filter(e=>typeof e.day==`string`).map(e=>({day:e.day,uses:qw(e.uses),failed:qw(e.failed)}))}var Zw=e=>e.map(({day:e,uses:t,failed:n})=>({key:e,uses:t,failed:n})),Qw=[`day`,`month`,`year`],$w=/^\d{4}-(0[1-9]|1[0-2])$/;function eT(e){let t=Yw(e);return{months:Jw(t.months).filter(e=>typeof e==`string`&&$w.test(e)),years:Jw(t.years).filter(e=>Number.isInteger(e))}}function tT(e){let t=Yw(e),n=Yw(t.totals),r=Xw(t.days),i=Array.isArray(t.series)?t.series.map(Yw).filter(e=>typeof e.key==`string`).map(e=>({key:e.key,uses:qw(e.uses),failed:qw(e.failed)})):Zw(r),a=Jw(t.topSkills).map(Yw).filter(e=>typeof e.name==`string`).map(e=>({name:e.name,path:typeof e.path==`string`?e.path:null,uses:qw(e.uses),failed:qw(e.failed)}));return{bucket:Qw.includes(t.bucket)?t.bucket:`day`,series:i,days:r,topSkills:a,topTotal:Math.max(qw(t.topTotal),a.length),totals:{uses:qw(n.uses),failed:qw(n.failed),activeSkills:qw(n.activeSkills)},available:eT(t.available)}}var nT=[`created`,`applied`,`rejected`,`undone`,`stale`];function rT(e){let t=Yw(e),n=Jw(t.entries).map(Yw).filter(e=>nT.includes(e.kind)&&typeof e.id==`string`).map(e=>({id:e.id,proposalId:typeof e.proposalId==`string`?e.proposalId:``,kind:e.kind,at:qw(e.at),summary:typeof e.summary==`string`?e.summary:``,appliedBy:typeof e.appliedBy==`string`?e.appliedBy:null,versionId:typeof e.versionId==`string`?e.versionId:null,canUndo:e.canUndo===!0,laterAppliedCount:qw(e.laterAppliedCount),added:qw(e.added),removed:qw(e.removed)}));return{total:Math.max(qw(t.total),n.length),entries:n}}var iT=e=>e.every(e=>e.uses===0),aT=e=>({...e,succeeded:Math.max(0,e.uses-e.failed),failed:Math.min(e.failed,e.uses)}),oT=[`pending`,`applied`,`rejected`,`stale`,`undone`];function sT(e){return oT.map(t=>({state:t,count:e.filter(e=>e.state===t).length}))}var cT=e=>Date.parse(`${e}T12:00:00`),lT={bucket:`day`,month:null},uT=`omms-skills-activity-range`,dT=`last-30`,fT=30,pT=(e,t)=>Math.min(t,e+8),mT={day:`Uses per day`,month:`Uses per month`,year:`Uses per year`},hT={day:`Day`,month:`Month`,year:`Year`};function gT(e){return e.bucket===`year`?{bucket:`year`}:e.bucket===`month`?{bucket:`month`,year:e.year}:e.month?{bucket:`day`,month:e.month}:{bucket:`day`,days:fT}}function _T(e){return e.bucket===`year`?`year`:e.bucket===`month`?`month:${e.year}`:e.month?`day:${e.month}`:`day`}function vT(e){if(e===`year`)return{bucket:`year`};let t=/^day:(\d{4}-\d{2})$/.exec(e??``)?.[1];if(t&&$w.test(t))return{bucket:`day`,month:t};let n=/^month:(\d{4})$/.exec(e??``)?.[1];return n?{bucket:`month`,year:Number(n)}:lT}function yT(e,t){return e.bucket===`day`&&e.month&&!t.months.includes(e.month)||e.bucket===`month`&&!t.years.includes(e.year)?lT:e}function bT(e,t){return e===`year`?{bucket:e}:e===`month`?{bucket:e,year:t}:lT}var xT=e=>e.bucket===`month`?String(e.year):e.bucket===`day`?e.month??`last-30`:``;function ST(e,t){return e.bucket===`month`?{bucket:`month`,year:Number(t)}:t===`last-30`?lT:{bucket:`day`,month:t}}function CT(e,t,n,r){if(e===`year`)return t;if(e===`day`){let e=new Date(cT(t));return n?Oi(e,r.choice,r.locale):Di(e,r.choice,r.locale)}let[i,a]=t.split(`-`).map(Number);return new Intl.DateTimeFormat(r.locale,{month:n?`long`:`short`,...n?{year:`numeric`}:{},timeZone:`UTC`,calendar:`gregory`}).format(Date.UTC(i,a-1,1))}function wT(e,t,n,r){if(e.bucket===`month`)return String(e.year);if(e.bucket===`day`)return e.month?CT(`month`,e.month,!0,n):r(`Last 30 days`);let i=t[0]?.key??``,a=t.at(-1)?.key??``;return i===a?a:zb(r(`{from} to {to}`),{from:i,to:a})}function TT(e,t,n,r,i){if(e.bucket===`year`)return[];if(e.bucket===`month`)return[...new Set([n,e.year,...t.years])].sort((e,t)=>t-e).map(e=>({value:String(e),label:String(e)}));let a=[...new Set([...e.month?[e.month]:[],...t.months])];return[{value:dT,label:i},...a.sort((e,t)=>t.localeCompare(e)).map(e=>({value:e,label:CT(`month`,e,!0,r)}))]}var ET=[`day`,`month`,`year`],DT={day:`Days`,month:`Months`,year:`Years`},OT={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function kT({range:e,available:t,currentYear:n,loading:r,onChange:i}){let a=X(),o=(0,v.useRef)([]),s=t=>{let r=ET[t];o.current[t]?.focus(),r!==e.bucket&&i(bT(r,n))};return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":a(`Show uses by`),className:`inline-flex gap-1.5`,onKeyDown:t=>{let n=OT[t.key];if(!n)return;t.preventDefault();let r=getComputedStyle(t.currentTarget).direction===`rtl`,i=t.key===`ArrowLeft`||t.key===`ArrowRight`,a=r&&i?-n:n,o=ET.indexOf(e.bucket);s((o+a+ET.length)%ET.length)},children:ET.map((t,n)=>(0,H.jsx)(`button`,{ref:e=>{o.current[n]=e},type:`button`,role:`radio`,"aria-checked":e.bucket===t,tabIndex:e.bucket===t?0:-1,className:V(`min-h-9 rounded-[10px] border px-3 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring`,e.bucket===t?`border-primary/40 bg-selection text-foreground`:`border-input bg-card text-muted-foreground hover:bg-interactive-hover`),onClick:()=>s(n),children:a(DT[t])},t))}),e.bucket===`year`?(0,H.jsx)(`span`,{className:`h-9 w-44`,"aria-hidden":`true`}):(0,H.jsx)(Er,{className:`w-44`,"aria-label":a(e.bucket===`day`?`Days to show`:`Year to show`),value:xT(e),onChange:t=>i(ST(e,t.target.value)),children:TT(e,t,n,$p(),a(`Last 30 days`)).map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,H.jsx)(Je,{"aria-hidden":`true`,className:V(`size-4 animate-spin text-muted-foreground`,!r&&`invisible`)}),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:r?a(`Loading…`):``})]})}var AT=`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`.split(`.`);function jT(e){return typeof e==`string`&&AT.includes(e)}var MT=new Set(`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`.split(`.`));function NT(e){return typeof e==`string`&&MT.has(e)}function PT(e){return typeof e==`string`&&e.startsWith(`data-`)}function FT(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(NT(n)||PT(n))&&(t[n]=e[n]);return t}function IT(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return FT(t)}return typeof e==`object`&&!Array.isArray(e)?FT(e):null}function LT(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(NT(n)||PT(n)||jT(n))&&(t[n]=e[n]);return t}var RT=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function zT(){return zT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zT.apply(null,arguments)}function BT(e,t){if(e==null)return{};var n,r,i=VT(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function VT(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var HT=(0,v.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:c,desc:l}=e,u=BT(e,RT),d=a||{width:r,height:i,x:0,y:0},f=Yt(`recharts-surface`,o);return v.createElement(`svg`,zT({},LT(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),UT=[`children`,`className`];function WT(){return WT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},WT.apply(null,arguments)}function GT(e,t){if(e==null)return{};var n,r,i=KT(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function KT(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var qT=v.forwardRef((e,t)=>{var{children:n,className:r}=e,i=GT(e,UT),a=Yt(`recharts-layer`,r);return v.createElement(`g`,WT({className:a},LT(i),{ref:t}),n)}),JT=(0,v.createContext)(null);function YT(e){return function(){return e}}var XT=Math.cos,ZT=Math.sin,QT=Math.sqrt,$T=Math.PI;$T/2;var eE=2*$T,tE=Math.PI,nE=2*tE,rE=1e-6,iE=nE-rE;function aE(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function oE(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return aE;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var sE=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?aE:oE(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>rE){if(!(Math.abs(u*s-c*l)>rE)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((tE-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>rE&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>rE||Math.abs(this._y1-l)>rE)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%nE+nE),d>iE?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>rE&&this._append`A${n},${n},0,${+(d>=tE)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};sE.prototype;function cE(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new sE(t)}Array.prototype.slice;function lE(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function uE(e){this._context=e}uE.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)}}};function dE(e){return new uE(e)}function fE(e){return e[0]}function pE(e){return e[1]}function mE(e,t){var n=YT(!0),r=null,i=dE,a=null,o=cE(s);e=typeof e==`function`?e:e===void 0?fE:YT(e),t=typeof t==`function`?t:t===void 0?pE:YT(t);function s(s){var c,l=(s=lE(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:YT(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:YT(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:YT(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function hE(e,t,n){var r=null,i=YT(!0),a=null,o=dE,s=null,c=cE(l);e=typeof e==`function`?e:e===void 0?fE:YT(+e),t=typeof t==`function`?t:YT(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?pE:YT(+n);function l(l){var u,d,f,p=(l=lE(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return mE().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:YT(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:YT(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:YT(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:YT(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:YT(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:YT(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:YT(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var gE=class{constructor(e,t){this._context=e,this._x=t}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(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._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function _E(e){return new gE(e,!0)}function vE(e){return new gE(e,!1)}var yE={draw(e,t){let n=QT(t/$T);e.moveTo(n,0),e.arc(0,0,n,0,eE)}},bE={draw(e,t){let n=QT(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},xE=QT(1/3),SE=xE*2,CE={draw(e,t){let n=QT(t/SE),r=n*xE;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},wE={draw(e,t){let n=QT(t),r=-n/2;e.rect(r,r,n,n)}},TE=.8908130915292852,EE=ZT($T/10)/ZT(7*$T/10),DE=ZT(eE/10)*EE,OE=-XT(eE/10)*EE,kE={draw(e,t){let n=QT(t*TE),r=DE*n,i=OE*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=eE*t/5,o=XT(a),s=ZT(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},AE=QT(3),jE={draw(e,t){let n=-QT(t/(AE*3));e.moveTo(0,n*2),e.lineTo(-AE*n,-n),e.lineTo(AE*n,-n),e.closePath()}},ME=-.5,NE=QT(3)/2,PE=1/QT(12),FE=(PE/2+1)*3,IE={draw(e,t){let n=QT(t/FE),r=n/2,i=n*PE,a=r,o=n*PE+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(ME*r-NE*i,NE*r+ME*i),e.lineTo(ME*a-NE*o,NE*a+ME*o),e.lineTo(ME*s-NE*c,NE*s+ME*c),e.lineTo(ME*r+NE*i,ME*i-NE*r),e.lineTo(ME*a+NE*o,ME*o-NE*a),e.lineTo(ME*s+NE*c,ME*c-NE*s),e.closePath()}};function LE(e,t){let n=null,r=cE(i);e=typeof e==`function`?e:YT(e||yE),t=typeof t==`function`?t:YT(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:YT(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:YT(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function RE(){}function zE(e,t,n){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+n)/6)}function BE(e){this._context=e}BE.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:zE(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(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:zE(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function VE(e){return new BE(e)}function HE(e){this._context=e}HE.prototype={areaStart:RE,areaEnd:RE,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)}},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:zE(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function UE(e){return new HE(e)}function WE(e){this._context=e}WE.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 n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:zE(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function GE(e){return new WE(e)}function KE(e){this._context=e}KE.prototype={areaStart:RE,areaEnd:RE,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 qE(e){return new KE(e)}function JE(e){return e<0?-1:1}function YE(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(JE(a)+JE(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function XE(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ZE(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function QE(e){this._context=e}QE.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:ZE(this,this._t0,XE(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=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,ZE(this,XE(this,n=YE(this,e,t)),n);break;default:ZE(this,this._t0,n=YE(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function $E(e){this._context=new eD(e)}($E.prototype=Object.create(QE.prototype)).point=function(e,t){QE.prototype.point.call(this,t,e)};function eD(e){this._context=e}eD.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,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function tD(e){return new QE(e)}function nD(e){return new $E(e)}function rD(e){this._context=e}rD.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,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=iD(e),i=iD(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===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 iD(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function aD(e){return new rD(e)}function oD(e,t){this._context=e,this._t=t}oD.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 n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function sD(e){return new oD(e,.5)}function cD(e){return new oD(e,0)}function lD(e){return new oD(e,1)}function uD(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function dD(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function fD(e,t){return e[t]}function pD(e){let t=[];return t.key=e,t}function mD(){var e=YT([]),t=dD,n=uD,r=fD;function i(i){var a=Array.from(e.apply(this,arguments),pD),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=lE(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:YT(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:YT(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?dD:typeof e==`function`?e:YT(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??uD,i):n},i}function hD(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}uD(e,t)}}function gD(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}uD(e,t)}}function _D(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,uD(e,t)}}function vD(e){return e===`__proto__`}var yD=Object.prototype.hasOwnProperty;function bD(e,t){return yD.call(e,t)}var xD=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function SD(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:xD.test(e);default:return!1}}function CD(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function wD(e){return typeof e==`symbol`||e instanceof Symbol}function TD(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n<e.length;n++)n>0&&(t+=`,`),t+=TD(e[n]);return t}if(wD(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function ED(e){return e==null?``:TD(e)}function DD(e){if(Array.isArray(e))return e.map(CD);if(typeof e==`symbol`)return[e];e=ED(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let l=e[r];if(a)l===`\\`&&r+1<n?(r++,i+=e[r]):l===a?a=``:i+=l;else if(o){if(l===`"`||l===`'`)a=l,s=!0;else if(l===`]`){if(o=!1,!s&&i.includes(`.`)&&!c.test(i)){let e=i.split(`.`);for(let n=0;n<e.length;n++)e[n]!==``&&t.push(e[n])}else t.push(i);i=``}else i+=l}else if(l===`[`)o=!0,s=!1,i&&=(t.push(i),``);else if(l===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=l;r++}return i&&t.push(i),t}function OD(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(vD(t))return n;let r=e[t];return r===void 0?SD(t)&&!bD(e,t)?OD(e,DD(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=CD(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return kD(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),vD(t))return n;let r=e[t];return r===void 0?n:r}}}function kD(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||vD(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var AD=4;function jD(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:AD),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function MD(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+jD(i)+n},``)}var ND=e=>e===0?0:e>0?1:-1,PD=e=>typeof e==`number`&&e!=+e,FD=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,Z=e=>(typeof e==`number`||e instanceof Number)&&!PD(e),ID=e=>Z(e)||typeof e==`string`,LD=0,RD=e=>{var t=++LD;return`${e||``}${t}`},zD=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!Z(e)&&typeof e!=`string`)return n;var i;if(FD(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return PD(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},BD=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function VD(e,t,n){return Z(e)&&Z(t)?jD(e+n*(t-e)):t}function HD(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):OD(e,t))===n)}var UD=e=>e==null,WD=e=>UD(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function GD(e){return e!=null}function KD(){}var qD=[`type`,`size`,`sizeType`];function JD(){return JD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},JD.apply(null,arguments)}function YD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?YD(Object(n),!0).forEach(function(t){ZD(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YD(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ZD(e,t,n){return(t=QD(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QD(e){var t=$D(e,`string`);return typeof t==`symbol`?t:t+``}function $D(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function eO(e,t){if(e==null)return{};var n,r,i=tO(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function tO(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var nO={symbolCircle:yE,symbolCross:bE,symbolDiamond:CE,symbolSquare:wE,symbolStar:kE,symbolTriangle:jE,symbolWye:IE},rO=Math.PI/180,iO=e=>nO[`symbol${WD(e)}`]||yE,aO=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*rO;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**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}},oO=(e,t)=>{nO[`symbol${WD(e)}`]=t},sO=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=XD(XD({},eO(e,qD)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=iO(a),t=LE().type(e).size(aO(n,r,a))();if(t!==null)return t},{className:s,cx:c,cy:l}=i,u=LT(i);return Z(c)&&Z(l)&&Z(n)?v.createElement(`path`,JD({},u,{className:Yt(`recharts-symbols`,s),transform:`translate(${c}, ${l})`,d:o()})):null};sO.registerSymbol=oO;var cO=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,lO=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{jT(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},uO=(e,t,n)=>r=>(e(t,n,r),null),dO=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];jT(i)&&typeof a==`function`&&(r||={},r[i]=uO(a,t,n))}),r};function fO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fO(Object(n),!0).forEach(function(t){mO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mO(e,t,n){return(t=hO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hO(e){var t=gO(e,`string`);return typeof t==`symbol`?t:t+``}function gO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _O(e,t){var n=pO({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function vO(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function yO(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function bO(e){return e}function xO(e){return Number.isSafeInteger(e)&&e>=0}function SO(e){return e!=null&&typeof e!=`function`&&xO(e.length)}function CO(e){return function(t){return OD(t,e)}}function wO(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function TO(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var EO=`[object RegExp]`,DO=`[object String]`,OO=`[object Number]`,kO=`[object Boolean]`,AO=`[object Arguments]`,jO=`[object Symbol]`,MO=`[object Date]`,NO=`[object Map]`,PO=`[object Set]`,FO=`[object Array]`,IO=`[object ArrayBuffer]`,LO=`[object Object]`,RO=`[object DataView]`,zO=`[object Uint8Array]`,BO=`[object Uint8ClampedArray]`,VO=`[object Uint16Array]`,HO=`[object Uint32Array]`,UO=`[object Int8Array]`,WO=`[object Int16Array]`,GO=`[object Int32Array]`,KO=`[object Float32Array]`,qO=`[object Float64Array]`;function JO(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function YO(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function XO(e,t,n){return typeof n==`function`?ZO(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?ZO(t,r,e,s,!1):!!c},new Map,!0):XO(e,t,()=>void 0)}function ZO(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return QO(e,t,n,r,i);case`function`:return Object.keys(t).length>0?ZO(e,Object.assign({},t),n,r,i):JO(e,t);default:return YO(e)&&i?typeof t!=`string`||t===``:JO(e,t)}}function QO(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return ek(e,t,n,r);if(t instanceof Map)return $O(e,t,n,r);if(t instanceof Set)return tk(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)wO(e)&&(e=Object(e));else{if(TO(t)===`[object Error]`)return TO(e)===`[object Error]`&&e.name===t.name&&e.message===t.message;let n=TO(e);if(n!==`[object Object]`&&n!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;i<a.length;i++){let o=a[i];if(!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function $O(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function ek(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function tk(e,t,n,r){return t.size===0||e instanceof Set&&ek([...e],[...t],n,r)}function nk(e,t){return XO(e,t,()=>void 0)}function rk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var ik=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function ak(e){return ik.Buffer!==void 0&&ik.Buffer.isBuffer(e)}function ok(e){return ak(e)}function sk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ck(e){return sk(e)}function lk(e,t){return uk(e,void 0,e,new Map,t)}function uk(e,t,n,r,i){if(i!=null){let a=i(e,t,n,r);if(a!==void 0)return a}if(wO(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=uk(e[a],a,n,r,i);return bD(e,`index`)&&(t.index=e.index),bD(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;return r.set(e,t),e.forEach((e,a)=>{t.set(a,uk(e,a,n,r,i))}),t}if(e instanceof Set){let t=new Set;return r.set(e,t),e.forEach(e=>{t.add(uk(e,void 0,n,r,i))}),t}if(ok(e))return e.subarray();if(ck(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=uk(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),dk(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),dk(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),dk(t,e,n,r,i),t}let a=TO(e);if(a===`[object Error]`)return e===n?{}:e;switch(a){case OO:case DO:case kO:{let t=new e.constructor(e.valueOf());return r.set(e,t),dk(t,e,n,r,i),t}case AO:{let t={};return r.set(e,t),dk(t,e,n,r,i),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}}if(typeof e==`object`&&fk(a)){let t=a===`[object Object]`&&typeof e.constructor!=`function`?{}:Object.create(Object.getPrototypeOf(e));return r.set(e,t),dk(t,e,n,r,i),t}return e}function dk(e,t,n,r,i){let a=[...Object.keys(t),...rk(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=uk(t[s],s,n,r,i))}}function fk(e){switch(e){case AO:case FO:case IO:case RO:case kO:case MO:case KO:case qO:case UO:case WO:case GO:case NO:case OO:case LO:case EO:case PO:case DO:case jO:case zO:case BO:case VO:case HO:return!0;default:return!1}}function pk(e){return lk(e)}function mk(e){return e=pk(e),t=>nk(t,e)}var hk=/^(?:0|[1-9]\d*)$/;function gk(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return hk.test(e)}}function _k(e){return typeof e==`object`&&!!e&&TO(e)===`[object Arguments]`}function vk(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&SD(t)&&!(t in Object(e))?DD(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=CD(n[e]);if((r==null||!bD(r,t))&&!((Array.isArray(r)||_k(r))&&gk(t)&&Number(t)<r.length))return!1;r=r[t]}return!0}function yk(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=CD(e)}return t=pk(t),function(n){let r=OD(n,e);return r===void 0?vk(n,e):t===void 0?r===void 0:nk(r,t)}}function bk(e){if(e==null)return bO;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?yk(e[0],e[1]):mk(e);default:return CO(e)}}function xk(e){return e===0?0:e}function Sk(e,t=bO){return SO(e)?vO(Array.from(e),yO(bk(t),1)).map(xk):[]}function Ck(e,t,n){return t===!0?Sk(e,n):typeof t==`function`?Sk(e,t):e}var wk=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Tk=o(((e,t)=>{t.exports=wk()})),Ek=o((e=>{var t=d(),n=Tk();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Dk=o(((e,t)=>{t.exports=Ek()})),Ok=(0,v.createContext)(null),kk=Dk(),Ak=e=>e,jk=()=>{var e=(0,v.useContext)(Ok);return e?e.store.dispatch:Ak},Mk=()=>{},Nk=()=>Mk,Pk=(e,t)=>e===t;function Q(e){var t=(0,v.useContext)(Ok),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Mk,[t,e]);return(0,kk.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Nk,t?t.store.getState:Mk,t?t.store.getState:Mk,n,Pk)}function Fk(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Ik(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Lk(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Rk=e=>Array.isArray(e)?e:[e];function zk(e){let t=Array.isArray(e[0])?e[0]:e;return Lk(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Bk(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Vk=class{constructor(e){this.value=e}deref(){return this.value}},Hk=typeof WeakRef<`u`?WeakRef:Vk,Uk=0,Wk=1;function Gk(){return{s:Uk,v:void 0,o:null,p:null}}function Kk(e,t={}){let n=Gk(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=Gk(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=Gk(),e.set(n,t)):t=r}}let s=t,c;if(t.s===Wk)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Hk(c):c}return s.s=Wk,s.v=c,c}return o.clearCache=()=>{n=Gk(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function qk(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Fk(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=Kk,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=Rk(c),p=Rk(u),m=zk(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Bk(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=qk(Kk),Jk=Object.assign((e,t=$)=>{Ik(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Jk});function Yk(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function Xk(e,t,n){return YO(n)&&(typeof t==`number`&&SO(n)&&gk(t)&&t<n.length||typeof t==`string`&&t in n)?JO(n[t],e):!1}function Zk(e){let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n}function Qk(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var $k=(e,t,n)=>{if(e!==t){let r=Qk(e),i=Qk(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},eA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tA=/^\w*$/;function nA(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||wD(e)?!0:typeof e==`string`&&(tA.test(e)||!eA.test(e))||t!=null&&bD(t,e)}function rA(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=SO(e)?Array.from(e):Zk(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r<t.length&&n!=null;++r)n=n[t[r]];return r>0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?bD(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||nA(e)?e:{key:e,path:DD(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=$k(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function iA(e,...t){let n=t.length;return n>1&&Xk(e,t[0],t[1])?t=[]:n>2&&Xk(t[0],t[1],t[2])&&(t=[t[0]]),rA(e,Yk(t),[`asc`])}var aA=e=>e.legend.settings,oA=e=>e.legend.size;$([e=>e.legend.payload,aA],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?iA(r,n):r});var sA=1;function cA(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,v.useState)({height:0,left:0,top:0,width:0});return[t,(0,v.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>sA||Math.abs(i.left-t.left)>sA||Math.abs(i.top-t.top)>sA||Math.abs(i.width-t.width)>sA)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function lA(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 uA=typeof Symbol==`function`&&Symbol.observable||`@@observable`,dA=()=>Math.random().toString(36).substring(7).split(``).join(`.`),fA={INIT:`@@redux/INIT${dA()}`,REPLACE:`@@redux/REPLACE${dA()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${dA()}`};function pA(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function mA(e,t,n){if(typeof e!=`function`)throw Error(lA(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(lA(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(lA(1));return n(mA)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(lA(3));return i}function d(e){if(typeof e!=`function`)throw Error(lA(4));if(c)throw Error(lA(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(lA(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!pA(e))throw Error(lA(7));if(e.type===void 0)throw Error(lA(8));if(typeof e.type!=`string`)throw Error(lA(17));if(c)throw Error(lA(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(lA(10));r=e,f({type:fA.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(lA(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[uA](){return this}}}return f({type:fA.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[uA]:m}}function hA(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:fA.INIT})===void 0)throw Error(lA(12));if(n(void 0,{type:fA.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(lA(13))})}function gA(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{hA(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(lA(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function _A(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function vA(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(lA(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=_A(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function yA(e){return pA(e)&&`type`in e&&typeof e.type==`string`}var bA=Symbol.for(`immer-nothing`),xA=Symbol.for(`immer-draftable`),SA=Symbol.for(`immer-state`);function CA(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var wA=Object,TA=wA.getPrototypeOf,EA=`constructor`,DA=`prototype`,OA=`configurable`,kA=`enumerable`,AA=`writable`,jA=`value`,MA=e=>!!e&&!!e[SA];function NA(e){return e?IA(e)||UA(e)||!!e[xA]||!!e[EA]?.[xA]||WA(e)||GA(e):!1}var PA=wA[DA][EA].toString(),FA=new WeakMap;function IA(e){if(!e||!KA(e))return!1;let t=TA(e);if(t===null||t===wA[DA])return!0;let n=wA.hasOwnProperty.call(t,EA)&&t[EA];if(n===Object)return!0;if(!qA(n))return!1;let r=FA.get(n);return r===void 0&&(r=Function.toString.call(n),FA.set(n,r)),r===PA}function LA(e,t,n=!0){RA(e)===0?(n?Reflect.ownKeys(e):wA.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function RA(e){let t=e[SA];return t?t.type_:UA(e)?1:WA(e)?2:GA(e)?3:0}var zA=(e,t,n=RA(e))=>n===2?e.has(t):wA[DA].hasOwnProperty.call(e,t),BA=(e,t,n=RA(e))=>n===2?e.get(t):e[t],VA=(e,t,n,r=RA(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function HA(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var UA=Array.isArray,WA=e=>e instanceof Map,GA=e=>e instanceof Set,KA=e=>typeof e==`object`,qA=e=>typeof e==`function`,JA=e=>typeof e==`boolean`;function YA(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var XA=e=>e.copy_||e.base_,ZA=e=>e.modified_?e.copy_:e.base_;function QA(e,t){if(WA(e))return new Map(e);if(GA(e))return new Set(e);if(UA(e))return Array[DA].slice.call(e);let n=IA(e);if(t===!0||t===`class_only`&&!n){let t=wA.getOwnPropertyDescriptors(e);delete t[SA];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[AA]===!1&&(a[AA]=!0,a[OA]=!0),(a.get||a.set)&&(t[i]={[OA]:!0,[AA]:!0,[kA]:a[kA],[jA]:e[i]})}return wA.create(TA(e),t)}{let t=TA(e);if(t!==null&&n)return{...e};let r=wA.create(t);return wA.assign(r,e)}}function $A(e,t=!1){return nj(e)||MA(e)||!NA(e)?e:(RA(e)>1&&wA.defineProperties(e,{set:tj,add:tj,clear:tj,delete:tj}),wA.freeze(e),t&&LA(e,(e,t)=>{$A(t,!0)},!1),e)}function ej(){CA(2)}var tj={[jA]:ej};function nj(e){return e===null||!KA(e)||wA.isFrozen(e)}var rj=`MapSet`,ij=`Patches`,aj=`ArrayMethods`,oj={};function sj(e){let t=oj[e];return t||CA(0,e),t}var cj=e=>!!oj[e],lj,uj=()=>lj,dj=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:cj(rj)?sj(rj):void 0,arrayMethodsPlugin_:cj(aj)?sj(aj):void 0});function fj(e,t){t&&(e.patchPlugin_=sj(ij),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function pj(e){mj(e),e.drafts_.forEach(gj),e.drafts_=null}function mj(e){e===lj&&(lj=e.parent_)}var hj=e=>lj=dj(lj,e);function gj(e){let t=e[SA];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function _j(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[SA].modified_&&(pj(t),CA(4)),NA(e)&&(e=vj(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[SA].base_,e,t)}else e=vj(t,n);return yj(t,e,!0),pj(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===bA?void 0:e}function vj(e,t){if(nj(t))return t;let n=t[SA];if(!n)return Dj(t,e.handledSet_,e);if(!xj(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);Tj(n,e)}return n.copy_}function yj(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&$A(t,n)}function bj(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var xj=(e,t)=>e.scope_===t,Sj=[];function Cj(e,t,n,r){let i=XA(e),a=e.type_;if(r!==void 0&&BA(i,r,a)===t){VA(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;LA(i,(e,n)=>{if(MA(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Sj;for(let e of o)VA(i,e,n,a)}function wj(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!xj(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=ZA(i);Cj(e,i.draft_??i,a,n),Tj(i,r)})}function Tj(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}bj(e)}}function Ej(e,t,n){let{scope_:r}=e;if(MA(n)){let i=n[SA];xj(i,r)&&i.callbacks_.push(function(){Ij(e),Cj(e,n,ZA(i),t)})}else NA(n)&&e.callbacks_.push(function(){let i=XA(e);e.type_===3?i.has(n)&&Dj(n,r.handledSet_,r):BA(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Dj(BA(e.copy_,t,e.type_),r.handledSet_,r)})}function Dj(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||MA(e)||t.has(e)||!NA(e)||nj(e)?e:(t.add(e),LA(e,(r,i)=>{if(MA(i)){let t=i[SA];xj(t,n)&&(VA(e,r,ZA(t),e.type_),bj(t))}else NA(i)&&Dj(i,t,n)}),e)}function Oj(e,t){let n=UA(e),r={type_:+!!n,scope_:t?t.scope_:uj(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=kj;n&&(i=[r],a=Aj);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var kj={get(e,t){if(t===SA)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=XA(e);if(!zA(i,t,e.type_))return Nj(e,i,t);let a=i[t];if(e.finalized_||!NA(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&YA(t))return a;if(a===jj(e.base_,t)||Mj(e,t,a)){Ij(e);let n=e.type_===1?+t:t,r=Rj(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in XA(e)},ownKeys(e){return Reflect.ownKeys(XA(e))},set(e,t,n){let r=Pj(XA(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=jj(XA(e),t),i=r?.[SA];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(HA(n,r)&&(n!==void 0||zA(e.base_,t,e.type_)))return!0;Ij(e),Fj(e)}return e.copy_[t]===n&&(n!==void 0||zA(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Ej(e,t,n),!0)},deleteProperty(e,t){return Ij(e),jj(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Fj(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=XA(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[AA]:!0,[OA]:e.type_!==1||t!==`length`,[kA]:r[kA],[jA]:n[t]}},defineProperty(){CA(11)},getPrototypeOf(e){return TA(e.base_)},setPrototypeOf(){CA(12)}},Aj={};for(let e in kj){let t=kj[e];Aj[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}Aj.deleteProperty=function(e,t){return Aj.set.call(this,e,t,void 0)},Aj.set=function(e,t,n){return kj.set.call(this,e[0],t,n,e[0])};function jj(e,t){let n=e[SA];return(n?XA(n):e)[t]}function Mj(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!NA(n)||n[SA]?!1:e.baseRefs_.has(n)}function Nj(e,t,n){let r=Pj(t,n);return r?jA in r?r[jA]:r.get?.call(e.draft_):void 0}function Pj(e,t){if(!(t in e))return;let n=TA(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=TA(n)}}function Fj(e){e.modified_||(e.modified_=!0,e.parent_&&Fj(e.parent_))}function Ij(e){e.copy_||=(e.assigned_=new Map,QA(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Lj=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(qA(e)&&!qA(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}qA(t)||CA(6),n!==void 0&&!qA(n)&&CA(7);let r;if(NA(e)){let i=hj(this),a=Rj(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?pj(i):mj(i)}return fj(i,n),_j(r,i)}if(!e||!KA(e)){if(r=t(e),r===void 0&&(r=e),r===bA&&(r=void 0),this.autoFreeze_&&$A(r,!0),n){let t=[],i=[];sj(ij).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}CA(1,e)},this.produceWithPatches=(e,t)=>{if(qA(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},JA(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),JA(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),JA(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){NA(e)||CA(8),MA(e)&&(e=zj(e));let t=hj(this),n=Rj(t,e,void 0);return n[SA].isManual_=!0,mj(t),n}finishDraft(e,t){let n=e&&e[SA];(!n||!n.isManual_)&&CA(9);let{scope_:r}=n;return fj(r,t),_j(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=sj(ij).applyPatches_;return MA(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Rj(e,t,n,r){let[i,a]=WA(t)?sj(rj).proxyMap_(t,n):GA(t)?sj(rj).proxySet_(t,n):Oj(t,n);return(n?.scope_??uj()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?wj(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function zj(e){return MA(e)||CA(10,e),Bj(e)}function Bj(e){if(!NA(e)||nj(e))return e;let t=e[SA],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=QA(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=QA(e,!0);let i=n;return GA(n)&&(n=new Set),LA(i,(e,t)=>{VA(n,e,Bj(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var Vj=new Lj().produce;function Hj(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Uj=Hj(),Wj=Hj,Gj=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?_A:_A.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function Kj(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(tN(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>yA(t)&&t.type===e,n}var qj=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Jj(e){return NA(e)?Vj(e,()=>{}):e}function Yj(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Xj(e){return typeof e==`boolean`}var Zj=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new qj;return t&&(Xj(t)?a.push(Uj):a.push(Wj(t.extraArgument))),a},Qj=`RTK_autoBatch`,$j=()=>e=>({payload:e,meta:{[Qj]:!0}}),eM=e=>t=>{setTimeout(t,e)},tM=(e,t)=>n=>{let r=!1,i,a,o=()=>{r||(r=!0,cancelAnimationFrame(i),clearTimeout(a),n())};i=e(o),a=setTimeout(o,t)},nM=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?tM(window.requestAnimationFrame,100):eM(10):e.type===`callback`?e.queueNotification:eM(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Qj],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},rM=e=>function(t){let{autoBatch:n=!0}=t??{},r=new qj(e);return n&&r.push(nM(typeof n==`object`?n:void 0)),r};function iM(e){let t=Zj(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(pA(n))c=gA(n);else throw Error(tN(1));let l;l=typeof r==`function`?r(t):t();let u=_A;i&&(u=Gj({trace:!1,...typeof i==`object`&&i}));let d=rM(vA(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return mA(c,o,p)}function aM(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(tN(28));if(r in t)throw Error(tN(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function oM(e){return typeof e==`function`}function sM(e,t){let[n,r,i]=aM(t),a;if(oM(e))a=()=>Jj(e());else{let t=Jj(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(MA(e)){let r=n(e,t);return r===void 0?e:r}if(NA(e))return Vj(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(tN(9))}return r}}return e},e)}return o.getInitialState=a,o}var cM=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,lM=(e=21)=>{let t=``,n=e;for(;n--;)t+=cM[Math.random()*64|0];return t},uM=Symbol.for(`rtk-slice-createasyncthunk`);function dM(e,t){return`${e}/${t}`}function fM({creators:e}={}){let t=e?.asyncThunk?.[uM];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(tN(11));let i=(typeof e.reducers==`function`?e.reducers(hM()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(tN(12));if(n in o.sliceCaseReducersByType)throw Error(tN(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:dM(n,r),createNotation:typeof e.reducers==`function`};_M(a)?yM(o,a,s,t):gM(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?aM(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return sM(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=Yj(d,r,m)),i}function i(t=l){return Yj(Yj(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=pM(a,t,()=>Yj(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function pM(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var mM=fM();function hM(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function gM({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!vM(r))throw Error(tN(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Kj(e,o):Kj(e))}function _M(e){return e._reducerDefinitionType===`asyncThunk`}function vM(e){return e._reducerDefinitionType===`reducerWithPrepare`}function yM({type:e,reducerName:t},n,r,i){if(!i)throw Error(tN(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||bM,pending:s||bM,rejected:c||bM,settled:l||bM})}function bM(){}var xM=`task`,SM=`listener`,CM=`completed`,wM=`cancelled`,TM=`task-${wM}`,EM=`task-${CM}`,DM=`${SM}-${wM}`,OM=`${SM}-${CM}`,kM=class{code;name=`TaskAbortError`;message;constructor(e){this.code=e,this.message=`${xM} ${wM} (reason: ${e})`}},AM=(e,t)=>{if(typeof e!=`function`)throw TypeError(tN(32))},jM=()=>{},MM=(e,t=jM)=>(e.catch(t),e),NM=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),PM=e=>{if(e.aborted)throw new kM(e.reason)};function FM(e,t){let n=jM;return new Promise((r,i)=>{let a=()=>i(new kM(e.reason));if(e.aborted){a();return}n=NM(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=jM})}var IM=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof kM?`cancelled`:`rejected`,error:e}}finally{t?.()}},LM=e=>t=>MM(FM(e,t).then(t=>(PM(e),t))),RM=e=>{let t=LM(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:zM}=Object,BM={},VM=`listenerMiddleware`,HM=(e,t)=>{let n=t=>NM(e,()=>t.abort(e.reason));return(r,i)=>{AM(r,`taskExecutor`);let a=new AbortController;n(a);let o=IM(async()=>{PM(e),PM(a.signal);let t=await r({pause:LM(a.signal),delay:RM(a.signal),signal:a.signal});return PM(a.signal),t},()=>a.abort(EM));return i?.autoJoin&&t.push(o.catch(jM)),{result:LM(e)(o),cancel(){a.abort(TM)}}}},UM=(e,t)=>{let n=async(n,r)=>{PM(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await FM(t,Promise.race(a));return PM(t),e}finally{i()}};return((e,t)=>MM(n(e,t)))},WM=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Kj(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(tN(21));return AM(a,`options.listener`),{predicate:i,type:t,effect:a}},GM=zM(e=>{let{type:t,predicate:n,effect:r}=WM(e);return{id:lM(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(tN(22))}}},{withTypes:()=>GM}),KM=(e,t)=>{let{type:n,effect:r,predicate:i}=WM(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},qM=e=>{e.pending.forEach(e=>{e.abort(DM)})},JM=(e,t)=>()=>{for(let e of t.keys())qM(e);e.clear()},YM=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},XM=zM(Kj(`${VM}/add`),{withTypes:()=>XM}),ZM=Kj(`${VM}/removeAll`),QM=zM(Kj(`${VM}/remove`),{withTypes:()=>QM}),$M=(...e)=>{console.error(`${VM}/error`,...e)},eN=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=$M}=e;AM(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&qM(e)}),c=(e=>{let n=KM(t,e)??GM(e);return s(n)});zM(c,{withTypes:()=>c});let l=e=>{let n=KM(t,e);return n&&(n.unsubscribe(),e.cancelActive&&qM(n)),!!n};zM(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=UM(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,zM({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:RM(u.signal),pause:LM(u.signal),extra:a,signal:u.signal,fork:HM(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(DM),n.delete(e))})},cancel:()=>{u.abort(DM),e.pending.delete(u)},throwIfCancelled:()=>{PM(u.signal)}})))}catch(e){e instanceof kM||YM(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(OM),i(e),e.pending.delete(u)}},d=JM(t,n);return{middleware:e=>n=>r=>{if(!yA(r))return n(r);if(XM.match(r))return c(r.payload);if(ZM.match(r)){d();return}if(QM.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===BM)throw Error(tN(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,YM(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=BM}return s},startListening:c,stopListening:l,clearListeners:d}};function tN(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 nN=mM({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:rN,setLayout:iN,setChartSize:aN,setScale:oN}=nN.actions,sN=nN.reducer;function cN(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function lN(e){return Number.isFinite(e)}function uN(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function dN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?dN(Object(n),!0).forEach(function(t){pN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pN(e,t,n){return(t=mN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mN(e){var t=hN(e,`string`);return typeof t==`symbol`?t:t+``}function hN(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gN(e,t,n){return UD(e)||UD(t)?n:ID(t)?OD(e,t,n):typeof t==`function`?t(e):n}var _N=(e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&Z(e[a]))return fN(fN({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&Z(e[o]))return fN(fN({},e),{},{[o]:e[o]+(i||0)})}return e},vN=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,yN=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},bN=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?ND(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return lN(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(GD):c&&l?l.map((e,t)=>{var n=o.map(e);return lN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(GD):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return lN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(GD):o.domain().map((e,t)=>{var n=o.map(e);return lN(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(GD)},xN=(e,t)=>{if(!t||t.length!==2||!Z(t[0])||!Z(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!Z(e[0])||e[0]<n)&&(i[0]=n),(!Z(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},SN={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0,o=0;o<t;++o){var s=e[o]?.[r];if(s!=null){var c=s[1],l=s[0],u=PD(c)?l:c;u>=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:hD,none:uD,silhouette:gD,wiggle:_D,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0;a<t;++a){var o=e[a]?.[r];if(o!=null){var s=PD(o[1])?o[0]:o[1];s>=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},CN=(e,t,n)=>{var r=SN[n]??uD,i=mD().keys(t).value((e,t)=>Number(gN(e,t,0))).order(dD).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=gN(e[i],t[r],0);Array.isArray(a)&&a.length===2&&Z(a[0])&&Z(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function wN(e){return e==null?void 0:String(e)}var TN=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:o}=e;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=gN(a,t.dataKey,t.scale.domain()[o]);if(UD(s))return null;var c=t.scale.map(s);return Z(c)?c-i/2+r:null},EN=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},DN=e=>{var t=e.flat(2).filter(Z);return[Math.min(...t),Math.max(...t)]},ON=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],kN=(e,t,n)=>{if(e!=null)return ON(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=DN(cN(r,t,n));return!lN(i[0])||!lN(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},AN=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,jN=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,MN=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=iA(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var c=i[o],l=i[o-1];a=Math.min((c?.coordinate||0)-(l?.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function NN(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return fN(fN({},t),{},{dataKey:n,payload:r,value:i,name:a})}function PN(e,t){if(e)return String(e);if(typeof t==`string`)return t}var FN=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},IN=(e,t)=>t===`centric`?e.angle:e.radius,LN=e=>e.layout.width,RN=e=>e.layout.height,zN=e=>e.layout.scale,BN=e=>e.layout.margin,VN=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),HN=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),UN=`data-recharts-item-index`;function WN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?WN(Object(n),!0).forEach(function(t){KN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function KN(e,t,n){return(t=qN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qN(e){var t=JN(e,`string`);return typeof t==`symbol`?t:t+``}function JN(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var YN=e=>e.brush.height;function XN(e){return HN(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function ZN(e){return HN(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function QN(e){return VN(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function $N(e){return VN(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var eP=$([LN,RN,BN,YN,XN,ZN,QN,$N,aA,oA],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=GN(GN({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=_N(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return GN(GN({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),tP=$(eP,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),nP=$(LN,RN,(e,t)=>({x:0,y:0,width:e,height:t})),rP=(0,v.createContext)(null),iP=()=>(0,v.useContext)(rP)!=null,aP=e=>e.brush,oP=$([aP,eP,BN],(e,t,n)=>({height:e.height,x:Z(e.x)?e.x:t.left,y:Z(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:Z(e.width)?e.width:t.width}));function sP(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function cP(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=sP(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function lP(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return cP(e,t,{leading:r,maxWait:t,trailing:i})}var uP=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},dP={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},fP=(e,t,n)=>{var{width:r=dP.width,height:i=dP.height,aspect:a,maxHeight:o}=n,s=FD(r)?e:Number(r),c=FD(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},pP={width:0,height:0,overflow:`visible`},mP={width:0,overflowX:`visible`},hP={height:0,overflowY:`visible`},gP={},_P=e=>{var{width:t,height:n}=e,r=FD(t),i=FD(n);return r&&i?pP:r?mP:i?hP:gP};function vP(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=dP.width,a=dP.height):i===void 0?i=r&&r>0?void 0:dP.width:a===void 0&&(a=r&&r>0?void 0:dP.height),{width:i,height:a}}function yP(){return yP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yP.apply(null,arguments)}function bP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?bP(Object(n),!0).forEach(function(t){SP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function SP(e,t,n){return(t=CP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CP(e){var t=wP(e,`string`);return typeof t==`symbol`?t:t+``}function wP(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var TP=(0,v.createContext)(dP.initialDimension);function EP(e){return uN(e.width)&&uN(e.height)}function DP(e){var{children:t,width:n,height:r}=e,i=(0,v.useMemo)(()=>({width:n,height:r}),[n,r]);return EP(i)?v.createElement(TP.Provider,{value:i},t):null}var OP=()=>(0,v.useContext)(TP),kP=(0,v.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r=dP.initialDimension,width:i,height:a,minWidth:o=dP.minWidth,minHeight:s,maxHeight:c,children:l,debounce:u=dP.debounce,id:d,className:f,onResize:p,style:m={}}=e,h=(0,v.useRef)(null),g=(0,v.useRef)();g.current=p,(0,v.useImperativeHandle)(t,()=>h.current);var[_,y]=(0,v.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,v.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,v.useEffect)(()=>{if(h.current==null||typeof ResizeObserver>`u`)return KD;var e=e=>{var t,n=e[0];if(n!=null){var{width:r,height:i}=n.contentRect;b(r,i),(t=g.current)==null||t.call(g,r,i)}};u>0&&(e=lP(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=h.current.getBoundingClientRect();return b(n,r),t.observe(h.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:x,containerHeight:S}=_;uP(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:C,calculatedHeight:w}=fP(x,S,{width:i,height:a,aspect:n,maxHeight:c});return uP(C!=null&&C>0||w!=null&&w>0,`The width(%s) and height(%s) of chart should be greater than 0,
122
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Zg(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Qg(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Zg(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Qg(e);if(i===null)return Zg(n);e=i;let a=`<img src="${e}" alt="${Zg(n)}"`;return t&&(a+=` title="${Zg(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Zg(e.text)}},l_=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},u_=class e{options;renderer;textRenderer;constructor(e){this.options=e||jh,this.options.renderer=this.options.renderer||new c_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new l_}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},d_=class{options;block;constructor(e){this.options=e||jh}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?s_.lex:s_.lexInline}provideParser(e=this.block){return e?u_.parse:u_.parseInline}},f_=new class{defaults=Ah();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=u_;Renderer=c_;TextRenderer=l_;Lexer=s_;Tokenizer=o_;Hooks=d_;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new c_(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new o_(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new d_;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=d_.passThroughHooks.has(n)?e=>{if(this.defaults.async&&d_.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return s_.lex(e,t??this.defaults)}parser(e,t){return u_.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?s_.lex:s_.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?u_.parse:u_.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?s_.lex:s_.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?u_.parse:u_.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
123
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Zg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function p_(e,t){return f_.parse(e,t)}p_.options=p_.setOptions=function(e){return f_.setOptions(e),p_.defaults=f_.defaults,Mh(p_.defaults),p_},p_.getDefaults=Ah,p_.defaults=jh;function m_(...e){return f_.use(...e),p_.defaults=f_.defaults,Mh(p_.defaults),p_}p_.use=m_,p_.walkTokens=function(e,t){return f_.walkTokens(e,t)},p_.parseInline=f_.parseInline,p_.Parser=u_,p_.parser=u_.parse,p_.Renderer=c_,p_.TextRenderer=l_,p_.Lexer=s_,p_.lexer=s_.lex,p_.Tokenizer=o_,p_.Hooks=d_,p_.parse=p_,p_.options,p_.setOptions,p_.walkTokens,p_.parseInline,u_.parse,s_.lex,p_.setOptions({gfm:!0,breaks:!0});function h_(e){let t=p_.parse(e,{async:!1});return kh.sanitize(t)}var g_=320,__=240;function v_(e){if(e.projectPath){let t=e.projectPath.replace(/\\/g,`/`).split(`/`).filter(e=>e);return t[t.length-1]||e.projectPath}return e.displayName||e.id}function y_(e){return{createdDate:Zp(e.createdAt),updatedDate:e.updatedAt&&e.updatedAt!==e.createdAt?Zp(e.updatedAt):null}}function b_(e,t){return e.similarity===void 0?null:t?`${Math.round(e.similarity*100)}%`:`${e.similarity}%`}function x_({variant:e,item:t,memory:n,prompt:r,selected:i=!1,onSelect:a,onPin:o,onUnpin:s,onEdit:c,onDeleteMemory:l,onDeletePrompt:u,activeKeyword:d,onKeywordClick:f}){let{t:p}=oa();if(e===`pair`&&n&&r){let e=n.isPinned||!1,t=y_(n),u=b_(n,!0);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-3 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":n.id,children:[(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-muted p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:p(`badge-prompt`)}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Zp(r.createdAt)})]}),(0,H.jsx)(Lp,{maxHeight:__,fade:`var(--muted)`,children:(0,H.jsx)(Jp,{content:r.content})})]}),(0,H.jsx)(`div`,{className:`flex justify-center text-muted-foreground`,children:(0,H.jsx)(M,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(n.id,e===!0)}),(0,H.jsx)(rd,{children:p(`badge-memory`)}),n.memoryType?(0,H.jsx)(Hp,{type:n.memoryType}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(rd,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:n.displayName||n.id})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(n.id),children:(0,H.jsx)(mt,{className:`size-3.5 fill-current`})}):(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(n.id),children:(0,H.jsx)(mt,{className:`size-3.5`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(n.id),children:(0,H.jsx)(ft,{className:`size-3.5`})}),(0,H.jsx)(Vp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(`btn-delete-pair`),onClick:()=>l?.(n.id,!0),children:(0,H.jsx)(Lt,{className:`size-3.5`})})})]})]}),n.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.tags.map(e=>(0,H.jsx)(Vp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(td,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Lp,{maxHeight:g_,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:h_(n.content)}})})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,t.createdDate]}),t.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,t.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,n.id]})]})]})]})}if(e===`prompt`&&t){let e=!!t.linkedMemoryId;return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),(0,H.jsx)(Xe,{className:`size-3.5 text-muted-foreground`}),(0,H.jsx)(rd,{variant:`secondary`,children:p(`badge-prompt`)}),e?(0,H.jsxs)(rd,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Zp(t.createdAt)})]}),e?(0,H.jsx)(Vp,{content:p(`tooltip-delete-prompt-pair`),children:(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Lt,{className:`size-3.5`})})}):(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Lt,{className:`size-3.5`})})]}),(0,H.jsx)(Lp,{maxHeight:__,children:(0,H.jsx)(Jp,{content:t.content})}),e?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(M,{className:`size-3`}),p(`text-generated-above`),(0,H.jsx)(ee,{className:`size-3`})]}):null]})}if(e===`memory`&&t){let e=t.isPinned||!1,n=!!t.linkedPromptId,r=y_(t),u=b_(t,!1);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),t.memoryType?(0,H.jsx)(Hp,{type:t.memoryType}):null,n?(0,H.jsxs)(rd,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(rd,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:v_(t)}),t.projectPath?(0,H.jsx)(`span`,{dir:`ltr`,className:`text-code text-muted-foreground font-mono break-all w-full`,children:t.projectPath}):null]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(t.id),children:(0,H.jsx)(mt,{className:`size-3.5 fill-current`})}):(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(t.id),children:(0,H.jsx)(mt,{className:`size-3.5`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(t.id),children:(0,H.jsx)(ft,{className:`size-3.5`})}),n?(0,H.jsx)(Vp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Lt,{className:`size-3.5`})})}):(0,H.jsx)(G,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Lt,{className:`size-3.5`})})]})]}),t.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.tags.map(e=>(0,H.jsx)(Vp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(td,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Lp,{maxHeight:g_,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:h_(t.content)}})})}),n?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(ee,{className:`size-3`}),p(`text-from-below`),(0,H.jsx)(M,{className:`size-3`})]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,r.createdDate]}),r.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,r.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,t.id]})]})]})}return null}function S_(e){let t=new Map(e.map(e=>[e.id,e])),n=[],r=new Set;for(let i of e)if(!r.has(i.id)){if(i.type===`memory`&&i.linkedPromptId&&t.has(i.linkedPromptId)){let e=t.get(i.linkedPromptId);n.push({isPair:!0,memory:i,prompt:e}),r.add(i.id),r.add(e.id)}else if(i.type===`prompt`&&i.linkedMemoryId&&t.has(i.linkedMemoryId)){let e=t.get(i.linkedMemoryId);n.push({isPair:!0,memory:e,prompt:i}),r.add(i.id),r.add(e.id)}else n.push({isPair:!1,type:i.type,item:i}),r.add(i.id)}return n.sort((e,t)=>{let n=e.isPair?e.memory.createdAt:e.item.createdAt,r=t.isPair?t.memory.createdAt:t.item.createdAt;return new Date(r).getTime()-new Date(n).getTime()})}function C_({memories:e,selectedIds:t,currentPage:n,totalPages:r,loading:i=!1,error:a=null,onSelect:o,onPageChange:s,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m}){let{t:h}=oa(),g=(0,v.useMemo)(()=>S_(e),[e]),_=h(`text-page`,{current:n,total:r}),y=(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(G,{variant:`outline`,size:`icon-xs`,disabled:!(n>1),onClick:()=>s(-1),children:(0,H.jsx)(se,{className:`size-3.5`})}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:_}),(0,H.jsx)(G,{variant:`outline`,size:`icon-xs`,disabled:!(n<r),onClick:()=>s(1),children:(0,H.jsx)(ce,{className:`size-3.5`})})]});return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{className:`grid min-h-32 items-start gap-3 lg:grid-cols-2`,children:i&&e.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`loading-init`)}):a?(0,H.jsxs)(`div`,{className:`text-sm text-destructive py-8 text-center`,children:[`Error: `,a]}):g.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`empty-memories`)}):g.map(e=>e.isPair?(0,H.jsx)(x_,{variant:`pair`,memory:e.memory,prompt:e.prompt,selected:t.has(e.memory.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.memory.id):e.type===`prompt`?(0,H.jsx)(x_,{variant:`prompt`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id):(0,H.jsx)(x_,{variant:`memory`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id))}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:y})]})}function w_(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=!1;return li.status().then(t=>{e||n(t.success?t.data??null:null)}),()=>{e=!0}},[e,r]),{record:t,reload:(0,v.useCallback)(()=>i(e=>e+1),[])}}function T_(e){return e!==null}function E_(e){return{createdAt:e.createdAt,merged:e.merged,removed:e.removed}}function D_(e,t){return e===`idle`&&t===`open`?`confirming`:e===`confirming`&&t===`cancel`?`idle`:e===`confirming`&&t===`confirm`?`working`:e===`working`&&t===`done`?`idle`:e}function O_(e,t){return e===`confirming`&&t===`confirm`}function k_(e){return{key:e.notFound>0?`toast-auto-cleanup-undone-partial`:`toast-auto-cleanup-undone`,params:{restored:e.restored,notFound:e.notFound}}}function A_({version:e,onUndone:t}){let{t:n}=oa(),{record:r,reload:i}=w_(e),[a,o]=(0,v.useState)(`idle`);if(!T_(r)||!r)return null;async function s(){if(!O_(a,`confirm`))return;o(D_(a,`confirm`));let e=await li.undo();if(o(`idle`),i(),!e.success||!e.data){U.info(e.error||n(`toast-auto-cleanup-undo-failed`));return}let r=k_(e.data);U.success(n(r.key,r.params)),t?.()}let c=E_(r);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:()=>o(D_(a,`open`)),children:[(0,H.jsx)(Bt,{className:`size-3.5`}),n(`btn-auto-cleanup-undo`)]}),(0,H.jsx)(K,{open:a!==`idle`,onOpenChange:e=>{e||o(D_(a,`cancel`))},children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:n(`title-auto-cleanup-undo`)}),(0,H.jsx)(Wl,{children:n(`label-auto-cleanup-undo-body`,{when:Zp(new Date(c.createdAt).toISOString()),merged:c.merged,removed:c.removed})})]}),(0,H.jsxs)(Hl,{className:`gap-2`,children:[(0,H.jsx)(G,{variant:`secondary`,size:`sm`,disabled:a===`working`,onClick:()=>o(D_(a,`cancel`)),children:n(`btn-cancel`)}),(0,H.jsx)(G,{size:`sm`,disabled:a===`working`,onClick:()=>void s(),children:n(`btn-auto-cleanup-undo-confirm`)})]})]})})]})}var j_=Ba(`grid min-w-0 gap-0.5 rounded-xl border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_minmax(0,1fr)] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive-label bg-card *:data-[slot=alert-description]:text-destructive-label *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function M_({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:V(j_({variant:t}),e),...n})}function N_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-description`,className:V(`text-muted-foreground text-sm [&_p]:leading-relaxed col-start-2`,e),...t})}function P_(e){if(!e)return null;let t=e.status;switch(t.state){case`grouping`:return{kind:`grouping`};case`checking`:return t.total>0?{kind:`checking`,done:t.done,total:t.total}:{kind:`grouping`};case`done`:return{kind:`ready`,groups:t.preview.groups.length};case`failed`:return{kind:`failed`,error:t.error}}}function F_(e){return e?.status.state===`grouping`||e?.status.state===`checking`}var I_=3e3;function L_(e){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e)return;let t=!1,r,i=async()=>{let e=await W(`/api/user-profile/category-cleanup`);if(t)return;let a=e.success?e.data??null:null;n(a),F_(a)&&(r=setTimeout(()=>void i(),I_))};return i(),()=>{t=!0,clearTimeout(r)}},[e]),t}function R_({paused:e,onOpen:t}){let{t:n}=oa(),r=P_(L_(e));if(e||!r)return null;let i=r.kind===`failed`;return(0,H.jsx)(M_,{variant:i?`destructive`:`default`,role:i?`alert`:`status`,children:(0,H.jsxs)(`div`,{className:`col-start-1 flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 break-words`,children:[r.kind===`grouping`&&n(`label-category-cleanup-loading`),r.kind===`checking`&&n(`label-category-cleanup-progress`,{done:r.done,total:r.total}),r.kind===`ready`&&n(`label-category-cleanup-banner-ready`,{groups:r.groups}),r.kind===`failed`&&(0,H.jsxs)(H.Fragment,{children:[n(`label-category-cleanup-banner-failed`),` `,(0,H.jsx)(`bdi`,{children:r.error})]})]}),(0,H.jsx)(G,{variant:`outline`,size:`xs`,onClick:t,children:n(`btn-category-cleanup-banner-open`)})]})})}var z_=Object.defineProperty,B_=(e,t)=>z_(e,`name`,{value:t,configurable:!0}),V_=v.createContext(void 0);function H_(e){let t=v.useContext(V_);return e||t||`ltr`}B_(H_,`useDirection`);var U_=Object.defineProperty,W_=(e,t)=>U_(e,`name`,{value:t,configurable:!0});function G_(e,[t,n]){return Math.min(n,Math.max(t,e))}W_(G_,`clamp`);var K_=Object.defineProperty,q_=(e,t)=>K_(e,`name`,{value:t,configurable:!0});function J_(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}q_(J_,`useStateMachine`);var Y_=`ScrollArea`,[X_,Z_]=qa(Y_),[Q_,$_]=X_(Y_),ev=v.forwardRef(q_(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[h,g]=v.useState(null),[_,y]=v.useState(0),[b,x]=v.useState(0),[S,C]=v.useState(!1),[w,T]=v.useState(!1),E=xa(t,c),D=H_(i);return(0,H.jsx)(Q_,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,H.jsx)(Mo.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),tv=`ScrollAreaViewport`,nv=v.forwardRef(q_(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=$_(tv,n),s=xa(t,v.useRef(null),o.onViewportChange);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rv,{nonce:i}),(0,H.jsx)(Mo.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,H.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),rv=v.memo(q_(function({nonce:e}){return(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),iv=`ScrollAreaScrollbar`,av=v.forwardRef(q_(function(e,t){let{forceMount:n,...r}=e,i=$_(iv,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return v.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,H.jsx)(ov,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,H.jsx)(sv,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,H.jsx)(cv,{...r,ref:t,forceMount:n}):i.type===`always`?(0,H.jsx)(lv,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),ov=v.forwardRef(q_(function(e,t){let{forceMount:n,...r}=e,i=$_(iv,e.__scopeScrollArea),[a,o]=v.useState(!1);return v.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=q_(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=q_(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,H.jsx)(wo,{present:n||a,children:(0,H.jsx)(cv,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),sv=v.forwardRef(q_(function(e,t){let{forceMount:n,...r}=e,i=$_(iv,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=kv(()=>c(`SCROLL_END`),100),[s,c]=J_(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return v.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),v.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=q_(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,H.jsx)(wo,{present:n||s!==`hidden`,children:(0,H.jsx)(lv,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:Qa(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:Qa(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),cv=v.forwardRef(q_(function(e,t){let n=$_(iv,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=v.useState(!1),s=e.orientation===`horizontal`,c=kv(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Av(n.viewport,c),Av(n.content,c),(0,H.jsx)(wo,{present:r||a,children:(0,H.jsx)(lv,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),lv=v.forwardRef(q_(function(e,t){let{orientation:n=`vertical`,...r}=e,i=$_(iv,e.__scopeScrollArea),a=v.useRef(null),o=v.useRef(0),[s,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Sv(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:q_(e=>a.current=e,`onThumbChange`),onThumbPointerUp:q_(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:q_(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return wv(e,o.current,s,t)}return q_(d,`getScrollPosition`),n===`horizontal`?(0,H.jsx)(uv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Tv(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,H.jsx)(dv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Tv(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),uv=v.forwardRef(q_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=$_(iv,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarXChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(mv,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Cv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Dv(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:xv(o.paddingLeft),paddingEnd:xv(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),dv=v.forwardRef(q_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=$_(iv,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarYChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(mv,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Cv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Dv(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:xv(o.paddingTop),paddingEnd:xv(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[fv,pv]=X_(iv),mv=v.forwardRef(q_(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=$_(iv,n),[m,h]=v.useState(null),g=xa(t,h),_=v.useRef(null),y=v.useRef(``),b=p.viewport,x=r.content-r.viewport,S=os(u),C=os(c),w=kv(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return q_(T,`handleDragScroll`),v.useEffect(()=>{let e=q_(e=>{let t=e.target;m?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,m,x,S]),v.useEffect(C,[r,C]),Av(m,w),Av(p.content,w),(0,H.jsx)(fv,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:os(a),onThumbPointerUp:os(o),onThumbPositionChange:C,onThumbPointerDown:os(s),children:(0,H.jsx)(Mo.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:Qa(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:Qa(e.onPointerMove,T),onPointerUp:Qa(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),hv=`ScrollAreaThumb`,gv=v.forwardRef(q_(function(e,t){let{forceMount:n,...r}=e,i=pv(hv,e.__scopeScrollArea);return(0,H.jsx)(wo,{present:n||i.hasThumb,children:(0,H.jsx)(_v,{ref:t,...r})})},`ScrollAreaThumb`)),_v=v.forwardRef(q_(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=$_(hv,n),o=pv(hv,n),{onThumbPositionChange:s}=o,c=xa(t,o.onThumbChange),l=v.useRef(void 0),u=kv(()=>{l.current&&=(l.current(),void 0)},100);return v.useEffect(()=>{let e=a.viewport;if(e){let t=q_(()=>{if(u(),!l.current){let t=Ov(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,H.jsx)(Mo.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:Qa(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:Qa(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),vv=`ScrollAreaCorner`,yv=v.forwardRef(q_(function(e,t){let n=$_(vv,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,H.jsx)(bv,{...e,ref:t}):null},`ScrollAreaCorner`)),bv=v.forwardRef(q_(function(e,t){let{__scopeScrollArea:n,...r}=e,i=$_(vv,n),[a,o]=v.useState(0),[s,c]=v.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Av(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Av(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),v.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,H.jsx)(Mo.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function xv(e){return e?parseInt(e,10):0}q_(xv,`toInt`);function Sv(e,t){let n=e/t;return isNaN(n)?0:n}q_(Sv,`getThumbRatio`);function Cv(e){let t=Sv(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}q_(Cv,`getThumbSize`);function wv(e,t,n,r=`ltr`){let i=Cv(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Ev([c,l],d)(e)}q_(wv,`getScrollPositionFromPointer`);function Tv(e,t,n=`ltr`){let r=Cv(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=G_(e,n===`ltr`?[0,o]:[o*-1,0]);return Ev([0,o],[0,s])(c)}q_(Tv,`getThumbOffsetFromScroll`);function Ev(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}q_(Ev,`linearScale`);function Dv(e,t){return e>0&&e<t}q_(Dv,`isScrollingWithinScrollbarBounds`);var Ov=q_((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return q_((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function kv(e,t){let n=os(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}q_(kv,`useDebounceCallback`);function Av(e,t){let n=os(t);ro(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}q_(Av,`useResizeObserver`);var jv=ev,Mv=nv,Nv=yv;function Pv({className:e,children:t,...n}){return(0,H.jsxs)(jv,{"data-slot":`scroll-area`,className:V(`relative`,e),...n,children:[(0,H.jsx)(Mv,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:t}),(0,H.jsx)(Fv,{}),(0,H.jsx)(Nv,{})]})}function Fv({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(av,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:V(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,H.jsx)(gv,{"data-slot":`scroll-area-thumb`,className:`bg-border relative flex-1 rounded-full`})})}function Iv({open:e=!1,profileId:t=``,onOpenChange:n}){let{t:r}=oa(),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)([]);(0,v.useEffect)(()=>{e&&t&&c(t)},[e,t]);async function c(e){a(!0),s([]);let t=await W(`/api/user-profile/changelog?profileId=${encodeURIComponent(e)}&limit=10`);a(!1),t.success&&t.data?s(t.data):s([])}return(0,H.jsx)(K,{open:e,onOpenChange:n,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:r(`modal-changelog-title`)})}),(0,H.jsx)(Pv,{className:`max-h-80`,children:i?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`loading-changelog`)}):o.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`empty-changelog`)}):(0,H.jsx)(`div`,{className:`space-y-3 pr-3`,children:o.map((e,t)=>(0,H.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`font-medium`,children:[`v`,e.version]}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeType}),(0,H.jsx)(`span`,{className:`text-muted-foreground ml-auto`,children:Zp(e.createdAt)})]}),(0,H.jsx)(`p`,{className:`text-sm`,children:e.changeSummary})]},`${e.version}-${t}`))})})]})})}function Lv({item:e,onOpen:t,focusKey:n}){let{t:r}=oa(),i=Wu(e).length;return i===0?null:(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`xs`,className:`-mx-1.5 h-5 cursor-pointer px-1.5 text-xs font-normal text-muted-foreground transition-colors duration-200 ease-in hover:bg-transparent hover:text-primary-label focus-visible:text-primary-label`,"aria-haspopup":`dialog`,"data-evidence-key":n,"aria-label":r(`evidence-open-label`,{count:i}),onClick:t,children:[(0,H.jsx)(Be,{className:`size-3`,"aria-hidden":`true`}),r(`evidence-count`,{count:i})]})}var Rv={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function zv({item:e,section:t}){let{t:n,language:r}=oa(),i=Wu(e);return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,children:[n(Rv[t]),e.category?` · ${e.category}`:null]}),(0,H.jsx)(`p`,{dir:`auto`,className:`text-sm leading-6 break-words`,children:e.description}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-hit-count`,{count:e.frequency||1})})]}),(0,H.jsx)(Pv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[50vh] rounded-lg border`,children:(0,H.jsx)(`ol`,{className:`flex flex-col divide-y`,children:i.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex gap-3 px-3 py-2.5 text-sm leading-6`,children:[(0,H.jsx)(`span`,{className:`w-5 shrink-0 text-end text-xs leading-6 text-muted-foreground tabular-nums`,children:t+1}),e.kind===`manual-write`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted-foreground italic`,children:[(0,H.jsx)(ft,{className:`size-3.5`,"aria-hidden":`true`}),n(`evidence-manual-write`)]}):(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 whitespace-pre-wrap break-words`,children:e.text})]},t))})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-note`)})]})}function Bv({item:e,section:t,focusKey:n,onOpenChange:r}){let{t:i}=oa(),a=(0,v.useRef)(null);return n&&(a.current=n),(0,H.jsx)(K,{open:e!==null,onOpenChange:r,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,onCloseAutoFocus:e=>{let t=a.current,n=t?document.querySelector(`[data-evidence-key="${CSS.escape(t)}"]`):null;n&&(e.preventDefault(),n.focus())},children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:i(`evidence-dialog-title`)}),(0,H.jsx)(Wl,{className:`sr-only`,children:e?.description})]}),e?(0,H.jsx)(zv,{item:e,section:t}):null]})})}function Vv({open:e=!1,type:t=null,index:n=0,action:r=`edit`,item:i=null,onOpenChange:a,onSaved:o}){let{t:s}=oa(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)([``]),[m,h]=(0,v.useState)(`1`),[g,_]=(0,v.useState)(!1),y=r===`edit`,b=t===`workflows`;(0,v.useEffect)(()=>{e&&i&&(l(i.category||``),d(i.description||``),p(i.steps?.length?[...i.steps]:[``]),h(`1`))},[e,i]);let x=y?s(`btn-edit`)||`Edit Item`:m===`2`?s(`confirm-delete-title`)||`Confirm Delete`:s(`confirm-delete`)||`Delete Item?`;function S(e){a?.(e)}function C(){p(e=>[...e,``])}function w(e){p(t=>{let n=t.filter((t,n)=>n!==e);return n.length===0?[``]:n})}function T(e,t){p(n=>n.map((n,r)=>r===e?t:n))}async function E(e){if(e.preventDefault(),!t)return;if(r===`delete`){if(m===`1`){h(`2`);return}_(!0);let e=await W(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:t,index:n,action:`delete`})});_(!1),e.success?(U.success(s(`toast-delete-success`)||`Item deleted`),S(!1),o?.()):U.error(e.error||s(`toast-delete-failed`)||`Delete failed`);return}_(!0);let i={type:t,index:n,action:`edit`,category:b?void 0:c,description:u};t===`workflows`&&(i.steps=f.map(e=>e.trim()).filter(Boolean));let a=await W(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});_(!1),a.success?(U.success(s(`toast-update-success`)||`Item updated`),S(!1),o?.()):U.error(a.error||s(`toast-update-failed`)||`Update failed`)}return(0,H.jsx)(K,{open:e,onOpenChange:S,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:x})}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:E,children:[y||m===`1`?(0,H.jsxs)(H.Fragment,{children:[b?null:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`profile-item-category`,children:s(`label-category`)}),(0,H.jsx)(id,{id:`profile-item-category`,value:c,onChange:e=>l(e.target.value),disabled:!y})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`profile-item-description`,children:s(`label-description`)}),(0,H.jsx)(Fp,{id:`profile-item-description`,rows:4,value:u,onChange:e=>d(e.target.value),disabled:!y})]}),b&&y?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{children:s(`label-steps`)}),(0,H.jsx)(`div`,{className:`space-y-2`,children:f.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground w-5 tabular-nums`,children:t+1}),(0,H.jsx)(id,{value:e,placeholder:`Step ${t+1}...`,onChange:e=>T(t,e.target.value)}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:()=>w(t),children:`×`})]},t))}),(0,H.jsx)(G,{type:`button`,variant:`secondary`,size:`sm`,onClick:C,children:s(`btn-add-step`)})]}):null]}):null,(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>S(!1),children:s(`btn-cancel`)}),(0,H.jsx)(G,{type:`submit`,variant:y?`default`:`destructive`,disabled:g,children:y?s(`btn-save`)||`Save`:s(`btn-delete`)||`Delete`})]})]})]})})}var Hv=8;function Uv({label:e,children:t,className:n}){let r=v.useId(),i=v.useRef(null),a=v.useRef(null),[o,s]=v.useState(!1),[c,l]=v.useState(0);return v.useEffect(()=>{if(!o)return;let e=e=>{i.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[o]),v.useLayoutEffect(()=>{let e=a.current,t=i.current;if(!o||!e||!t)return;let n=t.getBoundingClientRect(),r=e.offsetWidth/2,s=n.left+n.width/2,c=document.documentElement.clientWidth,u=Math.min(Math.max(s,Hv+r),c-Hv-r);l(u-s)},[o]),(0,H.jsxs)(`span`,{ref:i,className:V(`relative inline-flex`,n),children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":e,"aria-expanded":o,"aria-controls":r,onClick:()=>s(e=>!e),className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors duration-150 outline-none hover:bg-interactive-hover hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-selection aria-expanded:text-foreground`,children:(0,H.jsx)(Be,{className:`size-3.5`,"aria-hidden":`true`})}),o?(0,H.jsx)(`div`,{ref:a,id:r,style:{transform:`translateX(calc(-50% + ${c}px))`},className:`absolute top-full left-1/2 z-30 mt-2 w-72 max-w-[calc(100vw-1rem)] rounded-lg border border-border bg-card p-3 text-start text-xs whitespace-normal text-card-foreground shadow-sm`,children:t}):null]})}var Wv=20;function Gv(e,t){let n=e.length,r=Math.max(1,Math.ceil(n/Wv)),i=Math.min(t,r),a=(i-1)*Wv;return{items:e.slice(a,a+Wv),total:n,totalPages:r,page:i,start:a}}function Kv(e){return Math.round((e.confidence||0)*100)}function qv({profile:e,loading:t=!1,onRefresh:n,onCleanup:r,onCategoryCleanup:i,categoryCleanupOpen:a=!1}){let{t:o}=oa(),[s,c]=(0,v.useState)({pref:1,pat:1,wf:1}),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(0),[_,y]=(0,v.useState)(`edit`),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),w=(0,v.useMemo)(()=>{if(!e?.exists||!e.profileData)return null;let t=e.profileData;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}return t},[e]),T=(0,v.useMemo)(()=>{let e=[...w?.preferences??[],...w?.patterns??[]];return new Set(e.map(e=>e.category||`General`)).size},[w]),E=(0,v.useMemo)(()=>Bu(w?.preferences),[w]),D=(0,v.useMemo)(()=>Bu(w?.patterns),[w]),O=(0,v.useMemo)(()=>Bu(w?.workflows),[w]),k=(0,v.useMemo)(()=>O.map((e,t)=>({item:e,index:t})).sort((e,t)=>(t.item.frequency||0)-(e.item.frequency||0)),[O]),j=Gv(E,s.pref),M=Gv(D,s.pat),N=Gv(k,s.wf),P=O.length;function ee(e,t,n){let r=(e===`preferences`?E:e===`patterns`?D:O)[t];r&&(m(e),g(t),y(n),x(r),f(!0))}function F(e,t){return e.indexOf(t)}function I({page:e,pageKey:t}){return e.total<=Wv?null:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-2`,children:[(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground me-2`,children:[e.start+1,`-`,Math.min(e.start+Wv,e.total),` / `,e.total]}),Array.from({length:e.totalPages},(e,t)=>t+1).map(n=>(0,H.jsx)(G,{size:`xs`,variant:n===e.page?`default`:`outline`,onClick:()=>c(e=>({...e,[t]:n})),children:n},n))]})}function te({item:e,type:t,fullList:n}){let r=F(n,e),i=Kv(e);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-4 space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[t!==`workflows`||e.category?(0,H.jsx)(rd,{variant:`outline`,className:`bg-transparent border-current [color:oklch(0.42_0.13_var(--category-hue))] dark:[color:oklch(0.8_0.13_var(--category-hue))]`,style:{"--category-hue":String(ed(e.category||`General`))},children:e.category||`General`}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5 ms-auto`,children:[(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:o(`btn-edit`)||`Edit`,onClick:()=>ee(t,r,`edit`),children:(0,H.jsx)(pt,{className:`size-3`})}),(0,H.jsx)(G,{variant:`ghost`,size:`icon-xs`,title:o(`btn-delete`)||`Delete`,onClick:()=>ee(t,r,`delete`),children:(0,H.jsx)(Lt,{className:`size-3`})})]}),(0,H.jsxs)(`div`,{className:V(`shrink-0 rounded-md border px-1.5 py-0.5 text-xs font-medium tabular-nums`,Ku[Gu(i)]),title:`${o(`label-confidence`)}: ${i}%`,children:[i,`%`]})]}),(0,H.jsx)(`p`,{className:`text-sm break-words`,children:e.description||``}),e.steps?.length?(0,H.jsx)(`ol`,{className:`flex flex-col items-start gap-1.5`,children:e.steps.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex min-w-0 max-w-full items-start gap-2 rounded-2xl border border-blue-600/40 bg-blue-500/15 py-1 ps-1 pe-3 text-xs leading-5 text-blue-700 dark:text-blue-400`,children:[(0,H.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-blue-500/30 text-[11px] font-medium tabular-nums dark:bg-blue-400/30`,children:t+1}),(0,H.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))}):null,e.evidence||e.frequency?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:o(`label-evidence-tooltip`,{count:e.frequency||1}),children:[(0,H.jsx)(Ft,{className:`size-3`}),e.frequency||1]}),Wu(e).length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`·`}),(0,H.jsx)(Lv,{item:e,focusKey:`${t}-${r}`,onOpen:()=>C({item:e,section:t,focusKey:`${t}-${r}`})})]}):null]}):null]})}return t&&!e?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:o(`loading-profile`)}):e?.exists?w?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{dir:`auto`,className:`text-section-title font-semibold break-words`,children:e.displayName||e.userId}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-version`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.version})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-prompts`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.totalPromptsAnalyzed})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-updated`)}),(0,H.jsx)(`span`,{className:`ms-1`,children:e.lastAnalyzedAt?Zp(e.lastAnalyzedAt):`—`})]}),(0,H.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>r?.(),children:[(0,H.jsx)(kt,{className:`size-3.5`}),o(`btn-ai-cleanup`)]}),(0,H.jsx)(Uv,{label:o(`label-more-info`),children:o(`help-ai-cleanup`)})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>i?.(),children:[(0,H.jsx)(Pt,{className:`size-3.5`}),o(`btn-category-cleanup`),(0,H.jsx)(`span`,{className:`font-mono opacity-70`,title:o(`label-category-count-title`),children:T})]}),(0,H.jsx)(Uv,{label:o(`label-more-info`),children:o(`help-category-cleanup`)})]}),(0,H.jsx)(A_,{version:e.version,onUndone:n}),(0,H.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:()=>n?.(),children:[(0,H.jsx)(bt,{className:`size-3.5`}),o(`btn-refresh`)]}),(0,H.jsxs)(G,{variant:`secondary`,size:`sm`,onClick:()=>u(!0),children:[(0,H.jsx)(St,{className:`size-3.5`}),`History`]})]})]}),(0,H.jsx)(R_,{paused:a,onOpen:()=>i?.()})]}),(0,H.jsxs)(`div`,{className:`grid gap-8`,children:[(0,H.jsxs)(`section`,{id:`profile-preferences`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Le,{className:`size-4`}),o(`profile-preferences`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:E.length})]}),E.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-preferences`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:j.items.map(e=>(0,H.jsx)(te,{item:e,type:`preferences`,fullList:E},F(E,e)))}),(0,H.jsx)(I,{page:j,pageKey:`pref`})]})]}),(0,H.jsxs)(`section`,{id:`profile-patterns`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(A,{className:`size-4`}),o(`profile-patterns`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:D.length})]}),D.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-patterns`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:M.items.map(e=>(0,H.jsx)(te,{item:e,type:`patterns`,fullList:D},F(D,e)))}),(0,H.jsx)(I,{page:M,pageKey:`pat`})]})]}),(0,H.jsxs)(`section`,{id:`profile-workflows`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Wt,{className:`size-4`}),o(`profile-workflows`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:P})]}),P===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-workflows`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid items-start gap-3 lg:grid-cols-2`,children:N.items.map(e=>(0,H.jsx)(te,{item:e.item,type:`workflows`,fullList:O},e.index))}),(0,H.jsx)(I,{page:N,pageKey:`wf`})]})]})]})]}),(0,H.jsx)(Iv,{open:l,onOpenChange:u,profileId:e?.id||``}),(0,H.jsx)(Vv,{open:d,onOpenChange:f,type:p,index:h,action:_,item:b,onSaved:n}),(0,H.jsx)(Bv,{item:S?.item??null,section:S?.section??`preferences`,focusKey:S?.focusKey??null,onOpenChange:e=>{e||C(null)}})]}):null:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-10 text-muted-foreground`,children:[(0,H.jsx)(Vt,{className:`size-8`}),(0,H.jsx)(`p`,{className:`text-sm`,children:e?.message||o(`empty-preferences`)})]})}function Jv({open:e=!1,count:t=0,onOpenChange:n,onComplete:r}){let{t:i}=oa(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(0);(0,v.useEffect)(()=>{e&&!a&&(c(i(`migration-found-tags`,{count:t})),u(0))},[e,a,t,i]);function d(e){a&&!e||n?.(e)}async function f(){o(!0),c(i(`status-migration-init`)),u(0);let e=!0,t=0,n=1e3;for(;e&&t<n;){t++;let n=await W(`/api/migration/tags/run-batch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({batchSize:3})});if(!n.success||!n.data){c(i(`toast-migration-failed`)+`: `+(n.error||``)),o(!1);return}let r=n.data.processed;e=n.data.hasMore;let a=n.data.total;u(a>0?Math.round(r/a*100):0),c(i(`status-migration-progress`,{current:r,total:a})),e&&await new Promise(e=>setTimeout(e,100))}if(t>=n){c(i(`migration-stopped`)),o(!1);return}u(100),c(i(`toast-migration-success`)),U.success(i(`toast-migration-success`)),setTimeout(()=>{o(!1),d(!1),r?.()},2e3)}return(0,H.jsx)(K,{open:e,onOpenChange:d,children:(0,H.jsxs)(q,{className:`sm:max-w-md`,showCloseButton:!a,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:i(`modal-migration-title`)})}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s}),(0,H.jsx)(`div`,{className:`h-2 rounded-full bg-muted overflow-hidden`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary transition-all duration-200`,style:{width:`${l}%`}})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`migration-note`)})]}),a?null:(0,H.jsx)(Hl,{children:(0,H.jsxs)(G,{onClick:f,children:[(0,H.jsx)(ht,{className:`size-3.5`}),i(`btn-start-migration`)]})})]})})}var Yv=[{id:`settings-section-external-api`,title:`External API`},{id:`settings-section-models`,title:`Models`},{id:`settings-section-embedding`,title:`Embedding`},{id:`settings-section-keys`,title:`Keys and access`},{id:`settings-section-diagnostics`,title:`Capture diagnostics`},{id:`settings-section-health`,title:`Health`},{id:`settings-section-claude-folder`,title:`Claude Code folder`},{id:`settings-section-capture-language`,title:`Memory language`},{id:`settings-section-appearance`,title:`Appearance`},{id:`settings-section-profiles`,title:`Profiles`},{id:`settings-section-web-app`,title:`Web app`},{id:`settings-section-skill-learning`,title:`Skill learning`},{id:`settings-section-log`,title:`Log`}],Xv=class extends Error{status;constructor(e,t){super(e),this.name=`SettingsRequestError`,this.status=t}};async function Y(e,t={}){let n=(t.method??`GET`).toUpperCase(),r=n!==`GET`&&n!==`HEAD`,i=await fetch(e,{...t,headers:{"x-omms-token":window.__OMMS_TOKEN__??``,...r||t.body?{"Content-Type":`application/json`}:{},...t.headers}}),a=await i.json();if(!i.ok)throw new Xv(a.error??`Request failed (${i.status})`,i.status);return a}var Zv=new Set,Qv=0;function $v(e){Qv++;for(let t of Zv)t(e)}function ey(){let e=Qv;return{isCurrent:()=>Qv===e}}async function ty(){try{let e=await Y(`/api/settings`);return $v(e),e}catch{return null}}function ny(e){return Zv.add(e),()=>{Zv.delete(e)}}function ry(e,t){return`${e.replace(/\.+$/,``)}. ${t}`}function iy(){let e=0;return{begin(){let t=++e;return()=>t===e}}}async function ay(e,t){e(!0);try{return await t()}finally{e(!1)}}var oy={"(empty prompt)":[`(空提示)`,`(مطالبة فارغة)`],"<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.":[`<private> 文本、API 密钥和密码将按原文存储,并在起草时发送到外部 API。`,`سيُخزَّن نص <private> ومفاتيح API وكلمات المرور كما كُتبت، وتُرسَل إلى واجهة API الخارجية عند الصياغة.`],"A project config turns recording off for this project.":[`项目配置已为此项目关闭记录。`,`يوقف إعداد المشروع التسجيل في هذا المشروع.`],Attention:[`关注度`,`الاهتمام`],"Add folder":[`添加文件夹`,`إضافة مجلد`],"All skills":[`所有技能`,`كل المهارات`],"Changes to SKILL.md":[`对 SKILL.md 的更改`,`التغييرات على SKILL.md`],"Delete recorded turns":[`删除已记录的回合`,`حذف الأدوار المسجلة`],"Delete {count} recorded turns? This cannot be undone.":[`删除 {count} 个已记录的回合?此操作无法撤销。`,`حذف {count} من الأدوار المسجلة؟ لا يمكن التراجع عن ذلك.`],"Deleted {count} recorded turns.":[`已删除 {count} 个已记录的回合。`,`تم حذف {count} من الأدوار المسجلة.`],"Draft improvement":[`起草改进`,`صياغة تحسين`],"Draft skill":[`起草技能`,`صياغة مهارة`],"Drafting needs the external API. Set it up first.":[`起草需要外部 API。请先设置。`,`تحتاج الصياغة إلى واجهة API الخارجية. أعدّها أولاً.`],"Drafting… This can take a few minutes.":[`正在起草…这可能需要几分钟。`,`جارٍ الصياغة… قد يستغرق ذلك بضع دقائق.`],"Evidence turns":[`证据回合`,`الأدوار الداعمة`],"Failed turns":[`失败的回合`,`الأدوار الفاشلة`],"File size":[`文件大小`,`حجم الملف`],"Finding past sessions…":[`正在查找过去的会话…`,`جارٍ البحث عن الجلسات السابقة…`],"Filter skills by name":[`按名称筛选技能`,`تصفية المهارات بالاسم`],"Find new skill ideas":[`查找新技能想法`,`البحث عن أفكار مهارات جديدة`],"Folder for the new skill":[`新技能的文件夹`,`مجلد المهارة الجديدة`],"Folder not found":[`未找到文件夹`,`المجلد غير موجود`],"Folder path":[`文件夹路径`,`مسار المجلد`],"Hide changes":[`隐藏更改`,`إخفاء التغييرات`],Improvement:[`改进`,`تحسين`],"Last use":[`上次使用`,`آخر استخدام`],"Loading…":[`加载中…`,`جارٍ التحميل…`],"Looking…":[`正在查找…`,`جارٍ البحث…`],Manual:[`手动`,`يدوي`],"Most used":[`最常用`,`الأكثر استخدامًا`],"Needs attention":[`需要关注`,`يحتاج إلى اهتمام`],"Sort skills":[`技能排序`,`ترتيب المهارات`],"New skill":[`新技能`,`مهارة جديدة`],"New skill ideas":[`新技能想法`,`أفكار مهارات جديدة`],"New turns will be stored as written.":[`新回合将按原文存储。`,`ستُخزَّن الأدوار الجديدة كما كُتبت.`],"No change proposed":[`没有建议更改`,`لم يُقترح أي تغيير`],"No content was saved.":[`没有保存内容。`,`لم يُحفظ أي محتوى.`],"No folders are watched.":[`没有监视的文件夹。`,`لا توجد مجلدات مراقبة.`],"No new skill ideas in the recorded turns.":[`已记录的回合中没有新的技能想法。`,`لا توجد أفكار مهارات جديدة في الأدوار المسجلة.`],"No proposals yet.":[`还没有提案。`,`لا توجد مقترحات بعد.`],"No recorded turns.":[`没有已记录的回合。`,`لا توجد أدوار مسجلة.`],"No skill matches this name.":[`没有技能匹配此名称。`,`لا توجد مهارة تطابق هذا الاسم.`],"No skills found in the watched folders.":[`在监视的文件夹中未找到技能。`,`لم يُعثر على مهارات في المجلدات المراقبة.`],"No turns are recorded yet.":[`还没有记录任何回合。`,`لم تُسجَّل أي أدوار بعد.`],"Not in a watched folder":[`不在监视的文件夹中`,`ليست في مجلد مراقب`],"Nothing is recorded yet. Agent turns are recorded only after you turn it on.":[`尚未记录任何内容。只有在你开启后才会记录智能体回合。`,`لم يُسجَّل شيء بعد. لا تُسجَّل أدوار الوكيل إلا بعد تشغيل ذلك.`],"OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.":[`OMMS 会把完整的提示、回复和工具调用存储在这台电脑上的 skills.db 中。起草时会把已记录的回合发送到外部 API。该文件包含回合中的所有内容。`,`يخزّن OMMS المطالبات والردود واستدعاءات الأدوات كاملةً في skills.db على هذا الجهاز. ترسل الصياغة الأدوار المسجلة إلى واجهة API الخارجية. يحتوي الملف على كل ما تحتويه الأدوار.`],"OMMS will change this SKILL.md file without asking. It drafts an improvement after 10 new uses and at least 24 hours, then applies it. Each change can be undone.":[`OMMS 会在不询问的情况下修改此 SKILL.md 文件。它在 10 次新使用且至少 24 小时后起草改进,然后直接应用。每次更改都可以撤销。`,`سيعدّل OMMS ملف SKILL.md هذا دون أن يسأل. يصوغ تحسيناً بعد 10 استخدامات جديدة و24 ساعة على الأقل، ثم يطبّقه. يمكن التراجع عن كل تغيير.`],"Skill learning watches how your agents use your skills on Pi, OpenCode and Claude Code. It ranks each skill by use and failed tool calls, and drafts better versions from real turns.":[`技能学习会观察你的智能体在 Pi、OpenCode 和 Claude Code 中如何使用你的技能。它按使用次数和失败的工具调用为每个技能排名,并根据真实回合起草更好的版本。`,`يراقب تعلّم المهارات كيف يستخدم وكلاؤك مهاراتك في Pi وOpenCode وClaude Code. يرتّب كل مهارة حسب الاستخدام واستدعاءات الأدوات الفاشلة، ويصوغ نسخاً أفضل من أدوار حقيقية.`],"Every draft is a proposal with a diff. Nothing changes a SKILL.md file until you apply it, unless you set that skill to Automatic. Undo restores the previous version.":[`每份草稿都是带差异对比的提案。在你应用之前,SKILL.md 文件不会改变,除非你把该技能设为“自动”。撤销会恢复之前的版本。`,`كل مسودة مقترح مع عرض للفروق. لا يتغيّر ملف SKILL.md حتى تطبّقه، إلا إذا ضبطت تلك المهارة على تلقائي. التراجع يعيد النسخة السابقة.`],"Open the Skill learning card":[`打开“技能学习”卡片`,`افتح بطاقة تعلّم المهارات`],"No proposals are waiting.":[`没有等待处理的提案。`,`لا توجد مقترحات قيد الانتظار.`],"No proposals have been decided yet.":[`尚未处理任何提案。`,`لم يتم البتّ في أي مقترح بعد.`],"Pending proposals":[`待处理的提案`,`المقترحات المعلّقة`],Proposals:[`提案`,`المقترحات`],"Ranked skills":[`技能排名`,`المهارات مرتبةً`],"Recent turns":[`最近的回合`,`الأدوار الأخيرة`],"Recent proposals":[`最近的提案`,`المقترحات الأخيرة`],"Record agent turns":[`记录智能体回合`,`تسجيل أدوار الوكيل`],"Record agent turns so OMMS can rank your skills and draft improvements.":[`记录智能体回合,让 OMMS 为你的技能排名并起草改进。`,`سجّل أدوار الوكيل ليتمكن OMMS من ترتيب مهاراتك وصياغة التحسينات.`],"Record past turns":[`记录过去的回合`,`تسجيل الأدوار السابقة`],"Record past turns did not finish.":[`记录过去的回合未完成。`,`لم يكتمل تسجيل الأدوار السابقة.`],"Recorded turns":[`已记录的回合`,`الأدوار المسجلة`],"Recorded {count} past turns.":[`已记录 {count} 个过去的回合。`,`تم تسجيل {count} من الأدوار السابقة.`],Reject:[`拒绝`,`رفض`],"Remove folder":[`移除文件夹`,`إزالة المجلد`],"Remove folder {path}":[`移除文件夹 {path}`,`إزالة المجلد {path}`],"Remove private text and secrets":[`移除私密文本和机密`,`إزالة النص الخاص والأسرار`],"Reset default":[`恢复默认`,`استعادة الافتراضي`],"Saved.":[`已保存。`,`تم الحفظ.`],"Show changes":[`显示更改`,`عرض التغييرات`],"Skill learning":[`技能学习`,`تعلّم المهارات`],"Skill turns":[`技能回合`,`أدوار المهارات`],"Skill turns are recorded only while Record agent turns is on.":[`只有开启“记录智能体回合”时才会记录技能回合。`,`لا تُسجَّل أدوار المهارات إلا عند تشغيل تسجيل أدوار الوكيل.`],"Skill turns to record":[`待记录的技能回合`,`أدوار المهارات المراد تسجيلها`],"Skill turns already recorded":[`已记录的技能回合`,`أدوار المهارات المسجلة سابقاً`],"Skill turns recorded":[`本次记录的技能回合`,`أدوار المهارات المسجلة`],"Skill turns already present":[`已存在的技能回合`,`أدوار المهارات الموجودة مسبقاً`],Skills:[`技能`,`المهارات`],"Stale: the file changed since this draft":[`已过期:自起草以来文件已更改`,`قديم: تغيّر الملف منذ هذه المسودة`],"Stop removing private text and secrets?":[`停止移除私密文本和机密?`,`إيقاف إزالة النص الخاص والأسرار؟`],Suggested:[`建议`,`مقترحة`],"Turn off":[`关闭`,`إيقاف`],"Turn on Automatic":[`开启自动`,`تشغيل التلقائي`],"Turn on Automatic mode for this skill?":[`为此技能开启自动模式?`,`تشغيل الوضع التلقائي لهذه المهارة؟`],Undo:[`撤销`,`تراجع`],"Undo stopped because the file changed. This is the content OMMS saved:":[`撤销已停止,因为文件已更改。这是 OMMS 保存的内容:`,`توقف التراجع لأن الملف تغيّر. هذا هو المحتوى الذي حفظه OMMS:`],Uses:[`使用`,`الاستخدامات`],"Uses in 30 days":[`30 天内使用`,`الاستخدامات في 30 يوماً`],"Watched folders":[`监视的文件夹`,`المجلدات المراقبة`],applied:[`已应用`,`طُبّق`],"applied automatically":[`已自动应用`,`طُبّق تلقائياً`],rejected:[`已拒绝`,`مرفوض`],stale:[`已过期`,`قديم`],undone:[`已撤销`,`تم التراجع`],"{count} failed tool call":[`{count} 次工具调用失败`,`فشل استدعاء أداة واحد`],"{count} failed tool calls":[`{count} 次工具调用失败`,`فشل {count} من استدعاءات الأدوات`],"{count} skill":[`{count} 个技能`,`مهارة واحدة`],"{count} skills":[`{count} 个技能`,`المهارات: {count}`],Show:[`显示`,`عرض`],results:[`条结果`,`نتائج`],"Custom:":[`自定义:`,`مخصص:`],"Results per page":[`每页结果数`,`النتائج في كل صفحة`],"Custom results per page":[`自定义每页结果数`,`عدد مخصص للنتائج في كل صفحة`],"Sort by":[`排序方式`,`الترتيب حسب`],"Sort ascending":[`升序排列`,`ترتيب تصاعدي`],"Sort descending":[`降序排列`,`ترتيب تنازلي`],"Showing {from} to {to} of {total} results":[`显示第 {from} 到 {to} 条,共 {total} 条结果`,`عرض {from} إلى {to} من {total} نتيجة`],pagination:[`分页`,`ترقيم الصفحات`],"Go to previous page":[`转到上一页`,`الانتقال إلى الصفحة السابقة`],"Go to next page":[`转到下一页`,`الانتقال إلى الصفحة التالية`],"Go to page {page}":[`转到第 {page} 页`,`الانتقال إلى الصفحة {page}`],"More pages":[`更多页面`,`صفحات أخرى`],"Name (A–Z)":[`名称(A–Z)`,`الاسم (A–Z)`],Newest:[`最新`,`الأحدث`],Oldest:[`最早`,`الأقدم`],Skill:[`技能`,`المهارة`],Mode:[`模式`,`الوضع`],"{count} proposal":[`{count} 个提案`,`مقترح واحد ({count})`],"{count} proposals":[`{count} 个提案`,`المقترحات: {count}`],"{count} turn":[`{count} 个回合`,`دور واحد ({count})`],"{count} turns":[`{count} 个回合`,`الأدوار: {count}`],"{count} entry":[`{count} 条记录`,`إدخال واحد ({count})`],"{count} entries":[`{count} 条记录`,`الإدخالات: {count}`],"Created {date}":[`创建于 {date}`,`أُنشئ في {date}`],"Applied {date}":[`应用于 {date}`,`طُبّق في {date}`],"Rejected {date}":[`拒绝于 {date}`,`رُفض في {date}`],"Undone {date}":[`撤销于 {date}`,`تم التراجع في {date}`],"Stale since {date}":[`自 {date} 起已过期`,`قديم منذ {date}`],"Each card shows when the proposal was created and when it was last applied, rejected or undone.":[`每张卡片显示提案的创建时间,以及最近一次应用、拒绝或撤销的时间。`,`تعرض كل بطاقة وقت إنشاء المقترح ووقت آخر تطبيق أو رفض أو تراجع.`],History:[`历史记录`,`السجل`],created:[`已创建`,`أُنشئ`],"Each proposal, apply, reject and undo of this skill. Revert an applied change to restore SKILL.md as it was before it.":[`此技能的每个提案、应用、拒绝和撤销。还原已应用的更改可将 SKILL.md 恢复到该更改之前的状态。`,`كل مقترح وتطبيق ورفض وتراجع لهذه المهارة. أعِد تغييراً مطبّقاً لتستعيد SKILL.md كما كان قبله.`],"No history yet.":[`暂无历史记录。`,`لا يوجد سجل بعد.`],"{added} lines added, {removed} lines removed":[`新增 {added} 行,删除 {removed} 行`,`أُضيف {added} سطر، وحُذف {removed} سطر`],"Revert to before this change":[`还原到此更改之前`,`الرجوع إلى ما قبل هذا التغيير`],"Revert the newer change first.":[`请先还原较新的更改。`,`أعِد التغيير الأحدث أولاً.`],"Revert this change?":[`还原此更改?`,`هل تريد إعادة هذا التغيير؟`],"OMMS restores SKILL.md as it was before this change.":[`OMMS 会将 SKILL.md 恢复到此更改之前的状态。`,`يستعيد OMMS ملف SKILL.md كما كان قبل هذا التغيير.`],"Reverting this also removes {count} later change.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة تغيير لاحق واحد ({count}).`],"Reverting this also removes {count} later changes.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة {count} من التغييرات اللاحقة.`],Revert:[`还原`,`إعادة`],"Reverting…":[`正在还原…`,`جارٍ الإعادة…`],"Reverted. SKILL.md is back to the version before that change.":[`已还原。SKILL.md 已恢复到该更改之前的版本。`,`تمت الإعادة. عاد SKILL.md إلى النسخة السابقة لذلك التغيير.`],Activity:[`活动`,`النشاط`],"Activity could not load.":[`无法加载活动。`,`تعذّر تحميل النشاط.`],"Active skills":[`活跃技能`,`المهارات النشطة`],"Uses per day":[`每日使用`,`الاستخدامات يومياً`],"Uses in the last 30 days":[`最近 30 天的使用`,`الاستخدامات في آخر 30 يوماً`],"Most used skills":[`最常用的技能`,`المهارات الأكثر استخداماً`],"Proposal pipeline":[`提案进度`,`مسار المقترحات`],Successful:[`成功`,`ناجح`],Day:[`日期`,`اليوم`],"{uses} uses, {failed} with a failed tool call":[`使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"{name} leads with {uses} uses. Click a bar to open the skill.":[`{name} 以 {uses} 次使用领先。点击条形可打开该技能。`,`تتصدر {name} بعدد {uses} استخدام. انقر على شريط لفتح المهارة.`],"{total} proposals, {pending} waiting for a decision":[`共 {total} 个提案,{pending} 个等待决定`,`{total} مقترح، منها {pending} بانتظار قرار`],"No uses in the last 30 days. Bars appear after OMMS records turns.":[`最近 30 天没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في آخر 30 يوماً. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"No skill was used in the last 30 days.":[`最近 30 天没有使用任何技能。`,`لم تُستخدم أي مهارة في آخر 30 يوماً.`],"No skill uses are recorded in the last 30 days. The use charts appear after OMMS records agent turns that use a skill.":[`最近 30 天没有记录到技能使用。OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`لا توجد استخدامات مسجلة للمهارات في آخر 30 يوماً. تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"Show uses by":[`使用次数显示方式`,`عرض الاستخدامات حسب`],Days:[`按天`,`الأيام`],Months:[`按月`,`الأشهر`],Years:[`按年`,`السنوات`],"Days to show":[`要显示的日期范围`,`الأيام المعروضة`],"Year to show":[`要显示的年份`,`السنة المعروضة`],"Last 30 days":[`最近 30 天`,`آخر 30 يوماً`],"Uses per month":[`每月使用`,`الاستخدامات شهرياً`],"Uses per year":[`每年使用`,`الاستخدامات سنوياً`],Month:[`月份`,`الشهر`],Year:[`年份`,`السنة`],"{from} to {to}":[`{from} 至 {to}`,`من {from} إلى {to}`],"Uses in {period}":[`{period} 的使用`,`الاستخدامات في {period}`],"{period}: {uses} uses, {failed} with a failed tool call":[`{period}:使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{period}: {uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"No skill uses are recorded in {period}.":[`{period} 没有记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات في {period}.`],"No skill uses are recorded yet.":[`尚未记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات بعد.`],"The use charts appear after OMMS records agent turns that use a skill.":[`OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"No uses in this period. Bars appear after OMMS records turns.":[`此期间没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في هذه الفترة. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"Showing {shown} of {total}":[`显示 {shown} / {total}`,`عرض {shown} من {total}`],"Show more":[`显示更多`,`عرض المزيد`],"Show less":[`显示更少`,`عرض أقل`],lines:[`行`,`أسطر`],"Show {count} more":[`再显示 {count} 条`,`عرض {count} إضافية`],"Last modified":[`最近修改`,`آخر تعديل`],"Modified on {date}":[`修改于 {date}`,`تم التعديل في {date}`],"Show skills by modification":[`按是否修改显示技能`,`عرض المهارات حسب التعديل`],"All ({count})":[`全部({count})`,`الكل ({count})`],"Not modified ({count})":[`未修改({count})`,`غير معدّلة ({count})`],"Modified ({count})":[`已修改({count})`,`معدّلة ({count})`],"No skill has been modified yet.":[`尚未修改任何技能。`,`لم يتم تعديل أي مهارة بعد.`],"Every skill has been modified.":[`所有技能都已修改。`,`تم تعديل كل المهارات.`],"Suggested ({count})":[`建议({count})`,`مقترحة ({count})`],"No skill is suggested for a change yet.":[`尚无建议修改的技能。`,`لم تُقترح أي مهارة للتعديل بعد.`],"The state could not be saved, so SKILL.md is as it was. Try again.":[`无法保存状态,SKILL.md 保持原样。请重试。`,`تعذر حفظ الحالة، لذا بقي SKILL.md كما كان. حاول مرة أخرى.`],"No skill matches this name in this tab.":[`此标签页中没有技能匹配该名称。`,`لا توجد مهارة تطابق هذا الاسم في هذا التبويب.`],"Import chat history":[`导入聊天记录`,`استيراد سجل المحادثات`],"Memory limits":[`记忆限制`,`حدود الذاكرة`],"Resolve missing project folders":[`解析缺失的项目文件夹`,`حل مجلدات المشاريع المفقودة`],"Project memories":[`项目记忆`,`ذاكرة المشروع`],"User profile":[`用户画像`,`الملف الشخصي للمستخدم`],"(preferences, patterns, and workflows)":[`(偏好、模式和工作流程)`,`(التفضيلات والأنماط وسير العمل)`],"All hosts":[`所有宿主`,`جميع المضيفين`],"Selected hosts":[`已选宿主`,`المضيفون المحددون`],"Choose at least one output.":[`请至少选择一项输出。`,`اختر مخرجاً واحداً على الأقل.`],"Choose at least one host.":[`请至少选择一个宿主。`,`اختر مضيفاً واحداً على الأقل.`],"Re-analyse handled history":[`重新分析已处理的记录`,`إعادة تحليل السجل المعالج`],"Re-analysis applies to the selected outputs. Each profile prompt can be forcibly re-analysed once. Findings merge into the existing profile.":[`重新分析适用于所选输出。每条画像提示只能强制重新分析一次。结果合并到现有画像中。`,`تنطبق إعادة التحليل على المخرجات المحددة. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة. تُدمج النتائج في الملف الحالي.`],"Preview the current selection before starting an import.":[`开始导入前,请预览当前选择。`,`عاين الاختيار الحالي قبل بدء الاستيراد.`],"This import makes model calls. Continue?":[`此次导入会调用模型。是否继续?`,`سيجري هذا الاستيراد اتصالات بالنموذج. هل تريد المتابعة؟`],"Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.":[`对话生成项目事实。用户提示生成个人偏好、重复模式和工作流程步骤。`,`تضيف المحادثات حقائق المشروع. وتضيف مطالبات المستخدم التفضيلات الشخصية والأنماط المتكررة وخطوات سير العمل.`],"Profile identity in Settings":[`设置中的画像身份`,`هوية الملف الشخصي في الإعدادات`],"Hosts keep their existing user identities. All hosts does not merge profiles with different identities.":[`各宿主保留现有用户身份。选择所有宿主不会合并不同身份的画像。`,`يحتفظ المضيفون بهويات المستخدم الحالية. اختيار جميع المضيفين لا يدمج ملفات الهويات المختلفة.`],"Pi session reader is unavailable. Fix the reader or deselect Pi.":[`Pi 会话读取器不可用。请修复读取器或取消选择 Pi。`,`قارئ جلسات Pi غير متاح. أصلح القارئ أو ألغِ تحديد Pi.`],"Import results":[`导入结果`,`نتائج الاستيراد`],"Import successful 🎉":[`导入成功`,`تم الاستيراد بنجاح`],"Import failed":[`导入失败`,`فشل الاستيراد`],"Import cancelled":[`导入已取消`,`تم إلغاء الاستيراد`],"The import finished while you were away.":[`导入在你离开时已结束。`,`انتهى الاستيراد أثناء غيابك.`],"Could not reload the settings. Reload the page.":[`无法重新加载设置。请刷新页面。`,`تعذر إعادة تحميل الإعدادات. أعد تحميل الصفحة.`],OK:[`确定`,`حسناً`],Dismiss:[`关闭`,`إغلاق`],"Show handled sessions":[`显示已处理的会话`,`إظهار الجلسات المعالجة`],Handled:[`已处理`,`تمت معالجتها`],"Handled sessions hidden":[`已隐藏的已处理会话`,`الجلسات المعالجة المخفية`],"Some memory units failed. Completed work is saved. A new preview and import retries only the failed units.":[`部分记忆单元失败。已完成的工作已保存。重新预览并导入只会重试失败的单元。`,`فشلت بعض وحدات الذاكرة. العمل المكتمل محفوظ. المعاينة والاستيراد الجديدان يعيدان محاولة الوحدات الفاشلة فقط.`],"Profile learning failed. Completed memory work is saved.":[`画像学习失败。已完成的记忆处理已保存。`,`فشل تعلّم الملف الشخصي. عمل الذاكرة المكتمل محفوظ.`],"Import preparation failed.":[`导入准备失败。`,`فشل تحضير الاستيراد.`],"Refresh the preview and retry.":[`请刷新预览后重试。`,`حدّث المعاينة ثم أعد المحاولة.`],"The session list is out of date. Refresh the list and try again.":[`会话列表已过期。请刷新列表后重试。`,`قائمة الجلسات قديمة. حدّث القائمة ثم أعد المحاولة.`],"The history source changed. Choose it again.":[`历史记录来源已更改。请重新选择。`,`تغيّر مصدر السجل. اختره مجدداً.`],"The history source is no longer valid. Choose it again.":[`历史记录来源已失效。请重新选择。`,`لم يعد مصدر السجل صالحاً. اختره مجدداً.`],"A Pi import is already running":[`已有 Pi 导入正在运行`,`استيراد Pi قيد التشغيل بالفعل`],"An OpenCode import is already running":[`已有 OpenCode 导入正在运行`,`استيراد OpenCode قيد التشغيل بالفعل`],"A Claude Code import is already running":[`已有 Claude Code 导入正在运行`,`استيراد Claude Code قيد التشغيل بالفعل`],"Combined counts":[`合计数量`,`الأعداد المجمعة`],"Current host":[`当前宿主`,`المضيف الحالي`],"Memory extraction":[`提取记忆`,`استخراج الذاكرة`],"Memory units":[`记忆单元`,`وحدات الذاكرة`],"Pending memory units":[`待处理记忆单元`,`وحدات الذاكرة المعلقة`],"Imported memory units":[`已导入记忆单元`,`وحدات الذاكرة المستوردة`],"Already handled memory units":[`已处理记忆单元`,`وحدات الذاكرة المعالجة سابقاً`],"Skipped memory units":[`已跳过记忆单元`,`وحدات الذاكرة المتخطاة`],"Failed memory units":[`失败的记忆单元`,`وحدات الذاكرة التي فشلت`],"Held-back turns":[`暂缓处理的轮次`,`الرسائل المؤجلة`],"Untimed turns":[`无时间戳的轮次`,`الرسائل بلا طابع زمني`],"Load errors":[`加载错误`,`أخطاء التحميل`],"Already handled profile prompts":[`已处理画像提示`,`مطالبات الملف الشخصي المعالجة سابقاً`],"Profile prompts":[`画像提示`,`مطالبات الملف الشخصي`],"Profile batches":[`画像批次`,`دفعات الملف الشخصي`],"Estimated profile analysis calls":[`预计画像分析调用次数`,`اتصالات تحليل الملف الشخصي المقدّرة`],"Waiting prompts inside OMMS":[`OMMS 内等待处理的提示`,`المطالبات المنتظرة داخل OMMS`],"No work to process":[`没有待处理工作`,`لا يوجد عمل للمعالجة`],queued:[`排队中`,`في الانتظار`],preparing:[`准备中`,`جارٍ التحضير`],"not-run":[`未运行`,`لم يُشغّل`],"Automatic profile cleanup":[`自动整理画像`,`التنظيف التلقائي للملف الشخصي`],"After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.":[`学习完成后,OMMS 会在后台自动合并重复的画像条目,并删除含糊的条目。每次运行大约每 100 个条目调用一次模型,在大型画像上需要几分钟。在“用户画像”页面选择“撤销上次自动整理”可恢复这些更改。`,`بعد كل جولة تعلّم، يدمج OMMS عناصر الملف الشخصي المكررة ويحذف العناصر الغامضة تلقائياً في الخلفية. تجري كل عملية نحو اتصال واحد بالنموذج لكل 100 عنصر وتستغرق عدة دقائق على الملف الكبير. يعيد خيار «تراجع عن آخر تنظيف تلقائي» في صفحة الملف الشخصي التغييرات.`],"Clean up the profile automatically":[`自动整理画像`,`تنظيف الملف الشخصي تلقائياً`],"Run every this many analysed prompts":[`每隔多少条已分析的提示运行一次`,`التشغيل كل عدد من المطالبات المحللة`],"Save interval":[`保存间隔`,`حفظ الفاصل`],"Enter a whole number from 50 to 100000.":[`请输入 50 到 100000 之间的整数。`,`أدخل عدداً صحيحاً من 50 إلى 100000.`],"Saved. Changes apply at the next learning pass.":[`已保存。更改将在下一次学习时生效。`,`تم الحفظ. تنطبق التغييرات في جولة التعلّم التالية.`],"Analyse waiting prompts":[`分析等待处理的提示`,`تحليل المطالبات المنتظرة`],"Re-analyse chat history":[`重新分析聊天记录`,`إعادة تحليل سجل المحادثات`],"Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.":[`分析等待处理的提示使用已保存的外部 API,读取 OMMS 内已有的提示,每次分析调用处理 50 条符合条件的提示。不会重新分析已完成的历史记录。输出包括偏好、模式和工作流程。`,`يقرأ تحليل المطالبات المنتظرة المطالبات الموجودة داخل OMMS عبر واجهة API الخارجية المحفوظة، بمعدل 50 مطالبة مؤهلة لكل اتصال تحليل. لا يُعاد تحليل السجل المكتمل. المخرجات هي التفضيلات والأنماط وسير العمل.`],"Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.":[`分析调用次数为估计值。匹配、去重、重试和新增的等待提示可能增加调用次数。`,`اتصالات التحليل تقديرية. قد تضيف المطابقة وإزالة التكرار وإعادة المحاولة والمطالبات المنتظرة الجديدة اتصالات أخرى.`],"Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.":[`重新分析聊天记录会打开强制仅导入画像的流程。现有画像和项目记忆将保留。必须先预览并确认。每条画像提示只能强制重新分析一次。`,`تفتح إعادة تحليل سجل المحادثات استيراداً قسرياً للملف الشخصي فقط. تُحفظ ذاكرة المشروع وملفك الشخصي. تلزم المعاينة والتأكيد. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة.`],"Automatic import reads older conversations when a host starts. It populates project memories and user profile input. The first backfill fixes a cutoff; later turns use live capture.":[`自动导入在宿主启动时读取较早的对话,填充项目记忆和用户画像输入。首次回填固定截止时间,之后的轮次使用实时捕获。`,`يقرأ الاستيراد التلقائي المحادثات الأقدم عند بدء المضيف. ويضيف ذاكرة المشروع ومدخلات الملف الشخصي. يثبت أول استيراد تاريخاً فاصلاً؛ وتستخدم الرسائل اللاحقة الالتقاط المباشر.`],"A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.":[`目录映射将记录的项目文件夹链接到当前文件夹。保存的映射在下次导入或回填时全局应用于所有宿主。保存前请检查更改。`,`تربط خريطة المجلدات مجلد المشروع المسجل بمجلده الحالي. تنطبق الخرائط المحفوظة على جميع المضيفين في الاستيراد التالي. راجع التغييرات قبل الحفظ.`],"Prompt date from must not be after Prompt date to.":[`提示开始日期不能晚于结束日期。`,`يجب ألا يأتي تاريخ بدء المطالبات بعد تاريخ انتهائها.`],"Profile batch size must be a positive integer.":[`画像批次大小必须为正整数。`,`يجب أن يكون حجم دفعة الملف الشخصي عدداً صحيحاً موجباً.`],Models:[`模型`,`النماذج`],"External API fallback":[`外部 API 备用模型`,`النموذج الاحتياطي عبر واجهة API الخارجية`],none:[`无`,`لا يوجد`],ready:[`就绪`,`جاهز`],"not ready":[`未就绪`,`غير جاهز`],"Credentials (values hidden)":[`凭据(不显示内容)`,`بيانات الاعتماد (القيم مخفية)`],set:[`已设置`,`مضبوط`],"not set":[`未设置`,`غير مضبوط`],"Effective model":[`当前使用模型`,`النموذج المستخدم`],session:[`会话`,`الجلسة`],"external API":[`外部 API`,`واجهة API الخارجية`],unavailable:[`不可用`,`غير متاح`],"Project override is active. Changes to the global file may not take effect here.":[`项目设置优先。全局文件的更改可能不会在此生效。`,`إعدادات المشروع لها الأولوية. قد لا تسري تغييرات الملف العام هنا.`],"Model choice":[`模型选择`,`اختيار النموذج`],"Session model":[`会话模型`,`نموذج الجلسة`],"Manual model":[`手动选择模型`,`اختيار النموذج يدوياً`],"Manual provider/model":[`手动输入提供商/模型`,`إدخال المزوّد/النموذج يدوياً`],"Model list unavailable. Enter provider/model manually.":[`模型列表不可用。请手动输入提供商/模型。`,`قائمة النماذج غير متاحة. أدخل المزوّد/النموذج يدوياً.`],"OpenCode model list unavailable":[`OpenCode 模型列表不可用`,`قائمة نماذج OpenCode غير متاحة`],"OMMS could not find OpenCode on this computer, so it cannot list OpenCode's models here. Type the model as provider/model, for example zai-coding-plan/glm-5.3. If OpenCode is installed, open an OpenCode session and reload this page.":[`OMMS 在这台电脑上找不到 OpenCode,因此无法在此列出 OpenCode 的模型。请按 提供商/模型 格式输入模型,例如 zai-coding-plan/glm-5.3。如果已安装 OpenCode,请打开一个 OpenCode 会话,然后重新加载此页面。`,`لم يعثر OMMS على OpenCode في هذا الحاسوب، لذا لا يمكنه عرض نماذج OpenCode هنا. أدخل النموذج بصيغة المزوّد/النموذج، مثل zai-coding-plan/glm-5.3. إذا كان OpenCode مثبتاً، فافتح جلسة OpenCode ثم أعد تحميل هذه الصفحة.`],"OpenCode took too long to send its model list. Reload this page to try again, or type the model as provider/model.":[`OpenCode 发送模型列表的时间过长。请重新加载此页面重试,或按 提供商/模型 格式输入模型。`,`استغرق OpenCode وقتاً طويلاً لإرسال قائمة نماذجه. أعد تحميل هذه الصفحة للمحاولة مرة أخرى، أو أدخل النموذج بصيغة المزوّد/النموذج.`],"OpenCode has no signed-in models. Run `opencode auth login`, then reload this page.":["OpenCode 没有已登录的模型。请运行 `opencode auth login`,然后重新加载此页面。","لا توجد في OpenCode نماذج مسجَّل الدخول إليها. شغّل `opencode auth login` ثم أعد تحميل هذه الصفحة."],"This OpenCode version sent a model list OMMS cannot read. Type the model as provider/model. Update OMMS if this continues.":[`此版本的 OpenCode 发送的模型列表 OMMS 无法读取。请按 提供商/模型 格式输入模型。如果问题持续,请更新 OMMS。`,`أرسل هذا الإصدار من OpenCode قائمة نماذج لا يستطيع OMMS قراءتها. أدخل النموذج بصيغة المزوّد/النموذج. حدّث OMMS إذا استمرت المشكلة.`],"OMMS could not read Pi's model list. Type the model as provider/model.":[`OMMS 无法读取 Pi 的模型列表。请按 提供商/模型 格式输入模型。`,`تعذّر على OMMS قراءة قائمة نماذج Pi. أدخل النموذج بصيغة المزوّد/النموذج.`],"Pi has no signed-in models. Sign in to a provider in Pi, then reload this page.":[`Pi 没有已登录的模型。请在 Pi 中登录一个提供商,然后重新加载此页面。`,`لا توجد في Pi نماذج مسجَّل الدخول إليها. سجّل الدخول إلى مزوّد في Pi ثم أعد تحميل هذه الصفحة.`],"Save model":[`保存模型`,`حفظ النموذج`],"Enter a model as provider/model.":[`按 提供商/模型 格式输入。`,`أدخل النموذج بصيغة المزوّد/النموذج.`],"Saved. New capture and profile work uses these settings.":[`已保存。下一次捕获和用户画像将使用这些设置。`,`تم الحفظ. ستستخدم عمليات الالتقاط والملف الشخصي الجديدة هذه الإعدادات.`],"Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.":[`已保存。OMMS 现在读取 ~/.config/omms/omms.jsonc,旧配置保留。`,`تم الحفظ. يقرأ OMMS الآن الملف ~/.config/omms/omms.jsonc مع الاحتفاظ بالإعدادات القديمة.`],"Current settings were reloaded; check the values and save again.":[`已重新加载当前设置;检查数值后再次保存。`,`أُعيد تحميل الإعدادات الحالية. راجع القيم ثم احفظ مجدداً.`],"Capture diagnostics":[`捕获诊断`,`تشخيص الالتقاط`],"Time range":[`时间范围`,`الفترة الزمنية`],"24 hours":[`24 小时`,`24 ساعة`],"7 days":[`7 天`,`7 أيام`],"30 days":[`30 天`,`30 يوماً`],"90 days":[`90 天`,`90 يوماً`],"Host / model":[`主机 / 模型`,`المضيف / النموذج`],Saved:[`已保存`,`محفوظ`],Skipped:[`已跳过`,`متجاوز`],Failed:[`失败`,`فشل`],Total:[`总数`,`المجموع`],"Failure reasons":[`失败原因`,`أسباب الفشل`],"Recent attempts":[`最近尝试`,`المحاولات الأخيرة`],Time:[`时间`,`الوقت`],Host:[`主机`,`المضيف`],Source:[`来源`,`المصدر`],Session:[`会话`,`الجلسة`],Path:[`路径`,`المسار`],Model:[`模型`,`النموذج`],Stop:[`结束原因`,`سبب التوقف`],Blocks:[`区块`,`الكتل`],Prompt:[`提示词长度`,`طول الطلب`],Reply:[`回复长度`,`طول الرد`],Duration:[`耗时`,`المدة`],Outcome:[`结果`,`النتيجة`],Reason:[`原因`,`السبب`],"Save capture traces":[`保存捕获追踪`,`حفظ تتبعات الالتقاط`],"Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.":[`追踪文件在脱敏后仍可能包含对话内容。仅在调试时开启。`,`قد تحتوي التتبعات على محتوى المحادثة بعد التنقيح. فعّلها عند التصحيح فقط.`],"This project turns tracing off. The global switch cannot turn it on here.":[`此项目已关闭追踪。全局开关无法在此开启。`,`أوقف هذا المشروع التتبع. لا يمكن للمفتاح العام تفعيله هنا.`],"Trace retention (days)":[`追踪保留天数`,`مدة حفظ التتبعات (بالأيام)`],"Attempt retention (days)":[`尝试记录保留天数`,`مدة حفظ المحاولات (بالأيام)`],"Retry retention (hours)":[`重试保留小时数`,`مدة حفظ إعادة المحاولة (بالساعات)`],"When the capture model cannot be reached, OMMS keeps the turn and tries again later. Queued turns can hold conversation content after redaction. 0 turns the queue off and deletes waiting turns.":[`捕获模型无法访问时,OMMS 会保留该轮对话并稍后重试。排队的对话在脱敏后仍可能包含对话内容。设为 0 会关闭队列并删除等待中的对话。`,`عندما يتعذر الوصول إلى نموذج الالتقاط، يحتفظ OMMS بالجولة ويعيد المحاولة لاحقاً. قد تحتوي الجولات المنتظرة على محتوى المحادثة بعد التنقيح. القيمة 0 توقف قائمة الانتظار وتحذف الجولات المنتظرة.`],"Turns waiting for retry":[`等待重试的对话`,`الجولات المنتظرة لإعادة المحاولة`],"Retry now":[`立即重试`,`أعد المحاولة الآن`],"Retrying now.":[`正在重试。`,`تجري إعادة المحاولة الآن.`],"A retry is already running.":[`重试已在运行。`,`إعادة المحاولة قيد التشغيل بالفعل.`],"These turns retry at the next Pi session start.":[`这些对话将在下次启动 Pi 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Pi التالية.`],"These turns retry at the next OpenCode session start.":[`这些对话将在下次启动 OpenCode 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة OpenCode التالية.`],"These turns retry at the next Claude Code session start.":[`这些对话将在下次启动 Claude Code 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Claude Code التالية.`],"Claude Code capture uses the external API.":[`Claude Code 捕获使用外部 API。`,`يستخدم التقاط Claude Code واجهة API الخارجية.`],"Claude Code capture is off. Complete the external API settings.":[`Claude Code 捕获已关闭。请完成外部 API 设置。`,`التقاط Claude Code متوقف. أكمل إعدادات واجهة API الخارجية.`],"Missing settings":[`缺少的设置`,`الإعدادات الناقصة`],"memoryModel is not configured":[`未配置 memoryModel`,`لم يُضبط memoryModel`],"memoryApiUrl is not configured":[`未配置 memoryApiUrl`,`لم يُضبط memoryApiUrl`],"memoryApiKey is not configured":[`未配置 memoryApiKey`,`لم يُضبط memoryApiKey`],"memoryApiKey contains a placeholder value":[`memoryApiKey 包含占位值`,`يحتوي memoryApiKey على قيمة نائبة`],"Claude Code backfill always uses the external API. It has no backfill model setting.":[`Claude Code 回填始终使用外部 API,没有回填模型设置。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية، ولا يوجد له إعداد لنموذج الاستيراد.`],"Claude Code transcripts folder":[`Claude Code 对话记录文件夹`,`مجلد سجلات محادثات Claude Code`],"Claude Code transcripts":[`Claude Code 对话记录`,`سجلات محادثات Claude Code`],found:[`已找到`,`موجود`],"not found":[`未找到`,`غير موجود`],"Claude Code imports always use the external API.":[`Claude Code 导入始终使用外部 API。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية.`],"Claude Code imports use the external API. Complete the external API settings.":[`Claude Code 导入使用外部 API。请完成外部 API 设置。`,`يستخدم استيراد Claude Code واجهة API الخارجية. أكمل إعدادات واجهة API الخارجية.`],"Trace files":[`追踪文件`,`ملفات التتبع`],View:[`查看`,`عرض`],Delete:[`删除`,`حذف`],Health:[`健康检查`,`فحص الحالة`],"Config files":[`配置文件`,`ملفات الإعدادات`],"Memory store":[`记忆存储`,`مخزن الذاكرة`],Embedding:[`嵌入模型`,`نموذج التضمين`],"Web binding":[`网页服务绑定`,`ربط خادم الويب`],"OpenCode model":[`OpenCode 模型`,`نموذج OpenCode`],"Pi model":[`Pi 模型`,`نموذج Pi`],"Capture failures (24 hours)":[`捕获失败(24 小时)`,`فشل الالتقاط (24 ساعة)`],"OpenCode model test":[`OpenCode 模型测试`,`اختبار نموذج OpenCode`],"Pi model test":[`Pi 模型测试`,`اختبار نموذج Pi`],"Run checks":[`运行检查`,`تشغيل الفحوصات`],"Run checks and test models":[`运行检查并测试模型`,`تشغيل الفحوصات واختبار النماذج`],"Checking…":[`正在检查…`,`جارٍ الفحص…`],pass:[`通过`,`نجاح`],warn:[`警告`,`تحذير`],fail:[`失败`,`فشل`],"Import and backfill":[`导入和回填`,`الاستيراد والاستكمال`],"Automatic import":[`自动导入`,`الاستيراد التلقائي`],"Automatic import makes model calls. Changes apply at the next host start. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。更改在下次启动主机时生效。关闭后,正在运行的导入将在当前轮次结束后停止。`,`يستدعي الاستيراد التلقائي النموذج. تسري التغييرات عند بدء المضيف التالي. يوقف التعطيل الاستيراد بعد التبادل الحالي.`],"Import past chats automatically":[`自动导入过去的对话`,`استيراد المحادثات السابقة تلقائياً`],"Backfill model":[`历史导入模型`,`نموذج استيراد السجل`],"Same as live capture":[`与实时捕获相同`,`مثل الالتقاط المباشر`],"Saved. Changes apply at the next host start.":[`已保存。更改在下次启动主机时生效。`,`تم الحفظ. تسري التغييرات عند بدء المضيف التالي.`],State:[`状态`,`الحالة`],"not started":[`尚未开始`,`لم يبدأ`],"not-started":[`尚未开始`,`لم يبدأ`],Imported:[`已导入`,`مستورَد`],Pending:[`待处理`,`معلّق`],"Unresolved sessions":[`目录未解析的会话`,`جلسات بمجلدات غير محددة`],Cutoff:[`截止时间`,`وقت القطع`],stopped:[`已停止`,`توقف`],"Web app":[`网页应用`,`تطبيق الويب`],"Start web app at login":[`登录时启动网页应用`,`بدء تطبيق الويب عند تسجيل الدخول`],"Login item":[`登录启动项`,`عنصر بدء تسجيل الدخول`],"not installed":[`未安装`,`غير مثبّت`],"not-installed":[`未安装`,`غير مثبّت`],installed:[`已安装`,`مثبّت`],unsupported:[`不受支持`,`غير مدعوم`],"no-runtime":[`缺少运行环境`,`بيئة التشغيل غير متاحة`],"no-package":[`缺少软件包`,`الحزمة غير متاحة`],"no-launcher":[`缺少启动器`,`المشغّل غير متاح`],"Login items are unsupported on this platform.":[`此平台不支持登录启动项。`,`عناصر بدء تسجيل الدخول غير مدعومة على هذا النظام.`],"Install Node or Bun to start the web app at login.":[`安装 Node 或 Bun 后,网页应用才能在登录时启动。`,`ثبّت Node أو Bun لبدء تطبيق الويب عند تسجيل الدخول.`],"Use these commands to apply the change now:":[`使用以下命令立即应用更改:`,`استخدم هذه الأوامر لتطبيق التغيير الآن:`],"Saved. The login item changes at the next Pi or OpenCode start.":[`已保存。登录启动项将在下次启动 Pi 或 OpenCode 时更新。`,`تم الحفظ. يتغير عنصر بدء التشغيل عند بدء Pi أو OpenCode التالي.`],"History host":[`历史记录主机`,`مضيف السجل`],Scope:[`范围`,`النطاق`],"Current project":[`当前项目`,`المشروع الحالي`],"All projects":[`所有项目`,`كل المشاريع`],"Project directory":[`项目目录`,`مجلد المشروع`],"Current directory":[`当前目录`,`المجلد الحالي`],"Profile batch size":[`用户画像批量大小`,`حجم دفعة الملف الشخصي`],"Directory maps (old=new, one per line)":[`目录映射(旧=新,每行一条)`,`تعيين المجلدات (قديم=جديد، واحد في كل سطر)`],"Force reimport":[`强制重新导入`,`فرض إعادة الاستيراد`],"Skip memories":[`跳过记忆`,`تجاوز الذكريات`],"Skip profile":[`跳过用户画像`,`تجاوز الملف الشخصي`],"Import model":[`导入模型`,`نموذج الاستيراد`],"Saved external API":[`已保存的外部 API`,`واجهة API الخارجية المحفوظة`],"Preview (dry run)":[`预览(不写入)`,`معاينة (تشغيل تجريبي)`],"Start import":[`开始导入`,`بدء الاستيراد`],"Cancel after current unit":[`完成当前单元后取消`,`الإلغاء بعد الوحدة الحالية`],"Directory maps must be old=new, one per line":[`目录映射须为 旧=新,每行一条`,`يجب أن يكون تعيين المجلدات بصيغة قديم=جديد، واحد في كل سطر`],running:[`运行中`,`جارٍ التشغيل`],cancelling:[`正在取消`,`جارٍ الإلغاء`],cancelled:[`已取消`,`أُلغي`],done:[`已完成`,`اكتمل`],failed:[`失败`,`فشل`],units:[`单元`,`وحدات`],"List sessions":[`列出会话`,`عرض الجلسات`],"Refresh list":[`刷新列表`,`تحديث القائمة`],"Advanced options":[`高级选项`,`خيارات متقدمة`],"Hide advanced options":[`隐藏高级选项`,`إخفاء الخيارات المتقدمة`],"default location":[`默认位置`,`الموقع الافتراضي`],"Prompt date from":[`提示日期起`,`تاريخ الطلب من`],"Prompt date to":[`提示日期止`,`تاريخ الطلب إلى`],"Prompt dates are inclusive, use your time zone, and filter the turns inside each session, not the list. Empty dates include every turn.":[`提示日期包含首尾两天,按你所在时区计算,只筛选每个会话中的对话轮次,不筛选列表。留空则包含所有轮次。`,`تواريخ الطلب شاملة لليومين، وتُحسب بمنطقتك الزمنية، وتُصفّي الأدوار داخل كل جلسة لا القائمة. تركها فارغة يشمل كل الأدوار.`],"Sessions with directories that no longer exist":[`目录已不存在的会话`,`جلسات لم تعد مجلداتها موجودة`],"Show them and add a directory map":[`显示它们并添加目录映射`,`اعرضها وأضف تعيين مجلد`],Selected:[`已选择`,`المحدد`],"Select all matching":[`选择所有匹配项`,`تحديد كل المطابق`],"Clear selection":[`清除选择`,`مسح التحديد`],Select:[`选择`,`تحديد`],Created:[`创建时间`,`تاريخ الإنشاء`],"Resolved by":[`解析方式`,`طريقة التحديد`],recorded:[`记录的目录`,`المجلد المسجّل`],mapped:[`目录映射`,`تعيين مجلد`],"project root":[`项目根目录`,`جذر المشروع`],missing:[`缺失`,`مفقود`],"No sessions match.":[`没有匹配的会话。`,`لا توجد جلسات مطابقة.`],Previous:[`上一页`,`السابق`],Next:[`下一页`,`التالي`],None:[`无`,`لا شيء`],"Configured, not tested.":[`已配置,未测试。`,`مُعدّ، لم يُختبر.`],"An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode.":[`使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。`,`يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode.`],"The chosen OpenCode model is not connected here. An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode. Choose the external API for a web import.":[`所选 OpenCode 模型在此处未连接。使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。网页导入请选择外部 API。`,`نموذج OpenCode المختار غير متصل هنا. يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode. اختر واجهة API الخارجية للاستيراد من الصفحة.`],"Test models in Health":[`在健康检查中测试模型`,`اختبر النماذج في قسم السلامة`],Import:[`导入`,`استيراد`],sessions:[`个会话`,`جلسات`],"1 session":[`1 个会话`,`جلسة واحدة`],"List sessions first.":[`请先列出会话。`,`اعرض الجلسات أولاً.`],"Options changed. Refresh the session list first.":[`选项已更改。请先刷新会话列表。`,`تغيّرت الخيارات. حدّث قائمة الجلسات أولاً.`],"Select at least one session.":[`请至少选择一个会话。`,`حدّد جلسة واحدة على الأقل.`],"Select at most 1000 sessions one by one, or use Select all matching.":[`逐个选择最多 1000 个会话,或使用“选择所有匹配项”。`,`حدّد 1000 جلسة كحد أقصى واحدة تلو الأخرى، أو استخدم «تحديد كل المطابق».`],"Model readiness is unknown. Reload the page.":[`无法确定模型是否就绪。请重新加载页面。`,`حالة جاهزية النموذج غير معروفة. أعد تحميل الصفحة.`],"No import model is ready. Connect a model in OpenCode or complete the external API settings.":[`没有可用的导入模型。请在 OpenCode 中连接模型,或补全外部 API 设置。`,`لا يوجد نموذج استيراد جاهز. اربط نموذجاً في OpenCode أو أكمل إعدادات واجهة API الخارجية.`],"The external API is not ready":[`外部 API 未就绪`,`واجهة API الخارجية غير جاهزة`],"The external API has no memoryModel in the global config":[`全局配置中缺少外部 API 的 memoryModel`,`لا يحتوي الإعداد العام على memoryModel لواجهة API الخارجية`],"The external API has no memoryApiUrl in the global config":[`全局配置中缺少外部 API 的 memoryApiUrl`,`لا يحتوي الإعداد العام على memoryApiUrl لواجهة API الخارجية`],"The external API key is missing in the OpenCode process; check memoryApiKey and its env:// or file:// source":[`OpenCode 进程中缺少外部 API 密钥;请检查 memoryApiKey 及其 env:// 或 file:// 来源`,`مفتاح واجهة API الخارجية غير موجود في عملية OpenCode؛ تحقّق من memoryApiKey ومصدره env:// أو file://`],"The memoryProvider in the global config is not supported for imports":[`全局配置中的 memoryProvider 不支持导入`,`مزوّد memoryProvider في الإعداد العام غير مدعوم للاستيراد`],"Pi sessions folder or one .jsonl session file":[`Pi 会话文件夹或单个 .jsonl 会话文件`,`مجلد جلسات Pi أو ملف جلسة ‎.jsonl واحد`],"OpenCode database file":[`OpenCode 数据库文件`,`ملف قاعدة بيانات OpenCode`],"Absolute path, for example on a mounted volume":[`绝对路径,例如已挂载卷上的路径`,`مسار مطلق، مثلاً على وحدة تخزين مركّبة`],"Use this source":[`使用此来源`,`استخدم هذا المصدر`],Browse:[`浏览`,`استعراض`],"Use the default location":[`使用默认位置`,`استخدم الموقع الافتراضي`],"Chosen source":[`已选来源`,`المصدر المختار`],Choose:[`选择`,`اختيار`],"Only the first 500 entries are shown.":[`仅显示前 500 项。`,`تُعرض أول 500 عنصر فقط.`],"Reload the page before saving again.":[`再次保存前请重新加载页面。`,`أعد تحميل الصفحة قبل الحفظ مرة أخرى.`],"The current settings could not be reloaded. Reload the page.":[`无法重新加载当前设置。请重新加载页面。`,`تعذّر إعادة تحميل الإعدادات الحالية. أعد تحميل الصفحة.`],Log:[`日志`,`السجل`],"Capture attempts only":[`仅显示捕获尝试`,`محاولات الالتقاط فقط`],Refresh:[`刷新`,`تحديث`],"Copy log path":[`复制日志路径`,`نسخ مسار السجل`],"Log lines":[`日志行`,`أسطر السجل`],"No log has been written yet.":[`尚未写入日志。`,`لم يُكتب سجل بعد.`],"Loading log…":[`正在加载日志…`,`جارٍ تحميل السجل…`],Level:[`级别`,`المستوى`],Warning:[`警告`,`تحذير`],Error:[`错误`,`خطأ`],info:[`信息`,`معلومات`],error:[`错误`,`خطأ`],"Level guessed from the message":[`级别由消息内容推测`,`المستوى مُخمَّن من نص الرسالة`],"Copy visible records":[`复制可见记录`,`نسخ السجلات المعروضة`],Copied:[`已复制`,`تم النسخ`],"No matching log records.":[`没有匹配的日志记录。`,`لا توجد سجلات مطابقة.`],"External API":[`外部 API`,`واجهة API الخارجية`],"An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.":[`兼容 OpenAI 或 Anthropic 的端点,两个宿主都可用于捕获和回填。`,`نقطة نهاية متوافقة مع OpenAI أو Anthropic يمكن لأي مضيف استخدامها للالتقاط والاستيراد.`],Provider:[`提供商`,`المزوّد`],"API URL":[`API 地址`,`عنوان API`],"API key":[`API 密钥`,`مفتاح API`],"Save endpoint":[`保存端点`,`حفظ نقطة النهاية`],"Nothing to save.":[`没有需要保存的内容。`,`لا يوجد ما يُحفظ.`],"Key source":[`密钥来源`,`مصدر المفتاح`],"environment variable":[`环境变量`,`متغير البيئة`],"key file":[`密钥文件`,`ملف المفتاح`],"set in the config file":[`在配置文件中设置`,`مضبوط في ملف الإعدادات`],"resolves in the web app":[`可在网页应用中解析`,`يُقرأ في تطبيق الويب`],"does not resolve in the web app":[`无法在网页应用中解析`,`لا يُقرأ في تطبيق الويب`],"A login web app does not see variables set only in a shell profile; a key file works everywhere.":[`登录时启动的网页应用看不到仅在 shell 配置文件中设置的变量;密钥文件在任何地方都可用。`,`تطبيق الويب الذي يبدأ عند تسجيل الدخول لا يرى المتغيرات المضبوطة في ملف الصدفة فقط؛ ملف المفتاح يعمل في كل مكان.`],"The key does not resolve in this web app. Save it to a key file instead.":[`此网页应用无法解析该密钥。请改为保存到密钥文件。`,`لا يُقرأ المفتاح في تطبيق الويب هذا. احفظه في ملف مفتاح بدلاً من ذلك.`],"Environment variable":[`环境变量`,`متغير البيئة`],"Key file":[`密钥文件`,`ملف المفتاح`],"Save key to a private file":[`将密钥保存到私有文件`,`حفظ المفتاح في ملف خاص`],"Variable name":[`变量名`,`اسم المتغير`],"Key file path":[`密钥文件路径`,`مسار ملف المفتاح`],"Key file name":[`密钥文件名`,`اسم ملف المفتاح`],"The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.":[`密钥写入 ~/.config/omms/secrets/,仅你可读,之后不再显示。`,`يُكتب المفتاح في ~/.config/omms/secrets/ ولا يقرؤه غيرك، ولن يُعرض مرة أخرى.`],"Save key source":[`保存密钥来源`,`حفظ مصدر المفتاح`],"Key source saved.":[`密钥来源已保存。`,`تم حفظ مصدر المفتاح.`],"A key file with this name exists. Replace it?":[`已存在同名密钥文件。要替换吗?`,`يوجد ملف مفتاح بهذا الاسم. هل تريد استبداله؟`],"Enter a variable name such as ZAI_API_KEY":[`请输入变量名,例如 ZAI_API_KEY`,`أدخل اسم متغير مثل ZAI_API_KEY`],"Enter the path of a key file":[`请输入密钥文件路径`,`أدخل مسار ملف المفتاح`],"Name the key file with letters, digits, dashes, or underscores":[`密钥文件名只能包含字母、数字、短横线或下划线`,`سمِّ ملف المفتاح بحروف أو أرقام أو شرطات أو شرطات سفلية`],"Paste the key":[`请粘贴密钥`,`الصق المفتاح`],Test:[`测试`,`اختبار`],"Test call succeeded":[`测试调用成功`,`نجح استدعاء الاختبار`],"Test call failed":[`测试调用失败`,`فشل استدعاء الاختبار`],"External API needs":[`外部 API 缺少`,`تحتاج واجهة API الخارجية إلى`],"Automatic import makes model calls. A model change applies at the next run. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。模型更改在下次运行时生效。关闭后,正在进行的导入会在当前对话完成后停止。`,`يستدعي الاستيراد التلقائي النماذج. يسري تغيير النموذج في التشغيل التالي. إيقافه يوقف الاستيراد الجاري بعد المحادثة الحالية.`],"Saved. Changes apply at the next run.":[`已保存。更改在下次运行时生效。`,`تم الحفظ. تسري التغييرات في التشغيل التالي.`],paused:[`已暂停`,`متوقف مؤقتاً`],"started from auto":[`自动启动`,`بدأ تلقائياً`],"started from web":[`从网页启动`,`بدأ من الويب`],"started from cli":[`从终端启动`,`بدأ من الطرفية`],"started from slash":[`从斜杠命令启动`,`بدأ من أمر الشرطة المائلة`],"Minutes left":[`剩余分钟`,`الدقائق المتبقية`],unknown:[`未知`,`غير معروف`],about:[`约`,`حوالي`],Pause:[`暂停`,`إيقاف مؤقت`],Resume:[`继续`,`استئناف`],"Pausing after the current exchange.":[`将在当前对话完成后暂停。`,`سيتوقف مؤقتاً بعد المحادثة الحالية.`],"Backfill started.":[`回填已开始。`,`بدأ الاستيراد.`],"The list is still loading. Try again in a moment.":[`列表仍在加载。请稍后再试。`,`لا تزال القائمة قيد التحميل. حاول مرة أخرى بعد لحظة.`],"Paused. No import starts until you resume.":[`已暂停。恢复前不会开始导入。`,`تم الإيقاف مؤقتاً. لن يبدأ أي استيراد حتى تستأنفه.`],"Directory maps":[`目录映射`,`خرائط المجلدات`],"Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.":[`将已移动或删除的目录映射到其所属项目。更改在下次导入或回填时生效。`,`اربط مجلداً نُقل أو حُذف بالمشروع الذي ينتمي إليه. يسري التغيير في الاستيراد التالي.`],"Saved maps":[`已保存的映射`,`الخرائط المحفوظة`],Keep:[`保留`,`إبقاء`],Remove:[`移除`,`إزالة`],"Unresolved directories":[`无法解析的目录`,`مجلدات غير محلولة`],"No unresolved directories in the latest run.":[`最近一次运行没有无法解析的目录。`,`لا توجد مجلدات غير محلولة في آخر تشغيل.`],"No suggestion found.":[`未找到建议。`,`لم يُعثر على اقتراح.`],"Target directory":[`目标目录`,`المجلد الهدف`],"Saved. Maps apply to the next import or backfill run.":[`已保存。映射在下次导入或回填时生效。`,`تم الحفظ. تسري الخرائط في الاستيراد التالي.`],"Memory language":[`记忆语言`,`لغة الذاكرة`],"The language that new memory summaries are written in. Automatic detects it from your prompt, but a Latin-script prompt under 100 characters counts as English.":[`新记忆摘要使用的语言。“自动”会根据你的提示检测语言,但少于 100 个字符的拉丁字母提示按英语处理。`,`اللغة التي تُكتب بها ملخصات الذاكرة الجديدة. يكتشفها الوضع التلقائي من موجّهك، لكن الموجّه بالأحرف اللاتينية الأقصر من 100 حرف يُعدّ إنجليزياً.`],"Summary language":[`摘要语言`,`لغة الملخص`],Appearance:[`外观`,`المظهر`],Theme:[`主题`,`السمة`],"Theme mode":[`主题模式`,`وضع السمة`],System:[`系统`,`النظام`],Light:[`浅色`,`فاتح`],Dark:[`深色`,`داكن`],"Light theme":[`浅色主题`,`السمة الفاتحة`],"Dark theme":[`深色主题`,`السمة الداكنة`],"On screen now":[`当前显示`,`معروضة الآن`],"No theme matches.":[`没有匹配的主题。`,`لا توجد سمة مطابقة.`],"Filter themes":[`筛选主题`,`تصفية السمات`],"System follows your operating system and switches between the light and the dark theme. The choice stays in this browser.":[`“系统”跟随操作系统,在浅色和深色主题之间切换。此选择只保存在此浏览器中。`,`يتبع «النظام» نظام التشغيل ويبدّل بين السمة الفاتحة والداكنة. يبقى الاختيار في هذا المتصفح.`],"Date and time":[`日期和时间`,`التاريخ والوقت`],"How dates and times show in this web app. The choice stays in this browser.":[`此网页应用中日期和时间的显示方式。此选择只保存在此浏览器中。`,`طريقة عرض التواريخ والأوقات في تطبيق الويب هذا. يبقى الاختيار في هذا المتصفح.`],"Date format":[`日期格式`,`تنسيق التاريخ`],"Time format":[`时间格式`,`تنسيق الوقت`],"Day month year":[`日 月 年`,`يوم شهر سنة`],"Month day year":[`月 日 年`,`شهر يوم سنة`],"Year-month-day":[`年-月-日`,`سنة-شهر-يوم`],"24-hour":[`24 小时制`,`24 ساعة`],"12-hour":[`12 小时制`,`12 ساعة`],Automatic:[`自动`,`تلقائي`],"Saved. New memories use this language.":[`已保存。新记忆将使用此语言。`,`تم الحفظ. ستستخدم الذكريات الجديدة هذه اللغة.`],"Claude Code folder":[`Claude Code 文件夹`,`مجلد Claude Code`],"Set this when Claude Code does not use ~/.claude, for example when you start it with CLAUDE_CONFIG_DIR. Leave it empty to use the default.":[`当 Claude Code 不使用 ~/.claude 时(例如用 CLAUDE_CONFIG_DIR 启动它),请设置此项。留空则使用默认文件夹。`,`اضبط هذا عندما لا يستخدم Claude Code المجلد ‎~/.claude، مثلاً عند تشغيله مع CLAUDE_CONFIG_DIR. اتركه فارغاً لاستخدام المجلد الافتراضي.`],"Save folder":[`保存文件夹`,`حفظ المجلد`],"Transcripts folder in use":[`正在使用的会话记录文件夹`,`مجلد سجلات الجلسات المستخدم`],From:[`来源`,`المصدر`],"this setting":[`此设置`,`هذا الإعداد`],"the CLAUDE_CONFIG_DIR variable of the web app":[`网页应用的 CLAUDE_CONFIG_DIR 变量`,`متغير CLAUDE_CONFIG_DIR لتطبيق الويب`],"the default folder":[`默认文件夹`,`المجلد الافتراضي`],"This folder does not exist. Claude Code capture and import will not work:":[`此文件夹不存在。Claude Code 的捕获和导入将无法工作:`,`هذا المجلد غير موجود. لن يعمل الالتقاط والاستيراد في Claude Code:`],"Enter a full path, or a path that starts with ~/.":[`请输入完整路径,或以 ~/ 开头的路径。`,`أدخل مساراً كاملاً، أو مساراً يبدأ بـ ‎~/.`],"Saved. Capture and import use this folder now.":[`已保存。捕获和导入现在使用此文件夹。`,`تم الحفظ. يستخدم الالتقاط والاستيراد هذا المجلد الآن.`],"Running version":[`运行版本`,`الإصدار الجاري`],"Global command":[`全局命令`,`الأمر العام`],"not installed globally":[`未全局安装`,`غير مثبت عمومياً`],"A newer OMMS copy runs in place of the global install. The global install is optional. To update it:":[`正在运行的是更新的 OMMS 副本,而不是全局安装。全局安装是可选的。更新方法:`,`تعمل نسخة OMMS أحدث بدلاً من التثبيت العام. التثبيت العام اختياري. لتحديثه:`],"The global install is newer than the running OMMS. The next Pi or OpenCode start replaces the web app.":[`全局安装比正在运行的 OMMS 更新。下次启动 Pi 或 OpenCode 时将替换网页应用。`,`التثبيت العام أحدث من OMMS الجاري. سيستبدل التشغيل التالي لـ Pi أو OpenCode تطبيق الويب.`],"OMMS is not installed globally. A global install is optional.":[`OMMS 未全局安装。全局安装是可选的。`,`OMMS غير مثبت عمومياً. التثبيت العام اختياري.`],"Keys and access":[`密钥与访问`,`المفاتيح والوصول`],"not needed":[`不需要`,`غير مطلوب`],"External API key":[`外部 API 密钥`,`مفتاح واجهة API الخارجية`],"Embedding server key":[`嵌入服务器密钥`,`مفتاح خادم التضمين`],"Capture and profile learning through the external API. Claude Code always uses it.":[`通过外部 API 进行捕获和用户画像学习。Claude Code 始终使用它。`,`الالتقاط وتعلّم الملف الشخصي عبر واجهة API الخارجية. يستخدمه Claude Code دائماً.`],"Sent to an embedding server on another machine.":[`发送给另一台机器上的嵌入服务器。`,`يُرسَل إلى خادم تضمين على جهاز آخر.`],"Let scripts and other computers call the web app's API.":[`允许脚本和其他电脑调用网页应用的 API。`,`تتيح للبرامج النصية والحواسيب الأخرى استدعاء واجهة API لتطبيق الويب.`],"Asks for a user name and password before the page opens.":[`打开页面前要求输入用户名和密码。`,`يطلب اسم مستخدم وكلمة مرور قبل فتح الصفحة.`],"External API card":[`外部 API 卡片`,`بطاقة واجهة API الخارجية`],"Embedding card":[`嵌入卡片`,`بطاقة التضمين`],"Table below":[`下方表格`,`الجدول أدناه`],"Form below":[`下方表单`,`النموذج أدناه`],"API tokens":[`API 令牌`,`رموز API`],"Browser password":[`浏览器密码`,`كلمة مرور المتصفح`],"The config file still sets webServerApiToken. OMMS imported it once as the token “from config file” and no longer reads the key. Use the token table instead.":[`配置文件仍设置了 webServerApiToken。OMMS 已将其导入一次,作为令牌“from config file”,之后不再读取该键。请改用令牌表。`,`لا يزال ملف الإعدادات يضبط webServerApiToken. استورده OMMS مرة واحدة كرمز باسم “from config file” ولم يعد يقرأ هذا المفتاح. استخدم جدول الرموز بدلاً منه.`],"Open this page on the computer that runs OMMS to manage tokens and the password.":[`请在运行 OMMS 的电脑上打开此页面,以管理令牌和密码。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لإدارة الرموز وكلمة المرور.`],"Revoke this token? Scripts that use it stop working.":[`撤销此令牌?使用它的脚本将停止工作。`,`إلغاء هذا الرمز؟ ستتوقف البرامج النصية التي تستخدمه عن العمل.`],"No browser password is set.":[`未设置浏览器密码。`,`لم تُضبط كلمة مرور للمتصفح.`],"A browser password is set for user":[`已为以下用户设置浏览器密码:`,`ضُبطت كلمة مرور المتصفح للمستخدم`],"A browser password is set for your computer user name.":[`已为你的电脑用户名设置浏览器密码。`,`ضُبطت كلمة مرور المتصفح لاسم مستخدم حاسوبك.`],"User name":[`用户名`,`اسم المستخدم`],Password:[`密码`,`كلمة المرور`],"Save password":[`保存密码`,`حفظ كلمة المرور`],"Clear password":[`清除密码`,`مسح كلمة المرور`],"Saved. Restart the web app to use the new browser password.":[`已保存。重启网页应用以使用新的浏览器密码。`,`تم الحفظ. أعد تشغيل تطبيق الويب لاستخدام كلمة مرور المتصفح الجديدة.`],Name:[`名称`,`الاسم`],Expires:[`过期时间`,`تاريخ الانتهاء`],"Last used":[`上次使用`,`آخر استخدام`],Never:[`永不`,`أبداً`],Revoke:[`撤销`,`إلغاء`],Copy:[`复制`,`نسخ`],"Copy this token now. It will not be shown again.":[`请立即复制此令牌。它不会再次显示。`,`انسخ هذا الرمز الآن. لن يُعرض مرة أخرى.`],"Token name":[`令牌名称`,`اسم الرمز`],"Expires after":[`有效期`,`ينتهي بعد`],"Generate token":[`生成令牌`,`إنشاء رمز`],All:[`全部`,`الكل`],Kind:[`类型`,`النوع`],"Built-in model":[`内置模型`,`النموذج المدمج`],"OpenAI-compatible server":[`OpenAI 兼容服务器`,`خادم متوافق مع OpenAI`],"Server URL":[`服务器 URL`,`عنوان URL للخادم`],"Vector size":[`向量维度`,`حجم المتجه`],"Stored memories":[`已存储的记忆`,`الذكريات المخزنة`],"Re-embedding":[`正在重新嵌入`,`جارٍ إعادة التضمين`],"Re-embed finished.":[`重新嵌入已完成。`,`اكتملت إعادة التضمين.`],"Re-embed failed":[`重新嵌入失败`,`فشلت إعادة التضمين`],Retry:[`重试`,`إعادة المحاولة`],Lock:[`锁定`,`قفل`],"Unlock to change":[`解锁以更改`,`افتح القفل للتغيير`],"The model that turns memory text into search vectors. A change re-embeds every memory.":[`将记忆文本转换为搜索向量的模型。更改后会重新嵌入所有记忆。`,`النموذج الذي يحوّل نص الذكريات إلى متجهات بحث. يؤدي تغييره إلى إعادة تضمين كل الذكريات.`],Preset:[`预设`,`إعداد مسبق`],Custom:[`自定义`,`مخصص`],"No key":[`无密钥`,`بلا مفتاح`],"Keep the saved key":[`保留已保存的密钥`,`الاحتفاظ بالمفتاح المحفوظ`],Apply:[`应用`,`تطبيق`],Cancel:[`取消`,`إلغاء الأمر`],"Test passed. Vector size":[`测试通过。向量维度`,`نجح الاختبار. حجم المتجه`],"Test failed":[`测试失败`,`فشل الاختبار`],"Every stored memory will be re-embedded":[`所有已存储的记忆都将重新嵌入`,`ستُعاد عملية تضمين كل الذكريات المخزنة`],"The hosted server is called once for each memory, which may cost money.":[`托管服务器会为每条记忆调用一次,可能产生费用。`,`يُستدعى الخادم المستضاف مرة لكل ذكرى، وقد يكلّف ذلك مالاً.`],"Search results are poor until the re-embed ends.":[`在重新嵌入结束前,搜索结果质量较差。`,`تكون نتائج البحث ضعيفة حتى تنتهي إعادة التضمين.`],"Restart open OpenCode and Pi sessions after the change.":[`更改后请重启已打开的 OpenCode 和 Pi 会话。`,`أعد تشغيل جلسات OpenCode وPi المفتوحة بعد التغيير.`],"Profile learning":[`用户画像学习`,`تعلّم الملف الشخصي`],"Catch up analyses every waiting prompt with the saved external API, 50 prompts for each model call.":[`补齐会使用已保存的外部 API 分析所有等待中的提示词,每次模型调用处理 50 条。`,`يحلّل اللحاق كل الطلبات المنتظرة عبر واجهة API الخارجية المحفوظة، 50 طلباً لكل استدعاء للنموذج.`],"Open this page on the computer that runs OMMS to start a catch-up run.":[`请在运行 OMMS 的电脑上打开此页面以开始补齐。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لبدء اللحاق.`],"Prompts waiting for profile learning":[`等待用户画像学习的提示词`,`الطلبات المنتظرة لتعلّم الملف الشخصي`],"Model calls":[`模型调用次数`,`استدعاءات النموذج`],"Batches done":[`已完成批次`,`الدفعات المكتملة`],"Prompts waiting":[`等待中的提示词`,`الطلبات المنتظرة`],Paused:[`已暂停`,`متوقف مؤقتاً`],Finished:[`已完成`,`اكتمل`],Stopped:[`已停止`,`توقّف`],"Catch up profile":[`补齐用户画像`,`اللحاق بالملف الشخصي`],"Start profile learning for the waiting prompts? Model calls":[`为等待中的提示词开始用户画像学习?模型调用次数`,`بدء تعلّم الملف الشخصي للطلبات المنتظرة؟ عدد استدعاءات النموذج`],"never used before":[`从未使用`,`لم يُستخدم من قبل`],"A newer catch-up run took over.":[`较新的补齐任务已接管。`,`تولّت عملية لحاق أحدث المهمة.`],"Browser password cleared. Restart the web app to turn it off.":[`浏览器密码已清除。重启网页应用以关闭它。`,`تم مسح كلمة مرور المتصفح. أعد تشغيل تطبيق الويب لإيقافها.`],Actions:[`操作`,`الإجراءات`],"All exchanges are done. Learning the profile from the imported prompts":[`所有对话已完成。正在从导入的提示中学习画像`,`اكتملت كل المحادثات. يجري تعلّم الملف الشخصي من المطالبات المستوردة`],batches:[`批`,`دفعات`],"Change it in":[`修改位置`,`مكان التغيير`],"Check them, then press Save maps.":[`请检查后点击保存映射。`,`راجعها ثم اضغط حفظ الخرائط.`],Credential:[`凭据`,`بيانات الاعتماد`],Email:[`邮箱`,`البريد الإلكتروني`],Filled:[`已填写`,`تم الملء`],"Finds the project each missing directory belongs to, mostly the main repository of a deleted worktree, and fills it in for you to check. Nothing is saved until you press Save maps.":[`为每个缺失的目录找到所属项目(多为已删除工作树的主仓库),并填入供你检查。点击保存映射之前不会保存任何内容。`,`يعثر على المشروع الذي ينتمي إليه كل مجلد مفقود، وغالباً المستودع الرئيسي لشجرة عمل محذوفة، ويملؤه لتراجعه. لا يُحفظ شيء حتى تضغط حفظ الخرائط.`],Hosts:[`主机`,`المضيفات`],"Import status":[`导入状态`,`حالة الاستيراد`],"in use":[`使用中`,`قيد الاستخدام`],"Last run":[`上次运行`,`آخر تشغيل`],"Last update":[`最后更新`,`آخر تحديث`],"Learning profile":[`正在学习画像`,`يجري تعلّم الملف الشخصي`],"Merge into":[`合并到`,`دمج في`],"Merge this profile into the other one? The source profile is turned off, not deleted.":[`将此画像合并到另一个画像?源画像会被停用,不会被删除。`,`دمج هذا الملف الشخصي في الآخر؟ يُوقَف الملف المصدر ولا يُحذف.`],"Merged.":[`已合并。`,`تم الدمج.`],"model not recorded":[`未记录模型`,`لم يُسجَّل نموذج`],model:[`个模型`,`نموذج`],models:[`个模型`,`نماذج`],"No directory recorded":[`未记录目录`,`لم يُسجَّل مجلد`],"No suggestion":[`无建议`,`لا اقتراح`],"Not started":[`未开始`,`لم يبدأ`],"OMMS keeps one profile for each git email. A folder whose repository has its own email starts a second profile. Choose the profile that is yours, or merge the extra one into it.":[`OMMS 为每个 git 邮箱保留一个画像。若某文件夹的仓库设置了自己的邮箱,就会产生第二个画像。请选择属于你的画像,或把多余的画像合并进去。`,`يحتفظ OMMS بملف شخصي لكل بريد git. المجلد الذي يملك مستودعه بريداً خاصاً يبدأ ملفاً شخصياً ثانياً. اختر ملفك الشخصي، أو ادمج الملف الزائد فيه.`],"Outcomes by host":[`各主机结果`,`النتائج حسب المضيف`],"Partly imported":[`部分已导入`,`مستورد جزئياً`],Patterns:[`模式`,`الأنماط`],pending:[`待处理`,`معلّق`],Preferences:[`偏好`,`التفضيلات`],Profiles:[`画像`,`الملفات الشخصية`],"Prompts analysed":[`已分析提示`,`المطالبات المحلَّلة`],Running:[`运行中`,`قيد التشغيل`],"Saved maps apply to every host.":[`已保存的映射适用于所有主机。`,`تنطبق الخرائط المحفوظة على كل المضيفات.`],"Saved: a memory was stored. Skipped: the model or a rule found nothing worth keeping, or the turn was private or trivial. Failed: the attempt hit an error. Total: the three added up. Each percentage is a share of its row's total.":[`已保存:存储了一条记忆。已跳过:模型或规则认为没有值得保留的内容,或该轮为私密或琐碎内容。失败:尝试出错。总计:三者之和。每个百分比是该行总计中的占比。`,`محفوظ: خُزّنت ذاكرة. متجاوز: لم يجد النموذج أو قاعدة ما يستحق الحفظ، أو كانت الجولة خاصة أو تافهة. فشل: واجهت المحاولة خطأ. الإجمالي: مجموع الثلاثة. كل نسبة هي حصة من إجمالي صفها.`],"Saved. OMMS now uses this profile in every folder.":[`已保存。OMMS 现在在所有文件夹中使用此画像。`,`تم الحفظ. يستخدم OMMS هذا الملف الشخصي الآن في كل المجلدات.`],Directories:[`目录数`,`عدد المجلدات`],"No target chosen":[`尚未选择目标`,`لم يُختر مجلد مستهدف`],"Smart resolve directories":[`智能解析目录`,`حلّ المجلدات تلقائياً`],Exact:[`精确`,`مطابقة تامة`],"Name match":[`名称匹配`,`مطابقة بالاسم`],Guess:[`猜测`,`تخمين`],Confidence:[`可信度`,`درجة الثقة`],"Temporary folder":[`临时文件夹`,`مجلد مؤقت`],"node_modules folder":[`node_modules 文件夹`,`مجلد node_modules`],"App data folder":[`应用数据文件夹`,`مجلد بيانات التطبيقات`],"Skills folder":[`技能文件夹`,`مجلد المهارات`],"Rows with a target":[`已有目标的行数`,`عدد الصفوف ذات المجلد المستهدف`],"Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.":[`智能解析会在对话框中列出每个建议的映射和忽略项。勾选要保留的项,然后点击确认。在此之前不会保存任何内容。`,`يعرض الحلّ التلقائي كل خريطة مقترحة وكل تجاهل مقترح في مربع حوار. حدّد ما تريد الاحتفاظ به، ثم اضغط تأكيد. لا يُحفظ شيء قبل ذلك.`],"Suggested to ignore":[`建议忽略`,`مقترح للتجاهل`],Ignore:[`忽略`,`تجاهل`],Restore:[`恢复`,`استعادة`],"No target":[`无目标`,`بلا مجلد مستهدف`],"Save this map":[`保存此映射`,`حفظ هذه الخريطة`],"Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.":[`勾选要保留的映射和忽略项,然后点击确认保存。保存的映射将在所有主机的下一次导入或回填时生效。`,`حدّد الخرائط وعناصر التجاهل التي تريد الاحتفاظ بها، ثم اضغط تأكيد لحفظها. تسري الخرائط المحفوظة على كل المضيفات في عملية الاستيراد أو الاستكمال التالية.`],"Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.":[`没有可保存的内容。请在行中输入目标,或对不是项目的文件夹点击忽略。`,`لا يوجد ما يُحفظ. اكتب مجلداً مستهدفاً في صف، أو اضغط تجاهل للمجلدات التي ليست مشاريع.`],"Ignored directories":[`已忽略的目录`,`المجلدات المتجاهَلة`],"Ignored directories stay unimported and leave the unresolved counts.":[`已忽略的目录保持未导入,并且不计入未解析数量。`,`تبقى المجلدات المتجاهَلة دون استيراد، ولا تُحسب ضمن الأعداد غير المحلولة.`],"They apply to the next import or backfill run. No sessions were imported.":[`它们将在下一次导入或回填时生效。未导入任何会话。`,`تسري في عملية الاستيراد أو الاستكمال التالية. لم تُستورد أي جلسات.`],"Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.":[`会话导入后请保留映射。每次导入在跳过会话之前都会先检查映射,因此删除映射会使其会话在下次运行时重新变为未解析。`,`احتفظ بالخريطة بعد استيراد جلساتها. يفحص كل استيراد الخريطة قبل أن يتجاوز جلسة، لذا فإن حذف الخريطة يجعل جلساتها غير محلولة مجدداً في التشغيل التالي.`],"Save removals":[`保存删除`,`حفظ عمليات الحذف`],"Settings changed elsewhere. Check the list and try again.":[`设置已在其他位置更改。请检查列表后再试。`,`تغيّرت الإعدادات في مكان آخر. راجع القائمة، ثم حاول مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再试。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة، ثم حاول مجدداً.`],"Saved. Removed maps stop applying at the next import or backfill run.":[`已保存。删除的映射将从下一次导入或回填起不再生效。`,`تم الحفظ. تتوقف الخرائط المحذوفة عن السريان في عملية الاستيراد أو الاستكمال التالية.`],"Removals could not be saved. Try again.":[`无法保存删除。请重试。`,`تعذّر حفظ عمليات الحذف. حاول مجدداً.`],"Ignored. The directory stays unimported.":[`已忽略。该目录保持未导入。`,`تم التجاهل. يبقى المجلد دون استيراد.`],"The directory could not be ignored. Try again.":[`无法忽略该目录。请重试。`,`تعذّر تجاهل المجلد. حاول مجدداً.`],"Restored. The directory shows again in each host list that reported it.":[`已恢复。该目录会重新出现在报告它的每个主机列表中。`,`تمت الاستعادة. يظهر المجلد مجدداً في قائمة كل مضيف أبلغ عنه.`],"The directory could not be restored. Try again.":[`无法恢复该目录。请重试。`,`تعذّرت استعادة المجلد. حاول مجدداً.`],"Saved, but the list could not be refreshed. Refresh the list without saving again.":[`已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`تم الحفظ، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"Review directory maps":[`检查目录映射`,`مراجعة خرائط المجلدات`],"Proposed maps":[`建议映射数`,`عدد الخرائط المقترحة`],Sessions:[`会话数`,`عدد الجلسات`],Confirm:[`确认`,`تأكيد`],"Saving…":[`正在保存…`,`جارٍ الحفظ…`],"Settings refreshed. No maps were saved.":[`设置已刷新。未保存任何映射。`,`حُدّثت الإعدادات. لم تُحفظ أي خرائط.`],"Settings could not be refreshed. Try Refresh list again.":[`无法刷新设置。请再次点击刷新列表。`,`تعذّر تحديث الإعدادات. حاول تحديث القائمة مجدداً.`],"Maps could not be saved. Review the targets and confirm again.":[`无法保存映射。请检查目标后再次确认。`,`تعذّر حفظ الخرائط. راجع المجلدات المستهدفة، ثم أكّد مجدداً.`],"Settings changed elsewhere. Review these maps and confirm again.":[`设置已在其他位置更改。请检查这些映射后再次确认。`,`تغيّرت الإعدادات في مكان آخر. راجع هذه الخرائط، ثم أكّد مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再次确认。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة قبل التأكيد مجدداً.`],"Maps were saved, but the list could not be refreshed. Refresh the list without saving again.":[`映射已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`حُفظت الخرائط، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"No model was recorded for these attempts. This happens with records written by older OMMS versions, and when an attempt stops before a model is chosen.":[`这些尝试没有记录模型。旧版 OMMS 写入的记录,以及在选定模型之前就停止的尝试,会出现这种情况。`,`لم يُسجَّل نموذج لهذه المحاولات. يحدث ذلك في السجلات التي كتبتها إصدارات أقدم من OMMS، وعندما تتوقف المحاولة قبل اختيار نموذج.`],"These sessions cannot be mapped.":[`这些会话无法映射。`,`لا يمكن ربط هذه الجلسات.`],unresolved:[`未解析`,`غير محلول`],"Use this profile":[`使用此画像`,`استخدام هذا الملف الشخصي`],"Use this profile for every folder?":[`在所有文件夹中使用此画像?`,`استخدام هذا الملف الشخصي في كل المجلدات؟`],"Used for":[`用途`,`الاستخدام`],Workflows:[`工作流`,`سير العمل`],Memory:[`记忆`,`الذاكرة`],Setting:[`设置`,`الإعداد`],Value:[`数值`,`القيمة`],Default:[`默认值`,`القيمة الافتراضية`],Unit:[`单位`,`الوحدة`],Affects:[`影响`,`التأثير`],Results:[`条结果`,`نتائج`],Memories:[`条记忆`,`ذكريات`],Bytes:[`字节`,`بايت`],"Approximate tokens":[`约计令牌`,`رموز تقريبية`],"Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.":[`记忆搜索结果的最大数量。手动搜索可以请求更少;提示词检索使用此上限。`,`الحد الأقصى لنتائج بحث الذاكرة. يمكن للبحث اليدوي طلب عدد أقل؛ ويستخدم استرجاع الطلب هذا السقف.`],"Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.":[`会话开始时在 OpenCode V1 和 Claude Code 中加入的近期记忆。Pi 和 OpenCode V2 改用基于提示词的搜索。`,`الذكريات الحديثة التي تُضاف عند بدء الجلسة في OpenCode V1 و Claude Code. أما Pi و OpenCode V2 فيستخدمان البحث عبر الطلب بدلاً منها.`],"Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.":[`通过共享捕获管道发送给记忆摘要模型的对话输入。数值较小时可能省略部分对话文本。`,`مدخلات المحادثة التي تُرسل إلى نموذج تلخيص الذاكرة عبر مسار الالتقاط المشترك. القيم الأصغر قد تحذف نصاً من المحادثة.`],"OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.":[`OpenCode 画像学习的输入。数值较小时可能从该输入中省略部分提示词。此设置不限制其他主机的画像输入。`,`مدخلات تعلّم الملف الشخصي في OpenCode. القيم الأصغر قد تحذف مطالبات من هذه المدخلات. لا يقيّد هذا الإعداد مدخلات الملف الشخصي في المضيفات الأخرى.`],"Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.":[`自动加入各主机代理请求的记忆上下文,包括画像文本和格式化内容。数值较小时会显示更少或更短的记忆。`,`سياق الذاكرة المُضاف تلقائياً إلى طلبات الوكيل في كل المضيفات، بما في ذلك نص الملف الشخصي والتنسيق. القيم الأصغر قد تعرض ذكريات أقل أو أقصر.`],"Enter a positive whole number.":[`请输入正整数。`,`أدخل رقماً صحيحاً موجباً.`],"Enter a whole number from 16,384 to 16,777,216.":[`请输入 16,384 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 16,384 إلى 16,777,216.`],"Enter a whole number from 1,024 to 16,777,216.":[`请输入 1,024 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 1,024 إلى 16,777,216.`],"Enter a whole number from 256 to 65,536.":[`请输入 256 到 65,536 之间的整数。`,`أدخل رقماً صحيحاً من 256 إلى 65,536.`],"Byte limits count UTF-8 bytes.":[`字节限制按 UTF-8 字节计数。`,`تُحتسب حدود البايت بوحدات بايت UTF-8.`],"Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.":[`约计令牌按 ceil(UTF-8 字节数 / 4) 估算。同一文本,提供商统计的令牌数可能更多或更少。`,`تُقدَّر الرموز التقريبية بالصيغة ceil(بايتات UTF-8 / 4). قد يحسب المزوّد للنص نفسه رموزاً أكثر أو أقل.`],"These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.":[`这些设置不会删除已存储的数据、设定消费限额、限制模型回复,也不会控制 Graphify 输出。`,`لا تحذف هذه الإعدادات البيانات المخزنة، ولا تضع حد إنفاق، ولا تحدّ من ردود النموذج، ولا تتحكم في خرج Graphify.`],"Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.":[`也可以直接编辑 ~/.config/omms/omms.jsonc 来设置这些限制,无需网页界面。`,`عدّل الملف ~/.config/omms/omms.jsonc مباشرة لضبط هذه الحدود دون واجهة الويب.`],"Save memory limits":[`保存记忆限制`,`حفظ حدود الذاكرة`],"Saved. New memory operations use these limits.":[`已保存。新的记忆操作将使用这些限制。`,`تم الحفظ. ستستخدم عمليات الذاكرة الجديدة هذه الحدود.`],"Invalid setting":[`无效的设置`,`إعداد غير صالح`],"Config changed. Reload settings and save again.":[`设置文件已更改。请重新加载设置后再次保存。`,`تغيّر ملف الإعدادات. أعد تحميل الإعدادات ثم احفظ مجدداً.`],"The memory settings could not be loaded. Reload the page to try again.":[`无法加载记忆设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات الذاكرة. أعد تحميل الصفحة للمحاولة مجدداً.`],"The memory settings could not be saved.":[`无法保存记忆设置。`,`تعذّر حفظ إعدادات الذاكرة.`],"Effective value":[`生效值`,`القيمة السارية`],project:[`项目`,`المشروع`],"The project value stays in force. Saving edits the global file only.":[`项目值仍然生效。保存只修改全局文件。`,`تبقى قيمة المشروع سارية، والحفظ يعدّل الملف العام فقط.`],"Similarity score":[`相似度分数`,`درجة التشابه`],"Enter a number from 0 to 1.":[`请输入 0 到 1 之间的数字。`,`أدخل رقماً من 0 إلى 1.`],"Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.":[`记忆被搜索返回所需的最低分数。较低的值会返回更多记忆,包括相关性较低的;较高的值可能一条也不返回。默认值取决于嵌入模型。`,`أدنى درجة تحتاجها الذاكرة لتُعاد في نتائج البحث. القيم الأدنى تعيد ذكريات أكثر بمن فيها الأقل صلة، والقيم الأعلى قد لا تعيد شيئاً. تعتمد القيمة الافتراضية على نموذج التضمين.`],"Reset to default":[`恢复默认`,`إعادة إلى الافتراضي`],"Differs from default":[`与默认值不同`,`يختلف عن الافتراضي`],"Keyword matching":[`关键词匹配`,`مطابقة الكلمات`],"Search finds memories by meaning and by exact words from your prompt.":[`搜索按含义和提示中的确切词语查找记忆。`,`يجد البحث الذكريات بالمعنى وبالكلمات الدقيقة من مطالبتك.`],"Word matching mode":[`词语匹配模式`,`وضع مطابقة الكلمات`],"Boost (default)":[`加分(默认)`,`تعزيز (افتراضي)`],"Rank fusion (experimental)":[`排名融合(实验性)`,`دمج الترتيب (تجريبي)`],"Boost adds a small score bonus to memories that contain a word of your prompt.":[`加分会给包含提示中某个词的记忆增加少量分数。`,`يضيف التعزيز مكافأة صغيرة في الدرجة للذكريات التي تحتوي على كلمة من مطالبتك.`],"Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.":[`排名融合会合并按含义排序的列表和按词语排序的列表。即使含义得分低于相似度阈值,包含提示中某个词的记忆也可能被返回。实验性:尚未证明能找到更多相关记忆。`,`يدمج دمج الترتيب قائمة بالمعنى وقائمة بالكلمات. قد تُعاد ذاكرة تحتوي على كلمة من مطالبتك حتى لو كانت درجة المعنى أقل من حد التشابه. تجريبي: لم يثبت أنه يجد ذكريات أكثر صلة.`],"Rank fusion is not used while the reranker is on. Search uses the boost.":[`重排序器开启时不使用排名融合,搜索使用加分模式。`,`لا يُستخدم دمج الترتيب أثناء تشغيل معيد الترتيب. يستخدم البحث التعزيز.`],"A project file can override this setting. This page edits the global value.":[`项目文件可以覆盖此设置。此页面编辑全局值。`,`يمكن لملف المشروع تجاوز هذا الإعداد. تعدّل هذه الصفحة القيمة العامة.`],"Saved. New searches use this mode.":[`已保存。新的搜索将使用此模式。`,`تم الحفظ. تستخدم عمليات البحث الجديدة هذا الوضع.`],"The keyword matching setting could not be saved. Reload the page to try again.":[`无法保存关键词匹配设置。请重新加载页面后重试。`,`تعذّر حفظ إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],"The keyword matching setting could not be loaded. Reload the page to try again.":[`无法加载关键词匹配设置。请重新加载页面后重试。`,`تعذّر تحميل إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],Reranker:[`重排序器`,`إعادة الترتيب`],"Use a reranker":[`使用重排序器`,`استخدم معيد الترتيب`],Key:[`密钥`,`المفتاح`],Timeout:[`超时`,`مهلة الانتهاء`],"Search is unchanged while the switch is off.":[`开关关闭时,搜索行为保持不变。`,`يظل البحث دون تغيير أثناء إيقاف المفتاح.`],"The reranker reorders the best memory search results with your reranker server and keeps the top results.":[`重排序器使用您的重排序服务器对最佳记忆搜索结果重新排序,并保留最靠前的结果。`,`يعيد معيد الترتيب ترتيب أفضل نتائج بحث الذاكرة عبر خادم إعادة الترتيب لديك ويحتفظ بالنتائج العليا.`],"The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.":[`重排序器会将提示和候选记忆的文本发送到该服务器 URL。建议使用同一台机器上的服务器。`,`يرسل معيد الترتيب المطالبة ونص الذكريات المرشحة إلى عنوان URL للخادم. يُنصح بخادم على الجهاز نفسه.`],"This URL is not on this machine: memory text leaves this machine.":[`此 URL 不在本机上:记忆文本将离开本机。`,`هذا العنوان ليس على هذا الجهاز: نص الذاكرة يغادر جهازك.`],"A project file cannot change these settings. The reranker settings are global only.":[`项目文件无法更改这些设置。重排序器设置仅限全局。`,`لا يمكن لملف المشروع تغيير هذه الإعدادات. إعدادات معيد الترتيب عامة فقط.`],"The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.":[`默认值 4000 使搜索保持在 OpenCode V2 的 5 秒等待之内。超过 5000 的值可能导致 OpenCode V2 在不注入记忆的情况下发送请求。`,`تحافظ القيمة الافتراضية 4000 على بقاء البحث داخل مهلة انتظار OpenCode V2 البالغة 5 ثوانٍ. القيمة الأعلى من 5000 قد تجعل OpenCode V2 يرسل الطلب دون ذاكرة.`],"Enter the server URL and model before turning the reranker on.":[`打开重排序器前,请先填写服务器 URL 和模型。`,`أدخل عنوان URL للخادم والنموذج قبل تشغيل معيد الترتيب.`],"The key must be an env:// or file:// reference, or left empty.":[`密钥必须是 env:// 或 file:// 引用,或留空。`,`يجب أن يكون المفتاح مرجع env:// أو file://، أو يُترك فارغاً.`],"Enter a whole number from 500 to 30,000.":[`请输入 500 到 30,000 之间的整数。`,`أدخل رقماً صحيحاً من 500 إلى 30,000.`],"Optional env:// or file:// key reference.":[`可选的 env:// 或 file:// 密钥引用。`,`مرجع مفتاح env:// أو file:// اختياري.`],milliseconds:[`毫秒`,`ميلي ثانية`],Save:[`保存`,`حفظ`],"Saved. New searches use these settings.":[`已保存。新的搜索将使用这些设置。`,`تم الحفظ. ستستخدم عمليات البحث الجديدة هذه الإعدادات.`],"The reranker settings could not be saved. Reload the page to try again.":[`无法保存重排序器设置。请重新加载页面重试。`,`تعذّر حفظ إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"The reranker settings could not be loaded. Reload the page to try again.":[`无法加载重排序器设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"Test passed.":[`测试通过。`,`نجح الاختبار.`],"Test failed:":[`测试失败:`,`فشل الاختبار:`],"Change icon":[`更换图标`,`تغيير الأيقونة`],"Check again":[`再次检查`,`تحقق مرة أخرى`],"Choose a host to see its history import, sessions and settings.":[`选择一个宿主,查看其历史导入、会话和设置。`,`اختر مضيفاً لعرض استيراد سجله وجلساته وإعداداته.`],"Choose icon":[`选择图标`,`اختر أيقونة`],"Every avatar is shown at the same size. Images are cropped to a square.":[`所有头像大小一致。图片会被裁剪为正方形。`,`تظهر كل الصور الرمزية بالحجم نفسه. تُقصّ الصور إلى مربع.`],"Every host":[`所有宿主`,`كل المضيفين`],"Fix the service named here, then press Check again.":[`请修复此处所列的服务,然后点击“再次检查”。`,`أصلح الخدمة المذكورة هنا، ثم اضغط «تحقق مرة أخرى».`],"How many memories a search returns":[`一次搜索返回多少条记忆`,`عدد الذكريات التي يعيدها البحث`],"How to set up":[`如何设置`,`كيفية الإعداد`],"Ignore all":[`全部忽略`,`تجاهل الكل`],"Import all hosts":[`导入所有宿主`,`استيراد كل المضيفين`],"Import progress":[`导入进度`,`تقدم الاستيراد`],"Running · history imported {date}":[`运行中 · 历史已导入 {date}`,`قيد التشغيل · استُورد السجل {date}`],"Running · history imported {date} · last saved {when}":[`运行中 · 历史已导入 {date} · 上次保存 {when}`,`قيد التشغيل · استُورد السجل {date} · آخر حفظ {when}`],"Running · last saved {when}":[`运行中 · 上次保存 {when}`,`قيد التشغيل · آخر حفظ {when}`],"today {time}":[`今天 {time}`,`اليوم {time}`],"yesterday {time}":[`昨天 {time}`,`أمس {time}`],"Importing makes model calls and can cost money.":[`导入会调用模型,可能产生费用。`,`يجري الاستيراد اتصالات بالنموذج وقد يكلّف مالاً.`],"Importing · {percent}%":[`正在导入 · {percent}%`,`جارٍ الاستيراد · {percent}%`],"Memories are not being saved.":[`记忆当前无法保存。`,`لا يتم حفظ الذكريات حالياً.`],"Memories not saved":[`记忆未保存`,`الذكريات غير محفوظة`],"Memory views":[`记忆视图`,`عروض الذاكرة`],"Mode: {mode}":[`模式:{mode}`,`الوضع: {mode}`],"No icon matches.":[`没有匹配的图标。`,`لا توجد أيقونة مطابقة.`],"Not set up":[`未设置`,`غير مُعد`],"Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.":[`自动导入已开启。在 {date} 之前没有待导入的内容。更新的聊天请使用下方的“会话”。`,`الاستيراد التلقائي قيد التشغيل. لم يكن هناك ما ينتظر قبل {date}. استخدم «الجلسات» أدناه للمحادثات الأحدث.`],"Automatic import is on. Nothing is waiting.":[`自动导入已开启。没有待导入的内容。`,`الاستيراد التلقائي قيد التشغيل. لا يوجد ما ينتظر.`],"OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.":[`OMMS 在这台电脑上没有找到该宿主的聊天记录。请安装该宿主并使用一次,然后重新加载此页面。`,`لم يعثر OMMS على سجل محادثات هذا المضيف على هذا الحاسوب. ثبّت المضيف واستخدمه مرة واحدة، ثم أعد تحميل هذه الصفحة.`],Off:[`关`,`متوقف`],On:[`开`,`قيد التشغيل`],"On · {model}":[`开 · {model}`,`قيد التشغيل · {model}`],"PNG, JPEG, WebP or GIF, up to 20 MB.":[`PNG、JPEG、WebP 或 GIF,最大 20 MB。`,`PNG أو JPEG أو WebP أو GIF، حتى 20 ميغابايت.`],"Paused · {pending} pending":[`已暂停 · 待处理 {pending}`,`متوقف مؤقتاً · {pending} قيد الانتظار`],"Paused. Resume to continue.":[`已暂停。点击“恢复”继续。`,`متوقف مؤقتاً. اضغط «استئناف» للمتابعة.`],"Prompts waiting for profile learning, and re-analysis of old chats":[`等待画像学习的提示,以及旧聊天的重新分析`,`مطالبات تنتظر تعلم الملف الشخصي، وإعادة تحليل المحادثات القديمة`],"Results {results} · Similarity {similarity}":[`结果数 {results} · 相似度 {similarity}`,`النتائج {results} · التشابه {similarity}`],"Runs one import for every host you tick. It makes model calls and can cost money.":[`对勾选的每个宿主运行一次导入。它会调用模型,可能产生费用。`,`يشغّل استيراداً واحداً لكل مضيف تحدده. يجري اتصالات بالنموذج وقد يكلّف مالاً.`],"Saved maps and ignored directories":[`已保存的映射和已忽略的目录`,`الخرائط المحفوظة والمجلدات المتجاهلة`],"Search icons":[`搜索图标`,`ابحث عن أيقونة`],"Settings for every host":[`适用于所有宿主的设置`,`إعدادات لكل المضيفين`],Shared:[`共享`,`مشترك`],"Stopped · {pending} pending":[`已停止 · 待处理 {pending}`,`متوقف · {pending} قيد الانتظار`],"Stopped: {error}":[`已停止:{error}`,`توقف: {error}`],"These directories stay unimported and leave the unresolved counts.":[`这些目录保持未导入状态,并从未解析计数中移除。`,`تبقى هذه المجلدات غير مستوردة وتخرج من أعداد غير المحلولة.`],"These settings apply to every host. Open a row to change it.":[`这些设置适用于所有宿主。展开一行即可修改。`,`تنطبق هذه الإعدادات على كل المضيفين. افتح صفاً لتغييره.`],"This browser could not read the image.":[`此浏览器无法读取该图片。`,`تعذّر على هذا المتصفح قراءة الصورة.`],"This host is not set up on this machine.":[`此宿主尚未在这台机器上设置。`,`لم يتم إعداد هذا المضيف على هذا الجهاز.`],"This switch applies to every host. Automatic import makes model calls.":[`此开关适用于所有宿主。自动导入会调用模型。`,`ينطبق هذا المفتاح على كل المضيفين. يجري الاستيراد التلقائي اتصالات بالنموذج.`],"Upload image":[`上传图片`,`رفع صورة`],"Use external API":[`使用外部 API`,`استخدام واجهة API الخارجية`],settings:[`设置`,`الإعدادات`],"{saved} saved · {ignored} ignored":[`已保存 {saved} · 已忽略 {ignored}`,`{saved} محفوظة · {ignored} متجاهلة`],"The image is larger than 20 MB.":[`图片超过 20 MB。`,`الصورة أكبر من 20 ميغابايت.`],"Only PNG, JPEG, WebP and GIF images are accepted.":[`仅接受 PNG、JPEG、WebP 和 GIF 图片。`,`تُقبل صور PNG وJPEG وWebP وGIF فقط.`],"Importing {done} / {total}.":[`正在导入 {done} / {total}。`,`جارٍ الاستيراد {done} / {total}.`],"Importing {done} / {total}. About {minutes} min left.":[`正在导入 {done} / {total}。约剩 {minutes} 分钟。`,`جارٍ الاستيراد {done} / {total}. يتبقى نحو {minutes} دقيقة.`],"Nothing is waiting to import.":[`没有待导入的内容。`,`لا يوجد ما ينتظر الاستيراد.`],"{pending} still waiting to import.":[`仍有 {pending} 条待导入。`,`لا يزال {pending} بانتظار الاستيراد.`]};function sy(e,t){return t===`en`?e:oy[e]?.[t===`zh`?0:1]??e}function X(){let{language:e}=oa();return t=>sy(t,e)}function cy(e,t){if(e===`env`){let n=(t.name??``).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n))throw Error(`Enter a variable name such as ZAI_API_KEY`);return{source:e,name:n}}if(e===`file`){let n=(t.path??``).trim();if(!n)throw Error(`Enter the path of a key file`);return{source:e,path:n}}let n=(t.name??``).trim()||`memory-api`;if(!/^[A-Za-z0-9_-]{1,64}$/.test(n))throw Error(`Name the key file with letters, digits, dashes, or underscores`);if(!(t.value??``).trim())throw Error(`Paste the key`);return{source:e,name:n,value:t.value??``,replace:t.replace===!0}}function ly(e){let t=[],n=e.memoryProvider===`orcarouter`;return!n&&!e.memoryModel&&t.push(`memoryModel`),!n&&!e.memoryApiUrl&&t.push(`memoryApiUrl`),e.keySet||t.push(`memoryApiKey`),t}function uy(e,t){if(t===`inherit`||t===`external`)return{[`${e}Model`]:t};let n=t.indexOf(`/`);if(n<1||n===t.length-1)throw Error(`Enter a model as provider/model.`);return{[`${e}Provider`]:t.slice(0,n),[`${e}Model`]:t.slice(n+1)}}function dy(e){return{kind:e.relation,command:e.relation===`older`?`npm i -g om-memory-system@latest`:null}}function fy(e,t){return e.filter(e=>!t.has(e.from))}function py({status:e}){let t=X();return(0,H.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Jd(`claude-code`)}),e?.ready===!0&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`Claude Code capture uses the external API.`)}),e?.ready===!1&&(0,H.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-xs`,children:[(0,H.jsx)(`p`,{className:`text-amber-600`,children:t(`Claude Code capture is off. Complete the external API settings.`)}),(e.issues??[]).length>0&&(0,H.jsxs)(`p`,{children:[t(`Missing settings`),`: `,(e.issues??[]).map(e=>t(e)).join(`; `)]})]})]})}function my(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=ey();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&o(t.message)});for(let t of[`opencode`,`pi`])Y(`/api/settings/models?host=${t}`).then(n=>{e&&i(e=>({...e,[t]:n}))}).catch(()=>{e&&i(e=>({...e,[t]:{available:!1}}))});let r=ny(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function l(n,r){if(!t)return;let i;try{i=uy(n,r)}catch(t){o(e(t.message));return}c(!0);let a,s;try{a=await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:i,revision:t.revision})})}catch(e){s=e}let l=await ty()!==null;if(c(!1),a){let t=e(a.migratedLegacy?`Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.`:`Saved. New capture and profile work uses these settings.`);o(l?t:`${t} ${e(`Reload the page before saving again.`)}`)}else o(ry(s?.message??``,e(l?`Current settings were reloaded; check the values and save again.`:`The current settings could not be reloaded. Reload the page.`)))}let u=ly({memoryProvider:t?.settings.memoryProvider?.globalValue,memoryModel:t?.settings.memoryModel?.globalValue,memoryApiUrl:t?.settings.memoryApiUrl?.globalValue,keySet:!!t?.secrets.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Models`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Models`)}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e(`External API fallback`),`: `,t?.fallback.model??e(`none`),` (`,e(t?.fallback.configured?`ready`:`not ready`),`).`]}),[`opencode`,`pi`].map(e=>(0,H.jsx)(hy,{host:e,model:t?.settings[`${e}Model`],provider:t?.settings[`${e}Provider`],effective:e===`pi`?t?.effective.pi.kind:t?.effective.opencode.mode??`unready`,list:r[e],externalMissing:u,busy:s||!t,onSave:t=>l(e,t)},e)),(0,H.jsx)(py,{status:t?.effective[`claude-code`]}),a&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:a})]})}function hy({host:e,model:t,provider:n,effective:r,list:i,externalMissing:a,busy:o,onSave:s}){let c=X(),l=t?.globalValue===`inherit`||!t?.globalValue?`inherit`:t.globalValue===`external`?`external`:`${n?.globalValue??``}/${t.globalValue}`,[u,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),g=u??(l===`inherit`||l===`external`?l:`manual`),_=i?.models??[],y=l===`inherit`||l===`external`?``:l,b=m||y||(_[0]?`${_[0].provider}/${_[0].model}`:`typed`),x=!_.some(e=>`${e.provider}/${e.model}`===b),S=f??y;return(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Jd(e)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Effective model`),`:`,` `,t?.value===`external`&&r===`manual`?c(`external API`):t?.value===`inherit`||r===`session`?c(`session`):r===`manual`?c(`external API`):r===`unready`?c(`unavailable`):`${n?.value??``}/${t?.value??``}`]}),(t?.source===`project`||n?.source===`project`)&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:c(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`label`,{className:`block text-sm`,htmlFor:`${e}-model`,children:c(`Model choice`)}),(0,H.jsxs)(Er,{id:`${e}-model`,className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,value:g,onChange:e=>d(e.target.value),children:[(0,H.jsx)(`option`,{value:`inherit`,children:c(`Session model`)}),(0,H.jsx)(`option`,{value:`manual`,children:c(`Manual model`)}),(0,H.jsx)(`option`,{value:`external`,disabled:a.length>0,children:c(`External API`)})]}),a.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`External API needs`),`: `,a.join(`, `)]}),g===`manual`&&i?.available&&_.length>0&&(0,H.jsxs)(Er,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${Jd(e)} ${c(`Model`)}`,value:x?`typed`:b,onChange:e=>h(e.target.value),children:[_.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:c(`Manual provider/model`)})]}),g===`manual`&&x&&(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${e} ${c(`Manual provider/model`)}`,placeholder:`provider/model`,value:S,onChange:e=>{p(e.target.value),h(`typed`)}}),g===`manual`&&i&&!i.available&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason?c(i.reason):c(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:o,onClick:()=>s(g===`manual`?x?S.trim():b:g),children:c(`Save model`)})]})}var gy=[`openai-chat`,`openai-responses`,`anthropic`,`minimax`,`orcarouter`,`google-gemini`];function _y(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(`file`),[s,c]=(0,v.useState)({name:``,path:``,value:``}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=ey();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&u(t.message)});let r=ny(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let p=e=>String(t?.settings[e]?.globalValue??``),m=e=>r[e]??p(e);async function h(){if(!t)return;let n={};for(let e of[`memoryProvider`,`memoryApiUrl`,`memoryModel`]){let t=m(e).trim();t&&t!==p(e)&&(n[e]=t)}if(!Object.keys(n).length){u(e(`Nothing to save.`));return}f(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),i({}),u(e(`Saved. New capture and profile work uses these settings.`))}catch(e){u(e.message)}await ty(),f(!1)}async function g(n=!1){if(!t)return;let r;try{r=cy(a,{...s,replace:n})}catch(t){u(e(t.message));return}f(!0);try{await Y(`/api/settings/external-api/key`,{method:`POST`,body:JSON.stringify({...r,revision:t.revision})}),c(e=>({...e,value:``})),u(e(`Key source saved.`))}catch(t){let r=t.message;if(a===`paste`&&!n&&r.includes(`Confirm to replace`)){f(!1),window.confirm(e(`A key file with this name exists. Replace it?`))&&await g(!0);return}u(r)}await ty(),f(!1)}async function _(){f(!0);try{let t=await Y(`/api/settings/external-api/test`,{method:`POST`,body:`{}`});u(t.ok?`${e(`Test call succeeded`)}: ${t.model??``}`:`${e(`Test call failed`)}: ${t.error??``}`)}catch(e){u(e.message)}f(!1)}let y=t?.externalKey;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`External API`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`External API`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.`)}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Provider`),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsx)(Er,{"aria-label":e(`Provider`),className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:m(`memoryProvider`)||`openai-chat`,onChange:e=>i({...r,memoryProvider:e.target.value}),children:gy.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`API URL`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`https://api.example.com/v1`,value:m(`memoryApiUrl`),onChange:e=>i({...r,memoryApiUrl:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Model`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`glm-5-turbo`,value:m(`memoryModel`),onChange:e=>i({...r,memoryModel:e.target.value})})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d||!t,onClick:()=>void h(),children:e(`Save endpoint`)}),(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API key`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e(`Key source`),`:`,` `,y?.source===`env`?`${e(`environment variable`)} ${y.reference}`:y?.source===`file`?`${e(`key file`)} ${y.reference}`:y?.source===`literal`?e(`set in the config file`):e(`not set`),y?.source&&` · ${e(y.resolvesInWebApp?`resolves in the web app`:`does not resolve in the web app`)}`]}),y?.source===`env`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`A login web app does not see variables set only in a shell profile; a key file works everywhere.`)}),y?.source&&!y.resolvesInWebApp&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`The key does not resolve in this web app. Save it to a key file instead.`)}),[[`env`,`Environment variable`],[`file`,`Key file`],[`paste`,`Save key to a private file`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-key-source`,checked:a===t,onChange:()=>o(t)}),e(n)]},t)),a===`env`&&(0,H.jsx)(`input`,{"aria-label":e(`Variable name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`ZAI_API_KEY`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),a===`file`&&(0,H.jsx)(`input`,{"aria-label":e(`Key file path`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`~/.config/omms/secrets/zai.key`,value:s.path,onChange:e=>c({...s,path:e.target.value})}),a===`paste`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{"aria-label":e(`Key file name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`memory-api`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),(0,H.jsx)(`input`,{"aria-label":e(`API key`),type:`password`,autoComplete:`off`,className:`w-full rounded border border-border bg-background p-2`,value:s.value,onChange:e=>c({...s,value:e.target.value})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:d||!t,onClick:()=>void g(),children:e(`Save key source`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d,onClick:()=>void _(),children:e(`Test`)}),l&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:l})]})}var vy=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`,`0:0:0:0:0:0:0:1`]);function yy(e){let t=e.trim().toLowerCase();return vy.has(t)||/^127(?:\.\d{1,3}){3}$/.test(t)}function by(e){try{return yy(new URL(e).hostname)}catch{return!1}}function xy(e,t){return e?`set`:t?`missing`:`not-needed`}function Sy(e){let{access:t,secrets:n}=e,r=t.embeddingApiUrl;return{memoryApiKey:(e=>e===`not-needed`?`never-used`:e)(xy(!!n.memoryApiKey?.set,e.externalUsed||e.claudeCodeInUse)),embeddingApiKey:xy(!!n.embeddingApiKey?.set,!!r&&!by(r)),apiTokens:xy(t.tokenAvailable,!yy(t.host)&&!t.authEnabled),webPassword:xy(!!n.webServerAuthPassword?.set,!1)}}function Cy(e){return e?`Browser password cleared. Restart the web app to turn it off.`:`Saved. Restart the web app to use the new browser password.`}var wy=[{id:`ollama`,label:`Ollama`,url:`http://localhost:11434/v1`},{id:`llamacpp`,label:`llama.cpp`,url:`http://localhost:8080/v1`},{id:`openrouter`,label:`OpenRouter`,url:`https://openrouter.ai/api/v1`},{id:`openai`,label:`OpenAI`,url:`https://api.openai.com/v1`},{id:`custom`,label:`Custom`,url:``}];function Ty(e,t){let n=wy.find(t=>t.id===e);return n&&n.url?n.url:t}function Ey(e){if(e.kind===`builtin`)return{kind:`builtin`,model:e.model.trim()};let t=e.key===`none`||e.key===`saved`?{source:e.key}:cy(e.key,{...e.keyInput,name:e.keyInput.name||`embedding-api`});return{kind:`server`,url:e.url.trim(),model:e.model.trim(),key:t}}function Dy(e){return JSON.stringify([e.kind,e.kind===`server`?e.url.trim():``,e.model.trim(),e.kind===`server`?e.key:`none`,e.kind===`server`?e.keyInput:null])}function Oy(e,t){return e!==void 0&&e===Dy(t)}function ky(e,t){let n=t.kind===`server`&&!by(t.url);return{count:e.toLocaleString(`en-US`),risks:[...n?[`The hosted server is called once for each memory, which may cost money.`]:[],`Search results are poor until the re-embed ends.`,`Restart open OpenCode and Pi sessions after the change.`]}}var Ay=`Xenova/nomic-embed-text-v1`;function jy(e,t=Ay){return e===`builtin`?{kind:e,model:t}:{kind:e}}function My(e,t){return e===`server`&&t?`saved`:`none`}function Ny({current:e,keySet:t}){let n=X();return(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-sm`,children:[(0,H.jsx)(`dt`,{children:n(`Kind`)}),(0,H.jsx)(`dd`,{children:n(e.kind===`server`?`OpenAI-compatible server`:`Built-in model`)}),e.url&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`Server URL`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.url})]}),(0,H.jsx)(`dt`,{children:n(`Model`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.model}),(0,H.jsx)(`dt`,{children:n(`Vector size`)}),(0,H.jsx)(`dd`,{children:e.dimensions}),(0,H.jsx)(`dt`,{children:n(`API key`)}),(0,H.jsx)(`dd`,{children:n(t?`set`:`not set`)}),(0,H.jsx)(`dt`,{children:n(`Stored memories`)}),(0,H.jsx)(`dd`,{children:e.memoryCount.toLocaleString(`en-US`)})]})}function Py({run:e,onRetry:t}){let n=X();return e.state===`idle`?null:(0,H.jsxs)(`div`,{role:`status`,className:`space-y-1 text-sm`,children:[e.state===`running`&&(0,H.jsxs)(`p`,{children:[n(`Re-embedding`),`: `,e.progress.processed,`/`,e.progress.total]}),e.state===`done`&&(0,H.jsx)(`p`,{children:n(`Re-embed finished.`)}),e.state===`failed`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`text-red-600`,children:[n(`Re-embed failed`),`: `,e.error??``]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:t,children:n(`Retry`)})]})]})}function Fy(e,t){return{kind:e.kind,url:e.url??``,model:e.model,key:My(e.kind,t),keyInput:{name:``,path:``,value:``}}}function Iy(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)({state:`idle`,progress:{processed:0,total:0}}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1);async function b(){let e=await Y(`/api/settings/embedding`);return n(e),m(e.run),e}(0,v.useEffect)(()=>{let e=!0,t=ey();b().catch(t=>e&&g(t.message)),Y(`/api/settings`).then(n=>e&&t.isCurrent()&&i(n)).catch(()=>{}),Y(`/api/web/status`).then(t=>e&&o(!!t.isLocal)).catch(()=>{});let n=ny(t=>e&&i(t));return()=>{e=!1,n()}},[]),(0,v.useEffect)(()=>{if(p.state!==`running`)return;let e=setInterval(()=>{Y(`/api/settings/embedding/run`).then(e=>{m(e),e.state!==`running`&&b()}).catch(()=>{})},1e3);return()=>clearInterval(e)},[p.state]);function x(){if(s||!t){c(!1),u(void 0),f(void 0);return}u(Fy(t,!!r?.secrets.embeddingApiKey?.set)),c(!0)}let S=e=>u(t=>t&&{...t,...e});async function C(){l&&await ay(y,async()=>{try{let t=await Y(`/api/settings/embedding/test`,{method:`POST`,body:JSON.stringify(Ey(l))});t.ok&&t.dimensions?(f({key:Dy(l),dimensions:t.dimensions}),g(`${e(`Test passed. Vector size`)}: ${t.dimensions}`)):(f(void 0),g(`${e(`Test failed`)}: ${t.reason??``}`))}catch(t){g(e(t.message))}})}async function w(){if(!l||!t||!r)return;let{count:n,risks:i}=ky(t.memoryCount,l),a=[`${e(`Every stored memory will be re-embedded`)}: ${n}`,...i.map(t=>e(t))].join(`
124
+ `);window.confirm(a)&&await ay(y,async()=>{try{let e=await Y(`/api/settings/embedding/apply`,{method:`POST`,body:JSON.stringify({candidate:Ey(l),revision:r.revision})});m(e),c(!1),u(void 0),f(void 0),g(``)}catch(e){g(e.message)}await ty()})}async function T(){try{m(await Y(`/api/settings/embedding/run`,{method:`POST`,body:`{}`}))}catch(e){g(e.message)}}let E=!!r?.secrets.embeddingApiKey?.set;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Embedding`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Embedding`)}),a&&(0,H.jsx)(`button`,{type:`button`,"aria-label":e(s?`Lock`:`Unlock to change`),title:e(s?`Lock`:`Unlock to change`),className:`rounded border border-border px-2 py-1`,disabled:!t||p.state===`running`,onClick:x,children:s?`🔓`:`🔒`})]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`The model that turns memory text into search vectors. A change re-embeds every memory.`)}),t&&!s&&(0,H.jsx)(Ny,{current:t,keySet:E}),s&&l&&(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[[`builtin`,`server`].map(n=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-embedding-kind`,checked:l.kind===n,onChange:()=>S(jy(n,t?.kind===`builtin`?t.model:`Xenova/nomic-embed-text-v1`))}),e(n===`server`?`OpenAI-compatible server`:`Built-in model`)]},n)),l.kind===`server`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`block`,children:[e(`Preset`),(0,H.jsx)(`div`,{className:`w-72 max-w-full`,children:(0,H.jsx)(Er,{"aria-label":e(`Preset`),className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:wy.find(e=>e.url===l.url)?.id??`custom`,onChange:e=>S({url:Ty(e.target.value,l.url)}),children:wy.map(t=>(0,H.jsx)(`option`,{value:t.id,children:t.id===`custom`?e(`Custom`):t.label},t.id))})})]}),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Server URL`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:l.url,onChange:e=>S({url:e.target.value})})]})]}),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Model`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,placeholder:l.kind===`server`?`nomic-embed-text`:`Xenova/nomic-embed-text-v1`,value:l.model,onChange:e=>S({model:e.target.value})})]}),l.kind===`server`&&(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API key`)}),[[`none`,`No key`],...E?[[`saved`,`Keep the saved key`]]:[],[`env`,`Environment variable`],[`file`,`Key file`],[`paste`,`Save key to a private file`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-embedding-key`,checked:l.key===t,onChange:()=>S({key:t})}),e(n)]},t)),l.key===`env`&&(0,H.jsx)(`input`,{"aria-label":e(`Variable name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`OPENROUTER_API_KEY`,value:l.keyInput.name,onChange:e=>S({keyInput:{...l.keyInput,name:e.target.value}})}),l.key===`file`&&(0,H.jsx)(`input`,{"aria-label":e(`Key file path`),className:`w-full rounded border border-border bg-background p-2`,value:l.keyInput.path,onChange:e=>S({keyInput:{...l.keyInput,path:e.target.value}})}),l.key===`paste`&&(0,H.jsx)(`input`,{"aria-label":e(`API key`),type:`password`,autoComplete:`off`,className:`w-full rounded border border-border bg-background p-2`,value:l.keyInput.value,onChange:e=>S({keyInput:{...l.keyInput,value:e.target.value}})})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:_||!l.model.trim(),onClick:()=>void C(),children:e(`Test`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:_||!Oy(d?.key,l),onClick:()=>void w(),children:e(`Apply`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:x,children:e(`Cancel`)})]})]}),(0,H.jsx)(Py,{run:p,onRetry:()=>void T()}),h&&(0,H.jsx)(`p`,{className:`text-sm`,children:h})]})}async function Ly(e,t){return e()?(await t(),!0):!1}var Ry=[[`7`,`7 days`],[`30`,`30 days`],[`90`,`90 days`],[`never`,`Never`]];function zy({tokens:e,newValue:t,busy:n,onGenerate:r,onRevoke:i}){let a=X(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(`30`),u=e=>e===null?a(`Never`):Qp(e);return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:a(`Name`)}),(0,H.jsx)(`th`,{children:a(`Created`)}),(0,H.jsx)(`th`,{children:a(`Expires`)}),(0,H.jsx)(`th`,{children:a(`Last used`)}),(0,H.jsx)(`th`,{})]})}),(0,H.jsx)(`tbody`,{children:e.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:e.name}),(0,H.jsx)(`td`,{children:u(e.createdAt)}),(0,H.jsx)(`td`,{children:u(e.expiresAt)}),(0,H.jsx)(`td`,{children:e.lastUsedAt===null?`-`:u(e.lastUsedAt)}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-0.5`,disabled:n,onClick:()=>i(e),children:a(`Revoke`)})})]},e.id))})]}),t&&(0,H.jsxs)(`div`,{role:`status`,className:`space-y-1 rounded border border-border p-2 text-xs`,children:[(0,H.jsx)(`code`,{className:`block break-all`,children:t}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-0.5`,onClick:()=>void navigator.clipboard?.writeText(t),children:a(`Copy`)}),(0,H.jsx)(`p`,{className:`text-amber-600`,children:a(`Copy this token now. It will not be shown again.`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[a(`Token name`),(0,H.jsx)(`input`,{className:`mt-1 block rounded border border-border bg-background p-1.5`,placeholder:`ci`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`block`,children:[a(`Expires after`),(0,H.jsx)(Er,{"aria-label":a(`Expires after`),className:`mt-1 block rounded border border-border bg-background p-1.5`,value:c,onChange:e=>l(e.target.value),children:Ry.map(([e,t])=>(0,H.jsx)(`option`,{value:e,children:a(t)},e))})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:n||!o.trim(),onClick:()=>r(o.trim(),c===`never`?null:Number(c)),children:a(`Generate token`)})]})]})}var By=`relative overflow-x-auto rounded-lg border border-border`,Vy=`px-3 py-2 text-start font-medium`,Hy=`bg-muted/50 text-xs text-muted-foreground`,Uy=`px-3 py-2 text-start font-medium`,Wy=`border-t border-border transition-colors hover:bg-muted/30`,Gy=`px-3 py-1.5`;function Ky(e){return{secrets:e.secrets??{},externalUsed:e.effective?.opencode?.mode===`manual`||e.effective?.pi?.kind===`manual`,claudeCodeInUse:!!(e.claudeCodeEvidence?.attempts||e.claudeCodeEvidence?.folderSet),access:e.access??{host:`127.0.0.1`,authEnabled:!1,tokenAvailable:!1,embeddingApiUrl:null}}}var qy=[{id:`memoryApiKey`,label:`External API key`,purpose:`Capture and profile learning through the external API. Claude Code always uses it.`,hosts:`OpenCode, Pi, Claude Code`,where:`External API card`},{id:`embeddingApiKey`,label:`Embedding server key`,purpose:`Sent to an embedding server on another machine.`,hosts:`OpenCode, Pi, Claude Code`,where:`Embedding card`},{id:`apiTokens`,label:`API tokens`,purpose:`Let scripts and other computers call the web app's API.`,hosts:`Web app`,where:`Table below`},{id:`webPassword`,label:`Browser password`,purpose:`Asks for a user name and password before the page opens.`,hosts:`Web app`,where:`Form below`}];function Jy({state:e}){let t=X();return e===`set`?(0,H.jsxs)(`span`,{children:[`✅ `,t(`set`)]}):e===`missing`?(0,H.jsxs)(`span`,{className:`text-red-600`,children:[`⛔️ `,t(`missing`)]}):e===`never-used`?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t(`never used before`)}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t(`not needed`)})}function Yy({states:e}){let t=X();return(0,H.jsx)(`div`,{className:By,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:V(Vy,`sr-only`),children:t(`Keys and access`)}),(0,H.jsx)(`thead`,{className:Hy,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:Uy,children:t(`Credential`)}),(0,H.jsx)(`th`,{className:Uy,children:t(`State`)}),(0,H.jsx)(`th`,{className:Uy,children:t(`Used for`)}),(0,H.jsx)(`th`,{className:Uy,children:t(`Hosts`)}),(0,H.jsx)(`th`,{className:Uy,children:t(`Change it in`)})]})}),(0,H.jsx)(`tbody`,{children:qy.map(n=>(0,H.jsxs)(`tr`,{className:V(Wy,`align-top`),children:[(0,H.jsx)(`td`,{className:V(Gy,`font-medium`),children:t(n.label)}),(0,H.jsx)(`td`,{className:V(Gy,`whitespace-nowrap`),children:(0,H.jsx)(Jy,{state:e[n.id]})}),(0,H.jsx)(`td`,{className:Gy,children:t(n.purpose)}),(0,H.jsx)(`td`,{className:Gy,children:n.hosts===`Web app`?t(`Web app`):n.hosts}),(0,H.jsx)(`td`,{className:Gy,children:t(n.where)})]},n.id))})]})})}function Xy({value:e,onChange:t}){let n=X();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`block w-full max-w-72`,children:[(0,H.jsx)(`span`,{children:n(`User name`)}),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,autoComplete:`username`,value:e.username,onChange:n=>t({...e,username:n.target.value})})]}),(0,H.jsxs)(`label`,{className:`block w-full max-w-72`,children:[(0,H.jsx)(`span`,{children:n(`Password`)}),(0,H.jsx)(`input`,{type:`password`,autoComplete:`new-password`,className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:e.value,onChange:n=>t({...e,value:n.target.value})})]})]})}function Zy(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)({username:``,value:``}),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1);async function h(){let e=await Y(`/api/settings/tokens`);o(e.tokens)}(0,v.useEffect)(()=>{let e=!0,t=ey();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&f(t.message)}),Y(`/api/web/status`).then(async t=>{!e||!t.isLocal||(i(!0),await h())}).catch(()=>{});let r=ny(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function g(e){await ay(m,async()=>{try{await e()}catch(e){f(e.message)}await ty()}).catch(()=>{})}let _=(e,t)=>g(async()=>{let n=await Y(`/api/settings/tokens`,{method:`POST`,body:JSON.stringify({name:e,expiresInDays:t})});c(n.value),f(``),await h()}),y=t=>g(async()=>{c(void 0),await Ly(()=>window.confirm(e(`Revoke this token? Scripts that use it stop working.`)),async()=>{await Y(`/api/settings/tokens/${t.id}`,{method:`DELETE`}),await h()})}),b=n=>g(async()=>{t&&(await Y(`/api/settings/web-password`,{method:`POST`,body:JSON.stringify(n?{clear:!0,revision:t.revision}:{password:l.value,username:l.username,revision:t.revision})}),u({username:``,value:``}),f(e(Cy(n))))}),x=t?.access;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Keys and access`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Keys and access`)}),t&&(0,H.jsx)(Yy,{states:Sy(Ky(t))}),x?.configTokenIgnored&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`The config file still sets webServerApiToken. OMMS imported it once as the token “from config file” and no longer reads the key. Use the token table instead.`)}),r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API tokens`)}),(0,H.jsx)(zy,{tokens:a,newValue:s,busy:p,onGenerate:(e,t)=>void _(e,t),onRevoke:e=>void y(e)})]}),(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`Browser password`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:x?.authEnabled?x.authUsername?`${e(`A browser password is set for user`)} ${x.authUsername}.`:e(`A browser password is set for your computer user name.`):e(`No browser password is set.`)}),(0,H.jsx)(Xy,{value:l,onChange:u}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:p||!t||!l.value,onClick:()=>void b(!1),children:e(`Save password`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:p||!t||!x?.authEnabled,onClick:()=>void b(!0),children:e(`Clear password`)})]})]})]}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`Open this page on the computer that runs OMMS to manage tokens and the password.`)}),d&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:d})]})}function Qy(){let e=X(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``);async function l(){let e=await Y(`/api/settings/profiles`);n(e.profiles)}if((0,v.useEffect)(()=>{l().catch(e=>c(e.message))},[]),t.length<2)return null;let u=t=>ay(o,async()=>{if(window.confirm(`${e(`Use this profile for every folder?`)} ${t.userId}`))try{let n=await ty();await Y(`/api/settings/profiles/use`,{method:`POST`,body:JSON.stringify({userId:t.userId,revision:n?.revision})}),await ty(),await l(),c(e(`Saved. OMMS now uses this profile in every folder.`))}catch(e){c(e.message)}}),d=n=>ay(o,async()=>{let i=t.find(e=>e.id===(r[n.id]??t.find(e=>e.id!==n.id)?.id));if(i&&window.confirm(`${e(`Merge this profile into the other one? The source profile is turned off, not deleted.`)}\n${n.userId} → ${i.userId}`))try{await Y(`/api/settings/profiles/merge`,{method:`POST`,body:JSON.stringify({sourceId:n.id,targetId:i.id})}),await l(),c(e(`Merged.`))}catch(e){c(e.message)}});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Profiles`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Profiles`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`OMMS keeps one profile for each git email. A folder whose repository has its own email starts a second profile. Choose the profile that is yours, or merge the extra one into it.`)}),(0,H.jsx)(`div`,{className:By,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:V(Vy,`sr-only`),children:e(`Profiles`)}),(0,H.jsx)(`thead`,{className:Hy,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:Uy,children:e(`Email`)}),(0,H.jsx)(`th`,{className:Uy,children:e(`Preferences`)}),(0,H.jsx)(`th`,{className:Uy,children:e(`Patterns`)}),(0,H.jsx)(`th`,{className:Uy,children:e(`Workflows`)}),(0,H.jsx)(`th`,{className:Uy,children:e(`Prompts analysed`)}),(0,H.jsx)(`th`,{className:Uy,children:e(`Last update`)}),(0,H.jsx)(`th`,{className:Uy,children:e(`Actions`)})]})}),(0,H.jsx)(`tbody`,{children:t.map(n=>(0,H.jsxs)(`tr`,{className:Wy,children:[(0,H.jsxs)(`td`,{className:V(Gy,`font-medium`),children:[n.userId,n.inUse&&(0,H.jsxs)(`span`,{className:`ms-2 text-xs text-green-700`,children:[`✅ `,e(`in use`)]})]}),(0,H.jsx)(`td`,{className:Gy,children:n.preferences}),(0,H.jsx)(`td`,{className:Gy,children:n.patterns}),(0,H.jsx)(`td`,{className:Gy,children:n.workflows}),(0,H.jsx)(`td`,{className:Gy,children:n.totalPromptsAnalyzed}),(0,H.jsx)(`td`,{className:Gy,children:Zp(n.lastAnalyzedAt)}),(0,H.jsxs)(`td`,{className:V(Gy,`space-y-1`),children:[!n.inUse&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-1`,disabled:a,onClick:()=>void u(n),children:e(`Use this profile`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`label`,{className:`sr-only`,htmlFor:`merge-${n.id}`,children:e(`Merge into`)}),(0,H.jsx)(`select`,{id:`merge-${n.id}`,className:`rounded border border-border bg-background px-1 py-1 text-xs`,value:r[n.id]??``,onChange:e=>i(t=>({...t,[n.id]:e.target.value})),children:t.filter(e=>e.id!==n.id).map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.userId},e.id))}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-1`,disabled:a,onClick:()=>void d(n),children:e(`Merge into`)})]})]})]},n.id))})]})}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:s})]})}var $y=[`opencode`,`pi`,`claude-code`];function eb(e){return!e.provider&&!e.model?null:`${e.provider??``}/${e.model??``}`}function tb(e){let t=new Map;for(let n of e){let e=t.get(n.host)??{host:n.host,total:0,saved:0,skipped:0,failed:0,models:[]};e.total+=n.total,e.saved+=n.saved,e.skipped+=n.skipped,e.failed+=n.failed;let r=eb(n),i=e.models.find(e=>e.label===r);i?(i.total+=n.total,i.saved+=n.saved,i.skipped+=n.skipped,i.failed+=n.failed):e.models.push({label:r,provider:n.provider,model:n.model,total:n.total,saved:n.saved,skipped:n.skipped,failed:n.failed}),t.set(n.host,e)}let n=e=>{let t=$y.indexOf(e);return t<0?$y.length:t};return[...t.values()].map(e=>({...e,models:e.models.sort((e,t)=>t.total-e.total)})).sort((e,t)=>n(e.host)-n(t.host))}function nb(e,t){return t>0?Math.round(100*e/t):0}function rb(e){let t=new Map;for(let n of e){let e=`${n.host}\u0000${n.reason}`,r=t.get(e)??{host:n.host,reason:n.reason,count:0};r.count+=n.count,t.set(e,r)}return[...t.values()].sort((e,t)=>t.count-e.count)}function ib({row:e}){return(0,H.jsxs)(H.Fragment,{children:[[e.saved,e.skipped,e.failed].map((t,n)=>(0,H.jsxs)(`td`,{className:V(Gy,`text-end tabular-nums`),children:[t,` `,(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[nb(t,e.total),`%`]})]},n)),(0,H.jsx)(`td`,{className:V(Gy,`text-end font-medium tabular-nums`),children:e.total})]})}function ab(e,t){return`/api/settings/diagnostics?days=${e}${t===`all`?``:`&host=${t}`}`}function ob(){let e=X(),[t,n]=(0,v.useState)(7),[r,i]=(0,v.useState)(`all`),[a,o]=(0,v.useState)(()=>new Set),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b]=(0,v.useState)(iy),x=(0,v.useCallback)(async(e,t)=>{let n=ey(),r=b.begin();try{let[i,a,o]=await Promise.all([Y(ab(e,t)),Y(`/api/settings/traces`),Y(`/api/settings`)]);if(!r())return;c(i),u(a.traces),n.isCurrent()&&f(o),g(``)}catch(e){if(!r())return;g(e.message)}},[b]);(0,v.useEffect)(()=>{x(t,r)},[t,r,x]),(0,v.useEffect)(()=>ny(e=>f(e)),[]);async function S(n){if(!d)return;let i;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({revision:d.revision,edits:n})})}catch(e){i=e}let a=await ty()!==null;if(!i){y(``),await x(t,r),a||g(e(`Reload the page before saving again.`));return}g(ry(i.message,e(a?`Current settings were reloaded; check the values and save again.`:`The current settings could not be reloaded. Reload the page.`)))}async function C(e){try{let t=await Y(`/api/settings/traces/${encodeURIComponent(e)}`);m(t.content)}catch(e){g(e.message)}}async function w(n){if(window.confirm(`${e(`Delete`)} ${n}?`))try{await Y(`/api/settings/traces/${encodeURIComponent(n)}`,{method:`DELETE`}),m(``),await x(t,r)}catch(e){g(e.message)}}async function T(n){try{let{result:i}=await Y(`/api/settings/capture-retry/${n}/run`,{method:`POST`,body:`{}`});y(e(i===`scheduled`?n===`pi`?`These turns retry at the next Pi session start.`:n===`claude-code`?`These turns retry at the next Claude Code session start.`:`These turns retry at the next OpenCode session start.`:i===`running`?`A retry is already running.`:`Retrying now.`)),await x(t,r)}catch(e){g(e.message)}}let E=d?.settings.captureTrace,D=Number(d?.settings.captureRetryRetentionHours?.value??72);return(0,H.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Capture diagnostics`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Capture diagnostics`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 pb-2 text-sm`,children:[e(`Time range`),(0,H.jsxs)(Er,{"aria-label":e(`Time range`),className:`rounded-lg border border-border bg-background px-2 py-1`,value:t,onChange:e=>n(Number(e.target.value)),children:[(0,H.jsx)(`option`,{value:1,children:e(`24 hours`)}),(0,H.jsx)(`option`,{value:7,children:e(`7 days`)}),(0,H.jsx)(`option`,{value:30,children:e(`30 days`)}),(0,H.jsx)(`option`,{value:90,children:e(`90 days`)})]}),e(`Host`),(0,H.jsxs)(Er,{"aria-label":e(`Host`),className:`rounded-lg border border-border bg-background px-2 py-1`,value:r,onChange:e=>i(e.target.value),children:[(0,H.jsx)(`option`,{value:`all`,children:e(`All`)}),[`opencode`,`pi`,`claude-code`].map(e=>(0,H.jsx)(`option`,{value:e,children:Jd(e)},e))]})]}),h&&(0,H.jsx)(`p`,{role:`alert`,children:h}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Saved: a memory was stored. Skipped: the model or a rule found nothing worth keeping, or the turn was private or trivial. Failed: the attempt hit an error. Total: the three added up. Each percentage is a share of its row's total.`)}),(0,H.jsx)(`div`,{className:By,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:Vy,children:e(`Outcomes by host`)}),(0,H.jsx)(`thead`,{className:Hy,children:(0,H.jsx)(`tr`,{children:[`Host / model`,`Saved`,`Skipped`,`Failed`,`Total`].map((t,n)=>(0,H.jsx)(`th`,{scope:`col`,className:V(Uy,n>0&&`text-end`),children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:tb(s?.byModel??[]).map(t=>{let n=a.has(t.host);return(0,H.jsxs)(v.Fragment,{children:[(0,H.jsxs)(`tr`,{className:V(Wy,`font-medium`),children:[(0,H.jsx)(`td`,{className:Gy,children:(0,H.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1`,"aria-expanded":n,onClick:()=>o(e=>{let r=new Set(e);return n?r.delete(t.host):r.add(t.host),r}),children:[(0,H.jsx)(`span`,{"aria-hidden":!0,children:n?`▾`:`▸`}),Yd(t.host),(0,H.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,t.models.length,` `,e(t.models.length===1?`model`:`models`),`)`]})]})}),(0,H.jsx)(ib,{row:t})]}),n&&t.models.map(n=>(0,H.jsxs)(`tr`,{className:`border-t border-border transition-colors hover:bg-muted/30`,children:[(0,H.jsx)(`td`,{className:V(`px-3 py-1.5`,`ps-8`),children:n.label?(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:n.label}):(0,H.jsx)(`span`,{className:`text-xs italic text-muted-foreground`,title:e(`No model was recorded for these attempts. This happens with records written by older OMMS versions, and when an attempt stops before a model is chosen.`),children:e(`model not recorded`)})}),(0,H.jsx)(ib,{row:n})]},`${t.host}-${n.label??`none`}`))]},t.host)})})]})}),(0,H.jsx)(`div`,{className:By,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:Vy,children:e(`Failure reasons`)}),(0,H.jsx)(`thead`,{className:Hy,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,className:Uy,children:e(`Host`)}),(0,H.jsx)(`th`,{scope:`col`,className:Uy,children:e(`Reason`)}),(0,H.jsx)(`th`,{scope:`col`,className:V(Uy,`text-end`),children:e(`Total`)})]})}),(0,H.jsx)(`tbody`,{children:rb(s?.byReason??[]).map((e,t)=>(0,H.jsxs)(`tr`,{className:Wy,children:[(0,H.jsx)(`td`,{className:V(Gy,`text-muted-foreground`),children:Yd(e.host)}),(0,H.jsx)(`td`,{className:V(Gy,`font-mono text-xs`),children:e.reason}),(0,H.jsx)(`td`,{className:V(Gy,`text-end tabular-nums`),children:e.count})]},`${e.host}-${e.reason}-${t}`))})]})}),(0,H.jsx)(`div`,{className:V(By,`max-h-72 overflow-y-auto`),children:(0,H.jsxs)(`table`,{className:`w-full min-w-max text-sm`,children:[(0,H.jsx)(`caption`,{className:Vy,children:e(`Recent attempts`)}),(0,H.jsx)(`thead`,{className:V(Hy,`sticky top-0`),children:(0,H.jsx)(`tr`,{children:[`Time`,`Host`,`Source`,`Session`,`Path`,`Model`,`Stop`,`Blocks`,`Prompt`,`Reply`,`Duration`,`Outcome`,`Reason`].map(t=>(0,H.jsx)(`th`,{scope:`col`,className:Uy,children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:s?.recent.map((e,t)=>(0,H.jsx)(`tr`,{className:Wy,children:[Zp(e.timestamp),Yd(e.host),e.sourceType,e.sessionId,e.path,`${e.provider??``}/${e.model??``}`,e.stopReason,e.blockTypes?.join(`, `),e.promptChars,e.replyChars,e.durationMs,e.outcome,e.reason].map((e,t)=>(0,H.jsx)(`td`,{className:V(Gy,`whitespace-nowrap`),children:e??``},t))},`${e.timestamp}-${t}`))})]})}),(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3 text-sm`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:E?.value===!0,disabled:!d,onChange:t=>{t.target.checked&&!window.confirm(e(`Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.`))||S({captureTrace:t.target.checked})}}),` `,e(`Save capture traces`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.`)}),E?.source===`project`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`This project turns tracing off. The global switch cannot turn it on here.`)}),[`captureTraceRetentionDays`,`captureAttemptRetentionDays`].map(t=>(0,H.jsxs)(`label`,{className:`block`,children:[e(t===`captureTraceRetentionDays`?`Trace retention (days)`:`Attempt retention (days)`),` `,(0,H.jsx)(`input`,{type:`number`,min:1,className:`ms-2 w-20 rounded border border-border bg-background p-1`,defaultValue:Number(d?.settings[t]?.value??30),onBlur:e=>{let n=Number(e.target.value);Number.isSafeInteger(n)&&n>0&&n!==d?.settings[t]?.value&&S({[t]:n})}},`${t}-${d?.settings[t]?.value}`)]},t)),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Retry retention (hours)`),` `,(0,H.jsx)(`input`,{type:`number`,min:0,max:720,className:`ms-2 w-20 rounded border border-border bg-background p-1`,defaultValue:D,onBlur:e=>{let t=Number(e.target.value);Number.isSafeInteger(t)&&t>=0&&t<=720&&t!==D&&S({captureRetryRetentionHours:t})}},`captureRetryRetentionHours-${D}`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`When the capture model cannot be reached, OMMS keeps the turn and tries again later. Queued turns can hold conversation content after redaction. 0 turns the queue off and deletes waiting turns.`)}),(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Turns waiting for retry`)}),[`pi`,`opencode`,`claude-code`].map(t=>{let n=s?.retryQueue?.[t]??0;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`w-24`,children:Jd(t)}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:n}),(0,H.jsx)(`button`,{type:`button`,disabled:n===0||D===0,className:`disabled:opacity-50`,onClick:()=>void T(t),children:e(`Retry now`)})]},t)}),_&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_}),(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Trace files`)}),l.map(t=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`span`,{children:[t.file,` (`,t.size,` bytes)`]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void C(t.file),children:e(`View`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void w(t.file),children:e(`Delete`)})]},t.file)),p&&(0,H.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:p})]})]})}function sb(){let e=X(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``);async function s(e){i(!0);try{let t=await Y(`/api/settings/health`,{method:`POST`,body:JSON.stringify({testModels:e})});n(t.checks),o(``)}catch(e){o(e.message)}finally{i(!1)}}return(0,H.jsxs)(`section`,{id:`settings-health`,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Health`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Health`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:r,onClick:()=>void s(!1),children:e(`Run checks`)}),(0,H.jsx)(`button`,{className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:r,onClick:()=>void s(!0),children:e(`Run checks and test models`)})]}),r&&(0,H.jsx)(`p`,{role:`status`,children:e(`Checking…`)}),a&&(0,H.jsx)(`p`,{role:`alert`,children:a}),(0,H.jsx)(`ul`,{className:`space-y-2 text-sm`,children:t.map(t=>(0,H.jsxs)(`li`,{className:`rounded-lg border border-border p-2`,children:[(0,H.jsx)(`strong`,{className:t.status===`fail`?`text-red-600`:t.status===`warn`?`text-amber-600`:`text-green-600`,children:e(t.status).toUpperCase()}),` `,`· `,e(t.check),`: `,t.reason]},t.check))})]})}function cb(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>{e&&n(t)}).catch(t=>{e&&c(t.message)}),Y(`/api/settings/web-autostart`).then(t=>{e&&i(t)}).catch(t=>{e&&c(t.message)}),Y(`/api/settings/version`).then(t=>{e&&o(t)}).catch(()=>{});let t=ny(t=>{e&&n(t)});return()=>{e=!1,t()}},[]);async function d(n){if(t){u(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{webServerAutoStart:n},revision:t.revision})}),c(e(`Saved. The login item changes at the next Pi or OpenCode start.`))}catch(e){c(e.message)}await ty(),u(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Web app`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Web app`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!t?.settings.webServerAutoStart?.globalValue,disabled:l||!t,onChange:e=>void d(e.target.checked)}),e(`Start web app at login`)]}),(0,H.jsxs)(`p`,{className:`text-sm`,children:[e(`Login item`),`: `,e(r?.state??`not installed`)]}),r?.state===`unsupported`&&(0,H.jsx)(`p`,{role:`status`,children:e(`Login items are unsupported on this platform.`)}),r?.state===`no-runtime`&&(0,H.jsx)(`p`,{role:`status`,children:e(`Install Node or Bun to start the web app at login.`)}),a&&(0,H.jsx)(lb,{info:a}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Use these commands to apply the change now:`)}),(0,H.jsxs)(`div`,{className:`space-y-1 font-mono text-xs`,children:[(0,H.jsx)(`p`,{children:`om-memory-system web`}),(0,H.jsx)(`p`,{children:`om-memory-system web install`}),(0,H.jsx)(`p`,{children:`om-memory-system web uninstall`}),(0,H.jsx)(`p`,{children:`om-memory-system web status`})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:s})]})}function lb({info:e}){let t=X(),n=dy(e);return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsxs)(`p`,{children:[t(`Running version`),`: `,e.running,` · `,t(`Global command`),`:`,` `,e.global??t(`not installed globally`)]}),n.kind===`older`&&(0,H.jsx)(`p`,{role:`status`,children:t(`A newer OMMS copy runs in place of the global install. The global install is optional. To update it:`)}),n.kind===`newer`&&(0,H.jsx)(`p`,{role:`status`,className:`text-amber-600`,children:t(`The global install is newer than the running OMMS. The next Pi or OpenCode start replaces the web app.`)}),n.kind===`missing`&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`OMMS is not installed globally. A global install is optional.`)}),n.command&&(0,H.jsx)(`p`,{className:`font-mono text-xs`,children:n.command})]})}function ub(e){let t=e.trim();return t===``||t.startsWith(`~/`)||t.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(t)||t.startsWith(`\\\\`)}function db(e,t,n){return n?t:typeof e==`string`?e:``}function fb(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=t=>{e&&(n(t),i(e=>db(t.settings.claudeConfigDir?.globalValue,e,l.current)))},r=ey();Y(`/api/settings`).then(e=>{r.isCurrent()&&t(e)}).catch(t=>{e&&o(t.message)});let a=ny(e=>t(e));return()=>{e=!1,a()}},[]);async function u(){if(t){if(!ub(r)){o(e(`Enter a full path, or a path that starts with ~/.`));return}c(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{claudeConfigDir:r.trim()},revision:t.revision})}),l.current=!1,o(e(`Saved. Capture and import use this folder now.`))}catch(e){o(e.message)}await ty(),c(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Claude Code folder`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Claude Code folder`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`Set this when Claude Code does not use ~/.claude, for example when you start it with CLAUDE_CONFIG_DIR. Leave it empty to use the default.`)}),(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Claude Code folder`)}),(0,H.jsx)(`input`,{className:`w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`~/.claude`,value:r,disabled:s||!t,onChange:e=>{l.current=!0,i(e.target.value)}})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:s||!t,onClick:()=>void u(),children:e(`Save folder`)}),(0,H.jsx)(pb,{folder:t?.claudeFolder}),a&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:a})]})}function pb({folder:e}){let t=X();if(!e)return null;let n={setting:t(`this setting`),env:t(`the CLAUDE_CONFIG_DIR variable of the web app`),default:t(`the default folder`)};return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsxs)(`p`,{children:[t(`Transcripts folder in use`),`: `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.root})]}),(0,H.jsxs)(`p`,{children:[t(`From`),`: `,n[e.source]]}),!e.exists&&(0,H.jsxs)(`p`,{role:`status`,className:`text-amber-600`,children:[t(`This folder does not exist. Claude Code capture and import will not work:`),` `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.root})]})]})}function mb(e,t){return`/api/settings/log?lines=200${e===`all`?``:`&level=${e}`}${t?`&filter=capture`:``}`}function hb(e){let t=/^\d{4}-(\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(e);return t?`${t[1]} ${t[2]}`:e}function gb(e){return e.map(e=>{let t=e.message.replace(/\s*\n\s*/g,` `);return`${e.time} ${e.level.toUpperCase()} ${t}${e.data?`: ${e.data}`:``}`}).join(`
125
+ `)}function _b(e){return e.scrollHeight-e.scrollTop-e.clientHeight<24}var vb={info:`info`,warn:`warning`,error:`destructive`};function yb({level:e,guessed:t}){let n=X(),r=(0,H.jsxs)(rd,{variant:vb[e],tabIndex:t?0:void 0,className:`w-14 justify-center`,children:[n(e),t&&(0,H.jsxs)(`span`,{className:`sr-only`,children:[`, `,n(`Level guessed from the message`)]})]});return t?(0,H.jsx)(Vp,{content:n(`Level guessed from the message`),children:r}):r}function bb({records:e,emptyText:t,label:n}){let r=(0,v.useRef)(null),i=(0,v.useRef)(!0);return(0,v.useLayoutEffect)(()=>{let e=r.current;e&&i.current&&(e.scrollTop=e.scrollHeight)},[e]),(0,H.jsx)(`div`,{ref:r,role:`log`,"aria-live":`off`,"aria-label":n,tabIndex:0,onScroll:()=>{r.current&&(i.current=_b(r.current))},className:`max-h-80 overflow-auto rounded-lg bg-background p-3 text-xs`,children:e.length===0?(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:t}):(0,H.jsx)(`ol`,{dir:`ltr`,className:`space-y-1.5 text-start`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-2 gap-y-1`,children:[(0,H.jsx)(`time`,{dateTime:e.time,title:e.time,className:`shrink-0 font-mono text-muted-foreground`,children:hb(e.time)}),(0,H.jsx)(yb,{level:e.level,guessed:e.guessed}),(0,H.jsxs)(`span`,{className:`min-w-0 basis-full break-words whitespace-pre-wrap sm:basis-0 sm:flex-1`,children:[e.message,e.data&&(0,H.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[` `,e.data]})]})]},e.seq))})})}var xb=5e3,Sb=[{level:`all`,label:`All`},{level:`warn`,label:`Warning`},{level:`error`,label:`Error`}];function Cb(e){let[t,n]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let t=e.current;if(!t)return;let r=!0,i=document.visibilityState===`visible`,a=()=>n(r&&i),o=typeof IntersectionObserver>`u`?void 0:new IntersectionObserver(([e])=>{r=e?.isIntersecting??!0,a()});o?.observe(t);let s=()=>{i=document.visibilityState===`visible`,a()};return document.addEventListener(`visibilitychange`,s),a(),()=>{o?.disconnect(),document.removeEventListener(`visibilitychange`,s)}},[e]),t}function wb(){let e=X(),t=(0,v.useRef)(null),n=(0,v.useRef)(0),[r,i]=(0,v.useState)(`all`),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),h=Cb(t),g=(0,v.useCallback)(async()=>{let e=++n.current;try{let t=await Y(mb(r,a));if(e!==n.current)return;u(t),f(``)}catch(t){e===n.current&&f(t.message)}},[r,a]);(0,v.useEffect)(()=>{if(s){n.current++;return}g()},[g,s]),(0,v.useEffect)(()=>{if(s||!h)return;let e=setInterval(()=>void g(),xb);return()=>clearInterval(e)},[s,h,g]);async function _(e){try{await navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3)}catch{m(!1)}}let y=l?.records??[],b=e(r===`all`&&!a?`No log has been written yet.`:`No matching log records.`);return(0,H.jsxs)(`section`,{ref:t,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Log`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Log`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[(0,H.jsx)(`div`,{role:`group`,"aria-label":e(`Level`),className:`flex gap-1.5`,children:Sb.map(t=>(0,H.jsx)(G,{type:`button`,size:`sm`,variant:r===t.level?`default`:`outline`,"aria-pressed":r===t.level,onClick:()=>i(t.level),children:e(t.label)},t.level))}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),` `,e(`Capture attempts only`)]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,"aria-pressed":s,onClick:()=>c(!s),children:e(s?`Resume`:`Pause`)}),(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void g(),children:e(`Refresh`)}),(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:y.length===0,onClick:()=>void _(gb(y)),children:e(`Copy visible records`)}),l&&(0,H.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void _(l.path),children:e(`Copy log path`)}),(0,H.jsx)(`span`,{role:`status`,className:`text-xs text-muted-foreground`,children:p?e(`Copied`):s?e(`Paused`):``})]}),(0,H.jsx)(`p`,{dir:`ltr`,className:`break-all text-start font-mono text-xs text-muted-foreground`,children:l?.path}),d&&(0,H.jsx)(`p`,{role:`alert`,children:d}),(0,H.jsx)(bb,{records:y,label:e(`Log lines`),emptyText:l?b:e(`Loading log…`)})]})}var Tb=[{code:`en`,name:`English`},{code:`id`,name:`Bahasa Indonesia`},{code:`zh`,name:`中文`},{code:`ja`,name:`日本語`},{code:`es`,name:`Español`},{code:`fr`,name:`Français`},{code:`de`,name:`Deutsch`},{code:`ru`,name:`Русский`},{code:`pt`,name:`Português`},{code:`ar`,name:`العربية`},{code:`ko`,name:`한국어`}];function Eb(e){return typeof e==`string`&&e?e:`auto`}function Db(e){let t=[...Tb];return e!==`auto`&&!t.some(t=>t.code===e)&&t.push({code:e}),t}function Ob({value:e,onChange:t,disabled:n}){let r=X();return(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsxs)(Er,{id:`capture-language`,className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,value:e,disabled:n,onChange:e=>t(e.target.value),children:[(0,H.jsx)(`option`,{value:`auto`,children:r(`Automatic`)}),Db(e).map(e=>(0,H.jsx)(`option`,{value:e.code,children:e.name??e.code},e.code))]})})}function kb(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=ey();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&i(t.message)});let r=ny(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function s(n){if(t){o(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{autoCaptureLanguage:n},revision:t.revision})}),i(e(`Saved. New memories use this language.`))}catch(e){i(e.message)}await ty(),o(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory language`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory language`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`The language that new memory summaries are written in. Automatic detects it from your prompt, but a Latin-script prompt under 100 characters counts as English.`)}),(0,H.jsx)(`label`,{className:`block space-y-1 text-sm`,htmlFor:`capture-language`,children:e(`Summary language`)}),(0,H.jsx)(Ob,{value:Eb(t?.settings.autoCaptureLanguage?.value),disabled:a||!t,onChange:e=>void s(e)}),r&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:r})]})}function Ab({theme:e}){let{canvas:t,elevated:n,text:r,textSecondary:i,accent:a,border:o}=e.colours;return(0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`flex h-9 w-14 shrink-0 flex-col justify-center gap-1 rounded-md border px-1.5`,style:{background:t,borderColor:o},children:[(0,H.jsx)(`span`,{className:`h-1.5 w-8 rounded-full`,style:{background:r}}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{background:i}}),(0,H.jsx)(`span`,{className:`size-2.5 rounded-full`,style:{background:a,boxShadow:`0 0 0 2px ${n}`}})]})]})}function jb({variant:e,selected:t,filter:n,inUse:r,onSelect:i}){let a=X(),o=a(e===`light`?`Light theme`:`Dark theme`),s=Vf(e).filter(e=>e.name.toLowerCase().includes(n));return(0,H.jsxs)(`fieldset`,{"aria-label":o,className:`flex min-w-0 flex-col gap-2`,children:[(0,H.jsxs)(`legend`,{className:`flex w-full items-center gap-2 pb-2`,children:[(0,H.jsx)(`span`,{className:`text-ui font-semibold`,children:o}),r?(0,H.jsx)(rd,{children:a(`On screen now`)}):null]}),s.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`No theme matches.`)}):(0,H.jsx)(`div`,{className:`relative flex max-h-80 min-w-0 flex-col overflow-y-auto rounded-[10px] border border-border p-1`,children:s.map(n=>{let r=n.id===t;return(0,H.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 transition-colors duration-150 hover:bg-interactive-hover has-[:checked]:bg-selection has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-[-2px] has-[:focus-visible]:outline-ring`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`theme-${e}`,value:n.id,checked:r,onChange:()=>i(n.id),className:`sr-only`}),(0,H.jsx)(Ab,{theme:n}),(0,H.jsx)(`bdi`,{className:`min-w-0 flex-1 truncate text-ui`,children:n.name}),Uf(n)?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(`Default`)}):null,r?(0,H.jsx)(ae,{"aria-hidden":`true`,className:`size-4 shrink-0 text-primary-label`}):null]},n.id)})})]})}var Mb=[{value:`system`,label:`System`,Icon:et},{value:`light`,label:`Light`,Icon:Nt},{value:`dark`,label:`Dark`,Icon:tt}],Nb={auto:`Automatic`,dmy:`Day month year`,mdy:`Month day year`,iso:`Year-month-day`},Pb={auto:`Automatic`,h23:`24-hour`,h12:`12-hour`};function Fb(){let e=X(),t=yp(),n=_p(),[r,i]=(0,v.useState)(``),a=r.trim().toLowerCase();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Theme`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`System follows your operating system and switches between the light and the dark theme. The choice stays in this browser.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`fieldset`,{"aria-label":e(`Theme mode`),className:`inline-flex rounded-[10px] border border-border p-0.5`,children:Mb.map(({value:n,label:r,Icon:i})=>(0,H.jsxs)(`label`,{className:`flex h-8 cursor-pointer items-center gap-1.5 rounded-md px-3 text-ui text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover has-[:checked]:bg-selection has-[:checked]:text-foreground has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`theme-mode`,value:n,checked:t.mode===n,onChange:()=>bp(n),className:`sr-only`}),(0,H.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),e(r)]},n))}),(0,H.jsx)(id,{type:`search`,"aria-label":e(`Filter themes`),placeholder:e(`Filter themes`),value:r,onChange:e=>i(e.target.value),className:`w-full sm:w-60`})]}),(0,H.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-x-6 gap-y-4 md:grid-cols-2`,children:[(0,H.jsx)(jb,{variant:`light`,selected:t.light,filter:a,inUse:n===`light`,onSelect:e=>xp(`light`,e)}),(0,H.jsx)(jb,{variant:`dark`,selected:t.dark,filter:a,inUse:n===`dark`,onSelect:e=>xp(`dark`,e)})]})]})}function Ib(){let e=X(),{dateFormat:t}=oa(),n=new Date;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Date and time`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`How dates and times show in this web app. The choice stays in this browser.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Date format`)}),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsx)(Er,{"aria-label":e(`Date format`),className:`w-full`,value:t.date,onChange:e=>Fi({date:e.target.value}),children:_i.map(r=>(0,H.jsx)(`option`,{value:r,children:`${e(Nb[r])} · ${nm(n,{...t,date:r})}`},r))})})]}),(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Time format`)}),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsx)(Er,{"aria-label":e(`Time format`),className:`w-full`,value:t.time,onChange:e=>Fi({time:e.target.value}),children:vi.map(r=>(0,H.jsx)(`option`,{value:r,children:`${e(Pb[r])} · ${em(n,{...t,time:r})}`},r))})})]})]})]})}function Lb(){let e=X();return(0,H.jsxs)(`section`,{className:`space-y-6 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Appearance`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Appearance`)}),(0,H.jsx)(Fb,{}),(0,H.jsx)(Ib,{})]})}async function Rb(e,t){try{let n=await fetch(e,{method:t?`POST`:`GET`,headers:{"x-omms-token":window.__OMMS_TOKEN__??``,...t?{"Content-Type":`application/json`}:{}},...t?{body:JSON.stringify(t)}:{}}),r=await n.json();return r.success?{ok:!0,code:r.code??`ok`,data:r.data,message:r.message}:{ok:!1,code:r.code??`error`,error:r.error??`Request failed (${n.status})`,...r.savedContent===void 0?{}:{savedContent:r.savedContent}}}catch(e){return{ok:!1,code:`network`,error:e instanceof Error?e.message:String(e)}}}var zb=(e,t)=>e?`path=${encodeURIComponent(e)}`:`name=${encodeURIComponent(t)}`,Bb={overview:()=>Rb(`/api/skills`),skill:(e,t,n)=>Rb(`/api/skills/skill?${zb(e,t)}${n?`&turnLimit=${n.limit}&turnOffset=${n.offset}`:``}`),activity:(e={days:30})=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));return Rb(`/api/skills/activity?${t}`)},history:(e,t,n)=>Rb(`/api/skills/history?${zb(e,t)}&limit=${n.limit}&offset=${n.offset}`),proposals:e=>Rb(e?`/api/skills/proposals?state=${e}`:`/api/skills/proposals`),proposal:e=>Rb(`/api/skills/proposals/${encodeURIComponent(e)}`),stats:()=>Rb(`/api/skills/stats`),draftImprovement:e=>Rb(`/api/skills/draft`,{skill:e}),draftNew:(e,t)=>Rb(`/api/skills/draft`,{idea:e,folder:t}),ideas:()=>Rb(`/api/skills/ideas`,{}),apply:e=>Rb(`/api/skills/apply`,{id:e}),reject:e=>Rb(`/api/skills/reject`,{id:e}),undo:e=>Rb(`/api/skills/undo`,{id:e}),setMode:(e,t)=>Rb(`/api/skills/mode`,{skillPath:e,mode:t}),deleteTurns:()=>Rb(`/api/skills/delete-turns`,{confirm:!0}),recordPast:()=>Rb(`/api/skills/record-past`,{})};function Vb(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function Hb(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.name.toLowerCase().includes(n)):e}function Ub(e){return e.state===`applied`&&e.appliedBy===`automatic`?`applied automatically`:e.state}function Wb(e){return e.filter(e=>e.state!==`pending`).sort((e,t)=>t.updatedAt-e.updatedAt)}function Gb(e){return e.split(`
126
+ `).map(e=>e.startsWith(`@@`)?{kind:`hunk`,text:e}:e.startsWith(`+`)?{kind:`add`,text:e}:e.startsWith(`-`)?{kind:`del`,text:e}:{kind:`ctx`,text:e})}function Kb(e){if(e.diff===null)return{added:e.content.trim()?e.content.split(`
127
+ `).length:0,removed:0};let t=Gb(e.diff);return{added:t.filter(e=>e.kind===`add`).length,removed:t.filter(e=>e.kind===`del`).length}}var qb=160;function Jb(e){let t=e.summary??``;return t.length>qb||t.split(`
128
+ `).length>2||!!e.diff||e.diff===null&&e.content.trim()!==``||e.evidenceTurnIds.length>0}var Yb=e=>e.toLocaleString(`en-US`);function Xb(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Zb(e,t){let n=t.trim();return n&&!e.includes(n)?[...e,n]:e}function Qb(e,t){return e.filter(e=>e!==t)}var $b=[`done`,`failed`,`cancelled`],ex=e=>$b.includes(e.state);function tx(e){return e.summary?.skillTurnsRecorded===void 0?(e.hosts??[]).reduce((e,t)=>e+(t.summary?.skillTurnsRecorded??0),0):e.summary.skillTurnsRecorded}function nx(e){let t=e.total??0;return t>0?Math.min(100,Math.floor((e.processed??0)*100/t)):0}var rx={info:{box:`border-status-info/25 bg-status-info/10`,icon:`text-status-info`,Icon:Be},warning:{box:`border-status-warning/25 bg-status-warning/10`,icon:`text-status-warning`,Icon:zt},danger:{box:`border-destructive/25 bg-destructive/10`,icon:`text-destructive-label`,Icon:it}};function ix({tone:e,children:t,className:n}){let{box:r,icon:i,Icon:a}=rx[e];return(0,H.jsxs)(`div`,{role:e===`danger`?`alert`:`note`,"data-tone":e,className:V(`flex min-w-0 items-start gap-2.5 rounded-xl border px-3 py-2.5 text-start text-sm`,r,n),children:[(0,H.jsx)(a,{className:V(`mt-0.5 size-4 shrink-0`,i),"aria-hidden":`true`}),(0,H.jsx)(`div`,{className:`min-w-0 space-y-1.5 text-foreground`,children:t})]})}function ax(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),s=(0,v.useRef)(!0),c=(0,v.useRef)(!1),l=(0,v.useRef)(e);l.current=e;let u=t?.id,d=!!t&&!ex(t);(0,v.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,v.useEffect)(()=>{if(!d)return;c.current=!0;let e=setInterval(()=>{Y(`/api/settings/imports/current`).then(e=>{!s.current||!e.job||e.job.id!==u||n(e.job)}).catch(e=>{s.current&&o(e.message)})},1e3);return()=>clearInterval(e)},[d,u]),(0,v.useEffect)(()=>{t&&ex(t)&&c.current&&(c.current=!1,l.current())},[t]);async function f(){if(r||d)return;i(!0),o(``);let e=await Bb.recordPast();if(s.current){if(i(!1),!e.ok){o(e.error);return}n(e.data.job)}}return{job:t,running:d,starting:r,error:a,start:f}}function ox({onEnd:e}){let{job:t,running:n,starting:r,error:i,start:a}=ax(e);return(0,H.jsx)(sx,{job:t,running:n,starting:r,error:i,onStart:()=>void a()})}function sx({job:e,running:t,starting:n,error:r,onStart:i}){let a=X(),o=e?nx(e):0;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:t||n,onClick:i,children:[(0,H.jsx)(St,{"aria-hidden":`true`}),a(`Record past turns`)]}),n?(0,H.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),a(`Finding past sessions…`)]}):null,t&&e?(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-label":a(`Record past turns`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${o}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[a(`Skill turns`),`: `,Yb(e.processed??0),` / `,Yb(e.total??0),` ·`,` `,o,`%`]})]}):null,e&&ex(e)?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.state===`done`?Vb(a(`Recorded {count} past turns.`),{count:Yb(tx(e))}):a(`Record past turns did not finish.`)}):null,r?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:r}):null]})}function cx(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(!0);(0,v.useEffect)(()=>{o.current=!0,Y(`/api/settings`).then(e=>{o.current&&t(e)}).catch(e=>{o.current&&r(e.message)});let e=ny(e=>{o.current&&t(e)});return()=>{o.current=!1,e()}},[]);async function s(t){if(!e)return n||`Settings are not loaded`;let r=null;return await ay(a,async()=>{try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:e.revision})})}catch(e){r=e.message}await ty()}),r}return{snapshot:e,loadError:n,busy:i,save:s}}function lx({label:e,checked:t,disabled:n,onChange:r}){return(0,H.jsxs)(`label`,{className:`flex min-w-0 items-start gap-2.5 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`mt-1 size-4 shrink-0`,checked:t,disabled:n,onChange:e=>r(e.target.checked)}),(0,H.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:e})]})}function ux(e){let t=X(),{recording:n,redact:r,stats:i,busy:a,confirm:o}=e;return(0,H.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Skill learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Skill learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Record agent turns so OMMS can rank your skills and draft improvements.`)}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(lx,{label:t(`Record agent turns`),checked:n,disabled:a,onChange:e.onRecording}),e.projectOff?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`A project config turns recording off for this project.`)}):null,n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ix,{tone:`warning`,children:(0,H.jsx)(`p`,{children:t(`OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.`)})}),(0,H.jsx)(ox,{onEnd:e.onRecordPastEnd})]}):null]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(lx,{label:t(`Remove private text and secrets`),checked:r,disabled:a,onChange:e.onRedact}),o===`redact`?(0,H.jsxs)(ix,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:t(`Stop removing private text and secrets?`)}),(0,H.jsx)(`p`,{children:t(`New turns will be stored as written.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,variant:`destructive`,size:`sm`,disabled:a,onClick:()=>e.onRedact(!1),children:t(`Turn off`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null,r?null:(0,H.jsx)(ix,{tone:`danger`,children:(0,H.jsx)(`p`,{children:t(`<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.`)})})]}),(0,H.jsxs)(`dl`,{className:`grid max-w-md grid-cols-2 gap-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`Recorded turns`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?Yb(i.turns):`…`})]}),(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`File size`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?Xb(i.fileSize):`…`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`sm`,disabled:a||!i||i.turns===0,onClick:()=>e.onConfirm(`delete`),children:[(0,H.jsx)(Lt,{"aria-hidden":`true`}),t(`Delete recorded turns`)]}),o===`delete`&&i?(0,H.jsxs)(ix,{tone:`danger`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:Vb(t(`Delete {count} recorded turns? This cannot be undone.`),{count:Yb(i.turns)})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,variant:`destructive`,size:`sm`,onClick:e.onDeleteTurns,children:t(`Delete`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null]}),e.message?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.message}):null,e.failure?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:e.failure}):null]})}function dx(){let e=X(),{snapshot:t,loadError:n,busy:r,save:i}=cx(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(null),p=(0,v.useCallback)(async()=>{let e=await Bb.stats();e.ok&&o(e.data)},[]);(0,v.useEffect)(()=>{p()},[p]);let m=t?.settings.skillLearning;async function h(t){c(``),u(``),f(null);let n=await i(t);n?u(n):c(e(`Saved.`)),await p()}async function g(){f(null),u(``);let t=await Bb.deleteTurns();t.ok?c(Vb(e(`Deleted {count} recorded turns.`),{count:Yb(t.data.deleted)})):u(t.error),await p()}return(0,H.jsx)(ux,{recording:m?.globalValue===!0,redact:t?.settings.skillLearningRedact?.globalValue!==!1,projectOff:m?.source===`project`&&m.value===!1,stats:a,busy:r||!t,confirm:d,message:s,failure:l||n,onRecording:e=>void h({skillLearning:e}),onRedact:e=>{e||d===`redact`?h({skillLearningRedact:e}):f(`redact`)},onConfirm:f,onDeleteTurns:()=>void g(),onRecordPastEnd:()=>void p()})}var fx={"settings-section-external-api":_y,"settings-section-models":my,"settings-section-embedding":Iy,"settings-section-keys":Zy,"settings-section-diagnostics":ob,"settings-section-health":sb,"settings-section-claude-folder":fb,"settings-section-capture-language":kb,"settings-section-appearance":Lb,"settings-section-profiles":Qy,"settings-section-web-app":cb,"settings-section-skill-learning":dx,"settings-section-log":wb};function px(){return(0,v.useEffect)(()=>{of(window.location.hash,document)},[]),(0,H.jsx)(`div`,{className:`settings-view space-y-6`,children:Yv.map(({id:e})=>{let t=fx[e];return(0,H.jsx)(`div`,{id:e,className:`scroll-mt-20 md:scroll-mt-4`,children:(0,H.jsx)(t,{})},e)})})}function mx(e,t){return t?t.target:e.suggestion?.kind===`map`?e.suggestion.target:``}function hx(e,t){let n=new Map,r=new Map,i=[];for(let a of e){let e=t[a.directory],o=mx(a,e).trim();if(a.directory!==``&&o){let t=e||a.suggestion?.kind!==`map`?`exact`:a.suggestion.confidence,r=(n.get(a.directory)?.sessions??0)+a.sessions;n.set(a.directory,{from:a.directory,to:o,sessions:r,confidence:t})}else if(a.directory!==``&&!e&&a.suggestion?.kind===`ignore`){let e=(r.get(a.directory)?.sessions??0)+a.sessions;r.set(a.directory,{directory:a.directory,sessions:e,reason:a.suggestion.reason})}else i.push({...a})}return{maps:[...n.values()],ignores:[...r.values()],unmapped:i}}function gx(e){return new Set([...e.maps.filter(e=>e.confidence!==`guess`).map(e=>e.from),...e.ignores.map(e=>e.directory)])}function _x(e,t,n,r){let i={},a=n.maps.filter(e=>r.has(e.from));if(a.length){let t=new Map(e.map(e=>[e.from,{...e}]));for(let e of a)t.set(e.from,{from:e.from,to:e.to});i.importPathMaps=[...t.values()]}let o=n.ignores.filter(e=>r.has(e.directory));return o.length&&(i.importIgnoredDirectories=[...new Set([...t,...o.map(e=>e.directory)])]),i}function vx(e){let t=new Map;for(let n of e)t.set(n.to,[...t.get(n.to)??[],n]);return[...t].map(([e,t])=>({target:e,maps:t.sort((e,t)=>e.from.localeCompare(t.from))})).sort((e,t)=>t.maps.length-e.maps.length||e.target.localeCompare(t.target))}function yx(e){return e.filter(e=>e.directory!==``)}function bx(e,t){return[...new Set([...e,...yx(t).map(e=>e.directory)])]}function xx(e,t){return e(t===`exact`?`Exact`:t===`name`?`Name match`:`Guess`)}function Sx(e,t){return e(t===`temporary`?`Temporary folder`:t===`node_modules`?`node_modules folder`:t===`app-data`?`App data folder`:`Skills folder`)}function Cx({host:e,rows:t,decisions:n,busy:r,onDecide:i,onResolve:a,onIgnore:o,onIgnoreAll:s,open:c}){let l=X(),u=t.filter(e=>e.directory!==``),d=u.filter(e=>mx(e,n[e.directory]).trim()).length;return(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{id:`directory-maps-${e}`,className:`scroll-mt-20 cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsxs)(`h3`,{className:`inline text-subsection-title font-semibold`,children:[Jd(e),`: `,l(`Unresolved directories`)]}),(0,H.jsxs)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:[l(`Directories`),`: `,u.length,` · `,l(`Unresolved sessions`),`:`,` `,t.reduce((e,t)=>e+t.sessions,0),` · `,l(`Rows with a target`),`:`,` `,d]})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[t.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`No unresolved directories in the latest run.`)}):(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`[&_button]:h-auto [&_button]:min-h-8 [&_button]:whitespace-normal [&_button]:py-1.5`,children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:r||u.length===0,onClick:a,children:l(`Smart resolve directories`)}),s&&u.length>0&&(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,className:`ms-2`,disabled:r,onClick:s,children:l(`Ignore all`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.`)})]}),t.map(e=>{if(e.directory===``)return(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[l(`No directory recorded`),` ·`,` `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,` ·`,` `,l(`These sessions cannot be mapped.`)]},`no-directory`);let t=n[e.directory],a=mx(e,t),s=!t&&e.suggestion?.kind===`ignore`?e.suggestion:null;return(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsxs)(`details`,{className:`min-w-0 flex-1`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.directory}),` `,`· `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,(0,H.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:s?(0,H.jsxs)(H.Fragment,{children:[l(`Suggested to ignore`),`: `,Sx(l,s.reason)]}):(0,H.jsxs)(H.Fragment,{children:[l(`Target directory`),`:`,` `,a?(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:a}):l(`No target chosen`)]})})]}),(0,H.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[!e.suggestion&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`No suggestion found.`)}),(0,H.jsx)(id,{"aria-label":`${e.directory} ${l(`Target directory`)}`,dir:`ltr`,placeholder:l(`Target directory`),value:a,disabled:r,onChange:t=>i(e,t.target.value)})]})]}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,"aria-label":`${l(`Ignore`)} ${e.directory}`,disabled:r,onClick:()=>o(e),children:l(`Ignore`)})]},e.directory)})]})]})}function wx({host:e,review:t,busy:n,canConfirm:r,onRefresh:i,error:a,onClose:o,onConfirm:s}){let c=X(),[l,u]=(0,v.useState)(()=>({review:t,ticked:gx(t)})),d=l.review===t?l.ticked:gx(t),f=(e,n)=>u(r=>{let i=new Set(r.review===t?r.ticked:gx(t));return n?i.add(e):i.delete(e),{review:t,ticked:i}}),p=[...t.maps.map(e=>e.from),...t.ignores.map(e=>e.directory)],m=p.filter(e=>d.has(e)).length,h=e=>(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[c(`Sessions`),`: `,e]});return(0,H.jsx)(K,{open:!0,onOpenChange:e=>{!e&&!n&&o()},children:(0,H.jsxs)(q,{className:`sm:max-w-2xl flex flex-col overflow-hidden`,showCloseButton:!n,onEscapeKeyDown:e=>{n&&e.preventDefault()},onInteractOutside:e=>{n&&e.preventDefault()},children:[(0,H.jsxs)(Vl,{children:[(0,H.jsxs)(Ul,{children:[c(`Review directory maps`),`: `,Jd(e)]}),(0,H.jsx)(Wl,{children:c(`Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.`)})]}),(0,H.jsxs)(`div`,{className:`min-h-0 overflow-y-auto space-y-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm`,children:[c(`Proposed maps`),`: `,t.maps.length,` · `,c(`Suggested to ignore`),`:`,` `,t.ignores.length,` · `,c(`No target`),`: `,t.unmapped.length]}),!p.length&&(0,H.jsx)(`p`,{className:`text-sm`,children:c(`Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.`)}),t.maps.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Proposed maps`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Save this map`)} ${e.from}`,checked:d.has(e.from),disabled:n,onChange:t=>f(e.from,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.from}),(0,H.jsxs)(`div`,{className:`mt-1`,children:[c(`Target directory`),`:`,` `,(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.to})]}),(0,H.jsxs)(`div`,{className:`text-xs`,children:[c(`Confidence`),`: `,xx(c,e.confidence)]}),h(e.sessions)]})]},e.from))})]}),t.ignores.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Suggested to ignore`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.ignores.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Ignore`)} ${e.directory}`,checked:d.has(e.directory),disabled:n,onChange:t=>f(e.directory,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{className:`mt-1`,children:Sx(c,e.reason)}),h(e.sessions)]})]},e.directory))})]}),t.unmapped.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`No target`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.unmapped.map((e,t)=>(0,H.jsxs)(`li`,{className:`min-w-0 border-t border-border pt-2 text-sm`,children:[e.directory===``?c(`No directory recorded`):(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{children:e.directory===``?c(`These sessions cannot be mapped.`):c(`No target chosen`)}),h(e.sessions)]},`${e.directory}-${t}`))})]})]}),a&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:n,onClick:o,children:c(`Cancel`)}),!r&&(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:c(`Refresh list`)}),(0,H.jsx)(G,{type:`button`,disabled:n||!r||m===0,onClick:()=>s(new Set(p.filter(e=>d.has(e)))),children:c(n?`Saving…`:`Confirm`)})]})]})})}function Tx({host:e,rows:t,busy:n,onConfirm:r,onCancel:i}){let a=X(),o=t.reduce((e,t)=>e+t.sessions,0);return(0,H.jsx)(K,{open:!0,onOpenChange:e=>!e&&!n&&i(),children:(0,H.jsxs)(q,{className:`sm:max-w-xl`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:`${a(`Ignore all`)}: ${Jd(e)}`}),(0,H.jsx)(Wl,{children:`${a(`These directories stay unimported and leave the unresolved counts.`)} ${a(`Directories`)}: ${t.length} · ${a(`Sessions`)}: ${o}`})]}),(0,H.jsx)(`ul`,{className:`max-h-64 space-y-1 overflow-y-auto text-sm`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e.directory}),(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sessions})]},e.directory))}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:a(`Cancel`)}),(0,H.jsx)(G,{type:`button`,disabled:n,onClick:r,children:a(`Ignore all`)})]})]})})}var Ex=[`pi`,`opencode`,`claude-code`];function Dx({hosts:e=Ex,saved:t=!0,title:n,anchorId:r}={}){let i=X(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(new Set),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(),E=(0,v.useRef)(!1),D=(0,v.useRef)(void 0),O=()=>Y(`/api/settings/import-maps`).then(e=>{u(e),f(new Set),m({})}).catch(e=>g(e.message));(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>{e&&(D.current=t.revision,c(t))}).catch(t=>{e&&g(t.message)}),O();let t=ny(t=>{if(!e)return;let n=t;c(n),n.revision!==D.current&&(D.current=n.revision,Y(`/api/settings/import-maps`).then(t=>{e&&D.current===n.revision&&u(t)}).catch(()=>{}))});return()=>{e=!1,t()}},[]);function k(e,t){E.current||w||(C(``),x({host:e,review:hx(t,p)}))}function A(e,t){m(n=>({...n,[e.directory]:{directory:e.directory,target:t}}))}let j=()=>s?.settings?.importPathMaps?.globalValue??l?.saved??[],M=()=>l?.ignored??[];async function N(e,t,n){if(!s||!l||E.current||w)return!E.current&&!w&&g(`The list is still loading. Try again in a moment.`),!1;E.current=!0,y(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:s.revision})})}catch(e){let t=e instanceof Xv&&e.status===409;try{if(!t)return g(n),await ty(),!1;g(`Settings changed elsewhere. Check the list and try again.`);try{await te()}catch{T(`conflict`),g(`Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.`)}return!1}finally{E.current=!1,y(!1)}}g(t);try{await te()}catch{T(`saved`),g(`Saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}return!0}function P(){N({importPathMaps:fy(l?.saved??[],d)},`Saved. Removed maps stop applying at the next import or backfill run.`,`Removals could not be saved. Try again.`).then(e=>{e&&f(new Set)})}function ee(e){N({importIgnoredDirectories:[...new Set([...M(),e.directory])]},`Ignored. The directory stays unimported.`,`The directory could not be ignored. Try again.`)}function F(){if(!a)return;let{rows:e}=a;N({importIgnoredDirectories:bx(M(),e)},`Ignored. The directories stay unimported.`,`The directories could not be ignored. Try again.`).then(e=>{e&&o(void 0)})}function I(e){N({importIgnoredDirectories:M().filter(t=>t!==e)},`Restored. The directory shows again in each host list that reported it.`,`The directory could not be restored. Try again.`)}async function te(){let[e,t]=await Promise.all([Y(`/api/settings`),Y(`/api/settings/import-maps`)]);D.current=e.revision,$v(e),u(t),T(void 0)}async function L(){if(E.current)return;E.current=!0,y(!0);let e=w===`saved`;try{await te(),e?g(`Saved. Maps apply to the next import or backfill run.`):b?C(`Settings changed elsewhere. Review these maps and confirm again.`):g(`Settings refreshed. No maps were saved.`)}catch{e?g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`):b?C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`):g(`Settings could not be refreshed. Try Refresh list again.`)}finally{E.current=!1,y(!1)}}async function ne(e){if(!s||!l||!b||E.current||w)return;let t=_x(j(),M(),b.review,e);if(!t.importPathMaps&&!t.importIgnoredDirectories)return;E.current=!0,y(!0),C(``);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:s.revision})})}catch(e){let t=e instanceof Xv&&e.status===409;if(C(t?`Settings changed elsewhere. Review these maps and confirm again.`:`Maps could not be saved. Review the targets and confirm again.`),t)try{await te()}catch{T(`conflict`),C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`)}E.current=!1,y(!1);return}let n=new Set(e);m(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))),f(e=>new Set([...e].filter(e=>!n.has(e)))),u(e=>e&&{...e,saved:t.importPathMaps??e.saved,ignored:t.importIgnoredDirectories??e.ignored}),x(void 0);let r=b.review.maps.filter(t=>e.has(t.from)).length,a=b.review.ignores.filter(t=>e.has(t.directory)).length;g(`${i(`Saved maps`)}: ${r} · ${i(`Ignored directories`)}: ${a}. ${i(`They apply to the next import or backfill run. No sessions were imported.`)}`);try{await te()}catch{T(`saved`),g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}}return(0,H.jsxs)(`section`,{id:r??`directory-maps`,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":i(n??`Resolve missing project folders`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:i(n??`Resolve missing project folders`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.`)}),t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Saved maps`)}),` ·`,` `,l?.saved.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Saved maps apply to every host.`)})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:_||!!w||!s||!l||d.size===0,onClick:P,children:i(`Save removals`)}),!l?.saved.length&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`none`)}),vx(l?.saved??[]).map(e=>(0,H.jsxs)(`details`,{className:`min-w-0 border-t border-border pt-2`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded text-sm focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.target}),` `,`· `,e.maps.length]}),(0,H.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:e.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all ${d.has(e.from)?`line-through`:``}`,children:e.from}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${d.has(e.from)?i(`Keep`):i(`Remove`)} ${e.from}`,disabled:_,onClick:()=>f(t=>{let n=new Set(t);return n.has(e.from)?n.delete(e.from):n.add(e.from),n}),children:d.has(e.from)?i(`Keep`):i(`Remove`)})]},e.from))})]},e.target))]})]}),(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Ignored directories`)}),` `,`· `,l?.ignored?.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Ignored directories stay unimported and leave the unresolved counts.`)})]}),(0,H.jsxs)(`ul`,{className:`mt-3 space-y-1 text-sm`,children:[!l?.ignored?.length&&(0,H.jsx)(`li`,{className:`text-muted-foreground`,children:i(`none`)}),l?.ignored?.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${i(`Restore`)} ${e}`,disabled:_||!!w||!s,onClick:()=>I(e),children:i(`Restore`)})]},e))]})]})]}),e.map(t=>{let n=l?.[t]??[];return(0,H.jsx)(Cx,{host:t,rows:n,decisions:p,busy:_||!!w||!s||!l,onDecide:A,onResolve:()=>k(t,n),onIgnore:ee,onIgnoreAll:()=>o({host:t,rows:yx(n)}),open:e.length===1},t)}),a&&(0,H.jsx)(Tx,{host:a.host,rows:a.rows,busy:_,onConfirm:F,onCancel:()=>o(void 0)}),b&&(0,H.jsx)(wx,{host:b.host,review:b.review,busy:_,canConfirm:!w,error:i(S),onRefresh:()=>void L(),onClose:()=>{E.current||x(void 0)},onConfirm:e=>void ne(e)}),w&&!b&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:_,onClick:()=>void L(),children:i(`Refresh list`)}),h&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i(h)})]})}function Ox(e){return!e||e.total<=0?null:{percent:e.percent,done:`${e.done.toLocaleString(`en-US`)} / ${e.total.toLocaleString(`en-US`)}`,minutesLeft:e.minutesLeft===null?`unknown`:`about ${e.minutesLeft}`}}function kx(e,t){return e??!t}function Ax(e,t){let n=t.indexOf(`/`);if(t!==`inherit`&&t!==`external`&&(n<1||n===t.length-1))throw Error(`Enter a model as provider/model.`);return{[`${e}BackfillModel`]:t}}function jx(e,t){if(t?.state===`running`)return t.phase===`profile`?{kind:`learning-profile`,done:t.profileDone??0,total:t.profileTotal??0}:{kind:`running`};if(t?.paused)return{kind:`paused`};if(t?.state===`failed`&&(t.updatedAt??t.startedAt??0)>=(e?.updatedAt??0))return{kind:`failed`,error:t.error??e?.error??null};if(!e||e.state===`not-started`)return t?.state===`done`?{kind:`imported`}:{kind:`not-started`};let n=t?.state===`done`&&(e.counts.failed??0)>0;return e.state===`failed`&&!n?{kind:`failed`,error:e.error}:e.state===`running`?{kind:`running`}:e.counts.pending>0?{kind:`stopped`,pending:e.counts.pending}:e.counts.unresolved>0?{kind:`partly`,unresolved:e.counts.unresolved}:{kind:`imported`}}function Mx(e){return e?.state===`running`&&e.phase!==`profile`}function Nx(e){return!e||e.state===`running`||!e.state||!e.updatedAt||!e.surface?null:{finishedAt:e.updatedAt,surface:e.surface,imported:e.imported??0,skipped:e.skipped??0,failed:e.failed??0,state:e.state}}function Px({host:e,backfill:t}){let n=X(),{snapshot:r,lists:i,busy:a}=t,[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(),u=r?.settings??{},d=String(u[`${e}BackfillModel`]?.globalValue??`inherit`),f=o??d,p=i[e]?.models??[],m=kx(c,f===`inherit`||f===`external`||p.some(e=>`${e.provider}/${e.model}`===f)),h=ly({memoryProvider:u.memoryProvider?.globalValue,memoryModel:u.memoryModel?.globalValue,memoryApiUrl:u.memoryApiUrl?.globalValue,keySet:!!r?.secrets?.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":`${Jd(e)} ${n(`settings`)}`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:`${Jd(e)} ${n(`settings`)}`}),e===`claude-code`?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Claude Code backfill always uses the external API. It has no backfill model setting.`)}):(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[n(`Backfill model`),(0,H.jsx)(`div`,{dir:`ltr`,children:(0,H.jsxs)(Er,{"aria-label":`${Jd(e)} ${n(`Backfill model`)}`,className:`mt-1 block w-full`,value:m?`typed`:f,onChange:e=>{l(e.target.value===`typed`),s(e.target.value)},children:[(0,H.jsx)(`option`,{value:`inherit`,children:n(`Same as live capture`)}),(0,H.jsx)(`option`,{value:`external`,disabled:h.length>0,children:n(`External API`)}),p.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:n(`Manual provider/model`)})]})})]}),m&&(0,H.jsx)(`input`,{"aria-label":`${Jd(e)} ${n(`Manual provider/model`)}`,className:`w-full rounded-[10px] border border-border bg-card p-2`,dir:`ltr`,placeholder:`provider/model`,value:f===`typed`?``:f,onChange:e=>s(e.target.value)}),h.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n(`External API needs`),`: `,h.join(`, `)]}),i[e]?.available===!1&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i[e].reason?n(i[e].reason):n(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:a||!r,onClick:()=>t.saveModel(e,f),children:n(`Save model`)})]}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!u.autoBackfill?.globalValue,disabled:a||!r,onChange:e=>void t.save({autoBackfill:e.target.checked})}),n(`Import past chats automatically`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`This switch applies to every host. Automatic import makes model calls.`)})]})}var Fx={pi:{kind:`default`},opencode:{kind:`default`},"claude-code":{kind:`default`}},Ix=Fx,Lx=!1,Rx=new Set,zx=e=>{Ix=e;for(let e of Rx)e()},Bx=e=>(Rx.add(e),()=>Rx.delete(e));async function Vx(e,t){let n=await Y(e,t);zx({...Fx,...n.hosts})}function Hx(){let e=(0,v.useSyncExternalStore)(Bx,()=>Ix,()=>Fx);return(0,v.useEffect)(()=>{Lx||(Lx=!0,Vx(`/api/host-appearance`).catch(()=>{Lx=!1}))},[]),{looks:e,setIcon:(e,t)=>Vx(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`icon`,icon:t})}),setImage:(e,t)=>Vx(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`image`,png:t})}),reset:e=>Vx(`/api/host-appearance/${e}`,{method:`DELETE`})}}var Ux={anchor:j,atom:F,bird:I,"book-open":te,bot:L,braces:ne,brain:re,bug:R,cat:ie,cloud:pe,code:me,command:he,compass:ge,cpu:ve,database:ye,dog:be,feather:Ce,"file-code":we,fish:Te,flame:Ee,flower:De,folder:Ae,gem:je,ghost:Me,"git-branch":Ne,globe:Fe,hash:Ie,heart:Le,infinity:ze,key:Ve,layers:He,leaf:Ue,library:We,lightbulb:Ge,link:Ke,"message-square":Ze,moon:tt,mountain:nt,network:rt,orbit:ot,package:st,"pen-tool":dt,plug:gt,puzzle:yt,rocket:xt,server:Et,settings:Dt,shield:Ot,sparkles:kt,"square-terminal":jt,star:Mt,sun:Nt,target:Ft,terminal:It,"wand-sparkles":Ut,wrench:Gt,zap:qt},Wx=Object.keys(Ux),Gx={pi:`Pi`,opencode:`OC`,"claude-code":`CC`};function Kx({host:e,look:t,className:n}){let r=V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border`,n);if(t.kind===`image`)return(0,H.jsx)(`span`,{className:V(r,`border-border bg-muted`),"aria-hidden":`true`,children:(0,H.jsx)(`img`,{src:t.image,alt:``,className:`size-full object-cover`})});let i=t.kind===`icon`?Ux[t.icon]:void 0,a=ed(e);return(0,H.jsx)(`span`,{className:V(r,`text-ui font-semibold [color:oklch(0.42_0.13_var(--host-hue))] dark:[color:oklch(0.8_0.13_var(--host-hue))]`),style:{backgroundColor:`oklch(0.72 0.14 ${a} / 0.18)`,borderColor:`oklch(0.72 0.14 ${a} / 0.45)`,"--host-hue":String(a)},"aria-hidden":`true`,children:i?(0,H.jsx)(i,{className:`size-5`}):Gx[e]})}function qx({className:e,iconClassName:t=`size-5`}){return(0,H.jsx)(`span`,{"aria-hidden":`true`,className:V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border border-border bg-muted text-muted-foreground`,e),children:(0,H.jsx)(He,{className:t})})}function Jx({host:e,run:t,row:n}){let r=X(),i=Mx(t)?Ox(t):null,a=Nx(t),o=jx(n,t),s=`${ld(e)}#host-unresolved`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[o.kind===`learning-profile`&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`All exchanges are done. Learning the profile from the imported prompts`),`:`,` `,o.done,` / `,o.total,` `,r(`batches`)]}),i&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i.percent,"aria-label":r(`Import progress`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${i.percent}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[i.percent,`% · `,i.done,` · `,r(`Minutes left`),`:`,` `,i.minutesLeft===`unknown`?r(`unknown`):i.minutesLeft.replace(`about`,r(`about`))]})]}),t?.state===`running`&&t.surface&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:r(`started from ${t.surface}`)}),a&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`Last run`),`: `,Zp(a.finishedAt),` · `,r(`started from ${a.surface}`),` `,`· `,r(a.state),` · `,r(`Imported`),`: `,a.imported,` · `,r(`Skipped`),`:`,` `,a.skipped,` · `,r(`Failed`),`: `,a.failed]}),n&&(0,H.jsxs)(`div`,{className:`space-y-1 text-muted-foreground`,children:[!a&&(0,H.jsxs)(`p`,{children:[r(`Imported`),`: `,n.counts.imported,` · `,r(`Skipped`),`: `,n.counts.skipped,` ·`,` `,r(`Failed`),`: `,n.counts.failed]}),(0,H.jsxs)(`p`,{children:[r(`Pending`),`: `,n.counts.pending,` · `,r(`Unresolved sessions`),`:`,` `,n.counts.unresolved,n.counts.unresolved>0&&(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`a`,{className:`underline focus-visible:outline-2 focus-visible:outline-ring`,href:s,"aria-label":`${Jd(e)}: ${r(`Resolve missing project folders`)}`,onClick:e=>{e.preventDefault(),gf(s)},children:r(`Resolve missing project folders`)})]})]}),(0,H.jsxs)(`p`,{children:[r(`Model`),`: `,(0,H.jsx)(`bdi`,{dir:`ltr`,children:n.model??r(`none`)})]}),(0,H.jsxs)(`p`,{children:[r(`Cutoff`),`: `,Zp(n.cutoff)]}),n.error&&(0,H.jsx)(`p`,{role:`alert`,children:n.error})]})]})}function Yx(e){let{run:t,runNowUnavailable:n}=e,r=n===null,i=n!==null&&e.host!==`claude-code`,a={text:`{reason}`,params:{reason:n??``}},o=(e,t,n,r=!0)=>({state:e,action:{kind:t,enabled:r},sentence:n,offerExternal:!1});if(!e.setUp)return o(`not-set-up`,`setup`,{text:`This host is not set up on this machine.`});if(t?.state===`running`){if(t.paused)return o(`running`,`pause`,{text:`Pausing after the current exchange.`},!1);let e=t.minutesLeft;return o(`running`,`pause`,{text:e===null?`Importing {done} / {total}.`:`Importing {done} / {total}. About {minutes} min left.`,params:{done:t.done,total:t.total,...e===null?{}:{minutes:e}}})}if(t?.paused)return{...o(`paused`,`resume`,r?{text:`Paused. Resume to continue.`}:a,r),offerExternal:i};if(t?.state===`failed`)return{...o(`failed`,`retry`,r?{text:`Stopped: {error}`,params:{error:t.error??`unknown error`}}:a,r),offerExternal:i};if(!r||t?.state===`stopped`&&e.pending>0)return{...o(`stopped`,`resume`,r?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:a,r),offerExternal:i};let s=t?.state===`done`&&t.total===0,c;return c=s&&e.cutoff!==null?{text:`Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.`,params:{date:e.formatDate(e.cutoff)}}:e.pending>0?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:{text:`Automatic import is on. Nothing is waiting.`},o(`running`,`pause`,c)}function Xx(e){let{run:t}=e;if(!e.setUp)return{text:`Not set up`};if(t?.state===`running`)return{text:`Importing · {percent}%`,params:{percent:t.percent}};if(t?.paused)return{text:`Paused · {pending} pending`,params:{pending:e.pending}};if(t?.state===`failed`)return{text:`Failed`};if(e.runNowUnavailable!==null||t?.state===`stopped`&&e.pending>0)return{text:`Stopped · {pending} pending`,params:{pending:e.pending}};let n=t?.updatedAt&&t.state===`done`?e.formatDate(t.updatedAt):null,r=e.lastSaved===null?null:e.formatSaved(e.lastSaved);return n&&r?{text:`Running · history imported {date} · last saved {when}`,params:{date:n,when:r}}:n?{text:`Running · history imported {date}`,params:{date:n}}:r?{text:`Running · last saved {when}`,params:{when:r}}:{text:`Running`}}function Zx(e,t){let n=e(t.text);return Object.entries(t.params??{}).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),n)}var Qx={pi:`https://github.com/cmdaltctr/omms/blob/main/docs/pi-adapter.md`,opencode:`https://github.com/cmdaltctr/omms/blob/main/docs/opencode-adapter.md`,"claude-code":`https://github.com/cmdaltctr/omms/blob/main/docs/claude-code-adapter.md`},$x={"not-set-up":`Not set up`,running:`Running`,paused:`Paused`,failed:`Failed`,stopped:`Stopped`};function eS({host:e,statuses:t}){let n=X(),{looks:r}=Hx(),{backfill:i}=t,a=t.status(e),o=i.rows[e],s=i.runs?.[e]?.run??null,c=()=>{let t=a.action.kind;t===`pause`?i.control(e,`pause`):t===`resume`?i.control(e,`resume`):t===`retry`&&i.control(e,`run`)},l={setup:n(`How to set up`),pause:n(`Pause`),resume:n(`Resume`),retry:n(`Retry`)},u={pause:ut,resume:ht,retry:wt,setup:Se}[a.action.kind];return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":Jd(e),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Kx,{host:e,look:r[e]}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:Jd(e)}),(0,H.jsxs)(`p`,{className:V(`text-sm`,a.state===`failed`?`text-destructive-label`:`text-muted-foreground`),children:[n(`State`),`: `,n($x[a.state])]})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[a.action.kind===`setup`?(0,H.jsx)(G,{asChild:!0,variant:`outline`,children:(0,H.jsxs)(`a`,{href:Qx[e],target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(Se,{"aria-hidden":`true`}),l.setup]})}):(0,H.jsxs)(G,{type:`button`,disabled:i.busy||!a.action.enabled,onClick:c,children:[(0,H.jsx)(u,{"aria-hidden":`true`}),l[a.action.kind]]}),a.offerExternal&&(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:i.busy,onClick:()=>i.saveModel(e,`external`),children:n(`Use external API`)})]}),(0,H.jsx)(`p`,{className:`break-words text-sm text-muted-foreground`,role:`status`,children:Zx(n,a.sentence)}),a.state!==`not-set-up`&&(0,H.jsx)(Jx,{host:e,run:s,row:o}),i.message&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i.message}),a.action.kind!==`setup`&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Importing makes model calls and can cost money.`)})]})}function tS(e,t,n){let r=!n&&e!==null&&e.revision===t.revision;return{page:r?{...t,listedAt:e.listedAt}:t,sameListing:r}}function nS(e,t){let n=0;return async r=>{let i=++n;try{let t=await r;i===n&&e(t)}catch(e){i===n&&t?.(e)}}}function rS(e){let t=document.getElementById(`directory-maps-${e}`),n=t?.parentElement;if(!t||!n){typeof window<`u`&&window.location&&gf(`${J.memory}#directory-maps-${e}`);return}n.open=!0,t.focus({preventScroll:!0}),t.scrollIntoView?.(rf)}function iS({badge:e,host:t}){let n=X(),[r,i]=(()=>{switch(e.kind){case`imported`:return[`${n(`Imported`)} ✅`,`border-green-600/40 text-green-700`];case`partly`:return[`${n(`Partly imported`)} (${e.unresolved} ${n(`unresolved`)})`,`border-amber-500/50 text-amber-700`];case`running`:return[n(`Running`),`border-primary/50 text-primary`];case`learning-profile`:return[`${n(`Learning profile`)} ${e.done} / ${e.total}`,`border-primary/50 text-primary`];case`paused`:return[n(`Paused`),`border-border text-muted-foreground`];case`stopped`:return[`${n(`Stopped`)} (${e.pending} ${n(`pending`)})`,`border-amber-500/50 text-amber-700`];case`failed`:return[`${n(`Failed`)} ⛔️`,`border-red-600/40 text-red-700`];case`not-started`:return[n(`Not started`),`border-border text-muted-foreground`]}})(),a=V(`inline-block rounded-full border px-2 py-0.5 text-xs font-medium`,i);return e.kind===`partly`?(0,H.jsx)(`a`,{href:`/memory#directory-maps-${t}`,onClick:e=>{e.preventDefault(),rS(t)},"aria-label":`${Jd(t)}: ${n(`Resolve missing project folders`)}. ${r}`,className:V(a,`underline focus-visible:outline-2 focus-visible:outline-ring`),children:r}):(0,H.jsx)(`span`,{className:a,title:e.kind===`failed`&&e.error?e.error:void 0,children:r})}var aS=[`pi`,`opencode`,`claude-code`];function oS(){let e=X(),[t,n]=(0,v.useState)({}),[r,i]=(0,v.useState)({});return(0,v.useEffect)(()=>{let e=nS(n),t=nS(i),r=()=>{e(Y(`/api/settings/backfill`)),t(Y(`/api/settings/backfill/runs`))};r();let a=setInterval(r,1e4),o=ny(r);return()=>{clearInterval(a),o()}},[]),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,"aria-label":e(`Import status`),children:aS.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:Jd(e)}),(0,H.jsx)(iS,{host:e,badge:jx(t[e]??null,r[e]?.run??null)})]},e))})}function sS(e){let t=X(),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),f=`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`;async function p(t){try{let n=await Y(`/api/settings/imports/sources/validate`,{method:`POST`,body:JSON.stringify({host:e.host,path:t})});a(n),r(n.displayPath),e.onChoose(n),d(``)}catch(e){d(e.message)}}async function m(t){try{let n=await Y(`/api/settings/imports/sources/browse`,{method:`POST`,body:JSON.stringify({host:e.host,...t?{path:t}:{}})});s(n),d(``)}catch(e){let t=e.message;/loopback/i.test(t)&&l(!0),d(t)}}function h(){a(null),r(``),s(null),e.onChoose(null)}return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[e.host===`pi`?t(`Pi sessions folder or one .jsonl session file`):e.host===`claude-code`?t(`Claude Code transcripts folder`):t(`OpenCode database file`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,dir:`ltr`,value:n,placeholder:t(`Absolute path, for example on a mounted volume`),onChange:e=>r(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:f,disabled:!n.trim(),onClick:()=>void p(n.trim()),children:t(`Use this source`)}),!c&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:()=>void m(o?.path),children:t(`Browse`)}),i&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:h,children:t(`Use the default location`)})]}),i&&(0,H.jsxs)(`p`,{role:`status`,children:[t(`Chosen source`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono break-all`,children:i.displayPath})]}),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),o&&(0,H.jsxs)(`div`,{className:`rounded border border-border p-2`,children:[(0,H.jsx)(`p`,{dir:`ltr`,className:`font-mono text-xs break-all`,children:o.path}),(0,H.jsxs)(`ul`,{className:`max-h-60 overflow-auto`,children:[o.parent&&(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(o.parent),children:`..`})}),o.entries.map(n=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2`,children:[n.kind===`folder`?(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(n.path),children:(0,H.jsxs)(`bdi`,{dir:`ltr`,children:[n.name,`/`]})}):(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono text-xs`,children:n.name}),(n.kind!==`folder`||e.host!==`opencode`)&&(0,H.jsx)(`button`,{type:`button`,className:`text-xs underline`,onClick:()=>void p(n.path),children:t(`Choose`)})]},n.path))]}),o.truncated&&(0,H.jsx)(`p`,{className:`text-xs`,children:t(`Only the first 500 entries are shown.`)})]})]})}function cS(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return t?[Number(t[1]),Number(t[2])-1,Number(t[3])]:null}function lS(e){let t=cS(e);return t?new Date(t[0],t[1],t[2],0,0,0,0).getTime():void 0}function uS(e){let t=cS(e);return t?new Date(t[0],t[1],t[2],23,59,59,999).getTime():void 0}var dS=[`pi`,`opencode`,`claude-code`],fS=()=>({mode:`ids`,picked:new Map});function pS(){let e=e=>({enabled:e,source:null,page:null,listedWith:``,selection:fS(),modelChoice:`external`});return{hosts:{pi:e(!0),opencode:e(!1),"claude-code":e(!1)},scope:`current-project`,project:``,maps:``,since:``,until:``,profileBatch:``,force:!1,memories:!0,profile:!0,skills:!0,showHandled:!1}}var mS=[`scope`,`project`,`memories`,`profile`,`skills`,`force`,`showHandled`];function hS(e,t){let n={...e,...t};if(mS.every(t=>n[t]===e[t]))return n;let r={...n.hosts};for(let e of dS)r[e]={...r[e],page:null,listedWith:``,selection:fS()};return{...n,hosts:r}}function gS(e,t){return JSON.stringify([e.hosts[t].source?.sourceToken,e.scope,e.project,e.maps,e.memories,e.profile,e.skills,e.force,e.showHandled])}function _S(e){return{skipMemories:e.skills||!e.memories,skipProfile:e.skills||!e.profile,force:e.force,includeHandled:e.showHandled||e.force,...e.skills&&!e.memories&&!e.profile?{skillTurnsOnly:!0}:{}}}function vS(e,t){let n=e.hosts[t].page;return n?n.total-(e.scope===`all-projects`?n.unresolvedCount:0):0}function yS(e,t){let n=e.hosts[t].selection;return n.mode===`all`?vS(e,t)-n.excluded.size:n.picked.size}function bS(e,t){if(!t.selectable||!t.directory)return e;if(e.mode===`all`){let n=new Set(e.excluded);return n.has(t.key)?n.delete(t.key):n.add(t.key),{mode:`all`,excluded:n}}let n=new Map(e.picked);return n.has(t.key)?n.delete(t.key):n.set(t.key,t.directory),{mode:`ids`,picked:n}}function xS(e){return e.split(`
129
+ `).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.indexOf(`=`);if(t<1||t===e.length-1)throw Error(`Directory maps must be old=new, one per line`);return{from:e.slice(0,t),to:e.slice(t+1)}})}function SS(e){if(!e.memories&&!e.profile&&!e.skills)return`Choose at least one output.`;if(!dS.some(t=>e.hosts[t].enabled))return`Choose at least one host.`;try{xS(e.maps);let t=e.since?lS(e.since):void 0,n=e.until?uS(e.until):void 0;if(t!==void 0&&n!==void 0&&t>n)return`Prompt date from must not be after Prompt date to.`}catch(e){return e.message}return e.profileBatch&&(!Number.isInteger(Number(e.profileBatch))||Number(e.profileBatch)<1)?`Profile batch size must be a positive integer.`:null}function CS(e,t){let n=SS(e);if(n)throw Error(n);return{hosts:dS.filter(t=>e.hosts[t].enabled).map(t=>{let n=e.hosts[t];if(!n.page||n.listedWith!==gS(e,t))throw Error(`Options changed. Refresh the session list first.`);let r=n.selection;return{host:t,source:n.page.source.sourceToken,modelChoice:n.modelChoice||void 0,selection:r.mode===`all`||vS(e,t)===0?{mode:`all`,excludedKeys:r.mode===`all`?[...r.excluded]:[],revision:n.page.revision,listedAt:n.page.listedAt,...e.showHandled||e.force?{includeHandled:!0}:{}}:{mode:`ids`,sessions:[...r.picked].map(([e,t])=>({key:e,directory:t})),listedAt:n.page.listedAt}}}),options:{dryRun:t,force:e.force,skipMemories:!e.memories,skipProfile:!e.profile,skipSkills:!e.skills,scope:e.scope,...e.scope===`current-project`&&e.project?{project:e.project}:{},...e.since?{since:lS(e.since)}:{},...e.until?{until:uS(e.until)}:{},...e.profileBatch?{profileBatch:Number(e.profileBatch)}:{},pathMaps:xS(e.maps)}}}function wS(e){return JSON.stringify({...e,hosts:dS.filter(t=>e.hosts[t].enabled).map(t=>{let n=e.hosts[t];return{host:t,...n,selection:n.selection.mode===`all`?{mode:`all`,excluded:[...n.selection.excluded].sort()}:{mode:`ids`,picked:[...n.selection.picked].sort()}}})})}var TS=`${J.settings}#settings-section-skill-learning`,ES=`mt-1 block w-full min-w-0 rounded border border-border bg-background p-2`,DS=`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`;function OS({draft:e,skillRecording:t,advanced:n,onChange:r,onAdvanced:i}){let a=X();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-sm`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Project memories`),checked:e.memories,onChange:e=>r({memories:e.target.checked})}),` `,a(`Project memories`)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`User profile`),checked:e.profile,onChange:e=>r({profile:e.target.checked})}),` `,a(`User profile`),` `,a(`(preferences, patterns, and workflows)`)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Skill turns`),checked:t&&e.skills,disabled:!t,onChange:e=>r({skills:e.target.checked})}),` `,a(`Skill turns`)]})]}),!t&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a(`Skill turns are recorded only while Record agent turns is on.`),` `,(0,H.jsx)(`a`,{className:`underline`,href:TS,onClick:e=>{e.preventDefault(),gf(TS)},children:a(`Open the Skill learning card`)})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[a(`Scope`),(0,H.jsx)(`div`,{className:Tr,children:(0,H.jsxs)(Er,{"aria-label":a(`Scope`),className:ES,value:e.scope,onChange:e=>r({scope:e.target.value}),children:[(0,H.jsx)(`option`,{value:`current-project`,children:a(`Current project`)}),(0,H.jsx)(`option`,{value:`all-projects`,children:a(`All projects`)})]})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Show handled sessions`),checked:e.showHandled,onChange:e=>r({showHandled:e.target.checked})}),` `,a(`Show handled sessions`)]}),(0,H.jsx)(`button`,{type:`button`,className:DS,onClick:i,"aria-expanded":n,children:a(n?`Hide advanced options`:`Advanced options`)}),(0,H.jsxs)(`div`,{hidden:!n,className:`space-y-3 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e.scope===`current-project`&&(0,H.jsxs)(`label`,{className:`text-sm`,children:[a(`Project directory`),(0,H.jsx)(`input`,{"aria-label":a(`Project directory`),className:`mt-1 block w-full min-w-0 rounded border border-border bg-background p-2`,dir:`ltr`,value:e.project,placeholder:a(`Current directory`),onChange:e=>r({project:e.target.value})})]}),[[`Prompt date from`,`since`],[`Prompt date to`,`until`],[`Profile batch size`,`profileBatch`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`text-sm`,children:[a(t),(0,H.jsx)(`input`,{"aria-label":a(t),type:n===`profileBatch`?`text`:`date`,inputMode:n===`profileBatch`?`numeric`:void 0,className:ES,value:e[n],onChange:e=>r({[n]:e.target.value})})]},n))]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`Prompt dates are inclusive, use your time zone, and filter the turns inside each session, not the list. Empty dates include every turn.`)}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[a(`Directory maps (old=new, one per line)`),(0,H.jsx)(`textarea`,{"aria-label":a(`Directory maps (old=new, one per line)`),dir:`ltr`,className:ES,rows:2,value:e.maps,onChange:e=>r({maps:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Re-analyse handled history`),checked:e.force,onChange:e=>r({force:e.target.checked})}),` `,a(`Re-analyse handled history`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`Re-analysis applies to the selected outputs. Each profile prompt can be forcibly re-analysed once. Findings merge into the existing profile.`)})]})]})}function kS({host:e,draft:t,readiness:n,advanced:r,listing:i,onChange:a,onList:o,onUnresolved:s}){let c=X(),l=t.hosts[e],u=l.page,d=u&&l.listedWith!==gS(t,e),f=vS(t,e),p=e=>l.selection.mode===`all`?!l.selection.excluded.has(e.key):l.selection.picked.has(e.key),m={recorded:c(`recorded`),mapped:c(`mapped`),worktree:c(`project root`),unresolved:c(`missing`)},h=e===`pi`&&n?.piReader.available===!1;return(0,H.jsxs)(`section`,{hidden:!l.enabled,"aria-label":Jd(e),className:`space-y-3 rounded-lg border border-border p-3 min-w-0`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Jd(e)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Source`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`break-all`,children:l.source?.displayPath??u?.source.displayPath??c(`default location`)})]}),h&&(0,H.jsx)(`p`,{role:`alert`,children:c(n?.piReader.reason??`Pi session reader is unavailable. Fix the reader or deselect Pi.`)}),e===`claude-code`&&n?.claudeCode&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Claude Code transcripts`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono break-all`,children:n.claudeCode.defaultRoot}),` `,`(`,c(n.claudeCode.defaultRootFound?`found`:`not found`),`).`,` `,c(`Claude Code imports always use the external API.`)]}),(0,H.jsx)(`div`,{hidden:!r,children:(0,H.jsx)(sS,{host:e,onChoose:e=>a({source:e})})}),(0,H.jsx)(`button`,{type:`button`,className:DS,disabled:i||h,onClick:()=>o(0,!0),children:c(u?`Refresh list`:`List sessions`)}),d&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:c(`Options changed. Refresh the session list first.`)}),u&&t.scope===`current-project`&&u.unresolvedCount>0&&(0,H.jsxs)(`p`,{className:`text-sm`,children:[c(`Sessions with directories that no longer exist`),`: `,u.unresolvedCount,`.`,` `,(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:s,children:c(`Show them and add a directory map`)})]}),u&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsxs)(`span`,{role:`status`,children:[c(`Selected`),`: `,yS(t,e),` / `,f]}),(0,H.jsxs)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:f===0,onClick:()=>a({selection:{mode:`all`,excluded:new Set}}),children:[c(`Select all matching`),` (`,f,`)`]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,onClick:()=>a({selection:fS()}),children:c(`Clear selection`)})]}),(0,H.jsxs)(`div`,{className:`max-w-full overflow-x-auto`,children:[(0,H.jsxs)(`table`,{className:`w-full text-start text-sm`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{className:`text-muted-foreground`,children:[`Select`,`Created`,`Session`,`Project directory`,`Resolved by`].map(e=>(0,H.jsx)(`th`,{className:`p-1`,children:c(e)},e))})}),(0,H.jsx)(`tbody`,{children:u.rows.map(t=>(0,H.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,H.jsx)(`td`,{className:`p-1`,children:(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":`${Jd(e)}: ${c(`Select`)} ${t.sessionId??t.key}`,checked:t.selectable&&p(t),disabled:!t.selectable,onChange:()=>a({selection:bS(l.selection,t)})})}),(0,H.jsx)(`td`,{className:`p-1 whitespace-nowrap`,children:t.createdAt?Zp(t.createdAt):`—`}),(0,H.jsxs)(`td`,{className:`p-1 font-mono text-xs`,children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:t.sessionId??t.key}),t.handled&&(0,H.jsx)(`span`,{className:`ms-2 rounded border border-border px-1 font-sans text-muted-foreground`,children:c(`Handled`)})]}),(0,H.jsx)(`td`,{className:`p-1 font-mono text-xs break-all`,children:(0,H.jsx)(`bdi`,{dir:`ltr`,children:t.directory??t.recordedDirectory??`—`})}),(0,H.jsx)(`td`,{className:`p-1`,children:m[t.via]})]},t.key))})]}),u.total===0&&(0,H.jsx)(`p`,{className:`text-sm`,children:c(`No sessions match.`)}),(u.hiddenHandled??0)>0&&(0,H.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[c(`Handled sessions hidden`),`: `,u.hiddenHandled]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:i||u.offset===0,onClick:()=>o(Math.max(0,u.offset-50),!1),children:c(`Previous`)}),(0,H.jsxs)(`span`,{children:[u.total?u.offset+1:0,`–`,Math.min(u.offset+50,u.total),` /`,` `,u.total]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:i||u.offset+50>=u.total,onClick:()=>o(u.offset+50,!1),children:c(`Next`)})]})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[c(`Import model`),(0,H.jsx)(`div`,{dir:`ltr`,children:(0,H.jsxs)(Er,{"aria-label":c(`Import model`),className:ES,value:l.modelChoice,onChange:e=>a({modelChoice:e.target.value}),children:[(0,H.jsx)(`option`,{value:``,children:c(`None`)}),e!==`claude-code`&&n?.opencode.models.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsxs)(`option`,{value:`external`,children:[c(`Saved external API`),n&&n.external.state!==`ready`?` (${c(`not ready`)})`:``]})]})})]}),e!==`claude-code`&&n&&!n.opencode.available&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`Configured, not tested.`)})]})}var AS=`omms-memory-import-hosts`;function jS(e,t){try{let n=t??localStorage,r=dS.filter(t=>e.hosts[t].enabled);n.setItem(AS,JSON.stringify({hosts:r,scope:e.scope,skills:e.skills}))}catch{}}function MS(e,t){try{let n=t??localStorage,r=JSON.parse(n.getItem(`omms-memory-import-hosts`)??`null`);if(!r||typeof r!=`object`)return e;let{hosts:i,scope:a,skills:o}=r;return Array.isArray(i)&&i.length>0&&i.every(e=>dS.includes(e))&&(a===`current-project`||a===`all-projects`)?{...e,scope:a,skills:typeof o==`boolean`?o:e.skills,hosts:Object.fromEntries(dS.map(t=>[t,{...e.hosts[t],enabled:i.includes(t)}]))}:e}catch{return e}}var NS={"missing-model":`The external API has no memoryModel in the global config`,"missing-url":`The external API has no memoryApiUrl in the global config`,"missing-key":`The external API key is missing in the OpenCode process; check memoryApiKey and its env:// or file:// source`,"unsupported-provider":`The memoryProvider in the global config is not supported for imports`};function PS(e,t,n,r){return!t.memories&&!t.profile?null:e.map(e=>{let i=t.hosts[e].modelChoice,a=null;return n?i?i===`external`&&n.external.state!==`ready`?a=NS[n.external.state]??`The external API is not ready`:e===`claude-code`&&i!==`external`?a=`Claude Code imports use the external API. Complete the external API settings.`:i!==`external`&&!n.opencode.models.some(e=>`${e.provider}/${e.model}`===i)&&(a=`No import model is ready. Connect a model in OpenCode or complete the external API settings.`):a=`No import model is ready. Connect a model in OpenCode or complete the external API settings.`:a=`Model readiness is unknown. Reload the page.`,a?`${Jd(e)}: ${r(a)}`:null}).find(Boolean)??null}var FS=[`running`,`cancelling`],IS=[`done`,`failed`,`cancelled`];function LS(e){if(!e||e.dryRun||!FS.includes(e.state))return null;let t=e.hosts?.find(e=>e.state===`running`);if(!t)return null;let n=t.phase===`profile`,r=(n?t.profileProcessed:t.processed)??0,i=(n?t.profileTotal:t.total)??0;return{host:t.host,phase:n?`profile`:t.phase===`skill-turns`?`skill-turns`:`memory`,done:r,total:i,percent:i>0?Math.min(100,Math.floor(r*100/i)):0}}function RS(e,t,n){return!t||t.dryRun||!IS.includes(t.state)||t.state===`cancelled`||t.id===n?`none`:e?e.id===t.id&&IS.includes(e.state)?`none`:`dialog`:`banner`}function zS(e){return e?e.hosts?.length?e.hosts.reduce((e,t)=>e+(t.summary?.unitsFailed??0),0):e.summary?.unitsFailed??0:0}function BS(e){return e.hosts?.find(e=>e.error)?.error??e.error}var VS=`Could not reload the settings. Reload the page.`;async function HS(e,t){let[n]=await Promise.all([e(),t().catch(()=>{})]);return n===null?VS:null}var US=`omms.import.dismissedEnd`;function WS(){try{return window.localStorage.getItem(US)}catch{return null}}function GS(e){try{window.localStorage.setItem(US,e)}catch{}}function KS(e,t){let n=e.summary,r=n?.profile;return[[`sessions`,e.sessions],[`Memory units`,n?.unitsTotal??e.total],[`Pending memory units`,n?.unitsWouldImport],[`Imported memory units`,n?.unitsImported],[`Already handled memory units`,n?.unitsAlreadyHandled],[`Skipped memory units`,n?.unitsSkipped],[`Failed memory units`,n?.unitsFailed],[`Held-back turns`,n?.unitsHeldBack],[`Untimed turns`,n?.unitsUntimed],[`Skill turns to record`,n?.skillTurnsWouldRecord],[`Skill turns already recorded`,n?.skillTurnsAlreadyRecorded],[`Skill turns recorded`,n?.skillTurnsRecorded],[`Skill turns already present`,n?.skillTurnsAlreadyPresent],[`Load errors`,n?.loadErrors],[`Profile prompts`,r?r.promptsRecorded+r.promptsWouldRecord:void 0],[`Already handled profile prompts`,r?.promptsAlreadyHandled],[`Profile batches`,r?.batchesBuilt],[`Estimated profile analysis calls`,e.profileEstimate?.analysisCalls],[`Waiting prompts inside OMMS`,e.profileEstimate?.waitingPrompts],[`Unresolved sessions`,n?.unresolved]].filter(([,e])=>e!==void 0).map(([e,n])=>`${t(String(e))}: ${n}`).join(` · `)}function qS(e,t){let n=e.match(/^(Pi|OpenCode|Claude Code): /),r=n?e.slice(n[0].length):e,i=`Refresh the preview and retry.`,a=r.endsWith(` ${i}`),o=a?r.slice(0,-31):r,s=a&&/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*\.$/.test(o),c=t(o);return(0,H.jsxs)(H.Fragment,{children:[n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:n[1]}),`: `]}),s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:o.slice(0,-1)}),`.`]}):c===o?(0,H.jsx)(`bdi`,{dir:`ltr`,children:o}):c.split(/(Pi|OpenCode|Claude Code)/).map((e,t)=>/^(Pi|OpenCode|Claude Code)$/.test(e)?(0,H.jsx)(`bdi`,{dir:`ltr`,children:e},t):e),a&&(0,H.jsxs)(H.Fragment,{children:[` `,t(i)]})]})}function JS({job:e}){let t=X();if(!e)return null;let n=e.hosts??(e.host?[{...e,host:e.host}]:[]);return(0,H.jsxs)(`div`,{role:`status`,className:`space-y-3 text-sm`,"aria-label":t(`Import results`),children:[(0,H.jsxs)(`p`,{children:[t(e.dryRun?`Preview (dry run)`:`Import`),` · `,t(e.state),e.activeHost&&(0,H.jsxs)(H.Fragment,{children:[` `,`· `,t(`Current host`),`: `,Jd(e.activeHost)]})]}),(0,H.jsxs)(`p`,{children:[t(`Combined counts`),`: `,KS(e,t)]}),(0,H.jsx)(`ul`,{className:`space-y-2`,children:n.map(e=>(0,H.jsxs)(`li`,{className:`rounded border border-border p-2`,children:[(0,H.jsxs)(`p`,{children:[Jd(e.host),` ·`,` `,t(e.state===`no-work`?`No work to process`:e.state),e.phase&&(0,H.jsxs)(H.Fragment,{children:[` `,`·`,` `,t(e.phase===`profile`?`Learning profile`:e.phase===`preparing`?`preparing`:e.phase===`skill-turns`?`Skill turns`:`Memory extraction`)]})]}),e.phase===`profile`?(0,H.jsxs)(`p`,{children:[t(`Profile batches`),`: `,e.profileProcessed??0,`/`,e.profileTotal??0]}):(e.phase===`memory`||e.phase===`skill-turns`)&&e.total!==void 0&&(0,H.jsxs)(`p`,{children:[t(e.phase===`skill-turns`?`Skill turns`:`Memory units`),`:`,` `,e.processed??0,`/`,e.total]}),(0,H.jsx)(`p`,{children:KS(e,t)}),(e.error||e.blocker)&&(0,H.jsx)(`p`,{role:`alert`,children:qS(e.error??e.blocker,t)}),e.report&&(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:e.report})]},e.host))}),e.error&&(0,H.jsx)(`p`,{role:`alert`,children:qS(e.error,t)}),e.report&&(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:e.report}),e.dryRun&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.`)})]})}function YS({job:e}){let t=X(),n=e.state===`failed`,r=BS(e),i=zS(e);return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[n&&r&&(0,H.jsx)(`p`,{role:`alert`,children:qS(r,t)}),i>0&&(0,H.jsxs)(`p`,{children:[t(`Failed memory units`),`: `,i]}),!n&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:KS({summary:{unitsImported:e.summary?.unitsImported,unitsFailed:e.summary?.unitsFailed??0}},t)})]})}function XS({job:e,onReload:t}){let n=X(),r=(0,v.useRef)(null),[i,a]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!e)return;let t=RS(r.current,e,WS());r.current=e,t!==`none`&&a({job:e,view:t})},[e]);let o=()=>{i&&GS(i.job.id),a(null)},s=i?n(i.job.state===`failed`?`Import failed`:`Import successful 🎉`):``;return(0,H.jsxs)(H.Fragment,{children:[e?.state===`cancelled`&&!e.dryRun&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:n(`Import cancelled`)}),i?.view===`banner`&&(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-start justify-between gap-2 rounded-lg border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-semibold`,children:s}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`The import finished while you were away.`)}),(0,H.jsx)(YS,{job:i.job})]}),(0,H.jsx)(G,{variant:`outline`,size:`sm`,onClick:o,children:n(`Dismiss`)})]}),(0,H.jsx)(K,{open:i?.view===`dialog`,onOpenChange:e=>{e||(o(),t())},children:(0,H.jsxs)(q,{showCloseButton:!1,className:i?.job.state===`failed`?`border-destructive/40`:void 0,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:s}),(0,H.jsx)(Wl,{className:`sr-only`,children:s})]}),i&&(0,H.jsx)(YS,{job:i.job}),(0,H.jsx)(Hl,{children:(0,H.jsx)(G,{autoFocus:!0,onClick:()=>{o(),t()},children:n(`OK`)})})]})})]})}var ZS={memory:`Memory units`,"skill-turns":`Skill turns`,profile:`Profile batches`};function QS({job:e}){let t=X(),n=LS(e);return n?(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n.percent,"aria-label":t(`Import progress`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-green-600`,style:{width:`${n.percent}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:Jd(n.host)}),` · `,t(ZS[n.phase]),`: `,n.done,` /`,` `,n.total,` · `,n.percent,`%`]})]}):null}var $S=[`queued`,`preparing`,`running`,`cancelling`];function eC(e){return e&&$S.includes(e.state)?e:null}function tC(e,t){if(!e||!t)return e;if(!e.hosts)return e.host===t?e:null;let n=e.hosts.find(e=>e.host===t);if(!n)return null;if(e.hosts.length===1)return e;let r=e.hosts.some(e=>e.state===`failed`||e.error);return{...e,state:n.state,activeHost:e.activeHost===t?t:null,error:n.error??(r?void 0:e.error),sessions:n.sessions,processed:n.processed,total:n.total,summary:n.summary,profileEstimate:n.profileEstimate,hosts:[n]}}function nC(e){return ny(()=>e())}function rC({profilePreset:e=0,host:t}={}){let n=X(),[r,i]=(0,v.useState)(()=>{let e=pS();if(!t)return MS(e);for(let n of dS)e.hosts[n].enabled=n===t;return e}),{snapshot:a}=cx(),o=a?.settings?.skillLearning?.value===!0,s=e=>o?e:{...e,skills:!1},c=s(r),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)({}),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(``),w=(0,v.useRef)(!1),T=(0,v.useRef)({pi:0,opencode:0,"claude-code":0}),E=(0,v.useRef)(!0),D=(0,v.useRef)(iy()),O=wS(c),k=(0,v.useRef)(O);k.current=O;let A=tC(p,t),j=dS.filter(e=>c.hosts[e].enabled),M=t?[t]:dS,N=(0,v.useRef)(r.skills);(0,v.useEffect)(()=>{t||jS({...r,skills:N.current})},[r,t]);let P=p?.state===`running`||p?.state===`cancelling`||p?.state===`preparing`||p?.state===`queued`;function ee(e=!1){let t=D.current.begin();return Y(`/api/settings/imports/current`).then(n=>{E.current&&t()&&m(e?eC(n.job):n.job)})}(0,v.useEffect)(()=>{E.current=!0;let e=()=>{g(null),Y(`/api/settings/imports/readiness`).then(e=>{E.current&&f(e)}).catch(()=>{E.current&&f(null)})};e(),ee(!0).catch(()=>{});let t=nC(e);return()=>{E.current=!1,t()}},[]);function F(){HS(ty,ee).then(e=>{E.current&&e&&C(e)})}(0,v.useEffect)(()=>{if(!P)return;let e=setInterval(()=>{w.current||ee().catch(e=>{E.current&&C(e.message)})},1e3);return()=>clearInterval(e)},[P]),(0,v.useEffect)(()=>{e&&(i(e=>hS(e,{memories:!1,profile:!0,skills:!1,force:!0})),g(null))},[e]);function I(e){e.skills!==void 0&&(N.current=e.skills),g(null),i(t=>hS(t,e))}function te(e,t){g(null),i(n=>({...n,hosts:{...n.hosts,[e]:{...n.hosts[e],...t}}}))}async function L(e,t,n){let r=++T.current[e],a=gS(c,e);g(null),y(t=>({...t,[e]:!0}));try{let o=await Y(`/api/settings/imports/sessions`,{method:`POST`,body:JSON.stringify({host:e,...c.hosts[e].source?{source:c.hosts[e].source.sourceToken}:{},scope:c.scope,...c.scope===`current-project`&&c.project?{project:c.project}:{},pathMaps:xS(c.maps),offset:t,limit:50,refresh:n,..._S(c)})});if(!E.current||T.current[e]!==r)return;i(t=>{if(gS(s(t),e)!==a)return t;let r=t.hosts[e],i=tS(r.page,o,n);return{...t,hosts:{...t.hosts,[e]:{...r,page:i.page,listedWith:a,selection:i.sameListing?r.selection:fS()}}}}),C(``)}catch(t){E.current&&T.current[e]===r&&C(t.message)}finally{E.current&&T.current[e]===r&&y(t=>({...t,[e]:!1}))}}let ne=SS(c),re=j.some(e=>e===`pi`&&d?.piReader.available===!1),R=j.map(e=>{let t=c.hosts[e];return t.page?t.listedWith===gS(c,e)?vS(c,e)>0&&yS(c,e)===0?`${Jd(e)}: ${n(`Select at least one session.`)}`:t.selection.mode===`ids`&&t.selection.picked.size>1e3?`${Jd(e)}: ${n(`Select at most 1000 sessions one by one, or use Select all matching.`)}`:null:`${Jd(e)}: ${n(`Options changed. Refresh the session list first.`)}`:`${Jd(e)}: ${n(`List sessions first.`)}`}).find(Boolean),ie=PS(j,c,d,n),ae=!!(h&&h.fingerprint===O&&h.id===p?.id&&p.dryRun&&p.state===`done`&&!p.error&&!p.hosts?.some(e=>e.error||e.blocker||[`failed`,`cancelled`,`not-run`].includes(e.state))),oe=b||P||j.some(e=>_[e])||re||!!(ne||R);async function se(e){if(w.current||oe||!e&&(!ae||ie))return;if(!e){let e=[c.memories&&n(`Project memories`),c.profile&&n(`User profile`),c.skills&&n(`Skill turns`)].filter(Boolean).join(` · `),t=j.map(e=>`${Jd(e)}: ${c.hosts[e].modelChoice===`external`?`${n(`Saved external API`)} (${d?.external.provider}/${d?.external.model})`:c.hosts[e].modelChoice}`).join(`
130
+ `);if((c.memories||c.profile)&&!window.confirm([n(`This import makes model calls. Continue?`),j.map(Jd).join(` · `),n(c.scope===`current-project`?`Current project`:`All projects`),c.project,e,t,KS(p??{},n),...(p?.hosts??[]).map(e=>`${Jd(e.host)}: ${KS(e,n)}`)].filter(Boolean).join(`
131
+ `)))return}w.current=!0,D.current.begin(),x(!0);let t=O;g(null);try{let n=await Y(`/api/settings/imports`,{method:`POST`,body:JSON.stringify(CS(c,e))});if(!E.current)return;m(n),e&&t===k.current&&g({id:n.id,fingerprint:t}),C(``)}catch(e){E.current&&C(e.message),ee().catch(()=>{})}finally{w.current=!1,E.current&&x(!1)}}async function ce(){if(!w.current){w.current=!0,D.current.begin();try{let e=await Y(`/api/settings/imports/current/cancel`,{method:`POST`,body:`{}`});E.current&&m(e.job)}catch(e){E.current&&C(e.message)}finally{w.current=!1}}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4 min-w-0`,"aria-label":n(t?`Sessions`:`Import chat history`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:n(t?`Sessions`:`Import chat history`)}),!t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.`)}),(0,H.jsxs)(`p`,{className:`flex flex-wrap gap-3 text-sm`,children:[(0,H.jsx)(`a`,{className:`underline`,href:J.project,onClick:e=>{e.preventDefault(),gf(J.project)},children:n(`Project memories`)}),(0,H.jsx)(`a`,{className:`underline`,href:J.profile,onClick:e=>{e.preventDefault(),gf(J.profile)},children:n(`User profile`)}),(0,H.jsx)(`a`,{className:`underline`,href:`${J.settings}#settings-section-profiles`,onClick:e=>{e.preventDefault(),gf(`${J.settings}#settings-section-profiles`)},children:n(`Profile identity in Settings`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Hosts keep their existing user identities. All hosts does not merge profiles with different identities.`)}),(0,H.jsx)(oS,{}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[dS.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":Jd(e),checked:c.hosts[e].enabled,onChange:t=>te(e,{enabled:t.target.checked})}),` `,Jd(e)]},e)),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,onClick:()=>I({hosts:{pi:{...c.hosts.pi,enabled:!0},opencode:{...c.hosts.opencode,enabled:!0},"claude-code":{...c.hosts[`claude-code`],enabled:!0}}}),children:n(`All hosts`)}),(0,H.jsxs)(`span`,{role:`status`,children:[n(`Selected hosts`),`: `,j.length]})]})]}),(0,H.jsx)(OS,{draft:c,skillRecording:o,advanced:l,onChange:I,onAdvanced:()=>u(e=>!e)}),M.map(e=>(0,H.jsx)(kS,{host:e,draft:c,readiness:d,advanced:l,listing:!!_[e],onChange:t=>te(e,t),onList:(t,n)=>L(e,t,n),onUnresolved:()=>{I({scope:`all-projects`}),u(!0)}},e)),ne&&(0,H.jsx)(`p`,{role:`alert`,children:n(ne)}),!P&&(R||ie)&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:R??ie}),!ae&&!P&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Preview the current selection before starting an import.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:DS,disabled:oe,onClick:()=>se(!0),children:n(`Preview (dry run)`)}),(0,H.jsx)(`button`,{type:`button`,className:DS,disabled:oe||!ae||!!ie,onClick:()=>se(!1),children:n(`Start import`)}),P&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:p?.state===`cancelling`,onClick:()=>ce(),children:n(`Cancel after current unit`)})]}),S&&(0,H.jsx)(`p`,{role:`alert`,children:qS(S,n)}),(0,H.jsx)(QS,{job:A}),(0,H.jsx)(XS,{job:A,onReload:F}),(0,H.jsx)(JS,{job:A})]})}var iC=3e5,aC=null,oC,sC=new Set,cC=new Set;async function lC(e){try{aC=await Y(`/api/memory/write-health${e?`?fresh=1`:``}`)}catch{}for(let e of[...sC,...cC])e()}function uC(e){return sC.add(e),sC.size===1&&(lC(!1),oC=setInterval(()=>{document.hidden||lC(!1)},iC)),()=>{sC.delete(e),sC.size===0&&clearInterval(oC)}}function dC(){return{health:(0,v.useSyncExternalStore)(uC,()=>aC,()=>null),recheck:()=>lC(!0)}}function fC(e){return cC.add(e),()=>cC.delete(e)}function pC(){return(0,v.useSyncExternalStore)(fC,()=>aC,()=>null)}function mC(e){let t=(t,...n)=>n.every((n,r)=>e[t+r]===n);return t(0,137,80,78,71,13,10,26,10)?`png`:t(0,255,216,255)?`jpeg`:t(0,71,73,70,56)?`gif`:t(0,82,73,70,70)&&t(8,87,69,66,80)?`webp`:null}async function hC(e){return e.size>20971520?`size`:mC(new Uint8Array(await e.slice(0,16).arrayBuffer()))?null:`type`}function gC(e,t){let n=Math.min(e,t);return{x:Math.floor((e-n)/2),y:Math.floor((t-n)/2),side:n}}async function _C(e){let t=await createImageBitmap(e);try{let{x:e,y:n,side:r}=gC(t.width,t.height),i=document.createElement(`canvas`);i.width=128,i.height=128;let a=i.getContext(`2d`);if(!a)throw Error(`This browser cannot draw the image`);a.imageSmoothingQuality=`high`,a.drawImage(t,e,n,r,r,0,0,128,128);let o=await new Promise(e=>i.toBlob(e,`image/png`));if(!o)throw Error(`This browser cannot save the image`);let s=new Uint8Array(await o.arrayBuffer()),c=``;for(let e of s)c+=String.fromCharCode(e);return btoa(c)}finally{t.close()}}function vC({host:e,onClose:t}){let n=X(),{looks:r,setIcon:i,setImage:a,reset:o}=Hx(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),h=s===null?r[e]:`reset`in s?{kind:`default`}:s.look,g=Wx.filter(e=>e.includes(l.trim().toLowerCase()));async function _(e){if(!e)return;f(``);let t=await hC(e);if(t){f(n(t===`size`?`The image is larger than 20 MB.`:`Only PNG, JPEG, WebP and GIF images are accepted.`));return}try{let t=await _C(e);c({look:{kind:`image`,image:`data:image/png;base64,${t}`},png:t})}catch{f(n(`This browser could not read the image.`))}}async function y(){if(s===null)return t();m(!0);try{`reset`in s?await o(e):s.look.kind===`icon`?await i(e,s.look.icon):s.png&&await a(e,s.png),t()}catch(e){f(e.message),m(!1)}}return(0,H.jsx)(K,{open:!0,onOpenChange:e=>!e&&!p&&t(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:`${n(`Change icon`)}: ${Jd(e)}`}),(0,H.jsx)(Wl,{children:n(`Every avatar is shown at the same size. Images are cropped to a square.`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Kx,{host:e,look:h}),(0,H.jsxs)(`label`,{className:`inline-flex`,children:[(0,H.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,className:`sr-only peer`,onChange:e=>void _(e.target.files?.[0])}),(0,H.jsxs)(`span`,{className:`inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-[9px] border border-border px-3 text-ui font-medium hover:bg-interactive-hover peer-focus-visible:outline-2 peer-focus-visible:outline-ring`,children:[(0,H.jsx)(Re,{className:`size-4`,"aria-hidden":`true`}),n(`Upload image`)]})]}),(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c({reset:!0}),children:[(0,H.jsx)(Ct,{"aria-hidden":`true`}),n(`Reset to default`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`PNG, JPEG, WebP or GIF, up to 20 MB.`)}),(0,H.jsx)(id,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":n(`Search icons`),placeholder:n(`Search icons`)}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":n(`Choose icon`),className:`grid max-h-48 grid-cols-6 gap-1 overflow-y-auto sm:grid-cols-8`,children:[g.map(e=>{let t=Ux[e],n=h.kind===`icon`&&h.icon===e;return(0,H.jsx)(`button`,{type:`button`,title:e,"aria-label":e,"aria-pressed":n,onClick:()=>c({look:{kind:`icon`,icon:e}}),className:V(`grid size-10 place-items-center rounded-[9px] border border-transparent text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,n&&`border-primary bg-primary/10 text-primary-label`),children:(0,H.jsx)(t,{className:`size-5`,"aria-hidden":`true`})},e)}),g.length===0&&(0,H.jsx)(`p`,{className:`col-span-full text-sm text-muted-foreground`,children:n(`No icon matches.`)})]}),d&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:d}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,onClick:t,disabled:p,children:n(`Cancel`)}),(0,H.jsx)(G,{type:`button`,onClick:()=>void y(),disabled:p||s===null,children:n(`Save`)})]})]})})}function yC({view:e,line:t,warning:n,notSetUp:r,current:i,compact:a}){let o=X(),{looks:s}=Hx(),[c,l]=(0,v.useState)(!1),u=e===`shared`?null:e,d=u?Jd(u):o(`Shared`),f=ld(e),p=u?(0,H.jsx)(Kx,{host:u,look:s[u],className:a?`size-8`:void 0}):(0,H.jsx)(qx,{className:a?`size-8`:void 0});return(0,H.jsxs)(`div`,{className:`relative h-full min-w-0`,children:[(0,H.jsxs)(`a`,{href:f,"aria-current":i?`page`:void 0,onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||(e.preventDefault(),gf(f))},className:V(`flex h-full min-w-0 flex-col gap-3 rounded-xl border bg-card p-4 text-start transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,a&&`flex-row items-center gap-2 p-2 pe-10`,n?`border-[var(--status-warning)]`:`border-border`,i&&`bg-sidebar-accent`,r&&`opacity-70`),children:[p,(0,H.jsxs)(`span`,{className:`min-w-0 space-y-1`,children:[(0,H.jsx)(`span`,{className:`block break-words text-subsection-title font-semibold`,children:d}),(0,H.jsx)(`span`,{className:`block break-words text-xs text-muted-foreground`,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium text-status-warning`,children:o(`Memories not saved`)}),!a&&(0,H.jsx)(`span`,{className:`block`,children:n})]}):t})]})]}),u&&(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:a?`icon-xs`:`icon-sm`,className:`absolute end-2 top-2`,"aria-label":`${o(`Change icon`)}: ${d}`,title:o(`Change icon`),onClick:()=>l(!0),children:(0,H.jsx)(pt,{"aria-hidden":`true`})}),c&&u&&(0,H.jsx)(vC,{host:u,onClose:()=>l(!1)})]})}function bC({current:e,statuses:t}){let n=X(),{health:r}=dC(),i=r&&!r.ok?r.reason??``:null;return(0,H.jsx)(`nav`,{"aria-label":n(`Memory views`),children:(0,H.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 lg:grid-cols-4`,children:cd.map(r=>{let a=r===`shared`?null:r,o=a?t.line(a):{text:`Every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(yC,{compact:!0,view:r,current:r===e,line:Zx(n,o),warning:a&&t.input(a).setUp?i:null,notSetUp:a?!t.input(a).setUp:!1})},r)})})})}function xC({reason:e,checking:t,onCheck:n}){let r=X();return(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-[var(--status-warning)] bg-card p-3 text-sm`,children:[(0,H.jsx)(zt,{className:`size-4 shrink-0 text-status-warning`,"aria-hidden":`true`}),(0,H.jsxs)(`p`,{className:`min-w-0 flex-1 break-words`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:r(`Memories are not being saved.`)}),` `,e?/[.!?]$/.test(e)?e:`${e}.`:``,` `,r(`Fix the service named here, then press Check again.`)]}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:t,onClick:n,children:r(`Check again`)})]})}function SC(){let{health:e,recheck:t}=dC(),[n,r]=(0,v.useState)(!1);return!e||e.ok?null:(0,H.jsx)(xC,{reason:e.reason,checking:n,onCheck:()=>{r(!0),t().finally(()=>r(!1))}})}function CC({host:e,statuses:t,profilePreset:n}){let r=X(),i=!t.input(e).setUp;return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(bC,{current:e,statuses:t}),(0,H.jsx)(SC,{}),(0,H.jsx)(eS,{host:e,statuses:t}),i?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`${Jd(e)}: ${r(`OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.`)}`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rC,{host:e,profilePreset:n}),(0,H.jsx)(Dx,{hosts:[e],saved:!1,title:`Sessions that need a folder`,anchorId:`host-unresolved`}),(0,H.jsx)(Px,{host:e,backfill:t.backfill})]})]})}function wC({statuses:e,profilePreset:t}){let n=X(),{health:r}=dC(),[i,a]=(0,v.useState)(!1),o=r&&!r.ok?r.reason??``:null;return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Choose a host to see its history import, sessions and settings.`)}),(0,H.jsx)(`ul`,{className:`grid grid-cols-2 items-stretch gap-3 lg:grid-cols-4`,children:cd.map(t=>{let r=t===`shared`?null:t,i=r?e.line(r):{text:`Settings for every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(yC,{view:t,line:Zx(n,i),warning:r&&e.input(r).setUp?o:null,notSetUp:r?!e.input(r).setUp:!1})},t)})}),(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`Import all hosts`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(G,{type:`button`,variant:`outline`,"aria-expanded":i,"aria-controls":`memory-import-all`,onClick:()=>a(e=>!e),children:n(`Import all hosts`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Runs one import for every host you tick. It makes model calls and can cost money.`)})]}),(0,H.jsx)(`div`,{id:`memory-import-all`,hidden:!i,children:i&&(0,H.jsx)(rC,{profilePreset:t})})]})]})}var TC=[{value:`boost`,label:`Boost (default)`},{value:`rrf`,label:`Rank fusion (experimental)`}];function EC(e){return e===`boost`||e===`rrf`}function DC(e){return EC(e)?e:`boost`}function OC(e){return{keywordMode:e}}function kC(e){let t=t=>{let n=e[t]?.value;return typeof n==`string`&&n.trim().length>0};return e.rerankerEnabled?.value===!0&&t(`rerankerApiUrl`)&&t(`rerankerModel`)}function AC(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(`boost`),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=ey();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(DC(r.settings.keywordMode?.globalValue)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=ny(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||e===DC(r.settings.keywordMode?.globalValue)?DC(a.settings.keywordMode?.globalValue):e)});return()=>{e=!1,r()}},[]);let d=DC(t?.settings.keywordMode?.globalValue),f=t?.settings.keywordMode?.source===`project`,p=t?kC(t.settings):!1;async function m(){if(!t||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:OC(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await ty()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function h(t){if(t.kind===`load-failed`)return e(`The keyword matching setting could not be loaded. Reload the page to try again.`);let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ry(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use this mode.`):ry(e(`The keyword matching setting could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Keyword matching`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Keyword matching`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search finds memories by meaning and by exact words from your prompt.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`keyword-mode`,children:e(`Word matching mode`)}),(0,H.jsx)(`div`,{className:`w-72 max-w-full`,children:(0,H.jsx)(Er,{id:`keyword-mode`,className:`w-full`,value:r,disabled:a,onChange:e=>{EC(e.target.value)&&i(e.target.value)},children:TC.map(t=>(0,H.jsx)(`option`,{value:t.value,children:e(t.label)},t.value))})}),(0,H.jsx)(`span`,{id:`keyword-mode-help`,className:`block text-xs text-muted-foreground`,children:`keywordMode`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(r===`rrf`?`Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.`:`Boost adds a small score bonus to memories that contain a word of your prompt.`)}),p&&r===`rrf`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`Rank fusion is not used while the reranker is on. Search uses the boost.`)}),f&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file can override this setting. This page edits the global value.`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(G,{type:`submit`,disabled:a||!t||r===d,children:e(`Save`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:a||r===d,onClick:()=>i(d),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:h(s)})]})}var jC=`Enter a positive whole number.`,MC=[{key:`maxMemories`,id:`memory-maxMemories`,default:10,unit:`Results`,affects:`Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.`,min:1,max:2**53-1,accepted:jC,kind:`integer`},{key:`chatMessage.maxMemories`,id:`memory-chatMessage-maxMemories`,default:3,unit:`Memories`,affects:`Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.`,min:1,max:2**53-1,accepted:jC,kind:`integer`},{key:`autoCaptureMaxContextBytes`,id:`memory-autoCaptureMaxContextBytes`,default:131072,unit:`Bytes`,affects:`Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.`,min:16384,max:16777216,accepted:`Enter a whole number from 16,384 to 16,777,216.`,kind:`integer`},{key:`userProfileMaxContextBytes`,id:`memory-userProfileMaxContextBytes`,default:32768,unit:`Bytes`,affects:`OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.`,min:1024,max:16777216,accepted:`Enter a whole number from 1,024 to 16,777,216.`,kind:`integer`},{key:`retrievalMaxTokens`,id:`memory-retrievalMaxTokens`,default:2e3,unit:`Approximate tokens`,affects:`Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.`,min:256,max:65536,accepted:`Enter a whole number from 256 to 65,536.`,kind:`integer`},{key:`similarityThreshold`,id:`memory-similarityThreshold`,default:.6,unit:`Similarity score`,affects:`Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.`,min:0,max:1,accepted:`Enter a number from 0 to 1.`,kind:`decimal`}];[...MC.flatMap(e=>[e.unit,e.affects,e.accepted])];function NC(e,t){let n=typeof t==`string`?t.trim():``;if(!n||!/^-?\d+(\.\d+)?$/.test(n))return;let r=Number(n);if(!(e.kind===`integer`&&!Number.isInteger(r)))return r>=e.min&&r<=e.max?r:void 0}function PC(e){return e.toLocaleString(`en-US`)}function FC(e,t,n){let r=t[e.key];return typeof r==`string`?r:String(n[e.key]??e.default)}function IC(e,t){let n=!1;for(let r of MC){let i=e[r.key];if(typeof i!=`string`)continue;let a=NC(r,i);if(a===void 0)return!1;a!==(t[r.key]??r.default)&&(n=!0)}return n}function LC(e,t){let n={};if(!IC(e,t))return n;for(let r of MC){let i=e[r.key];if(typeof i!=`string`)continue;let a=NC(r,i);a!==(t[r.key]??r.default)&&(n[r.key]=a)}return n}var RC=`Config changed. Reload settings and save again.`;function zC(e){if(e===`Config changed. Reload settings and save again.`)return{kind:`stale`};let t=MC.map(e=>e.key.replace(/\./g,`\\.`)).join(`|`),n=RegExp(`^Invalid (${t}) setting\\b`).exec(e);return n?{kind:`invalid`,key:n[1]}:{kind:`unknown`}}function BC(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=ey();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(()=>{e&&c({kind:`load-failed`})});let r=ny(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let u={},d={};for(let e of MC){let n=t?.settings[e.key];u[e.key]=typeof n?.globalValue==`number`?n.globalValue:void 0,d[e.key]=typeof n?.default==`number`?n.default:e.default}let f=IC(r,u),p=`~/.config/omms/omms.jsonc`,m=e(`Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.`).split(p);async function h(){if(!t||!f||l.current)return;let e=LC(r,u);Object.keys(e).length&&await _(e)}async function g(e){!t||a||l.current||t.settings[e]?.hasGlobal&&await _({[e]:null})}async function _(e){if(!t||l.current)return;l.current=!0,o(!0);let n=!1,r;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:t.revision})}),n=!0}catch(e){r=e}let a=await ty()!==null;o(!1),l.current=!1,n?(i(t=>{let n={...t};for(let t of Object.keys(e))delete n[t];return n}),c({kind:`saved`,reloaded:a})):c({kind:`save-failed`,failure:zC(r?.message??``),reloaded:a})}function y(t){if(t.kind===`load-failed`)return e(`The memory settings could not be loaded. Reload the page to try again.`);if(t.kind===`saved`)return t.reloaded?e(`Saved. New memory operations use these limits.`):`${e(`Saved. New memory operations use these limits.`)} ${e(`Reload the page before saving again.`)}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);if(t.failure.kind===`stale`)return ry(e(RC),n);if(t.failure.kind===`invalid`){let r=t.failure,i=MC.find(e=>e.key===r.key);return ry(`${e(`Invalid setting`)} ${i.key}: ${e(i.accepted)}`,n)}return ry(e(`The memory settings could not be saved.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory limits`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory limits`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Byte limits count UTF-8 bytes.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[m[0],(0,H.jsx)(`code`,{dir:`ltr`,children:p}),m[1]]}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,H.jsx)(`div`,{className:By,children:(0,H.jsxs)(`table`,{className:`w-full min-w-[56rem] text-sm`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:e(`Memory limits`)}),(0,H.jsx)(`thead`,{className:Hy,children:(0,H.jsx)(`tr`,{children:[`Setting`,`Value`,`Default`,`Unit`,`Affects`].map(t=>(0,H.jsx)(`th`,{className:Uy,children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:MC.map(n=>{let o=r[n.key],s=FC(n,r,u),c=typeof o==`string`&&NC(n,o)===void 0,l=t?.settings[n.key],f=l?.source===`project`,p=l?.hasGlobal===!0,m=p&&typeof l?.globalValue==`number`&&l.globalValue!==d[n.key];return(0,H.jsxs)(`tr`,{className:Wy,children:[(0,H.jsxs)(`td`,{className:Gy,children:[(0,H.jsx)(`code`,{dir:`ltr`,children:n.key}),f&&(0,H.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-xs text-amber-600`,children:[(0,H.jsxs)(`p`,{children:[e(`Effective value`),`: `,String(l?.value??``),` (`,e(`project`),`)`]}),(0,H.jsx)(`p`,{children:e(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`p`,{children:e(`The project value stays in force. Saving edits the global file only.`)})]})]}),(0,H.jsxs)(`td`,{className:Gy,children:[(0,H.jsx)(`input`,{type:`number`,id:`${n.id}-input`,className:`w-36 tabular-nums`,inputMode:n.kind===`decimal`?`decimal`:`numeric`,step:n.kind===`decimal`?.01:1,min:n.min,max:n.max,"aria-label":`${n.key} ${e(`Value`)}`,"aria-describedby":`${n.id}-help`,"aria-invalid":c||void 0,disabled:a,value:s,onChange:e=>i(t=>({...t,[n.key]:e.target.value}))}),(0,H.jsx)(`span`,{id:`${n.id}-help`,className:`block text-xs ${c?`text-red-600`:`text-muted-foreground`}`,children:e(n.accepted)}),(0,H.jsx)(`button`,{type:`button`,"data-reset":n.key,className:`mt-1 block text-xs underline`,disabled:a||!p,"aria-label":`${n.key} ${e(`Reset to default`)}`,onClick:()=>void g(n.key),children:e(`Reset to default`)})]}),(0,H.jsxs)(`td`,{className:`${Gy} tabular-nums`,children:[PC(d[n.key]),m&&(0,H.jsx)(`span`,{className:`block text-xs text-amber-600`,children:e(`Differs from default`)})]}),(0,H.jsx)(`td`,{className:Gy,children:e(n.unit)}),(0,H.jsx)(`td`,{className:Gy,children:e(n.affects)})]},n.key)})})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`submit`,disabled:a||!t||!f,onClick:()=>void h(),children:e(`Save memory limits`)}),(0,H.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i({}),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:y(s)})]})}var VC=`Enter a whole number from 50 to 100000.`;function HC(e){let t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,message:VC};let n=Number(t);return n<50||n>1e5?{ok:!1,message:VC}:{ok:!0,value:n}}function UC(e,t){let n=HC(t);return n.ok?n.value===e?{kind:`none`}:{kind:`edit`,edits:{userProfileAutoCleanupInterval:n.value}}:{kind:`error`,message:n.message}}function WC(e,t){return e===t?null:{userProfileAutoCleanupEnabled:t}}var GC=500;function KC(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),d=t?.settings.userProfileAutoCleanupEnabled?.globalValue!==!1,f=Number(t?.settings.userProfileAutoCleanupInterval?.globalValue??GC);(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>{e&&n(t)}).catch(t=>{e&&c(t.message)});let t=ny(t=>{e&&n(t)});return()=>{e=!1,t()}},[]),(0,v.useEffect)(()=>{t&&i(String(f))},[t,f]);async function p(n){if(t){u(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),c(e(`Saved. Changes apply at the next learning pass.`))}catch(e){c(e.message)}await ty(),u(!1)}}function m(){let t=UC(f,r);if(t.kind===`error`){o(e(t.message));return}o(``),t.kind===`edit`&&p(t.edits)}return(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e(`Automatic profile cleanup`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,disabled:l||!t,onChange:e=>{let t=WC(d,e.target.checked);t&&p(t)}}),e(`Clean up the profile automatically`)]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-cleanup-interval`,children:e(`Run every this many analysed prompts`)}),(0,H.jsx)(`input`,{id:`auto-cleanup-interval`,className:`w-28 rounded border border-border bg-background px-2 py-1`,inputMode:`numeric`,value:r,disabled:l||!t,"aria-invalid":a?!0:void 0,"aria-describedby":a?`auto-cleanup-interval-error`:void 0,onChange:e=>{i(e.target.value),o(``)}}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:l||!t||r.trim()===String(f),onClick:m,children:e(`Save interval`)})]}),a&&(0,H.jsx)(`p`,{id:`auto-cleanup-interval-error`,role:`alert`,className:`text-sm text-destructive`,children:a}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:s})]})}function qC({preview:e,job:t,busy:n,onStart:r,onPause:i}){let a=X(),o=t.state===`running`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`p`,{children:[a(`Prompts waiting for profile learning`),`: `,e.waiting,` ·`,` `,a(`Estimated profile analysis calls`),`: `,e.calls]}),t.state!==`idle`&&(0,H.jsxs)(`p`,{role:`status`,children:[a(`Batches done`),`: `,t.batchesBuilt,` · `,a(`Prompts waiting`),`: `,t.remaining,t.state===`paused`&&` · ${a(`Paused`)}`,t.state===`done`&&` · ${a(`Finished`)}`]}),t.state===`superseded`&&(0,H.jsx)(`p`,{children:a(`A newer catch-up run took over.`)}),t.state===`failed`&&(0,H.jsxs)(`p`,{className:`text-red-600`,children:[a(`Stopped`),`: `,t.reason??`error`]}),o?(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:i,children:a(`Pause`)}):(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:n||e.waiting===0,onClick:r,children:a(t.state===`idle`||t.state===`done`?`Analyse waiting prompts`:`Resume`)})]})}function JC({onReanalyse:e}={}){let t=X(),[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)({state:`idle`,batchesBuilt:0,remaining:0}),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);async function f(){let e=await Y(`/api/settings/profile/catch-up`);r(e.preview),a(e.job)}(0,v.useEffect)(()=>{f().catch(e=>d(e.message)),Y(`/api/web/status`).then(e=>s(!!e.isLocal)).catch(()=>{})},[]),(0,v.useEffect)(()=>{if(i.state!==`running`)return;let e=setInterval(()=>void f().catch(()=>{}),2e3);return()=>clearInterval(e)},[i.state]);async function p(){if(!n)return;let e=i.state!==`idle`&&i.state!==`done`;if(window.confirm(`${t(`Start profile learning for the waiting prompts? Model calls`)}: ${n.calls}`)){l(!0);try{a(await Y(`/api/settings/profile/catch-up/${e?`resume`:`start`}`,{method:`POST`,body:`{}`})),d(``)}catch(e){d(e.message)}l(!1)}}async function m(){try{a(await Y(`/api/settings/profile/catch-up/pause`,{method:`POST`,body:`{}`}))}catch(e){d(e.message)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Profile learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Profile learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.`)}),e&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,onClick:e,children:t(`Re-analyse chat history`)}),n&&(o?(0,H.jsx)(qC,{preview:n,job:i,busy:c,onStart:()=>void p(),onPause:()=>void m()}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Open this page on the computer that runs OMMS to start a catch-up run.`)})),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),(0,H.jsx)(KC,{})]})}function YC(e){let t=typeof e==`string`?e.trim():``;if(!t||!/^\d+$/.test(t))return;let n=Number(t);return n>=500&&n<=3e4?n:void 0}function XC(e){return/^(env:\/\/[A-Za-z_][A-Za-z0-9_]*|file:\/\/.+)$/.test(e.trim())}function ZC(e){try{let t=new URL(e.trim()).hostname.toLowerCase();return!(t===`localhost`||t===`::1`||t===`[::1]`||/^127\.\d+\.\d+\.\d+$/.test(t))}catch{return!1}}function QC(e){if(e.enabled&&(e.url.trim().length===0||e.model.trim().length===0))return{field:`url-model`};if(e.key.trim().length>0&&!XC(e.key))return{field:`key`};if(YC(e.timeout)===void 0)return{field:`timeout`}}function $C(e){return QC(e)===void 0}function ew(e){return{rerankerEnabled:e.enabled,rerankerApiUrl:e.url.trim()||null,rerankerModel:e.model.trim()||null,rerankerApiKey:e.key.trim()||null,rerankerTimeoutMs:YC(e.timeout)??4e3}}function tw(e){let t=e?.settings,n=e?.secrets.rerankerApiKey?.reference;return{enabled:t?.rerankerEnabled?.value===!0,url:typeof t?.rerankerApiUrl?.value==`string`?t.rerankerApiUrl.value:``,model:typeof t?.rerankerModel?.value==`string`?t.rerankerModel.value:``,key:e?.secrets.rerankerApiKey?.set?`${e.secrets.rerankerApiKey.source}://${n??``}`:``,timeout:typeof t?.rerankerTimeoutMs?.value==`number`?String(t.rerankerTimeoutMs.value):`4000`}}function nw(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({enabled:!1,url:``,model:``,key:``,timeout:`4000`}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=ey();Y(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(tw(r)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=ny(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||JSON.stringify(e)===JSON.stringify(tw(r))?tw(a):e)});return()=>{e=!1,r()}},[]);let d=QC(r),f=$C(r),p=r.url.trim().length>0&&ZC(r.url);function m(e){i(t=>({...t,...e}))}async function h(){if(a||l.current||!f)return;l.current=!0,o(!0);let e=!1,t;try{let n=await Y(`/api/settings/reranker/test`,{method:`POST`,body:JSON.stringify({rerankerApiUrl:r.url.trim()||void 0,rerankerModel:r.model.trim()||void 0,rerankerApiKey:r.key.trim()||void 0,rerankerTimeoutMs:YC(r.timeout)??4e3})});e=n.success===!0,t=n.code}catch{t=`reranker_unreachable`}o(!1),l.current=!1,c({kind:`test`,ok:e,code:t})}async function g(){if(!t||!f||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:ew(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await ty()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function _(t){if(t.kind===`load-failed`)return e(`The reranker settings could not be loaded. Reload the page to try again.`);if(t.kind===`test`)return t.ok?e(`Test passed.`):`${e(`Test failed:`)} ${t.code??`reranker_unreachable`}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ry(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use these settings.`):ry(e(`The reranker settings could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Reranker`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Reranker`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker reorders the best memory search results with your reranker server and keeps the top results.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file cannot change these settings. The reranker settings are global only.`)}),!r.enabled&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search is unchanged while the switch is off.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`reranker-enabled`,role:`switch`,checked:r.enabled,disabled:a,"aria-label":e(`Use a reranker`),onChange:e=>m({enabled:e.target.checked})}),(0,H.jsx)(Pp,{htmlFor:`reranker-enabled`,children:e(`Use a reranker`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-url`,children:e(`Server URL`)}),(0,H.jsx)(id,{type:`url`,id:`reranker-url`,dir:`ltr`,placeholder:`http://127.0.0.1:3008/v1`,disabled:a,value:r.url,"aria-invalid":d?.field===`url-model`||void 0,"aria-describedby":`reranker-url-help`,onChange:e=>m({url:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-url-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`url-model`?e(`Enter the server URL and model before turning the reranker on.`):`rerankerApiUrl`}),p&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`This URL is not on this machine: memory text leaves this machine.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-model`,children:e(`Model`)}),(0,H.jsx)(id,{type:`text`,id:`reranker-model`,dir:`ltr`,disabled:a,value:r.model,"aria-invalid":d?.field===`url-model`||void 0,onChange:e=>m({model:e.target.value})}),(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`rerankerModel`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-key`,children:e(`Key`)}),(0,H.jsx)(id,{type:`text`,id:`reranker-key`,dir:`ltr`,disabled:a,value:r.key,"aria-invalid":d?.field===`key`||void 0,"aria-describedby":`reranker-key-help`,onChange:e=>m({key:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-key-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`key`?e(`The key must be an env:// or file:// reference, or left empty.`):e(`Optional env:// or file:// key reference.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Pp,{htmlFor:`reranker-timeout`,children:e(`Timeout`)}),(0,H.jsx)(id,{type:`number`,id:`reranker-timeout`,className:`tabular-nums`,inputMode:`numeric`,step:1,min:500,max:3e4,disabled:a,value:r.timeout,"aria-invalid":d?.field===`timeout`||void 0,"aria-describedby":`reranker-timeout-help`,onChange:e=>m({timeout:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-timeout-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`timeout`?e(`Enter a whole number from 500 to 30,000.`):e(`milliseconds`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.`)})]})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(G,{type:`submit`,disabled:a||!t||!f,onClick:()=>void g(),children:e(`Save`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:a||!f,onClick:()=>void h(),children:e(`Test`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,disabled:a,onClick:()=>i(tw(t)),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:_(s)})]})}var rw=e=>{let t=e?.value??e?.globalValue;return t==null||t===``?null:String(t)};function iw(e,t){let n=rw(e?.maxMemories),r=rw(e?.similarityThreshold),i=rw(e?.keywordMode),a=rw(e?.rerankerModel);return{profile:{text:`Prompts waiting for profile learning, and re-analysis of old chats`},limits:n&&r?{text:`Results {results} · Similarity {similarity}`,params:{results:n,similarity:r}}:{text:`How many memories a search returns`},keywords:i?{text:`Mode: {mode}`,params:{mode:i}}:{text:`Keyword matching`},reranker:rw(e?.rerankerApiUrl)?a?{text:`On · {model}`,params:{model:a}}:{text:`On`}:{text:`Off`},maps:t?{text:`{saved} saved · {ignored} ignored`,params:t}:{text:`Saved maps and ignored directories`}}}function aw({id:e,title:t,summary:n,children:r}){return(0,H.jsxs)(`details`,{id:e,"data-shared-row":!0,className:`scroll-mt-20 rounded-xl border border-border bg-card`,children:[(0,H.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer flex-wrap items-baseline gap-x-3 gap-y-1 rounded-xl p-4 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h2`,{className:`text-subsection-title font-semibold`,children:t}),(0,H.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:n})]}),(0,H.jsx)(`div`,{className:`border-t border-border p-4`,children:r})]})}function ow({statuses:e,onReanalyse:t}){let n=X(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let e=!0,t=()=>{Y(`/api/settings`).then(t=>e&&i(t.settings)).catch(()=>{}),Y(`/api/settings/import-maps`).then(t=>e&&o({saved:t.saved.length,ignored:t.ignored?.length??0})).catch(()=>{})};t();let n=ny(t);return()=>{e=!1,n()}},[]);let s=iw(r,a),c=e=>Zx(n,s[e]);return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(bC,{current:`shared`,statuses:e}),(0,H.jsxs)(`header`,{className:`space-y-1`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:n(`Shared`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`These settings apply to every host. Open a row to change it.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(aw,{id:`shared-profile`,title:n(`Profile learning`),summary:c(`profile`),children:(0,H.jsx)(JC,{onReanalyse:t})}),(0,H.jsx)(aw,{id:`shared-limits`,title:n(`Memory limits`),summary:c(`limits`),children:(0,H.jsx)(BC,{})}),(0,H.jsx)(aw,{id:`shared-keywords`,title:n(`Keyword matching`),summary:c(`keywords`),children:(0,H.jsx)(AC,{})}),(0,H.jsx)(aw,{id:`shared-reranker`,title:n(`Reranker`),summary:c(`reranker`),children:(0,H.jsx)(nw,{})}),(0,H.jsx)(aw,{id:`shared-directory-maps`,title:n(`Directory maps`),summary:c(`maps`),children:(0,H.jsx)(Dx,{hosts:[]})})]})]})}var sw=3e3;function cw(){let e=X(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({pi:null,opencode:null,"claude-code":null}),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)({}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(nS(i,e=>u(e.message))),m=(0,v.useRef)(nS(o,e=>u(e.message))),h=()=>p.current(Y(`/api/settings/backfill`)),g=()=>m.current(Y(`/api/settings/backfill/runs`));(0,v.useEffect)(()=>{let e=!0;Y(`/api/settings`).then(t=>e&&n(t)).catch(t=>e&&u(t.message)),h(),g();for(let t of[`pi`,`opencode`])Y(`/api/settings/models?host=${t}`).then(n=>e&&c(e=>({...e,[t]:n}))).catch(()=>e&&c(e=>({...e,[t]:{available:!1}})));let t=ny(t=>{e&&(n(t),h())}),r=setInterval(()=>{e&&(h(),g())},sw);return()=>{e=!1,clearInterval(r),t()}},[]);async function _(n){if(t){f(!0);try{await Y(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),u(e(`Saved. Changes apply at the next run.`))}catch(e){u(e.message)}await ty(),f(!1)}}async function y(t,n){f(!0);let r=a?.[t]?.run?.state===`running`;try{await Y(`/api/settings/backfill/${t}/${n}`,{method:`POST`,body:`{}`}),u(e(n===`pause`?r?`Pausing after the current exchange.`:`Paused. No import starts until you resume.`:`Backfill started.`))}catch(e){u(e.message)}await Promise.all([g(),h()]),f(!1)}function b(t,n){try{_(Ax(t,n.trim()))}catch(t){u(e(t.message))}}return{snapshot:t,rows:r,runs:a,lists:s,message:l,busy:d,save:_,control:y,saveModel:b,setMessage:u}}var lw=6e4;function uw(){let e=cw(),[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(null),a=X();(0,v.useEffect)(()=>{let e=!0,t=()=>void Y(`/api/settings/imports/readiness`).then(t=>e&&n(t)).catch(()=>e&&n(null));t();let r=ny(t);return()=>{e=!1,r()}},[]),(0,v.useEffect)(()=>{let e=!0,t=()=>void Y(`/api/settings/last-saved`).then(t=>e&&i(t.hosts)).catch(()=>void 0);t();let n=ny(t),r=setInterval(t,lw);return()=>{e=!1,n(),clearInterval(r)}},[]);let o=e=>{let t=Ai(new Date(e),new Date),n=em(e);return t===`earlier`?`${$p(e)} ${n}`:a(t===`today`?`today {time}`:`yesterday {time}`).replaceAll(`{time}`,n)},s=n=>({host:n,run:e.runs?.[n]?.run??null,pending:e.rows[n]?.counts.pending??0,cutoff:e.rows[n]?.cutoff??null,runNowUnavailable:e.runs?.[n]?.runNowUnavailable??null,setUp:t?.defaultSourceFound?.[n]!==!1,formatDate:$p,lastSaved:r?.[n]??null,formatSaved:o});return{backfill:e,readiness:t,input:s,status:e=>Yx(s(e)),line:e=>Xx(s(e))}}function dw(){let e=dd(vf().split(`#`)[0]),t=uw(),[n,r]=(0,v.useState)(0);(0,v.useEffect)(()=>{sf(window.location.hash)},[e]);function i(){r(e=>e+1),gf(J.memory)}return(0,H.jsxs)(`div`,{className:`settings-view`,children:[e===null&&(0,H.jsx)(wC,{statuses:t,profilePreset:n}),e===`shared`&&(0,H.jsx)(ow,{statuses:t,onReanalyse:i}),e!==null&&e!==`shared`&&(0,H.jsx)(CC,{host:e,statuses:t,profilePreset:n})]})}function fw(e){return e.startsWith(`P`)?`border-blue-600/40 bg-blue-500/10 text-blue-700 hover:bg-blue-500/20 dark:text-blue-400`:`border-primary/30 bg-primary/10 text-primary-label hover:bg-primary/20`}function pw({label:e,deleted:t,onOpen:n}){let{t:r}=oa();return(0,H.jsx)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-label":r(`chat-cite-label`,{label:e}),onClick:n,className:V(`mx-0.5 inline-flex h-5 cursor-pointer items-center rounded-md border px-1.5 align-baseline text-[11px] font-medium tabular-nums transition-colors duration-200 ease-in focus-visible:outline-2 focus-visible:outline-ring`,fw(e),t&&`line-through opacity-70`),children:e})}function mw({label:e,text:t}){return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:V(`inline-flex h-5 items-center rounded-md border px-1.5 text-[11px] font-medium`,fw(e)),children:e}),(0,H.jsx)(`span`,{dir:`auto`,children:t})]})}function hw(){let{t:e}=oa();return(0,H.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(mw,{label:`S`,text:e(`chat-legend-memory`)}),(0,H.jsx)(mw,{label:`P`,text:e(`chat-legend-profile`)})]})}var gw=`/api/chat`,_w={"Content-Type":`application/json`},vw=15e4,yw=(e,t,n,r)=>W(`${gw}${e}`,{method:t,headers:_w,body:n===void 0?void 0:JSON.stringify(n),timeout:r}),bw={status:()=>W(`${gw}/status`),list:()=>W(`${gw}/conversations`),get:e=>W(`${gw}/conversations/${encodeURIComponent(e)}`),create:(e,t)=>yw(`/conversations`,`POST`,{folderId:e,scopeTag:t}),rename:(e,t)=>yw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{title:t}),move:(e,t)=>yw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{folderId:t}),remove:e=>yw(`/conversations/${encodeURIComponent(e)}`,`DELETE`),removeMany:e=>yw(`/conversations/bulk-delete`,`POST`,{ids:e}),ask:(e,t,n,r=!1)=>yw(`/conversations/${encodeURIComponent(e)}/messages`,`POST`,{question:t,scopeTag:n,retry:r},vw),createFolder:e=>yw(`/folders`,`POST`,{name:e}),renameFolder:(e,t)=>yw(`/folders/${encodeURIComponent(e)}`,`PATCH`,{name:t}),removeFolder:e=>yw(`/folders/${encodeURIComponent(e)}`,`DELETE`)},xw={conversations:[],folders:[],readOnly:!1};function Sw(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(xw),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),m=(0,v.useCallback)(async()=>{let e=await bw.list();e.success&&e.data&&r(e.data)},[]);(0,v.useEffect)(()=>{bw.status().then(e=>e.success&&e.data&&t(e.data)),W(`/api/tags`).then(e=>e.success&&e.data&&a(e.data.project)),m()},[m]);let h=(0,v.useCallback)(e=>e===null||i.some(t=>t.tag===e),[i]),g=(0,v.useCallback)(async e=>{let t=await bw.get(e);if(!t.success||!t.data)return void U.error(t.error??``);s(e),l(t.data);let n=t.data.conversation.scopeTag;d(h(n)?n:void 0)},[h]),_=(0,v.useCallback)(async(e=null)=>{let t=await bw.create(e,null);if(!t.success||!t.data)return void U.error(t.error??``);await m(),s(t.data.id),l({conversation:t.data,messages:[]}),d(null)},[m]),y=(0,v.useCallback)(async(e,t=!1)=>{if(u===void 0)return;let n=o;if(!n){let e=await bw.create(null,u);if(!e.success||!e.data)return void U.error(e.error??``);n=e.data.id,s(n),l({conversation:e.data,messages:[]})}p(e);let r=await bw.ask(n,e,u,t);if(p(null),!r.success||!r.data)return void U.error(r.error??``);await g(n),await m()},[o,u,g,m]),b=(0,v.useCallback)(e=>{let t=c?.messages??[],n=t[t.findIndex(t=>t.id===e.id)-1];n?.role===`user`&&y(n.content,!0)},[c,y]),x=(0,v.useCallback)(async e=>{o&&e.includes(o)&&(s(null),l(null),d(null)),await m()},[o,m]),S=(0,v.useCallback)(async e=>{let t=e.length===1?await bw.remove(e[0]):await bw.removeMany(e);if(!t.success)return void U.error(t.error??``);await x(e)},[x]),C=(0,v.useCallback)(async e=>{let t=n.conversations.filter(t=>t.folderId===e).map(e=>e.id),r=await bw.removeFolder(e);if(!r.success)return void U.error(r.error??``);await x(t)},[n,x]),w=(0,v.useCallback)(async e=>{let t=await e();return t.success?(await m(),o&&await g(o),null):t.code===`conflict`?`conflict`:t.error??`error`},[m,o,g]);return{status:e,list:n,projects:i,activeId:o,detail:c,scope:u,setScope:d,pending:f,scopeMissing:!!c&&u===void 0,open:g,newChat:_,ask:y,retry:b,deleteChats:S,deleteFolder:C,change:w}}var Cw=`__all__`,ww=`__choose__`;function Tw({projects:e,scope:t,scopeMissing:n,disabled:r,onScope:i,onAsk:a}){let{t:o}=oa(),[s,c]=(0,v.useState)(``),l=r||t===void 0;function u(e){e?.preventDefault(),!(l||!s.trim())&&(a(s.trim()),c(``))}function d(e){e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),u())}return(0,H.jsxs)(`form`,{onSubmit:u,className:`grid gap-2 rounded-2xl border border-border bg-card p-2.5 shadow-sm`,children:[(0,H.jsx)(Fp,{value:s,disabled:r,rows:2,maxLength:4e3,placeholder:o(`chat-input-placeholder`),"aria-label":o(`chat-input-placeholder`),className:`min-h-14 resize-none border-0 bg-transparent shadow-none focus-visible:ring-0`,onChange:e=>c(e.target.value),onKeyDown:d}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`shrink-0`,children:o(`chat-scope-label`)}),(0,H.jsxs)(Er,{className:`h-8 min-w-0 max-w-64 flex-1 text-xs`,"aria-label":o(`chat-scope-label`),disabled:r,value:t===void 0?ww:t??Cw,onChange:e=>{let t=e.target.value;t!==ww&&i(t===Cw?null:t)},children:[t===void 0?(0,H.jsx)(`option`,{value:ww,children:o(`chat-scope-missing`)}):null,(0,H.jsx)(`option`,{value:Cw,children:o(`chat-scope-all`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.projectName||e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(G,{type:`submit`,size:`sm`,disabled:l||!s.trim(),"aria-label":o(`chat-send`),children:[(0,H.jsx)(ee,{}),o(`chat-send`)]})]}),n?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`chat-scope-choose`)}):null]})}function Ew({status:e}){let{t}=oa();return(0,H.jsxs)(`div`,{role:`alert`,className:`grid gap-2 rounded-xl border border-border bg-card p-4`,children:[(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,H.jsx)(zt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t(`chat-setup-title`)]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`chat-setup-body`,{names:e.missing.join(`, `)})}),(0,H.jsxs)(`a`,{href:`/settings#settings-section-external-api`,className:`inline-flex w-fit items-center gap-1.5 text-sm text-primary-label underline-offset-4 hover:underline`,children:[(0,H.jsx)(Dt,{className:`size-3.5`,"aria-hidden":`true`}),t(`chat-setup-link`)]})]})}var Dw=`__none__`;function Ow({folders:e,folderId:t,onMove:n}){let{t:r}=oa();return(0,H.jsxs)(Er,{className:`h-8 w-full text-xs`,"aria-label":r(`chat-move`),value:t??Dw,onChange:e=>n(e.target.value===Dw?null:e.target.value),children:[(0,H.jsx)(`option`,{value:Dw,children:r(`chat-no-folder`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}function kw(e){let{t}=oa(),{conversation:n,active:r,selectMode:i}=e,a=n.title||t(`chat-new`);return i?(0,H.jsx)(`li`,{children:(0,H.jsxs)(`label`,{className:`flex min-h-11 md:min-h-9 cursor-pointer items-center gap-2 rounded-lg px-2 text-sm hover:bg-interactive-hover`,children:[(0,H.jsx)(Qo,{checked:e.selected,onCheckedChange:e.onToggleSelect,"aria-label":t(`chat-select-chat`,{title:a})}),(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate`,title:a,children:a})]})}):(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`div`,{className:V(`group flex items-center gap-1 rounded-lg`,r?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-interactive-hover`),children:[(0,H.jsx)(`button`,{type:`button`,className:`min-h-11 md:min-h-9 min-w-0 flex-1 cursor-pointer overflow-hidden rounded-lg px-2 text-start text-sm focus-visible:outline-2 focus-visible:outline-ring`,"aria-current":r?`true`:void 0,title:a,onClick:e.onOpen,children:(0,H.jsx)(`span`,{dir:`auto`,className:`block truncate`,children:a})}),e.readOnly?null:(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`me-1 shrink-0 text-muted-foreground`,"aria-label":t(`chat-chat-actions`),"aria-expanded":e.actionsOpen,onClick:e.onToggleActions,children:(0,H.jsx)(xe,{})})]}),e.actionsOpen?(0,H.jsxs)(`div`,{className:`ms-2 mt-1 mb-2 grid gap-1.5 rounded-lg border border-border bg-card p-2`,children:[(0,H.jsx)(Ow,{folders:e.folders,folderId:n.folderId,onMove:e.onMove}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`xs`,onClick:e.onRename,children:[(0,H.jsx)(pt,{}),t(`chat-rename`)]}),(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`xs`,onClick:e.onDelete,children:[(0,H.jsx)(Lt,{}),t(`chat-delete`)]})]})]}):null]})}function Aw({name:e,count:t,actions:n,onSelectAll:r,children:i}){let{t:a}=oa(),[o,s]=(0,v.useState)(!0),c=o?Oe:Ae;return(0,H.jsxs)(`section`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex min-h-11 md:min-h-8 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-lg px-1.5 text-xs font-medium text-muted-foreground transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,"aria-expanded":o,onClick:()=>s(!o),children:[(0,H.jsx)(ce,{className:V(`size-3.5 shrink-0 transition-transform rtl:-scale-x-100`,o&&`rotate-90`),"aria-hidden":`true`}),(0,H.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate uppercase tracking-wide`,children:e}),(0,H.jsx)(`span`,{className:`tabular-nums`,"aria-label":a(t===1?`chat-folder-count-one`:`chat-folder-count`,{count:t}),children:t})]}),r&&t>0?(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`xs`,onClick:r,children:a(`chat-select-all-folder`)}):null,n&&!r?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center`,role:`group`,"aria-label":a(`chat-folder-actions`),children:[(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-new`),title:a(`chat-new`),onClick:n.onNewChat,children:(0,H.jsx)(_t,{})}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-rename`),title:a(`chat-rename`),onClick:n.onRename,children:(0,H.jsx)(pt,{})}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-delete`),title:a(`chat-delete`),onClick:n.onDelete,children:(0,H.jsx)(Lt,{})})]}):null]}),o?(0,H.jsx)(`ul`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5 ps-3`,children:i}):null]})}function jw(e){let{t}=oa(),{chat:n,selectMode:r,selected:i}=e,[a,o]=(0,v.useState)(null),{conversations:s,folders:c,readOnly:l}=n.list,u=s.filter(e=>!e.folderId),d=e=>e===`conflict`?t(`chat-folder-exists`):e,f=t=>{let n=new Set(i);n.has(t)?n.delete(t):n.add(t),e.onSelected(n)},p=t=>e.onSelected(new Set([...i,...t])),m=r=>e.onName({title:t(`chat-chat-rename-title`),label:t(`chat-chat-title`),initial:r.title,submitLabel:t(`chat-save`),submit:e=>n.change(()=>bw.rename(r.id,e))}),h=t=>t.map(t=>(0,H.jsx)(kw,{conversation:t,folders:c,active:t.id===n.activeId,selectMode:r,selected:i.has(t.id),actionsOpen:a===t.id,readOnly:l,onOpen:()=>{n.open(t.id),e.onOpened?.()},onToggleSelect:()=>f(t.id),onToggleActions:()=>o(a===t.id?null:t.id),onRename:()=>m(t),onMove:e=>void n.change(()=>bw.move(t.id,e)),onDelete:()=>e.onDelete({kind:`chats`,ids:[t.id]})},t.id));return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:t(`chat-selected-count`,{count:i.size})}),(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`xs`,disabled:i.size===0,onClick:()=>e.onDelete({kind:`chats`,ids:[...i]}),children:[(0,H.jsx)(Lt,{}),t(`chat-delete-selected`)]}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>e.onSelectMode(!1),children:t(`chat-select-done`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{type:`button`,size:`xs`,disabled:l,onClick:()=>void n.newChat(),children:[(0,H.jsx)(_t,{}),t(`chat-new`)]}),(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`xs`,disabled:l,onClick:()=>e.onName({title:t(`chat-folder-create-title`),label:t(`chat-folder-name`),initial:``,submitLabel:t(`chat-create`),submit:async e=>d(await n.change(()=>bw.createFolder(e)))}),children:[(0,H.jsx)(ke,{}),t(`chat-new-folder`)]}),(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`xs`,disabled:l||s.length===0,onClick:()=>e.onSelectMode(!0),children:[(0,H.jsx)(At,{}),t(`chat-select`)]})]})}),s.length===0&&c.length===0?(0,H.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:t(`chat-empty-list`)}):null,c.map(i=>{let a=s.filter(e=>e.folderId===i.id);return(0,H.jsx)(Aw,{name:i.name,count:a.length,onSelectAll:r?()=>p(a.map(e=>e.id)):void 0,actions:l?void 0:{onNewChat:()=>void n.newChat(i.id),onRename:()=>e.onName({title:t(`chat-folder-rename-title`),label:t(`chat-folder-name`),initial:i.name,submitLabel:t(`chat-save`),submit:async e=>d(await n.change(()=>bw.renameFolder(i.id,e)))}),onDelete:()=>e.onDelete({kind:`folder`,id:i.id,name:i.name,count:a.length})},children:h(a)},i.id)}),u.length>0?(0,H.jsx)(Aw,{name:t(`chat-no-folder`),count:u.length,onSelectAll:r?()=>p(u.map(e=>e.id)):void 0,children:h(u)}):null]})}function Mw({request:e,onConfirm:t,onCancel:n}){let{t:r}=oa(),[i,a]=(0,v.useState)(!1);return(0,H.jsx)(K,{open:e!==null,onOpenChange:e=>!e&&!i&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:e?.kind===`folder`?r(`chat-delete-folder-title`):r(`chat-delete-chats-title`)}),(0,H.jsx)(Wl,{children:e?Nw(e,r):null})]}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:n,disabled:i,children:r(`chat-cancel`)}),(0,H.jsx)(G,{type:`button`,variant:`destructive`,disabled:i,onClick:async()=>{e&&(a(!0),await t(e),a(!1))},children:r(`chat-delete-confirm`)})]})]})})}function Nw(e,t){if(e.kind===`folder`)return t(e.count===1?`chat-delete-folder-body-one`:`chat-delete-folder-body`,{name:e.name,count:e.count});let n=e.ids.length;return t(n===1?`chat-delete-chats-body-one`:`chat-delete-chats-body`,{count:n})}function Pw({request:e,onClose:t}){let{t:n}=oa(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{i(e?.initial??``),o(null)},[e]);async function l(n){if(n.preventDefault(),!e||!r.trim())return;c(!0);let i=await e.submit(r.trim());c(!1),i?o(i):t()}return(0,H.jsx)(K,{open:e!==null,onOpenChange:e=>!e&&t(),children:(0,H.jsx)(q,{className:`sm:max-w-sm`,children:(0,H.jsxs)(`form`,{onSubmit:l,className:`grid gap-4`,children:[(0,H.jsx)(Vl,{children:(0,H.jsx)(Ul,{children:e?.title})}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(Pp,{htmlFor:`chat-name-input`,children:e?.label}),(0,H.jsx)(id,{id:`chat-name-input`,value:r,maxLength:80,autoFocus:!0,"aria-invalid":a?!0:void 0,onChange:e=>i(e.target.value)}),a?(0,H.jsx)(`p`,{className:`text-xs text-destructive-label`,children:a}):null]}),(0,H.jsxs)(Hl,{children:[(0,H.jsx)(G,{type:`button`,variant:`secondary`,onClick:t,children:n(`chat-cancel`)}),(0,H.jsx)(G,{type:`submit`,disabled:s||!r.trim(),children:e?.submitLabel})]})]})})})}var Fw=/\[([SP]\d+)\]/g,Iw=/<(?:[^>"']|"[^"]*"|'[^']*')*>/g,Lw=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,Rw=new Set([`a`,`code`,`pre`,`button`]);function zw(e,t,n,r){let i=new Set(t),a=(e,t)=>{if(!i.has(t))return e;let a=[`cite-chip`];t.startsWith(`P`)&&a.push(`cite-profile`),n(t)&&a.push(`cite-deleted`);let o=r(t).replace(/["&<>]/g,e=>`&#${e.charCodeAt(0)};`);return`<button type="button" class="${a.join(` `)}" data-cite="${t}" aria-haspopup="dialog" aria-label="${o}">${t}</button>`},o=``,s=0,c=0,l=(t,n)=>{let r=e.slice(t,n);o+=c>0?r:r.replace(Fw,a)};for(let t of e.matchAll(Iw)){l(s,t.index),o+=t[0],s=t.index+t[0].length;let e=Lw.exec(t[0]);!e||!Rw.has(e[2].toLowerCase())||(e[1]?c=Math.max(0,c-1):c+=1)}return l(s,e.length),o}var Bw=/\[([SP]\d+)\]/g;function Vw(e,t){let n=new Set(t),r=[],i=``,a=0;for(let t of e.matchAll(Bw)){let o=t[1];n.has(o)&&(i+=e.slice(a,t.index),i&&r.push({kind:`text`,text:i}),i=``,r.push({kind:`cite`,label:o}),a=t.index+t[0].length)}return i+=e.slice(a),i&&r.push({kind:`text`,text:i}),r}function Hw(e,t){let n=[];for(let r of Vw(e,t))r.kind===`cite`&&!n.includes(r.label)&&n.push(r.label);return n}function Uw({plan:e}){let{t}=oa(),n=[[t(`chat-search-phrases`),e.queries],[t(`chat-search-tags`),e.tags],[t(`chat-search-categories`),e.profileCategories]];return(0,H.jsxs)(`details`,{className:`group text-xs text-muted-foreground`,children:[(0,H.jsxs)(`summary`,{className:`inline-flex cursor-pointer list-none items-center gap-1.5 rounded-md py-0.5 transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(Tt,{className:`size-3`,"aria-hidden":`true`}),t(`chat-how-searched`)]}),(0,H.jsxs)(`div`,{className:`mt-2 grid gap-1.5 rounded-lg border border-border p-2.5`,children:[e.skipped?(0,H.jsx)(`p`,{children:t(`chat-plan-skipped`)}):null,(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:n.map(([e,n])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{children:e}),(0,H.jsx)(`dd`,{dir:`auto`,className:`min-w-0 break-words text-foreground`,children:n.length?n.join(` · `):t(`chat-none`)})]},e))})]})]})}var Ww={no_sources:`chat-no-sources`,insufficient:`chat-insufficient`,uncited:`chat-uncited`};function Gw({message:e,missingMemoryIds:t,readOnly:n,onOpenSource:r,onRetry:i}){let{t:a}=oa(),o=e.sources.map(e=>e.label),s=new Map(e.sources.map(e=>[e.label,e])),c=e=>!!e&&e.kind===`memory`&&t.has(e.id),l=(0,v.useMemo)(()=>zw(h_(e.content),o,e=>c(s.get(e)),e=>a(`chat-cite-label`,{label:e})),[e.content,e.sources,t,a]),u=e=>{let t=e.target.closest(`[data-cite]`),n=t?s.get(t.dataset.cite??``):void 0;n&&r(n)},d=Hw(e.content,o).map(e=>s.get(e)).filter(e=>!!e);return(0,H.jsxs)(`article`,{className:`grid min-w-0 gap-2.5`,children:[e.errorCode?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-2.5 text-sm text-destructive-label`,children:[(0,H.jsx)(zt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:a(`chat-error`,{code:e.errorCode})}),n?null:(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>i(e),children:[(0,H.jsx)(wt,{}),a(`chat-retry`)]})]}):null,e.content?(0,H.jsx)(`div`,{dir:`auto`,className:`markdown-content chat-answer break-words text-sm leading-7`,onClick:u,dangerouslySetInnerHTML:{__html:l}}):null,e.notice?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),a(Ww[e.notice])]}):null,d.length?(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:a(`chat-sources`)}),(0,H.jsx)(`ul`,{className:`grid gap-1`,children:d.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 text-xs`,children:[(0,H.jsx)(pw,{label:e.label,deleted:c(e),onOpen:()=>r(e)}),(0,H.jsxs)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate leading-5 text-muted-foreground`,children:[e.projectName?`${e.projectName} · `:``,e.text]})]},e.label))})]}):null,e.plan?(0,H.jsx)(Uw,{plan:e.plan}):null]})}function Kw({text:e}){let{t}=oa();return(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsxs)(`div`,{className:`max-w-[85%] rounded-2xl rounded-ee-md bg-secondary px-3.5 py-2.5`,children:[(0,H.jsxs)(`span`,{className:`sr-only`,children:[t(`chat-you`),`: `]}),(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e})]})})}function qw({messages:e,pending:t,missingMemoryIds:n,readOnly:r,onOpenSource:i,onRetry:a}){let{t:o}=oa();return e.length===0&&!t?(0,H.jsx)(`p`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:o(`chat-empty-thread`)}):(0,H.jsxs)(`ol`,{className:`grid gap-6`,"aria-live":`polite`,children:[e.map(e=>(0,H.jsx)(`li`,{children:e.role===`user`?(0,H.jsx)(Kw,{text:e.content}):(0,H.jsx)(Gw,{message:e,missingMemoryIds:n,readOnly:r,onOpenSource:i,onRetry:a})},e.id)),t?(0,H.jsxs)(`li`,{className:`grid gap-4`,children:[e.at(-1)?.role===`user`&&e.at(-1)?.content===t?null:(0,H.jsx)(Kw,{text:t}),(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),o(`chat-thinking`)]})]}):null]})}var Jw={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function Yw({source:e,deleted:t}){let{t:n,language:r}=oa(),i=e.kind===`memory`;return(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[t?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-border bg-muted/40 p-2.5 text-xs`,children:[(0,H.jsx)(zt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),n(`chat-source-deleted`)]}):null,(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[i&&e.projectName?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-project`)}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words text-foreground`,children:e.projectName})]}):null,i&&e.createdAt?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-date`)}),(0,H.jsx)(`dd`,{className:`text-foreground`,children:Zp(new Date(e.createdAt).toISOString())})]}):null,!i&&e.section?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-profile`)}),(0,H.jsxs)(`dd`,{className:`text-foreground`,children:[n(Jw[e.section]),e.category?` · ${e.category}`:``]})]}):null]}),e.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n(`chat-source-tags`),children:e.tags.map(e=>(0,H.jsx)(rd,{variant:`outline`,children:e},e))}):null,(0,H.jsx)(Pv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[45vh] rounded-lg border`,children:(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words p-3 text-sm leading-6`,children:e.text})}),!i&&e.evidence?.length?(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:n(`chat-source-evidence`)}),(0,H.jsx)(`ul`,{className:`grid gap-1 text-xs`,children:e.evidence.map((e,t)=>(0,H.jsx)(`li`,{dir:`auto`,className:`break-words`,children:e},t))})]}):null,(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`chat-source-note`)}),i?(0,H.jsx)(`a`,{href:J.project,className:`text-xs text-primary-label underline-offset-4 hover:underline`,children:n(`chat-source-open-project`)}):null]})}function Xw({source:e,deleted:t,onClose:n}){let{t:r}=oa();return(0,H.jsx)(K,{open:e!==null,onOpenChange:e=>!e&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Vl,{children:[(0,H.jsx)(Ul,{children:e?`${e.label} · ${e.kind===`memory`?r(`chat-source-memory`):r(`chat-source-profile`)}`:``}),(0,H.jsx)(Wl,{className:`sr-only`,children:e?.text.slice(0,120)})]}),e?(0,H.jsx)(Yw,{source:e,deleted:t}):null]})})}function Zw(){let{t:e}=oa(),t=Sw(),[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null),a=(0,v.useRef)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(new Set),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!n)return;let e=i.current;return a.current?.focus(),()=>e?.focus()},[n]);let g=new Set(t.detail?.missingMemoryIds??[]),_=t.list.readOnly,y=t.status?.ready??!1;function b(e){s(e),l(new Set)}async function x(e){e.kind===`folder`?await t.deleteFolder(e.id):await t.deleteChats(e.ids),d(null),b(!1)}let S=(0,H.jsx)(jw,{chat:t,selectMode:o,selected:c,onSelectMode:b,onSelected:l,onDelete:d,onName:p,onOpened:()=>r(!1)});return(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100svh-9rem)] gap-4 md:grid-cols-[17rem_minmax(0,1fr)]`,children:[(0,H.jsx)(`aside`,{className:`hidden min-h-0 overflow-y-auto border-e border-border pe-4 md:sticky md:top-6 md:block md:max-h-[calc(100svh-3rem)] md:self-start`,children:S}),n?(0,H.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`chat-show-list`),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:[(0,H.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/50`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1)}),(0,H.jsxs)(`div`,{className:`absolute inset-y-0 start-0 flex w-[min(20rem,85vw)] flex-col gap-3 overflow-y-auto bg-background p-4 shadow-xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:e(`chat-conversations`)}),(0,H.jsx)(G,{ref:a,type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1),children:(0,H.jsx)(Kt,{})})]}),S]})]}):null,(0,H.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,children:[(0,H.jsxs)(G,{ref:i,type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(!0),children:[(0,H.jsx)(Qe,{}),e(`chat-show-list`)]}),t.detail?(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-sm text-muted-foreground`,children:t.detail.conversation.title}):null]}),(0,H.jsx)(hw,{}),t.status&&!y?(0,H.jsx)(Ew,{status:t.status}):null,_?(0,H.jsx)(`p`,{role:`alert`,className:`rounded-xl border border-border bg-card p-3 text-sm`,children:e(`chat-read-only`)}):null,(0,H.jsx)(`div`,{className:V(`flex min-h-48 flex-1 flex-col overflow-y-auto`),children:(0,H.jsx)(qw,{messages:t.detail?.messages??[],pending:t.pending,missingMemoryIds:g,readOnly:_||!y,onOpenSource:h,onRetry:t.retry})}),(0,H.jsxs)(`div`,{className:`sticky bottom-0 grid gap-1.5 bg-background pb-1`,children:[(0,H.jsx)(Tw,{projects:t.projects,scope:t.scope,scopeMissing:t.scopeMissing,disabled:!y||_||t.pending!==null,onScope:t.setScope,onAsk:e=>void t.ask(e)}),y&&t.status?.apiHost?(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":`true`}),e(`chat-provider-note`,{host:t.status.apiHost})]}):null]})]}),(0,H.jsx)(Mw,{request:u,onConfirm:x,onCancel:()=>d(null)}),(0,H.jsx)(Pw,{request:f,onClose:()=>p(null)}),(0,H.jsx)(Xw,{source:m,deleted:!!m&&m.kind===`memory`&&g.has(m.id),onClose:()=>h(null)})]})}var Qw=[`all`,`not-modified`,`modified`,`suggested`],$w=`omms-skills-modified-filter`;function eT(e){let t=e.filter(e=>e.modified).length,n=e.filter(e=>e.suggested).length;return{all:e.length,"not-modified":e.length-t,modified:t,suggested:n}}function tT(e,t){return t===`all`?e:t===`suggested`?e.filter(e=>e.suggested):e.filter(e=>e.modified===(t===`modified`))}function nT(){try{let e=localStorage.getItem($w);return Qw.find(t=>t===e)??`all`}catch{return`all`}}function rT(e){try{localStorage.setItem($w,e)}catch{}}var iT=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0,aT=e=>Array.isArray(e)?e:[],oT=e=>e&&typeof e==`object`?e:{};function sT(e){return aT(e).map(oT).filter(e=>typeof e.day==`string`).map(e=>({day:e.day,uses:iT(e.uses),failed:iT(e.failed)}))}var cT=e=>e.map(({day:e,uses:t,failed:n})=>({key:e,uses:t,failed:n})),lT=[`day`,`month`,`year`],uT=/^\d{4}-(0[1-9]|1[0-2])$/;function dT(e){let t=oT(e);return{months:aT(t.months).filter(e=>typeof e==`string`&&uT.test(e)),years:aT(t.years).filter(e=>Number.isInteger(e))}}function fT(e){let t=oT(e),n=oT(t.totals),r=sT(t.days),i=Array.isArray(t.series)?t.series.map(oT).filter(e=>typeof e.key==`string`).map(e=>({key:e.key,uses:iT(e.uses),failed:iT(e.failed)})):cT(r),a=aT(t.topSkills).map(oT).filter(e=>typeof e.name==`string`).map(e=>({name:e.name,path:typeof e.path==`string`?e.path:null,uses:iT(e.uses),failed:iT(e.failed)}));return{bucket:lT.includes(t.bucket)?t.bucket:`day`,series:i,days:r,topSkills:a,topTotal:Math.max(iT(t.topTotal),a.length),totals:{uses:iT(n.uses),failed:iT(n.failed),activeSkills:iT(n.activeSkills)},available:dT(t.available)}}var pT=[`created`,`applied`,`rejected`,`undone`,`stale`];function mT(e){let t=oT(e),n=aT(t.entries).map(oT).filter(e=>pT.includes(e.kind)&&typeof e.id==`string`).map(e=>({id:e.id,proposalId:typeof e.proposalId==`string`?e.proposalId:``,kind:e.kind,at:iT(e.at),summary:typeof e.summary==`string`?e.summary:``,appliedBy:typeof e.appliedBy==`string`?e.appliedBy:null,versionId:typeof e.versionId==`string`?e.versionId:null,canUndo:e.canUndo===!0,laterAppliedCount:iT(e.laterAppliedCount),added:iT(e.added),removed:iT(e.removed)}));return{total:Math.max(iT(t.total),n.length),entries:n}}var hT=e=>e.every(e=>e.uses===0),gT=e=>({...e,succeeded:Math.max(0,e.uses-e.failed),failed:Math.min(e.failed,e.uses)}),_T=[`pending`,`applied`,`rejected`,`stale`,`undone`];function vT(e){return _T.map(t=>({state:t,count:e.filter(e=>e.state===t).length}))}var yT=e=>Date.parse(`${e}T12:00:00`),bT={bucket:`day`,month:null},xT=`omms-skills-activity-range`,ST=`last-30`,CT=30,wT=(e,t)=>Math.min(t,e+8),TT={day:`Uses per day`,month:`Uses per month`,year:`Uses per year`},ET={day:`Day`,month:`Month`,year:`Year`};function DT(e){return e.bucket===`year`?{bucket:`year`}:e.bucket===`month`?{bucket:`month`,year:e.year}:e.month?{bucket:`day`,month:e.month}:{bucket:`day`,days:CT}}function OT(e){return e.bucket===`year`?`year`:e.bucket===`month`?`month:${e.year}`:e.month?`day:${e.month}`:`day`}function kT(e){if(e===`year`)return{bucket:`year`};let t=/^day:(\d{4}-\d{2})$/.exec(e??``)?.[1];if(t&&uT.test(t))return{bucket:`day`,month:t};let n=/^month:(\d{4})$/.exec(e??``)?.[1];return n?{bucket:`month`,year:Number(n)}:bT}function AT(e,t){return e.bucket===`day`&&e.month&&!t.months.includes(e.month)||e.bucket===`month`&&!t.years.includes(e.year)?bT:e}function jT(e,t){return e===`year`?{bucket:e}:e===`month`?{bucket:e,year:t}:bT}var MT=e=>e.bucket===`month`?String(e.year):e.bucket===`day`?e.month??`last-30`:``;function NT(e,t){return e.bucket===`month`?{bucket:`month`,year:Number(t)}:t===`last-30`?bT:{bucket:`day`,month:t}}function PT(e,t,n,r){if(e===`year`)return t;if(e===`day`){let e=new Date(yT(t));return n?Oi(e,r.choice,r.locale):Di(e,r.choice,r.locale)}let[i,a]=t.split(`-`).map(Number);return new Intl.DateTimeFormat(r.locale,{month:n?`long`:`short`,...n?{year:`numeric`}:{},timeZone:`UTC`,calendar:`gregory`}).format(Date.UTC(i,a-1,1))}function FT(e,t,n,r){if(e.bucket===`month`)return String(e.year);if(e.bucket===`day`)return e.month?PT(`month`,e.month,!0,n):r(`Last 30 days`);let i=t[0]?.key??``,a=t.at(-1)?.key??``;return i===a?a:Vb(r(`{from} to {to}`),{from:i,to:a})}function IT(e,t,n,r,i){if(e.bucket===`year`)return[];if(e.bucket===`month`)return[...new Set([n,e.year,...t.years])].sort((e,t)=>t-e).map(e=>({value:String(e),label:String(e)}));let a=[...new Set([...e.month?[e.month]:[],...t.months])];return[{value:ST,label:i},...a.sort((e,t)=>t.localeCompare(e)).map(e=>({value:e,label:PT(`month`,e,!0,r)}))]}var LT=[`day`,`month`,`year`],RT={day:`Days`,month:`Months`,year:`Years`},zT={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function BT({range:e,available:t,currentYear:n,loading:r,onChange:i}){let a=X(),o=(0,v.useRef)([]),s=t=>{let r=LT[t];o.current[t]?.focus(),r!==e.bucket&&i(jT(r,n))};return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":a(`Show uses by`),className:`inline-flex gap-1.5`,onKeyDown:t=>{let n=zT[t.key];if(!n)return;t.preventDefault();let r=getComputedStyle(t.currentTarget).direction===`rtl`,i=t.key===`ArrowLeft`||t.key===`ArrowRight`,a=r&&i?-n:n,o=LT.indexOf(e.bucket);s((o+a+LT.length)%LT.length)},children:LT.map((t,n)=>(0,H.jsx)(`button`,{ref:e=>{o.current[n]=e},type:`button`,role:`radio`,"aria-checked":e.bucket===t,tabIndex:e.bucket===t?0:-1,className:V(`min-h-9 rounded-[10px] border px-3 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring`,e.bucket===t?`border-primary/40 bg-selection text-foreground`:`border-input bg-card text-muted-foreground hover:bg-interactive-hover`),onClick:()=>s(n),children:a(RT[t])},t))}),e.bucket===`year`?(0,H.jsx)(`span`,{className:`h-9 w-44`,"aria-hidden":`true`}):(0,H.jsx)(Er,{className:`w-44`,"aria-label":a(e.bucket===`day`?`Days to show`:`Year to show`),value:MT(e),onChange:t=>i(NT(e,t.target.value)),children:IT(e,t,n,tm(),a(`Last 30 days`)).map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,H.jsx)(Je,{"aria-hidden":`true`,className:V(`size-4 animate-spin text-muted-foreground`,!r&&`invisible`)}),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:r?a(`Loading…`):``})]})}var VT=`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`.split(`.`);function HT(e){return typeof e==`string`&&VT.includes(e)}var UT=new Set(`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`.split(`.`));function WT(e){return typeof e==`string`&&UT.has(e)}function GT(e){return typeof e==`string`&&e.startsWith(`data-`)}function KT(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(WT(n)||GT(n))&&(t[n]=e[n]);return t}function qT(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return KT(t)}return typeof e==`object`&&!Array.isArray(e)?KT(e):null}function JT(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(WT(n)||GT(n)||HT(n))&&(t[n]=e[n]);return t}var YT=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function XT(){return XT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},XT.apply(null,arguments)}function ZT(e,t){if(e==null)return{};var n,r,i=QT(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function QT(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var $T=(0,v.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:c,desc:l}=e,u=ZT(e,YT),d=a||{width:r,height:i,x:0,y:0},f=Yt(`recharts-surface`,o);return v.createElement(`svg`,XT({},JT(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),eE=[`children`,`className`];function tE(){return tE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tE.apply(null,arguments)}function nE(e,t){if(e==null)return{};var n,r,i=rE(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function rE(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var iE=v.forwardRef((e,t)=>{var{children:n,className:r}=e,i=nE(e,eE),a=Yt(`recharts-layer`,r);return v.createElement(`g`,tE({className:a},JT(i),{ref:t}),n)}),aE=(0,v.createContext)(null);function oE(e){return function(){return e}}var sE=Math.cos,cE=Math.sin,lE=Math.sqrt,uE=Math.PI;uE/2;var dE=2*uE,fE=Math.PI,pE=2*fE,mE=1e-6,hE=pE-mE;function gE(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function _E(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return gE;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var vE=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?gE:_E(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>mE){if(!(Math.abs(u*s-c*l)>mE)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((fE-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>mE&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>mE||Math.abs(this._y1-l)>mE)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%pE+pE),d>hE?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>mE&&this._append`A${n},${n},0,${+(d>=fE)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};vE.prototype;function yE(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new vE(t)}Array.prototype.slice;function bE(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function xE(e){this._context=e}xE.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)}}};function SE(e){return new xE(e)}function CE(e){return e[0]}function wE(e){return e[1]}function TE(e,t){var n=oE(!0),r=null,i=SE,a=null,o=yE(s);e=typeof e==`function`?e:e===void 0?CE:oE(e),t=typeof t==`function`?t:t===void 0?wE:oE(t);function s(s){var c,l=(s=bE(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:oE(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:oE(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:oE(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function EE(e,t,n){var r=null,i=oE(!0),a=null,o=SE,s=null,c=yE(l);e=typeof e==`function`?e:e===void 0?CE:oE(+e),t=typeof t==`function`?t:oE(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?wE:oE(+n);function l(l){var u,d,f,p=(l=bE(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return TE().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:oE(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:oE(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:oE(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:oE(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:oE(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:oE(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:oE(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var DE=class{constructor(e,t){this._context=e,this._x=t}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(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._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function OE(e){return new DE(e,!0)}function kE(e){return new DE(e,!1)}var AE={draw(e,t){let n=lE(t/uE);e.moveTo(n,0),e.arc(0,0,n,0,dE)}},jE={draw(e,t){let n=lE(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},ME=lE(1/3),NE=ME*2,PE={draw(e,t){let n=lE(t/NE),r=n*ME;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},FE={draw(e,t){let n=lE(t),r=-n/2;e.rect(r,r,n,n)}},IE=.8908130915292852,LE=cE(uE/10)/cE(7*uE/10),RE=cE(dE/10)*LE,zE=-sE(dE/10)*LE,BE={draw(e,t){let n=lE(t*IE),r=RE*n,i=zE*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=dE*t/5,o=sE(a),s=cE(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},VE=lE(3),HE={draw(e,t){let n=-lE(t/(VE*3));e.moveTo(0,n*2),e.lineTo(-VE*n,-n),e.lineTo(VE*n,-n),e.closePath()}},UE=-.5,WE=lE(3)/2,GE=1/lE(12),KE=(GE/2+1)*3,qE={draw(e,t){let n=lE(t/KE),r=n/2,i=n*GE,a=r,o=n*GE+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(UE*r-WE*i,WE*r+UE*i),e.lineTo(UE*a-WE*o,WE*a+UE*o),e.lineTo(UE*s-WE*c,WE*s+UE*c),e.lineTo(UE*r+WE*i,UE*i-WE*r),e.lineTo(UE*a+WE*o,UE*o-WE*a),e.lineTo(UE*s+WE*c,UE*c-WE*s),e.closePath()}};function JE(e,t){let n=null,r=yE(i);e=typeof e==`function`?e:oE(e||AE),t=typeof t==`function`?t:oE(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:oE(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:oE(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function YE(){}function XE(e,t,n){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+n)/6)}function ZE(e){this._context=e}ZE.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:XE(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(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:XE(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function QE(e){return new ZE(e)}function $E(e){this._context=e}$E.prototype={areaStart:YE,areaEnd:YE,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)}},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:XE(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function eD(e){return new $E(e)}function tD(e){this._context=e}tD.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 n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:XE(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function nD(e){return new tD(e)}function rD(e){this._context=e}rD.prototype={areaStart:YE,areaEnd:YE,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 iD(e){return new rD(e)}function aD(e){return e<0?-1:1}function oD(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(aD(a)+aD(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function sD(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function cD(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function lD(e){this._context=e}lD.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:cD(this,this._t0,sD(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=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,cD(this,sD(this,n=oD(this,e,t)),n);break;default:cD(this,this._t0,n=oD(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function uD(e){this._context=new dD(e)}(uD.prototype=Object.create(lD.prototype)).point=function(e,t){lD.prototype.point.call(this,t,e)};function dD(e){this._context=e}dD.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,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function fD(e){return new lD(e)}function pD(e){return new uD(e)}function mD(e){this._context=e}mD.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,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=hD(e),i=hD(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===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 hD(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function gD(e){return new mD(e)}function _D(e,t){this._context=e,this._t=t}_D.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 n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function vD(e){return new _D(e,.5)}function yD(e){return new _D(e,0)}function bD(e){return new _D(e,1)}function xD(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function SD(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function CD(e,t){return e[t]}function wD(e){let t=[];return t.key=e,t}function TD(){var e=oE([]),t=SD,n=xD,r=CD;function i(i){var a=Array.from(e.apply(this,arguments),wD),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=bE(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:oE(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:oE(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?SD:typeof e==`function`?e:oE(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??xD,i):n},i}function ED(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}xD(e,t)}}function DD(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}xD(e,t)}}function OD(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,xD(e,t)}}function kD(e){return e===`__proto__`}var AD=Object.prototype.hasOwnProperty;function jD(e,t){return AD.call(e,t)}var MD=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function ND(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:MD.test(e);default:return!1}}function PD(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function FD(e){return typeof e==`symbol`||e instanceof Symbol}function ID(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n<e.length;n++)n>0&&(t+=`,`),t+=ID(e[n]);return t}if(FD(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function LD(e){return e==null?``:ID(e)}function RD(e){if(Array.isArray(e))return e.map(PD);if(typeof e==`symbol`)return[e];e=LD(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let l=e[r];if(a)l===`\\`&&r+1<n?(r++,i+=e[r]):l===a?a=``:i+=l;else if(o){if(l===`"`||l===`'`)a=l,s=!0;else if(l===`]`){if(o=!1,!s&&i.includes(`.`)&&!c.test(i)){let e=i.split(`.`);for(let n=0;n<e.length;n++)e[n]!==``&&t.push(e[n])}else t.push(i);i=``}else i+=l}else if(l===`[`)o=!0,s=!1,i&&=(t.push(i),``);else if(l===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=l;r++}return i&&t.push(i),t}function zD(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(kD(t))return n;let r=e[t];return r===void 0?ND(t)&&!jD(e,t)?zD(e,RD(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=PD(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return BD(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),kD(t))return n;let r=e[t];return r===void 0?n:r}}}function BD(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||kD(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var VD=4;function HD(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:VD),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function UD(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+HD(i)+n},``)}var WD=e=>e===0?0:e>0?1:-1,GD=e=>typeof e==`number`&&e!=+e,KD=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,Z=e=>(typeof e==`number`||e instanceof Number)&&!GD(e),qD=e=>Z(e)||typeof e==`string`,JD=0,YD=e=>{var t=++JD;return`${e||``}${t}`},XD=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!Z(e)&&typeof e!=`string`)return n;var i;if(KD(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return GD(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},ZD=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function QD(e,t,n){return Z(e)&&Z(t)?HD(e+n*(t-e)):t}function $D(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):zD(e,t))===n)}var eO=e=>e==null,tO=e=>eO(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function nO(e){return e!=null}function rO(){}var iO=[`type`,`size`,`sizeType`];function aO(){return aO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},aO.apply(null,arguments)}function oO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?oO(Object(n),!0).forEach(function(t){cO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cO(e,t,n){return(t=lO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lO(e){var t=uO(e,`string`);return typeof t==`symbol`?t:t+``}function uO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function dO(e,t){if(e==null)return{};var n,r,i=fO(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function fO(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var pO={symbolCircle:AE,symbolCross:jE,symbolDiamond:PE,symbolSquare:FE,symbolStar:BE,symbolTriangle:HE,symbolWye:qE},mO=Math.PI/180,hO=e=>pO[`symbol${tO(e)}`]||AE,gO=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*mO;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**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}},_O=(e,t)=>{pO[`symbol${tO(e)}`]=t},vO=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=sO(sO({},dO(e,iO)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=hO(a),t=JE().type(e).size(gO(n,r,a))();if(t!==null)return t},{className:s,cx:c,cy:l}=i,u=JT(i);return Z(c)&&Z(l)&&Z(n)?v.createElement(`path`,aO({},u,{className:Yt(`recharts-symbols`,s),transform:`translate(${c}, ${l})`,d:o()})):null};vO.registerSymbol=_O;var yO=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,bO=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{HT(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},xO=(e,t,n)=>r=>(e(t,n,r),null),SO=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];HT(i)&&typeof a==`function`&&(r||={},r[i]=xO(a,t,n))}),r};function CO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?CO(Object(n),!0).forEach(function(t){TO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function TO(e,t,n){return(t=EO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EO(e){var t=DO(e,`string`);return typeof t==`symbol`?t:t+``}function DO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function OO(e,t){var n=wO({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function kO(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function AO(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function jO(e){return e}function MO(e){return Number.isSafeInteger(e)&&e>=0}function NO(e){return e!=null&&typeof e!=`function`&&MO(e.length)}function PO(e){return function(t){return zD(t,e)}}function FO(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function IO(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var LO=`[object RegExp]`,RO=`[object String]`,zO=`[object Number]`,BO=`[object Boolean]`,VO=`[object Arguments]`,HO=`[object Symbol]`,UO=`[object Date]`,WO=`[object Map]`,GO=`[object Set]`,KO=`[object Array]`,qO=`[object ArrayBuffer]`,JO=`[object Object]`,YO=`[object DataView]`,XO=`[object Uint8Array]`,ZO=`[object Uint8ClampedArray]`,QO=`[object Uint16Array]`,$O=`[object Uint32Array]`,ek=`[object Int8Array]`,tk=`[object Int16Array]`,nk=`[object Int32Array]`,rk=`[object Float32Array]`,ik=`[object Float64Array]`;function ak(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ok(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function sk(e,t,n){return typeof n==`function`?ck(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?ck(t,r,e,s,!1):!!c},new Map,!0):sk(e,t,()=>void 0)}function ck(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return lk(e,t,n,r,i);case`function`:return Object.keys(t).length>0?ck(e,Object.assign({},t),n,r,i):ak(e,t);default:return ok(e)&&i?typeof t!=`string`||t===``:ak(e,t)}}function lk(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return dk(e,t,n,r);if(t instanceof Map)return uk(e,t,n,r);if(t instanceof Set)return fk(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)FO(e)&&(e=Object(e));else{if(IO(t)===`[object Error]`)return IO(e)===`[object Error]`&&e.name===t.name&&e.message===t.message;let n=IO(e);if(n!==`[object Object]`&&n!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;i<a.length;i++){let o=a[i];if(!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function uk(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function dk(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function fk(e,t,n,r){return t.size===0||e instanceof Set&&dk([...e],[...t],n,r)}function pk(e,t){return sk(e,t,()=>void 0)}function mk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var hk=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function gk(e){return hk.Buffer!==void 0&&hk.Buffer.isBuffer(e)}function _k(e){return gk(e)}function vk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yk(e){return vk(e)}function bk(e,t){return xk(e,void 0,e,new Map,t)}function xk(e,t,n,r,i){if(i!=null){let a=i(e,t,n,r);if(a!==void 0)return a}if(FO(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=xk(e[a],a,n,r,i);return jD(e,`index`)&&(t.index=e.index),jD(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;return r.set(e,t),e.forEach((e,a)=>{t.set(a,xk(e,a,n,r,i))}),t}if(e instanceof Set){let t=new Set;return r.set(e,t),e.forEach(e=>{t.add(xk(e,void 0,n,r,i))}),t}if(_k(e))return e.subarray();if(yk(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=xk(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),Sk(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),Sk(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),Sk(t,e,n,r,i),t}let a=IO(e);if(a===`[object Error]`)return e===n?{}:e;switch(a){case zO:case RO:case BO:{let t=new e.constructor(e.valueOf());return r.set(e,t),Sk(t,e,n,r,i),t}case VO:{let t={};return r.set(e,t),Sk(t,e,n,r,i),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}}if(typeof e==`object`&&Ck(a)){let t=a===`[object Object]`&&typeof e.constructor!=`function`?{}:Object.create(Object.getPrototypeOf(e));return r.set(e,t),Sk(t,e,n,r,i),t}return e}function Sk(e,t,n,r,i){let a=[...Object.keys(t),...mk(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=xk(t[s],s,n,r,i))}}function Ck(e){switch(e){case VO:case KO:case qO:case YO:case BO:case UO:case rk:case ik:case ek:case tk:case nk:case WO:case zO:case JO:case LO:case GO:case RO:case HO:case XO:case ZO:case QO:case $O:return!0;default:return!1}}function wk(e){return bk(e)}function Tk(e){return e=wk(e),t=>pk(t,e)}var Ek=/^(?:0|[1-9]\d*)$/;function Dk(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return Ek.test(e)}}function Ok(e){return typeof e==`object`&&!!e&&IO(e)===`[object Arguments]`}function kk(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&ND(t)&&!(t in Object(e))?RD(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=PD(n[e]);if((r==null||!jD(r,t))&&!((Array.isArray(r)||Ok(r))&&Dk(t)&&Number(t)<r.length))return!1;r=r[t]}return!0}function Ak(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=PD(e)}return t=wk(t),function(n){let r=zD(n,e);return r===void 0?kk(n,e):t===void 0?r===void 0:pk(r,t)}}function jk(e){if(e==null)return jO;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?Ak(e[0],e[1]):Tk(e);default:return PO(e)}}function Mk(e){return e===0?0:e}function Nk(e,t=jO){return NO(e)?kO(Array.from(e),AO(jk(t),1)).map(Mk):[]}function Pk(e,t,n){return t===!0?Nk(e,n):typeof t==`function`?Nk(e,t):e}var Fk=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ik=o(((e,t)=>{t.exports=Fk()})),Lk=o((e=>{var t=d(),n=Ik();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Rk=o(((e,t)=>{t.exports=Lk()})),zk=(0,v.createContext)(null),Bk=Rk(),Vk=e=>e,Hk=()=>{var e=(0,v.useContext)(zk);return e?e.store.dispatch:Vk},Uk=()=>{},Wk=()=>Uk,Gk=(e,t)=>e===t;function Q(e){var t=(0,v.useContext)(zk),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Uk,[t,e]);return(0,Bk.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Wk,t?t.store.getState:Uk,t?t.store.getState:Uk,n,Gk)}function Kk(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function qk(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Jk(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Yk=e=>Array.isArray(e)?e:[e];function Xk(e){let t=Array.isArray(e[0])?e[0]:e;return Jk(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Zk(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Qk=class{constructor(e){this.value=e}deref(){return this.value}},$k=typeof WeakRef<`u`?WeakRef:Qk,eA=0,tA=1;function nA(){return{s:eA,v:void 0,o:null,p:null}}function rA(e,t={}){let n=nA(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=nA(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=nA(),e.set(n,t)):t=r}}let s=t,c;if(t.s===tA)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new $k(c):c}return s.s=tA,s.v=c,c}return o.clearCache=()=>{n=nA(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function iA(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Kk(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=rA,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=Yk(c),p=Yk(u),m=Xk(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Zk(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=iA(rA),aA=Object.assign((e,t=$)=>{qk(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>aA});function oA(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function sA(e,t,n){return ok(n)&&(typeof t==`number`&&NO(n)&&Dk(t)&&t<n.length||typeof t==`string`&&t in n)?ak(n[t],e):!1}function cA(e){let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n}function lA(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var uA=(e,t,n)=>{if(e!==t){let r=lA(e),i=lA(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},dA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fA=/^\w*$/;function pA(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||FD(e)?!0:typeof e==`string`&&(fA.test(e)||!dA.test(e))||t!=null&&jD(t,e)}function mA(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=NO(e)?Array.from(e):cA(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r<t.length&&n!=null;++r)n=n[t[r]];return r>0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?jD(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||pA(e)?e:{key:e,path:RD(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=uA(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function hA(e,...t){let n=t.length;return n>1&&sA(e,t[0],t[1])?t=[]:n>2&&sA(t[0],t[1],t[2])&&(t=[t[0]]),mA(e,oA(t),[`asc`])}var gA=e=>e.legend.settings,_A=e=>e.legend.size;$([e=>e.legend.payload,gA],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?hA(r,n):r});var vA=1;function yA(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,v.useState)({height:0,left:0,top:0,width:0});return[t,(0,v.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>vA||Math.abs(i.left-t.left)>vA||Math.abs(i.top-t.top)>vA||Math.abs(i.width-t.width)>vA)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function bA(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 xA=typeof Symbol==`function`&&Symbol.observable||`@@observable`,SA=()=>Math.random().toString(36).substring(7).split(``).join(`.`),CA={INIT:`@@redux/INIT${SA()}`,REPLACE:`@@redux/REPLACE${SA()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${SA()}`};function wA(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function TA(e,t,n){if(typeof e!=`function`)throw Error(bA(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(bA(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(bA(1));return n(TA)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(bA(3));return i}function d(e){if(typeof e!=`function`)throw Error(bA(4));if(c)throw Error(bA(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(bA(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!wA(e))throw Error(bA(7));if(e.type===void 0)throw Error(bA(8));if(typeof e.type!=`string`)throw Error(bA(17));if(c)throw Error(bA(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(bA(10));r=e,f({type:CA.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(bA(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[xA](){return this}}}return f({type:CA.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[xA]:m}}function EA(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:CA.INIT})===void 0)throw Error(bA(12));if(n(void 0,{type:CA.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(bA(13))})}function DA(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{EA(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(bA(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function OA(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function kA(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(bA(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=OA(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function AA(e){return wA(e)&&`type`in e&&typeof e.type==`string`}var jA=Symbol.for(`immer-nothing`),MA=Symbol.for(`immer-draftable`),NA=Symbol.for(`immer-state`);function PA(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var FA=Object,IA=FA.getPrototypeOf,LA=`constructor`,RA=`prototype`,zA=`configurable`,BA=`enumerable`,VA=`writable`,HA=`value`,UA=e=>!!e&&!!e[NA];function WA(e){return e?qA(e)||ej(e)||!!e[MA]||!!e[LA]?.[MA]||tj(e)||nj(e):!1}var GA=FA[RA][LA].toString(),KA=new WeakMap;function qA(e){if(!e||!rj(e))return!1;let t=IA(e);if(t===null||t===FA[RA])return!0;let n=FA.hasOwnProperty.call(t,LA)&&t[LA];if(n===Object)return!0;if(!ij(n))return!1;let r=KA.get(n);return r===void 0&&(r=Function.toString.call(n),KA.set(n,r)),r===GA}function JA(e,t,n=!0){YA(e)===0?(n?Reflect.ownKeys(e):FA.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function YA(e){let t=e[NA];return t?t.type_:ej(e)?1:tj(e)?2:nj(e)?3:0}var XA=(e,t,n=YA(e))=>n===2?e.has(t):FA[RA].hasOwnProperty.call(e,t),ZA=(e,t,n=YA(e))=>n===2?e.get(t):e[t],QA=(e,t,n,r=YA(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function $A(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var ej=Array.isArray,tj=e=>e instanceof Map,nj=e=>e instanceof Set,rj=e=>typeof e==`object`,ij=e=>typeof e==`function`,aj=e=>typeof e==`boolean`;function oj(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var sj=e=>e.copy_||e.base_,cj=e=>e.modified_?e.copy_:e.base_;function lj(e,t){if(tj(e))return new Map(e);if(nj(e))return new Set(e);if(ej(e))return Array[RA].slice.call(e);let n=qA(e);if(t===!0||t===`class_only`&&!n){let t=FA.getOwnPropertyDescriptors(e);delete t[NA];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[VA]===!1&&(a[VA]=!0,a[zA]=!0),(a.get||a.set)&&(t[i]={[zA]:!0,[VA]:!0,[BA]:a[BA],[HA]:e[i]})}return FA.create(IA(e),t)}{let t=IA(e);if(t!==null&&n)return{...e};let r=FA.create(t);return FA.assign(r,e)}}function uj(e,t=!1){return pj(e)||UA(e)||!WA(e)?e:(YA(e)>1&&FA.defineProperties(e,{set:fj,add:fj,clear:fj,delete:fj}),FA.freeze(e),t&&JA(e,(e,t)=>{uj(t,!0)},!1),e)}function dj(){PA(2)}var fj={[HA]:dj};function pj(e){return e===null||!rj(e)||FA.isFrozen(e)}var mj=`MapSet`,hj=`Patches`,gj=`ArrayMethods`,_j={};function vj(e){let t=_j[e];return t||PA(0,e),t}var yj=e=>!!_j[e],bj,xj=()=>bj,Sj=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:yj(mj)?vj(mj):void 0,arrayMethodsPlugin_:yj(gj)?vj(gj):void 0});function Cj(e,t){t&&(e.patchPlugin_=vj(hj),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function wj(e){Tj(e),e.drafts_.forEach(Dj),e.drafts_=null}function Tj(e){e===bj&&(bj=e.parent_)}var Ej=e=>bj=Sj(bj,e);function Dj(e){let t=e[NA];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Oj(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[NA].modified_&&(wj(t),PA(4)),WA(e)&&(e=kj(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[NA].base_,e,t)}else e=kj(t,n);return Aj(t,e,!0),wj(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===jA?void 0:e}function kj(e,t){if(pj(t))return t;let n=t[NA];if(!n)return Rj(t,e.handledSet_,e);if(!Mj(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);Ij(n,e)}return n.copy_}function Aj(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&uj(t,n)}function jj(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Mj=(e,t)=>e.scope_===t,Nj=[];function Pj(e,t,n,r){let i=sj(e),a=e.type_;if(r!==void 0&&ZA(i,r,a)===t){QA(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;JA(i,(e,n)=>{if(UA(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Nj;for(let e of o)QA(i,e,n,a)}function Fj(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Mj(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=cj(i);Pj(e,i.draft_??i,a,n),Ij(i,r)})}function Ij(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}jj(e)}}function Lj(e,t,n){let{scope_:r}=e;if(UA(n)){let i=n[NA];Mj(i,r)&&i.callbacks_.push(function(){qj(e),Pj(e,n,cj(i),t)})}else WA(n)&&e.callbacks_.push(function(){let i=sj(e);e.type_===3?i.has(n)&&Rj(n,r.handledSet_,r):ZA(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Rj(ZA(e.copy_,t,e.type_),r.handledSet_,r)})}function Rj(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||UA(e)||t.has(e)||!WA(e)||pj(e)?e:(t.add(e),JA(e,(r,i)=>{if(UA(i)){let t=i[NA];Mj(t,n)&&(QA(e,r,cj(t),e.type_),jj(t))}else WA(i)&&Rj(i,t,n)}),e)}function zj(e,t){let n=ej(e),r={type_:+!!n,scope_:t?t.scope_:xj(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=Bj;n&&(i=[r],a=Vj);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var Bj={get(e,t){if(t===NA)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=sj(e);if(!XA(i,t,e.type_))return Wj(e,i,t);let a=i[t];if(e.finalized_||!WA(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&oj(t))return a;if(a===Hj(e.base_,t)||Uj(e,t,a)){qj(e);let n=e.type_===1?+t:t,r=Yj(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in sj(e)},ownKeys(e){return Reflect.ownKeys(sj(e))},set(e,t,n){let r=Gj(sj(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Hj(sj(e),t),i=r?.[NA];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if($A(n,r)&&(n!==void 0||XA(e.base_,t,e.type_)))return!0;qj(e),Kj(e)}return e.copy_[t]===n&&(n!==void 0||XA(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Lj(e,t,n),!0)},deleteProperty(e,t){return qj(e),Hj(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Kj(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=sj(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[VA]:!0,[zA]:e.type_!==1||t!==`length`,[BA]:r[BA],[HA]:n[t]}},defineProperty(){PA(11)},getPrototypeOf(e){return IA(e.base_)},setPrototypeOf(){PA(12)}},Vj={};for(let e in Bj){let t=Bj[e];Vj[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}Vj.deleteProperty=function(e,t){return Vj.set.call(this,e,t,void 0)},Vj.set=function(e,t,n){return Bj.set.call(this,e[0],t,n,e[0])};function Hj(e,t){let n=e[NA];return(n?sj(n):e)[t]}function Uj(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!WA(n)||n[NA]?!1:e.baseRefs_.has(n)}function Wj(e,t,n){let r=Gj(t,n);return r?HA in r?r[HA]:r.get?.call(e.draft_):void 0}function Gj(e,t){if(!(t in e))return;let n=IA(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=IA(n)}}function Kj(e){e.modified_||(e.modified_=!0,e.parent_&&Kj(e.parent_))}function qj(e){e.copy_||=(e.assigned_=new Map,lj(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Jj=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(ij(e)&&!ij(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}ij(t)||PA(6),n!==void 0&&!ij(n)&&PA(7);let r;if(WA(e)){let i=Ej(this),a=Yj(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?wj(i):Tj(i)}return Cj(i,n),Oj(r,i)}if(!e||!rj(e)){if(r=t(e),r===void 0&&(r=e),r===jA&&(r=void 0),this.autoFreeze_&&uj(r,!0),n){let t=[],i=[];vj(hj).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}PA(1,e)},this.produceWithPatches=(e,t)=>{if(ij(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},aj(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),aj(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),aj(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){WA(e)||PA(8),UA(e)&&(e=Xj(e));let t=Ej(this),n=Yj(t,e,void 0);return n[NA].isManual_=!0,Tj(t),n}finishDraft(e,t){let n=e&&e[NA];(!n||!n.isManual_)&&PA(9);let{scope_:r}=n;return Cj(r,t),Oj(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=vj(hj).applyPatches_;return UA(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Yj(e,t,n,r){let[i,a]=tj(t)?vj(mj).proxyMap_(t,n):nj(t)?vj(mj).proxySet_(t,n):zj(t,n);return(n?.scope_??xj()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Fj(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function Xj(e){return UA(e)||PA(10,e),Zj(e)}function Zj(e){if(!WA(e)||pj(e))return e;let t=e[NA],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=lj(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=lj(e,!0);let i=n;return nj(n)&&(n=new Set),JA(i,(e,t)=>{QA(n,e,Zj(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var Qj=new Jj().produce;function $j(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var eM=$j(),tM=$j,nM=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?OA:OA.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function rM(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(fN(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>AA(t)&&t.type===e,n}var iM=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function aM(e){return WA(e)?Qj(e,()=>{}):e}function oM(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function sM(e){return typeof e==`boolean`}var cM=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new iM;return t&&(sM(t)?a.push(eM):a.push(tM(t.extraArgument))),a},lM=`RTK_autoBatch`,uM=()=>e=>({payload:e,meta:{[lM]:!0}}),dM=e=>t=>{setTimeout(t,e)},fM=(e,t)=>n=>{let r=!1,i,a,o=()=>{r||(r=!0,cancelAnimationFrame(i),clearTimeout(a),n())};i=e(o),a=setTimeout(o,t)},pM=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?fM(window.requestAnimationFrame,100):dM(10):e.type===`callback`?e.queueNotification:dM(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[lM],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},mM=e=>function(t){let{autoBatch:n=!0}=t??{},r=new iM(e);return n&&r.push(pM(typeof n==`object`?n:void 0)),r};function hM(e){let t=cM(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(wA(n))c=DA(n);else throw Error(fN(1));let l;l=typeof r==`function`?r(t):t();let u=OA;i&&(u=nM({trace:!1,...typeof i==`object`&&i}));let d=mM(kA(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return TA(c,o,p)}function gM(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(fN(28));if(r in t)throw Error(fN(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function _M(e){return typeof e==`function`}function vM(e,t){let[n,r,i]=gM(t),a;if(_M(e))a=()=>aM(e());else{let t=aM(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(UA(e)){let r=n(e,t);return r===void 0?e:r}if(WA(e))return Qj(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(fN(9))}return r}}return e},e)}return o.getInitialState=a,o}var yM=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,bM=(e=21)=>{let t=``,n=e;for(;n--;)t+=yM[Math.random()*64|0];return t},xM=Symbol.for(`rtk-slice-createasyncthunk`);function SM(e,t){return`${e}/${t}`}function CM({creators:e}={}){let t=e?.asyncThunk?.[xM];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(fN(11));let i=(typeof e.reducers==`function`?e.reducers(EM()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(fN(12));if(n in o.sliceCaseReducersByType)throw Error(fN(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:SM(n,r),createNotation:typeof e.reducers==`function`};OM(a)?AM(o,a,s,t):DM(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?gM(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return vM(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=oM(d,r,m)),i}function i(t=l){return oM(oM(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=wM(a,t,()=>oM(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function wM(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var TM=CM();function EM(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function DM({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!kM(r))throw Error(fN(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?rM(e,o):rM(e))}function OM(e){return e._reducerDefinitionType===`asyncThunk`}function kM(e){return e._reducerDefinitionType===`reducerWithPrepare`}function AM({type:e,reducerName:t},n,r,i){if(!i)throw Error(fN(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||jM,pending:s||jM,rejected:c||jM,settled:l||jM})}function jM(){}var MM=`task`,NM=`listener`,PM=`completed`,FM=`cancelled`,IM=`task-${FM}`,LM=`task-${PM}`,RM=`${NM}-${FM}`,zM=`${NM}-${PM}`,BM=class{code;name=`TaskAbortError`;message;constructor(e){this.code=e,this.message=`${MM} ${FM} (reason: ${e})`}},VM=(e,t)=>{if(typeof e!=`function`)throw TypeError(fN(32))},HM=()=>{},UM=(e,t=HM)=>(e.catch(t),e),WM=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),GM=e=>{if(e.aborted)throw new BM(e.reason)};function KM(e,t){let n=HM;return new Promise((r,i)=>{let a=()=>i(new BM(e.reason));if(e.aborted){a();return}n=WM(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=HM})}var qM=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof BM?`cancelled`:`rejected`,error:e}}finally{t?.()}},JM=e=>t=>UM(KM(e,t).then(t=>(GM(e),t))),YM=e=>{let t=JM(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:XM}=Object,ZM={},QM=`listenerMiddleware`,$M=(e,t)=>{let n=t=>WM(e,()=>t.abort(e.reason));return(r,i)=>{VM(r,`taskExecutor`);let a=new AbortController;n(a);let o=qM(async()=>{GM(e),GM(a.signal);let t=await r({pause:JM(a.signal),delay:YM(a.signal),signal:a.signal});return GM(a.signal),t},()=>a.abort(LM));return i?.autoJoin&&t.push(o.catch(HM)),{result:JM(e)(o),cancel(){a.abort(IM)}}}},eN=(e,t)=>{let n=async(n,r)=>{GM(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await KM(t,Promise.race(a));return GM(t),e}finally{i()}};return((e,t)=>UM(n(e,t)))},tN=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=rM(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(fN(21));return VM(a,`options.listener`),{predicate:i,type:t,effect:a}},nN=XM(e=>{let{type:t,predicate:n,effect:r}=tN(e);return{id:bM(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(fN(22))}}},{withTypes:()=>nN}),rN=(e,t)=>{let{type:n,effect:r,predicate:i}=tN(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},iN=e=>{e.pending.forEach(e=>{e.abort(RM)})},aN=(e,t)=>()=>{for(let e of t.keys())iN(e);e.clear()},oN=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},sN=XM(rM(`${QM}/add`),{withTypes:()=>sN}),cN=rM(`${QM}/removeAll`),lN=XM(rM(`${QM}/remove`),{withTypes:()=>lN}),uN=(...e)=>{console.error(`${QM}/error`,...e)},dN=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=uN}=e;VM(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&iN(e)}),c=(e=>{let n=rN(t,e)??nN(e);return s(n)});XM(c,{withTypes:()=>c});let l=e=>{let n=rN(t,e);return n&&(n.unsubscribe(),e.cancelActive&&iN(n)),!!n};XM(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=eN(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,XM({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:YM(u.signal),pause:JM(u.signal),extra:a,signal:u.signal,fork:$M(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(RM),n.delete(e))})},cancel:()=>{u.abort(RM),e.pending.delete(u)},throwIfCancelled:()=>{GM(u.signal)}})))}catch(e){e instanceof BM||oN(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(zM),i(e),e.pending.delete(u)}},d=aN(t,n);return{middleware:e=>n=>r=>{if(!AA(r))return n(r);if(sN.match(r))return c(r.payload);if(cN.match(r)){d();return}if(lN.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===ZM)throw Error(fN(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,oN(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=ZM}return s},startListening:c,stopListening:l,clearListeners:d}};function fN(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 pN=TM({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:mN,setLayout:hN,setChartSize:gN,setScale:_N}=pN.actions,vN=pN.reducer;function yN(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function bN(e){return Number.isFinite(e)}function xN(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function SN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function CN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?SN(Object(n),!0).forEach(function(t){wN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wN(e,t,n){return(t=TN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function TN(e){var t=EN(e,`string`);return typeof t==`symbol`?t:t+``}function EN(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function DN(e,t,n){return eO(e)||eO(t)?n:qD(t)?zD(e,t,n):typeof t==`function`?t(e):n}var ON=(e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&Z(e[a]))return CN(CN({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&Z(e[o]))return CN(CN({},e),{},{[o]:e[o]+(i||0)})}return e},kN=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,AN=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},jN=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?WD(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return bN(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(nO):c&&l?l.map((e,t)=>{var n=o.map(e);return bN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(nO):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return bN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(nO):o.domain().map((e,t)=>{var n=o.map(e);return bN(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(nO)},MN=(e,t)=>{if(!t||t.length!==2||!Z(t[0])||!Z(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!Z(e[0])||e[0]<n)&&(i[0]=n),(!Z(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},NN={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0,o=0;o<t;++o){var s=e[o]?.[r];if(s!=null){var c=s[1],l=s[0],u=GD(c)?l:c;u>=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:ED,none:xD,silhouette:DD,wiggle:OD,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0;a<t;++a){var o=e[a]?.[r];if(o!=null){var s=GD(o[1])?o[0]:o[1];s>=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},PN=(e,t,n)=>{var r=NN[n]??xD,i=TD().keys(t).value((e,t)=>Number(DN(e,t,0))).order(SD).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=DN(e[i],t[r],0);Array.isArray(a)&&a.length===2&&Z(a[0])&&Z(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function FN(e){return e==null?void 0:String(e)}var IN=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:o}=e;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=DN(a,t.dataKey,t.scale.domain()[o]);if(eO(s))return null;var c=t.scale.map(s);return Z(c)?c-i/2+r:null},LN=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},RN=e=>{var t=e.flat(2).filter(Z);return[Math.min(...t),Math.max(...t)]},zN=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],BN=(e,t,n)=>{if(e!=null)return zN(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=RN(yN(r,t,n));return!bN(i[0])||!bN(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},VN=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,HN=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,UN=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=hA(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var c=i[o],l=i[o-1];a=Math.min((c?.coordinate||0)-(l?.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function WN(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return CN(CN({},t),{},{dataKey:n,payload:r,value:i,name:a})}function GN(e,t){if(e)return String(e);if(typeof t==`string`)return t}var KN=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},qN=(e,t)=>t===`centric`?e.angle:e.radius,JN=e=>e.layout.width,YN=e=>e.layout.height,XN=e=>e.layout.scale,ZN=e=>e.layout.margin,QN=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),$N=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),eP=`data-recharts-item-index`;function tP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tP(Object(n),!0).forEach(function(t){rP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rP(e,t,n){return(t=iP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iP(e){var t=aP(e,`string`);return typeof t==`symbol`?t:t+``}function aP(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var oP=e=>e.brush.height;function sP(e){return $N(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function cP(e){return $N(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function lP(e){return QN(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function uP(e){return QN(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var dP=$([JN,YN,ZN,oP,sP,cP,lP,uP,gA,_A],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=nP(nP({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=ON(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return nP(nP({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),fP=$(dP,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),pP=$(JN,YN,(e,t)=>({x:0,y:0,width:e,height:t})),mP=(0,v.createContext)(null),hP=()=>(0,v.useContext)(mP)!=null,gP=e=>e.brush,_P=$([gP,dP,ZN],(e,t,n)=>({height:e.height,x:Z(e.x)?e.x:t.left,y:Z(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:Z(e.width)?e.width:t.width}));function vP(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function yP(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=vP(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function bP(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return yP(e,t,{leading:r,maxWait:t,trailing:i})}var xP=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},SP={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},CP=(e,t,n)=>{var{width:r=SP.width,height:i=SP.height,aspect:a,maxHeight:o}=n,s=KD(r)?e:Number(r),c=KD(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},wP={width:0,height:0,overflow:`visible`},TP={width:0,overflowX:`visible`},EP={height:0,overflowY:`visible`},DP={},OP=e=>{var{width:t,height:n}=e,r=KD(t),i=KD(n);return r&&i?wP:r?TP:i?EP:DP};function kP(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=SP.width,a=SP.height):i===void 0?i=r&&r>0?void 0:SP.width:a===void 0&&(a=r&&r>0?void 0:SP.height),{width:i,height:a}}function AP(){return AP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},AP.apply(null,arguments)}function jP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jP(Object(n),!0).forEach(function(t){NP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function NP(e,t,n){return(t=PP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PP(e){var t=FP(e,`string`);return typeof t==`symbol`?t:t+``}function FP(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var IP=(0,v.createContext)(SP.initialDimension);function LP(e){return xN(e.width)&&xN(e.height)}function RP(e){var{children:t,width:n,height:r}=e,i=(0,v.useMemo)(()=>({width:n,height:r}),[n,r]);return LP(i)?v.createElement(IP.Provider,{value:i},t):null}var zP=()=>(0,v.useContext)(IP),BP=(0,v.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r=SP.initialDimension,width:i,height:a,minWidth:o=SP.minWidth,minHeight:s,maxHeight:c,children:l,debounce:u=SP.debounce,id:d,className:f,onResize:p,style:m={}}=e,h=(0,v.useRef)(null),g=(0,v.useRef)();g.current=p,(0,v.useImperativeHandle)(t,()=>h.current);var[_,y]=(0,v.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,v.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,v.useEffect)(()=>{if(h.current==null||typeof ResizeObserver>`u`)return rO;var e=e=>{var t,n=e[0];if(n!=null){var{width:r,height:i}=n.contentRect;b(r,i),(t=g.current)==null||t.call(g,r,i)}};u>0&&(e=bP(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=h.current.getBoundingClientRect();return b(n,r),t.observe(h.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:x,containerHeight:S}=_;xP(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:C,calculatedHeight:w}=CP(x,S,{width:i,height:a,aspect:n,maxHeight:c});return xP(C!=null&&C>0||w!=null&&w>0,`The width(%s) and height(%s) of chart should be greater than 0,
130
132
  please check the style of container, or the props width(%s) and height(%s),
131
133
  or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
132
- height and width.`,C,w,i,a,o,s,n),v.createElement(`div`,{id:d?`${d}`:void 0,className:Yt(`recharts-responsive-container`,f),style:xP(xP({},m),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:c}),ref:h},v.createElement(`div`,{style:_P({width:i,height:a})},v.createElement(DP,{width:C,height:w},l)))}),AP=(0,v.forwardRef)((e,t)=>{var n=OP();if(uN(n.width)&&uN(n.height))return e.children;var{width:r,height:i}=vP({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=fP(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return Z(a)&&Z(o)?v.createElement(DP,{width:a,height:o},e.children):v.createElement(kP,yP({},e,{width:r,height:i,ref:t}))});function jP(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 MP=()=>{var e=iP(),t=Q(tP),n=Q(oP),r=Q(aP)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},NP={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},PP=()=>Q(eP)??NP,FP=()=>Q(LN),IP=()=>Q(RN),LP=e=>e.layout.layoutType,RP=()=>Q(LP),zP=()=>{var e=RP();if(e===`horizontal`||e===`vertical`)return e},BP=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},VP=()=>RP()!==void 0,HP=e=>{var t=jk(),n=iP(),{width:r,height:i}=e,a=OP(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,v.useEffect)(()=>{!n&&uN(o)&&uN(s)&&t(aN({width:o,height:s}))},[t,n,o,s]),null},UP=Symbol.for(`immer-nothing`),WP=Symbol.for(`immer-draftable`),GP=Symbol.for(`immer-state`);function KP(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qP=Object.getPrototypeOf;function JP(e){return!!e&&!!e[GP]}function YP(e){return e?QP(e)||Array.isArray(e)||!!e[WP]||!!e.constructor?.[WP]||iF(e)||aF(e):!1}var XP=Object.prototype.constructor.toString(),ZP=new WeakMap;function QP(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;if(n===Object)return!0;if(typeof n!=`function`)return!1;let r=ZP.get(n);return r===void 0&&(r=Function.toString.call(n),ZP.set(n,r)),r===XP}function $P(e,t,n=!0){eF(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function eF(e){let t=e[GP];return t?t.type_:Array.isArray(e)?1:iF(e)?2:aF(e)?3:0}function tF(e,t){return eF(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function nF(e,t,n){let r=eF(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function rF(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function iF(e){return e instanceof Map}function aF(e){return e instanceof Set}function oF(e){return e.copy_||e.base_}function sF(e,t){if(iF(e))return new Map(e);if(aF(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=QP(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[GP];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(qP(e),t)}{let t=qP(e);if(t!==null&&n)return{...e};let r=Object.create(t);return Object.assign(r,e)}}function cF(e,t=!1){return dF(e)||JP(e)||!YP(e)?e:(eF(e)>1&&Object.defineProperties(e,{set:uF,add:uF,clear:uF,delete:uF}),Object.freeze(e),t&&Object.values(e).forEach(e=>cF(e,!0)),e)}function lF(){KP(2)}var uF={value:lF};function dF(e){return typeof e!=`object`||!e||Object.isFrozen(e)}var fF={};function pF(e){let t=fF[e];return t||KP(0,e),t}var mF;function hF(){return mF}function gF(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function _F(e,t){t&&(pF(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function vF(e){yF(e),e.drafts_.forEach(xF),e.drafts_=null}function yF(e){e===mF&&(mF=e.parent_)}function bF(e){return mF=gF(mF,e)}function xF(e){let t=e[GP];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function SF(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[GP].modified_&&(vF(t),KP(4)),YP(e)&&(e=CF(t,e),t.parent_||TF(t,e)),t.patches_&&pF(`Patches`).generateReplacementPatches_(n[GP].base_,e,t.patches_,t.inversePatches_)):e=CF(t,n,[]),vF(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===UP?void 0:e}function CF(e,t,n){if(dF(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[GP];if(!i)return $P(t,(r,a)=>wF(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return TF(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;i.type_===3&&(a=new Set(t),t.clear(),o=!0),$P(a,(r,a)=>wF(e,i,t,r,a,n,o),r),TF(e,t,!1),n&&e.patches_&&pF(`Patches`).generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function wF(e,t,n,r,i,a,o){if(i==null||typeof i!=`object`&&!o)return;let s=dF(i);if(!(s&&!o)){if(JP(i)){let o=CF(e,i,a&&t&&t.type_!==3&&!tF(t.assigned_,r)?a.concat(r):void 0);if(nF(n,r,o),JP(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(YP(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;CF(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&(iF(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&TF(e,i)}}}function TF(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&cF(t,n)}function EF(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:hF(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=DF;n&&(i=[r],a=OF);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var DF={get(e,t){if(t===GP)return e;let n=oF(e);if(!tF(n,t))return AF(e,n,t);let r=n[t];return e.finalized_||!YP(r)?r:r===kF(e.base_,t)?(NF(e),e.copy_[t]=FF(r,e)):r},has(e,t){return t in oF(e)},ownKeys(e){return Reflect.ownKeys(oF(e))},set(e,t,n){let r=jF(oF(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=kF(oF(e),t),i=r?.[GP];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(rF(n,r)&&(n!==void 0||tF(e.base_,t)))return!0;NF(e),MF(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty(e,t){return kF(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,NF(e),MF(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=oF(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){KP(11)},getPrototypeOf(e){return qP(e.base_)},setPrototypeOf(){KP(12)}},OF={};$P(DF,(e,t)=>{OF[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),OF.deleteProperty=function(e,t){return OF.set.call(this,e,t,void 0)},OF.set=function(e,t,n){return DF.set.call(this,e[0],t,n,e[0])};function kF(e,t){let n=e[GP];return(n?oF(n):e)[t]}function AF(e,t,n){let r=jF(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function jF(e,t){if(!(t in e))return;let n=qP(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=qP(n)}}function MF(e){e.modified_||(e.modified_=!0,e.parent_&&MF(e.parent_))}function NF(e){e.copy_||=sF(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var PF=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&KP(6),n!==void 0&&typeof n!=`function`&&KP(7);let r;if(YP(e)){let i=bF(this),a=FF(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?vF(i):yF(i)}return _F(i,n),SF(r,i)}if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===UP&&(r=void 0),this.autoFreeze_&&cF(r,!0),n){let t=[],i=[];pF(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}KP(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==`boolean`&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){YP(e)||KP(8),JP(e)&&(e=IF(e));let t=bF(this),n=FF(e,void 0);return n[GP].isManual_=!0,yF(t),n}finishDraft(e,t){let n=e&&e[GP];(!n||!n.isManual_)&&KP(9);let{scope_:r}=n;return _F(r,t),SF(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=pF(`Patches`).applyPatches_;return JP(e)?r(e,t):this.produce(e,e=>r(e,t))}};function FF(e,t){let n=iF(e)?pF(`MapSet`).proxyMap_(e,t):aF(e)?pF(`MapSet`).proxySet_(e,t):EF(e,t);return(t?t.scope_:hF()).drafts_.push(n),n}function IF(e){return JP(e)||KP(10,e),LF(e)}function LF(e){if(!YP(e)||dF(e))return e;let t=e[GP],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=sF(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=sF(e,!0);return $P(n,(e,t)=>{nF(n,e,LF(t))},r),t&&(t.finalized_=!1),n}new PF().produce;function RF(e){return e}var zF=mM({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`middle`,itemSorter:`value`},size:{width:0,height:0},payload:[]},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(RF(t.payload))},prepare:$j()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=zj(e).payload.indexOf(RF(n));i>-1&&(e.payload[i]=RF(r))},prepare:$j()},removeLegendPayload:{reducer(e,t){var n=zj(e).payload.indexOf(RF(t.payload));n>-1&&e.payload.splice(n,1)},prepare:$j()}}}),{setLegendSize:BF,setLegendSettings:VF,addLegendPayload:HF,replaceLegendPayload:UF,removeLegendPayload:WF}=zF.actions,GF=zF.reducer,KF=o((e=>{var t=d();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));o(((e,t)=>{t.exports=KF()}))();function qF(e){e()}function JF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){qF(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var YF={notify(){},get:()=>[]};function XF(e,t){let n,r=YF,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=JF())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=YF)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var ZF=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,QF=typeof navigator<`u`&&navigator.product===`ReactNative`,$F=ZF||QF?v.useLayoutEffect:v.useEffect;function eI(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function tI(e,t){if(eI(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!eI(e[n[r]],t[n[r]]))return!1;return!0}var nI=Symbol.for(`react-redux-context`),rI=typeof globalThis<`u`?globalThis:{};function iI(){if(!v.createContext)return{};let e=rI[nI]??=new Map,t=e.get(v.createContext);return t||(t=v.createContext(null),e.set(v.createContext,t)),t}var aI=iI();function oI(e){let{children:t,context:n,serverState:r,store:i}=e,a=v.useMemo(()=>{let e=XF(i);return{store:i,subscription:e,getServerState:r==null?void 0:()=>r}},[i,r]),o=v.useMemo(()=>i.getState(),[i]);$F(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||aI;return v.createElement(s.Provider,{value:a},t)}var sI=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function cI(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function lI(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(sI.has(n)){if(e[n]==null&&t[n]==null)continue;if(!tI(e[n],t[n]))return!1}else if(!cI(e[n],t[n]))return!1;return!0}function uI(){return uI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uI.apply(null,arguments)}function dI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?dI(Object(n),!0).forEach(function(t){pI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pI(e,t,n){return(t=mI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mI(e){var t=hI(e,`string`);return typeof t==`symbol`?t:t+``}function hI(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gI(e){return Array.isArray(e)&&ID(e[0])&&ID(e[1])?e.join(` ~ `):e}var _I={separator:` : `,contentStyle:{margin:0,padding:10,backgroundColor:`#fff`,border:`1px solid #ccc`,whiteSpace:`nowrap`},itemStyle:{display:`block`,paddingTop:4,paddingBottom:4,color:`#000`},labelStyle:{},accessibilityLayer:!1};function vI(e,t){return t==null?e:iA(e,t)}var yI=e=>{var{separator:t=_I.separator,contentStyle:n,itemStyle:r,labelStyle:i=_I.labelStyle,payload:a,formatter:o,itemSorter:s,wrapperClassName:c,labelClassName:l,label:u,labelFormatter:d,accessibilityLayer:f=_I.accessibilityLayer}=e,p=()=>{if(a&&a.length){var e={padding:0,margin:0},n=vI(a,s).map((e,n)=>{if(e.type===`none`)return null;var i=e.formatter||o||gI,{value:s,name:c}=e,l=s,u=c;if(i){var d=i(s,c,e,n,a);if(Array.isArray(d))[l,u]=d;else if(d!=null)l=d;else return null}var f=fI(fI({},_I.itemStyle),{},{color:e.color||_I.itemStyle.color},r);return v.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${n}`,style:f},ID(u)?v.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,ID(u)?v.createElement(`span`,{className:`recharts-tooltip-item-separator`},t):null,v.createElement(`span`,{className:`recharts-tooltip-item-value`},l),v.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return v.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},n)}return null},m=fI(fI({},_I.contentStyle),n),h=fI({margin:0},i),g=!UD(u),_=g?u:``,y=Yt(`recharts-default-tooltip`,c),b=Yt(`recharts-tooltip-label`,l);g&&d&&a!=null&&(_=d(u,a));var x=f?{role:`status`,"aria-live":`assertive`}:{};return v.createElement(`div`,uI({className:y,style:m},x),v.createElement(`p`,{className:b,style:h},v.isValidElement(_)?_:`${_}`),p())},bI=`recharts-tooltip-wrapper`,xI={visibility:`hidden`};function SI(e){var{coordinate:t,translateX:n,translateY:r}=e;return Yt(bI,{[`${bI}-right`]:Z(n)&&t&&Z(t.x)&&n>=t.x,[`${bI}-left`]:Z(n)&&t&&Z(t.x)&&n<t.x,[`${bI}-bottom`]:Z(r)&&t&&Z(t.y)&&r>=t.y,[`${bI}-top`]:Z(r)&&t&&Z(t.y)&&r<t.y})}function CI(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offset:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:c,viewBoxDimension:l}=e;if(a&&Z(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(u<f?d:u,f):l==null?0:d+s>f+l?Math.max(u,f):Math.max(d,f)}function wI(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function TI(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:s,useTranslate3d:c,viewBox:l}=e,u,d,f;return s.height>0&&s.width>0&&n?(d=CI({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=CI({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=wI({translateX:d,translateY:f,useTranslate3d:c})):u=xI,{cssProperties:u,cssClasses:SI({translateX:d,translateY:f,coordinate:n})}}var EI={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function DI(){var[e,t]=(0,v.useState)(()=>EI.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,v.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}}},[]),e}function OI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?OI(Object(n),!0).forEach(function(t){AI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function AI(e,t,n){return(t=jI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jI(e){var t=MI(e,`string`);return typeof t==`symbol`?t:t+``}function MI(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function NI(e){if(!(e.prefersReducedMotion&&e.isAnimationActive===`auto`)&&e.isAnimationActive&&e.active)return`transform ${e.animationDuration}ms ${e.animationEasing}`}function PI(e){var t=DI(),[n,r]=v.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));v.useEffect(()=>{var t=t=>{t.key===`Escape`&&r({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),n.dismissed&&((e.coordinate?.x??0)!==n.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==n.dismissedAtCoordinate.y)&&r(kI(kI({},n),{},{dismissed:!1}));var{cssClasses:i,cssProperties:a}=TI({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=kI(kI({},e.hasPortalFromProps?{}:kI(kI({transition:NI({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},a),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!n.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return v.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:i,style:o,ref:e.innerRef},e.children)}var FI=v.memo(PI),II=()=>Q(e=>e.rootProps.accessibilityLayer)??!0;function LI(){return LI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LI.apply(null,arguments)}function RI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?RI(Object(n),!0).forEach(function(t){BI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BI(e,t,n){return(t=VI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VI(e){var t=HI(e,`string`);return typeof t==`symbol`?t:t+``}function HI(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var UI={curveBasisClosed:UE,curveBasisOpen:GE,curveBasis:VE,curveBumpX:_E,curveBumpY:vE,curveLinearClosed:qE,curveLinear:dE,curveMonotoneX:tD,curveMonotoneY:nD,curveNatural:aD,curveStep:sD,curveStepAfter:lD,curveStepBefore:cD},WI=e=>lN(e.x)&&lN(e.y),GI=e=>e.base!=null&&WI(e.base)&&WI(e),KI=e=>e.x,qI=e=>e.y,JI=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${WD(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=UI[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return UI[n]||dE},YI={connectNulls:!1,type:`linear`},XI=e=>{var{type:t=YI.type,points:n=[],baseLine:r,layout:i,connectNulls:a=YI.connectNulls}=e,o=JI(t,i),s=a?n.filter(WI):n;if(Array.isArray(r)){var c,l=n.map((e,t)=>zI(zI({},e),{},{base:r[t]}));return c=i===`vertical`?hE().y(qI).x1(KI).x0(e=>e.base.x):hE().x(KI).y1(qI).y0(e=>e.base.y),c.defined(GI).curve(o)(a?l.filter(GI):l)}return(i===`vertical`&&Z(r)?hE().y(qI).x1(KI).x0(r):Z(r)?hE().x(KI).y1(qI).y0(r):mE().x(KI).y(qI)).defined(WI).curve(o)(s)},ZI=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=RP();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?XI(o):r;return v.createElement(`path`,LI({},FT(e),lO(e),{className:Yt(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},QI=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function $I(){return $I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$I.apply(null,arguments)}function eL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?eL(Object(n),!0).forEach(function(t){nL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nL(e,t,n){return(t=rL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rL(e){var t=iL(e,`string`);return typeof t==`symbol`?t:t+``}function iL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function aL(e,t){if(e==null)return{};var n,r,i=oL(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function oL(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var sL=(e,t,n,r,i,a)=>`M${e},${i}v${r}M${a},${t}h${n}`,cL=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,c=aL(e,QI),l=tL({x:t,y:n,top:r,left:i,width:a,height:o},c);return!Z(t)||!Z(n)||!Z(a)||!Z(o)||!Z(r)||!Z(i)?null:v.createElement(`path`,$I({},LT(l),{className:Yt(`recharts-cross`,s),d:sL(t,n,a,o,r,i)}))};function lL(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function uL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?uL(Object(n),!0).forEach(function(t){fL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fL(e,t,n){return(t=pL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pL(e){var t=mL(e,`string`);return typeof t==`symbol`?t:t+``}function mL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var hL=e=>e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),gL=(e,t,n)=>e.map(e=>`${hL(e)} ${t}ms ${n}`).join(`,`),_L=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e))),vL=(e,t)=>Object.keys(t).reduce((n,r)=>dL(dL({},n),{},{[r]:e(r,t[r])}),{});function yL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yL(Object(n),!0).forEach(function(t){xL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xL(e,t,n){return(t=SL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SL(e){var t=CL(e,`string`);return typeof t==`symbol`?t:t+``}function CL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var wL=(e,t,n)=>e+(t-e)*n,TL=e=>{var{from:t,to:n}=e;return t!==n},EL=(e,t,n)=>{var r=vL((t,n)=>{if(TL(n)){var[r,i]=e(n.from,n.to,n.velocity);return bL(bL({},n),{},{from:r,velocity:i})}return n},t);return n<1?vL((e,t)=>TL(t)&&r[e]!=null?bL(bL({},t),{},{velocity:wL(t.velocity,r[e].velocity,n),from:wL(t.from,r[e].from,n)}):t,t):EL(e,r,n-1)};function DL(e,t,n,r,i,a){var o,s=r.reduce((n,r)=>bL(bL({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),c=()=>vL((e,t)=>t.from,s),l=()=>!Object.values(s).filter(TL).length,u=null,d=r=>{o||=r;var f=(r-o)/n.dt;s=EL(n,s,f),i(bL(bL(bL({},e),t),c())),o=r,l()||(u=a.setTimeout(d))};return()=>(u=a.setTimeout(d),()=>{var e;(e=u)==null||e()})}function OL(e,t,n,r,i,a,o){var s=null,c=i.reduce((n,r)=>{var i=e[r],a=t[r];return i==null||a==null?n:bL(bL({},n),{},{[r]:[i,a]})},{}),l,u=i=>{l||=i;var d=(i-l)/r,f=vL((e,t)=>wL(...t,n(d)),c);if(a(bL(bL(bL({},e),t),f)),d<1)s=o.setTimeout(u);else{var p=vL((e,t)=>wL(...t,n(1)),c);a(bL(bL(bL({},e),t),p))}};return()=>(s=o.setTimeout(u),()=>{var e;(e=s)==null||e()})}var kL=(e,t,n,r,i,a)=>{var o=_L(e,t);return n==null?()=>(i(bL(bL({},e),t)),()=>{}):n.isStepper===!0?DL(e,t,n,o,i,a):OL(e,t,n,r,o,i,a)},AL=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],jL=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),ML=(e,t)=>n=>jL(AL(e,t),n),NL=(e,t)=>n=>jL([...AL(e,t).map((e,t)=>e*t).slice(1),0],n),PL=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},FL=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=PL(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},IL=(e,t,n,r)=>{var i=ML(e,n),a=ML(t,r),o=NL(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},LL=function(){return IL(...FL(...arguments))},RL=function(){var{stiff:e=100,damping:t=8,dt:n=17}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=(r,i,a)=>{var o=a+(-(r-i)*e-a*t)*n/1e3,s=a*n/1e3+r;return Math.abs(s-i)<1e-4&&Math.abs(o)<1e-4?[i,0]:[s,o]};return r.isStepper=!0,r.dt=n,r},zL=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return LL(e);case`spring`:return RL();default:if(e.split(`(`)[0]===`cubic-bezier`)return LL(e)}return typeof e==`function`?e:null};function BL(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var[s,...c]=o;if(typeof s==`number`){i=e.setTimeout(a.bind(null,c),s);return}a(s),i=e.setTimeout(a.bind(null,c));return}typeof o==`string`&&(t=o,n(t)),typeof o==`object`&&(t=o,n(t)),typeof o==`function`&&o()}};return{stop:()=>{r=!0},start:e=>{r=!1,i&&=(i(),null),a(e)},subscribe:e=>(n=e,()=>{n=()=>null}),getTimeoutController:()=>e}}var VL=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function HL(){return BL(new VL)}var UL=(0,v.createContext)(HL);function WL(e,t){var n=(0,v.useContext)(UL);return(0,v.useMemo)(()=>t??n(e),[e,t,n])}var GL={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},KL={t:0},qL={t:1};function JL(e){var t=_O(e,GL),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:c,children:l}=t,u=DI(),d=n===`auto`?!EI.isSsr&&!u:n,f=WL(t.animationId,t.animationManager),[p,m]=(0,v.useState)(d?KL:qL),h=(0,v.useRef)(null);return(0,v.useEffect)(()=>{d||m(qL)},[d]),(0,v.useEffect)(()=>{if(!d||!r)return KD;var e=kL(KL,qL,zL(a),i,m,f.getTimeoutController());return f.start([c,o,()=>{h.current=e()},i,s]),()=>{f.stop(),h.current&&h.current(),s()}},[d,r,i,a,o,c,s,f]),l(p.t)}function YL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,v.useRef)(RD(t)),r=(0,v.useRef)(e);return r.current!==e&&(n.current=RD(t),r.current=e),n.current}var XL=[`radius`],ZL=[`radius`],QL,$L,eR,tR,nR,rR,iR,aR,oR,sR;function cR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?cR(Object(n),!0).forEach(function(t){uR(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uR(e,t,n){return(t=dR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dR(e){var t=fR(e,`string`);return typeof t==`symbol`?t:t+``}function fR(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function pR(){return pR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pR.apply(null,arguments)}function mR(e,t){if(e==null)return{};var n,r,i=hR(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hR(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function gR(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var _R=(e,t,n,r,i)=>{var a=jD(n),o=jD(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;p<m;p++){var h=i[p]??0;f[p]=h>s?s:h}d=MD(QL||=gR([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=MD($L||=gR([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=MD(eR||=gR([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=MD(tR||=gR([`A `,`,`,`,0,0,`,`,
133
- `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=MD(nR||=gR([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=MD(rR||=gR([`A `,`,`,`,0,0,`,`,
134
- `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=MD(iR||=gR([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=MD(aR||=gR([`A `,`,`,`,0,0,`,`,
135
- `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=MD(oR||=gR(`M .,.
134
+ height and width.`,C,w,i,a,o,s,n),v.createElement(`div`,{id:d?`${d}`:void 0,className:Yt(`recharts-responsive-container`,f),style:MP(MP({},m),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:c}),ref:h},v.createElement(`div`,{style:OP({width:i,height:a})},v.createElement(RP,{width:C,height:w},l)))}),VP=(0,v.forwardRef)((e,t)=>{var n=zP();if(xN(n.width)&&xN(n.height))return e.children;var{width:r,height:i}=kP({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=CP(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return Z(a)&&Z(o)?v.createElement(RP,{width:a,height:o},e.children):v.createElement(BP,AP({},e,{width:r,height:i,ref:t}))});function HP(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 UP=()=>{var e=hP(),t=Q(fP),n=Q(_P),r=Q(gP)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},WP={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},GP=()=>Q(dP)??WP,KP=()=>Q(JN),qP=()=>Q(YN),JP=e=>e.layout.layoutType,YP=()=>Q(JP),XP=()=>{var e=YP();if(e===`horizontal`||e===`vertical`)return e},ZP=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},QP=()=>YP()!==void 0,$P=e=>{var t=Hk(),n=hP(),{width:r,height:i}=e,a=zP(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,v.useEffect)(()=>{!n&&xN(o)&&xN(s)&&t(gN({width:o,height:s}))},[t,n,o,s]),null},eF=Symbol.for(`immer-nothing`),tF=Symbol.for(`immer-draftable`),nF=Symbol.for(`immer-state`);function rF(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var iF=Object.getPrototypeOf;function aF(e){return!!e&&!!e[nF]}function oF(e){return e?lF(e)||Array.isArray(e)||!!e[tF]||!!e.constructor?.[tF]||hF(e)||gF(e):!1}var sF=Object.prototype.constructor.toString(),cF=new WeakMap;function lF(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;if(n===Object)return!0;if(typeof n!=`function`)return!1;let r=cF.get(n);return r===void 0&&(r=Function.toString.call(n),cF.set(n,r)),r===sF}function uF(e,t,n=!0){dF(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function dF(e){let t=e[nF];return t?t.type_:Array.isArray(e)?1:hF(e)?2:gF(e)?3:0}function fF(e,t){return dF(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function pF(e,t,n){let r=dF(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function mF(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function hF(e){return e instanceof Map}function gF(e){return e instanceof Set}function _F(e){return e.copy_||e.base_}function vF(e,t){if(hF(e))return new Map(e);if(gF(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=lF(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[nF];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(iF(e),t)}{let t=iF(e);if(t!==null&&n)return{...e};let r=Object.create(t);return Object.assign(r,e)}}function yF(e,t=!1){return SF(e)||aF(e)||!oF(e)?e:(dF(e)>1&&Object.defineProperties(e,{set:xF,add:xF,clear:xF,delete:xF}),Object.freeze(e),t&&Object.values(e).forEach(e=>yF(e,!0)),e)}function bF(){rF(2)}var xF={value:bF};function SF(e){return typeof e!=`object`||!e||Object.isFrozen(e)}var CF={};function wF(e){let t=CF[e];return t||rF(0,e),t}var TF;function EF(){return TF}function DF(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function OF(e,t){t&&(wF(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function kF(e){AF(e),e.drafts_.forEach(MF),e.drafts_=null}function AF(e){e===TF&&(TF=e.parent_)}function jF(e){return TF=DF(TF,e)}function MF(e){let t=e[nF];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function NF(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[nF].modified_&&(kF(t),rF(4)),oF(e)&&(e=PF(t,e),t.parent_||IF(t,e)),t.patches_&&wF(`Patches`).generateReplacementPatches_(n[nF].base_,e,t.patches_,t.inversePatches_)):e=PF(t,n,[]),kF(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===eF?void 0:e}function PF(e,t,n){if(SF(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[nF];if(!i)return uF(t,(r,a)=>FF(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return IF(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;i.type_===3&&(a=new Set(t),t.clear(),o=!0),uF(a,(r,a)=>FF(e,i,t,r,a,n,o),r),IF(e,t,!1),n&&e.patches_&&wF(`Patches`).generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function FF(e,t,n,r,i,a,o){if(i==null||typeof i!=`object`&&!o)return;let s=SF(i);if(!(s&&!o)){if(aF(i)){let o=PF(e,i,a&&t&&t.type_!==3&&!fF(t.assigned_,r)?a.concat(r):void 0);if(pF(n,r,o),aF(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(oF(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;PF(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&(hF(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&IF(e,i)}}}function IF(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&yF(t,n)}function LF(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:EF(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=RF;n&&(i=[r],a=zF);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var RF={get(e,t){if(t===nF)return e;let n=_F(e);if(!fF(n,t))return VF(e,n,t);let r=n[t];return e.finalized_||!oF(r)?r:r===BF(e.base_,t)?(WF(e),e.copy_[t]=KF(r,e)):r},has(e,t){return t in _F(e)},ownKeys(e){return Reflect.ownKeys(_F(e))},set(e,t,n){let r=HF(_F(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=BF(_F(e),t),i=r?.[nF];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(mF(n,r)&&(n!==void 0||fF(e.base_,t)))return!0;WF(e),UF(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty(e,t){return BF(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,WF(e),UF(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=_F(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){rF(11)},getPrototypeOf(e){return iF(e.base_)},setPrototypeOf(){rF(12)}},zF={};uF(RF,(e,t)=>{zF[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),zF.deleteProperty=function(e,t){return zF.set.call(this,e,t,void 0)},zF.set=function(e,t,n){return RF.set.call(this,e[0],t,n,e[0])};function BF(e,t){let n=e[nF];return(n?_F(n):e)[t]}function VF(e,t,n){let r=HF(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function HF(e,t){if(!(t in e))return;let n=iF(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=iF(n)}}function UF(e){e.modified_||(e.modified_=!0,e.parent_&&UF(e.parent_))}function WF(e){e.copy_||=vF(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var GF=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&rF(6),n!==void 0&&typeof n!=`function`&&rF(7);let r;if(oF(e)){let i=jF(this),a=KF(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?kF(i):AF(i)}return OF(i,n),NF(r,i)}if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===eF&&(r=void 0),this.autoFreeze_&&yF(r,!0),n){let t=[],i=[];wF(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}rF(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==`boolean`&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){oF(e)||rF(8),aF(e)&&(e=qF(e));let t=jF(this),n=KF(e,void 0);return n[nF].isManual_=!0,AF(t),n}finishDraft(e,t){let n=e&&e[nF];(!n||!n.isManual_)&&rF(9);let{scope_:r}=n;return OF(r,t),NF(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=wF(`Patches`).applyPatches_;return aF(e)?r(e,t):this.produce(e,e=>r(e,t))}};function KF(e,t){let n=hF(e)?wF(`MapSet`).proxyMap_(e,t):gF(e)?wF(`MapSet`).proxySet_(e,t):LF(e,t);return(t?t.scope_:EF()).drafts_.push(n),n}function qF(e){return aF(e)||rF(10,e),JF(e)}function JF(e){if(!oF(e)||SF(e))return e;let t=e[nF],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=vF(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=vF(e,!0);return uF(n,(e,t)=>{pF(n,e,JF(t))},r),t&&(t.finalized_=!1),n}new GF().produce;function YF(e){return e}var XF=TM({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`middle`,itemSorter:`value`},size:{width:0,height:0},payload:[]},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(YF(t.payload))},prepare:uM()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Xj(e).payload.indexOf(YF(n));i>-1&&(e.payload[i]=YF(r))},prepare:uM()},removeLegendPayload:{reducer(e,t){var n=Xj(e).payload.indexOf(YF(t.payload));n>-1&&e.payload.splice(n,1)},prepare:uM()}}}),{setLegendSize:ZF,setLegendSettings:QF,addLegendPayload:$F,replaceLegendPayload:eI,removeLegendPayload:tI}=XF.actions,nI=XF.reducer,rI=o((e=>{var t=d();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));o(((e,t)=>{t.exports=rI()}))();function iI(e){e()}function aI(){let e=null,t=null;return{clear(){e=null,t=null},notify(){iI(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var oI={notify(){},get:()=>[]};function sI(e,t){let n,r=oI,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=aI())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=oI)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var cI=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,lI=typeof navigator<`u`&&navigator.product===`ReactNative`,uI=cI||lI?v.useLayoutEffect:v.useEffect;function dI(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function fI(e,t){if(dI(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!dI(e[n[r]],t[n[r]]))return!1;return!0}var pI=Symbol.for(`react-redux-context`),mI=typeof globalThis<`u`?globalThis:{};function hI(){if(!v.createContext)return{};let e=mI[pI]??=new Map,t=e.get(v.createContext);return t||(t=v.createContext(null),e.set(v.createContext,t)),t}var gI=hI();function _I(e){let{children:t,context:n,serverState:r,store:i}=e,a=v.useMemo(()=>{let e=sI(i);return{store:i,subscription:e,getServerState:r==null?void 0:()=>r}},[i,r]),o=v.useMemo(()=>i.getState(),[i]);uI(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||gI;return v.createElement(s.Provider,{value:a},t)}var vI=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function yI(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function bI(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(vI.has(n)){if(e[n]==null&&t[n]==null)continue;if(!fI(e[n],t[n]))return!1}else if(!yI(e[n],t[n]))return!1;return!0}function xI(){return xI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xI.apply(null,arguments)}function SI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function CI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?SI(Object(n),!0).forEach(function(t){wI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wI(e,t,n){return(t=TI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function TI(e){var t=EI(e,`string`);return typeof t==`symbol`?t:t+``}function EI(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function DI(e){return Array.isArray(e)&&qD(e[0])&&qD(e[1])?e.join(` ~ `):e}var OI={separator:` : `,contentStyle:{margin:0,padding:10,backgroundColor:`#fff`,border:`1px solid #ccc`,whiteSpace:`nowrap`},itemStyle:{display:`block`,paddingTop:4,paddingBottom:4,color:`#000`},labelStyle:{},accessibilityLayer:!1};function kI(e,t){return t==null?e:hA(e,t)}var AI=e=>{var{separator:t=OI.separator,contentStyle:n,itemStyle:r,labelStyle:i=OI.labelStyle,payload:a,formatter:o,itemSorter:s,wrapperClassName:c,labelClassName:l,label:u,labelFormatter:d,accessibilityLayer:f=OI.accessibilityLayer}=e,p=()=>{if(a&&a.length){var e={padding:0,margin:0},n=kI(a,s).map((e,n)=>{if(e.type===`none`)return null;var i=e.formatter||o||DI,{value:s,name:c}=e,l=s,u=c;if(i){var d=i(s,c,e,n,a);if(Array.isArray(d))[l,u]=d;else if(d!=null)l=d;else return null}var f=CI(CI({},OI.itemStyle),{},{color:e.color||OI.itemStyle.color},r);return v.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${n}`,style:f},qD(u)?v.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,qD(u)?v.createElement(`span`,{className:`recharts-tooltip-item-separator`},t):null,v.createElement(`span`,{className:`recharts-tooltip-item-value`},l),v.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return v.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},n)}return null},m=CI(CI({},OI.contentStyle),n),h=CI({margin:0},i),g=!eO(u),_=g?u:``,y=Yt(`recharts-default-tooltip`,c),b=Yt(`recharts-tooltip-label`,l);g&&d&&a!=null&&(_=d(u,a));var x=f?{role:`status`,"aria-live":`assertive`}:{};return v.createElement(`div`,xI({className:y,style:m},x),v.createElement(`p`,{className:b,style:h},v.isValidElement(_)?_:`${_}`),p())},jI=`recharts-tooltip-wrapper`,MI={visibility:`hidden`};function NI(e){var{coordinate:t,translateX:n,translateY:r}=e;return Yt(jI,{[`${jI}-right`]:Z(n)&&t&&Z(t.x)&&n>=t.x,[`${jI}-left`]:Z(n)&&t&&Z(t.x)&&n<t.x,[`${jI}-bottom`]:Z(r)&&t&&Z(t.y)&&r>=t.y,[`${jI}-top`]:Z(r)&&t&&Z(t.y)&&r<t.y})}function PI(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offset:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:c,viewBoxDimension:l}=e;if(a&&Z(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(u<f?d:u,f):l==null?0:d+s>f+l?Math.max(u,f):Math.max(d,f)}function FI(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function II(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:s,useTranslate3d:c,viewBox:l}=e,u,d,f;return s.height>0&&s.width>0&&n?(d=PI({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=PI({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=FI({translateX:d,translateY:f,useTranslate3d:c})):u=MI,{cssProperties:u,cssClasses:NI({translateX:d,translateY:f,coordinate:n})}}var LI={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function RI(){var[e,t]=(0,v.useState)(()=>LI.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,v.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}}},[]),e}function zI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?zI(Object(n),!0).forEach(function(t){VI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VI(e,t,n){return(t=HI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HI(e){var t=UI(e,`string`);return typeof t==`symbol`?t:t+``}function UI(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function WI(e){if(!(e.prefersReducedMotion&&e.isAnimationActive===`auto`)&&e.isAnimationActive&&e.active)return`transform ${e.animationDuration}ms ${e.animationEasing}`}function GI(e){var t=RI(),[n,r]=v.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));v.useEffect(()=>{var t=t=>{t.key===`Escape`&&r({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),n.dismissed&&((e.coordinate?.x??0)!==n.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==n.dismissedAtCoordinate.y)&&r(BI(BI({},n),{},{dismissed:!1}));var{cssClasses:i,cssProperties:a}=II({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=BI(BI({},e.hasPortalFromProps?{}:BI(BI({transition:WI({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},a),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!n.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return v.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:i,style:o,ref:e.innerRef},e.children)}var KI=v.memo(GI),qI=()=>Q(e=>e.rootProps.accessibilityLayer)??!0;function JI(){return JI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},JI.apply(null,arguments)}function YI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?YI(Object(n),!0).forEach(function(t){ZI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ZI(e,t,n){return(t=QI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QI(e){var t=$I(e,`string`);return typeof t==`symbol`?t:t+``}function $I(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var eL={curveBasisClosed:eD,curveBasisOpen:nD,curveBasis:QE,curveBumpX:OE,curveBumpY:kE,curveLinearClosed:iD,curveLinear:SE,curveMonotoneX:fD,curveMonotoneY:pD,curveNatural:gD,curveStep:vD,curveStepAfter:bD,curveStepBefore:yD},tL=e=>bN(e.x)&&bN(e.y),nL=e=>e.base!=null&&tL(e.base)&&tL(e),rL=e=>e.x,iL=e=>e.y,aL=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${tO(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=eL[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return eL[n]||SE},oL={connectNulls:!1,type:`linear`},sL=e=>{var{type:t=oL.type,points:n=[],baseLine:r,layout:i,connectNulls:a=oL.connectNulls}=e,o=aL(t,i),s=a?n.filter(tL):n;if(Array.isArray(r)){var c,l=n.map((e,t)=>XI(XI({},e),{},{base:r[t]}));return c=i===`vertical`?EE().y(iL).x1(rL).x0(e=>e.base.x):EE().x(rL).y1(iL).y0(e=>e.base.y),c.defined(nL).curve(o)(a?l.filter(nL):l)}return(i===`vertical`&&Z(r)?EE().y(iL).x1(rL).x0(r):Z(r)?EE().x(rL).y1(iL).y0(r):TE().x(rL).y(iL)).defined(tL).curve(o)(s)},cL=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=YP();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?sL(o):r;return v.createElement(`path`,JI({},KT(e),bO(e),{className:Yt(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},lL=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function uL(){return uL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uL.apply(null,arguments)}function dL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?dL(Object(n),!0).forEach(function(t){pL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pL(e,t,n){return(t=mL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mL(e){var t=hL(e,`string`);return typeof t==`symbol`?t:t+``}function hL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gL(e,t){if(e==null)return{};var n,r,i=_L(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _L(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var vL=(e,t,n,r,i,a)=>`M${e},${i}v${r}M${a},${t}h${n}`,yL=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,c=gL(e,lL),l=fL({x:t,y:n,top:r,left:i,width:a,height:o},c);return!Z(t)||!Z(n)||!Z(a)||!Z(o)||!Z(r)||!Z(i)?null:v.createElement(`path`,uL({},JT(l),{className:Yt(`recharts-cross`,s),d:vL(t,n,a,o,r,i)}))};function bL(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function xL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function SL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?xL(Object(n),!0).forEach(function(t){CL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CL(e,t,n){return(t=wL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wL(e){var t=TL(e,`string`);return typeof t==`symbol`?t:t+``}function TL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var EL=e=>e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),DL=(e,t,n)=>e.map(e=>`${EL(e)} ${t}ms ${n}`).join(`,`),OL=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e))),kL=(e,t)=>Object.keys(t).reduce((n,r)=>SL(SL({},n),{},{[r]:e(r,t[r])}),{});function AL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?AL(Object(n),!0).forEach(function(t){ML(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ML(e,t,n){return(t=NL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NL(e){var t=PL(e,`string`);return typeof t==`symbol`?t:t+``}function PL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var FL=(e,t,n)=>e+(t-e)*n,IL=e=>{var{from:t,to:n}=e;return t!==n},LL=(e,t,n)=>{var r=kL((t,n)=>{if(IL(n)){var[r,i]=e(n.from,n.to,n.velocity);return jL(jL({},n),{},{from:r,velocity:i})}return n},t);return n<1?kL((e,t)=>IL(t)&&r[e]!=null?jL(jL({},t),{},{velocity:FL(t.velocity,r[e].velocity,n),from:FL(t.from,r[e].from,n)}):t,t):LL(e,r,n-1)};function RL(e,t,n,r,i,a){var o,s=r.reduce((n,r)=>jL(jL({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),c=()=>kL((e,t)=>t.from,s),l=()=>!Object.values(s).filter(IL).length,u=null,d=r=>{o||=r;var f=(r-o)/n.dt;s=LL(n,s,f),i(jL(jL(jL({},e),t),c())),o=r,l()||(u=a.setTimeout(d))};return()=>(u=a.setTimeout(d),()=>{var e;(e=u)==null||e()})}function zL(e,t,n,r,i,a,o){var s=null,c=i.reduce((n,r)=>{var i=e[r],a=t[r];return i==null||a==null?n:jL(jL({},n),{},{[r]:[i,a]})},{}),l,u=i=>{l||=i;var d=(i-l)/r,f=kL((e,t)=>FL(...t,n(d)),c);if(a(jL(jL(jL({},e),t),f)),d<1)s=o.setTimeout(u);else{var p=kL((e,t)=>FL(...t,n(1)),c);a(jL(jL(jL({},e),t),p))}};return()=>(s=o.setTimeout(u),()=>{var e;(e=s)==null||e()})}var BL=(e,t,n,r,i,a)=>{var o=OL(e,t);return n==null?()=>(i(jL(jL({},e),t)),()=>{}):n.isStepper===!0?RL(e,t,n,o,i,a):zL(e,t,n,r,o,i,a)},VL=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],HL=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),UL=(e,t)=>n=>HL(VL(e,t),n),WL=(e,t)=>n=>HL([...VL(e,t).map((e,t)=>e*t).slice(1),0],n),GL=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},KL=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=GL(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},qL=(e,t,n,r)=>{var i=UL(e,n),a=UL(t,r),o=WL(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},JL=function(){return qL(...KL(...arguments))},YL=function(){var{stiff:e=100,damping:t=8,dt:n=17}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=(r,i,a)=>{var o=a+(-(r-i)*e-a*t)*n/1e3,s=a*n/1e3+r;return Math.abs(s-i)<1e-4&&Math.abs(o)<1e-4?[i,0]:[s,o]};return r.isStepper=!0,r.dt=n,r},XL=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return JL(e);case`spring`:return YL();default:if(e.split(`(`)[0]===`cubic-bezier`)return JL(e)}return typeof e==`function`?e:null};function ZL(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var[s,...c]=o;if(typeof s==`number`){i=e.setTimeout(a.bind(null,c),s);return}a(s),i=e.setTimeout(a.bind(null,c));return}typeof o==`string`&&(t=o,n(t)),typeof o==`object`&&(t=o,n(t)),typeof o==`function`&&o()}};return{stop:()=>{r=!0},start:e=>{r=!1,i&&=(i(),null),a(e)},subscribe:e=>(n=e,()=>{n=()=>null}),getTimeoutController:()=>e}}var QL=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function $L(){return ZL(new QL)}var eR=(0,v.createContext)($L);function tR(e,t){var n=(0,v.useContext)(eR);return(0,v.useMemo)(()=>t??n(e),[e,t,n])}var nR={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},rR={t:0},iR={t:1};function aR(e){var t=OO(e,nR),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:c,children:l}=t,u=RI(),d=n===`auto`?!LI.isSsr&&!u:n,f=tR(t.animationId,t.animationManager),[p,m]=(0,v.useState)(d?rR:iR),h=(0,v.useRef)(null);return(0,v.useEffect)(()=>{d||m(iR)},[d]),(0,v.useEffect)(()=>{if(!d||!r)return rO;var e=BL(rR,iR,XL(a),i,m,f.getTimeoutController());return f.start([c,o,()=>{h.current=e()},i,s]),()=>{f.stop(),h.current&&h.current(),s()}},[d,r,i,a,o,c,s,f]),l(p.t)}function oR(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,v.useRef)(YD(t)),r=(0,v.useRef)(e);return r.current!==e&&(n.current=YD(t),r.current=e),n.current}var sR=[`radius`],cR=[`radius`],lR,uR,dR,fR,pR,mR,hR,gR,_R,vR;function yR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yR(Object(n),!0).forEach(function(t){xR(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xR(e,t,n){return(t=SR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SR(e){var t=CR(e,`string`);return typeof t==`symbol`?t:t+``}function CR(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function wR(){return wR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wR.apply(null,arguments)}function TR(e,t){if(e==null)return{};var n,r,i=ER(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ER(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function DR(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var OR=(e,t,n,r,i)=>{var a=HD(n),o=HD(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;p<m;p++){var h=i[p]??0;f[p]=h>s?s:h}d=UD(lR||=DR([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=UD(uR||=DR([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=UD(dR||=DR([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=UD(fR||=DR([`A `,`,`,`,0,0,`,`,
135
+ `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=UD(pR||=DR([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=UD(mR||=DR([`A `,`,`,`,0,0,`,`,
136
+ `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=UD(hR||=DR([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=UD(gR||=DR([`A `,`,`,`,0,0,`,`,
137
+ `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=UD(_R||=DR(`M .,.
136
138
  A .,.,0,0,.,.,.
137
139
  L .,.
138
140
  A .,.,0,0,.,.,.
139
141
  L .,.
140
142
  A .,.,0,0,.,.,.
141
143
  L .,.
142
- A .,.,0,0,.,.,. Z`.split(`.`)),e,t+c*g,g,g,u,e+l*g,t,e+n-l*g,t,g,g,u,e+n,t+c*g,e+n,t+r-c*g,g,g,u,e+n-l*g,t+r,e+l*g,t+r,g,g,u,e,t+r-c*g)}else d=MD(sR||=gR([`M `,`,`,` h `,` v `,` h `,` Z`]),e,t,n,r,-n);return d},vR={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},yR=e=>{var t=_O(e,vR),n=(0,v.useRef)(null),[r,i]=(0,v.useState)(-1);(0,v.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch{}},[]);var{x:a,y:o,width:s,height:c,radius:l,className:u}=t,{animationEasing:d,animationDuration:f,animationBegin:p,isAnimationActive:m,isUpdateAnimationActive:h}=t,g=(0,v.useRef)(s),_=(0,v.useRef)(c),y=(0,v.useRef)(a),b=(0,v.useRef)(o),x=YL((0,v.useMemo)(()=>({x:a,y:o,width:s,height:c,radius:l}),[a,o,s,c,l]),`rectangle-`);if(a!==+a||o!==+o||s!==+s||c!==+c||s===0||c===0)return null;var S=Yt(`recharts-rectangle`,u);if(!h){var C=LT(t),{radius:w}=C,T=mR(C,XL);return v.createElement(`path`,pR({},T,{x:jD(a),y:jD(o),width:jD(s),height:jD(c),radius:typeof l==`number`?l:void 0,className:S,d:_R(a,o,s,c,l)}))}var E=g.current,D=_.current,O=y.current,k=b.current,A=`0px ${r===-1?1:r}px`,j=`${r}px ${r}px`,M=gL([`strokeDasharray`],f,typeof d==`string`?d:vR.animationEasing);return v.createElement(JL,{animationId:x,key:x,canBegin:r>0,duration:f,easing:d,isActive:h,begin:p},e=>{var r=VD(E,s,e),i=VD(D,c,e),u=VD(O,a,e),d=VD(k,o,e);n.current&&(g.current=r,_.current=i,y.current=u,b.current=d);var f=m?e>0?{transition:M,strokeDasharray:j}:{strokeDasharray:A}:{strokeDasharray:j},p=LT(t),{radius:h}=p,x=mR(p,ZL);return v.createElement(`path`,pR({},x,{radius:typeof l==`number`?l:void 0,className:S,d:_R(u,d,r,i,l),ref:n,style:lR(lR({},f),t.style)}))})};function bR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?bR(Object(n),!0).forEach(function(t){SR(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function SR(e,t,n){return(t=CR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CR(e){var t=wR(e,`string`);return typeof t==`symbol`?t:t+``}function wR(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var TR=Math.PI/180,ER=e=>e*180/Math.PI,DR=(e,t,n,r)=>({x:e+Math.cos(-TR*r)*n,y:t+Math.sin(-TR*r)*n}),OR=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},kR=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},AR=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=kR({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:ER(c),angleInRadian:c}},jR=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},MR=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},NR=(e,t)=>{var{relativeX:n,relativeY:r}=e,{radius:i,angle:a}=AR({x:n,y:r},t),{innerRadius:o,outerRadius:s}=t;if(i<o||i>s||i===0)return null;var{startAngle:c,endAngle:l}=jR(t),u=a,d;if(c<=l){for(;u>l;)u-=360;for(;u<c;)u+=360;d=u>=c&&u<=l}else{for(;u>c;)u-=360;for(;u<l;)u+=360;d=u>=l&&u<=c}return d?xR(xR({},t),{},{radius:i,angle:MR(u,t)}):null};function PR(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[DR(t,n,r,i),DR(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var FR,IR,LR,RR,zR,BR,VR;function HR(){return HR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},HR.apply(null,arguments)}function UR(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var WR=(e,t)=>ND(t-e)*Math.min(Math.abs(t-e),359.999),GR=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:c}=e,l=s*(o?1:-1)+r,u=Math.asin(s/l)/TR,d=c?i:i+a*u,f=DR(t,n,l,d),p=DR(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:DR(t,n,l*Math.cos(u*TR),m),theta:u}},KR=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=WR(a,o),c=a+s,l=DR(t,n,i,a),u=DR(t,n,i,c),d=MD(FR||=UR([`M `,`,`,`
144
+ A .,.,0,0,.,.,. Z`.split(`.`)),e,t+c*g,g,g,u,e+l*g,t,e+n-l*g,t,g,g,u,e+n,t+c*g,e+n,t+r-c*g,g,g,u,e+n-l*g,t+r,e+l*g,t+r,g,g,u,e,t+r-c*g)}else d=UD(vR||=DR([`M `,`,`,` h `,` v `,` h `,` Z`]),e,t,n,r,-n);return d},kR={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},AR=e=>{var t=OO(e,kR),n=(0,v.useRef)(null),[r,i]=(0,v.useState)(-1);(0,v.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch{}},[]);var{x:a,y:o,width:s,height:c,radius:l,className:u}=t,{animationEasing:d,animationDuration:f,animationBegin:p,isAnimationActive:m,isUpdateAnimationActive:h}=t,g=(0,v.useRef)(s),_=(0,v.useRef)(c),y=(0,v.useRef)(a),b=(0,v.useRef)(o),x=oR((0,v.useMemo)(()=>({x:a,y:o,width:s,height:c,radius:l}),[a,o,s,c,l]),`rectangle-`);if(a!==+a||o!==+o||s!==+s||c!==+c||s===0||c===0)return null;var S=Yt(`recharts-rectangle`,u);if(!h){var C=JT(t),{radius:w}=C,T=TR(C,sR);return v.createElement(`path`,wR({},T,{x:HD(a),y:HD(o),width:HD(s),height:HD(c),radius:typeof l==`number`?l:void 0,className:S,d:OR(a,o,s,c,l)}))}var E=g.current,D=_.current,O=y.current,k=b.current,A=`0px ${r===-1?1:r}px`,j=`${r}px ${r}px`,M=DL([`strokeDasharray`],f,typeof d==`string`?d:kR.animationEasing);return v.createElement(aR,{animationId:x,key:x,canBegin:r>0,duration:f,easing:d,isActive:h,begin:p},e=>{var r=QD(E,s,e),i=QD(D,c,e),u=QD(O,a,e),d=QD(k,o,e);n.current&&(g.current=r,_.current=i,y.current=u,b.current=d);var f=m?e>0?{transition:M,strokeDasharray:j}:{strokeDasharray:A}:{strokeDasharray:j},p=JT(t),{radius:h}=p,x=TR(p,cR);return v.createElement(`path`,wR({},x,{radius:typeof l==`number`?l:void 0,className:S,d:OR(u,d,r,i,l),ref:n,style:bR(bR({},f),t.style)}))})};function jR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jR(Object(n),!0).forEach(function(t){NR(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function NR(e,t,n){return(t=PR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PR(e){var t=FR(e,`string`);return typeof t==`symbol`?t:t+``}function FR(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var IR=Math.PI/180,LR=e=>e*180/Math.PI,RR=(e,t,n,r)=>({x:e+Math.cos(-IR*r)*n,y:t+Math.sin(-IR*r)*n}),zR=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},BR=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},VR=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=BR({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:LR(c),angleInRadian:c}},HR=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},UR=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},WR=(e,t)=>{var{relativeX:n,relativeY:r}=e,{radius:i,angle:a}=VR({x:n,y:r},t),{innerRadius:o,outerRadius:s}=t;if(i<o||i>s||i===0)return null;var{startAngle:c,endAngle:l}=HR(t),u=a,d;if(c<=l){for(;u>l;)u-=360;for(;u<c;)u+=360;d=u>=c&&u<=l}else{for(;u>c;)u-=360;for(;u<l;)u+=360;d=u>=l&&u<=c}return d?MR(MR({},t),{},{radius:i,angle:UR(u,t)}):null};function GR(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[RR(t,n,r,i),RR(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var KR,qR,JR,YR,XR,ZR,QR;function $R(){return $R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$R.apply(null,arguments)}function ez(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var tz=(e,t)=>WD(t-e)*Math.min(Math.abs(t-e),359.999),nz=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:c}=e,l=s*(o?1:-1)+r,u=Math.asin(s/l)/IR,d=c?i:i+a*u,f=RR(t,n,l,d),p=RR(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:RR(t,n,l*Math.cos(u*IR),m),theta:u}},rz=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=tz(a,o),c=a+s,l=RR(t,n,i,a),u=RR(t,n,i,c),d=UD(KR||=ez([`M `,`,`,`
143
145
  A `,`,`,`,0,
144
146
  `,`,`,`,
145
147
  `,`,`,`
146
- `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=DR(t,n,r,a),p=DR(t,n,r,c);d+=MD(IR||=UR([`L `,`,`,`
148
+ `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=RR(t,n,r,a),p=RR(t,n,r,c);d+=UD(qR||=ez([`L `,`,`,`
147
149
  A `,`,`,`,0,
148
150
  `,`,`,`,
149
- `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=MD(LR||=UR([`L `,`,`,` Z`]),t,n);return d},qR=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:c,endAngle:l}=e,u=ND(l-c),{circleTangency:d,lineTangency:f,theta:p}=GR({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:m,lineTangency:h,theta:g}=GR({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),_=s?Math.abs(c-l):Math.abs(c-l)-p-g;if(_<0)return o?MD(RR||=UR([`M `,`,`,`
151
+ `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=UD(JR||=ez([`L `,`,`,` Z`]),t,n);return d},iz=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:c,endAngle:l}=e,u=WD(l-c),{circleTangency:d,lineTangency:f,theta:p}=nz({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:m,lineTangency:h,theta:g}=nz({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),_=s?Math.abs(c-l):Math.abs(c-l)-p-g;if(_<0)return o?UD(YR||=ez([`M `,`,`,`
150
152
  a`,`,`,`,0,0,1,`,`,0
151
153
  a`,`,`,`,0,0,1,`,`,0
152
- `]),f.x,f.y,a,a,a*2,a,a,-a*2):KR({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var v=MD(zR||=UR([`M `,`,`,`
154
+ `]),f.x,f.y,a,a,a*2,a,a,-a*2):rz({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var v=UD(XR||=ez([`M `,`,`,`
153
155
  A`,`,`,`,0,0,`,`,`,`,`,`
154
156
  A`,`,`,`,0,`,`,`,`,`,`,`,`
155
157
  A`,`,`,`,0,0,`,`,`,`,`,`
156
- `]),f.x,f.y,a,a,+(u<0),d.x,d.y,i,i,+(_>180),+(u<0),m.x,m.y,a,a,+(u<0),h.x,h.y);if(r>0){var{circleTangency:y,lineTangency:b,theta:x}=GR({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:S,lineTangency:C,theta:w}=GR({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),T=s?Math.abs(c-l):Math.abs(c-l)-x-w;if(T<0&&a===0)return`${v}L${t},${n}Z`;v+=MD(BR||=UR([`L`,`,`,`
158
+ `]),f.x,f.y,a,a,+(u<0),d.x,d.y,i,i,+(_>180),+(u<0),m.x,m.y,a,a,+(u<0),h.x,h.y);if(r>0){var{circleTangency:y,lineTangency:b,theta:x}=nz({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:S,lineTangency:C,theta:w}=nz({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),T=s?Math.abs(c-l):Math.abs(c-l)-x-w;if(T<0&&a===0)return`${v}L${t},${n}Z`;v+=UD(ZR||=ez([`L`,`,`,`
157
159
  A`,`,`,`,0,0,`,`,`,`,`,`
158
160
  A`,`,`,`,0,`,`,`,`,`,`,`,`
159
- A`,`,`,`,0,0,`,`,`,`,`,`Z`]),C.x,C.y,a,a,+(u<0),S.x,S.y,r,r,+(T>180),+(u>0),y.x,y.y,a,a,+(u<0),b.x,b.y)}else v+=MD(VR||=UR([`L`,`,`,`Z`]),t,n);return v},JR={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},YR=e=>{var t=_O(e,JR),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u,className:d}=t;if(a<i||l===u)return null;var f=Yt(`recharts-sector`,d),p=a-i,m=zD(o,p,0,!0),h=m>0&&Math.abs(l-u)<360?qR({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):KR({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return v.createElement(`path`,HR({},LT(t),{className:f,d:h}))};function XR(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(cO(t)){if(e===`centric`){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,c=DR(r,i,a,s),l=DR(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return PR(t)}}function ZR(e){return wD(e)?NaN:Number(e)}function QR(e){return e?(e=ZR(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function $R(e,t,n){n&&typeof n!=`number`&&Xk(e,t,n)&&(t=n=void 0),e=QR(e),t===void 0?(t=e,e=0):t=QR(t),n=n===void 0?e<t?1:-1:QR(n);let r=Math.max(Math.ceil((t-e)/(n||1)),0),i=Array(r);for(let t=0;t<r;t++)i[t]=e,e+=n;return i}var ez=e=>e.chartData,tz=$([ez],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),nz=(e,t,n,r)=>r?tz(e):ez(e),rz=(e,t,n)=>n?tz(e):ez(e);function iz(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(lN(t)&&lN(n))return!0}return!1}function az(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function oz(e,t){if(t&&typeof e!=`function`&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(lN(n))i=n;else if(typeof n==`function`)return;if(lN(r))a=r;else if(typeof r==`function`)return;var o=[i,a];if(iz(o))return o}}function sz(e,t,n){if(!(!n&&t==null)){if(typeof e==`function`&&t!=null)try{var r=e(t,n);if(iz(r))return az(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,s;if(i===`auto`)t!=null&&(o=Math.min(...t));else if(Z(i))o=i;else if(typeof i==`function`)try{t!=null&&(o=i(t?.[0]))}catch{}else if(typeof i==`string`&&AN.test(i)){var c=AN.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var l=+c[1];o=t[0]-l}}else o=t?.[0];if(a===`auto`)t!=null&&(s=Math.max(...t));else if(Z(a))s=a;else if(typeof a==`function`)try{t!=null&&(s=a(t?.[1]))}catch{}else if(typeof a==`string`&&jN.test(a)){var u=jN.exec(a);if(u==null||u[1]==null||t==null)s=void 0;else{var d=+u[1];s=t[1]+d}}else s=t?.[1];var f=[o,s];if(iz(f))return t==null?f:az(f,t,n)}}}var cz=l(o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=r<i?r:i;t<n;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l<u&&(o=m,m=h,h=o,s=l,l=u,u=s),o=[],s=l+u,r=s;r--;)o.push(0);for(r=u;--r>=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||e<t||e>n)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+``,n=p-r.length,n&&(a+=w(n)),a+=r;o=e[t],r=o+``,n=p-r.length,n&&(a+=w(n))}else if(o===0)return`0`;for(;o%10==0;)o/=10;return a+o}var b=(function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%f|0,r=n/f|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]<t[n]),e[n]=r*f+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u<T||d)&&x--;u++)C=d*f+(M[u]||0),_[u]=C/N|0,d=C%N|0;else{for(d=f/(N[0]+1)|0,d>1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y<O;)v[y++]=0;k=N.slice(),k.unshift(0),E=N[0],N[1]>=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O<h?k:N,h))):(d==0&&(c=d=1),m=N.slice()),h=m.length,h<y&&m.unshift(0),n(v,m,y),c==-1&&(y=v.length,c=t(N,v,O,y),c<1&&(d++,n(v,O<y?k:N,y))),y=v.length):c===0&&(d++,v=[0]),_[u++]=d,c&&v[0]?v[y++]=M[w]||0:(v=[M[w]],y=1);while((w++<T||v[0]!==void 0)&&x--)}return _[0]||_.shift(),g.e=l,D(g,s?o+S(g)+1:o)}})();function x(e,t){var n,r,a,o,c,u,f=0,p=0,m=e.constructor,h=m.precision;if(S(e)>16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),r<a){for(r&&e.d.push(+t.slice(0,r)),a-=p;r<a;)e.d.push(+t.slice(r,r+=p));t=t.slice(r),r=p-t.length}else r-=a;for(;r--;)t+=`0`;if(e.d.push(+t),i&&(e.e>h||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a<c,d&&(c=a),a=0;a<c;a++)if(l[a]!=m[a]){d=l[a]<m[a];break}s=0}for(d&&(n=l,l=m,m=n,t.s=-t.s),c=l.length,a=m.length-c;a>0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]<m[a]){for(o=a;o&&l[--o]===0;)l[o]=f-1;--l[o],l[a]+=f}l[a]-=m[a]}for(;l[--c]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(t.d=l,t.e=r,i?D(t,g):t):new h(0)}function k(e,t,n){var r,i=S(e),a=y(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)<o&&(a=a.slice(0,r)+`.`+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function M(e){if(!e||typeof e!=`object`)throw Error(a+`Object expected`);var t,r,i,s=[`precision`,1,n,`rounding`,0,8,`toExpNeg`,-1/0,0,`toExpPos`,0,1/0];for(t=0;t<s.length;t+=3)if((i=e[r=s[t]])!==void 0){if(c(i)===i&&i>=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i)}if((i=e[r=`LN10`])!==void 0){if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i)}return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}))());function lz(e){return e===0?1:Math.floor(new cz.default(e).abs().log(10).toNumber())+1}function uz(e,t,n){for(var r=new cz.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var dz=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},fz=(e,t,n)=>{if(e.lte(0))return new cz.default(0);var r=lz(e.toNumber()),i=new cz.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new cz.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new cz.default(s.toNumber()):new cz.default(Math.ceil(s.toNumber()))},pz=(e,t,n)=>{if(e.lte(0))return new cz.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new cz.default(i).abs().log(10).toNumber()),o=new cz.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new cz.default(10).pow(l))}var u=r[c]??1,d=new cz.default(u).mul(o);return t?d:new cz.default(Math.ceil(d.toNumber()))},mz=(e,t,n)=>{var r=new cz.default(1),i=new cz.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new cz.default(10).pow(lz(e)-1),i=new cz.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new cz.default(Math.floor(e)))}else e===0?i=new cz.default(Math.floor((t-1)/2)):n||(i=new cz.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c<t;c++)s.push(i.add(new cz.default(c-o).mul(r)).toNumber());return s},hz=function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:fz;if(!Number.isFinite((t-e)/(n-1)))return{step:new cz.default(0),tickMin:new cz.default(0),tickMax:new cz.default(0)};var o=a(new cz.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new cz.default(0):(s=new cz.default(e).add(t).div(2),s=s.sub(new cz.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new cz.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?hz(e,t,n,r,i+1,a):(u<n&&(l=t>0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new cz.default(c).mul(o)),tickMax:s.add(new cz.default(l).mul(o))})},gz=function(e){var[t,n]=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,o=Math.max(r,2),[s,c]=dz([t,n]);if(s===-1/0||c===1/0){var l=c===1/0?[s,...Array(r-1).fill(1/0)]:[...Array(r-1).fill(-1/0),c];return t>n?l.reverse():l}if(s===c)return mz(s,r,i);var{step:u,tickMin:d,tickMax:f}=hz(s,c,o,i,0,a===`snap125`?pz:fz),p=uz(d,f.add(new cz.default(.1).mul(u)),u);return t>n?p.reverse():p},_z=function(e,t){var[n,r]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,[o,s]=dz([n,r]);if(o===-1/0||s===1/0)return[n,r];if(o===s)return[o];var c=a===`snap125`?pz:fz,l=Math.max(t,2),u=c(new cz.default(s).sub(o).div(l-1),i,0),d=[...uz(new cz.default(o),new cz.default(s),u),s];return i===!1&&(d=d.map(e=>Math.round(e))),n>r?d.reverse():d},vz=e=>e.rootProps.maxBarSize,yz=e=>e.rootProps.barGap,bz=e=>e.rootProps.barCategoryGap,xz=e=>e.rootProps.barSize,Sz=e=>e.rootProps.stackOffset,Cz=e=>e.rootProps.reverseStackOrder,wz=e=>e.options.chartName,Tz=e=>e.rootProps.syncId,Ez=e=>e.rootProps.syncMethod,Dz=e=>e.options.eventEmitter,Oz={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},kz={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:Oz.axis},Az={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:Oz.axis},jz=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function Mz(e,t,n){if(n!==`auto`)return n;if(e!=null)return vN(e,t)?`category`:`number`}function Nz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pz(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Nz(Object(n),!0).forEach(function(t){Fz(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nz(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fz(e,t,n){return(t=Iz(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Iz(e){var t=Lz(e,`string`);return typeof t==`symbol`?t:t+``}function Lz(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Rz={allowDataOverflow:kz.allowDataOverflow,allowDecimals:kz.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:kz.angleAxisId,includeHidden:!1,name:void 0,reversed:kz.reversed,scale:kz.scale,tick:kz.tick,tickCount:void 0,ticks:void 0,type:kz.type,unit:void 0,niceTicks:`auto`},zz={allowDataOverflow:Az.allowDataOverflow,allowDecimals:Az.allowDecimals,allowDuplicatedCategory:Az.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Az.radiusAxisId,includeHidden:Az.includeHidden,name:void 0,reversed:Az.reversed,scale:Az.scale,tick:Az.tick,tickCount:Az.tickCount,ticks:void 0,type:Az.type,unit:void 0,niceTicks:`auto`},Bz=$([(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},BP],(e,t)=>{if(e!=null)return e;var n=Mz(t,`angleAxis`,Rz.type)??`category`;return Pz(Pz({},Rz),{},{type:n})}),Vz=$([(e,t)=>e.polarAxis.radiusAxis[t],BP],(e,t)=>{if(e!=null)return e;var n=Mz(t,`radiusAxis`,zz.type)??`category`;return Pz(Pz({},zz),{},{type:n})}),Hz=e=>e.polarOptions,Uz=$([LN,RN,eP],OR),Wz=$([Hz,Uz],(e,t)=>{if(e!=null)return zD(e.innerRadius,t,0)}),Gz=$([Hz,Uz],(e,t)=>{if(e!=null)return zD(e.outerRadius,t,t*.8)}),Kz=$([Hz],e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});$([Bz,Kz],jz);var qz=$([Uz,Wz,Gz],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});$([Vz,qz],jz);var Jz=$([LP,Hz,Wz,Gz,LN,RN],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var{cx:o,cy:s,startAngle:c,endAngle:l}=t;return{cx:zD(o,i,i/2),cy:zD(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),Yz=(e,t)=>t,Xz=(e,t,n)=>n;function Zz(e){return e?.id}function Qz(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t=e.data??r;if(t!=null&&t.length!==0){var n=Zz(e);t.forEach((t,r)=>{var s=a==null||i?r:String(gN(t,a,null)),c=gN(t,e.dataKey,0),l=o.has(s)?o.get(s):{};Object.assign(l,{[n]:c}),o.set(s,l)})}}),Array.from(o.values())}function $z(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var eB=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function tB(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function nB(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}var rB=e=>{var t=LP(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},iB=e=>e.tooltip.settings.axisId;function aB(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var oB=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!iz(t)){for(var n,r,i=0;i<t.length;i++){var a=t[i];lN(a)&&((n===void 0||a<n)&&(n=a),(r===void 0||a>r)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function sB(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function cB(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function lB(e){let t,n,r;e.length===2?(t=e===sB||e===cB?e:uB,n=e,r=e):(t=sB,n=(t,n)=>sB(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function uB(){return 0}function dB(e){return e===null?NaN:+e}function*fB(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var pB=lB(sB),mB=pB.right;pB.left,lB(dB).center;var hB=class extends Map{constructor(e,t=yB){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(gB(this,e))}has(e){return super.has(gB(this,e))}set(e,t){return super.set(_B(this,e),t)}delete(e){return super.delete(vB(this,e))}};function gB({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _B({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function vB({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function yB(e){return typeof e==`object`&&e?e.valueOf():e}function bB(e=sB){if(e===sB)return xB;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function xB(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:+(e>t))}var SB=Math.sqrt(50),CB=Math.sqrt(10),wB=Math.sqrt(2);function TB(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=SB?10:a>=CB?5:a>=wB?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?TB(e,t,n*2):[s,c,l]}function EB(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?TB(t,e,n):TB(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o}else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function DB(e,t,n){return t=+t,e=+e,n=+n,TB(e,t,n)[2]}function OB(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?DB(t,e,n):DB(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function kB(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function AB(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function jB(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?xB:bB(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));jB(e,t,u,d,i)}let a=e[t],o=n,s=r;for(MB(e,n,t),i(e[r],a)>0&&MB(e,n,r);o<s;){for(MB(e,o,s),++o,--s;i(e[o],a)<0;)++o;for(;i(e[s],a)>0;)--s}i(e[n],a)===0?MB(e,n,s):(++s,MB(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function MB(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function NB(e,t,n){if(e=Float64Array.from(fB(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return AB(e);if(t>=1)return kB(e);var r,i=(r-1)*t,a=Math.floor(i),o=kB(jB(e,a).subarray(0,a+1));return o+(AB(e.subarray(a+1))-o)*(i-a)}}function PB(e,t,n=dB){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function FB(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function IB(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function LB(e,t){switch(arguments.length){case 0:break;case 1:typeof e==`function`?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t==`function`?this.interpolator(t):this.range(t)}return this}var RB=Symbol(`implicit`);function zB(){var e=new hB,t=[],n=[],r=RB;function i(i){let a=e.get(i);if(a===void 0){if(r!==RB)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new hB;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return zB(t,n).unknown(r)},IB.apply(i,arguments),i}function BB(){var e=zB().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=FB(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return BB(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},IB.apply(d(),arguments)}function VB(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return VB(t())},e}function HB(){return VB(BB.apply(null,arguments).paddingInner(1))}function UB(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function WB(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function GB(){}var KB=.7,qB=1/KB,JB=`\\s*([+-]?\\d+)\\s*`,YB=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,XB=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ZB=/^#([0-9a-f]{3,8})$/,QB=RegExp(`^rgb\\(${JB},${JB},${JB}\\)$`),$B=RegExp(`^rgb\\(${XB},${XB},${XB}\\)$`),eV=RegExp(`^rgba\\(${JB},${JB},${JB},${YB}\\)$`),tV=RegExp(`^rgba\\(${XB},${XB},${XB},${YB}\\)$`),nV=RegExp(`^hsl\\(${YB},${XB},${XB}\\)$`),rV=RegExp(`^hsla\\(${YB},${XB},${XB},${YB}\\)$`),iV={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};UB(GB,lV,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:aV,formatHex:aV,formatHex8:oV,formatHsl:sV,formatRgb:cV,toString:cV});function aV(){return this.rgb().formatHex()}function oV(){return this.rgb().formatHex8()}function sV(){return SV(this).formatHsl()}function cV(){return this.rgb().formatRgb()}function lV(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ZB.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?uV(t):n===3?new mV(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?dV(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?dV(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=QB.exec(e))?new mV(t[1],t[2],t[3],1):(t=$B.exec(e))?new mV(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=eV.exec(e))?dV(t[1],t[2],t[3],t[4]):(t=tV.exec(e))?dV(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nV.exec(e))?xV(t[1],t[2]/100,t[3]/100,1):(t=rV.exec(e))?xV(t[1],t[2]/100,t[3]/100,t[4]):iV.hasOwnProperty(e)?uV(iV[e]):e===`transparent`?new mV(NaN,NaN,NaN,0):null}function uV(e){return new mV(e>>16&255,e>>8&255,e&255,1)}function dV(e,t,n,r){return r<=0&&(e=t=n=NaN),new mV(e,t,n,r)}function fV(e){return e instanceof GB||(e=lV(e)),e?(e=e.rgb(),new mV(e.r,e.g,e.b,e.opacity)):new mV}function pV(e,t,n,r){return arguments.length===1?fV(e):new mV(e,t,n,r??1)}function mV(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}UB(mV,pV,WB(GB,{brighter(e){return e=e==null?qB:qB**+e,new mV(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?KB:KB**+e,new mV(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mV(yV(this.r),yV(this.g),yV(this.b),vV(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:hV,formatHex:hV,formatHex8:gV,formatRgb:_V,toString:_V}));function hV(){return`#${bV(this.r)}${bV(this.g)}${bV(this.b)}`}function gV(){return`#${bV(this.r)}${bV(this.g)}${bV(this.b)}${bV((isNaN(this.opacity)?1:this.opacity)*255)}`}function _V(){let e=vV(this.opacity);return`${e===1?`rgb(`:`rgba(`}${yV(this.r)}, ${yV(this.g)}, ${yV(this.b)}${e===1?`)`:`, ${e})`}`}function vV(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yV(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bV(e){return e=yV(e),(e<16?`0`:``)+e.toString(16)}function xV(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new wV(e,t,n,r)}function SV(e){if(e instanceof wV)return new wV(e.h,e.s,e.l,e.opacity);if(e instanceof GB||(e=lV(e)),!e)return new wV;if(e instanceof wV)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new wV(o,s,c,e.opacity)}function CV(e,t,n,r){return arguments.length===1?SV(e):new wV(e,t,n,r??1)}function wV(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}UB(wV,CV,WB(GB,{brighter(e){return e=e==null?qB:qB**+e,new wV(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?KB:KB**+e,new wV(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new mV(DV(e>=240?e-240:e+120,i,r),DV(e,i,r),DV(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new wV(TV(this.h),EV(this.s),EV(this.l),vV(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=vV(this.opacity);return`${e===1?`hsl(`:`hsla(`}${TV(this.h)}, ${EV(this.s)*100}%, ${EV(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function TV(e){return e=(e||0)%360,e<0?e+360:e}function EV(e){return Math.max(0,Math.min(1,e||0))}function DV(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var OV=e=>()=>e;function kV(e,t){return function(n){return e+n*t}}function AV(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function jV(e){return(e=+e)==1?MV:function(t,n){return n-t?AV(t,n,e):OV(isNaN(t)?n:t)}}function MV(e,t){var n=t-e;return n?kV(e,n):OV(isNaN(e)?t:e)}var NV=(function e(t){var n=jV(t);function r(e,t){var r=n((e=pV(e)).r,(t=pV(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=MV(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function PV(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function FV(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function IV(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=GV(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function LV(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function RV(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function zV(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=GV(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var BV=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,VV=new RegExp(BV.source,`g`);function HV(e){return function(){return e}}function UV(e){return function(t){return e(t)+``}}function WV(e,t){var n=BV.lastIndex=VV.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=BV.exec(e))&&(i=VV.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:RV(r,i)})),n=VV.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?UV(c[0].x):HV(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function GV(e,t){var n=typeof t,r;return t==null||n===`boolean`?OV(t):(n===`number`?RV:n===`string`?(r=lV(t))?(t=r,NV):WV:t instanceof lV?NV:t instanceof Date?LV:FV(t)?PV:Array.isArray(t)?IV:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?zV:RV)(e,t)}function KV(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function qV(e,t){t===void 0&&(t=e,e=GV);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}function JV(e){return function(){return e}}function YV(e){return+e}var XV=[0,1];function ZV(e){return e}function QV(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:JV(isNaN(t)?NaN:.5)}function $V(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function eH(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=QV(i,r),a=n(o,a)):(r=QV(r,i),a=n(a,o)),function(e){return a(r(e))}}function tH(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=QV(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=mB(e,t,1,r)-1;return a[n](i[n](t))}}function nH(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function rH(){var e=XV,t=XV,n=GV,r,i,a,o=ZV,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==ZV&&(o=$V(e[0],e[n-1])),s=n>2?tH:eH,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),RV))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,YV),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=KV,u()},d.clamp=function(e){return arguments.length?(o=e?!0:ZV,u()):o!==ZV},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function iH(){return rH()(ZV,ZV)}function aH(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function oH(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function sH(e){return e=oH(Math.abs(e)),e?e[1]:NaN}function cH(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function lH(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var uH=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function dH(e){if(!(t=uH.exec(e)))throw Error(`invalid format: `+e);var t;return new fH({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}dH.prototype=fH.prototype;function fH(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}fH.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function pH(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var mH;function hH(e,t){var n=oH(e,t);if(!n)return mH=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(mH=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+oH(e,Math.max(0,t+a-1))[0]}function gH(e,t){var n=oH(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var _H={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:aH,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>gH(e*100,t),r:gH,s:hH,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function vH(e){return e}var yH=Array.prototype.map,bH=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function xH(e){var t=e.grouping===void 0||e.thousands===void 0?vH:cH(yH.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?vH:lH(yH.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=dH(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):_H[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=_H[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=pH(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&mH!==void 0?bH[8+mH/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(sH(t)/3)))*3,r=10**-n,i=l((e=dH(e),e.type=`f`,e),{suffix:bH[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var SH,CH,wH;TH({thousands:`,`,grouping:[3],currency:[`$`,``]});function TH(e){return SH=xH(e),CH=SH.format,wH=SH.formatPrefix,SH}function EH(e){return Math.max(0,-sH(Math.abs(e)))}function DH(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(sH(t)/3)))*3-sH(Math.abs(e)))}function OH(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,sH(t)-sH(e))+1}function kH(e,t,n,r){var i=OB(e,t,n),a;switch(r=dH(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=DH(i,o))&&(r.precision=a),wH(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=OH(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=EH(i))&&(r.precision=a-(r.type===`%`)*2)}return CH(r)}function AH(e){var t=e.domain;return e.ticks=function(e){var n=t();return EB(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return kH(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=DB(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function jH(){var e=iH();return e.copy=function(){return nH(e,jH())},IB.apply(e,arguments),AH(e)}function MH(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,YV),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return MH(e).unknown(t)},e=arguments.length?Array.from(e,YV):[0,1],AH(n)}function NH(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}function PH(e){return Math.log(e)}function FH(e){return Math.exp(e)}function IH(e){return-Math.log(-e)}function LH(e){return-Math.exp(-e)}function RH(e){return isFinite(e)?+(`1e`+e):e<0?0:e}function zH(e){return e===10?RH:e===Math.E?Math.exp:t=>e**+t}function BH(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function VH(e){return(t,n)=>-e(-t,n)}function HH(e){let t=e(PH,FH),n=t.domain,r=10,i,a;function o(){return i=BH(r),a=zH(r),n()[0]<0?(i=VH(i),a=VH(a),e(IH,LH)):e(PH,FH),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s<o;c&&([o,s]=[s,o]);let l=i(o),u=i(s),d,f,p=e==null?10:+e,m=[];if(!(r%1)&&u-l<p){if(l=Math.floor(l),u=Math.ceil(u),o>0){for(;l<=u;++l)for(d=1;d<r;++d)if(f=l<0?d/a(-l):d*a(l),!(f<o)){if(f>s)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(f<o)){if(f>s)break;m.push(f)}m.length*2<p&&(m=EB(o,s,p))}else m=EB(l,u,Math.min(u-l,p)).map(a);return c?m.reverse():m},t.tickFormat=(e,n)=>{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=dH(n)).precision==null&&(n.trim=!0),n=CH(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*r<r-.5&&(t*=r),t<=o?n(e):``}},t.nice=()=>n(NH(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function UH(){let e=HH(rH()).domain([1,10]);return e.copy=()=>nH(e,UH()).base(e.base()),IB.apply(e,arguments),e}function WH(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function GH(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function KH(e){var t=1,n=e(WH(t),GH(t));return n.constant=function(n){return arguments.length?e(WH(t=+n),GH(t)):t},AH(n)}function qH(){var e=KH(rH());return e.copy=function(){return nH(e,qH()).constant(e.constant())},IB.apply(e,arguments)}function JH(e){return function(t){return t<0?-((-t)**+e):t**+e}}function YH(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function XH(e){return e<0?-e*e:e*e}function ZH(e){var t=e(ZV,ZV),n=1;function r(){return n===1?e(ZV,ZV):n===.5?e(YH,XH):e(JH(n),JH(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},AH(t)}function QH(){var e=ZH(rH());return e.copy=function(){return nH(e,QH()).exponent(e.exponent())},IB.apply(e,arguments),e}function $H(){return QH.apply(null,arguments).exponent(.5)}function eU(e){return Math.sign(e)*e*e}function tU(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function nU(){var e=iH(),t=[0,1],n=!1,r;function i(t){var i=tU(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(eU(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,YV)).map(eU)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return nU(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},IB.apply(i,arguments),AH(i)}function rU(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r<i;)n[r-1]=PB(e,r/i);return a}function a(e){return e==null||isNaN(e=+e)?r:t[mB(n,e)]}return a.invertExtent=function(r){var i=t.indexOf(r);return i<0?[NaN,NaN]:[i>0?n[i-1]:e[0],i<n.length?n[i]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)n!=null&&!isNaN(n=+n)&&e.push(n);return e.sort(sB),i()},a.range=function(e){return arguments.length?(t=Array.from(e),i()):t.slice()},a.unknown=function(e){return arguments.length?(r=e,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return rU().domain(e).range(t).unknown(r)},IB.apply(a,arguments)}function iU(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[mB(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++i<n;)r[i]=((i+1)*t-(i-n)*e)/(n+1);return o}return o.domain=function(n){return arguments.length?([e,t]=n,e=+e,t=+t,s()):[e,t]},o.range=function(e){return arguments.length?(n=(i=Array.from(e)).length-1,s()):i.slice()},o.invertExtent=function(a){var o=i.indexOf(a);return o<0?[NaN,NaN]:o<1?[e,r[0]]:o>=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return iU().domain([e,t]).range(i).unknown(a)},IB.apply(AH(o),arguments)}function aU(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[mB(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return aU().domain(e).range(t).unknown(n)},IB.apply(i,arguments)}var oU=new Date,sU=new Date;function cU(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n<r)||!(a>0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s<n&&n<r);return o},i.filter=n=>cU(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(i.count=(t,r)=>(oU.setTime(+t),sU.setTime(+r),e(oU),e(sU),Math.floor(n(oU,sU))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var lU=cU(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);lU.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?cU(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):lU),lU.range;var uU=1e3,dU=uU*60,fU=dU*60,pU=fU*24,mU=pU*7,hU=pU*30,gU=pU*365,_U=cU(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*uU)},(e,t)=>(t-e)/uU,e=>e.getUTCSeconds());_U.range;var vU=cU(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*uU)},(e,t)=>{e.setTime(+e+t*dU)},(e,t)=>(t-e)/dU,e=>e.getMinutes());vU.range;var yU=cU(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*dU)},(e,t)=>(t-e)/dU,e=>e.getUTCMinutes());yU.range;var bU=cU(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*uU-e.getMinutes()*dU)},(e,t)=>{e.setTime(+e+t*fU)},(e,t)=>(t-e)/fU,e=>e.getHours());bU.range;var xU=cU(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*fU)},(e,t)=>(t-e)/fU,e=>e.getUTCHours());xU.range;var SU=cU(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*dU)/pU,e=>e.getDate()-1);SU.range;var CU=cU(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/pU,e=>e.getUTCDate()-1);CU.range;var wU=cU(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/pU,e=>Math.floor(e/pU));wU.range;function TU(e){return cU(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*dU)/mU)}var EU=TU(0),DU=TU(1),OU=TU(2),kU=TU(3),AU=TU(4),jU=TU(5),MU=TU(6);EU.range,DU.range,OU.range,kU.range,AU.range,jU.range,MU.range;function NU(e){return cU(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/mU)}var PU=NU(0),FU=NU(1),IU=NU(2),LU=NU(3),RU=NU(4),zU=NU(5),BU=NU(6);PU.range,FU.range,IU.range,LU.range,RU.range,zU.range,BU.range;var VU=cU(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());VU.range;var HU=cU(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());HU.range;var UU=cU(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());UU.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:cU(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),UU.range;var WU=cU(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());WU.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:cU(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),WU.range;function GU(e,t,n,r,i,a){let o=[[_U,1,uU],[_U,5,5*uU],[_U,15,15*uU],[_U,30,30*uU],[a,1,dU],[a,5,5*dU],[a,15,15*dU],[a,30,30*dU],[i,1,fU],[i,3,3*fU],[i,6,6*fU],[i,12,12*fU],[r,1,pU],[r,2,2*pU],[n,1,mU],[t,1,hU],[t,3,3*hU],[e,1,gU]];function s(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&typeof n.range==`function`?n:c(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a}function c(t,n,r){let i=Math.abs(n-t)/r,a=lB(([,,e])=>e).right(o,i);if(a===o.length)return e.every(OB(t/gU,n/gU,r));if(a===0)return lU.every(Math.max(OB(t,n,r),1));let[s,c]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(c)}return[s,c]}var[KU,qU]=GU(WU,HU,PU,wU,xU,yU),[JU,YU]=GU(UU,VU,EU,SU,bU,vU);function XU(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function ZU(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function QU(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function $U(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=oW(i),u=sW(i),d=oW(a),f=sW(a),p=oW(o),m=sW(o),h=oW(s),g=sW(s),_=oW(c),v=sW(c),y={a:N,A:P,b:ee,B:F,c:null,d:OW,e:OW,f:NW,g:WW,G:KW,H:kW,I:AW,j:jW,L:MW,m:PW,M:FW,p:I,q:te,Q:hG,s:gG,S:IW,u:LW,U:RW,V:BW,w:VW,W:HW,x:null,X:null,y:UW,Y:GW,Z:qW,"%":mG},b={a:L,A:ne,b:re,B:R,c:null,d:JW,e:JW,f:$W,g:uG,G:fG,H:YW,I:XW,j:ZW,L:QW,m:eG,M:tG,p:ie,q:ae,Q:hG,s:gG,S:nG,u:rG,U:iG,V:oG,w:sG,W:cG,x:null,X:null,y:lG,Y:dG,Z:pG,"%":mG},x={a:E,A:D,b:O,B:k,c:A,d:vW,e:vW,f:wW,g:mW,G:pW,H:bW,I:bW,j:yW,L:CW,m:_W,M:xW,p:T,q:gW,Q:EW,s:DW,S:SW,u:lW,U:uW,V:dW,w:cW,W:fW,x:j,X:M,y:mW,Y:pW,Z:hW,"%":TW};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=eW[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function C(e,t){return function(n){var r=QU(1900,void 0,1),i=w(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=ZU(QU(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?FU.ceil(a):FU(a),a=CU.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=XU(QU(r.y,0,1)),o=a.getDay(),a=o>4||o===0?DU.ceil(a):DU(a),a=SU.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?ZU(QU(r.y,0,1)).getUTCDay():XU(QU(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,ZU(r)):XU(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in eW?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function ee(e){return c[e.getMonth()]}function F(e){return s[e.getMonth()]}function I(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function L(e){return o[e.getUTCDay()]}function ne(e){return a[e.getUTCDay()]}function re(e){return c[e.getUTCMonth()]}function R(e){return s[e.getUTCMonth()]}function ie(e){return i[+(e.getUTCHours()>=12)]}function ae(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var eW={"-":``,_:` `,0:`0`},tW=/^\s*\d+/,nW=/^%/,rW=/[\\^$*+?|[\]().{}]/g;function iW(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function aW(e){return e.replace(rW,`\\$&`)}function oW(e){return RegExp(`^(?:`+e.map(aW).join(`|`)+`)`,`i`)}function sW(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function cW(e,t,n){var r=tW.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function lW(e,t,n){var r=tW.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function uW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function dW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function fW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function pW(e,t,n){var r=tW.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function mW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function hW(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function gW(e,t,n){var r=tW.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function _W(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function vW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function yW(e,t,n){var r=tW.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function bW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function xW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function SW(e,t,n){var r=tW.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function CW(e,t,n){var r=tW.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function wW(e,t,n){var r=tW.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function TW(e,t,n){var r=nW.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function EW(e,t,n){var r=tW.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function DW(e,t,n){var r=tW.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function OW(e,t){return iW(e.getDate(),t,2)}function kW(e,t){return iW(e.getHours(),t,2)}function AW(e,t){return iW(e.getHours()%12||12,t,2)}function jW(e,t){return iW(1+SU.count(UU(e),e),t,3)}function MW(e,t){return iW(e.getMilliseconds(),t,3)}function NW(e,t){return MW(e,t)+`000`}function PW(e,t){return iW(e.getMonth()+1,t,2)}function FW(e,t){return iW(e.getMinutes(),t,2)}function IW(e,t){return iW(e.getSeconds(),t,2)}function LW(e){var t=e.getDay();return t===0?7:t}function RW(e,t){return iW(EU.count(UU(e)-1,e),t,2)}function zW(e){var t=e.getDay();return t>=4||t===0?AU(e):AU.ceil(e)}function BW(e,t){return e=zW(e),iW(AU.count(UU(e),e)+(UU(e).getDay()===4),t,2)}function VW(e){return e.getDay()}function HW(e,t){return iW(DU.count(UU(e)-1,e),t,2)}function UW(e,t){return iW(e.getFullYear()%100,t,2)}function WW(e,t){return e=zW(e),iW(e.getFullYear()%100,t,2)}function GW(e,t){return iW(e.getFullYear()%1e4,t,4)}function KW(e,t){var n=e.getDay();return e=n>=4||n===0?AU(e):AU.ceil(e),iW(e.getFullYear()%1e4,t,4)}function qW(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+iW(t/60|0,`0`,2)+iW(t%60,`0`,2)}function JW(e,t){return iW(e.getUTCDate(),t,2)}function YW(e,t){return iW(e.getUTCHours(),t,2)}function XW(e,t){return iW(e.getUTCHours()%12||12,t,2)}function ZW(e,t){return iW(1+CU.count(WU(e),e),t,3)}function QW(e,t){return iW(e.getUTCMilliseconds(),t,3)}function $W(e,t){return QW(e,t)+`000`}function eG(e,t){return iW(e.getUTCMonth()+1,t,2)}function tG(e,t){return iW(e.getUTCMinutes(),t,2)}function nG(e,t){return iW(e.getUTCSeconds(),t,2)}function rG(e){var t=e.getUTCDay();return t===0?7:t}function iG(e,t){return iW(PU.count(WU(e)-1,e),t,2)}function aG(e){var t=e.getUTCDay();return t>=4||t===0?RU(e):RU.ceil(e)}function oG(e,t){return e=aG(e),iW(RU.count(WU(e),e)+(WU(e).getUTCDay()===4),t,2)}function sG(e){return e.getUTCDay()}function cG(e,t){return iW(FU.count(WU(e)-1,e),t,2)}function lG(e,t){return iW(e.getUTCFullYear()%100,t,2)}function uG(e,t){return e=aG(e),iW(e.getUTCFullYear()%100,t,2)}function dG(e,t){return iW(e.getUTCFullYear()%1e4,t,4)}function fG(e,t){var n=e.getUTCDay();return e=n>=4||n===0?RU(e):RU.ceil(e),iW(e.getUTCFullYear()%1e4,t,4)}function pG(){return`+0000`}function mG(){return`%`}function hG(e){return+e}function gG(e){return Math.floor(e/1e3)}var _G,vG,yG;bG({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function bG(e){return _G=$U(e),vG=_G.format,_G.parse,yG=_G.utcFormat,_G.utcParse,_G}function xG(e){return new Date(e)}function SG(e){return e instanceof Date?+e:+new Date(+e)}function CG(e,t,n,r,i,a,o,s,c,l){var u=iH(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)<e?p:s(e)<e?m:o(e)<e?h:a(e)<e?g:r(e)<e?i(e)<e?_:v:n(e)<e?y:b)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,SG)):f().map(xG)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],t??10)},u.tickFormat=function(e,t){return t==null?x:l(t)},u.nice=function(e){var n=f();return(!e||typeof e.range!=`function`)&&(e=t(n[0],n[n.length-1],e??10)),e?f(NH(n,e)):u},u.copy=function(){return nH(u,CG(e,t,n,r,i,a,o,s,c,l))},u}function wG(){return IB.apply(CG(JU,YU,UU,VU,EU,SU,bU,vU,_U,vG).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function TG(){return IB.apply(CG(KU,qU,WU,HU,PU,CU,xU,yU,_U,yG).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function EG(){var e=0,t=1,n,r,i,a,o=ZV,s=!1,c;function l(e){return e==null||isNaN(e=+e)?c:o(i===0?.5:(e=(a(e)-n)*i,s?Math.max(0,Math.min(1,e)):e))}l.domain=function(o){return arguments.length?([e,t]=o,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(e){return arguments.length?(s=!!e,l):s},l.interpolator=function(e){return arguments.length?(o=e,l):o};function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,o=e(n,r),l):[o(0),o(1)]}}return l.range=u(GV),l.rangeRound=u(KV),l.unknown=function(e){return arguments.length?(c=e,l):c},function(o){return a=o,n=o(e),r=o(t),i=n===r?0:1/(r-n),l}}function DG(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function OG(){var e=AH(EG()(ZV));return e.copy=function(){return DG(e,OG())},LB.apply(e,arguments)}function kG(){var e=HH(EG()).domain([1,10]);return e.copy=function(){return DG(e,kG()).base(e.base())},LB.apply(e,arguments)}function AG(){var e=KH(EG());return e.copy=function(){return DG(e,AG()).constant(e.constant())},LB.apply(e,arguments)}function jG(){var e=ZH(EG());return e.copy=function(){return DG(e,jG()).exponent(e.exponent())},LB.apply(e,arguments)}function MG(){return jG.apply(null,arguments).exponent(.5)}function NG(){var e=[],t=ZV;function n(n){if(n!=null&&!isNaN(n=+n))return t((mB(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)n!=null&&!isNaN(n=+n)&&e.push(n);return e.sort(sB),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>NB(e,r/t))},n.copy=function(){return NG(t).domain(e)},LB.apply(n,arguments)}function PG(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=ZV,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e<r*a?s:c),l(d?Math.max(0,Math.min(1,e)):e))}p.domain=function(l){return arguments.length?([e,t,n]=l,i=u(e=+e),a=u(t=+t),o=u(n=+n),s=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,p):[e,t,n]},p.clamp=function(e){return arguments.length?(d=!!e,p):d},p.interpolator=function(e){return arguments.length?(l=e,p):l};function m(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,l=qV(e,[n,r,i]),p):[l(0),l(.5),l(1)]}}return p.range=m(GV),p.rangeRound=m(KV),p.unknown=function(e){return arguments.length?(f=e,p):f},function(l){return u=l,i=l(e),a=l(t),o=l(n),s=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,p}}function FG(){var e=AH(PG()(ZV));return e.copy=function(){return DG(e,FG())},LB.apply(e,arguments)}function IG(){var e=HH(PG()).domain([.1,1,10]);return e.copy=function(){return DG(e,IG()).base(e.base())},LB.apply(e,arguments)}function LG(){var e=KH(PG());return e.copy=function(){return DG(e,LG()).constant(e.constant())},LB.apply(e,arguments)}function RG(){var e=ZH(PG());return e.copy=function(){return DG(e,RG()).exponent(e.exponent())},LB.apply(e,arguments)}function zG(){return RG.apply(null,arguments).exponent(.5)}var BG=s({scaleBand:()=>BB,scaleDiverging:()=>FG,scaleDivergingLog:()=>IG,scaleDivergingPow:()=>RG,scaleDivergingSqrt:()=>zG,scaleDivergingSymlog:()=>LG,scaleIdentity:()=>MH,scaleImplicit:()=>RB,scaleLinear:()=>jH,scaleLog:()=>UH,scaleOrdinal:()=>zB,scalePoint:()=>HB,scalePow:()=>QH,scaleQuantile:()=>rU,scaleQuantize:()=>iU,scaleRadial:()=>nU,scaleSequential:()=>OG,scaleSequentialLog:()=>kG,scaleSequentialPow:()=>jG,scaleSequentialQuantile:()=>NG,scaleSequentialSqrt:()=>MG,scaleSequentialSymlog:()=>AG,scaleSqrt:()=>$H,scaleSymlog:()=>qH,scaleThreshold:()=>aU,scaleTime:()=>wG,scaleUtc:()=>TG,tickFormat:()=>kH});function VG(e){if(e in BG)return BG[e]();var t=`scale${WD(e)}`;if(t in BG)return BG[t]()}function HG(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=VG(e);if(r!=null)return r.domain(t).range(n),r}}function UG(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?HG(e.scale,n,r):HG(t,n,r)}function WG(e){return`scale${WD(e)}`}function GG(e){return WG(e)in BG}var KG=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return GG(r)?r:`point`}};function qG(e,t){for(var n=0,r=e.length,i=e[0]<e[e.length-1];n<r;){var a=Math.floor((n+r)/2);(i?e[a]<t:e[a]>t)?n=a+1:r=a}return n}function JG(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=qG(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function YG(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):JG(e,void 0)}function XG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ZG(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?XG(Object(n),!0).forEach(function(t){QG(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function QG(e,t,n){return(t=$G(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $G(e){var t=eK(e,`string`);return typeof t==`symbol`?t:t+``}function eK(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var tK=[0,`auto`],nK={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`bottom`,padding:{left:0,right:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`category`,unit:void 0,niceTicks:`auto`},rK=(e,t)=>e.cartesianAxis.xAxis[t],iK=(e,t)=>rK(e,t)??nK,aK={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:tK,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,niceTicks:`auto`,width:60},oK=(e,t)=>e.cartesianAxis.yAxis[t],sK=(e,t)=>oK(e,t)??aK,cK={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},lK=(e,t)=>e.cartesianAxis.zAxis[t]??cK,uK=(e,t,n)=>{switch(t){case`xAxis`:return iK(e,n);case`yAxis`:return sK(e,n);case`zAxis`:return lK(e,n);case`angleAxis`:return Bz(e,n);case`radiusAxis`:return Vz(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},dK=(e,t,n)=>{switch(t){case`xAxis`:return iK(e,n);case`yAxis`:return sK(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},fK=(e,t,n)=>{switch(t){case`xAxis`:return iK(e,n);case`yAxis`:return sK(e,n);case`angleAxis`:return Bz(e,n);case`radiusAxis`:return Vz(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},pK=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function mK(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var hK=e=>e.graphicalItems.cartesianItems,gK=$([Yz,Xz],mK),_K=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),vK=$([hK,uK,gK],_K,{memoizeOptions:{resultEqualityCheck:tB}}),yK=$([vK],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter($z)),bK=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),xK=$([vK],bK),SK=e=>e.map(e=>e.data).filter(Boolean).flat(1),CK=$([vK],SK,{memoizeOptions:{resultEqualityCheck:tB}}),wK=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},TK=$([CK,nz],wK),EK=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:gN(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:gN(e,t.dataKey)})),DK=$([TK,uK,vK],EK);function OK(e){if(ID(e)||e instanceof Date){var t=Number(e);if(lN(t))return t}}function kK(e){if(Array.isArray(e)){var t=[OK(e[0]),OK(e[1])];return iz(t)?t:void 0}var n=OK(e);if(n!=null)return[n,n]}function AK(e){return e.map(OK).filter(GD)}function jK(e,t){var n=OK(e),r=OK(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var MK=$([DK],e=>e?.map(e=>e.value).sort(jK));function NK(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function PK(e,t,n){return!n||typeof t!=`number`||PD(t)||!n.length?[]:AK(n.flatMap(n=>{var r=gN(e,n.dataKey),i,a;if(Array.isArray(r)?[i,a]=r:i=a=r,!(!lN(i)||!lN(a)))return[t-i,t+a]}))}var FK=e=>fK(e,rB(e),iB(e)),IK=$([FK],e=>e?.dataKey),LK=$([yK,nz,FK],Qz),RK=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var[i,a]=t,o=r?[...a].reverse():a;return[i,{stackedData:CN(e,o.map(Zz),n),graphicalItems:o}]}))},zK=$([LK,yK,Sz,Cz],RK),BK=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!==`zAxis`){var o=kN(e,i,a);if(o==null||o[0]!==0||o[1]!==0)return o}},VK=$([uK],e=>e.allowDataOverflow),HK=e=>{if(e==null||!(`domain`in e))return tK;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=AK(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??tK},UK=$([uK],HK),WK=$([UK,VK],oz),GK=$([zK,ez,Yz,WK],BK,{memoizeOptions:{resultEqualityCheck:eB}}),KK=e=>e.errorBars,qK=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>NK(n,e)),JK=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},YK=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s=r[n.id]?.filter(e=>NK(i,e)),c=gN(e,t.dataKey??n.dataKey),l=PK(e,c,s);if(l.length>=2){var u=Math.min(...l),d=Math.max(...l);(a==null||u<a)&&(a=u),(o==null||d>o)&&(o=d)}var f=kK(c);f!=null&&(a=a==null?f[0]:Math.min(a,f[0]),o=o==null?f[1]:Math.max(o,f[1]))})}),t?.dataKey!=null&&e.forEach(e=>{var n=kK(gN(e,t.dataKey));n!=null&&(a=a==null?n[0]:Math.min(a,n[0]),o=o==null?n[1]:Math.max(o,n[1]))}),lN(a)&&lN(o))return[a,o]},XK=$([TK,uK,xK,KK,Yz],YK,{memoizeOptions:{resultEqualityCheck:eB}});function ZK(e){var{value:t}=e;if(ID(t)||t instanceof Date)return t}var QK=(e,t,n)=>{var r=e.map(ZK).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&BD(r))?$R(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},$K=e=>e.referenceElements.dots,eq=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),tq=$([$K,Yz,Xz],eq),nq=e=>e.referenceElements.areas,rq=$([nq,Yz,Xz],eq),iq=e=>e.referenceElements.lines,aq=$([iq,Yz,Xz],eq),oq=(e,t)=>{if(e!=null){var n=AK(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},sq=$(tq,Yz,oq),cq=(e,t)=>{if(e!=null){var n=AK(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},lq=$([rq,Yz],cq);function uq(e){if(e.x!=null)return AK([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:AK(t)}function dq(e){if(e.y!=null)return AK([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:AK(t)}var fq=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?uq(e):dq(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},pq=$(sq,$([aq,Yz],fq),lq,(e,t,n)=>JK(e,n,t)),mq=(e,t,n,r,i,a,o,s)=>n??sz(t,o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?JK(r,a,i):JK(a,i),e.allowDataOverflow),hq=$([uK,UK,WK,GK,XK,pq,LP,Yz],mq,{memoizeOptions:{resultEqualityCheck:eB}}),gq=[0,1],_q=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var{dataKey:s,type:c}=e,l=vN(t,a);return l&&s==null?$R(0,n?.length??0):c===`category`?QK(r,e,l):i===`expand`?gq:o}},vq=$([uK,LP,TK,DK,Sz,Yz,hq],_q),yq=$([uK,pK,wz],KG),bq=(e,t,n)=>{var{niceTicks:r}=t;if(r!==`none`){var i=HK(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&iz(e)){if(a)return gz(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return _z(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&iz(e))return gz(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&iz(e))return _z(e,t.tickCount,t.allowDecimals,`adaptive`)}}},xq=$([vq,fK,yq],bq),Sq=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&iz(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},Cq=$([uK,vq,xq,Yz],Sq),wq=$($(DK,uK,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(AK(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;s<r.length-1;s++){var c=r[s],l=r[s+1];if(c!=null&&l!=null){var u=l-c;n=Math.min(n,u)}}return n/o}}),LP,bz,eP,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!lN(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=zD(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),Tq=(e,t,n)=>{var r=iK(e,t);return r==null||typeof r.padding!=`string`?0:wq(e,`xAxis`,t,n,r.padding)},Eq=(e,t,n)=>{var r=sK(e,t);return r==null||typeof r.padding!=`string`?0:wq(e,`yAxis`,t,n,r.padding)},Dq=$(iK,Tq,(e,t)=>{if(e==null)return{left:0,right:0};var{padding:n}=e;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),Oq=$(sK,Eq,(e,t)=>{if(e==null)return{top:0,bottom:0};var{padding:n}=e;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),kq=$([eP,Dq,oP,aP,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Aq=$([eP,LP,Oq,oP,aP,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),jq=(e,t,n,r)=>{switch(t){case`xAxis`:return kq(e,n,r);case`yAxis`:return Aq(e,n,r);case`zAxis`:return lK(e,n)?.range;case`angleAxis`:return Kz(e);case`radiusAxis`:return qz(e,n);default:return}},Mq=$([uK,jq],jz),Nq=$([uK,yq,$([yq,Cq],oB),Mq],UG),Pq=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var{type:i,scale:a}=n;if(vN(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},Fq=$([LP,DK,fK,Yz],Pq),Iq=$([Nq],aB);$([Nq],YG),$([Nq,MK],JG),$([vK,KK,Yz],qK);function Lq(e,t){return e.id<t.id?-1:+(e.id>t.id)}var Rq=(e,t)=>t,zq=(e,t,n)=>n,Bq=$(VN,Rq,zq,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Lq)),Vq=$(HN,Rq,zq,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Lq)),Hq=(e,t)=>({width:e.width,height:t.height}),Uq=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),Wq=$(eP,iK,Hq),Gq=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},Kq=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},qq=$(RN,eP,Bq,Rq,zq,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=Hq(t,n);o??=Gq(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),Jq=$(LN,eP,Vq,Rq,zq,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=Uq(t,n);o??=Kq(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),Yq=$([eP,iK,(e,t)=>{var n=iK(e,t);if(n!=null)return qq(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),Xq=$([eP,sK,(e,t)=>{var n=sK(e,t);if(n!=null)return Jq(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),Zq=$(eP,sK,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),Qq=(e,t,n)=>{switch(t){case`xAxis`:return Wq(e,n).width;case`yAxis`:return Zq(e,n).height;default:return}},$q=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=vN(e,r),c=t.map(e=>e.value);if(o&&s&&a===`category`&&i&&BD(c))return c}},eJ=$([LP,DK,uK,Yz],$q),tJ=$([LP,dK,yq,Iq,eJ,Fq,jq,xq,Yz],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=vN(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),nJ=$([LP,fK,yq,Iq,xq,jq,eJ,Fq,Yz],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=vN(e,c),{type:u,ticks:d,tickCount:f}=t,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?ND(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return lN(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(GD):l&&s?s.map((e,t)=>{var n=r.map(e);return lN(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(GD):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return lN(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(GD):r.domain().map((e,t)=>{var n=r.map(e);return lN(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(GD)}}),rJ=$([LP,fK,Iq,jq,eJ,Fq,Yz],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=vN(e,o),{tickCount:c}=t,l=0;return l=o===`angleAxis`&&r?.length>=2?ND(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return lN(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(GD):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return lN(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(GD):n.domain().map((e,t)=>{var r=n.map(e);return lN(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(GD)}}),iJ=$(uK,Iq,(e,t)=>{if(e!=null&&t!=null)return ZG(ZG({},e),{},{scale:t})});$((e,t,n)=>lK(e,n),$([$([uK,yq,vq,Mq],UG)],aB),(e,t)=>{if(e!=null&&t!=null)return ZG(ZG({},e),{},{scale:t})});var aJ=$([LP,VN,HN],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});$([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);a<n&&(n=a,r=i)}return r?.value}});var oJ=e=>e.options.defaultTooltipEventType,sJ=e=>e.options.validateTooltipEventTypes;function cJ(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function lJ(e,t){return cJ(t,oJ(e),sJ(e))}function uJ(e){return Q(t=>lJ(t,e))}var dJ=(e,t)=>{var n,r=Number(t);if(!(PD(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},fJ=e=>e.tooltip.settings,pJ={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},mJ=mM({name:`tooltip`,initialState:{itemInteraction:{click:pJ,hover:pJ},axisInteraction:{click:pJ,hover:pJ},keyboardInteraction:pJ,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(RF(t.payload))},prepare:$j()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=zj(e).tooltipItemPayloads.indexOf(RF(n));i>-1&&(e.tooltipItemPayloads[i]=RF(r))},prepare:$j()},removeTooltipEntrySettings:{reducer(e,t){var n=zj(e).tooltipItemPayloads.indexOf(RF(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:$j()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:hJ,replaceTooltipEntrySettings:gJ,removeTooltipEntrySettings:_J,setTooltipSettingsState:vJ,setActiveMouseOverItemIndex:yJ,mouseLeaveItem:bJ,mouseLeaveChart:xJ,setActiveClickItemIndex:SJ,setMouseOverAxisIndex:CJ,setMouseClickAxisIndex:wJ,setSyncInteraction:TJ,setKeyboardInteraction:EJ}=mJ.actions,DJ=mJ.reducer;function OJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?OJ(Object(n),!0).forEach(function(t){AJ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function AJ(e,t,n){return(t=jJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jJ(e){var t=MJ(e,`string`);return typeof t==`symbol`?t:t+``}function MJ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function NJ(e,t,n){return t===`axis`?n===`click`?e.axisInteraction.click:e.axisInteraction.hover:n===`click`?e.itemInteraction.click:e.itemInteraction.hover}function PJ(e){return e.index!=null}var FJ=(e,t,n,r)=>{if(t==null)return pJ;var i=NJ(e,t,n);if(i==null)return pJ;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(PJ(i)){if(a)return kJ(kJ({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return kJ(kJ({},pJ),{},{coordinate:i.coordinate})};function IJ(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function LJ(e,t){var n=IJ(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function RJ(e,t,n){if(n==null||t==null)return!0;var r=gN(e,t);return r==null||!iz(n)||LJ(r,n)}var zJ=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!lN(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||RJ(l,n,r)?String(c):null},BJ=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},VJ=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},HJ=e=>e.options.tooltipPayloadSearcher,UJ=e=>e.tooltip;function WJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?WJ(Object(n),!0).forEach(function(t){KJ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function KJ(e,t,n){return(t=qJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qJ(e){var t=JJ(e,`string`);return typeof t==`symbol`?t:t+``}function JJ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function YJ(e){if(typeof e==`string`||typeof e==`number`)return e}function XJ(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e}function ZJ(e){if(typeof e==`string`||typeof e==`number`)return e;if(typeof e==`function`)return t=>e(t)}function QJ(e){if(typeof e==`string`)return e}function $J(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?YJ(e.name):void 0,unit:`unit`in e?XJ(e.unit):void 0,dataKey:`dataKey`in e?ZJ(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?QJ(e.color):void 0,fill:`fill`in e?QJ(e.fill):void 0}}function eY(e,t){return e??t}var tY=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var{chartData:s,computedData:c,dataStartIndex:l,dataEndIndex:u}=n;return e.reduce((e,n)=>{var{dataDefinedOnItem:d,settings:f}=n,p=eY(d,s),m=Array.isArray(p)?cN(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_=r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?HD(m,r,i):a(m,t,c,g);return Array.isArray(_)?_.forEach(t=>{var n=$J(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=GJ(GJ({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(NN({tooltipEntrySettings:o,dataKey:i,payload:a,value:gN(a,i),name:r==null?void 0:String(r)}))}):e.push(NN({tooltipEntrySettings:f,dataKey:h,payload:_,value:gN(_,h),name:gN(_,g)??f?.name})),e},[])}},nY=$([FK,pK,wz],KG),rY=$([$([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),FK,$([rB,iB],mK)],_K,{memoizeOptions:{resultEqualityCheck:tB}}),iY=$([rY],e=>e.filter($z)),aY=$([$([rY],SK,{memoizeOptions:{resultEqualityCheck:tB}}),ez],wK),oY=$([iY,ez,FK],Qz),sY=$([aY,FK,rY],EK),cY=$([FK],HK),lY=$([cY,$([FK],e=>e.allowDataOverflow)],oz),uY=$([$([oY,$([rY],e=>e.filter($z)),Sz,Cz],RK),ez,rB,lY],BK),dY=$([aY,FK,$([rY],bK),KK,rB],YK,{memoizeOptions:{resultEqualityCheck:eB}}),fY=$([$([$K,rB,iB],eq),rB],oq),pY=$([$([nq,rB,iB],eq),rB],cq),mY=$([FK,LP,aY,sY,Sz,rB,$([FK,cY,lY,uY,dY,$([fY,$([$([iq,rB,iB],eq),rB],fq),pY],JK),LP,rB],mq)],_q),hY=$([FK,mY,$([mY,FK,nY],bq),rB],Sq),gY=e=>jq(e,rB(e),iB(e),!1),_Y=$([FK,gY],jz),vY=$([$([FK,nY,hY,_Y],UG)],aB),yY=$([LP,FK,nY,vY,gY,$([LP,sY,FK,rB],$q),$([LP,sY,FK,rB],Pq),rB],(e,t,n,r,i,a,o,s)=>{if(t){var{type:c}=t,l=vN(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?ND(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return lN(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(GD):r.domain().map((e,t)=>{var n=r.map(e);return lN(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(GD)}}}),bY=$([oJ,sJ,fJ],(e,t,n)=>cJ(n.shared,e,t)),xY=e=>e.tooltip.settings.trigger,SY=e=>e.tooltip.settings.defaultIndex,CY=$([UJ,bY,xY,SY],FJ),wY=$([CY,aY,IK,mY],zJ),TY=$([yY,wY],dJ),EY=$([CY],e=>{if(e)return e.dataKey}),DY=$([CY],e=>{if(e)return e.graphicalItemId}),OY=$([UJ,bY,xY,SY],VJ),kY=$([CY,$([LN,RN,LP,eP,yY,SY,OY],BJ)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),AY=$([CY],e=>e?.active??!1);$([$([OY,wY,ez,IK,TY,HJ,bY],tY)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function jY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jY(Object(n),!0).forEach(function(t){NY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function NY(e,t,n){return(t=PY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PY(e){var t=FY(e,`string`);return typeof t==`symbol`?t:t+``}function FY(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var IY=()=>Q(FK),LY=()=>{var e=IY(),t=Q(yY),n=Q(vY);return MN(!e||!n?void 0:MY(MY({},e),{},{scale:n}),t)};function RY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?RY(Object(n),!0).forEach(function(t){BY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BY(e,t,n){return(t=VY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VY(e){var t=HY(e,`string`);return typeof t==`symbol`?t:t+``}function HY(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var UY=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},WY=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,{radius:o}=r;return zY(zY(zY({},r),DR(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:c}=r;return zY(zY(zY({},r),DR(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function GY(e,t){var{relativeX:n,relativeY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var KY=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o<a;o++){var s=o>0?n[o-1]?.coordinate:n[a-1]?.coordinate,c=n[o]?.coordinate,l=o>=a-1?n[0]?.coordinate:n[o+1]?.coordinate,u=void 0;if(s!=null&&c!=null&&l!=null){if(ND(c-s)!==ND(l-c)){var d=[];if(ND(l-c)===ND(i[1]-i[0])){u=l;var f=c+i[1]-i[0];d[0]=Math.min(f,(f+s)/2),d[1]=Math.max(f,(f+s)/2)}else{u=s;var p=l+i[1]-i[0];d[0]=Math.min(c,(p+c)/2),d[1]=Math.max(c,(p+c)/2)}var m=[Math.min(c,(u+c)/2),Math.max(c,(u+c)/2)];if(e>m[0]&&e<=m[1]||e>=d[0]&&e<=d[1])return n[o]?.index}else{var h=Math.min(s,l),g=Math.max(s,l);if(e>(h+c)/2&&e<=(g+c)/2)return n[o]?.index}}}else if(t)for(var _=0;_<a;_++){var v=t[_];if(v!=null){var y=t[_+1],b=t[_-1];if(_===0&&y!=null&&e<=(v.coordinate+y.coordinate)/2||_===a-1&&b!=null&&e>(v.coordinate+b.coordinate)/2||_>0&&_<a-1&&b!=null&&y!=null&&e>(v.coordinate+b.coordinate)/2&&e<=(v.coordinate+y.coordinate)/2)return v.index}}return-1},qY=()=>Q(wz),JY=(e,t)=>t,YY=(e,t,n)=>n,XY=(e,t,n,r)=>r,ZY=$(yY,e=>iA(e,e=>e.coordinate)),QY=$([UJ,JY,YY,XY],FJ),$Y=$([QY,aY,IK,mY],zJ),eX=(e,t,n)=>{if(t!=null){var r=UJ(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},tX=$([UJ,JY,YY,XY],VJ),nX=$([LN,RN,LP,eP,yY,XY,tX],BJ),rX=$([QY,nX],(e,t)=>e.coordinate??t),iX=$([yY,$Y],dJ),aX=$([tX,$Y,ez,IK,iX,HJ,JY],tY),oX=$([QY,$Y],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),sX=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&GY(e,o)){var s=KY(FN(e,t),a,i,n,r),c=UY(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},cX=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=NR(e,n);if(s){var c=KY(IN(s,t),o,a,r,i),l=WY(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},lX=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?sX(e,t,r,i,a,o,s):cX(e,t,n,r,i,a,o)},uX=$(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),dX=$(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(Oz));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:nB}});function fX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fX(Object(n),!0).forEach(function(t){mX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mX(e,t,n){return(t=hX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hX(e){var t=gX(e,`string`);return typeof t==`symbol`?t:t+``}function gX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var _X={zIndexMap:Object.values(Oz).reduce((e,t)=>pX(pX({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},vX=new Set(Object.values(Oz));function yX(e){return vX.has(e)}var bX=mM({name:`zIndex`,initialState:_X,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:$j()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!yX(n)&&delete e.zIndexMap[n])},prepare:$j()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=RF(r):e.zIndexMap[n].element=RF(r):e.zIndexMap[n]={consumers:0,element:i?void 0:RF(r),panoramaElement:i?RF(r):void 0}},prepare:$j()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:$j()}}}),{registerZIndexPortal:xX,unregisterZIndexPortal:SX,registerZIndexPortalElement:CX,unregisterZIndexPortalElement:wX}=bX.actions,TX=bX.reducer;function EX(e){var{zIndex:t,children:n}=e,r=VP()&&t!==void 0&&t!==0,i=iP(),a=jk();(0,v.useLayoutEffect)(()=>r?(a(xX({zIndex:t})),()=>{a(SX({zIndex:t}))}):KD,[a,t,r]);var o=Q(e=>uX(e,t,i));return r?o?(0,Dr.createPortal)(n,o):null:n}function DX(){return DX=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},DX.apply(null,arguments)}function OX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?OX(Object(n),!0).forEach(function(t){AX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function AX(e,t,n){return(t=jX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jX(e){var t=MX(e,`string`);return typeof t==`symbol`?t:t+``}function MX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function NX(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,v.isValidElement)(t)?(0,v.cloneElement)(t,r):(0,v.createElement)(n,r)}function PX(e){var{coordinate:t,payload:n,index:r,offset:i,tooltipAxisBandSize:a,layout:o,cursor:s,tooltipEventType:c,chartName:l}=e,u=t,d=n,f=r;if(!s||!u||l!==`ScatterChart`&&c!==`axis`)return null;var p,m,h;if(l===`ScatterChart`)p=u,m=cL,h=Oz.cursorLine;else if(l===`BarChart`)p=lL(o,u,i,a),m=yR,h=Oz.cursorRectangle;else if(o===`radial`&&cO(u)){var{cx:g,cy:_,radius:y,startAngle:b,endAngle:x}=PR(u);p={cx:g,cy:_,startAngle:b,endAngle:x,innerRadius:y,outerRadius:y},m=YR,h=Oz.cursorLine}else p={points:XR(o,u,i)},m=ZI,h=Oz.cursorLine;var S=typeof s==`object`&&`className`in s?s.className:void 0,C=kX(kX(kX(kX({stroke:`#ccc`,pointerEvents:`none`},i),p),IT(s)),{},{payload:d,payloadIndex:f,className:Yt(`recharts-tooltip-cursor`,S)});return v.createElement(EX,{zIndex:e.zIndex??h},v.createElement(NX,{cursor:s,cursorComp:m,cursorProps:C}))}function FX(e){var t=LY(),n=PP(),r=RP(),i=qY();return t==null||n==null||r==null||i==null?null:v.createElement(PX,DX({},e,{offset:n,layout:r,tooltipAxisBandSize:t,chartName:i}))}var IX=(0,v.createContext)(null),LX=()=>(0,v.useContext)(IX),RX=l(o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1).default,zX=new RX,BX=`recharts.syncEvent.tooltip`,VX=`recharts.syncEvent.brush`,HX=(e,t)=>{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!PD(n))return e[n]}},UX=mM({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),WX=UX.reducer,{createEventEmitter:GX}=UX.actions;function KX(e){return e.tooltip.syncInteraction}var qX=mM({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=RF(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:JX,setDataStartEndIndexes:YX,setComputedData:XX}=qX.actions,ZX=qX.reducer,QX=[`x`,`y`];function $X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?$X(Object(n),!0).forEach(function(t){tZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function tZ(e,t,n){return(t=nZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nZ(e){var t=rZ(e,`string`);return typeof t==`symbol`?t:t+``}function rZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function iZ(e,t){if(e==null)return{};var n,r,i=aZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function aZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function oZ(){var e=Q(Tz),t=Q(Dz),n=jk(),r=Q(Ez),i=Q(yY),a=RP(),o=MP(),s=Q(e=>e.rootProps.className);(0,v.useEffect)(()=>{if(e==null)return KD;var s=(s,c,l)=>{if(t!==l&&e===s){if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,{x:f,y:p}=d,m=iZ(d,QX),{x:h,y:g,width:_,height:v}=c.payload.sourceViewBox,y=eZ(eZ({},m),{},{x:o.x+(_?(f-h)/_:0)*o.width,y:o.y+(v?(p-g)/v:0)*o.height});n(eZ(eZ({},c),{},{payload:eZ(eZ({},c.payload),{},{coordinate:y})}))}else n(c);return}if(i!=null){var b;typeof r==`function`?b=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(b=i.find(e=>String(e.value)===c.payload.label));var{coordinate:x}=c.payload;if(b==null||c.payload.active===!1||x==null||o==null){n(TJ({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:S,y:C}=x,w=Math.min(S,o.x+o.width),T=Math.min(C,o.y+o.height),E={x:a===`horizontal`?b.coordinate:w,y:a===`horizontal`?T:b.coordinate};n(TJ({active:c.payload.active,coordinate:E,dataKey:c.payload.dataKey,index:String(b.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return zX.on(BX,s),()=>{zX.off(BX,s)}},[s,n,t,e,r,i,a,o])}function sZ(){var e=Q(Tz),t=Q(Dz),n=jk();(0,v.useEffect)(()=>{if(e==null)return KD;var r=(r,i,a)=>{t!==a&&e===r&&n(YX(i))};return zX.on(VX,r),()=>{zX.off(VX,r)}},[n,t,e])}function cZ(){var e=jk();(0,v.useEffect)(()=>{e(GX())},[e]),oZ(),sZ()}function lZ(e,t,n,r,i,a){var o=Q(n=>eX(n,e,t)),s=Q(DY),c=Q(Dz),l=Q(Tz),u=Q(Ez),d=Q(KX)?.active,f=MP();(0,v.useEffect)(()=>{if(!d&&l!=null&&c!=null){var e=TJ({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:f,graphicalItemId:s});zX.emit(BX,l,e,c)}},[d,n,o,s,i,r,c,l,u,a,f])}function uZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?uZ(Object(n),!0).forEach(function(t){fZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fZ(e,t,n){return(t=pZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pZ(e){var t=mZ(e,`string`);return typeof t==`symbol`?t:t+``}function mZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function hZ(e){return e.dataKey}function gZ(e,t){return v.isValidElement(e)?v.cloneElement(e,t):typeof e==`function`?v.createElement(e,t):v.createElement(yI,t)}var _Z=[],vZ={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:`auto`,itemSorter:`name`,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,wrapperStyle:{}};function yZ(e){var t=_O(e,vZ),{active:n,allowEscapeViewBox:r,animationDuration:i,animationEasing:a,content:o,filterNull:s,isAnimationActive:c,offset:l,payloadUniqBy:u,position:d,reverseDirection:f,useTranslate3d:p,wrapperStyle:m,cursor:h,shared:g,trigger:_,defaultIndex:y,portal:b,axisId:x}=t,S=jk(),C=typeof y==`number`?String(y):y;(0,v.useEffect)(()=>{S(vJ({shared:g,trigger:_,axisId:x,active:n,defaultIndex:C}))},[S,g,_,x,n,C]);var w=MP(),T=II(),E=uJ(g),{activeIndex:D,isActive:O}=Q(e=>oX(e,E,_,C))??{},k=Q(e=>aX(e,E,_,C)),A=Q(e=>iX(e,E,_,C)),j=Q(e=>rX(e,E,_,C)),M=k,N=LX(),P=n??O??!1,[ee,F]=cA([M,P]),I=E===`axis`?A:void 0;lZ(E,_,j,I,D,P);var te=b??N;if(te==null||w==null||E==null)return null;var L=M??_Z;P||(L=_Z),s&&L.length&&(L=Ck(L.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),u,hZ));var ne=L.length>0,re=dZ(dZ({},t),{},{payload:L,label:I,active:P,activeIndex:D,coordinate:j,accessibilityLayer:T}),R=v.createElement(FI,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:c,active:P,coordinate:j,hasPayload:ne,offset:l,position:d,reverseDirection:f,useTranslate3d:p,viewBox:w,wrapperStyle:m,lastBoundingBox:ee,innerRef:F,hasPortalFromProps:!!b},gZ(o,re));return v.createElement(v.Fragment,null,(0,Dr.createPortal)(R,te),P&&v.createElement(FX,{cursor:h,tooltipEventType:E,coordinate:j,payload:L,index:D}))}var bZ=e=>null;bZ.displayName=`Cell`;function xZ(e,t,n){return(t=SZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SZ(e){var t=CZ(e,`string`);return typeof t==`symbol`?t:t+``}function CZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var wZ=class{constructor(e){xZ(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function TZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function EZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?TZ(Object(n),!0).forEach(function(t){DZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function DZ(e,t,n){return(t=OZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function OZ(e){var t=kZ(e,`string`);return typeof t==`symbol`?t:t+``}function kZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var AZ=EZ({},{cacheSize:2e3,enableCache:!0}),jZ=new wZ(AZ.cacheSize),MZ={position:`absolute`,top:`-20000px`,left:0,padding:0,margin:0,border:`none`,whiteSpace:`pre`},NZ=`recharts_measurement_span`;function PZ(e,t){return`${e}|${t.fontSize||``}|${t.fontFamily||``}|${t.fontWeight||``}|${t.fontStyle||``}|${t.letterSpacing||``}|${t.textTransform||``}`}var FZ=(e,t)=>{try{var n=document.getElementById(NZ);n||(n=document.createElement(`span`),n.setAttribute(`id`,NZ),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,MZ,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},IZ=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||EI.isSsr)return{width:0,height:0};if(!AZ.enableCache)return FZ(e,t);var n=PZ(e,t),r=jZ.get(n);if(r)return r;var i=FZ(e,t);return jZ.set(n,i),i},LZ;function RZ(e,t,n){return(t=zZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zZ(e){var t=BZ(e,`string`);return typeof t==`symbol`?t:t+``}function BZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var VZ=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,HZ=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,UZ=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,WZ=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,GZ={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},KZ=[`cm`,`mm`,`pt`,`pc`,`in`,`Q`,`px`];function qZ(e){return KZ.includes(e)}var JZ=`NaN`;function YZ(e,t){return e*GZ[t]}var XZ=class e{static parse(t){var[,n,r]=WZ.exec(t)??[];return n==null?e.NaN:new e(parseFloat(n),r??``)}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,PD(e)&&(this.unit=``),t!==``&&!UZ.test(t)&&(this.num=NaN,this.unit=``),qZ(t)&&(this.num=YZ(e,t),this.unit=`px`)}add(t){return this.unit===t.unit?new e(this.num+t.num,this.unit):new e(NaN,``)}subtract(t){return this.unit===t.unit?new e(this.num-t.num,this.unit):new e(NaN,``)}multiply(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num/t.num,this.unit||t.unit)}toString(){return`${this.num}${this.unit}`}isNaN(){return PD(this.num)}};LZ=XZ,RZ(XZ,`NaN`,new LZ(NaN,``));function ZZ(e){if(e==null||e.includes(JZ))return JZ;for(var t=e;t.includes(`*`)||t.includes(`/`);){var[,n,r,i]=VZ.exec(t)??[],a=XZ.parse(n??``),o=XZ.parse(i??``),s=r===`*`?a.multiply(o):a.divide(o);if(s.isNaN())return JZ;t=t.replace(VZ,s.toString())}for(;t.includes(`+`)||/.-\d+(?:\.\d+)?/.test(t);){var[,c,l,u]=HZ.exec(t)??[],d=XZ.parse(c??``),f=XZ.parse(u??``),p=l===`+`?d.add(f):d.subtract(f);if(p.isNaN())return JZ;t=t.replace(HZ,p.toString())}return t}var QZ=/\(([^()]*)\)/;function $Z(e){for(var t=e,n;(n=QZ.exec(t))!=null;){var[,r]=n;t=t.replace(QZ,ZZ(r))}return t}function eQ(e){var t=e.replace(/\s+/g,``);return t=$Z(t),t=ZZ(t),t}function tQ(e){try{return eQ(e)}catch{return JZ}}function nQ(e){var t=tQ(e.slice(5,-1));return t===JZ?``:t}var rQ=[`x`,`y`,`lineHeight`,`capHeight`,`fill`,`scaleToFit`,`textAnchor`,`verticalAnchor`],iQ=[`dx`,`dy`,`angle`,`className`,`breakAll`];function aQ(){return aQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},aQ.apply(null,arguments)}function oQ(e,t){if(e==null)return{};var n,r,i=sQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function sQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var cQ=/[ \f\n\r\t\v\u2028\u2029]+/,lQ=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];return UD(t)||(i=n?t.toString().split(``):t.toString().split(cQ)),{wordsWithComputedWidth:i.map(e=>({word:e,width:IZ(e,r).width})),spaceWidth:n?0:IZ(`\xA0`,r).width}}catch{return null}};function uQ(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function dQ(e){return UD(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var fQ=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+n<Number(t)))s.words.push(a),s.width+=o+n;else{var c={words:[a],width:o};e.push(c)}return e},[]),pQ=e=>e.reduce((e,t)=>e.width>t.width?e:t),mQ=`…`,hQ=(e,t,n,r,i,a,o,s)=>{var c=lQ({breakAll:n,style:r,children:e.slice(0,t)+mQ});if(!c)return[!1,[]];var l=fQ(c.wordsWithComputedWidth,a,o,s);return[l.length>i||pQ(l).width>Number(a),l]},gQ=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:s,breakAll:c}=e,l=Z(a),u=String(o),d=fQ(t,r,n,i);if(!l||i||!(d.length>a||pQ(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),[_,v]=hQ(u,g-1,c,s,a,r,n,i),[y]=hQ(u,g,c,s,a,r,n,i);if(!_&&!y&&(f=g+1),_&&y&&(p=g-1),!_&&y){h=v;break}m++}return h||d},_Q=e=>[{words:UD(e)?[]:e.toString().split(cQ),width:void 0}],vQ=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!EI.isSsr){var s,c,l=lQ({breakAll:a,children:r,style:i});if(l){var{wordsWithComputedWidth:u,spaceWidth:d}=l;s=u,c=d}else return _Q(r);return gQ({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return _Q(r)},yQ=`#808080`,bQ={angle:0,breakAll:!1,capHeight:`0.71em`,fill:yQ,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},xQ=(0,v.forwardRef)((e,t)=>{var n=_O(e,bQ),{x:r,y:i,lineHeight:a,capHeight:o,fill:s,scaleToFit:c,textAnchor:l,verticalAnchor:u}=n,d=oQ(n,rQ),f=(0,v.useMemo)(()=>vQ({breakAll:d.breakAll,children:d.children,maxLines:d.maxLines,scaleToFit:c,style:d.style,width:d.width}),[d.breakAll,d.children,d.maxLines,c,d.style,d.width]),{dx:p,dy:m,angle:h,className:g,breakAll:_}=d,y=oQ(d,iQ);if(!ID(r)||!ID(i)||f.length===0)return null;var b=Number(r)+(Z(p)?p:0),x=Number(i)+(Z(m)?m:0);if(!lN(b)||!lN(x))return null;var S;switch(u){case`start`:S=nQ(`calc(${o})`);break;case`middle`:S=nQ(`calc(${(f.length-1)/2} * -${a} + (${o} / 2))`);break;default:S=nQ(`calc(${f.length-1} * -${a})`)}var C=[],w=f[0];if(c&&w!=null){var T=w.width,{width:E}=d;C.push(`scale(${Z(E)&&Z(T)?E/T:1})`)}return h&&C.push(`rotate(${h}, ${b}, ${x})`),C.length&&(y.transform=C.join(` `)),v.createElement(`text`,aQ({},LT(y),{ref:t,x:b,y:x,className:Yt(`recharts-text`,g),textAnchor:l,fill:s.includes(`url`)?yQ:s}),f.map((e,t)=>{var n=e.words.join(_?``:` `);return v.createElement(`tspan`,{x:b,dy:t===0?S:a,key:`${n}-${t}`},n)}))});xQ.displayName=`Text`;function SQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function CQ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?SQ(Object(n),!0).forEach(function(t){wQ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wQ(e,t,n){return(t=TQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function TQ(e){var t=EQ(e,`string`);return typeof t==`symbol`?t:t+``}function EQ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var DQ=e=>{var{viewBox:t,position:n,offset:r=0,parentViewBox:i,clamp:a}=e,{x:o,y:s,height:c,upperWidth:l,lowerWidth:u}=jP(t),d=o,f=o+(l-u)/2,p=(d+f)/2,m=(l+u)/2,h=d+l/2,g=c>=0?1:-1,_=g*r,v=g>0?`end`:`start`,y=g>0?`start`:`end`,b=l>=0?1:-1,x=b*r,S=b>0?`end`:`start`,C=b>0?`start`:`end`,w=i;if(n===`top`){var T={x:d+l/2,y:s-_,horizontalAnchor:`middle`,verticalAnchor:v};return a&&w&&(T.height=Math.max(s-w.y,0),T.width=l),T}if(n===`bottom`){var E={x:f+u/2,y:s+c+_,horizontalAnchor:`middle`,verticalAnchor:y};return a&&w&&(E.height=Math.max(w.y+w.height-(s+c),0),E.width=u),E}if(n===`left`){var D={x:p-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`};return a&&w&&(D.width=Math.max(D.x-w.x,0),D.height=c),D}if(n===`right`){var O={x:p+m+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`};return a&&w&&(O.width=Math.max(w.x+w.width-O.x,0),O.height=c),O}var k=a&&w?{width:m,height:c}:{};return n===`insideLeft`?CQ({x:p+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`},k):n===`insideRight`?CQ({x:p+m-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`},k):n===`insideTop`?CQ({x:d+l/2,y:s+_,horizontalAnchor:`middle`,verticalAnchor:y},k):n===`insideBottom`?CQ({x:f+u/2,y:s+c-_,horizontalAnchor:`middle`,verticalAnchor:v},k):n===`insideTopLeft`?CQ({x:d+x,y:s+_,horizontalAnchor:C,verticalAnchor:y},k):n===`insideTopRight`?CQ({x:d+l-x,y:s+_,horizontalAnchor:S,verticalAnchor:y},k):n===`insideBottomLeft`?CQ({x:f+x,y:s+c-_,horizontalAnchor:C,verticalAnchor:v},k):n===`insideBottomRight`?CQ({x:f+u-x,y:s+c-_,horizontalAnchor:S,verticalAnchor:v},k):n&&typeof n==`object`&&(Z(n.x)||FD(n.x))&&(Z(n.y)||FD(n.y))?CQ({x:o+zD(n.x,m),y:s+zD(n.y,c),horizontalAnchor:`end`,verticalAnchor:`end`},k):CQ({x:h,y:s+c/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},k)},OQ=[`labelRef`],kQ=[`content`];function AQ(e,t){if(e==null)return{};var n,r,i=jQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function jQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function MQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function NQ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?MQ(Object(n),!0).forEach(function(t){PQ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function PQ(e,t,n){return(t=FQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FQ(e){var t=IQ(e,`string`);return typeof t==`symbol`?t:t+``}function IQ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function LQ(){return LQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LQ.apply(null,arguments)}var RQ=(0,v.createContext)(null),zQ=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,c=(0,v.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return v.createElement(RQ.Provider,{value:c},s)},BQ=()=>{var e=(0,v.useContext)(RQ),t=MP();return e||(t?jP(t):void 0)},VQ=(0,v.createContext)(null),HQ=()=>{var e=(0,v.useContext)(VQ),t=Q(Jz);return e||t},UQ=e=>{var{value:t,formatter:n}=e,r=UD(e.children)?t:e.children;return typeof n==`function`?n(r):r},WQ=e=>e!=null&&typeof e==`function`,GQ=(e,t)=>ND(t-e)*Math.min(Math.abs(t-e),360),KQ=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:s,cy:c,innerRadius:l,outerRadius:u,startAngle:d,endAngle:f,clockWise:p}=i,m=(l+u)/2,h=GQ(d,f),g=h>=0?1:-1,_,y;switch(t){case`insideStart`:_=d+g*a,y=p;break;case`insideEnd`:_=f-g*a,y=!p;break;case`end`:_=f+g*a,y=p;break;default:throw Error(`Unsupported position ${t}`)}y=h<=0?y:!y;var b=DR(s,c,m,_),x=DR(s,c,m,_+(y?1:-1)*359),S=`M${b.x},${b.y}
161
+ A`,`,`,`,0,0,`,`,`,`,`,`Z`]),C.x,C.y,a,a,+(u<0),S.x,S.y,r,r,+(T>180),+(u>0),y.x,y.y,a,a,+(u<0),b.x,b.y)}else v+=UD(QR||=ez([`L`,`,`,`Z`]),t,n);return v},az={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},oz=e=>{var t=OO(e,az),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u,className:d}=t;if(a<i||l===u)return null;var f=Yt(`recharts-sector`,d),p=a-i,m=XD(o,p,0,!0),h=m>0&&Math.abs(l-u)<360?iz({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):rz({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return v.createElement(`path`,$R({},JT(t),{className:f,d:h}))};function sz(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(yO(t)){if(e===`centric`){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,c=RR(r,i,a,s),l=RR(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return GR(t)}}function cz(e){return FD(e)?NaN:Number(e)}function lz(e){return e?(e=cz(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function uz(e,t,n){n&&typeof n!=`number`&&sA(e,t,n)&&(t=n=void 0),e=lz(e),t===void 0?(t=e,e=0):t=lz(t),n=n===void 0?e<t?1:-1:lz(n);let r=Math.max(Math.ceil((t-e)/(n||1)),0),i=Array(r);for(let t=0;t<r;t++)i[t]=e,e+=n;return i}var dz=e=>e.chartData,fz=$([dz],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),pz=(e,t,n,r)=>r?fz(e):dz(e),mz=(e,t,n)=>n?fz(e):dz(e);function hz(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(bN(t)&&bN(n))return!0}return!1}function gz(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function _z(e,t){if(t&&typeof e!=`function`&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(bN(n))i=n;else if(typeof n==`function`)return;if(bN(r))a=r;else if(typeof r==`function`)return;var o=[i,a];if(hz(o))return o}}function vz(e,t,n){if(!(!n&&t==null)){if(typeof e==`function`&&t!=null)try{var r=e(t,n);if(hz(r))return gz(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,s;if(i===`auto`)t!=null&&(o=Math.min(...t));else if(Z(i))o=i;else if(typeof i==`function`)try{t!=null&&(o=i(t?.[0]))}catch{}else if(typeof i==`string`&&VN.test(i)){var c=VN.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var l=+c[1];o=t[0]-l}}else o=t?.[0];if(a===`auto`)t!=null&&(s=Math.max(...t));else if(Z(a))s=a;else if(typeof a==`function`)try{t!=null&&(s=a(t?.[1]))}catch{}else if(typeof a==`string`&&HN.test(a)){var u=HN.exec(a);if(u==null||u[1]==null||t==null)s=void 0;else{var d=+u[1];s=t[1]+d}}else s=t?.[1];var f=[o,s];if(hz(f))return t==null?f:gz(f,t,n)}}}var yz=l(o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=r<i?r:i;t<n;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l<u&&(o=m,m=h,h=o,s=l,l=u,u=s),o=[],s=l+u,r=s;r--;)o.push(0);for(r=u;--r>=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||e<t||e>n)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+``,n=p-r.length,n&&(a+=w(n)),a+=r;o=e[t],r=o+``,n=p-r.length,n&&(a+=w(n))}else if(o===0)return`0`;for(;o%10==0;)o/=10;return a+o}var b=(function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%f|0,r=n/f|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]<t[n]),e[n]=r*f+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u<T||d)&&x--;u++)C=d*f+(M[u]||0),_[u]=C/N|0,d=C%N|0;else{for(d=f/(N[0]+1)|0,d>1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y<O;)v[y++]=0;k=N.slice(),k.unshift(0),E=N[0],N[1]>=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O<h?k:N,h))):(d==0&&(c=d=1),m=N.slice()),h=m.length,h<y&&m.unshift(0),n(v,m,y),c==-1&&(y=v.length,c=t(N,v,O,y),c<1&&(d++,n(v,O<y?k:N,y))),y=v.length):c===0&&(d++,v=[0]),_[u++]=d,c&&v[0]?v[y++]=M[w]||0:(v=[M[w]],y=1);while((w++<T||v[0]!==void 0)&&x--)}return _[0]||_.shift(),g.e=l,D(g,s?o+S(g)+1:o)}})();function x(e,t){var n,r,a,o,c,u,f=0,p=0,m=e.constructor,h=m.precision;if(S(e)>16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),r<a){for(r&&e.d.push(+t.slice(0,r)),a-=p;r<a;)e.d.push(+t.slice(r,r+=p));t=t.slice(r),r=p-t.length}else r-=a;for(;r--;)t+=`0`;if(e.d.push(+t),i&&(e.e>h||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a<c,d&&(c=a),a=0;a<c;a++)if(l[a]!=m[a]){d=l[a]<m[a];break}s=0}for(d&&(n=l,l=m,m=n,t.s=-t.s),c=l.length,a=m.length-c;a>0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]<m[a]){for(o=a;o&&l[--o]===0;)l[o]=f-1;--l[o],l[a]+=f}l[a]-=m[a]}for(;l[--c]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(t.d=l,t.e=r,i?D(t,g):t):new h(0)}function k(e,t,n){var r,i=S(e),a=y(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)<o&&(a=a.slice(0,r)+`.`+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function M(e){if(!e||typeof e!=`object`)throw Error(a+`Object expected`);var t,r,i,s=[`precision`,1,n,`rounding`,0,8,`toExpNeg`,-1/0,0,`toExpPos`,0,1/0];for(t=0;t<s.length;t+=3)if((i=e[r=s[t]])!==void 0){if(c(i)===i&&i>=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i)}if((i=e[r=`LN10`])!==void 0){if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i)}return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}))());function bz(e){return e===0?1:Math.floor(new yz.default(e).abs().log(10).toNumber())+1}function xz(e,t,n){for(var r=new yz.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var Sz=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},Cz=(e,t,n)=>{if(e.lte(0))return new yz.default(0);var r=bz(e.toNumber()),i=new yz.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new yz.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new yz.default(s.toNumber()):new yz.default(Math.ceil(s.toNumber()))},wz=(e,t,n)=>{if(e.lte(0))return new yz.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new yz.default(i).abs().log(10).toNumber()),o=new yz.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new yz.default(10).pow(l))}var u=r[c]??1,d=new yz.default(u).mul(o);return t?d:new yz.default(Math.ceil(d.toNumber()))},Tz=(e,t,n)=>{var r=new yz.default(1),i=new yz.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new yz.default(10).pow(bz(e)-1),i=new yz.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new yz.default(Math.floor(e)))}else e===0?i=new yz.default(Math.floor((t-1)/2)):n||(i=new yz.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c<t;c++)s.push(i.add(new yz.default(c-o).mul(r)).toNumber());return s},Ez=function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Cz;if(!Number.isFinite((t-e)/(n-1)))return{step:new yz.default(0),tickMin:new yz.default(0),tickMax:new yz.default(0)};var o=a(new yz.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new yz.default(0):(s=new yz.default(e).add(t).div(2),s=s.sub(new yz.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new yz.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?Ez(e,t,n,r,i+1,a):(u<n&&(l=t>0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new yz.default(c).mul(o)),tickMax:s.add(new yz.default(l).mul(o))})},Dz=function(e){var[t,n]=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,o=Math.max(r,2),[s,c]=Sz([t,n]);if(s===-1/0||c===1/0){var l=c===1/0?[s,...Array(r-1).fill(1/0)]:[...Array(r-1).fill(-1/0),c];return t>n?l.reverse():l}if(s===c)return Tz(s,r,i);var{step:u,tickMin:d,tickMax:f}=Ez(s,c,o,i,0,a===`snap125`?wz:Cz),p=xz(d,f.add(new yz.default(.1).mul(u)),u);return t>n?p.reverse():p},Oz=function(e,t){var[n,r]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,[o,s]=Sz([n,r]);if(o===-1/0||s===1/0)return[n,r];if(o===s)return[o];var c=a===`snap125`?wz:Cz,l=Math.max(t,2),u=c(new yz.default(s).sub(o).div(l-1),i,0),d=[...xz(new yz.default(o),new yz.default(s),u),s];return i===!1&&(d=d.map(e=>Math.round(e))),n>r?d.reverse():d},kz=e=>e.rootProps.maxBarSize,Az=e=>e.rootProps.barGap,jz=e=>e.rootProps.barCategoryGap,Mz=e=>e.rootProps.barSize,Nz=e=>e.rootProps.stackOffset,Pz=e=>e.rootProps.reverseStackOrder,Fz=e=>e.options.chartName,Iz=e=>e.rootProps.syncId,Lz=e=>e.rootProps.syncMethod,Rz=e=>e.options.eventEmitter,zz={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Bz={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:zz.axis},Vz={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:zz.axis},Hz=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function Uz(e,t,n){if(n!==`auto`)return n;if(e!=null)return kN(e,t)?`category`:`number`}function Wz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gz(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Wz(Object(n),!0).forEach(function(t){Kz(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wz(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kz(e,t,n){return(t=qz(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qz(e){var t=Jz(e,`string`);return typeof t==`symbol`?t:t+``}function Jz(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Yz={allowDataOverflow:Bz.allowDataOverflow,allowDecimals:Bz.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Bz.angleAxisId,includeHidden:!1,name:void 0,reversed:Bz.reversed,scale:Bz.scale,tick:Bz.tick,tickCount:void 0,ticks:void 0,type:Bz.type,unit:void 0,niceTicks:`auto`},Xz={allowDataOverflow:Vz.allowDataOverflow,allowDecimals:Vz.allowDecimals,allowDuplicatedCategory:Vz.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Vz.radiusAxisId,includeHidden:Vz.includeHidden,name:void 0,reversed:Vz.reversed,scale:Vz.scale,tick:Vz.tick,tickCount:Vz.tickCount,ticks:void 0,type:Vz.type,unit:void 0,niceTicks:`auto`},Zz=$([(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},ZP],(e,t)=>{if(e!=null)return e;var n=Uz(t,`angleAxis`,Yz.type)??`category`;return Gz(Gz({},Yz),{},{type:n})}),Qz=$([(e,t)=>e.polarAxis.radiusAxis[t],ZP],(e,t)=>{if(e!=null)return e;var n=Uz(t,`radiusAxis`,Xz.type)??`category`;return Gz(Gz({},Xz),{},{type:n})}),$z=e=>e.polarOptions,eB=$([JN,YN,dP],zR),tB=$([$z,eB],(e,t)=>{if(e!=null)return XD(e.innerRadius,t,0)}),nB=$([$z,eB],(e,t)=>{if(e!=null)return XD(e.outerRadius,t,t*.8)}),rB=$([$z],e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});$([Zz,rB],Hz);var iB=$([eB,tB,nB],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});$([Qz,iB],Hz);var aB=$([JP,$z,tB,nB,JN,YN],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var{cx:o,cy:s,startAngle:c,endAngle:l}=t;return{cx:XD(o,i,i/2),cy:XD(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),oB=(e,t)=>t,sB=(e,t,n)=>n;function cB(e){return e?.id}function lB(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t=e.data??r;if(t!=null&&t.length!==0){var n=cB(e);t.forEach((t,r)=>{var s=a==null||i?r:String(DN(t,a,null)),c=DN(t,e.dataKey,0),l=o.has(s)?o.get(s):{};Object.assign(l,{[n]:c}),o.set(s,l)})}}),Array.from(o.values())}function uB(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var dB=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function fB(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function pB(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}var mB=e=>{var t=JP(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},hB=e=>e.tooltip.settings.axisId;function gB(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var _B=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!hz(t)){for(var n,r,i=0;i<t.length;i++){var a=t[i];bN(a)&&((n===void 0||a<n)&&(n=a),(r===void 0||a>r)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function vB(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function yB(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bB(e){let t,n,r;e.length===2?(t=e===vB||e===yB?e:xB,n=e,r=e):(t=vB,n=(t,n)=>vB(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function xB(){return 0}function SB(e){return e===null?NaN:+e}function*CB(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var wB=bB(vB),TB=wB.right;wB.left,bB(SB).center;var EB=class extends Map{constructor(e,t=AB){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(DB(this,e))}has(e){return super.has(DB(this,e))}set(e,t){return super.set(OB(this,e),t)}delete(e){return super.delete(kB(this,e))}};function DB({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function OB({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function kB({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function AB(e){return typeof e==`object`&&e?e.valueOf():e}function jB(e=vB){if(e===vB)return MB;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function MB(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:+(e>t))}var NB=Math.sqrt(50),PB=Math.sqrt(10),FB=Math.sqrt(2);function IB(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=NB?10:a>=PB?5:a>=FB?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?IB(e,t,n*2):[s,c,l]}function LB(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?IB(t,e,n):IB(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o}else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function RB(e,t,n){return t=+t,e=+e,n=+n,IB(e,t,n)[2]}function zB(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?RB(t,e,n):RB(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function BB(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function VB(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function HB(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?MB:jB(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));HB(e,t,u,d,i)}let a=e[t],o=n,s=r;for(UB(e,n,t),i(e[r],a)>0&&UB(e,n,r);o<s;){for(UB(e,o,s),++o,--s;i(e[o],a)<0;)++o;for(;i(e[s],a)>0;)--s}i(e[n],a)===0?UB(e,n,s):(++s,UB(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function UB(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function WB(e,t,n){if(e=Float64Array.from(CB(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return VB(e);if(t>=1)return BB(e);var r,i=(r-1)*t,a=Math.floor(i),o=BB(HB(e,a).subarray(0,a+1));return o+(VB(e.subarray(a+1))-o)*(i-a)}}function GB(e,t,n=SB){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function KB(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function qB(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function JB(e,t){switch(arguments.length){case 0:break;case 1:typeof e==`function`?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t==`function`?this.interpolator(t):this.range(t)}return this}var YB=Symbol(`implicit`);function XB(){var e=new EB,t=[],n=[],r=YB;function i(i){let a=e.get(i);if(a===void 0){if(r!==YB)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new EB;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return XB(t,n).unknown(r)},qB.apply(i,arguments),i}function ZB(){var e=XB().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=KB(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return ZB(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},qB.apply(d(),arguments)}function QB(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return QB(t())},e}function $B(){return QB(ZB.apply(null,arguments).paddingInner(1))}function eV(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function tV(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function nV(){}var rV=.7,iV=1/rV,aV=`\\s*([+-]?\\d+)\\s*`,oV=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,sV=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,cV=/^#([0-9a-f]{3,8})$/,lV=RegExp(`^rgb\\(${aV},${aV},${aV}\\)$`),uV=RegExp(`^rgb\\(${sV},${sV},${sV}\\)$`),dV=RegExp(`^rgba\\(${aV},${aV},${aV},${oV}\\)$`),fV=RegExp(`^rgba\\(${sV},${sV},${sV},${oV}\\)$`),pV=RegExp(`^hsl\\(${oV},${sV},${sV}\\)$`),mV=RegExp(`^hsla\\(${oV},${sV},${sV},${oV}\\)$`),hV={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};eV(nV,bV,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gV,formatHex:gV,formatHex8:_V,formatHsl:vV,formatRgb:yV,toString:yV});function gV(){return this.rgb().formatHex()}function _V(){return this.rgb().formatHex8()}function vV(){return NV(this).formatHsl()}function yV(){return this.rgb().formatRgb()}function bV(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=cV.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xV(t):n===3?new TV(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?SV(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?SV(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=lV.exec(e))?new TV(t[1],t[2],t[3],1):(t=uV.exec(e))?new TV(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dV.exec(e))?SV(t[1],t[2],t[3],t[4]):(t=fV.exec(e))?SV(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pV.exec(e))?MV(t[1],t[2]/100,t[3]/100,1):(t=mV.exec(e))?MV(t[1],t[2]/100,t[3]/100,t[4]):hV.hasOwnProperty(e)?xV(hV[e]):e===`transparent`?new TV(NaN,NaN,NaN,0):null}function xV(e){return new TV(e>>16&255,e>>8&255,e&255,1)}function SV(e,t,n,r){return r<=0&&(e=t=n=NaN),new TV(e,t,n,r)}function CV(e){return e instanceof nV||(e=bV(e)),e?(e=e.rgb(),new TV(e.r,e.g,e.b,e.opacity)):new TV}function wV(e,t,n,r){return arguments.length===1?CV(e):new TV(e,t,n,r??1)}function TV(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}eV(TV,wV,tV(nV,{brighter(e){return e=e==null?iV:iV**+e,new TV(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rV:rV**+e,new TV(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new TV(AV(this.r),AV(this.g),AV(this.b),kV(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:EV,formatHex:EV,formatHex8:DV,formatRgb:OV,toString:OV}));function EV(){return`#${jV(this.r)}${jV(this.g)}${jV(this.b)}`}function DV(){return`#${jV(this.r)}${jV(this.g)}${jV(this.b)}${jV((isNaN(this.opacity)?1:this.opacity)*255)}`}function OV(){let e=kV(this.opacity);return`${e===1?`rgb(`:`rgba(`}${AV(this.r)}, ${AV(this.g)}, ${AV(this.b)}${e===1?`)`:`, ${e})`}`}function kV(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function AV(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jV(e){return e=AV(e),(e<16?`0`:``)+e.toString(16)}function MV(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new FV(e,t,n,r)}function NV(e){if(e instanceof FV)return new FV(e.h,e.s,e.l,e.opacity);if(e instanceof nV||(e=bV(e)),!e)return new FV;if(e instanceof FV)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new FV(o,s,c,e.opacity)}function PV(e,t,n,r){return arguments.length===1?NV(e):new FV(e,t,n,r??1)}function FV(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}eV(FV,PV,tV(nV,{brighter(e){return e=e==null?iV:iV**+e,new FV(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rV:rV**+e,new FV(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new TV(RV(e>=240?e-240:e+120,i,r),RV(e,i,r),RV(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new FV(IV(this.h),LV(this.s),LV(this.l),kV(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=kV(this.opacity);return`${e===1?`hsl(`:`hsla(`}${IV(this.h)}, ${LV(this.s)*100}%, ${LV(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function IV(e){return e=(e||0)%360,e<0?e+360:e}function LV(e){return Math.max(0,Math.min(1,e||0))}function RV(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var zV=e=>()=>e;function BV(e,t){return function(n){return e+n*t}}function VV(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function HV(e){return(e=+e)==1?UV:function(t,n){return n-t?VV(t,n,e):zV(isNaN(t)?n:t)}}function UV(e,t){var n=t-e;return n?BV(e,n):zV(isNaN(e)?t:e)}var WV=(function e(t){var n=HV(t);function r(e,t){var r=n((e=wV(e)).r,(t=wV(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=UV(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function GV(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function KV(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qV(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=nH(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function JV(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function YV(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function XV(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=nH(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var ZV=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,QV=new RegExp(ZV.source,`g`);function $V(e){return function(){return e}}function eH(e){return function(t){return e(t)+``}}function tH(e,t){var n=ZV.lastIndex=QV.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=ZV.exec(e))&&(i=QV.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:YV(r,i)})),n=QV.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?eH(c[0].x):$V(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function nH(e,t){var n=typeof t,r;return t==null||n===`boolean`?zV(t):(n===`number`?YV:n===`string`?(r=bV(t))?(t=r,WV):tH:t instanceof bV?WV:t instanceof Date?JV:KV(t)?GV:Array.isArray(t)?qV:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?XV:YV)(e,t)}function rH(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function iH(e,t){t===void 0&&(t=e,e=nH);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}function aH(e){return function(){return e}}function oH(e){return+e}var sH=[0,1];function cH(e){return e}function lH(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:aH(isNaN(t)?NaN:.5)}function uH(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function dH(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=lH(i,r),a=n(o,a)):(r=lH(r,i),a=n(a,o)),function(e){return a(r(e))}}function fH(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=lH(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=TB(e,t,1,r)-1;return a[n](i[n](t))}}function pH(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function mH(){var e=sH,t=sH,n=nH,r,i,a,o=cH,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==cH&&(o=uH(e[0],e[n-1])),s=n>2?fH:dH,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),YV))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,oH),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=rH,u()},d.clamp=function(e){return arguments.length?(o=e?!0:cH,u()):o!==cH},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function hH(){return mH()(cH,cH)}function gH(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function _H(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function vH(e){return e=_H(Math.abs(e)),e?e[1]:NaN}function yH(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function bH(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var xH=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SH(e){if(!(t=xH.exec(e)))throw Error(`invalid format: `+e);var t;return new CH({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}SH.prototype=CH.prototype;function CH(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}CH.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function wH(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var TH;function EH(e,t){var n=_H(e,t);if(!n)return TH=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(TH=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+_H(e,Math.max(0,t+a-1))[0]}function DH(e,t){var n=_H(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var OH={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:gH,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>DH(e*100,t),r:DH,s:EH,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function kH(e){return e}var AH=Array.prototype.map,jH=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function MH(e){var t=e.grouping===void 0||e.thousands===void 0?kH:yH(AH.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?kH:bH(AH.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=SH(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):OH[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=OH[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=wH(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&TH!==void 0?jH[8+TH/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(vH(t)/3)))*3,r=10**-n,i=l((e=SH(e),e.type=`f`,e),{suffix:jH[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var NH,PH,FH;IH({thousands:`,`,grouping:[3],currency:[`$`,``]});function IH(e){return NH=MH(e),PH=NH.format,FH=NH.formatPrefix,NH}function LH(e){return Math.max(0,-vH(Math.abs(e)))}function RH(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(vH(t)/3)))*3-vH(Math.abs(e)))}function zH(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,vH(t)-vH(e))+1}function BH(e,t,n,r){var i=zB(e,t,n),a;switch(r=SH(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=RH(i,o))&&(r.precision=a),FH(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=zH(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=LH(i))&&(r.precision=a-(r.type===`%`)*2)}return PH(r)}function VH(e){var t=e.domain;return e.ticks=function(e){var n=t();return LB(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return BH(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=RB(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function HH(){var e=hH();return e.copy=function(){return pH(e,HH())},qB.apply(e,arguments),VH(e)}function UH(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,oH),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return UH(e).unknown(t)},e=arguments.length?Array.from(e,oH):[0,1],VH(n)}function WH(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}function GH(e){return Math.log(e)}function KH(e){return Math.exp(e)}function qH(e){return-Math.log(-e)}function JH(e){return-Math.exp(-e)}function YH(e){return isFinite(e)?+(`1e`+e):e<0?0:e}function XH(e){return e===10?YH:e===Math.E?Math.exp:t=>e**+t}function ZH(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function QH(e){return(t,n)=>-e(-t,n)}function $H(e){let t=e(GH,KH),n=t.domain,r=10,i,a;function o(){return i=ZH(r),a=XH(r),n()[0]<0?(i=QH(i),a=QH(a),e(qH,JH)):e(GH,KH),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s<o;c&&([o,s]=[s,o]);let l=i(o),u=i(s),d,f,p=e==null?10:+e,m=[];if(!(r%1)&&u-l<p){if(l=Math.floor(l),u=Math.ceil(u),o>0){for(;l<=u;++l)for(d=1;d<r;++d)if(f=l<0?d/a(-l):d*a(l),!(f<o)){if(f>s)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(f<o)){if(f>s)break;m.push(f)}m.length*2<p&&(m=LB(o,s,p))}else m=LB(l,u,Math.min(u-l,p)).map(a);return c?m.reverse():m},t.tickFormat=(e,n)=>{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=SH(n)).precision==null&&(n.trim=!0),n=PH(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*r<r-.5&&(t*=r),t<=o?n(e):``}},t.nice=()=>n(WH(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function eU(){let e=$H(mH()).domain([1,10]);return e.copy=()=>pH(e,eU()).base(e.base()),qB.apply(e,arguments),e}function tU(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function nU(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function rU(e){var t=1,n=e(tU(t),nU(t));return n.constant=function(n){return arguments.length?e(tU(t=+n),nU(t)):t},VH(n)}function iU(){var e=rU(mH());return e.copy=function(){return pH(e,iU()).constant(e.constant())},qB.apply(e,arguments)}function aU(e){return function(t){return t<0?-((-t)**+e):t**+e}}function oU(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function sU(e){return e<0?-e*e:e*e}function cU(e){var t=e(cH,cH),n=1;function r(){return n===1?e(cH,cH):n===.5?e(oU,sU):e(aU(n),aU(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},VH(t)}function lU(){var e=cU(mH());return e.copy=function(){return pH(e,lU()).exponent(e.exponent())},qB.apply(e,arguments),e}function uU(){return lU.apply(null,arguments).exponent(.5)}function dU(e){return Math.sign(e)*e*e}function fU(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function pU(){var e=hH(),t=[0,1],n=!1,r;function i(t){var i=fU(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(dU(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,oH)).map(dU)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return pU(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},qB.apply(i,arguments),VH(i)}function mU(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r<i;)n[r-1]=GB(e,r/i);return a}function a(e){return e==null||isNaN(e=+e)?r:t[TB(n,e)]}return a.invertExtent=function(r){var i=t.indexOf(r);return i<0?[NaN,NaN]:[i>0?n[i-1]:e[0],i<n.length?n[i]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)n!=null&&!isNaN(n=+n)&&e.push(n);return e.sort(vB),i()},a.range=function(e){return arguments.length?(t=Array.from(e),i()):t.slice()},a.unknown=function(e){return arguments.length?(r=e,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return mU().domain(e).range(t).unknown(r)},qB.apply(a,arguments)}function hU(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[TB(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++i<n;)r[i]=((i+1)*t-(i-n)*e)/(n+1);return o}return o.domain=function(n){return arguments.length?([e,t]=n,e=+e,t=+t,s()):[e,t]},o.range=function(e){return arguments.length?(n=(i=Array.from(e)).length-1,s()):i.slice()},o.invertExtent=function(a){var o=i.indexOf(a);return o<0?[NaN,NaN]:o<1?[e,r[0]]:o>=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return hU().domain([e,t]).range(i).unknown(a)},qB.apply(VH(o),arguments)}function gU(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[TB(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return gU().domain(e).range(t).unknown(n)},qB.apply(i,arguments)}var _U=new Date,vU=new Date;function yU(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n<r)||!(a>0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s<n&&n<r);return o},i.filter=n=>yU(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(i.count=(t,r)=>(_U.setTime(+t),vU.setTime(+r),e(_U),e(vU),Math.floor(n(_U,vU))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var bU=yU(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);bU.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?yU(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):bU),bU.range;var xU=1e3,SU=xU*60,CU=SU*60,wU=CU*24,TU=wU*7,EU=wU*30,DU=wU*365,OU=yU(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*xU)},(e,t)=>(t-e)/xU,e=>e.getUTCSeconds());OU.range;var kU=yU(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*xU)},(e,t)=>{e.setTime(+e+t*SU)},(e,t)=>(t-e)/SU,e=>e.getMinutes());kU.range;var AU=yU(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*SU)},(e,t)=>(t-e)/SU,e=>e.getUTCMinutes());AU.range;var jU=yU(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*xU-e.getMinutes()*SU)},(e,t)=>{e.setTime(+e+t*CU)},(e,t)=>(t-e)/CU,e=>e.getHours());jU.range;var MU=yU(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*CU)},(e,t)=>(t-e)/CU,e=>e.getUTCHours());MU.range;var NU=yU(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*SU)/wU,e=>e.getDate()-1);NU.range;var PU=yU(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/wU,e=>e.getUTCDate()-1);PU.range;var FU=yU(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/wU,e=>Math.floor(e/wU));FU.range;function IU(e){return yU(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*SU)/TU)}var LU=IU(0),RU=IU(1),zU=IU(2),BU=IU(3),VU=IU(4),HU=IU(5),UU=IU(6);LU.range,RU.range,zU.range,BU.range,VU.range,HU.range,UU.range;function WU(e){return yU(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/TU)}var GU=WU(0),KU=WU(1),qU=WU(2),JU=WU(3),YU=WU(4),XU=WU(5),ZU=WU(6);GU.range,KU.range,qU.range,JU.range,YU.range,XU.range,ZU.range;var QU=yU(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());QU.range;var $U=yU(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());$U.range;var eW=yU(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());eW.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:yU(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),eW.range;var tW=yU(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());tW.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:yU(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),tW.range;function nW(e,t,n,r,i,a){let o=[[OU,1,xU],[OU,5,5*xU],[OU,15,15*xU],[OU,30,30*xU],[a,1,SU],[a,5,5*SU],[a,15,15*SU],[a,30,30*SU],[i,1,CU],[i,3,3*CU],[i,6,6*CU],[i,12,12*CU],[r,1,wU],[r,2,2*wU],[n,1,TU],[t,1,EU],[t,3,3*EU],[e,1,DU]];function s(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&typeof n.range==`function`?n:c(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a}function c(t,n,r){let i=Math.abs(n-t)/r,a=bB(([,,e])=>e).right(o,i);if(a===o.length)return e.every(zB(t/DU,n/DU,r));if(a===0)return bU.every(Math.max(zB(t,n,r),1));let[s,c]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(c)}return[s,c]}var[rW,iW]=nW(tW,$U,GU,FU,MU,AU),[aW,oW]=nW(eW,QU,LU,NU,jU,kU);function sW(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function cW(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function lW(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function uW(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=_W(i),u=vW(i),d=_W(a),f=vW(a),p=_W(o),m=vW(o),h=_W(s),g=vW(s),_=_W(c),v=vW(c),y={a:N,A:P,b:ee,B:F,c:null,d:zW,e:zW,f:WW,g:tG,G:rG,H:BW,I:VW,j:HW,L:UW,m:GW,M:KW,p:I,q:te,Q:EG,s:DG,S:qW,u:JW,U:YW,V:ZW,w:QW,W:$W,x:null,X:null,y:eG,Y:nG,Z:iG,"%":TG},b={a:L,A:ne,b:re,B:R,c:null,d:aG,e:aG,f:uG,g:xG,G:CG,H:oG,I:sG,j:cG,L:lG,m:dG,M:fG,p:ie,q:ae,Q:EG,s:DG,S:pG,u:mG,U:hG,V:_G,w:vG,W:yG,x:null,X:null,y:bG,Y:SG,Z:wG,"%":TG},x={a:E,A:D,b:O,B:k,c:A,d:kW,e:kW,f:FW,g:TW,G:wW,H:jW,I:jW,j:AW,L:PW,m:OW,M:MW,p:T,q:DW,Q:LW,s:RW,S:NW,u:bW,U:xW,V:SW,w:yW,W:CW,x:j,X:M,y:TW,Y:wW,Z:EW,"%":IW};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=dW[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function C(e,t){return function(n){var r=lW(1900,void 0,1),i=w(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=cW(lW(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?KU.ceil(a):KU(a),a=PU.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=sW(lW(r.y,0,1)),o=a.getDay(),a=o>4||o===0?RU.ceil(a):RU(a),a=NU.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?cW(lW(r.y,0,1)).getUTCDay():sW(lW(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,cW(r)):sW(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in dW?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function ee(e){return c[e.getMonth()]}function F(e){return s[e.getMonth()]}function I(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function L(e){return o[e.getUTCDay()]}function ne(e){return a[e.getUTCDay()]}function re(e){return c[e.getUTCMonth()]}function R(e){return s[e.getUTCMonth()]}function ie(e){return i[+(e.getUTCHours()>=12)]}function ae(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var dW={"-":``,_:` `,0:`0`},fW=/^\s*\d+/,pW=/^%/,mW=/[\\^$*+?|[\]().{}]/g;function hW(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function gW(e){return e.replace(mW,`\\$&`)}function _W(e){return RegExp(`^(?:`+e.map(gW).join(`|`)+`)`,`i`)}function vW(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function yW(e,t,n){var r=fW.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function bW(e,t,n){var r=fW.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function xW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function SW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function CW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function wW(e,t,n){var r=fW.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function TW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function EW(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function DW(e,t,n){var r=fW.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function OW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function kW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function AW(e,t,n){var r=fW.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function jW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function MW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function NW(e,t,n){var r=fW.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function PW(e,t,n){var r=fW.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function FW(e,t,n){var r=fW.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function IW(e,t,n){var r=pW.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function LW(e,t,n){var r=fW.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function RW(e,t,n){var r=fW.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function zW(e,t){return hW(e.getDate(),t,2)}function BW(e,t){return hW(e.getHours(),t,2)}function VW(e,t){return hW(e.getHours()%12||12,t,2)}function HW(e,t){return hW(1+NU.count(eW(e),e),t,3)}function UW(e,t){return hW(e.getMilliseconds(),t,3)}function WW(e,t){return UW(e,t)+`000`}function GW(e,t){return hW(e.getMonth()+1,t,2)}function KW(e,t){return hW(e.getMinutes(),t,2)}function qW(e,t){return hW(e.getSeconds(),t,2)}function JW(e){var t=e.getDay();return t===0?7:t}function YW(e,t){return hW(LU.count(eW(e)-1,e),t,2)}function XW(e){var t=e.getDay();return t>=4||t===0?VU(e):VU.ceil(e)}function ZW(e,t){return e=XW(e),hW(VU.count(eW(e),e)+(eW(e).getDay()===4),t,2)}function QW(e){return e.getDay()}function $W(e,t){return hW(RU.count(eW(e)-1,e),t,2)}function eG(e,t){return hW(e.getFullYear()%100,t,2)}function tG(e,t){return e=XW(e),hW(e.getFullYear()%100,t,2)}function nG(e,t){return hW(e.getFullYear()%1e4,t,4)}function rG(e,t){var n=e.getDay();return e=n>=4||n===0?VU(e):VU.ceil(e),hW(e.getFullYear()%1e4,t,4)}function iG(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+hW(t/60|0,`0`,2)+hW(t%60,`0`,2)}function aG(e,t){return hW(e.getUTCDate(),t,2)}function oG(e,t){return hW(e.getUTCHours(),t,2)}function sG(e,t){return hW(e.getUTCHours()%12||12,t,2)}function cG(e,t){return hW(1+PU.count(tW(e),e),t,3)}function lG(e,t){return hW(e.getUTCMilliseconds(),t,3)}function uG(e,t){return lG(e,t)+`000`}function dG(e,t){return hW(e.getUTCMonth()+1,t,2)}function fG(e,t){return hW(e.getUTCMinutes(),t,2)}function pG(e,t){return hW(e.getUTCSeconds(),t,2)}function mG(e){var t=e.getUTCDay();return t===0?7:t}function hG(e,t){return hW(GU.count(tW(e)-1,e),t,2)}function gG(e){var t=e.getUTCDay();return t>=4||t===0?YU(e):YU.ceil(e)}function _G(e,t){return e=gG(e),hW(YU.count(tW(e),e)+(tW(e).getUTCDay()===4),t,2)}function vG(e){return e.getUTCDay()}function yG(e,t){return hW(KU.count(tW(e)-1,e),t,2)}function bG(e,t){return hW(e.getUTCFullYear()%100,t,2)}function xG(e,t){return e=gG(e),hW(e.getUTCFullYear()%100,t,2)}function SG(e,t){return hW(e.getUTCFullYear()%1e4,t,4)}function CG(e,t){var n=e.getUTCDay();return e=n>=4||n===0?YU(e):YU.ceil(e),hW(e.getUTCFullYear()%1e4,t,4)}function wG(){return`+0000`}function TG(){return`%`}function EG(e){return+e}function DG(e){return Math.floor(e/1e3)}var OG,kG,AG;jG({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function jG(e){return OG=uW(e),kG=OG.format,OG.parse,AG=OG.utcFormat,OG.utcParse,OG}function MG(e){return new Date(e)}function NG(e){return e instanceof Date?+e:+new Date(+e)}function PG(e,t,n,r,i,a,o,s,c,l){var u=hH(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)<e?p:s(e)<e?m:o(e)<e?h:a(e)<e?g:r(e)<e?i(e)<e?_:v:n(e)<e?y:b)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,NG)):f().map(MG)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],t??10)},u.tickFormat=function(e,t){return t==null?x:l(t)},u.nice=function(e){var n=f();return(!e||typeof e.range!=`function`)&&(e=t(n[0],n[n.length-1],e??10)),e?f(WH(n,e)):u},u.copy=function(){return pH(u,PG(e,t,n,r,i,a,o,s,c,l))},u}function FG(){return qB.apply(PG(aW,oW,eW,QU,LU,NU,jU,kU,OU,kG).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function IG(){return qB.apply(PG(rW,iW,tW,$U,GU,PU,MU,AU,OU,AG).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function LG(){var e=0,t=1,n,r,i,a,o=cH,s=!1,c;function l(e){return e==null||isNaN(e=+e)?c:o(i===0?.5:(e=(a(e)-n)*i,s?Math.max(0,Math.min(1,e)):e))}l.domain=function(o){return arguments.length?([e,t]=o,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(e){return arguments.length?(s=!!e,l):s},l.interpolator=function(e){return arguments.length?(o=e,l):o};function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,o=e(n,r),l):[o(0),o(1)]}}return l.range=u(nH),l.rangeRound=u(rH),l.unknown=function(e){return arguments.length?(c=e,l):c},function(o){return a=o,n=o(e),r=o(t),i=n===r?0:1/(r-n),l}}function RG(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function zG(){var e=VH(LG()(cH));return e.copy=function(){return RG(e,zG())},JB.apply(e,arguments)}function BG(){var e=$H(LG()).domain([1,10]);return e.copy=function(){return RG(e,BG()).base(e.base())},JB.apply(e,arguments)}function VG(){var e=rU(LG());return e.copy=function(){return RG(e,VG()).constant(e.constant())},JB.apply(e,arguments)}function HG(){var e=cU(LG());return e.copy=function(){return RG(e,HG()).exponent(e.exponent())},JB.apply(e,arguments)}function UG(){return HG.apply(null,arguments).exponent(.5)}function WG(){var e=[],t=cH;function n(n){if(n!=null&&!isNaN(n=+n))return t((TB(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)n!=null&&!isNaN(n=+n)&&e.push(n);return e.sort(vB),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>WB(e,r/t))},n.copy=function(){return WG(t).domain(e)},JB.apply(n,arguments)}function GG(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=cH,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e<r*a?s:c),l(d?Math.max(0,Math.min(1,e)):e))}p.domain=function(l){return arguments.length?([e,t,n]=l,i=u(e=+e),a=u(t=+t),o=u(n=+n),s=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,p):[e,t,n]},p.clamp=function(e){return arguments.length?(d=!!e,p):d},p.interpolator=function(e){return arguments.length?(l=e,p):l};function m(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,l=iH(e,[n,r,i]),p):[l(0),l(.5),l(1)]}}return p.range=m(nH),p.rangeRound=m(rH),p.unknown=function(e){return arguments.length?(f=e,p):f},function(l){return u=l,i=l(e),a=l(t),o=l(n),s=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,p}}function KG(){var e=VH(GG()(cH));return e.copy=function(){return RG(e,KG())},JB.apply(e,arguments)}function qG(){var e=$H(GG()).domain([.1,1,10]);return e.copy=function(){return RG(e,qG()).base(e.base())},JB.apply(e,arguments)}function JG(){var e=rU(GG());return e.copy=function(){return RG(e,JG()).constant(e.constant())},JB.apply(e,arguments)}function YG(){var e=cU(GG());return e.copy=function(){return RG(e,YG()).exponent(e.exponent())},JB.apply(e,arguments)}function XG(){return YG.apply(null,arguments).exponent(.5)}var ZG=s({scaleBand:()=>ZB,scaleDiverging:()=>KG,scaleDivergingLog:()=>qG,scaleDivergingPow:()=>YG,scaleDivergingSqrt:()=>XG,scaleDivergingSymlog:()=>JG,scaleIdentity:()=>UH,scaleImplicit:()=>YB,scaleLinear:()=>HH,scaleLog:()=>eU,scaleOrdinal:()=>XB,scalePoint:()=>$B,scalePow:()=>lU,scaleQuantile:()=>mU,scaleQuantize:()=>hU,scaleRadial:()=>pU,scaleSequential:()=>zG,scaleSequentialLog:()=>BG,scaleSequentialPow:()=>HG,scaleSequentialQuantile:()=>WG,scaleSequentialSqrt:()=>UG,scaleSequentialSymlog:()=>VG,scaleSqrt:()=>uU,scaleSymlog:()=>iU,scaleThreshold:()=>gU,scaleTime:()=>FG,scaleUtc:()=>IG,tickFormat:()=>BH});function QG(e){if(e in ZG)return ZG[e]();var t=`scale${tO(e)}`;if(t in ZG)return ZG[t]()}function $G(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=QG(e);if(r!=null)return r.domain(t).range(n),r}}function eK(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?$G(e.scale,n,r):$G(t,n,r)}function tK(e){return`scale${tO(e)}`}function nK(e){return tK(e)in ZG}var rK=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return nK(r)?r:`point`}};function iK(e,t){for(var n=0,r=e.length,i=e[0]<e[e.length-1];n<r;){var a=Math.floor((n+r)/2);(i?e[a]<t:e[a]>t)?n=a+1:r=a}return n}function aK(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=iK(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function oK(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):aK(e,void 0)}function sK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function cK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?sK(Object(n),!0).forEach(function(t){lK(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sK(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function lK(e,t,n){return(t=uK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uK(e){var t=dK(e,`string`);return typeof t==`symbol`?t:t+``}function dK(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var fK=[0,`auto`],pK={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`bottom`,padding:{left:0,right:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`category`,unit:void 0,niceTicks:`auto`},mK=(e,t)=>e.cartesianAxis.xAxis[t],hK=(e,t)=>mK(e,t)??pK,gK={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:fK,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,niceTicks:`auto`,width:60},_K=(e,t)=>e.cartesianAxis.yAxis[t],vK=(e,t)=>_K(e,t)??gK,yK={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},bK=(e,t)=>e.cartesianAxis.zAxis[t]??yK,xK=(e,t,n)=>{switch(t){case`xAxis`:return hK(e,n);case`yAxis`:return vK(e,n);case`zAxis`:return bK(e,n);case`angleAxis`:return Zz(e,n);case`radiusAxis`:return Qz(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},SK=(e,t,n)=>{switch(t){case`xAxis`:return hK(e,n);case`yAxis`:return vK(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},CK=(e,t,n)=>{switch(t){case`xAxis`:return hK(e,n);case`yAxis`:return vK(e,n);case`angleAxis`:return Zz(e,n);case`radiusAxis`:return Qz(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},wK=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function TK(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var EK=e=>e.graphicalItems.cartesianItems,DK=$([oB,sB],TK),OK=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),kK=$([EK,xK,DK],OK,{memoizeOptions:{resultEqualityCheck:fB}}),AK=$([kK],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(uB)),jK=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),MK=$([kK],jK),NK=e=>e.map(e=>e.data).filter(Boolean).flat(1),PK=$([kK],NK,{memoizeOptions:{resultEqualityCheck:fB}}),FK=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},IK=$([PK,pz],FK),LK=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:DN(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:DN(e,t.dataKey)})),RK=$([IK,xK,kK],LK);function zK(e){if(qD(e)||e instanceof Date){var t=Number(e);if(bN(t))return t}}function BK(e){if(Array.isArray(e)){var t=[zK(e[0]),zK(e[1])];return hz(t)?t:void 0}var n=zK(e);if(n!=null)return[n,n]}function VK(e){return e.map(zK).filter(nO)}function HK(e,t){var n=zK(e),r=zK(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var UK=$([RK],e=>e?.map(e=>e.value).sort(HK));function WK(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function GK(e,t,n){return!n||typeof t!=`number`||GD(t)||!n.length?[]:VK(n.flatMap(n=>{var r=DN(e,n.dataKey),i,a;if(Array.isArray(r)?[i,a]=r:i=a=r,!(!bN(i)||!bN(a)))return[t-i,t+a]}))}var KK=e=>CK(e,mB(e),hB(e)),qK=$([KK],e=>e?.dataKey),JK=$([AK,pz,KK],lB),YK=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var[i,a]=t,o=r?[...a].reverse():a;return[i,{stackedData:PN(e,o.map(cB),n),graphicalItems:o}]}))},XK=$([JK,AK,Nz,Pz],YK),ZK=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!==`zAxis`){var o=BN(e,i,a);if(o==null||o[0]!==0||o[1]!==0)return o}},QK=$([xK],e=>e.allowDataOverflow),$K=e=>{if(e==null||!(`domain`in e))return fK;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=VK(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??fK},eq=$([xK],$K),tq=$([eq,QK],_z),nq=$([XK,dz,oB,tq],ZK,{memoizeOptions:{resultEqualityCheck:dB}}),rq=e=>e.errorBars,iq=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>WK(n,e)),aq=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},oq=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s=r[n.id]?.filter(e=>WK(i,e)),c=DN(e,t.dataKey??n.dataKey),l=GK(e,c,s);if(l.length>=2){var u=Math.min(...l),d=Math.max(...l);(a==null||u<a)&&(a=u),(o==null||d>o)&&(o=d)}var f=BK(c);f!=null&&(a=a==null?f[0]:Math.min(a,f[0]),o=o==null?f[1]:Math.max(o,f[1]))})}),t?.dataKey!=null&&e.forEach(e=>{var n=BK(DN(e,t.dataKey));n!=null&&(a=a==null?n[0]:Math.min(a,n[0]),o=o==null?n[1]:Math.max(o,n[1]))}),bN(a)&&bN(o))return[a,o]},sq=$([IK,xK,MK,rq,oB],oq,{memoizeOptions:{resultEqualityCheck:dB}});function cq(e){var{value:t}=e;if(qD(t)||t instanceof Date)return t}var lq=(e,t,n)=>{var r=e.map(cq).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&ZD(r))?uz(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},uq=e=>e.referenceElements.dots,dq=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),fq=$([uq,oB,sB],dq),pq=e=>e.referenceElements.areas,mq=$([pq,oB,sB],dq),hq=e=>e.referenceElements.lines,gq=$([hq,oB,sB],dq),_q=(e,t)=>{if(e!=null){var n=VK(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},vq=$(fq,oB,_q),yq=(e,t)=>{if(e!=null){var n=VK(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},bq=$([mq,oB],yq);function xq(e){if(e.x!=null)return VK([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:VK(t)}function Sq(e){if(e.y!=null)return VK([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:VK(t)}var Cq=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?xq(e):Sq(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},wq=$(vq,$([gq,oB],Cq),bq,(e,t,n)=>aq(e,n,t)),Tq=(e,t,n,r,i,a,o,s)=>n??vz(t,o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?aq(r,a,i):aq(a,i),e.allowDataOverflow),Eq=$([xK,eq,tq,nq,sq,wq,JP,oB],Tq,{memoizeOptions:{resultEqualityCheck:dB}}),Dq=[0,1],Oq=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var{dataKey:s,type:c}=e,l=kN(t,a);return l&&s==null?uz(0,n?.length??0):c===`category`?lq(r,e,l):i===`expand`?Dq:o}},kq=$([xK,JP,IK,RK,Nz,oB,Eq],Oq),Aq=$([xK,wK,Fz],rK),jq=(e,t,n)=>{var{niceTicks:r}=t;if(r!==`none`){var i=$K(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&hz(e)){if(a)return Dz(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return Oz(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&hz(e))return Dz(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&hz(e))return Oz(e,t.tickCount,t.allowDecimals,`adaptive`)}}},Mq=$([kq,CK,Aq],jq),Nq=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&hz(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},Pq=$([xK,kq,Mq,oB],Nq),Fq=$($(RK,xK,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(VK(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;s<r.length-1;s++){var c=r[s],l=r[s+1];if(c!=null&&l!=null){var u=l-c;n=Math.min(n,u)}}return n/o}}),JP,jz,dP,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!bN(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=XD(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),Iq=(e,t,n)=>{var r=hK(e,t);return r==null||typeof r.padding!=`string`?0:Fq(e,`xAxis`,t,n,r.padding)},Lq=(e,t,n)=>{var r=vK(e,t);return r==null||typeof r.padding!=`string`?0:Fq(e,`yAxis`,t,n,r.padding)},Rq=$(hK,Iq,(e,t)=>{if(e==null)return{left:0,right:0};var{padding:n}=e;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),zq=$(vK,Lq,(e,t)=>{if(e==null)return{top:0,bottom:0};var{padding:n}=e;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),Bq=$([dP,Rq,_P,gP,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Vq=$([dP,JP,zq,_P,gP,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Hq=(e,t,n,r)=>{switch(t){case`xAxis`:return Bq(e,n,r);case`yAxis`:return Vq(e,n,r);case`zAxis`:return bK(e,n)?.range;case`angleAxis`:return rB(e);case`radiusAxis`:return iB(e,n);default:return}},Uq=$([xK,Hq],Hz),Wq=$([xK,Aq,$([Aq,Pq],_B),Uq],eK),Gq=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var{type:i,scale:a}=n;if(kN(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},Kq=$([JP,RK,CK,oB],Gq),qq=$([Wq],gB);$([Wq],oK),$([Wq,UK],aK),$([kK,rq,oB],iq);function Jq(e,t){return e.id<t.id?-1:+(e.id>t.id)}var Yq=(e,t)=>t,Xq=(e,t,n)=>n,Zq=$(QN,Yq,Xq,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Jq)),Qq=$($N,Yq,Xq,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Jq)),$q=(e,t)=>({width:e.width,height:t.height}),eJ=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),tJ=$(dP,hK,$q),nJ=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},rJ=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},iJ=$(YN,dP,Zq,Yq,Xq,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=$q(t,n);o??=nJ(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),aJ=$(JN,dP,Qq,Yq,Xq,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=eJ(t,n);o??=rJ(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),oJ=$([dP,hK,(e,t)=>{var n=hK(e,t);if(n!=null)return iJ(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),sJ=$([dP,vK,(e,t)=>{var n=vK(e,t);if(n!=null)return aJ(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),cJ=$(dP,vK,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),lJ=(e,t,n)=>{switch(t){case`xAxis`:return tJ(e,n).width;case`yAxis`:return cJ(e,n).height;default:return}},uJ=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=kN(e,r),c=t.map(e=>e.value);if(o&&s&&a===`category`&&i&&ZD(c))return c}},dJ=$([JP,RK,xK,oB],uJ),fJ=$([JP,SK,Aq,qq,dJ,Kq,Hq,Mq,oB],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=kN(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),pJ=$([JP,CK,Aq,qq,Mq,Hq,dJ,Kq,oB],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=kN(e,c),{type:u,ticks:d,tickCount:f}=t,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?WD(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return bN(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(nO):l&&s?s.map((e,t)=>{var n=r.map(e);return bN(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(nO):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return bN(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(nO):r.domain().map((e,t)=>{var n=r.map(e);return bN(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(nO)}}),mJ=$([JP,CK,qq,Hq,dJ,Kq,oB],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=kN(e,o),{tickCount:c}=t,l=0;return l=o===`angleAxis`&&r?.length>=2?WD(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return bN(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(nO):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return bN(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(nO):n.domain().map((e,t)=>{var r=n.map(e);return bN(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(nO)}}),hJ=$(xK,qq,(e,t)=>{if(e!=null&&t!=null)return cK(cK({},e),{},{scale:t})});$((e,t,n)=>bK(e,n),$([$([xK,Aq,kq,Uq],eK)],gB),(e,t)=>{if(e!=null&&t!=null)return cK(cK({},e),{},{scale:t})});var gJ=$([JP,QN,$N],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});$([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);a<n&&(n=a,r=i)}return r?.value}});var _J=e=>e.options.defaultTooltipEventType,vJ=e=>e.options.validateTooltipEventTypes;function yJ(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function bJ(e,t){return yJ(t,_J(e),vJ(e))}function xJ(e){return Q(t=>bJ(t,e))}var SJ=(e,t)=>{var n,r=Number(t);if(!(GD(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},CJ=e=>e.tooltip.settings,wJ={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},TJ=TM({name:`tooltip`,initialState:{itemInteraction:{click:wJ,hover:wJ},axisInteraction:{click:wJ,hover:wJ},keyboardInteraction:wJ,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(YF(t.payload))},prepare:uM()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Xj(e).tooltipItemPayloads.indexOf(YF(n));i>-1&&(e.tooltipItemPayloads[i]=YF(r))},prepare:uM()},removeTooltipEntrySettings:{reducer(e,t){var n=Xj(e).tooltipItemPayloads.indexOf(YF(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:uM()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:EJ,replaceTooltipEntrySettings:DJ,removeTooltipEntrySettings:OJ,setTooltipSettingsState:kJ,setActiveMouseOverItemIndex:AJ,mouseLeaveItem:jJ,mouseLeaveChart:MJ,setActiveClickItemIndex:NJ,setMouseOverAxisIndex:PJ,setMouseClickAxisIndex:FJ,setSyncInteraction:IJ,setKeyboardInteraction:LJ}=TJ.actions,RJ=TJ.reducer;function zJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?zJ(Object(n),!0).forEach(function(t){VJ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VJ(e,t,n){return(t=HJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HJ(e){var t=UJ(e,`string`);return typeof t==`symbol`?t:t+``}function UJ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function WJ(e,t,n){return t===`axis`?n===`click`?e.axisInteraction.click:e.axisInteraction.hover:n===`click`?e.itemInteraction.click:e.itemInteraction.hover}function GJ(e){return e.index!=null}var KJ=(e,t,n,r)=>{if(t==null)return wJ;var i=WJ(e,t,n);if(i==null)return wJ;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(GJ(i)){if(a)return BJ(BJ({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return BJ(BJ({},wJ),{},{coordinate:i.coordinate})};function qJ(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function JJ(e,t){var n=qJ(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function YJ(e,t,n){if(n==null||t==null)return!0;var r=DN(e,t);return r==null||!hz(n)||JJ(r,n)}var XJ=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!bN(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||YJ(l,n,r)?String(c):null},ZJ=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},QJ=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},$J=e=>e.options.tooltipPayloadSearcher,eY=e=>e.tooltip;function tY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tY(Object(n),!0).forEach(function(t){rY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rY(e,t,n){return(t=iY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iY(e){var t=aY(e,`string`);return typeof t==`symbol`?t:t+``}function aY(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function oY(e){if(typeof e==`string`||typeof e==`number`)return e}function sY(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e}function cY(e){if(typeof e==`string`||typeof e==`number`)return e;if(typeof e==`function`)return t=>e(t)}function lY(e){if(typeof e==`string`)return e}function uY(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?oY(e.name):void 0,unit:`unit`in e?sY(e.unit):void 0,dataKey:`dataKey`in e?cY(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?lY(e.color):void 0,fill:`fill`in e?lY(e.fill):void 0}}function dY(e,t){return e??t}var fY=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var{chartData:s,computedData:c,dataStartIndex:l,dataEndIndex:u}=n;return e.reduce((e,n)=>{var{dataDefinedOnItem:d,settings:f}=n,p=dY(d,s),m=Array.isArray(p)?yN(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_=r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?$D(m,r,i):a(m,t,c,g);return Array.isArray(_)?_.forEach(t=>{var n=uY(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=nY(nY({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(WN({tooltipEntrySettings:o,dataKey:i,payload:a,value:DN(a,i),name:r==null?void 0:String(r)}))}):e.push(WN({tooltipEntrySettings:f,dataKey:h,payload:_,value:DN(_,h),name:DN(_,g)??f?.name})),e},[])}},pY=$([KK,wK,Fz],rK),mY=$([$([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),KK,$([mB,hB],TK)],OK,{memoizeOptions:{resultEqualityCheck:fB}}),hY=$([mY],e=>e.filter(uB)),gY=$([$([mY],NK,{memoizeOptions:{resultEqualityCheck:fB}}),dz],FK),_Y=$([hY,dz,KK],lB),vY=$([gY,KK,mY],LK),yY=$([KK],$K),bY=$([yY,$([KK],e=>e.allowDataOverflow)],_z),xY=$([$([_Y,$([mY],e=>e.filter(uB)),Nz,Pz],YK),dz,mB,bY],ZK),SY=$([gY,KK,$([mY],jK),rq,mB],oq,{memoizeOptions:{resultEqualityCheck:dB}}),CY=$([$([uq,mB,hB],dq),mB],_q),wY=$([$([pq,mB,hB],dq),mB],yq),TY=$([KK,JP,gY,vY,Nz,mB,$([KK,yY,bY,xY,SY,$([CY,$([$([hq,mB,hB],dq),mB],Cq),wY],aq),JP,mB],Tq)],Oq),EY=$([KK,TY,$([TY,KK,pY],jq),mB],Nq),DY=e=>Hq(e,mB(e),hB(e),!1),OY=$([KK,DY],Hz),kY=$([$([KK,pY,EY,OY],eK)],gB),AY=$([JP,KK,pY,kY,DY,$([JP,vY,KK,mB],uJ),$([JP,vY,KK,mB],Gq),mB],(e,t,n,r,i,a,o,s)=>{if(t){var{type:c}=t,l=kN(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?WD(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return bN(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(nO):r.domain().map((e,t)=>{var n=r.map(e);return bN(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(nO)}}}),jY=$([_J,vJ,CJ],(e,t,n)=>yJ(n.shared,e,t)),MY=e=>e.tooltip.settings.trigger,NY=e=>e.tooltip.settings.defaultIndex,PY=$([eY,jY,MY,NY],KJ),FY=$([PY,gY,qK,TY],XJ),IY=$([AY,FY],SJ),LY=$([PY],e=>{if(e)return e.dataKey}),RY=$([PY],e=>{if(e)return e.graphicalItemId}),zY=$([eY,jY,MY,NY],QJ),BY=$([PY,$([JN,YN,JP,dP,AY,NY,zY],ZJ)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),VY=$([PY],e=>e?.active??!1);$([$([zY,FY,dz,qK,IY,$J,jY],fY)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function HY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function UY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?HY(Object(n),!0).forEach(function(t){WY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function WY(e,t,n){return(t=GY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GY(e){var t=KY(e,`string`);return typeof t==`symbol`?t:t+``}function KY(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var qY=()=>Q(KK),JY=()=>{var e=qY(),t=Q(AY),n=Q(kY);return UN(!e||!n?void 0:UY(UY({},e),{},{scale:n}),t)};function YY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?YY(Object(n),!0).forEach(function(t){ZY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ZY(e,t,n){return(t=QY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QY(e){var t=$Y(e,`string`);return typeof t==`symbol`?t:t+``}function $Y(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var eX=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},tX=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,{radius:o}=r;return XY(XY(XY({},r),RR(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:c}=r;return XY(XY(XY({},r),RR(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function nX(e,t){var{relativeX:n,relativeY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var rX=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o<a;o++){var s=o>0?n[o-1]?.coordinate:n[a-1]?.coordinate,c=n[o]?.coordinate,l=o>=a-1?n[0]?.coordinate:n[o+1]?.coordinate,u=void 0;if(s!=null&&c!=null&&l!=null){if(WD(c-s)!==WD(l-c)){var d=[];if(WD(l-c)===WD(i[1]-i[0])){u=l;var f=c+i[1]-i[0];d[0]=Math.min(f,(f+s)/2),d[1]=Math.max(f,(f+s)/2)}else{u=s;var p=l+i[1]-i[0];d[0]=Math.min(c,(p+c)/2),d[1]=Math.max(c,(p+c)/2)}var m=[Math.min(c,(u+c)/2),Math.max(c,(u+c)/2)];if(e>m[0]&&e<=m[1]||e>=d[0]&&e<=d[1])return n[o]?.index}else{var h=Math.min(s,l),g=Math.max(s,l);if(e>(h+c)/2&&e<=(g+c)/2)return n[o]?.index}}}else if(t)for(var _=0;_<a;_++){var v=t[_];if(v!=null){var y=t[_+1],b=t[_-1];if(_===0&&y!=null&&e<=(v.coordinate+y.coordinate)/2||_===a-1&&b!=null&&e>(v.coordinate+b.coordinate)/2||_>0&&_<a-1&&b!=null&&y!=null&&e>(v.coordinate+b.coordinate)/2&&e<=(v.coordinate+y.coordinate)/2)return v.index}}return-1},iX=()=>Q(Fz),aX=(e,t)=>t,oX=(e,t,n)=>n,sX=(e,t,n,r)=>r,cX=$(AY,e=>hA(e,e=>e.coordinate)),lX=$([eY,aX,oX,sX],KJ),uX=$([lX,gY,qK,TY],XJ),dX=(e,t,n)=>{if(t!=null){var r=eY(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},fX=$([eY,aX,oX,sX],QJ),pX=$([JN,YN,JP,dP,AY,sX,fX],ZJ),mX=$([lX,pX],(e,t)=>e.coordinate??t),hX=$([AY,uX],SJ),gX=$([fX,uX,dz,qK,hX,$J,aX],fY),_X=$([lX,uX],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),vX=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&nX(e,o)){var s=rX(KN(e,t),a,i,n,r),c=eX(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},yX=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=WR(e,n);if(s){var c=rX(qN(s,t),o,a,r,i),l=tX(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},bX=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?vX(e,t,r,i,a,o,s):yX(e,t,n,r,i,a,o)},xX=$(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),SX=$(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(zz));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:pB}});function CX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?CX(Object(n),!0).forEach(function(t){TX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function TX(e,t,n){return(t=EX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EX(e){var t=DX(e,`string`);return typeof t==`symbol`?t:t+``}function DX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var OX={zIndexMap:Object.values(zz).reduce((e,t)=>wX(wX({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},kX=new Set(Object.values(zz));function AX(e){return kX.has(e)}var jX=TM({name:`zIndex`,initialState:OX,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:uM()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!AX(n)&&delete e.zIndexMap[n])},prepare:uM()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=YF(r):e.zIndexMap[n].element=YF(r):e.zIndexMap[n]={consumers:0,element:i?void 0:YF(r),panoramaElement:i?YF(r):void 0}},prepare:uM()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:uM()}}}),{registerZIndexPortal:MX,unregisterZIndexPortal:NX,registerZIndexPortalElement:PX,unregisterZIndexPortalElement:FX}=jX.actions,IX=jX.reducer;function LX(e){var{zIndex:t,children:n}=e,r=QP()&&t!==void 0&&t!==0,i=hP(),a=Hk();(0,v.useLayoutEffect)(()=>r?(a(MX({zIndex:t})),()=>{a(NX({zIndex:t}))}):rO,[a,t,r]);var o=Q(e=>xX(e,t,i));return r?o?(0,Dr.createPortal)(n,o):null:n}function RX(){return RX=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RX.apply(null,arguments)}function zX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?zX(Object(n),!0).forEach(function(t){VX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VX(e,t,n){return(t=HX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HX(e){var t=UX(e,`string`);return typeof t==`symbol`?t:t+``}function UX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function WX(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,v.isValidElement)(t)?(0,v.cloneElement)(t,r):(0,v.createElement)(n,r)}function GX(e){var{coordinate:t,payload:n,index:r,offset:i,tooltipAxisBandSize:a,layout:o,cursor:s,tooltipEventType:c,chartName:l}=e,u=t,d=n,f=r;if(!s||!u||l!==`ScatterChart`&&c!==`axis`)return null;var p,m,h;if(l===`ScatterChart`)p=u,m=yL,h=zz.cursorLine;else if(l===`BarChart`)p=bL(o,u,i,a),m=AR,h=zz.cursorRectangle;else if(o===`radial`&&yO(u)){var{cx:g,cy:_,radius:y,startAngle:b,endAngle:x}=GR(u);p={cx:g,cy:_,startAngle:b,endAngle:x,innerRadius:y,outerRadius:y},m=oz,h=zz.cursorLine}else p={points:sz(o,u,i)},m=cL,h=zz.cursorLine;var S=typeof s==`object`&&`className`in s?s.className:void 0,C=BX(BX(BX(BX({stroke:`#ccc`,pointerEvents:`none`},i),p),qT(s)),{},{payload:d,payloadIndex:f,className:Yt(`recharts-tooltip-cursor`,S)});return v.createElement(LX,{zIndex:e.zIndex??h},v.createElement(WX,{cursor:s,cursorComp:m,cursorProps:C}))}function KX(e){var t=JY(),n=GP(),r=YP(),i=iX();return t==null||n==null||r==null||i==null?null:v.createElement(GX,RX({},e,{offset:n,layout:r,tooltipAxisBandSize:t,chartName:i}))}var qX=(0,v.createContext)(null),JX=()=>(0,v.useContext)(qX),YX=l(o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1).default,XX=new YX,ZX=`recharts.syncEvent.tooltip`,QX=`recharts.syncEvent.brush`,$X=(e,t)=>{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!GD(n))return e[n]}},eZ=TM({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),tZ=eZ.reducer,{createEventEmitter:nZ}=eZ.actions;function rZ(e){return e.tooltip.syncInteraction}var iZ=TM({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=YF(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:aZ,setDataStartEndIndexes:oZ,setComputedData:sZ}=iZ.actions,cZ=iZ.reducer,lZ=[`x`,`y`];function uZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?uZ(Object(n),!0).forEach(function(t){fZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fZ(e,t,n){return(t=pZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pZ(e){var t=mZ(e,`string`);return typeof t==`symbol`?t:t+``}function mZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function hZ(e,t){if(e==null)return{};var n,r,i=gZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function gZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _Z(){var e=Q(Iz),t=Q(Rz),n=Hk(),r=Q(Lz),i=Q(AY),a=YP(),o=UP(),s=Q(e=>e.rootProps.className);(0,v.useEffect)(()=>{if(e==null)return rO;var s=(s,c,l)=>{if(t!==l&&e===s){if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,{x:f,y:p}=d,m=hZ(d,lZ),{x:h,y:g,width:_,height:v}=c.payload.sourceViewBox,y=dZ(dZ({},m),{},{x:o.x+(_?(f-h)/_:0)*o.width,y:o.y+(v?(p-g)/v:0)*o.height});n(dZ(dZ({},c),{},{payload:dZ(dZ({},c.payload),{},{coordinate:y})}))}else n(c);return}if(i!=null){var b;typeof r==`function`?b=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(b=i.find(e=>String(e.value)===c.payload.label));var{coordinate:x}=c.payload;if(b==null||c.payload.active===!1||x==null||o==null){n(IJ({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:S,y:C}=x,w=Math.min(S,o.x+o.width),T=Math.min(C,o.y+o.height),E={x:a===`horizontal`?b.coordinate:w,y:a===`horizontal`?T:b.coordinate};n(IJ({active:c.payload.active,coordinate:E,dataKey:c.payload.dataKey,index:String(b.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return XX.on(ZX,s),()=>{XX.off(ZX,s)}},[s,n,t,e,r,i,a,o])}function vZ(){var e=Q(Iz),t=Q(Rz),n=Hk();(0,v.useEffect)(()=>{if(e==null)return rO;var r=(r,i,a)=>{t!==a&&e===r&&n(oZ(i))};return XX.on(QX,r),()=>{XX.off(QX,r)}},[n,t,e])}function yZ(){var e=Hk();(0,v.useEffect)(()=>{e(nZ())},[e]),_Z(),vZ()}function bZ(e,t,n,r,i,a){var o=Q(n=>dX(n,e,t)),s=Q(RY),c=Q(Rz),l=Q(Iz),u=Q(Lz),d=Q(rZ)?.active,f=UP();(0,v.useEffect)(()=>{if(!d&&l!=null&&c!=null){var e=IJ({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:f,graphicalItemId:s});XX.emit(ZX,l,e,c)}},[d,n,o,s,i,r,c,l,u,a,f])}function xZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function SZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?xZ(Object(n),!0).forEach(function(t){CZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CZ(e,t,n){return(t=wZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wZ(e){var t=TZ(e,`string`);return typeof t==`symbol`?t:t+``}function TZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function EZ(e){return e.dataKey}function DZ(e,t){return v.isValidElement(e)?v.cloneElement(e,t):typeof e==`function`?v.createElement(e,t):v.createElement(AI,t)}var OZ=[],kZ={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:`auto`,itemSorter:`name`,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,wrapperStyle:{}};function AZ(e){var t=OO(e,kZ),{active:n,allowEscapeViewBox:r,animationDuration:i,animationEasing:a,content:o,filterNull:s,isAnimationActive:c,offset:l,payloadUniqBy:u,position:d,reverseDirection:f,useTranslate3d:p,wrapperStyle:m,cursor:h,shared:g,trigger:_,defaultIndex:y,portal:b,axisId:x}=t,S=Hk(),C=typeof y==`number`?String(y):y;(0,v.useEffect)(()=>{S(kJ({shared:g,trigger:_,axisId:x,active:n,defaultIndex:C}))},[S,g,_,x,n,C]);var w=UP(),T=qI(),E=xJ(g),{activeIndex:D,isActive:O}=Q(e=>_X(e,E,_,C))??{},k=Q(e=>gX(e,E,_,C)),A=Q(e=>hX(e,E,_,C)),j=Q(e=>mX(e,E,_,C)),M=k,N=JX(),P=n??O??!1,[ee,F]=yA([M,P]),I=E===`axis`?A:void 0;bZ(E,_,j,I,D,P);var te=b??N;if(te==null||w==null||E==null)return null;var L=M??OZ;P||(L=OZ),s&&L.length&&(L=Pk(L.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),u,EZ));var ne=L.length>0,re=SZ(SZ({},t),{},{payload:L,label:I,active:P,activeIndex:D,coordinate:j,accessibilityLayer:T}),R=v.createElement(KI,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:c,active:P,coordinate:j,hasPayload:ne,offset:l,position:d,reverseDirection:f,useTranslate3d:p,viewBox:w,wrapperStyle:m,lastBoundingBox:ee,innerRef:F,hasPortalFromProps:!!b},DZ(o,re));return v.createElement(v.Fragment,null,(0,Dr.createPortal)(R,te),P&&v.createElement(KX,{cursor:h,tooltipEventType:E,coordinate:j,payload:L,index:D}))}var jZ=e=>null;jZ.displayName=`Cell`;function MZ(e,t,n){return(t=NZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NZ(e){var t=PZ(e,`string`);return typeof t==`symbol`?t:t+``}function PZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var FZ=class{constructor(e){MZ(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function IZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function LZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?IZ(Object(n),!0).forEach(function(t){RZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RZ(e,t,n){return(t=zZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zZ(e){var t=BZ(e,`string`);return typeof t==`symbol`?t:t+``}function BZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var VZ=LZ({},{cacheSize:2e3,enableCache:!0}),HZ=new FZ(VZ.cacheSize),UZ={position:`absolute`,top:`-20000px`,left:0,padding:0,margin:0,border:`none`,whiteSpace:`pre`},WZ=`recharts_measurement_span`;function GZ(e,t){return`${e}|${t.fontSize||``}|${t.fontFamily||``}|${t.fontWeight||``}|${t.fontStyle||``}|${t.letterSpacing||``}|${t.textTransform||``}`}var KZ=(e,t)=>{try{var n=document.getElementById(WZ);n||(n=document.createElement(`span`),n.setAttribute(`id`,WZ),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,UZ,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},qZ=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||LI.isSsr)return{width:0,height:0};if(!VZ.enableCache)return KZ(e,t);var n=GZ(e,t),r=HZ.get(n);if(r)return r;var i=KZ(e,t);return HZ.set(n,i),i},JZ;function YZ(e,t,n){return(t=XZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XZ(e){var t=ZZ(e,`string`);return typeof t==`symbol`?t:t+``}function ZZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var QZ=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,$Z=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,eQ=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,tQ=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,nQ={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},rQ=[`cm`,`mm`,`pt`,`pc`,`in`,`Q`,`px`];function iQ(e){return rQ.includes(e)}var aQ=`NaN`;function oQ(e,t){return e*nQ[t]}var sQ=class e{static parse(t){var[,n,r]=tQ.exec(t)??[];return n==null?e.NaN:new e(parseFloat(n),r??``)}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,GD(e)&&(this.unit=``),t!==``&&!eQ.test(t)&&(this.num=NaN,this.unit=``),iQ(t)&&(this.num=oQ(e,t),this.unit=`px`)}add(t){return this.unit===t.unit?new e(this.num+t.num,this.unit):new e(NaN,``)}subtract(t){return this.unit===t.unit?new e(this.num-t.num,this.unit):new e(NaN,``)}multiply(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num/t.num,this.unit||t.unit)}toString(){return`${this.num}${this.unit}`}isNaN(){return GD(this.num)}};JZ=sQ,YZ(sQ,`NaN`,new JZ(NaN,``));function cQ(e){if(e==null||e.includes(aQ))return aQ;for(var t=e;t.includes(`*`)||t.includes(`/`);){var[,n,r,i]=QZ.exec(t)??[],a=sQ.parse(n??``),o=sQ.parse(i??``),s=r===`*`?a.multiply(o):a.divide(o);if(s.isNaN())return aQ;t=t.replace(QZ,s.toString())}for(;t.includes(`+`)||/.-\d+(?:\.\d+)?/.test(t);){var[,c,l,u]=$Z.exec(t)??[],d=sQ.parse(c??``),f=sQ.parse(u??``),p=l===`+`?d.add(f):d.subtract(f);if(p.isNaN())return aQ;t=t.replace($Z,p.toString())}return t}var lQ=/\(([^()]*)\)/;function uQ(e){for(var t=e,n;(n=lQ.exec(t))!=null;){var[,r]=n;t=t.replace(lQ,cQ(r))}return t}function dQ(e){var t=e.replace(/\s+/g,``);return t=uQ(t),t=cQ(t),t}function fQ(e){try{return dQ(e)}catch{return aQ}}function pQ(e){var t=fQ(e.slice(5,-1));return t===aQ?``:t}var mQ=[`x`,`y`,`lineHeight`,`capHeight`,`fill`,`scaleToFit`,`textAnchor`,`verticalAnchor`],hQ=[`dx`,`dy`,`angle`,`className`,`breakAll`];function gQ(){return gQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gQ.apply(null,arguments)}function _Q(e,t){if(e==null)return{};var n,r,i=vQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function vQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var yQ=/[ \f\n\r\t\v\u2028\u2029]+/,bQ=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];return eO(t)||(i=n?t.toString().split(``):t.toString().split(yQ)),{wordsWithComputedWidth:i.map(e=>({word:e,width:qZ(e,r).width})),spaceWidth:n?0:qZ(`\xA0`,r).width}}catch{return null}};function xQ(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function SQ(e){return eO(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var CQ=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+n<Number(t)))s.words.push(a),s.width+=o+n;else{var c={words:[a],width:o};e.push(c)}return e},[]),wQ=e=>e.reduce((e,t)=>e.width>t.width?e:t),TQ=`…`,EQ=(e,t,n,r,i,a,o,s)=>{var c=bQ({breakAll:n,style:r,children:e.slice(0,t)+TQ});if(!c)return[!1,[]];var l=CQ(c.wordsWithComputedWidth,a,o,s);return[l.length>i||wQ(l).width>Number(a),l]},DQ=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:s,breakAll:c}=e,l=Z(a),u=String(o),d=CQ(t,r,n,i);if(!l||i||!(d.length>a||wQ(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),[_,v]=EQ(u,g-1,c,s,a,r,n,i),[y]=EQ(u,g,c,s,a,r,n,i);if(!_&&!y&&(f=g+1),_&&y&&(p=g-1),!_&&y){h=v;break}m++}return h||d},OQ=e=>[{words:eO(e)?[]:e.toString().split(yQ),width:void 0}],kQ=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!LI.isSsr){var s,c,l=bQ({breakAll:a,children:r,style:i});if(l){var{wordsWithComputedWidth:u,spaceWidth:d}=l;s=u,c=d}else return OQ(r);return DQ({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return OQ(r)},AQ=`#808080`,jQ={angle:0,breakAll:!1,capHeight:`0.71em`,fill:AQ,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},MQ=(0,v.forwardRef)((e,t)=>{var n=OO(e,jQ),{x:r,y:i,lineHeight:a,capHeight:o,fill:s,scaleToFit:c,textAnchor:l,verticalAnchor:u}=n,d=_Q(n,mQ),f=(0,v.useMemo)(()=>kQ({breakAll:d.breakAll,children:d.children,maxLines:d.maxLines,scaleToFit:c,style:d.style,width:d.width}),[d.breakAll,d.children,d.maxLines,c,d.style,d.width]),{dx:p,dy:m,angle:h,className:g,breakAll:_}=d,y=_Q(d,hQ);if(!qD(r)||!qD(i)||f.length===0)return null;var b=Number(r)+(Z(p)?p:0),x=Number(i)+(Z(m)?m:0);if(!bN(b)||!bN(x))return null;var S;switch(u){case`start`:S=pQ(`calc(${o})`);break;case`middle`:S=pQ(`calc(${(f.length-1)/2} * -${a} + (${o} / 2))`);break;default:S=pQ(`calc(${f.length-1} * -${a})`)}var C=[],w=f[0];if(c&&w!=null){var T=w.width,{width:E}=d;C.push(`scale(${Z(E)&&Z(T)?E/T:1})`)}return h&&C.push(`rotate(${h}, ${b}, ${x})`),C.length&&(y.transform=C.join(` `)),v.createElement(`text`,gQ({},JT(y),{ref:t,x:b,y:x,className:Yt(`recharts-text`,g),textAnchor:l,fill:s.includes(`url`)?AQ:s}),f.map((e,t)=>{var n=e.words.join(_?``:` `);return v.createElement(`tspan`,{x:b,dy:t===0?S:a,key:`${n}-${t}`},n)}))});MQ.displayName=`Text`;function NQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function PQ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?NQ(Object(n),!0).forEach(function(t){FQ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FQ(e,t,n){return(t=IQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IQ(e){var t=LQ(e,`string`);return typeof t==`symbol`?t:t+``}function LQ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var RQ=e=>{var{viewBox:t,position:n,offset:r=0,parentViewBox:i,clamp:a}=e,{x:o,y:s,height:c,upperWidth:l,lowerWidth:u}=HP(t),d=o,f=o+(l-u)/2,p=(d+f)/2,m=(l+u)/2,h=d+l/2,g=c>=0?1:-1,_=g*r,v=g>0?`end`:`start`,y=g>0?`start`:`end`,b=l>=0?1:-1,x=b*r,S=b>0?`end`:`start`,C=b>0?`start`:`end`,w=i;if(n===`top`){var T={x:d+l/2,y:s-_,horizontalAnchor:`middle`,verticalAnchor:v};return a&&w&&(T.height=Math.max(s-w.y,0),T.width=l),T}if(n===`bottom`){var E={x:f+u/2,y:s+c+_,horizontalAnchor:`middle`,verticalAnchor:y};return a&&w&&(E.height=Math.max(w.y+w.height-(s+c),0),E.width=u),E}if(n===`left`){var D={x:p-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`};return a&&w&&(D.width=Math.max(D.x-w.x,0),D.height=c),D}if(n===`right`){var O={x:p+m+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`};return a&&w&&(O.width=Math.max(w.x+w.width-O.x,0),O.height=c),O}var k=a&&w?{width:m,height:c}:{};return n===`insideLeft`?PQ({x:p+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`},k):n===`insideRight`?PQ({x:p+m-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`},k):n===`insideTop`?PQ({x:d+l/2,y:s+_,horizontalAnchor:`middle`,verticalAnchor:y},k):n===`insideBottom`?PQ({x:f+u/2,y:s+c-_,horizontalAnchor:`middle`,verticalAnchor:v},k):n===`insideTopLeft`?PQ({x:d+x,y:s+_,horizontalAnchor:C,verticalAnchor:y},k):n===`insideTopRight`?PQ({x:d+l-x,y:s+_,horizontalAnchor:S,verticalAnchor:y},k):n===`insideBottomLeft`?PQ({x:f+x,y:s+c-_,horizontalAnchor:C,verticalAnchor:v},k):n===`insideBottomRight`?PQ({x:f+u-x,y:s+c-_,horizontalAnchor:S,verticalAnchor:v},k):n&&typeof n==`object`&&(Z(n.x)||KD(n.x))&&(Z(n.y)||KD(n.y))?PQ({x:o+XD(n.x,m),y:s+XD(n.y,c),horizontalAnchor:`end`,verticalAnchor:`end`},k):PQ({x:h,y:s+c/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},k)},zQ=[`labelRef`],BQ=[`content`];function VQ(e,t){if(e==null)return{};var n,r,i=HQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function HQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function UQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function WQ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?UQ(Object(n),!0).forEach(function(t){GQ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function GQ(e,t,n){return(t=KQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KQ(e){var t=qQ(e,`string`);return typeof t==`symbol`?t:t+``}function qQ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function JQ(){return JQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},JQ.apply(null,arguments)}var YQ=(0,v.createContext)(null),XQ=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,c=(0,v.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return v.createElement(YQ.Provider,{value:c},s)},ZQ=()=>{var e=(0,v.useContext)(YQ),t=UP();return e||(t?HP(t):void 0)},QQ=(0,v.createContext)(null),$Q=()=>{var e=(0,v.useContext)(QQ),t=Q(aB);return e||t},e$=e=>{var{value:t,formatter:n}=e,r=eO(e.children)?t:e.children;return typeof n==`function`?n(r):r},t$=e=>e!=null&&typeof e==`function`,n$=(e,t)=>WD(t-e)*Math.min(Math.abs(t-e),360),r$=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:s,cy:c,innerRadius:l,outerRadius:u,startAngle:d,endAngle:f,clockWise:p}=i,m=(l+u)/2,h=n$(d,f),g=h>=0?1:-1,_,y;switch(t){case`insideStart`:_=d+g*a,y=p;break;case`insideEnd`:_=f-g*a,y=!p;break;case`end`:_=f+g*a,y=p;break;default:throw Error(`Unsupported position ${t}`)}y=h<=0?y:!y;var b=RR(s,c,m,_),x=RR(s,c,m,_+(y?1:-1)*359),S=`M${b.x},${b.y}
160
162
  A${m},${m},0,1,${+!y},
161
- ${x.x},${x.y}`,C=UD(e.id)?RD(`recharts-radial-line-`):e.id;return v.createElement(`text`,LQ({},r,{dominantBaseline:`central`,className:Yt(`recharts-radial-bar-label`,o)}),v.createElement(`defs`,null,v.createElement(`path`,{id:C,d:S})),v.createElement(`textPath`,{xlinkHref:`#${C}`},n))},qQ=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:c}=e,l=(s+c)/2;if(n===`outside`){var{x:u,y:d}=DR(r,i,o+t,l);return{x:u,y:d,textAnchor:u>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var{x:f,y:p}=DR(r,i,(a+o)/2,l);return{x:f,y:p,textAnchor:`middle`,verticalAnchor:`middle`}},JQ=e=>e!=null&&`cx`in e&&Z(e.cx),YQ={angle:0,offset:5,zIndex:Oz.label,position:`middle`,textBreakAll:!1};function XQ(e){if(!JQ(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function ZQ(e){var t=_O(e,YQ),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:s,className:c=``,textBreakAll:l,labelRef:u}=t,d=HQ(),f=BQ(),p=n==null?i===`center`?f:d??f:JQ(n)?n:jP(n),m,h,g=XQ(p);if(!p||UD(a)&&UD(o)&&!(0,v.isValidElement)(s)&&typeof s!=`function`)return null;var _=NQ(NQ({},t),{},{viewBox:p});if((0,v.isValidElement)(s)){var{labelRef:y}=_,b=AQ(_,OQ);return(0,v.cloneElement)(s,b)}if(typeof s==`function`){var{content:x}=_,S=AQ(_,kQ);if(m=(0,v.createElement)(s,S),(0,v.isValidElement)(m))return m}else m=UQ(t);var C=LT(t);if(JQ(p)){if(i===`insideStart`||i===`insideEnd`||i===`end`)return KQ(t,i,m,C,p);h=qQ(p,t.offset,t.position)}else{if(!g)return null;var w=DQ({viewBox:g,position:i,offset:t.offset,parentViewBox:JQ(r)?void 0:r,clamp:!0});h=NQ(NQ({x:w.x,y:w.y,textAnchor:w.horizontalAnchor,verticalAnchor:w.verticalAnchor},w.width===void 0?{}:{width:w.width}),w.height===void 0?{}:{height:w.height})}return v.createElement(EX,{zIndex:t.zIndex},v.createElement(xQ,LQ({ref:u,className:Yt(`recharts-label`,c)},C,h,{textAnchor:uQ(C.textAnchor)?C.textAnchor:h.textAnchor,breakAll:l}),m))}ZQ.displayName=`Label`;var QQ=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?v.createElement(ZQ,LQ({key:`label-implicit`},r)):ID(e)?v.createElement(ZQ,LQ({key:`label-implicit`,value:e},r)):(0,v.isValidElement)(e)?e.type===ZQ?(0,v.cloneElement)(e,NQ({key:`label-implicit`},r)):v.createElement(ZQ,LQ({key:`label-implicit`,content:e},r)):WQ(e)?v.createElement(ZQ,LQ({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?v.createElement(ZQ,LQ({},e,{key:`label-implicit`},r)):null};function $Q(e){var{label:t,labelRef:n}=e;return QQ(t,BQ(),n)||null}var e$=[`valueAccessor`],t$=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function n$(){return n$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n$.apply(null,arguments)}function r$(e,t){if(e==null)return{};var n,r,i=i$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function i$(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var a$=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(dQ(t))return t},o$=(0,v.createContext)(void 0),s$=o$.Provider,c$=(0,v.createContext)(void 0);c$.Provider;function l$(){return(0,v.useContext)(o$)}function u$(){return(0,v.useContext)(c$)}function d$(e){var{valueAccessor:t=a$}=e,n=r$(e,e$),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,c=r$(n,t$),l=l$(),u=u$(),d=l||u;return!d||!d.length?null:v.createElement(EX,{zIndex:s??Oz.label},v.createElement(qT,{className:`recharts-label-list`},d.map((e,i)=>{var s=UD(r)?t(e,i):gN(e.payload,r),l=UD(a)?{}:{id:`${a}-${i}`};return v.createElement(ZQ,n$({key:`label-${i}`},LT(e),c,l,{fill:n.fill??e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))})))}d$.displayName=`LabelList`;function f$(e){var{label:t}=e;return t?t===!0?v.createElement(d$,{key:`labelList-implicit`}):v.isValidElement(t)||WQ(t)?v.createElement(d$,{key:`labelList-implicit`,content:t}):typeof t==`object`?v.createElement(d$,n$({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}var p$=mM({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=RF(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=RF(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:m$,removeRadiusAxis:h$,addAngleAxis:g$,removeAngleAxis:_$}=p$.actions,v$=p$.reducer;function y$(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}var b$=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),x$=o(((e,t)=>{t.exports=b$()}))(),S$=e=>typeof e==`string`?e:e?e.displayName||e.name||`Component`:``,C$=null,w$=null,T$=e=>{if(e===C$&&Array.isArray(w$))return w$;var t=[];return v.Children.forEach(e,e=>{UD(e)||((0,x$.isFragment)(e)?t=t.concat(T$(e.props.children)):t.push(e))}),w$=t,C$=e,t};function E$(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(e=>S$(e)):[S$(t)],T$(e).forEach(e=>{var t=OD(e,`type.displayName`)||OD(e,`type.name`);t&&r.indexOf(t)!==-1&&n.push(e)}),n}function D$(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var O$,k$,A$,j$,M$;function N$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?N$(Object(n),!0).forEach(function(t){F$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F$(e,t,n){return(t=I$(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I$(e){var t=L$(e,`string`);return typeof t==`symbol`?t:t+``}function L$(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function R$(){return R$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},R$.apply(null,arguments)}function z$(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var B$=(e,t,n,r,i)=>{var a=n-r,o=MD(O$||=z$([`M `,`,`,``]),e,t);return o+=MD(k$||=z$([`L `,`,`,``]),e+n,t),o+=MD(A$||=z$([`L `,`,`,``]),e+n-a/2,t+i),o+=MD(j$||=z$([`L `,`,`,``]),e+n-a/2-r,t+i),o+=MD(M$||=z$([`L `,`,`,` Z`]),e,t),o},V$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},H$=e=>{var t=_O(e,V$),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:c,animationDuration:l,animationBegin:u,isUpdateAnimationActive:d}=t,f=(0,v.useRef)(null),[p,m]=(0,v.useState)(-1),h=(0,v.useRef)(i),g=(0,v.useRef)(a),_=(0,v.useRef)(o),y=(0,v.useRef)(n),b=(0,v.useRef)(r),x=YL(e,`trapezoid-`);if((0,v.useEffect)(()=>{if(f.current&&f.current.getTotalLength)try{var e=f.current.getTotalLength();e&&m(e)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var S=Yt(`recharts-trapezoid`,s);if(!d)return v.createElement(`g`,null,v.createElement(`path`,R$({},LT(t),{className:S,d:B$(n,r,i,a,o)})));var C=h.current,w=g.current,T=_.current,E=y.current,D=b.current,O=`0px ${p===-1?1:p}px`,k=`${p}px ${p}px`,A=gL([`strokeDasharray`],l,c);return v.createElement(JL,{animationId:x,key:x,canBegin:p>0,duration:l,easing:c,isActive:d,begin:u},e=>{var s=VD(C,i,e),c=VD(w,a,e),l=VD(T,o,e),u=VD(E,n,e),d=VD(D,r,e);f.current&&(h.current=s,g.current=c,_.current=l,y.current=u,b.current=d);var p=e>0?{transition:A,strokeDasharray:k}:{strokeDasharray:O};return v.createElement(`path`,R$({},LT(t),{className:S,d:B$(u,d,s,c,l),ref:f,style:P$(P$({},p),t.style)}))})},U$=[`option`,`shapeType`,`activeClassName`,`inActiveClassName`];function W$(e,t){if(e==null)return{};var n,r,i=G$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function G$(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function K$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?K$(Object(n),!0).forEach(function(t){J$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function J$(e,t,n){return(t=Y$(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y$(e){var t=X$(e,`string`);return typeof t==`symbol`?t:t+``}function X$(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Z$(e,t){return q$(q$({},t),e)}function Q$(e,t){return e===`symbols`}function $$(e){var{shapeType:t,elementProps:n}=e;switch(t){case`rectangle`:return v.createElement(yR,n);case`trapezoid`:return v.createElement(H$,n);case`sector`:return v.createElement(YR,n);case`symbols`:if(Q$(t,n))return v.createElement(sO,n);break;case`curve`:return v.createElement(ZI,n);default:return null}}function e1(e){return(0,v.isValidElement)(e)?e.props:e}function t1(e){var{option:t,shapeType:n,activeClassName:r=`recharts-active-shape`,inActiveClassName:i=`recharts-shape`}=e,a=W$(e,U$),o;if((0,v.isValidElement)(t))o=(0,v.cloneElement)(t,q$(q$({},a),e1(t)));else if(typeof t==`function`)o=t(a,a.index);else if(D$(t)&&typeof t!=`boolean`){var s=Z$(t,a);o=v.createElement($$,{shapeType:n,elementProps:s})}else{var c=a;o=v.createElement($$,{shapeType:n,elementProps:c})}return a.isActive?v.createElement(qT,{className:r},o):v.createElement(qT,{className:i},o)}var n1=(e,t,n)=>{var r=jk();return(i,a)=>o=>{e?.(i,a,o),r(yJ({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},r1=e=>{var t=jk();return(n,r)=>i=>{e?.(n,r,i),t(bJ())}},i1=(e,t,n)=>{var r=jk();return(i,a)=>o=>{e?.(i,a,o),r(SJ({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function a1(e){var{tooltipEntrySettings:t}=e,n=jk(),r=iP(),i=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{r||(i.current===null?n(hJ(t)):i.current!==t&&n(gJ({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,v.useLayoutEffect)(()=>()=>{i.current&&=(n(_J(i.current)),null)},[n]),null}function o1(e){var{legendPayload:t}=e,n=jk(),r=iP(),i=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{r||(i.current===null?n(HF(t)):i.current!==t&&n(UF({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,v.useLayoutEffect)(()=>()=>{i.current&&=(n(WF(i.current)),null)},[n]),null}var s1=v.useId??(()=>{var[e]=v.useState(()=>RD(`uid-`));return e});function c1(e,t){var n=s1();return t||(e?`${e}-${n}`:n)}var l1=(0,v.createContext)(void 0),u1=e=>{var{id:t,type:n,children:r}=e,i=c1(`recharts-${n}`,t);return v.createElement(l1.Provider,{value:i},r(i))},d1=mM({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(RF(t.payload))},prepare:$j()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=zj(e).cartesianItems.indexOf(RF(n));i>-1&&(e.cartesianItems[i]=RF(r))},prepare:$j()},removeCartesianGraphicalItem:{reducer(e,t){var n=zj(e).cartesianItems.indexOf(RF(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:$j()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(RF(t.payload))},prepare:$j()},removePolarGraphicalItem:{reducer(e,t){var n=zj(e).polarItems.indexOf(RF(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:$j()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=zj(e).polarItems.indexOf(RF(n));i>-1&&(e.polarItems[i]=RF(r))},prepare:$j()}}}),{addCartesianGraphicalItem:f1,replaceCartesianGraphicalItem:p1,removeCartesianGraphicalItem:m1,addPolarGraphicalItem:h1,removePolarGraphicalItem:g1,replacePolarGraphicalItem:_1}=d1.actions,v1=d1.reducer,y1=(0,v.memo)(e=>{var t=jk(),n=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{n.current===null?t(f1(e)):n.current!==e&&t(p1({prev:n.current,next:e})),n.current=e},[t,e]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(m1(n.current)),null)},[t]),null});function b1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?b1(Object(n),!0).forEach(function(t){S1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function S1(e,t,n){return(t=C1(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C1(e){var t=w1(e,`string`);return typeof t==`symbol`?t:t+``}function w1(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var T1=mM({name:`cartesianAxis`,initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=RF(t.payload)},prepare:$j()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.xAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=RF(r))},prepare:$j()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:$j()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=RF(t.payload)},prepare:$j()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.yAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=RF(r))},prepare:$j()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:$j()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=RF(t.payload)},prepare:$j()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.zAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=RF(r))},prepare:$j()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:$j()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(a.length===3&&a[0]===a[2]&&r===a[1]&&r!==i.width&&Math.abs(r-(a[0]??0))<=1)return;var o=[...a,r].slice(-3);e.yAxis[n]=x1(x1({},i),{},{width:r,widthHistory:o})}}}}),{addXAxis:E1,replaceXAxis:D1,removeXAxis:O1,addYAxis:k1,replaceYAxis:A1,removeYAxis:j1,addZAxis:M1,replaceZAxis:N1,removeZAxis:P1,updateYAxisWidth:F1}=T1.actions,I1=T1.reducer,L1=$([$([eP],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),LN,RN],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),R1=()=>Q(L1),z1=(e,t,n)=>{var r=n??e;if(!UD(r))return zD(r,t,0)},B1=(e,t,n)=>{var r={},i=e.filter($z),a=e.filter(e=>e.stackId==null),o=i.reduce((e,t)=>{var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},r),s=Object.entries(o).map(e=>{var[r,i]=e;return{stackId:r,dataKeys:i.map(e=>e.dataKey),barSize:z1(t,n,i[0]?.barSize)}}),c=a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>e!=null),barSize:z1(t,n,e.barSize)}));return[...s,...c]};function V1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?V1(Object(n),!0).forEach(function(t){U1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function U1(e,t,n){return(t=W1(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W1(e){var t=G1(e,`string`);return typeof t==`symbol`?t:t+``}function G1(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function K1(e,t,n,r,i){var a=r.length;if(!(a<1)){var o=zD(e,n,0,!0),s,c=[];if(lN(r[0]?.barSize)){var l=!1,u=n/a,d=r.reduce((e,t)=>e+(t.barSize||0),0);d+=(a-1)*o,d>=n&&(d-=(a-1)*o,o=0),d>=n&&u>0&&(l=!0,u*=.9,d=a*u);var f={offset:((n-d)/2>>0)-o,size:0};s=r.reduce((e,t)=>{var n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f.offset+f.size+o,size:l?u:t.barSize??0}},r=[...e,n];return f=n.position,r},c)}else{var p=zD(t,n,0,!0);n-2*p-(a-1)*o<=0&&(o=0);var m=(n-2*p-(a-1)*o)/a;m>1&&(m>>=0);var h=lN(i)?Math.min(m,i):m;s=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+(m+o)*n+(m-h)/2,size:h}}],c)}return s}}var q1=(e,t,n,r,i,a,o)=>{var s=UD(o)?t:o,c=K1(n,r,i===a?a:i,e,s);return i!==a&&c!=null&&(c=c.map(e=>H1(H1({},e),{},{position:H1(H1({},e.position),{},{offset:e.position.offset-i/2})}))),c},J1=(e,t)=>{var n=Zz(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:a}=i;if(a)return a.find(e=>e.key===n)}}}},Y1=(e,t)=>{if(e!=null&&t!=null){var n=e.find(e=>e.stackId===t.stackId&&t.dataKey!=null&&e.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function X1(e,t){return e&&typeof e==`object`&&`zIndex`in e&&typeof e.zIndex==`number`&&lN(e.zIndex)?e.zIndex:t}var Z1=e=>{var{chartData:t}=e,n=jk(),r=iP();return(0,v.useEffect)(()=>r?()=>{}:(n(JX(t)),()=>{n(JX(void 0))}),[t,n,r]),null},Q1={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},$1=mM({name:`brush`,initialState:Q1,reducers:{setBrushSettings(e,t){return t.payload==null?Q1:t.payload}}}),{setBrushSettings:e0}=$1.actions,t0=$1.reducer;function n0(e){return(e%180+180)%180}var r0=function(e){var{width:t,height:n}=e,r=n0(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r<Math.PI-i?n/Math.sin(r):t/Math.cos(r);return Math.abs(a)},i0=mM({name:`referenceElements`,initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=zj(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=zj(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(RF(t.payload))},removeLine:(e,t)=>{var n=zj(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:a0,removeDot:o0,addArea:s0,removeArea:c0,addLine:l0,removeLine:u0}=i0.actions,d0=i0.reducer,f0=(0,v.createContext)(void 0),p0=e=>{var{children:t}=e,[n]=(0,v.useState)(`${RD(`recharts`)}-clip`),r=R1();if(r==null)return null;var{x:i,y:a,width:o,height:s}=r;return v.createElement(f0.Provider,{value:n},v.createElement(`defs`,null,v.createElement(`clipPath`,{id:n},v.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)};function m0(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];i!==void 0&&n.push(i)}return n}function h0(e,t,n){return r0({width:e.width+t.width,height:e.height+t.height},n)}function g0(e,t,n){var r=n===`width`,{x:i,y:a,width:o,height:s}=e;return t===1?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}function _0(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function v0(e,t){return m0(e,t+1)}function y0(e,t,n,r,i){for(var a=(r||[]).slice(),{start:o,end:s}=t,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:m0(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||_0(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function b0(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var{start:o,end:s}=t,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||_0(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m<a&&(p=f(),p===0||p!==1);m+=c);if(d){for(var h=[],g=l;g<a;g+=c){var _=r[g];_!=null&&h.push(_)}return h}}return[]}function x0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function S0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?x0(Object(n),!0).forEach(function(t){C0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C0(e,t,n){return(t=w0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w0(e){var t=T0(e,`string`);return typeof t==`symbol`?t:t+``}function T0(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function E0(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:c}=t,l=function(t){var r=a[t];if(r==null)return 1;var l=r,u,d=()=>(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=S0(S0({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=S0(S0({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&_0(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=S0(S0({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function D0(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:c,end:l}=t;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=S0(S0({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&_0(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=S0(S0({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=S0(S0({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=S0(S0({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&_0(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=S0(S0({},a),{},{isShow:!0}))},h=0;h<p;h++)if(m(h))continue;return o}function O0(e,t,n){var{tick:r,ticks:i,viewBox:a,minTickGap:o,orientation:s,interval:c,tickFormatter:l,unit:u,angle:d}=e;if(!i||!i.length||!r)return[];if(Z(c)||EI.isSsr)return v0(i,Z(c)?c:0)??[];var f=[],p=s===`top`||s===`bottom`?`width`:`height`,m=u&&p===`width`?IZ(u,{fontSize:t,letterSpacing:n}):{width:0,height:0},h=(e,r)=>{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?h0(IZ(i,{fontSize:t,letterSpacing:n}),m,d):IZ(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?ND(_.coordinate-g.coordinate):1,y=g0(a,v,p);return c===`equidistantPreserveStart`?y0(v,y,h,i,o):c===`equidistantPreserveEnd`?b0(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?D0(v,y,h,i,o,c===`preserveStartEnd`):E0(v,y,h,i,o),f.filter(e=>e.isShow))}var k0=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0,c=i+a,l=o+c+s+(n?r:0);return Math.round(l)}return 0},A0=mM({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:i}=t.payload;e[n][r]=RF(i)},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:j0,removeRenderedTicks:M0}=A0.actions,N0=A0.reducer,P0=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function F0(e,t){if(e==null)return{};var n,r,i=I0(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function I0(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function L0(){return L0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L0.apply(null,arguments)}function R0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function z0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?R0(Object(n),!0).forEach(function(t){B0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function B0(e,t,n){return(t=V0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V0(e){var t=H0(e,`string`);return typeof t==`symbol`?t:t+``}function H0(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var U0={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`,zIndex:Oz.axis};function W0(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:c}=e;if(!s)return null;var l=z0(z0(z0({},c),FT(s)),{},{fill:`none`});if(a===`top`||a===`bottom`){var u=+(a===`top`&&!o||a===`bottom`&&o);l=z0(z0({},l),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+(a===`left`&&!o||a===`right`&&o);l=z0(z0({},l),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return v.createElement(`line`,L0({},l,{className:Yt(`recharts-cartesian-axis-line`,OD(s,`className`))}))}function G0(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h=s?-1:1,g=e.tickSize||o,_=Z(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case`top`:l=u=e.coordinate,f=n+ +!s*i,d=f-h*g,m=d-h*c,p=_;break;case`left`:d=f=e.coordinate,u=t+ +!s*r,l=u-h*g,p=l-h*c,m=_;break;case`right`:d=f=e.coordinate,u=t+ +s*r,l=u+h*g,p=l+h*c,m=_;break;default:l=u=e.coordinate,f=n+ +s*i,d=f+h*g,m=d+h*c,p=_}return{line:{x1:l,y1:d,x2:u,y2:f},tick:{x:p,y:m}}}function K0(e,t){switch(e){case`left`:return t?`start`:`end`;case`right`:return t?`end`:`start`;default:return`middle`}}function q0(e,t){switch(e){case`left`:case`right`:return`middle`;case`top`:return t?`start`:`end`;default:return t?`end`:`start`}}function J0(e){var{option:t,tickProps:n,value:r}=e,i,a=Yt(n.className,`recharts-cartesian-axis-tick-value`);if(v.isValidElement(t))i=v.cloneElement(t,z0(z0({},n),{},{className:a}));else if(typeof t==`function`)i=t(z0(z0({},n),{},{className:a}));else{var o=`recharts-cartesian-axis-tick-value`;typeof t!=`boolean`&&(o=Yt(o,y$(t))),i=v.createElement(xQ,L0({},n,{className:o}),r)}return i}function Y0(e){var{ticks:t,axisType:n,axisId:r}=e,i=jk();return(0,v.useEffect)(()=>r==null||n==null?KD:(i(j0({ticks:t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),axisId:r,axisType:n})),()=>{i(M0({axisId:r,axisType:n}))}),[i,t,r,n]),null}var X0=(0,v.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:c,tickTextProps:l,orientation:u,mirror:d,x:f,y:p,width:m,height:h,tickSize:g,tickMargin:_,fontSize:y,letterSpacing:b,getTicksConfig:x,events:S,axisType:C,axisId:w}=e,T=O0(z0(z0({},x),{},{ticks:n}),y,b),E=FT(x),D=IT(r),O=uQ(E.textAnchor)?E.textAnchor:K0(u,d),k=q0(u,d),A={};typeof i==`object`&&(A=i);var j=z0(z0({},E),{},{fill:`none`},A),M=T.map(e=>z0({entry:e},G0(e,f,p,m,h,u,g,d,_))),N=M.map(e=>{var{entry:t,line:n}=e;return v.createElement(qT,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},i&&v.createElement(`line`,L0({},j,n,{className:Yt(`recharts-cartesian-axis-tick-line`,OD(i,`className`))})))}),P=M.map((e,t)=>{var{entry:n,tick:i}=e,u=z0(z0({},z0(z0(z0(z0({verticalAnchor:k},E),{},{textAnchor:O,stroke:`none`,fill:a},i),{},{index:t,payload:n,visibleTicksCount:T.length,tickFormatter:o,padding:c},l),{},{angle:l?.angle??E.angle??0})),D);return v.createElement(qT,L0({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},dO(S,n,t)),r&&v.createElement(J0,{option:r,tickProps:u,value:`${typeof o==`function`?o(n.value,t):n.value}${s||``}`}))});return v.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${C}-ticks`},v.createElement(Y0,{ticks:T,axisId:w,axisType:C}),P.length>0&&v.createElement(EX,{zIndex:Oz.label},v.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${C}-tick-labels`,ref:t},P)),N.length>0&&v.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${C}-tick-lines`},N))}),Z0=(0,v.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:c,axisId:l}=e,u=F0(e,P0),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),h=(0,v.useRef)(null);(0,v.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>k0({ticks:h.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var g=(0,v.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);h.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==d||a!==p)&&(f(i),m(a))}}},[d,p]);return o||r!=null&&r<=0||i!=null&&i<=0?null:v.createElement(EX,{zIndex:e.zIndex},v.createElement(qT,{className:Yt(`recharts-cartesian-axis`,a)},v.createElement(W0,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:FT(e)}),v.createElement(X0,{ref:g,axisType:c,events:u,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:l}),v.createElement(zQ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},v.createElement($Q,{label:e.label,labelRef:e.labelRef}),e.children)))}),Q0=v.forwardRef((e,t)=>{var n=_O(e,U0);return v.createElement(Z0,L0({},n,{ref:t}))});Q0.displayName=`CartesianAxis`;var $0=[`x1`,`y1`,`x2`,`y2`,`key`],e2=[`offset`],t2=[`xAxisId`,`yAxisId`],n2=[`xAxisId`,`yAxisId`];function r2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?r2(Object(n),!0).forEach(function(t){a2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a2(e,t,n){return(t=o2(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o2(e){var t=s2(e,`string`);return typeof t==`symbol`?t:t+``}function s2(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function c2(){return c2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c2.apply(null,arguments)}function l2(e,t){if(e==null)return{};var n,r,i=u2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function u2(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var d2=e=>{var{fill:t}=e;if(!t||t===`none`)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return v.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function f2(e){var{option:t,lineItemProps:n}=e,r;if(v.isValidElement(t))r=v.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var{x1:i,y1:a,x2:o,y2:s,key:c}=n,l=FT(l2(n,$0))??{},{offset:u}=l,d=l2(l,e2);r=v.createElement(`line`,c2({},d,{x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function p2(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=l2(e,t2),c=i.map((e,i)=>{var a=i2(i2({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${i}`,index:i});return v.createElement(f2,{key:`line-${i}`,option:r,lineItemProps:a})});return v.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},c)}function m2(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=l2(e,n2),c=i.map((e,i)=>{var a=i2(i2({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${i}`,index:i});return v.createElement(f2,{option:r,lineItemProps:a,key:`line-${i}`})});return v.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},c)}function h2(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:c=!0}=e;if(!c||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return v.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return v.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function g2(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:c}=e;if(!t||!n||!n.length)return null;var l=c.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,t)=>{var c=l[t+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=t%n.length;return v.createElement(`rect`,{key:`react-${t}`,x:e,y:a,width:u,height:s,stroke:`none`,fill:n[d],fillOpacity:r,className:`recharts-cartesian-grid-bg`})});return v.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},u)}var _2=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return yN(O0(i2(i2(i2({},U0),n),{},{ticks:bN(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},v2=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return yN(O0(i2(i2(i2({},U0),n),{},{ticks:bN(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},y2={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:`#ccc`,fill:`none`,verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Oz.grid};function b2(e){var t=FP(),n=IP(),r=PP(),i=i2(i2({},_O(e,y2)),{},{x:Z(e.x)?e.x:r.left,y:Z(e.y)?e.y:r.top,width:Z(e.width)?e.width:r.width,height:Z(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:c,width:l,height:u,syncWithTicks:d,horizontalValues:f,verticalValues:p}=i,m=iP(),h=Q(e=>tJ(e,`xAxis`,a,m)),g=Q(e=>tJ(e,`yAxis`,o,m));if(!uN(l)||!uN(u)||!Z(s)||!Z(c))return null;var _=i.verticalCoordinatesGenerator||_2,y=i.horizontalCoordinatesGenerator||v2,{horizontalPoints:b,verticalPoints:x}=i;if((!b||!b.length)&&typeof y==`function`){var S=f&&f.length,C=y({yAxis:g?i2(i2({},g),{},{ticks:S?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},S?!0:d);uP(Array.isArray(C),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof C}]`),Array.isArray(C)&&(b=C)}if((!x||!x.length)&&typeof _==`function`){var w=p&&p.length,T=_({xAxis:h?i2(i2({},h),{},{ticks:w?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},w?!0:d);uP(Array.isArray(T),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof T}]`),Array.isArray(T)&&(x=T)}return v.createElement(EX,{zIndex:i.zIndex},v.createElement(`g`,{className:`recharts-cartesian-grid`},v.createElement(d2,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),v.createElement(h2,c2({},i,{horizontalPoints:b})),v.createElement(g2,c2({},i,{verticalPoints:x})),v.createElement(p2,c2({},i,{offset:r,horizontalPoints:b,xAxis:h,yAxis:g})),v.createElement(m2,c2({},i,{offset:r,verticalPoints:x,xAxis:h,yAxis:g}))))}b2.displayName=`CartesianGrid`;var x2=mM({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:S2,replaceErrorBar:C2,removeErrorBar:w2}=x2.actions,T2=x2.reducer,E2=[`children`];function D2(e,t){if(e==null)return{};var n,r,i=O2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function O2(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var k2=(0,v.createContext)({data:[],xAxisId:`xAxis-0`,yAxisId:`yAxis-0`,dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function A2(e){var{children:t}=e,n=D2(e,E2);return v.createElement(k2.Provider,{value:n},t)}function j2(e,t){var n=Q(t=>iK(t,e)),r=Q(e=>sK(e,t)),i=n?.allowDataOverflow??nK.allowDataOverflow,a=r?.allowDataOverflow??aK.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function M2(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=R1(),{needClipX:a,needClipY:o,needClip:s}=j2(t,n);if(!s||!i)return null;var{x:c,y:l,width:u,height:d}=i;return v.createElement(`clipPath`,{id:`clipPath-${r}`},v.createElement(`rect`,{x:a?c:c-u/2,y:o?l:l-d/2,width:a?u:u*2,height:o?d:d*2}))}function N2(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function P2(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var F2=`Invariant failed`;function I2(e,t){if(!e)throw Error(F2)}function L2(){return L2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L2.apply(null,arguments)}function R2(e){return v.createElement(t1,L2({shapeType:`rectangle`,activeClassName:`recharts-active-bar`,inActiveClassName:`recharts-inactive-bar`},e))}var z2=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(Z(e))return e;var i=Z(n)||UD(n);return i?e(n,r):(!i&&I2(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},B2=(e,t,n)=>n,V2=$([hK,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),H2=$([V2],e=>e?.maxBarSize),U2=(e,t,n,r)=>r,W2=$([LP,hK,N2,P2,B2],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),G2=(e,t,n)=>{var r=LP(e),i=N2(e,t),a=P2(e,t);if(i!=null&&a!=null)return r===`horizontal`?zK(e,`yAxis`,a,n):zK(e,`xAxis`,i,n)},K2=$([W2,xz,(e,t)=>{var n=LP(e),r=N2(e,t),i=P2(e,t);if(r!=null&&i!=null)return n===`horizontal`?Qq(e,`xAxis`,r):Qq(e,`yAxis`,i)}],B1),q2=(e,t,n)=>{var r=V2(e,t);if(r==null)return 0;var i=N2(e,t),a=P2(e,t);if(i==null||a==null)return 0;var o=LP(e),s=vz(e),{maxBarSize:c}=r,l=UD(c)?s:c,u,d;return o===`horizontal`?(u=iJ(e,`xAxis`,i,n),d=rJ(e,`xAxis`,i,n)):(u=iJ(e,`yAxis`,a,n),d=rJ(e,`yAxis`,a,n)),MN(u,d,!0)??l??0},J2=(e,t,n)=>{var r=LP(e),i=N2(e,t),a=P2(e,t);if(i!=null&&a!=null){var o,s;return r===`horizontal`?(o=iJ(e,`xAxis`,i,n),s=rJ(e,`xAxis`,i,n)):(o=iJ(e,`yAxis`,a,n),s=rJ(e,`yAxis`,a,n)),MN(o,s)}},Y2=$([eP,nP,(e,t,n)=>{var r=N2(e,t);if(r!=null)return iJ(e,`xAxis`,r,n)},(e,t,n)=>{var r=P2(e,t);if(r!=null)return iJ(e,`yAxis`,r,n)},(e,t,n)=>{var r=N2(e,t);if(r!=null)return rJ(e,`xAxis`,r,n)},(e,t,n)=>{var r=P2(e,t);if(r!=null)return rJ(e,`yAxis`,r,n)},$([$([K2,vz,yz,bz,q2,J2,H2],q1),V2],Y1),LP,rz,J2,$([G2,V2],J1),V2,U2],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var{chartData:p,dataStartIndex:m,dataEndIndex:h}=c;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var{data:g}=d,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return j4({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),X2=[`index`];function Z2(){return Z2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Z2.apply(null,arguments)}function Q2(e,t){if(e==null)return{};var n,r,i=$2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function $2(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var e4=(0,v.createContext)(void 0),t4=e=>{var t=(0,v.useContext)(e4);if(t!=null)return t.stackId;if(e!=null)return wN(e)},n4=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,r4=e=>{var t=(0,v.useContext)(e4);if(t!=null){var{stackId:n}=t;return`url(#${n4(n,e)})`}},i4=e=>{var{index:t}=e,n=Q2(e,X2),r=r4(t);return v.createElement(qT,Z2({className:`recharts-bar-stack-layer`,clipPath:r},n))},a4=[`onMouseEnter`,`onMouseLeave`,`onClick`],o4=[`value`,`background`,`tooltipPosition`],s4=[`id`],c4=[`onMouseEnter`,`onClick`,`onMouseLeave`];function l4(){return l4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l4.apply(null,arguments)}function u4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d4(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u4(Object(n),!0).forEach(function(t){f4(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f4(e,t,n){return(t=p4(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p4(e){var t=m4(e,`string`);return typeof t==`symbol`?t:t+``}function m4(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h4(e,t){if(e==null)return{};var n,r,i=g4(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g4(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var _4=e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:PN(n,t),payload:e}]},v4=v.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:a,hide:o,unit:s,tooltipType:c,id:l}=e,u={dataDefinedOnItem:void 0,getPosition:KD,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:PN(a,t),hide:o,type:c,color:i,unit:s,graphicalItemId:l}};return v.createElement(a1,{tooltipEntrySettings:u})});function y4(e){var t=Q(wY),{data:n,dataKey:r,background:i,allOtherBarProps:a}=e,{onMouseEnter:o,onMouseLeave:s,onClick:c}=a,l=h4(a,a4),u=n1(o,r,a.id),d=r1(s),f=i1(c,r,a.id);if(!i||n==null)return null;var p=IT(i);return v.createElement(EX,{zIndex:X1(i,Oz.barBackground)},n.map((e,n)=>{var{value:a,background:o,tooltipPosition:s}=e,c=h4(e,o4);if(!o)return null;var m=u(e,n),h=d(e,n),g=f(e,n),_=d4(d4(d4(d4(d4({option:i,isActive:String(n)===t},c),{},{fill:`#eee`},o),p),dO(l,e,n)),{},{onMouseEnter:m,onMouseLeave:h,onClick:g,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return v.createElement(R2,l4({key:`background-bar-${n}`},_))}))}function b4(e){var{showLabels:t,children:n,rects:r}=e,i=r?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return d4(d4({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return v.createElement(s$,{value:t?i:void 0},n)}function x4(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:a,dataKey:o}=e,s=Q(wY),c=Q(EY),l=n&&String(i.originalDataIndex)===s&&(c==null||o===c),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1);(0,v.useEffect)(()=>{var e;return l?(d(!0),e=requestAnimationFrame(()=>{p(!0)})):p(!1),()=>{cancelAnimationFrame(e)}},[l]);var m=(0,v.useCallback)(()=>{l||d(!1)},[l]),h=l&&f,g=l||u,_=l?n===!0?t:n:t,y=v.createElement(R2,l4({},r,{name:String(r.name)},i,{isActive:h,option:_,index:a,dataKey:o,onTransitionEnd:m}));return g?v.createElement(EX,{zIndex:Oz.activeBar},v.createElement(i4,{index:i.originalDataIndex},y)):y}function S4(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:a}=e;return v.createElement(R2,l4({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a}))}function C4(e){var{data:t,props:n}=e,r=FT(n)??{},{id:i}=r,a=h4(r,s4),{shape:o,dataKey:s,activeBar:c}=n,{onMouseEnter:l,onClick:u,onMouseLeave:d}=n,f=h4(n,c4),p=n1(l,s,i),m=r1(d),h=i1(u,s,i);return t?v.createElement(v.Fragment,null,t.map((e,t)=>v.createElement(i4,l4({index:e.originalDataIndex,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},dO(f,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:h(e,t)}),c?v.createElement(x4,{shape:o,activeBar:c,baseProps:a,entry:e,index:t,dataKey:s}):v.createElement(S4,{shape:o,baseProps:a,entry:e,index:t,dataKey:s})))):null}function w4(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,onAnimationEnd:l,onAnimationStart:u}=t,d=n.current,f=YL(t,`recharts-bar-`),[p,m]=(0,v.useState)(!1),h=!p,g=(0,v.useCallback)(()=>{typeof l==`function`&&l(),m(!1)},[l]),_=(0,v.useCallback)(()=>{typeof u==`function`&&u(),m(!0)},[u]);return v.createElement(b4,{showLabels:h,rects:r},v.createElement(JL,{animationId:f,begin:o,duration:s,isActive:a,easing:c,onAnimationEnd:g,onAnimationStart:_,key:f},e=>{var a=e===1?r:r?.map((t,n)=>{var r=d&&d[n];if(r)return d4(d4({},t),{},{x:VD(r.x,t.x,e),y:VD(r.y,t.y,e),width:VD(r.width,t.width,e),height:VD(r.height,t.height,e)});if(i===`horizontal`){var a=VD(0,t.height,e),o=VD(t.stackedBarStart,t.y,e);return d4(d4({},t),{},{y:o,height:a})}var s=VD(0,t.width,e),c=VD(t.stackedBarStart,t.x,e);return d4(d4({},t),{},{width:s,x:c})});return e>0&&(n.current=a??null),a==null?null:v.createElement(qT,null,v.createElement(C4,{props:t,data:a}))}),v.createElement(f$,{label:t.label}),t.children)}function T4(e){var t=(0,v.useRef)(null);return v.createElement(w4,{previousRectanglesRef:t,props:e})}var E4=0,D4=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:gN(e,t)}},O4=class extends v.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:i,yAxisId:a,needClip:o,background:s,id:c}=this.props;if(e||t==null)return null;var l=Yt(`recharts-bar`,r),u=c;return v.createElement(qT,{className:l,id:c},o&&v.createElement(`defs`,null,v.createElement(M2,{clipPathId:u,xAxisId:i,yAxisId:a})),v.createElement(qT,{className:`recharts-bar-rectangles`,clipPath:o?`url(#clipPath-${u})`:void 0},v.createElement(y4,{data:t,dataKey:n,background:s,allOtherBarProps:this.props}),v.createElement(T4,this.props)))}},k4={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:E4,xAxisId:0,yAxisId:0,zIndex:Oz.bar};function A4(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u}=e,{needClip:d}=j2(t,n),f=RP(),p=iP(),m=E$(e.children,bZ),h=Q(t=>Y2(t,e.id,p,m));if(f!==`vertical`&&f!==`horizontal`)return null;var g,_=h?.[0];return g=_==null||_.height==null||_.width==null?0:f===`vertical`?_.height/2:_.width/2,v.createElement(A2,{xAxisId:t,yAxisId:n,data:h,dataPointFormatter:D4,errorBarOffset:g},v.createElement(O4,l4({},e,{layout:f,needClip:d,data:h,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function j4(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:i},pos:a,bandSize:o,xAxis:s,yAxis:c,xAxisTicks:l,yAxisTicks:u,stackedData:d,displayedData:f,offset:p,cells:m,parentViewBox:h,dataStartIndex:g}=e,_=t===`horizontal`?c:s,v=d?_.scale.domain():null,y=EN({numericAxis:_}),b=_.scale.map(y);return f.map((e,f)=>{var _,x,S,C,w,T;if(d){var E=d[f+g];if(E==null)return null;_=xN(E,v)}else _=gN(e,n),Array.isArray(_)||(_=[y,_]);var D=z2(r,E4)(_[1],f);if(t===`horizontal`){var O=c.scale.map(_[0]),k=c.scale.map(_[1]);if(O==null||k==null)return null;x=TN({axis:s,ticks:l,bandSize:o,offset:a.offset,entry:e,index:f}),S=k??O??void 0,C=a.size;var A=O-k;if(w=PD(A)?0:A,T={x,y:p.top,width:C,height:p.height},Math.abs(D)>0&&Math.abs(w)<Math.abs(D)){var j=ND(w||D)*(Math.abs(D)-Math.abs(w));S-=j,w+=j}}else{var M=s.scale.map(_[0]),N=s.scale.map(_[1]);if(M==null||N==null)return null;if(x=M,S=TN({axis:c,ticks:u,bandSize:o,offset:a.offset,entry:e,index:f}),C=N-M,w=a.size,T={x:p.left,y:S,width:p.width,height:w},Math.abs(D)>0&&Math.abs(C)<Math.abs(D)){var P=ND(C||D)*(Math.abs(D)-Math.abs(C));C+=P}}return x==null||S==null||C==null||w==null||!i&&(C===0||w===0)?null:d4(d4({},e),{},{stackedBarStart:b,x,y:S,width:C,height:w,value:d?_:_[1],payload:e,background:T,tooltipPosition:{x:x+C/2,y:S+w/2},parentViewBox:h,originalDataIndex:f},m&&m[f]&&m[f].props)}).filter(Boolean)}function M4(e){var t=_O(e,k4),n=t4(t.stackId),r=iP();return v.createElement(u1,{id:t.id,type:`bar`},e=>v.createElement(v.Fragment,null,v.createElement(o1,{legendPayload:_4(t)}),v.createElement(v4,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),v.createElement(y1,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null}),v.createElement(EX,{zIndex:t.zIndex},v.createElement(A4,l4({},t,{id:e})))))}var N4=v.memo(M4,lI);N4.displayName=`Bar`;var P4=[`domain`,`range`],F4=[`domain`,`range`];function I4(e,t){if(e==null)return{};var n,r,i=L4(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function L4(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function R4(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function z4(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=I4(e,P4),{domain:a,range:o}=t,s=I4(t,F4);return!R4(n,a)||!R4(r,o)?!1:lI(i,s)}var B4=[`type`],V4=[`dangerouslySetInnerHTML`,`ticks`,`scale`],H4=[`id`,`scale`];function U4(){return U4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},U4.apply(null,arguments)}function W4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G4(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?W4(Object(n),!0).forEach(function(t){K4(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function K4(e,t,n){return(t=q4(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function q4(e){var t=J4(e,`string`);return typeof t==`symbol`?t:t+``}function J4(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Y4(e,t){if(e==null)return{};var n,r,i=X4(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function X4(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Z4(e){var t=jk(),n=(0,v.useRef)(null),r=zP(),{type:i}=e,a=Y4(e,B4),o=Mz(r,`xAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return G4(G4({},a),{},{type:o})},[a,o]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(E1(s)):n.current!==s&&t(D1({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(O1(n.current)),null)},[t]),null}var Q4=e=>{var{xAxisId:t,className:n}=e,r=Q(nP),i=iP(),a=`xAxis`,o=Q(e=>nJ(e,a,t,i)),s=Q(e=>Wq(e,t)),c=Q(e=>Yq(e,t)),l=Q(e=>rK(e,t));if(s==null||c==null||l==null)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:f}=e,p=Y4(e,V4),{id:m,scale:h}=l,g=Y4(l,H4);return v.createElement(Q0,U4({},p,g,{x:c.x,y:c.y,width:s.width,height:s.height,className:Yt(`recharts-${a} ${a}`,n),viewBox:r,ticks:o,axisType:a,axisId:t}))},$4={allowDataOverflow:nK.allowDataOverflow,allowDecimals:nK.allowDecimals,allowDuplicatedCategory:nK.allowDuplicatedCategory,angle:nK.angle,axisLine:U0.axisLine,height:nK.height,hide:!1,includeHidden:nK.includeHidden,interval:nK.interval,label:!1,minTickGap:nK.minTickGap,mirror:nK.mirror,orientation:nK.orientation,padding:nK.padding,reversed:nK.reversed,scale:nK.scale,tick:nK.tick,tickCount:nK.tickCount,tickLine:U0.tickLine,tickSize:U0.tickSize,type:nK.type,niceTicks:nK.niceTicks,xAxisId:0},e3=v.memo(e=>{var t=_O(e,$4);return v.createElement(v.Fragment,null,v.createElement(Z4,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),v.createElement(Q4,t))},z4);e3.displayName=`XAxis`;var t3=[`type`],n3=[`dangerouslySetInnerHTML`,`ticks`,`scale`],r3=[`id`,`scale`];function i3(){return i3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i3.apply(null,arguments)}function a3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?a3(Object(n),!0).forEach(function(t){s3(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s3(e,t,n){return(t=c3(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c3(e){var t=l3(e,`string`);return typeof t==`symbol`?t:t+``}function l3(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u3(e,t){if(e==null)return{};var n,r,i=d3(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function d3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function f3(e){var t=jk(),n=(0,v.useRef)(null),r=zP(),{type:i}=e,a=u3(e,t3),o=Mz(r,`yAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return o3(o3({},a),{},{type:o})},[o,a]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(k1(s)):n.current!==s&&t(A1({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(j1(n.current)),null)},[t]),null}function p3(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=Q(nP),c=iP(),l=jk(),u=`yAxis`,d=Q(e=>Zq(e,t)),f=Q(e=>Xq(e,t)),p=Q(e=>nJ(e,u,t,c)),m=Q(e=>oK(e,t));if((0,v.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||WQ(i)||(0,v.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(F1({id:t,width:n}))}}},[p,d,l,i,t,r,m]),d==null||f==null||m==null)return null;var{dangerouslySetInnerHTML:h,ticks:g,scale:_}=e,y=u3(e,n3),{id:b,scale:x}=m,S=u3(m,r3);return v.createElement(Q0,i3({},y,S,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:d.width,height:d.height,className:Yt(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var m3={allowDataOverflow:aK.allowDataOverflow,allowDecimals:aK.allowDecimals,allowDuplicatedCategory:aK.allowDuplicatedCategory,angle:aK.angle,axisLine:U0.axisLine,hide:!1,includeHidden:aK.includeHidden,interval:aK.interval,label:!1,minTickGap:aK.minTickGap,mirror:aK.mirror,orientation:aK.orientation,padding:aK.padding,reversed:aK.reversed,scale:aK.scale,tick:aK.tick,tickCount:aK.tickCount,tickLine:U0.tickLine,tickSize:U0.tickSize,type:aK.type,niceTicks:aK.niceTicks,width:aK.width,yAxisId:0},h3=v.memo(e=>{var t=_O(e,m3);return v.createElement(v.Fragment,null,v.createElement(f3,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),v.createElement(p3,t))},z4);h3.displayName=`YAxis`;var g3=$([(e,t)=>t,LP,Jz,rB,_Y,yY,ZY,eP],lX);function _3(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function v3(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(_3(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var y3=Kj(`mouseClick`),b3=eN();b3.startListening({actionCreator:y3,effect:(e,t)=>{var n=e.payload,r=g3(t.getState(),v3(n));r?.activeIndex!=null&&t.dispatch(wJ({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var x3=Kj(`mouseMove`),S3=eN(),C3=null,w3=null,T3=null;S3.startListening({actionCreator:x3,effect:(e,t)=>{var n=e.payload,{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i?.includes(`mousemove`);C3!==null&&(cancelAnimationFrame(C3),C3=null),w3!==null&&(typeof r!=`number`||!a)&&(clearTimeout(w3),w3=null),T3=v3(n);var o=()=>{var e=t.getState(),n=lJ(e,e.tooltip.settings.shared);if(!T3){C3=null,w3=null;return}if(n===`axis`){var r=g3(e,T3);r?.activeIndex==null?t.dispatch(xJ()):t.dispatch(CJ({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}C3=null,w3=null};if(!a){o();return}r===`raf`?C3=requestAnimationFrame(o):typeof r==`number`&&w3===null&&(w3=setTimeout(o,r))}});function E3(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<<CHILDREN>>`:t}var D3={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},O3=mM({name:`rootProps`,initialState:D3,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??D3.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),k3=O3.reducer,{updateOptions:A3}=O3.actions,j3=mM({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}}),{updatePolarOptions:M3}=j3.actions,N3=j3.reducer,P3=Kj(`keyDown`),F3=Kj(`focus`),I3=Kj(`blur`),L3=eN(),R3=null,z3=null,B3=null;L3.startListening({actionCreator:P3,effect:(e,t)=>{B3=e.payload,R3!==null&&(cancelAnimationFrame(R3),R3=null);var{throttleDelay:n,throttledEvents:r}=t.getState().eventSettings,i=r===`all`||r.includes(`keydown`);z3!==null&&(typeof n!=`number`||!i)&&(clearTimeout(z3),z3=null);var a=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var{keyboardInteraction:n}=e.tooltip,r=B3;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=zJ(n,aY(e),IK(e),mY(e)),a=i==null?-1:Number(i);if(!Number.isFinite(a)||a<0)return;var o=yY(e);if(r===`Enter`){var s=nX(e,`axis`,`hover`,String(n.index));t.dispatch(EJ({active:!n.active,activeIndex:n.index,activeCoordinate:s}));return}var c=aJ(e)===`left-to-right`?1:-1,l=a+(r===`ArrowRight`?1:-1)*c;if(o==null||l>=o.length||l<0)return;var u=nX(e,`axis`,`hover`,String(l));t.dispatch(EJ({active:!0,activeIndex:l.toString(),activeCoordinate:u}))}finally{R3=null,z3=null}};if(!i){a();return}n===`raf`?R3=requestAnimationFrame(a):typeof n==`number`&&z3===null&&(a(),B3=null,z3=setTimeout(()=>{B3?a():(z3=null,R3=null)},n))}}),L3.startListening({actionCreator:F3,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&r.index==null){var i=`0`,a=nX(n,`axis`,`hover`,String(i));t.dispatch(EJ({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),L3.startListening({actionCreator:I3,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;r.active&&t.dispatch(EJ({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function V3(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var H3=Kj(`externalEvent`),U3=eN(),W3=new Map,G3=new Map,K3=new Map;U3.startListening({actionCreator:H3,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var i=r.type,a=V3(r);K3.set(i,{handler:n,reactEvent:a});var o=W3.get(i);o!==void 0&&(cancelAnimationFrame(o),W3.delete(i));var{throttleDelay:s,throttledEvents:c}=t.getState().eventSettings,l=c,u=l===`all`||l?.includes(i),d=G3.get(i);d!==void 0&&(typeof s!=`number`||!u)&&(clearTimeout(d),G3.delete(i));var f=()=>{var e=K3.get(i);try{if(!e)return;var{handler:n,reactEvent:r}=e,a=t.getState(),o={activeCoordinate:kY(a),activeDataKey:EY(a),activeIndex:wY(a),activeLabel:TY(a),activeTooltipIndex:wY(a),isTooltipActive:AY(a)};n&&n(o,r)}finally{W3.delete(i),G3.delete(i),K3.delete(i)}};if(!u){f();return}if(s===`raf`){var p=requestAnimationFrame(f);W3.set(i,p)}else if(typeof s==`number`){if(!G3.has(i)){f();var m=setTimeout(f,s);G3.set(i,m)}}else f()}}});var q3=$([$([UJ],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),J3=Kj(`touchMove`),Y3=eN(),X3=null,Z3=null,Q3=null,$3=null;Y3.startListening({actionCreator:J3,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){$3=V3(n);var{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i.includes(`touchmove`);X3!==null&&(cancelAnimationFrame(X3),X3=null),Z3!==null&&(typeof r!=`number`||!a)&&(clearTimeout(Z3),Z3=null),Q3=Array.from(n.touches).map(e=>v3({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var o=()=>{if($3!=null){var e=t.getState(),n=lJ(e,e.tooltip.settings.shared);if(n===`axis`){var r=Q3?.[0];if(r==null){X3=null,Z3=null;return}var i=g3(e,r);i?.activeIndex!=null&&t.dispatch(CJ({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=$3.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(UN),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=rY(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var{dataKey:u}=l,d=q3(e,s,c);t.dispatch(yJ({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}X3=null,Z3=null}};if(!a){o();return}r===`raf`?X3=requestAnimationFrame(o):typeof r==`number`&&Z3===null&&(o(),$3=null,Z3=setTimeout(()=>{$3?o():(Z3=null,X3=null)},r))}}});var e6={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},t6=mM({name:`eventSettings`,initialState:e6,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=RF(t.payload.throttledEvents))}}}),{setEventSettings:n6}=t6.actions,r6=t6.reducer,i6=gA({brush:t0,cartesianAxis:I1,chartData:ZX,errorBars:T2,eventSettings:r6,graphicalItems:v1,layout:sN,legend:GF,options:WX,polarAxis:v$,polarOptions:N3,referenceElements:d0,renderedTicks:N0,rootProps:k3,tooltip:DJ,zIndex:TX}),a6=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return iM({reducer:i6,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([b3.middleware,S3.middleware,L3.middleware,U3.middleware,Y3.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(nM({type:`raf`}))},devTools:EI.devToolsEnabled&&{serialize:{replacer:E3},name:`recharts-${t}`}})};function o6(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=iP(),a=(0,v.useRef)(null);if(i)return n;a.current??=a6(t,r);var o=Ok;return v.createElement(oI,{context:o,store:a.current},n)}function s6(e){var{layout:t,margin:n}=e,r=jk(),i=iP();return(0,v.useEffect)(()=>{i||(r(iN(t)),r(rN(n)))},[r,i,t,n]),null}var c6=(0,v.memo)(s6,lI);function l6(e){var t=jk();return(0,v.useEffect)(()=>{t(A3(e))},[t,e]),null}var u6=(0,v.memo)(e=>{var t=jk();return(0,v.useEffect)(()=>{t(n6(e))},[t,e]),null},lI);function d6(e){var{zIndex:t,isPanorama:n}=e,r=(0,v.useRef)(null),i=jk();return(0,v.useLayoutEffect)(()=>(r.current&&i(CX({zIndex:t,element:r.current,isPanorama:n})),()=>{i(wX({zIndex:t,isPanorama:n}))}),[i,t,n]),v.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function f6(e){var{children:t,isPanorama:n}=e,r=Q(dX);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return v.createElement(v.Fragment,null,i.map(e=>v.createElement(d6,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>v.createElement(d6,{key:e,zIndex:e,isPanorama:n})))}var p6=[`children`];function m6(e,t){if(e==null)return{};var n,r,i=h6(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function h6(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function g6(){return g6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g6.apply(null,arguments)}var _6={width:`100%`,height:`100%`,display:`block`},v6=(0,v.forwardRef)((e,t)=>{var n=FP(),r=IP(),i=II();if(!uN(n)||!uN(r))return null;var{children:a,otherAttributes:o,title:s,desc:c}=e,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),v.createElement(HT,g6({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:_6,ref:t}),a)}),y6=e=>{var{children:t}=e,n=Q(oP);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return v.createElement(HT,{width:r,height:i,x:o,y:a},t)},b6=(0,v.forwardRef)((e,t)=>{var{children:n}=e,r=m6(e,p6);return iP()?v.createElement(y6,null,v.createElement(f6,{isPanorama:!0},n)):v.createElement(v6,g6({ref:t},r),v.createElement(f6,{isPanorama:!1},n))});function x6(){var e=jk(),[t,n]=(0,v.useState)(null),r=Q(zN);return(0,v.useEffect)(()=>{if(t!=null){var n=t.getBoundingClientRect().width/t.offsetWidth;lN(n)&&n!==r&&e(oN(n))}},[t,e,r]),n}function S6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?S6(Object(n),!0).forEach(function(t){w6(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function w6(e,t,n){return(t=T6(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T6(e){var t=E6(e,`string`);return typeof t==`symbol`?t:t+``}function E6(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function D6(){return D6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},D6.apply(null,arguments)}var O6=()=>(cZ(),null);function k6(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var A6=(0,v.forwardRef)((e,t)=>{var n=(0,v.useRef)(null),[r,i]=(0,v.useState)({containerWidth:k6(e.style?.width),containerHeight:k6(e.style?.height)}),a=(0,v.useCallback)((e,t)=>{i(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),o=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null&&typeof ResizeObserver<`u`){var{width:r,height:i}=e.getBoundingClientRect();a(r,i);var o=new ResizeObserver(e=>{var t=e[0];if(t!=null){var{width:n,height:r}=t.contentRect;a(n,r)}});o.observe(e),n.current=o}},[t,a]);return(0,v.useEffect)(()=>()=>{n.current?.disconnect()},[a]),v.createElement(v.Fragment,null,v.createElement(HP,{width:r.containerWidth,height:r.containerHeight}),v.createElement(`div`,D6({ref:o},e)))}),j6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,v.useState)({containerWidth:k6(n),containerHeight:k6(r)}),o=(0,v.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return v.createElement(v.Fragment,null,v.createElement(HP,{width:i.containerWidth,height:i.containerHeight}),v.createElement(`div`,D6({ref:s},e)))}),M6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r}=e;return v.createElement(v.Fragment,null,v.createElement(HP,{width:n,height:r}),v.createElement(`div`,D6({ref:t},e)))}),N6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r}=e;return typeof n==`string`||typeof r==`string`?v.createElement(j6,D6({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?v.createElement(M6,D6({},e,{width:n,height:r,ref:t})):v.createElement(v.Fragment,null,v.createElement(HP,{width:n,height:r}),v.createElement(`div`,D6({ref:t},e)))});function P6(e){return e?A6:N6}var F6=(0,v.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:c,onMouseEnter:l,onMouseLeave:u,onMouseMove:d,onMouseUp:f,onTouchEnd:p,onTouchMove:m,onTouchStart:h,style:g,width:_,responsive:y,dispatchTouchEvents:b=!0}=e,x=(0,v.useRef)(null),S=jk(),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(null),D=x6(),O=OP(),k=O?.width>0?O.width:_,A=O?.height>0?O.height:i,j=(0,v.useCallback)(e=>{D(e),typeof t==`function`&&t(e),w(e),E(e),e!=null&&(x.current=e)},[D,t,w,E]),M=(0,v.useCallback)(e=>{S(y3(e)),S(H3({handler:a,reactEvent:e}))},[S,a]),N=(0,v.useCallback)(e=>{S(x3(e)),S(H3({handler:l,reactEvent:e}))},[S,l]),P=(0,v.useCallback)(e=>{S(xJ()),S(H3({handler:u,reactEvent:e}))},[S,u]),ee=(0,v.useCallback)(e=>{S(x3(e)),S(H3({handler:d,reactEvent:e}))},[S,d]),F=(0,v.useCallback)(()=>{S(F3())},[S]),I=(0,v.useCallback)(()=>{S(I3())},[S]),te=(0,v.useCallback)(e=>{S(P3(e.key))},[S]),L=(0,v.useCallback)(e=>{S(H3({handler:o,reactEvent:e}))},[S,o]),ne=(0,v.useCallback)(e=>{S(H3({handler:s,reactEvent:e}))},[S,s]),re=(0,v.useCallback)(e=>{S(H3({handler:c,reactEvent:e}))},[S,c]),R=(0,v.useCallback)(e=>{S(H3({handler:f,reactEvent:e}))},[S,f]),ie=(0,v.useCallback)(e=>{S(H3({handler:h,reactEvent:e}))},[S,h]),ae=(0,v.useCallback)(e=>{b&&S(J3(e)),S(H3({handler:m,reactEvent:e}))},[S,b,m]),oe=(0,v.useCallback)(e=>{S(H3({handler:p,reactEvent:e}))},[S,p]),se=P6(y);return v.createElement(IX.Provider,{value:C},v.createElement(JT.Provider,{value:T},v.createElement(se,{width:k??g?.width,height:A??g?.height,className:Yt(`recharts-wrapper`,r),style:C6({position:`relative`,cursor:`default`,width:k,height:A},g),onClick:M,onContextMenu:L,onDoubleClick:ne,onFocus:F,onBlur:I,onKeyDown:te,onMouseDown:re,onMouseEnter:N,onMouseLeave:P,onMouseMove:ee,onMouseUp:R,onTouchEnd:oe,onTouchMove:ae,onTouchStart:ie,ref:j},v.createElement(O6,null),n)))}),I6=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function L6(e,t){if(e==null)return{};var n,r,i=R6(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function R6(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var z6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:c,title:l,desc:u}=e,d=FT(L6(e,I6));return c?v.createElement(v.Fragment,null,v.createElement(HP,{width:n,height:r}),v.createElement(b6,{otherAttributes:d,title:l,desc:u},a)):v.createElement(F6,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},v.createElement(b6,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(p0,null,a)))});function B6(){return B6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B6.apply(null,arguments)}function V6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?V6(Object(n),!0).forEach(function(t){U6(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function U6(e,t,n){return(t=W6(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W6(e){var t=G6(e,`string`);return typeof t==`symbol`?t:t+``}function G6(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var K6=H6({accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,layout:`horizontal`,margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:`none`,syncMethod:`index`},e6),q6=(0,v.forwardRef)(function(e,t){var n=_O(e.categoricalChartProps,K6),{chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,categoricalChartProps:s}=e,c={chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,eventEmitter:void 0};return v.createElement(o6,{preloadedState:{options:c},reduxStoreName:s.id??r},v.createElement(Z1,{chartData:s.data}),v.createElement(c6,{layout:n.layout,margin:n.margin}),v.createElement(u6,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(l6,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),v.createElement(z6,B6({},n,{ref:t})))}),J6=[`axis`,`item`],Y6=(0,v.forwardRef)((e,t)=>v.createElement(q6,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:J6,tooltipPayloadSearcher:HX,categoricalChartProps:e,ref:t})),X6={light:``,dark:`.dark`},Z6={width:320,height:200},Q6=v.createContext(null);function $6(){let e=v.useContext(Q6);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function e8({id:e,className:t,children:n,config:r,initialDimension:i=Z6,...a}){let o=v.useId(),s=`chart-${e??o.replace(/:/g,``)}`;return(0,H.jsx)(Q6.Provider,{value:{config:r},children:(0,H.jsxs)(`div`,{"data-slot":`chart`,"data-chart":s,className:V(`flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden`,t),...a,children:[(0,H.jsx)(t8,{id:s,config:r}),(0,H.jsx)(AP,{initialDimension:i,children:n})]})})}var t8=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme??e.color);return n.length?(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(X6).map(([t,r])=>`
163
+ ${x.x},${x.y}`,C=eO(e.id)?YD(`recharts-radial-line-`):e.id;return v.createElement(`text`,JQ({},r,{dominantBaseline:`central`,className:Yt(`recharts-radial-bar-label`,o)}),v.createElement(`defs`,null,v.createElement(`path`,{id:C,d:S})),v.createElement(`textPath`,{xlinkHref:`#${C}`},n))},i$=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:c}=e,l=(s+c)/2;if(n===`outside`){var{x:u,y:d}=RR(r,i,o+t,l);return{x:u,y:d,textAnchor:u>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var{x:f,y:p}=RR(r,i,(a+o)/2,l);return{x:f,y:p,textAnchor:`middle`,verticalAnchor:`middle`}},a$=e=>e!=null&&`cx`in e&&Z(e.cx),o$={angle:0,offset:5,zIndex:zz.label,position:`middle`,textBreakAll:!1};function s$(e){if(!a$(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function c$(e){var t=OO(e,o$),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:s,className:c=``,textBreakAll:l,labelRef:u}=t,d=$Q(),f=ZQ(),p=n==null?i===`center`?f:d??f:a$(n)?n:HP(n),m,h,g=s$(p);if(!p||eO(a)&&eO(o)&&!(0,v.isValidElement)(s)&&typeof s!=`function`)return null;var _=WQ(WQ({},t),{},{viewBox:p});if((0,v.isValidElement)(s)){var{labelRef:y}=_,b=VQ(_,zQ);return(0,v.cloneElement)(s,b)}if(typeof s==`function`){var{content:x}=_,S=VQ(_,BQ);if(m=(0,v.createElement)(s,S),(0,v.isValidElement)(m))return m}else m=e$(t);var C=JT(t);if(a$(p)){if(i===`insideStart`||i===`insideEnd`||i===`end`)return r$(t,i,m,C,p);h=i$(p,t.offset,t.position)}else{if(!g)return null;var w=RQ({viewBox:g,position:i,offset:t.offset,parentViewBox:a$(r)?void 0:r,clamp:!0});h=WQ(WQ({x:w.x,y:w.y,textAnchor:w.horizontalAnchor,verticalAnchor:w.verticalAnchor},w.width===void 0?{}:{width:w.width}),w.height===void 0?{}:{height:w.height})}return v.createElement(LX,{zIndex:t.zIndex},v.createElement(MQ,JQ({ref:u,className:Yt(`recharts-label`,c)},C,h,{textAnchor:xQ(C.textAnchor)?C.textAnchor:h.textAnchor,breakAll:l}),m))}c$.displayName=`Label`;var l$=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?v.createElement(c$,JQ({key:`label-implicit`},r)):qD(e)?v.createElement(c$,JQ({key:`label-implicit`,value:e},r)):(0,v.isValidElement)(e)?e.type===c$?(0,v.cloneElement)(e,WQ({key:`label-implicit`},r)):v.createElement(c$,JQ({key:`label-implicit`,content:e},r)):t$(e)?v.createElement(c$,JQ({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?v.createElement(c$,JQ({},e,{key:`label-implicit`},r)):null};function u$(e){var{label:t,labelRef:n}=e;return l$(t,ZQ(),n)||null}var d$=[`valueAccessor`],f$=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function p$(){return p$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p$.apply(null,arguments)}function m$(e,t){if(e==null)return{};var n,r,i=h$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function h$(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var g$=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(SQ(t))return t},_$=(0,v.createContext)(void 0),v$=_$.Provider,y$=(0,v.createContext)(void 0);y$.Provider;function b$(){return(0,v.useContext)(_$)}function x$(){return(0,v.useContext)(y$)}function S$(e){var{valueAccessor:t=g$}=e,n=m$(e,d$),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,c=m$(n,f$),l=b$(),u=x$(),d=l||u;return!d||!d.length?null:v.createElement(LX,{zIndex:s??zz.label},v.createElement(iE,{className:`recharts-label-list`},d.map((e,i)=>{var s=eO(r)?t(e,i):DN(e.payload,r),l=eO(a)?{}:{id:`${a}-${i}`};return v.createElement(c$,p$({key:`label-${i}`},JT(e),c,l,{fill:n.fill??e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))})))}S$.displayName=`LabelList`;function C$(e){var{label:t}=e;return t?t===!0?v.createElement(S$,{key:`labelList-implicit`}):v.isValidElement(t)||t$(t)?v.createElement(S$,{key:`labelList-implicit`,content:t}):typeof t==`object`?v.createElement(S$,p$({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}var w$=TM({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=YF(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=YF(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:T$,removeRadiusAxis:E$,addAngleAxis:D$,removeAngleAxis:O$}=w$.actions,k$=w$.reducer;function A$(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}var j$=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),M$=o(((e,t)=>{t.exports=j$()}))(),N$=e=>typeof e==`string`?e:e?e.displayName||e.name||`Component`:``,P$=null,F$=null,I$=e=>{if(e===P$&&Array.isArray(F$))return F$;var t=[];return v.Children.forEach(e,e=>{eO(e)||((0,M$.isFragment)(e)?t=t.concat(I$(e.props.children)):t.push(e))}),F$=t,P$=e,t};function L$(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(e=>N$(e)):[N$(t)],I$(e).forEach(e=>{var t=zD(e,`type.displayName`)||zD(e,`type.name`);t&&r.indexOf(t)!==-1&&n.push(e)}),n}function R$(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var z$,B$,V$,H$,U$;function W$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?W$(Object(n),!0).forEach(function(t){K$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function K$(e,t,n){return(t=q$(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function q$(e){var t=J$(e,`string`);return typeof t==`symbol`?t:t+``}function J$(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Y$(){return Y$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y$.apply(null,arguments)}function X$(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Z$=(e,t,n,r,i)=>{var a=n-r,o=UD(z$||=X$([`M `,`,`,``]),e,t);return o+=UD(B$||=X$([`L `,`,`,``]),e+n,t),o+=UD(V$||=X$([`L `,`,`,``]),e+n-a/2,t+i),o+=UD(H$||=X$([`L `,`,`,``]),e+n-a/2-r,t+i),o+=UD(U$||=X$([`L `,`,`,` Z`]),e,t),o},Q$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},$$=e=>{var t=OO(e,Q$),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:c,animationDuration:l,animationBegin:u,isUpdateAnimationActive:d}=t,f=(0,v.useRef)(null),[p,m]=(0,v.useState)(-1),h=(0,v.useRef)(i),g=(0,v.useRef)(a),_=(0,v.useRef)(o),y=(0,v.useRef)(n),b=(0,v.useRef)(r),x=oR(e,`trapezoid-`);if((0,v.useEffect)(()=>{if(f.current&&f.current.getTotalLength)try{var e=f.current.getTotalLength();e&&m(e)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var S=Yt(`recharts-trapezoid`,s);if(!d)return v.createElement(`g`,null,v.createElement(`path`,Y$({},JT(t),{className:S,d:Z$(n,r,i,a,o)})));var C=h.current,w=g.current,T=_.current,E=y.current,D=b.current,O=`0px ${p===-1?1:p}px`,k=`${p}px ${p}px`,A=DL([`strokeDasharray`],l,c);return v.createElement(aR,{animationId:x,key:x,canBegin:p>0,duration:l,easing:c,isActive:d,begin:u},e=>{var s=QD(C,i,e),c=QD(w,a,e),l=QD(T,o,e),u=QD(E,n,e),d=QD(D,r,e);f.current&&(h.current=s,g.current=c,_.current=l,y.current=u,b.current=d);var p=e>0?{transition:A,strokeDasharray:k}:{strokeDasharray:O};return v.createElement(`path`,Y$({},JT(t),{className:S,d:Z$(u,d,s,c,l),ref:f,style:G$(G$({},p),t.style)}))})},e1=[`option`,`shapeType`,`activeClassName`,`inActiveClassName`];function t1(e,t){if(e==null)return{};var n,r,i=n1(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function n1(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function r1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?r1(Object(n),!0).forEach(function(t){a1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a1(e,t,n){return(t=o1(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o1(e){var t=s1(e,`string`);return typeof t==`symbol`?t:t+``}function s1(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function c1(e,t){return i1(i1({},t),e)}function l1(e,t){return e===`symbols`}function u1(e){var{shapeType:t,elementProps:n}=e;switch(t){case`rectangle`:return v.createElement(AR,n);case`trapezoid`:return v.createElement($$,n);case`sector`:return v.createElement(oz,n);case`symbols`:if(l1(t,n))return v.createElement(vO,n);break;case`curve`:return v.createElement(cL,n);default:return null}}function d1(e){return(0,v.isValidElement)(e)?e.props:e}function f1(e){var{option:t,shapeType:n,activeClassName:r=`recharts-active-shape`,inActiveClassName:i=`recharts-shape`}=e,a=t1(e,e1),o;if((0,v.isValidElement)(t))o=(0,v.cloneElement)(t,i1(i1({},a),d1(t)));else if(typeof t==`function`)o=t(a,a.index);else if(R$(t)&&typeof t!=`boolean`){var s=c1(t,a);o=v.createElement(u1,{shapeType:n,elementProps:s})}else{var c=a;o=v.createElement(u1,{shapeType:n,elementProps:c})}return a.isActive?v.createElement(iE,{className:r},o):v.createElement(iE,{className:i},o)}var p1=(e,t,n)=>{var r=Hk();return(i,a)=>o=>{e?.(i,a,o),r(AJ({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},m1=e=>{var t=Hk();return(n,r)=>i=>{e?.(n,r,i),t(jJ())}},h1=(e,t,n)=>{var r=Hk();return(i,a)=>o=>{e?.(i,a,o),r(NJ({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function g1(e){var{tooltipEntrySettings:t}=e,n=Hk(),r=hP(),i=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{r||(i.current===null?n(EJ(t)):i.current!==t&&n(DJ({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,v.useLayoutEffect)(()=>()=>{i.current&&=(n(OJ(i.current)),null)},[n]),null}function _1(e){var{legendPayload:t}=e,n=Hk(),r=hP(),i=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{r||(i.current===null?n($F(t)):i.current!==t&&n(eI({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,v.useLayoutEffect)(()=>()=>{i.current&&=(n(tI(i.current)),null)},[n]),null}var v1=v.useId??(()=>{var[e]=v.useState(()=>YD(`uid-`));return e});function y1(e,t){var n=v1();return t||(e?`${e}-${n}`:n)}var b1=(0,v.createContext)(void 0),x1=e=>{var{id:t,type:n,children:r}=e,i=y1(`recharts-${n}`,t);return v.createElement(b1.Provider,{value:i},r(i))},S1=TM({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(YF(t.payload))},prepare:uM()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Xj(e).cartesianItems.indexOf(YF(n));i>-1&&(e.cartesianItems[i]=YF(r))},prepare:uM()},removeCartesianGraphicalItem:{reducer(e,t){var n=Xj(e).cartesianItems.indexOf(YF(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:uM()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(YF(t.payload))},prepare:uM()},removePolarGraphicalItem:{reducer(e,t){var n=Xj(e).polarItems.indexOf(YF(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:uM()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Xj(e).polarItems.indexOf(YF(n));i>-1&&(e.polarItems[i]=YF(r))},prepare:uM()}}}),{addCartesianGraphicalItem:C1,replaceCartesianGraphicalItem:w1,removeCartesianGraphicalItem:T1,addPolarGraphicalItem:E1,removePolarGraphicalItem:D1,replacePolarGraphicalItem:O1}=S1.actions,k1=S1.reducer,A1=(0,v.memo)(e=>{var t=Hk(),n=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{n.current===null?t(C1(e)):n.current!==e&&t(w1({prev:n.current,next:e})),n.current=e},[t,e]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(T1(n.current)),null)},[t]),null});function j1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function M1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j1(Object(n),!0).forEach(function(t){N1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N1(e,t,n){return(t=P1(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P1(e){var t=F1(e,`string`);return typeof t==`symbol`?t:t+``}function F1(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var I1=TM({name:`cartesianAxis`,initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=YF(t.payload)},prepare:uM()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.xAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=YF(r))},prepare:uM()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:uM()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=YF(t.payload)},prepare:uM()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.yAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=YF(r))},prepare:uM()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:uM()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=YF(t.payload)},prepare:uM()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.zAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=YF(r))},prepare:uM()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:uM()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(a.length===3&&a[0]===a[2]&&r===a[1]&&r!==i.width&&Math.abs(r-(a[0]??0))<=1)return;var o=[...a,r].slice(-3);e.yAxis[n]=M1(M1({},i),{},{width:r,widthHistory:o})}}}}),{addXAxis:L1,replaceXAxis:R1,removeXAxis:z1,addYAxis:B1,replaceYAxis:V1,removeYAxis:H1,addZAxis:U1,replaceZAxis:W1,removeZAxis:G1,updateYAxisWidth:K1}=I1.actions,q1=I1.reducer,J1=$([$([dP],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),JN,YN],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Y1=()=>Q(J1),X1=(e,t,n)=>{var r=n??e;if(!eO(r))return XD(r,t,0)},Z1=(e,t,n)=>{var r={},i=e.filter(uB),a=e.filter(e=>e.stackId==null),o=i.reduce((e,t)=>{var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},r),s=Object.entries(o).map(e=>{var[r,i]=e;return{stackId:r,dataKeys:i.map(e=>e.dataKey),barSize:X1(t,n,i[0]?.barSize)}}),c=a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>e!=null),barSize:X1(t,n,e.barSize)}));return[...s,...c]};function Q1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Q1(Object(n),!0).forEach(function(t){e0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function e0(e,t,n){return(t=t0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t0(e){var t=n0(e,`string`);return typeof t==`symbol`?t:t+``}function n0(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function r0(e,t,n,r,i){var a=r.length;if(!(a<1)){var o=XD(e,n,0,!0),s,c=[];if(bN(r[0]?.barSize)){var l=!1,u=n/a,d=r.reduce((e,t)=>e+(t.barSize||0),0);d+=(a-1)*o,d>=n&&(d-=(a-1)*o,o=0),d>=n&&u>0&&(l=!0,u*=.9,d=a*u);var f={offset:((n-d)/2>>0)-o,size:0};s=r.reduce((e,t)=>{var n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f.offset+f.size+o,size:l?u:t.barSize??0}},r=[...e,n];return f=n.position,r},c)}else{var p=XD(t,n,0,!0);n-2*p-(a-1)*o<=0&&(o=0);var m=(n-2*p-(a-1)*o)/a;m>1&&(m>>=0);var h=bN(i)?Math.min(m,i):m;s=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+(m+o)*n+(m-h)/2,size:h}}],c)}return s}}var i0=(e,t,n,r,i,a,o)=>{var s=eO(o)?t:o,c=r0(n,r,i===a?a:i,e,s);return i!==a&&c!=null&&(c=c.map(e=>$1($1({},e),{},{position:$1($1({},e.position),{},{offset:e.position.offset-i/2})}))),c},a0=(e,t)=>{var n=cB(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:a}=i;if(a)return a.find(e=>e.key===n)}}}},o0=(e,t)=>{if(e!=null&&t!=null){var n=e.find(e=>e.stackId===t.stackId&&t.dataKey!=null&&e.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function s0(e,t){return e&&typeof e==`object`&&`zIndex`in e&&typeof e.zIndex==`number`&&bN(e.zIndex)?e.zIndex:t}var c0=e=>{var{chartData:t}=e,n=Hk(),r=hP();return(0,v.useEffect)(()=>r?()=>{}:(n(aZ(t)),()=>{n(aZ(void 0))}),[t,n,r]),null},l0={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},u0=TM({name:`brush`,initialState:l0,reducers:{setBrushSettings(e,t){return t.payload==null?l0:t.payload}}}),{setBrushSettings:d0}=u0.actions,f0=u0.reducer;function p0(e){return(e%180+180)%180}var m0=function(e){var{width:t,height:n}=e,r=p0(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r<Math.PI-i?n/Math.sin(r):t/Math.cos(r);return Math.abs(a)},h0=TM({name:`referenceElements`,initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Xj(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Xj(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(YF(t.payload))},removeLine:(e,t)=>{var n=Xj(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:g0,removeDot:_0,addArea:v0,removeArea:y0,addLine:b0,removeLine:x0}=h0.actions,S0=h0.reducer,C0=(0,v.createContext)(void 0),w0=e=>{var{children:t}=e,[n]=(0,v.useState)(`${YD(`recharts`)}-clip`),r=Y1();if(r==null)return null;var{x:i,y:a,width:o,height:s}=r;return v.createElement(C0.Provider,{value:n},v.createElement(`defs`,null,v.createElement(`clipPath`,{id:n},v.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)};function T0(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];i!==void 0&&n.push(i)}return n}function E0(e,t,n){return m0({width:e.width+t.width,height:e.height+t.height},n)}function D0(e,t,n){var r=n===`width`,{x:i,y:a,width:o,height:s}=e;return t===1?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}function O0(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function k0(e,t){return T0(e,t+1)}function A0(e,t,n,r,i){for(var a=(r||[]).slice(),{start:o,end:s}=t,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:T0(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||O0(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function j0(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var{start:o,end:s}=t,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||O0(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m<a&&(p=f(),p===0||p!==1);m+=c);if(d){for(var h=[],g=l;g<a;g+=c){var _=r[g];_!=null&&h.push(_)}return h}}return[]}function M0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function N0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?M0(Object(n),!0).forEach(function(t){P0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function P0(e,t,n){return(t=F0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F0(e){var t=I0(e,`string`);return typeof t==`symbol`?t:t+``}function I0(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function L0(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:c}=t,l=function(t){var r=a[t];if(r==null)return 1;var l=r,u,d=()=>(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=N0(N0({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=N0(N0({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&O0(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=N0(N0({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function R0(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:c,end:l}=t;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=N0(N0({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&O0(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=N0(N0({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=N0(N0({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=N0(N0({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&O0(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=N0(N0({},a),{},{isShow:!0}))},h=0;h<p;h++)if(m(h))continue;return o}function z0(e,t,n){var{tick:r,ticks:i,viewBox:a,minTickGap:o,orientation:s,interval:c,tickFormatter:l,unit:u,angle:d}=e;if(!i||!i.length||!r)return[];if(Z(c)||LI.isSsr)return k0(i,Z(c)?c:0)??[];var f=[],p=s===`top`||s===`bottom`?`width`:`height`,m=u&&p===`width`?qZ(u,{fontSize:t,letterSpacing:n}):{width:0,height:0},h=(e,r)=>{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?E0(qZ(i,{fontSize:t,letterSpacing:n}),m,d):qZ(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?WD(_.coordinate-g.coordinate):1,y=D0(a,v,p);return c===`equidistantPreserveStart`?A0(v,y,h,i,o):c===`equidistantPreserveEnd`?j0(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?R0(v,y,h,i,o,c===`preserveStartEnd`):L0(v,y,h,i,o),f.filter(e=>e.isShow))}var B0=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0,c=i+a,l=o+c+s+(n?r:0);return Math.round(l)}return 0},V0=TM({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:i}=t.payload;e[n][r]=YF(i)},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:H0,removeRenderedTicks:U0}=V0.actions,W0=V0.reducer,G0=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function K0(e,t){if(e==null)return{};var n,r,i=q0(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function q0(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function J0(){return J0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J0.apply(null,arguments)}function Y0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Y0(Object(n),!0).forEach(function(t){Z0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Y0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z0(e,t,n){return(t=Q0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q0(e){var t=$0(e,`string`);return typeof t==`symbol`?t:t+``}function $0(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var e2={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`,zIndex:zz.axis};function t2(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:c}=e;if(!s)return null;var l=X0(X0(X0({},c),KT(s)),{},{fill:`none`});if(a===`top`||a===`bottom`){var u=+(a===`top`&&!o||a===`bottom`&&o);l=X0(X0({},l),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+(a===`left`&&!o||a===`right`&&o);l=X0(X0({},l),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return v.createElement(`line`,J0({},l,{className:Yt(`recharts-cartesian-axis-line`,zD(s,`className`))}))}function n2(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h=s?-1:1,g=e.tickSize||o,_=Z(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case`top`:l=u=e.coordinate,f=n+ +!s*i,d=f-h*g,m=d-h*c,p=_;break;case`left`:d=f=e.coordinate,u=t+ +!s*r,l=u-h*g,p=l-h*c,m=_;break;case`right`:d=f=e.coordinate,u=t+ +s*r,l=u+h*g,p=l+h*c,m=_;break;default:l=u=e.coordinate,f=n+ +s*i,d=f+h*g,m=d+h*c,p=_}return{line:{x1:l,y1:d,x2:u,y2:f},tick:{x:p,y:m}}}function r2(e,t){switch(e){case`left`:return t?`start`:`end`;case`right`:return t?`end`:`start`;default:return`middle`}}function i2(e,t){switch(e){case`left`:case`right`:return`middle`;case`top`:return t?`start`:`end`;default:return t?`end`:`start`}}function a2(e){var{option:t,tickProps:n,value:r}=e,i,a=Yt(n.className,`recharts-cartesian-axis-tick-value`);if(v.isValidElement(t))i=v.cloneElement(t,X0(X0({},n),{},{className:a}));else if(typeof t==`function`)i=t(X0(X0({},n),{},{className:a}));else{var o=`recharts-cartesian-axis-tick-value`;typeof t!=`boolean`&&(o=Yt(o,A$(t))),i=v.createElement(MQ,J0({},n,{className:o}),r)}return i}function o2(e){var{ticks:t,axisType:n,axisId:r}=e,i=Hk();return(0,v.useEffect)(()=>r==null||n==null?rO:(i(H0({ticks:t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),axisId:r,axisType:n})),()=>{i(U0({axisId:r,axisType:n}))}),[i,t,r,n]),null}var s2=(0,v.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:c,tickTextProps:l,orientation:u,mirror:d,x:f,y:p,width:m,height:h,tickSize:g,tickMargin:_,fontSize:y,letterSpacing:b,getTicksConfig:x,events:S,axisType:C,axisId:w}=e,T=z0(X0(X0({},x),{},{ticks:n}),y,b),E=KT(x),D=qT(r),O=xQ(E.textAnchor)?E.textAnchor:r2(u,d),k=i2(u,d),A={};typeof i==`object`&&(A=i);var j=X0(X0({},E),{},{fill:`none`},A),M=T.map(e=>X0({entry:e},n2(e,f,p,m,h,u,g,d,_))),N=M.map(e=>{var{entry:t,line:n}=e;return v.createElement(iE,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},i&&v.createElement(`line`,J0({},j,n,{className:Yt(`recharts-cartesian-axis-tick-line`,zD(i,`className`))})))}),P=M.map((e,t)=>{var{entry:n,tick:i}=e,u=X0(X0({},X0(X0(X0(X0({verticalAnchor:k},E),{},{textAnchor:O,stroke:`none`,fill:a},i),{},{index:t,payload:n,visibleTicksCount:T.length,tickFormatter:o,padding:c},l),{},{angle:l?.angle??E.angle??0})),D);return v.createElement(iE,J0({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},SO(S,n,t)),r&&v.createElement(a2,{option:r,tickProps:u,value:`${typeof o==`function`?o(n.value,t):n.value}${s||``}`}))});return v.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${C}-ticks`},v.createElement(o2,{ticks:T,axisId:w,axisType:C}),P.length>0&&v.createElement(LX,{zIndex:zz.label},v.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${C}-tick-labels`,ref:t},P)),N.length>0&&v.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${C}-tick-lines`},N))}),c2=(0,v.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:c,axisId:l}=e,u=K0(e,G0),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),h=(0,v.useRef)(null);(0,v.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>B0({ticks:h.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var g=(0,v.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);h.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==d||a!==p)&&(f(i),m(a))}}},[d,p]);return o||r!=null&&r<=0||i!=null&&i<=0?null:v.createElement(LX,{zIndex:e.zIndex},v.createElement(iE,{className:Yt(`recharts-cartesian-axis`,a)},v.createElement(t2,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:KT(e)}),v.createElement(s2,{ref:g,axisType:c,events:u,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:l}),v.createElement(XQ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},v.createElement(u$,{label:e.label,labelRef:e.labelRef}),e.children)))}),l2=v.forwardRef((e,t)=>{var n=OO(e,e2);return v.createElement(c2,J0({},n,{ref:t}))});l2.displayName=`CartesianAxis`;var u2=[`x1`,`y1`,`x2`,`y2`,`key`],d2=[`offset`],f2=[`xAxisId`,`yAxisId`],p2=[`xAxisId`,`yAxisId`];function m2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?m2(Object(n),!0).forEach(function(t){g2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function g2(e,t,n){return(t=_2(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _2(e){var t=v2(e,`string`);return typeof t==`symbol`?t:t+``}function v2(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function y2(){return y2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y2.apply(null,arguments)}function b2(e,t){if(e==null)return{};var n,r,i=x2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function x2(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var S2=e=>{var{fill:t}=e;if(!t||t===`none`)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return v.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function C2(e){var{option:t,lineItemProps:n}=e,r;if(v.isValidElement(t))r=v.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var{x1:i,y1:a,x2:o,y2:s,key:c}=n,l=KT(b2(n,u2))??{},{offset:u}=l,d=b2(l,d2);r=v.createElement(`line`,y2({},d,{x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function w2(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=b2(e,f2),c=i.map((e,i)=>{var a=h2(h2({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${i}`,index:i});return v.createElement(C2,{key:`line-${i}`,option:r,lineItemProps:a})});return v.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},c)}function T2(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=b2(e,p2),c=i.map((e,i)=>{var a=h2(h2({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${i}`,index:i});return v.createElement(C2,{option:r,lineItemProps:a,key:`line-${i}`})});return v.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},c)}function E2(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:c=!0}=e;if(!c||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return v.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return v.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function D2(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:c}=e;if(!t||!n||!n.length)return null;var l=c.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,t)=>{var c=l[t+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=t%n.length;return v.createElement(`rect`,{key:`react-${t}`,x:e,y:a,width:u,height:s,stroke:`none`,fill:n[d],fillOpacity:r,className:`recharts-cartesian-grid-bg`})});return v.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},u)}var O2=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return AN(z0(h2(h2(h2({},e2),n),{},{ticks:jN(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},k2=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return AN(z0(h2(h2(h2({},e2),n),{},{ticks:jN(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},A2={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:`#ccc`,fill:`none`,verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:zz.grid};function j2(e){var t=KP(),n=qP(),r=GP(),i=h2(h2({},OO(e,A2)),{},{x:Z(e.x)?e.x:r.left,y:Z(e.y)?e.y:r.top,width:Z(e.width)?e.width:r.width,height:Z(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:c,width:l,height:u,syncWithTicks:d,horizontalValues:f,verticalValues:p}=i,m=hP(),h=Q(e=>fJ(e,`xAxis`,a,m)),g=Q(e=>fJ(e,`yAxis`,o,m));if(!xN(l)||!xN(u)||!Z(s)||!Z(c))return null;var _=i.verticalCoordinatesGenerator||O2,y=i.horizontalCoordinatesGenerator||k2,{horizontalPoints:b,verticalPoints:x}=i;if((!b||!b.length)&&typeof y==`function`){var S=f&&f.length,C=y({yAxis:g?h2(h2({},g),{},{ticks:S?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},S?!0:d);xP(Array.isArray(C),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof C}]`),Array.isArray(C)&&(b=C)}if((!x||!x.length)&&typeof _==`function`){var w=p&&p.length,T=_({xAxis:h?h2(h2({},h),{},{ticks:w?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},w?!0:d);xP(Array.isArray(T),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof T}]`),Array.isArray(T)&&(x=T)}return v.createElement(LX,{zIndex:i.zIndex},v.createElement(`g`,{className:`recharts-cartesian-grid`},v.createElement(S2,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),v.createElement(E2,y2({},i,{horizontalPoints:b})),v.createElement(D2,y2({},i,{verticalPoints:x})),v.createElement(w2,y2({},i,{offset:r,horizontalPoints:b,xAxis:h,yAxis:g})),v.createElement(T2,y2({},i,{offset:r,verticalPoints:x,xAxis:h,yAxis:g}))))}j2.displayName=`CartesianGrid`;var M2=TM({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:N2,replaceErrorBar:P2,removeErrorBar:F2}=M2.actions,I2=M2.reducer,L2=[`children`];function R2(e,t){if(e==null)return{};var n,r,i=z2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function z2(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var B2=(0,v.createContext)({data:[],xAxisId:`xAxis-0`,yAxisId:`yAxis-0`,dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function V2(e){var{children:t}=e,n=R2(e,L2);return v.createElement(B2.Provider,{value:n},t)}function H2(e,t){var n=Q(t=>hK(t,e)),r=Q(e=>vK(e,t)),i=n?.allowDataOverflow??pK.allowDataOverflow,a=r?.allowDataOverflow??gK.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function U2(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=Y1(),{needClipX:a,needClipY:o,needClip:s}=H2(t,n);if(!s||!i)return null;var{x:c,y:l,width:u,height:d}=i;return v.createElement(`clipPath`,{id:`clipPath-${r}`},v.createElement(`rect`,{x:a?c:c-u/2,y:o?l:l-d/2,width:a?u:u*2,height:o?d:d*2}))}function W2(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function G2(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var K2=`Invariant failed`;function q2(e,t){if(!e)throw Error(K2)}function J2(){return J2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J2.apply(null,arguments)}function Y2(e){return v.createElement(f1,J2({shapeType:`rectangle`,activeClassName:`recharts-active-bar`,inActiveClassName:`recharts-inactive-bar`},e))}var X2=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(Z(e))return e;var i=Z(n)||eO(n);return i?e(n,r):(!i&&q2(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},Z2=(e,t,n)=>n,Q2=$([EK,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),$2=$([Q2],e=>e?.maxBarSize),e4=(e,t,n,r)=>r,t4=$([JP,EK,W2,G2,Z2],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),n4=(e,t,n)=>{var r=JP(e),i=W2(e,t),a=G2(e,t);if(i!=null&&a!=null)return r===`horizontal`?XK(e,`yAxis`,a,n):XK(e,`xAxis`,i,n)},r4=$([t4,Mz,(e,t)=>{var n=JP(e),r=W2(e,t),i=G2(e,t);if(r!=null&&i!=null)return n===`horizontal`?lJ(e,`xAxis`,r):lJ(e,`yAxis`,i)}],Z1),i4=(e,t,n)=>{var r=Q2(e,t);if(r==null)return 0;var i=W2(e,t),a=G2(e,t);if(i==null||a==null)return 0;var o=JP(e),s=kz(e),{maxBarSize:c}=r,l=eO(c)?s:c,u,d;return o===`horizontal`?(u=hJ(e,`xAxis`,i,n),d=mJ(e,`xAxis`,i,n)):(u=hJ(e,`yAxis`,a,n),d=mJ(e,`yAxis`,a,n)),UN(u,d,!0)??l??0},a4=(e,t,n)=>{var r=JP(e),i=W2(e,t),a=G2(e,t);if(i!=null&&a!=null){var o,s;return r===`horizontal`?(o=hJ(e,`xAxis`,i,n),s=mJ(e,`xAxis`,i,n)):(o=hJ(e,`yAxis`,a,n),s=mJ(e,`yAxis`,a,n)),UN(o,s)}},o4=$([dP,pP,(e,t,n)=>{var r=W2(e,t);if(r!=null)return hJ(e,`xAxis`,r,n)},(e,t,n)=>{var r=G2(e,t);if(r!=null)return hJ(e,`yAxis`,r,n)},(e,t,n)=>{var r=W2(e,t);if(r!=null)return mJ(e,`xAxis`,r,n)},(e,t,n)=>{var r=G2(e,t);if(r!=null)return mJ(e,`yAxis`,r,n)},$([$([r4,kz,Az,jz,i4,a4,$2],i0),Q2],o0),JP,mz,a4,$([n4,Q2],a0),Q2,e4],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var{chartData:p,dataStartIndex:m,dataEndIndex:h}=c;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var{data:g}=d,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return H4({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),s4=[`index`];function c4(){return c4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c4.apply(null,arguments)}function l4(e,t){if(e==null)return{};var n,r,i=u4(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function u4(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var d4=(0,v.createContext)(void 0),f4=e=>{var t=(0,v.useContext)(d4);if(t!=null)return t.stackId;if(e!=null)return FN(e)},p4=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,m4=e=>{var t=(0,v.useContext)(d4);if(t!=null){var{stackId:n}=t;return`url(#${p4(n,e)})`}},h4=e=>{var{index:t}=e,n=l4(e,s4),r=m4(t);return v.createElement(iE,c4({className:`recharts-bar-stack-layer`,clipPath:r},n))},g4=[`onMouseEnter`,`onMouseLeave`,`onClick`],_4=[`value`,`background`,`tooltipPosition`],v4=[`id`],y4=[`onMouseEnter`,`onClick`,`onMouseLeave`];function b4(){return b4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b4.apply(null,arguments)}function x4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function S4(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?x4(Object(n),!0).forEach(function(t){C4(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C4(e,t,n){return(t=w4(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w4(e){var t=T4(e,`string`);return typeof t==`symbol`?t:t+``}function T4(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function E4(e,t){if(e==null)return{};var n,r,i=D4(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function D4(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var O4=e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:GN(n,t),payload:e}]},k4=v.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:a,hide:o,unit:s,tooltipType:c,id:l}=e,u={dataDefinedOnItem:void 0,getPosition:rO,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:GN(a,t),hide:o,type:c,color:i,unit:s,graphicalItemId:l}};return v.createElement(g1,{tooltipEntrySettings:u})});function A4(e){var t=Q(FY),{data:n,dataKey:r,background:i,allOtherBarProps:a}=e,{onMouseEnter:o,onMouseLeave:s,onClick:c}=a,l=E4(a,g4),u=p1(o,r,a.id),d=m1(s),f=h1(c,r,a.id);if(!i||n==null)return null;var p=qT(i);return v.createElement(LX,{zIndex:s0(i,zz.barBackground)},n.map((e,n)=>{var{value:a,background:o,tooltipPosition:s}=e,c=E4(e,_4);if(!o)return null;var m=u(e,n),h=d(e,n),g=f(e,n),_=S4(S4(S4(S4(S4({option:i,isActive:String(n)===t},c),{},{fill:`#eee`},o),p),SO(l,e,n)),{},{onMouseEnter:m,onMouseLeave:h,onClick:g,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return v.createElement(Y2,b4({key:`background-bar-${n}`},_))}))}function j4(e){var{showLabels:t,children:n,rects:r}=e,i=r?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return S4(S4({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return v.createElement(v$,{value:t?i:void 0},n)}function M4(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:a,dataKey:o}=e,s=Q(FY),c=Q(LY),l=n&&String(i.originalDataIndex)===s&&(c==null||o===c),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1);(0,v.useEffect)(()=>{var e;return l?(d(!0),e=requestAnimationFrame(()=>{p(!0)})):p(!1),()=>{cancelAnimationFrame(e)}},[l]);var m=(0,v.useCallback)(()=>{l||d(!1)},[l]),h=l&&f,g=l||u,_=l?n===!0?t:n:t,y=v.createElement(Y2,b4({},r,{name:String(r.name)},i,{isActive:h,option:_,index:a,dataKey:o,onTransitionEnd:m}));return g?v.createElement(LX,{zIndex:zz.activeBar},v.createElement(h4,{index:i.originalDataIndex},y)):y}function N4(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:a}=e;return v.createElement(Y2,b4({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a}))}function P4(e){var{data:t,props:n}=e,r=KT(n)??{},{id:i}=r,a=E4(r,v4),{shape:o,dataKey:s,activeBar:c}=n,{onMouseEnter:l,onClick:u,onMouseLeave:d}=n,f=E4(n,y4),p=p1(l,s,i),m=m1(d),h=h1(u,s,i);return t?v.createElement(v.Fragment,null,t.map((e,t)=>v.createElement(h4,b4({index:e.originalDataIndex,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},SO(f,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:h(e,t)}),c?v.createElement(M4,{shape:o,activeBar:c,baseProps:a,entry:e,index:t,dataKey:s}):v.createElement(N4,{shape:o,baseProps:a,entry:e,index:t,dataKey:s})))):null}function F4(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,onAnimationEnd:l,onAnimationStart:u}=t,d=n.current,f=oR(t,`recharts-bar-`),[p,m]=(0,v.useState)(!1),h=!p,g=(0,v.useCallback)(()=>{typeof l==`function`&&l(),m(!1)},[l]),_=(0,v.useCallback)(()=>{typeof u==`function`&&u(),m(!0)},[u]);return v.createElement(j4,{showLabels:h,rects:r},v.createElement(aR,{animationId:f,begin:o,duration:s,isActive:a,easing:c,onAnimationEnd:g,onAnimationStart:_,key:f},e=>{var a=e===1?r:r?.map((t,n)=>{var r=d&&d[n];if(r)return S4(S4({},t),{},{x:QD(r.x,t.x,e),y:QD(r.y,t.y,e),width:QD(r.width,t.width,e),height:QD(r.height,t.height,e)});if(i===`horizontal`){var a=QD(0,t.height,e),o=QD(t.stackedBarStart,t.y,e);return S4(S4({},t),{},{y:o,height:a})}var s=QD(0,t.width,e),c=QD(t.stackedBarStart,t.x,e);return S4(S4({},t),{},{width:s,x:c})});return e>0&&(n.current=a??null),a==null?null:v.createElement(iE,null,v.createElement(P4,{props:t,data:a}))}),v.createElement(C$,{label:t.label}),t.children)}function I4(e){var t=(0,v.useRef)(null);return v.createElement(F4,{previousRectanglesRef:t,props:e})}var L4=0,R4=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:DN(e,t)}},z4=class extends v.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:i,yAxisId:a,needClip:o,background:s,id:c}=this.props;if(e||t==null)return null;var l=Yt(`recharts-bar`,r),u=c;return v.createElement(iE,{className:l,id:c},o&&v.createElement(`defs`,null,v.createElement(U2,{clipPathId:u,xAxisId:i,yAxisId:a})),v.createElement(iE,{className:`recharts-bar-rectangles`,clipPath:o?`url(#clipPath-${u})`:void 0},v.createElement(A4,{data:t,dataKey:n,background:s,allOtherBarProps:this.props}),v.createElement(I4,this.props)))}},B4={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:L4,xAxisId:0,yAxisId:0,zIndex:zz.bar};function V4(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u}=e,{needClip:d}=H2(t,n),f=YP(),p=hP(),m=L$(e.children,jZ),h=Q(t=>o4(t,e.id,p,m));if(f!==`vertical`&&f!==`horizontal`)return null;var g,_=h?.[0];return g=_==null||_.height==null||_.width==null?0:f===`vertical`?_.height/2:_.width/2,v.createElement(V2,{xAxisId:t,yAxisId:n,data:h,dataPointFormatter:R4,errorBarOffset:g},v.createElement(z4,b4({},e,{layout:f,needClip:d,data:h,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function H4(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:i},pos:a,bandSize:o,xAxis:s,yAxis:c,xAxisTicks:l,yAxisTicks:u,stackedData:d,displayedData:f,offset:p,cells:m,parentViewBox:h,dataStartIndex:g}=e,_=t===`horizontal`?c:s,v=d?_.scale.domain():null,y=LN({numericAxis:_}),b=_.scale.map(y);return f.map((e,f)=>{var _,x,S,C,w,T;if(d){var E=d[f+g];if(E==null)return null;_=MN(E,v)}else _=DN(e,n),Array.isArray(_)||(_=[y,_]);var D=X2(r,L4)(_[1],f);if(t===`horizontal`){var O=c.scale.map(_[0]),k=c.scale.map(_[1]);if(O==null||k==null)return null;x=IN({axis:s,ticks:l,bandSize:o,offset:a.offset,entry:e,index:f}),S=k??O??void 0,C=a.size;var A=O-k;if(w=GD(A)?0:A,T={x,y:p.top,width:C,height:p.height},Math.abs(D)>0&&Math.abs(w)<Math.abs(D)){var j=WD(w||D)*(Math.abs(D)-Math.abs(w));S-=j,w+=j}}else{var M=s.scale.map(_[0]),N=s.scale.map(_[1]);if(M==null||N==null)return null;if(x=M,S=IN({axis:c,ticks:u,bandSize:o,offset:a.offset,entry:e,index:f}),C=N-M,w=a.size,T={x:p.left,y:S,width:p.width,height:w},Math.abs(D)>0&&Math.abs(C)<Math.abs(D)){var P=WD(C||D)*(Math.abs(D)-Math.abs(C));C+=P}}return x==null||S==null||C==null||w==null||!i&&(C===0||w===0)?null:S4(S4({},e),{},{stackedBarStart:b,x,y:S,width:C,height:w,value:d?_:_[1],payload:e,background:T,tooltipPosition:{x:x+C/2,y:S+w/2},parentViewBox:h,originalDataIndex:f},m&&m[f]&&m[f].props)}).filter(Boolean)}function U4(e){var t=OO(e,B4),n=f4(t.stackId),r=hP();return v.createElement(x1,{id:t.id,type:`bar`},e=>v.createElement(v.Fragment,null,v.createElement(_1,{legendPayload:O4(t)}),v.createElement(k4,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),v.createElement(A1,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null}),v.createElement(LX,{zIndex:t.zIndex},v.createElement(V4,b4({},t,{id:e})))))}var W4=v.memo(U4,bI);W4.displayName=`Bar`;var G4=[`domain`,`range`],K4=[`domain`,`range`];function q4(e,t){if(e==null)return{};var n,r,i=J4(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function J4(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Y4(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function X4(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=q4(e,G4),{domain:a,range:o}=t,s=q4(t,K4);return!Y4(n,a)||!Y4(r,o)?!1:bI(i,s)}var Z4=[`type`],Q4=[`dangerouslySetInnerHTML`,`ticks`,`scale`],$4=[`id`,`scale`];function e3(){return e3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e3.apply(null,arguments)}function t3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?t3(Object(n),!0).forEach(function(t){r3(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function r3(e,t,n){return(t=i3(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i3(e){var t=a3(e,`string`);return typeof t==`symbol`?t:t+``}function a3(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o3(e,t){if(e==null)return{};var n,r,i=s3(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function s3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function c3(e){var t=Hk(),n=(0,v.useRef)(null),r=XP(),{type:i}=e,a=o3(e,Z4),o=Uz(r,`xAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return n3(n3({},a),{},{type:o})},[a,o]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(L1(s)):n.current!==s&&t(R1({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(z1(n.current)),null)},[t]),null}var l3=e=>{var{xAxisId:t,className:n}=e,r=Q(pP),i=hP(),a=`xAxis`,o=Q(e=>pJ(e,a,t,i)),s=Q(e=>tJ(e,t)),c=Q(e=>oJ(e,t)),l=Q(e=>mK(e,t));if(s==null||c==null||l==null)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:f}=e,p=o3(e,Q4),{id:m,scale:h}=l,g=o3(l,$4);return v.createElement(l2,e3({},p,g,{x:c.x,y:c.y,width:s.width,height:s.height,className:Yt(`recharts-${a} ${a}`,n),viewBox:r,ticks:o,axisType:a,axisId:t}))},u3={allowDataOverflow:pK.allowDataOverflow,allowDecimals:pK.allowDecimals,allowDuplicatedCategory:pK.allowDuplicatedCategory,angle:pK.angle,axisLine:e2.axisLine,height:pK.height,hide:!1,includeHidden:pK.includeHidden,interval:pK.interval,label:!1,minTickGap:pK.minTickGap,mirror:pK.mirror,orientation:pK.orientation,padding:pK.padding,reversed:pK.reversed,scale:pK.scale,tick:pK.tick,tickCount:pK.tickCount,tickLine:e2.tickLine,tickSize:e2.tickSize,type:pK.type,niceTicks:pK.niceTicks,xAxisId:0},d3=v.memo(e=>{var t=OO(e,u3);return v.createElement(v.Fragment,null,v.createElement(c3,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),v.createElement(l3,t))},X4);d3.displayName=`XAxis`;var f3=[`type`],p3=[`dangerouslySetInnerHTML`,`ticks`,`scale`],m3=[`id`,`scale`];function h3(){return h3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h3.apply(null,arguments)}function g3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?g3(Object(n),!0).forEach(function(t){v3(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v3(e,t,n){return(t=y3(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y3(e){var t=b3(e,`string`);return typeof t==`symbol`?t:t+``}function b3(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function x3(e,t){if(e==null)return{};var n,r,i=S3(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function S3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function C3(e){var t=Hk(),n=(0,v.useRef)(null),r=XP(),{type:i}=e,a=x3(e,f3),o=Uz(r,`yAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return _3(_3({},a),{},{type:o})},[o,a]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(B1(s)):n.current!==s&&t(V1({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(H1(n.current)),null)},[t]),null}function w3(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=Q(pP),c=hP(),l=Hk(),u=`yAxis`,d=Q(e=>cJ(e,t)),f=Q(e=>sJ(e,t)),p=Q(e=>pJ(e,u,t,c)),m=Q(e=>_K(e,t));if((0,v.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||t$(i)||(0,v.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(K1({id:t,width:n}))}}},[p,d,l,i,t,r,m]),d==null||f==null||m==null)return null;var{dangerouslySetInnerHTML:h,ticks:g,scale:_}=e,y=x3(e,p3),{id:b,scale:x}=m,S=x3(m,m3);return v.createElement(l2,h3({},y,S,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:d.width,height:d.height,className:Yt(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var T3={allowDataOverflow:gK.allowDataOverflow,allowDecimals:gK.allowDecimals,allowDuplicatedCategory:gK.allowDuplicatedCategory,angle:gK.angle,axisLine:e2.axisLine,hide:!1,includeHidden:gK.includeHidden,interval:gK.interval,label:!1,minTickGap:gK.minTickGap,mirror:gK.mirror,orientation:gK.orientation,padding:gK.padding,reversed:gK.reversed,scale:gK.scale,tick:gK.tick,tickCount:gK.tickCount,tickLine:e2.tickLine,tickSize:e2.tickSize,type:gK.type,niceTicks:gK.niceTicks,width:gK.width,yAxisId:0},E3=v.memo(e=>{var t=OO(e,T3);return v.createElement(v.Fragment,null,v.createElement(C3,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),v.createElement(w3,t))},X4);E3.displayName=`YAxis`;var D3=$([(e,t)=>t,JP,aB,mB,OY,AY,cX,dP],bX);function O3(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function k3(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(O3(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var A3=rM(`mouseClick`),j3=dN();j3.startListening({actionCreator:A3,effect:(e,t)=>{var n=e.payload,r=D3(t.getState(),k3(n));r?.activeIndex!=null&&t.dispatch(FJ({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var M3=rM(`mouseMove`),N3=dN(),P3=null,F3=null,I3=null;N3.startListening({actionCreator:M3,effect:(e,t)=>{var n=e.payload,{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i?.includes(`mousemove`);P3!==null&&(cancelAnimationFrame(P3),P3=null),F3!==null&&(typeof r!=`number`||!a)&&(clearTimeout(F3),F3=null),I3=k3(n);var o=()=>{var e=t.getState(),n=bJ(e,e.tooltip.settings.shared);if(!I3){P3=null,F3=null;return}if(n===`axis`){var r=D3(e,I3);r?.activeIndex==null?t.dispatch(MJ()):t.dispatch(PJ({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}P3=null,F3=null};if(!a){o();return}r===`raf`?P3=requestAnimationFrame(o):typeof r==`number`&&F3===null&&(F3=setTimeout(o,r))}});function L3(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<<CHILDREN>>`:t}var R3={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},z3=TM({name:`rootProps`,initialState:R3,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??R3.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),B3=z3.reducer,{updateOptions:V3}=z3.actions,H3=TM({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}}),{updatePolarOptions:U3}=H3.actions,W3=H3.reducer,G3=rM(`keyDown`),K3=rM(`focus`),q3=rM(`blur`),J3=dN(),Y3=null,X3=null,Z3=null;J3.startListening({actionCreator:G3,effect:(e,t)=>{Z3=e.payload,Y3!==null&&(cancelAnimationFrame(Y3),Y3=null);var{throttleDelay:n,throttledEvents:r}=t.getState().eventSettings,i=r===`all`||r.includes(`keydown`);X3!==null&&(typeof n!=`number`||!i)&&(clearTimeout(X3),X3=null);var a=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var{keyboardInteraction:n}=e.tooltip,r=Z3;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=XJ(n,gY(e),qK(e),TY(e)),a=i==null?-1:Number(i);if(!Number.isFinite(a)||a<0)return;var o=AY(e);if(r===`Enter`){var s=pX(e,`axis`,`hover`,String(n.index));t.dispatch(LJ({active:!n.active,activeIndex:n.index,activeCoordinate:s}));return}var c=gJ(e)===`left-to-right`?1:-1,l=a+(r===`ArrowRight`?1:-1)*c;if(o==null||l>=o.length||l<0)return;var u=pX(e,`axis`,`hover`,String(l));t.dispatch(LJ({active:!0,activeIndex:l.toString(),activeCoordinate:u}))}finally{Y3=null,X3=null}};if(!i){a();return}n===`raf`?Y3=requestAnimationFrame(a):typeof n==`number`&&X3===null&&(a(),Z3=null,X3=setTimeout(()=>{Z3?a():(X3=null,Y3=null)},n))}}),J3.startListening({actionCreator:K3,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&r.index==null){var i=`0`,a=pX(n,`axis`,`hover`,String(i));t.dispatch(LJ({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),J3.startListening({actionCreator:q3,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;r.active&&t.dispatch(LJ({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function Q3(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var $3=rM(`externalEvent`),e6=dN(),t6=new Map,n6=new Map,r6=new Map;e6.startListening({actionCreator:$3,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var i=r.type,a=Q3(r);r6.set(i,{handler:n,reactEvent:a});var o=t6.get(i);o!==void 0&&(cancelAnimationFrame(o),t6.delete(i));var{throttleDelay:s,throttledEvents:c}=t.getState().eventSettings,l=c,u=l===`all`||l?.includes(i),d=n6.get(i);d!==void 0&&(typeof s!=`number`||!u)&&(clearTimeout(d),n6.delete(i));var f=()=>{var e=r6.get(i);try{if(!e)return;var{handler:n,reactEvent:r}=e,a=t.getState(),o={activeCoordinate:BY(a),activeDataKey:LY(a),activeIndex:FY(a),activeLabel:IY(a),activeTooltipIndex:FY(a),isTooltipActive:VY(a)};n&&n(o,r)}finally{t6.delete(i),n6.delete(i),r6.delete(i)}};if(!u){f();return}if(s===`raf`){var p=requestAnimationFrame(f);t6.set(i,p)}else if(typeof s==`number`){if(!n6.has(i)){f();var m=setTimeout(f,s);n6.set(i,m)}}else f()}}});var i6=$([$([eY],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),a6=rM(`touchMove`),o6=dN(),s6=null,c6=null,l6=null,u6=null;o6.startListening({actionCreator:a6,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){u6=Q3(n);var{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i.includes(`touchmove`);s6!==null&&(cancelAnimationFrame(s6),s6=null),c6!==null&&(typeof r!=`number`||!a)&&(clearTimeout(c6),c6=null),l6=Array.from(n.touches).map(e=>k3({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var o=()=>{if(u6!=null){var e=t.getState(),n=bJ(e,e.tooltip.settings.shared);if(n===`axis`){var r=l6?.[0];if(r==null){s6=null,c6=null;return}var i=D3(e,r);i?.activeIndex!=null&&t.dispatch(PJ({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=u6.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(eP),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=mY(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var{dataKey:u}=l,d=i6(e,s,c);t.dispatch(AJ({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}s6=null,c6=null}};if(!a){o();return}r===`raf`?s6=requestAnimationFrame(o):typeof r==`number`&&c6===null&&(o(),u6=null,c6=setTimeout(()=>{u6?o():(c6=null,s6=null)},r))}}});var d6={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},f6=TM({name:`eventSettings`,initialState:d6,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=YF(t.payload.throttledEvents))}}}),{setEventSettings:p6}=f6.actions,m6=f6.reducer,h6=DA({brush:f0,cartesianAxis:q1,chartData:cZ,errorBars:I2,eventSettings:m6,graphicalItems:k1,layout:vN,legend:nI,options:tZ,polarAxis:k$,polarOptions:W3,referenceElements:S0,renderedTicks:W0,rootProps:B3,tooltip:RJ,zIndex:IX}),g6=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return hM({reducer:h6,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([j3.middleware,N3.middleware,J3.middleware,e6.middleware,o6.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(pM({type:`raf`}))},devTools:LI.devToolsEnabled&&{serialize:{replacer:L3},name:`recharts-${t}`}})};function _6(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=hP(),a=(0,v.useRef)(null);if(i)return n;a.current??=g6(t,r);var o=zk;return v.createElement(_I,{context:o,store:a.current},n)}function v6(e){var{layout:t,margin:n}=e,r=Hk(),i=hP();return(0,v.useEffect)(()=>{i||(r(hN(t)),r(mN(n)))},[r,i,t,n]),null}var y6=(0,v.memo)(v6,bI);function b6(e){var t=Hk();return(0,v.useEffect)(()=>{t(V3(e))},[t,e]),null}var x6=(0,v.memo)(e=>{var t=Hk();return(0,v.useEffect)(()=>{t(p6(e))},[t,e]),null},bI);function S6(e){var{zIndex:t,isPanorama:n}=e,r=(0,v.useRef)(null),i=Hk();return(0,v.useLayoutEffect)(()=>(r.current&&i(PX({zIndex:t,element:r.current,isPanorama:n})),()=>{i(FX({zIndex:t,isPanorama:n}))}),[i,t,n]),v.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function C6(e){var{children:t,isPanorama:n}=e,r=Q(SX);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return v.createElement(v.Fragment,null,i.map(e=>v.createElement(S6,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>v.createElement(S6,{key:e,zIndex:e,isPanorama:n})))}var w6=[`children`];function T6(e,t){if(e==null)return{};var n,r,i=E6(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function E6(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function D6(){return D6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},D6.apply(null,arguments)}var O6={width:`100%`,height:`100%`,display:`block`},k6=(0,v.forwardRef)((e,t)=>{var n=KP(),r=qP(),i=qI();if(!xN(n)||!xN(r))return null;var{children:a,otherAttributes:o,title:s,desc:c}=e,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),v.createElement($T,D6({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:O6,ref:t}),a)}),A6=e=>{var{children:t}=e,n=Q(_P);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return v.createElement($T,{width:r,height:i,x:o,y:a},t)},j6=(0,v.forwardRef)((e,t)=>{var{children:n}=e,r=T6(e,w6);return hP()?v.createElement(A6,null,v.createElement(C6,{isPanorama:!0},n)):v.createElement(k6,D6({ref:t},r),v.createElement(C6,{isPanorama:!1},n))});function M6(){var e=Hk(),[t,n]=(0,v.useState)(null),r=Q(XN);return(0,v.useEffect)(()=>{if(t!=null){var n=t.getBoundingClientRect().width/t.offsetWidth;bN(n)&&n!==r&&e(_N(n))}},[t,e,r]),n}function N6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?N6(Object(n),!0).forEach(function(t){F6(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F6(e,t,n){return(t=I6(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I6(e){var t=L6(e,`string`);return typeof t==`symbol`?t:t+``}function L6(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function R6(){return R6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},R6.apply(null,arguments)}var z6=()=>(yZ(),null);function B6(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var V6=(0,v.forwardRef)((e,t)=>{var n=(0,v.useRef)(null),[r,i]=(0,v.useState)({containerWidth:B6(e.style?.width),containerHeight:B6(e.style?.height)}),a=(0,v.useCallback)((e,t)=>{i(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),o=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null&&typeof ResizeObserver<`u`){var{width:r,height:i}=e.getBoundingClientRect();a(r,i);var o=new ResizeObserver(e=>{var t=e[0];if(t!=null){var{width:n,height:r}=t.contentRect;a(n,r)}});o.observe(e),n.current=o}},[t,a]);return(0,v.useEffect)(()=>()=>{n.current?.disconnect()},[a]),v.createElement(v.Fragment,null,v.createElement($P,{width:r.containerWidth,height:r.containerHeight}),v.createElement(`div`,R6({ref:o},e)))}),H6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,v.useState)({containerWidth:B6(n),containerHeight:B6(r)}),o=(0,v.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return v.createElement(v.Fragment,null,v.createElement($P,{width:i.containerWidth,height:i.containerHeight}),v.createElement(`div`,R6({ref:s},e)))}),U6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r}=e;return v.createElement(v.Fragment,null,v.createElement($P,{width:n,height:r}),v.createElement(`div`,R6({ref:t},e)))}),W6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r}=e;return typeof n==`string`||typeof r==`string`?v.createElement(H6,R6({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?v.createElement(U6,R6({},e,{width:n,height:r,ref:t})):v.createElement(v.Fragment,null,v.createElement($P,{width:n,height:r}),v.createElement(`div`,R6({ref:t},e)))});function G6(e){return e?V6:W6}var K6=(0,v.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:c,onMouseEnter:l,onMouseLeave:u,onMouseMove:d,onMouseUp:f,onTouchEnd:p,onTouchMove:m,onTouchStart:h,style:g,width:_,responsive:y,dispatchTouchEvents:b=!0}=e,x=(0,v.useRef)(null),S=Hk(),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(null),D=M6(),O=zP(),k=O?.width>0?O.width:_,A=O?.height>0?O.height:i,j=(0,v.useCallback)(e=>{D(e),typeof t==`function`&&t(e),w(e),E(e),e!=null&&(x.current=e)},[D,t,w,E]),M=(0,v.useCallback)(e=>{S(A3(e)),S($3({handler:a,reactEvent:e}))},[S,a]),N=(0,v.useCallback)(e=>{S(M3(e)),S($3({handler:l,reactEvent:e}))},[S,l]),P=(0,v.useCallback)(e=>{S(MJ()),S($3({handler:u,reactEvent:e}))},[S,u]),ee=(0,v.useCallback)(e=>{S(M3(e)),S($3({handler:d,reactEvent:e}))},[S,d]),F=(0,v.useCallback)(()=>{S(K3())},[S]),I=(0,v.useCallback)(()=>{S(q3())},[S]),te=(0,v.useCallback)(e=>{S(G3(e.key))},[S]),L=(0,v.useCallback)(e=>{S($3({handler:o,reactEvent:e}))},[S,o]),ne=(0,v.useCallback)(e=>{S($3({handler:s,reactEvent:e}))},[S,s]),re=(0,v.useCallback)(e=>{S($3({handler:c,reactEvent:e}))},[S,c]),R=(0,v.useCallback)(e=>{S($3({handler:f,reactEvent:e}))},[S,f]),ie=(0,v.useCallback)(e=>{S($3({handler:h,reactEvent:e}))},[S,h]),ae=(0,v.useCallback)(e=>{b&&S(a6(e)),S($3({handler:m,reactEvent:e}))},[S,b,m]),oe=(0,v.useCallback)(e=>{S($3({handler:p,reactEvent:e}))},[S,p]),se=G6(y);return v.createElement(qX.Provider,{value:C},v.createElement(aE.Provider,{value:T},v.createElement(se,{width:k??g?.width,height:A??g?.height,className:Yt(`recharts-wrapper`,r),style:P6({position:`relative`,cursor:`default`,width:k,height:A},g),onClick:M,onContextMenu:L,onDoubleClick:ne,onFocus:F,onBlur:I,onKeyDown:te,onMouseDown:re,onMouseEnter:N,onMouseLeave:P,onMouseMove:ee,onMouseUp:R,onTouchEnd:oe,onTouchMove:ae,onTouchStart:ie,ref:j},v.createElement(z6,null),n)))}),q6=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function J6(e,t){if(e==null)return{};var n,r,i=Y6(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Y6(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var X6=(0,v.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:c,title:l,desc:u}=e,d=KT(J6(e,q6));return c?v.createElement(v.Fragment,null,v.createElement($P,{width:n,height:r}),v.createElement(j6,{otherAttributes:d,title:l,desc:u},a)):v.createElement(K6,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},v.createElement(j6,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(w0,null,a)))});function Z6(){return Z6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Z6.apply(null,arguments)}function Q6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Q6(Object(n),!0).forEach(function(t){e8(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function e8(e,t,n){return(t=t8(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t8(e){var t=n8(e,`string`);return typeof t==`symbol`?t:t+``}function n8(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var r8=$6({accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,layout:`horizontal`,margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:`none`,syncMethod:`index`},d6),i8=(0,v.forwardRef)(function(e,t){var n=OO(e.categoricalChartProps,r8),{chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,categoricalChartProps:s}=e,c={chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,eventEmitter:void 0};return v.createElement(_6,{preloadedState:{options:c},reduxStoreName:s.id??r},v.createElement(c0,{chartData:s.data}),v.createElement(y6,{layout:n.layout,margin:n.margin}),v.createElement(x6,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(b6,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),v.createElement(X6,Z6({},n,{ref:t})))}),a8=[`axis`,`item`],o8=(0,v.forwardRef)((e,t)=>v.createElement(i8,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:a8,tooltipPayloadSearcher:$X,categoricalChartProps:e,ref:t})),s8={light:``,dark:`.dark`},c8={width:320,height:200},l8=v.createContext(null);function u8(){let e=v.useContext(l8);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function d8({id:e,className:t,children:n,config:r,initialDimension:i=c8,...a}){let o=v.useId(),s=`chart-${e??o.replace(/:/g,``)}`;return(0,H.jsx)(l8.Provider,{value:{config:r},children:(0,H.jsxs)(`div`,{"data-slot":`chart`,"data-chart":s,className:V(`flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden`,t),...a,children:[(0,H.jsx)(f8,{id:s,config:r}),(0,H.jsx)(VP,{initialDimension:i,children:n})]})})}var f8=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme??e.color);return n.length?(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(s8).map(([t,r])=>`
162
164
  ${r} [data-chart=${e}] {
163
165
  ${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:null}).join(`
164
166
  `)}
165
167
  }
166
168
  `).join(`
167
- `)}}):null},n8=yZ;function r8({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:s,labelClassName:c,formatter:l,color:u,nameKey:d,labelKey:f}){let{config:p}=$6(),m=v.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${f??e?.dataKey??e?.name??`value`}`,r=i8(p,e,n),a=!f&&typeof o==`string`?p[o]?.label??o:r?.label;return s?(0,H.jsx)(`div`,{className:V(`font-medium`,c),children:s(a,t)}):a?(0,H.jsx)(`div`,{className:V(`font-medium`,c),children:a}):null},[o,s,t,i,c,p,f]);if(!e||!t?.length)return null;let h=t.length===1&&r!==`dot`;return(0,H.jsxs)(`div`,{className:V(`grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[h?null:m,(0,H.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=`${d??e.name??e.dataKey??`value`}`,i=i8(p,e,n),o=u??e.payload?.fill??e.color;return(0,H.jsx)(`div`,{className:V(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:l&&e?.value!==void 0&&e.name?l(e.value,e.name,e,t,e.payload):(0,H.jsxs)(H.Fragment,{children:[i?.icon?(0,H.jsx)(i.icon,{}):!a&&(0,H.jsx)(`div`,{className:V(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"w-1":r===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"my-0.5":h&&r===`dashed`}),style:{"--color-bg":o,"--color-border":o}}),(0,H.jsxs)(`div`,{className:V(`flex flex-1 justify-between leading-none`,h?`items-end`:`items-center`),children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[h?m:null,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:i?.label??e.name})]}),e.value!=null&&(0,H.jsx)(`span`,{className:`font-mono font-medium text-foreground tabular-nums`,children:typeof e.value==`number`?e.value.toLocaleString():String(e.value)})]})]})},t)})})]})}function i8(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}function a8({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card`,className:V(`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 text-card-foreground`,e),...t})}function o8({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-header`,className:V(`grid gap-1`,e),...t})}function s8({className:e,...t}){return(0,H.jsx)(`h3`,{"data-slot":`card-title`,className:V(`text-sm font-semibold leading-snug`,e),...t})}function c8({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`card-description`,className:V(`text-xs text-muted-foreground`,e),...t})}function l8({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-content`,className:V(`min-w-0`,e),...t})}function u8({title:e,summary:t,emptyText:n,table:r,children:i,className:a,interactive:o=!1}){return(0,H.jsxs)(a8,{className:a,children:[(0,H.jsxs)(o8,{children:[(0,H.jsx)(s8,{children:e}),t&&!n?(0,H.jsx)(c8,{children:t}):null]}),(0,H.jsx)(l8,{children:n?(0,H.jsx)(`p`,{className:`flex min-h-40 items-center text-sm text-muted-foreground`,children:n}):(0,H.jsxs)(H.Fragment,{children:[o?i:(0,H.jsx)(`div`,{"aria-hidden":`true`,children:i}),(0,H.jsxs)(`table`,{className:`sr-only`,children:[(0,H.jsx)(`caption`,{children:e}),(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:r.columns.map(e=>(0,H.jsx)(`th`,{scope:`col`,children:e},e))})}),(0,H.jsx)(`tbody`,{children:r.rows.map((e,t)=>(0,H.jsx)(`tr`,{children:e.map((e,t)=>(0,H.jsx)(`td`,{children:e},t))},t))})]})]})})]})}var d8={pending:`var(--status-info)`,applied:`var(--status-success)`,rejected:`var(--destructive)`,stale:`var(--status-warning)`,undone:`var(--muted-foreground)`};function f8({proposals:e}){let t=X(),n=sT(e).map(e=>({...e,label:t(e.state)})),r={count:{label:t(`Proposals`),color:`var(--chart-1)`}},i=n[0]?.count??0;return(0,H.jsx)(u8,{title:t(`Proposal pipeline`),summary:zb(t(`{total} proposals, {pending} waiting for a decision`),{total:e.length,pending:i}),emptyText:e.length===0?t(`No proposals yet.`):``,table:{columns:[t(`State`),t(`Proposals`)],rows:n.map(e=>[e.label,e.count])},children:(0,H.jsx)(e8,{config:r,className:`aspect-auto h-44 w-full`,children:(0,H.jsxs)(Y6,{data:n,layout:`vertical`,accessibilityLayer:!1,margin:{top:0,right:28,left:0,bottom:0},children:[(0,H.jsx)(e3,{type:`number`,hide:!0,allowDecimals:!1}),(0,H.jsx)(h3,{type:`category`,dataKey:`label`,width:104,tickLine:!1,axisLine:!1}),(0,H.jsx)(n8,{cursor:{fill:`var(--interactive-hover)`},content:(0,H.jsx)(r8,{hideLabel:!0,nameKey:`count`})}),(0,H.jsxs)(N4,{dataKey:`count`,fill:`var(--color-count)`,radius:[0,2,2,0],children:[n.map(e=>(0,H.jsx)(bZ,{fill:d8[e.state]??`var(--color-count)`},e.state)),(0,H.jsx)(d$,{dataKey:`count`,position:`right`,className:`fill-foreground`})]})]})})})}var p8=`var(--status-success)`,m8=`var(--destructive)`;function h8(){let e=X();return{succeeded:{label:e(`Successful`),color:p8},failed:{label:e(`Failed`),color:m8}}}var g8={stroke:`var(--card)`,strokeWidth:1};function _8(){let e=X(),t=[{label:e(`Successful`),background:p8},{label:e(`Failed`),background:m8}];return(0,H.jsx)(`ul`,{className:`flex flex-wrap items-center justify-center gap-4 pt-3 text-xs`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[2px]`,style:{background:e.background}}),e.label]},e.label))})}var v8=26;function y8({skills:e,total:t,shown:n,onShown:r,onOpen:i,className:a}){let o=X(),s=h8(),c=e.slice(0,n).map(aT),l=c[0],u=e=>{let t=e?.payload;t&&i(t)};return(0,H.jsxs)(u8,{className:a,interactive:!0,title:o(`Most used skills`),summary:l?zb(o(`{name} leads with {uses} uses. Click a bar to open the skill.`),{name:l.name,uses:l.uses}):void 0,emptyText:c.length===0?o(`No skill was used in the last 30 days.`):``,table:{columns:[o(`Skill`),o(`Uses`),o(`Failed`)],rows:c.map(e=>[e.name,e.uses,e.failed])},children:[(0,H.jsxs)(`div`,{className:V(`flex gap-2`,c.length>16&&`overflow-y-auto overscroll-contain pt-8`),style:c.length>16?{maxHeight:`448px`}:void 0,children:[(0,H.jsx)(`ol`,{className:`w-[6.5rem] shrink-0`,"aria-label":o(`Most used skills`),children:c.map(e=>(0,H.jsx)(`li`,{className:`flex h-[26px] items-center justify-end`,children:(0,H.jsx)(zp,{content:e.name,className:`min-w-0 max-w-full`,children:(0,H.jsx)(`button`,{type:`button`,className:`block max-w-full truncate rounded-sm text-end text-xs hover:underline focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>i(e),children:e.name})})},`${e.name}\n${e.path??``}`))}),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`min-w-0 flex-1`,children:(0,H.jsx)(e8,{config:s,className:`aspect-auto w-full`,style:{height:`${c.length*v8}px`},children:(0,H.jsxs)(Y6,{data:c,layout:`vertical`,accessibilityLayer:!1,margin:{top:0,right:8,left:0,bottom:0},children:[(0,H.jsx)(e3,{type:`number`,hide:!0,allowDecimals:!1}),(0,H.jsx)(h3,{type:`category`,dataKey:`name`,hide:!0}),(0,H.jsx)(n8,{cursor:{fill:`var(--interactive-hover)`},content:(0,H.jsx)(r8,{})}),(0,H.jsx)(N4,{dataKey:`succeeded`,stackId:`uses`,fill:`var(--color-succeeded)`,cursor:`pointer`,onClick:u,...g8}),(0,H.jsx)(N4,{dataKey:`failed`,stackId:`uses`,fill:`var(--color-failed)`,radius:[0,2,2,0],cursor:`pointer`,onClick:u,...g8})]})})})]}),(0,H.jsx)(`div`,{"aria-hidden":`true`,children:(0,H.jsx)(_8,{})}),t>8?(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:zb(o(`Showing {shown} of {total}`),{shown:c.length,total:t})}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[c.length<e.length?(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(pT(n,e.length)),children:o(`Show more`)}):null,c.length>8?(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(8),children:o(`Show less`)}):null]})]}):null]})}function b8(e){let[t,n]=(0,v.useState)(8);return(0,H.jsx)(y8,{...e,shown:t,onShown:n})}var x8=e=>{let t=Math.ceil(Math.max(0,...e.map(e=>e.uses))*1.25);return Math.max(28,String(t).length*7+10)};function S8({rows:e,bucket:t,period:n,title:r,className:i}){let a=X(),o=h8(),s=$p(),c=t??`day`,l=e.map(aT),u=e.reduce((e,t)=>e+t.uses,0),d=e.reduce((e,t)=>e+t.failed,0),f=e=>CT(c,String(e),!1,s),p=t?e=>CT(c,String(e),!0,s):f,m={uses:Wb(u),failed:Wb(d)},h=a(t?`No uses in this period. Bars appear after OMMS records turns.`:`No uses in the last 30 days. Bars appear after OMMS records turns.`);return(0,H.jsxs)(u8,{className:i,title:r,summary:n?zb(a(`{period}: {uses} uses, {failed} with a failed tool call`),{period:n,...m}):zb(a(`{uses} uses, {failed} with a failed tool call`),m),emptyText:iT(e)?h:``,table:{columns:[a(hT[c]),a(`Uses`),a(`Failed`)],rows:e.map(e=>[p(e.key),e.uses,e.failed])},children:[(0,H.jsx)(e8,{config:o,className:`aspect-auto h-44 w-full`,children:(0,H.jsxs)(Y6,{data:l,accessibilityLayer:!1,margin:{top:4,right:0,left:0},children:[(0,H.jsx)(b2,{vertical:!1}),(0,H.jsx)(e3,{dataKey:`key`,tickLine:!1,axisLine:!1,minTickGap:c===`day`?24:8,tickFormatter:f}),(0,H.jsx)(h3,{width:x8(e),tickLine:!1,axisLine:!1,allowDecimals:!1,tickCount:3}),(0,H.jsx)(n8,{cursor:{fill:`var(--interactive-hover)`},content:(0,H.jsx)(r8,{labelFormatter:p})}),(0,H.jsx)(N4,{dataKey:`succeeded`,stackId:`uses`,fill:`var(--color-succeeded)`,...g8}),(0,H.jsx)(N4,{dataKey:`failed`,stackId:`uses`,fill:`var(--color-failed)`,radius:[2,2,0,0],...g8})]})}),(0,H.jsx)(_8,{})]})}var C8={months:[],years:[]},w8=`The use charts appear after OMMS records agent turns that use a skill.`;function T8(e,t,n){return e.bucket===`year`?`${n(`No skill uses are recorded yet.`)} ${n(w8)}`:e.bucket===`day`&&!e.month?n(`No skill uses are recorded in the last 30 days. The use charts appear after OMMS records agent turns that use a skill.`):`${zb(n(`No skill uses are recorded in {period}.`),{period:t})} ${n(w8)}`}function E8({activity:e,range:t,shownRange:n=t,loading:r,error:i,proposals:a,onOpen:o,onRange:s}){let c=X(),l=$p(),u=e!==null&&iT(e.series),d=e?wT(n,e.series,l,c):``,f=n.bucket===`day`&&!n.month,p=r&&e!==null,m=V(`transition-opacity duration-150`,p&&`opacity-60`);return(0,H.jsxs)(`section`,{id:`skills-section-activity`,className:`scroll-mt-4 space-y-3`,"aria-labelledby":`skills-activity-title`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`h2`,{id:`skills-activity-title`,className:`text-section-title font-semibold`,children:c(`Activity`)}),(0,H.jsx)(kT,{range:t,available:e?.available??C8,currentYear:new Date().getUTCFullYear(),loading:p,onChange:s})]}),i?(0,H.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:[c(`Activity could not load.`),` `,i]}):null,e===null&&!i?(0,H.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),c(`Loading…`)]}):null,(0,H.jsxs)(`div`,{"aria-busy":p||void 0,className:`space-y-3`,children:[e?(0,H.jsx)(`dl`,{className:V(`flex flex-wrap gap-x-6 gap-y-1 text-sm`,m),children:[[f?c(`Uses in 30 days`):zb(c(`Uses in {period}`),{period:d}),e.totals.uses],[c(`Failed turns`),e.totals.failed],[c(`Active skills`),e.totals.activeSkills]].map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`font-semibold tabular-nums`,children:Wb(Number(t))})]},e))}):null,e&&u?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T8(n,d,c)}):null,(0,H.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-3 lg:grid-cols-2`,children:[e&&!u?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S8,{className:V(`lg:col-span-2`,m),rows:e.series,bucket:e.bucket,period:d,title:c(mT[e.bucket])}),(0,H.jsx)(b8,{className:m,skills:e.topSkills,total:e.topTotal,onOpen:o},_T(n))]}):null,(0,H.jsx)(f8,{proposals:a})]})]})]})}function D8({proposals:e,onOpen:t,reloadKey:n}){let[r,i]=(0,v.useState)(()=>vT(ui(uT,uT))),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let e=!0;return u(!0),Rb.activity({...gT(r),top:100}).then(t=>{if(!e)return;if(!t.ok){c(t.error),u(!1);return}let n=tT(t.data),a=yT(r,n.available);if(a!==r){fi(uT,_T(a)),i(a);return}o({range:r,activity:n}),c(``),u(!1)}),()=>{e=!1}},[r,n]),(0,H.jsx)(E8,{activity:a?.activity??null,range:r,shownRange:a?.range??r,loading:l,error:s,proposals:e,onOpen:t,onRange:e=>{fi(uT,_T(e)),i(e)}})}function O8({className:e,...t}){return(0,H.jsx)(`nav`,{"data-slot":`pagination`,className:V(`mx-auto flex w-full justify-center`,e),...t})}function k8({className:e,...t}){return(0,H.jsx)(`ul`,{"data-slot":`pagination-content`,className:V(`flex flex-row flex-wrap items-center justify-center gap-1`,e),...t})}function A8({...e}){return(0,H.jsx)(`li`,{"data-slot":`pagination-item`,...e})}function j8({className:e,isActive:t,size:n=`icon-sm`,disabled:r,...i}){return(0,H.jsx)(`button`,{type:`button`,"aria-current":t?`page`:void 0,"aria-disabled":r||void 0,disabled:r,"data-slot":`pagination-button`,"data-active":t,className:V(Va({variant:t?`outline`:`ghost`,size:n}),`tabular-nums`,t&&`border-primary/40 bg-selection`,e),...i})}function M8({className:e,label:t,...n}){return(0,H.jsxs)(`span`,{"data-slot":`pagination-ellipsis`,className:V(`flex size-8 items-center justify-center`,e),...n,children:[(0,H.jsx)(xe,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:t})]})}var N8=[5,10,25,50,100],P8=(e,t)=>Array.from({length:t-e+1},(t,n)=>e+n);function F8(e,t,n=1){if(t<=1)return[];if(t<=n*2+5)return P8(1,t);let r=Math.max(e-n,1),i=Math.min(e+n,t),a=r>2,o=i<t-1,s=3+n*2;return!a&&o?[...P8(1,s),`...`,t]:a&&!o?[1,`...`,...P8(t-s+1,t)]:[1,`...`,...P8(r,i),`...`,t]}var I8=(e,t)=>Math.max(1,Math.ceil(Math.max(0,e)/Math.max(1,t))),L8=(e,t,n)=>Math.min(Math.max(1,Math.floor(e)||1),I8(t,n));function R8(e,t,n){let r=L8(e,n,t),i=n===0?0:(r-1)*t+1;return{page:r,pageCount:I8(n,t),from:i,to:Math.min(n,r*t),total:n}}function z8(e,t,n,r){let{from:i,to:a}=R8(e,t,n);return!r||n===0?{offset:Math.max(0,i-1),limit:t}:{offset:n-a,limit:a-i+1}}function B8(e){let t=[...N8];return t.includes(e)?t:[...t,e].sort((e,t)=>e-t)}function V8(e,t){let n=Number.parseInt(e.trim(),10);return Number.isNaN(n)||n<1?t:Math.min(n,200)}function H8(e,t,n){let r=n===`asc`?1:-1;return e.map((e,t)=>({item:e,index:t})).sort((e,n)=>r*t(e.item,n.item)||e.index-n.index).map(({item:e})=>e)}function U8(e){try{let t=localStorage.getItem(e);if(!t)return null;let n=JSON.parse(t),r=V8(String(n.perPage??``),5),i=n.order===`asc`||n.order===`desc`?n.order:void 0;return{perPage:r,sort:typeof n.sort==`string`?n.sort:void 0,order:i}}catch{return null}}function W8(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function G8(e,t){return e.key===t?e:{page:1,key:t}}function K8(e,t,n){let r=e.find(n=>n.value===e.find(e=>e.value===t)?.flip);return r?{sort:r.value,order:r.first}:{sort:t,order:n===`asc`?`desc`:`asc`}}function q8({view:e}){let t=X(),n=(0,v.useRef)(null),r=(0,v.useRef)(!1);(0,v.useEffect)(()=>{r.current&&(r.current=!1,n.current?.querySelector(`[aria-current="page"]`)?.focus())},[e.page]);let i=F8(e.page,e.pageCount);if(i.length===0)return null;let a=t=>{r.current=t===1||t===e.pageCount,e.setPage(t)};return(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 pt-1`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground tabular-nums`,children:zb(t(`Showing {from} to {to} of {total} results`),{from:e.from,to:e.to,total:e.total})}),(0,H.jsx)(O8,{ref:n,"aria-label":t(`pagination`),children:(0,H.jsxs)(k8,{children:[(0,H.jsx)(A8,{children:(0,H.jsxs)(j8,{size:`sm`,className:`gap-1 px-2.5`,"aria-label":t(`Go to previous page`),disabled:e.page<=1,onClick:()=>a(e.page-1),children:[(0,H.jsx)(se,{className:`rtl:-scale-x-100`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:t(`Previous`)})]})}),i.map((n,r)=>n===`...`?(0,H.jsx)(A8,{children:(0,H.jsx)(M8,{label:t(`More pages`)})},`gap-${r}`):(0,H.jsx)(A8,{children:(0,H.jsx)(j8,{isActive:n===e.page,"aria-label":zb(t(`Go to page {page}`),{page:n}),onClick:()=>n===e.page?void 0:a(n),children:n})},n)),(0,H.jsx)(A8,{children:(0,H.jsxs)(j8,{size:`sm`,className:`gap-1 px-2.5`,"aria-label":t(`Go to next page`),disabled:e.page>=e.pageCount,onClick:()=>a(e.page+1),children:[(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:t(`Next`)}),(0,H.jsx)(ce,{className:`rtl:-scale-x-100`,"aria-hidden":`true`})]})})]})})]})}var J8=()=>(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`hidden text-muted-foreground/50 sm:inline`,children:`|`});function Y8({view:e,totalLabel:t}){let n=X(),[r,i]=(0,v.useState)(null),a=()=>{if(r===null)return;let t=V8(r,e.perPage);i(null),t!==e.perPage&&e.setPerPage(t)},o=e=>{e.key===`Enter`&&a()},s=e.order===`asc`,c=s?ee:M;return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-2 text-sm text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:n(`Show`)}),(0,H.jsx)(Er,{className:`h-8 w-fit`,value:e.perPage,"aria-label":n(`Results per page`),onChange:t=>e.setPerPage(Number(t.target.value)),children:B8(e.perPage).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))}),(0,H.jsx)(`span`,{children:n(`results`)})]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(J8,{}),(0,H.jsx)(`span`,{children:n(`Custom:`)}),(0,H.jsx)(id,{type:`number`,inputMode:`numeric`,min:1,max:200,className:`h-8 w-20 tabular-nums`,value:r??String(e.perPage),"aria-label":n(`Custom results per page`),onChange:e=>i(e.target.value),onKeyDown:o,onBlur:a})]}),e.sorts.length>0?(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(J8,{}),(0,H.jsx)(`span`,{children:n(`Sort by`)}),(0,H.jsx)(Er,{className:`h-8 w-fit`,value:e.sort,"aria-label":n(`Sort by`),onChange:t=>{let n=e.sorts.find(e=>e.value===t.target.value);n&&e.setSort(n.value,n.first)},children:e.sorts.map(e=>(0,H.jsx)(`option`,{value:e.value,children:n(e.label)},e.value))}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":n(s?`Sort descending`:`Sort ascending`),title:n(s?`Sort descending`:`Sort ascending`),onClick:()=>{let t=K8(e.sorts,e.sort,e.order);e.setSort(t.sort,t.order)},children:(0,H.jsx)(c,{className:`size-3.5`,"aria-hidden":`true`})})]}):null,(0,H.jsx)(`span`,{className:`ms-auto tabular-nums`,children:t})]})}function X8({view:e,totalLabel:t,children:n}){return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(Y8,{view:e,totalLabel:t}),n,(0,H.jsx)(q8,{view:e})]})}function Z8(e,t){let n=U8(e),r=t.find(e=>e.value===n?.sort)??t[0];return{perPage:n?.perPage??5,sort:r.value,order:(n?.sort===r.value?n.order:void 0)??r.first}}function Q8({storageKey:e,total:t,sorts:n,resetKey:r=``}){let[i,a]=(0,v.useState)(()=>Z8(e,n)),[o,s]=(0,v.useState)({page:1,key:r}),c=G8(o,r);c!==o&&s(c);let l=R8(c.page,i.perPage,t),u=t=>{a(t),W8(e,t),s({page:1,key:r})};return{...l,...i,sorts:n,setPage:e=>s({page:e,key:r}),setPerPage:e=>u({...i,perPage:e}),setSort:(e,t)=>u({...i,sort:e,order:t})}}function $8({items:e,sorts:t,...n}){let r=Q8({...n,sorts:t,total:e.length}),i=(t.find(e=>e.value===r.sort)??t[0]).compare;return{view:r,pageItems:(0,v.useMemo)(()=>H8(e,i,r.order),[e,i,r.order]).slice(Math.max(0,r.from-1),r.to)}}var e5=(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}),t5=[{value:`uses`,label:`Most used`,first:`desc`,compare:(e,t)=>e.uses-t.uses},{value:`attention`,label:`Needs attention`,first:`desc`,compare:(e,t)=>e.attention-t.attention},{value:`name`,label:`Name (A–Z)`,first:`asc`,compare:e5},{value:`lastUsed`,label:`Last used`,first:`desc`,compare:(e,t)=>(e.lastUsedAt??0)-(t.lastUsedAt??0)},{value:`failed`,label:`Failed turns`,first:`desc`,compare:(e,t)=>e.failedTurns-t.failedTurns}],n5=[`pending`,`applied`,`rejected`,`stale`,`undone`],r5=(e,t)=>e.updatedAt-t.updatedAt,i5=[{value:`newest`,label:`Newest`,first:`desc`,flip:`oldest`,compare:r5},{value:`oldest`,label:`Oldest`,first:`asc`,flip:`newest`,compare:r5},{value:`state`,label:`State`,first:`asc`,compare:(e,t)=>n5.indexOf(e.state)-n5.indexOf(t.state)},{value:`skill`,label:`Skill`,first:`asc`,compare:(e,t)=>e5({name:e.skillName},{name:t.skillName})}],a5=[{value:`newest`,label:`Newest`,first:`desc`,flip:`oldest`},{value:`oldest`,label:`Oldest`,first:`asc`,flip:`newest`}],o5=e=>e.order===`asc`;function s5({label:e,colourKey:t=e,className:n}){let r=ed(t);return(0,H.jsx)(`span`,{className:V(`inline-flex min-h-6 max-w-full items-center rounded-[7px] border px-2 text-xs break-words`,`[color:oklch(0.42_0.13_var(--keyword-hue))] dark:[color:oklch(0.8_0.13_var(--keyword-hue))]`,n),style:{backgroundColor:`oklch(0.72 0.14 ${r} / 0.18)`,borderColor:`oklch(0.72 0.14 ${r} / 0.45)`,"--keyword-hue":String(r)},children:e})}var c5={add:`bg-status-success/15 text-status-success`,del:`bg-destructive/10 text-destructive-label`,hunk:`text-status-info`,ctx:`text-muted-foreground`};function l5({diff:e,label:t}){return(0,H.jsx)(`pre`,{dir:`ltr`,tabIndex:0,"aria-label":t,className:`max-h-96 overflow-auto rounded-lg border border-border bg-background py-1 font-mono text-xs leading-5`,children:Ub(e).map((e,t)=>(0,H.jsx)(`code`,{"data-line":e.kind,className:V(`block px-2 whitespace-pre`,c5[e.kind]),children:e.text||` `},t))})}function u5({turns:e}){let t=X();return e.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`No recorded turns.`)}):(0,H.jsx)(`ul`,{className:`space-y-3`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`min-w-0 space-y-1 rounded-xl border border-border bg-card px-3 py-2.5`,children:[(0,H.jsx)(`p`,{className:`line-clamp-3 break-words text-sm`,dir:`auto`,children:e.promptPreview||t(`(empty prompt)`)}),(0,H.jsxs)(`p`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:Yp(e.createdAt)}),(0,H.jsx)(`span`,{dir:`ltr`,children:e.host}),e.projectName?(0,H.jsx)(`bdi`,{children:e.projectName}):null,e.failedToolCalls>0?(0,H.jsx)(`span`,{className:`text-destructive-label`,children:zb(t(e.failedToolCalls===1?`{count} failed tool call`:`{count} failed tool calls`),{count:e.failedToolCalls})}):null]})]},e.id))})}function d5({savedContent:e}){let t=X();return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:t(`Undo stopped because the file changed. This is the content OMMS saved:`)}),e===null?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`No content was saved.`)}):(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-h-72 overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,children:e})]})}var f5=(e,t)=>({...e,state:`stale`,updatedAt:t}),p5={applied:`Applied {date}`,rejected:`Rejected {date}`,undone:`Undone {date}`,stale:`Stale since {date}`};function m5({proposal:e}){let t=X(),n=e.state===`pending`?null:p5[e.state];return(0,H.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:zb(t(`Created {date}`),{date:Yp(e.createdAt)})}),n?(0,H.jsx)(`span`,{children:zb(t(n),{date:Yp(e.updatedAt)})}):null]})}function h5({proposal:e,onChange:t}){let n=X(),r=Vb(e),i=e.state===`pending`,a=(0,v.useId)(),o=e.canUndo!==!1,[s,c]=(0,v.useState)(i),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{if(!s||l||e.evidenceTurnIds.length===0)return;let t=!0;return Rb.proposal(e.id).then(e=>{t&&e.ok&&u(e.data.evidence)}),()=>{t=!1}},[s,l,e.id,e.evidenceTurnIds.length]);async function _(n){f(!0),m(``),g(void 0);let r=await n();f(!1),r.ok?t(r.data.proposal):(m(r.error),r.code===`changed`&&g(r.savedContent??null),r.code===`stale`&&t(f5(e,Date.now())))}return(0,H.jsxs)(`article`,{className:`min-w-0 space-y-3 rounded-xl border border-border bg-card p-3`,children:[(0,H.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-semibold`,children:e.skillName}),(0,H.jsx)(s5,{label:n(r),colourKey:r}),(0,H.jsx)(s5,{label:n(e.kind===`new`?`New skill`:`Improvement`),colourKey:e.kind}),(0,H.jsx)(m5,{proposal:e})]}),e.summary?(0,H.jsx)(`p`,{className:`text-sm`,dir:`auto`,children:e.summary}):null,e.state===`stale`?(0,H.jsx)($b,{tone:`warning`,children:(0,H.jsx)(`p`,{children:n(`Stale: the file changed since this draft`)})}):null,i?null:(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-expanded":s,onClick:()=>c(e=>!e),children:n(s?`Hide changes`:`Show changes`)}),s?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[e.diff?(0,H.jsx)(l5,{diff:e.diff,label:n(`Changes to SKILL.md`)}):(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-h-96 overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,children:e.content}),e.evidenceTurnIds.length>0?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`h4`,{className:`text-sm font-medium`,children:n(`Evidence turns`)}),l?(0,H.jsx)(u5,{turns:l}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Loading…`)})]}):null]}):null,i||e.state===`applied`?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{type:`button`,size:`sm`,disabled:d,onClick:()=>void _(()=>Rb.apply(e.id)),children:[(0,H.jsx)(ae,{"aria-hidden":`true`}),n(`Apply`)]}),(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`sm`,disabled:d,onClick:()=>void _(()=>Rb.reject(e.id)),children:[(0,H.jsx)(Kt,{"aria-hidden":`true`}),n(`Reject`)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:d||!o,"aria-describedby":o?void 0:a,onClick:()=>void _(()=>Rb.undo(e.id)),children:[(0,H.jsx)(Bt,{"aria-hidden":`true`}),n(`Undo`)]}),o?null:(0,H.jsx)(`span`,{id:a,className:`self-center text-xs text-muted-foreground`,children:n(`Revert the newer change first.`)})]})}):null,p?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:p}):null,h===void 0?null:(0,H.jsx)(d5,{savedContent:h})]})}function g5({storageKey:e,proposals:t,onChange:n}){let r=X(),{view:i,pageItems:a}=$8({storageKey:e,items:t,sorts:i5});return(0,H.jsx)(X8,{view:i,totalLabel:zb(r(i.total===1?`{count} proposal`:`{count} proposals`),{count:i.total}),children:(0,H.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,H.jsx)(h5,{proposal:e,onChange:n},e.id))})})}function _5(){let[e,t]=(0,v.useState)({kind:`none`});return{value:e,clear:()=>t({kind:`none`}),show:e=>{e.ok?t(e.code===`no-change`?{kind:`no-change`}:{kind:`none`}):t(e.code===`not-configured`?{kind:`not-configured`}:{kind:`error`,text:e.error})}}}function v5({notice:e}){let t=X();if(e.kind===`none`)return null;if(e.kind===`no-change`)return(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:t(`No change proposed`)});if(e.kind===`error`)return(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:e.text});let n=`${J.settings}#settings-section-external-api`;return(0,H.jsxs)($b,{tone:`info`,children:[(0,H.jsx)(`p`,{children:t(`Drafting needs the external API. Set it up first.`)}),(0,H.jsx)(`a`,{className:`underline`,href:n,onClick:e=>{e.preventDefault(),gf(n)},children:t(`External API`)})]})}var y5=[`manual`,`automatic`];function b5({mode:e,disabled:t,confirming:n,onSelect:r,onConfirm:i,onCancel:a}){let o=X();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":o(`Mode`),className:`inline-flex gap-1.5`,children:y5.map(n=>(0,H.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===n,disabled:t,className:V(`min-h-9 rounded-[10px] border px-3 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50`,e===n?`border-primary/40 bg-selection text-foreground`:`border-input bg-card text-muted-foreground hover:bg-interactive-hover`),onClick:()=>r(n),children:o(n===`manual`?`Manual`:`Automatic`)},n))}),n?(0,H.jsxs)($b,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:o(`Turn on Automatic mode for this skill?`)}),(0,H.jsx)(`p`,{children:o(`OMMS will change this SKILL.md file without asking. It drafts an improvement after 10 new uses and at least 24 hours, then applies it. Each change can be undone.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,size:`sm`,disabled:t,onClick:i,children:o(`Turn on Automatic`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:a,children:o(`Cancel`)})]})]}):null]})}function x5({mode:e,disabled:t,onChoose:n}){let[r,i]=(0,v.useState)(!1);return(0,H.jsx)(b5,{mode:e,disabled:t,confirming:r,onSelect:t=>{t!==e&&(t===`automatic`?i(!0):(i(!1),n(t)))},onConfirm:()=>{i(!1),n(`automatic`)},onCancel:()=>i(!1)})}var S5=e=>e.kind===`applied`&&e.appliedBy===`automatic`?`applied automatically`:e.kind;function C5({entry:e,confirming:t,working:n,locked:r,onAsk:i,onConfirm:a,onCancel:o}){let s=X(),c=(0,v.useId)(),l=S5(e),u=e.added>0||e.removed>0;return(0,H.jsxs)(`li`,{className:`relative min-w-0 space-y-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -start-[21.5px] top-1.5 size-2.5 rounded-full border-2 border-background`,style:{backgroundColor:`oklch(0.66 0.14 ${ed(l)})`}}),(0,H.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(s5,{label:s(l),colourKey:l}),(0,H.jsx)(`time`,{dateTime:new Date(e.at).toISOString(),className:`text-xs text-muted-foreground`,children:Yp(e.at)}),u?(0,H.jsxs)(`span`,{className:`font-mono text-xs tabular-nums`,dir:`ltr`,"aria-label":zb(s(`{added} lines added, {removed} lines removed`),{added:e.added,removed:e.removed}),children:[(0,H.jsxs)(`span`,{className:`text-status-success`,children:[`+`,e.added]}),` `,(0,H.jsxs)(`span`,{className:`text-destructive-label`,children:[`−`,e.removed]})]}):null]}),e.summary?(0,H.jsx)(`p`,{className:`break-words text-sm`,dir:`auto`,children:e.summary}):null,e.kind===`applied`?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-0.5`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:!e.canUndo||r||t,"aria-describedby":e.canUndo?void 0:c,onClick:i,children:[(0,H.jsx)(Bt,{"aria-hidden":`true`}),s(`Revert to before this change`)]}),e.canUndo?null:(0,H.jsx)(`span`,{id:c,className:`text-xs text-muted-foreground`,children:s(`Revert the newer change first.`)}),n?(0,H.jsxs)(`span`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),s(`Reverting…`)]}):null]}):null,t?(0,H.jsxs)($b,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:s(`Revert this change?`)}),(0,H.jsx)(`p`,{children:s(`OMMS restores SKILL.md as it was before this change.`)}),e.laterAppliedCount>0?(0,H.jsx)(`p`,{className:`font-medium`,children:zb(s(e.laterAppliedCount===1?`Reverting this also removes {count} later change.`:`Reverting this also removes {count} later changes.`),{count:e.laterAppliedCount})}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,size:`sm`,disabled:n||r,onClick:a,children:s(`Revert`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:o,children:s(`Cancel`)})]})]}):null]})}function w5(e){let t=X(),{view:n,entries:r,loaded:i,error:a,notice:o,refreshing:s=!1}=e;return(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`skill-history-title`,children:[(0,H.jsx)(`h3`,{id:`skill-history-title`,className:`text-section-title font-semibold`,children:t(`History`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Each proposal, apply, reject and undo of this skill. Revert an applied change to restore SKILL.md as it was before it.`)}),o?.tone===`done`?(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-status-success`,children:t(`Reverted. SKILL.md is back to the version before that change.`)}):null,o?.tone===`error`?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:o.text}),o.savedContent===void 0?null:(0,H.jsx)(d5,{savedContent:o.savedContent})]}):null,a?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:a}):i?n.total===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`No history yet.`)}):(0,H.jsx)(X8,{view:n,totalLabel:zb(t(n.total===1?`{count} entry`:`{count} entries`),{count:n.total}),children:(0,H.jsx)(`ol`,{"aria-busy":s,className:`ms-1.5 space-y-4 border-s border-border ps-4 transition-opacity ${s?`opacity-60`:``}`,children:r.map(t=>(0,H.jsx)(C5,{entry:t,confirming:e.confirmId===t.id,working:e.workingId===t.id,locked:e.workingId!==null||s,onAsk:()=>e.onAsk(t),onConfirm:()=>e.onConfirm(t),onCancel:e.onCancel},t.id))})}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Loading…`)})]})}function T5({skill:e,reloadKey:t,onChanged:n}){let[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),b=Q8({storageKey:`omms-list-skill-history`,total:r,sorts:a5}),x=o5(b),{offset:S,limit:C}=z8(b.page,b.perPage,r,x),w=`${e.path}|${e.name}|${C}|${S}|${x}|${t}`;(0,v.useEffect)(()=>{let t=!0;return Rb.history(e.path,e.name,{limit:C,offset:S}).then(e=>{if(!t)return;if(c(!0),!e.ok)return f(e.error);let n=rT(e.data);f(``),i(n.total);let r=n.entries.slice(0,C);o(x?r.reverse():r),u(w)}),()=>{t=!1}},[e.path,e.name,C,S,x,t,w]);async function T(e){m(null),g(e.id),y(null);let t=await Rb.undo(e.proposalId);if(g(null),t.ok){y({tone:`done`}),n();return}y({tone:`error`,text:t.error,...t.code===`changed`?{savedContent:t.savedContent??null}:{}})}return(0,H.jsx)(w5,{view:b,entries:a,loaded:s,error:d,confirmId:p,workingId:h,notice:_,refreshing:s&&l!==w,onAsk:e=>{y(null),m(e.id)},onConfirm:e=>void T(e),onCancel:()=>m(null)})}function E5({skill:e,reloadKey:t}){let n=X(),[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),l=Q8({storageKey:`omms-list-skill-turns`,total:r,sorts:a5}),u=o5(l),{offset:d,limit:f}=z8(l.page,l.perPage,r,u);return(0,v.useEffect)(()=>{let t=!0;return Rb.skill(e.path,e.name,{limit:f,offset:d}).then(e=>{if(!t)return;if(!e.ok)return c(e.error);let n=(e.data.recentTurns??[]).slice(0,f);c(``),i(e.data.turnTotal??n.length),o(u?n.reverse():n)}),()=>{t=!1}},[e.path,e.name,f,d,u,t]),(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`skill-turns-title`,children:[(0,H.jsx)(`h3`,{id:`skill-turns-title`,className:`text-section-title font-semibold`,children:n(`Recent turns`)}),s?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:s}):a===null?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Loading…`)}):r===0?(0,H.jsx)(u5,{turns:[]}):(0,H.jsx)(X8,{view:l,totalLabel:zb(n(r===1?`{count} turn`:`{count} turns`),{count:r}),children:(0,H.jsx)(u5,{turns:a})})]})}var D5=e=>e.ok?``:e.error;function O5({skill:e,onBack:t,onChanged:n}){let r=X(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(e.mode),[f,p]=(0,v.useState)(``),m=_5(),[h,g]=(0,v.useState)(0),_=(0,v.useCallback)(async()=>{let t=await Rb.skill(e.path,e.name,{limit:1,offset:0});t.ok&&a(t.data),s(D5(t))},[e.path,e.name]),y=()=>{g(e=>e+1),_(),n()};(0,v.useEffect)(()=>{_()},[_]);async function b(){l(!0),m.clear();let t=await Rb.draftImprovement(e.path??e.name);l(!1),m.show(t),t.ok&&y()}async function x(t){if(!e.path)return;p(``);let r=await Rb.setMode(e.path,t);r.ok?(d(t),n()):p(r.error)}function S(e){a(t=>t&&{...t,proposals:t.proposals.map(t=>t.id===e.id?e:t)}),g(e=>e+1)}let C=i?.proposals??[];return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,H.jsx)(N,{className:`rtl:-scale-x-100`,"aria-hidden":`true`}),r(`All skills`)]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`min-w-0 break-words text-section-title font-semibold`,children:e.name}),e.suggested?(0,H.jsx)(s5,{label:r(`Suggested`),colourKey:`Suggested`}):null,(0,H.jsx)(s5,{label:r(u===`manual`?`Manual`:`Automatic`),colourKey:u})]}),e.path?(0,H.jsx)(`p`,{dir:`ltr`,className:`break-all font-mono text-xs text-start text-muted-foreground`,children:e.path}):(0,H.jsx)($b,{tone:`info`,children:(0,H.jsx)(`p`,{children:r(`Not in a watched folder`)})}),(0,H.jsx)(`dl`,{className:`grid max-w-xl grid-cols-1 gap-3 text-sm sm:grid-cols-3`,children:[[r(`Uses in 30 days`),Wb(e.uses)],[r(`Failed turns`),Wb(e.failedTurns)],[r(`Last use`),e.lastUsedAt?Yp(e.lastUsedAt):r(`Never`)]].map(([e,t])=>(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`font-medium`,children:t})]},e))})]}),i?(0,H.jsx)(S8,{className:`max-w-3xl`,rows:Zw(Xw(i.daily)),title:r(`Uses in the last 30 days`)}):null,e.path?(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":r(`Mode`),children:[(0,H.jsx)(`h3`,{className:`text-section-title font-semibold`,children:r(`Mode`)}),(0,H.jsx)(x5,{mode:u,disabled:c,onChoose:e=>void x(e)}),f?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:f}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pt-1`,children:[(0,H.jsxs)(G,{type:`button`,size:`sm`,disabled:c,onClick:()=>void b(),children:[(0,H.jsx)(kt,{"aria-hidden":`true`}),r(`Draft improvement`)]}),c?(0,H.jsxs)(`span`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),r(`Drafting… This can take a few minutes.`)]}):null]}),(0,H.jsx)(v5,{notice:m.value})]}):null,(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`skill-proposals-title`,children:[(0,H.jsx)(`h3`,{id:`skill-proposals-title`,className:`text-section-title font-semibold`,children:r(`Proposals`)}),o?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:o}):C.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`No proposals yet.`)}):(0,H.jsx)(g5,{storageKey:`omms-list-skill-proposals`,proposals:C,onChange:S})]}),(0,H.jsx)(T5,{skill:e,reloadKey:h,onChanged:y}),(0,H.jsx)(E5,{skill:e,reloadKey:h})]})}function k5({folders:e,onChanged:t}){let n=X(),{snapshot:r,busy:i,save:a}=rx(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),u=e.map(e=>e.path),d=r?.settings.skillFolders?.source===`global`;async function f(e){l(``);let n=await a({skillFolders:e});n?l(n):(s(``),t())}return(0,H.jsxs)(`section`,{id:`skills-section-folders`,className:`scroll-mt-4 space-y-3`,"aria-label":n(`Watched folders`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:n(`Watched folders`)}),d?(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(null),children:[(0,H.jsx)(Ct,{"aria-hidden":`true`}),n(`Reset default`)]}):null]}),e.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`No folders are watched.`)}):(0,H.jsx)(`ul`,{className:`space-y-3`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 rounded-xl border border-border bg-card px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{dir:`ltr`,className:`break-all font-mono text-xs text-start`,children:e.path}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.exists?zb(n(e.skills===1?`{count} skill`:`{count} skills`),{count:e.skills}):n(`Folder not found`)})]}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:i,"aria-label":zb(n(`Remove folder {path}`),{path:e.path}),title:n(`Remove folder`),onClick:()=>void f(qb(u,e.path)),children:(0,H.jsx)(Kt,{"aria-hidden":`true`})})]},e.path))}),(0,H.jsxs)(`form`,{className:`flex flex-wrap items-center gap-3`,onSubmit:e=>{e.preventDefault(),o.trim()&&f(Kb(u,o))},children:[(0,H.jsx)(id,{dir:`ltr`,className:`max-w-md flex-1 basis-60`,value:o,placeholder:`~/.agents/skills`,"aria-label":n(`Folder path`),onChange:e=>s(e.target.value)}),(0,H.jsxs)(G,{type:`submit`,variant:`outline`,size:`sm`,disabled:i||!o.trim(),children:[(0,H.jsx)(ke,{"aria-hidden":`true`}),n(`Add folder`)]})]}),c?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:c}):null]})}function A5({idea:e,folders:t,onDrafted:n}){let r=X(),[i,a]=(0,v.useState)(t[0]?.path??``),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=_5();async function d(){s(!0),u.clear();let t=await Rb.draftNew(e,i);s(!1),u.show(t),t.ok&&t.data.proposal&&(l(t.data.proposal),n())}return(0,H.jsxs)(`li`,{className:`min-w-0 space-y-3 rounded-xl border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`h3`,{className:`break-words text-sm font-semibold`,children:e.name}),(0,H.jsx)(`p`,{className:`text-sm`,dir:`auto`,children:e.description}),e.reason?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,dir:`auto`,children:e.reason}):null,e.evidenceTurnIds.length>0?(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r(`Evidence turns`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,children:e.evidenceTurnIds.map(e=>`T${e}`).join(`, `)})]}):null]}),c?(0,H.jsx)(h5,{proposal:c,onChange:l}):(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,H.jsxs)(`label`,{className:`min-w-0 max-w-full space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:r(`Folder for the new skill`)}),(0,H.jsx)(Er,{value:i,disabled:o,"aria-label":r(`Folder for the new skill`),onChange:e=>a(e.target.value),children:t.map(e=>(0,H.jsx)(`option`,{value:e.path,children:e.path},e.path))})]}),(0,H.jsxs)(G,{type:`button`,size:`sm`,disabled:o||!i,onClick:()=>void d(),children:[(0,H.jsx)(kt,{"aria-hidden":`true`}),r(`Draft skill`)]})]}),(0,H.jsx)(v5,{notice:u.value})]})}function j5({folders:e,onDrafted:t}){let n=X(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),s=_5();async function c(){o(!0),s.clear();let e=await Rb.ideas();o(!1),s.show(e),e.ok&&i(e.data.ideas)}return(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`New skill ideas`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:a,onClick:()=>void c(),children:[(0,H.jsx)(Ge,{"aria-hidden":`true`}),n(`Find new skill ideas`)]}),a?(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:n(`Looking…`)}):null]}),(0,H.jsx)(v5,{notice:s.value}),r&&r.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`No new skill ideas in the recorded turns.`)}):null,r&&r.length>0?(0,H.jsx)(`ul`,{className:`space-y-3`,children:r.map(n=>(0,H.jsx)(A5,{idea:n,folders:e,onDrafted:t},n.name))}):null]})}function M5(e,t){return e.path?t.filter(t=>e.path.startsWith(t.path)).sort((e,t)=>t.path.length-e.path.length)[0]?.path??null:null}function N5({skills:e,folders:t,onOpen:n}){let r=X();return(0,H.jsx)(`ul`,{className:`space-y-3`,children:e.map(e=>{let i=M5(e,t);return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`w-full min-w-0 space-y-1.5 rounded-xl border border-border bg-card px-3 py-2.5 text-start transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 break-words text-sm font-semibold`,children:e.name}),e.suggested?(0,H.jsx)(s5,{label:r(`Suggested`),colourKey:`Suggested`}):null,(0,H.jsx)(s5,{label:r(e.mode===`manual`?`Manual`:`Automatic`),colourKey:e.mode}),e.notInWatchedFolder?(0,H.jsx)(s5,{label:r(`Not in a watched folder`),colourKey:`not-watched`}):null]}),(0,H.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,className:`break-all`,children:i}),` · `]}):null,r(`Uses`),` `,Wb(e.uses),` · `,r(`Failed turns`),` `,Wb(e.failedTurns),` · `,r(`Attention`),` `,e.attention.toFixed(2),` ·`,` `,r(`Last use`),` `,e.lastUsedAt?Yp(e.lastUsedAt):r(`Never`)]})]})},e.path??`name:${e.name}`)})})}function P5({skills:e,folders:t,query:n,onOpen:r}){let i=X(),{view:a,pageItems:o}=$8({storageKey:`omms-list-skills`,items:e,sorts:t5,resetKey:n.trim().toLowerCase()});return(0,H.jsx)(X8,{view:a,totalLabel:zb(i(a.total===1?`{count} skill`:`{count} skills`),{count:a.total}),children:(0,H.jsx)(N5,{skills:o,folders:t,onOpen:r})})}var F5=`${J.settings}#settings-section-skill-learning`;function I5({overview:e,turns:t,pending:n,recent:r,error:i,query:a,reloadKey:o=0,onQuery:s,onOpen:c,onPendingChange:l,onRecentChange:u,onReload:d}){let f=X(),p=Bb(e?.skills??[],a),m=e?.folders??[],h=t=>{let n=(e?.skills??[]).find(e=>t.path?e.path===t.path:e.name===t.name);n&&c(n)};return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`max-w-3xl space-y-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(`p`,{children:f(`Skill learning watches how your agents use your skills on Pi, OpenCode and Claude Code. It ranks each skill by use and failed tool calls, and drafts better versions from real turns.`)}),(0,H.jsx)(`p`,{children:f(`Every draft is a proposal with a diff. Nothing changes a SKILL.md file until you apply it, unless you set that skill to Automatic. Undo restores the previous version.`)})]}),e&&!e.recording?(0,H.jsxs)($b,{tone:`info`,children:[(0,H.jsx)(`p`,{children:f(`Nothing is recorded yet. Agent turns are recorded only after you turn it on.`)}),(0,H.jsx)(`a`,{className:`underline`,href:F5,onClick:e=>{e.preventDefault(),gf(F5)},children:f(`Open the Skill learning card`)})]}):null,i?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:i}):null,(0,H.jsx)(D8,{proposals:[...n,...r],onOpen:h,reloadKey:o}),(0,H.jsxs)(`section`,{id:`skills-section-ranked`,className:`scroll-mt-4 space-y-3`,"aria-label":f(`Skills`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:f(`Ranked skills`)}),(0,H.jsx)(id,{type:`search`,className:`max-w-xs`,value:a,"aria-label":f(`Filter skills by name`),placeholder:f(`Filter skills by name`),onChange:e=>s(e.target.value)})]}),e&&e.recording&&t===0?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`No turns are recorded yet.`)}),(0,H.jsx)(tx,{onEnd:d})]}):null,e&&p.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(a.trim()?`No skill matches this name.`:`No skills found in the watched folders.`)}):null,p.length>0?(0,H.jsx)(P5,{skills:p,folders:m,query:a,onOpen:c}):null]}),(0,H.jsxs)(`section`,{id:`skills-section-pending`,className:`scroll-mt-4 space-y-3`,"aria-label":f(`Pending proposals`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:f(`Pending proposals`)}),n.length>0?(0,H.jsx)(g5,{storageKey:`omms-list-pending`,proposals:n,onChange:l}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`No proposals are waiting.`)})]}),(0,H.jsxs)(`section`,{id:`skills-section-recent`,className:`scroll-mt-4 space-y-3`,"aria-label":f(`Recent proposals`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:f(`Recent proposals`)}),r.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`Each card shows when the proposal was created and when it was last applied, rejected or undone.`)}),(0,H.jsx)(g5,{storageKey:`omms-list-recent`,proposals:r,onChange:u})]}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`No proposals have been decided yet.`)})]}),e?.recording?(0,H.jsx)(j5,{folders:m,onDrafted:d}):null,(0,H.jsx)(k5,{folders:m,onChanged:d})]})}function L5(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(0),g=(0,v.useCallback)(async()=>{let[e,n,i]=await Promise.all([Rb.overview(),Rb.stats(),Rb.proposals()]);if(e.ok?(t(e.data),l(``)):l(e.error),n.ok&&r(n.data.turns),i.ok){let e=i.data.proposals;a(e.filter(e=>e.state===`pending`)),s(Hb(e))}},[]);(0,v.useEffect)(()=>{g()},[g]);let _=()=>{h(e=>e+1),g()},y=vf();return(0,v.useEffect)(()=>{y.includes(`#skills-section-`)&&p(null)},[y]),f?(0,H.jsx)(O5,{skill:f,onBack:()=>{p(null),_()},onChanged:()=>void g()}):(0,H.jsx)(I5,{overview:e,turns:n,pending:i,recent:o,error:c,query:u,reloadKey:m,onQuery:d,onOpen:p,onPendingChange:e=>a(t=>t.map(t=>t.id===e.id?e:t)),onRecentChange:e=>s(t=>t.map(t=>t.id===e.id?e:t)),onReload:_})}function R5({...e}){let t=_p();return(0,H.jsx)(ii,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--color-popover)`,"--normal-text":`var(--color-popover-foreground)`,"--normal-border":`var(--color-border)`},icons:{loading:(0,H.jsx)(qe,{className:`size-4 animate-spin`}),success:(0,H.jsx)(fe,{className:`size-4`}),error:(0,H.jsx)(at,{className:`size-4`}),info:(0,H.jsx)(Be,{className:`size-4`}),warning:(0,H.jsx)(zt,{className:`size-4`})},...e})}function z5(e,t,n){return e?t:n}var B5=[{id:`skills-section-activity`,title:`Activity`},{id:`skills-section-ranked`,title:`Ranked skills`},{id:`skills-section-pending`,title:`Pending proposals`},{id:`skills-section-recent`,title:`Recent proposals`},{id:`skills-section-folders`,title:`Watched folders`}],V5=e=>B5.map(t=>({id:t.id,label:ay(t.title,e)}));function H5(e,t,n){return Xd.map(r=>{let i=ay(r.title,e);return r.id===`shared`?{id:r.id,label:i,avatar:(0,H.jsx)(Hx,{className:`size-5 rounded-md`,iconClassName:`size-3`}),items:Zd.map(t=>({id:t.id,label:ay(t.title,e)}))}:{id:r.id,label:i,avatar:(0,H.jsx)(Vx,{host:r.id,look:t[r.id],className:`size-5 rounded-md text-[9px]`}),warning:n}})}function U5(e){let{looks:t}=Lx(),n=cC();return{memoryViewId:dd(vf().split(`#`)[0]),memoryWarningLabel:ay(`Memories not saved`,e),memorySections:H5(e,t,n?.ok===!1)}}var W5=[``,`feature`,`bug-fix`,`refactor`,`architecture`,`rule`,`documentation`,`discussion`,`analysis`,`configuration`];function G5(){let{t:e,language:t}=oa(),n=yf(),r=U5(t),[i,a]=(0,v.useState)(!1),o=sa(),s=ca();(0,v.useEffect)(()=>{let e=_f();(async()=>{await o.loadTags(),await o.loadMemories(),await o.loadStats(),await o.checkMigrationStatus(),await o.checkAuthWarning()})();let t=setInterval(()=>{o.loadStats(),!o.isSearching&&n===`project`&&o.loadMemories()},3e4);return()=>{e(),clearInterval(t)}},[]);let c=s.loadUserProfile;(0,v.useEffect)(()=>{n===`profile`&&c()},[n,c]);function l(e){e!==t&&(ea(e),o.loadMemories(),o.loadStats(),n===`profile`&&s.loadUserProfile())}function u(e){e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),gf(J.home))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(R5,{richColors:!0,position:`bottom-right`}),(0,H.jsxs)(`div`,{className:`flex min-h-svh bg-background text-foreground overflow-x-clip`,children:[(0,H.jsx)(jp,{open:i,onOpenChange:a,currentView:n,brand:e(`brand`),projectLabel:e(`tab-project`),profileLabel:e(`tab-profile`),chatLabel:e(`nav-chat`),skillsLabel:e(`nav-skills`),profileSections:[{id:`profile-preferences`,label:e(`profile-preferences`)},{id:`profile-patterns`,label:e(`profile-patterns`)},{id:`profile-workflows`,label:e(`profile-workflows`)}],skillsSections:V5(t),memoryLabel:ay(`Memory`,t),...r,settingsSections:qv.map(e=>({id:e.id,label:ay(e.title,t)})),langLabel:t.toUpperCase(),languageLabel:e(`nav-language`),themeLabel:e(`nav-theme`),settingsLabel:e(`nav-settings`),closeLabel:e(`nav-close`),collapseLabel:e(`nav-collapse`),expandLabel:e(`nav-expand`),onLanguageSelect:l}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-30 flex items-center gap-2 border-b border-border bg-background/95 px-3 py-2 backdrop-blur md:hidden`,children:[(0,H.jsx)(G,{variant:`ghost`,size:`icon-sm`,className:`min-h-11 min-w-11`,onClick:()=>a(!0),"aria-label":e(`nav-menu`),children:(0,H.jsx)(Ye,{className:`size-4`})}),(0,H.jsx)(`a`,{href:J.home,className:`min-w-0`,onClick:u,children:(0,H.jsx)(Gd,{brand:e(`brand`)})})]}),(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex-1 space-y-4 p-4 md:p-6`,children:[o.showAuthWarning?(0,H.jsxs)(A_,{variant:`destructive`,children:[(0,H.jsx)(zt,{}),(0,H.jsx)(j_,{children:e(`auth-warning-text`)})]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h1`,{className:`text-page-title font-semibold text-foreground`,children:n===`project`?e(`tab-project`):n===`profile`?e(`tab-profile`):n===`memory`?ay(`Memory`,t):e(n===`chat`?`nav-chat`:n===`skills`?`nav-skills`:`nav-settings`)}),n===`project`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:e(`text-total`,{count:z5(o.isSearching,o.totalItems,o.statsTotal)})}),o.refreshing?(0,H.jsx)(Je,{className:`size-3.5 animate-spin`}):null]}):null]}),n===`project`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3 rounded-xl border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 max-w-full space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`tag-filter`,children:e(`label-tag`)}),(0,H.jsxs)(Er,{id:`tag-filter`,className:`w-64 max-w-full`,value:o.selectedTag,onChange:e=>o.onTagFilterChange(e.currentTarget.value),children:[(0,H.jsx)(`option`,{value:``,children:e(`opt-all-tags`)}),o.tags.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(`div`,{className:`min-w-0 max-w-full space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`keyword-filter`,children:e(`label-label-filter`)}),(0,H.jsxs)(Er,{id:`keyword-filter`,className:`w-56 max-w-full`,value:o.selectedKeyword.toLowerCase(),onChange:e=>o.onKeywordFilterChange(e.currentTarget.value),children:[(0,H.jsx)(`option`,{value:``,children:e(`opt-all-labels`)}),o.selectedKeyword&&!o.keywords.some(e=>e.keyword===o.selectedKeyword.toLowerCase())?(0,H.jsxs)(`option`,{value:o.selectedKeyword.toLowerCase(),children:[o.selectedKeyword,` (0)`]}):null,o.keywords.map(e=>(0,H.jsxs)(`option`,{value:e.keyword,children:[e.keyword,` (`,e.count,`)`]},e.keyword))]})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 items-end gap-1.5 min-w-0 basis-56`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`search-input`,className:`sr-only`,children:e(`placeholder-search`)}),(0,H.jsx)(id,{id:`search-input`,placeholder:e(`placeholder-search`),value:o.searchInput,onChange:e=>o.setSearchInput(e.target.value),onKeyDown:e=>e.key===`Enter`&&o.performSearch()})]}),(0,H.jsx)(G,{variant:`outline`,size:`icon`,onClick:o.performSearch,children:(0,H.jsx)(Tt,{className:`size-4`})}),o.isSearching?(0,H.jsx)(G,{variant:`outline`,size:`icon`,onClick:o.clearSearch,children:(0,H.jsx)(Kt,{className:`size-4`})}):null]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,H.jsx)(zp,{content:e(`tooltip-cleanup`),children:(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:o.runCleanup,children:[(0,H.jsx)(Rt,{className:`size-3.5`}),e(`btn-cleanup`)]})}),(0,H.jsx)(zp,{content:e(`tooltip-deduplicate`),children:(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:o.runDeduplication,children:[(0,H.jsx)(bt,{className:`size-3.5`}),e(`btn-deduplicate`)]})})]}),o.selectedIds.size>0?(0,H.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 border-t border-border pt-3`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`text-selected`,{count:o.selectedIds.size})}),(0,H.jsx)(G,{variant:`secondary`,size:`xs`,onClick:o.selectAllCurrentPage,children:e(`btn-select-all`)}),(0,H.jsx)(G,{variant:`destructive`,size:`xs`,onClick:o.bulkDelete,children:e(`btn-delete-selected`)}),(0,H.jsx)(G,{variant:`ghost`,size:`xs`,onClick:o.deselectAll,children:e(`btn-deselect-all`)})]}):null]}),o.migrationNeeded?(0,H.jsxs)(A_,{variant:`destructive`,className:`space-y-3`,children:[(0,H.jsx)(zt,{}),(0,H.jsxs)(j_,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{children:o.migrationMessage||e(`migration-mismatch`)}),(0,H.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,H.jsx)(Qo,{checked:o.migrationConfirmed,onCheckedChange:e=>o.setMigrationConfirmed(e===!0),className:`mt-0.5`}),(0,H.jsx)(`span`,{children:e(`migration-understand`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(G,{variant:`destructive`,size:`sm`,disabled:!o.migrationConfirmed,onClick:()=>o.runMigration(`fresh-start`),children:e(`btn-fresh-start`)}),(0,H.jsx)(G,{variant:`secondary`,size:`sm`,disabled:!o.migrationConfirmed,onClick:()=>o.runMigration(`re-embed`),children:e(`btn-reembed`)})]})]})]}):null,(0,H.jsx)(x_,{memories:o.memories,selectedIds:o.selectedIds,currentPage:o.currentPage,totalPages:o.totalPages,totalItems:o.totalItems,isSearching:o.isSearching,loading:o.loadingMemories,error:o.memoriesError,onSelect:o.onSelect,onPageChange:e=>{let t=o.currentPage+e;o.setCurrentPage(t),o.loadMemories({page:t})},onPin:o.pinMemory,onUnpin:o.unpinMemory,onEdit:o.openEdit,onDeleteMemory:o.deleteMemory,onDeletePrompt:o.deletePrompt,activeKeyword:o.selectedKeyword,onKeywordClick:e=>o.onKeywordFilterChange(o.selectedKeyword.toLowerCase()===e.toLowerCase()?``:e)}),(0,H.jsxs)(`section`,{className:`rounded-xl border border-border bg-card p-4 space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold text-muted-foreground`,children:e(`section-add`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:o.addMemory,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-tag`,children:e(`label-tag`)}),(0,H.jsxs)(Er,{id:`add-tag`,required:!0,className:`w-full`,value:o.addTag,onChange:e=>o.setAddTag(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:e(`opt-select-tag`)}),o.tags.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-type`,children:e(`label-type`)}),(0,H.jsx)(Er,{id:`add-type`,className:`w-full`,value:o.addType,onChange:e=>o.setAddType(e.target.value),children:W5.map(t=>(0,H.jsx)(`option`,{value:t,children:e(t?`opt-${t}`:`opt-other`)},t||`other`))})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-tags`,children:e(`label-tags`)}),(0,H.jsx)(id,{id:`add-tags`,placeholder:e(`placeholder-tags`),value:o.addTags,onChange:e=>o.setAddTags(e.target.value)})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-content`,children:e(`label-content`)}),(0,H.jsx)(Fp,{id:`add-content`,rows:4,required:!0,placeholder:e(`placeholder-content`),value:o.addContent,onChange:e=>o.setAddContent(e.target.value)})]}),(0,H.jsxs)(G,{type:`submit`,children:[(0,H.jsx)(_t,{className:`size-3.5`}),e(`btn-add-memory`)]})]})]})]}):n===`memory`?(0,H.jsx)(ow,{}):n===`chat`?(0,H.jsx)(Kw,{}):n===`skills`?(0,H.jsx)(L5,{}):n===`settings`?(0,H.jsx)(cx,{}):(0,H.jsx)(Gv,{profile:s.userProfile,loading:s.loadingProfile,onRefresh:s.refreshProfile,onCleanup:()=>s.setAiCleanupOpen(!0),onCategoryCleanup:()=>s.setCategoryCleanupOpen(!0),categoryCleanupOpen:s.categoryCleanupOpen})]})]})]}),(0,H.jsx)(Ip,{open:o.editOpen,onOpenChange:o.setEditOpen,content:o.editContent,onSave:o.saveEdit}),(0,H.jsx)(Kv,{open:o.tagMigrationOpen,onOpenChange:e=>{e||hi(o.tagMigrationCount),o.setTagMigrationOpen(e)},count:o.tagMigrationCount,onComplete:()=>{gi(),o.loadMemories(),o.loadStats()}}),(0,H.jsx)(Ju,{open:s.aiCleanupOpen,onOpenChange:s.setAiCleanupOpen,onMinimise:s.minimiseAiCleanup,profile:s.userProfile,onApplied:s.loadUserProfile}),s.aiCleanupMinimised?(0,H.jsx)(Yu,{onOpen:()=>s.setAiCleanupOpen(!0),onGone:s.dismissAiCleanupPill}):null,(0,H.jsx)(sd,{open:s.categoryCleanupOpen,onOpenChange:s.setCategoryCleanupOpen,onApplied:s.loadUserProfile})]})}gp();var K5=document.getElementById(`app`);if(!K5)throw Error(`Root element #app not found`);(0,y.createRoot)(K5).render((0,H.jsx)(v.StrictMode,{children:(0,H.jsx)(aa,{children:(0,H.jsx)(G5,{})})}));
169
+ `)}}):null},p8=AZ;function m8({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:s,labelClassName:c,formatter:l,color:u,nameKey:d,labelKey:f}){let{config:p}=u8(),m=v.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${f??e?.dataKey??e?.name??`value`}`,r=h8(p,e,n),a=!f&&typeof o==`string`?p[o]?.label??o:r?.label;return s?(0,H.jsx)(`div`,{className:V(`font-medium`,c),children:s(a,t)}):a?(0,H.jsx)(`div`,{className:V(`font-medium`,c),children:a}):null},[o,s,t,i,c,p,f]);if(!e||!t?.length)return null;let h=t.length===1&&r!==`dot`;return(0,H.jsxs)(`div`,{className:V(`grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[h?null:m,(0,H.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=`${d??e.name??e.dataKey??`value`}`,i=h8(p,e,n),o=u??e.payload?.fill??e.color;return(0,H.jsx)(`div`,{className:V(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:l&&e?.value!==void 0&&e.name?l(e.value,e.name,e,t,e.payload):(0,H.jsxs)(H.Fragment,{children:[i?.icon?(0,H.jsx)(i.icon,{}):!a&&(0,H.jsx)(`div`,{className:V(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"w-1":r===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"my-0.5":h&&r===`dashed`}),style:{"--color-bg":o,"--color-border":o}}),(0,H.jsxs)(`div`,{className:V(`flex flex-1 justify-between leading-none`,h?`items-end`:`items-center`),children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[h?m:null,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:i?.label??e.name})]}),e.value!=null&&(0,H.jsx)(`span`,{className:`font-mono font-medium text-foreground tabular-nums`,children:typeof e.value==`number`?e.value.toLocaleString():String(e.value)})]})]})},t)})})]})}function h8(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}function g8({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card`,className:V(`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 text-card-foreground`,e),...t})}function _8({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-header`,className:V(`grid gap-1`,e),...t})}function v8({className:e,...t}){return(0,H.jsx)(`h3`,{"data-slot":`card-title`,className:V(`text-sm font-semibold leading-snug`,e),...t})}function y8({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`card-description`,className:V(`text-xs text-muted-foreground`,e),...t})}function b8({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-content`,className:V(`min-w-0`,e),...t})}function x8({title:e,summary:t,emptyText:n,table:r,children:i,className:a,interactive:o=!1}){return(0,H.jsxs)(g8,{className:a,children:[(0,H.jsxs)(_8,{children:[(0,H.jsx)(v8,{children:e}),t&&!n?(0,H.jsx)(y8,{children:t}):null]}),(0,H.jsx)(b8,{children:n?(0,H.jsx)(`p`,{className:`flex min-h-40 items-center text-sm text-muted-foreground`,children:n}):(0,H.jsxs)(H.Fragment,{children:[o?i:(0,H.jsx)(`div`,{"aria-hidden":`true`,children:i}),(0,H.jsxs)(`table`,{className:`sr-only`,children:[(0,H.jsx)(`caption`,{children:e}),(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:r.columns.map(e=>(0,H.jsx)(`th`,{scope:`col`,children:e},e))})}),(0,H.jsx)(`tbody`,{children:r.rows.map((e,t)=>(0,H.jsx)(`tr`,{children:e.map((e,t)=>(0,H.jsx)(`td`,{children:e},t))},t))})]})]})})]})}var S8={pending:`var(--status-info)`,applied:`var(--status-success)`,rejected:`var(--destructive)`,stale:`var(--status-warning)`,undone:`var(--muted-foreground)`};function C8({proposals:e}){let t=X(),n=vT(e).map(e=>({...e,label:t(e.state)})),r={count:{label:t(`Proposals`),color:`var(--chart-1)`}},i=n[0]?.count??0;return(0,H.jsx)(x8,{title:t(`Proposal pipeline`),summary:Vb(t(`{total} proposals, {pending} waiting for a decision`),{total:e.length,pending:i}),emptyText:e.length===0?t(`No proposals yet.`):``,table:{columns:[t(`State`),t(`Proposals`)],rows:n.map(e=>[e.label,e.count])},children:(0,H.jsx)(d8,{config:r,className:`aspect-auto h-44 w-full`,children:(0,H.jsxs)(o8,{data:n,layout:`vertical`,accessibilityLayer:!1,margin:{top:0,right:28,left:0,bottom:0},children:[(0,H.jsx)(d3,{type:`number`,hide:!0,allowDecimals:!1}),(0,H.jsx)(E3,{type:`category`,dataKey:`label`,width:104,tickLine:!1,axisLine:!1}),(0,H.jsx)(p8,{cursor:{fill:`var(--interactive-hover)`},content:(0,H.jsx)(m8,{hideLabel:!0,nameKey:`count`})}),(0,H.jsxs)(W4,{dataKey:`count`,fill:`var(--color-count)`,radius:[0,2,2,0],children:[n.map(e=>(0,H.jsx)(jZ,{fill:S8[e.state]??`var(--color-count)`},e.state)),(0,H.jsx)(S$,{dataKey:`count`,position:`right`,className:`fill-foreground`})]})]})})})}var w8=`var(--status-success)`,T8=`var(--destructive)`;function E8(){let e=X();return{succeeded:{label:e(`Successful`),color:w8},failed:{label:e(`Failed`),color:T8}}}var D8={stroke:`var(--card)`,strokeWidth:1};function O8(){let e=X(),t=[{label:e(`Successful`),background:w8},{label:e(`Failed`),background:T8}];return(0,H.jsx)(`ul`,{className:`flex flex-wrap items-center justify-center gap-4 pt-3 text-xs`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[2px]`,style:{background:e.background}}),e.label]},e.label))})}var k8=26;function A8({skills:e,total:t,shown:n,onShown:r,onOpen:i,className:a}){let o=X(),s=E8(),c=e.slice(0,n).map(gT),l=c[0],u=e=>{let t=e?.payload;t&&i(t)};return(0,H.jsxs)(x8,{className:a,interactive:!0,title:o(`Most used skills`),summary:l?Vb(o(`{name} leads with {uses} uses. Click a bar to open the skill.`),{name:l.name,uses:l.uses}):void 0,emptyText:c.length===0?o(`No skill was used in the last 30 days.`):``,table:{columns:[o(`Skill`),o(`Uses`),o(`Failed`)],rows:c.map(e=>[e.name,e.uses,e.failed])},children:[(0,H.jsxs)(`div`,{className:V(`flex gap-2`,c.length>16&&`overflow-y-auto overscroll-contain pt-8`),style:c.length>16?{maxHeight:`448px`}:void 0,children:[(0,H.jsx)(`ol`,{className:`w-[6.5rem] shrink-0`,"aria-label":o(`Most used skills`),children:c.map(e=>(0,H.jsx)(`li`,{className:`flex h-[26px] items-center justify-end`,children:(0,H.jsx)(Vp,{content:e.name,className:`min-w-0 max-w-full`,children:(0,H.jsx)(`button`,{type:`button`,className:`block max-w-full truncate rounded-sm text-end text-xs hover:underline focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>i(e),children:e.name})})},`${e.name}\n${e.path??``}`))}),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`min-w-0 flex-1`,children:(0,H.jsx)(d8,{config:s,className:`aspect-auto w-full`,style:{height:`${c.length*k8}px`},children:(0,H.jsxs)(o8,{data:c,layout:`vertical`,accessibilityLayer:!1,margin:{top:0,right:8,left:0,bottom:0},children:[(0,H.jsx)(d3,{type:`number`,hide:!0,allowDecimals:!1}),(0,H.jsx)(E3,{type:`category`,dataKey:`name`,hide:!0}),(0,H.jsx)(p8,{cursor:{fill:`var(--interactive-hover)`},content:(0,H.jsx)(m8,{})}),(0,H.jsx)(W4,{dataKey:`succeeded`,stackId:`uses`,fill:`var(--color-succeeded)`,cursor:`pointer`,onClick:u,...D8}),(0,H.jsx)(W4,{dataKey:`failed`,stackId:`uses`,fill:`var(--color-failed)`,radius:[0,2,2,0],cursor:`pointer`,onClick:u,...D8})]})})})]}),(0,H.jsx)(`div`,{"aria-hidden":`true`,children:(0,H.jsx)(O8,{})}),t>8?(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:Vb(o(`Showing {shown} of {total}`),{shown:c.length,total:t})}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[c.length<e.length?(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(wT(n,e.length)),children:o(`Show more`)}):null,c.length>8?(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(8),children:o(`Show less`)}):null]})]}):null]})}function j8(e){let[t,n]=(0,v.useState)(8);return(0,H.jsx)(A8,{...e,shown:t,onShown:n})}var M8=e=>{let t=Math.ceil(Math.max(0,...e.map(e=>e.uses))*1.25);return Math.max(28,String(t).length*7+10)};function N8({rows:e,bucket:t,period:n,title:r,className:i}){let a=X(),o=E8(),s=tm(),c=t??`day`,l=e.map(gT),u=e.reduce((e,t)=>e+t.uses,0),d=e.reduce((e,t)=>e+t.failed,0),f=e=>PT(c,String(e),!1,s),p=t?e=>PT(c,String(e),!0,s):f,m={uses:Yb(u),failed:Yb(d)},h=a(t?`No uses in this period. Bars appear after OMMS records turns.`:`No uses in the last 30 days. Bars appear after OMMS records turns.`);return(0,H.jsxs)(x8,{className:i,title:r,summary:n?Vb(a(`{period}: {uses} uses, {failed} with a failed tool call`),{period:n,...m}):Vb(a(`{uses} uses, {failed} with a failed tool call`),m),emptyText:hT(e)?h:``,table:{columns:[a(ET[c]),a(`Uses`),a(`Failed`)],rows:e.map(e=>[p(e.key),e.uses,e.failed])},children:[(0,H.jsx)(d8,{config:o,className:`aspect-auto h-44 w-full`,children:(0,H.jsxs)(o8,{data:l,accessibilityLayer:!1,margin:{top:4,right:0,left:0},children:[(0,H.jsx)(j2,{vertical:!1}),(0,H.jsx)(d3,{dataKey:`key`,tickLine:!1,axisLine:!1,minTickGap:c===`day`?24:8,tickFormatter:f}),(0,H.jsx)(E3,{width:M8(e),tickLine:!1,axisLine:!1,allowDecimals:!1,tickCount:3}),(0,H.jsx)(p8,{cursor:{fill:`var(--interactive-hover)`},content:(0,H.jsx)(m8,{labelFormatter:p})}),(0,H.jsx)(W4,{dataKey:`succeeded`,stackId:`uses`,fill:`var(--color-succeeded)`,...D8}),(0,H.jsx)(W4,{dataKey:`failed`,stackId:`uses`,fill:`var(--color-failed)`,radius:[2,2,0,0],...D8})]})}),(0,H.jsx)(O8,{})]})}var P8={months:[],years:[]},F8=`The use charts appear after OMMS records agent turns that use a skill.`;function I8(e,t,n){return e.bucket===`year`?`${n(`No skill uses are recorded yet.`)} ${n(F8)}`:e.bucket===`day`&&!e.month?n(`No skill uses are recorded in the last 30 days. The use charts appear after OMMS records agent turns that use a skill.`):`${Vb(n(`No skill uses are recorded in {period}.`),{period:t})} ${n(F8)}`}function L8({activity:e,range:t,shownRange:n=t,loading:r,error:i,proposals:a,onOpen:o,onRange:s}){let c=X(),l=tm(),u=e!==null&&hT(e.series),d=e?FT(n,e.series,l,c):``,f=n.bucket===`day`&&!n.month,p=r&&e!==null,m=V(`transition-opacity duration-150`,p&&`opacity-60`);return(0,H.jsxs)(`section`,{id:`skills-section-activity`,className:`scroll-mt-4 space-y-3`,"aria-labelledby":`skills-activity-title`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`h2`,{id:`skills-activity-title`,className:`text-section-title font-semibold`,children:c(`Activity`)}),(0,H.jsx)(BT,{range:t,available:e?.available??P8,currentYear:new Date().getUTCFullYear(),loading:p,onChange:s})]}),i?(0,H.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:[c(`Activity could not load.`),` `,i]}):null,e===null&&!i?(0,H.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),c(`Loading…`)]}):null,(0,H.jsxs)(`div`,{"aria-busy":p||void 0,className:`space-y-3`,children:[e?(0,H.jsx)(`dl`,{className:V(`flex flex-wrap gap-x-6 gap-y-1 text-sm`,m),children:[[f?c(`Uses in 30 days`):Vb(c(`Uses in {period}`),{period:d}),e.totals.uses],[c(`Failed turns`),e.totals.failed],[c(`Active skills`),e.totals.activeSkills]].map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`font-semibold tabular-nums`,children:Yb(Number(t))})]},e))}):null,e&&u?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:I8(n,d,c)}):null,(0,H.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-3 lg:grid-cols-2`,children:[e&&!u?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(N8,{className:V(`lg:col-span-2`,m),rows:e.series,bucket:e.bucket,period:d,title:c(TT[e.bucket])}),(0,H.jsx)(j8,{className:m,skills:e.topSkills,total:e.topTotal,onOpen:o},OT(n))]}):null,(0,H.jsx)(C8,{proposals:a})]})]})]})}function R8({proposals:e,onOpen:t,reloadKey:n}){let[r,i]=(0,v.useState)(()=>kT(ui(xT,xT))),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let e=!0;return u(!0),Bb.activity({...DT(r),top:100}).then(t=>{if(!e)return;if(!t.ok){c(t.error),u(!1);return}let n=fT(t.data),a=AT(r,n.available);if(a!==r){fi(xT,OT(a)),i(a);return}o({range:r,activity:n}),c(``),u(!1)}),()=>{e=!1}},[r,n]),(0,H.jsx)(L8,{activity:a?.activity??null,range:r,shownRange:a?.range??r,loading:l,error:s,proposals:e,onOpen:t,onRange:e=>{fi(xT,OT(e)),i(e)}})}var z8={all:`All ({count})`,"not-modified":`Not modified ({count})`,modified:`Modified ({count})`,suggested:`Suggested ({count})`},B8={all:{idle:`border-input bg-card text-muted-foreground hover:bg-interactive-hover`,chosen:`border-primary/40 bg-selection text-foreground`},"not-modified":{idle:`border-status-info/35 bg-status-info/5 text-status-info hover:bg-status-info/15`,chosen:`border-status-info/70 bg-status-info/20 text-status-info`},modified:{idle:`border-status-success/35 bg-status-success/5 text-status-success hover:bg-status-success/15`,chosen:`border-status-success/70 bg-status-success/20 text-status-success`},suggested:{idle:`[color:oklch(0.42_0.13_var(--keyword-hue))] dark:[color:oklch(0.8_0.13_var(--keyword-hue))] hover:brightness-110`,chosen:`[color:oklch(0.42_0.13_var(--keyword-hue))] dark:[color:oklch(0.8_0.13_var(--keyword-hue))]`}};function V8(e){let t=ed(`Suggested`);return{backgroundColor:`oklch(0.72 0.14 ${t} / ${e?.3:.1})`,borderColor:`oklch(0.72 0.14 ${t} / ${e?.8:.4})`,"--keyword-hue":String(t)}}var H8={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function U8({value:e,counts:t,onChange:n}){let r=X(),i=(0,v.useRef)([]),a=e=>{i.current[e]?.focus(),n(Qw[e])};return(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`Show skills by modification`),className:`inline-flex flex-wrap gap-1.5`,onKeyDown:t=>{let n=H8[t.key];if(!n)return;t.preventDefault();let r=getComputedStyle(t.currentTarget).direction===`rtl`,i=t.key===`ArrowLeft`||t.key===`ArrowRight`,o=r&&i?-n:n,s=Qw.indexOf(e);a((s+o+Qw.length)%Qw.length)},children:Qw.map((n,o)=>(0,H.jsx)(`button`,{ref:e=>{i.current[o]=e},type:`button`,role:`radio`,"aria-checked":e===n,tabIndex:e===n?0:-1,className:V(`min-h-9 rounded-[10px] border px-3 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring`,e===n?B8[n].chosen:B8[n].idle),style:n===`suggested`?V8(e===n):void 0,onClick:()=>a(o),children:Vb(r(z8[n]),{count:Yb(t[n])})},n))})}function W8({className:e,...t}){return(0,H.jsx)(`nav`,{"data-slot":`pagination`,className:V(`mx-auto flex w-full justify-center`,e),...t})}function G8({className:e,...t}){return(0,H.jsx)(`ul`,{"data-slot":`pagination-content`,className:V(`flex flex-row flex-wrap items-center justify-center gap-1`,e),...t})}function K8({...e}){return(0,H.jsx)(`li`,{"data-slot":`pagination-item`,...e})}function q8({className:e,isActive:t,size:n=`icon-sm`,disabled:r,...i}){return(0,H.jsx)(`button`,{type:`button`,"aria-current":t?`page`:void 0,"aria-disabled":r||void 0,disabled:r,"data-slot":`pagination-button`,"data-active":t,className:V(Va({variant:t?`outline`:`ghost`,size:n}),`tabular-nums`,t&&`border-primary/40 bg-selection`,e),...i})}function J8({className:e,label:t,...n}){return(0,H.jsxs)(`span`,{"data-slot":`pagination-ellipsis`,className:V(`flex size-8 items-center justify-center`,e),...n,children:[(0,H.jsx)(xe,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:t})]})}var Y8=[3,5,10,25,50,100],X8=(e,t)=>Array.from({length:t-e+1},(t,n)=>e+n);function Z8(e,t,n=1){if(t<=1)return[];if(t<=n*2+5)return X8(1,t);let r=Math.max(e-n,1),i=Math.min(e+n,t),a=r>2,o=i<t-1,s=3+n*2;return!a&&o?[...X8(1,s),`...`,t]:a&&!o?[1,`...`,...X8(t-s+1,t)]:[1,`...`,...X8(r,i),`...`,t]}var Q8=(e,t)=>Math.max(1,Math.ceil(Math.max(0,e)/Math.max(1,t))),$8=(e,t,n)=>Math.min(Math.max(1,Math.floor(e)||1),Q8(t,n));function e5(e,t,n){let r=$8(e,n,t),i=n===0?0:(r-1)*t+1;return{page:r,pageCount:Q8(n,t),from:i,to:Math.min(n,r*t),total:n}}function t5(e,t,n){let r=e5(t,n,e.length);return{...r,items:e.slice(Math.max(0,r.from-1),r.to)}}function n5(e,t,n,r){let{from:i,to:a}=e5(e,t,n);return!r||n===0?{offset:Math.max(0,i-1),limit:t}:{offset:n-a,limit:a-i+1}}function r5(e){let t=[...Y8];return t.includes(e)?t:[...t,e].sort((e,t)=>e-t)}function i5(e,t){let n=Number.parseInt(e.trim(),10);return Number.isNaN(n)||n<1?t:Math.min(n,200)}function a5(e,t,n,r){let i=n===`asc`?1:-1,a=e=>+!!r?.(e);return e.map((e,t)=>({item:e,index:t})).sort((e,n)=>a(e.item)-a(n.item)||(a(e.item)?0:i*t(e.item,n.item))||e.index-n.index).map(({item:e})=>e)}function o5(e){try{let t=localStorage.getItem(e);if(!t)return null;let n=JSON.parse(t),r=n.perPage===void 0?void 0:i5(String(n.perPage),5),i=n.order===`asc`||n.order===`desc`?n.order:void 0;return{perPage:r,sort:typeof n.sort==`string`?n.sort:void 0,order:i}}catch{return null}}function s5(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function c5(e,t){try{if(localStorage.getItem(e)!==null)return;let n=o5(t);if(!n)return;let r=n.perPage===5?void 0:n.perPage;if(r===void 0&&n.sort===void 0&&n.order===void 0)return;s5(e,{perPage:r,sort:n.sort,order:n.order})}catch{}}function l5(e,t){return e.key===t?e:{page:1,key:t}}function u5(e,t,n){let r=e.find(n=>n.value===e.find(e=>e.value===t)?.flip);return r?{sort:r.value,order:r.first}:{sort:t,order:n===`asc`?`desc`:`asc`}}function d5({view:e}){let t=X(),n=(0,v.useRef)(null),r=(0,v.useRef)(!1);(0,v.useEffect)(()=>{r.current&&(r.current=!1,n.current?.querySelector(`[aria-current="page"]`)?.focus())},[e.page]);let i=Z8(e.page,e.pageCount);if(i.length===0)return null;let a=t=>{r.current=t===1||t===e.pageCount,e.setPage(t)};return(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 pt-1`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground tabular-nums`,children:Vb(t(`Showing {from} to {to} of {total} results`),{from:e.from,to:e.to,total:e.total})}),(0,H.jsx)(W8,{ref:n,"aria-label":t(`pagination`),children:(0,H.jsxs)(G8,{children:[(0,H.jsx)(K8,{children:(0,H.jsxs)(q8,{size:`sm`,className:`gap-1 px-2.5`,"aria-label":t(`Go to previous page`),disabled:e.page<=1,onClick:()=>a(e.page-1),children:[(0,H.jsx)(se,{className:`rtl:-scale-x-100`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:t(`Previous`)})]})}),i.map((n,r)=>n===`...`?(0,H.jsx)(K8,{children:(0,H.jsx)(J8,{label:t(`More pages`)})},`gap-${r}`):(0,H.jsx)(K8,{children:(0,H.jsx)(q8,{isActive:n===e.page,"aria-label":Vb(t(`Go to page {page}`),{page:n}),onClick:()=>n===e.page?void 0:a(n),children:n})},n)),(0,H.jsx)(K8,{children:(0,H.jsxs)(q8,{size:`sm`,className:`gap-1 px-2.5`,"aria-label":t(`Go to next page`),disabled:e.page>=e.pageCount,onClick:()=>a(e.page+1),children:[(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:t(`Next`)}),(0,H.jsx)(ce,{className:`rtl:-scale-x-100`,"aria-hidden":`true`})]})})]})})]})}var f5=()=>(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`hidden text-muted-foreground/50 sm:inline`,children:`|`});function p5({view:e,totalLabel:t}){let n=X(),[r,i]=(0,v.useState)(null),a=()=>{if(r===null)return;let t=i5(r,e.perPage);i(null),t!==e.perPage&&e.setPerPage(t)},o=e=>{e.key===`Enter`&&a()},s=e.order===`asc`,c=s?ee:M;return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-2 text-sm text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:n(`Show`)}),(0,H.jsx)(Er,{className:`h-8 w-fit`,value:e.perPage,"aria-label":n(`Results per page`),onChange:t=>e.setPerPage(Number(t.target.value)),children:r5(e.perPage).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))}),(0,H.jsx)(`span`,{children:n(`results`)})]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(f5,{}),(0,H.jsx)(`span`,{children:n(`Custom:`)}),(0,H.jsx)(id,{type:`number`,inputMode:`numeric`,min:1,max:200,className:`h-8 w-20 tabular-nums`,value:r??String(e.perPage),"aria-label":n(`Custom results per page`),onChange:e=>i(e.target.value),onKeyDown:o,onBlur:a})]}),e.sorts.length>0?(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(f5,{}),(0,H.jsx)(`span`,{children:n(`Sort by`)}),(0,H.jsx)(Er,{className:`h-8 w-fit`,value:e.sort,"aria-label":n(`Sort by`),onChange:t=>{let n=e.sorts.find(e=>e.value===t.target.value);n&&e.setSort(n.value,n.first)},children:e.sorts.map(e=>(0,H.jsx)(`option`,{value:e.value,children:n(e.label)},e.value))}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":n(s?`Sort descending`:`Sort ascending`),title:n(s?`Sort descending`:`Sort ascending`),onClick:()=>{let t=u5(e.sorts,e.sort,e.order);e.setSort(t.sort,t.order)},children:(0,H.jsx)(c,{className:`size-3.5`,"aria-hidden":`true`})})]}):null,(0,H.jsx)(`span`,{className:`ms-auto tabular-nums`,children:t})]})}function m5({view:e,totalLabel:t,children:n}){return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(p5,{view:e,totalLabel:t}),n,(0,H.jsx)(d5,{view:e})]})}function h5(e,t){let{perPage:n,...r}=e;return t?{perPage:n,...r}:r}function g5(e,t,n=5){let r=o5(e),i=t.find(e=>e.value===r?.sort)??t[0];return{perPage:r?.perPage??n,sort:i.value,order:(r?.sort===i.value?r.order:void 0)??i.first}}function _5({storageKey:e,total:t,sorts:n,resetKey:r=``,legacyKey:i,defaultPerPage:a}){let[o,s]=(0,v.useState)(()=>(i&&c5(e,i),g5(e,n,a))),[c,l]=(0,v.useState)(()=>o5(e)?.perPage!==void 0),[u,d]=(0,v.useState)({page:1,key:r}),f=l5(u,r);f!==u&&d(f);let p=e5(f.page,o.perPage,t),m=(t,n=c)=>{s(t),l(n),s5(e,h5(t,n)),d({page:1,key:r})};return{...p,...o,sorts:n,setPage:e=>d({page:e,key:r}),setPerPage:e=>m({...o,perPage:e},!0),setSort:(e,t)=>m({...o,sort:e,order:t})}}function v5({items:e,sorts:t,...n}){let r=_5({...n,sorts:t,total:e.length}),{compare:i,last:a}=t.find(e=>e.value===r.sort)??t[0];return{view:r,pageItems:(0,v.useMemo)(()=>a5(e,i,r.order,a),[e,i,a,r.order]).slice(Math.max(0,r.from-1),r.to)}}var y5=(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}),b5=[{value:`uses`,label:`Most used`,first:`desc`,compare:(e,t)=>e.uses-t.uses},{value:`attention`,label:`Needs attention`,first:`desc`,compare:(e,t)=>e.attention-t.attention},{value:`name`,label:`Name (A–Z)`,first:`asc`,compare:y5},{value:`lastUsed`,label:`Last used`,first:`desc`,compare:(e,t)=>(e.lastUsedAt??0)-(t.lastUsedAt??0),last:e=>e.lastUsedAt===null},{value:`failed`,label:`Failed turns`,first:`desc`,compare:(e,t)=>e.failedTurns-t.failedTurns},{value:`lastModified`,label:`Last modified`,first:`desc`,compare:(e,t)=>(e.lastAppliedAt??0)-(t.lastAppliedAt??0),last:e=>e.lastAppliedAt===null}],x5=[`pending`,`applied`,`rejected`,`stale`,`undone`],S5=(e,t)=>e.updatedAt-t.updatedAt,C5=[{value:`newest`,label:`Newest`,first:`desc`,flip:`oldest`,compare:S5},{value:`oldest`,label:`Oldest`,first:`asc`,flip:`newest`,compare:S5},{value:`state`,label:`State`,first:`asc`,compare:(e,t)=>x5.indexOf(e.state)-x5.indexOf(t.state)},{value:`skill`,label:`Skill`,first:`asc`,compare:(e,t)=>y5({name:e.skillName},{name:t.skillName})}],w5=[{value:`newest`,label:`Newest`,first:`desc`,flip:`oldest`},{value:`oldest`,label:`Oldest`,first:`asc`,flip:`newest`}],T5=e=>e.order===`asc`;function E5({label:e,colourKey:t=e,className:n}){let r=ed(t);return(0,H.jsx)(`span`,{className:V(`inline-flex min-h-6 max-w-full items-center rounded-[7px] border px-2 text-xs break-words`,`[color:oklch(0.42_0.13_var(--keyword-hue))] dark:[color:oklch(0.8_0.13_var(--keyword-hue))]`,n),style:{backgroundColor:`oklch(0.72 0.14 ${r} / 0.18)`,borderColor:`oklch(0.72 0.14 ${r} / 0.45)`,"--keyword-hue":String(r)},children:e})}var D5={add:`bg-status-success/15 text-status-success`,del:`bg-destructive/10 text-destructive-label`,hunk:`text-status-info`,ctx:`text-muted-foreground`};function O5({diff:e,label:t}){return(0,H.jsx)(`pre`,{dir:`ltr`,tabIndex:0,"aria-label":t,className:`max-h-96 overflow-auto rounded-lg border border-border bg-background py-1 font-mono text-xs leading-5`,children:Gb(e).map((e,t)=>(0,H.jsx)(`code`,{"data-line":e.kind,className:V(`block px-2 whitespace-pre`,D5[e.kind]),children:e.text||` `},t))})}function k5({turns:e}){let t=X();return e.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`No recorded turns.`)}):(0,H.jsx)(`ul`,{className:`space-y-3`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`min-w-0 space-y-1 rounded-xl border border-border bg-card px-3 py-2.5`,children:[(0,H.jsx)(`p`,{className:`line-clamp-3 break-words text-sm`,dir:`auto`,children:e.promptPreview||t(`(empty prompt)`)}),(0,H.jsxs)(`p`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:Zp(e.createdAt)}),(0,H.jsx)(`span`,{dir:`ltr`,children:e.host}),e.projectName?(0,H.jsx)(`bdi`,{children:e.projectName}):null,e.failedToolCalls>0?(0,H.jsx)(`span`,{className:`text-destructive-label`,children:Vb(t(e.failedToolCalls===1?`{count} failed tool call`:`{count} failed tool calls`),{count:e.failedToolCalls})}):null]})]},e.id))})}function A5(e,t,n){let r=e.length>3;return!r||!t?{canExpand:r,moreCount:r?Math.min(e.length,6)-3:0,...t5(e,1,3)}:{canExpand:r,moreCount:0,...t5(e,n,6)}}function j5({turns:e,expanded:t,page:n,onToggle:r,onPage:i}){let a=X(),o=(0,v.useId)(),s=A5(e,t,n),c=t?le:oe;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{id:o,children:(0,H.jsx)(k5,{turns:s.items})}),s.canExpand?(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-expanded":t,"aria-controls":o,onClick:r,children:[(0,H.jsx)(c,{"aria-hidden":`true`}),t?a(`Show less`):Vb(a(`Show {count} more`),{count:s.moreCount})]}):null,t?(0,H.jsx)(d5,{view:{...s,setPage:i}}):null]})}function M5({turns:e}){let[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(1);return(0,H.jsx)(j5,{turns:e,expanded:t,page:r,onToggle:()=>{n(e=>!e),i(1)},onPage:i})}function N5(e,t){return e===`state-write-failed`?{message:`The state could not be saved, so SKILL.md is as it was. Try again.`,reload:!0}:{message:t,reload:!1}}function P5({savedContent:e}){let t=X();return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:t(`Undo stopped because the file changed. This is the content OMMS saved:`)}),e===null?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`No content was saved.`)}):(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-h-72 overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,children:e})]})}var F5=(e,t)=>({...e,state:`stale`,updatedAt:t}),I5={applied:`Applied {date}`,rejected:`Rejected {date}`,undone:`Undone {date}`,stale:`Stale since {date}`};function L5({proposal:e}){let t=X(),n=e.state===`pending`?null:I5[e.state];return(0,H.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:Vb(t(`Created {date}`),{date:Zp(e.createdAt)})}),n?(0,H.jsx)(`span`,{children:Vb(t(n),{date:Zp(e.updatedAt)})}):null]})}function R5({proposal:e}){let t=X(),{added:n,removed:r}=Kb(e);return n===0&&r===0?null:(0,H.jsxs)(`span`,{dir:`ltr`,className:`inline-flex w-fit items-center gap-1 rounded-[7px] border border-border bg-background px-2 font-mono text-xs tabular-nums leading-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:Vb(t(`{added} lines added, {removed} lines removed`),{added:n,removed:r})}),(0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`text-status-success`,children:[`+`,n]}),(0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`text-destructive-label`,children:[`−`,r]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:t(`lines`)})]})}function z5({proposal:e,onChange:t,initiallyOpen:n=!1}){let r=X(),i=Ub(e),a=e.state===`pending`,o=(0,v.useId)(),s=(0,v.useId)(),c=e.canUndo!==!1,[l,u]=(0,v.useState)(n),d=l?le:oe,[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{if(!l||f||e.evidenceTurnIds.length===0)return;let t=!0;return Bb.proposal(e.id).then(e=>{t&&e.ok&&p(e.data.evidence)}),()=>{t=!1}},[l,f,e.id,e.evidenceTurnIds.length]);async function x(n){h(!0),_(``),b(void 0);let i=await n();if(h(!1),i.ok)t(i.data.proposal);else{let n=N5(i.code,i.error);_(r(n.message)),n.reload&&Bb.proposal(e.id).then(e=>{e.ok&&t(e.data.proposal)}),i.code===`changed`&&b(i.savedContent??null),i.code===`stale`&&t(F5(e,Date.now()))}}return(0,H.jsxs)(`article`,{className:`min-w-0 space-y-3 rounded-xl border border-border bg-card p-3`,children:[(0,H.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-semibold`,children:e.skillName}),(0,H.jsx)(E5,{label:r(i),colourKey:i}),(0,H.jsx)(E5,{label:r(e.kind===`new`?`New skill`:`Improvement`),colourKey:e.kind}),(0,H.jsx)(L5,{proposal:e})]}),e.summary?(0,H.jsx)(`p`,{className:V(`break-words text-sm`,l?``:`line-clamp-2`),dir:`auto`,children:e.summary}):null,(0,H.jsx)(R5,{proposal:e}),e.state===`stale`?(0,H.jsx)(ix,{tone:`warning`,children:(0,H.jsx)(`p`,{children:r(`Stale: the file changed since this draft`)})}):null,(0,H.jsx)(`div`,{id:s,hidden:!l,className:`space-y-3`,children:l?(0,H.jsxs)(H.Fragment,{children:[e.diff?(0,H.jsx)(O5,{diff:e.diff,label:r(`Changes to SKILL.md`)}):(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-h-96 overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,children:e.content}),e.evidenceTurnIds.length>0?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`Evidence turns`)}),f?(0,H.jsx)(M5,{turns:f}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`Loading…`)})]}):null]}):null}),a||e.state===`applied`?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{type:`button`,size:`sm`,disabled:m,onClick:()=>void x(()=>Bb.apply(e.id)),children:[(0,H.jsx)(ae,{"aria-hidden":`true`}),r(`Apply`)]}),(0,H.jsxs)(G,{type:`button`,variant:`destructive`,size:`sm`,disabled:m,onClick:()=>void x(()=>Bb.reject(e.id)),children:[(0,H.jsx)(Kt,{"aria-hidden":`true`}),r(`Reject`)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:m||!c,"aria-describedby":c?void 0:o,onClick:()=>void x(()=>Bb.undo(e.id)),children:[(0,H.jsx)(Bt,{"aria-hidden":`true`}),r(`Undo`)]}),c?null:(0,H.jsx)(`span`,{id:o,className:`self-center text-xs text-muted-foreground`,children:r(`Revert the newer change first.`)})]})}):null,g?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:g}):null,y===void 0?null:(0,H.jsx)(P5,{savedContent:y}),Jb(e)?(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-expanded":l,"aria-controls":s,onClick:()=>u(e=>!e),children:[(0,H.jsx)(d,{"aria-hidden":`true`}),r(l?`Show less`:`Show more`)]}):null]})}var B5=`omms-list-pending-v2`,V5=`omms-list-recent-v2`,H5=`omms-list-skill-proposals-v2`,U5={[B5]:`omms-list-pending`,[V5]:`omms-list-recent`,[H5]:`omms-list-skill-proposals`};function W5({storageKey:e,proposals:t,onChange:n}){let r=X(),{view:i,pageItems:a}=v5({storageKey:e,legacyKey:U5[e],items:t,sorts:C5,defaultPerPage:3});return(0,H.jsx)(m5,{view:i,totalLabel:Vb(r(i.total===1?`{count} proposal`:`{count} proposals`),{count:i.total}),children:(0,H.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,H.jsx)(z5,{proposal:e,onChange:n},e.id))})})}function G5(){let[e,t]=(0,v.useState)({kind:`none`});return{value:e,clear:()=>t({kind:`none`}),show:e=>{e.ok?t(e.code===`no-change`?{kind:`no-change`}:{kind:`none`}):t(e.code===`not-configured`?{kind:`not-configured`}:{kind:`error`,text:e.error})}}}function K5({notice:e}){let t=X();if(e.kind===`none`)return null;if(e.kind===`no-change`)return(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:t(`No change proposed`)});if(e.kind===`error`)return(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:e.text});let n=`${J.settings}#settings-section-external-api`;return(0,H.jsxs)(ix,{tone:`info`,children:[(0,H.jsx)(`p`,{children:t(`Drafting needs the external API. Set it up first.`)}),(0,H.jsx)(`a`,{className:`underline`,href:n,onClick:e=>{e.preventDefault(),gf(n)},children:t(`External API`)})]})}var q5=[`manual`,`automatic`];function J5({mode:e,disabled:t,confirming:n,onSelect:r,onConfirm:i,onCancel:a}){let o=X();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":o(`Mode`),className:`inline-flex gap-1.5`,children:q5.map(n=>(0,H.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===n,disabled:t,className:V(`min-h-9 rounded-[10px] border px-3 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50`,e===n?`border-primary/40 bg-selection text-foreground`:`border-input bg-card text-muted-foreground hover:bg-interactive-hover`),onClick:()=>r(n),children:o(n===`manual`?`Manual`:`Automatic`)},n))}),n?(0,H.jsxs)(ix,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:o(`Turn on Automatic mode for this skill?`)}),(0,H.jsx)(`p`,{children:o(`OMMS will change this SKILL.md file without asking. It drafts an improvement after 10 new uses and at least 24 hours, then applies it. Each change can be undone.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,size:`sm`,disabled:t,onClick:i,children:o(`Turn on Automatic`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:a,children:o(`Cancel`)})]})]}):null]})}function Y5({mode:e,disabled:t,onChoose:n}){let[r,i]=(0,v.useState)(!1);return(0,H.jsx)(J5,{mode:e,disabled:t,confirming:r,onSelect:t=>{t!==e&&(t===`automatic`?i(!0):(i(!1),n(t)))},onConfirm:()=>{i(!1),n(`automatic`)},onCancel:()=>i(!1)})}function X5({at:e,className:t}){let n=Vb(X()(`Modified on {date}`),{date:Zp(e)});return(0,H.jsx)(Vp,{content:n,className:t,children:(0,H.jsxs)(`span`,{tabIndex:0,className:`inline-flex rounded-full text-status-success focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(fe,{className:`size-4`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:n})]})})}var Z5=e=>e.kind===`applied`&&e.appliedBy===`automatic`?`applied automatically`:e.kind;function Q5({entry:e,confirming:t,working:n,locked:r,onAsk:i,onConfirm:a,onCancel:o}){let s=X(),c=(0,v.useId)(),l=Z5(e),u=e.added>0||e.removed>0;return(0,H.jsxs)(`li`,{className:`relative min-w-0 space-y-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -start-[21.5px] top-1.5 size-2.5 rounded-full border-2 border-background`,style:{backgroundColor:`oklch(0.66 0.14 ${ed(l)})`}}),(0,H.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(E5,{label:s(l),colourKey:l}),(0,H.jsx)(`time`,{dateTime:new Date(e.at).toISOString(),className:`text-xs text-muted-foreground`,children:Zp(e.at)}),u?(0,H.jsxs)(`span`,{className:`font-mono text-xs tabular-nums`,dir:`ltr`,"aria-label":Vb(s(`{added} lines added, {removed} lines removed`),{added:e.added,removed:e.removed}),children:[(0,H.jsxs)(`span`,{className:`text-status-success`,children:[`+`,e.added]}),` `,(0,H.jsxs)(`span`,{className:`text-destructive-label`,children:[`−`,e.removed]})]}):null]}),e.summary?(0,H.jsx)(`p`,{className:`break-words text-sm`,dir:`auto`,children:e.summary}):null,e.kind===`applied`?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-0.5`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:!e.canUndo||r||t,"aria-describedby":e.canUndo?void 0:c,onClick:i,children:[(0,H.jsx)(Bt,{"aria-hidden":`true`}),s(`Revert to before this change`)]}),e.canUndo?null:(0,H.jsx)(`span`,{id:c,className:`text-xs text-muted-foreground`,children:s(`Revert the newer change first.`)}),n?(0,H.jsxs)(`span`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),s(`Reverting…`)]}):null]}):null,t?(0,H.jsxs)(ix,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:s(`Revert this change?`)}),(0,H.jsx)(`p`,{children:s(`OMMS restores SKILL.md as it was before this change.`)}),e.laterAppliedCount>0?(0,H.jsx)(`p`,{className:`font-medium`,children:Vb(s(e.laterAppliedCount===1?`Reverting this also removes {count} later change.`:`Reverting this also removes {count} later changes.`),{count:e.laterAppliedCount})}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(G,{type:`button`,size:`sm`,disabled:n||r,onClick:a,children:s(`Revert`)}),(0,H.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:o,children:s(`Cancel`)})]})]}):null]})}function $5(e){let t=X(),{view:n,entries:r,loaded:i,error:a,notice:o,refreshing:s=!1}=e;return(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`skill-history-title`,children:[(0,H.jsx)(`h3`,{id:`skill-history-title`,className:`text-section-title font-semibold`,children:t(`History`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Each proposal, apply, reject and undo of this skill. Revert an applied change to restore SKILL.md as it was before it.`)}),o?.tone===`done`?(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-status-success`,children:t(`Reverted. SKILL.md is back to the version before that change.`)}):null,o?.tone===`error`?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:o.text}),o.savedContent===void 0?null:(0,H.jsx)(P5,{savedContent:o.savedContent})]}):null,a?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:a}):i?n.total===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`No history yet.`)}):(0,H.jsx)(m5,{view:n,totalLabel:Vb(t(n.total===1?`{count} entry`:`{count} entries`),{count:n.total}),children:(0,H.jsx)(`ol`,{"aria-busy":s,className:`ms-1.5 space-y-4 border-s border-border ps-4 transition-opacity ${s?`opacity-60`:``}`,children:r.map(t=>(0,H.jsx)(Q5,{entry:t,confirming:e.confirmId===t.id,working:e.workingId===t.id,locked:e.workingId!==null||s,onAsk:()=>e.onAsk(t),onConfirm:()=>e.onConfirm(t),onCancel:e.onCancel},t.id))})}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Loading…`)})]})}function e7({skill:e,reloadKey:t,onChanged:n}){let[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),b=_5({storageKey:`omms-list-skill-history`,total:r,sorts:w5}),x=T5(b),{offset:S,limit:C}=n5(b.page,b.perPage,r,x),w=`${e.path}|${e.name}|${C}|${S}|${x}|${t}`;(0,v.useEffect)(()=>{let t=!0;return Bb.history(e.path,e.name,{limit:C,offset:S}).then(e=>{if(!t)return;if(c(!0),!e.ok)return f(e.error);let n=mT(e.data);f(``),i(n.total);let r=n.entries.slice(0,C);o(x?r.reverse():r),u(w)}),()=>{t=!1}},[e.path,e.name,C,S,x,t,w]);async function T(e){m(null),g(e.id),y(null);let t=await Bb.undo(e.proposalId);if(g(null),t.ok){y({tone:`done`}),n();return}y({tone:`error`,text:t.error,...t.code===`changed`?{savedContent:t.savedContent??null}:{}})}return(0,H.jsx)($5,{view:b,entries:a,loaded:s,error:d,confirmId:p,workingId:h,notice:_,refreshing:s&&l!==w,onAsk:e=>{y(null),m(e.id)},onConfirm:e=>void T(e),onCancel:()=>m(null)})}function t7({skill:e,reloadKey:t}){let n=X(),[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),l=_5({storageKey:`omms-list-skill-turns`,total:r,sorts:w5}),u=T5(l),{offset:d,limit:f}=n5(l.page,l.perPage,r,u);return(0,v.useEffect)(()=>{let t=!0;return Bb.skill(e.path,e.name,{limit:f,offset:d}).then(e=>{if(!t)return;if(!e.ok)return c(e.error);let n=(e.data.recentTurns??[]).slice(0,f);c(``),i(e.data.turnTotal??n.length),o(u?n.reverse():n)}),()=>{t=!1}},[e.path,e.name,f,d,u,t]),(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`skill-turns-title`,children:[(0,H.jsx)(`h3`,{id:`skill-turns-title`,className:`text-section-title font-semibold`,children:n(`Recent turns`)}),s?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:s}):a===null?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Loading…`)}):r===0?(0,H.jsx)(k5,{turns:[]}):(0,H.jsx)(m5,{view:l,totalLabel:Vb(n(r===1?`{count} turn`:`{count} turns`),{count:r}),children:(0,H.jsx)(k5,{turns:a})})]})}var n7=e=>e.ok?``:e.error;function r7(e,t){t.setDetail(t=>t&&{...t,proposals:t.proposals.map(t=>t.id===e.id?e:t)}),t.bumpHistory(),t.reload()}function i7({skill:e,onBack:t,onChanged:n}){let r=X(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(e.mode),[f,p]=(0,v.useState)(``),m=G5(),[h,g]=(0,v.useState)(0),_=(0,v.useCallback)(async()=>{let t=await Bb.skill(e.path,e.name,{limit:1,offset:0});t.ok&&a(t.data),s(n7(t))},[e.path,e.name]),y=()=>{g(e=>e+1),_(),n()};(0,v.useEffect)(()=>{_()},[_]);async function b(){l(!0),m.clear();let t=await Bb.draftImprovement(e.path??e.name);l(!1),m.show(t),t.ok&&y()}async function x(t){if(!e.path)return;p(``);let r=await Bb.setMode(e.path,t);r.ok?(d(t),n()):p(r.error)}let S=e=>r7(e,{setDetail:a,bumpHistory:()=>g(e=>e+1),reload:()=>void _()}),C=i?.proposals??[],w=i?.skill??e;return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,H.jsx)(N,{className:`rtl:-scale-x-100`,"aria-hidden":`true`}),r(`All skills`)]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`min-w-0 break-words text-section-title font-semibold`,children:e.name}),w.modified&&w.lastAppliedAt!==null?(0,H.jsx)(X5,{at:w.lastAppliedAt}):null,e.suggested?(0,H.jsx)(E5,{label:r(`Suggested`),colourKey:`Suggested`}):null,(0,H.jsx)(E5,{label:r(u===`manual`?`Manual`:`Automatic`),colourKey:u})]}),e.path?(0,H.jsx)(`p`,{dir:`ltr`,className:`break-all font-mono text-xs text-start text-muted-foreground`,children:e.path}):(0,H.jsx)(ix,{tone:`info`,children:(0,H.jsx)(`p`,{children:r(`Not in a watched folder`)})}),(0,H.jsx)(`dl`,{className:`grid max-w-xl grid-cols-1 gap-3 text-sm sm:grid-cols-3`,children:[[r(`Uses in 30 days`),Yb(e.uses)],[r(`Failed turns`),Yb(e.failedTurns)],[r(`Last use`),e.lastUsedAt?Zp(e.lastUsedAt):r(`Never`)]].map(([e,t])=>(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:`font-medium`,children:t})]},e))})]}),i?(0,H.jsx)(N8,{className:`max-w-3xl`,rows:cT(sT(i.daily)),title:r(`Uses in the last 30 days`)}):null,e.path?(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":r(`Mode`),children:[(0,H.jsx)(`h3`,{className:`text-section-title font-semibold`,children:r(`Mode`)}),(0,H.jsx)(Y5,{mode:u,disabled:c,onChoose:e=>void x(e)}),f?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:f}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pt-1`,children:[(0,H.jsxs)(G,{type:`button`,size:`sm`,disabled:c,onClick:()=>void b(),children:[(0,H.jsx)(kt,{"aria-hidden":`true`}),r(`Draft improvement`)]}),c?(0,H.jsxs)(`span`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Je,{className:`size-4 animate-spin`,"aria-hidden":`true`}),r(`Drafting… This can take a few minutes.`)]}):null]}),(0,H.jsx)(K5,{notice:m.value})]}):null,(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`skill-proposals-title`,children:[(0,H.jsx)(`h3`,{id:`skill-proposals-title`,className:`text-section-title font-semibold`,children:r(`Proposals`)}),o?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:o}):C.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`No proposals yet.`)}):(0,H.jsx)(W5,{storageKey:H5,proposals:C,onChange:S})]}),(0,H.jsx)(e7,{skill:e,reloadKey:h,onChanged:y}),(0,H.jsx)(t7,{skill:e,reloadKey:h})]})}function a7({folders:e,onChanged:t}){let n=X(),{snapshot:r,busy:i,save:a}=cx(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),u=e.map(e=>e.path),d=r?.settings.skillFolders?.source===`global`;async function f(e){l(``);let n=await a({skillFolders:e});n?l(n):(s(``),t())}return(0,H.jsxs)(`section`,{id:`skills-section-folders`,className:`scroll-mt-4 space-y-3`,"aria-label":n(`Watched folders`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:n(`Watched folders`)}),d?(0,H.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(null),children:[(0,H.jsx)(Ct,{"aria-hidden":`true`}),n(`Reset default`)]}):null]}),e.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`No folders are watched.`)}):(0,H.jsx)(`ul`,{className:`space-y-3`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 rounded-xl border border-border bg-card px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{dir:`ltr`,className:`break-all font-mono text-xs text-start`,children:e.path}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.exists?Vb(n(e.skills===1?`{count} skill`:`{count} skills`),{count:e.skills}):n(`Folder not found`)})]}),(0,H.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:i,"aria-label":Vb(n(`Remove folder {path}`),{path:e.path}),title:n(`Remove folder`),onClick:()=>void f(Qb(u,e.path)),children:(0,H.jsx)(Kt,{"aria-hidden":`true`})})]},e.path))}),(0,H.jsxs)(`form`,{className:`flex flex-wrap items-center gap-3`,onSubmit:e=>{e.preventDefault(),o.trim()&&f(Zb(u,o))},children:[(0,H.jsx)(id,{dir:`ltr`,className:`max-w-md flex-1 basis-60`,value:o,placeholder:`~/.agents/skills`,"aria-label":n(`Folder path`),onChange:e=>s(e.target.value)}),(0,H.jsxs)(G,{type:`submit`,variant:`outline`,size:`sm`,disabled:i||!o.trim(),children:[(0,H.jsx)(ke,{"aria-hidden":`true`}),n(`Add folder`)]})]}),c?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:c}):null]})}function o7({idea:e,folders:t,onDrafted:n}){let r=X(),[i,a]=(0,v.useState)(t[0]?.path??``),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=G5();async function d(){s(!0),u.clear();let t=await Bb.draftNew(e,i);s(!1),u.show(t),t.ok&&t.data.proposal&&(l(t.data.proposal),n())}return(0,H.jsxs)(`li`,{className:`min-w-0 space-y-3 rounded-xl border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`h3`,{className:`break-words text-sm font-semibold`,children:e.name}),(0,H.jsx)(`p`,{className:`text-sm`,dir:`auto`,children:e.description}),e.reason?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,dir:`auto`,children:e.reason}):null,e.evidenceTurnIds.length>0?(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r(`Evidence turns`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,children:e.evidenceTurnIds.map(e=>`T${e}`).join(`, `)})]}):null]}),c?(0,H.jsx)(z5,{proposal:c,onChange:l}):(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,H.jsxs)(`label`,{className:`min-w-0 max-w-full space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:r(`Folder for the new skill`)}),(0,H.jsx)(Er,{value:i,disabled:o,"aria-label":r(`Folder for the new skill`),onChange:e=>a(e.target.value),children:t.map(e=>(0,H.jsx)(`option`,{value:e.path,children:e.path},e.path))})]}),(0,H.jsxs)(G,{type:`button`,size:`sm`,disabled:o||!i,onClick:()=>void d(),children:[(0,H.jsx)(kt,{"aria-hidden":`true`}),r(`Draft skill`)]})]}),(0,H.jsx)(K5,{notice:u.value})]})}function s7({folders:e,onDrafted:t}){let n=X(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),s=G5();async function c(){o(!0),s.clear();let e=await Bb.ideas();o(!1),s.show(e),e.ok&&i(e.data.ideas)}return(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`New skill ideas`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:a,onClick:()=>void c(),children:[(0,H.jsx)(Ge,{"aria-hidden":`true`}),n(`Find new skill ideas`)]}),a?(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:n(`Looking…`)}):null]}),(0,H.jsx)(K5,{notice:s.value}),r&&r.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`No new skill ideas in the recorded turns.`)}):null,r&&r.length>0?(0,H.jsx)(`ul`,{className:`space-y-3`,children:r.map(n=>(0,H.jsx)(o7,{idea:n,folders:e,onDrafted:t},n.name))}):null]})}function c7(e,t){return e.path?t.filter(t=>e.path.startsWith(t.path)).sort((e,t)=>t.path.length-e.path.length)[0]?.path??null:null}function l7({skills:e,folders:t,onOpen:n}){let r=X();return(0,H.jsx)(`ul`,{className:`space-y-3`,children:e.map(e=>{let i=c7(e,t);return(0,H.jsxs)(`li`,{className:`relative`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`w-full min-w-0 space-y-1.5 rounded-xl border border-border bg-card px-3 py-2.5 text-start transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsxs)(`span`,{className:V(`flex flex-wrap items-center gap-2`,e.modified&&`ps-6`),children:[(0,H.jsx)(`span`,{className:`min-w-0 break-words text-sm font-semibold`,children:e.name}),e.suggested?(0,H.jsx)(E5,{label:r(`Suggested`),colourKey:`Suggested`}):null,(0,H.jsx)(E5,{label:r(e.mode===`manual`?`Manual`:`Automatic`),colourKey:e.mode}),e.notInWatchedFolder?(0,H.jsx)(E5,{label:r(`Not in a watched folder`),colourKey:`not-watched`}):null]}),(0,H.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,className:`break-all`,children:i}),` · `]}):null,r(`Uses`),` `,Yb(e.uses),` · `,r(`Failed turns`),` `,Yb(e.failedTurns),` · `,r(`Attention`),` `,e.attention.toFixed(2),` ·`,` `,r(`Last use`),` `,e.lastUsedAt?Zp(e.lastUsedAt):r(`Never`)]})]}),e.modified&&e.lastAppliedAt!==null?(0,H.jsx)(X5,{at:e.lastAppliedAt,className:`absolute start-3 top-3`}):null]},e.path??`name:${e.name}`)})})}function u7({skills:e,folders:t,query:n,modifiedFilter:r=`all`,onOpen:i}){let a=X(),{view:o,pageItems:s}=v5({storageKey:`omms-list-skills`,items:e,sorts:b5,resetKey:`${r}|${n.trim().toLowerCase()}`});return(0,H.jsx)(m5,{view:o,totalLabel:Vb(a(o.total===1?`{count} skill`:`{count} skills`),{count:o.total}),children:(0,H.jsx)(l7,{skills:s,folders:t,onOpen:i})})}var d7=`${J.settings}#settings-section-skill-learning`;function f7(e,t,n,r){return e.trim()?t===0?`No skill matches this name.`:`No skill matches this name in this tab.`:n>0&&r===`modified`?`No skill has been modified yet.`:n>0&&r===`not-modified`?`Every skill has been modified.`:n>0&&r===`suggested`?`No skill is suggested for a change yet.`:`No skills found in the watched folders.`}function p7({overview:e,turns:t,pending:n,recent:r,error:i,query:a,modifiedFilter:o=`all`,reloadKey:s=0,onQuery:c,onModifiedFilter:l=()=>{},onOpen:u,onPendingChange:d,onRecentChange:f,onReload:p}){let m=X(),h=e?.skills??[],g=Hb(h,a),_=tT(g,o),v=e?.folders??[],y=t=>{let n=(e?.skills??[]).find(e=>t.path?e.path===t.path:e.name===t.name);n&&u(n)};return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`max-w-3xl space-y-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(`p`,{children:m(`Skill learning watches how your agents use your skills on Pi, OpenCode and Claude Code. It ranks each skill by use and failed tool calls, and drafts better versions from real turns.`)}),(0,H.jsx)(`p`,{children:m(`Every draft is a proposal with a diff. Nothing changes a SKILL.md file until you apply it, unless you set that skill to Automatic. Undo restores the previous version.`)})]}),e&&!e.recording?(0,H.jsxs)(ix,{tone:`info`,children:[(0,H.jsx)(`p`,{children:m(`Nothing is recorded yet. Agent turns are recorded only after you turn it on.`)}),(0,H.jsx)(`a`,{className:`underline`,href:d7,onClick:e=>{e.preventDefault(),gf(d7)},children:m(`Open the Skill learning card`)})]}):null,i?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:i}):null,(0,H.jsx)(R8,{proposals:[...n,...r],onOpen:y,reloadKey:s}),(0,H.jsxs)(`section`,{id:`skills-section-ranked`,className:`scroll-mt-4 space-y-3`,"aria-label":m(`Skills`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:m(`Ranked skills`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[h.length>0?(0,H.jsx)(U8,{value:o,counts:eT(h),onChange:l}):null,(0,H.jsx)(id,{type:`search`,className:`w-72 max-w-full`,value:a,"aria-label":m(`Filter skills by name`),placeholder:m(`Filter skills by name`),onChange:e=>c(e.target.value)})]})]}),e&&e.recording&&t===0?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m(`No turns are recorded yet.`)}),(0,H.jsx)(ox,{onEnd:p})]}):null,e&&_.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m(f7(a,g.length,h.length,o))}):null,_.length>0?(0,H.jsx)(u7,{skills:_,folders:v,query:a,modifiedFilter:o,onOpen:u}):null]}),(0,H.jsxs)(`section`,{id:`skills-section-pending`,className:`scroll-mt-4 space-y-3`,"aria-label":m(`Pending proposals`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:m(`Pending proposals`)}),n.length>0?(0,H.jsx)(W5,{storageKey:B5,proposals:n,onChange:d}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m(`No proposals are waiting.`)})]}),(0,H.jsxs)(`section`,{id:`skills-section-recent`,className:`scroll-mt-4 space-y-3`,"aria-label":m(`Recent proposals`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:m(`Recent proposals`)}),r.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m(`Each card shows when the proposal was created and when it was last applied, rejected or undone.`)}),(0,H.jsx)(W5,{storageKey:V5,proposals:r,onChange:f})]}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m(`No proposals have been decided yet.`)})]}),e?.recording?(0,H.jsx)(s7,{folders:v,onDrafted:p}):null,(0,H.jsx)(a7,{folders:v,onChanged:p})]})}function m7(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(nT),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(0),y=(0,v.useCallback)(async()=>{let[e,n,i]=await Promise.all([Bb.overview(),Bb.stats(),Bb.proposals()]);if(e.ok?(t(e.data),l(``)):l(e.error),n.ok&&r(n.data.turns),i.ok){let e=i.data.proposals;a(e.filter(e=>e.state===`pending`)),s(Wb(e))}},[]);(0,v.useEffect)(()=>{y()},[y]);let b=()=>{_(e=>e+1),y()},x=vf();return(0,v.useEffect)(()=>{x.includes(`#skills-section-`)&&h(null)},[x]),m?(0,H.jsx)(i7,{skill:m,onBack:()=>{h(null),b()},onChanged:()=>void y()}):(0,H.jsx)(p7,{overview:e,turns:n,pending:i,recent:o,error:c,query:u,modifiedFilter:f,reloadKey:g,onQuery:d,onModifiedFilter:e=>{p(e),rT(e)},onOpen:h,onPendingChange:e=>a(t=>t.map(t=>t.id===e.id?e:t)),onRecentChange:e=>s(t=>t.map(t=>t.id===e.id?e:t)),onReload:b})}function h7({...e}){let t=_p();return(0,H.jsx)(ii,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--color-popover)`,"--normal-text":`var(--color-popover-foreground)`,"--normal-border":`var(--color-border)`},icons:{loading:(0,H.jsx)(qe,{className:`size-4 animate-spin`}),success:(0,H.jsx)(fe,{className:`size-4`}),error:(0,H.jsx)(at,{className:`size-4`}),info:(0,H.jsx)(Be,{className:`size-4`}),warning:(0,H.jsx)(zt,{className:`size-4`})},...e})}function g7(e,t,n){return e?t:n}var _7=[{id:`skills-section-activity`,title:`Activity`},{id:`skills-section-ranked`,title:`Ranked skills`},{id:`skills-section-pending`,title:`Pending proposals`},{id:`skills-section-recent`,title:`Recent proposals`},{id:`skills-section-folders`,title:`Watched folders`}],v7=e=>_7.map(t=>({id:t.id,label:sy(t.title,e)}));function y7(e,t,n){return Xd.map(r=>{let i=sy(r.title,e);return r.id===`shared`?{id:r.id,label:i,avatar:(0,H.jsx)(qx,{className:`size-5 rounded-md`,iconClassName:`size-3`}),items:Zd.map(t=>({id:t.id,label:sy(t.title,e)}))}:{id:r.id,label:i,avatar:(0,H.jsx)(Kx,{host:r.id,look:t[r.id],className:`size-5 rounded-md text-[9px]`}),warning:n}})}function b7(e){let{looks:t}=Hx(),n=pC();return{memoryViewId:dd(vf().split(`#`)[0]),memoryWarningLabel:sy(`Memories not saved`,e),memorySections:y7(e,t,n?.ok===!1)}}var x7=[``,`feature`,`bug-fix`,`refactor`,`architecture`,`rule`,`documentation`,`discussion`,`analysis`,`configuration`];function S7(){let{t:e,language:t}=oa(),n=yf(),r=b7(t),[i,a]=(0,v.useState)(!1),o=sa(),s=ca();(0,v.useEffect)(()=>{let e=_f();(async()=>{await o.loadTags(),await o.loadMemories(),await o.loadStats(),await o.checkMigrationStatus(),await o.checkAuthWarning()})();let t=setInterval(()=>{o.loadStats(),!o.isSearching&&n===`project`&&o.loadMemories()},3e4);return()=>{e(),clearInterval(t)}},[]);let c=s.loadUserProfile;(0,v.useEffect)(()=>{n===`profile`&&c()},[n,c]);function l(e){e!==t&&(ea(e),o.loadMemories(),o.loadStats(),n===`profile`&&s.loadUserProfile())}function u(e){e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),gf(J.home))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h7,{richColors:!0,position:`bottom-right`}),(0,H.jsxs)(`div`,{className:`flex min-h-svh bg-background text-foreground overflow-x-clip`,children:[(0,H.jsx)(jp,{open:i,onOpenChange:a,currentView:n,brand:e(`brand`),projectLabel:e(`tab-project`),profileLabel:e(`tab-profile`),chatLabel:e(`nav-chat`),skillsLabel:e(`nav-skills`),profileSections:[{id:`profile-preferences`,label:e(`profile-preferences`)},{id:`profile-patterns`,label:e(`profile-patterns`)},{id:`profile-workflows`,label:e(`profile-workflows`)}],skillsSections:v7(t),memoryLabel:sy(`Memory`,t),...r,settingsSections:Yv.map(e=>({id:e.id,label:sy(e.title,t)})),langLabel:t.toUpperCase(),languageLabel:e(`nav-language`),themeLabel:e(`nav-theme`),settingsLabel:e(`nav-settings`),closeLabel:e(`nav-close`),collapseLabel:e(`nav-collapse`),expandLabel:e(`nav-expand`),onLanguageSelect:l}),(0,H.jsxs)(`div`,{"data-tooltip-bounds":!0,className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-30 flex items-center gap-2 border-b border-border bg-background/95 px-3 py-2 backdrop-blur md:hidden`,children:[(0,H.jsx)(G,{variant:`ghost`,size:`icon-sm`,className:`min-h-11 min-w-11`,onClick:()=>a(!0),"aria-label":e(`nav-menu`),children:(0,H.jsx)(Ye,{className:`size-4`})}),(0,H.jsx)(`a`,{href:J.home,className:`min-w-0`,onClick:u,children:(0,H.jsx)(Gd,{brand:e(`brand`)})})]}),(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex-1 space-y-4 p-4 md:p-6`,children:[o.showAuthWarning?(0,H.jsxs)(M_,{variant:`destructive`,children:[(0,H.jsx)(zt,{}),(0,H.jsx)(N_,{children:e(`auth-warning-text`)})]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h1`,{className:`text-page-title font-semibold text-foreground`,children:n===`project`?e(`tab-project`):n===`profile`?e(`tab-profile`):n===`memory`?sy(`Memory`,t):e(n===`chat`?`nav-chat`:n===`skills`?`nav-skills`:`nav-settings`)}),n===`project`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:e(`text-total`,{count:g7(o.isSearching,o.totalItems,o.statsTotal)})}),o.refreshing?(0,H.jsx)(Je,{className:`size-3.5 animate-spin`}):null]}):null]}),n===`project`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3 rounded-xl border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 max-w-full space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`tag-filter`,children:e(`label-tag`)}),(0,H.jsxs)(Er,{id:`tag-filter`,className:`w-64 max-w-full`,value:o.selectedTag,onChange:e=>o.onTagFilterChange(e.currentTarget.value),children:[(0,H.jsx)(`option`,{value:``,children:e(`opt-all-tags`)}),o.tags.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(`div`,{className:`min-w-0 max-w-full space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`keyword-filter`,children:e(`label-label-filter`)}),(0,H.jsxs)(Er,{id:`keyword-filter`,className:`w-56 max-w-full`,value:o.selectedKeyword.toLowerCase(),onChange:e=>o.onKeywordFilterChange(e.currentTarget.value),children:[(0,H.jsx)(`option`,{value:``,children:e(`opt-all-labels`)}),o.selectedKeyword&&!o.keywords.some(e=>e.keyword===o.selectedKeyword.toLowerCase())?(0,H.jsxs)(`option`,{value:o.selectedKeyword.toLowerCase(),children:[o.selectedKeyword,` (0)`]}):null,o.keywords.map(e=>(0,H.jsxs)(`option`,{value:e.keyword,children:[e.keyword,` (`,e.count,`)`]},e.keyword))]})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 items-end gap-1.5 min-w-0 basis-56`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`search-input`,className:`sr-only`,children:e(`placeholder-search`)}),(0,H.jsx)(id,{id:`search-input`,placeholder:e(`placeholder-search`),value:o.searchInput,onChange:e=>o.setSearchInput(e.target.value),onKeyDown:e=>e.key===`Enter`&&o.performSearch()})]}),(0,H.jsx)(G,{variant:`outline`,size:`icon`,onClick:o.performSearch,children:(0,H.jsx)(Tt,{className:`size-4`})}),o.isSearching?(0,H.jsx)(G,{variant:`outline`,size:`icon`,onClick:o.clearSearch,children:(0,H.jsx)(Kt,{className:`size-4`})}):null]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,H.jsx)(Vp,{content:e(`tooltip-cleanup`),children:(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:o.runCleanup,children:[(0,H.jsx)(Rt,{className:`size-3.5`}),e(`btn-cleanup`)]})}),(0,H.jsx)(Vp,{content:e(`tooltip-deduplicate`),children:(0,H.jsxs)(G,{variant:`outline`,size:`sm`,onClick:o.runDeduplication,children:[(0,H.jsx)(bt,{className:`size-3.5`}),e(`btn-deduplicate`)]})})]}),o.selectedIds.size>0?(0,H.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 border-t border-border pt-3`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`text-selected`,{count:o.selectedIds.size})}),(0,H.jsx)(G,{variant:`secondary`,size:`xs`,onClick:o.selectAllCurrentPage,children:e(`btn-select-all`)}),(0,H.jsx)(G,{variant:`destructive`,size:`xs`,onClick:o.bulkDelete,children:e(`btn-delete-selected`)}),(0,H.jsx)(G,{variant:`ghost`,size:`xs`,onClick:o.deselectAll,children:e(`btn-deselect-all`)})]}):null]}),o.migrationNeeded?(0,H.jsxs)(M_,{variant:`destructive`,className:`space-y-3`,children:[(0,H.jsx)(zt,{}),(0,H.jsxs)(N_,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{children:o.migrationMessage||e(`migration-mismatch`)}),(0,H.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,H.jsx)(Qo,{checked:o.migrationConfirmed,onCheckedChange:e=>o.setMigrationConfirmed(e===!0),className:`mt-0.5`}),(0,H.jsx)(`span`,{children:e(`migration-understand`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(G,{variant:`destructive`,size:`sm`,disabled:!o.migrationConfirmed,onClick:()=>o.runMigration(`fresh-start`),children:e(`btn-fresh-start`)}),(0,H.jsx)(G,{variant:`secondary`,size:`sm`,disabled:!o.migrationConfirmed,onClick:()=>o.runMigration(`re-embed`),children:e(`btn-reembed`)})]})]})]}):null,(0,H.jsx)(C_,{memories:o.memories,selectedIds:o.selectedIds,currentPage:o.currentPage,totalPages:o.totalPages,totalItems:o.totalItems,isSearching:o.isSearching,loading:o.loadingMemories,error:o.memoriesError,onSelect:o.onSelect,onPageChange:e=>{let t=o.currentPage+e;o.setCurrentPage(t),o.loadMemories({page:t})},onPin:o.pinMemory,onUnpin:o.unpinMemory,onEdit:o.openEdit,onDeleteMemory:o.deleteMemory,onDeletePrompt:o.deletePrompt,activeKeyword:o.selectedKeyword,onKeywordClick:e=>o.onKeywordFilterChange(o.selectedKeyword.toLowerCase()===e.toLowerCase()?``:e)}),(0,H.jsxs)(`section`,{className:`rounded-xl border border-border bg-card p-4 space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold text-muted-foreground`,children:e(`section-add`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:o.addMemory,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-tag`,children:e(`label-tag`)}),(0,H.jsxs)(Er,{id:`add-tag`,required:!0,className:`w-full`,value:o.addTag,onChange:e=>o.setAddTag(e.target.value),children:[(0,H.jsx)(`option`,{value:``,children:e(`opt-select-tag`)}),o.tags.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-type`,children:e(`label-type`)}),(0,H.jsx)(Er,{id:`add-type`,className:`w-full`,value:o.addType,onChange:e=>o.setAddType(e.target.value),children:x7.map(t=>(0,H.jsx)(`option`,{value:t,children:e(t?`opt-${t}`:`opt-other`)},t||`other`))})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-tags`,children:e(`label-tags`)}),(0,H.jsx)(id,{id:`add-tags`,placeholder:e(`placeholder-tags`),value:o.addTags,onChange:e=>o.setAddTags(e.target.value)})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(Pp,{htmlFor:`add-content`,children:e(`label-content`)}),(0,H.jsx)(Fp,{id:`add-content`,rows:4,required:!0,placeholder:e(`placeholder-content`),value:o.addContent,onChange:e=>o.setAddContent(e.target.value)})]}),(0,H.jsxs)(G,{type:`submit`,children:[(0,H.jsx)(_t,{className:`size-3.5`}),e(`btn-add-memory`)]})]})]})]}):n===`memory`?(0,H.jsx)(dw,{}):n===`chat`?(0,H.jsx)(Zw,{}):n===`skills`?(0,H.jsx)(m7,{}):n===`settings`?(0,H.jsx)(px,{}):(0,H.jsx)(qv,{profile:s.userProfile,loading:s.loadingProfile,onRefresh:s.refreshProfile,onCleanup:()=>s.setAiCleanupOpen(!0),onCategoryCleanup:()=>s.setCategoryCleanupOpen(!0),categoryCleanupOpen:s.categoryCleanupOpen})]})]})]}),(0,H.jsx)(Ip,{open:o.editOpen,onOpenChange:o.setEditOpen,content:o.editContent,onSave:o.saveEdit}),(0,H.jsx)(Jv,{open:o.tagMigrationOpen,onOpenChange:e=>{e||hi(o.tagMigrationCount),o.setTagMigrationOpen(e)},count:o.tagMigrationCount,onComplete:()=>{gi(),o.loadMemories(),o.loadStats()}}),(0,H.jsx)(Ju,{open:s.aiCleanupOpen,onOpenChange:s.setAiCleanupOpen,onMinimise:s.minimiseAiCleanup,profile:s.userProfile,onApplied:s.loadUserProfile}),s.aiCleanupMinimised?(0,H.jsx)(Yu,{onOpen:()=>s.setAiCleanupOpen(!0),onGone:s.dismissAiCleanupPill}):null,(0,H.jsx)(sd,{open:s.categoryCleanupOpen,onOpenChange:s.setCategoryCleanupOpen,onApplied:s.loadUserProfile})]})}gp();var C7=document.getElementById(`app`);if(!C7)throw Error(`Root element #app not found`);(0,y.createRoot)(C7).render((0,H.jsx)(v.StrictMode,{children:(0,H.jsx)(aa,{children:(0,H.jsx)(S7,{})})}));